@threekit-tools/treble 0.0.92 → 0.0.93

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (282) hide show
  1. package/dist/Treble/Treble.d.ts +1 -1
  2. package/dist/Treble/Treble.js +4 -3
  3. package/dist/Treble/snapshots.d.ts +2 -2
  4. package/dist/Treble/snapshots.js +1 -1
  5. package/dist/Treble/wishlist.d.ts +1 -1
  6. package/dist/Treble/wishlist.js +1 -1
  7. package/dist/api/assets.d.ts +1 -0
  8. package/dist/api/{products.js → assets.js} +12 -33
  9. package/dist/api/catalog.js +1 -1
  10. package/dist/api/configurations.d.ts +1 -0
  11. package/dist/api/configurations.js +10 -3
  12. package/dist/api/datatables.js +1 -1
  13. package/dist/api/index.d.ts +2 -2
  14. package/dist/api/index.js +2 -2
  15. package/dist/api/orders.js +1 -1
  16. package/dist/api/price.js +1 -1
  17. package/dist/components/AttributeTitle/index.d.ts +2 -2
  18. package/dist/components/AttributeValue/index.d.ts +2 -2
  19. package/dist/components/BreatheAnimation/index.js +1 -1
  20. package/dist/components/Button/index.d.ts +3 -3
  21. package/dist/components/Cards/index.d.ts +3 -3
  22. package/dist/components/DevTools/index.d.ts +2 -2
  23. package/dist/components/DraggableHint/draggableIndicator.styles.d.ts +1 -1
  24. package/dist/components/DraggableHint/index.d.ts +2 -2
  25. package/dist/components/Dropdown/index.d.ts +3 -3
  26. package/dist/components/FlatForm/index.d.ts +2 -2
  27. package/dist/components/FormComponentDescription/index.d.ts +1 -1
  28. package/dist/components/FormComponentTitle/index.d.ts +1 -1
  29. package/dist/components/Player/index.d.ts +9 -9
  30. package/dist/components/PlayerLoadingCircular/index.d.ts +2 -2
  31. package/dist/components/PlayerLoadingSpinner/index.d.ts +2 -2
  32. package/dist/components/PlayerLoadingSpinner/playerLoadingSpinner.styles.d.ts +1 -1
  33. package/dist/components/ProductDescription/index.d.ts +3 -3
  34. package/dist/components/ProductName/index.d.ts +3 -3
  35. package/dist/components/Share/index.d.ts +2 -2
  36. package/dist/components/Share/index.js +1 -1
  37. package/dist/components/Share/share.styles.d.ts +1 -1
  38. package/dist/components/Snapshots/index.d.ts +2 -2
  39. package/dist/components/Strips/index.d.ts +3 -3
  40. package/dist/components/Swatch/index.d.ts +3 -3
  41. package/dist/components/Switch/index.d.ts +3 -3
  42. package/dist/components/TextInput/index.d.ts +3 -3
  43. package/dist/components/ThreekitProvider/index.d.ts +6 -3
  44. package/dist/components/ThreekitProvider/index.js +27 -2
  45. package/dist/components/Tiles/index.d.ts +3 -3
  46. package/dist/components/TilesGroup/index.d.ts +3 -3
  47. package/dist/components/TotalPrice/index.d.ts +3 -3
  48. package/dist/components/TrebleApp/index.d.ts +3 -3
  49. package/dist/components/TurntableAnimation/index.js +1 -1
  50. package/dist/components/Upload/index.d.ts +3 -3
  51. package/dist/components/Upload/index.js +1 -1
  52. package/dist/components/UploadArea/index.d.ts +3 -3
  53. package/dist/components/UploadArea/index.js +1 -1
  54. package/dist/components/Wishlist/WishlistItem.d.ts +2 -2
  55. package/dist/components/Wishlist/index.d.ts +4 -4
  56. package/dist/components/Wishlist/index.js +1 -1
  57. package/dist/components/Zoom/index.d.ts +6 -6
  58. package/dist/components/containers/formInputContainer.d.ts +2 -2
  59. package/dist/components/formComponents.d.ts +6 -6
  60. package/dist/components/message/index.d.ts +1 -1
  61. package/dist/constants.d.ts +6 -6
  62. package/dist/hooks/useAttribute/index.d.ts +4 -4
  63. package/dist/hooks/useAttribute/index.js +3 -3
  64. package/dist/hooks/useConfigurationLoader/index.js +1 -1
  65. package/dist/hooks/useConfigurator/index.d.ts +3 -3
  66. package/dist/hooks/useConfigurator/index.js +3 -5
  67. package/dist/hooks/useDevTools/index.d.ts +1 -1
  68. package/dist/hooks/useNestedConfigurator/index.d.ts +2 -2
  69. package/dist/hooks/useNestedConfigurator/index.js +3 -3
  70. package/dist/hooks/usePlayer/index.d.ts +1 -1
  71. package/dist/hooks/usePlayerPortal/index.d.ts +1 -1
  72. package/dist/hooks/useProductCache/index.js +1 -1
  73. package/dist/hooks/useResetProduct/index.d.ts +1 -1
  74. package/dist/hooks/useResetProduct/index.js +1 -1
  75. package/dist/hooks/useRoomBuilder/RoomBuilderState.js +1 -1
  76. package/dist/hooks/useRoomBuilder/constants.js +2 -2
  77. package/dist/hooks/useRoomBuilder/themes.js +1 -1
  78. package/dist/hooks/useRoomBuilder/types.d.ts +7 -7
  79. package/dist/hooks/useRoomBuilder/types.js +5 -5
  80. package/dist/hooks/useRoomBuilder/validators.d.ts +1 -1
  81. package/dist/hooks/useShare/index.d.ts +1 -1
  82. package/dist/hooks/useShare/index.js +4 -2
  83. package/dist/hooks/useSingleAnimation/index.js +1 -1
  84. package/dist/hooks/useSnapshot/index.d.ts +1 -1
  85. package/dist/hooks/useWishlist/index.d.ts +1 -1
  86. package/dist/hooks/useZoom/index.d.ts +1 -1
  87. package/dist/http/assets.d.ts +2 -0
  88. package/dist/http/assets.js +16 -0
  89. package/dist/http/index.d.ts +2 -2
  90. package/dist/http/index.js +2 -2
  91. package/dist/http/orders.d.ts +1 -1
  92. package/dist/icons/Spinner.d.ts +2 -2
  93. package/dist/icons/types.d.ts +1 -1
  94. package/dist/store/attributes.d.ts +4 -4
  95. package/dist/store/attributes.js +2 -4
  96. package/dist/store/index.d.ts +6 -6
  97. package/dist/store/price.d.ts +1 -1
  98. package/dist/store/price.js +1 -1
  99. package/dist/store/product.d.ts +2 -2
  100. package/dist/store/product.js +1 -1
  101. package/dist/store/translations.d.ts +10 -8
  102. package/dist/store/translations.js +39 -19
  103. package/dist/store/treble.d.ts +1 -1
  104. package/dist/store/treble.js +1 -1
  105. package/dist/store/wishlist.d.ts +2 -2
  106. package/dist/store/wishlist.js +1 -1
  107. package/dist/types.d.ts +18 -17
  108. package/dist/types.js +9 -9
  109. package/dist/utils.d.ts +2 -6
  110. package/dist/utils.js +5 -12
  111. package/package.json +1 -2
  112. package/dist/Treble/snapshot.d.ts +0 -22
  113. package/dist/Treble/snapshot.js +0 -247
  114. package/dist/api/products.d.ts +0 -4
  115. package/dist/hooks/useSpaces/SpacesLayout.d.ts +0 -11
  116. package/dist/hooks/useSpaces/SpacesLayout.js +0 -74
  117. package/dist/hooks/useSpaces/SpacesState.d.ts +0 -164
  118. package/dist/hooks/useSpaces/SpacesState.js +0 -1751
  119. package/dist/hooks/useSpaces/constants.d.ts +0 -64
  120. package/dist/hooks/useSpaces/constants.js +0 -109
  121. package/dist/hooks/useSpaces/dataHandlers.d.ts +0 -20
  122. package/dist/hooks/useSpaces/dataHandlers.js +0 -254
  123. package/dist/hooks/useSpaces/draw/clearCanvas.d.ts +0 -2
  124. package/dist/hooks/useSpaces/draw/clearCanvas.js +0 -9
  125. package/dist/hooks/useSpaces/draw/drawBackground.d.ts +0 -2
  126. package/dist/hooks/useSpaces/draw/drawBackground.js +0 -12
  127. package/dist/hooks/useSpaces/draw/drawDimensions.d.ts +0 -3
  128. package/dist/hooks/useSpaces/draw/drawDimensions.js +0 -53
  129. package/dist/hooks/useSpaces/draw/drawDoors.d.ts +0 -9
  130. package/dist/hooks/useSpaces/draw/drawDoors.js +0 -99
  131. package/dist/hooks/useSpaces/draw/drawFloor.d.ts +0 -3
  132. package/dist/hooks/useSpaces/draw/drawFloor.js +0 -36
  133. package/dist/hooks/useSpaces/draw/drawGrid.d.ts +0 -3
  134. package/dist/hooks/useSpaces/draw/drawGrid.js +0 -33
  135. package/dist/hooks/useSpaces/draw/drawGuides.d.ts +0 -3
  136. package/dist/hooks/useSpaces/draw/drawGuides.js +0 -23
  137. package/dist/hooks/useSpaces/draw/drawOpenings.d.ts +0 -9
  138. package/dist/hooks/useSpaces/draw/drawOpenings.js +0 -72
  139. package/dist/hooks/useSpaces/draw/drawVertices.d.ts +0 -8
  140. package/dist/hooks/useSpaces/draw/drawVertices.js +0 -61
  141. package/dist/hooks/useSpaces/draw/drawWalls.d.ts +0 -10
  142. package/dist/hooks/useSpaces/draw/drawWalls.js +0 -88
  143. package/dist/hooks/useSpaces/draw/drawWindows.d.ts +0 -9
  144. package/dist/hooks/useSpaces/draw/drawWindows.js +0 -82
  145. package/dist/hooks/useSpaces/draw/index.d.ts +0 -11
  146. package/dist/hooks/useSpaces/draw/index.js +0 -129
  147. package/dist/hooks/useSpaces/geometry/addThicknessToLine.d.ts +0 -3
  148. package/dist/hooks/useSpaces/geometry/addThicknessToLine.js +0 -13
  149. package/dist/hooks/useSpaces/geometry/areLinesEqual.d.ts +0 -3
  150. package/dist/hooks/useSpaces/geometry/areLinesEqual.js +0 -17
  151. package/dist/hooks/useSpaces/geometry/arePointsEqual.d.ts +0 -3
  152. package/dist/hooks/useSpaces/geometry/arePointsEqual.js +0 -8
  153. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.d.ts +0 -3
  154. package/dist/hooks/useSpaces/geometry/arePointsWithinProximity.js +0 -11
  155. package/dist/hooks/useSpaces/geometry/closestPointOnLine.d.ts +0 -3
  156. package/dist/hooks/useSpaces/geometry/closestPointOnLine.js +0 -13
  157. package/dist/hooks/useSpaces/geometry/doLinesOverlap.d.ts +0 -2
  158. package/dist/hooks/useSpaces/geometry/doLinesOverlap.js +0 -16
  159. package/dist/hooks/useSpaces/geometry/euclideanMod.d.ts +0 -2
  160. package/dist/hooks/useSpaces/geometry/euclideanMod.js +0 -6
  161. package/dist/hooks/useSpaces/geometry/findLoops.d.ts +0 -6
  162. package/dist/hooks/useSpaces/geometry/findLoops.js +0 -117
  163. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.d.ts +0 -6
  164. package/dist/hooks/useSpaces/geometry/getAllLineIntersections.js +0 -23
  165. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.d.ts +0 -3
  166. package/dist/hooks/useSpaces/geometry/getAngleOfLineSegment.js +0 -7
  167. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.d.ts +0 -3
  168. package/dist/hooks/useSpaces/geometry/getClosestPointOnLineSegment.js +0 -17
  169. package/dist/hooks/useSpaces/geometry/getDistanceToLine.d.ts +0 -3
  170. package/dist/hooks/useSpaces/geometry/getDistanceToLine.js +0 -10
  171. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.d.ts +0 -3
  172. package/dist/hooks/useSpaces/geometry/getLengthOfLineSegment.js +0 -7
  173. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.d.ts +0 -3
  174. package/dist/hooks/useSpaces/geometry/getLineAtOffsetOnLineSegment.js +0 -17
  175. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.d.ts +0 -3
  176. package/dist/hooks/useSpaces/geometry/getLineOtherPoint.js +0 -11
  177. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.d.ts +0 -3
  178. package/dist/hooks/useSpaces/geometry/getLineSegmentsIntersection.js +0 -43
  179. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.d.ts +0 -3
  180. package/dist/hooks/useSpaces/geometry/getMidpointOfLineSegment.js +0 -9
  181. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.d.ts +0 -3
  182. package/dist/hooks/useSpaces/geometry/getParallelLineSegmentAtDistance.js +0 -20
  183. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.d.ts +0 -3
  184. package/dist/hooks/useSpaces/geometry/getPointAtOffsetOnLineSegment.js +0 -11
  185. package/dist/hooks/useSpaces/geometry/getPolygonArea.d.ts +0 -3
  186. package/dist/hooks/useSpaces/geometry/getPolygonArea.js +0 -15
  187. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.d.ts +0 -3
  188. package/dist/hooks/useSpaces/geometry/getQuadrilateralArea.js +0 -16
  189. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.d.ts +0 -6
  190. package/dist/hooks/useSpaces/geometry/getTangetIntersectionAndOffset.js +0 -17
  191. package/dist/hooks/useSpaces/geometry/getTriangleArea.d.ts +0 -3
  192. package/dist/hooks/useSpaces/geometry/getTriangleArea.js +0 -9
  193. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.d.ts +0 -3
  194. package/dist/hooks/useSpaces/geometry/getUnitVectorOfLineSegment.js +0 -12
  195. package/dist/hooks/useSpaces/geometry/index.d.ts +0 -30
  196. package/dist/hooks/useSpaces/geometry/index.js +0 -64
  197. package/dist/hooks/useSpaces/geometry/isPointInPolygon.d.ts +0 -3
  198. package/dist/hooks/useSpaces/geometry/isPointInPolygon.js +0 -21
  199. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.d.ts +0 -3
  200. package/dist/hooks/useSpaces/geometry/isPointInQuadrilateral.js +0 -25
  201. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.d.ts +0 -3
  202. package/dist/hooks/useSpaces/geometry/orderCoordinatesOnLineSegment.js +0 -11
  203. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.d.ts +0 -3
  204. package/dist/hooks/useSpaces/geometry/splitLineAtOffset.js +0 -12
  205. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.d.ts +0 -3
  206. package/dist/hooks/useSpaces/geometry/splitLineAtPoint.js +0 -9
  207. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.d.ts +0 -3
  208. package/dist/hooks/useSpaces/geometry/splitLineAtPoints.js +0 -28
  209. package/dist/hooks/useSpaces/index.d.ts +0 -82
  210. package/dist/hooks/useSpaces/index.js +0 -482
  211. package/dist/hooks/useSpaces/themes/blueprint.d.ts +0 -3
  212. package/dist/hooks/useSpaces/themes/blueprint.js +0 -96
  213. package/dist/hooks/useSpaces/themes/default.d.ts +0 -3
  214. package/dist/hooks/useSpaces/themes/default.js +0 -96
  215. package/dist/hooks/useSpaces/themes/index.d.ts +0 -11
  216. package/dist/hooks/useSpaces/themes/index.js +0 -21
  217. package/dist/hooks/useSpaces/themes/light.d.ts +0 -3
  218. package/dist/hooks/useSpaces/themes/light.js +0 -96
  219. package/dist/hooks/useSpaces/types.d.ts +0 -339
  220. package/dist/hooks/useSpaces/types.js +0 -54
  221. package/dist/hooks/useSpaces/validators/areWallsDuplicated.d.ts +0 -3
  222. package/dist/hooks/useSpaces/validators/areWallsDuplicated.js +0 -61
  223. package/dist/hooks/useSpaces/validators/areWallsIntersecting.d.ts +0 -3
  224. package/dist/hooks/useSpaces/validators/areWallsIntersecting.js +0 -42
  225. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.d.ts +0 -3
  226. package/dist/hooks/useSpaces/validators/areWallsOrphaningFeatures.js +0 -52
  227. package/dist/hooks/useSpaces/validators/areWallsTooShort.d.ts +0 -3
  228. package/dist/hooks/useSpaces/validators/areWallsTooShort.js +0 -37
  229. package/dist/hooks/useSpaces/validators/index.d.ts +0 -15
  230. package/dist/hooks/useSpaces/validators/index.js +0 -40
  231. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.d.ts +0 -3
  232. package/dist/hooks/useSpaces/validators/isFeatureCollidingWithExistingFeature.js +0 -31
  233. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.d.ts +0 -3
  234. package/dist/hooks/useSpaces/validators/isFeatureOutsideWallBounds.js +0 -19
  235. package/dist/hooks/useSpaces/validators/isLineTooShort.d.ts +0 -3
  236. package/dist/hooks/useSpaces/validators/isLineTooShort.js +0 -26
  237. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.d.ts +0 -4
  238. package/dist/hooks/useSpaces/validators/isVertexLandingOnFeature.js +0 -19
  239. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.d.ts +0 -3
  240. package/dist/hooks/useSpaces/validators/isWallEndingOnFeature.js +0 -19
  241. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.d.ts +0 -3
  242. package/dist/hooks/useSpaces/validators/isWallIntersectingFeature.js +0 -41
  243. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.d.ts +0 -3
  244. package/dist/hooks/useSpaces/validators/isWallOverlappingExisitingWalls.js +0 -54
  245. package/dist/hooks/useSpaces/validators/isWallTooShort.d.ts +0 -3
  246. package/dist/hooks/useSpaces/validators/isWallTooShort.js +0 -10
  247. package/dist/hooks/useSpaces/validators/messaging.d.ts +0 -8
  248. package/dist/hooks/useSpaces/validators/messaging.js +0 -18
  249. package/dist/http/products.d.ts +0 -1
  250. package/dist/http/products.js +0 -12
  251. package/dist/icons/AngleSnapping.d.ts +0 -3
  252. package/dist/icons/AngleSnapping.js +0 -28
  253. package/dist/icons/Center.d.ts +0 -3
  254. package/dist/icons/Center.js +0 -24
  255. package/dist/icons/GridSnapping.d.ts +0 -3
  256. package/dist/icons/GridSnapping.js +0 -28
  257. package/dist/icons/LayoutAlt.d.ts +0 -3
  258. package/dist/icons/LayoutAlt.js +0 -21
  259. package/dist/icons/Magnet.d.ts +0 -3
  260. package/dist/icons/Magnet.js +0 -27
  261. package/dist/icons/Player3D.d.ts +0 -3
  262. package/dist/icons/Player3D.js +0 -21
  263. package/dist/icons/Ruler copy.d.ts +0 -3
  264. package/dist/icons/Ruler copy.js +0 -22
  265. package/dist/icons/RulerBlank.d.ts +0 -3
  266. package/dist/icons/RulerBlank.js +0 -25
  267. package/dist/icons/RulerDetailed copy.d.ts +0 -3
  268. package/dist/icons/RulerDetailed copy.js +0 -27
  269. package/dist/icons/RulerDetailed.d.ts +0 -3
  270. package/dist/icons/RulerDetailed.js +0 -27
  271. package/dist/icons/Save.d.ts +0 -3
  272. package/dist/icons/Save.js +0 -21
  273. package/dist/icons/UnitCm.d.ts +0 -3
  274. package/dist/icons/UnitCm.js +0 -22
  275. package/dist/icons/UnitFeet.d.ts +0 -3
  276. package/dist/icons/UnitFeet.js +0 -22
  277. package/dist/icons/UnitInch.d.ts +0 -3
  278. package/dist/icons/UnitInch.js +0 -22
  279. package/dist/icons/UnitMeter.d.ts +0 -3
  280. package/dist/icons/UnitMeter.js +0 -21
  281. package/dist/store/spaces.d.ts +0 -47
  282. package/dist/store/spaces.js +0 -197
