JS tree construction. See ext dec for schema and details

Element relations now determined during internal tree construction and
stored in the APP.Data.EntityMap, which is an instance of the EntityMap
inheriting from Map.

EntityMap has an index of all entity IDs like a hashmap, but each key
mapping is an object containing both entity information and hierachial
relations.

Schema of EntityMap entry:

key: "id" <!-- --> value: {
id: "id" // duplicate, may be removed in the future
type: "type",
generation: "gen", // how far this node is from root
state: { // state stores own state and collective states of children. If
children states are different then their respective state attrs are
initialized to -1, meaning partial
self: "self-state",
area: "areas",
curtain: "curtains",
door: "door",
light: "light",
lock: "lock",
window: "window"
}
parentId: "parentId",
ancestorIds: [], // list of parent of each parent up to root
childrenIds: [],
descendantIds: [], // list of children of each children up to each leaf
siblingIds: [], // list of parent' s children which are not self
siblingOfTypeIds: [], // list of parent's children which are not self
and are of own type
}

Todo:
Construct UI after EntityMap construction, using EntityMap. Currently UI
is constructed alongside EntityMap so aggregrate values cannot be
initialized properly due to how the algorithm runs.