diff --git a/assets/furniture/houseplan-0.3.0/README.md b/assets/furniture/houseplan-0.3.0/README.md deleted file mode 100644 index 643fa0d6..00000000 --- a/assets/furniture/houseplan-0.3.0/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# House Plan furniture pack 0.3.0 - -Canonical source artwork for the built-in House Plan furniture library. - -- `svg/menu/`: 33 front-view category illustrations used only by the lazy - editor bundle. -- `svg/plan/`: 44 top-view drawings used on the plan. -- `pack.json`: stable ids, category links, default dimensions and names. The - filename deliberately avoids the `*manifest.json` suffix reserved by HACS. - -The original author, Sergey Matyunin (`Matysh`), granted House Plan permission -to use, modify and distribute all 77 SVG files under the repository MIT -License without separate UI attribution in -[issue #159](https://github.com/Matysh/houseplan-card/issues/159#issuecomment-5454085168). - -The reviewed source archive is `houseplan-furniture-custom-0.3.0.zip`, attached -to [issue #159](https://github.com/Matysh/houseplan-card/issues/159#issuecomment-5449707137), -with SHA-256 -`9E969016EE3B4B4E3DB776FEC53C8B387B91368B118EB5E39911483DEF1B0953`. - -The editable source is linked from `pack.json`. Generated TypeScript must -not be edited by hand; run `npm run furniture:generate` after changing this -directory. - -Note (#369): the source archive referenced by the SHA-256 above may still -carry the earlier romanisation of the author's name; the authoritative -spelling is Sergey Matyunin (Сергей Матюнин), fixed 2026-08-29 by the -owner's decision in issue #369. The archive bytes are unchanged. diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/air_conditioner.svg b/assets/furniture/houseplan-0.3.0/svg/menu/air_conditioner.svg deleted file mode 100644 index 3b03c1e9..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/air_conditioner.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/armchair.svg b/assets/furniture/houseplan-0.3.0/svg/menu/armchair.svg deleted file mode 100644 index 4326c7c7..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/armchair.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/bathtub.svg b/assets/furniture/houseplan-0.3.0/svg/menu/bathtub.svg deleted file mode 100644 index 89707558..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/bathtub.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/bed.svg b/assets/furniture/houseplan-0.3.0/svg/menu/bed.svg deleted file mode 100644 index 3dfcdeb2..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/bed.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/bidet.svg b/assets/furniture/houseplan-0.3.0/svg/menu/bidet.svg deleted file mode 100644 index 96b19560..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/bidet.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/boiler.svg b/assets/furniture/houseplan-0.3.0/svg/menu/boiler.svg deleted file mode 100644 index 867c62bd..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/boiler.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/chair.svg b/assets/furniture/houseplan-0.3.0/svg/menu/chair.svg deleted file mode 100644 index d0fe866b..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/chair.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/coffee_table.svg b/assets/furniture/houseplan-0.3.0/svg/menu/coffee_table.svg deleted file mode 100644 index 61712004..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/coffee_table.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/computer.svg b/assets/furniture/houseplan-0.3.0/svg/menu/computer.svg deleted file mode 100644 index 3a87cf53..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/computer.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/cooktop.svg b/assets/furniture/houseplan-0.3.0/svg/menu/cooktop.svg deleted file mode 100644 index 3396dcb3..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/cooktop.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/dining_table.svg b/assets/furniture/houseplan-0.3.0/svg/menu/dining_table.svg deleted file mode 100644 index 18c7044c..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/dining_table.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/dishwasher.svg b/assets/furniture/houseplan-0.3.0/svg/menu/dishwasher.svg deleted file mode 100644 index 001a2f4c..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/dishwasher.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/dryer.svg b/assets/furniture/houseplan-0.3.0/svg/menu/dryer.svg deleted file mode 100644 index 1c6035be..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/dryer.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/exercise.svg b/assets/furniture/houseplan-0.3.0/svg/menu/exercise.svg deleted file mode 100644 index 4f251765..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/exercise.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/fireplace.svg b/assets/furniture/houseplan-0.3.0/svg/menu/fireplace.svg deleted file mode 100644 index ef19e073..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/fireplace.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/fridge.svg b/assets/furniture/houseplan-0.3.0/svg/menu/fridge.svg deleted file mode 100644 index fd77f06a..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/fridge.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/hood.svg b/assets/furniture/houseplan-0.3.0/svg/menu/hood.svg deleted file mode 100644 index 7608b32f..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/hood.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/kitchen_cabinet.svg b/assets/furniture/houseplan-0.3.0/svg/menu/kitchen_cabinet.svg deleted file mode 100644 index 086a37a4..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/kitchen_cabinet.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/kitchen_sink.svg b/assets/furniture/houseplan-0.3.0/svg/menu/kitchen_sink.svg deleted file mode 100644 index 209369a3..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/kitchen_sink.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/nightstand.svg b/assets/furniture/houseplan-0.3.0/svg/menu/nightstand.svg deleted file mode 100644 index 5735a814..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/nightstand.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/oven.svg b/assets/furniture/houseplan-0.3.0/svg/menu/oven.svg deleted file mode 100644 index 0440a008..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/oven.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/plant.svg b/assets/furniture/houseplan-0.3.0/svg/menu/plant.svg deleted file mode 100644 index 5b118934..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/plant.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/rug.svg b/assets/furniture/houseplan-0.3.0/svg/menu/rug.svg deleted file mode 100644 index 7f90443e..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/rug.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/shelving.svg b/assets/furniture/houseplan-0.3.0/svg/menu/shelving.svg deleted file mode 100644 index 540c7163..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/shelving.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/shower.svg b/assets/furniture/houseplan-0.3.0/svg/menu/shower.svg deleted file mode 100644 index 343fa7e2..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/shower.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/sink.svg b/assets/furniture/houseplan-0.3.0/svg/menu/sink.svg deleted file mode 100644 index b7f286f3..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/sink.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/sofa.svg b/assets/furniture/houseplan-0.3.0/svg/menu/sofa.svg deleted file mode 100644 index 7309f4fe..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/sofa.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/stairs.svg b/assets/furniture/houseplan-0.3.0/svg/menu/stairs.svg deleted file mode 100644 index e18cf556..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/stairs.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/toilet.svg b/assets/furniture/houseplan-0.3.0/svg/menu/toilet.svg deleted file mode 100644 index 33016688..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/toilet.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/tv.svg b/assets/furniture/houseplan-0.3.0/svg/menu/tv.svg deleted file mode 100644 index 04036687..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/tv.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/wardrobe.svg b/assets/furniture/houseplan-0.3.0/svg/menu/wardrobe.svg deleted file mode 100644 index fb0e4d2f..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/wardrobe.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/washer.svg b/assets/furniture/houseplan-0.3.0/svg/menu/washer.svg deleted file mode 100644 index 0d8f96a0..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/washer.svg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/menu/work_table.svg b/assets/furniture/houseplan-0.3.0/svg/menu/work_table.svg deleted file mode 100644 index 2ca3d9f5..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/menu/work_table.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/armchair.svg b/assets/furniture/houseplan-0.3.0/svg/plan/armchair.svg deleted file mode 100644 index 68057f10..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/armchair.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/armchair_office.svg b/assets/furniture/houseplan-0.3.0/svg/plan/armchair_office.svg deleted file mode 100644 index 273ebdff..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/armchair_office.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/bathtub.svg b/assets/furniture/houseplan-0.3.0/svg/plan/bathtub.svg deleted file mode 100644 index 9a4e1ede..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/bathtub.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/bathtub_corner.svg b/assets/furniture/houseplan-0.3.0/svg/plan/bathtub_corner.svg deleted file mode 100644 index 25cff43b..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/bathtub_corner.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/bed_double.svg b/assets/furniture/houseplan-0.3.0/svg/plan/bed_double.svg deleted file mode 100644 index ffd7e06e..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/bed_double.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/bed_single.svg b/assets/furniture/houseplan-0.3.0/svg/plan/bed_single.svg deleted file mode 100644 index 55134825..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/bed_single.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/bidet.svg b/assets/furniture/houseplan-0.3.0/svg/plan/bidet.svg deleted file mode 100644 index 257246e7..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/bidet.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/bidet_built_in.svg b/assets/furniture/houseplan-0.3.0/svg/plan/bidet_built_in.svg deleted file mode 100644 index 158877b6..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/bidet_built_in.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/bookshelf.svg b/assets/furniture/houseplan-0.3.0/svg/plan/bookshelf.svg deleted file mode 100644 index f46904ff..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/bookshelf.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/cabinet_shoe.svg b/assets/furniture/houseplan-0.3.0/svg/plan/cabinet_shoe.svg deleted file mode 100644 index 6fd3dbc6..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/cabinet_shoe.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/cabinet_sink.svg b/assets/furniture/houseplan-0.3.0/svg/plan/cabinet_sink.svg deleted file mode 100644 index ebeca1c8..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/cabinet_sink.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/cabinet_tv.svg b/assets/furniture/houseplan-0.3.0/svg/plan/cabinet_tv.svg deleted file mode 100644 index e703245c..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/cabinet_tv.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/chair.svg b/assets/furniture/houseplan-0.3.0/svg/plan/chair.svg deleted file mode 100644 index df332c9d..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/chair.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/chair_bar.svg b/assets/furniture/houseplan-0.3.0/svg/plan/chair_bar.svg deleted file mode 100644 index 5c0b067a..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/chair_bar.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/coffee_table.svg b/assets/furniture/houseplan-0.3.0/svg/plan/coffee_table.svg deleted file mode 100644 index 41d9f0de..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/coffee_table.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/coffee_table_oval.svg b/assets/furniture/houseplan-0.3.0/svg/plan/coffee_table_oval.svg deleted file mode 100644 index d9e9c805..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/coffee_table_oval.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/coffee_table_round.svg b/assets/furniture/houseplan-0.3.0/svg/plan/coffee_table_round.svg deleted file mode 100644 index c2c05b0b..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/coffee_table_round.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/coffee_table_rounded.svg b/assets/furniture/houseplan-0.3.0/svg/plan/coffee_table_rounded.svg deleted file mode 100644 index 791df0e8..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/coffee_table_rounded.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/cooktop_two.svg b/assets/furniture/houseplan-0.3.0/svg/plan/cooktop_two.svg deleted file mode 100644 index 8aff1d65..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/cooktop_two.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/desk.svg b/assets/furniture/houseplan-0.3.0/svg/plan/desk.svg deleted file mode 100644 index a40e7f80..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/desk.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/desk_corner.svg b/assets/furniture/houseplan-0.3.0/svg/plan/desk_corner.svg deleted file mode 100644 index eddb053c..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/desk_corner.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/kitchen_floor.svg b/assets/furniture/houseplan-0.3.0/svg/plan/kitchen_floor.svg deleted file mode 100644 index 01a42e9c..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/kitchen_floor.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/kitchen_floor_corner.svg b/assets/furniture/houseplan-0.3.0/svg/plan/kitchen_floor_corner.svg deleted file mode 100644 index 6e7e013d..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/kitchen_floor_corner.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/kitchen_sink.svg b/assets/furniture/houseplan-0.3.0/svg/plan/kitchen_sink.svg deleted file mode 100644 index e6e8bd65..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/kitchen_sink.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/kitchen_sink_double.svg b/assets/furniture/houseplan-0.3.0/svg/plan/kitchen_sink_double.svg deleted file mode 100644 index 573f58f3..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/kitchen_sink_double.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/kitchen_wall.svg b/assets/furniture/houseplan-0.3.0/svg/plan/kitchen_wall.svg deleted file mode 100644 index 1c38cf6f..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/kitchen_wall.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/kitchen_wall_corner.svg b/assets/furniture/houseplan-0.3.0/svg/plan/kitchen_wall_corner.svg deleted file mode 100644 index b6300e7c..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/kitchen_wall_corner.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/nightstand.svg b/assets/furniture/houseplan-0.3.0/svg/plan/nightstand.svg deleted file mode 100644 index bec9aebd..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/nightstand.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/shelf_floor.svg b/assets/furniture/houseplan-0.3.0/svg/plan/shelf_floor.svg deleted file mode 100644 index e8933f9c..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/shelf_floor.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/shelf_wall.svg b/assets/furniture/houseplan-0.3.0/svg/plan/shelf_wall.svg deleted file mode 100644 index 6a4ce5a4..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/shelf_wall.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/sofa.svg b/assets/furniture/houseplan-0.3.0/svg/plan/sofa.svg deleted file mode 100644 index dbb5775f..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/sofa.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/sofa_corner_right.svg b/assets/furniture/houseplan-0.3.0/svg/plan/sofa_corner_right.svg deleted file mode 100644 index 2fbc4da2..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/sofa_corner_right.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/sofa_three_seat.svg b/assets/furniture/houseplan-0.3.0/svg/plan/sofa_three_seat.svg deleted file mode 100644 index f7dcdd89..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/sofa_three_seat.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/stove.svg b/assets/furniture/houseplan-0.3.0/svg/plan/stove.svg deleted file mode 100644 index 0d8c6a22..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/stove.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/table_dining.svg b/assets/furniture/houseplan-0.3.0/svg/plan/table_dining.svg deleted file mode 100644 index 8ee05bc0..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/table_dining.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/table_dining_oval.svg b/assets/furniture/houseplan-0.3.0/svg/plan/table_dining_oval.svg deleted file mode 100644 index 56fd832d..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/table_dining_oval.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/table_dining_rounded.svg b/assets/furniture/houseplan-0.3.0/svg/plan/table_dining_rounded.svg deleted file mode 100644 index 5dec469d..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/table_dining_rounded.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/table_round.svg b/assets/furniture/houseplan-0.3.0/svg/plan/table_round.svg deleted file mode 100644 index cbef2a30..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/table_round.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/toilet.svg b/assets/furniture/houseplan-0.3.0/svg/plan/toilet.svg deleted file mode 100644 index d26c3cfb..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/toilet.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/toilet_built_in.svg b/assets/furniture/houseplan-0.3.0/svg/plan/toilet_built_in.svg deleted file mode 100644 index 3054bdef..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/toilet_built_in.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/tv.svg b/assets/furniture/houseplan-0.3.0/svg/plan/tv.svg deleted file mode 100644 index 79ea0dd5..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/tv.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/tv_wall.svg b/assets/furniture/houseplan-0.3.0/svg/plan/tv_wall.svg deleted file mode 100644 index 8db12a06..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/tv_wall.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/wall_unit.svg b/assets/furniture/houseplan-0.3.0/svg/plan/wall_unit.svg deleted file mode 100644 index 547551d4..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/wall_unit.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/svg/plan/wardrobe.svg b/assets/furniture/houseplan-0.3.0/svg/plan/wardrobe.svg deleted file mode 100644 index c4a90558..00000000 --- a/assets/furniture/houseplan-0.3.0/svg/plan/wardrobe.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/assets/furniture/houseplan-0.3.0/LICENSE.md b/assets/furniture/houseplan-0.4.0/LICENSE.md similarity index 95% rename from assets/furniture/houseplan-0.3.0/LICENSE.md rename to assets/furniture/houseplan-0.4.0/LICENSE.md index 00498bbb..df61c8db 100644 --- a/assets/furniture/houseplan-0.3.0/LICENSE.md +++ b/assets/furniture/houseplan-0.4.0/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2026 Sergey Matyunin (Matysh) +Copyright (c) 2026 JB (justbusiness) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/assets/furniture/houseplan-0.4.0/README.md b/assets/furniture/houseplan-0.4.0/README.md new file mode 100644 index 00000000..1ea326c7 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/README.md @@ -0,0 +1,37 @@ +# House Plan furniture pack 0.4.0 + +Canonical source artwork for the built-in House Plan furniture library. + +- `svg/menu/`: 33 front-view category illustrations used only by the lazy + editor bundle. +- `svg/plan/`: 60 top-view drawings used on the plan. +- `pack.json`: stable ids, category links, default dimensions and names. The + filename deliberately avoids the `*manifest.json` suffix reserved by HACS. + +This release replaces pack 0.3.0 together with its 12 retained code-drawn +primitives: every public symbol is now designer artwork, and `computer`, +`hood`, `oven` and `cactus` are new ids (#593). + +The original author, Sergey Matyunin (`Matysh`), granted House Plan permission +to use, modify and distribute all 93 SVG files under the repository MIT +License without separate UI attribution in +[issue #593](https://github.com/Matysh/houseplan-card/issues/593#issuecomment-5739841899). + +The reviewed source archive is `houseplan-furniture-0.4.0.zip`, attached to +[issue #593](https://github.com/Matysh/houseplan-card/issues/593), with SHA-256 +`69BA5E0C398542D59F24269F637F57B8EBF31C2836C9D493F084AD29AB299FDE`. + +`LICENSE.md` of this pack carries the copyright line `JB (justbusiness)`. That +is the same author under his own domain, not a third party; the authoritative +spelling of the name is Sergey Matyunin (Сергей Матюнин), fixed 2026-08-29 by +the owner's decision in issue #369. + +One field differs from the archive on purpose: `symbols[cactus].menu_icon` is +`plant`, not `exercise`. The `exercise` category tile draws an exercise +machine, so opening it onto a cactus would misdescribe the palette. `exercise` +therefore stays an empty, hidden category and 32 of the 33 categories are +populated (owner's decision in #593). + +The editable source is linked from `pack.json`. Generated TypeScript must +not be edited by hand; run `npm run furniture:generate` after changing this +directory. diff --git a/assets/furniture/houseplan-0.3.0/pack.json b/assets/furniture/houseplan-0.4.0/pack.json similarity index 55% rename from assets/furniture/houseplan-0.3.0/pack.json rename to assets/furniture/houseplan-0.4.0/pack.json index d2aa9336..e7b83995 100644 --- a/assets/furniture/houseplan-0.3.0/pack.json +++ b/assets/furniture/houseplan-0.4.0/pack.json @@ -2,7 +2,7 @@ "schema_version": 1, "view_schema": 2, "pack_id": "houseplan", - "pack_version": "0.3.0", + "pack_version": "0.4.0", "title_ru": "Набор мебели: меню и план", "title_en": "Furniture pack: menu and plan", "author": "Sergey Matyunin (Matysh)", @@ -253,11 +253,11 @@ "back": "top", "file": "svg/plan/coffee_table.svg", "menu_icon": "coffee_table", - "notes": "Типовой размер; свободно стоящий предмет." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "coffee_table_round", - "operation": "add", + "operation": "replace", "name_ru": "Журнальный стол, круглый", "name_en": "Round coffee table", "group": "furniture", @@ -266,11 +266,11 @@ "back": "top", "file": "svg/plan/coffee_table_round.svg", "menu_icon": "coffee_table", - "notes": "Круглый свободно стоящий предмет." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "coffee_table_oval", - "operation": "add", + "operation": "replace", "name_ru": "Журнальный стол, овальный", "name_en": "Oval coffee table", "group": "furniture", @@ -279,11 +279,11 @@ "back": "top", "file": "svg/plan/coffee_table_oval.svg", "menu_icon": "coffee_table", - "notes": "Свободно стоящий предмет." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "coffee_table_rounded", - "operation": "add", + "operation": "replace", "name_ru": "Журнальный стол, скруглённый", "name_en": "Rounded coffee table", "group": "furniture", @@ -292,7 +292,7 @@ "back": "top", "file": "svg/plan/coffee_table_rounded.svg", "menu_icon": "coffee_table", - "notes": "Прямоугольная форма со скруглёнными углами." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "table_dining", @@ -305,7 +305,7 @@ "back": "top", "file": "svg/plan/table_dining.svg", "menu_icon": "dining_table", - "notes": "Типовой стол на 4–6 мест." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "table_round", @@ -318,11 +318,11 @@ "back": "top", "file": "svg/plan/table_round.svg", "menu_icon": "dining_table", - "notes": "Круглый стол на 4 места." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "table_dining_oval", - "operation": "add", + "operation": "replace", "name_ru": "Обеденный стол, овальный", "name_en": "Oval dining table", "group": "furniture", @@ -331,11 +331,11 @@ "back": "top", "file": "svg/plan/table_dining_oval.svg", "menu_icon": "dining_table", - "notes": "Овальный стол на 6 мест." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "table_dining_rounded", - "operation": "add", + "operation": "replace", "name_ru": "Обеденный стол, скруглённый", "name_en": "Rounded dining table", "group": "furniture", @@ -344,7 +344,7 @@ "back": "top", "file": "svg/plan/table_dining_rounded.svg", "menu_icon": "dining_table", - "notes": "Прямоугольная форма со скруглёнными углами." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "desk", @@ -357,11 +357,11 @@ "back": "top", "file": "svg/plan/desk.svg", "menu_icon": "work_table", - "notes": "BACK — длинная сторона у стены." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "desk_corner", - "operation": "add", + "operation": "replace", "name_ru": "Рабочий стол, угловой", "name_en": "Corner desk", "group": "furniture", @@ -370,7 +370,7 @@ "back": "top", "file": "svg/plan/desk_corner.svg", "menu_icon": "work_table", - "notes": "Угловой стол; основная задняя сторона направлена вверх." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "chair", @@ -383,11 +383,11 @@ "back": "top", "file": "svg/plan/chair.svg", "menu_icon": "chair", - "notes": "Спинка находится сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "chair_bar", - "operation": "add", + "operation": "replace", "name_ru": "Барный стул", "name_en": "Bar stool", "group": "furniture", @@ -396,7 +396,7 @@ "back": "top", "file": "svg/plan/chair_bar.svg", "menu_icon": "chair", - "notes": "Спинка находится сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "armchair", @@ -409,11 +409,11 @@ "back": "top", "file": "svg/plan/armchair.svg", "menu_icon": "armchair", - "notes": "Спинка находится сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "armchair_office", - "operation": "add", + "operation": "replace", "name_ru": "Кресло офисное", "name_en": "Office chair", "group": "furniture", @@ -422,7 +422,7 @@ "back": "top", "file": "svg/plan/armchair_office.svg", "menu_icon": "armchair", - "notes": "Спинка находится сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "sofa", @@ -435,11 +435,11 @@ "back": "top", "file": "svg/plan/sofa.svg", "menu_icon": "sofa", - "notes": "Спинка находится сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "sofa_three_seat", - "operation": "add", + "operation": "replace", "name_ru": "Диван трёхместный", "name_en": "Three-seat sofa", "group": "furniture", @@ -448,11 +448,11 @@ "back": "top", "file": "svg/plan/sofa_three_seat.svg", "menu_icon": "sofa", - "notes": "Спинка находится сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "sofa_corner_right", - "operation": "add", + "operation": "replace", "name_ru": "Угловой диван, правый", "name_en": "Right sectional sofa", "group": "furniture", @@ -461,7 +461,7 @@ "back": "top", "file": "svg/plan/sofa_corner_right.svg", "menu_icon": "sofa", - "notes": "Шезлонг справа при взгляде сверху; спинка сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "bed_single", @@ -474,7 +474,7 @@ "back": "top", "file": "svg/plan/bed_single.svg", "menu_icon": "bed", - "notes": "Узкая кровать с одной подушкой; изголовье сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "bed_double", @@ -487,7 +487,7 @@ "back": "top", "file": "svg/plan/bed_double.svg", "menu_icon": "bed", - "notes": "Широкая кровать с двумя подушками; изголовье сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "nightstand", @@ -500,11 +500,11 @@ "back": "top", "file": "svg/plan/nightstand.svg", "menu_icon": "nightstand", - "notes": "Задняя сторона сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "cabinet_tv", - "operation": "add", + "operation": "replace", "name_ru": "Тумба под телевизор", "name_en": "TV cabinet", "group": "furniture", @@ -513,11 +513,11 @@ "back": "top", "file": "svg/plan/cabinet_tv.svg", "menu_icon": "nightstand", - "notes": "Задняя длинная сторона сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "cabinet_shoe", - "operation": "add", + "operation": "replace", "name_ru": "Тумба для обуви", "name_en": "Shoe cabinet", "group": "furniture", @@ -526,11 +526,11 @@ "back": "top", "file": "svg/plan/cabinet_shoe.svg", "menu_icon": "nightstand", - "notes": "Задняя сторона сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "cabinet_sink", - "operation": "add", + "operation": "replace", "name_ru": "Тумба под раковину", "name_en": "Sink cabinet", "group": "furniture", @@ -539,7 +539,7 @@ "back": "top", "file": "svg/plan/cabinet_sink.svg", "menu_icon": "nightstand", - "notes": "Задняя сторона сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "bookshelf", @@ -552,11 +552,11 @@ "back": "top", "file": "svg/plan/bookshelf.svg", "menu_icon": "wardrobe", - "notes": "Задняя длинная сторона сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "wall_unit", - "operation": "add", + "operation": "replace", "name_ru": "Шкаф-стенка", "name_en": "Wall unit", "group": "furniture", @@ -565,7 +565,7 @@ "back": "top", "file": "svg/plan/wall_unit.svg", "menu_icon": "wardrobe", - "notes": "Задняя длинная сторона сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "wardrobe", @@ -578,11 +578,11 @@ "back": "top", "file": "svg/plan/wardrobe.svg", "menu_icon": "wardrobe", - "notes": "Задняя длинная сторона сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "kitchen_floor", - "operation": "add", + "operation": "replace", "name_ru": "Кухонный напольный модуль", "name_en": "Kitchen floor module", "group": "furniture", @@ -591,11 +591,11 @@ "back": "top", "file": "svg/plan/kitchen_floor.svg", "menu_icon": "kitchen_cabinet", - "notes": "Задняя сторона сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "kitchen_floor_corner", - "operation": "add", + "operation": "replace", "name_ru": "Кухонный напольный угловой модуль", "name_en": "Kitchen floor corner module", "group": "furniture", @@ -604,11 +604,11 @@ "back": "top", "file": "svg/plan/kitchen_floor_corner.svg", "menu_icon": "kitchen_cabinet", - "notes": "Угловой модуль; основной BACK сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "kitchen_wall", - "operation": "add", + "operation": "replace", "name_ru": "Кухонный навесной модуль", "name_en": "Kitchen wall module", "group": "furniture", @@ -617,11 +617,11 @@ "back": "top", "file": "svg/plan/kitchen_wall.svg", "menu_icon": "kitchen_cabinet", - "notes": "Задняя сторона сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "kitchen_wall_corner", - "operation": "add", + "operation": "replace", "name_ru": "Кухонный навесной угловой модуль", "name_en": "Kitchen wall corner module", "group": "furniture", @@ -630,11 +630,11 @@ "back": "top", "file": "svg/plan/kitchen_wall_corner.svg", "menu_icon": "kitchen_cabinet", - "notes": "Угловой модуль; основной BACK сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "shelf_floor", - "operation": "add", + "operation": "replace", "name_ru": "Стеллаж напольный", "name_en": "Floor shelving unit", "group": "furniture", @@ -643,11 +643,11 @@ "back": "top", "file": "svg/plan/shelf_floor.svg", "menu_icon": "shelving", - "notes": "Задняя длинная сторона сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "shelf_wall", - "operation": "add", + "operation": "replace", "name_ru": "Полка настенная", "name_en": "Wall shelf", "group": "furniture", @@ -656,11 +656,11 @@ "back": "top", "file": "svg/plan/shelf_wall.svg", "menu_icon": "shelving", - "notes": "Задняя длинная сторона сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "cooktop_two", - "operation": "add", + "operation": "replace", "name_ru": "Варочная панель, 2 конфорки", "name_en": "Two-burner cooktop", "group": "appliance", @@ -669,7 +669,7 @@ "back": "top", "file": "svg/plan/cooktop_two.svg", "menu_icon": "cooktop", - "notes": "Панель ориентирована управляющей стороной вниз." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "stove", @@ -682,7 +682,7 @@ "back": "top", "file": "svg/plan/stove.svg", "menu_icon": "cooktop", - "notes": "Панель ориентирована управляющей стороной вниз." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "tv", @@ -695,11 +695,11 @@ "back": "top", "file": "svg/plan/tv.svg", "menu_icon": "tv", - "notes": "Задняя сторона экрана сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "tv_wall", - "operation": "add", + "operation": "replace", "name_ru": "Телевизор на кронштейне", "name_en": "Wall-mounted TV", "group": "appliance", @@ -708,7 +708,7 @@ "back": "top", "file": "svg/plan/tv_wall.svg", "menu_icon": "tv", - "notes": "Сторона крепления к стене сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "toilet", @@ -721,11 +721,11 @@ "back": "top", "file": "svg/plan/toilet.svg", "menu_icon": "toilet", - "notes": "Сторона подключения к стене сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "toilet_built_in", - "operation": "add", + "operation": "replace", "name_ru": "Унитаз встроенный", "name_en": "Built-in toilet", "group": "sanitary", @@ -734,7 +734,7 @@ "back": "top", "file": "svg/plan/toilet_built_in.svg", "menu_icon": "toilet", - "notes": "Инсталляция находится сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "bathtub", @@ -747,11 +747,11 @@ "back": "top", "file": "svg/plan/bathtub.svg", "menu_icon": "bathtub", - "notes": "Длинная задняя сторона сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "bathtub_corner", - "operation": "add", + "operation": "replace", "name_ru": "Ванна угловая", "name_en": "Corner bathtub", "group": "sanitary", @@ -760,7 +760,7 @@ "back": "top", "file": "svg/plan/bathtub_corner.svg", "menu_icon": "bathtub", - "notes": "Угловая ванна; основной BACK сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "bidet", @@ -773,11 +773,11 @@ "back": "top", "file": "svg/plan/bidet.svg", "menu_icon": "bidet", - "notes": "Сторона подключения к стене сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "bidet_built_in", - "operation": "add", + "operation": "replace", "name_ru": "Биде встроенное", "name_en": "Built-in bidet", "group": "sanitary", @@ -786,7 +786,7 @@ "back": "top", "file": "svg/plan/bidet_built_in.svg", "menu_icon": "bidet", - "notes": "Инсталляция находится сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "kitchen_sink", @@ -799,11 +799,11 @@ "back": "top", "file": "svg/plan/kitchen_sink.svg", "menu_icon": "kitchen_sink", - "notes": "Задняя сторона столешницы сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." }, { "id": "kitchen_sink_double", - "operation": "add", + "operation": "replace", "name_ru": "Кухонная мойка двойная", "name_en": "Double kitchen sink", "group": "sanitary", @@ -812,7 +812,215 @@ "back": "top", "file": "svg/plan/kitchen_sink_double.svg", "menu_icon": "kitchen_sink", - "notes": "Задняя сторона столешницы сверху." + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." + }, + { + "id": "fridge", + "operation": "replace", + "name_ru": "Холодильник", + "name_en": "Refrigerator", + "group": "appliance", + "width_cm": 60, + "depth_cm": 65, + "back": "top", + "file": "svg/plan/fridge.svg", + "menu_icon": "fridge", + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." + }, + { + "id": "dishwasher", + "operation": "replace", + "name_ru": "Посудомоечная машина", + "name_en": "Dishwasher", + "group": "appliance", + "width_cm": 60, + "depth_cm": 60, + "back": "top", + "file": "svg/plan/dishwasher.svg", + "menu_icon": "dishwasher", + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." + }, + { + "id": "washer", + "operation": "replace", + "name_ru": "Стиральная машина", + "name_en": "Washing machine", + "group": "appliance", + "width_cm": 60, + "depth_cm": 60, + "back": "top", + "file": "svg/plan/washer.svg", + "menu_icon": "washer", + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." + }, + { + "id": "dryer", + "operation": "replace", + "name_ru": "Сушильная машина", + "name_en": "Dryer", + "group": "appliance", + "width_cm": 60, + "depth_cm": 60, + "back": "top", + "file": "svg/plan/dryer.svg", + "menu_icon": "dryer", + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." + }, + { + "id": "ac", + "operation": "replace", + "name_ru": "Кондиционер", + "name_en": "Air conditioner", + "group": "appliance", + "width_cm": 90, + "depth_cm": 25, + "back": "top", + "file": "svg/plan/ac.svg", + "menu_icon": "air_conditioner", + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." + }, + { + "id": "water_heater", + "operation": "replace", + "name_ru": "Бойлер", + "name_en": "Water heater", + "group": "appliance", + "width_cm": 45, + "depth_cm": 45, + "back": "top", + "file": "svg/plan/water_heater.svg", + "menu_icon": "boiler", + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." + }, + { + "id": "shower", + "operation": "replace", + "name_ru": "Душ", + "name_en": "Shower", + "group": "sanitary", + "width_cm": 90, + "depth_cm": 90, + "back": "top", + "file": "svg/plan/shower.svg", + "menu_icon": "shower", + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." + }, + { + "id": "sink", + "operation": "replace", + "name_ru": "Раковина", + "name_en": "Sink", + "group": "sanitary", + "width_cm": 60, + "depth_cm": 45, + "back": "top", + "file": "svg/plan/sink.svg", + "menu_icon": "sink", + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." + }, + { + "id": "stairs", + "operation": "replace", + "name_ru": "Лестница", + "name_en": "Stairs", + "group": "other", + "width_cm": 100, + "depth_cm": 280, + "back": "top", + "file": "svg/plan/stairs.svg", + "menu_icon": "stairs", + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." + }, + { + "id": "fireplace", + "operation": "replace", + "name_ru": "Камин", + "name_en": "Fireplace", + "group": "other", + "width_cm": 120, + "depth_cm": 40, + "back": "top", + "file": "svg/plan/fireplace.svg", + "menu_icon": "fireplace", + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." + }, + { + "id": "plant", + "operation": "replace", + "name_ru": "Растение", + "name_en": "Plant", + "group": "other", + "width_cm": 40, + "depth_cm": 40, + "back": "top", + "file": "svg/plan/plant.svg", + "menu_icon": "plant", + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." + }, + { + "id": "rug", + "operation": "replace", + "name_ru": "Ковёр", + "name_en": "Rug", + "group": "other", + "width_cm": 200, + "depth_cm": 140, + "back": "top", + "file": "svg/plan/rug.svg", + "menu_icon": "rug", + "notes": "Существующий публичный ID House Plan; меняются только рисунок и default-размер нового размещения." + }, + { + "id": "computer", + "operation": "add", + "name_ru": "Компьютер", + "name_en": "Computer", + "group": "appliance", + "width_cm": 120, + "depth_cm": 60, + "back": "top", + "file": "svg/plan/computer.svg", + "menu_icon": "computer", + "notes": "Новый ID для расширения встроенной библиотеки House Plan." + }, + { + "id": "hood", + "operation": "add", + "name_ru": "Вытяжка", + "name_en": "Range hood", + "group": "appliance", + "width_cm": 60, + "depth_cm": 50, + "back": "top", + "file": "svg/plan/hood.svg", + "menu_icon": "hood", + "notes": "Новый ID для расширения встроенной библиотеки House Plan." + }, + { + "id": "oven", + "operation": "add", + "name_ru": "Духовка", + "name_en": "Oven", + "group": "appliance", + "width_cm": 60, + "depth_cm": 60, + "back": "top", + "file": "svg/plan/oven.svg", + "menu_icon": "oven", + "notes": "Новый ID для расширения встроенной библиотеки House Plan." + }, + { + "id": "cactus", + "operation": "add", + "name_ru": "Кактус", + "name_en": "Cactus", + "group": "other", + "width_cm": 70, + "depth_cm": 120, + "back": "top", + "file": "svg/plan/cactus.svg", + "menu_icon": "plant", + "notes": "Новый ID для расширения встроенной библиотеки House Plan." } ] } diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/air_conditioner.svg b/assets/furniture/houseplan-0.4.0/svg/menu/air_conditioner.svg new file mode 100644 index 00000000..bf7983ce --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/air_conditioner.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/armchair.svg b/assets/furniture/houseplan-0.4.0/svg/menu/armchair.svg new file mode 100644 index 00000000..6e6d4561 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/armchair.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/bathtub.svg b/assets/furniture/houseplan-0.4.0/svg/menu/bathtub.svg new file mode 100644 index 00000000..17193608 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/bathtub.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/bed.svg b/assets/furniture/houseplan-0.4.0/svg/menu/bed.svg new file mode 100644 index 00000000..8c3cf08c --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/bed.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/bidet.svg b/assets/furniture/houseplan-0.4.0/svg/menu/bidet.svg new file mode 100644 index 00000000..038c27a1 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/bidet.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/boiler.svg b/assets/furniture/houseplan-0.4.0/svg/menu/boiler.svg new file mode 100644 index 00000000..f24c2f84 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/boiler.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/chair.svg b/assets/furniture/houseplan-0.4.0/svg/menu/chair.svg new file mode 100644 index 00000000..f9c13509 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/chair.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/coffee_table.svg b/assets/furniture/houseplan-0.4.0/svg/menu/coffee_table.svg new file mode 100644 index 00000000..a2b2c31a --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/coffee_table.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/computer.svg b/assets/furniture/houseplan-0.4.0/svg/menu/computer.svg new file mode 100644 index 00000000..a583b695 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/computer.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/cooktop.svg b/assets/furniture/houseplan-0.4.0/svg/menu/cooktop.svg new file mode 100644 index 00000000..c9061b4c --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/cooktop.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/dining_table.svg b/assets/furniture/houseplan-0.4.0/svg/menu/dining_table.svg new file mode 100644 index 00000000..4abd72b2 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/dining_table.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/dishwasher.svg b/assets/furniture/houseplan-0.4.0/svg/menu/dishwasher.svg new file mode 100644 index 00000000..0ac63483 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/dishwasher.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/dryer.svg b/assets/furniture/houseplan-0.4.0/svg/menu/dryer.svg new file mode 100644 index 00000000..0ac63483 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/dryer.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/exercise.svg b/assets/furniture/houseplan-0.4.0/svg/menu/exercise.svg new file mode 100644 index 00000000..e194fe86 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/exercise.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/fireplace.svg b/assets/furniture/houseplan-0.4.0/svg/menu/fireplace.svg new file mode 100644 index 00000000..e5917856 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/fireplace.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/fridge.svg b/assets/furniture/houseplan-0.4.0/svg/menu/fridge.svg new file mode 100644 index 00000000..23d5bee4 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/fridge.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/hood.svg b/assets/furniture/houseplan-0.4.0/svg/menu/hood.svg new file mode 100644 index 00000000..84dd46f9 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/hood.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/kitchen_cabinet.svg b/assets/furniture/houseplan-0.4.0/svg/menu/kitchen_cabinet.svg new file mode 100644 index 00000000..8a893239 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/kitchen_cabinet.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/kitchen_sink.svg b/assets/furniture/houseplan-0.4.0/svg/menu/kitchen_sink.svg new file mode 100644 index 00000000..5a74cdd9 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/kitchen_sink.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/nightstand.svg b/assets/furniture/houseplan-0.4.0/svg/menu/nightstand.svg new file mode 100644 index 00000000..80e129f8 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/nightstand.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/oven.svg b/assets/furniture/houseplan-0.4.0/svg/menu/oven.svg new file mode 100644 index 00000000..1c75e9cc --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/oven.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/plant.svg b/assets/furniture/houseplan-0.4.0/svg/menu/plant.svg new file mode 100644 index 00000000..61cfd93f --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/plant.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/rug.svg b/assets/furniture/houseplan-0.4.0/svg/menu/rug.svg new file mode 100644 index 00000000..e56aa7da --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/rug.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/shelving.svg b/assets/furniture/houseplan-0.4.0/svg/menu/shelving.svg new file mode 100644 index 00000000..67a1800f --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/shelving.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/shower.svg b/assets/furniture/houseplan-0.4.0/svg/menu/shower.svg new file mode 100644 index 00000000..44231bbd --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/shower.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/sink.svg b/assets/furniture/houseplan-0.4.0/svg/menu/sink.svg new file mode 100644 index 00000000..36479172 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/sink.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/sofa.svg b/assets/furniture/houseplan-0.4.0/svg/menu/sofa.svg new file mode 100644 index 00000000..872e8175 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/sofa.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/stairs.svg b/assets/furniture/houseplan-0.4.0/svg/menu/stairs.svg new file mode 100644 index 00000000..67258148 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/stairs.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/toilet.svg b/assets/furniture/houseplan-0.4.0/svg/menu/toilet.svg new file mode 100644 index 00000000..bdfc919b --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/toilet.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/tv.svg b/assets/furniture/houseplan-0.4.0/svg/menu/tv.svg new file mode 100644 index 00000000..ddb5380e --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/tv.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/wardrobe.svg b/assets/furniture/houseplan-0.4.0/svg/menu/wardrobe.svg new file mode 100644 index 00000000..6ef43efa --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/wardrobe.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/washer.svg b/assets/furniture/houseplan-0.4.0/svg/menu/washer.svg new file mode 100644 index 00000000..4cf6eb28 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/washer.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/menu/work_table.svg b/assets/furniture/houseplan-0.4.0/svg/menu/work_table.svg new file mode 100644 index 00000000..e3cc43b4 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/menu/work_table.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/ac.svg b/assets/furniture/houseplan-0.4.0/svg/plan/ac.svg new file mode 100644 index 00000000..3c073db8 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/ac.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/armchair.svg b/assets/furniture/houseplan-0.4.0/svg/plan/armchair.svg new file mode 100644 index 00000000..bcc33c3b --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/armchair.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/armchair_office.svg b/assets/furniture/houseplan-0.4.0/svg/plan/armchair_office.svg new file mode 100644 index 00000000..0c6d29b8 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/armchair_office.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/bathtub.svg b/assets/furniture/houseplan-0.4.0/svg/plan/bathtub.svg new file mode 100644 index 00000000..399030f5 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/bathtub.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/bathtub_corner.svg b/assets/furniture/houseplan-0.4.0/svg/plan/bathtub_corner.svg new file mode 100644 index 00000000..c40e5867 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/bathtub_corner.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/bed_double.svg b/assets/furniture/houseplan-0.4.0/svg/plan/bed_double.svg new file mode 100644 index 00000000..1529c87f --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/bed_double.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/bed_single.svg b/assets/furniture/houseplan-0.4.0/svg/plan/bed_single.svg new file mode 100644 index 00000000..19c4e704 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/bed_single.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/bidet.svg b/assets/furniture/houseplan-0.4.0/svg/plan/bidet.svg new file mode 100644 index 00000000..3f7af2c9 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/bidet.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/bidet_built_in.svg b/assets/furniture/houseplan-0.4.0/svg/plan/bidet_built_in.svg new file mode 100644 index 00000000..9e15aa79 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/bidet_built_in.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/bookshelf.svg b/assets/furniture/houseplan-0.4.0/svg/plan/bookshelf.svg new file mode 100644 index 00000000..fd8884b6 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/bookshelf.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/cabinet_shoe.svg b/assets/furniture/houseplan-0.4.0/svg/plan/cabinet_shoe.svg new file mode 100644 index 00000000..ec343999 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/cabinet_shoe.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/cabinet_sink.svg b/assets/furniture/houseplan-0.4.0/svg/plan/cabinet_sink.svg new file mode 100644 index 00000000..f15c49f2 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/cabinet_sink.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/cabinet_tv.svg b/assets/furniture/houseplan-0.4.0/svg/plan/cabinet_tv.svg new file mode 100644 index 00000000..82ecd98f --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/cabinet_tv.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/cactus.svg b/assets/furniture/houseplan-0.4.0/svg/plan/cactus.svg new file mode 100644 index 00000000..3693d3eb --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/cactus.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/chair.svg b/assets/furniture/houseplan-0.4.0/svg/plan/chair.svg new file mode 100644 index 00000000..0d40a947 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/chair.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/chair_bar.svg b/assets/furniture/houseplan-0.4.0/svg/plan/chair_bar.svg new file mode 100644 index 00000000..bf0d7857 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/chair_bar.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/coffee_table.svg b/assets/furniture/houseplan-0.4.0/svg/plan/coffee_table.svg new file mode 100644 index 00000000..06aaa43c --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/coffee_table.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/coffee_table_oval.svg b/assets/furniture/houseplan-0.4.0/svg/plan/coffee_table_oval.svg new file mode 100644 index 00000000..e00ebf14 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/coffee_table_oval.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/coffee_table_round.svg b/assets/furniture/houseplan-0.4.0/svg/plan/coffee_table_round.svg new file mode 100644 index 00000000..05f3ca87 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/coffee_table_round.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/coffee_table_rounded.svg b/assets/furniture/houseplan-0.4.0/svg/plan/coffee_table_rounded.svg new file mode 100644 index 00000000..d92036ee --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/coffee_table_rounded.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/computer.svg b/assets/furniture/houseplan-0.4.0/svg/plan/computer.svg new file mode 100644 index 00000000..d5ceda20 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/computer.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/cooktop_two.svg b/assets/furniture/houseplan-0.4.0/svg/plan/cooktop_two.svg new file mode 100644 index 00000000..a9bfd4bf --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/cooktop_two.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/desk.svg b/assets/furniture/houseplan-0.4.0/svg/plan/desk.svg new file mode 100644 index 00000000..e1975217 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/desk.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/desk_corner.svg b/assets/furniture/houseplan-0.4.0/svg/plan/desk_corner.svg new file mode 100644 index 00000000..aa44dcf3 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/desk_corner.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/dishwasher.svg b/assets/furniture/houseplan-0.4.0/svg/plan/dishwasher.svg new file mode 100644 index 00000000..59355310 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/dishwasher.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/dryer.svg b/assets/furniture/houseplan-0.4.0/svg/plan/dryer.svg new file mode 100644 index 00000000..ce7f1b52 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/dryer.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/fireplace.svg b/assets/furniture/houseplan-0.4.0/svg/plan/fireplace.svg new file mode 100644 index 00000000..41dd4aab --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/fireplace.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/fridge.svg b/assets/furniture/houseplan-0.4.0/svg/plan/fridge.svg new file mode 100644 index 00000000..408ca573 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/fridge.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/hood.svg b/assets/furniture/houseplan-0.4.0/svg/plan/hood.svg new file mode 100644 index 00000000..77816a73 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/hood.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/kitchen_floor.svg b/assets/furniture/houseplan-0.4.0/svg/plan/kitchen_floor.svg new file mode 100644 index 00000000..2f99427c --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/kitchen_floor.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/kitchen_floor_corner.svg b/assets/furniture/houseplan-0.4.0/svg/plan/kitchen_floor_corner.svg new file mode 100644 index 00000000..a8896ce7 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/kitchen_floor_corner.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/kitchen_sink.svg b/assets/furniture/houseplan-0.4.0/svg/plan/kitchen_sink.svg new file mode 100644 index 00000000..e34a97b6 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/kitchen_sink.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/kitchen_sink_double.svg b/assets/furniture/houseplan-0.4.0/svg/plan/kitchen_sink_double.svg new file mode 100644 index 00000000..09c88a62 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/kitchen_sink_double.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/kitchen_wall.svg b/assets/furniture/houseplan-0.4.0/svg/plan/kitchen_wall.svg new file mode 100644 index 00000000..ea2cb64f --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/kitchen_wall.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/kitchen_wall_corner.svg b/assets/furniture/houseplan-0.4.0/svg/plan/kitchen_wall_corner.svg new file mode 100644 index 00000000..b58e49b9 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/kitchen_wall_corner.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/nightstand.svg b/assets/furniture/houseplan-0.4.0/svg/plan/nightstand.svg new file mode 100644 index 00000000..832d1dba --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/nightstand.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/oven.svg b/assets/furniture/houseplan-0.4.0/svg/plan/oven.svg new file mode 100644 index 00000000..33b1fd45 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/oven.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/plant.svg b/assets/furniture/houseplan-0.4.0/svg/plan/plant.svg new file mode 100644 index 00000000..b9a40d97 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/plant.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/rug.svg b/assets/furniture/houseplan-0.4.0/svg/plan/rug.svg new file mode 100644 index 00000000..6e11d885 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/rug.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/shelf_floor.svg b/assets/furniture/houseplan-0.4.0/svg/plan/shelf_floor.svg new file mode 100644 index 00000000..feef87b1 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/shelf_floor.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/shelf_wall.svg b/assets/furniture/houseplan-0.4.0/svg/plan/shelf_wall.svg new file mode 100644 index 00000000..af15c99c --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/shelf_wall.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/shower.svg b/assets/furniture/houseplan-0.4.0/svg/plan/shower.svg new file mode 100644 index 00000000..c5b70074 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/shower.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/sink.svg b/assets/furniture/houseplan-0.4.0/svg/plan/sink.svg new file mode 100644 index 00000000..53fffbdf --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/sink.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/sofa.svg b/assets/furniture/houseplan-0.4.0/svg/plan/sofa.svg new file mode 100644 index 00000000..08be780a --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/sofa.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/sofa_corner_right.svg b/assets/furniture/houseplan-0.4.0/svg/plan/sofa_corner_right.svg new file mode 100644 index 00000000..83fa46e9 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/sofa_corner_right.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/sofa_three_seat.svg b/assets/furniture/houseplan-0.4.0/svg/plan/sofa_three_seat.svg new file mode 100644 index 00000000..77d2f16e --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/sofa_three_seat.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/stairs.svg b/assets/furniture/houseplan-0.4.0/svg/plan/stairs.svg new file mode 100644 index 00000000..cf56f5dc --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/stairs.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/stove.svg b/assets/furniture/houseplan-0.4.0/svg/plan/stove.svg new file mode 100644 index 00000000..485017ec --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/stove.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/table_dining.svg b/assets/furniture/houseplan-0.4.0/svg/plan/table_dining.svg new file mode 100644 index 00000000..08cd5889 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/table_dining.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/table_dining_oval.svg b/assets/furniture/houseplan-0.4.0/svg/plan/table_dining_oval.svg new file mode 100644 index 00000000..2f02264b --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/table_dining_oval.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/table_dining_rounded.svg b/assets/furniture/houseplan-0.4.0/svg/plan/table_dining_rounded.svg new file mode 100644 index 00000000..cf260b58 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/table_dining_rounded.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/table_round.svg b/assets/furniture/houseplan-0.4.0/svg/plan/table_round.svg new file mode 100644 index 00000000..8d163d29 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/table_round.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/toilet.svg b/assets/furniture/houseplan-0.4.0/svg/plan/toilet.svg new file mode 100644 index 00000000..8de11bad --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/toilet.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/toilet_built_in.svg b/assets/furniture/houseplan-0.4.0/svg/plan/toilet_built_in.svg new file mode 100644 index 00000000..84332d79 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/toilet_built_in.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/tv.svg b/assets/furniture/houseplan-0.4.0/svg/plan/tv.svg new file mode 100644 index 00000000..ea1df302 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/tv.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/tv_wall.svg b/assets/furniture/houseplan-0.4.0/svg/plan/tv_wall.svg new file mode 100644 index 00000000..88d35d00 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/tv_wall.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/wall_unit.svg b/assets/furniture/houseplan-0.4.0/svg/plan/wall_unit.svg new file mode 100644 index 00000000..aef048fb --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/wall_unit.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/wardrobe.svg b/assets/furniture/houseplan-0.4.0/svg/plan/wardrobe.svg new file mode 100644 index 00000000..c21e2793 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/wardrobe.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/washer.svg b/assets/furniture/houseplan-0.4.0/svg/plan/washer.svg new file mode 100644 index 00000000..d435ec5d --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/washer.svg @@ -0,0 +1,3 @@ + + + diff --git a/assets/furniture/houseplan-0.4.0/svg/plan/water_heater.svg b/assets/furniture/houseplan-0.4.0/svg/plan/water_heater.svg new file mode 100644 index 00000000..c700b9a8 --- /dev/null +++ b/assets/furniture/houseplan-0.4.0/svg/plan/water_heater.svg @@ -0,0 +1,3 @@ + + + diff --git a/custom_components/houseplan/frontend/houseplan-assets.json b/custom_components/houseplan/frontend/houseplan-assets.json index ba201943..8a232ee5 100644 --- a/custom_components/houseplan/frontend/houseplan-assets.json +++ b/custom_components/houseplan/frontend/houseplan-assets.json @@ -1,295 +1,295 @@ { "schema": 1, - "fingerprint": "271e0747b4ddef1af0d15d8bf63a832d72b0f7211550c349a59b3baa3864a84e", + "fingerprint": "b468bec31a4d35a4630025ee2489e4187921a21b8f95e5abaaaace1921cfa3d8", "entry": "houseplan-card.js", "panelEntry": "houseplan-panel.js", "initialViewFiles": [ - "houseplan-assets/houseplan-card-BMVLvcks.js", + "houseplan-assets/houseplan-card-CK7KNP4B.js", "houseplan-card.js" ], - "initialViewGzipBytes": 291872, + "initialViewGzipBytes": 290836, "initialPanelFiles": [ - "houseplan-assets/houseplan-card-BMVLvcks.js", + "houseplan-assets/houseplan-card-CK7KNP4B.js", "houseplan-panel.js" ], - "initialPanelGzipBytes": 293394, + "initialPanelGzipBytes": 292359, "initialPanelOnlyFiles": [ "houseplan-panel.js" ], "initialPanelOnlyGzipBytes": 2325, "lazyFiles": [ - "houseplan-assets/backdrop-pick-BEAwnXmw.js", - "houseplan-assets/de-DWDYt11e.js", - "houseplan-assets/editor-CV6uoEg_.js", - "houseplan-assets/fr-Bfh5k4A7.js", - "houseplan-assets/furniture-plan-art.generated-D0lHr8pH.js", - "houseplan-assets/houseplan-editor-runtime-CffLSWDF.js", - "houseplan-assets/houseplan-onboarding-runtime-aNl4FiLj.js", - "houseplan-assets/hp-zigbee-topology-overlay-BoAV-qiO.js", - "houseplan-assets/iso-scene-render-C9GeuwoY.js", - "houseplan-assets/live-interaction-runtime-BI1aUBNm.js", - "houseplan-assets/pdf-export-D_xOUM3j.js", - "houseplan-assets/summary-panel-runtime-loaded-g1LT0Cej.js", - "houseplan-assets/zigbee-topology-BEa8LNBZ.js", - "houseplan-assets/zigbee-topology-runtime-6-X3BuRu.js" + "houseplan-assets/backdrop-pick-DqssWRMU.js", + "houseplan-assets/de-DHs-xkgD.js", + "houseplan-assets/editor-v_hhQ3R4.js", + "houseplan-assets/fr-BdIFyCIL.js", + "houseplan-assets/furniture-plan-art.generated-Bhgrr-iO.js", + "houseplan-assets/houseplan-editor-runtime-BTZPftx5.js", + "houseplan-assets/houseplan-onboarding-runtime-BE6dwLJ2.js", + "houseplan-assets/hp-zigbee-topology-overlay-DnFzdpec.js", + "houseplan-assets/iso-scene-render-MSqpZfmO.js", + "houseplan-assets/live-interaction-runtime-CxkX2LMW.js", + "houseplan-assets/pdf-export-CdUPKBCc.js", + "houseplan-assets/summary-panel-runtime-loaded-pjWn0aEE.js", + "houseplan-assets/zigbee-topology-Cq1qwIGM.js", + "houseplan-assets/zigbee-topology-runtime-D-SGhZyY.js" ], - "lazyGzipBytes": 437743, + "lazyGzipBytes": 438306, "lazyEditorFiles": [ - "houseplan-assets/backdrop-pick-BEAwnXmw.js", - "houseplan-assets/editor-CV6uoEg_.js", - "houseplan-assets/furniture-plan-art.generated-D0lHr8pH.js", - "houseplan-assets/houseplan-editor-runtime-CffLSWDF.js", - "houseplan-assets/zigbee-topology-BEa8LNBZ.js" + "houseplan-assets/backdrop-pick-DqssWRMU.js", + "houseplan-assets/editor-v_hhQ3R4.js", + "houseplan-assets/furniture-plan-art.generated-Bhgrr-iO.js", + "houseplan-assets/houseplan-editor-runtime-BTZPftx5.js", + "houseplan-assets/zigbee-topology-Cq1qwIGM.js" ], - "lazyEditorGzipBytes": 221474, + "lazyEditorGzipBytes": 221927, "lazyOnboardingFiles": [ - "houseplan-assets/backdrop-pick-BEAwnXmw.js", - "houseplan-assets/houseplan-onboarding-runtime-aNl4FiLj.js" + "houseplan-assets/backdrop-pick-DqssWRMU.js", + "houseplan-assets/houseplan-onboarding-runtime-BE6dwLJ2.js" ], "lazyOnboardingGzipBytes": 13916, "lazyLocaleFiles": [ - "houseplan-assets/de-DWDYt11e.js", - "houseplan-assets/fr-Bfh5k4A7.js" + "houseplan-assets/de-DHs-xkgD.js", + "houseplan-assets/fr-BdIFyCIL.js" ], - "lazyLocaleGzipBytes": 55595, + "lazyLocaleGzipBytes": 55714, "lazyIsometricFiles": [ - "houseplan-assets/iso-scene-render-C9GeuwoY.js" + "houseplan-assets/iso-scene-render-MSqpZfmO.js" ], - "lazyIsometricGzipBytes": 15013, + "lazyIsometricGzipBytes": 15014, "lazyFurnitureArtFiles": [ - "houseplan-assets/furniture-plan-art.generated-D0lHr8pH.js" + "houseplan-assets/furniture-plan-art.generated-Bhgrr-iO.js" ], - "lazyFurnitureArtGzipBytes": 23347, + "lazyFurnitureArtGzipBytes": 16943, "lazyPdfFiles": [ - "houseplan-assets/furniture-plan-art.generated-D0lHr8pH.js", - "houseplan-assets/pdf-export-D_xOUM3j.js" + "houseplan-assets/furniture-plan-art.generated-Bhgrr-iO.js", + "houseplan-assets/pdf-export-CdUPKBCc.js" ], - "lazyPdfGzipBytes": 133220, + "lazyPdfGzipBytes": 126814, "files": [ { - "path": "houseplan-assets/backdrop-pick-BEAwnXmw.js", - "sha256": "e25323c086334af09e9266ba9cdedcb7298a4f010d6170b52e709cc05e9fd9b3", + "path": "houseplan-assets/backdrop-pick-DqssWRMU.js", + "sha256": "be8b52604ef15d12df876086e6d6b0d89954a9ec15096a665639c5c0f8a6e5e4", "rawBytes": 19959, "gzipBytes": 6880, "isEntry": false, "imports": [ - "houseplan-assets/houseplan-card-BMVLvcks.js" + "houseplan-assets/houseplan-card-CK7KNP4B.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/de-DWDYt11e.js", - "sha256": "61a2ab3d6417bc3b31db1289f17f02d1b6c9f715f9084dbc5a6cff46efaceecc", - "rawBytes": 92816, - "gzipBytes": 28084, + "path": "houseplan-assets/de-DHs-xkgD.js", + "sha256": "edc240d002b45a2e3eb540923f0e83708b9a3962f382e366acf47a67b5ce94d2", + "rawBytes": 93029, + "gzipBytes": 28149, "isEntry": false, "imports": [], "dynamicImports": [] }, { - "path": "houseplan-assets/editor-CV6uoEg_.js", - "sha256": "adb0f86d68da9a0d2a7f68cb4e02bf86e9112f0437066b7ad22fcf29d065b58a", + "path": "houseplan-assets/editor-v_hhQ3R4.js", + "sha256": "d27e0fbee2b8e2b4250cd2a27c553775a2cac76b2c75905b85152098182369ea", "rawBytes": 3833, - "gzipBytes": 1585, + "gzipBytes": 1584, "isEntry": false, "imports": [ - "houseplan-assets/houseplan-card-BMVLvcks.js" + "houseplan-assets/houseplan-card-CK7KNP4B.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/fr-Bfh5k4A7.js", - "sha256": "445c24e66a97909334e8927978cc0acd009eb053d6d4317d89c2bce39b8b58c7", - "rawBytes": 95188, - "gzipBytes": 27511, + "path": "houseplan-assets/fr-BdIFyCIL.js", + "sha256": "b3b4ec9c60bf457ecad7ee2d77db4fecd2bcd6520336efb5c2d7b0421d169f91", + "rawBytes": 95375, + "gzipBytes": 27565, "isEntry": false, "imports": [], "dynamicImports": [] }, { - "path": "houseplan-assets/furniture-plan-art.generated-D0lHr8pH.js", - "sha256": "92af6580a4908ac007cba2432b7b22cf7835fcf10c372e67f6105046db85aa68", - "rawBytes": 90517, - "gzipBytes": 23347, + "path": "houseplan-assets/furniture-plan-art.generated-Bhgrr-iO.js", + "sha256": "469d647ee6d66115337717bb9adc44495a26cd1ffda70ce64911c46e034af710", + "rawBytes": 52033, + "gzipBytes": 16943, "isEntry": false, "imports": [], "dynamicImports": [] }, { - "path": "houseplan-assets/houseplan-card-BMVLvcks.js", - "sha256": "8a13e2c37d3e1a994c4e53abd2a5815aa12d35106f990b17914afa741799d55a", - "rawBytes": 1037084, - "gzipBytes": 291069, + "path": "houseplan-assets/houseplan-card-CK7KNP4B.js", + "sha256": "c19ca1cf03359ebad6978a38db9c2ae33b8fca264f6d49ddfe9df3c7b15f4b32", + "rawBytes": 1033355, + "gzipBytes": 290034, "isEntry": false, "imports": [], "dynamicImports": [ - "houseplan-assets/de-DWDYt11e.js", - "houseplan-assets/editor-CV6uoEg_.js", - "houseplan-assets/fr-Bfh5k4A7.js", - "houseplan-assets/furniture-plan-art.generated-D0lHr8pH.js", - "houseplan-assets/houseplan-editor-runtime-CffLSWDF.js", - "houseplan-assets/houseplan-onboarding-runtime-aNl4FiLj.js", - "houseplan-assets/hp-zigbee-topology-overlay-BoAV-qiO.js", - "houseplan-assets/iso-scene-render-C9GeuwoY.js", - "houseplan-assets/live-interaction-runtime-BI1aUBNm.js", - "houseplan-assets/pdf-export-D_xOUM3j.js", - "houseplan-assets/summary-panel-runtime-loaded-g1LT0Cej.js" + "houseplan-assets/de-DHs-xkgD.js", + "houseplan-assets/editor-v_hhQ3R4.js", + "houseplan-assets/fr-BdIFyCIL.js", + "houseplan-assets/furniture-plan-art.generated-Bhgrr-iO.js", + "houseplan-assets/houseplan-editor-runtime-BTZPftx5.js", + "houseplan-assets/houseplan-onboarding-runtime-BE6dwLJ2.js", + "houseplan-assets/hp-zigbee-topology-overlay-DnFzdpec.js", + "houseplan-assets/iso-scene-render-MSqpZfmO.js", + "houseplan-assets/live-interaction-runtime-CxkX2LMW.js", + "houseplan-assets/pdf-export-CdUPKBCc.js", + "houseplan-assets/summary-panel-runtime-loaded-pjWn0aEE.js" ] }, { - "path": "houseplan-assets/houseplan-editor-runtime-CffLSWDF.js", - "sha256": "df39790bc4f69ea19d62012a9f2c0a5c22fbefd10858b7c9110a6a2bf7363c93", - "rawBytes": 674630, - "gzipBytes": 182233, + "path": "houseplan-assets/houseplan-editor-runtime-BTZPftx5.js", + "sha256": "491b655a8657e313ead56a6cf61be3ad37e85a35e6ca7437c14b65c066f1514d", + "rawBytes": 692866, + "gzipBytes": 189091, "isEntry": false, "imports": [ - "houseplan-assets/backdrop-pick-BEAwnXmw.js", - "houseplan-assets/furniture-plan-art.generated-D0lHr8pH.js", - "houseplan-assets/houseplan-card-BMVLvcks.js", - "houseplan-assets/zigbee-topology-BEa8LNBZ.js" + "houseplan-assets/backdrop-pick-DqssWRMU.js", + "houseplan-assets/furniture-plan-art.generated-Bhgrr-iO.js", + "houseplan-assets/houseplan-card-CK7KNP4B.js", + "houseplan-assets/zigbee-topology-Cq1qwIGM.js" ], "dynamicImports": [ - "houseplan-assets/zigbee-topology-runtime-6-X3BuRu.js" + "houseplan-assets/zigbee-topology-runtime-D-SGhZyY.js" ] }, { - "path": "houseplan-assets/houseplan-onboarding-runtime-aNl4FiLj.js", - "sha256": "af2b2dc7cdb63f36d693b1d89b3b4540592c5f81897eace70d8d6af391147455", + "path": "houseplan-assets/houseplan-onboarding-runtime-BE6dwLJ2.js", + "sha256": "d5c28996609f16dc719b6c11c4c61139955c29bbca81ebecb00e585da75d51f8", "rawBytes": 28287, "gzipBytes": 7036, "isEntry": false, "imports": [ - "houseplan-assets/backdrop-pick-BEAwnXmw.js", - "houseplan-assets/houseplan-card-BMVLvcks.js" + "houseplan-assets/backdrop-pick-DqssWRMU.js", + "houseplan-assets/houseplan-card-CK7KNP4B.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/hp-zigbee-topology-overlay-BoAV-qiO.js", - "sha256": "9767b014de5d5f6b5e48d4c83647c45b91ea5be02a7177cb8ce456212fb24991", + "path": "houseplan-assets/hp-zigbee-topology-overlay-DnFzdpec.js", + "sha256": "3f4909ab0c0ce69933671b63e3f6afe1e91a4ddc8ce7266166c8398c417302fe", "rawBytes": 10759, - "gzipBytes": 3688, + "gzipBytes": 3687, "isEntry": false, "imports": [ - "houseplan-assets/houseplan-card-BMVLvcks.js", - "houseplan-assets/zigbee-topology-BEa8LNBZ.js", - "houseplan-assets/zigbee-topology-runtime-6-X3BuRu.js" + "houseplan-assets/houseplan-card-CK7KNP4B.js", + "houseplan-assets/zigbee-topology-Cq1qwIGM.js", + "houseplan-assets/zigbee-topology-runtime-D-SGhZyY.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/iso-scene-render-C9GeuwoY.js", - "sha256": "7658e6aba6394d37150e0e578b7a342c1dd36e5b615fb0d04967d366c4ac6993", + "path": "houseplan-assets/iso-scene-render-MSqpZfmO.js", + "sha256": "f53c622bce56135962f4964e27eabe0774e7f1fbf3d5b0aa7d15c426d31cefbb", "rawBytes": 44439, - "gzipBytes": 15013, + "gzipBytes": 15014, "isEntry": false, "imports": [ - "houseplan-assets/houseplan-card-BMVLvcks.js" + "houseplan-assets/houseplan-card-CK7KNP4B.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/live-interaction-runtime-BI1aUBNm.js", - "sha256": "bd1cb4c7629ed7a8211a0d5d78a4805a9551bb63a8e5bce712c8e899d6ba7e06", + "path": "houseplan-assets/live-interaction-runtime-CxkX2LMW.js", + "sha256": "cb973beaeedc0f29395dfad95faee2325d352a3ea6e65d16eaa8c3e2ced79071", "rawBytes": 8216, - "gzipBytes": 3211, + "gzipBytes": 3205, "isEntry": false, "imports": [ - "houseplan-assets/houseplan-card-BMVLvcks.js" + "houseplan-assets/houseplan-card-CK7KNP4B.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/pdf-export-D_xOUM3j.js", - "sha256": "2a0ce1424dbbb753c3954ca750cbc2a4c07a57dc335f9443f7fb92a544163cd7", + "path": "houseplan-assets/pdf-export-CdUPKBCc.js", + "sha256": "eea4af5a8133bc1a93e758176e07bb3f7156bc33ecf510c50e221da25475fd14", "rawBytes": 236247, - "gzipBytes": 109873, + "gzipBytes": 109871, "isEntry": false, "imports": [ - "houseplan-assets/furniture-plan-art.generated-D0lHr8pH.js", - "houseplan-assets/houseplan-card-BMVLvcks.js" + "houseplan-assets/furniture-plan-art.generated-Bhgrr-iO.js", + "houseplan-assets/houseplan-card-CK7KNP4B.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/summary-panel-editor-CC7xfAHi.js", - "sha256": "875f068b28f9a2b494c12f6070a6220b9520a114506f3e6ca6c2c6cae533520a", + "path": "houseplan-assets/summary-panel-editor-BjygV2yH.js", + "sha256": "4baf834c4ee197a2c2f63cf86a4104be043ef78d74088850627f957e12fa5f39", "rawBytes": 14824, - "gzipBytes": 3400, + "gzipBytes": 3399, "isEntry": false, "imports": [ - "houseplan-assets/houseplan-card-BMVLvcks.js", - "houseplan-assets/summary-panel-runtime-loaded-g1LT0Cej.js" + "houseplan-assets/houseplan-card-CK7KNP4B.js", + "houseplan-assets/summary-panel-runtime-loaded-pjWn0aEE.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/summary-panel-metrics-BNvy3ieG.js", - "sha256": "0c1d00835fa887c628894bf666aa3482eecab24273e25ffc04c14ba0c1b00f43", + "path": "houseplan-assets/summary-panel-metrics-RWgqMkxu.js", + "sha256": "f472fd9d4da60efef3a64638a400b5b06ebadd1def9cb808b463c4b81819207c", "rawBytes": 2611, - "gzipBytes": 1309, + "gzipBytes": 1307, "isEntry": false, "imports": [ - "houseplan-assets/houseplan-card-BMVLvcks.js" + "houseplan-assets/houseplan-card-CK7KNP4B.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/summary-panel-runtime-loaded-g1LT0Cej.js", - "sha256": "8636cc30ed28478ed53ec99db1af654ca32eeca97867db997621ea24f9690ca9", + "path": "houseplan-assets/summary-panel-runtime-loaded-pjWn0aEE.js", + "sha256": "223ac67537f7caf34b98aef0f438584b8ea59fabcea93ef9d402e420025f26ad", "rawBytes": 73367, - "gzipBytes": 20088, + "gzipBytes": 20089, "isEntry": false, "imports": [ - "houseplan-assets/houseplan-card-BMVLvcks.js" + "houseplan-assets/houseplan-card-CK7KNP4B.js" ], "dynamicImports": [ - "houseplan-assets/summary-panel-editor-CC7xfAHi.js", - "houseplan-assets/summary-panel-metrics-BNvy3ieG.js" + "houseplan-assets/summary-panel-editor-BjygV2yH.js", + "houseplan-assets/summary-panel-metrics-RWgqMkxu.js" ] }, { - "path": "houseplan-assets/zigbee-topology-BEa8LNBZ.js", - "sha256": "3e3d656e76c73d257389b408ae7921eac1034ee1d32e860a659432e84e54822b", + "path": "houseplan-assets/zigbee-topology-Cq1qwIGM.js", + "sha256": "395085420b65898814d9720c5d840bad6ff43fbd2d16562ac7cc2da57dbc9862", "rawBytes": 18962, "gzipBytes": 7429, "isEntry": false, "imports": [ - "houseplan-assets/houseplan-card-BMVLvcks.js" + "houseplan-assets/houseplan-card-CK7KNP4B.js" ], "dynamicImports": [] }, { - "path": "houseplan-assets/zigbee-topology-runtime-6-X3BuRu.js", - "sha256": "db1b7ba90817c3f67a032d28186f64b9863a136788fa08a12320759a80bd138f", + "path": "houseplan-assets/zigbee-topology-runtime-D-SGhZyY.js", + "sha256": "d695f410d7ceeffd1bc653eb46e85db43f04366a5b4b9514b5fb51ac405d22dc", "rawBytes": 3942, - "gzipBytes": 1765, + "gzipBytes": 1763, "isEntry": false, "imports": [ - "houseplan-assets/houseplan-card-BMVLvcks.js", - "houseplan-assets/zigbee-topology-BEa8LNBZ.js" + "houseplan-assets/houseplan-card-CK7KNP4B.js", + "houseplan-assets/zigbee-topology-Cq1qwIGM.js" ], "dynamicImports": [] }, { "path": "houseplan-card.js", - "sha256": "6c2cf3707dd9c1cebf8b33748449ad09064d267ac0aa7926f20b6c6f685f4848", + "sha256": "6c7b1ad3e446a38b85fa91c86340fd731c44c92b707f00906460190608b8d7f5", "rawBytes": 1205, - "gzipBytes": 803, + "gzipBytes": 802, "isEntry": true, "imports": [ - "houseplan-assets/houseplan-card-BMVLvcks.js" + "houseplan-assets/houseplan-card-CK7KNP4B.js" ], "dynamicImports": [] }, { "path": "houseplan-panel.js", - "sha256": "416e6a7b7ca38d635e350b01eb44ab93ce84d21eacb26f3303e6b17c40413d3a", + "sha256": "434777e6031a824cb5491500942f72b0fa4ca011a22b73a8b9c8e973a73f9c00", "rawBytes": 6165, "gzipBytes": 2325, "isEntry": true, "imports": [ - "houseplan-assets/houseplan-card-BMVLvcks.js" + "houseplan-assets/houseplan-card-CK7KNP4B.js" ], "dynamicImports": [] } diff --git a/custom_components/houseplan/frontend/houseplan-assets/backdrop-pick-BEAwnXmw.js b/custom_components/houseplan/frontend/houseplan-assets/backdrop-pick-DqssWRMU.js similarity index 93% rename from custom_components/houseplan/frontend/houseplan-assets/backdrop-pick-BEAwnXmw.js rename to custom_components/houseplan/frontend/houseplan-assets/backdrop-pick-DqssWRMU.js index 12dcf53a..fed746bf 100644 --- a/custom_components/houseplan/frontend/houseplan-assets/backdrop-pick-BEAwnXmw.js +++ b/custom_components/houseplan/frontend/houseplan-assets/backdrop-pick-DqssWRMU.js @@ -1,6 +1,6 @@ -globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0f7211550c349a59b3baa3864a84e";import{aA as e,c as t,A as i,aH as o,aI as n,dG as r}from"./houseplan-card-BMVLvcks.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-d),p=Math.min(Math.max(r,p),Math.max(r,a-d));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(c)}}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 c 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` + @pointerenter=${this._surfacePointerEnter} @pointerleave=${this._surfacePointerLeave}>${this.text}
`}_renderFallback(){const e=c.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` ${this.text} `:G} - `}houseplanContinuityTrace(){return[...this._continuityHistory,...this._continuity.trace].slice(-80).map(e=>({...e,...e.stage?{stage:[...e.stage]}:{}}))}render(){if(!this._config||!this.hass)return G;const e=_p(this,yp,$p(this.hass,this._config.language));if("cold"===e)return mp();if("warm"===e)return U;const t=this._snap?.config;if(!t)return this._errorCard(Mp(this._lang,"space_card.loading"));const i=this._config.space,n=el(t).find(e=>e.id===i),r=void 0!==this._config.title?this._config.title:n?.title||"",o=this._renderDeviceSnapshot,s=Vm({hass:o?.hass||this.hass,cfg:t,layout:this._snap?.layout||{},spaceId:i,iconSize:this._config.icon_size,fit:this._config.fit,compactTopFrame:""===this._config.title||null===this._config.title,stageWidth:this._stageWidth,lang:this._lang,displayUrl:e=>this._signer.display(this.hass,e),decorAssetUrl:e=>this._decorAssets.get(e)?.url||"",assetLoaded:this._onAssetLoaded,registry:o?{revision:o.sourceSequence,authoritative:!1,access:"limited",entities:{...o.hass.entities},devices:{...o.hass.devices},lastSuccess:o.capturedAt}:sd(this.hass),devices:[...o?.devices||this._devices],areaRelocationIds:this._areaRelocationIds,presentations:o?.presentations,activityRuntime:this._activityRuntime,reducedMotion:this._reducedMotion,virtualLights:this._snap?.virtualLights,lightPools:!0===this._config.light_pools,glowRuntime:{state:this._glowRuntimeState,host:this._glowRuntimeHost,screenBlend:this._glowScreenBlend},liveStates:!1!==this._config.live_states,showTemperature:!1!==this._config.show_temperature,showSignal:!1!==this._config.show_signal,inert:this._continuity.overlayBlocksInteraction});if(!s)return this._errorCard(Mp(this._lang,"space_card.not_found",{id:i}));const a=!1!==this._config.show_button,l=this._config.button_label||Mp(this._lang,"space_card.button"),c=this._continuity.overlayVisible||"recovery-error"===this._continuity.state?this._continuity.recoveryReason:null;return j` + ${xp(this._lang,e?"continuity.restore_connection":"continuity.restore_plan")} + ${"recovery-error"===this._continuity.state?j``:G} + `}houseplanContinuityTrace(){return[...this._continuityHistory,...this._continuity.trace].slice(-80).map(e=>({...e,...e.stage?{stage:[...e.stage]}:{}}))}render(){if(!this._config||!this.hass)return G;const e=dp(this,gp,kp(this.hass,this._config.language));if("cold"===e)return up();if("warm"===e)return U;const t=this._snap?.config;if(!t)return this._errorCard(xp(this._lang,"space_card.loading"));const i=this._config.space,n=el(t).find(e=>e.id===i),r=void 0!==this._config.title?this._config.title:n?.title||"",o=this._renderDeviceSnapshot,s=Wm({hass:o?.hass||this.hass,cfg:t,layout:this._snap?.layout||{},spaceId:i,iconSize:this._config.icon_size,fit:this._config.fit,compactTopFrame:""===this._config.title||null===this._config.title,stageWidth:this._stageWidth,lang:this._lang,displayUrl:e=>this._signer.display(this.hass,e),decorAssetUrl:e=>this._decorAssets.get(e)?.url||"",assetLoaded:this._onAssetLoaded,registry:o?{revision:o.sourceSequence,authoritative:!1,access:"limited",entities:{...o.hass.entities},devices:{...o.hass.devices},lastSuccess:o.capturedAt}:nd(this.hass),devices:[...o?.devices||this._devices],areaRelocationIds:this._areaRelocationIds,presentations:o?.presentations,activityRuntime:this._activityRuntime,reducedMotion:this._reducedMotion,virtualLights:this._snap?.virtualLights,lightPools:!0===this._config.light_pools,glowRuntime:{state:this._glowRuntimeState,host:this._glowRuntimeHost,screenBlend:this._glowScreenBlend},liveStates:!1!==this._config.live_states,showTemperature:!1!==this._config.show_temperature,showSignal:!1!==this._config.show_signal,inert:this._continuity.overlayBlocksInteraction});if(!s)return this._errorCard(xp(this._lang,"space_card.not_found",{id:i}));const a=!1!==this._config.show_button,l=this._config.button_label||xp(this._lang,"space_card.button"),c=this._continuity.overlayVisible||"recovery-error"===this._continuity.state?this._continuity.recoveryReason:null;return j` ${l} `:G} - `}}fg.properties={hass:{attribute:!1},_config:{state:!0},_snap:{state:!0},_continuityEpoch:{state:!0}},fg.styles=[hp,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-static-stage>.hp-paper-outline-svg{z-index:0;overflow:visible;}.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",fg),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 vg=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 yg{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 bg(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 wg(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 kg="houseplan-card:version-reload-target:v1";function xg(e){if("string"!=typeof e)return null;return e.trim()||null}class Sg{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:xg(e.frontendVersion),backendVersion:xg(e.backendVersion),kiosk:!0===e.kiosk,reducedMotion:!0===e.reducedMotion},i=function(e,t){const i=xg(e),n=xg(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(kg)===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(kg)===t?"attempted":(i.setItem(kg,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 $g=1;function Mg(e,t){const i=t&&"object"==typeof t?t:{};e._haIntegrationVersion=xg(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 Rg(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 Cg{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:md(e),bindings:n},this.diagnosticsCache}}function Tg(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 Dg(e){return!!e&&"object"==typeof e&&1===e.version}function Ag(e,t){const i=e.radar;return e.space===t&&!0!==e.hidden&&!0!==e.removed&&Dg(i)&&!0===i.enabled&&!1!==i.show_live}const Pg={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 Fg=e=>"number"==typeof e&&Number.isFinite(e);class zg{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&&Fg(t.x)&&Fg(t.y)&&Fg(t.expires_at)&&Fg(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&&Fg(t.x)&&Fg(t.y)&&Fg(t.radius)&&Fg(t.expires_at)&&Fg(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&&Fg(e[0])&&Fg(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&&!Fg(i))return[];const n=Array.isArray(t.polygon)?t.polygon.slice(0,64).flatMap(e=>Array.isArray(e)&&2===e.length&&Fg(e[0])&&Fg(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:Fg(t.reported_at)?t.reported_at:void 0,expires_at:Fg(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(!Fg(e.expires_at))return null;if(!Fg(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 Ig=Object.freeze({enabled:!1,z2mBaseTopics:Object.freeze([])});function Og(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 Eg(e){const t=e?.zigbee_topology;if(!t||"object"!=typeof t)return Ig;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=Og(e);if(t&&!r.has(t)&&(r.add(t),o.push(t),8===o.length))break}return{enabled:!0===i.enabled,z2mBaseTopics:o}}function Ng(e,t){const i={...e},n=t.z2mBaseTopics.map(Og).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 Hg={now:()=>performance.now(),requestFrame:e=>requestAnimationFrame(e),cancelFrame:e=>cancelAnimationFrame(e)},Lg=e=>Math.max(0,Math.min(1,e)),Bg=(e,t,i)=>e+(t-e)*i,qg=(e,t,i)=>{const n=1-e;return 3*n*n*e*t+3*n*e*e*i+e*e*e},jg=e=>{const t=Lg(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,qg(r,.2,.2)0&&e.w>0?t/e.w:1,viewBox:{...e}}}function Ug(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 Gg(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 Vg(e,t,i){const n=Gg(e),r=Gg(t);if(!n||!r)return i<.5?e:t;const o=Lg(i);return`rgba(${Math.round(Bg(n[0],r[0],o))}, ${Math.round(Bg(n[1],r[1],o))}, ${Math.round(Bg(n[2],r[2],o))}, ${Bg(n[3],r[3],o).toFixed(3)})`}class Kg{constructor(e,t=Hg){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=Lg((e-t.startedAt)/t.duration);t.presented=i>=1?t.to:function(e,t,i){const n=jg(i),r=Bg(e.stageWidth,t.stageWidth,n),o=Bg(e.stageHeight,t.stageHeight,n),s=Math.max(1e-9,e.viewport.pixelsPerUnit),a=Math.max(1e-9,t.viewport.pixelsPerUnit),l={centerX:Bg(e.viewport.centerX,t.viewport.centerX,n),centerY:Bg(e.viewport.centerY,t.viewport.centerY,n),pixelsPerUnit:Math.exp(Bg(Math.log(s),Math.log(a),n))};return{presentedMode:n<.5?e.presentedMode:t.presentedMode,editorChromeHeight:Bg(e.editorChromeHeight,t.editorChromeHeight,n),stageWidth:r,stageHeight:o,viewport:{...l,viewBox:Ug(l,r,o)},stageColor:Vg(e.stageColor,t.stageColor,n),paperColor:Vg(e.paperColor,t.paperColor,n),sceneBrightness:Bg(e.sceneBrightness,t.sceneBrightness,n),architectureOpacity:Bg(e.architectureOpacity,t.architectureOpacity,n),backdropOpacity:Bg(e.backdropOpacity,t.backdropOpacity,n),viewWeight:Bg(e.viewWeight,t.viewWeight,n),editorWeight:Bg(e.editorWeight,t.editorWeight,n),toolbarContentOpacity:Bg(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 Yg={now:()=>"undefined"!=typeof performance?performance.now():Date.now(),requestFrame:e=>"function"==typeof requestAnimationFrame?requestAnimationFrame(e):null,cancelFrame:e=>{"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(e)}},Xg=e=>Number.isFinite(e);function Zg(e){return!!e&&Xg(e.zoom)&&e.zoom>0&&Xg(e.viewBox.x)&&Xg(e.viewBox.y)&&Xg(e.viewBox.w)&&e.viewBox.w>0&&Xg(e.viewBox.h)&&e.viewBox.h>0}function Jg(e){return{zoom:e.zoom,viewBox:{...e.viewBox}}}function Qg(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 ef=(e,t,i)=>e+(t-e)*i,tf=(e,t,i)=>Math.exp(ef(Math.log(e),Math.log(t),i));class nf{constructor(e,t=Yg){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=Jg(e),s=Jg(t),a=n>0&&Zg(o)&&Zg(s),l=this._clock.now(),c={token:r,phase:a?"running":"settling",from:o,to:s,presented:Jg(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?Jg(t.to):function(e,t,i){if(!Zg(e))return Jg(t);if(!Zg(t))return Jg(e);const n=jg(i);if(n<=0)return Jg(e);if(n>=1)return Jg(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=tf(e.viewBox.w,t.viewBox.w,n),c=tf(e.viewBox.h,t.viewBox.h,n),h=ef(r,s,n),d=ef(o,a,n);return{zoom:tf(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=Jg(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=Jg(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=Jg(t.to),this._hooks.settled(t),this._state?.token===e&&(this._state=null))}}function rf(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 of=Object.freeze({rotDeg:0,tiltDeg:20,xyScale:1,zScale:1,origin:Object.freeze([500,500])}),sf=84,af=10,lf=4,cf=4;function hf(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 df(e,t,i=of){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,pf(t,i))}function uf(e,t=of){if(!hf(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 pf(e=0,t=of){if(!hf(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 _f(e=of){return function(e=0,t=of){return`matrix(${pf(e,t).map(e=>Number(e.toFixed(12))).join(" ")})`}(0,e)}function mf(e,t=of){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=>[df(e,-o,t),df(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 gf=[".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(","),ff=(e,t)=>{try{return"function"==typeof e?.matches&&e.matches(t)}catch{return!1}};function vf(e){for(const t of e){const e=t;if(ff(e,".roomlabel[data-id]")){const t=e.getAttribute?.("data-id");return t?{kind:"room",roomId:t}:{kind:"interactive"}}if(ff(e,gf))return{kind:"interactive"};if(ff(e,'[data-hp="room"][data-id]')){const t=e.getAttribute?.("data-id");return t?{kind:"room",roomId:t}:{kind:"interactive"}}if(ff(e,".stage"))return{kind:"background"}}return{kind:"outside"}}function yf(e){const t=vf(e);return"room"===t.kind?t.roomId:null}class bf{constructor(){this.pointer=null,this.sequence=null}clear(){this.pointer=null,this.sequence=null}clearOutside(e){let t={kind:"outside"};try{t=vf(e.composedPath())}catch{}"outside"===t.kind&&this.clear()}pointerDown(e,t,i){let n={kind:"outside"};try{n=vf(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=vf(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 wf=e=>e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1]);function kf(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 xf(e,t=0){if(!e.length||!Number.isFinite(t)||t<0||!e.every(wf))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 Sf(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 $f(e,t){return`${e("editor.load_failed")} ${e(t.terminal?"editor.refresh_advice":"editor.retry_advice")}`}class Mf extends Error{}class Rf{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 Mf(`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 Mf&&(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 Cf=(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}},Tf=(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)}},Df=new Set(["select","draw","column","merge","split","resize","opening","wallthick","delroom"]),Af=e=>`${window.innerWidth}x${window.innerHeight}|${location.pathname}|${JSON.stringify(e??{})}`,Pf="houseplan_card_alpha_v1",Ff=Object.freeze([Object.freeze({id:"iso",issue:89,summary:"Volumetric plan renderer"})]);function zf(e){return/^[a-z][a-z0-9-]*$/.test(e.id)&&Number.isInteger(e.issue)&&e.issue>0&&!!e.summary.trim()}function If(e){const t=String(e||"").replace(/^#/,"");return new URLSearchParams(t)}function Of(e){return If(e).get("space")||""}function Ef(e,t,i=Ff){const n=function(e){const t=new Set;for(const i of e){if(!zf(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(If(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:Of(e.hash),persist:n&&o?l?"1":"0":void 0,knownUrlOperation:o}}let Nf={alpha:!1,active:Object.freeze([]),space:""},Hf=!1,Lf="";const Bf=new Set;function qf(){if("undefined"==typeof window)return Nf;const e=Ef(window.location,function(){try{return window.localStorage.getItem(Pf)}catch{return null}}());void 0!==e.persist&&function(e){try{window.localStorage.setItem(Pf,e)}catch{}}(e.persist),Nf={alpha:e.alpha,active:e.active,space:e.space},window.__hpAlpha=e.alpha,window.__hpLabs=e.active;for(const e of Bf)e(Nf);return Nf}function jf(){qf()}function Wf(){if("undefined"==typeof window)return Nf;if(!Hf){Hf=!0,window.__hpLabsListenerCleanup?.(),window.addEventListener("hashchange",jf),window.addEventListener("popstate",jf);const e=()=>{window.removeEventListener("hashchange",jf),window.removeEventListener("popstate",jf),window.__hpLabsListenerCleanup===e&&delete window.__hpLabsListenerCleanup};window.__hpLabsListenerCleanup=e}return qf()}const Uf={window:120,door:90,passage:90,gate:300};function Gf(e){return Uf[e]}function Vf(e,t){return{type:e,lengthCm:Gf(e),flipH:!1,flipV:!1,revision:t}}function Kf(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 Yf(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 Xf(e){const t=new Map;return e.forEach((e,i)=>{if(!e.kind||e.open)return;const n=Yf(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 Zf(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 Jf(e){const t=Xf(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=Yf(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(Zf),n=t.filter(t=>!t.target.partitionHost||e.renderedLength+2*t.target.physicalHalfWidth<=t.length+1e-9).sort(Zf);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 Qf(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 ev(e){return!(!e.canEdit||e.kiosk||e.fixedFloor)&&("view"!==e.mode&&("mouse"===e.pointerType&&e.spaceCount>1))}class tv{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 iv=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-g1LT0Cej.js").then(function(e){return e.e}).then(({LoadedSummaryPanelRuntime:e})=>t=>new e(t)));function nv(e){const t=globalThis.__HP_VERSION_OVERRIDE__;return"string"==typeof t&&t.length>0?t:e}let rv=0;const ov="1.77.0-beta.1",sv="271e0747b4ddef1af0d15d8bf63a832d72b0f7211550c349a59b3baa3864a84e",av=1500,lv=new Map;let cv=0,hv=1e4;const dv="houseplan_card_layout_v1",uv="houseplan_card_cfg_v1",pv="houseplan_card_zoom_v1",_v="houseplan_card_nav_v1",mv="houseplan_card_view_v1",gv="hp-dialog, hp-help, hp-color-opacity, hp-device-preview",fv=1e3,vv=(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}},yv=(e,t,i)=>{const n=new Event(t,{bubbles:!0,composed:!0});n.detail=i??{},e.dispatchEvent(n)},bv=e=>{history.pushState(null,"",e),yv(window,"location-changed",{replace:!1})},wv=(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},kv=e=>{try{e.target?.setPointerCapture?.(e.pointerId)}catch{}},xv=["edges","corners"];class Sv 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 Rf({expectedFingerprint:sv,load:async e=>{const t=0===e?await import("./houseplan-editor-runtime-CffLSWDF.js"):await import((()=>{const e=new URL("./houseplan-editor-runtime-CffLSWDF.js",import.meta.url);return e.searchParams.set("hp_retry",`${ov}-${++rv}`),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($f(e=>this._t(e),t))}}),this._onboardingRuntimeLoader=new Rf({expectedFingerprint:sv,load:async e=>{const t=0===e?await import("./houseplan-onboarding-runtime-aNl4FiLj.js"):await import((()=>{const e=new URL("./houseplan-onboarding-runtime-aNl4FiLj.js",import.meta.url);return e.searchParams.set("hp_retry",`${ov}-${++rv}`),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($f(e=>this._t(e),t))}}),this._isoSceneRuntime=null,this._isoSceneRuntimeLoader=new Rf({expectedFingerprint:sv,load:async e=>{const t=0===e?await import("./iso-scene-render-C9GeuwoY.js"):await import((()=>{const e=new URL("./iso-scene-render-C9GeuwoY.js",import.meta.url);return e.searchParams.set("hp_retry",`${ov}-${++rv}`),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",Sf("runtime-load","unverified",t.terminal)),this.isConnected&&this.requestUpdate()}}),this._pdfRuntime=null,this._pdfRuntimeLoader=new Rf({expectedFingerprint:sv,load:async e=>{const t=0===e?await import("./pdf-export-D_xOUM3j.js"):await import((()=>{const e=new URL("./pdf-export-D_xOUM3j.js",import.meta.url);return e.searchParams.set("hp_retry",`${ov}-${++rv}`),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=$f(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 Uu((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 Yu,this._virtualLights=qh(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 cg(this,()=>this._syncPointerHoverTargets()),this._devicePressAnimations=new Map,this._selId=null,this._toast="",this._mode="view",this._pendingNavMode=null,this._decorTool="select",this._decorStyle={...Cr},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 Kg({frame:e=>this._applyModeTransitionFrame(e),settled:e=>this._settleModeTransition(e)}),this._cameraTransitionFit=null,this._cameraTransition=new nf({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 yg(50),this._devicePositionHistory=new yg(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=xm(),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 bf,this._deviceHits=new Sc,this._pointers=new Map,this._panStart=null,this._panLock=null,this._pinchStart=null,this._safeDayCycleOutline=!1,this._suppressClick=!1,this._viewportGestureDirty=!1,this._touchContacts=new Map,this._touchClickGuard=new gc,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 Sg({clock:{setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e)},storage:()=>e.ownerDocument.defaultView?.sessionStorage??null,safety:()=>Rg(e),reload:()=>e._reloadDocument(),changed:()=>{e.requestUpdate()}})),this._haSupportApi=null,this._haDecorAssetsApi=null,this._haSummaryPanelApi=null,this._haRadarStage1Api=null,this._radarLive=new zg(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=++cv,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 tv(iv,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+rg)>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 Cg,this._liveEditorPaintCount=0,this._onHaRegistryUpdate=()=>{const e=sd(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,od(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 mc(()=>this.requestUpdate()),this._dirtyPos=new Set,this._sentPos=new Map,this._persistLayout=wv(()=>{if(this._serverStorage){const e=[...this._dirtyPos];this._dirtyPos.clear();for(const t of e){const e=xo(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=wv(()=>{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=cr(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,()=>Tg(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=Ol,i=this,Fl(e,jl)&&"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:Tr(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:Tr(i.fill_opacity,t.fillOpacity)}}(n,Cr))}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(Sv.ZOOM_MAX,Math.max(Sv.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||!Qg(o,e))&&(Qg(r,e)?(this._cancelCameraTransition(!1),!1):(this._activateSafeDayCycleOutline(),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:Wg(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(Sv.ZOOM_MAX,Math.max(Sv.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)-rf(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:Wg(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 ev({canEdit:this._canEdit,kiosk:this._kiosk,mode:this._mode,pointerType:"mouse",spaceCount:this._model.length,fixedFloor:this._hasFixedFloor})}_tabPointerDown(e,t){ev({canEdit:this._canEdit,kiosk:this._kiosk,mode:this._mode,pointerType:e.pointerType,spaceCount:this._model.length,fixedFloor:this._hasFixedFloor})&&(kv(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}_activateSafeDayCycleOutline(){this._safeDayCycleOutline=!0,this._stageEl?.classList.add("hp-safe-daycycle-outline")}get _touchSequenceMultitouch(){return this._touchClickGuard.sequenceMultitouch}_syncDangerConfirmLocaleGate(){return this._config&&this.hass?_p(this,yp,$p(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:nv(ov),backendVersion:this._haIntegrationVersion,kiosk:!0===this._config?.kiosk,reducedMotion:this._reducedMotion})}_newContinuityController(){return new dc(()=>{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(mv,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?uf(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?df([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 Of(window.location.hash||"")}connectedCallback(){this._connectedPath=location.pathname,this._routeDepartureHandled=!1,this._configReloadAuthority.observeContext(Xu(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=_g(this.ownerDocument);var t;void 0!==e&&(this._glowScreenBlend=e),this._continuityUnsub?.(),this._continuityUnsub=cc(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"))},vp.add(t),()=>vp.delete(t)),function(e){return Il.add(e),()=>{Il.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(),pg(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){Bf.add(e);const t=Wf();return"undefined"==typeof window&&e(t),()=>{Bf.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},av)),!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),Om(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-CV6uoEg_.js"),document.createElement("houseplan-card-editor")}static getStubConfig(){return{type:"custom:houseplan-card"}}static _warmBootReset(e){for(const e of lv.values())for(const t of e)clearTimeout(t.evict);lv.clear(),hv=e&&e>0?e:1e4}static _warmBootStats(){let e=0,t=0;const i=[];for(const n of lv.values())for(const r of n)e++,r.dlg&&(t++,i.push(r.dlg.kind));return{keys:lv.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(pv)||"{}")||{}}catch{this._zoomBySpace={}}try{const e=JSON.parse(localStorage.getItem(mv)||"{}")||{};this._viewPreference=Object.fromEntries(Object.entries(e).filter(e=>"flat"===e[1]||"iso"===e[1]))}catch{this._viewPreference={}}if(this._labs=Wf(),this.isConnected&&this._labsIso&&this._ensureIsoSceneRuntime(),!this._summary?.applyLocalScaleForCurrentIdentity())try{const e=JSON.parse(localStorage.getItem("houseplan_card_kiosk_v1")||"null");this._kioskScale={icon:jn(e?.icon),font:jn(e?.font)}}catch{}try{const e=JSON.parse(localStorage.getItem(uv)||"null");this._adoption.restoreCached(e)&&(this._seedDecorStyle(this._serverCfg),this._cfgEpoch++,this._virtualLights=qh(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=Af(this._config);if(this._warmKey===e&&this._warmSlot)return;this._warmSlot&&this._warmRelease();const t=this.parentNode,i=this._warmIdx(t),n=lv.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>=sc,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>=sc,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},av)),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=lv.get(t);if(!e.live&&o&&o.length>1){const t=o.indexOf(e);t>=0&&o.splice(t,1)}},hv+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?df([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&&Df.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=Af(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=lv.get(i)||[];for(n.push(this._warmSlot),lv.set(i,n),this._warmTrim(n);lv.size>8;){const e=lv.keys().next().value;if(void 0===e||e===i)break;for(const t of lv.get(e)||[])clearTimeout(t.evict);lv.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>hv)&&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(Uh).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(uv,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 Rg(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=el(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 pc([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`
svg{position:absolute;inset:0;width:100%;height:100%;display:block;z-index:1;}.hp-static-stage>.hp-paper-outline-svg{z-index:0;overflow:visible;}.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",_g),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 mg=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 gg{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 fg(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 vg(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 yg="houseplan-card:version-reload-target:v1";function bg(e){if("string"!=typeof e)return null;return e.trim()||null}class wg{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:bg(e.frontendVersion),backendVersion:bg(e.backendVersion),kiosk:!0===e.kiosk,reducedMotion:!0===e.reducedMotion},i=function(e,t){const i=bg(e),n=bg(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(yg)===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(yg)===t?"attempted":(i.setItem(yg,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 kg=1;function xg(e,t){const i=t&&"object"==typeof t?t:{};e._haIntegrationVersion=bg(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 Sg(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 $g{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:ud(e),bindings:n},this.diagnosticsCache}}function Mg(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 Rg(e){return!!e&&"object"==typeof e&&1===e.version}function Cg(e,t){const i=e.radar;return e.space===t&&!0!==e.hidden&&!0!==e.removed&&Rg(i)&&!0===i.enabled&&!1!==i.show_live}const Tg={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 Dg=e=>"number"==typeof e&&Number.isFinite(e);class Ag{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&&Dg(t.x)&&Dg(t.y)&&Dg(t.expires_at)&&Dg(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&&Dg(t.x)&&Dg(t.y)&&Dg(t.radius)&&Dg(t.expires_at)&&Dg(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&&Dg(e[0])&&Dg(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&&!Dg(i))return[];const n=Array.isArray(t.polygon)?t.polygon.slice(0,64).flatMap(e=>Array.isArray(e)&&2===e.length&&Dg(e[0])&&Dg(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:Dg(t.reported_at)?t.reported_at:void 0,expires_at:Dg(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(!Dg(e.expires_at))return null;if(!Dg(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 Pg=Object.freeze({enabled:!1,z2mBaseTopics:Object.freeze([])});function Fg(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 zg(e){const t=e?.zigbee_topology;if(!t||"object"!=typeof t)return Pg;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=Fg(e);if(t&&!r.has(t)&&(r.add(t),o.push(t),8===o.length))break}return{enabled:!0===i.enabled,z2mBaseTopics:o}}function Ig(e,t){const i={...e},n=t.z2mBaseTopics.map(Fg).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 Og={now:()=>performance.now(),requestFrame:e=>requestAnimationFrame(e),cancelFrame:e=>cancelAnimationFrame(e)},Eg=e=>Math.max(0,Math.min(1,e)),Ng=(e,t,i)=>e+(t-e)*i,Hg=(e,t,i)=>{const n=1-e;return 3*n*n*e*t+3*n*e*e*i+e*e*e},Lg=e=>{const t=Eg(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,Hg(r,.2,.2)0&&e.w>0?t/e.w:1,viewBox:{...e}}}function qg(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 jg(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 Wg(e,t,i){const n=jg(e),r=jg(t);if(!n||!r)return i<.5?e:t;const o=Eg(i);return`rgba(${Math.round(Ng(n[0],r[0],o))}, ${Math.round(Ng(n[1],r[1],o))}, ${Math.round(Ng(n[2],r[2],o))}, ${Ng(n[3],r[3],o).toFixed(3)})`}class Ug{constructor(e,t=Og){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=Eg((e-t.startedAt)/t.duration);t.presented=i>=1?t.to:function(e,t,i){const n=Lg(i),r=Ng(e.stageWidth,t.stageWidth,n),o=Ng(e.stageHeight,t.stageHeight,n),s=Math.max(1e-9,e.viewport.pixelsPerUnit),a=Math.max(1e-9,t.viewport.pixelsPerUnit),l={centerX:Ng(e.viewport.centerX,t.viewport.centerX,n),centerY:Ng(e.viewport.centerY,t.viewport.centerY,n),pixelsPerUnit:Math.exp(Ng(Math.log(s),Math.log(a),n))};return{presentedMode:n<.5?e.presentedMode:t.presentedMode,editorChromeHeight:Ng(e.editorChromeHeight,t.editorChromeHeight,n),stageWidth:r,stageHeight:o,viewport:{...l,viewBox:qg(l,r,o)},stageColor:Wg(e.stageColor,t.stageColor,n),paperColor:Wg(e.paperColor,t.paperColor,n),sceneBrightness:Ng(e.sceneBrightness,t.sceneBrightness,n),architectureOpacity:Ng(e.architectureOpacity,t.architectureOpacity,n),backdropOpacity:Ng(e.backdropOpacity,t.backdropOpacity,n),viewWeight:Ng(e.viewWeight,t.viewWeight,n),editorWeight:Ng(e.editorWeight,t.editorWeight,n),toolbarContentOpacity:Ng(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 Gg={now:()=>"undefined"!=typeof performance?performance.now():Date.now(),requestFrame:e=>"function"==typeof requestAnimationFrame?requestAnimationFrame(e):null,cancelFrame:e=>{"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(e)}},Vg=e=>Number.isFinite(e);function Kg(e){return!!e&&Vg(e.zoom)&&e.zoom>0&&Vg(e.viewBox.x)&&Vg(e.viewBox.y)&&Vg(e.viewBox.w)&&e.viewBox.w>0&&Vg(e.viewBox.h)&&e.viewBox.h>0}function Yg(e){return{zoom:e.zoom,viewBox:{...e.viewBox}}}function Xg(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 Zg=(e,t,i)=>e+(t-e)*i,Jg=(e,t,i)=>Math.exp(Zg(Math.log(e),Math.log(t),i));class Qg{constructor(e,t=Gg){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=Yg(e),s=Yg(t),a=n>0&&Kg(o)&&Kg(s),l=this._clock.now(),c={token:r,phase:a?"running":"settling",from:o,to:s,presented:Yg(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?Yg(t.to):function(e,t,i){if(!Kg(e))return Yg(t);if(!Kg(t))return Yg(e);const n=Lg(i);if(n<=0)return Yg(e);if(n>=1)return Yg(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=Jg(e.viewBox.w,t.viewBox.w,n),c=Jg(e.viewBox.h,t.viewBox.h,n),h=Zg(r,s,n),d=Zg(o,a,n);return{zoom:Jg(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=Yg(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=Yg(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=Yg(t.to),this._hooks.settled(t),this._state?.token===e&&(this._state=null))}}function ef(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 tf=Object.freeze({rotDeg:0,tiltDeg:20,xyScale:1,zScale:1,origin:Object.freeze([500,500])}),nf=84,rf=10,of=4,sf=4;function af(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 lf(e,t,i=tf){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,hf(t,i))}function cf(e,t=tf){if(!af(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 hf(e=0,t=tf){if(!af(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 df(e=tf){return function(e=0,t=tf){return`matrix(${hf(e,t).map(e=>Number(e.toFixed(12))).join(" ")})`}(0,e)}function uf(e,t=tf){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=>[lf(e,-o,t),lf(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 pf=[".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(","),_f=(e,t)=>{try{return"function"==typeof e?.matches&&e.matches(t)}catch{return!1}};function mf(e){for(const t of e){const e=t;if(_f(e,".roomlabel[data-id]")){const t=e.getAttribute?.("data-id");return t?{kind:"room",roomId:t}:{kind:"interactive"}}if(_f(e,pf))return{kind:"interactive"};if(_f(e,'[data-hp="room"][data-id]')){const t=e.getAttribute?.("data-id");return t?{kind:"room",roomId:t}:{kind:"interactive"}}if(_f(e,".stage"))return{kind:"background"}}return{kind:"outside"}}function gf(e){const t=mf(e);return"room"===t.kind?t.roomId:null}class ff{constructor(){this.pointer=null,this.sequence=null}clear(){this.pointer=null,this.sequence=null}clearOutside(e){let t={kind:"outside"};try{t=mf(e.composedPath())}catch{}"outside"===t.kind&&this.clear()}pointerDown(e,t,i){let n={kind:"outside"};try{n=mf(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=mf(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 vf=e=>e.length>=2&&Number.isFinite(e[0])&&Number.isFinite(e[1]);function yf(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 bf(e,t=0){if(!e.length||!Number.isFinite(t)||t<0||!e.every(vf))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 wf(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 kf(e,t){return`${e("editor.load_failed")} ${e(t.terminal?"editor.refresh_advice":"editor.retry_advice")}`}class xf extends Error{}class Sf{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 xf(`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 xf&&(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 $f=(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}},Mf=(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)}},Rf=new Set(["select","draw","column","merge","split","resize","opening","wallthick","delroom"]),Cf=e=>`${window.innerWidth}x${window.innerHeight}|${location.pathname}|${JSON.stringify(e??{})}`,Tf="houseplan_card_alpha_v1",Df=Object.freeze([Object.freeze({id:"iso",issue:89,summary:"Volumetric plan renderer"})]);function Af(e){return/^[a-z][a-z0-9-]*$/.test(e.id)&&Number.isInteger(e.issue)&&e.issue>0&&!!e.summary.trim()}function Pf(e){const t=String(e||"").replace(/^#/,"");return new URLSearchParams(t)}function Ff(e){return Pf(e).get("space")||""}function zf(e,t,i=Df){const n=function(e){const t=new Set;for(const i of e){if(!Af(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(Pf(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:Ff(e.hash),persist:n&&o?l?"1":"0":void 0,knownUrlOperation:o}}let If={alpha:!1,active:Object.freeze([]),space:""},Of=!1,Ef="";const Nf=new Set;function Hf(){if("undefined"==typeof window)return If;const e=zf(window.location,function(){try{return window.localStorage.getItem(Tf)}catch{return null}}());void 0!==e.persist&&function(e){try{window.localStorage.setItem(Tf,e)}catch{}}(e.persist),If={alpha:e.alpha,active:e.active,space:e.space},window.__hpAlpha=e.alpha,window.__hpLabs=e.active;for(const e of Nf)e(If);return If}function Lf(){Hf()}function Bf(){if("undefined"==typeof window)return If;if(!Of){Of=!0,window.__hpLabsListenerCleanup?.(),window.addEventListener("hashchange",Lf),window.addEventListener("popstate",Lf);const e=()=>{window.removeEventListener("hashchange",Lf),window.removeEventListener("popstate",Lf),window.__hpLabsListenerCleanup===e&&delete window.__hpLabsListenerCleanup};window.__hpLabsListenerCleanup=e}return Hf()}const qf={window:120,door:90,passage:90,gate:300};function jf(e){return qf[e]}function Wf(e,t){return{type:e,lengthCm:jf(e),flipH:!1,flipV:!1,revision:t}}function Uf(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 Gf(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 Vf(e){const t=new Map;return e.forEach((e,i)=>{if(!e.kind||e.open)return;const n=Gf(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 Kf(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 Yf(e){const t=Vf(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=Gf(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(Kf),n=t.filter(t=>!t.target.partitionHost||e.renderedLength+2*t.target.physicalHalfWidth<=t.length+1e-9).sort(Kf);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 Xf(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 Zf(e){return!(!e.canEdit||e.kiosk||e.fixedFloor)&&("view"!==e.mode&&("mouse"===e.pointerType&&e.spaceCount>1))}class Jf{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 Qf=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-pjWn0aEE.js").then(function(e){return e.e}).then(({LoadedSummaryPanelRuntime:e})=>t=>new e(t)));function ev(e){const t=globalThis.__HP_VERSION_OVERRIDE__;return"string"==typeof t&&t.length>0?t:e}let tv=0;const iv="1.77.0-beta.1",nv="b468bec31a4d35a4630025ee2489e4187921a21b8f95e5abaaaace1921cfa3d8",rv=1500,ov=new Map;let sv=0,av=1e4;const lv="houseplan_card_layout_v1",cv="houseplan_card_cfg_v1",hv="houseplan_card_zoom_v1",dv="houseplan_card_nav_v1",uv="houseplan_card_view_v1",pv="hp-dialog, hp-help, hp-color-opacity, hp-device-preview",_v=1e3,mv=(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}},gv=(e,t,i)=>{const n=new Event(t,{bubbles:!0,composed:!0});n.detail=i??{},e.dispatchEvent(n)},fv=e=>{history.pushState(null,"",e),gv(window,"location-changed",{replace:!1})},vv=(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},yv=e=>{try{e.target?.setPointerCapture?.(e.pointerId)}catch{}},bv=["edges","corners"];class wv 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 Sf({expectedFingerprint:nv,load:async e=>{const t=0===e?await import("./houseplan-editor-runtime-BTZPftx5.js"):await import((()=>{const e=new URL("./houseplan-editor-runtime-BTZPftx5.js",import.meta.url);return e.searchParams.set("hp_retry",`${iv}-${++tv}`),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(kf(e=>this._t(e),t))}}),this._onboardingRuntimeLoader=new Sf({expectedFingerprint:nv,load:async e=>{const t=0===e?await import("./houseplan-onboarding-runtime-BE6dwLJ2.js"):await import((()=>{const e=new URL("./houseplan-onboarding-runtime-BE6dwLJ2.js",import.meta.url);return e.searchParams.set("hp_retry",`${iv}-${++tv}`),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(kf(e=>this._t(e),t))}}),this._isoSceneRuntime=null,this._isoSceneRuntimeLoader=new Sf({expectedFingerprint:nv,load:async e=>{const t=0===e?await import("./iso-scene-render-MSqpZfmO.js"):await import((()=>{const e=new URL("./iso-scene-render-MSqpZfmO.js",import.meta.url);return e.searchParams.set("hp_retry",`${iv}-${++tv}`),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",wf("runtime-load","unverified",t.terminal)),this.isConnected&&this.requestUpdate()}}),this._pdfRuntime=null,this._pdfRuntimeLoader=new Sf({expectedFingerprint:nv,load:async e=>{const t=0===e?await import("./pdf-export-CdUPKBCc.js"):await import((()=>{const e=new URL("./pdf-export-CdUPKBCc.js",import.meta.url);return e.searchParams.set("hp_retry",`${iv}-${++tv}`),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=kf(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 qu((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 Gu,this._virtualLights=Hh(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 sg(this,()=>this._syncPointerHoverTargets()),this._devicePressAnimations=new Map,this._selId=null,this._toast="",this._mode="view",this._pendingNavMode=null,this._decorTool="select",this._decorStyle={...Cr},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 Ug({frame:e=>this._applyModeTransitionFrame(e),settled:e=>this._settleModeTransition(e)}),this._cameraTransitionFit=null,this._cameraTransition=new Qg({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 gg(50),this._devicePositionHistory=new gg(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=bm(),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 ff,this._deviceHits=new wc,this._pointers=new Map,this._panStart=null,this._panLock=null,this._pinchStart=null,this._safeDayCycleOutline=!1,this._suppressClick=!1,this._viewportGestureDirty=!1,this._touchContacts=new Map,this._touchClickGuard=new pc,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 wg({clock:{setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e)},storage:()=>e.ownerDocument.defaultView?.sessionStorage??null,safety:()=>Sg(e),reload:()=>e._reloadDocument(),changed:()=>{e.requestUpdate()}})),this._haSupportApi=null,this._haDecorAssetsApi=null,this._haSummaryPanelApi=null,this._haRadarStage1Api=null,this._radarLive=new Ag(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=++sv,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 Jf(Qf,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+tg)>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 $g,this._liveEditorPaintCount=0,this._onHaRegistryUpdate=()=>{const e=nd(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,id(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 uc(()=>this.requestUpdate()),this._dirtyPos=new Set,this._sentPos=new Map,this._persistLayout=vv(()=>{if(this._serverStorage){const e=[...this._dirtyPos];this._dirtyPos.clear();for(const t of e){const e=xo(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=vv(()=>{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=cr(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,()=>Mg(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=Ol,i=this,Fl(e,Bl)&&"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:Tr(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:Tr(i.fill_opacity,t.fillOpacity)}}(n,Cr))}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(wv.ZOOM_MAX,Math.max(wv.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||!Xg(o,e))&&(Xg(r,e)?(this._cancelCameraTransition(!1),!1):(this._activateSafeDayCycleOutline(),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:Bg(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(wv.ZOOM_MAX,Math.max(wv.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)-ef(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:Bg(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 Zf({canEdit:this._canEdit,kiosk:this._kiosk,mode:this._mode,pointerType:"mouse",spaceCount:this._model.length,fixedFloor:this._hasFixedFloor})}_tabPointerDown(e,t){Zf({canEdit:this._canEdit,kiosk:this._kiosk,mode:this._mode,pointerType:e.pointerType,spaceCount:this._model.length,fixedFloor:this._hasFixedFloor})&&(yv(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}_activateSafeDayCycleOutline(){this._safeDayCycleOutline=!0,this._stageEl?.classList.add("hp-safe-daycycle-outline")}get _touchSequenceMultitouch(){return this._touchClickGuard.sequenceMultitouch}_syncDangerConfirmLocaleGate(){return this._config&&this.hass?dp(this,gp,kp(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:ev(iv),backendVersion:this._haIntegrationVersion,kiosk:!0===this._config?.kiosk,reducedMotion:this._reducedMotion})}_newContinuityController(){return new lc(()=>{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(uv,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?cf(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?lf([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 Ff(window.location.hash||"")}connectedCallback(){this._connectedPath=location.pathname,this._routeDepartureHandled=!1,this._configReloadAuthority.observeContext(Vu(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=dg(this.ownerDocument);var t;void 0!==e&&(this._glowScreenBlend=e),this._continuityUnsub?.(),this._continuityUnsub=sc(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"))},mp.add(t),()=>mp.delete(t)),function(e){return Il.add(e),()=>{Il.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(),hg(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){Nf.add(e);const t=Bf();return"undefined"==typeof window&&e(t),()=>{Nf.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},rv)),!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),Fm(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-v_hhQ3R4.js"),document.createElement("houseplan-card-editor")}static getStubConfig(){return{type:"custom:houseplan-card"}}static _warmBootReset(e){for(const e of ov.values())for(const t of e)clearTimeout(t.evict);ov.clear(),av=e&&e>0?e:1e4}static _warmBootStats(){let e=0,t=0;const i=[];for(const n of ov.values())for(const r of n)e++,r.dlg&&(t++,i.push(r.dlg.kind));return{keys:ov.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(hv)||"{}")||{}}catch{this._zoomBySpace={}}try{const e=JSON.parse(localStorage.getItem(uv)||"{}")||{};this._viewPreference=Object.fromEntries(Object.entries(e).filter(e=>"flat"===e[1]||"iso"===e[1]))}catch{this._viewPreference={}}if(this._labs=Bf(),this.isConnected&&this._labsIso&&this._ensureIsoSceneRuntime(),!this._summary?.applyLocalScaleForCurrentIdentity())try{const e=JSON.parse(localStorage.getItem("houseplan_card_kiosk_v1")||"null");this._kioskScale={icon:jn(e?.icon),font:jn(e?.font)}}catch{}try{const e=JSON.parse(localStorage.getItem(cv)||"null");this._adoption.restoreCached(e)&&(this._seedDecorStyle(this._serverCfg),this._cfgEpoch++,this._virtualLights=Hh(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=Cf(this._config);if(this._warmKey===e&&this._warmSlot)return;this._warmSlot&&this._warmRelease();const t=this.parentNode,i=this._warmIdx(t),n=ov.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>=nc,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>=nc,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},rv)),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=ov.get(t);if(!e.live&&o&&o.length>1){const t=o.indexOf(e);t>=0&&o.splice(t,1)}},av+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?lf([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&&Rf.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=Cf(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=ov.get(i)||[];for(n.push(this._warmSlot),ov.set(i,n),this._warmTrim(n);ov.size>8;){const e=ov.keys().next().value;if(void 0===e||e===i)break;for(const t of ov.get(e)||[])clearTimeout(t.evict);ov.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>av)&&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(qh).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(cv,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 Sg(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=el(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 hc([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()} @@ -363,7 +363,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 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 el(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?$c(this._model,this._space):(e=this._model,t=this._space,e.find(e=>e.id===t)??e[0]);var e,t}_spaceModelById(e){return $c(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=nu({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 vn(this._settings)}get _excluded(){return du(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(Xu(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,()=>Tg(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=rf(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){Mg(this,e)}_syncRadarLive(){const e=this._serverCfg?.settings?.radar,t=(this._serverCfg?.markers||[]).some(e=>Ag(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 mm(this.hass,um(e),this._cfgRev);t===this._decorAssetSyncToken&&(this._decorAssets=i,this._resign(),this.requestUpdate())}_adoptAuthoritative(e){return Gu(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=>Mg(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(dv)||"{}")||{}}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=Vh(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 Zu(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-BI1aUBNm.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=rd(this.hass,this._onHaRegistryUpdate),this._onHaRegistryUpdate())}get _haRegistry(){return sd(this.hass)}get _planHass(){const e=this._haRegistry,t=ld(this.hass,e),i=this._planHassMemo;if(i&&i.hass===this.hass&&i.sig===t)return i.active;const n=hd(this.hass,e),r=dd(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+rg)>e?1:0)).join("|"),i=Wh(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=Xi(e[1]);t?.entity&&s.add(t.entity)}t.entity&&s.add(t.entity),o.set(`decor:${e.id}:${t.id}`,tn(t.text,t,n,e=>!!n.entities?.[e]&&!!n.states?.[e]&&!tu(n,e,eu(this._markers))))}const h=Ld(n,this._devices,null,this._virtualLights);for(const e of this._devices){for(const t of[!1,!0])r.set(b_(e.id,t),g_(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?Vc(n?.states?.[t]?.attributes):null,r=this._vacRt.get(e.id),s=dh(e.id,e.marker?.vacuum??null,e.space,t),a=ph({routes:s,observed:_h(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=y_({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 _d(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&&bv("/config/devices/device/"+encodeURIComponent(e.device_id))}}else bv("/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=Nn(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=So(lo(this._layout)),localStorage.setItem(dv,JSON.stringify(this._layout))}_maybeRebuildDevices(){const e=this.hass;if(!e?.devices||!e?.entities||!e?.areas)return;const t=this._haRegistry,i=ld(e,t)+":"+Object.keys(e.areas).length+":"+(this._norm?"n":"l")+":"+$p(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=ou({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,_d(e,n,t));!function(e){if("undefined"==typeof localStorage||!e.size)return;const t=pd(),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));Jh=n;try{localStorage.setItem(Zh,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)&&(yv(this,"hass-more-info",{entityId:null}),this._nativeMoreInfoEntity=null)}_resolveAreaRelocations(e=this._haRegistry){const t=function(e){const t=im(e.snapshot),i=new Set(Object.values(t).map(e=>e.binding)),n=new Map;for(const[t,r]of e.previousCandidates||[])tm(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||(em(t.id)&&r.add(t.id),tm(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]=am(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&&od(this.hass),lm({devices:this._devices,model:this._model,layout:this._layout,snapshot:this._settings.marker_area_snapshot,authoritative:e.authoritative,cleanupSnapshotIds:t.removeIds,coordinateScale:fv})}_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=uc({snapshot:im(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=bg(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=wg(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=im(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=uc(o)!==uc(im(r.marker_area_snapshot)),l=uc(s)!==uc(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(uc(a.marker_area_snapshot)===uc(o)&&uc(a.new_device_ids)===uc(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=jd(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*Ml(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]=al(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*fv,y:i.y*fv}}else if(void 0===i.s)return{x:i.x,y:i.y};return this._defPos[e.id]?this._defPos[e.id]:t?al($l(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:cl(r/fv),y:cl(o/fv)}}_previewDevicePlacement(e,t){this._layout=wg(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=wg(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=xo(this._layout[e]);uc(t)!==uc(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=bg(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=wg(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(b_(e.id,t));return n||g_(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,m_({...i,visual:t}).join(" "))}_liveTemp(e){if(!this._config?.show_temperature)return null;if(!0===e.marker?.use_climate_temp){const t=Ud(this._renderPlanHass,e.entities);if(null!=t)return t}return"mdi:thermometer"!==e.icon&&"mdi:air-filter"!==e.icon?null:Wd(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 Yn(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,yv(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=Pu(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(!Nu(e))return void this._showUnavailableToggleTargets(e);const t=e=>{const t=Nu(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=Vh(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&&!Nu(r)&&this._showUnavailableToggleTargets(r)||(r&&Lu(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||Nu(e)||"configured-targets-missing"!==e.noneReason)return[];if(!e.skippedTargets.length||e.skippedTargets.some(e=>!Hu.has(e.reason)&&"secure"!==e.reason))return[];const t=[],i=new Set;for(const n of e.skippedTargets){if(!Hu.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 Mp($p(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=pl([[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=pl("line"===e.kind?[[e.x1*fv,e.y1*i],[e.x2*fv,e.y2*i]]:"text"===e.kind?[[e.x*fv,e.y*i]]:Nr({x:e.x*fv,y:e.y*i,w:e.w*fv,h:e.h*i,angle:e.angle}));n&&t.push(n)}for(const i of this._physicalBodiesR(e)){const e=pl(i);e&&t.push(e)}}return vl(e,t)}_frameOf(){const e=this._spaceModel();if(!e){this._frame=null;const e={x:0,y:0,w:fv,h:fv};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=kl(this._contentItems(e));let r=n.all||Sl(e),o=this._showFar?r:n.core||Sl(e);return t&&t.id===e.id&&i&&t.grow&&(o=vv(t.rect,o),r=vv(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:fv,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=vv(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,M_(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",Sf("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?df(e,0):e}_floorView(e){if("iso"!==this._renderProjection)return e;const t=uf([e.x,e.y]),i=uf([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=mf({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=Fs(t.rooms,e.id,n,r,this._wallKeyPitch,this._cellCm,this._gridPitch,fv);i&&(l=aa(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(wf)||!i.every(wf)||!Number.isFinite(n)||n<0)return null;if("flat"===e.projection)return xf([...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(df(t,0)),o>0&&e.push(df(t,-o))}for(const t of i){const i=[t[0],t[1]];e.push(df(i,0)),r>0&&e.push(df(i,r))}return xf(e,n)}catch{return null}}({floor:s,wall:l,projection:c,wallHeight:"iso"===c&&a.showBorders?Wa(84,this._cellCm):0,floorDepth:"iso"===c&&a.showBorders?Wa(10,this._cellCm):0,padding:a.showBorders?Wa(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(!kf(i)||!kf(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:Sv.ZOOM_MIN,maxZoom:Sv.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),Qg(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 el(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?kc(this._model,this._space):(e=this._model,t=this._space,e.find(e=>e.id===t)??e[0]);var e,t}_spaceModelById(e){return kc(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=eu({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 vn(this._settings)}get _excluded(){return lu(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(Vu(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,()=>Mg(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=ef(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){xg(this,e)}_syncRadarLive(){const e=this._serverCfg?.settings?.radar,t=(this._serverCfg?.markers||[]).some(e=>Cg(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 um(this.hass,cm(e),this._cfgRev);t===this._decorAssetSyncToken&&(this._decorAssets=i,this._resign(),this.requestUpdate())}_adoptAuthoritative(e){return ju(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=>xg(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(lv)||"{}")||{}}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=Wh(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 Ku(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-CxkX2LMW.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=td(this.hass,this._onHaRegistryUpdate),this._onHaRegistryUpdate())}get _haRegistry(){return nd(this.hass)}get _planHass(){const e=this._haRegistry,t=od(this.hass,e),i=this._planHassMemo;if(i&&i.hass===this.hass&&i.sig===t)return i.active;const n=ad(this.hass,e),r=ld(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+tg)>e?1:0)).join("|"),i=Bh(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=Xi(e[1]);t?.entity&&s.add(t.entity)}t.entity&&s.add(t.entity),o.set(`decor:${e.id}:${t.id}`,tn(t.text,t,n,e=>!!n.entities?.[e]&&!!n.states?.[e]&&!Jd(n,e,Zd(this._markers))))}const h=Ed(n,this._devices,null,this._virtualLights);for(const e of this._devices){for(const t of[!1,!0])r.set(f_(e.id,t),p_(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?Wc(n?.states?.[t]?.attributes):null,r=this._vacRt.get(e.id),s=lh(e.id,e.marker?.vacuum??null,e.space,t),a=hh({routes:s,observed:dh(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=g_({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 dd(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&&fv("/config/devices/device/"+encodeURIComponent(e.device_id))}}else fv("/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=Nn(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=So(lo(this._layout)),localStorage.setItem(lv,JSON.stringify(this._layout))}_maybeRebuildDevices(){const e=this.hass;if(!e?.devices||!e?.entities||!e?.areas)return;const t=this._haRegistry,i=od(e,t)+":"+Object.keys(e.areas).length+":"+(this._norm?"n":"l")+":"+kp(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=iu({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,dd(e,n,t));!function(e){if("undefined"==typeof localStorage||!e.size)return;const t=hd(),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));Yh=n;try{localStorage.setItem(Kh,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)&&(gv(this,"hass-more-info",{entityId:null}),this._nativeMoreInfoEntity=null)}_resolveAreaRelocations(e=this._haRegistry){const t=function(e){const t=Q_(e.snapshot),i=new Set(Object.values(t).map(e=>e.binding)),n=new Map;for(const[t,r]of e.previousCandidates||[])J_(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||(Z_(t.id)&&r.add(t.id),J_(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]=rm(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&&id(this.hass),om({devices:this._devices,model:this._model,layout:this._layout,snapshot:this._settings.marker_area_snapshot,authoritative:e.authoritative,cleanupSnapshotIds:t.removeIds,coordinateScale:_v})}_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=cc({snapshot:Q_(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=fg(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=vg(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=Q_(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=cc(o)!==cc(Q_(r.marker_area_snapshot)),l=cc(s)!==cc(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(cc(a.marker_area_snapshot)===cc(o)&&cc(a.new_device_ids)===cc(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=Ld(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*Ml(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]=al(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*_v,y:i.y*_v}}else if(void 0===i.s)return{x:i.x,y:i.y};return this._defPos[e.id]?this._defPos[e.id]:t?al($l(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:cl(r/_v),y:cl(o/_v)}}_previewDevicePlacement(e,t){this._layout=vg(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=vg(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=xo(this._layout[e]);cc(t)!==cc(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=fg(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=vg(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(f_(e.id,t));return n||p_(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,u_({...i,visual:t}).join(" "))}_liveTemp(e){if(!this._config?.show_temperature)return null;if(!0===e.marker?.use_climate_temp){const t=qd(this._renderPlanHass,e.entities);if(null!=t)return t}return"mdi:thermometer"!==e.icon&&"mdi:air-filter"!==e.icon?null:Bd(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 Yn(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,gv(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=Tu(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(!Iu(e))return void this._showUnavailableToggleTargets(e);const t=e=>{const t=Iu(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=Wh(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&&!Iu(r)&&this._showUnavailableToggleTargets(r)||(r&&Eu(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||Iu(e)||"configured-targets-missing"!==e.noneReason)return[];if(!e.skippedTargets.length||e.skippedTargets.some(e=>!Ou.has(e.reason)&&"secure"!==e.reason))return[];const t=[],i=new Set;for(const n of e.skippedTargets){if(!Ou.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 xp(kp(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=pl([[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=pl("line"===e.kind?[[e.x1*_v,e.y1*i],[e.x2*_v,e.y2*i]]:"text"===e.kind?[[e.x*_v,e.y*i]]:Nr({x:e.x*_v,y:e.y*i,w:e.w*_v,h:e.h*i,angle:e.angle}));n&&t.push(n)}for(const i of this._physicalBodiesR(e)){const e=pl(i);e&&t.push(e)}}return vl(e,t)}_frameOf(){const e=this._spaceModel();if(!e){this._frame=null;const e={x:0,y:0,w:_v,h:_v};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=kl(this._contentItems(e));let r=n.all||Sl(e),o=this._showFar?r:n.core||Sl(e);return t&&t.id===e.id&&i&&t.grow&&(o=mv(t.rect,o),r=mv(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:_v,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=mv(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,x_(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",wf("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?lf(e,0):e}_floorView(e){if("iso"!==this._renderProjection)return e;const t=cf([e.x,e.y]),i=cf([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=uf({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=Fs(t.rooms,e.id,n,r,this._wallKeyPitch,this._cellCm,this._gridPitch,_v);i&&(l=aa(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(vf)||!i.every(vf)||!Number.isFinite(n)||n<0)return null;if("flat"===e.projection)return bf([...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(lf(t,0)),o>0&&e.push(lf(t,-o))}for(const t of i){const i=[t[0],t[1]];e.push(lf(i,0)),r>0&&e.push(lf(i,r))}return bf(e,n)}catch{return null}}({floor:s,wall:l,projection:c,wallHeight:"iso"===c&&a.showBorders?Wa(84,this._cellCm):0,floorDepth:"iso"===c&&a.showBorders?Wa(10,this._cellCm):0,padding:a.showBorders?Wa(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(!yf(i)||!yf(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:wv.ZOOM_MIN,maxZoom:wv.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),Xg(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})} @@ -371,7 +371,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 style="left:${a.toFixed(1)}%;top:${l.toFixed(1)}%" @click=${e=>{e.stopPropagation(),this._fitAll("home")}}> - `}_stageAspect(e=this._baseVb()){const t=this._stageEl;return t&&t.clientHeight?t.clientWidth/t.clientHeight:e[2]/e[3]}_viewOr(e){return this._view&&this._view.w?this._view:Oi(e,this._stageAspect(e))}_roomLabelReferenceViewWidth(e){if(!this._markup)return e.w;const t=this._viewModeSnap;if(t?.space===this._space&&t.w)return t.w*t.zoom/this._zoom;const i=this._stageEl,n=this.renderRoot.querySelector(".editorchrome");if(!i?.clientWidth||!i.clientHeight)return e.w;const r=i.clientHeight+(n?.offsetHeight||0);return this._viewForModeTarget(this._zoom,void 0,void 0,i.clientWidth,r).w}_screenToVb(e,t){const i=this._stageEl,n=this._viewOr(this._baseVb()),r=i?.clientWidth||1,o=i?.clientHeight||1;return[n.x+e/r*n.w,n.y+t/o*n.h]}_clampView(e,t){const i=(e,t,i,n)=>{const r=1*Math.max(t,n),o=i-r,s=i+n-t+r;return Math.max(Math.min(o,s),Math.min(Math.max(o,s),e))};return{w:e.w,h:e.h,x:i(e.x,e.w,t.x,t.w),y:i(e.y,e.h,t.y,t.h)}}_applyView(e,t,i){this._cancelCameraTransition(!1);const n=this._baseVb(),r=Oi(n,this._stageAspect()),o=Math.min(Sv.ZOOM_MAX,Math.max(Sv.ZOOM_MIN,e)),s=r.w/o,a=r.h/o,l=this._viewOr(n),c=t??l.x+l.w/2,h=i??l.y+l.h/2,d=this._clampView({x:c-s/2,y:h-a/2,w:s,h:a},r);return!(this._view&&Math.abs(this._zoom-o)<1e-9&&Math.abs(this._view.x-d.x)<1e-6&&Math.abs(this._view.y-d.y)<1e-6&&Math.abs(this._view.w-d.w)<1e-6&&Math.abs(this._view.h-d.h)<1e-6)&&("opening"===this._tool&&(this._cursorPt=null,this._clearOpeningPlacement(!1)),this._zoom=o,this._view=d,this._liveVp(),!0)}_bootWatch(){clearTimeout(this._bootTimer),this._bootStart=Date.now(),this._bootLastH=-1,this._bootLastChange=this._bootStart;const e=()=>{if(!this._booting)return;const t=Date.now(),i=this._stageEl?this._stageEl.clientHeight:0;i!==this._bootLastH&&(this._bootLastH=i,this._bootLastChange=t);const n=t-this._bootStart;var r,o,s;n>=1200||n>=700&&i>0&&t-this._bootLastChange>=250&&(r=Ol,o=this._serverCfg,s=jl,"pending"!==r.state()||!Fl(o,s))?this._bootSettled():this._bootTimer=window.setTimeout(e,100)};this._bootTimer=window.setTimeout(e,100)}_bootSettled(){this._booting&&!this._bootSettling&&(this._bootSettling=!0,this._refitView(),this._bootSettleRaf=requestAnimationFrame(()=>{this._bootSettleRaf=0,this._finishBootSettled()}))}_finishBootSettled(){if(!this._booting)return;this._refitView(),this._booting=!1,this._bootSettling=!1;const e=this._stageEl?.clientHeight??0;!this._config?.kiosk&&e>0&&this._warmPatch({hdrH:this._hdrH,stageH:e,vp:this._warmViewportState()},!0),this._bootFading=!0,this._bootTimer=window.setTimeout(()=>{this._bootFading=!1},220),this._bootSoft=!0,clearTimeout(this._bootSoftTimer),this._bootSoftTimer=window.setTimeout(()=>{this._bootSoft=!1},av)}_bootSoftCancel(){if(!this._bootSoft)return;clearTimeout(this._bootSoftTimer),this._bootSoft=!1;const e=function(e,t,i,n){if(!t)return null;const r=rf(e,t,i);return i||n||null===r||(t.style.height=`calc(100dvh - ${r}px)`),t.classList.remove("hpsettle"),t.getBoundingClientRect(),t.clientWidth<=0||t.clientHeight<=0?null:{headerHeight:r,size:[t.clientWidth,t.clientHeight]}}(this.renderRoot,this._stageEl,this.panelHost,this._kiosk);if(!e)return;null!==e.headerHeight&&(this._hdrH=e.headerHeight),this._refitRaf&&(cancelAnimationFrame(this._refitRaf),this._refitRaf=0),this._pendingRefitSize=null,this._lastValidStageSize=e.size;const t=this._view;t&&this._applyView(this._zoom,t.x+t.w/2,t.y+t.h/2)}_beginResumeSettle(){this._booting||this._resumeSettling||(this._modeTransitionPreparing?this._modeTransitionForceAtomic=!0:this._cancelModeTransition(!0),this._viewportInvalidAt=0,this._beginContinuityCandidate("warm-resume",!1),this._loading?this.requestUpdate():this._loadFromServer())}_refitView(){if(this._modeTransitionBusy||this._warmModeRequest)return;const e=this._stageEl;if(!e||"visible"!==document.visibilityState||e.clientWidth<=0||e.clientHeight<=0)return this._cancelCameraTransition(!1),void(this._viewportInvalidAt||(this._viewportInvalidAt=Date.now()));const t=[e.clientWidth,e.clientHeight];if(this._bootSoft&&this._warmVp)return this._lastValidStageSize=t,void(this._pendingRefitSize=null);const i=this._lastValidStageSize,n=!!i&&Math.abs(i[0]-t[0])<=.5&&Math.abs(i[1]-t[1])<=.5,r=this._viewportInvalidAt?Date.now()-this._viewportInvalidAt:0;if(this._viewportInvalidAt=0,n)this._pendingRefitSize=null;else{if(this._cancelCameraTransition(!1),!i)return this._lastValidStageSize=t,void(this._roomFocus?.spaceId===this._space?this._fitRoom(this._roomFocus.roomId,!1):this._view||this._applyView(this._zoom));this._pendingRefitSize=t,this._refitRaf||(this._refitRaf=requestAnimationFrame(()=>{this._refitRaf=0;const e=this._pendingRefitSize;this._pendingRefitSize=null;const t=this._stageEl;if(!e||!t||t.clientWidth<=0||t.clientHeight<=0)return;if(Math.abs(t.clientWidth-e[0])>.5||Math.abs(t.clientHeight-e[1])>.5)return void this._refitView();const i=this._lastValidStageSize;if(i&&Math.abs(i[0]-e[0])<=.5&&Math.abs(i[1]-e[1])<=.5)return;this._lastValidStageSize=e;const n=this._view;r>=sc?this._beginContinuityCandidate("stage-size-restored",!0,"stage-size"):this._continuity.hasCompleteFrame&&this._beginContinuityCandidate("stage-resize",!0,"stage-size"),this._roomFocus?.spaceId!==this._space?this._applyView(this._zoom,n?n.x+n.w/2:void 0,n?n.y+n.h/2:void 0):this._fitRoom(this._roomFocus.roomId,!1)}))}}_cameraTargetAt(e,t,i,n=!1){const r=this._stageEl;if(!r||r.clientWidth<=0||r.clientHeight<=0)return null;const o=Oi(this._baseVb(),this._stageAspect()),s=Math.min(Sv.ZOOM_MAX,Math.max(Sv.ZOOM_MIN,i)),a=function(e,t,i,n,r,o,s){if(!Zg(e)||!Zg({zoom:t,viewBox:i})||!Xg(n)||n<=0||!Xg(r)||r<=0||!Xg(o)||!Xg(s))return null;const a=o/n,l=s/r,c=e.viewBox.x+a*e.viewBox.w,h=e.viewBox.y+l*e.viewBox.h,d=i.w/t,u=i.h/t;return{zoom:t,viewBox:{x:c-a*d,y:h-l*u,w:d,h:u}}}(n&&this._cameraTransition.target||this._cameraState(),s,o,r.clientWidth,r.clientHeight,e,t);return a?(a.viewBox=this._clampView(a.viewBox,o),{target:a,fit:o}):null}_zoomAt(e,t,i){this._clearRoomFocus(),this._cancelCameraTransition(!1);const n=this._cameraTargetAt(e,t,i);n&&("opening"===this._tool&&(this._cursorPt=null,this._clearOpeningPlacement(!1)),this._zoom=n.target.zoom,this._view={...n.target.viewBox},this._liveVp())}_onWheel(e){this._clearRoomFocus(),this._prepareCameraCommand();const t=this._stageEl;if(!t)return;e.preventDefault();const i=t.getBoundingClientRect(),n=e.deltaY<0?1.15:1/1.15,r=this._cameraTransition.target?.zoom??this._zoom,o=this._cameraTargetAt(e.clientX-i.left,e.clientY-i.top,r*n,!0);o&&this._startCameraTransition(o.target,o.fit,"wheel",160)}_stepZoom(e){this._clearRoomFocus(),this._prepareCameraCommand();const t=this._stageEl;if(!t)return;const i=this._cameraTransition.target?.zoom??this._zoom,n=this._cameraTargetAt(t.clientWidth/2,t.clientHeight/2,i*(e>0?1.4:1/1.4),!0);n&&this._startCameraTransition(n.target,n.fit,"button",180)}_resetZoom(e="fit"){this._clearRoomFocus(),this._prepareCameraCommand();const t=Oi(this._baseVb(),this._stageAspect());this._startCameraTransition({zoom:1,viewBox:{...t}},t,e,220)}_saveZoom(){if("view"===this._mode){this._zoomBySpace={...this._zoomBySpace,[this._space]:this._zoom};try{localStorage.setItem(pv,JSON.stringify(this._zoomBySpace))}catch{}}}_restoreZoom(){this._clearRoomFocus(!0),this._cancelCameraTransition(!1);const e=this._zoomBySpace[this._space]||1;this._zoom=e;const t=this._stageEl;if(t&&t.clientHeight){const t=this._baseVb();return this._applyView(e,t[0]+t[2]/2,t[1]+t[3]/2),void this.requestUpdate()}this._view=null,requestAnimationFrame(()=>{if(!this._stageEl)return;const t=this._baseVb();this._applyView(e,t[0]+t[2]/2,t[1]+t[3]/2),this.requestUpdate()})}_stagePointerDown(e){this._bootSoftCancel();const t=e.isPrimary&&0===e.button&&"view"===this._mode?yf(e.composedPath()):null;if(this._roomPointer=t?{pointerId:e.pointerId,spaceId:this._space,roomId:t}:null,this._doubleFit.pointerDown(e,this._space,this._doubleFitEnabled),this._cancelCameraTransition(!1,!0),this._vacFit)return;if(this._kiosk&&(this._cyclePausedUntil=Date.now()+6e4,0===this._pointers.size?(this._swipeStart={x:e.clientX,y:e.clientY,id:e.pointerId},e.target.closest?.(".dev, .roomlabel, .oplock")||(clearTimeout(this._kioskHoldTimer),this._kioskHoldTimer=window.setTimeout(()=>{this._roomPointer=null,this._doubleFit.clear(),this._kioskDialog=!0,this._swipeStart=null},3e3))):(this._swipeStart=null,clearTimeout(this._kioskHoldTimer))),this._drag||this._deviceDrag)return;if(this._markup&&e.target.closest?.(".roomlabel, .rlhandle, .rszhandle, .dev, .oplock, .op-hit, button"))return;if("devices"===this._mode&&e.target.closest(".dev"))return;if("decor"===this._mode&&this._decorPointerDown(e))return;this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY});const i=this._viewOr(this._baseVb());if(1===this._pointers.size)this._panStart={sx:e.clientX,sy:e.clientY,vx:i.x,vy:i.y},this._panLock=null,this._suppressClick=!1;else if(2===this._pointers.size){this._clearRoomFocus(!0),"opening"===this._tool?(this._cursorPt=null,this._clearOpeningPlacement(!1)):"draw"===this._tool&&this._clearPlanSnapHover();const e=[...this._pointers.values()],t=Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y);this._pinchStart={dist:t,zoom:this._zoom},this._panStart=null,this._panLock=null}}get _swipeZone(){return!this._hasFixedFloor&&this._kiosk&&this._zoom<=1.001&&this._model.length>1}_stagePointerMove(e){if(this._physicalRotate?.pid!==e.pointerId)if(this._physicalDrag?.pid!==e.pointerId)if(this._dtDrag?.pid!==e.pointerId)if(this._bdDrag?.pid!==e.pointerId){if(this._decorDraft?.pid===e.pointerId){const t=this._decorDraft;let i=this._decorSnap(this._svgPoint(e),e.pointerType);if(e.shiftKey&&("rect"===t.kind||"ellipse"===t.kind)){const e=i[0]-t.a[0],n=i[1]-t.a[1],r=Math.max(Math.abs(e),Math.abs(n));i=this._snap([t.a[0]+(e<0?-r:r),t.a[1]+(n<0?-r:r)])}return void(this._decorDraft={...t,b:i})}if(this._decorMove?.pid!==e.pointerId){if("decor"!==this._mode||"furniture"!==this._decorTool&&"image"!==this._decorTool||!this._editorRuntime||(this._notePointer(e),!this._editorRuntime._furnPointerMove(e,this._pointerModality.hoverEnabled)))if(this._pointers.has(e.pointerId)){if(this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),this._markup&&1===this._pointers.size&&this._markupMove(e),this._pinchStart&&this._pointers.size>=2){this._activateSafeDayCycleOutline(),this._clearRoomFocus(!0),"opening"===this._tool?(this._cursorPt=null,this._clearOpeningPlacement(!1)):"draw"===this._tool&&this._clearPlanSnapHover();const e=[...this._pointers.values()],t=Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)/(this._pinchStart.dist||1),i=this._stageEl.getBoundingClientRect(),n=(e[0].x+e[1].x)/2-i.left,r=(e[0].y+e[1].y)/2-i.top;this._zoomAt(n,r,this._pinchStart.zoom*t),this._viewportGestureDirty=!0,this._suppressClick=!0,this._saveZoom()}else if(this._panStart){const t=e.clientX-this._panStart.sx,i=e.clientY-this._panStart.sy;Math.abs(t)+Math.abs(i)>4&&(this._roomPointer=null,this._doubleFit.clear(),this._suppressClick=!0,clearTimeout(this._holdTimer),"opening"===this._tool?(this._cursorPt=null,this._clearOpeningPlacement(!1)):"draw"===this._tool&&this._clearPlanSnapHover()),null===this._panLock&&Math.abs(t)+Math.abs(i)>8&&(this._panLock=this._swipeZone&&Math.abs(t)>1.5*Math.abs(i)?"swipe":"pan","pan"===this._panLock&&(this._activateSafeDayCycleOutline(),this._clearRoomFocus()));const n=this._stageEl;if("pan"===this._panLock&&n){const e=this._baseVb(),r=this._viewOr(e),o=Oi(e,this._stageAspect());this._view=this._clampView({x:this._panStart.vx-t/(n.clientWidth||1)*r.w,y:this._panStart.vy-i/(n.clientHeight||1)*r.h,w:r.w,h:r.h},o),this._viewportGestureDirty=!0,this._liveVp()}}}else this._markupMove(e)}else this._decorMoveUpdate(e)}else this._bdMove(e);else this._dtMove(e);else this._physicalMove(e);else this._physicalRotateMove(e)}_stagePointerLeave(e){this._editorRuntime?._cancelPointerMove("markup-hover"),"decor"===this._mode&&this._editorRuntime?._furnPointerLeave(e),this._markup&&("opening"===this._tool?(this._cursorPt=null,this._clearOpeningPlacement(!1)):"draw"===this._tool&&this._clearPlanSnapHover())}_stagePointerUp(e){this._deviceHits.release(e.pointerId),this._flushHa(),this._editorRuntime?._cancelPointerMove("markup-hover");const t=(i=this._roomPointer,n=e.pointerId,r=this._space,o=this._roomPointer&&"view"===this._mode?yf(e.composedPath()):null,s=this._suppressClick||!!this._pinchStart||null!==this._panLock||this._holdFired||this._touchSequenceMultitouch,!i||s||i.pointerId!==n||i.spaceId!==r||i.roomId!==o?null:i.roomId);var i,n,r,o,s;this._roomPointer?.pointerId===e.pointerId&&(this._roomPointer=null);if(this._doubleFit.pointerUp(e,this._space,this._doubleFitEnabled,this._suppressClick||!!this._pinchStart||null!==this._panLock||this._holdFired)&&this._fitAll("double-tap"),this._kiosk){clearTimeout(this._kioskHoldTimer);const i=this._swipeStart;if(this._swipeStart=null,!t&&i&&i.id===e.pointerId){const t=e.clientX-i.x,n=e.clientY-i.y,r="pan"===this._panLock?null:function(e,t,i,n,r,o=60){if(i>1.001||n.length<2)return null;if(Math.abs(e)e.id),this._space);r&&this._slideTo(r,t<0?"left":"right")&&(this._saveNav(),this._suppressClick=!0,setTimeout(()=>this._suppressClick=!1,0),this._showKioskDots())}}this._physicalDrag?.pid!==e.pointerId?this._physicalRotate?.pid!==e.pointerId?this._dtDrag?.pid!==e.pointerId?this._bdDrag?.pid!==e.pointerId?this._decorDraft?.pid!==e.pointerId?this._decorMove?.pid!==e.pointerId?this._editorRuntime?._furnPointerUp(e)||(this._pointers.delete(e.pointerId),this._pointers.size<2&&(this._pinchStart=null),0===this._pointers.size&&(this._panStart=null,this._panLock=null,this._suppressClick&&setTimeout(()=>this._suppressClick=!1,0)),this._viewportGestureDirty&&0===this._pointers.size&&!t&&(this._viewportGestureDirty=!1,this.requestUpdate()),t&&this._fitRoom(t)):this._editorRuntimeOrThrow()._dmUp():this._decorCommitDraft():this._bdUp():this._dtUp():this._physicalRotateUp(e):this._physicalUp(e)}_clickRoom(e){!this._suppressClick&&e.area&&bv("/config/areas/area/"+e.area)}_roomLabelKey(e,t){"view"!==this._mode||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),this._fitRoom(t))}_pointerDown(e,t){if("view"!==this._mode&&"devices"!==this._mode)return;if("view"===this._mode&&"touch"===e.pointerType&&this._touchSequenceMultitouch)return;if(t=this._deviceHits.begin(this.renderRoot,this._renderDevices,this._space,e,t),"view"===this._mode){this._holdFired=!1,clearTimeout(this._holdTimer);const i=e.pointerId,n=e.currentTarget;return void(this._holdTimer=window.setTimeout(()=>{this._holdFired=!0,this._interruptViewGesture(i,n),this._infoCard=t},600))}if("ha_disabled"===t.bindingStatus?.kind||this._devicePositionBusy)return;if(this._deviceDrag)return void(this._deviceDrag.pointerId!==e.pointerId&&this._cancelDeviceDrag());e.preventDefault();const i=this._pos(t);this._deviceDrag={id:t.id,spaceId:t.space,displayName:t.name,pointerId:e.pointerId,source:e.currentTarget,sx:e.clientX,sy:e.clientY,ox:i.x,oy:i.y,moved:!1,before:bg(this._layout,t.id),start:this._devicePlacementForCanvas(t,i.x,i.y)},kv(e),this._tip=null,this._syncLiveHover()}_pointerMove(e,t){if("view"!==this._mode&&"devices"!==this._mode)return null;if(t=this._deviceForPointerEvent(e,t),"devices"!==this._mode)return t;const i=this._deviceDrag;return i&&i.id===t.id&&i.pointerId===e.pointerId?(this._editorRuntimeOrThrow()._queuePointerMove("device",()=>this._pointerMoveNow(e,t)),t):t}_pointerMoveNow(e,t){if("devices"!==this._mode)return;const i=this._deviceDrag;if(!i||i.id!==t.id||i.pointerId!==e.pointerId)return;const n=this.renderRoot.querySelector(".stage");if(!n)return;const r=this._baseVb(),o=n.getBoundingClientRect(),s=this._viewOr(r),a=(e.clientX-i.sx)/o.width*s.w,l=(e.clientY-i.sy)/o.height*s.h;Math.abs(e.clientX-i.sx)+Math.abs(e.clientY-i.sy)>3&&(i.moved=!0,clearTimeout(this._holdTimer));const c=ll(i.ox+a),h=ll(i.oy+l);this._previewDevicePlacement(t.id,this._devicePlacementForCanvas(t,c,h))}_pointerUp(e,t){if(t=this._deviceForPointerEvent(e,t),this._deviceHits.release(e.pointerId),clearTimeout(this._holdTimer),"devices"!==this._mode)return;const i=this._deviceDrag;if(!i||i.id!==t.id||i.pointerId!==e.pointerId)return;this._editorRuntimeOrThrow()._flushPointerMove("device"),this._deviceDrag=null;const n=bg(this._layout,t.id);var r,o;i.moved&&null!==n&&(r=n,o=i.start,null===r||null===o?r!==o:r.x!==o.x||r.y!==o.y||r.s!==o.s)?(this._selId=t.id,this._suppressClick=!0,window.setTimeout(()=>{this._suppressClick=!1},0),this._devicePositionBusy=!0,this.requestUpdate(),this._persistDevicePlacement(t.id,n).then(()=>{const e=this._t("history.device_move",{name:i.displayName});this._devicePositionHistory.push({name:e,before:{deviceId:i.id,spaceId:i.spaceId,placement:i.before},after:{deviceId:i.id,spaceId:i.spaceId,placement:n}})}).catch(e=>{this._previewDevicePlacement(t.id,i.before),this._showToast(this._t("toast.pos_save_failed",{err:this._errText(e)}))}).finally(()=>{this._devicePositionBusy=!1,this.requestUpdate()})):this._previewDevicePlacement(t.id,i.before)}_pointerCancel(e,t){t=this._deviceForPointerEvent(e,t),this._deviceHits.cancel(e.pointerId),this._deviceDrag?.id===t.id&&this._deviceDrag.pointerId===e.pointerId&&this._cancelDeviceDrag()}_showToast(e){for(const e of this.renderRoot.querySelectorAll("hp-dialog"))e.closeTransientOverlays("toast");this._toast=e,clearTimeout(this._toastTimer),this._toastTimer=window.setTimeout(()=>{this._toast=""},3500)}_syncPointerHoverTargets(){const e=this._pointerModality.hoverEnabled;for(const t of this.renderRoot.querySelectorAll(gv))t.toggleAttribute("data-pointer-hover",e)}_syncPointerHoverSubtree(e){if(e.nodeType!==Node.ELEMENT_NODE)return;const t=e,i=this._pointerModality.hoverEnabled;t.matches(gv)&&t.toggleAttribute("data-pointer-hover",i);for(const e of t.querySelectorAll(gv))e.toggleAttribute("data-pointer-hover",i)}_clearTransientHover(e=!1){e&&this._pointerModality.suspend(),this._liveRt?.clearDeviceFocus(),this._deviceHits.hover(this.renderRoot,null),this._tip&&(this._tip=null),this._hoverRoom&&(this._hoverRoom=null),this._syncLiveHover()}_notePointer(e){const t=this._pointerModality.modality,i=this._pointerModality.note(e);"touch"!==i&&"pen"!==i||t===i&&!this._tip&&!this._hoverRoom||this._clearTransientHover()}_guardTouchGesture(e){if(this._editorSecondary?.handleOutsideDismiss(e))return;if(this._touchClickGuard.handleActivation(e,this._suppressClick))return;const t=e;if(this._notePointer(t),"pointercancel"===e.type||"lostpointercapture"===e.type?this._doubleFit.clear():"pointerdown"===e.type&&this._doubleFit.clearOutside(t),"pointerdown"===e.type&&this._touchClickGuard.pointerDown(t.pointerId,t.pointerType),"touch"!==t.pointerType)return;if("pointerdown"===e.type){if(this._touchContacts.set(t.pointerId,{x:t.clientX,y:t.clientY,inStage:!!t.target?.closest?.(".stage")}),this._touchContacts.size>=2){this._deviceHits.clearPointers(),this._clearRoomFocus(!0),this._clearTransientHover(),clearTimeout(this._holdTimer),clearTimeout(this._kioskHoldTimer),this._swipeStart=null;const e=[...this._touchContacts.values()];if("view"===this._mode&&!this._vacFit&&e.every(e=>e.inStage)){this._pointers=new Map([...this._touchContacts].map(([e,t])=>[e,{x:t.x,y:t.y}]));const[t,i]=e;this._pinchStart={dist:Math.hypot(t.x-i.x,t.y-i.y),zoom:this._zoom},this._panStart=null,this._panLock=null}else this._vacFit&&(this._pointers.clear(),this._pinchStart=null,this._panStart=null,this._panLock=null)}return}if("pointermove"===e.type){const e=this._touchContacts.get(t.pointerId);if(!e)return;const i={...e,x:t.clientX,y:t.clientY};if(this._touchContacts.set(t.pointerId,i),this._touchSequenceMultitouch&&"view"===this._mode&&!this._vacFit&&this._pinchStart&&[...this._touchContacts.values()].every(e=>e.inStage)){this._activateSafeDayCycleOutline(),this._pointers.set(t.pointerId,{x:t.clientX,y:t.clientY});const e=[...this._touchContacts.values()];if(e.length>=2&&this._stageEl){const[t,i]=e,n=Math.hypot(t.x-i.x,t.y-i.y)/(this._pinchStart.dist||1),r=this._stageEl.getBoundingClientRect();this._zoomAt((t.x+i.x)/2-r.left,(t.y+i.y)/2-r.top,this._pinchStart.zoom*n),this._saveZoom()}}return}if("pointerup"!==e.type&&"pointercancel"!==e.type&&"lostpointercapture"!==e.type)return;const i=this._touchClickGuard.pointerTerminal(t.pointerId,t.pointerType);if(this._clearTransientHover(),this._touchContacts.delete(t.pointerId),i){if(this._pointers.delete(t.pointerId),!this._vacFit&&this._pointers.size>=2){const[e,t]=[...this._pointers.values()];this._pinchStart={dist:Math.hypot(e.x-t.x,e.y-t.y),zoom:this._zoom}}else this._pinchStart=null;0===this._pointers.size&&(this._panStart=null,this._panLock=null)}}_showTip(e,t,i,n,r,o,s=!1){this._notePointer(e),this._pointerModality.hoverEnabled&&(this._drag||this._deviceDrag||s&&this._liveRt?.deviceFocusActive()||(this._tip={x:e.clientX,y:e.clientY,title:t,meta:i,lqi:n,temp:r,hum:o,room:s,source:"pointer"},this._syncLiveHover()))}_roomTipEnabledForPointer(e){return"view"===this._mode&&(this._notePointer(e),!!gn(this._settings)||(this._tip?.room&&(this._tip=null,this._syncLiveHover()),!1))}get _gridPitch(){return rl}get _cellCm(){const e=Number(this._curSpaceCfg?.cell_cm);return Number.isFinite(e)&&e>0?e:5}_fmtLen(e,t){const i=function(e,t,i,n){return Math.hypot(t[0]-e[0],t[1]-e[1])/i*n}(e,t,this._gridPitch,this._cellCm);return ti(i,"mi"===this.hass?.config?.unit_system?.length)}get _curSpaceCfg(){const e=this._resize?.preview;return e&&e.space===this._space?e.sp:this._serverCfg?.spaces.find(e=>e.id===this._space)}get _renderCfg(){const e=this._resize?.preview;return e&&this._serverCfg?{...this._serverCfg,spaces:this._serverCfg.spaces.map(t=>t.id===e.space?e.sp:t)}:this._serverCfg}get _spaceH(){return this._curSpaceCfg,fv}get _segments(){const e=this._curSpaceCfg,t=this._spaceH;return oi(e?.rooms||[]).map(e=>[e[0]*fv,e[1]*t,e[2]*fv,e[3]*t])}_savedNav(){if(this._hasFixedFloor)return null;try{return JSON.parse(localStorage.getItem(_v)||"null")}catch{return null}}_saveNav(){if(!this._hasFixedFloor)try{localStorage.setItem(_v,JSON.stringify({space:this._space}))}catch{}}_leaveCardRoute(){if(this._routeDepartureHandled)return;this._routeDepartureHandled=!0,this._configReloadAuthority.invalidateLifecycle(),this._summary?.leaveRoute(),this._clearRoomFocus(!0),this._cancelDangerConfirm(),"view"!==this._mode&&this._setMode("view",!1),this._pendingNavMode=null,this._geometryHistory.clear(),this._activeWallChainId=null,this._wallChainSegmentCms=[],this._closingWallCm=null,this._drawWallField=null,this._showHidden=!1,this._tapConfirm=null,this._vacCalConfirm=null,this._decorEraseConfirm=null,this._openingInfo=null,this._closeInfoCard(),this._rulesDialog=null,this._alignDialog=null,this._preflightClipboardFallback=null,this._backupImportDialog=null,this._backupExportDialog=null,this._pdfDialog=!1,this._supportDialog?.preview?.token&&this._editorRuntime?._discardSupportPreview(this._supportDialog.preview.token),this._supportDialog=null,this._settingsDialog=null,this._deviceInbox=null,this._deviceInboxReturn=null,this._markerDialog=null,this._openingDialog=null,this._physicalDialog=null,this._wallDialog=null,this._backdropDialog=null,this._decorShapeDialog=null,this._decorTextDialog=null,this._mergeDialog=null,this._roomDialog=!1,this._spaceDialog=null,this._importDialog=null;const e=this._warmSlot;e?.owner===this._warmGen&&(e.vp=this._warmViewportState(),e.dlg=null,e.frameFingerprint="",clearTimeout(e.evict),e.evict=0),this._saveNav()}_setMode(e,t=!0){return e!==this._mode&&(this._clearRoomFocus(!0),this._cancelDangerConfirm(),this._resetDeviceHitState(),this._clearTransientHover(!0)),this._warmModeRequest=0,this._editorRuntime?this._editorRuntime._setMode(e,t):"view"===e?void this._editorModeRequest++:void this._requestMode(e,t)}_primeDrawWallField(){return this._editorRuntimeOrThrow()._primeDrawWallField()}get _drawWallFieldValue(){return null===this._drawWallField?Io(15,this._imperial):this._drawWallField}get _drawWallCm(){const e=(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})(this._drawWallFieldValue);if(null==e||e<0)return null;const t=this._imperial?2.54*e:e,i="column"===this._tool?fa:100;return t>=("column"===this._tool?1:0)&&t<=i?t:null}get _drawWallMaxCm(){return"column"===this._tool?fa:100}_showPhysicalRange(e=this._drawWallMaxCm,t=0){return this._editorRuntimeOrThrow()._showPhysicalRange(e,t)}_mergeSpacePartitions(e,t){return this._editorRuntimeOrThrow()._mergeSpacePartitions(e,t)}_finishWallChain(){return this._editorRuntimeOrThrow()._finishWallChain()}_activateMarkupTool(e){return this._editorRuntimeOrThrow()._activateMarkupTool(e)}_limitReached(e){return this._editorRuntimeOrThrow()._limitReached(e)}_svgPoint(e){return this._editorRuntimeOrThrow()._svgPoint(e)}_snap(e){return this._editorRuntimeOrThrow()._snap(e)}_snapDrawPoint(e,t=!1){return this._editorRuntimeOrThrow()._snapDrawPoint(e,t)}_planSnapOpeningCuts(e,t){return this._editorRuntimeOrThrow()._planSnapOpeningCuts(e,t)}_planSnapGeometrySnapshot(){return this._editorRuntimeOrThrow()._planSnapGeometrySnapshot()}_hiddenWallDiagnosticSnapshot(){return this._editorRuntimeOrThrow()._hiddenWallDiagnosticSnapshot()}_planStructuralGeometrySnapshot(){return this._editorRuntimeOrThrow()._planStructuralGeometrySnapshot()}_planSnapContextKey(e){return this._editorRuntimeOrThrow()._planSnapContextKey(e)}_resolvePlanDrawPoint(e,t){return this._editorRuntimeOrThrow()._resolvePlanDrawPoint(e,t)}get _activePlanSnapCandidate(){if(!this._markup||"draw"!==this._tool)return null;const e=this._planSnapHover;if(!e)return null;const t=this._planSnapGeometrySnapshot();return e.contextKey===this._planSnapContextKey(t.key)?e.candidate:null}get _activePlanSnapConflicts(){if(!this._markup||"draw"!==this._tool)return[];const e=this._planSnapHover;if(!e)return[];const t=this._planSnapGeometrySnapshot();return e.contextKey===this._planSnapContextKey(t.key)?e.conflicts:[]}_clearPlanSnapHover(e=!0){return this._editorRuntime?this._editorRuntimeOrThrow()._clearPlanSnapHover(e):(this._planSnapHover=null,void(e&&(this._cursorPt=null)))}_samePt(e,t){return _i(e,t)}_dropLegacySegments(){return this._editorRuntimeOrThrow()._dropLegacySegments()}_rollbackRejectedPhysicalWrites(e){return this._editorRuntimeOrThrow()._rollbackRejectedPhysicalWrites(e)}async _reloadRejectedPhysicalWrite(){return this._editorRuntimeOrThrow()._reloadRejectedPhysicalWrite()}get _cfgWriting(){return this._writesPending>0}async _sendConfigCandidate(e){const t=$o(e),i=await this.hass.callWS({type:"houseplan/config/set",config:t,expected_rev:this._cfgRev});this._adoption.acceptConfigWrite(t,i)}_writeConfig(){if(this._editorRuntime)return this._editorRuntime._writeConfig();this._writesPending++,this._writeChain=qu(this._writeChain,async()=>{if(!this._serverCfg)return;const e=$o(this._serverCfg);this._adoption.stageConfigCandidate(e),await this._sendConfigCandidate(e)});return this._writeChain.finally(()=>{this._writesPending--})}_saveConfig(){this._cfgEpoch++,this._saveConfigDebounced()}_geometrySnapshotFromConfig(e,t){return this._editorRuntimeOrThrow()._geometrySnapshotFromConfig(e,t)}_geometrySnapshot(e=this._space){return this._editorRuntimeOrThrow()._geometrySnapshot(e)}_recordGeometry(e,t){return this._editorRuntimeOrThrow()._recordGeometry(e,t)}_restoreGeometryStateInConfig(e,t,i=!1){return this._editorRuntimeOrThrow()._restoreGeometryStateInConfig(e,t,i)}_restoreGeometryStateLocal(e){return this._editorRuntimeOrThrow()._restoreGeometryStateLocal(e)}_wallModelBlockerLabel(e){return this._editorRuntimeOrThrow()._wallModelBlockerLabel(e)}_hasLegacyZeroWallFields(e=this._serverCfg){return this._editorRuntimeOrThrow()._hasLegacyZeroWallFields(e)}_showWallModelMigrationBlocked(e){return this._editorRuntimeOrThrow()._showWallModelMigrationBlocked(e)}_limitSegmentsOf(e){return this._editorRuntimeOrThrow()._limitSegmentsOf(e)}_junctionLimitViolations(e,t,i,n){return this._editorRuntimeOrThrow()._junctionLimitViolations(e,t,i,n)}_junctionLimitLabel(e){return this._editorRuntimeOrThrow()._junctionLimitLabel(e)}_junctionLimitsIntroduced(e,t,i){return this._editorRuntimeOrThrow()._junctionLimitsIntroduced(e,t,i)}_commitPhysicalGeometry(e,t,i=[]){return this._editorRuntimeOrThrow()._commitPhysicalGeometry(e,t,i)}_clearGeometryGesture(){return this._editorRuntime?this._editorRuntimeOrThrow()._clearGeometryGesture():(this._path=[],this._planSnapHover=null,this._cursorPt=null,this._openingHoverCandidate=null,this._openingJambBlockCm=null,this._openingPreset=null,this._openingRebindId=null,this._mergeSel=null,this._mergeDialog=null,this._splitSel=null,this._pendingSplit=null,this._wallFaceBatch=null,this._wallRepairDiagnostic=null,this._roomDeleteDialog=null,this._wallDialog=null,this._physicalDialog=null,this._physicalSel=null,this._physicalDrag=null,this._physicalRotate=null,this._activeWallChainId=null,this._wallChainSegmentCms=[],this._closingWallCm=null,this._openingDialog=null,this._resize?.reset(),this._decorDraft=null,this._decorMove=null,this._dtDrag=null,void(this._bdDrag=null))}_stagePointerCancel(e){if(this._deviceHits.cancel(e.pointerId),this._flushHa(),this._editorRuntime?._cancelPointerMove("markup-hover"),this._roomPointer?.pointerId===e.pointerId&&(this._roomPointer=null),this._doubleFit.clear(),this._editorRuntime)return this._editorRuntime._stagePointerCancel(e);this._pointers.delete(e.pointerId),this._pointers.size<2&&(this._pinchStart=null),0===this._pointers.size&&(this._panStart=null,this._panLock=null,this._swipeStart=null),this._viewportGestureDirty&&0===this._pointers.size&&(this._viewportGestureDirty=!1,this.requestUpdate())}_applyGeometryState(e,t=!1){return this._editorRuntimeOrThrow()._applyGeometryState(e,t)}_roomAt(e){return this._editorRuntimeOrThrow()._roomAt(e)}_overlapRoom(e){return this._editorRuntimeOrThrow()._overlapRoom(e)}_pointInRoom(e,t){return t.poly?mi(e,t.poly):null!=t.x&&e[0]>=t.x&&e[0]<=t.x+t.w&&e[1]>=t.y&&e[1]<=t.y+t.h}_contourSelfIntersects(e){return this._editorRuntimeOrThrow()._contourSelfIntersects(e)}_canAppendWallPoint(){return this._editorRuntimeOrThrow()._canAppendWallPoint()}_markupClick(e){if(this._editorRuntime)return this._editorRuntime._markupClick(e)}_activeWallSourceKey(e){return this._editorRuntimeOrThrow()._activeWallSourceKey(e)}_wallGraphSources(e){return this._editorRuntimeOrThrow()._wallGraphSources(e)}_wallFaceGraph(e,t){return this._editorRuntimeOrThrow()._wallFaceGraph(e,t)}_offerWallFaces(e,t=this._path.length-2,i){return this._editorRuntimeOrThrow()._offerWallFaces(e,t,i)}_beginWallFaceBatch(e){return this._editorRuntimeOrThrow()._beginWallFaceBatch(e)}_offerExistingWallFace(e){return this._editorRuntimeOrThrow()._offerExistingWallFace(e)}_columnClick(e){return this._editorRuntimeOrThrow()._columnClick(e)}_openPhysicalDialog(e,t){return this._editorRuntimeOrThrow()._openPhysicalDialog(e,t)}_physicalDown(e,t,i){return this._editorRuntimeOrThrow()._physicalDown(e,t,i)}_clampPhysicalDelta(e,t,i){return this._editorRuntimeOrThrow()._clampPhysicalDelta(e,t,i)}_physicalMove(e){return this._editorRuntimeOrThrow()._physicalMove(e)}_physicalUp(e){return this._editorRuntimeOrThrow()._physicalUp(e)}_registerPhysicalTap(e,t){return this._editorRuntimeOrThrow()._registerPhysicalTap(e,t)}_cancelPhysicalGesture(){return this._editorRuntimeOrThrow()._cancelPhysicalGesture()}_physicalRotateDown(e,t){return this._editorRuntimeOrThrow()._physicalRotateDown(e,t)}_physicalRotateMove(e){return this._editorRuntimeOrThrow()._physicalRotateMove(e)}_physicalRotateUp(e){return this._editorRuntimeOrThrow()._physicalRotateUp(e)}_rszRooms(){return this._editorRuntimeOrThrow()._rszRooms()}_rszOpenings(){return this._editorRuntimeOrThrow()._rszOpenings()}_rszObstacles(){return this._editorRuntimeOrThrow()._rszObstacles()}_rszOptsFor(e,t){return this._editorRuntimeOrThrow()._rszOptsFor(e,t)}_rszResolution(e,t,i){return this._editorRuntimeOrThrow()._rszResolution(e,t,i)}_rszSnapshot(){return this._editorRuntimeOrThrow()._rszSnapshot()}_rszResetController(){return this._editorRuntimeOrThrow()._rszResetController()}_rszProjectPreview(e,t,i,n,r){return this._editorRuntimeOrThrow()._rszProjectPreview(e,t,i,n,r)}_rszAcceptPreview(e,t){return this._editorRuntimeOrThrow()._rszAcceptPreview(e,t)}_rszSpaceCandidateGeometry(e,t){return this._editorRuntimeOrThrow()._rszSpaceCandidateGeometry(e,t)}_rszSpaceCandidateRenderable(e,t){return this._editorRuntimeOrThrow()._rszSpaceCandidateRenderable(e,t)}_rszCandidateRenderable(e){return this._editorRuntimeOrThrow()._rszCandidateRenderable(e)}_rszEdgeDown(e,t,i){return this._editorRuntimeOrThrow()._rszEdgeDown(e,t,i)}_rszReasonText(e){return this._editorRuntimeOrThrow()._rszReasonText(e)}_rszDisabledActivate(e,t){return this._editorRuntimeOrThrow()._rszDisabledActivate(e,t)}_rszDisabledKey(e,t){return this._editorRuntimeOrThrow()._rszDisabledKey(e,t)}_rszMove(e){return this._editorRuntimeOrThrow()._rszMove(e)}_rszUp(e){return this._editorRuntimeOrThrow()._rszUp(e)}_rszCancelDrag(e){return this._editorRuntimeOrThrow()._rszCancelDrag(e)}_rszPointerCancel(e){return this._editorRuntimeOrThrow()._rszPointerCancel(e)}_rszEdgeLabels(e,t,i=this._resize?.rooms){return this._editorRuntimeOrThrow()._rszEdgeLabels(e,t,i)}_rszInnerSpanCms(e,t,i){return this._editorRuntimeOrThrow()._rszInnerSpanCms(e,t,i)}_renderResizeMeasurements(){return this._editorRuntimeOrThrow()._renderResizeMeasurements()}_renderResizeLayer(e,t){return this._editorRuntimeOrThrow()._renderResizeLayer(e,t)}get _openingsR(){const e=this._curSpaceCfg,t=this._spaceH,i=this._spaceModel();return i?(e?.openings||[]).flatMap(e=>{const n={...e,rx:e.x*fv,ry:e.y*t,rlen:e.length*fv};if(!e.host||"wall"===e.host.kind)return[n];const r=tp(e,i.partitions,fv,this._cellCm,this._gridPitch);if(!r.resolved)return"plan"===this._mode?[{...n,orphanReason:r.reason||"invalid-host"}]:[];let[o,s]=r.resolved.center;const a=this._physicalDrag;return a?.moved&&"partition"===a.kind&&a.id===e.host.id&&(o+=a.delta[0],s+=a.delta[1]),[{...e,rx:o,ry:s,rlen:r.resolved.length,angle:r.resolved.angle,partitionHost:r.resolved}]}):[]}_partitionOpeningCuts(e=this._spaceModel(),t=()=>!0){if(!e)return[];return Y_(K_(this._curSpaceCfg?.id===e.id?this._curSpaceCfg:null,e,this._cellCm,this._gridPitch,fv),t)}_roomWallOpeningInputs(e=this._openingsR,t=this._spaceModel()){if(!t)return[];const i=this._openCuts();return X_(e,t,this._spaceWalls,i,this._wallKeyPitch,this._cellCm,this._gridPitch,fv)}_openingFace(e,t,i){return e.partitionHost?op(e.partitionHost,i):pa(t,{x:e.rx,y:e.ry,angle:e.angle,length:e.rlen,flip_v:i})}_cmToUnits(e){return e/this._cellCm*this._gridPitch}get _decorList(){const e=this._curSpaceCfg;return Array.isArray(e?.decor)?e.decor:[]}get _decorH(){return fv}_decorResolvedStyle(e){return function(e,t,i,n=Cr){const r="rect"===e?.kind||"ellipse"===e?.kind,o=e,s=Kt(o?.color,n.color);return{color:s,opacity:Tr(o?.opacity,n.opacity),widthCm:Ir(e,t,i,n.widthCm),fill:!!r&&!0===o?.fill,fillColor:Kt(o?.fill_color,o?.fill?s:n.fillColor),fillOpacity:r&&o?.fill?Tr(o?.fill_opacity,.25):n.fillOpacity}}(e,this._cellCm,this._gridPitch,Cr)}_decorWidthUnits(e){return((e,t,i,n=Cr.widthCm)=>{const r=Number(e?.width_cm);if(Number.isFinite(r)&&r>0)return Fr(r,t,i);const o=Number(e?.width);return Number.isFinite(o)&&o>0?o:Fr(n,t,i)})(e,this._cellCm,this._gridPitch,Cr.widthCm)}_decorTextSizeCm(e){if("text"===e?.kind){const t=Number(e.size_cm);return Number.isFinite(t)&&t>0?t:zr(20*rn(e),this._cellCm,this._gridPitch)}return zr(20,this._cellCm,this._gridPitch)}_decorTextUnits(e){if("text"!==e.kind)return 20;const t=Number(e.size_cm);return Number.isFinite(t)&&t>0?Fr(t,this._cellCm,this._gridPitch):20*rn(e)}_decorSmallField(e){return Math.round(100*(this._imperial?e/2.54:e))/100}_decorSmallCm(e){const t=this._imperial?2.54*e:e;return Number.isFinite(t)?Math.max(.1,Math.min(100,t)):.1}_decorTextCm(e){const t=this._imperial?2.54*e:e;return Number.isFinite(t)?Math.max(.1,Math.min(2e3,t)):.1}_decorLargeField(e){return Math.round(100*(this._imperial?e/30.48:e/100))/100}_decorLargeCm(e){const t=this._imperial?30.48*e:100*e;return Number.isFinite(t)?Math.max(.1,Math.min(tl*this._cellCm,t)):.1}_angleField(e){const t=Number(e);return Number.isFinite(t)?String(Number(t.toFixed(3))):"0"}_decorBoxOf(e){return"rect"!==e.kind&&"ellipse"!==e.kind&&"furniture"!==e.kind&&"image"!==e.kind?null:{x:e.x*fv,y:e.y*this._decorH,w:e.w*fv,h:e.h*this._decorH,angle:Dr(e.angle)||void 0}}_decorSnapGeometry(e){return this._editorRuntimeOrThrow()._decorSnapGeometry(e)}_decorSnap(e,t="mouse",i){return this._editorRuntimeOrThrow()._decorSnap(e,t,i)}_replaceDecor(e,t){return this._editorRuntimeOrThrow()._replaceDecor(e,t)}_cancelDecorGesture(){return this._editorRuntimeOrThrow()._cancelDecorGesture()}_decorPointerDown(e){return this._editorRuntimeOrThrow()._decorPointerDown(e)}_decorCommitDraft(){return this._editorRuntimeOrThrow()._decorCommitDraft()}_decorShapeDown(e,t){if(this._editorRuntime)return this._editorRuntime._decorShapeDown(e,t)}_decorMoveUpdate(e){this._editorRuntimeOrThrow()._queuePointerMove("decor-move",()=>this._editorRuntimeOrThrow()._decorMoveUpdate(e))}_decorNudge(e,t){if("decor"!==this._mode||"select"!==this._decorTool||!this._decorSel||this._decorDraft||this._decorMove||this._dtDrag||this._bdDrag)return!1;const i=this._decorList.find(e=>e.id===this._decorSel),n=this._curSpaceCfg;if(!i||!n)return!1;const r=function(e,t,i,n,r,o){if(!([t,i,n,r,o].every(Number.isFinite)&&r>0))return null;let s;if(s="line"===e.kind?[[e.x1,e.y1],[e.x2,e.y2]]:"text"===e.kind?[[e.x,e.y]]:Nr(e),!s.length||s.some(e=>!e.slice(0,2).every(Number.isFinite)))return null;const a=s.map(e=>e[0]),l=s.map(e=>e[1]),c=Math.min(...a),h=Math.max(...a),d=Math.min(...l),u=Math.max(...l),p=t/n,_=i/r,m=p>0?Math.min(p,Math.max(0,o-h)):Math.max(p,Math.min(0,-o-c)),g=_>0?Math.min(_,Math.max(0,o-u)):Math.max(_,Math.min(0,-o-d));return m||g?"line"===e.kind?{...e,x1:e.x1+m,y1:e.y1+g,x2:e.x2+m,y2:e.y2+g}:{...e,x:e.x+m,y:e.y+g}:null}(i,e,t,fv,this._decorH,tl);if(!r)return!1;const o=this._geometrySnapshot();return n.decor=this._decorList.map(e=>e.id===i.id?r:e),this._recordGeometry(this._t("history.decor_move"),o),this._saveConfig(),this.requestUpdate(),!0}_decorShapeDbl(e,t){if(this._editorRuntime)return this._editorRuntime._decorShapeDbl(e,t)}_openDecorProperties(e){return this._editorRuntimeOrThrow()._openDecorProperties(e)}_decorOpenText(e){return this._editorRuntimeOrThrow()._decorOpenText(e)}_decorRememberTextSelection(e){return this._editorRuntimeOrThrow()._decorRememberTextSelection(e)}_decorInsertLiveVariable(e){return this._editorRuntimeOrThrow()._decorInsertLiveVariable(e)}_decorSaveText(){return this._editorRuntimeOrThrow()._decorSaveText()}_decorSaveShape(){return this._editorRuntimeOrThrow()._decorSaveShape()}get _dtSel(){return"decor"===this._mode&&"select"===this._decorTool&&this._decorSel&&this._decorList.find(e=>e.id===this._decorSel)||null}_dtPivot(e){return this._editorRuntimeOrThrow()._dtPivot(e)}_dtApply(e,t){return this._editorRuntimeOrThrow()._dtApply(e,t)}_dtStart(e,t,i,n){return this._editorRuntimeOrThrow()._dtStart(e,t,i,n)}_dtMove(e){this._editorRuntimeOrThrow()._queuePointerMove("decor-transform",()=>this._editorRuntimeOrThrow()._dtMove(e))}_dtUp(){return this._editorRuntimeOrThrow()._flushPointerMove("decor-transform"),this._editorRuntimeOrThrow()._dtUp()}_dtMeasure(){return this._editorRuntimeOrThrow()._dtMeasure()}_deleteDecor(e){return this._editorRuntimeOrThrow()._deleteDecor(e)}_decorDeleteSel(){return this._editorRuntimeOrThrow()._decorDeleteSel()}_confirmDecorErase(){return this._editorRuntimeOrThrow()._confirmDecorErase()}get _bdBase(){const e=this._curSpaceCfg;return e?.plan_url?{...Ya(e.plan_aspect,fv)}:null}get _bdRect(){const e=this._curSpaceCfg;return e?.plan_url?Ja(e,fv):null}get _bdParams(){const e=this._curSpaceCfg,t=Number(e?.plan_x),i=Number(e?.plan_y),n=Number(e?.plan_scale),r=Number(e?.plan_scale_x),o=Number(e?.plan_scale_y),s=Number.isFinite(n)&&n>0?n:1;return{dx:Number.isFinite(t)?t:0,dy:Number.isFinite(i)?i:0,sx:Number.isFinite(r)&&r>0?r:s,sy:Number.isFinite(o)&&o>0?o:s,angle:Dr(e?.plan_angle)}}_openBackdropDialog(e){if(this._editorRuntime)return this._editorRuntime._openBackdropDialog(e)}_saveBackdropDialog(){return this._editorRuntimeOrThrow()._saveBackdropDialog()}get _bdActive(){return"decor"===this._mode&&!!this._bdRect&&"backdrop"===this._decorTool}get _bdMovable(){return"decor"===this._mode&&"backdrop"===this._decorTool&&!!this._bdRect}_bdApply(e,t,i,n,r){return this._editorRuntimeOrThrow()._bdApply(e,t,i,n,r)}_bdStart(e,t,i=!1){return this._editorRuntimeOrThrow()._bdStart(e,t,i)}_bdMove(e){return this._editorRuntimeOrThrow()._bdMove(e)}get _bdMoved(){if("decor"!==this._mode||!this._bdRect)return!1;const e=this._bdParams;return 0!==e.dx||0!==e.dy||1!==e.sx||1!==e.sy||0!==e.angle}_bdReset(){return this._editorRuntimeOrThrow()._bdReset()}_bdUp(){return this._editorRuntimeOrThrow()._bdUp()}get _bdLive(){if(!this._bdDrag)return null;const e=this._bdRect;return e?{x:e.x+e.w/2,y:e.y+e.h/2,text:`${this._fmtLen([0,0],[e.w,0])} × ${this._fmtLen([0,0],[0,e.h])}`}:null}_renderBackdropFrame(e){return this._editorRuntime?this._editorRuntimeOrThrow()._renderBackdropFrame(e):G}_renderTextFrame(e){const t=this._dtSel;if(!t)return G;if("text"===t.kind&&this._dtBox?.id!==t.id)return G;const i="text"===t.kind?this._dtBox:this._decorBoxOf(t);if("line"!==t.kind&&!i)return G;const n=.018*Math.max(e.w,e.h),r=n/4;if("line"===t.kind){const e=[t.x1*fv,t.y1*this._decorH],i=[t.x2*fv,t.y2*this._decorH];return W` + `}_stageAspect(e=this._baseVb()){const t=this._stageEl;return t&&t.clientHeight?t.clientWidth/t.clientHeight:e[2]/e[3]}_viewOr(e){return this._view&&this._view.w?this._view:Oi(e,this._stageAspect(e))}_roomLabelReferenceViewWidth(e){if(!this._markup)return e.w;const t=this._viewModeSnap;if(t?.space===this._space&&t.w)return t.w*t.zoom/this._zoom;const i=this._stageEl,n=this.renderRoot.querySelector(".editorchrome");if(!i?.clientWidth||!i.clientHeight)return e.w;const r=i.clientHeight+(n?.offsetHeight||0);return this._viewForModeTarget(this._zoom,void 0,void 0,i.clientWidth,r).w}_screenToVb(e,t){const i=this._stageEl,n=this._viewOr(this._baseVb()),r=i?.clientWidth||1,o=i?.clientHeight||1;return[n.x+e/r*n.w,n.y+t/o*n.h]}_clampView(e,t){const i=(e,t,i,n)=>{const r=1*Math.max(t,n),o=i-r,s=i+n-t+r;return Math.max(Math.min(o,s),Math.min(Math.max(o,s),e))};return{w:e.w,h:e.h,x:i(e.x,e.w,t.x,t.w),y:i(e.y,e.h,t.y,t.h)}}_applyView(e,t,i){this._cancelCameraTransition(!1);const n=this._baseVb(),r=Oi(n,this._stageAspect()),o=Math.min(wv.ZOOM_MAX,Math.max(wv.ZOOM_MIN,e)),s=r.w/o,a=r.h/o,l=this._viewOr(n),c=t??l.x+l.w/2,h=i??l.y+l.h/2,d=this._clampView({x:c-s/2,y:h-a/2,w:s,h:a},r);return!(this._view&&Math.abs(this._zoom-o)<1e-9&&Math.abs(this._view.x-d.x)<1e-6&&Math.abs(this._view.y-d.y)<1e-6&&Math.abs(this._view.w-d.w)<1e-6&&Math.abs(this._view.h-d.h)<1e-6)&&("opening"===this._tool&&(this._cursorPt=null,this._clearOpeningPlacement(!1)),this._zoom=o,this._view=d,this._liveVp(),!0)}_bootWatch(){clearTimeout(this._bootTimer),this._bootStart=Date.now(),this._bootLastH=-1,this._bootLastChange=this._bootStart;const e=()=>{if(!this._booting)return;const t=Date.now(),i=this._stageEl?this._stageEl.clientHeight:0;i!==this._bootLastH&&(this._bootLastH=i,this._bootLastChange=t);const n=t-this._bootStart;var r,o,s;n>=1200||n>=700&&i>0&&t-this._bootLastChange>=250&&(r=Ol,o=this._serverCfg,s=Bl,"pending"!==r.state()||!Fl(o,s))?this._bootSettled():this._bootTimer=window.setTimeout(e,100)};this._bootTimer=window.setTimeout(e,100)}_bootSettled(){this._booting&&!this._bootSettling&&(this._bootSettling=!0,this._refitView(),this._bootSettleRaf=requestAnimationFrame(()=>{this._bootSettleRaf=0,this._finishBootSettled()}))}_finishBootSettled(){if(!this._booting)return;this._refitView(),this._booting=!1,this._bootSettling=!1;const e=this._stageEl?.clientHeight??0;!this._config?.kiosk&&e>0&&this._warmPatch({hdrH:this._hdrH,stageH:e,vp:this._warmViewportState()},!0),this._bootFading=!0,this._bootTimer=window.setTimeout(()=>{this._bootFading=!1},220),this._bootSoft=!0,clearTimeout(this._bootSoftTimer),this._bootSoftTimer=window.setTimeout(()=>{this._bootSoft=!1},rv)}_bootSoftCancel(){if(!this._bootSoft)return;clearTimeout(this._bootSoftTimer),this._bootSoft=!1;const e=function(e,t,i,n){if(!t)return null;const r=ef(e,t,i);return i||n||null===r||(t.style.height=`calc(100dvh - ${r}px)`),t.classList.remove("hpsettle"),t.getBoundingClientRect(),t.clientWidth<=0||t.clientHeight<=0?null:{headerHeight:r,size:[t.clientWidth,t.clientHeight]}}(this.renderRoot,this._stageEl,this.panelHost,this._kiosk);if(!e)return;null!==e.headerHeight&&(this._hdrH=e.headerHeight),this._refitRaf&&(cancelAnimationFrame(this._refitRaf),this._refitRaf=0),this._pendingRefitSize=null,this._lastValidStageSize=e.size;const t=this._view;t&&this._applyView(this._zoom,t.x+t.w/2,t.y+t.h/2)}_beginResumeSettle(){this._booting||this._resumeSettling||(this._modeTransitionPreparing?this._modeTransitionForceAtomic=!0:this._cancelModeTransition(!0),this._viewportInvalidAt=0,this._beginContinuityCandidate("warm-resume",!1),this._loading?this.requestUpdate():this._loadFromServer())}_refitView(){if(this._modeTransitionBusy||this._warmModeRequest)return;const e=this._stageEl;if(!e||"visible"!==document.visibilityState||e.clientWidth<=0||e.clientHeight<=0)return this._cancelCameraTransition(!1),void(this._viewportInvalidAt||(this._viewportInvalidAt=Date.now()));const t=[e.clientWidth,e.clientHeight];if(this._bootSoft&&this._warmVp)return this._lastValidStageSize=t,void(this._pendingRefitSize=null);const i=this._lastValidStageSize,n=!!i&&Math.abs(i[0]-t[0])<=.5&&Math.abs(i[1]-t[1])<=.5,r=this._viewportInvalidAt?Date.now()-this._viewportInvalidAt:0;if(this._viewportInvalidAt=0,n)this._pendingRefitSize=null;else{if(this._cancelCameraTransition(!1),!i)return this._lastValidStageSize=t,void(this._roomFocus?.spaceId===this._space?this._fitRoom(this._roomFocus.roomId,!1):this._view||this._applyView(this._zoom));this._pendingRefitSize=t,this._refitRaf||(this._refitRaf=requestAnimationFrame(()=>{this._refitRaf=0;const e=this._pendingRefitSize;this._pendingRefitSize=null;const t=this._stageEl;if(!e||!t||t.clientWidth<=0||t.clientHeight<=0)return;if(Math.abs(t.clientWidth-e[0])>.5||Math.abs(t.clientHeight-e[1])>.5)return void this._refitView();const i=this._lastValidStageSize;if(i&&Math.abs(i[0]-e[0])<=.5&&Math.abs(i[1]-e[1])<=.5)return;this._lastValidStageSize=e;const n=this._view;r>=nc?this._beginContinuityCandidate("stage-size-restored",!0,"stage-size"):this._continuity.hasCompleteFrame&&this._beginContinuityCandidate("stage-resize",!0,"stage-size"),this._roomFocus?.spaceId!==this._space?this._applyView(this._zoom,n?n.x+n.w/2:void 0,n?n.y+n.h/2:void 0):this._fitRoom(this._roomFocus.roomId,!1)}))}}_cameraTargetAt(e,t,i,n=!1){const r=this._stageEl;if(!r||r.clientWidth<=0||r.clientHeight<=0)return null;const o=Oi(this._baseVb(),this._stageAspect()),s=Math.min(wv.ZOOM_MAX,Math.max(wv.ZOOM_MIN,i)),a=function(e,t,i,n,r,o,s){if(!Kg(e)||!Kg({zoom:t,viewBox:i})||!Vg(n)||n<=0||!Vg(r)||r<=0||!Vg(o)||!Vg(s))return null;const a=o/n,l=s/r,c=e.viewBox.x+a*e.viewBox.w,h=e.viewBox.y+l*e.viewBox.h,d=i.w/t,u=i.h/t;return{zoom:t,viewBox:{x:c-a*d,y:h-l*u,w:d,h:u}}}(n&&this._cameraTransition.target||this._cameraState(),s,o,r.clientWidth,r.clientHeight,e,t);return a?(a.viewBox=this._clampView(a.viewBox,o),{target:a,fit:o}):null}_zoomAt(e,t,i){this._clearRoomFocus(),this._cancelCameraTransition(!1);const n=this._cameraTargetAt(e,t,i);n&&("opening"===this._tool&&(this._cursorPt=null,this._clearOpeningPlacement(!1)),this._zoom=n.target.zoom,this._view={...n.target.viewBox},this._liveVp())}_onWheel(e){this._clearRoomFocus(),this._prepareCameraCommand();const t=this._stageEl;if(!t)return;e.preventDefault();const i=t.getBoundingClientRect(),n=e.deltaY<0?1.15:1/1.15,r=this._cameraTransition.target?.zoom??this._zoom,o=this._cameraTargetAt(e.clientX-i.left,e.clientY-i.top,r*n,!0);o&&this._startCameraTransition(o.target,o.fit,"wheel",160)}_stepZoom(e){this._clearRoomFocus(),this._prepareCameraCommand();const t=this._stageEl;if(!t)return;const i=this._cameraTransition.target?.zoom??this._zoom,n=this._cameraTargetAt(t.clientWidth/2,t.clientHeight/2,i*(e>0?1.4:1/1.4),!0);n&&this._startCameraTransition(n.target,n.fit,"button",180)}_resetZoom(e="fit"){this._clearRoomFocus(),this._prepareCameraCommand();const t=Oi(this._baseVb(),this._stageAspect());this._startCameraTransition({zoom:1,viewBox:{...t}},t,e,220)}_saveZoom(){if("view"===this._mode){this._zoomBySpace={...this._zoomBySpace,[this._space]:this._zoom};try{localStorage.setItem(hv,JSON.stringify(this._zoomBySpace))}catch{}}}_restoreZoom(){this._clearRoomFocus(!0),this._cancelCameraTransition(!1);const e=this._zoomBySpace[this._space]||1;this._zoom=e;const t=this._stageEl;if(t&&t.clientHeight){const t=this._baseVb();return this._applyView(e,t[0]+t[2]/2,t[1]+t[3]/2),void this.requestUpdate()}this._view=null,requestAnimationFrame(()=>{if(!this._stageEl)return;const t=this._baseVb();this._applyView(e,t[0]+t[2]/2,t[1]+t[3]/2),this.requestUpdate()})}_stagePointerDown(e){this._bootSoftCancel();const t=e.isPrimary&&0===e.button&&"view"===this._mode?gf(e.composedPath()):null;if(this._roomPointer=t?{pointerId:e.pointerId,spaceId:this._space,roomId:t}:null,this._doubleFit.pointerDown(e,this._space,this._doubleFitEnabled),this._cancelCameraTransition(!1,!0),this._vacFit)return;if(this._kiosk&&(this._cyclePausedUntil=Date.now()+6e4,0===this._pointers.size?(this._swipeStart={x:e.clientX,y:e.clientY,id:e.pointerId},e.target.closest?.(".dev, .roomlabel, .oplock")||(clearTimeout(this._kioskHoldTimer),this._kioskHoldTimer=window.setTimeout(()=>{this._roomPointer=null,this._doubleFit.clear(),this._kioskDialog=!0,this._swipeStart=null},3e3))):(this._swipeStart=null,clearTimeout(this._kioskHoldTimer))),this._drag||this._deviceDrag)return;if(this._markup&&e.target.closest?.(".roomlabel, .rlhandle, .rszhandle, .dev, .oplock, .op-hit, button"))return;if("devices"===this._mode&&e.target.closest(".dev"))return;if("decor"===this._mode&&this._decorPointerDown(e))return;this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY});const i=this._viewOr(this._baseVb());if(1===this._pointers.size)this._panStart={sx:e.clientX,sy:e.clientY,vx:i.x,vy:i.y},this._panLock=null,this._suppressClick=!1;else if(2===this._pointers.size){this._clearRoomFocus(!0),"opening"===this._tool?(this._cursorPt=null,this._clearOpeningPlacement(!1)):"draw"===this._tool&&this._clearPlanSnapHover();const e=[...this._pointers.values()],t=Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y);this._pinchStart={dist:t,zoom:this._zoom},this._panStart=null,this._panLock=null}}get _swipeZone(){return!this._hasFixedFloor&&this._kiosk&&this._zoom<=1.001&&this._model.length>1}_stagePointerMove(e){if(this._physicalRotate?.pid!==e.pointerId)if(this._physicalDrag?.pid!==e.pointerId)if(this._dtDrag?.pid!==e.pointerId)if(this._bdDrag?.pid!==e.pointerId){if(this._decorDraft?.pid===e.pointerId){const t=this._decorDraft;let i=this._decorSnap(this._svgPoint(e),e.pointerType);if(e.shiftKey&&("rect"===t.kind||"ellipse"===t.kind)){const e=i[0]-t.a[0],n=i[1]-t.a[1],r=Math.max(Math.abs(e),Math.abs(n));i=this._snap([t.a[0]+(e<0?-r:r),t.a[1]+(n<0?-r:r)])}return void(this._decorDraft={...t,b:i})}if(this._decorMove?.pid!==e.pointerId){if("decor"!==this._mode||"furniture"!==this._decorTool&&"image"!==this._decorTool||!this._editorRuntime||(this._notePointer(e),!this._editorRuntime._furnPointerMove(e,this._pointerModality.hoverEnabled)))if(this._pointers.has(e.pointerId)){if(this._pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),this._markup&&1===this._pointers.size&&this._markupMove(e),this._pinchStart&&this._pointers.size>=2){this._activateSafeDayCycleOutline(),this._clearRoomFocus(!0),"opening"===this._tool?(this._cursorPt=null,this._clearOpeningPlacement(!1)):"draw"===this._tool&&this._clearPlanSnapHover();const e=[...this._pointers.values()],t=Math.hypot(e[0].x-e[1].x,e[0].y-e[1].y)/(this._pinchStart.dist||1),i=this._stageEl.getBoundingClientRect(),n=(e[0].x+e[1].x)/2-i.left,r=(e[0].y+e[1].y)/2-i.top;this._zoomAt(n,r,this._pinchStart.zoom*t),this._viewportGestureDirty=!0,this._suppressClick=!0,this._saveZoom()}else if(this._panStart){const t=e.clientX-this._panStart.sx,i=e.clientY-this._panStart.sy;Math.abs(t)+Math.abs(i)>4&&(this._roomPointer=null,this._doubleFit.clear(),this._suppressClick=!0,clearTimeout(this._holdTimer),"opening"===this._tool?(this._cursorPt=null,this._clearOpeningPlacement(!1)):"draw"===this._tool&&this._clearPlanSnapHover()),null===this._panLock&&Math.abs(t)+Math.abs(i)>8&&(this._panLock=this._swipeZone&&Math.abs(t)>1.5*Math.abs(i)?"swipe":"pan","pan"===this._panLock&&(this._activateSafeDayCycleOutline(),this._clearRoomFocus()));const n=this._stageEl;if("pan"===this._panLock&&n){const e=this._baseVb(),r=this._viewOr(e),o=Oi(e,this._stageAspect());this._view=this._clampView({x:this._panStart.vx-t/(n.clientWidth||1)*r.w,y:this._panStart.vy-i/(n.clientHeight||1)*r.h,w:r.w,h:r.h},o),this._viewportGestureDirty=!0,this._liveVp()}}}else this._markupMove(e)}else this._decorMoveUpdate(e)}else this._bdMove(e);else this._dtMove(e);else this._physicalMove(e);else this._physicalRotateMove(e)}_stagePointerLeave(e){this._editorRuntime?._cancelPointerMove("markup-hover"),"decor"===this._mode&&this._editorRuntime?._furnPointerLeave(e),this._markup&&("opening"===this._tool?(this._cursorPt=null,this._clearOpeningPlacement(!1)):"draw"===this._tool&&this._clearPlanSnapHover())}_stagePointerUp(e){this._deviceHits.release(e.pointerId),this._flushHa(),this._editorRuntime?._cancelPointerMove("markup-hover");const t=(i=this._roomPointer,n=e.pointerId,r=this._space,o=this._roomPointer&&"view"===this._mode?gf(e.composedPath()):null,s=this._suppressClick||!!this._pinchStart||null!==this._panLock||this._holdFired||this._touchSequenceMultitouch,!i||s||i.pointerId!==n||i.spaceId!==r||i.roomId!==o?null:i.roomId);var i,n,r,o,s;this._roomPointer?.pointerId===e.pointerId&&(this._roomPointer=null);if(this._doubleFit.pointerUp(e,this._space,this._doubleFitEnabled,this._suppressClick||!!this._pinchStart||null!==this._panLock||this._holdFired)&&this._fitAll("double-tap"),this._kiosk){clearTimeout(this._kioskHoldTimer);const i=this._swipeStart;if(this._swipeStart=null,!t&&i&&i.id===e.pointerId){const t=e.clientX-i.x,n=e.clientY-i.y,r="pan"===this._panLock?null:function(e,t,i,n,r,o=60){if(i>1.001||n.length<2)return null;if(Math.abs(e)e.id),this._space);r&&this._slideTo(r,t<0?"left":"right")&&(this._saveNav(),this._suppressClick=!0,setTimeout(()=>this._suppressClick=!1,0),this._showKioskDots())}}this._physicalDrag?.pid!==e.pointerId?this._physicalRotate?.pid!==e.pointerId?this._dtDrag?.pid!==e.pointerId?this._bdDrag?.pid!==e.pointerId?this._decorDraft?.pid!==e.pointerId?this._decorMove?.pid!==e.pointerId?this._editorRuntime?._furnPointerUp(e)||(this._pointers.delete(e.pointerId),this._pointers.size<2&&(this._pinchStart=null),0===this._pointers.size&&(this._panStart=null,this._panLock=null,this._suppressClick&&setTimeout(()=>this._suppressClick=!1,0)),this._viewportGestureDirty&&0===this._pointers.size&&!t&&(this._viewportGestureDirty=!1,this.requestUpdate()),t&&this._fitRoom(t)):this._editorRuntimeOrThrow()._dmUp():this._decorCommitDraft():this._bdUp():this._dtUp():this._physicalRotateUp(e):this._physicalUp(e)}_clickRoom(e){!this._suppressClick&&e.area&&fv("/config/areas/area/"+e.area)}_roomLabelKey(e,t){"view"!==this._mode||"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),e.stopPropagation(),this._fitRoom(t))}_pointerDown(e,t){if("view"!==this._mode&&"devices"!==this._mode)return;if("view"===this._mode&&"touch"===e.pointerType&&this._touchSequenceMultitouch)return;if(t=this._deviceHits.begin(this.renderRoot,this._renderDevices,this._space,e,t),"view"===this._mode){this._holdFired=!1,clearTimeout(this._holdTimer);const i=e.pointerId,n=e.currentTarget;return void(this._holdTimer=window.setTimeout(()=>{this._holdFired=!0,this._interruptViewGesture(i,n),this._infoCard=t},600))}if("ha_disabled"===t.bindingStatus?.kind||this._devicePositionBusy)return;if(this._deviceDrag)return void(this._deviceDrag.pointerId!==e.pointerId&&this._cancelDeviceDrag());e.preventDefault();const i=this._pos(t);this._deviceDrag={id:t.id,spaceId:t.space,displayName:t.name,pointerId:e.pointerId,source:e.currentTarget,sx:e.clientX,sy:e.clientY,ox:i.x,oy:i.y,moved:!1,before:fg(this._layout,t.id),start:this._devicePlacementForCanvas(t,i.x,i.y)},yv(e),this._tip=null,this._syncLiveHover()}_pointerMove(e,t){if("view"!==this._mode&&"devices"!==this._mode)return null;if(t=this._deviceForPointerEvent(e,t),"devices"!==this._mode)return t;const i=this._deviceDrag;return i&&i.id===t.id&&i.pointerId===e.pointerId?(this._editorRuntimeOrThrow()._queuePointerMove("device",()=>this._pointerMoveNow(e,t)),t):t}_pointerMoveNow(e,t){if("devices"!==this._mode)return;const i=this._deviceDrag;if(!i||i.id!==t.id||i.pointerId!==e.pointerId)return;const n=this.renderRoot.querySelector(".stage");if(!n)return;const r=this._baseVb(),o=n.getBoundingClientRect(),s=this._viewOr(r),a=(e.clientX-i.sx)/o.width*s.w,l=(e.clientY-i.sy)/o.height*s.h;Math.abs(e.clientX-i.sx)+Math.abs(e.clientY-i.sy)>3&&(i.moved=!0,clearTimeout(this._holdTimer));const c=ll(i.ox+a),h=ll(i.oy+l);this._previewDevicePlacement(t.id,this._devicePlacementForCanvas(t,c,h))}_pointerUp(e,t){if(t=this._deviceForPointerEvent(e,t),this._deviceHits.release(e.pointerId),clearTimeout(this._holdTimer),"devices"!==this._mode)return;const i=this._deviceDrag;if(!i||i.id!==t.id||i.pointerId!==e.pointerId)return;this._editorRuntimeOrThrow()._flushPointerMove("device"),this._deviceDrag=null;const n=fg(this._layout,t.id);var r,o;i.moved&&null!==n&&(r=n,o=i.start,null===r||null===o?r!==o:r.x!==o.x||r.y!==o.y||r.s!==o.s)?(this._selId=t.id,this._suppressClick=!0,window.setTimeout(()=>{this._suppressClick=!1},0),this._devicePositionBusy=!0,this.requestUpdate(),this._persistDevicePlacement(t.id,n).then(()=>{const e=this._t("history.device_move",{name:i.displayName});this._devicePositionHistory.push({name:e,before:{deviceId:i.id,spaceId:i.spaceId,placement:i.before},after:{deviceId:i.id,spaceId:i.spaceId,placement:n}})}).catch(e=>{this._previewDevicePlacement(t.id,i.before),this._showToast(this._t("toast.pos_save_failed",{err:this._errText(e)}))}).finally(()=>{this._devicePositionBusy=!1,this.requestUpdate()})):this._previewDevicePlacement(t.id,i.before)}_pointerCancel(e,t){t=this._deviceForPointerEvent(e,t),this._deviceHits.cancel(e.pointerId),this._deviceDrag?.id===t.id&&this._deviceDrag.pointerId===e.pointerId&&this._cancelDeviceDrag()}_showToast(e){for(const e of this.renderRoot.querySelectorAll("hp-dialog"))e.closeTransientOverlays("toast");this._toast=e,clearTimeout(this._toastTimer),this._toastTimer=window.setTimeout(()=>{this._toast=""},3500)}_syncPointerHoverTargets(){const e=this._pointerModality.hoverEnabled;for(const t of this.renderRoot.querySelectorAll(pv))t.toggleAttribute("data-pointer-hover",e)}_syncPointerHoverSubtree(e){if(e.nodeType!==Node.ELEMENT_NODE)return;const t=e,i=this._pointerModality.hoverEnabled;t.matches(pv)&&t.toggleAttribute("data-pointer-hover",i);for(const e of t.querySelectorAll(pv))e.toggleAttribute("data-pointer-hover",i)}_clearTransientHover(e=!1){e&&this._pointerModality.suspend(),this._liveRt?.clearDeviceFocus(),this._deviceHits.hover(this.renderRoot,null),this._tip&&(this._tip=null),this._hoverRoom&&(this._hoverRoom=null),this._syncLiveHover()}_notePointer(e){const t=this._pointerModality.modality,i=this._pointerModality.note(e);"touch"!==i&&"pen"!==i||t===i&&!this._tip&&!this._hoverRoom||this._clearTransientHover()}_guardTouchGesture(e){if(this._editorSecondary?.handleOutsideDismiss(e))return;if(this._touchClickGuard.handleActivation(e,this._suppressClick))return;const t=e;if(this._notePointer(t),"pointercancel"===e.type||"lostpointercapture"===e.type?this._doubleFit.clear():"pointerdown"===e.type&&this._doubleFit.clearOutside(t),"pointerdown"===e.type&&this._touchClickGuard.pointerDown(t.pointerId,t.pointerType),"touch"!==t.pointerType)return;if("pointerdown"===e.type){if(this._touchContacts.set(t.pointerId,{x:t.clientX,y:t.clientY,inStage:!!t.target?.closest?.(".stage")}),this._touchContacts.size>=2){this._deviceHits.clearPointers(),this._clearRoomFocus(!0),this._clearTransientHover(),clearTimeout(this._holdTimer),clearTimeout(this._kioskHoldTimer),this._swipeStart=null;const e=[...this._touchContacts.values()];if("view"===this._mode&&!this._vacFit&&e.every(e=>e.inStage)){this._pointers=new Map([...this._touchContacts].map(([e,t])=>[e,{x:t.x,y:t.y}]));const[t,i]=e;this._pinchStart={dist:Math.hypot(t.x-i.x,t.y-i.y),zoom:this._zoom},this._panStart=null,this._panLock=null}else this._vacFit&&(this._pointers.clear(),this._pinchStart=null,this._panStart=null,this._panLock=null)}return}if("pointermove"===e.type){const e=this._touchContacts.get(t.pointerId);if(!e)return;const i={...e,x:t.clientX,y:t.clientY};if(this._touchContacts.set(t.pointerId,i),this._touchSequenceMultitouch&&"view"===this._mode&&!this._vacFit&&this._pinchStart&&[...this._touchContacts.values()].every(e=>e.inStage)){this._activateSafeDayCycleOutline(),this._pointers.set(t.pointerId,{x:t.clientX,y:t.clientY});const e=[...this._touchContacts.values()];if(e.length>=2&&this._stageEl){const[t,i]=e,n=Math.hypot(t.x-i.x,t.y-i.y)/(this._pinchStart.dist||1),r=this._stageEl.getBoundingClientRect();this._zoomAt((t.x+i.x)/2-r.left,(t.y+i.y)/2-r.top,this._pinchStart.zoom*n),this._saveZoom()}}return}if("pointerup"!==e.type&&"pointercancel"!==e.type&&"lostpointercapture"!==e.type)return;const i=this._touchClickGuard.pointerTerminal(t.pointerId,t.pointerType);if(this._clearTransientHover(),this._touchContacts.delete(t.pointerId),i){if(this._pointers.delete(t.pointerId),!this._vacFit&&this._pointers.size>=2){const[e,t]=[...this._pointers.values()];this._pinchStart={dist:Math.hypot(e.x-t.x,e.y-t.y),zoom:this._zoom}}else this._pinchStart=null;0===this._pointers.size&&(this._panStart=null,this._panLock=null)}}_showTip(e,t,i,n,r,o,s=!1){this._notePointer(e),this._pointerModality.hoverEnabled&&(this._drag||this._deviceDrag||s&&this._liveRt?.deviceFocusActive()||(this._tip={x:e.clientX,y:e.clientY,title:t,meta:i,lqi:n,temp:r,hum:o,room:s,source:"pointer"},this._syncLiveHover()))}_roomTipEnabledForPointer(e){return"view"===this._mode&&(this._notePointer(e),!!gn(this._settings)||(this._tip?.room&&(this._tip=null,this._syncLiveHover()),!1))}get _gridPitch(){return rl}get _cellCm(){const e=Number(this._curSpaceCfg?.cell_cm);return Number.isFinite(e)&&e>0?e:5}_fmtLen(e,t){const i=function(e,t,i,n){return Math.hypot(t[0]-e[0],t[1]-e[1])/i*n}(e,t,this._gridPitch,this._cellCm);return ti(i,"mi"===this.hass?.config?.unit_system?.length)}get _curSpaceCfg(){const e=this._resize?.preview;return e&&e.space===this._space?e.sp:this._serverCfg?.spaces.find(e=>e.id===this._space)}get _renderCfg(){const e=this._resize?.preview;return e&&this._serverCfg?{...this._serverCfg,spaces:this._serverCfg.spaces.map(t=>t.id===e.space?e.sp:t)}:this._serverCfg}get _spaceH(){return this._curSpaceCfg,_v}get _segments(){const e=this._curSpaceCfg,t=this._spaceH;return oi(e?.rooms||[]).map(e=>[e[0]*_v,e[1]*t,e[2]*_v,e[3]*t])}_savedNav(){if(this._hasFixedFloor)return null;try{return JSON.parse(localStorage.getItem(dv)||"null")}catch{return null}}_saveNav(){if(!this._hasFixedFloor)try{localStorage.setItem(dv,JSON.stringify({space:this._space}))}catch{}}_leaveCardRoute(){if(this._routeDepartureHandled)return;this._routeDepartureHandled=!0,this._configReloadAuthority.invalidateLifecycle(),this._summary?.leaveRoute(),this._clearRoomFocus(!0),this._cancelDangerConfirm(),"view"!==this._mode&&this._setMode("view",!1),this._pendingNavMode=null,this._geometryHistory.clear(),this._activeWallChainId=null,this._wallChainSegmentCms=[],this._closingWallCm=null,this._drawWallField=null,this._showHidden=!1,this._tapConfirm=null,this._vacCalConfirm=null,this._decorEraseConfirm=null,this._openingInfo=null,this._closeInfoCard(),this._rulesDialog=null,this._alignDialog=null,this._preflightClipboardFallback=null,this._backupImportDialog=null,this._backupExportDialog=null,this._pdfDialog=!1,this._supportDialog?.preview?.token&&this._editorRuntime?._discardSupportPreview(this._supportDialog.preview.token),this._supportDialog=null,this._settingsDialog=null,this._deviceInbox=null,this._deviceInboxReturn=null,this._markerDialog=null,this._openingDialog=null,this._physicalDialog=null,this._wallDialog=null,this._backdropDialog=null,this._decorShapeDialog=null,this._decorTextDialog=null,this._mergeDialog=null,this._roomDialog=!1,this._spaceDialog=null,this._importDialog=null;const e=this._warmSlot;e?.owner===this._warmGen&&(e.vp=this._warmViewportState(),e.dlg=null,e.frameFingerprint="",clearTimeout(e.evict),e.evict=0),this._saveNav()}_setMode(e,t=!0){return e!==this._mode&&(this._clearRoomFocus(!0),this._cancelDangerConfirm(),this._resetDeviceHitState(),this._clearTransientHover(!0)),this._warmModeRequest=0,this._editorRuntime?this._editorRuntime._setMode(e,t):"view"===e?void this._editorModeRequest++:void this._requestMode(e,t)}_primeDrawWallField(){return this._editorRuntimeOrThrow()._primeDrawWallField()}get _drawWallFieldValue(){return null===this._drawWallField?Io(15,this._imperial):this._drawWallField}get _drawWallCm(){const e=(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})(this._drawWallFieldValue);if(null==e||e<0)return null;const t=this._imperial?2.54*e:e,i="column"===this._tool?fa:100;return t>=("column"===this._tool?1:0)&&t<=i?t:null}get _drawWallMaxCm(){return"column"===this._tool?fa:100}_showPhysicalRange(e=this._drawWallMaxCm,t=0){return this._editorRuntimeOrThrow()._showPhysicalRange(e,t)}_mergeSpacePartitions(e,t){return this._editorRuntimeOrThrow()._mergeSpacePartitions(e,t)}_finishWallChain(){return this._editorRuntimeOrThrow()._finishWallChain()}_activateMarkupTool(e){return this._editorRuntimeOrThrow()._activateMarkupTool(e)}_limitReached(e){return this._editorRuntimeOrThrow()._limitReached(e)}_svgPoint(e){return this._editorRuntimeOrThrow()._svgPoint(e)}_snap(e){return this._editorRuntimeOrThrow()._snap(e)}_snapDrawPoint(e,t=!1){return this._editorRuntimeOrThrow()._snapDrawPoint(e,t)}_planSnapOpeningCuts(e,t){return this._editorRuntimeOrThrow()._planSnapOpeningCuts(e,t)}_planSnapGeometrySnapshot(){return this._editorRuntimeOrThrow()._planSnapGeometrySnapshot()}_hiddenWallDiagnosticSnapshot(){return this._editorRuntimeOrThrow()._hiddenWallDiagnosticSnapshot()}_planStructuralGeometrySnapshot(){return this._editorRuntimeOrThrow()._planStructuralGeometrySnapshot()}_planSnapContextKey(e){return this._editorRuntimeOrThrow()._planSnapContextKey(e)}_resolvePlanDrawPoint(e,t){return this._editorRuntimeOrThrow()._resolvePlanDrawPoint(e,t)}get _activePlanSnapCandidate(){if(!this._markup||"draw"!==this._tool)return null;const e=this._planSnapHover;if(!e)return null;const t=this._planSnapGeometrySnapshot();return e.contextKey===this._planSnapContextKey(t.key)?e.candidate:null}get _activePlanSnapConflicts(){if(!this._markup||"draw"!==this._tool)return[];const e=this._planSnapHover;if(!e)return[];const t=this._planSnapGeometrySnapshot();return e.contextKey===this._planSnapContextKey(t.key)?e.conflicts:[]}_clearPlanSnapHover(e=!0){return this._editorRuntime?this._editorRuntimeOrThrow()._clearPlanSnapHover(e):(this._planSnapHover=null,void(e&&(this._cursorPt=null)))}_samePt(e,t){return _i(e,t)}_dropLegacySegments(){return this._editorRuntimeOrThrow()._dropLegacySegments()}_rollbackRejectedPhysicalWrites(e){return this._editorRuntimeOrThrow()._rollbackRejectedPhysicalWrites(e)}async _reloadRejectedPhysicalWrite(){return this._editorRuntimeOrThrow()._reloadRejectedPhysicalWrite()}get _cfgWriting(){return this._writesPending>0}async _sendConfigCandidate(e){const t=$o(e),i=await this.hass.callWS({type:"houseplan/config/set",config:t,expected_rev:this._cfgRev});this._adoption.acceptConfigWrite(t,i)}_writeConfig(){if(this._editorRuntime)return this._editorRuntime._writeConfig();this._writesPending++,this._writeChain=Hu(this._writeChain,async()=>{if(!this._serverCfg)return;const e=$o(this._serverCfg);this._adoption.stageConfigCandidate(e),await this._sendConfigCandidate(e)});return this._writeChain.finally(()=>{this._writesPending--})}_saveConfig(){this._cfgEpoch++,this._saveConfigDebounced()}_geometrySnapshotFromConfig(e,t){return this._editorRuntimeOrThrow()._geometrySnapshotFromConfig(e,t)}_geometrySnapshot(e=this._space){return this._editorRuntimeOrThrow()._geometrySnapshot(e)}_recordGeometry(e,t){return this._editorRuntimeOrThrow()._recordGeometry(e,t)}_restoreGeometryStateInConfig(e,t,i=!1){return this._editorRuntimeOrThrow()._restoreGeometryStateInConfig(e,t,i)}_restoreGeometryStateLocal(e){return this._editorRuntimeOrThrow()._restoreGeometryStateLocal(e)}_wallModelBlockerLabel(e){return this._editorRuntimeOrThrow()._wallModelBlockerLabel(e)}_hasLegacyZeroWallFields(e=this._serverCfg){return this._editorRuntimeOrThrow()._hasLegacyZeroWallFields(e)}_showWallModelMigrationBlocked(e){return this._editorRuntimeOrThrow()._showWallModelMigrationBlocked(e)}_limitSegmentsOf(e){return this._editorRuntimeOrThrow()._limitSegmentsOf(e)}_junctionLimitViolations(e,t,i,n){return this._editorRuntimeOrThrow()._junctionLimitViolations(e,t,i,n)}_junctionLimitLabel(e){return this._editorRuntimeOrThrow()._junctionLimitLabel(e)}_junctionLimitsIntroduced(e,t,i){return this._editorRuntimeOrThrow()._junctionLimitsIntroduced(e,t,i)}_commitPhysicalGeometry(e,t,i=[]){return this._editorRuntimeOrThrow()._commitPhysicalGeometry(e,t,i)}_clearGeometryGesture(){return this._editorRuntime?this._editorRuntimeOrThrow()._clearGeometryGesture():(this._path=[],this._planSnapHover=null,this._cursorPt=null,this._openingHoverCandidate=null,this._openingJambBlockCm=null,this._openingPreset=null,this._openingRebindId=null,this._mergeSel=null,this._mergeDialog=null,this._splitSel=null,this._pendingSplit=null,this._wallFaceBatch=null,this._wallRepairDiagnostic=null,this._roomDeleteDialog=null,this._wallDialog=null,this._physicalDialog=null,this._physicalSel=null,this._physicalDrag=null,this._physicalRotate=null,this._activeWallChainId=null,this._wallChainSegmentCms=[],this._closingWallCm=null,this._openingDialog=null,this._resize?.reset(),this._decorDraft=null,this._decorMove=null,this._dtDrag=null,void(this._bdDrag=null))}_stagePointerCancel(e){if(this._deviceHits.cancel(e.pointerId),this._flushHa(),this._editorRuntime?._cancelPointerMove("markup-hover"),this._roomPointer?.pointerId===e.pointerId&&(this._roomPointer=null),this._doubleFit.clear(),this._editorRuntime)return this._editorRuntime._stagePointerCancel(e);this._pointers.delete(e.pointerId),this._pointers.size<2&&(this._pinchStart=null),0===this._pointers.size&&(this._panStart=null,this._panLock=null,this._swipeStart=null),this._viewportGestureDirty&&0===this._pointers.size&&(this._viewportGestureDirty=!1,this.requestUpdate())}_applyGeometryState(e,t=!1){return this._editorRuntimeOrThrow()._applyGeometryState(e,t)}_roomAt(e){return this._editorRuntimeOrThrow()._roomAt(e)}_overlapRoom(e){return this._editorRuntimeOrThrow()._overlapRoom(e)}_pointInRoom(e,t){return t.poly?mi(e,t.poly):null!=t.x&&e[0]>=t.x&&e[0]<=t.x+t.w&&e[1]>=t.y&&e[1]<=t.y+t.h}_contourSelfIntersects(e){return this._editorRuntimeOrThrow()._contourSelfIntersects(e)}_canAppendWallPoint(){return this._editorRuntimeOrThrow()._canAppendWallPoint()}_markupClick(e){if(this._editorRuntime)return this._editorRuntime._markupClick(e)}_activeWallSourceKey(e){return this._editorRuntimeOrThrow()._activeWallSourceKey(e)}_wallGraphSources(e){return this._editorRuntimeOrThrow()._wallGraphSources(e)}_wallFaceGraph(e,t){return this._editorRuntimeOrThrow()._wallFaceGraph(e,t)}_offerWallFaces(e,t=this._path.length-2,i){return this._editorRuntimeOrThrow()._offerWallFaces(e,t,i)}_beginWallFaceBatch(e){return this._editorRuntimeOrThrow()._beginWallFaceBatch(e)}_offerExistingWallFace(e){return this._editorRuntimeOrThrow()._offerExistingWallFace(e)}_columnClick(e){return this._editorRuntimeOrThrow()._columnClick(e)}_openPhysicalDialog(e,t){return this._editorRuntimeOrThrow()._openPhysicalDialog(e,t)}_physicalDown(e,t,i){return this._editorRuntimeOrThrow()._physicalDown(e,t,i)}_clampPhysicalDelta(e,t,i){return this._editorRuntimeOrThrow()._clampPhysicalDelta(e,t,i)}_physicalMove(e){return this._editorRuntimeOrThrow()._physicalMove(e)}_physicalUp(e){return this._editorRuntimeOrThrow()._physicalUp(e)}_registerPhysicalTap(e,t){return this._editorRuntimeOrThrow()._registerPhysicalTap(e,t)}_cancelPhysicalGesture(){return this._editorRuntimeOrThrow()._cancelPhysicalGesture()}_physicalRotateDown(e,t){return this._editorRuntimeOrThrow()._physicalRotateDown(e,t)}_physicalRotateMove(e){return this._editorRuntimeOrThrow()._physicalRotateMove(e)}_physicalRotateUp(e){return this._editorRuntimeOrThrow()._physicalRotateUp(e)}_rszRooms(){return this._editorRuntimeOrThrow()._rszRooms()}_rszOpenings(){return this._editorRuntimeOrThrow()._rszOpenings()}_rszObstacles(){return this._editorRuntimeOrThrow()._rszObstacles()}_rszOptsFor(e,t){return this._editorRuntimeOrThrow()._rszOptsFor(e,t)}_rszResolution(e,t,i){return this._editorRuntimeOrThrow()._rszResolution(e,t,i)}_rszSnapshot(){return this._editorRuntimeOrThrow()._rszSnapshot()}_rszResetController(){return this._editorRuntimeOrThrow()._rszResetController()}_rszProjectPreview(e,t,i,n,r){return this._editorRuntimeOrThrow()._rszProjectPreview(e,t,i,n,r)}_rszAcceptPreview(e,t){return this._editorRuntimeOrThrow()._rszAcceptPreview(e,t)}_rszSpaceCandidateGeometry(e,t){return this._editorRuntimeOrThrow()._rszSpaceCandidateGeometry(e,t)}_rszSpaceCandidateRenderable(e,t){return this._editorRuntimeOrThrow()._rszSpaceCandidateRenderable(e,t)}_rszCandidateRenderable(e){return this._editorRuntimeOrThrow()._rszCandidateRenderable(e)}_rszEdgeDown(e,t,i){return this._editorRuntimeOrThrow()._rszEdgeDown(e,t,i)}_rszReasonText(e){return this._editorRuntimeOrThrow()._rszReasonText(e)}_rszDisabledActivate(e,t){return this._editorRuntimeOrThrow()._rszDisabledActivate(e,t)}_rszDisabledKey(e,t){return this._editorRuntimeOrThrow()._rszDisabledKey(e,t)}_rszMove(e){return this._editorRuntimeOrThrow()._rszMove(e)}_rszUp(e){return this._editorRuntimeOrThrow()._rszUp(e)}_rszCancelDrag(e){return this._editorRuntimeOrThrow()._rszCancelDrag(e)}_rszPointerCancel(e){return this._editorRuntimeOrThrow()._rszPointerCancel(e)}_rszEdgeLabels(e,t,i=this._resize?.rooms){return this._editorRuntimeOrThrow()._rszEdgeLabels(e,t,i)}_rszInnerSpanCms(e,t,i){return this._editorRuntimeOrThrow()._rszInnerSpanCms(e,t,i)}_renderResizeMeasurements(){return this._editorRuntimeOrThrow()._renderResizeMeasurements()}_renderResizeLayer(e,t){return this._editorRuntimeOrThrow()._renderResizeLayer(e,t)}get _openingsR(){const e=this._curSpaceCfg,t=this._spaceH,i=this._spaceModel();return i?(e?.openings||[]).flatMap(e=>{const n={...e,rx:e.x*_v,ry:e.y*t,rlen:e.length*_v};if(!e.host||"wall"===e.host.kind)return[n];const r=Ju(e,i.partitions,_v,this._cellCm,this._gridPitch);if(!r.resolved)return"plan"===this._mode?[{...n,orphanReason:r.reason||"invalid-host"}]:[];let[o,s]=r.resolved.center;const a=this._physicalDrag;return a?.moved&&"partition"===a.kind&&a.id===e.host.id&&(o+=a.delta[0],s+=a.delta[1]),[{...e,rx:o,ry:s,rlen:r.resolved.length,angle:r.resolved.angle,partitionHost:r.resolved}]}):[]}_partitionOpeningCuts(e=this._spaceModel(),t=()=>!0){if(!e)return[];return G_(U_(this._curSpaceCfg?.id===e.id?this._curSpaceCfg:null,e,this._cellCm,this._gridPitch,_v),t)}_roomWallOpeningInputs(e=this._openingsR,t=this._spaceModel()){if(!t)return[];const i=this._openCuts();return V_(e,t,this._spaceWalls,i,this._wallKeyPitch,this._cellCm,this._gridPitch,_v)}_openingFace(e,t,i){return e.partitionHost?ip(e.partitionHost,i):pa(t,{x:e.rx,y:e.ry,angle:e.angle,length:e.rlen,flip_v:i})}_cmToUnits(e){return e/this._cellCm*this._gridPitch}get _decorList(){const e=this._curSpaceCfg;return Array.isArray(e?.decor)?e.decor:[]}get _decorH(){return _v}_decorResolvedStyle(e){return function(e,t,i,n=Cr){const r="rect"===e?.kind||"ellipse"===e?.kind,o=e,s=Kt(o?.color,n.color);return{color:s,opacity:Tr(o?.opacity,n.opacity),widthCm:Ir(e,t,i,n.widthCm),fill:!!r&&!0===o?.fill,fillColor:Kt(o?.fill_color,o?.fill?s:n.fillColor),fillOpacity:r&&o?.fill?Tr(o?.fill_opacity,.25):n.fillOpacity}}(e,this._cellCm,this._gridPitch,Cr)}_decorWidthUnits(e){return((e,t,i,n=Cr.widthCm)=>{const r=Number(e?.width_cm);if(Number.isFinite(r)&&r>0)return Fr(r,t,i);const o=Number(e?.width);return Number.isFinite(o)&&o>0?o:Fr(n,t,i)})(e,this._cellCm,this._gridPitch,Cr.widthCm)}_decorTextSizeCm(e){if("text"===e?.kind){const t=Number(e.size_cm);return Number.isFinite(t)&&t>0?t:zr(20*rn(e),this._cellCm,this._gridPitch)}return zr(20,this._cellCm,this._gridPitch)}_decorTextUnits(e){if("text"!==e.kind)return 20;const t=Number(e.size_cm);return Number.isFinite(t)&&t>0?Fr(t,this._cellCm,this._gridPitch):20*rn(e)}_decorSmallField(e){return Math.round(100*(this._imperial?e/2.54:e))/100}_decorSmallCm(e){const t=this._imperial?2.54*e:e;return Number.isFinite(t)?Math.max(.1,Math.min(100,t)):.1}_decorTextCm(e){const t=this._imperial?2.54*e:e;return Number.isFinite(t)?Math.max(.1,Math.min(2e3,t)):.1}_decorLargeField(e){return Math.round(100*(this._imperial?e/30.48:e/100))/100}_decorLargeCm(e){const t=this._imperial?30.48*e:100*e;return Number.isFinite(t)?Math.max(.1,Math.min(tl*this._cellCm,t)):.1}_angleField(e){const t=Number(e);return Number.isFinite(t)?String(Number(t.toFixed(3))):"0"}_decorBoxOf(e){return"rect"!==e.kind&&"ellipse"!==e.kind&&"furniture"!==e.kind&&"image"!==e.kind?null:{x:e.x*_v,y:e.y*this._decorH,w:e.w*_v,h:e.h*this._decorH,angle:Dr(e.angle)||void 0}}_decorSnapGeometry(e){return this._editorRuntimeOrThrow()._decorSnapGeometry(e)}_decorSnap(e,t="mouse",i){return this._editorRuntimeOrThrow()._decorSnap(e,t,i)}_replaceDecor(e,t){return this._editorRuntimeOrThrow()._replaceDecor(e,t)}_cancelDecorGesture(){return this._editorRuntimeOrThrow()._cancelDecorGesture()}_decorPointerDown(e){return this._editorRuntimeOrThrow()._decorPointerDown(e)}_decorCommitDraft(){return this._editorRuntimeOrThrow()._decorCommitDraft()}_decorShapeDown(e,t){if(this._editorRuntime)return this._editorRuntime._decorShapeDown(e,t)}_decorMoveUpdate(e){this._editorRuntimeOrThrow()._queuePointerMove("decor-move",()=>this._editorRuntimeOrThrow()._decorMoveUpdate(e))}_decorNudge(e,t){if("decor"!==this._mode||"select"!==this._decorTool||!this._decorSel||this._decorDraft||this._decorMove||this._dtDrag||this._bdDrag)return!1;const i=this._decorList.find(e=>e.id===this._decorSel),n=this._curSpaceCfg;if(!i||!n)return!1;const r=function(e,t,i,n,r,o){if(!([t,i,n,r,o].every(Number.isFinite)&&r>0))return null;let s;if(s="line"===e.kind?[[e.x1,e.y1],[e.x2,e.y2]]:"text"===e.kind?[[e.x,e.y]]:Nr(e),!s.length||s.some(e=>!e.slice(0,2).every(Number.isFinite)))return null;const a=s.map(e=>e[0]),l=s.map(e=>e[1]),c=Math.min(...a),h=Math.max(...a),d=Math.min(...l),u=Math.max(...l),p=t/n,_=i/r,m=p>0?Math.min(p,Math.max(0,o-h)):Math.max(p,Math.min(0,-o-c)),g=_>0?Math.min(_,Math.max(0,o-u)):Math.max(_,Math.min(0,-o-d));return m||g?"line"===e.kind?{...e,x1:e.x1+m,y1:e.y1+g,x2:e.x2+m,y2:e.y2+g}:{...e,x:e.x+m,y:e.y+g}:null}(i,e,t,_v,this._decorH,tl);if(!r)return!1;const o=this._geometrySnapshot();return n.decor=this._decorList.map(e=>e.id===i.id?r:e),this._recordGeometry(this._t("history.decor_move"),o),this._saveConfig(),this.requestUpdate(),!0}_decorShapeDbl(e,t){if(this._editorRuntime)return this._editorRuntime._decorShapeDbl(e,t)}_openDecorProperties(e){return this._editorRuntimeOrThrow()._openDecorProperties(e)}_decorOpenText(e){return this._editorRuntimeOrThrow()._decorOpenText(e)}_decorRememberTextSelection(e){return this._editorRuntimeOrThrow()._decorRememberTextSelection(e)}_decorInsertLiveVariable(e){return this._editorRuntimeOrThrow()._decorInsertLiveVariable(e)}_decorSaveText(){return this._editorRuntimeOrThrow()._decorSaveText()}_decorSaveShape(){return this._editorRuntimeOrThrow()._decorSaveShape()}get _dtSel(){return"decor"===this._mode&&"select"===this._decorTool&&this._decorSel&&this._decorList.find(e=>e.id===this._decorSel)||null}_dtPivot(e){return this._editorRuntimeOrThrow()._dtPivot(e)}_dtApply(e,t){return this._editorRuntimeOrThrow()._dtApply(e,t)}_dtStart(e,t,i,n){return this._editorRuntimeOrThrow()._dtStart(e,t,i,n)}_dtMove(e){this._editorRuntimeOrThrow()._queuePointerMove("decor-transform",()=>this._editorRuntimeOrThrow()._dtMove(e))}_dtUp(){return this._editorRuntimeOrThrow()._flushPointerMove("decor-transform"),this._editorRuntimeOrThrow()._dtUp()}_dtMeasure(){return this._editorRuntimeOrThrow()._dtMeasure()}_deleteDecor(e){return this._editorRuntimeOrThrow()._deleteDecor(e)}_decorDeleteSel(){return this._editorRuntimeOrThrow()._decorDeleteSel()}_confirmDecorErase(){return this._editorRuntimeOrThrow()._confirmDecorErase()}get _bdBase(){const e=this._curSpaceCfg;return e?.plan_url?{...Ya(e.plan_aspect,_v)}:null}get _bdRect(){const e=this._curSpaceCfg;return e?.plan_url?Ja(e,_v):null}get _bdParams(){const e=this._curSpaceCfg,t=Number(e?.plan_x),i=Number(e?.plan_y),n=Number(e?.plan_scale),r=Number(e?.plan_scale_x),o=Number(e?.plan_scale_y),s=Number.isFinite(n)&&n>0?n:1;return{dx:Number.isFinite(t)?t:0,dy:Number.isFinite(i)?i:0,sx:Number.isFinite(r)&&r>0?r:s,sy:Number.isFinite(o)&&o>0?o:s,angle:Dr(e?.plan_angle)}}_openBackdropDialog(e){if(this._editorRuntime)return this._editorRuntime._openBackdropDialog(e)}_saveBackdropDialog(){return this._editorRuntimeOrThrow()._saveBackdropDialog()}get _bdActive(){return"decor"===this._mode&&!!this._bdRect&&"backdrop"===this._decorTool}get _bdMovable(){return"decor"===this._mode&&"backdrop"===this._decorTool&&!!this._bdRect}_bdApply(e,t,i,n,r){return this._editorRuntimeOrThrow()._bdApply(e,t,i,n,r)}_bdStart(e,t,i=!1){return this._editorRuntimeOrThrow()._bdStart(e,t,i)}_bdMove(e){return this._editorRuntimeOrThrow()._bdMove(e)}get _bdMoved(){if("decor"!==this._mode||!this._bdRect)return!1;const e=this._bdParams;return 0!==e.dx||0!==e.dy||1!==e.sx||1!==e.sy||0!==e.angle}_bdReset(){return this._editorRuntimeOrThrow()._bdReset()}_bdUp(){return this._editorRuntimeOrThrow()._bdUp()}get _bdLive(){if(!this._bdDrag)return null;const e=this._bdRect;return e?{x:e.x+e.w/2,y:e.y+e.h/2,text:`${this._fmtLen([0,0],[e.w,0])} × ${this._fmtLen([0,0],[0,e.h])}`}:null}_renderBackdropFrame(e){return this._editorRuntime?this._editorRuntimeOrThrow()._renderBackdropFrame(e):G}_renderTextFrame(e){const t=this._dtSel;if(!t)return G;if("text"===t.kind&&this._dtBox?.id!==t.id)return G;const i="text"===t.kind?this._dtBox:this._decorBoxOf(t);if("line"!==t.kind&&!i)return G;const n=.018*Math.max(e.w,e.h),r=n/4;if("line"===t.kind){const e=[t.x1*_v,t.y1*this._decorH],i=[t.x2*_v,t.y2*this._decorH];return W` ${[e,i].map((e,t)=>W`this._dtStart(e,"scale",void 0,t)}> @@ -382,13 +382,13 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 this._dtStart(e,"rotate")}> - ${xv.map(e=>"edges"===e?d.map(([e,t,o])=>{const s=e<0?i.x:e>0?i.x+i.w:i.x+i.w/2,a=t<0?i.y:t>0?i.y+i.h:i.y+i.h/2;return W`"edges"===e?d.map(([e,t,o])=>{const s=e<0?i.x:e>0?i.x+i.w:i.x+i.w/2,a=t<0?i.y:t>0?i.y+i.h:i.y+i.h/2;return W`this._dtStart(i,"scale",[e,t])}> `}):l.map(([e,t,o])=>W`this._dtStart(i,"scale",[e,t])}>`))} - `}_renderDecorLayer(e,t=this._viewOr(this._baseVb())){const i=fv,n=this._decorH,r="decor"===this._mode,o=r&&"erase"===this._decorTool,s=this._stageEl,a="iso"===this._renderProjection?1:function(e,t,i,n){const r=Number(e),o=Number(t),s=Number(i),a=Number(n);if(![r,o,s,a].every(e=>Number.isFinite(e)&&e>0))return 1;const l=Math.min(r/s,o/a);return Number.isFinite(l)&&l>0?l:1}(s?.clientWidth,s?.clientHeight,t.w,t.h),l=this._decorList.filter(t=>void 0===e||t.id===e).map(e=>{const t="dshape"+(r&&this._decorSel===e.id?" dsel":""),s=this._decorResolvedStyle(e),l=this._decorWidthUnits(e),c=t=>this._decorShapeDown(t,e),h=t=>this._decorShapeDbl(t,e);if("line"===e.kind)return W``}_renderDecorLayer(e,t=this._viewOr(this._baseVb())){const i=_v,n=this._decorH,r="decor"===this._mode,o=r&&"erase"===this._decorTool,s=this._stageEl,a="iso"===this._renderProjection?1:function(e,t,i,n){const r=Number(e),o=Number(t),s=Number(i),a=Number(n);if(![r,o,s,a].every(e=>Number.isFinite(e)&&e>0))return 1;const l=Math.min(r/s,o/a);return Number.isFinite(l)&&l>0?l:1}(s?.clientWidth,s?.clientHeight,t.w,t.h),l=this._decorList.filter(t=>void 0===e||t.id===e).map(e=>{const t="dshape"+(r&&this._decorSel===e.id?" dsel":""),s=this._decorResolvedStyle(e),l=this._decorWidthUnits(e),c=t=>this._decorShapeDown(t,e),h=t=>this._decorShapeDbl(t,e);if("line"===e.kind)return W``:G}`}if("image"===e.kind){const s=pm(e,i,n);if(!s)return G;const[a,l,d,u,p,_]=s,m=this._decorAssets.get(e.asset_id);if(!m)return r&&this._editorRuntime?this._editorRuntime._renderMissingDecorImage(e,t,_,a,l,d,u,c,h):G;const g=this._display(m.url);return g?W``:G}`}if("image"===e.kind){const s=hm(e,i,n);if(!s)return G;const[a,l,d,u,p,_]=s,m=this._decorAssets.get(e.asset_id);if(!m)return r&&this._editorRuntime?this._editorRuntime._renderMissingDecorImage(e,t,_,a,l,d,u,c,h):G;const g=this._display(m.url);return g?W`this._signer.markLoaded(this._renderPlanHass,m.url,g)} @pointerdown=${c} @dblclick=${h}> ${o?W``:G}`:G}if("furniture"===e.kind){const d=Jl(e.symbol,this);if(!d)return G;const u=nc(e,i,n,d.viewW,d.viewH),p=Ql(l,a),_=Ql(l+Fr(20,this._cellCm,this._gridPitch),a);return W``:G}`:G}if("furniture"===e.kind){const d=Yl(e.symbol,this);if(!d)return G;const u=ec(e,i,n,d.viewW,d.viewH),p=Xl(l,a),_=Xl(l+Fr(20,this._cellCm,this._gridPitch),a);return W` ${t.lines.map(e=>W``)} - `}_zeroWalls(){const e=this._spaceModel();return e?q_(this._curSpaceCfg,e,fv,.02*this._gridPitch):{style:N_(this._curSpaceCfg),lines:[],contour:[],barriers:[],transmissive:[]}}_openCuts(){return this._zeroWalls().contour}_deleteRoomClick(e){return this._editorRuntimeOrThrow()._deleteRoomClick(e)}get _wallKeyPitch(){return ol}get _spaceWalls(){const e=this._curSpaceCfg?.walls;return Array.isArray(e)?e:[]}_intervalCm(e){const t=this._spaceModel();return t?Es(t.rooms,this._spaceWalls,this._openCuts(),e,this._wallKeyPitch,this._cellCm,this._gridPitch,fv):0}_normalizeWalls(e,t){const i=this._spaceModel();if(!i)return[];return Xo(Os(i.rooms,e,t,this._wallKeyPitch,this._cellCm,this._gridPitch,fv),this._curSpaceCfg?.rooms||[],ol,1,t.map(e=>[e[0]/fv,e[1]/fv,e[2]/fv,e[3]/fv]))}_paperShapes(e){if(!this._spaceWalls.length)return ri(e);const t=this._wallUnionGeometry();return t?.paperD?[{path:t.paperD}]:ri(e)}_wallUnionGeometry(){const e=this._spaceModel();if(!e)return null;const t=this._spaceWalls,i=this._physicalBodiesR();if(!t.length&&!i.length)return null;const n=`${this._space}|${this._cfgEpoch}|${e.rooms.length}`;if(!this._wallUnionCache||this._wallUnionCache.key!==n){const r=Cf(this._wallUnionPool,n);if(r.hit)this._wallUnionCache=r.value;else{const r=this._openCuts(),o=this._roomWallOpeningInputs(),s=na(e.rooms,t,r,o,this._wallKeyPitch,this._cellCm,this._gridPitch,fv,i);s&&Object.defineProperty(s,"sourceFingerprint",{value:uc([this._curSpaceCfg,this._cellCm,this._gridPitch]),enumerable:!1});const a={key:n,value:s};Tf(this._wallUnionPool,n,a,8),this._wallUnionCache=a}}return this._wallUnionCache.value}_thickWallCuts(){const e=this._spaceModel();if(!e)return[];const t=this._spaceWalls;if(!t.length)return[];const i=this._openCuts();return oa(e.rooms,t,i,this._wallKeyPitch,this._cellCm,this._gridPitch,fv).map(e=>[e.a[0],e.a[1],e.b[0],e.b[1]])}_innerRoomContour(e,t,i=this._openCuts(),n=this._wallUnionGeometry()?.roomGeom,r=this._wallUnionGeometry()?.multiWallNodes){const o=i.map(e=>e.join(",")).join(";"),s=`${e.id}|${this._cfgEpoch}|${t}|${o}`,a=Cf(this._innerContourCache,s);if(a.hit)return a.value;const l=Ls(e.rooms,t,this._spaceWalls,i,this._wallKeyPitch,this._cellCm,this._gridPitch,fv,n,r);return Tf(this._innerContourCache,s,l,600),l}_wallThickHit(e){return this._editorRuntimeOrThrow()._wallThickHit(e)}get _wallThickHover(){if(!this._markup||"wallthick"!==this._tool||!this._cursorPt||this._wallDialog)return null;const e=this._wallThickHit(this._cursorPt);if(!e)return null;const t=function(e,t,i){const n=Number.isFinite(e)&&e>0?e:0,r=Number.isFinite(t)&&t>0?t:5,o=Number.isFinite(i)&&i>0?i:0;return n>0?Oo(n,r,o)/2:Wa(1.5*o,r)}(e.cm,this._cellCm,this._gridPitch);let i="";for(const n of e.segs)i+=(i?" ":"")+us([[n[0],n[1]],[n[2],n[3]]],t,!1);return{segs:e.segs,open:e.open,d:i}}_wallThickClick(e){return this._editorRuntimeOrThrow()._wallThickClick(e)}_wallThickApply(e){return this._editorRuntimeOrThrow()._wallThickApply(e)}_wallHatchDefs(e){const t=Po(this._cellCm);return W` + `}_zeroWalls(){const e=this._spaceModel();return e?H_(this._curSpaceCfg,e,_v,.02*this._gridPitch):{style:I_(this._curSpaceCfg),lines:[],contour:[],barriers:[],transmissive:[]}}_openCuts(){return this._zeroWalls().contour}_deleteRoomClick(e){return this._editorRuntimeOrThrow()._deleteRoomClick(e)}get _wallKeyPitch(){return ol}get _spaceWalls(){const e=this._curSpaceCfg?.walls;return Array.isArray(e)?e:[]}_intervalCm(e){const t=this._spaceModel();return t?Es(t.rooms,this._spaceWalls,this._openCuts(),e,this._wallKeyPitch,this._cellCm,this._gridPitch,_v):0}_normalizeWalls(e,t){const i=this._spaceModel();if(!i)return[];return Xo(Os(i.rooms,e,t,this._wallKeyPitch,this._cellCm,this._gridPitch,_v),this._curSpaceCfg?.rooms||[],ol,1,t.map(e=>[e[0]/_v,e[1]/_v,e[2]/_v,e[3]/_v]))}_paperShapes(e){if(!this._spaceWalls.length)return ri(e);const t=this._wallUnionGeometry();return t?.paperD?[{path:t.paperD}]:ri(e)}_wallUnionGeometry(){const e=this._spaceModel();if(!e)return null;const t=this._spaceWalls,i=this._physicalBodiesR();if(!t.length&&!i.length)return null;const n=`${this._space}|${this._cfgEpoch}|${e.rooms.length}`;if(!this._wallUnionCache||this._wallUnionCache.key!==n){const r=$f(this._wallUnionPool,n);if(r.hit)this._wallUnionCache=r.value;else{const r=this._openCuts(),o=this._roomWallOpeningInputs(),s=na(e.rooms,t,r,o,this._wallKeyPitch,this._cellCm,this._gridPitch,_v,i);s&&Object.defineProperty(s,"sourceFingerprint",{value:cc([this._curSpaceCfg,this._cellCm,this._gridPitch]),enumerable:!1});const a={key:n,value:s};Mf(this._wallUnionPool,n,a,8),this._wallUnionCache=a}}return this._wallUnionCache.value}_thickWallCuts(){const e=this._spaceModel();if(!e)return[];const t=this._spaceWalls;if(!t.length)return[];const i=this._openCuts();return oa(e.rooms,t,i,this._wallKeyPitch,this._cellCm,this._gridPitch,_v).map(e=>[e.a[0],e.a[1],e.b[0],e.b[1]])}_innerRoomContour(e,t,i=this._openCuts(),n=this._wallUnionGeometry()?.roomGeom,r=this._wallUnionGeometry()?.multiWallNodes){const o=i.map(e=>e.join(",")).join(";"),s=`${e.id}|${this._cfgEpoch}|${t}|${o}`,a=$f(this._innerContourCache,s);if(a.hit)return a.value;const l=Ls(e.rooms,t,this._spaceWalls,i,this._wallKeyPitch,this._cellCm,this._gridPitch,_v,n,r);return Mf(this._innerContourCache,s,l,600),l}_wallThickHit(e){return this._editorRuntimeOrThrow()._wallThickHit(e)}get _wallThickHover(){if(!this._markup||"wallthick"!==this._tool||!this._cursorPt||this._wallDialog)return null;const e=this._wallThickHit(this._cursorPt);if(!e)return null;const t=function(e,t,i){const n=Number.isFinite(e)&&e>0?e:0,r=Number.isFinite(t)&&t>0?t:5,o=Number.isFinite(i)&&i>0?i:0;return n>0?Oo(n,r,o)/2:Wa(1.5*o,r)}(e.cm,this._cellCm,this._gridPitch);let i="";for(const n of e.segs)i+=(i?" ":"")+us([[n[0],n[1]],[n[2],n[3]]],t,!1);return{segs:e.segs,open:e.open,d:i}}_wallThickClick(e){return this._editorRuntimeOrThrow()._wallThickClick(e)}_wallThickApply(e){return this._editorRuntimeOrThrow()._wallThickApply(e)}_wallHatchDefs(e){const t=Po(this._cellCm);return W` - `}_resolvedRoomFills(e,t){const i=new Map,n=new Map;for(const r of e.rooms){const e=this._roomDialog&&r.id===this._roomEditId?this._roomFill||t.fill:Ln(t.fill,r),o=un(t.customFill,this._roomDialog&&r.id===this._roomEditId?{settings:{fill_mode:this._roomFill,custom_fill:this._roomCustomFill}}:r),s=Pc(t.tempMin,t.tempMax,r,this._roomTempMin,this._roomTempMax,this._roomDialog&&r.id===this._roomEditId),a=bn(e,"lqi"===e&&r.area?this._roomLqi(r.area):null,"light"===e?qd(Ld(this._renderPlanHass,this._renderDevices,r,this._virtualLights)):"none","temp"===e?this._roomTemp(r):null,s.min,s.max,this._fillColors,o);i.set(r,a),r.id&&n.set(r.id,a)}return{byRoom:i,byId:n}}_spaceDisplayForRender(){const e=_n(this._curSpaceCfg),t=this._spaceDialog;return t&&"edit"===t.mode&&t.spaceId===this._space?{...e,showBorders:t.showBorders,showNames:t.showNames,hideDecor:t.hideDecor,hideOpenings:t.hideOpenings,color:t.roomColor,opacity:t.roomOpacity,fill:t.fillMode,customFill:t.customFill?dn(t.customFill):hn,glow:t.glowEnabled,tempMin:t.tempMin,tempMax:t.tempMax,showLqi:t.showLqi,cardFontScale:t.cardFontScale,labelTemp:t.labelTemp,labelHum:t.labelHum,labelLqi:t.labelLqi,labelLight:t.labelLight}:e}_openingWallIndexFor(e,t){const i=e.rooms.map(e=>`${e.id}:${e.poly?.map(e=>e.join(",")).join("/")||`${e.x},${e.y},${e.w},${e.h}`}`).join(";"),n=this._spaceWalls.map(e=>`${e.key}:${e.a?.join(",")||""}:${e.b?.join(",")||""}:${e.cm}`).join(";"),r=t.map(e=>e.join(",")).join(";"),o=[e.id,this._cfgEpoch,this._wallKeyPitch,this._cellCm,this._gridPitch,i,n,r].join("|");let s=this._openingWallIndexCache.get(o);return s||(s=la(e.rooms,this._spaceWalls,t,this._wallKeyPitch,this._cellCm,this._gridPitch,fv)),Tf(this._openingWallIndexCache,o,s,4),{key:o,value:s}}_renderOpeningTunnelFills(e,t,i="data"){if(this._markup||!this._spaceWalls.length||!this._openingsR.length)return W``;if("glow-base"===i&&![...t.byRoom.values()].some(Boolean))return W``;const n=this._openCuts(),r=this._openingsR.map(e=>({x:e.rx,y:e.ry,angle:e.angle,length:e.rlen})),o=r.map(e=>`${e.x},${e.y},${e.angle},${e.length}`).join(";"),s=this._openingWallIndexFor(e,n),a=`${s.key}|${o}`;return this._openingTunnelCache&&this._openingTunnelCache.key===a||(this._openingTunnelCache={key:a,value:ga(s.value,r)}),R_({openings:this._openingsR,geometries:this._openingTunnelCache.value,fillsByRoomId:t.byId,idPrefix:`${e.id}-${i}`,groupClass:"data"===i?"opening-tunnels":"opening-tunnels glow-base-tunnels",dataLayer:i})}_resolvedGlowBase(e,t,i){const n=new Map,r=new Map,o=this._fillColors.glow_base;for(const s of e.rooms){const e=i.byRoom.get(s),a=Bn(t.glow,s)&&(!e||e.opacity<=0)?{color:o.c,opacity:o.a,mode:"glow"}:null;n.set(s,a),s.id&&r.set(s.id,a)}return{byRoom:n,byId:r}}_renderGlowBaseRooms(e,t){if(this._markup||![...t.byRoom.values()].some(Boolean))return W``;const i=new Map(e.rooms.map(e=>[e,ni(e)])),n=this._openCuts(),r=this._wallUnionGeometry()?.roomGeom,o=e=>"M "+e.map(e=>e[0]+" "+e[1]).join(" L ")+" Z",s=e.rooms.map(s=>{const a=t.byRoom.get(s)||null,l=i.get(s)||null;if(!a||!l)return G;const c=this._spaceWalls.length&&s.id&&this._innerRoomContour(e,s.id,n,r)||l,h=Ri(c,e.rooms.filter(e=>e!==s).map(e=>i.get(e)).filter(e=>!!e)),d=this._cleanFloor(s,c,e).path;return d||h.length?W``}_resolvedRoomFills(e,t){const i=new Map,n=new Map;for(const r of e.rooms){const e=this._roomDialog&&r.id===this._roomEditId?this._roomFill||t.fill:Ln(t.fill,r),o=un(t.customFill,this._roomDialog&&r.id===this._roomEditId?{settings:{fill_mode:this._roomFill,custom_fill:this._roomCustomFill}}:r),s=Tc(t.tempMin,t.tempMax,r,this._roomTempMin,this._roomTempMax,this._roomDialog&&r.id===this._roomEditId),a=bn(e,"lqi"===e&&r.area?this._roomLqi(r.area):null,"light"===e?Hd(Ed(this._renderPlanHass,this._renderDevices,r,this._virtualLights)):"none","temp"===e?this._roomTemp(r):null,s.min,s.max,this._fillColors,o);i.set(r,a),r.id&&n.set(r.id,a)}return{byRoom:i,byId:n}}_spaceDisplayForRender(){const e=_n(this._curSpaceCfg),t=this._spaceDialog;return t&&"edit"===t.mode&&t.spaceId===this._space?{...e,showBorders:t.showBorders,showNames:t.showNames,hideDecor:t.hideDecor,hideOpenings:t.hideOpenings,color:t.roomColor,opacity:t.roomOpacity,fill:t.fillMode,customFill:t.customFill?dn(t.customFill):hn,glow:t.glowEnabled,tempMin:t.tempMin,tempMax:t.tempMax,showLqi:t.showLqi,cardFontScale:t.cardFontScale,labelTemp:t.labelTemp,labelHum:t.labelHum,labelLqi:t.labelLqi,labelLight:t.labelLight}:e}_openingWallIndexFor(e,t){const i=e.rooms.map(e=>`${e.id}:${e.poly?.map(e=>e.join(",")).join("/")||`${e.x},${e.y},${e.w},${e.h}`}`).join(";"),n=this._spaceWalls.map(e=>`${e.key}:${e.a?.join(",")||""}:${e.b?.join(",")||""}:${e.cm}`).join(";"),r=t.map(e=>e.join(",")).join(";"),o=[e.id,this._cfgEpoch,this._wallKeyPitch,this._cellCm,this._gridPitch,i,n,r].join("|");let s=this._openingWallIndexCache.get(o);return s||(s=la(e.rooms,this._spaceWalls,t,this._wallKeyPitch,this._cellCm,this._gridPitch,_v)),Mf(this._openingWallIndexCache,o,s,4),{key:o,value:s}}_renderOpeningTunnelFills(e,t,i="data"){if(this._markup||!this._spaceWalls.length||!this._openingsR.length)return W``;if("glow-base"===i&&![...t.byRoom.values()].some(Boolean))return W``;const n=this._openCuts(),r=this._openingsR.map(e=>({x:e.rx,y:e.ry,angle:e.angle,length:e.rlen})),o=r.map(e=>`${e.x},${e.y},${e.angle},${e.length}`).join(";"),s=this._openingWallIndexFor(e,n),a=`${s.key}|${o}`;return this._openingTunnelCache&&this._openingTunnelCache.key===a||(this._openingTunnelCache={key:a,value:ga(s.value,r)}),S_({openings:this._openingsR,geometries:this._openingTunnelCache.value,fillsByRoomId:t.byId,idPrefix:`${e.id}-${i}`,groupClass:"data"===i?"opening-tunnels":"opening-tunnels glow-base-tunnels",dataLayer:i})}_resolvedGlowBase(e,t,i){const n=new Map,r=new Map,o=this._fillColors.glow_base;for(const s of e.rooms){const e=i.byRoom.get(s),a=Bn(t.glow,s)&&(!e||e.opacity<=0)?{color:o.c,opacity:o.a,mode:"glow"}:null;n.set(s,a),s.id&&r.set(s.id,a)}return{byRoom:n,byId:r}}_renderGlowBaseRooms(e,t){if(this._markup||![...t.byRoom.values()].some(Boolean))return W``;const i=new Map(e.rooms.map(e=>[e,ni(e)])),n=this._openCuts(),r=this._wallUnionGeometry()?.roomGeom,o=e=>"M "+e.map(e=>e[0]+" "+e[1]).join(" L ")+" Z",s=e.rooms.map(s=>{const a=t.byRoom.get(s)||null,l=i.get(s)||null;if(!a||!l)return G;const c=this._spaceWalls.length&&s.id&&this._innerRoomContour(e,s.id,n,r)||l,h=Ri(c,e.rooms.filter(e=>e!==s).map(e=>i.get(e)).filter(e=>!!e)),d=this._cleanFloor(s,c,e).path;return d||h.length?W``:s.poly||c!==l?W``)} - `}_roomHoverPaths(e){const t=this._hoverRoom;if("view"!==this._mode||!t||t.space!==e.id)return null;const i=e.rooms.find(e=>e===t.room||!!e.id&&e.id===t.room.id);if(!i)return null;const n=ni(i);if(!n)return null;const r=e.rooms.filter(e=>e!==i).map(e=>({room:e,poly:ni(e)})).filter(e=>!!e.poly),o=Ri(n,r.map(e=>e.poly)),s=this._openCuts(),a=.02*this._gridPitch,l=s.filter(e=>{const t=[(e[0]+e[2])/2,(e[1]+e[3])/2];return n.some((e,i)=>Vn(t,[e[0],e[1],...n[(i+1)%n.length]])<=4*a)}),c=this._spaceWalls,h=this._wallUnionGeometry()?.roomGeom,d=c.length&&i.id&&this._innerRoomContour(e,i.id,s,h)||n,u=[{axis:n,face:d}];for(const t of o){const i=r.find(e=>e.poly===t)?.room;let n=t;if(c.length&&i?.id){const r=Fs(e.rooms,i.id,c,s,this._wallKeyPitch,this._cellCm,this._gridPitch,fv);r&&(n=aa(r.poly,r.offsets)||t)}u.push({axis:t,face:n})}const p=this._roomWallOpeningInputs(this._openingsR,e).map(e=>{const t=e.angle*Math.PI/180,i=Math.cos(t)*e.length/2,n=Math.sin(t)*e.length/2;return[e.x-i,e.y-n,e.x+i,e.y+n]}),_=l.concat(p),m=u.map(({axis:e,face:t})=>{const i=_.map(i=>((e,t,i)=>{const n=e[2]-e[0],r=e[3]-e[1],o=Math.hypot(n,r);if(o.05)&&Vn([c,h],[i[0],i[1],n[0],n[1]])<=4*a){d=!0;break}}if(!d)return null;let u=null;for(let e=0;e.05)continue;const p=Vn([c,h],[t[0],t[1],n[0],n[1]]);(!u||p!!e);return i.length?In(t,i,a).map(e=>`M ${e[0]} ${e[1]} L ${e[2]} ${e[3]}`).join(" "):`M ${t.map(e=>`${e[0]} ${e[1]}`).join(" L ")} Z`}).filter(Boolean).join(" ");if(!m)return null;const g=e=>`M ${e.map(e=>`${e[0]} ${e[1]}`).join(" L ")} Z`;return{fillD:[this._cleanFloor(i,d,e).path||g(d),...o.map(g)].join(" "),outlineD:m}}_renderRoomHoverFill(e){return W` + `}_roomHoverPaths(e){const t=this._hoverRoom;if("view"!==this._mode||!t||t.space!==e.id)return null;const i=e.rooms.find(e=>e===t.room||!!e.id&&e.id===t.room.id);if(!i)return null;const n=ni(i);if(!n)return null;const r=e.rooms.filter(e=>e!==i).map(e=>({room:e,poly:ni(e)})).filter(e=>!!e.poly),o=Ri(n,r.map(e=>e.poly)),s=this._openCuts(),a=.02*this._gridPitch,l=s.filter(e=>{const t=[(e[0]+e[2])/2,(e[1]+e[3])/2];return n.some((e,i)=>Vn(t,[e[0],e[1],...n[(i+1)%n.length]])<=4*a)}),c=this._spaceWalls,h=this._wallUnionGeometry()?.roomGeom,d=c.length&&i.id&&this._innerRoomContour(e,i.id,s,h)||n,u=[{axis:n,face:d}];for(const t of o){const i=r.find(e=>e.poly===t)?.room;let n=t;if(c.length&&i?.id){const r=Fs(e.rooms,i.id,c,s,this._wallKeyPitch,this._cellCm,this._gridPitch,_v);r&&(n=aa(r.poly,r.offsets)||t)}u.push({axis:t,face:n})}const p=this._roomWallOpeningInputs(this._openingsR,e).map(e=>{const t=e.angle*Math.PI/180,i=Math.cos(t)*e.length/2,n=Math.sin(t)*e.length/2;return[e.x-i,e.y-n,e.x+i,e.y+n]}),_=l.concat(p),m=u.map(({axis:e,face:t})=>{const i=_.map(i=>((e,t,i)=>{const n=e[2]-e[0],r=e[3]-e[1],o=Math.hypot(n,r);if(o.05)&&Vn([c,h],[i[0],i[1],n[0],n[1]])<=4*a){d=!0;break}}if(!d)return null;let u=null;for(let e=0;e.05)continue;const p=Vn([c,h],[t[0],t[1],n[0],n[1]]);(!u||p!!e);return i.length?In(t,i,a).map(e=>`M ${e[0]} ${e[1]} L ${e[2]} ${e[3]}`).join(" "):`M ${t.map(e=>`${e[0]} ${e[1]}`).join(" L ")} Z`}).filter(Boolean).join(" ");if(!m)return null;const g=e=>`M ${e.map(e=>`${e[0]} ${e[1]}`).join(" L ")} Z`;return{fillD:[this._cleanFloor(i,d,e).path||g(d),...o.map(g)].join(" "),outlineD:m}}_renderRoomHoverFill(e){return W` `}_renderRoomHoverOutline(e){return W` @@ -480,7 +480,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 d="${e?.outlineD||""}" ?hidden=${!e}> - `}_renderWallThickUi(){return this._editorRuntime?this._editorRuntimeOrThrow()._renderWallThickUi():W``}_renderWallThickDialog(){return this._editorRuntimeOrThrow()._renderWallThickDialog()}_openingAt(e){return this._editorRuntimeOrThrow()._openingAt(e)}_resolveOpeningPlacement(e){return this._editorRuntimeOrThrow()._resolveOpeningPlacement(e)}_activateOpeningPlacement(e){return this._editorRuntimeOrThrow()._activateOpeningPlacement(e)}_clearOpeningPlacement(e){return this._editorRuntime?this._editorRuntimeOrThrow()._clearOpeningPlacement(e):(this._openingHoverCandidate=null,this._openingJambBlockCm=null,void(e&&(this._openingPreset=null,this._openingRebindId=null)))}_openingClick(e){return this._editorRuntimeOrThrow()._openingClick(e)}_editOpening(e){if(this._editorRuntime)return this._editorRuntimeOrThrow()._editOpening(e)}_opPointerDown(e,t){if(this._editorRuntime)return this._editorRuntimeOrThrow()._opPointerDown(e,t)}_opPointerMove(e,t){if(this._editorRuntime)return this._editorRuntimeOrThrow()._opPointerMove(e,t)}_opRuler(e,t){return this._editorRuntimeOrThrow()._opRuler(e,t)}_opPointerUp(e,t){if(this._editorRuntime)return this._editorRuntimeOrThrow()._opPointerUp(e,t)}_opClick(e,t){if(this._editorRuntime)return this._editorRuntimeOrThrow()._opClick(e,t)}_saveOpening(){return this._editorRuntimeOrThrow()._saveOpening()}_deleteOpening(){return this._editorRuntimeOrThrow()._deleteOpening()}_contactCandidates(){return this._editorRuntimeOrThrow()._contactCandidates()}_lockCandidates(){return this._editorRuntimeOrThrow()._lockCandidates()}_toggleOpeningEntityPicker(e){return this._editorRuntimeOrThrow()._toggleOpeningEntityPicker(e)}_filterOpeningEntities(e,t){return this._editorRuntimeOrThrow()._filterOpeningEntities(e,t)}_selectOpeningEntity(e,t){return this._editorRuntimeOrThrow()._selectOpeningEntity(e,t)}_mergeClick(e){return this._editorRuntimeOrThrow()._mergeClick(e)}_commitMerge(){return this._editorRuntimeOrThrow()._commitMerge()}_splitClick(e){return this._editorRuntimeOrThrow()._splitClick(e)}get _contourClosed(){return this._path.length>=4&&this._samePt(this._path[0],this._path[this._path.length-1])&&(null!=this._closingWallCm||!this._activeWallChainId)}_markupMove(e){this._markup&&this._editorRuntime&&this._editorRuntimeOrThrow()._queuePointerMove("markup-hover",()=>this._editorRuntime._markupMove(e))}get _openingPreview(){const e=this._openingPreset;if("opening"!==this._tool||!e||!this._cursorPt)return null;const t=this._cursorPt,i=this._openingHoverCandidate;if(i&&Qf(i,[t[0],t[1]],e.revision,this._cfgEpoch))return i;if(this._openingAt(t))return this._openingHoverCandidate=null,null;const n=this._resolveOpeningPlacement(t);return this._openingHoverCandidate=n,n}get _opMeasureView(){return this._opMeasure||this._openingPreview?.measure||null}_saveRoom(){return this._editorRuntimeOrThrow()._saveRoom()}_decideWallFace(e){return this._editorRuntimeOrThrow()._decideWallFace(e)}_wallSourceCmAt(e,t,i){return this._editorRuntimeOrThrow()._wallSourceCmAt(e,t,i)}_activePathWithRepair(e,t){return this._editorRuntimeOrThrow()._activePathWithRepair(e,t)}_validateWallRepair(e,t){return this._editorRuntimeOrThrow()._validateWallRepair(e,t)}_applyWallRepair(e,t){return this._editorRuntimeOrThrow()._applyWallRepair(e,t)}_applyWallFaceBatch(){return this._editorRuntimeOrThrow()._applyWallFaceBatch()}_commitRoom(){return this._editorRuntimeOrThrow()._commitRoom()}_cancelPath(){return this._editorRuntimeOrThrow()._cancelPath()}_roomDialogCancel(){return this._editorRuntimeOrThrow()._roomDialogCancel()}get _freeAreas(){const e=new Set;for(const t of this._serverCfg?.spaces||[])for(const i of t.rooms||[])i.area&&e.add(i.area);for(const t of this._wallFaceBatch?.decisions||[])t.create&&t.area&&e.add(t.area);return Object.values(this.hass?.areas||{}).filter(t=>!e.has(t.area_id)).sort((e,t)=>(e.name||"").localeCompare(t.name||""))}_openDeviceInbox(){return this._editorRuntimeOrThrow()._openDeviceInbox()}_closeMarkerDialog(){return this._editorRuntimeOrThrow()._closeMarkerDialog()}_deviceInboxCandidates(e){return this._editorRuntimeOrThrow()._deviceInboxCandidates(e)}_deviceInboxRows(){return this._editorRuntimeOrThrow()._deviceInboxRows()}_deviceForInboxRow(e){return this._editorRuntimeOrThrow()._deviceForInboxRow(e)}_openInboxMarker(e,t=!1){return this._editorRuntimeOrThrow()._openInboxMarker(e,t)}async _setInboxHidden(e,t){return this._editorRuntimeOrThrow()._setInboxHidden(e,t)}_findInboxDevice(e){return this._editorRuntimeOrThrow()._findInboxDevice(e)}_deviceInboxTabKey(e){return this._editorRuntimeOrThrow()._deviceInboxTabKey(e)}_openMarkerDialog(e){if(this._editorRuntime)return this._editorRuntime._openMarkerDialog(e);this._ensureEditorRuntime().then(t=>{t&&this._openMarkerDialog(e)})}_runCandidates(){return this._editorRuntimeOrThrow()._runCandidates()}_bindingCandidates(){return this._editorRuntimeOrThrow()._bindingCandidates()}_physicalBodiesR(e=this._spaceModel()){if(!e)return[];const t=`${e.id}|${this._cfgEpoch}|${this._cellCm}|${this._gridPitch}`;if(this._physicalBodiesCache?.key===t)return this._physicalBodiesCache.all;const i=Da(e,this._cellCm,this._gridPitch,2e-4*this._gridPitch,this._partitionOpeningCuts(e));return this._physicalBodiesCache={key:t,...i},i.all}_rawPhysicalBodiesR(e=this._spaceModel()){if(!e)return[];this._physicalBodiesR(e);const t=this._physicalBodiesCache;return t?[...t.partitions,...t.columns]:[]}_cleanFloor(e,t,i=this._spaceModel()){if(!i)return{floor:t,geom:null,path:"",area:Oa([[[...t,t[0]]]])};const n=e.id||`#${i.rooms.indexOf(e)}`,r=`${i.id}|${this._cfgEpoch}|${n}`;if(!this._resize?.preview){const e=Cf(this._cleanFloorCache,r);if(e.hit)return e.value}const o=t.map(e=>e[0]),s=t.map(e=>e[1]),a=[Math.min(...o),Math.min(...s),Math.max(...o),Math.max(...s)],l=this._physicalBodiesR(i).filter(e=>{const t=e.map(e=>e[0]),i=e.map(e=>e[1]);return Math.max(...t)>=a[0]&&Math.min(...t)<=a[2]&&Math.max(...i)>=a[1]&&Math.min(...i)<=a[3]}),c=l.length?Ia(t,l):null,h={floor:t,geom:c,path:c?Sa(c):"",area:Oa(c||[[[...t,t[0]]]])};return this._resize?.preview||Tf(this._cleanFloorCache,r,h,600),h}_autoIconForBinding(e){if("virtual"===e)return"mdi:map-marker";const[t,i]=e.split(":");if(!i)return"";const n=this._fullRegistryHass,r=this._bindingStatus(e),o="active"===r.kind?r.enabledEntityIds:r.allEntityIds;if("device"===t){const e=n.devices?.[i];if(!e)return"mdi:help-circle";const t=o;return t.some(e=>e.startsWith("lock."))?"mdi:lock":Yd(n,e.name_by_user||e.name||"",e.model,t,this._iconRules)}if("entity"===t){const e=n.entities?.[i],t=this.hass.states?.[i],r=e?.name||t?.attributes?.friendly_name||i;return i.startsWith("lock.")?"mdi:lock":Yd(n,r,"",[i],this._iconRules)}return""}_allRoomsFlat(){const e=[];for(const t of this._serverCfg?.spaces||[])for(const i of t.rooms||[])i.area?e.push({value:t.id+"#"+i.area,label:(t.title||t.id)+" · "+i.name}):i.id&&e.push({value:t.id+"#@"+i.id,label:(t.title||t.id)+" · "+i.name+" · "+this._t("marker.subarea")});return e}_errText(e){if(!e)return this._t("err.unknown");if("string"==typeof e)return e;if("invalid_passage_fields"===e.code){const t=String(e.message||e.error||"");let i="",n=[];try{const e=JSON.parse(t);i=String(e.space??""),n=Array.isArray(e.fields)?e.fields.map(String):[]}catch{const e=t.match(/space=([^;]*);\s*opening=([^;]*);\s*fields=([^;]*)/);e&&(i=e[1],n=e[3].split(",").filter(Boolean))}if(i||n.length){const e=this._serverCfg?.spaces?.find(e=>String(e.id)===i),t={contact:"opening.contact_label",lock:"opening.lock_label",invert:"opening.invert",flip_h:"opening.flip_h",flip_v:"opening.flip_v"},r=n.map(e=>t[e]?this._t(t[e]):e).join(", ");return this._t("opening.invalid_passage_fields",{room:e?.title||i,fields:r})}}if("invalid_partition_opening_jamb_margin"===e.code){const t=String(e.message||e.error||"");let i=NaN;try{i=Number(JSON.parse(t).margin_cm)}catch{const e=t.match(/margin_cm=([^;}"]*)/);i=e?Number(e[1]):NaN}if(Number.isFinite(i))return this._t("opening.partition_jamb_margin",{distance:ti(i,this._imperial)})}if(null!=e.code){const t=`backup.error.${e.code}`,i=this._t(t);return e.message&&console.warn("[houseplan] backend error",e.code,e.message),i!==t?i:this._t("err.code",{code:e.code})}if(e.message)return e.message;if(e.error)return e.error;try{return JSON.stringify(e)}catch{return String(e)}}_backupErrorText(e){return this._editorRuntimeOrThrow()._backupErrorText(e)}async _pickMarkerFiles(e){return this._editorRuntimeOrThrow()._pickMarkerFiles(e)}_removeMarkerPdf(e){return this._editorRuntimeOrThrow()._removeMarkerPdf(e)}_markerLightFields(e){return this._editorRuntimeOrThrow()._markerLightFields(e)}_markerTapActionFields(e){return this._editorRuntimeOrThrow()._markerTapActionFields(e)}_markerToggleEntityFields(e){return this._editorRuntimeOrThrow()._markerToggleEntityFields(e)}async _saveMarker(){return this._editorRuntimeOrThrow()._saveMarker()}async _deleteMarker(){return this._editorRuntimeOrThrow()._deleteMarker()}_normPos(e,t,i){return{s:e,x:t/fv,y:i/fv}}_spaceDialogUsesOnboardingRuntime(e){return"create"===e&&!this._editorRuntime&&(!!this._onboardingRuntime||0===(this._serverCfg?.spaces.length||0)||this._importTotal>0||this._importQueue.length>0)}_spaceRuntimeOrThrow(){if(!this._onboardingRuntime)throw new Error("Houseplan onboarding runtime is not loaded");return this._onboardingRuntime}_openSpaceDialog(e,t){return this._spaceDialogUsesOnboardingRuntime(e)?this._onboardingRuntime?void this._onboardingRuntime._openSpaceDialog(e,t):void this._ensureOnboardingRuntime().then(i=>{i&&this._spaceRuntimeOrThrow()._openSpaceDialog(e,t)}):this._editorRuntime?this._editorRuntime._openSpaceDialog(e,t):void this._ensureEditorRuntime().then(i=>{i&&this._openSpaceDialog(e,t)})}async _pickPlanFile(e){return this._onboardingRuntime&&this._spaceDialogUsesOnboardingRuntime("create")?this._onboardingRuntime._pickPlanFile(e):this._editorRuntimeOrThrow()._pickPlanFile(e)}_useServerPlan(e){return this._onboardingRuntime&&this._spaceDialogUsesOnboardingRuntime("create")?this._onboardingRuntime._useServerPlan(e):this._editorRuntimeOrThrow()._useServerPlan(e)}async _readPlanAspect(e){return this._onboardingRuntime&&this._spaceDialogUsesOnboardingRuntime("create")?this._onboardingRuntime._readPlanAspect(e):this._editorRuntimeOrThrow()._readPlanAspect(e)}async _deleteServerPlan(e){return this._onboardingRuntime&&this._spaceDialogUsesOnboardingRuntime("create")?this._onboardingRuntime._deleteServerPlan(e):this._editorRuntimeOrThrow()._deleteServerPlan(e)}_renderServerPlans(e){return this._onboardingRuntime&&this._spaceDialogUsesOnboardingRuntime(e.mode)?this._onboardingRuntime._renderServerPlans(e):this._editorRuntimeOrThrow()._renderServerPlans(e)}async _saveSpaceDialog(){return this._onboardingRuntime&&this._spaceDialogUsesOnboardingRuntime("create")?this._onboardingRuntime._saveSpaceDialog():this._editorRuntimeOrThrow()._saveSpaceDialog()}async _deleteSpace(){return this._editorRuntimeOrThrow()._deleteSpace()}async _saveConfigNow(){return this._editorRuntimeOrThrow()._saveConfigNow()}_startImport(){return this._onboardingRuntime?this._onboardingRuntime._startImport():this._editorRuntimeOrThrow()._startImport()}_openNextImport(){return this._onboardingRuntime?this._onboardingRuntime._openNextImport():this._editorRuntimeOrThrow()._openNextImport()}_skipImport(){return this._onboardingRuntime?this._onboardingRuntime._skipImport():this._editorRuntimeOrThrow()._skipImport()}_renderImportDialog(){return this._onboardingRuntime?this._onboardingRuntime._renderImportDialog():this._editorRuntimeOrThrow()._renderImportDialog()}_sunGlobal(){const e=this._settingsDialog;return e?{...this._settings,north_deg:e.northDeg??void 0,bg_mode:e.bgMode,sun_rays:e.sunRays,sun_ray_origin:e.sunRayOrigin}:this._settings}_sunSpace(){const e=this._spaceDialog,t=this._curSpaceCfg?.settings||{};return e&&"edit"===e.mode&&e.spaceId===this._space?{...t,north_deg:e.northDeg??void 0,bg_mode:e.bgMode??void 0,sun_rays:e.sunRays??void 0}:t}_effNorth(){return yr(this._sunGlobal(),this._sunSpace())}_effBgMode(){return wr(this._sunGlobal(),this._sunSpace())}_dayCycleState(e=new Date){return(this._modeTransitionVisual?.viewWeight??("view"===this._mode?1:0))<=0||"daynight"!==this._effBgMode()?null:lr(this._renderPlanHass,e)}_syncDayCycleClock(){const e=this._dayCycleState();this._dayCycleClockKey=e?cr(e):"";const t="clock"===e?.source&&"hidden"!==this.ownerDocument.visibilityState&&this.isConnected;t&&!this._dayCycleTimer?this._dayCycleTimer=window.setInterval(this._dayCycleTick,3e4):!t&&this._dayCycleTimer&&(clearInterval(this._dayCycleTimer),this._dayCycleTimer=0)}_dayCycleVisibility(e){"hidden"!==e.kind?(this._dayCycleTick(),this._syncDayCycleClock()):this._dayCycleTimer&&(clearInterval(this._dayCycleTimer),this._dayCycleTimer=0)}_effSunRays(){return kr(this._sunGlobal(),this._sunSpace())}_effSunRayOrigin(){return br(this._sunGlobal())}_sunNow(){return null!==this._effNorth()?xr(this._renderPlanHass):null}_renderSunRays(e){const t=W``,i=this._modeTransitionVisual?.viewWeight??0;if(this._editing&&i<=0||!this._effSunRays())return this._sunFadeReset(),t;const n=this._effNorth(),r=null!==n?xr(this._renderPlanHass):null;if(!r||r.elevation<=0)return this._sunFadeReset(),t;if(o=r.elevation,Number(o)>=3)this._sunOutTimer&&(clearTimeout(this._sunOutTimer),this._sunOutTimer=0),this._sunOut=!1,this._sunShown=!0;else{if(!this._sunShown)return t;this._sunOut||(this._sunOut=!0,this._sunOutTimer=window.setTimeout(()=>{this._sunOutTimer=0,this._sunShown=!1,this._sunOut=!1,this.requestUpdate()},2e3))}var o;const s=this._zeroWalls(),a=s.barriers.map(e=>e.join(",")).join(";"),l=this._effSunRayOrigin(),c=`${e.id}|${r.azimuth}|${r.elevation}|${n}|${l}|${this._cfgEpoch}|${s.style}|${a}`;if(!this._sunRaysCache||this._sunRaysCache.key!==c){const t=e.rooms.map(e=>({id:e.id||"",poly:ni(e)})).filter(e=>!!e.id&&!!e.poly),i=this._openingsR.filter(e=>"window"===e.type&&"partition"!==e.host?.kind).map(e=>({id:e.id,x:e.rx,y:e.ry,angle:e.angle,length:e.rlen})),o=this._spaceWalls,a=this._openCuts(),h=this._openingWallIndexFor(e,a).value,d={},u={},p=this._wallUnionGeometry()?.roomGeom;if(o.length){for(const i of t){const t=this._innerRoomContour(e,i.id,a,p);t&&(d[i.id]=t)}for(const e of i){const t=pa(h,{x:e.x,y:e.y,angle:e.angle,length:e.length});t.cm>0&&(u[e.id]=Oo(t.cm,this._cellCm,this._gridPitch))}}let _=fr(t,i,r.azimuth,r.elevation,n,o.length?d:void 0,o.length?u:void 0,l);const m=[...this._physicalBodiesR(e),...s.barriers.map(e=>[[e[0],e[1]],[e[2],e[3]]])];m.length&&(_=_.map(e=>{const t=function(e,t,i){return i>0?e.map(e=>function(e){const t=[...e].sort((e,t)=>e[0]-t[0]||e[1]-t[1]);if(t.length<=2)return t;const i=(e,t,i)=>(t[0]-e[0])*(i[1]-e[1])-(t[1]-e[1])*(i[0]-e[0]),n=[];for(const e of t){for(;n.length>=2&&i(n[n.length-2],n[n.length-1],e)<=0;)n.pop();n.push(e)}const r=[];for(let e=t.length-1;e>=0;e--){const n=t[e];for(;r.length>=2&&i(r[r.length-2],r[r.length-1],n)<=0;)r.pop();r.push(n)}return n.slice(0,-1).concat(r.slice(0,-1))}([...e,...e.map(e=>[e[0]+t[0]*i,e[1]+t[1]*i])])).filter(e=>e.length>=3):e}(m,e.dir,e.len),i=e.polys.map(e=>Ia(e,t));return{...e,paths:i.map(Sa).filter(Boolean),polys:i.flatMap(Na)}}).filter(e=>e.paths?.length||e.polys.length)),this._sunRaysCache={key:c,rays:_,rims:_.map(e=>function(e,t=1e-4){const[i,n]=e.dir,r=-n,o=i,s=[],a=e.rimSources||[e.a,e.b],l=a.filter((e,i)=>{const n=e[0]*r+e[1]*o;return a.findIndex(e=>Math.abs(e[0]*r+e[1]*o-n)<=t)===i});for(const a of l){const l=[];for(const s of e.polys)for(let e=0;et)continue;if(Math.abs((h[0]-a[0])*r+(h[1]-a[1])*o)>t)continue;const d=(c[0]-a[0])*i+(c[1]-a[1])*n,u=(h[0]-a[0])*i+(h[1]-a[1])*n;Math.abs(u-d)<=t||l.push(de[0]-t[0]);const c=[];for(const e of l){const i=c[c.length-1];i&&e[0]<=i[1]+t?i[1]=Math.max(i[1],e[1]):c.push([e[0],e[1]])}for(const[e,t]of c)s.push([[a[0]+i*e,a[1]+n*e],[a[0]+i*t,a[1]+n*t]])}return s}(e))}}const h=this._sunRaysCache.rays,d=this._sunRaysCache.rims;if(!h.length)return t;const u=(p=function(e){const t=Math.min(90,Math.max(-90,Number(e)||0));let i=hr[hr.length-1][1];for(let e=1;e + `}_renderWallThickUi(){return this._editorRuntime?this._editorRuntimeOrThrow()._renderWallThickUi():W``}_renderWallThickDialog(){return this._editorRuntimeOrThrow()._renderWallThickDialog()}_openingAt(e){return this._editorRuntimeOrThrow()._openingAt(e)}_resolveOpeningPlacement(e){return this._editorRuntimeOrThrow()._resolveOpeningPlacement(e)}_activateOpeningPlacement(e){return this._editorRuntimeOrThrow()._activateOpeningPlacement(e)}_clearOpeningPlacement(e){return this._editorRuntime?this._editorRuntimeOrThrow()._clearOpeningPlacement(e):(this._openingHoverCandidate=null,this._openingJambBlockCm=null,void(e&&(this._openingPreset=null,this._openingRebindId=null)))}_openingClick(e){return this._editorRuntimeOrThrow()._openingClick(e)}_editOpening(e){if(this._editorRuntime)return this._editorRuntimeOrThrow()._editOpening(e)}_opPointerDown(e,t){if(this._editorRuntime)return this._editorRuntimeOrThrow()._opPointerDown(e,t)}_opPointerMove(e,t){if(this._editorRuntime)return this._editorRuntimeOrThrow()._opPointerMove(e,t)}_opRuler(e,t){return this._editorRuntimeOrThrow()._opRuler(e,t)}_opPointerUp(e,t){if(this._editorRuntime)return this._editorRuntimeOrThrow()._opPointerUp(e,t)}_opClick(e,t){if(this._editorRuntime)return this._editorRuntimeOrThrow()._opClick(e,t)}_saveOpening(){return this._editorRuntimeOrThrow()._saveOpening()}_deleteOpening(){return this._editorRuntimeOrThrow()._deleteOpening()}_contactCandidates(){return this._editorRuntimeOrThrow()._contactCandidates()}_lockCandidates(){return this._editorRuntimeOrThrow()._lockCandidates()}_toggleOpeningEntityPicker(e){return this._editorRuntimeOrThrow()._toggleOpeningEntityPicker(e)}_filterOpeningEntities(e,t){return this._editorRuntimeOrThrow()._filterOpeningEntities(e,t)}_selectOpeningEntity(e,t){return this._editorRuntimeOrThrow()._selectOpeningEntity(e,t)}_mergeClick(e){return this._editorRuntimeOrThrow()._mergeClick(e)}_commitMerge(){return this._editorRuntimeOrThrow()._commitMerge()}_splitClick(e){return this._editorRuntimeOrThrow()._splitClick(e)}get _contourClosed(){return this._path.length>=4&&this._samePt(this._path[0],this._path[this._path.length-1])&&(null!=this._closingWallCm||!this._activeWallChainId)}_markupMove(e){this._markup&&this._editorRuntime&&this._editorRuntimeOrThrow()._queuePointerMove("markup-hover",()=>this._editorRuntime._markupMove(e))}get _openingPreview(){const e=this._openingPreset;if("opening"!==this._tool||!e||!this._cursorPt)return null;const t=this._cursorPt,i=this._openingHoverCandidate;if(i&&Xf(i,[t[0],t[1]],e.revision,this._cfgEpoch))return i;if(this._openingAt(t))return this._openingHoverCandidate=null,null;const n=this._resolveOpeningPlacement(t);return this._openingHoverCandidate=n,n}get _opMeasureView(){return this._opMeasure||this._openingPreview?.measure||null}_saveRoom(){return this._editorRuntimeOrThrow()._saveRoom()}_decideWallFace(e){return this._editorRuntimeOrThrow()._decideWallFace(e)}_wallSourceCmAt(e,t,i){return this._editorRuntimeOrThrow()._wallSourceCmAt(e,t,i)}_activePathWithRepair(e,t){return this._editorRuntimeOrThrow()._activePathWithRepair(e,t)}_validateWallRepair(e,t){return this._editorRuntimeOrThrow()._validateWallRepair(e,t)}_applyWallRepair(e,t){return this._editorRuntimeOrThrow()._applyWallRepair(e,t)}_applyWallFaceBatch(){return this._editorRuntimeOrThrow()._applyWallFaceBatch()}_commitRoom(){return this._editorRuntimeOrThrow()._commitRoom()}_cancelPath(){return this._editorRuntimeOrThrow()._cancelPath()}_roomDialogCancel(){return this._editorRuntimeOrThrow()._roomDialogCancel()}get _freeAreas(){const e=new Set;for(const t of this._serverCfg?.spaces||[])for(const i of t.rooms||[])i.area&&e.add(i.area);for(const t of this._wallFaceBatch?.decisions||[])t.create&&t.area&&e.add(t.area);return Object.values(this.hass?.areas||{}).filter(t=>!e.has(t.area_id)).sort((e,t)=>(e.name||"").localeCompare(t.name||""))}_openDeviceInbox(){return this._editorRuntimeOrThrow()._openDeviceInbox()}_closeMarkerDialog(){return this._editorRuntimeOrThrow()._closeMarkerDialog()}_deviceInboxCandidates(e){return this._editorRuntimeOrThrow()._deviceInboxCandidates(e)}_deviceInboxRows(){return this._editorRuntimeOrThrow()._deviceInboxRows()}_deviceForInboxRow(e){return this._editorRuntimeOrThrow()._deviceForInboxRow(e)}_openInboxMarker(e,t=!1){return this._editorRuntimeOrThrow()._openInboxMarker(e,t)}async _setInboxHidden(e,t){return this._editorRuntimeOrThrow()._setInboxHidden(e,t)}_findInboxDevice(e){return this._editorRuntimeOrThrow()._findInboxDevice(e)}_deviceInboxTabKey(e){return this._editorRuntimeOrThrow()._deviceInboxTabKey(e)}_openMarkerDialog(e){if(this._editorRuntime)return this._editorRuntime._openMarkerDialog(e);this._ensureEditorRuntime().then(t=>{t&&this._openMarkerDialog(e)})}_runCandidates(){return this._editorRuntimeOrThrow()._runCandidates()}_bindingCandidates(){return this._editorRuntimeOrThrow()._bindingCandidates()}_physicalBodiesR(e=this._spaceModel()){if(!e)return[];const t=`${e.id}|${this._cfgEpoch}|${this._cellCm}|${this._gridPitch}`;if(this._physicalBodiesCache?.key===t)return this._physicalBodiesCache.all;const i=Da(e,this._cellCm,this._gridPitch,2e-4*this._gridPitch,this._partitionOpeningCuts(e));return this._physicalBodiesCache={key:t,...i},i.all}_rawPhysicalBodiesR(e=this._spaceModel()){if(!e)return[];this._physicalBodiesR(e);const t=this._physicalBodiesCache;return t?[...t.partitions,...t.columns]:[]}_cleanFloor(e,t,i=this._spaceModel()){if(!i)return{floor:t,geom:null,path:"",area:Oa([[[...t,t[0]]]])};const n=e.id||`#${i.rooms.indexOf(e)}`,r=`${i.id}|${this._cfgEpoch}|${n}`;if(!this._resize?.preview){const e=$f(this._cleanFloorCache,r);if(e.hit)return e.value}const o=t.map(e=>e[0]),s=t.map(e=>e[1]),a=[Math.min(...o),Math.min(...s),Math.max(...o),Math.max(...s)],l=this._physicalBodiesR(i).filter(e=>{const t=e.map(e=>e[0]),i=e.map(e=>e[1]);return Math.max(...t)>=a[0]&&Math.min(...t)<=a[2]&&Math.max(...i)>=a[1]&&Math.min(...i)<=a[3]}),c=l.length?Ia(t,l):null,h={floor:t,geom:c,path:c?Sa(c):"",area:Oa(c||[[[...t,t[0]]]])};return this._resize?.preview||Mf(this._cleanFloorCache,r,h,600),h}_autoIconForBinding(e){if("virtual"===e)return"mdi:map-marker";const[t,i]=e.split(":");if(!i)return"";const n=this._fullRegistryHass,r=this._bindingStatus(e),o="active"===r.kind?r.enabledEntityIds:r.allEntityIds;if("device"===t){const e=n.devices?.[i];if(!e)return"mdi:help-circle";const t=o;return t.some(e=>e.startsWith("lock."))?"mdi:lock":Gd(n,e.name_by_user||e.name||"",e.model,t,this._iconRules)}if("entity"===t){const e=n.entities?.[i],t=this.hass.states?.[i],r=e?.name||t?.attributes?.friendly_name||i;return i.startsWith("lock.")?"mdi:lock":Gd(n,r,"",[i],this._iconRules)}return""}_allRoomsFlat(){const e=[];for(const t of this._serverCfg?.spaces||[])for(const i of t.rooms||[])i.area?e.push({value:t.id+"#"+i.area,label:(t.title||t.id)+" · "+i.name}):i.id&&e.push({value:t.id+"#@"+i.id,label:(t.title||t.id)+" · "+i.name+" · "+this._t("marker.subarea")});return e}_errText(e){if(!e)return this._t("err.unknown");if("string"==typeof e)return e;if("invalid_passage_fields"===e.code){const t=String(e.message||e.error||"");let i="",n=[];try{const e=JSON.parse(t);i=String(e.space??""),n=Array.isArray(e.fields)?e.fields.map(String):[]}catch{const e=t.match(/space=([^;]*);\s*opening=([^;]*);\s*fields=([^;]*)/);e&&(i=e[1],n=e[3].split(",").filter(Boolean))}if(i||n.length){const e=this._serverCfg?.spaces?.find(e=>String(e.id)===i),t={contact:"opening.contact_label",lock:"opening.lock_label",invert:"opening.invert",flip_h:"opening.flip_h",flip_v:"opening.flip_v"},r=n.map(e=>t[e]?this._t(t[e]):e).join(", ");return this._t("opening.invalid_passage_fields",{room:e?.title||i,fields:r})}}if("invalid_partition_opening_jamb_margin"===e.code){const t=String(e.message||e.error||"");let i=NaN;try{i=Number(JSON.parse(t).margin_cm)}catch{const e=t.match(/margin_cm=([^;}"]*)/);i=e?Number(e[1]):NaN}if(Number.isFinite(i))return this._t("opening.partition_jamb_margin",{distance:ti(i,this._imperial)})}if(null!=e.code){const t=`backup.error.${e.code}`,i=this._t(t);return e.message&&console.warn("[houseplan] backend error",e.code,e.message),i!==t?i:this._t("err.code",{code:e.code})}if(e.message)return e.message;if(e.error)return e.error;try{return JSON.stringify(e)}catch{return String(e)}}_backupErrorText(e){return this._editorRuntimeOrThrow()._backupErrorText(e)}async _pickMarkerFiles(e){return this._editorRuntimeOrThrow()._pickMarkerFiles(e)}_removeMarkerPdf(e){return this._editorRuntimeOrThrow()._removeMarkerPdf(e)}_markerLightFields(e){return this._editorRuntimeOrThrow()._markerLightFields(e)}_markerTapActionFields(e){return this._editorRuntimeOrThrow()._markerTapActionFields(e)}_markerToggleEntityFields(e){return this._editorRuntimeOrThrow()._markerToggleEntityFields(e)}async _saveMarker(){return this._editorRuntimeOrThrow()._saveMarker()}async _deleteMarker(){return this._editorRuntimeOrThrow()._deleteMarker()}_normPos(e,t,i){return{s:e,x:t/_v,y:i/_v}}_spaceDialogUsesOnboardingRuntime(e){return"create"===e&&!this._editorRuntime&&(!!this._onboardingRuntime||0===(this._serverCfg?.spaces.length||0)||this._importTotal>0||this._importQueue.length>0)}_spaceRuntimeOrThrow(){if(!this._onboardingRuntime)throw new Error("Houseplan onboarding runtime is not loaded");return this._onboardingRuntime}_openSpaceDialog(e,t){return this._spaceDialogUsesOnboardingRuntime(e)?this._onboardingRuntime?void this._onboardingRuntime._openSpaceDialog(e,t):void this._ensureOnboardingRuntime().then(i=>{i&&this._spaceRuntimeOrThrow()._openSpaceDialog(e,t)}):this._editorRuntime?this._editorRuntime._openSpaceDialog(e,t):void this._ensureEditorRuntime().then(i=>{i&&this._openSpaceDialog(e,t)})}async _pickPlanFile(e){return this._onboardingRuntime&&this._spaceDialogUsesOnboardingRuntime("create")?this._onboardingRuntime._pickPlanFile(e):this._editorRuntimeOrThrow()._pickPlanFile(e)}_useServerPlan(e){return this._onboardingRuntime&&this._spaceDialogUsesOnboardingRuntime("create")?this._onboardingRuntime._useServerPlan(e):this._editorRuntimeOrThrow()._useServerPlan(e)}async _readPlanAspect(e){return this._onboardingRuntime&&this._spaceDialogUsesOnboardingRuntime("create")?this._onboardingRuntime._readPlanAspect(e):this._editorRuntimeOrThrow()._readPlanAspect(e)}async _deleteServerPlan(e){return this._onboardingRuntime&&this._spaceDialogUsesOnboardingRuntime("create")?this._onboardingRuntime._deleteServerPlan(e):this._editorRuntimeOrThrow()._deleteServerPlan(e)}_renderServerPlans(e){return this._onboardingRuntime&&this._spaceDialogUsesOnboardingRuntime(e.mode)?this._onboardingRuntime._renderServerPlans(e):this._editorRuntimeOrThrow()._renderServerPlans(e)}async _saveSpaceDialog(){return this._onboardingRuntime&&this._spaceDialogUsesOnboardingRuntime("create")?this._onboardingRuntime._saveSpaceDialog():this._editorRuntimeOrThrow()._saveSpaceDialog()}async _deleteSpace(){return this._editorRuntimeOrThrow()._deleteSpace()}async _saveConfigNow(){return this._editorRuntimeOrThrow()._saveConfigNow()}_startImport(){return this._onboardingRuntime?this._onboardingRuntime._startImport():this._editorRuntimeOrThrow()._startImport()}_openNextImport(){return this._onboardingRuntime?this._onboardingRuntime._openNextImport():this._editorRuntimeOrThrow()._openNextImport()}_skipImport(){return this._onboardingRuntime?this._onboardingRuntime._skipImport():this._editorRuntimeOrThrow()._skipImport()}_renderImportDialog(){return this._onboardingRuntime?this._onboardingRuntime._renderImportDialog():this._editorRuntimeOrThrow()._renderImportDialog()}_sunGlobal(){const e=this._settingsDialog;return e?{...this._settings,north_deg:e.northDeg??void 0,bg_mode:e.bgMode,sun_rays:e.sunRays,sun_ray_origin:e.sunRayOrigin}:this._settings}_sunSpace(){const e=this._spaceDialog,t=this._curSpaceCfg?.settings||{};return e&&"edit"===e.mode&&e.spaceId===this._space?{...t,north_deg:e.northDeg??void 0,bg_mode:e.bgMode??void 0,sun_rays:e.sunRays??void 0}:t}_effNorth(){return yr(this._sunGlobal(),this._sunSpace())}_effBgMode(){return wr(this._sunGlobal(),this._sunSpace())}_dayCycleState(e=new Date){return(this._modeTransitionVisual?.viewWeight??("view"===this._mode?1:0))<=0||"daynight"!==this._effBgMode()?null:lr(this._renderPlanHass,e)}_syncDayCycleClock(){const e=this._dayCycleState();this._dayCycleClockKey=e?cr(e):"";const t="clock"===e?.source&&"hidden"!==this.ownerDocument.visibilityState&&this.isConnected;t&&!this._dayCycleTimer?this._dayCycleTimer=window.setInterval(this._dayCycleTick,3e4):!t&&this._dayCycleTimer&&(clearInterval(this._dayCycleTimer),this._dayCycleTimer=0)}_dayCycleVisibility(e){"hidden"!==e.kind?(this._dayCycleTick(),this._syncDayCycleClock()):this._dayCycleTimer&&(clearInterval(this._dayCycleTimer),this._dayCycleTimer=0)}_effSunRays(){return kr(this._sunGlobal(),this._sunSpace())}_effSunRayOrigin(){return br(this._sunGlobal())}_sunNow(){return null!==this._effNorth()?xr(this._renderPlanHass):null}_renderSunRays(e){const t=W``,i=this._modeTransitionVisual?.viewWeight??0;if(this._editing&&i<=0||!this._effSunRays())return this._sunFadeReset(),t;const n=this._effNorth(),r=null!==n?xr(this._renderPlanHass):null;if(!r||r.elevation<=0)return this._sunFadeReset(),t;if(o=r.elevation,Number(o)>=3)this._sunOutTimer&&(clearTimeout(this._sunOutTimer),this._sunOutTimer=0),this._sunOut=!1,this._sunShown=!0;else{if(!this._sunShown)return t;this._sunOut||(this._sunOut=!0,this._sunOutTimer=window.setTimeout(()=>{this._sunOutTimer=0,this._sunShown=!1,this._sunOut=!1,this.requestUpdate()},2e3))}var o;const s=this._zeroWalls(),a=s.barriers.map(e=>e.join(",")).join(";"),l=this._effSunRayOrigin(),c=`${e.id}|${r.azimuth}|${r.elevation}|${n}|${l}|${this._cfgEpoch}|${s.style}|${a}`;if(!this._sunRaysCache||this._sunRaysCache.key!==c){const t=e.rooms.map(e=>({id:e.id||"",poly:ni(e)})).filter(e=>!!e.id&&!!e.poly),i=this._openingsR.filter(e=>"window"===e.type&&"partition"!==e.host?.kind).map(e=>({id:e.id,x:e.rx,y:e.ry,angle:e.angle,length:e.rlen})),o=this._spaceWalls,a=this._openCuts(),h=this._openingWallIndexFor(e,a).value,d={},u={},p=this._wallUnionGeometry()?.roomGeom;if(o.length){for(const i of t){const t=this._innerRoomContour(e,i.id,a,p);t&&(d[i.id]=t)}for(const e of i){const t=pa(h,{x:e.x,y:e.y,angle:e.angle,length:e.length});t.cm>0&&(u[e.id]=Oo(t.cm,this._cellCm,this._gridPitch))}}let _=fr(t,i,r.azimuth,r.elevation,n,o.length?d:void 0,o.length?u:void 0,l);const m=[...this._physicalBodiesR(e),...s.barriers.map(e=>[[e[0],e[1]],[e[2],e[3]]])];m.length&&(_=_.map(e=>{const t=function(e,t,i){return i>0?e.map(e=>function(e){const t=[...e].sort((e,t)=>e[0]-t[0]||e[1]-t[1]);if(t.length<=2)return t;const i=(e,t,i)=>(t[0]-e[0])*(i[1]-e[1])-(t[1]-e[1])*(i[0]-e[0]),n=[];for(const e of t){for(;n.length>=2&&i(n[n.length-2],n[n.length-1],e)<=0;)n.pop();n.push(e)}const r=[];for(let e=t.length-1;e>=0;e--){const n=t[e];for(;r.length>=2&&i(r[r.length-2],r[r.length-1],n)<=0;)r.pop();r.push(n)}return n.slice(0,-1).concat(r.slice(0,-1))}([...e,...e.map(e=>[e[0]+t[0]*i,e[1]+t[1]*i])])).filter(e=>e.length>=3):e}(m,e.dir,e.len),i=e.polys.map(e=>Ia(e,t));return{...e,paths:i.map(Sa).filter(Boolean),polys:i.flatMap(Na)}}).filter(e=>e.paths?.length||e.polys.length)),this._sunRaysCache={key:c,rays:_,rims:_.map(e=>function(e,t=1e-4){const[i,n]=e.dir,r=-n,o=i,s=[],a=e.rimSources||[e.a,e.b],l=a.filter((e,i)=>{const n=e[0]*r+e[1]*o;return a.findIndex(e=>Math.abs(e[0]*r+e[1]*o-n)<=t)===i});for(const a of l){const l=[];for(const s of e.polys)for(let e=0;et)continue;if(Math.abs((h[0]-a[0])*r+(h[1]-a[1])*o)>t)continue;const d=(c[0]-a[0])*i+(c[1]-a[1])*n,u=(h[0]-a[0])*i+(h[1]-a[1])*n;Math.abs(u-d)<=t||l.push(de[0]-t[0]);const c=[];for(const e of l){const i=c[c.length-1];i&&e[0]<=i[1]+t?i[1]=Math.max(i[1],e[1]):c.push([e[0],e[1]])}for(const[e,t]of c)s.push([[a[0]+i*e,a[1]+n*e],[a[0]+i*t,a[1]+n*t]])}return s}(e))}}const h=this._sunRaysCache.rays,d=this._sunRaysCache.rims;if(!h.length)return t;const u=(p=function(e){const t=Math.min(90,Math.max(-90,Number(e)||0));let i=hr[hr.length-1][1];for(let e=1;e ${h.map((e,t)=>{const i=(e.a[0]+e.b[0])/2,n=(e.a[1]+e.b[1])/2,r=i+e.normal[0]*e.depth,o=n+e.normal[1]*e.depth;return W` ${_.map(([e,t])=>W`${this._t("gs.north_letter")} ${null===e?"—":e+"°"} - `}_stageBg(e){const t=this._settingsDialog,i=this._spaceDialog,n=t?t.bgColor||"":mn(this._settings,{bgColor:null});return(i&&"edit"===i.mode&&i.spaceId===this._space?i.bgColor||"":e.bgColor||"")||n}_stageBgHex(){const e=this._stageEl;if(e){const t=getComputedStyle(e).backgroundColor.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(t)return"#"+t.slice(1,4).map(e=>(+e).toString(16).padStart(2,"0")).join("")}return"#111111"}_renderPdfDialog(){const e=this._pdfRuntime,t=this._spaceModel(),i=this._curSpaceCfg;if(!(e&&t&&i&&this._serverCfg))return G;const n=new Map;for(const[e,t]of this._decorAssets)n.set(e,{url:this._display(t.url),mime:t.mime});const r=this._wallUnionGeometry(),o=this._openCuts(),s=new Map(t.rooms.flatMap(e=>e.id?[[e.id,e]]:[]));return e.render({config:this._serverCfg,rawSpace:i,space:t,layout:this._layout,imperial:this._imperial,cardTitle:this._config?.title||this._t("card.title"),version:nv(ov),hass:this.hass,backdropUrl:t.bg?this._display(t.bg.href):"",decorAssets:n,sharedWallGeometry:r,resolveInnerContour:e=>this._innerRoomContour(t,e,o,r?.roomGeom,r?.multiWallNodes),resolveRoomArea:(e,i)=>{const n=s.get(e);return n?this._cleanFloor(n,i,t).area:void 0},t:(e,t)=>this._t(e,t),toast:e=>this._showToast(e),close:()=>{this._pdfDialog=!1,this.requestUpdate()}})}_preflightDiagnostics(e,t){return this._editorRuntimeOrThrow()._preflightDiagnostics(e,t)}_reportPreflightFailure(e,t){return this._editorRuntimeOrThrow()._reportPreflightFailure(e,t)}_preflightVersionsDiffer(){return this._editorRuntimeOrThrow()._preflightVersionsDiffer()}async _copyPreflightDiagnostics(){return this._editorRuntimeOrThrow()._copyPreflightDiagnostics()}_checkOptimizeGeometry(e){return this._editorRuntimeOrThrow()._checkOptimizeGeometryImpl(e)}_checkSpacePhysicalGeometry(e,t,i){return this._editorRuntimeOrThrow()._checkSpacePhysicalGeometryImpl(e,t,i)}_optimizeReferenceContext(e){return this._editorRuntimeOrThrow()._optimizeReferenceContext(e)}_previewAlignDialog(e){return this._editorRuntimeOrThrow()._previewAlignDialog(e)}async _runAlignToGrid(){return this._editorRuntimeOrThrow()._runAlignToGrid()}async _undoPlanOptimization(){return this._editorRuntimeOrThrow()._undoPlanOptimization()}async _runBackupExport(){return this._editorRuntimeOrThrow()._runBackupExport()}async _pickBackupImport(e){return this._editorRuntimeOrThrow()._pickBackupImport(e)}async _setBackupDuplicatePolicy(e){return this._editorRuntimeOrThrow()._setBackupDuplicatePolicy(e)}async _applyBackupImport(){return this._editorRuntimeOrThrow()._applyBackupImport()}_renderBackupExportDialog(){return this._editorRuntimeOrThrow()._renderBackupExportDialog()}_renderBackupImportDialog(){return this._editorRuntimeOrThrow()._renderBackupImportDialog()}_setFillColor(e,t){return this._editorRuntimeOrThrow()._setFillColor(e,t)}async _saveSettingsDialog(){return this._editorRuntimeOrThrow()._saveSettingsDialog()}_boolInput(e,t,i=!1){return this._editorRuntimeOrThrow()._boolInput(e,t,i)}_rangeInput(e,t,i,n,r,o=!1,s){return this._editorRuntimeOrThrow()._rangeInput(e,t,i,n,r,o,s)}_renderColorRow(e,t){return this._editorRuntimeOrThrow()._renderColorRow(e,t)}get _glowRadiusCm(){const e=Number(this._settings.glow_radius_cm);return Number.isFinite(e)&&e>0?e:300}get _imperial(){return"mi"===this.hass?.config?.unit_system?.length}get _glowRadiusPlaceholder(){const e=this._glowRadiusCm;return this._imperial?String(Math.round(e/30.48*10)/10):String(e/100)}_glowTransition(e,t){return Pm(this._glowRuntimeState,this._glowRuntimeHost,e,t)}_forgetGlowSource(e){Fm(this._glowRuntimeState,this._glowRuntimeHost,e)}_forgetGlowSpace(e){zm(this._glowRuntimeState,this._glowRuntimeHost,e)}_warnGlowGeometryFallback(e,t,i,n){Em(this._glowRuntimeState,e,t,i,n)}_lightBarriers(e,t){const i=Rm({rawSpaceConfig:this._curSpaceCfg,space:e,openings:this._openingsR,cellCm:this._cellCm,gridPitch:this._gridPitch,openingAmount:e=>this._openingAmt(e)}),n=`${e.id}|${i.fingerprint}`,r=Cf(this._lightBarrierPool,n);if(r.hit)return this._lightBarrierCache=r.value,r.value.value;const o=Cm({space:e,revision:i,walls:this._spaceWalls,zeroWalls:this._zeroWalls(),wallKeyPitch:this._wallKeyPitch,cellCm:this._cellCm,gridPitch:this._gridPitch,coordScale:fv,sharedWallGeometry:this._wallUnionGeometry(),physicalBodies:(t,i)=>(this._lightPhysicalBodiesCache?.key!==i&&(this._lightPhysicalBodiesCache={key:i,all:Da(e,this._cellCm,this._gridPitch,2e-4*this._gridPitch,t).all}),this._lightPhysicalBodiesCache.all)}),s={key:n,value:o};return Tf(this._lightBarrierPool,n,s,8),this._lightBarrierCache=s,o}_renderGlowLayer(e,t,i=this._viewOr(this._baseVb())){const n=this._fillColors,r=this._glowRadiusCm/this._cellCm*this._gridPitch,o=e.rooms.map(e=>({r:e,poly:ni(e)})).filter(e=>!!e.poly),s=o.filter(({r:e})=>Bn(t.glow,e));if(!s.length)return this._forgetGlowSpace(e.id),W``;const a=this._lightBarriers(e,o),l=Mm({hass:this._renderPlanHass,devices:this._renderDevices,virtualLights:this._virtualLights,spaceId:e.id,defaultColor:n.glow_light.c,paletteAlpha:n.glow_light.a,defaultRadiusUnits:r,cellCm:this._cellCm,gridPitch:this._gridPitch,position:e=>this._pos(e)}),c=[],h=new Set;for(const t of l){const{key:i,pos:n}=t;if(h.add(i),Dm(n,a)){this._forgetGlowSource(i);continue}const r=this._glowTransition(i,!!t.appearance);if(!r)continue;t.appearance&&this._glowLastAppearance.set(i,t.appearance);const s=this._glowLastAppearance.get(i);if(!s)continue;let l=null;const d=`${e.id}|${a.fingerprint}|${n.x.toFixed(4)},${n.y.toFixed(4)}|${t.radius.toFixed(4)}`,u=Sm(this._glowRuntimeState,d);u.hit?l=u.value:(l=Tm({spaceId:e.id,source:n,radius:t.radius,scene:a,polygons:o.map(({r:e,poly:t})=>({room:e,poly:t})),onBoundsFailure:(t,i)=>this._warnGlowGeometryFallback(e.id,a.fingerprint,t,i)}),$m(this._glowRuntimeState,d,l)),c.push({key:i,sourceEid:t.sourceEid,domId:r.domId,entering:r.entering,leaving:r.leaving,pos:n,c:s.c,alpha:s.alpha,geometry:l,r:t.radius})}if(Im(this._glowRuntimeState,this._glowRuntimeHost,e.id,h),!c.length)return W``;const d=this._spaceWalls,u=s.length===o.length?[]:this._openCuts(),p=this._wallUnionGeometry()?.roomGeom,_=s.length===o.length?null:s.map(({r:t,poly:i})=>{const n=d.length&&t.id&&this._innerRoomContour(e,t.id,u,p)||i,r=this._cleanFloor(t,n,e).path,s=Ri(n,o.filter(e=>e.r!==t).map(e=>e.poly)),a=e=>"M "+e.map(e=>e[0]+" "+e[1]).join(" L ")+" Z";return[r||a(n),...s.map(a)].join(" ")}),m=this._stageEl?.clientWidth&&i.w?this._stageEl.clientWidth/i.w:1,g=!this._pinchStart&&!this._panStart&&!this._cameraTransition.active,f=Nm(this._glowRuntimeState,m,g);return Hm({spots:c,enabledClip:_,feather:f.feather,featherEnabled:f.enabled,screenBlend:this._glowScreenBlend})}_renderAlignDialog(){return this._editorRuntimeOrThrow()._renderAlignDialog()}_renderSettingsDialog(){return this._editorRuntimeOrThrow()._renderSettingsDialog()}_renderSupportDialog(){return this._editorRuntimeOrThrow()._renderSupportDialog()}_rulesSet(e){return this._editorRuntimeOrThrow()._rulesSet(e)}async _saveRules(){return this._editorRuntimeOrThrow()._saveRules()}_renderRulesDialog(){return this._editorRuntimeOrThrow()._renderRulesDialog()}_saveKioskScale(e){this._summary?.saveScale(e)}_renderKioskDialog(){const e=this._kioskScale,t=(t,i)=>{const n=Math.round(100*e[t]);return j` + `}_stageBg(e){const t=this._settingsDialog,i=this._spaceDialog,n=t?t.bgColor||"":mn(this._settings,{bgColor:null});return(i&&"edit"===i.mode&&i.spaceId===this._space?i.bgColor||"":e.bgColor||"")||n}_stageBgHex(){const e=this._stageEl;if(e){const t=getComputedStyle(e).backgroundColor.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(t)return"#"+t.slice(1,4).map(e=>(+e).toString(16).padStart(2,"0")).join("")}return"#111111"}_renderPdfDialog(){const e=this._pdfRuntime,t=this._spaceModel(),i=this._curSpaceCfg;if(!(e&&t&&i&&this._serverCfg))return G;const n=new Map;for(const[e,t]of this._decorAssets)n.set(e,{url:this._display(t.url),mime:t.mime});const r=this._wallUnionGeometry(),o=this._openCuts(),s=new Map(t.rooms.flatMap(e=>e.id?[[e.id,e]]:[]));return e.render({config:this._serverCfg,rawSpace:i,space:t,layout:this._layout,imperial:this._imperial,cardTitle:this._config?.title||this._t("card.title"),version:ev(iv),hass:this.hass,backdropUrl:t.bg?this._display(t.bg.href):"",decorAssets:n,sharedWallGeometry:r,resolveInnerContour:e=>this._innerRoomContour(t,e,o,r?.roomGeom,r?.multiWallNodes),resolveRoomArea:(e,i)=>{const n=s.get(e);return n?this._cleanFloor(n,i,t).area:void 0},t:(e,t)=>this._t(e,t),toast:e=>this._showToast(e),close:()=>{this._pdfDialog=!1,this.requestUpdate()}})}_preflightDiagnostics(e,t){return this._editorRuntimeOrThrow()._preflightDiagnostics(e,t)}_reportPreflightFailure(e,t){return this._editorRuntimeOrThrow()._reportPreflightFailure(e,t)}_preflightVersionsDiffer(){return this._editorRuntimeOrThrow()._preflightVersionsDiffer()}async _copyPreflightDiagnostics(){return this._editorRuntimeOrThrow()._copyPreflightDiagnostics()}_checkOptimizeGeometry(e){return this._editorRuntimeOrThrow()._checkOptimizeGeometryImpl(e)}_checkSpacePhysicalGeometry(e,t,i){return this._editorRuntimeOrThrow()._checkSpacePhysicalGeometryImpl(e,t,i)}_optimizeReferenceContext(e){return this._editorRuntimeOrThrow()._optimizeReferenceContext(e)}_previewAlignDialog(e){return this._editorRuntimeOrThrow()._previewAlignDialog(e)}async _runAlignToGrid(){return this._editorRuntimeOrThrow()._runAlignToGrid()}async _undoPlanOptimization(){return this._editorRuntimeOrThrow()._undoPlanOptimization()}async _runBackupExport(){return this._editorRuntimeOrThrow()._runBackupExport()}async _pickBackupImport(e){return this._editorRuntimeOrThrow()._pickBackupImport(e)}async _setBackupDuplicatePolicy(e){return this._editorRuntimeOrThrow()._setBackupDuplicatePolicy(e)}async _applyBackupImport(){return this._editorRuntimeOrThrow()._applyBackupImport()}_renderBackupExportDialog(){return this._editorRuntimeOrThrow()._renderBackupExportDialog()}_renderBackupImportDialog(){return this._editorRuntimeOrThrow()._renderBackupImportDialog()}_setFillColor(e,t){return this._editorRuntimeOrThrow()._setFillColor(e,t)}async _saveSettingsDialog(){return this._editorRuntimeOrThrow()._saveSettingsDialog()}_boolInput(e,t,i=!1){return this._editorRuntimeOrThrow()._boolInput(e,t,i)}_rangeInput(e,t,i,n,r,o=!1,s){return this._editorRuntimeOrThrow()._rangeInput(e,t,i,n,r,o,s)}_renderColorRow(e,t){return this._editorRuntimeOrThrow()._renderColorRow(e,t)}get _glowRadiusCm(){const e=Number(this._settings.glow_radius_cm);return Number.isFinite(e)&&e>0?e:300}get _imperial(){return"mi"===this.hass?.config?.unit_system?.length}get _glowRadiusPlaceholder(){const e=this._glowRadiusCm;return this._imperial?String(Math.round(e/30.48*10)/10):String(e/100)}_glowTransition(e,t){return Tm(this._glowRuntimeState,this._glowRuntimeHost,e,t)}_forgetGlowSource(e){Dm(this._glowRuntimeState,this._glowRuntimeHost,e)}_forgetGlowSpace(e){Am(this._glowRuntimeState,this._glowRuntimeHost,e)}_warnGlowGeometryFallback(e,t,i,n){zm(this._glowRuntimeState,e,t,i,n)}_lightBarriers(e,t){const i=Sm({rawSpaceConfig:this._curSpaceCfg,space:e,openings:this._openingsR,cellCm:this._cellCm,gridPitch:this._gridPitch,openingAmount:e=>this._openingAmt(e)}),n=`${e.id}|${i.fingerprint}`,r=$f(this._lightBarrierPool,n);if(r.hit)return this._lightBarrierCache=r.value,r.value.value;const o=$m({space:e,revision:i,walls:this._spaceWalls,zeroWalls:this._zeroWalls(),wallKeyPitch:this._wallKeyPitch,cellCm:this._cellCm,gridPitch:this._gridPitch,coordScale:_v,sharedWallGeometry:this._wallUnionGeometry(),physicalBodies:(t,i)=>(this._lightPhysicalBodiesCache?.key!==i&&(this._lightPhysicalBodiesCache={key:i,all:Da(e,this._cellCm,this._gridPitch,2e-4*this._gridPitch,t).all}),this._lightPhysicalBodiesCache.all)}),s={key:n,value:o};return Mf(this._lightBarrierPool,n,s,8),this._lightBarrierCache=s,o}_renderGlowLayer(e,t,i=this._viewOr(this._baseVb())){const n=this._fillColors,r=this._glowRadiusCm/this._cellCm*this._gridPitch,o=e.rooms.map(e=>({r:e,poly:ni(e)})).filter(e=>!!e.poly),s=o.filter(({r:e})=>Bn(t.glow,e));if(!s.length)return this._forgetGlowSpace(e.id),W``;const a=this._lightBarriers(e,o),l=xm({hass:this._renderPlanHass,devices:this._renderDevices,virtualLights:this._virtualLights,spaceId:e.id,defaultColor:n.glow_light.c,paletteAlpha:n.glow_light.a,defaultRadiusUnits:r,cellCm:this._cellCm,gridPitch:this._gridPitch,position:e=>this._pos(e)}),c=[],h=new Set;for(const t of l){const{key:i,pos:n}=t;if(h.add(i),Rm(n,a)){this._forgetGlowSource(i);continue}const r=this._glowTransition(i,!!t.appearance);if(!r)continue;t.appearance&&this._glowLastAppearance.set(i,t.appearance);const s=this._glowLastAppearance.get(i);if(!s)continue;let l=null;const d=`${e.id}|${a.fingerprint}|${n.x.toFixed(4)},${n.y.toFixed(4)}|${t.radius.toFixed(4)}`,u=wm(this._glowRuntimeState,d);u.hit?l=u.value:(l=Mm({spaceId:e.id,source:n,radius:t.radius,scene:a,polygons:o.map(({r:e,poly:t})=>({room:e,poly:t})),onBoundsFailure:(t,i)=>this._warnGlowGeometryFallback(e.id,a.fingerprint,t,i)}),km(this._glowRuntimeState,d,l)),c.push({key:i,sourceEid:t.sourceEid,domId:r.domId,entering:r.entering,leaving:r.leaving,pos:n,c:s.c,alpha:s.alpha,geometry:l,r:t.radius})}if(Pm(this._glowRuntimeState,this._glowRuntimeHost,e.id,h),!c.length)return W``;const d=this._spaceWalls,u=s.length===o.length?[]:this._openCuts(),p=this._wallUnionGeometry()?.roomGeom,_=s.length===o.length?null:s.map(({r:t,poly:i})=>{const n=d.length&&t.id&&this._innerRoomContour(e,t.id,u,p)||i,r=this._cleanFloor(t,n,e).path,s=Ri(n,o.filter(e=>e.r!==t).map(e=>e.poly)),a=e=>"M "+e.map(e=>e[0]+" "+e[1]).join(" L ")+" Z";return[r||a(n),...s.map(a)].join(" ")}),m=this._stageEl?.clientWidth&&i.w?this._stageEl.clientWidth/i.w:1,g=!this._pinchStart&&!this._panStart&&!this._cameraTransition.active,f=Im(this._glowRuntimeState,m,g);return Om({spots:c,enabledClip:_,feather:f.feather,featherEnabled:f.enabled,screenBlend:this._glowScreenBlend})}_renderAlignDialog(){return this._editorRuntimeOrThrow()._renderAlignDialog()}_renderSettingsDialog(){return this._editorRuntimeOrThrow()._renderSettingsDialog()}_renderSupportDialog(){return this._editorRuntimeOrThrow()._renderSupportDialog()}_rulesSet(e){return this._editorRuntimeOrThrow()._rulesSet(e)}async _saveRules(){return this._editorRuntimeOrThrow()._saveRules()}_renderRulesDialog(){return this._editorRuntimeOrThrow()._renderRulesDialog()}_saveKioskScale(e){this._summary?.saveScale(e)}_renderKioskDialog(){const e=this._kioskScale,t=(t,i)=>{const n=Math.round(100*e[t]);return j`
{const i=Number(e.target.value);Number.isFinite(i)&&this._saveKioskScale({[t]:i/100})}} aria-label=${i} /> @@ -535,7 +535,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 .request=${this._dangerConfirm.request} .token=${this._dangerConfirm.token} @hp-confirm-decision=${this._onDangerConfirmDecision}> - `:G}_renderRoot(e){return j`${e}${this._renderVersionBanner()}${this._renderDangerConfirm()}`}render(){const e=this._renderBody();return e===G?e:this._renderRoot(e)}_renderBody(){if(!this._config||!this.hass)return G;const e=this._terminalFrame;if(this._terminalFrame=0,1===e)return U;const t=this._syncDangerConfirmLocaleGate();if("cold"===t)return mp();if("warm"===t)return U;const i=!!this._importDialog||!(!this._spaceDialog||!this._spaceDialogUsesOnboardingRuntime(this._spaceDialog.mode)),n="view"!==this._mode||!!(this._roomDialog||this._mergeDialog||this._openingDialog||this._physicalDialog||this._partitionDeleteDialog||this._roomDeleteDialog||this._decorTextDialog||this._decorShapeDialog||this._backdropDialog||this._decorEraseConfirm||this._spaceDialog&&!this._spaceDialogUsesOnboardingRuntime(this._spaceDialog.mode)||this._deviceInbox||this._markerDialog||this._rulesDialog||this._settingsDialog||this._supportDialog||this._alignDialog||this._backupExportDialog||this._backupImportDialog||this._kioskDialog||this._vacFit||this._vacCalConfirm);i&&!this._onboardingRuntime&&this._ensureOnboardingRuntime(),n&&!this._editorRuntime&&this._ensureEditorRuntime();const r=this._model,o=this._renderLife.diagnostics(this.hass,this._markers,e=>this._bindingStatus(e)),s=this._fixedFloorState(r);if("pending"===s.kind)return j` + `:G}_renderRoot(e){return j`${e}${this._renderVersionBanner()}${this._renderDangerConfirm()}`}render(){const e=this._renderBody();return e===G?e:this._renderRoot(e)}_renderBody(){if(!this._config||!this.hass)return G;const e=this._terminalFrame;if(this._terminalFrame=0,1===e)return U;const t=this._syncDangerConfirmLocaleGate();if("cold"===t)return up();if("warm"===t)return U;const i=!!this._importDialog||!(!this._spaceDialog||!this._spaceDialogUsesOnboardingRuntime(this._spaceDialog.mode)),n="view"!==this._mode||!!(this._roomDialog||this._mergeDialog||this._openingDialog||this._physicalDialog||this._partitionDeleteDialog||this._roomDeleteDialog||this._decorTextDialog||this._decorShapeDialog||this._backdropDialog||this._decorEraseConfirm||this._spaceDialog&&!this._spaceDialogUsesOnboardingRuntime(this._spaceDialog.mode)||this._deviceInbox||this._markerDialog||this._rulesDialog||this._settingsDialog||this._supportDialog||this._alignDialog||this._backupExportDialog||this._backupImportDialog||this._kioskDialog||this._vacFit||this._vacCalConfirm);i&&!this._onboardingRuntime&&this._ensureOnboardingRuntime(),n&&!this._editorRuntime&&this._ensureEditorRuntime();const r=this._model,o=this._renderLife.diagnostics(this.hass,this._markers,e=>this._bindingStatus(e)),s=this._fixedFloorState(r);if("pending"===s.kind)return j` ${this.panelHost?G:j`
${this._config.title||this._t("card.title")}
`} @@ -578,7 +578,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 ${this._spaceDialog&&(this._onboardingRuntime||this._editorRuntime)?this._renderSpaceDialog():G} ${this._importDialog&&this._onboardingRuntime?this._renderImportDialog():G} ${this._toast?j``:G} -
`;const a=this._spaceModel();if(!a)return G;const l="valid"===s.kind?[a]:r,c=a.vb;let h=this._effectiveProjection();this._renderProjection=h,this._labs.active.length&&function(){const e=Nf,t=e.alpha?e.active.join(","):"";if(!t||t===Lf)return;Lf=t;const i=new Map(Ff.map(e=>[e.id,e])),n=e.active.map(e=>`${e} (#${i.get(e).issue})`).join(", ");console.info(`HOUSEPLAN ALPHA: hp_alpha=1; ${n}`)}();let d="iso"===h;const u=d?this._isoSceneRuntime:null,p="devices"===this._mode&&this._showAll,_=this._renderDevices.filter(e=>e.space===a.id&&(!e.hidden||p)),m=this._renderDeviceSnapshot,g=this._spaceDisplayForRender(),f=this._resolvedRoomFills(a,g),v=this._resolvedGlowBase(a,g,f),y=g.showLqi??this._config.show_signal??!0,b=this._config.icon_size??2.5,w=b>8?2.5:b,k=M_(w);let x=d?this._renderIsoScene:null,S=this._viewOr(this._baseVb(h,x)),$=null;try{$=u?.resolveIsoFramePresentation({projection:h,display:g,scene:x,openings:this._openingsR,amountOf:e=>this._openingAmt(e),cellCm:this._cellCm,overlays:e=>this._isoOverlayScene(a,_,S,g,e,x,w,k,y)})??null}catch(e){this._latchIsoFallback(g.showBorders?x?.key||this._isoInvalidKey():`${a.id}|no-borders`,e),this._cancelCameraTransition(!1),h="flat",d=!1,x=null,$=null,this._renderProjection="flat",this._renderIsoScene=null,this._isoProjectionSnapshot="flat",this._view=null,this._viewModeSnap=null,S=this._viewOr(this._baseVb("flat",null))}const M=$?.layers??null,R=$?.overlays??null,C=this._editing?"":this._stageBg(g),T=this._opMeasureView,D="view"===this._mode?this._editorChromeMode:this._mode,A=this._roomHoverPaths(a),P=a.bg?this._display(a.bg.href):"",F=this._continuity.overlayVisible||"recovery-error"===this._continuity.state?this._continuity.recoveryReason:null,z=this._modeTransitionVisual,I=this._dayCycleState(),O=z?.viewWeight??("view"===this._mode?1:0),E=this._paperShapes(a.rooms),N=this._modeTransition.state?.from.presentedMode,H=!this._markup||!!z&&("view"===z.presentedMode||"devices"===z.presentedMode||"view"===N||"devices"===N),L=z?.stageColor||C,B=z?.sceneBrightness??1;return j` +
`;const a=this._spaceModel();if(!a)return G;const l="valid"===s.kind?[a]:r,c=a.vb;let h=this._effectiveProjection();this._renderProjection=h,this._labs.active.length&&function(){const e=If,t=e.alpha?e.active.join(","):"";if(!t||t===Ef)return;Ef=t;const i=new Map(Df.map(e=>[e.id,e])),n=e.active.map(e=>`${e} (#${i.get(e).issue})`).join(", ");console.info(`HOUSEPLAN ALPHA: hp_alpha=1; ${n}`)}();let d="iso"===h;const u=d?this._isoSceneRuntime:null,p="devices"===this._mode&&this._showAll,_=this._renderDevices.filter(e=>e.space===a.id&&(!e.hidden||p)),m=this._renderDeviceSnapshot,g=this._spaceDisplayForRender(),f=this._resolvedRoomFills(a,g),v=this._resolvedGlowBase(a,g,f),y=g.showLqi??this._config.show_signal??!0,b=this._config.icon_size??2.5,w=b>8?2.5:b,k=x_(w);let x=d?this._renderIsoScene:null,S=this._viewOr(this._baseVb(h,x)),$=null;try{$=u?.resolveIsoFramePresentation({projection:h,display:g,scene:x,openings:this._openingsR,amountOf:e=>this._openingAmt(e),cellCm:this._cellCm,overlays:e=>this._isoOverlayScene(a,_,S,g,e,x,w,k,y)})??null}catch(e){this._latchIsoFallback(g.showBorders?x?.key||this._isoInvalidKey():`${a.id}|no-borders`,e),this._cancelCameraTransition(!1),h="flat",d=!1,x=null,$=null,this._renderProjection="flat",this._renderIsoScene=null,this._isoProjectionSnapshot="flat",this._view=null,this._viewModeSnap=null,S=this._viewOr(this._baseVb("flat",null))}const M=$?.layers??null,R=$?.overlays??null,C=this._editing?"":this._stageBg(g),T=this._opMeasureView,D="view"===this._mode?this._editorChromeMode:this._mode,A=this._roomHoverPaths(a),P=a.bg?this._display(a.bg.href):"",F=this._continuity.overlayVisible||"recovery-error"===this._continuity.state?this._continuity.recoveryReason:null,z=this._modeTransitionVisual,I=this._dayCycleState(),O=z?.viewWeight??("view"===this._mode?1:0),E=this._paperShapes(a.rooms),N=this._modeTransition.state?.from.presentedMode,H=!this._markup||!!z&&("view"===z.presentedMode||"devices"===z.presentedMode||"view"===N||"devices"===N),L=z?.stageColor||C,B=z?.sceneBrightness??1;return j`
@@ -918,16 +918,16 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 `:G} ${this._toast?j``:G} - `;var q}_vacCandidateStatus(e,t,i=this._planHass){const n=this._bindingStatus("entity:"+e);if("ha_disabled"===n.kind)return"disabled";if("orphaned"===n.kind)return"missing";if("unverified"===n.kind)return"unverified";const r=i?.states?.[e];return"unavailable"===r?.state?"unavailable":t?.hasPosition?"ok":"unsupported"}_vacOpenAllCameras(e){const t=this._haRegistry.entities||{},i=[];for(const[e,n]of Object.entries(this.hass?.states||{})){if(!e.startsWith("camera."))continue;const r=Xc(e,n,t[e]);r&&i.push(r)}this._vacAllCameraCache={devId:e.id,candidates:i},this._vacAllCamerasFor=e.id}_vacSourceResolution(e,t=!1,i=this._planHass){const n=e.marker?.vacuum,r="string"==typeof n?.source&&!!n.source,o=new Set(e.entities||[]),s=new Set(o);r&&s.add(n.source);const a=i?.entities||{},l=[];for(const e of s){const t=i?.states?.[e],o=Xc(e,t,a[e]);o?l.push(o):r&&e===n.source&&l.push({entityId:e,name:String(t?.attributes?.friendly_name||e),platform:a[e]?.platform?String(a[e].platform):null,category:e.startsWith("camera.")?"camera":"partial",hasPosition:!1,hasRooms:!1,hasPath:!1,hasMapId:!1,score:0})}if(t&&this._vacAllCameraCache?.devId===e.id){const e=new Set(l.map(e=>e.entityId));for(const t of this._vacAllCameraCache.candidates)e.has(t.entityId)||l.push(t)}const c={};for(const e of l)c[e.entityId]=this._vacCandidateStatus(e.entityId,e,i);return function(e,t,i,n){const r="string"==typeof e&&e.length>0,o=new Set(t),s=Array.from(i).sort((t,i)=>r&&t.entityId===e?-1:r&&i.entityId===e?1:i.score-t.score||t.entityId.localeCompare(i.entityId));if(r){const t=s.find(t=>t.entityId===e);return{entityId:e,status:n[e]||(t?.hasPosition?"ok":"unverified"),pinned:!0,candidates:s}}const a=s.find(e=>o.has(e.entityId)&&e.hasPosition&&"ok"===n[e.entityId]);return a?{entityId:a.entityId,status:"ok",pinned:!1,candidates:s}:{entityId:null,status:"none",pinned:!1,candidates:s}}(n?.source,o,l,c)}_vacSource(e,t=this._planHass){if(!1===e.marker?.vacuum?.live)return null;const i=this._vacSourceResolution(e,!1,t);return"ok"===i.status||"unsupported"===i.status?i.entityId:null}_vacEntity(e){return e.primary?.startsWith("vacuum.")?e.primary:(e.entities||[]).find(e=>e.startsWith("vacuum."))||null}_isVacDev(e){return!!this._vacEntity(e)}_activitySourceKey(e){return this._activitySnapshot(e).sourceKey}_activitySnapshot(e,t=Ld(this._planHass,this._devices,null,this._virtualLights)){const i=d_(this._planHass,e,this._devices,t,this._fullRegistryHass);return{samples:i.samples,sourceKey:__(this._planHass,e,i)}}_stampActivity(e,t,i){let n=this._activityRt.get(e);n||(n=og(i||"",[]),this._activityRt.set(e,n)),null!=i&&(n.sources=i),ag(n,t,Date.now(),window.clearTimeout.bind(window),e=>window.setTimeout(()=>this.requestUpdate(),e))}_syncActivityRuntime(){const e=new Map;if(!this.hass)return e;if(!1===this._config?.live_states){for(const e of this._activityRt.values())clearTimeout(e.timer);return this._activityRt.clear(),e}const t=new Set,i=Ld(this._planHass,this._devices,null,this._virtualLights);for(const n of this._devices){if(n.hidden)continue;if("icon_ripple"!==qi(n.marker?.display))continue;t.add(n.id);const r=this._activitySnapshot(n,i);e.set(n.id,r);const{samples:o,sourceKey:s}=r;let a=this._activityRt.get(n.id);a?a.sources!==s&&sg(a,s,o,window.clearTimeout.bind(window)):(a=og(s,o),this._activityRt.set(n.id,a))}for(const[e,i]of this._activityRt)t.has(e)||(clearTimeout(i.timer),this._activityRt.delete(e));return e}_activityTick(){if(!this.hass)return;const e=this._syncActivityRuntime();for(const t of this._devices){if(t.hidden)continue;if("icon_ripple"!==qi(t.marker?.display))continue;const i=e.get(t.id)||this._activitySnapshot(t),{samples:n,sourceKey:r}=i,o=this._activityRt.get(t.id);if(!o||o.sources!==r)continue;const s=lg(o,n,window.clearTimeout.bind(window));s&&this._stampActivity(t.id,s,r)}}_vacTick(){if(this.hass)for(const e of this._devices){if(e.hidden||!this._isVacDev(e))continue;if(Bi(qi(e.marker?.display))){this._vacRt.delete(e.id);continue}const t=this._vacSource(e);if(!t)continue;const i=this._vacEntity(e),n=th(this.hass.states[i||""]?.state),r=Vc(this.hass.states[t]?.attributes);let o=this._vacRt.get(e.id);o||(o={trail:[],lastKey:"",lastTs:0,moving:!1,jump:!1,endedTs:0,lastPos:null},this._vacRt.set(e.id,o)),n&&!o.moving&&(o.trail=[],o.lastPos=null);const s="never"!==ah(e.marker?.vacuum)&&!r?.path.length;!n&&o.moving&&(o.endedTs=Date.now(),s&&o.lastPos&&(o.trail=eh(o.trail,o.lastPos,40)),o.lastPos=null),o.moving=n;const a=r?.pos;if(n&&a){const e=a.x+":"+a.y;if(e!==o.lastKey){const t=Date.now();o.jump=o.lastTs>0&&t-o.lastTs>1e4,o.lastKey=e,o.lastTs=t,s&&o.lastPos&&(o.trail=eh(o.trail,o.lastPos,40)),o.lastPos=[a.x,a.y]}}}}_vacEnsureMarker(e){const t=this._serverCfg;if(!t)return null;t.markers=t.markers||[];const i=t.markers.find(t=>t.id===e.id);if(i)return i;if("device"!==e.bindingKind&&"entity"!==e.bindingKind||!e.bindingRef)return null;const n={id:e.id,binding:e.bindingKind+":"+e.bindingRef,space:e.space||null,area:e.area||null,hidden:!!e.hidden};return t.markers.push(n),n}_renderVacSection(e){return this._editorRuntimeOrThrow()._renderVacSection(e)}_vacMapId(e,t,i=this._planHass){const n=this._vacEntity(e),r=n?i?.states?.[n]?.attributes?.selected_map:null;return o=t.mapId,s=r,"default"!==o?o:null!=s?String(s):"default";var o,s}_vacObservedMapId(e,t,i=this._planHass){const n=Vc(i?.states?.[t]?.attributes);return n?this._vacMapId(e,n,i):void 0}_vacSaveMatrix(e,t,i,n,r=""){return this._editorRuntimeOrThrow()._vacSaveMatrix(e,t,i,n,r)}_vacPlanRoomAnchors(e){return this._editorRuntimeOrThrow()._vacPlanRoomAnchors(e)}_vacAutoCalibrate(e){return this._editorRuntimeOrThrow()._vacAutoCalibrate(e)}_vacApplyCalibrationProposal(e){return this._editorRuntimeOrThrow()._vacApplyCalibrationProposal(e)}_vacStartFit(e){return this._editorRuntimeOrThrow()._vacStartFit(e)}_vacFitSave(){return this._editorRuntimeOrThrow()._vacFitSave()}_vacFitTurn(e){return this._editorRuntimeOrThrow()._vacFitTurn(e)}_vacGhostCentre(e){return this._editorRuntimeOrThrow()._vacGhostCentre(e)}_vacDelta(e,t,i){return this._editorRuntimeOrThrow()._vacDelta(e,t,i)}_vacFitPointer(e,t){return this._editorRuntimeOrThrow()._vacFitPointer(e,t)}_renderVacFit(e){return this._editorRuntime?this._editorRuntimeOrThrow()._renderVacFit(e):G}_vacRafLoop(){this._vacRaf=requestAnimationFrame(()=>{const e=this.renderRoot,t=this._stageEl,i=this._vacLastView,n=e?.querySelectorAll?.(".vacpuck")||[];if(!t||!i||!n.length)return void(this._vacRaf=0);const r=t.getBoundingClientRect();for(const t of n){const n=t.getAttribute("data-mid"),o=t.getBoundingClientRect(),s=i.x+(o.left+o.width/2-r.left)/r.width*i.w,a=i.y+(o.top+o.height/2-r.top)/r.height*i.h;for(const t of e.querySelectorAll(`line.tip[data-mid="${n}"]`))t.setAttribute("x2",s.toFixed(1)),t.setAttribute("y2",a.toFixed(1))}this._vacRafLoop()})}_vacTrailPathD(e,t){const i=e.map(e=>e.map(([e,i])=>Oc(t,e,i))),n=function(e,t,i=console.warn){if(!Number.isFinite(t)||t<=0)return[];const n=[];let r=0;for(const i of e){if(!i.every(Uc)){r++;continue}const e=i.filter((e,t)=>0===t||!Gc(e,i[t-1]));if(e.length<2)continue;const o=[{kind:"move",point:e[0]}];if(2!==e.length){for(let i=1;i0&&i(`[houseplan] vacuum trail: ${r} segment(s) dropped — non-finite point (check map calibration)`),n}(i,this._cmToUnits(17.5)),r=e=>{const t=this._scenePoint(e);return`${t[0].toFixed(1)} ${t[1].toFixed(1)}`};return n.map(e=>e.map(e=>"move"===e.kind?`M ${r(e.point)}`:"line"===e.kind?`L ${r(e.point)}`:`Q ${r(e.control)} ${r(e.point)}`).join(" ")).join(" ")}_renderVacuums(e,t,i){if(this._markup||"decor"===this._mode)return G;const n=this._space+"|"+t.x+"|"+t.y+"|"+t.w+"|"+t.h,r=this._vacJumpOnce||n!==this._vacViewKey;this._vacViewKey=n,this._vacJumpOnce=!1;const o=[],s=[];for(const n of e){if(n.hidden||!this._isVacDev(n))continue;if(Bi(qi(n.marker?.display)))continue;const e=this._renderDeviceSnapshot?.facts.get(`vacuum:${n.id}`),a=e?.source??this._vacSource(n,this._renderPlanHass);if(!a)continue;const l=e?.telemetry??Vc(this._renderPlanHass?.states[a]?.attributes);if(!l)continue;const c=e?.routes??dh(n.id,n.marker?.vacuum??null,n.space,a),h=e?.resolution??ph({routes:c,observed:_h(c,[a],e=>this._vacObservedMapId(n,e)),spaceIds:new Set(this._model.map(e=>e.id))}),d=e?.server??this._vacSrvTrails[n.id],u=gh({resolution:h,routes:c,renderSpace:i,rootSource:n.marker?.vacuum?.source??null,serverCurrent:d?.current??null,serverPrevious:d?.previous??null,explicitRoutes:Array.isArray(n.marker?.vacuum?.map_routes)});if(!u.live&&!u.previous)continue;const p=u.live,_=e?.runtime??this._vacRt.get(n.id),m=_?.moving??!1,g=ah(n.marker?.vacuum),f="always"===g||"cleaning"===g&&m,v=d,y=u.currentRunMatches&&Array.isArray(v?.current?.points)?v.current:null,b=u.previous&&Array.isArray(v?.previous?.points)?v.previous:null;if("always"===g&&b&&u.previous){const e=qc(b.points),t=this._vacTrailPathD(e,u.previous);t&&s.push(W``)}if(f&&p){const e=jc(l,y,_?.trail||[]),t=!m||"integration"!==e.source&&"server"!==e.source?e.path:Wc(e.path);if(t.length){const e=this._vacTrailPathD(t,p);e&&s.push(W``);const i=t[t.length-1];if(m&&i?.length>=2){const e=i[i.length-1],[t,r]=Oc(p,e[0],e[1]),o=this._scenePoint([t,r]),a=o[0].toFixed(1),l=o[1].toFixed(1);s.push(W``)}}}if(!m||!l.pos||!p)continue;const[w,k]=Oc(p,l.pos.x,l.pos.y),x=this._scenePoint([w,k]),S=(x[0]-t.x)/t.w*100,$=(x[1]-t.y)/t.h*100,M=_&&_.lastTs>0&&Date.now()-_.lastTs>6e4,R=n.marker?.icon||n.icon||"mdi:robot-vacuum";o.push(j`
e.entityId));for(const t of this._vacAllCameraCache.candidates)e.has(t.entityId)||l.push(t)}const c={};for(const e of l)c[e.entityId]=this._vacCandidateStatus(e.entityId,e,i);return function(e,t,i,n){const r="string"==typeof e&&e.length>0,o=new Set(t),s=Array.from(i).sort((t,i)=>r&&t.entityId===e?-1:r&&i.entityId===e?1:i.score-t.score||t.entityId.localeCompare(i.entityId));if(r){const t=s.find(t=>t.entityId===e);return{entityId:e,status:n[e]||(t?.hasPosition?"ok":"unverified"),pinned:!0,candidates:s}}const a=s.find(e=>o.has(e.entityId)&&e.hasPosition&&"ok"===n[e.entityId]);return a?{entityId:a.entityId,status:"ok",pinned:!1,candidates:s}:{entityId:null,status:"none",pinned:!1,candidates:s}}(n?.source,o,l,c)}_vacSource(e,t=this._planHass){if(!1===e.marker?.vacuum?.live)return null;const i=this._vacSourceResolution(e,!1,t);return"ok"===i.status||"unsupported"===i.status?i.entityId:null}_vacEntity(e){return e.primary?.startsWith("vacuum.")?e.primary:(e.entities||[]).find(e=>e.startsWith("vacuum."))||null}_isVacDev(e){return!!this._vacEntity(e)}_activitySourceKey(e){return this._activitySnapshot(e).sourceKey}_activitySnapshot(e,t=Ed(this._planHass,this._devices,null,this._virtualLights)){const i=l_(this._planHass,e,this._devices,t,this._fullRegistryHass);return{samples:i.samples,sourceKey:d_(this._planHass,e,i)}}_stampActivity(e,t,i){let n=this._activityRt.get(e);n||(n=ig(i||"",[]),this._activityRt.set(e,n)),null!=i&&(n.sources=i),rg(n,t,Date.now(),window.clearTimeout.bind(window),e=>window.setTimeout(()=>this.requestUpdate(),e))}_syncActivityRuntime(){const e=new Map;if(!this.hass)return e;if(!1===this._config?.live_states){for(const e of this._activityRt.values())clearTimeout(e.timer);return this._activityRt.clear(),e}const t=new Set,i=Ed(this._planHass,this._devices,null,this._virtualLights);for(const n of this._devices){if(n.hidden)continue;if("icon_ripple"!==qi(n.marker?.display))continue;t.add(n.id);const r=this._activitySnapshot(n,i);e.set(n.id,r);const{samples:o,sourceKey:s}=r;let a=this._activityRt.get(n.id);a?a.sources!==s&&ng(a,s,o,window.clearTimeout.bind(window)):(a=ig(s,o),this._activityRt.set(n.id,a))}for(const[e,i]of this._activityRt)t.has(e)||(clearTimeout(i.timer),this._activityRt.delete(e));return e}_activityTick(){if(!this.hass)return;const e=this._syncActivityRuntime();for(const t of this._devices){if(t.hidden)continue;if("icon_ripple"!==qi(t.marker?.display))continue;const i=e.get(t.id)||this._activitySnapshot(t),{samples:n,sourceKey:r}=i,o=this._activityRt.get(t.id);if(!o||o.sources!==r)continue;const s=og(o,n,window.clearTimeout.bind(window));s&&this._stampActivity(t.id,s,r)}}_vacTick(){if(this.hass)for(const e of this._devices){if(e.hidden||!this._isVacDev(e))continue;if(Bi(qi(e.marker?.display))){this._vacRt.delete(e.id);continue}const t=this._vacSource(e);if(!t)continue;const i=this._vacEntity(e),n=Jc(this.hass.states[i||""]?.state),r=Wc(this.hass.states[t]?.attributes);let o=this._vacRt.get(e.id);o||(o={trail:[],lastKey:"",lastTs:0,moving:!1,jump:!1,endedTs:0,lastPos:null},this._vacRt.set(e.id,o)),n&&!o.moving&&(o.trail=[],o.lastPos=null);const s="never"!==rh(e.marker?.vacuum)&&!r?.path.length;!n&&o.moving&&(o.endedTs=Date.now(),s&&o.lastPos&&(o.trail=Zc(o.trail,o.lastPos,40)),o.lastPos=null),o.moving=n;const a=r?.pos;if(n&&a){const e=a.x+":"+a.y;if(e!==o.lastKey){const t=Date.now();o.jump=o.lastTs>0&&t-o.lastTs>1e4,o.lastKey=e,o.lastTs=t,s&&o.lastPos&&(o.trail=Zc(o.trail,o.lastPos,40)),o.lastPos=[a.x,a.y]}}}}_vacEnsureMarker(e){const t=this._serverCfg;if(!t)return null;t.markers=t.markers||[];const i=t.markers.find(t=>t.id===e.id);if(i)return i;if("device"!==e.bindingKind&&"entity"!==e.bindingKind||!e.bindingRef)return null;const n={id:e.id,binding:e.bindingKind+":"+e.bindingRef,space:e.space||null,area:e.area||null,hidden:!!e.hidden};return t.markers.push(n),n}_renderVacSection(e){return this._editorRuntimeOrThrow()._renderVacSection(e)}_vacMapId(e,t,i=this._planHass){const n=this._vacEntity(e),r=n?i?.states?.[n]?.attributes?.selected_map:null;return o=t.mapId,s=r,"default"!==o?o:null!=s?String(s):"default";var o,s}_vacObservedMapId(e,t,i=this._planHass){const n=Wc(i?.states?.[t]?.attributes);return n?this._vacMapId(e,n,i):void 0}_vacSaveMatrix(e,t,i,n,r=""){return this._editorRuntimeOrThrow()._vacSaveMatrix(e,t,i,n,r)}_vacPlanRoomAnchors(e){return this._editorRuntimeOrThrow()._vacPlanRoomAnchors(e)}_vacAutoCalibrate(e){return this._editorRuntimeOrThrow()._vacAutoCalibrate(e)}_vacApplyCalibrationProposal(e){return this._editorRuntimeOrThrow()._vacApplyCalibrationProposal(e)}_vacStartFit(e){return this._editorRuntimeOrThrow()._vacStartFit(e)}_vacFitSave(){return this._editorRuntimeOrThrow()._vacFitSave()}_vacFitTurn(e){return this._editorRuntimeOrThrow()._vacFitTurn(e)}_vacGhostCentre(e){return this._editorRuntimeOrThrow()._vacGhostCentre(e)}_vacDelta(e,t,i){return this._editorRuntimeOrThrow()._vacDelta(e,t,i)}_vacFitPointer(e,t){return this._editorRuntimeOrThrow()._vacFitPointer(e,t)}_renderVacFit(e){return this._editorRuntime?this._editorRuntimeOrThrow()._renderVacFit(e):G}_vacRafLoop(){this._vacRaf=requestAnimationFrame(()=>{const e=this.renderRoot,t=this._stageEl,i=this._vacLastView,n=e?.querySelectorAll?.(".vacpuck")||[];if(!t||!i||!n.length)return void(this._vacRaf=0);const r=t.getBoundingClientRect();for(const t of n){const n=t.getAttribute("data-mid"),o=t.getBoundingClientRect(),s=i.x+(o.left+o.width/2-r.left)/r.width*i.w,a=i.y+(o.top+o.height/2-r.top)/r.height*i.h;for(const t of e.querySelectorAll(`line.tip[data-mid="${n}"]`))t.setAttribute("x2",s.toFixed(1)),t.setAttribute("y2",a.toFixed(1))}this._vacRafLoop()})}_vacTrailPathD(e,t){const i=e.map(e=>e.map(([e,i])=>Fc(t,e,i))),n=function(e,t,i=console.warn){if(!Number.isFinite(t)||t<=0)return[];const n=[];let r=0;for(const i of e){if(!i.every(qc)){r++;continue}const e=i.filter((e,t)=>0===t||!jc(e,i[t-1]));if(e.length<2)continue;const o=[{kind:"move",point:e[0]}];if(2!==e.length){for(let i=1;i0&&i(`[houseplan] vacuum trail: ${r} segment(s) dropped — non-finite point (check map calibration)`),n}(i,this._cmToUnits(17.5)),r=e=>{const t=this._scenePoint(e);return`${t[0].toFixed(1)} ${t[1].toFixed(1)}`};return n.map(e=>e.map(e=>"move"===e.kind?`M ${r(e.point)}`:"line"===e.kind?`L ${r(e.point)}`:`Q ${r(e.control)} ${r(e.point)}`).join(" ")).join(" ")}_renderVacuums(e,t,i){if(this._markup||"decor"===this._mode)return G;const n=this._space+"|"+t.x+"|"+t.y+"|"+t.w+"|"+t.h,r=this._vacJumpOnce||n!==this._vacViewKey;this._vacViewKey=n,this._vacJumpOnce=!1;const o=[],s=[];for(const n of e){if(n.hidden||!this._isVacDev(n))continue;if(Bi(qi(n.marker?.display)))continue;const e=this._renderDeviceSnapshot?.facts.get(`vacuum:${n.id}`),a=e?.source??this._vacSource(n,this._renderPlanHass);if(!a)continue;const l=e?.telemetry??Wc(this._renderPlanHass?.states[a]?.attributes);if(!l)continue;const c=e?.routes??lh(n.id,n.marker?.vacuum??null,n.space,a),h=e?.resolution??hh({routes:c,observed:dh(c,[a],e=>this._vacObservedMapId(n,e)),spaceIds:new Set(this._model.map(e=>e.id))}),d=e?.server??this._vacSrvTrails[n.id],u=ph({resolution:h,routes:c,renderSpace:i,rootSource:n.marker?.vacuum?.source??null,serverCurrent:d?.current??null,serverPrevious:d?.previous??null,explicitRoutes:Array.isArray(n.marker?.vacuum?.map_routes)});if(!u.live&&!u.previous)continue;const p=u.live,_=e?.runtime??this._vacRt.get(n.id),m=_?.moving??!1,g=rh(n.marker?.vacuum),f="always"===g||"cleaning"===g&&m,v=d,y=u.currentRunMatches&&Array.isArray(v?.current?.points)?v.current:null,b=u.previous&&Array.isArray(v?.previous?.points)?v.previous:null;if("always"===g&&b&&u.previous){const e=Hc(b.points),t=this._vacTrailPathD(e,u.previous);t&&s.push(W``)}if(f&&p){const e=Lc(l,y,_?.trail||[]),t=!m||"integration"!==e.source&&"server"!==e.source?e.path:Bc(e.path);if(t.length){const e=this._vacTrailPathD(t,p);e&&s.push(W``);const i=t[t.length-1];if(m&&i?.length>=2){const e=i[i.length-1],[t,r]=Fc(p,e[0],e[1]),o=this._scenePoint([t,r]),a=o[0].toFixed(1),l=o[1].toFixed(1);s.push(W``)}}}if(!m||!l.pos||!p)continue;const[w,k]=Fc(p,l.pos.x,l.pos.y),x=this._scenePoint([w,k]),S=(x[0]-t.x)/t.w*100,$=(x[1]-t.y)/t.h*100,M=_&&_.lastTs>0&&Date.now()-_.lastTs>6e4,R=n.marker?.icon||n.icon||"mdi:robot-vacuum";o.push(j`
{e.stopPropagation();const t=this._vacEntity(n);t&&this._openMoreInfo(t)}}>
`)}return this._vacLastView=t,o.length&&!this._vacRaf&&this._vacRafLoop(),o.length||s.length?j` ${s.length?W`${s}`:G} - ${o}`:G}_renderDevice(e,t,i=!0,n){const r=this._pos(e),o=n?.visualScene??this._scenePoint([r.x,r.y]),s=(o[0]-t.x)/t.w*100,a=(o[1]-t.y)/t.h*100,l=this._devicePresentation(e,i),c=[`left:${s}%`,`top:${a}%`,...x_(l)],h=l.disabledReason,d=l.haDisabled?this._t(`marker.ha_disabled_${h}`):e.userHidden?this._t("marker.hidden_ghost"):e.name,u=o_(l),p="view"===this._mode||"devices"===this._mode,_=r_([d,l.haDisabled?"":this._t(`marker.state_a11y_${u}`),"none"!==l.pulse.kind?this._t(`marker.pulse_a11y_${l.pulse.reason}`):"",l.valueFullText||l.valueText||"",Ep(l.valueBadge),null!=l.lqiText&&l.lqiBand?this._t(`marker.lqi_a11y_${l.lqiBand}`,{value:l.lqiText}):""]);return j`
this._clickDevice(t,e)} @keydown=${t=>this._keyDevice(t,e)} @@ -960,10 +960,10 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 @pointercancel=${t=>this._pointerCancel(t,e)} @lostpointercapture=${t=>this._pointerCancel(t,e)} > - ${$_(l,{newDevice:this._newIds.has(e.id),newDeviceTitle:this._t("device.new"),disabledTitle:l.haDisabled?d:""})} + ${k_(l,{newDevice:this._newIds.has(e.id),newDeviceTitle:this._t("device.new"),disabledTitle:l.haDisabled?d:""})} ${this._vacRouteBadge(e)}
`}_vacRouteBadge(e){if(!this._isVacDev(e)||e.hidden)return G;if(Bi(qi(e.marker?.display)))return G;const t=this._renderDeviceSnapshot?.facts.get(`vacuum:${e.id}`),i=function(e,t){if(!t||!e)return null;switch(e.kind){case"unmapped":case"needs_calibration":case"ambiguous":case"missing_space":return e.kind;default:return null}}(t?.resolution,this._vacRt.get(e.id)?.moving??!1);if(!i)return G;const n=this._t(`vac.route_warn_${i}`);return j` - `}_roomArea(e){const t=ni(e);if(!t)return null;const i=this._spaceModel();if(!i)return null;const n=this._spaceWalls.length&&e.id&&this._innerRoomContour(i,e.id)||t,r=this._cleanFloor(e,n),o=this._cellCm/this._gridPitch;return Jn(r.area*o*o/1e4,"mi"===this._renderPlanHass?.config?.unit_system?.length)}_roomTemp(e){const t=e.settings?.temp_source,i=cu(this._spaceModel()?.id,e);return t?au(this._renderPlanHass,t,"temp",this._markers):i?this._climate().get(i)?.temp??null:null}_roomHum(e){const t=e.settings?.hum_source,i=cu(this._spaceModel()?.id,e);return t?au(this._renderPlanHass,t,"hum",this._markers):i?this._climate().get(i)?.hum??null:null}_climate(){const e=this._serverCfg?.markers,t=this._renderPlanHass,i=this._climateCache,n=this._settings.exclude_integrations;if(i&&i.h===t&&i.r===this._iconRules&&i.mk===e&&i.ex===n)return i.m;const r=uu(t,this._iconRules,e,this._excluded);return this._climateCache={h:t,r:this._iconRules,mk:e,ex:n,m:r},r}_resetRoomDialogFields(){return this._editorRuntimeOrThrow()._resetRoomDialogFields()}_openRoomEdit(e){return this._editorRuntimeOrThrow()._openRoomEdit(e)}_roomSettingsFromDialog(){return this._editorRuntimeOrThrow()._roomSettingsFromDialog()}_saveRoomEdit(){return this._editorRuntimeOrThrow()._saveRoomEdit()}_roomSrcCandidates(){return this._editorRuntimeOrThrow()._roomSrcCandidates()}_roomSrcLabel(e){return this._editorRuntimeOrThrow()._roomSrcLabel(e)}_labelPos(e,t){const i=this._layout["rl_"+(e.id||"")];if(i&&i.s===t)return{x:i.x*fv,y:i.y*fv};const n=this._roomCenter(e),r=this._gridPitch;return{x:ll(Qt(n[0],r)),y:ll(Qt(n[1],r))}}_labelDown(e,t,i){if(this._editorRuntime)return this._editorRuntimeOrThrow()._labelDown(e,t,i)}_labelMove(e,t,i){if(this._editorRuntime)return this._editorRuntimeOrThrow()._labelMove(e,t,i)}_labelUp(e){if(this._editorRuntime)return this._editorRuntimeOrThrow()._labelUp(e)}_labelScale(e){const t=this._layout["rl_"+(e.id||"")]?.k;return"number"==typeof t&&Number.isFinite(t)?Math.min(3,Math.max(.5,t)):1}_rlResizeDown(e,t,i){return this._editorRuntimeOrThrow()._rlResizeDown(e,t,i)}_rlResizeMove(e){return this._editorRuntimeOrThrow()._rlResizeMove(e)}_rlResizeUp(){return this._editorRuntimeOrThrow()._rlResizeUp()}_renderRoomGear(e,t,i){return this._editorRuntimeOrThrow()._renderRoomGear(e,t,i)}_renderRoomLabel(e,t,i,n,r){if(!e.name&&!this._markup)return G;const o=this._labelPos(e,t.id),s=r?.visualScene??this._scenePoint([o.x,o.y]),a=(s[0]-i.x)/i.w*100,l=(s[1]-i.y)/i.h*100,c=Math.min(1,n.opacity+.25),h=this._labelScale(e),d=[];if(n.labelTemp||n.labelHum||n.labelLqi&&e.area||n.labelLight){if(n.labelTemp){const t=this._roomTemp(e);null!=t&&d.push(j`${t}°`)}if(n.labelHum){const t=this._roomHum(e);null!=t&&d.push(j`${t}%`)}if(n.labelLqi&&e.area){const t=this._roomLqi(e.area);null!=t&&d.push(j`${t}`)}if(n.labelLight){const t=(u=Ld(this._renderPlanHass,this._renderDevices,e,this._virtualLights)).length?{on:u.filter(e=>e.on).length,total:u.length}:null;if(t){const e=0===t.on?this._t("roomcard.light_off"):t.on===t.total?this._t("roomcard.light_on"):this._t("roomcard.light_partial",{on:t.on,total:t.total});d.push(j`${e}`)}}}var u;const p=!!e.area,_=!this._markup;return j`
`}_roomArea(e){const t=ni(e);if(!t)return null;const i=this._spaceModel();if(!i)return null;const n=this._spaceWalls.length&&e.id&&this._innerRoomContour(i,e.id)||t,r=this._cleanFloor(e,n),o=this._cellCm/this._gridPitch;return Jn(r.area*o*o/1e4,"mi"===this._renderPlanHass?.config?.unit_system?.length)}_roomTemp(e){const t=e.settings?.temp_source,i=su(this._spaceModel()?.id,e);return t?ru(this._renderPlanHass,t,"temp",this._markers):i?this._climate().get(i)?.temp??null:null}_roomHum(e){const t=e.settings?.hum_source,i=su(this._spaceModel()?.id,e);return t?ru(this._renderPlanHass,t,"hum",this._markers):i?this._climate().get(i)?.hum??null:null}_climate(){const e=this._serverCfg?.markers,t=this._renderPlanHass,i=this._climateCache,n=this._settings.exclude_integrations;if(i&&i.h===t&&i.r===this._iconRules&&i.mk===e&&i.ex===n)return i.m;const r=cu(t,this._iconRules,e,this._excluded);return this._climateCache={h:t,r:this._iconRules,mk:e,ex:n,m:r},r}_resetRoomDialogFields(){return this._editorRuntimeOrThrow()._resetRoomDialogFields()}_openRoomEdit(e){return this._editorRuntimeOrThrow()._openRoomEdit(e)}_roomSettingsFromDialog(){return this._editorRuntimeOrThrow()._roomSettingsFromDialog()}_saveRoomEdit(){return this._editorRuntimeOrThrow()._saveRoomEdit()}_roomSrcCandidates(){return this._editorRuntimeOrThrow()._roomSrcCandidates()}_roomSrcLabel(e){return this._editorRuntimeOrThrow()._roomSrcLabel(e)}_labelPos(e,t){const i=this._layout["rl_"+(e.id||"")];if(i&&i.s===t)return{x:i.x*_v,y:i.y*_v};const n=this._roomCenter(e),r=this._gridPitch;return{x:ll(Qt(n[0],r)),y:ll(Qt(n[1],r))}}_labelDown(e,t,i){if(this._editorRuntime)return this._editorRuntimeOrThrow()._labelDown(e,t,i)}_labelMove(e,t,i){if(this._editorRuntime)return this._editorRuntimeOrThrow()._labelMove(e,t,i)}_labelUp(e){if(this._editorRuntime)return this._editorRuntimeOrThrow()._labelUp(e)}_labelScale(e){const t=this._layout["rl_"+(e.id||"")]?.k;return"number"==typeof t&&Number.isFinite(t)?Math.min(3,Math.max(.5,t)):1}_rlResizeDown(e,t,i){return this._editorRuntimeOrThrow()._rlResizeDown(e,t,i)}_rlResizeMove(e){return this._editorRuntimeOrThrow()._rlResizeMove(e)}_rlResizeUp(){return this._editorRuntimeOrThrow()._rlResizeUp()}_renderRoomGear(e,t,i){return this._editorRuntimeOrThrow()._renderRoomGear(e,t,i)}_renderRoomLabel(e,t,i,n,r){if(!e.name&&!this._markup)return G;const o=this._labelPos(e,t.id),s=r?.visualScene??this._scenePoint([o.x,o.y]),a=(s[0]-i.x)/i.w*100,l=(s[1]-i.y)/i.h*100,c=Math.min(1,n.opacity+.25),h=this._labelScale(e),d=[];if(n.labelTemp||n.labelHum||n.labelLqi&&e.area||n.labelLight){if(n.labelTemp){const t=this._roomTemp(e);null!=t&&d.push(j`${t}°`)}if(n.labelHum){const t=this._roomHum(e);null!=t&&d.push(j`${t}%`)}if(n.labelLqi&&e.area){const t=this._roomLqi(e.area);null!=t&&d.push(j`${t}`)}if(n.labelLight){const t=(u=Ed(this._renderPlanHass,this._renderDevices,e,this._virtualLights)).length?{on:u.filter(e=>e.on).length,total:u.length}:null;if(t){const e=0===t.on?this._t("roomcard.light_off"):t.on===t.total?this._t("roomcard.light_on"):this._t("roomcard.light_partial",{on:t.on,total:t.total});d.push(j`${e}`)}}}var u;const p=!!e.area,_=!this._markup;return j`
${r.text}
`:G} `}get _measureAnchor(){return this._markup&&this._cursorPt?"draw"===this._tool&&this._path.length&&!this._contourClosed?this._path[this._path.length-1]:"split"===this._tool&&this._splitSel?.pts?.length?this._splitSel.pts[this._splitSel.pts.length-1]:null:null}_renderMeasureLabel(e){const t=this._measureAnchor,i=this._cursorPt,n=(i[0]-e.x)/e.w*100,r=(i[1]-e.y)/e.h*100,o=Un(t,i),s=Math.round(10*o)/10,a=function(e,t,i=.001){if(e.length<2||t.length<2)return!1;const n=Math.abs(t[0]-e[0]),r=Math.abs(t[1]-e[1]);if(!Number.isFinite(n)||!Number.isFinite(r)||Math.hypot(n,r)<=i)return!1;const o=Math.max(n,r,1);return n<=i*o||r<=i*o||Math.abs(n-r)<=i*o}(t,i,2e-4*this._gridPitch);return j`
- ${this._fmtLen(t,i)} · ${s}°
`}get _decorMeasure(){const e=this._decorDraft;if(!e||"decor"!==this._mode)return null;const[t,i]=e.a,[n,r]=e.b;if(Math.abs(t-n)<1e-6&&Math.abs(i-r)<1e-6)return null;const o=(t+n)/2,s=(i+r)/2;if("line"===e.kind){const t=Un(e.a,e.b);return{x:o,y:s,on45:Gn(t),text:`${this._fmtLen(e.a,e.b)} · ${Math.round(10*t)/10}°`}}const a=this._fmtLen([t,i],[n,i]),l=this._fmtLen([n,i],[n,r]);if("ellipse"===e.kind){const e=this._fmtLen([0,0],[Math.abs(n-t)/2,0]),a=this._fmtLen([0,0],[0,Math.abs(r-i)/2]);return{x:o,y:s,on45:!1,text:Math.abs(Math.abs(n-t)-Math.abs(r-i))<1e-6?`R ${e}`:`Rx ${e} × Ry ${a}`}}return{x:o,y:s,on45:!1,text:`${a} × ${l} · ${Jn(zr(Math.abs(n-t),this._cellCm,this._gridPitch)*zr(Math.abs(r-i),this._cellCm,this._gridPitch)/1e4,this._imperial)}`}}get _alignPoint(){if(this._markup){if("draw"===this._tool&&this._path.length&&!this._contourClosed&&this._cursorPt)return this._cursorPt;if("split"===this._tool&&this._splitSel?.pts?.length&&this._cursorPt)return this._cursorPt;if(this._drag?.id.startsWith("rl_")&&this._drag.moved){const e=this._drag.id.slice(3),t=this._spaceModel()?.rooms.find(t=>t.id===e);return t?(()=>{const e=this._labelPos(t,this._space);return[e.x,e.y]})():null}return null}if("devices"===this._mode&&this._deviceDrag?.moved){const e=this._devices.find(e=>e.id===this._deviceDrag.id);return e?(()=>{const t=this._livePos(e);return[t.x,t.y]})():null}if("decor"===this._mode){if(this._decorDraft)return this._decorDraft.b;if(this._decorMove){const e=this._decorList.find(e=>e.id===this._decorMove.id);if(!e)return null;const t=fv,i=this._decorH;return"line"===e.kind?[e.x1*t,e.y1*i]:[e.x*t,e.y*i]}return null}return null}_alignCandidates(){return this._editorRuntimeOrThrow()._alignCandidates()}_renderAlignGuides(){return this._editorRuntime?._renderAlignGuides()??G}_renderOpeningCenterTick(e){return this._editorRuntimeOrThrow()._renderOpeningCenterTick(e)}_renderOpeningDimensionGuides(e){return this._editorRuntimeOrThrow()._renderOpeningDimensionGuides(e)}_roomCenter(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)]}_openingAmt(e){const t=e.contact&&this._renderOpeningEntityAvailable(e.contact)?this._renderPlanHass.states[e.contact]:null;return ci(e.type,t?.state,!!e.invert,t?.attributes?.current_position)}_planEntityAvailable(e){return!!e&&(!tu(this._fullRegistryHass,e,eu(this._markers))&&"active"===this._bindingStatus("entity:"+e).kind)}_renderEntityAvailable(e){return!!e&&(!tu(this._renderPlanHass,e,eu(this._markers))&&(!!this._renderPlanHass.entities?.[e]&&!!this._renderPlanHass.states?.[e]))}_openingEntityAvailable(e){return function(e,t,i=sd(e)){return!!t&&"active"===_d(e,`entity:${t}`,i).kind}(this.hass,e,this._haRegistry)}_renderOpeningEntityAvailable(e){return t=this._renderPlanHass,!!(i=e)&&!!t?.states?.[i];var t,i}_renderOpeningPlacementPreview(){return this._editorRuntimeOrThrow()._renderOpeningPlacementPreview()}_renderOpenings(e,t){const i=t?this._openingsR.filter(e=>t.includes(e.id)):this._openingsR;if(!i.length)return W``;const n=this._spaceModel();if(!n)return W``;const r=e.color,o=this._spaceWalls,s=this._openCuts(),a=this._openingWallIndexFor(n,s).value;return W`${Re(n.id,Te(i,e=>e.id,e=>{if(e.orphanReason)return W``}get _decorMeasure(){const e=this._decorDraft;if(!e||"decor"!==this._mode)return null;const[t,i]=e.a,[n,r]=e.b;if(Math.abs(t-n)<1e-6&&Math.abs(i-r)<1e-6)return null;const o=(t+n)/2,s=(i+r)/2;if("line"===e.kind){const t=Un(e.a,e.b);return{x:o,y:s,on45:Gn(t),text:`${this._fmtLen(e.a,e.b)} · ${Math.round(10*t)/10}°`}}const a=this._fmtLen([t,i],[n,i]),l=this._fmtLen([n,i],[n,r]);if("ellipse"===e.kind){const e=this._fmtLen([0,0],[Math.abs(n-t)/2,0]),a=this._fmtLen([0,0],[0,Math.abs(r-i)/2]);return{x:o,y:s,on45:!1,text:Math.abs(Math.abs(n-t)-Math.abs(r-i))<1e-6?`R ${e}`:`Rx ${e} × Ry ${a}`}}return{x:o,y:s,on45:!1,text:`${a} × ${l} · ${Jn(zr(Math.abs(n-t),this._cellCm,this._gridPitch)*zr(Math.abs(r-i),this._cellCm,this._gridPitch)/1e4,this._imperial)}`}}get _alignPoint(){if(this._markup){if("draw"===this._tool&&this._path.length&&!this._contourClosed&&this._cursorPt)return this._cursorPt;if("split"===this._tool&&this._splitSel?.pts?.length&&this._cursorPt)return this._cursorPt;if(this._drag?.id.startsWith("rl_")&&this._drag.moved){const e=this._drag.id.slice(3),t=this._spaceModel()?.rooms.find(t=>t.id===e);return t?(()=>{const e=this._labelPos(t,this._space);return[e.x,e.y]})():null}return null}if("devices"===this._mode&&this._deviceDrag?.moved){const e=this._devices.find(e=>e.id===this._deviceDrag.id);return e?(()=>{const t=this._livePos(e);return[t.x,t.y]})():null}if("decor"===this._mode){if(this._decorDraft)return this._decorDraft.b;if(this._decorMove){const e=this._decorList.find(e=>e.id===this._decorMove.id);if(!e)return null;const t=_v,i=this._decorH;return"line"===e.kind?[e.x1*t,e.y1*i]:[e.x*t,e.y*i]}return null}return null}_alignCandidates(){return this._editorRuntimeOrThrow()._alignCandidates()}_renderAlignGuides(){return this._editorRuntime?._renderAlignGuides()??G}_renderOpeningCenterTick(e){return this._editorRuntimeOrThrow()._renderOpeningCenterTick(e)}_renderOpeningDimensionGuides(e){return this._editorRuntimeOrThrow()._renderOpeningDimensionGuides(e)}_roomCenter(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)]}_openingAmt(e){const t=e.contact&&this._renderOpeningEntityAvailable(e.contact)?this._renderPlanHass.states[e.contact]:null;return ci(e.type,t?.state,!!e.invert,t?.attributes?.current_position)}_planEntityAvailable(e){return!!e&&(!Jd(this._fullRegistryHass,e,Zd(this._markers))&&"active"===this._bindingStatus("entity:"+e).kind)}_renderEntityAvailable(e){return!!e&&(!Jd(this._renderPlanHass,e,Zd(this._markers))&&(!!this._renderPlanHass.entities?.[e]&&!!this._renderPlanHass.states?.[e]))}_openingEntityAvailable(e){return function(e,t,i=nd(e)){return!!t&&"active"===dd(e,`entity:${t}`,i).kind}(this.hass,e,this._haRegistry)}_renderOpeningEntityAvailable(e){return t=this._renderPlanHass,!!(i=e)&&!!t?.states?.[i];var t,i}_renderOpeningPlacementPreview(){return this._editorRuntimeOrThrow()._renderOpeningPlacementPreview()}_renderOpenings(e,t){const i=t?this._openingsR.filter(e=>t.includes(e.id)):this._openingsR;if(!i.length)return W``;const n=this._spaceModel();if(!n)return W``;const r=e.color,o=this._spaceWalls,s=this._openCuts(),a=this._openingWallIndexFor(n,s).value;return W`${Re(n.id,Te(i,e=>e.id,e=>{if(e.orphanReason)return W`{t.stopPropagation(),this._editOpening(e)}}> ! - `;const t=this._openingAmt(e),i=t>0&&!!e.contact&&this._renderOpeningEntityAvailable(e.contact)?"var(--hp-open)":r,n="gate"===e.type?!e.flip_v:e.flip_v,s=e.partitionHost||o.length||"gate"===e.type?this._openingFace(e,a,!!n):{ox:0,oy:0,cm:0,side:-1},l={type:e.type,length:e.rlen,angle:e.angle,amount:t,flipH:!!e.flip_h,flipV:!!e.flip_v,base:r,tone:i,cellCm:this._cellCm,gridPitch:this._gridPitch,face:s},{half:c,outlineHalf:h,hitHalf:d}=Dp(l),u=Wa(10,this._cellCm),p=Wa(12,this._cellCm);return W``;const t=this._openingAmt(e),i=t>0&&!!e.contact&&this._renderOpeningEntityAvailable(e.contact)?"var(--hp-open)":r,n="gate"===e.type?!e.flip_v:e.flip_v,s=e.partitionHost||o.length||"gate"===e.type?this._openingFace(e,a,!!n):{ox:0,oy:0,cm:0,side:-1},l={type:e.type,length:e.rlen,angle:e.angle,amount:t,flipH:!!e.flip_h,flipV:!!e.flip_v,base:r,tone:i,cellCm:this._cellCm,gridPitch:this._gridPitch,face:s},{half:c,outlineHalf:h,hitHalf:d}=Rp(l),u=Wa(10,this._cellCm),p=Wa(12,this._cellCm);return W` - ${Ip(l)} + ${Pp(l)} @@ -1026,7 +1026,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 @pointermove=${t=>this._opPointerMove(t,e)} @pointerup=${t=>this._opPointerUp(t,e)} @pointercancel=${t=>this._opPointerUp(t,e)}> - `}))}`}_renderOpeningLocks(e,t){const i=this._openingsR.filter(e=>!e.orphanReason&&("door"===e.type||"gate"===e.type)&&e.lock&&this._renderOpeningEntityAvailable(e.lock));if(!i.length)return j``;const n=this._spaceModel();if(!n)return j``;const r=this._openCuts(),o=this._openingWallIndexFor(n,r).value;return j`${i.map(i=>{const n=this._renderPlanHass.states[i.lock]?.state,r="locked"===n,s=r||["unlocked","open","opening","unlocking","locking"].includes(String(n)),a="gate"===i.type?this._openingFace(i,o,!i.flip_v):null,l=Tp({x:i.rx,y:i.ry,angle:i.angle,flipV:!!i.flip_v,gateFace:a},this._cellCm)[0],c=t?.get(String(i.id)),h=c?.visualScene??this._scenePoint(l),d=(h[0]-e.x)/e.w*100,u=(h[1]-e.y)/e.h*100;return j`
`}))}`}_renderOpeningLocks(e,t){const i=this._openingsR.filter(e=>!e.orphanReason&&("door"===e.type||"gate"===e.type)&&e.lock&&this._renderOpeningEntityAvailable(e.lock));if(!i.length)return j``;const n=this._spaceModel();if(!n)return j``;const r=this._openCuts(),o=this._openingWallIndexFor(n,r).value;return j`${i.map(i=>{const n=this._renderPlanHass.states[i.lock]?.state,r="locked"===n,s=r||["unlocked","open","opening","unlocking","locking"].includes(String(n)),a="gate"===i.type?this._openingFace(i,o,!i.flip_v):null,l=Mp({x:i.rx,y:i.ry,angle:i.angle,flipV:!!i.flip_v,gateFace:a},this._cellCm)[0],c=t?.get(String(i.id)),h=c?.visualScene??this._scenePoint(l),d=(h[0]-e.x)/e.w*100,u=(h[1]-e.y)/e.h*100;return j`
this._openingInfo=null}>${this._t("btn.close")}
- `}_renderOpeningDialog(){return this._editorRuntimeOrThrow()._renderOpeningDialog()}_gridLevels(){return this._editorRuntimeOrThrow()._gridLevels()}_renderMarkupDefs(e){return this._editorRuntimeOrThrow()._renderMarkupDefs(e)}_renderPhysicalEditorLayer(){return this._editorRuntimeOrThrow()._renderPhysicalEditorLayer()}_renderHiddenWallDiagnosticOverlay(){return this._editorRuntimeOrThrow()._renderHiddenWallDiagnosticOverlay()}_renderPlanSnapOverlay(){return this._editorRuntimeOrThrow()._renderPlanSnapOverlay()}_syncPlanSnapActiveMarker(e){return this._editorRuntimeOrThrow()._syncPlanSnapActiveMarker(e)}_syncPlanSnapConflictMarkers(e){return this._editorRuntimeOrThrow()._syncPlanSnapConflictMarkers(e)}_planSnapPhysicalSegment(e){return this._editorRuntimeOrThrow()._planSnapPhysicalSegment(e)}_drawPreviewJoinPatchD(e,t){return this._editorRuntimeOrThrow()._drawPreviewJoinPatchD(e,t)}_renderMarkupLayer(e){return this._editorRuntimeOrThrow()._renderMarkupLayer(e)}_renderActiveChainInk(){return this._editorRuntimeOrThrow()._renderActiveChainInk()}_renderPartitionDeleteDialog(){return this._editorRuntimeOrThrow()._renderPartitionDeleteDialog()}_renderRoomDeleteDialog(){return this._editorRuntimeOrThrow()._renderRoomDeleteDialog()}_renderPhysicalDialog(){return this._editorRuntimeOrThrow()._renderPhysicalDialog()}_renderMarkupBar(){return this._editorRuntimeOrThrow()._renderMarkupBar()}_renderDevicesBar(){return this._editorRuntimeOrThrow()._renderDevicesBar()}_renderDeviceInbox(){return this._editorRuntimeOrThrow()._renderDeviceInbox()}_cardEntities(e){const t=this._planHass,i=[],n=new Set,r=e=>{if(!e||n.has(e)||!t.states[e])return;const r=t.entities[e];if("config"===r?.entity_category||"diagnostic"===r?.entity_category)return;n.add(e);const o=e.split(".")[0];["light","switch","fan","humidifier","siren","input_boolean"].includes(o)?i.push({eid:e,kind:"toggle"}):["cover","valve","lock","climate","media_player","vacuum","water_heater"].includes(o)?i.push({eid:e,kind:"open"}):["sensor","binary_sensor","number","select"].includes(o)&&i.push({eid:e,kind:"value"})};for(const i of Ld(t,this._devices,null,this._virtualLights))if(i.device.id===e.id)for(const e of[...i.serviceEids,...i.stateEids])r(e);e.primary&&r(e.primary);for(const t of e.entities)r(t);return i.slice(0,12)}_cardToggle(e){const t=e.split(".")[0];"lock"!==t&&"alarm_control_panel"!==t&&this._planEntityAvailable(e)&&this.hass.callService("homeassistant","toggle",{entity_id:e}).catch(e=>this._showToast(this._t("toast.error",{err:this._errText(e)})))}_renderInfoCard(){const e=this._infoCard,t=e.primary?this.hass.states[e.primary]:void 0,i=t?Ji(this.hass,e.primary)?.text??t.state:null,n=Dg(e.marker?.radar)?e.marker.radar:null,r=n?this._radarLive.frames.get(e.marker?.id||e.id):null,o=n?function(e,t){return!0!==e.enabled?"radar.health_disabled":Pg[t||""]||"radar.health_unknown"}(n,r?.health):null,s=(e.controls??e.marker?.controls??[]).filter(Pn).filter(e=>this._planEntityAvailable(e));return j``}_renderOpeningDialog(){return this._editorRuntimeOrThrow()._renderOpeningDialog()}_gridLevels(){return this._editorRuntimeOrThrow()._gridLevels()}_renderMarkupDefs(e){return this._editorRuntimeOrThrow()._renderMarkupDefs(e)}_renderPhysicalEditorLayer(){return this._editorRuntimeOrThrow()._renderPhysicalEditorLayer()}_renderHiddenWallDiagnosticOverlay(){return this._editorRuntimeOrThrow()._renderHiddenWallDiagnosticOverlay()}_renderPlanSnapOverlay(){return this._editorRuntimeOrThrow()._renderPlanSnapOverlay()}_syncPlanSnapActiveMarker(e){return this._editorRuntimeOrThrow()._syncPlanSnapActiveMarker(e)}_syncPlanSnapConflictMarkers(e){return this._editorRuntimeOrThrow()._syncPlanSnapConflictMarkers(e)}_planSnapPhysicalSegment(e){return this._editorRuntimeOrThrow()._planSnapPhysicalSegment(e)}_drawPreviewJoinPatchD(e,t){return this._editorRuntimeOrThrow()._drawPreviewJoinPatchD(e,t)}_renderMarkupLayer(e){return this._editorRuntimeOrThrow()._renderMarkupLayer(e)}_renderActiveChainInk(){return this._editorRuntimeOrThrow()._renderActiveChainInk()}_renderPartitionDeleteDialog(){return this._editorRuntimeOrThrow()._renderPartitionDeleteDialog()}_renderRoomDeleteDialog(){return this._editorRuntimeOrThrow()._renderRoomDeleteDialog()}_renderPhysicalDialog(){return this._editorRuntimeOrThrow()._renderPhysicalDialog()}_renderMarkupBar(){return this._editorRuntimeOrThrow()._renderMarkupBar()}_renderDevicesBar(){return this._editorRuntimeOrThrow()._renderDevicesBar()}_renderDeviceInbox(){return this._editorRuntimeOrThrow()._renderDeviceInbox()}_cardEntities(e){const t=this._planHass,i=[],n=new Set,r=e=>{if(!e||n.has(e)||!t.states[e])return;const r=t.entities[e];if("config"===r?.entity_category||"diagnostic"===r?.entity_category)return;n.add(e);const o=e.split(".")[0];["light","switch","fan","humidifier","siren","input_boolean"].includes(o)?i.push({eid:e,kind:"toggle"}):["cover","valve","lock","climate","media_player","vacuum","water_heater"].includes(o)?i.push({eid:e,kind:"open"}):["sensor","binary_sensor","number","select"].includes(o)&&i.push({eid:e,kind:"value"})};for(const i of Ed(t,this._devices,null,this._virtualLights))if(i.device.id===e.id)for(const e of[...i.serviceEids,...i.stateEids])r(e);e.primary&&r(e.primary);for(const t of e.entities)r(t);return i.slice(0,12)}_cardToggle(e){const t=e.split(".")[0];"lock"!==t&&"alarm_control_panel"!==t&&this._planEntityAvailable(e)&&this.hass.callService("homeassistant","toggle",{entity_id:e}).catch(e=>this._showToast(this._t("toast.error",{err:this._errText(e)})))}_renderInfoCard(){const e=this._infoCard,t=e.primary?this.hass.states[e.primary]:void 0,i=t?Ji(this.hass,e.primary)?.text??t.state:null,n=Rg(e.marker?.radar)?e.marker.radar:null,r=n?this._radarLive.frames.get(e.marker?.id||e.id):null,o=n?function(e,t){return!0!==e.enabled?"radar.health_disabled":Tg[t||""]||"radar.health_unknown"}(n,r?.health):null,s=(e.controls??e.marker?.controls??[]).filter(Pn).filter(e=>this._planEntityAvailable(e));return j`
@@ -1101,7 +1101,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0
-
`}_markerValueBadgeFields(e){return this._editorRuntimeOrThrow()._markerValueBadgeFields(e)}_markerDraft(e){return this._editorRuntimeOrThrow()._markerDraft(e)}_markerPreviewDevice(e){return this._editorRuntimeOrThrow()._markerPreviewDevice(e)}_markerPreviewDevices(e){return this._editorRuntimeOrThrow()._markerPreviewDevices(e)}_toggleIntent(e,t=this._devices){return Ou({hass:this._planHass,registryHass:this._fullRegistryHass,devices:t,device:e,virtualLights:this._virtualLights})}_toggleIntentForDialog(e){return this._editorRuntimeOrThrow()._toggleIntentForDialog(e)}_toggleStateText(e,t){const i=this._planHass?.states?.[e]||this.hass?.states?.[e];try{return i&&"function"==typeof this.hass?.formatEntityState?this.hass.formatEntityState(i):t}catch{return t}}_toggleConfirmationStateText(e){const t=String(e.state||"unknown"),i=e.entityId?this._toggleStateText(e.entityId,t):t;if(i.trim().toLocaleLowerCase()!==t.trim().toLocaleLowerCase())return i;const n={on:"confirm.state_on",off:"confirm.state_off",open:"confirm.state_open",closed:"confirm.state_closed",opening:"confirm.state_opening",closing:"confirm.state_closing",unknown:"confirm.state_unknown"}[t];return n?this._t(n):t.replaceAll("_"," ").replaceAll("-"," ")}_toggleConfirmationLines(e){const t={"turn-on":"confirm.state_on","turn-off":"confirm.state_off",open:"confirm.state_open",close:"confirm.state_closed",stop:"confirm.state_stopped"};return function(e,t){if(!Nu(e)||!e.nextEffect||!e.targets.length)return[];const i="group"===e.kind,n=i?e.targets.filter(e=>"on"===e.state).length:0,r=i?0===n?t.groupAllOff():t.groupCurrent(n,e.targets.length):t.state(e.targets[0]);let o;return o="toggle"===e.nextEffect?t.expectedByHa():i&&"turn-on"===e.nextEffect?t.groupAllOn():i&&"turn-off"===e.nextEffect?t.groupAllOff():t.effect(e.nextEffect),[t.current(r),t.expected(o),...e.skippedTargets.length?[t.unavailable(e.skippedTargets.length)]:[]]}(e,{state:e=>this._toggleConfirmationStateText(e),current:e=>this._t("confirm.current_state",{state:e}),expected:e=>this._t("confirm.expected_state",{state:e}),groupCurrent:(e,t)=>this._t("confirm.group_current",{on:e,total:t}),groupAllOn:()=>this._t("confirm.group_all_on"),groupAllOff:()=>this._t("confirm.group_all_off"),unavailable:e=>this._t("confirm.unavailable_targets",{count:e}),effect:e=>this._t(t[e]),expectedByHa:()=>this._t("confirm.expected_by_ha")})}_toggleHintLines(e){return this._editorRuntimeOrThrow()._toggleHintLines(e)}_effectiveStoredTapAction(e,t){return this._editorRuntimeOrThrow()._effectiveStoredTapAction(e,t)}_effectiveMarkerTapAction(e,t=this._markerPreviewDevice(e)){return this._editorRuntimeOrThrow()._effectiveMarkerTapAction(e,t)}_announceToggleDraft(e){return this._editorRuntimeOrThrow()._announceToggleDraft(e)}_valueBadgeForBinding(e,t){return this._editorRuntimeOrThrow()._valueBadgeForBinding(e,t)}_markerSpatialSource(e){return this._editorRuntimeOrThrow()._markerSpatialSource(e)}_markerAutoHasSpatialSource(e){return this._editorRuntimeOrThrow()._markerAutoHasSpatialSource(e)}_setMarkerLightRole(e){return this._editorRuntimeOrThrow()._setMarkerLightRole(e)}_controlRefInfo(e){return this._editorRuntimeOrThrow()._controlRefInfo(e)}_valueBadgeCandidateLabel(e){return this._editorRuntimeOrThrow()._valueBadgeCandidateLabel(e)}_controlCandidates(e){return this._editorRuntimeOrThrow()._controlCandidates(e)}_addControlRef(e,t){return this._editorRuntimeOrThrow()._addControlRef(e,t)}_setMarkerGlowMode(e){return this._editorRuntimeOrThrow()._setMarkerGlowMode(e)}_renderMarkerDialog(){return this._editorRuntimeOrThrow()._renderMarkerDialog()}_renderSpaceDialog(){return this._onboardingRuntime&&this._spaceDialog&&this._spaceDialogUsesOnboardingRuntime(this._spaceDialog.mode)?this._onboardingRuntime._renderSpaceDialog():this._editorRuntimeOrThrow()._renderSpaceDialog()}_renderMergeDialog(){return this._editorRuntimeOrThrow()._renderMergeDialog()}_renderCardPreview(e,t,i){const n=18*e;return j`
+ `}_markerValueBadgeFields(e){return this._editorRuntimeOrThrow()._markerValueBadgeFields(e)}_markerDraft(e){return this._editorRuntimeOrThrow()._markerDraft(e)}_markerPreviewDevice(e){return this._editorRuntimeOrThrow()._markerPreviewDevice(e)}_markerPreviewDevices(e){return this._editorRuntimeOrThrow()._markerPreviewDevices(e)}_toggleIntent(e,t=this._devices){return Fu({hass:this._planHass,registryHass:this._fullRegistryHass,devices:t,device:e,virtualLights:this._virtualLights})}_toggleIntentForDialog(e){return this._editorRuntimeOrThrow()._toggleIntentForDialog(e)}_toggleStateText(e,t){const i=this._planHass?.states?.[e]||this.hass?.states?.[e];try{return i&&"function"==typeof this.hass?.formatEntityState?this.hass.formatEntityState(i):t}catch{return t}}_toggleConfirmationStateText(e){const t=String(e.state||"unknown"),i=e.entityId?this._toggleStateText(e.entityId,t):t;if(i.trim().toLocaleLowerCase()!==t.trim().toLocaleLowerCase())return i;const n={on:"confirm.state_on",off:"confirm.state_off",open:"confirm.state_open",closed:"confirm.state_closed",opening:"confirm.state_opening",closing:"confirm.state_closing",unknown:"confirm.state_unknown"}[t];return n?this._t(n):t.replaceAll("_"," ").replaceAll("-"," ")}_toggleConfirmationLines(e){const t={"turn-on":"confirm.state_on","turn-off":"confirm.state_off",open:"confirm.state_open",close:"confirm.state_closed",stop:"confirm.state_stopped"};return function(e,t){if(!Iu(e)||!e.nextEffect||!e.targets.length)return[];const i="group"===e.kind,n=i?e.targets.filter(e=>"on"===e.state).length:0,r=i?0===n?t.groupAllOff():t.groupCurrent(n,e.targets.length):t.state(e.targets[0]);let o;return o="toggle"===e.nextEffect?t.expectedByHa():i&&"turn-on"===e.nextEffect?t.groupAllOn():i&&"turn-off"===e.nextEffect?t.groupAllOff():t.effect(e.nextEffect),[t.current(r),t.expected(o),...e.skippedTargets.length?[t.unavailable(e.skippedTargets.length)]:[]]}(e,{state:e=>this._toggleConfirmationStateText(e),current:e=>this._t("confirm.current_state",{state:e}),expected:e=>this._t("confirm.expected_state",{state:e}),groupCurrent:(e,t)=>this._t("confirm.group_current",{on:e,total:t}),groupAllOn:()=>this._t("confirm.group_all_on"),groupAllOff:()=>this._t("confirm.group_all_off"),unavailable:e=>this._t("confirm.unavailable_targets",{count:e}),effect:e=>this._t(t[e]),expectedByHa:()=>this._t("confirm.expected_by_ha")})}_toggleHintLines(e){return this._editorRuntimeOrThrow()._toggleHintLines(e)}_effectiveStoredTapAction(e,t){return this._editorRuntimeOrThrow()._effectiveStoredTapAction(e,t)}_effectiveMarkerTapAction(e,t=this._markerPreviewDevice(e)){return this._editorRuntimeOrThrow()._effectiveMarkerTapAction(e,t)}_announceToggleDraft(e){return this._editorRuntimeOrThrow()._announceToggleDraft(e)}_valueBadgeForBinding(e,t){return this._editorRuntimeOrThrow()._valueBadgeForBinding(e,t)}_markerSpatialSource(e){return this._editorRuntimeOrThrow()._markerSpatialSource(e)}_markerAutoHasSpatialSource(e){return this._editorRuntimeOrThrow()._markerAutoHasSpatialSource(e)}_setMarkerLightRole(e){return this._editorRuntimeOrThrow()._setMarkerLightRole(e)}_controlRefInfo(e){return this._editorRuntimeOrThrow()._controlRefInfo(e)}_valueBadgeCandidateLabel(e){return this._editorRuntimeOrThrow()._valueBadgeCandidateLabel(e)}_controlCandidates(e){return this._editorRuntimeOrThrow()._controlCandidates(e)}_addControlRef(e,t){return this._editorRuntimeOrThrow()._addControlRef(e,t)}_setMarkerGlowMode(e){return this._editorRuntimeOrThrow()._setMarkerGlowMode(e)}_renderMarkerDialog(){return this._editorRuntimeOrThrow()._renderMarkerDialog()}_renderSpaceDialog(){return this._onboardingRuntime&&this._spaceDialog&&this._spaceDialogUsesOnboardingRuntime(this._spaceDialog.mode)?this._onboardingRuntime._renderSpaceDialog():this._editorRuntimeOrThrow()._renderSpaceDialog()}_renderMergeDialog(){return this._editorRuntimeOrThrow()._renderMergeDialog()}_renderCardPreview(e,t,i){const n=18*e;return j`
${this._t("preview.room_name")} @@ -1109,4 +1109,4 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 45% · ${this._t("roomcard.light_partial",{on:1,total:3})} -
`}_renderRoomDialog(){return this._editorRuntimeOrThrow()._renderRoomDialog()}}Sv.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}},Sv.ZOOM_MAX=8,Sv.ZOOM_MIN=1/3,Sv.styles=[hp,vg],customElements.get("houseplan-card")||customElements.define("houseplan-card",Sv),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${ov} `,"background:#3ea6ff;color:#04121f;font-weight:700","");export{Ss as $,G as A,Lp as B,Bi as C,Hi as D,U as E,Ni as F,si as G,ol as H,nl as I,ni as J,tp as K,cp as L,zs as M,Ro as N,ap as O,Qu as P,is as Q,Os as R,ip as S,ji as T,la as U,da as V,Oo as W,Mo as X,Bo as Y,A_ as Z,P_ as _,dh as a,Yl as a$,ao as a0,Zo as a1,_i as a2,Yo as a3,ko as a4,So as a5,no as a6,B_ as a7,Ka as a8,Qo as a9,le as aA,W as aB,sa as aC,Ao as aD,Fo as aE,Po as aF,Wa as aG,o as aH,he as aI,Kt as aJ,hp as aK,Mp as aL,e_ as aM,w_ as aN,x_ as aO,Ep as aP,$_ as aQ,Og as aR,wi as aS,Ur as aT,$i as aU,Mi as aV,Ut as aW,Ci as aX,U_ as aY,ql as aZ,cl as a_,rl as aa,Xo as ab,Xa as ac,Za as ad,nn as ae,rn as af,Xi as ag,Zi as ah,el as ai,Fs as aj,uc as ak,Cc as al,Ga as am,Dc as an,Va as ao,Tc as ap,wr as aq,mn as ar,yr as as,Wi as at,hn as au,Eg as av,xr as aw,fn as ax,Ac as ay,Ui as az,oh as b,Y_ as b$,Gl as b0,gs as b1,Ps as b2,ia as b3,Ls as b4,eu as b5,tu as b6,ti as b7,oi as b8,zn as b9,Qt as bA,ei as bB,Gr as bC,ba as bD,$c as bE,q_ as bF,$o as bG,qu as bH,V_ as bI,yi as bJ,mi as bK,Fi as bL,Ha as bM,Ma as bN,$a as bO,es as bP,ts as bQ,ra as bR,Rl as bS,Oa as bT,Ia as bU,Zn as bV,Jn as bW,ki as bX,bs as bY,ys as bZ,K_ as b_,Vn as ba,gm as bb,Fr as bc,_m as bd,El as be,Wl as bf,rc as bg,tl as bh,oc as bi,Jl as bj,ws as bk,oa as bl,os as bm,fa as bn,Ba as bo,j_ as bp,ya as bq,Is as br,gn as bs,br as bt,kr as bu,Oe as bv,Rp as bw,df as bx,Io as by,ll as bz,j as c,Ne as c$,Hr as c0,jr as c1,qr as c2,zr as c3,Dr as c4,Pr as c5,Er as c6,Un as c7,Tr as c8,Ar as c9,zi as cA,Cn as cB,Pu as cC,Vi as cD,qn as cE,Zd as cF,nm as cG,xo as cH,Qd as cI,Xd as cJ,dn as cK,N_ as cL,cn as cM,ln as cN,an as cO,sn as cP,Ua as cQ,Rc as cR,Mc as cS,nv as cT,Q_ as cU,G_ as cV,Or as cW,Ng as cX,uo as cY,Ee as cZ,qe as c_,tc as ca,Lr as cb,ic as cc,Xl as cd,Ul as ce,nc as cf,Ql as cg,ec as ch,cm as ci,ns as cj,Dp as ck,sp as cl,Jf as cm,op as cn,pa as co,Vf as cp,Qf as cq,F_ as cr,li as cs,np as ct,lp as cu,Di as cv,fi as cw,ai as cx,vi as cy,rs as cz,Dg as d,ua as d$,Vc as d0,Jc as d1,ah as d2,Lc as d3,Qc as d4,Kc as d5,Yc as d6,sh as d7,nh as d8,Oc as d9,Co as dA,pi as dB,nu as dC,ou as dD,il as dE,Ol as dF,Ic as dG,of as dH,sf as dI,Cp as dJ,lf as dK,uf as dL,Ml as dM,af as dN,cf as dO,Da as dP,Js as dQ,Tp as dR,Ri as dS,k_ as dT,Cf as dU,Tf as dV,mf as dW,S_ as dX,ja as dY,Wr as dZ,Ea as d_,Fc as da,jn as db,zc as dc,Wn as dd,ci as de,Kf as df,Ip as dg,Gf as dh,Tl as di,Es as dj,ds as dk,us as dl,Ie as dm,du as dn,Zp as dp,Jp as dq,su as dr,Bu as ds,Bd as dt,Ld as du,Od as dv,Pn as dw,$d as dx,Jd as dy,Tn as dz,pe as e,Ir as e0,Nr as e1,Na as e2,Pl as e3,X_ as e4,La as e5,pm as e6,Sp as e7,_p as e8,yp as e9,mp as ea,Jt as eb,$g as ec,Z_ as ed,Ji as ee,Qi as ef,Wt as eg,Sv as eh,rh as f,_n as g,g_ as h,_e as i,Xp as j,Hp as k,$p as l,Ed as m,ch as n,_h as o,Nd as p,Cd as q,ph as r,on as s,Td as t,Ru as u,Yp as v,Md as w,Xn as x,qi as y,Li as z}; +
`}_renderRoomDialog(){return this._editorRuntimeOrThrow()._renderRoomDialog()}}wv.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}},wv.ZOOM_MAX=8,wv.ZOOM_MIN=1/3,wv.styles=[ap,mg],customElements.get("houseplan-card")||customElements.define("houseplan-card",wv),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${iv} `,"background:#3ea6ff;color:#04121f;font-weight:700","");export{Ss as $,G as A,Ep as B,Bi as C,Hi as D,U as E,Ni as F,si as G,ol as H,nl as I,ni as J,Ju as K,sp as L,zs as M,Ro as N,rp as O,Xu as P,is as Q,Os as R,Qu as S,ji as T,la as U,da as V,Oo as W,Mo as X,Bo as Y,C_ as Z,T_ as _,lh as a,Vl as a$,ao as a0,Zo as a1,_i as a2,Yo as a3,ko as a4,So as a5,no as a6,N_ as a7,Ka as a8,Qo as a9,le as aA,W as aB,sa as aC,Ao as aD,Fo as aE,Po as aF,Wa as aG,o as aH,he as aI,Kt as aJ,ap as aK,xp as aL,Zp as aM,v_ as aN,b_ as aO,zp as aP,k_ as aQ,Fg as aR,wi as aS,Ur as aT,$i as aU,Mi as aV,Ut as aW,Ci as aX,q_ as aY,Ll as aZ,cl as a_,rl as aa,Xo as ab,Xa as ac,Za as ad,nn as ae,rn as af,Xi as ag,Zi as ah,el as ai,Fs as aj,cc as ak,$c as al,Ga as am,Rc as an,Va as ao,Mc as ap,wr as aq,mn as ar,yr as as,Wi as at,hn as au,zg as av,xr as aw,fn as ax,Cc as ay,Ui as az,ih as b,G_ as b$,Wl as b0,gs as b1,Ps as b2,ia as b3,Ls as b4,Zd as b5,Jd as b6,ti as b7,oi as b8,zn as b9,Qt as bA,ei as bB,Gr as bC,ba as bD,kc as bE,H_ as bF,$o as bG,Hu as bH,W_ as bI,yi as bJ,mi as bK,Fi as bL,Ha as bM,Ma as bN,$a as bO,es as bP,ts as bQ,ra as bR,Rl as bS,Oa as bT,Ia as bU,Zn as bV,Jn as bW,ki as bX,bs as bY,ys as bZ,U_ as b_,Vn as ba,pm as bb,Fr as bc,dm as bd,El as be,ql as bf,tc as bg,tl as bh,ic as bi,Yl as bj,ws as bk,oa as bl,os as bm,fa as bn,Ba as bo,L_ as bp,ya as bq,Is as br,gn as bs,br as bt,kr as bu,Oe as bv,Sp as bw,lf as bx,Io as by,ll as bz,j as c,Ne as c$,Hr as c0,jr as c1,qr as c2,zr as c3,Dr as c4,Pr as c5,Er as c6,Un as c7,Tr as c8,Ar as c9,zi as cA,Cn as cB,Tu as cC,Vi as cD,qn as cE,Kd as cF,em as cG,xo as cH,Xd as cI,Vd as cJ,dn as cK,I_ as cL,cn as cM,ln as cN,an as cO,sn as cP,Ua as cQ,Sc as cR,xc as cS,ev as cT,X_ as cU,j_ as cV,Or as cW,Ig as cX,uo as cY,Ee as cZ,qe as c_,Jl as ca,Lr as cb,Ql as cc,Kl as cd,jl as ce,ec as cf,Xl as cg,Zl as ch,sm as ci,ns as cj,Rp as ck,np as cl,Yf as cm,ip as cn,pa as co,Wf as cp,Xf as cq,D_ as cr,li as cs,ep as ct,op as cu,Di as cv,fi as cw,ai as cx,vi as cy,rs as cz,Rg as d,ua as d$,Wc as d0,Yc as d1,rh as d2,Ec as d3,Xc as d4,Uc as d5,Gc as d6,nh as d7,eh as d8,Fc as d9,Co as dA,pi as dB,eu as dC,iu as dD,il as dE,Ol as dF,Pc as dG,tf as dH,nf as dI,$p as dJ,of as dK,cf as dL,Ml as dM,rf as dN,sf as dO,Da as dP,Js as dQ,Mp as dR,Ri as dS,y_ as dT,$f as dU,Mf as dV,uf as dW,w_ as dX,ja as dY,Wr as dZ,Ea as d_,Dc as da,jn as db,Ac as dc,Wn as dd,ci as de,Uf as df,Pp as dg,jf as dh,Tl as di,Es as dj,ds as dk,us as dl,Ie as dm,lu as dn,Kp as dp,Yp as dq,nu as dr,Nu as ds,Nd as dt,Ed as du,Fd as dv,Pn as dw,kd as dx,Yd as dy,Tn as dz,pe as e,Ir as e0,Nr as e1,Na as e2,Pl as e3,V_ as e4,La as e5,hm as e6,wp as e7,dp as e8,gp as e9,up as ea,Jt as eb,kg as ec,K_ as ed,Ji as ee,Qi as ef,Wt as eg,wv as eh,th as f,_n as g,p_ as h,_e as i,Vp as j,Op as k,kp as l,zd as m,sh as n,dh as o,Id as p,$d as q,hh as r,on as s,Md as t,Su as u,Gp as v,xd as w,Xn as x,qi as y,Li as z}; diff --git a/custom_components/houseplan/frontend/houseplan-assets/houseplan-editor-runtime-CffLSWDF.js b/custom_components/houseplan/frontend/houseplan-assets/houseplan-editor-runtime-BTZPftx5.js similarity index 82% rename from custom_components/houseplan/frontend/houseplan-assets/houseplan-editor-runtime-CffLSWDF.js rename to custom_components/houseplan/frontend/houseplan-assets/houseplan-editor-runtime-BTZPftx5.js index 98ab9aae..aa739454 100644 --- a/custom_components/houseplan/frontend/houseplan-assets/houseplan-editor-runtime-CffLSWDF.js +++ b/custom_components/houseplan/frontend/houseplan-assets/houseplan-editor-runtime-BTZPftx5.js @@ -1,4 +1,4 @@ -globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0f7211550c349a59b3baa3864a84e";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,g as _,h as m,v as g,j as f,k as b,m as v,p as y,q as $,t as w,u as k,w as x,x as S,T as M,y as C,D 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,N as L,O as B,P as W,Q as j,R as G,S 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,dD as mo,dE as go,dF as fo}from"./houseplan-card-BMVLvcks.js";import{F as bo,f as vo,p as yo,c as $o,e as wo,r as ko,a as xo,s as So}from"./backdrop-pick-BEAwnXmw.js";import{t as Mo,h as Co,m as Po,T as Do}from"./zigbee-topology-BEa8LNBZ.js";import{GENERATED_FURNITURE_ART as Io,FURNITURE_ART_FINGERPRINT as To}from"./furniture-plan-art.generated-D0lHr8pH.js";const zo={},Ro=t(class extends e{constructor(){super(...arguments),this.ot=zo}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 Ao={"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 Fo={en:Ao,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 No(t,e,s){return i(Fo[t]?.[e]??Ao[e]??e,s)}function Eo(t,e,s,i,o){return{markerId:t,source:i,mapId:o,space:e.length?"":s}}function Ho(t,e,s){return{...t,space:s.has(e)?e:""}}function Oo(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 Lo(t,e,s){return t.map(t=>t.id===e?{...t,calibration:s}:t)}const Bo=new WeakMap,Wo=(t,e)=>{const s=(t._serverCfg?.spaces||[]).find(t=>t?.id===e);return String(s?.name||s?.id||e)};function jo(t,e,s){const i=t.host,n=l(i.hass,i._config?.language),r=(t,e)=>No(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=>Oo(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,Oo(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=Bo.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)&&(Bo.delete(t),z=void 0),z?.space&&!b.has(z.space)&&(z=Ho(z,"",b),Bo.set(t,z));const N=s=>p` +globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="b468bec31a4d35a4630025ee2489e4187921a21b8f95e5abaaaace1921cfa3d8";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,g as _,h as g,v as m,j as f,k as b,m as v,p as y,q as $,t as w,u as k,w as x,x as M,T as C,y as S,D as P,z as D,B as I,C as L,F as T,G as R,H as z,I as F,J as N,K as A,L as E,M as O,N as B,O as H,P as W,Q as j,R as G,S as q,U,V as K,W as V,X as J,Y as Z,Z as Y,_ as X,$ 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 gt,ag as mt,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 Mt,aq as Ct,ar as St,as as Pt,at as Dt,au as It,av as Lt,aw as Tt,ax as Rt,ay as zt,az as Ft,aA as Nt,aB as At,aC as Et,aD as Ot,aE as Bt,aF as Ht,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 Zt,aP as Yt,aQ as Xt,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 ge,b6 as me,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 Me,bg as Ce,bh as Se,bi as Pe,bj as De,bk as Ie,bl as Le,bm as Te,bn as Re,bo as ze,bp as Fe,bq as Ne,br as Ae,bs as Ee,bt as Oe,bu as Be,bv as He,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 Ze,bF as Ye,bG as Xe,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 gs,bY as ms,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 Ms,c6 as Cs,c7 as Ss,c8 as Ps,c9 as Ds,ca as Is,cb as Ls,cc as Ts,cd as Rs,ce as zs,cf as Fs,cg as Ns,ch as As,ci as Es,cj as Os,ck as Bs,cl as Hs,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 Zs,cv as Ys,cw as Xs,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 gi,cO as mi,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 Mi,cY as Ci,cZ as Si,c_ as Pi,c$ as Di,d0 as Ii,d1 as Li,d2 as Ti,d3 as Ri,d4 as zi,d5 as Fi,d6 as Ni,d7 as Ai,d8 as Ei,d9 as Oi,da as Bi,db as Hi,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 Zi,dl as Yi,dm as Xi,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,dD as go,dE as mo,dF as fo}from"./houseplan-card-CK7KNP4B.js";import{F as bo,f as vo,p as yo,c as $o,e as wo,r as ko,a as xo,s as Mo}from"./backdrop-pick-DqssWRMU.js";import{t as Co,h as So,m as Po,T as Do}from"./zigbee-topology-Cq1qwIGM.js";import{GENERATED_FURNITURE_ART as Io,FURNITURE_ART_FINGERPRINT as Lo}from"./furniture-plan-art.generated-Bhgrr-iO.js";const To={},Ro=t(class extends e{constructor(){super(...arguments),this.ot=To}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 zo={"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 Fo={en:zo,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 No(t,e,s){return i(Fo[t]?.[e]??zo[e]??e,s)}function Ao(t,e,s,i,o){return{markerId:t,source:i,mapId:o,space:e.length?"":s}}function Eo(t,e,s){return{...t,space:s.has(e)?e:""}}function Oo(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 Bo(t,e,s){return t.map(t=>t.id===e?{...t,calibration:s}:t)}const Ho=new WeakMap,Wo=(t,e)=>{const s=(t._serverCfg?.spaces||[]).find(t=>t?.id===e);return String(s?.name||s?.id||e)};function jo(t,e,s){const i=t.host,n=l(i.hass,i._config?.language),r=(t,e)=>No(n,t,e),u=e.marker?.vacuum||{},_=Array.isArray(u.map_routes),g=i._vacSource(e)||"",m=o(e.id,u,e.space,g),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(m,[g],t=>i._vacObservedMapId(e,t)),y=c({routes:m,observed:v,spaceIds:b}),$="ready"===y.kind||"needs_calibration"===y.kind||"missing_space"===y.kind?y.route.id:"",w=g?v[g]: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,g,t=>Oo(t))??[],!g&&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!==g&&!m.some(e=>e.source===t.entityId)),M=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,Oo(new Set(m.map(t=>t.id)))))},C=new Map(f.map((t,e)=>[t.id,e])),S=(t,e)=>t.map_id.localeCompare(e.map_id)||t.source.localeCompare(e.source)||t.id.localeCompare(e.id),P=m.filter(t=>b.has(t.space)).sort((t,e)=>(C.get(t.space)??0)-(C.get(e.space)??0)||S(t,e)),D=m.filter(t=>!b.has(t.space)).sort(S),I=[...P,...D],L=!!g&&void 0!==w&&!m.some(t=>t.source===g&&t.map_id===w);let T=Ho.get(t);const R=T?.source||"",z=T?.mapId||"",F=!!T&&m.some(t=>t.source===R&&t.map_id===z);T&&(T.markerId!==e.id||i._vacObservedMapId(e,T.source)!==T.mapId||F&&!T.saving)&&(Ho.delete(t),T=void 0),T?.space&&!b.has(T.space)&&(T=Eo(T,"",b),Ho.set(t,T));const N=s=>p`
  • ${s.map_id||r("vac.route_map_default")} @@ -8,7 +8,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0
    ${(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)}
    -
  • `,E=`vacroute-missing-${e.id.replace(/[^a-zA-Z0-9_-]/g,"-")}`;return p` + `,A=`vacroute-missing-${e.id.replace(/[^a-zA-Z0-9_-]/g,"-")}`;return p`
    ${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?p`
      - ${z?p` + ${P.length||T?p`
        + ${T?p`
      • -
        ${z.mapId||r("vac.route_map_default")}
        - ${z.source} +
        ${T.mapId||r("vac.route_map_default")}
        + ${T.source}
        - + + ?disabled=${!!T.saving||!b.has(T.space)} + @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,Oo(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")}
      • `:d} ${P.map(N)}
      `:d} ${D.length?p`
      -

      + aria-labelledby=${A}> +

      ${r("vac.route_missing_space_group")}

        ${D.map(N)}
      `:d} - ${I.length||z?d:p`
      ${r("vac.routes_empty")}
      `} + ${I.length||T?d:p`
      ${r("vac.routes_empty")}
      `}
      - +
      ${x.length?p`
      ${r("vac.route_add_source")}
      ${r("vac.route_add_source_hint")}
      ${x.map(s=>{const o=i._vacObservedMapId(e,s.entityId);return p``})} @@ -78,10 +78,10 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0
      `:d} ${I.some(t=>!b.has(t.space))?p`
      ${r("vac.route_missing_space_hint")}
      `:d} - ${g.some(t=>"default"===t.map_id)?p` + ${m.some(t=>"default"===t.map_id)?p`
      ${r("vac.route_default_hint")}
      `:d} ${I.length?p`
      ${r("vac.route_target_hint",{space:Wo(i,e.space)})}
      `:d} -
    `}const Go=new Set(["ld2450","hlkld2450","hilinkld2450"]),qo=()=>globalThis.crypto?.randomUUID?.()||`radar_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`,Uo=(t,e,s)=>{const i=!!t?.original;return{radar:i?t:null,radarEligible:i,radarTouched:i?e:e||!!t,radarRemove:i?s:s||!!t}},Ko=(t,e="")=>"number"==typeof t&&Number.isFinite(t)?String(t):e,Vo=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)),Jo=(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 Yo(t,e){if(t.marker?.radar&&"object"==typeof t.marker.radar)return u(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=Vo(t);return Go.has((n=o?.model||t.model,String(n||"").toLowerCase().replace(/[^a-z0-9]/g,"")))&&a.some(t=>Jo(t,"x",1))&&a.some(t=>Jo(t,"y",1))?{eligible:!0,profile:"esphome_ld2450_v1",reason:"ld2450"}:{eligible:!1,profile:"presence_v1",reason:"none"};var n}function Xo(t,e){return t.find(t=>e.some(e=>e.test(t)))||""}function Zo(t,e,s,i,o=!1){const a=Yo(t,i),n=u(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=Vo(t).filter(t=>!!s?.states?.[t]),o=[],a=[];for(let t=1;t<=3;t++)o.push(i.find(e=>Jo(e,"x",t))||""),a.push(i.find(e=>Jo(e,"y",t))||"");const n=i.filter(t=>t.startsWith("binary_sensor.")),r=i.filter(t=>t.startsWith("sensor.")),l=Xo(n,[/(?:occupancy|presence|target)(?:_|$)/]);return{xEntities:o,yEntities:a,distanceEntity:Xo(r,[/(?:target_)?distance(?:_|$)/,/distance/]),angleEntity:Xo(r,[/(?:target_)?angle(?:_|$)/,/angle/]),occupancyEntity:l,countEntity:Xo(r,[/(?:target|people|presence)_count(?:_|$)/,/target_count/]),zoneEntity:"zones_v1"===e?Xo(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),_=h.ranges||[],m=h.zones?.[0],g="esphome_ld2450_v1"===r?3:"cartesian_v1"===r?Math.max(1,d.length):"polar_v1"===r?Math.max(1,p.length):1,f=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:f,installationId:n?.mount?.installation_id||qo(),mountX:Ko(null==n?.mount?.x?void 0:1e3*n.mount.x,Ko(s[0],"0")),mountY:Ko(null==n?.mount?.y?void 0:1e3*n.mount.y,Ko(s[1],"0")),heading:Ko(n?.mount?.heading_deg,"0"),rangeCm:Ko(n?.mount?.range_cm,"esphome_ld2450_v1"===r?"600":""),fovDeg:Ko(n?.mount?.fov_deg,"esphome_ld2450_v1"===r?"120":""),mirror:!0===n?.calibration?.mirror,unit:d[0]?.unit||p[0]?.unit||_[0]?.unit||("esphome_ld2450_v1"===r?"mm":"cm"),xEntities:Array.from({length:g},(t,e)=>d[e]?.x_entity||l.xEntities[e]||""),yEntities:Array.from({length:g},(t,e)=>d[e]?.y_entity||l.yEntities[e]||""),distanceEntities:Array.from({length:g},(t,e)=>p[e]?.distance_entity||(0===e?l.distanceEntity:"")),angleEntities:Array.from({length:g},(t,e)=>p[e]?.angle_entity||(0===e?l.angleEntity:"")),rangeEntities:_.length?_.map(t=>t.entity_id):[l.distanceEntity],slotPresenceEntities:Array.from({length:g},(t,e)=>(d[e]||p[e])?.presence_entity||""),rangePresenceEntities:(_.length?_:[{}]).map(t=>"presence_entity"in t&&t.presence_entity||""),swapXY:Array.from({length:g},(t,e)=>!0===d[e]?.swap_xy),xSigns:Array.from({length:g},(t,e)=>-1===d[e]?.x_sign?-1:1),ySigns:Array.from({length:g},(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:m?.entity_id||l.zoneEntity,zoneKind:m?.kind||"occupancy"}}const Qo=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),ta=t=>{if(!t.trim())return null;const e=Number(t.replace(",","."));return Number.isFinite(e)?e:null};function ea(t,e){const s=ta(t.mountX),i=ta(t.mountY),o=ta(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=ta(t.rangeCm),r=ta(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&&Qo(c.sources)===Qo(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}const sa={badge:"display.badge",icon_ripple:"display.icon_ripple",value:"display.value",static_icon:"display.static_icon",value_static_icon:"display.value_static_icon"},ia={badge:"marker.display_hint_badge",icon_ripple:"marker.display_hint_icon_ripple",value:"marker.display_hint_value",static_icon:"marker.display_hint_static_icon",value_static_icon:"marker.display_hint_value_static_icon"};function oa(){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?_(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?m(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,R=a?g(this.host._planHass,a,l):[],A=a?f(this.host._planHass,a,R):null,F=t.valueBadgeTouched?t.valueBadgeEnabled:!!u?.valueBadge,N=t.valueBadgeTouched?t.valueBadgeSource:u?.valueBadge?.source||t.valueBadgeSource,E=t.valueBadgeTouched?t.valueBadgePosition:u?.valueBadge?.position||t.valueBadgePosition,H=b(N),O=!!N&&!R.some(t=>t.key===H),L=R.find(t=>t.key===H),B=b(t.valueSource),W=!(!t.valueSource||B&&R.some(t=>t.key===B)),j=R.find(t=>t.key===B),G=u?.valueSource?.sourceKey||"",q=this._markerAutoHasSpatialSource(t),U=!!a&&v(this.host._planHass,{...a}),K=y(t.lightRole,q,U,t.glowMode),V=!K.sourceExists,J=!K.fromSourceEnabled,Y=K.passive,X=K.effectiveMode,Z="never"===t.lightRole?this.host._t("marker.glow_disabled_never"):"auto"!==t.lightRole||q?Y?this.host._t("marker.glow_passive_hint"):this.host._t("marker.glow_disabled_no_entity"):this.host._t("marker.glow_disabled_auto"),Q=a?$(a):[],tt=a&&w(a)||"",et=!!t.lightEntity&&!Q.includes(t.lightEntity),st=a?k(a):[],it=!!t.toggleEntity&&!st.includes(t.toggleEntity),ot="toggle"===n?this._toggleIntentForDialog({...t,toggleEntity:"",toggleEntityTouched:!0}):null,at=ot?[...ot.targets,...ot.skippedTargets].map(t=>t.entityId||("ref"in t?t.ref:"")).filter(Boolean).join(", "):"",nt=(()=>{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``}const Go=new Set(["ld2450","hlkld2450","hilinkld2450"]),qo=()=>globalThis.crypto?.randomUUID?.()||`radar_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`,Uo=(t,e,s)=>{const i=!!t?.original;return{radar:i?t:null,radarEligible:i,radarTouched:i?e:e||!!t,radarRemove:i?s:s||!!t}},Ko=(t,e="")=>"number"==typeof t&&Number.isFinite(t)?String(t):e,Vo=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)),Jo=(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 Zo(t,e){if(t.marker?.radar&&"object"==typeof t.marker.radar)return u(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=Vo(t);return Go.has((n=o?.model||t.model,String(n||"").toLowerCase().replace(/[^a-z0-9]/g,"")))&&a.some(t=>Jo(t,"x",1))&&a.some(t=>Jo(t,"y",1))?{eligible:!0,profile:"esphome_ld2450_v1",reason:"ld2450"}:{eligible:!1,profile:"presence_v1",reason:"none"};var n}function Yo(t,e){return t.find(t=>e.some(e=>e.test(t)))||""}function Xo(t,e,s,i,o=!1){const a=Zo(t,i),n=u(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=Vo(t).filter(t=>!!s?.states?.[t]),o=[],a=[];for(let t=1;t<=3;t++)o.push(i.find(e=>Jo(e,"x",t))||""),a.push(i.find(e=>Jo(e,"y",t))||"");const n=i.filter(t=>t.startsWith("binary_sensor.")),r=i.filter(t=>t.startsWith("sensor.")),l=Yo(n,[/(?:occupancy|presence|target)(?:_|$)/]);return{xEntities:o,yEntities:a,distanceEntity:Yo(r,[/(?:target_)?distance(?:_|$)/,/distance/]),angleEntity:Yo(r,[/(?:target_)?angle(?:_|$)/,/angle/]),occupancyEntity:l,countEntity:Yo(r,[/(?:target|people|presence)_count(?:_|$)/,/target_count/]),zoneEntity:"zones_v1"===e?Yo(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),_=h.ranges||[],g=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,f=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:f,installationId:n?.mount?.installation_id||qo(),mountX:Ko(null==n?.mount?.x?void 0:1e3*n.mount.x,Ko(s[0],"0")),mountY:Ko(null==n?.mount?.y?void 0:1e3*n.mount.y,Ko(s[1],"0")),heading:Ko(n?.mount?.heading_deg,"0"),rangeCm:Ko(n?.mount?.range_cm,"esphome_ld2450_v1"===r?"600":""),fovDeg:Ko(n?.mount?.fov_deg,"esphome_ld2450_v1"===r?"120":""),mirror:!0===n?.calibration?.mirror,unit:d[0]?.unit||p[0]?.unit||_[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:_.length?_.map(t=>t.entity_id):[l.distanceEntity],slotPresenceEntities:Array.from({length:m},(t,e)=>(d[e]||p[e])?.presence_entity||""),rangePresenceEntities:(_.length?_:[{}]).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:g?.entity_id||l.zoneEntity,zoneKind:g?.kind||"occupancy"}}const Qo=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),ta=t=>{if(!t.trim())return null;const e=Number(t.replace(",","."));return Number.isFinite(e)?e:null};function ea(t,e){const s=ta(t.mountX),i=ta(t.mountY),o=ta(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=ta(t.rangeCm),r=ta(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&&Qo(c.sources)===Qo(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}const sa={badge:"display.badge",icon_ripple:"display.icon_ripple",value:"display.value",static_icon:"display.static_icon",value_static_icon:"display.value_static_icon"},ia={badge:"marker.display_hint_badge",icon_ripple:"marker.display_hint_icon_ripple",value:"marker.display_hint_value",static_icon:"marker.display_hint_static_icon",value_static_icon:"marker.display_hint_value_static_icon"};function oa(){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?_(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?g(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,R=a?m(this.host._planHass,a,l):[],z=a?f(this.host._planHass,a,R):null,F=t.valueBadgeTouched?t.valueBadgeEnabled:!!u?.valueBadge,N=t.valueBadgeTouched?t.valueBadgeSource:u?.valueBadge?.source||t.valueBadgeSource,A=t.valueBadgeTouched?t.valueBadgePosition:u?.valueBadge?.position||t.valueBadgePosition,E=b(N),O=!!N&&!R.some(t=>t.key===E),B=R.find(t=>t.key===E),H=b(t.valueSource),W=!(!t.valueSource||H&&R.some(t=>t.key===H)),j=R.find(t=>t.key===H),G=u?.valueSource?.sourceKey||"",q=this._markerAutoHasSpatialSource(t),U=!!a&&v(this.host._planHass,{...a}),K=y(t.lightRole,q,U,t.glowMode),V=!K.sourceExists,J=!K.fromSourceEnabled,Z=K.passive,Y=K.effectiveMode,X="never"===t.lightRole?this.host._t("marker.glow_disabled_never"):"auto"!==t.lightRole||q?Z?this.host._t("marker.glow_passive_hint"):this.host._t("marker.glow_disabled_no_entity"):this.host._t("marker.glow_disabled_auto"),Q=a?$(a):[],tt=a&&w(a)||"",et=!!t.lightEntity&&!Q.includes(t.lightEntity),st=a?k(a):[],it=!!t.toggleEntity&&!st.includes(t.toggleEntity),ot="toggle"===n?this._toggleIntentForDialog({...t,toggleEntity:"",toggleEntityTouched:!0}):null,at=ot?[...ot.targets,...ot.skippedTargets].map(t=>t.entityId||("ref"in t?t.ref:"")).filter(Boolean).join(", "):"",nt=(()=>{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()}>
    @@ -139,7 +139,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 {const s={...t,tapAction:e.target.value,tapActionTouched:!0};this.host._markerDialog=this._announceToggleDraft(s)}}> - ${M.map(t=>[t,"tap."+t.replace("-","_")]).map(([t,e])=>p``)} @@ -266,30 +266,30 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 ${this.host._t("marker.glow_color_label")}${this._help("marker.glow_mode.help")}
    - ${"auto"!==X?p`
    + ${"auto"!==Y?p`
    {this.host._markerDialog={...t,glowMode:X,glowColor:e.detail.color,glowColorDrafted:!0,glowTouched:!0}}}> - ${"fixed"===X?p` + @hp-color-opacity-change=${e=>{this.host._markerDialog={...t,glowMode:Y,glowColor:e.detail.color,glowColorDrafted:!0,glowTouched:!0}}}> + ${"fixed"===Y?p` ${this.host._t("marker.glow_brightness")} - ${this._rangeInput(1,100,1,t.glowBrightness,e=>{this.host._markerDialog={...t,glowMode:X,glowBrightness:e,glowBrightnessDrafted:!0,glowTouched:!0}},V,this.host._t("marker.glow_brightness"))} + ${this._rangeInput(1,100,1,t.glowBrightness,e=>{this.host._markerDialog={...t,glowMode:Y,glowBrightness:e,glowBrightnessDrafted:!0,glowTouched:!0}},V,this.host._t("marker.glow_brightness"))} ${Math.round(t.glowBrightness)}%`:d}
    `:d} @@ -301,14 +301,14 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0
    this.host._markerDialog={...t,glowRadius:e.target.value}} /> ${this.host._imperial?this.host._t("gs.unit_ft"):this.host._t("gs.unit_m")}
    - ${V||Y?p`

    - ${Z} + ${V||Z?p`

    + ${X}

    `:d} @@ -328,7 +328,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 this.host._markerDialog={...t,valueBadgeSource:I(e.target.value),valueBadgeEnabled:!0,valueBadgeTouched:!0}}> - ${O?p``:d} ${R.map(t=>p``)} - ${L?p`

    ${L.technical}

    `:d} + ${B?p`

    ${B.technical}

    `:d} ${O?p`

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

    `:d} - ${D(t.display)&&H===G?p`

    + ${D(t.display)&&E===G?p`

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

    `:d}
    @@ -406,7 +406,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 @@ -462,7 +462,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0
    ${t.pdfs.map(t=>p` - ${t.name} + ${t.name} this._removeMarkerPdf(t.url)}>`)}
    - `}const aa=1e-6*A,na=6*A;function ra(t){return Number.isFinite(t)?Math.round(t/A)*A:t}const la=(t,e,s,i)=>Math.hypot(s-t,i-e),ha=(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)))),ca=(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(la(t+h,e+c,o+d,a+p),la(t-h,e-c,o-d,a-p)),_=Math.max(la(t+h,e+c,o-d,a-p),la(t-h,e-c,o+d,a+p));return Math.min(u,_)},da=t=>{const e=Number(t?.cell_cm);return e>0?e:5};function pa(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)<=aa&&c++},p=(t,e)=>{d(t[0],e[0]),d(t[1],e[1])},u={};let _=5;for(const t of s){const e=da(t);null!=t?.id&&(u[String(t.id)]=e),e>_&&(_=e)}const m=(t,e,s,i=!1)=>{if(!(t>aa||i))return;o++,t>n&&(n=t);const a=t*F*e;a>r&&(r=a,l=s)};for(const t of s){const e=da(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=[ra(e[0]),ra(e[1])];return t=Math.max(t,la(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=ra(e+o),r=ra(s+a),l=ra(e),h=ra(s),c=Math.max(A,n-l),p=Math.max(A,r-h);t=ha(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=[ra(o[0]),ra(o[1])],l=[ra(n[0]),ra(n[1])];let h=Math.max(la(o[0],o[1],r[0],r[1]),la(n[0],n[1],l[0],l[1]));const c=la(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>=-aa&&i+e/2<=c+aa});c>aa&&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=[ra(t[0]),ra(t[1])],n=la(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=[ra(e[0]),ra(e[1])],a=[ra(s[0]),ra(s[1])];t=Math.max(la(e[0],e[1],o[0],o[1]),la(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=ra(e),r=ra(s);if(null!=i.w&&null!=i.h){const l=ra(e+o),h=ra(s+a),c=Math.max(A,l-n),p=Math.max(A,h-r);t=ha(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=la(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)<=aa)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),_=ca(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=R([i.x,i.y],t.rooms||[],na,{step:A,length:Number(i.length)||0});if(!o)continue;const n=Number(i.angle),r=!(Number.isFinite(n)&&n===o.angle),l=ca(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=ra(s.x),n=ra(s.y),r=la(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 ua(t,e){const s=e.base+t*e.span;return Math.min(1,Math.max(0,s))}const _a=t=>Array.isArray(t)&&t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1]),ma=(t,e)=>Math.hypot(t[0]-e[0],t[1]-e[1]);function ga(t,e,s){const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o;if(a<=0)return ma(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 fa(t,e,s,i,o){for(const i of e)if(i&&!s.has(i.id)&&_a(i.a)&&_a(i.b)&&(ma(t,i.a)<=o||ma(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(ma(s,o)<=i)return[(s[0]+o[0])/2,(s[1]+o[1])/2];return null}function va(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&&_a(t.a)&&_a(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;tma(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 ya(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:ua(t.t,n)},a++;const r=E(s,e,i.coordScale,i.cellCm,i.gridPitch).resolved;r&&Object.assign(s,H(s,r,i.coordScale))}return a}function $a(t){return{roomPolygons:(t?.rooms||[]).map(t=>N(t)).filter(t=>!!t),columns:t?.wall_columns||[]}}const wa=t=>!!t&&t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1]),ka=(t,e)=>t[0]-e[0]||t[1]-e[1],xa=(t,e,s,i)=>[t[0]+e*i,t[1]+s*i],Sa=(t,e,s,i)=>(t[0]-e[0])*s+(t[1]-e[1])*i,Ma=(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=Sa(s,t,l,h),p=Sa(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},Ca=(t,e,s)=>Math.min(t.hi,e.hi)-Math.max(t.lo,e.lo)>s,Pa=t=>{const e=new Set(["id","a","b","cm"]);return Object.keys(t||{}).every(t=>e.has(t))},Da=(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=V(t.cm,s.cellCm,s.gridPitch)/2;return e.some(e=>{const o=e?.center;if(!wa(o))return!0;const a=Sa(o,t.a,r,l),c=Math.abs((o[0]-t.a[0])*l-(o[1]-t.a[1])*r),d=V(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})},Ia=(t,e,s)=>{if(t.host){const i=E(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},Ta=(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]}),Ra=(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},Aa=(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 Fa(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(!Pa(t))continue;const s=g.get(t.id);if(!(s&&wa(s.a)&&wa(s.b)&&Number.isFinite(s.cm)&&(o.allowCoincidentPartitions?!(s.cm<0):s.cm>0)))continue;const[a,n]=ka(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=O(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=Ma(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:E(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=Sa(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=>za(t,o.coordScale)).filter(t=>t.id!==s.id),P=[];for(let t=0;t+1h))continue;const r=xa(a,b,v,i),l=xa(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:L)),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=>!!Ma(r,l,t.a,t.b,h)),k=f&&(o.allowCoincidentPartitions||!w)&&!Da(y,e.wall_columns,o,h),x=f?o.allowCoincidentPartitions||p[0].cm>0?p[0].cm:L: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&&tCa(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&&B(e,y,h)){D.set(t.id,{resolved:e,signature:[...r][0]});continue}const l=W(s,o.cellCm,o.gridPitch),c={lo:i.lo-l,hi:i.hi+l};for(const t of P)Ca(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=>Ca(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=W(s,o.cellCm,o.gridPitch),r={lo:i.lo-n,hi:i.hi+n};for(const t of P)Ca(t,r,h)&&(t.safe=!1,t.signature="");I=!0}}const T=Aa(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]=ka(s.a,s.b)<=0?[t.a,t.b]:[t.b,t.a];A=j(A,e,i,t.finalCm,o.pitch,o.coordScale)}if(A=G(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:Ra(s.id,i,a,F);return F.add(n),{id:n,a:i,b:a,cm:s.cm}}),V=d.findIndex(t=>t.id===s.id),J=d.slice();J.splice(V,1,...N);const Y=J.map(t=>za(t,o.coordScale)),X=new Map;let Z=!0;for(const{opening:t,resolved:e}of w){const s=D.get(t.id);if(s){const e=H(t,s.resolved,o.coordScale),{host:i,...a}=e;X.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&&Y.find(t=>t.id===a.id);if(!a||!n){Z=!1;break}const r=n.b[0]-n.a[0],l=n.b[1]-n.a[1],c=Math.hypot(r,l),d=Sa(e.center,n.a,r/c,l/c),p={...H(t,e,o.coordScale),host:{kind:"partition",id:a.id,t:d/c}};if(!q(p,Y,o.coordScale,o.cellCm,o.gridPitch).resolved){Z=!1;break}X.set(t.id,p)}if(!Z)continue;const Q=p.map(t=>X.get(t.id)||t),tt=[...D.keys()].map(t=>X.get(t)),et=tt.map(t=>Ia(t,Y,o));if(et.some(t=>!t))continue;let st=!1;for(let t=0;tt.id));for(const t of Q){if(it.has(t.id))continue;const e=Ia(t,Y,o);e&&et.some(t=>Ta(t,e,h))&&(st=!0)}if(st)continue;const ot=U(e.rooms,A,i,o.pitch,o.cellCm,o.gridPitch,o.coordScale);[...D.entries()].every(([t,e])=>{const s=X.get(t),i=K(ot,{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=J,p=Q,u+=z.length,_+=D.size)}return{walls:c,partitions:d,openings:p,partitionsReconciled:u,openingsRehosted:_}}const Na=t=>JSON.parse(JSON.stringify(t)),Ea=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Ha=(t,e)=>e.length>0&&e.length<=35&&("space"===t?/^[a-z0-9_-]+$/.test(e):/^[A-Za-z0-9_-]+$/.test(e));function Oa(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 La=(t,e,s)=>{const i=t.get(e)||[];i.push(s),t.set(e,i)};const Ba=1e-9;class Wa extends Error{constructor(t,e=""){super(e?`${t}: ${e}`:t),this.reason=t,this.name="WallSegmentModelError"}}const ja=t=>JSON.parse(JSON.stringify(t)),Ga=t=>Array.isArray(t)&&t.length>=2&&Number.isFinite(Number(t[0]))&&Number.isFinite(Number(t[1])),qa=t=>[Number(t[0]),Number(t[1])],Ua=t=>`${Number(t[0]).toFixed(12)},${Number(t[1]).toFixed(12)}`,Ka=(t,e)=>{const s=Ua(t),i=Ua(e);return sUa(t)<=Ua(e)?[qa(t),qa(e)]:[qa(e),qa(t)],Ja=(t,e)=>Math.hypot(e[0]-t[0],e[1]-t[1]),Ya=(t,e=[])=>{const s=new Set,i=t=>{const e=Number(t);if(!Number.isFinite(e))return;const i=e/A;Math.abs(i-Math.round(i))>=tt&&s.add(e.toFixed(12))};for(const e of Array.isArray(t?.rooms)?t.rooms:[])for(const t of N(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},Xa=(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},Za=(t,e,s)=>{const i=Math.max(0,Math.min(1,Xa(t,e,s)));return Math.hypot(t[0]-(e[0]+(s[0]-e[0])*i),t[1]-(e[1]+(s[1]-e[1])*i))},Qa=(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=Xa(s,t,e),c=Xa(i,t,e);return Math.max(0,Math.min(1,Math.max(h,c))-Math.max(0,Math.min(h,c)))*r},tn=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},sn=(t,e,s,i,o="")=>{const[a,n]=Va(e,s),r=`${t}|${Ua(a)}|${Ua(n)}|${[...i].sort().join(",")}${o}`;return`wall-${en(tn(r)).slice(0,20)}`};let on=0;const an=t=>{for(let e=0;e<1e3;e++){const e=globalThis.crypto?.randomUUID?.(),s=`wall-${e||en(tn(`${Date.now()}|${on++}|${Math.random()}`)).slice(0,26)}`;if(!t.has(s))return s}throw new Wa("duplicate-id","id factory exhausted")},nn=t=>{const e=new Map;for(const s of Array.isArray(t?.wall_segments)?t.wall_segments:[])if(s&&"string"==typeof s.id&&Ga(s.a)&&Ga(s.b)){if(e.has(s.id))throw new Wa("duplicate-id",s.id);e.set(s.id,s)}return e},rn=(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)<=Ba&&Math.abs(e[1]-i[1]-a)<=Ba?[o,a]:null};return i(s.a,s.b)||i(s.b,s.a)},ln=(t,e)=>{const s=Array.isArray(t.rooms)?t.rooms:[],i=X(t.open_spans).map(t=>[t.a[0],t.a[1],t.b[0],t.b[1]]),o=i.length?i:Z(s,null,1,.04*A,!0),a=[];for(const t of s){const s=N(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=>Za([Number(t.x),Number(t.y)],[e[0],e[1]],[e[2],e[3]])<=.04*A)):[],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(!et(t,e,Number(s.angle)))return!1;if(Za(i,t,e)>.02*A)return!1;const o=Ja(t,e),a=Xa(i,t,e)*o,n=Number(s.length)/2;return a+n>=-1e-9&&a-n<=o+Ba}),c=new Map,d=[];for(const i of s){const r=String(i?.id||""),p=N(i);if(!r||!p||p.length<3)throw new Wa("invalid-room",r);const u=Q(s,r,n,A,1,[...t.walls||[],...l]);if(!u||u.poly.length<3)throw new Wa("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;tBa||Math.abs(i[1]-g[1])>Ba)){f=!1;break}g=i}const b=[];for(let t=0;t2)throw new Wa("third-owner",n);const d=m?_[u.parent[t]]:void 0;if("string"==typeof d&&d){const o=e.get(d);f||!o||Qa(s,i,o.a,o.b)>Ba?l.preferredIds.add(d):l.positionalIds.add(d),l.preferredCarriers.set(d,{a:qa(p[u.parent[t]]),b:qa(p[(u.parent[t]+1)%p.length])})}const g=u.parent[t];l.parentKeys.add(Y(p[g],p[(g+1)%p.length],A));const v=[(s[0]+i[0])/2,(s[1]+i[1])/2],y=t=>t.some(t=>Za(v,[t[0],t[1]],[t[2],t[3]])<=.04*A);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}},hn=(t,e,s,i,o)=>{const a=new Map([...s.values()].map(t=>[Ka(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 Wa("duplicate-id",e);r.set(t,i);continue}if(t.preferredIds.size>1)throw new Wa("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=>Qa(t.a,t.b,e.a,e.b)>Ba),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)||Ja(e.a,e.b)-Ja(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 Wa("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=Za(o,t.a,t.b)<=Ba?0:1,a=Za(o,e.a,e.b)<=Ba?0:1;if(s!==a)return s-a;return(Za(i.a,t.a,t.b)<=Ba?0:1)-(Za(i.a,e.a,e.b)<=Ba?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 Wa("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]=Va(e.a,e.b),o=`${String(t.id||"")}|${Ua(s)}|${Ua(i)}|${[...e.owners].sort().join(",")}`,a=en(tn(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 Wa("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=an(h),h.add(t.id)},cn=(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=Xa(s,e.a,e.b),o=Ja(e.a,e.b),a=Number(t.length)/2;return i>=-1e-9&&i<=1+Ba&&Za(s,e.a,e.b)<=.02*A&&et(e.a,e.b,Number(t.angle))&&Number.isFinite(a)&&a>=0&&i*o-a>=-1e-9&&i*o+a<=o+Ba},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,Xa(s,n.a,n.b)))}},dn=(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=Xa(s,e.a,e.b),a=Ja(e.a,e.b);return o>=-1e-9&&o<=1+Ba&&Za(s,e.a,e.b)<=.02*A&&et(e.a,e.b,Number(t.angle))&&Number.isFinite(i)&&i>=0&&o*a-i>=-1e-9&&o*a+i<=a+Ba}),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)=>Za(s,t.a,t.b)-Za(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,Xa(s,a.a,a.b)))}:null},pn=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/,un=t=>{if("number"!=typeof t&&"string"!=typeof t)return null;if("string"==typeof t&&!pn.test(t.trim()))return null;const e=Number(t);return Number.isFinite(e)?e:null},_n=t=>{if(!Array.isArray(t)||t.length<2)return null;const e=un(t[0]),s=un(t[1]);return null==e||null==s?null:[e,s]},mn=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=mn(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 Wa("zero-length",e);for(let a=0;a+1100)throw new Wa("thickness-conflict",e);let p="string"==typeof c?.id&&c.id?c.id:"";if(!p||s.has(p)){const i=sn(mn(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:qa(l),b:qa(h),cm:d}),o++}}return i.length?t.partitions=i:delete t.partitions,delete t.room_drafts,{drafts:e.length,segments:o}},fn=t=>gn(t),bn=(t,e,s)=>{const i=gn(t),o=nn(t),{atoms:a,rooms:n}=ln(t,o);hn(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=Y(e.a,e.b,A),a=i.filter(t=>Number(t.cm)>0&&(!(t.key!==o&&!e.parentKeys.has(t.key))||!(!Ga(t.a)||!Ga(t.b))&&Qa(e.a,e.b,t.a,t.b)>=Ja(e.a,e.b)-Ba)).map(t=>Math.max(1,Math.min(100,Number(t.cm))));if(new Set(a.map(t=>t.toFixed(9))).size>1)throw new Wa("thickness-conflict",e.key);if(a.length)return a[0];const n=it(i,e.a,e.b,A,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:Y(t.a,t.b,A),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=cn(t,e);s&&(t.host=s);continue}const i=cn(t,e)??(s?dn(t,e):null);if(i)t.host=i;else{if(!s)throw new Wa("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 vn(t,e={}){const s=JSON.stringify(t),i=ja(t);J(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=bn(t,r,s);o+=i.wallSegments,a+=i.drafts,n+=i.draftSegments}return i.model_version=10,J(i),{config:i,changed:s!==JSON.stringify(i),migratedSegments:o,migratedDrafts:a,migratedDraftSegments:n}}const yn=t=>!!t&&"object"==typeof t&&!Array.isArray(t);function $n(t,e){const s=(t,e)=>{if(Array.isArray(t)&&Array.isArray(e)){const i=new Map;for(const e of t)yn(e)&&"string"==typeof e.id&&e.id&&i.set(e.id,e);const o=e.map((e,o)=>{if(yn(e)&&"string"==typeof e.id&&e.id){const t=i.get(e.id);return t?s(t,e):ja(e)}return o[e,e in t?s(t[e],i):ja(i)]);for(const e of Object.keys(t))delete t[e];for(const[e,s]of i)t[e]=s;return t}return ja(e)};return s(t,e)}const wn=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),kn=(t,e,s)=>Math.min(s,Math.max(e,t)),xn=t=>bt({spaces:[t]})[0],Sn=(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 N(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=vt(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=Sn(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)=>Sn(t.a,t.b,r).localeCompare(Sn(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=j(u,t.a,t.b,e,i,r))}return u}const Cn=t=>{const e=[];for(const s of t||[]){const t=N(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=Oa("space",t);e.layers>0&&Ha("space",e.root)&&La(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=Oa("room",t);o.layers>0&&Ha("room",o.root)&&La(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=Oa("space",t).root;if(!Ha("space",e))return null;const s=d.get(e)||[];return 1===s.length?s[0]:null})(),w=(t,e)=>{const s=Oa("room",t).root;if(!Ha("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}`;Ea(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=ot(n,a.layout);J(n),at(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&&wn(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(wn(o,"segments")&&(delete o.segments,e++),wn(o,"plan_scale")){const t=Number(o.plan_scale);Number.isFinite(t)&&t>=pt&&t<=ut&&(wn(o,"plan_scale_x")||(o.plan_scale_x=t),wn(o,"plan_scale_y")||(o.plan_scale_y=t),delete o.plan_scale,e++)}const a=Number(o.cell_cm);wn(o,"cell_cm")&&(!Number.isFinite(a)||a<.1||a>1e3)&&(o.cell_cm=Number.isFinite(a)&&a>0?kn(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)wn(t,"angle")&&(delete t.angle,e++);else if("square"===t.shape&&wn(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(wn(t,"width")){const s=Number(t.width);(wn(t,"width_cm")||Number.isFinite(s))&&(wn(t,"width_cm")||(t.width_cm=Number(kn(s/ct*r,.1,100).toFixed(6))),delete t.width,e++)}if("rect"!==t?.kind&&"ellipse"!==t?.kind||!0!==t.fill||(wn(t,"fill_color")||(t.fill_color=t.color||"#607d8b",e++),wn(t,"fill_opacity")||(t.fill_opacity=.25,e++)),"text"!==t?.kind)continue;void 0===t.size_cm?(t.size_cm=Number(kn(_t*mt(t)/ct*r,.1,2e3).toFixed(6)),delete t.scale,delete t.size,e++):(wn(t,"scale")||wn(t,"size"))&&(delete t.scale,delete t.size,e++);let s=String(t.text??"");const i=[...s.matchAll(/\{([^{}\r\n]+)\}/g)].some(t=>!!gt(t[1]));if(!(wn(t,"entity")||wn(t,"attr")||wn(t,"unit")))continue;const o=String(t.unit??"").trim(),a="state"===String(t.attr??"").trim().toLowerCase()?null:t.attr,n=i||o?"":ft(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,m=0;if(c<10)for(const t of Array.isArray(n.spaces)?n.spaces:[]){const e=fn(t);_+=e.drafts,m+=e.segments}const g=(f=n.spaces||[],JSON.parse(JSON.stringify(f)));var f;const b=pa(n.spaces||[],a.layout);let v=0,y=0,$=0,w="";const k=b.spaces.map(t=>{const e=nt(t);v+=e.report.wallsStraightened,y+=e.report.wallsStraightenSkipped;const s=Number(t?.cell_cm)>0?Number(t.cell_cm):5,i=e.report.maxStraightenShift/A*s;return i>$&&($=i,w=String(t?.id||"")),e.space}),x=v?pa(k,b.layout):{...b,spaces:k};n.spaces=x.spaces;const S=v?{...b.report,moved:b.report.moved+x.report.moved,coordsCanonicalized:b.report.coordsCanonicalized+x.report.coordsCanonicalized,maxShift:Math.max(b.report.maxShift,x.report.maxShift),maxShiftCm:Math.max(b.report.maxShiftCm,x.report.maxShiftCm),maxSpace:x.report.maxShiftCm>b.report.maxShiftCm?x.report.maxSpace:b.report.maxSpace,rotated:b.report.rotated+x.report.rotated}:{...b.report};let M=0,C=0,P=0,D=0,I=0,T=0,z=0;for(let t=0;t0===Number(t.cm)),walls:e.walls||[]}),a=xn(e),r=xn(s);if(!a||!r)continue;const l=Cn(a.rooms),h=Cn(r.rooms),c=.02*ct,d=(e.wall_segments||[]).filter(t=>0===Number(t.cm)).map(t=>({...t,key:Y(t.a,t.b,A),cm:0})),p=new Set(d.map(t=>t.key)),u=rt(e,a.rooms,lt,c);C+=u.length;for(const t of u){const e=[t[0]/lt,t[1]/lt],s=[t[2]/lt,t[3]/lt],i=Y(e,s,A);p.has(i)||(p.add(i),d.push({key:i,a:e,b:s,cm:0}))}const _=d.length,m=ht(d,l,h,A,lt),f=(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))},b=m.filter(t=>{if(!Array.isArray(t.a)||!Array.isArray(t.b))return!1;const e=t.a.map(t=>t*lt),s=t.b.map(t=>t*lt);return h.some(([t,i])=>f(e,t,i)<=4*c&&f(s,t,i)<=4*c)});P+=Math.max(0,_-b.length);const v=(s.wall_segments||[]).filter(t=>Number(t.cm)>0);s.wall_segments=[...v,...b.map(({key:t,...e})=>e)];const y=b.map(t=>[t.a[0]*lt,t.a[1]*lt,t.b[0]*lt,t.b[1]*lt]),$=Array.isArray(e.walls)?e.walls.length:0;let w=ht(e.walls,l,h,A,lt);w=Mn(r.rooms,w,y,A,Number(s.cell_cm)>0?Number(s.cell_cm):5,ct,lt),w=G(r.rooms,w,y,A,Number(s.cell_cm)>0?Number(s.cell_cm):5,ct,lt),w=dt(w,s.rooms||[],A,1,y.map(t=>[t[0]/lt,t[1]/lt,t[2]/lt,t[3]/lt])),M+=Math.max(0,$-w.length),w.length?s.walls=w:delete s.walls;const k=va(s.partitions||[],{pitch:A,geometry:$a(s)});k.merged&&(D+=k.merged,s.partitions=k.partitions,ya(s.openings,s.partitions,k.openingMoves,{coordScale:lt,cellCm:Number(s.cell_cm)>0?Number(s.cell_cm):5,gridPitch:ct}));const x=xn(s);if(x){const t=o(s,x,s.walls||[],y,{pitch:A,cellCm:Number(s.cell_cm)>0?Number(s.cell_cm):5,gridPitch:ct,coordScale:lt});t.partitionsReconciled&&(I+=t.partitionsReconciled,T+=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&&z++}if(c<=10){const t=function(t){const e=vn(t);return $n(t,e.config),{...e,config:t}}(n);u+=t.migratedSegments,_+=t.migratedDrafts,m+=t.migratedDraftSegments}const R=J(n),F=at(x.layout),N=JSON.stringify(R)!==l||JSON.stringify(F)!==h;c<10&&N&&(R.model_version=10);const E=JSON.stringify(R)!==l||JSON.stringify(F)!==h,H=Number.isInteger(Number(R.model_version))?Number(R.model_version):c,O=E?S:{...S,moved:0,coordsCanonicalized:0,maxShift:0,maxShiftCm:0,maxSpace:"",rotated:0},L=E?a.report:{...a.report,spaceRefsRemapped:0,roomRefsRemapped:0,positionsRemapped:0,markersDetached:0,orphanRoomLabelsRemoved:0,orphanDevicePositionsRemoved:0,orphanGroupPositionsRemoved:0,liveMissingPositionsRemoved:0};return{config:R,layout:F,report:{...O,modelFrom:c,modelTo:H,migrated:E?p:0,glowSpacesMigrated:E?d.glowSpaces:0,glowRoomsMigrated:E?d.glowRooms:0,canonicalized:E?z:0,wallSegmentsMigrated:E?u:0,roomDraftsMigrated:E?_:0,roomDraftSegmentsMigrated:E?m:0,legacyZeroWallsMigrated:E?C:0,wallsMerged:E?M:0,spansMerged:E?P:0,partitionsMerged:E?D:0,partitionsReconciled:E?I:0,openingsRehosted:E?T:0,wallsStraightened:E?v:0,wallsStraightenSkipped:y,maxStraightenShiftCm:E?$:0,maxStraightenSpace:E?w:"",latticeCoordinatesCanonicalized:E?r.canonicalized:0,latticeCoordinatesFar:E?r.far:0,latticeMaxShift:E?r.maxShift:0,latticeMaxShiftCm:E?r.maxShiftCm:0,latticeSpaces:E?r.spaces:[],...L},changed:E}}async function Dn(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 In=Object.freeze({spaces:50,partitions:2e3,openings:500,decor:1e3,columns:500});class Tn extends Error{constructor(t){super(t),this.code=t,this.name="SpaceCopyError"}}const zn=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Rn=t=>void 0===t?t:JSON.parse(JSON.stringify(t)),An=t=>null===t||"object"!=typeof t||Array.isArray(t)?null:t;function Fn(t,e=!1){if(void 0===t&&!e)return[];if(!Array.isArray(t))throw new Tn("source_invalid");return t.map(t=>{const e=An(t);if(!e||"string"!=typeof e.id||!e.id)throw new Tn("source_invalid");return e})}const Nn=t=>Array.isArray(t)&&2===t.length&&t.every(t=>Number.isFinite(t));function En(t,e,s){const i=String(t??"").trim()||s,o=new Set(e.map(t=>{const e=An(t);return String(e?.title??"").trim()}));let a=2;for(;o.has(`${i} (${a})`);)a++;return`${i} (${a})`}const Hn=["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 On={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 Ln=0;function Bn(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 Wn(t){t._cfgEpoch++,t._modelCache=null,t._frame=null,t._regSignature="",t._maybeRebuildDevices(),t.requestUpdate()}async function jn(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=++Ln,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,!Bn(t,i,!0)||!t._serverCfg)return;const s=t._cfgRev,r=t._layoutRev,l=yt(t._serverCfg),h=yt(t._layout);let c;try{c=(e.optimize??Pn)(t._serverCfg,t._layout,e.optimizeReferenceContext())}catch(s){return Bn(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 Bn(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(!Bn(t,i,p))return;if(!p)return;if(t._cfgRev!==s||t._layoutRev!==r||!t._serverCfg||yt(t._serverCfg)!==l||yt(t._layout)!==h)return Bn(t,i,!1),void t._showToast(t._t("space.copy_error_changed"));e.clearGeometryGesture(),await Dn(t,c.config,c.layout),n=!0}if(!Bn(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 Tn("source_invalid");if(o.length>=In.spaces)throw new Tn("spaces_limit");const a=o.findIndex(t=>t.id===e);if(a<0)throw new Tn("source_missing");const n=o[a];if(!Array.isArray(n.view_box))throw new Tn("source_invalid");const r=Fn(n.wall_segments,!0),l=Fn(n.partitions),h=Fn(n.openings),c=Fn(n.decor),d=Fn(n.wall_columns);if(r.length+l.length>In.partitions)throw new Tn("partitions_limit");if(h.length>In.openings)throw new Tn("openings_limit");if(c.length>In.decor)throw new Tn("decor_limit");if(d.length>In.columns)throw new Tn("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)||!Nn(t.a)||!Nn(t.b)||"number"!=typeof t.cm||!Number.isFinite(t.cm))throw new Tn("source_invalid");const e=u("cw");_.set(t.id,e),g.push({id:e,a:Rn(t.a),b:Rn(t.b),cm:t.cm})}for(const t of l){if(m.has(t.id)||!Nn(t.a)||!Nn(t.b)||"number"!=typeof t.cm||!Number.isFinite(t.cm))throw new Tn("source_invalid");const e=u("cp");m.set(t.id,e),g.push({id:e,a:Rn(t.a),b:Rn(t.b),cm:t.cm})}const f=h.map(t=>{const e=An(t.host);if(!e||"string"!=typeof e.id||"string"!=typeof e.kind)throw new Tn("opening_host_missing");const s="wall"===e.kind?_.get(e.id):"partition"===e.kind?m.get(e.id):void 0;if(!s)throw new Tn("opening_host_unknown");const i={...Rn(t),id:u("co"),host:{...Rn(e),kind:"partition",id:s}};return delete i.contact,delete i.lock,i}),b=c.map(t=>({...Rn(t),id:u("cd")})),v=d.map(t=>({...Rn(t),id:u("cc")})),y=`s${i}`;if(o.some(t=>t.id===y))throw new Tn("source_invalid");const $={id:y,title:s.trim(),rooms:[],wall_segments:[],view_box:Rn(n.view_box)};for(const t of Hn)"view_box"!==t&&zn(n,t)&&($[t]=Rn(n[t]));g.length&&($.partitions=g),f.length&&($.openings=f),b.length&&($.decor=b),v.length&&($.wall_columns=v);const w=Rn(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 Tn("geometry_unsafe");const _=t._adoption.beginOptimistic(d,p.config);t._adoption.stageLocalConfig(p.config),Wn(t);try{await e.saveConfigNow(_)}catch(e){throw t._rollbackOptimistic(_)&&Wn(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()]),Bn(t,i,!1),function(t,e){if(e instanceof Tn)return void t._showToast(t._t(On[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 Gn=1e3;function qn(){const t=this.host._spaceDialog;if(t.copy)return function(t,e){const s=t._spaceDialog.copy,i=()=>function(t){const e=t._spaceDialog;!e?.copy||e.busy||e.copy.busy||(t._spaceDialog={...e,copy:void 0})}(t);return p``}const aa=1e-6*z,na=6*z;function ra(t){return Number.isFinite(t)?Math.round(t/z)*z:t}const la=(t,e,s,i)=>Math.hypot(s-t,i-e),ha=(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)))),ca=(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(la(t+h,e+c,o+d,a+p),la(t-h,e-c,o-d,a-p)),_=Math.max(la(t+h,e+c,o-d,a-p),la(t-h,e-c,o+d,a+p));return Math.min(u,_)},da=t=>{const e=Number(t?.cell_cm);return e>0?e:5};function pa(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)<=aa&&c++},p=(t,e)=>{d(t[0],e[0]),d(t[1],e[1])},u={};let _=5;for(const t of s){const e=da(t);null!=t?.id&&(u[String(t.id)]=e),e>_&&(_=e)}const g=(t,e,s,i=!1)=>{if(!(t>aa||i))return;o++,t>n&&(n=t);const a=t*F*e;a>r&&(r=a,l=s)};for(const t of s){const e=da(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=[ra(e[0]),ra(e[1])];return t=Math.max(t,la(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=ra(e+o),r=ra(s+a),l=ra(e),h=ra(s),c=Math.max(z,n-l),p=Math.max(z,r-h);t=ha(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)}g(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=[ra(o[0]),ra(o[1])],l=[ra(n[0]),ra(n[1])];let h=Math.max(la(o[0],o[1],r[0],r[1]),la(n[0],n[1],l[0],l[1]));const c=la(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>=-aa&&i+e/2<=c+aa});c>aa&&d?(i.a=r,i.b=l,p(o,r),p(n,l)):h=0,g(h,e,s)}for(const i of t.wall_columns||[]){a++;const t=[i.center[0],i.center[1]],o=[ra(t[0]),ra(t[1])],n=la(t[0],t[1],o[0],o[1]);i.center=o,p(t,o),g(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=[ra(e[0]),ra(e[1])],a=[ra(s[0]),ra(s[1])];t=Math.max(la(e[0],e[1],o[0],o[1]),la(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=ra(e),r=ra(s);if(null!=i.w&&null!=i.h){const l=ra(e+o),h=ra(s+a),c=Math.max(z,l-n),p=Math.max(z,h-r);t=ha(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=la(e,s,n,r);i.x=n,i.y=r,d(e,n),d(s,r)}g(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)<=aa)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),_=ca(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++,g(_,e,s,u);continue}const o=R([i.x,i.y],t.rooms||[],na,{step:z,length:Number(i.length)||0});if(!o)continue;const n=Number(i.angle),r=!(Number.isFinite(n)&&n===o.angle),l=ca(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++,g(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=ra(s.x),n=ra(s.y),r=la(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:"";g(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 ua(t,e){const s=e.base+t*e.span;return Math.min(1,Math.max(0,s))}const _a=t=>Array.isArray(t)&&t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1]),ga=(t,e)=>Math.hypot(t[0]-e[0],t[1]-e[1]);function ma(t,e,s){const i=s[0]-e[0],o=s[1]-e[1],a=i*i+o*o;if(a<=0)return ga(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 fa(t,e,s,i,o){for(const i of e)if(i&&!s.has(i.id)&&_a(i.a)&&_a(i.b)&&(ga(t,i.a)<=o||ga(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(ga(s,o)<=i)return[(s[0]+o[0])/2,(s[1]+o[1])/2];return null}function va(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&&_a(t.a)&&_a(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;tga(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,g=u>0?(d[1]-c[1])/u:0,m=t=>u>0?((t[0]-c[0])*_+(t[1]-c[1])*g)/u:0;for(const t of[r,l]){const e=m(t.a),s=m(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 ya(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:ua(t.t,n)},a++;const r=A(s,e,i.coordScale,i.cellCm,i.gridPitch).resolved;r&&Object.assign(s,E(s,r,i.coordScale))}return a}function $a(t){return{roomPolygons:(t?.rooms||[]).map(t=>N(t)).filter(t=>!!t),columns:t?.wall_columns||[]}}const wa=t=>!!t&&t.length>=2&&Number.isFinite(t[0])&&Number.isFinite(t[1]),ka=(t,e)=>t[0]-e[0]||t[1]-e[1],xa=(t,e,s,i)=>[t[0]+e*i,t[1]+s*i],Ma=(t,e,s,i)=>(t[0]-e[0])*s+(t[1]-e[1])*i,Ca=(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=Ma(s,t,l,h),p=Ma(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},Sa=(t,e,s)=>Math.min(t.hi,e.hi)-Math.max(t.lo,e.lo)>s,Pa=t=>{const e=new Set(["id","a","b","cm"]);return Object.keys(t||{}).every(t=>e.has(t))},Da=(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=V(t.cm,s.cellCm,s.gridPitch)/2;return e.some(e=>{const o=e?.center;if(!wa(o))return!0;const a=Ma(o,t.a,r,l),c=Math.abs((o[0]-t.a[0])*l-(o[1]-t.a[1])*r),d=V(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})},Ia=(t,e,s)=>{if(t.host){const i=A(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},La=(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]}),Ra=(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},za=(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 Fa(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 g=o.partitionIds?new Set(o.partitionIds):null,m=new Map(e.partitions.map(t=>[t.id,t]));for(const t of[...n].sort((t,e)=>t.id.localeCompare(e.id))){if(g&&!g.has(t.id))continue;if(!d.some(e=>e.id===t.id))continue;if(!Pa(t))continue;const s=m.get(t.id);if(!(s&&wa(s.a)&&wa(s.b)&&Number.isFinite(s.cm)&&(o.allowCoincidentPartitions?!(s.cm<0):s.cm>0)))continue;const[a,n]=ka(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=O(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=Ca(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:A(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(),M=new Map;for(const{opening:t,resolved:e}of w){const s=Ma(e.center,a,b,v),i={lo:s-e.length/2,hi:s+e.length/2};M.set(t.id,i),x.push(Math.max(0,i.lo),Math.min(f,i.hi))}const C=[...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),S=d.map(t=>Ta(t,o.coordScale)).filter(t=>t.id!==s.id),P=[];for(let t=0;t+1h))continue;const r=xa(a,b,v,i),l=xa(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:B)),g=p[0]?.kind,m=[...d.keys()].sort(),f=1===u.size&&1===_.size&&("outer"===g&&1===m.length||"shared"===g&&2===m.length),y={id:s.id,a:r,b:l,cm:s.cm},w=S.some(t=>!!Ca(r,l,t.a,t.b,h)),k=f&&(o.allowCoincidentPartitions||!w)&&!Da(y,e.wall_columns,o,h),x=f?o.allowCoincidentPartitions||p[0].cm>0?p[0].cm:B:0,M=f?Math.max(x,s.cm):s.cm;P.push({lo:i,hi:n,a:r,b:l,safe:k,signature:k?`${g}|${m.join(",")}|${M}`:"",roomIds:m,roomCm:x,finalCm:M})}if(!P.some(t=>t.safe))continue;const D=new Map;for(const{opening:t,resolved:e}of w){const i=M.get(t.id),a=k.some(t=>t>i.lo+h&&tSa(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&&H(e,y,h)){D.set(t.id,{resolved:e,signature:[...r][0]});continue}const l=W(s,o.cellCm,o.gridPitch),c={lo:i.lo-l,hi:i.hi+l};for(const t of P)Sa(t,c,h)&&(t.safe=!1,t.signature="")}let I=!0;for(;I;){I=!1;for(const[t,e]of[...D.entries()]){const i=M.get(t),a=P.filter(t=>Sa(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=W(s,o.cellCm,o.gridPitch),r={lo:i.lo-n,hi:i.hi+n};for(const t of P)Sa(t,r,h)&&(t.safe=!1,t.signature="");I=!0}}const L=za(P,h),T=L.filter(t=>t.safe),R=L.filter(t=>!t.safe);if(!T.length)continue;if(d.length-1+R.length>2e3)continue;let z=c;for(const t of T){const[e,i]=ka(s.a,s.b)<=0?[t.a,t.b]:[t.b,t.a];z=j(z,e,i,t.finalCm,o.pitch,o.coordScale)}if(z=G(e.rooms,z,i,o.pitch,o.cellCm,o.gridPitch,o.coordScale),z.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:Ra(s.id,i,a,F);return F.add(n),{id:n,a:i,b:a,cm:s.cm}}),V=d.findIndex(t=>t.id===s.id),J=d.slice();J.splice(V,1,...N);const Z=J.map(t=>Ta(t,o.coordScale)),Y=new Map;let X=!0;for(const{opening:t,resolved:e}of w){const s=D.get(t.id);if(s){const e=E(t,s.resolved,o.coordScale),{host:i,...a}=e;Y.set(t.id,a);continue}const i=M.get(t.id),a=N[R.findIndex(t=>t.lo<=i.lo+h&&t.hi>=i.hi-h)],n=a&&Z.find(t=>t.id===a.id);if(!a||!n){X=!1;break}const r=n.b[0]-n.a[0],l=n.b[1]-n.a[1],c=Math.hypot(r,l),d=Ma(e.center,n.a,r/c,l/c),p={...E(t,e,o.coordScale),host:{kind:"partition",id:a.id,t:d/c}};if(!q(p,Z,o.coordScale,o.cellCm,o.gridPitch).resolved){X=!1;break}Y.set(t.id,p)}if(!X)continue;const Q=p.map(t=>Y.get(t.id)||t),tt=[...D.keys()].map(t=>Y.get(t)),et=tt.map(t=>Ia(t,Z,o));if(et.some(t=>!t))continue;let st=!1;for(let t=0;tt.id));for(const t of Q){if(it.has(t.id))continue;const e=Ia(t,Z,o);e&&et.some(t=>La(t,e,h))&&(st=!0)}if(st)continue;const ot=U(e.rooms,z,i,o.pitch,o.cellCm,o.gridPitch,o.coordScale);[...D.entries()].every(([t,e])=>{const s=Y.get(t),i=K(ot,{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=z,d=J,p=Q,u+=T.length,_+=D.size)}return{walls:c,partitions:d,openings:p,partitionsReconciled:u,openingsRehosted:_}}const Na=t=>JSON.parse(JSON.stringify(t)),Aa=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Ea=(t,e)=>e.length>0&&e.length<=35&&("space"===t?/^[a-z0-9_-]+$/.test(e):/^[A-Za-z0-9_-]+$/.test(e));function Oa(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 Ba=(t,e,s)=>{const i=t.get(e)||[];i.push(s),t.set(e,i)};const Ha=1e-9;class Wa extends Error{constructor(t,e=""){super(e?`${t}: ${e}`:t),this.reason=t,this.name="WallSegmentModelError"}}const ja=t=>JSON.parse(JSON.stringify(t)),Ga=t=>Array.isArray(t)&&t.length>=2&&Number.isFinite(Number(t[0]))&&Number.isFinite(Number(t[1])),qa=t=>[Number(t[0]),Number(t[1])],Ua=t=>`${Number(t[0]).toFixed(12)},${Number(t[1]).toFixed(12)}`,Ka=(t,e)=>{const s=Ua(t),i=Ua(e);return sUa(t)<=Ua(e)?[qa(t),qa(e)]:[qa(e),qa(t)],Ja=(t,e)=>Math.hypot(e[0]-t[0],e[1]-t[1]),Za=(t,e=[])=>{const s=new Set,i=t=>{const e=Number(t);if(!Number.isFinite(e))return;const i=e/z;Math.abs(i-Math.round(i))>=tt&&s.add(e.toFixed(12))};for(const e of Array.isArray(t?.rooms)?t.rooms:[])for(const t of N(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},Ya=(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},Xa=(t,e,s)=>{const i=Math.max(0,Math.min(1,Ya(t,e,s)));return Math.hypot(t[0]-(e[0]+(s[0]-e[0])*i),t[1]-(e[1]+(s[1]-e[1])*i))},Qa=(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=Ya(s,t,e),c=Ya(i,t,e);return Math.max(0,Math.min(1,Math.max(h,c))-Math.max(0,Math.min(h,c)))*r},tn=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},sn=(t,e,s,i,o="")=>{const[a,n]=Va(e,s),r=`${t}|${Ua(a)}|${Ua(n)}|${[...i].sort().join(",")}${o}`;return`wall-${en(tn(r)).slice(0,20)}`};let on=0;const an=t=>{for(let e=0;e<1e3;e++){const e=globalThis.crypto?.randomUUID?.(),s=`wall-${e||en(tn(`${Date.now()}|${on++}|${Math.random()}`)).slice(0,26)}`;if(!t.has(s))return s}throw new Wa("duplicate-id","id factory exhausted")},nn=t=>{const e=new Map;for(const s of Array.isArray(t?.wall_segments)?t.wall_segments:[])if(s&&"string"==typeof s.id&&Ga(s.a)&&Ga(s.b)){if(e.has(s.id))throw new Wa("duplicate-id",s.id);e.set(s.id,s)}return e},rn=(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)<=Ha&&Math.abs(e[1]-i[1]-a)<=Ha?[o,a]:null};return i(s.a,s.b)||i(s.b,s.a)},ln=(t,e)=>{const s=Array.isArray(t.rooms)?t.rooms:[],i=Y(t.open_spans).map(t=>[t.a[0],t.a[1],t.b[0],t.b[1]]),o=i.length?i:X(s,null,1,.04*z,!0),a=[];for(const t of s){const s=N(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=>Xa([Number(t.x),Number(t.y)],[e[0],e[1]],[e[2],e[3]])<=.04*z)):[],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(!et(t,e,Number(s.angle)))return!1;if(Xa(i,t,e)>.02*z)return!1;const o=Ja(t,e),a=Ya(i,t,e)*o,n=Number(s.length)/2;return a+n>=-1e-9&&a-n<=o+Ha}),c=new Map,d=[];for(const i of s){const r=String(i?.id||""),p=N(i);if(!r||!p||p.length<3)throw new Wa("invalid-room",r);const u=Q(s,r,n,z,1,[...t.walls||[],...l]);if(!u||u.poly.length<3)throw new Wa("invalid-room",r);const _=Array.isArray(i.wall_ids)?i.wall_ids:[],g=_.length===p.length;let m=null,f=g;if(f)for(let t=0;tHa||Math.abs(i[1]-m[1])>Ha)){f=!1;break}m=i}const b=[];for(let t=0;t2)throw new Wa("third-owner",n);const d=g?_[u.parent[t]]:void 0;if("string"==typeof d&&d){const o=e.get(d);f||!o||Qa(s,i,o.a,o.b)>Ha?l.preferredIds.add(d):l.positionalIds.add(d),l.preferredCarriers.set(d,{a:qa(p[u.parent[t]]),b:qa(p[(u.parent[t]+1)%p.length])})}const m=u.parent[t];l.parentKeys.add(Z(p[m],p[(m+1)%p.length],z));const v=[(s[0]+i[0])/2,(s[1]+i[1])/2],y=t=>t.some(t=>Xa(v,[t[0],t[1]],[t[2],t[3]])<=.04*z);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}},hn=(t,e,s,i,o)=>{const a=new Map([...s.values()].map(t=>[Ka(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 Wa("duplicate-id",e);r.set(t,i);continue}if(t.preferredIds.size>1)throw new Wa("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=>Qa(t.a,t.b,e.a,e.b)>Ha),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)||Ja(e.a,e.b)-Ja(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 Wa("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=Xa(o,t.a,t.b)<=Ha?0:1,a=Xa(o,e.a,e.b)<=Ha?0:1;if(s!==a)return s-a;return(Xa(i.a,t.a,t.b)<=Ha?0:1)-(Xa(i.a,e.a,e.b)<=Ha?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 Wa("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]=Va(e.a,e.b),o=`${String(t.id||"")}|${Ua(s)}|${Ua(i)}|${[...e.owners].sort().join(",")}`,a=en(tn(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 Wa("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=an(h),h.add(t.id)},cn=(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=Ya(s,e.a,e.b),o=Ja(e.a,e.b),a=Number(t.length)/2;return i>=-1e-9&&i<=1+Ha&&Xa(s,e.a,e.b)<=.02*z&&et(e.a,e.b,Number(t.angle))&&Number.isFinite(a)&&a>=0&&i*o-a>=-1e-9&&i*o+a<=o+Ha},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,Ya(s,n.a,n.b)))}},dn=(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=Ya(s,e.a,e.b),a=Ja(e.a,e.b);return o>=-1e-9&&o<=1+Ha&&Xa(s,e.a,e.b)<=.02*z&&et(e.a,e.b,Number(t.angle))&&Number.isFinite(i)&&i>=0&&o*a-i>=-1e-9&&o*a+i<=a+Ha}),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)=>Xa(s,t.a,t.b)-Xa(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,Ya(s,a.a,a.b)))}:null},pn=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/,un=t=>{if("number"!=typeof t&&"string"!=typeof t)return null;if("string"==typeof t&&!pn.test(t.trim()))return null;const e=Number(t);return Number.isFinite(e)?e:null},_n=t=>{if(!Array.isArray(t)||t.length<2)return null;const e=un(t[0]),s=un(t[1]);return null==e||null==s?null:[e,s]},gn=t=>"string"==typeof t?t:"",mn=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=gn(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 Wa("zero-length",e);for(let a=0;a+1100)throw new Wa("thickness-conflict",e);let p="string"==typeof c?.id&&c.id?c.id:"";if(!p||s.has(p)){const i=sn(gn(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:qa(l),b:qa(h),cm:d}),o++}}return i.length?t.partitions=i:delete t.partitions,delete t.room_drafts,{drafts:e.length,segments:o}},fn=t=>mn(t),bn=(t,e,s)=>{const i=mn(t),o=nn(t),{atoms:a,rooms:n}=ln(t,o);hn(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=Z(e.a,e.b,z),a=i.filter(t=>Number(t.cm)>0&&(!(t.key!==o&&!e.parentKeys.has(t.key))||!(!Ga(t.a)||!Ga(t.b))&&Qa(e.a,e.b,t.a,t.b)>=Ja(e.a,e.b)-Ha)).map(t=>Math.max(1,Math.min(100,Number(t.cm))));if(new Set(a.map(t=>t.toFixed(9))).size>1)throw new Wa("thickness-conflict",e.key);if(a.length)return a[0];const n=it(i,e.a,e.b,z,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:Z(t.a,t.b,z),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=cn(t,e);s&&(t.host=s);continue}const i=cn(t,e)??(s?dn(t,e):null);if(i)t.host=i;else{if(!s)throw new Wa("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 vn(t,e={}){const s=JSON.stringify(t),i=ja(t);J(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=bn(t,r,s);o+=i.wallSegments,a+=i.drafts,n+=i.draftSegments}return i.model_version=10,J(i),{config:i,changed:s!==JSON.stringify(i),migratedSegments:o,migratedDrafts:a,migratedDraftSegments:n}}const yn=t=>!!t&&"object"==typeof t&&!Array.isArray(t);function $n(t,e){const s=(t,e)=>{if(Array.isArray(t)&&Array.isArray(e)){const i=new Map;for(const e of t)yn(e)&&"string"==typeof e.id&&e.id&&i.set(e.id,e);const o=e.map((e,o)=>{if(yn(e)&&"string"==typeof e.id&&e.id){const t=i.get(e.id);return t?s(t,e):ja(e)}return o[e,e in t?s(t[e],i):ja(i)]);for(const e of Object.keys(t))delete t[e];for(const[e,s]of i)t[e]=s;return t}return ja(e)};return s(t,e)}const wn=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),kn=(t,e,s)=>Math.min(s,Math.max(e,t)),xn=t=>bt({spaces:[t]})[0],Mn=(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 N(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=vt(t,n.id,e,s,i,o,a,r);if(u)for(let t=0;t0&&_>0&&n===g&&_!==n))continue;const m=u.poly[i],f=u.poly[(i+1)%u.poly.length],b=Math.hypot(f[0]-m[0],f[1]-m[1]);if(!(b>l&&b<.5*a-1e-9*a))continue;if(d(m,c)||d(f,c))continue;if(d(m,h)&&d(f,h))continue;const v=Mn(m,f,r),y=p.get(v);y?y.targets.add(n):p.set(v,{a:[m[0],m[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,g=(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)=>Mn(t.a,t.b,r).localeCompare(Mn(e.a,e.b,r)))){const e=[...t.targets][0],s=u.filter(e=>g(e,t));if(new Set(s.map(t=>t.cm)).size>1)continue;let o=!1;u=u.map(s=>g(s,t)?(o=!0,s.cm===e?s:{...s,cm:e}):s),o||(u=j(u,t.a,t.b,e,i,r))}return u}const Sn=t=>{const e=[];for(const s of t||[]){const t=N(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=Oa("space",t);e.layers>0&&Ea("space",e.root)&&Ba(d,e.root,t)}const p=new Map,u=new Map,_=new Map,g=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=Oa("room",t);o.layers>0&&Ea("room",o.root)&&Ba(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=g.get(a)||[];s.push({spaceId:e,roomId:t}),g.set(a,s)}}p.set(e,s)}const m=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=Oa("space",t).root;if(!Ea("space",e))return null;const s=d.get(e)||[];return 1===s.length?s[0]:null})(),w=(t,e)=>{const s=Oa("room",t).root;if(!Ea("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&&g.get(e)||[];return 1===i.length?i[0]:null},x=(t,e,s)=>{if("string"==typeof t.room_id&&t.room_id&&!m.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||m.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}`;Aa(o,s)||(o[s]={...e,s:i}),delete o[t],v.roomRefsRemapped++,v.positionsRemapped++;continue}}o[t]={...e,s:i},v.positionsRemapped++}}const M=s.ownerRoster,C=!0===M?.authoritative,S=new Set(M?.deviceIds||[]),P=new Set(M?.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(M?.names?.[t]||e||"").trim();return s&&s!==t?s:""},L=(t,e,s,i="",o)=>({id:t,spaceId:e,kind:s,name:I(t,i),...o?{reason:o}:{}}),T=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=L(t,i,"device",String(r.name||"")),n="live";else if(l)a=L(t,i,"device",String(l.name||"")),n="absent";else if(t.startsWith("rl_")){const e=t.slice(3);a=L(t,i,"room_label",_.get(e)||""),n=m.has(e)?"live":"absent"}else if(t.startsWith("lg_")){const e=t.slice(3);a=L(t,i,"group"),n=P.has(e)?"live":C?"absent":"unverified","unverified"===n&&(a.reason="registry_unavailable")}else S.has(t)?(a=L(t,i,"device"),n="live"):D.has(t)?(a=L(t,i,"device"),n=C?"absent":"unverified","unverified"===n&&(a.reason="registry_unavailable")):(a=L(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++,T(a.kind),v.removedPositions.push(a);continue}}else v.unverifiedPositions.push(a);v.positionsUnresolved++,R.add(i)}else delete o[t],T(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=ot(n,a.layout);J(n),at(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&&wn(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(wn(o,"segments")&&(delete o.segments,e++),wn(o,"plan_scale")){const t=Number(o.plan_scale);Number.isFinite(t)&&t>=pt&&t<=ut&&(wn(o,"plan_scale_x")||(o.plan_scale_x=t),wn(o,"plan_scale_y")||(o.plan_scale_y=t),delete o.plan_scale,e++)}const a=Number(o.cell_cm);wn(o,"cell_cm")&&(!Number.isFinite(a)||a<.1||a>1e3)&&(o.cell_cm=Number.isFinite(a)&&a>0?kn(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)wn(t,"angle")&&(delete t.angle,e++);else if("square"===t.shape&&wn(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(wn(t,"width")){const s=Number(t.width);(wn(t,"width_cm")||Number.isFinite(s))&&(wn(t,"width_cm")||(t.width_cm=Number(kn(s/ct*r,.1,100).toFixed(6))),delete t.width,e++)}if("rect"!==t?.kind&&"ellipse"!==t?.kind||!0!==t.fill||(wn(t,"fill_color")||(t.fill_color=t.color||"#607d8b",e++),wn(t,"fill_opacity")||(t.fill_opacity=.25,e++)),"text"!==t?.kind)continue;void 0===t.size_cm?(t.size_cm=Number(kn(_t*gt(t)/ct*r,.1,2e3).toFixed(6)),delete t.scale,delete t.size,e++):(wn(t,"scale")||wn(t,"size"))&&(delete t.scale,delete t.size,e++);let s=String(t.text??"");const i=[...s.matchAll(/\{([^{}\r\n]+)\}/g)].some(t=>!!mt(t[1]));if(!(wn(t,"entity")||wn(t,"attr")||wn(t,"unit")))continue;const o=String(t.unit??"").trim(),a="state"===String(t.attr??"").trim().toLowerCase()?null:t.attr,n=i||o?"":ft(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=fn(t);_+=e.drafts,g+=e.segments}const m=(f=n.spaces||[],JSON.parse(JSON.stringify(f)));var f;const b=pa(n.spaces||[],a.layout);let v=0,y=0,$=0,w="";const k=b.spaces.map(t=>{const e=nt(t);v+=e.report.wallsStraightened,y+=e.report.wallsStraightenSkipped;const s=Number(t?.cell_cm)>0?Number(t.cell_cm):5,i=e.report.maxStraightenShift/z*s;return i>$&&($=i,w=String(t?.id||"")),e.space}),x=v?pa(k,b.layout):{...b,spaces:k};n.spaces=x.spaces;const M=v?{...b.report,moved:b.report.moved+x.report.moved,coordsCanonicalized:b.report.coordsCanonicalized+x.report.coordsCanonicalized,maxShift:Math.max(b.report.maxShift,x.report.maxShift),maxShiftCm:Math.max(b.report.maxShiftCm,x.report.maxShiftCm),maxSpace:x.report.maxShiftCm>b.report.maxShiftCm?x.report.maxSpace:b.report.maxSpace,rotated:b.report.rotated+x.report.rotated}:{...b.report};let C=0,S=0,P=0,D=0,I=0,L=0,T=0;for(let t=0;t0===Number(t.cm)),walls:e.walls||[]}),a=xn(e),r=xn(s);if(!a||!r)continue;const l=Sn(a.rooms),h=Sn(r.rooms),c=.02*ct,d=(e.wall_segments||[]).filter(t=>0===Number(t.cm)).map(t=>({...t,key:Z(t.a,t.b,z),cm:0})),p=new Set(d.map(t=>t.key)),u=rt(e,a.rooms,lt,c);S+=u.length;for(const t of u){const e=[t[0]/lt,t[1]/lt],s=[t[2]/lt,t[3]/lt],i=Z(e,s,z);p.has(i)||(p.add(i),d.push({key:i,a:e,b:s,cm:0}))}const _=d.length,g=ht(d,l,h,z,lt),f=(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))},b=g.filter(t=>{if(!Array.isArray(t.a)||!Array.isArray(t.b))return!1;const e=t.a.map(t=>t*lt),s=t.b.map(t=>t*lt);return h.some(([t,i])=>f(e,t,i)<=4*c&&f(s,t,i)<=4*c)});P+=Math.max(0,_-b.length);const v=(s.wall_segments||[]).filter(t=>Number(t.cm)>0);s.wall_segments=[...v,...b.map(({key:t,...e})=>e)];const y=b.map(t=>[t.a[0]*lt,t.a[1]*lt,t.b[0]*lt,t.b[1]*lt]),$=Array.isArray(e.walls)?e.walls.length:0;let w=ht(e.walls,l,h,z,lt);w=Cn(r.rooms,w,y,z,Number(s.cell_cm)>0?Number(s.cell_cm):5,ct,lt),w=G(r.rooms,w,y,z,Number(s.cell_cm)>0?Number(s.cell_cm):5,ct,lt),w=dt(w,s.rooms||[],z,1,y.map(t=>[t[0]/lt,t[1]/lt,t[2]/lt,t[3]/lt])),C+=Math.max(0,$-w.length),w.length?s.walls=w:delete s.walls;const k=va(s.partitions||[],{pitch:z,geometry:$a(s)});k.merged&&(D+=k.merged,s.partitions=k.partitions,ya(s.openings,s.partitions,k.openingMoves,{coordScale:lt,cellCm:Number(s.cell_cm)>0?Number(s.cell_cm):5,gridPitch:ct}));const x=xn(s);if(x){const t=o(s,x,s.walls||[],y,{pitch:z,cellCm:Number(s.cell_cm)>0?Number(s.cell_cm):5,gridPitch:ct,coordScale:lt});t.partitionsReconciled&&(I+=t.partitionsReconciled,L+=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&&T++}if(c<=10){const t=function(t){const e=vn(t);return $n(t,e.config),{...e,config:t}}(n);u+=t.migratedSegments,_+=t.migratedDrafts,g+=t.migratedDraftSegments}const R=J(n),F=at(x.layout),N=JSON.stringify(R)!==l||JSON.stringify(F)!==h;c<10&&N&&(R.model_version=10);const A=JSON.stringify(R)!==l||JSON.stringify(F)!==h,E=Number.isInteger(Number(R.model_version))?Number(R.model_version):c,O=A?M:{...M,moved:0,coordsCanonicalized:0,maxShift:0,maxShiftCm:0,maxSpace:"",rotated:0},B=A?a.report:{...a.report,spaceRefsRemapped:0,roomRefsRemapped:0,positionsRemapped:0,markersDetached:0,orphanRoomLabelsRemoved:0,orphanDevicePositionsRemoved:0,orphanGroupPositionsRemoved:0,liveMissingPositionsRemoved:0};return{config:R,layout:F,report:{...O,modelFrom:c,modelTo:E,migrated:A?p:0,glowSpacesMigrated:A?d.glowSpaces:0,glowRoomsMigrated:A?d.glowRooms:0,canonicalized:A?T:0,wallSegmentsMigrated:A?u:0,roomDraftsMigrated:A?_:0,roomDraftSegmentsMigrated:A?g:0,legacyZeroWallsMigrated:A?S:0,wallsMerged:A?C:0,spansMerged:A?P:0,partitionsMerged:A?D:0,partitionsReconciled:A?I:0,openingsRehosted:A?L:0,wallsStraightened:A?v:0,wallsStraightenSkipped:y,maxStraightenShiftCm:A?$:0,maxStraightenSpace:A?w:"",latticeCoordinatesCanonicalized:A?r.canonicalized:0,latticeCoordinatesFar:A?r.far:0,latticeMaxShift:A?r.maxShift:0,latticeMaxShiftCm:A?r.maxShiftCm:0,latticeSpaces:A?r.spaces:[],...B},changed:A}}async function Dn(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 In=Object.freeze({spaces:50,partitions:2e3,openings:500,decor:1e3,columns:500});class Ln extends Error{constructor(t){super(t),this.code=t,this.name="SpaceCopyError"}}const Tn=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Rn=t=>void 0===t?t:JSON.parse(JSON.stringify(t)),zn=t=>null===t||"object"!=typeof t||Array.isArray(t)?null:t;function Fn(t,e=!1){if(void 0===t&&!e)return[];if(!Array.isArray(t))throw new Ln("source_invalid");return t.map(t=>{const e=zn(t);if(!e||"string"!=typeof e.id||!e.id)throw new Ln("source_invalid");return e})}const Nn=t=>Array.isArray(t)&&2===t.length&&t.every(t=>Number.isFinite(t));function An(t,e,s){const i=String(t??"").trim()||s,o=new Set(e.map(t=>{const e=zn(t);return String(e?.title??"").trim()}));let a=2;for(;o.has(`${i} (${a})`);)a++;return`${i} (${a})`}const En=["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 On={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 Bn=0;function Hn(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 Wn(t){t._cfgEpoch++,t._modelCache=null,t._frame=null,t._regSignature="",t._maybeRebuildDevices(),t.requestUpdate()}async function jn(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=++Bn,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,!Hn(t,i,!0)||!t._serverCfg)return;const s=t._cfgRev,r=t._layoutRev,l=yt(t._serverCfg),h=yt(t._layout);let c;try{c=(e.optimize??Pn)(t._serverCfg,t._layout,e.optimizeReferenceContext())}catch(s){return Hn(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 Hn(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(!Hn(t,i,p))return;if(!p)return;if(t._cfgRev!==s||t._layoutRev!==r||!t._serverCfg||yt(t._serverCfg)!==l||yt(t._layout)!==h)return Hn(t,i,!1),void t._showToast(t._t("space.copy_error_changed"));e.clearGeometryGesture(),await Dn(t,c.config,c.layout),n=!0}if(!Hn(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 Ln("source_invalid");if(o.length>=In.spaces)throw new Ln("spaces_limit");const a=o.findIndex(t=>t.id===e);if(a<0)throw new Ln("source_missing");const n=o[a];if(!Array.isArray(n.view_box))throw new Ln("source_invalid");const r=Fn(n.wall_segments,!0),l=Fn(n.partitions),h=Fn(n.openings),c=Fn(n.decor),d=Fn(n.wall_columns);if(r.length+l.length>In.partitions)throw new Ln("partitions_limit");if(h.length>In.openings)throw new Ln("openings_limit");if(c.length>In.decor)throw new Ln("decor_limit");if(d.length>In.columns)throw new Ln("columns_limit");let p=0;const u=t=>`${t}${i}${(p++).toString(36)}`,_=new Map,g=new Map,m=[];for(const t of r){if(_.has(t.id)||!Nn(t.a)||!Nn(t.b)||"number"!=typeof t.cm||!Number.isFinite(t.cm))throw new Ln("source_invalid");const e=u("cw");_.set(t.id,e),m.push({id:e,a:Rn(t.a),b:Rn(t.b),cm:t.cm})}for(const t of l){if(g.has(t.id)||!Nn(t.a)||!Nn(t.b)||"number"!=typeof t.cm||!Number.isFinite(t.cm))throw new Ln("source_invalid");const e=u("cp");g.set(t.id,e),m.push({id:e,a:Rn(t.a),b:Rn(t.b),cm:t.cm})}const f=h.map(t=>{const e=zn(t.host);if(!e||"string"!=typeof e.id||"string"!=typeof e.kind)throw new Ln("opening_host_missing");const s="wall"===e.kind?_.get(e.id):"partition"===e.kind?g.get(e.id):void 0;if(!s)throw new Ln("opening_host_unknown");const i={...Rn(t),id:u("co"),host:{...Rn(e),kind:"partition",id:s}};return delete i.contact,delete i.lock,i}),b=c.map(t=>({...Rn(t),id:u("cd")})),v=d.map(t=>({...Rn(t),id:u("cc")})),y=`s${i}`;if(o.some(t=>t.id===y))throw new Ln("source_invalid");const $={id:y,title:s.trim(),rooms:[],wall_segments:[],view_box:Rn(n.view_box)};for(const t of En)"view_box"!==t&&Tn(n,t)&&($[t]=Rn(n[t]));m.length&&($.partitions=m),f.length&&($.openings=f),b.length&&($.decor=b),v.length&&($.wall_columns=v);const w=Rn(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 Ln("geometry_unsafe");const _=t._adoption.beginOptimistic(d,p.config);t._adoption.stageLocalConfig(p.config),Wn(t);try{await e.saveConfigNow(_)}catch(e){throw t._rollbackOptimistic(_)&&Wn(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()]),Hn(t,i,!1),function(t,e){if(e instanceof Ln)return void t._showToast(t._t(On[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 Gn=1e3;function qn(){const t=this.host._spaceDialog;if(t.copy)return function(t,e){const s=t._spaceDialog.copy,i=()=>function(t){const e=t._spaceDialog;!e?.copy||e.busy||e.copy.busy||(t._spaceDialog={...e,copy:void 0})}(t);return p`
    @@ -571,7 +571,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0
    @@ -588,7 +588,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0
    `:d}`:d}`}function ir(){!function(t){const e=t.renderRoot;if(!e||Jn.has(e))return;const s=e.ownerDocument??globalThis.document,i=s?.defaultView?.CSSStyleSheet;if(i&&"adoptedStyleSheets"in e)return Yn||(Yn=new i,Yn.replaceSync(Vn)),e.adoptedStyleSheets=[...e.adoptedStyleSheets,Yn],void Jn.add(e);if(e.querySelector("style[data-hp-form-kit]"))return void Jn.add(e);const o=s.createElement("style");o.dataset.hpFormKit="true",o.textContent=Vn,e.appendChild(o),Jn.add(e)}(this.host);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=_(this.host._curSpaceCfg),o=this.host._roomFill||i.fill,a=this.host._roomCustomFill||i.customFill,n=At(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``:d}`:d}`}function ir(){!function(t){const e=t.renderRoot;if(!e||Jn.has(e))return;const s=e.ownerDocument??globalThis.document,i=s?.defaultView?.CSSStyleSheet;if(i&&"adoptedStyleSheets"in e)return Zn||(Zn=new i,Zn.replaceSync(Vn)),e.adoptedStyleSheets=[...e.adoptedStyleSheets,Zn],void Jn.add(e);if(e.querySelector("style[data-hp-form-kit]"))return void Jn.add(e);const o=s.createElement("style");o.dataset.hpFormKit="true",o.textContent=Vn,e.appendChild(o),Jn.add(e)}(this.host);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=_(this.host._curSpaceCfg),o=this.host._roomFill||i.fill,a=this.host._roomCustomFill||i.customFill,n=zt(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?p`

    ${s}

    `:d} - ${Xn({title:this.host._t("room.group_basics"),help:this._help("room.group_basics.help"),body:p` + ${Yn({title:this.host._t("room.group_basics"),help:this._help("room.group_basics.help"),body:p` ${this.host._t("room.no_area_option")} ${l.map(t=>p``)} `})} - ${Xn({title:this.host._t("room.group_fill"),help:this._help("room.group_fill.help"),body:p` + ${Yn({title:this.host._t("room.group_fill"),help:this._help("room.group_fill.help"),body:p` ${er.map(({value:t,key:e})=>p`
    @@ -954,20 +954,20 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 ${this.host._t("btn.save")} `}
    -
    `}const or=new WeakMap;function ar(t,e,s){let i=or.get(t);i||(i=new Map,or.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 nr(t,e){const s=or.get(t),i=s?.get(e);i&&(s.delete(e),i.run())}function rr(t,e){const s=or.get(t);if(!s)return;const i=e?[...s].filter(([t])=>t===e):[...s];for(const[t]of i)s.delete(t);s.size||or.delete(t)}const lr=new WeakMap,hr=new Set(["_cursorPt","_opMeasure","_physicalDrag","_physicalRotate","_decorDraft","_dtBox","_dtDrag","_bdDrag","_furnPreviewInput","_layout"]),cr=new Set(["_cursorPt","_opMeasure","_furnPreviewInput"]),dr=new Set(["_physicalDrag","_physicalRotate","_decorDraft","_dtDrag","_bdDrag"]),pr=t=>{let e=lr.get(t);return e||(e={raf:0,requestedRevision:0,paintedRevision:0,waiters:[],hidden:[],transparent:[],dimmed:[]},lr.set(t,e)),e},ur=(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()},_r=t=>!!("view"!==t._mode&&(t._deviceDrag||t._physicalDrag||t._physicalRotate||t._decorDraft||t._decorMove||t._dtDrag||t._bdDrag||t._opDrag||t._resize?.dragging));function mr(t,e,s){const i=t;if(!i?.isConnected||"view"===i._mode)return!1;const o=void 0!==e&&hr.has(e);if("_layout"===e&&!i._deviceDrag)return!1;if("_dtBox"===e&&!i._dtDrag)return!1;if(void 0!==e&&dr.has(e)&&null==s&&null!=i[e]&&_r(i))return!1;if(void 0!==e&&dr.has(e)&&null==i[e])return!1;if(void 0!==e&&cr.has(e)&&null==i[e])return!1;return!!(o&&(cr.has(e)||_r(i))||void 0===e&&_r(i))&&(function(t){const e=pr(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=pr(e);br(i),$r(e,s);const o=s.querySelector("[data-hp-live-editor]");if(!o)return;if(fr(i,s,".hp-editor-only-layer:not(.hp-plan-snap-layer)"),"plan"===e._mode)e._opDrag&&gr(i,s,".wallbodies"),e._resize?.dragging&&(xr(i,s,".wallbodies"),fr(i,s,".resize-layer"),kr(i,s,e._resize.plan?.movingOpeningIds||[])),e._opDrag&&fr(i,s,".openinglayer");else if("decor"===e._mode){const t=e._dtDrag?.id||e._decorMove?.id;t&&wr(i,s,t),fr(i,s,".dtframe, .backdropframe")}Nt(yr(e),o);const a=s.querySelector("[data-hp-live-editor-html]");if(a){const t=e._viewOr(e._baseVb());Nt(e._renderLiveEditorMeasurements(t),a)}e._liveEditorPaintCount=(e._liveEditorPaintCount||0)+1}(t),ur(e,s)})}(i),!0)}const gr=(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))},fr=(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))},br=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},vr=(t,e,s=[])=>{if("iso"===t._renderProjection)return Et``;const i=t._spaceModel();if(!i)return Et``;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*lt),s=(t.b||[]).map(t=>t*lt);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=V(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*lt),(e.b||[]).map(t=>t*lt),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=>Ht(t,l)).filter(Boolean);if(!h.length)return Et``;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=Ot(c,p)||Lt(Bt(t._cellCm),p),_=e?.color||"#607d8b",m=t._fillColors.wall_fill,g=h.join(" ");return Et` - +
    `}const or=new WeakMap;function ar(t,e,s){let i=or.get(t);i||(i=new Map,or.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 nr(t,e){const s=or.get(t),i=s?.get(e);i&&(s.delete(e),i.run())}function rr(t,e){const s=or.get(t);if(!s)return;const i=e?[...s].filter(([t])=>t===e):[...s];for(const[t]of i)s.delete(t);s.size||or.delete(t)}const lr=new WeakMap,hr=new Set(["_cursorPt","_opMeasure","_physicalDrag","_physicalRotate","_decorDraft","_dtBox","_dtDrag","_bdDrag","_furnPreviewInput","_layout"]),cr=new Set(["_cursorPt","_opMeasure","_furnPreviewInput"]),dr=new Set(["_physicalDrag","_physicalRotate","_decorDraft","_dtDrag","_bdDrag"]),pr=t=>{let e=lr.get(t);return e||(e={raf:0,requestedRevision:0,paintedRevision:0,waiters:[],hidden:[],transparent:[],dimmed:[]},lr.set(t,e)),e},ur=(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()},_r=t=>!!("view"!==t._mode&&(t._deviceDrag||t._physicalDrag||t._physicalRotate||t._decorDraft||t._decorMove||t._dtDrag||t._bdDrag||t._opDrag||t._resize?.dragging));function gr(t,e,s){const i=t;if(!i?.isConnected||"view"===i._mode)return!1;const o=void 0!==e&&hr.has(e);if("_layout"===e&&!i._deviceDrag)return!1;if("_dtBox"===e&&!i._dtDrag)return!1;if(void 0!==e&&dr.has(e)&&null==s&&null!=i[e]&&_r(i))return!1;if(void 0!==e&&dr.has(e)&&null==i[e])return!1;if(void 0!==e&&cr.has(e)&&null==i[e])return!1;return!!(o&&(cr.has(e)||_r(i))||void 0===e&&_r(i))&&(function(t){const e=pr(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=pr(e);br(i),$r(e,s);const o=s.querySelector("[data-hp-live-editor]");if(!o)return;if(fr(i,s,".hp-editor-only-layer:not(.hp-plan-snap-layer)"),"plan"===e._mode)e._opDrag&&mr(i,s,".wallbodies"),e._resize?.dragging&&(xr(i,s,".wallbodies"),fr(i,s,".resize-layer"),kr(i,s,e._resize.plan?.movingOpeningIds||[])),e._opDrag&&fr(i,s,".openinglayer");else if("decor"===e._mode){const t=e._dtDrag?.id||e._decorMove?.id;t&&wr(i,s,t),fr(i,s,".dtframe, .backdropframe")}Nt(yr(e),o);const a=s.querySelector("[data-hp-live-editor-html]");if(a){const t=e._viewOr(e._baseVb());Nt(e._renderLiveEditorMeasurements(t),a)}e._liveEditorPaintCount=(e._liveEditorPaintCount||0)+1}(t),ur(e,s)})}(i),!0)}const mr=(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))},fr=(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))},br=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},vr=(t,e,s=[])=>{if("iso"===t._renderProjection)return At``;const i=t._spaceModel();if(!i)return At``;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*lt),s=(t.b||[]).map(t=>t*lt);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=V(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*lt),(e.b||[]).map(t=>t*lt),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=>Et(t,l)).filter(Boolean);if(!h.length)return At``;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=Ot(c,p)||Bt(Ht(t._cellCm),p),_=e?.color||"#607d8b",g=t._fillColors.wall_fill,m=h.join(" ");return At` + - `},yr=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 Et``},yr=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 At``}const o=t._spaceDisplayForRender();return Et``}const o=t._spaceDisplayForRender();return At``})(t);if("decor"===t._mode){const e=t._viewOr(t._baseVb()),s=t._dtDrag?.id||t._decorMove?.id||null;return Et``})(t);if("decor"===t._mode){const e=t._viewOr(t._baseVb()),s=t._dtDrag?.id||t._decorMove?.id||null;return At``}return Et``}return At``},$r=(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+"%"},wr=(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))},kr=(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))},xr=(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 Sr=(t,e,s)=>Math.min(s,Math.max(e,Number.isFinite(t)?t:e));function Mr(t){return Number.isFinite(t)?(t%360+360)%360:0}function Cr(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 Pr(t){const e=Cr(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 Dr(t){const e=Sr(t.r,0,255)/255,s=Sr(t.g,0,255)/255,i=Sr(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:Mr(n),s:0===o?0:a/o*100,v:100*o}}function Ir(t){return function(t){const e=t=>Math.round(Sr(t,0,255)).toString(16).padStart(2,"0");return`#${e(t.r)}${e(t.g)}${e(t.b)}`}(function(t){const e=Mr(t.h),s=Sr(t.s,0,100)/100,i=Sr(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 Tr={title:"Color picker",hue:"Hue",saturation:"Saturation",value:"Brightness",hex:"Hex color",invalidHex:"Enter a 3- or 6-digit hex color",confirm:"OK"};class zr extends Gt{constructor(){super(...arguments),this.label="",this.opacityLabel="Opacity",this.color="#607d8b",this.opacity=1,this.disabled=!1,this.showOpacity=!0,this.pickerLabels=Tr,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 bo(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=Cr(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=zr.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=vo(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=yo(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||Tr;return{title:t.title||Tr.title,hue:t.hue||Tr.hue,saturation:t.saturation||Tr.saturation,value:t.value||Tr.value,hex:t.hex||Tr.hex,invalidHex:t.invalidHex||Tr.invalidHex,confirm:t.confirm||Tr.confirm}}_syncFromColor(t,e){const s=Cr(qt(t,"#607d8b"))||"#607d8b",i=Pr(s);if(!i)return;const o=Dr(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(Ir({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=Cr(e),i=s?Pr(s):null;if(!s||!i)return void(this._hexInvalid=this._hexNeedsValidInput);this._hexNeedsValidInput=!1,this._hexInvalid=!1;const o=Dr(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=Cr(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=Cr(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=Ir({h:this._hue,s:this._saturation,v:this._value}),i=Ir({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 p` + `},$r=(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+"%"},wr=(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))},kr=(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))},xr=(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 Mr=(t,e,s)=>Math.min(s,Math.max(e,Number.isFinite(t)?t:e));function Cr(t){return Number.isFinite(t)?(t%360+360)%360:0}function Sr(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 Pr(t){const e=Sr(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 Dr(t){const e=Mr(t.r,0,255)/255,s=Mr(t.g,0,255)/255,i=Mr(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:Cr(n),s:0===o?0:a/o*100,v:100*o}}function Ir(t){return function(t){const e=t=>Math.round(Mr(t,0,255)).toString(16).padStart(2,"0");return`#${e(t.r)}${e(t.g)}${e(t.b)}`}(function(t){const e=Cr(t.h),s=Mr(t.s,0,100)/100,i=Mr(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 Lr={title:"Color picker",hue:"Hue",saturation:"Saturation",value:"Brightness",hex:"Hex color",invalidHex:"Enter a 3- or 6-digit hex color",confirm:"OK"};class Tr extends Gt{constructor(){super(...arguments),this.label="",this.opacityLabel="Opacity",this.color="#607d8b",this.opacity=1,this.disabled=!1,this.showOpacity=!0,this.pickerLabels=Lr,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 bo(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=Sr(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=Tr.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=vo(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=yo(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||Lr;return{title:t.title||Lr.title,hue:t.hue||Lr.hue,saturation:t.saturation||Lr.saturation,value:t.value||Lr.value,hex:t.hex||Lr.hex,invalidHex:t.invalidHex||Lr.invalidHex,confirm:t.confirm||Lr.confirm}}_syncFromColor(t,e){const s=Sr(qt(t,"#607d8b"))||"#607d8b",i=Pr(s);if(!i)return;const o=Dr(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(Ir({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=Sr(e),i=s?Pr(s):null;if(!s||!i)return void(this._hexInvalid=this._hexNeedsValidInput);this._hexNeedsValidInput=!1,this._hexInvalid=!1;const o=Dr(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=Sr(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=Sr(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=Ir({h:this._hue,s:this._saturation,v:this._value}),i=Ir({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 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(Ac(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=Ac(t,t=>t.classList.contains("editor-secondary")),i=Ac(t,t=>!!t.dataset.editorGroup),o=Ac(t,t=>!!t.dataset.editorPalette),a=Ac(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 Nc=t=>t.stopPropagation(),Ec=new WeakSet,Hc=t=>{t._regSignature="",t._maybeRebuildDevices(),t.requestUpdate()};async function Oc(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:Lo(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),Hc(n),n._saveConfigDebounced.pending()&&n._saveConfigDebounced.cancel();try{return await t._saveConfigNow(c),!0}catch(t){return n._rollbackOptimistic(c),Hc(n),n._showToast(n._t("toast.cfg_save_failed",{err:n._errText(t)})),!1}}function Lc(t){return 1===t}function Bc(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?Bc("report"):t.idempotencyKey,fingerprint:e}}function jc(t){return[...t].length}function Gc(t,e=Date.now()){const s=t.message.trim();return s?jc(s)>1e4?"message_too_long":jc(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 qc(t,e=Date.now()){return"building"!==t.status&&"sending"!==t.status&&"success"!==t.status&&null===Gc(t,e)}function Uc(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 Vc=[{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:"M 60.752 62.03 l -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 M 73.113 28.633 l -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 M 56.75 45.5 l 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 Jc{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=$e(s.width,s.height),n=we(a.w,this.host._cellCm,this.host._gridPitch)/lt,r=we(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:le(o[0]/lt-n/2),y:le(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=$e(e.width,e.height),o=we(i.w,this.host._cellCm,this.host._gridPitch)/lt,a=we(i.h,this.host._cellCm,this.host._gridPitch)/this.host._decorH,n=this.host._display(e.url);return n?Et``}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(zc(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=zc(t,t=>t.classList.contains("editor-secondary")),i=zc(t,t=>!!t.dataset.editorGroup),o=zc(t,t=>!!t.dataset.editorPalette),a=zc(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 Nc=t=>t.stopPropagation(),Ac=new WeakSet,Ec=t=>{t._regSignature="",t._maybeRebuildDevices(),t.requestUpdate()};async function Oc(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:Bo(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),Ec(n),n._saveConfigDebounced.pending()&&n._saveConfigDebounced.cancel();try{return await t._saveConfigNow(c),!0}catch(t){return n._rollbackOptimistic(c),Ec(n),n._showToast(n._t("toast.cfg_save_failed",{err:n._errText(t)})),!1}}function Bc(t){return 1===t}function Hc(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?Hc("report"):t.idempotencyKey,fingerprint:e}}function jc(t){return[...t].length}function Gc(t,e=Date.now()){const s=t.message.trim();return s?jc(s)>1e4?"message_too_long":jc(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 qc(t,e=Date.now()){return"building"!==t.status&&"sending"!==t.status&&"success"!==t.status&&null===Gc(t,e)}function Uc(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 Vc=[{id:"air_conditioner",group:"appliance",art:{d:"M85 71.5 L85 63 M25 71.5 L25 63 M25 71.5 L89.5 71.5 C90.8807 71.5 92 70.3807 92 69 L92 41.5 C92 40.1193 90.8807 39 89.5 39 L20.5 39 C19.1193 39 18 40.1193 18 41.5 L18 69 C18 70.3807 19.1193 71.5 20.5 71.5 L25 71.5 Z M85 63 C85 61.6193 83.8807 60.5 82.5 60.5 L27.5 60.5 C26.1193 60.5 25 61.6193 25 63 M85 63 L85 66.5 L25 66.5 L25 63",viewW:110,viewH:110}},{id:"armchair",group:"furniture",art:{d:"M77.5 48.5 L77.5 39 C77.5 33.4772 73.0228 29 67.5 29 L42.5 29 C36.9772 29 32.5 33.4772 32.5 39 L32.5 48.5205 M77.5 48.5 C80.8137 48.5 83.5 51.1863 83.5 54.5 C83.5 57.1123 81.8302 59.3334 79.5 60.1572 L79.5 71.5 C79.5 73.7091 77.7091 75.5 75.5 75.5 M77.5 48.5 C74.2576 48.5 71.617 51.072 71.5049 54.2871 C71.5012 54.3576 71.5 54.4286 71.5 54.5 L71.5 61.75 M38 61.75 L38 54 C38 53.2396 37.7873 52.5291 37.4189 51.9238 C36.5228 50.0421 34.6765 48.7002 32.5 48.5205 M32.5 48.5205 C32.3351 48.5069 32.1684 48.5 32 48.5 M75.5 75.5 L34 75.5 M75.5 75.5 L72.5 75.5 M34 75.5 C31.7909 75.5 30 73.7091 30 71.5 L30 60.1572 C27.6698 59.3334 26 57.1123 26 54.5 C26 51.1863 28.6863 48.5 32 48.5 M34 75.5 L36.5 75.5 M32 48.5 C34.3914 48.5 36.4549 49.8996 37.4189 51.9238 M38 61.75 C38 64.3734 40.1266 66.5 42.75 66.5 L66.75 66.5 C69.3734 66.5 71.5 64.3734 71.5 61.75 M38 61.75 C38 59.1266 40.1266 57 42.75 57 L66.75 57 C69.3734 57 71.5 59.1266 71.5 61.75 M36.5 75.5 L44.5 75.5 M36.5 75.5 L36.5 80.5 C36.5 81.3284 37.1716 82 38 82 L41.3921 82 C42.0506 82 42.6321 81.5705 42.8258 80.9411 L44.5 75.5 M44.5 75.5 L64.5 75.5 M72.5 75.5 L64.5 75.5 M72.5 75.5 L72.5 80.5 C72.5 81.3284 71.8284 82 71 82 L67.6079 82 C66.9494 82 66.3679 81.5705 66.1742 80.9411 L64.5 75.5",viewW:110,viewH:110}},{id:"bathtub",group:"sanitary",art:{d:"M28 74.8457 L28 80 C28 80.8284 28.6716 81.5 29.5 81.5 L32.8921 81.5 C33.5506 81.5 34.1321 81.0705 34.3258 80.4411 L35.6923 76 M28.0191 74.8558 C28.0127 74.8524 28.0063 74.8491 28 74.8457 C25.4198 73.4833 23.483 71.0169 22.8673 67.9996 M19.5 51.5 L90 51.5 M19.5 51.5 C18.1193 51.5 17 50.3807 17 49 C17 47.6193 18.1193 46.5 19.5 46.5 M19.5 51.5 L22.8673 67.9996 M90 51.5 C91.3807 51.5 92.5 50.3807 92.5 49 C92.5 47.6193 91.3807 46.5 90 46.5 M90 51.5 L86.6327 67.9996 C85.9778 71.2088 83.8285 73.7948 81 75.0922 M90 46.5 L19.5 46.5 M90 46.5 L20 46.5 M19.5 46.5 L20 46.5 M22.8673 67.9996 C23.4846 71.0243 25.4293 73.4954 28.0191 74.8558 M30 36 L30 34 C30 32.6739 29.4732 31.4021 28.5355 30.4645 C27.5979 29.5268 26.3261 29 25 29 C23.6739 29 22.4021 29.5268 21.4645 30.4645 C20.5268 31.4021 20 32.6739 20 34 L20 46.5 M81 75.0922 C79.7247 75.6771 78.3114 76 76.8347 76 L73.3077 76 M81 75.0922 L81 80 C81 80.8284 80.3284 81.5 79.5 81.5 L76.1079 81.5 C75.4494 81.5 74.8679 81.0705 74.6742 80.4411 L73.3077 76 M73.3077 76 L35.6923 76 M35.6923 76 L32.6653 76 C31.1128 76 29.6303 75.643 28.3047 75 C28.2086 74.9534 28.1134 74.9053 28.0191 74.8558",viewW:110,viewH:110}},{id:"bed",group:"furniture",art:{d:"M16 75.5 L24 75.5 M16 75.5 L16 80.5 C16 81.3284 16.6716 82 17.5 82 L20.8921 82 C21.5506 82 22.1321 81.5705 22.3258 80.9411 L24 75.5 M16 75.5 L15 75.5 M24 75.5 L86.5 75.5 M94.5 75.5 L86.5 75.5 M94.5 75.5 L94.5 80.5 C94.5 81.3284 93.8284 82 93 82 L89.6079 82 C88.9494 82 88.3679 81.5705 88.1742 80.9411 L86.5 75.5 M94.5 75.5 L95.5 75.5 M88 50.1296 L88 31.5 C88 30.1193 86.8807 29 85.5 29 L25 29 C23.6193 29 22.5 30.1193 22.5 31.5 L22.5 50.1296 M87.9383 50.1068 C87.9589 50.1143 87.9795 50.1219 88 50.1296 C91.7967 51.5483 94.5 55.2085 94.5 59.5 M22.5617 50.1068 C22.5411 50.1143 22.5205 50.1219 22.5 50.1296 C18.7033 51.5483 16 55.2085 16 59.5 M94.5 65.5 L94.5 59.5 M94.5 65.5 L16 65.5 M94.5 65.5 L95.5 65.5 M16 65.5 L16 59.5 M16 65.5 L15 65.5 M84.5 49.5 L26 49.5 M84.5 49.5 L80 49.5 M94.5 59.5 C94.5 55.1853 91.7674 51.5088 87.9383 50.1068 C86.8662 49.7142 85.7081 49.5 84.5 49.5 M26 49.5 L30.5 49.5 M16 59.5 C16 55.1853 18.7326 51.5088 22.5617 50.1068 C23.6338 49.7142 24.7919 49.5 26 49.5 M15 75.5 L95.5 75.5 M15 75.5 C14.4477 75.5 14 75.0523 14 74.5 L14 66.5 C14 65.9477 14.4477 65.5 15 65.5 M95.5 75.5 C96.0523 75.5 96.5 75.0523 96.5 74.5 L96.5 66.5 C96.5 65.9477 96.0523 65.5 95.5 65.5 M95.5 65.5 L15 65.5 M51.5 49.5 L51.5 45.5 C51.5 42.7386 49.2614 40.5 46.5 40.5 L35.5 40.5 C32.7386 40.5 30.5 42.7386 30.5 45.5 L30.5 49.5 M51.5 49.5 L30.5 49.5 M51.5 49.5 L59 49.5 M80 49.5 L80 45.5 C80 42.7386 77.7614 40.5 75 40.5 L64 40.5 C61.2386 40.5 59 42.7386 59 45.5 L59 49.5 M80 49.5 L59 49.5",viewW:110,viewH:110}},{id:"bidet",group:"sanitary",art:{d:"M46 67.5 L64.5 67.5 M46 67.5 C40.4772 67.5 36 63.0228 36 57.5 L36 53 M46 67.5 C45.4902 67.5 44.9893 67.4618 44.5 67.3882 L44.5 79.5 C44.5 80.0523 44.9477 80.5 45.5 80.5 L65 80.5 C65.5523 80.5 66 80.0523 66 79.5 L66 67.3882 C65.5107 67.4618 65.0098 67.5 64.5 67.5 M64.5 67.5 C70.0229 67.5 74.5 63.0228 74.5 57.5 L74.5 53 M74.5 53 L74.5 47.5 C74.5 46.9477 74.0523 46.5 73.5 46.5 M74.5 53 L36 53 M36 53 L36 47.5 C36 46.9477 36.4477 46.5 37 46.5 M73.5 46.5 L37 46.5 M73.5 46.5 L60 46.5 M37 46.5 L50.5 46.5 M51.5 40 L59 40 M51.5 40 C50.9477 40 50.5 40.4477 50.5 41 L50.5 46.5 M51.5 40 L53 40 M59 40 C59.5523 40 60 40.4477 60 41 L60 46.5 M59 40 L57.5 40 M60 46.5 L50.5 46.5 M57.5 40 L57.5 30 C57.5 29.4477 57.0523 29 56.5 29 L54 29 C53.4477 29 53 29.4477 53 30 M57.5 40 L53 40 M53 40 L53 30 M53 40 L53 36 M53 30 L53 31.5 M53 31.5 L49 31.5 C48.4477 31.5 48 31.9477 48 32.5 L48 35 C48 35.5523 48.4477 36 49 36 L53 36 M53 31.5 L53 36",viewW:110,viewH:110}},{id:"boiler",group:"appliance",art:{d:"M51.5 81.5 L51.5 86 C51.5 86.5523 51.0523 87 50.5 87 L47.5 87 C46.9477 87 46.5 86.5523 46.5 86 L46.5 81.5 M51.5 81.5 L46.5 81.5 M51.5 81.5 L59 81.5 M46.5 81.5 L44 81.5 M64 81.5 L64 86 C64 86.5523 63.5523 87 63 87 L60 87 C59.4477 87 59 86.5523 59 86 L59 81.5 M64 81.5 L59 81.5 M64 81.5 L66.5 81.5 M74.5 73 L74.5 73.5 C74.5 77.9183 70.9183 81.5 66.5 81.5 M44 81.5 C39.5817 81.5 36 77.9183 36 73.5 L36 73 L36 31 C36 26.5817 39.5817 23 44 23 L66.5 23 C70.9183 23 74.5 26.5817 74.5 31 L74.5 73 M74.5 73 L36 73 M66.5 81.5 L44 81.5 M55 42.5 L58.5 39 M62.5 42.5 C62.5 46.366 59.366 49.5 55.5 49.5 C51.634 49.5 48.5 46.366 48.5 42.5 C48.5 38.634 51.634 35.5 55.5 35.5 C59.366 35.5 62.5 38.634 62.5 42.5 Z",viewW:110,viewH:110}},{id:"chair",group:"furniture",art:{d:"M41.25 60.5 L68.75 60.5 M68.75 60.5 C70.5449 60.5 72 59.0449 72 57.25 C72 55.6281 70.8119 54.2836 69.2585 54.0395 C69.0928 54.0135 68.923 54 68.75 54 L41.25 54 C41.077 54 40.9072 54.0135 40.7415 54.0395 C39.1881 54.2836 38 55.6281 38 57.25 C38 59.0449 39.4551 60.5 41.25 60.5 M41.25 60.5 L46 60.5 M68.75 60.5 L64 60.5 M64 60.5 L69.5 60.5 L69.5 82 C69.5 82.8284 68.8284 83.5 68 83.5 L67.3752 83.5 C66.5972 83.5 65.9483 82.9051 65.8809 82.1299 L64 60.5 Z M64 60.5 L46 60.5 M46 60.5 L40.5 60.5 L40.5 82 C40.5 82.8284 41.1716 83.5 42 83.5 L42.6248 83.5 C43.4028 83.5 44.0517 82.9051 44.1191 82.1299 L46 60.5 Z M40.7415 54.0395 C40.5847 53.5546 40.5 53.0372 40.5 52.5 L40.5 39.5 C40.5 32.5964 46.0964 27 53 27 L57 27 C63.9036 27 69.5 32.5964 69.5 39.5 L69.5 52.5 C69.5 53.0372 69.4153 53.5546 69.2585 54.0395",viewW:110,viewH:110}},{id:"coffee_table",group:"furniture",art:{d:"M85.2381 55 L86.5 55 C87.0523 55 87.5 54.5523 87.5 54 L87.5 51 L84.6598 43.4847 C84.2586 42.5818 83.3633 42 82.3753 42 L26.6247 42 C25.6367 42 24.7414 42.5818 24.3402 43.4847 L21.5 51 L21.5 54 C21.5 54.5523 21.9477 55 22.5 55 L25 55 M87.5 51 L21.5 51 M25 55 L25 66.5 C25 67.3284 25.6716 68 26.5 68 L27.2113 68 C27.983 68 28.6288 67.4144 28.7041 66.6464 L29.8459 55 M25 55 L29.8459 55 M29.8459 55 L80.3922 55 M80.3922 55 L81.534 66.6464 C81.6093 67.4144 82.2551 68 83.0268 68 L83.7381 68 C84.5665 68 85.2381 67.3284 85.2381 66.5 L85.2381 55 M80.3922 55 L85.2381 55",viewW:110,viewH:110}},{id:"computer",group:"appliance",art:{d:"M43 65 L48 65 M43 65 L24.5 65 C23.1193 65 22 63.8807 22 62.5 L22 40.5 C22 39.1193 23.1193 38 24.5 38 L64.5 38 C65.8807 38 67 39.1193 67 40.5 L67 62.5 C67 63.8807 65.8807 65 64.5 65 L48 65 M43 65 L43 72 M48 65 L48 72 M37 72 L43 72 M54.0711 72 L48 72 M76 60 L84 60 M76 43 L84 43 M35 53 L35 46 L39.5 46 C40.4283 46 41.3185 46.3687 41.9749 47.0251 C42.6313 47.6815 43 48.5717 43 49.5 C43 50.4283 42.6312 51.3185 41.9749 51.9749 C41.3185 52.6313 40.4283 53 39.5 53 L35 53 Z M35 53 L35 56 M54.5355 54.5355 C53.8363 55.2348 52.9454 55.711 51.9755 55.9039 C51.0055 56.0969 50.0002 55.9978 49.0866 55.6194 C48.173 55.241 47.3921 54.6001 46.8427 53.7779 C46.2932 52.9556 46 51.9889 46 51 C46 50.0111 46.2932 49.0444 46.8427 48.2221 C47.3921 47.3999 48.173 46.759 49.0866 46.3806 C50.0002 46.0022 51.0055 45.9031 51.9755 46.0961 C52.9454 46.289 53.8363 46.7652 54.5355 47.4645 M48 72 L43 72 M74.5 72 L85.5 72 C86.8807 72 88 70.8807 88 69.5 L88 40.5 C88 39.1193 86.8807 38 85.5 38 L74.5 38 C73.1193 38 72 39.1193 72 40.5 L72 69.5 C72 70.8807 73.1193 72 74.5 72 Z",viewW:110,viewH:110}},{id:"cooktop",group:"appliance",art:{d:"M25 31.5 C25 30.1193 26.1193 29 27.5 29 L82.5 29 C83.8807 29 85 30.1193 85 31.5 L85 78.5 C85 79.8807 83.8807 81 82.5 81 L27.5 81 C26.1193 81 25 79.8807 25 78.5 L25 31.5 Z M49.5 66.5 C49.5 70.9183 45.9183 74.5 41.5 74.5 C37.0817 74.5 33.5 70.9183 33.5 66.5 C33.5 62.0817 37.0817 58.5 41.5 58.5 C45.9183 58.5 49.5 62.0817 49.5 66.5 Z M76 43.5 C76 47.9183 72.4183 51.5 68 51.5 C63.5817 51.5 60 47.9183 60 43.5 C60 39.0817 63.5817 35.5 68 35.5 C72.4183 35.5 76 39.0817 76 43.5 Z M73 66.5 C73 69.2614 70.7614 71.5 68 71.5 C65.2386 71.5 63 69.2614 63 66.5 C63 63.7386 65.2386 61.5 68 61.5 C70.7614 61.5 73 63.7386 73 66.5 Z M49.5 43.5 C49.5 47.9183 45.9183 51.5 41.5 51.5 C37.0817 51.5 33.5 47.9183 33.5 43.5 C33.5 39.0817 37.0817 35.5 41.5 35.5 C45.9183 35.5 49.5 39.0817 49.5 43.5 Z",viewW:110,viewH:110}},{id:"dining_table",group:"furniture",art:{d:"M26.875 47 L23.5 47 C22.9477 47 22.5 46.5523 22.5 46 L22.5 43 L24.8802 35.5939 C25.2539 34.633 26.1791 34 27.2102 34 L83.7898 34 C84.8209 34 85.7462 34.633 86.1198 35.5939 L88.5 43 L88.5 46 C88.5 46.5523 88.0523 47 87.5 47 L84.125 47 M22.5 43 L88.5 43 M78.875 47 L84.742 73.8205 C84.8926 74.5092 85.5024 75 86.2073 75 L86.7474 75 C87.6682 75 88.3716 74.1781 88.2294 73.2684 L84.125 47 M78.875 47 L84.125 47 M78.875 47 L32.125 47 M32.125 47 L26.258 73.8205 C26.1074 74.5092 25.4976 75 24.7927 75 L24.2526 75 C23.3318 75 22.6284 74.1781 22.7706 73.2684 L26.875 47 M32.125 47 L26.875 47",viewW:110,viewH:110}},{id:"dishwasher",group:"appliance",art:{d:"M81 82.5 L81 27.5 M81 82.5 C81 83.8807 79.8807 85 78.5 85 L31.5 85 C30.1193 85 29 83.8807 29 82.5 L29 55.5 M81 82.5 L81 40 M81 27.5 C81 26.1193 79.8807 25 78.5 25 L31.5 25 C30.1193 25 29 26.1193 29 27.5 M81 27.5 L81 40 M29 27.5 L29 55.5 M29 27.5 L29 40 M81 40 C81 38.6193 79.8807 37.5 78.5 37.5 L31.5 37.5 C30.1193 37.5 29 38.6193 29 40 M29 40 L29 55.5 M35.75 31 L45.25 31 M55.9943 55 C55.9943 55 54.6654 56.8105 54.5153 58.1429 C54.3169 59.9042 56.1139 60.6968 55.9943 62.4643 C55.8942 63.9429 54.5153 66 54.5153 66 M60.4943 55 C60.4943 55 59.1654 56.8105 59.0153 58.1429 C58.8169 59.9042 60.6139 60.6968 60.4943 62.4643 C60.3942 63.9429 59.0153 66 59.0153 66 M50.9943 55 C50.9943 55 49.6654 56.8105 49.5153 58.1429 C49.3169 59.9042 51.1139 60.6968 50.9943 62.4643 C50.8942 63.9429 49.5153 66 49.5153 66 M72 60.5 C72 69.8888 64.3888 77.5 55 77.5 C45.6112 77.5 38 69.8888 38 60.5 C38 51.1112 45.6112 43.5 55 43.5 C64.3888 43.5 72 51.1112 72 60.5 Z M66.5 60.5 C66.5 66.8513 61.3513 72 55 72 C48.6487 72 43.5 66.8513 43.5 60.5 C43.5 54.1487 48.6487 49 55 49 C61.3513 49 66.5 54.1487 66.5 60.5 Z M69.5 31 C69.5 32.1046 68.6046 33 67.5 33 C66.3954 33 65.5 32.1046 65.5 31 C65.5 29.8954 66.3954 29 67.5 29 C68.6046 29 69.5 29.8954 69.5 31 Z M77 31 C77 32.1046 76.1046 33 75 33 C73.8954 33 73 32.1046 73 31 C73 29.8954 73.8954 29 75 29 C76.1046 29 77 29.8954 77 31 Z",viewW:110,viewH:110}},{id:"dryer",group:"appliance",art:{d:"M81 82.5 L81 27.5 M81 82.5 C81 83.8807 79.8807 85 78.5 85 L31.5 85 C30.1193 85 29 83.8807 29 82.5 L29 55.5 M81 82.5 L81 40 M81 27.5 C81 26.1193 79.8807 25 78.5 25 L31.5 25 C30.1193 25 29 26.1193 29 27.5 M81 27.5 L81 40 M29 27.5 L29 55.5 M29 27.5 L29 40 M81 40 C81 38.6193 79.8807 37.5 78.5 37.5 L31.5 37.5 C30.1193 37.5 29 38.6193 29 40 M29 40 L29 55.5 M35.75 31 L45.25 31 M55.9943 55 C55.9943 55 54.6654 56.8105 54.5153 58.1429 C54.3169 59.9042 56.1139 60.6968 55.9943 62.4643 C55.8942 63.9429 54.5153 66 54.5153 66 M60.4943 55 C60.4943 55 59.1654 56.8105 59.0153 58.1429 C58.8169 59.9042 60.6139 60.6968 60.4943 62.4643 C60.3942 63.9429 59.0153 66 59.0153 66 M50.9943 55 C50.9943 55 49.6654 56.8105 49.5153 58.1429 C49.3169 59.9042 51.1139 60.6968 50.9943 62.4643 C50.8942 63.9429 49.5153 66 49.5153 66 M72 60.5 C72 69.8888 64.3888 77.5 55 77.5 C45.6112 77.5 38 69.8888 38 60.5 C38 51.1112 45.6112 43.5 55 43.5 C64.3888 43.5 72 51.1112 72 60.5 Z M66.5 60.5 C66.5 66.8513 61.3513 72 55 72 C48.6487 72 43.5 66.8513 43.5 60.5 C43.5 54.1487 48.6487 49 55 49 C61.3513 49 66.5 54.1487 66.5 60.5 Z M69.5 31 C69.5 32.1046 68.6046 33 67.5 33 C66.3954 33 65.5 32.1046 65.5 31 C65.5 29.8954 66.3954 29 67.5 29 C68.6046 29 69.5 29.8954 69.5 31 Z M77 31 C77 32.1046 76.1046 33 75 33 C73.8954 33 73 32.1046 73 31 C73 29.8954 73.8954 29 75 29 C76.1046 29 77 29.8954 77 31 Z",viewW:110,viewH:110}},{id:"exercise",group:"other",art:{d:"M55.091 60.072 L65.7741 35.5156 M42.2119 56.2083 L55.091 60.072 L60.8511 61.8001 L66.5032 63.4957 C70.733 64.7646 73.6297 68.6579 73.6297 73.074 L73.6297 76.2635 L29.3385 76.2635 L29.3385 65.7866 C29.3385 60.9371 32.7227 57.0804 37.0256 56.051 C38.5108 55.6956 40.1055 55.6771 41.7081 56.0709 M41.7081 56.0709 C41.876 56.1122 42.044 56.1579 42.2119 56.2083 L60.8511 61.8001 M71.9311 35.5156 L76.4108 35.5156 C78.2451 35.5156 79.9321 34.5112 80.8064 32.8987 L83.8375 27.308 C84.3011 26.4529 83.9993 25.384 83.1569 24.8976 C82.2982 24.4018 81.2002 24.696 80.7045 25.5547 L77.8652 30.4723 C77.3293 31.4005 76.3389 31.9723 75.2671 31.9723 L65.6573 31.9723 C64.6788 31.9723 63.8856 32.7655 63.8856 33.744 C63.8856 34.7224 64.6788 35.5156 65.6573 35.5156 L65.7741 35.5156 M71.9311 35.5156 C71.9603 35.7673 71.9261 36.0298 71.8188 36.2793 L60.8511 61.8001 M71.9311 35.5156 L65.7741 35.5156 M41.7081 56.0709 L38.03 42.6022 M37.0256 56.051 L33.3529 42.6022 M38.03 42.6022 L33.3529 42.6022 L29.7814 42.6022 C28.5583 42.6022 27.5668 41.6107 27.5668 40.3876 C27.5668 39.1646 28.5583 38.1731 29.7814 38.1731 L41.2971 38.1731 C42.5202 38.1731 43.5117 39.1646 43.5117 40.3876 C43.5117 41.6107 42.5202 42.6022 41.2971 42.6022 L38.03 42.6022 Z M25.7952 78.921 C25.7952 77.4533 26.985 76.2635 28.4526 76.2635 L74.5155 76.2636 C75.9832 76.2636 77.173 77.4533 77.173 78.921 C77.173 80.3887 75.9832 81.5785 74.5155 81.5785 L28.4526 81.5785 C26.985 81.5785 25.7952 80.3887 25.7952 78.921 Z M29.3385 81.5785 L29.3385 84.5677 C29.3385 85.3962 30.01 86.0677 30.8385 86.0677 L33.6379 86.0677 C34.2512 86.0677 34.8028 85.6943 35.0306 85.1248 L36.5002 81.5785 L29.3385 81.5785 Z M73.6297 81.5785 L73.6297 84.5677 C73.6297 85.3962 72.9581 86.0677 72.1297 86.0677 L69.3303 86.0677 C68.717 86.0677 68.1654 85.6943 67.9376 85.1248 L66.5002 81.5785 L73.6297 81.5785 Z M45.2833 66.0766 C45.2833 68.7673 43.102 70.9486 40.4113 70.9486 C37.7205 70.9486 35.5392 68.7673 35.5392 66.0766 C35.5392 63.3858 37.7205 61.2045 40.4113 61.2045 C43.102 61.2045 45.2833 63.3858 45.2833 66.0766 Z",viewW:110,viewH:110}},{id:"fireplace",group:"other",art:{d:"M71.1884 73.8943 L71.1884 50.4399 C71.1884 47.6784 68.9498 45.4399 66.1884 45.4399 L43.1445 45.4399 C40.3831 45.4399 38.1445 47.6784 38.1445 50.4399 L38.1445 73.8942 M38.1445 73.8942 L26.7031 73.8942 L26.7031 34.4252 L82.6629 34.4252 L82.6629 73.8942 L71.1884 73.8943 L38.1445 73.8942 Z M62.0101 62.8795 L47.3239 62.8795 C45.8031 62.8795 44.5703 64.1124 44.5703 65.6332 C44.5703 67.154 45.8031 68.3868 47.3239 68.3868 M47.3239 68.3868 C45.8031 68.3868 44.5703 69.6195 44.5703 71.1403 C44.5703 72.6611 45.8031 73.894 47.3239 73.894 M47.3239 68.3868 C48.8447 68.3868 50.0776 69.6195 50.0776 71.1403 C50.0776 72.6611 48.8447 73.894 47.3239 73.894 M47.3239 68.3868 L61.9918 68.3868 M47.3239 73.894 L62.0101 73.894 C63.5309 73.894 64.7637 72.6611 64.7637 71.1403 C64.7637 69.6242 63.5385 68.3945 62.0243 68.3869 M62.0114 68.3869 C62.0049 68.3869 61.9983 68.3869 61.9918 68.3868 M62.0114 68.3869 C62.0157 68.3869 62.02 68.3869 62.0243 68.3869 M62.0114 68.3869 L62.0243 68.3869 M62.0114 68.3869 L61.9918 68.3868 M61.9918 68.3868 C60.48 68.3763 59.2578 67.1475 59.2578 65.6332 C59.2578 64.1124 60.4906 62.8796 62.0114 62.8796 C63.5322 62.8796 64.7651 64.1124 64.7651 65.6332 C64.7651 67.1498 63.5392 68.3799 62.0243 68.3869 M61.9918 68.3868 L62.0101 68.3868 C62.0148 68.3868 62.0195 68.3868 62.0243 68.3869 M24 81.6962 L85.3341 81.6962 C85.8864 81.6962 86.3341 81.2485 86.3341 80.6962 L86.3341 74.8942 C86.3341 74.3419 85.8864 73.8942 85.3341 73.8942 L24 73.8942 C23.4477 73.8942 23 74.3419 23 74.8942 L23 80.6962 C23 81.2485 23.4477 81.6962 24 81.6962 Z M24 34.4252 L85.3341 34.4252 C85.8864 34.4252 86.3341 33.9775 86.3341 33.4252 L86.3341 29 C86.3341 28.4477 85.8864 28 85.3341 28 L24 28 C23.4477 28 23 28.4477 23 29 L23 33.4252 C23 33.9775 23.4477 34.4252 24 34.4252 Z",viewW:110,viewH:110}},{id:"fridge",group:"appliance",art:{d:"M35.5 87 C34.1193 87 33 85.8807 33 84.5 M35.5 87 L74.5 87 M35.5 87 L35.5 90.5 C35.5 91.0523 35.9477 91.5 36.5 91.5 L73.5 91.5 C74.0523 91.5 74.5 91.0523 74.5 90.5 L74.5 87 M33 84.5 L33 20.5 M33 84.5 L33 46.5 M77.5 84.5 L77.5 20.5 M77.5 84.5 C77.5 85.8807 76.3807 87 75 87 L74.5 87 M77.5 84.5 L77.5 46.5 M77.5 20.5 C77.5 19.1193 76.3807 18 75 18 L35.5 18 C34.1193 18 33 19.1193 33 20.5 M77.5 20.5 L77.5 46.5 M33 20.5 L33 46.5 M33 46.5 L77.5 46.5 M38.5 41 L38.5 31.5 M38.5 62 L38.5 52.5",viewW:110,viewH:110}},{id:"hood",group:"appliance",art:{d:"M66 57 L83 69 L83 71.5 C83 72.8807 81.8807 74 80.5 74 L29.5 74 C28.1193 74 27 72.8807 27 71.5 L27 69 L44 57 M44 57 L66 57 M44 57 L44 37.5 C44 36.1193 45.1193 35 46.5 35 L63.5 35 C64.8807 35 66 36.1193 66 37.5 L66 57 M83 69 L27 69",viewW:110,viewH:110}},{id:"kitchen_cabinet",group:"furniture",art:{d:"M72 84.95 L72 88 C72 88.5523 71.5523 89 71 89 L39 89 C38.4477 89 38 88.5523 38 88 L38 84.95 M55 20 L71.5 20 C72.8807 20 74 21.1193 74 22.5 L74 39.5 C74 40.8807 72.8807 42 71.5 42 L55 42 M55 20 L55 42 M55 20 L38.5 20 C37.1193 20 36 21.1193 36 22.5 L36 39.5 C36 40.8807 37.1193 42 38.5 42 L55 42 M59 33 L59 38 M51 33 L51 38 M55 85 L71.5 85 C72.8807 85 74 83.8807 74 82.5 L74 65.5 C74 64.1193 72.8807 63 71.5 63 L55 63 M55 85 L55 63 M55 85 L38.5 85 C37.1193 85 36 83.8807 36 82.5 L36 65.5 C36 64.1193 37.1193 63 38.5 63 L55 63 M67 67 L62 67 M48 67 L43 67",viewW:110,viewH:110}},{id:"kitchen_sink",group:"sanitary",art:{d:"M49 54 L49 59 M51.5 37.5 L44 37.5 M51.5 37.5 C52.0523 37.5 52.5 37.9477 52.5 38.5 L52.5 44 M51.5 37.5 L48 37.5 M44 37.5 C43.4477 37.5 43 37.9477 43 38.5 L43 44 M44 37.5 L48 37.5 M43 44 L21.5 44 C20.1193 44 19 45.1193 19 46.5 L19 81.5 C19 82.8807 20.1193 84 21.5 84 L89.5 84 C90.8807 84 92 82.8807 92 81.5 L92 46.5 C92 45.1193 90.8807 44 89.5 44 L52.5 44 M43 44 L52.5 44 M58 33 L58 31 C58 29.6739 57.4732 28.4021 56.5355 27.4645 C55.5979 26.5268 54.3261 26 53 26 C51.6739 26 50.4021 26.5268 49.4645 27.4645 C48.5268 28.4021 48 29.6739 48 31 L48 37.5 M62 54 L62 59 M26 50 L52.5 50 C53.0523 50 53.5 50.4477 53.5 51 L53.5 77 C53.5 77.5523 53.0523 78 52.5 78 L26 78 C25.4477 78 25 77.5523 25 77 L25 51 C25 50.4477 25.4477 50 26 50 Z M58.5 50 L85 50 C85.5523 50 86 50.4477 86 51 L86 77 C86 77.5523 85.5523 78 85 78 L58.5 78 C57.9477 78 57.5 77.5523 57.5 77 L57.5 51 C57.5 50.4477 57.9477 50 58.5 50 Z",viewW:110,viewH:110}},{id:"nightstand",group:"furniture",art:{d:"M34.5 76 C33.1193 76 32 74.8807 32 73.5 M34.5 76 L41.2308 76 M34.5 76 C34.3288 76 34.1616 75.9828 34 75.95 L34 78.5 C34 79.3284 34.6716 80 35.5 80 L38.8921 80 C39.5506 80 40.1321 79.5705 40.3258 78.9411 L41.2308 76 M32 73.5 L32 33 M32 73.5 L32 57.5 M78 73.5 L78 33 M69.2692 76 L75.5 76 C75.8556 76 76.1938 75.9258 76.5 75.792 C77.383 75.4062 78 74.5252 78 73.5 M78 73.5 L78 57.5 M78 33 C78 31.6193 76.8807 30.5 75.5 30.5 L34.5 30.5 C33.1193 30.5 32 31.6193 32 33 M78 33 L78 39.5 M32 33 L32 39.5 M32 39.5 L78 39.5 M32 39.5 L32 57.5 M78 39.5 L78 57.5 M78 57.5 L32 57.5 M50.5 48.5 L60 48.5 M50.5 66 L60 66 M41.2308 76 L69.2692 76 M69.2692 76 L70.1742 78.9411 C70.3679 79.5705 70.9494 80 71.6079 80 L75 80 C75.8284 80 76.5 79.3284 76.5 78.5 L76.5 75.792",viewW:110,viewH:110}},{id:"oven",group:"appliance",art:{d:"M29 76 C29 77.3807 30.1193 78.5 31.5 78.5 L78.5 78.5 C79.8807 78.5 81 77.3807 81 76 M29 76 L29 40 M29 76 L29 82.5 C29 83.8807 30.1193 85 31.5 85 L78.5 85 C79.8807 85 81 83.8807 81 82.5 L81 76 M81 76 L81 40 M81 40 C81 38.6193 79.8807 37.5 78.5 37.5 L31.5 37.5 C30.1193 37.5 29 38.6193 29 40 M81 40 L81 27.5 C81 26.1193 79.8807 25 78.5 25 L31.5 25 C30.1193 25 29 26.1193 29 27.5 L29 40 M35.75 31 L45.25 31 M43 42 L67 42 M40.5 72 L69.5 72 C70.8807 72 72 70.8807 72 69.5 L72 49.5 C72 48.1193 70.8807 47 69.5 47 L40.5 47 C39.1193 47 38 48.1193 38 49.5 L38 69.5 C38 70.8807 39.1193 72 40.5 72 Z M69.5 31 C69.5 32.1046 68.6046 33 67.5 33 C66.3954 33 65.5 32.1046 65.5 31 C65.5 29.8954 66.3954 29 67.5 29 C68.6046 29 69.5 29.8954 69.5 31 Z M77 31 C77 32.1046 76.1046 33 75 33 C73.8954 33 73 32.1046 73 31 C73 29.8954 73.8954 29 75 29 C76.1046 29 77 29.8954 77 31 Z",viewW:110,viewH:110}},{id:"plant",group:"other",art:{d:"M55.7064 55.8805 L55.7064 52.9357 M55.7064 52.9357 C56.839 47.0461 62.7965 41.9801 68.6182 37.5322 M55.7064 52.9357 C50.7678 48.7899 47.7236 46.7763 41.6621 43.8748 M67.4992 61.3174 L65.9151 75.8488 C65.7779 77.1181 64.7063 78.0801 63.4296 78.0801 L48.4373 78.0801 C47.1606 78.0801 46.089 77.1181 45.9518 75.8488 L44.3593 61.3174 L67.4992 61.3174 Z M60.2363 44.7807 C58.4234 36.1732 66.8047 29.604 76.9989 31.869 C76.9989 40.024 68.3904 48.6318 60.2363 44.7807 Z M50.476 49.9288 C51.9926 41.2641 43.391 34.9863 33.2805 37.5996 C33.5602 45.7498 42.4589 54.0573 50.476 49.9288 Z M43.1152 61.3174 L68.7509 61.3174 C69.3031 61.3174 69.7509 60.8697 69.7509 60.3174 L69.7509 56.8809 C69.7509 56.3286 69.3031 55.8809 68.7509 55.8809 L43.1152 55.8809 C42.5629 55.8809 42.1152 56.3286 42.1152 56.8809 L42.1152 60.3174 C42.1152 60.8697 42.5629 61.3174 43.1152 61.3174 Z",viewW:110,viewH:110}},{id:"rug",group:"other",art:{d:"M90.2693 33.8735 L84.648 33.8735 M25.6208 33.8735 L19.9995 33.8735 M90.2693 39.0264 L84.648 39.0264 M25.6208 39.0264 L19.9995 39.0264 M90.2693 44.1792 L84.648 44.1792 M25.6208 44.1792 L19.9995 44.1792 M90.2693 49.332 L84.648 49.332 M25.6208 49.332 L19.9995 49.332 M90.2693 54.4854 L84.648 54.4854 M25.6208 54.4854 L19.9995 54.4854 M90.2693 59.6382 L84.648 59.6382 M25.6208 59.6382 L19.9995 59.6382 M90.2693 64.791 L84.648 64.791 M25.6208 64.791 L19.9995 64.791 M90.2693 69.9438 L84.648 69.9438 M25.6208 69.9438 L19.9995 69.9438 M90.2693 75.0967 L84.648 75.0967 M25.6208 75.0967 L19.9995 75.0967 M28.121 32 L82.145 32 C83.5257 32 84.645 33.1193 84.645 34.5 L84.645 74.939 C84.645 76.3197 83.5257 77.439 82.145 77.439 L28.121 77.439 C26.7403 77.439 25.621 76.3197 25.621 74.939 L25.621 34.5 C25.621 33.1193 26.7403 32 28.121 32 Z M29.8369 32 L29.8369 77.439 M80.4302 32 L80.4302 77.439 M37.8005 54.4852 L55.6014 46.0532 L73.4022 54.4852 L55.6014 62.9172 L37.8005 54.4852 Z",viewW:110,viewH:110}},{id:"shelving",group:"furniture",art:{d:"M64 58.5 L64 47 C64 46.4477 64.4477 46 65 46 L68 46 C68.5523 46 69 46.4477 69 47 M64 58.5 L69 58.5 M64 58.5 L28 58.5 L28 39 L35.5 39 M69 58.5 L69 47 M69 58.5 L69 44.5 M69 58.5 L76 58.5 M69 47 L69 44.5 M52.5 39 L52.5 27.5 C52.5 26.9477 52.0523 26.5 51.5 26.5 L48.5 26.5 C47.9477 26.5 47.5 26.9477 47.5 27.5 M52.5 39 L47.5 39 M52.5 39 L81 39 L81 58.5 L76 58.5 M47.5 39 L47.5 27.5 M47.5 39 L47.5 25 M47.5 39 L40.5 39 M47.5 27.5 L47.5 25 M40.5 39 L40.5 27.5 M40.5 39 L40.5 25 M40.5 39 L35.5 39 M35.5 39 L35.5 27.5 C35.5 26.9477 35.9477 26.5 36.5 26.5 L39.5 26.5 C40.0523 26.5 40.5 26.9477 40.5 27.5 M40.5 27.5 L40.5 25 M49 72 L36.5 72 M50.5 72 L36.5 72 C35.9477 72 35.5 71.5523 35.5 71 L35.5 68.5 C35.5 67.9477 35.9477 67.5 36.5 67.5 L49 67.5 C49.5523 67.5 50 67.9477 50 68.5 L50 71 C50 71.5523 49.5523 72 49 72 M50.5 78 C51.0523 78 51.5 77.5523 51.5 77 L51.5 73 C51.5 72.4477 51.0523 72 50.5 72 L49 72 M36.5 72 C35.9477 72 35.5 72.4477 35.5 73 L35.5 77 C35.5 77.5523 35.9477 78 36.5 78 M76 58.5 L76 44.5 C76 43.9477 75.5523 43.5 75 43.5 L70 43.5 C69.4477 43.5 69 43.9477 69 44.5 M47.5 25 C47.5 24.4477 47.0523 24 46.5 24 L41.5 24 C40.9477 24 40.5 24.4477 40.5 25 M50.5 78 L36.5 78 M50.5 78 L81 78 L81 85 L28 85 L28 78 L36.5 78 M28 89.5 L28 23 C28 21.6193 29.1193 20.5 30.5 20.5 L78.5 20.5 C79.8807 20.5 81 21.6193 81 23 L81 89.5",viewW:110,viewH:110}},{id:"shower",group:"sanitary",art:{d:"M39 84 L39 31.7143 C39 25.245 44.2564 20 50.75 20 C56.4663 20 61.2394 24.5462 62.1824 29.0091 M51.5 39.25 C51.5 33.5891 56.0891 29 61.75 29 C67.4109 29 72 33.5891 72 39.25 L51.5 39.25 M54.75 44.25 L54.75 46.75 M62 44.25 L62 46.75 M69.25 44.25 L69.25 46.75 M54.75 50.5 L54.75 53 M62 50.5 L62 53 M69.25 50.5 L69.25 53 M54.75 56.75 L54.75 59.25 M62 56.75 L62 59.25 M69.25 56.75 L69.25 59.25 M54.75 63 L54.75 65.5 M62 63 L62 65.5 M69.25 63 L69.25 65.5 M31 84 L80 84 C80.5523 84 81 84.4477 81 85 L81 88 C81 88.5523 80.5523 89 80 89 L31 89 C30.4477 89 30 88.5523 30 88 L30 85 C30 84.4477 30.4477 84 31 84",viewW:110,viewH:110}},{id:"sink",group:"sanitary",art:{d:"M51 41.5 L58.5 41.5 M51 41.5 C50.4477 41.5 50 41.9477 50 42.5 L50 48 M51 41.5 L55 41.5 M58.5 41.5 C59.0523 41.5 59.5 41.9477 59.5 42.5 L59.5 48 M58.5 41.5 L55 41.5 M59.5 48 L77 48 C78.3807 48 79.5 49.1193 79.5 50.5 L79.5 57 C79.5 62.5228 75.0228 67 69.5 67 L40 67 C34.4772 67 30 62.5228 30 57 L30 50.5 C30 49.1193 31.1193 48 32.5 48 L50 48 M59.5 48 L50 48 M45 37 L45 35 C45 33.6739 45.5268 32.4021 46.4645 31.4645 C47.4021 30.5268 48.6739 30 50 30 C51.3261 30 52.5979 30.5268 53.5355 31.4645 C54.4732 32.4021 55 33.6739 55 35 L55 41.5 M45 80 L64.5 80 C65.0523 80 65.5 79.5523 65.5 79 L65.5 67 L44 67 L44 79 C44 79.5523 44.4477 80 45 80 Z",viewW:110,viewH:110}},{id:"sofa",group:"furniture",art:{d:"M88.5 44.6689 L88.5 34 C88.5 31.2386 86.2614 29 83.5 29 L59.5 29 C56.7386 29 54.5 31.2386 54.5 34 M88.5 44.6689 C89.2354 44.2435 90.0893 44 91 44 M88.5 44.6689 C88.3992 44.7272 88.3006 44.7889 88.2045 44.8539 M54.5 61.75 L54.5 34 M54.5 61.75 C54.5 64.3734 52.3734 66.5 49.75 66.5 L25.25 66.5 C22.6266 66.5 20.5 64.3734 20.5 61.75 M54.5 61.75 C54.5 59.1266 52.3734 57 49.75 57 L25.25 57 C24.6761 57 24.1261 57.1018 23.6168 57.2882 M54.5 61.75 C54.5 64.3734 56.6266 66.5 59.25 66.5 L83.75 66.5 C86.3734 66.5 88.5 64.3734 88.5 61.75 M88.5 61.75 C88.5 59.9118 87.4558 58.3175 85.9283 57.5278 C85.8889 57.5075 85.8493 57.4877 85.8093 57.4684 C85.1863 57.1682 84.4878 57 83.75 57 L59.25 57 C56.6266 57 54.5 59.1266 54.5 61.75 M54.5 34 C54.5 31.2386 52.2614 29 49.5 29 L25.5 29 C22.7386 29 20.5 31.2386 20.5 34 L20.5 44.416 M20.5 44.416 C19.8875 44.1484 19.2111 44 18.5 44 M20.5 44.416 C22.2659 45.1876 23.5 46.9497 23.5 49 M18.5 44 C21.2614 44 23.5 46.2386 23.5 49 M18.5 44 L18 44 C15.2386 44 13 46.2386 13 49 L13 70.5 C13 73.2614 15.2386 75.5 18 75.5 M23.5 49 L23.5 57.3328 M23.5 57.3328 C21.7427 58.0295 20.5 59.7446 20.5 61.75 M23.5 57.3328 C23.5387 57.3174 23.5776 57.3026 23.6168 57.2882 M91 44 C89.9645 44 89.0025 44.3148 88.2045 44.8539 C86.8744 45.7525 86 47.2741 86 49 L86 57.5657 M85.9283 57.5278 C85.9523 57.5402 85.9762 57.5528 86 57.5657 C87.4884 58.3677 88.5 59.9407 88.5 61.75 M91 44 L91.5 44 C94.2614 44 96.5 46.2386 96.5 49 L96.5 70.5 C96.5 73.2614 94.2614 75.5 91.5 75.5 M91.5 75.5 L18 75.5 M91.5 75.5 L90.5 75.5 M18 75.5 L18.5 75.5 M20.5 61.75 C20.5 59.7005 21.798 57.9542 23.6168 57.2882 M18.5 75.5 L26.5 75.5 M18.5 75.5 L18.5 80.5 C18.5 81.3284 19.1716 82 20 82 L23.3921 82 C24.0506 82 24.6321 81.5705 24.8258 80.9411 L26.5 75.5 M26.5 75.5 L82.5 75.5 M90.5 75.5 L82.5 75.5 M90.5 75.5 L90.5 80.5 C90.5 81.3284 89.8284 82 89 82 L85.6079 82 C84.9494 82 84.3679 81.5705 84.1742 80.9411 L82.5 75.5",viewW:110,viewH:110}},{id:"stairs",group:"other",art:{d:"M73.4707 46.8057 L73.4707 28.5242 M73.4707 46.8057 L73.1504 46.8057 M73.4707 46.8057 L82.6039 46.8057 M73.4707 28.5242 L73.425 28.5242 M73.4707 28.5242 L75.6731 28.5242 M62.8987 54.2946 L62.8987 36.7397 M61.5762 61.7837 L61.5762 55.2944 C61.5762 54.7421 62.0239 54.2944 62.5762 54.2944 L62.8987 54.2946 L72.1504 54.2945 M52.3262 61.7837 L52.3262 45.1306 M52.3262 61.7837 L52.0039 61.7837 M52.3262 61.7837 L61.5762 61.7837 M62.8987 36.7397 L52.3262 45.1306 L42.1934 53.1725 L31.6211 61.5632 M42.1934 69.2725 L42.1934 53.1725 M42.1934 69.2725 L41.873 69.2725 M83.6035 69.2725 L83.6024 69.2725 L51.0039 69.2725 L42.1934 69.2725 M83.6031 76.7612 L83.6031 83.25 C83.6031 83.8023 83.1554 84.25 82.6031 84.25 L31.6231 84.2499 M41.873 69.2725 L83.6035 69.2725 L83.6031 76.7612 M83.6031 76.7612 L31.6231 76.7612 M31.6231 76.7612 L40.873 76.7613 L83.6031 76.7612 M31.6231 84.2499 L27.7773 84.2499 C27.2251 84.2499 26.7773 83.8021 26.7773 83.2499 L26.7773 57.4971 C26.7773 56.9448 27.2251 56.4971 27.7773 56.4971 L28.9352 56.4971 M31.6231 84.2499 L31.6231 76.7612 M31.6231 76.7612 L31.6211 61.5632 L31.6231 56.4971 M29.0212 56.4971 L31.6231 56.4971 L31.6228 57.2227 M31.6211 61.5632 L62.8987 36.7397 M31.6211 61.5632 L31.6228 57.2227 M73.425 28.5242 L75.6731 28.5242 M73.425 28.5242 C73.3119 28.5242 73.202 28.5624 73.1134 28.6328 L62.8987 36.7397 M75.6731 28.5242 C76.6463 28.5242 77.4352 27.7353 77.4352 26.7621 C77.4352 25.7889 76.6463 25 75.6731 25 L71.9495 25 C71.7935 25 71.6421 25.0532 71.5204 25.1508 L31.6228 57.2227 M41.873 69.2725 C41.3208 69.2725 40.873 69.7202 40.873 70.2725 L40.873 76.7613 M52.0039 61.7837 L83.6024 61.7837 M52.0039 61.7837 C51.4516 61.7837 51.0039 62.2314 51.0039 62.7837 L51.0039 69.2725 M83.6022 54.2944 L83.6024 61.7837 L83.6024 69.2725 M83.6024 61.7837 L61.5762 61.7837 M83.6022 54.2944 L83.6039 47.8057 C83.6039 47.2534 83.1562 46.8057 82.6039 46.8057 M83.6022 54.2944 L72.1504 54.2945 M73.1504 46.8057 L82.6039 46.8057 M73.1504 46.8057 C72.5981 46.8057 72.1504 47.2534 72.1504 47.8057 L72.1504 54.2945 M28.9352 56.4971 C28.9495 56.4973 28.9638 56.4974 28.9782 56.4974 C28.9925 56.4974 29.0069 56.4973 29.0212 56.4971 M28.9352 56.4971 C27.2519 56.4741 25.8945 55.1024 25.8945 53.4137 C25.8945 51.7107 27.2751 50.3301 28.9782 50.3301 C30.6812 50.3301 32.0618 51.7107 32.0618 53.4137 C32.0618 55.1024 30.7044 56.4741 29.0212 56.4971 M28.9352 56.4971 L29.0212 56.4971",viewW:110,viewH:110}},{id:"toilet",group:"sanitary",art:{d:"M64.5372 72.1021 L67.6892 84.7575 C67.847 85.3886 67.3696 86 66.7191 86 L37.6483 86 C37.0414 86 36.5743 85.4636 36.6578 84.8624 L38.9999 68 C40.0716 64 32.5 64.5 32 57 L32 26.5 C32 25.1193 33.1193 24 34.5 24 L45 24 C46.3807 24 47.5 25.1193 47.5 26.5 L47.5 52 M32 57 L47.5 57 M47.5 52 L76.5 52 C77.8807 52 79 53.1193 79 54.5 L79 57 M47.5 52 L47.5 57 M54.9999 71.75 C58.5528 72.6096 61.7379 72.6416 64.5372 72.1021 C73.95 70.2877 79 62.0101 79 57 M79 57 L47.5 57",viewW:110,viewH:110}},{id:"tv",group:"appliance",art:{d:"M23.5 31 L86 31 C87.3807 31 88.5 32.1193 88.5 33.5 L88.5 67.5 C88.5 68.8807 87.3807 70 86 70 L23.5 70 C22.1193 70 21 68.8807 21 67.5 L21 33.5 C21 32.1193 22.1193 31 23.5 31 M50 70 L50 78 M59.5 70 L59.5 78 M40 78 L70 78 M42.5466 45.9951 L52.5466 45.9951 M47.5466 45.9951 L47.5 56.0336 M56.75 45.5 L61.75 55.5 L66.75 45.5",viewW:110,viewH:110}},{id:"wardrobe",group:"furniture",art:{d:"M54.5 20.5 L30.5 20.5 C29.1193 20.5 28 21.6193 28 23 L28 82.5 C28 83.8807 29.1193 85 30.5 85 L54.5 85 M54.5 20.5 L54.5 85 M54.5 20.5 L78.5 20.5 C79.8807 20.5 81 21.6193 81 23 L81 82.5 C81 83.8807 79.8807 85 78.5 85 L54.5 85 M79 84.95 L79 88.5 C79 89.0523 78.5523 89.5 78 89.5 L31 89.5 C30.4477 89.5 30 89.0523 30 88.5 L30 84.95 M50.5 48 L50.5 57.5 M58.5 48 L58.5 57.5",viewW:110,viewH:110}},{id:"washer",group:"appliance",art:{d:"M81 40 C81 38.6193 79.8807 37.5 78.5 37.5 L31.5 37.5 C30.1193 37.5 29 38.6193 29 40 M35.75 31 L45.25 31 M31.5 85 L78.5 85 C79.8807 85 81 83.8807 81 82.5 L81 55.5 L81 27.5 C81 26.1193 79.8807 25 78.5 25 L31.5 25 C30.1193 25 29 26.1193 29 27.5 L29 56 L29 82.5 C29 83.8807 30.1193 85 31.5 85 Z M72 60.5 C72 69.8888 64.3888 77.5 55 77.5 C45.6112 77.5 38 69.8888 38 60.5 C38 51.1112 45.6112 43.5 55 43.5 C64.3888 43.5 72 51.1112 72 60.5 Z M66.5 60.5 C66.5 66.8513 61.3513 72 55 72 C48.6487 72 43.5 66.8513 43.5 60.5 C43.5 54.1487 48.6487 49 55 49 C61.3513 49 66.5 54.1487 66.5 60.5 Z M69.5 31 C69.5 32.1046 68.6046 33 67.5 33 C66.3954 33 65.5 32.1046 65.5 31 C65.5 29.8954 66.3954 29 67.5 29 C68.6046 29 69.5 29.8954 69.5 31 Z M77 31 C77 32.1046 76.1046 33 75 33 C73.8954 33 73 32.1046 73 31 C73 29.8954 73.8954 29 75 29 C76.1046 29 77 29.8954 77 31 Z",viewW:110,viewH:110}},{id:"work_table",group:"furniture",art:{d:"M68.5 61 L68.5 73.5 C68.5 74.3284 69.1716 75 70 75 L87 75 C87.8284 75 88.5 74.3284 88.5 73.5 L88.5 61 L88.4844 47 M26.4844 47 L26.4844 73.5 C26.4844 74.3284 25.8128 75 24.9844 75 L23.9844 75 C23.1559 75 22.4844 74.3284 22.4844 73.5 L22.4844 47 L22.4844 43 L24.866 35.5974 C25.2388 34.6346 26.165 34 27.1974 34 L83.7743 34 C84.8054 34 85.7307 34.633 86.1044 35.5939 L88.4844 43 L88.4844 47 M88.4844 47 L68.5 47 M68.5 47 L68.5 61 M68.5 47 L26.4844 47 M68.5 61 L88.5 61 M76.5 51 L80.5 51 M88.4844 43 L22.4844 43 M22.4844 47 L26.4844 47 M76.5 65 L80.5 65",viewW:110,viewH:110}}];class Jc{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=$e(s.width,s.height),n=we(a.w,this.host._cellCm,this.host._gridPitch)/lt,r=we(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:le(o[0]/lt-n/2),y:le(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=$e(e.width,e.height),o=we(i.w,this.host._cellCm,this.host._gridPitch)/lt,a=we(i.h,this.host._cellCm,this.host._gridPitch)/this.host._decorH,n=this.host._display(e.url);return n?At``:d}renderMissing(t,e,s,i,o,a,n,r,l){const h=i+a/2,c=o+n/2;return Et``:d}renderMissing(t,e,s,i,o,a,n,r,l){const h=i+a/2,c=o+n/2;return At` ${this.host._t("decor.image_unavailable")} @@ -1456,7 +1456,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0
    ${this.host._t(t?"decor.image_place_hint":"decor.image_pick_hint")}
    -
    `}renderFurniturePalette(){const t=this.host._furnPalette,e=this.host._furnCategory,s=xe.flatMap(t=>Se(t)),i=Vc.filter(t=>s.some(e=>e.category===t.id)),o=i.find(t=>t.id===e)||null,a=o?s.filter(t=>t.category===o.id):[],n=this.host._t(this.host._imperial?"gs.unit_ft":"gs.unit_m");return p`
    t.stopPropagation()}> +
    `}renderFurniturePalette(){const t=this.host._furnPalette,e=this.host._furnCategory,s=xe.flatMap(t=>Me(t)),i=Vc.filter(t=>s.some(e=>e.category===t.id)),o=i.find(t=>t.id===e)||null,a=o?s.filter(t=>t.category===o.id):[],n=this.host._t(this.host._imperial?"gs.unit_ft":"gs.unit_m");return p`
    t.stopPropagation()}>
    ${this.host._t("furn.title")} @@ -1478,11 +1478,11 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 class="furnitem ${t?.symbol===e.id?"on":""}" data-symbol=${e.id} title=${this.host._t(`furn.sym_${e.id}`)} @click=${()=>this.hooks.furnPick(e.id)}> - ${(t=>{const e=De(t);return e?Et`{const e=De(t);return e?At``:Et``})(e.id)}${this.host._t(`furn.sym_${e.id}`)} + stroke-linejoin="round">`:At``})(e.id)}${this.host._t(`furn.sym_${e.id}`)} `)}
    `:xe.map(t=>p` @@ -1492,7 +1492,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 class="furnitem furncategory" data-category=${t.id} title=${this.host._t(`furn.cat_${t.id}`)} @click=${()=>{this.hooks.clearFurniturePreview(),this.host._furnPalette=null,this.hooks.furnShiftDetach(),this.host._furnCategory=t.id}}> - ${(t=>Et`At`
    `:p`
    ${this.host._t("furn.pick_hint")}
    `} -
    `}furnitureSizeInput(t,e){const s=this.host._decorShapeDialog;if(!s||"furniture"!==s.kind&&"image"!==s.kind)return;const i=Me(e,this.host._imperial,Ce*this.host._cellCm),o="w"===t?"sizeWField":"sizeHField",a="w"===t?"sizeWCm":"sizeHCm",n="w"===t?"flipH":"flipV";this.host._decorShapeDialog={...s,[o]:e,...null===i?{}:{[a]:Math.abs(i),[n]:i<0}}}furnitureFlip(t,e){const s=this.host._decorShapeDialog;if(!s||"furniture"!==s.kind&&"image"!==s.kind)return;const i="w"===t?s.sizeWField:s.sizeHField,o=Me(i,this.host._imperial,Ce*this.host._cellCm),a="w"===t?s.sizeWCm:s.sizeHCm,n=Math.abs(o??a??.1),r="w"===t?"sizeWField":"sizeHField",l="w"===t?"flipH":"flipV";this.host._decorShapeDialog={...s,[r]:Pe(n,e,this.host._imperial),[l]:e}}renderShapeDialog(){const t=this.host._decorShapeDialog,e="rect"===t.kind||"ellipse"===t.kind,s=this.host._t(`decor.${t.kind}`),i=this.host._t(this.host._imperial?"gs.unit_ft":"gs.unit_m"),o="furniture"===t.kind||"image"===t.kind?Me(t.sizeWField,this.host._imperial,Ce*this.host._cellCm):null,a="furniture"===t.kind||"image"===t.kind?Me(t.sizeHField,this.host._imperial,Ce*this.host._cellCm):null,n=!("furniture"!==t.kind&&"image"!==t.kind||null!==o&&null!==a),r="image"===t.kind?this.host._decorAssetCatalog.find(e=>e.asset_id===t.assetId)||this.host._decorAssets.get(t.assetId||""):null;return p``}furnitureSizeInput(t,e){const s=this.host._decorShapeDialog;if(!s||"furniture"!==s.kind&&"image"!==s.kind)return;const i=Ce(e,this.host._imperial,Se*this.host._cellCm),o="w"===t?"sizeWField":"sizeHField",a="w"===t?"sizeWCm":"sizeHCm",n="w"===t?"flipH":"flipV";this.host._decorShapeDialog={...s,[o]:e,...null===i?{}:{[a]:Math.abs(i),[n]:i<0}}}furnitureFlip(t,e){const s=this.host._decorShapeDialog;if(!s||"furniture"!==s.kind&&"image"!==s.kind)return;const i="w"===t?s.sizeWField:s.sizeHField,o=Ce(i,this.host._imperial,Se*this.host._cellCm),a="w"===t?s.sizeWCm:s.sizeHCm,n=Math.abs(o??a??.1),r="w"===t?"sizeWField":"sizeHField",l="w"===t?"flipH":"flipV";this.host._decorShapeDialog={...s,[r]:Pe(n,e,this.host._imperial),[l]:e}}renderShapeDialog(){const t=this.host._decorShapeDialog,e="rect"===t.kind||"ellipse"===t.kind,s=this.host._t(`decor.${t.kind}`),i=this.host._t(this.host._imperial?"gs.unit_ft":"gs.unit_m"),o="furniture"===t.kind||"image"===t.kind?Ce(t.sizeWField,this.host._imperial,Se*this.host._cellCm):null,a="furniture"===t.kind||"image"===t.kind?Ce(t.sizeHField,this.host._imperial,Se*this.host._cellCm):null,n=!("furniture"!==t.kind&&"image"!==t.kind||null!==o&&null!==a),r="image"===t.kind?this.host._decorAssetCatalog.find(e=>e.asset_id===t.assetId)||this.host._decorAssets.get(t.assetId||""):null;return p`this.host._decorShapeDialog=null}>
    @@ -1519,7 +1519,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 `}_rangeInput(t,e,s,i,o,a=!1,n){const r=t=>{const e=Number(t.target.value);Number.isFinite(e)&&o(e)};return customElements.get("ha-slider")?p``}_setFillColor(t,e){const s=this.host._settingsDialog;this.host._settingsDialog={...s,colors:{...s.colors,[t]:{...s.colors[t],...e}}}}_updateDecorStyle(t){this.host._decorStyle=t,null!==this._decorStylePersistTimer&&window.clearTimeout(this._decorStylePersistTimer),this._decorStylePersistTimer=window.setTimeout(()=>{this._decorStylePersistTimer=null,this._persistDecorStyle()},1e3)}_persistDecorStyle(){const t=this.host._serverCfg;if(!t)return;const e=xi(this.host._decorStyle),s={...t.settings},i=JSON.stringify(s.decor_default_style??null);e?s.decor_default_style=e:delete s.decor_default_style,JSON.stringify(s.decor_default_style??null)!==i&&(this.host._serverCfg={...t,settings:s},this._saveConfig())}async _saveSettingsDialog(){const t=this.host._settingsDialog;if(!t||t.busy)return;this.host._settingsDialog={...t,busy:!0};let e=null;try{const s=this.host._serverCfg,i=JSON.stringify(t.colors)===JSON.stringify(Rt);let o={...s.settings};i?delete o.fill_colors:o.fill_colors=t.colors;const a=this.host._imperial?30.48*t.glowRadius:100*t.glowRadius;Number.isFinite(a)&&a>0&&300!==Math.round(a)?o.glow_radius_cm=Math.round(a):delete o.glow_radius_cm,t.bgColor?o.bg_color=t.bgColor:delete o.bg_color,null!==t.northDeg&&Number.isInteger(t.northDeg)&&t.northDeg>=0&&t.northDeg<=359?o.north_deg=t.northDeg:delete o.north_deg,o.bg_mode=t.bgMode,t.sunRays?o.sun_rays=!0:delete o.sun_rays,o.sun_ray_origin=t.sunRayOrigin,t.showRoomTooltip?delete o.show_room_tooltip:o.show_room_tooltip=!1;const n=o.radar;n&&null!=n.version&&1!==n.version||(o.radar={...n||{},version:1},t.radarShowLive?delete o.radar.show_live:o.radar.show_live=!1),o=Mi(o,t.zigbeeTopology),delete o.weather_entity;const r={...s,settings:o};e=this.host._adoption.beginOptimistic(s,r),this.host._serverCfg=r,await this._saveConfigNow(e),!t.showRoomTooltip&&this.host._tip?.room&&(this.host._tip=null),this.host._settingsDialog=null,this.host.requestUpdate(),this.host._showToast(this.host._t("gs.saved"))}catch(t){e&&this.host._rollbackOptimistic(e),this.host._settingsDialog&&(this.host._settingsDialog={...this.host._settingsDialog,busy:!1}),this.host._showToast(this.host._t("toast.error",{err:this.host._errText(t)}))}}_boolInput(t,e,s=!1){const i=t=>e(!!t.target.checked);return customElements.get("ha-switch")?p``:p``}_rangeInput(t,e,s,i,o,a=!1,n){const r=t=>{const e=Number(t.target.value);Number.isFinite(e)&&o(e)};return customElements.get("ha-slider")?p``:p``}_renderColorRow(t,e){const s=this.host._settingsDialog.colors[t];return p`
    String(t?.id||"")===e.maxStraightenSpace),m=(this.host._serverCfg?.spaces||[]).length>1&&_?String(_.title||_.id):"",g=e.orphanRoomLabelsRemoved+e.orphanDevicePositionsRemoved+e.orphanGroupPositionsRemoved,f=e.liveMissingPositions.map(t=>t.name).filter(Boolean),b=f.slice(0,3).join(", "),v=Math.max(0,f.length-3),y=b?this.host._t("gs.optimize_live_names",{names:b,more:v?this.host._t("gs.optimize_reference_more",{n:String(v)}):""}):"",$=e.unverifiedPositions.some(t=>"registry_unavailable"===t.reason),w=t=>e.removedPositions.some(e=>e.id===t.id)?this.host._t("gs.optimize_detail_removed"):e.liveMissingPositions.some(e=>e.id===t.id)?this.host._t("gs.optimize_detail_live"):this.host._t("gs.optimize_detail_unverified"),k=t=>this.host._t("room_label"===t?"gs.optimize_detail_room_label":"group"===t?"gs.optimize_detail_group":"device"===t?"gs.optimize_detail_device":"gs.optimize_detail_unknown"),x=[...e.removedPositions,...e.liveMissingPositions.filter(t=>!e.removedPositions.some(e=>e.id===t.id)),...e.unverifiedPositions],S=x.slice(0,10),M=Math.max(0,x.length-S.length);return p``}_renderAlignDialog(){const t=this.host._alignDialog,e=t.report,s=t.changed&&!t.preflight?.ok,i=t.preflight?.failures||[],o=i.slice(0,3).map(t=>t.displayName),a=o.length?o.join(", "):this.host._t("gs.align_preflight_space",{n:"1"}),n=Math.max(0,i.length-o.length),r=n?this.host._t("gs.align_preflight_more",{n:String(n)}):"",l=e.spaceRefsRemapped+e.roomRefsRemapped+e.positionsRemapped+e.markersDetached,h=e.migrated+e.canonicalized+e.coordsCanonicalized+e.wallSegmentsMigrated+e.roomDraftsMigrated+e.roomDraftSegmentsMigrated+e.wallsMerged+e.spansMerged+e.partitionsMerged+e.partitionsReconciled+e.openingsRehosted,c=e.moved+e.rotated+e.coordsCanonicalized+e.wallsStraightened,u=Math.ceil(10*e.maxStraightenShiftCm)/10,_=(this.host._serverCfg?.spaces||[]).find(t=>String(t?.id||"")===e.maxStraightenSpace),g=(this.host._serverCfg?.spaces||[]).length>1&&_?String(_.title||_.id):"",m=e.orphanRoomLabelsRemoved+e.orphanDevicePositionsRemoved+e.orphanGroupPositionsRemoved,f=e.liveMissingPositions.map(t=>t.name).filter(Boolean),b=f.slice(0,3).join(", "),v=Math.max(0,f.length-3),y=b?this.host._t("gs.optimize_live_names",{names:b,more:v?this.host._t("gs.optimize_reference_more",{n:String(v)}):""}):"",$=e.unverifiedPositions.some(t=>"registry_unavailable"===t.reason),w=t=>e.removedPositions.some(e=>e.id===t.id)?this.host._t("gs.optimize_detail_removed"):e.liveMissingPositions.some(e=>e.id===t.id)?this.host._t("gs.optimize_detail_live"):this.host._t("gs.optimize_detail_unverified"),k=t=>this.host._t("room_label"===t?"gs.optimize_detail_room_label":"group"===t?"gs.optimize_detail_group":"device"===t?"gs.optimize_detail_device":"gs.optimize_detail_unknown"),x=[...e.removedPositions,...e.liveMissingPositions.filter(t=>!e.removedPositions.some(e=>e.id===t.id)),...e.unverifiedPositions],M=x.slice(0,10),C=Math.max(0,x.length-M.length);return p`{this.host._alignDialog=null,this.host._preflightClipboardFallback=null}}>
    ${s?p` @@ -2124,7 +2124,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 `:d}`:t.changed?p` ${e.moved?p`

    ${this.host._t("gs.align_count",{n:String(e.moved),total:String(e.total),cm:String(t.cm)})}

    `:d} ${e.latticeCoordinatesCanonicalized?p` -

    ${this.host._t("gs.optimize_lattice_summary",{n:String(e.latticeCoordinatesCanonicalized),cm:Mi(e.latticeMaxShiftCm)})}

    +

    ${this.host._t("gs.optimize_lattice_summary",{n:String(e.latticeCoordinatesCanonicalized),cm:Ci(e.latticeMaxShiftCm)})}

    ${e.latticeSpaces.map(t=>p`

    ${this.host._t("gs.optimize_lattice_space",{space:t.space,n:String(t.canonicalized),far:String(t.far)})}

    `)} `:d} ${t.where?p`

    ${this.host._t("gs.align_where",{s:t.where})}

    `:d} @@ -2137,12 +2137,12 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 ${e.partitionsReconciled?p`

    ${this.host._t("gs.optimize_coincident_partitions",{n:String(e.partitionsReconciled)})}

    `:d} ${e.openingsRehosted?p`

    ${this.host._t("gs.optimize_openings_rehosted",{n:String(e.openingsRehosted)})}

    `:d} ${e.wallsStraightened?p`

    ${this.host._t("gs.optimize_walls_straightened",{n:String(e.wallsStraightened),cm:String(u)})}

    `:d} - ${m?p`

    ${this.host._t("gs.optimize_walls_straightened_where",{s:m})}

    `:d} + ${g?p`

    ${this.host._t("gs.optimize_walls_straightened_where",{s:g})}

    `:d} ${e.glowSpacesMigrated||e.glowRoomsMigrated?p`

    ${this.host._t("gs.optimize_glow_migration",{spaces:String(e.glowSpacesMigrated),rooms:String(e.glowRoomsMigrated)})}

    `:d} ${c?p`
    ${this.host._t("gs.align_warn")}
    `:d}`:p`

    ${this.host._t(e.liveMissingPositions.length||e.unverifiedPositions.length||e.nestedRefsUnresolved?"gs.optimize_no_automatic_changes":"gs.align_none")}

    `} ${!s&&e.wallsStraightenSkipped?p`

    ${this.host._t("gs.optimize_walls_straighten_skipped",{n:String(e.wallsStraightenSkipped)})}

    `:d} ${l?p`

    ${this.host._t("gs.optimize_references",{spaces:String(e.spaceRefsRemapped),rooms:String(e.roomRefsRemapped),positions:String(e.positionsRemapped),detached:String(e.markersDetached)})}

    `:d} - ${g?p`

    ${this.host._t("gs.optimize_orphans_removed",{total:String(g),rooms:String(e.orphanRoomLabelsRemoved),devices:String(e.orphanDevicePositionsRemoved),groups:String(e.orphanGroupPositionsRemoved)})}

    `:d} + ${m?p`

    ${this.host._t("gs.optimize_orphans_removed",{total:String(m),rooms:String(e.orphanRoomLabelsRemoved),devices:String(e.orphanDevicePositionsRemoved),groups:String(e.orphanGroupPositionsRemoved)})}

    `:d} ${e.liveMissingPositions.length?p`

    ${this.host._t(t.removeLiveMissingPositions?"gs.optimize_live_positions_remove":"gs.optimize_live_positions",{n:String(e.liveMissingPositions.length),names:y})}

    @@ -2176,7 +2176,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 ${t.busy?"…":this.host._t("gs.align_run")} `:d}
    - `}_renderSettingsDialog(){return Un.call(this)}_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(Be),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=Ci(t.rules),s=t.test.trim()?Pi(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``}_renderSettingsDialog(){return Un.call(this)}_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=Si(t.rules),s=t.test.trim()?Pi(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")}
    @@ -2208,7 +2208,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0
    - @@ -2233,12 +2233,12 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0
    -
    `}_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?Ii(this.host.hass?.states[n]?.attributes):null,h=!1!==s.live&&("ok"===a.status||"unsupported"===a.status),c=this._vacPlanRoomAnchors(e.space),u=l?Ti(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` +
    `}_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?Ii(this.host.hass?.states[n]?.attributes):null,h=!1!==s.live&&("ok"===a.status||"unsupported"===a.status),c=this._vacPlanRoomAnchors(e.space),u=l?Li(l.rooms,c.map(t=>t.name)):0,_=!!(h&&l&&u>=3),g=t=>{const s=this.host._vacEnsureMarker(e);s&&(s.vacuum={...s.vacuum||{},...t},this.host._regSignature="",this.host._maybeRebuildDevices(),this._saveConfig(),this.host.requestUpdate())},m=new Set(e.entities||[]),f=a.candidates.filter(t=>m.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 p` + `,$=a.candidates.some(t=>m.has(t.entityId)&&"known_xcme_incomplete"===t.category)||!!a.pinned&&!!n?.startsWith("camera.")&&!r?.hasPosition;return p`
    @@ -2266,7 +2266,7 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 ${this.host._t("vac.choose_source")}
    ${f.map(y)} @@ -2286,57 +2286,57 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0
    ${l?p` ${jo(this,e,a)} `:d} -
    `}_vacMapId(t,e,s=this.host._planHass){return this.host._vacMapId(t,e,s)}_vacSaveMatrix(t,e,s,i,o=""){return Oc(this,t,e,s,i,o)}_vacPlanRoomAnchors(t){return(this.host._spaceModelById(t)?.rooms||[]).map(t=>({room:t,poly:N(t)})).filter(({room:t,poly:e})=>t.name&&e).map(({room:t,poly:e})=>{const s=Ri(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?Ii(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=Ai(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=Fi(n.residual,this.host._gridPitch,h);c>Ni?this.host._vacCalConfirm={markerId:t.id,source:e,mapId:i,routeId:a.routeId,space:a.space,matrix:n.matrix,rooms:n.matched.length,error:fe(c,"mi"===this.host.hass?.config?.unit_system?.length)}:await async function(t,e){if(Ec.has(t))return;Ec.add(t);const s=t.host,i=s._markerDialog,o=i?{...i,busy:!0}:null;o&&(s._markerDialog=o,s.requestUpdate());try{await Oc(t,e.markerId,e.source,e.mapId,e.matrix,e.routeId)&&s._showToast(s._t("vac.autocal_done",{rooms:String(e.rooms)}))}finally{Ec.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 Oc(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?Ii(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 Oc(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,Hi)}_vacFitTurn(t){const e=this.host._vacFit;if(!e||e.busy)return;const s=Ii(this.host.hass?.states[e.source]?.attributes),i=this._vacGhostCentre(s?.rooms||[]),o={...e.p,...t};this.host._vacFit={...e,p:Ei(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=Ii(this.host.hass?.states[s.source]?.attributes),e=this._vacGhostCentre(t?.rooms||[]),n=Hi(i.p0),[r,l]=Oi(n,e[0],e[1]),[h,c]=Oi(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:Ei(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=Ii(this.host._renderPlanHass?.states?.[e.source]?.attributes);if(!s)return d;const i=Hi(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])=>Oi(i,t,e));e.forEach(([t,e])=>{a.push(t),n.push(e)});const[s,r]=Oi(i,t.cx,t.cy);o.push(Et` - ${t.name}`)}let r=d;if(s.pos){const[e,o]=Oi(i,s.pos.x,s.pos.y);r=Et``}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(Et``}_vacMapId(t,e,s=this.host._planHass){return this.host._vacMapId(t,e,s)}_vacSaveMatrix(t,e,s,i,o=""){return Oc(this,t,e,s,i,o)}_vacPlanRoomAnchors(t){return(this.host._spaceModelById(t)?.rooms||[]).map(t=>({room:t,poly:N(t)})).filter(({room:t,poly:e})=>t.name&&e).map(({room:t,poly:e})=>{const s=Ri(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?Ii(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=zi(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=Fi(n.residual,this.host._gridPitch,h);c>Ni?this.host._vacCalConfirm={markerId:t.id,source:e,mapId:i,routeId:a.routeId,space:a.space,matrix:n.matrix,rooms:n.matched.length,error:fe(c,"mi"===this.host.hass?.config?.unit_system?.length)}:await async function(t,e){if(Ac.has(t))return;Ac.add(t);const s=t.host,i=s._markerDialog,o=i?{...i,busy:!0}:null;o&&(s._markerDialog=o,s.requestUpdate());try{await Oc(t,e.markerId,e.source,e.mapId,e.matrix,e.routeId)&&s._showToast(s._t("vac.autocal_done",{rooms:String(e.rooms)}))}finally{Ac.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 Oc(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?Ii(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 Oc(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,Ei)}_vacFitTurn(t){const e=this.host._vacFit;if(!e||e.busy)return;const s=Ii(this.host.hass?.states[e.source]?.attributes),i=this._vacGhostCentre(s?.rooms||[]),o={...e.p,...t};this.host._vacFit={...e,p:Ai(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=Ii(this.host.hass?.states[s.source]?.attributes),e=this._vacGhostCentre(t?.rooms||[]),n=Ei(i.p0),[r,l]=Oi(n,e[0],e[1]),[h,c]=Oi(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,g=Math.max(.05,_/d),m={...i.p0,s:i.p0.s*g};this.host._vacFit={...s,p:Ai(m,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=Ii(this.host._renderPlanHass?.states?.[e.source]?.attributes);if(!s)return d;const i=Ei(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])=>Oi(i,t,e));e.forEach(([t,e])=>{a.push(t),n.push(e)});const[s,r]=Oi(i,t.cx,t.cy);o.push(At` + ${t.name}`)}let r=d;if(s.pos){const[e,o]=Oi(i,s.pos.x,s.pos.y);r=At``}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(At` `)}}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}${l}`}_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="custom"===this.host._roomFill?t.settings?.custom_fill:null;this.host._roomCustomFill=e&&"object"==typeof e?pi(e,_(this.host._curSpaceCfg).customFill):null,[this.host._roomTempMin,this.host._roomTempMax]=Li(t.settings),this.host._roomTempSrc=t.settings?.temp_source||"",this.host._roomHumSrc=t.settings?.hum_source||"",this.host._roomNameScale=Bi(t.settings?.name_scale),this.host._roomLabelScale=Bi(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),"custom"===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),Wi(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};Wi(i,this.host._roomTempMin,this.host._roomTempMax)&&(this.host._roomFill?i.fill_mode=this.host._roomFill:delete i.fill_mode,"custom"===this.host._roomFill&&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=me(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(ge(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*vd,y:s.y*vd};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},$d(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=qe(this.host._drag.ox+h),p=qe(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},$d(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/vd,y:a.y/vd,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=ms(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=N(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 Et``;const e=this.host._drag?.id.startsWith("rl_")?.5*this.host._gridPitch:.05*this.host._gridPitch,s=ji(t,this._alignCandidates(),e);if(!s.length)return Et``;const i=this.host._gridPitch,o=1.5*i;return Et` - ${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 Et` + `}_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=N(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 At``;const e=this.host._drag?.id.startsWith("rl_")?.5*this.host._gridPitch:.05*this.host._gridPitch,s=ji(t,this._alignCandidates(),e);if(!s.length)return At``;const i=this.host._gridPitch,o=1.5*i;return At` + ${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 At` `})} - `}_renderOpeningCenterTick(t){const e=(t.angle+90)*Math.PI/180,s=Wt(15,this.host._cellCm);return Et``}_renderOpeningCenterTick(t){const e=(t.angle+90)*Math.PI/180,s=Wt(15,this.host._cellCm);return At``}_renderOpeningDimensionGuides(t){const e=t.labels.flatMap(t=>t.dimension?[t.dimension]:[]);if(!e.length)return Et``;const s=this._cssPxToRender(4);return Et``;return At` ${o(t.from,"from")}${o(t.to,"to")} `})} - `}_renderOpeningPlacementPreview(){const t=this.host._openingPreview;if(!t)return Et``;const e={type:t.type,length:t.renderedLength,angle:t.angle,amount:Gi(t.type,null),flipH:t.flipH,flipV:t.flipV,base:"var(--hp-open)",tone:"var(--hp-open)",cellCm:this.host._cellCm,gridPitch:this.host._gridPitch,face:t.face},s="passage"===t.type?qi(t,Wt(this.host._gridPitch,this.host._cellCm)):null;return Et``}_renderOpeningPlacementPreview(){const t=this.host._openingPreview;if(!t)return At``;const e={type:t.type,length:t.renderedLength,angle:t.angle,amount:Gi(t.type,null),flipH:t.flipH,flipV:t.flipV,base:"var(--hp-open)",tone:"var(--hp-open)",cellCm:this.host._cellCm,gridPitch:this.host._gridPitch,face:t.face},s="passage"===t.type?qi(t,Wt(this.host._gridPitch,this.host._cellCm)):null;return At` `}_renderOpeningDialog(){const t=this.host._openingDialog,e=this.host._spaceModel()?.partitions||[],s=t.id?this.host._curSpaceCfg?.openings?.find(e=>e.id===t.id):null,i={id:t.id||"preview",type:t.type,x:t.x/vd,y:t.y/this.host._spaceH,angle:t.angle,length:s&&!t.lengthTouched?s.length:this.host._cmToUnits(Math.max(20,t.lengthCm))/vd,...t.host?{host:t.host}:{}},o=Js(s,i),a=t.host?o?q(i,e,vd,this.host._cellCm,this.host._gridPitch):E(i,e,vd,this.host._cellCm,this.host._gridPitch):null,n="does-not-fit-jamb"===a?.reason,r=t.host?e.find(e=>e.id===t.host.id):null,l=r?fe(r.cm/2,this.host._imperial):"",h=!!t.host&&!a?.resolved&&!n,c="gate"===t.type?"mdi:gate":"window"===t.type?"mdi:window-closed-variant":"passage"===t.type?"mdi:arch":"mdi:door",u=(e,s)=>{const i="contact"===e?t.contact:t.lock,o="contact"===e?!!t.contactOpen:!!t.lockOpen,a="contact"===e?t.contactFilter||"":t.lockFilter||"",n=s.find(t=>t.value===i),r=n?.label||this.host.hass.states[i]?.attributes?.friendly_name||this.host._fullRegistryHass.entities[i]?.name||i,l=uo(s,a);return p` + r=${Wt(.18*this.host._gridPitch,this.host._cellCm)}>`}_renderOpeningDialog(){const t=this.host._openingDialog,e=this.host._spaceModel()?.partitions||[],s=t.id?this.host._curSpaceCfg?.openings?.find(e=>e.id===t.id):null,i={id:t.id||"preview",type:t.type,x:t.x/vd,y:t.y/this.host._spaceH,angle:t.angle,length:s&&!t.lengthTouched?s.length:this.host._cmToUnits(Math.max(20,t.lengthCm))/vd,...t.host?{host:t.host}:{}},o=Js(s,i),a=t.host?o?q(i,e,vd,this.host._cellCm,this.host._gridPitch):A(i,e,vd,this.host._cellCm,this.host._gridPitch):null,n="does-not-fit-jamb"===a?.reason,r=t.host?e.find(e=>e.id===t.host.id):null,l=r?fe(r.cm/2,this.host._imperial):"",h=!!t.host&&!a?.resolved&&!n,c="gate"===t.type?"mdi:gate":"window"===t.type?"mdi:window-closed-variant":"passage"===t.type?"mdi:arch":"mdi:door",u=(e,s)=>{const i="contact"===e?t.contact:t.lock,o="contact"===e?!!t.contactOpen:!!t.lockOpen,a="contact"===e?t.contactFilter||"":t.lockFilter||"",n=s.find(t=>t.value===i),r=n?.label||this.host.hass.states[i]?.attributes?.friendly_name||this.host._fullRegistryHass.entities[i]?.name||i,l=uo(s,a);return p`
    -
    `}_gridLevels(){const t=this.host._stageEl,e=this.host._viewOr(this.host._baseVb()),s=t&&t.clientWidth&&e.w?t.clientWidth/e.w:1;return Vi(this.host._gridPitch,s)}_renderMarkupDefs(t){const e=this._gridLevels();if(!e)return Et``;const s=this.host._gridPitch*e.fine,i=this.host._gridPitch*e.coarse,o=this.host._gridPitch*e.fine*.14;return Et` +
    `}_gridLevels(){const t=this.host._stageEl,e=this.host._viewOr(this.host._baseVb()),s=t&&t.clientWidth&&e.w?t.clientWidth/e.w:1;return Vi(this.host._gridPitch,s)}_renderMarkupDefs(t){const e=this._gridLevels();if(!e)return At``;const s=this.host._gridPitch*e.fine,i=this.host._gridPitch*e.coarse,o=this.host._gridPitch*e.fine*.14;return At` @@ -2446,67 +2446,67 @@ globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0 - `}_renderPhysicalEditorLayer(){const t=this.host._spaceModel();if(!t)return Et``;const e=this.host._gridPitch,s=this.host._viewOr(this.host._baseVb()),i=this.host._stageEl,o=i?.clientWidth?s.w/i.clientWidth:e/8,a=Math.max(.22*e,8*o),n=Math.max(a,12*o),r=t=>`M ${t.map(t=>`${t[0]} ${t[1]}`).join(" L ")} Z`,l=(t,e)=>this.host._physicalSel?.kind===t&&this.host._physicalSel.id===e||"column"===t&&this.host._duplicateColumnId===e,h=(t.partitions||[]).map(t=>{const e=ns(t.a,t.b,t.cm,this.host._cellCm,this.host._gridPitch);return e?Et``}_renderPhysicalEditorLayer(){const t=this.host._spaceModel();if(!t)return At``;const e=this.host._gridPitch,s=this.host._viewOr(this.host._baseVb()),i=this.host._stageEl,o=i?.clientWidth?s.w/i.clientWidth:e/8,a=Math.max(.22*e,8*o),n=Math.max(a,12*o),r=t=>`M ${t.map(t=>`${t[0]} ${t[1]}`).join(" L ")} Z`,l=(t,e)=>this.host._physicalSel?.kind===t&&this.host._physicalSel.id===e||"column"===t&&this.host._duplicateColumnId===e,h=(t.partitions||[]).map(t=>{const e=ns(t.a,t.b,t.cm,this.host._cellCm,this.host._gridPitch);return e?At`this._physicalDown(e,"partition",t.id)} @pointermove=${t=>this._physicalMove(t)} - @pointerup=${t=>this._physicalUp(t)}>`:Et`this._physicalUp(t)}>`:At`this._physicalDown(e,"partition",t.id)} @pointermove=${t=>this._physicalMove(t)} - @pointerup=${t=>this._physicalUp(t)}>`}),c=(t.wall_columns||[]).map(t=>{const e=this.host._physicalRotate?.id===t.id?{...t,angle:this.host._physicalRotate.angle}:t,s=as(e,this.host._cellCm,this.host._gridPitch);return Et`this._physicalUp(t)}>`}),c=(t.wall_columns||[]).map(t=>{const e=this.host._physicalRotate?.id===t.id?{...t,angle:this.host._physicalRotate.angle}:t,s=as(e,this.host._cellCm,this.host._gridPitch);return At`this._physicalDown(e,"column",t.id)} @pointermove=${t=>this._physicalMove(t)} - @pointerup=${t=>this._physicalUp(t)}>`}),p=this.host._physicalDrag,u=(()=>{if(!p?.moved)return d;if("partition"===p.kind&&0===Number(p.base.cm)){const t=p.base;return Et`this._physicalUp(t)}>`}),p=this.host._physicalDrag,u=(()=>{if(!p?.moved)return d;if("partition"===p.kind&&0===Number(p.base.cm)){const t=p.base;return At``}const t="partition"===p.kind?ns(p.base.a,p.base.b,p.base.cm,this.host._cellCm,this.host._gridPitch):as(p.base,this.host._cellCm,this.host._gridPitch);return t?Et``:d})(),_=(()=>{const s=this.host._physicalSel;if(!s)return d;if("partition"===s.kind){const e=t.partitions.find(t=>t.id===s.id);if(!e)return d;const i=ns(e.a,e.b,e.cm,this.host._cellCm,this.host._gridPitch),o=(e.a[0]+e.b[0])/2,n=(e.a[1]+e.b[1])/2;return Et` - ${i?Et``:Et``}const t="partition"===p.kind?ns(p.base.a,p.base.b,p.base.cm,this.host._cellCm,this.host._gridPitch):as(p.base,this.host._cellCm,this.host._gridPitch);return t?At``:d})(),_=(()=>{const s=this.host._physicalSel;if(!s)return d;if("partition"===s.kind){const e=t.partitions.find(t=>t.id===s.id);if(!e)return d;const i=ns(e.a,e.b,e.cm,this.host._cellCm,this.host._gridPitch),o=(e.a[0]+e.b[0])/2,n=(e.a[1]+e.b[1])/2;return At` + ${i?At``:At``} - `}const i=t.wall_columns.find(t=>t.id===s.id);if(!i)return d;const l=this.host._physicalRotate?.id===i.id?{...i,angle:this.host._physicalRotate.angle}:i,h=as(l,this.host._cellCm,this.host._gridPitch);if("square"!==l.shape)return Et` + `}const i=t.wall_columns.find(t=>t.id===s.id);if(!i)return d;const l=this.host._physicalRotate?.id===i.id?{...i,angle:this.host._physicalRotate.angle}:i,h=as(l,this.host._cellCm,this.host._gridPitch);if("square"!==l.shape)return At` - `;const c=V(l.cm,this.host._cellCm,this.host._gridPitch),p=Je(l.angle)*Math.PI/180,u=Math.sin(p),_=-Math.cos(p),m=[l.center[0]+u*c/2,l.center[1]+_*c/2],g=[m[0]+u*Math.max(e,24*o),m[1]+_*Math.max(e,24*o)];return Et` + `;const c=V(l.cm,this.host._cellCm,this.host._gridPitch),p=Je(l.angle)*Math.PI/180,u=Math.sin(p),_=-Math.cos(p),g=[l.center[0]+u*c/2,l.center[1]+_*c/2],m=[g[0]+u*Math.max(e,24*o),g[1]+_*Math.max(e,24*o)];return At` - - + this._physicalRotateDown(t,i)} @pointermove=${t=>this._physicalRotateMove(t)} @pointerup=${t=>this._physicalRotateUp(t)}> - `})();return Et`${h}${c}${u}${_}`}_renderHiddenWallDiagnosticOverlay(){if(!this.host._markup)return Et``;const t=this._hiddenWallDiagnosticSnapshot().value;if(!t.segments.length)return Et``;const e=V(5,this.host._cellCm,this.host._gridPitch);return Et``})();return At`${h}${c}${u}${_}`}_renderHiddenWallDiagnosticOverlay(){if(!this.host._markup)return At``;const t=this._hiddenWallDiagnosticSnapshot().value;if(!t.segments.length)return At``;const e=V(5,this.host._cellCm,this.host._gridPitch);return At``}_renderPlanSnapOverlay(){if(!this.host._markup)return Et``;const t=this._planSnapGeometrySnapshot().value,e=this.host._activePlanSnapCandidate,s=new Set(this.host._activePlanSnapConflicts.map(t=>t.key)),i=V(5,this.host._cellCm,this.host._gridPitch),o=V(10,this.host._cellCm,this.host._gridPitch);return Et``}_renderPlanSnapOverlay(){if(!this.host._markup)return At``;const t=this._planSnapGeometrySnapshot().value,e=this.host._activePlanSnapCandidate,s=new Set(this.host._activePlanSnapConflicts.map(t=>t.key)),i=V(5,this.host._cellCm,this.host._gridPitch),o=V(10,this.host._cellCm,this.host._gridPitch);return At``}_syncPlanSnapActiveMarker(t){const e=this.host.renderRoot?.querySelector('[data-hp="plan-snap-active-marker"]');if(e){if(e.setAttribute("class",`plan-snap-node${t?" active":""}${"line"===t?.kind?" dynamic":""}`),e.setAttribute("data-active",t?"true":"false"),e.setAttribute("visibility",t?"visible":"hidden"),!t)return e.removeAttribute("data-kind"),void e.removeAttribute("data-key");e.setAttribute("data-kind",t.kind),e.setAttribute("data-key",t.key),e.setAttribute("cx",String(t.point[0])),e.setAttribute("cy",String(t.point[1])),e.setAttribute("r",String(V(10,this.host._cellCm,this.host._gridPitch)))}}_syncPlanSnapConflictMarkers(t){const e=new Set(t.map(t=>t.key));for(const t of this.host.renderRoot?.querySelectorAll('.plan-snap-node[data-kind="endpoint"]')||[])t.setAttribute("class","plan-snap-node"+(e.has(t.dataset.key||"")?" conflict":""))}_planSnapPhysicalSegment(t){let e=0;const s=this.host._spaceModel();return s?(e="partition"===t.sourceKind?Number(s.partitions.find(e=>e.id===t.sourceId)?.cm)||0:Ji(s.rooms,this.host._spaceWalls,this.host._openCuts(),[t.a[0],t.a[1],t.b[0],t.b[1]],this.host._wallKeyPitch,this.host._cellCm,this.host._gridPitch,vd),e>0?{a:[...t.a],b:[...t.b],halfDepth:V(e,this.host._cellCm,this.host._gridPitch)/2}:null):null}_drawPreviewJoinPatchD(t,e){if(t.length<2)return"";const s=[];for(let i=0;i+10&&s.push({a:t[i],b:t[i+1],halfDepth:e[i]});if(!s.length)return"";const i=2e-4*this.host._gridPitch,o=this._planSnapGeometrySnapshot().value.segments.filter(e=>t.some(t=>ye(t,[e.a[0],e.a[1],e.b[0],e.b[1]])<=i)).map(t=>this._planSnapPhysicalSegment(t)).filter(t=>!!t);return Yi([...s,...o],i).map(t=>`M ${t.map(t=>`${t[0]} ${t[1]}`).join(" L ")} Z`).join(" ")}_renderMarkupLayer(t){const e=this.host._openCuts(),s=this.host._thickWallCuts(),i=e.concat(s),o=i.length?ve(this.host._segments,i,.02*this.host._gridPitch):this.host._segments,a=this.host._path,n=this.host._gridPitch,r=this.host._viewOr(this.host._baseVb()),l="draw"===this.host._tool?this.host._drawWallCm:null,h=(()=>"draw"===this.host._tool&&a.length&&null!=l?this.host._contourClosed?a:this.host._cursorPt?[...a,this.host._cursorPt]:a.length>=2?a:null:null)(),c=h?Qh(h.length-1,this.host._contourClosed?[...this.host._wallChainSegmentCms,this.host._closingWallCm??void 0]:this.host._wallChainSegmentCms,l,L).map(t=>V(t,this.host._cellCm,this.host._gridPitch)/2):[],p=h?Xi(h,V(l,this.host._cellCm,this.host._gridPitch)/2,this.host._contourClosed,c):"",u=h?this._drawPreviewJoinPatchD(h,c):"",_=this.host._wallFaceBatch?.candidates[this.host._wallFaceBatch.index]?.repair||this.host._wallRepairDiagnostic;return Et` - ${this._gridLevels()?Et``:d} - ${o.map(t=>Et``)} + `}_syncPlanSnapActiveMarker(t){const e=this.host.renderRoot?.querySelector('[data-hp="plan-snap-active-marker"]');if(e){if(e.setAttribute("class",`plan-snap-node${t?" active":""}${"line"===t?.kind?" dynamic":""}`),e.setAttribute("data-active",t?"true":"false"),e.setAttribute("visibility",t?"visible":"hidden"),!t)return e.removeAttribute("data-kind"),void e.removeAttribute("data-key");e.setAttribute("data-kind",t.kind),e.setAttribute("data-key",t.key),e.setAttribute("cx",String(t.point[0])),e.setAttribute("cy",String(t.point[1])),e.setAttribute("r",String(V(10,this.host._cellCm,this.host._gridPitch)))}}_syncPlanSnapConflictMarkers(t){const e=new Set(t.map(t=>t.key));for(const t of this.host.renderRoot?.querySelectorAll('.plan-snap-node[data-kind="endpoint"]')||[])t.setAttribute("class","plan-snap-node"+(e.has(t.dataset.key||"")?" conflict":""))}_planSnapPhysicalSegment(t){let e=0;const s=this.host._spaceModel();return s?(e="partition"===t.sourceKind?Number(s.partitions.find(e=>e.id===t.sourceId)?.cm)||0:Ji(s.rooms,this.host._spaceWalls,this.host._openCuts(),[t.a[0],t.a[1],t.b[0],t.b[1]],this.host._wallKeyPitch,this.host._cellCm,this.host._gridPitch,vd),e>0?{a:[...t.a],b:[...t.b],halfDepth:V(e,this.host._cellCm,this.host._gridPitch)/2}:null):null}_drawPreviewJoinPatchD(t,e){if(t.length<2)return"";const s=[];for(let i=0;i+10&&s.push({a:t[i],b:t[i+1],halfDepth:e[i]});if(!s.length)return"";const i=2e-4*this.host._gridPitch,o=this._planSnapGeometrySnapshot().value.segments.filter(e=>t.some(t=>ye(t,[e.a[0],e.a[1],e.b[0],e.b[1]])<=i)).map(t=>this._planSnapPhysicalSegment(t)).filter(t=>!!t);return Zi([...s,...o],i).map(t=>`M ${t.map(t=>`${t[0]} ${t[1]}`).join(" L ")} Z`).join(" ")}_renderMarkupLayer(t){const e=this.host._openCuts(),s=this.host._thickWallCuts(),i=e.concat(s),o=i.length?ve(this.host._segments,i,.02*this.host._gridPitch):this.host._segments,a=this.host._path,n=this.host._gridPitch,r=this.host._viewOr(this.host._baseVb()),l="draw"===this.host._tool?this.host._drawWallCm:null,h=(()=>"draw"===this.host._tool&&a.length&&null!=l?this.host._contourClosed?a:this.host._cursorPt?[...a,this.host._cursorPt]:a.length>=2?a:null:null)(),c=h?Qh(h.length-1,this.host._contourClosed?[...this.host._wallChainSegmentCms,this.host._closingWallCm??void 0]:this.host._wallChainSegmentCms,l,B).map(t=>V(t,this.host._cellCm,this.host._gridPitch)/2):[],p=h?Yi(h,V(l,this.host._cellCm,this.host._gridPitch)/2,this.host._contourClosed,c):"",u=h?this._drawPreviewJoinPatchD(h,c):"",_=this.host._wallFaceBatch?.candidates[this.host._wallFaceBatch.index]?.repair||this.host._wallRepairDiagnostic;return At` + ${this._gridLevels()?At``:d} + ${o.map(t=>At``)} ${this._renderPhysicalEditorLayer()} - ${"column"===this.host._tool&&this.host._cursorPt&&this.host._drawWallCm?Et`{const t={shape:"square",center:this.host._cursorPt,cm:this.host._drawWallCm};return`M ${as(t,this.host._cellCm,this.host._gridPitch).map(t=>`${t[0]} ${t[1]}`).join(" L ")} Z`})()}>`:d} - ${p?Et` + ${"column"===this.host._tool&&this.host._cursorPt&&this.host._drawWallCm?At`{const t={shape:"square",center:this.host._cursorPt,cm:this.host._drawWallCm};return`M ${as(t,this.host._cellCm,this.host._gridPitch).map(t=>`${t[0]} ${t[1]}`).join(" L ")} Z`})()}>`:d} + ${p?At` `:d} - ${h&&0===l?Et`t.join(",")).join(" ")}>`:d} - ${u?Et` + ${u?At` `:d} - ${_?Et``:d} - ${"split"===this.host._tool&&this.host._splitSel?.pts?.length?Et`${this.host._splitSel.pts.length>1?Et``:d} - ${this.host._splitSel.pts.map((t,e)=>Et`1?At``:d} + ${this.host._splitSel.pts.map((t,e)=>At``)} - ${this.host._cursorPt?Et``:d}`:d} - `}_renderActiveChainInk(){const t=this.host._path,e=this.host._gridPitch;return Et` - ${t.length>1?Et``:d} - ${t.length&&this.host._cursorPt&&"draw"===this.host._tool&&!this.host._contourClosed?Et`1?At``:d} + ${t.length&&this.host._cursorPt&&"draw"===this.host._tool&&!this.host._contourClosed?At` - ${this.host._activePlanSnapCandidate||this.host._activePlanSnapConflicts.length?d:Et``}`:d} - ${t.map((t,s)=>Et`At``)} `}_renderPartitionDeleteDialog(){const t=this.host._partitionDeleteDialog,e="mi"===this.host.hass?.config?.unit_system?.length;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?[...Zi]:t.draftExcluded:i?[...i]:[...Zi],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(_o({...i,settings:t,excluded:e})),a=(t,e)=>new Set(mo({...i,settings:t,excluded:e}).map(t=>t.bindingRef||t.id)),n=Qi(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`
    `}_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?[...Xi]:t.draftExcluded:i?[...i]:[...Xi],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(_o({...i,settings:t,excluded:e})),a=(t,e)=>new Set(go({...i,settings:t,excluded:e}).map(t=>t.bindingRef||t.id)),n=Qi(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,g=0;const m=t=>t.includes("light.");for(const t of h)c.has(t)||(u++,m(t)&&g++);for(const t of c)h.has(t)||(_++,m(t)&&g++);for(const t of p)d.has(t)||(u++,m(t)&&g++);for(const t of d)p.has(t)||(_++,m(t)&&g++);const f={appear:u,hide:_,lights:g};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")}
    - `}_markerValueBadgeFields(t){return to({touched:t.valueBadgeTouched,originalHas:t.originalHasValueBadge,original:t.originalValueBadge,enabled:t.valueBadgeEnabled,source:t.valueBadgeSource,position:t.valueBadgePosition})}_markerValueSourceFields(t){return eo({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=S(t.room),s=si(t.binding,t.devId,()=>"__hp_device_preview__"),i=this.host._markers.find(e=>e.id===s||e.id===t.devId),o=x(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=kt(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${yt(this.host._markers)}\n${JSON.stringify(e)}`;if(this.host._markerPreviewMemo?.key===s)return this.host._markerPreviewMemo.device;const i=so({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 io(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:oi(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=g(this.host._planHass,i,o),n=f(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 oo(ao(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&&no(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&&$(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 $(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} ${$(o).join(" ")}`.toLowerCase()})}const o=Object.keys(this.host.hass.states||{}).filter(e=>ro(e)&&!i.has(e)&&lo(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(ho(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=co(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 zh({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(){return oa.call(this)}_renderSpaceDialog(){return qn.call(this)}_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`
    - `}}v.properties={context:{attribute:!1}},v.styles=A`:host{display:contents;}.body{display:grid;gap:12px;width:100%;max-width:100%;min-width:0;padding:16px 20px;box-sizing:border-box;}label{display:flex;min-width:0;min-height:44px;align-items:center;gap:12px;cursor:pointer;}label span{min-width:0;overflow-wrap:anywhere;}input{width:20px;height:20px;flex:none;accent-color:var(--hp-accent,#d89300);}.row{display:flex;align-items:center;gap:8px;width:100%;max-width:100%;min-width:0;padding:12px 16px;box-sizing:border-box;}.spacer{flex:1;}button{min-width:0;min-height:44px;max-width:100%;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--hp-line,rgb(127 127 127/.3));border-radius:12px;padding:0 18px;box-sizing:border-box;overflow-wrap:anywhere;white-space:normal;background:transparent;color:inherit;font:inherit;cursor:pointer;}button.primary{background:var(--hp-accent,#d89300);color:var(--hp-on-accent,#111);border-color:transparent;}button:disabled{opacity:.55;cursor:default;}ha-icon{flex:none;margin-right:6px;}@media (max-width:360px){.row{display:grid;grid-template-columns:minmax(0,1fr);}.spacer{display:none;}button{width:100%;}}`,customElements.get("hp-pdf-dialog")||customElements.define("hp-pdf-dialog",v);const V=(A,B,E)=>Math.hypot(A[0]-B[0],A[1]-B[1])<=E,U=A=>Number.isFinite(A)&&A>=0?A:0;function l(A){const B=Number(A);return Number.isFinite(B)&&B>0?.1/B:0}const a=(A,B)=>[...new Set([...A,...B])].sort((A,B)=>A-B),P=(A,B)=>{const E=A.points.length;if(E<=1||!V(A.points[E-1],A.points[0],B))return!1;const s=E-2;return A.edgeSources[s]=a(A.edgeSources[s],A.edgeSources[E-1]),A.points.splice(E-1,1),A.edgeSources.splice(E-1,1),!0},y=(A,B)=>{for(let E=0;E+1{let E=!1;for(;A.points.length>1;)if(P(A,B))E=!0;else{if(!y(A,B))break;E=!0}return E},N=(A,B,E)=>{const s=B[0]-A[0],w=B[1]-A[1],C=E[0]-B[0],g=E[1]-B[1],I=Math.hypot(s,w),Y=Math.hypot(C,g);if(!(I>0&&Y>0))return!1;const R=s*C+w*g;if(!(R>0))return!1;const M=s*g-w*C;return Math.abs(M)<=R*Q},K=A=>{const B=A.points.length;if(B<3)return!1;for(let E=0;E{const E=U(B),s=[],w=[];for(let B=0;B[A])};for(;Q.points.length>1;){const A=u(Q,E);if(Q.points.length<3)break;if(!K(Q)&&!A)break}return u(Q,E),Q};function J(A,B){const E=Number(A[0]),s=Number(A[1]),w=Number(B[0]),C=Number(B[1]);if(![E,s,w,C].every(Number.isFinite))return null;const g=w-E,I=C-s,Y=Math.abs(g),R=Math.abs(I),M=Math.max(Y,R),F=Math.min(Y,R);if(!(M>0)||F/M>Q)return null;const i=[(E+w)/2,(s+C)/2];if(Y>=R){return{axis:"horizontal",a:[E,i[1]],b:[w,i[1]],mid:i,projectedLength:Y,tangentInterval:[Math.min(E,w),Math.max(E,w)],normalCoordinate:i[1]}}return{axis:"vertical",a:[i[0],s],b:[i[0],C],mid:i,projectedLength:R,tangentInterval:[Math.min(s,C),Math.max(s,C)],normalCoordinate:i[0]}}function Z(A,B){const E=B.map(A=>[Number(A[0]),Number(A[1])]);if(!E.every(A=>A.every(Number.isFinite)))return!1;if(E.length<3||((A,B)=>{const E=1e-12*Math.max(1,Math.abs(A[0]),Math.abs(A[1]),...B.flatMap(A=>[Math.abs(A[0]),Math.abs(A[1])]));for(let s=0;s0))continue;const Y=(A[0]-w[0])*g-(A[1]-w[1])*C;if(Math.abs(Y)>E*I)continue;const R=(A[0]-w[0])*C+(A[1]-w[1])*g;if(R>=-E&&R<=I*I+E)return!0}return!1})(A,E))return!1;let s=!1;for(let B=0,w=E.length-1;BA[1]==C[1]>A[1])continue;const g=(C[0]-Q[0])*(A[1]-Q[1])/(C[1]-Q[1])+Q[0];A[0]Object.is(A,-0)?0:A,I=[g(-Q/C),g(w/C)],Y=[g(-I[0]),g(-I[1])],R=[(B[0]+E[0])/2,(B[1]+E[1])/2],M=Math.max(1,C,Math.abs(R[0]),Math.abs(R[1])),F=Math.max(1e-9*M,.01*U(s));for(const B of[F,4*F,16*F]){const E=Z([R[0]+I[0]*B,R[1]+I[1]*B],A);if(E!==Z([R[0]+Y[0]*B,R[1]+Y[1]*B],A))return E?I:Y}return sA(A)>=0?I:Y}function f(A,B){let E=180*Math.atan2(B[1]-A[1],B[0]-A[0])/Math.PI;return E>90&&(E-=180),E<=-90&&(E+=180),E}function k(A,B,E,s={}){const w=Number(B);if(!(w>0&&Number.isFinite(w)))return[];const Q=void 0===s.epsilon?l(w):U(s.epsilon);return z(d(A,Q),w,E,{...s,epsilon:Q})}const z=(A,B,E,s)=>{if(A.points.length<3)return[];const Q=U(s.epsilon??l(B)),C=Number.isFinite(Number(s.ringIndex))?Number(s.ringIndex):0,g=[];for(let s=0;sQ))continue;const M=[...A.edgeSources[s]||[s]].sort((A,B)=>A-B),F=M[0]??s,i=T(A.points,R.a,R.b,Q),x=("horizontal"===R.axis?i[1]:i[0])<0?-1:1,b=[R.axis,O(R.tangentInterval[0]),String(x),O(C),O(F)].join("|"),L=R.projectedLength*B;g.push({sourceA:[...I],sourceB:[...Y],a:R.a,b:R.b,text:w(L,E),short:L<30,angle:f(R.a,R.b),mid:R.mid,axis:R.axis,projectedLength:R.projectedLength,tangentInterval:R.tangentInterval,normalCoordinate:R.normalCoordinate,inwardNormal:i,normalSign:x,source:{ringIndex:C,edgeIndex:F},sourceEdgeIndices:M,stableKey:b})}return g};function p(A,B,E,s={}){const w=Number(B);if(!(w>0&&Number.isFinite(w)))return[];const Q=void 0===s.epsilon?l(w):U(s.epsilon);let C=d(A,Q);if(sA(C.points)<0&&(C=(A=>{const B=A.points.length;return{points:[...A.points].reverse().map(A=>[...A]),edgeSources:A.points.map((E,s)=>[...A.edgeSources[(B-2-s+B)%B]])}})(C)),C.points.length){let A=0;for(let B=1;B({points:[...A.points.slice(B),...A.points.slice(0,B)],edgeSources:[...A.edgeSources.slice(B),...A.edgeSources.slice(0,B)]}))(C,A)}return z(C,w,E,{...s,epsilon:Q})}function X(A,B){const E=U(B),s=[];for(const B of A){const A=s.find(A=>A.axis===B.axis&&A.normalSign===B.normalSign&&Math.abs(A.normalCoordinate-B.normalCoordinate)<=E);A?A.edges.push(B):s.push({axis:B.axis,normalSign:B.normalSign,normalCoordinate:B.normalCoordinate,edges:[B]})}return s.map(A=>A.edges)}const O=A=>Object.is(A,-0)?"0":String(A),q=A=>"horizontal"===A?0:1;function $(A,B){return q(A.axis)-q(B.axis)||A.tangentInterval[0]-B.tangentInterval[0]||A.normalSign-B.normalSign||A.source.ringIndex-B.source.ringIndex||A.source.edgeIndex-B.source.edgeIndex}function _(A,B,E,s){const w=U(s);if(A.axis!==B.axis)return!1;if(A.source.ringIndex!==B.source.ringIndex)return!1;if(A.inwardNormal[0]*B.inwardNormal[0]+A.inwardNormal[1]*B.inwardNormal[1]>=-.5)return!1;if(!((A,B,E)=>Math.abs(A[0]-B[0])<=E&&Math.abs(A[1]-B[1])<=E)(A.tangentInterval,B.tangentInterval,w))return!1;if(Math.abs(A.projectedLength-B.projectedLength)>w)return!1;return Z([(A.mid[0]+B.mid[0])/2,(A.mid[1]+B.mid[1])/2],E)}const AA=(A,B)=>{const E=B?.(A);return{hardCollisions:Number.isFinite(Number(E?.hardCollisions))?Number(E?.hardCollisions):0,normalClearance:Number.isFinite(Number(E?.normalClearance))?Number(E?.normalClearance):0}},BA=(A,B,E)=>{const s=AA(A,E),w=AA(B,E);return s.hardCollisions-w.hardCollisions||w.normalClearance-s.normalClearance||$(A,B)};function EA(A,B){if(A.length<2)return[...A];const E=U(B.epsilon),s=function(A,B=1e-7){return d(A,B).points.map(A=>[...A])}(B.ring,E),w=[];for(let B=0;B{const E=A.separation-B.separation;if(E)return E;const s=$(A.left,A.right)<=0?A.left:A.right,w=s===A.left?A.right:A.left,Q=$(B.left,B.right)<=0?B.left:B.right,C=Q===B.left?B.right:B.left;return $(s,Q)||$(w,C)});const Q=new Set,C=new Set;for(const A of w){if(Q.has(A.left)||Q.has(A.right))continue;Q.add(A.left),Q.add(A.right);const E=BA(A.left,A.right,B.score)<=0?A.left:A.right;C.add(E===A.left?A.right:A.left)}return A.filter(A=>!C.has(A))}function sA(A){let B=0;for(let E=0;E1){const A=Math.sqrt(G);Y*=A,R*=A}const o=Math.max(0,Y*Y*R*R-Y*Y*D*D-R*R*L*L),t=Y*Y*D*D+R*R*L*L||1,c=(Q===C?-1:1)*Math.sqrt(o/t),W=c*Y*D/R,m=c*-R*L/Y,n=F*W-i*m+(A+g)/2,e=i*W+F*m+(B+I)/2;let h=gA(1,0,(L-W)/Y,(D-m)/R),S=gA((L-W)/Y,(D-m)/R,(-L-W)/Y,(-D-m)/R);!C&&S>0&&(S-=2*Math.PI),C&&S<0&&(S+=2*Math.PI);const j=Math.max(1,Math.ceil(Math.abs(S)/(Math.PI/2))),r=S/j,H=A=>[n+F*Y*Math.cos(A)-i*R*Math.sin(A),e+i*Y*Math.cos(A)+F*R*Math.sin(A)],v=A=>[-F*Y*Math.sin(A)-i*R*Math.cos(A),-i*Y*Math.sin(A)+F*R*Math.cos(A)],V=[];for(let A=0;A[B.a*A+B.c*E+B.e,B.b*A+B.d*E+B.f];return function(A){const B=A.match(/[AaCcHhLlMmQqSsTtVvZz]|[-+]?(?:\d*\.\d+|\d+\.?)(?:e[-+]?\d+)?/gi)||[],E=[];let s=0,w="",Q=0,C=0,g=0,I=0,Y=null,R=null;const M=()=>Number(B[s++]);for(;sB.length||QA.test(B[s]))throw new Error(`Invalid SVG path command ${w}`);const x=Array.from({length:i},M),b=A=>A+(F?Q:0),L=A=>A+(F?C:0);if("M"===A||"L"===A)Q=b(x[0]),C=L(x[1]),E.push({op:"M"===A?"M":"L",x:Q,y:C}),"M"===A&&(g=Q,I=C,w=F?"l":"L"),Y=R=null;else if("H"===A)Q=b(x[0]),E.push({op:"L",x:Q,y:C}),Y=R=null;else if("V"===A)C=L(x[0]),E.push({op:"L",x:Q,y:C}),Y=R=null;else if("C"===A){const A=b(x[0]),B=L(x[1]),s=b(x[2]),w=L(x[3]);Q=b(x[4]),C=L(x[5]),Y=[s,w],R=null,E.push({op:"C",x1:A,y1:B,x2:s,y2:w,x:Q,y:C})}else if("S"===A){const A=Y?2*Q-Y[0]:Q,B=Y?2*C-Y[1]:C,s=b(x[0]),w=L(x[1]);Q=b(x[2]),C=L(x[3]),Y=[s,w],R=null,E.push({op:"C",x1:A,y1:B,x2:s,y2:w,x:Q,y:C})}else if("Q"===A||"T"===A){const B="Q"===A?b(x[0]):R?2*Q-R[0]:Q,s="Q"===A?L(x[1]):R?2*C-R[1]:C,w=b("Q"===A?x[2]:x[0]),g=L("Q"===A?x[3]:x[1]);E.push({op:"C",x1:Q+2/3*(B-Q),y1:C+2/3*(s-C),x2:w+2/3*(B-w),y2:g+2/3*(s-g),x:w,y:g}),Q=w,C=g,R=[B,s],Y=null}else if("A"===A){const A=b(x[5]),B=L(x[6]),s=IA(Q,C,x[0],x[1],x[2],x[3],x[4],A,B);s.length?E.push(...s):E.push({op:"L",x:A,y:B}),Q=A,C=B,Y=R=null}}return E}(A).map(A=>{if("Z"===A.op)return A;if("M"===A.op||"L"===A.op){const[B,s]=E(A.x,A.y);return{op:A.op,x:B,y:s}}if("C"!==A.op)throw new Error("Unsupported PDF vector operation");const[B,s]=E(A.x1,A.y1),[w,Q]=E(A.x2,A.y2),[C,g]=E(A.x,A.y);return{op:"C",x1:B,y1:s,x2:w,y2:Q,x:C,y:g}})}const RA=["M20.82,15.31h0L10.46,9c-.46-.26-1.11.37-.86.84l6.15,10.56,10.56,6.15a.66.66,0,0,0,.84-.86Zm-4,4,3-3,4.55,7.44Z","M18,2A16,16,0,1,0,34,18,16,16,0,0,0,18,2Zm1,29.95V29.53H17v2.42A14,14,0,0,1,4.05,19H6.47V17H4.05A14,14,0,0,1,17,4.05V6.47h2V4.05A14,14,0,0,1,31.95,17H29.53v2h2.42A14,14,0,0,1,19,31.95Z"],MA=A=>Math.abs(A)<1e-12?0:Math.abs(A-1)<1e-12?1:Math.abs(A+1)<1e-12?-1:A;function FA(A){const B=function(A){const{centerX:B,centerY:E,size:s,northDeg:w}=A;if(![B,E,s,w].every(Number.isFinite)||s<=0)throw new RangeError("PDF compass placement must contain finite coordinates and a positive size");const Q=((w%360+360)%360+45)*Math.PI/180,C=s/36,g=MA(Math.cos(Q)),I=MA(Math.sin(Q)),Y=C*g,R=C*I,M=-C*I,F=C*g;return{a:Y,b:R,c:M,d:F,e:B-18*Y-18*M,f:E-18*R-18*F}}(A);return RA.flatMap(A=>YA(A,B))}const iA=1e-8,xA=A=>A.length>=2&&Number.isFinite(A[0])&&Number.isFinite(A[1]),bA=(A,B)=>A[0]>=B.minX-iA&&A[0]<=B.maxX+iA&&A[1]>=B.minY-iA&&A[1]<=B.maxY+iA,LA=A=>[A.minX,A.minY,A.maxX,A.maxY].every(Number.isFinite)&&A.maxX>=A.minX&&A.maxY>=A.minY,DA=A=>[[A.minX,A.minY],[A.maxX,A.minY],[A.maxX,A.maxY],[A.minX,A.maxY]];const GA=(A,B,E)=>(B[0]-A[0])*(E[1]-A[1])-(B[1]-A[1])*(E[0]-A[0]),oA=(A,B,E)=>{const s=E[0]-B[0],w=E[1]-B[1],Q=Math.abs(s)>=Math.abs(w)?s:w;return Math.abs(Q)<=iA?0:(Math.abs(s)>=Math.abs(w)?A[0]-B[0]:A[1]-B[1])/Q},tA=(A,B)=>Math.hypot(B[0]-A[0],B[1]-A[1]);function cA(A,B,E){const s=tA(B,E);if(s<=iA)return tA(A,B)<=iA;if(Math.abs(GA(B,E,A))/s>iA)return!1;const w=oA(A,B,E),Q=iA/s;return w>=-Q&&w<=1+Q}function WA(A,B,E,s){const w=B[0]-A[0],Q=B[1]-A[1],C=s[0]-E[0],g=s[1]-E[1],I=Math.hypot(w,Q),Y=Math.hypot(C,g);if(I<=iA)return cA(A,E,s)?{t:0,endT:0,overlap:!1}:null;if(Y<=iA){if(!cA(E,A,B))return null;const s=Math.max(0,Math.min(1,oA(E,A,B)));return{t:s,endT:s,overlap:!1}}const R=w*g-Q*C,M=E[0]-A[0],F=E[1]-A[1],i=iA*I*Y;if(Math.abs(R)<=i){if(Math.abs(GA(A,B,E))/I>iA||Math.abs(GA(A,B,s))/I>iA)return null;const w=oA(E,A,B),Q=oA(s,A,B),C=Math.max(0,Math.min(w,Q)),g=Math.min(1,Math.max(w,Q));return giA}}const x=(M*g-F*C)/R,b=(M*Q-F*w)/R,L=iA/I,D=iA/Y;if(x<-L||x>1+L||b<-D||b>1+D)return null;const G=Math.max(0,Math.min(1,x));return{t:G,endT:G,overlap:!1}}const mA=A=>A.every(A=>A.length>=2&&A.every(xA));function nA(A,B){for(const E of A){const A=E;for(let E=0;Enull!==WA(A,B,E,s[(w+1)%s.length]))}const hA=2048,SA=2146,jA=[-1825,-555,4188,2163],rA={32:1,33:2,34:3,35:4,36:5,37:6,38:7,39:8,40:9,41:10,42:11,43:12,44:13,45:14,46:15,47:16,48:17,49:18,50:19,51:20,52:21,53:22,54:23,55:24,56:25,57:26,58:27,59:28,60:29,61:30,62:31,63:32,64:33,65:34,66:35,67:36,68:37,69:38,70:39,71:40,72:41,73:42,74:43,75:44,76:45,77:46,78:47,79:48,80:49,81:50,82:51,83:52,84:53,85:54,86:55,87:56,88:57,89:58,90:59,91:60,92:61,93:62,94:63,95:64,96:65,97:66,98:67,99:68,100:69,101:70,102:71,103:72,104:73,105:74,106:75,107:76,108:77,109:78,110:79,111:80,112:81,113:82,114:83,115:84,116:85,117:86,118:87,119:88,120:89,121:90,122:91,123:92,124:93,125:94,126:95,160:596,161:96,162:97,163:98,164:99,165:100,166:101,167:102,168:103,169:104,170:105,171:106,172:107,173:597,174:108,175:109,176:110,177:111,178:112,179:113,180:114,181:115,182:116,183:117,184:118,185:119,186:120,187:121,188:122,189:123,190:124,191:125,192:603,193:604,194:605,195:606,196:607,197:608,198:126,199:609,200:610,201:611,202:612,203:613,204:614,205:615,206:616,207:617,208:599,209:618,210:619,211:620,212:621,213:622,214:623,215:127,216:128,217:624,218:625,219:626,220:627,221:628,222:129,223:130,224:629,225:630,226:631,227:632,228:633,229:634,230:131,231:635,232:636,233:637,234:638,235:639,236:640,237:641,238:642,239:643,240:132,241:644,242:645,243:646,244:647,245:648,246:649,247:133,248:134,249:650,250:651,251:652,252:653,253:654,254:135,255:655,256:656,257:657,258:658,259:659,260:660,261:661,262:662,263:663,264:664,265:665,266:666,267:667,268:668,269:669,270:670,271:671,272:598,273:136,274:672,275:673,276:674,277:675,278:676,279:677,280:678,281:679,282:680,283:681,284:682,285:683,286:684,287:685,288:686,289:687,290:688,291:689,292:690,293:691,294:137,295:600,296:692,297:693,298:694,299:695,300:696,301:697,302:698,303:699,304:700,305:138,306:701,307:702,308:703,309:704,310:705,311:706,312:139,313:707,314:708,315:709,316:710,317:711,318:712,319:713,320:714,321:140,322:141,323:715,324:716,325:717,326:718,327:719,328:720,329:721,330:142,331:143,332:722,333:723,334:724,335:725,336:726,337:727,338:144,339:145,340:728,341:729,342:730,343:731,344:732,345:733,346:734,347:735,348:736,349:737,350:738,351:739,352:742,353:743,354:744,355:745,356:746,357:747,358:601,359:602,360:748,361:749,362:750,363:751,364:752,365:753,366:754,367:755,368:756,369:757,370:758,371:759,372:760,373:761,374:762,375:763,376:764,377:765,378:766,379:767,380:768,381:769,382:770,383:146,1024:897,1025:856,1026:165,1027:857,1028:166,1029:858,1030:859,1031:860,1032:861,1033:167,1034:168,1035:169,1036:863,1037:898,1038:864,1039:170,1040:865,1041:171,1042:866,1043:867,1044:172,1045:868,1046:173,1047:174,1048:175,1049:869,1050:862,1051:176,1052:870,1053:871,1054:872,1055:873,1056:874,1057:875,1058:876,1059:177,1060:178,1061:877,1062:179,1063:180,1064:181,1065:182,1066:183,1067:184,1068:185,1069:186,1070:187,1071:188,1072:878,1073:189,1074:190,1075:191,1076:192,1077:879,1078:193,1079:194,1080:195,1081:880,1082:196,1083:197,1084:198,1085:199,1086:881,1087:200,1088:882,1089:883,1090:201,1091:884,1092:202,1093:885,1094:203,1095:204,1096:205,1097:206,1098:207,1099:208,1100:209,1101:210,1102:211,1103:212,1104:899,1105:886,1106:213,1107:887,1108:214,1109:888,1110:889,1111:890,1112:891,1113:215,1114:216,1115:217,1116:892,1117:900,1118:893,1119:218,1120:219,1121:220,1122:965,1123:221,1124:222,1125:223,1126:224,1127:225,1128:226,1129:227,1130:228,1131:229,1132:230,1133:231,1134:232,1135:233,1136:901,1137:902,1138:234,1139:235,1140:236,1141:237,1142:903,1143:904,1144:906,1145:905,1146:238,1147:239,1148:240,1149:241,1150:242,1151:243,1152:244,1153:245,1154:246,1155:247,1156:248,1157:249,1158:250,1159:251,1160:252,1161:253,1162:254,1163:255,1164:964,1165:256,1166:257,1167:258,1168:259,1169:260,1170:966,1171:967,1172:261,1173:262,1174:263,1175:264,1176:907,1177:908,1178:265,1179:266,1180:267,1181:268,1182:968,1183:969,1184:269,1185:270,1186:271,1187:272,1188:273,1189:274,1190:275,1191:276,1192:277,1193:278,1194:909,1195:910,1196:955,1197:956,1198:911,1199:912,1200:970,1201:971,1202:279,1203:280,1204:281,1205:282,1206:283,1207:284,1208:285,1209:286,1210:287,1211:963,1212:288,1213:289,1214:961,1215:962,1216:913,1217:914,1218:915,1219:290,1220:291,1221:292,1222:293,1223:294,1224:295,1225:296,1226:297,1227:957,1228:958,1229:298,1230:299,1231:916,1232:917,1233:918,1234:919,1235:920,1236:921,1237:922,1238:923,1239:924,1240:300,1241:926,1242:925,1243:927,1244:928,1245:929,1246:930,1247:931,1248:301,1249:302,1250:932,1251:933,1252:934,1253:935,1254:936,1255:937,1256:938,1257:939,1258:940,1259:941,1260:942,1261:943,1262:944,1263:945,1264:946,1265:947,1266:948,1267:949,1268:950,1269:951,1270:959,1271:960,1272:952,1273:953,1274:303,1275:304,1276:305,1277:306,1278:972,1279:973,1280:307,1281:954,1282:308,1283:309,1284:310,1285:311,1286:312,1287:313,1288:314,1289:315,1290:316,1291:317,1292:318,1293:319,1294:320,1295:321,1296:322,1297:974,1298:323,1299:324,1300:325,1301:326,1302:327,1303:328,1304:329,1305:330,1306:982,1307:983,1308:984,1309:985,1310:331,1311:332,1312:333,1313:334,1314:335,1315:336,1316:337,1317:338,1318:339,1319:340,1320:341,1321:342,1322:343,1323:344,1324:345,1325:346,1326:347,1327:348,8192:349,8193:350,8194:351,8195:352,8196:353,8197:354,8198:355,8199:356,8200:357,8201:358,8202:360,8203:361,8204:362,8205:363,8206:364,8207:365,8208:366,8209:367,8210:368,8211:369,8212:370,8213:975,8214:371,8215:372,8216:373,8217:374,8218:375,8219:376,8220:377,8221:378,8222:379,8223:380,8224:381,8225:382,8226:383,8227:384,8228:385,8229:386,8230:387,8231:388,8239:986,8240:389,8241:390,8242:894,8243:895,8244:391,8245:392,8246:393,8247:394,8248:395,8249:396,8250:397,8251:398,8252:896,8253:399,8254:400,8255:401,8256:402,8257:403,8258:404,8259:405,8260:406,8261:407,8262:408,8263:987,8264:988,8265:989,8266:409,8267:410,8268:411,8269:412,8270:413,8271:414,8272:415,8273:416,8274:417,8275:418,8276:419,8277:420,8278:421,8279:422,8280:423,8281:424,8282:425,8283:426,8284:427,8285:428,8286:429,8287:990,8364:430,8381:431,8776:433},HA={1:507,2:527,3:655,4:1261,5:1150,6:1500,7:1273,8:357,9:700,10:712,11:882,12:1161,13:402,14:565,15:539,16:844,17:1150,18:1150,19:1150,20:1150,21:1150,22:1150,23:1150,24:1150,25:1150,26:1150,27:496,28:433,29:1041,30:1124,31:1070,32:967,33:1839,34:1336,35:1275,36:1333,37:1343,38:1164,39:1132,40:1395,41:1460,42:557,43:1130,44:1284,45:1102,46:1788,47:1460,48:1408,49:1292,50:1408,51:1261,52:1215,53:1222,54:1328,55:1303,56:1817,57:1284,58:1230,59:1226,60:543,61:840,62:543,63:856,64:924,65:633,66:1114,67:1149,68:1072,69:1155,70:1085,71:711,72:1149,73:1128,74:497,75:489,76:1038,77:497,78:1795,79:1130,80:1168,81:1149,82:1164,83:693,84:1056,85:669,86:1129,87:992,88:1539,89:1015,90:969,91:1015,92:693,93:499,94:693,95:1393,96:499,97:1120,98:1190,99:1460,100:1075,101:491,102:1256,103:856,104:1609,105:915,106:961,107:1134,108:1610,109:938,110:765,111:1094,112:751,113:751,114:642,115:1160,116:1001,117:534,118:507,119:751,120:931,121:960,122:1500,123:1589,124:1593,125:969,126:1914,127:1092,128:1408,129:1210,130:1218,131:1729,132:1200,133:1169,134:1160,135:1180,136:1223,137:1434,138:506,139:1139,140:1103,141:553,142:1419,143:1160,144:1953,145:1860,146:508,165:1535,166:1380,167:2193,168:2212,169:1666,170:1460,171:1291,172:1540,173:1859,174:1215,175:1460,176:1449,177:1287,178:1580,179:1497,180:1402,181:1927,182:1984,183:1554,184:1771,185:1285,186:1380,187:1831,188:1304,189:1132,190:1170,191:859,192:1236,193:1568,194:1040,195:1182,196:1106,197:1184,198:1519,199:1181,200:1182,201:984,202:1485,203:1213,204:1113,205:1656,206:1694,207:1271,208:1590,209:1112,210:1101,211:1671,212:1124,213:1128,214:1101,215:1737,216:1764,217:1161,218:1182,219:1800,220:1579,221:1110,222:1835,223:1528,224:1234,225:1094,226:1803,227:1547,228:1745,229:1505,230:2308,231:2001,232:1059,233:987,234:1393,235:1163,236:1290,237:1027,238:1393,239:1160,240:1793,241:1572,242:1800,243:1579,244:1330,245:1095,246:1277,247:1024,248:1024,249:1024,250:1024,251:1024,252:1024,253:1024,254:1545,255:1261,256:1110,257:1307,258:1161,259:1123,260:912,261:1243,262:1029,263:1954,264:1633,265:1434,266:1208,267:1289,268:1150,269:1676,270:1411,271:1535,272:1241,273:1999,274:1460,275:2097,276:1780,277:1518,278:1235,279:1304,280:1066,281:1836,282:1372,283:1468,284:1174,285:1391,286:1130,287:1391,288:1583,289:1213,290:1289,291:1114,292:1534,293:1263,294:1458,295:1160,296:1554,297:1260,298:1871,299:1598,300:1415,301:1192,302:1192,303:1207,304:939,305:1326,306:1088,307:1270,308:1684,309:1764,310:1622,311:1323,312:1097,313:1031,314:1985,315:1653,316:2043,317:1697,318:1270,319:1053,320:1453,321:1312,322:1380,323:1538,324:1266,325:1920,326:1549,327:1857,328:1547,329:1926,330:1774,331:1316,332:1106,333:2274,334:1832,335:2300,336:1829,337:1526,338:1242,339:1468,340:1208,341:1539,342:1273,343:2710,344:2238,345:1568,346:1240,347:1515,348:1243,349:1044,350:2089,351:1044,352:2089,353:697,354:522,355:348,356:1151,357:560,358:418,360:209,361:1024,362:1024,363:1024,364:1024,365:1024,366:564,367:564,368:1171,369:1344,370:1599,371:778,372:933,373:409,374:409,375:407,376:409,377:724,378:731,379:705,380:764,381:1129,382:1167,383:690,384:1100,385:511,386:964,387:1370,388:382,389:1962,390:2360,391:1045,392:463,393:757,394:1045,395:803,396:614,397:614,398:1241,399:919,400:952,401:1540,402:1540,403:874,404:1370,405:870,406:931,407:640,408:641,409:907,410:1001,411:1237,412:1237,413:985,414:511,415:1541,416:985,417:931,418:1366,419:1540,420:1172,421:932,422:1333,423:1215,424:1125,425:379,426:1071,427:1162,428:379,429:379,430:1150,431:1359,433:1154,596:507,597:565,598:1373,599:1373,600:1158,601:1222,602:669,603:1336,604:1336,605:1336,606:1336,607:1336,608:1336,609:1333,610:1164,611:1164,612:1164,613:1164,614:557,615:557,616:557,617:557,618:1460,619:1408,620:1408,621:1408,622:1408,623:1408,624:1328,625:1328,626:1328,627:1328,628:1230,629:1114,630:1114,631:1114,632:1114,633:1114,634:1114,635:1072,636:1085,637:1085,638:1085,639:1085,640:506,641:506,642:506,643:506,644:1130,645:1168,646:1168,647:1168,648:1168,649:1168,650:1129,651:1129,652:1129,653:1129,654:969,655:969,656:1336,657:1114,658:1336,659:1114,660:1336,661:1114,662:1333,663:1072,664:1333,665:1072,666:1333,667:1072,668:1333,669:1072,670:1343,671:1305,672:1164,673:1085,674:1164,675:1085,676:1164,677:1085,678:1164,679:1085,680:1164,681:1085,682:1395,683:1149,684:1395,685:1149,686:1395,687:1149,688:1395,689:1149,690:1460,691:1128,692:557,693:506,694:557,695:506,696:557,697:506,698:557,699:497,700:557,701:1687,702:986,703:1130,704:515,705:1284,706:1038,707:1102,708:497,709:1102,710:497,711:1102,712:647,713:1102,714:717,715:1460,716:1130,717:1460,718:1130,719:1460,720:1130,721:1130,722:1408,723:1168,724:1408,725:1168,726:1408,727:1168,728:1261,729:693,730:1261,731:693,732:1261,733:693,734:1215,735:1056,736:1215,737:1056,738:1215,739:1056,742:1215,743:1056,744:1222,745:669,746:1222,747:709,748:1328,749:1129,750:1328,751:1129,752:1328,753:1129,754:1328,755:1129,756:1328,757:1129,758:1328,759:1129,760:1817,761:1539,762:1230,763:969,764:1230,765:1226,766:1015,767:1226,768:1015,769:1226,770:1015,856:1164,857:1139,858:1215,859:557,860:557,861:1130,862:1316,863:1284,864:1287,865:1336,866:1275,867:1139,868:1164,869:1460,870:1788,871:1460,872:1408,873:1461,874:1292,875:1333,876:1222,877:1284,878:1114,879:1085,880:1182,881:1168,882:1149,883:1072,884:969,885:1015,886:1085,887:859,888:1056,889:497,890:506,891:489,892:1106,893:969,894:357,895:655,896:1054,897:1164,898:1460,899:1085,900:1182,901:1417,902:1434,903:1290,904:1027,905:2137,906:2377,907:1215,908:1040,909:1333,910:1072,911:1230,912:1026,913:557,914:1859,915:1568,916:557,917:1336,918:1114,919:1336,920:1114,921:1914,922:1729,923:1164,924:1085,925:1415,926:1079,927:1079,928:1859,929:1568,930:1215,931:1040,932:1460,933:1182,934:1460,935:1182,936:1408,937:1168,938:1393,939:1163,940:1393,941:1163,942:1380,943:1101,944:1287,945:969,946:1287,947:969,948:1287,949:969,950:1402,951:1113,952:1771,953:1590,954:1155,955:1222,956:984,957:1402,958:1113,959:1139,960:859,961:1583,962:1213,963:1128,964:1285,965:1285,966:1139,967:859,968:1336,969:1063,970:1230,971:1026,972:1284,973:1015,974:1104,975:1599,982:1408,983:1164,984:1817,985:1539,986:507,987:1934,988:1494,989:1494,990:507},vA=new TextEncoder,VA=A=>{const B=Math.round(100*A)/100;return Number.isInteger(B)?String(B):B.toFixed(2).replace(/0+$/,"")},UA=A=>{const B=Math.round(1e6*A)/1e6;return Number.isInteger(B)?String(B):B.toFixed(6).replace(/0+$/,"")},lA=A=>A.map(UA).join(" ");function aA(A){let B="",E=0;const s=new Map;for(const w of A){const A=w.codePointAt(0)||0,Q=rA[A]||rA[63];B+=Q.toString(16).padStart(4,"0"),E+=HA[Q]||1024,s.has(Q)||s.set(Q,A||63)}return{hex:B,width:E,unicode:s}}function PA(A,B){return aA(A).width*B/hA}function yA(A,B=PA(A.text,A.size)){const E=A.align||"left",s="center"===E?B/2:"right"===E?B:0,w=(A.angle||0)*Math.PI/180,Q=Math.cos(w),C=Math.sin(w);return{width:B,baselineX:A.x-Q*s,baselineY:A.y+C*s,cos:Q,sin:C}}function uA(A){const B=yA(A),E=-555*A.size/hA,s=SA*A.size/hA,w=[0,B.width].flatMap(A=>[E,s].map(E=>({x:B.baselineX+B.cos*A-B.sin*E,y:B.baselineY-B.sin*A-B.cos*E})));return{minX:Math.min(...w.map(A=>A.x)),minY:Math.min(...w.map(A=>A.y)),maxX:Math.max(...w.map(A=>A.x)),maxY:Math.max(...w.map(A=>A.y))}}function NA(A){const B=A.reduce((A,B)=>A+B.length,0),E=new Uint8Array(B);let s=0;for(const B of A)E.set(B,s),s+=B.length;return E}const KA=A=>vA.encode(A),dA=(A,B)=>NA([KA(`<< ${A} /Length ${B.length} >>\nstream\n`),B,KA("\nendstream")]);function JA(A){const B=function(A){const B=atob(A),E=new Uint8Array(B.length);for(let A=0;A"image"===A.kind&&null!=A.opacity&&A.opacity<1?[Math.max(0,Math.min(1,A.opacity))]:[]))].sort((A,B)=>A-B),s=new Map(E.map((A,B)=>[A,`GS${B+1}`])),w=function(A,B){const E=[],s=new Map,w=B=>A.height-B,Q=(A,...B)=>`${B.map(VA).join(" ")} ${A}`,C=A=>{for(const B of A)if(B.length){E.push(Q("m",B[0][0],w(B[0][1])));for(let A=1;A{let B=!1;for(const s of A)if(!(s.length<2)){B=!0,E.push(Q("m",s[0][0],w(s[0][1])));for(let A=1;A Tj`,"ET")}else{const A=(I.angle||0)*Math.PI/180,s=Math.cos(A),C=Math.sin(A),g=I.x+I.width/2,Y=w(I.y+I.height/2);E.push("q");const R=null==I.opacity?1:Math.max(0,Math.min(1,I.opacity)),M=B.get(R);M&&E.push(`/${M} gs`),E.push(Q("cm",s*I.width,C*I.width,C*I.height,-s*I.height,g-s*I.width/2-C*I.height/2,Y-C*I.width/2+s*I.height/2),`/Im${I.imageId} Do`,"Q")}return{stream:E.join("\n"),unicode:s}}(A,s),Q=Math.max(0,...Object.keys(HA).map(Number)),C=Array.from({length:Q+1},(A,B)=>Math.round(1e3*(HA[B]||1024)/hA)),g=[],I=A=>(g.push("string"==typeof A?KA(A):A),g.length),Y=I(""),R=I(""),M=I(""),F=I(dA(`/Length1 ${B.length}`,B)),i=I(`<< /Type /FontDescriptor /FontName /Roboto /Flags 32 /FontBBox [${jA.join(" ")}] /ItalicAngle 0 /Ascent 2146 /Descent -555 /CapHeight 2146 /StemV 80 /FontFile2 ${F} 0 R >>`),x=I(`<< /Type /Font /Subtype /CIDFontType2 /BaseFont /Roboto /CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >> /FontDescriptor ${i} 0 R /W [0 [${C.join(" ")}]] /CIDToGIDMap /Identity >>`),b=KA(function(A){const B=[...A].sort((A,B)=>A[0]-B[0]),E=B.map(([A,B])=>`<${A.toString(16).padStart(4,"0")}> <${B<=65535?B.toString(16).padStart(4,"0"):(()=>{const A=B-65536;return(55296+(A>>10)).toString(16).padStart(4,"0")+(56320+(1023&A)).toString(16).padStart(4,"0")})()}>`);return`/CIDInit /ProcSet findresource begin\n12 dict begin\nbegincmap\n/CIDSystemInfo << /Registry (Adobe) /Ordering (UCS) /Supplement 0 >> def\n/CMapName /HousePlanUnicode def\n/CMapType 2 def\n1 begincodespacerange\n<0000> \nendcodespacerange\n${B.length} beginbfchar\n${E.join("\n")}\nendbfchar\nendcmap\nCMapName currentdict /CMap defineresource pop\nend\nend`}(w.unicode)),L=I(dA("",b)),D=I(`<< /Type /Font /Subtype /Type0 /BaseFont /Roboto /Encoding /Identity-H /DescendantFonts [${x} 0 R] /ToUnicode ${L} 0 R >>`),G=I(dA("",KA(w.stream))),o=[];for(const B of A.images||[]){const A=I(dA(`/Type /XObject /Subtype /Image /Width ${B.width} /Height ${B.height} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode`,B.bytes));o.push(`/Im${B.id} ${A} 0 R`)}const t=A.now.toISOString().replace(/[-:T]/g,"").slice(0,14),c=I(`<< /CreationDate (D:${t}Z) /ModDate (D:${t}Z) >>`),W=`<< /Font << /F1 ${D} 0 R >>`+(o.length?` /XObject << ${o.join(" ")} >>`:"")+(E.length?` /ExtGState << ${E.map(A=>`/${s.get(A)} << /ca ${VA(A)} /CA ${VA(A)} >>`).join(" ")} >>`:"")+" >>";g[Y-1]=KA(`<< /Type /Catalog /Pages ${R} 0 R >>`),g[R-1]=KA(`<< /Type /Pages /Kids [${M} 0 R] /Count 1 >>`),g[M-1]=KA(`<< /Type /Page /Parent ${R} 0 R /MediaBox [0 0 ${VA(A.width)} ${VA(A.height)}] /Resources ${W} /Contents ${G} 0 R >>`);const m=KA("%PDF-1.4\n%âãÏÓ\n"),n=[m],e=[0];let h=m.length;g.forEach((A,B)=>{const E=KA(`${B+1} 0 obj\n`),s=KA("\nendobj\n");e.push(h),n.push(E,A,s),h+=E.length+A.length+s.length});const S=h,j=["xref",`0 ${g.length+1}`,"0000000000 65535 f "];for(let A=1;A<=g.length;A++)j.push(`${String(e[A]).padStart(10,"0")} 00000 n `);return j.push(`trailer\n<< /Size ${g.length+1} /Root ${Y} 0 R /Info ${c} 0 R >>`,`startxref\n${S}\n%%EOF\n`),n.push(KA(j.join("\n"))),NA(n)}const ZA=A=>[A.minX,A.minY,A.maxX,A.maxY].every(Number.isFinite)&&A.maxX>=A.minX&&A.maxY>=A.minY,TA=A=>A.maxX-A.minX,fA=A=>A.maxY-A.minY;function kA(A,B,E,s=0){Number.isFinite(B)&&Number.isFinite(E)&&(A.minX=Math.min(A.minX,B-s),A.minY=Math.min(A.minY,E-s),A.maxX=Math.max(A.maxX,B+s),A.maxY=Math.max(A.maxY,E+s))}function zA(A,B,E,s,w,Q){const C=Q*Math.PI/180,g=Math.cos(C),I=Math.sin(C),Y=B+s/2,R=E+w/2;for(const[B,E]of[[-s/2,-w/2],[s/2,-w/2],[s/2,w/2],[-s/2,w/2]])kA(A,Y+g*B-I*E,R+I*B+g*E)}function pA(A,B,E){for(const s of B)"M"===s.op||"L"===s.op?kA(A,s.x,s.y,E):"C"===s.op&&(kA(A,s.x1,s.y1,E),kA(A,s.x2,s.y2,E),kA(A,s.x,s.y,E))}function XA(A){const B={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const E of A)if("path"===E.kind){const A=E.stroke?(E.width||.5)/2:0;for(const s of E.rings)for(const[E,w]of s)kA(B,E,w,A)}else if("line"===E.kind)for(const[A,s]of E.points)kA(B,A,s,E.width/2);else if("vector"===E.kind)pA(B,E.ops,E.width/2);else if("text"===E.kind){const A=uA(E);kA(B,A.minX,A.minY),kA(B,A.maxX,A.maxY)}else zA(B,E.x,E.y,E.width,E.height,E.angle||0);return B}function OA(A,B,E){return!!ZA(A)&&(TA(A)<=TA(B)+E&&fA(A)<=fA(B)+E)}function qA(A){return`${A.getFullYear()}-${String(A.getMonth()+1).padStart(2,"0")}-${String(A.getDate()).padStart(2,"0")}`}const $A=72/25.4,_A=5.25,AB=[.08,.08,.08],BB=[127/255,127/255,127/255],EB=[.72,.72,.72],sB=(A,B)=>A.minXB.minX&&A.minYB.minY;function wB(A,B,E,s,w=0,Q="left"){return uA({x:A,y:B,text:E,size:s,angle:w,align:Q})}function QB(A,B,E,s,w){const Q=Math.min(...[[A.minX,A.minY],[A.maxX,A.minY],[A.maxX,A.maxY],[A.minX,A.maxY]].map(([A,w])=>(A-B)*s[0]+(w-E)*s[1]));return Math.max(0,w-Q)}const CB=(A,B)=>`${A.axis}:${B[0]<-.5||B[1]<-.5?-1:1}`,gB=(A,B)=>{A.minX=Math.min(A.minX,B[0]),A.minY=Math.min(A.minY,B[1]),A.maxX=Math.max(A.maxX,B[0]),A.maxY=Math.max(A.maxY,B[1])},IB=A=>{const B={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const E of A)for(const A of E)gB(B,A);return B};function YB(A,B,E,s,w=0){const Q=w*Math.PI/180,C=Math.cos(Q),g=Math.sin(Q),I=A+E/2,Y=B+s/2;return Array.from({length:48},(A,B)=>{const w=B/48*Math.PI*2,Q=Math.cos(w)*E/2,R=Math.sin(w)*s/2;return[I+C*Q-g*R,Y+g*Q+C*R]})}function RB(A,B,E,s,w=0){const Q=w*Math.PI/180,C=Math.cos(Q),g=Math.sin(Q),I=A+E/2,Y=B+s/2;return[[-E/2,-s/2],[E/2,-s/2],[E/2,s/2],[-E/2,s/2]].map(([A,B])=>[I+C*A-g*B,Y+g*A+C*B])}function MB(A,B,E){if("passage"===A.type)return[];const s=A.rlen/2,w=B>0?B/E*Y/2:2,Q=[];if("window"===A.type)Q.push([[-s,-w],[s,-w]],[[-s,w],[s,w]],[[-s,-w],[-s,w]],[[s,-w],[s,w]]);else if("gate"===A.type){const B=10*(A.flip_v?-1:1)*Math.PI/180,E=[[[-s,0],[-s+Math.cos(B)*s,Math.sin(B)*s]],[[s,0],[s-Math.cos(B)*s,Math.sin(-B)*s]]];Q.push(...E);for(const A of E){const B=A[1][0]-A[0][0],E=A[1][1]-A[0][1],s=Math.hypot(B,E)||1,C=-E/s,g=B/s,I=Math.min(.08*s,Math.max(1,.7*w));for(const s of[.3,.5,.7]){const w=A[0][0]+B*s,Y=A[0][1]+E*s;Q.push([[w-C*I,Y-g*I],[w+C*I,Y+g*I]])}}}else{const B=A.flip_v?1:-1,E=A.flip_h?s:-s,w=[E,B*A.rlen];Q.push([[E,0],w]);const C=[];for(let s=0;s<=16;s++){const w=B*s/16*Math.PI/2,Q=A.flip_h?-1:1;C.push([E+Q*Math.cos(w)*A.rlen,Math.sin(w)*A.rlen])}Q.push(C)}const C=A.angle*Math.PI/180,g=Math.cos(C),I=Math.sin(C);return Q.map(B=>B.map(([B,E])=>[A.rx+B*g-E*I,A.ry+B*I+E*g]))}function FB(A,B){const E=IB([A]);return B.filter(A=>{const B=IB([A]);return B.maxX>=E.minX&&B.minX<=E.maxX&&B.maxY>=E.minY&&B.minY<=E.maxY})}function iB(A){const B=function(A){const{rawSpace:B,space:E}=A,s=Number(B.cell_cm)>0?Number(B.cell_cm):5,w=Array.isArray(B.walls)?B.walls:[],Q=c(B,E,I,.02*Y),C=W(B,E,s,Y,I),g=m(C),M=n(E,s,Y,2e-4*Y,g).all,F=e(C,E,w,Q.contour,R,s,Y,I);return{cellCm:s,walls:w,zero:Q,openings:C,extras:M,geometry:A.sharedWallGeometry||h(E.rooms,w,Q.contour,F,R,s,Y,I,M)}}(A),E=new Map;if(A.options.dimensions)for(const s of A.space.rooms){const w=C(s);if(!w)continue;const Q=s.id?A.resolveInnerContour?.(s.id):void 0;E.set(s,s.id&&(void 0===Q?g(A.space.rooms,s.id,B.walls,B.zero.contour,R,B.cellCm,Y,I,B.geometry.roomGeom,B.geometry.multiWallNodes):Q)||w)}const s=new Map;if(A.options.dimensions)for(const w of A.space.rooms){const Q=C(w);if(!Q)continue;const g=E.get(w)||Q,I=w.id?A.resolveRoomArea?.(w.id,g):void 0,Y=Number.isFinite(I)?[]:FB(g,B.extras),R=Y.length?M(g,Y):null,i=Number.isFinite(I)&&I>=0?I:R?F(R):Math.abs(g.reduce((A,B,E)=>{const s=g[(E+1)%g.length];return A+B[0]*s[1]-s[0]*B[1]},0)/2);s.set(w,i)}const w=[..."failed-core"===B.geometry.status?A.space.rooms.map(A=>C(A)||[]).filter(A=>A.length):B.geometry.components.flatMap(A=>i(A.geom)),...B.zero.lines.map(A=>[[A[0],A[1]],[A[2],A[3]]])];A.options.decor&&w.push(...function(A){const B=[];for(const E of A.decor||[])"line"===E.kind?B.push([[E.x1*I,E.y1*I],[E.x2*I,E.y2*I]]):"text"!==E.kind?B.push(L(E).map(([A,B])=>[A*I,B*I])):B.push([[E.x*I,E.y*I]]);return B}(A.rawSpace));for(const B of A.rasters||[])w.push(RB(B.x,B.y,B.drawWidth,B.drawHeight,B.angle));let Q=IB(w);var x;[(x=Q).minX,x.minY,x.maxX,x.maxY].every(Number.isFinite)&&x.maxX>x.minX&&x.maxY>x.minY||(Q={minX:0,minY:0,maxX:I,maxY:I});return{built:B,dimensionContours:E,roomAreas:s,bounds:Q,cmPerUnit:B.cellCm/Y}}function xB(A,B,E,s){const{built:w,dimensionContours:Q,roomAreas:g,bounds:M,cmPerUnit:F}=B,c=(s?297:210)*$A,W=(s?210:297)*$A,m=12*$A,n=18*$A,e=24*$A,h=F*(10*$A)/E,j=(M.maxX-M.minX)*h,H=(M.maxY-M.minY)*h,v=m+n,V=W-v-m-e,U=c-2*m,a=A=>[0+(A[0]-M.minX)*h,0+(A[1]-M.minY)*h],P=(A,B)=>[M.minX+(A-0)/h,M.minY+(B-0)/h],y=A=>{const B=P(A.minX,A.minY),E=P(A.maxX,A.maxY);return{minX:B[0],minY:B[1],maxX:E[0],maxY:E[1]}},u=w.geometry.components.flatMap(A=>i(A.geom)),N=A=>w.geometry.components.some(B=>S([...A],B.geom)),K=A=>function(A,B,E){if(!LA(A)||!mA(B))return!0;const s=DA(A);return!!s.some(E)||!!B.some(B=>B.some(B=>xA(B)&&bA(B,A)))||nA(B,(A,B)=>s.some((E,w)=>null!==WA(A,B,E,s[(w+1)%s.length])))}(y(function(A,B){const E=Number.isFinite(B)&&B>=0?B:0;return{minX:A.minX-E,minY:A.minY-E,maxX:A.maxX+E,maxY:A.maxY+E}}(A,$A-1e-6)),u,N),d=(A,B)=>function(A,B,E){if(!LA(A)||!mA([B]))return!1;const s=DA(A);return!!s.every(E)&&!nA([B],(A,B)=>s.some((E,w)=>null!==WA(A,B,E,s[(w+1)%s.length])))}(y(A),B,A=>Z([...A],B)),J=(A,B,E={})=>function(A,B,E,s,w={}){if(!xA(A)||!xA(B)||!mA(E))return!0;if(w.allowStartExit){const w=tA(A,B);if(w<=iA)return!0;const Q=nA(E,(B,E)=>cA(A,B,E));if(!Q)return!0;const C=[];nA(E,(E,s)=>{const w=WA(A,B,E,s);return w&&C.push(w),!1});const g=iA/w,I=[0,1,...C.flatMap(A=>[A.t,A.endT])].sort((A,B)=>A-B).filter((A,B,E)=>0===B||A-E[B-1]>g),Y=E=>[A[0]+(B[0]-A[0])*E,A[1]+(B[1]-A[1])*E],R=A=>C.some(B=>B.overlap&&A>B.t+g&&AA.t>M+g||A.endT>M+g)}const Q=[(A[0]+B[0])/2,(A[1]+B[1])/2],C=nA(E,(B,E)=>cA(A,B,E));return!((!s(A)||w.allowStartBoundary&&C)&&!s(Q)&&!s(B))||nA(E,(E,s)=>{const Q=WA(A,B,E,s);return!!Q&&(Q.overlap||!w.allowStartBoundary||!C||Q.t*tA(A,B)>iA)})}(P(A[0],A[1]),P(B[0],B[1]),u,N,E),T=(A,B,E)=>{const s=A.x*I,w=A.y*I,Q=A.w*I,C=A.h*I,g=s+Q/2,Y=w+C/2,R=s+(A.flip_h?Q:0),F=w+(A.flip_v?C:0),i=(A.flip_h?-1:1)*Q/B,x=(A.flip_v?-1:1)*C/E,b=(Number(A.angle)||0)*Math.PI/180,L=Math.cos(b),D=Math.sin(b),G=Y+D*(R-g)+L*(F-Y);return{a:h*L*i,b:h*D*i,c:-h*D*x,d:h*L*x,e:0+(g+L*(R-g)-D*(F-Y)-M.minX)*h,f:0+(G-M.minY)*h}};let f=[];const z=[],O=function(A,B){const E=3*$A*Math.SQRT2,s=[];for(let w=-B;w<=A+E;w+=E)s.push([[w,0],[w+B,B]]);return s}(c,W);for(const B of A.rasters||[])f.push({kind:"image",imageId:B.id,...a([B.x,B.y]).reduce((A,B,E)=>({...A,[E?"y":"x"]:B}),{}),width:B.drawWidth*h,height:B.drawHeight*h,angle:B.angle,opacity:B.opacity});for(const A of w.geometry.components)f.push({kind:"path",rings:i(A.geom).map(A=>A.map(a)),fill:BB,stroke:AB,width:.25*$A,hatch:{lines:O,stroke:AB,width:.18*$A}});if("failed-core"===w.geometry.status)for(const B of A.space.rooms){const A=C(B);A&&f.push({kind:"path",rings:[A.map(a)],stroke:AB,width:.25*$A})}for(const A of w.zero.lines)f.push({kind:"line",points:[a([A[0],A[1]]),a([A[2],A[3]])],stroke:AB,width:.35*$A,dash:[3*$A,2*$A]});const q=w.geometry.openingIndex;for(const B of w.openings){const E=B.partitionHost?{cm:B.partitionHost.partition.cm}:q?x(A.space.rooms,B,w.walls,R,w.cellCm,Y,I,w.zero.contour):{cm:0};for(const A of MB(B,E.cm,w.cellCm))f.push({kind:"line",points:A.map(a),stroke:AB,width:.3*$A})}if(A.options.decor)for(const B of A.rawSpace.decor||[])if("image"!==B.kind)if("line"===B.kind)f.push({kind:"line",points:[a([B.x1*I,B.y1*I]),a([B.x2*I,B.y2*I])],stroke:AB,width:Math.max(.2*$A,10*Number(B.width_cm||1)*$A/E),dash:"dashed"===B.line_style?[3*$A,2*$A]:void 0});else if("text"===B.kind)f.push({kind:"text",...(()=>{const[A,E]=a([B.x*I,B.y*I]);return{x:A,y:E}})(),text:B.text,size:Math.max(6,10*Number(B.size_cm||20)*$A/E),angle:Number(B.angle)||0});else if("furniture"===B.kind){const A=r[B.symbol];A?f.push({kind:"vector",ops:YA(A.d,T(B,A.viewW,A.viewH)),stroke:AB,width:Math.max(.2*$A,10*b(B,w.cellCm,Y)*$A/E)}):f.push({kind:"path",rings:[L(B).map(([A,B])=>a([A*I,B*I]))],stroke:AB,width:.25*$A})}else{const A="ellipse"===B.kind?YB(B.x*I,B.y*I,B.w*I,B.h*I,Number(B.angle)||0):L(B).map(([A,B])=>[A*I,B*I]);f.push({kind:"path",rings:[A.map(a)],stroke:AB,width:.25*$A})}if(A.options.dimensions&&w.geometry.roomGeom)for(const[B,E]of D(w.geometry.roomGeom).entries()){const s=l(F),w=(A,B,E)=>{const s=a(A.sourceA),w=a(A.sourceB),Q=a(A.a),C=a(A.b),g=(6+E)*$A,I=[Q[0]+B[0]*g,Q[1]+B[1]*g],Y=[C[0]+B[0]*g,C[1]+B[1]*g],R=[(I[0]+Y[0])/2,(I[1]+Y[1])/2],M=PA(A.text,7)+2*$A>Math.hypot(Y[0]-I[0],Y[1]-I[1]),F=QB(wB(R[0],R[1],A.text,7,A.angle,"center"),R[0],R[1],B,$A),i=[R[0]+B[0]*F,R[1]+B[1]*F];return{edge:A,a:s,b:w,oa:I,ob:Y,middle:R,label:i,box:wB(i[0],i[1],A.text,7,A.angle,"center"),needsShelf:M}},Q=A=>{const B=[{start:A.oa,end:A.ob},{start:A.a,end:A.oa,allowStartExit:!0},{start:A.b,end:A.ob,allowStartExit:!0}];return A.needsShelf&&B.push({start:A.middle,end:A.label,mayEnterOwnLabel:!0}),B},C=A=>K(A.box)||Q(A).some(A=>J(A.start,A.end,{allowStartBoundary:A.allowStartBoundary,allowStartExit:A.allowStartExit})),g=EA(k(E,F,A.imperial,{ringIndex:B,epsilon:s}),{ring:E,epsilon:s,score:A=>{const B=[-A.inwardNormal[0],-A.inwardNormal[1]],E=a(A.mid),s=Array.from({length:21},(A,B)=>4*B).find(E=>!C(w(A,B,E))),Q=E[0]+(U-j)/2,g=E[1]+(V-H)/2;return{hardCollisions:void 0===s?21:s/4,normalClearance:Math.abs(B[0])>.5?B[0]>0?U-Q:Q:B[1]>0?V-g:g}}});for(const A of X(g,s)){const B=A.map(A=>({edge:A,outward:[-A.inwardNormal[0],-A.inwardNormal[1]]})),E=A=>B.map(({edge:B,outward:E})=>w(B,E,A));let s=null;for(let A=0;A<=80&&!s;A+=4){const B=E(A),w=B.some((A,E)=>B.slice(0,E).some(B=>sB(A.box,B.box))),g=B.some(A=>C(A)||z.some(B=>sB(A.box,B))),I=B.some((A,E)=>Q(A).some(A=>z.some(B=>eA(A.start,A.end,B))||B.some((B,s)=>(!A.mayEnterOwnLabel||s!==E)&&eA(A.start,A.end,B.box))));w||g||I||(s=B)}if(s)for(const A of s)f.push({kind:"line",points:[A.oa,A.ob],stroke:AB,width:.2*$A},{kind:"line",points:[A.a,A.oa],stroke:AB,width:.15*$A},{kind:"line",points:[A.b,A.ob],stroke:AB,width:.15*$A}),A.needsShelf&&f.push({kind:"line",points:[A.middle,A.label],stroke:AB,width:.15*$A}),f.push({kind:"text",x:A.label[0],y:A.label[1],text:A.edge.text,size:_A,angle:A.edge.angle,align:"center"}),z.push(A.box)}}const $=[...A.space.rooms].sort((A,B)=>String(A.id||"").localeCompare(String(B.id||"")));for(const[B,E]of $.entries()){const s=C(E);if(!s)continue;const w=Q.get(E)||s,I=g.get(E)||0,Y=G(E,A.space.id,A.layout,A.config),[R,M]=a([Y.x,Y.y]),i=w.map(a),x=IB([i]);let b=!1;if(A.options.roomNames&&E.name){const A=Math.max(0,x.maxX-x.minX-4*$A),B=PA(E.name,6.75)<=A?6.75:PA(E.name,5.25)<=A?5.25:0;B&&(f.push({kind:"text",x:R,y:M-2,text:E.name,size:B,align:"center"}),z.push(wB(R,M-2,E.name,B,0,"center")),b=!0)}if(A.options.dimensions){const B=o(I*F*F/1e4,A.imperial),E=M+(b?8:0);f.push({kind:"text",x:R,y:E,text:B,size:6,align:"center"}),z.push(wB(R,E,B,8,0,"center"))}if(A.options.dimensions){const E=l(F),s=EA(p(w,F,A.imperial,{ringIndex:B,epsilon:E}),{ring:w,epsilon:E,score:A=>{const B=a(A.mid),E=QB(wB(B[0],B[1],A.text,_A,A.angle,"center"),B[0],B[1],A.inwardNormal,$A),s=wB(B[0]+A.inwardNormal[0]*E,B[1]+A.inwardNormal[1]*E,A.text,7,A.angle,"center"),w="horizontal"===A.axis?A.inwardNormal[1]>0?x.maxY-B[1]:B[1]-x.minY:A.inwardNormal[0]>0?x.maxX-B[0]:B[0]-x.minX;return{hardCollisions:Number(K(s))+z.reduce((A,B)=>A+Number(sB(s,B)),0),normalClearance:w}}});for(const A of s.filter(A=>A.short)){const B=A.inwardNormal,E=a(A.a),s=a(A.b),w=(E[0]+s[0])/2,Q=(E[1]+s[1])/2;f.push({kind:"line",points:[[w-1.5*B[0]*$A,Q-1.5*B[1]*$A],[w+1.5*B[0]*$A,Q+1.5*B[1]*$A]],stroke:AB,width:.2*$A})}const Q=new Map;for(const A of s.filter(A=>!A.short)){const B=CB(A,A.inwardNormal),E=Q.get(B)||[];E.push(A),Q.set(B,E)}for(const A of Q.values()){let B=null;for(let E=0;E<=30&&!B;E+=3){const s=A.map(A=>{const B=a(A.mid),s=QB(wB(B[0],B[1],A.text,_A,A.angle,"center"),B[0],B[1],A.inwardNormal,(1+E)*$A),w=B[0]+A.inwardNormal[0]*s,Q=B[1]+A.inwardNormal[1]*s;return{edge:A,x:w,y:Q,box:wB(w,Q,A.text,_A,A.angle,"center")}}),Q=s.some((A,B)=>s.slice(0,B).some(B=>sB(A.box,B.box))),C=s.some(A=>K(A.box)||z.some(B=>sB(A.box,B))),g=s.every(A=>d(A.box,w));Q||C||!g||(B=s)}if(B)for(const A of B)f.push({kind:"text",x:A.x,y:A.y,text:A.edge.text,size:_A,angle:A.edge.angle,align:"center"}),z.push(A.box)}}}const _={minX:m,minY:v,maxX:c-m,maxY:v+V},AA=XA(f),BA=OA(AA,{minX:0,minY:0,maxX:U,maxY:V},.5*$A),sA=function(A,B){const E=XA(A);if(!ZA(E))return{commands:[...A],bounds:E,dx:0,dy:0};const s=(B.minX+B.maxX-E.minX-E.maxX)/2,w=(B.minY+B.maxY-E.minY-E.maxY)/2,Q=function(A,B,E){return A.map(A=>"path"===A.kind?{...A,rings:A.rings.map(A=>A.map(([A,s])=>[A+B,s+E]))}:"line"===A.kind?{...A,points:A.points.map(([A,s])=>[A+B,s+E])}:"vector"===A.kind?{...A,ops:A.ops.map(A=>((A,B,E)=>"M"===A.op||"L"===A.op?{...A,x:A.x+B,y:A.y+E}:"C"===A.op?{...A,x1:A.x1+B,y1:A.y1+E,x2:A.x2+B,y2:A.y2+E,x:A.x+B,y:A.y+E}:A)(A,B,E))}:{...A,x:A.x+B,y:A.y+E})}(A,s,w);return{commands:Q,bounds:{minX:E.minX+s,minY:E.minY+w,maxX:E.maxX+s,maxY:E.maxY+w},dx:s,dy:w}}(f,_);f=sA.commands,f.push({kind:"text",x:m,y:m+10,text:A.space.title,size:14}),A.cardTitle&&f.push({kind:"text",x:c-m,y:m+10,text:A.cardTitle,size:10,align:"right"});const wA=W-m-13*$A;f.push({kind:"line",points:[[m,wA-4*$A],[c-m,wA-4*$A]],stroke:EB,width:.2*$A}),f.push({kind:"text",x:m,y:wA,text:A.t("pdf.scale",{n:E}),size:8});const QA=10*(A.imperial?152.4:100)*$A/E,CA=wA+8;f.push({kind:"line",points:[[m,CA],[m+QA,CA]],stroke:AB,width:.4*$A});for(let A=0;A<=4;A++){const B=m+QA*A/4;f.push({kind:"line",points:[[B,CA-2],[B,CA+2]],stroke:AB,width:.25*$A})}f.push({kind:"text",x:m+QA/2,y:wA+17,text:A.imperial?"5 ft":"1 m",size:7,align:"center"});const gA=t(A.config.settings,A.rawSpace.settings||{});if(null!==gA){const B=c/2,E=wA+5.5*$A;f.push({kind:"vector",ops:FA({centerX:B,centerY:E,size:11*$A,northDeg:gA}),fill:AB,width:0,fillRule:"evenodd"}),f.push({kind:"text",x:B,y:wA,text:A.t("pdf.north"),size:7,align:"center"})}f.push({kind:"text",x:c-m,y:wA+12,text:`${qA(A.now)} · House Plan v${A.version}`,size:7,align:"right"});const IA={width:c,height:W,commands:f,images:(A.rasters||[]).map(({id:A,bytes:B,width:E,height:s})=>({id:A,bytes:B,width:E,height:s})),now:A.now,scale:E,sceneBounds:sA.bounds,planField:_},RA=Math.max(0,TA(AA))*Math.max(0,fA(AA)),MA=U*V;return{page:IA,sceneBounds:sA.bounds,field:_,fits:BA,fillRatio:MA>0?RA/MA:0,landscape:s}}function bB(A,B){return A.fillRatio!==B.fillRatio?A.fillRatio>B.fillRatio?A:B:A.landscape?B:A}function LB(A,B,E){const s=12*$A,w=(E?297:210)*$A-2*s,Q=(E?210:297)*$A-2*s-18*$A-24*$A,C=A.cmPerUnit*(10*$A)/B;return(A.bounds.maxX-A.bounds.minX)*C<=w+.5*$A&&(A.bounds.maxY-A.bounds.minY)*C<=Q+.5*$A}function DB(A){let B=0;for(const E of A)if(B+=Math.max(0,Number(E)||0),B>26214400)throw new Error("pdf.too_large")}const GB="271e0747b4ddef1af0d15d8bf63a832d72b0f7211550c349a59b3baa3864a84e";async function oB(A,B){if(!A)throw new Error("pdf.asset_failed");const E=await fetch(A,{credentials:"same-origin"});if(!E.ok)throw new Error("pdf.asset_failed");const s=await E.blob();let w;try{w=await createImageBitmap(s)}catch{throw new Error("pdf.asset_failed")}try{if("image/jpeg"===s.type)return{id:B,bytes:new Uint8Array(await s.arrayBuffer()),width:w.width,height:w.height};const A=document.createElement("canvas");A.width=w.width,A.height=w.height;const E=A.getContext("2d");if(!E)throw new Error("pdf.asset_failed");E.fillStyle="#fff",E.fillRect(0,0,A.width,A.height),E.drawImage(w,0,0);const Q=await new Promise(B=>A.toBlob(B,"image/jpeg",.85));if(!Q)throw new Error("pdf.asset_failed");return{id:B,bytes:new Uint8Array(await Q.arrayBuffer()),width:w.width,height:w.height}}finally{w.close()}}async function tB(A,B,E){const s=await async function(A,B){const E=[];if(B.backdrop&&A.space.bg){const B=await oB(A.backdropUrl,"backdrop");E.push({...B,x:A.space.bg.x,y:A.space.bg.y,drawWidth:A.space.bg.w,drawHeight:A.space.bg.h,angle:A.space.bg.angle,opacity:.6})}if(B.decor){let B=0;for(const s of A.rawSpace.decor||[]){if("image"!==s.kind)continue;const w=A.decorAssets.get(s.asset_id),Q=j(s,I,I);if(!w||!Q)throw new Error("pdf.asset_failed");const C=await oB(w.url,"decor"+B++);E.push({...C,x:Q[0],y:Q[1],drawWidth:Q[2],drawHeight:Q[3],opacity:Q[4],angle:Number(s.angle)||0})}}return DB(E.map(A=>A.bytes.byteLength)),E}(A,B),w=JA(function(A){const B=iB(A);let E=[];for(const s of wA){const w=[!1,!0].filter(A=>LB(B,s,A)).map(E=>xB(A,B,s,E));if(!w.length)continue;const Q=w.filter(A=>A.fits);if(Q.length)return Q.reduce(bB).page;E=w}E.length||(E=[!1,!0].map(E=>xB(A,B,500,E)));const s=E.filter(A=>A.fits);if(s.length)return s.reduce(bB).page;const w=Math.min(...E.map(A=>Math.max(TA(A.sceneBounds)/TA(A.field),fA(A.sceneBounds)/fA(A.field)))),Q=50,C=1e6,g=Number.isFinite(w)?Math.ceil(Math.min(C,500*Math.max(1,w))/Q)*Q:C;let I=500,Y=0,R=[],M=Math.max(550,g);for(;M<=C;){const E=[!1,!0].map(E=>xB(A,B,M,E)).filter(A=>A.fits);if(E.length){Y=M,R=E;break}if(I=M,M===C)break;M=Math.min(C,Math.ceil(2*M/Q)*Q)}if(!Y)throw new Error("pdf.failed");let F=Math.floor(I/Q),i=Math.floor(Y/Q);for(;i-F>1;){const E=Math.floor((F+i)/2),s=[!1,!0].map(s=>xB(A,B,E*Q,s)).filter(A=>A.fits);s.length?(i=E,R=s):F=E}const x=R.reduce(bB).page;if(!OA(x.sceneBounds,x.planField,.5*$A))throw new Error("pdf.failed");return x}({...A,options:B,now:E,rasters:s,t:A.t})),Q=new Blob([w],{type:"application/pdf"}),C=URL.createObjectURL(Q);try{const B=document.createElement("a");B.href=C,B.download=`houseplan-${g=A.space.title,g.normalize("NFKD").replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-|-$/g,"").toLowerCase()||"space"}-${qA(E)}.pdf`,B.style.display="none",document.body.append(B),B.click(),B.remove()}finally{setTimeout(()=>URL.revokeObjectURL(C),0)}var g;return w}class cB{assertRasterBudget(A){DB(A)}render(A){let B;return B={...A,save:async E=>{await tB(A,E,B.now||new Date)}},s``}}export{GB as PDF_EXPORT_FINGERPRINT,cB as PdfExportRuntime,tB as exportSpacePdf}; + `}}v.properties={context:{attribute:!1}},v.styles=A`:host{display:contents;}.body{display:grid;gap:12px;width:100%;max-width:100%;min-width:0;padding:16px 20px;box-sizing:border-box;}label{display:flex;min-width:0;min-height:44px;align-items:center;gap:12px;cursor:pointer;}label span{min-width:0;overflow-wrap:anywhere;}input{width:20px;height:20px;flex:none;accent-color:var(--hp-accent,#d89300);}.row{display:flex;align-items:center;gap:8px;width:100%;max-width:100%;min-width:0;padding:12px 16px;box-sizing:border-box;}.spacer{flex:1;}button{min-width:0;min-height:44px;max-width:100%;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--hp-line,rgb(127 127 127/.3));border-radius:12px;padding:0 18px;box-sizing:border-box;overflow-wrap:anywhere;white-space:normal;background:transparent;color:inherit;font:inherit;cursor:pointer;}button.primary{background:var(--hp-accent,#d89300);color:var(--hp-on-accent,#111);border-color:transparent;}button:disabled{opacity:.55;cursor:default;}ha-icon{flex:none;margin-right:6px;}@media (max-width:360px){.row{display:grid;grid-template-columns:minmax(0,1fr);}.spacer{display:none;}button{width:100%;}}`,customElements.get("hp-pdf-dialog")||customElements.define("hp-pdf-dialog",v);const V=(A,B,E)=>Math.hypot(A[0]-B[0],A[1]-B[1])<=E,U=A=>Number.isFinite(A)&&A>=0?A:0;function l(A){const B=Number(A);return Number.isFinite(B)&&B>0?.1/B:0}const a=(A,B)=>[...new Set([...A,...B])].sort((A,B)=>A-B),P=(A,B)=>{const E=A.points.length;if(E<=1||!V(A.points[E-1],A.points[0],B))return!1;const s=E-2;return A.edgeSources[s]=a(A.edgeSources[s],A.edgeSources[E-1]),A.points.splice(E-1,1),A.edgeSources.splice(E-1,1),!0},y=(A,B)=>{for(let E=0;E+1{let E=!1;for(;A.points.length>1;)if(P(A,B))E=!0;else{if(!y(A,B))break;E=!0}return E},N=(A,B,E)=>{const s=B[0]-A[0],w=B[1]-A[1],C=E[0]-B[0],g=E[1]-B[1],I=Math.hypot(s,w),Y=Math.hypot(C,g);if(!(I>0&&Y>0))return!1;const R=s*C+w*g;if(!(R>0))return!1;const M=s*g-w*C;return Math.abs(M)<=R*Q},K=A=>{const B=A.points.length;if(B<3)return!1;for(let E=0;E{const E=U(B),s=[],w=[];for(let B=0;B[A])};for(;Q.points.length>1;){const A=u(Q,E);if(Q.points.length<3)break;if(!K(Q)&&!A)break}return u(Q,E),Q};function J(A,B){const E=Number(A[0]),s=Number(A[1]),w=Number(B[0]),C=Number(B[1]);if(![E,s,w,C].every(Number.isFinite))return null;const g=w-E,I=C-s,Y=Math.abs(g),R=Math.abs(I),M=Math.max(Y,R),F=Math.min(Y,R);if(!(M>0)||F/M>Q)return null;const i=[(E+w)/2,(s+C)/2];if(Y>=R){return{axis:"horizontal",a:[E,i[1]],b:[w,i[1]],mid:i,projectedLength:Y,tangentInterval:[Math.min(E,w),Math.max(E,w)],normalCoordinate:i[1]}}return{axis:"vertical",a:[i[0],s],b:[i[0],C],mid:i,projectedLength:R,tangentInterval:[Math.min(s,C),Math.max(s,C)],normalCoordinate:i[0]}}function Z(A,B){const E=B.map(A=>[Number(A[0]),Number(A[1])]);if(!E.every(A=>A.every(Number.isFinite)))return!1;if(E.length<3||((A,B)=>{const E=1e-12*Math.max(1,Math.abs(A[0]),Math.abs(A[1]),...B.flatMap(A=>[Math.abs(A[0]),Math.abs(A[1])]));for(let s=0;s0))continue;const Y=(A[0]-w[0])*g-(A[1]-w[1])*C;if(Math.abs(Y)>E*I)continue;const R=(A[0]-w[0])*C+(A[1]-w[1])*g;if(R>=-E&&R<=I*I+E)return!0}return!1})(A,E))return!1;let s=!1;for(let B=0,w=E.length-1;BA[1]==C[1]>A[1])continue;const g=(C[0]-Q[0])*(A[1]-Q[1])/(C[1]-Q[1])+Q[0];A[0]Object.is(A,-0)?0:A,I=[g(-Q/C),g(w/C)],Y=[g(-I[0]),g(-I[1])],R=[(B[0]+E[0])/2,(B[1]+E[1])/2],M=Math.max(1,C,Math.abs(R[0]),Math.abs(R[1])),F=Math.max(1e-9*M,.01*U(s));for(const B of[F,4*F,16*F]){const E=Z([R[0]+I[0]*B,R[1]+I[1]*B],A);if(E!==Z([R[0]+Y[0]*B,R[1]+Y[1]*B],A))return E?I:Y}return sA(A)>=0?I:Y}function f(A,B){let E=180*Math.atan2(B[1]-A[1],B[0]-A[0])/Math.PI;return E>90&&(E-=180),E<=-90&&(E+=180),E}function k(A,B,E,s={}){const w=Number(B);if(!(w>0&&Number.isFinite(w)))return[];const Q=void 0===s.epsilon?l(w):U(s.epsilon);return z(d(A,Q),w,E,{...s,epsilon:Q})}const z=(A,B,E,s)=>{if(A.points.length<3)return[];const Q=U(s.epsilon??l(B)),C=Number.isFinite(Number(s.ringIndex))?Number(s.ringIndex):0,g=[];for(let s=0;sQ))continue;const M=[...A.edgeSources[s]||[s]].sort((A,B)=>A-B),F=M[0]??s,i=T(A.points,R.a,R.b,Q),x=("horizontal"===R.axis?i[1]:i[0])<0?-1:1,b=[R.axis,O(R.tangentInterval[0]),String(x),O(C),O(F)].join("|"),L=R.projectedLength*B;g.push({sourceA:[...I],sourceB:[...Y],a:R.a,b:R.b,text:w(L,E),short:L<30,angle:f(R.a,R.b),mid:R.mid,axis:R.axis,projectedLength:R.projectedLength,tangentInterval:R.tangentInterval,normalCoordinate:R.normalCoordinate,inwardNormal:i,normalSign:x,source:{ringIndex:C,edgeIndex:F},sourceEdgeIndices:M,stableKey:b})}return g};function p(A,B,E,s={}){const w=Number(B);if(!(w>0&&Number.isFinite(w)))return[];const Q=void 0===s.epsilon?l(w):U(s.epsilon);let C=d(A,Q);if(sA(C.points)<0&&(C=(A=>{const B=A.points.length;return{points:[...A.points].reverse().map(A=>[...A]),edgeSources:A.points.map((E,s)=>[...A.edgeSources[(B-2-s+B)%B]])}})(C)),C.points.length){let A=0;for(let B=1;B({points:[...A.points.slice(B),...A.points.slice(0,B)],edgeSources:[...A.edgeSources.slice(B),...A.edgeSources.slice(0,B)]}))(C,A)}return z(C,w,E,{...s,epsilon:Q})}function X(A,B){const E=U(B),s=[];for(const B of A){const A=s.find(A=>A.axis===B.axis&&A.normalSign===B.normalSign&&Math.abs(A.normalCoordinate-B.normalCoordinate)<=E);A?A.edges.push(B):s.push({axis:B.axis,normalSign:B.normalSign,normalCoordinate:B.normalCoordinate,edges:[B]})}return s.map(A=>A.edges)}const O=A=>Object.is(A,-0)?"0":String(A),q=A=>"horizontal"===A?0:1;function $(A,B){return q(A.axis)-q(B.axis)||A.tangentInterval[0]-B.tangentInterval[0]||A.normalSign-B.normalSign||A.source.ringIndex-B.source.ringIndex||A.source.edgeIndex-B.source.edgeIndex}function _(A,B,E,s){const w=U(s);if(A.axis!==B.axis)return!1;if(A.source.ringIndex!==B.source.ringIndex)return!1;if(A.inwardNormal[0]*B.inwardNormal[0]+A.inwardNormal[1]*B.inwardNormal[1]>=-.5)return!1;if(!((A,B,E)=>Math.abs(A[0]-B[0])<=E&&Math.abs(A[1]-B[1])<=E)(A.tangentInterval,B.tangentInterval,w))return!1;if(Math.abs(A.projectedLength-B.projectedLength)>w)return!1;return Z([(A.mid[0]+B.mid[0])/2,(A.mid[1]+B.mid[1])/2],E)}const AA=(A,B)=>{const E=B?.(A);return{hardCollisions:Number.isFinite(Number(E?.hardCollisions))?Number(E?.hardCollisions):0,normalClearance:Number.isFinite(Number(E?.normalClearance))?Number(E?.normalClearance):0}},BA=(A,B,E)=>{const s=AA(A,E),w=AA(B,E);return s.hardCollisions-w.hardCollisions||w.normalClearance-s.normalClearance||$(A,B)};function EA(A,B){if(A.length<2)return[...A];const E=U(B.epsilon),s=function(A,B=1e-7){return d(A,B).points.map(A=>[...A])}(B.ring,E),w=[];for(let B=0;B{const E=A.separation-B.separation;if(E)return E;const s=$(A.left,A.right)<=0?A.left:A.right,w=s===A.left?A.right:A.left,Q=$(B.left,B.right)<=0?B.left:B.right,C=Q===B.left?B.right:B.left;return $(s,Q)||$(w,C)});const Q=new Set,C=new Set;for(const A of w){if(Q.has(A.left)||Q.has(A.right))continue;Q.add(A.left),Q.add(A.right);const E=BA(A.left,A.right,B.score)<=0?A.left:A.right;C.add(E===A.left?A.right:A.left)}return A.filter(A=>!C.has(A))}function sA(A){let B=0;for(let E=0;E1){const A=Math.sqrt(G);Y*=A,R*=A}const o=Math.max(0,Y*Y*R*R-Y*Y*D*D-R*R*L*L),t=Y*Y*D*D+R*R*L*L||1,c=(Q===C?-1:1)*Math.sqrt(o/t),W=c*Y*D/R,m=c*-R*L/Y,n=F*W-i*m+(A+g)/2,e=i*W+F*m+(B+I)/2;let h=gA(1,0,(L-W)/Y,(D-m)/R),S=gA((L-W)/Y,(D-m)/R,(-L-W)/Y,(-D-m)/R);!C&&S>0&&(S-=2*Math.PI),C&&S<0&&(S+=2*Math.PI);const j=Math.max(1,Math.ceil(Math.abs(S)/(Math.PI/2))),r=S/j,H=A=>[n+F*Y*Math.cos(A)-i*R*Math.sin(A),e+i*Y*Math.cos(A)+F*R*Math.sin(A)],v=A=>[-F*Y*Math.sin(A)-i*R*Math.cos(A),-i*Y*Math.sin(A)+F*R*Math.cos(A)],V=[];for(let A=0;A[B.a*A+B.c*E+B.e,B.b*A+B.d*E+B.f];return function(A){const B=A.match(/[AaCcHhLlMmQqSsTtVvZz]|[-+]?(?:\d*\.\d+|\d+\.?)(?:e[-+]?\d+)?/gi)||[],E=[];let s=0,w="",Q=0,C=0,g=0,I=0,Y=null,R=null;const M=()=>Number(B[s++]);for(;sB.length||QA.test(B[s]))throw new Error(`Invalid SVG path command ${w}`);const x=Array.from({length:i},M),b=A=>A+(F?Q:0),L=A=>A+(F?C:0);if("M"===A||"L"===A)Q=b(x[0]),C=L(x[1]),E.push({op:"M"===A?"M":"L",x:Q,y:C}),"M"===A&&(g=Q,I=C,w=F?"l":"L"),Y=R=null;else if("H"===A)Q=b(x[0]),E.push({op:"L",x:Q,y:C}),Y=R=null;else if("V"===A)C=L(x[0]),E.push({op:"L",x:Q,y:C}),Y=R=null;else if("C"===A){const A=b(x[0]),B=L(x[1]),s=b(x[2]),w=L(x[3]);Q=b(x[4]),C=L(x[5]),Y=[s,w],R=null,E.push({op:"C",x1:A,y1:B,x2:s,y2:w,x:Q,y:C})}else if("S"===A){const A=Y?2*Q-Y[0]:Q,B=Y?2*C-Y[1]:C,s=b(x[0]),w=L(x[1]);Q=b(x[2]),C=L(x[3]),Y=[s,w],R=null,E.push({op:"C",x1:A,y1:B,x2:s,y2:w,x:Q,y:C})}else if("Q"===A||"T"===A){const B="Q"===A?b(x[0]):R?2*Q-R[0]:Q,s="Q"===A?L(x[1]):R?2*C-R[1]:C,w=b("Q"===A?x[2]:x[0]),g=L("Q"===A?x[3]:x[1]);E.push({op:"C",x1:Q+2/3*(B-Q),y1:C+2/3*(s-C),x2:w+2/3*(B-w),y2:g+2/3*(s-g),x:w,y:g}),Q=w,C=g,R=[B,s],Y=null}else if("A"===A){const A=b(x[5]),B=L(x[6]),s=IA(Q,C,x[0],x[1],x[2],x[3],x[4],A,B);s.length?E.push(...s):E.push({op:"L",x:A,y:B}),Q=A,C=B,Y=R=null}}return E}(A).map(A=>{if("Z"===A.op)return A;if("M"===A.op||"L"===A.op){const[B,s]=E(A.x,A.y);return{op:A.op,x:B,y:s}}if("C"!==A.op)throw new Error("Unsupported PDF vector operation");const[B,s]=E(A.x1,A.y1),[w,Q]=E(A.x2,A.y2),[C,g]=E(A.x,A.y);return{op:"C",x1:B,y1:s,x2:w,y2:Q,x:C,y:g}})}const RA=["M20.82,15.31h0L10.46,9c-.46-.26-1.11.37-.86.84l6.15,10.56,10.56,6.15a.66.66,0,0,0,.84-.86Zm-4,4,3-3,4.55,7.44Z","M18,2A16,16,0,1,0,34,18,16,16,0,0,0,18,2Zm1,29.95V29.53H17v2.42A14,14,0,0,1,4.05,19H6.47V17H4.05A14,14,0,0,1,17,4.05V6.47h2V4.05A14,14,0,0,1,31.95,17H29.53v2h2.42A14,14,0,0,1,19,31.95Z"],MA=A=>Math.abs(A)<1e-12?0:Math.abs(A-1)<1e-12?1:Math.abs(A+1)<1e-12?-1:A;function FA(A){const B=function(A){const{centerX:B,centerY:E,size:s,northDeg:w}=A;if(![B,E,s,w].every(Number.isFinite)||s<=0)throw new RangeError("PDF compass placement must contain finite coordinates and a positive size");const Q=((w%360+360)%360+45)*Math.PI/180,C=s/36,g=MA(Math.cos(Q)),I=MA(Math.sin(Q)),Y=C*g,R=C*I,M=-C*I,F=C*g;return{a:Y,b:R,c:M,d:F,e:B-18*Y-18*M,f:E-18*R-18*F}}(A);return RA.flatMap(A=>YA(A,B))}const iA=1e-8,xA=A=>A.length>=2&&Number.isFinite(A[0])&&Number.isFinite(A[1]),bA=(A,B)=>A[0]>=B.minX-iA&&A[0]<=B.maxX+iA&&A[1]>=B.minY-iA&&A[1]<=B.maxY+iA,LA=A=>[A.minX,A.minY,A.maxX,A.maxY].every(Number.isFinite)&&A.maxX>=A.minX&&A.maxY>=A.minY,DA=A=>[[A.minX,A.minY],[A.maxX,A.minY],[A.maxX,A.maxY],[A.minX,A.maxY]];const GA=(A,B,E)=>(B[0]-A[0])*(E[1]-A[1])-(B[1]-A[1])*(E[0]-A[0]),oA=(A,B,E)=>{const s=E[0]-B[0],w=E[1]-B[1],Q=Math.abs(s)>=Math.abs(w)?s:w;return Math.abs(Q)<=iA?0:(Math.abs(s)>=Math.abs(w)?A[0]-B[0]:A[1]-B[1])/Q},tA=(A,B)=>Math.hypot(B[0]-A[0],B[1]-A[1]);function cA(A,B,E){const s=tA(B,E);if(s<=iA)return tA(A,B)<=iA;if(Math.abs(GA(B,E,A))/s>iA)return!1;const w=oA(A,B,E),Q=iA/s;return w>=-Q&&w<=1+Q}function WA(A,B,E,s){const w=B[0]-A[0],Q=B[1]-A[1],C=s[0]-E[0],g=s[1]-E[1],I=Math.hypot(w,Q),Y=Math.hypot(C,g);if(I<=iA)return cA(A,E,s)?{t:0,endT:0,overlap:!1}:null;if(Y<=iA){if(!cA(E,A,B))return null;const s=Math.max(0,Math.min(1,oA(E,A,B)));return{t:s,endT:s,overlap:!1}}const R=w*g-Q*C,M=E[0]-A[0],F=E[1]-A[1],i=iA*I*Y;if(Math.abs(R)<=i){if(Math.abs(GA(A,B,E))/I>iA||Math.abs(GA(A,B,s))/I>iA)return null;const w=oA(E,A,B),Q=oA(s,A,B),C=Math.max(0,Math.min(w,Q)),g=Math.min(1,Math.max(w,Q));return giA}}const x=(M*g-F*C)/R,b=(M*Q-F*w)/R,L=iA/I,D=iA/Y;if(x<-L||x>1+L||b<-D||b>1+D)return null;const G=Math.max(0,Math.min(1,x));return{t:G,endT:G,overlap:!1}}const mA=A=>A.every(A=>A.length>=2&&A.every(xA));function nA(A,B){for(const E of A){const A=E;for(let E=0;Enull!==WA(A,B,E,s[(w+1)%s.length]))}const hA=2048,SA=2146,jA=[-1825,-555,4188,2163],rA={32:1,33:2,34:3,35:4,36:5,37:6,38:7,39:8,40:9,41:10,42:11,43:12,44:13,45:14,46:15,47:16,48:17,49:18,50:19,51:20,52:21,53:22,54:23,55:24,56:25,57:26,58:27,59:28,60:29,61:30,62:31,63:32,64:33,65:34,66:35,67:36,68:37,69:38,70:39,71:40,72:41,73:42,74:43,75:44,76:45,77:46,78:47,79:48,80:49,81:50,82:51,83:52,84:53,85:54,86:55,87:56,88:57,89:58,90:59,91:60,92:61,93:62,94:63,95:64,96:65,97:66,98:67,99:68,100:69,101:70,102:71,103:72,104:73,105:74,106:75,107:76,108:77,109:78,110:79,111:80,112:81,113:82,114:83,115:84,116:85,117:86,118:87,119:88,120:89,121:90,122:91,123:92,124:93,125:94,126:95,160:596,161:96,162:97,163:98,164:99,165:100,166:101,167:102,168:103,169:104,170:105,171:106,172:107,173:597,174:108,175:109,176:110,177:111,178:112,179:113,180:114,181:115,182:116,183:117,184:118,185:119,186:120,187:121,188:122,189:123,190:124,191:125,192:603,193:604,194:605,195:606,196:607,197:608,198:126,199:609,200:610,201:611,202:612,203:613,204:614,205:615,206:616,207:617,208:599,209:618,210:619,211:620,212:621,213:622,214:623,215:127,216:128,217:624,218:625,219:626,220:627,221:628,222:129,223:130,224:629,225:630,226:631,227:632,228:633,229:634,230:131,231:635,232:636,233:637,234:638,235:639,236:640,237:641,238:642,239:643,240:132,241:644,242:645,243:646,244:647,245:648,246:649,247:133,248:134,249:650,250:651,251:652,252:653,253:654,254:135,255:655,256:656,257:657,258:658,259:659,260:660,261:661,262:662,263:663,264:664,265:665,266:666,267:667,268:668,269:669,270:670,271:671,272:598,273:136,274:672,275:673,276:674,277:675,278:676,279:677,280:678,281:679,282:680,283:681,284:682,285:683,286:684,287:685,288:686,289:687,290:688,291:689,292:690,293:691,294:137,295:600,296:692,297:693,298:694,299:695,300:696,301:697,302:698,303:699,304:700,305:138,306:701,307:702,308:703,309:704,310:705,311:706,312:139,313:707,314:708,315:709,316:710,317:711,318:712,319:713,320:714,321:140,322:141,323:715,324:716,325:717,326:718,327:719,328:720,329:721,330:142,331:143,332:722,333:723,334:724,335:725,336:726,337:727,338:144,339:145,340:728,341:729,342:730,343:731,344:732,345:733,346:734,347:735,348:736,349:737,350:738,351:739,352:742,353:743,354:744,355:745,356:746,357:747,358:601,359:602,360:748,361:749,362:750,363:751,364:752,365:753,366:754,367:755,368:756,369:757,370:758,371:759,372:760,373:761,374:762,375:763,376:764,377:765,378:766,379:767,380:768,381:769,382:770,383:146,1024:897,1025:856,1026:165,1027:857,1028:166,1029:858,1030:859,1031:860,1032:861,1033:167,1034:168,1035:169,1036:863,1037:898,1038:864,1039:170,1040:865,1041:171,1042:866,1043:867,1044:172,1045:868,1046:173,1047:174,1048:175,1049:869,1050:862,1051:176,1052:870,1053:871,1054:872,1055:873,1056:874,1057:875,1058:876,1059:177,1060:178,1061:877,1062:179,1063:180,1064:181,1065:182,1066:183,1067:184,1068:185,1069:186,1070:187,1071:188,1072:878,1073:189,1074:190,1075:191,1076:192,1077:879,1078:193,1079:194,1080:195,1081:880,1082:196,1083:197,1084:198,1085:199,1086:881,1087:200,1088:882,1089:883,1090:201,1091:884,1092:202,1093:885,1094:203,1095:204,1096:205,1097:206,1098:207,1099:208,1100:209,1101:210,1102:211,1103:212,1104:899,1105:886,1106:213,1107:887,1108:214,1109:888,1110:889,1111:890,1112:891,1113:215,1114:216,1115:217,1116:892,1117:900,1118:893,1119:218,1120:219,1121:220,1122:965,1123:221,1124:222,1125:223,1126:224,1127:225,1128:226,1129:227,1130:228,1131:229,1132:230,1133:231,1134:232,1135:233,1136:901,1137:902,1138:234,1139:235,1140:236,1141:237,1142:903,1143:904,1144:906,1145:905,1146:238,1147:239,1148:240,1149:241,1150:242,1151:243,1152:244,1153:245,1154:246,1155:247,1156:248,1157:249,1158:250,1159:251,1160:252,1161:253,1162:254,1163:255,1164:964,1165:256,1166:257,1167:258,1168:259,1169:260,1170:966,1171:967,1172:261,1173:262,1174:263,1175:264,1176:907,1177:908,1178:265,1179:266,1180:267,1181:268,1182:968,1183:969,1184:269,1185:270,1186:271,1187:272,1188:273,1189:274,1190:275,1191:276,1192:277,1193:278,1194:909,1195:910,1196:955,1197:956,1198:911,1199:912,1200:970,1201:971,1202:279,1203:280,1204:281,1205:282,1206:283,1207:284,1208:285,1209:286,1210:287,1211:963,1212:288,1213:289,1214:961,1215:962,1216:913,1217:914,1218:915,1219:290,1220:291,1221:292,1222:293,1223:294,1224:295,1225:296,1226:297,1227:957,1228:958,1229:298,1230:299,1231:916,1232:917,1233:918,1234:919,1235:920,1236:921,1237:922,1238:923,1239:924,1240:300,1241:926,1242:925,1243:927,1244:928,1245:929,1246:930,1247:931,1248:301,1249:302,1250:932,1251:933,1252:934,1253:935,1254:936,1255:937,1256:938,1257:939,1258:940,1259:941,1260:942,1261:943,1262:944,1263:945,1264:946,1265:947,1266:948,1267:949,1268:950,1269:951,1270:959,1271:960,1272:952,1273:953,1274:303,1275:304,1276:305,1277:306,1278:972,1279:973,1280:307,1281:954,1282:308,1283:309,1284:310,1285:311,1286:312,1287:313,1288:314,1289:315,1290:316,1291:317,1292:318,1293:319,1294:320,1295:321,1296:322,1297:974,1298:323,1299:324,1300:325,1301:326,1302:327,1303:328,1304:329,1305:330,1306:982,1307:983,1308:984,1309:985,1310:331,1311:332,1312:333,1313:334,1314:335,1315:336,1316:337,1317:338,1318:339,1319:340,1320:341,1321:342,1322:343,1323:344,1324:345,1325:346,1326:347,1327:348,8192:349,8193:350,8194:351,8195:352,8196:353,8197:354,8198:355,8199:356,8200:357,8201:358,8202:360,8203:361,8204:362,8205:363,8206:364,8207:365,8208:366,8209:367,8210:368,8211:369,8212:370,8213:975,8214:371,8215:372,8216:373,8217:374,8218:375,8219:376,8220:377,8221:378,8222:379,8223:380,8224:381,8225:382,8226:383,8227:384,8228:385,8229:386,8230:387,8231:388,8239:986,8240:389,8241:390,8242:894,8243:895,8244:391,8245:392,8246:393,8247:394,8248:395,8249:396,8250:397,8251:398,8252:896,8253:399,8254:400,8255:401,8256:402,8257:403,8258:404,8259:405,8260:406,8261:407,8262:408,8263:987,8264:988,8265:989,8266:409,8267:410,8268:411,8269:412,8270:413,8271:414,8272:415,8273:416,8274:417,8275:418,8276:419,8277:420,8278:421,8279:422,8280:423,8281:424,8282:425,8283:426,8284:427,8285:428,8286:429,8287:990,8364:430,8381:431,8776:433},HA={1:507,2:527,3:655,4:1261,5:1150,6:1500,7:1273,8:357,9:700,10:712,11:882,12:1161,13:402,14:565,15:539,16:844,17:1150,18:1150,19:1150,20:1150,21:1150,22:1150,23:1150,24:1150,25:1150,26:1150,27:496,28:433,29:1041,30:1124,31:1070,32:967,33:1839,34:1336,35:1275,36:1333,37:1343,38:1164,39:1132,40:1395,41:1460,42:557,43:1130,44:1284,45:1102,46:1788,47:1460,48:1408,49:1292,50:1408,51:1261,52:1215,53:1222,54:1328,55:1303,56:1817,57:1284,58:1230,59:1226,60:543,61:840,62:543,63:856,64:924,65:633,66:1114,67:1149,68:1072,69:1155,70:1085,71:711,72:1149,73:1128,74:497,75:489,76:1038,77:497,78:1795,79:1130,80:1168,81:1149,82:1164,83:693,84:1056,85:669,86:1129,87:992,88:1539,89:1015,90:969,91:1015,92:693,93:499,94:693,95:1393,96:499,97:1120,98:1190,99:1460,100:1075,101:491,102:1256,103:856,104:1609,105:915,106:961,107:1134,108:1610,109:938,110:765,111:1094,112:751,113:751,114:642,115:1160,116:1001,117:534,118:507,119:751,120:931,121:960,122:1500,123:1589,124:1593,125:969,126:1914,127:1092,128:1408,129:1210,130:1218,131:1729,132:1200,133:1169,134:1160,135:1180,136:1223,137:1434,138:506,139:1139,140:1103,141:553,142:1419,143:1160,144:1953,145:1860,146:508,165:1535,166:1380,167:2193,168:2212,169:1666,170:1460,171:1291,172:1540,173:1859,174:1215,175:1460,176:1449,177:1287,178:1580,179:1497,180:1402,181:1927,182:1984,183:1554,184:1771,185:1285,186:1380,187:1831,188:1304,189:1132,190:1170,191:859,192:1236,193:1568,194:1040,195:1182,196:1106,197:1184,198:1519,199:1181,200:1182,201:984,202:1485,203:1213,204:1113,205:1656,206:1694,207:1271,208:1590,209:1112,210:1101,211:1671,212:1124,213:1128,214:1101,215:1737,216:1764,217:1161,218:1182,219:1800,220:1579,221:1110,222:1835,223:1528,224:1234,225:1094,226:1803,227:1547,228:1745,229:1505,230:2308,231:2001,232:1059,233:987,234:1393,235:1163,236:1290,237:1027,238:1393,239:1160,240:1793,241:1572,242:1800,243:1579,244:1330,245:1095,246:1277,247:1024,248:1024,249:1024,250:1024,251:1024,252:1024,253:1024,254:1545,255:1261,256:1110,257:1307,258:1161,259:1123,260:912,261:1243,262:1029,263:1954,264:1633,265:1434,266:1208,267:1289,268:1150,269:1676,270:1411,271:1535,272:1241,273:1999,274:1460,275:2097,276:1780,277:1518,278:1235,279:1304,280:1066,281:1836,282:1372,283:1468,284:1174,285:1391,286:1130,287:1391,288:1583,289:1213,290:1289,291:1114,292:1534,293:1263,294:1458,295:1160,296:1554,297:1260,298:1871,299:1598,300:1415,301:1192,302:1192,303:1207,304:939,305:1326,306:1088,307:1270,308:1684,309:1764,310:1622,311:1323,312:1097,313:1031,314:1985,315:1653,316:2043,317:1697,318:1270,319:1053,320:1453,321:1312,322:1380,323:1538,324:1266,325:1920,326:1549,327:1857,328:1547,329:1926,330:1774,331:1316,332:1106,333:2274,334:1832,335:2300,336:1829,337:1526,338:1242,339:1468,340:1208,341:1539,342:1273,343:2710,344:2238,345:1568,346:1240,347:1515,348:1243,349:1044,350:2089,351:1044,352:2089,353:697,354:522,355:348,356:1151,357:560,358:418,360:209,361:1024,362:1024,363:1024,364:1024,365:1024,366:564,367:564,368:1171,369:1344,370:1599,371:778,372:933,373:409,374:409,375:407,376:409,377:724,378:731,379:705,380:764,381:1129,382:1167,383:690,384:1100,385:511,386:964,387:1370,388:382,389:1962,390:2360,391:1045,392:463,393:757,394:1045,395:803,396:614,397:614,398:1241,399:919,400:952,401:1540,402:1540,403:874,404:1370,405:870,406:931,407:640,408:641,409:907,410:1001,411:1237,412:1237,413:985,414:511,415:1541,416:985,417:931,418:1366,419:1540,420:1172,421:932,422:1333,423:1215,424:1125,425:379,426:1071,427:1162,428:379,429:379,430:1150,431:1359,433:1154,596:507,597:565,598:1373,599:1373,600:1158,601:1222,602:669,603:1336,604:1336,605:1336,606:1336,607:1336,608:1336,609:1333,610:1164,611:1164,612:1164,613:1164,614:557,615:557,616:557,617:557,618:1460,619:1408,620:1408,621:1408,622:1408,623:1408,624:1328,625:1328,626:1328,627:1328,628:1230,629:1114,630:1114,631:1114,632:1114,633:1114,634:1114,635:1072,636:1085,637:1085,638:1085,639:1085,640:506,641:506,642:506,643:506,644:1130,645:1168,646:1168,647:1168,648:1168,649:1168,650:1129,651:1129,652:1129,653:1129,654:969,655:969,656:1336,657:1114,658:1336,659:1114,660:1336,661:1114,662:1333,663:1072,664:1333,665:1072,666:1333,667:1072,668:1333,669:1072,670:1343,671:1305,672:1164,673:1085,674:1164,675:1085,676:1164,677:1085,678:1164,679:1085,680:1164,681:1085,682:1395,683:1149,684:1395,685:1149,686:1395,687:1149,688:1395,689:1149,690:1460,691:1128,692:557,693:506,694:557,695:506,696:557,697:506,698:557,699:497,700:557,701:1687,702:986,703:1130,704:515,705:1284,706:1038,707:1102,708:497,709:1102,710:497,711:1102,712:647,713:1102,714:717,715:1460,716:1130,717:1460,718:1130,719:1460,720:1130,721:1130,722:1408,723:1168,724:1408,725:1168,726:1408,727:1168,728:1261,729:693,730:1261,731:693,732:1261,733:693,734:1215,735:1056,736:1215,737:1056,738:1215,739:1056,742:1215,743:1056,744:1222,745:669,746:1222,747:709,748:1328,749:1129,750:1328,751:1129,752:1328,753:1129,754:1328,755:1129,756:1328,757:1129,758:1328,759:1129,760:1817,761:1539,762:1230,763:969,764:1230,765:1226,766:1015,767:1226,768:1015,769:1226,770:1015,856:1164,857:1139,858:1215,859:557,860:557,861:1130,862:1316,863:1284,864:1287,865:1336,866:1275,867:1139,868:1164,869:1460,870:1788,871:1460,872:1408,873:1461,874:1292,875:1333,876:1222,877:1284,878:1114,879:1085,880:1182,881:1168,882:1149,883:1072,884:969,885:1015,886:1085,887:859,888:1056,889:497,890:506,891:489,892:1106,893:969,894:357,895:655,896:1054,897:1164,898:1460,899:1085,900:1182,901:1417,902:1434,903:1290,904:1027,905:2137,906:2377,907:1215,908:1040,909:1333,910:1072,911:1230,912:1026,913:557,914:1859,915:1568,916:557,917:1336,918:1114,919:1336,920:1114,921:1914,922:1729,923:1164,924:1085,925:1415,926:1079,927:1079,928:1859,929:1568,930:1215,931:1040,932:1460,933:1182,934:1460,935:1182,936:1408,937:1168,938:1393,939:1163,940:1393,941:1163,942:1380,943:1101,944:1287,945:969,946:1287,947:969,948:1287,949:969,950:1402,951:1113,952:1771,953:1590,954:1155,955:1222,956:984,957:1402,958:1113,959:1139,960:859,961:1583,962:1213,963:1128,964:1285,965:1285,966:1139,967:859,968:1336,969:1063,970:1230,971:1026,972:1284,973:1015,974:1104,975:1599,982:1408,983:1164,984:1817,985:1539,986:507,987:1934,988:1494,989:1494,990:507},vA=new TextEncoder,VA=A=>{const B=Math.round(100*A)/100;return Number.isInteger(B)?String(B):B.toFixed(2).replace(/0+$/,"")},UA=A=>{const B=Math.round(1e6*A)/1e6;return Number.isInteger(B)?String(B):B.toFixed(6).replace(/0+$/,"")},lA=A=>A.map(UA).join(" ");function aA(A){let B="",E=0;const s=new Map;for(const w of A){const A=w.codePointAt(0)||0,Q=rA[A]||rA[63];B+=Q.toString(16).padStart(4,"0"),E+=HA[Q]||1024,s.has(Q)||s.set(Q,A||63)}return{hex:B,width:E,unicode:s}}function PA(A,B){return aA(A).width*B/hA}function yA(A,B=PA(A.text,A.size)){const E=A.align||"left",s="center"===E?B/2:"right"===E?B:0,w=(A.angle||0)*Math.PI/180,Q=Math.cos(w),C=Math.sin(w);return{width:B,baselineX:A.x-Q*s,baselineY:A.y+C*s,cos:Q,sin:C}}function uA(A){const B=yA(A),E=-555*A.size/hA,s=SA*A.size/hA,w=[0,B.width].flatMap(A=>[E,s].map(E=>({x:B.baselineX+B.cos*A-B.sin*E,y:B.baselineY-B.sin*A-B.cos*E})));return{minX:Math.min(...w.map(A=>A.x)),minY:Math.min(...w.map(A=>A.y)),maxX:Math.max(...w.map(A=>A.x)),maxY:Math.max(...w.map(A=>A.y))}}function NA(A){const B=A.reduce((A,B)=>A+B.length,0),E=new Uint8Array(B);let s=0;for(const B of A)E.set(B,s),s+=B.length;return E}const KA=A=>vA.encode(A),dA=(A,B)=>NA([KA(`<< ${A} /Length ${B.length} >>\nstream\n`),B,KA("\nendstream")]);function JA(A){const B=function(A){const B=atob(A),E=new Uint8Array(B.length);for(let A=0;A"image"===A.kind&&null!=A.opacity&&A.opacity<1?[Math.max(0,Math.min(1,A.opacity))]:[]))].sort((A,B)=>A-B),s=new Map(E.map((A,B)=>[A,`GS${B+1}`])),w=function(A,B){const E=[],s=new Map,w=B=>A.height-B,Q=(A,...B)=>`${B.map(VA).join(" ")} ${A}`,C=A=>{for(const B of A)if(B.length){E.push(Q("m",B[0][0],w(B[0][1])));for(let A=1;A{let B=!1;for(const s of A)if(!(s.length<2)){B=!0,E.push(Q("m",s[0][0],w(s[0][1])));for(let A=1;A Tj`,"ET")}else{const A=(I.angle||0)*Math.PI/180,s=Math.cos(A),C=Math.sin(A),g=I.x+I.width/2,Y=w(I.y+I.height/2);E.push("q");const R=null==I.opacity?1:Math.max(0,Math.min(1,I.opacity)),M=B.get(R);M&&E.push(`/${M} gs`),E.push(Q("cm",s*I.width,C*I.width,C*I.height,-s*I.height,g-s*I.width/2-C*I.height/2,Y-C*I.width/2+s*I.height/2),`/Im${I.imageId} Do`,"Q")}return{stream:E.join("\n"),unicode:s}}(A,s),Q=Math.max(0,...Object.keys(HA).map(Number)),C=Array.from({length:Q+1},(A,B)=>Math.round(1e3*(HA[B]||1024)/hA)),g=[],I=A=>(g.push("string"==typeof A?KA(A):A),g.length),Y=I(""),R=I(""),M=I(""),F=I(dA(`/Length1 ${B.length}`,B)),i=I(`<< /Type /FontDescriptor /FontName /Roboto /Flags 32 /FontBBox [${jA.join(" ")}] /ItalicAngle 0 /Ascent 2146 /Descent -555 /CapHeight 2146 /StemV 80 /FontFile2 ${F} 0 R >>`),x=I(`<< /Type /Font /Subtype /CIDFontType2 /BaseFont /Roboto /CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >> /FontDescriptor ${i} 0 R /W [0 [${C.join(" ")}]] /CIDToGIDMap /Identity >>`),b=KA(function(A){const B=[...A].sort((A,B)=>A[0]-B[0]),E=B.map(([A,B])=>`<${A.toString(16).padStart(4,"0")}> <${B<=65535?B.toString(16).padStart(4,"0"):(()=>{const A=B-65536;return(55296+(A>>10)).toString(16).padStart(4,"0")+(56320+(1023&A)).toString(16).padStart(4,"0")})()}>`);return`/CIDInit /ProcSet findresource begin\n12 dict begin\nbegincmap\n/CIDSystemInfo << /Registry (Adobe) /Ordering (UCS) /Supplement 0 >> def\n/CMapName /HousePlanUnicode def\n/CMapType 2 def\n1 begincodespacerange\n<0000> \nendcodespacerange\n${B.length} beginbfchar\n${E.join("\n")}\nendbfchar\nendcmap\nCMapName currentdict /CMap defineresource pop\nend\nend`}(w.unicode)),L=I(dA("",b)),D=I(`<< /Type /Font /Subtype /Type0 /BaseFont /Roboto /Encoding /Identity-H /DescendantFonts [${x} 0 R] /ToUnicode ${L} 0 R >>`),G=I(dA("",KA(w.stream))),o=[];for(const B of A.images||[]){const A=I(dA(`/Type /XObject /Subtype /Image /Width ${B.width} /Height ${B.height} /ColorSpace /DeviceRGB /BitsPerComponent 8 /Filter /DCTDecode`,B.bytes));o.push(`/Im${B.id} ${A} 0 R`)}const t=A.now.toISOString().replace(/[-:T]/g,"").slice(0,14),c=I(`<< /CreationDate (D:${t}Z) /ModDate (D:${t}Z) >>`),W=`<< /Font << /F1 ${D} 0 R >>`+(o.length?` /XObject << ${o.join(" ")} >>`:"")+(E.length?` /ExtGState << ${E.map(A=>`/${s.get(A)} << /ca ${VA(A)} /CA ${VA(A)} >>`).join(" ")} >>`:"")+" >>";g[Y-1]=KA(`<< /Type /Catalog /Pages ${R} 0 R >>`),g[R-1]=KA(`<< /Type /Pages /Kids [${M} 0 R] /Count 1 >>`),g[M-1]=KA(`<< /Type /Page /Parent ${R} 0 R /MediaBox [0 0 ${VA(A.width)} ${VA(A.height)}] /Resources ${W} /Contents ${G} 0 R >>`);const m=KA("%PDF-1.4\n%âãÏÓ\n"),n=[m],e=[0];let h=m.length;g.forEach((A,B)=>{const E=KA(`${B+1} 0 obj\n`),s=KA("\nendobj\n");e.push(h),n.push(E,A,s),h+=E.length+A.length+s.length});const S=h,j=["xref",`0 ${g.length+1}`,"0000000000 65535 f "];for(let A=1;A<=g.length;A++)j.push(`${String(e[A]).padStart(10,"0")} 00000 n `);return j.push(`trailer\n<< /Size ${g.length+1} /Root ${Y} 0 R /Info ${c} 0 R >>`,`startxref\n${S}\n%%EOF\n`),n.push(KA(j.join("\n"))),NA(n)}const ZA=A=>[A.minX,A.minY,A.maxX,A.maxY].every(Number.isFinite)&&A.maxX>=A.minX&&A.maxY>=A.minY,TA=A=>A.maxX-A.minX,fA=A=>A.maxY-A.minY;function kA(A,B,E,s=0){Number.isFinite(B)&&Number.isFinite(E)&&(A.minX=Math.min(A.minX,B-s),A.minY=Math.min(A.minY,E-s),A.maxX=Math.max(A.maxX,B+s),A.maxY=Math.max(A.maxY,E+s))}function zA(A,B,E,s,w,Q){const C=Q*Math.PI/180,g=Math.cos(C),I=Math.sin(C),Y=B+s/2,R=E+w/2;for(const[B,E]of[[-s/2,-w/2],[s/2,-w/2],[s/2,w/2],[-s/2,w/2]])kA(A,Y+g*B-I*E,R+I*B+g*E)}function pA(A,B,E){for(const s of B)"M"===s.op||"L"===s.op?kA(A,s.x,s.y,E):"C"===s.op&&(kA(A,s.x1,s.y1,E),kA(A,s.x2,s.y2,E),kA(A,s.x,s.y,E))}function XA(A){const B={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const E of A)if("path"===E.kind){const A=E.stroke?(E.width||.5)/2:0;for(const s of E.rings)for(const[E,w]of s)kA(B,E,w,A)}else if("line"===E.kind)for(const[A,s]of E.points)kA(B,A,s,E.width/2);else if("vector"===E.kind)pA(B,E.ops,E.width/2);else if("text"===E.kind){const A=uA(E);kA(B,A.minX,A.minY),kA(B,A.maxX,A.maxY)}else zA(B,E.x,E.y,E.width,E.height,E.angle||0);return B}function OA(A,B,E){return!!ZA(A)&&(TA(A)<=TA(B)+E&&fA(A)<=fA(B)+E)}function qA(A){return`${A.getFullYear()}-${String(A.getMonth()+1).padStart(2,"0")}-${String(A.getDate()).padStart(2,"0")}`}const $A=72/25.4,_A=5.25,AB=[.08,.08,.08],BB=[127/255,127/255,127/255],EB=[.72,.72,.72],sB=(A,B)=>A.minXB.minX&&A.minYB.minY;function wB(A,B,E,s,w=0,Q="left"){return uA({x:A,y:B,text:E,size:s,angle:w,align:Q})}function QB(A,B,E,s,w){const Q=Math.min(...[[A.minX,A.minY],[A.maxX,A.minY],[A.maxX,A.maxY],[A.minX,A.maxY]].map(([A,w])=>(A-B)*s[0]+(w-E)*s[1]));return Math.max(0,w-Q)}const CB=(A,B)=>`${A.axis}:${B[0]<-.5||B[1]<-.5?-1:1}`,gB=(A,B)=>{A.minX=Math.min(A.minX,B[0]),A.minY=Math.min(A.minY,B[1]),A.maxX=Math.max(A.maxX,B[0]),A.maxY=Math.max(A.maxY,B[1])},IB=A=>{const B={minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};for(const E of A)for(const A of E)gB(B,A);return B};function YB(A,B,E,s,w=0){const Q=w*Math.PI/180,C=Math.cos(Q),g=Math.sin(Q),I=A+E/2,Y=B+s/2;return Array.from({length:48},(A,B)=>{const w=B/48*Math.PI*2,Q=Math.cos(w)*E/2,R=Math.sin(w)*s/2;return[I+C*Q-g*R,Y+g*Q+C*R]})}function RB(A,B,E,s,w=0){const Q=w*Math.PI/180,C=Math.cos(Q),g=Math.sin(Q),I=A+E/2,Y=B+s/2;return[[-E/2,-s/2],[E/2,-s/2],[E/2,s/2],[-E/2,s/2]].map(([A,B])=>[I+C*A-g*B,Y+g*A+C*B])}function MB(A,B,E){if("passage"===A.type)return[];const s=A.rlen/2,w=B>0?B/E*Y/2:2,Q=[];if("window"===A.type)Q.push([[-s,-w],[s,-w]],[[-s,w],[s,w]],[[-s,-w],[-s,w]],[[s,-w],[s,w]]);else if("gate"===A.type){const B=10*(A.flip_v?-1:1)*Math.PI/180,E=[[[-s,0],[-s+Math.cos(B)*s,Math.sin(B)*s]],[[s,0],[s-Math.cos(B)*s,Math.sin(-B)*s]]];Q.push(...E);for(const A of E){const B=A[1][0]-A[0][0],E=A[1][1]-A[0][1],s=Math.hypot(B,E)||1,C=-E/s,g=B/s,I=Math.min(.08*s,Math.max(1,.7*w));for(const s of[.3,.5,.7]){const w=A[0][0]+B*s,Y=A[0][1]+E*s;Q.push([[w-C*I,Y-g*I],[w+C*I,Y+g*I]])}}}else{const B=A.flip_v?1:-1,E=A.flip_h?s:-s,w=[E,B*A.rlen];Q.push([[E,0],w]);const C=[];for(let s=0;s<=16;s++){const w=B*s/16*Math.PI/2,Q=A.flip_h?-1:1;C.push([E+Q*Math.cos(w)*A.rlen,Math.sin(w)*A.rlen])}Q.push(C)}const C=A.angle*Math.PI/180,g=Math.cos(C),I=Math.sin(C);return Q.map(B=>B.map(([B,E])=>[A.rx+B*g-E*I,A.ry+B*I+E*g]))}function FB(A,B){const E=IB([A]);return B.filter(A=>{const B=IB([A]);return B.maxX>=E.minX&&B.minX<=E.maxX&&B.maxY>=E.minY&&B.minY<=E.maxY})}function iB(A){const B=function(A){const{rawSpace:B,space:E}=A,s=Number(B.cell_cm)>0?Number(B.cell_cm):5,w=Array.isArray(B.walls)?B.walls:[],Q=c(B,E,I,.02*Y),C=W(B,E,s,Y,I),g=m(C),M=n(E,s,Y,2e-4*Y,g).all,F=e(C,E,w,Q.contour,R,s,Y,I);return{cellCm:s,walls:w,zero:Q,openings:C,extras:M,geometry:A.sharedWallGeometry||h(E.rooms,w,Q.contour,F,R,s,Y,I,M)}}(A),E=new Map;if(A.options.dimensions)for(const s of A.space.rooms){const w=C(s);if(!w)continue;const Q=s.id?A.resolveInnerContour?.(s.id):void 0;E.set(s,s.id&&(void 0===Q?g(A.space.rooms,s.id,B.walls,B.zero.contour,R,B.cellCm,Y,I,B.geometry.roomGeom,B.geometry.multiWallNodes):Q)||w)}const s=new Map;if(A.options.dimensions)for(const w of A.space.rooms){const Q=C(w);if(!Q)continue;const g=E.get(w)||Q,I=w.id?A.resolveRoomArea?.(w.id,g):void 0,Y=Number.isFinite(I)?[]:FB(g,B.extras),R=Y.length?M(g,Y):null,i=Number.isFinite(I)&&I>=0?I:R?F(R):Math.abs(g.reduce((A,B,E)=>{const s=g[(E+1)%g.length];return A+B[0]*s[1]-s[0]*B[1]},0)/2);s.set(w,i)}const w=[..."failed-core"===B.geometry.status?A.space.rooms.map(A=>C(A)||[]).filter(A=>A.length):B.geometry.components.flatMap(A=>i(A.geom)),...B.zero.lines.map(A=>[[A[0],A[1]],[A[2],A[3]]])];A.options.decor&&w.push(...function(A){const B=[];for(const E of A.decor||[])"line"===E.kind?B.push([[E.x1*I,E.y1*I],[E.x2*I,E.y2*I]]):"text"!==E.kind?B.push(L(E).map(([A,B])=>[A*I,B*I])):B.push([[E.x*I,E.y*I]]);return B}(A.rawSpace));for(const B of A.rasters||[])w.push(RB(B.x,B.y,B.drawWidth,B.drawHeight,B.angle));let Q=IB(w);var x;[(x=Q).minX,x.minY,x.maxX,x.maxY].every(Number.isFinite)&&x.maxX>x.minX&&x.maxY>x.minY||(Q={minX:0,minY:0,maxX:I,maxY:I});return{built:B,dimensionContours:E,roomAreas:s,bounds:Q,cmPerUnit:B.cellCm/Y}}function xB(A,B,E,s){const{built:w,dimensionContours:Q,roomAreas:g,bounds:M,cmPerUnit:F}=B,c=(s?297:210)*$A,W=(s?210:297)*$A,m=12*$A,n=18*$A,e=24*$A,h=F*(10*$A)/E,j=(M.maxX-M.minX)*h,H=(M.maxY-M.minY)*h,v=m+n,V=W-v-m-e,U=c-2*m,a=A=>[0+(A[0]-M.minX)*h,0+(A[1]-M.minY)*h],P=(A,B)=>[M.minX+(A-0)/h,M.minY+(B-0)/h],y=A=>{const B=P(A.minX,A.minY),E=P(A.maxX,A.maxY);return{minX:B[0],minY:B[1],maxX:E[0],maxY:E[1]}},u=w.geometry.components.flatMap(A=>i(A.geom)),N=A=>w.geometry.components.some(B=>S([...A],B.geom)),K=A=>function(A,B,E){if(!LA(A)||!mA(B))return!0;const s=DA(A);return!!s.some(E)||!!B.some(B=>B.some(B=>xA(B)&&bA(B,A)))||nA(B,(A,B)=>s.some((E,w)=>null!==WA(A,B,E,s[(w+1)%s.length])))}(y(function(A,B){const E=Number.isFinite(B)&&B>=0?B:0;return{minX:A.minX-E,minY:A.minY-E,maxX:A.maxX+E,maxY:A.maxY+E}}(A,$A-1e-6)),u,N),d=(A,B)=>function(A,B,E){if(!LA(A)||!mA([B]))return!1;const s=DA(A);return!!s.every(E)&&!nA([B],(A,B)=>s.some((E,w)=>null!==WA(A,B,E,s[(w+1)%s.length])))}(y(A),B,A=>Z([...A],B)),J=(A,B,E={})=>function(A,B,E,s,w={}){if(!xA(A)||!xA(B)||!mA(E))return!0;if(w.allowStartExit){const w=tA(A,B);if(w<=iA)return!0;const Q=nA(E,(B,E)=>cA(A,B,E));if(!Q)return!0;const C=[];nA(E,(E,s)=>{const w=WA(A,B,E,s);return w&&C.push(w),!1});const g=iA/w,I=[0,1,...C.flatMap(A=>[A.t,A.endT])].sort((A,B)=>A-B).filter((A,B,E)=>0===B||A-E[B-1]>g),Y=E=>[A[0]+(B[0]-A[0])*E,A[1]+(B[1]-A[1])*E],R=A=>C.some(B=>B.overlap&&A>B.t+g&&AA.t>M+g||A.endT>M+g)}const Q=[(A[0]+B[0])/2,(A[1]+B[1])/2],C=nA(E,(B,E)=>cA(A,B,E));return!((!s(A)||w.allowStartBoundary&&C)&&!s(Q)&&!s(B))||nA(E,(E,s)=>{const Q=WA(A,B,E,s);return!!Q&&(Q.overlap||!w.allowStartBoundary||!C||Q.t*tA(A,B)>iA)})}(P(A[0],A[1]),P(B[0],B[1]),u,N,E),T=(A,B,E)=>{const s=A.x*I,w=A.y*I,Q=A.w*I,C=A.h*I,g=s+Q/2,Y=w+C/2,R=s+(A.flip_h?Q:0),F=w+(A.flip_v?C:0),i=(A.flip_h?-1:1)*Q/B,x=(A.flip_v?-1:1)*C/E,b=(Number(A.angle)||0)*Math.PI/180,L=Math.cos(b),D=Math.sin(b),G=Y+D*(R-g)+L*(F-Y);return{a:h*L*i,b:h*D*i,c:-h*D*x,d:h*L*x,e:0+(g+L*(R-g)-D*(F-Y)-M.minX)*h,f:0+(G-M.minY)*h}};let f=[];const z=[],O=function(A,B){const E=3*$A*Math.SQRT2,s=[];for(let w=-B;w<=A+E;w+=E)s.push([[w,0],[w+B,B]]);return s}(c,W);for(const B of A.rasters||[])f.push({kind:"image",imageId:B.id,...a([B.x,B.y]).reduce((A,B,E)=>({...A,[E?"y":"x"]:B}),{}),width:B.drawWidth*h,height:B.drawHeight*h,angle:B.angle,opacity:B.opacity});for(const A of w.geometry.components)f.push({kind:"path",rings:i(A.geom).map(A=>A.map(a)),fill:BB,stroke:AB,width:.25*$A,hatch:{lines:O,stroke:AB,width:.18*$A}});if("failed-core"===w.geometry.status)for(const B of A.space.rooms){const A=C(B);A&&f.push({kind:"path",rings:[A.map(a)],stroke:AB,width:.25*$A})}for(const A of w.zero.lines)f.push({kind:"line",points:[a([A[0],A[1]]),a([A[2],A[3]])],stroke:AB,width:.35*$A,dash:[3*$A,2*$A]});const q=w.geometry.openingIndex;for(const B of w.openings){const E=B.partitionHost?{cm:B.partitionHost.partition.cm}:q?x(A.space.rooms,B,w.walls,R,w.cellCm,Y,I,w.zero.contour):{cm:0};for(const A of MB(B,E.cm,w.cellCm))f.push({kind:"line",points:A.map(a),stroke:AB,width:.3*$A})}if(A.options.decor)for(const B of A.rawSpace.decor||[])if("image"!==B.kind)if("line"===B.kind)f.push({kind:"line",points:[a([B.x1*I,B.y1*I]),a([B.x2*I,B.y2*I])],stroke:AB,width:Math.max(.2*$A,10*Number(B.width_cm||1)*$A/E),dash:"dashed"===B.line_style?[3*$A,2*$A]:void 0});else if("text"===B.kind)f.push({kind:"text",...(()=>{const[A,E]=a([B.x*I,B.y*I]);return{x:A,y:E}})(),text:B.text,size:Math.max(6,10*Number(B.size_cm||20)*$A/E),angle:Number(B.angle)||0});else if("furniture"===B.kind){const A=r[B.symbol];A?f.push({kind:"vector",ops:YA(A.d,T(B,A.viewW,A.viewH)),stroke:AB,width:Math.max(.2*$A,10*b(B,w.cellCm,Y)*$A/E)}):f.push({kind:"path",rings:[L(B).map(([A,B])=>a([A*I,B*I]))],stroke:AB,width:.25*$A})}else{const A="ellipse"===B.kind?YB(B.x*I,B.y*I,B.w*I,B.h*I,Number(B.angle)||0):L(B).map(([A,B])=>[A*I,B*I]);f.push({kind:"path",rings:[A.map(a)],stroke:AB,width:.25*$A})}if(A.options.dimensions&&w.geometry.roomGeom)for(const[B,E]of D(w.geometry.roomGeom).entries()){const s=l(F),w=(A,B,E)=>{const s=a(A.sourceA),w=a(A.sourceB),Q=a(A.a),C=a(A.b),g=(6+E)*$A,I=[Q[0]+B[0]*g,Q[1]+B[1]*g],Y=[C[0]+B[0]*g,C[1]+B[1]*g],R=[(I[0]+Y[0])/2,(I[1]+Y[1])/2],M=PA(A.text,7)+2*$A>Math.hypot(Y[0]-I[0],Y[1]-I[1]),F=QB(wB(R[0],R[1],A.text,7,A.angle,"center"),R[0],R[1],B,$A),i=[R[0]+B[0]*F,R[1]+B[1]*F];return{edge:A,a:s,b:w,oa:I,ob:Y,middle:R,label:i,box:wB(i[0],i[1],A.text,7,A.angle,"center"),needsShelf:M}},Q=A=>{const B=[{start:A.oa,end:A.ob},{start:A.a,end:A.oa,allowStartExit:!0},{start:A.b,end:A.ob,allowStartExit:!0}];return A.needsShelf&&B.push({start:A.middle,end:A.label,mayEnterOwnLabel:!0}),B},C=A=>K(A.box)||Q(A).some(A=>J(A.start,A.end,{allowStartBoundary:A.allowStartBoundary,allowStartExit:A.allowStartExit})),g=EA(k(E,F,A.imperial,{ringIndex:B,epsilon:s}),{ring:E,epsilon:s,score:A=>{const B=[-A.inwardNormal[0],-A.inwardNormal[1]],E=a(A.mid),s=Array.from({length:21},(A,B)=>4*B).find(E=>!C(w(A,B,E))),Q=E[0]+(U-j)/2,g=E[1]+(V-H)/2;return{hardCollisions:void 0===s?21:s/4,normalClearance:Math.abs(B[0])>.5?B[0]>0?U-Q:Q:B[1]>0?V-g:g}}});for(const A of X(g,s)){const B=A.map(A=>({edge:A,outward:[-A.inwardNormal[0],-A.inwardNormal[1]]})),E=A=>B.map(({edge:B,outward:E})=>w(B,E,A));let s=null;for(let A=0;A<=80&&!s;A+=4){const B=E(A),w=B.some((A,E)=>B.slice(0,E).some(B=>sB(A.box,B.box))),g=B.some(A=>C(A)||z.some(B=>sB(A.box,B))),I=B.some((A,E)=>Q(A).some(A=>z.some(B=>eA(A.start,A.end,B))||B.some((B,s)=>(!A.mayEnterOwnLabel||s!==E)&&eA(A.start,A.end,B.box))));w||g||I||(s=B)}if(s)for(const A of s)f.push({kind:"line",points:[A.oa,A.ob],stroke:AB,width:.2*$A},{kind:"line",points:[A.a,A.oa],stroke:AB,width:.15*$A},{kind:"line",points:[A.b,A.ob],stroke:AB,width:.15*$A}),A.needsShelf&&f.push({kind:"line",points:[A.middle,A.label],stroke:AB,width:.15*$A}),f.push({kind:"text",x:A.label[0],y:A.label[1],text:A.edge.text,size:_A,angle:A.edge.angle,align:"center"}),z.push(A.box)}}const $=[...A.space.rooms].sort((A,B)=>String(A.id||"").localeCompare(String(B.id||"")));for(const[B,E]of $.entries()){const s=C(E);if(!s)continue;const w=Q.get(E)||s,I=g.get(E)||0,Y=G(E,A.space.id,A.layout,A.config),[R,M]=a([Y.x,Y.y]),i=w.map(a),x=IB([i]);let b=!1;if(A.options.roomNames&&E.name){const A=Math.max(0,x.maxX-x.minX-4*$A),B=PA(E.name,6.75)<=A?6.75:PA(E.name,5.25)<=A?5.25:0;B&&(f.push({kind:"text",x:R,y:M-2,text:E.name,size:B,align:"center"}),z.push(wB(R,M-2,E.name,B,0,"center")),b=!0)}if(A.options.dimensions){const B=o(I*F*F/1e4,A.imperial),E=M+(b?8:0);f.push({kind:"text",x:R,y:E,text:B,size:6,align:"center"}),z.push(wB(R,E,B,8,0,"center"))}if(A.options.dimensions){const E=l(F),s=EA(p(w,F,A.imperial,{ringIndex:B,epsilon:E}),{ring:w,epsilon:E,score:A=>{const B=a(A.mid),E=QB(wB(B[0],B[1],A.text,_A,A.angle,"center"),B[0],B[1],A.inwardNormal,$A),s=wB(B[0]+A.inwardNormal[0]*E,B[1]+A.inwardNormal[1]*E,A.text,7,A.angle,"center"),w="horizontal"===A.axis?A.inwardNormal[1]>0?x.maxY-B[1]:B[1]-x.minY:A.inwardNormal[0]>0?x.maxX-B[0]:B[0]-x.minX;return{hardCollisions:Number(K(s))+z.reduce((A,B)=>A+Number(sB(s,B)),0),normalClearance:w}}});for(const A of s.filter(A=>A.short)){const B=A.inwardNormal,E=a(A.a),s=a(A.b),w=(E[0]+s[0])/2,Q=(E[1]+s[1])/2;f.push({kind:"line",points:[[w-1.5*B[0]*$A,Q-1.5*B[1]*$A],[w+1.5*B[0]*$A,Q+1.5*B[1]*$A]],stroke:AB,width:.2*$A})}const Q=new Map;for(const A of s.filter(A=>!A.short)){const B=CB(A,A.inwardNormal),E=Q.get(B)||[];E.push(A),Q.set(B,E)}for(const A of Q.values()){let B=null;for(let E=0;E<=30&&!B;E+=3){const s=A.map(A=>{const B=a(A.mid),s=QB(wB(B[0],B[1],A.text,_A,A.angle,"center"),B[0],B[1],A.inwardNormal,(1+E)*$A),w=B[0]+A.inwardNormal[0]*s,Q=B[1]+A.inwardNormal[1]*s;return{edge:A,x:w,y:Q,box:wB(w,Q,A.text,_A,A.angle,"center")}}),Q=s.some((A,B)=>s.slice(0,B).some(B=>sB(A.box,B.box))),C=s.some(A=>K(A.box)||z.some(B=>sB(A.box,B))),g=s.every(A=>d(A.box,w));Q||C||!g||(B=s)}if(B)for(const A of B)f.push({kind:"text",x:A.x,y:A.y,text:A.edge.text,size:_A,angle:A.edge.angle,align:"center"}),z.push(A.box)}}}const _={minX:m,minY:v,maxX:c-m,maxY:v+V},AA=XA(f),BA=OA(AA,{minX:0,minY:0,maxX:U,maxY:V},.5*$A),sA=function(A,B){const E=XA(A);if(!ZA(E))return{commands:[...A],bounds:E,dx:0,dy:0};const s=(B.minX+B.maxX-E.minX-E.maxX)/2,w=(B.minY+B.maxY-E.minY-E.maxY)/2,Q=function(A,B,E){return A.map(A=>"path"===A.kind?{...A,rings:A.rings.map(A=>A.map(([A,s])=>[A+B,s+E]))}:"line"===A.kind?{...A,points:A.points.map(([A,s])=>[A+B,s+E])}:"vector"===A.kind?{...A,ops:A.ops.map(A=>((A,B,E)=>"M"===A.op||"L"===A.op?{...A,x:A.x+B,y:A.y+E}:"C"===A.op?{...A,x1:A.x1+B,y1:A.y1+E,x2:A.x2+B,y2:A.y2+E,x:A.x+B,y:A.y+E}:A)(A,B,E))}:{...A,x:A.x+B,y:A.y+E})}(A,s,w);return{commands:Q,bounds:{minX:E.minX+s,minY:E.minY+w,maxX:E.maxX+s,maxY:E.maxY+w},dx:s,dy:w}}(f,_);f=sA.commands,f.push({kind:"text",x:m,y:m+10,text:A.space.title,size:14}),A.cardTitle&&f.push({kind:"text",x:c-m,y:m+10,text:A.cardTitle,size:10,align:"right"});const wA=W-m-13*$A;f.push({kind:"line",points:[[m,wA-4*$A],[c-m,wA-4*$A]],stroke:EB,width:.2*$A}),f.push({kind:"text",x:m,y:wA,text:A.t("pdf.scale",{n:E}),size:8});const QA=10*(A.imperial?152.4:100)*$A/E,CA=wA+8;f.push({kind:"line",points:[[m,CA],[m+QA,CA]],stroke:AB,width:.4*$A});for(let A=0;A<=4;A++){const B=m+QA*A/4;f.push({kind:"line",points:[[B,CA-2],[B,CA+2]],stroke:AB,width:.25*$A})}f.push({kind:"text",x:m+QA/2,y:wA+17,text:A.imperial?"5 ft":"1 m",size:7,align:"center"});const gA=t(A.config.settings,A.rawSpace.settings||{});if(null!==gA){const B=c/2,E=wA+5.5*$A;f.push({kind:"vector",ops:FA({centerX:B,centerY:E,size:11*$A,northDeg:gA}),fill:AB,width:0,fillRule:"evenodd"}),f.push({kind:"text",x:B,y:wA,text:A.t("pdf.north"),size:7,align:"center"})}f.push({kind:"text",x:c-m,y:wA+12,text:`${qA(A.now)} · House Plan v${A.version}`,size:7,align:"right"});const IA={width:c,height:W,commands:f,images:(A.rasters||[]).map(({id:A,bytes:B,width:E,height:s})=>({id:A,bytes:B,width:E,height:s})),now:A.now,scale:E,sceneBounds:sA.bounds,planField:_},RA=Math.max(0,TA(AA))*Math.max(0,fA(AA)),MA=U*V;return{page:IA,sceneBounds:sA.bounds,field:_,fits:BA,fillRatio:MA>0?RA/MA:0,landscape:s}}function bB(A,B){return A.fillRatio!==B.fillRatio?A.fillRatio>B.fillRatio?A:B:A.landscape?B:A}function LB(A,B,E){const s=12*$A,w=(E?297:210)*$A-2*s,Q=(E?210:297)*$A-2*s-18*$A-24*$A,C=A.cmPerUnit*(10*$A)/B;return(A.bounds.maxX-A.bounds.minX)*C<=w+.5*$A&&(A.bounds.maxY-A.bounds.minY)*C<=Q+.5*$A}function DB(A){let B=0;for(const E of A)if(B+=Math.max(0,Number(E)||0),B>26214400)throw new Error("pdf.too_large")}const GB="b468bec31a4d35a4630025ee2489e4187921a21b8f95e5abaaaace1921cfa3d8";async function oB(A,B){if(!A)throw new Error("pdf.asset_failed");const E=await fetch(A,{credentials:"same-origin"});if(!E.ok)throw new Error("pdf.asset_failed");const s=await E.blob();let w;try{w=await createImageBitmap(s)}catch{throw new Error("pdf.asset_failed")}try{if("image/jpeg"===s.type)return{id:B,bytes:new Uint8Array(await s.arrayBuffer()),width:w.width,height:w.height};const A=document.createElement("canvas");A.width=w.width,A.height=w.height;const E=A.getContext("2d");if(!E)throw new Error("pdf.asset_failed");E.fillStyle="#fff",E.fillRect(0,0,A.width,A.height),E.drawImage(w,0,0);const Q=await new Promise(B=>A.toBlob(B,"image/jpeg",.85));if(!Q)throw new Error("pdf.asset_failed");return{id:B,bytes:new Uint8Array(await Q.arrayBuffer()),width:w.width,height:w.height}}finally{w.close()}}async function tB(A,B,E){const s=await async function(A,B){const E=[];if(B.backdrop&&A.space.bg){const B=await oB(A.backdropUrl,"backdrop");E.push({...B,x:A.space.bg.x,y:A.space.bg.y,drawWidth:A.space.bg.w,drawHeight:A.space.bg.h,angle:A.space.bg.angle,opacity:.6})}if(B.decor){let B=0;for(const s of A.rawSpace.decor||[]){if("image"!==s.kind)continue;const w=A.decorAssets.get(s.asset_id),Q=j(s,I,I);if(!w||!Q)throw new Error("pdf.asset_failed");const C=await oB(w.url,"decor"+B++);E.push({...C,x:Q[0],y:Q[1],drawWidth:Q[2],drawHeight:Q[3],opacity:Q[4],angle:Number(s.angle)||0})}}return DB(E.map(A=>A.bytes.byteLength)),E}(A,B),w=JA(function(A){const B=iB(A);let E=[];for(const s of wA){const w=[!1,!0].filter(A=>LB(B,s,A)).map(E=>xB(A,B,s,E));if(!w.length)continue;const Q=w.filter(A=>A.fits);if(Q.length)return Q.reduce(bB).page;E=w}E.length||(E=[!1,!0].map(E=>xB(A,B,500,E)));const s=E.filter(A=>A.fits);if(s.length)return s.reduce(bB).page;const w=Math.min(...E.map(A=>Math.max(TA(A.sceneBounds)/TA(A.field),fA(A.sceneBounds)/fA(A.field)))),Q=50,C=1e6,g=Number.isFinite(w)?Math.ceil(Math.min(C,500*Math.max(1,w))/Q)*Q:C;let I=500,Y=0,R=[],M=Math.max(550,g);for(;M<=C;){const E=[!1,!0].map(E=>xB(A,B,M,E)).filter(A=>A.fits);if(E.length){Y=M,R=E;break}if(I=M,M===C)break;M=Math.min(C,Math.ceil(2*M/Q)*Q)}if(!Y)throw new Error("pdf.failed");let F=Math.floor(I/Q),i=Math.floor(Y/Q);for(;i-F>1;){const E=Math.floor((F+i)/2),s=[!1,!0].map(s=>xB(A,B,E*Q,s)).filter(A=>A.fits);s.length?(i=E,R=s):F=E}const x=R.reduce(bB).page;if(!OA(x.sceneBounds,x.planField,.5*$A))throw new Error("pdf.failed");return x}({...A,options:B,now:E,rasters:s,t:A.t})),Q=new Blob([w],{type:"application/pdf"}),C=URL.createObjectURL(Q);try{const B=document.createElement("a");B.href=C,B.download=`houseplan-${g=A.space.title,g.normalize("NFKD").replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-|-$/g,"").toLowerCase()||"space"}-${qA(E)}.pdf`,B.style.display="none",document.body.append(B),B.click(),B.remove()}finally{setTimeout(()=>URL.revokeObjectURL(C),0)}var g;return w}class cB{assertRasterBudget(A){DB(A)}render(A){let B;return B={...A,save:async E=>{await tB(A,E,B.now||new Date)}},s``}}export{GB as PDF_EXPORT_FINGERPRINT,cB as PdfExportRuntime,tB as exportSpacePdf}; diff --git a/dist/houseplan-assets/summary-panel-editor-CC7xfAHi.js b/custom_components/houseplan/frontend/houseplan-assets/summary-panel-editor-BjygV2yH.js similarity index 97% rename from dist/houseplan-assets/summary-panel-editor-CC7xfAHi.js rename to custom_components/houseplan/frontend/houseplan-assets/summary-panel-editor-BjygV2yH.js index 4e86a89b..d8a61913 100644 --- a/dist/houseplan-assets/summary-panel-editor-CC7xfAHi.js +++ b/custom_components/houseplan/frontend/houseplan-assets/summary-panel-editor-BjygV2yH.js @@ -1,4 +1,4 @@ -globalThis.__HOUSEPLAN_BUILD_FINGERPRINT__="271e0747b4ddef1af0d15d8bf63a832d72b0f7211550c349a59b3baa3864a84e";import{c as a,A as e}from"./houseplan-card-BMVLvcks.js";import{s,n as t,a as l,m as r,b as o,c as i,d as u}from"./summary-panel-runtime-loaded-g1LT0Cej.js";const m=m=>{const{host:c,dialog:d,problems:n,t:b}=m,y=n.find(a=>"error"===a.kind),$=d.localShow!==d.baseLocalShow||!d.localOnly&&!s(t(d.draft),d.base),p=$&&!d.busy&&!y,v=a=>n.find(e=>e.path===a),h=a=>a?b(`summary.problem.${a.code}`):"",k=()=>m.close(),g=a`