@@ -1,1751 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
- return new (P || (P = Promise))(function (resolve, reject) {
16
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
- step((generator = generator.apply(thisArg, _arguments || [])).next());
20
- });
21
- };
22
- var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
- function verb(n) { return function (v) { return step([n, v]); }; }
26
- function step(op) {
27
- if (f) throw new TypeError("Generator is already executing.");
28
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
- if (y = 0, t) op = [op[0] & 2, t.value];
31
- switch (op[0]) {
32
- case 0: case 1: t = op; break;
33
- case 4: _.label++; return { value: op[1], done: false };
34
- case 5: _.label++; y = op[1]; op = [0]; continue;
35
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
- default:
37
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
- if (t[2]) _.ops.pop();
42
- _.trys.pop(); continue;
43
- }
44
- op = body.call(thisArg, _);
45
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
- }
48
- };
49
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
50
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
51
- if (ar || !(i in from)) {
52
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
53
- ar[i] = from[i];
54
- }
55
- }
56
- return to.concat(ar || Array.prototype.slice.call(from));
57
- };
58
- Object.defineProperty(exports, "__esModule", { value: true });
59
- exports.SpacesState = void 0;
60
- var types_1 = require("./types");
61
- var validators_1 = require("./validators");
62
- var geometry_1 = require("./geometry");
63
- var draw_1 = require("./draw");
64
- var dataHandlers_1 = require("./dataHandlers");
65
- var __1 = require("../..");
66
- var constants_1 = require("./constants");
67
- var SpacesState = (function () {
68
- function SpacesState(config) {
69
- var _a;
70
- var _this = this;
71
- this.moveActiveVertex = function (canvas, point) {
72
- var _a, _b, _c, _d;
73
- if (!canvas)
74
- return;
75
- if (((_a = _this._activeElement) === null || _a === void 0 ? void 0 : _a.type) !== types_1.IElements.VERTEX)
76
- return;
77
- var snapPoint = _this.getSnapPointToElementInProximity(point);
78
- snapPoint = _this.getSnapActiveVertexToGuideInProximity(snapPoint);
79
- snapPoint = _this.getSnapPointToGridInProximity(snapPoint);
80
- if (snapPoint.type === types_1.SNAPPING_TYPES.GUIDE ||
81
- snapPoint.type === types_1.SNAPPING_TYPES.GRID)
82
- _this.guides = snapPoint;
83
- else if (_this.guides)
84
- _this.guides = null;
85
- var vertex = _this.getVertex(_this._activeElement.index);
86
- if (!vertex)
87
- return;
88
- var validationData = {
89
- vertex: vertex,
90
- updatedPosition: snapPoint,
91
- };
92
- _this._errorElement = _this.runValidators([
93
- validators_1.isVertexLandingOnFeature,
94
- validators_1.areWallsTooShort,
95
- validators_1.areWallsIntersecting,
96
- validators_1.areWallsOrphaningFeatures,
97
- validators_1.areWallsDuplicated,
98
- ], validationData);
99
- var errorType = ((_b = _this._errorElement) === null || _b === void 0 ? void 0 : _b[0].type) || null;
100
- switch (errorType) {
101
- case types_1.IErrorTypes.HARD:
102
- return;
103
- case types_1.IErrorTypes.SOFT:
104
- case types_1.IErrorTypes.WARN:
105
- case null:
106
- default:
107
- _this._activeElement.snapPoint = snapPoint;
108
- _this.repositionVertex(_this._activeElement.index, (_c = snapPoint === null || snapPoint === void 0 ? void 0 : snapPoint.point) !== null && _c !== void 0 ? _c : point);
109
- _this.drawSpaces(canvas);
110
- (0, draw_1.drawVertex)(canvas, _this.transformPointToCanvas((_d = snapPoint === null || snapPoint === void 0 ? void 0 : snapPoint.point) !== null && _d !== void 0 ? _d : point), _this.styles.vertex, types_1.IElementStyleModes.HIGHLIGHT);
111
- break;
112
- }
113
- };
114
- this.finishMoveActiveVertex = function () {
115
- var _a, _b;
116
- if (((_a = _this._activeElement) === null || _a === void 0 ? void 0 : _a.type) !== types_1.IElements.VERTEX)
117
- return;
118
- if (((_b = _this._activeElement.snapPoint) === null || _b === void 0 ? void 0 : _b.type) === types_1.IElements.WALL)
119
- _this.splitWallAtPoint(_this._activeElement.snapPoint.index, _this._activeElement.snapPoint.point);
120
- _this.guides = null;
121
- _this.pushStateToConfigurator();
122
- };
123
- this.moveActiveFeature = function (canvas, moveToPoint) {
124
- var _a, _b;
125
- if (_this._activeElement === null)
126
- return;
127
- var _c = _this._activeElement, type = _c.type, index = _c.index;
128
- if (type !== types_1.IElements.WINDOW &&
129
- type !== types_1.IElements.DOOR &&
130
- type !== types_1.IElements.OPENING)
131
- return;
132
- var feature = _this.getFeature(type, index);
133
- if (!feature)
134
- return;
135
- var wallIndex = (_a = _this.getWallIndexInProximity(moveToPoint)) !== null && _a !== void 0 ? _a : feature.connectedTo[1];
136
- var wall = _this.getWall(wallIndex);
137
- if (!wall)
138
- return;
139
- var intersection = (0, geometry_1.getTangetIntersectionAndOffset)(wall.line, moveToPoint);
140
- if (!intersection)
141
- return;
142
- var padding = _this.validationConfig.padding;
143
- var minOffset = padding;
144
- var maxOffset = (0, geometry_1.getLengthOfLineSegment)(wall.line) - (padding + feature.length);
145
- var newOffset = intersection.offset - feature.length / 2;
146
- if (newOffset < minOffset)
147
- newOffset = minOffset;
148
- else if (newOffset > maxOffset)
149
- newOffset = maxOffset;
150
- var validationData = {
151
- wall: wall,
152
- updatedFeature: {
153
- length: feature.length,
154
- offset: newOffset,
155
- address: { type: type, index: index },
156
- },
157
- };
158
- _this._errorElement = _this.runValidators([validators_1.isFeatureCollidingWithExistingFeature], validationData);
159
- var errorType = ((_b = _this._errorElement) === null || _b === void 0 ? void 0 : _b[0].type) || null;
160
- switch (errorType) {
161
- case types_1.IErrorTypes.HARD:
162
- return;
163
- case types_1.IErrorTypes.SOFT:
164
- _this.drawSpaces(canvas);
165
- break;
166
- case types_1.IErrorTypes.WARN:
167
- case null:
168
- default:
169
- _this.repositionFeature([type, index], newOffset, wallIndex);
170
- _this.drawSpaces(canvas);
171
- break;
172
- }
173
- };
174
- this.finishMoveActiveFeature = function () {
175
- var _a;
176
- var type = (_a = _this._activeElement) === null || _a === void 0 ? void 0 : _a.type;
177
- if (!type)
178
- return;
179
- if (type !== types_1.IElements.WINDOW &&
180
- type !== types_1.IElements.DOOR &&
181
- type !== types_1.IElements.OPENING)
182
- return;
183
- _this.pushStateToConfigurator();
184
- };
185
- this._config = config;
186
- this._newWall = null;
187
- this._activeElement = null;
188
- this._selectedElement = null;
189
- this._highlightedElement = null;
190
- this._errorElement = null;
191
- this._attributeDefaults = {};
192
- this._state = (_a = {},
193
- _a[types_1.IElements.WALL] = [],
194
- _a[types_1.IElements.VERTEX] = {},
195
- _a[types_1.IElements.FEATURE] = {},
196
- _a);
197
- this._showDimensions = types_1.IDimensionOptions.NONE;
198
- this._angleSnappingEnabled = true;
199
- this._guideSnappingEnabled = !config.config.disableGuides;
200
- this._guides = null;
201
- this._attributesState = null;
202
- this._canvasDimensions = [0, 0];
203
- this._zoom = config.config.zoomDefault;
204
- this._zoomLimits = [constants_1.ZOOM_MIN, constants_1.ZOOM_MAX];
205
- this._translate = config.config.translateDefault;
206
- this._translateLimits = [constants_1.TRANSLATE_MIN, constants_1.TRANSLATE_MAX];
207
- }
208
- Object.defineProperty(SpacesState.prototype, "styles", {
209
- get: function () {
210
- return this._config.config.styles;
211
- },
212
- enumerable: false,
213
- configurable: true
214
- });
215
- Object.defineProperty(SpacesState.prototype, "attributeDefaults", {
216
- get: function () {
217
- return this._attributeDefaults;
218
- },
219
- set: function (val) {
220
- this._attributeDefaults = val;
221
- },
222
- enumerable: false,
223
- configurable: true
224
- });
225
- Object.defineProperty(SpacesState.prototype, "scale", {
226
- get: function () {
227
- return this._config.config.scale;
228
- },
229
- enumerable: false,
230
- configurable: true
231
- });
232
- Object.defineProperty(SpacesState.prototype, "snapProximity", {
233
- get: function () {
234
- return this.transformLengthFromCanvas(this._config.config.snapProximity);
235
- },
236
- enumerable: false,
237
- configurable: true
238
- });
239
- Object.defineProperty(SpacesState.prototype, "gridUnitLength", {
240
- get: function () {
241
- var length = [types_1.IUnits.FEET, types_1.IUnits.INCH].includes(this.unit)
242
- ? (0, dataHandlers_1.convertLengthUnit)(1, types_1.IUnits.FEET, types_1.IUnits.METER)
243
- : 1;
244
- return length / this.scale;
245
- },
246
- enumerable: false,
247
- configurable: true
248
- });
249
- Object.defineProperty(SpacesState.prototype, "gridUnitLengthToDraw", {
250
- get: function () {
251
- return this.transformLengthToCanvas(this.gridUnitLength);
252
- },
253
- enumerable: false,
254
- configurable: true
255
- });
256
- Object.defineProperty(SpacesState.prototype, "gridOffset", {
257
- get: function () {
258
- var gridLength = this.gridUnitLengthToDraw;
259
- var translate = this.transformPointToCanvas([0, 0]);
260
- return [
261
- ((translate[0] % gridLength) + gridLength) % gridLength,
262
- ((translate[1] % gridLength) + gridLength) % gridLength,
263
- ];
264
- },
265
- enumerable: false,
266
- configurable: true
267
- });
268
- Object.defineProperty(SpacesState.prototype, "gridToDraw", {
269
- get: function () {
270
- var unitLength = this.gridUnitLengthToDraw;
271
- var subdivisions = [types_1.IUnits.FEET, types_1.IUnits.INCH].includes(this.unit) ? 4 : 5;
272
- return {
273
- unitLength: unitLength,
274
- offset: this.gridOffset,
275
- subdivisions: subdivisions,
276
- showSubdivisions: this.styles.grid.showSubdivisions &&
277
- unitLength / subdivisions > this.styles.grid.subdivisionThreshold,
278
- };
279
- },
280
- enumerable: false,
281
- configurable: true
282
- });
283
- Object.defineProperty(SpacesState.prototype, "walls", {
284
- get: function () {
285
- return this._state[types_1.IElements.WALL];
286
- },
287
- set: function (walls) {
288
- this._state[types_1.IElements.WALL] = walls;
289
- },
290
- enumerable: false,
291
- configurable: true
292
- });
293
- Object.defineProperty(SpacesState.prototype, "wallsToDraw", {
294
- get: function () {
295
- var _this = this;
296
- return this._state[types_1.IElements.WALL].map(function (wall) { return (__assign(__assign({}, wall), { line: _this.transformLineToCanvas(wall.line), path: undefined })); });
297
- },
298
- enumerable: false,
299
- configurable: true
300
- });
301
- Object.defineProperty(SpacesState.prototype, "wallCount", {
302
- get: function () {
303
- return this.walls.length;
304
- },
305
- enumerable: false,
306
- configurable: true
307
- });
308
- Object.defineProperty(SpacesState.prototype, "wallLines", {
309
- get: function () {
310
- return this.walls.map(function (_a) {
311
- var line = _a.line;
312
- return line;
313
- });
314
- },
315
- enumerable: false,
316
- configurable: true
317
- });
318
- Object.defineProperty(SpacesState.prototype, "vertices", {
319
- get: function () {
320
- return this._state[types_1.IElements.VERTEX];
321
- },
322
- set: function (vertices) {
323
- this._state[types_1.IElements.VERTEX] = vertices;
324
- },
325
- enumerable: false,
326
- configurable: true
327
- });
328
- Object.defineProperty(SpacesState.prototype, "verticesToDraw", {
329
- get: function () {
330
- return this._state[types_1.IElements.VERTEX];
331
- },
332
- enumerable: false,
333
- configurable: true
334
- });
335
- Object.defineProperty(SpacesState.prototype, "verticesList", {
336
- get: function () {
337
- return Object.entries(this.vertices).map(function (_a) {
338
- var pointStr = _a[0], connections = _a[1];
339
- return ({
340
- point: JSON.parse(pointStr),
341
- connections: connections,
342
- });
343
- });
344
- },
345
- enumerable: false,
346
- configurable: true
347
- });
348
- Object.defineProperty(SpacesState.prototype, "verticesListToDraw", {
349
- get: function () {
350
- var _this = this;
351
- return this.verticesList.map(function (vertex) { return (__assign(__assign({}, vertex), { point: _this.transformPointToCanvas(vertex.point) })); });
352
- },
353
- enumerable: false,
354
- configurable: true
355
- });
356
- Object.defineProperty(SpacesState.prototype, "features", {
357
- get: function () {
358
- return this._state[types_1.IElements.FEATURE];
359
- },
360
- set: function (features) {
361
- this._state[types_1.IElements.FEATURE] = features;
362
- },
363
- enumerable: false,
364
- configurable: true
365
- });
366
- Object.defineProperty(SpacesState.prototype, "featuresToDraw", {
367
- get: function () {
368
- var _this = this;
369
- return Object.entries(this.features).reduce(function (output, _a) {
370
- var _b;
371
- var type = _a[0], featureArr = _a[1];
372
- return Object.assign(output, (_b = {},
373
- _b[type] = featureArr.map(function (feature) { return (__assign(__assign({}, feature), { path: undefined, offset: _this.transformLengthToCanvas(feature.offset), length: _this.transformLengthToCanvas(feature.length) })); }),
374
- _b));
375
- }, {});
376
- },
377
- enumerable: false,
378
- configurable: true
379
- });
380
- Object.defineProperty(SpacesState.prototype, "getHydratedFeatures", {
381
- get: function () {
382
- var _this = this;
383
- return Object.entries(this.features).reduce(function (output, _a) {
384
- var _b;
385
- var type = _a[0], featureArr = _a[1];
386
- return Object.assign(output, (_b = {},
387
- _b[type] = featureArr.map(function (feature) {
388
- var wall = _this.getWall(feature.connectedTo[1]);
389
- if (!wall)
390
- return;
391
- var line = (0, geometry_1.getLineAtOffsetOnLineSegment)(wall.line, feature.offset, feature.length);
392
- return __assign(__assign({}, feature), { line: line });
393
- }),
394
- _b));
395
- }, {});
396
- },
397
- enumerable: false,
398
- configurable: true
399
- });
400
- Object.defineProperty(SpacesState.prototype, "featureCount", {
401
- get: function () {
402
- return Object.values(this.features).flat().length;
403
- },
404
- enumerable: false,
405
- configurable: true
406
- });
407
- Object.defineProperty(SpacesState.prototype, "activeElement", {
408
- get: function () {
409
- return this._activeElement;
410
- },
411
- enumerable: false,
412
- configurable: true
413
- });
414
- Object.defineProperty(SpacesState.prototype, "selectedElement", {
415
- get: function () {
416
- return this._selectedElement;
417
- },
418
- set: function (element) {
419
- this._selectedElement = element;
420
- },
421
- enumerable: false,
422
- configurable: true
423
- });
424
- Object.defineProperty(SpacesState.prototype, "showDimensions", {
425
- get: function () {
426
- return this._showDimensions;
427
- },
428
- set: function (val) {
429
- this._showDimensions = val;
430
- },
431
- enumerable: false,
432
- configurable: true
433
- });
434
- Object.defineProperty(SpacesState.prototype, "angleSnappingEnabled", {
435
- get: function () {
436
- return this._angleSnappingEnabled;
437
- },
438
- set: function (val) {
439
- this._angleSnappingEnabled = val;
440
- },
441
- enumerable: false,
442
- configurable: true
443
- });
444
- Object.defineProperty(SpacesState.prototype, "guideSnappingEnabled", {
445
- get: function () {
446
- return this._guideSnappingEnabled;
447
- },
448
- set: function (val) {
449
- this._guideSnappingEnabled = val;
450
- },
451
- enumerable: false,
452
- configurable: true
453
- });
454
- Object.defineProperty(SpacesState.prototype, "gridSnappingEnabled", {
455
- get: function () {
456
- return this._gridSnappingEnabled;
457
- },
458
- set: function (val) {
459
- this._gridSnappingEnabled = val;
460
- },
461
- enumerable: false,
462
- configurable: true
463
- });
464
- Object.defineProperty(SpacesState.prototype, "guides", {
465
- get: function () {
466
- return this._guides;
467
- },
468
- set: function (val) {
469
- this._guides = val;
470
- },
471
- enumerable: false,
472
- configurable: true
473
- });
474
- Object.defineProperty(SpacesState.prototype, "enclosedSpacesToDraw", {
475
- get: function () {
476
- var _this = this;
477
- var loops = (0, geometry_1.findLoops)(this.wallLines).inner;
478
- return loops.reduce(function (output, loop) {
479
- var screenSpaceArea = Math.round((0, geometry_1.getPolygonArea)(loop));
480
- var area = screenSpaceArea * Math.pow(_this.scale, 2);
481
- var convertedArea = (0, dataHandlers_1.convertAreaUnit)(area, types_1.IUnits.METER, _this.unit);
482
- var enclosedSpace = {
483
- loop: loop.map(function (point) { return _this.transformPointToCanvas(point); }),
484
- area: (0, dataHandlers_1.prepAreaForUser)(convertedArea, _this.unit),
485
- center: loop.reduce(function (centerPoint, point) {
486
- centerPoint[0] += point[0] / loop.length;
487
- centerPoint[1] += point[1] / loop.length;
488
- return centerPoint;
489
- }, [0, 0]),
490
- };
491
- enclosedSpace.center = _this.transformPointToCanvas(enclosedSpace.center);
492
- output.push(enclosedSpace);
493
- return output;
494
- }, []);
495
- },
496
- enumerable: false,
497
- configurable: true
498
- });
499
- Object.defineProperty(SpacesState.prototype, "canvasDimensions", {
500
- get: function () {
501
- return this._canvasDimensions;
502
- },
503
- set: function (dimensions) {
504
- this._canvasDimensions = dimensions;
505
- },
506
- enumerable: false,
507
- configurable: true
508
- });
509
- Object.defineProperty(SpacesState.prototype, "canvasWidth", {
510
- get: function () {
511
- return this.canvasDimensions[0];
512
- },
513
- enumerable: false,
514
- configurable: true
515
- });
516
- Object.defineProperty(SpacesState.prototype, "canvasHeight", {
517
- get: function () {
518
- return this.canvasDimensions[1];
519
- },
520
- enumerable: false,
521
- configurable: true
522
- });
523
- Object.defineProperty(SpacesState.prototype, "zoom", {
524
- get: function () {
525
- return this._zoom;
526
- },
527
- set: function (delta) {
528
- var newZoom = this.zoom + delta;
529
- var preppedZoom = newZoom < this.zoomMin
530
- ? this.zoomMin
531
- : newZoom > this.zoomMax
532
- ? this.zoomMax
533
- : newZoom;
534
- if (preppedZoom === this.zoom)
535
- return;
536
- this._zoom = preppedZoom;
537
- },
538
- enumerable: false,
539
- configurable: true
540
- });
541
- Object.defineProperty(SpacesState.prototype, "zoomFactor", {
542
- get: function () {
543
- return this._zoom / this.zoomMin;
544
- },
545
- set: function (val) {
546
- var newZoom = val * this.zoomMin;
547
- var validatedZoom = newZoom < this.zoomMin
548
- ? this.zoomMin
549
- : newZoom > this.zoomMax
550
- ? this.zoomMax
551
- : newZoom;
552
- this._zoom = validatedZoom;
553
- },
554
- enumerable: false,
555
- configurable: true
556
- });
557
- Object.defineProperty(SpacesState.prototype, "zoomMin", {
558
- get: function () {
559
- return this._zoomLimits[0];
560
- },
561
- enumerable: false,
562
- configurable: true
563
- });
564
- Object.defineProperty(SpacesState.prototype, "zoomMax", {
565
- get: function () {
566
- return this._zoomLimits[1];
567
- },
568
- enumerable: false,
569
- configurable: true
570
- });
571
- Object.defineProperty(SpacesState.prototype, "unit", {
572
- get: function () {
573
- return this._unit;
574
- },
575
- set: function (unit) {
576
- this._unit = unit;
577
- },
578
- enumerable: false,
579
- configurable: true
580
- });
581
- Object.defineProperty(SpacesState.prototype, "translate", {
582
- get: function () {
583
- return this._translate;
584
- },
585
- set: function (position) {
586
- var zoomFactor = this._zoom / this.zoomMin;
587
- var delta = [
588
- (position[0] - this._translate[0]) / zoomFactor,
589
- (position[1] - this._translate[1]) / zoomFactor,
590
- ];
591
- this._translate = [
592
- this._translate[0] + delta[0],
593
- this._translate[1] + delta[1],
594
- ];
595
- },
596
- enumerable: false,
597
- configurable: true
598
- });
599
- Object.defineProperty(SpacesState.prototype, "translateMin", {
600
- get: function () {
601
- return this._translateLimits[0];
602
- },
603
- enumerable: false,
604
- configurable: true
605
- });
606
- Object.defineProperty(SpacesState.prototype, "translateMax", {
607
- get: function () {
608
- return this._translateLimits[1];
609
- },
610
- enumerable: false,
611
- configurable: true
612
- });
613
- Object.defineProperty(SpacesState.prototype, "isDrawWallActive", {
614
- get: function () {
615
- return !!this._newWall;
616
- },
617
- enumerable: false,
618
- configurable: true
619
- });
620
- Object.defineProperty(SpacesState.prototype, "validationConfig", {
621
- get: function () {
622
- return this._validationConfig;
623
- },
624
- set: function (config) {
625
- this._validationConfig = config;
626
- },
627
- enumerable: false,
628
- configurable: true
629
- });
630
- SpacesState.prototype.transformLengthFromCanvas = function (length) {
631
- return length / this.zoomFactor;
632
- };
633
- SpacesState.prototype.transformLengthToCanvas = function (length) {
634
- return length * this.zoomFactor;
635
- };
636
- SpacesState.prototype.transformPointToCanvas = function (point) {
637
- var widthOffset = this.canvasWidth / 2;
638
- var heightOffset = this.canvasHeight / 2;
639
- return [
640
- this.transformLengthToCanvas(point[0] + this.translate[0]) -
641
- widthOffset * (this.zoomFactor - 1),
642
- this.transformLengthToCanvas(point[1] + this.translate[1]) -
643
- heightOffset * (this.zoomFactor - 1),
644
- ];
645
- };
646
- SpacesState.prototype.transformPointFromCanvas = function (point) {
647
- var widthOffset = this.canvasWidth / 2;
648
- var heightOffset = this.canvasHeight / 2;
649
- return [
650
- this.transformLengthFromCanvas(point[0] + widthOffset * (this.zoomFactor - 1)) - this.translate[0],
651
- this.transformLengthFromCanvas(point[1] + heightOffset * (this.zoomFactor - 1)) - this.translate[1],
652
- ];
653
- };
654
- SpacesState.prototype.transformLineToCanvas = function (line) {
655
- return [
656
- this.transformPointToCanvas(line[0]),
657
- this.transformPointToCanvas(line[1]),
658
- ];
659
- };
660
- SpacesState.prototype.prepLineLength = function (line) {
661
- var lineLength = (0, geometry_1.getLengthOfLineSegment)(line) * this.scale;
662
- var convertedVal = (0, dataHandlers_1.convertLengthUnit)(lineLength, types_1.IUnits.METER, this.unit);
663
- return convertedVal;
664
- };
665
- SpacesState.prototype.getWall = function (index) {
666
- return this.walls[index];
667
- };
668
- SpacesState.prototype.addWall = function (wall) {
669
- if (!wall)
670
- return;
671
- var updatedWalls = this.walls;
672
- updatedWalls.push(wall);
673
- this.walls = updatedWalls;
674
- };
675
- SpacesState.prototype.addWalls = function (walls) {
676
- var _this = this;
677
- if (!(walls === null || walls === void 0 ? void 0 : walls.length))
678
- return;
679
- walls.forEach(function (wall) { return _this.addWall(wall); });
680
- };
681
- SpacesState.prototype.updateWall = function (index, wall) {
682
- var currentWall = this.walls[index];
683
- if (!currentWall)
684
- return;
685
- this._state[types_1.IElements.WALL][index] = Object.assign({}, currentWall, wall);
686
- };
687
- SpacesState.prototype.getWallConnectionCount = function (index) {
688
- var wall = this.getWall(index);
689
- return (wall === null || wall === void 0 ? void 0 : wall.connections.length) || 0;
690
- };
691
- SpacesState.prototype.getWallConnectionsHydrated = function (index) {
692
- var _this = this;
693
- var _a;
694
- var connections = (_a = this.getWall(index)) === null || _a === void 0 ? void 0 : _a.connections;
695
- if (!connections)
696
- return undefined;
697
- return connections.reduce(function (output, connection) {
698
- var feature = _this.getFeature.apply(_this, connection);
699
- if (feature)
700
- output.push(feature);
701
- return output;
702
- }, []);
703
- };
704
- SpacesState.prototype.getWallDimensions = function (line) {
705
- var lineLength = this.prepLineLength(line);
706
- return {
707
- line: line,
708
- label: (0, dataHandlers_1.prepLengthForUser)(lineLength, this.unit),
709
- };
710
- };
711
- SpacesState.prototype.getWallDimensionsByIndex = function (index) {
712
- var _a;
713
- var line = (_a = this.getWall(index)) === null || _a === void 0 ? void 0 : _a.line;
714
- if (!line)
715
- return undefined;
716
- return this.getWallDimensions(line);
717
- };
718
- SpacesState.prototype.getWallDetailedDimensionsByIndex = function (index) {
719
- var _this = this;
720
- var _a;
721
- var line = (_a = this.getWall(index)) === null || _a === void 0 ? void 0 : _a.line;
722
- var features = this.getWallConnectionsHydrated(index);
723
- if (!line || !features)
724
- return undefined;
725
- var prepLength = function (val) { return val.toFixed(2); };
726
- var lines = features
727
- .sort(function (a, b) { return a.offset - b.offset; })
728
- .reduce(function (output, _a, i) {
729
- var offset = _a.offset, length = _a.length;
730
- var featureLine = (0, geometry_1.getLineAtOffsetOnLineSegment)(line, offset, length);
731
- var featureLength = _this.prepLineLength(featureLine);
732
- var unit = constants_1.UNIT_LABELS[_this.unit];
733
- if (!i) {
734
- var startLine = [line[0], featureLine[0]];
735
- var startLineLength = _this.prepLineLength(startLine);
736
- output.push({
737
- line: startLine,
738
- label: "".concat(prepLength(startLineLength), " ").concat(unit),
739
- });
740
- }
741
- else {
742
- var previousLine = [
743
- output[output.length - 1].line[1],
744
- featureLine[0],
745
- ];
746
- var previousLineLength = _this.prepLineLength(previousLine);
747
- output.push({
748
- line: previousLine,
749
- label: "".concat(prepLength(previousLineLength), " ").concat(unit),
750
- });
751
- }
752
- output.push({
753
- line: featureLine,
754
- label: "".concat(prepLength(featureLength), " ").concat(unit),
755
- });
756
- if (i === features.length - 1) {
757
- var endLine = [featureLine[1], line[1]];
758
- var endLineLength = _this.prepLineLength(endLine);
759
- output.push({
760
- line: endLine,
761
- label: "".concat(prepLength(endLineLength), " ").concat(unit),
762
- });
763
- }
764
- return output;
765
- }, []);
766
- return lines;
767
- };
768
- SpacesState.prototype.getDimensionToDraw = function (detailedWallsIndexes) {
769
- var _this = this;
770
- if (detailedWallsIndexes === void 0) { detailedWallsIndexes = []; }
771
- if (this.showDimensions === types_1.IDimensionOptions.NONE)
772
- return undefined;
773
- var indexes = new Set([detailedWallsIndexes].flat());
774
- var dimensionsList = this.walls.reduce(function (output, _, i) {
775
- var dimensions = _this.showDimensions === types_1.IDimensionOptions.DETAILED || indexes.has(i)
776
- ? _this.getWallDetailedDimensionsByIndex(i)
777
- : _this.getWallDimensionsByIndex(i);
778
- if (!dimensions)
779
- return output;
780
- if (Array.isArray(dimensions))
781
- output.push.apply(output, dimensions);
782
- else
783
- output.push(dimensions);
784
- return output;
785
- }, []);
786
- return dimensionsList.map(function (dimension) { return (__assign(__assign({}, dimension), { line: _this.transformLineToCanvas(dimension.line) })); });
787
- };
788
- SpacesState.prototype.shiftAllFeaturesOnWall = function (index, shift) {
789
- var _this = this;
790
- var _a;
791
- var connections = (_a = this.getWall(index)) === null || _a === void 0 ? void 0 : _a.connections;
792
- if (!connections)
793
- return;
794
- connections.forEach(function (_a) {
795
- var type = _a[0], featureIndex = _a[1];
796
- var feature = _this.getFeature(type, featureIndex);
797
- if (!feature)
798
- return;
799
- _this.updateFeature(type, featureIndex, {
800
- offset: feature.offset + shift,
801
- });
802
- });
803
- };
804
- SpacesState.prototype.addFeatureToWall = function (index, featurePath) {
805
- var _a;
806
- var updatedWalls = this.walls;
807
- (_a = updatedWalls[index]) === null || _a === void 0 ? void 0 : _a.connections.push(featurePath);
808
- this.walls = updatedWalls;
809
- };
810
- SpacesState.prototype.removeFeatureFromWall = function (index, featurePath) {
811
- var updatedWalls = this.walls;
812
- if (!updatedWalls[index])
813
- return;
814
- updatedWalls[index].connections = updatedWalls[index].connections.filter(function (connection) {
815
- return connection[0] !== featurePath[0] || connection[1] !== featurePath[1];
816
- });
817
- this.walls = updatedWalls;
818
- };
819
- SpacesState.prototype.splitWallAtOffset = function (wallIndex, offset) {
820
- var wall = this.getWall(wallIndex);
821
- if (!wall)
822
- return;
823
- var point = offset
824
- ? (0, geometry_1.getPointAtOffsetOnLineSegment)(wall.line, offset)
825
- : (0, geometry_1.getMidpointOfLineSegment)(wall.line);
826
- this.splitWallAtPoint(wallIndex, point);
827
- this.pushStateToConfigurator();
828
- };
829
- SpacesState.prototype.splitWallAtPoint = function (wallIndex, point) {
830
- var _this = this;
831
- var originalWall = this.getWall(wallIndex);
832
- if (!originalWall)
833
- return;
834
- var offset = (0, geometry_1.getLengthOfLineSegment)([originalWall.line[0], point]);
835
- var _a = (0, geometry_1.splitLineAtPoint)(originalWall.line, point), line1 = _a[0], line2 = _a[1];
836
- var newWallIndex = this.wallCount;
837
- var splitWallsShared = {
838
- assetId: originalWall.assetId,
839
- restConfiguration: originalWall.restConfiguration,
840
- visible: originalWall.visible,
841
- };
842
- var wall1 = __assign(__assign({}, splitWallsShared), { line: line1, connections: originalWall.connections });
843
- var wall2 = __assign(__assign({}, splitWallsShared), { line: line2, connections: [] });
844
- this.updateWall(wallIndex, wall1);
845
- this.addWall(wall2);
846
- originalWall.connections.forEach(function (connection) {
847
- var feature = _this.getFeature.apply(_this, connection);
848
- if (!feature)
849
- return;
850
- var updatedOffset = feature.offset - offset;
851
- if (updatedOffset > 0)
852
- _this.repositionFeature(connection, updatedOffset, newWallIndex);
853
- });
854
- };
855
- SpacesState.prototype.deleteWall = function (index) {
856
- var wall = this.getWall(index);
857
- if (!wall)
858
- return;
859
- if (wall.connections.length) {
860
- var currentFeatures_1 = this.features;
861
- var deleteMap = wall.connections.reduce(function (output, _a) {
862
- var type = _a[0], index = _a[1];
863
- if (output[type])
864
- output[type].push(index);
865
- else
866
- output[type] = [index];
867
- return output;
868
- }, {});
869
- var updatedFeatures = Object.entries(deleteMap).reduce(function (output, _a) {
870
- var _b;
871
- var type = _a[0], deletionIndexes = _a[1];
872
- output[type] = (_b = currentFeatures_1[type]) === null || _b === void 0 ? void 0 : _b.filter(function (_, i) { return !deletionIndexes.includes(i); });
873
- return output;
874
- }, __assign({}, currentFeatures_1));
875
- this.features = updatedFeatures;
876
- }
877
- var updatedWalls = this.walls;
878
- updatedWalls.splice(index, 1);
879
- this.walls = updatedWalls;
880
- var reevaluatedFeatures = Object.entries(this.features).reduce(function (output, _a) {
881
- var type = _a[0], featuresArr = _a[1];
882
- output[type] = featuresArr.map(function (feature) {
883
- return feature.connectedTo[1] > index
884
- ? Object.assign({}, feature, {
885
- connectedTo: [
886
- feature.connectedTo[0],
887
- feature.connectedTo[1] - 1,
888
- ],
889
- })
890
- : feature;
891
- });
892
- return output;
893
- }, {});
894
- this.features = reevaluatedFeatures;
895
- this.reevaluateFeatureConnections();
896
- this.pushStateToConfigurator();
897
- };
898
- SpacesState.prototype.getFirstVacantLocationOnWallIndex = function (length, wallIndex) {
899
- var _a, _b;
900
- var _c = this, walls = _c.walls, validationConfig = _c.validationConfig;
901
- var padding = validationConfig.padding;
902
- var wallLength = (0, geometry_1.getLengthOfLineSegment)(walls[wallIndex].line);
903
- var features = (_b = (_a = this.getWallConnectionsHydrated(wallIndex)) === null || _a === void 0 ? void 0 : _a.sort(function (a, b) { return a.offset - b.offset; })) !== null && _b !== void 0 ? _b : [];
904
- for (var j = 0; j <= features.length; j++) {
905
- var prev = features[j - 1];
906
- var next = features[j];
907
- var slotStart = prev ? prev.offset + prev.length : padding;
908
- var slotEnd = next ? next.offset : wallLength - padding;
909
- if (slotEnd - slotStart > length) {
910
- return (slotStart + slotEnd) / 2 - length / 2;
911
- }
912
- }
913
- return undefined;
914
- };
915
- SpacesState.prototype.getFirstVacantLocation = function (length, wallIndex) {
916
- if (wallIndex !== undefined) {
917
- var offset = this.getFirstVacantLocationOnWallIndex(length, wallIndex);
918
- if (offset != null)
919
- return {
920
- wallIndex: wallIndex,
921
- offset: offset,
922
- };
923
- }
924
- for (var i = 0; i < this.walls.length; i++) {
925
- var offset = this.getFirstVacantLocationOnWallIndex(length, i);
926
- if (offset != null)
927
- return {
928
- wallIndex: i,
929
- offset: offset,
930
- };
931
- }
932
- return false;
933
- };
934
- SpacesState.prototype.getWallUiAnchorPoint = function (index) {
935
- var wall = this.getWall(index);
936
- if (!wall)
937
- return undefined;
938
- var line = (0, geometry_1.getParallelLineSegmentAtDistance)(wall.line, constants_1.UI_ANCHOR_DISTANCE);
939
- var point = (0, geometry_1.getMidpointOfLineSegment)(line);
940
- return this.transformPointToCanvas(point);
941
- };
942
- SpacesState.prototype.getVertex = function (index) {
943
- return this.verticesList[index];
944
- };
945
- SpacesState.prototype.getWallsConnectedToVertex = function (index) {
946
- if (index === undefined)
947
- return [];
948
- var vertex = this.getVertex(index);
949
- if (!vertex)
950
- return [];
951
- return vertex.connections.map(function (_a) {
952
- var index = _a[0];
953
- return index;
954
- });
955
- };
956
- SpacesState.prototype.repositionVertex = function (index, newCoordinates) {
957
- var _this = this;
958
- var _a;
959
- var connections = (_a = this.getVertex(index)) === null || _a === void 0 ? void 0 : _a.connections;
960
- if (!connections)
961
- return;
962
- connections.forEach(function (_a) {
963
- var wallIdx = _a[0], vertexIdx = _a[1];
964
- var updatedLine = JSON.parse(JSON.stringify(_this.walls[wallIdx].line));
965
- var currentLine = JSON.parse(JSON.stringify(_this.walls[wallIdx].line));
966
- updatedLine[vertexIdx] = newCoordinates;
967
- if (_this.getWallConnectionCount(wallIdx) && vertexIdx === 0) {
968
- var delta = (0, geometry_1.getLengthOfLineSegment)(updatedLine) -
969
- (0, geometry_1.getLengthOfLineSegment)(currentLine);
970
- _this.shiftAllFeaturesOnWall(wallIdx, delta);
971
- }
972
- _this.updateWall(wallIdx, {
973
- line: updatedLine,
974
- path: undefined,
975
- });
976
- });
977
- };
978
- SpacesState.prototype.getFeatureType = function (type) {
979
- return this.features[type];
980
- };
981
- SpacesState.prototype.setFeatureType = function (type, features) {
982
- var updatedFeatures = this.features;
983
- updatedFeatures[type] = features;
984
- this.features = updatedFeatures;
985
- this.reevaluateFeatureConnections();
986
- };
987
- SpacesState.prototype.getFeature = function (type, index) {
988
- var _a;
989
- return (_a = this.features[type]) === null || _a === void 0 ? void 0 : _a[index];
990
- };
991
- SpacesState.prototype.updateFeature = function (type, index, feature) {
992
- var currentFeature = this._state[types_1.IElements.FEATURE][type][index];
993
- if (!currentFeature)
994
- return;
995
- this._state[types_1.IElements.FEATURE][type][index] = Object.assign({}, currentFeature, feature);
996
- };
997
- SpacesState.prototype.repositionFeature = function (featurePath, offset, moveToWallIndex) {
998
- var type = featurePath[0], index = featurePath[1];
999
- var feature = this.getFeature(type, index);
1000
- if (!feature)
1001
- return;
1002
- this.updateFeature(type, index, { offset: offset, path: undefined });
1003
- if (moveToWallIndex === feature.connectedTo[1])
1004
- return;
1005
- this.removeFeatureFromWall(index, featurePath);
1006
- this.addFeatureToWall(moveToWallIndex, featurePath);
1007
- this.updateFeature(type, index, {
1008
- connectedTo: [types_1.IElements.WALL, moveToWallIndex],
1009
- });
1010
- };
1011
- SpacesState.prototype.addFeature = function (type, addToWallIndex, feature) {
1012
- var _a;
1013
- var assetId = (feature === null || feature === void 0 ? void 0 : feature.assetId) || this.attributeDefaults[type];
1014
- if (!assetId)
1015
- return;
1016
- var offset = undefined;
1017
- var index = undefined;
1018
- var length = ((feature === null || feature === void 0 ? void 0 : feature.length) || constants_1.FEATURE_LENGTH) / this.scale;
1019
- if (addToWallIndex !== undefined && (feature === null || feature === void 0 ? void 0 : feature.offset) !== undefined) {
1020
- var wall = this.getWall(addToWallIndex);
1021
- if (wall) {
1022
- var isColliding = (0, validators_1.isFeatureCollidingWithExistingFeature)({
1023
- wall: wall,
1024
- updatedFeature: {
1025
- length: length,
1026
- offset: feature.offset,
1027
- address: { type: types_1.IElements.WALL, index: addToWallIndex },
1028
- },
1029
- }, {
1030
- walls: this.walls,
1031
- features: this.features,
1032
- });
1033
- if (!isColliding) {
1034
- offset = feature.offset;
1035
- index = addToWallIndex;
1036
- }
1037
- }
1038
- }
1039
- if (offset === undefined) {
1040
- var availableSlot = this.getFirstVacantLocation(length, addToWallIndex);
1041
- if (!availableSlot)
1042
- return;
1043
- offset = availableSlot.offset;
1044
- index = availableSlot.wallIndex;
1045
- }
1046
- if (index === undefined || offset === undefined)
1047
- return;
1048
- var newFeature = __assign(__assign({}, feature), { assetId: assetId, offset: offset, length: length, height: (feature === null || feature === void 0 ? void 0 : feature.height) ? feature.height / this.scale : 0, altitude: (feature === null || feature === void 0 ? void 0 : feature.altitude) ? feature.altitude / this.scale : 0, connectedTo: [types_1.IElements.WALL, index], restConfiguration: '{}' });
1049
- if (type === types_1.IElements.DOOR) {
1050
- newFeature.orientation = 'left';
1051
- newFeature.openingDirection = 'inside';
1052
- }
1053
- var newFeatureIndex;
1054
- if ((_a = this._state[types_1.IElements.FEATURE][type]) === null || _a === void 0 ? void 0 : _a.length)
1055
- newFeatureIndex = this._state[types_1.IElements.FEATURE][type].length;
1056
- else {
1057
- this._state[types_1.IElements.FEATURE][type] = [];
1058
- newFeatureIndex = 0;
1059
- }
1060
- this._state[types_1.IElements.FEATURE][type].push(newFeature);
1061
- this.addFeatureToWall(index, [type, newFeatureIndex]);
1062
- this.pushStateToConfigurator();
1063
- };
1064
- SpacesState.prototype.deleteFeature = function (type, index) {
1065
- var features = this.getFeatureType(type);
1066
- if (!(features === null || features === void 0 ? void 0 : features[index]))
1067
- return;
1068
- var deletedFeature = features.splice(index, 1)[0];
1069
- this.setFeatureType(type, features);
1070
- var wallToUpdate = this.getWall(deletedFeature.connectedTo[1]);
1071
- if (!wallToUpdate)
1072
- return;
1073
- this.updateWall(deletedFeature.connectedTo[1], {
1074
- connections: wallToUpdate.connections.filter(function (connection) { return connection[0] === type && connection[1] !== index; }),
1075
- });
1076
- this.pushStateToConfigurator();
1077
- };
1078
- SpacesState.prototype.getHydratedFeature = function (type, index) {
1079
- var feature = this.getFeature(type, index);
1080
- if (!feature)
1081
- return;
1082
- var wall = this.getWall(feature.connectedTo[1]);
1083
- if (!wall)
1084
- return;
1085
- var line = (0, geometry_1.getLineAtOffsetOnLineSegment)(wall.line, feature.offset, feature.length);
1086
- return __assign(__assign({}, feature), { line: line });
1087
- };
1088
- SpacesState.prototype.getFeatureUiAnchorPoint = function (type, index) {
1089
- var feature = this.getHydratedFeature(type, index);
1090
- if (!feature)
1091
- return;
1092
- var line = (0, geometry_1.getParallelLineSegmentAtDistance)(feature.line, constants_1.UI_ANCHOR_DISTANCE);
1093
- var point = (0, geometry_1.getMidpointOfLineSegment)(line);
1094
- return this.transformPointToCanvas(point);
1095
- };
1096
- SpacesState.prototype.deleteElement = function (type, index) {
1097
- if (type === types_1.IElements.VERTEX)
1098
- return;
1099
- if (type === types_1.IElements.WALL)
1100
- this.deleteWall(index);
1101
- else
1102
- this.deleteFeature(type, index);
1103
- };
1104
- SpacesState.prototype.getVertexIndexInProximity = function (point) {
1105
- if (!point)
1106
- return undefined;
1107
- var snapProximity = this.snapProximity;
1108
- var index = this.verticesList.findIndex(function (vertex) {
1109
- return (0, geometry_1.arePointsWithinProximity)(vertex.point, point, snapProximity);
1110
- });
1111
- if (index === -1)
1112
- return undefined;
1113
- return index;
1114
- };
1115
- SpacesState.prototype.getWallIndexInProximity = function (point) {
1116
- var _this = this;
1117
- var index = this.walls.findIndex(function (wall) {
1118
- var path = (0, geometry_1.addThicknessToLine)(wall.line, _this.styles.wall.thickness + constants_1.WALL_SNAP_DISTANCE);
1119
- return (0, geometry_1.isPointInQuadrilateral)(path, point);
1120
- });
1121
- if (index === -1)
1122
- return undefined;
1123
- return index;
1124
- };
1125
- SpacesState.prototype.getSnapPointToVertexInProximity = function (point) {
1126
- var _a, _b;
1127
- if (!point)
1128
- return undefined;
1129
- var index = this.getVertexIndexInProximity(point);
1130
- if (index === undefined)
1131
- return undefined;
1132
- if (((_a = this._activeElement) === null || _a === void 0 ? void 0 : _a.type) === types_1.IElements.VERTEX &&
1133
- ((_b = this._activeElement) === null || _b === void 0 ? void 0 : _b.index) === index)
1134
- return undefined;
1135
- var vertex = this.getVertex(index);
1136
- if (!vertex)
1137
- return undefined;
1138
- return {
1139
- type: types_1.IElements.VERTEX,
1140
- index: index,
1141
- point: vertex.point,
1142
- locked: [true, true],
1143
- };
1144
- };
1145
- SpacesState.prototype.getSnapPointToWallInProximity = function (point) {
1146
- var index = this.getWallIndexInProximity(point);
1147
- if (index === undefined)
1148
- return undefined;
1149
- if (this._activeElement) {
1150
- if (this._activeElement.type === types_1.IElements.WALL &&
1151
- this._activeElement.index === index)
1152
- return undefined;
1153
- if (this._activeElement.type === types_1.IElements.VERTEX) {
1154
- var vertex = this.getVertex(this._activeElement.index);
1155
- if (vertex)
1156
- for (var i = 0; i < vertex.connections.length; i++) {
1157
- if (vertex.connections[i][0] === index)
1158
- return undefined;
1159
- }
1160
- }
1161
- }
1162
- var intersection = (0, geometry_1.getTangetIntersectionAndOffset)(this.getWall(index).line, point);
1163
- if (!intersection)
1164
- return undefined;
1165
- return __assign(__assign({ type: types_1.IElements.WALL, index: index }, intersection), { locked: [true, true] });
1166
- };
1167
- SpacesState.prototype.getSnapPointToAngleInProximity = function (snapPoint, anchorPoint, angle) {
1168
- var _a;
1169
- if (anchorPoint === void 0) { anchorPoint = ((_a = this._newWall) === null || _a === void 0 ? void 0 : _a.start.point) ||
1170
- undefined; }
1171
- if (angle === void 0) { angle = 30; }
1172
- if (!this.angleSnappingEnabled)
1173
- return snapPoint;
1174
- var point = snapPoint.point, locked = snapPoint.locked;
1175
- if (locked[0] || locked[1])
1176
- return snapPoint;
1177
- if (!anchorPoint)
1178
- return snapPoint;
1179
- if (Math.abs(point[0] - anchorPoint[0]) < this.snapProximity) {
1180
- return {
1181
- type: types_1.SNAPPING_TYPES.ANGLE,
1182
- point: [anchorPoint[0], point[1]],
1183
- orientations: [types_1.GUIDE_ORIENTATIONS.VERTICAL],
1184
- locked: [true, true],
1185
- };
1186
- }
1187
- else if (Math.abs(point[1] - anchorPoint[1]) < this.snapProximity) {
1188
- return {
1189
- type: types_1.SNAPPING_TYPES.ANGLE,
1190
- point: [point[0], anchorPoint[1]],
1191
- orientations: [types_1.GUIDE_ORIENTATIONS.HORIZONTAL],
1192
- locked: [true, true],
1193
- };
1194
- }
1195
- for (var degrees = 0; degrees < 360; degrees += angle) {
1196
- if (degrees === 0 || degrees % 90 === 0)
1197
- continue;
1198
- var radians = degrees * (Math.PI / 180);
1199
- if ((0, geometry_1.getDistanceToLine)(anchorPoint, radians, point) < this.snapProximity)
1200
- return {
1201
- type: types_1.SNAPPING_TYPES.ANGLE,
1202
- point: (0, geometry_1.closestPointOnLine)(anchorPoint, radians, point),
1203
- orientations: [],
1204
- locked: [true, true],
1205
- };
1206
- }
1207
- return snapPoint;
1208
- };
1209
- SpacesState.prototype.getSnapVertexToGuideInProximity = function (snapPoint, vertexIndex) {
1210
- if (!this.guideSnappingEnabled)
1211
- return snapPoint;
1212
- var locked = snapPoint.locked, point = snapPoint.point;
1213
- if (locked[0] && locked[1])
1214
- return snapPoint;
1215
- var x = point[0], y = point[1];
1216
- var outputSnapPoint;
1217
- var anchorPoints = [];
1218
- var orientations = new Set();
1219
- var vertices = __spreadArray([], this.verticesList.map(function (_a) {
1220
- var point = _a.point;
1221
- return point;
1222
- }), true);
1223
- if (this._newWall)
1224
- vertices.push(this._newWall.start.point);
1225
- for (var i = 0; i < vertices.length &&
1226
- (!orientations.has(types_1.GUIDE_ORIENTATIONS.VERTICAL) ||
1227
- !orientations.has(types_1.GUIDE_ORIENTATIONS.HORIZONTAL)); i++) {
1228
- if (vertexIndex === i)
1229
- continue;
1230
- var _a = vertices[i], xAnchor = _a[0], yAnchor = _a[1];
1231
- if (!orientations.has(types_1.GUIDE_ORIENTATIONS.VERTICAL) &&
1232
- Math.abs(x - xAnchor) < this.snapProximity) {
1233
- outputSnapPoint = orientations.has(types_1.GUIDE_ORIENTATIONS.HORIZONTAL)
1234
- ? [xAnchor, outputSnapPoint[1]]
1235
- : [xAnchor, y];
1236
- anchorPoints.push(vertices[i]);
1237
- orientations.add(types_1.GUIDE_ORIENTATIONS.VERTICAL);
1238
- locked[0] = true;
1239
- }
1240
- else if (!orientations.has(types_1.GUIDE_ORIENTATIONS.HORIZONTAL) &&
1241
- Math.abs(y - yAnchor) < this.snapProximity) {
1242
- outputSnapPoint = orientations.has(types_1.GUIDE_ORIENTATIONS.VERTICAL)
1243
- ? [outputSnapPoint[0], yAnchor]
1244
- : [x, yAnchor];
1245
- anchorPoints.push(vertices[i]);
1246
- orientations.add(types_1.GUIDE_ORIENTATIONS.HORIZONTAL);
1247
- locked[1] = true;
1248
- }
1249
- }
1250
- if (!outputSnapPoint)
1251
- return snapPoint;
1252
- return {
1253
- type: types_1.SNAPPING_TYPES.GUIDE,
1254
- point: outputSnapPoint,
1255
- orientations: Array.from(orientations),
1256
- locked: locked,
1257
- };
1258
- };
1259
- SpacesState.prototype.getSnapActiveVertexToGuideInProximity = function (snapPoint) {
1260
- if (!this._activeElement)
1261
- return snapPoint;
1262
- return this.getSnapVertexToGuideInProximity(snapPoint, this._activeElement.index);
1263
- };
1264
- SpacesState.prototype.getSnapPointToGridInProximity = function (snapPoint) {
1265
- if (!this.gridSnappingEnabled)
1266
- return snapPoint;
1267
- var locked = snapPoint.locked, point = snapPoint.point;
1268
- if (locked[0] && locked[1])
1269
- return snapPoint;
1270
- var _a = this.gridToDraw, showSubdivisions = _a.showSubdivisions, subdivisions = _a.subdivisions;
1271
- var gridUnitLength = showSubdivisions
1272
- ? this.gridUnitLength / subdivisions
1273
- : this.gridUnitLength;
1274
- var gridPoint = point.map(function (axis) { return Math.round(axis / gridUnitLength) * gridUnitLength; });
1275
- if ((0, geometry_1.getLengthOfLineSegment)([point, gridPoint]) > this.snapProximity)
1276
- return snapPoint;
1277
- if ((!locked[0] && !locked[1]) ||
1278
- (locked[0] && gridPoint[0] === point[0]) ||
1279
- (locked[1] && gridPoint[1] === point[1]))
1280
- return {
1281
- type: types_1.SNAPPING_TYPES.GRID,
1282
- point: gridPoint,
1283
- locked: [true, true],
1284
- orientations: types_1.SNAPPING_TYPES.ANGLE === snapPoint.type ||
1285
- types_1.SNAPPING_TYPES.GUIDE === snapPoint.type
1286
- ? snapPoint.orientations
1287
- : [],
1288
- };
1289
- return snapPoint;
1290
- };
1291
- SpacesState.prototype.getFeatureAtPoint = function (point) {
1292
- var _this = this;
1293
- if (!point)
1294
- return undefined;
1295
- if (!this.featureCount)
1296
- return undefined;
1297
- var featuresMap = Object.entries(this.features);
1298
- for (var i = 0; i < featuresMap.length; i++) {
1299
- var _a = featuresMap[i], name_1 = _a[0], feature = _a[1];
1300
- var index = feature.findIndex(function (feature) {
1301
- var path = feature.path;
1302
- if (!path) {
1303
- var wallIndex = feature.connectedTo[1];
1304
- var featureLine = (0, geometry_1.getLineAtOffsetOnLineSegment)(_this.getWall(wallIndex).line, feature.offset, feature.length);
1305
- path = (0, geometry_1.addThicknessToLine)(featureLine, _this.styles.feature.thickness);
1306
- }
1307
- return (0, geometry_1.isPointInQuadrilateral)(path, point);
1308
- });
1309
- if (index !== -1)
1310
- return {
1311
- type: name_1,
1312
- index: index,
1313
- };
1314
- }
1315
- return undefined;
1316
- };
1317
- SpacesState.prototype.getElementAddressAtPoint = function (point) {
1318
- if (!point)
1319
- return undefined;
1320
- var snapToVertex = this.getSnapPointToVertexInProximity(point);
1321
- if (snapToVertex !== undefined)
1322
- return snapToVertex;
1323
- if (this.featureCount) {
1324
- var featureInProximity = this.getFeatureAtPoint(point);
1325
- if (featureInProximity)
1326
- return featureInProximity;
1327
- }
1328
- var wallInProximity = this.getWallIndexInProximity(point);
1329
- if (wallInProximity !== undefined)
1330
- return { type: types_1.IElements.WALL, index: wallInProximity };
1331
- return undefined;
1332
- };
1333
- SpacesState.prototype.getElementUiAtPoint = function (cursorPoint) {
1334
- var point = this.transformPointFromCanvas(cursorPoint);
1335
- var element = this.getElementAddressAtPoint(point);
1336
- if (!element)
1337
- return;
1338
- var uiAnchor;
1339
- if (element.type === types_1.IElements.VERTEX)
1340
- return;
1341
- if (element.type === types_1.IElements.WALL)
1342
- uiAnchor = this.getWallUiAnchorPoint(element.index);
1343
- else
1344
- uiAnchor = this.getFeatureUiAnchorPoint(element.type, element.index);
1345
- if (!uiAnchor)
1346
- return undefined;
1347
- return {
1348
- path: [element.type, element.index],
1349
- uiAnchor: uiAnchor,
1350
- };
1351
- };
1352
- SpacesState.prototype.getSnapPointToElementInProximity = function (point) {
1353
- var feature = this.getFeatureAtPoint(point);
1354
- if (feature)
1355
- return __assign(__assign({}, feature), { point: point, locked: [true, true] });
1356
- var snapToVertex = this.getSnapPointToVertexInProximity(point);
1357
- if (snapToVertex)
1358
- return snapToVertex;
1359
- var snapToWall = this.getSnapPointToWallInProximity(point);
1360
- if (snapToWall)
1361
- return snapToWall;
1362
- return {
1363
- type: types_1.SNAPPING_TYPES.NONE,
1364
- point: point,
1365
- locked: [false, false],
1366
- };
1367
- };
1368
- SpacesState.prototype.runValidators = function (validators, input) {
1369
- return (0, validators_1.runValidators)(validators, input, { walls: this.walls, features: this.features }, this.validationConfig);
1370
- };
1371
- SpacesState.prototype.reevaluateFeatureConnections = function () {
1372
- var _this = this;
1373
- this.walls.forEach(function (_, i) { return _this.updateWall(i, { connections: [] }); });
1374
- Object.entries(this.features).forEach(function (_a) {
1375
- var type = _a[0], featuresArr = _a[1];
1376
- return featuresArr.forEach(function (feature, i) {
1377
- return _this.addFeatureToWall(feature.connectedTo[1], [type, i]);
1378
- });
1379
- });
1380
- };
1381
- SpacesState.prototype.pushStateToConfigurator = function () {
1382
- var configuration = (0, dataHandlers_1.prepAttributesOutgoing)(this.walls, this.features, this._config);
1383
- window.threekit.configurator.setConfiguration(configuration);
1384
- };
1385
- SpacesState.prototype.setAttributesToState = function (attributes) {
1386
- if (!attributes)
1387
- return;
1388
- this._attributesState = attributes;
1389
- var data = (0, dataHandlers_1.prepAttributesIncoming)(attributes, this._config);
1390
- if (!Object.keys(this.attributeDefaults).length)
1391
- this.attributeDefaults = (0, dataHandlers_1.getAttributeDefaults)(attributes, this._config);
1392
- this.validationConfig = data.validationConfig;
1393
- this.walls = data[types_1.IElements.WALL];
1394
- this.vertices = data[types_1.IElements.VERTEX];
1395
- this.features = data[types_1.IElements.FEATURE];
1396
- this.reevaluateFeatureConnections();
1397
- };
1398
- SpacesState.prototype.deleteAll = function () {
1399
- this.walls = [];
1400
- this.vertices = {};
1401
- this.features = Object.keys(this.features).reduce(function (output, type) {
1402
- var _a;
1403
- return Object.assign(output, (_a = {}, _a[type] = [], _a));
1404
- }, {});
1405
- this.pushStateToConfigurator();
1406
- };
1407
- SpacesState.prototype.resetInternalState = function () {
1408
- if (this._attributesState)
1409
- this.setAttributesToState(this._attributesState);
1410
- };
1411
- SpacesState.prototype.highlightElementIfInProximity = function (canvas, cursorPoint) {
1412
- var _a, _b;
1413
- var point = this.transformPointFromCanvas(cursorPoint);
1414
- var elementAtPoint = this.getElementAddressAtPoint(point);
1415
- if ((!elementAtPoint && !this._highlightedElement) ||
1416
- Array.isArray(this._highlightedElement))
1417
- return;
1418
- if (elementAtPoint) {
1419
- var type = elementAtPoint.type, index = elementAtPoint.index;
1420
- if (((_a = this._highlightedElement) === null || _a === void 0 ? void 0 : _a.type) === type &&
1421
- ((_b = this._highlightedElement) === null || _b === void 0 ? void 0 : _b.index) === index)
1422
- return;
1423
- }
1424
- this._highlightedElement = elementAtPoint !== null && elementAtPoint !== void 0 ? elementAtPoint : null;
1425
- this.drawSpaces(canvas);
1426
- };
1427
- SpacesState.prototype.centerSpace = function (canvas, zoomToFit) {
1428
- if (zoomToFit === void 0) { zoomToFit = true; }
1429
- if (!canvas)
1430
- return;
1431
- if (!this.verticesList.length)
1432
- return;
1433
- var _a = this.verticesList.reduce(function (output, _a, i) {
1434
- var point = _a.point;
1435
- if (!i)
1436
- return {
1437
- xMin: point[0],
1438
- yMin: point[1],
1439
- xMax: point[0],
1440
- yMax: point[1],
1441
- };
1442
- if (point[0] < output.xMin)
1443
- output.xMin = point[0];
1444
- if (point[1] < output.yMin)
1445
- output.yMin = point[1];
1446
- if (point[0] > output.xMax)
1447
- output.xMax = point[0];
1448
- if (point[1] > output.yMax)
1449
- output.yMax = point[1];
1450
- return output;
1451
- }, { xMin: 0, yMin: 0, xMax: 0, yMax: 0 }), xMin = _a.xMin, yMin = _a.yMin, xMax = _a.xMax, yMax = _a.yMax;
1452
- var centerPoint = [(xMin + xMax) / 2, (yMin + yMax) / 2];
1453
- this._translate = [
1454
- canvas.width / 2 - centerPoint[0],
1455
- canvas.height / 2 - centerPoint[1],
1456
- ];
1457
- if (zoomToFit)
1458
- this.zoomFactor = Math.min((canvas.width - 80) / (xMax - xMin), (canvas.height - 80) / (yMax - yMin));
1459
- this.drawSpaces(canvas);
1460
- };
1461
- SpacesState.prototype.showGuideAtPoint = function (canvas, cursorPoint) {
1462
- var _this = this;
1463
- if (!this.guideSnappingEnabled)
1464
- return;
1465
- var clearGuides = function () {
1466
- if (!_this.guides)
1467
- return;
1468
- _this.guides = null;
1469
- _this.drawSpaces(canvas);
1470
- };
1471
- var point = this.transformPointFromCanvas(cursorPoint);
1472
- var elementAtPoint = this.getElementAddressAtPoint(point);
1473
- if (elementAtPoint) {
1474
- clearGuides();
1475
- if (elementAtPoint.type === types_1.IElements.WALL ||
1476
- elementAtPoint.type === types_1.IElements.VERTEX) {
1477
- this._highlightedElement = elementAtPoint;
1478
- this.drawSpaces(canvas);
1479
- }
1480
- return;
1481
- }
1482
- else if (this._highlightedElement) {
1483
- this._highlightedElement = null;
1484
- this.drawSpaces(canvas);
1485
- }
1486
- var snapPoint = this.getSnapVertexToGuideInProximity({
1487
- type: types_1.SNAPPING_TYPES.NONE,
1488
- point: point,
1489
- locked: [false, false],
1490
- }) || null;
1491
- if (snapPoint.type === types_1.SNAPPING_TYPES.NONE) {
1492
- clearGuides();
1493
- return;
1494
- }
1495
- else if (snapPoint.type === types_1.SNAPPING_TYPES.GUIDE) {
1496
- this.guides = snapPoint;
1497
- this.drawSpaces(canvas);
1498
- }
1499
- };
1500
- SpacesState.prototype.startDrawNewWall = function (startPoint) {
1501
- if (this.guides) {
1502
- this._newWall = {
1503
- start: __assign(__assign({ type: types_1.SNAPPING_TYPES.GUIDE }, this.guides), { locked: [true, true] }),
1504
- };
1505
- return;
1506
- }
1507
- var point = this.transformPointFromCanvas(startPoint);
1508
- var snapPoint = this.getSnapPointToElementInProximity(point);
1509
- snapPoint = this.getSnapPointToGridInProximity(snapPoint);
1510
- if (snapPoint.type === types_1.IElements.WINDOW ||
1511
- snapPoint.type === types_1.IElements.DOOR ||
1512
- snapPoint.type === types_1.IElements.OPENING)
1513
- return;
1514
- this._newWall = {
1515
- start: snapPoint,
1516
- };
1517
- };
1518
- SpacesState.prototype.drawNewWall = function (canvas, endPoint) {
1519
- var _a;
1520
- if (!this._newWall)
1521
- return;
1522
- var point = this.transformPointFromCanvas(endPoint);
1523
- var snapPoint = this.getSnapPointToElementInProximity(point);
1524
- snapPoint = this.getSnapVertexToGuideInProximity(snapPoint);
1525
- snapPoint = this.getSnapPointToAngleInProximity(snapPoint);
1526
- snapPoint = this.getSnapPointToGridInProximity(snapPoint);
1527
- if (this.guideSnappingEnabled) {
1528
- if (snapPoint.type === types_1.SNAPPING_TYPES.GUIDE ||
1529
- snapPoint.type === types_1.SNAPPING_TYPES.ANGLE ||
1530
- snapPoint.type === types_1.SNAPPING_TYPES.GRID)
1531
- this.guides = snapPoint;
1532
- else if (this.guides)
1533
- this.guides = null;
1534
- }
1535
- var wallLine = [
1536
- this._newWall.start.point,
1537
- snapPoint.point,
1538
- ];
1539
- var validationData = {
1540
- newWall: __assign({ line: wallLine }, this._newWall),
1541
- };
1542
- this._errorElement = this.runValidators([
1543
- validators_1.isWallEndingOnFeature,
1544
- validators_1.isWallTooShort,
1545
- validators_1.isWallOverlappingExisitingWalls,
1546
- validators_1.isWallIntersectingFeature,
1547
- ], validationData);
1548
- var errorType = ((_a = this._errorElement) === null || _a === void 0 ? void 0 : _a[0].type) || null;
1549
- switch (errorType) {
1550
- case types_1.IErrorTypes.HARD:
1551
- return;
1552
- case types_1.IErrorTypes.SOFT:
1553
- case types_1.IErrorTypes.WARN:
1554
- case null:
1555
- default:
1556
- this._newWall.end = snapPoint || { type: types_1.SNAPPING_TYPES.NONE, point: point };
1557
- this.drawSpaces(canvas);
1558
- break;
1559
- }
1560
- };
1561
- SpacesState.prototype.cancelDrawNewWall = function (canvas) {
1562
- this._newWall = null;
1563
- this._errorElement = null;
1564
- this._highlightedElement = null;
1565
- this.guides = null;
1566
- this.drawSpaces(canvas);
1567
- };
1568
- SpacesState.prototype.finishDrawNewWall = function (canvas, assetId) {
1569
- return __awaiter(this, void 0, void 0, function () {
1570
- var newWallAssetId, _a, start, end, wallsToExclude, filteredWalls, intersections, newWallLines;
1571
- var _this = this;
1572
- return __generator(this, function (_b) {
1573
- if (this._errorElement) {
1574
- if ([this._errorElement].flat()[0].message)
1575
- __1.message.info([this._errorElement].flat()[0].message);
1576
- this._newWall = null;
1577
- this._errorElement = null;
1578
- this._highlightedElement = null;
1579
- this.drawSpaces(canvas);
1580
- return [2];
1581
- }
1582
- newWallAssetId = assetId || this.attributeDefaults[types_1.IElements.WALL];
1583
- if (!newWallAssetId)
1584
- return [2];
1585
- _a = this._newWall || {}, start = _a.start, end = _a.end;
1586
- if (!start || !end) {
1587
- this._newWall = null;
1588
- this._errorElement = null;
1589
- this._highlightedElement = null;
1590
- return [2];
1591
- }
1592
- wallsToExclude = new Set([]);
1593
- if (start.type === types_1.IElements.WALL) {
1594
- this.splitWallAtPoint(start.index, start.point);
1595
- wallsToExclude.add(start.index);
1596
- }
1597
- if (end.type === types_1.IElements.WALL) {
1598
- this.splitWallAtPoint(end.index, end.point);
1599
- wallsToExclude.add(end.index);
1600
- }
1601
- if (wallsToExclude.size === 1)
1602
- wallsToExclude.add(this.wallCount - 1);
1603
- else if (wallsToExclude.size === 2)
1604
- wallsToExclude.add(this.wallCount - 1).add(this.wallCount - 2);
1605
- filteredWalls = this.walls.map(function (wall, i) {
1606
- return wallsToExclude.has(i) ? null : wall.line;
1607
- });
1608
- intersections = (0, geometry_1.getAllLineIntersections)([start.point, end.point], filteredWalls);
1609
- intersections.forEach(function (_a) {
1610
- var index = _a.index, point = _a.point;
1611
- return _this.splitWallAtPoint(index, point);
1612
- });
1613
- newWallLines = (0, geometry_1.splitLineAtPoints)([start.point, end.point], intersections.map(function (_a) {
1614
- var point = _a.point;
1615
- return point;
1616
- }));
1617
- this.addWalls(newWallLines.map(function (line) { return ({
1618
- assetId: newWallAssetId,
1619
- line: line,
1620
- connections: [],
1621
- restConfiguration: JSON.stringify({}),
1622
- visible: true,
1623
- }); }));
1624
- this._newWall = null;
1625
- this._errorElement = null;
1626
- this._highlightedElement = null;
1627
- this.guides = null;
1628
- this.pushStateToConfigurator();
1629
- return [2];
1630
- });
1631
- });
1632
- };
1633
- SpacesState.prototype.selectElementIfInProximity = function (canvas, cursorPoint) {
1634
- var point = this.transformPointFromCanvas(cursorPoint);
1635
- var elementAtPoint = this.getElementAddressAtPoint(point);
1636
- if (!elementAtPoint || elementAtPoint.type === types_1.IElements.WALL)
1637
- return;
1638
- this._activeElement = elementAtPoint;
1639
- if (elementAtPoint.type === types_1.IElements.VERTEX) {
1640
- var wallIndexes = this.getWallsConnectedToVertex(elementAtPoint.index);
1641
- this._highlightedElement = wallIndexes.map(function (index) { return ({
1642
- type: types_1.IElements.WALL,
1643
- index: index,
1644
- }); });
1645
- }
1646
- this.drawSpaces(canvas);
1647
- };
1648
- SpacesState.prototype.moveActiveElement = function (canvas, moveToPoint) {
1649
- if (!canvas)
1650
- return;
1651
- if (!this._activeElement)
1652
- return;
1653
- var point = this.transformPointFromCanvas(moveToPoint);
1654
- var type = this._activeElement.type;
1655
- if (type === types_1.IElements.VERTEX)
1656
- this.moveActiveVertex(canvas, point);
1657
- else if (type === types_1.IElements.WINDOW ||
1658
- type === types_1.IElements.DOOR ||
1659
- type === types_1.IElements.OPENING)
1660
- this.moveActiveFeature(canvas, point);
1661
- };
1662
- SpacesState.prototype.finishMoveActiveElement = function (canvas) {
1663
- if (!this._activeElement)
1664
- return;
1665
- if (this._errorElement) {
1666
- if ([this._errorElement].flat()[0].message)
1667
- __1.message.info([this._errorElement].flat()[0].message);
1668
- this._activeElement = null;
1669
- this._errorElement = null;
1670
- this._highlightedElement = null;
1671
- this.resetInternalState();
1672
- this.drawSpaces(canvas);
1673
- return;
1674
- }
1675
- var type = this._activeElement.type;
1676
- if (type === types_1.IElements.VERTEX)
1677
- this.finishMoveActiveVertex();
1678
- else if (type === types_1.IElements.WINDOW ||
1679
- type === types_1.IElements.DOOR ||
1680
- type === types_1.IElements.OPENING)
1681
- this.finishMoveActiveFeature();
1682
- this._activeElement = null;
1683
- this._errorElement = null;
1684
- this._highlightedElement = null;
1685
- this.drawSpaces(canvas);
1686
- };
1687
- SpacesState.prototype.cancelMoveActiveElement = function (canvas) {
1688
- this._activeElement = null;
1689
- this._errorElement = null;
1690
- this._highlightedElement = null;
1691
- this.resetInternalState();
1692
- this.drawSpaces(canvas);
1693
- };
1694
- SpacesState.prototype.drawSpaces = function (canvas) {
1695
- var _a, _b, _c, _d, _e, _f, _g;
1696
- if (!canvas)
1697
- return;
1698
- var highlighted = this._highlightedElement
1699
- ? [this._highlightedElement].flat()
1700
- : [];
1701
- var active = this._activeElement && this._activeElement.type !== types_1.IElements.VERTEX
1702
- ? [this._activeElement]
1703
- : [];
1704
- var error = this._errorElement
1705
- ? [this._errorElement]
1706
- .flat()
1707
- .reduce(function (output, _a) {
1708
- var address = _a.address;
1709
- return (address ? __spreadArray(__spreadArray([], output, true), [address], false) : output);
1710
- }, [])
1711
- : [];
1712
- var hidden = ((_a = this._activeElement) === null || _a === void 0 ? void 0 : _a.type) === types_1.IElements.VERTEX
1713
- ? [this._activeElement]
1714
- : [];
1715
- if (this.selectedElement)
1716
- highlighted.push(this.selectedElement);
1717
- var selection = {
1718
- highlighted: highlighted,
1719
- active: active,
1720
- error: error,
1721
- hidden: hidden,
1722
- };
1723
- var activeWallIndex;
1724
- if (this._showDimensions &&
1725
- (((_b = this._activeElement) === null || _b === void 0 ? void 0 : _b.type) === types_1.IElements.WINDOW ||
1726
- ((_c = this._activeElement) === null || _c === void 0 ? void 0 : _c.type) === types_1.IElements.DOOR ||
1727
- ((_d = this._activeElement) === null || _d === void 0 ? void 0 : _d.type) === types_1.IElements.OPENING))
1728
- activeWallIndex = (_e = this.getFeature(this._activeElement.type, this._activeElement.index)) === null || _e === void 0 ? void 0 : _e.connectedTo[1];
1729
- var guides = this.guides
1730
- ? __assign(__assign({}, this.guides), { point: this.transformPointToCanvas(this.guides.point) }) : this.guides;
1731
- (0, draw_1.drawSpaces)(canvas, this.gridToDraw, this.enclosedSpacesToDraw, this.wallsToDraw, this.verticesListToDraw, this.featuresToDraw, this.getDimensionToDraw(activeWallIndex), guides, selection, this._config.config);
1732
- if (((_f = this._newWall) === null || _f === void 0 ? void 0 : _f.start) && ((_g = this._newWall) === null || _g === void 0 ? void 0 : _g.end)) {
1733
- var newWallLine = [
1734
- this._newWall.start.point,
1735
- this._newWall.end.point,
1736
- ];
1737
- (0, draw_1.drawNewWall)(canvas, this.transformLineToCanvas(newWallLine), this.styles, this._errorElement ? types_1.IElementStyleModes.ERROR : undefined);
1738
- if (this._showDimensions) {
1739
- (0, draw_1.drawDimensions)(canvas, [
1740
- {
1741
- label: this.getWallDimensions(newWallLine).label,
1742
- line: this.transformLineToCanvas(newWallLine),
1743
- },
1744
- ], this._config.config);
1745
- }
1746
- }
1747
- };
1748
- return SpacesState;
1749
- }());
1750
- exports.SpacesState = SpacesState;
1751
- exports.default = SpacesState;