diff --git a/B2Program/LandingGear/GearsDoors/LandingGear.json b/B2Program/LandingGear/GearsDoors/LandingGear.json
new file mode 100644
index 0000000000000000000000000000000000000000..8c0b59aac10a4ec69b5f448173983efe52d84b70
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/LandingGear.json
@@ -0,0 +1,228 @@
+{
+  "svg":"architecture.svg",
+  "items":[
+	  {
+		  "repeat": ["1", "2", "3"],
+		  "id":"eo_general_%0",
+		  "attr":"stroke",
+		  "value":"IF general_EV = TRUE THEN \"green\" ELSE \"red\" END"
+	  },
+	  {
+		  "repeat": ["1", "2"],
+		  "id":"eo_open_doors_%0",
+		  "attr":"stroke",
+		  "value":"IF open_EV = TRUE THEN \"green\" ELSE \"red\" END"
+	  },
+	  {
+		  "repeat": ["1", "2"],
+		  "id":"eo_close_doors_%0",
+		  "attr":"stroke",
+		  "value":"IF close_EV = TRUE THEN \"green\" ELSE \"red\" END"
+	  },
+	  {
+		  "repeat": ["1", "2"],
+		  "id":"eo_retract_gears_%0",
+		  "attr":"stroke",
+		  "value":"IF retract_EV = TRUE THEN \"green\" ELSE \"red\" END"
+	  },
+	  {
+		  "repeat": ["1", "2"],
+		  "id":"eo_extend_gears_%0",
+		  "attr":"stroke",
+		  "value":"IF extend_EV = TRUE THEN \"green\" ELSE \"red\" END"
+	  },
+	  {
+		  "for": {"from": "1", "to": "6"},
+		  "id":"hydraulic_circuit_%0",
+		  "attr":"stroke-width",
+		  "value":"IF general_valve = valve_open THEN 2 ELSE 1 END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3", "4", "5", "6"],
+		  "id":"hydraulic_circuit_%0",
+		  "attr":"stroke",
+		  "value":"IF general_valve = valve_open THEN \"#88d2f7\" ELSE \"#cccccc\" END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3", "4"],
+		  "id":"extension_circuit_doors_%0",
+		  "attr":"stroke-width",
+		  "value":"IF valve_open_door = valve_open THEN 2 ELSE 1 END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3", "4"],
+		  "id":"extension_circuit_doors_%0",
+		  "attr":"stroke",
+		  "value":"IF valve_open_door = valve_open THEN \"#88d2f7\" ELSE \"#cccccc\" END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3", "4"],
+		  "id":"retraction_circuit_doors_%0",
+		  "attr":"stroke-width",
+		  "value":"IF valve_close_door = valve_open THEN 2 ELSE 1 END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3", "4"],
+		  "id":"retraction_circuit_doors_%0",
+		  "attr":"stroke",
+		  "value":"IF valve_close_door = valve_open THEN \"#88d2f7\" ELSE \"#cccccc\" END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3", "4"],
+		  "id":"extension_circuit_gears_%0",
+		  "attr":"stroke-width",
+		  "value":"IF valve_extend_gear = valve_open THEN 2 ELSE 1 END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3", "4"],
+		  "id":"extension_circuit_gears_%0",
+		  "attr":"stroke",
+		  "value":"IF valve_extend_gear = valve_open THEN \"#88d2f7\" ELSE \"#cccccc\" END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3", "4"],
+		  "id":"retraction_circuit_gears_%0",
+		  "attr":"stroke-width",
+		  "value":"IF valve_retract_gear = valve_open THEN 2 ELSE 1 END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3", "4"],
+		  "id":"retraction_circuit_gears_%0",
+		  "attr":"stroke",
+		  "value":"IF valve_retract_gear = valve_open THEN \"#88d2f7\" ELSE \"#cccccc\" END"
+	  },
+	  
+	  {
+		  "id":"door_cylinder_forcer",
+		  "attr":"transform",
+		  "value":"{closed |-> \"translate(0,0)\", open |-> \"translate(90,0)\", door_moving |-> \"translate(45,0)\"}(door)"
+	  },
+	  {
+		  "id":"gear_cylinder_forcer",
+		  "attr":"transform",
+		  "value":"{extended |-> \"translate(0,0)\", retracted |-> \"translate(90,0)\", gear_moving |-> \"translate(45,0)\"}(gear)"
+	  },
+	  {
+		  "repeat": ["fr","lt", "rt"],
+		  "id":"%0_door_cylinder_forcer",
+		  "attr":"transform",
+		  "value":"{closed |-> \"translate(0,0)\", open |-> \"translate(90,0)\", door_moving |-> \"translate(45,0)\"}(doors(%0))"
+	  },
+	  {
+		  "repeat": ["fr","lt", "rt"],
+		  "id":"%0_gear_cylinder_forcer",
+		  "attr":"transform",
+		  "value":"{extended |-> \"translate(0,0)\", retracted |-> \"translate(90,0)\", gear_moving |-> \"translate(45,0)\"}(gears(%0))"
+	  },
+	  {
+		  "repeat": ["fr", "lt", "rt"],
+		  "id":"%0_door_cylinder_l",
+		  "attr":"fill",
+		  "value":"{closed |-> \"#cccccc\", open |-> \"#88d2f7\", door_moving |-> \"#88d2f7\"}(doors(%0))"
+	  },
+	  {
+		  "repeat": ["fr", "lt", "rt"],
+		  "id":"%0_door_cylinder_r",
+		  "attr":"fill",
+		  "value":"{closed |-> \"#cccccc\", open |-> \"#88d2f7\", door_moving |-> \"#cccccc\"}(doors(%0))"
+	  },
+	  {
+		  "repeat": ["fr","lt", "rt"],
+		  "id":"%0_gear_cylinder_l",
+		  "attr":"fill",
+		  "value":"{extended |-> \"#cccccc\", retracted |-> \"#88d2f7\", gear_moving |-> \"#88d2f7\"}(gears(%0))"
+	  },
+	  {
+		  "repeat": ["fr","lt", "rt"],
+		  "id":"%0_gear_cylinder_r",
+		  "attr":"fill",
+		  "value":"{extended |-> \"#cccccc\", retracted |-> \"#88d2f7\", gear_moving |-> \"#cccccc\"}(gears(%0))"
+	  },
+	  {
+		  "id":"ev_handle",
+		  "attr":"xlink:href",
+		  "value":"IF handle = up THEN \"img/handle_up.png\" ELSE \"img/handle_down.png\" END"
+	  },
+	  {
+		  "repeat": ["1", "2"],
+		  "id":"ev_general_%0",
+		  "attr":"fill",
+		  "value":"IF general_valve = valve_open THEN \"blue\" ELSE \"gray\" END"
+	  },
+	  {
+		  "repeat": ["1", "2"],
+		  "id":"ev_open_doors_%0",
+		  "attr":"fill",
+		  "value":"IF valve_open_door = valve_open THEN \"blue\" ELSE \"gray\" END"
+	  },
+	  {
+		  "repeat": ["1", "2"],
+		  "id":"ev_close_doors_%0",
+		  "attr":"fill",
+		  "value":"IF valve_close_door = valve_open THEN \"blue\" ELSE \"gray\" END"
+	  },
+	  {
+		  "repeat": ["1", "2"],
+		  "id":"ev_extended_gears_%0",
+		  "attr":"fill",
+		  "value":"IF valve_extend_gear = valve_open THEN \"blue\" ELSE \"gray\" END"
+	  },
+	  {
+		  "repeat": ["1", "2"],
+		  "id":"ev_retraction_gears_%0",
+		  "attr":"fill",
+		  "value":"IF valve_retract_gear = valve_open THEN \"blue\" ELSE \"gray\" END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3"],
+		  "id":"analogical_switch_%0",
+		  "attr":"fill",
+		  "value":"IF general_EV = TRUE THEN \"green\" ELSE \"red\" END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3"],
+		  "id":"analogical_switch_%0",
+		  "attr":"stroke",
+		  "value":"IF general_EV = TRUE THEN \"green\" ELSE \"red\" END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3"],
+		  "id":"close_switch_%0",
+		  "attr":"fill",
+		  "value":"IF general_EV = TRUE THEN \"green\" ELSE \"red\" END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3"],
+		  "id":"close_switch_%0",
+		  "attr":"stroke",
+		  "value":"IF general_EV = TRUE THEN \"green\" ELSE \"red\" END"
+	  },
+	  {
+		  "id":"analogical_switch_open",
+		  "attr":"visibility",
+		  "value":"IF analogical_switch = switch_open THEN \"visible\" ELSE \"hidden\" END"
+	  },
+	  {
+		  "id":"analogical_switch_closed",
+		  "attr":"visibility",
+		  "value":"IF analogical_switch = switch_closed THEN \"visible\" ELSE \"hidden\" END"
+	  }
+  ],
+  "events": [
+	  {
+		"id":"con_stimulate_general_valve",
+		"event":"con_stimulate_general_valve",
+		"predicates":[]
+	  },
+	  {
+		"id":"close_switch_1",
+		"event":"env_open_analogical_switch",
+		"predicates":[]
+	  },
+	  {
+		"id":"open_switch",
+		"event":"env_close_analogical_switch",
+		"predicates":[]
+	  }
+  ]
+}
diff --git a/B2Program/LandingGear/GearsDoors/LandingGear_GearsDoors.json b/B2Program/LandingGear/GearsDoors/LandingGear_GearsDoors.json
new file mode 100644
index 0000000000000000000000000000000000000000..41740571b2a82a9e57e50d0766a5f1b9d40523e0
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/LandingGear_GearsDoors.json
@@ -0,0 +1,18 @@
+{
+  "svg":"physical.svg",
+  "items":[
+    {
+		  "repeat": ["fr", "lt", "rt"],
+		  "id":"door_%0",
+		  "attr":"xlink:href",
+		  "value":"IF doors(%0) = open THEN \"img/door_open.png\" ELSIF doors(%0) = closed \"img/door_closed.png\" ELSE \"img/door_door_moving.png\" END"
+	  },
+    {
+		  "repeat": ["fr", "lt", "rt"],
+		  "id":"gear_%0",
+		  "attr":"xlink:href",
+		  "value":"IF gears(%0) = extended THEN \"img/gear_extended.png\" ELSIF gears(%0) = retracted \"img/gear_retracted.png\" ELSE \"img/gear_gear_moving.png\" END"
+	  }
+  ],
+  "events": []
+}
diff --git a/B2Program/LandingGear/GearsDoors/LandingGear_R6-visualisation.js b/B2Program/LandingGear/GearsDoors/LandingGear_R6-visualisation.js
new file mode 100644
index 0000000000000000000000000000000000000000..c9c1b778e966a8432920280fa23f005e8e2ef8a9
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/LandingGear_R6-visualisation.js
@@ -0,0 +1,3397 @@
+import LandingGear_R6 from "./LandingGear_R6.js";
+import {SelectError} from "./btypes/BUtils.js";
+import {VALVE_STATE} from "./LandingGear_R6.js"
+import {DOOR_STATE} from "./LandingGear_R6.js"
+import {GEAR_STATE} from "./LandingGear_R6.js"
+import {POSITION} from "./LandingGear_R6.js"
+import {HANDLE_STATE} from "./LandingGear_R6.js"
+import {PLANE_STATE} from "./LandingGear_R6.js"
+import {SWITCH_STATE} from "./LandingGear_R6.js"
+
+import {enum_VALVE_STATE} from "./LandingGear_R6.js"
+import {enum_DOOR_STATE} from "./LandingGear_R6.js"
+import {enum_GEAR_STATE} from "./LandingGear_R6.js"
+import {enum_POSITION} from "./LandingGear_R6.js"
+import {enum_HANDLE_STATE} from "./LandingGear_R6.js"
+import {enum_PLANE_STATE} from "./LandingGear_R6.js"
+import {enum_SWITCH_STATE} from "./LandingGear_R6.js"
+
+import {BTuple} from "./btypes/BTuple.js";
+import {BSet} from "./btypes/BSet.js";
+import {BRelation} from "./btypes/BRelation.js";
+import {BBoolean} from "./btypes/BBoolean.js";
+import {BObject} from "./btypes/BObject.js";
+import {BString} from "./btypes/BString.js";
+
+var _machine = new LandingGear_R6();
+var _state_list = [];
+var _transition_list = [];
+var _included_machines = {};
+_included_machines["LandingGear_R6"] = function(){return _machine};
+var _state_view_vars = document.getElementById("_state_view_variables");
+var _state_view_consts = document.getElementById("_state_view_constants");
+var _state_view_sets = document.getElementById("_state_view_sets");
+var _state_view_invariant = document.getElementById("_state_view_invariant");
+var _svg_vars = {}
+_svg_vars["door_lt"] = document.getElementById("physical").contentDocument.getElementById("door_lt")
+_svg_vars["gear_rt"] = document.getElementById("physical").contentDocument.getElementById("gear_rt")
+_svg_vars["door_fr"] = document.getElementById("physical").contentDocument.getElementById("door_fr")
+_svg_vars["door_rt"] = document.getElementById("physical").contentDocument.getElementById("door_rt")
+_svg_vars["gear_fr"] = document.getElementById("physical").contentDocument.getElementById("gear_fr")
+_svg_vars["gear_lt"] = document.getElementById("physical").contentDocument.getElementById("gear_lt")
+var _machine_vars = {}
+var _var_label;
+var _var_div;
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_analogical_switch();
+_var_div.id = "_var_analogical_switch";
+_machine_vars["analogical_switch"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_analogical_switch";
+_var_label.innerHTML = "LandingGear_R6.analogical_switch";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_general_EV();
+_var_div.id = "_var_general_EV";
+_machine_vars["general_EV"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_general_EV";
+_var_label.innerHTML = "LandingGear_R6.general_EV";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_general_valve();
+_var_div.id = "_var_general_valve";
+_machine_vars["general_valve"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_general_valve";
+_var_label.innerHTML = "LandingGear_R6.general_valve";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_handle_move();
+_var_div.id = "_var_handle_move";
+_machine_vars["handle_move"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_handle_move";
+_var_label.innerHTML = "LandingGear_R6.handle_move";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_close_EV();
+_var_div.id = "_var_close_EV";
+_machine_vars["close_EV"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_close_EV";
+_var_label.innerHTML = "LandingGear_R6.close_EV";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_extend_EV();
+_var_div.id = "_var_extend_EV";
+_machine_vars["extend_EV"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_extend_EV";
+_var_label.innerHTML = "LandingGear_R6.extend_EV";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_open_EV();
+_var_div.id = "_var_open_EV";
+_machine_vars["open_EV"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_open_EV";
+_var_label.innerHTML = "LandingGear_R6.open_EV";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_retract_EV();
+_var_div.id = "_var_retract_EV";
+_machine_vars["retract_EV"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_retract_EV";
+_var_label.innerHTML = "LandingGear_R6.retract_EV";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_shock_absorber();
+_var_div.id = "_var_shock_absorber";
+_machine_vars["shock_absorber"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_shock_absorber";
+_var_label.innerHTML = "LandingGear_R6.shock_absorber";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_valve_close_door();
+_var_div.id = "_var_valve_close_door";
+_machine_vars["valve_close_door"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_valve_close_door";
+_var_label.innerHTML = "LandingGear_R6.valve_close_door";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_valve_extend_gear();
+_var_div.id = "_var_valve_extend_gear";
+_machine_vars["valve_extend_gear"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_valve_extend_gear";
+_var_label.innerHTML = "LandingGear_R6.valve_extend_gear";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_valve_open_door();
+_var_div.id = "_var_valve_open_door";
+_machine_vars["valve_open_door"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_valve_open_door";
+_var_label.innerHTML = "LandingGear_R6.valve_open_door";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_valve_retract_gear();
+_var_div.id = "_var_valve_retract_gear";
+_machine_vars["valve_retract_gear"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_valve_retract_gear";
+_var_label.innerHTML = "LandingGear_R6.valve_retract_gear";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_doors();
+_var_div.id = "_var_doors";
+_machine_vars["doors"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_doors";
+_var_label.innerHTML = "LandingGear_R6.doors";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_gears();
+_var_div.id = "_var_gears";
+_machine_vars["gears"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_gears";
+_var_label.innerHTML = "LandingGear_R6.gears";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_handle();
+_var_div.id = "_var_handle";
+_machine_vars["handle"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_handle";
+_var_label.innerHTML = "LandingGear_R6.handle";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_door();
+_var_div.id = "_var_door";
+_machine_vars["door"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_door";
+_var_label.innerHTML = "LandingGear_R6.door";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_gear();
+_var_div.id = "_var_gear";
+_machine_vars["gear"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_gear";
+_var_label.innerHTML = "LandingGear_R6.gear";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get__DOOR_STATE();
+_var_div.id = "_var_DOOR_STATE";
+_machine_vars["DOOR_STATE"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_DOOR_STATE";
+_var_label.innerHTML = "LandingGear_R6.DOOR_STATE";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get__GEAR_STATE();
+_var_div.id = "_var_GEAR_STATE";
+_machine_vars["GEAR_STATE"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_GEAR_STATE";
+_var_label.innerHTML = "LandingGear_R6.GEAR_STATE";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get__HANDLE_STATE();
+_var_div.id = "_var_HANDLE_STATE";
+_machine_vars["HANDLE_STATE"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_HANDLE_STATE";
+_var_label.innerHTML = "LandingGear_R6.HANDLE_STATE";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get__POSITION();
+_var_div.id = "_var_POSITION";
+_machine_vars["POSITION"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_POSITION";
+_var_label.innerHTML = "LandingGear_R6.POSITION";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get__SWITCH_STATE();
+_var_div.id = "_var_SWITCH_STATE";
+_machine_vars["SWITCH_STATE"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_SWITCH_STATE";
+_var_label.innerHTML = "LandingGear_R6.SWITCH_STATE";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get__PLANE_STATE();
+_var_div.id = "_var_PLANE_STATE";
+_machine_vars["PLANE_STATE"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_PLANE_STATE";
+_var_label.innerHTML = "LandingGear_R6.PLANE_STATE";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get__VALVE_STATE();
+_var_div.id = "_var_VALVE_STATE";
+_machine_vars["VALVE_STATE"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_VALVE_STATE";
+_var_label.innerHTML = "LandingGear_R6.VALVE_STATE";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_1();
+_var_div.id = "_check_inv_1";
+_machine_vars["_check_inv_1"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_1";
+_var_label.innerHTML = "analogical_switch:SWITCH_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_2();
+_var_div.id = "_check_inv_2";
+_machine_vars["_check_inv_2"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_2";
+_var_label.innerHTML = "general_EV:BOOL";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_3();
+_var_div.id = "_check_inv_3";
+_machine_vars["_check_inv_3"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_3";
+_var_label.innerHTML = "general_valve:VALVE_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_4();
+_var_div.id = "_check_inv_4";
+_machine_vars["_check_inv_4"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_4";
+_var_label.innerHTML = "handle_move:BOOL";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_5();
+_var_div.id = "_check_inv_5";
+_machine_vars["_check_inv_5"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_5";
+_var_label.innerHTML = "close_EV:BOOL";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_6();
+_var_div.id = "_check_inv_6";
+_machine_vars["_check_inv_6"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_6";
+_var_label.innerHTML = "extend_EV:BOOL";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_7();
+_var_div.id = "_check_inv_7";
+_machine_vars["_check_inv_7"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_7";
+_var_label.innerHTML = "open_EV:BOOL";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_8();
+_var_div.id = "_check_inv_8";
+_machine_vars["_check_inv_8"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_8";
+_var_label.innerHTML = "retract_EV:BOOL";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_9();
+_var_div.id = "_check_inv_9";
+_machine_vars["_check_inv_9"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_9";
+_var_label.innerHTML = "shock_absorber:PLANE_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_10();
+_var_div.id = "_check_inv_10";
+_machine_vars["_check_inv_10"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_10";
+_var_label.innerHTML = "valve_close_door:VALVE_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_11();
+_var_div.id = "_check_inv_11";
+_machine_vars["_check_inv_11"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_11";
+_var_label.innerHTML = "valve_extend_gear:VALVE_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_12();
+_var_div.id = "_check_inv_12";
+_machine_vars["_check_inv_12"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_12";
+_var_label.innerHTML = "valve_open_door:VALVE_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_13();
+_var_div.id = "_check_inv_13";
+_machine_vars["_check_inv_13"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_13";
+_var_label.innerHTML = "valve_retract_gear:VALVE_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_14();
+_var_div.id = "_check_inv_14";
+_machine_vars["_check_inv_14"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_14";
+_var_label.innerHTML = "handle:HANDLE_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_15();
+_var_div.id = "_check_inv_15";
+_machine_vars["_check_inv_15"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_15";
+_var_label.innerHTML = "door:DOOR_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_16();
+_var_div.id = "_check_inv_16";
+_machine_vars["_check_inv_16"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_16";
+_var_label.innerHTML = "gear:GEAR_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_17();
+_var_div.id = "_check_inv_17";
+_machine_vars["_check_inv_17"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_17";
+_var_label.innerHTML = "(open_EV=TRUEorclose_EV=TRUEorretract_EV=TRUEorextend_EV=TRUE)=>general_EV=TRUE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_18();
+_var_div.id = "_check_inv_18";
+_machine_vars["_check_inv_18"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_18";
+_var_label.innerHTML = "not(open_EV=TRUE&close_EV=TRUE)";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_19();
+_var_div.id = "_check_inv_19";
+_machine_vars["_check_inv_19"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_19";
+_var_label.innerHTML = "gears:POSITION-->GEAR_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_20();
+_var_div.id = "_check_inv_20";
+_machine_vars["_check_inv_20"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_20";
+_var_label.innerHTML = "doors:POSITION-->DOOR_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_21();
+_var_div.id = "_check_inv_21";
+_machine_vars["_check_inv_21"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_21";
+_var_label.innerHTML = "door=closed<=>ran(doors)={closed}";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_22();
+_var_div.id = "_check_inv_22";
+_machine_vars["_check_inv_22"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_22";
+_var_label.innerHTML = "door=open<=>ran(doors)={open}";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_23();
+_var_div.id = "_check_inv_23";
+_machine_vars["_check_inv_23"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_23";
+_var_label.innerHTML = "gear=extended<=>ran(gears)={extended}";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_24();
+_var_div.id = "_check_inv_24";
+_machine_vars["_check_inv_24"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_24";
+_var_label.innerHTML = "gear=retracted<=>ran(gears)={retracted}";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_25();
+_var_div.id = "_check_inv_25";
+_machine_vars["_check_inv_25"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_25";
+_var_label.innerHTML = "gear=gear_moving=>door=open";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+
+function updateVisuals () {
+  _svg_vars["door_lt"].setAttribute("xlink:href", new BRelation(new BTuple(new DOOR_STATE(enum_DOOR_STATE.open), new BString("img/door_open.png")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.closed), new BString("img/door_closed.png")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.door_moving), new BString("img/door_door_moving.png"))).functionCall(_machine._get_doors().functionCall(new POSITION(enum_POSITION.lt))).getValue());
+  _svg_vars["gear_rt"].setAttribute("xlink:href", new BRelation(new BTuple(new GEAR_STATE(enum_GEAR_STATE.extended), new BString("img/gear_extended.png")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.retracted), new BString("img/gear_retracted.png")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new BString("img/gear_gear_moving.png"))).functionCall(_machine._get_gears().functionCall(new POSITION(enum_POSITION.rt))).getValue());
+  _svg_vars["gear_fr"].setAttribute("xlink:href", new BRelation(new BTuple(new GEAR_STATE(enum_GEAR_STATE.extended), new BString("img/gear_extended.png")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.retracted), new BString("img/gear_retracted.png")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new BString("img/gear_gear_moving.png"))).functionCall(_machine._get_gears().functionCall(new POSITION(enum_POSITION.fr))).getValue());
+  _svg_vars["door_rt"].setAttribute("xlink:href", new BRelation(new BTuple(new DOOR_STATE(enum_DOOR_STATE.open), new BString("img/door_open.png")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.closed), new BString("img/door_closed.png")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.door_moving), new BString("img/door_door_moving.png"))).functionCall(_machine._get_doors().functionCall(new POSITION(enum_POSITION.rt))).getValue());
+  _svg_vars["gear_lt"].setAttribute("xlink:href", new BRelation(new BTuple(new GEAR_STATE(enum_GEAR_STATE.extended), new BString("img/gear_extended.png")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.retracted), new BString("img/gear_retracted.png")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new BString("img/gear_gear_moving.png"))).functionCall(_machine._get_gears().functionCall(new POSITION(enum_POSITION.lt))).getValue());
+  _svg_vars["door_fr"].setAttribute("xlink:href", new BRelation(new BTuple(new DOOR_STATE(enum_DOOR_STATE.open), new BString("img/door_open.png")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.closed), new BString("img/door_closed.png")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.door_moving), new BString("img/door_door_moving.png"))).functionCall(_machine._get_doors().functionCall(new POSITION(enum_POSITION.fr))).getValue());
+  _machine_vars["analogical_switch"].innerHTML = _included_machines["LandingGear_R6"]()._get_analogical_switch();
+  _machine_vars["general_EV"].innerHTML = _included_machines["LandingGear_R6"]()._get_general_EV();
+  _machine_vars["general_valve"].innerHTML = _included_machines["LandingGear_R6"]()._get_general_valve();
+  _machine_vars["handle_move"].innerHTML = _included_machines["LandingGear_R6"]()._get_handle_move();
+  _machine_vars["close_EV"].innerHTML = _included_machines["LandingGear_R6"]()._get_close_EV();
+  _machine_vars["extend_EV"].innerHTML = _included_machines["LandingGear_R6"]()._get_extend_EV();
+  _machine_vars["open_EV"].innerHTML = _included_machines["LandingGear_R6"]()._get_open_EV();
+  _machine_vars["retract_EV"].innerHTML = _included_machines["LandingGear_R6"]()._get_retract_EV();
+  _machine_vars["shock_absorber"].innerHTML = _included_machines["LandingGear_R6"]()._get_shock_absorber();
+  _machine_vars["valve_close_door"].innerHTML = _included_machines["LandingGear_R6"]()._get_valve_close_door();
+  _machine_vars["valve_extend_gear"].innerHTML = _included_machines["LandingGear_R6"]()._get_valve_extend_gear();
+  _machine_vars["valve_open_door"].innerHTML = _included_machines["LandingGear_R6"]()._get_valve_open_door();
+  _machine_vars["valve_retract_gear"].innerHTML = _included_machines["LandingGear_R6"]()._get_valve_retract_gear();
+  _machine_vars["doors"].innerHTML = _included_machines["LandingGear_R6"]()._get_doors();
+  _machine_vars["gears"].innerHTML = _included_machines["LandingGear_R6"]()._get_gears();
+  _machine_vars["handle"].innerHTML = _included_machines["LandingGear_R6"]()._get_handle();
+  _machine_vars["door"].innerHTML = _included_machines["LandingGear_R6"]()._get_door();
+  _machine_vars["gear"].innerHTML = _included_machines["LandingGear_R6"]()._get_gear();
+  for (let i = 1; i <= 25; i++) {
+    _machine_vars["_check_inv_"+i].innerHTML = _machine["_check_inv_"+i]();
+  }
+  checkTransitions();
+}
+
+var _history_view_buttons = document.getElementById("_history_view_buttons");
+var _buttonLeft = document.createElement("button");
+var _buttonRight = document.createElement("button");
+var _buttonUpload = document.createElement("button");
+var _buttonExport = document.createElement("button");
+var _inputUpload = document.createElement("input");
+var _buttonRun10 = document.createElement("button");
+var _buttonRun500 = document.createElement("button");
+
+function flattenTuple(tuple) {
+    if(!(tuple instanceof BTuple)) {
+        return [tuple];
+    }
+    return [tuple.projection1(), ...flattenTuple(tuple.projection2())];
+}
+
+function createOptionList(event, transition) {
+    let collator = new Intl.Collator([], {numeric: true});
+    for(let index in _machine_events[event].parameterNames) {
+        let parameter = _machine_events[event].parameterNames[index];
+        var datalist = document.querySelector("#" + event + "_" + parameter + "_datalist");
+        datalist.replaceChildren();
+        for(let value of Array.of(...transition).sort((a, b) => collator.compare(a, b))) {
+            let option = document.createElement("option");
+            value = flattenTuple(value);
+            option.text = value[index].toString();
+            datalist.appendChild(option);
+        }
+    }
+}
+
+function checkTransitions () {
+    let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+    for(event in _machine_events) {
+      var transition;
+      if(_transition_list[index]?.[event] == null ?? true) {
+         transition = _machine["_tr_" + event]();
+         _transition_list[index][event] = transition;
+      } else {
+         transition = _transition_list[index][event];
+      }
+      if(!(transition instanceof BSet)) {
+        _machine_events[event].disabled = !transition;
+      } else if (transition.size().intValue() == 0) {
+        _machine_events[event].disabled = true;
+      } else {
+        let collator = new Intl.Collator([], {numeric: true});
+        for(let current_transition of transition) {
+            try {
+                var current_machine = _machine._copy();
+                current_machine[event](...flattenTuple(current_transition));
+            } catch (error) {
+                  if(! error instanceof SelectError) {
+                      throw error;
+                  }
+                  transition = transition.difference(new BSet(current_transition));
+            }
+        }
+        if(transition.size().intValue() == 0) {
+            _machine_events[event].disabled = true;
+        } else {
+            _machine_events[event].disabled = false;
+        }
+        createOptionList(event, transition);
+      }
+    }
+    _buttonLeft.disabled = document.querySelector(".active").index <= 0;
+    _buttonRight.disabled = document.querySelector(".active").index >= document.querySelector("span:last-of-type").index;
+}
+
+_operations_view = document.getElementById("_operations_view");
+_history_view = document.getElementById("_history_view");
+_scenario_view = document.getElementById("_scenario_view");
+
+var _history_onclick_function = function () {
+  _machine = _state_list[this.index]._copy();
+  document.querySelectorAll("span").forEach(el => el.classList.remove("active"));
+  this.classList.add("active");
+  updateVisuals();
+}
+
+function createHistoryElement(text, index) {
+  var history_element = document.createElement("span");
+  history_element.innerHTML = text + "</br>";
+  history_element.index = index;
+  document.querySelectorAll("span.active").forEach(element => element.classList.remove("active"));
+  history_element.classList.add("active");
+  history_element.onclick = _history_onclick_function;
+  _state_list = _state_list.slice(0, index);
+  _state_list.push(_machine._copy());
+  _transition_list = _transition_list.slice(0, index);
+  _transition_list.push({});
+  while(_history_view.querySelectorAll("span").length > index && _history_view.lastChild !== null) {
+    _history_view.removeChild(_history_view.lastChild);
+  }
+  _history_view.appendChild(history_element);
+}
+
+function selectHistoryElement(offset) {
+  let currentHistoryElement = _history_view.querySelector(".active");
+  let index = currentHistoryElement.index + offset;
+  if (index < 0 || index >= _state_list.length) {
+    return;
+  }
+  currentHistoryElement.classList.remove("active");
+  _machine = _state_list[index]._copy();
+  _history_view.querySelectorAll(".active").forEach(el => el.classList.remove("active"));
+  currentHistoryElement = _history_view.querySelector("span:nth-of-type(" + (index + 1) + ")");
+  currentHistoryElement.classList.add("active");
+  updateVisuals();
+}
+
+function createScenarioElement(text, trace) {
+  var scenario_element = document.createElement("button");
+  var remove_element = document.createElement("button");
+  scenario_element.innerHTML = text + "</br>";
+  remove_element.innerHTML = "X";
+  var div_element = document.createElement("div");
+  div_element.appendChild(scenario_element);
+  div_element.appendChild(remove_element);
+  _scenario_view.appendChild(div_element);
+  scenario_element.onclick = function() {
+    displayTrace(trace);
+  };
+  remove_element.onclick = function() {
+    _scenario_view.removeChild(div_element);
+  };
+}
+
+
+_buttonLeft.innerHTML="&#9664;";
+_buttonLeft.onclick = function(){selectHistoryElement(-1)};
+_buttonRight.innerHTML="&#9654;";
+_buttonRight.onclick = function(){selectHistoryElement(1)};
+_history_view_buttons.appendChild(_buttonLeft);
+_history_view_buttons.appendChild(_buttonRight);
+
+_buttonUpload.textContent = "Import trace";
+_buttonUpload.onclick = importTrace;
+_history_view_buttons.appendChild(_buttonUpload);
+
+_buttonExport.textContent = "Export trace";
+_buttonExport.onclick = exportTrace;
+_history_view_buttons.appendChild(_buttonExport);
+
+_buttonRun10.textContent = "Run trace(10ms)";
+_buttonRun10.onclick = function(){runTrace(10);};
+_history_view_buttons.appendChild(_buttonRun10);
+
+_buttonRun500.textContent = "Run trace(500ms)";
+_buttonRun500.onclick = function(){runTrace(500);};
+_history_view_buttons.appendChild(_buttonRun500);
+
+createHistoryElement("Initialisation", 0);
+var _current_trace = [{name: "$initialise_machine", params: {}}];
+
+var _param_div;
+var _param_datalist;
+var _onclick_function;
+var _machine_events = {};
+var _svg_events = {};
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_retract_gear_skip"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_retract_gear_skip_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_retract_gear_skip_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_retract_gear_skip"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_retract_gear_skip"].style.gridColumn="-1";
+_machine_events["env_retract_gear_skip"].innerHTML = "env_retract_gear_skip";
+_machine_events["env_retract_gear_skip"].parameterNames = ["gr", ];
+_machine_events["env_retract_gear_skip"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_retract_gear_skip"] == null ?? true) {
+      transition = _machine["_tr_env_retract_gear_skip"]();
+      _transition_list[index]["env_retract_gear_skip"] = transition;
+  } else {
+      transition = _transition_list[index]["env_retract_gear_skip"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_retract_gear_skip is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_retract_gear_skip"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_retract_gear_skip!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_retract_gear_skip!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_retract_gear_skip"]["gr"].getValue(), ];
+    var returnValue = _machine.env_retract_gear_skip(...parameters);
+    createHistoryElement("env_retract_gear_skip(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_retract_gear_skip"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_retract_gear_skip", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_retract_gear_skip"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_retract_gear_skip"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_retract_gear_skip"].disabled = true;
+        }
+        createOptionList("env_retract_gear_skip", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_retract_gear_skip"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["close_valve_retract_gear"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["close_valve_retract_gear"].style.gridColumn="-1";
+_machine_events["close_valve_retract_gear"].innerHTML = "close_valve_retract_gear";
+_machine_events["close_valve_retract_gear"].parameterNames = [];
+_machine_events["close_valve_retract_gear"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["close_valve_retract_gear"] == null ?? true) {
+      transition = _machine["_tr_close_valve_retract_gear"]();
+      _transition_list[index]["close_valve_retract_gear"] = transition;
+  } else {
+      transition = _transition_list[index]["close_valve_retract_gear"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event close_valve_retract_gear is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event close_valve_retract_gear!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event close_valve_retract_gear!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.close_valve_retract_gear(...parameters);
+    createHistoryElement("close_valve_retract_gear(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "close_valve_retract_gear", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["close_valve_retract_gear"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["close_valve_retract_gear"].disabled = true;
+        }
+        createOptionList("close_valve_retract_gear", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["close_valve_retract_gear"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["evn_close_general_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["evn_close_general_valve"].style.gridColumn="-1";
+_machine_events["evn_close_general_valve"].innerHTML = "evn_close_general_valve";
+_machine_events["evn_close_general_valve"].parameterNames = [];
+_machine_events["evn_close_general_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["evn_close_general_valve"] == null ?? true) {
+      transition = _machine["_tr_evn_close_general_valve"]();
+      _transition_list[index]["evn_close_general_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["evn_close_general_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event evn_close_general_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event evn_close_general_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event evn_close_general_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.evn_close_general_valve(...parameters);
+    createHistoryElement("evn_close_general_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "evn_close_general_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["evn_close_general_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["evn_close_general_valve"].disabled = true;
+        }
+        createOptionList("evn_close_general_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["evn_close_general_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["close_valve_extend_gear"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["close_valve_extend_gear"].style.gridColumn="-1";
+_machine_events["close_valve_extend_gear"].innerHTML = "close_valve_extend_gear";
+_machine_events["close_valve_extend_gear"].parameterNames = [];
+_machine_events["close_valve_extend_gear"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["close_valve_extend_gear"] == null ?? true) {
+      transition = _machine["_tr_close_valve_extend_gear"]();
+      _transition_list[index]["close_valve_extend_gear"] = transition;
+  } else {
+      transition = _transition_list[index]["close_valve_extend_gear"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event close_valve_extend_gear is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event close_valve_extend_gear!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event close_valve_extend_gear!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.close_valve_extend_gear(...parameters);
+    createHistoryElement("close_valve_extend_gear(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "close_valve_extend_gear", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["close_valve_extend_gear"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["close_valve_extend_gear"].disabled = true;
+        }
+        createOptionList("close_valve_extend_gear", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["close_valve_extend_gear"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_open_analogical_switch"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_open_analogical_switch"].style.gridColumn="-1";
+_machine_events["env_open_analogical_switch"].innerHTML = "env_open_analogical_switch";
+_machine_events["env_open_analogical_switch"].parameterNames = [];
+_machine_events["env_open_analogical_switch"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_open_analogical_switch"] == null ?? true) {
+      transition = _machine["_tr_env_open_analogical_switch"]();
+      _transition_list[index]["env_open_analogical_switch"] = transition;
+  } else {
+      transition = _transition_list[index]["env_open_analogical_switch"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_open_analogical_switch is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_open_analogical_switch!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_open_analogical_switch!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.env_open_analogical_switch(...parameters);
+    createHistoryElement("env_open_analogical_switch(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "env_open_analogical_switch", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_open_analogical_switch"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_open_analogical_switch"].disabled = true;
+        }
+        createOptionList("env_open_analogical_switch", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_open_analogical_switch"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["close_valve_door_open"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["close_valve_door_open"].style.gridColumn="-1";
+_machine_events["close_valve_door_open"].innerHTML = "close_valve_door_open";
+_machine_events["close_valve_door_open"].parameterNames = [];
+_machine_events["close_valve_door_open"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["close_valve_door_open"] == null ?? true) {
+      transition = _machine["_tr_close_valve_door_open"]();
+      _transition_list[index]["close_valve_door_open"] = transition;
+  } else {
+      transition = _transition_list[index]["close_valve_door_open"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event close_valve_door_open is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event close_valve_door_open!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event close_valve_door_open!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.close_valve_door_open(...parameters);
+    createHistoryElement("close_valve_door_open(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "close_valve_door_open", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["close_valve_door_open"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["close_valve_door_open"].disabled = true;
+        }
+        createOptionList("close_valve_door_open", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["close_valve_door_open"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_start_extending"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_start_extending_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_start_extending_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_start_extending"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_start_extending"].style.gridColumn="-1";
+_machine_events["env_start_extending"].innerHTML = "env_start_extending";
+_machine_events["env_start_extending"].parameterNames = ["gr", ];
+_machine_events["env_start_extending"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_start_extending"] == null ?? true) {
+      transition = _machine["_tr_env_start_extending"]();
+      _transition_list[index]["env_start_extending"] = transition;
+  } else {
+      transition = _transition_list[index]["env_start_extending"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_start_extending is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_start_extending"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_start_extending!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_start_extending!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_start_extending"]["gr"].getValue(), ];
+    var returnValue = _machine.env_start_extending(...parameters);
+    createHistoryElement("env_start_extending(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_start_extending"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_start_extending", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_start_extending"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_start_extending"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_start_extending"].disabled = true;
+        }
+        createOptionList("env_start_extending", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_start_extending"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stimulate_extend_gear_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stimulate_extend_gear_valve"].style.gridColumn="-1";
+_machine_events["con_stimulate_extend_gear_valve"].innerHTML = "con_stimulate_extend_gear_valve";
+_machine_events["con_stimulate_extend_gear_valve"].parameterNames = [];
+_machine_events["con_stimulate_extend_gear_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stimulate_extend_gear_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stimulate_extend_gear_valve"]();
+      _transition_list[index]["con_stimulate_extend_gear_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stimulate_extend_gear_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stimulate_extend_gear_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stimulate_extend_gear_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stimulate_extend_gear_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stimulate_extend_gear_valve(...parameters);
+    createHistoryElement("con_stimulate_extend_gear_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stimulate_extend_gear_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stimulate_extend_gear_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stimulate_extend_gear_valve"].disabled = true;
+        }
+        createOptionList("con_stimulate_extend_gear_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stimulate_extend_gear_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["toggle_handle_down"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["toggle_handle_down"].style.gridColumn="-1";
+_machine_events["toggle_handle_down"].innerHTML = "toggle_handle_down";
+_machine_events["toggle_handle_down"].parameterNames = [];
+_machine_events["toggle_handle_down"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["toggle_handle_down"] == null ?? true) {
+      transition = _machine["_tr_toggle_handle_down"]();
+      _transition_list[index]["toggle_handle_down"] = transition;
+  } else {
+      transition = _transition_list[index]["toggle_handle_down"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event toggle_handle_down is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event toggle_handle_down!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event toggle_handle_down!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.toggle_handle_down(...parameters);
+    createHistoryElement("toggle_handle_down(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "toggle_handle_down", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["toggle_handle_down"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["toggle_handle_down"].disabled = true;
+        }
+        createOptionList("toggle_handle_down", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["toggle_handle_down"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_close_door"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_close_door_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_close_door_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_close_door"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_close_door"].style.gridColumn="-1";
+_machine_events["env_close_door"].innerHTML = "env_close_door";
+_machine_events["env_close_door"].parameterNames = ["gr", ];
+_machine_events["env_close_door"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_close_door"] == null ?? true) {
+      transition = _machine["_tr_env_close_door"]();
+      _transition_list[index]["env_close_door"] = transition;
+  } else {
+      transition = _transition_list[index]["env_close_door"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_close_door is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_close_door"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_close_door!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_close_door!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_close_door"]["gr"].getValue(), ];
+    var returnValue = _machine.env_close_door(...parameters);
+    createHistoryElement("env_close_door(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_close_door"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_close_door", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_close_door"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_close_door"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_close_door"].disabled = true;
+        }
+        createOptionList("env_close_door", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_close_door"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["open_valve_door_close"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["open_valve_door_close"].style.gridColumn="-1";
+_machine_events["open_valve_door_close"].innerHTML = "open_valve_door_close";
+_machine_events["open_valve_door_close"].parameterNames = [];
+_machine_events["open_valve_door_close"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["open_valve_door_close"] == null ?? true) {
+      transition = _machine["_tr_open_valve_door_close"]();
+      _transition_list[index]["open_valve_door_close"] = transition;
+  } else {
+      transition = _transition_list[index]["open_valve_door_close"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event open_valve_door_close is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event open_valve_door_close!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event open_valve_door_close!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.open_valve_door_close(...parameters);
+    createHistoryElement("open_valve_door_close(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "open_valve_door_close", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["open_valve_door_close"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["open_valve_door_close"].disabled = true;
+        }
+        createOptionList("open_valve_door_close", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["open_valve_door_close"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stop_stimulate_extend_gear_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stop_stimulate_extend_gear_valve"].style.gridColumn="-1";
+_machine_events["con_stop_stimulate_extend_gear_valve"].innerHTML = "con_stop_stimulate_extend_gear_valve";
+_machine_events["con_stop_stimulate_extend_gear_valve"].parameterNames = [];
+_machine_events["con_stop_stimulate_extend_gear_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stop_stimulate_extend_gear_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stop_stimulate_extend_gear_valve"]();
+      _transition_list[index]["con_stop_stimulate_extend_gear_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stop_stimulate_extend_gear_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stop_stimulate_extend_gear_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stop_stimulate_extend_gear_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stop_stimulate_extend_gear_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stop_stimulate_extend_gear_valve(...parameters);
+    createHistoryElement("con_stop_stimulate_extend_gear_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stop_stimulate_extend_gear_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stop_stimulate_extend_gear_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stop_stimulate_extend_gear_valve"].disabled = true;
+        }
+        createOptionList("con_stop_stimulate_extend_gear_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stop_stimulate_extend_gear_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stimulate_open_door_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stimulate_open_door_valve"].style.gridColumn="-1";
+_machine_events["con_stimulate_open_door_valve"].innerHTML = "con_stimulate_open_door_valve";
+_machine_events["con_stimulate_open_door_valve"].parameterNames = [];
+_machine_events["con_stimulate_open_door_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stimulate_open_door_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stimulate_open_door_valve"]();
+      _transition_list[index]["con_stimulate_open_door_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stimulate_open_door_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stimulate_open_door_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stimulate_open_door_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stimulate_open_door_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stimulate_open_door_valve(...parameters);
+    createHistoryElement("con_stimulate_open_door_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stimulate_open_door_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stimulate_open_door_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stimulate_open_door_valve"].disabled = true;
+        }
+        createOptionList("con_stimulate_open_door_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stimulate_open_door_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stimulate_retract_gear_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stimulate_retract_gear_valve"].style.gridColumn="-1";
+_machine_events["con_stimulate_retract_gear_valve"].innerHTML = "con_stimulate_retract_gear_valve";
+_machine_events["con_stimulate_retract_gear_valve"].parameterNames = [];
+_machine_events["con_stimulate_retract_gear_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stimulate_retract_gear_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stimulate_retract_gear_valve"]();
+      _transition_list[index]["con_stimulate_retract_gear_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stimulate_retract_gear_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stimulate_retract_gear_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stimulate_retract_gear_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stimulate_retract_gear_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stimulate_retract_gear_valve(...parameters);
+    createHistoryElement("con_stimulate_retract_gear_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stimulate_retract_gear_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stimulate_retract_gear_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stimulate_retract_gear_valve"].disabled = true;
+        }
+        createOptionList("con_stimulate_retract_gear_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stimulate_retract_gear_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stop_stimulate_open_door_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stop_stimulate_open_door_valve"].style.gridColumn="-1";
+_machine_events["con_stop_stimulate_open_door_valve"].innerHTML = "con_stop_stimulate_open_door_valve";
+_machine_events["con_stop_stimulate_open_door_valve"].parameterNames = [];
+_machine_events["con_stop_stimulate_open_door_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stop_stimulate_open_door_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stop_stimulate_open_door_valve"]();
+      _transition_list[index]["con_stop_stimulate_open_door_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stop_stimulate_open_door_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stop_stimulate_open_door_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stop_stimulate_open_door_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stop_stimulate_open_door_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stop_stimulate_open_door_valve(...parameters);
+    createHistoryElement("con_stop_stimulate_open_door_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stop_stimulate_open_door_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stop_stimulate_open_door_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stop_stimulate_open_door_valve"].disabled = true;
+        }
+        createOptionList("con_stop_stimulate_open_door_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stop_stimulate_open_door_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_close_analogical_switch"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_close_analogical_switch"].style.gridColumn="-1";
+_machine_events["env_close_analogical_switch"].innerHTML = "env_close_analogical_switch";
+_machine_events["env_close_analogical_switch"].parameterNames = [];
+_machine_events["env_close_analogical_switch"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_close_analogical_switch"] == null ?? true) {
+      transition = _machine["_tr_env_close_analogical_switch"]();
+      _transition_list[index]["env_close_analogical_switch"] = transition;
+  } else {
+      transition = _transition_list[index]["env_close_analogical_switch"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_close_analogical_switch is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_close_analogical_switch!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_close_analogical_switch!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.env_close_analogical_switch(...parameters);
+    createHistoryElement("env_close_analogical_switch(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "env_close_analogical_switch", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_close_analogical_switch"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_close_analogical_switch"].disabled = true;
+        }
+        createOptionList("env_close_analogical_switch", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_close_analogical_switch"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["open_valve_door_open"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["open_valve_door_open"].style.gridColumn="-1";
+_machine_events["open_valve_door_open"].innerHTML = "open_valve_door_open";
+_machine_events["open_valve_door_open"].parameterNames = [];
+_machine_events["open_valve_door_open"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["open_valve_door_open"] == null ?? true) {
+      transition = _machine["_tr_open_valve_door_open"]();
+      _transition_list[index]["open_valve_door_open"] = transition;
+  } else {
+      transition = _transition_list[index]["open_valve_door_open"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event open_valve_door_open is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event open_valve_door_open!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event open_valve_door_open!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.open_valve_door_open(...parameters);
+    createHistoryElement("open_valve_door_open(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "open_valve_door_open", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["open_valve_door_open"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["open_valve_door_open"].disabled = true;
+        }
+        createOptionList("open_valve_door_open", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["open_valve_door_open"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_retract_gear_last"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_retract_gear_last_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_retract_gear_last_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_retract_gear_last"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_retract_gear_last"].style.gridColumn="-1";
+_machine_events["env_retract_gear_last"].innerHTML = "env_retract_gear_last";
+_machine_events["env_retract_gear_last"].parameterNames = ["gr", ];
+_machine_events["env_retract_gear_last"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_retract_gear_last"] == null ?? true) {
+      transition = _machine["_tr_env_retract_gear_last"]();
+      _transition_list[index]["env_retract_gear_last"] = transition;
+  } else {
+      transition = _transition_list[index]["env_retract_gear_last"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_retract_gear_last is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_retract_gear_last"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_retract_gear_last!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_retract_gear_last!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_retract_gear_last"]["gr"].getValue(), ];
+    var returnValue = _machine.env_retract_gear_last(...parameters);
+    createHistoryElement("env_retract_gear_last(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_retract_gear_last"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_retract_gear_last", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_retract_gear_last"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_retract_gear_last"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_retract_gear_last"].disabled = true;
+        }
+        createOptionList("env_retract_gear_last", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_retract_gear_last"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["open_valve_retract_gear"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["open_valve_retract_gear"].style.gridColumn="-1";
+_machine_events["open_valve_retract_gear"].innerHTML = "open_valve_retract_gear";
+_machine_events["open_valve_retract_gear"].parameterNames = [];
+_machine_events["open_valve_retract_gear"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["open_valve_retract_gear"] == null ?? true) {
+      transition = _machine["_tr_open_valve_retract_gear"]();
+      _transition_list[index]["open_valve_retract_gear"] = transition;
+  } else {
+      transition = _transition_list[index]["open_valve_retract_gear"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event open_valve_retract_gear is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event open_valve_retract_gear!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event open_valve_retract_gear!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.open_valve_retract_gear(...parameters);
+    createHistoryElement("open_valve_retract_gear(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "open_valve_retract_gear", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["open_valve_retract_gear"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["open_valve_retract_gear"].disabled = true;
+        }
+        createOptionList("open_valve_retract_gear", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["open_valve_retract_gear"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stimulate_close_door_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stimulate_close_door_valve"].style.gridColumn="-1";
+_machine_events["con_stimulate_close_door_valve"].innerHTML = "con_stimulate_close_door_valve";
+_machine_events["con_stimulate_close_door_valve"].parameterNames = [];
+_machine_events["con_stimulate_close_door_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stimulate_close_door_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stimulate_close_door_valve"]();
+      _transition_list[index]["con_stimulate_close_door_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stimulate_close_door_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stimulate_close_door_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stimulate_close_door_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stimulate_close_door_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stimulate_close_door_valve(...parameters);
+    createHistoryElement("con_stimulate_close_door_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stimulate_close_door_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stimulate_close_door_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stimulate_close_door_valve"].disabled = true;
+        }
+        createOptionList("con_stimulate_close_door_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stimulate_close_door_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stop_stimulate_close_door_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stop_stimulate_close_door_valve"].style.gridColumn="-1";
+_machine_events["con_stop_stimulate_close_door_valve"].innerHTML = "con_stop_stimulate_close_door_valve";
+_machine_events["con_stop_stimulate_close_door_valve"].parameterNames = [];
+_machine_events["con_stop_stimulate_close_door_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stop_stimulate_close_door_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stop_stimulate_close_door_valve"]();
+      _transition_list[index]["con_stop_stimulate_close_door_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stop_stimulate_close_door_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stop_stimulate_close_door_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stop_stimulate_close_door_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stop_stimulate_close_door_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stop_stimulate_close_door_valve(...parameters);
+    createHistoryElement("con_stop_stimulate_close_door_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stop_stimulate_close_door_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stop_stimulate_close_door_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stop_stimulate_close_door_valve"].disabled = true;
+        }
+        createOptionList("con_stop_stimulate_close_door_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stop_stimulate_close_door_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_start_open_door"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_start_open_door_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_start_open_door_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_start_open_door"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_start_open_door"].style.gridColumn="-1";
+_machine_events["env_start_open_door"].innerHTML = "env_start_open_door";
+_machine_events["env_start_open_door"].parameterNames = ["gr", ];
+_machine_events["env_start_open_door"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_start_open_door"] == null ?? true) {
+      transition = _machine["_tr_env_start_open_door"]();
+      _transition_list[index]["env_start_open_door"] = transition;
+  } else {
+      transition = _transition_list[index]["env_start_open_door"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_start_open_door is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_start_open_door"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_start_open_door!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_start_open_door!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_start_open_door"]["gr"].getValue(), ];
+    var returnValue = _machine.env_start_open_door(...parameters);
+    createHistoryElement("env_start_open_door(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_start_open_door"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_start_open_door", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_start_open_door"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_start_open_door"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_start_open_door"].disabled = true;
+        }
+        createOptionList("env_start_open_door", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_start_open_door"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_open_door_last"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_open_door_last_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_open_door_last_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_open_door_last"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_open_door_last"].style.gridColumn="-1";
+_machine_events["env_open_door_last"].innerHTML = "env_open_door_last";
+_machine_events["env_open_door_last"].parameterNames = ["gr", ];
+_machine_events["env_open_door_last"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_open_door_last"] == null ?? true) {
+      transition = _machine["_tr_env_open_door_last"]();
+      _transition_list[index]["env_open_door_last"] = transition;
+  } else {
+      transition = _transition_list[index]["env_open_door_last"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_open_door_last is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_open_door_last"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_open_door_last!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_open_door_last!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_open_door_last"]["gr"].getValue(), ];
+    var returnValue = _machine.env_open_door_last(...parameters);
+    createHistoryElement("env_open_door_last(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_open_door_last"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_open_door_last", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_open_door_last"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_open_door_last"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_open_door_last"].disabled = true;
+        }
+        createOptionList("env_open_door_last", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_open_door_last"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["land_plane"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["land_plane"].style.gridColumn="-1";
+_machine_events["land_plane"].innerHTML = "land_plane";
+_machine_events["land_plane"].parameterNames = [];
+_machine_events["land_plane"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["land_plane"] == null ?? true) {
+      transition = _machine["_tr_land_plane"]();
+      _transition_list[index]["land_plane"] = transition;
+  } else {
+      transition = _transition_list[index]["land_plane"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event land_plane is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event land_plane!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event land_plane!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.land_plane(...parameters);
+    createHistoryElement("land_plane(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "land_plane", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["land_plane"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["land_plane"].disabled = true;
+        }
+        createOptionList("land_plane", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["land_plane"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_start_retracting_first"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_start_retracting_first_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_start_retracting_first_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_start_retracting_first"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_start_retracting_first"].style.gridColumn="-1";
+_machine_events["env_start_retracting_first"].innerHTML = "env_start_retracting_first";
+_machine_events["env_start_retracting_first"].parameterNames = ["gr", ];
+_machine_events["env_start_retracting_first"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_start_retracting_first"] == null ?? true) {
+      transition = _machine["_tr_env_start_retracting_first"]();
+      _transition_list[index]["env_start_retracting_first"] = transition;
+  } else {
+      transition = _transition_list[index]["env_start_retracting_first"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_start_retracting_first is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_start_retracting_first"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_start_retracting_first!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_start_retracting_first!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_start_retracting_first"]["gr"].getValue(), ];
+    var returnValue = _machine.env_start_retracting_first(...parameters);
+    createHistoryElement("env_start_retracting_first(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_start_retracting_first"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_start_retracting_first", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_start_retracting_first"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_start_retracting_first"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_start_retracting_first"].disabled = true;
+        }
+        createOptionList("env_start_retracting_first", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_start_retracting_first"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_close_door_skip"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_close_door_skip_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_close_door_skip_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_close_door_skip"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_close_door_skip"].style.gridColumn="-1";
+_machine_events["env_close_door_skip"].innerHTML = "env_close_door_skip";
+_machine_events["env_close_door_skip"].parameterNames = ["gr", ];
+_machine_events["env_close_door_skip"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_close_door_skip"] == null ?? true) {
+      transition = _machine["_tr_env_close_door_skip"]();
+      _transition_list[index]["env_close_door_skip"] = transition;
+  } else {
+      transition = _transition_list[index]["env_close_door_skip"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_close_door_skip is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_close_door_skip"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_close_door_skip!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_close_door_skip!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_close_door_skip"]["gr"].getValue(), ];
+    var returnValue = _machine.env_close_door_skip(...parameters);
+    createHistoryElement("env_close_door_skip(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_close_door_skip"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_close_door_skip", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_close_door_skip"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_close_door_skip"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_close_door_skip"].disabled = true;
+        }
+        createOptionList("env_close_door_skip", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_close_door_skip"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["begin_flying"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["begin_flying"].style.gridColumn="-1";
+_machine_events["begin_flying"].innerHTML = "begin_flying";
+_machine_events["begin_flying"].parameterNames = [];
+_machine_events["begin_flying"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["begin_flying"] == null ?? true) {
+      transition = _machine["_tr_begin_flying"]();
+      _transition_list[index]["begin_flying"] = transition;
+  } else {
+      transition = _transition_list[index]["begin_flying"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event begin_flying is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event begin_flying!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event begin_flying!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.begin_flying(...parameters);
+    createHistoryElement("begin_flying(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "begin_flying", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["begin_flying"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["begin_flying"].disabled = true;
+        }
+        createOptionList("begin_flying", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["begin_flying"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["evn_open_general_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["evn_open_general_valve"].style.gridColumn="-1";
+_machine_events["evn_open_general_valve"].innerHTML = "evn_open_general_valve";
+_machine_events["evn_open_general_valve"].parameterNames = [];
+_machine_events["evn_open_general_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["evn_open_general_valve"] == null ?? true) {
+      transition = _machine["_tr_evn_open_general_valve"]();
+      _transition_list[index]["evn_open_general_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["evn_open_general_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event evn_open_general_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event evn_open_general_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event evn_open_general_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.evn_open_general_valve(...parameters);
+    createHistoryElement("evn_open_general_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "evn_open_general_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["evn_open_general_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["evn_open_general_valve"].disabled = true;
+        }
+        createOptionList("evn_open_general_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["evn_open_general_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["close_valve_door_close"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["close_valve_door_close"].style.gridColumn="-1";
+_machine_events["close_valve_door_close"].innerHTML = "close_valve_door_close";
+_machine_events["close_valve_door_close"].parameterNames = [];
+_machine_events["close_valve_door_close"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["close_valve_door_close"] == null ?? true) {
+      transition = _machine["_tr_close_valve_door_close"]();
+      _transition_list[index]["close_valve_door_close"] = transition;
+  } else {
+      transition = _transition_list[index]["close_valve_door_close"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event close_valve_door_close is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event close_valve_door_close!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event close_valve_door_close!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.close_valve_door_close(...parameters);
+    createHistoryElement("close_valve_door_close(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "close_valve_door_close", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["close_valve_door_close"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["close_valve_door_close"].disabled = true;
+        }
+        createOptionList("close_valve_door_close", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["close_valve_door_close"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stimulate_general_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stimulate_general_valve"].style.gridColumn="-1";
+_machine_events["con_stimulate_general_valve"].innerHTML = "con_stimulate_general_valve";
+_machine_events["con_stimulate_general_valve"].parameterNames = [];
+_machine_events["con_stimulate_general_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stimulate_general_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stimulate_general_valve"]();
+      _transition_list[index]["con_stimulate_general_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stimulate_general_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stimulate_general_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stimulate_general_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stimulate_general_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stimulate_general_valve(...parameters);
+    createHistoryElement("con_stimulate_general_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stimulate_general_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stimulate_general_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stimulate_general_valve"].disabled = true;
+        }
+        createOptionList("con_stimulate_general_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stimulate_general_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stop_stimulate_general_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stop_stimulate_general_valve"].style.gridColumn="-1";
+_machine_events["con_stop_stimulate_general_valve"].innerHTML = "con_stop_stimulate_general_valve";
+_machine_events["con_stop_stimulate_general_valve"].parameterNames = [];
+_machine_events["con_stop_stimulate_general_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stop_stimulate_general_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stop_stimulate_general_valve"]();
+      _transition_list[index]["con_stop_stimulate_general_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stop_stimulate_general_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stop_stimulate_general_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stop_stimulate_general_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stop_stimulate_general_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stop_stimulate_general_valve(...parameters);
+    createHistoryElement("con_stop_stimulate_general_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stop_stimulate_general_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stop_stimulate_general_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stop_stimulate_general_valve"].disabled = true;
+        }
+        createOptionList("con_stop_stimulate_general_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stop_stimulate_general_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_extend_gear_last"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_extend_gear_last_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_extend_gear_last_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_extend_gear_last"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_extend_gear_last"].style.gridColumn="-1";
+_machine_events["env_extend_gear_last"].innerHTML = "env_extend_gear_last";
+_machine_events["env_extend_gear_last"].parameterNames = ["gr", ];
+_machine_events["env_extend_gear_last"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_extend_gear_last"] == null ?? true) {
+      transition = _machine["_tr_env_extend_gear_last"]();
+      _transition_list[index]["env_extend_gear_last"] = transition;
+  } else {
+      transition = _transition_list[index]["env_extend_gear_last"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_extend_gear_last is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_extend_gear_last"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_extend_gear_last!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_extend_gear_last!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_extend_gear_last"]["gr"].getValue(), ];
+    var returnValue = _machine.env_extend_gear_last(...parameters);
+    createHistoryElement("env_extend_gear_last(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_extend_gear_last"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_extend_gear_last", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_extend_gear_last"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_extend_gear_last"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_extend_gear_last"].disabled = true;
+        }
+        createOptionList("env_extend_gear_last", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_extend_gear_last"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_extend_gear_skip"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_extend_gear_skip_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_extend_gear_skip_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_extend_gear_skip"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_extend_gear_skip"].style.gridColumn="-1";
+_machine_events["env_extend_gear_skip"].innerHTML = "env_extend_gear_skip";
+_machine_events["env_extend_gear_skip"].parameterNames = ["gr", ];
+_machine_events["env_extend_gear_skip"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_extend_gear_skip"] == null ?? true) {
+      transition = _machine["_tr_env_extend_gear_skip"]();
+      _transition_list[index]["env_extend_gear_skip"] = transition;
+  } else {
+      transition = _transition_list[index]["env_extend_gear_skip"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_extend_gear_skip is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_extend_gear_skip"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_extend_gear_skip!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_extend_gear_skip!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_extend_gear_skip"]["gr"].getValue(), ];
+    var returnValue = _machine.env_extend_gear_skip(...parameters);
+    createHistoryElement("env_extend_gear_skip(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_extend_gear_skip"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_extend_gear_skip", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_extend_gear_skip"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_extend_gear_skip"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_extend_gear_skip"].disabled = true;
+        }
+        createOptionList("env_extend_gear_skip", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_extend_gear_skip"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_start_close_door"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_start_close_door_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_start_close_door_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_start_close_door"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_start_close_door"].style.gridColumn="-1";
+_machine_events["env_start_close_door"].innerHTML = "env_start_close_door";
+_machine_events["env_start_close_door"].parameterNames = ["gr", ];
+_machine_events["env_start_close_door"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_start_close_door"] == null ?? true) {
+      transition = _machine["_tr_env_start_close_door"]();
+      _transition_list[index]["env_start_close_door"] = transition;
+  } else {
+      transition = _transition_list[index]["env_start_close_door"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_start_close_door is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_start_close_door"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_start_close_door!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_start_close_door!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_start_close_door"]["gr"].getValue(), ];
+    var returnValue = _machine.env_start_close_door(...parameters);
+    createHistoryElement("env_start_close_door(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_start_close_door"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_start_close_door", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_start_close_door"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_start_close_door"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_start_close_door"].disabled = true;
+        }
+        createOptionList("env_start_close_door", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_start_close_door"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["open_valve_extend_gear"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["open_valve_extend_gear"].style.gridColumn="-1";
+_machine_events["open_valve_extend_gear"].innerHTML = "open_valve_extend_gear";
+_machine_events["open_valve_extend_gear"].parameterNames = [];
+_machine_events["open_valve_extend_gear"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["open_valve_extend_gear"] == null ?? true) {
+      transition = _machine["_tr_open_valve_extend_gear"]();
+      _transition_list[index]["open_valve_extend_gear"] = transition;
+  } else {
+      transition = _transition_list[index]["open_valve_extend_gear"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event open_valve_extend_gear is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event open_valve_extend_gear!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event open_valve_extend_gear!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.open_valve_extend_gear(...parameters);
+    createHistoryElement("open_valve_extend_gear(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "open_valve_extend_gear", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["open_valve_extend_gear"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["open_valve_extend_gear"].disabled = true;
+        }
+        createOptionList("open_valve_extend_gear", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["open_valve_extend_gear"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stop_stimulate_retract_gear_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stop_stimulate_retract_gear_valve"].style.gridColumn="-1";
+_machine_events["con_stop_stimulate_retract_gear_valve"].innerHTML = "con_stop_stimulate_retract_gear_valve";
+_machine_events["con_stop_stimulate_retract_gear_valve"].parameterNames = [];
+_machine_events["con_stop_stimulate_retract_gear_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stop_stimulate_retract_gear_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stop_stimulate_retract_gear_valve"]();
+      _transition_list[index]["con_stop_stimulate_retract_gear_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stop_stimulate_retract_gear_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stop_stimulate_retract_gear_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stop_stimulate_retract_gear_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stop_stimulate_retract_gear_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stop_stimulate_retract_gear_valve(...parameters);
+    createHistoryElement("con_stop_stimulate_retract_gear_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stop_stimulate_retract_gear_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stop_stimulate_retract_gear_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stop_stimulate_retract_gear_valve"].disabled = true;
+        }
+        createOptionList("con_stop_stimulate_retract_gear_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stop_stimulate_retract_gear_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_open_door_skip"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_open_door_skip_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_open_door_skip_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_open_door_skip"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_open_door_skip"].style.gridColumn="-1";
+_machine_events["env_open_door_skip"].innerHTML = "env_open_door_skip";
+_machine_events["env_open_door_skip"].parameterNames = ["gr", ];
+_machine_events["env_open_door_skip"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_open_door_skip"] == null ?? true) {
+      transition = _machine["_tr_env_open_door_skip"]();
+      _transition_list[index]["env_open_door_skip"] = transition;
+  } else {
+      transition = _transition_list[index]["env_open_door_skip"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_open_door_skip is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_open_door_skip"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_open_door_skip!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_open_door_skip!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_open_door_skip"]["gr"].getValue(), ];
+    var returnValue = _machine.env_open_door_skip(...parameters);
+    createHistoryElement("env_open_door_skip(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_open_door_skip"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_open_door_skip", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_open_door_skip"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_open_door_skip"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_open_door_skip"].disabled = true;
+        }
+        createOptionList("env_open_door_skip", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_open_door_skip"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["toggle_handle_up"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["toggle_handle_up"].style.gridColumn="-1";
+_machine_events["toggle_handle_up"].innerHTML = "toggle_handle_up";
+_machine_events["toggle_handle_up"].parameterNames = [];
+_machine_events["toggle_handle_up"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["toggle_handle_up"] == null ?? true) {
+      transition = _machine["_tr_toggle_handle_up"]();
+      _transition_list[index]["toggle_handle_up"] = transition;
+  } else {
+      transition = _transition_list[index]["toggle_handle_up"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event toggle_handle_up is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event toggle_handle_up!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event toggle_handle_up!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.toggle_handle_up(...parameters);
+    createHistoryElement("toggle_handle_up(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "toggle_handle_up", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["toggle_handle_up"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["toggle_handle_up"].disabled = true;
+        }
+        createOptionList("toggle_handle_up", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["toggle_handle_up"]);
+
+
+
+
+updateVisuals();
+if(_operations_view.querySelectorAll("label").length == 0) {
+    document.documentElement.style.setProperty('--noneOrGrid', 'none');
+}
+
+function displayTrace(trace) {
+    selectHistoryElement(-_history_view.querySelector(".active").index);
+    let transitions = trace.transitionList
+    for(let transition of transitions) {
+      if(transition.name.startsWith("$")) {
+        continue;
+      }
+      if(transition.params == null) {
+        transition.params = {};
+      }
+      let parameters = Object.keys(transition.params).map(param => _machine_events[transition.name][param].parseValue(transition.params[param]))
+      let returnValue = _machine[transition.name](...parameters);
+      createHistoryElement(transition.name + "(" + parameters.join(", ") + ")" + (returnValue? " (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+      let parametersJSON = {};
+
+      _current_trace.push({name: transition.name, params: parametersJSON});
+    }
+    updateVisuals();
+    selectHistoryElement(_history_view.querySelector("span:last-of-type").index-_history_view.querySelector(".active").index);
+}
+
+function importTrace() {
+    var _file_input = document.querySelector("#_upload_trace_input");
+    _file_input.accept = ".prob2trace";
+
+    _file_input.onchange = async _ => {
+        let files = Array.from(_file_input.files);
+        let file = files[0];
+        let response = await fetch(file.name);
+        let data = await response.text();
+        let trace = JSON.parse(data);
+        createScenarioElement(file.name, trace);
+
+        try {
+            displayTrace(trace);
+        } catch (error) {
+            alert("Trace could not be completely imported.");
+            console.error(error);
+        }
+    };
+
+    _file_input.click();
+}
+
+function exportTrace() {
+  var transitions = _current_trace;
+  var object = {
+    description: "Created from B2Program JS Export",
+    transitionList: transitions,
+    metadata: {
+      fileType: "Trace",
+      formatVersion: 1,
+      creator: "B2Program JS",
+      modelName: "LandingGear_R6"
+    }
+  };
+  const blob = new Blob([JSON.stringify(object, null, '\t')]);
+  const a = document.createElement('a');
+  a.href = URL.createObjectURL(blob);
+  a.download = 'Scenario.prob2trace';
+  a.click();
+}
+
+function sleep(ms) {
+    return new Promise(resolve => setTimeout(resolve, ms));
+}
+
+async function runTrace(ms) {
+    let firstElement = _history_view.querySelector("span");
+    firstElement.click();
+    let currentHistoryElement = _history_view.querySelector(".active");
+    let index = currentHistoryElement.index + 1;
+    while (index >= 0 && index < _state_list.length) {
+      selectHistoryElement(1);
+      await sleep(ms);
+      currentHistoryElement = _history_view.querySelector(".active");
+      index = currentHistoryElement.index + 1;
+    }
+}
\ No newline at end of file
diff --git a/B2Program/LandingGear/GearsDoors/LandingGear_R6.html b/B2Program/LandingGear/GearsDoors/LandingGear_R6.html
new file mode 100644
index 0000000000000000000000000000000000000000..1b8ce0bb539199869fe0ea520500019c32e6640a
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/LandingGear_R6.html
@@ -0,0 +1,146 @@
+<!doctype html>
+
+<html lang="en">
+<head>
+  <meta charset="utf-8">
+  <title>LandingGear_R6</title>
+<head>
+
+<body>
+  <div>
+    <h1>Visualization <br></h1>
+    <object id="physical" data="physical.svg" type="image/svg+xml"></object>
+  </div>
+  <div>
+      <h1>Operations View <br></h1>
+      <div id="_operations_view">
+        <div class="param" style="grid-column: span 2;">Parameter</div>
+        <div style="text-align: center; grid-column: -1;">Event</div>
+      </div>
+  </div>
+  <div>
+    <h1>History View <br></h1>
+    <div id="_history_view_buttons">
+        <input id="_upload_trace_input" type="file" style="display:none;"></input>
+        <input id="_export_trace" type="file" style="display:none;"></input>
+    </div>
+    <div id="_history_view">
+    </div>
+    <br>
+    <br>
+    <h1>Scenario View <br></h1>
+    <div id="_scenario_view">
+    </div>
+  </div>
+  <div id="_state_view">
+    <h1>State View <br></h1>
+    <div id="_state_view_variables" class="state_view_section">
+        <div class="state_view_header collapsed" onclick="collapse(this)">Variables</div>
+    </div>
+    <div id="_state_view_constants" class="state_view_section">
+        <div class="state_view_header collapsed" onclick="collapse(this)">Constants</div>
+    </div>
+    <div id="_state_view_sets" class="state_view_section">
+            <div class="state_view_header collapsed" onclick="collapse(this)">Sets</div>
+        </div>
+    <div id="_state_view_invariant" class="state_view_section">
+            <div class="state_view_header collapsed" onclick="collapse(this)">Invariant</div>
+        </div>
+  </div>
+  <script type="module" src="./immutable/dist/immutable.es.js"></script>
+  <script type="module" src="./btypes/BTuple.js"></script>
+  <script type="module" src="./btypes/BRelation.js"></script>
+  <script type="module" src="./btypes/BBoolean.js"></script>
+  <script type="module" src="./btypes/BSet.js"></script>
+  <script type="module" src="./btypes/BObject.js"></script>
+  <script type="module" src="./LandingGear_R6.js"></script>
+  <script type="module" src="./LandingGear_R6-visualisation.js" defer></script>
+</body>
+
+<script>
+function collapse(element) {
+    element.classList.toggle("collapsed");
+}
+</script>
+<style>
+#_operations_view{
+    display: grid;
+    grid-template-columns: auto auto auto;
+    gap: 0.5%;
+    margin-bottom: auto;
+    margin-right: 1rem;
+}
+:root {
+    --noneOrGrid: grid;
+}
+.param{
+    display: var(--noneOrGrid);
+    grid-column: span 2;
+    grid-template-columns: subgrid;
+    gap: 5px;
+}
+#_history_view{
+    margin-bottom: auto;
+    margin-right: 1rem;
+    overflow-y  : auto;
+    padding-right: 18px;
+    max-height: 90vh;
+}
+#_history_view > span.active {
+    background: lightblue;
+}
+#_history_view_buttons {
+    display: grid;
+    grid-template-columns: 1fr 1fr;
+}
+
+#_scenario_view{
+    margin-right: 1rem;
+    overflow-y  : auto;
+    padding-right: 18px;
+    gap: 5%;
+    display: grid;
+}
+#_scenario_view > span.active {
+    background: lightblue;
+}
+#_scenario_view_buttons {
+    display: grid;
+    grid-template-columns: 1fr 1fr;
+}
+
+.state_view_section {
+    display: grid;
+    grid-template-columns: auto auto;
+    gap: 0px 20px;
+}
+.state_view_header {
+    grid-column: 1 / -1;
+    border-bottom: 1px solid black;
+}
+
+.state_view_header:only-child {
+    display: none;
+}
+
+.state_view_header::after {
+    content: "\25B2";
+    margin-left: 5px;
+    float: right;
+}
+.collapsed ~ * {
+    display: none;
+}
+.collapsed::after {
+    content: "\25BC";
+}
+body {
+display: flex;
+flex-direction: row;
+flex-wrap: wrap;
+gap: 20px;
+align-items: start;
+}
+</style>
+
+</html>
\ No newline at end of file
diff --git a/B2Program/LandingGear/GearsDoors/LandingGear_R6.js b/B2Program/LandingGear/GearsDoors/LandingGear_R6.js
new file mode 100644
index 0000000000000000000000000000000000000000..14fa2f92c584620f805cfdc7e8a9d0bbd4713e1b
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/LandingGear_R6.js
@@ -0,0 +1,918 @@
+import { BTuple } from './btypes/BTuple.js';
+import { BBoolean } from './btypes/BBoolean.js';
+import { BRelation } from './btypes/BRelation.js';
+import { BSet } from './btypes/BSet.js';
+import { BUtils } from "./btypes/BUtils.js";
+import { SelectError } from "./btypes/BUtils.js";
+export var enum_DOOR_STATE;
+(function (enum_DOOR_STATE) {
+    enum_DOOR_STATE[enum_DOOR_STATE["open"] = 0] = "open";
+    enum_DOOR_STATE[enum_DOOR_STATE["closed"] = 1] = "closed";
+    enum_DOOR_STATE[enum_DOOR_STATE["door_moving"] = 2] = "door_moving";
+})(enum_DOOR_STATE || (enum_DOOR_STATE = {}));
+export class DOOR_STATE {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof DOOR_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_DOOR_STATE[this.value].toString();
+    }
+    static get_open() { return new DOOR_STATE(enum_DOOR_STATE.open); }
+    static get_closed() { return new DOOR_STATE(enum_DOOR_STATE.closed); }
+    static get_door_moving() { return new DOOR_STATE(enum_DOOR_STATE.door_moving); }
+}
+export var enum_GEAR_STATE;
+(function (enum_GEAR_STATE) {
+    enum_GEAR_STATE[enum_GEAR_STATE["retracted"] = 0] = "retracted";
+    enum_GEAR_STATE[enum_GEAR_STATE["extended"] = 1] = "extended";
+    enum_GEAR_STATE[enum_GEAR_STATE["gear_moving"] = 2] = "gear_moving";
+})(enum_GEAR_STATE || (enum_GEAR_STATE = {}));
+export class GEAR_STATE {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof GEAR_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_GEAR_STATE[this.value].toString();
+    }
+    static get_retracted() { return new GEAR_STATE(enum_GEAR_STATE.retracted); }
+    static get_extended() { return new GEAR_STATE(enum_GEAR_STATE.extended); }
+    static get_gear_moving() { return new GEAR_STATE(enum_GEAR_STATE.gear_moving); }
+}
+export var enum_HANDLE_STATE;
+(function (enum_HANDLE_STATE) {
+    enum_HANDLE_STATE[enum_HANDLE_STATE["up"] = 0] = "up";
+    enum_HANDLE_STATE[enum_HANDLE_STATE["down"] = 1] = "down";
+})(enum_HANDLE_STATE || (enum_HANDLE_STATE = {}));
+export class HANDLE_STATE {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof HANDLE_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_HANDLE_STATE[this.value].toString();
+    }
+    static get_up() { return new HANDLE_STATE(enum_HANDLE_STATE.up); }
+    static get_down() { return new HANDLE_STATE(enum_HANDLE_STATE.down); }
+}
+export var enum_POSITION;
+(function (enum_POSITION) {
+    enum_POSITION[enum_POSITION["fr"] = 0] = "fr";
+    enum_POSITION[enum_POSITION["lt"] = 1] = "lt";
+    enum_POSITION[enum_POSITION["rt"] = 2] = "rt";
+})(enum_POSITION || (enum_POSITION = {}));
+export class POSITION {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof POSITION)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_POSITION[this.value].toString();
+    }
+    static get_fr() { return new POSITION(enum_POSITION.fr); }
+    static get_lt() { return new POSITION(enum_POSITION.lt); }
+    static get_rt() { return new POSITION(enum_POSITION.rt); }
+}
+export var enum_SWITCH_STATE;
+(function (enum_SWITCH_STATE) {
+    enum_SWITCH_STATE[enum_SWITCH_STATE["switch_open"] = 0] = "switch_open";
+    enum_SWITCH_STATE[enum_SWITCH_STATE["switch_closed"] = 1] = "switch_closed";
+})(enum_SWITCH_STATE || (enum_SWITCH_STATE = {}));
+export class SWITCH_STATE {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof SWITCH_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_SWITCH_STATE[this.value].toString();
+    }
+    static get_switch_open() { return new SWITCH_STATE(enum_SWITCH_STATE.switch_open); }
+    static get_switch_closed() { return new SWITCH_STATE(enum_SWITCH_STATE.switch_closed); }
+}
+export var enum_PLANE_STATE;
+(function (enum_PLANE_STATE) {
+    enum_PLANE_STATE[enum_PLANE_STATE["ground"] = 0] = "ground";
+    enum_PLANE_STATE[enum_PLANE_STATE["flight"] = 1] = "flight";
+})(enum_PLANE_STATE || (enum_PLANE_STATE = {}));
+export class PLANE_STATE {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof PLANE_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_PLANE_STATE[this.value].toString();
+    }
+    static get_ground() { return new PLANE_STATE(enum_PLANE_STATE.ground); }
+    static get_flight() { return new PLANE_STATE(enum_PLANE_STATE.flight); }
+}
+export var enum_VALVE_STATE;
+(function (enum_VALVE_STATE) {
+    enum_VALVE_STATE[enum_VALVE_STATE["valve_open"] = 0] = "valve_open";
+    enum_VALVE_STATE[enum_VALVE_STATE["valve_closed"] = 1] = "valve_closed";
+})(enum_VALVE_STATE || (enum_VALVE_STATE = {}));
+export class VALVE_STATE {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof VALVE_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_VALVE_STATE[this.value].toString();
+    }
+    static get_valve_open() { return new VALVE_STATE(enum_VALVE_STATE.valve_open); }
+    static get_valve_closed() { return new VALVE_STATE(enum_VALVE_STATE.valve_closed); }
+}
+export default class LandingGear_R6 {
+    constructor() {
+        this.gears = BRelation.cartesianProduct(LandingGear_R6._POSITION, new BSet(new GEAR_STATE(enum_GEAR_STATE.extended)));
+        this.doors = BRelation.cartesianProduct(LandingGear_R6._POSITION, new BSet(new DOOR_STATE(enum_DOOR_STATE.closed)));
+        this.handle = new HANDLE_STATE(enum_HANDLE_STATE.down);
+        this.valve_extend_gear = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.valve_retract_gear = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.valve_open_door = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.valve_close_door = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.open_EV = new BBoolean(false);
+        this.close_EV = new BBoolean(false);
+        this.retract_EV = new BBoolean(false);
+        this.extend_EV = new BBoolean(false);
+        this.shock_absorber = new PLANE_STATE(enum_PLANE_STATE.ground);
+        this.general_EV = new BBoolean(false);
+        this.general_valve = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.analogical_switch = new SWITCH_STATE(enum_SWITCH_STATE.switch_open);
+        this.handle_move = new BBoolean(false);
+        this.gear = new GEAR_STATE(enum_GEAR_STATE.extended);
+        this.door = new DOOR_STATE(enum_DOOR_STATE.closed);
+    }
+    _copy() {
+        var _a, _b, _c;
+        let _instance = Object.create(LandingGear_R6.prototype);
+        for (let key of Object.keys(this)) {
+            _instance[key] = (_c = (_b = (_a = this[key])._copy) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : this[key];
+        }
+        return _instance;
+    }
+    begin_flying() {
+        if ((this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground))).booleanValue()) {
+            this.shock_absorber = new PLANE_STATE(enum_PLANE_STATE.flight);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    land_plane() {
+        if ((this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.flight))).booleanValue()) {
+            this.shock_absorber = new PLANE_STATE(enum_PLANE_STATE.ground);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    open_valve_door_open() {
+        if ((new BBoolean(this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.valve_open_door = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    close_valve_door_open() {
+        if ((new BBoolean(this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue())).booleanValue()) {
+            this.valve_open_door = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    open_valve_door_close() {
+        if ((new BBoolean(this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.close_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.valve_close_door = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    close_valve_door_close() {
+        if ((new BBoolean(this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue())).booleanValue()) {
+            this.valve_close_door = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    open_valve_retract_gear() {
+        if ((new BBoolean(this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.retract_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.valve_retract_gear = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    close_valve_retract_gear() {
+        if ((new BBoolean(this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue())).booleanValue()) {
+            this.valve_retract_gear = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    open_valve_extend_gear() {
+        if ((new BBoolean(this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.extend_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.valve_extend_gear = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    close_valve_extend_gear() {
+        if ((new BBoolean(this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue())).booleanValue()) {
+            this.valve_extend_gear = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stimulate_open_door_valve() {
+        if ((new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(false)).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).not().booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).not().booleanValue()).booleanValue() && new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).not().booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.open_EV = new BBoolean(true);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stop_stimulate_open_door_valve() {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(true)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.open_EV = new BBoolean(false);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stimulate_close_door_valve() {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.close_EV.equal(new BBoolean(false)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).not().booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.close_EV = new BBoolean(true);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stop_stimulate_close_door_valve() {
+        if ((new BBoolean(new BBoolean(this.close_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.close_EV = new BBoolean(false);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stimulate_retract_gear_valve() {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.retract_EV.equal(new BBoolean(false)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).not().booleanValue()).booleanValue() && this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.flight)).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.retract_EV = new BBoolean(true);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stop_stimulate_retract_gear_valve() {
+        if ((new BBoolean(new BBoolean(this.retract_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.retract_EV = new BBoolean(false);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stimulate_extend_gear_valve() {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.extend_EV.equal(new BBoolean(false)).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).not().booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.extend_EV = new BBoolean(true);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stop_stimulate_extend_gear_valve() {
+        if ((new BBoolean(new BBoolean(this.extend_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.extend_EV = new BBoolean(false);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_start_retracting_first(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() && this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.gear_moving)).elementOf(this.gear).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+            let _ld_gears = this.gears;
+            this.gears = _ld_gears.override(new BRelation(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.gear_moving))));
+            this.gear = new GEAR_STATE(enum_GEAR_STATE.gear_moving);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_retract_gear_skip(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).unequal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.gears = this.gears.override(new BRelation(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.retracted))));
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_retract_gear_last(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+            let _ld_gears = this.gears;
+            this.gears = _ld_gears.override(new BRelation(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.retracted))));
+            this.gear = new GEAR_STATE(enum_GEAR_STATE.retracted);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_start_extending(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() && this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+            let _ld_gears = this.gears;
+            this.gears = _ld_gears.override(new BRelation(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.gear_moving))));
+            this.gear = new GEAR_STATE(enum_GEAR_STATE.gear_moving);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_extend_gear_last(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+            let _ld_gears = this.gears;
+            this.gears = _ld_gears.override(new BRelation(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.extended))));
+            this.gear = new GEAR_STATE(enum_GEAR_STATE.extended);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_extend_gear_skip(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).unequal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.gears = this.gears.override(new BRelation(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.extended))));
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_start_open_door(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.closed)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new DOOR_STATE(enum_DOOR_STATE.closed), new DOOR_STATE(enum_DOOR_STATE.door_moving)).elementOf(this.door).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            let _ld_doors = this.doors;
+            this.doors = _ld_doors.override(new BRelation(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.door_moving))));
+            this.door = new DOOR_STATE(enum_DOOR_STATE.door_moving);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_open_door_last(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            let _ld_doors = this.doors;
+            this.doors = _ld_doors.override(new BRelation(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.open))));
+            this.door = new DOOR_STATE(enum_DOOR_STATE.open);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_open_door_skip(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).unequal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.doors = this.doors.override(new BRelation(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.open))));
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_start_close_door(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new DOOR_STATE(enum_DOOR_STATE.door_moving), new DOOR_STATE(enum_DOOR_STATE.open)).elementOf(this.door).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            let _ld_doors = this.doors;
+            this.doors = _ld_doors.override(new BRelation(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.door_moving))));
+            this.door = new DOOR_STATE(enum_DOOR_STATE.door_moving);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_close_door(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BBoolean(!new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            let _ld_doors = this.doors;
+            this.doors = _ld_doors.override(new BRelation(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.closed))));
+            this.door = new DOOR_STATE(enum_DOOR_STATE.closed);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_close_door_skip(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).unequal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BBoolean(!new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.doors = this.doors.override(new BRelation(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.closed))));
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    toggle_handle_up() {
+        if ((this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down))).booleanValue()) {
+            this.handle = new HANDLE_STATE(enum_HANDLE_STATE.up);
+            this.handle_move = new BBoolean(true);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    toggle_handle_down() {
+        if ((this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up))).booleanValue()) {
+            this.handle = new HANDLE_STATE(enum_HANDLE_STATE.down);
+            this.handle_move = new BBoolean(true);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stimulate_general_valve() {
+        if ((new BBoolean(this.general_EV.equal(new BBoolean(false)).booleanValue() && this.handle_move.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.general_EV = new BBoolean(true);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stop_stimulate_general_valve() {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(true)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() || new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue()).booleanValue() || new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            this.general_EV = new BBoolean(false);
+            this.handle_move = new BBoolean(false);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    evn_open_general_valve() {
+        if ((new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(true)).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue()).booleanValue() && this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_closed)).booleanValue())).booleanValue()) {
+            this.general_valve = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    evn_close_general_valve() {
+        if ((new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(false)).booleanValue() || this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.general_valve = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_close_analogical_switch() {
+        if ((new BBoolean(this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_open)).booleanValue() && this.handle_move.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.analogical_switch = new SWITCH_STATE(enum_SWITCH_STATE.switch_closed);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_open_analogical_switch() {
+        if ((this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_closed))).booleanValue()) {
+            this.analogical_switch = new SWITCH_STATE(enum_SWITCH_STATE.switch_open);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    _get_analogical_switch() {
+        return this.analogical_switch;
+    }
+    _get_general_EV() {
+        return this.general_EV;
+    }
+    _get_general_valve() {
+        return this.general_valve;
+    }
+    _get_handle_move() {
+        return this.handle_move;
+    }
+    _get_close_EV() {
+        return this.close_EV;
+    }
+    _get_extend_EV() {
+        return this.extend_EV;
+    }
+    _get_open_EV() {
+        return this.open_EV;
+    }
+    _get_retract_EV() {
+        return this.retract_EV;
+    }
+    _get_shock_absorber() {
+        return this.shock_absorber;
+    }
+    _get_valve_close_door() {
+        return this.valve_close_door;
+    }
+    _get_valve_extend_gear() {
+        return this.valve_extend_gear;
+    }
+    _get_valve_open_door() {
+        return this.valve_open_door;
+    }
+    _get_valve_retract_gear() {
+        return this.valve_retract_gear;
+    }
+    _get_doors() {
+        return this.doors;
+    }
+    _get_gears() {
+        return this.gears;
+    }
+    _get_handle() {
+        return this.handle;
+    }
+    _get_door() {
+        return this.door;
+    }
+    _get_gear() {
+        return this.gear;
+    }
+    _get__DOOR_STATE() {
+        return LandingGear_R6._DOOR_STATE;
+    }
+    _get__GEAR_STATE() {
+        return LandingGear_R6._GEAR_STATE;
+    }
+    _get__HANDLE_STATE() {
+        return LandingGear_R6._HANDLE_STATE;
+    }
+    _get__POSITION() {
+        return LandingGear_R6._POSITION;
+    }
+    _get__SWITCH_STATE() {
+        return LandingGear_R6._SWITCH_STATE;
+    }
+    _get__PLANE_STATE() {
+        return LandingGear_R6._PLANE_STATE;
+    }
+    _get__VALVE_STATE() {
+        return LandingGear_R6._VALVE_STATE;
+    }
+    _tr_begin_flying() {
+        return this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue();
+    }
+    _tr_land_plane() {
+        return this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.flight)).booleanValue();
+    }
+    _tr_open_valve_door_open() {
+        return new BBoolean(this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_close_valve_door_open() {
+        return new BBoolean(this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue();
+    }
+    _tr_open_valve_door_close() {
+        return new BBoolean(this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.close_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_close_valve_door_close() {
+        return new BBoolean(this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue();
+    }
+    _tr_open_valve_retract_gear() {
+        return new BBoolean(this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.retract_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_close_valve_retract_gear() {
+        return new BBoolean(this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue();
+    }
+    _tr_open_valve_extend_gear() {
+        return new BBoolean(this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.extend_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_close_valve_extend_gear() {
+        return new BBoolean(this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue();
+    }
+    _tr_con_stimulate_open_door_valve() {
+        return new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(false)).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).not().booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).not().booleanValue()).booleanValue() && new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).not().booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_con_stop_stimulate_open_door_valve() {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(true)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_con_stimulate_close_door_valve() {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.close_EV.equal(new BBoolean(false)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).not().booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_con_stop_stimulate_close_door_valve() {
+        return new BBoolean(new BBoolean(this.close_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_con_stimulate_retract_gear_valve() {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.retract_EV.equal(new BBoolean(false)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).not().booleanValue()).booleanValue() && this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.flight)).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_con_stop_stimulate_retract_gear_valve() {
+        return new BBoolean(new BBoolean(this.retract_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_con_stimulate_extend_gear_valve() {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.extend_EV.equal(new BBoolean(false)).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).not().booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_con_stop_stimulate_extend_gear_valve() {
+        return new BBoolean(new BBoolean(this.extend_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_env_start_retracting_first() {
+        let _ic_set_18 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() && this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.gear_moving)).elementOf(this.gear).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+                _ic_set_18 = _ic_set_18.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_18;
+    }
+    _tr_env_retract_gear_skip() {
+        let _ic_set_19 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).unequal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+                _ic_set_19 = _ic_set_19.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_19;
+    }
+    _tr_env_retract_gear_last() {
+        let _ic_set_20 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+                _ic_set_20 = _ic_set_20.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_20;
+    }
+    _tr_env_start_extending() {
+        let _ic_set_21 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() && this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+                _ic_set_21 = _ic_set_21.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_21;
+    }
+    _tr_env_extend_gear_last() {
+        let _ic_set_22 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+                _ic_set_22 = _ic_set_22.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_22;
+    }
+    _tr_env_extend_gear_skip() {
+        let _ic_set_23 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).unequal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+                _ic_set_23 = _ic_set_23.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_23;
+    }
+    _tr_env_start_open_door() {
+        let _ic_set_24 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.closed)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new DOOR_STATE(enum_DOOR_STATE.closed), new DOOR_STATE(enum_DOOR_STATE.door_moving)).elementOf(this.door).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+                _ic_set_24 = _ic_set_24.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_24;
+    }
+    _tr_env_open_door_last() {
+        let _ic_set_25 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+                _ic_set_25 = _ic_set_25.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_25;
+    }
+    _tr_env_open_door_skip() {
+        let _ic_set_26 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).unequal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+                _ic_set_26 = _ic_set_26.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_26;
+    }
+    _tr_env_start_close_door() {
+        let _ic_set_27 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new DOOR_STATE(enum_DOOR_STATE.door_moving), new DOOR_STATE(enum_DOOR_STATE.open)).elementOf(this.door).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+                _ic_set_27 = _ic_set_27.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_27;
+    }
+    _tr_env_close_door() {
+        let _ic_set_28 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BBoolean(!new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+                _ic_set_28 = _ic_set_28.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_28;
+    }
+    _tr_env_close_door_skip() {
+        let _ic_set_29 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).unequal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BBoolean(!new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+                _ic_set_29 = _ic_set_29.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_29;
+    }
+    _tr_toggle_handle_up() {
+        return this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue();
+    }
+    _tr_toggle_handle_down() {
+        return this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue();
+    }
+    _tr_con_stimulate_general_valve() {
+        return new BBoolean(this.general_EV.equal(new BBoolean(false)).booleanValue() && this.handle_move.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_con_stop_stimulate_general_valve() {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(true)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() || new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue()).booleanValue() || new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue()).booleanValue()).booleanValue();
+    }
+    _tr_evn_open_general_valve() {
+        return new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(true)).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue()).booleanValue() && this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_closed)).booleanValue()).booleanValue();
+    }
+    _tr_evn_close_general_valve() {
+        return new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(false)).booleanValue() || this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue();
+    }
+    _tr_env_close_analogical_switch() {
+        return new BBoolean(this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_open)).booleanValue() && this.handle_move.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_env_open_analogical_switch() {
+        return this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_closed)).booleanValue();
+    }
+    _check_inv_1() {
+        return LandingGear_R6._SWITCH_STATE.elementOf(this.analogical_switch).booleanValue();
+    }
+    _check_inv_2() {
+        return BUtils.BOOL.elementOf(this.general_EV).booleanValue();
+    }
+    _check_inv_3() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.general_valve).booleanValue();
+    }
+    _check_inv_4() {
+        return BUtils.BOOL.elementOf(this.handle_move).booleanValue();
+    }
+    _check_inv_5() {
+        return BUtils.BOOL.elementOf(this.close_EV).booleanValue();
+    }
+    _check_inv_6() {
+        return BUtils.BOOL.elementOf(this.extend_EV).booleanValue();
+    }
+    _check_inv_7() {
+        return BUtils.BOOL.elementOf(this.open_EV).booleanValue();
+    }
+    _check_inv_8() {
+        return BUtils.BOOL.elementOf(this.retract_EV).booleanValue();
+    }
+    _check_inv_9() {
+        return LandingGear_R6._PLANE_STATE.elementOf(this.shock_absorber).booleanValue();
+    }
+    _check_inv_10() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.valve_close_door).booleanValue();
+    }
+    _check_inv_11() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.valve_extend_gear).booleanValue();
+    }
+    _check_inv_12() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.valve_open_door).booleanValue();
+    }
+    _check_inv_13() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.valve_retract_gear).booleanValue();
+    }
+    _check_inv_14() {
+        return LandingGear_R6._HANDLE_STATE.elementOf(this.handle).booleanValue();
+    }
+    _check_inv_15() {
+        return LandingGear_R6._DOOR_STATE.elementOf(this.door).booleanValue();
+    }
+    _check_inv_16() {
+        return LandingGear_R6._GEAR_STATE.elementOf(this.gear).booleanValue();
+    }
+    _check_inv_17() {
+        return new BBoolean(!new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(true)).booleanValue() || this.close_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() || this.retract_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() || this.extend_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() || this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _check_inv_18() {
+        return new BBoolean(this.open_EV.equal(new BBoolean(true)).booleanValue() && this.close_EV.equal(new BBoolean(true)).booleanValue()).not().booleanValue();
+    }
+    _check_inv_19() {
+        return this.gears.checkDomain(LandingGear_R6._POSITION).and(this.gears.checkRange(LandingGear_R6._GEAR_STATE)).and(this.gears.isFunction()).and(this.gears.isTotal(LandingGear_R6._POSITION)).booleanValue();
+    }
+    _check_inv_20() {
+        return this.doors.checkDomain(LandingGear_R6._POSITION).and(this.doors.checkRange(LandingGear_R6._DOOR_STATE)).and(this.doors.isFunction()).and(this.doors.isTotal(LandingGear_R6._POSITION)).booleanValue();
+    }
+    _check_inv_21() {
+        return new BBoolean((!this.door.equal(new DOOR_STATE(enum_DOOR_STATE.closed)).booleanValue() || this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()) && (!this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue() || this.door.equal(new DOOR_STATE(enum_DOOR_STATE.closed)).booleanValue())).booleanValue();
+    }
+    _check_inv_22() {
+        return new BBoolean((!this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue() || this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()) && (!this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() || this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue();
+    }
+    _check_inv_23() {
+        return new BBoolean((!this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()) && (!this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue() || this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue())).booleanValue();
+    }
+    _check_inv_24() {
+        return new BBoolean((!this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()) && (!this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue())).booleanValue();
+    }
+    _check_inv_25() {
+        return new BBoolean(!this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue() || this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue()).booleanValue();
+    }
+}
+LandingGear_R6._DOOR_STATE = new BSet(new DOOR_STATE(enum_DOOR_STATE.open), new DOOR_STATE(enum_DOOR_STATE.closed), new DOOR_STATE(enum_DOOR_STATE.door_moving));
+LandingGear_R6._GEAR_STATE = new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted), new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.gear_moving));
+LandingGear_R6._HANDLE_STATE = new BSet(new HANDLE_STATE(enum_HANDLE_STATE.up), new HANDLE_STATE(enum_HANDLE_STATE.down));
+LandingGear_R6._POSITION = new BSet(new POSITION(enum_POSITION.fr), new POSITION(enum_POSITION.lt), new POSITION(enum_POSITION.rt));
+LandingGear_R6._SWITCH_STATE = new BSet(new SWITCH_STATE(enum_SWITCH_STATE.switch_open), new SWITCH_STATE(enum_SWITCH_STATE.switch_closed));
+LandingGear_R6._PLANE_STATE = new BSet(new PLANE_STATE(enum_PLANE_STATE.ground), new PLANE_STATE(enum_PLANE_STATE.flight));
+LandingGear_R6._VALVE_STATE = new BSet(new VALVE_STATE(enum_VALVE_STATE.valve_open), new VALVE_STATE(enum_VALVE_STATE.valve_closed));
diff --git a/B2Program/LandingGear/GearsDoors/LandingGear_R6.mch b/B2Program/LandingGear/GearsDoors/LandingGear_R6.mch
new file mode 100644
index 0000000000000000000000000000000000000000..72bd1819e166f1370614ab88f8b30a4c1927338b
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/LandingGear_R6.mch
@@ -0,0 +1,532 @@
+MACHINE LandingGear_R6
+SETS /* enumerated */
+  DOOR_STATE={open,closed,door_moving};
+  GEAR_STATE={retracted,extended,gear_moving};
+  HANDLE_STATE={up,down};
+  POSITION={fr,lt,rt};
+  SWITCH_STATE={switch_open,switch_closed};
+  PLANE_STATE={ground,flight};
+  VALVE_STATE={valve_open,valve_closed}
+
+VARIABLES
+  analogical_switch,
+  general_EV,
+  general_valve,
+  handle_move,
+  close_EV,
+  extend_EV,
+  open_EV,
+  retract_EV,
+  shock_absorber,
+  valve_close_door,
+  valve_extend_gear,
+  valve_open_door,
+  valve_retract_gear,
+  doors,
+  gears,
+  handle,
+  door,
+  gear
+
+/* PROMOTED OPERATIONS
+  begin_flying,
+  land_plane,
+  open_valve_door_open,
+  close_valve_door_open,
+  open_valve_door_close,
+  close_valve_door_close,
+  open_valve_retract_gear,
+  close_valve_retract_gear,
+  open_valve_extend_gear,
+  close_valve_extend_gear,
+  con_stimulate_open_door_valve,
+  con_stop_stimulate_open_door_valve,
+  con_stimulate_close_door_valve,
+  con_stop_stimulate_close_door_valve,
+  con_stimulate_retract_gear_valve,
+  con_stop_stimulate_retract_gear_valve,
+  con_stimulate_extend_gear_valve,
+  con_stop_stimulate_extend_gear_valve,
+  env_start_retracting_first,
+  env_retract_gear_skip,
+  env_retract_gear_last,
+  env_start_extending,
+  env_extend_gear_last,
+  env_extend_gear_skip,
+  env_start_open_door,
+  env_open_door_last,
+  env_open_door_skip,
+  env_start_close_door,
+  env_close_door,
+  env_close_door_skip,
+  toggle_handle_up,
+  toggle_handle_down,
+  con_stimulate_general_valve,
+  con_stop_stimulate_general_valve,
+  evn_open_general_valve,
+  evn_close_general_valve,
+  env_close_analogical_switch,
+  env_open_analogical_switch */
+INVARIANT
+analogical_switch : SWITCH_STATE
+& general_EV : BOOL
+& general_valve : VALVE_STATE
+& handle_move : BOOL
+& close_EV : BOOL
+& extend_EV : BOOL
+& open_EV : BOOL
+& retract_EV : BOOL
+& shock_absorber : PLANE_STATE
+& valve_close_door : VALVE_STATE
+& valve_extend_gear : VALVE_STATE
+& valve_open_door : VALVE_STATE
+& valve_retract_gear : VALVE_STATE
+& handle : HANDLE_STATE
+& door : DOOR_STATE
+& gear : GEAR_STATE
+& /* @R6GearsDoorsHandleValvesControllerSwitch:r51 */ ((open_EV = TRUE or close_EV = TRUE or retract_EV = TRUE or extend_EV = TRUE) => general_EV = TRUE)
+& /* @R5GearsDoorsHandleValvesController:R41 */ not(open_EV = TRUE & close_EV = TRUE)
+& /* @R3GearsDoorsHandle:inv1 */ gears : POSITION --> GEAR_STATE
+& /* @R3GearsDoorsHandle:inv2 */ doors : POSITION --> DOOR_STATE
+& /* @R3GearsDoorsHandle:glued1 */ (door = closed <=> ran(doors) = {closed})
+& /* @R3GearsDoorsHandle:glued2 */ (door = open <=> ran(doors) = {open})
+& /* @R3GearsDoorsHandle:glueg1 */ (gear = extended <=> ran(gears) = {extended})
+& /* @R3GearsDoorsHandle:glueg2 */ (gear = retracted <=> ran(gears) = {retracted})
+& /* @R1GearDoor:safety_inv1 */ (gear = gear_moving => door = open)
+
+
+INITIALISATION
+    gears := POSITION * {extended} ||
+    doors := POSITION * {closed} ||
+    handle := down ||
+    valve_extend_gear := valve_closed ||
+    valve_retract_gear := valve_closed ||
+    valve_open_door := valve_closed ||
+    valve_close_door := valve_closed ||
+    open_EV := FALSE ||
+    close_EV := FALSE ||
+    retract_EV := FALSE ||
+    extend_EV := FALSE ||
+    shock_absorber := ground ||
+    general_EV := FALSE ||
+    general_valve := valve_closed ||
+    analogical_switch := switch_open ||
+    handle_move := FALSE ||
+    gear := extended ||
+    door := closed
+
+OPERATIONS
+
+    begin_flying =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:onground */ shock_absorber = ground
+    THEN
+        shock_absorber := flight
+    END;
+
+    land_plane =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:onground */ shock_absorber = flight
+    THEN
+        shock_absorber := ground
+    END;
+
+    open_valve_door_open =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:valve_not_open */ valve_open_door = valve_closed
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ open_EV = TRUE
+    THEN
+        valve_open_door := valve_open
+    END;
+
+    close_valve_door_open =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:valve_not_closed */ valve_open_door = valve_open
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ open_EV = FALSE
+    THEN
+        valve_open_door := valve_closed
+    END;
+
+    open_valve_door_close =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:valve_not_open */ valve_close_door = valve_closed
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ close_EV = TRUE
+    THEN
+        valve_close_door := valve_open
+    END;
+
+    close_valve_door_close =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:valve_not_closed */ valve_close_door = valve_open
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ close_EV = FALSE
+    THEN
+        valve_close_door := valve_closed
+    END;
+
+    open_valve_retract_gear =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:valve_not_open */ valve_retract_gear = valve_closed
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ retract_EV = TRUE
+    THEN
+        valve_retract_gear := valve_open
+    END;
+
+    close_valve_retract_gear =
+    SELECT
+    /* @R6GearsDoorsHandleValvesControllerSwitch:valve_not_closed */ valve_retract_gear = valve_open
+    & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ retract_EV = FALSE
+    THEN
+        valve_retract_gear := valve_closed
+    END;
+
+    open_valve_extend_gear =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:valve_not_open */ valve_extend_gear = valve_closed
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ extend_EV = TRUE
+    THEN
+        valve_extend_gear := valve_open
+    END;
+
+    close_valve_extend_gear =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:valve_not_closed */ valve_extend_gear = valve_open
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ extend_EV = FALSE
+    THEN
+        valve_extend_gear := valve_closed
+    END;
+
+    con_stimulate_open_door_valve =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ open_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ close_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grdh1 */ ((handle = down & not(ran(gears) = {extended})) or (handle = up & not(ran(gears) = {retracted}) & not(ran(doors) = {open} & shock_absorber = ground)))
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_ev */ general_EV = TRUE
+    THEN
+        open_EV := TRUE
+    END;
+
+    con_stop_stimulate_open_door_valve =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ open_EV = TRUE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd11 */ extend_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd12 */ retract_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grdh1 */ ((handle = down & ran(gears) = {extended}) or (handle = up & (ran(gears) = {retracted} or shock_absorber = ground) & ran(doors) = {open}))
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_ev */ general_EV = TRUE
+    THEN
+        open_EV := FALSE
+    END;
+
+    con_stimulate_close_door_valve =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ close_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ open_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd11 */ extend_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd12 */ retract_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grdh1 */ ((handle = down & ran(gears) = {extended}) or (handle = up & (ran(gears) = {retracted} or shock_absorber = ground)))
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grddoors */ not(ran(doors) = {closed})
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_ev */ general_EV = TRUE
+    THEN
+        close_EV := TRUE
+    END;
+
+    con_stop_stimulate_close_door_valve =
+    SELECT
+    /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ close_EV = TRUE
+    & /* @R6GearsDoorsHandleValvesControllerSwitch:grdh1 */ ((handle = down & ran(gears) = {extended} & ran(doors) = {closed}) or (handle = up & (ran(gears) = {retracted} or shock_absorber = ground) & ran(doors) = {closed}))
+    & /* @R6GearsDoorsHandleValvesControllerSwitch:general_ev */ general_EV = TRUE
+    THEN
+        close_EV := FALSE
+    END;
+
+    con_stimulate_retract_gear_valve =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ retract_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ extend_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ open_EV = TRUE
+        & handle = up
+        & not(ran(gears) = {retracted})
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grdflight */ shock_absorber = flight
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grddoors */ ran(doors) = {open}
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_ev */ general_EV = TRUE
+    THEN
+        retract_EV := TRUE
+    END;
+
+    con_stop_stimulate_retract_gear_valve =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ retract_EV = TRUE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grdh1 */ (handle = down or ran(gears) = {retracted})
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_ev */ general_EV = TRUE
+    THEN
+        retract_EV := FALSE
+    END;
+
+    con_stimulate_extend_gear_valve =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ extend_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ retract_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ open_EV = TRUE
+        & handle = down
+        & not(ran(gears) = {extended})
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grddoors */ ran(doors) = {open}
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_ev */ general_EV = TRUE
+    THEN
+        extend_EV := TRUE
+    END;
+
+    con_stop_stimulate_extend_gear_valve =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ extend_EV = TRUE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grdh1 */ (handle = up or ran(gears) = {extended})
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_ev */ general_EV = TRUE
+    THEN
+        extend_EV := FALSE
+    END;
+
+    env_start_retracting_first(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:all_doors_open */ ran(doors) = {open}
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:handle_up */ handle = up
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:g1 */ gears(gr) = extended
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:gv */ valve_retract_gear = valve_open
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+        & /* @R2GearDoorHandle:g1 */ gear : {extended,gear_moving}
+        & /* @R2GearDoorHandle:door_open */ door = open
+    THEN
+        gears := gears <+ {gr |-> gear_moving} ||
+        gear := gear_moving
+    END;
+
+    env_retract_gear_skip(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:all_doors_open */ ran(doors) = {open}
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:all_others */ gears[POSITION \ {gr}] /= {retracted}
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:handle_up */ handle = up
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:g1 */ gears(gr) = gear_moving
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+    THEN
+        gears := gears <+ {gr |-> retracted}
+    END;
+
+    env_retract_gear_last(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:all_doors_open */ ran(doors) = {open}
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:all_others */ gears[POSITION \ {gr}] = {retracted}
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:handle_up */ handle = up
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:g1 */ gears(gr) = gear_moving
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+        & /* @R2GearDoorHandle:g1 */ gear = gear_moving
+        & /* @R2GearDoorHandle:door_open */ door = open
+    THEN
+        gears := gears <+ {gr |-> retracted} ||
+        gear := retracted
+    END;
+
+        env_start_extending(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:all_doors_open */ ran(doors) = {open}
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:handle_down */ handle = down
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:g1 */ gears(gr) = retracted
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:gv */ valve_extend_gear = valve_open
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+            & /* @R2GearDoorHandle:g1 */ gear : {gear_moving,retracted}
+            & /* @R2GearDoorHandle:door_open */ door = open
+        THEN
+            gears := gears <+ {gr |-> gear_moving} ||
+            gear := gear_moving
+        END;
+
+        env_extend_gear_last(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:all_doors_open */ ran(doors) = {open}
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:handle_down */ handle = down
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:all_others */ gears[POSITION \ {gr}] = {extended}
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:g1 */ gears(gr) = gear_moving
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+            & /* @R2GearDoorHandle:g1 */ gear = gear_moving
+            & /* @R2GearDoorHandle:door_open */ door = open
+        THEN
+            gears := gears <+ {gr |-> extended} ||
+            gear := extended
+        END;
+
+        env_extend_gear_skip(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:all_doors_open */ ran(doors) = {open}
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:handle_down */ handle = down
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:all_others */ gears[POSITION \ {gr}] /= {extended}
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:g1 */ gears(gr) = gear_moving
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+        THEN
+            gears := gears <+ {gr |-> extended}
+        END;
+
+        env_start_open_door(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+            & doors(gr) = closed
+            & gears(gr) /= gear_moving
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:nomov */ gear_moving /: ran(gears)
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:h */ ((handle = down & ran(gears) = {retracted}) or (handle = up & ran(gears) = {extended}))
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:gv */ valve_open_door = valve_open
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+            & door : {closed,door_moving}
+            & gear /= gear_moving
+            & /* @R2GearDoorHandle:h */ ((handle = down & gear = retracted) or (handle = up & gear = extended))
+        THEN
+            doors := doors <+ {gr |-> door_moving} ||
+            door := door_moving
+        END;
+
+        env_open_door_last(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+            & doors(gr) = door_moving
+            & gears(gr) /= gear_moving
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:nomov */ gear_moving /: ran(gears)
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:all_others */ doors[POSITION \ {gr}] = {open}
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:h */ ((handle = down & ran(gears) = {retracted}) or (handle = up & ran(gears) = {extended}))
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:gv */ valve_open_door = valve_open
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+            & door = door_moving
+            & gear /= gear_moving
+            & /* @R2GearDoorHandle:h */ ((handle = down & gear = retracted) or (handle = up & gear = extended))
+        THEN
+            doors := doors <+ {gr |-> open} ||
+            door := open
+        END;
+
+        env_open_door_skip(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+            & doors(gr) = door_moving
+            & gears(gr) /= gear_moving
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:nomov */ gear_moving /: ran(gears)
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:all_others */ doors[POSITION \ {gr}] /= {open}
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:h */ ((handle = down & ran(gears) = {retracted}) or (handle = up & ran(gears) = {extended}))
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:gv */ valve_open_door = valve_open
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+        THEN
+            doors := doors <+ {gr |-> open}
+        END;
+
+        env_start_close_door(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+            & doors(gr) = open
+            & gears(gr) /= gear_moving
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:h */ ((handle = up & (ran(gears) = {retracted} or ran(gears) = {extended})) or (handle = down & ran(gears) = {extended}))
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:gv */ valve_close_door = valve_open
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+            & door : {door_moving,open} & gear /= gear_moving & /* @R2GearDoorHandle:h */ ((handle = down & gear = extended) or (handle = up & gear : {extended,retracted}))
+        THEN
+            doors := doors <+ {gr |-> door_moving} ||
+            door := door_moving
+        END;
+
+        env_close_door(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+            & doors(gr) = door_moving & gears(gr) /= gear_moving & /* @R6GearsDoorsHandleValvesControllerSwitch:nomov */ gear_moving /: ran(gears)
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:all_others */ doors[POSITION \ {gr}] = {closed}
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:h */ ((handle = up & (ran(gears) = {retracted} or ran(gears) = {extended})) or (handle = down & ran(gears) = {extended}))
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:gv */ valve_close_door = valve_open
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:hground */ ((handle = up & ran(gears) = {extended}) => shock_absorber = ground)
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open & door = door_moving & gear /= gear_moving
+            & /* @R2GearDoorHandle:h */ ((handle = down & gear = extended) or (handle = up & gear : {extended,retracted}))
+        THEN
+            doors := doors <+ {gr |-> closed} ||
+            door := closed
+        END;
+
+        env_close_door_skip(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+        SELECT /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+        & doors(gr) = door_moving
+        & gears(gr) /= gear_moving
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:nomov */ gear_moving /: ran(gears)
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:all_others */ doors[POSITION \ {gr}] /= {closed}
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:h */ ((handle = up & (ran(gears) = {retracted} or ran(gears) = {extended})) or (handle = down & ran(gears) = {extended}))
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:gv */ valve_close_door = valve_open
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:hground */ ((handle = up & ran(gears) = {extended}) => shock_absorber = ground)
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+        THEN
+            doors := doors <+ {gr |-> closed}
+        END;
+
+        toggle_handle_up =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:h */ handle = down
+        THEN
+            handle := up ||
+            handle_move := TRUE
+        END;
+
+        toggle_handle_down =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:h */ handle = up
+        THEN
+            handle := down ||
+            handle_move := TRUE
+        END;
+
+        con_stimulate_general_valve =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ general_EV = FALSE
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ handle_move = TRUE
+        THEN
+            general_EV := TRUE
+        END;
+
+        con_stop_stimulate_general_valve =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ general_EV = TRUE
+            & open_EV = FALSE
+            & close_EV = FALSE
+            & retract_EV = FALSE
+            & extend_EV = FALSE
+            & close_EV = FALSE
+            & ((handle = up & ran(gears) = {retracted} & ran(doors) = {closed} & open_EV = FALSE) or (handle = down & ran(gears) = {extended} & ran(doors) = {closed} & open_EV = FALSE) or (handle = up & ran(gears) = {extended} & ran(doors) = {closed} & open_EV = FALSE))
+        THEN
+            general_EV := FALSE ||
+            handle_move := FALSE
+        END;
+
+        evn_open_general_valve =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ general_EV = TRUE
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ general_valve = valve_closed
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ analogical_switch = switch_closed
+        THEN
+            general_valve := valve_open
+        END;
+
+        evn_close_general_valve =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ (general_EV = FALSE or analogical_switch = switch_open )
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ general_valve = valve_open
+        THEN
+            general_valve := valve_closed
+        END;
+
+        env_close_analogical_switch =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ analogical_switch = switch_open
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ handle_move = TRUE
+        THEN
+            analogical_switch := switch_closed
+        END;
+
+        env_open_analogical_switch =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ analogical_switch = switch_closed
+        THEN
+            analogical_switch := switch_open
+        END
+
+END
diff --git a/B2Program/LandingGear/GearsDoors/LandingGear_R6.ts b/B2Program/LandingGear/GearsDoors/LandingGear_R6.ts
new file mode 100644
index 0000000000000000000000000000000000000000..ae569db86754755d02a16596dbec530fd6b67ee3
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/LandingGear_R6.ts
@@ -0,0 +1,1076 @@
+import {BTuple} from './btypes/BTuple.js';
+import {BBoolean} from './btypes/BBoolean.js';
+import {BRelation} from './btypes/BRelation.js';
+import {BSet} from './btypes/BSet.js';
+import {BObject} from './btypes/BObject.js';
+import {BUtils} from "./btypes/BUtils.js";
+import {SelectError} from "./btypes/BUtils.js";
+
+export enum enum_DOOR_STATE {
+    open,
+    closed,
+    door_moving
+}
+
+export class DOOR_STATE implements BObject{
+    value: enum_DOOR_STATE;
+
+    constructor(value: enum_DOOR_STATE) {
+        this.value = value;
+    }
+
+    equal(other: DOOR_STATE) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: DOOR_STATE) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof DOOR_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_DOOR_STATE[this.value].toString();
+    }
+
+    static get_open () {return new DOOR_STATE(enum_DOOR_STATE.open);}
+    static get_closed () {return new DOOR_STATE(enum_DOOR_STATE.closed);}
+    static get_door_moving () {return new DOOR_STATE(enum_DOOR_STATE.door_moving);}
+
+
+}
+
+export enum enum_GEAR_STATE {
+    retracted,
+    extended,
+    gear_moving
+}
+
+export class GEAR_STATE implements BObject{
+    value: enum_GEAR_STATE;
+
+    constructor(value: enum_GEAR_STATE) {
+        this.value = value;
+    }
+
+    equal(other: GEAR_STATE) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: GEAR_STATE) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof GEAR_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_GEAR_STATE[this.value].toString();
+    }
+
+    static get_retracted () {return new GEAR_STATE(enum_GEAR_STATE.retracted);}
+    static get_extended () {return new GEAR_STATE(enum_GEAR_STATE.extended);}
+    static get_gear_moving () {return new GEAR_STATE(enum_GEAR_STATE.gear_moving);}
+
+
+}
+
+export enum enum_HANDLE_STATE {
+    up,
+    down
+}
+
+export class HANDLE_STATE implements BObject{
+    value: enum_HANDLE_STATE;
+
+    constructor(value: enum_HANDLE_STATE) {
+        this.value = value;
+    }
+
+    equal(other: HANDLE_STATE) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: HANDLE_STATE) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof HANDLE_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_HANDLE_STATE[this.value].toString();
+    }
+
+    static get_up () {return new HANDLE_STATE(enum_HANDLE_STATE.up);}
+    static get_down () {return new HANDLE_STATE(enum_HANDLE_STATE.down);}
+
+
+}
+
+export enum enum_POSITION {
+    fr,
+    lt,
+    rt
+}
+
+export class POSITION implements BObject{
+    value: enum_POSITION;
+
+    constructor(value: enum_POSITION) {
+        this.value = value;
+    }
+
+    equal(other: POSITION) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: POSITION) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof POSITION)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_POSITION[this.value].toString();
+    }
+
+    static get_fr () {return new POSITION(enum_POSITION.fr);}
+    static get_lt () {return new POSITION(enum_POSITION.lt);}
+    static get_rt () {return new POSITION(enum_POSITION.rt);}
+
+
+}
+
+export enum enum_SWITCH_STATE {
+    switch_open,
+    switch_closed
+}
+
+export class SWITCH_STATE implements BObject{
+    value: enum_SWITCH_STATE;
+
+    constructor(value: enum_SWITCH_STATE) {
+        this.value = value;
+    }
+
+    equal(other: SWITCH_STATE) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: SWITCH_STATE) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof SWITCH_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_SWITCH_STATE[this.value].toString();
+    }
+
+    static get_switch_open () {return new SWITCH_STATE(enum_SWITCH_STATE.switch_open);}
+    static get_switch_closed () {return new SWITCH_STATE(enum_SWITCH_STATE.switch_closed);}
+
+
+}
+
+export enum enum_PLANE_STATE {
+    ground,
+    flight
+}
+
+export class PLANE_STATE implements BObject{
+    value: enum_PLANE_STATE;
+
+    constructor(value: enum_PLANE_STATE) {
+        this.value = value;
+    }
+
+    equal(other: PLANE_STATE) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: PLANE_STATE) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof PLANE_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_PLANE_STATE[this.value].toString();
+    }
+
+    static get_ground () {return new PLANE_STATE(enum_PLANE_STATE.ground);}
+    static get_flight () {return new PLANE_STATE(enum_PLANE_STATE.flight);}
+
+
+}
+
+export enum enum_VALVE_STATE {
+    valve_open,
+    valve_closed
+}
+
+export class VALVE_STATE implements BObject{
+    value: enum_VALVE_STATE;
+
+    constructor(value: enum_VALVE_STATE) {
+        this.value = value;
+    }
+
+    equal(other: VALVE_STATE) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: VALVE_STATE) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof VALVE_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_VALVE_STATE[this.value].toString();
+    }
+
+    static get_valve_open () {return new VALVE_STATE(enum_VALVE_STATE.valve_open);}
+    static get_valve_closed () {return new VALVE_STATE(enum_VALVE_STATE.valve_closed);}
+
+
+}
+
+
+export default class LandingGear_R6 {
+
+
+
+    private static _DOOR_STATE: BSet<DOOR_STATE> = new BSet(new DOOR_STATE(enum_DOOR_STATE.open), new DOOR_STATE(enum_DOOR_STATE.closed), new DOOR_STATE(enum_DOOR_STATE.door_moving));
+    private static _GEAR_STATE: BSet<GEAR_STATE> = new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted), new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.gear_moving));
+    private static _HANDLE_STATE: BSet<HANDLE_STATE> = new BSet(new HANDLE_STATE(enum_HANDLE_STATE.up), new HANDLE_STATE(enum_HANDLE_STATE.down));
+    private static _POSITION: BSet<POSITION> = new BSet(new POSITION(enum_POSITION.fr), new POSITION(enum_POSITION.lt), new POSITION(enum_POSITION.rt));
+    private static _SWITCH_STATE: BSet<SWITCH_STATE> = new BSet(new SWITCH_STATE(enum_SWITCH_STATE.switch_open), new SWITCH_STATE(enum_SWITCH_STATE.switch_closed));
+    private static _PLANE_STATE: BSet<PLANE_STATE> = new BSet(new PLANE_STATE(enum_PLANE_STATE.ground), new PLANE_STATE(enum_PLANE_STATE.flight));
+    private static _VALVE_STATE: BSet<VALVE_STATE> = new BSet(new VALVE_STATE(enum_VALVE_STATE.valve_open), new VALVE_STATE(enum_VALVE_STATE.valve_closed));
+
+    private analogical_switch: SWITCH_STATE;
+    private general_EV: BBoolean;
+    private general_valve: VALVE_STATE;
+    private handle_move: BBoolean;
+    private close_EV: BBoolean;
+    private extend_EV: BBoolean;
+    private open_EV: BBoolean;
+    private retract_EV: BBoolean;
+    private shock_absorber: PLANE_STATE;
+    private valve_close_door: VALVE_STATE;
+    private valve_extend_gear: VALVE_STATE;
+    private valve_open_door: VALVE_STATE;
+    private valve_retract_gear: VALVE_STATE;
+    private doors: BRelation<POSITION, DOOR_STATE>;
+    private gears: BRelation<POSITION, GEAR_STATE>;
+    private handle: HANDLE_STATE;
+    private door: DOOR_STATE;
+    private gear: GEAR_STATE;
+
+    constructor() {
+        this.gears = BRelation.cartesianProduct(LandingGear_R6._POSITION, new BSet(new GEAR_STATE(enum_GEAR_STATE.extended)));
+        this.doors = BRelation.cartesianProduct(LandingGear_R6._POSITION, new BSet(new DOOR_STATE(enum_DOOR_STATE.closed)));
+        this.handle = new HANDLE_STATE(enum_HANDLE_STATE.down);
+        this.valve_extend_gear = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.valve_retract_gear = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.valve_open_door = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.valve_close_door = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.open_EV = new BBoolean(false);
+        this.close_EV = new BBoolean(false);
+        this.retract_EV = new BBoolean(false);
+        this.extend_EV = new BBoolean(false);
+        this.shock_absorber = new PLANE_STATE(enum_PLANE_STATE.ground);
+        this.general_EV = new BBoolean(false);
+        this.general_valve = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.analogical_switch = new SWITCH_STATE(enum_SWITCH_STATE.switch_open);
+        this.handle_move = new BBoolean(false);
+        this.gear = new GEAR_STATE(enum_GEAR_STATE.extended);
+        this.door = new DOOR_STATE(enum_DOOR_STATE.closed);
+    }
+
+    public _copy(): LandingGear_R6 {
+        let _instance = Object.create(LandingGear_R6.prototype);
+        for(let key of Object.keys(this)) {
+            _instance[key] = this[key]._copy?.() ?? this[key];
+        }
+        return _instance;
+    }
+
+     begin_flying(): void {
+        if((this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground))).booleanValue()) {
+            this.shock_absorber = new PLANE_STATE(enum_PLANE_STATE.flight);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     land_plane(): void {
+        if((this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.flight))).booleanValue()) {
+            this.shock_absorber = new PLANE_STATE(enum_PLANE_STATE.ground);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     open_valve_door_open(): void {
+        if((new BBoolean(this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.valve_open_door = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     close_valve_door_open(): void {
+        if((new BBoolean(this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue())).booleanValue()) {
+            this.valve_open_door = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     open_valve_door_close(): void {
+        if((new BBoolean(this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.close_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.valve_close_door = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     close_valve_door_close(): void {
+        if((new BBoolean(this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue())).booleanValue()) {
+            this.valve_close_door = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     open_valve_retract_gear(): void {
+        if((new BBoolean(this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.retract_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.valve_retract_gear = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     close_valve_retract_gear(): void {
+        if((new BBoolean(this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue())).booleanValue()) {
+            this.valve_retract_gear = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     open_valve_extend_gear(): void {
+        if((new BBoolean(this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.extend_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.valve_extend_gear = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     close_valve_extend_gear(): void {
+        if((new BBoolean(this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue())).booleanValue()) {
+            this.valve_extend_gear = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stimulate_open_door_valve(): void {
+        if((new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(false)).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).not().booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).not().booleanValue()).booleanValue() && new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).not().booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.open_EV = new BBoolean(true);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stop_stimulate_open_door_valve(): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(true)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.open_EV = new BBoolean(false);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stimulate_close_door_valve(): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.close_EV.equal(new BBoolean(false)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).not().booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.close_EV = new BBoolean(true);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stop_stimulate_close_door_valve(): void {
+        if((new BBoolean(new BBoolean(this.close_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.close_EV = new BBoolean(false);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stimulate_retract_gear_valve(): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.retract_EV.equal(new BBoolean(false)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).not().booleanValue()).booleanValue() && this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.flight)).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.retract_EV = new BBoolean(true);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stop_stimulate_retract_gear_valve(): void {
+        if((new BBoolean(new BBoolean(this.retract_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.retract_EV = new BBoolean(false);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stimulate_extend_gear_valve(): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.extend_EV.equal(new BBoolean(false)).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).not().booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.extend_EV = new BBoolean(true);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stop_stimulate_extend_gear_valve(): void {
+        if((new BBoolean(new BBoolean(this.extend_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.extend_EV = new BBoolean(false);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_start_retracting_first(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() && this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.gear_moving)).elementOf(this.gear).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+            let _ld_gears: BRelation<POSITION, GEAR_STATE> = this.gears;
+            this.gears = _ld_gears.override(new BRelation<POSITION, GEAR_STATE>(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.gear_moving))));
+            this.gear = new GEAR_STATE(enum_GEAR_STATE.gear_moving);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_retract_gear_skip(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).unequal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.gears = this.gears.override(new BRelation<POSITION, GEAR_STATE>(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.retracted))));
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_retract_gear_last(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+            let _ld_gears: BRelation<POSITION, GEAR_STATE> = this.gears;
+            this.gears = _ld_gears.override(new BRelation<POSITION, GEAR_STATE>(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.retracted))));
+            this.gear = new GEAR_STATE(enum_GEAR_STATE.retracted);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_start_extending(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() && this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+            let _ld_gears: BRelation<POSITION, GEAR_STATE> = this.gears;
+            this.gears = _ld_gears.override(new BRelation<POSITION, GEAR_STATE>(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.gear_moving))));
+            this.gear = new GEAR_STATE(enum_GEAR_STATE.gear_moving);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_extend_gear_last(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+            let _ld_gears: BRelation<POSITION, GEAR_STATE> = this.gears;
+            this.gears = _ld_gears.override(new BRelation<POSITION, GEAR_STATE>(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.extended))));
+            this.gear = new GEAR_STATE(enum_GEAR_STATE.extended);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_extend_gear_skip(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).unequal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.gears = this.gears.override(new BRelation<POSITION, GEAR_STATE>(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.extended))));
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_start_open_door(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.closed)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new DOOR_STATE(enum_DOOR_STATE.closed), new DOOR_STATE(enum_DOOR_STATE.door_moving)).elementOf(this.door).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            let _ld_doors: BRelation<POSITION, DOOR_STATE> = this.doors;
+            this.doors = _ld_doors.override(new BRelation<POSITION, DOOR_STATE>(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.door_moving))));
+            this.door = new DOOR_STATE(enum_DOOR_STATE.door_moving);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_open_door_last(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            let _ld_doors: BRelation<POSITION, DOOR_STATE> = this.doors;
+            this.doors = _ld_doors.override(new BRelation<POSITION, DOOR_STATE>(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.open))));
+            this.door = new DOOR_STATE(enum_DOOR_STATE.open);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_open_door_skip(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).unequal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.doors = this.doors.override(new BRelation<POSITION, DOOR_STATE>(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.open))));
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_start_close_door(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new DOOR_STATE(enum_DOOR_STATE.door_moving), new DOOR_STATE(enum_DOOR_STATE.open)).elementOf(this.door).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            let _ld_doors: BRelation<POSITION, DOOR_STATE> = this.doors;
+            this.doors = _ld_doors.override(new BRelation<POSITION, DOOR_STATE>(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.door_moving))));
+            this.door = new DOOR_STATE(enum_DOOR_STATE.door_moving);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_close_door(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BBoolean(!new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            let _ld_doors: BRelation<POSITION, DOOR_STATE> = this.doors;
+            this.doors = _ld_doors.override(new BRelation<POSITION, DOOR_STATE>(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.closed))));
+            this.door = new DOOR_STATE(enum_DOOR_STATE.closed);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_close_door_skip(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).unequal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BBoolean(!new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.doors = this.doors.override(new BRelation<POSITION, DOOR_STATE>(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.closed))));
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     toggle_handle_up(): void {
+        if((this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down))).booleanValue()) {
+            this.handle = new HANDLE_STATE(enum_HANDLE_STATE.up);
+            this.handle_move = new BBoolean(true);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     toggle_handle_down(): void {
+        if((this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up))).booleanValue()) {
+            this.handle = new HANDLE_STATE(enum_HANDLE_STATE.down);
+            this.handle_move = new BBoolean(true);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stimulate_general_valve(): void {
+        if((new BBoolean(this.general_EV.equal(new BBoolean(false)).booleanValue() && this.handle_move.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.general_EV = new BBoolean(true);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stop_stimulate_general_valve(): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(true)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() || new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue()).booleanValue() || new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            this.general_EV = new BBoolean(false);
+            this.handle_move = new BBoolean(false);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     evn_open_general_valve(): void {
+        if((new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(true)).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue()).booleanValue() && this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_closed)).booleanValue())).booleanValue()) {
+            this.general_valve = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     evn_close_general_valve(): void {
+        if((new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(false)).booleanValue() || this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.general_valve = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_close_analogical_switch(): void {
+        if((new BBoolean(this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_open)).booleanValue() && this.handle_move.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.analogical_switch = new SWITCH_STATE(enum_SWITCH_STATE.switch_closed);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_open_analogical_switch(): void {
+        if((this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_closed))).booleanValue()) {
+            this.analogical_switch = new SWITCH_STATE(enum_SWITCH_STATE.switch_open);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+    _get_analogical_switch(): SWITCH_STATE {
+        return this.analogical_switch;
+    }
+
+    _get_general_EV(): BBoolean {
+        return this.general_EV;
+    }
+
+    _get_general_valve(): VALVE_STATE {
+        return this.general_valve;
+    }
+
+    _get_handle_move(): BBoolean {
+        return this.handle_move;
+    }
+
+    _get_close_EV(): BBoolean {
+        return this.close_EV;
+    }
+
+    _get_extend_EV(): BBoolean {
+        return this.extend_EV;
+    }
+
+    _get_open_EV(): BBoolean {
+        return this.open_EV;
+    }
+
+    _get_retract_EV(): BBoolean {
+        return this.retract_EV;
+    }
+
+    _get_shock_absorber(): PLANE_STATE {
+        return this.shock_absorber;
+    }
+
+    _get_valve_close_door(): VALVE_STATE {
+        return this.valve_close_door;
+    }
+
+    _get_valve_extend_gear(): VALVE_STATE {
+        return this.valve_extend_gear;
+    }
+
+    _get_valve_open_door(): VALVE_STATE {
+        return this.valve_open_door;
+    }
+
+    _get_valve_retract_gear(): VALVE_STATE {
+        return this.valve_retract_gear;
+    }
+
+    _get_doors(): BRelation<POSITION, DOOR_STATE> {
+        return this.doors;
+    }
+
+    _get_gears(): BRelation<POSITION, GEAR_STATE> {
+        return this.gears;
+    }
+
+    _get_handle(): HANDLE_STATE {
+        return this.handle;
+    }
+
+    _get_door(): DOOR_STATE {
+        return this.door;
+    }
+
+    _get_gear(): GEAR_STATE {
+        return this.gear;
+    }
+
+    _get__DOOR_STATE(): BSet<DOOR_STATE> {
+        return LandingGear_R6._DOOR_STATE;
+    }
+
+    _get__GEAR_STATE(): BSet<GEAR_STATE> {
+        return LandingGear_R6._GEAR_STATE;
+    }
+
+    _get__HANDLE_STATE(): BSet<HANDLE_STATE> {
+        return LandingGear_R6._HANDLE_STATE;
+    }
+
+    _get__POSITION(): BSet<POSITION> {
+        return LandingGear_R6._POSITION;
+    }
+
+    _get__SWITCH_STATE(): BSet<SWITCH_STATE> {
+        return LandingGear_R6._SWITCH_STATE;
+    }
+
+    _get__PLANE_STATE(): BSet<PLANE_STATE> {
+        return LandingGear_R6._PLANE_STATE;
+    }
+
+    _get__VALVE_STATE(): BSet<VALVE_STATE> {
+        return LandingGear_R6._VALVE_STATE;
+    }
+
+    _tr_begin_flying(): boolean {
+        return this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue();
+    }
+
+    _tr_land_plane(): boolean {
+        return this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.flight)).booleanValue();
+    }
+
+    _tr_open_valve_door_open(): boolean {
+        return new BBoolean(this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_close_valve_door_open(): boolean {
+        return new BBoolean(this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue();
+    }
+
+    _tr_open_valve_door_close(): boolean {
+        return new BBoolean(this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.close_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_close_valve_door_close(): boolean {
+        return new BBoolean(this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue();
+    }
+
+    _tr_open_valve_retract_gear(): boolean {
+        return new BBoolean(this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.retract_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_close_valve_retract_gear(): boolean {
+        return new BBoolean(this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue();
+    }
+
+    _tr_open_valve_extend_gear(): boolean {
+        return new BBoolean(this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.extend_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_close_valve_extend_gear(): boolean {
+        return new BBoolean(this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue();
+    }
+
+    _tr_con_stimulate_open_door_valve(): boolean {
+        return new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(false)).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).not().booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).not().booleanValue()).booleanValue() && new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).not().booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_con_stop_stimulate_open_door_valve(): boolean {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(true)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_con_stimulate_close_door_valve(): boolean {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.close_EV.equal(new BBoolean(false)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).not().booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_con_stop_stimulate_close_door_valve(): boolean {
+        return new BBoolean(new BBoolean(this.close_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_con_stimulate_retract_gear_valve(): boolean {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.retract_EV.equal(new BBoolean(false)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).not().booleanValue()).booleanValue() && this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.flight)).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_con_stop_stimulate_retract_gear_valve(): boolean {
+        return new BBoolean(new BBoolean(this.retract_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_con_stimulate_extend_gear_valve(): boolean {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.extend_EV.equal(new BBoolean(false)).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).not().booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_con_stop_stimulate_extend_gear_valve(): boolean {
+        return new BBoolean(new BBoolean(this.extend_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_env_start_retracting_first(): BSet<POSITION> {
+        let _ic_set_18: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() && this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.gear_moving)).elementOf(this.gear).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+                _ic_set_18 = _ic_set_18.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_18;
+    }
+
+    _tr_env_retract_gear_skip(): BSet<POSITION> {
+        let _ic_set_19: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).unequal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+                _ic_set_19 = _ic_set_19.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_19;
+    }
+
+    _tr_env_retract_gear_last(): BSet<POSITION> {
+        let _ic_set_20: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+                _ic_set_20 = _ic_set_20.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_20;
+    }
+
+    _tr_env_start_extending(): BSet<POSITION> {
+        let _ic_set_21: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() && this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+                _ic_set_21 = _ic_set_21.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_21;
+    }
+
+    _tr_env_extend_gear_last(): BSet<POSITION> {
+        let _ic_set_22: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+                _ic_set_22 = _ic_set_22.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_22;
+    }
+
+    _tr_env_extend_gear_skip(): BSet<POSITION> {
+        let _ic_set_23: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).unequal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+                _ic_set_23 = _ic_set_23.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_23;
+    }
+
+    _tr_env_start_open_door(): BSet<POSITION> {
+        let _ic_set_24: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.closed)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new DOOR_STATE(enum_DOOR_STATE.closed), new DOOR_STATE(enum_DOOR_STATE.door_moving)).elementOf(this.door).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+                _ic_set_24 = _ic_set_24.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_24;
+    }
+
+    _tr_env_open_door_last(): BSet<POSITION> {
+        let _ic_set_25: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+                _ic_set_25 = _ic_set_25.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_25;
+    }
+
+    _tr_env_open_door_skip(): BSet<POSITION> {
+        let _ic_set_26: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).unequal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+                _ic_set_26 = _ic_set_26.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_26;
+    }
+
+    _tr_env_start_close_door(): BSet<POSITION> {
+        let _ic_set_27: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new DOOR_STATE(enum_DOOR_STATE.door_moving), new DOOR_STATE(enum_DOOR_STATE.open)).elementOf(this.door).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+                _ic_set_27 = _ic_set_27.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_27;
+    }
+
+    _tr_env_close_door(): BSet<POSITION> {
+        let _ic_set_28: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BBoolean(!new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+                _ic_set_28 = _ic_set_28.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_28;
+    }
+
+    _tr_env_close_door_skip(): BSet<POSITION> {
+        let _ic_set_29: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).unequal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BBoolean(!new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+                _ic_set_29 = _ic_set_29.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_29;
+    }
+
+    _tr_toggle_handle_up(): boolean {
+        return this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue();
+    }
+
+    _tr_toggle_handle_down(): boolean {
+        return this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue();
+    }
+
+    _tr_con_stimulate_general_valve(): boolean {
+        return new BBoolean(this.general_EV.equal(new BBoolean(false)).booleanValue() && this.handle_move.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_con_stop_stimulate_general_valve(): boolean {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(true)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() || new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue()).booleanValue() || new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue()).booleanValue()).booleanValue();
+    }
+
+    _tr_evn_open_general_valve(): boolean {
+        return new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(true)).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue()).booleanValue() && this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_closed)).booleanValue()).booleanValue();
+    }
+
+    _tr_evn_close_general_valve(): boolean {
+        return new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(false)).booleanValue() || this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue();
+    }
+
+    _tr_env_close_analogical_switch(): boolean {
+        return new BBoolean(this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_open)).booleanValue() && this.handle_move.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_env_open_analogical_switch(): boolean {
+        return this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_closed)).booleanValue();
+    }
+
+    _check_inv_1() {
+        return LandingGear_R6._SWITCH_STATE.elementOf(this.analogical_switch).booleanValue();
+    }_check_inv_2() {
+        return BUtils.BOOL.elementOf(this.general_EV).booleanValue();
+    }_check_inv_3() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.general_valve).booleanValue();
+    }_check_inv_4() {
+        return BUtils.BOOL.elementOf(this.handle_move).booleanValue();
+    }_check_inv_5() {
+        return BUtils.BOOL.elementOf(this.close_EV).booleanValue();
+    }_check_inv_6() {
+        return BUtils.BOOL.elementOf(this.extend_EV).booleanValue();
+    }_check_inv_7() {
+        return BUtils.BOOL.elementOf(this.open_EV).booleanValue();
+    }_check_inv_8() {
+        return BUtils.BOOL.elementOf(this.retract_EV).booleanValue();
+    }_check_inv_9() {
+        return LandingGear_R6._PLANE_STATE.elementOf(this.shock_absorber).booleanValue();
+    }_check_inv_10() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.valve_close_door).booleanValue();
+    }_check_inv_11() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.valve_extend_gear).booleanValue();
+    }_check_inv_12() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.valve_open_door).booleanValue();
+    }_check_inv_13() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.valve_retract_gear).booleanValue();
+    }_check_inv_14() {
+        return LandingGear_R6._HANDLE_STATE.elementOf(this.handle).booleanValue();
+    }_check_inv_15() {
+        return LandingGear_R6._DOOR_STATE.elementOf(this.door).booleanValue();
+    }_check_inv_16() {
+        return LandingGear_R6._GEAR_STATE.elementOf(this.gear).booleanValue();
+    }_check_inv_17() {
+        return new BBoolean(!new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(true)).booleanValue() || this.close_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() || this.retract_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() || this.extend_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() || this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }_check_inv_18() {
+        return new BBoolean(this.open_EV.equal(new BBoolean(true)).booleanValue() && this.close_EV.equal(new BBoolean(true)).booleanValue()).not().booleanValue();
+    }_check_inv_19() {
+        return this.gears.checkDomain(LandingGear_R6._POSITION).and(this.gears.checkRange(LandingGear_R6._GEAR_STATE)).and(this.gears.isFunction()).and(this.gears.isTotal(LandingGear_R6._POSITION)).booleanValue();
+    }_check_inv_20() {
+        return this.doors.checkDomain(LandingGear_R6._POSITION).and(this.doors.checkRange(LandingGear_R6._DOOR_STATE)).and(this.doors.isFunction()).and(this.doors.isTotal(LandingGear_R6._POSITION)).booleanValue();
+    }_check_inv_21() {
+        return new BBoolean((!this.door.equal(new DOOR_STATE(enum_DOOR_STATE.closed)).booleanValue() || this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()) && (!this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue() || this.door.equal(new DOOR_STATE(enum_DOOR_STATE.closed)).booleanValue())).booleanValue();
+    }_check_inv_22() {
+        return new BBoolean((!this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue() || this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()) && (!this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() || this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue();
+    }_check_inv_23() {
+        return new BBoolean((!this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()) && (!this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue() || this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue())).booleanValue();
+    }_check_inv_24() {
+        return new BBoolean((!this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()) && (!this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue())).booleanValue();
+    }_check_inv_25() {
+        return new BBoolean(!this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue() || this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue()).booleanValue();
+    }
+
+
+}
+
diff --git a/B2Program/LandingGear/GearsDoors/Outgoing.prob2trace b/B2Program/LandingGear/GearsDoors/Outgoing.prob2trace
new file mode 100644
index 0000000000000000000000000000000000000000..68abd72d16bcf8669c75564d92a1fa0012122a68
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/Outgoing.prob2trace
@@ -0,0 +1,195 @@
+{
+	"description": "Created from B2Program JS Export",
+	"transitionList": [
+		{
+			"name": "$initialise_machine",
+			"params": {}
+		},
+		{
+			"name": "toggle_handle_up",
+			"params": {}
+		},
+		{
+			"name": "begin_flying",
+			"params": {}
+		},
+		{
+			"name": "con_stimulate_general_valve",
+			"params": {}
+		},
+		{
+			"name": "con_stimulate_open_door_valve",
+			"params": {}
+		},
+		{
+			"name": "env_close_analogical_switch",
+			"params": {}
+		},
+		{
+			"name": "open_valve_door_open",
+			"params": {}
+		},
+		{
+			"name": "evn_open_general_valve",
+			"params": {}
+		},
+		{
+			"name": "env_start_open_door",
+			"params": {}
+		},
+		{
+			"name": "env_start_open_door",
+			"params": {}
+		},
+		{
+			"name": "env_start_open_door",
+			"params": {
+				"gr": "rt"
+			}
+		},
+		{
+			"name": "env_open_door_skip",
+			"params": {
+				"gr": "fr"
+			}
+		},
+		{
+			"name": "env_open_door_skip",
+			"params": {
+				"gr": "lt"
+			}
+		},
+		{
+			"name": "env_open_door_last",
+			"params": {
+				"gr": "rt"
+			}
+		},
+		{
+			"name": "con_stimulate_retract_gear_valve",
+			"params": {}
+		},
+		{
+			"name": "open_valve_retract_gear",
+			"params": {}
+		},
+		{
+			"name": "env_start_retracting_first",
+			"params": {
+				"gr": "fr"
+			}
+		},
+		{
+			"name": "env_start_retracting_first",
+			"params": {
+				"gr": "lt"
+			}
+		},
+		{
+			"name": "env_start_retracting_first",
+			"params": {
+				"gr": "rt"
+			}
+		},
+		{
+			"name": "env_retract_gear_skip",
+			"params": {
+				"gr": "fr"
+			}
+		},
+		{
+			"name": "env_retract_gear_skip",
+			"params": {
+				"gr": "lt"
+			}
+		},
+		{
+			"name": "env_retract_gear_last",
+			"params": {
+				"gr": "rt"
+			}
+		},
+		{
+			"name": "con_stop_stimulate_retract_gear_valve",
+			"params": {}
+		},
+		{
+			"name": "con_stop_stimulate_open_door_valve",
+			"params": {}
+		},
+		{
+			"name": "close_valve_door_open",
+			"params": {}
+		},
+		{
+			"name": "con_stimulate_close_door_valve",
+			"params": {}
+		},
+		{
+			"name": "open_valve_door_close",
+			"params": {}
+		},
+		{
+			"name": "env_start_close_door",
+			"params": {
+				"gr": "fr"
+			}
+		},
+		{
+			"name": "env_start_close_door",
+			"params": {
+				"gr": "lt"
+			}
+		},
+		{
+			"name": "env_start_close_door",
+			"params": {
+				"gr": "rt"
+			}
+		},
+		{
+			"name": "env_close_door_skip",
+			"params": {
+				"gr": "fr"
+			}
+		},
+		{
+			"name": "env_close_door_skip",
+			"params": {
+				"gr": "lt"
+			}
+		},
+		{
+			"name": "env_close_door",
+			"params": {
+				"gr": "rt"
+			}
+		},
+		{
+			"name": "con_stop_stimulate_close_door_valve",
+			"params": {}
+		},
+		{
+			"name": "close_valve_door_close",
+			"params": {}
+		},
+		{
+			"name": "con_stop_stimulate_general_valve",
+			"params": {}
+		},
+		{
+			"name": "close_valve_retract_gear",
+			"params": {}
+		},
+		{
+			"name": "evn_close_general_valve",
+			"params": {}
+		}
+	],
+	"metadata": {
+		"fileType": "Trace",
+		"formatVersion": 1,
+		"creator": "B2Program JS",
+		"modelName": "LandingGear_R6"
+	}
+}
\ No newline at end of file
diff --git a/B2Program/LandingGear/GearsDoors/btypes/BBoolean.js b/B2Program/LandingGear/GearsDoors/btypes/BBoolean.js
new file mode 100755
index 0000000000000000000000000000000000000000..130448faa26383f85f2db7a048581e0778fdb1d5
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/btypes/BBoolean.js
@@ -0,0 +1,49 @@
+export class BBoolean {
+    constructor(value) {
+        if (typeof (value) === 'boolean') {
+            this.value = value;
+        }
+        else if (typeof value === 'string') {
+            this.value = value.toLowerCase() === 'true';
+        }
+        else {
+            this.value = value.value;
+        }
+    }
+    and(other) {
+        return new BBoolean(this.value && other.value);
+    }
+    or(other) {
+        return new BBoolean(this.value || other.value);
+    }
+    not() {
+        return new BBoolean(!this.value);
+    }
+    implies(other) {
+        return this.not().or(other);
+    }
+    equivalent(other) {
+        return this.implies(other).and(other.implies(this));
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    equals(other) {
+        if (!(other instanceof BBoolean)) {
+            return false;
+        }
+        return this.equal(other).booleanValue();
+    }
+    unequal(other) {
+        return new BBoolean(this.value != other.value);
+    }
+    booleanValue() {
+        return this.value;
+    }
+    toString() {
+        return this.value.toString();
+    }
+    hashCode() {
+        return this.value ? 1 : 0;
+    }
+}
diff --git a/B2Program/LandingGear/GearsDoors/btypes/BInteger.js b/B2Program/LandingGear/GearsDoors/btypes/BInteger.js
new file mode 100755
index 0000000000000000000000000000000000000000..11c2723b5e4781ff02f7a59b101aebb174d65cbf
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/btypes/BInteger.js
@@ -0,0 +1,108 @@
+import { BBoolean } from './BBoolean.js';
+export class BInteger {
+    constructor(value) {
+        this.value = value;
+    }
+    equals(obj) {
+        if (obj instanceof BInteger) {
+            return this.compareTo(obj) === 0;
+        }
+        return false;
+    }
+    static build(value) {
+        return new BInteger(value);
+    }
+    compareTo(o) {
+        return this.value - o.value;
+    }
+    lessEqual(o) {
+        return new BBoolean(this.compareTo(o) <= 0);
+    }
+    greaterEqual(o) {
+        return new BBoolean(this.compareTo(o) >= 0);
+    }
+    less(o) {
+        return new BBoolean(this.compareTo(o) < 0);
+    }
+    greater(o) {
+        return new BBoolean(this.compareTo(o) > 0);
+    }
+    equal(o) {
+        return new BBoolean(this.compareTo(o) === 0);
+    }
+    unequal(o) {
+        return new BBoolean(this.compareTo(o) != 0);
+    }
+    intValue() {
+        return this.value;
+    }
+    plus(o) {
+        return new BInteger(this.value + o.value);
+    }
+    toString() {
+        return this.value.toString();
+    }
+    minus(o) {
+        return new BInteger(this.value - o.value);
+    }
+    multiply(o) {
+        return new BInteger(this.value * o.value);
+    }
+    power(o) {
+        return new BInteger(this.value ^ o.value);
+    }
+    divide(o) {
+        return new BInteger(~~(this.value / o.value));
+    }
+    modulo(o) {
+        return new BInteger(this.value % o.value);
+    }
+    succ() {
+        return new BInteger(this.value + 1);
+    }
+    pred() {
+        return new BInteger(this.value - 1);
+    }
+    leftShift() {
+        return new BInteger(this.value << 1);
+    }
+    rightShift() {
+        return new BInteger(this.value >> 1);
+    }
+    isCase(o) {
+        return this.equals(o);
+    }
+    negative() {
+        return new BInteger(-this.value);
+    }
+    positive() {
+        return this;
+    }
+    getValue() {
+        return this.value;
+    }
+    isInteger() {
+        return new BBoolean(true);
+    }
+    isNotInteger() {
+        return new BBoolean(false);
+    }
+    isNatural() {
+        return this.greaterEqual(new BInteger(0));
+    }
+    isNotNatural() {
+        return this.isNatural().not();
+    }
+    isNatural1() {
+        return this.greater(new BInteger(0));
+    }
+    isNotNatural1() {
+        return this.isNatural1().not();
+    }
+    hashCode() {
+        const prime = 31;
+        let result = 1;
+        result = prime * result + this.value;
+        return result;
+    }
+}
diff --git a/B2Program/LandingGear/GearsDoors/btypes/BObject.js b/B2Program/LandingGear/GearsDoors/btypes/BObject.js
new file mode 100755
index 0000000000000000000000000000000000000000..51b475ea3aeca5d23cebf2760f968f115e965477
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/btypes/BObject.js
@@ -0,0 +1,8 @@
+export class BObject {
+    equals(other) {
+        return false;
+    }
+    hashCode() {
+        return 0;
+    }
+}
diff --git a/B2Program/LandingGear/GearsDoors/btypes/BRelation.js b/B2Program/LandingGear/GearsDoors/btypes/BRelation.js
new file mode 100755
index 0000000000000000000000000000000000000000..361218789a087230718b877c9cb7ef474771c1bb
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/btypes/BRelation.js
@@ -0,0 +1,791 @@
+import { BTuple } from "./BTuple.js";
+import { BSet } from "./BSet.js";
+import { BInteger } from "./BInteger.js";
+import { BBoolean } from "./BBoolean.js";
+import { BString } from "./BString.js";
+import { BStruct } from "./BStruct.js";
+import * as immutable from "../immutable/dist/immutable.es.js";
+export class BRelation {
+    constructor(...args) {
+        if (args.length === 0) {
+            this.map = immutable.Map();
+        }
+        else if (args.length == 1 && args[0] instanceof immutable.Map) {
+            this.map = args[0];
+        }
+        else {
+            this.map = immutable.Map();
+            for (let e of args) {
+                let key = e.projection1();
+                let value = e.projection2();
+                let set = this.map.get(key);
+                if (set == null) {
+                    set = immutable.Set();
+                }
+                set = set.add(value);
+                this.map = this.map.set(key, set);
+            }
+        }
+    }
+    static fromSet(set) {
+        let resultMap = immutable.Map();
+        set.getSet().forEach((e) => {
+            let key = e.projection1();
+            let value = e.projection2();
+            let range = resultMap.get(key);
+            if (range == null) {
+                range = immutable.Set([value]);
+                resultMap = resultMap.set(key, range);
+            }
+            else {
+                range = range.add(value);
+                resultMap = resultMap.set(key, range);
+            }
+        });
+        return new BRelation(resultMap);
+    }
+    equals(o) {
+        if (o == null || !(o instanceof BRelation))
+            return false;
+        return this.map.equals(o.map);
+    }
+    intersect(relation) {
+        let otherMap = relation.map;
+        let otherDomain = immutable.Set(otherMap.keys());
+        let thisDomain = immutable.Set(this.map.keys());
+        let intersectionDomain = thisDomain.intersect(otherDomain);
+        let differenceDomain = thisDomain.subtract(otherDomain);
+        let resultMap = this.map;
+        intersectionDomain.forEach((domainElement) => {
+            let thisRangeSet = this.map.get(domainElement);
+            let otherRangeSet = otherMap.get(domainElement);
+            resultMap = resultMap.set(domainElement, thisRangeSet.intersect(otherRangeSet));
+        });
+        differenceDomain.forEach((domainElement) => {
+            resultMap = resultMap.set(domainElement, immutable.Set());
+        });
+        return new BRelation(resultMap);
+    }
+    difference(relation) {
+        let otherMap = relation.map;
+        let otherDomain = otherMap.keys();
+        let thisDomain = immutable.Set(this.map.keys());
+        let differenceDomain = thisDomain.subtract(otherDomain);
+        let restDomain = thisDomain.subtract(differenceDomain);
+        let resultMap = this.map;
+        differenceDomain.forEach((domainElement) => {
+            let thisRangeSet = this.map.get(domainElement);
+            let otherRangeSet = otherMap.get(domainElement);
+            resultMap = resultMap.set(domainElement, thisRangeSet.subtract(otherRangeSet));
+        });
+        restDomain.forEach((domainElement) => {
+            resultMap = resultMap.set(domainElement, immutable.Set());
+        });
+        return new BRelation(resultMap);
+    }
+    union(relation) {
+        let otherMap = relation.map;
+        let otherDomain = immutable.Set(otherMap.keys());
+        let resultMap = this.map;
+        for (let domainElement of otherDomain) {
+            let thisRangeSet = this.map.get(domainElement);
+            let otherRangeSet = otherMap.get(domainElement);
+            resultMap = resultMap.set(domainElement, thisRangeSet == null ? otherRangeSet : otherRangeSet == null ? otherRangeSet : thisRangeSet.union(otherRangeSet));
+        }
+        return new BRelation(resultMap);
+    }
+    size() {
+        let size = 0;
+        let thisDomain = immutable.Set(this.map.keys());
+        for (let domainElement of thisDomain) {
+            let thisRangeSet = this.map.get(domainElement);
+            if (thisRangeSet == null) {
+                continue;
+            }
+            size += thisRangeSet.size;
+        }
+        return size;
+    }
+    card() {
+        return new BInteger(this.size());
+    }
+    equal(o) {
+        return new BBoolean(this.equals(o));
+    }
+    unequal(o) {
+        return new BBoolean(!this.equals(o));
+    }
+    elementOf(object) {
+        let prj1 = object.projection1();
+        let prj2 = object.projection2();
+        if (!this.map.has(prj1)) {
+            return new BBoolean(false);
+        }
+        let range = this.map.get(prj1);
+        return new BBoolean(range.has(prj2));
+    }
+    notElementOf(object) {
+        let prj1 = object.projection1();
+        let prj2 = object.projection2();
+        if (!this.map.has(prj1)) {
+            return new BBoolean(true);
+        }
+        let range = this.map.get(prj1);
+        return new BBoolean(!range.has(prj2));
+    }
+    relationImage(domain) {
+        let resultSet = immutable.Set();
+        for (let this_domain_elem of this.map.keys()) {
+            for (let other_domain_elem of domain.set) {
+                if (other_domain_elem.equals(this_domain_elem)) {
+                    let thisRangeSet = this.map.get(this_domain_elem);
+                    if (thisRangeSet != null) {
+                        resultSet = BSet.immutableSetUnion(resultSet, thisRangeSet);
+                    }
+                }
+            }
+        }
+        return new BSet(resultSet);
+    }
+    functionCall(arg) {
+        let range = this.map.get(arg);
+        if (range == null) {
+            throw new Error("Argument is not in the domain of this relation");
+        }
+        for (let element of range) {
+            return element;
+        }
+        throw new Error("Argument is not in the domain of this relation");
+    }
+    pow() {
+        let thisMap = this.map;
+        let thisDomain = immutable.Set(thisMap.keys());
+        let result = new BSet();
+        let start = new BRelation();
+        let queue = [];
+        queue.push(start);
+        result = result.union(new BSet(start));
+        while (queue.length !== 0) {
+            let currentSet = queue.pop();
+            for (let domainElement of thisDomain) {
+                let range = thisMap.get(domainElement);
+                range.forEach((rangeElement) => {
+                    let nextRelation = currentSet.union(BRelation.fromSet(new BSet(new BTuple(domainElement, rangeElement))));
+                    let previousSize = result.size().intValue();
+                    result = result.union(new BSet(nextRelation));
+                    if (previousSize < result.size().intValue()) {
+                        queue.push(nextRelation);
+                    }
+                });
+            }
+        }
+        return result;
+    }
+    pow1() {
+        return this.pow().difference(new BSet(new BRelation()));
+    }
+    fin() {
+        return this.pow();
+    }
+    fin1() {
+        return this.pow1();
+    }
+    domain() {
+        let resultSet = immutable.Set(this.map.keys());
+        for (let domainElement of this.map.keys()) {
+            let range = this.map.get(domainElement);
+            if (range.size === 0) {
+                resultSet = resultSet.remove(domainElement);
+            }
+        }
+        return new BSet(resultSet);
+    }
+    range() {
+        let set = immutable.Set.union(this.map.values());
+        return new BSet(set);
+    }
+    inverse() {
+        let thisMap = this.map;
+        let keys = immutable.Set(thisMap.keys());
+        let resultMap = immutable.Map();
+        for (let domainElement of keys) {
+            let range = this.map.get(domainElement);
+            range.forEach((rangeElement) => {
+                let currentRange = resultMap.get(rangeElement);
+                if (currentRange == null) {
+                    currentRange = immutable.Set();
+                }
+                currentRange = currentRange.union(immutable.Set([domainElement]));
+                resultMap = resultMap.set(rangeElement, currentRange);
+            });
+        }
+        return new BRelation(resultMap);
+    }
+    domainRestriction(arg) {
+        let resultMap = this.map;
+        outer_loop: for (let obj of resultMap.keys()) {
+            for (let obj2 of arg.set) {
+                if (obj2.equals(obj)) {
+                    continue outer_loop;
+                }
+            }
+            resultMap = resultMap.delete(obj);
+        }
+        return new BRelation(resultMap);
+    }
+    domainSubstraction(arg) {
+        let resultMap = this.map;
+        for (let obj of resultMap.keys()) {
+            for (let obj2 of arg.set) {
+                if (obj2.equals(obj)) {
+                    resultMap = resultMap.delete(obj);
+                    break;
+                }
+            }
+        }
+        return new BRelation(resultMap);
+    }
+    rangeRestriction(arg) {
+        let otherSet = arg.getSet();
+        let thisDomain = immutable.Set(this.map.keys());
+        let resultMap = this.map;
+        for (let domainElement of thisDomain) {
+            let thisRangeSet = this.map.get(domainElement);
+            resultMap = resultMap.set(domainElement, BSet.immutableSetIntersection(thisRangeSet, otherSet));
+        }
+        return new BRelation(resultMap);
+    }
+    rangeSubstraction(arg) {
+        let otherSet = arg.getSet();
+        let thisDomain = immutable.Set(this.map.keys());
+        let resultMap = this.map;
+        for (let domainElement of thisDomain) {
+            let thisRangeSet = this.map.get(domainElement);
+            resultMap = resultMap.set(domainElement, BSet.immutableSetDifference(thisRangeSet, otherSet));
+        }
+        return new BRelation(resultMap);
+    }
+    override(arg) {
+        let otherMap = arg.map;
+        let otherDomain = immutable.Set(otherMap.keys());
+        let resultMap = this.map;
+        outer_loop: for (let domainElement of otherDomain) {
+            for (let thisDomainElement of resultMap.keys()) {
+                if (thisDomainElement.equals(domainElement)) {
+                    let range = otherMap.get(domainElement);
+                    resultMap = resultMap.set(thisDomainElement, range);
+                    continue outer_loop;
+                }
+            }
+            resultMap = resultMap.set(domainElement, otherMap.get(domainElement));
+        }
+        return new BRelation(resultMap);
+    }
+    first() {
+        return this.functionCall(new BInteger(1));
+    }
+    last() {
+        return this.functionCall(this.card());
+    }
+    reverse() {
+        let size = this.card();
+        let resultMap = immutable.Map();
+        for (let i = new BInteger(1); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            let rangeElement = this.functionCall(size.minus(i).succ());
+            resultMap = resultMap.set(i, immutable.Set([rangeElement]));
+        }
+        return new BRelation(resultMap);
+    }
+    front() {
+        return this.domainSubstraction(new BSet(this.card()));
+    }
+    tail() {
+        let size = this.card();
+        let resultMap = immutable.Map();
+        for (let i = new BInteger(2); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            let rangeElement = this.functionCall(i);
+            resultMap = resultMap.set(i.pred(), immutable.Set([rangeElement]));
+        }
+        return new BRelation(resultMap);
+    }
+    take(n) {
+        let size = this.card();
+        if (n.greaterEqual(size).booleanValue()) {
+            return new BRelation(this.map);
+        }
+        let resultMap = this.map;
+        //Remove sets with index greater than n
+        for (let i = n.succ(); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            for (let index of resultMap.keys()) {
+                if (index.equals(i)) {
+                    resultMap = resultMap.delete(index);
+                    break;
+                }
+            }
+        }
+        return new BRelation(resultMap);
+    }
+    drop(n) {
+        let size = this.card();
+        let thisMap = this.map;
+        let resultMap = immutable.Map();
+        for (let i = n.succ(); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            let currentSet = thisMap.get(i);
+            resultMap = resultMap.set(i.minus(n), currentSet);
+        }
+        return new BRelation(resultMap);
+    }
+    concat(arg) {
+        let resultMap = this.map;
+        let otherMap = arg.map;
+        let size = this.card();
+        for (let i = new BInteger(1); i.lessEqual(arg.card()).booleanValue(); i = i.succ()) {
+            resultMap = resultMap.set(size.plus(i), otherMap.get(i));
+        }
+        return new BRelation(resultMap);
+    }
+    conc() {
+        let result = new BRelation();
+        let size = this.card();
+        for (let i = new BInteger(1); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            result = result.concat(this.functionCall(i));
+        }
+        return result;
+    }
+    append(arg) {
+        let resultMap = this.map;
+        resultMap = resultMap.set(this.card().succ(), immutable.Set([arg]));
+        return new BRelation(resultMap);
+    }
+    prepend(arg) {
+        let resultMap = immutable.Map();
+        let thisMap = this.map;
+        let size = this.card();
+        for (let i = new BInteger(1); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            resultMap = resultMap.set(i.succ(), thisMap.get(i));
+        }
+        resultMap = resultMap.set(new BInteger(1), immutable.Set([arg]));
+        return new BRelation(resultMap);
+    }
+    directProduct(arg) {
+        let thisMap = this.map;
+        let thisDomain = immutable.Set(thisMap.keys());
+        let otherMap = arg.map;
+        let resultMap = immutable.Map();
+        for (let domainElement of thisDomain) {
+            let thisRange = this.map.get(domainElement);
+            let otherRange = otherMap.get(domainElement);
+            if (otherRange == undefined) {
+                continue;
+            }
+            let resultRange = immutable.Set();
+            thisRange.forEach((lhs) => {
+                otherRange.forEach((rhs) => {
+                    resultRange = immutable.Set.union([resultRange, immutable.Set([new BTuple(lhs, rhs)])]);
+                });
+            });
+            resultMap = resultMap.set(domainElement, resultRange);
+        }
+        return new BRelation(resultMap);
+    }
+    parallelProduct(arg) {
+        let thisMap = this.map;
+        let thisDomain = immutable.Set(thisMap.keys());
+        let otherMap = arg.map;
+        let otherDomain = immutable.Set(otherMap.keys());
+        let resultMap = immutable.Map();
+        for (let domainElementThis of thisDomain) {
+            for (let domainElementOther of otherDomain) {
+                let thisRange = thisMap.get(domainElementThis);
+                let otherRange = otherMap.get(domainElementOther);
+                let resultRange = immutable.Set();
+                thisRange.forEach((lhs) => {
+                    otherRange.forEach((rhs) => {
+                        resultRange = resultRange.union(immutable.Set([new BTuple(lhs, rhs)]));
+                    });
+                });
+                let tuple = new BTuple(domainElementThis, domainElementOther);
+                resultMap = resultMap.set(tuple, resultRange);
+            }
+        }
+        return new BRelation(resultMap);
+    }
+    composition(arg) {
+        let otherMap = arg.map;
+        let resultMap = immutable.Map();
+        for (let domainElement of this.map.keys()) {
+            let range = this.map.get(domainElement);
+            let set = immutable.Set();
+            range.forEach((rangeElement) => {
+                let union_element = otherMap.get(rangeElement);
+                if (union_element == null) {
+                    return;
+                }
+                set = set.union(union_element);
+            });
+            resultMap = resultMap.set(domainElement, set);
+        }
+        return new BRelation(resultMap);
+    }
+    iterate(n) {
+        let thisRelation = this;
+        let result = BRelation.identity(this.domain().union(this.range()));
+        for (let i = new BInteger(1); i.lessEqual(n).booleanValue(); i = i.succ()) {
+            result = result.composition(thisRelation);
+        }
+        return result;
+    }
+    closure() {
+        let thisRelation = this;
+        let result = BRelation.identity(this.domain().union(this.range()));
+        let nextResult = result.composition(thisRelation);
+        let lastResult = result;
+        do {
+            lastResult = result;
+            result = result.union(nextResult);
+            nextResult = result.composition(thisRelation);
+        } while (!result.equal(lastResult).booleanValue());
+        return result;
+    }
+    closure1() {
+        let thisRelation = this;
+        let result = this;
+        let nextResult = result.composition(thisRelation);
+        let lastResult = null;
+        do {
+            lastResult = result;
+            result = result.union(nextResult);
+            nextResult = result.composition(thisRelation);
+        } while (!result.equal(lastResult).booleanValue());
+        return result;
+    }
+    static projection1(arg1, arg2) {
+        let argSet1 = arg1.getSet();
+        let argSet2 = arg2.getSet();
+        let resultMap = immutable.Map();
+        argSet1.forEach((e1) => {
+            argSet2.forEach((e2) => {
+                let tuple = new BTuple(e1, e2);
+                resultMap = resultMap.set(tuple, immutable.Set([e1]));
+            });
+        });
+        return new BRelation(resultMap);
+    }
+    static projection2(arg1, arg2) {
+        let argSet1 = arg1.getSet();
+        let argSet2 = arg2.getSet();
+        let resultMap = immutable.Map();
+        argSet1.forEach((e1) => {
+            argSet2.forEach((e2) => {
+                let tuple = new BTuple(e1, e2);
+                resultMap = resultMap.set(tuple, immutable.Set([e2]));
+            });
+        });
+        return new BRelation(resultMap);
+    }
+    fnc() {
+        let thisMap = this.map;
+        let domain = this.domain().getSet();
+        let resultMap = immutable.Map();
+        domain.forEach((domainElement) => {
+            let range = thisMap.get(domainElement);
+            let rangeSet = new BSet([range]);
+            resultMap = resultMap.set(domainElement, immutable.Set([rangeSet]));
+        });
+        return new BRelation(resultMap);
+    }
+    rel() {
+        let domain = this.domain().getSet();
+        let resultMap = immutable.Map();
+        domain.forEach((domainElement) => {
+            let range = this.functionCall(domainElement);
+            let rangeSet = range.getSet();
+            resultMap = resultMap.set(domainElement, rangeSet);
+        });
+        return new BRelation(resultMap);
+    }
+    static identity(arg) {
+        let resultMap = immutable.Map();
+        arg.getSet().forEach((e) => {
+            resultMap = resultMap.set(e, immutable.Set([e]));
+        });
+        return new BRelation(resultMap);
+    }
+    static cartesianProduct(arg1, arg2) {
+        let resultMap = immutable.Map();
+        arg1.getSet().forEach((e1) => {
+            resultMap = resultMap.set(e1, arg2.getSet());
+        });
+        return new BRelation(resultMap);
+    }
+    nondeterminism() {
+        let domain = immutable.Set(this.map.keys());
+        let index = Math.floor(Math.random() * domain.size);
+        let i = 0;
+        let domainElement = undefined;
+        for (let obj of domain) {
+            if (i == index) {
+                domainElement = obj;
+                break;
+            }
+            i++;
+        }
+        if (domainElement == undefined) {
+            return null;
+        }
+        let range = this.map.get(domainElement);
+        if (range != null) {
+            index = Math.floor(Math.random() * range.size);
+            i = 0;
+            for (let obj of range) {
+                if (i == index) {
+                    return new BTuple(domainElement, obj);
+                }
+                i++;
+            }
+        }
+        return null;
+    }
+    isTotal(domain) {
+        return new BBoolean(this.domain().equal(domain));
+    }
+    isTotalInteger() {
+        return new BBoolean(false);
+    }
+    isTotalNatural() {
+        return new BBoolean(false);
+    }
+    isTotalNatural1() {
+        return new BBoolean(false);
+    }
+    isTotalString() {
+        return new BBoolean(false);
+    }
+    isTotalStruct() {
+        return new BBoolean(false);
+    }
+    isPartial(domain) {
+        return this.domain().strictSubset(domain);
+    }
+    isPartialInteger() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger) {
+                return new BBoolean(true);
+            }
+            else {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isPartialNatural() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isPartialNatural1() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural1().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isPartialString() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BString && !e.isString().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isPartialStruct() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BStruct && !e.isRecord().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomain(domain) {
+        return this.domain().subset(domain);
+    }
+    checkDomainInteger() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger) {
+                return new BBoolean(true);
+            }
+            else {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomainNatural() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomainNatural1() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural1().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomainString() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BString && !e.isString().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomainStruct() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BStruct && !e.isRecord().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRange(range) {
+        return this.range().subset(range);
+    }
+    checkRangeInteger() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BInteger) {
+                return new BBoolean(true);
+            }
+            else {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRangeNatural() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRangeNatural1() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural1().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRangeString() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BString && !e.isString().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRangeStruct() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BStruct && !e.isRecord().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isRelation() {
+        return new BBoolean(true);
+    }
+    isFunction() {
+        this.domain().getSet().forEach((element) => {
+            let range = this.map.get(element);
+            if (range.size > 1) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isSurjection(range) {
+        return new BBoolean(this.range().equal(range));
+    }
+    isSurjectionInteger() {
+        return new BBoolean(false);
+    }
+    isSurjectionNatural() {
+        return new BBoolean(false);
+    }
+    isSurjectionNatural1() {
+        return new BBoolean(false);
+    }
+    isSurjectionString() {
+        return new BBoolean(false);
+    }
+    isSurjectionStruct() {
+        return new BBoolean(false);
+    }
+    isInjection() {
+        let visited = immutable.Set();
+        this.domain().getSet().forEach((element) => {
+            let range = this.map.get(element);
+            range.forEach((rangeElement) => {
+                if (visited.contains(rangeElement)) {
+                    return new BBoolean(false);
+                }
+                visited = visited.union(immutable.Set([rangeElement]));
+            });
+        });
+        return new BBoolean(true);
+    }
+    isBijection(range) {
+        return this.isSurjection(range).and(this.isInjection());
+    }
+    isBijectionInteger() {
+        return new BBoolean(false);
+    }
+    isBijectionNatural() {
+        return new BBoolean(false);
+    }
+    isBijectionNatural1() {
+        return new BBoolean(false);
+    }
+    isBijectionString() {
+        return new BBoolean(false);
+    }
+    isBijectionStruct() {
+        return new BBoolean(false);
+    }
+    toString() {
+        let size = this.size();
+        let i = 0;
+        let sb = "";
+        sb = sb + "{";
+        for (let domainElement of this.map.keys()) {
+            let range = this.map.get(domainElement);
+            range.forEach((rangeElement) => {
+                sb += "(";
+                sb += domainElement.toString();
+                sb += " |-> ";
+                sb += rangeElement.toString();
+                sb += ")";
+                if (i + 1 < size) {
+                    sb += ", ";
+                }
+                i++;
+            });
+        }
+        sb += "}";
+        return sb.toString();
+    }
+    hashCode() {
+        return this.map.hashCode();
+    }
+}
diff --git a/B2Program/LandingGear/GearsDoors/btypes/BSet.js b/B2Program/LandingGear/GearsDoors/btypes/BSet.js
new file mode 100755
index 0000000000000000000000000000000000000000..3cd16d85d4636b667b9741b6fbb3816b02d71da6
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/btypes/BSet.js
@@ -0,0 +1,359 @@
+import { BBoolean } from "./BBoolean.js";
+import { BInteger } from "./BInteger.js";
+import { BRelation } from "./BRelation.js";
+import { BString } from "./BString.js";
+import { BStruct } from "./BStruct.js";
+import * as immutable from "../immutable/dist/immutable.es.js";
+export class BSet {
+    constructor(...args) {
+        if (args.length == 1 && args[0] instanceof immutable.Set) {
+            this.set = args[0];
+        }
+        else {
+            this.set = immutable.Set();
+            for (let x of args) {
+                this.set = this.set.add(x);
+            }
+        }
+    }
+    /* Make this class iterable */
+    [Symbol.iterator]() {
+        return this.set[Symbol.iterator]();
+    }
+    toString() {
+        let sb = "{";
+        this.set.forEach(element => {
+            if (sb.length > 1) {
+                sb += ", ";
+            }
+            sb += element.toString();
+        });
+        sb += "}";
+        return sb;
+    }
+    union(other = null) {
+        if (other == null) {
+            if (this.set.size === 0) {
+                return new BSet();
+            }
+            else if (this.set.values().next().value instanceof BSet) {
+                let result = immutable.Set();
+                for (let current_set of this.set) {
+                    result = BSet.immutableSetUnion(result, current_set.set);
+                }
+                return new BSet(result);
+            }
+            else if (this.set.values().next().value instanceof BRelation) {
+                let result = immutable.Map();
+                for (let current_set of this.set) {
+                    result = BSet.immutableMapUnion(result, current_set.map);
+                }
+                return new BRelation(result);
+            }
+            else {
+                throw new Error("Generalized Union is only possible on immutable.Sets of immutable.Sets or Relations");
+            }
+        }
+        let result = BSet.immutableSetUnion(this.set, other.set);
+        return new BSet(result);
+    }
+    static immutableSetUnion(s1, s2) {
+        return s1.union(s2);
+    }
+    static immutableSetDifference(s1, s2) {
+        return s1.subtract(s2);
+    }
+    static immutableSetIntersection(s1, s2) {
+        return s1.intersect(s2);
+    }
+    static immutableMapUnion(m1, m2) {
+        let result = m2;
+        outer_loop: for (let current_element of m1.keys()) {
+            for (let result_element of result.keys()) {
+                if (current_element.equals(result_element)) {
+                    let result_set = result.get(result_element);
+                    let current_set = m1.get(current_element);
+                    result = result.set(result_element, BSet.immutableSetUnion(result_set != null ? result_set : immutable.Set(), current_set != null ? current_set : immutable.Set()));
+                    continue outer_loop;
+                }
+            }
+            result = result.set(current_element, m1.get(current_element));
+        }
+        return result;
+    }
+    static immutableMapIntersection(m1, m2) {
+        let result = immutable.Map();
+        elem_loop: for (let result_element of m2.keys()) {
+            for (let current_element of m1.keys()) {
+                if (current_element.equals(result_element)) {
+                    let result_set = m2.get(result_element);
+                    let current_set = m1.get(current_element);
+                    result = result.set(result_element, BSet.immutableSetIntersection(result_set != null ? result_set : immutable.Set(), current_set != null ? current_set : immutable.Set()));
+                    continue elem_loop;
+                }
+            }
+            result.delete(result_element);
+        }
+        return result;
+    }
+    intersect(other = null) {
+        if (other == null) {
+            if (this.set.size === 0) {
+                return new BSet();
+            }
+            else if (this.set.values().next().value instanceof BSet) {
+                let result = this.set.values().next().value.set;
+                for (let current_set of this.set) {
+                    result = BSet.immutableSetDifference(result, BSet.immutableSetDifference(result, current_set.set));
+                }
+                return new BSet(result);
+            }
+            else if (this.set.values().next().value instanceof BRelation) {
+                let result = this.set.values().next().value.map;
+                for (let current_set of this.set) {
+                    result = BSet.immutableMapIntersection(result, current_set.map);
+                }
+                return new BRelation(result);
+            }
+            else {
+                throw new Error("Generalized Intersection is only possible on immutable.Sets of immutable.Sets or Relations");
+            }
+        }
+        let new_set = BSet.immutableSetDifference(this.set, BSet.immutableSetDifference(this.set, other.set));
+        return new BSet(new_set);
+    }
+    difference(other) {
+        let set = BSet.immutableSetDifference(this.set, other.set);
+        return new BSet(set);
+    }
+    card() {
+        return new BInteger(this.set.size);
+    }
+    size() {
+        return new BInteger(this.set.size);
+    }
+    elementOf(obj) {
+        return new BBoolean(this.set.has(obj));
+    }
+    notElementOf(obj) {
+        return new BBoolean(!this.set.has(obj));
+    }
+    subset(other) {
+        this_set_loop: for (let elem of this.set) {
+            for (let other_elem of other.set) {
+                if (other_elem.equals(elem)) {
+                    continue this_set_loop;
+                }
+            }
+            return new BBoolean(false);
+        }
+        return new BBoolean(true);
+    }
+    notSubset(other) {
+        this_set_loop: for (let elem of this.set) {
+            for (let other_elem of other.set) {
+                if (other_elem.equals(elem)) {
+                    continue this_set_loop;
+                }
+            }
+            return new BBoolean(true);
+        }
+        return new BBoolean(false);
+    }
+    strictSubset(other) {
+        return this.size().less(other.size()).and(this.subset(other));
+    }
+    strictNotSubset(other) {
+        return this.size().equal(other.size()).and(this.notSubset(other));
+    }
+    contains(other) {
+        return other.toString() in this.set;
+    }
+    containsAll(other) {
+        for (let o of other.set) {
+            if (!(o in this.set)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    isEmpty() {
+        return this.set.size === 0;
+    }
+    equals(other) {
+        return this.equal(other).booleanValue();
+    }
+    equal(other) {
+        if (!(other instanceof BSet)) {
+            return new BBoolean(false);
+        }
+        return this.subset(other).and(other.subset(this));
+    }
+    unequal(other) {
+        return this.equal(other).not();
+    }
+    nondeterminism() {
+        let values = [];
+        for (let item of this.set) {
+            values.push(item);
+        }
+        return values[Math.floor(Math.random() * values.length)];
+    }
+    min() {
+        return this.set.reduce((a, v) => { if (a < v) {
+            return a;
+        } return v; });
+    }
+    max() {
+        return this.set.reduce((a, v) => { if (a > v) {
+            return a;
+        } return v; });
+    }
+    pow() {
+        let result = new BSet();
+        let start = new BSet();
+        let queue = [start];
+        result = result.union(new BSet(start));
+        while (queue.length != 0) {
+            let currentSet = queue.pop();
+            for (let element of this.set) {
+                let nextSet = currentSet.union(new BSet(element));
+                let previousSize = result.size();
+                result = result.union(new BSet(nextSet));
+                if (previousSize < result.size()) {
+                    queue.push(nextSet);
+                }
+            }
+        }
+        return result;
+    }
+    pow1() {
+        return this.pow().difference(new BSet(new BSet()));
+    }
+    // Only finite subsets are supported so fin = pow
+    fin() {
+        return this.pow();
+    }
+    fin1() {
+        return this.pow1();
+    }
+    subsetOfInteger() {
+        for (let element of this.set) {
+            if (element instanceof BInteger) {
+                return false;
+            }
+        }
+        return true;
+    }
+    strictSubsetOfInteger() {
+        return this.subsetOfInteger();
+    }
+    notSubsetOfInteger() {
+        return !this.subsetOfInteger();
+    }
+    notStrictSubsetOfInteger() {
+        return !this.strictSubsetOfInteger();
+    }
+    subsetOfNatural() {
+        for (let element of this.set) {
+            if (!(element instanceof BInteger && element.isNatural().booleanValue())) {
+                return false;
+            }
+        }
+        return true;
+    }
+    strictSubsetOfNatural() {
+        return this.subsetOfNatural();
+    }
+    notSubsetOfNatural() {
+        return !this.subsetOfNatural();
+    }
+    notStrictSubsetOfNatural() {
+        return !this.strictSubsetOfNatural();
+    }
+    subsetOfNatural1() {
+        for (let element of this.set) {
+            if (!(element instanceof BInteger && element.isNatural1().booleanValue())) {
+                return false;
+            }
+        }
+        return true;
+    }
+    subsetOfString() {
+        for (let element of this.set) {
+            if (!(element instanceof BString)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    strictSubsetOfString() {
+        return this.subsetOfString();
+    }
+    notSubsetOfString() {
+        return !this.subsetOfString();
+    }
+    notStrictSubsetOfString() {
+        return !this.strictSubsetOfString();
+    }
+    subsetOfStruct() {
+        for (let element of this.set) {
+            if (!(element instanceof BStruct)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    strictSubsetOfStruct() {
+        return this.subsetOfStruct();
+    }
+    notSubsetOfStruct() {
+        return !this.subsetOfStruct();
+    }
+    notStrictSubsetOfStruct() {
+        return !this.strictSubsetOfStruct();
+    }
+    equalInteger() {
+        return new BBoolean(false);
+    }
+    unequalInteger() {
+        return new BBoolean(true);
+    }
+    equalNatural() {
+        return new BBoolean(false);
+    }
+    unequalNatural() {
+        return new BBoolean(true);
+    }
+    equalNatural1() {
+        return new BBoolean(false);
+    }
+    unequalNatural1() {
+        return new BBoolean(true);
+    }
+    equalString() {
+        return new BBoolean(false);
+    }
+    unequalString() {
+        return new BBoolean(true);
+    }
+    equalStruct() {
+        return new BBoolean(false);
+    }
+    unequalStruct() {
+        return new BBoolean(true);
+    }
+    getSet() {
+        return this.set;
+    }
+    static interval(a, b) {
+        if (b.less(a).booleanValue()) {
+            return new BSet();
+        }
+        const range = [...Array(b.minus(a).intValue() + 1).keys()].map(e => new BInteger(e).plus(a));
+        return new BSet(immutable.Set(range));
+    }
+    hashCode() {
+        return this.set.hashCode();
+    }
+}
diff --git a/B2Program/LandingGear/GearsDoors/btypes/BString.js b/B2Program/LandingGear/GearsDoors/btypes/BString.js
new file mode 100755
index 0000000000000000000000000000000000000000..ff8e795b9a5997e3dad032029e78fb40dba7f7a1
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/btypes/BString.js
@@ -0,0 +1,46 @@
+import { BBoolean } from "./BBoolean.js";
+export class BString {
+    constructor(value) {
+        this.value = value;
+    }
+    getValue() {
+        return this.value;
+    }
+    equals(o) {
+        if (o == null || o instanceof BString) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    length() {
+        return this.value.length;
+    }
+    isEmpty() {
+        return this.value === "";
+    }
+    toString() {
+        return '"' + this.value + '"';
+    }
+    isCase(o) {
+        return this.value == o;
+    }
+    isString() {
+        return new BBoolean(true);
+    }
+    isNotString() {
+        return new BBoolean(false);
+    }
+    hashCode() {
+        let hash = 0;
+        if (this.value.length === 0) {
+            return hash;
+        }
+        for (let i = 0; i < this.value.length; i++) {
+            let chr = this.value.charCodeAt(i);
+            hash = ((hash << 5) - hash) + chr;
+            hash |= 0; // Convert to 32bit integer
+        }
+        return hash;
+    }
+    ;
+}
diff --git a/B2Program/LandingGear/GearsDoors/btypes/BStruct.js b/B2Program/LandingGear/GearsDoors/btypes/BStruct.js
new file mode 100755
index 0000000000000000000000000000000000000000..196b0fa0e643f72a865a96d09c27c76f5ed92fdd
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/btypes/BStruct.js
@@ -0,0 +1,9 @@
+import { BBoolean } from "./BBoolean.js";
+export class BStruct {
+    isRecord() {
+        return new BBoolean(true);
+    }
+    isNotRecord() {
+        return new BBoolean(false);
+    }
+}
diff --git a/B2Program/LandingGear/GearsDoors/btypes/BTuple.js b/B2Program/LandingGear/GearsDoors/btypes/BTuple.js
new file mode 100755
index 0000000000000000000000000000000000000000..49f6bba5979626f54da241bc2aee21b680b45674
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/btypes/BTuple.js
@@ -0,0 +1,34 @@
+import { BBoolean } from "./BBoolean.js";
+export class BTuple {
+    constructor(first, second) {
+        if (first == null || second == null) {
+            throw new RangeError("Arguments of Tuple cant be null or undefined");
+        }
+        this.first = first;
+        this.second = second;
+    }
+    equals(o) {
+        if (o == null || !(o instanceof BTuple)) {
+            return false;
+        }
+        return o.projection1().equals(this.first) && o.projection2().equals(this.second);
+    }
+    toString() {
+        return "(" + this.projection1() + " |-> " + this.projection2() + ')';
+    }
+    projection1() {
+        return this.first;
+    }
+    projection2() {
+        return this.second;
+    }
+    equal(o) {
+        return new BBoolean(this.equals(o));
+    }
+    unequal(o) {
+        return new BBoolean(!this.equals(o));
+    }
+    hashCode() {
+        return this.first.hashCode() ^ (this.second.hashCode() << 1);
+    }
+}
diff --git a/B2Program/LandingGear/GearsDoors/btypes/BUtils.js b/B2Program/LandingGear/GearsDoors/btypes/BUtils.js
new file mode 100755
index 0000000000000000000000000000000000000000..cc0de5b897c6bf57f395a844a2717aaf89ba68b1
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/btypes/BUtils.js
@@ -0,0 +1,11 @@
+import { BSet } from "./BSet.js";
+import { BBoolean } from "./BBoolean.js";
+export class BUtils {
+}
+BUtils.BOOL = new BSet(new BBoolean(true), new BBoolean(false));
+export class SelectError extends Error {
+    constructor(msg) {
+        super(msg);
+        Object.setPrototypeOf(this, SelectError.prototype);
+    }
+}
\ No newline at end of file
diff --git a/B2Program/LandingGear/GearsDoors/img/door_closed.png b/B2Program/LandingGear/GearsDoors/img/door_closed.png
new file mode 100644
index 0000000000000000000000000000000000000000..c91e5da5fe9b9de93c83dd843ca0f88cb4d65154
Binary files /dev/null and b/B2Program/LandingGear/GearsDoors/img/door_closed.png differ
diff --git a/B2Program/LandingGear/GearsDoors/img/door_door_moving.png b/B2Program/LandingGear/GearsDoors/img/door_door_moving.png
new file mode 100644
index 0000000000000000000000000000000000000000..75f11431cd36d2576fb60e68aecd1f9fa1cf8d9e
Binary files /dev/null and b/B2Program/LandingGear/GearsDoors/img/door_door_moving.png differ
diff --git a/B2Program/LandingGear/GearsDoors/img/door_open.png b/B2Program/LandingGear/GearsDoors/img/door_open.png
new file mode 100644
index 0000000000000000000000000000000000000000..69df2acbeda70c93537fa400ad20abb847e7d33f
Binary files /dev/null and b/B2Program/LandingGear/GearsDoors/img/door_open.png differ
diff --git a/B2Program/LandingGear/GearsDoors/img/gear_extended.png b/B2Program/LandingGear/GearsDoors/img/gear_extended.png
new file mode 100644
index 0000000000000000000000000000000000000000..1d01c660913d8c42b47775a6526c8fb3f27a6273
Binary files /dev/null and b/B2Program/LandingGear/GearsDoors/img/gear_extended.png differ
diff --git a/B2Program/LandingGear/GearsDoors/img/gear_gear_moving.png b/B2Program/LandingGear/GearsDoors/img/gear_gear_moving.png
new file mode 100644
index 0000000000000000000000000000000000000000..25a4d51b8157736640f6aa4929febc223e56afa5
Binary files /dev/null and b/B2Program/LandingGear/GearsDoors/img/gear_gear_moving.png differ
diff --git a/B2Program/LandingGear/GearsDoors/img/gear_retracted.png b/B2Program/LandingGear/GearsDoors/img/gear_retracted.png
new file mode 100644
index 0000000000000000000000000000000000000000..d65f88f5263f70797ec2696d5936694514fd4b42
Binary files /dev/null and b/B2Program/LandingGear/GearsDoors/img/gear_retracted.png differ
diff --git a/B2Program/LandingGear/GearsDoors/immutable/LICENSE b/B2Program/LandingGear/GearsDoors/immutable/LICENSE
new file mode 100755
index 0000000000000000000000000000000000000000..cde61b6c53dda799b707ddf13c067fada5140acf
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/immutable/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2014-present, Facebook, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/B2Program/LandingGear/GearsDoors/immutable/dist/immutable.es.js b/B2Program/LandingGear/GearsDoors/immutable/dist/immutable.es.js
new file mode 100755
index 0000000000000000000000000000000000000000..aecd6fe13a5026d8567ff123f8bdd6b79452e394
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/immutable/dist/immutable.es.js
@@ -0,0 +1,5818 @@
+/**
+ * Copyright (c) 2014-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+// Used for setting prototype methods that IE8 chokes on.
+var DELETE = 'delete';
+
+// Constants describing the size of trie nodes.
+var SHIFT = 5; // Resulted in best performance after ______?
+var SIZE = 1 << SHIFT;
+var MASK = SIZE - 1;
+
+// A consistent shared value representing "not set" which equals nothing other
+// than itself, and nothing that could be provided externally.
+var NOT_SET = {};
+
+// Boolean references, Rough equivalent of `bool &`.
+function MakeRef() {
+  return { value: false };
+}
+
+function SetRef(ref) {
+  if (ref) {
+    ref.value = true;
+  }
+}
+
+// A function which returns a value representing an "owner" for transient writes
+// to tries. The return value will only ever equal itself, and will not equal
+// the return of any subsequent call of this function.
+function OwnerID() {}
+
+function ensureSize(iter) {
+  if (iter.size === undefined) {
+    iter.size = iter.__iterate(returnTrue);
+  }
+  return iter.size;
+}
+
+function wrapIndex(iter, index) {
+  // This implements "is array index" which the ECMAString spec defines as:
+  //
+  //     A String property name P is an array index if and only if
+  //     ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal
+  //     to 2^32−1.
+  //
+  // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects
+  if (typeof index !== 'number') {
+    var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32
+    if ('' + uint32Index !== index || uint32Index === 4294967295) {
+      return NaN;
+    }
+    index = uint32Index;
+  }
+  return index < 0 ? ensureSize(iter) + index : index;
+}
+
+function returnTrue() {
+  return true;
+}
+
+function wholeSlice(begin, end, size) {
+  return (
+    ((begin === 0 && !isNeg(begin)) ||
+      (size !== undefined && begin <= -size)) &&
+    (end === undefined || (size !== undefined && end >= size))
+  );
+}
+
+function resolveBegin(begin, size) {
+  return resolveIndex(begin, size, 0);
+}
+
+function resolveEnd(end, size) {
+  return resolveIndex(end, size, size);
+}
+
+function resolveIndex(index, size, defaultIndex) {
+  // Sanitize indices using this shorthand for ToInt32(argument)
+  // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32
+  return index === undefined
+    ? defaultIndex
+    : isNeg(index)
+      ? size === Infinity
+        ? size
+        : Math.max(0, size + index) | 0
+      : size === undefined || size === index
+        ? index
+        : Math.min(size, index) | 0;
+}
+
+function isNeg(value) {
+  // Account for -0 which is negative, but not less than 0.
+  return value < 0 || (value === 0 && 1 / value === -Infinity);
+}
+
+// Note: value is unchanged to not break immutable-devtools.
+var IS_COLLECTION_SYMBOL = '@@__IMMUTABLE_ITERABLE__@@';
+
+function isCollection(maybeCollection) {
+  return Boolean(maybeCollection && maybeCollection[IS_COLLECTION_SYMBOL]);
+}
+
+var IS_KEYED_SYMBOL = '@@__IMMUTABLE_KEYED__@@';
+
+function isKeyed(maybeKeyed) {
+  return Boolean(maybeKeyed && maybeKeyed[IS_KEYED_SYMBOL]);
+}
+
+var IS_INDEXED_SYMBOL = '@@__IMMUTABLE_INDEXED__@@';
+
+function isIndexed(maybeIndexed) {
+  return Boolean(maybeIndexed && maybeIndexed[IS_INDEXED_SYMBOL]);
+}
+
+function isAssociative(maybeAssociative) {
+  return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);
+}
+
+var Collection = function Collection(value) {
+  return isCollection(value) ? value : Seq(value);
+};
+
+var KeyedCollection = /*@__PURE__*/(function (Collection) {
+  function KeyedCollection(value) {
+    return isKeyed(value) ? value : KeyedSeq(value);
+  }
+
+  if ( Collection ) KeyedCollection.__proto__ = Collection;
+  KeyedCollection.prototype = Object.create( Collection && Collection.prototype );
+  KeyedCollection.prototype.constructor = KeyedCollection;
+
+  return KeyedCollection;
+}(Collection));
+
+var IndexedCollection = /*@__PURE__*/(function (Collection) {
+  function IndexedCollection(value) {
+    return isIndexed(value) ? value : IndexedSeq(value);
+  }
+
+  if ( Collection ) IndexedCollection.__proto__ = Collection;
+  IndexedCollection.prototype = Object.create( Collection && Collection.prototype );
+  IndexedCollection.prototype.constructor = IndexedCollection;
+
+  return IndexedCollection;
+}(Collection));
+
+var SetCollection = /*@__PURE__*/(function (Collection) {
+  function SetCollection(value) {
+    return isCollection(value) && !isAssociative(value) ? value : SetSeq(value);
+  }
+
+  if ( Collection ) SetCollection.__proto__ = Collection;
+  SetCollection.prototype = Object.create( Collection && Collection.prototype );
+  SetCollection.prototype.constructor = SetCollection;
+
+  return SetCollection;
+}(Collection));
+
+Collection.Keyed = KeyedCollection;
+Collection.Indexed = IndexedCollection;
+Collection.Set = SetCollection;
+
+var IS_SEQ_SYMBOL = '@@__IMMUTABLE_SEQ__@@';
+
+function isSeq(maybeSeq) {
+  return Boolean(maybeSeq && maybeSeq[IS_SEQ_SYMBOL]);
+}
+
+var IS_RECORD_SYMBOL = '@@__IMMUTABLE_RECORD__@@';
+
+function isRecord(maybeRecord) {
+  return Boolean(maybeRecord && maybeRecord[IS_RECORD_SYMBOL]);
+}
+
+function isImmutable(maybeImmutable) {
+  return isCollection(maybeImmutable) || isRecord(maybeImmutable);
+}
+
+var IS_ORDERED_SYMBOL = '@@__IMMUTABLE_ORDERED__@@';
+
+function isOrdered(maybeOrdered) {
+  return Boolean(maybeOrdered && maybeOrdered[IS_ORDERED_SYMBOL]);
+}
+
+var ITERATE_KEYS = 0;
+var ITERATE_VALUES = 1;
+var ITERATE_ENTRIES = 2;
+
+var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
+var FAUX_ITERATOR_SYMBOL = '@@iterator';
+
+var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL;
+
+var Iterator = function Iterator(next) {
+  this.next = next;
+};
+
+Iterator.prototype.toString = function toString () {
+  return '[Iterator]';
+};
+
+Iterator.KEYS = ITERATE_KEYS;
+Iterator.VALUES = ITERATE_VALUES;
+Iterator.ENTRIES = ITERATE_ENTRIES;
+
+Iterator.prototype.inspect = Iterator.prototype.toSource = function() {
+  return this.toString();
+};
+Iterator.prototype[ITERATOR_SYMBOL] = function() {
+  return this;
+};
+
+function iteratorValue(type, k, v, iteratorResult) {
+  var value = type === 0 ? k : type === 1 ? v : [k, v];
+  iteratorResult
+    ? (iteratorResult.value = value)
+    : (iteratorResult = {
+        value: value,
+        done: false,
+      });
+  return iteratorResult;
+}
+
+function iteratorDone() {
+  return { value: undefined, done: true };
+}
+
+function hasIterator(maybeIterable) {
+  return !!getIteratorFn(maybeIterable);
+}
+
+function isIterator(maybeIterator) {
+  return maybeIterator && typeof maybeIterator.next === 'function';
+}
+
+function getIterator(iterable) {
+  var iteratorFn = getIteratorFn(iterable);
+  return iteratorFn && iteratorFn.call(iterable);
+}
+
+function getIteratorFn(iterable) {
+  var iteratorFn =
+    iterable &&
+    ((REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) ||
+      iterable[FAUX_ITERATOR_SYMBOL]);
+  if (typeof iteratorFn === 'function') {
+    return iteratorFn;
+  }
+}
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+function isArrayLike(value) {
+  if (Array.isArray(value) || typeof value === 'string') {
+    return true;
+  }
+
+  return (
+    value &&
+    typeof value === 'object' &&
+    Number.isInteger(value.length) &&
+    value.length >= 0 &&
+    (value.length === 0
+      ? // Only {length: 0} is considered Array-like.
+        Object.keys(value).length === 1
+      : // An object is only Array-like if it has a property where the last value
+        // in the array-like may be found (which could be undefined).
+        value.hasOwnProperty(value.length - 1))
+  );
+}
+
+var Seq = /*@__PURE__*/(function (Collection$$1) {
+  function Seq(value) {
+    return value === null || value === undefined
+      ? emptySequence()
+      : isImmutable(value)
+        ? value.toSeq()
+        : seqFromValue(value);
+  }
+
+  if ( Collection$$1 ) Seq.__proto__ = Collection$$1;
+  Seq.prototype = Object.create( Collection$$1 && Collection$$1.prototype );
+  Seq.prototype.constructor = Seq;
+
+  Seq.prototype.toSeq = function toSeq () {
+    return this;
+  };
+
+  Seq.prototype.toString = function toString () {
+    return this.__toString('Seq {', '}');
+  };
+
+  Seq.prototype.cacheResult = function cacheResult () {
+    if (!this._cache && this.__iterateUncached) {
+      this._cache = this.entrySeq().toArray();
+      this.size = this._cache.length;
+    }
+    return this;
+  };
+
+  // abstract __iterateUncached(fn, reverse)
+
+  Seq.prototype.__iterate = function __iterate (fn, reverse) {
+    var cache = this._cache;
+    if (cache) {
+      var size = cache.length;
+      var i = 0;
+      while (i !== size) {
+        var entry = cache[reverse ? size - ++i : i++];
+        if (fn(entry[1], entry[0], this) === false) {
+          break;
+        }
+      }
+      return i;
+    }
+    return this.__iterateUncached(fn, reverse);
+  };
+
+  // abstract __iteratorUncached(type, reverse)
+
+  Seq.prototype.__iterator = function __iterator (type, reverse) {
+    var cache = this._cache;
+    if (cache) {
+      var size = cache.length;
+      var i = 0;
+      return new Iterator(function () {
+        if (i === size) {
+          return iteratorDone();
+        }
+        var entry = cache[reverse ? size - ++i : i++];
+        return iteratorValue(type, entry[0], entry[1]);
+      });
+    }
+    return this.__iteratorUncached(type, reverse);
+  };
+
+  return Seq;
+}(Collection));
+
+var KeyedSeq = /*@__PURE__*/(function (Seq) {
+  function KeyedSeq(value) {
+    return value === null || value === undefined
+      ? emptySequence().toKeyedSeq()
+      : isCollection(value)
+        ? isKeyed(value)
+          ? value.toSeq()
+          : value.fromEntrySeq()
+        : isRecord(value)
+          ? value.toSeq()
+          : keyedSeqFromValue(value);
+  }
+
+  if ( Seq ) KeyedSeq.__proto__ = Seq;
+  KeyedSeq.prototype = Object.create( Seq && Seq.prototype );
+  KeyedSeq.prototype.constructor = KeyedSeq;
+
+  KeyedSeq.prototype.toKeyedSeq = function toKeyedSeq () {
+    return this;
+  };
+
+  return KeyedSeq;
+}(Seq));
+
+var IndexedSeq = /*@__PURE__*/(function (Seq) {
+  function IndexedSeq(value) {
+    return value === null || value === undefined
+      ? emptySequence()
+      : isCollection(value)
+        ? isKeyed(value)
+          ? value.entrySeq()
+          : value.toIndexedSeq()
+        : isRecord(value)
+          ? value.toSeq().entrySeq()
+          : indexedSeqFromValue(value);
+  }
+
+  if ( Seq ) IndexedSeq.__proto__ = Seq;
+  IndexedSeq.prototype = Object.create( Seq && Seq.prototype );
+  IndexedSeq.prototype.constructor = IndexedSeq;
+
+  IndexedSeq.of = function of (/*...values*/) {
+    return IndexedSeq(arguments);
+  };
+
+  IndexedSeq.prototype.toIndexedSeq = function toIndexedSeq () {
+    return this;
+  };
+
+  IndexedSeq.prototype.toString = function toString () {
+    return this.__toString('Seq [', ']');
+  };
+
+  return IndexedSeq;
+}(Seq));
+
+var SetSeq = /*@__PURE__*/(function (Seq) {
+  function SetSeq(value) {
+    return (isCollection(value) && !isAssociative(value)
+      ? value
+      : IndexedSeq(value)
+    ).toSetSeq();
+  }
+
+  if ( Seq ) SetSeq.__proto__ = Seq;
+  SetSeq.prototype = Object.create( Seq && Seq.prototype );
+  SetSeq.prototype.constructor = SetSeq;
+
+  SetSeq.of = function of (/*...values*/) {
+    return SetSeq(arguments);
+  };
+
+  SetSeq.prototype.toSetSeq = function toSetSeq () {
+    return this;
+  };
+
+  return SetSeq;
+}(Seq));
+
+Seq.isSeq = isSeq;
+Seq.Keyed = KeyedSeq;
+Seq.Set = SetSeq;
+Seq.Indexed = IndexedSeq;
+
+Seq.prototype[IS_SEQ_SYMBOL] = true;
+
+// #pragma Root Sequences
+
+var ArraySeq = /*@__PURE__*/(function (IndexedSeq) {
+  function ArraySeq(array) {
+    this._array = array;
+    this.size = array.length;
+  }
+
+  if ( IndexedSeq ) ArraySeq.__proto__ = IndexedSeq;
+  ArraySeq.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
+  ArraySeq.prototype.constructor = ArraySeq;
+
+  ArraySeq.prototype.get = function get (index, notSetValue) {
+    return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue;
+  };
+
+  ArraySeq.prototype.__iterate = function __iterate (fn, reverse) {
+    var array = this._array;
+    var size = array.length;
+    var i = 0;
+    while (i !== size) {
+      var ii = reverse ? size - ++i : i++;
+      if (fn(array[ii], ii, this) === false) {
+        break;
+      }
+    }
+    return i;
+  };
+
+  ArraySeq.prototype.__iterator = function __iterator (type, reverse) {
+    var array = this._array;
+    var size = array.length;
+    var i = 0;
+    return new Iterator(function () {
+      if (i === size) {
+        return iteratorDone();
+      }
+      var ii = reverse ? size - ++i : i++;
+      return iteratorValue(type, ii, array[ii]);
+    });
+  };
+
+  return ArraySeq;
+}(IndexedSeq));
+
+var ObjectSeq = /*@__PURE__*/(function (KeyedSeq) {
+  function ObjectSeq(object) {
+    var keys = Object.keys(object);
+    this._object = object;
+    this._keys = keys;
+    this.size = keys.length;
+  }
+
+  if ( KeyedSeq ) ObjectSeq.__proto__ = KeyedSeq;
+  ObjectSeq.prototype = Object.create( KeyedSeq && KeyedSeq.prototype );
+  ObjectSeq.prototype.constructor = ObjectSeq;
+
+  ObjectSeq.prototype.get = function get (key, notSetValue) {
+    if (notSetValue !== undefined && !this.has(key)) {
+      return notSetValue;
+    }
+    return this._object[key];
+  };
+
+  ObjectSeq.prototype.has = function has (key) {
+    return hasOwnProperty.call(this._object, key);
+  };
+
+  ObjectSeq.prototype.__iterate = function __iterate (fn, reverse) {
+    var object = this._object;
+    var keys = this._keys;
+    var size = keys.length;
+    var i = 0;
+    while (i !== size) {
+      var key = keys[reverse ? size - ++i : i++];
+      if (fn(object[key], key, this) === false) {
+        break;
+      }
+    }
+    return i;
+  };
+
+  ObjectSeq.prototype.__iterator = function __iterator (type, reverse) {
+    var object = this._object;
+    var keys = this._keys;
+    var size = keys.length;
+    var i = 0;
+    return new Iterator(function () {
+      if (i === size) {
+        return iteratorDone();
+      }
+      var key = keys[reverse ? size - ++i : i++];
+      return iteratorValue(type, key, object[key]);
+    });
+  };
+
+  return ObjectSeq;
+}(KeyedSeq));
+ObjectSeq.prototype[IS_ORDERED_SYMBOL] = true;
+
+var CollectionSeq = /*@__PURE__*/(function (IndexedSeq) {
+  function CollectionSeq(collection) {
+    this._collection = collection;
+    this.size = collection.length || collection.size;
+  }
+
+  if ( IndexedSeq ) CollectionSeq.__proto__ = IndexedSeq;
+  CollectionSeq.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
+  CollectionSeq.prototype.constructor = CollectionSeq;
+
+  CollectionSeq.prototype.__iterateUncached = function __iterateUncached (fn, reverse) {
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var collection = this._collection;
+    var iterator = getIterator(collection);
+    var iterations = 0;
+    if (isIterator(iterator)) {
+      var step;
+      while (!(step = iterator.next()).done) {
+        if (fn(step.value, iterations++, this) === false) {
+          break;
+        }
+      }
+    }
+    return iterations;
+  };
+
+  CollectionSeq.prototype.__iteratorUncached = function __iteratorUncached (type, reverse) {
+    if (reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    var collection = this._collection;
+    var iterator = getIterator(collection);
+    if (!isIterator(iterator)) {
+      return new Iterator(iteratorDone);
+    }
+    var iterations = 0;
+    return new Iterator(function () {
+      var step = iterator.next();
+      return step.done ? step : iteratorValue(type, iterations++, step.value);
+    });
+  };
+
+  return CollectionSeq;
+}(IndexedSeq));
+
+// # pragma Helper functions
+
+var EMPTY_SEQ;
+
+function emptySequence() {
+  return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([]));
+}
+
+function keyedSeqFromValue(value) {
+  var seq = Array.isArray(value)
+    ? new ArraySeq(value)
+    : hasIterator(value)
+      ? new CollectionSeq(value)
+      : undefined;
+  if (seq) {
+    return seq.fromEntrySeq();
+  }
+  if (typeof value === 'object') {
+    return new ObjectSeq(value);
+  }
+  throw new TypeError(
+    'Expected Array or collection object of [k, v] entries, or keyed object: ' +
+      value
+  );
+}
+
+function indexedSeqFromValue(value) {
+  var seq = maybeIndexedSeqFromValue(value);
+  if (seq) {
+    return seq;
+  }
+  throw new TypeError(
+    'Expected Array or collection object of values: ' + value
+  );
+}
+
+function seqFromValue(value) {
+  var seq = maybeIndexedSeqFromValue(value);
+  if (seq) {
+    return seq;
+  }
+  if (typeof value === 'object') {
+    return new ObjectSeq(value);
+  }
+  throw new TypeError(
+    'Expected Array or collection object of values, or keyed object: ' + value
+  );
+}
+
+function maybeIndexedSeqFromValue(value) {
+  return isArrayLike(value)
+    ? new ArraySeq(value)
+    : hasIterator(value)
+      ? new CollectionSeq(value)
+      : undefined;
+}
+
+var IS_MAP_SYMBOL = '@@__IMMUTABLE_MAP__@@';
+
+function isMap(maybeMap) {
+  return Boolean(maybeMap && maybeMap[IS_MAP_SYMBOL]);
+}
+
+function isOrderedMap(maybeOrderedMap) {
+  return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);
+}
+
+function isValueObject(maybeValue) {
+  return Boolean(
+    maybeValue &&
+      typeof maybeValue.equals === 'function' &&
+      typeof maybeValue.hashCode === 'function'
+  );
+}
+
+/**
+ * An extension of the "same-value" algorithm as [described for use by ES6 Map
+ * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality)
+ *
+ * NaN is considered the same as NaN, however -0 and 0 are considered the same
+ * value, which is different from the algorithm described by
+ * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
+ *
+ * This is extended further to allow Objects to describe the values they
+ * represent, by way of `valueOf` or `equals` (and `hashCode`).
+ *
+ * Note: because of this extension, the key equality of Immutable.Map and the
+ * value equality of Immutable.Set will differ from ES6 Map and Set.
+ *
+ * ### Defining custom values
+ *
+ * The easiest way to describe the value an object represents is by implementing
+ * `valueOf`. For example, `Date` represents a value by returning a unix
+ * timestamp for `valueOf`:
+ *
+ *     var date1 = new Date(1234567890000); // Fri Feb 13 2009 ...
+ *     var date2 = new Date(1234567890000);
+ *     date1.valueOf(); // 1234567890000
+ *     assert( date1 !== date2 );
+ *     assert( Immutable.is( date1, date2 ) );
+ *
+ * Note: overriding `valueOf` may have other implications if you use this object
+ * where JavaScript expects a primitive, such as implicit string coercion.
+ *
+ * For more complex types, especially collections, implementing `valueOf` may
+ * not be performant. An alternative is to implement `equals` and `hashCode`.
+ *
+ * `equals` takes another object, presumably of similar type, and returns true
+ * if it is equal. Equality is symmetrical, so the same result should be
+ * returned if this and the argument are flipped.
+ *
+ *     assert( a.equals(b) === b.equals(a) );
+ *
+ * `hashCode` returns a 32bit integer number representing the object which will
+ * be used to determine how to store the value object in a Map or Set. You must
+ * provide both or neither methods, one must not exist without the other.
+ *
+ * Also, an important relationship between these methods must be upheld: if two
+ * values are equal, they *must* return the same hashCode. If the values are not
+ * equal, they might have the same hashCode; this is called a hash collision,
+ * and while undesirable for performance reasons, it is acceptable.
+ *
+ *     if (a.equals(b)) {
+ *       assert( a.hashCode() === b.hashCode() );
+ *     }
+ *
+ * All Immutable collections are Value Objects: they implement `equals()`
+ * and `hashCode()`.
+ */
+function is(valueA, valueB) {
+  if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {
+    return true;
+  }
+  if (!valueA || !valueB) {
+    return false;
+  }
+  if (
+    typeof valueA.valueOf === 'function' &&
+    typeof valueB.valueOf === 'function'
+  ) {
+    valueA = valueA.valueOf();
+    valueB = valueB.valueOf();
+    if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {
+      return true;
+    }
+    if (!valueA || !valueB) {
+      return false;
+    }
+  }
+  return !!(
+    isValueObject(valueA) &&
+    isValueObject(valueB) &&
+    valueA.equals(valueB)
+  );
+}
+
+var imul =
+  typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2
+    ? Math.imul
+    : function imul(a, b) {
+        a |= 0; // int
+        b |= 0; // int
+        var c = a & 0xffff;
+        var d = b & 0xffff;
+        // Shift by 0 fixes the sign on the high part.
+        return (c * d + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0)) | 0; // int
+      };
+
+// v8 has an optimization for storing 31-bit signed numbers.
+// Values which have either 00 or 11 as the high order bits qualify.
+// This function drops the highest order bit in a signed number, maintaining
+// the sign bit.
+function smi(i32) {
+  return ((i32 >>> 1) & 0x40000000) | (i32 & 0xbfffffff);
+}
+
+var defaultValueOf = Object.prototype.valueOf;
+
+function hash(o) {
+  switch (typeof o) {
+    case 'boolean':
+      // The hash values for built-in constants are a 1 value for each 5-byte
+      // shift region expect for the first, which encodes the value. This
+      // reduces the odds of a hash collision for these common values.
+      return o ? 0x42108421 : 0x42108420;
+    case 'number':
+      return hashNumber(o);
+    case 'string':
+      return o.length > STRING_HASH_CACHE_MIN_STRLEN
+        ? cachedHashString(o)
+        : hashString(o);
+    case 'object':
+    case 'function':
+      if (o === null) {
+        return 0x42108422;
+      }
+      if (typeof o.hashCode === 'function') {
+        // Drop any high bits from accidentally long hash codes.
+        return smi(o.hashCode(o));
+      }
+      if (o.valueOf !== defaultValueOf && typeof o.valueOf === 'function') {
+        o = o.valueOf(o);
+      }
+      return hashJSObj(o);
+    case 'undefined':
+      return 0x42108423;
+    default:
+      if (typeof o.toString === 'function') {
+        return hashString(o.toString());
+      }
+      throw new Error('Value type ' + typeof o + ' cannot be hashed.');
+  }
+}
+
+// Compress arbitrarily large numbers into smi hashes.
+function hashNumber(n) {
+  if (n !== n || n === Infinity) {
+    return 0;
+  }
+  var hash = n | 0;
+  if (hash !== n) {
+    hash ^= n * 0xffffffff;
+  }
+  while (n > 0xffffffff) {
+    n /= 0xffffffff;
+    hash ^= n;
+  }
+  return smi(hash);
+}
+
+function cachedHashString(string) {
+  var hashed = stringHashCache[string];
+  if (hashed === undefined) {
+    hashed = hashString(string);
+    if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) {
+      STRING_HASH_CACHE_SIZE = 0;
+      stringHashCache = {};
+    }
+    STRING_HASH_CACHE_SIZE++;
+    stringHashCache[string] = hashed;
+  }
+  return hashed;
+}
+
+// http://jsperf.com/hashing-strings
+function hashString(string) {
+  // This is the hash from JVM
+  // The hash code for a string is computed as
+  // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1],
+  // where s[i] is the ith character of the string and n is the length of
+  // the string. We "mod" the result to make it between 0 (inclusive) and 2^31
+  // (exclusive) by dropping high bits.
+  var hashed = 0;
+  for (var ii = 0; ii < string.length; ii++) {
+    hashed = (31 * hashed + string.charCodeAt(ii)) | 0;
+  }
+  return smi(hashed);
+}
+
+function hashJSObj(obj) {
+  var hashed;
+  if (usingWeakMap) {
+    hashed = weakMap.get(obj);
+    if (hashed !== undefined) {
+      return hashed;
+    }
+  }
+
+  hashed = obj[UID_HASH_KEY];
+  if (hashed !== undefined) {
+    return hashed;
+  }
+
+  if (!canDefineProperty) {
+    hashed = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY];
+    if (hashed !== undefined) {
+      return hashed;
+    }
+
+    hashed = getIENodeHash(obj);
+    if (hashed !== undefined) {
+      return hashed;
+    }
+  }
+
+  hashed = ++objHashUID;
+  if (objHashUID & 0x40000000) {
+    objHashUID = 0;
+  }
+
+  if (usingWeakMap) {
+    weakMap.set(obj, hashed);
+  } else if (isExtensible !== undefined && isExtensible(obj) === false) {
+    throw new Error('Non-extensible objects are not allowed as keys.');
+  } else if (canDefineProperty) {
+    Object.defineProperty(obj, UID_HASH_KEY, {
+      enumerable: false,
+      configurable: false,
+      writable: false,
+      value: hashed,
+    });
+  } else if (
+    obj.propertyIsEnumerable !== undefined &&
+    obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable
+  ) {
+    // Since we can't define a non-enumerable property on the object
+    // we'll hijack one of the less-used non-enumerable properties to
+    // save our hash on it. Since this is a function it will not show up in
+    // `JSON.stringify` which is what we want.
+    obj.propertyIsEnumerable = function() {
+      return this.constructor.prototype.propertyIsEnumerable.apply(
+        this,
+        arguments
+      );
+    };
+    obj.propertyIsEnumerable[UID_HASH_KEY] = hashed;
+  } else if (obj.nodeType !== undefined) {
+    // At this point we couldn't get the IE `uniqueID` to use as a hash
+    // and we couldn't use a non-enumerable property to exploit the
+    // dontEnum bug so we simply add the `UID_HASH_KEY` on the node
+    // itself.
+    obj[UID_HASH_KEY] = hashed;
+  } else {
+    throw new Error('Unable to set a non-enumerable property on object.');
+  }
+
+  return hashed;
+}
+
+// Get references to ES5 object methods.
+var isExtensible = Object.isExtensible;
+
+// True if Object.defineProperty works as expected. IE8 fails this test.
+var canDefineProperty = (function() {
+  try {
+    Object.defineProperty({}, '@', {});
+    return true;
+  } catch (e) {
+    return false;
+  }
+})();
+
+// IE has a `uniqueID` property on DOM nodes. We can construct the hash from it
+// and avoid memory leaks from the IE cloneNode bug.
+function getIENodeHash(node) {
+  if (node && node.nodeType > 0) {
+    switch (node.nodeType) {
+      case 1: // Element
+        return node.uniqueID;
+      case 9: // Document
+        return node.documentElement && node.documentElement.uniqueID;
+    }
+  }
+}
+
+// If possible, use a WeakMap.
+var usingWeakMap = typeof WeakMap === 'function';
+var weakMap;
+if (usingWeakMap) {
+  weakMap = new WeakMap();
+}
+
+var objHashUID = 0;
+
+var UID_HASH_KEY = '__immutablehash__';
+if (typeof Symbol === 'function') {
+  UID_HASH_KEY = Symbol(UID_HASH_KEY);
+}
+
+var STRING_HASH_CACHE_MIN_STRLEN = 16;
+var STRING_HASH_CACHE_MAX_SIZE = 255;
+var STRING_HASH_CACHE_SIZE = 0;
+var stringHashCache = {};
+
+var ToKeyedSequence = /*@__PURE__*/(function (KeyedSeq$$1) {
+  function ToKeyedSequence(indexed, useKeys) {
+    this._iter = indexed;
+    this._useKeys = useKeys;
+    this.size = indexed.size;
+  }
+
+  if ( KeyedSeq$$1 ) ToKeyedSequence.__proto__ = KeyedSeq$$1;
+  ToKeyedSequence.prototype = Object.create( KeyedSeq$$1 && KeyedSeq$$1.prototype );
+  ToKeyedSequence.prototype.constructor = ToKeyedSequence;
+
+  ToKeyedSequence.prototype.get = function get (key, notSetValue) {
+    return this._iter.get(key, notSetValue);
+  };
+
+  ToKeyedSequence.prototype.has = function has (key) {
+    return this._iter.has(key);
+  };
+
+  ToKeyedSequence.prototype.valueSeq = function valueSeq () {
+    return this._iter.valueSeq();
+  };
+
+  ToKeyedSequence.prototype.reverse = function reverse () {
+    var this$1 = this;
+
+    var reversedSequence = reverseFactory(this, true);
+    if (!this._useKeys) {
+      reversedSequence.valueSeq = function () { return this$1._iter.toSeq().reverse(); };
+    }
+    return reversedSequence;
+  };
+
+  ToKeyedSequence.prototype.map = function map (mapper, context) {
+    var this$1 = this;
+
+    var mappedSequence = mapFactory(this, mapper, context);
+    if (!this._useKeys) {
+      mappedSequence.valueSeq = function () { return this$1._iter.toSeq().map(mapper, context); };
+    }
+    return mappedSequence;
+  };
+
+  ToKeyedSequence.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._iter.__iterate(function (v, k) { return fn(v, k, this$1); }, reverse);
+  };
+
+  ToKeyedSequence.prototype.__iterator = function __iterator (type, reverse) {
+    return this._iter.__iterator(type, reverse);
+  };
+
+  return ToKeyedSequence;
+}(KeyedSeq));
+ToKeyedSequence.prototype[IS_ORDERED_SYMBOL] = true;
+
+var ToIndexedSequence = /*@__PURE__*/(function (IndexedSeq$$1) {
+  function ToIndexedSequence(iter) {
+    this._iter = iter;
+    this.size = iter.size;
+  }
+
+  if ( IndexedSeq$$1 ) ToIndexedSequence.__proto__ = IndexedSeq$$1;
+  ToIndexedSequence.prototype = Object.create( IndexedSeq$$1 && IndexedSeq$$1.prototype );
+  ToIndexedSequence.prototype.constructor = ToIndexedSequence;
+
+  ToIndexedSequence.prototype.includes = function includes (value) {
+    return this._iter.includes(value);
+  };
+
+  ToIndexedSequence.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    var i = 0;
+    reverse && ensureSize(this);
+    return this._iter.__iterate(
+      function (v) { return fn(v, reverse ? this$1.size - ++i : i++, this$1); },
+      reverse
+    );
+  };
+
+  ToIndexedSequence.prototype.__iterator = function __iterator (type, reverse) {
+    var this$1 = this;
+
+    var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
+    var i = 0;
+    reverse && ensureSize(this);
+    return new Iterator(function () {
+      var step = iterator.next();
+      return step.done
+        ? step
+        : iteratorValue(
+            type,
+            reverse ? this$1.size - ++i : i++,
+            step.value,
+            step
+          );
+    });
+  };
+
+  return ToIndexedSequence;
+}(IndexedSeq));
+
+var ToSetSequence = /*@__PURE__*/(function (SetSeq$$1) {
+  function ToSetSequence(iter) {
+    this._iter = iter;
+    this.size = iter.size;
+  }
+
+  if ( SetSeq$$1 ) ToSetSequence.__proto__ = SetSeq$$1;
+  ToSetSequence.prototype = Object.create( SetSeq$$1 && SetSeq$$1.prototype );
+  ToSetSequence.prototype.constructor = ToSetSequence;
+
+  ToSetSequence.prototype.has = function has (key) {
+    return this._iter.includes(key);
+  };
+
+  ToSetSequence.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._iter.__iterate(function (v) { return fn(v, v, this$1); }, reverse);
+  };
+
+  ToSetSequence.prototype.__iterator = function __iterator (type, reverse) {
+    var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
+    return new Iterator(function () {
+      var step = iterator.next();
+      return step.done
+        ? step
+        : iteratorValue(type, step.value, step.value, step);
+    });
+  };
+
+  return ToSetSequence;
+}(SetSeq));
+
+var FromEntriesSequence = /*@__PURE__*/(function (KeyedSeq$$1) {
+  function FromEntriesSequence(entries) {
+    this._iter = entries;
+    this.size = entries.size;
+  }
+
+  if ( KeyedSeq$$1 ) FromEntriesSequence.__proto__ = KeyedSeq$$1;
+  FromEntriesSequence.prototype = Object.create( KeyedSeq$$1 && KeyedSeq$$1.prototype );
+  FromEntriesSequence.prototype.constructor = FromEntriesSequence;
+
+  FromEntriesSequence.prototype.entrySeq = function entrySeq () {
+    return this._iter.toSeq();
+  };
+
+  FromEntriesSequence.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._iter.__iterate(function (entry) {
+      // Check if entry exists first so array access doesn't throw for holes
+      // in the parent iteration.
+      if (entry) {
+        validateEntry(entry);
+        var indexedCollection = isCollection(entry);
+        return fn(
+          indexedCollection ? entry.get(1) : entry[1],
+          indexedCollection ? entry.get(0) : entry[0],
+          this$1
+        );
+      }
+    }, reverse);
+  };
+
+  FromEntriesSequence.prototype.__iterator = function __iterator (type, reverse) {
+    var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
+    return new Iterator(function () {
+      while (true) {
+        var step = iterator.next();
+        if (step.done) {
+          return step;
+        }
+        var entry = step.value;
+        // Check if entry exists first so array access doesn't throw for holes
+        // in the parent iteration.
+        if (entry) {
+          validateEntry(entry);
+          var indexedCollection = isCollection(entry);
+          return iteratorValue(
+            type,
+            indexedCollection ? entry.get(0) : entry[0],
+            indexedCollection ? entry.get(1) : entry[1],
+            step
+          );
+        }
+      }
+    });
+  };
+
+  return FromEntriesSequence;
+}(KeyedSeq));
+
+ToIndexedSequence.prototype.cacheResult = ToKeyedSequence.prototype.cacheResult = ToSetSequence.prototype.cacheResult = FromEntriesSequence.prototype.cacheResult = cacheResultThrough;
+
+function flipFactory(collection) {
+  var flipSequence = makeSequence(collection);
+  flipSequence._iter = collection;
+  flipSequence.size = collection.size;
+  flipSequence.flip = function () { return collection; };
+  flipSequence.reverse = function() {
+    var reversedSequence = collection.reverse.apply(this); // super.reverse()
+    reversedSequence.flip = function () { return collection.reverse(); };
+    return reversedSequence;
+  };
+  flipSequence.has = function (key) { return collection.includes(key); };
+  flipSequence.includes = function (key) { return collection.has(key); };
+  flipSequence.cacheResult = cacheResultThrough;
+  flipSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    return collection.__iterate(function (v, k) { return fn(k, v, this$1) !== false; }, reverse);
+  };
+  flipSequence.__iteratorUncached = function(type, reverse) {
+    if (type === ITERATE_ENTRIES) {
+      var iterator = collection.__iterator(type, reverse);
+      return new Iterator(function () {
+        var step = iterator.next();
+        if (!step.done) {
+          var k = step.value[0];
+          step.value[0] = step.value[1];
+          step.value[1] = k;
+        }
+        return step;
+      });
+    }
+    return collection.__iterator(
+      type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES,
+      reverse
+    );
+  };
+  return flipSequence;
+}
+
+function mapFactory(collection, mapper, context) {
+  var mappedSequence = makeSequence(collection);
+  mappedSequence.size = collection.size;
+  mappedSequence.has = function (key) { return collection.has(key); };
+  mappedSequence.get = function (key, notSetValue) {
+    var v = collection.get(key, NOT_SET);
+    return v === NOT_SET
+      ? notSetValue
+      : mapper.call(context, v, key, collection);
+  };
+  mappedSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    return collection.__iterate(
+      function (v, k, c) { return fn(mapper.call(context, v, k, c), k, this$1) !== false; },
+      reverse
+    );
+  };
+  mappedSequence.__iteratorUncached = function(type, reverse) {
+    var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
+    return new Iterator(function () {
+      var step = iterator.next();
+      if (step.done) {
+        return step;
+      }
+      var entry = step.value;
+      var key = entry[0];
+      return iteratorValue(
+        type,
+        key,
+        mapper.call(context, entry[1], key, collection),
+        step
+      );
+    });
+  };
+  return mappedSequence;
+}
+
+function reverseFactory(collection, useKeys) {
+  var this$1 = this;
+
+  var reversedSequence = makeSequence(collection);
+  reversedSequence._iter = collection;
+  reversedSequence.size = collection.size;
+  reversedSequence.reverse = function () { return collection; };
+  if (collection.flip) {
+    reversedSequence.flip = function() {
+      var flipSequence = flipFactory(collection);
+      flipSequence.reverse = function () { return collection.flip(); };
+      return flipSequence;
+    };
+  }
+  reversedSequence.get = function (key, notSetValue) { return collection.get(useKeys ? key : -1 - key, notSetValue); };
+  reversedSequence.has = function (key) { return collection.has(useKeys ? key : -1 - key); };
+  reversedSequence.includes = function (value) { return collection.includes(value); };
+  reversedSequence.cacheResult = cacheResultThrough;
+  reversedSequence.__iterate = function(fn, reverse) {
+    var this$1 = this;
+
+    var i = 0;
+    reverse && ensureSize(collection);
+    return collection.__iterate(
+      function (v, k) { return fn(v, useKeys ? k : reverse ? this$1.size - ++i : i++, this$1); },
+      !reverse
+    );
+  };
+  reversedSequence.__iterator = function (type, reverse) {
+    var i = 0;
+    reverse && ensureSize(collection);
+    var iterator = collection.__iterator(ITERATE_ENTRIES, !reverse);
+    return new Iterator(function () {
+      var step = iterator.next();
+      if (step.done) {
+        return step;
+      }
+      var entry = step.value;
+      return iteratorValue(
+        type,
+        useKeys ? entry[0] : reverse ? this$1.size - ++i : i++,
+        entry[1],
+        step
+      );
+    });
+  };
+  return reversedSequence;
+}
+
+function filterFactory(collection, predicate, context, useKeys) {
+  var filterSequence = makeSequence(collection);
+  if (useKeys) {
+    filterSequence.has = function (key) {
+      var v = collection.get(key, NOT_SET);
+      return v !== NOT_SET && !!predicate.call(context, v, key, collection);
+    };
+    filterSequence.get = function (key, notSetValue) {
+      var v = collection.get(key, NOT_SET);
+      return v !== NOT_SET && predicate.call(context, v, key, collection)
+        ? v
+        : notSetValue;
+    };
+  }
+  filterSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    var iterations = 0;
+    collection.__iterate(function (v, k, c) {
+      if (predicate.call(context, v, k, c)) {
+        iterations++;
+        return fn(v, useKeys ? k : iterations - 1, this$1);
+      }
+    }, reverse);
+    return iterations;
+  };
+  filterSequence.__iteratorUncached = function(type, reverse) {
+    var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
+    var iterations = 0;
+    return new Iterator(function () {
+      while (true) {
+        var step = iterator.next();
+        if (step.done) {
+          return step;
+        }
+        var entry = step.value;
+        var key = entry[0];
+        var value = entry[1];
+        if (predicate.call(context, value, key, collection)) {
+          return iteratorValue(type, useKeys ? key : iterations++, value, step);
+        }
+      }
+    });
+  };
+  return filterSequence;
+}
+
+function countByFactory(collection, grouper, context) {
+  var groups = Map().asMutable();
+  collection.__iterate(function (v, k) {
+    groups.update(grouper.call(context, v, k, collection), 0, function (a) { return a + 1; });
+  });
+  return groups.asImmutable();
+}
+
+function groupByFactory(collection, grouper, context) {
+  var isKeyedIter = isKeyed(collection);
+  var groups = (isOrdered(collection) ? OrderedMap() : Map()).asMutable();
+  collection.__iterate(function (v, k) {
+    groups.update(
+      grouper.call(context, v, k, collection),
+      function (a) { return ((a = a || []), a.push(isKeyedIter ? [k, v] : v), a); }
+    );
+  });
+  var coerce = collectionClass(collection);
+  return groups.map(function (arr) { return reify(collection, coerce(arr)); }).asImmutable();
+}
+
+function sliceFactory(collection, begin, end, useKeys) {
+  var originalSize = collection.size;
+
+  if (wholeSlice(begin, end, originalSize)) {
+    return collection;
+  }
+
+  var resolvedBegin = resolveBegin(begin, originalSize);
+  var resolvedEnd = resolveEnd(end, originalSize);
+
+  // begin or end will be NaN if they were provided as negative numbers and
+  // this collection's size is unknown. In that case, cache first so there is
+  // a known size and these do not resolve to NaN.
+  if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) {
+    return sliceFactory(collection.toSeq().cacheResult(), begin, end, useKeys);
+  }
+
+  // Note: resolvedEnd is undefined when the original sequence's length is
+  // unknown and this slice did not supply an end and should contain all
+  // elements after resolvedBegin.
+  // In that case, resolvedSize will be NaN and sliceSize will remain undefined.
+  var resolvedSize = resolvedEnd - resolvedBegin;
+  var sliceSize;
+  if (resolvedSize === resolvedSize) {
+    sliceSize = resolvedSize < 0 ? 0 : resolvedSize;
+  }
+
+  var sliceSeq = makeSequence(collection);
+
+  // If collection.size is undefined, the size of the realized sliceSeq is
+  // unknown at this point unless the number of items to slice is 0
+  sliceSeq.size =
+    sliceSize === 0 ? sliceSize : (collection.size && sliceSize) || undefined;
+
+  if (!useKeys && isSeq(collection) && sliceSize >= 0) {
+    sliceSeq.get = function(index, notSetValue) {
+      index = wrapIndex(this, index);
+      return index >= 0 && index < sliceSize
+        ? collection.get(index + resolvedBegin, notSetValue)
+        : notSetValue;
+    };
+  }
+
+  sliceSeq.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    if (sliceSize === 0) {
+      return 0;
+    }
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var skipped = 0;
+    var isSkipping = true;
+    var iterations = 0;
+    collection.__iterate(function (v, k) {
+      if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {
+        iterations++;
+        return (
+          fn(v, useKeys ? k : iterations - 1, this$1) !== false &&
+          iterations !== sliceSize
+        );
+      }
+    });
+    return iterations;
+  };
+
+  sliceSeq.__iteratorUncached = function(type, reverse) {
+    if (sliceSize !== 0 && reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    // Don't bother instantiating parent iterator if taking 0.
+    if (sliceSize === 0) {
+      return new Iterator(iteratorDone);
+    }
+    var iterator = collection.__iterator(type, reverse);
+    var skipped = 0;
+    var iterations = 0;
+    return new Iterator(function () {
+      while (skipped++ < resolvedBegin) {
+        iterator.next();
+      }
+      if (++iterations > sliceSize) {
+        return iteratorDone();
+      }
+      var step = iterator.next();
+      if (useKeys || type === ITERATE_VALUES || step.done) {
+        return step;
+      }
+      if (type === ITERATE_KEYS) {
+        return iteratorValue(type, iterations - 1, undefined, step);
+      }
+      return iteratorValue(type, iterations - 1, step.value[1], step);
+    });
+  };
+
+  return sliceSeq;
+}
+
+function takeWhileFactory(collection, predicate, context) {
+  var takeSequence = makeSequence(collection);
+  takeSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var iterations = 0;
+    collection.__iterate(
+      function (v, k, c) { return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$1); }
+    );
+    return iterations;
+  };
+  takeSequence.__iteratorUncached = function(type, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
+    var iterating = true;
+    return new Iterator(function () {
+      if (!iterating) {
+        return iteratorDone();
+      }
+      var step = iterator.next();
+      if (step.done) {
+        return step;
+      }
+      var entry = step.value;
+      var k = entry[0];
+      var v = entry[1];
+      if (!predicate.call(context, v, k, this$1)) {
+        iterating = false;
+        return iteratorDone();
+      }
+      return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);
+    });
+  };
+  return takeSequence;
+}
+
+function skipWhileFactory(collection, predicate, context, useKeys) {
+  var skipSequence = makeSequence(collection);
+  skipSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var isSkipping = true;
+    var iterations = 0;
+    collection.__iterate(function (v, k, c) {
+      if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {
+        iterations++;
+        return fn(v, useKeys ? k : iterations - 1, this$1);
+      }
+    });
+    return iterations;
+  };
+  skipSequence.__iteratorUncached = function(type, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
+    var skipping = true;
+    var iterations = 0;
+    return new Iterator(function () {
+      var step;
+      var k;
+      var v;
+      do {
+        step = iterator.next();
+        if (step.done) {
+          if (useKeys || type === ITERATE_VALUES) {
+            return step;
+          }
+          if (type === ITERATE_KEYS) {
+            return iteratorValue(type, iterations++, undefined, step);
+          }
+          return iteratorValue(type, iterations++, step.value[1], step);
+        }
+        var entry = step.value;
+        k = entry[0];
+        v = entry[1];
+        skipping && (skipping = predicate.call(context, v, k, this$1));
+      } while (skipping);
+      return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);
+    });
+  };
+  return skipSequence;
+}
+
+function concatFactory(collection, values) {
+  var isKeyedCollection = isKeyed(collection);
+  var iters = [collection]
+    .concat(values)
+    .map(function (v) {
+      if (!isCollection(v)) {
+        v = isKeyedCollection
+          ? keyedSeqFromValue(v)
+          : indexedSeqFromValue(Array.isArray(v) ? v : [v]);
+      } else if (isKeyedCollection) {
+        v = KeyedCollection(v);
+      }
+      return v;
+    })
+    .filter(function (v) { return v.size !== 0; });
+
+  if (iters.length === 0) {
+    return collection;
+  }
+
+  if (iters.length === 1) {
+    var singleton = iters[0];
+    if (
+      singleton === collection ||
+      (isKeyedCollection && isKeyed(singleton)) ||
+      (isIndexed(collection) && isIndexed(singleton))
+    ) {
+      return singleton;
+    }
+  }
+
+  var concatSeq = new ArraySeq(iters);
+  if (isKeyedCollection) {
+    concatSeq = concatSeq.toKeyedSeq();
+  } else if (!isIndexed(collection)) {
+    concatSeq = concatSeq.toSetSeq();
+  }
+  concatSeq = concatSeq.flatten(true);
+  concatSeq.size = iters.reduce(function (sum, seq) {
+    if (sum !== undefined) {
+      var size = seq.size;
+      if (size !== undefined) {
+        return sum + size;
+      }
+    }
+  }, 0);
+  return concatSeq;
+}
+
+function flattenFactory(collection, depth, useKeys) {
+  var flatSequence = makeSequence(collection);
+  flatSequence.__iterateUncached = function(fn, reverse) {
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var iterations = 0;
+    var stopped = false;
+    function flatDeep(iter, currentDepth) {
+      iter.__iterate(function (v, k) {
+        if ((!depth || currentDepth < depth) && isCollection(v)) {
+          flatDeep(v, currentDepth + 1);
+        } else {
+          iterations++;
+          if (fn(v, useKeys ? k : iterations - 1, flatSequence) === false) {
+            stopped = true;
+          }
+        }
+        return !stopped;
+      }, reverse);
+    }
+    flatDeep(collection, 0);
+    return iterations;
+  };
+  flatSequence.__iteratorUncached = function(type, reverse) {
+    if (reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    var iterator = collection.__iterator(type, reverse);
+    var stack = [];
+    var iterations = 0;
+    return new Iterator(function () {
+      while (iterator) {
+        var step = iterator.next();
+        if (step.done !== false) {
+          iterator = stack.pop();
+          continue;
+        }
+        var v = step.value;
+        if (type === ITERATE_ENTRIES) {
+          v = v[1];
+        }
+        if ((!depth || stack.length < depth) && isCollection(v)) {
+          stack.push(iterator);
+          iterator = v.__iterator(type, reverse);
+        } else {
+          return useKeys ? step : iteratorValue(type, iterations++, v, step);
+        }
+      }
+      return iteratorDone();
+    });
+  };
+  return flatSequence;
+}
+
+function flatMapFactory(collection, mapper, context) {
+  var coerce = collectionClass(collection);
+  return collection
+    .toSeq()
+    .map(function (v, k) { return coerce(mapper.call(context, v, k, collection)); })
+    .flatten(true);
+}
+
+function interposeFactory(collection, separator) {
+  var interposedSequence = makeSequence(collection);
+  interposedSequence.size = collection.size && collection.size * 2 - 1;
+  interposedSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    var iterations = 0;
+    collection.__iterate(
+      function (v) { return (!iterations || fn(separator, iterations++, this$1) !== false) &&
+        fn(v, iterations++, this$1) !== false; },
+      reverse
+    );
+    return iterations;
+  };
+  interposedSequence.__iteratorUncached = function(type, reverse) {
+    var iterator = collection.__iterator(ITERATE_VALUES, reverse);
+    var iterations = 0;
+    var step;
+    return new Iterator(function () {
+      if (!step || iterations % 2) {
+        step = iterator.next();
+        if (step.done) {
+          return step;
+        }
+      }
+      return iterations % 2
+        ? iteratorValue(type, iterations++, separator)
+        : iteratorValue(type, iterations++, step.value, step);
+    });
+  };
+  return interposedSequence;
+}
+
+function sortFactory(collection, comparator, mapper) {
+  if (!comparator) {
+    comparator = defaultComparator;
+  }
+  var isKeyedCollection = isKeyed(collection);
+  var index = 0;
+  var entries = collection
+    .toSeq()
+    .map(function (v, k) { return [k, v, index++, mapper ? mapper(v, k, collection) : v]; })
+    .valueSeq()
+    .toArray();
+  entries.sort(function (a, b) { return comparator(a[3], b[3]) || a[2] - b[2]; }).forEach(
+    isKeyedCollection
+      ? function (v, i) {
+          entries[i].length = 2;
+        }
+      : function (v, i) {
+          entries[i] = v[1];
+        }
+  );
+  return isKeyedCollection
+    ? KeyedSeq(entries)
+    : isIndexed(collection)
+      ? IndexedSeq(entries)
+      : SetSeq(entries);
+}
+
+function maxFactory(collection, comparator, mapper) {
+  if (!comparator) {
+    comparator = defaultComparator;
+  }
+  if (mapper) {
+    var entry = collection
+      .toSeq()
+      .map(function (v, k) { return [v, mapper(v, k, collection)]; })
+      .reduce(function (a, b) { return (maxCompare(comparator, a[1], b[1]) ? b : a); });
+    return entry && entry[0];
+  }
+  return collection.reduce(function (a, b) { return (maxCompare(comparator, a, b) ? b : a); });
+}
+
+function maxCompare(comparator, a, b) {
+  var comp = comparator(b, a);
+  // b is considered the new max if the comparator declares them equal, but
+  // they are not equal and b is in fact a nullish value.
+  return (
+    (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) ||
+    comp > 0
+  );
+}
+
+function zipWithFactory(keyIter, zipper, iters, zipAll) {
+  var zipSequence = makeSequence(keyIter);
+  var sizes = new ArraySeq(iters).map(function (i) { return i.size; });
+  zipSequence.size = zipAll ? sizes.max() : sizes.min();
+  // Note: this a generic base implementation of __iterate in terms of
+  // __iterator which may be more generically useful in the future.
+  zipSequence.__iterate = function(fn, reverse) {
+    /* generic:
+    var iterator = this.__iterator(ITERATE_ENTRIES, reverse);
+    var step;
+    var iterations = 0;
+    while (!(step = iterator.next()).done) {
+      iterations++;
+      if (fn(step.value[1], step.value[0], this) === false) {
+        break;
+      }
+    }
+    return iterations;
+    */
+    // indexed:
+    var iterator = this.__iterator(ITERATE_VALUES, reverse);
+    var step;
+    var iterations = 0;
+    while (!(step = iterator.next()).done) {
+      if (fn(step.value, iterations++, this) === false) {
+        break;
+      }
+    }
+    return iterations;
+  };
+  zipSequence.__iteratorUncached = function(type, reverse) {
+    var iterators = iters.map(
+      function (i) { return ((i = Collection(i)), getIterator(reverse ? i.reverse() : i)); }
+    );
+    var iterations = 0;
+    var isDone = false;
+    return new Iterator(function () {
+      var steps;
+      if (!isDone) {
+        steps = iterators.map(function (i) { return i.next(); });
+        isDone = zipAll ? steps.every(function (s) { return s.done; }) : steps.some(function (s) { return s.done; });
+      }
+      if (isDone) {
+        return iteratorDone();
+      }
+      return iteratorValue(
+        type,
+        iterations++,
+        zipper.apply(null, steps.map(function (s) { return s.value; }))
+      );
+    });
+  };
+  return zipSequence;
+}
+
+// #pragma Helper Functions
+
+function reify(iter, seq) {
+  return iter === seq ? iter : isSeq(iter) ? seq : iter.constructor(seq);
+}
+
+function validateEntry(entry) {
+  if (entry !== Object(entry)) {
+    throw new TypeError('Expected [K, V] tuple: ' + entry);
+  }
+}
+
+function collectionClass(collection) {
+  return isKeyed(collection)
+    ? KeyedCollection
+    : isIndexed(collection)
+      ? IndexedCollection
+      : SetCollection;
+}
+
+function makeSequence(collection) {
+  return Object.create(
+    (isKeyed(collection)
+      ? KeyedSeq
+      : isIndexed(collection)
+        ? IndexedSeq
+        : SetSeq
+    ).prototype
+  );
+}
+
+function cacheResultThrough() {
+  if (this._iter.cacheResult) {
+    this._iter.cacheResult();
+    this.size = this._iter.size;
+    return this;
+  }
+  return Seq.prototype.cacheResult.call(this);
+}
+
+function defaultComparator(a, b) {
+  if (a === undefined && b === undefined) {
+    return 0;
+  }
+
+  if (a === undefined) {
+    return 1;
+  }
+
+  if (b === undefined) {
+    return -1;
+  }
+
+  return a > b ? 1 : a < b ? -1 : 0;
+}
+
+// http://jsperf.com/copy-array-inline
+function arrCopy(arr, offset) {
+  offset = offset || 0;
+  var len = Math.max(0, arr.length - offset);
+  var newArr = new Array(len);
+  for (var ii = 0; ii < len; ii++) {
+    newArr[ii] = arr[ii + offset];
+  }
+  return newArr;
+}
+
+function invariant(condition, error) {
+  if (!condition) { throw new Error(error); }
+}
+
+function assertNotInfinite(size) {
+  invariant(
+    size !== Infinity,
+    'Cannot perform this action with an infinite size.'
+  );
+}
+
+function coerceKeyPath(keyPath) {
+  if (isArrayLike(keyPath) && typeof keyPath !== 'string') {
+    return keyPath;
+  }
+  if (isOrdered(keyPath)) {
+    return keyPath.toArray();
+  }
+  throw new TypeError(
+    'Invalid keyPath: expected Ordered Collection or Array: ' + keyPath
+  );
+}
+
+function isPlainObj(value) {
+  return (
+    value &&
+    (typeof value.constructor !== 'function' ||
+      value.constructor.name === 'Object')
+  );
+}
+
+/**
+ * Returns true if the value is a potentially-persistent data structure, either
+ * provided by Immutable.js or a plain Array or Object.
+ */
+function isDataStructure(value) {
+  return (
+    typeof value === 'object' &&
+    (isImmutable(value) || Array.isArray(value) || isPlainObj(value))
+  );
+}
+
+/**
+ * Converts a value to a string, adding quotes if a string was provided.
+ */
+function quoteString(value) {
+  try {
+    return typeof value === 'string' ? JSON.stringify(value) : String(value);
+  } catch (_ignoreError) {
+    return JSON.stringify(value);
+  }
+}
+
+function has(collection, key) {
+  return isImmutable(collection)
+    ? collection.has(key)
+    : isDataStructure(collection) && hasOwnProperty.call(collection, key);
+}
+
+function get(collection, key, notSetValue) {
+  return isImmutable(collection)
+    ? collection.get(key, notSetValue)
+    : !has(collection, key)
+      ? notSetValue
+      : typeof collection.get === 'function'
+        ? collection.get(key)
+        : collection[key];
+}
+
+function shallowCopy(from) {
+  if (Array.isArray(from)) {
+    return arrCopy(from);
+  }
+  var to = {};
+  for (var key in from) {
+    if (hasOwnProperty.call(from, key)) {
+      to[key] = from[key];
+    }
+  }
+  return to;
+}
+
+function remove(collection, key) {
+  if (!isDataStructure(collection)) {
+    throw new TypeError(
+      'Cannot update non-data-structure value: ' + collection
+    );
+  }
+  if (isImmutable(collection)) {
+    if (!collection.remove) {
+      throw new TypeError(
+        'Cannot update immutable value without .remove() method: ' + collection
+      );
+    }
+    return collection.remove(key);
+  }
+  if (!hasOwnProperty.call(collection, key)) {
+    return collection;
+  }
+  var collectionCopy = shallowCopy(collection);
+  if (Array.isArray(collectionCopy)) {
+    collectionCopy.splice(key, 1);
+  } else {
+    delete collectionCopy[key];
+  }
+  return collectionCopy;
+}
+
+function set(collection, key, value) {
+  if (!isDataStructure(collection)) {
+    throw new TypeError(
+      'Cannot update non-data-structure value: ' + collection
+    );
+  }
+  if (isImmutable(collection)) {
+    if (!collection.set) {
+      throw new TypeError(
+        'Cannot update immutable value without .set() method: ' + collection
+      );
+    }
+    return collection.set(key, value);
+  }
+  if (hasOwnProperty.call(collection, key) && value === collection[key]) {
+    return collection;
+  }
+  var collectionCopy = shallowCopy(collection);
+  collectionCopy[key] = value;
+  return collectionCopy;
+}
+
+function updateIn(collection, keyPath, notSetValue, updater) {
+  if (!updater) {
+    updater = notSetValue;
+    notSetValue = undefined;
+  }
+  var updatedValue = updateInDeeply(
+    isImmutable(collection),
+    collection,
+    coerceKeyPath(keyPath),
+    0,
+    notSetValue,
+    updater
+  );
+  return updatedValue === NOT_SET ? notSetValue : updatedValue;
+}
+
+function updateInDeeply(
+  inImmutable,
+  existing,
+  keyPath,
+  i,
+  notSetValue,
+  updater
+) {
+  var wasNotSet = existing === NOT_SET;
+  if (i === keyPath.length) {
+    var existingValue = wasNotSet ? notSetValue : existing;
+    var newValue = updater(existingValue);
+    return newValue === existingValue ? existing : newValue;
+  }
+  if (!wasNotSet && !isDataStructure(existing)) {
+    throw new TypeError(
+      'Cannot update within non-data-structure value in path [' +
+        keyPath.slice(0, i).map(quoteString) +
+        ']: ' +
+        existing
+    );
+  }
+  var key = keyPath[i];
+  var nextExisting = wasNotSet ? NOT_SET : get(existing, key, NOT_SET);
+  var nextUpdated = updateInDeeply(
+    nextExisting === NOT_SET ? inImmutable : isImmutable(nextExisting),
+    nextExisting,
+    keyPath,
+    i + 1,
+    notSetValue,
+    updater
+  );
+  return nextUpdated === nextExisting
+    ? existing
+    : nextUpdated === NOT_SET
+      ? remove(existing, key)
+      : set(
+          wasNotSet ? (inImmutable ? emptyMap() : {}) : existing,
+          key,
+          nextUpdated
+        );
+}
+
+function setIn(collection, keyPath, value) {
+  return updateIn(collection, keyPath, NOT_SET, function () { return value; });
+}
+
+function setIn$1(keyPath, v) {
+  return setIn(this, keyPath, v);
+}
+
+function removeIn(collection, keyPath) {
+  return updateIn(collection, keyPath, function () { return NOT_SET; });
+}
+
+function deleteIn(keyPath) {
+  return removeIn(this, keyPath);
+}
+
+function update(collection, key, notSetValue, updater) {
+  return updateIn(collection, [key], notSetValue, updater);
+}
+
+function update$1(key, notSetValue, updater) {
+  return arguments.length === 1
+    ? key(this)
+    : update(this, key, notSetValue, updater);
+}
+
+function updateIn$1(keyPath, notSetValue, updater) {
+  return updateIn(this, keyPath, notSetValue, updater);
+}
+
+function merge() {
+  var iters = [], len = arguments.length;
+  while ( len-- ) iters[ len ] = arguments[ len ];
+
+  return mergeIntoKeyedWith(this, iters);
+}
+
+function mergeWith(merger) {
+  var iters = [], len = arguments.length - 1;
+  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
+
+  if (typeof merger !== 'function') {
+    throw new TypeError('Invalid merger function: ' + merger);
+  }
+  return mergeIntoKeyedWith(this, iters, merger);
+}
+
+function mergeIntoKeyedWith(collection, collections, merger) {
+  var iters = [];
+  for (var ii = 0; ii < collections.length; ii++) {
+    var collection$1 = KeyedCollection(collections[ii]);
+    if (collection$1.size !== 0) {
+      iters.push(collection$1);
+    }
+  }
+  if (iters.length === 0) {
+    return collection;
+  }
+  if (
+    collection.toSeq().size === 0 &&
+    !collection.__ownerID &&
+    iters.length === 1
+  ) {
+    return collection.constructor(iters[0]);
+  }
+  return collection.withMutations(function (collection) {
+    var mergeIntoCollection = merger
+      ? function (value, key) {
+          update(
+            collection,
+            key,
+            NOT_SET,
+            function (oldVal) { return (oldVal === NOT_SET ? value : merger(oldVal, value, key)); }
+          );
+        }
+      : function (value, key) {
+          collection.set(key, value);
+        };
+    for (var ii = 0; ii < iters.length; ii++) {
+      iters[ii].forEach(mergeIntoCollection);
+    }
+  });
+}
+
+function merge$1(collection) {
+  var sources = [], len = arguments.length - 1;
+  while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
+
+  return mergeWithSources(collection, sources);
+}
+
+function mergeWith$1(merger, collection) {
+  var sources = [], len = arguments.length - 2;
+  while ( len-- > 0 ) sources[ len ] = arguments[ len + 2 ];
+
+  return mergeWithSources(collection, sources, merger);
+}
+
+function mergeDeep(collection) {
+  var sources = [], len = arguments.length - 1;
+  while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
+
+  return mergeDeepWithSources(collection, sources);
+}
+
+function mergeDeepWith(merger, collection) {
+  var sources = [], len = arguments.length - 2;
+  while ( len-- > 0 ) sources[ len ] = arguments[ len + 2 ];
+
+  return mergeDeepWithSources(collection, sources, merger);
+}
+
+function mergeDeepWithSources(collection, sources, merger) {
+  return mergeWithSources(collection, sources, deepMergerWith(merger));
+}
+
+function mergeWithSources(collection, sources, merger) {
+  if (!isDataStructure(collection)) {
+    throw new TypeError(
+      'Cannot merge into non-data-structure value: ' + collection
+    );
+  }
+  if (isImmutable(collection)) {
+    return typeof merger === 'function' && collection.mergeWith
+      ? collection.mergeWith.apply(collection, [ merger ].concat( sources ))
+      : collection.merge
+        ? collection.merge.apply(collection, sources)
+        : collection.concat.apply(collection, sources);
+  }
+  var isArray = Array.isArray(collection);
+  var merged = collection;
+  var Collection$$1 = isArray ? IndexedCollection : KeyedCollection;
+  var mergeItem = isArray
+    ? function (value) {
+        // Copy on write
+        if (merged === collection) {
+          merged = shallowCopy(merged);
+        }
+        merged.push(value);
+      }
+    : function (value, key) {
+        var hasVal = hasOwnProperty.call(merged, key);
+        var nextVal =
+          hasVal && merger ? merger(merged[key], value, key) : value;
+        if (!hasVal || nextVal !== merged[key]) {
+          // Copy on write
+          if (merged === collection) {
+            merged = shallowCopy(merged);
+          }
+          merged[key] = nextVal;
+        }
+      };
+  for (var i = 0; i < sources.length; i++) {
+    Collection$$1(sources[i]).forEach(mergeItem);
+  }
+  return merged;
+}
+
+function deepMergerWith(merger) {
+  function deepMerger(oldValue, newValue, key) {
+    return isDataStructure(oldValue) && isDataStructure(newValue)
+      ? mergeWithSources(oldValue, [newValue], deepMerger)
+      : merger
+        ? merger(oldValue, newValue, key)
+        : newValue;
+  }
+  return deepMerger;
+}
+
+function mergeDeep$1() {
+  var iters = [], len = arguments.length;
+  while ( len-- ) iters[ len ] = arguments[ len ];
+
+  return mergeDeepWithSources(this, iters);
+}
+
+function mergeDeepWith$1(merger) {
+  var iters = [], len = arguments.length - 1;
+  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
+
+  return mergeDeepWithSources(this, iters, merger);
+}
+
+function mergeIn(keyPath) {
+  var iters = [], len = arguments.length - 1;
+  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
+
+  return updateIn(this, keyPath, emptyMap(), function (m) { return mergeWithSources(m, iters); });
+}
+
+function mergeDeepIn(keyPath) {
+  var iters = [], len = arguments.length - 1;
+  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
+
+  return updateIn(this, keyPath, emptyMap(), function (m) { return mergeDeepWithSources(m, iters); }
+  );
+}
+
+function withMutations(fn) {
+  var mutable = this.asMutable();
+  fn(mutable);
+  return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this;
+}
+
+function asMutable() {
+  return this.__ownerID ? this : this.__ensureOwner(new OwnerID());
+}
+
+function asImmutable() {
+  return this.__ensureOwner();
+}
+
+function wasAltered() {
+  return this.__altered;
+}
+
+var Map = /*@__PURE__*/(function (KeyedCollection$$1) {
+  function Map(value) {
+    return value === null || value === undefined
+      ? emptyMap()
+      : isMap(value) && !isOrdered(value)
+        ? value
+        : emptyMap().withMutations(function (map) {
+            var iter = KeyedCollection$$1(value);
+            assertNotInfinite(iter.size);
+            iter.forEach(function (v, k) { return map.set(k, v); });
+          });
+  }
+
+  if ( KeyedCollection$$1 ) Map.__proto__ = KeyedCollection$$1;
+  Map.prototype = Object.create( KeyedCollection$$1 && KeyedCollection$$1.prototype );
+  Map.prototype.constructor = Map;
+
+  Map.of = function of () {
+    var keyValues = [], len = arguments.length;
+    while ( len-- ) keyValues[ len ] = arguments[ len ];
+
+    return emptyMap().withMutations(function (map) {
+      for (var i = 0; i < keyValues.length; i += 2) {
+        if (i + 1 >= keyValues.length) {
+          throw new Error('Missing value for key: ' + keyValues[i]);
+        }
+        map.set(keyValues[i], keyValues[i + 1]);
+      }
+    });
+  };
+
+  Map.prototype.toString = function toString () {
+    return this.__toString('Map {', '}');
+  };
+
+  // @pragma Access
+
+  Map.prototype.get = function get (k, notSetValue) {
+    return this._root
+      ? this._root.get(0, undefined, k, notSetValue)
+      : notSetValue;
+  };
+
+  // @pragma Modification
+
+  Map.prototype.set = function set (k, v) {
+    return updateMap(this, k, v);
+  };
+
+  Map.prototype.remove = function remove (k) {
+    return updateMap(this, k, NOT_SET);
+  };
+
+  Map.prototype.deleteAll = function deleteAll (keys) {
+    var collection = Collection(keys);
+
+    if (collection.size === 0) {
+      return this;
+    }
+
+    return this.withMutations(function (map) {
+      collection.forEach(function (key) { return map.remove(key); });
+    });
+  };
+
+  Map.prototype.clear = function clear () {
+    if (this.size === 0) {
+      return this;
+    }
+    if (this.__ownerID) {
+      this.size = 0;
+      this._root = null;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return emptyMap();
+  };
+
+  // @pragma Composition
+
+  Map.prototype.sort = function sort (comparator) {
+    // Late binding
+    return OrderedMap(sortFactory(this, comparator));
+  };
+
+  Map.prototype.sortBy = function sortBy (mapper, comparator) {
+    // Late binding
+    return OrderedMap(sortFactory(this, comparator, mapper));
+  };
+
+  Map.prototype.map = function map (mapper, context) {
+    return this.withMutations(function (map) {
+      map.forEach(function (value, key) {
+        map.set(key, mapper.call(context, value, key, map));
+      });
+    });
+  };
+
+  // @pragma Mutability
+
+  Map.prototype.__iterator = function __iterator (type, reverse) {
+    return new MapIterator(this, type, reverse);
+  };
+
+  Map.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    var iterations = 0;
+    this._root &&
+      this._root.iterate(function (entry) {
+        iterations++;
+        return fn(entry[1], entry[0], this$1);
+      }, reverse);
+    return iterations;
+  };
+
+  Map.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    if (!ownerID) {
+      if (this.size === 0) {
+        return emptyMap();
+      }
+      this.__ownerID = ownerID;
+      this.__altered = false;
+      return this;
+    }
+    return makeMap(this.size, this._root, ownerID, this.__hash);
+  };
+
+  return Map;
+}(KeyedCollection));
+
+Map.isMap = isMap;
+
+var MapPrototype = Map.prototype;
+MapPrototype[IS_MAP_SYMBOL] = true;
+MapPrototype[DELETE] = MapPrototype.remove;
+MapPrototype.removeAll = MapPrototype.deleteAll;
+MapPrototype.setIn = setIn$1;
+MapPrototype.removeIn = MapPrototype.deleteIn = deleteIn;
+MapPrototype.update = update$1;
+MapPrototype.updateIn = updateIn$1;
+MapPrototype.merge = MapPrototype.concat = merge;
+MapPrototype.mergeWith = mergeWith;
+MapPrototype.mergeDeep = mergeDeep$1;
+MapPrototype.mergeDeepWith = mergeDeepWith$1;
+MapPrototype.mergeIn = mergeIn;
+MapPrototype.mergeDeepIn = mergeDeepIn;
+MapPrototype.withMutations = withMutations;
+MapPrototype.wasAltered = wasAltered;
+MapPrototype.asImmutable = asImmutable;
+MapPrototype['@@transducer/init'] = MapPrototype.asMutable = asMutable;
+MapPrototype['@@transducer/step'] = function(result, arr) {
+  return result.set(arr[0], arr[1]);
+};
+MapPrototype['@@transducer/result'] = function(obj) {
+  return obj.asImmutable();
+};
+
+// #pragma Trie Nodes
+
+var ArrayMapNode = function ArrayMapNode(ownerID, entries) {
+  this.ownerID = ownerID;
+  this.entries = entries;
+};
+
+ArrayMapNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  var entries = this.entries;
+  for (var ii = 0, len = entries.length; ii < len; ii++) {
+    if (is(key, entries[ii][0])) {
+      return entries[ii][1];
+    }
+  }
+  return notSetValue;
+};
+
+ArrayMapNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  var removed = value === NOT_SET;
+
+  var entries = this.entries;
+  var idx = 0;
+  var len = entries.length;
+  for (; idx < len; idx++) {
+    if (is(key, entries[idx][0])) {
+      break;
+    }
+  }
+  var exists = idx < len;
+
+  if (exists ? entries[idx][1] === value : removed) {
+    return this;
+  }
+
+  SetRef(didAlter);
+  (removed || !exists) && SetRef(didChangeSize);
+
+  if (removed && entries.length === 1) {
+    return; // undefined
+  }
+
+  if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) {
+    return createNodes(ownerID, entries, key, value);
+  }
+
+  var isEditable = ownerID && ownerID === this.ownerID;
+  var newEntries = isEditable ? entries : arrCopy(entries);
+
+  if (exists) {
+    if (removed) {
+      idx === len - 1
+        ? newEntries.pop()
+        : (newEntries[idx] = newEntries.pop());
+    } else {
+      newEntries[idx] = [key, value];
+    }
+  } else {
+    newEntries.push([key, value]);
+  }
+
+  if (isEditable) {
+    this.entries = newEntries;
+    return this;
+  }
+
+  return new ArrayMapNode(ownerID, newEntries);
+};
+
+var BitmapIndexedNode = function BitmapIndexedNode(ownerID, bitmap, nodes) {
+  this.ownerID = ownerID;
+  this.bitmap = bitmap;
+  this.nodes = nodes;
+};
+
+BitmapIndexedNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+  var bit = 1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK);
+  var bitmap = this.bitmap;
+  return (bitmap & bit) === 0
+    ? notSetValue
+    : this.nodes[popCount(bitmap & (bit - 1))].get(
+        shift + SHIFT,
+        keyHash,
+        key,
+        notSetValue
+      );
+};
+
+BitmapIndexedNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+  var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
+  var bit = 1 << keyHashFrag;
+  var bitmap = this.bitmap;
+  var exists = (bitmap & bit) !== 0;
+
+  if (!exists && value === NOT_SET) {
+    return this;
+  }
+
+  var idx = popCount(bitmap & (bit - 1));
+  var nodes = this.nodes;
+  var node = exists ? nodes[idx] : undefined;
+  var newNode = updateNode(
+    node,
+    ownerID,
+    shift + SHIFT,
+    keyHash,
+    key,
+    value,
+    didChangeSize,
+    didAlter
+  );
+
+  if (newNode === node) {
+    return this;
+  }
+
+  if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {
+    return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode);
+  }
+
+  if (
+    exists &&
+    !newNode &&
+    nodes.length === 2 &&
+    isLeafNode(nodes[idx ^ 1])
+  ) {
+    return nodes[idx ^ 1];
+  }
+
+  if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) {
+    return newNode;
+  }
+
+  var isEditable = ownerID && ownerID === this.ownerID;
+  var newBitmap = exists ? (newNode ? bitmap : bitmap ^ bit) : bitmap | bit;
+  var newNodes = exists
+    ? newNode
+      ? setAt(nodes, idx, newNode, isEditable)
+      : spliceOut(nodes, idx, isEditable)
+    : spliceIn(nodes, idx, newNode, isEditable);
+
+  if (isEditable) {
+    this.bitmap = newBitmap;
+    this.nodes = newNodes;
+    return this;
+  }
+
+  return new BitmapIndexedNode(ownerID, newBitmap, newNodes);
+};
+
+var HashArrayMapNode = function HashArrayMapNode(ownerID, count, nodes) {
+  this.ownerID = ownerID;
+  this.count = count;
+  this.nodes = nodes;
+};
+
+HashArrayMapNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+  var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
+  var node = this.nodes[idx];
+  return node
+    ? node.get(shift + SHIFT, keyHash, key, notSetValue)
+    : notSetValue;
+};
+
+HashArrayMapNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+  var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
+  var removed = value === NOT_SET;
+  var nodes = this.nodes;
+  var node = nodes[idx];
+
+  if (removed && !node) {
+    return this;
+  }
+
+  var newNode = updateNode(
+    node,
+    ownerID,
+    shift + SHIFT,
+    keyHash,
+    key,
+    value,
+    didChangeSize,
+    didAlter
+  );
+  if (newNode === node) {
+    return this;
+  }
+
+  var newCount = this.count;
+  if (!node) {
+    newCount++;
+  } else if (!newNode) {
+    newCount--;
+    if (newCount < MIN_HASH_ARRAY_MAP_SIZE) {
+      return packNodes(ownerID, nodes, newCount, idx);
+    }
+  }
+
+  var isEditable = ownerID && ownerID === this.ownerID;
+  var newNodes = setAt(nodes, idx, newNode, isEditable);
+
+  if (isEditable) {
+    this.count = newCount;
+    this.nodes = newNodes;
+    return this;
+  }
+
+  return new HashArrayMapNode(ownerID, newCount, newNodes);
+};
+
+var HashCollisionNode = function HashCollisionNode(ownerID, keyHash, entries) {
+  this.ownerID = ownerID;
+  this.keyHash = keyHash;
+  this.entries = entries;
+};
+
+HashCollisionNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  var entries = this.entries;
+  for (var ii = 0, len = entries.length; ii < len; ii++) {
+    if (is(key, entries[ii][0])) {
+      return entries[ii][1];
+    }
+  }
+  return notSetValue;
+};
+
+HashCollisionNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+
+  var removed = value === NOT_SET;
+
+  if (keyHash !== this.keyHash) {
+    if (removed) {
+      return this;
+    }
+    SetRef(didAlter);
+    SetRef(didChangeSize);
+    return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]);
+  }
+
+  var entries = this.entries;
+  var idx = 0;
+  var len = entries.length;
+  for (; idx < len; idx++) {
+    if (is(key, entries[idx][0])) {
+      break;
+    }
+  }
+  var exists = idx < len;
+
+  if (exists ? entries[idx][1] === value : removed) {
+    return this;
+  }
+
+  SetRef(didAlter);
+  (removed || !exists) && SetRef(didChangeSize);
+
+  if (removed && len === 2) {
+    return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]);
+  }
+
+  var isEditable = ownerID && ownerID === this.ownerID;
+  var newEntries = isEditable ? entries : arrCopy(entries);
+
+  if (exists) {
+    if (removed) {
+      idx === len - 1
+        ? newEntries.pop()
+        : (newEntries[idx] = newEntries.pop());
+    } else {
+      newEntries[idx] = [key, value];
+    }
+  } else {
+    newEntries.push([key, value]);
+  }
+
+  if (isEditable) {
+    this.entries = newEntries;
+    return this;
+  }
+
+  return new HashCollisionNode(ownerID, this.keyHash, newEntries);
+};
+
+var ValueNode = function ValueNode(ownerID, keyHash, entry) {
+  this.ownerID = ownerID;
+  this.keyHash = keyHash;
+  this.entry = entry;
+};
+
+ValueNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  return is(key, this.entry[0]) ? this.entry[1] : notSetValue;
+};
+
+ValueNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  var removed = value === NOT_SET;
+  var keyMatch = is(key, this.entry[0]);
+  if (keyMatch ? value === this.entry[1] : removed) {
+    return this;
+  }
+
+  SetRef(didAlter);
+
+  if (removed) {
+    SetRef(didChangeSize);
+    return; // undefined
+  }
+
+  if (keyMatch) {
+    if (ownerID && ownerID === this.ownerID) {
+      this.entry[1] = value;
+      return this;
+    }
+    return new ValueNode(ownerID, this.keyHash, [key, value]);
+  }
+
+  SetRef(didChangeSize);
+  return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]);
+};
+
+// #pragma Iterators
+
+ArrayMapNode.prototype.iterate = HashCollisionNode.prototype.iterate = function(
+  fn,
+  reverse
+) {
+  var entries = this.entries;
+  for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {
+    if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {
+      return false;
+    }
+  }
+};
+
+BitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate = function(
+  fn,
+  reverse
+) {
+  var nodes = this.nodes;
+  for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {
+    var node = nodes[reverse ? maxIndex - ii : ii];
+    if (node && node.iterate(fn, reverse) === false) {
+      return false;
+    }
+  }
+};
+
+// eslint-disable-next-line no-unused-vars
+ValueNode.prototype.iterate = function(fn, reverse) {
+  return fn(this.entry);
+};
+
+var MapIterator = /*@__PURE__*/(function (Iterator$$1) {
+  function MapIterator(map, type, reverse) {
+    this._type = type;
+    this._reverse = reverse;
+    this._stack = map._root && mapIteratorFrame(map._root);
+  }
+
+  if ( Iterator$$1 ) MapIterator.__proto__ = Iterator$$1;
+  MapIterator.prototype = Object.create( Iterator$$1 && Iterator$$1.prototype );
+  MapIterator.prototype.constructor = MapIterator;
+
+  MapIterator.prototype.next = function next () {
+    var type = this._type;
+    var stack = this._stack;
+    while (stack) {
+      var node = stack.node;
+      var index = stack.index++;
+      var maxIndex = (void 0);
+      if (node.entry) {
+        if (index === 0) {
+          return mapIteratorValue(type, node.entry);
+        }
+      } else if (node.entries) {
+        maxIndex = node.entries.length - 1;
+        if (index <= maxIndex) {
+          return mapIteratorValue(
+            type,
+            node.entries[this._reverse ? maxIndex - index : index]
+          );
+        }
+      } else {
+        maxIndex = node.nodes.length - 1;
+        if (index <= maxIndex) {
+          var subNode = node.nodes[this._reverse ? maxIndex - index : index];
+          if (subNode) {
+            if (subNode.entry) {
+              return mapIteratorValue(type, subNode.entry);
+            }
+            stack = this._stack = mapIteratorFrame(subNode, stack);
+          }
+          continue;
+        }
+      }
+      stack = this._stack = this._stack.__prev;
+    }
+    return iteratorDone();
+  };
+
+  return MapIterator;
+}(Iterator));
+
+function mapIteratorValue(type, entry) {
+  return iteratorValue(type, entry[0], entry[1]);
+}
+
+function mapIteratorFrame(node, prev) {
+  return {
+    node: node,
+    index: 0,
+    __prev: prev,
+  };
+}
+
+function makeMap(size, root, ownerID, hash$$1) {
+  var map = Object.create(MapPrototype);
+  map.size = size;
+  map._root = root;
+  map.__ownerID = ownerID;
+  map.__hash = hash$$1;
+  map.__altered = false;
+  return map;
+}
+
+var EMPTY_MAP;
+function emptyMap() {
+  return EMPTY_MAP || (EMPTY_MAP = makeMap(0));
+}
+
+function updateMap(map, k, v) {
+  var newRoot;
+  var newSize;
+  if (!map._root) {
+    if (v === NOT_SET) {
+      return map;
+    }
+    newSize = 1;
+    newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]);
+  } else {
+    var didChangeSize = MakeRef();
+    var didAlter = MakeRef();
+    newRoot = updateNode(
+      map._root,
+      map.__ownerID,
+      0,
+      undefined,
+      k,
+      v,
+      didChangeSize,
+      didAlter
+    );
+    if (!didAlter.value) {
+      return map;
+    }
+    newSize = map.size + (didChangeSize.value ? (v === NOT_SET ? -1 : 1) : 0);
+  }
+  if (map.__ownerID) {
+    map.size = newSize;
+    map._root = newRoot;
+    map.__hash = undefined;
+    map.__altered = true;
+    return map;
+  }
+  return newRoot ? makeMap(newSize, newRoot) : emptyMap();
+}
+
+function updateNode(
+  node,
+  ownerID,
+  shift,
+  keyHash,
+  key,
+  value,
+  didChangeSize,
+  didAlter
+) {
+  if (!node) {
+    if (value === NOT_SET) {
+      return node;
+    }
+    SetRef(didAlter);
+    SetRef(didChangeSize);
+    return new ValueNode(ownerID, keyHash, [key, value]);
+  }
+  return node.update(
+    ownerID,
+    shift,
+    keyHash,
+    key,
+    value,
+    didChangeSize,
+    didAlter
+  );
+}
+
+function isLeafNode(node) {
+  return (
+    node.constructor === ValueNode || node.constructor === HashCollisionNode
+  );
+}
+
+function mergeIntoNode(node, ownerID, shift, keyHash, entry) {
+  if (node.keyHash === keyHash) {
+    return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]);
+  }
+
+  var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK;
+  var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
+
+  var newNode;
+  var nodes =
+    idx1 === idx2
+      ? [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)]
+      : ((newNode = new ValueNode(ownerID, keyHash, entry)),
+        idx1 < idx2 ? [node, newNode] : [newNode, node]);
+
+  return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes);
+}
+
+function createNodes(ownerID, entries, key, value) {
+  if (!ownerID) {
+    ownerID = new OwnerID();
+  }
+  var node = new ValueNode(ownerID, hash(key), [key, value]);
+  for (var ii = 0; ii < entries.length; ii++) {
+    var entry = entries[ii];
+    node = node.update(ownerID, 0, undefined, entry[0], entry[1]);
+  }
+  return node;
+}
+
+function packNodes(ownerID, nodes, count, excluding) {
+  var bitmap = 0;
+  var packedII = 0;
+  var packedNodes = new Array(count);
+  for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) {
+    var node = nodes[ii];
+    if (node !== undefined && ii !== excluding) {
+      bitmap |= bit;
+      packedNodes[packedII++] = node;
+    }
+  }
+  return new BitmapIndexedNode(ownerID, bitmap, packedNodes);
+}
+
+function expandNodes(ownerID, nodes, bitmap, including, node) {
+  var count = 0;
+  var expandedNodes = new Array(SIZE);
+  for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) {
+    expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined;
+  }
+  expandedNodes[including] = node;
+  return new HashArrayMapNode(ownerID, count + 1, expandedNodes);
+}
+
+function popCount(x) {
+  x -= (x >> 1) & 0x55555555;
+  x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
+  x = (x + (x >> 4)) & 0x0f0f0f0f;
+  x += x >> 8;
+  x += x >> 16;
+  return x & 0x7f;
+}
+
+function setAt(array, idx, val, canEdit) {
+  var newArray = canEdit ? array : arrCopy(array);
+  newArray[idx] = val;
+  return newArray;
+}
+
+function spliceIn(array, idx, val, canEdit) {
+  var newLen = array.length + 1;
+  if (canEdit && idx + 1 === newLen) {
+    array[idx] = val;
+    return array;
+  }
+  var newArray = new Array(newLen);
+  var after = 0;
+  for (var ii = 0; ii < newLen; ii++) {
+    if (ii === idx) {
+      newArray[ii] = val;
+      after = -1;
+    } else {
+      newArray[ii] = array[ii + after];
+    }
+  }
+  return newArray;
+}
+
+function spliceOut(array, idx, canEdit) {
+  var newLen = array.length - 1;
+  if (canEdit && idx === newLen) {
+    array.pop();
+    return array;
+  }
+  var newArray = new Array(newLen);
+  var after = 0;
+  for (var ii = 0; ii < newLen; ii++) {
+    if (ii === idx) {
+      after = 1;
+    }
+    newArray[ii] = array[ii + after];
+  }
+  return newArray;
+}
+
+var MAX_ARRAY_MAP_SIZE = SIZE / 4;
+var MAX_BITMAP_INDEXED_SIZE = SIZE / 2;
+var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;
+
+var IS_LIST_SYMBOL = '@@__IMMUTABLE_LIST__@@';
+
+function isList(maybeList) {
+  return Boolean(maybeList && maybeList[IS_LIST_SYMBOL]);
+}
+
+var List = /*@__PURE__*/(function (IndexedCollection$$1) {
+  function List(value) {
+    var empty = emptyList();
+    if (value === null || value === undefined) {
+      return empty;
+    }
+    if (isList(value)) {
+      return value;
+    }
+    var iter = IndexedCollection$$1(value);
+    var size = iter.size;
+    if (size === 0) {
+      return empty;
+    }
+    assertNotInfinite(size);
+    if (size > 0 && size < SIZE) {
+      return makeList(0, size, SHIFT, null, new VNode(iter.toArray()));
+    }
+    return empty.withMutations(function (list) {
+      list.setSize(size);
+      iter.forEach(function (v, i) { return list.set(i, v); });
+    });
+  }
+
+  if ( IndexedCollection$$1 ) List.__proto__ = IndexedCollection$$1;
+  List.prototype = Object.create( IndexedCollection$$1 && IndexedCollection$$1.prototype );
+  List.prototype.constructor = List;
+
+  List.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  List.prototype.toString = function toString () {
+    return this.__toString('List [', ']');
+  };
+
+  // @pragma Access
+
+  List.prototype.get = function get (index, notSetValue) {
+    index = wrapIndex(this, index);
+    if (index >= 0 && index < this.size) {
+      index += this._origin;
+      var node = listNodeFor(this, index);
+      return node && node.array[index & MASK];
+    }
+    return notSetValue;
+  };
+
+  // @pragma Modification
+
+  List.prototype.set = function set (index, value) {
+    return updateList(this, index, value);
+  };
+
+  List.prototype.remove = function remove (index) {
+    return !this.has(index)
+      ? this
+      : index === 0
+        ? this.shift()
+        : index === this.size - 1
+          ? this.pop()
+          : this.splice(index, 1);
+  };
+
+  List.prototype.insert = function insert (index, value) {
+    return this.splice(index, 0, value);
+  };
+
+  List.prototype.clear = function clear () {
+    if (this.size === 0) {
+      return this;
+    }
+    if (this.__ownerID) {
+      this.size = this._origin = this._capacity = 0;
+      this._level = SHIFT;
+      this._root = this._tail = null;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return emptyList();
+  };
+
+  List.prototype.push = function push (/*...values*/) {
+    var values = arguments;
+    var oldSize = this.size;
+    return this.withMutations(function (list) {
+      setListBounds(list, 0, oldSize + values.length);
+      for (var ii = 0; ii < values.length; ii++) {
+        list.set(oldSize + ii, values[ii]);
+      }
+    });
+  };
+
+  List.prototype.pop = function pop () {
+    return setListBounds(this, 0, -1);
+  };
+
+  List.prototype.unshift = function unshift (/*...values*/) {
+    var values = arguments;
+    return this.withMutations(function (list) {
+      setListBounds(list, -values.length);
+      for (var ii = 0; ii < values.length; ii++) {
+        list.set(ii, values[ii]);
+      }
+    });
+  };
+
+  List.prototype.shift = function shift () {
+    return setListBounds(this, 1);
+  };
+
+  // @pragma Composition
+
+  List.prototype.concat = function concat (/*...collections*/) {
+    var arguments$1 = arguments;
+
+    var seqs = [];
+    for (var i = 0; i < arguments.length; i++) {
+      var argument = arguments$1[i];
+      var seq = IndexedCollection$$1(
+        typeof argument !== 'string' && hasIterator(argument)
+          ? argument
+          : [argument]
+      );
+      if (seq.size !== 0) {
+        seqs.push(seq);
+      }
+    }
+    if (seqs.length === 0) {
+      return this;
+    }
+    if (this.size === 0 && !this.__ownerID && seqs.length === 1) {
+      return this.constructor(seqs[0]);
+    }
+    return this.withMutations(function (list) {
+      seqs.forEach(function (seq) { return seq.forEach(function (value) { return list.push(value); }); });
+    });
+  };
+
+  List.prototype.setSize = function setSize (size) {
+    return setListBounds(this, 0, size);
+  };
+
+  List.prototype.map = function map (mapper, context) {
+    var this$1 = this;
+
+    return this.withMutations(function (list) {
+      for (var i = 0; i < this$1.size; i++) {
+        list.set(i, mapper.call(context, list.get(i), i, list));
+      }
+    });
+  };
+
+  // @pragma Iteration
+
+  List.prototype.slice = function slice (begin, end) {
+    var size = this.size;
+    if (wholeSlice(begin, end, size)) {
+      return this;
+    }
+    return setListBounds(
+      this,
+      resolveBegin(begin, size),
+      resolveEnd(end, size)
+    );
+  };
+
+  List.prototype.__iterator = function __iterator (type, reverse) {
+    var index = reverse ? this.size : 0;
+    var values = iterateList(this, reverse);
+    return new Iterator(function () {
+      var value = values();
+      return value === DONE
+        ? iteratorDone()
+        : iteratorValue(type, reverse ? --index : index++, value);
+    });
+  };
+
+  List.prototype.__iterate = function __iterate (fn, reverse) {
+    var index = reverse ? this.size : 0;
+    var values = iterateList(this, reverse);
+    var value;
+    while ((value = values()) !== DONE) {
+      if (fn(value, reverse ? --index : index++, this) === false) {
+        break;
+      }
+    }
+    return index;
+  };
+
+  List.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    if (!ownerID) {
+      if (this.size === 0) {
+        return emptyList();
+      }
+      this.__ownerID = ownerID;
+      this.__altered = false;
+      return this;
+    }
+    return makeList(
+      this._origin,
+      this._capacity,
+      this._level,
+      this._root,
+      this._tail,
+      ownerID,
+      this.__hash
+    );
+  };
+
+  return List;
+}(IndexedCollection));
+
+List.isList = isList;
+
+var ListPrototype = List.prototype;
+ListPrototype[IS_LIST_SYMBOL] = true;
+ListPrototype[DELETE] = ListPrototype.remove;
+ListPrototype.merge = ListPrototype.concat;
+ListPrototype.setIn = setIn$1;
+ListPrototype.deleteIn = ListPrototype.removeIn = deleteIn;
+ListPrototype.update = update$1;
+ListPrototype.updateIn = updateIn$1;
+ListPrototype.mergeIn = mergeIn;
+ListPrototype.mergeDeepIn = mergeDeepIn;
+ListPrototype.withMutations = withMutations;
+ListPrototype.wasAltered = wasAltered;
+ListPrototype.asImmutable = asImmutable;
+ListPrototype['@@transducer/init'] = ListPrototype.asMutable = asMutable;
+ListPrototype['@@transducer/step'] = function(result, arr) {
+  return result.push(arr);
+};
+ListPrototype['@@transducer/result'] = function(obj) {
+  return obj.asImmutable();
+};
+
+var VNode = function VNode(array, ownerID) {
+  this.array = array;
+  this.ownerID = ownerID;
+};
+
+// TODO: seems like these methods are very similar
+
+VNode.prototype.removeBefore = function removeBefore (ownerID, level, index) {
+  if (index === level ? 1 << level : this.array.length === 0) {
+    return this;
+  }
+  var originIndex = (index >>> level) & MASK;
+  if (originIndex >= this.array.length) {
+    return new VNode([], ownerID);
+  }
+  var removingFirst = originIndex === 0;
+  var newChild;
+  if (level > 0) {
+    var oldChild = this.array[originIndex];
+    newChild =
+      oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index);
+    if (newChild === oldChild && removingFirst) {
+      return this;
+    }
+  }
+  if (removingFirst && !newChild) {
+    return this;
+  }
+  var editable = editableVNode(this, ownerID);
+  if (!removingFirst) {
+    for (var ii = 0; ii < originIndex; ii++) {
+      editable.array[ii] = undefined;
+    }
+  }
+  if (newChild) {
+    editable.array[originIndex] = newChild;
+  }
+  return editable;
+};
+
+VNode.prototype.removeAfter = function removeAfter (ownerID, level, index) {
+  if (index === (level ? 1 << level : 0) || this.array.length === 0) {
+    return this;
+  }
+  var sizeIndex = ((index - 1) >>> level) & MASK;
+  if (sizeIndex >= this.array.length) {
+    return this;
+  }
+
+  var newChild;
+  if (level > 0) {
+    var oldChild = this.array[sizeIndex];
+    newChild =
+      oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index);
+    if (newChild === oldChild && sizeIndex === this.array.length - 1) {
+      return this;
+    }
+  }
+
+  var editable = editableVNode(this, ownerID);
+  editable.array.splice(sizeIndex + 1);
+  if (newChild) {
+    editable.array[sizeIndex] = newChild;
+  }
+  return editable;
+};
+
+var DONE = {};
+
+function iterateList(list, reverse) {
+  var left = list._origin;
+  var right = list._capacity;
+  var tailPos = getTailOffset(right);
+  var tail = list._tail;
+
+  return iterateNodeOrLeaf(list._root, list._level, 0);
+
+  function iterateNodeOrLeaf(node, level, offset) {
+    return level === 0
+      ? iterateLeaf(node, offset)
+      : iterateNode(node, level, offset);
+  }
+
+  function iterateLeaf(node, offset) {
+    var array = offset === tailPos ? tail && tail.array : node && node.array;
+    var from = offset > left ? 0 : left - offset;
+    var to = right - offset;
+    if (to > SIZE) {
+      to = SIZE;
+    }
+    return function () {
+      if (from === to) {
+        return DONE;
+      }
+      var idx = reverse ? --to : from++;
+      return array && array[idx];
+    };
+  }
+
+  function iterateNode(node, level, offset) {
+    var values;
+    var array = node && node.array;
+    var from = offset > left ? 0 : (left - offset) >> level;
+    var to = ((right - offset) >> level) + 1;
+    if (to > SIZE) {
+      to = SIZE;
+    }
+    return function () {
+      while (true) {
+        if (values) {
+          var value = values();
+          if (value !== DONE) {
+            return value;
+          }
+          values = null;
+        }
+        if (from === to) {
+          return DONE;
+        }
+        var idx = reverse ? --to : from++;
+        values = iterateNodeOrLeaf(
+          array && array[idx],
+          level - SHIFT,
+          offset + (idx << level)
+        );
+      }
+    };
+  }
+}
+
+function makeList(origin, capacity, level, root, tail, ownerID, hash) {
+  var list = Object.create(ListPrototype);
+  list.size = capacity - origin;
+  list._origin = origin;
+  list._capacity = capacity;
+  list._level = level;
+  list._root = root;
+  list._tail = tail;
+  list.__ownerID = ownerID;
+  list.__hash = hash;
+  list.__altered = false;
+  return list;
+}
+
+var EMPTY_LIST;
+function emptyList() {
+  return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT));
+}
+
+function updateList(list, index, value) {
+  index = wrapIndex(list, index);
+
+  if (index !== index) {
+    return list;
+  }
+
+  if (index >= list.size || index < 0) {
+    return list.withMutations(function (list) {
+      index < 0
+        ? setListBounds(list, index).set(0, value)
+        : setListBounds(list, 0, index + 1).set(index, value);
+    });
+  }
+
+  index += list._origin;
+
+  var newTail = list._tail;
+  var newRoot = list._root;
+  var didAlter = MakeRef();
+  if (index >= getTailOffset(list._capacity)) {
+    newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter);
+  } else {
+    newRoot = updateVNode(
+      newRoot,
+      list.__ownerID,
+      list._level,
+      index,
+      value,
+      didAlter
+    );
+  }
+
+  if (!didAlter.value) {
+    return list;
+  }
+
+  if (list.__ownerID) {
+    list._root = newRoot;
+    list._tail = newTail;
+    list.__hash = undefined;
+    list.__altered = true;
+    return list;
+  }
+  return makeList(list._origin, list._capacity, list._level, newRoot, newTail);
+}
+
+function updateVNode(node, ownerID, level, index, value, didAlter) {
+  var idx = (index >>> level) & MASK;
+  var nodeHas = node && idx < node.array.length;
+  if (!nodeHas && value === undefined) {
+    return node;
+  }
+
+  var newNode;
+
+  if (level > 0) {
+    var lowerNode = node && node.array[idx];
+    var newLowerNode = updateVNode(
+      lowerNode,
+      ownerID,
+      level - SHIFT,
+      index,
+      value,
+      didAlter
+    );
+    if (newLowerNode === lowerNode) {
+      return node;
+    }
+    newNode = editableVNode(node, ownerID);
+    newNode.array[idx] = newLowerNode;
+    return newNode;
+  }
+
+  if (nodeHas && node.array[idx] === value) {
+    return node;
+  }
+
+  if (didAlter) {
+    SetRef(didAlter);
+  }
+
+  newNode = editableVNode(node, ownerID);
+  if (value === undefined && idx === newNode.array.length - 1) {
+    newNode.array.pop();
+  } else {
+    newNode.array[idx] = value;
+  }
+  return newNode;
+}
+
+function editableVNode(node, ownerID) {
+  if (ownerID && node && ownerID === node.ownerID) {
+    return node;
+  }
+  return new VNode(node ? node.array.slice() : [], ownerID);
+}
+
+function listNodeFor(list, rawIndex) {
+  if (rawIndex >= getTailOffset(list._capacity)) {
+    return list._tail;
+  }
+  if (rawIndex < 1 << (list._level + SHIFT)) {
+    var node = list._root;
+    var level = list._level;
+    while (node && level > 0) {
+      node = node.array[(rawIndex >>> level) & MASK];
+      level -= SHIFT;
+    }
+    return node;
+  }
+}
+
+function setListBounds(list, begin, end) {
+  // Sanitize begin & end using this shorthand for ToInt32(argument)
+  // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32
+  if (begin !== undefined) {
+    begin |= 0;
+  }
+  if (end !== undefined) {
+    end |= 0;
+  }
+  var owner = list.__ownerID || new OwnerID();
+  var oldOrigin = list._origin;
+  var oldCapacity = list._capacity;
+  var newOrigin = oldOrigin + begin;
+  var newCapacity =
+    end === undefined
+      ? oldCapacity
+      : end < 0
+        ? oldCapacity + end
+        : oldOrigin + end;
+  if (newOrigin === oldOrigin && newCapacity === oldCapacity) {
+    return list;
+  }
+
+  // If it's going to end after it starts, it's empty.
+  if (newOrigin >= newCapacity) {
+    return list.clear();
+  }
+
+  var newLevel = list._level;
+  var newRoot = list._root;
+
+  // New origin might need creating a higher root.
+  var offsetShift = 0;
+  while (newOrigin + offsetShift < 0) {
+    newRoot = new VNode(
+      newRoot && newRoot.array.length ? [undefined, newRoot] : [],
+      owner
+    );
+    newLevel += SHIFT;
+    offsetShift += 1 << newLevel;
+  }
+  if (offsetShift) {
+    newOrigin += offsetShift;
+    oldOrigin += offsetShift;
+    newCapacity += offsetShift;
+    oldCapacity += offsetShift;
+  }
+
+  var oldTailOffset = getTailOffset(oldCapacity);
+  var newTailOffset = getTailOffset(newCapacity);
+
+  // New size might need creating a higher root.
+  while (newTailOffset >= 1 << (newLevel + SHIFT)) {
+    newRoot = new VNode(
+      newRoot && newRoot.array.length ? [newRoot] : [],
+      owner
+    );
+    newLevel += SHIFT;
+  }
+
+  // Locate or create the new tail.
+  var oldTail = list._tail;
+  var newTail =
+    newTailOffset < oldTailOffset
+      ? listNodeFor(list, newCapacity - 1)
+      : newTailOffset > oldTailOffset
+        ? new VNode([], owner)
+        : oldTail;
+
+  // Merge Tail into tree.
+  if (
+    oldTail &&
+    newTailOffset > oldTailOffset &&
+    newOrigin < oldCapacity &&
+    oldTail.array.length
+  ) {
+    newRoot = editableVNode(newRoot, owner);
+    var node = newRoot;
+    for (var level = newLevel; level > SHIFT; level -= SHIFT) {
+      var idx = (oldTailOffset >>> level) & MASK;
+      node = node.array[idx] = editableVNode(node.array[idx], owner);
+    }
+    node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail;
+  }
+
+  // If the size has been reduced, there's a chance the tail needs to be trimmed.
+  if (newCapacity < oldCapacity) {
+    newTail = newTail && newTail.removeAfter(owner, 0, newCapacity);
+  }
+
+  // If the new origin is within the tail, then we do not need a root.
+  if (newOrigin >= newTailOffset) {
+    newOrigin -= newTailOffset;
+    newCapacity -= newTailOffset;
+    newLevel = SHIFT;
+    newRoot = null;
+    newTail = newTail && newTail.removeBefore(owner, 0, newOrigin);
+
+    // Otherwise, if the root has been trimmed, garbage collect.
+  } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) {
+    offsetShift = 0;
+
+    // Identify the new top root node of the subtree of the old root.
+    while (newRoot) {
+      var beginIndex = (newOrigin >>> newLevel) & MASK;
+      if ((beginIndex !== newTailOffset >>> newLevel) & MASK) {
+        break;
+      }
+      if (beginIndex) {
+        offsetShift += (1 << newLevel) * beginIndex;
+      }
+      newLevel -= SHIFT;
+      newRoot = newRoot.array[beginIndex];
+    }
+
+    // Trim the new sides of the new root.
+    if (newRoot && newOrigin > oldOrigin) {
+      newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift);
+    }
+    if (newRoot && newTailOffset < oldTailOffset) {
+      newRoot = newRoot.removeAfter(
+        owner,
+        newLevel,
+        newTailOffset - offsetShift
+      );
+    }
+    if (offsetShift) {
+      newOrigin -= offsetShift;
+      newCapacity -= offsetShift;
+    }
+  }
+
+  if (list.__ownerID) {
+    list.size = newCapacity - newOrigin;
+    list._origin = newOrigin;
+    list._capacity = newCapacity;
+    list._level = newLevel;
+    list._root = newRoot;
+    list._tail = newTail;
+    list.__hash = undefined;
+    list.__altered = true;
+    return list;
+  }
+  return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail);
+}
+
+function getTailOffset(size) {
+  return size < SIZE ? 0 : ((size - 1) >>> SHIFT) << SHIFT;
+}
+
+var OrderedMap = /*@__PURE__*/(function (Map$$1) {
+  function OrderedMap(value) {
+    return value === null || value === undefined
+      ? emptyOrderedMap()
+      : isOrderedMap(value)
+        ? value
+        : emptyOrderedMap().withMutations(function (map) {
+            var iter = KeyedCollection(value);
+            assertNotInfinite(iter.size);
+            iter.forEach(function (v, k) { return map.set(k, v); });
+          });
+  }
+
+  if ( Map$$1 ) OrderedMap.__proto__ = Map$$1;
+  OrderedMap.prototype = Object.create( Map$$1 && Map$$1.prototype );
+  OrderedMap.prototype.constructor = OrderedMap;
+
+  OrderedMap.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  OrderedMap.prototype.toString = function toString () {
+    return this.__toString('OrderedMap {', '}');
+  };
+
+  // @pragma Access
+
+  OrderedMap.prototype.get = function get (k, notSetValue) {
+    var index = this._map.get(k);
+    return index !== undefined ? this._list.get(index)[1] : notSetValue;
+  };
+
+  // @pragma Modification
+
+  OrderedMap.prototype.clear = function clear () {
+    if (this.size === 0) {
+      return this;
+    }
+    if (this.__ownerID) {
+      this.size = 0;
+      this._map.clear();
+      this._list.clear();
+      return this;
+    }
+    return emptyOrderedMap();
+  };
+
+  OrderedMap.prototype.set = function set (k, v) {
+    return updateOrderedMap(this, k, v);
+  };
+
+  OrderedMap.prototype.remove = function remove (k) {
+    return updateOrderedMap(this, k, NOT_SET);
+  };
+
+  OrderedMap.prototype.wasAltered = function wasAltered () {
+    return this._map.wasAltered() || this._list.wasAltered();
+  };
+
+  OrderedMap.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._list.__iterate(
+      function (entry) { return entry && fn(entry[1], entry[0], this$1); },
+      reverse
+    );
+  };
+
+  OrderedMap.prototype.__iterator = function __iterator (type, reverse) {
+    return this._list.fromEntrySeq().__iterator(type, reverse);
+  };
+
+  OrderedMap.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    var newMap = this._map.__ensureOwner(ownerID);
+    var newList = this._list.__ensureOwner(ownerID);
+    if (!ownerID) {
+      if (this.size === 0) {
+        return emptyOrderedMap();
+      }
+      this.__ownerID = ownerID;
+      this._map = newMap;
+      this._list = newList;
+      return this;
+    }
+    return makeOrderedMap(newMap, newList, ownerID, this.__hash);
+  };
+
+  return OrderedMap;
+}(Map));
+
+OrderedMap.isOrderedMap = isOrderedMap;
+
+OrderedMap.prototype[IS_ORDERED_SYMBOL] = true;
+OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove;
+
+function makeOrderedMap(map, list, ownerID, hash) {
+  var omap = Object.create(OrderedMap.prototype);
+  omap.size = map ? map.size : 0;
+  omap._map = map;
+  omap._list = list;
+  omap.__ownerID = ownerID;
+  omap.__hash = hash;
+  return omap;
+}
+
+var EMPTY_ORDERED_MAP;
+function emptyOrderedMap() {
+  return (
+    EMPTY_ORDERED_MAP ||
+    (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList()))
+  );
+}
+
+function updateOrderedMap(omap, k, v) {
+  var map = omap._map;
+  var list = omap._list;
+  var i = map.get(k);
+  var has = i !== undefined;
+  var newMap;
+  var newList;
+  if (v === NOT_SET) {
+    // removed
+    if (!has) {
+      return omap;
+    }
+    if (list.size >= SIZE && list.size >= map.size * 2) {
+      newList = list.filter(function (entry, idx) { return entry !== undefined && i !== idx; });
+      newMap = newList
+        .toKeyedSeq()
+        .map(function (entry) { return entry[0]; })
+        .flip()
+        .toMap();
+      if (omap.__ownerID) {
+        newMap.__ownerID = newList.__ownerID = omap.__ownerID;
+      }
+    } else {
+      newMap = map.remove(k);
+      newList = i === list.size - 1 ? list.pop() : list.set(i, undefined);
+    }
+  } else if (has) {
+    if (v === list.get(i)[1]) {
+      return omap;
+    }
+    newMap = map;
+    newList = list.set(i, [k, v]);
+  } else {
+    newMap = map.set(k, list.size);
+    newList = list.set(list.size, [k, v]);
+  }
+  if (omap.__ownerID) {
+    omap.size = newMap.size;
+    omap._map = newMap;
+    omap._list = newList;
+    omap.__hash = undefined;
+    return omap;
+  }
+  return makeOrderedMap(newMap, newList);
+}
+
+var IS_STACK_SYMBOL = '@@__IMMUTABLE_STACK__@@';
+
+function isStack(maybeStack) {
+  return Boolean(maybeStack && maybeStack[IS_STACK_SYMBOL]);
+}
+
+var Stack = /*@__PURE__*/(function (IndexedCollection$$1) {
+  function Stack(value) {
+    return value === null || value === undefined
+      ? emptyStack()
+      : isStack(value)
+        ? value
+        : emptyStack().pushAll(value);
+  }
+
+  if ( IndexedCollection$$1 ) Stack.__proto__ = IndexedCollection$$1;
+  Stack.prototype = Object.create( IndexedCollection$$1 && IndexedCollection$$1.prototype );
+  Stack.prototype.constructor = Stack;
+
+  Stack.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  Stack.prototype.toString = function toString () {
+    return this.__toString('Stack [', ']');
+  };
+
+  // @pragma Access
+
+  Stack.prototype.get = function get (index, notSetValue) {
+    var head = this._head;
+    index = wrapIndex(this, index);
+    while (head && index--) {
+      head = head.next;
+    }
+    return head ? head.value : notSetValue;
+  };
+
+  Stack.prototype.peek = function peek () {
+    return this._head && this._head.value;
+  };
+
+  // @pragma Modification
+
+  Stack.prototype.push = function push (/*...values*/) {
+    var arguments$1 = arguments;
+
+    if (arguments.length === 0) {
+      return this;
+    }
+    var newSize = this.size + arguments.length;
+    var head = this._head;
+    for (var ii = arguments.length - 1; ii >= 0; ii--) {
+      head = {
+        value: arguments$1[ii],
+        next: head,
+      };
+    }
+    if (this.__ownerID) {
+      this.size = newSize;
+      this._head = head;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return makeStack(newSize, head);
+  };
+
+  Stack.prototype.pushAll = function pushAll (iter) {
+    iter = IndexedCollection$$1(iter);
+    if (iter.size === 0) {
+      return this;
+    }
+    if (this.size === 0 && isStack(iter)) {
+      return iter;
+    }
+    assertNotInfinite(iter.size);
+    var newSize = this.size;
+    var head = this._head;
+    iter.__iterate(function (value) {
+      newSize++;
+      head = {
+        value: value,
+        next: head,
+      };
+    }, /* reverse */ true);
+    if (this.__ownerID) {
+      this.size = newSize;
+      this._head = head;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return makeStack(newSize, head);
+  };
+
+  Stack.prototype.pop = function pop () {
+    return this.slice(1);
+  };
+
+  Stack.prototype.clear = function clear () {
+    if (this.size === 0) {
+      return this;
+    }
+    if (this.__ownerID) {
+      this.size = 0;
+      this._head = undefined;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return emptyStack();
+  };
+
+  Stack.prototype.slice = function slice (begin, end) {
+    if (wholeSlice(begin, end, this.size)) {
+      return this;
+    }
+    var resolvedBegin = resolveBegin(begin, this.size);
+    var resolvedEnd = resolveEnd(end, this.size);
+    if (resolvedEnd !== this.size) {
+      // super.slice(begin, end);
+      return IndexedCollection$$1.prototype.slice.call(this, begin, end);
+    }
+    var newSize = this.size - resolvedBegin;
+    var head = this._head;
+    while (resolvedBegin--) {
+      head = head.next;
+    }
+    if (this.__ownerID) {
+      this.size = newSize;
+      this._head = head;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return makeStack(newSize, head);
+  };
+
+  // @pragma Mutability
+
+  Stack.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    if (!ownerID) {
+      if (this.size === 0) {
+        return emptyStack();
+      }
+      this.__ownerID = ownerID;
+      this.__altered = false;
+      return this;
+    }
+    return makeStack(this.size, this._head, ownerID, this.__hash);
+  };
+
+  // @pragma Iteration
+
+  Stack.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return new ArraySeq(this.toArray()).__iterate(
+        function (v, k) { return fn(v, k, this$1); },
+        reverse
+      );
+    }
+    var iterations = 0;
+    var node = this._head;
+    while (node) {
+      if (fn(node.value, iterations++, this) === false) {
+        break;
+      }
+      node = node.next;
+    }
+    return iterations;
+  };
+
+  Stack.prototype.__iterator = function __iterator (type, reverse) {
+    if (reverse) {
+      return new ArraySeq(this.toArray()).__iterator(type, reverse);
+    }
+    var iterations = 0;
+    var node = this._head;
+    return new Iterator(function () {
+      if (node) {
+        var value = node.value;
+        node = node.next;
+        return iteratorValue(type, iterations++, value);
+      }
+      return iteratorDone();
+    });
+  };
+
+  return Stack;
+}(IndexedCollection));
+
+Stack.isStack = isStack;
+
+var StackPrototype = Stack.prototype;
+StackPrototype[IS_STACK_SYMBOL] = true;
+StackPrototype.shift = StackPrototype.pop;
+StackPrototype.unshift = StackPrototype.push;
+StackPrototype.unshiftAll = StackPrototype.pushAll;
+StackPrototype.withMutations = withMutations;
+StackPrototype.wasAltered = wasAltered;
+StackPrototype.asImmutable = asImmutable;
+StackPrototype['@@transducer/init'] = StackPrototype.asMutable = asMutable;
+StackPrototype['@@transducer/step'] = function(result, arr) {
+  return result.unshift(arr);
+};
+StackPrototype['@@transducer/result'] = function(obj) {
+  return obj.asImmutable();
+};
+
+function makeStack(size, head, ownerID, hash) {
+  var map = Object.create(StackPrototype);
+  map.size = size;
+  map._head = head;
+  map.__ownerID = ownerID;
+  map.__hash = hash;
+  map.__altered = false;
+  return map;
+}
+
+var EMPTY_STACK;
+function emptyStack() {
+  return EMPTY_STACK || (EMPTY_STACK = makeStack(0));
+}
+
+var IS_SET_SYMBOL = '@@__IMMUTABLE_SET__@@';
+
+function isSet(maybeSet) {
+  return Boolean(maybeSet && maybeSet[IS_SET_SYMBOL]);
+}
+
+function isOrderedSet(maybeOrderedSet) {
+  return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);
+}
+
+function deepEqual(a, b) {
+  if (a === b) {
+    return true;
+  }
+
+  if (
+    !isCollection(b) ||
+    (a.size !== undefined && b.size !== undefined && a.size !== b.size) ||
+    (a.__hash !== undefined &&
+      b.__hash !== undefined &&
+      a.__hash !== b.__hash) ||
+    isKeyed(a) !== isKeyed(b) ||
+    isIndexed(a) !== isIndexed(b) ||
+    isOrdered(a) !== isOrdered(b)
+  ) {
+    return false;
+  }
+
+  if (a.size === 0 && b.size === 0) {
+    return true;
+  }
+
+  var notAssociative = !isAssociative(a);
+
+  if (isOrdered(a)) {
+    var entries = a.entries();
+    return (
+      b.every(function (v, k) {
+        var entry = entries.next().value;
+        return entry && is(entry[1], v) && (notAssociative || is(entry[0], k));
+      }) && entries.next().done
+    );
+  }
+
+  var flipped = false;
+
+  if (a.size === undefined) {
+    if (b.size === undefined) {
+      if (typeof a.cacheResult === 'function') {
+        a.cacheResult();
+      }
+    } else {
+      flipped = true;
+      var _ = a;
+      a = b;
+      b = _;
+    }
+  }
+
+  var allEqual = true;
+  var bSize = b.__iterate(function (v, k) {
+    if (
+      notAssociative
+        ? !a.has(v)
+        : flipped
+          ? !is(v, a.get(k, NOT_SET))
+          : !is(a.get(k, NOT_SET), v)
+    ) {
+      allEqual = false;
+      return false;
+    }
+  });
+
+  return allEqual && a.size === bSize;
+}
+
+/**
+ * Contributes additional methods to a constructor
+ */
+function mixin(ctor, methods) {
+  var keyCopier = function (key) {
+    ctor.prototype[key] = methods[key];
+  };
+  Object.keys(methods).forEach(keyCopier);
+  Object.getOwnPropertySymbols &&
+    Object.getOwnPropertySymbols(methods).forEach(keyCopier);
+  return ctor;
+}
+
+function toJS(value) {
+  if (!value || typeof value !== 'object') {
+    return value;
+  }
+  if (!isCollection(value)) {
+    if (!isDataStructure(value)) {
+      return value;
+    }
+    value = Seq(value);
+  }
+  if (isKeyed(value)) {
+    var result$1 = {};
+    value.__iterate(function (v, k) {
+      result$1[k] = toJS(v);
+    });
+    return result$1;
+  }
+  var result = [];
+  value.__iterate(function (v) {
+    result.push(toJS(v));
+  });
+  return result;
+}
+
+var Set = /*@__PURE__*/(function (SetCollection$$1) {
+  function Set(value) {
+    return value === null || value === undefined
+      ? emptySet()
+      : isSet(value) && !isOrdered(value)
+        ? value
+        : emptySet().withMutations(function (set) {
+            var iter = SetCollection$$1(value);
+            assertNotInfinite(iter.size);
+            iter.forEach(function (v) { return set.add(v); });
+          });
+  }
+
+  if ( SetCollection$$1 ) Set.__proto__ = SetCollection$$1;
+  Set.prototype = Object.create( SetCollection$$1 && SetCollection$$1.prototype );
+  Set.prototype.constructor = Set;
+
+  Set.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  Set.fromKeys = function fromKeys (value) {
+    return this(KeyedCollection(value).keySeq());
+  };
+
+  Set.intersect = function intersect (sets) {
+    sets = Collection(sets).toArray();
+    return sets.length
+      ? SetPrototype.intersect.apply(Set(sets.pop()), sets)
+      : emptySet();
+  };
+
+  Set.union = function union (sets) {
+    sets = Collection(sets).toArray();
+    return sets.length
+      ? SetPrototype.union.apply(Set(sets.pop()), sets)
+      : emptySet();
+  };
+
+  Set.prototype.toString = function toString () {
+    return this.__toString('Set {', '}');
+  };
+
+  // @pragma Access
+
+  Set.prototype.has = function has (value) {
+    return this._map.has(value);
+  };
+
+  // @pragma Modification
+
+  Set.prototype.add = function add (value) {
+    return updateSet(this, this._map.set(value, value));
+  };
+
+  Set.prototype.remove = function remove (value) {
+    return updateSet(this, this._map.remove(value));
+  };
+
+  Set.prototype.clear = function clear () {
+    return updateSet(this, this._map.clear());
+  };
+
+  // @pragma Composition
+
+  Set.prototype.map = function map (mapper, context) {
+    var this$1 = this;
+
+    var removes = [];
+    var adds = [];
+    this.forEach(function (value) {
+      var mapped = mapper.call(context, value, value, this$1);
+      if (mapped !== value) {
+        removes.push(value);
+        adds.push(mapped);
+      }
+    });
+    return this.withMutations(function (set) {
+      removes.forEach(function (value) { return set.remove(value); });
+      adds.forEach(function (value) { return set.add(value); });
+    });
+  };
+
+  Set.prototype.union = function union () {
+    var iters = [], len = arguments.length;
+    while ( len-- ) iters[ len ] = arguments[ len ];
+
+    iters = iters.filter(function (x) { return x.size !== 0; });
+    if (iters.length === 0) {
+      return this;
+    }
+    if (this.size === 0 && !this.__ownerID && iters.length === 1) {
+      return this.constructor(iters[0]);
+    }
+    return this.withMutations(function (set) {
+      for (var ii = 0; ii < iters.length; ii++) {
+        SetCollection$$1(iters[ii]).forEach(function (value) { return set.add(value); });
+      }
+    });
+  };
+
+  Set.prototype.intersect = function intersect () {
+    var iters = [], len = arguments.length;
+    while ( len-- ) iters[ len ] = arguments[ len ];
+
+    if (iters.length === 0) {
+      return this;
+    }
+    iters = iters.map(function (iter) { return SetCollection$$1(iter); });
+    var toRemove = [];
+    this.forEach(function (value) {
+      if (!iters.every(function (iter) { return iter.includes(value); })) {
+        toRemove.push(value);
+      }
+    });
+    return this.withMutations(function (set) {
+      toRemove.forEach(function (value) {
+        set.remove(value);
+      });
+    });
+  };
+
+  Set.prototype.subtract = function subtract () {
+    var iters = [], len = arguments.length;
+    while ( len-- ) iters[ len ] = arguments[ len ];
+
+    if (iters.length === 0) {
+      return this;
+    }
+    iters = iters.map(function (iter) { return SetCollection$$1(iter); });
+    var toRemove = [];
+    this.forEach(function (value) {
+      if (iters.some(function (iter) { return iter.includes(value); })) {
+        toRemove.push(value);
+      }
+    });
+    return this.withMutations(function (set) {
+      toRemove.forEach(function (value) {
+        set.remove(value);
+      });
+    });
+  };
+
+  Set.prototype.sort = function sort (comparator) {
+    // Late binding
+    return OrderedSet(sortFactory(this, comparator));
+  };
+
+  Set.prototype.sortBy = function sortBy (mapper, comparator) {
+    // Late binding
+    return OrderedSet(sortFactory(this, comparator, mapper));
+  };
+
+  Set.prototype.wasAltered = function wasAltered () {
+    return this._map.wasAltered();
+  };
+
+  Set.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._map.__iterate(function (k) { return fn(k, k, this$1); }, reverse);
+  };
+
+  Set.prototype.__iterator = function __iterator (type, reverse) {
+    return this._map.__iterator(type, reverse);
+  };
+
+  Set.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    var newMap = this._map.__ensureOwner(ownerID);
+    if (!ownerID) {
+      if (this.size === 0) {
+        return this.__empty();
+      }
+      this.__ownerID = ownerID;
+      this._map = newMap;
+      return this;
+    }
+    return this.__make(newMap, ownerID);
+  };
+
+  return Set;
+}(SetCollection));
+
+Set.isSet = isSet;
+
+var SetPrototype = Set.prototype;
+SetPrototype[IS_SET_SYMBOL] = true;
+SetPrototype[DELETE] = SetPrototype.remove;
+SetPrototype.merge = SetPrototype.concat = SetPrototype.union;
+SetPrototype.withMutations = withMutations;
+SetPrototype.asImmutable = asImmutable;
+SetPrototype['@@transducer/init'] = SetPrototype.asMutable = asMutable;
+SetPrototype['@@transducer/step'] = function(result, arr) {
+  return result.add(arr);
+};
+SetPrototype['@@transducer/result'] = function(obj) {
+  return obj.asImmutable();
+};
+
+SetPrototype.__empty = emptySet;
+SetPrototype.__make = makeSet;
+
+function updateSet(set, newMap) {
+  if (set.__ownerID) {
+    set.size = newMap.size;
+    set._map = newMap;
+    return set;
+  }
+  return newMap === set._map
+    ? set
+    : newMap.size === 0
+      ? set.__empty()
+      : set.__make(newMap);
+}
+
+function makeSet(map, ownerID) {
+  var set = Object.create(SetPrototype);
+  set.size = map ? map.size : 0;
+  set._map = map;
+  set.__ownerID = ownerID;
+  return set;
+}
+
+var EMPTY_SET;
+function emptySet() {
+  return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap()));
+}
+
+/**
+ * Returns a lazy seq of nums from start (inclusive) to end
+ * (exclusive), by step, where start defaults to 0, step to 1, and end to
+ * infinity. When start is equal to end, returns empty list.
+ */
+var Range = /*@__PURE__*/(function (IndexedSeq$$1) {
+  function Range(start, end, step) {
+    if (!(this instanceof Range)) {
+      return new Range(start, end, step);
+    }
+    invariant(step !== 0, 'Cannot step a Range by 0');
+    start = start || 0;
+    if (end === undefined) {
+      end = Infinity;
+    }
+    step = step === undefined ? 1 : Math.abs(step);
+    if (end < start) {
+      step = -step;
+    }
+    this._start = start;
+    this._end = end;
+    this._step = step;
+    this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);
+    if (this.size === 0) {
+      if (EMPTY_RANGE) {
+        return EMPTY_RANGE;
+      }
+      EMPTY_RANGE = this;
+    }
+  }
+
+  if ( IndexedSeq$$1 ) Range.__proto__ = IndexedSeq$$1;
+  Range.prototype = Object.create( IndexedSeq$$1 && IndexedSeq$$1.prototype );
+  Range.prototype.constructor = Range;
+
+  Range.prototype.toString = function toString () {
+    if (this.size === 0) {
+      return 'Range []';
+    }
+    return (
+      'Range [ ' +
+      this._start +
+      '...' +
+      this._end +
+      (this._step !== 1 ? ' by ' + this._step : '') +
+      ' ]'
+    );
+  };
+
+  Range.prototype.get = function get (index, notSetValue) {
+    return this.has(index)
+      ? this._start + wrapIndex(this, index) * this._step
+      : notSetValue;
+  };
+
+  Range.prototype.includes = function includes (searchValue) {
+    var possibleIndex = (searchValue - this._start) / this._step;
+    return (
+      possibleIndex >= 0 &&
+      possibleIndex < this.size &&
+      possibleIndex === Math.floor(possibleIndex)
+    );
+  };
+
+  Range.prototype.slice = function slice (begin, end) {
+    if (wholeSlice(begin, end, this.size)) {
+      return this;
+    }
+    begin = resolveBegin(begin, this.size);
+    end = resolveEnd(end, this.size);
+    if (end <= begin) {
+      return new Range(0, 0);
+    }
+    return new Range(
+      this.get(begin, this._end),
+      this.get(end, this._end),
+      this._step
+    );
+  };
+
+  Range.prototype.indexOf = function indexOf (searchValue) {
+    var offsetValue = searchValue - this._start;
+    if (offsetValue % this._step === 0) {
+      var index = offsetValue / this._step;
+      if (index >= 0 && index < this.size) {
+        return index;
+      }
+    }
+    return -1;
+  };
+
+  Range.prototype.lastIndexOf = function lastIndexOf (searchValue) {
+    return this.indexOf(searchValue);
+  };
+
+  Range.prototype.__iterate = function __iterate (fn, reverse) {
+    var size = this.size;
+    var step = this._step;
+    var value = reverse ? this._start + (size - 1) * step : this._start;
+    var i = 0;
+    while (i !== size) {
+      if (fn(value, reverse ? size - ++i : i++, this) === false) {
+        break;
+      }
+      value += reverse ? -step : step;
+    }
+    return i;
+  };
+
+  Range.prototype.__iterator = function __iterator (type, reverse) {
+    var size = this.size;
+    var step = this._step;
+    var value = reverse ? this._start + (size - 1) * step : this._start;
+    var i = 0;
+    return new Iterator(function () {
+      if (i === size) {
+        return iteratorDone();
+      }
+      var v = value;
+      value += reverse ? -step : step;
+      return iteratorValue(type, reverse ? size - ++i : i++, v);
+    });
+  };
+
+  Range.prototype.equals = function equals (other) {
+    return other instanceof Range
+      ? this._start === other._start &&
+          this._end === other._end &&
+          this._step === other._step
+      : deepEqual(this, other);
+  };
+
+  return Range;
+}(IndexedSeq));
+
+var EMPTY_RANGE;
+
+function getIn(collection, searchKeyPath, notSetValue) {
+  var keyPath = coerceKeyPath(searchKeyPath);
+  var i = 0;
+  while (i !== keyPath.length) {
+    collection = get(collection, keyPath[i++], NOT_SET);
+    if (collection === NOT_SET) {
+      return notSetValue;
+    }
+  }
+  return collection;
+}
+
+function getIn$1(searchKeyPath, notSetValue) {
+  return getIn(this, searchKeyPath, notSetValue);
+}
+
+function hasIn(collection, keyPath) {
+  return getIn(collection, keyPath, NOT_SET) !== NOT_SET;
+}
+
+function hasIn$1(searchKeyPath) {
+  return hasIn(this, searchKeyPath);
+}
+
+function toObject() {
+  assertNotInfinite(this.size);
+  var object = {};
+  this.__iterate(function (v, k) {
+    object[k] = v;
+  });
+  return object;
+}
+
+// Note: all of these methods are deprecated.
+Collection.isIterable = isCollection;
+Collection.isKeyed = isKeyed;
+Collection.isIndexed = isIndexed;
+Collection.isAssociative = isAssociative;
+Collection.isOrdered = isOrdered;
+
+Collection.Iterator = Iterator;
+
+mixin(Collection, {
+  // ### Conversion to other types
+
+  toArray: function toArray() {
+    assertNotInfinite(this.size);
+    var array = new Array(this.size || 0);
+    var useTuples = isKeyed(this);
+    var i = 0;
+    this.__iterate(function (v, k) {
+      // Keyed collections produce an array of tuples.
+      array[i++] = useTuples ? [k, v] : v;
+    });
+    return array;
+  },
+
+  toIndexedSeq: function toIndexedSeq() {
+    return new ToIndexedSequence(this);
+  },
+
+  toJS: function toJS$1() {
+    return toJS(this);
+  },
+
+  toKeyedSeq: function toKeyedSeq() {
+    return new ToKeyedSequence(this, true);
+  },
+
+  toMap: function toMap() {
+    // Use Late Binding here to solve the circular dependency.
+    return Map(this.toKeyedSeq());
+  },
+
+  toObject: toObject,
+
+  toOrderedMap: function toOrderedMap() {
+    // Use Late Binding here to solve the circular dependency.
+    return OrderedMap(this.toKeyedSeq());
+  },
+
+  toOrderedSet: function toOrderedSet() {
+    // Use Late Binding here to solve the circular dependency.
+    return OrderedSet(isKeyed(this) ? this.valueSeq() : this);
+  },
+
+  toSet: function toSet() {
+    // Use Late Binding here to solve the circular dependency.
+    return Set(isKeyed(this) ? this.valueSeq() : this);
+  },
+
+  toSetSeq: function toSetSeq() {
+    return new ToSetSequence(this);
+  },
+
+  toSeq: function toSeq() {
+    return isIndexed(this)
+      ? this.toIndexedSeq()
+      : isKeyed(this)
+        ? this.toKeyedSeq()
+        : this.toSetSeq();
+  },
+
+  toStack: function toStack() {
+    // Use Late Binding here to solve the circular dependency.
+    return Stack(isKeyed(this) ? this.valueSeq() : this);
+  },
+
+  toList: function toList() {
+    // Use Late Binding here to solve the circular dependency.
+    return List(isKeyed(this) ? this.valueSeq() : this);
+  },
+
+  // ### Common JavaScript methods and properties
+
+  toString: function toString() {
+    return '[Collection]';
+  },
+
+  __toString: function __toString(head, tail) {
+    if (this.size === 0) {
+      return head + tail;
+    }
+    return (
+      head +
+      ' ' +
+      this.toSeq()
+        .map(this.__toStringMapper)
+        .join(', ') +
+      ' ' +
+      tail
+    );
+  },
+
+  // ### ES6 Collection methods (ES6 Array and Map)
+
+  concat: function concat() {
+    var values = [], len = arguments.length;
+    while ( len-- ) values[ len ] = arguments[ len ];
+
+    return reify(this, concatFactory(this, values));
+  },
+
+  includes: function includes(searchValue) {
+    return this.some(function (value) { return is(value, searchValue); });
+  },
+
+  entries: function entries() {
+    return this.__iterator(ITERATE_ENTRIES);
+  },
+
+  every: function every(predicate, context) {
+    assertNotInfinite(this.size);
+    var returnValue = true;
+    this.__iterate(function (v, k, c) {
+      if (!predicate.call(context, v, k, c)) {
+        returnValue = false;
+        return false;
+      }
+    });
+    return returnValue;
+  },
+
+  filter: function filter(predicate, context) {
+    return reify(this, filterFactory(this, predicate, context, true));
+  },
+
+  find: function find(predicate, context, notSetValue) {
+    var entry = this.findEntry(predicate, context);
+    return entry ? entry[1] : notSetValue;
+  },
+
+  forEach: function forEach(sideEffect, context) {
+    assertNotInfinite(this.size);
+    return this.__iterate(context ? sideEffect.bind(context) : sideEffect);
+  },
+
+  join: function join(separator) {
+    assertNotInfinite(this.size);
+    separator = separator !== undefined ? '' + separator : ',';
+    var joined = '';
+    var isFirst = true;
+    this.__iterate(function (v) {
+      isFirst ? (isFirst = false) : (joined += separator);
+      joined += v !== null && v !== undefined ? v.toString() : '';
+    });
+    return joined;
+  },
+
+  keys: function keys() {
+    return this.__iterator(ITERATE_KEYS);
+  },
+
+  map: function map(mapper, context) {
+    return reify(this, mapFactory(this, mapper, context));
+  },
+
+  reduce: function reduce$1(reducer, initialReduction, context) {
+    return reduce(
+      this,
+      reducer,
+      initialReduction,
+      context,
+      arguments.length < 2,
+      false
+    );
+  },
+
+  reduceRight: function reduceRight(reducer, initialReduction, context) {
+    return reduce(
+      this,
+      reducer,
+      initialReduction,
+      context,
+      arguments.length < 2,
+      true
+    );
+  },
+
+  reverse: function reverse() {
+    return reify(this, reverseFactory(this, true));
+  },
+
+  slice: function slice(begin, end) {
+    return reify(this, sliceFactory(this, begin, end, true));
+  },
+
+  some: function some(predicate, context) {
+    return !this.every(not(predicate), context);
+  },
+
+  sort: function sort(comparator) {
+    return reify(this, sortFactory(this, comparator));
+  },
+
+  values: function values() {
+    return this.__iterator(ITERATE_VALUES);
+  },
+
+  // ### More sequential methods
+
+  butLast: function butLast() {
+    return this.slice(0, -1);
+  },
+
+  isEmpty: function isEmpty() {
+    return this.size !== undefined ? this.size === 0 : !this.some(function () { return true; });
+  },
+
+  count: function count(predicate, context) {
+    return ensureSize(
+      predicate ? this.toSeq().filter(predicate, context) : this
+    );
+  },
+
+  countBy: function countBy(grouper, context) {
+    return countByFactory(this, grouper, context);
+  },
+
+  equals: function equals(other) {
+    return deepEqual(this, other);
+  },
+
+  entrySeq: function entrySeq() {
+    var collection = this;
+    if (collection._cache) {
+      // We cache as an entries array, so we can just return the cache!
+      return new ArraySeq(collection._cache);
+    }
+    var entriesSequence = collection
+      .toSeq()
+      .map(entryMapper)
+      .toIndexedSeq();
+    entriesSequence.fromEntrySeq = function () { return collection.toSeq(); };
+    return entriesSequence;
+  },
+
+  filterNot: function filterNot(predicate, context) {
+    return this.filter(not(predicate), context);
+  },
+
+  findEntry: function findEntry(predicate, context, notSetValue) {
+    var found = notSetValue;
+    this.__iterate(function (v, k, c) {
+      if (predicate.call(context, v, k, c)) {
+        found = [k, v];
+        return false;
+      }
+    });
+    return found;
+  },
+
+  findKey: function findKey(predicate, context) {
+    var entry = this.findEntry(predicate, context);
+    return entry && entry[0];
+  },
+
+  findLast: function findLast(predicate, context, notSetValue) {
+    return this.toKeyedSeq()
+      .reverse()
+      .find(predicate, context, notSetValue);
+  },
+
+  findLastEntry: function findLastEntry(predicate, context, notSetValue) {
+    return this.toKeyedSeq()
+      .reverse()
+      .findEntry(predicate, context, notSetValue);
+  },
+
+  findLastKey: function findLastKey(predicate, context) {
+    return this.toKeyedSeq()
+      .reverse()
+      .findKey(predicate, context);
+  },
+
+  first: function first(notSetValue) {
+    return this.find(returnTrue, null, notSetValue);
+  },
+
+  flatMap: function flatMap(mapper, context) {
+    return reify(this, flatMapFactory(this, mapper, context));
+  },
+
+  flatten: function flatten(depth) {
+    return reify(this, flattenFactory(this, depth, true));
+  },
+
+  fromEntrySeq: function fromEntrySeq() {
+    return new FromEntriesSequence(this);
+  },
+
+  get: function get(searchKey, notSetValue) {
+    return this.find(function (_, key) { return is(key, searchKey); }, undefined, notSetValue);
+  },
+
+  getIn: getIn$1,
+
+  groupBy: function groupBy(grouper, context) {
+    return groupByFactory(this, grouper, context);
+  },
+
+  has: function has(searchKey) {
+    return this.get(searchKey, NOT_SET) !== NOT_SET;
+  },
+
+  hasIn: hasIn$1,
+
+  isSubset: function isSubset(iter) {
+    iter = typeof iter.includes === 'function' ? iter : Collection(iter);
+    return this.every(function (value) { return iter.includes(value); });
+  },
+
+  isSuperset: function isSuperset(iter) {
+    iter = typeof iter.isSubset === 'function' ? iter : Collection(iter);
+    return iter.isSubset(this);
+  },
+
+  keyOf: function keyOf(searchValue) {
+    return this.findKey(function (value) { return is(value, searchValue); });
+  },
+
+  keySeq: function keySeq() {
+    return this.toSeq()
+      .map(keyMapper)
+      .toIndexedSeq();
+  },
+
+  last: function last(notSetValue) {
+    return this.toSeq()
+      .reverse()
+      .first(notSetValue);
+  },
+
+  lastKeyOf: function lastKeyOf(searchValue) {
+    return this.toKeyedSeq()
+      .reverse()
+      .keyOf(searchValue);
+  },
+
+  max: function max(comparator) {
+    return maxFactory(this, comparator);
+  },
+
+  maxBy: function maxBy(mapper, comparator) {
+    return maxFactory(this, comparator, mapper);
+  },
+
+  min: function min(comparator) {
+    return maxFactory(
+      this,
+      comparator ? neg(comparator) : defaultNegComparator
+    );
+  },
+
+  minBy: function minBy(mapper, comparator) {
+    return maxFactory(
+      this,
+      comparator ? neg(comparator) : defaultNegComparator,
+      mapper
+    );
+  },
+
+  rest: function rest() {
+    return this.slice(1);
+  },
+
+  skip: function skip(amount) {
+    return amount === 0 ? this : this.slice(Math.max(0, amount));
+  },
+
+  skipLast: function skipLast(amount) {
+    return amount === 0 ? this : this.slice(0, -Math.max(0, amount));
+  },
+
+  skipWhile: function skipWhile(predicate, context) {
+    return reify(this, skipWhileFactory(this, predicate, context, true));
+  },
+
+  skipUntil: function skipUntil(predicate, context) {
+    return this.skipWhile(not(predicate), context);
+  },
+
+  sortBy: function sortBy(mapper, comparator) {
+    return reify(this, sortFactory(this, comparator, mapper));
+  },
+
+  take: function take(amount) {
+    return this.slice(0, Math.max(0, amount));
+  },
+
+  takeLast: function takeLast(amount) {
+    return this.slice(-Math.max(0, amount));
+  },
+
+  takeWhile: function takeWhile(predicate, context) {
+    return reify(this, takeWhileFactory(this, predicate, context));
+  },
+
+  takeUntil: function takeUntil(predicate, context) {
+    return this.takeWhile(not(predicate), context);
+  },
+
+  update: function update(fn) {
+    return fn(this);
+  },
+
+  valueSeq: function valueSeq() {
+    return this.toIndexedSeq();
+  },
+
+  // ### Hashable Object
+
+  hashCode: function hashCode() {
+    return this.__hash || (this.__hash = hashCollection(this));
+  },
+
+  // ### Internal
+
+  // abstract __iterate(fn, reverse)
+
+  // abstract __iterator(type, reverse)
+});
+
+var CollectionPrototype = Collection.prototype;
+CollectionPrototype[IS_COLLECTION_SYMBOL] = true;
+CollectionPrototype[ITERATOR_SYMBOL] = CollectionPrototype.values;
+CollectionPrototype.toJSON = CollectionPrototype.toArray;
+CollectionPrototype.__toStringMapper = quoteString;
+CollectionPrototype.inspect = CollectionPrototype.toSource = function() {
+  return this.toString();
+};
+CollectionPrototype.chain = CollectionPrototype.flatMap;
+CollectionPrototype.contains = CollectionPrototype.includes;
+
+mixin(KeyedCollection, {
+  // ### More sequential methods
+
+  flip: function flip() {
+    return reify(this, flipFactory(this));
+  },
+
+  mapEntries: function mapEntries(mapper, context) {
+    var this$1 = this;
+
+    var iterations = 0;
+    return reify(
+      this,
+      this.toSeq()
+        .map(function (v, k) { return mapper.call(context, [k, v], iterations++, this$1); })
+        .fromEntrySeq()
+    );
+  },
+
+  mapKeys: function mapKeys(mapper, context) {
+    var this$1 = this;
+
+    return reify(
+      this,
+      this.toSeq()
+        .flip()
+        .map(function (k, v) { return mapper.call(context, k, v, this$1); })
+        .flip()
+    );
+  },
+});
+
+var KeyedCollectionPrototype = KeyedCollection.prototype;
+KeyedCollectionPrototype[IS_KEYED_SYMBOL] = true;
+KeyedCollectionPrototype[ITERATOR_SYMBOL] = CollectionPrototype.entries;
+KeyedCollectionPrototype.toJSON = toObject;
+KeyedCollectionPrototype.__toStringMapper = function (v, k) { return quoteString(k) + ': ' + quoteString(v); };
+
+mixin(IndexedCollection, {
+  // ### Conversion to other types
+
+  toKeyedSeq: function toKeyedSeq() {
+    return new ToKeyedSequence(this, false);
+  },
+
+  // ### ES6 Collection methods (ES6 Array and Map)
+
+  filter: function filter(predicate, context) {
+    return reify(this, filterFactory(this, predicate, context, false));
+  },
+
+  findIndex: function findIndex(predicate, context) {
+    var entry = this.findEntry(predicate, context);
+    return entry ? entry[0] : -1;
+  },
+
+  indexOf: function indexOf(searchValue) {
+    var key = this.keyOf(searchValue);
+    return key === undefined ? -1 : key;
+  },
+
+  lastIndexOf: function lastIndexOf(searchValue) {
+    var key = this.lastKeyOf(searchValue);
+    return key === undefined ? -1 : key;
+  },
+
+  reverse: function reverse() {
+    return reify(this, reverseFactory(this, false));
+  },
+
+  slice: function slice(begin, end) {
+    return reify(this, sliceFactory(this, begin, end, false));
+  },
+
+  splice: function splice(index, removeNum /*, ...values*/) {
+    var numArgs = arguments.length;
+    removeNum = Math.max(removeNum || 0, 0);
+    if (numArgs === 0 || (numArgs === 2 && !removeNum)) {
+      return this;
+    }
+    // If index is negative, it should resolve relative to the size of the
+    // collection. However size may be expensive to compute if not cached, so
+    // only call count() if the number is in fact negative.
+    index = resolveBegin(index, index < 0 ? this.count() : this.size);
+    var spliced = this.slice(0, index);
+    return reify(
+      this,
+      numArgs === 1
+        ? spliced
+        : spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum))
+    );
+  },
+
+  // ### More collection methods
+
+  findLastIndex: function findLastIndex(predicate, context) {
+    var entry = this.findLastEntry(predicate, context);
+    return entry ? entry[0] : -1;
+  },
+
+  first: function first(notSetValue) {
+    return this.get(0, notSetValue);
+  },
+
+  flatten: function flatten(depth) {
+    return reify(this, flattenFactory(this, depth, false));
+  },
+
+  get: function get(index, notSetValue) {
+    index = wrapIndex(this, index);
+    return index < 0 ||
+      (this.size === Infinity || (this.size !== undefined && index > this.size))
+      ? notSetValue
+      : this.find(function (_, key) { return key === index; }, undefined, notSetValue);
+  },
+
+  has: function has(index) {
+    index = wrapIndex(this, index);
+    return (
+      index >= 0 &&
+      (this.size !== undefined
+        ? this.size === Infinity || index < this.size
+        : this.indexOf(index) !== -1)
+    );
+  },
+
+  interpose: function interpose(separator) {
+    return reify(this, interposeFactory(this, separator));
+  },
+
+  interleave: function interleave(/*...collections*/) {
+    var collections = [this].concat(arrCopy(arguments));
+    var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, collections);
+    var interleaved = zipped.flatten(true);
+    if (zipped.size) {
+      interleaved.size = zipped.size * collections.length;
+    }
+    return reify(this, interleaved);
+  },
+
+  keySeq: function keySeq() {
+    return Range(0, this.size);
+  },
+
+  last: function last(notSetValue) {
+    return this.get(-1, notSetValue);
+  },
+
+  skipWhile: function skipWhile(predicate, context) {
+    return reify(this, skipWhileFactory(this, predicate, context, false));
+  },
+
+  zip: function zip(/*, ...collections */) {
+    var collections = [this].concat(arrCopy(arguments));
+    return reify(this, zipWithFactory(this, defaultZipper, collections));
+  },
+
+  zipAll: function zipAll(/*, ...collections */) {
+    var collections = [this].concat(arrCopy(arguments));
+    return reify(this, zipWithFactory(this, defaultZipper, collections, true));
+  },
+
+  zipWith: function zipWith(zipper /*, ...collections */) {
+    var collections = arrCopy(arguments);
+    collections[0] = this;
+    return reify(this, zipWithFactory(this, zipper, collections));
+  },
+});
+
+var IndexedCollectionPrototype = IndexedCollection.prototype;
+IndexedCollectionPrototype[IS_INDEXED_SYMBOL] = true;
+IndexedCollectionPrototype[IS_ORDERED_SYMBOL] = true;
+
+mixin(SetCollection, {
+  // ### ES6 Collection methods (ES6 Array and Map)
+
+  get: function get(value, notSetValue) {
+    return this.has(value) ? value : notSetValue;
+  },
+
+  includes: function includes(value) {
+    return this.has(value);
+  },
+
+  // ### More sequential methods
+
+  keySeq: function keySeq() {
+    return this.valueSeq();
+  },
+});
+
+SetCollection.prototype.has = CollectionPrototype.includes;
+SetCollection.prototype.contains = SetCollection.prototype.includes;
+
+// Mixin subclasses
+
+mixin(KeyedSeq, KeyedCollection.prototype);
+mixin(IndexedSeq, IndexedCollection.prototype);
+mixin(SetSeq, SetCollection.prototype);
+
+// #pragma Helper functions
+
+function reduce(collection, reducer, reduction, context, useFirst, reverse) {
+  assertNotInfinite(collection.size);
+  collection.__iterate(function (v, k, c) {
+    if (useFirst) {
+      useFirst = false;
+      reduction = v;
+    } else {
+      reduction = reducer.call(context, reduction, v, k, c);
+    }
+  }, reverse);
+  return reduction;
+}
+
+function keyMapper(v, k) {
+  return k;
+}
+
+function entryMapper(v, k) {
+  return [k, v];
+}
+
+function not(predicate) {
+  return function() {
+    return !predicate.apply(this, arguments);
+  };
+}
+
+function neg(predicate) {
+  return function() {
+    return -predicate.apply(this, arguments);
+  };
+}
+
+function defaultZipper() {
+  return arrCopy(arguments);
+}
+
+function defaultNegComparator(a, b) {
+  return a < b ? 1 : a > b ? -1 : 0;
+}
+
+function hashCollection(collection) {
+  if (collection.size === Infinity) {
+    return 0;
+  }
+  var ordered = isOrdered(collection);
+  var keyed = isKeyed(collection);
+  var h = ordered ? 1 : 0;
+  var size = collection.__iterate(
+    keyed
+      ? ordered
+        ? function (v, k) {
+            h = (31 * h + hashMerge(hash(v), hash(k))) | 0;
+          }
+        : function (v, k) {
+            h = (h + hashMerge(hash(v), hash(k))) | 0;
+          }
+      : ordered
+        ? function (v) {
+            h = (31 * h + hash(v)) | 0;
+          }
+        : function (v) {
+            h = (h + hash(v)) | 0;
+          }
+  );
+  return murmurHashOfSize(size, h);
+}
+
+function murmurHashOfSize(size, h) {
+  h = imul(h, 0xcc9e2d51);
+  h = imul((h << 15) | (h >>> -15), 0x1b873593);
+  h = imul((h << 13) | (h >>> -13), 5);
+  h = ((h + 0xe6546b64) | 0) ^ size;
+  h = imul(h ^ (h >>> 16), 0x85ebca6b);
+  h = imul(h ^ (h >>> 13), 0xc2b2ae35);
+  h = smi(h ^ (h >>> 16));
+  return h;
+}
+
+function hashMerge(a, b) {
+  return (a ^ (b + 0x9e3779b9 + (a << 6) + (a >> 2))) | 0; // int
+}
+
+var OrderedSet = /*@__PURE__*/(function (Set$$1) {
+  function OrderedSet(value) {
+    return value === null || value === undefined
+      ? emptyOrderedSet()
+      : isOrderedSet(value)
+        ? value
+        : emptyOrderedSet().withMutations(function (set) {
+            var iter = SetCollection(value);
+            assertNotInfinite(iter.size);
+            iter.forEach(function (v) { return set.add(v); });
+          });
+  }
+
+  if ( Set$$1 ) OrderedSet.__proto__ = Set$$1;
+  OrderedSet.prototype = Object.create( Set$$1 && Set$$1.prototype );
+  OrderedSet.prototype.constructor = OrderedSet;
+
+  OrderedSet.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  OrderedSet.fromKeys = function fromKeys (value) {
+    return this(KeyedCollection(value).keySeq());
+  };
+
+  OrderedSet.prototype.toString = function toString () {
+    return this.__toString('OrderedSet {', '}');
+  };
+
+  return OrderedSet;
+}(Set));
+
+OrderedSet.isOrderedSet = isOrderedSet;
+
+var OrderedSetPrototype = OrderedSet.prototype;
+OrderedSetPrototype[IS_ORDERED_SYMBOL] = true;
+OrderedSetPrototype.zip = IndexedCollectionPrototype.zip;
+OrderedSetPrototype.zipWith = IndexedCollectionPrototype.zipWith;
+
+OrderedSetPrototype.__empty = emptyOrderedSet;
+OrderedSetPrototype.__make = makeOrderedSet;
+
+function makeOrderedSet(map, ownerID) {
+  var set = Object.create(OrderedSetPrototype);
+  set.size = map ? map.size : 0;
+  set._map = map;
+  set.__ownerID = ownerID;
+  return set;
+}
+
+var EMPTY_ORDERED_SET;
+function emptyOrderedSet() {
+  return (
+    EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap()))
+  );
+}
+
+var Record = function Record(defaultValues, name) {
+  var hasInitialized;
+
+  var RecordType = function Record(values) {
+    var this$1 = this;
+
+    if (values instanceof RecordType) {
+      return values;
+    }
+    if (!(this instanceof RecordType)) {
+      return new RecordType(values);
+    }
+    if (!hasInitialized) {
+      hasInitialized = true;
+      var keys = Object.keys(defaultValues);
+      var indices = (RecordTypePrototype._indices = {});
+      // Deprecated: left to attempt not to break any external code which
+      // relies on a ._name property existing on record instances.
+      // Use Record.getDescriptiveName() instead
+      RecordTypePrototype._name = name;
+      RecordTypePrototype._keys = keys;
+      RecordTypePrototype._defaultValues = defaultValues;
+      for (var i = 0; i < keys.length; i++) {
+        var propName = keys[i];
+        indices[propName] = i;
+        if (RecordTypePrototype[propName]) {
+          /* eslint-disable no-console */
+          typeof console === 'object' &&
+            console.warn &&
+            console.warn(
+              'Cannot define ' +
+                recordName(this) +
+                ' with property "' +
+                propName +
+                '" since that property name is part of the Record API.'
+            );
+          /* eslint-enable no-console */
+        } else {
+          setProp(RecordTypePrototype, propName);
+        }
+      }
+    }
+    this.__ownerID = undefined;
+    this._values = List().withMutations(function (l) {
+      l.setSize(this$1._keys.length);
+      KeyedCollection(values).forEach(function (v, k) {
+        l.set(this$1._indices[k], v === this$1._defaultValues[k] ? undefined : v);
+      });
+    });
+  };
+
+  var RecordTypePrototype = (RecordType.prototype = Object.create(
+    RecordPrototype
+  ));
+  RecordTypePrototype.constructor = RecordType;
+
+  if (name) {
+    RecordType.displayName = name;
+  }
+
+  return RecordType;
+};
+
+Record.prototype.toString = function toString () {
+  var str = recordName(this) + ' { ';
+  var keys = this._keys;
+  var k;
+  for (var i = 0, l = keys.length; i !== l; i++) {
+    k = keys[i];
+    str += (i ? ', ' : '') + k + ': ' + quoteString(this.get(k));
+  }
+  return str + ' }';
+};
+
+Record.prototype.equals = function equals (other) {
+  return (
+    this === other ||
+    (other &&
+      this._keys === other._keys &&
+      recordSeq(this).equals(recordSeq(other)))
+  );
+};
+
+Record.prototype.hashCode = function hashCode () {
+  return recordSeq(this).hashCode();
+};
+
+// @pragma Access
+
+Record.prototype.has = function has (k) {
+  return this._indices.hasOwnProperty(k);
+};
+
+Record.prototype.get = function get (k, notSetValue) {
+  if (!this.has(k)) {
+    return notSetValue;
+  }
+  var index = this._indices[k];
+  var value = this._values.get(index);
+  return value === undefined ? this._defaultValues[k] : value;
+};
+
+// @pragma Modification
+
+Record.prototype.set = function set (k, v) {
+  if (this.has(k)) {
+    var newValues = this._values.set(
+      this._indices[k],
+      v === this._defaultValues[k] ? undefined : v
+    );
+    if (newValues !== this._values && !this.__ownerID) {
+      return makeRecord(this, newValues);
+    }
+  }
+  return this;
+};
+
+Record.prototype.remove = function remove (k) {
+  return this.set(k);
+};
+
+Record.prototype.clear = function clear () {
+  var newValues = this._values.clear().setSize(this._keys.length);
+  return this.__ownerID ? this : makeRecord(this, newValues);
+};
+
+Record.prototype.wasAltered = function wasAltered () {
+  return this._values.wasAltered();
+};
+
+Record.prototype.toSeq = function toSeq () {
+  return recordSeq(this);
+};
+
+Record.prototype.toJS = function toJS$1 () {
+  return toJS(this);
+};
+
+Record.prototype.entries = function entries () {
+  return this.__iterator(ITERATE_ENTRIES);
+};
+
+Record.prototype.__iterator = function __iterator (type, reverse) {
+  return recordSeq(this).__iterator(type, reverse);
+};
+
+Record.prototype.__iterate = function __iterate (fn, reverse) {
+  return recordSeq(this).__iterate(fn, reverse);
+};
+
+Record.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+  if (ownerID === this.__ownerID) {
+    return this;
+  }
+  var newValues = this._values.__ensureOwner(ownerID);
+  if (!ownerID) {
+    this.__ownerID = ownerID;
+    this._values = newValues;
+    return this;
+  }
+  return makeRecord(this, newValues, ownerID);
+};
+
+Record.isRecord = isRecord;
+Record.getDescriptiveName = recordName;
+var RecordPrototype = Record.prototype;
+RecordPrototype[IS_RECORD_SYMBOL] = true;
+RecordPrototype[DELETE] = RecordPrototype.remove;
+RecordPrototype.deleteIn = RecordPrototype.removeIn = deleteIn;
+RecordPrototype.getIn = getIn$1;
+RecordPrototype.hasIn = CollectionPrototype.hasIn;
+RecordPrototype.merge = merge;
+RecordPrototype.mergeWith = mergeWith;
+RecordPrototype.mergeIn = mergeIn;
+RecordPrototype.mergeDeep = mergeDeep$1;
+RecordPrototype.mergeDeepWith = mergeDeepWith$1;
+RecordPrototype.mergeDeepIn = mergeDeepIn;
+RecordPrototype.setIn = setIn$1;
+RecordPrototype.update = update$1;
+RecordPrototype.updateIn = updateIn$1;
+RecordPrototype.withMutations = withMutations;
+RecordPrototype.asMutable = asMutable;
+RecordPrototype.asImmutable = asImmutable;
+RecordPrototype[ITERATOR_SYMBOL] = RecordPrototype.entries;
+RecordPrototype.toJSON = RecordPrototype.toObject =
+  CollectionPrototype.toObject;
+RecordPrototype.inspect = RecordPrototype.toSource = function() {
+  return this.toString();
+};
+
+function makeRecord(likeRecord, values, ownerID) {
+  var record = Object.create(Object.getPrototypeOf(likeRecord));
+  record._values = values;
+  record.__ownerID = ownerID;
+  return record;
+}
+
+function recordName(record) {
+  return record.constructor.displayName || record.constructor.name || 'Record';
+}
+
+function recordSeq(record) {
+  return keyedSeqFromValue(record._keys.map(function (k) { return [k, record.get(k)]; }));
+}
+
+function setProp(prototype, name) {
+  try {
+    Object.defineProperty(prototype, name, {
+      get: function() {
+        return this.get(name);
+      },
+      set: function(value) {
+        invariant(this.__ownerID, 'Cannot set on an immutable record.');
+        this.set(name, value);
+      },
+    });
+  } catch (error) {
+    // Object.defineProperty failed. Probably IE8.
+  }
+}
+
+/**
+ * Returns a lazy Seq of `value` repeated `times` times. When `times` is
+ * undefined, returns an infinite sequence of `value`.
+ */
+var Repeat = /*@__PURE__*/(function (IndexedSeq$$1) {
+  function Repeat(value, times) {
+    if (!(this instanceof Repeat)) {
+      return new Repeat(value, times);
+    }
+    this._value = value;
+    this.size = times === undefined ? Infinity : Math.max(0, times);
+    if (this.size === 0) {
+      if (EMPTY_REPEAT) {
+        return EMPTY_REPEAT;
+      }
+      EMPTY_REPEAT = this;
+    }
+  }
+
+  if ( IndexedSeq$$1 ) Repeat.__proto__ = IndexedSeq$$1;
+  Repeat.prototype = Object.create( IndexedSeq$$1 && IndexedSeq$$1.prototype );
+  Repeat.prototype.constructor = Repeat;
+
+  Repeat.prototype.toString = function toString () {
+    if (this.size === 0) {
+      return 'Repeat []';
+    }
+    return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]';
+  };
+
+  Repeat.prototype.get = function get (index, notSetValue) {
+    return this.has(index) ? this._value : notSetValue;
+  };
+
+  Repeat.prototype.includes = function includes (searchValue) {
+    return is(this._value, searchValue);
+  };
+
+  Repeat.prototype.slice = function slice (begin, end) {
+    var size = this.size;
+    return wholeSlice(begin, end, size)
+      ? this
+      : new Repeat(
+          this._value,
+          resolveEnd(end, size) - resolveBegin(begin, size)
+        );
+  };
+
+  Repeat.prototype.reverse = function reverse () {
+    return this;
+  };
+
+  Repeat.prototype.indexOf = function indexOf (searchValue) {
+    if (is(this._value, searchValue)) {
+      return 0;
+    }
+    return -1;
+  };
+
+  Repeat.prototype.lastIndexOf = function lastIndexOf (searchValue) {
+    if (is(this._value, searchValue)) {
+      return this.size;
+    }
+    return -1;
+  };
+
+  Repeat.prototype.__iterate = function __iterate (fn, reverse) {
+    var size = this.size;
+    var i = 0;
+    while (i !== size) {
+      if (fn(this._value, reverse ? size - ++i : i++, this) === false) {
+        break;
+      }
+    }
+    return i;
+  };
+
+  Repeat.prototype.__iterator = function __iterator (type, reverse) {
+    var this$1 = this;
+
+    var size = this.size;
+    var i = 0;
+    return new Iterator(
+      function () { return i === size
+          ? iteratorDone()
+          : iteratorValue(type, reverse ? size - ++i : i++, this$1._value); }
+    );
+  };
+
+  Repeat.prototype.equals = function equals (other) {
+    return other instanceof Repeat
+      ? is(this._value, other._value)
+      : deepEqual(other);
+  };
+
+  return Repeat;
+}(IndexedSeq));
+
+var EMPTY_REPEAT;
+
+function fromJS(value, converter) {
+  return fromJSWith(
+    [],
+    converter || defaultConverter,
+    value,
+    '',
+    converter && converter.length > 2 ? [] : undefined,
+    { '': value }
+  );
+}
+
+function fromJSWith(stack, converter, value, key, keyPath, parentValue) {
+  var toSeq = Array.isArray(value)
+    ? IndexedSeq
+    : isPlainObj(value)
+      ? KeyedSeq
+      : null;
+  if (toSeq) {
+    if (~stack.indexOf(value)) {
+      throw new TypeError('Cannot convert circular structure to Immutable');
+    }
+    stack.push(value);
+    keyPath && key !== '' && keyPath.push(key);
+    var converted = converter.call(
+      parentValue,
+      key,
+      toSeq(value).map(function (v, k) { return fromJSWith(stack, converter, v, k, keyPath, value); }
+      ),
+      keyPath && keyPath.slice()
+    );
+    stack.pop();
+    keyPath && keyPath.pop();
+    return converted;
+  }
+  return value;
+}
+
+function defaultConverter(k, v) {
+  return isKeyed(v) ? v.toMap() : v.toList();
+}
+
+var version = "4.0.0-rc.11";
+
+var Immutable = {
+  version: version,
+
+  Collection: Collection,
+  // Note: Iterable is deprecated
+  Iterable: Collection,
+
+  Seq: Seq,
+  Map: Map,
+  OrderedMap: OrderedMap,
+  List: List,
+  Stack: Stack,
+  Set: Set,
+  OrderedSet: OrderedSet,
+
+  Record: Record,
+  Range: Range,
+  Repeat: Repeat,
+
+  is: is,
+  fromJS: fromJS,
+  hash: hash,
+
+  isImmutable: isImmutable,
+  isCollection: isCollection,
+  isKeyed: isKeyed,
+  isIndexed: isIndexed,
+  isAssociative: isAssociative,
+  isOrdered: isOrdered,
+  isValueObject: isValueObject,
+  isSeq: isSeq,
+  isList: isList,
+  isMap: isMap,
+  isOrderedMap: isOrderedMap,
+  isStack: isStack,
+  isSet: isSet,
+  isOrderedSet: isOrderedSet,
+  isRecord: isRecord,
+
+  get: get,
+  getIn: getIn,
+  has: has,
+  hasIn: hasIn,
+  merge: merge$1,
+  mergeDeep: mergeDeep,
+  mergeWith: mergeWith$1,
+  mergeDeepWith: mergeDeepWith,
+  remove: remove,
+  removeIn: removeIn,
+  set: set,
+  setIn: setIn,
+  update: update,
+  updateIn: updateIn,
+};
+
+// Note: Iterable is deprecated
+var Iterable = Collection;
+
+export default Immutable;
+export { version, Collection, Iterable, Seq, Map, OrderedMap, List, Stack, Set, OrderedSet, Record, Range, Repeat, is, fromJS, hash, isImmutable, isCollection, isKeyed, isIndexed, isAssociative, isOrdered, isValueObject, get, getIn, has, hasIn, merge$1 as merge, mergeDeep, mergeWith$1 as mergeWith, mergeDeepWith, remove, removeIn, set, setIn, update, updateIn };
diff --git a/B2Program/LandingGear/GearsDoors/physical.svg b/B2Program/LandingGear/GearsDoors/physical.svg
new file mode 100644
index 0000000000000000000000000000000000000000..6b9a224c00c47cd67d52084428ed6287e5f958ac
--- /dev/null
+++ b/B2Program/LandingGear/GearsDoors/physical.svg
@@ -0,0 +1,17 @@
+<svg width="947" height="728" xmlns="http://www.w3.org/2000/svg" id="landinggear" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <metadata id="metadata3467">image/svg+xml</metadata>
+
+ <g>
+  <title>background</title>
+  <rect x="-1" y="-1" width="949" height="730" id="canvas_background" fill="none"/>
+ </g>
+ <g>
+  <title>Layer 1</title>
+  <image xlink:href="img/door_closed.png" id="door_fr" x="0" y="0" width="200" height="200"/>
+  <image xlink:href="img/door_closed.png" id="door_lt" x="210" y="0" width="200" height="200"/>
+  <image xlink:href="img/door_closed.png" id="door_rt" x="420" y="0" width="200" height="200"/>
+  <image xlink:href="img/gear_extended.png" id="gear_fr" x="0" y="210" width="200" height="200"/>
+  <image xlink:href="img/gear_extended.png" id="gear_lt" x="210" y="210" width="200" height="200"/>
+  <image xlink:href="img/gear_extended.png" id="gear_rt" x="420" y="210" width="200" height="200"/>
+ </g>
+</svg>
diff --git a/B2Program/LandingGear/HydraulicCircuit/LandingGear.json b/B2Program/LandingGear/HydraulicCircuit/LandingGear.json
new file mode 100644
index 0000000000000000000000000000000000000000..8c0b59aac10a4ec69b5f448173983efe52d84b70
--- /dev/null
+++ b/B2Program/LandingGear/HydraulicCircuit/LandingGear.json
@@ -0,0 +1,228 @@
+{
+  "svg":"architecture.svg",
+  "items":[
+	  {
+		  "repeat": ["1", "2", "3"],
+		  "id":"eo_general_%0",
+		  "attr":"stroke",
+		  "value":"IF general_EV = TRUE THEN \"green\" ELSE \"red\" END"
+	  },
+	  {
+		  "repeat": ["1", "2"],
+		  "id":"eo_open_doors_%0",
+		  "attr":"stroke",
+		  "value":"IF open_EV = TRUE THEN \"green\" ELSE \"red\" END"
+	  },
+	  {
+		  "repeat": ["1", "2"],
+		  "id":"eo_close_doors_%0",
+		  "attr":"stroke",
+		  "value":"IF close_EV = TRUE THEN \"green\" ELSE \"red\" END"
+	  },
+	  {
+		  "repeat": ["1", "2"],
+		  "id":"eo_retract_gears_%0",
+		  "attr":"stroke",
+		  "value":"IF retract_EV = TRUE THEN \"green\" ELSE \"red\" END"
+	  },
+	  {
+		  "repeat": ["1", "2"],
+		  "id":"eo_extend_gears_%0",
+		  "attr":"stroke",
+		  "value":"IF extend_EV = TRUE THEN \"green\" ELSE \"red\" END"
+	  },
+	  {
+		  "for": {"from": "1", "to": "6"},
+		  "id":"hydraulic_circuit_%0",
+		  "attr":"stroke-width",
+		  "value":"IF general_valve = valve_open THEN 2 ELSE 1 END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3", "4", "5", "6"],
+		  "id":"hydraulic_circuit_%0",
+		  "attr":"stroke",
+		  "value":"IF general_valve = valve_open THEN \"#88d2f7\" ELSE \"#cccccc\" END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3", "4"],
+		  "id":"extension_circuit_doors_%0",
+		  "attr":"stroke-width",
+		  "value":"IF valve_open_door = valve_open THEN 2 ELSE 1 END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3", "4"],
+		  "id":"extension_circuit_doors_%0",
+		  "attr":"stroke",
+		  "value":"IF valve_open_door = valve_open THEN \"#88d2f7\" ELSE \"#cccccc\" END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3", "4"],
+		  "id":"retraction_circuit_doors_%0",
+		  "attr":"stroke-width",
+		  "value":"IF valve_close_door = valve_open THEN 2 ELSE 1 END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3", "4"],
+		  "id":"retraction_circuit_doors_%0",
+		  "attr":"stroke",
+		  "value":"IF valve_close_door = valve_open THEN \"#88d2f7\" ELSE \"#cccccc\" END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3", "4"],
+		  "id":"extension_circuit_gears_%0",
+		  "attr":"stroke-width",
+		  "value":"IF valve_extend_gear = valve_open THEN 2 ELSE 1 END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3", "4"],
+		  "id":"extension_circuit_gears_%0",
+		  "attr":"stroke",
+		  "value":"IF valve_extend_gear = valve_open THEN \"#88d2f7\" ELSE \"#cccccc\" END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3", "4"],
+		  "id":"retraction_circuit_gears_%0",
+		  "attr":"stroke-width",
+		  "value":"IF valve_retract_gear = valve_open THEN 2 ELSE 1 END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3", "4"],
+		  "id":"retraction_circuit_gears_%0",
+		  "attr":"stroke",
+		  "value":"IF valve_retract_gear = valve_open THEN \"#88d2f7\" ELSE \"#cccccc\" END"
+	  },
+	  
+	  {
+		  "id":"door_cylinder_forcer",
+		  "attr":"transform",
+		  "value":"{closed |-> \"translate(0,0)\", open |-> \"translate(90,0)\", door_moving |-> \"translate(45,0)\"}(door)"
+	  },
+	  {
+		  "id":"gear_cylinder_forcer",
+		  "attr":"transform",
+		  "value":"{extended |-> \"translate(0,0)\", retracted |-> \"translate(90,0)\", gear_moving |-> \"translate(45,0)\"}(gear)"
+	  },
+	  {
+		  "repeat": ["fr","lt", "rt"],
+		  "id":"%0_door_cylinder_forcer",
+		  "attr":"transform",
+		  "value":"{closed |-> \"translate(0,0)\", open |-> \"translate(90,0)\", door_moving |-> \"translate(45,0)\"}(doors(%0))"
+	  },
+	  {
+		  "repeat": ["fr","lt", "rt"],
+		  "id":"%0_gear_cylinder_forcer",
+		  "attr":"transform",
+		  "value":"{extended |-> \"translate(0,0)\", retracted |-> \"translate(90,0)\", gear_moving |-> \"translate(45,0)\"}(gears(%0))"
+	  },
+	  {
+		  "repeat": ["fr", "lt", "rt"],
+		  "id":"%0_door_cylinder_l",
+		  "attr":"fill",
+		  "value":"{closed |-> \"#cccccc\", open |-> \"#88d2f7\", door_moving |-> \"#88d2f7\"}(doors(%0))"
+	  },
+	  {
+		  "repeat": ["fr", "lt", "rt"],
+		  "id":"%0_door_cylinder_r",
+		  "attr":"fill",
+		  "value":"{closed |-> \"#cccccc\", open |-> \"#88d2f7\", door_moving |-> \"#cccccc\"}(doors(%0))"
+	  },
+	  {
+		  "repeat": ["fr","lt", "rt"],
+		  "id":"%0_gear_cylinder_l",
+		  "attr":"fill",
+		  "value":"{extended |-> \"#cccccc\", retracted |-> \"#88d2f7\", gear_moving |-> \"#88d2f7\"}(gears(%0))"
+	  },
+	  {
+		  "repeat": ["fr","lt", "rt"],
+		  "id":"%0_gear_cylinder_r",
+		  "attr":"fill",
+		  "value":"{extended |-> \"#cccccc\", retracted |-> \"#88d2f7\", gear_moving |-> \"#cccccc\"}(gears(%0))"
+	  },
+	  {
+		  "id":"ev_handle",
+		  "attr":"xlink:href",
+		  "value":"IF handle = up THEN \"img/handle_up.png\" ELSE \"img/handle_down.png\" END"
+	  },
+	  {
+		  "repeat": ["1", "2"],
+		  "id":"ev_general_%0",
+		  "attr":"fill",
+		  "value":"IF general_valve = valve_open THEN \"blue\" ELSE \"gray\" END"
+	  },
+	  {
+		  "repeat": ["1", "2"],
+		  "id":"ev_open_doors_%0",
+		  "attr":"fill",
+		  "value":"IF valve_open_door = valve_open THEN \"blue\" ELSE \"gray\" END"
+	  },
+	  {
+		  "repeat": ["1", "2"],
+		  "id":"ev_close_doors_%0",
+		  "attr":"fill",
+		  "value":"IF valve_close_door = valve_open THEN \"blue\" ELSE \"gray\" END"
+	  },
+	  {
+		  "repeat": ["1", "2"],
+		  "id":"ev_extended_gears_%0",
+		  "attr":"fill",
+		  "value":"IF valve_extend_gear = valve_open THEN \"blue\" ELSE \"gray\" END"
+	  },
+	  {
+		  "repeat": ["1", "2"],
+		  "id":"ev_retraction_gears_%0",
+		  "attr":"fill",
+		  "value":"IF valve_retract_gear = valve_open THEN \"blue\" ELSE \"gray\" END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3"],
+		  "id":"analogical_switch_%0",
+		  "attr":"fill",
+		  "value":"IF general_EV = TRUE THEN \"green\" ELSE \"red\" END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3"],
+		  "id":"analogical_switch_%0",
+		  "attr":"stroke",
+		  "value":"IF general_EV = TRUE THEN \"green\" ELSE \"red\" END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3"],
+		  "id":"close_switch_%0",
+		  "attr":"fill",
+		  "value":"IF general_EV = TRUE THEN \"green\" ELSE \"red\" END"
+	  },
+	  {
+		  "repeat": ["1", "2", "3"],
+		  "id":"close_switch_%0",
+		  "attr":"stroke",
+		  "value":"IF general_EV = TRUE THEN \"green\" ELSE \"red\" END"
+	  },
+	  {
+		  "id":"analogical_switch_open",
+		  "attr":"visibility",
+		  "value":"IF analogical_switch = switch_open THEN \"visible\" ELSE \"hidden\" END"
+	  },
+	  {
+		  "id":"analogical_switch_closed",
+		  "attr":"visibility",
+		  "value":"IF analogical_switch = switch_closed THEN \"visible\" ELSE \"hidden\" END"
+	  }
+  ],
+  "events": [
+	  {
+		"id":"con_stimulate_general_valve",
+		"event":"con_stimulate_general_valve",
+		"predicates":[]
+	  },
+	  {
+		"id":"close_switch_1",
+		"event":"env_open_analogical_switch",
+		"predicates":[]
+	  },
+	  {
+		"id":"open_switch",
+		"event":"env_close_analogical_switch",
+		"predicates":[]
+	  }
+  ]
+}
diff --git a/B2Program/LandingGear/HydraulicCircuit/LandingGear_R6-visualisation.js b/B2Program/LandingGear/HydraulicCircuit/LandingGear_R6-visualisation.js
new file mode 100644
index 0000000000000000000000000000000000000000..64c8f45afc55f0ac1d549c118024680703966f92
--- /dev/null
+++ b/B2Program/LandingGear/HydraulicCircuit/LandingGear_R6-visualisation.js
@@ -0,0 +1,3718 @@
+import LandingGear_R6 from "./LandingGear_R6.js";
+import {SelectError} from "./btypes/BUtils.js";
+import {VALVE_STATE} from "./LandingGear_R6.js"
+import {DOOR_STATE} from "./LandingGear_R6.js"
+import {GEAR_STATE} from "./LandingGear_R6.js"
+import {POSITION} from "./LandingGear_R6.js"
+import {HANDLE_STATE} from "./LandingGear_R6.js"
+import {PLANE_STATE} from "./LandingGear_R6.js"
+import {SWITCH_STATE} from "./LandingGear_R6.js"
+
+import {enum_VALVE_STATE} from "./LandingGear_R6.js"
+import {enum_DOOR_STATE} from "./LandingGear_R6.js"
+import {enum_GEAR_STATE} from "./LandingGear_R6.js"
+import {enum_POSITION} from "./LandingGear_R6.js"
+import {enum_HANDLE_STATE} from "./LandingGear_R6.js"
+import {enum_PLANE_STATE} from "./LandingGear_R6.js"
+import {enum_SWITCH_STATE} from "./LandingGear_R6.js"
+
+import {BTuple} from "./btypes/BTuple.js";
+import {BSet} from "./btypes/BSet.js";
+import {BRelation} from "./btypes/BRelation.js";
+import {BInteger} from "./btypes/BInteger.js";
+import {BBoolean} from "./btypes/BBoolean.js";
+import {BObject} from "./btypes/BObject.js";
+import {BString} from "./btypes/BString.js";
+
+var _machine = new LandingGear_R6();
+var _state_list = [];
+var _transition_list = [];
+var _included_machines = {};
+_included_machines["LandingGear_R6"] = function(){return _machine};
+var _state_view_vars = document.getElementById("_state_view_variables");
+var _state_view_consts = document.getElementById("_state_view_constants");
+var _state_view_sets = document.getElementById("_state_view_sets");
+var _state_view_invariant = document.getElementById("_state_view_invariant");
+var _svg_vars = {}
+_svg_vars["retraction_circuit_doors_1"] = document.getElementById("architecture").contentDocument.getElementById("retraction_circuit_doors_1")
+_svg_vars["fr_gear_cylinder_forcer"] = document.getElementById("architecture").contentDocument.getElementById("fr_gear_cylinder_forcer")
+_svg_vars["retraction_circuit_doors_3"] = document.getElementById("architecture").contentDocument.getElementById("retraction_circuit_doors_3")
+_svg_vars["retraction_circuit_doors_2"] = document.getElementById("architecture").contentDocument.getElementById("retraction_circuit_doors_2")
+_svg_vars["retraction_circuit_doors_4"] = document.getElementById("architecture").contentDocument.getElementById("retraction_circuit_doors_4")
+_svg_vars["eo_retract_gears_2"] = document.getElementById("architecture").contentDocument.getElementById("eo_retract_gears_2")
+_svg_vars["eo_retract_gears_1"] = document.getElementById("architecture").contentDocument.getElementById("eo_retract_gears_1")
+_svg_vars["lt_gear_cylinder_forcer"] = document.getElementById("architecture").contentDocument.getElementById("lt_gear_cylinder_forcer")
+_svg_vars["eo_close_doors_2"] = document.getElementById("architecture").contentDocument.getElementById("eo_close_doors_2")
+_svg_vars["ev_retraction_gears_2"] = document.getElementById("architecture").contentDocument.getElementById("ev_retraction_gears_2")
+_svg_vars["ev_retraction_gears_1"] = document.getElementById("architecture").contentDocument.getElementById("ev_retraction_gears_1")
+_svg_vars["lt_door_cylinder_r"] = document.getElementById("architecture").contentDocument.getElementById("lt_door_cylinder_r")
+_svg_vars["fr_door_cylinder_l"] = document.getElementById("architecture").contentDocument.getElementById("fr_door_cylinder_l")
+_svg_vars["lt_gear_cylinder_l"] = document.getElementById("architecture").contentDocument.getElementById("lt_gear_cylinder_l")
+_svg_vars["door_cylinder_forcer"] = document.getElementById("architecture").contentDocument.getElementById("door_cylinder_forcer")
+_svg_vars["fr_door_cylinder_r"] = document.getElementById("architecture").contentDocument.getElementById("fr_door_cylinder_r")
+_svg_vars["eo_close_doors_1"] = document.getElementById("architecture").contentDocument.getElementById("eo_close_doors_1")
+_svg_vars["rt_gear_cylinder_forcer"] = document.getElementById("architecture").contentDocument.getElementById("rt_gear_cylinder_forcer")
+_svg_vars["eo_extend_gears_1"] = document.getElementById("architecture").contentDocument.getElementById("eo_extend_gears_1")
+_svg_vars["ev_extended_gears_1"] = document.getElementById("architecture").contentDocument.getElementById("ev_extended_gears_1")
+_svg_vars["eo_extend_gears_2"] = document.getElementById("architecture").contentDocument.getElementById("eo_extend_gears_2")
+_svg_vars["rt_door_cylinder_r"] = document.getElementById("architecture").contentDocument.getElementById("rt_door_cylinder_r")
+_svg_vars["ev_extended_gears_2"] = document.getElementById("architecture").contentDocument.getElementById("ev_extended_gears_2")
+_svg_vars["analogical_switch_closed"] = document.getElementById("architecture").contentDocument.getElementById("analogical_switch_closed")
+_svg_vars["rt_door_cylinder_l"] = document.getElementById("architecture").contentDocument.getElementById("rt_door_cylinder_l")
+_svg_vars["hydraulic_circuit_5"] = document.getElementById("architecture").contentDocument.getElementById("hydraulic_circuit_5")
+_svg_vars["hydraulic_circuit_4"] = document.getElementById("architecture").contentDocument.getElementById("hydraulic_circuit_4")
+_svg_vars["hydraulic_circuit_3"] = document.getElementById("architecture").contentDocument.getElementById("hydraulic_circuit_3")
+_svg_vars["ev_handle"] = document.getElementById("architecture").contentDocument.getElementById("ev_handle")
+_svg_vars["ev_open_doors_2"] = document.getElementById("architecture").contentDocument.getElementById("ev_open_doors_2")
+_svg_vars["hydraulic_circuit_2"] = document.getElementById("architecture").contentDocument.getElementById("hydraulic_circuit_2")
+_svg_vars["ev_open_doors_1"] = document.getElementById("architecture").contentDocument.getElementById("ev_open_doors_1")
+_svg_vars["hydraulic_circuit_6"] = document.getElementById("architecture").contentDocument.getElementById("hydraulic_circuit_6")
+_svg_vars["extension_circuit_doors_3"] = document.getElementById("architecture").contentDocument.getElementById("extension_circuit_doors_3")
+_svg_vars["ev_general_1"] = document.getElementById("architecture").contentDocument.getElementById("ev_general_1")
+_svg_vars["extension_circuit_doors_2"] = document.getElementById("architecture").contentDocument.getElementById("extension_circuit_doors_2")
+_svg_vars["rt_door_cylinder_forcer"] = document.getElementById("architecture").contentDocument.getElementById("rt_door_cylinder_forcer")
+_svg_vars["ev_general_2"] = document.getElementById("architecture").contentDocument.getElementById("ev_general_2")
+_svg_vars["extension_circuit_doors_1"] = document.getElementById("architecture").contentDocument.getElementById("extension_circuit_doors_1")
+_svg_vars["hydraulic_circuit_1"] = document.getElementById("architecture").contentDocument.getElementById("hydraulic_circuit_1")
+_svg_vars["close_switch_1"] = document.getElementById("architecture").contentDocument.getElementById("close_switch_1")
+_svg_vars["close_switch_2"] = document.getElementById("architecture").contentDocument.getElementById("close_switch_2")
+_svg_vars["extension_circuit_doors_4"] = document.getElementById("architecture").contentDocument.getElementById("extension_circuit_doors_4")
+_svg_vars["close_switch_3"] = document.getElementById("architecture").contentDocument.getElementById("close_switch_3")
+_svg_vars["analogical_switch_1"] = document.getElementById("architecture").contentDocument.getElementById("analogical_switch_1")
+_svg_vars["analogical_switch_2"] = document.getElementById("architecture").contentDocument.getElementById("analogical_switch_2")
+_svg_vars["analogical_switch_3"] = document.getElementById("architecture").contentDocument.getElementById("analogical_switch_3")
+_svg_vars["eo_general_3"] = document.getElementById("architecture").contentDocument.getElementById("eo_general_3")
+_svg_vars["lt_door_cylinder_l"] = document.getElementById("architecture").contentDocument.getElementById("lt_door_cylinder_l")
+_svg_vars["eo_general_2"] = document.getElementById("architecture").contentDocument.getElementById("eo_general_2")
+_svg_vars["lt_gear_cylinder_r"] = document.getElementById("architecture").contentDocument.getElementById("lt_gear_cylinder_r")
+_svg_vars["eo_general_1"] = document.getElementById("architecture").contentDocument.getElementById("eo_general_1")
+_svg_vars["ev_close_doors_1"] = document.getElementById("architecture").contentDocument.getElementById("ev_close_doors_1")
+_svg_vars["ev_close_doors_2"] = document.getElementById("architecture").contentDocument.getElementById("ev_close_doors_2")
+_svg_vars["fr_gear_cylinder_l"] = document.getElementById("architecture").contentDocument.getElementById("fr_gear_cylinder_l")
+_svg_vars["fr_gear_cylinder_r"] = document.getElementById("architecture").contentDocument.getElementById("fr_gear_cylinder_r")
+_svg_vars["retraction_circuit_gears_3"] = document.getElementById("architecture").contentDocument.getElementById("retraction_circuit_gears_3")
+_svg_vars["retraction_circuit_gears_4"] = document.getElementById("architecture").contentDocument.getElementById("retraction_circuit_gears_4")
+_svg_vars["analogical_switch_open"] = document.getElementById("architecture").contentDocument.getElementById("analogical_switch_open")
+_svg_vars["retraction_circuit_gears_1"] = document.getElementById("architecture").contentDocument.getElementById("retraction_circuit_gears_1")
+_svg_vars["retraction_circuit_gears_2"] = document.getElementById("architecture").contentDocument.getElementById("retraction_circuit_gears_2")
+_svg_vars["extension_circuit_gears_1"] = document.getElementById("architecture").contentDocument.getElementById("extension_circuit_gears_1")
+_svg_vars["extension_circuit_gears_2"] = document.getElementById("architecture").contentDocument.getElementById("extension_circuit_gears_2")
+_svg_vars["extension_circuit_gears_3"] = document.getElementById("architecture").contentDocument.getElementById("extension_circuit_gears_3")
+_svg_vars["lt_door_cylinder_forcer"] = document.getElementById("architecture").contentDocument.getElementById("lt_door_cylinder_forcer")
+_svg_vars["eo_open_doors_2"] = document.getElementById("architecture").contentDocument.getElementById("eo_open_doors_2")
+_svg_vars["extension_circuit_gears_4"] = document.getElementById("architecture").contentDocument.getElementById("extension_circuit_gears_4")
+_svg_vars["rt_gear_cylinder_r"] = document.getElementById("architecture").contentDocument.getElementById("rt_gear_cylinder_r")
+_svg_vars["eo_open_doors_1"] = document.getElementById("architecture").contentDocument.getElementById("eo_open_doors_1")
+_svg_vars["rt_gear_cylinder_l"] = document.getElementById("architecture").contentDocument.getElementById("rt_gear_cylinder_l")
+_svg_vars["fr_door_cylinder_forcer"] = document.getElementById("architecture").contentDocument.getElementById("fr_door_cylinder_forcer")
+_svg_vars["gear_cylinder_forcer"] = document.getElementById("architecture").contentDocument.getElementById("gear_cylinder_forcer")
+var _machine_vars = {}
+var _var_label;
+var _var_div;
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_analogical_switch();
+_var_div.id = "_var_analogical_switch";
+_machine_vars["analogical_switch"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_analogical_switch";
+_var_label.innerHTML = "LandingGear_R6.analogical_switch";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_general_EV();
+_var_div.id = "_var_general_EV";
+_machine_vars["general_EV"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_general_EV";
+_var_label.innerHTML = "LandingGear_R6.general_EV";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_general_valve();
+_var_div.id = "_var_general_valve";
+_machine_vars["general_valve"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_general_valve";
+_var_label.innerHTML = "LandingGear_R6.general_valve";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_handle_move();
+_var_div.id = "_var_handle_move";
+_machine_vars["handle_move"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_handle_move";
+_var_label.innerHTML = "LandingGear_R6.handle_move";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_close_EV();
+_var_div.id = "_var_close_EV";
+_machine_vars["close_EV"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_close_EV";
+_var_label.innerHTML = "LandingGear_R6.close_EV";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_extend_EV();
+_var_div.id = "_var_extend_EV";
+_machine_vars["extend_EV"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_extend_EV";
+_var_label.innerHTML = "LandingGear_R6.extend_EV";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_open_EV();
+_var_div.id = "_var_open_EV";
+_machine_vars["open_EV"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_open_EV";
+_var_label.innerHTML = "LandingGear_R6.open_EV";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_retract_EV();
+_var_div.id = "_var_retract_EV";
+_machine_vars["retract_EV"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_retract_EV";
+_var_label.innerHTML = "LandingGear_R6.retract_EV";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_shock_absorber();
+_var_div.id = "_var_shock_absorber";
+_machine_vars["shock_absorber"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_shock_absorber";
+_var_label.innerHTML = "LandingGear_R6.shock_absorber";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_valve_close_door();
+_var_div.id = "_var_valve_close_door";
+_machine_vars["valve_close_door"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_valve_close_door";
+_var_label.innerHTML = "LandingGear_R6.valve_close_door";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_valve_extend_gear();
+_var_div.id = "_var_valve_extend_gear";
+_machine_vars["valve_extend_gear"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_valve_extend_gear";
+_var_label.innerHTML = "LandingGear_R6.valve_extend_gear";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_valve_open_door();
+_var_div.id = "_var_valve_open_door";
+_machine_vars["valve_open_door"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_valve_open_door";
+_var_label.innerHTML = "LandingGear_R6.valve_open_door";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_valve_retract_gear();
+_var_div.id = "_var_valve_retract_gear";
+_machine_vars["valve_retract_gear"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_valve_retract_gear";
+_var_label.innerHTML = "LandingGear_R6.valve_retract_gear";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_doors();
+_var_div.id = "_var_doors";
+_machine_vars["doors"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_doors";
+_var_label.innerHTML = "LandingGear_R6.doors";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_gears();
+_var_div.id = "_var_gears";
+_machine_vars["gears"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_gears";
+_var_label.innerHTML = "LandingGear_R6.gears";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_handle();
+_var_div.id = "_var_handle";
+_machine_vars["handle"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_handle";
+_var_label.innerHTML = "LandingGear_R6.handle";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_door();
+_var_div.id = "_var_door";
+_machine_vars["door"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_door";
+_var_label.innerHTML = "LandingGear_R6.door";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get_gear();
+_var_div.id = "_var_gear";
+_machine_vars["gear"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_gear";
+_var_label.innerHTML = "LandingGear_R6.gear";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get__DOOR_STATE();
+_var_div.id = "_var_DOOR_STATE";
+_machine_vars["DOOR_STATE"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_DOOR_STATE";
+_var_label.innerHTML = "LandingGear_R6.DOOR_STATE";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get__GEAR_STATE();
+_var_div.id = "_var_GEAR_STATE";
+_machine_vars["GEAR_STATE"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_GEAR_STATE";
+_var_label.innerHTML = "LandingGear_R6.GEAR_STATE";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get__HANDLE_STATE();
+_var_div.id = "_var_HANDLE_STATE";
+_machine_vars["HANDLE_STATE"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_HANDLE_STATE";
+_var_label.innerHTML = "LandingGear_R6.HANDLE_STATE";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get__POSITION();
+_var_div.id = "_var_POSITION";
+_machine_vars["POSITION"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_POSITION";
+_var_label.innerHTML = "LandingGear_R6.POSITION";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get__SWITCH_STATE();
+_var_div.id = "_var_SWITCH_STATE";
+_machine_vars["SWITCH_STATE"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_SWITCH_STATE";
+_var_label.innerHTML = "LandingGear_R6.SWITCH_STATE";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get__PLANE_STATE();
+_var_div.id = "_var_PLANE_STATE";
+_machine_vars["PLANE_STATE"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_PLANE_STATE";
+_var_label.innerHTML = "LandingGear_R6.PLANE_STATE";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._get__VALVE_STATE();
+_var_div.id = "_var_VALVE_STATE";
+_machine_vars["VALVE_STATE"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_VALVE_STATE";
+_var_label.innerHTML = "LandingGear_R6.VALVE_STATE";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_1();
+_var_div.id = "_check_inv_1";
+_machine_vars["_check_inv_1"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_1";
+_var_label.innerHTML = "analogical_switch:SWITCH_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_2();
+_var_div.id = "_check_inv_2";
+_machine_vars["_check_inv_2"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_2";
+_var_label.innerHTML = "general_EV:BOOL";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_3();
+_var_div.id = "_check_inv_3";
+_machine_vars["_check_inv_3"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_3";
+_var_label.innerHTML = "general_valve:VALVE_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_4();
+_var_div.id = "_check_inv_4";
+_machine_vars["_check_inv_4"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_4";
+_var_label.innerHTML = "handle_move:BOOL";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_5();
+_var_div.id = "_check_inv_5";
+_machine_vars["_check_inv_5"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_5";
+_var_label.innerHTML = "close_EV:BOOL";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_6();
+_var_div.id = "_check_inv_6";
+_machine_vars["_check_inv_6"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_6";
+_var_label.innerHTML = "extend_EV:BOOL";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_7();
+_var_div.id = "_check_inv_7";
+_machine_vars["_check_inv_7"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_7";
+_var_label.innerHTML = "open_EV:BOOL";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_8();
+_var_div.id = "_check_inv_8";
+_machine_vars["_check_inv_8"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_8";
+_var_label.innerHTML = "retract_EV:BOOL";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_9();
+_var_div.id = "_check_inv_9";
+_machine_vars["_check_inv_9"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_9";
+_var_label.innerHTML = "shock_absorber:PLANE_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_10();
+_var_div.id = "_check_inv_10";
+_machine_vars["_check_inv_10"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_10";
+_var_label.innerHTML = "valve_close_door:VALVE_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_11();
+_var_div.id = "_check_inv_11";
+_machine_vars["_check_inv_11"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_11";
+_var_label.innerHTML = "valve_extend_gear:VALVE_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_12();
+_var_div.id = "_check_inv_12";
+_machine_vars["_check_inv_12"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_12";
+_var_label.innerHTML = "valve_open_door:VALVE_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_13();
+_var_div.id = "_check_inv_13";
+_machine_vars["_check_inv_13"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_13";
+_var_label.innerHTML = "valve_retract_gear:VALVE_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_14();
+_var_div.id = "_check_inv_14";
+_machine_vars["_check_inv_14"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_14";
+_var_label.innerHTML = "handle:HANDLE_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_15();
+_var_div.id = "_check_inv_15";
+_machine_vars["_check_inv_15"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_15";
+_var_label.innerHTML = "door:DOOR_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_16();
+_var_div.id = "_check_inv_16";
+_machine_vars["_check_inv_16"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_16";
+_var_label.innerHTML = "gear:GEAR_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_17();
+_var_div.id = "_check_inv_17";
+_machine_vars["_check_inv_17"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_17";
+_var_label.innerHTML = "(open_EV=TRUEorclose_EV=TRUEorretract_EV=TRUEorextend_EV=TRUE)=>general_EV=TRUE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_18();
+_var_div.id = "_check_inv_18";
+_machine_vars["_check_inv_18"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_18";
+_var_label.innerHTML = "not(open_EV=TRUE&close_EV=TRUE)";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_19();
+_var_div.id = "_check_inv_19";
+_machine_vars["_check_inv_19"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_19";
+_var_label.innerHTML = "gears:POSITION-->GEAR_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_20();
+_var_div.id = "_check_inv_20";
+_machine_vars["_check_inv_20"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_20";
+_var_label.innerHTML = "doors:POSITION-->DOOR_STATE";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_21();
+_var_div.id = "_check_inv_21";
+_machine_vars["_check_inv_21"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_21";
+_var_label.innerHTML = "door=closed<=>ran(doors)={closed}";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_22();
+_var_div.id = "_check_inv_22";
+_machine_vars["_check_inv_22"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_22";
+_var_label.innerHTML = "door=open<=>ran(doors)={open}";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_23();
+_var_div.id = "_check_inv_23";
+_machine_vars["_check_inv_23"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_23";
+_var_label.innerHTML = "gear=extended<=>ran(gears)={extended}";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_24();
+_var_div.id = "_check_inv_24";
+_machine_vars["_check_inv_24"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_24";
+_var_label.innerHTML = "gear=retracted<=>ran(gears)={retracted}";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["LandingGear_R6"]()._check_inv_25();
+_var_div.id = "_check_inv_25";
+_machine_vars["_check_inv_25"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_25";
+_var_label.innerHTML = "gear=gear_moving=>door=open";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+
+function updateVisuals () {
+  _svg_vars["extension_circuit_gears_4"].setAttribute("stroke-width", (_machine._get_valve_extend_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["extension_circuit_doors_4"].setAttribute("stroke", (_machine._get_valve_open_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["ev_close_doors_1"].setAttribute("fill", (_machine._get_valve_close_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("blue") : new BString("gray")).getValue());
+  _svg_vars["close_switch_1"].setAttribute("fill", (_machine._get_general_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["analogical_switch_1"].setAttribute("fill", (_machine._get_general_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["retraction_circuit_doors_1"].setAttribute("stroke-width", (_machine._get_valve_close_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["lt_door_cylinder_r"].setAttribute("fill", new BRelation(new BTuple(new DOOR_STATE(enum_DOOR_STATE.closed), new BString("#cccccc")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.open), new BString("#88d2f7")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.door_moving), new BString("#cccccc"))).functionCall(_machine._get_doors().functionCall(new POSITION(enum_POSITION.lt))).getValue());
+  _svg_vars["lt_gear_cylinder_l"].setAttribute("fill", new BRelation(new BTuple(new GEAR_STATE(enum_GEAR_STATE.extended), new BString("#cccccc")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.retracted), new BString("#88d2f7")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new BString("#88d2f7"))).functionCall(_machine._get_gears().functionCall(new POSITION(enum_POSITION.lt))).getValue());
+  _svg_vars["analogical_switch_1"].setAttribute("stroke", (_machine._get_general_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["extension_circuit_gears_4"].setAttribute("stroke", (_machine._get_valve_extend_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["hydraulic_circuit_5"].setAttribute("stroke", (_machine._get_general_valve().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["retraction_circuit_gears_2"].setAttribute("stroke", (_machine._get_valve_retract_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["close_switch_2"].setAttribute("fill", (_machine._get_general_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["eo_close_doors_1"].setAttribute("stroke", (_machine._get_close_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["hydraulic_circuit_4"].setAttribute("stroke-width", (_machine._get_general_valve().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["retraction_circuit_gears_1"].setAttribute("stroke", (_machine._get_valve_retract_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["retraction_circuit_gears_4"].setAttribute("stroke", (_machine._get_valve_retract_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["rt_door_cylinder_l"].setAttribute("fill", new BRelation(new BTuple(new DOOR_STATE(enum_DOOR_STATE.closed), new BString("#cccccc")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.open), new BString("#88d2f7")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.door_moving), new BString("#88d2f7"))).functionCall(_machine._get_doors().functionCall(new POSITION(enum_POSITION.rt))).getValue());
+  _svg_vars["retraction_circuit_gears_3"].setAttribute("stroke", (_machine._get_valve_retract_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["analogical_switch_closed"].setAttribute("visibility", (_machine._get_analogical_switch().equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_closed)).booleanValue() ? new BString("visible") : new BString("hidden")).getValue());
+  _svg_vars["eo_extend_gears_2"].setAttribute("stroke", (_machine._get_extend_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["analogical_switch_open"].setAttribute("visibility", (_machine._get_analogical_switch().equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_open)).booleanValue() ? new BString("visible") : new BString("hidden")).getValue());
+  _svg_vars["extension_circuit_gears_1"].setAttribute("stroke", (_machine._get_valve_extend_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["hydraulic_circuit_6"].setAttribute("stroke", (_machine._get_general_valve().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["ev_handle"].setAttribute("xlink:href", (_machine._get_handle().equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() ? new BString("img/handle_up.png") : new BString("img/handle_down.png")).getValue());
+  _svg_vars["fr_gear_cylinder_r"].setAttribute("fill", new BRelation(new BTuple(new GEAR_STATE(enum_GEAR_STATE.extended), new BString("#cccccc")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.retracted), new BString("#88d2f7")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new BString("#cccccc"))).functionCall(_machine._get_gears().functionCall(new POSITION(enum_POSITION.fr))).getValue());
+  _svg_vars["close_switch_3"].setAttribute("fill", (_machine._get_general_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["eo_close_doors_2"].setAttribute("stroke", (_machine._get_close_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["extension_circuit_doors_3"].setAttribute("stroke", (_machine._get_valve_open_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["ev_extended_gears_1"].setAttribute("fill", (_machine._get_valve_extend_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("blue") : new BString("gray")).getValue());
+  _svg_vars["extension_circuit_doors_4"].setAttribute("stroke-width", (_machine._get_valve_open_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["retraction_circuit_doors_3"].setAttribute("stroke", (_machine._get_valve_close_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["retraction_circuit_doors_2"].setAttribute("stroke-width", (_machine._get_valve_close_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["retraction_circuit_doors_1"].setAttribute("stroke", (_machine._get_valve_close_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["door_cylinder_forcer"].setAttribute("transform", new BRelation(new BTuple(new DOOR_STATE(enum_DOOR_STATE.closed), new BString("translate(0,0)")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.open), new BString("translate(90,0)")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.door_moving), new BString("translate(45,0)"))).functionCall(_machine._get_door()).getValue());
+  _svg_vars["analogical_switch_3"].setAttribute("stroke", (_machine._get_general_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["rt_gear_cylinder_r"].setAttribute("fill", new BRelation(new BTuple(new GEAR_STATE(enum_GEAR_STATE.extended), new BString("#cccccc")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.retracted), new BString("#88d2f7")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new BString("#cccccc"))).functionCall(_machine._get_gears().functionCall(new POSITION(enum_POSITION.rt))).getValue());
+  _svg_vars["retraction_circuit_gears_4"].setAttribute("stroke-width", (_machine._get_valve_retract_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["analogical_switch_3"].setAttribute("fill", (_machine._get_general_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["retraction_circuit_doors_2"].setAttribute("stroke", (_machine._get_valve_close_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["rt_door_cylinder_r"].setAttribute("fill", new BRelation(new BTuple(new DOOR_STATE(enum_DOOR_STATE.closed), new BString("#cccccc")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.open), new BString("#88d2f7")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.door_moving), new BString("#cccccc"))).functionCall(_machine._get_doors().functionCall(new POSITION(enum_POSITION.rt))).getValue());
+  _svg_vars["hydraulic_circuit_1"].setAttribute("stroke", (_machine._get_general_valve().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["fr_gear_cylinder_forcer"].setAttribute("transform", new BRelation(new BTuple(new GEAR_STATE(enum_GEAR_STATE.extended), new BString("translate(0,0)")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.retracted), new BString("translate(90,0)")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new BString("translate(45,0)"))).functionCall(_machine._get_gears().functionCall(new POSITION(enum_POSITION.fr))).getValue());
+  _svg_vars["extension_circuit_gears_3"].setAttribute("stroke", (_machine._get_valve_extend_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["extension_circuit_doors_2"].setAttribute("stroke-width", (_machine._get_valve_open_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["eo_retract_gears_2"].setAttribute("stroke", (_machine._get_retract_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["extension_circuit_doors_1"].setAttribute("stroke", (_machine._get_valve_open_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["fr_gear_cylinder_l"].setAttribute("fill", new BRelation(new BTuple(new GEAR_STATE(enum_GEAR_STATE.extended), new BString("#cccccc")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.retracted), new BString("#88d2f7")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new BString("#88d2f7"))).functionCall(_machine._get_gears().functionCall(new POSITION(enum_POSITION.fr))).getValue());
+  _svg_vars["analogical_switch_2"].setAttribute("stroke", (_machine._get_general_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["retraction_circuit_doors_4"].setAttribute("stroke", (_machine._get_valve_close_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["ev_retraction_gears_2"].setAttribute("fill", (_machine._get_valve_retract_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("blue") : new BString("gray")).getValue());
+  _svg_vars["eo_extend_gears_1"].setAttribute("stroke", (_machine._get_extend_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["rt_gear_cylinder_l"].setAttribute("fill", new BRelation(new BTuple(new GEAR_STATE(enum_GEAR_STATE.extended), new BString("#cccccc")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.retracted), new BString("#88d2f7")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new BString("#88d2f7"))).functionCall(_machine._get_gears().functionCall(new POSITION(enum_POSITION.rt))).getValue());
+  _svg_vars["rt_gear_cylinder_forcer"].setAttribute("transform", new BRelation(new BTuple(new GEAR_STATE(enum_GEAR_STATE.extended), new BString("translate(0,0)")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.retracted), new BString("translate(90,0)")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new BString("translate(45,0)"))).functionCall(_machine._get_gears().functionCall(new POSITION(enum_POSITION.rt))).getValue());
+  _svg_vars["lt_door_cylinder_forcer"].setAttribute("transform", new BRelation(new BTuple(new DOOR_STATE(enum_DOOR_STATE.closed), new BString("translate(0,0)")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.open), new BString("translate(90,0)")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.door_moving), new BString("translate(45,0)"))).functionCall(_machine._get_doors().functionCall(new POSITION(enum_POSITION.lt))).getValue());
+  _svg_vars["hydraulic_circuit_3"].setAttribute("stroke", (_machine._get_general_valve().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["eo_general_2"].setAttribute("stroke", (_machine._get_general_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["eo_open_doors_1"].setAttribute("stroke", (_machine._get_open_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["eo_retract_gears_1"].setAttribute("stroke", (_machine._get_retract_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["ev_general_1"].setAttribute("fill", (_machine._get_general_valve().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("blue") : new BString("gray")).getValue());
+  _svg_vars["hydraulic_circuit_2"].setAttribute("stroke-width", (_machine._get_general_valve().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["extension_circuit_doors_2"].setAttribute("stroke", (_machine._get_valve_open_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["retraction_circuit_doors_3"].setAttribute("stroke-width", (_machine._get_valve_close_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["retraction_circuit_gears_3"].setAttribute("stroke-width", (_machine._get_valve_retract_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["close_switch_1"].setAttribute("stroke", (_machine._get_general_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["eo_open_doors_2"].setAttribute("stroke", (_machine._get_open_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["extension_circuit_gears_1"].setAttribute("stroke-width", (_machine._get_valve_extend_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["ev_open_doors_1"].setAttribute("fill", (_machine._get_valve_open_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("blue") : new BString("gray")).getValue());
+  _svg_vars["eo_general_3"].setAttribute("stroke", (_machine._get_general_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["hydraulic_circuit_5"].setAttribute("stroke-width", (_machine._get_general_valve().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["ev_retraction_gears_1"].setAttribute("fill", (_machine._get_valve_retract_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("blue") : new BString("gray")).getValue());
+  _svg_vars["ev_extended_gears_2"].setAttribute("fill", (_machine._get_valve_extend_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("blue") : new BString("gray")).getValue());
+  _svg_vars["extension_circuit_gears_3"].setAttribute("stroke-width", (_machine._get_valve_extend_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["ev_open_doors_2"].setAttribute("fill", (_machine._get_valve_open_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("blue") : new BString("gray")).getValue());
+  _svg_vars["hydraulic_circuit_6"].setAttribute("stroke-width", (_machine._get_general_valve().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["lt_gear_cylinder_forcer"].setAttribute("transform", new BRelation(new BTuple(new GEAR_STATE(enum_GEAR_STATE.extended), new BString("translate(0,0)")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.retracted), new BString("translate(90,0)")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new BString("translate(45,0)"))).functionCall(_machine._get_gears().functionCall(new POSITION(enum_POSITION.lt))).getValue());
+  _svg_vars["fr_door_cylinder_l"].setAttribute("fill", new BRelation(new BTuple(new DOOR_STATE(enum_DOOR_STATE.closed), new BString("#cccccc")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.open), new BString("#88d2f7")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.door_moving), new BString("#88d2f7"))).functionCall(_machine._get_doors().functionCall(new POSITION(enum_POSITION.fr))).getValue());
+  _svg_vars["close_switch_2"].setAttribute("stroke", (_machine._get_general_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["extension_circuit_gears_2"].setAttribute("stroke", (_machine._get_valve_extend_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["ev_close_doors_2"].setAttribute("fill", (_machine._get_valve_close_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("blue") : new BString("gray")).getValue());
+  _svg_vars["hydraulic_circuit_4"].setAttribute("stroke", (_machine._get_general_valve().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["extension_circuit_doors_1"].setAttribute("stroke-width", (_machine._get_valve_open_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["rt_door_cylinder_forcer"].setAttribute("transform", new BRelation(new BTuple(new DOOR_STATE(enum_DOOR_STATE.closed), new BString("translate(0,0)")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.open), new BString("translate(90,0)")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.door_moving), new BString("translate(45,0)"))).functionCall(_machine._get_doors().functionCall(new POSITION(enum_POSITION.rt))).getValue());
+  _svg_vars["hydraulic_circuit_3"].setAttribute("stroke-width", (_machine._get_general_valve().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["retraction_circuit_gears_2"].setAttribute("stroke-width", (_machine._get_valve_retract_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["retraction_circuit_doors_4"].setAttribute("stroke-width", (_machine._get_valve_close_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["fr_door_cylinder_forcer"].setAttribute("transform", new BRelation(new BTuple(new DOOR_STATE(enum_DOOR_STATE.closed), new BString("translate(0,0)")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.open), new BString("translate(90,0)")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.door_moving), new BString("translate(45,0)"))).functionCall(_machine._get_doors().functionCall(new POSITION(enum_POSITION.fr))).getValue());
+  _svg_vars["ev_general_2"].setAttribute("fill", (_machine._get_general_valve().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("blue") : new BString("gray")).getValue());
+  _svg_vars["eo_general_1"].setAttribute("stroke", (_machine._get_general_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["retraction_circuit_gears_1"].setAttribute("stroke-width", (_machine._get_valve_retract_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["fr_door_cylinder_r"].setAttribute("fill", new BRelation(new BTuple(new DOOR_STATE(enum_DOOR_STATE.closed), new BString("#cccccc")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.open), new BString("#88d2f7")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.door_moving), new BString("#cccccc"))).functionCall(_machine._get_doors().functionCall(new POSITION(enum_POSITION.fr))).getValue());
+  _svg_vars["hydraulic_circuit_2"].setAttribute("stroke", (_machine._get_general_valve().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BString("#88d2f7") : new BString("#cccccc")).getValue());
+  _svg_vars["lt_door_cylinder_l"].setAttribute("fill", new BRelation(new BTuple(new DOOR_STATE(enum_DOOR_STATE.closed), new BString("#cccccc")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.open), new BString("#88d2f7")), new BTuple(new DOOR_STATE(enum_DOOR_STATE.door_moving), new BString("#88d2f7"))).functionCall(_machine._get_doors().functionCall(new POSITION(enum_POSITION.lt))).getValue());
+  _svg_vars["extension_circuit_gears_2"].setAttribute("stroke-width", (_machine._get_valve_extend_gear().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["analogical_switch_2"].setAttribute("fill", (_machine._get_general_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["lt_gear_cylinder_r"].setAttribute("fill", new BRelation(new BTuple(new GEAR_STATE(enum_GEAR_STATE.extended), new BString("#cccccc")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.retracted), new BString("#88d2f7")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new BString("#cccccc"))).functionCall(_machine._get_gears().functionCall(new POSITION(enum_POSITION.lt))).getValue());
+  _svg_vars["close_switch_3"].setAttribute("stroke", (_machine._get_general_EV().equal(new BBoolean(true)).booleanValue() ? new BString("green") : new BString("red")).getValue());
+  _svg_vars["gear_cylinder_forcer"].setAttribute("transform", new BRelation(new BTuple(new GEAR_STATE(enum_GEAR_STATE.extended), new BString("translate(0,0)")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.retracted), new BString("translate(90,0)")), new BTuple(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new BString("translate(45,0)"))).functionCall(_machine._get_gear()).getValue());
+  _svg_vars["extension_circuit_doors_3"].setAttribute("stroke-width", (_machine._get_valve_open_door().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _svg_vars["hydraulic_circuit_1"].setAttribute("stroke-width", (_machine._get_general_valve().equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() ? new BInteger(2) : new BInteger(1)).getValue());
+  _machine_vars["analogical_switch"].innerHTML = _included_machines["LandingGear_R6"]()._get_analogical_switch();
+  _machine_vars["general_EV"].innerHTML = _included_machines["LandingGear_R6"]()._get_general_EV();
+  _machine_vars["general_valve"].innerHTML = _included_machines["LandingGear_R6"]()._get_general_valve();
+  _machine_vars["handle_move"].innerHTML = _included_machines["LandingGear_R6"]()._get_handle_move();
+  _machine_vars["close_EV"].innerHTML = _included_machines["LandingGear_R6"]()._get_close_EV();
+  _machine_vars["extend_EV"].innerHTML = _included_machines["LandingGear_R6"]()._get_extend_EV();
+  _machine_vars["open_EV"].innerHTML = _included_machines["LandingGear_R6"]()._get_open_EV();
+  _machine_vars["retract_EV"].innerHTML = _included_machines["LandingGear_R6"]()._get_retract_EV();
+  _machine_vars["shock_absorber"].innerHTML = _included_machines["LandingGear_R6"]()._get_shock_absorber();
+  _machine_vars["valve_close_door"].innerHTML = _included_machines["LandingGear_R6"]()._get_valve_close_door();
+  _machine_vars["valve_extend_gear"].innerHTML = _included_machines["LandingGear_R6"]()._get_valve_extend_gear();
+  _machine_vars["valve_open_door"].innerHTML = _included_machines["LandingGear_R6"]()._get_valve_open_door();
+  _machine_vars["valve_retract_gear"].innerHTML = _included_machines["LandingGear_R6"]()._get_valve_retract_gear();
+  _machine_vars["doors"].innerHTML = _included_machines["LandingGear_R6"]()._get_doors();
+  _machine_vars["gears"].innerHTML = _included_machines["LandingGear_R6"]()._get_gears();
+  _machine_vars["handle"].innerHTML = _included_machines["LandingGear_R6"]()._get_handle();
+  _machine_vars["door"].innerHTML = _included_machines["LandingGear_R6"]()._get_door();
+  _machine_vars["gear"].innerHTML = _included_machines["LandingGear_R6"]()._get_gear();
+  for (let i = 1; i <= 25; i++) {
+    _machine_vars["_check_inv_"+i].innerHTML = _machine["_check_inv_"+i]();
+  }
+  checkTransitions();
+}
+
+var _history_view_buttons = document.getElementById("_history_view_buttons");
+var _buttonLeft = document.createElement("button");
+var _buttonRight = document.createElement("button");
+var _buttonUpload = document.createElement("button");
+var _buttonExport = document.createElement("button");
+var _inputUpload = document.createElement("input");
+var _buttonRun10 = document.createElement("button");
+var _buttonRun500 = document.createElement("button");
+
+function flattenTuple(tuple) {
+    if(!(tuple instanceof BTuple)) {
+        return [tuple];
+    }
+    return [tuple.projection1(), ...flattenTuple(tuple.projection2())];
+}
+
+function createOptionList(event, transition) {
+    let collator = new Intl.Collator([], {numeric: true});
+    for(let index in _machine_events[event].parameterNames) {
+        let parameter = _machine_events[event].parameterNames[index];
+        var datalist = document.querySelector("#" + event + "_" + parameter + "_datalist");
+        datalist.replaceChildren();
+        for(let value of Array.of(...transition).sort((a, b) => collator.compare(a, b))) {
+            let option = document.createElement("option");
+            value = flattenTuple(value);
+            option.text = value[index].toString();
+            datalist.appendChild(option);
+        }
+    }
+}
+
+function checkTransitions () {
+    let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+    for(event in _machine_events) {
+      var transition;
+      if(_transition_list[index]?.[event] == null ?? true) {
+         transition = _machine["_tr_" + event]();
+         _transition_list[index][event] = transition;
+      } else {
+         transition = _transition_list[index][event];
+      }
+      if(!(transition instanceof BSet)) {
+        _machine_events[event].disabled = !transition;
+      } else if (transition.size().intValue() == 0) {
+        _machine_events[event].disabled = true;
+      } else {
+        let collator = new Intl.Collator([], {numeric: true});
+        for(let current_transition of transition) {
+            try {
+                var current_machine = _machine._copy();
+                current_machine[event](...flattenTuple(current_transition));
+            } catch (error) {
+                  if(! error instanceof SelectError) {
+                      throw error;
+                  }
+                  transition = transition.difference(new BSet(current_transition));
+            }
+        }
+        if(transition.size().intValue() == 0) {
+            _machine_events[event].disabled = true;
+        } else {
+            _machine_events[event].disabled = false;
+        }
+        createOptionList(event, transition);
+      }
+    }
+    _buttonLeft.disabled = document.querySelector(".active").index <= 0;
+    _buttonRight.disabled = document.querySelector(".active").index >= document.querySelector("span:last-of-type").index;
+}
+
+_operations_view = document.getElementById("_operations_view");
+_history_view = document.getElementById("_history_view");
+_scenario_view = document.getElementById("_scenario_view");
+
+var _history_onclick_function = function () {
+  _machine = _state_list[this.index]._copy();
+  document.querySelectorAll("span").forEach(el => el.classList.remove("active"));
+  this.classList.add("active");
+  updateVisuals();
+}
+
+function createHistoryElement(text, index) {
+  var history_element = document.createElement("span");
+  history_element.innerHTML = text + "</br>";
+  history_element.index = index;
+  document.querySelectorAll("span.active").forEach(element => element.classList.remove("active"));
+  history_element.classList.add("active");
+  history_element.onclick = _history_onclick_function;
+  _state_list = _state_list.slice(0, index);
+  _state_list.push(_machine._copy());
+  _transition_list = _transition_list.slice(0, index);
+  _transition_list.push({});
+  while(_history_view.querySelectorAll("span").length > index && _history_view.lastChild !== null) {
+    _history_view.removeChild(_history_view.lastChild);
+  }
+  _history_view.appendChild(history_element);
+}
+
+function selectHistoryElement(offset) {
+  let currentHistoryElement = _history_view.querySelector(".active");
+  let index = currentHistoryElement.index + offset;
+  if (index < 0 || index >= _state_list.length) {
+    return;
+  }
+  currentHistoryElement.classList.remove("active");
+  _machine = _state_list[index]._copy();
+  _history_view.querySelectorAll(".active").forEach(el => el.classList.remove("active"));
+  currentHistoryElement = _history_view.querySelector("span:nth-of-type(" + (index + 1) + ")");
+  currentHistoryElement.classList.add("active");
+  updateVisuals();
+}
+
+function createScenarioElement(text, trace) {
+  var scenario_element = document.createElement("button");
+  var remove_element = document.createElement("button");
+  scenario_element.innerHTML = text + "</br>";
+  remove_element.innerHTML = "X";
+  var div_element = document.createElement("div");
+  div_element.appendChild(scenario_element);
+  div_element.appendChild(remove_element);
+  _scenario_view.appendChild(div_element);
+  scenario_element.onclick = function() {
+    displayTrace(trace);
+  };
+  remove_element.onclick = function() {
+    _scenario_view.removeChild(div_element);
+  };
+}
+
+
+_buttonLeft.innerHTML="&#9664;";
+_buttonLeft.onclick = function(){selectHistoryElement(-1)};
+_buttonRight.innerHTML="&#9654;";
+_buttonRight.onclick = function(){selectHistoryElement(1)};
+_history_view_buttons.appendChild(_buttonLeft);
+_history_view_buttons.appendChild(_buttonRight);
+
+_buttonUpload.textContent = "Import trace";
+_buttonUpload.onclick = importTrace;
+_history_view_buttons.appendChild(_buttonUpload);
+
+_buttonExport.textContent = "Export trace";
+_buttonExport.onclick = exportTrace;
+_history_view_buttons.appendChild(_buttonExport);
+
+_buttonRun10.textContent = "Run trace(10ms)";
+_buttonRun10.onclick = function(){runTrace(10);};
+_history_view_buttons.appendChild(_buttonRun10);
+
+_buttonRun500.textContent = "Run trace(500ms)";
+_buttonRun500.onclick = function(){runTrace(500);};
+_history_view_buttons.appendChild(_buttonRun500);
+
+createHistoryElement("Initialisation", 0);
+var _current_trace = [{name: "$initialise_machine", params: {}}];
+
+var _param_div;
+var _param_datalist;
+var _onclick_function;
+var _machine_events = {};
+var _svg_events = {};
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_retract_gear_skip"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_retract_gear_skip_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_retract_gear_skip_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_retract_gear_skip"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_retract_gear_skip"].style.gridColumn="-1";
+_machine_events["env_retract_gear_skip"].innerHTML = "env_retract_gear_skip";
+_machine_events["env_retract_gear_skip"].parameterNames = ["gr", ];
+_machine_events["env_retract_gear_skip"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_retract_gear_skip"] == null ?? true) {
+      transition = _machine["_tr_env_retract_gear_skip"]();
+      _transition_list[index]["env_retract_gear_skip"] = transition;
+  } else {
+      transition = _transition_list[index]["env_retract_gear_skip"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_retract_gear_skip is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_retract_gear_skip"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_retract_gear_skip!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_retract_gear_skip!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_retract_gear_skip"]["gr"].getValue(), ];
+    var returnValue = _machine.env_retract_gear_skip(...parameters);
+    createHistoryElement("env_retract_gear_skip(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_retract_gear_skip"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_retract_gear_skip", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_retract_gear_skip"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_retract_gear_skip"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_retract_gear_skip"].disabled = true;
+        }
+        createOptionList("env_retract_gear_skip", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_retract_gear_skip"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["close_valve_retract_gear"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["close_valve_retract_gear"].style.gridColumn="-1";
+_machine_events["close_valve_retract_gear"].innerHTML = "close_valve_retract_gear";
+_machine_events["close_valve_retract_gear"].parameterNames = [];
+_machine_events["close_valve_retract_gear"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["close_valve_retract_gear"] == null ?? true) {
+      transition = _machine["_tr_close_valve_retract_gear"]();
+      _transition_list[index]["close_valve_retract_gear"] = transition;
+  } else {
+      transition = _transition_list[index]["close_valve_retract_gear"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event close_valve_retract_gear is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event close_valve_retract_gear!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event close_valve_retract_gear!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.close_valve_retract_gear(...parameters);
+    createHistoryElement("close_valve_retract_gear(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "close_valve_retract_gear", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["close_valve_retract_gear"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["close_valve_retract_gear"].disabled = true;
+        }
+        createOptionList("close_valve_retract_gear", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["close_valve_retract_gear"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["evn_close_general_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["evn_close_general_valve"].style.gridColumn="-1";
+_machine_events["evn_close_general_valve"].innerHTML = "evn_close_general_valve";
+_machine_events["evn_close_general_valve"].parameterNames = [];
+_machine_events["evn_close_general_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["evn_close_general_valve"] == null ?? true) {
+      transition = _machine["_tr_evn_close_general_valve"]();
+      _transition_list[index]["evn_close_general_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["evn_close_general_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event evn_close_general_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event evn_close_general_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event evn_close_general_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.evn_close_general_valve(...parameters);
+    createHistoryElement("evn_close_general_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "evn_close_general_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["evn_close_general_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["evn_close_general_valve"].disabled = true;
+        }
+        createOptionList("evn_close_general_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["evn_close_general_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["close_valve_extend_gear"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["close_valve_extend_gear"].style.gridColumn="-1";
+_machine_events["close_valve_extend_gear"].innerHTML = "close_valve_extend_gear";
+_machine_events["close_valve_extend_gear"].parameterNames = [];
+_machine_events["close_valve_extend_gear"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["close_valve_extend_gear"] == null ?? true) {
+      transition = _machine["_tr_close_valve_extend_gear"]();
+      _transition_list[index]["close_valve_extend_gear"] = transition;
+  } else {
+      transition = _transition_list[index]["close_valve_extend_gear"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event close_valve_extend_gear is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event close_valve_extend_gear!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event close_valve_extend_gear!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.close_valve_extend_gear(...parameters);
+    createHistoryElement("close_valve_extend_gear(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "close_valve_extend_gear", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["close_valve_extend_gear"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["close_valve_extend_gear"].disabled = true;
+        }
+        createOptionList("close_valve_extend_gear", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["close_valve_extend_gear"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stimulate_general_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stimulate_general_valve"].style.gridColumn="-1";
+_machine_events["con_stimulate_general_valve"].innerHTML = "con_stimulate_general_valve";
+_machine_events["con_stimulate_general_valve"].parameterNames = [];
+_machine_events["con_stimulate_general_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stimulate_general_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stimulate_general_valve"]();
+      _transition_list[index]["con_stimulate_general_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stimulate_general_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stimulate_general_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stimulate_general_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stimulate_general_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stimulate_general_valve(...parameters);
+    createHistoryElement("con_stimulate_general_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stimulate_general_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stimulate_general_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stimulate_general_valve"].disabled = true;
+        }
+        createOptionList("con_stimulate_general_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stimulate_general_valve"]);
+
+_svg_events["con_stimulate_general_valve"] = document.getElementById("architecture").contentDocument.getElementById("con_stimulate_general_valve");
+_svg_events["con_stimulate_general_valve"].onclick = function() {
+  var parameters = {
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stimulate_general_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stimulate_general_valve"]();
+      _transition_list[index]["con_stimulate_general_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stimulate_general_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stimulate_general_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stimulate_general_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stimulate_general_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stimulate_general_valve(...parameters);
+    createHistoryElement("con_stimulate_general_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stimulate_general_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stimulate_general_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stimulate_general_valve"].disabled = true;
+        }
+        createOptionList("con_stimulate_general_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["close_valve_door_open"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["close_valve_door_open"].style.gridColumn="-1";
+_machine_events["close_valve_door_open"].innerHTML = "close_valve_door_open";
+_machine_events["close_valve_door_open"].parameterNames = [];
+_machine_events["close_valve_door_open"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["close_valve_door_open"] == null ?? true) {
+      transition = _machine["_tr_close_valve_door_open"]();
+      _transition_list[index]["close_valve_door_open"] = transition;
+  } else {
+      transition = _transition_list[index]["close_valve_door_open"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event close_valve_door_open is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event close_valve_door_open!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event close_valve_door_open!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.close_valve_door_open(...parameters);
+    createHistoryElement("close_valve_door_open(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "close_valve_door_open", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["close_valve_door_open"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["close_valve_door_open"].disabled = true;
+        }
+        createOptionList("close_valve_door_open", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["close_valve_door_open"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_start_extending"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_start_extending_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_start_extending_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_start_extending"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_start_extending"].style.gridColumn="-1";
+_machine_events["env_start_extending"].innerHTML = "env_start_extending";
+_machine_events["env_start_extending"].parameterNames = ["gr", ];
+_machine_events["env_start_extending"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_start_extending"] == null ?? true) {
+      transition = _machine["_tr_env_start_extending"]();
+      _transition_list[index]["env_start_extending"] = transition;
+  } else {
+      transition = _transition_list[index]["env_start_extending"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_start_extending is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_start_extending"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_start_extending!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_start_extending!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_start_extending"]["gr"].getValue(), ];
+    var returnValue = _machine.env_start_extending(...parameters);
+    createHistoryElement("env_start_extending(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_start_extending"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_start_extending", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_start_extending"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_start_extending"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_start_extending"].disabled = true;
+        }
+        createOptionList("env_start_extending", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_start_extending"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stimulate_extend_gear_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stimulate_extend_gear_valve"].style.gridColumn="-1";
+_machine_events["con_stimulate_extend_gear_valve"].innerHTML = "con_stimulate_extend_gear_valve";
+_machine_events["con_stimulate_extend_gear_valve"].parameterNames = [];
+_machine_events["con_stimulate_extend_gear_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stimulate_extend_gear_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stimulate_extend_gear_valve"]();
+      _transition_list[index]["con_stimulate_extend_gear_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stimulate_extend_gear_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stimulate_extend_gear_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stimulate_extend_gear_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stimulate_extend_gear_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stimulate_extend_gear_valve(...parameters);
+    createHistoryElement("con_stimulate_extend_gear_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stimulate_extend_gear_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stimulate_extend_gear_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stimulate_extend_gear_valve"].disabled = true;
+        }
+        createOptionList("con_stimulate_extend_gear_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stimulate_extend_gear_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["toggle_handle_down"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["toggle_handle_down"].style.gridColumn="-1";
+_machine_events["toggle_handle_down"].innerHTML = "toggle_handle_down";
+_machine_events["toggle_handle_down"].parameterNames = [];
+_machine_events["toggle_handle_down"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["toggle_handle_down"] == null ?? true) {
+      transition = _machine["_tr_toggle_handle_down"]();
+      _transition_list[index]["toggle_handle_down"] = transition;
+  } else {
+      transition = _transition_list[index]["toggle_handle_down"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event toggle_handle_down is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event toggle_handle_down!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event toggle_handle_down!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.toggle_handle_down(...parameters);
+    createHistoryElement("toggle_handle_down(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "toggle_handle_down", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["toggle_handle_down"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["toggle_handle_down"].disabled = true;
+        }
+        createOptionList("toggle_handle_down", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["toggle_handle_down"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_close_door"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_close_door_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_close_door_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_close_door"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_close_door"].style.gridColumn="-1";
+_machine_events["env_close_door"].innerHTML = "env_close_door";
+_machine_events["env_close_door"].parameterNames = ["gr", ];
+_machine_events["env_close_door"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_close_door"] == null ?? true) {
+      transition = _machine["_tr_env_close_door"]();
+      _transition_list[index]["env_close_door"] = transition;
+  } else {
+      transition = _transition_list[index]["env_close_door"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_close_door is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_close_door"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_close_door!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_close_door!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_close_door"]["gr"].getValue(), ];
+    var returnValue = _machine.env_close_door(...parameters);
+    createHistoryElement("env_close_door(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_close_door"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_close_door", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_close_door"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_close_door"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_close_door"].disabled = true;
+        }
+        createOptionList("env_close_door", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_close_door"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["open_valve_door_close"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["open_valve_door_close"].style.gridColumn="-1";
+_machine_events["open_valve_door_close"].innerHTML = "open_valve_door_close";
+_machine_events["open_valve_door_close"].parameterNames = [];
+_machine_events["open_valve_door_close"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["open_valve_door_close"] == null ?? true) {
+      transition = _machine["_tr_open_valve_door_close"]();
+      _transition_list[index]["open_valve_door_close"] = transition;
+  } else {
+      transition = _transition_list[index]["open_valve_door_close"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event open_valve_door_close is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event open_valve_door_close!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event open_valve_door_close!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.open_valve_door_close(...parameters);
+    createHistoryElement("open_valve_door_close(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "open_valve_door_close", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["open_valve_door_close"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["open_valve_door_close"].disabled = true;
+        }
+        createOptionList("open_valve_door_close", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["open_valve_door_close"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stop_stimulate_extend_gear_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stop_stimulate_extend_gear_valve"].style.gridColumn="-1";
+_machine_events["con_stop_stimulate_extend_gear_valve"].innerHTML = "con_stop_stimulate_extend_gear_valve";
+_machine_events["con_stop_stimulate_extend_gear_valve"].parameterNames = [];
+_machine_events["con_stop_stimulate_extend_gear_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stop_stimulate_extend_gear_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stop_stimulate_extend_gear_valve"]();
+      _transition_list[index]["con_stop_stimulate_extend_gear_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stop_stimulate_extend_gear_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stop_stimulate_extend_gear_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stop_stimulate_extend_gear_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stop_stimulate_extend_gear_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stop_stimulate_extend_gear_valve(...parameters);
+    createHistoryElement("con_stop_stimulate_extend_gear_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stop_stimulate_extend_gear_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stop_stimulate_extend_gear_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stop_stimulate_extend_gear_valve"].disabled = true;
+        }
+        createOptionList("con_stop_stimulate_extend_gear_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stop_stimulate_extend_gear_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stimulate_open_door_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stimulate_open_door_valve"].style.gridColumn="-1";
+_machine_events["con_stimulate_open_door_valve"].innerHTML = "con_stimulate_open_door_valve";
+_machine_events["con_stimulate_open_door_valve"].parameterNames = [];
+_machine_events["con_stimulate_open_door_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stimulate_open_door_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stimulate_open_door_valve"]();
+      _transition_list[index]["con_stimulate_open_door_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stimulate_open_door_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stimulate_open_door_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stimulate_open_door_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stimulate_open_door_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stimulate_open_door_valve(...parameters);
+    createHistoryElement("con_stimulate_open_door_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stimulate_open_door_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stimulate_open_door_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stimulate_open_door_valve"].disabled = true;
+        }
+        createOptionList("con_stimulate_open_door_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stimulate_open_door_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_close_analogical_switch"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_close_analogical_switch"].style.gridColumn="-1";
+_machine_events["env_close_analogical_switch"].innerHTML = "env_close_analogical_switch";
+_machine_events["env_close_analogical_switch"].parameterNames = [];
+_machine_events["env_close_analogical_switch"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_close_analogical_switch"] == null ?? true) {
+      transition = _machine["_tr_env_close_analogical_switch"]();
+      _transition_list[index]["env_close_analogical_switch"] = transition;
+  } else {
+      transition = _transition_list[index]["env_close_analogical_switch"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_close_analogical_switch is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_close_analogical_switch!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_close_analogical_switch!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.env_close_analogical_switch(...parameters);
+    createHistoryElement("env_close_analogical_switch(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "env_close_analogical_switch", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_close_analogical_switch"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_close_analogical_switch"].disabled = true;
+        }
+        createOptionList("env_close_analogical_switch", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_close_analogical_switch"]);
+
+_svg_events["open_switch"] = document.getElementById("architecture").contentDocument.getElementById("open_switch");
+_svg_events["open_switch"].onclick = function() {
+  var parameters = {
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_close_analogical_switch"] == null ?? true) {
+      transition = _machine["_tr_env_close_analogical_switch"]();
+      _transition_list[index]["env_close_analogical_switch"] = transition;
+  } else {
+      transition = _transition_list[index]["env_close_analogical_switch"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_close_analogical_switch is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_close_analogical_switch!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_close_analogical_switch!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.env_close_analogical_switch(...parameters);
+    createHistoryElement("env_close_analogical_switch(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "env_close_analogical_switch", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_close_analogical_switch"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_close_analogical_switch"].disabled = true;
+        }
+        createOptionList("env_close_analogical_switch", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_open_analogical_switch"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_open_analogical_switch"].style.gridColumn="-1";
+_machine_events["env_open_analogical_switch"].innerHTML = "env_open_analogical_switch";
+_machine_events["env_open_analogical_switch"].parameterNames = [];
+_machine_events["env_open_analogical_switch"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_open_analogical_switch"] == null ?? true) {
+      transition = _machine["_tr_env_open_analogical_switch"]();
+      _transition_list[index]["env_open_analogical_switch"] = transition;
+  } else {
+      transition = _transition_list[index]["env_open_analogical_switch"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_open_analogical_switch is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_open_analogical_switch!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_open_analogical_switch!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.env_open_analogical_switch(...parameters);
+    createHistoryElement("env_open_analogical_switch(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "env_open_analogical_switch", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_open_analogical_switch"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_open_analogical_switch"].disabled = true;
+        }
+        createOptionList("env_open_analogical_switch", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_open_analogical_switch"]);
+
+_svg_events["close_switch_1"] = document.getElementById("architecture").contentDocument.getElementById("close_switch_1");
+_svg_events["close_switch_1"].onclick = function() {
+  var parameters = {
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_open_analogical_switch"] == null ?? true) {
+      transition = _machine["_tr_env_open_analogical_switch"]();
+      _transition_list[index]["env_open_analogical_switch"] = transition;
+  } else {
+      transition = _transition_list[index]["env_open_analogical_switch"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_open_analogical_switch is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_open_analogical_switch!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_open_analogical_switch!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.env_open_analogical_switch(...parameters);
+    createHistoryElement("env_open_analogical_switch(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "env_open_analogical_switch", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_open_analogical_switch"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_open_analogical_switch"].disabled = true;
+        }
+        createOptionList("env_open_analogical_switch", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stimulate_retract_gear_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stimulate_retract_gear_valve"].style.gridColumn="-1";
+_machine_events["con_stimulate_retract_gear_valve"].innerHTML = "con_stimulate_retract_gear_valve";
+_machine_events["con_stimulate_retract_gear_valve"].parameterNames = [];
+_machine_events["con_stimulate_retract_gear_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stimulate_retract_gear_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stimulate_retract_gear_valve"]();
+      _transition_list[index]["con_stimulate_retract_gear_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stimulate_retract_gear_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stimulate_retract_gear_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stimulate_retract_gear_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stimulate_retract_gear_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stimulate_retract_gear_valve(...parameters);
+    createHistoryElement("con_stimulate_retract_gear_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stimulate_retract_gear_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stimulate_retract_gear_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stimulate_retract_gear_valve"].disabled = true;
+        }
+        createOptionList("con_stimulate_retract_gear_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stimulate_retract_gear_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stop_stimulate_open_door_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stop_stimulate_open_door_valve"].style.gridColumn="-1";
+_machine_events["con_stop_stimulate_open_door_valve"].innerHTML = "con_stop_stimulate_open_door_valve";
+_machine_events["con_stop_stimulate_open_door_valve"].parameterNames = [];
+_machine_events["con_stop_stimulate_open_door_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stop_stimulate_open_door_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stop_stimulate_open_door_valve"]();
+      _transition_list[index]["con_stop_stimulate_open_door_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stop_stimulate_open_door_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stop_stimulate_open_door_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stop_stimulate_open_door_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stop_stimulate_open_door_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stop_stimulate_open_door_valve(...parameters);
+    createHistoryElement("con_stop_stimulate_open_door_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stop_stimulate_open_door_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stop_stimulate_open_door_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stop_stimulate_open_door_valve"].disabled = true;
+        }
+        createOptionList("con_stop_stimulate_open_door_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stop_stimulate_open_door_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["open_valve_door_open"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["open_valve_door_open"].style.gridColumn="-1";
+_machine_events["open_valve_door_open"].innerHTML = "open_valve_door_open";
+_machine_events["open_valve_door_open"].parameterNames = [];
+_machine_events["open_valve_door_open"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["open_valve_door_open"] == null ?? true) {
+      transition = _machine["_tr_open_valve_door_open"]();
+      _transition_list[index]["open_valve_door_open"] = transition;
+  } else {
+      transition = _transition_list[index]["open_valve_door_open"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event open_valve_door_open is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event open_valve_door_open!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event open_valve_door_open!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.open_valve_door_open(...parameters);
+    createHistoryElement("open_valve_door_open(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "open_valve_door_open", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["open_valve_door_open"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["open_valve_door_open"].disabled = true;
+        }
+        createOptionList("open_valve_door_open", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["open_valve_door_open"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_retract_gear_last"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_retract_gear_last_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_retract_gear_last_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_retract_gear_last"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_retract_gear_last"].style.gridColumn="-1";
+_machine_events["env_retract_gear_last"].innerHTML = "env_retract_gear_last";
+_machine_events["env_retract_gear_last"].parameterNames = ["gr", ];
+_machine_events["env_retract_gear_last"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_retract_gear_last"] == null ?? true) {
+      transition = _machine["_tr_env_retract_gear_last"]();
+      _transition_list[index]["env_retract_gear_last"] = transition;
+  } else {
+      transition = _transition_list[index]["env_retract_gear_last"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_retract_gear_last is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_retract_gear_last"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_retract_gear_last!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_retract_gear_last!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_retract_gear_last"]["gr"].getValue(), ];
+    var returnValue = _machine.env_retract_gear_last(...parameters);
+    createHistoryElement("env_retract_gear_last(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_retract_gear_last"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_retract_gear_last", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_retract_gear_last"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_retract_gear_last"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_retract_gear_last"].disabled = true;
+        }
+        createOptionList("env_retract_gear_last", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_retract_gear_last"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["open_valve_retract_gear"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["open_valve_retract_gear"].style.gridColumn="-1";
+_machine_events["open_valve_retract_gear"].innerHTML = "open_valve_retract_gear";
+_machine_events["open_valve_retract_gear"].parameterNames = [];
+_machine_events["open_valve_retract_gear"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["open_valve_retract_gear"] == null ?? true) {
+      transition = _machine["_tr_open_valve_retract_gear"]();
+      _transition_list[index]["open_valve_retract_gear"] = transition;
+  } else {
+      transition = _transition_list[index]["open_valve_retract_gear"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event open_valve_retract_gear is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event open_valve_retract_gear!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event open_valve_retract_gear!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.open_valve_retract_gear(...parameters);
+    createHistoryElement("open_valve_retract_gear(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "open_valve_retract_gear", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["open_valve_retract_gear"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["open_valve_retract_gear"].disabled = true;
+        }
+        createOptionList("open_valve_retract_gear", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["open_valve_retract_gear"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stimulate_close_door_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stimulate_close_door_valve"].style.gridColumn="-1";
+_machine_events["con_stimulate_close_door_valve"].innerHTML = "con_stimulate_close_door_valve";
+_machine_events["con_stimulate_close_door_valve"].parameterNames = [];
+_machine_events["con_stimulate_close_door_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stimulate_close_door_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stimulate_close_door_valve"]();
+      _transition_list[index]["con_stimulate_close_door_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stimulate_close_door_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stimulate_close_door_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stimulate_close_door_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stimulate_close_door_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stimulate_close_door_valve(...parameters);
+    createHistoryElement("con_stimulate_close_door_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stimulate_close_door_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stimulate_close_door_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stimulate_close_door_valve"].disabled = true;
+        }
+        createOptionList("con_stimulate_close_door_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stimulate_close_door_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stop_stimulate_close_door_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stop_stimulate_close_door_valve"].style.gridColumn="-1";
+_machine_events["con_stop_stimulate_close_door_valve"].innerHTML = "con_stop_stimulate_close_door_valve";
+_machine_events["con_stop_stimulate_close_door_valve"].parameterNames = [];
+_machine_events["con_stop_stimulate_close_door_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stop_stimulate_close_door_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stop_stimulate_close_door_valve"]();
+      _transition_list[index]["con_stop_stimulate_close_door_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stop_stimulate_close_door_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stop_stimulate_close_door_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stop_stimulate_close_door_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stop_stimulate_close_door_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stop_stimulate_close_door_valve(...parameters);
+    createHistoryElement("con_stop_stimulate_close_door_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stop_stimulate_close_door_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stop_stimulate_close_door_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stop_stimulate_close_door_valve"].disabled = true;
+        }
+        createOptionList("con_stop_stimulate_close_door_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stop_stimulate_close_door_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_start_open_door"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_start_open_door_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_start_open_door_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_start_open_door"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_start_open_door"].style.gridColumn="-1";
+_machine_events["env_start_open_door"].innerHTML = "env_start_open_door";
+_machine_events["env_start_open_door"].parameterNames = ["gr", ];
+_machine_events["env_start_open_door"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_start_open_door"] == null ?? true) {
+      transition = _machine["_tr_env_start_open_door"]();
+      _transition_list[index]["env_start_open_door"] = transition;
+  } else {
+      transition = _transition_list[index]["env_start_open_door"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_start_open_door is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_start_open_door"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_start_open_door!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_start_open_door!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_start_open_door"]["gr"].getValue(), ];
+    var returnValue = _machine.env_start_open_door(...parameters);
+    createHistoryElement("env_start_open_door(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_start_open_door"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_start_open_door", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_start_open_door"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_start_open_door"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_start_open_door"].disabled = true;
+        }
+        createOptionList("env_start_open_door", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_start_open_door"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_open_door_last"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_open_door_last_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_open_door_last_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_open_door_last"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_open_door_last"].style.gridColumn="-1";
+_machine_events["env_open_door_last"].innerHTML = "env_open_door_last";
+_machine_events["env_open_door_last"].parameterNames = ["gr", ];
+_machine_events["env_open_door_last"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_open_door_last"] == null ?? true) {
+      transition = _machine["_tr_env_open_door_last"]();
+      _transition_list[index]["env_open_door_last"] = transition;
+  } else {
+      transition = _transition_list[index]["env_open_door_last"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_open_door_last is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_open_door_last"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_open_door_last!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_open_door_last!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_open_door_last"]["gr"].getValue(), ];
+    var returnValue = _machine.env_open_door_last(...parameters);
+    createHistoryElement("env_open_door_last(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_open_door_last"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_open_door_last", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_open_door_last"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_open_door_last"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_open_door_last"].disabled = true;
+        }
+        createOptionList("env_open_door_last", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_open_door_last"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["land_plane"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["land_plane"].style.gridColumn="-1";
+_machine_events["land_plane"].innerHTML = "land_plane";
+_machine_events["land_plane"].parameterNames = [];
+_machine_events["land_plane"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["land_plane"] == null ?? true) {
+      transition = _machine["_tr_land_plane"]();
+      _transition_list[index]["land_plane"] = transition;
+  } else {
+      transition = _transition_list[index]["land_plane"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event land_plane is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event land_plane!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event land_plane!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.land_plane(...parameters);
+    createHistoryElement("land_plane(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "land_plane", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["land_plane"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["land_plane"].disabled = true;
+        }
+        createOptionList("land_plane", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["land_plane"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_start_retracting_first"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_start_retracting_first_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_start_retracting_first_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_start_retracting_first"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_start_retracting_first"].style.gridColumn="-1";
+_machine_events["env_start_retracting_first"].innerHTML = "env_start_retracting_first";
+_machine_events["env_start_retracting_first"].parameterNames = ["gr", ];
+_machine_events["env_start_retracting_first"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_start_retracting_first"] == null ?? true) {
+      transition = _machine["_tr_env_start_retracting_first"]();
+      _transition_list[index]["env_start_retracting_first"] = transition;
+  } else {
+      transition = _transition_list[index]["env_start_retracting_first"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_start_retracting_first is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_start_retracting_first"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_start_retracting_first!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_start_retracting_first!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_start_retracting_first"]["gr"].getValue(), ];
+    var returnValue = _machine.env_start_retracting_first(...parameters);
+    createHistoryElement("env_start_retracting_first(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_start_retracting_first"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_start_retracting_first", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_start_retracting_first"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_start_retracting_first"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_start_retracting_first"].disabled = true;
+        }
+        createOptionList("env_start_retracting_first", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_start_retracting_first"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_close_door_skip"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_close_door_skip_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_close_door_skip_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_close_door_skip"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_close_door_skip"].style.gridColumn="-1";
+_machine_events["env_close_door_skip"].innerHTML = "env_close_door_skip";
+_machine_events["env_close_door_skip"].parameterNames = ["gr", ];
+_machine_events["env_close_door_skip"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_close_door_skip"] == null ?? true) {
+      transition = _machine["_tr_env_close_door_skip"]();
+      _transition_list[index]["env_close_door_skip"] = transition;
+  } else {
+      transition = _transition_list[index]["env_close_door_skip"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_close_door_skip is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_close_door_skip"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_close_door_skip!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_close_door_skip!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_close_door_skip"]["gr"].getValue(), ];
+    var returnValue = _machine.env_close_door_skip(...parameters);
+    createHistoryElement("env_close_door_skip(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_close_door_skip"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_close_door_skip", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_close_door_skip"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_close_door_skip"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_close_door_skip"].disabled = true;
+        }
+        createOptionList("env_close_door_skip", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_close_door_skip"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["begin_flying"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["begin_flying"].style.gridColumn="-1";
+_machine_events["begin_flying"].innerHTML = "begin_flying";
+_machine_events["begin_flying"].parameterNames = [];
+_machine_events["begin_flying"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["begin_flying"] == null ?? true) {
+      transition = _machine["_tr_begin_flying"]();
+      _transition_list[index]["begin_flying"] = transition;
+  } else {
+      transition = _transition_list[index]["begin_flying"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event begin_flying is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event begin_flying!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event begin_flying!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.begin_flying(...parameters);
+    createHistoryElement("begin_flying(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "begin_flying", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["begin_flying"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["begin_flying"].disabled = true;
+        }
+        createOptionList("begin_flying", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["begin_flying"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["evn_open_general_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["evn_open_general_valve"].style.gridColumn="-1";
+_machine_events["evn_open_general_valve"].innerHTML = "evn_open_general_valve";
+_machine_events["evn_open_general_valve"].parameterNames = [];
+_machine_events["evn_open_general_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["evn_open_general_valve"] == null ?? true) {
+      transition = _machine["_tr_evn_open_general_valve"]();
+      _transition_list[index]["evn_open_general_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["evn_open_general_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event evn_open_general_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event evn_open_general_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event evn_open_general_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.evn_open_general_valve(...parameters);
+    createHistoryElement("evn_open_general_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "evn_open_general_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["evn_open_general_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["evn_open_general_valve"].disabled = true;
+        }
+        createOptionList("evn_open_general_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["evn_open_general_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["close_valve_door_close"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["close_valve_door_close"].style.gridColumn="-1";
+_machine_events["close_valve_door_close"].innerHTML = "close_valve_door_close";
+_machine_events["close_valve_door_close"].parameterNames = [];
+_machine_events["close_valve_door_close"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["close_valve_door_close"] == null ?? true) {
+      transition = _machine["_tr_close_valve_door_close"]();
+      _transition_list[index]["close_valve_door_close"] = transition;
+  } else {
+      transition = _transition_list[index]["close_valve_door_close"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event close_valve_door_close is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event close_valve_door_close!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event close_valve_door_close!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.close_valve_door_close(...parameters);
+    createHistoryElement("close_valve_door_close(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "close_valve_door_close", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["close_valve_door_close"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["close_valve_door_close"].disabled = true;
+        }
+        createOptionList("close_valve_door_close", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["close_valve_door_close"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stop_stimulate_general_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stop_stimulate_general_valve"].style.gridColumn="-1";
+_machine_events["con_stop_stimulate_general_valve"].innerHTML = "con_stop_stimulate_general_valve";
+_machine_events["con_stop_stimulate_general_valve"].parameterNames = [];
+_machine_events["con_stop_stimulate_general_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stop_stimulate_general_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stop_stimulate_general_valve"]();
+      _transition_list[index]["con_stop_stimulate_general_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stop_stimulate_general_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stop_stimulate_general_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stop_stimulate_general_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stop_stimulate_general_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stop_stimulate_general_valve(...parameters);
+    createHistoryElement("con_stop_stimulate_general_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stop_stimulate_general_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stop_stimulate_general_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stop_stimulate_general_valve"].disabled = true;
+        }
+        createOptionList("con_stop_stimulate_general_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stop_stimulate_general_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_extend_gear_last"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_extend_gear_last_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_extend_gear_last_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_extend_gear_last"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_extend_gear_last"].style.gridColumn="-1";
+_machine_events["env_extend_gear_last"].innerHTML = "env_extend_gear_last";
+_machine_events["env_extend_gear_last"].parameterNames = ["gr", ];
+_machine_events["env_extend_gear_last"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_extend_gear_last"] == null ?? true) {
+      transition = _machine["_tr_env_extend_gear_last"]();
+      _transition_list[index]["env_extend_gear_last"] = transition;
+  } else {
+      transition = _transition_list[index]["env_extend_gear_last"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_extend_gear_last is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_extend_gear_last"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_extend_gear_last!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_extend_gear_last!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_extend_gear_last"]["gr"].getValue(), ];
+    var returnValue = _machine.env_extend_gear_last(...parameters);
+    createHistoryElement("env_extend_gear_last(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_extend_gear_last"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_extend_gear_last", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_extend_gear_last"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_extend_gear_last"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_extend_gear_last"].disabled = true;
+        }
+        createOptionList("env_extend_gear_last", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_extend_gear_last"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_extend_gear_skip"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_extend_gear_skip_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_extend_gear_skip_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_extend_gear_skip"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_extend_gear_skip"].style.gridColumn="-1";
+_machine_events["env_extend_gear_skip"].innerHTML = "env_extend_gear_skip";
+_machine_events["env_extend_gear_skip"].parameterNames = ["gr", ];
+_machine_events["env_extend_gear_skip"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_extend_gear_skip"] == null ?? true) {
+      transition = _machine["_tr_env_extend_gear_skip"]();
+      _transition_list[index]["env_extend_gear_skip"] = transition;
+  } else {
+      transition = _transition_list[index]["env_extend_gear_skip"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_extend_gear_skip is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_extend_gear_skip"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_extend_gear_skip!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_extend_gear_skip!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_extend_gear_skip"]["gr"].getValue(), ];
+    var returnValue = _machine.env_extend_gear_skip(...parameters);
+    createHistoryElement("env_extend_gear_skip(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_extend_gear_skip"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_extend_gear_skip", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_extend_gear_skip"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_extend_gear_skip"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_extend_gear_skip"].disabled = true;
+        }
+        createOptionList("env_extend_gear_skip", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_extend_gear_skip"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_start_close_door"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_start_close_door_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_start_close_door_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_start_close_door"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_start_close_door"].style.gridColumn="-1";
+_machine_events["env_start_close_door"].innerHTML = "env_start_close_door";
+_machine_events["env_start_close_door"].parameterNames = ["gr", ];
+_machine_events["env_start_close_door"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_start_close_door"] == null ?? true) {
+      transition = _machine["_tr_env_start_close_door"]();
+      _transition_list[index]["env_start_close_door"] = transition;
+  } else {
+      transition = _transition_list[index]["env_start_close_door"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_start_close_door is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_start_close_door"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_start_close_door!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_start_close_door!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_start_close_door"]["gr"].getValue(), ];
+    var returnValue = _machine.env_start_close_door(...parameters);
+    createHistoryElement("env_start_close_door(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_start_close_door"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_start_close_door", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_start_close_door"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_start_close_door"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_start_close_door"].disabled = true;
+        }
+        createOptionList("env_start_close_door", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_start_close_door"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["open_valve_extend_gear"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["open_valve_extend_gear"].style.gridColumn="-1";
+_machine_events["open_valve_extend_gear"].innerHTML = "open_valve_extend_gear";
+_machine_events["open_valve_extend_gear"].parameterNames = [];
+_machine_events["open_valve_extend_gear"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["open_valve_extend_gear"] == null ?? true) {
+      transition = _machine["_tr_open_valve_extend_gear"]();
+      _transition_list[index]["open_valve_extend_gear"] = transition;
+  } else {
+      transition = _transition_list[index]["open_valve_extend_gear"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event open_valve_extend_gear is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event open_valve_extend_gear!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event open_valve_extend_gear!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.open_valve_extend_gear(...parameters);
+    createHistoryElement("open_valve_extend_gear(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "open_valve_extend_gear", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["open_valve_extend_gear"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["open_valve_extend_gear"].disabled = true;
+        }
+        createOptionList("open_valve_extend_gear", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["open_valve_extend_gear"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["con_stop_stimulate_retract_gear_valve"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["con_stop_stimulate_retract_gear_valve"].style.gridColumn="-1";
+_machine_events["con_stop_stimulate_retract_gear_valve"].innerHTML = "con_stop_stimulate_retract_gear_valve";
+_machine_events["con_stop_stimulate_retract_gear_valve"].parameterNames = [];
+_machine_events["con_stop_stimulate_retract_gear_valve"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["con_stop_stimulate_retract_gear_valve"] == null ?? true) {
+      transition = _machine["_tr_con_stop_stimulate_retract_gear_valve"]();
+      _transition_list[index]["con_stop_stimulate_retract_gear_valve"] = transition;
+  } else {
+      transition = _transition_list[index]["con_stop_stimulate_retract_gear_valve"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event con_stop_stimulate_retract_gear_valve is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event con_stop_stimulate_retract_gear_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event con_stop_stimulate_retract_gear_valve!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.con_stop_stimulate_retract_gear_valve(...parameters);
+    createHistoryElement("con_stop_stimulate_retract_gear_valve(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "con_stop_stimulate_retract_gear_valve", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["con_stop_stimulate_retract_gear_valve"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["con_stop_stimulate_retract_gear_valve"].disabled = true;
+        }
+        createOptionList("con_stop_stimulate_retract_gear_valve", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["con_stop_stimulate_retract_gear_valve"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["env_open_door_skip"] = document.createElement("button");
+var gr_label = document.createElement("label")
+gr_label.textContent = "gr:";
+gr_label.htmlFor="gr";
+_param_div.appendChild(gr_label);
+var gr = document.createElement("input");
+gr.id="gr";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="env_open_door_skip_gr_datalist";
+_param_div.appendChild(_param_datalist);
+gr.setAttribute("list", "env_open_door_skip_gr_datalist");
+gr.getValue = function() {return POSITION["get_" + this.value]()}
+gr.parseValue = function(value) {return POSITION["get_" + value]()}
+_param_div.appendChild(gr);
+_machine_events["env_open_door_skip"]["gr"] = gr;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["env_open_door_skip"].style.gridColumn="-1";
+_machine_events["env_open_door_skip"].innerHTML = "env_open_door_skip";
+_machine_events["env_open_door_skip"].parameterNames = ["gr", ];
+_machine_events["env_open_door_skip"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["env_open_door_skip"] == null ?? true) {
+      transition = _machine["_tr_env_open_door_skip"]();
+      _transition_list[index]["env_open_door_skip"] = transition;
+  } else {
+      transition = _transition_list[index]["env_open_door_skip"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event env_open_door_skip is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_open_door_skip"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event env_open_door_skip!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event env_open_door_skip!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.gr ?? _machine_events["env_open_door_skip"]["gr"].getValue(), ];
+    var returnValue = _machine.env_open_door_skip(...parameters);
+    createHistoryElement("env_open_door_skip(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["gr"] = _machine_events["env_open_door_skip"]["gr"].getValue().toString();
+
+    _current_trace.push({name: "env_open_door_skip", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.gr ?? _machine_events["env_open_door_skip"]["gr"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["env_open_door_skip"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["env_open_door_skip"].disabled = true;
+        }
+        createOptionList("env_open_door_skip", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["env_open_door_skip"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["toggle_handle_up"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["toggle_handle_up"].style.gridColumn="-1";
+_machine_events["toggle_handle_up"].innerHTML = "toggle_handle_up";
+_machine_events["toggle_handle_up"].parameterNames = [];
+_machine_events["toggle_handle_up"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["toggle_handle_up"] == null ?? true) {
+      transition = _machine["_tr_toggle_handle_up"]();
+      _transition_list[index]["toggle_handle_up"] = transition;
+  } else {
+      transition = _transition_list[index]["toggle_handle_up"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event toggle_handle_up is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event toggle_handle_up!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event toggle_handle_up!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.toggle_handle_up(...parameters);
+    createHistoryElement("toggle_handle_up(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "toggle_handle_up", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["toggle_handle_up"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["toggle_handle_up"].disabled = true;
+        }
+        createOptionList("toggle_handle_up", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["toggle_handle_up"]);
+
+
+
+
+updateVisuals();
+if(_operations_view.querySelectorAll("label").length == 0) {
+    document.documentElement.style.setProperty('--noneOrGrid', 'none');
+}
+
+function displayTrace(trace) {
+    selectHistoryElement(-_history_view.querySelector(".active").index);
+    let transitions = trace.transitionList
+    for(let transition of transitions) {
+      if(transition.name.startsWith("$")) {
+        continue;
+      }
+      if(transition.params == null) {
+        transition.params = {};
+      }
+      let parameters = Object.keys(transition.params).map(param => _machine_events[transition.name][param].parseValue(transition.params[param]))
+      let returnValue = _machine[transition.name](...parameters);
+      createHistoryElement(transition.name + "(" + parameters.join(", ") + ")" + (returnValue? " (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+      let parametersJSON = {};
+
+      _current_trace.push({name: transition.name, params: parametersJSON});
+    }
+    updateVisuals();
+    selectHistoryElement(_history_view.querySelector("span:last-of-type").index-_history_view.querySelector(".active").index);
+}
+
+function importTrace() {
+    var _file_input = document.querySelector("#_upload_trace_input");
+    _file_input.accept = ".prob2trace";
+
+    _file_input.onchange = async _ => {
+        let files = Array.from(_file_input.files);
+        let file = files[0];
+        let response = await fetch(file.name);
+        let data = await response.text();
+        let trace = JSON.parse(data);
+        createScenarioElement(file.name, trace);
+
+        try {
+            displayTrace(trace);
+        } catch (error) {
+            alert("Trace could not be completely imported.");
+            console.error(error);
+        }
+    };
+
+    _file_input.click();
+}
+
+function exportTrace() {
+  var transitions = _current_trace;
+  var object = {
+    description: "Created from B2Program JS Export",
+    transitionList: transitions,
+    metadata: {
+      fileType: "Trace",
+      formatVersion: 1,
+      savedAt: "2022-05-18T12:00:01.661297Z",
+      creator: "B2Program JS",
+      modelName: "LandingGear_R6"
+    }
+  };
+  const blob = new Blob([JSON.stringify(object, null, '\t')]);
+  const a = document.createElement('a');
+  a.href = URL.createObjectURL(blob);
+  a.download = 'Scenario.prob2trace';
+  a.click();
+}
+
+function sleep(ms) {
+    return new Promise(resolve => setTimeout(resolve, ms));
+}
+
+async function runTrace(ms) {
+    let firstElement = _history_view.querySelector("span");
+    firstElement.click();
+    let currentHistoryElement = _history_view.querySelector(".active");
+    let index = currentHistoryElement.index + 1;
+    while (index >= 0 && index < _state_list.length) {
+      selectHistoryElement(1);
+      await sleep(ms);
+      currentHistoryElement = _history_view.querySelector(".active");
+      index = currentHistoryElement.index + 1;
+    }
+}
diff --git a/B2Program/LandingGear/HydraulicCircuit/LandingGear_R6.html b/B2Program/LandingGear/HydraulicCircuit/LandingGear_R6.html
new file mode 100644
index 0000000000000000000000000000000000000000..9bb6226c144f7b40128c0061aeed6e319f3ca1ee
--- /dev/null
+++ b/B2Program/LandingGear/HydraulicCircuit/LandingGear_R6.html
@@ -0,0 +1,145 @@
+<!doctype html>
+
+<html lang="en">
+<head>
+  <meta charset="utf-8">
+  <title>LandingGear_R6</title>
+<head>
+
+<body>
+  <div>
+    <h1>Visualization <br></h1>
+    <object id="architecture" data="architecture.svg" type="image/svg+xml"></object>
+  </div>
+  <div>
+      <h1>Operations View <br></h1>
+      <div id="_operations_view">
+        <div class="param" style="grid-column: span 2;">Parameter</div>
+        <div style="text-align: center; grid-column: -1;">Event</div>
+      </div>
+  </div>
+  <div>
+    <h1>History View <br></h1>
+    <div id="_history_view_buttons">
+        <input id="_upload_trace_input" type="file" style="display:none;"></input>
+        <input id="_export_trace" type="file" style="display:none;"></input>
+    </div>
+    <div id="_history_view">
+    </div>
+    <br>
+    <br>
+    <h1>Scenario View <br></h1>
+    <div id="_scenario_view">
+    </div>
+  </div>
+  <div id="_state_view">
+    <h1>State View <br></h1>
+    <div id="_state_view_variables" class="state_view_section">
+        <div class="state_view_header collapsed" onclick="collapse(this)">Variables</div>
+    </div>
+    <div id="_state_view_constants" class="state_view_section">
+        <div class="state_view_header collapsed" onclick="collapse(this)">Constants</div>
+    </div>
+    <div id="_state_view_sets" class="state_view_section">
+            <div class="state_view_header collapsed" onclick="collapse(this)">Sets</div>
+        </div>
+    <div id="_state_view_invariant" class="state_view_section">
+            <div class="state_view_header collapsed" onclick="collapse(this)">Invariant</div>
+        </div>
+  </div>
+  <script type="module" src="./btypes/BTuple.js"></script>
+  <script type="module" src="./btypes/BRelation.js"></script>
+  <script type="module" src="./btypes/BBoolean.js"></script>
+  <script type="module" src="./btypes/BSet.js"></script>
+  <script type="module" src="./btypes/BObject.js"></script>
+  <script type="module" src="./LandingGear_R6.js"></script>
+  <script type="module" src="./LandingGear_R6-visualisation.js" defer></script>
+</body>
+
+<script>
+function collapse(element) {
+    element.classList.toggle("collapsed");
+}
+</script>
+<style>
+#_operations_view{
+    display: grid;
+    grid-template-columns: auto auto auto;
+    gap: 0.5%;
+    margin-bottom: auto;
+    margin-right: 1rem;
+}
+:root {
+    --noneOrGrid: grid;
+}
+.param{
+    display: var(--noneOrGrid);
+    grid-column: span 2;
+    grid-template-columns: subgrid;
+    gap: 5px;
+}
+#_history_view{
+    margin-bottom: auto;
+    margin-right: 1rem;
+    overflow-y  : auto;
+    padding-right: 18px;
+    max-height: 90vh;
+}
+#_history_view > span.active {
+    background: lightblue;
+}
+#_history_view_buttons {
+    display: grid;
+    grid-template-columns: 1fr 1fr;
+}
+
+#_scenario_view{
+    margin-right: 1rem;
+    overflow-y  : auto;
+    padding-right: 18px;
+    gap: 5%;
+    display: grid;
+}
+#_scenario_view > span.active {
+    background: lightblue;
+}
+#_scenario_view_buttons {
+    display: grid;
+    grid-template-columns: 1fr 1fr;
+}
+
+.state_view_section {
+    display: grid;
+    grid-template-columns: auto auto;
+    gap: 0px 20px;
+}
+.state_view_header {
+    grid-column: 1 / -1;
+    border-bottom: 1px solid black;
+}
+
+.state_view_header:only-child {
+    display: none;
+}
+
+.state_view_header::after {
+    content: "\25B2";
+    margin-left: 5px;
+    float: right;
+}
+.collapsed ~ * {
+    display: none;
+}
+.collapsed::after {
+    content: "\25BC";
+}
+body {
+display: flex;
+flex-direction: row;
+flex-wrap: wrap;
+gap: 20px;
+align-items: start;
+}
+</style>
+
+</html>
diff --git a/B2Program/LandingGear/HydraulicCircuit/LandingGear_R6.js b/B2Program/LandingGear/HydraulicCircuit/LandingGear_R6.js
new file mode 100644
index 0000000000000000000000000000000000000000..14fa2f92c584620f805cfdc7e8a9d0bbd4713e1b
--- /dev/null
+++ b/B2Program/LandingGear/HydraulicCircuit/LandingGear_R6.js
@@ -0,0 +1,918 @@
+import { BTuple } from './btypes/BTuple.js';
+import { BBoolean } from './btypes/BBoolean.js';
+import { BRelation } from './btypes/BRelation.js';
+import { BSet } from './btypes/BSet.js';
+import { BUtils } from "./btypes/BUtils.js";
+import { SelectError } from "./btypes/BUtils.js";
+export var enum_DOOR_STATE;
+(function (enum_DOOR_STATE) {
+    enum_DOOR_STATE[enum_DOOR_STATE["open"] = 0] = "open";
+    enum_DOOR_STATE[enum_DOOR_STATE["closed"] = 1] = "closed";
+    enum_DOOR_STATE[enum_DOOR_STATE["door_moving"] = 2] = "door_moving";
+})(enum_DOOR_STATE || (enum_DOOR_STATE = {}));
+export class DOOR_STATE {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof DOOR_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_DOOR_STATE[this.value].toString();
+    }
+    static get_open() { return new DOOR_STATE(enum_DOOR_STATE.open); }
+    static get_closed() { return new DOOR_STATE(enum_DOOR_STATE.closed); }
+    static get_door_moving() { return new DOOR_STATE(enum_DOOR_STATE.door_moving); }
+}
+export var enum_GEAR_STATE;
+(function (enum_GEAR_STATE) {
+    enum_GEAR_STATE[enum_GEAR_STATE["retracted"] = 0] = "retracted";
+    enum_GEAR_STATE[enum_GEAR_STATE["extended"] = 1] = "extended";
+    enum_GEAR_STATE[enum_GEAR_STATE["gear_moving"] = 2] = "gear_moving";
+})(enum_GEAR_STATE || (enum_GEAR_STATE = {}));
+export class GEAR_STATE {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof GEAR_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_GEAR_STATE[this.value].toString();
+    }
+    static get_retracted() { return new GEAR_STATE(enum_GEAR_STATE.retracted); }
+    static get_extended() { return new GEAR_STATE(enum_GEAR_STATE.extended); }
+    static get_gear_moving() { return new GEAR_STATE(enum_GEAR_STATE.gear_moving); }
+}
+export var enum_HANDLE_STATE;
+(function (enum_HANDLE_STATE) {
+    enum_HANDLE_STATE[enum_HANDLE_STATE["up"] = 0] = "up";
+    enum_HANDLE_STATE[enum_HANDLE_STATE["down"] = 1] = "down";
+})(enum_HANDLE_STATE || (enum_HANDLE_STATE = {}));
+export class HANDLE_STATE {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof HANDLE_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_HANDLE_STATE[this.value].toString();
+    }
+    static get_up() { return new HANDLE_STATE(enum_HANDLE_STATE.up); }
+    static get_down() { return new HANDLE_STATE(enum_HANDLE_STATE.down); }
+}
+export var enum_POSITION;
+(function (enum_POSITION) {
+    enum_POSITION[enum_POSITION["fr"] = 0] = "fr";
+    enum_POSITION[enum_POSITION["lt"] = 1] = "lt";
+    enum_POSITION[enum_POSITION["rt"] = 2] = "rt";
+})(enum_POSITION || (enum_POSITION = {}));
+export class POSITION {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof POSITION)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_POSITION[this.value].toString();
+    }
+    static get_fr() { return new POSITION(enum_POSITION.fr); }
+    static get_lt() { return new POSITION(enum_POSITION.lt); }
+    static get_rt() { return new POSITION(enum_POSITION.rt); }
+}
+export var enum_SWITCH_STATE;
+(function (enum_SWITCH_STATE) {
+    enum_SWITCH_STATE[enum_SWITCH_STATE["switch_open"] = 0] = "switch_open";
+    enum_SWITCH_STATE[enum_SWITCH_STATE["switch_closed"] = 1] = "switch_closed";
+})(enum_SWITCH_STATE || (enum_SWITCH_STATE = {}));
+export class SWITCH_STATE {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof SWITCH_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_SWITCH_STATE[this.value].toString();
+    }
+    static get_switch_open() { return new SWITCH_STATE(enum_SWITCH_STATE.switch_open); }
+    static get_switch_closed() { return new SWITCH_STATE(enum_SWITCH_STATE.switch_closed); }
+}
+export var enum_PLANE_STATE;
+(function (enum_PLANE_STATE) {
+    enum_PLANE_STATE[enum_PLANE_STATE["ground"] = 0] = "ground";
+    enum_PLANE_STATE[enum_PLANE_STATE["flight"] = 1] = "flight";
+})(enum_PLANE_STATE || (enum_PLANE_STATE = {}));
+export class PLANE_STATE {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof PLANE_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_PLANE_STATE[this.value].toString();
+    }
+    static get_ground() { return new PLANE_STATE(enum_PLANE_STATE.ground); }
+    static get_flight() { return new PLANE_STATE(enum_PLANE_STATE.flight); }
+}
+export var enum_VALVE_STATE;
+(function (enum_VALVE_STATE) {
+    enum_VALVE_STATE[enum_VALVE_STATE["valve_open"] = 0] = "valve_open";
+    enum_VALVE_STATE[enum_VALVE_STATE["valve_closed"] = 1] = "valve_closed";
+})(enum_VALVE_STATE || (enum_VALVE_STATE = {}));
+export class VALVE_STATE {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof VALVE_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_VALVE_STATE[this.value].toString();
+    }
+    static get_valve_open() { return new VALVE_STATE(enum_VALVE_STATE.valve_open); }
+    static get_valve_closed() { return new VALVE_STATE(enum_VALVE_STATE.valve_closed); }
+}
+export default class LandingGear_R6 {
+    constructor() {
+        this.gears = BRelation.cartesianProduct(LandingGear_R6._POSITION, new BSet(new GEAR_STATE(enum_GEAR_STATE.extended)));
+        this.doors = BRelation.cartesianProduct(LandingGear_R6._POSITION, new BSet(new DOOR_STATE(enum_DOOR_STATE.closed)));
+        this.handle = new HANDLE_STATE(enum_HANDLE_STATE.down);
+        this.valve_extend_gear = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.valve_retract_gear = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.valve_open_door = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.valve_close_door = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.open_EV = new BBoolean(false);
+        this.close_EV = new BBoolean(false);
+        this.retract_EV = new BBoolean(false);
+        this.extend_EV = new BBoolean(false);
+        this.shock_absorber = new PLANE_STATE(enum_PLANE_STATE.ground);
+        this.general_EV = new BBoolean(false);
+        this.general_valve = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.analogical_switch = new SWITCH_STATE(enum_SWITCH_STATE.switch_open);
+        this.handle_move = new BBoolean(false);
+        this.gear = new GEAR_STATE(enum_GEAR_STATE.extended);
+        this.door = new DOOR_STATE(enum_DOOR_STATE.closed);
+    }
+    _copy() {
+        var _a, _b, _c;
+        let _instance = Object.create(LandingGear_R6.prototype);
+        for (let key of Object.keys(this)) {
+            _instance[key] = (_c = (_b = (_a = this[key])._copy) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : this[key];
+        }
+        return _instance;
+    }
+    begin_flying() {
+        if ((this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground))).booleanValue()) {
+            this.shock_absorber = new PLANE_STATE(enum_PLANE_STATE.flight);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    land_plane() {
+        if ((this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.flight))).booleanValue()) {
+            this.shock_absorber = new PLANE_STATE(enum_PLANE_STATE.ground);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    open_valve_door_open() {
+        if ((new BBoolean(this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.valve_open_door = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    close_valve_door_open() {
+        if ((new BBoolean(this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue())).booleanValue()) {
+            this.valve_open_door = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    open_valve_door_close() {
+        if ((new BBoolean(this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.close_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.valve_close_door = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    close_valve_door_close() {
+        if ((new BBoolean(this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue())).booleanValue()) {
+            this.valve_close_door = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    open_valve_retract_gear() {
+        if ((new BBoolean(this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.retract_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.valve_retract_gear = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    close_valve_retract_gear() {
+        if ((new BBoolean(this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue())).booleanValue()) {
+            this.valve_retract_gear = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    open_valve_extend_gear() {
+        if ((new BBoolean(this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.extend_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.valve_extend_gear = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    close_valve_extend_gear() {
+        if ((new BBoolean(this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue())).booleanValue()) {
+            this.valve_extend_gear = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stimulate_open_door_valve() {
+        if ((new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(false)).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).not().booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).not().booleanValue()).booleanValue() && new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).not().booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.open_EV = new BBoolean(true);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stop_stimulate_open_door_valve() {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(true)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.open_EV = new BBoolean(false);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stimulate_close_door_valve() {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.close_EV.equal(new BBoolean(false)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).not().booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.close_EV = new BBoolean(true);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stop_stimulate_close_door_valve() {
+        if ((new BBoolean(new BBoolean(this.close_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.close_EV = new BBoolean(false);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stimulate_retract_gear_valve() {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.retract_EV.equal(new BBoolean(false)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).not().booleanValue()).booleanValue() && this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.flight)).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.retract_EV = new BBoolean(true);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stop_stimulate_retract_gear_valve() {
+        if ((new BBoolean(new BBoolean(this.retract_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.retract_EV = new BBoolean(false);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stimulate_extend_gear_valve() {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.extend_EV.equal(new BBoolean(false)).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).not().booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.extend_EV = new BBoolean(true);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stop_stimulate_extend_gear_valve() {
+        if ((new BBoolean(new BBoolean(this.extend_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.extend_EV = new BBoolean(false);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_start_retracting_first(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() && this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.gear_moving)).elementOf(this.gear).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+            let _ld_gears = this.gears;
+            this.gears = _ld_gears.override(new BRelation(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.gear_moving))));
+            this.gear = new GEAR_STATE(enum_GEAR_STATE.gear_moving);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_retract_gear_skip(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).unequal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.gears = this.gears.override(new BRelation(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.retracted))));
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_retract_gear_last(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+            let _ld_gears = this.gears;
+            this.gears = _ld_gears.override(new BRelation(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.retracted))));
+            this.gear = new GEAR_STATE(enum_GEAR_STATE.retracted);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_start_extending(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() && this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+            let _ld_gears = this.gears;
+            this.gears = _ld_gears.override(new BRelation(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.gear_moving))));
+            this.gear = new GEAR_STATE(enum_GEAR_STATE.gear_moving);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_extend_gear_last(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+            let _ld_gears = this.gears;
+            this.gears = _ld_gears.override(new BRelation(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.extended))));
+            this.gear = new GEAR_STATE(enum_GEAR_STATE.extended);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_extend_gear_skip(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).unequal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.gears = this.gears.override(new BRelation(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.extended))));
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_start_open_door(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.closed)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new DOOR_STATE(enum_DOOR_STATE.closed), new DOOR_STATE(enum_DOOR_STATE.door_moving)).elementOf(this.door).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            let _ld_doors = this.doors;
+            this.doors = _ld_doors.override(new BRelation(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.door_moving))));
+            this.door = new DOOR_STATE(enum_DOOR_STATE.door_moving);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_open_door_last(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            let _ld_doors = this.doors;
+            this.doors = _ld_doors.override(new BRelation(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.open))));
+            this.door = new DOOR_STATE(enum_DOOR_STATE.open);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_open_door_skip(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).unequal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.doors = this.doors.override(new BRelation(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.open))));
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_start_close_door(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new DOOR_STATE(enum_DOOR_STATE.door_moving), new DOOR_STATE(enum_DOOR_STATE.open)).elementOf(this.door).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            let _ld_doors = this.doors;
+            this.doors = _ld_doors.override(new BRelation(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.door_moving))));
+            this.door = new DOOR_STATE(enum_DOOR_STATE.door_moving);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_close_door(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BBoolean(!new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            let _ld_doors = this.doors;
+            this.doors = _ld_doors.override(new BRelation(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.closed))));
+            this.door = new DOOR_STATE(enum_DOOR_STATE.closed);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_close_door_skip(gr) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).unequal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BBoolean(!new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.doors = this.doors.override(new BRelation(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.closed))));
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    toggle_handle_up() {
+        if ((this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down))).booleanValue()) {
+            this.handle = new HANDLE_STATE(enum_HANDLE_STATE.up);
+            this.handle_move = new BBoolean(true);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    toggle_handle_down() {
+        if ((this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up))).booleanValue()) {
+            this.handle = new HANDLE_STATE(enum_HANDLE_STATE.down);
+            this.handle_move = new BBoolean(true);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stimulate_general_valve() {
+        if ((new BBoolean(this.general_EV.equal(new BBoolean(false)).booleanValue() && this.handle_move.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.general_EV = new BBoolean(true);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    con_stop_stimulate_general_valve() {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(true)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() || new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue()).booleanValue() || new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            this.general_EV = new BBoolean(false);
+            this.handle_move = new BBoolean(false);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    evn_open_general_valve() {
+        if ((new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(true)).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue()).booleanValue() && this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_closed)).booleanValue())).booleanValue()) {
+            this.general_valve = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    evn_close_general_valve() {
+        if ((new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(false)).booleanValue() || this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.general_valve = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_close_analogical_switch() {
+        if ((new BBoolean(this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_open)).booleanValue() && this.handle_move.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.analogical_switch = new SWITCH_STATE(enum_SWITCH_STATE.switch_closed);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    env_open_analogical_switch() {
+        if ((this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_closed))).booleanValue()) {
+            this.analogical_switch = new SWITCH_STATE(enum_SWITCH_STATE.switch_open);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    _get_analogical_switch() {
+        return this.analogical_switch;
+    }
+    _get_general_EV() {
+        return this.general_EV;
+    }
+    _get_general_valve() {
+        return this.general_valve;
+    }
+    _get_handle_move() {
+        return this.handle_move;
+    }
+    _get_close_EV() {
+        return this.close_EV;
+    }
+    _get_extend_EV() {
+        return this.extend_EV;
+    }
+    _get_open_EV() {
+        return this.open_EV;
+    }
+    _get_retract_EV() {
+        return this.retract_EV;
+    }
+    _get_shock_absorber() {
+        return this.shock_absorber;
+    }
+    _get_valve_close_door() {
+        return this.valve_close_door;
+    }
+    _get_valve_extend_gear() {
+        return this.valve_extend_gear;
+    }
+    _get_valve_open_door() {
+        return this.valve_open_door;
+    }
+    _get_valve_retract_gear() {
+        return this.valve_retract_gear;
+    }
+    _get_doors() {
+        return this.doors;
+    }
+    _get_gears() {
+        return this.gears;
+    }
+    _get_handle() {
+        return this.handle;
+    }
+    _get_door() {
+        return this.door;
+    }
+    _get_gear() {
+        return this.gear;
+    }
+    _get__DOOR_STATE() {
+        return LandingGear_R6._DOOR_STATE;
+    }
+    _get__GEAR_STATE() {
+        return LandingGear_R6._GEAR_STATE;
+    }
+    _get__HANDLE_STATE() {
+        return LandingGear_R6._HANDLE_STATE;
+    }
+    _get__POSITION() {
+        return LandingGear_R6._POSITION;
+    }
+    _get__SWITCH_STATE() {
+        return LandingGear_R6._SWITCH_STATE;
+    }
+    _get__PLANE_STATE() {
+        return LandingGear_R6._PLANE_STATE;
+    }
+    _get__VALVE_STATE() {
+        return LandingGear_R6._VALVE_STATE;
+    }
+    _tr_begin_flying() {
+        return this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue();
+    }
+    _tr_land_plane() {
+        return this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.flight)).booleanValue();
+    }
+    _tr_open_valve_door_open() {
+        return new BBoolean(this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_close_valve_door_open() {
+        return new BBoolean(this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue();
+    }
+    _tr_open_valve_door_close() {
+        return new BBoolean(this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.close_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_close_valve_door_close() {
+        return new BBoolean(this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue();
+    }
+    _tr_open_valve_retract_gear() {
+        return new BBoolean(this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.retract_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_close_valve_retract_gear() {
+        return new BBoolean(this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue();
+    }
+    _tr_open_valve_extend_gear() {
+        return new BBoolean(this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.extend_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_close_valve_extend_gear() {
+        return new BBoolean(this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue();
+    }
+    _tr_con_stimulate_open_door_valve() {
+        return new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(false)).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).not().booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).not().booleanValue()).booleanValue() && new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).not().booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_con_stop_stimulate_open_door_valve() {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(true)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_con_stimulate_close_door_valve() {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.close_EV.equal(new BBoolean(false)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).not().booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_con_stop_stimulate_close_door_valve() {
+        return new BBoolean(new BBoolean(this.close_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_con_stimulate_retract_gear_valve() {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.retract_EV.equal(new BBoolean(false)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).not().booleanValue()).booleanValue() && this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.flight)).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_con_stop_stimulate_retract_gear_valve() {
+        return new BBoolean(new BBoolean(this.retract_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_con_stimulate_extend_gear_valve() {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.extend_EV.equal(new BBoolean(false)).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).not().booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_con_stop_stimulate_extend_gear_valve() {
+        return new BBoolean(new BBoolean(this.extend_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_env_start_retracting_first() {
+        let _ic_set_18 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() && this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.gear_moving)).elementOf(this.gear).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+                _ic_set_18 = _ic_set_18.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_18;
+    }
+    _tr_env_retract_gear_skip() {
+        let _ic_set_19 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).unequal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+                _ic_set_19 = _ic_set_19.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_19;
+    }
+    _tr_env_retract_gear_last() {
+        let _ic_set_20 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+                _ic_set_20 = _ic_set_20.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_20;
+    }
+    _tr_env_start_extending() {
+        let _ic_set_21 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() && this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+                _ic_set_21 = _ic_set_21.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_21;
+    }
+    _tr_env_extend_gear_last() {
+        let _ic_set_22 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+                _ic_set_22 = _ic_set_22.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_22;
+    }
+    _tr_env_extend_gear_skip() {
+        let _ic_set_23 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).unequal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+                _ic_set_23 = _ic_set_23.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_23;
+    }
+    _tr_env_start_open_door() {
+        let _ic_set_24 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.closed)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new DOOR_STATE(enum_DOOR_STATE.closed), new DOOR_STATE(enum_DOOR_STATE.door_moving)).elementOf(this.door).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+                _ic_set_24 = _ic_set_24.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_24;
+    }
+    _tr_env_open_door_last() {
+        let _ic_set_25 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+                _ic_set_25 = _ic_set_25.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_25;
+    }
+    _tr_env_open_door_skip() {
+        let _ic_set_26 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).unequal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+                _ic_set_26 = _ic_set_26.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_26;
+    }
+    _tr_env_start_close_door() {
+        let _ic_set_27 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new DOOR_STATE(enum_DOOR_STATE.door_moving), new DOOR_STATE(enum_DOOR_STATE.open)).elementOf(this.door).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+                _ic_set_27 = _ic_set_27.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_27;
+    }
+    _tr_env_close_door() {
+        let _ic_set_28 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BBoolean(!new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+                _ic_set_28 = _ic_set_28.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_28;
+    }
+    _tr_env_close_door_skip() {
+        let _ic_set_29 = new BSet();
+        for (let _ic_gr_1 of this.gears.domain()) {
+            if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).unequal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BBoolean(!new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+                _ic_set_29 = _ic_set_29.union(new BSet(_ic_gr_1));
+            }
+        }
+        return _ic_set_29;
+    }
+    _tr_toggle_handle_up() {
+        return this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue();
+    }
+    _tr_toggle_handle_down() {
+        return this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue();
+    }
+    _tr_con_stimulate_general_valve() {
+        return new BBoolean(this.general_EV.equal(new BBoolean(false)).booleanValue() && this.handle_move.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_con_stop_stimulate_general_valve() {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(true)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() || new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue()).booleanValue() || new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue()).booleanValue()).booleanValue();
+    }
+    _tr_evn_open_general_valve() {
+        return new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(true)).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue()).booleanValue() && this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_closed)).booleanValue()).booleanValue();
+    }
+    _tr_evn_close_general_valve() {
+        return new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(false)).booleanValue() || this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue();
+    }
+    _tr_env_close_analogical_switch() {
+        return new BBoolean(this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_open)).booleanValue() && this.handle_move.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _tr_env_open_analogical_switch() {
+        return this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_closed)).booleanValue();
+    }
+    _check_inv_1() {
+        return LandingGear_R6._SWITCH_STATE.elementOf(this.analogical_switch).booleanValue();
+    }
+    _check_inv_2() {
+        return BUtils.BOOL.elementOf(this.general_EV).booleanValue();
+    }
+    _check_inv_3() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.general_valve).booleanValue();
+    }
+    _check_inv_4() {
+        return BUtils.BOOL.elementOf(this.handle_move).booleanValue();
+    }
+    _check_inv_5() {
+        return BUtils.BOOL.elementOf(this.close_EV).booleanValue();
+    }
+    _check_inv_6() {
+        return BUtils.BOOL.elementOf(this.extend_EV).booleanValue();
+    }
+    _check_inv_7() {
+        return BUtils.BOOL.elementOf(this.open_EV).booleanValue();
+    }
+    _check_inv_8() {
+        return BUtils.BOOL.elementOf(this.retract_EV).booleanValue();
+    }
+    _check_inv_9() {
+        return LandingGear_R6._PLANE_STATE.elementOf(this.shock_absorber).booleanValue();
+    }
+    _check_inv_10() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.valve_close_door).booleanValue();
+    }
+    _check_inv_11() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.valve_extend_gear).booleanValue();
+    }
+    _check_inv_12() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.valve_open_door).booleanValue();
+    }
+    _check_inv_13() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.valve_retract_gear).booleanValue();
+    }
+    _check_inv_14() {
+        return LandingGear_R6._HANDLE_STATE.elementOf(this.handle).booleanValue();
+    }
+    _check_inv_15() {
+        return LandingGear_R6._DOOR_STATE.elementOf(this.door).booleanValue();
+    }
+    _check_inv_16() {
+        return LandingGear_R6._GEAR_STATE.elementOf(this.gear).booleanValue();
+    }
+    _check_inv_17() {
+        return new BBoolean(!new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(true)).booleanValue() || this.close_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() || this.retract_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() || this.extend_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() || this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+    _check_inv_18() {
+        return new BBoolean(this.open_EV.equal(new BBoolean(true)).booleanValue() && this.close_EV.equal(new BBoolean(true)).booleanValue()).not().booleanValue();
+    }
+    _check_inv_19() {
+        return this.gears.checkDomain(LandingGear_R6._POSITION).and(this.gears.checkRange(LandingGear_R6._GEAR_STATE)).and(this.gears.isFunction()).and(this.gears.isTotal(LandingGear_R6._POSITION)).booleanValue();
+    }
+    _check_inv_20() {
+        return this.doors.checkDomain(LandingGear_R6._POSITION).and(this.doors.checkRange(LandingGear_R6._DOOR_STATE)).and(this.doors.isFunction()).and(this.doors.isTotal(LandingGear_R6._POSITION)).booleanValue();
+    }
+    _check_inv_21() {
+        return new BBoolean((!this.door.equal(new DOOR_STATE(enum_DOOR_STATE.closed)).booleanValue() || this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()) && (!this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue() || this.door.equal(new DOOR_STATE(enum_DOOR_STATE.closed)).booleanValue())).booleanValue();
+    }
+    _check_inv_22() {
+        return new BBoolean((!this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue() || this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()) && (!this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() || this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue();
+    }
+    _check_inv_23() {
+        return new BBoolean((!this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()) && (!this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue() || this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue())).booleanValue();
+    }
+    _check_inv_24() {
+        return new BBoolean((!this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()) && (!this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue())).booleanValue();
+    }
+    _check_inv_25() {
+        return new BBoolean(!this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue() || this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue()).booleanValue();
+    }
+}
+LandingGear_R6._DOOR_STATE = new BSet(new DOOR_STATE(enum_DOOR_STATE.open), new DOOR_STATE(enum_DOOR_STATE.closed), new DOOR_STATE(enum_DOOR_STATE.door_moving));
+LandingGear_R6._GEAR_STATE = new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted), new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.gear_moving));
+LandingGear_R6._HANDLE_STATE = new BSet(new HANDLE_STATE(enum_HANDLE_STATE.up), new HANDLE_STATE(enum_HANDLE_STATE.down));
+LandingGear_R6._POSITION = new BSet(new POSITION(enum_POSITION.fr), new POSITION(enum_POSITION.lt), new POSITION(enum_POSITION.rt));
+LandingGear_R6._SWITCH_STATE = new BSet(new SWITCH_STATE(enum_SWITCH_STATE.switch_open), new SWITCH_STATE(enum_SWITCH_STATE.switch_closed));
+LandingGear_R6._PLANE_STATE = new BSet(new PLANE_STATE(enum_PLANE_STATE.ground), new PLANE_STATE(enum_PLANE_STATE.flight));
+LandingGear_R6._VALVE_STATE = new BSet(new VALVE_STATE(enum_VALVE_STATE.valve_open), new VALVE_STATE(enum_VALVE_STATE.valve_closed));
diff --git a/B2Program/LandingGear/HydraulicCircuit/LandingGear_R6.mch b/B2Program/LandingGear/HydraulicCircuit/LandingGear_R6.mch
new file mode 100644
index 0000000000000000000000000000000000000000..72bd1819e166f1370614ab88f8b30a4c1927338b
--- /dev/null
+++ b/B2Program/LandingGear/HydraulicCircuit/LandingGear_R6.mch
@@ -0,0 +1,532 @@
+MACHINE LandingGear_R6
+SETS /* enumerated */
+  DOOR_STATE={open,closed,door_moving};
+  GEAR_STATE={retracted,extended,gear_moving};
+  HANDLE_STATE={up,down};
+  POSITION={fr,lt,rt};
+  SWITCH_STATE={switch_open,switch_closed};
+  PLANE_STATE={ground,flight};
+  VALVE_STATE={valve_open,valve_closed}
+
+VARIABLES
+  analogical_switch,
+  general_EV,
+  general_valve,
+  handle_move,
+  close_EV,
+  extend_EV,
+  open_EV,
+  retract_EV,
+  shock_absorber,
+  valve_close_door,
+  valve_extend_gear,
+  valve_open_door,
+  valve_retract_gear,
+  doors,
+  gears,
+  handle,
+  door,
+  gear
+
+/* PROMOTED OPERATIONS
+  begin_flying,
+  land_plane,
+  open_valve_door_open,
+  close_valve_door_open,
+  open_valve_door_close,
+  close_valve_door_close,
+  open_valve_retract_gear,
+  close_valve_retract_gear,
+  open_valve_extend_gear,
+  close_valve_extend_gear,
+  con_stimulate_open_door_valve,
+  con_stop_stimulate_open_door_valve,
+  con_stimulate_close_door_valve,
+  con_stop_stimulate_close_door_valve,
+  con_stimulate_retract_gear_valve,
+  con_stop_stimulate_retract_gear_valve,
+  con_stimulate_extend_gear_valve,
+  con_stop_stimulate_extend_gear_valve,
+  env_start_retracting_first,
+  env_retract_gear_skip,
+  env_retract_gear_last,
+  env_start_extending,
+  env_extend_gear_last,
+  env_extend_gear_skip,
+  env_start_open_door,
+  env_open_door_last,
+  env_open_door_skip,
+  env_start_close_door,
+  env_close_door,
+  env_close_door_skip,
+  toggle_handle_up,
+  toggle_handle_down,
+  con_stimulate_general_valve,
+  con_stop_stimulate_general_valve,
+  evn_open_general_valve,
+  evn_close_general_valve,
+  env_close_analogical_switch,
+  env_open_analogical_switch */
+INVARIANT
+analogical_switch : SWITCH_STATE
+& general_EV : BOOL
+& general_valve : VALVE_STATE
+& handle_move : BOOL
+& close_EV : BOOL
+& extend_EV : BOOL
+& open_EV : BOOL
+& retract_EV : BOOL
+& shock_absorber : PLANE_STATE
+& valve_close_door : VALVE_STATE
+& valve_extend_gear : VALVE_STATE
+& valve_open_door : VALVE_STATE
+& valve_retract_gear : VALVE_STATE
+& handle : HANDLE_STATE
+& door : DOOR_STATE
+& gear : GEAR_STATE
+& /* @R6GearsDoorsHandleValvesControllerSwitch:r51 */ ((open_EV = TRUE or close_EV = TRUE or retract_EV = TRUE or extend_EV = TRUE) => general_EV = TRUE)
+& /* @R5GearsDoorsHandleValvesController:R41 */ not(open_EV = TRUE & close_EV = TRUE)
+& /* @R3GearsDoorsHandle:inv1 */ gears : POSITION --> GEAR_STATE
+& /* @R3GearsDoorsHandle:inv2 */ doors : POSITION --> DOOR_STATE
+& /* @R3GearsDoorsHandle:glued1 */ (door = closed <=> ran(doors) = {closed})
+& /* @R3GearsDoorsHandle:glued2 */ (door = open <=> ran(doors) = {open})
+& /* @R3GearsDoorsHandle:glueg1 */ (gear = extended <=> ran(gears) = {extended})
+& /* @R3GearsDoorsHandle:glueg2 */ (gear = retracted <=> ran(gears) = {retracted})
+& /* @R1GearDoor:safety_inv1 */ (gear = gear_moving => door = open)
+
+
+INITIALISATION
+    gears := POSITION * {extended} ||
+    doors := POSITION * {closed} ||
+    handle := down ||
+    valve_extend_gear := valve_closed ||
+    valve_retract_gear := valve_closed ||
+    valve_open_door := valve_closed ||
+    valve_close_door := valve_closed ||
+    open_EV := FALSE ||
+    close_EV := FALSE ||
+    retract_EV := FALSE ||
+    extend_EV := FALSE ||
+    shock_absorber := ground ||
+    general_EV := FALSE ||
+    general_valve := valve_closed ||
+    analogical_switch := switch_open ||
+    handle_move := FALSE ||
+    gear := extended ||
+    door := closed
+
+OPERATIONS
+
+    begin_flying =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:onground */ shock_absorber = ground
+    THEN
+        shock_absorber := flight
+    END;
+
+    land_plane =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:onground */ shock_absorber = flight
+    THEN
+        shock_absorber := ground
+    END;
+
+    open_valve_door_open =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:valve_not_open */ valve_open_door = valve_closed
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ open_EV = TRUE
+    THEN
+        valve_open_door := valve_open
+    END;
+
+    close_valve_door_open =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:valve_not_closed */ valve_open_door = valve_open
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ open_EV = FALSE
+    THEN
+        valve_open_door := valve_closed
+    END;
+
+    open_valve_door_close =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:valve_not_open */ valve_close_door = valve_closed
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ close_EV = TRUE
+    THEN
+        valve_close_door := valve_open
+    END;
+
+    close_valve_door_close =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:valve_not_closed */ valve_close_door = valve_open
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ close_EV = FALSE
+    THEN
+        valve_close_door := valve_closed
+    END;
+
+    open_valve_retract_gear =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:valve_not_open */ valve_retract_gear = valve_closed
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ retract_EV = TRUE
+    THEN
+        valve_retract_gear := valve_open
+    END;
+
+    close_valve_retract_gear =
+    SELECT
+    /* @R6GearsDoorsHandleValvesControllerSwitch:valve_not_closed */ valve_retract_gear = valve_open
+    & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ retract_EV = FALSE
+    THEN
+        valve_retract_gear := valve_closed
+    END;
+
+    open_valve_extend_gear =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:valve_not_open */ valve_extend_gear = valve_closed
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ extend_EV = TRUE
+    THEN
+        valve_extend_gear := valve_open
+    END;
+
+    close_valve_extend_gear =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:valve_not_closed */ valve_extend_gear = valve_open
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ extend_EV = FALSE
+    THEN
+        valve_extend_gear := valve_closed
+    END;
+
+    con_stimulate_open_door_valve =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ open_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ close_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grdh1 */ ((handle = down & not(ran(gears) = {extended})) or (handle = up & not(ran(gears) = {retracted}) & not(ran(doors) = {open} & shock_absorber = ground)))
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_ev */ general_EV = TRUE
+    THEN
+        open_EV := TRUE
+    END;
+
+    con_stop_stimulate_open_door_valve =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ open_EV = TRUE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd11 */ extend_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd12 */ retract_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grdh1 */ ((handle = down & ran(gears) = {extended}) or (handle = up & (ran(gears) = {retracted} or shock_absorber = ground) & ran(doors) = {open}))
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_ev */ general_EV = TRUE
+    THEN
+        open_EV := FALSE
+    END;
+
+    con_stimulate_close_door_valve =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ close_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ open_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd11 */ extend_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd12 */ retract_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grdh1 */ ((handle = down & ran(gears) = {extended}) or (handle = up & (ran(gears) = {retracted} or shock_absorber = ground)))
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grddoors */ not(ran(doors) = {closed})
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_ev */ general_EV = TRUE
+    THEN
+        close_EV := TRUE
+    END;
+
+    con_stop_stimulate_close_door_valve =
+    SELECT
+    /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ close_EV = TRUE
+    & /* @R6GearsDoorsHandleValvesControllerSwitch:grdh1 */ ((handle = down & ran(gears) = {extended} & ran(doors) = {closed}) or (handle = up & (ran(gears) = {retracted} or shock_absorber = ground) & ran(doors) = {closed}))
+    & /* @R6GearsDoorsHandleValvesControllerSwitch:general_ev */ general_EV = TRUE
+    THEN
+        close_EV := FALSE
+    END;
+
+    con_stimulate_retract_gear_valve =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ retract_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ extend_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ open_EV = TRUE
+        & handle = up
+        & not(ran(gears) = {retracted})
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grdflight */ shock_absorber = flight
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grddoors */ ran(doors) = {open}
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_ev */ general_EV = TRUE
+    THEN
+        retract_EV := TRUE
+    END;
+
+    con_stop_stimulate_retract_gear_valve =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ retract_EV = TRUE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grdh1 */ (handle = down or ran(gears) = {retracted})
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_ev */ general_EV = TRUE
+    THEN
+        retract_EV := FALSE
+    END;
+
+    con_stimulate_extend_gear_valve =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ extend_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ retract_EV = FALSE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ open_EV = TRUE
+        & handle = down
+        & not(ran(gears) = {extended})
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grddoors */ ran(doors) = {open}
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_ev */ general_EV = TRUE
+    THEN
+        extend_EV := TRUE
+    END;
+
+    con_stop_stimulate_extend_gear_valve =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ extend_EV = TRUE
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:grdh1 */ (handle = up or ran(gears) = {extended})
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_ev */ general_EV = TRUE
+    THEN
+        extend_EV := FALSE
+    END;
+
+    env_start_retracting_first(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:all_doors_open */ ran(doors) = {open}
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:handle_up */ handle = up
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:g1 */ gears(gr) = extended
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:gv */ valve_retract_gear = valve_open
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+        & /* @R2GearDoorHandle:g1 */ gear : {extended,gear_moving}
+        & /* @R2GearDoorHandle:door_open */ door = open
+    THEN
+        gears := gears <+ {gr |-> gear_moving} ||
+        gear := gear_moving
+    END;
+
+    env_retract_gear_skip(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:all_doors_open */ ran(doors) = {open}
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:all_others */ gears[POSITION \ {gr}] /= {retracted}
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:handle_up */ handle = up
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:g1 */ gears(gr) = gear_moving
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+    THEN
+        gears := gears <+ {gr |-> retracted}
+    END;
+
+    env_retract_gear_last(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+    SELECT
+        /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:all_doors_open */ ran(doors) = {open}
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:all_others */ gears[POSITION \ {gr}] = {retracted}
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:handle_up */ handle = up
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:g1 */ gears(gr) = gear_moving
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+        & /* @R2GearDoorHandle:g1 */ gear = gear_moving
+        & /* @R2GearDoorHandle:door_open */ door = open
+    THEN
+        gears := gears <+ {gr |-> retracted} ||
+        gear := retracted
+    END;
+
+        env_start_extending(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:all_doors_open */ ran(doors) = {open}
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:handle_down */ handle = down
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:g1 */ gears(gr) = retracted
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:gv */ valve_extend_gear = valve_open
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+            & /* @R2GearDoorHandle:g1 */ gear : {gear_moving,retracted}
+            & /* @R2GearDoorHandle:door_open */ door = open
+        THEN
+            gears := gears <+ {gr |-> gear_moving} ||
+            gear := gear_moving
+        END;
+
+        env_extend_gear_last(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:all_doors_open */ ran(doors) = {open}
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:handle_down */ handle = down
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:all_others */ gears[POSITION \ {gr}] = {extended}
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:g1 */ gears(gr) = gear_moving
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+            & /* @R2GearDoorHandle:g1 */ gear = gear_moving
+            & /* @R2GearDoorHandle:door_open */ door = open
+        THEN
+            gears := gears <+ {gr |-> extended} ||
+            gear := extended
+        END;
+
+        env_extend_gear_skip(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:all_doors_open */ ran(doors) = {open}
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:handle_down */ handle = down
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:all_others */ gears[POSITION \ {gr}] /= {extended}
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:g1 */ gears(gr) = gear_moving
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+        THEN
+            gears := gears <+ {gr |-> extended}
+        END;
+
+        env_start_open_door(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+            & doors(gr) = closed
+            & gears(gr) /= gear_moving
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:nomov */ gear_moving /: ran(gears)
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:h */ ((handle = down & ran(gears) = {retracted}) or (handle = up & ran(gears) = {extended}))
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:gv */ valve_open_door = valve_open
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+            & door : {closed,door_moving}
+            & gear /= gear_moving
+            & /* @R2GearDoorHandle:h */ ((handle = down & gear = retracted) or (handle = up & gear = extended))
+        THEN
+            doors := doors <+ {gr |-> door_moving} ||
+            door := door_moving
+        END;
+
+        env_open_door_last(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+            & doors(gr) = door_moving
+            & gears(gr) /= gear_moving
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:nomov */ gear_moving /: ran(gears)
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:all_others */ doors[POSITION \ {gr}] = {open}
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:h */ ((handle = down & ran(gears) = {retracted}) or (handle = up & ran(gears) = {extended}))
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:gv */ valve_open_door = valve_open
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+            & door = door_moving
+            & gear /= gear_moving
+            & /* @R2GearDoorHandle:h */ ((handle = down & gear = retracted) or (handle = up & gear = extended))
+        THEN
+            doors := doors <+ {gr |-> open} ||
+            door := open
+        END;
+
+        env_open_door_skip(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+            & doors(gr) = door_moving
+            & gears(gr) /= gear_moving
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:nomov */ gear_moving /: ran(gears)
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:all_others */ doors[POSITION \ {gr}] /= {open}
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:h */ ((handle = down & ran(gears) = {retracted}) or (handle = up & ran(gears) = {extended}))
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:gv */ valve_open_door = valve_open
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+        THEN
+            doors := doors <+ {gr |-> open}
+        END;
+
+        env_start_close_door(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+            & doors(gr) = open
+            & gears(gr) /= gear_moving
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:h */ ((handle = up & (ran(gears) = {retracted} or ran(gears) = {extended})) or (handle = down & ran(gears) = {extended}))
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:gv */ valve_close_door = valve_open
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+            & door : {door_moving,open} & gear /= gear_moving & /* @R2GearDoorHandle:h */ ((handle = down & gear = extended) or (handle = up & gear : {extended,retracted}))
+        THEN
+            doors := doors <+ {gr |-> door_moving} ||
+            door := door_moving
+        END;
+
+        env_close_door(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+            & doors(gr) = door_moving & gears(gr) /= gear_moving & /* @R6GearsDoorsHandleValvesControllerSwitch:nomov */ gear_moving /: ran(gears)
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:all_others */ doors[POSITION \ {gr}] = {closed}
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:h */ ((handle = up & (ran(gears) = {retracted} or ran(gears) = {extended})) or (handle = down & ran(gears) = {extended}))
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:gv */ valve_close_door = valve_open
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:hground */ ((handle = up & ran(gears) = {extended}) => shock_absorber = ground)
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open & door = door_moving & gear /= gear_moving
+            & /* @R2GearDoorHandle:h */ ((handle = down & gear = extended) or (handle = up & gear : {extended,retracted}))
+        THEN
+            doors := doors <+ {gr |-> closed} ||
+            door := closed
+        END;
+
+        env_close_door_skip(/* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr) =
+        SELECT /* @R6GearsDoorsHandleValvesControllerSwitch:gr */ gr : dom(gears)
+        & doors(gr) = door_moving
+        & gears(gr) /= gear_moving
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:nomov */ gear_moving /: ran(gears)
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:all_others */ doors[POSITION \ {gr}] /= {closed}
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:h */ ((handle = up & (ran(gears) = {retracted} or ran(gears) = {extended})) or (handle = down & ran(gears) = {extended}))
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:gv */ valve_close_door = valve_open
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:hground */ ((handle = up & ran(gears) = {extended}) => shock_absorber = ground)
+        & /* @R6GearsDoorsHandleValvesControllerSwitch:general_valve */ general_valve = valve_open
+        THEN
+            doors := doors <+ {gr |-> closed}
+        END;
+
+        toggle_handle_up =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:h */ handle = down
+        THEN
+            handle := up ||
+            handle_move := TRUE
+        END;
+
+        toggle_handle_down =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:h */ handle = up
+        THEN
+            handle := down ||
+            handle_move := TRUE
+        END;
+
+        con_stimulate_general_valve =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ general_EV = FALSE
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ handle_move = TRUE
+        THEN
+            general_EV := TRUE
+        END;
+
+        con_stop_stimulate_general_valve =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ general_EV = TRUE
+            & open_EV = FALSE
+            & close_EV = FALSE
+            & retract_EV = FALSE
+            & extend_EV = FALSE
+            & close_EV = FALSE
+            & ((handle = up & ran(gears) = {retracted} & ran(doors) = {closed} & open_EV = FALSE) or (handle = down & ran(gears) = {extended} & ran(doors) = {closed} & open_EV = FALSE) or (handle = up & ran(gears) = {extended} & ran(doors) = {closed} & open_EV = FALSE))
+        THEN
+            general_EV := FALSE ||
+            handle_move := FALSE
+        END;
+
+        evn_open_general_valve =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ general_EV = TRUE
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ general_valve = valve_closed
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:grd3 */ analogical_switch = switch_closed
+        THEN
+            general_valve := valve_open
+        END;
+
+        evn_close_general_valve =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ (general_EV = FALSE or analogical_switch = switch_open )
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ general_valve = valve_open
+        THEN
+            general_valve := valve_closed
+        END;
+
+        env_close_analogical_switch =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ analogical_switch = switch_open
+            & /* @R6GearsDoorsHandleValvesControllerSwitch:grd2 */ handle_move = TRUE
+        THEN
+            analogical_switch := switch_closed
+        END;
+
+        env_open_analogical_switch =
+        SELECT
+            /* @R6GearsDoorsHandleValvesControllerSwitch:grd1 */ analogical_switch = switch_closed
+        THEN
+            analogical_switch := switch_open
+        END
+
+END
diff --git a/B2Program/LandingGear/HydraulicCircuit/LandingGear_R6.ts b/B2Program/LandingGear/HydraulicCircuit/LandingGear_R6.ts
new file mode 100644
index 0000000000000000000000000000000000000000..ae569db86754755d02a16596dbec530fd6b67ee3
--- /dev/null
+++ b/B2Program/LandingGear/HydraulicCircuit/LandingGear_R6.ts
@@ -0,0 +1,1076 @@
+import {BTuple} from './btypes/BTuple.js';
+import {BBoolean} from './btypes/BBoolean.js';
+import {BRelation} from './btypes/BRelation.js';
+import {BSet} from './btypes/BSet.js';
+import {BObject} from './btypes/BObject.js';
+import {BUtils} from "./btypes/BUtils.js";
+import {SelectError} from "./btypes/BUtils.js";
+
+export enum enum_DOOR_STATE {
+    open,
+    closed,
+    door_moving
+}
+
+export class DOOR_STATE implements BObject{
+    value: enum_DOOR_STATE;
+
+    constructor(value: enum_DOOR_STATE) {
+        this.value = value;
+    }
+
+    equal(other: DOOR_STATE) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: DOOR_STATE) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof DOOR_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_DOOR_STATE[this.value].toString();
+    }
+
+    static get_open () {return new DOOR_STATE(enum_DOOR_STATE.open);}
+    static get_closed () {return new DOOR_STATE(enum_DOOR_STATE.closed);}
+    static get_door_moving () {return new DOOR_STATE(enum_DOOR_STATE.door_moving);}
+
+
+}
+
+export enum enum_GEAR_STATE {
+    retracted,
+    extended,
+    gear_moving
+}
+
+export class GEAR_STATE implements BObject{
+    value: enum_GEAR_STATE;
+
+    constructor(value: enum_GEAR_STATE) {
+        this.value = value;
+    }
+
+    equal(other: GEAR_STATE) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: GEAR_STATE) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof GEAR_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_GEAR_STATE[this.value].toString();
+    }
+
+    static get_retracted () {return new GEAR_STATE(enum_GEAR_STATE.retracted);}
+    static get_extended () {return new GEAR_STATE(enum_GEAR_STATE.extended);}
+    static get_gear_moving () {return new GEAR_STATE(enum_GEAR_STATE.gear_moving);}
+
+
+}
+
+export enum enum_HANDLE_STATE {
+    up,
+    down
+}
+
+export class HANDLE_STATE implements BObject{
+    value: enum_HANDLE_STATE;
+
+    constructor(value: enum_HANDLE_STATE) {
+        this.value = value;
+    }
+
+    equal(other: HANDLE_STATE) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: HANDLE_STATE) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof HANDLE_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_HANDLE_STATE[this.value].toString();
+    }
+
+    static get_up () {return new HANDLE_STATE(enum_HANDLE_STATE.up);}
+    static get_down () {return new HANDLE_STATE(enum_HANDLE_STATE.down);}
+
+
+}
+
+export enum enum_POSITION {
+    fr,
+    lt,
+    rt
+}
+
+export class POSITION implements BObject{
+    value: enum_POSITION;
+
+    constructor(value: enum_POSITION) {
+        this.value = value;
+    }
+
+    equal(other: POSITION) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: POSITION) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof POSITION)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_POSITION[this.value].toString();
+    }
+
+    static get_fr () {return new POSITION(enum_POSITION.fr);}
+    static get_lt () {return new POSITION(enum_POSITION.lt);}
+    static get_rt () {return new POSITION(enum_POSITION.rt);}
+
+
+}
+
+export enum enum_SWITCH_STATE {
+    switch_open,
+    switch_closed
+}
+
+export class SWITCH_STATE implements BObject{
+    value: enum_SWITCH_STATE;
+
+    constructor(value: enum_SWITCH_STATE) {
+        this.value = value;
+    }
+
+    equal(other: SWITCH_STATE) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: SWITCH_STATE) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof SWITCH_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_SWITCH_STATE[this.value].toString();
+    }
+
+    static get_switch_open () {return new SWITCH_STATE(enum_SWITCH_STATE.switch_open);}
+    static get_switch_closed () {return new SWITCH_STATE(enum_SWITCH_STATE.switch_closed);}
+
+
+}
+
+export enum enum_PLANE_STATE {
+    ground,
+    flight
+}
+
+export class PLANE_STATE implements BObject{
+    value: enum_PLANE_STATE;
+
+    constructor(value: enum_PLANE_STATE) {
+        this.value = value;
+    }
+
+    equal(other: PLANE_STATE) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: PLANE_STATE) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof PLANE_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_PLANE_STATE[this.value].toString();
+    }
+
+    static get_ground () {return new PLANE_STATE(enum_PLANE_STATE.ground);}
+    static get_flight () {return new PLANE_STATE(enum_PLANE_STATE.flight);}
+
+
+}
+
+export enum enum_VALVE_STATE {
+    valve_open,
+    valve_closed
+}
+
+export class VALVE_STATE implements BObject{
+    value: enum_VALVE_STATE;
+
+    constructor(value: enum_VALVE_STATE) {
+        this.value = value;
+    }
+
+    equal(other: VALVE_STATE) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: VALVE_STATE) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof VALVE_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_VALVE_STATE[this.value].toString();
+    }
+
+    static get_valve_open () {return new VALVE_STATE(enum_VALVE_STATE.valve_open);}
+    static get_valve_closed () {return new VALVE_STATE(enum_VALVE_STATE.valve_closed);}
+
+
+}
+
+
+export default class LandingGear_R6 {
+
+
+
+    private static _DOOR_STATE: BSet<DOOR_STATE> = new BSet(new DOOR_STATE(enum_DOOR_STATE.open), new DOOR_STATE(enum_DOOR_STATE.closed), new DOOR_STATE(enum_DOOR_STATE.door_moving));
+    private static _GEAR_STATE: BSet<GEAR_STATE> = new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted), new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.gear_moving));
+    private static _HANDLE_STATE: BSet<HANDLE_STATE> = new BSet(new HANDLE_STATE(enum_HANDLE_STATE.up), new HANDLE_STATE(enum_HANDLE_STATE.down));
+    private static _POSITION: BSet<POSITION> = new BSet(new POSITION(enum_POSITION.fr), new POSITION(enum_POSITION.lt), new POSITION(enum_POSITION.rt));
+    private static _SWITCH_STATE: BSet<SWITCH_STATE> = new BSet(new SWITCH_STATE(enum_SWITCH_STATE.switch_open), new SWITCH_STATE(enum_SWITCH_STATE.switch_closed));
+    private static _PLANE_STATE: BSet<PLANE_STATE> = new BSet(new PLANE_STATE(enum_PLANE_STATE.ground), new PLANE_STATE(enum_PLANE_STATE.flight));
+    private static _VALVE_STATE: BSet<VALVE_STATE> = new BSet(new VALVE_STATE(enum_VALVE_STATE.valve_open), new VALVE_STATE(enum_VALVE_STATE.valve_closed));
+
+    private analogical_switch: SWITCH_STATE;
+    private general_EV: BBoolean;
+    private general_valve: VALVE_STATE;
+    private handle_move: BBoolean;
+    private close_EV: BBoolean;
+    private extend_EV: BBoolean;
+    private open_EV: BBoolean;
+    private retract_EV: BBoolean;
+    private shock_absorber: PLANE_STATE;
+    private valve_close_door: VALVE_STATE;
+    private valve_extend_gear: VALVE_STATE;
+    private valve_open_door: VALVE_STATE;
+    private valve_retract_gear: VALVE_STATE;
+    private doors: BRelation<POSITION, DOOR_STATE>;
+    private gears: BRelation<POSITION, GEAR_STATE>;
+    private handle: HANDLE_STATE;
+    private door: DOOR_STATE;
+    private gear: GEAR_STATE;
+
+    constructor() {
+        this.gears = BRelation.cartesianProduct(LandingGear_R6._POSITION, new BSet(new GEAR_STATE(enum_GEAR_STATE.extended)));
+        this.doors = BRelation.cartesianProduct(LandingGear_R6._POSITION, new BSet(new DOOR_STATE(enum_DOOR_STATE.closed)));
+        this.handle = new HANDLE_STATE(enum_HANDLE_STATE.down);
+        this.valve_extend_gear = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.valve_retract_gear = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.valve_open_door = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.valve_close_door = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.open_EV = new BBoolean(false);
+        this.close_EV = new BBoolean(false);
+        this.retract_EV = new BBoolean(false);
+        this.extend_EV = new BBoolean(false);
+        this.shock_absorber = new PLANE_STATE(enum_PLANE_STATE.ground);
+        this.general_EV = new BBoolean(false);
+        this.general_valve = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        this.analogical_switch = new SWITCH_STATE(enum_SWITCH_STATE.switch_open);
+        this.handle_move = new BBoolean(false);
+        this.gear = new GEAR_STATE(enum_GEAR_STATE.extended);
+        this.door = new DOOR_STATE(enum_DOOR_STATE.closed);
+    }
+
+    public _copy(): LandingGear_R6 {
+        let _instance = Object.create(LandingGear_R6.prototype);
+        for(let key of Object.keys(this)) {
+            _instance[key] = this[key]._copy?.() ?? this[key];
+        }
+        return _instance;
+    }
+
+     begin_flying(): void {
+        if((this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground))).booleanValue()) {
+            this.shock_absorber = new PLANE_STATE(enum_PLANE_STATE.flight);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     land_plane(): void {
+        if((this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.flight))).booleanValue()) {
+            this.shock_absorber = new PLANE_STATE(enum_PLANE_STATE.ground);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     open_valve_door_open(): void {
+        if((new BBoolean(this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.valve_open_door = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     close_valve_door_open(): void {
+        if((new BBoolean(this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue())).booleanValue()) {
+            this.valve_open_door = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     open_valve_door_close(): void {
+        if((new BBoolean(this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.close_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.valve_close_door = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     close_valve_door_close(): void {
+        if((new BBoolean(this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue())).booleanValue()) {
+            this.valve_close_door = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     open_valve_retract_gear(): void {
+        if((new BBoolean(this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.retract_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.valve_retract_gear = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     close_valve_retract_gear(): void {
+        if((new BBoolean(this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue())).booleanValue()) {
+            this.valve_retract_gear = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     open_valve_extend_gear(): void {
+        if((new BBoolean(this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.extend_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.valve_extend_gear = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     close_valve_extend_gear(): void {
+        if((new BBoolean(this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue())).booleanValue()) {
+            this.valve_extend_gear = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stimulate_open_door_valve(): void {
+        if((new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(false)).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).not().booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).not().booleanValue()).booleanValue() && new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).not().booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.open_EV = new BBoolean(true);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stop_stimulate_open_door_valve(): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(true)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.open_EV = new BBoolean(false);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stimulate_close_door_valve(): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.close_EV.equal(new BBoolean(false)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).not().booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.close_EV = new BBoolean(true);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stop_stimulate_close_door_valve(): void {
+        if((new BBoolean(new BBoolean(this.close_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.close_EV = new BBoolean(false);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stimulate_retract_gear_valve(): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.retract_EV.equal(new BBoolean(false)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).not().booleanValue()).booleanValue() && this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.flight)).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.retract_EV = new BBoolean(true);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stop_stimulate_retract_gear_valve(): void {
+        if((new BBoolean(new BBoolean(this.retract_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.retract_EV = new BBoolean(false);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stimulate_extend_gear_valve(): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.extend_EV.equal(new BBoolean(false)).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).not().booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.extend_EV = new BBoolean(true);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stop_stimulate_extend_gear_valve(): void {
+        if((new BBoolean(new BBoolean(this.extend_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.extend_EV = new BBoolean(false);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_start_retracting_first(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() && this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.gear_moving)).elementOf(this.gear).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+            let _ld_gears: BRelation<POSITION, GEAR_STATE> = this.gears;
+            this.gears = _ld_gears.override(new BRelation<POSITION, GEAR_STATE>(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.gear_moving))));
+            this.gear = new GEAR_STATE(enum_GEAR_STATE.gear_moving);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_retract_gear_skip(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).unequal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.gears = this.gears.override(new BRelation<POSITION, GEAR_STATE>(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.retracted))));
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_retract_gear_last(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+            let _ld_gears: BRelation<POSITION, GEAR_STATE> = this.gears;
+            this.gears = _ld_gears.override(new BRelation<POSITION, GEAR_STATE>(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.retracted))));
+            this.gear = new GEAR_STATE(enum_GEAR_STATE.retracted);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_start_extending(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() && this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+            let _ld_gears: BRelation<POSITION, GEAR_STATE> = this.gears;
+            this.gears = _ld_gears.override(new BRelation<POSITION, GEAR_STATE>(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.gear_moving))));
+            this.gear = new GEAR_STATE(enum_GEAR_STATE.gear_moving);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_extend_gear_last(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+            let _ld_gears: BRelation<POSITION, GEAR_STATE> = this.gears;
+            this.gears = _ld_gears.override(new BRelation<POSITION, GEAR_STATE>(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.extended))));
+            this.gear = new GEAR_STATE(enum_GEAR_STATE.extended);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_extend_gear_skip(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).unequal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.gears.functionCall(gr).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.gears = this.gears.override(new BRelation<POSITION, GEAR_STATE>(new BTuple(gr, new GEAR_STATE(enum_GEAR_STATE.extended))));
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_start_open_door(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.closed)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new DOOR_STATE(enum_DOOR_STATE.closed), new DOOR_STATE(enum_DOOR_STATE.door_moving)).elementOf(this.door).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            let _ld_doors: BRelation<POSITION, DOOR_STATE> = this.doors;
+            this.doors = _ld_doors.override(new BRelation<POSITION, DOOR_STATE>(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.door_moving))));
+            this.door = new DOOR_STATE(enum_DOOR_STATE.door_moving);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_open_door_last(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            let _ld_doors: BRelation<POSITION, DOOR_STATE> = this.doors;
+            this.doors = _ld_doors.override(new BRelation<POSITION, DOOR_STATE>(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.open))));
+            this.door = new DOOR_STATE(enum_DOOR_STATE.open);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_open_door_skip(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).unequal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.doors = this.doors.override(new BRelation<POSITION, DOOR_STATE>(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.open))));
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_start_close_door(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new DOOR_STATE(enum_DOOR_STATE.door_moving), new DOOR_STATE(enum_DOOR_STATE.open)).elementOf(this.door).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            let _ld_doors: BRelation<POSITION, DOOR_STATE> = this.doors;
+            this.doors = _ld_doors.override(new BRelation<POSITION, DOOR_STATE>(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.door_moving))));
+            this.door = new DOOR_STATE(enum_DOOR_STATE.door_moving);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_close_door(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BBoolean(!new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            let _ld_doors: BRelation<POSITION, DOOR_STATE> = this.doors;
+            this.doors = _ld_doors.override(new BRelation<POSITION, DOOR_STATE>(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.closed))));
+            this.door = new DOOR_STATE(enum_DOOR_STATE.closed);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_close_door_skip(gr: POSITION): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.gears.domain().elementOf(gr).booleanValue() && this.doors.functionCall(gr).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gears.functionCall(gr).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(gr))).unequal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BBoolean(!new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.doors = this.doors.override(new BRelation<POSITION, DOOR_STATE>(new BTuple(gr, new DOOR_STATE(enum_DOOR_STATE.closed))));
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     toggle_handle_up(): void {
+        if((this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down))).booleanValue()) {
+            this.handle = new HANDLE_STATE(enum_HANDLE_STATE.up);
+            this.handle_move = new BBoolean(true);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     toggle_handle_down(): void {
+        if((this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up))).booleanValue()) {
+            this.handle = new HANDLE_STATE(enum_HANDLE_STATE.down);
+            this.handle_move = new BBoolean(true);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stimulate_general_valve(): void {
+        if((new BBoolean(this.general_EV.equal(new BBoolean(false)).booleanValue() && this.handle_move.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.general_EV = new BBoolean(true);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     con_stop_stimulate_general_valve(): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(true)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() || new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue()).booleanValue() || new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+            this.general_EV = new BBoolean(false);
+            this.handle_move = new BBoolean(false);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     evn_open_general_valve(): void {
+        if((new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(true)).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue()).booleanValue() && this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_closed)).booleanValue())).booleanValue()) {
+            this.general_valve = new VALVE_STATE(enum_VALVE_STATE.valve_open);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     evn_close_general_valve(): void {
+        if((new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(false)).booleanValue() || this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+            this.general_valve = new VALVE_STATE(enum_VALVE_STATE.valve_closed);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_close_analogical_switch(): void {
+        if((new BBoolean(this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_open)).booleanValue() && this.handle_move.equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this.analogical_switch = new SWITCH_STATE(enum_SWITCH_STATE.switch_closed);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     env_open_analogical_switch(): void {
+        if((this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_closed))).booleanValue()) {
+            this.analogical_switch = new SWITCH_STATE(enum_SWITCH_STATE.switch_open);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+    _get_analogical_switch(): SWITCH_STATE {
+        return this.analogical_switch;
+    }
+
+    _get_general_EV(): BBoolean {
+        return this.general_EV;
+    }
+
+    _get_general_valve(): VALVE_STATE {
+        return this.general_valve;
+    }
+
+    _get_handle_move(): BBoolean {
+        return this.handle_move;
+    }
+
+    _get_close_EV(): BBoolean {
+        return this.close_EV;
+    }
+
+    _get_extend_EV(): BBoolean {
+        return this.extend_EV;
+    }
+
+    _get_open_EV(): BBoolean {
+        return this.open_EV;
+    }
+
+    _get_retract_EV(): BBoolean {
+        return this.retract_EV;
+    }
+
+    _get_shock_absorber(): PLANE_STATE {
+        return this.shock_absorber;
+    }
+
+    _get_valve_close_door(): VALVE_STATE {
+        return this.valve_close_door;
+    }
+
+    _get_valve_extend_gear(): VALVE_STATE {
+        return this.valve_extend_gear;
+    }
+
+    _get_valve_open_door(): VALVE_STATE {
+        return this.valve_open_door;
+    }
+
+    _get_valve_retract_gear(): VALVE_STATE {
+        return this.valve_retract_gear;
+    }
+
+    _get_doors(): BRelation<POSITION, DOOR_STATE> {
+        return this.doors;
+    }
+
+    _get_gears(): BRelation<POSITION, GEAR_STATE> {
+        return this.gears;
+    }
+
+    _get_handle(): HANDLE_STATE {
+        return this.handle;
+    }
+
+    _get_door(): DOOR_STATE {
+        return this.door;
+    }
+
+    _get_gear(): GEAR_STATE {
+        return this.gear;
+    }
+
+    _get__DOOR_STATE(): BSet<DOOR_STATE> {
+        return LandingGear_R6._DOOR_STATE;
+    }
+
+    _get__GEAR_STATE(): BSet<GEAR_STATE> {
+        return LandingGear_R6._GEAR_STATE;
+    }
+
+    _get__HANDLE_STATE(): BSet<HANDLE_STATE> {
+        return LandingGear_R6._HANDLE_STATE;
+    }
+
+    _get__POSITION(): BSet<POSITION> {
+        return LandingGear_R6._POSITION;
+    }
+
+    _get__SWITCH_STATE(): BSet<SWITCH_STATE> {
+        return LandingGear_R6._SWITCH_STATE;
+    }
+
+    _get__PLANE_STATE(): BSet<PLANE_STATE> {
+        return LandingGear_R6._PLANE_STATE;
+    }
+
+    _get__VALVE_STATE(): BSet<VALVE_STATE> {
+        return LandingGear_R6._VALVE_STATE;
+    }
+
+    _tr_begin_flying(): boolean {
+        return this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue();
+    }
+
+    _tr_land_plane(): boolean {
+        return this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.flight)).booleanValue();
+    }
+
+    _tr_open_valve_door_open(): boolean {
+        return new BBoolean(this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_close_valve_door_open(): boolean {
+        return new BBoolean(this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue();
+    }
+
+    _tr_open_valve_door_close(): boolean {
+        return new BBoolean(this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.close_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_close_valve_door_close(): boolean {
+        return new BBoolean(this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue();
+    }
+
+    _tr_open_valve_retract_gear(): boolean {
+        return new BBoolean(this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.retract_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_close_valve_retract_gear(): boolean {
+        return new BBoolean(this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue();
+    }
+
+    _tr_open_valve_extend_gear(): boolean {
+        return new BBoolean(this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue() && this.extend_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_close_valve_extend_gear(): boolean {
+        return new BBoolean(this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue();
+    }
+
+    _tr_con_stimulate_open_door_valve(): boolean {
+        return new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(false)).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).not().booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).not().booleanValue()).booleanValue() && new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).not().booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_con_stop_stimulate_open_door_valve(): boolean {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(true)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_con_stimulate_close_door_valve(): boolean {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.close_EV.equal(new BBoolean(false)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).not().booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_con_stop_stimulate_close_door_valve(): boolean {
+        return new BBoolean(new BBoolean(this.close_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() || new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_con_stimulate_retract_gear_valve(): boolean {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.retract_EV.equal(new BBoolean(false)).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).not().booleanValue()).booleanValue() && this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.flight)).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_con_stop_stimulate_retract_gear_valve(): boolean {
+        return new BBoolean(new BBoolean(this.retract_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_con_stimulate_extend_gear_valve(): boolean {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.extend_EV.equal(new BBoolean(false)).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).not().booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_con_stop_stimulate_extend_gear_valve(): boolean {
+        return new BBoolean(new BBoolean(this.extend_EV.equal(new BBoolean(true)).booleanValue() && new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() && this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_env_start_retracting_first(): BSet<POSITION> {
+        let _ic_set_18: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() && this.valve_retract_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.gear_moving)).elementOf(this.gear).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+                _ic_set_18 = _ic_set_18.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_18;
+    }
+
+    _tr_env_retract_gear_skip(): BSet<POSITION> {
+        let _ic_set_19: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).unequal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+                _ic_set_19 = _ic_set_19.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_19;
+    }
+
+    _tr_env_retract_gear_last(): BSet<POSITION> {
+        let _ic_set_20: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+                _ic_set_20 = _ic_set_20.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_20;
+    }
+
+    _tr_env_start_extending(): BSet<POSITION> {
+        let _ic_set_21: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() && this.valve_extend_gear.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.gear_moving), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+                _ic_set_21 = _ic_set_21.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_21;
+    }
+
+    _tr_env_extend_gear_last(): BSet<POSITION> {
+        let _ic_set_22: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue()) {
+                _ic_set_22 = _ic_set_22.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_22;
+    }
+
+    _tr_env_extend_gear_skip(): BSet<POSITION> {
+        let _ic_set_23: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() && this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue()).booleanValue() && this.gears.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).unequal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.gears.functionCall(_ic_gr_1).equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+                _ic_set_23 = _ic_set_23.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_23;
+    }
+
+    _tr_env_start_open_door(): BSet<POSITION> {
+        let _ic_set_24: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.closed)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new DOOR_STATE(enum_DOOR_STATE.closed), new DOOR_STATE(enum_DOOR_STATE.door_moving)).elementOf(this.door).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+                _ic_set_24 = _ic_set_24.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_24;
+    }
+
+    _tr_env_open_door_last(): BSet<POSITION> {
+        let _ic_set_25: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+                _ic_set_25 = _ic_set_25.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_25;
+    }
+
+    _tr_env_open_door_skip(): BSet<POSITION> {
+        let _ic_set_26: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).unequal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_open_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+                _ic_set_26 = _ic_set_26.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_26;
+    }
+
+    _tr_env_start_close_door(): BSet<POSITION> {
+        let _ic_set_27: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BSet(new DOOR_STATE(enum_DOOR_STATE.door_moving), new DOOR_STATE(enum_DOOR_STATE.open)).elementOf(this.door).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+                _ic_set_27 = _ic_set_27.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_27;
+    }
+
+    _tr_env_close_door(): BSet<POSITION> {
+        let _ic_set_28: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BBoolean(!new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && this.door.equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue()).booleanValue() && this.gear.unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BSet(new GEAR_STATE(enum_GEAR_STATE.extended), new GEAR_STATE(enum_GEAR_STATE.retracted)).elementOf(this.gear).booleanValue()).booleanValue()).booleanValue())).booleanValue()) {
+                _ic_set_28 = _ic_set_28.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_28;
+    }
+
+    _tr_env_close_door_skip(): BSet<POSITION> {
+        let _ic_set_29: BSet<POSITION> = new BSet<POSITION>();
+        for(let _ic_gr_1 of this.gears.domain()) {
+            if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.doors.functionCall(_ic_gr_1).equal(new DOOR_STATE(enum_DOOR_STATE.door_moving)).booleanValue() && this.gears.functionCall(_ic_gr_1).unequal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.gears.range().notElementOf(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue()).booleanValue() && this.doors.relationImage(LandingGear_R6._POSITION.difference(new BSet(_ic_gr_1))).unequal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && new BBoolean(this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue() || new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue()).booleanValue()).booleanValue() && this.valve_close_door.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue() && new BBoolean(!new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() || this.shock_absorber.equal(new PLANE_STATE(enum_PLANE_STATE.ground)).booleanValue()).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue())).booleanValue()) {
+                _ic_set_29 = _ic_set_29.union(new BSet<POSITION>(_ic_gr_1));
+            }
+
+        }
+        return _ic_set_29;
+    }
+
+    _tr_toggle_handle_up(): boolean {
+        return this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue();
+    }
+
+    _tr_toggle_handle_down(): boolean {
+        return this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue();
+    }
+
+    _tr_con_stimulate_general_valve(): boolean {
+        return new BBoolean(this.general_EV.equal(new BBoolean(false)).booleanValue() && this.handle_move.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_con_stop_stimulate_general_valve(): boolean {
+        return new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(true)).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.retract_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.extend_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && this.close_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() && new BBoolean(new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue() || new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.down)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue()).booleanValue() || new BBoolean(new BBoolean(new BBoolean(this.handle.equal(new HANDLE_STATE(enum_HANDLE_STATE.up)).booleanValue() && this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()).booleanValue() && this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()).booleanValue() && this.open_EV.equal(new BBoolean(false)).booleanValue()).booleanValue()).booleanValue()).booleanValue();
+    }
+
+    _tr_evn_open_general_valve(): boolean {
+        return new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(true)).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_closed)).booleanValue()).booleanValue() && this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_closed)).booleanValue()).booleanValue();
+    }
+
+    _tr_evn_close_general_valve(): boolean {
+        return new BBoolean(new BBoolean(this.general_EV.equal(new BBoolean(false)).booleanValue() || this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_open)).booleanValue()).booleanValue() && this.general_valve.equal(new VALVE_STATE(enum_VALVE_STATE.valve_open)).booleanValue()).booleanValue();
+    }
+
+    _tr_env_close_analogical_switch(): boolean {
+        return new BBoolean(this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_open)).booleanValue() && this.handle_move.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }
+
+    _tr_env_open_analogical_switch(): boolean {
+        return this.analogical_switch.equal(new SWITCH_STATE(enum_SWITCH_STATE.switch_closed)).booleanValue();
+    }
+
+    _check_inv_1() {
+        return LandingGear_R6._SWITCH_STATE.elementOf(this.analogical_switch).booleanValue();
+    }_check_inv_2() {
+        return BUtils.BOOL.elementOf(this.general_EV).booleanValue();
+    }_check_inv_3() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.general_valve).booleanValue();
+    }_check_inv_4() {
+        return BUtils.BOOL.elementOf(this.handle_move).booleanValue();
+    }_check_inv_5() {
+        return BUtils.BOOL.elementOf(this.close_EV).booleanValue();
+    }_check_inv_6() {
+        return BUtils.BOOL.elementOf(this.extend_EV).booleanValue();
+    }_check_inv_7() {
+        return BUtils.BOOL.elementOf(this.open_EV).booleanValue();
+    }_check_inv_8() {
+        return BUtils.BOOL.elementOf(this.retract_EV).booleanValue();
+    }_check_inv_9() {
+        return LandingGear_R6._PLANE_STATE.elementOf(this.shock_absorber).booleanValue();
+    }_check_inv_10() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.valve_close_door).booleanValue();
+    }_check_inv_11() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.valve_extend_gear).booleanValue();
+    }_check_inv_12() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.valve_open_door).booleanValue();
+    }_check_inv_13() {
+        return LandingGear_R6._VALVE_STATE.elementOf(this.valve_retract_gear).booleanValue();
+    }_check_inv_14() {
+        return LandingGear_R6._HANDLE_STATE.elementOf(this.handle).booleanValue();
+    }_check_inv_15() {
+        return LandingGear_R6._DOOR_STATE.elementOf(this.door).booleanValue();
+    }_check_inv_16() {
+        return LandingGear_R6._GEAR_STATE.elementOf(this.gear).booleanValue();
+    }_check_inv_17() {
+        return new BBoolean(!new BBoolean(new BBoolean(new BBoolean(this.open_EV.equal(new BBoolean(true)).booleanValue() || this.close_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() || this.retract_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() || this.extend_EV.equal(new BBoolean(true)).booleanValue()).booleanValue() || this.general_EV.equal(new BBoolean(true)).booleanValue()).booleanValue();
+    }_check_inv_18() {
+        return new BBoolean(this.open_EV.equal(new BBoolean(true)).booleanValue() && this.close_EV.equal(new BBoolean(true)).booleanValue()).not().booleanValue();
+    }_check_inv_19() {
+        return this.gears.checkDomain(LandingGear_R6._POSITION).and(this.gears.checkRange(LandingGear_R6._GEAR_STATE)).and(this.gears.isFunction()).and(this.gears.isTotal(LandingGear_R6._POSITION)).booleanValue();
+    }_check_inv_20() {
+        return this.doors.checkDomain(LandingGear_R6._POSITION).and(this.doors.checkRange(LandingGear_R6._DOOR_STATE)).and(this.doors.isFunction()).and(this.doors.isTotal(LandingGear_R6._POSITION)).booleanValue();
+    }_check_inv_21() {
+        return new BBoolean((!this.door.equal(new DOOR_STATE(enum_DOOR_STATE.closed)).booleanValue() || this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue()) && (!this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.closed))).booleanValue() || this.door.equal(new DOOR_STATE(enum_DOOR_STATE.closed)).booleanValue())).booleanValue();
+    }_check_inv_22() {
+        return new BBoolean((!this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue() || this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue()) && (!this.doors.range().equal(new BSet(new DOOR_STATE(enum_DOOR_STATE.open))).booleanValue() || this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue())).booleanValue();
+    }_check_inv_23() {
+        return new BBoolean((!this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue()) && (!this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.extended))).booleanValue() || this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.extended)).booleanValue())).booleanValue();
+    }_check_inv_24() {
+        return new BBoolean((!this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue() || this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue()) && (!this.gears.range().equal(new BSet(new GEAR_STATE(enum_GEAR_STATE.retracted))).booleanValue() || this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.retracted)).booleanValue())).booleanValue();
+    }_check_inv_25() {
+        return new BBoolean(!this.gear.equal(new GEAR_STATE(enum_GEAR_STATE.gear_moving)).booleanValue() || this.door.equal(new DOOR_STATE(enum_DOOR_STATE.open)).booleanValue()).booleanValue();
+    }
+
+
+}
+
diff --git a/B2Program/LandingGear/HydraulicCircuit/Outgoing.prob2trace b/B2Program/LandingGear/HydraulicCircuit/Outgoing.prob2trace
new file mode 100644
index 0000000000000000000000000000000000000000..68abd72d16bcf8669c75564d92a1fa0012122a68
--- /dev/null
+++ b/B2Program/LandingGear/HydraulicCircuit/Outgoing.prob2trace
@@ -0,0 +1,195 @@
+{
+	"description": "Created from B2Program JS Export",
+	"transitionList": [
+		{
+			"name": "$initialise_machine",
+			"params": {}
+		},
+		{
+			"name": "toggle_handle_up",
+			"params": {}
+		},
+		{
+			"name": "begin_flying",
+			"params": {}
+		},
+		{
+			"name": "con_stimulate_general_valve",
+			"params": {}
+		},
+		{
+			"name": "con_stimulate_open_door_valve",
+			"params": {}
+		},
+		{
+			"name": "env_close_analogical_switch",
+			"params": {}
+		},
+		{
+			"name": "open_valve_door_open",
+			"params": {}
+		},
+		{
+			"name": "evn_open_general_valve",
+			"params": {}
+		},
+		{
+			"name": "env_start_open_door",
+			"params": {}
+		},
+		{
+			"name": "env_start_open_door",
+			"params": {}
+		},
+		{
+			"name": "env_start_open_door",
+			"params": {
+				"gr": "rt"
+			}
+		},
+		{
+			"name": "env_open_door_skip",
+			"params": {
+				"gr": "fr"
+			}
+		},
+		{
+			"name": "env_open_door_skip",
+			"params": {
+				"gr": "lt"
+			}
+		},
+		{
+			"name": "env_open_door_last",
+			"params": {
+				"gr": "rt"
+			}
+		},
+		{
+			"name": "con_stimulate_retract_gear_valve",
+			"params": {}
+		},
+		{
+			"name": "open_valve_retract_gear",
+			"params": {}
+		},
+		{
+			"name": "env_start_retracting_first",
+			"params": {
+				"gr": "fr"
+			}
+		},
+		{
+			"name": "env_start_retracting_first",
+			"params": {
+				"gr": "lt"
+			}
+		},
+		{
+			"name": "env_start_retracting_first",
+			"params": {
+				"gr": "rt"
+			}
+		},
+		{
+			"name": "env_retract_gear_skip",
+			"params": {
+				"gr": "fr"
+			}
+		},
+		{
+			"name": "env_retract_gear_skip",
+			"params": {
+				"gr": "lt"
+			}
+		},
+		{
+			"name": "env_retract_gear_last",
+			"params": {
+				"gr": "rt"
+			}
+		},
+		{
+			"name": "con_stop_stimulate_retract_gear_valve",
+			"params": {}
+		},
+		{
+			"name": "con_stop_stimulate_open_door_valve",
+			"params": {}
+		},
+		{
+			"name": "close_valve_door_open",
+			"params": {}
+		},
+		{
+			"name": "con_stimulate_close_door_valve",
+			"params": {}
+		},
+		{
+			"name": "open_valve_door_close",
+			"params": {}
+		},
+		{
+			"name": "env_start_close_door",
+			"params": {
+				"gr": "fr"
+			}
+		},
+		{
+			"name": "env_start_close_door",
+			"params": {
+				"gr": "lt"
+			}
+		},
+		{
+			"name": "env_start_close_door",
+			"params": {
+				"gr": "rt"
+			}
+		},
+		{
+			"name": "env_close_door_skip",
+			"params": {
+				"gr": "fr"
+			}
+		},
+		{
+			"name": "env_close_door_skip",
+			"params": {
+				"gr": "lt"
+			}
+		},
+		{
+			"name": "env_close_door",
+			"params": {
+				"gr": "rt"
+			}
+		},
+		{
+			"name": "con_stop_stimulate_close_door_valve",
+			"params": {}
+		},
+		{
+			"name": "close_valve_door_close",
+			"params": {}
+		},
+		{
+			"name": "con_stop_stimulate_general_valve",
+			"params": {}
+		},
+		{
+			"name": "close_valve_retract_gear",
+			"params": {}
+		},
+		{
+			"name": "evn_close_general_valve",
+			"params": {}
+		}
+	],
+	"metadata": {
+		"fileType": "Trace",
+		"formatVersion": 1,
+		"creator": "B2Program JS",
+		"modelName": "LandingGear_R6"
+	}
+}
\ No newline at end of file
diff --git a/B2Program/LandingGear/HydraulicCircuit/architecture.svg b/B2Program/LandingGear/HydraulicCircuit/architecture.svg
new file mode 100644
index 0000000000000000000000000000000000000000..81bba719c8c6819b864376d7f6a1046752211c32
--- /dev/null
+++ b/B2Program/LandingGear/HydraulicCircuit/architecture.svg
@@ -0,0 +1,328 @@
+<?xml-stylesheet href="landinggear.css" type="text/css"?>
+
+<svg width="947" height="728" xmlns="http://www.w3.org/2000/svg" id="landinggear" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <metadata id="metadata3467">image/svg+xml</metadata>
+
+ <g>
+  <title>background</title>
+  <rect x="-1" y="-1" width="949" height="730" id="canvas_background" fill="none"/>
+ </g>
+ <g>
+  <title>Layer 1</title>
+  <g id="svg_3">
+    <g id="gear_door_abstract">
+     <g id="gear_cylinder_abstract">
+      <g id="gear_cylinder">
+       <rect x="375" y="609.37699" width="108" height="40" stroke="#000000" fill="#cccccc"/>
+       <g id="gear_cylinder_forcer">
+        <rect x="375" y="610" width="15" height="39" stroke="#1c93a5" fill="#666666"/>
+        <rect x="390" y="625" width="90" height="9" stroke="#1c93a5" fill="#666666"/>
+       </g>
+      </g>
+      <text fill="#000000" stroke="#000" stroke-width="0" x="402" y="599.5" id="svg_45" font-size="8" font-family="Helvetica, Arial, sans-serif" text-anchor="left" xml:space="preserve">gear cylinder</text>
+     </g>
+     <g id="door_cylinder_abstract">
+      <g id="door_cylinder">
+       <rect id="door_cylinder1" stroke-linejoin="null" stroke-linecap="null" x="375.0909" y="414.37699" width="107.58621" height="39.44828" stroke-dasharray="null" stroke-width="null" stroke="#000000" fill="#cccccc"/>
+       <g id="door_cylinder_forcer">
+        <rect id="door_cylinder_forcer1" stroke-width="null" stroke-linejoin="null" stroke-linecap="null" x="376" y="414.35657" width="15.24138" height="39" stroke="#1c93a5" fill="#666666"/>
+        <rect id="door_cylinder_forcer2" stroke-width="null" stroke-linejoin="null" stroke-linecap="null" x="391" y="430.27036" width="90" height="8.96552" stroke="#1c93a5" fill="#666666"/>
+       </g>
+      </g>
+      <text fill="#000000" stroke="#000" stroke-width="0" x="402" y="402.5" id="svg_44" font-size="8" font-family="Helvetica, Arial, sans-serif" text-anchor="left" xml:space="preserve">door cylinder</text>
+     </g>
+    </g>
+   <rect fill="#666666" stroke="#1c93a5" stroke-width="null" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="492.72729" y="460.68176" width="0.25" id="svg_26" height="0"/>
+   <g id="lights" class="refinementGroup" data-custom="R7GearsDoorsHandleValvesControllerSwitchLights">
+    <rect id="svg_22" stroke="#1c93a5" height="10" width="10" y="75.875" x="49.25" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" fill="#88d2f7"/>
+    <rect id="svg_33" stroke="#1c93a5" height="10" width="10" y="75.875" x="72.5" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" fill="#88d2f7"/>
+    <rect id="rect3363" stroke="#1c93a5" height="10" width="10" y="75.875" x="95.75" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" fill="#88d2f7"/>
+    <line marker-end="url(#se_marker_end_svg_36)" id="line3365" y2="51.25" x2="54" y1="75.25" x1="54" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="null" stroke="#ff0000" fill="none"/>
+    <line id="svg_46" marker-end="url(#se_marker_end_svg_46)" y2="51.25" x2="77.5" y1="75.25" x1="77.5" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="null" stroke="#ff0000" fill="none"/>
+    <line id="svg_47" marker-end="url(#se_marker_end_svg_47)" y2="51.25" x2="100.75" y1="75.25" x1="100.75" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="null" stroke="#ff0000" fill="none"/>
+    <ellipse id="green_light" ry="8" rx="8" cy="34.625" cx="53.75" stroke-width="0" stroke="#000000" fill="#cfffa0"/>
+    <ellipse id="orange_light" ry="8" rx="8" cy="34.625" cx="77.25" stroke-width="0" stroke="#000000" fill="#ffe7ad"/>
+    <ellipse id="red_light" ry="8" rx="8" cy="34.625" cx="100.75" stroke-width="0" stroke="#000000" fill="#ffc9c9"/>
+   </g>
+   <g id="sensors" class="refinementGroup" data-custom="R8GearsDoorsHandleValvesControllerSwitchLightsSensors">
+    <path fill="none" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" d="m220.5,57l-96.25,0l0,26.5" id="sensor_handle" marker-end="url(#se_marker_end_svg_45)" stroke="#ff0000"/>
+    <rect id="svg_5-6" height="2.5" width="2.5" y="83.24999" x="123.125" stroke-linecap="null" stroke-linejoin="null" stroke="#1c93a5" fill="#88d2f7"/>
+    <rect id="svg_92" height="2.5" width="2.5" y="93.95676" x="146.88522" stroke-linecap="null" stroke-linejoin="null" stroke="#1c93a5" fill="#88d2f7"/>
+    <rect id="svg_99" height="2.5" width="2.5" y="98.63826" x="146.88522" stroke-linecap="null" stroke-linejoin="null" stroke="#1c93a5" fill="#88d2f7"/>
+    <rect id="svg_111" height="2.5" width="2.5" y="103.42097" x="146.88522" stroke-linecap="null" stroke-linejoin="null" stroke="#1c93a5" fill="#88d2f7"/>
+    <rect id="svg_5" height="2.5" width="2.5" y="89.36598" x="146.88522" stroke-linecap="null" stroke-linejoin="null" stroke="#1c93a5" fill="#88d2f7"/>
+    <rect id="svg_5" height="2.5" width="2.5" y="85.46598" x="146.88522" stroke-linecap="null" stroke-linejoin="null" stroke="#1c93a5" fill="#88d2f7"/>
+    <line id="sensor_shock_absorber" y2="86.47652" x2="378.17615" y1="86.47652" x1="149.66943" stroke-linecap="null" stroke-linejoin="null" stroke-width="null" stroke="#ff0000" fill="#ff0000"/>
+    <line id="gear_extended_fr" y2="90.47652" x2="378.17615" y1="90.47652" x1="149.66943" stroke-linecap="null" stroke-linejoin="null" stroke-width="null" stroke="#ff0000" fill="#ff0000"/>
+    <line id="gear_extended_rt" y2="95.35306" x2="378.17612" y1="95.35306" x1="149.66943" stroke-linecap="null" stroke-linejoin="null" stroke-width="null" stroke="#ff0000"/>
+    <line id="gear_extended_lt" y2="100.04845" x2="378.17615" y1="100.04845" x1="149.66943" stroke-linecap="null" stroke-linejoin="null" stroke-width="null" stroke="#ff0000"/>
+    <line id="gear_retracted_fr" y2="104.74781" x2="378.17615" y1="104.74781" x1="149.66943" stroke-linecap="null" stroke-linejoin="null" stroke-width="null" stroke="#ff0000"/>
+    <line y2="109.75434" x2="378.17615" y1="109.75434" x1="149.66943" stroke-linecap="null" stroke-linejoin="null" stroke-width="null" id="gear_retracted_rt" stroke="#ff0000"/>
+    <rect height="2.5" width="2.5" y="143.99486" x="146.88522" stroke-linecap="null" stroke-linejoin="null" id="svg_21" stroke="#1c93a5" fill="#88d2f7"/>
+    <rect id="svg_111-1" height="2.5" width="2.5" y="108.35166" x="146.88522" stroke-linecap="null" stroke-linejoin="null" stroke="#1c93a5" fill="#88d2f7"/>
+    <rect id="svg_111-8" height="2.5" width="2.5" y="113.18684" x="146.88522" stroke-linecap="null" stroke-linejoin="null" stroke="#1c93a5" fill="#88d2f7"/>
+    <rect id="svg_111-4" height="2.5" width="2.5" y="118.20257" x="146.88522" stroke-linecap="null" stroke-linejoin="null" stroke="#1c93a5" fill="#88d2f7"/>
+    <rect id="svg_111-9" height="2.5" width="2.5" y="123.38999" x="146.88522" stroke-linecap="null" stroke-linejoin="null" stroke="#1c93a5" fill="#88d2f7"/>
+    <rect id="svg_111-7" height="2.5" width="2.5" y="128.43594" x="146.88522" stroke-linecap="null" stroke-linejoin="null" stroke="#1c93a5" fill="#88d2f7"/>
+    <rect id="svg_111-84" height="2.5" width="2.5" y="133.82087" x="146.88522" stroke-linecap="null" stroke-linejoin="null" stroke="#1c93a5" fill="#88d2f7"/>
+    <rect id="svg_111-89" height="2.5" width="2.5" y="138.78944" x="146.88522" stroke-linecap="null" stroke-linejoin="null" stroke="#1c93a5" fill="#88d2f7"/>
+    <line y2="114.54458" x2="378.17615" y1="114.54458" x1="149.66943" stroke-linecap="null" stroke-linejoin="null" stroke-width="null" id="gear_retracted_lt" stroke="#ff0000"/>
+    <line y2="119.60815" x2="378.17615" y1="119.60815" x1="149.66943" stroke-linecap="null" stroke-linejoin="null" stroke-width="null" id="door_open_fr" stroke="#ff0000"/>
+    <line y2="124.64205" x2="378.17612" y1="124.64205" x1="149.66943" stroke-linecap="null" stroke-linejoin="null" stroke-width="null" id="door_open_rt" stroke="#ff0000"/>
+    <line y2="129.74892" x2="378.17618" y1="129.74892" x1="149.66943" stroke-linecap="null" stroke-linejoin="null" stroke-width="null" id="door_open_lt" stroke="#ff0000"/>
+    <line y2="135.22057" x2="378.17615" y1="135.22057" x1="149.66943" stroke-linecap="null" stroke-linejoin="null" stroke-width="null" id="door_closed_fr" stroke="#ff0000"/>
+    <line y2="140.03568" x2="378.17618" y1="140.03568" x1="149.66943" stroke-linecap="null" stroke-linejoin="null" stroke-width="null" id="door_closed_rt" stroke="#ff0000"/>
+    <line y2="145.36139" x2="378.17615" y1="145.36139" x1="149.66943" stroke-linecap="null" stroke-linejoin="null" stroke-width="null" id="door_closed_lt" stroke="#ff0000"/>
+    <g id="g3986">
+     <text xml:space="preserve" font-size="7px" id="svg_23" y="88.7322" x="430.75" stroke-linecap="null" stroke-linejoin="null" font-family="Monospace" stroke-width="0" stroke="#ff0000" fill="#4f9e00" text-anchor="middle">ground</text>
+     <text xml:space="preserve" font-size="7px" id="svg_37" y="88.7322" x="460.75" stroke-linecap="null" stroke-linejoin="null" font-family="Monospace" stroke-width="0" stroke="#ff0000" fill="#ff0000" text-anchor="middle">flight</text>
+     <text xml:space="preserve" font-size="7px" id="svg_23" y="101.7322" x="416.73816" stroke-linecap="null" stroke-linejoin="null" font-family="Monospace" stroke-width="0" stroke="#ff0000" fill="#4f9e00" text-anchor="middle">gear extended</text>
+     <text xml:space="preserve" font-size="7px" id="svg_37" y="101.7322" x="473.59796" stroke-linecap="null" stroke-linejoin="null" font-family="Monospace" stroke-width="0" stroke="#ff0000" fill="#ff0000" text-anchor="middle">not extended</text>
+     <text xml:space="preserve" font-size="7px" id="svg_37-1" y="101.7698" x="546.80585" stroke-linecap="null" stroke-linejoin="null" font-family="Monospace" stroke-width="0" stroke="#ff0000" fill="#ff0000" text-anchor="middle">
+      <tspan id="tspan3984" fill="#000000">(front, right, left)</tspan>
+     </text>
+     <text xml:space="preserve" font-size="7px" id="svg_23-5" y="115.38843" x="414.63269" stroke-linecap="null" stroke-linejoin="null" font-family="Monospace" stroke-width="0" stroke="#ff0000" fill="#4f9e00" text-anchor="middle">gear retracted</text>
+     <text xml:space="preserve" font-size="7px" id="svg_37-8" y="115.38843" x="475.70343" stroke-linecap="null" stroke-linejoin="null" font-family="Monospace" stroke-width="0" stroke="#ff0000" fill="#ff0000" text-anchor="middle">not retracted</text>
+     <text xml:space="preserve" font-size="7px" id="svg_37-1-6" y="115.42602" x="546.80585" stroke-linecap="null" stroke-linejoin="null" font-family="Monospace" stroke-width="0" stroke="#ff0000" fill="#ff0000" text-anchor="middle">
+      <tspan id="tspan3984-2" fill="#000000">(front, right, left)</tspan>
+     </text>
+     <text xml:space="preserve" font-size="7px" id="svg_23-9" y="129.38843" x="425.12927" stroke-linecap="null" stroke-linejoin="null" font-family="Monospace" stroke-width="0" stroke="#ff0000" fill="#4f9e00" text-anchor="middle">door open</text>
+     <text xml:space="preserve" font-size="7px" id="svg_37-9" y="129.38843" x="465.17609" stroke-linecap="null" stroke-linejoin="null" font-family="Monospace" stroke-width="0" stroke="#ff0000" fill="#ff0000" text-anchor="middle">not open</text>
+     <text xml:space="preserve" font-size="7px" id="svg_37-1-5" y="129.42603" x="546.80585" stroke-linecap="null" stroke-linejoin="null" font-family="Monospace" stroke-width="0" stroke="#ff0000" fill="#ff0000" text-anchor="middle">
+      <tspan id="tspan3984-8" fill="#000000">(front, right, left)</tspan>
+     </text>
+     <text xml:space="preserve" font-size="7px" id="svg_23-7" y="142.88843" x="420.9491" stroke-linecap="null" stroke-linejoin="null" font-family="Monospace" stroke-width="0" stroke="#ff0000" fill="#4f9e00" text-anchor="middle">door closed</text>
+     <text xml:space="preserve" font-size="7px" id="svg_37-5" y="142.88843" x="469.38702" stroke-linecap="null" stroke-linejoin="null" font-family="Monospace" stroke-width="0" stroke="#ff0000" fill="#ff0000" text-anchor="middle">not closed</text>
+     <text xml:space="preserve" font-size="7px" id="svg_37-1-9" y="142.92603" x="546.80585" stroke-linecap="null" stroke-linejoin="null" font-family="Monospace" stroke-width="0" stroke="#ff0000" fill="#ff0000" text-anchor="middle">
+      <tspan id="tspan3984-3" fill="#000000">(front, right, left)</tspan>
+     </text>
+    </g>
+   </g>
+   <g id="switch_general_valve" class="refinementGroup" data-custom="R6GearsDoorsHandleValvesControllerSwitch">
+    <rect id="con_stimulate_general_valve" stroke="#1c93a5" height="10" width="10" y="195" x="127" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" fill="#88d2f7"/>
+    <rect height="2.5" width="2.5" y="149.375" x="147" stroke-linecap="null" stroke-linejoin="null" id="svg_136" stroke-dasharray="null" stroke="#1c93a5" fill="#88d2f7"/>
+    <g id="general_circuit">
+     <text stroke="#ff0000" xml:space="preserve" text-anchor="middle" font-family="Monospace" font-size="8" y="215.72867" x="401.08732" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="0" fill="#000000" id="svg_121">General electro-valve</text>
+     <text id="lb_analogical_switch" stroke="#ff0000" xml:space="preserve" text-anchor="middle" font-family="Monospace" font-size="8" y="247.72583" x="271.09229" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="0" fill="#000000">Analogical switch</text>
+     <line stroke="#88d2f7" marker-start="url(#se_marker_start_svg_7)" id="svg_7" y2="266.95453" x2="577.16045" y1="266.95453" x1="436.15906" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="2" fill="none"/>
+     <text id="svg_12" stroke="#ff0000" xml:space="preserve" text-anchor="middle" font-family="Monospace" font-size="8" y="259.07171" x="510.52411" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="0" fill="#000000">Aircraft hydraulic circuit</text>
+      <g id="hydraulic_circuit">
+      <line id="hydraulic_circuit_1" fill="none" stroke="#cccccc" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x1="364.18182" y1="266.36359" x2="202.07075" y2="266.36359" stroke-width="2"/>
+      <line id="hydraulic_circuit_2" fill="none" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x1="202.15906" y1="265.85309" x2="202.15906" y2="684.78071" stroke-width="2" stroke="#cccccc"/>
+      <line id="hydraulic_circuit_3" fill="none" stroke-width="2" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x1="201.61359" y1="391.5" x2="241.66325" y2="391.5" stroke="#cccccc"/>
+      <line id="hydraulic_circuit_4" fill="none" stroke-width="2" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x1="201.49789" y1="488.27273" x2="241.54755" y2="488.27273" stroke="#cccccc" />
+      <line id="hydraulic_circuit_5" fill="none" stroke-width="2" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x1="201.4979" y1="586.02272" x2="241.54756" y2="586.02272" stroke="#cccccc" />
+      <line id="hydraulic_circuit_6" fill="none" stroke-width="2" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x1="201.4979" y1="683.77272" x2="241.54756" y2="683.77272" stroke="#cccccc" />
+     </g>
+     <g id="analogical_switch_eo_ev_general">
+      <g id="eo_ev_general">
+       <g id="ev_general">
+        <path id="ev_general_1" fill="#cccccc" stroke-linejoin="null" stroke-linecap="null" d="m364.979,243.3l32.58398,22.13899l-32.58398,22.13901l0,-44.278l0,0z" stroke="#000000" class="valve"/>
+        <path id="ev_general_2" fill="#cccccc" stroke-linejoin="null" stroke-linecap="null" d="m431.203,287.578l-32.58401,-22.13901l32.58401,-22.14l0,44.27901l0,0l0,0z" stroke="#000000" class="valve"/>
+        <line fill="none" stroke-width="null" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x1="397.98443" y1="265.13815" x2="397.98443" y2="239.78808" stroke="#000000" id="svg_116"/>
+       </g>
+       <g id="eo_general">
+        <g id="ge-order-1">
+         <line id="eo_general_1" y2="232.88431" x2="131.70442" y1="205.2975" x1="131.70442" stroke-linecap="null" stroke-linejoin="null" fill="none" stroke="#ff0000" class="order"/>
+         <line id="eo_general_2" stroke="#ff0000" marker-start="url(#se_marker_start_svg_120)" y2="232.77128" x2="131.22833" y1="232.77128" x1="228.2198" stroke-linecap="null" stroke-linejoin="round" stroke-width="null" fill="none" class="order"/>
+        </g>
+        <g stroke="null" id="ge-order-2">
+         <rect stroke="#000000" fill="#cccccc" stroke-width="null" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="383.77242" y="224.35357" width="29.03165" height="15.24684" id="svg_114"/>
+         <line id="eo_general_3" stroke="#ff0000" class="order" marker-end="url(#se_marker_end_svg_3)" y2="232.77273" x2="308.39462" y1="232.77273" x1="383.63528" stroke-linecap="null" stroke-linejoin="round" stroke-width="null" fill="none"/>
+         <line stroke="#000000" fill="none" stroke-width="null" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x1="383.51134" y1="239.69376" x2="412.80406" y2="225.23015" id="svg_115"/>
+        </g>
+       </g>
+      </g>
+      <g id="analogical_switch">
+       <g id="analogical_switch_open">
+        <line fill="none" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x1="268.875" y1="68.00001" x2="268.875" y2="223" id="switch_to_handle" stroke="#ff0000"/>
+        <rect fill="#ff0000" stroke-width="0" stroke-linejoin="null" stroke-linecap="null" x="254.83269" y="211.48889" width="28.39808" height="11.55828" id="open_switch" stroke="#ff0000"/>
+        <g stroke="null" id="svg_39">
+         <line stroke="#ff0000" y2="150.72597" x2="263.17623" y1="150.72597" x1="149.87163" stroke-linecap="null" stroke-linejoin="null" id="svg_13" fill="none"/>
+         <line stroke="#ff0000" stroke-linejoin="null" stroke-linecap="null" x1="263.56864" y1="150.12182" x2="263.56864" y2="211.29864" id="svg_31" fill="none"/>
+        </g>
+       </g>
+       <g id="analogical_switch_closed">
+        <line id="analogical_switch_1" class="order" stroke="#ff0000" fill="none" stroke-linejoin="null" stroke-linecap="null" x1="268.875" y1="68.26942" x2="268.875" y2="236.9968"/>
+        <g stroke="null" id="svg_32">
+         <line id="analogical_switch_2" stroke="#ff0000" y2="150.72597" x2="263.17623" y1="150.72597" x1="149.87163" stroke-linecap="null" stroke-linejoin="null" fill="none" class="order"/>
+         <line id="analogical_switch_3" stroke="#ff0000" stroke-linejoin="null" stroke-linecap="null" x1="263.56864" y1="150.12182" x2="263.56864" y2="225.53928" fill="none" class="order"/>
+        </g>
+        <rect fill="#ff0000" stroke-width="0" stroke-linejoin="null" stroke-linecap="null" x="254.83269" y="225.48569" width="28.39808" height="11.55828" id="close_switch_1" class="order" stroke="#ff0000"/>
+        <line id="close_switch_2" class="order" stroke="#ff0000" stroke-linecap="null" stroke-linejoin="round" y2="232.7986" x2="308.56438" y1="232.7986" x1="282.68913" fill-opacity="null" stroke-opacity="null" fill="none"/>
+        <line id="close_switch_3" class="order" stroke="#ff0000" stroke-linecap="null" stroke-linejoin="round" y2="232.7986" x2="256.58975" y1="232.7986" x1="227.04788" fill-opacity="null" stroke-opacity="null" fill="none"/>
+       </g>
+      </g>
+     </g>
+    </g>
+   </g>
+   <g id="handleRefinement" data-custom="R2GearDoorHandle" class="refinementGroup">
+    <image xlink:href="img/handle_down.png" id="ev_handle" x="237" y="17" width="60" height="45"/>
+   </g>
+   <g id="controller" class="refinementGroup" data-custom="R5GearsDoorsHandleValvesController">
+    <g id="svg_51">
+     <rect id="svg_24" height="109" width="109" y="86" x="38" stroke="#1c93a5" fill="#ffffff"/>
+     <text font-weight="normal" xml:space="preserve" font-size="12" id="svg_25" y="144.54541" x="93.81818" stroke-linecap="null" stroke-linejoin="null" text-anchor="middle" font-family="Monospace" stroke-dasharray="null" stroke-width="0" stroke="#000000" fill="#000000">Digital part</text>
+     <rect id="signal_extend_gears" height="10" width="10" y="195" x="47" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke="#1c93a5" fill="#88d2f7"/>
+     <rect id="signal_retract_gears" height="10" width="10" y="195" x="68" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke="#1c93a5" fill="#88d2f7"/>
+     <rect id="signal_open_door" height="10" width="10" y="195" x="88" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke="#1c93a5" fill="#88d2f7"/>
+     <rect id="signal_close_door" height="10" width="10" y="195" x="108" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke="#1c93a5" fill="#88d2f7"/>
+    </g>
+    <text transform="rotate(-90 36.72660064697272,458.7269897460938) " xml:space="preserve" font-size="8" id="svg_20" y="461.45453" x="36.72726" stroke-linecap="null" stroke-linejoin="null" text-anchor="middle" font-family="Monospace" stroke-dasharray="null" stroke-width="0" stroke="#ff0000" fill="#000000">Orders to electro-valves</text>
+    <g id="eo_close_doors">
+     <line stroke-width="null" stroke-linejoin="null" stroke-linecap="null" x1="274.98441" y1="389.53458" x2="274.98441" y2="364.18451" id="svg_8" stroke-dasharray="null" stroke="#000000" fill="none"/>
+     <rect stroke-width="null" stroke-linejoin="null" stroke-linecap="null" x="260.2724" y="349" width="29.03165" height="15.24684" id="svg_4" stroke-dasharray="null" stroke="#000000" fill="#cccccc"/>
+     <line stroke-width="null" stroke-linejoin="null" stroke-linecap="null" x1="260.26132" y1="364.09019" x2="289.55404" y2="349.62658" id="svg_6" stroke-dasharray="null" stroke="#000000" fill="none"/>
+     <line id="eo_close_doors_1" y2="357.25" x2="113.07455" y1="205.41318" x1="113.07455" stroke-linecap="null" stroke-linejoin="null" stroke="#ff0000" fill="none" class="order"/>
+     <line id="eo_close_doors_2" y2="356.57268" x2="112.52485" y1="356.57268" x1="260" stroke-linecap="null" stroke-width="null" stroke-linejoin="round" stroke="#ff0000" fill="none" class="order"/>
+    </g>
+    <g id="eo_open_doors">
+     <line stroke-width="null" stroke-linejoin="null" stroke-linecap="null" x1="274.98442" y1="487.13815" x2="274.98442" y2="461.78808" id="svg_64" stroke="#000000" stroke-dasharray="null" fill="none"/>
+     <rect stroke-width="null" stroke-linejoin="null" stroke-linecap="null" x="260.77241" y="446.60357" width="29.03165" height="15.24684" id="svg_62" stroke="#000000" fill="#cccccc"/>
+     <line stroke-width="null" stroke-linejoin="null" stroke-linecap="null" x1="260.51133" y1="461.69376" x2="289.80406" y2="447.23016" id="svg_63" stroke="#000000" stroke-dasharray="null" fill="none"/>
+     <line class="order" id="eo_open_doors_1" y2="454.92481" x2="92.55869" y1="204.81752" x1="93.0293" stroke="#ff0000" stroke-linecap="null" stroke-linejoin="null" fill="none"/>
+     <line class="order" id="eo_open_doors_2" y2="454.32872" x2="92" y1="454.32872" x1="259.93863" stroke-linecap="null" stroke-width="null" stroke-linejoin="round" stroke="#ff0000" fill="none"/>
+    </g>
+    <g id="eo_retract_gears">
+     <line stroke-width="null" stroke-linejoin="null" stroke-linecap="null" x1="274.98442" y1="584.13815" x2="274.98442" y2="558.78808" id="svg_70" stroke-dasharray="null" stroke="#000000" fill="none"/>
+     <rect stroke-width="null" stroke-linejoin="null" stroke-linecap="null" x="260.77241" y="543.60357" width="29.03165" height="15.24684" id="svg_68" stroke="#000000" fill="#cccccc"/>
+     <line stroke-width="null" stroke-linejoin="null" stroke-linecap="null" x1="260.51133" y1="558.69376" x2="289.80406" y2="544.23016" id="svg_69" stroke-dasharray="null" stroke="#000000" fill="none"/>
+     <line class="order" id="eo_retract_gears_1" y2="552.40828" x2="71.80693" y1="204.78728" x1="72.33782" stroke-linecap="null" stroke-linejoin="null" stroke="#ff0000" fill="none"/>
+     <line class="order" id="eo_retract_gears_2" y2="551.84636" x2="71.23716" y1="551.84636" x1="260.62271" stroke-linecap="null" stroke-width="null" marker-start="url(#se_marker_start_svg_15)" stroke-linejoin="round" stroke="#ff0000" fill="none"/>
+    </g>
+    <g id="eo_extend_gears">
+     <line stroke-width="null" stroke-linejoin="null" stroke-linecap="null" x1="274.98442" y1="683.13815" x2="274.98442" y2="657.78808" id="svg_76" stroke-dasharray="null" stroke="#000000" fill="none"/>
+     <rect stroke-width="null" stroke-linejoin="null" stroke-linecap="null" x="260.77241" y="642.60358" width="29.03165" height="15.24684" id="svg_74" stroke-dasharray="null" stroke="#000000" fill="#cccccc"/>
+     <line stroke-width="null" stroke-linejoin="null" stroke-linecap="null" x1="260.51133" y1="657.69377" x2="289.80406" y2="643.23016" id="svg_75" stroke-dasharray="null" stroke="#000000" fill="none"/>
+     <line class="order" id="eo_extend_gears_1" y2="651.52644" x2="50.96783" y1="205.40543" x1="51.55688" stroke-linecap="null" stroke-linejoin="null" stroke="#ff0000" fill="none"/>
+     <line class="order" id="eo_extend_gears_2" y2="650.8053" x2="50.33563" y1="650.8053" x1="260.47121" stroke-linecap="null" stroke-width="null" marker-start="url(#se_marker_start_svg_15)" stroke-linejoin="round" stroke="#ff0000" fill="none"/>
+    </g>
+   </g>
+   <g class="refinementGroup" data-custom="R4GearsDoorsHandleValves" id="valves">
+    <text fill="#000000" stroke-width="0" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="287.09016" y="340.73151" font-size="8" font-family="Monospace" text-anchor="middle" xml:space="preserve" stroke="#ff0000" id="svg_100">Electro-valve (close doors)</text>
+    <text fill="#000000" stroke-width="0" stroke-linejoin="null" stroke-linecap="null" x="282.08733" y="438.72867" font-size="8" font-family="Monospace" text-anchor="middle" xml:space="preserve" stroke="#ff0000" id="svg_102">Electro-valve (open doors)</text>
+    <text fill="#000000" stroke-width="0" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="285.8423" y="535.72583" font-size="8" font-family="Monospace" text-anchor="middle" xml:space="preserve" stroke="#ff0000" id="svg_103">Electro-valve (retraction gears)</text>
+    <text fill="#000000" stroke-width="0" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="286.09727" y="636.73081" font-size="8" font-family="Monospace" text-anchor="middle" xml:space="preserve" stroke="#ff0000" id="svg_104">Electro-valve (extended gears)</text>
+    <text stroke="#ff0000" xml:space="preserve" text-anchor="middle" font-family="Monospace" font-size="8" y="383.31248" x="359.02269" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="0" fill="#000000" id="svg_101">(retraction circuit)</text>
+    <g id="retraction_circuit_doors">
+     <line id="retraction_circuit_doors_1" stroke="#cccccc" y2="390.375" x2="884.12496" y1="390.375" x1="308.125" stroke-width="2" fill="none"/>
+     <line id="retraction_circuit_doors_2" stroke="#cccccc" marker-end="url(#se_marker_end_svg_35)" y2="412.47753" x2="679.11353" y1="390.97717" x1="679.11353" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="2" fill="none"/>
+     <line id="retraction_circuit_doors_3" stroke="#cccccc" marker-end="url(#se_marker_end_svg_36)" y2="413.47717" x2="883.14771" y1="390.85218" x1="883.14771" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="2" fill="none"/>
+     <line id="retraction_circuit_doors_4" stroke="#cccccc" marker-end="url(#se_marker_end_svg_57)" y2="412.01154" x2="478.51137" y1="390.51118" x1="478.51137" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="2" fill="none"/>
+    </g>
+    <g id="retraction_circuit_gears">
+     <line id="retraction_circuit_gears_1" stroke="#cccccc" y2="584.80105" x2="884.39091" y1="584.80105" x1="308.59091" stroke-width="2" fill="none"/>
+     <line id="retraction_circuit_gears_2" stroke="#cccccc" marker-end="url(#se_marker_end_svg_35)" y2="606.90358" x2="679.07944" y1="585.40323" x1="679.07944" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="2" fill="none"/>
+     <line id="retraction_circuit_gears_3" stroke="#cccccc" marker-end="url(#se_marker_end_svg_36)" y2="607.40323" x2="883.36362" y1="584.77823" x1="883.36362" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="2" fill="none"/>
+     <line id="retraction_circuit_gears_4" stroke="#cccccc" marker-end="url(#se_marker_end_svg_57)" y2="606.93759" x2="479.47728" y1="585.43723" x1="479.47728" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="2" fill="none"/>
+    </g>
+    <g id="extension_circuit_doors">
+     <line id="extension_circuit_doors_1" stroke="#cccccc" y2="488.88635" x2="806.81378" y1="488.88635" x1="308.81812" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="2" fill="none"/>
+     <line id="extension_circuit_doors_2" marker-end="url(#se_marker_end_svg_88)" y2="455.36304" x2="397.45447" y1="488.65906" x1="397.45447" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="2" stroke="#cccccc" fill="none"/>
+     <line id="extension_circuit_doors_3" marker-end="url(#se_marker_end_svg_89)" y2="455.37472" x2="599.27272" y1="488.67074" x1="599.27272" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="2" stroke="#cccccc" fill="none"/>
+     <line id="extension_circuit_doors_4" stroke="#cccccc" marker-end="url(#se_marker_end_svg_90)" y2="454.37471" x2="805.77274" y1="488.57073" x1="805.77274" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="2" fill="none"/>
+    </g>
+    <g id="extension_circuit_gears">
+     <line id="extension_circuit_gears_1" stroke="#cccccc" y2="683.95454" x2="799.51371" y1="683.95454" x1="308.8681" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="2" fill="none"/>
+     <line id="extension_circuit_gears_2" marker-end="url(#se_marker_end_svg_88)" y2="650.18123" x2="397.25446" y1="683.47725" x1="397.25446" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="2" stroke="#cccccc" fill="none"/>
+     <line id="extension_circuit_gears_3" marker-end="url(#se_marker_end_svg_89)" y2="650.19291" x2="596.82271" y1="683.48893" x1="596.82271" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="2" stroke="#cccccc" fill="none"/>
+     <line id="extension_circuit_gears_4" marker-end="url(#se_marker_end_svg_90)" y2="649.9429" x2="798.57272" y1="683.23892" x1="798.57272" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="2" stroke="#cccccc" fill="none"/>
+    </g>
+    <text fill="#000000" stroke-width="0" stroke-linejoin="null" stroke-linecap="null" x="355.22723" y="697.45453" id="svg_97" font-size="8" font-family="Monospace" text-anchor="middle" xml:space="preserve" stroke="#ff0000">(extension circuit)</text>
+    <text id="svg_98" fill="#000000" stroke-width="0" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="360.0234" y="578.0632" font-size="8" font-family="Monospace" text-anchor="middle" xml:space="preserve" stroke="#ff0000">(retraction circuit)</text>
+    <text id="sfsfa" fill="#000000" stroke-width="0" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="357.02269" y="502.06248" font-size="8" font-family="Monospace" text-anchor="middle" xml:space="preserve" stroke="#ff0000">(extension circuit)</text>
+    <g id="ev_close_doors">
+     <path id="ev_close_doors_1" fill="#cccccc" stroke-linejoin="null" stroke-linecap="null" d="m241.979,367.69601l32.58398,22.13898l-32.58398,22.14001l0,-44.27899l0,0z" stroke="#000000" class="valve"/>
+     <path id="ev_close_doors_2" fill="#cccccc" stroke-linejoin="null" stroke-linecap="null" d="m308.20285,411.97467l-32.58395,-22.13922l32.58395,-22.14011l0,44.27933l0,0l0,0z" stroke="#000000" class="valve"/>
+    </g>
+    <g id="ev_open_doors">
+     <path id="ev_open_doors_1" class="valve" fill="#cccccc" stroke-linejoin="null" stroke-linecap="null" d="m241.97894,465.29977l32.58398,22.13925l-32.58398,22.13922l0,-44.27847l0,0z" stroke="#000000" />
+     <path id="ev_open_doors_2" class="valve" fill="#cccccc" stroke-linejoin="null" stroke-linecap="null" d="m308.20285,509.57825l-32.58395,-22.13922l32.58395,-22.14011l0,44.27933l0,0l0,0z" stroke="#000000" />
+    </g>
+    <g id="ev_retraction_gears">
+     <path id="ev_retraction_gears_1" class="valve" fill="#cccccc" stroke-linejoin="null" stroke-linecap="null" d="m241.97894,562.2998l32.58398,22.13922l-32.58398,22.13922l0,-44.27844l0,0z" stroke="#000000"/>
+     <path id="ev_retraction_gears_2" class="valve" fill="#cccccc" stroke-linejoin="null" stroke-linecap="null" d="m308.20285,606.57825l-32.58395,-22.13922l32.58395,-22.14008l0,44.2793l0,0l0,0z" stroke="#000000"/>
+    </g>
+    <g id="ev_extended_gears">
+     <path id="ev_extended_gears_1" class="valve" fill="#cccccc" stroke-linejoin="null" stroke-linecap="null" d="m241.97894,661.2998l32.58398,22.13922l-32.58398,22.13922l0,-44.27844l0,0z" stroke="#000000"/>
+     <path id="ev_extended_gears_2" class="valve" fill="#cccccc" stroke-linejoin="null" stroke-linecap="null" d="m308.20285,705.57825l-32.58395,-22.13922l32.58395,-22.14008l0,44.2793l0,0l0,0z" stroke="#000000"/>
+    </g>
+   </g>
+   <g id="gear_door">
+    <g id="gear_door_refined">
+     <g id="fr_door_cylinder">
+      <rect id="fr_door_cylinder1" stroke-linejoin="null" stroke-linecap="null" x="374.59333" y="413.87721" width="107.58621" height="39.44828" stroke-dasharray="null" stroke-width="null" stroke="#000000" fill="#cccccc"/>
+
+      <rect id="fr_door_cylinder_l" stroke-linejoin="null" stroke-linecap="null" x="375.59331" y="414.87721" width="52.58621" height="37.44828" stroke-dasharray="null" stroke-width="null" stroke="null" fill="#cccccc"/>
+      <rect id="fr_door_cylinder_r" stroke-linejoin="null" stroke-linecap="null" x="425.29331" y="414.87721" width="52" height="37.44828" stroke-dasharray="null" stroke-width="null" stroke="null" fill="#cccccc"/>
+
+      <g id="fr_door_cylinder_forcer">
+       <rect id="fr_door_cylinder_forcer1" stroke-width="null" stroke-linejoin="null" stroke-linecap="null" x="375.50243" y="414.85679" width="15.24138" height="39" stroke="#1c93a5" fill="#666666"/>
+       <rect id="fr_door_cylinder_forcer2" stroke-width="null" stroke-linejoin="null" stroke-linecap="null" x="390.50243" y="429.77058" width="90" height="8.96552" stroke="#1c93a5" fill="#666666"/>
+      </g>
+     </g>
+     <g id="rt_door_cylinder">
+      <rect stroke="#000000" height="39.44828" width="107.58621" y="413.87721" x="573.59331" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="null" fill="#cccccc" id="rt_door_cylinder1"/>
+
+      <rect id="rt_door_cylinder_l" stroke-linejoin="null" stroke-linecap="null" x="574.59331" y="414.87721" width="52.58621" height="37.44828" stroke-dasharray="null" stroke-width="null" stroke="null" fill="#cccccc"/>
+      <rect id="rt_door_cylinder_r" stroke-linejoin="null" stroke-linecap="null" x="622.29331" y="414.87721" width="52" height="37.44828" stroke-dasharray="null" stroke-width="null" stroke="null" fill="#cccccc"/>
+
+      <g id="rt_door_cylinder_forcer">
+       <rect height="39" width="15.24138" y="413.85679" x="574.50243" stroke-linecap="null" stroke-linejoin="null" stroke-width="null" id="rt_door_cylinder_forcer1" stroke="#1c93a5" fill="#666666"/>
+       <rect height="8.96552" width="90" y="429.77058" x="589.50243" stroke-linecap="null" stroke-linejoin="null" stroke-width="null" id="rt_door_cylinder_forcer2" stroke="#1c93a5" fill="#666666"/>
+      </g>
+     </g>
+     <g id="lt_door_cylinder">
+      <rect stroke="#000000" height="39.44828" width="107.58621" y="413.87721" x="778.59331" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="null" fill="#cccccc" id="lt_door_cylinder1"/>
+      <rect id="lt_door_cylinder_l" stroke-linejoin="null" stroke-linecap="null" x="779.59331" y="414.87721" width="52.58621" height="37.44828" stroke-dasharray="null" stroke-width="null" stroke="null" fill="#cccccc"/>
+      <rect id="lt_door_cylinder_r" stroke-linejoin="null" stroke-linecap="null" x="830.29331" y="414.87721" width="52" height="37.44828" stroke-dasharray="null" stroke-width="null" stroke="null" fill="#cccccc"/>
+
+      <g id="lt_door_cylinder_forcer">
+       <rect height="39" width="15.24138" y="413.85679" x="779.50243" stroke-linecap="null" stroke-linejoin="null" stroke-width="null" id="lt_door_cylinder_forcer1" stroke="#1c93a5" fill="#666666"/>
+       <rect height="8.96552" width="90" y="429.77058" x="795.50243" stroke-linecap="null" stroke-linejoin="null" stroke-width="null" id="lt_door_cylinder_forcer2" stroke="#1c93a5" fill="#666666"/>
+      </g>
+     </g>
+     <g id="fr_gear_cylinder">
+      <rect id="fr_gear_cylinder1" fill="#cccccc" stroke-width="null" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="374.59333" y="608.87721" width="107.58621" height="39.44828" stroke="#000000"/>
+
+      <rect id="fr_gear_cylinder_l" stroke-linejoin="null" stroke-linecap="null" x="375.59331" y="609.87721" width="52.58621" height="38.44828" stroke-dasharray="null" stroke-width="null" stroke="null" fill="#cccccc"/>
+      <rect id="fr_gear_cylinder_r" stroke-linejoin="null" stroke-linecap="null" x="426.29331" y="609.87721" width="52" height="38.44828" stroke-dasharray="null" stroke-width="null" stroke="null" fill="#cccccc"/>
+
+      <g id="fr_gear_cylinder_forcer">
+       <rect id="fr_gear_cylinder_forcer1" fill="#666666" stroke-width="null" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="375.50243" y="608.8568" width="15.24138" height="39" stroke="#1c93a5"/>
+       <rect id="fr_gear_cylinder_forcer2" fill="#666666" stroke-width="null" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="390.50243" y="624.77059" width="90" height="8.96552" stroke="#1c93a5"/>
+      </g>
+     </g>
+     <g id="rt_gear_cylinder">
+      <rect stroke="#000000" height="39.44828" width="107.58621" y="608.87721" x="573.59331" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="null" fill="#cccccc" id="rt_gear_cylinder1"/>
+
+      <rect id="rt_gear_cylinder_l" stroke-linejoin="null" stroke-linecap="null" x="574.59331" y="609.87721" width="52.58621" height="37.44828" stroke-dasharray="null" stroke-width="null" stroke="null" fill="#cccccc"/>
+      <rect id="rt_gear_cylinder_r" stroke-linejoin="null" stroke-linecap="null" x="622.29331" y="609.87721" width="52" height="37.44828" stroke-dasharray="null" stroke-width="null" stroke="null" fill="#cccccc"/>
+
+      <g id="rt_gear_cylinder_forcer">
+       <rect stroke="#1c93a5" height="39" width="15.24138" y="608.8568" x="574.50243" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="null" fill="#666666" id="rt_gear_cylinder_forcer1"/>
+       <rect stroke="#1c93a5" height="8.96552" width="90" y="624.77059" x="589.50243" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="null" fill="#666666" id="rt_gear_cylinder_forcer2"/>
+      </g>
+     </g>
+     <g id="lt_gear_cylinder">
+      <rect stroke="#000000" height="39.44828" width="107.58621" y="608.87721" x="778.59331" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="null" fill="#cccccc" id="lt_gear_cylinder1"/>
+
+      <rect id="lt_gear_cylinder_l" stroke-linejoin="null" stroke-linecap="null" x="779.59331" y="609.87721" width="52.58621" height="37.44828" stroke-dasharray="null" stroke-width="null" stroke="null" fill="#cccccc"/>
+      <rect id="lt_gear_cylinder_r" stroke-linejoin="null" stroke-linecap="null" x="831.19331" y="609.87721" width="52" height="37.44828" stroke-dasharray="null" stroke-width="null" stroke="null" fill="#cccccc"/>
+
+      <g id="lt_gear_cylinder_forcer">
+       <rect stroke="#1c93a5" height="39" width="15.24138" y="608.8568" x="779.50243" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="null" fill="#666666" id="lt_gear_cylinder_forcer1"/>
+       <rect stroke="#1c93a5" height="8.96552" width="90" y="624.77059" x="795.50243" stroke-linecap="null" stroke-linejoin="null" stroke-dasharray="null" stroke-width="null" fill="#666666" id="lt_gear_cylinder_forcer2"/>
+      </g>
+     </g>
+     <text fill="#000000" stroke-width="0" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="419.08976" y="405.9789" font-size="8" font-family="Monospace" text-anchor="middle" xml:space="preserve" stroke="#ff0000" id="svg_105">Front door cylinder</text>
+     <text fill="#000000" stroke-width="0" stroke-linejoin="null" stroke-linecap="null" x="618.09473" y="405.22606" font-size="8" font-family="Monospace" text-anchor="middle" xml:space="preserve" stroke="#ff0000" id="svg_106">Right door cylinder</text>
+     <text fill="#000000" stroke-width="0" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="824.09189" y="405.23103" font-size="8" font-family="Monospace" text-anchor="middle" xml:space="preserve" stroke="#ff0000" id="svg_107">Left door cylinder</text>
+     <text fill="#000000" stroke-width="0" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="422.84473" y="599.22606" font-size="8" font-family="Monospace" text-anchor="middle" xml:space="preserve" stroke="#ff0000" id="svg_108">Front gear cylinder</text>
+     <text fill="#000000" stroke-width="0" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="622.59189" y="599.23103" font-size="8" font-family="Monospace" text-anchor="middle" xml:space="preserve" stroke="#ff0000" id="svg_109">Right gear cylinder</text>
+     <text fill="#000000" stroke-width="0" stroke-dasharray="null" stroke-linejoin="null" stroke-linecap="null" x="826.58905" y="600.22819" font-size="8" font-family="Monospace" text-anchor="middle" xml:space="preserve" stroke="#ff0000" id="svg_110">Left gear cylinder</text>
+    </g>
+   </g>
+  </g>
+ </g>
+</svg>
diff --git a/B2Program/LandingGear/HydraulicCircuit/btypes/BBoolean.js b/B2Program/LandingGear/HydraulicCircuit/btypes/BBoolean.js
new file mode 100755
index 0000000000000000000000000000000000000000..130448faa26383f85f2db7a048581e0778fdb1d5
--- /dev/null
+++ b/B2Program/LandingGear/HydraulicCircuit/btypes/BBoolean.js
@@ -0,0 +1,49 @@
+export class BBoolean {
+    constructor(value) {
+        if (typeof (value) === 'boolean') {
+            this.value = value;
+        }
+        else if (typeof value === 'string') {
+            this.value = value.toLowerCase() === 'true';
+        }
+        else {
+            this.value = value.value;
+        }
+    }
+    and(other) {
+        return new BBoolean(this.value && other.value);
+    }
+    or(other) {
+        return new BBoolean(this.value || other.value);
+    }
+    not() {
+        return new BBoolean(!this.value);
+    }
+    implies(other) {
+        return this.not().or(other);
+    }
+    equivalent(other) {
+        return this.implies(other).and(other.implies(this));
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    equals(other) {
+        if (!(other instanceof BBoolean)) {
+            return false;
+        }
+        return this.equal(other).booleanValue();
+    }
+    unequal(other) {
+        return new BBoolean(this.value != other.value);
+    }
+    booleanValue() {
+        return this.value;
+    }
+    toString() {
+        return this.value.toString();
+    }
+    hashCode() {
+        return this.value ? 1 : 0;
+    }
+}
diff --git a/B2Program/LandingGear/HydraulicCircuit/btypes/BInteger.js b/B2Program/LandingGear/HydraulicCircuit/btypes/BInteger.js
new file mode 100755
index 0000000000000000000000000000000000000000..11c2723b5e4781ff02f7a59b101aebb174d65cbf
--- /dev/null
+++ b/B2Program/LandingGear/HydraulicCircuit/btypes/BInteger.js
@@ -0,0 +1,108 @@
+import { BBoolean } from './BBoolean.js';
+export class BInteger {
+    constructor(value) {
+        this.value = value;
+    }
+    equals(obj) {
+        if (obj instanceof BInteger) {
+            return this.compareTo(obj) === 0;
+        }
+        return false;
+    }
+    static build(value) {
+        return new BInteger(value);
+    }
+    compareTo(o) {
+        return this.value - o.value;
+    }
+    lessEqual(o) {
+        return new BBoolean(this.compareTo(o) <= 0);
+    }
+    greaterEqual(o) {
+        return new BBoolean(this.compareTo(o) >= 0);
+    }
+    less(o) {
+        return new BBoolean(this.compareTo(o) < 0);
+    }
+    greater(o) {
+        return new BBoolean(this.compareTo(o) > 0);
+    }
+    equal(o) {
+        return new BBoolean(this.compareTo(o) === 0);
+    }
+    unequal(o) {
+        return new BBoolean(this.compareTo(o) != 0);
+    }
+    intValue() {
+        return this.value;
+    }
+    plus(o) {
+        return new BInteger(this.value + o.value);
+    }
+    toString() {
+        return this.value.toString();
+    }
+    minus(o) {
+        return new BInteger(this.value - o.value);
+    }
+    multiply(o) {
+        return new BInteger(this.value * o.value);
+    }
+    power(o) {
+        return new BInteger(this.value ^ o.value);
+    }
+    divide(o) {
+        return new BInteger(~~(this.value / o.value));
+    }
+    modulo(o) {
+        return new BInteger(this.value % o.value);
+    }
+    succ() {
+        return new BInteger(this.value + 1);
+    }
+    pred() {
+        return new BInteger(this.value - 1);
+    }
+    leftShift() {
+        return new BInteger(this.value << 1);
+    }
+    rightShift() {
+        return new BInteger(this.value >> 1);
+    }
+    isCase(o) {
+        return this.equals(o);
+    }
+    negative() {
+        return new BInteger(-this.value);
+    }
+    positive() {
+        return this;
+    }
+    getValue() {
+        return this.value;
+    }
+    isInteger() {
+        return new BBoolean(true);
+    }
+    isNotInteger() {
+        return new BBoolean(false);
+    }
+    isNatural() {
+        return this.greaterEqual(new BInteger(0));
+    }
+    isNotNatural() {
+        return this.isNatural().not();
+    }
+    isNatural1() {
+        return this.greater(new BInteger(0));
+    }
+    isNotNatural1() {
+        return this.isNatural1().not();
+    }
+    hashCode() {
+        const prime = 31;
+        let result = 1;
+        result = prime * result + this.value;
+        return result;
+    }
+}
diff --git a/B2Program/LandingGear/HydraulicCircuit/btypes/BObject.js b/B2Program/LandingGear/HydraulicCircuit/btypes/BObject.js
new file mode 100755
index 0000000000000000000000000000000000000000..51b475ea3aeca5d23cebf2760f968f115e965477
--- /dev/null
+++ b/B2Program/LandingGear/HydraulicCircuit/btypes/BObject.js
@@ -0,0 +1,8 @@
+export class BObject {
+    equals(other) {
+        return false;
+    }
+    hashCode() {
+        return 0;
+    }
+}
diff --git a/B2Program/LandingGear/HydraulicCircuit/btypes/BRelation.js b/B2Program/LandingGear/HydraulicCircuit/btypes/BRelation.js
new file mode 100755
index 0000000000000000000000000000000000000000..361218789a087230718b877c9cb7ef474771c1bb
--- /dev/null
+++ b/B2Program/LandingGear/HydraulicCircuit/btypes/BRelation.js
@@ -0,0 +1,791 @@
+import { BTuple } from "./BTuple.js";
+import { BSet } from "./BSet.js";
+import { BInteger } from "./BInteger.js";
+import { BBoolean } from "./BBoolean.js";
+import { BString } from "./BString.js";
+import { BStruct } from "./BStruct.js";
+import * as immutable from "../immutable/dist/immutable.es.js";
+export class BRelation {
+    constructor(...args) {
+        if (args.length === 0) {
+            this.map = immutable.Map();
+        }
+        else if (args.length == 1 && args[0] instanceof immutable.Map) {
+            this.map = args[0];
+        }
+        else {
+            this.map = immutable.Map();
+            for (let e of args) {
+                let key = e.projection1();
+                let value = e.projection2();
+                let set = this.map.get(key);
+                if (set == null) {
+                    set = immutable.Set();
+                }
+                set = set.add(value);
+                this.map = this.map.set(key, set);
+            }
+        }
+    }
+    static fromSet(set) {
+        let resultMap = immutable.Map();
+        set.getSet().forEach((e) => {
+            let key = e.projection1();
+            let value = e.projection2();
+            let range = resultMap.get(key);
+            if (range == null) {
+                range = immutable.Set([value]);
+                resultMap = resultMap.set(key, range);
+            }
+            else {
+                range = range.add(value);
+                resultMap = resultMap.set(key, range);
+            }
+        });
+        return new BRelation(resultMap);
+    }
+    equals(o) {
+        if (o == null || !(o instanceof BRelation))
+            return false;
+        return this.map.equals(o.map);
+    }
+    intersect(relation) {
+        let otherMap = relation.map;
+        let otherDomain = immutable.Set(otherMap.keys());
+        let thisDomain = immutable.Set(this.map.keys());
+        let intersectionDomain = thisDomain.intersect(otherDomain);
+        let differenceDomain = thisDomain.subtract(otherDomain);
+        let resultMap = this.map;
+        intersectionDomain.forEach((domainElement) => {
+            let thisRangeSet = this.map.get(domainElement);
+            let otherRangeSet = otherMap.get(domainElement);
+            resultMap = resultMap.set(domainElement, thisRangeSet.intersect(otherRangeSet));
+        });
+        differenceDomain.forEach((domainElement) => {
+            resultMap = resultMap.set(domainElement, immutable.Set());
+        });
+        return new BRelation(resultMap);
+    }
+    difference(relation) {
+        let otherMap = relation.map;
+        let otherDomain = otherMap.keys();
+        let thisDomain = immutable.Set(this.map.keys());
+        let differenceDomain = thisDomain.subtract(otherDomain);
+        let restDomain = thisDomain.subtract(differenceDomain);
+        let resultMap = this.map;
+        differenceDomain.forEach((domainElement) => {
+            let thisRangeSet = this.map.get(domainElement);
+            let otherRangeSet = otherMap.get(domainElement);
+            resultMap = resultMap.set(domainElement, thisRangeSet.subtract(otherRangeSet));
+        });
+        restDomain.forEach((domainElement) => {
+            resultMap = resultMap.set(domainElement, immutable.Set());
+        });
+        return new BRelation(resultMap);
+    }
+    union(relation) {
+        let otherMap = relation.map;
+        let otherDomain = immutable.Set(otherMap.keys());
+        let resultMap = this.map;
+        for (let domainElement of otherDomain) {
+            let thisRangeSet = this.map.get(domainElement);
+            let otherRangeSet = otherMap.get(domainElement);
+            resultMap = resultMap.set(domainElement, thisRangeSet == null ? otherRangeSet : otherRangeSet == null ? otherRangeSet : thisRangeSet.union(otherRangeSet));
+        }
+        return new BRelation(resultMap);
+    }
+    size() {
+        let size = 0;
+        let thisDomain = immutable.Set(this.map.keys());
+        for (let domainElement of thisDomain) {
+            let thisRangeSet = this.map.get(domainElement);
+            if (thisRangeSet == null) {
+                continue;
+            }
+            size += thisRangeSet.size;
+        }
+        return size;
+    }
+    card() {
+        return new BInteger(this.size());
+    }
+    equal(o) {
+        return new BBoolean(this.equals(o));
+    }
+    unequal(o) {
+        return new BBoolean(!this.equals(o));
+    }
+    elementOf(object) {
+        let prj1 = object.projection1();
+        let prj2 = object.projection2();
+        if (!this.map.has(prj1)) {
+            return new BBoolean(false);
+        }
+        let range = this.map.get(prj1);
+        return new BBoolean(range.has(prj2));
+    }
+    notElementOf(object) {
+        let prj1 = object.projection1();
+        let prj2 = object.projection2();
+        if (!this.map.has(prj1)) {
+            return new BBoolean(true);
+        }
+        let range = this.map.get(prj1);
+        return new BBoolean(!range.has(prj2));
+    }
+    relationImage(domain) {
+        let resultSet = immutable.Set();
+        for (let this_domain_elem of this.map.keys()) {
+            for (let other_domain_elem of domain.set) {
+                if (other_domain_elem.equals(this_domain_elem)) {
+                    let thisRangeSet = this.map.get(this_domain_elem);
+                    if (thisRangeSet != null) {
+                        resultSet = BSet.immutableSetUnion(resultSet, thisRangeSet);
+                    }
+                }
+            }
+        }
+        return new BSet(resultSet);
+    }
+    functionCall(arg) {
+        let range = this.map.get(arg);
+        if (range == null) {
+            throw new Error("Argument is not in the domain of this relation");
+        }
+        for (let element of range) {
+            return element;
+        }
+        throw new Error("Argument is not in the domain of this relation");
+    }
+    pow() {
+        let thisMap = this.map;
+        let thisDomain = immutable.Set(thisMap.keys());
+        let result = new BSet();
+        let start = new BRelation();
+        let queue = [];
+        queue.push(start);
+        result = result.union(new BSet(start));
+        while (queue.length !== 0) {
+            let currentSet = queue.pop();
+            for (let domainElement of thisDomain) {
+                let range = thisMap.get(domainElement);
+                range.forEach((rangeElement) => {
+                    let nextRelation = currentSet.union(BRelation.fromSet(new BSet(new BTuple(domainElement, rangeElement))));
+                    let previousSize = result.size().intValue();
+                    result = result.union(new BSet(nextRelation));
+                    if (previousSize < result.size().intValue()) {
+                        queue.push(nextRelation);
+                    }
+                });
+            }
+        }
+        return result;
+    }
+    pow1() {
+        return this.pow().difference(new BSet(new BRelation()));
+    }
+    fin() {
+        return this.pow();
+    }
+    fin1() {
+        return this.pow1();
+    }
+    domain() {
+        let resultSet = immutable.Set(this.map.keys());
+        for (let domainElement of this.map.keys()) {
+            let range = this.map.get(domainElement);
+            if (range.size === 0) {
+                resultSet = resultSet.remove(domainElement);
+            }
+        }
+        return new BSet(resultSet);
+    }
+    range() {
+        let set = immutable.Set.union(this.map.values());
+        return new BSet(set);
+    }
+    inverse() {
+        let thisMap = this.map;
+        let keys = immutable.Set(thisMap.keys());
+        let resultMap = immutable.Map();
+        for (let domainElement of keys) {
+            let range = this.map.get(domainElement);
+            range.forEach((rangeElement) => {
+                let currentRange = resultMap.get(rangeElement);
+                if (currentRange == null) {
+                    currentRange = immutable.Set();
+                }
+                currentRange = currentRange.union(immutable.Set([domainElement]));
+                resultMap = resultMap.set(rangeElement, currentRange);
+            });
+        }
+        return new BRelation(resultMap);
+    }
+    domainRestriction(arg) {
+        let resultMap = this.map;
+        outer_loop: for (let obj of resultMap.keys()) {
+            for (let obj2 of arg.set) {
+                if (obj2.equals(obj)) {
+                    continue outer_loop;
+                }
+            }
+            resultMap = resultMap.delete(obj);
+        }
+        return new BRelation(resultMap);
+    }
+    domainSubstraction(arg) {
+        let resultMap = this.map;
+        for (let obj of resultMap.keys()) {
+            for (let obj2 of arg.set) {
+                if (obj2.equals(obj)) {
+                    resultMap = resultMap.delete(obj);
+                    break;
+                }
+            }
+        }
+        return new BRelation(resultMap);
+    }
+    rangeRestriction(arg) {
+        let otherSet = arg.getSet();
+        let thisDomain = immutable.Set(this.map.keys());
+        let resultMap = this.map;
+        for (let domainElement of thisDomain) {
+            let thisRangeSet = this.map.get(domainElement);
+            resultMap = resultMap.set(domainElement, BSet.immutableSetIntersection(thisRangeSet, otherSet));
+        }
+        return new BRelation(resultMap);
+    }
+    rangeSubstraction(arg) {
+        let otherSet = arg.getSet();
+        let thisDomain = immutable.Set(this.map.keys());
+        let resultMap = this.map;
+        for (let domainElement of thisDomain) {
+            let thisRangeSet = this.map.get(domainElement);
+            resultMap = resultMap.set(domainElement, BSet.immutableSetDifference(thisRangeSet, otherSet));
+        }
+        return new BRelation(resultMap);
+    }
+    override(arg) {
+        let otherMap = arg.map;
+        let otherDomain = immutable.Set(otherMap.keys());
+        let resultMap = this.map;
+        outer_loop: for (let domainElement of otherDomain) {
+            for (let thisDomainElement of resultMap.keys()) {
+                if (thisDomainElement.equals(domainElement)) {
+                    let range = otherMap.get(domainElement);
+                    resultMap = resultMap.set(thisDomainElement, range);
+                    continue outer_loop;
+                }
+            }
+            resultMap = resultMap.set(domainElement, otherMap.get(domainElement));
+        }
+        return new BRelation(resultMap);
+    }
+    first() {
+        return this.functionCall(new BInteger(1));
+    }
+    last() {
+        return this.functionCall(this.card());
+    }
+    reverse() {
+        let size = this.card();
+        let resultMap = immutable.Map();
+        for (let i = new BInteger(1); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            let rangeElement = this.functionCall(size.minus(i).succ());
+            resultMap = resultMap.set(i, immutable.Set([rangeElement]));
+        }
+        return new BRelation(resultMap);
+    }
+    front() {
+        return this.domainSubstraction(new BSet(this.card()));
+    }
+    tail() {
+        let size = this.card();
+        let resultMap = immutable.Map();
+        for (let i = new BInteger(2); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            let rangeElement = this.functionCall(i);
+            resultMap = resultMap.set(i.pred(), immutable.Set([rangeElement]));
+        }
+        return new BRelation(resultMap);
+    }
+    take(n) {
+        let size = this.card();
+        if (n.greaterEqual(size).booleanValue()) {
+            return new BRelation(this.map);
+        }
+        let resultMap = this.map;
+        //Remove sets with index greater than n
+        for (let i = n.succ(); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            for (let index of resultMap.keys()) {
+                if (index.equals(i)) {
+                    resultMap = resultMap.delete(index);
+                    break;
+                }
+            }
+        }
+        return new BRelation(resultMap);
+    }
+    drop(n) {
+        let size = this.card();
+        let thisMap = this.map;
+        let resultMap = immutable.Map();
+        for (let i = n.succ(); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            let currentSet = thisMap.get(i);
+            resultMap = resultMap.set(i.minus(n), currentSet);
+        }
+        return new BRelation(resultMap);
+    }
+    concat(arg) {
+        let resultMap = this.map;
+        let otherMap = arg.map;
+        let size = this.card();
+        for (let i = new BInteger(1); i.lessEqual(arg.card()).booleanValue(); i = i.succ()) {
+            resultMap = resultMap.set(size.plus(i), otherMap.get(i));
+        }
+        return new BRelation(resultMap);
+    }
+    conc() {
+        let result = new BRelation();
+        let size = this.card();
+        for (let i = new BInteger(1); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            result = result.concat(this.functionCall(i));
+        }
+        return result;
+    }
+    append(arg) {
+        let resultMap = this.map;
+        resultMap = resultMap.set(this.card().succ(), immutable.Set([arg]));
+        return new BRelation(resultMap);
+    }
+    prepend(arg) {
+        let resultMap = immutable.Map();
+        let thisMap = this.map;
+        let size = this.card();
+        for (let i = new BInteger(1); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            resultMap = resultMap.set(i.succ(), thisMap.get(i));
+        }
+        resultMap = resultMap.set(new BInteger(1), immutable.Set([arg]));
+        return new BRelation(resultMap);
+    }
+    directProduct(arg) {
+        let thisMap = this.map;
+        let thisDomain = immutable.Set(thisMap.keys());
+        let otherMap = arg.map;
+        let resultMap = immutable.Map();
+        for (let domainElement of thisDomain) {
+            let thisRange = this.map.get(domainElement);
+            let otherRange = otherMap.get(domainElement);
+            if (otherRange == undefined) {
+                continue;
+            }
+            let resultRange = immutable.Set();
+            thisRange.forEach((lhs) => {
+                otherRange.forEach((rhs) => {
+                    resultRange = immutable.Set.union([resultRange, immutable.Set([new BTuple(lhs, rhs)])]);
+                });
+            });
+            resultMap = resultMap.set(domainElement, resultRange);
+        }
+        return new BRelation(resultMap);
+    }
+    parallelProduct(arg) {
+        let thisMap = this.map;
+        let thisDomain = immutable.Set(thisMap.keys());
+        let otherMap = arg.map;
+        let otherDomain = immutable.Set(otherMap.keys());
+        let resultMap = immutable.Map();
+        for (let domainElementThis of thisDomain) {
+            for (let domainElementOther of otherDomain) {
+                let thisRange = thisMap.get(domainElementThis);
+                let otherRange = otherMap.get(domainElementOther);
+                let resultRange = immutable.Set();
+                thisRange.forEach((lhs) => {
+                    otherRange.forEach((rhs) => {
+                        resultRange = resultRange.union(immutable.Set([new BTuple(lhs, rhs)]));
+                    });
+                });
+                let tuple = new BTuple(domainElementThis, domainElementOther);
+                resultMap = resultMap.set(tuple, resultRange);
+            }
+        }
+        return new BRelation(resultMap);
+    }
+    composition(arg) {
+        let otherMap = arg.map;
+        let resultMap = immutable.Map();
+        for (let domainElement of this.map.keys()) {
+            let range = this.map.get(domainElement);
+            let set = immutable.Set();
+            range.forEach((rangeElement) => {
+                let union_element = otherMap.get(rangeElement);
+                if (union_element == null) {
+                    return;
+                }
+                set = set.union(union_element);
+            });
+            resultMap = resultMap.set(domainElement, set);
+        }
+        return new BRelation(resultMap);
+    }
+    iterate(n) {
+        let thisRelation = this;
+        let result = BRelation.identity(this.domain().union(this.range()));
+        for (let i = new BInteger(1); i.lessEqual(n).booleanValue(); i = i.succ()) {
+            result = result.composition(thisRelation);
+        }
+        return result;
+    }
+    closure() {
+        let thisRelation = this;
+        let result = BRelation.identity(this.domain().union(this.range()));
+        let nextResult = result.composition(thisRelation);
+        let lastResult = result;
+        do {
+            lastResult = result;
+            result = result.union(nextResult);
+            nextResult = result.composition(thisRelation);
+        } while (!result.equal(lastResult).booleanValue());
+        return result;
+    }
+    closure1() {
+        let thisRelation = this;
+        let result = this;
+        let nextResult = result.composition(thisRelation);
+        let lastResult = null;
+        do {
+            lastResult = result;
+            result = result.union(nextResult);
+            nextResult = result.composition(thisRelation);
+        } while (!result.equal(lastResult).booleanValue());
+        return result;
+    }
+    static projection1(arg1, arg2) {
+        let argSet1 = arg1.getSet();
+        let argSet2 = arg2.getSet();
+        let resultMap = immutable.Map();
+        argSet1.forEach((e1) => {
+            argSet2.forEach((e2) => {
+                let tuple = new BTuple(e1, e2);
+                resultMap = resultMap.set(tuple, immutable.Set([e1]));
+            });
+        });
+        return new BRelation(resultMap);
+    }
+    static projection2(arg1, arg2) {
+        let argSet1 = arg1.getSet();
+        let argSet2 = arg2.getSet();
+        let resultMap = immutable.Map();
+        argSet1.forEach((e1) => {
+            argSet2.forEach((e2) => {
+                let tuple = new BTuple(e1, e2);
+                resultMap = resultMap.set(tuple, immutable.Set([e2]));
+            });
+        });
+        return new BRelation(resultMap);
+    }
+    fnc() {
+        let thisMap = this.map;
+        let domain = this.domain().getSet();
+        let resultMap = immutable.Map();
+        domain.forEach((domainElement) => {
+            let range = thisMap.get(domainElement);
+            let rangeSet = new BSet([range]);
+            resultMap = resultMap.set(domainElement, immutable.Set([rangeSet]));
+        });
+        return new BRelation(resultMap);
+    }
+    rel() {
+        let domain = this.domain().getSet();
+        let resultMap = immutable.Map();
+        domain.forEach((domainElement) => {
+            let range = this.functionCall(domainElement);
+            let rangeSet = range.getSet();
+            resultMap = resultMap.set(domainElement, rangeSet);
+        });
+        return new BRelation(resultMap);
+    }
+    static identity(arg) {
+        let resultMap = immutable.Map();
+        arg.getSet().forEach((e) => {
+            resultMap = resultMap.set(e, immutable.Set([e]));
+        });
+        return new BRelation(resultMap);
+    }
+    static cartesianProduct(arg1, arg2) {
+        let resultMap = immutable.Map();
+        arg1.getSet().forEach((e1) => {
+            resultMap = resultMap.set(e1, arg2.getSet());
+        });
+        return new BRelation(resultMap);
+    }
+    nondeterminism() {
+        let domain = immutable.Set(this.map.keys());
+        let index = Math.floor(Math.random() * domain.size);
+        let i = 0;
+        let domainElement = undefined;
+        for (let obj of domain) {
+            if (i == index) {
+                domainElement = obj;
+                break;
+            }
+            i++;
+        }
+        if (domainElement == undefined) {
+            return null;
+        }
+        let range = this.map.get(domainElement);
+        if (range != null) {
+            index = Math.floor(Math.random() * range.size);
+            i = 0;
+            for (let obj of range) {
+                if (i == index) {
+                    return new BTuple(domainElement, obj);
+                }
+                i++;
+            }
+        }
+        return null;
+    }
+    isTotal(domain) {
+        return new BBoolean(this.domain().equal(domain));
+    }
+    isTotalInteger() {
+        return new BBoolean(false);
+    }
+    isTotalNatural() {
+        return new BBoolean(false);
+    }
+    isTotalNatural1() {
+        return new BBoolean(false);
+    }
+    isTotalString() {
+        return new BBoolean(false);
+    }
+    isTotalStruct() {
+        return new BBoolean(false);
+    }
+    isPartial(domain) {
+        return this.domain().strictSubset(domain);
+    }
+    isPartialInteger() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger) {
+                return new BBoolean(true);
+            }
+            else {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isPartialNatural() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isPartialNatural1() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural1().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isPartialString() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BString && !e.isString().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isPartialStruct() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BStruct && !e.isRecord().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomain(domain) {
+        return this.domain().subset(domain);
+    }
+    checkDomainInteger() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger) {
+                return new BBoolean(true);
+            }
+            else {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomainNatural() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomainNatural1() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural1().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomainString() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BString && !e.isString().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomainStruct() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BStruct && !e.isRecord().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRange(range) {
+        return this.range().subset(range);
+    }
+    checkRangeInteger() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BInteger) {
+                return new BBoolean(true);
+            }
+            else {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRangeNatural() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRangeNatural1() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural1().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRangeString() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BString && !e.isString().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRangeStruct() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BStruct && !e.isRecord().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isRelation() {
+        return new BBoolean(true);
+    }
+    isFunction() {
+        this.domain().getSet().forEach((element) => {
+            let range = this.map.get(element);
+            if (range.size > 1) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isSurjection(range) {
+        return new BBoolean(this.range().equal(range));
+    }
+    isSurjectionInteger() {
+        return new BBoolean(false);
+    }
+    isSurjectionNatural() {
+        return new BBoolean(false);
+    }
+    isSurjectionNatural1() {
+        return new BBoolean(false);
+    }
+    isSurjectionString() {
+        return new BBoolean(false);
+    }
+    isSurjectionStruct() {
+        return new BBoolean(false);
+    }
+    isInjection() {
+        let visited = immutable.Set();
+        this.domain().getSet().forEach((element) => {
+            let range = this.map.get(element);
+            range.forEach((rangeElement) => {
+                if (visited.contains(rangeElement)) {
+                    return new BBoolean(false);
+                }
+                visited = visited.union(immutable.Set([rangeElement]));
+            });
+        });
+        return new BBoolean(true);
+    }
+    isBijection(range) {
+        return this.isSurjection(range).and(this.isInjection());
+    }
+    isBijectionInteger() {
+        return new BBoolean(false);
+    }
+    isBijectionNatural() {
+        return new BBoolean(false);
+    }
+    isBijectionNatural1() {
+        return new BBoolean(false);
+    }
+    isBijectionString() {
+        return new BBoolean(false);
+    }
+    isBijectionStruct() {
+        return new BBoolean(false);
+    }
+    toString() {
+        let size = this.size();
+        let i = 0;
+        let sb = "";
+        sb = sb + "{";
+        for (let domainElement of this.map.keys()) {
+            let range = this.map.get(domainElement);
+            range.forEach((rangeElement) => {
+                sb += "(";
+                sb += domainElement.toString();
+                sb += " |-> ";
+                sb += rangeElement.toString();
+                sb += ")";
+                if (i + 1 < size) {
+                    sb += ", ";
+                }
+                i++;
+            });
+        }
+        sb += "}";
+        return sb.toString();
+    }
+    hashCode() {
+        return this.map.hashCode();
+    }
+}
diff --git a/B2Program/LandingGear/HydraulicCircuit/btypes/BSet.js b/B2Program/LandingGear/HydraulicCircuit/btypes/BSet.js
new file mode 100755
index 0000000000000000000000000000000000000000..3cd16d85d4636b667b9741b6fbb3816b02d71da6
--- /dev/null
+++ b/B2Program/LandingGear/HydraulicCircuit/btypes/BSet.js
@@ -0,0 +1,359 @@
+import { BBoolean } from "./BBoolean.js";
+import { BInteger } from "./BInteger.js";
+import { BRelation } from "./BRelation.js";
+import { BString } from "./BString.js";
+import { BStruct } from "./BStruct.js";
+import * as immutable from "../immutable/dist/immutable.es.js";
+export class BSet {
+    constructor(...args) {
+        if (args.length == 1 && args[0] instanceof immutable.Set) {
+            this.set = args[0];
+        }
+        else {
+            this.set = immutable.Set();
+            for (let x of args) {
+                this.set = this.set.add(x);
+            }
+        }
+    }
+    /* Make this class iterable */
+    [Symbol.iterator]() {
+        return this.set[Symbol.iterator]();
+    }
+    toString() {
+        let sb = "{";
+        this.set.forEach(element => {
+            if (sb.length > 1) {
+                sb += ", ";
+            }
+            sb += element.toString();
+        });
+        sb += "}";
+        return sb;
+    }
+    union(other = null) {
+        if (other == null) {
+            if (this.set.size === 0) {
+                return new BSet();
+            }
+            else if (this.set.values().next().value instanceof BSet) {
+                let result = immutable.Set();
+                for (let current_set of this.set) {
+                    result = BSet.immutableSetUnion(result, current_set.set);
+                }
+                return new BSet(result);
+            }
+            else if (this.set.values().next().value instanceof BRelation) {
+                let result = immutable.Map();
+                for (let current_set of this.set) {
+                    result = BSet.immutableMapUnion(result, current_set.map);
+                }
+                return new BRelation(result);
+            }
+            else {
+                throw new Error("Generalized Union is only possible on immutable.Sets of immutable.Sets or Relations");
+            }
+        }
+        let result = BSet.immutableSetUnion(this.set, other.set);
+        return new BSet(result);
+    }
+    static immutableSetUnion(s1, s2) {
+        return s1.union(s2);
+    }
+    static immutableSetDifference(s1, s2) {
+        return s1.subtract(s2);
+    }
+    static immutableSetIntersection(s1, s2) {
+        return s1.intersect(s2);
+    }
+    static immutableMapUnion(m1, m2) {
+        let result = m2;
+        outer_loop: for (let current_element of m1.keys()) {
+            for (let result_element of result.keys()) {
+                if (current_element.equals(result_element)) {
+                    let result_set = result.get(result_element);
+                    let current_set = m1.get(current_element);
+                    result = result.set(result_element, BSet.immutableSetUnion(result_set != null ? result_set : immutable.Set(), current_set != null ? current_set : immutable.Set()));
+                    continue outer_loop;
+                }
+            }
+            result = result.set(current_element, m1.get(current_element));
+        }
+        return result;
+    }
+    static immutableMapIntersection(m1, m2) {
+        let result = immutable.Map();
+        elem_loop: for (let result_element of m2.keys()) {
+            for (let current_element of m1.keys()) {
+                if (current_element.equals(result_element)) {
+                    let result_set = m2.get(result_element);
+                    let current_set = m1.get(current_element);
+                    result = result.set(result_element, BSet.immutableSetIntersection(result_set != null ? result_set : immutable.Set(), current_set != null ? current_set : immutable.Set()));
+                    continue elem_loop;
+                }
+            }
+            result.delete(result_element);
+        }
+        return result;
+    }
+    intersect(other = null) {
+        if (other == null) {
+            if (this.set.size === 0) {
+                return new BSet();
+            }
+            else if (this.set.values().next().value instanceof BSet) {
+                let result = this.set.values().next().value.set;
+                for (let current_set of this.set) {
+                    result = BSet.immutableSetDifference(result, BSet.immutableSetDifference(result, current_set.set));
+                }
+                return new BSet(result);
+            }
+            else if (this.set.values().next().value instanceof BRelation) {
+                let result = this.set.values().next().value.map;
+                for (let current_set of this.set) {
+                    result = BSet.immutableMapIntersection(result, current_set.map);
+                }
+                return new BRelation(result);
+            }
+            else {
+                throw new Error("Generalized Intersection is only possible on immutable.Sets of immutable.Sets or Relations");
+            }
+        }
+        let new_set = BSet.immutableSetDifference(this.set, BSet.immutableSetDifference(this.set, other.set));
+        return new BSet(new_set);
+    }
+    difference(other) {
+        let set = BSet.immutableSetDifference(this.set, other.set);
+        return new BSet(set);
+    }
+    card() {
+        return new BInteger(this.set.size);
+    }
+    size() {
+        return new BInteger(this.set.size);
+    }
+    elementOf(obj) {
+        return new BBoolean(this.set.has(obj));
+    }
+    notElementOf(obj) {
+        return new BBoolean(!this.set.has(obj));
+    }
+    subset(other) {
+        this_set_loop: for (let elem of this.set) {
+            for (let other_elem of other.set) {
+                if (other_elem.equals(elem)) {
+                    continue this_set_loop;
+                }
+            }
+            return new BBoolean(false);
+        }
+        return new BBoolean(true);
+    }
+    notSubset(other) {
+        this_set_loop: for (let elem of this.set) {
+            for (let other_elem of other.set) {
+                if (other_elem.equals(elem)) {
+                    continue this_set_loop;
+                }
+            }
+            return new BBoolean(true);
+        }
+        return new BBoolean(false);
+    }
+    strictSubset(other) {
+        return this.size().less(other.size()).and(this.subset(other));
+    }
+    strictNotSubset(other) {
+        return this.size().equal(other.size()).and(this.notSubset(other));
+    }
+    contains(other) {
+        return other.toString() in this.set;
+    }
+    containsAll(other) {
+        for (let o of other.set) {
+            if (!(o in this.set)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    isEmpty() {
+        return this.set.size === 0;
+    }
+    equals(other) {
+        return this.equal(other).booleanValue();
+    }
+    equal(other) {
+        if (!(other instanceof BSet)) {
+            return new BBoolean(false);
+        }
+        return this.subset(other).and(other.subset(this));
+    }
+    unequal(other) {
+        return this.equal(other).not();
+    }
+    nondeterminism() {
+        let values = [];
+        for (let item of this.set) {
+            values.push(item);
+        }
+        return values[Math.floor(Math.random() * values.length)];
+    }
+    min() {
+        return this.set.reduce((a, v) => { if (a < v) {
+            return a;
+        } return v; });
+    }
+    max() {
+        return this.set.reduce((a, v) => { if (a > v) {
+            return a;
+        } return v; });
+    }
+    pow() {
+        let result = new BSet();
+        let start = new BSet();
+        let queue = [start];
+        result = result.union(new BSet(start));
+        while (queue.length != 0) {
+            let currentSet = queue.pop();
+            for (let element of this.set) {
+                let nextSet = currentSet.union(new BSet(element));
+                let previousSize = result.size();
+                result = result.union(new BSet(nextSet));
+                if (previousSize < result.size()) {
+                    queue.push(nextSet);
+                }
+            }
+        }
+        return result;
+    }
+    pow1() {
+        return this.pow().difference(new BSet(new BSet()));
+    }
+    // Only finite subsets are supported so fin = pow
+    fin() {
+        return this.pow();
+    }
+    fin1() {
+        return this.pow1();
+    }
+    subsetOfInteger() {
+        for (let element of this.set) {
+            if (element instanceof BInteger) {
+                return false;
+            }
+        }
+        return true;
+    }
+    strictSubsetOfInteger() {
+        return this.subsetOfInteger();
+    }
+    notSubsetOfInteger() {
+        return !this.subsetOfInteger();
+    }
+    notStrictSubsetOfInteger() {
+        return !this.strictSubsetOfInteger();
+    }
+    subsetOfNatural() {
+        for (let element of this.set) {
+            if (!(element instanceof BInteger && element.isNatural().booleanValue())) {
+                return false;
+            }
+        }
+        return true;
+    }
+    strictSubsetOfNatural() {
+        return this.subsetOfNatural();
+    }
+    notSubsetOfNatural() {
+        return !this.subsetOfNatural();
+    }
+    notStrictSubsetOfNatural() {
+        return !this.strictSubsetOfNatural();
+    }
+    subsetOfNatural1() {
+        for (let element of this.set) {
+            if (!(element instanceof BInteger && element.isNatural1().booleanValue())) {
+                return false;
+            }
+        }
+        return true;
+    }
+    subsetOfString() {
+        for (let element of this.set) {
+            if (!(element instanceof BString)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    strictSubsetOfString() {
+        return this.subsetOfString();
+    }
+    notSubsetOfString() {
+        return !this.subsetOfString();
+    }
+    notStrictSubsetOfString() {
+        return !this.strictSubsetOfString();
+    }
+    subsetOfStruct() {
+        for (let element of this.set) {
+            if (!(element instanceof BStruct)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    strictSubsetOfStruct() {
+        return this.subsetOfStruct();
+    }
+    notSubsetOfStruct() {
+        return !this.subsetOfStruct();
+    }
+    notStrictSubsetOfStruct() {
+        return !this.strictSubsetOfStruct();
+    }
+    equalInteger() {
+        return new BBoolean(false);
+    }
+    unequalInteger() {
+        return new BBoolean(true);
+    }
+    equalNatural() {
+        return new BBoolean(false);
+    }
+    unequalNatural() {
+        return new BBoolean(true);
+    }
+    equalNatural1() {
+        return new BBoolean(false);
+    }
+    unequalNatural1() {
+        return new BBoolean(true);
+    }
+    equalString() {
+        return new BBoolean(false);
+    }
+    unequalString() {
+        return new BBoolean(true);
+    }
+    equalStruct() {
+        return new BBoolean(false);
+    }
+    unequalStruct() {
+        return new BBoolean(true);
+    }
+    getSet() {
+        return this.set;
+    }
+    static interval(a, b) {
+        if (b.less(a).booleanValue()) {
+            return new BSet();
+        }
+        const range = [...Array(b.minus(a).intValue() + 1).keys()].map(e => new BInteger(e).plus(a));
+        return new BSet(immutable.Set(range));
+    }
+    hashCode() {
+        return this.set.hashCode();
+    }
+}
diff --git a/B2Program/LandingGear/HydraulicCircuit/btypes/BString.js b/B2Program/LandingGear/HydraulicCircuit/btypes/BString.js
new file mode 100755
index 0000000000000000000000000000000000000000..ff8e795b9a5997e3dad032029e78fb40dba7f7a1
--- /dev/null
+++ b/B2Program/LandingGear/HydraulicCircuit/btypes/BString.js
@@ -0,0 +1,46 @@
+import { BBoolean } from "./BBoolean.js";
+export class BString {
+    constructor(value) {
+        this.value = value;
+    }
+    getValue() {
+        return this.value;
+    }
+    equals(o) {
+        if (o == null || o instanceof BString) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    length() {
+        return this.value.length;
+    }
+    isEmpty() {
+        return this.value === "";
+    }
+    toString() {
+        return '"' + this.value + '"';
+    }
+    isCase(o) {
+        return this.value == o;
+    }
+    isString() {
+        return new BBoolean(true);
+    }
+    isNotString() {
+        return new BBoolean(false);
+    }
+    hashCode() {
+        let hash = 0;
+        if (this.value.length === 0) {
+            return hash;
+        }
+        for (let i = 0; i < this.value.length; i++) {
+            let chr = this.value.charCodeAt(i);
+            hash = ((hash << 5) - hash) + chr;
+            hash |= 0; // Convert to 32bit integer
+        }
+        return hash;
+    }
+    ;
+}
diff --git a/B2Program/LandingGear/HydraulicCircuit/btypes/BStruct.js b/B2Program/LandingGear/HydraulicCircuit/btypes/BStruct.js
new file mode 100755
index 0000000000000000000000000000000000000000..196b0fa0e643f72a865a96d09c27c76f5ed92fdd
--- /dev/null
+++ b/B2Program/LandingGear/HydraulicCircuit/btypes/BStruct.js
@@ -0,0 +1,9 @@
+import { BBoolean } from "./BBoolean.js";
+export class BStruct {
+    isRecord() {
+        return new BBoolean(true);
+    }
+    isNotRecord() {
+        return new BBoolean(false);
+    }
+}
diff --git a/B2Program/LandingGear/HydraulicCircuit/btypes/BTuple.js b/B2Program/LandingGear/HydraulicCircuit/btypes/BTuple.js
new file mode 100755
index 0000000000000000000000000000000000000000..49f6bba5979626f54da241bc2aee21b680b45674
--- /dev/null
+++ b/B2Program/LandingGear/HydraulicCircuit/btypes/BTuple.js
@@ -0,0 +1,34 @@
+import { BBoolean } from "./BBoolean.js";
+export class BTuple {
+    constructor(first, second) {
+        if (first == null || second == null) {
+            throw new RangeError("Arguments of Tuple cant be null or undefined");
+        }
+        this.first = first;
+        this.second = second;
+    }
+    equals(o) {
+        if (o == null || !(o instanceof BTuple)) {
+            return false;
+        }
+        return o.projection1().equals(this.first) && o.projection2().equals(this.second);
+    }
+    toString() {
+        return "(" + this.projection1() + " |-> " + this.projection2() + ')';
+    }
+    projection1() {
+        return this.first;
+    }
+    projection2() {
+        return this.second;
+    }
+    equal(o) {
+        return new BBoolean(this.equals(o));
+    }
+    unequal(o) {
+        return new BBoolean(!this.equals(o));
+    }
+    hashCode() {
+        return this.first.hashCode() ^ (this.second.hashCode() << 1);
+    }
+}
diff --git a/B2Program/LandingGear/HydraulicCircuit/btypes/BUtils.js b/B2Program/LandingGear/HydraulicCircuit/btypes/BUtils.js
new file mode 100755
index 0000000000000000000000000000000000000000..cc0de5b897c6bf57f395a844a2717aaf89ba68b1
--- /dev/null
+++ b/B2Program/LandingGear/HydraulicCircuit/btypes/BUtils.js
@@ -0,0 +1,11 @@
+import { BSet } from "./BSet.js";
+import { BBoolean } from "./BBoolean.js";
+export class BUtils {
+}
+BUtils.BOOL = new BSet(new BBoolean(true), new BBoolean(false));
+export class SelectError extends Error {
+    constructor(msg) {
+        super(msg);
+        Object.setPrototypeOf(this, SelectError.prototype);
+    }
+}
\ No newline at end of file
diff --git a/B2Program/LandingGear/HydraulicCircuit/img/handle_.png b/B2Program/LandingGear/HydraulicCircuit/img/handle_.png
new file mode 100644
index 0000000000000000000000000000000000000000..bc09fd37a21792d2350e95972b9bb590a027153a
Binary files /dev/null and b/B2Program/LandingGear/HydraulicCircuit/img/handle_.png differ
diff --git a/B2Program/LandingGear/HydraulicCircuit/img/handle_down.png b/B2Program/LandingGear/HydraulicCircuit/img/handle_down.png
new file mode 100644
index 0000000000000000000000000000000000000000..bc09fd37a21792d2350e95972b9bb590a027153a
Binary files /dev/null and b/B2Program/LandingGear/HydraulicCircuit/img/handle_down.png differ
diff --git a/B2Program/LandingGear/HydraulicCircuit/img/handle_up.png b/B2Program/LandingGear/HydraulicCircuit/img/handle_up.png
new file mode 100644
index 0000000000000000000000000000000000000000..a4ed6862820a0058e2d6d3554c58fd922ce4468e
Binary files /dev/null and b/B2Program/LandingGear/HydraulicCircuit/img/handle_up.png differ
diff --git a/B2Program/LandingGear/HydraulicCircuit/immutable/LICENSE b/B2Program/LandingGear/HydraulicCircuit/immutable/LICENSE
new file mode 100755
index 0000000000000000000000000000000000000000..cde61b6c53dda799b707ddf13c067fada5140acf
--- /dev/null
+++ b/B2Program/LandingGear/HydraulicCircuit/immutable/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2014-present, Facebook, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/B2Program/LandingGear/HydraulicCircuit/immutable/dist/immutable.es.js b/B2Program/LandingGear/HydraulicCircuit/immutable/dist/immutable.es.js
new file mode 100755
index 0000000000000000000000000000000000000000..aecd6fe13a5026d8567ff123f8bdd6b79452e394
--- /dev/null
+++ b/B2Program/LandingGear/HydraulicCircuit/immutable/dist/immutable.es.js
@@ -0,0 +1,5818 @@
+/**
+ * Copyright (c) 2014-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+// Used for setting prototype methods that IE8 chokes on.
+var DELETE = 'delete';
+
+// Constants describing the size of trie nodes.
+var SHIFT = 5; // Resulted in best performance after ______?
+var SIZE = 1 << SHIFT;
+var MASK = SIZE - 1;
+
+// A consistent shared value representing "not set" which equals nothing other
+// than itself, and nothing that could be provided externally.
+var NOT_SET = {};
+
+// Boolean references, Rough equivalent of `bool &`.
+function MakeRef() {
+  return { value: false };
+}
+
+function SetRef(ref) {
+  if (ref) {
+    ref.value = true;
+  }
+}
+
+// A function which returns a value representing an "owner" for transient writes
+// to tries. The return value will only ever equal itself, and will not equal
+// the return of any subsequent call of this function.
+function OwnerID() {}
+
+function ensureSize(iter) {
+  if (iter.size === undefined) {
+    iter.size = iter.__iterate(returnTrue);
+  }
+  return iter.size;
+}
+
+function wrapIndex(iter, index) {
+  // This implements "is array index" which the ECMAString spec defines as:
+  //
+  //     A String property name P is an array index if and only if
+  //     ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal
+  //     to 2^32−1.
+  //
+  // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects
+  if (typeof index !== 'number') {
+    var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32
+    if ('' + uint32Index !== index || uint32Index === 4294967295) {
+      return NaN;
+    }
+    index = uint32Index;
+  }
+  return index < 0 ? ensureSize(iter) + index : index;
+}
+
+function returnTrue() {
+  return true;
+}
+
+function wholeSlice(begin, end, size) {
+  return (
+    ((begin === 0 && !isNeg(begin)) ||
+      (size !== undefined && begin <= -size)) &&
+    (end === undefined || (size !== undefined && end >= size))
+  );
+}
+
+function resolveBegin(begin, size) {
+  return resolveIndex(begin, size, 0);
+}
+
+function resolveEnd(end, size) {
+  return resolveIndex(end, size, size);
+}
+
+function resolveIndex(index, size, defaultIndex) {
+  // Sanitize indices using this shorthand for ToInt32(argument)
+  // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32
+  return index === undefined
+    ? defaultIndex
+    : isNeg(index)
+      ? size === Infinity
+        ? size
+        : Math.max(0, size + index) | 0
+      : size === undefined || size === index
+        ? index
+        : Math.min(size, index) | 0;
+}
+
+function isNeg(value) {
+  // Account for -0 which is negative, but not less than 0.
+  return value < 0 || (value === 0 && 1 / value === -Infinity);
+}
+
+// Note: value is unchanged to not break immutable-devtools.
+var IS_COLLECTION_SYMBOL = '@@__IMMUTABLE_ITERABLE__@@';
+
+function isCollection(maybeCollection) {
+  return Boolean(maybeCollection && maybeCollection[IS_COLLECTION_SYMBOL]);
+}
+
+var IS_KEYED_SYMBOL = '@@__IMMUTABLE_KEYED__@@';
+
+function isKeyed(maybeKeyed) {
+  return Boolean(maybeKeyed && maybeKeyed[IS_KEYED_SYMBOL]);
+}
+
+var IS_INDEXED_SYMBOL = '@@__IMMUTABLE_INDEXED__@@';
+
+function isIndexed(maybeIndexed) {
+  return Boolean(maybeIndexed && maybeIndexed[IS_INDEXED_SYMBOL]);
+}
+
+function isAssociative(maybeAssociative) {
+  return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);
+}
+
+var Collection = function Collection(value) {
+  return isCollection(value) ? value : Seq(value);
+};
+
+var KeyedCollection = /*@__PURE__*/(function (Collection) {
+  function KeyedCollection(value) {
+    return isKeyed(value) ? value : KeyedSeq(value);
+  }
+
+  if ( Collection ) KeyedCollection.__proto__ = Collection;
+  KeyedCollection.prototype = Object.create( Collection && Collection.prototype );
+  KeyedCollection.prototype.constructor = KeyedCollection;
+
+  return KeyedCollection;
+}(Collection));
+
+var IndexedCollection = /*@__PURE__*/(function (Collection) {
+  function IndexedCollection(value) {
+    return isIndexed(value) ? value : IndexedSeq(value);
+  }
+
+  if ( Collection ) IndexedCollection.__proto__ = Collection;
+  IndexedCollection.prototype = Object.create( Collection && Collection.prototype );
+  IndexedCollection.prototype.constructor = IndexedCollection;
+
+  return IndexedCollection;
+}(Collection));
+
+var SetCollection = /*@__PURE__*/(function (Collection) {
+  function SetCollection(value) {
+    return isCollection(value) && !isAssociative(value) ? value : SetSeq(value);
+  }
+
+  if ( Collection ) SetCollection.__proto__ = Collection;
+  SetCollection.prototype = Object.create( Collection && Collection.prototype );
+  SetCollection.prototype.constructor = SetCollection;
+
+  return SetCollection;
+}(Collection));
+
+Collection.Keyed = KeyedCollection;
+Collection.Indexed = IndexedCollection;
+Collection.Set = SetCollection;
+
+var IS_SEQ_SYMBOL = '@@__IMMUTABLE_SEQ__@@';
+
+function isSeq(maybeSeq) {
+  return Boolean(maybeSeq && maybeSeq[IS_SEQ_SYMBOL]);
+}
+
+var IS_RECORD_SYMBOL = '@@__IMMUTABLE_RECORD__@@';
+
+function isRecord(maybeRecord) {
+  return Boolean(maybeRecord && maybeRecord[IS_RECORD_SYMBOL]);
+}
+
+function isImmutable(maybeImmutable) {
+  return isCollection(maybeImmutable) || isRecord(maybeImmutable);
+}
+
+var IS_ORDERED_SYMBOL = '@@__IMMUTABLE_ORDERED__@@';
+
+function isOrdered(maybeOrdered) {
+  return Boolean(maybeOrdered && maybeOrdered[IS_ORDERED_SYMBOL]);
+}
+
+var ITERATE_KEYS = 0;
+var ITERATE_VALUES = 1;
+var ITERATE_ENTRIES = 2;
+
+var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
+var FAUX_ITERATOR_SYMBOL = '@@iterator';
+
+var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL;
+
+var Iterator = function Iterator(next) {
+  this.next = next;
+};
+
+Iterator.prototype.toString = function toString () {
+  return '[Iterator]';
+};
+
+Iterator.KEYS = ITERATE_KEYS;
+Iterator.VALUES = ITERATE_VALUES;
+Iterator.ENTRIES = ITERATE_ENTRIES;
+
+Iterator.prototype.inspect = Iterator.prototype.toSource = function() {
+  return this.toString();
+};
+Iterator.prototype[ITERATOR_SYMBOL] = function() {
+  return this;
+};
+
+function iteratorValue(type, k, v, iteratorResult) {
+  var value = type === 0 ? k : type === 1 ? v : [k, v];
+  iteratorResult
+    ? (iteratorResult.value = value)
+    : (iteratorResult = {
+        value: value,
+        done: false,
+      });
+  return iteratorResult;
+}
+
+function iteratorDone() {
+  return { value: undefined, done: true };
+}
+
+function hasIterator(maybeIterable) {
+  return !!getIteratorFn(maybeIterable);
+}
+
+function isIterator(maybeIterator) {
+  return maybeIterator && typeof maybeIterator.next === 'function';
+}
+
+function getIterator(iterable) {
+  var iteratorFn = getIteratorFn(iterable);
+  return iteratorFn && iteratorFn.call(iterable);
+}
+
+function getIteratorFn(iterable) {
+  var iteratorFn =
+    iterable &&
+    ((REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) ||
+      iterable[FAUX_ITERATOR_SYMBOL]);
+  if (typeof iteratorFn === 'function') {
+    return iteratorFn;
+  }
+}
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+function isArrayLike(value) {
+  if (Array.isArray(value) || typeof value === 'string') {
+    return true;
+  }
+
+  return (
+    value &&
+    typeof value === 'object' &&
+    Number.isInteger(value.length) &&
+    value.length >= 0 &&
+    (value.length === 0
+      ? // Only {length: 0} is considered Array-like.
+        Object.keys(value).length === 1
+      : // An object is only Array-like if it has a property where the last value
+        // in the array-like may be found (which could be undefined).
+        value.hasOwnProperty(value.length - 1))
+  );
+}
+
+var Seq = /*@__PURE__*/(function (Collection$$1) {
+  function Seq(value) {
+    return value === null || value === undefined
+      ? emptySequence()
+      : isImmutable(value)
+        ? value.toSeq()
+        : seqFromValue(value);
+  }
+
+  if ( Collection$$1 ) Seq.__proto__ = Collection$$1;
+  Seq.prototype = Object.create( Collection$$1 && Collection$$1.prototype );
+  Seq.prototype.constructor = Seq;
+
+  Seq.prototype.toSeq = function toSeq () {
+    return this;
+  };
+
+  Seq.prototype.toString = function toString () {
+    return this.__toString('Seq {', '}');
+  };
+
+  Seq.prototype.cacheResult = function cacheResult () {
+    if (!this._cache && this.__iterateUncached) {
+      this._cache = this.entrySeq().toArray();
+      this.size = this._cache.length;
+    }
+    return this;
+  };
+
+  // abstract __iterateUncached(fn, reverse)
+
+  Seq.prototype.__iterate = function __iterate (fn, reverse) {
+    var cache = this._cache;
+    if (cache) {
+      var size = cache.length;
+      var i = 0;
+      while (i !== size) {
+        var entry = cache[reverse ? size - ++i : i++];
+        if (fn(entry[1], entry[0], this) === false) {
+          break;
+        }
+      }
+      return i;
+    }
+    return this.__iterateUncached(fn, reverse);
+  };
+
+  // abstract __iteratorUncached(type, reverse)
+
+  Seq.prototype.__iterator = function __iterator (type, reverse) {
+    var cache = this._cache;
+    if (cache) {
+      var size = cache.length;
+      var i = 0;
+      return new Iterator(function () {
+        if (i === size) {
+          return iteratorDone();
+        }
+        var entry = cache[reverse ? size - ++i : i++];
+        return iteratorValue(type, entry[0], entry[1]);
+      });
+    }
+    return this.__iteratorUncached(type, reverse);
+  };
+
+  return Seq;
+}(Collection));
+
+var KeyedSeq = /*@__PURE__*/(function (Seq) {
+  function KeyedSeq(value) {
+    return value === null || value === undefined
+      ? emptySequence().toKeyedSeq()
+      : isCollection(value)
+        ? isKeyed(value)
+          ? value.toSeq()
+          : value.fromEntrySeq()
+        : isRecord(value)
+          ? value.toSeq()
+          : keyedSeqFromValue(value);
+  }
+
+  if ( Seq ) KeyedSeq.__proto__ = Seq;
+  KeyedSeq.prototype = Object.create( Seq && Seq.prototype );
+  KeyedSeq.prototype.constructor = KeyedSeq;
+
+  KeyedSeq.prototype.toKeyedSeq = function toKeyedSeq () {
+    return this;
+  };
+
+  return KeyedSeq;
+}(Seq));
+
+var IndexedSeq = /*@__PURE__*/(function (Seq) {
+  function IndexedSeq(value) {
+    return value === null || value === undefined
+      ? emptySequence()
+      : isCollection(value)
+        ? isKeyed(value)
+          ? value.entrySeq()
+          : value.toIndexedSeq()
+        : isRecord(value)
+          ? value.toSeq().entrySeq()
+          : indexedSeqFromValue(value);
+  }
+
+  if ( Seq ) IndexedSeq.__proto__ = Seq;
+  IndexedSeq.prototype = Object.create( Seq && Seq.prototype );
+  IndexedSeq.prototype.constructor = IndexedSeq;
+
+  IndexedSeq.of = function of (/*...values*/) {
+    return IndexedSeq(arguments);
+  };
+
+  IndexedSeq.prototype.toIndexedSeq = function toIndexedSeq () {
+    return this;
+  };
+
+  IndexedSeq.prototype.toString = function toString () {
+    return this.__toString('Seq [', ']');
+  };
+
+  return IndexedSeq;
+}(Seq));
+
+var SetSeq = /*@__PURE__*/(function (Seq) {
+  function SetSeq(value) {
+    return (isCollection(value) && !isAssociative(value)
+      ? value
+      : IndexedSeq(value)
+    ).toSetSeq();
+  }
+
+  if ( Seq ) SetSeq.__proto__ = Seq;
+  SetSeq.prototype = Object.create( Seq && Seq.prototype );
+  SetSeq.prototype.constructor = SetSeq;
+
+  SetSeq.of = function of (/*...values*/) {
+    return SetSeq(arguments);
+  };
+
+  SetSeq.prototype.toSetSeq = function toSetSeq () {
+    return this;
+  };
+
+  return SetSeq;
+}(Seq));
+
+Seq.isSeq = isSeq;
+Seq.Keyed = KeyedSeq;
+Seq.Set = SetSeq;
+Seq.Indexed = IndexedSeq;
+
+Seq.prototype[IS_SEQ_SYMBOL] = true;
+
+// #pragma Root Sequences
+
+var ArraySeq = /*@__PURE__*/(function (IndexedSeq) {
+  function ArraySeq(array) {
+    this._array = array;
+    this.size = array.length;
+  }
+
+  if ( IndexedSeq ) ArraySeq.__proto__ = IndexedSeq;
+  ArraySeq.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
+  ArraySeq.prototype.constructor = ArraySeq;
+
+  ArraySeq.prototype.get = function get (index, notSetValue) {
+    return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue;
+  };
+
+  ArraySeq.prototype.__iterate = function __iterate (fn, reverse) {
+    var array = this._array;
+    var size = array.length;
+    var i = 0;
+    while (i !== size) {
+      var ii = reverse ? size - ++i : i++;
+      if (fn(array[ii], ii, this) === false) {
+        break;
+      }
+    }
+    return i;
+  };
+
+  ArraySeq.prototype.__iterator = function __iterator (type, reverse) {
+    var array = this._array;
+    var size = array.length;
+    var i = 0;
+    return new Iterator(function () {
+      if (i === size) {
+        return iteratorDone();
+      }
+      var ii = reverse ? size - ++i : i++;
+      return iteratorValue(type, ii, array[ii]);
+    });
+  };
+
+  return ArraySeq;
+}(IndexedSeq));
+
+var ObjectSeq = /*@__PURE__*/(function (KeyedSeq) {
+  function ObjectSeq(object) {
+    var keys = Object.keys(object);
+    this._object = object;
+    this._keys = keys;
+    this.size = keys.length;
+  }
+
+  if ( KeyedSeq ) ObjectSeq.__proto__ = KeyedSeq;
+  ObjectSeq.prototype = Object.create( KeyedSeq && KeyedSeq.prototype );
+  ObjectSeq.prototype.constructor = ObjectSeq;
+
+  ObjectSeq.prototype.get = function get (key, notSetValue) {
+    if (notSetValue !== undefined && !this.has(key)) {
+      return notSetValue;
+    }
+    return this._object[key];
+  };
+
+  ObjectSeq.prototype.has = function has (key) {
+    return hasOwnProperty.call(this._object, key);
+  };
+
+  ObjectSeq.prototype.__iterate = function __iterate (fn, reverse) {
+    var object = this._object;
+    var keys = this._keys;
+    var size = keys.length;
+    var i = 0;
+    while (i !== size) {
+      var key = keys[reverse ? size - ++i : i++];
+      if (fn(object[key], key, this) === false) {
+        break;
+      }
+    }
+    return i;
+  };
+
+  ObjectSeq.prototype.__iterator = function __iterator (type, reverse) {
+    var object = this._object;
+    var keys = this._keys;
+    var size = keys.length;
+    var i = 0;
+    return new Iterator(function () {
+      if (i === size) {
+        return iteratorDone();
+      }
+      var key = keys[reverse ? size - ++i : i++];
+      return iteratorValue(type, key, object[key]);
+    });
+  };
+
+  return ObjectSeq;
+}(KeyedSeq));
+ObjectSeq.prototype[IS_ORDERED_SYMBOL] = true;
+
+var CollectionSeq = /*@__PURE__*/(function (IndexedSeq) {
+  function CollectionSeq(collection) {
+    this._collection = collection;
+    this.size = collection.length || collection.size;
+  }
+
+  if ( IndexedSeq ) CollectionSeq.__proto__ = IndexedSeq;
+  CollectionSeq.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
+  CollectionSeq.prototype.constructor = CollectionSeq;
+
+  CollectionSeq.prototype.__iterateUncached = function __iterateUncached (fn, reverse) {
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var collection = this._collection;
+    var iterator = getIterator(collection);
+    var iterations = 0;
+    if (isIterator(iterator)) {
+      var step;
+      while (!(step = iterator.next()).done) {
+        if (fn(step.value, iterations++, this) === false) {
+          break;
+        }
+      }
+    }
+    return iterations;
+  };
+
+  CollectionSeq.prototype.__iteratorUncached = function __iteratorUncached (type, reverse) {
+    if (reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    var collection = this._collection;
+    var iterator = getIterator(collection);
+    if (!isIterator(iterator)) {
+      return new Iterator(iteratorDone);
+    }
+    var iterations = 0;
+    return new Iterator(function () {
+      var step = iterator.next();
+      return step.done ? step : iteratorValue(type, iterations++, step.value);
+    });
+  };
+
+  return CollectionSeq;
+}(IndexedSeq));
+
+// # pragma Helper functions
+
+var EMPTY_SEQ;
+
+function emptySequence() {
+  return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([]));
+}
+
+function keyedSeqFromValue(value) {
+  var seq = Array.isArray(value)
+    ? new ArraySeq(value)
+    : hasIterator(value)
+      ? new CollectionSeq(value)
+      : undefined;
+  if (seq) {
+    return seq.fromEntrySeq();
+  }
+  if (typeof value === 'object') {
+    return new ObjectSeq(value);
+  }
+  throw new TypeError(
+    'Expected Array or collection object of [k, v] entries, or keyed object: ' +
+      value
+  );
+}
+
+function indexedSeqFromValue(value) {
+  var seq = maybeIndexedSeqFromValue(value);
+  if (seq) {
+    return seq;
+  }
+  throw new TypeError(
+    'Expected Array or collection object of values: ' + value
+  );
+}
+
+function seqFromValue(value) {
+  var seq = maybeIndexedSeqFromValue(value);
+  if (seq) {
+    return seq;
+  }
+  if (typeof value === 'object') {
+    return new ObjectSeq(value);
+  }
+  throw new TypeError(
+    'Expected Array or collection object of values, or keyed object: ' + value
+  );
+}
+
+function maybeIndexedSeqFromValue(value) {
+  return isArrayLike(value)
+    ? new ArraySeq(value)
+    : hasIterator(value)
+      ? new CollectionSeq(value)
+      : undefined;
+}
+
+var IS_MAP_SYMBOL = '@@__IMMUTABLE_MAP__@@';
+
+function isMap(maybeMap) {
+  return Boolean(maybeMap && maybeMap[IS_MAP_SYMBOL]);
+}
+
+function isOrderedMap(maybeOrderedMap) {
+  return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);
+}
+
+function isValueObject(maybeValue) {
+  return Boolean(
+    maybeValue &&
+      typeof maybeValue.equals === 'function' &&
+      typeof maybeValue.hashCode === 'function'
+  );
+}
+
+/**
+ * An extension of the "same-value" algorithm as [described for use by ES6 Map
+ * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality)
+ *
+ * NaN is considered the same as NaN, however -0 and 0 are considered the same
+ * value, which is different from the algorithm described by
+ * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
+ *
+ * This is extended further to allow Objects to describe the values they
+ * represent, by way of `valueOf` or `equals` (and `hashCode`).
+ *
+ * Note: because of this extension, the key equality of Immutable.Map and the
+ * value equality of Immutable.Set will differ from ES6 Map and Set.
+ *
+ * ### Defining custom values
+ *
+ * The easiest way to describe the value an object represents is by implementing
+ * `valueOf`. For example, `Date` represents a value by returning a unix
+ * timestamp for `valueOf`:
+ *
+ *     var date1 = new Date(1234567890000); // Fri Feb 13 2009 ...
+ *     var date2 = new Date(1234567890000);
+ *     date1.valueOf(); // 1234567890000
+ *     assert( date1 !== date2 );
+ *     assert( Immutable.is( date1, date2 ) );
+ *
+ * Note: overriding `valueOf` may have other implications if you use this object
+ * where JavaScript expects a primitive, such as implicit string coercion.
+ *
+ * For more complex types, especially collections, implementing `valueOf` may
+ * not be performant. An alternative is to implement `equals` and `hashCode`.
+ *
+ * `equals` takes another object, presumably of similar type, and returns true
+ * if it is equal. Equality is symmetrical, so the same result should be
+ * returned if this and the argument are flipped.
+ *
+ *     assert( a.equals(b) === b.equals(a) );
+ *
+ * `hashCode` returns a 32bit integer number representing the object which will
+ * be used to determine how to store the value object in a Map or Set. You must
+ * provide both or neither methods, one must not exist without the other.
+ *
+ * Also, an important relationship between these methods must be upheld: if two
+ * values are equal, they *must* return the same hashCode. If the values are not
+ * equal, they might have the same hashCode; this is called a hash collision,
+ * and while undesirable for performance reasons, it is acceptable.
+ *
+ *     if (a.equals(b)) {
+ *       assert( a.hashCode() === b.hashCode() );
+ *     }
+ *
+ * All Immutable collections are Value Objects: they implement `equals()`
+ * and `hashCode()`.
+ */
+function is(valueA, valueB) {
+  if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {
+    return true;
+  }
+  if (!valueA || !valueB) {
+    return false;
+  }
+  if (
+    typeof valueA.valueOf === 'function' &&
+    typeof valueB.valueOf === 'function'
+  ) {
+    valueA = valueA.valueOf();
+    valueB = valueB.valueOf();
+    if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {
+      return true;
+    }
+    if (!valueA || !valueB) {
+      return false;
+    }
+  }
+  return !!(
+    isValueObject(valueA) &&
+    isValueObject(valueB) &&
+    valueA.equals(valueB)
+  );
+}
+
+var imul =
+  typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2
+    ? Math.imul
+    : function imul(a, b) {
+        a |= 0; // int
+        b |= 0; // int
+        var c = a & 0xffff;
+        var d = b & 0xffff;
+        // Shift by 0 fixes the sign on the high part.
+        return (c * d + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0)) | 0; // int
+      };
+
+// v8 has an optimization for storing 31-bit signed numbers.
+// Values which have either 00 or 11 as the high order bits qualify.
+// This function drops the highest order bit in a signed number, maintaining
+// the sign bit.
+function smi(i32) {
+  return ((i32 >>> 1) & 0x40000000) | (i32 & 0xbfffffff);
+}
+
+var defaultValueOf = Object.prototype.valueOf;
+
+function hash(o) {
+  switch (typeof o) {
+    case 'boolean':
+      // The hash values for built-in constants are a 1 value for each 5-byte
+      // shift region expect for the first, which encodes the value. This
+      // reduces the odds of a hash collision for these common values.
+      return o ? 0x42108421 : 0x42108420;
+    case 'number':
+      return hashNumber(o);
+    case 'string':
+      return o.length > STRING_HASH_CACHE_MIN_STRLEN
+        ? cachedHashString(o)
+        : hashString(o);
+    case 'object':
+    case 'function':
+      if (o === null) {
+        return 0x42108422;
+      }
+      if (typeof o.hashCode === 'function') {
+        // Drop any high bits from accidentally long hash codes.
+        return smi(o.hashCode(o));
+      }
+      if (o.valueOf !== defaultValueOf && typeof o.valueOf === 'function') {
+        o = o.valueOf(o);
+      }
+      return hashJSObj(o);
+    case 'undefined':
+      return 0x42108423;
+    default:
+      if (typeof o.toString === 'function') {
+        return hashString(o.toString());
+      }
+      throw new Error('Value type ' + typeof o + ' cannot be hashed.');
+  }
+}
+
+// Compress arbitrarily large numbers into smi hashes.
+function hashNumber(n) {
+  if (n !== n || n === Infinity) {
+    return 0;
+  }
+  var hash = n | 0;
+  if (hash !== n) {
+    hash ^= n * 0xffffffff;
+  }
+  while (n > 0xffffffff) {
+    n /= 0xffffffff;
+    hash ^= n;
+  }
+  return smi(hash);
+}
+
+function cachedHashString(string) {
+  var hashed = stringHashCache[string];
+  if (hashed === undefined) {
+    hashed = hashString(string);
+    if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) {
+      STRING_HASH_CACHE_SIZE = 0;
+      stringHashCache = {};
+    }
+    STRING_HASH_CACHE_SIZE++;
+    stringHashCache[string] = hashed;
+  }
+  return hashed;
+}
+
+// http://jsperf.com/hashing-strings
+function hashString(string) {
+  // This is the hash from JVM
+  // The hash code for a string is computed as
+  // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1],
+  // where s[i] is the ith character of the string and n is the length of
+  // the string. We "mod" the result to make it between 0 (inclusive) and 2^31
+  // (exclusive) by dropping high bits.
+  var hashed = 0;
+  for (var ii = 0; ii < string.length; ii++) {
+    hashed = (31 * hashed + string.charCodeAt(ii)) | 0;
+  }
+  return smi(hashed);
+}
+
+function hashJSObj(obj) {
+  var hashed;
+  if (usingWeakMap) {
+    hashed = weakMap.get(obj);
+    if (hashed !== undefined) {
+      return hashed;
+    }
+  }
+
+  hashed = obj[UID_HASH_KEY];
+  if (hashed !== undefined) {
+    return hashed;
+  }
+
+  if (!canDefineProperty) {
+    hashed = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY];
+    if (hashed !== undefined) {
+      return hashed;
+    }
+
+    hashed = getIENodeHash(obj);
+    if (hashed !== undefined) {
+      return hashed;
+    }
+  }
+
+  hashed = ++objHashUID;
+  if (objHashUID & 0x40000000) {
+    objHashUID = 0;
+  }
+
+  if (usingWeakMap) {
+    weakMap.set(obj, hashed);
+  } else if (isExtensible !== undefined && isExtensible(obj) === false) {
+    throw new Error('Non-extensible objects are not allowed as keys.');
+  } else if (canDefineProperty) {
+    Object.defineProperty(obj, UID_HASH_KEY, {
+      enumerable: false,
+      configurable: false,
+      writable: false,
+      value: hashed,
+    });
+  } else if (
+    obj.propertyIsEnumerable !== undefined &&
+    obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable
+  ) {
+    // Since we can't define a non-enumerable property on the object
+    // we'll hijack one of the less-used non-enumerable properties to
+    // save our hash on it. Since this is a function it will not show up in
+    // `JSON.stringify` which is what we want.
+    obj.propertyIsEnumerable = function() {
+      return this.constructor.prototype.propertyIsEnumerable.apply(
+        this,
+        arguments
+      );
+    };
+    obj.propertyIsEnumerable[UID_HASH_KEY] = hashed;
+  } else if (obj.nodeType !== undefined) {
+    // At this point we couldn't get the IE `uniqueID` to use as a hash
+    // and we couldn't use a non-enumerable property to exploit the
+    // dontEnum bug so we simply add the `UID_HASH_KEY` on the node
+    // itself.
+    obj[UID_HASH_KEY] = hashed;
+  } else {
+    throw new Error('Unable to set a non-enumerable property on object.');
+  }
+
+  return hashed;
+}
+
+// Get references to ES5 object methods.
+var isExtensible = Object.isExtensible;
+
+// True if Object.defineProperty works as expected. IE8 fails this test.
+var canDefineProperty = (function() {
+  try {
+    Object.defineProperty({}, '@', {});
+    return true;
+  } catch (e) {
+    return false;
+  }
+})();
+
+// IE has a `uniqueID` property on DOM nodes. We can construct the hash from it
+// and avoid memory leaks from the IE cloneNode bug.
+function getIENodeHash(node) {
+  if (node && node.nodeType > 0) {
+    switch (node.nodeType) {
+      case 1: // Element
+        return node.uniqueID;
+      case 9: // Document
+        return node.documentElement && node.documentElement.uniqueID;
+    }
+  }
+}
+
+// If possible, use a WeakMap.
+var usingWeakMap = typeof WeakMap === 'function';
+var weakMap;
+if (usingWeakMap) {
+  weakMap = new WeakMap();
+}
+
+var objHashUID = 0;
+
+var UID_HASH_KEY = '__immutablehash__';
+if (typeof Symbol === 'function') {
+  UID_HASH_KEY = Symbol(UID_HASH_KEY);
+}
+
+var STRING_HASH_CACHE_MIN_STRLEN = 16;
+var STRING_HASH_CACHE_MAX_SIZE = 255;
+var STRING_HASH_CACHE_SIZE = 0;
+var stringHashCache = {};
+
+var ToKeyedSequence = /*@__PURE__*/(function (KeyedSeq$$1) {
+  function ToKeyedSequence(indexed, useKeys) {
+    this._iter = indexed;
+    this._useKeys = useKeys;
+    this.size = indexed.size;
+  }
+
+  if ( KeyedSeq$$1 ) ToKeyedSequence.__proto__ = KeyedSeq$$1;
+  ToKeyedSequence.prototype = Object.create( KeyedSeq$$1 && KeyedSeq$$1.prototype );
+  ToKeyedSequence.prototype.constructor = ToKeyedSequence;
+
+  ToKeyedSequence.prototype.get = function get (key, notSetValue) {
+    return this._iter.get(key, notSetValue);
+  };
+
+  ToKeyedSequence.prototype.has = function has (key) {
+    return this._iter.has(key);
+  };
+
+  ToKeyedSequence.prototype.valueSeq = function valueSeq () {
+    return this._iter.valueSeq();
+  };
+
+  ToKeyedSequence.prototype.reverse = function reverse () {
+    var this$1 = this;
+
+    var reversedSequence = reverseFactory(this, true);
+    if (!this._useKeys) {
+      reversedSequence.valueSeq = function () { return this$1._iter.toSeq().reverse(); };
+    }
+    return reversedSequence;
+  };
+
+  ToKeyedSequence.prototype.map = function map (mapper, context) {
+    var this$1 = this;
+
+    var mappedSequence = mapFactory(this, mapper, context);
+    if (!this._useKeys) {
+      mappedSequence.valueSeq = function () { return this$1._iter.toSeq().map(mapper, context); };
+    }
+    return mappedSequence;
+  };
+
+  ToKeyedSequence.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._iter.__iterate(function (v, k) { return fn(v, k, this$1); }, reverse);
+  };
+
+  ToKeyedSequence.prototype.__iterator = function __iterator (type, reverse) {
+    return this._iter.__iterator(type, reverse);
+  };
+
+  return ToKeyedSequence;
+}(KeyedSeq));
+ToKeyedSequence.prototype[IS_ORDERED_SYMBOL] = true;
+
+var ToIndexedSequence = /*@__PURE__*/(function (IndexedSeq$$1) {
+  function ToIndexedSequence(iter) {
+    this._iter = iter;
+    this.size = iter.size;
+  }
+
+  if ( IndexedSeq$$1 ) ToIndexedSequence.__proto__ = IndexedSeq$$1;
+  ToIndexedSequence.prototype = Object.create( IndexedSeq$$1 && IndexedSeq$$1.prototype );
+  ToIndexedSequence.prototype.constructor = ToIndexedSequence;
+
+  ToIndexedSequence.prototype.includes = function includes (value) {
+    return this._iter.includes(value);
+  };
+
+  ToIndexedSequence.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    var i = 0;
+    reverse && ensureSize(this);
+    return this._iter.__iterate(
+      function (v) { return fn(v, reverse ? this$1.size - ++i : i++, this$1); },
+      reverse
+    );
+  };
+
+  ToIndexedSequence.prototype.__iterator = function __iterator (type, reverse) {
+    var this$1 = this;
+
+    var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
+    var i = 0;
+    reverse && ensureSize(this);
+    return new Iterator(function () {
+      var step = iterator.next();
+      return step.done
+        ? step
+        : iteratorValue(
+            type,
+            reverse ? this$1.size - ++i : i++,
+            step.value,
+            step
+          );
+    });
+  };
+
+  return ToIndexedSequence;
+}(IndexedSeq));
+
+var ToSetSequence = /*@__PURE__*/(function (SetSeq$$1) {
+  function ToSetSequence(iter) {
+    this._iter = iter;
+    this.size = iter.size;
+  }
+
+  if ( SetSeq$$1 ) ToSetSequence.__proto__ = SetSeq$$1;
+  ToSetSequence.prototype = Object.create( SetSeq$$1 && SetSeq$$1.prototype );
+  ToSetSequence.prototype.constructor = ToSetSequence;
+
+  ToSetSequence.prototype.has = function has (key) {
+    return this._iter.includes(key);
+  };
+
+  ToSetSequence.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._iter.__iterate(function (v) { return fn(v, v, this$1); }, reverse);
+  };
+
+  ToSetSequence.prototype.__iterator = function __iterator (type, reverse) {
+    var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
+    return new Iterator(function () {
+      var step = iterator.next();
+      return step.done
+        ? step
+        : iteratorValue(type, step.value, step.value, step);
+    });
+  };
+
+  return ToSetSequence;
+}(SetSeq));
+
+var FromEntriesSequence = /*@__PURE__*/(function (KeyedSeq$$1) {
+  function FromEntriesSequence(entries) {
+    this._iter = entries;
+    this.size = entries.size;
+  }
+
+  if ( KeyedSeq$$1 ) FromEntriesSequence.__proto__ = KeyedSeq$$1;
+  FromEntriesSequence.prototype = Object.create( KeyedSeq$$1 && KeyedSeq$$1.prototype );
+  FromEntriesSequence.prototype.constructor = FromEntriesSequence;
+
+  FromEntriesSequence.prototype.entrySeq = function entrySeq () {
+    return this._iter.toSeq();
+  };
+
+  FromEntriesSequence.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._iter.__iterate(function (entry) {
+      // Check if entry exists first so array access doesn't throw for holes
+      // in the parent iteration.
+      if (entry) {
+        validateEntry(entry);
+        var indexedCollection = isCollection(entry);
+        return fn(
+          indexedCollection ? entry.get(1) : entry[1],
+          indexedCollection ? entry.get(0) : entry[0],
+          this$1
+        );
+      }
+    }, reverse);
+  };
+
+  FromEntriesSequence.prototype.__iterator = function __iterator (type, reverse) {
+    var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
+    return new Iterator(function () {
+      while (true) {
+        var step = iterator.next();
+        if (step.done) {
+          return step;
+        }
+        var entry = step.value;
+        // Check if entry exists first so array access doesn't throw for holes
+        // in the parent iteration.
+        if (entry) {
+          validateEntry(entry);
+          var indexedCollection = isCollection(entry);
+          return iteratorValue(
+            type,
+            indexedCollection ? entry.get(0) : entry[0],
+            indexedCollection ? entry.get(1) : entry[1],
+            step
+          );
+        }
+      }
+    });
+  };
+
+  return FromEntriesSequence;
+}(KeyedSeq));
+
+ToIndexedSequence.prototype.cacheResult = ToKeyedSequence.prototype.cacheResult = ToSetSequence.prototype.cacheResult = FromEntriesSequence.prototype.cacheResult = cacheResultThrough;
+
+function flipFactory(collection) {
+  var flipSequence = makeSequence(collection);
+  flipSequence._iter = collection;
+  flipSequence.size = collection.size;
+  flipSequence.flip = function () { return collection; };
+  flipSequence.reverse = function() {
+    var reversedSequence = collection.reverse.apply(this); // super.reverse()
+    reversedSequence.flip = function () { return collection.reverse(); };
+    return reversedSequence;
+  };
+  flipSequence.has = function (key) { return collection.includes(key); };
+  flipSequence.includes = function (key) { return collection.has(key); };
+  flipSequence.cacheResult = cacheResultThrough;
+  flipSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    return collection.__iterate(function (v, k) { return fn(k, v, this$1) !== false; }, reverse);
+  };
+  flipSequence.__iteratorUncached = function(type, reverse) {
+    if (type === ITERATE_ENTRIES) {
+      var iterator = collection.__iterator(type, reverse);
+      return new Iterator(function () {
+        var step = iterator.next();
+        if (!step.done) {
+          var k = step.value[0];
+          step.value[0] = step.value[1];
+          step.value[1] = k;
+        }
+        return step;
+      });
+    }
+    return collection.__iterator(
+      type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES,
+      reverse
+    );
+  };
+  return flipSequence;
+}
+
+function mapFactory(collection, mapper, context) {
+  var mappedSequence = makeSequence(collection);
+  mappedSequence.size = collection.size;
+  mappedSequence.has = function (key) { return collection.has(key); };
+  mappedSequence.get = function (key, notSetValue) {
+    var v = collection.get(key, NOT_SET);
+    return v === NOT_SET
+      ? notSetValue
+      : mapper.call(context, v, key, collection);
+  };
+  mappedSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    return collection.__iterate(
+      function (v, k, c) { return fn(mapper.call(context, v, k, c), k, this$1) !== false; },
+      reverse
+    );
+  };
+  mappedSequence.__iteratorUncached = function(type, reverse) {
+    var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
+    return new Iterator(function () {
+      var step = iterator.next();
+      if (step.done) {
+        return step;
+      }
+      var entry = step.value;
+      var key = entry[0];
+      return iteratorValue(
+        type,
+        key,
+        mapper.call(context, entry[1], key, collection),
+        step
+      );
+    });
+  };
+  return mappedSequence;
+}
+
+function reverseFactory(collection, useKeys) {
+  var this$1 = this;
+
+  var reversedSequence = makeSequence(collection);
+  reversedSequence._iter = collection;
+  reversedSequence.size = collection.size;
+  reversedSequence.reverse = function () { return collection; };
+  if (collection.flip) {
+    reversedSequence.flip = function() {
+      var flipSequence = flipFactory(collection);
+      flipSequence.reverse = function () { return collection.flip(); };
+      return flipSequence;
+    };
+  }
+  reversedSequence.get = function (key, notSetValue) { return collection.get(useKeys ? key : -1 - key, notSetValue); };
+  reversedSequence.has = function (key) { return collection.has(useKeys ? key : -1 - key); };
+  reversedSequence.includes = function (value) { return collection.includes(value); };
+  reversedSequence.cacheResult = cacheResultThrough;
+  reversedSequence.__iterate = function(fn, reverse) {
+    var this$1 = this;
+
+    var i = 0;
+    reverse && ensureSize(collection);
+    return collection.__iterate(
+      function (v, k) { return fn(v, useKeys ? k : reverse ? this$1.size - ++i : i++, this$1); },
+      !reverse
+    );
+  };
+  reversedSequence.__iterator = function (type, reverse) {
+    var i = 0;
+    reverse && ensureSize(collection);
+    var iterator = collection.__iterator(ITERATE_ENTRIES, !reverse);
+    return new Iterator(function () {
+      var step = iterator.next();
+      if (step.done) {
+        return step;
+      }
+      var entry = step.value;
+      return iteratorValue(
+        type,
+        useKeys ? entry[0] : reverse ? this$1.size - ++i : i++,
+        entry[1],
+        step
+      );
+    });
+  };
+  return reversedSequence;
+}
+
+function filterFactory(collection, predicate, context, useKeys) {
+  var filterSequence = makeSequence(collection);
+  if (useKeys) {
+    filterSequence.has = function (key) {
+      var v = collection.get(key, NOT_SET);
+      return v !== NOT_SET && !!predicate.call(context, v, key, collection);
+    };
+    filterSequence.get = function (key, notSetValue) {
+      var v = collection.get(key, NOT_SET);
+      return v !== NOT_SET && predicate.call(context, v, key, collection)
+        ? v
+        : notSetValue;
+    };
+  }
+  filterSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    var iterations = 0;
+    collection.__iterate(function (v, k, c) {
+      if (predicate.call(context, v, k, c)) {
+        iterations++;
+        return fn(v, useKeys ? k : iterations - 1, this$1);
+      }
+    }, reverse);
+    return iterations;
+  };
+  filterSequence.__iteratorUncached = function(type, reverse) {
+    var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
+    var iterations = 0;
+    return new Iterator(function () {
+      while (true) {
+        var step = iterator.next();
+        if (step.done) {
+          return step;
+        }
+        var entry = step.value;
+        var key = entry[0];
+        var value = entry[1];
+        if (predicate.call(context, value, key, collection)) {
+          return iteratorValue(type, useKeys ? key : iterations++, value, step);
+        }
+      }
+    });
+  };
+  return filterSequence;
+}
+
+function countByFactory(collection, grouper, context) {
+  var groups = Map().asMutable();
+  collection.__iterate(function (v, k) {
+    groups.update(grouper.call(context, v, k, collection), 0, function (a) { return a + 1; });
+  });
+  return groups.asImmutable();
+}
+
+function groupByFactory(collection, grouper, context) {
+  var isKeyedIter = isKeyed(collection);
+  var groups = (isOrdered(collection) ? OrderedMap() : Map()).asMutable();
+  collection.__iterate(function (v, k) {
+    groups.update(
+      grouper.call(context, v, k, collection),
+      function (a) { return ((a = a || []), a.push(isKeyedIter ? [k, v] : v), a); }
+    );
+  });
+  var coerce = collectionClass(collection);
+  return groups.map(function (arr) { return reify(collection, coerce(arr)); }).asImmutable();
+}
+
+function sliceFactory(collection, begin, end, useKeys) {
+  var originalSize = collection.size;
+
+  if (wholeSlice(begin, end, originalSize)) {
+    return collection;
+  }
+
+  var resolvedBegin = resolveBegin(begin, originalSize);
+  var resolvedEnd = resolveEnd(end, originalSize);
+
+  // begin or end will be NaN if they were provided as negative numbers and
+  // this collection's size is unknown. In that case, cache first so there is
+  // a known size and these do not resolve to NaN.
+  if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) {
+    return sliceFactory(collection.toSeq().cacheResult(), begin, end, useKeys);
+  }
+
+  // Note: resolvedEnd is undefined when the original sequence's length is
+  // unknown and this slice did not supply an end and should contain all
+  // elements after resolvedBegin.
+  // In that case, resolvedSize will be NaN and sliceSize will remain undefined.
+  var resolvedSize = resolvedEnd - resolvedBegin;
+  var sliceSize;
+  if (resolvedSize === resolvedSize) {
+    sliceSize = resolvedSize < 0 ? 0 : resolvedSize;
+  }
+
+  var sliceSeq = makeSequence(collection);
+
+  // If collection.size is undefined, the size of the realized sliceSeq is
+  // unknown at this point unless the number of items to slice is 0
+  sliceSeq.size =
+    sliceSize === 0 ? sliceSize : (collection.size && sliceSize) || undefined;
+
+  if (!useKeys && isSeq(collection) && sliceSize >= 0) {
+    sliceSeq.get = function(index, notSetValue) {
+      index = wrapIndex(this, index);
+      return index >= 0 && index < sliceSize
+        ? collection.get(index + resolvedBegin, notSetValue)
+        : notSetValue;
+    };
+  }
+
+  sliceSeq.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    if (sliceSize === 0) {
+      return 0;
+    }
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var skipped = 0;
+    var isSkipping = true;
+    var iterations = 0;
+    collection.__iterate(function (v, k) {
+      if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {
+        iterations++;
+        return (
+          fn(v, useKeys ? k : iterations - 1, this$1) !== false &&
+          iterations !== sliceSize
+        );
+      }
+    });
+    return iterations;
+  };
+
+  sliceSeq.__iteratorUncached = function(type, reverse) {
+    if (sliceSize !== 0 && reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    // Don't bother instantiating parent iterator if taking 0.
+    if (sliceSize === 0) {
+      return new Iterator(iteratorDone);
+    }
+    var iterator = collection.__iterator(type, reverse);
+    var skipped = 0;
+    var iterations = 0;
+    return new Iterator(function () {
+      while (skipped++ < resolvedBegin) {
+        iterator.next();
+      }
+      if (++iterations > sliceSize) {
+        return iteratorDone();
+      }
+      var step = iterator.next();
+      if (useKeys || type === ITERATE_VALUES || step.done) {
+        return step;
+      }
+      if (type === ITERATE_KEYS) {
+        return iteratorValue(type, iterations - 1, undefined, step);
+      }
+      return iteratorValue(type, iterations - 1, step.value[1], step);
+    });
+  };
+
+  return sliceSeq;
+}
+
+function takeWhileFactory(collection, predicate, context) {
+  var takeSequence = makeSequence(collection);
+  takeSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var iterations = 0;
+    collection.__iterate(
+      function (v, k, c) { return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$1); }
+    );
+    return iterations;
+  };
+  takeSequence.__iteratorUncached = function(type, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
+    var iterating = true;
+    return new Iterator(function () {
+      if (!iterating) {
+        return iteratorDone();
+      }
+      var step = iterator.next();
+      if (step.done) {
+        return step;
+      }
+      var entry = step.value;
+      var k = entry[0];
+      var v = entry[1];
+      if (!predicate.call(context, v, k, this$1)) {
+        iterating = false;
+        return iteratorDone();
+      }
+      return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);
+    });
+  };
+  return takeSequence;
+}
+
+function skipWhileFactory(collection, predicate, context, useKeys) {
+  var skipSequence = makeSequence(collection);
+  skipSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var isSkipping = true;
+    var iterations = 0;
+    collection.__iterate(function (v, k, c) {
+      if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {
+        iterations++;
+        return fn(v, useKeys ? k : iterations - 1, this$1);
+      }
+    });
+    return iterations;
+  };
+  skipSequence.__iteratorUncached = function(type, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
+    var skipping = true;
+    var iterations = 0;
+    return new Iterator(function () {
+      var step;
+      var k;
+      var v;
+      do {
+        step = iterator.next();
+        if (step.done) {
+          if (useKeys || type === ITERATE_VALUES) {
+            return step;
+          }
+          if (type === ITERATE_KEYS) {
+            return iteratorValue(type, iterations++, undefined, step);
+          }
+          return iteratorValue(type, iterations++, step.value[1], step);
+        }
+        var entry = step.value;
+        k = entry[0];
+        v = entry[1];
+        skipping && (skipping = predicate.call(context, v, k, this$1));
+      } while (skipping);
+      return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);
+    });
+  };
+  return skipSequence;
+}
+
+function concatFactory(collection, values) {
+  var isKeyedCollection = isKeyed(collection);
+  var iters = [collection]
+    .concat(values)
+    .map(function (v) {
+      if (!isCollection(v)) {
+        v = isKeyedCollection
+          ? keyedSeqFromValue(v)
+          : indexedSeqFromValue(Array.isArray(v) ? v : [v]);
+      } else if (isKeyedCollection) {
+        v = KeyedCollection(v);
+      }
+      return v;
+    })
+    .filter(function (v) { return v.size !== 0; });
+
+  if (iters.length === 0) {
+    return collection;
+  }
+
+  if (iters.length === 1) {
+    var singleton = iters[0];
+    if (
+      singleton === collection ||
+      (isKeyedCollection && isKeyed(singleton)) ||
+      (isIndexed(collection) && isIndexed(singleton))
+    ) {
+      return singleton;
+    }
+  }
+
+  var concatSeq = new ArraySeq(iters);
+  if (isKeyedCollection) {
+    concatSeq = concatSeq.toKeyedSeq();
+  } else if (!isIndexed(collection)) {
+    concatSeq = concatSeq.toSetSeq();
+  }
+  concatSeq = concatSeq.flatten(true);
+  concatSeq.size = iters.reduce(function (sum, seq) {
+    if (sum !== undefined) {
+      var size = seq.size;
+      if (size !== undefined) {
+        return sum + size;
+      }
+    }
+  }, 0);
+  return concatSeq;
+}
+
+function flattenFactory(collection, depth, useKeys) {
+  var flatSequence = makeSequence(collection);
+  flatSequence.__iterateUncached = function(fn, reverse) {
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var iterations = 0;
+    var stopped = false;
+    function flatDeep(iter, currentDepth) {
+      iter.__iterate(function (v, k) {
+        if ((!depth || currentDepth < depth) && isCollection(v)) {
+          flatDeep(v, currentDepth + 1);
+        } else {
+          iterations++;
+          if (fn(v, useKeys ? k : iterations - 1, flatSequence) === false) {
+            stopped = true;
+          }
+        }
+        return !stopped;
+      }, reverse);
+    }
+    flatDeep(collection, 0);
+    return iterations;
+  };
+  flatSequence.__iteratorUncached = function(type, reverse) {
+    if (reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    var iterator = collection.__iterator(type, reverse);
+    var stack = [];
+    var iterations = 0;
+    return new Iterator(function () {
+      while (iterator) {
+        var step = iterator.next();
+        if (step.done !== false) {
+          iterator = stack.pop();
+          continue;
+        }
+        var v = step.value;
+        if (type === ITERATE_ENTRIES) {
+          v = v[1];
+        }
+        if ((!depth || stack.length < depth) && isCollection(v)) {
+          stack.push(iterator);
+          iterator = v.__iterator(type, reverse);
+        } else {
+          return useKeys ? step : iteratorValue(type, iterations++, v, step);
+        }
+      }
+      return iteratorDone();
+    });
+  };
+  return flatSequence;
+}
+
+function flatMapFactory(collection, mapper, context) {
+  var coerce = collectionClass(collection);
+  return collection
+    .toSeq()
+    .map(function (v, k) { return coerce(mapper.call(context, v, k, collection)); })
+    .flatten(true);
+}
+
+function interposeFactory(collection, separator) {
+  var interposedSequence = makeSequence(collection);
+  interposedSequence.size = collection.size && collection.size * 2 - 1;
+  interposedSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    var iterations = 0;
+    collection.__iterate(
+      function (v) { return (!iterations || fn(separator, iterations++, this$1) !== false) &&
+        fn(v, iterations++, this$1) !== false; },
+      reverse
+    );
+    return iterations;
+  };
+  interposedSequence.__iteratorUncached = function(type, reverse) {
+    var iterator = collection.__iterator(ITERATE_VALUES, reverse);
+    var iterations = 0;
+    var step;
+    return new Iterator(function () {
+      if (!step || iterations % 2) {
+        step = iterator.next();
+        if (step.done) {
+          return step;
+        }
+      }
+      return iterations % 2
+        ? iteratorValue(type, iterations++, separator)
+        : iteratorValue(type, iterations++, step.value, step);
+    });
+  };
+  return interposedSequence;
+}
+
+function sortFactory(collection, comparator, mapper) {
+  if (!comparator) {
+    comparator = defaultComparator;
+  }
+  var isKeyedCollection = isKeyed(collection);
+  var index = 0;
+  var entries = collection
+    .toSeq()
+    .map(function (v, k) { return [k, v, index++, mapper ? mapper(v, k, collection) : v]; })
+    .valueSeq()
+    .toArray();
+  entries.sort(function (a, b) { return comparator(a[3], b[3]) || a[2] - b[2]; }).forEach(
+    isKeyedCollection
+      ? function (v, i) {
+          entries[i].length = 2;
+        }
+      : function (v, i) {
+          entries[i] = v[1];
+        }
+  );
+  return isKeyedCollection
+    ? KeyedSeq(entries)
+    : isIndexed(collection)
+      ? IndexedSeq(entries)
+      : SetSeq(entries);
+}
+
+function maxFactory(collection, comparator, mapper) {
+  if (!comparator) {
+    comparator = defaultComparator;
+  }
+  if (mapper) {
+    var entry = collection
+      .toSeq()
+      .map(function (v, k) { return [v, mapper(v, k, collection)]; })
+      .reduce(function (a, b) { return (maxCompare(comparator, a[1], b[1]) ? b : a); });
+    return entry && entry[0];
+  }
+  return collection.reduce(function (a, b) { return (maxCompare(comparator, a, b) ? b : a); });
+}
+
+function maxCompare(comparator, a, b) {
+  var comp = comparator(b, a);
+  // b is considered the new max if the comparator declares them equal, but
+  // they are not equal and b is in fact a nullish value.
+  return (
+    (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) ||
+    comp > 0
+  );
+}
+
+function zipWithFactory(keyIter, zipper, iters, zipAll) {
+  var zipSequence = makeSequence(keyIter);
+  var sizes = new ArraySeq(iters).map(function (i) { return i.size; });
+  zipSequence.size = zipAll ? sizes.max() : sizes.min();
+  // Note: this a generic base implementation of __iterate in terms of
+  // __iterator which may be more generically useful in the future.
+  zipSequence.__iterate = function(fn, reverse) {
+    /* generic:
+    var iterator = this.__iterator(ITERATE_ENTRIES, reverse);
+    var step;
+    var iterations = 0;
+    while (!(step = iterator.next()).done) {
+      iterations++;
+      if (fn(step.value[1], step.value[0], this) === false) {
+        break;
+      }
+    }
+    return iterations;
+    */
+    // indexed:
+    var iterator = this.__iterator(ITERATE_VALUES, reverse);
+    var step;
+    var iterations = 0;
+    while (!(step = iterator.next()).done) {
+      if (fn(step.value, iterations++, this) === false) {
+        break;
+      }
+    }
+    return iterations;
+  };
+  zipSequence.__iteratorUncached = function(type, reverse) {
+    var iterators = iters.map(
+      function (i) { return ((i = Collection(i)), getIterator(reverse ? i.reverse() : i)); }
+    );
+    var iterations = 0;
+    var isDone = false;
+    return new Iterator(function () {
+      var steps;
+      if (!isDone) {
+        steps = iterators.map(function (i) { return i.next(); });
+        isDone = zipAll ? steps.every(function (s) { return s.done; }) : steps.some(function (s) { return s.done; });
+      }
+      if (isDone) {
+        return iteratorDone();
+      }
+      return iteratorValue(
+        type,
+        iterations++,
+        zipper.apply(null, steps.map(function (s) { return s.value; }))
+      );
+    });
+  };
+  return zipSequence;
+}
+
+// #pragma Helper Functions
+
+function reify(iter, seq) {
+  return iter === seq ? iter : isSeq(iter) ? seq : iter.constructor(seq);
+}
+
+function validateEntry(entry) {
+  if (entry !== Object(entry)) {
+    throw new TypeError('Expected [K, V] tuple: ' + entry);
+  }
+}
+
+function collectionClass(collection) {
+  return isKeyed(collection)
+    ? KeyedCollection
+    : isIndexed(collection)
+      ? IndexedCollection
+      : SetCollection;
+}
+
+function makeSequence(collection) {
+  return Object.create(
+    (isKeyed(collection)
+      ? KeyedSeq
+      : isIndexed(collection)
+        ? IndexedSeq
+        : SetSeq
+    ).prototype
+  );
+}
+
+function cacheResultThrough() {
+  if (this._iter.cacheResult) {
+    this._iter.cacheResult();
+    this.size = this._iter.size;
+    return this;
+  }
+  return Seq.prototype.cacheResult.call(this);
+}
+
+function defaultComparator(a, b) {
+  if (a === undefined && b === undefined) {
+    return 0;
+  }
+
+  if (a === undefined) {
+    return 1;
+  }
+
+  if (b === undefined) {
+    return -1;
+  }
+
+  return a > b ? 1 : a < b ? -1 : 0;
+}
+
+// http://jsperf.com/copy-array-inline
+function arrCopy(arr, offset) {
+  offset = offset || 0;
+  var len = Math.max(0, arr.length - offset);
+  var newArr = new Array(len);
+  for (var ii = 0; ii < len; ii++) {
+    newArr[ii] = arr[ii + offset];
+  }
+  return newArr;
+}
+
+function invariant(condition, error) {
+  if (!condition) { throw new Error(error); }
+}
+
+function assertNotInfinite(size) {
+  invariant(
+    size !== Infinity,
+    'Cannot perform this action with an infinite size.'
+  );
+}
+
+function coerceKeyPath(keyPath) {
+  if (isArrayLike(keyPath) && typeof keyPath !== 'string') {
+    return keyPath;
+  }
+  if (isOrdered(keyPath)) {
+    return keyPath.toArray();
+  }
+  throw new TypeError(
+    'Invalid keyPath: expected Ordered Collection or Array: ' + keyPath
+  );
+}
+
+function isPlainObj(value) {
+  return (
+    value &&
+    (typeof value.constructor !== 'function' ||
+      value.constructor.name === 'Object')
+  );
+}
+
+/**
+ * Returns true if the value is a potentially-persistent data structure, either
+ * provided by Immutable.js or a plain Array or Object.
+ */
+function isDataStructure(value) {
+  return (
+    typeof value === 'object' &&
+    (isImmutable(value) || Array.isArray(value) || isPlainObj(value))
+  );
+}
+
+/**
+ * Converts a value to a string, adding quotes if a string was provided.
+ */
+function quoteString(value) {
+  try {
+    return typeof value === 'string' ? JSON.stringify(value) : String(value);
+  } catch (_ignoreError) {
+    return JSON.stringify(value);
+  }
+}
+
+function has(collection, key) {
+  return isImmutable(collection)
+    ? collection.has(key)
+    : isDataStructure(collection) && hasOwnProperty.call(collection, key);
+}
+
+function get(collection, key, notSetValue) {
+  return isImmutable(collection)
+    ? collection.get(key, notSetValue)
+    : !has(collection, key)
+      ? notSetValue
+      : typeof collection.get === 'function'
+        ? collection.get(key)
+        : collection[key];
+}
+
+function shallowCopy(from) {
+  if (Array.isArray(from)) {
+    return arrCopy(from);
+  }
+  var to = {};
+  for (var key in from) {
+    if (hasOwnProperty.call(from, key)) {
+      to[key] = from[key];
+    }
+  }
+  return to;
+}
+
+function remove(collection, key) {
+  if (!isDataStructure(collection)) {
+    throw new TypeError(
+      'Cannot update non-data-structure value: ' + collection
+    );
+  }
+  if (isImmutable(collection)) {
+    if (!collection.remove) {
+      throw new TypeError(
+        'Cannot update immutable value without .remove() method: ' + collection
+      );
+    }
+    return collection.remove(key);
+  }
+  if (!hasOwnProperty.call(collection, key)) {
+    return collection;
+  }
+  var collectionCopy = shallowCopy(collection);
+  if (Array.isArray(collectionCopy)) {
+    collectionCopy.splice(key, 1);
+  } else {
+    delete collectionCopy[key];
+  }
+  return collectionCopy;
+}
+
+function set(collection, key, value) {
+  if (!isDataStructure(collection)) {
+    throw new TypeError(
+      'Cannot update non-data-structure value: ' + collection
+    );
+  }
+  if (isImmutable(collection)) {
+    if (!collection.set) {
+      throw new TypeError(
+        'Cannot update immutable value without .set() method: ' + collection
+      );
+    }
+    return collection.set(key, value);
+  }
+  if (hasOwnProperty.call(collection, key) && value === collection[key]) {
+    return collection;
+  }
+  var collectionCopy = shallowCopy(collection);
+  collectionCopy[key] = value;
+  return collectionCopy;
+}
+
+function updateIn(collection, keyPath, notSetValue, updater) {
+  if (!updater) {
+    updater = notSetValue;
+    notSetValue = undefined;
+  }
+  var updatedValue = updateInDeeply(
+    isImmutable(collection),
+    collection,
+    coerceKeyPath(keyPath),
+    0,
+    notSetValue,
+    updater
+  );
+  return updatedValue === NOT_SET ? notSetValue : updatedValue;
+}
+
+function updateInDeeply(
+  inImmutable,
+  existing,
+  keyPath,
+  i,
+  notSetValue,
+  updater
+) {
+  var wasNotSet = existing === NOT_SET;
+  if (i === keyPath.length) {
+    var existingValue = wasNotSet ? notSetValue : existing;
+    var newValue = updater(existingValue);
+    return newValue === existingValue ? existing : newValue;
+  }
+  if (!wasNotSet && !isDataStructure(existing)) {
+    throw new TypeError(
+      'Cannot update within non-data-structure value in path [' +
+        keyPath.slice(0, i).map(quoteString) +
+        ']: ' +
+        existing
+    );
+  }
+  var key = keyPath[i];
+  var nextExisting = wasNotSet ? NOT_SET : get(existing, key, NOT_SET);
+  var nextUpdated = updateInDeeply(
+    nextExisting === NOT_SET ? inImmutable : isImmutable(nextExisting),
+    nextExisting,
+    keyPath,
+    i + 1,
+    notSetValue,
+    updater
+  );
+  return nextUpdated === nextExisting
+    ? existing
+    : nextUpdated === NOT_SET
+      ? remove(existing, key)
+      : set(
+          wasNotSet ? (inImmutable ? emptyMap() : {}) : existing,
+          key,
+          nextUpdated
+        );
+}
+
+function setIn(collection, keyPath, value) {
+  return updateIn(collection, keyPath, NOT_SET, function () { return value; });
+}
+
+function setIn$1(keyPath, v) {
+  return setIn(this, keyPath, v);
+}
+
+function removeIn(collection, keyPath) {
+  return updateIn(collection, keyPath, function () { return NOT_SET; });
+}
+
+function deleteIn(keyPath) {
+  return removeIn(this, keyPath);
+}
+
+function update(collection, key, notSetValue, updater) {
+  return updateIn(collection, [key], notSetValue, updater);
+}
+
+function update$1(key, notSetValue, updater) {
+  return arguments.length === 1
+    ? key(this)
+    : update(this, key, notSetValue, updater);
+}
+
+function updateIn$1(keyPath, notSetValue, updater) {
+  return updateIn(this, keyPath, notSetValue, updater);
+}
+
+function merge() {
+  var iters = [], len = arguments.length;
+  while ( len-- ) iters[ len ] = arguments[ len ];
+
+  return mergeIntoKeyedWith(this, iters);
+}
+
+function mergeWith(merger) {
+  var iters = [], len = arguments.length - 1;
+  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
+
+  if (typeof merger !== 'function') {
+    throw new TypeError('Invalid merger function: ' + merger);
+  }
+  return mergeIntoKeyedWith(this, iters, merger);
+}
+
+function mergeIntoKeyedWith(collection, collections, merger) {
+  var iters = [];
+  for (var ii = 0; ii < collections.length; ii++) {
+    var collection$1 = KeyedCollection(collections[ii]);
+    if (collection$1.size !== 0) {
+      iters.push(collection$1);
+    }
+  }
+  if (iters.length === 0) {
+    return collection;
+  }
+  if (
+    collection.toSeq().size === 0 &&
+    !collection.__ownerID &&
+    iters.length === 1
+  ) {
+    return collection.constructor(iters[0]);
+  }
+  return collection.withMutations(function (collection) {
+    var mergeIntoCollection = merger
+      ? function (value, key) {
+          update(
+            collection,
+            key,
+            NOT_SET,
+            function (oldVal) { return (oldVal === NOT_SET ? value : merger(oldVal, value, key)); }
+          );
+        }
+      : function (value, key) {
+          collection.set(key, value);
+        };
+    for (var ii = 0; ii < iters.length; ii++) {
+      iters[ii].forEach(mergeIntoCollection);
+    }
+  });
+}
+
+function merge$1(collection) {
+  var sources = [], len = arguments.length - 1;
+  while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
+
+  return mergeWithSources(collection, sources);
+}
+
+function mergeWith$1(merger, collection) {
+  var sources = [], len = arguments.length - 2;
+  while ( len-- > 0 ) sources[ len ] = arguments[ len + 2 ];
+
+  return mergeWithSources(collection, sources, merger);
+}
+
+function mergeDeep(collection) {
+  var sources = [], len = arguments.length - 1;
+  while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
+
+  return mergeDeepWithSources(collection, sources);
+}
+
+function mergeDeepWith(merger, collection) {
+  var sources = [], len = arguments.length - 2;
+  while ( len-- > 0 ) sources[ len ] = arguments[ len + 2 ];
+
+  return mergeDeepWithSources(collection, sources, merger);
+}
+
+function mergeDeepWithSources(collection, sources, merger) {
+  return mergeWithSources(collection, sources, deepMergerWith(merger));
+}
+
+function mergeWithSources(collection, sources, merger) {
+  if (!isDataStructure(collection)) {
+    throw new TypeError(
+      'Cannot merge into non-data-structure value: ' + collection
+    );
+  }
+  if (isImmutable(collection)) {
+    return typeof merger === 'function' && collection.mergeWith
+      ? collection.mergeWith.apply(collection, [ merger ].concat( sources ))
+      : collection.merge
+        ? collection.merge.apply(collection, sources)
+        : collection.concat.apply(collection, sources);
+  }
+  var isArray = Array.isArray(collection);
+  var merged = collection;
+  var Collection$$1 = isArray ? IndexedCollection : KeyedCollection;
+  var mergeItem = isArray
+    ? function (value) {
+        // Copy on write
+        if (merged === collection) {
+          merged = shallowCopy(merged);
+        }
+        merged.push(value);
+      }
+    : function (value, key) {
+        var hasVal = hasOwnProperty.call(merged, key);
+        var nextVal =
+          hasVal && merger ? merger(merged[key], value, key) : value;
+        if (!hasVal || nextVal !== merged[key]) {
+          // Copy on write
+          if (merged === collection) {
+            merged = shallowCopy(merged);
+          }
+          merged[key] = nextVal;
+        }
+      };
+  for (var i = 0; i < sources.length; i++) {
+    Collection$$1(sources[i]).forEach(mergeItem);
+  }
+  return merged;
+}
+
+function deepMergerWith(merger) {
+  function deepMerger(oldValue, newValue, key) {
+    return isDataStructure(oldValue) && isDataStructure(newValue)
+      ? mergeWithSources(oldValue, [newValue], deepMerger)
+      : merger
+        ? merger(oldValue, newValue, key)
+        : newValue;
+  }
+  return deepMerger;
+}
+
+function mergeDeep$1() {
+  var iters = [], len = arguments.length;
+  while ( len-- ) iters[ len ] = arguments[ len ];
+
+  return mergeDeepWithSources(this, iters);
+}
+
+function mergeDeepWith$1(merger) {
+  var iters = [], len = arguments.length - 1;
+  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
+
+  return mergeDeepWithSources(this, iters, merger);
+}
+
+function mergeIn(keyPath) {
+  var iters = [], len = arguments.length - 1;
+  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
+
+  return updateIn(this, keyPath, emptyMap(), function (m) { return mergeWithSources(m, iters); });
+}
+
+function mergeDeepIn(keyPath) {
+  var iters = [], len = arguments.length - 1;
+  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
+
+  return updateIn(this, keyPath, emptyMap(), function (m) { return mergeDeepWithSources(m, iters); }
+  );
+}
+
+function withMutations(fn) {
+  var mutable = this.asMutable();
+  fn(mutable);
+  return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this;
+}
+
+function asMutable() {
+  return this.__ownerID ? this : this.__ensureOwner(new OwnerID());
+}
+
+function asImmutable() {
+  return this.__ensureOwner();
+}
+
+function wasAltered() {
+  return this.__altered;
+}
+
+var Map = /*@__PURE__*/(function (KeyedCollection$$1) {
+  function Map(value) {
+    return value === null || value === undefined
+      ? emptyMap()
+      : isMap(value) && !isOrdered(value)
+        ? value
+        : emptyMap().withMutations(function (map) {
+            var iter = KeyedCollection$$1(value);
+            assertNotInfinite(iter.size);
+            iter.forEach(function (v, k) { return map.set(k, v); });
+          });
+  }
+
+  if ( KeyedCollection$$1 ) Map.__proto__ = KeyedCollection$$1;
+  Map.prototype = Object.create( KeyedCollection$$1 && KeyedCollection$$1.prototype );
+  Map.prototype.constructor = Map;
+
+  Map.of = function of () {
+    var keyValues = [], len = arguments.length;
+    while ( len-- ) keyValues[ len ] = arguments[ len ];
+
+    return emptyMap().withMutations(function (map) {
+      for (var i = 0; i < keyValues.length; i += 2) {
+        if (i + 1 >= keyValues.length) {
+          throw new Error('Missing value for key: ' + keyValues[i]);
+        }
+        map.set(keyValues[i], keyValues[i + 1]);
+      }
+    });
+  };
+
+  Map.prototype.toString = function toString () {
+    return this.__toString('Map {', '}');
+  };
+
+  // @pragma Access
+
+  Map.prototype.get = function get (k, notSetValue) {
+    return this._root
+      ? this._root.get(0, undefined, k, notSetValue)
+      : notSetValue;
+  };
+
+  // @pragma Modification
+
+  Map.prototype.set = function set (k, v) {
+    return updateMap(this, k, v);
+  };
+
+  Map.prototype.remove = function remove (k) {
+    return updateMap(this, k, NOT_SET);
+  };
+
+  Map.prototype.deleteAll = function deleteAll (keys) {
+    var collection = Collection(keys);
+
+    if (collection.size === 0) {
+      return this;
+    }
+
+    return this.withMutations(function (map) {
+      collection.forEach(function (key) { return map.remove(key); });
+    });
+  };
+
+  Map.prototype.clear = function clear () {
+    if (this.size === 0) {
+      return this;
+    }
+    if (this.__ownerID) {
+      this.size = 0;
+      this._root = null;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return emptyMap();
+  };
+
+  // @pragma Composition
+
+  Map.prototype.sort = function sort (comparator) {
+    // Late binding
+    return OrderedMap(sortFactory(this, comparator));
+  };
+
+  Map.prototype.sortBy = function sortBy (mapper, comparator) {
+    // Late binding
+    return OrderedMap(sortFactory(this, comparator, mapper));
+  };
+
+  Map.prototype.map = function map (mapper, context) {
+    return this.withMutations(function (map) {
+      map.forEach(function (value, key) {
+        map.set(key, mapper.call(context, value, key, map));
+      });
+    });
+  };
+
+  // @pragma Mutability
+
+  Map.prototype.__iterator = function __iterator (type, reverse) {
+    return new MapIterator(this, type, reverse);
+  };
+
+  Map.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    var iterations = 0;
+    this._root &&
+      this._root.iterate(function (entry) {
+        iterations++;
+        return fn(entry[1], entry[0], this$1);
+      }, reverse);
+    return iterations;
+  };
+
+  Map.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    if (!ownerID) {
+      if (this.size === 0) {
+        return emptyMap();
+      }
+      this.__ownerID = ownerID;
+      this.__altered = false;
+      return this;
+    }
+    return makeMap(this.size, this._root, ownerID, this.__hash);
+  };
+
+  return Map;
+}(KeyedCollection));
+
+Map.isMap = isMap;
+
+var MapPrototype = Map.prototype;
+MapPrototype[IS_MAP_SYMBOL] = true;
+MapPrototype[DELETE] = MapPrototype.remove;
+MapPrototype.removeAll = MapPrototype.deleteAll;
+MapPrototype.setIn = setIn$1;
+MapPrototype.removeIn = MapPrototype.deleteIn = deleteIn;
+MapPrototype.update = update$1;
+MapPrototype.updateIn = updateIn$1;
+MapPrototype.merge = MapPrototype.concat = merge;
+MapPrototype.mergeWith = mergeWith;
+MapPrototype.mergeDeep = mergeDeep$1;
+MapPrototype.mergeDeepWith = mergeDeepWith$1;
+MapPrototype.mergeIn = mergeIn;
+MapPrototype.mergeDeepIn = mergeDeepIn;
+MapPrototype.withMutations = withMutations;
+MapPrototype.wasAltered = wasAltered;
+MapPrototype.asImmutable = asImmutable;
+MapPrototype['@@transducer/init'] = MapPrototype.asMutable = asMutable;
+MapPrototype['@@transducer/step'] = function(result, arr) {
+  return result.set(arr[0], arr[1]);
+};
+MapPrototype['@@transducer/result'] = function(obj) {
+  return obj.asImmutable();
+};
+
+// #pragma Trie Nodes
+
+var ArrayMapNode = function ArrayMapNode(ownerID, entries) {
+  this.ownerID = ownerID;
+  this.entries = entries;
+};
+
+ArrayMapNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  var entries = this.entries;
+  for (var ii = 0, len = entries.length; ii < len; ii++) {
+    if (is(key, entries[ii][0])) {
+      return entries[ii][1];
+    }
+  }
+  return notSetValue;
+};
+
+ArrayMapNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  var removed = value === NOT_SET;
+
+  var entries = this.entries;
+  var idx = 0;
+  var len = entries.length;
+  for (; idx < len; idx++) {
+    if (is(key, entries[idx][0])) {
+      break;
+    }
+  }
+  var exists = idx < len;
+
+  if (exists ? entries[idx][1] === value : removed) {
+    return this;
+  }
+
+  SetRef(didAlter);
+  (removed || !exists) && SetRef(didChangeSize);
+
+  if (removed && entries.length === 1) {
+    return; // undefined
+  }
+
+  if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) {
+    return createNodes(ownerID, entries, key, value);
+  }
+
+  var isEditable = ownerID && ownerID === this.ownerID;
+  var newEntries = isEditable ? entries : arrCopy(entries);
+
+  if (exists) {
+    if (removed) {
+      idx === len - 1
+        ? newEntries.pop()
+        : (newEntries[idx] = newEntries.pop());
+    } else {
+      newEntries[idx] = [key, value];
+    }
+  } else {
+    newEntries.push([key, value]);
+  }
+
+  if (isEditable) {
+    this.entries = newEntries;
+    return this;
+  }
+
+  return new ArrayMapNode(ownerID, newEntries);
+};
+
+var BitmapIndexedNode = function BitmapIndexedNode(ownerID, bitmap, nodes) {
+  this.ownerID = ownerID;
+  this.bitmap = bitmap;
+  this.nodes = nodes;
+};
+
+BitmapIndexedNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+  var bit = 1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK);
+  var bitmap = this.bitmap;
+  return (bitmap & bit) === 0
+    ? notSetValue
+    : this.nodes[popCount(bitmap & (bit - 1))].get(
+        shift + SHIFT,
+        keyHash,
+        key,
+        notSetValue
+      );
+};
+
+BitmapIndexedNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+  var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
+  var bit = 1 << keyHashFrag;
+  var bitmap = this.bitmap;
+  var exists = (bitmap & bit) !== 0;
+
+  if (!exists && value === NOT_SET) {
+    return this;
+  }
+
+  var idx = popCount(bitmap & (bit - 1));
+  var nodes = this.nodes;
+  var node = exists ? nodes[idx] : undefined;
+  var newNode = updateNode(
+    node,
+    ownerID,
+    shift + SHIFT,
+    keyHash,
+    key,
+    value,
+    didChangeSize,
+    didAlter
+  );
+
+  if (newNode === node) {
+    return this;
+  }
+
+  if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {
+    return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode);
+  }
+
+  if (
+    exists &&
+    !newNode &&
+    nodes.length === 2 &&
+    isLeafNode(nodes[idx ^ 1])
+  ) {
+    return nodes[idx ^ 1];
+  }
+
+  if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) {
+    return newNode;
+  }
+
+  var isEditable = ownerID && ownerID === this.ownerID;
+  var newBitmap = exists ? (newNode ? bitmap : bitmap ^ bit) : bitmap | bit;
+  var newNodes = exists
+    ? newNode
+      ? setAt(nodes, idx, newNode, isEditable)
+      : spliceOut(nodes, idx, isEditable)
+    : spliceIn(nodes, idx, newNode, isEditable);
+
+  if (isEditable) {
+    this.bitmap = newBitmap;
+    this.nodes = newNodes;
+    return this;
+  }
+
+  return new BitmapIndexedNode(ownerID, newBitmap, newNodes);
+};
+
+var HashArrayMapNode = function HashArrayMapNode(ownerID, count, nodes) {
+  this.ownerID = ownerID;
+  this.count = count;
+  this.nodes = nodes;
+};
+
+HashArrayMapNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+  var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
+  var node = this.nodes[idx];
+  return node
+    ? node.get(shift + SHIFT, keyHash, key, notSetValue)
+    : notSetValue;
+};
+
+HashArrayMapNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+  var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
+  var removed = value === NOT_SET;
+  var nodes = this.nodes;
+  var node = nodes[idx];
+
+  if (removed && !node) {
+    return this;
+  }
+
+  var newNode = updateNode(
+    node,
+    ownerID,
+    shift + SHIFT,
+    keyHash,
+    key,
+    value,
+    didChangeSize,
+    didAlter
+  );
+  if (newNode === node) {
+    return this;
+  }
+
+  var newCount = this.count;
+  if (!node) {
+    newCount++;
+  } else if (!newNode) {
+    newCount--;
+    if (newCount < MIN_HASH_ARRAY_MAP_SIZE) {
+      return packNodes(ownerID, nodes, newCount, idx);
+    }
+  }
+
+  var isEditable = ownerID && ownerID === this.ownerID;
+  var newNodes = setAt(nodes, idx, newNode, isEditable);
+
+  if (isEditable) {
+    this.count = newCount;
+    this.nodes = newNodes;
+    return this;
+  }
+
+  return new HashArrayMapNode(ownerID, newCount, newNodes);
+};
+
+var HashCollisionNode = function HashCollisionNode(ownerID, keyHash, entries) {
+  this.ownerID = ownerID;
+  this.keyHash = keyHash;
+  this.entries = entries;
+};
+
+HashCollisionNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  var entries = this.entries;
+  for (var ii = 0, len = entries.length; ii < len; ii++) {
+    if (is(key, entries[ii][0])) {
+      return entries[ii][1];
+    }
+  }
+  return notSetValue;
+};
+
+HashCollisionNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+
+  var removed = value === NOT_SET;
+
+  if (keyHash !== this.keyHash) {
+    if (removed) {
+      return this;
+    }
+    SetRef(didAlter);
+    SetRef(didChangeSize);
+    return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]);
+  }
+
+  var entries = this.entries;
+  var idx = 0;
+  var len = entries.length;
+  for (; idx < len; idx++) {
+    if (is(key, entries[idx][0])) {
+      break;
+    }
+  }
+  var exists = idx < len;
+
+  if (exists ? entries[idx][1] === value : removed) {
+    return this;
+  }
+
+  SetRef(didAlter);
+  (removed || !exists) && SetRef(didChangeSize);
+
+  if (removed && len === 2) {
+    return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]);
+  }
+
+  var isEditable = ownerID && ownerID === this.ownerID;
+  var newEntries = isEditable ? entries : arrCopy(entries);
+
+  if (exists) {
+    if (removed) {
+      idx === len - 1
+        ? newEntries.pop()
+        : (newEntries[idx] = newEntries.pop());
+    } else {
+      newEntries[idx] = [key, value];
+    }
+  } else {
+    newEntries.push([key, value]);
+  }
+
+  if (isEditable) {
+    this.entries = newEntries;
+    return this;
+  }
+
+  return new HashCollisionNode(ownerID, this.keyHash, newEntries);
+};
+
+var ValueNode = function ValueNode(ownerID, keyHash, entry) {
+  this.ownerID = ownerID;
+  this.keyHash = keyHash;
+  this.entry = entry;
+};
+
+ValueNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  return is(key, this.entry[0]) ? this.entry[1] : notSetValue;
+};
+
+ValueNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  var removed = value === NOT_SET;
+  var keyMatch = is(key, this.entry[0]);
+  if (keyMatch ? value === this.entry[1] : removed) {
+    return this;
+  }
+
+  SetRef(didAlter);
+
+  if (removed) {
+    SetRef(didChangeSize);
+    return; // undefined
+  }
+
+  if (keyMatch) {
+    if (ownerID && ownerID === this.ownerID) {
+      this.entry[1] = value;
+      return this;
+    }
+    return new ValueNode(ownerID, this.keyHash, [key, value]);
+  }
+
+  SetRef(didChangeSize);
+  return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]);
+};
+
+// #pragma Iterators
+
+ArrayMapNode.prototype.iterate = HashCollisionNode.prototype.iterate = function(
+  fn,
+  reverse
+) {
+  var entries = this.entries;
+  for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {
+    if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {
+      return false;
+    }
+  }
+};
+
+BitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate = function(
+  fn,
+  reverse
+) {
+  var nodes = this.nodes;
+  for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {
+    var node = nodes[reverse ? maxIndex - ii : ii];
+    if (node && node.iterate(fn, reverse) === false) {
+      return false;
+    }
+  }
+};
+
+// eslint-disable-next-line no-unused-vars
+ValueNode.prototype.iterate = function(fn, reverse) {
+  return fn(this.entry);
+};
+
+var MapIterator = /*@__PURE__*/(function (Iterator$$1) {
+  function MapIterator(map, type, reverse) {
+    this._type = type;
+    this._reverse = reverse;
+    this._stack = map._root && mapIteratorFrame(map._root);
+  }
+
+  if ( Iterator$$1 ) MapIterator.__proto__ = Iterator$$1;
+  MapIterator.prototype = Object.create( Iterator$$1 && Iterator$$1.prototype );
+  MapIterator.prototype.constructor = MapIterator;
+
+  MapIterator.prototype.next = function next () {
+    var type = this._type;
+    var stack = this._stack;
+    while (stack) {
+      var node = stack.node;
+      var index = stack.index++;
+      var maxIndex = (void 0);
+      if (node.entry) {
+        if (index === 0) {
+          return mapIteratorValue(type, node.entry);
+        }
+      } else if (node.entries) {
+        maxIndex = node.entries.length - 1;
+        if (index <= maxIndex) {
+          return mapIteratorValue(
+            type,
+            node.entries[this._reverse ? maxIndex - index : index]
+          );
+        }
+      } else {
+        maxIndex = node.nodes.length - 1;
+        if (index <= maxIndex) {
+          var subNode = node.nodes[this._reverse ? maxIndex - index : index];
+          if (subNode) {
+            if (subNode.entry) {
+              return mapIteratorValue(type, subNode.entry);
+            }
+            stack = this._stack = mapIteratorFrame(subNode, stack);
+          }
+          continue;
+        }
+      }
+      stack = this._stack = this._stack.__prev;
+    }
+    return iteratorDone();
+  };
+
+  return MapIterator;
+}(Iterator));
+
+function mapIteratorValue(type, entry) {
+  return iteratorValue(type, entry[0], entry[1]);
+}
+
+function mapIteratorFrame(node, prev) {
+  return {
+    node: node,
+    index: 0,
+    __prev: prev,
+  };
+}
+
+function makeMap(size, root, ownerID, hash$$1) {
+  var map = Object.create(MapPrototype);
+  map.size = size;
+  map._root = root;
+  map.__ownerID = ownerID;
+  map.__hash = hash$$1;
+  map.__altered = false;
+  return map;
+}
+
+var EMPTY_MAP;
+function emptyMap() {
+  return EMPTY_MAP || (EMPTY_MAP = makeMap(0));
+}
+
+function updateMap(map, k, v) {
+  var newRoot;
+  var newSize;
+  if (!map._root) {
+    if (v === NOT_SET) {
+      return map;
+    }
+    newSize = 1;
+    newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]);
+  } else {
+    var didChangeSize = MakeRef();
+    var didAlter = MakeRef();
+    newRoot = updateNode(
+      map._root,
+      map.__ownerID,
+      0,
+      undefined,
+      k,
+      v,
+      didChangeSize,
+      didAlter
+    );
+    if (!didAlter.value) {
+      return map;
+    }
+    newSize = map.size + (didChangeSize.value ? (v === NOT_SET ? -1 : 1) : 0);
+  }
+  if (map.__ownerID) {
+    map.size = newSize;
+    map._root = newRoot;
+    map.__hash = undefined;
+    map.__altered = true;
+    return map;
+  }
+  return newRoot ? makeMap(newSize, newRoot) : emptyMap();
+}
+
+function updateNode(
+  node,
+  ownerID,
+  shift,
+  keyHash,
+  key,
+  value,
+  didChangeSize,
+  didAlter
+) {
+  if (!node) {
+    if (value === NOT_SET) {
+      return node;
+    }
+    SetRef(didAlter);
+    SetRef(didChangeSize);
+    return new ValueNode(ownerID, keyHash, [key, value]);
+  }
+  return node.update(
+    ownerID,
+    shift,
+    keyHash,
+    key,
+    value,
+    didChangeSize,
+    didAlter
+  );
+}
+
+function isLeafNode(node) {
+  return (
+    node.constructor === ValueNode || node.constructor === HashCollisionNode
+  );
+}
+
+function mergeIntoNode(node, ownerID, shift, keyHash, entry) {
+  if (node.keyHash === keyHash) {
+    return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]);
+  }
+
+  var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK;
+  var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
+
+  var newNode;
+  var nodes =
+    idx1 === idx2
+      ? [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)]
+      : ((newNode = new ValueNode(ownerID, keyHash, entry)),
+        idx1 < idx2 ? [node, newNode] : [newNode, node]);
+
+  return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes);
+}
+
+function createNodes(ownerID, entries, key, value) {
+  if (!ownerID) {
+    ownerID = new OwnerID();
+  }
+  var node = new ValueNode(ownerID, hash(key), [key, value]);
+  for (var ii = 0; ii < entries.length; ii++) {
+    var entry = entries[ii];
+    node = node.update(ownerID, 0, undefined, entry[0], entry[1]);
+  }
+  return node;
+}
+
+function packNodes(ownerID, nodes, count, excluding) {
+  var bitmap = 0;
+  var packedII = 0;
+  var packedNodes = new Array(count);
+  for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) {
+    var node = nodes[ii];
+    if (node !== undefined && ii !== excluding) {
+      bitmap |= bit;
+      packedNodes[packedII++] = node;
+    }
+  }
+  return new BitmapIndexedNode(ownerID, bitmap, packedNodes);
+}
+
+function expandNodes(ownerID, nodes, bitmap, including, node) {
+  var count = 0;
+  var expandedNodes = new Array(SIZE);
+  for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) {
+    expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined;
+  }
+  expandedNodes[including] = node;
+  return new HashArrayMapNode(ownerID, count + 1, expandedNodes);
+}
+
+function popCount(x) {
+  x -= (x >> 1) & 0x55555555;
+  x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
+  x = (x + (x >> 4)) & 0x0f0f0f0f;
+  x += x >> 8;
+  x += x >> 16;
+  return x & 0x7f;
+}
+
+function setAt(array, idx, val, canEdit) {
+  var newArray = canEdit ? array : arrCopy(array);
+  newArray[idx] = val;
+  return newArray;
+}
+
+function spliceIn(array, idx, val, canEdit) {
+  var newLen = array.length + 1;
+  if (canEdit && idx + 1 === newLen) {
+    array[idx] = val;
+    return array;
+  }
+  var newArray = new Array(newLen);
+  var after = 0;
+  for (var ii = 0; ii < newLen; ii++) {
+    if (ii === idx) {
+      newArray[ii] = val;
+      after = -1;
+    } else {
+      newArray[ii] = array[ii + after];
+    }
+  }
+  return newArray;
+}
+
+function spliceOut(array, idx, canEdit) {
+  var newLen = array.length - 1;
+  if (canEdit && idx === newLen) {
+    array.pop();
+    return array;
+  }
+  var newArray = new Array(newLen);
+  var after = 0;
+  for (var ii = 0; ii < newLen; ii++) {
+    if (ii === idx) {
+      after = 1;
+    }
+    newArray[ii] = array[ii + after];
+  }
+  return newArray;
+}
+
+var MAX_ARRAY_MAP_SIZE = SIZE / 4;
+var MAX_BITMAP_INDEXED_SIZE = SIZE / 2;
+var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;
+
+var IS_LIST_SYMBOL = '@@__IMMUTABLE_LIST__@@';
+
+function isList(maybeList) {
+  return Boolean(maybeList && maybeList[IS_LIST_SYMBOL]);
+}
+
+var List = /*@__PURE__*/(function (IndexedCollection$$1) {
+  function List(value) {
+    var empty = emptyList();
+    if (value === null || value === undefined) {
+      return empty;
+    }
+    if (isList(value)) {
+      return value;
+    }
+    var iter = IndexedCollection$$1(value);
+    var size = iter.size;
+    if (size === 0) {
+      return empty;
+    }
+    assertNotInfinite(size);
+    if (size > 0 && size < SIZE) {
+      return makeList(0, size, SHIFT, null, new VNode(iter.toArray()));
+    }
+    return empty.withMutations(function (list) {
+      list.setSize(size);
+      iter.forEach(function (v, i) { return list.set(i, v); });
+    });
+  }
+
+  if ( IndexedCollection$$1 ) List.__proto__ = IndexedCollection$$1;
+  List.prototype = Object.create( IndexedCollection$$1 && IndexedCollection$$1.prototype );
+  List.prototype.constructor = List;
+
+  List.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  List.prototype.toString = function toString () {
+    return this.__toString('List [', ']');
+  };
+
+  // @pragma Access
+
+  List.prototype.get = function get (index, notSetValue) {
+    index = wrapIndex(this, index);
+    if (index >= 0 && index < this.size) {
+      index += this._origin;
+      var node = listNodeFor(this, index);
+      return node && node.array[index & MASK];
+    }
+    return notSetValue;
+  };
+
+  // @pragma Modification
+
+  List.prototype.set = function set (index, value) {
+    return updateList(this, index, value);
+  };
+
+  List.prototype.remove = function remove (index) {
+    return !this.has(index)
+      ? this
+      : index === 0
+        ? this.shift()
+        : index === this.size - 1
+          ? this.pop()
+          : this.splice(index, 1);
+  };
+
+  List.prototype.insert = function insert (index, value) {
+    return this.splice(index, 0, value);
+  };
+
+  List.prototype.clear = function clear () {
+    if (this.size === 0) {
+      return this;
+    }
+    if (this.__ownerID) {
+      this.size = this._origin = this._capacity = 0;
+      this._level = SHIFT;
+      this._root = this._tail = null;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return emptyList();
+  };
+
+  List.prototype.push = function push (/*...values*/) {
+    var values = arguments;
+    var oldSize = this.size;
+    return this.withMutations(function (list) {
+      setListBounds(list, 0, oldSize + values.length);
+      for (var ii = 0; ii < values.length; ii++) {
+        list.set(oldSize + ii, values[ii]);
+      }
+    });
+  };
+
+  List.prototype.pop = function pop () {
+    return setListBounds(this, 0, -1);
+  };
+
+  List.prototype.unshift = function unshift (/*...values*/) {
+    var values = arguments;
+    return this.withMutations(function (list) {
+      setListBounds(list, -values.length);
+      for (var ii = 0; ii < values.length; ii++) {
+        list.set(ii, values[ii]);
+      }
+    });
+  };
+
+  List.prototype.shift = function shift () {
+    return setListBounds(this, 1);
+  };
+
+  // @pragma Composition
+
+  List.prototype.concat = function concat (/*...collections*/) {
+    var arguments$1 = arguments;
+
+    var seqs = [];
+    for (var i = 0; i < arguments.length; i++) {
+      var argument = arguments$1[i];
+      var seq = IndexedCollection$$1(
+        typeof argument !== 'string' && hasIterator(argument)
+          ? argument
+          : [argument]
+      );
+      if (seq.size !== 0) {
+        seqs.push(seq);
+      }
+    }
+    if (seqs.length === 0) {
+      return this;
+    }
+    if (this.size === 0 && !this.__ownerID && seqs.length === 1) {
+      return this.constructor(seqs[0]);
+    }
+    return this.withMutations(function (list) {
+      seqs.forEach(function (seq) { return seq.forEach(function (value) { return list.push(value); }); });
+    });
+  };
+
+  List.prototype.setSize = function setSize (size) {
+    return setListBounds(this, 0, size);
+  };
+
+  List.prototype.map = function map (mapper, context) {
+    var this$1 = this;
+
+    return this.withMutations(function (list) {
+      for (var i = 0; i < this$1.size; i++) {
+        list.set(i, mapper.call(context, list.get(i), i, list));
+      }
+    });
+  };
+
+  // @pragma Iteration
+
+  List.prototype.slice = function slice (begin, end) {
+    var size = this.size;
+    if (wholeSlice(begin, end, size)) {
+      return this;
+    }
+    return setListBounds(
+      this,
+      resolveBegin(begin, size),
+      resolveEnd(end, size)
+    );
+  };
+
+  List.prototype.__iterator = function __iterator (type, reverse) {
+    var index = reverse ? this.size : 0;
+    var values = iterateList(this, reverse);
+    return new Iterator(function () {
+      var value = values();
+      return value === DONE
+        ? iteratorDone()
+        : iteratorValue(type, reverse ? --index : index++, value);
+    });
+  };
+
+  List.prototype.__iterate = function __iterate (fn, reverse) {
+    var index = reverse ? this.size : 0;
+    var values = iterateList(this, reverse);
+    var value;
+    while ((value = values()) !== DONE) {
+      if (fn(value, reverse ? --index : index++, this) === false) {
+        break;
+      }
+    }
+    return index;
+  };
+
+  List.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    if (!ownerID) {
+      if (this.size === 0) {
+        return emptyList();
+      }
+      this.__ownerID = ownerID;
+      this.__altered = false;
+      return this;
+    }
+    return makeList(
+      this._origin,
+      this._capacity,
+      this._level,
+      this._root,
+      this._tail,
+      ownerID,
+      this.__hash
+    );
+  };
+
+  return List;
+}(IndexedCollection));
+
+List.isList = isList;
+
+var ListPrototype = List.prototype;
+ListPrototype[IS_LIST_SYMBOL] = true;
+ListPrototype[DELETE] = ListPrototype.remove;
+ListPrototype.merge = ListPrototype.concat;
+ListPrototype.setIn = setIn$1;
+ListPrototype.deleteIn = ListPrototype.removeIn = deleteIn;
+ListPrototype.update = update$1;
+ListPrototype.updateIn = updateIn$1;
+ListPrototype.mergeIn = mergeIn;
+ListPrototype.mergeDeepIn = mergeDeepIn;
+ListPrototype.withMutations = withMutations;
+ListPrototype.wasAltered = wasAltered;
+ListPrototype.asImmutable = asImmutable;
+ListPrototype['@@transducer/init'] = ListPrototype.asMutable = asMutable;
+ListPrototype['@@transducer/step'] = function(result, arr) {
+  return result.push(arr);
+};
+ListPrototype['@@transducer/result'] = function(obj) {
+  return obj.asImmutable();
+};
+
+var VNode = function VNode(array, ownerID) {
+  this.array = array;
+  this.ownerID = ownerID;
+};
+
+// TODO: seems like these methods are very similar
+
+VNode.prototype.removeBefore = function removeBefore (ownerID, level, index) {
+  if (index === level ? 1 << level : this.array.length === 0) {
+    return this;
+  }
+  var originIndex = (index >>> level) & MASK;
+  if (originIndex >= this.array.length) {
+    return new VNode([], ownerID);
+  }
+  var removingFirst = originIndex === 0;
+  var newChild;
+  if (level > 0) {
+    var oldChild = this.array[originIndex];
+    newChild =
+      oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index);
+    if (newChild === oldChild && removingFirst) {
+      return this;
+    }
+  }
+  if (removingFirst && !newChild) {
+    return this;
+  }
+  var editable = editableVNode(this, ownerID);
+  if (!removingFirst) {
+    for (var ii = 0; ii < originIndex; ii++) {
+      editable.array[ii] = undefined;
+    }
+  }
+  if (newChild) {
+    editable.array[originIndex] = newChild;
+  }
+  return editable;
+};
+
+VNode.prototype.removeAfter = function removeAfter (ownerID, level, index) {
+  if (index === (level ? 1 << level : 0) || this.array.length === 0) {
+    return this;
+  }
+  var sizeIndex = ((index - 1) >>> level) & MASK;
+  if (sizeIndex >= this.array.length) {
+    return this;
+  }
+
+  var newChild;
+  if (level > 0) {
+    var oldChild = this.array[sizeIndex];
+    newChild =
+      oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index);
+    if (newChild === oldChild && sizeIndex === this.array.length - 1) {
+      return this;
+    }
+  }
+
+  var editable = editableVNode(this, ownerID);
+  editable.array.splice(sizeIndex + 1);
+  if (newChild) {
+    editable.array[sizeIndex] = newChild;
+  }
+  return editable;
+};
+
+var DONE = {};
+
+function iterateList(list, reverse) {
+  var left = list._origin;
+  var right = list._capacity;
+  var tailPos = getTailOffset(right);
+  var tail = list._tail;
+
+  return iterateNodeOrLeaf(list._root, list._level, 0);
+
+  function iterateNodeOrLeaf(node, level, offset) {
+    return level === 0
+      ? iterateLeaf(node, offset)
+      : iterateNode(node, level, offset);
+  }
+
+  function iterateLeaf(node, offset) {
+    var array = offset === tailPos ? tail && tail.array : node && node.array;
+    var from = offset > left ? 0 : left - offset;
+    var to = right - offset;
+    if (to > SIZE) {
+      to = SIZE;
+    }
+    return function () {
+      if (from === to) {
+        return DONE;
+      }
+      var idx = reverse ? --to : from++;
+      return array && array[idx];
+    };
+  }
+
+  function iterateNode(node, level, offset) {
+    var values;
+    var array = node && node.array;
+    var from = offset > left ? 0 : (left - offset) >> level;
+    var to = ((right - offset) >> level) + 1;
+    if (to > SIZE) {
+      to = SIZE;
+    }
+    return function () {
+      while (true) {
+        if (values) {
+          var value = values();
+          if (value !== DONE) {
+            return value;
+          }
+          values = null;
+        }
+        if (from === to) {
+          return DONE;
+        }
+        var idx = reverse ? --to : from++;
+        values = iterateNodeOrLeaf(
+          array && array[idx],
+          level - SHIFT,
+          offset + (idx << level)
+        );
+      }
+    };
+  }
+}
+
+function makeList(origin, capacity, level, root, tail, ownerID, hash) {
+  var list = Object.create(ListPrototype);
+  list.size = capacity - origin;
+  list._origin = origin;
+  list._capacity = capacity;
+  list._level = level;
+  list._root = root;
+  list._tail = tail;
+  list.__ownerID = ownerID;
+  list.__hash = hash;
+  list.__altered = false;
+  return list;
+}
+
+var EMPTY_LIST;
+function emptyList() {
+  return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT));
+}
+
+function updateList(list, index, value) {
+  index = wrapIndex(list, index);
+
+  if (index !== index) {
+    return list;
+  }
+
+  if (index >= list.size || index < 0) {
+    return list.withMutations(function (list) {
+      index < 0
+        ? setListBounds(list, index).set(0, value)
+        : setListBounds(list, 0, index + 1).set(index, value);
+    });
+  }
+
+  index += list._origin;
+
+  var newTail = list._tail;
+  var newRoot = list._root;
+  var didAlter = MakeRef();
+  if (index >= getTailOffset(list._capacity)) {
+    newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter);
+  } else {
+    newRoot = updateVNode(
+      newRoot,
+      list.__ownerID,
+      list._level,
+      index,
+      value,
+      didAlter
+    );
+  }
+
+  if (!didAlter.value) {
+    return list;
+  }
+
+  if (list.__ownerID) {
+    list._root = newRoot;
+    list._tail = newTail;
+    list.__hash = undefined;
+    list.__altered = true;
+    return list;
+  }
+  return makeList(list._origin, list._capacity, list._level, newRoot, newTail);
+}
+
+function updateVNode(node, ownerID, level, index, value, didAlter) {
+  var idx = (index >>> level) & MASK;
+  var nodeHas = node && idx < node.array.length;
+  if (!nodeHas && value === undefined) {
+    return node;
+  }
+
+  var newNode;
+
+  if (level > 0) {
+    var lowerNode = node && node.array[idx];
+    var newLowerNode = updateVNode(
+      lowerNode,
+      ownerID,
+      level - SHIFT,
+      index,
+      value,
+      didAlter
+    );
+    if (newLowerNode === lowerNode) {
+      return node;
+    }
+    newNode = editableVNode(node, ownerID);
+    newNode.array[idx] = newLowerNode;
+    return newNode;
+  }
+
+  if (nodeHas && node.array[idx] === value) {
+    return node;
+  }
+
+  if (didAlter) {
+    SetRef(didAlter);
+  }
+
+  newNode = editableVNode(node, ownerID);
+  if (value === undefined && idx === newNode.array.length - 1) {
+    newNode.array.pop();
+  } else {
+    newNode.array[idx] = value;
+  }
+  return newNode;
+}
+
+function editableVNode(node, ownerID) {
+  if (ownerID && node && ownerID === node.ownerID) {
+    return node;
+  }
+  return new VNode(node ? node.array.slice() : [], ownerID);
+}
+
+function listNodeFor(list, rawIndex) {
+  if (rawIndex >= getTailOffset(list._capacity)) {
+    return list._tail;
+  }
+  if (rawIndex < 1 << (list._level + SHIFT)) {
+    var node = list._root;
+    var level = list._level;
+    while (node && level > 0) {
+      node = node.array[(rawIndex >>> level) & MASK];
+      level -= SHIFT;
+    }
+    return node;
+  }
+}
+
+function setListBounds(list, begin, end) {
+  // Sanitize begin & end using this shorthand for ToInt32(argument)
+  // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32
+  if (begin !== undefined) {
+    begin |= 0;
+  }
+  if (end !== undefined) {
+    end |= 0;
+  }
+  var owner = list.__ownerID || new OwnerID();
+  var oldOrigin = list._origin;
+  var oldCapacity = list._capacity;
+  var newOrigin = oldOrigin + begin;
+  var newCapacity =
+    end === undefined
+      ? oldCapacity
+      : end < 0
+        ? oldCapacity + end
+        : oldOrigin + end;
+  if (newOrigin === oldOrigin && newCapacity === oldCapacity) {
+    return list;
+  }
+
+  // If it's going to end after it starts, it's empty.
+  if (newOrigin >= newCapacity) {
+    return list.clear();
+  }
+
+  var newLevel = list._level;
+  var newRoot = list._root;
+
+  // New origin might need creating a higher root.
+  var offsetShift = 0;
+  while (newOrigin + offsetShift < 0) {
+    newRoot = new VNode(
+      newRoot && newRoot.array.length ? [undefined, newRoot] : [],
+      owner
+    );
+    newLevel += SHIFT;
+    offsetShift += 1 << newLevel;
+  }
+  if (offsetShift) {
+    newOrigin += offsetShift;
+    oldOrigin += offsetShift;
+    newCapacity += offsetShift;
+    oldCapacity += offsetShift;
+  }
+
+  var oldTailOffset = getTailOffset(oldCapacity);
+  var newTailOffset = getTailOffset(newCapacity);
+
+  // New size might need creating a higher root.
+  while (newTailOffset >= 1 << (newLevel + SHIFT)) {
+    newRoot = new VNode(
+      newRoot && newRoot.array.length ? [newRoot] : [],
+      owner
+    );
+    newLevel += SHIFT;
+  }
+
+  // Locate or create the new tail.
+  var oldTail = list._tail;
+  var newTail =
+    newTailOffset < oldTailOffset
+      ? listNodeFor(list, newCapacity - 1)
+      : newTailOffset > oldTailOffset
+        ? new VNode([], owner)
+        : oldTail;
+
+  // Merge Tail into tree.
+  if (
+    oldTail &&
+    newTailOffset > oldTailOffset &&
+    newOrigin < oldCapacity &&
+    oldTail.array.length
+  ) {
+    newRoot = editableVNode(newRoot, owner);
+    var node = newRoot;
+    for (var level = newLevel; level > SHIFT; level -= SHIFT) {
+      var idx = (oldTailOffset >>> level) & MASK;
+      node = node.array[idx] = editableVNode(node.array[idx], owner);
+    }
+    node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail;
+  }
+
+  // If the size has been reduced, there's a chance the tail needs to be trimmed.
+  if (newCapacity < oldCapacity) {
+    newTail = newTail && newTail.removeAfter(owner, 0, newCapacity);
+  }
+
+  // If the new origin is within the tail, then we do not need a root.
+  if (newOrigin >= newTailOffset) {
+    newOrigin -= newTailOffset;
+    newCapacity -= newTailOffset;
+    newLevel = SHIFT;
+    newRoot = null;
+    newTail = newTail && newTail.removeBefore(owner, 0, newOrigin);
+
+    // Otherwise, if the root has been trimmed, garbage collect.
+  } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) {
+    offsetShift = 0;
+
+    // Identify the new top root node of the subtree of the old root.
+    while (newRoot) {
+      var beginIndex = (newOrigin >>> newLevel) & MASK;
+      if ((beginIndex !== newTailOffset >>> newLevel) & MASK) {
+        break;
+      }
+      if (beginIndex) {
+        offsetShift += (1 << newLevel) * beginIndex;
+      }
+      newLevel -= SHIFT;
+      newRoot = newRoot.array[beginIndex];
+    }
+
+    // Trim the new sides of the new root.
+    if (newRoot && newOrigin > oldOrigin) {
+      newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift);
+    }
+    if (newRoot && newTailOffset < oldTailOffset) {
+      newRoot = newRoot.removeAfter(
+        owner,
+        newLevel,
+        newTailOffset - offsetShift
+      );
+    }
+    if (offsetShift) {
+      newOrigin -= offsetShift;
+      newCapacity -= offsetShift;
+    }
+  }
+
+  if (list.__ownerID) {
+    list.size = newCapacity - newOrigin;
+    list._origin = newOrigin;
+    list._capacity = newCapacity;
+    list._level = newLevel;
+    list._root = newRoot;
+    list._tail = newTail;
+    list.__hash = undefined;
+    list.__altered = true;
+    return list;
+  }
+  return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail);
+}
+
+function getTailOffset(size) {
+  return size < SIZE ? 0 : ((size - 1) >>> SHIFT) << SHIFT;
+}
+
+var OrderedMap = /*@__PURE__*/(function (Map$$1) {
+  function OrderedMap(value) {
+    return value === null || value === undefined
+      ? emptyOrderedMap()
+      : isOrderedMap(value)
+        ? value
+        : emptyOrderedMap().withMutations(function (map) {
+            var iter = KeyedCollection(value);
+            assertNotInfinite(iter.size);
+            iter.forEach(function (v, k) { return map.set(k, v); });
+          });
+  }
+
+  if ( Map$$1 ) OrderedMap.__proto__ = Map$$1;
+  OrderedMap.prototype = Object.create( Map$$1 && Map$$1.prototype );
+  OrderedMap.prototype.constructor = OrderedMap;
+
+  OrderedMap.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  OrderedMap.prototype.toString = function toString () {
+    return this.__toString('OrderedMap {', '}');
+  };
+
+  // @pragma Access
+
+  OrderedMap.prototype.get = function get (k, notSetValue) {
+    var index = this._map.get(k);
+    return index !== undefined ? this._list.get(index)[1] : notSetValue;
+  };
+
+  // @pragma Modification
+
+  OrderedMap.prototype.clear = function clear () {
+    if (this.size === 0) {
+      return this;
+    }
+    if (this.__ownerID) {
+      this.size = 0;
+      this._map.clear();
+      this._list.clear();
+      return this;
+    }
+    return emptyOrderedMap();
+  };
+
+  OrderedMap.prototype.set = function set (k, v) {
+    return updateOrderedMap(this, k, v);
+  };
+
+  OrderedMap.prototype.remove = function remove (k) {
+    return updateOrderedMap(this, k, NOT_SET);
+  };
+
+  OrderedMap.prototype.wasAltered = function wasAltered () {
+    return this._map.wasAltered() || this._list.wasAltered();
+  };
+
+  OrderedMap.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._list.__iterate(
+      function (entry) { return entry && fn(entry[1], entry[0], this$1); },
+      reverse
+    );
+  };
+
+  OrderedMap.prototype.__iterator = function __iterator (type, reverse) {
+    return this._list.fromEntrySeq().__iterator(type, reverse);
+  };
+
+  OrderedMap.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    var newMap = this._map.__ensureOwner(ownerID);
+    var newList = this._list.__ensureOwner(ownerID);
+    if (!ownerID) {
+      if (this.size === 0) {
+        return emptyOrderedMap();
+      }
+      this.__ownerID = ownerID;
+      this._map = newMap;
+      this._list = newList;
+      return this;
+    }
+    return makeOrderedMap(newMap, newList, ownerID, this.__hash);
+  };
+
+  return OrderedMap;
+}(Map));
+
+OrderedMap.isOrderedMap = isOrderedMap;
+
+OrderedMap.prototype[IS_ORDERED_SYMBOL] = true;
+OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove;
+
+function makeOrderedMap(map, list, ownerID, hash) {
+  var omap = Object.create(OrderedMap.prototype);
+  omap.size = map ? map.size : 0;
+  omap._map = map;
+  omap._list = list;
+  omap.__ownerID = ownerID;
+  omap.__hash = hash;
+  return omap;
+}
+
+var EMPTY_ORDERED_MAP;
+function emptyOrderedMap() {
+  return (
+    EMPTY_ORDERED_MAP ||
+    (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList()))
+  );
+}
+
+function updateOrderedMap(omap, k, v) {
+  var map = omap._map;
+  var list = omap._list;
+  var i = map.get(k);
+  var has = i !== undefined;
+  var newMap;
+  var newList;
+  if (v === NOT_SET) {
+    // removed
+    if (!has) {
+      return omap;
+    }
+    if (list.size >= SIZE && list.size >= map.size * 2) {
+      newList = list.filter(function (entry, idx) { return entry !== undefined && i !== idx; });
+      newMap = newList
+        .toKeyedSeq()
+        .map(function (entry) { return entry[0]; })
+        .flip()
+        .toMap();
+      if (omap.__ownerID) {
+        newMap.__ownerID = newList.__ownerID = omap.__ownerID;
+      }
+    } else {
+      newMap = map.remove(k);
+      newList = i === list.size - 1 ? list.pop() : list.set(i, undefined);
+    }
+  } else if (has) {
+    if (v === list.get(i)[1]) {
+      return omap;
+    }
+    newMap = map;
+    newList = list.set(i, [k, v]);
+  } else {
+    newMap = map.set(k, list.size);
+    newList = list.set(list.size, [k, v]);
+  }
+  if (omap.__ownerID) {
+    omap.size = newMap.size;
+    omap._map = newMap;
+    omap._list = newList;
+    omap.__hash = undefined;
+    return omap;
+  }
+  return makeOrderedMap(newMap, newList);
+}
+
+var IS_STACK_SYMBOL = '@@__IMMUTABLE_STACK__@@';
+
+function isStack(maybeStack) {
+  return Boolean(maybeStack && maybeStack[IS_STACK_SYMBOL]);
+}
+
+var Stack = /*@__PURE__*/(function (IndexedCollection$$1) {
+  function Stack(value) {
+    return value === null || value === undefined
+      ? emptyStack()
+      : isStack(value)
+        ? value
+        : emptyStack().pushAll(value);
+  }
+
+  if ( IndexedCollection$$1 ) Stack.__proto__ = IndexedCollection$$1;
+  Stack.prototype = Object.create( IndexedCollection$$1 && IndexedCollection$$1.prototype );
+  Stack.prototype.constructor = Stack;
+
+  Stack.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  Stack.prototype.toString = function toString () {
+    return this.__toString('Stack [', ']');
+  };
+
+  // @pragma Access
+
+  Stack.prototype.get = function get (index, notSetValue) {
+    var head = this._head;
+    index = wrapIndex(this, index);
+    while (head && index--) {
+      head = head.next;
+    }
+    return head ? head.value : notSetValue;
+  };
+
+  Stack.prototype.peek = function peek () {
+    return this._head && this._head.value;
+  };
+
+  // @pragma Modification
+
+  Stack.prototype.push = function push (/*...values*/) {
+    var arguments$1 = arguments;
+
+    if (arguments.length === 0) {
+      return this;
+    }
+    var newSize = this.size + arguments.length;
+    var head = this._head;
+    for (var ii = arguments.length - 1; ii >= 0; ii--) {
+      head = {
+        value: arguments$1[ii],
+        next: head,
+      };
+    }
+    if (this.__ownerID) {
+      this.size = newSize;
+      this._head = head;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return makeStack(newSize, head);
+  };
+
+  Stack.prototype.pushAll = function pushAll (iter) {
+    iter = IndexedCollection$$1(iter);
+    if (iter.size === 0) {
+      return this;
+    }
+    if (this.size === 0 && isStack(iter)) {
+      return iter;
+    }
+    assertNotInfinite(iter.size);
+    var newSize = this.size;
+    var head = this._head;
+    iter.__iterate(function (value) {
+      newSize++;
+      head = {
+        value: value,
+        next: head,
+      };
+    }, /* reverse */ true);
+    if (this.__ownerID) {
+      this.size = newSize;
+      this._head = head;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return makeStack(newSize, head);
+  };
+
+  Stack.prototype.pop = function pop () {
+    return this.slice(1);
+  };
+
+  Stack.prototype.clear = function clear () {
+    if (this.size === 0) {
+      return this;
+    }
+    if (this.__ownerID) {
+      this.size = 0;
+      this._head = undefined;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return emptyStack();
+  };
+
+  Stack.prototype.slice = function slice (begin, end) {
+    if (wholeSlice(begin, end, this.size)) {
+      return this;
+    }
+    var resolvedBegin = resolveBegin(begin, this.size);
+    var resolvedEnd = resolveEnd(end, this.size);
+    if (resolvedEnd !== this.size) {
+      // super.slice(begin, end);
+      return IndexedCollection$$1.prototype.slice.call(this, begin, end);
+    }
+    var newSize = this.size - resolvedBegin;
+    var head = this._head;
+    while (resolvedBegin--) {
+      head = head.next;
+    }
+    if (this.__ownerID) {
+      this.size = newSize;
+      this._head = head;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return makeStack(newSize, head);
+  };
+
+  // @pragma Mutability
+
+  Stack.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    if (!ownerID) {
+      if (this.size === 0) {
+        return emptyStack();
+      }
+      this.__ownerID = ownerID;
+      this.__altered = false;
+      return this;
+    }
+    return makeStack(this.size, this._head, ownerID, this.__hash);
+  };
+
+  // @pragma Iteration
+
+  Stack.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return new ArraySeq(this.toArray()).__iterate(
+        function (v, k) { return fn(v, k, this$1); },
+        reverse
+      );
+    }
+    var iterations = 0;
+    var node = this._head;
+    while (node) {
+      if (fn(node.value, iterations++, this) === false) {
+        break;
+      }
+      node = node.next;
+    }
+    return iterations;
+  };
+
+  Stack.prototype.__iterator = function __iterator (type, reverse) {
+    if (reverse) {
+      return new ArraySeq(this.toArray()).__iterator(type, reverse);
+    }
+    var iterations = 0;
+    var node = this._head;
+    return new Iterator(function () {
+      if (node) {
+        var value = node.value;
+        node = node.next;
+        return iteratorValue(type, iterations++, value);
+      }
+      return iteratorDone();
+    });
+  };
+
+  return Stack;
+}(IndexedCollection));
+
+Stack.isStack = isStack;
+
+var StackPrototype = Stack.prototype;
+StackPrototype[IS_STACK_SYMBOL] = true;
+StackPrototype.shift = StackPrototype.pop;
+StackPrototype.unshift = StackPrototype.push;
+StackPrototype.unshiftAll = StackPrototype.pushAll;
+StackPrototype.withMutations = withMutations;
+StackPrototype.wasAltered = wasAltered;
+StackPrototype.asImmutable = asImmutable;
+StackPrototype['@@transducer/init'] = StackPrototype.asMutable = asMutable;
+StackPrototype['@@transducer/step'] = function(result, arr) {
+  return result.unshift(arr);
+};
+StackPrototype['@@transducer/result'] = function(obj) {
+  return obj.asImmutable();
+};
+
+function makeStack(size, head, ownerID, hash) {
+  var map = Object.create(StackPrototype);
+  map.size = size;
+  map._head = head;
+  map.__ownerID = ownerID;
+  map.__hash = hash;
+  map.__altered = false;
+  return map;
+}
+
+var EMPTY_STACK;
+function emptyStack() {
+  return EMPTY_STACK || (EMPTY_STACK = makeStack(0));
+}
+
+var IS_SET_SYMBOL = '@@__IMMUTABLE_SET__@@';
+
+function isSet(maybeSet) {
+  return Boolean(maybeSet && maybeSet[IS_SET_SYMBOL]);
+}
+
+function isOrderedSet(maybeOrderedSet) {
+  return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);
+}
+
+function deepEqual(a, b) {
+  if (a === b) {
+    return true;
+  }
+
+  if (
+    !isCollection(b) ||
+    (a.size !== undefined && b.size !== undefined && a.size !== b.size) ||
+    (a.__hash !== undefined &&
+      b.__hash !== undefined &&
+      a.__hash !== b.__hash) ||
+    isKeyed(a) !== isKeyed(b) ||
+    isIndexed(a) !== isIndexed(b) ||
+    isOrdered(a) !== isOrdered(b)
+  ) {
+    return false;
+  }
+
+  if (a.size === 0 && b.size === 0) {
+    return true;
+  }
+
+  var notAssociative = !isAssociative(a);
+
+  if (isOrdered(a)) {
+    var entries = a.entries();
+    return (
+      b.every(function (v, k) {
+        var entry = entries.next().value;
+        return entry && is(entry[1], v) && (notAssociative || is(entry[0], k));
+      }) && entries.next().done
+    );
+  }
+
+  var flipped = false;
+
+  if (a.size === undefined) {
+    if (b.size === undefined) {
+      if (typeof a.cacheResult === 'function') {
+        a.cacheResult();
+      }
+    } else {
+      flipped = true;
+      var _ = a;
+      a = b;
+      b = _;
+    }
+  }
+
+  var allEqual = true;
+  var bSize = b.__iterate(function (v, k) {
+    if (
+      notAssociative
+        ? !a.has(v)
+        : flipped
+          ? !is(v, a.get(k, NOT_SET))
+          : !is(a.get(k, NOT_SET), v)
+    ) {
+      allEqual = false;
+      return false;
+    }
+  });
+
+  return allEqual && a.size === bSize;
+}
+
+/**
+ * Contributes additional methods to a constructor
+ */
+function mixin(ctor, methods) {
+  var keyCopier = function (key) {
+    ctor.prototype[key] = methods[key];
+  };
+  Object.keys(methods).forEach(keyCopier);
+  Object.getOwnPropertySymbols &&
+    Object.getOwnPropertySymbols(methods).forEach(keyCopier);
+  return ctor;
+}
+
+function toJS(value) {
+  if (!value || typeof value !== 'object') {
+    return value;
+  }
+  if (!isCollection(value)) {
+    if (!isDataStructure(value)) {
+      return value;
+    }
+    value = Seq(value);
+  }
+  if (isKeyed(value)) {
+    var result$1 = {};
+    value.__iterate(function (v, k) {
+      result$1[k] = toJS(v);
+    });
+    return result$1;
+  }
+  var result = [];
+  value.__iterate(function (v) {
+    result.push(toJS(v));
+  });
+  return result;
+}
+
+var Set = /*@__PURE__*/(function (SetCollection$$1) {
+  function Set(value) {
+    return value === null || value === undefined
+      ? emptySet()
+      : isSet(value) && !isOrdered(value)
+        ? value
+        : emptySet().withMutations(function (set) {
+            var iter = SetCollection$$1(value);
+            assertNotInfinite(iter.size);
+            iter.forEach(function (v) { return set.add(v); });
+          });
+  }
+
+  if ( SetCollection$$1 ) Set.__proto__ = SetCollection$$1;
+  Set.prototype = Object.create( SetCollection$$1 && SetCollection$$1.prototype );
+  Set.prototype.constructor = Set;
+
+  Set.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  Set.fromKeys = function fromKeys (value) {
+    return this(KeyedCollection(value).keySeq());
+  };
+
+  Set.intersect = function intersect (sets) {
+    sets = Collection(sets).toArray();
+    return sets.length
+      ? SetPrototype.intersect.apply(Set(sets.pop()), sets)
+      : emptySet();
+  };
+
+  Set.union = function union (sets) {
+    sets = Collection(sets).toArray();
+    return sets.length
+      ? SetPrototype.union.apply(Set(sets.pop()), sets)
+      : emptySet();
+  };
+
+  Set.prototype.toString = function toString () {
+    return this.__toString('Set {', '}');
+  };
+
+  // @pragma Access
+
+  Set.prototype.has = function has (value) {
+    return this._map.has(value);
+  };
+
+  // @pragma Modification
+
+  Set.prototype.add = function add (value) {
+    return updateSet(this, this._map.set(value, value));
+  };
+
+  Set.prototype.remove = function remove (value) {
+    return updateSet(this, this._map.remove(value));
+  };
+
+  Set.prototype.clear = function clear () {
+    return updateSet(this, this._map.clear());
+  };
+
+  // @pragma Composition
+
+  Set.prototype.map = function map (mapper, context) {
+    var this$1 = this;
+
+    var removes = [];
+    var adds = [];
+    this.forEach(function (value) {
+      var mapped = mapper.call(context, value, value, this$1);
+      if (mapped !== value) {
+        removes.push(value);
+        adds.push(mapped);
+      }
+    });
+    return this.withMutations(function (set) {
+      removes.forEach(function (value) { return set.remove(value); });
+      adds.forEach(function (value) { return set.add(value); });
+    });
+  };
+
+  Set.prototype.union = function union () {
+    var iters = [], len = arguments.length;
+    while ( len-- ) iters[ len ] = arguments[ len ];
+
+    iters = iters.filter(function (x) { return x.size !== 0; });
+    if (iters.length === 0) {
+      return this;
+    }
+    if (this.size === 0 && !this.__ownerID && iters.length === 1) {
+      return this.constructor(iters[0]);
+    }
+    return this.withMutations(function (set) {
+      for (var ii = 0; ii < iters.length; ii++) {
+        SetCollection$$1(iters[ii]).forEach(function (value) { return set.add(value); });
+      }
+    });
+  };
+
+  Set.prototype.intersect = function intersect () {
+    var iters = [], len = arguments.length;
+    while ( len-- ) iters[ len ] = arguments[ len ];
+
+    if (iters.length === 0) {
+      return this;
+    }
+    iters = iters.map(function (iter) { return SetCollection$$1(iter); });
+    var toRemove = [];
+    this.forEach(function (value) {
+      if (!iters.every(function (iter) { return iter.includes(value); })) {
+        toRemove.push(value);
+      }
+    });
+    return this.withMutations(function (set) {
+      toRemove.forEach(function (value) {
+        set.remove(value);
+      });
+    });
+  };
+
+  Set.prototype.subtract = function subtract () {
+    var iters = [], len = arguments.length;
+    while ( len-- ) iters[ len ] = arguments[ len ];
+
+    if (iters.length === 0) {
+      return this;
+    }
+    iters = iters.map(function (iter) { return SetCollection$$1(iter); });
+    var toRemove = [];
+    this.forEach(function (value) {
+      if (iters.some(function (iter) { return iter.includes(value); })) {
+        toRemove.push(value);
+      }
+    });
+    return this.withMutations(function (set) {
+      toRemove.forEach(function (value) {
+        set.remove(value);
+      });
+    });
+  };
+
+  Set.prototype.sort = function sort (comparator) {
+    // Late binding
+    return OrderedSet(sortFactory(this, comparator));
+  };
+
+  Set.prototype.sortBy = function sortBy (mapper, comparator) {
+    // Late binding
+    return OrderedSet(sortFactory(this, comparator, mapper));
+  };
+
+  Set.prototype.wasAltered = function wasAltered () {
+    return this._map.wasAltered();
+  };
+
+  Set.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._map.__iterate(function (k) { return fn(k, k, this$1); }, reverse);
+  };
+
+  Set.prototype.__iterator = function __iterator (type, reverse) {
+    return this._map.__iterator(type, reverse);
+  };
+
+  Set.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    var newMap = this._map.__ensureOwner(ownerID);
+    if (!ownerID) {
+      if (this.size === 0) {
+        return this.__empty();
+      }
+      this.__ownerID = ownerID;
+      this._map = newMap;
+      return this;
+    }
+    return this.__make(newMap, ownerID);
+  };
+
+  return Set;
+}(SetCollection));
+
+Set.isSet = isSet;
+
+var SetPrototype = Set.prototype;
+SetPrototype[IS_SET_SYMBOL] = true;
+SetPrototype[DELETE] = SetPrototype.remove;
+SetPrototype.merge = SetPrototype.concat = SetPrototype.union;
+SetPrototype.withMutations = withMutations;
+SetPrototype.asImmutable = asImmutable;
+SetPrototype['@@transducer/init'] = SetPrototype.asMutable = asMutable;
+SetPrototype['@@transducer/step'] = function(result, arr) {
+  return result.add(arr);
+};
+SetPrototype['@@transducer/result'] = function(obj) {
+  return obj.asImmutable();
+};
+
+SetPrototype.__empty = emptySet;
+SetPrototype.__make = makeSet;
+
+function updateSet(set, newMap) {
+  if (set.__ownerID) {
+    set.size = newMap.size;
+    set._map = newMap;
+    return set;
+  }
+  return newMap === set._map
+    ? set
+    : newMap.size === 0
+      ? set.__empty()
+      : set.__make(newMap);
+}
+
+function makeSet(map, ownerID) {
+  var set = Object.create(SetPrototype);
+  set.size = map ? map.size : 0;
+  set._map = map;
+  set.__ownerID = ownerID;
+  return set;
+}
+
+var EMPTY_SET;
+function emptySet() {
+  return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap()));
+}
+
+/**
+ * Returns a lazy seq of nums from start (inclusive) to end
+ * (exclusive), by step, where start defaults to 0, step to 1, and end to
+ * infinity. When start is equal to end, returns empty list.
+ */
+var Range = /*@__PURE__*/(function (IndexedSeq$$1) {
+  function Range(start, end, step) {
+    if (!(this instanceof Range)) {
+      return new Range(start, end, step);
+    }
+    invariant(step !== 0, 'Cannot step a Range by 0');
+    start = start || 0;
+    if (end === undefined) {
+      end = Infinity;
+    }
+    step = step === undefined ? 1 : Math.abs(step);
+    if (end < start) {
+      step = -step;
+    }
+    this._start = start;
+    this._end = end;
+    this._step = step;
+    this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);
+    if (this.size === 0) {
+      if (EMPTY_RANGE) {
+        return EMPTY_RANGE;
+      }
+      EMPTY_RANGE = this;
+    }
+  }
+
+  if ( IndexedSeq$$1 ) Range.__proto__ = IndexedSeq$$1;
+  Range.prototype = Object.create( IndexedSeq$$1 && IndexedSeq$$1.prototype );
+  Range.prototype.constructor = Range;
+
+  Range.prototype.toString = function toString () {
+    if (this.size === 0) {
+      return 'Range []';
+    }
+    return (
+      'Range [ ' +
+      this._start +
+      '...' +
+      this._end +
+      (this._step !== 1 ? ' by ' + this._step : '') +
+      ' ]'
+    );
+  };
+
+  Range.prototype.get = function get (index, notSetValue) {
+    return this.has(index)
+      ? this._start + wrapIndex(this, index) * this._step
+      : notSetValue;
+  };
+
+  Range.prototype.includes = function includes (searchValue) {
+    var possibleIndex = (searchValue - this._start) / this._step;
+    return (
+      possibleIndex >= 0 &&
+      possibleIndex < this.size &&
+      possibleIndex === Math.floor(possibleIndex)
+    );
+  };
+
+  Range.prototype.slice = function slice (begin, end) {
+    if (wholeSlice(begin, end, this.size)) {
+      return this;
+    }
+    begin = resolveBegin(begin, this.size);
+    end = resolveEnd(end, this.size);
+    if (end <= begin) {
+      return new Range(0, 0);
+    }
+    return new Range(
+      this.get(begin, this._end),
+      this.get(end, this._end),
+      this._step
+    );
+  };
+
+  Range.prototype.indexOf = function indexOf (searchValue) {
+    var offsetValue = searchValue - this._start;
+    if (offsetValue % this._step === 0) {
+      var index = offsetValue / this._step;
+      if (index >= 0 && index < this.size) {
+        return index;
+      }
+    }
+    return -1;
+  };
+
+  Range.prototype.lastIndexOf = function lastIndexOf (searchValue) {
+    return this.indexOf(searchValue);
+  };
+
+  Range.prototype.__iterate = function __iterate (fn, reverse) {
+    var size = this.size;
+    var step = this._step;
+    var value = reverse ? this._start + (size - 1) * step : this._start;
+    var i = 0;
+    while (i !== size) {
+      if (fn(value, reverse ? size - ++i : i++, this) === false) {
+        break;
+      }
+      value += reverse ? -step : step;
+    }
+    return i;
+  };
+
+  Range.prototype.__iterator = function __iterator (type, reverse) {
+    var size = this.size;
+    var step = this._step;
+    var value = reverse ? this._start + (size - 1) * step : this._start;
+    var i = 0;
+    return new Iterator(function () {
+      if (i === size) {
+        return iteratorDone();
+      }
+      var v = value;
+      value += reverse ? -step : step;
+      return iteratorValue(type, reverse ? size - ++i : i++, v);
+    });
+  };
+
+  Range.prototype.equals = function equals (other) {
+    return other instanceof Range
+      ? this._start === other._start &&
+          this._end === other._end &&
+          this._step === other._step
+      : deepEqual(this, other);
+  };
+
+  return Range;
+}(IndexedSeq));
+
+var EMPTY_RANGE;
+
+function getIn(collection, searchKeyPath, notSetValue) {
+  var keyPath = coerceKeyPath(searchKeyPath);
+  var i = 0;
+  while (i !== keyPath.length) {
+    collection = get(collection, keyPath[i++], NOT_SET);
+    if (collection === NOT_SET) {
+      return notSetValue;
+    }
+  }
+  return collection;
+}
+
+function getIn$1(searchKeyPath, notSetValue) {
+  return getIn(this, searchKeyPath, notSetValue);
+}
+
+function hasIn(collection, keyPath) {
+  return getIn(collection, keyPath, NOT_SET) !== NOT_SET;
+}
+
+function hasIn$1(searchKeyPath) {
+  return hasIn(this, searchKeyPath);
+}
+
+function toObject() {
+  assertNotInfinite(this.size);
+  var object = {};
+  this.__iterate(function (v, k) {
+    object[k] = v;
+  });
+  return object;
+}
+
+// Note: all of these methods are deprecated.
+Collection.isIterable = isCollection;
+Collection.isKeyed = isKeyed;
+Collection.isIndexed = isIndexed;
+Collection.isAssociative = isAssociative;
+Collection.isOrdered = isOrdered;
+
+Collection.Iterator = Iterator;
+
+mixin(Collection, {
+  // ### Conversion to other types
+
+  toArray: function toArray() {
+    assertNotInfinite(this.size);
+    var array = new Array(this.size || 0);
+    var useTuples = isKeyed(this);
+    var i = 0;
+    this.__iterate(function (v, k) {
+      // Keyed collections produce an array of tuples.
+      array[i++] = useTuples ? [k, v] : v;
+    });
+    return array;
+  },
+
+  toIndexedSeq: function toIndexedSeq() {
+    return new ToIndexedSequence(this);
+  },
+
+  toJS: function toJS$1() {
+    return toJS(this);
+  },
+
+  toKeyedSeq: function toKeyedSeq() {
+    return new ToKeyedSequence(this, true);
+  },
+
+  toMap: function toMap() {
+    // Use Late Binding here to solve the circular dependency.
+    return Map(this.toKeyedSeq());
+  },
+
+  toObject: toObject,
+
+  toOrderedMap: function toOrderedMap() {
+    // Use Late Binding here to solve the circular dependency.
+    return OrderedMap(this.toKeyedSeq());
+  },
+
+  toOrderedSet: function toOrderedSet() {
+    // Use Late Binding here to solve the circular dependency.
+    return OrderedSet(isKeyed(this) ? this.valueSeq() : this);
+  },
+
+  toSet: function toSet() {
+    // Use Late Binding here to solve the circular dependency.
+    return Set(isKeyed(this) ? this.valueSeq() : this);
+  },
+
+  toSetSeq: function toSetSeq() {
+    return new ToSetSequence(this);
+  },
+
+  toSeq: function toSeq() {
+    return isIndexed(this)
+      ? this.toIndexedSeq()
+      : isKeyed(this)
+        ? this.toKeyedSeq()
+        : this.toSetSeq();
+  },
+
+  toStack: function toStack() {
+    // Use Late Binding here to solve the circular dependency.
+    return Stack(isKeyed(this) ? this.valueSeq() : this);
+  },
+
+  toList: function toList() {
+    // Use Late Binding here to solve the circular dependency.
+    return List(isKeyed(this) ? this.valueSeq() : this);
+  },
+
+  // ### Common JavaScript methods and properties
+
+  toString: function toString() {
+    return '[Collection]';
+  },
+
+  __toString: function __toString(head, tail) {
+    if (this.size === 0) {
+      return head + tail;
+    }
+    return (
+      head +
+      ' ' +
+      this.toSeq()
+        .map(this.__toStringMapper)
+        .join(', ') +
+      ' ' +
+      tail
+    );
+  },
+
+  // ### ES6 Collection methods (ES6 Array and Map)
+
+  concat: function concat() {
+    var values = [], len = arguments.length;
+    while ( len-- ) values[ len ] = arguments[ len ];
+
+    return reify(this, concatFactory(this, values));
+  },
+
+  includes: function includes(searchValue) {
+    return this.some(function (value) { return is(value, searchValue); });
+  },
+
+  entries: function entries() {
+    return this.__iterator(ITERATE_ENTRIES);
+  },
+
+  every: function every(predicate, context) {
+    assertNotInfinite(this.size);
+    var returnValue = true;
+    this.__iterate(function (v, k, c) {
+      if (!predicate.call(context, v, k, c)) {
+        returnValue = false;
+        return false;
+      }
+    });
+    return returnValue;
+  },
+
+  filter: function filter(predicate, context) {
+    return reify(this, filterFactory(this, predicate, context, true));
+  },
+
+  find: function find(predicate, context, notSetValue) {
+    var entry = this.findEntry(predicate, context);
+    return entry ? entry[1] : notSetValue;
+  },
+
+  forEach: function forEach(sideEffect, context) {
+    assertNotInfinite(this.size);
+    return this.__iterate(context ? sideEffect.bind(context) : sideEffect);
+  },
+
+  join: function join(separator) {
+    assertNotInfinite(this.size);
+    separator = separator !== undefined ? '' + separator : ',';
+    var joined = '';
+    var isFirst = true;
+    this.__iterate(function (v) {
+      isFirst ? (isFirst = false) : (joined += separator);
+      joined += v !== null && v !== undefined ? v.toString() : '';
+    });
+    return joined;
+  },
+
+  keys: function keys() {
+    return this.__iterator(ITERATE_KEYS);
+  },
+
+  map: function map(mapper, context) {
+    return reify(this, mapFactory(this, mapper, context));
+  },
+
+  reduce: function reduce$1(reducer, initialReduction, context) {
+    return reduce(
+      this,
+      reducer,
+      initialReduction,
+      context,
+      arguments.length < 2,
+      false
+    );
+  },
+
+  reduceRight: function reduceRight(reducer, initialReduction, context) {
+    return reduce(
+      this,
+      reducer,
+      initialReduction,
+      context,
+      arguments.length < 2,
+      true
+    );
+  },
+
+  reverse: function reverse() {
+    return reify(this, reverseFactory(this, true));
+  },
+
+  slice: function slice(begin, end) {
+    return reify(this, sliceFactory(this, begin, end, true));
+  },
+
+  some: function some(predicate, context) {
+    return !this.every(not(predicate), context);
+  },
+
+  sort: function sort(comparator) {
+    return reify(this, sortFactory(this, comparator));
+  },
+
+  values: function values() {
+    return this.__iterator(ITERATE_VALUES);
+  },
+
+  // ### More sequential methods
+
+  butLast: function butLast() {
+    return this.slice(0, -1);
+  },
+
+  isEmpty: function isEmpty() {
+    return this.size !== undefined ? this.size === 0 : !this.some(function () { return true; });
+  },
+
+  count: function count(predicate, context) {
+    return ensureSize(
+      predicate ? this.toSeq().filter(predicate, context) : this
+    );
+  },
+
+  countBy: function countBy(grouper, context) {
+    return countByFactory(this, grouper, context);
+  },
+
+  equals: function equals(other) {
+    return deepEqual(this, other);
+  },
+
+  entrySeq: function entrySeq() {
+    var collection = this;
+    if (collection._cache) {
+      // We cache as an entries array, so we can just return the cache!
+      return new ArraySeq(collection._cache);
+    }
+    var entriesSequence = collection
+      .toSeq()
+      .map(entryMapper)
+      .toIndexedSeq();
+    entriesSequence.fromEntrySeq = function () { return collection.toSeq(); };
+    return entriesSequence;
+  },
+
+  filterNot: function filterNot(predicate, context) {
+    return this.filter(not(predicate), context);
+  },
+
+  findEntry: function findEntry(predicate, context, notSetValue) {
+    var found = notSetValue;
+    this.__iterate(function (v, k, c) {
+      if (predicate.call(context, v, k, c)) {
+        found = [k, v];
+        return false;
+      }
+    });
+    return found;
+  },
+
+  findKey: function findKey(predicate, context) {
+    var entry = this.findEntry(predicate, context);
+    return entry && entry[0];
+  },
+
+  findLast: function findLast(predicate, context, notSetValue) {
+    return this.toKeyedSeq()
+      .reverse()
+      .find(predicate, context, notSetValue);
+  },
+
+  findLastEntry: function findLastEntry(predicate, context, notSetValue) {
+    return this.toKeyedSeq()
+      .reverse()
+      .findEntry(predicate, context, notSetValue);
+  },
+
+  findLastKey: function findLastKey(predicate, context) {
+    return this.toKeyedSeq()
+      .reverse()
+      .findKey(predicate, context);
+  },
+
+  first: function first(notSetValue) {
+    return this.find(returnTrue, null, notSetValue);
+  },
+
+  flatMap: function flatMap(mapper, context) {
+    return reify(this, flatMapFactory(this, mapper, context));
+  },
+
+  flatten: function flatten(depth) {
+    return reify(this, flattenFactory(this, depth, true));
+  },
+
+  fromEntrySeq: function fromEntrySeq() {
+    return new FromEntriesSequence(this);
+  },
+
+  get: function get(searchKey, notSetValue) {
+    return this.find(function (_, key) { return is(key, searchKey); }, undefined, notSetValue);
+  },
+
+  getIn: getIn$1,
+
+  groupBy: function groupBy(grouper, context) {
+    return groupByFactory(this, grouper, context);
+  },
+
+  has: function has(searchKey) {
+    return this.get(searchKey, NOT_SET) !== NOT_SET;
+  },
+
+  hasIn: hasIn$1,
+
+  isSubset: function isSubset(iter) {
+    iter = typeof iter.includes === 'function' ? iter : Collection(iter);
+    return this.every(function (value) { return iter.includes(value); });
+  },
+
+  isSuperset: function isSuperset(iter) {
+    iter = typeof iter.isSubset === 'function' ? iter : Collection(iter);
+    return iter.isSubset(this);
+  },
+
+  keyOf: function keyOf(searchValue) {
+    return this.findKey(function (value) { return is(value, searchValue); });
+  },
+
+  keySeq: function keySeq() {
+    return this.toSeq()
+      .map(keyMapper)
+      .toIndexedSeq();
+  },
+
+  last: function last(notSetValue) {
+    return this.toSeq()
+      .reverse()
+      .first(notSetValue);
+  },
+
+  lastKeyOf: function lastKeyOf(searchValue) {
+    return this.toKeyedSeq()
+      .reverse()
+      .keyOf(searchValue);
+  },
+
+  max: function max(comparator) {
+    return maxFactory(this, comparator);
+  },
+
+  maxBy: function maxBy(mapper, comparator) {
+    return maxFactory(this, comparator, mapper);
+  },
+
+  min: function min(comparator) {
+    return maxFactory(
+      this,
+      comparator ? neg(comparator) : defaultNegComparator
+    );
+  },
+
+  minBy: function minBy(mapper, comparator) {
+    return maxFactory(
+      this,
+      comparator ? neg(comparator) : defaultNegComparator,
+      mapper
+    );
+  },
+
+  rest: function rest() {
+    return this.slice(1);
+  },
+
+  skip: function skip(amount) {
+    return amount === 0 ? this : this.slice(Math.max(0, amount));
+  },
+
+  skipLast: function skipLast(amount) {
+    return amount === 0 ? this : this.slice(0, -Math.max(0, amount));
+  },
+
+  skipWhile: function skipWhile(predicate, context) {
+    return reify(this, skipWhileFactory(this, predicate, context, true));
+  },
+
+  skipUntil: function skipUntil(predicate, context) {
+    return this.skipWhile(not(predicate), context);
+  },
+
+  sortBy: function sortBy(mapper, comparator) {
+    return reify(this, sortFactory(this, comparator, mapper));
+  },
+
+  take: function take(amount) {
+    return this.slice(0, Math.max(0, amount));
+  },
+
+  takeLast: function takeLast(amount) {
+    return this.slice(-Math.max(0, amount));
+  },
+
+  takeWhile: function takeWhile(predicate, context) {
+    return reify(this, takeWhileFactory(this, predicate, context));
+  },
+
+  takeUntil: function takeUntil(predicate, context) {
+    return this.takeWhile(not(predicate), context);
+  },
+
+  update: function update(fn) {
+    return fn(this);
+  },
+
+  valueSeq: function valueSeq() {
+    return this.toIndexedSeq();
+  },
+
+  // ### Hashable Object
+
+  hashCode: function hashCode() {
+    return this.__hash || (this.__hash = hashCollection(this));
+  },
+
+  // ### Internal
+
+  // abstract __iterate(fn, reverse)
+
+  // abstract __iterator(type, reverse)
+});
+
+var CollectionPrototype = Collection.prototype;
+CollectionPrototype[IS_COLLECTION_SYMBOL] = true;
+CollectionPrototype[ITERATOR_SYMBOL] = CollectionPrototype.values;
+CollectionPrototype.toJSON = CollectionPrototype.toArray;
+CollectionPrototype.__toStringMapper = quoteString;
+CollectionPrototype.inspect = CollectionPrototype.toSource = function() {
+  return this.toString();
+};
+CollectionPrototype.chain = CollectionPrototype.flatMap;
+CollectionPrototype.contains = CollectionPrototype.includes;
+
+mixin(KeyedCollection, {
+  // ### More sequential methods
+
+  flip: function flip() {
+    return reify(this, flipFactory(this));
+  },
+
+  mapEntries: function mapEntries(mapper, context) {
+    var this$1 = this;
+
+    var iterations = 0;
+    return reify(
+      this,
+      this.toSeq()
+        .map(function (v, k) { return mapper.call(context, [k, v], iterations++, this$1); })
+        .fromEntrySeq()
+    );
+  },
+
+  mapKeys: function mapKeys(mapper, context) {
+    var this$1 = this;
+
+    return reify(
+      this,
+      this.toSeq()
+        .flip()
+        .map(function (k, v) { return mapper.call(context, k, v, this$1); })
+        .flip()
+    );
+  },
+});
+
+var KeyedCollectionPrototype = KeyedCollection.prototype;
+KeyedCollectionPrototype[IS_KEYED_SYMBOL] = true;
+KeyedCollectionPrototype[ITERATOR_SYMBOL] = CollectionPrototype.entries;
+KeyedCollectionPrototype.toJSON = toObject;
+KeyedCollectionPrototype.__toStringMapper = function (v, k) { return quoteString(k) + ': ' + quoteString(v); };
+
+mixin(IndexedCollection, {
+  // ### Conversion to other types
+
+  toKeyedSeq: function toKeyedSeq() {
+    return new ToKeyedSequence(this, false);
+  },
+
+  // ### ES6 Collection methods (ES6 Array and Map)
+
+  filter: function filter(predicate, context) {
+    return reify(this, filterFactory(this, predicate, context, false));
+  },
+
+  findIndex: function findIndex(predicate, context) {
+    var entry = this.findEntry(predicate, context);
+    return entry ? entry[0] : -1;
+  },
+
+  indexOf: function indexOf(searchValue) {
+    var key = this.keyOf(searchValue);
+    return key === undefined ? -1 : key;
+  },
+
+  lastIndexOf: function lastIndexOf(searchValue) {
+    var key = this.lastKeyOf(searchValue);
+    return key === undefined ? -1 : key;
+  },
+
+  reverse: function reverse() {
+    return reify(this, reverseFactory(this, false));
+  },
+
+  slice: function slice(begin, end) {
+    return reify(this, sliceFactory(this, begin, end, false));
+  },
+
+  splice: function splice(index, removeNum /*, ...values*/) {
+    var numArgs = arguments.length;
+    removeNum = Math.max(removeNum || 0, 0);
+    if (numArgs === 0 || (numArgs === 2 && !removeNum)) {
+      return this;
+    }
+    // If index is negative, it should resolve relative to the size of the
+    // collection. However size may be expensive to compute if not cached, so
+    // only call count() if the number is in fact negative.
+    index = resolveBegin(index, index < 0 ? this.count() : this.size);
+    var spliced = this.slice(0, index);
+    return reify(
+      this,
+      numArgs === 1
+        ? spliced
+        : spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum))
+    );
+  },
+
+  // ### More collection methods
+
+  findLastIndex: function findLastIndex(predicate, context) {
+    var entry = this.findLastEntry(predicate, context);
+    return entry ? entry[0] : -1;
+  },
+
+  first: function first(notSetValue) {
+    return this.get(0, notSetValue);
+  },
+
+  flatten: function flatten(depth) {
+    return reify(this, flattenFactory(this, depth, false));
+  },
+
+  get: function get(index, notSetValue) {
+    index = wrapIndex(this, index);
+    return index < 0 ||
+      (this.size === Infinity || (this.size !== undefined && index > this.size))
+      ? notSetValue
+      : this.find(function (_, key) { return key === index; }, undefined, notSetValue);
+  },
+
+  has: function has(index) {
+    index = wrapIndex(this, index);
+    return (
+      index >= 0 &&
+      (this.size !== undefined
+        ? this.size === Infinity || index < this.size
+        : this.indexOf(index) !== -1)
+    );
+  },
+
+  interpose: function interpose(separator) {
+    return reify(this, interposeFactory(this, separator));
+  },
+
+  interleave: function interleave(/*...collections*/) {
+    var collections = [this].concat(arrCopy(arguments));
+    var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, collections);
+    var interleaved = zipped.flatten(true);
+    if (zipped.size) {
+      interleaved.size = zipped.size * collections.length;
+    }
+    return reify(this, interleaved);
+  },
+
+  keySeq: function keySeq() {
+    return Range(0, this.size);
+  },
+
+  last: function last(notSetValue) {
+    return this.get(-1, notSetValue);
+  },
+
+  skipWhile: function skipWhile(predicate, context) {
+    return reify(this, skipWhileFactory(this, predicate, context, false));
+  },
+
+  zip: function zip(/*, ...collections */) {
+    var collections = [this].concat(arrCopy(arguments));
+    return reify(this, zipWithFactory(this, defaultZipper, collections));
+  },
+
+  zipAll: function zipAll(/*, ...collections */) {
+    var collections = [this].concat(arrCopy(arguments));
+    return reify(this, zipWithFactory(this, defaultZipper, collections, true));
+  },
+
+  zipWith: function zipWith(zipper /*, ...collections */) {
+    var collections = arrCopy(arguments);
+    collections[0] = this;
+    return reify(this, zipWithFactory(this, zipper, collections));
+  },
+});
+
+var IndexedCollectionPrototype = IndexedCollection.prototype;
+IndexedCollectionPrototype[IS_INDEXED_SYMBOL] = true;
+IndexedCollectionPrototype[IS_ORDERED_SYMBOL] = true;
+
+mixin(SetCollection, {
+  // ### ES6 Collection methods (ES6 Array and Map)
+
+  get: function get(value, notSetValue) {
+    return this.has(value) ? value : notSetValue;
+  },
+
+  includes: function includes(value) {
+    return this.has(value);
+  },
+
+  // ### More sequential methods
+
+  keySeq: function keySeq() {
+    return this.valueSeq();
+  },
+});
+
+SetCollection.prototype.has = CollectionPrototype.includes;
+SetCollection.prototype.contains = SetCollection.prototype.includes;
+
+// Mixin subclasses
+
+mixin(KeyedSeq, KeyedCollection.prototype);
+mixin(IndexedSeq, IndexedCollection.prototype);
+mixin(SetSeq, SetCollection.prototype);
+
+// #pragma Helper functions
+
+function reduce(collection, reducer, reduction, context, useFirst, reverse) {
+  assertNotInfinite(collection.size);
+  collection.__iterate(function (v, k, c) {
+    if (useFirst) {
+      useFirst = false;
+      reduction = v;
+    } else {
+      reduction = reducer.call(context, reduction, v, k, c);
+    }
+  }, reverse);
+  return reduction;
+}
+
+function keyMapper(v, k) {
+  return k;
+}
+
+function entryMapper(v, k) {
+  return [k, v];
+}
+
+function not(predicate) {
+  return function() {
+    return !predicate.apply(this, arguments);
+  };
+}
+
+function neg(predicate) {
+  return function() {
+    return -predicate.apply(this, arguments);
+  };
+}
+
+function defaultZipper() {
+  return arrCopy(arguments);
+}
+
+function defaultNegComparator(a, b) {
+  return a < b ? 1 : a > b ? -1 : 0;
+}
+
+function hashCollection(collection) {
+  if (collection.size === Infinity) {
+    return 0;
+  }
+  var ordered = isOrdered(collection);
+  var keyed = isKeyed(collection);
+  var h = ordered ? 1 : 0;
+  var size = collection.__iterate(
+    keyed
+      ? ordered
+        ? function (v, k) {
+            h = (31 * h + hashMerge(hash(v), hash(k))) | 0;
+          }
+        : function (v, k) {
+            h = (h + hashMerge(hash(v), hash(k))) | 0;
+          }
+      : ordered
+        ? function (v) {
+            h = (31 * h + hash(v)) | 0;
+          }
+        : function (v) {
+            h = (h + hash(v)) | 0;
+          }
+  );
+  return murmurHashOfSize(size, h);
+}
+
+function murmurHashOfSize(size, h) {
+  h = imul(h, 0xcc9e2d51);
+  h = imul((h << 15) | (h >>> -15), 0x1b873593);
+  h = imul((h << 13) | (h >>> -13), 5);
+  h = ((h + 0xe6546b64) | 0) ^ size;
+  h = imul(h ^ (h >>> 16), 0x85ebca6b);
+  h = imul(h ^ (h >>> 13), 0xc2b2ae35);
+  h = smi(h ^ (h >>> 16));
+  return h;
+}
+
+function hashMerge(a, b) {
+  return (a ^ (b + 0x9e3779b9 + (a << 6) + (a >> 2))) | 0; // int
+}
+
+var OrderedSet = /*@__PURE__*/(function (Set$$1) {
+  function OrderedSet(value) {
+    return value === null || value === undefined
+      ? emptyOrderedSet()
+      : isOrderedSet(value)
+        ? value
+        : emptyOrderedSet().withMutations(function (set) {
+            var iter = SetCollection(value);
+            assertNotInfinite(iter.size);
+            iter.forEach(function (v) { return set.add(v); });
+          });
+  }
+
+  if ( Set$$1 ) OrderedSet.__proto__ = Set$$1;
+  OrderedSet.prototype = Object.create( Set$$1 && Set$$1.prototype );
+  OrderedSet.prototype.constructor = OrderedSet;
+
+  OrderedSet.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  OrderedSet.fromKeys = function fromKeys (value) {
+    return this(KeyedCollection(value).keySeq());
+  };
+
+  OrderedSet.prototype.toString = function toString () {
+    return this.__toString('OrderedSet {', '}');
+  };
+
+  return OrderedSet;
+}(Set));
+
+OrderedSet.isOrderedSet = isOrderedSet;
+
+var OrderedSetPrototype = OrderedSet.prototype;
+OrderedSetPrototype[IS_ORDERED_SYMBOL] = true;
+OrderedSetPrototype.zip = IndexedCollectionPrototype.zip;
+OrderedSetPrototype.zipWith = IndexedCollectionPrototype.zipWith;
+
+OrderedSetPrototype.__empty = emptyOrderedSet;
+OrderedSetPrototype.__make = makeOrderedSet;
+
+function makeOrderedSet(map, ownerID) {
+  var set = Object.create(OrderedSetPrototype);
+  set.size = map ? map.size : 0;
+  set._map = map;
+  set.__ownerID = ownerID;
+  return set;
+}
+
+var EMPTY_ORDERED_SET;
+function emptyOrderedSet() {
+  return (
+    EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap()))
+  );
+}
+
+var Record = function Record(defaultValues, name) {
+  var hasInitialized;
+
+  var RecordType = function Record(values) {
+    var this$1 = this;
+
+    if (values instanceof RecordType) {
+      return values;
+    }
+    if (!(this instanceof RecordType)) {
+      return new RecordType(values);
+    }
+    if (!hasInitialized) {
+      hasInitialized = true;
+      var keys = Object.keys(defaultValues);
+      var indices = (RecordTypePrototype._indices = {});
+      // Deprecated: left to attempt not to break any external code which
+      // relies on a ._name property existing on record instances.
+      // Use Record.getDescriptiveName() instead
+      RecordTypePrototype._name = name;
+      RecordTypePrototype._keys = keys;
+      RecordTypePrototype._defaultValues = defaultValues;
+      for (var i = 0; i < keys.length; i++) {
+        var propName = keys[i];
+        indices[propName] = i;
+        if (RecordTypePrototype[propName]) {
+          /* eslint-disable no-console */
+          typeof console === 'object' &&
+            console.warn &&
+            console.warn(
+              'Cannot define ' +
+                recordName(this) +
+                ' with property "' +
+                propName +
+                '" since that property name is part of the Record API.'
+            );
+          /* eslint-enable no-console */
+        } else {
+          setProp(RecordTypePrototype, propName);
+        }
+      }
+    }
+    this.__ownerID = undefined;
+    this._values = List().withMutations(function (l) {
+      l.setSize(this$1._keys.length);
+      KeyedCollection(values).forEach(function (v, k) {
+        l.set(this$1._indices[k], v === this$1._defaultValues[k] ? undefined : v);
+      });
+    });
+  };
+
+  var RecordTypePrototype = (RecordType.prototype = Object.create(
+    RecordPrototype
+  ));
+  RecordTypePrototype.constructor = RecordType;
+
+  if (name) {
+    RecordType.displayName = name;
+  }
+
+  return RecordType;
+};
+
+Record.prototype.toString = function toString () {
+  var str = recordName(this) + ' { ';
+  var keys = this._keys;
+  var k;
+  for (var i = 0, l = keys.length; i !== l; i++) {
+    k = keys[i];
+    str += (i ? ', ' : '') + k + ': ' + quoteString(this.get(k));
+  }
+  return str + ' }';
+};
+
+Record.prototype.equals = function equals (other) {
+  return (
+    this === other ||
+    (other &&
+      this._keys === other._keys &&
+      recordSeq(this).equals(recordSeq(other)))
+  );
+};
+
+Record.prototype.hashCode = function hashCode () {
+  return recordSeq(this).hashCode();
+};
+
+// @pragma Access
+
+Record.prototype.has = function has (k) {
+  return this._indices.hasOwnProperty(k);
+};
+
+Record.prototype.get = function get (k, notSetValue) {
+  if (!this.has(k)) {
+    return notSetValue;
+  }
+  var index = this._indices[k];
+  var value = this._values.get(index);
+  return value === undefined ? this._defaultValues[k] : value;
+};
+
+// @pragma Modification
+
+Record.prototype.set = function set (k, v) {
+  if (this.has(k)) {
+    var newValues = this._values.set(
+      this._indices[k],
+      v === this._defaultValues[k] ? undefined : v
+    );
+    if (newValues !== this._values && !this.__ownerID) {
+      return makeRecord(this, newValues);
+    }
+  }
+  return this;
+};
+
+Record.prototype.remove = function remove (k) {
+  return this.set(k);
+};
+
+Record.prototype.clear = function clear () {
+  var newValues = this._values.clear().setSize(this._keys.length);
+  return this.__ownerID ? this : makeRecord(this, newValues);
+};
+
+Record.prototype.wasAltered = function wasAltered () {
+  return this._values.wasAltered();
+};
+
+Record.prototype.toSeq = function toSeq () {
+  return recordSeq(this);
+};
+
+Record.prototype.toJS = function toJS$1 () {
+  return toJS(this);
+};
+
+Record.prototype.entries = function entries () {
+  return this.__iterator(ITERATE_ENTRIES);
+};
+
+Record.prototype.__iterator = function __iterator (type, reverse) {
+  return recordSeq(this).__iterator(type, reverse);
+};
+
+Record.prototype.__iterate = function __iterate (fn, reverse) {
+  return recordSeq(this).__iterate(fn, reverse);
+};
+
+Record.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+  if (ownerID === this.__ownerID) {
+    return this;
+  }
+  var newValues = this._values.__ensureOwner(ownerID);
+  if (!ownerID) {
+    this.__ownerID = ownerID;
+    this._values = newValues;
+    return this;
+  }
+  return makeRecord(this, newValues, ownerID);
+};
+
+Record.isRecord = isRecord;
+Record.getDescriptiveName = recordName;
+var RecordPrototype = Record.prototype;
+RecordPrototype[IS_RECORD_SYMBOL] = true;
+RecordPrototype[DELETE] = RecordPrototype.remove;
+RecordPrototype.deleteIn = RecordPrototype.removeIn = deleteIn;
+RecordPrototype.getIn = getIn$1;
+RecordPrototype.hasIn = CollectionPrototype.hasIn;
+RecordPrototype.merge = merge;
+RecordPrototype.mergeWith = mergeWith;
+RecordPrototype.mergeIn = mergeIn;
+RecordPrototype.mergeDeep = mergeDeep$1;
+RecordPrototype.mergeDeepWith = mergeDeepWith$1;
+RecordPrototype.mergeDeepIn = mergeDeepIn;
+RecordPrototype.setIn = setIn$1;
+RecordPrototype.update = update$1;
+RecordPrototype.updateIn = updateIn$1;
+RecordPrototype.withMutations = withMutations;
+RecordPrototype.asMutable = asMutable;
+RecordPrototype.asImmutable = asImmutable;
+RecordPrototype[ITERATOR_SYMBOL] = RecordPrototype.entries;
+RecordPrototype.toJSON = RecordPrototype.toObject =
+  CollectionPrototype.toObject;
+RecordPrototype.inspect = RecordPrototype.toSource = function() {
+  return this.toString();
+};
+
+function makeRecord(likeRecord, values, ownerID) {
+  var record = Object.create(Object.getPrototypeOf(likeRecord));
+  record._values = values;
+  record.__ownerID = ownerID;
+  return record;
+}
+
+function recordName(record) {
+  return record.constructor.displayName || record.constructor.name || 'Record';
+}
+
+function recordSeq(record) {
+  return keyedSeqFromValue(record._keys.map(function (k) { return [k, record.get(k)]; }));
+}
+
+function setProp(prototype, name) {
+  try {
+    Object.defineProperty(prototype, name, {
+      get: function() {
+        return this.get(name);
+      },
+      set: function(value) {
+        invariant(this.__ownerID, 'Cannot set on an immutable record.');
+        this.set(name, value);
+      },
+    });
+  } catch (error) {
+    // Object.defineProperty failed. Probably IE8.
+  }
+}
+
+/**
+ * Returns a lazy Seq of `value` repeated `times` times. When `times` is
+ * undefined, returns an infinite sequence of `value`.
+ */
+var Repeat = /*@__PURE__*/(function (IndexedSeq$$1) {
+  function Repeat(value, times) {
+    if (!(this instanceof Repeat)) {
+      return new Repeat(value, times);
+    }
+    this._value = value;
+    this.size = times === undefined ? Infinity : Math.max(0, times);
+    if (this.size === 0) {
+      if (EMPTY_REPEAT) {
+        return EMPTY_REPEAT;
+      }
+      EMPTY_REPEAT = this;
+    }
+  }
+
+  if ( IndexedSeq$$1 ) Repeat.__proto__ = IndexedSeq$$1;
+  Repeat.prototype = Object.create( IndexedSeq$$1 && IndexedSeq$$1.prototype );
+  Repeat.prototype.constructor = Repeat;
+
+  Repeat.prototype.toString = function toString () {
+    if (this.size === 0) {
+      return 'Repeat []';
+    }
+    return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]';
+  };
+
+  Repeat.prototype.get = function get (index, notSetValue) {
+    return this.has(index) ? this._value : notSetValue;
+  };
+
+  Repeat.prototype.includes = function includes (searchValue) {
+    return is(this._value, searchValue);
+  };
+
+  Repeat.prototype.slice = function slice (begin, end) {
+    var size = this.size;
+    return wholeSlice(begin, end, size)
+      ? this
+      : new Repeat(
+          this._value,
+          resolveEnd(end, size) - resolveBegin(begin, size)
+        );
+  };
+
+  Repeat.prototype.reverse = function reverse () {
+    return this;
+  };
+
+  Repeat.prototype.indexOf = function indexOf (searchValue) {
+    if (is(this._value, searchValue)) {
+      return 0;
+    }
+    return -1;
+  };
+
+  Repeat.prototype.lastIndexOf = function lastIndexOf (searchValue) {
+    if (is(this._value, searchValue)) {
+      return this.size;
+    }
+    return -1;
+  };
+
+  Repeat.prototype.__iterate = function __iterate (fn, reverse) {
+    var size = this.size;
+    var i = 0;
+    while (i !== size) {
+      if (fn(this._value, reverse ? size - ++i : i++, this) === false) {
+        break;
+      }
+    }
+    return i;
+  };
+
+  Repeat.prototype.__iterator = function __iterator (type, reverse) {
+    var this$1 = this;
+
+    var size = this.size;
+    var i = 0;
+    return new Iterator(
+      function () { return i === size
+          ? iteratorDone()
+          : iteratorValue(type, reverse ? size - ++i : i++, this$1._value); }
+    );
+  };
+
+  Repeat.prototype.equals = function equals (other) {
+    return other instanceof Repeat
+      ? is(this._value, other._value)
+      : deepEqual(other);
+  };
+
+  return Repeat;
+}(IndexedSeq));
+
+var EMPTY_REPEAT;
+
+function fromJS(value, converter) {
+  return fromJSWith(
+    [],
+    converter || defaultConverter,
+    value,
+    '',
+    converter && converter.length > 2 ? [] : undefined,
+    { '': value }
+  );
+}
+
+function fromJSWith(stack, converter, value, key, keyPath, parentValue) {
+  var toSeq = Array.isArray(value)
+    ? IndexedSeq
+    : isPlainObj(value)
+      ? KeyedSeq
+      : null;
+  if (toSeq) {
+    if (~stack.indexOf(value)) {
+      throw new TypeError('Cannot convert circular structure to Immutable');
+    }
+    stack.push(value);
+    keyPath && key !== '' && keyPath.push(key);
+    var converted = converter.call(
+      parentValue,
+      key,
+      toSeq(value).map(function (v, k) { return fromJSWith(stack, converter, v, k, keyPath, value); }
+      ),
+      keyPath && keyPath.slice()
+    );
+    stack.pop();
+    keyPath && keyPath.pop();
+    return converted;
+  }
+  return value;
+}
+
+function defaultConverter(k, v) {
+  return isKeyed(v) ? v.toMap() : v.toList();
+}
+
+var version = "4.0.0-rc.11";
+
+var Immutable = {
+  version: version,
+
+  Collection: Collection,
+  // Note: Iterable is deprecated
+  Iterable: Collection,
+
+  Seq: Seq,
+  Map: Map,
+  OrderedMap: OrderedMap,
+  List: List,
+  Stack: Stack,
+  Set: Set,
+  OrderedSet: OrderedSet,
+
+  Record: Record,
+  Range: Range,
+  Repeat: Repeat,
+
+  is: is,
+  fromJS: fromJS,
+  hash: hash,
+
+  isImmutable: isImmutable,
+  isCollection: isCollection,
+  isKeyed: isKeyed,
+  isIndexed: isIndexed,
+  isAssociative: isAssociative,
+  isOrdered: isOrdered,
+  isValueObject: isValueObject,
+  isSeq: isSeq,
+  isList: isList,
+  isMap: isMap,
+  isOrderedMap: isOrderedMap,
+  isStack: isStack,
+  isSet: isSet,
+  isOrderedSet: isOrderedSet,
+  isRecord: isRecord,
+
+  get: get,
+  getIn: getIn,
+  has: has,
+  hasIn: hasIn,
+  merge: merge$1,
+  mergeDeep: mergeDeep,
+  mergeWith: mergeWith$1,
+  mergeDeepWith: mergeDeepWith,
+  remove: remove,
+  removeIn: removeIn,
+  set: set,
+  setIn: setIn,
+  update: update,
+  updateIn: updateIn,
+};
+
+// Note: Iterable is deprecated
+var Iterable = Collection;
+
+export default Immutable;
+export { version, Collection, Iterable, Seq, Map, OrderedMap, List, Stack, Set, OrderedSet, Record, Range, Repeat, is, fromJS, hash, isImmutable, isCollection, isKeyed, isIndexed, isAssociative, isOrdered, isValueObject, get, getIn, has, hasIn, merge$1 as merge, mergeDeep, mergeWith$1 as mergeWith, mergeDeepWith, remove, removeIn, set, setIn, update, updateIn };
diff --git a/B2Program/LightModel/BlinkLamps_v3.js b/B2Program/LightModel/BlinkLamps_v3.js
new file mode 100644
index 0000000000000000000000000000000000000000..9db6479f67a729ceeb11c794cd16fbb46b0ffdfc
--- /dev/null
+++ b/B2Program/LightModel/BlinkLamps_v3.js
@@ -0,0 +1,164 @@
+import { BTuple } from './btypes/BTuple.js';
+import { BInteger } from './btypes/BInteger.js';
+import { BBoolean } from './btypes/BBoolean.js';
+import { BRelation } from './btypes/BRelation.js';
+import { BSet } from './btypes/BSet.js';
+import { SelectError } from "./btypes/BUtils.js";
+export var enum_DIRECTIONS;
+(function (enum_DIRECTIONS) {
+    enum_DIRECTIONS[enum_DIRECTIONS["left_blink"] = 0] = "left_blink";
+    enum_DIRECTIONS[enum_DIRECTIONS["right_blink"] = 1] = "right_blink";
+    enum_DIRECTIONS[enum_DIRECTIONS["neutral_blink"] = 2] = "neutral_blink";
+})(enum_DIRECTIONS || (enum_DIRECTIONS = {}));
+export class DIRECTIONS {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof DIRECTIONS)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_DIRECTIONS[this.value].toString();
+    }
+    static get_left_blink() { return new DIRECTIONS(enum_DIRECTIONS.left_blink); }
+    static get_right_blink() { return new DIRECTIONS(enum_DIRECTIONS.right_blink); }
+    static get_neutral_blink() { return new DIRECTIONS(enum_DIRECTIONS.neutral_blink); }
+}
+export default class BlinkLamps_v3 {
+    constructor() {
+        BlinkLamps_v3.BLINK_DIRECTION = new BSet(new DIRECTIONS(enum_DIRECTIONS.left_blink), new DIRECTIONS(enum_DIRECTIONS.right_blink));
+        BlinkLamps_v3.LAMP_STATUS = new BSet(new BInteger(0), new BInteger(100));
+        BlinkLamps_v3.lamp_on = new BInteger(100);
+        BlinkLamps_v3.lamp_off = new BInteger(0);
+        BlinkLamps_v3.BLINK_CYCLE_COUNTER = BSet.interval(new BInteger(1).negative(), new BInteger(3));
+        BlinkLamps_v3.cycleMaxLampStatus = new BRelation(new BTuple(new BBoolean(false), BlinkLamps_v3.lamp_off), new BTuple(new BBoolean(true), BlinkLamps_v3.lamp_on));
+        this.active_blinkers = new BSet();
+        this.blinkLeft = BlinkLamps_v3.lamp_off;
+        this.blinkRight = BlinkLamps_v3.lamp_off;
+        this.remaining_blinks = new BInteger(0);
+        this.onCycle = new BBoolean(false);
+    }
+    _copy() {
+        var _a, _b, _c;
+        let _instance = Object.create(BlinkLamps_v3.prototype);
+        for (let key of Object.keys(this)) {
+            _instance[key] = (_c = (_b = (_a = this[key])._copy) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : this[key];
+        }
+        return _instance;
+    }
+    SET_AllBlinkersOff() {
+        this.active_blinkers = new BSet();
+        this.remaining_blinks = new BInteger(0);
+        this.blinkLeft = BlinkLamps_v3.lamp_off;
+        this.blinkRight = BlinkLamps_v3.lamp_off;
+    }
+    SET_AllBlinkersOn() {
+        this.active_blinkers = BlinkLamps_v3.BLINK_DIRECTION;
+        this.remaining_blinks = new BInteger(1).negative();
+        this.blinkLeft = BlinkLamps_v3.cycleMaxLampStatus.functionCall(this.onCycle);
+        this.blinkRight = BlinkLamps_v3.cycleMaxLampStatus.functionCall(this.onCycle);
+    }
+    SET_BlinkersOn(direction, rem) {
+        this.active_blinkers = new BSet(direction);
+        this.remaining_blinks = rem;
+        if ((direction.equal(new DIRECTIONS(enum_DIRECTIONS.right_blink))).booleanValue()) {
+            this.blinkLeft = BlinkLamps_v3.lamp_off;
+            this.blinkRight = BlinkLamps_v3.cycleMaxLampStatus.functionCall(this.onCycle);
+        }
+        else {
+            this.blinkLeft = BlinkLamps_v3.cycleMaxLampStatus.functionCall(this.onCycle);
+            this.blinkRight = BlinkLamps_v3.lamp_off;
+        }
+    }
+    SET_RemainingBlinks(rem) {
+        this.remaining_blinks = rem;
+    }
+    TIME_BlinkerOn() {
+        if ((new BBoolean(new BBoolean(this.blinkLeft.equal(BlinkLamps_v3.lamp_off).booleanValue() && this.blinkRight.equal(BlinkLamps_v3.lamp_off).booleanValue()).booleanValue() && this.remaining_blinks.unequal(new BInteger(0)).booleanValue())).booleanValue()) {
+            let _ld_remaining_blinks = this.remaining_blinks;
+            this.onCycle = new BBoolean(true);
+            if ((this.active_blinkers.elementOf(new DIRECTIONS(enum_DIRECTIONS.left_blink))).booleanValue()) {
+                this.blinkLeft = BlinkLamps_v3.lamp_on;
+            }
+            if ((this.active_blinkers.elementOf(new DIRECTIONS(enum_DIRECTIONS.right_blink))).booleanValue()) {
+                this.blinkRight = BlinkLamps_v3.lamp_on;
+            }
+            if ((_ld_remaining_blinks.greater(new BInteger(0))).booleanValue()) {
+                this.remaining_blinks = _ld_remaining_blinks.minus(new BInteger(1));
+            }
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    TIME_BlinkerOff() {
+        if ((new BBoolean(this.blinkLeft.equal(BlinkLamps_v3.lamp_off).booleanValue() && this.blinkRight.equal(BlinkLamps_v3.lamp_off).booleanValue()).not()).booleanValue()) {
+            this.blinkLeft = BlinkLamps_v3.lamp_off;
+            this.blinkRight = BlinkLamps_v3.lamp_off;
+            this.onCycle = new BBoolean(false);
+            if ((this.remaining_blinks.equal(new BInteger(0))).booleanValue()) {
+                this.active_blinkers = new BSet();
+            }
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    TIME_Nothing(newOnCycle) {
+        if ((new BBoolean(new BBoolean(newOnCycle.equal(new BBoolean(false)).booleanValue() && new BBoolean(this.blinkLeft.equal(BlinkLamps_v3.lamp_off).booleanValue() && this.blinkRight.equal(BlinkLamps_v3.lamp_off).booleanValue()).booleanValue()).booleanValue() && this.active_blinkers.equal(new BSet()).booleanValue())).booleanValue()) {
+            this.onCycle = newOnCycle;
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    _get_BLINK_DIRECTION() {
+        return BlinkLamps_v3.BLINK_DIRECTION;
+    }
+    _get_LAMP_STATUS() {
+        return BlinkLamps_v3.LAMP_STATUS;
+    }
+    _get_lamp_on() {
+        return BlinkLamps_v3.lamp_on;
+    }
+    _get_lamp_off() {
+        return BlinkLamps_v3.lamp_off;
+    }
+    _get_BLINK_CYCLE_COUNTER() {
+        return BlinkLamps_v3.BLINK_CYCLE_COUNTER;
+    }
+    _get_cycleMaxLampStatus() {
+        return BlinkLamps_v3.cycleMaxLampStatus;
+    }
+    _get_active_blinkers() {
+        return this.active_blinkers;
+    }
+    _get_remaining_blinks() {
+        return this.remaining_blinks;
+    }
+    _get_onCycle() {
+        return this.onCycle;
+    }
+    _get_blinkLeft() {
+        return this.blinkLeft;
+    }
+    _get_blinkRight() {
+        return this.blinkRight;
+    }
+    _get__DIRECTIONS() {
+        return BlinkLamps_v3._DIRECTIONS;
+    }
+}
+BlinkLamps_v3._DIRECTIONS = new BSet(new DIRECTIONS(enum_DIRECTIONS.left_blink), new DIRECTIONS(enum_DIRECTIONS.right_blink), new DIRECTIONS(enum_DIRECTIONS.neutral_blink));
diff --git a/B2Program/LightModel/BlinkLamps_v3.ts b/B2Program/LightModel/BlinkLamps_v3.ts
new file mode 100644
index 0000000000000000000000000000000000000000..4499b78cfa11f162a3b69083f05640e83fde45bc
--- /dev/null
+++ b/B2Program/LightModel/BlinkLamps_v3.ts
@@ -0,0 +1,215 @@
+import {BTuple} from './btypes/BTuple.js';
+import {BInteger} from './btypes/BInteger.js';
+import {BBoolean} from './btypes/BBoolean.js';
+import {BRelation} from './btypes/BRelation.js';
+import {BSet} from './btypes/BSet.js';
+import {BObject} from './btypes/BObject.js';
+import {BUtils} from "./btypes/BUtils.js";
+import {SelectError} from "./btypes/BUtils.js";
+
+export enum enum_DIRECTIONS {
+    left_blink,
+    right_blink,
+    neutral_blink
+}
+
+export class DIRECTIONS implements BObject{
+    value: enum_DIRECTIONS;
+
+    constructor(value: enum_DIRECTIONS) {
+        this.value = value;
+    }
+
+    equal(other: DIRECTIONS) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: DIRECTIONS) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof DIRECTIONS)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_DIRECTIONS[this.value].toString();
+    }
+
+    static get_left_blink () {return new DIRECTIONS(enum_DIRECTIONS.left_blink);}
+    static get_right_blink () {return new DIRECTIONS(enum_DIRECTIONS.right_blink);}
+    static get_neutral_blink () {return new DIRECTIONS(enum_DIRECTIONS.neutral_blink);}
+
+
+}
+
+
+export default class BlinkLamps_v3 {
+
+
+    private static BLINK_DIRECTION: BSet<DIRECTIONS>;
+    private static LAMP_STATUS: BSet<BInteger>;
+    private static lamp_on: BInteger;
+    private static lamp_off: BInteger;
+    private static BLINK_CYCLE_COUNTER: BSet<BInteger>;
+    private static cycleMaxLampStatus: BRelation<BBoolean, BInteger>;
+
+    private static _DIRECTIONS: BSet<DIRECTIONS> = new BSet(new DIRECTIONS(enum_DIRECTIONS.left_blink), new DIRECTIONS(enum_DIRECTIONS.right_blink), new DIRECTIONS(enum_DIRECTIONS.neutral_blink));
+
+    private active_blinkers: BSet<DIRECTIONS>;
+    private remaining_blinks: BInteger;
+    private onCycle: BBoolean;
+    private blinkLeft: BInteger;
+    private blinkRight: BInteger;
+
+    constructor() {
+        BlinkLamps_v3.BLINK_DIRECTION = new BSet(new DIRECTIONS(enum_DIRECTIONS.left_blink), new DIRECTIONS(enum_DIRECTIONS.right_blink));
+        BlinkLamps_v3.LAMP_STATUS = new BSet(new BInteger(0), new BInteger(100));
+        BlinkLamps_v3.lamp_on = new BInteger(100);
+        BlinkLamps_v3.lamp_off = new BInteger(0);
+        BlinkLamps_v3.BLINK_CYCLE_COUNTER = BSet.interval(new BInteger(1).negative(), new BInteger(3));
+        BlinkLamps_v3.cycleMaxLampStatus = new BRelation<BBoolean, BInteger>(new BTuple(new BBoolean(false), BlinkLamps_v3.lamp_off), new BTuple(new BBoolean(true), BlinkLamps_v3.lamp_on));
+        this.active_blinkers = new BSet();
+        this.blinkLeft = BlinkLamps_v3.lamp_off;
+        this.blinkRight = BlinkLamps_v3.lamp_off;
+        this.remaining_blinks = new BInteger(0);
+        this.onCycle = new BBoolean(false);
+    }
+
+    public _copy(): BlinkLamps_v3 {
+        let _instance = Object.create(BlinkLamps_v3.prototype);
+        for(let key of Object.keys(this)) {
+            _instance[key] = this[key]._copy?.() ?? this[key];
+        }
+        return _instance;
+    }
+
+     SET_AllBlinkersOff(): void {
+        this.active_blinkers = new BSet();
+        this.remaining_blinks = new BInteger(0);
+        this.blinkLeft = BlinkLamps_v3.lamp_off;
+        this.blinkRight = BlinkLamps_v3.lamp_off;
+    }
+
+     SET_AllBlinkersOn(): void {
+        this.active_blinkers = BlinkLamps_v3.BLINK_DIRECTION;
+        this.remaining_blinks = new BInteger(1).negative();
+        this.blinkLeft = BlinkLamps_v3.cycleMaxLampStatus.functionCall(this.onCycle);
+        this.blinkRight = BlinkLamps_v3.cycleMaxLampStatus.functionCall(this.onCycle);
+    }
+
+     SET_BlinkersOn(direction: DIRECTIONS, rem: BInteger): void {
+        this.active_blinkers = new BSet(direction);
+        this.remaining_blinks = rem;
+        if((direction.equal(new DIRECTIONS(enum_DIRECTIONS.right_blink))).booleanValue()) {
+            this.blinkLeft = BlinkLamps_v3.lamp_off;
+            this.blinkRight = BlinkLamps_v3.cycleMaxLampStatus.functionCall(this.onCycle);
+        } else {
+            this.blinkLeft = BlinkLamps_v3.cycleMaxLampStatus.functionCall(this.onCycle);
+            this.blinkRight = BlinkLamps_v3.lamp_off;
+        }
+    }
+
+     SET_RemainingBlinks(rem: BInteger): void {
+        this.remaining_blinks = rem;
+    }
+
+     TIME_BlinkerOn(): void {
+        if((new BBoolean(new BBoolean(this.blinkLeft.equal(BlinkLamps_v3.lamp_off).booleanValue() && this.blinkRight.equal(BlinkLamps_v3.lamp_off).booleanValue()).booleanValue() && this.remaining_blinks.unequal(new BInteger(0)).booleanValue())).booleanValue()) {
+            let _ld_remaining_blinks: BInteger = this.remaining_blinks;
+            this.onCycle = new BBoolean(true);
+            if((this.active_blinkers.elementOf(new DIRECTIONS(enum_DIRECTIONS.left_blink))).booleanValue()) {
+                this.blinkLeft = BlinkLamps_v3.lamp_on;
+            } 
+            if((this.active_blinkers.elementOf(new DIRECTIONS(enum_DIRECTIONS.right_blink))).booleanValue()) {
+                this.blinkRight = BlinkLamps_v3.lamp_on;
+            } 
+            if((_ld_remaining_blinks.greater(new BInteger(0))).booleanValue()) {
+                this.remaining_blinks = _ld_remaining_blinks.minus(new BInteger(1));
+            } 
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     TIME_BlinkerOff(): void {
+        if((new BBoolean(this.blinkLeft.equal(BlinkLamps_v3.lamp_off).booleanValue() && this.blinkRight.equal(BlinkLamps_v3.lamp_off).booleanValue()).not()).booleanValue()) {
+            this.blinkLeft = BlinkLamps_v3.lamp_off;
+            this.blinkRight = BlinkLamps_v3.lamp_off;
+            this.onCycle = new BBoolean(false);
+            if((this.remaining_blinks.equal(new BInteger(0))).booleanValue()) {
+                this.active_blinkers = new BSet();
+            } 
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     TIME_Nothing(newOnCycle: BBoolean): void {
+        if((new BBoolean(new BBoolean(newOnCycle.equal(new BBoolean(false)).booleanValue() && new BBoolean(this.blinkLeft.equal(BlinkLamps_v3.lamp_off).booleanValue() && this.blinkRight.equal(BlinkLamps_v3.lamp_off).booleanValue()).booleanValue()).booleanValue() && this.active_blinkers.equal(new BSet()).booleanValue())).booleanValue()) {
+            this.onCycle = newOnCycle;
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+    _get_BLINK_DIRECTION(): BSet<DIRECTIONS> {
+        return BlinkLamps_v3.BLINK_DIRECTION;
+    }
+
+    _get_LAMP_STATUS(): BSet<BInteger> {
+        return BlinkLamps_v3.LAMP_STATUS;
+    }
+
+    _get_lamp_on(): BInteger {
+        return BlinkLamps_v3.lamp_on;
+    }
+
+    _get_lamp_off(): BInteger {
+        return BlinkLamps_v3.lamp_off;
+    }
+
+    _get_BLINK_CYCLE_COUNTER(): BSet<BInteger> {
+        return BlinkLamps_v3.BLINK_CYCLE_COUNTER;
+    }
+
+    _get_cycleMaxLampStatus(): BRelation<BBoolean, BInteger> {
+        return BlinkLamps_v3.cycleMaxLampStatus;
+    }
+
+    _get_active_blinkers(): BSet<DIRECTIONS> {
+        return this.active_blinkers;
+    }
+
+    _get_remaining_blinks(): BInteger {
+        return this.remaining_blinks;
+    }
+
+    _get_onCycle(): BBoolean {
+        return this.onCycle;
+    }
+
+    _get_blinkLeft(): BInteger {
+        return this.blinkLeft;
+    }
+
+    _get_blinkRight(): BInteger {
+        return this.blinkRight;
+    }
+
+    _get__DIRECTIONS(): BSet<DIRECTIONS> {
+        return BlinkLamps_v3._DIRECTIONS;
+    }
+
+
+
+
+}
+
diff --git a/B2Program/LightModel/GenericTimersMC.js b/B2Program/LightModel/GenericTimersMC.js
new file mode 100644
index 0000000000000000000000000000000000000000..a2d3e150af089516cd57089f085d1727fed59354
--- /dev/null
+++ b/B2Program/LightModel/GenericTimersMC.js
@@ -0,0 +1,97 @@
+import { BTuple } from './btypes/BTuple.js';
+import { BBoolean } from './btypes/BBoolean.js';
+import { BRelation } from './btypes/BRelation.js';
+import { BSet } from './btypes/BSet.js';
+import { SelectError } from "./btypes/BUtils.js";
+export var enum_TIMERS;
+(function (enum_TIMERS) {
+    enum_TIMERS[enum_TIMERS["blink_deadline"] = 0] = "blink_deadline";
+    enum_TIMERS[enum_TIMERS["tip_deadline"] = 1] = "tip_deadline";
+})(enum_TIMERS || (enum_TIMERS = {}));
+export class TIMERS {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof TIMERS)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_TIMERS[this.value].toString();
+    }
+    static get_blink_deadline() { return new TIMERS(enum_TIMERS.blink_deadline); }
+    static get_tip_deadline() { return new TIMERS(enum_TIMERS.tip_deadline); }
+}
+export default class GenericTimersMC {
+    constructor() {
+        this.curDeadlines = new BRelation();
+    }
+    _copy() {
+        var _a, _b, _c;
+        let _instance = Object.create(GenericTimersMC.prototype);
+        for (let key of Object.keys(this)) {
+            _instance[key] = (_c = (_b = (_a = this[key])._copy) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : this[key];
+        }
+        return _instance;
+    }
+    AbsoluteSetDeadline(timer, deadline) {
+        this.curDeadlines = this.curDeadlines.override(new BRelation(new BTuple(timer, deadline)));
+    }
+    AddDeadline(timer, deadline) {
+        this.curDeadlines = this.curDeadlines.override(new BRelation(new BTuple(timer, deadline)));
+    }
+    IncreaseTime(delta) {
+        if ((new BBoolean(delta.isNatural().booleanValue() && new BBoolean(!this.curDeadlines.unequal(new BRelation()).booleanValue() || delta.lessEqual(this.curDeadlines.range().min()).booleanValue()).booleanValue())).booleanValue()) {
+            let _ic_set_0 = new BRelation();
+            for (let _ic_x_1 of this.curDeadlines.domain()) {
+                _ic_set_0 = _ic_set_0.union(new BRelation(new BTuple(_ic_x_1, this.curDeadlines.functionCall(_ic_x_1).minus(delta))));
+            }
+            this.curDeadlines = _ic_set_0;
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    IncreaseTimeUntilDeadline(timer, delta) {
+        if ((new BBoolean(new BBoolean(new BBoolean(this.curDeadlines.domain().elementOf(timer).booleanValue() && delta.isNatural().booleanValue()).booleanValue() && delta.equal(this.curDeadlines.range().min()).booleanValue()).booleanValue() && delta.equal(this.curDeadlines.functionCall(timer)).booleanValue())).booleanValue()) {
+            let _ic_set_1 = new BRelation();
+            for (let _ic_x_1 of this.curDeadlines.domain().difference(new BSet(timer))) {
+                _ic_set_1 = _ic_set_1.union(new BRelation(new BTuple(_ic_x_1, this.curDeadlines.functionCall(_ic_x_1).minus(delta))));
+            }
+            this.curDeadlines = _ic_set_1;
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    IncreaseTimeUntilCyclicDeadline(timer, delta, newDelta) {
+        if ((new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.curDeadlines.domain().elementOf(timer).booleanValue() && delta.isNatural().booleanValue()).booleanValue() && newDelta.isNatural().booleanValue()).booleanValue() && delta.equal(this.curDeadlines.functionCall(timer)).booleanValue()).booleanValue() && delta.equal(this.curDeadlines.range().min()).booleanValue())).booleanValue()) {
+            let _ic_set_2 = new BRelation();
+            for (let _ic_x_1 of this.curDeadlines.domain().difference(new BSet(timer))) {
+                _ic_set_2 = _ic_set_2.union(new BRelation(new BTuple(_ic_x_1, this.curDeadlines.functionCall(_ic_x_1).minus(delta))));
+            }
+            this.curDeadlines = _ic_set_2.union(new BRelation(new BTuple(timer, newDelta)));
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    _get_curDeadlines() {
+        return this.curDeadlines;
+    }
+    _get__TIMERS() {
+        return GenericTimersMC._TIMERS;
+    }
+}
+GenericTimersMC._TIMERS = new BSet(new TIMERS(enum_TIMERS.blink_deadline), new TIMERS(enum_TIMERS.tip_deadline));
diff --git a/B2Program/LightModel/GenericTimersMC.ts b/B2Program/LightModel/GenericTimersMC.ts
new file mode 100644
index 0000000000000000000000000000000000000000..3bffd02f8700d83be25ffb205aab014713d6cd34
--- /dev/null
+++ b/B2Program/LightModel/GenericTimersMC.ts
@@ -0,0 +1,131 @@
+import {BTuple} from './btypes/BTuple.js';
+import {BInteger} from './btypes/BInteger.js';
+import {BBoolean} from './btypes/BBoolean.js';
+import {BRelation} from './btypes/BRelation.js';
+import {BSet} from './btypes/BSet.js';
+import {BObject} from './btypes/BObject.js';
+import {BUtils} from "./btypes/BUtils.js";
+import {SelectError} from "./btypes/BUtils.js";
+
+export enum enum_TIMERS {
+    blink_deadline,
+    tip_deadline
+}
+
+export class TIMERS implements BObject{
+    value: enum_TIMERS;
+
+    constructor(value: enum_TIMERS) {
+        this.value = value;
+    }
+
+    equal(other: TIMERS) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: TIMERS) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof TIMERS)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_TIMERS[this.value].toString();
+    }
+
+    static get_blink_deadline () {return new TIMERS(enum_TIMERS.blink_deadline);}
+    static get_tip_deadline () {return new TIMERS(enum_TIMERS.tip_deadline);}
+
+
+}
+
+
+export default class GenericTimersMC {
+
+
+
+    private static _TIMERS: BSet<TIMERS> = new BSet(new TIMERS(enum_TIMERS.blink_deadline), new TIMERS(enum_TIMERS.tip_deadline));
+
+    private curDeadlines: BRelation<TIMERS, BInteger>;
+
+    constructor() {
+        this.curDeadlines = new BRelation<TIMERS, BInteger>();
+    }
+
+    public _copy(): GenericTimersMC {
+        let _instance = Object.create(GenericTimersMC.prototype);
+        for(let key of Object.keys(this)) {
+            _instance[key] = this[key]._copy?.() ?? this[key];
+        }
+        return _instance;
+    }
+
+     AbsoluteSetDeadline(timer: TIMERS, deadline: BInteger): void {
+        this.curDeadlines = this.curDeadlines.override(new BRelation<TIMERS, BInteger>(new BTuple<TIMERS, BInteger>(timer,deadline)));
+    }
+
+     AddDeadline(timer: TIMERS, deadline: BInteger): void {
+        this.curDeadlines = this.curDeadlines.override(new BRelation<TIMERS, BInteger>(new BTuple<TIMERS, BInteger>(timer,deadline)));
+    }
+
+     IncreaseTime(delta: BInteger): void {
+        if((new BBoolean(delta.isNatural().booleanValue() && new BBoolean(!this.curDeadlines.unequal(new BRelation<TIMERS, BInteger>()).booleanValue() || delta.lessEqual(this.curDeadlines.range().min()).booleanValue()).booleanValue())).booleanValue()) {
+            let _ic_set_0: BRelation<TIMERS, BInteger> = new BRelation<TIMERS, BInteger>();
+            for(let _ic_x_1 of this.curDeadlines.domain()) {
+                _ic_set_0 = _ic_set_0.union(new BRelation<TIMERS, BInteger>(new BTuple(_ic_x_1, this.curDeadlines.functionCall(_ic_x_1).minus(delta))));
+
+            }
+            this.curDeadlines = _ic_set_0;
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     IncreaseTimeUntilDeadline(timer: TIMERS, delta: BInteger): void {
+        if((new BBoolean(new BBoolean(new BBoolean(this.curDeadlines.domain().elementOf(timer).booleanValue() && delta.isNatural().booleanValue()).booleanValue() && delta.equal(this.curDeadlines.range().min()).booleanValue()).booleanValue() && delta.equal(this.curDeadlines.functionCall(timer)).booleanValue())).booleanValue()) {
+            let _ic_set_1: BRelation<TIMERS, BInteger> = new BRelation<TIMERS, BInteger>();
+            for(let _ic_x_1 of this.curDeadlines.domain().difference(new BSet(timer))) {
+                _ic_set_1 = _ic_set_1.union(new BRelation<TIMERS, BInteger>(new BTuple(_ic_x_1, this.curDeadlines.functionCall(_ic_x_1).minus(delta))));
+
+            }
+            this.curDeadlines = _ic_set_1;
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     IncreaseTimeUntilCyclicDeadline(timer: TIMERS, delta: BInteger, newDelta: BInteger): void {
+        if((new BBoolean(new BBoolean(new BBoolean(new BBoolean(this.curDeadlines.domain().elementOf(timer).booleanValue() && delta.isNatural().booleanValue()).booleanValue() && newDelta.isNatural().booleanValue()).booleanValue() && delta.equal(this.curDeadlines.functionCall(timer)).booleanValue()).booleanValue() && delta.equal(this.curDeadlines.range().min()).booleanValue())).booleanValue()) {
+            let _ic_set_2: BRelation<TIMERS, BInteger> = new BRelation<TIMERS, BInteger>();
+            for(let _ic_x_1 of this.curDeadlines.domain().difference(new BSet(timer))) {
+                _ic_set_2 = _ic_set_2.union(new BRelation<TIMERS, BInteger>(new BTuple(_ic_x_1, this.curDeadlines.functionCall(_ic_x_1).minus(delta))));
+
+            }
+            this.curDeadlines = _ic_set_2.union(new BRelation<TIMERS, BInteger>(new BTuple(timer, newDelta)));
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+    _get_curDeadlines(): BRelation<TIMERS, BInteger> {
+        return this.curDeadlines;
+    }
+
+    _get__TIMERS(): BSet<TIMERS> {
+        return GenericTimersMC._TIMERS;
+    }
+
+
+
+
+}
+
diff --git a/B2Program/LightModel/Key.svg b/B2Program/LightModel/Key.svg
new file mode 100644
index 0000000000000000000000000000000000000000..8c13255e7b07d523750b3652e2e5d5c695627a81
--- /dev/null
+++ b/B2Program/LightModel/Key.svg
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   id="svg1896"
+   version="1.1"
+   width="98.866058"
+   height="96.676758"
+   sodipodi:docname="Key.svg"
+   inkscape:version="0.92.3 (2405546, 2018-03-11)">
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1920"
+     inkscape:window-height="1017"
+     id="namedview6329"
+     showgrid="false"
+     inkscape:zoom="2.8433735"
+     inkscape:cx="-20.78519"
+     inkscape:cy="41.480327"
+     inkscape:window-x="-8"
+     inkscape:window-y="-8"
+     inkscape:window-maximized="1"
+     inkscape:current-layer="ignition" />
+  <metadata
+     id="metadata1902">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs1900" />
+  <g
+     transform="matrix(1.1911573,0,0,1.1647802,-10.124837,-9.9006317)"
+     id="ignition-layer">
+    <g
+       id="ignition">
+      <circle
+         style="fill:#808080;stroke:#808080;stroke-width:3"
+         id="circle1890"
+         r="40"
+         cy="50"
+         cx="50" />
+      <ellipse
+         style="fill:#494949;stroke:#494949;stroke-width:2.40303135"
+         id="circle1892"
+         cy="50"
+         cx="50"
+         rx="23.803005"
+         ry="24.259792" />
+      <rect
+         style="fill:#000000;fill-opacity:1"
+         id="rect6208"
+         width="13.559322"
+         height="30.084745"
+         x="43.220341"
+         y="34.322033" />
+      <text
+         xml:space="preserve"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.33333349px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none"
+         x="19.913101"
+         y="-100.88259"
+         id="text6917"
+         transform="matrix(-0.38445029,0.94405083,-0.90270348,-0.3844503,0,0)"><tspan
+           sodipodi:role="line"
+           id="tspan6915"
+           x="19.913101"
+           y="-100.88259">START</tspan></text>
+      <text
+         xml:space="preserve"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.33333349px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1"
+         x="63.698452"
+         y="-63.434811"
+         id="text6917-7"
+         transform="matrix(0.38879411,0.94218856,-0.90092278,0.38879412,0,0)"><tspan
+           style="stroke-width:1"
+           sodipodi:role="line"
+           id="tspan6915-3"
+           x="63.698452"
+           y="-63.434811">ON</tspan></text>
+      <text
+         xml:space="preserve"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.33333349px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1"
+         x="69.099663"
+         y="-14.083524"
+         id="text6917-5"
+         transform="matrix(0.88720363,0.47182619,-0.45116124,0.88720367,0,0)"><tspan
+           style="stroke-width:1"
+           sodipodi:role="line"
+           id="tspan6915-30"
+           x="69.099663"
+           y="-14.083524">ACC</tspan></text>
+    </g>
+  </g>
+  <g
+     transform="matrix(1.2199409,0.0064397,-0.00604819,1.1457667,-11.070343,-10.130296)"
+     id="key-inserted-layer"
+     style="fill:#000000">
+    <g
+       visibility="hidden"
+       transform="matrix(1.1281738,0,0,1.2266666,14.93372,-16.073443)"
+       id="key-inserted"
+       style="fill:#000000">
+      <rect
+         style="fill:#000000;fill-opacity:1;stroke-width:0.83614457"
+         id="rect6890"
+         width="22.676216"
+         height="55.067017"
+         x="19.678703"
+         y="26.21656"
+         rx="20"
+         ry="5" />
+      <rect
+         style="fill:#1a1a1a;fill-opacity:1;stroke-width:1.10055423"
+         id="rect6893"
+         width="5.7390733"
+         height="54.845291"
+         x="28.167255"
+         y="26.373297"
+         rx="33.472603"
+         ry="5.0076761" />
+    </g>
+  </g>
+  <g
+     transform="matrix(0.55545704,1.0861698,-1.0201291,0.5216844,72.66677,-32.920254)"
+     id="key-on-position-layer"
+     style="fill:#000000">
+    <g
+       transform="matrix(1.1281738,0,0,1.2266666,14.93372,-16.073443)"
+       id="key-on-position"
+       visibility="hidden"
+       style="fill:#000000">
+      <rect
+         style="fill:#000000;fill-opacity:1;stroke-width:0.83614457"
+         id="rect6890-0"
+         width="22.676216"
+         height="55.067017"
+         x="19.678703"
+         y="26.21656"
+         rx="20"
+         ry="5" />
+      <rect
+         style="fill:#1a1a1a;fill-opacity:1;stroke-width:1.10055423"
+         id="rect6893-3"
+         width="5.7390733"
+         height="54.845291"
+         x="28.167255"
+         y="26.373297"
+         rx="33.472603"
+         ry="5.0076761" />
+    </g>
+  </g>
+  <g
+     transform="matrix(0.01972985,1.2197984,-1.1456328,0.0185302,105.67114,-14.504551)"
+     id="engine-started-layer"
+     style="fill:#000000">
+    <g
+       visibility="hidden"
+       transform="matrix(1.0996363,0.26846651,-0.25748706,1.1956376,29.658811,-22.732608)"
+       id="engine-start"
+       style="fill:#000000">
+      <rect
+         style="fill:#000000;fill-opacity:1;stroke-width:0.83614457"
+         id="rect6890-0-7"
+         width="22.676216"
+         height="55.067017"
+         x="19.678703"
+         y="26.21656"
+         rx="20"
+         ry="5" />
+      <rect
+         style="fill:#1a1a1a;fill-opacity:1;stroke-width:1.10055423"
+         id="rect6893-3-2"
+         width="5.7390733"
+         height="54.845291"
+         x="28.167255"
+         y="26.373297"
+         rx="33.472603"
+         ry="5.0076761" />
+    </g>
+  </g>
+</svg>
diff --git a/B2Program/LightModel/LichtUebersicht.svg b/B2Program/LightModel/LichtUebersicht.svg
new file mode 100644
index 0000000000000000000000000000000000000000..5783391e1c7032703afaa670e9f982733a3c5da4
--- /dev/null
+++ b/B2Program/LightModel/LichtUebersicht.svg
@@ -0,0 +1,490 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   id="svg8"
+   version="1.1"
+   viewBox="0 0 210 297"
+   height="297mm"
+   width="210mm">
+  <defs
+     id="defs2">
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath26">
+      <path
+         d="M 0,1.2207e-4 H 720 V 540.00012 H 0 Z"
+         id="path24"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath64">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path62"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath76">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path74"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath88">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path86"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath100">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path98"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath112">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path110"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath124">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path122"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath136">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path134"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath148">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path146"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath160">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path158"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath172">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path170"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath184">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path182"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath196">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path194"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath123">
+      <path
+         d="M 0,0 H 240 V 240 H 0 Z"
+         id="path121" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath137">
+      <path
+         d="M 0,0 H 240 V 240 H 0 Z"
+         id="path135" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath177">
+      <path
+         d="M 0,0 H 240 V 240 H 0 Z"
+         id="path175" />
+    </clipPath>
+  </defs>
+  <metadata
+     id="metadata5">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     id="layer1">
+    <path
+       id="car_outline"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       stroke ="#000000"
+       fill="none"
+       stroke-width="0.71966666"
+       stroke-opacity="1"
+       d="m 159.54511,60.511861 c 0,0 0.0844,6.523931 -0.7729,10.245736 -0.85725,3.721806 -1.28411,6.096 -4.43795,8.09625 -3.15383,2.00025 -9.49677,3.393722 -14.48152,3.90525 -4.98475,0.515056 -3.30906,-0.790223 -15.41639,-0.836083 l -57.227612,0.557389 c 0,0 -17.28611,1.721555 -23.125993,0.560916 -5.839531,-1.164166 -9.415286,-3.340805 -11.912953,-7.538861 -2.497314,-4.198055 -3.071636,-9.896753 -3.071636,-17.293165 0,-7.396413 0.629355,-12.982223 3.137253,-17.159112 2.50825,-4.176888 6.072363,-6.374694 11.910835,-7.53886 5.839884,-1.160639 23.118939,0.560916 23.118939,0.560916 l 57.220557,0.557389 c 12.1038,-0.04586 10.43164,-1.351139 15.41286,-0.836083 4.98122,0.511527 11.32769,1.905 14.478,3.90525 3.15383,2.00025 3.58422,4.374444 4.43794,8.096249 0.6189,3.376819 0.68846,6.852603 0.70692,10.299222 z" />
+    <path
+       id="A-right"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       fill="#f4eed7"
+       stroke ="#000000"
+       stroke-width="0.71966666"
+       stroke-opacity="1"
+       d="m 32.434345,48.014015 c 1.51765,-1.252361 10.155767,-10.918472 10.973153,-12.544778 0.817033,-1.626305 -4.55295,1.534583 -6.070247,2.786945 -1.51765,1.255888 -2.334684,3.252611 -3.0353,4.741333 -0.700264,1.485194 -3.385256,6.272388 -1.867606,5.0165 z" />
+    <path
+       id="B-right"
+       fill="none"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       stroke ="#000000"
+       stroke-width="0.71966666"
+       stroke-opacity="1"
+       d="m 74.013792,34.08282 c 0.85725,-1.721555 1.7145,-3.446638 2.575277,-4.190999 0.85725,-0.744362 2.377723,-0.931334 2.57175,-0.278695 0.197556,0.652639 -1.404055,4.191 -1.404055,4.191 l -0.112212,0.27167" />
+    <path
+       id="C-right"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       stroke ="#000000"
+       stroke-width="0.71966666"
+       fill="#d40000"
+       stroke-opacity="1"
+       d="m 152.27754,37.123765 c -0.97014,-0.141111 -3.10444,-0.328083 -2.794,0.557389 0.31044,0.881944 3.25967,3.023305 4.65667,4.744861 1.397,1.721555 3.18558,5.210527 3.72886,5.584472 0.54328,0.370417 -0.0388,-1.767417 -0.46567,-3.351389 -0.42686,-1.580444 -1.28411,-4.931833 -2.09903,-6.141861 -0.81491,-1.210028 -2.05669,-1.255889 -3.02683,-1.393472 z" />
+    <path
+       id="front-window"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       fill="none"
+       stroke ="#000000"
+       stroke-width="0.71966666"
+       stroke-opacity="1"
+       d="m 85.857171,70.535347 c 1.113049,2.755359 1.636728,1.789363 -0.903741,3.319639 -2.543058,1.531835 -11.571111,4.935361 -14.492111,5.863167 -2.920999,0.931333 -2.172485,1.390426 -3.037416,-0.278695 -0.917177,-1.769945 -2.133046,-5.820707 -2.753935,-9.45079 -0.624417,-3.626555 -0.946699,-7.860015 -0.943176,-11.712348 0.08114,-3.845278 0.02545,-6.509002 0.646339,-10.132029 0.624417,-3.623028 2.115911,-9.411859 3.124855,-10.992304 1.012472,-1.576917 0.119945,-1.2065 3.033889,-0.278694 2.913944,0.931333 11.90625,4.346222 14.453305,5.852583 2.547056,1.506361 2.265082,0.951176 1.254251,3.182055 -1.076472,2.375747 -2.382586,8.119789 -2.472594,12.168692 -0.104118,4.68361 1.044435,9.869595 2.090334,12.458724 z" />
+    <path
+       id="A-left"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       fill="#f4eed7"
+       stroke ="#000000"
+       stroke-width="0.71966666"
+       stroke-opacity="1"
+       d="m 32.392012,68.538625 c 1.51765,1.252361 10.155766,10.918472 10.973153,12.544778 0.817033,1.626305 -4.55295,-1.534584 -6.070248,-2.786945 -1.51765,-1.255888 -2.334683,-3.252611 -3.0353,-4.741333 -0.700263,-1.485194 -3.385255,-6.272389 -1.867605,-5.0165 z" />
+    <path
+       id="B-left"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       fill="none"
+       stroke ="#000000"
+       stroke-width="0.71966666"
+       stroke-opacity="1"
+       d="m 73.971458,82.512153 c 0.85725,1.707444 1.7145,3.414889 2.575278,4.155722 0.85725,0.737305 2.377722,0.92075 2.57175,0.275167 0.197556,-0.645584 -1.404056,-4.155723 -1.404056,-4.155723 l -0.141741,-0.318917" />
+    <path
+       id="C-left"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       fill="#d40000"
+       stroke ="#000000"
+       stroke-width="0.71966666"
+       stroke-opacity="1"
+       d="m 152.20698,79.428875 c -0.97719,0.141111 -3.12208,0.328083 -2.80811,-0.557389 0.31045,-0.881944 3.27731,-3.023305 4.68136,-4.744861 1.40406,-1.721555 3.1997,-5.210527 3.74298,-5.584472 0.5468,-0.370417 -0.0388,1.767417 -0.46567,3.351389 -0.43039,1.580444 -1.28764,4.931833 -2.10961,6.141861 -0.81845,1.210028 -2.06728,1.255889 -3.04095,1.393472 z" />
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g58">
+      <g
+         clip-path="url(#clipPath64)"
+         id="g60">
+        <text
+           id="text68"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,49.2,501.6)">
+          <tspan
+             id="tspan66"
+             y="0"
+             x="0">A</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g70">
+      <g
+         clip-path="url(#clipPath76)"
+         id="g72">
+        <text
+           id="text80"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,59.64,497.16)">
+          <tspan
+             id="tspan78"
+             y="0"
+             x="0 4.1880002 6.948 12.6 18.84">right</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g82">
+      <g
+         clip-path="url(#clipPath88)"
+         id="g84">
+        <text
+           id="text92"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,206.76,501.6)">
+          <tspan
+             id="tspan90"
+             y="0"
+             x="0">B</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g94">
+      <g
+         clip-path="url(#clipPath100)"
+         id="g96">
+        <text
+           id="text104"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,216.6,497.16)">
+          <tspan
+             id="tspan102"
+             y="0"
+             x="0 4.1880002 6.948 12.6 18.84">right</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g106">
+      <g
+         clip-path="url(#clipPath112)"
+         id="g108">
+        <text
+           id="text116"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,403.27,501.6)">
+          <tspan
+             id="tspan114"
+             y="0"
+             x="0">C</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g118">
+      <g
+         clip-path="url(#clipPath124)"
+         id="g120">
+        <text
+           id="text128"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,412.87,497.16)">
+          <tspan
+             id="tspan126"
+             y="0"
+             x="0 4.1880002 6.948 12.6 18.84">right</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g130">
+      <g
+         clip-path="url(#clipPath136)"
+         id="g132">
+        <text
+           id="text140"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,49.2,333.55)">
+          <tspan
+             id="tspan138"
+             y="0"
+             x="0">A</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g142">
+      <g
+         clip-path="url(#clipPath148)"
+         id="g144">
+        <text
+           id="text152"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,59.64,329.11)">
+          <tspan
+             id="tspan150"
+             y="0"
+             x="0 2.76 8.6400003 12.348">left</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g154">
+      <g
+         clip-path="url(#clipPath160)"
+         id="g156">
+        <text
+           id="text164"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,206.76,333.55)">
+          <tspan
+             id="tspan162"
+             y="0"
+             x="0">B</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g166">
+      <g
+         clip-path="url(#clipPath172)"
+         id="g168">
+        <text
+           id="text176"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,216.6,329.11)">
+          <tspan
+             id="tspan174"
+             y="0"
+             x="0 2.76 8.6400003 12.348">left</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g178">
+      <g
+         clip-path="url(#clipPath184)"
+         id="g180">
+        <text
+           id="text188"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,403.27,333.55)">
+          <tspan
+             id="tspan186"
+             y="0"
+             x="0">C</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g190">
+      <g
+         clip-path="url(#clipPath196)"
+         id="g192">
+        <text
+           id="text200"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,412.87,329.11)">
+          <tspan
+             id="tspan198"
+             y="0"
+             x="0 2.76 8.6400003 12.348">left</tspan>
+        </text>
+      </g>
+    </g>
+    <path
+       id="back-window"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       stroke ="#000000"
+       fill="none"
+       stroke-width="0.71966666"
+       stroke-opacity="1"
+       d="m 124.25993,44.105237 c -0.2152,-1.541639 0.47625,-1.192389 2.00025,-1.513417 l 13.88533,-2.395361 c 1.21709,-0.09172 1.50636,-0.257528 1.76036,1.051278 0.25753,1.312333 2.46831,7.96232 2.54353,16.774583 -0.16114,8.860392 -2.28953,15.46225 -2.54353,16.774583 -0.25752,1.308805 -0.5468,1.142998 -1.76741,1.051278 L 126.24607,73.45282 c -1.524,-0.321028 -2.15195,-0.299861 -2.00378,-1.513417 0.14817,-1.213556 1.54683,-6.248024 1.79192,-13.398878 0.23996,-7.001251 -1.55909,-12.890121 -1.77428,-14.435288 z" />
+    <path
+       id="D"
+       d="m 124.18415,50.382077 c 0.0343,-0.890241 1.29942,-0.98003 1.39703,-0.09449 0.47184,4.280429 0.37231,10.148768 -0.0472,15.042017 -0.0761,0.887643 -1.33149,0.843466 -1.34978,-0.04725 -0.10434,-5.082237 -0.13775,-11.32143 0,-14.900276 z"
+       style="fill-opacity:1;stroke:#000006;stroke-width:0.56499994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       fill="#d40000" />
+    <g
+       id="g910"
+       transform="matrix(0.35277777,0,0,-0.35277777,-24.041971,236.36781)">
+      <g
+         id="g908"
+         clip-path="url(#clipPath112)">
+        <text
+           transform="matrix(1,0,0,-1,403.27,501.6)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text906">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan904">D</tspan>
+        </text>
+      </g>
+    </g>
+  </g>
+  
+    <g
+       transform="matrix(0.10589502,0,0,0.11178956,108.38127,114.85035)"
+       id="warningLightOuter">
+      <g
+         id="g39">
+        <g
+           id="g41">
+          <path
+             id="warningLight"
+             style="fill-rule:evenodd;stroke:#385d8a;stroke-width:2.03999996;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+             fill="#4f81bd"
+             fill-opacity="1"
+             d="m 1.02,11.02 c 0,-5.52 4.48,-10 10,-10 h 94 c 5.519,0 10,4.48 10,10 v 40 c 0,5.519 -4.481,10 -10,10 h -94 c -5.52,0 -10,-4.481 -10,-10 z" />
+        </g>
+        <g
+           id="g45">
+          <path
+             id="path47"
+             style="fill-rule:evenodd;stroke:#ff0000;stroke-width:2.03999996;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+             fill="#4f81bd"
+             fill-opacity="0.2"
+             d="m 37.02,49.02 21,-36 21,36 z" />
+        </g>
+        <g
+           id="g49">
+          <path
+             id="path51"
+             style="fill-rule:evenodd;stroke:#ff0000;stroke-width:2.03999996;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+             fill="#4f81bd"
+             fill-opacity="0.2"
+             d="m 43.02,45.539 15,-25.68 15,25.68 z" />
+        </g>
+      </g>
+    </g>
+  
+</svg>
diff --git a/B2Program/LightModel/LichtUebersicht_v2.svg b/B2Program/LightModel/LichtUebersicht_v2.svg
new file mode 100644
index 0000000000000000000000000000000000000000..13a409a539440ce44377789691d6eac225418fa4
--- /dev/null
+++ b/B2Program/LightModel/LichtUebersicht_v2.svg
@@ -0,0 +1,547 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   id="svg8"
+   version="1.1"
+   viewBox="0 0 210 297"
+   height="297mm"
+   width="210mm"
+   sodipodi:docname="LichtUebersicht_v2.svg"
+   inkscape:version="0.92.2 5c3e80d, 2017-08-06">
+  <sodipodi:namedview
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1"
+     objecttolerance="10"
+     gridtolerance="10"
+     guidetolerance="10"
+     inkscape:pageopacity="0"
+     inkscape:pageshadow="2"
+     inkscape:window-width="1768"
+     inkscape:window-height="1138"
+     id="namedview108"
+     showgrid="false"
+     inkscape:zoom="1.01"
+     inkscape:cx="267.63638"
+     inkscape:cy="704.84714"
+     inkscape:window-x="1440"
+     inkscape:window-y="0"
+     inkscape:window-maximized="0"
+     inkscape:current-layer="svg8" />
+  <defs
+     id="defs2">
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath26">
+      <path
+         d="M 0,1.2207e-4 H 720 V 540.00012 H 0 Z"
+         id="path24"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath64">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path62"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath76">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path74"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath88">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path86"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath100">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path98"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath112">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path110"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath124">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path122"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath136">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path134"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath148">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path146"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath160">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path158"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath172">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path170"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath184">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path182"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath196">
+      <path
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z"
+         id="path194"
+         style="clip-rule:evenodd" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath123">
+      <path
+         d="M 0,0 H 240 V 240 H 0 Z"
+         id="path121" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath137">
+      <path
+         d="M 0,0 H 240 V 240 H 0 Z"
+         id="path135" />
+    </clipPath>
+    <clipPath
+       clipPathUnits="userSpaceOnUse"
+       id="clipPath177">
+      <path
+         d="M 0,0 H 240 V 240 H 0 Z"
+         id="path175" />
+    </clipPath>
+  </defs>
+  <metadata
+     id="metadata5">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     id="layer1">
+    <path
+       id="car_outline"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       stroke="#000000"
+       fill="none"
+       stroke-width="0.71966666"
+       stroke-opacity="1"
+       d="m 159.54511,60.511861 c 0,0 0.0844,6.523931 -0.7729,10.245736 -0.85725,3.721806 -1.28411,6.096 -4.43795,8.09625 -3.15383,2.00025 -9.49677,3.393722 -14.48152,3.90525 -4.98475,0.515056 -3.30906,-0.790223 -15.41639,-0.836083 l -57.227612,0.557389 c 0,0 -17.28611,1.721555 -23.125993,0.560916 -5.839531,-1.164166 -9.415286,-3.340805 -11.912953,-7.538861 -2.497314,-4.198055 -3.071636,-9.896753 -3.071636,-17.293165 0,-7.396413 0.629355,-12.982223 3.137253,-17.159112 2.50825,-4.176888 6.072363,-6.374694 11.910835,-7.53886 5.839884,-1.160639 23.118939,0.560916 23.118939,0.560916 l 57.220557,0.557389 c 12.1038,-0.04586 10.43164,-1.351139 15.41286,-0.836083 4.98122,0.511527 11.32769,1.905 14.478,3.90525 3.15383,2.00025 3.58422,4.374444 4.43794,8.096249 0.6189,3.376819 0.68846,6.852603 0.70692,10.299222 z" />
+    <path
+       id="A-right"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       fill="#f4eed7"
+       stroke="#000000"
+       stroke-width="0.71966666"
+       stroke-opacity="1"
+       d="m 32.434345,48.014015 c 1.51765,-1.252361 10.155767,-10.918472 10.973153,-12.544778 0.817033,-1.626305 -4.55295,1.534583 -6.070247,2.786945 -1.51765,1.255888 -2.334684,3.252611 -3.0353,4.741333 -0.700264,1.485194 -3.385256,6.272388 -1.867606,5.0165 z" />
+    <path
+       id="B-right"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       fill="none"
+       stroke="#000000"
+       stroke-width="0.71966666"
+       stroke-opacity="1"
+       d="m 74.013792,34.08282 c 0.85725,-1.721555 1.7145,-3.446638 2.575277,-4.190999 0.85725,-0.744362 2.377723,-0.931334 2.57175,-0.278695 0.197556,0.652639 -1.404055,4.191 -1.404055,4.191 l -0.112212,0.27167" />
+    <path
+       id="C-right"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       stroke="#000000"
+       stroke-width="0.71966666"
+       fill="#d40000"
+       stroke-opacity="1"
+       d="m 152.27754,37.123765 c -0.97014,-0.141111 -3.10444,-0.328083 -2.794,0.557389 0.31044,0.881944 3.25967,3.023305 4.65667,4.744861 1.397,1.721555 3.18558,5.210527 3.72886,5.584472 0.54328,0.370417 -0.0388,-1.767417 -0.46567,-3.351389 -0.42686,-1.580444 -1.28411,-4.931833 -2.09903,-6.141861 -0.81491,-1.210028 -2.05669,-1.255889 -3.02683,-1.393472 z" />
+    <path
+       id="front-window"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       fill="none"
+       stroke="#000000"
+       stroke-width="0.71966666"
+       stroke-opacity="1"
+       d="m 85.857171,70.535347 c 1.113049,2.755359 1.636728,1.789363 -0.903741,3.319639 -2.543058,1.531835 -11.571111,4.935361 -14.492111,5.863167 -2.920999,0.931333 -2.172485,1.390426 -3.037416,-0.278695 -0.917177,-1.769945 -2.133046,-5.820707 -2.753935,-9.45079 -0.624417,-3.626555 -0.946699,-7.860015 -0.943176,-11.712348 0.08114,-3.845278 0.02545,-6.509002 0.646339,-10.132029 0.624417,-3.623028 2.115911,-9.411859 3.124855,-10.992304 1.012472,-1.576917 0.119945,-1.2065 3.033889,-0.278694 2.913944,0.931333 11.90625,4.346222 14.453305,5.852583 2.547056,1.506361 2.265082,0.951176 1.254251,3.182055 -1.076472,2.375747 -2.382586,8.119789 -2.472594,12.168692 -0.104118,4.68361 1.044435,9.869595 2.090334,12.458724 z" />
+    <path
+       id="A-left"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       fill="#f4eed7"
+       stroke="#000000"
+       stroke-width="0.71966666"
+       stroke-opacity="1"
+       d="m 32.392012,68.538625 c 1.51765,1.252361 10.155766,10.918472 10.973153,12.544778 0.817033,1.626305 -4.55295,-1.534584 -6.070248,-2.786945 -1.51765,-1.255888 -2.334683,-3.252611 -3.0353,-4.741333 -0.700263,-1.485194 -3.385255,-6.272389 -1.867605,-5.0165 z" />
+    <path
+       id="B-left"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       fill="none"
+       stroke="#000000"
+       stroke-width="0.71966666"
+       stroke-opacity="1"
+       d="m 73.971458,82.512153 c 0.85725,1.707444 1.7145,3.414889 2.575278,4.155722 0.85725,0.737305 2.377722,0.92075 2.57175,0.275167 0.197556,-0.645584 -1.404056,-4.155723 -1.404056,-4.155723 l -0.141741,-0.318917" />
+    <path
+       id="C-left"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       fill="#d40000"
+       stroke="#000000"
+       stroke-width="0.71966666"
+       stroke-opacity="1"
+       d="m 152.20698,79.428875 c -0.97719,0.141111 -3.12208,0.328083 -2.80811,-0.557389 0.31045,-0.881944 3.27731,-3.023305 4.68136,-4.744861 1.40406,-1.721555 3.1997,-5.210527 3.74298,-5.584472 0.5468,-0.370417 -0.0388,1.767417 -0.46567,3.351389 -0.43039,1.580444 -1.28764,4.931833 -2.10961,6.141861 -0.81845,1.210028 -2.06728,1.255889 -3.04095,1.393472 z" />
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g58">
+      <g
+         clip-path="url(#clipPath64)"
+         id="g60">
+        <text
+           id="text68"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,49.2,501.6)">
+          <tspan
+             id="tspan66"
+             y="0"
+             x="0">A</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g70">
+      <g
+         clip-path="url(#clipPath76)"
+         id="g72">
+        <text
+           id="text80"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,59.64,497.16)">
+          <tspan
+             id="tspan78"
+             y="0"
+             x="0 4.1880002 6.948 12.6 18.84">right</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g82">
+      <g
+         clip-path="url(#clipPath88)"
+         id="g84">
+        <text
+           id="text92"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,206.76,501.6)">
+          <tspan
+             id="tspan90"
+             y="0"
+             x="0">B</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g94">
+      <g
+         clip-path="url(#clipPath100)"
+         id="g96">
+        <text
+           id="text104"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,216.6,497.16)">
+          <tspan
+             id="tspan102"
+             y="0"
+             x="0 4.1880002 6.948 12.6 18.84">right</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g106">
+      <g
+         clip-path="url(#clipPath112)"
+         id="g108">
+        <text
+           id="text116"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,403.27,501.6)">
+          <tspan
+             id="tspan114"
+             y="0"
+             x="0">C</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g118">
+      <g
+         clip-path="url(#clipPath124)"
+         id="g120">
+        <text
+           id="text128"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,412.87,497.16)">
+          <tspan
+             id="tspan126"
+             y="0"
+             x="0 4.1880002 6.948 12.6 18.84">right</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g130">
+      <g
+         clip-path="url(#clipPath136)"
+         id="g132">
+        <text
+           id="text140"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,49.2,333.55)">
+          <tspan
+             id="tspan138"
+             y="0"
+             x="0">A</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g142">
+      <g
+         clip-path="url(#clipPath148)"
+         id="g144">
+        <text
+           id="text152"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,59.64,329.11)">
+          <tspan
+             id="tspan150"
+             y="0"
+             x="0 2.76 8.6400003 12.348">left</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g154">
+      <g
+         clip-path="url(#clipPath160)"
+         id="g156">
+        <text
+           id="text164"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,206.76,333.55)">
+          <tspan
+             id="tspan162"
+             y="0"
+             x="0">B</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g166">
+      <g
+         clip-path="url(#clipPath172)"
+         id="g168">
+        <text
+           id="text176"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,216.6,329.11)">
+          <tspan
+             id="tspan174"
+             y="0"
+             x="0 2.76 8.6400003 12.348">left</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g178">
+      <g
+         clip-path="url(#clipPath184)"
+         id="g180">
+        <text
+           id="text188"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,403.27,333.55)">
+          <tspan
+             id="tspan186"
+             y="0"
+             x="0">C</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)"
+       id="g190">
+      <g
+         clip-path="url(#clipPath196)"
+         id="g192">
+        <text
+           id="text200"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,412.87,329.11)">
+          <tspan
+             id="tspan198"
+             y="0"
+             x="0 2.76 8.6400003 12.348">left</tspan>
+        </text>
+      </g>
+    </g>
+    <path
+       id="back-window"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       stroke="#000000"
+       fill="none"
+       stroke-width="0.71966666"
+       stroke-opacity="1"
+       d="m 124.25993,44.105237 c -0.2152,-1.541639 0.47625,-1.192389 2.00025,-1.513417 l 13.88533,-2.395361 c 1.21709,-0.09172 1.50636,-0.257528 1.76036,1.051278 0.25753,1.312333 2.46831,7.96232 2.54353,16.774583 -0.16114,8.860392 -2.28953,15.46225 -2.54353,16.774583 -0.25752,1.308805 -0.5468,1.142998 -1.76741,1.051278 L 126.24607,73.45282 c -1.524,-0.321028 -2.15195,-0.299861 -2.00378,-1.513417 0.14817,-1.213556 1.54683,-6.248024 1.79192,-13.398878 0.23996,-7.001251 -1.55909,-12.890121 -1.77428,-14.435288 z" />
+    <path
+       id="D-centre"
+       d="m 124.18415,50.382077 c 0.0343,-0.890241 1.29942,-0.98003 1.39703,-0.09449 0.47184,4.280429 0.37231,10.148768 -0.0472,15.042017 -0.0761,0.887643 -1.33149,0.843466 -1.34978,-0.04725 -0.10434,-5.082237 -0.13775,-11.32143 0,-14.900276 z"
+       style="stroke:#000006;stroke-width:0.56499994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       fill-opacity="0.5"
+       fill="#d40000" />
+    <g
+       id="g910"
+       transform="matrix(0.35277777,0,0,-0.35277777,-24.041971,236.36781)">
+      <g
+         id="g908"
+         clip-path="url(#clipPath112)">
+        <text
+           transform="matrix(1,0,0,-1,403.27,501.6)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text906">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan904">D</tspan>
+        </text>
+      </g>
+    </g>
+  </g>
+  <g
+     id="g129"
+     transform="translate(-39.120636,-7.1685344)">
+    <g
+       id="warningLightOuter"
+       transform="matrix(0.10589502,0,0,0.11178956,108.38127,114.85035)">
+      <g
+         id="g39">
+        <g
+           id="g41">
+          <path
+             inkscape:connector-curvature="0"
+             d="m 1.02,11.02 c 0,-5.52 4.48,-10 10,-10 h 94 c 5.519,0 10,4.48 10,10 v 40 c 0,5.519 -4.481,10 -10,10 h -94 c -5.52,0 -10,-4.481 -10,-10 z"
+             style="fill:#4f81bd;fill-rule:evenodd;stroke:#385d8a;stroke-width:2.03999996;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+             fill-opacity="1"
+             id="warningLight" />
+        </g>
+        <g
+           id="g45">
+          <path
+             inkscape:connector-curvature="0"
+             d="m 37.02,49.02 21,-36 21,36 z"
+             fill-opacity="0.2"
+             style="fill:#4f81bd;fill-rule:evenodd;stroke:#ff0000;stroke-width:2.03999996;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+             id="path47" />
+        </g>
+        <g
+           id="g49">
+          <path
+             inkscape:connector-curvature="0"
+             d="m 43.02,45.539 15,-25.68 15,25.68 z"
+             fill-opacity="0.2"
+             style="fill:#4f81bd;fill-rule:evenodd;stroke:#ff0000;stroke-width:2.03999996;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+             id="path51" />
+        </g>
+      </g>
+    </g>
+  </g>
+  <ellipse
+     id="PitmanNeutral"
+     cx="58.412617"
+     cy="110.93323"
+     rx="2.0774357"
+     ry="2.0876832"
+     fill="#95b3d7"
+     fill-opacity="1"
+     style="stroke-width:0.14762825"
+     inkscape:label="#path131" />
+  <g
+     id="g112"
+     transform="translate(-11.526402,26.720298)">
+    <path
+       id="PitmanDownward"
+       fill="#95b3d7"
+       fill-opacity="1"
+       style="fill-rule:evenodd;stroke:none;stroke-width:0.35277778"
+       d="m 67.234809,96.910218 h 1.111955 v -5.354813 h 2.222853 v 5.354813 h 1.110544 l -2.222852,2.222853 z"
+       inkscape:label="#path865"
+       inkscape:connector-curvature="0" />
+    <path
+       id="PitmanUpward"
+       fill="#95b3d7"
+       fill-opacity="1"
+       style="fill-rule:evenodd;stroke:none;stroke-width:0.35277778"
+       d="m 67.530789,71.299611 h 1.112308 v 5.354813 h 2.222853 v -5.354813 h 1.110545 l -2.222853,-2.222853 z"
+       inkscape:label="#path867"
+       inkscape:connector-curvature="0" />
+  </g>
+</svg>
diff --git a/B2Program/LightModel/LichtUebersicht_v3.svg b/B2Program/LightModel/LichtUebersicht_v3.svg
new file mode 100644
index 0000000000000000000000000000000000000000..520635cdef35e2cd784d0c4f443311d70eba9f82
--- /dev/null
+++ b/B2Program/LightModel/LichtUebersicht_v3.svg
@@ -0,0 +1,703 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   width="210mm"
+   height="297mm"
+   viewBox="0 0 210 297"
+   version="1.1"
+   id="svg8">
+  <defs
+     id="defs2">
+    <clipPath
+       id="clipPath26"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path24"
+         d="M 0,1.2207e-4 H 720 V 540.00012 H 0 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath64"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path62"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath76"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path74"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath88"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path86"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath100"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path98"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath112"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path110"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath124"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path122"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath136"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path134"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath148"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path146"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath160"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path158"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath172"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path170"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath184"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path182"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath196"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path194"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath123"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         id="path121"
+         d="M 0,0 H 240 V 240 H 0 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath137"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         id="path135"
+         d="M 0,0 H 240 V 240 H 0 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath177"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         id="path175"
+         d="M 0,0 H 240 V 240 H 0 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath835"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         id="path833"
+         d="M 0,0 H 158 V 86 H 0 Z" />
+    </clipPath>
+    <radialGradient
+       id="radialGradient859"
+       spreadMethod="pad"
+       gradientTransform="matrix(19.209,0,0,-19.209,44.999999,41.999984)"
+       gradientUnits="userSpaceOnUse"
+       r="1"
+       cy="0"
+       cx="0"
+       fy="0"
+       fx="0">
+      <stop
+         id="stop853"
+         offset="0"
+         style="stop-opacity:1;stop-color:#212121" />
+      <stop
+         id="stop855"
+         offset="0.5"
+         style="stop-opacity:1;stop-color:#343434" />
+      <stop
+         id="stop857"
+         offset="1"
+         style="stop-opacity:1;stop-color:#404040" />
+    </radialGradient>
+    <clipPath
+       id="clipPath877"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         id="path875"
+         d="M 0,0 H 158 V 86 H 0 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath891"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         id="path889"
+         d="M 0,0 H 158 V 86 H 0 Z" />
+    </clipPath>
+  </defs>
+  <metadata
+     id="metadata5">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     id="layer1">
+    <path
+       d="m 159.54511,60.511861 c 0,0 0.0844,6.523931 -0.7729,10.245736 -0.85725,3.721806 -1.28411,6.096 -4.43795,8.09625 -3.15383,2.00025 -9.49677,3.393722 -14.48152,3.90525 -4.98475,0.515056 -3.30906,-0.790223 -15.41639,-0.836083 l -57.227612,0.557389 c 0,0 -17.28611,1.721555 -23.125993,0.560916 -5.839531,-1.164166 -9.415286,-3.340805 -11.912953,-7.538861 -2.497314,-4.198055 -3.071636,-9.896753 -3.071636,-17.293165 0,-7.396413 0.629355,-12.982223 3.137253,-17.159112 2.50825,-4.176888 6.072363,-6.374694 11.910835,-7.53886 5.839884,-1.160639 23.118939,0.560916 23.118939,0.560916 l 57.220557,0.557389 c 12.1038,-0.04586 10.43164,-1.351139 15.41286,-0.836083 4.98122,0.511527 11.32769,1.905 14.478,3.90525 3.15383,2.00025 3.58422,4.374444 4.43794,8.096249 0.6189,3.376819 0.68846,6.852603 0.70692,10.299222 z"
+       stroke-opacity="1"
+       stroke-width="0.71966666"
+       fill="none"
+       stroke="#000000"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       id="car_outline" />
+    <path
+       d="m 32.434345,48.014015 c 1.51765,-1.252361 10.155767,-10.918472 10.973153,-12.544778 0.817033,-1.626305 -4.55295,1.534583 -6.070247,2.786945 -1.51765,1.255888 -2.334684,3.252611 -3.0353,4.741333 -0.700264,1.485194 -3.385256,6.272388 -1.867606,5.0165 z"
+       stroke-opacity="1"
+       stroke-width="0.71966666"
+       stroke="#000000"
+       fill="#f4eed7"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       id="A-right" />
+    <path
+       d="m 74.013792,34.08282 c 0.85725,-1.721555 1.7145,-3.446638 2.575277,-4.190999 0.85725,-0.744362 2.377723,-0.931334 2.57175,-0.278695 0.197556,0.652639 -1.404055,4.191 -1.404055,4.191 l -0.112212,0.27167"
+       stroke-opacity="1"
+       stroke-width="0.71966666"
+       stroke="#000000"
+       fill="none"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       id="B-right" />
+    <path
+       d="m 152.27754,37.123765 c -0.97014,-0.141111 -3.10444,-0.328083 -2.794,0.557389 0.31044,0.881944 3.25967,3.023305 4.65667,4.744861 1.397,1.721555 3.18558,5.210527 3.72886,5.584472 0.54328,0.370417 -0.0388,-1.767417 -0.46567,-3.351389 -0.42686,-1.580444 -1.28411,-4.931833 -2.09903,-6.141861 -0.81491,-1.210028 -2.05669,-1.255889 -3.02683,-1.393472 z"
+       stroke-opacity="1"
+       fill="#d40000"
+       stroke-width="0.71966666"
+       stroke="#000000"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       id="C-right" />
+    <path
+       d="m 85.857171,70.535347 c 1.113049,2.755359 1.636728,1.789363 -0.903741,3.319639 -2.543058,1.531835 -11.571111,4.935361 -14.492111,5.863167 -2.920999,0.931333 -2.172485,1.390426 -3.037416,-0.278695 -0.917177,-1.769945 -2.133046,-5.820707 -2.753935,-9.45079 -0.624417,-3.626555 -0.946699,-7.860015 -0.943176,-11.712348 0.08114,-3.845278 0.02545,-6.509002 0.646339,-10.132029 0.624417,-3.623028 2.115911,-9.411859 3.124855,-10.992304 1.012472,-1.576917 0.119945,-1.2065 3.033889,-0.278694 2.913944,0.931333 11.90625,4.346222 14.453305,5.852583 2.547056,1.506361 2.265082,0.951176 1.254251,3.182055 -1.076472,2.375747 -2.382586,8.119789 -2.472594,12.168692 -0.104118,4.68361 1.044435,9.869595 2.090334,12.458724 z"
+       stroke-opacity="1"
+       stroke-width="0.71966666"
+       stroke="#000000"
+       fill="none"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       id="front-window" />
+    <path
+       d="m 32.392012,68.538625 c 1.51765,1.252361 10.155766,10.918472 10.973153,12.544778 0.817033,1.626305 -4.55295,-1.534584 -6.070248,-2.786945 -1.51765,-1.255888 -2.334683,-3.252611 -3.0353,-4.741333 -0.700263,-1.485194 -3.385255,-6.272389 -1.867605,-5.0165 z"
+       stroke-opacity="1"
+       stroke-width="0.71966666"
+       stroke="#000000"
+       fill="#f4eed7"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       id="A-left" />
+    <path
+       d="m 73.971458,82.512153 c 0.85725,1.707444 1.7145,3.414889 2.575278,4.155722 0.85725,0.737305 2.377722,0.92075 2.57175,0.275167 0.197556,-0.645584 -1.404056,-4.155723 -1.404056,-4.155723 l -0.141741,-0.318917"
+       stroke-opacity="1"
+       stroke-width="0.71966666"
+       stroke="#000000"
+       fill="none"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       id="B-left" />
+    <path
+       d="m 152.20698,79.428875 c -0.97719,0.141111 -3.12208,0.328083 -2.80811,-0.557389 0.31045,-0.881944 3.27731,-3.023305 4.68136,-4.744861 1.40406,-1.721555 3.1997,-5.210527 3.74298,-5.584472 0.5468,-0.370417 -0.0388,1.767417 -0.46567,3.351389 -0.43039,1.580444 -1.28764,4.931833 -2.10961,6.141861 -0.81845,1.210028 -2.06728,1.255889 -3.04095,1.393472 z"
+       stroke-opacity="1"
+       stroke-width="0.71966666"
+       stroke="#000000"
+       fill="#d40000"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       id="C-left" />
+    <g
+       id="g58"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g60"
+         clip-path="url(#clipPath64)">
+        <text
+           transform="matrix(1,0,0,-1,49.2,501.6)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text68">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan66">A</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g70"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g72"
+         clip-path="url(#clipPath76)">
+        <text
+           transform="matrix(1,0,0,-1,59.64,497.16)"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text80">
+          <tspan
+             x="0 4.1880002 6.948 12.6 18.84"
+             y="0"
+             id="tspan78">right</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g82"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g84"
+         clip-path="url(#clipPath88)">
+        <text
+           transform="matrix(1,0,0,-1,206.76,501.6)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text92">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan90">B</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g94"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g96"
+         clip-path="url(#clipPath100)">
+        <text
+           transform="matrix(1,0,0,-1,216.6,497.16)"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text104">
+          <tspan
+             x="0 4.1880002 6.948 12.6 18.84"
+             y="0"
+             id="tspan102">right</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g106"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g108"
+         clip-path="url(#clipPath112)">
+        <text
+           transform="matrix(1,0,0,-1,403.27,501.6)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text116">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan114">C</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g118"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g120"
+         clip-path="url(#clipPath124)">
+        <text
+           transform="matrix(1,0,0,-1,412.87,497.16)"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text128">
+          <tspan
+             x="0 4.1880002 6.948 12.6 18.84"
+             y="0"
+             id="tspan126">right</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g130"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g132"
+         clip-path="url(#clipPath136)">
+        <text
+           transform="matrix(1,0,0,-1,49.2,333.55)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text140">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan138">A</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g142"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g144"
+         clip-path="url(#clipPath148)">
+        <text
+           transform="matrix(1,0,0,-1,59.64,329.11)"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text152">
+          <tspan
+             x="0 2.76 8.6400003 12.348"
+             y="0"
+             id="tspan150">left</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g154"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g156"
+         clip-path="url(#clipPath160)">
+        <text
+           transform="matrix(1,0,0,-1,206.76,333.55)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text164">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan162">B</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g166"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g168"
+         clip-path="url(#clipPath172)">
+        <text
+           transform="matrix(1,0,0,-1,216.6,329.11)"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text176">
+          <tspan
+             x="0 2.76 8.6400003 12.348"
+             y="0"
+             id="tspan174">left</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g178"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g180"
+         clip-path="url(#clipPath184)">
+        <text
+           transform="matrix(1,0,0,-1,403.27,333.55)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text188">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan186">C</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g190"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g192"
+         clip-path="url(#clipPath196)">
+        <text
+           transform="matrix(1,0,0,-1,412.87,329.11)"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text200">
+          <tspan
+             x="0 2.76 8.6400003 12.348"
+             y="0"
+             id="tspan198">left</tspan>
+        </text>
+      </g>
+    </g>
+    <path
+       d="m 124.25993,44.105237 c -0.2152,-1.541639 0.47625,-1.192389 2.00025,-1.513417 l 13.88533,-2.395361 c 1.21709,-0.09172 1.50636,-0.257528 1.76036,1.051278 0.25753,1.312333 2.46831,7.96232 2.54353,16.774583 -0.16114,8.860392 -2.28953,15.46225 -2.54353,16.774583 -0.25752,1.308805 -0.5468,1.142998 -1.76741,1.051278 L 126.24607,73.45282 c -1.524,-0.321028 -2.15195,-0.299861 -2.00378,-1.513417 0.14817,-1.213556 1.54683,-6.248024 1.79192,-13.398878 0.23996,-7.001251 -1.55909,-12.890121 -1.77428,-14.435288 z"
+       stroke-opacity="1"
+       stroke-width="0.71966666"
+       fill="none"
+       stroke="#000000"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       id="back-window" />
+    <path
+       fill="#d40000"
+       fill-opacity="0.5"
+       style="stroke:#000006;stroke-width:0.56499994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="m 124.18415,50.382077 c 0.0343,-0.890241 1.29942,-0.98003 1.39703,-0.09449 0.47184,4.280429 0.37231,10.148768 -0.0472,15.042017 -0.0761,0.887643 -1.33149,0.843466 -1.34978,-0.04725 -0.10434,-5.082237 -0.13775,-11.32143 0,-14.900276 z"
+       id="D-centre" />
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,-24.041971,236.36781)"
+       id="g910">
+      <g
+         clip-path="url(#clipPath112)"
+         id="g908">
+        <text
+           id="text906"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,403.27,501.6)">
+          <tspan
+             id="tspan904"
+             y="0"
+             x="0">D</tspan>
+        </text>
+      </g>
+    </g>
+  </g>
+  <g
+     transform="matrix(1.7238627,0,0,1.8327494,-86.91809,-98.362844)"
+     id="g129">
+    <g
+       transform="matrix(0.10589502,0,0,0.11178956,108.38127,114.85035)"
+       id="warningLightOuter">
+      <g
+         id="g39">
+        <g
+           id="g41">
+          <path
+             id="warningLight"
+             style="fill:#4f81bd;fill-opacity:1;fill-rule:evenodd;stroke:#385d8a;stroke-width:2.03999996;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+             d="m 1.02,11.02 c 0,-5.52 4.48,-10 10,-10 h 94 c 5.519,0 10,4.48 10,10 v 40 c 0,5.519 -4.481,10 -10,10 h -94 c -5.52,0 -10,-4.481 -10,-10 z" />
+        </g>
+        <g
+           id="g45">
+          <path
+             id="path47"
+             style="fill:#4f81bd;fill-opacity:0.2;fill-rule:evenodd;stroke:#ff0000;stroke-width:2.03999996;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+             d="m 37.02,49.02 21,-36 21,36 z" />
+        </g>
+        <g
+           id="g49">
+          <path
+             id="path51"
+             style="fill:#4f81bd;fill-opacity:0.2;fill-rule:evenodd;stroke:#ff0000;stroke-width:2.03999996;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+             d="m 43.02,45.539 15,-25.68 15,25.68 z" />
+        </g>
+      </g>
+    </g>
+  </g>
+  <g
+     transform="translate(-20.96062,38.501179)"
+     id="layer1-2">
+    <g
+       transform="matrix(0.35277777,0,0,0.35277777,55.288846,63.501609)"
+       id="g823">
+      <g
+         id="g825">
+        <g
+           id="g827">
+          <g
+             id="g829">
+            <g
+               clip-path="url(#clipPath835)"
+               id="g831">
+              <g
+                 id="g837">
+                <path
+                   id="lever"
+                   style="fill:#595959;fill-opacity:1;fill-rule:evenodd;stroke:none"
+                   d="m 90.738,47.328 67.242,12.953 -0.742,3.84 L 90,51.172 Z" />
+              </g>
+            </g>
+          </g>
+        </g>
+        <path
+           id="lever-holder"
+           style="fill:#7f7f7f;fill-opacity:1;fill-rule:evenodd;stroke:none"
+           d="m 57.602,30.238 39.839,15.672 -0.41,9.891 -38.672,-2.84 z" />
+        <g
+           id="g843">
+          <g
+             id="g845">
+            <g
+               id="g851">
+              <path
+                 id="rectangle"
+                 style="fill:url(#radialGradient859);fill-rule:evenodd;stroke:none"
+                 d="m 30,34 c 0,-2.211 1.789,-4 4,-4 h 22 c 2.211,0 4,1.789 4,4 v 16 c 0,2.211 -1.789,4 -4,4 H 34 c -2.211,0 -4,-1.789 -4,-4 z" />
+            </g>
+          </g>
+        </g>
+        <path
+           id="shadow"
+           style="fill:#595959;fill-opacity:1;fill-rule:evenodd;stroke:none"
+           d="M 61.84,52.801 98.16,54.82 89.949,56.762 32.16,53.609 Z" />
+        <path
+           id="arrow-1"
+           style="fill:#95b3d7;fill-opacity:1;fill-rule:evenodd;stroke:none"
+           d="m 40.559,78.898 h 3.152 V 63.719 h 6.301 v 15.179 h 3.148 l -6.301,6.301 z" />
+        <path
+           id="arrow-2"
+           style="fill:#95b3d7;fill-opacity:1;fill-rule:evenodd;stroke:none"
+           d="m 41.398,6.301 h 3.153 V 21.48 h 6.301 V 6.301 H 54 L 47.699,0 Z" />
+        <g
+           id="g869">
+            <g
+               clip-path="url(#clipPath877)"
+               id="g873">
+                <path
+                   id="arrow-1"
+                   style="fill:#95b3d7;fill-opacity:1;fill-rule:evenodd;stroke:none"
+                   d="m 87.18,36.359 v 3.153 H 72 v 6.297 h 15.18 v 3.152 l 6.3,-6.301 z" />
+          </g>
+        </g>
+            <g
+               clip-path="url(#clipPath891)"
+               id="arrow-4">
+                <path
+                   id="path895"
+                   style="fill:#95b3d7;fill-opacity:1;fill-rule:evenodd;stroke:none"
+                   d="m 6.301,36.359 v 3.153 H 21.48 v 6.297 H 6.301 v 3.152 L 0,42.66 Z" />
+        </g>
+      </g>
+    </g>
+    <g
+       id="circled-2"
+       transform="matrix(0.50000001,0,0,0.50000001,37.311567,17.458633)">
+      <circle
+         r="4.4767647"
+         cy="86.391617"
+         cx="69.623711"
+         id="path875-3"
+         style="fill:none;fill-opacity:1;stroke:#95b3d7;stroke-width:0.56499994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <text
+         id="text879"
+         y="88.663406"
+         x="67.819641"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:1.25;font-family:AIGDT;-inkscape-font-specification:AIGDT;letter-spacing:0px;word-spacing:0px;fill:#95b3d7;fill-opacity:1;stroke:none;stroke-width:0.26458332"
+         xml:space="preserve"><tspan
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7.05555534px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans';fill:#95b3d7;fill-opacity:1;stroke-width:0.26458332"
+           y="88.663406"
+           x="67.819641"
+           id="tspan877">2</tspan><tspan
+           id="tspan881"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:AIGDT;-inkscape-font-specification:AIGDT;fill:#95b3d7;fill-opacity:1;stroke-width:0.26458332"
+           y="101.89257"
+           x="67.819641" /></text>
+    </g>
+    <g
+       id="circled-1"
+       transform="matrix(0.50000001,0,0,0.50000001,56.399491,35.416294)">
+      <circle
+         style="fill:none;fill-opacity:1;stroke:#95b3d7;stroke-width:0.56499994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         id="circle885"
+         cx="69.623711"
+         cy="86.391617"
+         r="4.4767647" />
+      <text
+         xml:space="preserve"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:1.25;font-family:AIGDT;-inkscape-font-specification:AIGDT;letter-spacing:0px;word-spacing:0px;fill:#95b3d7;fill-opacity:1;stroke:none;stroke-width:0.26458332"
+         x="67.819641"
+         y="88.663406"
+         id="text891"><tspan
+           id="tspan887"
+           x="67.819641"
+           y="88.663406"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7.05555534px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans';fill:#95b3d7;fill-opacity:1;stroke-width:0.26458332">1</tspan><tspan
+           x="67.819641"
+           y="101.89257"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:AIGDT;-inkscape-font-specification:AIGDT;fill:#95b3d7;fill-opacity:1;stroke-width:0.26458332"
+           id="tspan889" /></text>
+    </g>
+    <g
+       transform="matrix(0.50000001,0,0,0.50000001,37.010396,53.209273)"
+       id="circled-3">
+      <circle
+         style="fill:none;fill-opacity:1;stroke:#95b3d7;stroke-width:0.56499994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         id="circle895"
+         cx="69.623711"
+         cy="86.391617"
+         r="4.4767647" />
+      <text
+         xml:space="preserve"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:1.25;font-family:AIGDT;-inkscape-font-specification:AIGDT;letter-spacing:0px;word-spacing:0px;fill:#95b3d7;fill-opacity:1;stroke:none;stroke-width:0.26458332"
+         x="67.819641"
+         y="88.663406"
+         id="text901"><tspan
+           id="tspan897"
+           x="67.819641"
+           y="88.663406"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7.05555534px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans';fill:#95b3d7;fill-opacity:1;stroke-width:0.26458332">3</tspan><tspan
+           x="67.819641"
+           y="101.89257"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:AIGDT;-inkscape-font-specification:AIGDT;fill:#95b3d7;fill-opacity:1;stroke-width:0.26458332"
+           id="tspan899" /></text>
+    </g>
+    <g
+       id="circled-4"
+       transform="matrix(0.50000001,0,0,0.50000001,17.399857,35.285018)">
+      <circle
+         r="4.4767647"
+         cy="86.391617"
+         cx="69.623711"
+         id="circle905"
+         style="fill:none;fill-opacity:1;stroke:#95b3d7;stroke-width:0.56499994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <text
+         id="text911"
+         y="88.663406"
+         x="67.819641"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:1.25;font-family:AIGDT;-inkscape-font-specification:AIGDT;letter-spacing:0px;word-spacing:0px;fill:#95b3d7;fill-opacity:1;stroke:none;stroke-width:0.26458332"
+         xml:space="preserve"><tspan
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7.05555534px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans';fill:#95b3d7;fill-opacity:1;stroke-width:0.26458332"
+           y="88.663406"
+           x="67.819641"
+           id="tspan907">4</tspan><tspan
+           id="tspan909"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:AIGDT;-inkscape-font-specification:AIGDT;fill:#95b3d7;fill-opacity:1;stroke-width:0.26458332"
+           y="101.89257"
+           x="67.819641" /></text>
+    </g>
+  </g>
+</svg>
diff --git a/B2Program/LightModel/LichtUebersicht_v4.svg b/B2Program/LightModel/LichtUebersicht_v4.svg
new file mode 100644
index 0000000000000000000000000000000000000000..0c1ccfcc84d9835ab3394bbdcfd40786a92416fd
--- /dev/null
+++ b/B2Program/LightModel/LichtUebersicht_v4.svg
@@ -0,0 +1,896 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   width="210mm"
+   height="297mm"
+   viewBox="0 0 210 297"
+   version="1.1"
+   id="svg8">
+  <defs
+     id="defs2">
+    <clipPath
+       id="clipPath26"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path24"
+         d="M 0,1.2207e-4 H 720 V 540.00012 H 0 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath64"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path62"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath76"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path74"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath88"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path86"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath100"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path98"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath112"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path110"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath124"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path122"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath136"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path134"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath148"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path146"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath160"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path158"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath172"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path170"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath184"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path182"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath196"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path194"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath123"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         id="path121"
+         d="M 0,0 H 240 V 240 H 0 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath137"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         id="path135"
+         d="M 0,0 H 240 V 240 H 0 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath177"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         id="path175"
+         d="M 0,0 H 240 V 240 H 0 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath835"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         id="path833"
+         d="M 0,0 H 158 V 86 H 0 Z" />
+    </clipPath>
+    <radialGradient
+       id="radialGradient859"
+       spreadMethod="pad"
+       gradientTransform="matrix(19.209,0,0,-19.209,44.999999,41.999984)"
+       gradientUnits="userSpaceOnUse"
+       r="1"
+       cy="0"
+       cx="0"
+       fy="0"
+       fx="0">
+      <stop
+         id="stop853"
+         offset="0"
+         style="stop-opacity:1;stop-color:#212121" />
+      <stop
+         id="stop855"
+         offset="0.5"
+         style="stop-opacity:1;stop-color:#343434" />
+      <stop
+         id="stop857"
+         offset="1"
+         style="stop-opacity:1;stop-color:#404040" />
+    </radialGradient>
+    <clipPath
+       id="clipPath877"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         id="path875"
+         d="M 0,0 H 158 V 86 H 0 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath891"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         id="path889"
+         d="M 0,0 H 158 V 86 H 0 Z" />
+    </clipPath>
+  </defs>
+  <metadata
+     id="metadata5">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     id="layer1">
+    <path
+       d="m 159.54511,60.511861 c 0,0 0.0844,6.523931 -0.7729,10.245736 -0.85725,3.721806 -1.28411,6.096 -4.43795,8.09625 -3.15383,2.00025 -9.49677,3.393722 -14.48152,3.90525 -4.98475,0.515056 -3.30906,-0.790223 -15.41639,-0.836083 l -57.227612,0.557389 c 0,0 -17.28611,1.721555 -23.125993,0.560916 -5.839531,-1.164166 -9.415286,-3.340805 -11.912953,-7.538861 -2.497314,-4.198055 -3.071636,-9.896753 -3.071636,-17.293165 0,-7.396413 0.629355,-12.982223 3.137253,-17.159112 2.50825,-4.176888 6.072363,-6.374694 11.910835,-7.53886 5.839884,-1.160639 23.118939,0.560916 23.118939,0.560916 l 57.220557,0.557389 c 12.1038,-0.04586 10.43164,-1.351139 15.41286,-0.836083 4.98122,0.511527 11.32769,1.905 14.478,3.90525 3.15383,2.00025 3.58422,4.374444 4.43794,8.096249 0.6189,3.376819 0.68846,6.852603 0.70692,10.299222 z"
+       stroke-opacity="1"
+       stroke-width="0.71966666"
+       fill="none"
+       stroke="#000000"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       id="car_outline" />
+    <path
+       d="m 32.434345,48.014015 c 1.51765,-1.252361 10.155767,-10.918472 10.973153,-12.544778 0.817033,-1.626305 -4.55295,1.534583 -6.070247,2.786945 -1.51765,1.255888 -2.334684,3.252611 -3.0353,4.741333 -0.700264,1.485194 -3.385256,6.272388 -1.867606,5.0165 z"
+       stroke-opacity="1"
+       stroke-width="0.71966666"
+       stroke="#000000"
+       fill="#f4eed7"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       id="A-right" />
+    <path
+       d="m 74.013792,34.08282 c 0.85725,-1.721555 1.7145,-3.446638 2.575277,-4.190999 0.85725,-0.744362 2.377723,-0.931334 2.57175,-0.278695 0.197556,0.652639 -1.404055,4.191 -1.404055,4.191 l -0.112212,0.27167"
+       stroke-opacity="1"
+       stroke-width="0.71966666"
+       stroke="#000000"
+       fill="none"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       id="B-right" />
+    <path
+       d="m 152.27754,37.123765 c -0.97014,-0.141111 -3.10444,-0.328083 -2.794,0.557389 0.31044,0.881944 3.25967,3.023305 4.65667,4.744861 1.397,1.721555 3.18558,5.210527 3.72886,5.584472 0.54328,0.370417 -0.0388,-1.767417 -0.46567,-3.351389 -0.42686,-1.580444 -1.28411,-4.931833 -2.09903,-6.141861 -0.81491,-1.210028 -2.05669,-1.255889 -3.02683,-1.393472 z"
+       stroke-opacity="1"
+       fill="#d40000"
+       stroke-width="0.71966666"
+       stroke="#000000"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       id="C-right" />
+    <path
+       d="m 85.857171,70.535347 c 1.113049,2.755359 1.636728,1.789363 -0.903741,3.319639 -2.543058,1.531835 -11.571111,4.935361 -14.492111,5.863167 -2.920999,0.931333 -2.172485,1.390426 -3.037416,-0.278695 -0.917177,-1.769945 -2.133046,-5.820707 -2.753935,-9.45079 -0.624417,-3.626555 -0.946699,-7.860015 -0.943176,-11.712348 0.08114,-3.845278 0.02545,-6.509002 0.646339,-10.132029 0.624417,-3.623028 2.115911,-9.411859 3.124855,-10.992304 1.012472,-1.576917 0.119945,-1.2065 3.033889,-0.278694 2.913944,0.931333 11.90625,4.346222 14.453305,5.852583 2.547056,1.506361 2.265082,0.951176 1.254251,3.182055 -1.076472,2.375747 -2.382586,8.119789 -2.472594,12.168692 -0.104118,4.68361 1.044435,9.869595 2.090334,12.458724 z"
+       stroke-opacity="1"
+       stroke-width="0.71966666"
+       stroke="#000000"
+       fill="none"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       id="front-window" />
+    <path
+       d="m 32.392012,68.538625 c 1.51765,1.252361 10.155766,10.918472 10.973153,12.544778 0.817033,1.626305 -4.55295,-1.534584 -6.070248,-2.786945 -1.51765,-1.255888 -2.334683,-3.252611 -3.0353,-4.741333 -0.700263,-1.485194 -3.385255,-6.272389 -1.867605,-5.0165 z"
+       stroke-opacity="1"
+       stroke-width="0.71966666"
+       stroke="#000000"
+       fill="#f4eed7"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       id="A-left" />
+    <path
+       d="m 73.971458,82.512153 c 0.85725,1.707444 1.7145,3.414889 2.575278,4.155722 0.85725,0.737305 2.377722,0.92075 2.57175,0.275167 0.197556,-0.645584 -1.404056,-4.155723 -1.404056,-4.155723 l -0.141741,-0.318917"
+       stroke-opacity="1"
+       stroke-width="0.71966666"
+       stroke="#000000"
+       fill="none"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       id="B-left" />
+    <path
+       d="m 152.20698,79.428875 c -0.97719,0.141111 -3.12208,0.328083 -2.80811,-0.557389 0.31045,-0.881944 3.27731,-3.023305 4.68136,-4.744861 1.40406,-1.721555 3.1997,-5.210527 3.74298,-5.584472 0.5468,-0.370417 -0.0388,1.767417 -0.46567,3.351389 -0.43039,1.580444 -1.28764,4.931833 -2.10961,6.141861 -0.81845,1.210028 -2.06728,1.255889 -3.04095,1.393472 z"
+       stroke-opacity="1"
+       stroke-width="0.71966666"
+       stroke="#000000"
+       fill="#d40000"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       id="C-left" />
+    <g
+       id="g58"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g60"
+         clip-path="url(#clipPath64)">
+        <text
+           transform="matrix(1,0,0,-1,49.2,501.6)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text68">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan66">A</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g70"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g72"
+         clip-path="url(#clipPath76)">
+        <text
+           transform="matrix(1,0,0,-1,59.64,497.16)"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text80">
+          <tspan
+             x="0 4.1880002 6.948 12.6 18.84"
+             y="0"
+             id="tspan78">right</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g82"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g84"
+         clip-path="url(#clipPath88)">
+        <text
+           transform="matrix(1,0,0,-1,206.76,501.6)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text92">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan90">B</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g94"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g96"
+         clip-path="url(#clipPath100)">
+        <text
+           transform="matrix(1,0,0,-1,216.6,497.16)"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text104">
+          <tspan
+             x="0 4.1880002 6.948 12.6 18.84"
+             y="0"
+             id="tspan102">right</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g106"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g108"
+         clip-path="url(#clipPath112)">
+        <text
+           transform="matrix(1,0,0,-1,403.27,501.6)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text116">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan114">C</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g118"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g120"
+         clip-path="url(#clipPath124)">
+        <text
+           transform="matrix(1,0,0,-1,412.87,497.16)"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text128">
+          <tspan
+             x="0 4.1880002 6.948 12.6 18.84"
+             y="0"
+             id="tspan126">right</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g130"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g132"
+         clip-path="url(#clipPath136)">
+        <text
+           transform="matrix(1,0,0,-1,49.2,333.55)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text140">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan138">A</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g142"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g144"
+         clip-path="url(#clipPath148)">
+        <text
+           transform="matrix(1,0,0,-1,59.64,329.11)"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text152">
+          <tspan
+             x="0 2.76 8.6400003 12.348"
+             y="0"
+             id="tspan150">left</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g154"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g156"
+         clip-path="url(#clipPath160)">
+        <text
+           transform="matrix(1,0,0,-1,206.76,333.55)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text164">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan162">B</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g166"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g168"
+         clip-path="url(#clipPath172)">
+        <text
+           transform="matrix(1,0,0,-1,216.6,329.11)"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text176">
+          <tspan
+             x="0 2.76 8.6400003 12.348"
+             y="0"
+             id="tspan174">left</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g178"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g180"
+         clip-path="url(#clipPath184)">
+        <text
+           transform="matrix(1,0,0,-1,403.27,333.55)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text188">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan186">C</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g190"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g192"
+         clip-path="url(#clipPath196)">
+        <text
+           transform="matrix(1,0,0,-1,412.87,329.11)"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text200">
+          <tspan
+             x="0 2.76 8.6400003 12.348"
+             y="0"
+             id="tspan198">left</tspan>
+        </text>
+      </g>
+    </g>
+    <path
+       d="m 124.25993,44.105237 c -0.2152,-1.541639 0.47625,-1.192389 2.00025,-1.513417 l 13.88533,-2.395361 c 1.21709,-0.09172 1.50636,-0.257528 1.76036,1.051278 0.25753,1.312333 2.46831,7.96232 2.54353,16.774583 -0.16114,8.860392 -2.28953,15.46225 -2.54353,16.774583 -0.25752,1.308805 -0.5468,1.142998 -1.76741,1.051278 L 126.24607,73.45282 c -1.524,-0.321028 -2.15195,-0.299861 -2.00378,-1.513417 0.14817,-1.213556 1.54683,-6.248024 1.79192,-13.398878 0.23996,-7.001251 -1.55909,-12.890121 -1.77428,-14.435288 z"
+       stroke-opacity="1"
+       stroke-width="0.71966666"
+       fill="none"
+       stroke="#000000"
+       style="stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none"
+       id="back-window" />
+    <path
+       fill="#d40000"
+       fill-opacity="0.1"
+       stroke-width="0.56499994"
+       style="stroke:#000006;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="m 124.18415,50.382077 c 0.0343,-0.890241 1.29942,-0.98003 1.39703,-0.09449 0.47184,4.280429 0.37231,10.148768 -0.0472,15.042017 -0.0761,0.887643 -1.33149,0.843466 -1.34978,-0.04725 -0.10434,-5.082237 -0.13775,-11.32143 0,-14.900276 z"
+       id="D-centre" />
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,-24.041971,236.36781)"
+       id="g910">
+      <g
+         clip-path="url(#clipPath112)"
+         id="g908">
+        <text
+           id="text906"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,403.27,501.6)">
+          <tspan
+             id="tspan904"
+             y="0"
+             x="0">D</tspan>
+        </text>
+      </g>
+    </g>
+  </g>
+  <g
+     transform="matrix(1.7238627,0,0,1.8327494,-54.696392,-97.312136)"
+     id="g129">
+    <g
+       transform="matrix(0.10589502,0,0,0.11178956,108.38127,114.85035)"
+       id="warningLightOuter">
+      <g
+         id="g39">
+        <g
+           id="g41">
+          <path
+             id="warningLight"
+             fill-opacity="1"
+             style="fill:#4f81bd;fill-rule:evenodd;stroke:#385d8a;stroke-width:2.03999996;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+             d="m 1.02,11.02 c 0,-5.52 4.48,-10 10,-10 h 94 c 5.519,0 10,4.48 10,10 v 40 c 0,5.519 -4.481,10 -10,10 h -94 c -5.52,0 -10,-4.481 -10,-10 z" />
+        </g>
+        <g
+           id="g45">
+          <path
+             id="path47"
+             style="fill:#4f81bd;fill-opacity:0.1;fill-rule:evenodd;stroke:#ff0000;stroke-width:2.03999996;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+             d="m 37.02,49.02 21,-36 21,36 z" />
+        </g>
+        <g
+           id="g49">
+          <path
+             id="path51"
+             style="fill:#4f81bd;fill-opacity:0.2;fill-rule:evenodd;stroke:#ff0000;stroke-width:2.03999996;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+             d="m 43.02,45.539 15,-25.68 15,25.68 z" />
+        </g>
+      </g>
+    </g>
+  </g>
+  <g
+     transform="translate(-34.269582,39.201651)"
+     id="layer1-2">
+    <g
+       transform="matrix(0.35277777,0,0,0.35277777,55.288846,63.501609)"
+       id="g823">
+      <g
+         id="g825">
+        <g
+           id="g827">
+          <g
+             id="g829">
+            <g
+               clip-path="url(#clipPath835)"
+               id="g831">
+              <g
+                 id="g837">
+                <path
+                   id="lever"
+                   style="fill:#595959;fill-opacity:1;fill-rule:evenodd;stroke:none"
+                   d="m 90.738,47.328 67.242,12.953 -0.742,3.84 L 90,51.172 Z" />
+              </g>
+            </g>
+          </g>
+        </g>
+        <path
+           id="lever-holder"
+           style="fill:#7f7f7f;fill-opacity:1;fill-rule:evenodd;stroke:none"
+           d="m 57.602,30.238 39.839,15.672 -0.41,9.891 -38.672,-2.84 z" />
+        <g
+           id="g843">
+          <g
+             id="g845">
+            <g
+               id="g851">
+              <path
+                 id="rectangle"
+                 style="fill:url(#radialGradient859);fill-rule:evenodd;stroke:none"
+                 d="m 30,34 c 0,-2.211 1.789,-4 4,-4 h 22 c 2.211,0 4,1.789 4,4 v 16 c 0,2.211 -1.789,4 -4,4 H 34 c -2.211,0 -4,-1.789 -4,-4 z" />
+            </g>
+          </g>
+        </g>
+        <path
+           id="shadow"
+           style="fill:#595959;fill-opacity:1;fill-rule:evenodd;stroke:none"
+           d="M 61.84,52.801 98.16,54.82 89.949,56.762 32.16,53.609 Z" />
+        <path
+           id="PitmanDownward"
+           fill-opacity="0.1"
+           fill="#95b3d7"
+           style="fill-rule:evenodd;stroke:none"
+           d="m 40.559,78.898 h 3.152 V 63.719 h 6.301 v 15.179 h 3.148 l -6.301,6.301 z" />
+        <path
+           id="PitmanUpward"
+           style="fill-rule:evenodd;stroke:none"
+           fill-opacity="1"
+           fill="#95b3d7"
+           d="m 41.398,6.301 h 3.153 V 21.48 h 6.301 V 6.301 H 54 L 47.699,0 Z" />
+        <g
+           id="g869">
+          <g
+             clip-path="url(#clipPath877)"
+             id="g873">
+            <path
+               id="PitmanLeft"
+               visibility="hidden"
+               fill-opacity="0.1"
+               fill="#95b3d7"
+               style="fill-rule:evenodd;stroke:none"
+               d="m 87.18,36.359 v 3.153 H 72 v 6.297 h 15.18 v 3.152 l 6.3,-6.301 z" />
+          </g>
+        </g>
+        <g
+           clip-path="url(#clipPath891)"
+           id="g874">
+          <path
+             id="PitmanRight"
+             visibility="hidden"
+             style="fill-rule:evenodd;stroke:none"
+             fill-opacity="0.1"
+             fill="#95b3d7"
+             d="m 6.301,36.359 v 3.153 H 21.48 v 6.297 H 6.301 v 3.152 L 0,42.66 Z" />
+        </g>
+      </g>
+    </g>
+    <g
+       id="circled-2"
+       transform="matrix(0.50000001,0,0,0.50000001,37.311567,17.458633)">
+      <circle
+         r="4.4767647"
+         cy="86.391617"
+         cx="69.623711"
+         id="circle-PitmanUpward"
+         stroke-opacity="1"
+         fill="none"
+         stroke-width="0.56499994"
+         style="fill-opacity:1;stroke:#95b3d7;stroke-miterlimit:4;stroke-dasharray:none" />
+      <text
+         id="text879"
+         y="88.663406"
+         x="67.819641"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:1.25;font-family:AIGDT;-inkscape-font-specification:AIGDT;letter-spacing:0px;word-spacing:0px;fill:#95b3d7;fill-opacity:1;stroke:none;stroke-width:0.26458332"
+         xml:space="preserve"><tspan
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7.05555534px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans';fill:#95b3d7;fill-opacity:1;stroke-width:0.26458332"
+           y="88.663406"
+           x="67.819641"
+           id="tspan877">2</tspan><tspan
+           id="tspan881"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:AIGDT;-inkscape-font-specification:AIGDT;fill:#95b3d7;fill-opacity:1;stroke-width:0.26458332"
+           y="101.89257"
+           x="67.819641" /></text>
+    </g>
+    <g
+       id="circled-1"
+       visibility="hidden"
+       transform="matrix(0.50000001,0,0,0.50000001,56.399491,35.416294)">
+      <circle
+         style="fill:none;fill-opacity:0.5;stroke:#95b3d7;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         stroke-width="0.56499994"
+         id="circle885"
+         cx="69.623711"
+         cy="86.391617"
+         r="4.4767647" />
+      <text
+         xml:space="preserve"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:1.25;font-family:AIGDT;-inkscape-font-specification:AIGDT;letter-spacing:0px;word-spacing:0px;fill:#95b3d7;fill-opacity:1;stroke:none;stroke-width:0.26458332"
+         x="67.819641"
+         y="88.663406"
+         id="text891"><tspan
+           id="tspan887"
+           x="67.819641"
+           y="88.663406"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7.05555534px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans';fill:#95b3d7;fill-opacity:1;stroke-width:0.26458332">1</tspan><tspan
+           x="67.819641"
+           y="101.89257"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:AIGDT;-inkscape-font-specification:AIGDT;fill:#95b3d7;fill-opacity:1;stroke-width:0.26458332"
+           id="tspan889" /></text>
+    </g>
+    <g
+       transform="matrix(0.50000001,0,0,0.50000001,37.010396,53.209273)"
+       id="circled-3">
+      <circle
+         style="fill-opacity:1;stroke:#95b3d7;stroke-miterlimit:4;stroke-dasharray:none"
+         stroke-opacity="1"
+         stroke-width="0.56499994"
+         fill="none"
+         id="circle-PitmanDownward"
+         cx="69.623711"
+         cy="86.391617"
+         r="4.4767647" />
+      <text
+         xml:space="preserve"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:1.25;font-family:AIGDT;-inkscape-font-specification:AIGDT;letter-spacing:0px;word-spacing:0px;fill:#95b3d7;fill-opacity:1;stroke:none;stroke-width:0.26458332"
+         x="67.819641"
+         y="88.663406"
+         id="text901"><tspan
+           id="tspan897"
+           x="67.819641"
+           y="88.663406"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7.05555534px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans';fill:#95b3d7;fill-opacity:1;stroke-width:0.26458332">3</tspan><tspan
+           x="67.819641"
+           y="101.89257"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:AIGDT;-inkscape-font-specification:AIGDT;fill:#95b3d7;fill-opacity:1;stroke-width:0.26458332"
+           id="tspan899" /></text>
+    </g>
+    <g
+       id="circled-4"
+       visibility="hidden"
+       transform="matrix(0.50000001,0,0,0.50000001,17.399857,35.285018)">
+      <circle
+         r="4.4767647"
+         cy="86.391617"
+         cx="69.623711"
+         id="circle905"
+         stroke-width="0.56499994"
+         style="fill:none;fill-opacity:0.5;stroke:#95b3d7;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <text
+         id="text911"
+         y="88.663406"
+         x="67.819641"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:1.25;font-family:AIGDT;-inkscape-font-specification:AIGDT;letter-spacing:0px;word-spacing:0px;fill:#95b3d7;fill-opacity:1;stroke:none;stroke-width:0.26458332"
+         xml:space="preserve"><tspan
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7.05555534px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans';fill:#95b3d7;fill-opacity:1;stroke-width:0.26458332"
+           y="88.663406"
+           x="67.819641"
+           id="tspan907">4</tspan><tspan
+           id="tspan909"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:AIGDT;-inkscape-font-specification:AIGDT;fill:#95b3d7;fill-opacity:1;stroke-width:0.26458332"
+           y="101.89257"
+           x="67.819641" /></text>
+    </g>
+  </g>
+  <g
+     id="g1214"
+     transform="matrix(0.17602011,0,0,0.17602011,90.631641,110.63546)">
+    <g
+       id="ignition-layer"
+       transform="matrix(1.1911573,0,0,1.1647802,-10.124837,-9.9006317)">
+      <g
+         id="ignition">
+        <circle
+           cx="50"
+           cy="50"
+           r="40"
+           id="circle1890"
+           style="fill:#808080;stroke:#808080;stroke-width:3" />
+        <ellipse
+           ry="24.259792"
+           rx="23.803005"
+           cx="50"
+           cy="50"
+           id="circle1892"
+           style="fill:#494949;stroke:#494949;stroke-width:2.40303135" />
+        <rect
+           y="34.322033"
+           x="43.220341"
+           height="30.084745"
+           width="13.559322"
+           id="rect6208"
+           style="fill:#000000;fill-opacity:1" />
+        <text
+           transform="matrix(-0.38445029,0.94405083,-0.90270348,-0.3844503,0,0)"
+           id="text6917"
+           y="-100.88259"
+           x="19.913101"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.33333349px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill-opacity:1;stroke:none"
+           xml:space="preserve"><tspan
+             y="-100.88259"
+             x="19.913101"
+             id="engine-started-text"
+             fill="#ffffff">START</tspan></text>
+        <text
+           transform="matrix(0.38879411,0.94218856,-0.90092278,0.38879412,0,0)"
+           id="text6917-7"
+           y="-63.434811"
+           x="63.698452"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.33333349px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill-opacity:1;stroke:none;stroke-width:1"
+           xml:space="preserve"><tspan
+             y="-63.434811"
+             x="63.698452"
+             id="key-on-text"
+             fill="#ffffff"
+             style="stroke-width:1">ON</tspan></text>
+        <text
+           transform="matrix(0.88720363,0.47182619,-0.45116124,0.88720367,0,0)"
+           id="text6917-5"
+           y="-14.083524"
+           x="69.099663"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.33333349px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill-opacity:1;stroke:none;stroke-width:1"
+           xml:space="preserve"><tspan
+             y="-14.083524"
+             x="69.099663"
+             fill="#ffffff"
+             id="tspan6915-30"
+             style="stroke-width:1">OFF</tspan></text>
+      </g>
+    </g>
+    <g
+       style="fill:#000000"
+       id="key-inserted-layer"
+       transform="matrix(1.2199409,0.0064397,-0.00604819,1.1457667,-11.070343,-10.130296)">
+      <g
+         fill="#000000"
+         id="key-inserted"
+         transform="matrix(1.1281738,0,0,1.2266666,14.93372,-16.073443)"
+         visibility="hidden">
+        <rect
+           ry="5"
+           rx="20"
+           y="26.21656"
+           x="19.678703"
+           height="55.067017"
+           width="22.676216"
+           id="rect6890"
+           style="fill:#000000;fill-opacity:1;stroke-width:0.83614457" />
+        <rect
+           ry="5.0076761"
+           rx="33.472603"
+           y="26.373297"
+           x="28.167255"
+           height="54.845291"
+           width="5.7390733"
+           id="rect6893"
+           style="fill:#1a1a1a;fill-opacity:1;stroke-width:1.10055423" />
+      </g>
+    </g>
+    <g
+       style="visibility:hidden;fill:#000000"
+       id="key-on-position-layer"
+       transform="matrix(0.55545704,1.0861698,-1.0201291,0.5216844,72.66677,-32.920254)">
+      <g
+         fill="#4f81bd"
+         visibility="hidden"
+         id="key-on-position"
+         transform="matrix(1.1281738,0,0,1.2266666,14.93372,-16.073443)">
+        <rect
+           ry="5"
+           rx="20"
+           y="26.21656"
+           x="19.678703"
+           height="55.067017"
+           width="22.676216"
+           id="rect6890-0"
+           style="fill:#4f81bd;fill-opacity:1;stroke-width:0.83614457" />
+        <rect
+           ry="5.0076761"
+           rx="33.472603"
+           y="26.373297"
+           x="28.167255"
+           height="54.845291"
+           width="5.7390733"
+           id="rect6893-3"
+           style="fill:#1a1a1a;fill-opacity:1;stroke-width:1.10055423" />
+      </g>
+    </g>
+    <g
+       style="visibility:hidden;fill:#000000"
+       id="engine-started-layer"
+       transform="matrix(0.01972985,1.2197984,-1.1456328,0.0185302,105.67114,-14.504551)">
+      <g
+         fill="#00cc00"
+         visibility="hidden"
+         id="engine-start"
+         transform="matrix(1.0996363,0.26846651,-0.25748706,1.1956376,29.658811,-22.732608)">
+        <rect
+           ry="5"
+           rx="20"
+           y="26.21656"
+           x="19.678703"
+           height="55.067017"
+           width="22.676216"
+           id="rect6890-0-7"
+           style="fill:#00cc00;fill-opacity:1;stroke-width:0.83614457" />
+        <rect
+           ry="5.0076761"
+           rx="33.472603"
+           y="26.373297"
+           x="28.167255"
+           height="54.845291"
+           width="5.7390733"
+           id="rect6893-3-2"
+           style="fill:#1a1a1a;fill-opacity:1;stroke-width:1.10055423" />
+      </g>
+    </g>
+  </g>
+  <ellipse
+     style="stroke-width:0.14762825"
+     fill-opacity="1"
+     fill="#95b3d7"
+     ry="2.0"
+     rx="2.0"
+     cy="117.63323"
+     cx="36.8"
+     id="PitmanNeutral" />
+     
+        <text
+           id="timer-txt"
+           style="font-variant:normal;font-weight:normal;font-size:5px;font-family:'Fira Sans';writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none">
+          <tspan
+             id="timer-text"
+             y="120"
+             x="112">Timer</tspan>
+        </text>
+</svg>
diff --git a/B2Program/LightModel/LichtUebersicht_v5.svg b/B2Program/LightModel/LichtUebersicht_v5.svg
new file mode 100644
index 0000000000000000000000000000000000000000..686292b59527b1ba81df885a1a557ddf301186ed
--- /dev/null
+++ b/B2Program/LightModel/LichtUebersicht_v5.svg
@@ -0,0 +1,847 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   width="179.96185mm"
+   height="135.26794mm"
+   viewBox="0 0 179.96185 135.26794"
+   version="1.1"
+   id="svg8">
+  <defs
+     id="defs2">
+    <clipPath
+       id="clipPath26"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path24"
+         d="M 0,1.2207e-4 H 720 V 540.00012 H 0 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath64"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path62"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath76"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path74"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath88"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path86"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath100"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path98"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath112"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path110"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath124"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path122"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath136"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path134"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath148"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path146"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath160"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path158"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath172"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path170"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath184"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path182"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath196"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         style="clip-rule:evenodd"
+         id="path194"
+         d="M 1.0729e-5,0 H 720.00001 V 540 H 1.0729e-5 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath123"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         id="path121"
+         d="M 0,0 H 240 V 240 H 0 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath137"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         id="path135"
+         d="M 0,0 H 240 V 240 H 0 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath177"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         id="path175"
+         d="M 0,0 H 240 V 240 H 0 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath835"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         id="path833"
+         d="M 0,0 H 158 V 86 H 0 Z" />
+    </clipPath>
+    <radialGradient
+       id="radialGradient859"
+       spreadMethod="pad"
+       gradientTransform="matrix(19.209,0,0,-19.209,44.999999,41.999984)"
+       gradientUnits="userSpaceOnUse"
+       r="1"
+       cy="0"
+       cx="0"
+       fy="0"
+       fx="0">
+      <stop
+         id="stop853"
+         offset="0"
+         style="stop-opacity:1;stop-color:#212121" />
+      <stop
+         id="stop855"
+         offset="0.5"
+         style="stop-opacity:1;stop-color:#343434" />
+      <stop
+         id="stop857"
+         offset="1"
+         style="stop-opacity:1;stop-color:#404040" />
+    </radialGradient>
+    <clipPath
+       id="clipPath877"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         id="path875"
+         d="M 0,0 H 158 V 86 H 0 Z" />
+    </clipPath>
+    <clipPath
+       id="clipPath891"
+       clipPathUnits="userSpaceOnUse">
+      <path
+         id="path889"
+         d="M 0,0 H 158 V 86 H 0 Z" />
+    </clipPath>
+  </defs>
+  <metadata
+     id="metadata5">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     id="layer1"
+     transform="translate(-8.4947023,-26.13143)">
+    <path
+       d="m 159.54511,60.511861 c 0,0 0.0844,6.523931 -0.7729,10.245736 -0.85725,3.721806 -1.28411,6.096 -4.43795,8.09625 -3.15383,2.00025 -9.49677,3.393722 -14.48152,3.90525 -4.98475,0.515056 -3.30906,-0.790223 -15.41639,-0.836083 l -57.227612,0.557389 c 0,0 -17.28611,1.721555 -23.125993,0.560916 -5.839531,-1.164166 -9.415286,-3.340805 -11.912953,-7.538861 -2.497314,-4.198055 -3.071636,-9.896753 -3.071636,-17.293165 0,-7.396413 0.629355,-12.982223 3.137253,-17.159112 2.50825,-4.176888 6.072363,-6.374694 11.910835,-7.53886 5.839884,-1.160639 23.118939,0.560916 23.118939,0.560916 l 57.220557,0.557389 c 12.1038,-0.04586 10.43164,-1.351139 15.41286,-0.836083 4.98122,0.511527 11.32769,1.905 14.478,3.90525 3.15383,2.00025 3.58422,4.374444 4.43794,8.096249 0.6189,3.376819 0.68846,6.852603 0.70692,10.299222 z"
+       style="fill:none;stroke:#000000;stroke-width:0.71966666;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+       id="car_outline" />
+    <path
+       d="m 32.434345,48.014015 c 1.51765,-1.252361 10.155767,-10.918472 10.973153,-12.544778 0.817033,-1.626305 -4.55295,1.534583 -6.070247,2.786945 -1.51765,1.255888 -2.334684,3.252611 -3.0353,4.741333 -0.700264,1.485194 -3.385256,6.272388 -1.867606,5.0165 z"
+       style="fill:#f4eed7;stroke:#000000;stroke-width:0.71966666;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+       id="A-right" />
+    <path
+       d="m 74.013792,34.08282 c 0.85725,-1.721555 1.7145,-3.446638 2.575277,-4.190999 0.85725,-0.744362 2.377723,-0.931334 2.57175,-0.278695 0.197556,0.652639 -1.404055,4.191 -1.404055,4.191 l -0.112212,0.27167"
+       style="fill:none;stroke:#000000;stroke-width:0.71966666;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+       id="B-right" />
+    <path
+       d="m 152.27754,37.123765 c -0.97014,-0.141111 -3.10444,-0.328083 -2.794,0.557389 0.31044,0.881944 3.25967,3.023305 4.65667,4.744861 1.397,1.721555 3.18558,5.210527 3.72886,5.584472 0.54328,0.370417 -0.0388,-1.767417 -0.46567,-3.351389 -0.42686,-1.580444 -1.28411,-4.931833 -2.09903,-6.141861 -0.81491,-1.210028 -2.05669,-1.255889 -3.02683,-1.393472 z"
+       style="fill:#d40000;stroke:#000000;stroke-width:0.71966666;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+       id="C-right" />
+    <path
+       d="m 85.857171,70.535347 c 1.113049,2.755359 1.636728,1.789363 -0.903741,3.319639 -2.543058,1.531835 -11.571111,4.935361 -14.492111,5.863167 -2.920999,0.931333 -2.172485,1.390426 -3.037416,-0.278695 -0.917177,-1.769945 -2.133046,-5.820707 -2.753935,-9.45079 -0.624417,-3.626555 -0.946699,-7.860015 -0.943176,-11.712348 0.08114,-3.845278 0.02545,-6.509002 0.646339,-10.132029 0.624417,-3.623028 2.115911,-9.411859 3.124855,-10.992304 1.012472,-1.576917 0.119945,-1.2065 3.033889,-0.278694 2.913944,0.931333 11.90625,4.346222 14.453305,5.852583 2.547056,1.506361 2.265082,0.951176 1.254251,3.182055 -1.076472,2.375747 -2.382586,8.119789 -2.472594,12.168692 -0.104118,4.68361 1.044435,9.869595 2.090334,12.458724 z"
+       style="fill:none;stroke:#000000;stroke-width:0.71966666;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+       id="front-window" />
+    <path
+       d="m 32.392012,68.538625 c 1.51765,1.252361 10.155766,10.918472 10.973153,12.544778 0.817033,1.626305 -4.55295,-1.534584 -6.070248,-2.786945 -1.51765,-1.255888 -2.334683,-3.252611 -3.0353,-4.741333 -0.700263,-1.485194 -3.385255,-6.272389 -1.867605,-5.0165 z"
+       style="fill:#f4eed7;stroke:#000000;stroke-width:0.71966666;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+       id="A-left" />
+    <path
+       d="m 73.971458,82.512153 c 0.85725,1.707444 1.7145,3.414889 2.575278,4.155722 0.85725,0.737305 2.377722,0.92075 2.57175,0.275167 0.197556,-0.645584 -1.404056,-4.155723 -1.404056,-4.155723 l -0.141741,-0.318917"
+       style="fill:none;stroke:#000000;stroke-width:0.71966666;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+       id="B-left" />
+    <path
+       d="m 152.20698,79.428875 c -0.97719,0.141111 -3.12208,0.328083 -2.80811,-0.557389 0.31045,-0.881944 3.27731,-3.023305 4.68136,-4.744861 1.40406,-1.721555 3.1997,-5.210527 3.74298,-5.584472 0.5468,-0.370417 -0.0388,1.767417 -0.46567,3.351389 -0.43039,1.580444 -1.28764,4.931833 -2.10961,6.141861 -0.81845,1.210028 -2.06728,1.255889 -3.04095,1.393472 z"
+       style="fill:#d40000;stroke:#000000;stroke-width:0.71966666;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+       id="C-left" />
+    <g
+       id="g58"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g60"
+         clip-path="url(#clipPath64)">
+        <text
+           transform="matrix(1,0,0,-1,49.2,501.6)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text68">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan66">A</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g70"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g72"
+         clip-path="url(#clipPath76)">
+        <text
+           transform="matrix(1,0,0,-1,59.64,497.16)"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text80">
+          <tspan
+             x="0 4.1880002 6.948 12.6 18.84"
+             y="0"
+             id="tspan78">right</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g82"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g84"
+         clip-path="url(#clipPath88)">
+        <text
+           transform="matrix(1,0,0,-1,206.76,501.6)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text92">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan90">B</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g94"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g96"
+         clip-path="url(#clipPath100)">
+        <text
+           transform="matrix(1,0,0,-1,216.6,497.16)"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text104">
+          <tspan
+             x="0 4.1880002 6.948 12.6 18.84"
+             y="0"
+             id="tspan102">right</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g106"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g108"
+         clip-path="url(#clipPath112)">
+        <text
+           transform="matrix(1,0,0,-1,403.27,501.6)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text116">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan114">C</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g118"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g120"
+         clip-path="url(#clipPath124)">
+        <text
+           transform="matrix(1,0,0,-1,412.87,497.16)"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text128">
+          <tspan
+             x="0 4.1880002 6.948 12.6 18.84"
+             y="0"
+             id="tspan126">right</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g130"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g132"
+         clip-path="url(#clipPath136)">
+        <text
+           transform="matrix(1,0,0,-1,49.2,333.55)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text140">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan138">A</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g142"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g144"
+         clip-path="url(#clipPath148)">
+        <text
+           transform="matrix(1,0,0,-1,59.64,329.11)"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text152">
+          <tspan
+             x="0 2.76 8.6400003 12.348"
+             y="0"
+             id="tspan150">left</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g154"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g156"
+         clip-path="url(#clipPath160)">
+        <text
+           transform="matrix(1,0,0,-1,206.76,333.55)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text164">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan162">B</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g166"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g168"
+         clip-path="url(#clipPath172)">
+        <text
+           transform="matrix(1,0,0,-1,216.6,329.11)"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text176">
+          <tspan
+             x="0 2.76 8.6400003 12.348"
+             y="0"
+             id="tspan174">left</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g178"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g180"
+         clip-path="url(#clipPath184)">
+        <text
+           transform="matrix(1,0,0,-1,403.27,333.55)"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text188">
+          <tspan
+             x="0"
+             y="0"
+             id="tspan186">C</tspan>
+        </text>
+      </g>
+    </g>
+    <g
+       id="g190"
+       transform="matrix(0.35277777,0,0,-0.35277777,11.339293,207.79765)">
+      <g
+         id="g192"
+         clip-path="url(#clipPath196)">
+        <text
+           transform="matrix(1,0,0,-1,412.87,329.11)"
+           style="font-variant:normal;font-weight:normal;font-size:12px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           id="text200">
+          <tspan
+             x="0 2.76 8.6400003 12.348"
+             y="0"
+             id="tspan198">left</tspan>
+        </text>
+      </g>
+    </g>
+    <path
+       d="m 124.25993,44.105237 c -0.2152,-1.541639 0.47625,-1.192389 2.00025,-1.513417 l 13.88533,-2.395361 c 1.21709,-0.09172 1.50636,-0.257528 1.76036,1.051278 0.25753,1.312333 2.46831,7.96232 2.54353,16.774583 -0.16114,8.860392 -2.28953,15.46225 -2.54353,16.774583 -0.25752,1.308805 -0.5468,1.142998 -1.76741,1.051278 L 126.24607,73.45282 c -1.524,-0.321028 -2.15195,-0.299861 -2.00378,-1.513417 0.14817,-1.213556 1.54683,-6.248024 1.79192,-13.398878 0.23996,-7.001251 -1.55909,-12.890121 -1.77428,-14.435288 z"
+       style="fill:none;stroke:#000000;stroke-width:0.71966666;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+       id="back-window" />
+    <path
+       style="fill:#d40000;fill-opacity:0.1;stroke:#000006;stroke-width:0.56499994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="m 124.18415,50.382077 c 0.0343,-0.890241 1.29942,-0.98003 1.39703,-0.09449 0.47184,4.280429 0.37231,10.148768 -0.0472,15.042017 -0.0761,0.887643 -1.33149,0.843466 -1.34978,-0.04725 -0.10434,-5.082237 -0.13775,-11.32143 0,-14.900276 z"
+       id="D-centre" />
+    <g
+       transform="matrix(0.35277777,0,0,-0.35277777,-24.041971,236.36781)"
+       id="g910">
+      <g
+         clip-path="url(#clipPath112)"
+         id="g908">
+        <text
+           id="text906"
+           style="font-variant:normal;font-weight:normal;font-size:18px;font-family:Calibri;-inkscape-font-specification:Calibri;writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none"
+           transform="matrix(1,0,0,-1,403.27,501.6)">
+          <tspan
+             id="tspan904"
+             y="0"
+             x="0">D</tspan>
+        </text>
+      </g>
+    </g>
+  </g>
+  <g
+     transform="matrix(1.7238627,0,0,1.8327494,-49.141215,-123.44357)"
+     id="g129">
+    <g
+       transform="matrix(0.10589502,0,0,0.11178956,108.38127,114.85035)"
+       id="warningLightOuter">
+      <g
+         id="g39">
+        <g
+           id="g41">
+          <path
+             id="warningLight"
+             style="fill:#4f81bd;fill-opacity:1;fill-rule:evenodd;stroke:#385d8a;stroke-width:2.03999996;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+             d="m 1.02,11.02 c 0,-5.52 4.48,-10 10,-10 h 94 c 5.519,0 10,4.48 10,10 v 40 c 0,5.519 -4.481,10 -10,10 h -94 c -5.52,0 -10,-4.481 -10,-10 z" />
+        </g>
+        <g
+           id="g45">
+          <path
+             id="path47"
+             style="fill:#4f81bd;fill-opacity:0.1;fill-rule:evenodd;stroke:#ff0000;stroke-width:2.03999996;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+             d="m 37.02,49.02 21,-36 21,36 z" />
+        </g>
+        <g
+           id="g49">
+          <path
+             id="path51"
+             style="fill:#4f81bd;fill-opacity:0.2;fill-rule:evenodd;stroke:#ff0000;stroke-width:2.03999996;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
+             d="m 43.02,45.539 15,-25.68 15,25.68 z" />
+        </g>
+      </g>
+    </g>
+  </g>
+  <g
+     transform="translate(-40.984532,13.070221)"
+     id="layer1-2">
+    <g
+       transform="matrix(0.35277777,0,0,0.35277777,55.288846,63.501609)"
+       id="g823">
+      <g
+         id="g825">
+        <g
+           id="g827">
+          <g
+             id="g829">
+            <g
+               clip-path="url(#clipPath835)"
+               id="g831">
+              <g
+                 id="g837">
+                <path
+                   id="lever"
+                   style="fill:#595959;fill-opacity:1;fill-rule:evenodd;stroke:none"
+                   d="m 90.738,47.328 67.242,12.953 -0.742,3.84 L 90,51.172 Z" />
+              </g>
+            </g>
+          </g>
+        </g>
+        <path
+           id="lever-holder"
+           style="fill:#7f7f7f;fill-opacity:1;fill-rule:evenodd;stroke:none"
+           d="m 57.602,30.238 39.839,15.672 -0.41,9.891 -38.672,-2.84 z" />
+        <g
+           id="g843">
+          <g
+             id="g845">
+            <g
+               id="g851">
+              <path
+                 id="rectangle"
+                 style="fill:url(#radialGradient859);fill-rule:evenodd;stroke:none"
+                 d="m 30,34 c 0,-2.211 1.789,-4 4,-4 h 22 c 2.211,0 4,1.789 4,4 v 16 c 0,2.211 -1.789,4 -4,4 H 34 c -2.211,0 -4,-1.789 -4,-4 z" />
+            </g>
+          </g>
+        </g>
+        <path
+           id="shadow"
+           style="fill:#595959;fill-opacity:1;fill-rule:evenodd;stroke:none"
+           d="M 61.84,52.801 98.16,54.82 89.949,56.762 32.16,53.609 Z" />
+        <path
+           id="PitmanDownward"
+           visibility="visible"
+           fill-opacity="0.5"
+           style="fill:#216775;fill-rule:evenodd;stroke:none"
+           d="m 40.559,78.898 h 3.152 V 63.719 h 6.301 v 15.179 h 3.148 l -6.301,6.301 z" />
+        <path
+           id="PitmanUpward"
+           visibility="visible"
+           fill-opacity="1"
+           style="fill:#216775;fill-rule:evenodd;stroke:none"
+           d="m 41.398,6.301 h 3.153 V 21.48 h 6.301 V 6.301 H 54 L 47.699,0 Z" />
+        <g
+           id="g869">
+          <g
+             clip-path="url(#clipPath877)"
+             id="g873">
+            <path
+               id="PitmanLeft"
+               visibility="visible"
+               fill-opacity="0.5"
+               style="fill:#216775;fill-rule:evenodd;stroke:none"
+               d="m 87.18,36.359 v 3.153 H 72 v 6.297 h 15.18 v 3.152 l 6.3,-6.301 z" />
+          </g>
+        </g>
+        <g
+           clip-path="url(#clipPath891)"
+           id="g874">
+          <path
+             id="PitmanRight"
+             fill-opacity="0.5"
+             visibility="visible"
+             style="fill:#216775;fill-rule:evenodd;stroke:none"
+             d="m 6.301,36.359 v 3.153 H 21.48 v 6.297 H 6.301 v 3.152 L 0,42.66 Z" />
+        </g>
+      </g>
+    </g>
+    <g
+       id="circled-2"
+       transform="matrix(0.50000001,0,0,0.50000001,37.311567,17.458633)">
+      <circle
+         r="4.4767647"
+         cy="86.391617"
+         cx="69.623711"
+         id="circle-PitmanUpward"
+         style="fill:none;fill-opacity:1;stroke:#216775;stroke-width:0.56499994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <text
+         id="text879"
+         y="88.663406"
+         x="67.819641"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:1.25;font-family:AIGDT;-inkscape-font-specification:AIGDT;letter-spacing:0px;word-spacing:0px;fill:#95b3d7;fill-opacity:1;stroke:none;stroke-width:0.26458332"
+         xml:space="preserve"><tspan
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7.05555534px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans';fill:#216775;fill-opacity:1;stroke-width:0.26458332"
+           y="88.663406"
+           x="67.819641"
+           id="tspan877">2</tspan><tspan
+           id="tspan881"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:AIGDT;-inkscape-font-specification:AIGDT;fill:#95b3d7;fill-opacity:1;stroke-width:0.26458332"
+           y="101.89257"
+           x="67.819641" /></text>
+    </g>
+    <g
+       id="circled-1"
+       visibility="visible"
+       transform="matrix(0.50000001,0,0,0.50000001,56.399491,35.416294)">
+      <circle
+         style="fill:none;fill-opacity:0.5;stroke:#216775;stroke-width:0.56499994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         id="circle885"
+         cx="69.623711"
+         cy="86.391617"
+         r="4.4767647" />
+      <text
+         xml:space="preserve"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:1.25;font-family:AIGDT;-inkscape-font-specification:AIGDT;letter-spacing:0px;word-spacing:0px;fill:#95b3d7;fill-opacity:1;stroke:none;stroke-width:0.26458332"
+         x="67.819641"
+         y="88.663406"
+         id="text891"><tspan
+           id="tspan887"
+           x="67.819641"
+           y="88.663406"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7.05555534px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans';fill:#216775;fill-opacity:1;stroke-width:0.26458332">1</tspan><tspan
+           x="67.819641"
+           y="101.89257"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:AIGDT;-inkscape-font-specification:AIGDT;fill:#216775;fill-opacity:1;stroke-width:0.26458332"
+           id="tspan889" /></text>
+    </g>
+    <g
+       transform="matrix(0.50000001,0,0,0.50000001,37.010396,53.209273)"
+       id="circled-3">
+      <circle
+         style="fill:none;fill-opacity:1;stroke:#216775;stroke-width:0.56499994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+         id="circle-PitmanDownward"
+         cx="69.623711"
+         cy="86.391617"
+         r="4.4767647" />
+      <text
+         xml:space="preserve"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:1.25;font-family:AIGDT;-inkscape-font-specification:AIGDT;letter-spacing:0px;word-spacing:0px;fill:#95b3d7;fill-opacity:1;stroke:none;stroke-width:0.26458332"
+         x="67.819641"
+         y="88.663406"
+         id="text901"><tspan
+           id="tspan897"
+           x="67.819641"
+           y="88.663406"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7.05555534px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans';fill:#216775;fill-opacity:1;stroke-width:0.26458332">3</tspan><tspan
+           x="67.819641"
+           y="101.89257"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:AIGDT;-inkscape-font-specification:AIGDT;fill:#216775;fill-opacity:1;stroke-width:0.26458332"
+           id="tspan899" /></text>
+    </g>
+    <g
+       id="circled-4"
+       visibility="visible"
+       transform="matrix(0.50000001,0,0,0.50000001,17.399857,35.285018)">
+      <circle
+         r="4.4767647"
+         cy="86.391617"
+         cx="69.623711"
+         id="circle905"
+         style="fill:none;fill-opacity:0.5;stroke:#216775;stroke-width:0.56499994;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
+      <text
+         id="text911"
+         y="88.663406"
+         x="67.819641"
+         style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:10.58333302px;line-height:1.25;font-family:AIGDT;-inkscape-font-specification:AIGDT;letter-spacing:0px;word-spacing:0px;fill:#95b3d7;fill-opacity:1;stroke:none;stroke-width:0.26458332"
+         xml:space="preserve"><tspan
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7.05555534px;font-family:'Fira Sans';-inkscape-font-specification:'Fira Sans';fill:#216775;fill-opacity:1;stroke-width:0.26458332"
+           y="88.663406"
+           x="67.819641"
+           id="tspan907">4</tspan><tspan
+           id="tspan909"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:AIGDT;-inkscape-font-specification:AIGDT;fill:#216775;fill-opacity:1;stroke-width:0.26458332"
+           y="101.89257"
+           x="67.819641" /></text>
+    </g>
+  </g>
+  <g
+     id="g1214"
+     transform="matrix(0.18903745,0,0,0.18903745,87.692115,84.18942)">
+    <g
+       id="ignition-layer"
+       transform="matrix(1.1911573,0,0,1.1647802,-10.124837,-9.9006317)">
+      <g
+         id="ignition">
+        <circle
+           cx="50"
+           cy="50"
+           r="40"
+           id="circle1890"
+           style="fill:#808080;stroke:#808080;stroke-width:3" />
+        <ellipse
+           ry="24.259792"
+           rx="23.803005"
+           cx="50"
+           cy="50"
+           id="circle1892"
+           style="fill:#494949;stroke:#494949;stroke-width:2.40303135" />
+        <rect
+           y="34.322033"
+           x="43.220341"
+           height="30.084745"
+           width="13.559322"
+           id="rect6208"
+           style="fill:#000000;fill-opacity:1" />
+        <text
+           transform="matrix(-0.38445029,0.94405083,-0.90270348,-0.3844503,0,0)"
+           id="text6917"
+           y="-100.88259"
+           x="19.913101"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.33333349px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill-opacity:1;stroke:none"
+           xml:space="preserve"><tspan
+             y="-100.88259"
+             x="19.913101"
+             id="engine-started-text"
+             style="fill:#ffffff">START</tspan></text>
+        <text
+           transform="matrix(0.38879411,0.94218856,-0.90092278,0.38879412,0,0)"
+           id="text6917-7"
+           y="-63.434811"
+           x="63.698452"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.33333349px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill-opacity:1;stroke:none;stroke-width:1"
+           xml:space="preserve"><tspan
+             y="-63.434811"
+             x="63.698452"
+             id="key-on-text"
+             style="fill:#ffffff;stroke-width:1">ON</tspan></text>
+        <text
+           transform="matrix(0.88720363,0.47182619,-0.45116124,0.88720367,0,0)"
+           id="text6917-5"
+           y="-14.083524"
+           x="69.099663"
+           style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.33333349px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill-opacity:1;stroke:none;stroke-width:1"
+           xml:space="preserve"><tspan
+             y="-14.083524"
+             x="69.099663"
+             id="tspan6915-30"
+             style="fill:#ffffff;stroke-width:1">OFF</tspan></text>
+      </g>
+    </g>
+    <g
+       id="key-inserted-layer"
+       transform="matrix(1.2199409,0.0064397,-0.00604819,1.1457667,-11.070343,-10.130296)">
+      <g
+         id="key-inserted"
+         transform="matrix(1.1281738,0,0,1.2266666,14.93372,-16.073443)"
+         visibility="hidden">
+        <rect
+           ry="5"
+           rx="20"
+           y="26.21656"
+           x="19.678703"
+           height="55.067017"
+           width="22.676216"
+           id="rect6890"
+           style="fill:#000000;fill-opacity:1;stroke-width:0.83614457" />
+        <rect
+           ry="5.0076761"
+           rx="33.472603"
+           y="26.373297"
+           x="28.167255"
+           height="54.845291"
+           width="5.7390733"
+           id="rect6893"
+           style="fill:#1a1a1a;fill-opacity:1;stroke-width:1.10055423" />
+      </g>
+    </g>
+    <g
+       id="key-on-position-layer"
+       transform="matrix(0.55545704,1.0861698,-1.0201291,0.5216844,72.66677,-32.920254)">
+      <g
+         visibility="hidden"
+         id="key-on-position"
+         transform="matrix(1.1281738,0,0,1.2266666,14.93372,-16.073443)"
+         style="fill:#4f81bd">
+        <rect
+           ry="5"
+           rx="20"
+           y="26.21656"
+           x="19.678703"
+           height="55.067017"
+           width="22.676216"
+           id="rect6890-0"
+           style="fill:#4f81bd;fill-opacity:1;stroke-width:0.83614457" />
+        <rect
+           ry="5.0076761"
+           rx="33.472603"
+           y="26.373297"
+           x="28.167255"
+           height="54.845291"
+           width="5.7390733"
+           id="rect6893-3"
+           style="fill:#1a1a1a;fill-opacity:1;stroke-width:1.10055423" />
+      </g>
+    </g>
+    <g
+       id="engine-started-layer"
+       transform="matrix(0.01972985,1.2197984,-1.1456328,0.0185302,105.67114,-14.504551)">
+      <g
+         visibility="hidden"
+         id="engine-start"
+         transform="matrix(1.0996363,0.26846651,-0.25748706,1.1956376,29.658811,-22.732608)"
+         style="fill:#00cc00">
+        <rect
+           ry="5"
+           rx="20"
+           y="26.21656"
+           x="19.678703"
+           height="55.067017"
+           width="22.676216"
+           id="rect6890-0-7"
+           style="fill:#00cc00;fill-opacity:1;stroke-width:0.83614457" />
+        <rect
+           ry="5.0076761"
+           rx="33.472603"
+           y="26.373297"
+           x="28.167255"
+           height="54.845291"
+           width="5.7390733"
+           id="rect6893-3-2"
+           style="fill:#1a1a1a;fill-opacity:1;stroke-width:1.10055423" />
+      </g>
+    </g>
+  </g>
+  <circle
+     style="fill:#216775;fill-opacity:1;stroke-width:0.14762825"
+     cy="91.501801"
+     cx="30.085047"
+     id="PitmanNeutral"
+     r="2" />
+  <rect
+     id="rect189"
+     width="179.96185"
+     height="8.5943508"
+     x="0"
+     y="126.67359"
+     style="fill:#999999;stroke-width:0.24568108" />
+  <text
+     id="timer-txt"
+     style="font-variant:normal;font-weight:normal;font-size:6.46923256px;font-family:'Fira Sans';writing-mode:lr-tb;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.29384649"
+     x="-123.0052"
+     y="-21.679113">
+    <tspan
+       id="timer-text"
+       y="133.58247"
+       x="21.905622"
+       style="stroke-width:1.29384649">Timer</tspan>
+  </text>
+</svg>
diff --git a/B2Program/LightModel/PitmanController_TIME_MC_v4-visualisation.js b/B2Program/LightModel/PitmanController_TIME_MC_v4-visualisation.js
new file mode 100644
index 0000000000000000000000000000000000000000..7825719f114abc03a0e40e12bcba9ef6e5f9dfaa
--- /dev/null
+++ b/B2Program/LightModel/PitmanController_TIME_MC_v4-visualisation.js
@@ -0,0 +1,2062 @@
+import PitmanController_TIME_MC_v4 from "./PitmanController_TIME_MC_v4.js";
+import {SelectError} from "./btypes/BUtils.js";
+import {enum_PITMAN_POSITION} from "./Sensors.js"
+import {PITMAN_POSITION} from "./Sensors.js"
+import {enum_SWITCH_STATUS} from "./Sensors.js"
+import {SWITCH_STATUS} from "./Sensors.js"
+import {enum_KEY_STATE} from "./Sensors.js"
+import {KEY_STATE} from "./Sensors.js"
+import {enum_TIMERS} from "./GenericTimersMC.js"
+import {TIMERS} from "./GenericTimersMC.js"
+import {enum_DIRECTIONS} from "./BlinkLamps_v3.js"
+import {DIRECTIONS} from "./BlinkLamps_v3.js"
+import {BTuple} from "./btypes/BTuple.js";
+import {BSet} from "./btypes/BSet.js";
+import {BRelation} from "./btypes/BRelation.js";
+import {BInteger} from "./btypes/BInteger.js";
+import {BBoolean} from "./btypes/BBoolean.js";
+import {BObject} from "./btypes/BObject.js";
+import {BString} from "./btypes/BString.js";
+
+var _machine = new PitmanController_TIME_MC_v4();
+var _state_list = [];
+var _transition_list = [];
+var _included_machines = {};
+_included_machines["PitmanController_TIME_MC_v4"] = function(){return _machine};
+_included_machines["BlinkLamps_v3"] = function(){return _machine._BlinkLamps_v3};
+_included_machines["Sensors"] = function(){return _machine._Sensors};
+_included_machines["GenericTimersMC"] = function(){return _machine._GenericTimersMC};
+var _state_view_vars = document.getElementById("_state_view_variables");
+var _state_view_consts = document.getElementById("_state_view_constants");
+var _state_view_sets = document.getElementById("_state_view_sets");
+var _state_view_invariant = document.getElementById("_state_view_invariant");
+var _svg_vars = {}
+_svg_vars["circle-PitmanDownward"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("circle-PitmanDownward")
+_svg_vars["PitmanNeutral"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("PitmanNeutral")
+_svg_vars["A-left"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("A-left")
+_svg_vars["key-inserted"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("key-inserted")
+_svg_vars["A-right"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("A-right")
+_svg_vars["car_outline"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("car_outline")
+_svg_vars["B-right"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("B-right")
+_svg_vars["back-window"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("back-window")
+_svg_vars["C-left"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("C-left")
+_svg_vars["C-right"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("C-right")
+_svg_vars["timer-text"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("timer-text")
+_svg_vars["engine-start"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("engine-start")
+_svg_vars["key-on-position"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("key-on-position")
+_svg_vars["warningLight"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("warningLight")
+_svg_vars["circle-PitmanUpward"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("circle-PitmanUpward")
+_svg_vars["key-on-text"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("key-on-text")
+_svg_vars["PitmanDownward"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("PitmanDownward")
+_svg_vars["B-left"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("B-left")
+_svg_vars["PitmanUpward"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("PitmanUpward")
+_svg_vars["front-window"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("front-window")
+var _machine_vars = {}
+var _var_label;
+var _var_div;
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["BlinkLamps_v3"]()._get_active_blinkers();
+_var_div.id = "_var_active_blinkers";
+_machine_vars["active_blinkers"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_active_blinkers";
+_var_label.innerHTML = "BlinkLamps_v3.active_blinkers";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["BlinkLamps_v3"]()._get_remaining_blinks();
+_var_div.id = "_var_remaining_blinks";
+_machine_vars["remaining_blinks"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_remaining_blinks";
+_var_label.innerHTML = "BlinkLamps_v3.remaining_blinks";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["BlinkLamps_v3"]()._get_onCycle();
+_var_div.id = "_var_onCycle";
+_machine_vars["onCycle"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_onCycle";
+_var_label.innerHTML = "BlinkLamps_v3.onCycle";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["BlinkLamps_v3"]()._get_blinkLeft();
+_var_div.id = "_var_blinkLeft";
+_machine_vars["blinkLeft"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_blinkLeft";
+_var_label.innerHTML = "BlinkLamps_v3.blinkLeft";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["BlinkLamps_v3"]()._get_blinkRight();
+_var_div.id = "_var_blinkRight";
+_machine_vars["blinkRight"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_blinkRight";
+_var_label.innerHTML = "BlinkLamps_v3.blinkRight";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["Sensors"]()._get_hazardWarningSwitchOn();
+_var_div.id = "_var_hazardWarningSwitchOn";
+_machine_vars["hazardWarningSwitchOn"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_hazardWarningSwitchOn";
+_var_label.innerHTML = "Sensors.hazardWarningSwitchOn";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["Sensors"]()._get_pitmanArmUpDown();
+_var_div.id = "_var_pitmanArmUpDown";
+_machine_vars["pitmanArmUpDown"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_pitmanArmUpDown";
+_var_label.innerHTML = "Sensors.pitmanArmUpDown";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["Sensors"]()._get_keyState();
+_var_div.id = "_var_keyState";
+_machine_vars["keyState"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_keyState";
+_var_label.innerHTML = "Sensors.keyState";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["Sensors"]()._get_engineOn();
+_var_div.id = "_var_engineOn";
+_machine_vars["engineOn"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_engineOn";
+_var_label.innerHTML = "Sensors.engineOn";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["GenericTimersMC"]()._get_curDeadlines();
+_var_div.id = "_var_curDeadlines";
+_machine_vars["curDeadlines"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_curDeadlines";
+_var_label.innerHTML = "GenericTimersMC.curDeadlines";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["PitmanController_TIME_MC_v4"]()._get_pitman_direction();
+_var_div.id = "_var_pitman_direction";
+_machine_vars["pitman_direction"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_pitman_direction";
+_var_label.innerHTML = "PitmanController_TIME_MC_v4.pitman_direction";
+_state_view_consts.appendChild(_var_label);
+_state_view_consts.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["BlinkLamps_v3"]()._get_BLINK_DIRECTION();
+_var_div.id = "_var_BLINK_DIRECTION";
+_machine_vars["BLINK_DIRECTION"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_BLINK_DIRECTION";
+_var_label.innerHTML = "BlinkLamps_v3.BLINK_DIRECTION";
+_state_view_consts.appendChild(_var_label);
+_state_view_consts.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["BlinkLamps_v3"]()._get_LAMP_STATUS();
+_var_div.id = "_var_LAMP_STATUS";
+_machine_vars["LAMP_STATUS"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_LAMP_STATUS";
+_var_label.innerHTML = "BlinkLamps_v3.LAMP_STATUS";
+_state_view_consts.appendChild(_var_label);
+_state_view_consts.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["BlinkLamps_v3"]()._get_lamp_on();
+_var_div.id = "_var_lamp_on";
+_machine_vars["lamp_on"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_lamp_on";
+_var_label.innerHTML = "BlinkLamps_v3.lamp_on";
+_state_view_consts.appendChild(_var_label);
+_state_view_consts.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["BlinkLamps_v3"]()._get_lamp_off();
+_var_div.id = "_var_lamp_off";
+_machine_vars["lamp_off"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_lamp_off";
+_var_label.innerHTML = "BlinkLamps_v3.lamp_off";
+_state_view_consts.appendChild(_var_label);
+_state_view_consts.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["BlinkLamps_v3"]()._get_BLINK_CYCLE_COUNTER();
+_var_div.id = "_var_BLINK_CYCLE_COUNTER";
+_machine_vars["BLINK_CYCLE_COUNTER"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_BLINK_CYCLE_COUNTER";
+_var_label.innerHTML = "BlinkLamps_v3.BLINK_CYCLE_COUNTER";
+_state_view_consts.appendChild(_var_label);
+_state_view_consts.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["BlinkLamps_v3"]()._get_cycleMaxLampStatus();
+_var_div.id = "_var_cycleMaxLampStatus";
+_machine_vars["cycleMaxLampStatus"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_cycleMaxLampStatus";
+_var_label.innerHTML = "BlinkLamps_v3.cycleMaxLampStatus";
+_state_view_consts.appendChild(_var_label);
+_state_view_consts.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["Sensors"]()._get_PITMAN_DIRECTION_BLINKING();
+_var_div.id = "_var_PITMAN_DIRECTION_BLINKING";
+_machine_vars["PITMAN_DIRECTION_BLINKING"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_PITMAN_DIRECTION_BLINKING";
+_var_label.innerHTML = "Sensors.PITMAN_DIRECTION_BLINKING";
+_state_view_consts.appendChild(_var_label);
+_state_view_consts.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["Sensors"]()._get_PITMAN_TIP_BLINKING();
+_var_div.id = "_var_PITMAN_TIP_BLINKING";
+_machine_vars["PITMAN_TIP_BLINKING"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_PITMAN_TIP_BLINKING";
+_var_label.innerHTML = "Sensors.PITMAN_TIP_BLINKING";
+_state_view_consts.appendChild(_var_label);
+_state_view_consts.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["BlinkLamps_v3"]()._get__DIRECTIONS();
+_var_div.id = "_var_DIRECTIONS";
+_machine_vars["DIRECTIONS"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_DIRECTIONS";
+_var_label.innerHTML = "BlinkLamps_v3.DIRECTIONS";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["Sensors"]()._get__SWITCH_STATUS();
+_var_div.id = "_var_SWITCH_STATUS";
+_machine_vars["SWITCH_STATUS"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_SWITCH_STATUS";
+_var_label.innerHTML = "Sensors.SWITCH_STATUS";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["Sensors"]()._get__PITMAN_POSITION();
+_var_div.id = "_var_PITMAN_POSITION";
+_machine_vars["PITMAN_POSITION"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_PITMAN_POSITION";
+_var_label.innerHTML = "Sensors.PITMAN_POSITION";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["Sensors"]()._get__KEY_STATE();
+_var_div.id = "_var_KEY_STATE";
+_machine_vars["KEY_STATE"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_KEY_STATE";
+_var_label.innerHTML = "Sensors.KEY_STATE";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["GenericTimersMC"]()._get__TIMERS();
+_var_div.id = "_var_TIMERS";
+_machine_vars["TIMERS"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_TIMERS";
+_var_label.innerHTML = "GenericTimersMC.TIMERS";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["PitmanController_TIME_MC_v4"]()._check_inv_1();
+_var_div.id = "_check_inv_1";
+_machine_vars["_check_inv_1"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_1";
+_var_label.innerHTML = "hazardWarningSwitchOn=switch_on=>active_blinkers=BLINK_DIRECTION";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["PitmanController_TIME_MC_v4"]()._check_inv_2();
+_var_div.id = "_check_inv_2";
+_machine_vars["_check_inv_2"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_2";
+_var_label.innerHTML = "hazardWarningSwitchOn=switch_off&remaining_blinks=-1=>active_blinkers={pitman_direction(pitmanArmUpDown)}";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["PitmanController_TIME_MC_v4"]()._check_inv_3();
+_var_div.id = "_check_inv_3";
+_machine_vars["_check_inv_3"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_3";
+_var_label.innerHTML = "pitmanArmUpDown:PITMAN_DIRECTION_BLINKING&engineOn=TRUE=>{pitman_direction(pitmanArmUpDown)}<:active_blinkers";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["PitmanController_TIME_MC_v4"]()._check_inv_4();
+_var_div.id = "_check_inv_4";
+_machine_vars["_check_inv_4"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_4";
+_var_label.innerHTML = "engineOn=FALSE&hazardWarningSwitchOn=switch_off=>active_blinkers={}";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["PitmanController_TIME_MC_v4"]()._check_inv_5();
+_var_div.id = "_check_inv_5";
+_machine_vars["_check_inv_5"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_5";
+_var_label.innerHTML = "hazardWarningSwitchOn=switch_on⇒remaining_blinks=-1";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["PitmanController_TIME_MC_v4"]()._check_inv_6();
+_var_div.id = "_check_inv_6";
+_machine_vars["_check_inv_6"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_6";
+_var_label.innerHTML = "pitmanArmUpDown∈PITMAN_DIRECTION_BLINKING&engineOn=TRUE⇒remaining_blinks=-1";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+
+function updateVisuals () {
+  _svg_vars["key-inserted"].setAttribute("visibility", (_machine._Sensors._get_keyState().equal(new KEY_STATE(enum_KEY_STATE.NoKeyInserted)).booleanValue() ? new BString("visible") : new BString("hidden")).getValue());
+  _svg_vars["circle-PitmanUpward"].setAttribute("stroke-opacity", (_machine._Sensors._get_pitmanArmUpDown().equal(new PITMAN_POSITION(enum_PITMAN_POSITION.Upward7)).booleanValue() ? new BString("1") : (_machine._Sensors._get_pitmanArmUpDown().equal(new PITMAN_POSITION(enum_PITMAN_POSITION.Upward5)).booleanValue() ? new BString("0.6") : new BString("0.5"))).getValue());
+  _svg_vars["back-window"].setAttribute("fill", (_machine._Sensors._get_engineOn().equal(new BBoolean(true)).booleanValue() ? new BString("#f2f2f2") : new BString("white")).getValue());
+  _svg_vars["front-window"].setAttribute("fill", (_machine._Sensors._get_engineOn().equal(new BBoolean(true)).booleanValue() ? new BString("#f2f2f2") : new BString("white")).getValue());
+  _svg_vars["PitmanNeutral"].setAttribute("fill-opacity", (_machine._Sensors._get_pitmanArmUpDown().equal(new PITMAN_POSITION(enum_PITMAN_POSITION.Neutral)).booleanValue() ? new BString("1") : new BString("0.2")).getValue());
+  _svg_vars["B-right"].setAttribute("stroke-opacity", (_machine._BlinkLamps_v3._get_active_blinkers().elementOf(new DIRECTIONS(enum_DIRECTIONS.right_blink)).booleanValue() ? new BString("0.5") : new BString("1")).getValue());
+  _svg_vars["key-on-position"].setAttribute("visibility", (new BBoolean(_machine._Sensors._get_keyState().equal(new KEY_STATE(enum_KEY_STATE.NoKeyInserted)).booleanValue() || _machine._Sensors._get_engineOn().equal(new BBoolean(true)).booleanValue()).booleanValue() ? new BString("hidden") : new BString("visible")).getValue());
+  _svg_vars["A-left"].setAttribute("stroke-opacity", (_machine._BlinkLamps_v3._get_active_blinkers().elementOf(new DIRECTIONS(enum_DIRECTIONS.left_blink)).booleanValue() ? new BString("0.5") : new BString("1")).getValue());
+  _svg_vars["circle-PitmanUpward"].setAttribute("stroke-width", (_machine._Sensors._get_pitmanArmUpDown().equal(new PITMAN_POSITION(enum_PITMAN_POSITION.Upward7)).booleanValue() ? new BString("1") : (_machine._Sensors._get_pitmanArmUpDown().equal(new PITMAN_POSITION(enum_PITMAN_POSITION.Upward5)).booleanValue() ? new BString("0.6") : new BString("0.565"))).getValue());
+  _svg_vars["circle-PitmanDownward"].setAttribute("stroke-opacity", (_machine._Sensors._get_pitmanArmUpDown().equal(new PITMAN_POSITION(enum_PITMAN_POSITION.Downward7)).booleanValue() ? new BString("1") : (_machine._Sensors._get_pitmanArmUpDown().equal(new PITMAN_POSITION(enum_PITMAN_POSITION.Downward5)).booleanValue() ? new BString("0.6") : new BString("0.5"))).getValue());
+  _svg_vars["A-right"].setAttribute("fill", (_machine._BlinkLamps_v3._get_active_blinkers().elementOf(new DIRECTIONS(enum_DIRECTIONS.right_blink)).booleanValue() ? (_machine._BlinkLamps_v3._get_blinkRight().equal(_machine._BlinkLamps_v3._get_lamp_off()).booleanValue() ? new BString("#ffe6cc") : new BString("orange")) : new BString("white")).getValue());
+  _svg_vars["A-right"].setAttribute("stroke-opacity", (_machine._BlinkLamps_v3._get_active_blinkers().elementOf(new DIRECTIONS(enum_DIRECTIONS.right_blink)).booleanValue() ? new BString("0.5") : new BString("1")).getValue());
+  _svg_vars["PitmanDownward"].setAttribute("fill-opacity", (_machine._Sensors._get_pitmanArmUpDown().equal(new PITMAN_POSITION(enum_PITMAN_POSITION.Downward7)).booleanValue() ? new BString("1") : (_machine._Sensors._get_pitmanArmUpDown().equal(new PITMAN_POSITION(enum_PITMAN_POSITION.Downward5)).booleanValue() ? new BString("0.85") : new BString("0.2"))).getValue());
+  _svg_vars["warningLight"].setAttribute("fill-opacity", (_machine._Sensors._get_hazardWarningSwitchOn().equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_on)).booleanValue() ? new BString("0.7") : new BString("0.05")).getValue());
+  _svg_vars["car_outline"].setAttribute("stroke-opacity", (_machine._Sensors._get_engineOn().equal(new BBoolean(true)).booleanValue() ? new BString("1.0") : new BString("0.5")).getValue());
+  _svg_vars["C-left"].setAttribute("fill", (_machine._BlinkLamps_v3._get_active_blinkers().elementOf(new DIRECTIONS(enum_DIRECTIONS.left_blink)).booleanValue() ? (_machine._BlinkLamps_v3._get_blinkLeft().equal(_machine._BlinkLamps_v3._get_lamp_off()).booleanValue() ? new BString("#ffe6cc") : new BString("orange")) : new BString("white")).getValue());
+  _svg_vars["B-right"].setAttribute("fill", (_machine._BlinkLamps_v3._get_active_blinkers().elementOf(new DIRECTIONS(enum_DIRECTIONS.right_blink)).booleanValue() ? (_machine._BlinkLamps_v3._get_blinkRight().equal(_machine._BlinkLamps_v3._get_lamp_off()).booleanValue() ? new BString("#ffe6cc") : new BString("orange")) : new BString("white")).getValue());
+  _svg_vars["B-left"].setAttribute("stroke-opacity", (_machine._BlinkLamps_v3._get_active_blinkers().elementOf(new DIRECTIONS(enum_DIRECTIONS.left_blink)).booleanValue() ? new BString("0.5") : new BString("1")).getValue());
+  _svg_vars["key-on-text"].setAttribute("fill", (new BBoolean(_machine._Sensors._get_keyState().equal(new KEY_STATE(enum_KEY_STATE.NoKeyInserted)).booleanValue() || _machine._Sensors._get_engineOn().equal(new BBoolean(true)).booleanValue()).booleanValue() ? new BString("#f2f2f2") : new BString("#ccffcc")).getValue());
+  _svg_vars["A-left"].setAttribute("fill", (_machine._BlinkLamps_v3._get_active_blinkers().elementOf(new DIRECTIONS(enum_DIRECTIONS.left_blink)).booleanValue() ? (_machine._BlinkLamps_v3._get_blinkLeft().equal(_machine._BlinkLamps_v3._get_lamp_off()).booleanValue() ? new BString("#ffe6cc") : new BString("orange")) : new BString("white")).getValue());
+  _svg_vars["engine-start"].setAttribute("visibility", (new BBoolean(_machine._Sensors._get_keyState().equal(new KEY_STATE(enum_KEY_STATE.NoKeyInserted)).booleanValue() || _machine._Sensors._get_engineOn().equal(new BBoolean(false)).booleanValue()).booleanValue() ? new BString("hidden") : new BString("visible")).getValue());
+  _svg_vars["B-left"].setAttribute("fill", (_machine._BlinkLamps_v3._get_active_blinkers().elementOf(new DIRECTIONS(enum_DIRECTIONS.left_blink)).booleanValue() ? (_machine._BlinkLamps_v3._get_blinkLeft().equal(_machine._BlinkLamps_v3._get_lamp_off()).booleanValue() ? new BString("#ffe6cc") : new BString("orange")) : new BString("white")).getValue());
+  _svg_vars["PitmanUpward"].setAttribute("fill-opacity", (_machine._Sensors._get_pitmanArmUpDown().equal(new PITMAN_POSITION(enum_PITMAN_POSITION.Upward7)).booleanValue() ? new BString("1") : (_machine._Sensors._get_pitmanArmUpDown().equal(new PITMAN_POSITION(enum_PITMAN_POSITION.Upward5)).booleanValue() ? new BString("0.85") : new BString("0.2"))).getValue());
+  _svg_vars["timer-text"].setAttribute("text", new BString("").getValue());
+  _svg_vars["C-right"].setAttribute("fill", (_machine._BlinkLamps_v3._get_active_blinkers().elementOf(new DIRECTIONS(enum_DIRECTIONS.right_blink)).booleanValue() ? (_machine._BlinkLamps_v3._get_blinkRight().equal(_machine._BlinkLamps_v3._get_lamp_off()).booleanValue() ? new BString("#ffe6cc") : new BString("orange")) : new BString("white")).getValue());
+  _svg_vars["C-right"].setAttribute("stroke-opacity", (_machine._BlinkLamps_v3._get_active_blinkers().elementOf(new DIRECTIONS(enum_DIRECTIONS.right_blink)).booleanValue() ? new BString("0.5") : new BString("1")).getValue());
+  _svg_vars["C-left"].setAttribute("stroke-opacity", (_machine._BlinkLamps_v3._get_active_blinkers().elementOf(new DIRECTIONS(enum_DIRECTIONS.left_blink)).booleanValue() ? new BString("0.5") : new BString("1")).getValue());
+  _svg_vars["circle-PitmanDownward"].setAttribute("stroke-width", (_machine._Sensors._get_pitmanArmUpDown().equal(new PITMAN_POSITION(enum_PITMAN_POSITION.Downward7)).booleanValue() ? new BString("1") : (_machine._Sensors._get_pitmanArmUpDown().equal(new PITMAN_POSITION(enum_PITMAN_POSITION.Downward5)).booleanValue() ? new BString("0.6") : new BString("0.565"))).getValue());
+  _machine_vars["active_blinkers"].innerHTML = _included_machines["BlinkLamps_v3"]()._get_active_blinkers();
+  _machine_vars["remaining_blinks"].innerHTML = _included_machines["BlinkLamps_v3"]()._get_remaining_blinks();
+  _machine_vars["onCycle"].innerHTML = _included_machines["BlinkLamps_v3"]()._get_onCycle();
+  _machine_vars["blinkLeft"].innerHTML = _included_machines["BlinkLamps_v3"]()._get_blinkLeft();
+  _machine_vars["blinkRight"].innerHTML = _included_machines["BlinkLamps_v3"]()._get_blinkRight();
+  _machine_vars["hazardWarningSwitchOn"].innerHTML = _included_machines["Sensors"]()._get_hazardWarningSwitchOn();
+  _machine_vars["pitmanArmUpDown"].innerHTML = _included_machines["Sensors"]()._get_pitmanArmUpDown();
+  _machine_vars["keyState"].innerHTML = _included_machines["Sensors"]()._get_keyState();
+  _machine_vars["engineOn"].innerHTML = _included_machines["Sensors"]()._get_engineOn();
+  _machine_vars["curDeadlines"].innerHTML = _included_machines["GenericTimersMC"]()._get_curDeadlines();
+  for (let i = 1; i <= 6; i++) {
+    _machine_vars["_check_inv_"+i].innerHTML = _machine["_check_inv_"+i]();
+  }
+  checkTransitions();
+}
+
+var _history_view_buttons = document.getElementById("_history_view_buttons");
+var _buttonLeft = document.createElement("button");
+var _buttonRight = document.createElement("button");
+var _buttonUpload = document.createElement("button");
+var _buttonExport = document.createElement("button");
+var _inputUpload = document.createElement("input");
+var _buttonRun10 = document.createElement("button");
+var _buttonRun500 = document.createElement("button");
+
+function flattenTuple(tuple) {
+    if(!(tuple instanceof BTuple)) {
+        return [tuple];
+    }
+    return [tuple.projection1(), ...flattenTuple(tuple.projection2())];
+}
+
+function createOptionList(event, transition) {
+    let collator = new Intl.Collator([], {numeric: true});
+    for(let index in _machine_events[event].parameterNames) {
+        let parameter = _machine_events[event].parameterNames[index];
+        var datalist = document.querySelector("#" + event + "_" + parameter + "_datalist");
+        datalist.replaceChildren();
+        for(let value of Array.of(...transition).sort((a, b) => collator.compare(a, b))) {
+            let option = document.createElement("option");
+            value = flattenTuple(value);
+            option.text = value[index].toString();
+            datalist.appendChild(option);
+        }
+    }
+}
+
+function checkTransitions () {
+    let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+    for(event in _machine_events) {
+      var transition;
+      if(_transition_list[index]?.[event] == null ?? true) {
+         transition = _machine["_tr_" + event]();
+         _transition_list[index][event] = transition;
+      } else {
+         transition = _transition_list[index][event];
+      }
+      if(!(transition instanceof BSet)) {
+        _machine_events[event].disabled = !transition;
+      } else if (transition.size().intValue() == 0) {
+        _machine_events[event].disabled = true;
+      } else {
+        let collator = new Intl.Collator([], {numeric: true});
+        for(let current_transition of transition) {
+            try {
+                var current_machine = _machine._copy();
+                current_machine[event](...flattenTuple(current_transition));
+            } catch (error) {
+                  if(! error instanceof SelectError) {
+                      throw error;
+                  }
+                  transition = transition.difference(new BSet(current_transition));
+            }
+        }
+        if(transition.size().intValue() == 0) {
+            _machine_events[event].disabled = true;
+        } else {
+            _machine_events[event].disabled = false;
+        }
+        createOptionList(event, transition);
+      }
+    }
+    _buttonLeft.disabled = document.querySelector(".active").index <= 0;
+    _buttonRight.disabled = document.querySelector(".active").index >= document.querySelector("span:last-of-type").index;
+}
+
+_operations_view = document.getElementById("_operations_view");
+_history_view = document.getElementById("_history_view");
+_scenario_view = document.getElementById("_scenario_view");
+
+var _history_onclick_function = function () {
+  _machine = _state_list[this.index]._copy();
+  document.querySelectorAll("span").forEach(el => el.classList.remove("active"));
+  this.classList.add("active");
+  updateVisuals();
+}
+
+function createHistoryElement(text, index) {
+  var history_element = document.createElement("span");
+  history_element.innerHTML = text + "</br>";
+  history_element.index = index;
+  document.querySelectorAll("span.active").forEach(element => element.classList.remove("active"));
+  history_element.classList.add("active");
+  history_element.onclick = _history_onclick_function;
+  _state_list = _state_list.slice(0, index);
+  _state_list.push(_machine._copy());
+  _transition_list = _transition_list.slice(0, index);
+  _transition_list.push({});
+  while(_history_view.querySelectorAll("span").length > index && _history_view.lastChild !== null) {
+    _history_view.removeChild(_history_view.lastChild);
+  }
+  _history_view.appendChild(history_element);
+}
+
+function selectHistoryElement(offset) {
+  let currentHistoryElement = _history_view.querySelector(".active");
+  let index = currentHistoryElement.index + offset;
+  if (index < 0 || index >= _state_list.length) {
+    return;
+  }
+  currentHistoryElement.classList.remove("active");
+  _machine = _state_list[index]._copy();
+  _history_view.querySelectorAll(".active").forEach(el => el.classList.remove("active"));
+  currentHistoryElement = _history_view.querySelector("span:nth-of-type(" + (index + 1) + ")");
+  currentHistoryElement.classList.add("active");
+  updateVisuals();
+}
+
+function createScenarioElement(text, trace) {
+  var scenario_element = document.createElement("button");
+  var remove_element = document.createElement("button");
+  scenario_element.innerHTML = text + "</br>";
+  remove_element.innerHTML = "X";
+  var div_element = document.createElement("div");
+  div_element.appendChild(scenario_element);
+  div_element.appendChild(remove_element);
+  _scenario_view.appendChild(div_element);
+  scenario_element.onclick = function() {
+    displayTrace(trace);
+  };
+  remove_element.onclick = function() {
+    _scenario_view.removeChild(div_element);
+  };
+}
+
+
+_buttonLeft.innerHTML="&#9664;";
+_buttonLeft.onclick = function(){selectHistoryElement(-1)};
+_buttonRight.innerHTML="&#9654;";
+_buttonRight.onclick = function(){selectHistoryElement(1)};
+_history_view_buttons.appendChild(_buttonLeft);
+_history_view_buttons.appendChild(_buttonRight);
+
+_buttonUpload.textContent = "Import trace";
+_buttonUpload.onclick = importTrace;
+_history_view_buttons.appendChild(_buttonUpload);
+
+_buttonExport.textContent = "Export trace";
+_buttonExport.onclick = exportTrace;
+_history_view_buttons.appendChild(_buttonExport);
+
+_buttonRun10.textContent = "Run trace(10ms)";
+_buttonRun10.onclick = function(){runTrace(10);};
+_history_view_buttons.appendChild(_buttonRun10);
+
+_buttonRun500.textContent = "Run trace(500ms)";
+_buttonRun500.onclick = function(){runTrace(500);};
+_history_view_buttons.appendChild(_buttonRun500);
+
+createHistoryElement("Initialisation", 0);
+var _current_trace = [{name: "$initialise_machine", params: {}}];
+
+var _param_div;
+var _param_datalist;
+var _onclick_function;
+var _machine_events = {};
+var _svg_events = {};
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["ENV_Pitman_Reset_to_Neutral"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["ENV_Pitman_Reset_to_Neutral"].style.gridColumn="-1";
+_machine_events["ENV_Pitman_Reset_to_Neutral"].innerHTML = "ENV_Pitman_Reset_to_Neutral";
+_machine_events["ENV_Pitman_Reset_to_Neutral"].parameterNames = [];
+_machine_events["ENV_Pitman_Reset_to_Neutral"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["ENV_Pitman_Reset_to_Neutral"] == null ?? true) {
+      transition = _machine["_tr_ENV_Pitman_Reset_to_Neutral"]();
+      _transition_list[index]["ENV_Pitman_Reset_to_Neutral"] = transition;
+  } else {
+      transition = _transition_list[index]["ENV_Pitman_Reset_to_Neutral"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event ENV_Pitman_Reset_to_Neutral is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event ENV_Pitman_Reset_to_Neutral!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event ENV_Pitman_Reset_to_Neutral!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.ENV_Pitman_Reset_to_Neutral(...parameters);
+    createHistoryElement("ENV_Pitman_Reset_to_Neutral(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "ENV_Pitman_Reset_to_Neutral", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["ENV_Pitman_Reset_to_Neutral"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["ENV_Pitman_Reset_to_Neutral"].disabled = true;
+        }
+        createOptionList("ENV_Pitman_Reset_to_Neutral", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["ENV_Pitman_Reset_to_Neutral"]);
+
+_svg_events["PitmanNeutral"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("PitmanNeutral");
+_svg_events["PitmanNeutral"].onclick = function() {
+  var parameters = {
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["ENV_Pitman_Reset_to_Neutral"] == null ?? true) {
+      transition = _machine["_tr_ENV_Pitman_Reset_to_Neutral"]();
+      _transition_list[index]["ENV_Pitman_Reset_to_Neutral"] = transition;
+  } else {
+      transition = _transition_list[index]["ENV_Pitman_Reset_to_Neutral"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event ENV_Pitman_Reset_to_Neutral is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event ENV_Pitman_Reset_to_Neutral!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event ENV_Pitman_Reset_to_Neutral!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.ENV_Pitman_Reset_to_Neutral(...parameters);
+    createHistoryElement("ENV_Pitman_Reset_to_Neutral(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "ENV_Pitman_Reset_to_Neutral", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["ENV_Pitman_Reset_to_Neutral"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["ENV_Pitman_Reset_to_Neutral"].disabled = true;
+        }
+        createOptionList("ENV_Pitman_Reset_to_Neutral", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["ENV_Pitman_Tip_blinking_start"] = document.createElement("button");
+var newPos_label = document.createElement("label")
+newPos_label.textContent = "newPos:";
+newPos_label.htmlFor="newPos";
+_param_div.appendChild(newPos_label);
+var newPos = document.createElement("input");
+newPos.id="newPos";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="ENV_Pitman_Tip_blinking_start_newPos_datalist";
+_param_div.appendChild(_param_datalist);
+newPos.setAttribute("list", "ENV_Pitman_Tip_blinking_start_newPos_datalist");
+newPos.getValue = function() {return PITMAN_POSITION["get_" + this.value]()}
+newPos.parseValue = function(value) {return PITMAN_POSITION["get_" + value]()}
+_param_div.appendChild(newPos);
+_machine_events["ENV_Pitman_Tip_blinking_start"]["newPos"] = newPos;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["ENV_Pitman_Tip_blinking_start"].style.gridColumn="-1";
+_machine_events["ENV_Pitman_Tip_blinking_start"].innerHTML = "ENV_Pitman_Tip_blinking_start";
+_machine_events["ENV_Pitman_Tip_blinking_start"].parameterNames = ["newPos", ];
+_machine_events["ENV_Pitman_Tip_blinking_start"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["ENV_Pitman_Tip_blinking_start"] == null ?? true) {
+      transition = _machine["_tr_ENV_Pitman_Tip_blinking_start"]();
+      _transition_list[index]["ENV_Pitman_Tip_blinking_start"] = transition;
+  } else {
+      transition = _transition_list[index]["ENV_Pitman_Tip_blinking_start"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event ENV_Pitman_Tip_blinking_start is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.newPos ?? _machine_events["ENV_Pitman_Tip_blinking_start"]["newPos"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event ENV_Pitman_Tip_blinking_start!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event ENV_Pitman_Tip_blinking_start!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.newPos ?? _machine_events["ENV_Pitman_Tip_blinking_start"]["newPos"].getValue(), ];
+    var returnValue = _machine.ENV_Pitman_Tip_blinking_start(...parameters);
+    createHistoryElement("ENV_Pitman_Tip_blinking_start(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["newPos"] = _machine_events["ENV_Pitman_Tip_blinking_start"]["newPos"].getValue().toString();
+
+    _current_trace.push({name: "ENV_Pitman_Tip_blinking_start", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.newPos ?? _machine_events["ENV_Pitman_Tip_blinking_start"]["newPos"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["ENV_Pitman_Tip_blinking_start"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["ENV_Pitman_Tip_blinking_start"].disabled = true;
+        }
+        createOptionList("ENV_Pitman_Tip_blinking_start", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["ENV_Pitman_Tip_blinking_start"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["RTIME_Nothing"] = document.createElement("button");
+var delta_label = document.createElement("label")
+delta_label.textContent = "delta:";
+delta_label.htmlFor="delta";
+_param_div.appendChild(delta_label);
+var delta = document.createElement("input");
+delta.id="delta";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="RTIME_Nothing_delta_datalist";
+_param_div.appendChild(_param_datalist);
+delta.setAttribute("list", "RTIME_Nothing_delta_datalist");
+delta.getValue = function() {return new BInteger(parseInt(this.value))}
+delta.parseValue = function(value) {return new BInteger(parseInt(value))}
+_param_div.appendChild(delta);
+_machine_events["RTIME_Nothing"]["delta"] = delta;
+var newOnCycle_label = document.createElement("label")
+newOnCycle_label.textContent = "newOnCycle:";
+newOnCycle_label.htmlFor="newOnCycle";
+_param_div.appendChild(newOnCycle_label);
+var newOnCycle = document.createElement("input");
+newOnCycle.id="newOnCycle";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="RTIME_Nothing_newOnCycle_datalist";
+_param_div.appendChild(_param_datalist);
+newOnCycle.setAttribute("list", "RTIME_Nothing_newOnCycle_datalist");
+newOnCycle.getValue = function() {return new BBoolean(this.value == "true")}
+newOnCycle.parseValue = function(value) {return new BBoolean(value == "true")}
+_param_div.appendChild(newOnCycle);
+_machine_events["RTIME_Nothing"]["newOnCycle"] = newOnCycle;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["RTIME_Nothing"].style.gridColumn="-1";
+_machine_events["RTIME_Nothing"].innerHTML = "RTIME_Nothing";
+_machine_events["RTIME_Nothing"].parameterNames = ["delta", "newOnCycle", ];
+_machine_events["RTIME_Nothing"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["RTIME_Nothing"] == null ?? true) {
+      transition = _machine["_tr_RTIME_Nothing"]();
+      _transition_list[index]["RTIME_Nothing"] = transition;
+  } else {
+      transition = _transition_list[index]["RTIME_Nothing"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event RTIME_Nothing is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.delta ?? _machine_events["RTIME_Nothing"]["delta"].getValue(), parameters?.newOnCycle ?? _machine_events["RTIME_Nothing"]["newOnCycle"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event RTIME_Nothing!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event RTIME_Nothing!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.delta ?? _machine_events["RTIME_Nothing"]["delta"].getValue(), parameters?.newOnCycle ?? _machine_events["RTIME_Nothing"]["newOnCycle"].getValue(), ];
+    var returnValue = _machine.RTIME_Nothing(...parameters);
+    createHistoryElement("RTIME_Nothing(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["delta"] = _machine_events["RTIME_Nothing"]["delta"].getValue().toString();
+    parametersJSON["newOnCycle"] = _machine_events["RTIME_Nothing"]["newOnCycle"].getValue().toString();
+
+    _current_trace.push({name: "RTIME_Nothing", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.delta ?? _machine_events["RTIME_Nothing"]["delta"].getValue(), parameters?.newOnCycle ?? _machine_events["RTIME_Nothing"]["newOnCycle"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["RTIME_Nothing"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["RTIME_Nothing"].disabled = true;
+        }
+        createOptionList("RTIME_Nothing", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["RTIME_Nothing"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["ENV_Pitman_DirectionBlinking"] = document.createElement("button");
+var newPos_label = document.createElement("label")
+newPos_label.textContent = "newPos:";
+newPos_label.htmlFor="newPos";
+_param_div.appendChild(newPos_label);
+var newPos = document.createElement("input");
+newPos.id="newPos";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="ENV_Pitman_DirectionBlinking_newPos_datalist";
+_param_div.appendChild(_param_datalist);
+newPos.setAttribute("list", "ENV_Pitman_DirectionBlinking_newPos_datalist");
+newPos.getValue = function() {return PITMAN_POSITION["get_" + this.value]()}
+newPos.parseValue = function(value) {return PITMAN_POSITION["get_" + value]()}
+_param_div.appendChild(newPos);
+_machine_events["ENV_Pitman_DirectionBlinking"]["newPos"] = newPos;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["ENV_Pitman_DirectionBlinking"].style.gridColumn="-1";
+_machine_events["ENV_Pitman_DirectionBlinking"].innerHTML = "ENV_Pitman_DirectionBlinking";
+_machine_events["ENV_Pitman_DirectionBlinking"].parameterNames = ["newPos", ];
+_machine_events["ENV_Pitman_DirectionBlinking"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["ENV_Pitman_DirectionBlinking"] == null ?? true) {
+      transition = _machine["_tr_ENV_Pitman_DirectionBlinking"]();
+      _transition_list[index]["ENV_Pitman_DirectionBlinking"] = transition;
+  } else {
+      transition = _transition_list[index]["ENV_Pitman_DirectionBlinking"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event ENV_Pitman_DirectionBlinking is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.newPos ?? _machine_events["ENV_Pitman_DirectionBlinking"]["newPos"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event ENV_Pitman_DirectionBlinking!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event ENV_Pitman_DirectionBlinking!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.newPos ?? _machine_events["ENV_Pitman_DirectionBlinking"]["newPos"].getValue(), ];
+    var returnValue = _machine.ENV_Pitman_DirectionBlinking(...parameters);
+    createHistoryElement("ENV_Pitman_DirectionBlinking(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["newPos"] = _machine_events["ENV_Pitman_DirectionBlinking"]["newPos"].getValue().toString();
+
+    _current_trace.push({name: "ENV_Pitman_DirectionBlinking", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.newPos ?? _machine_events["ENV_Pitman_DirectionBlinking"]["newPos"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["ENV_Pitman_DirectionBlinking"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["ENV_Pitman_DirectionBlinking"].disabled = true;
+        }
+        createOptionList("ENV_Pitman_DirectionBlinking", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["ENV_Pitman_DirectionBlinking"]);
+
+_svg_events["PitmanUpward"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("PitmanUpward");
+_svg_events["PitmanUpward"].onclick = function() {
+  var parameters = {
+    newPos: new PITMAN_POSITION(enum_PITMAN_POSITION.Upward7),
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["ENV_Pitman_DirectionBlinking"] == null ?? true) {
+      transition = _machine["_tr_ENV_Pitman_DirectionBlinking"]();
+      _transition_list[index]["ENV_Pitman_DirectionBlinking"] = transition;
+  } else {
+      transition = _transition_list[index]["ENV_Pitman_DirectionBlinking"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event ENV_Pitman_DirectionBlinking is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.newPos ?? _machine_events["ENV_Pitman_DirectionBlinking"]["newPos"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event ENV_Pitman_DirectionBlinking!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event ENV_Pitman_DirectionBlinking!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.newPos ?? _machine_events["ENV_Pitman_DirectionBlinking"]["newPos"].getValue(), ];
+    var returnValue = _machine.ENV_Pitman_DirectionBlinking(...parameters);
+    createHistoryElement("ENV_Pitman_DirectionBlinking(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["newPos"] = _machine_events["ENV_Pitman_DirectionBlinking"]["newPos"].getValue().toString();
+
+    _current_trace.push({name: "ENV_Pitman_DirectionBlinking", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.newPos ?? _machine_events["ENV_Pitman_DirectionBlinking"]["newPos"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["ENV_Pitman_DirectionBlinking"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["ENV_Pitman_DirectionBlinking"].disabled = true;
+        }
+        createOptionList("ENV_Pitman_DirectionBlinking", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_svg_events["PitmanDownward"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("PitmanDownward");
+_svg_events["PitmanDownward"].onclick = function() {
+  var parameters = {
+    newPos: new PITMAN_POSITION(enum_PITMAN_POSITION.Downward7),
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["ENV_Pitman_DirectionBlinking"] == null ?? true) {
+      transition = _machine["_tr_ENV_Pitman_DirectionBlinking"]();
+      _transition_list[index]["ENV_Pitman_DirectionBlinking"] = transition;
+  } else {
+      transition = _transition_list[index]["ENV_Pitman_DirectionBlinking"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event ENV_Pitman_DirectionBlinking is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.newPos ?? _machine_events["ENV_Pitman_DirectionBlinking"]["newPos"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event ENV_Pitman_DirectionBlinking!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event ENV_Pitman_DirectionBlinking!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.newPos ?? _machine_events["ENV_Pitman_DirectionBlinking"]["newPos"].getValue(), ];
+    var returnValue = _machine.ENV_Pitman_DirectionBlinking(...parameters);
+    createHistoryElement("ENV_Pitman_DirectionBlinking(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["newPos"] = _machine_events["ENV_Pitman_DirectionBlinking"]["newPos"].getValue().toString();
+
+    _current_trace.push({name: "ENV_Pitman_DirectionBlinking", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.newPos ?? _machine_events["ENV_Pitman_DirectionBlinking"]["newPos"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["ENV_Pitman_DirectionBlinking"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["ENV_Pitman_DirectionBlinking"].disabled = true;
+        }
+        createOptionList("ENV_Pitman_DirectionBlinking", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["RTIME_BlinkerOn"] = document.createElement("button");
+var delta_label = document.createElement("label")
+delta_label.textContent = "delta:";
+delta_label.htmlFor="delta";
+_param_div.appendChild(delta_label);
+var delta = document.createElement("input");
+delta.id="delta";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="RTIME_BlinkerOn_delta_datalist";
+_param_div.appendChild(_param_datalist);
+delta.setAttribute("list", "RTIME_BlinkerOn_delta_datalist");
+delta.getValue = function() {return new BInteger(parseInt(this.value))}
+delta.parseValue = function(value) {return new BInteger(parseInt(value))}
+_param_div.appendChild(delta);
+_machine_events["RTIME_BlinkerOn"]["delta"] = delta;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["RTIME_BlinkerOn"].style.gridColumn="-1";
+_machine_events["RTIME_BlinkerOn"].innerHTML = "RTIME_BlinkerOn";
+_machine_events["RTIME_BlinkerOn"].parameterNames = ["delta", ];
+_machine_events["RTIME_BlinkerOn"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["RTIME_BlinkerOn"] == null ?? true) {
+      transition = _machine["_tr_RTIME_BlinkerOn"]();
+      _transition_list[index]["RTIME_BlinkerOn"] = transition;
+  } else {
+      transition = _transition_list[index]["RTIME_BlinkerOn"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event RTIME_BlinkerOn is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.delta ?? _machine_events["RTIME_BlinkerOn"]["delta"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event RTIME_BlinkerOn!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event RTIME_BlinkerOn!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.delta ?? _machine_events["RTIME_BlinkerOn"]["delta"].getValue(), ];
+    var returnValue = _machine.RTIME_BlinkerOn(...parameters);
+    createHistoryElement("RTIME_BlinkerOn(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["delta"] = _machine_events["RTIME_BlinkerOn"]["delta"].getValue().toString();
+
+    _current_trace.push({name: "RTIME_BlinkerOn", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.delta ?? _machine_events["RTIME_BlinkerOn"]["delta"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["RTIME_BlinkerOn"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["RTIME_BlinkerOn"].disabled = true;
+        }
+        createOptionList("RTIME_BlinkerOn", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["RTIME_BlinkerOn"]);
+
+_svg_events["A-left"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("A-left");
+_svg_events["A-left"].onclick = function() {
+  var parameters = {
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["RTIME_BlinkerOn"] == null ?? true) {
+      transition = _machine["_tr_RTIME_BlinkerOn"]();
+      _transition_list[index]["RTIME_BlinkerOn"] = transition;
+  } else {
+      transition = _transition_list[index]["RTIME_BlinkerOn"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event RTIME_BlinkerOn is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.delta ?? _machine_events["RTIME_BlinkerOn"]["delta"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event RTIME_BlinkerOn!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event RTIME_BlinkerOn!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.delta ?? _machine_events["RTIME_BlinkerOn"]["delta"].getValue(), ];
+    var returnValue = _machine.RTIME_BlinkerOn(...parameters);
+    createHistoryElement("RTIME_BlinkerOn(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["delta"] = _machine_events["RTIME_BlinkerOn"]["delta"].getValue().toString();
+
+    _current_trace.push({name: "RTIME_BlinkerOn", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.delta ?? _machine_events["RTIME_BlinkerOn"]["delta"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["RTIME_BlinkerOn"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["RTIME_BlinkerOn"].disabled = true;
+        }
+        createOptionList("RTIME_BlinkerOn", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_svg_events["B-left"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("B-left");
+_svg_events["B-left"].onclick = function() {
+  var parameters = {
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["RTIME_BlinkerOn"] == null ?? true) {
+      transition = _machine["_tr_RTIME_BlinkerOn"]();
+      _transition_list[index]["RTIME_BlinkerOn"] = transition;
+  } else {
+      transition = _transition_list[index]["RTIME_BlinkerOn"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event RTIME_BlinkerOn is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.delta ?? _machine_events["RTIME_BlinkerOn"]["delta"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event RTIME_BlinkerOn!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event RTIME_BlinkerOn!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.delta ?? _machine_events["RTIME_BlinkerOn"]["delta"].getValue(), ];
+    var returnValue = _machine.RTIME_BlinkerOn(...parameters);
+    createHistoryElement("RTIME_BlinkerOn(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["delta"] = _machine_events["RTIME_BlinkerOn"]["delta"].getValue().toString();
+
+    _current_trace.push({name: "RTIME_BlinkerOn", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.delta ?? _machine_events["RTIME_BlinkerOn"]["delta"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["RTIME_BlinkerOn"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["RTIME_BlinkerOn"].disabled = true;
+        }
+        createOptionList("RTIME_BlinkerOn", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_svg_events["C-left"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("C-left");
+_svg_events["C-left"].onclick = function() {
+  var parameters = {
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["RTIME_BlinkerOn"] == null ?? true) {
+      transition = _machine["_tr_RTIME_BlinkerOn"]();
+      _transition_list[index]["RTIME_BlinkerOn"] = transition;
+  } else {
+      transition = _transition_list[index]["RTIME_BlinkerOn"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event RTIME_BlinkerOn is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.delta ?? _machine_events["RTIME_BlinkerOn"]["delta"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event RTIME_BlinkerOn!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event RTIME_BlinkerOn!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.delta ?? _machine_events["RTIME_BlinkerOn"]["delta"].getValue(), ];
+    var returnValue = _machine.RTIME_BlinkerOn(...parameters);
+    createHistoryElement("RTIME_BlinkerOn(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["delta"] = _machine_events["RTIME_BlinkerOn"]["delta"].getValue().toString();
+
+    _current_trace.push({name: "RTIME_BlinkerOn", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.delta ?? _machine_events["RTIME_BlinkerOn"]["delta"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["RTIME_BlinkerOn"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["RTIME_BlinkerOn"].disabled = true;
+        }
+        createOptionList("RTIME_BlinkerOn", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["ENV_Turn_EngineOff"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["ENV_Turn_EngineOff"].style.gridColumn="-1";
+_machine_events["ENV_Turn_EngineOff"].innerHTML = "ENV_Turn_EngineOff";
+_machine_events["ENV_Turn_EngineOff"].parameterNames = [];
+_machine_events["ENV_Turn_EngineOff"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["ENV_Turn_EngineOff"] == null ?? true) {
+      transition = _machine["_tr_ENV_Turn_EngineOff"]();
+      _transition_list[index]["ENV_Turn_EngineOff"] = transition;
+  } else {
+      transition = _transition_list[index]["ENV_Turn_EngineOff"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event ENV_Turn_EngineOff is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event ENV_Turn_EngineOff!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event ENV_Turn_EngineOff!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.ENV_Turn_EngineOff(...parameters);
+    createHistoryElement("ENV_Turn_EngineOff(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "ENV_Turn_EngineOff", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["ENV_Turn_EngineOff"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["ENV_Turn_EngineOff"].disabled = true;
+        }
+        createOptionList("ENV_Turn_EngineOff", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["ENV_Turn_EngineOff"]);
+
+_svg_events["engine-start"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("engine-start");
+_svg_events["engine-start"].onclick = function() {
+  var parameters = {
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["ENV_Turn_EngineOff"] == null ?? true) {
+      transition = _machine["_tr_ENV_Turn_EngineOff"]();
+      _transition_list[index]["ENV_Turn_EngineOff"] = transition;
+  } else {
+      transition = _transition_list[index]["ENV_Turn_EngineOff"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event ENV_Turn_EngineOff is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event ENV_Turn_EngineOff!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event ENV_Turn_EngineOff!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.ENV_Turn_EngineOff(...parameters);
+    createHistoryElement("ENV_Turn_EngineOff(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "ENV_Turn_EngineOff", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["ENV_Turn_EngineOff"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["ENV_Turn_EngineOff"].disabled = true;
+        }
+        createOptionList("ENV_Turn_EngineOff", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["ENV_Hazard_blinking"] = document.createElement("button");
+var newSwitchPos_label = document.createElement("label")
+newSwitchPos_label.textContent = "newSwitchPos:";
+newSwitchPos_label.htmlFor="newSwitchPos";
+_param_div.appendChild(newSwitchPos_label);
+var newSwitchPos = document.createElement("input");
+newSwitchPos.id="newSwitchPos";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="ENV_Hazard_blinking_newSwitchPos_datalist";
+_param_div.appendChild(_param_datalist);
+newSwitchPos.setAttribute("list", "ENV_Hazard_blinking_newSwitchPos_datalist");
+newSwitchPos.getValue = function() {return SWITCH_STATUS["get_" + this.value]()}
+newSwitchPos.parseValue = function(value) {return SWITCH_STATUS["get_" + value]()}
+_param_div.appendChild(newSwitchPos);
+_machine_events["ENV_Hazard_blinking"]["newSwitchPos"] = newSwitchPos;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["ENV_Hazard_blinking"].style.gridColumn="-1";
+_machine_events["ENV_Hazard_blinking"].innerHTML = "ENV_Hazard_blinking";
+_machine_events["ENV_Hazard_blinking"].parameterNames = ["newSwitchPos", ];
+_machine_events["ENV_Hazard_blinking"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["ENV_Hazard_blinking"] == null ?? true) {
+      transition = _machine["_tr_ENV_Hazard_blinking"]();
+      _transition_list[index]["ENV_Hazard_blinking"] = transition;
+  } else {
+      transition = _transition_list[index]["ENV_Hazard_blinking"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event ENV_Hazard_blinking is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.newSwitchPos ?? _machine_events["ENV_Hazard_blinking"]["newSwitchPos"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event ENV_Hazard_blinking!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event ENV_Hazard_blinking!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.newSwitchPos ?? _machine_events["ENV_Hazard_blinking"]["newSwitchPos"].getValue(), ];
+    var returnValue = _machine.ENV_Hazard_blinking(...parameters);
+    createHistoryElement("ENV_Hazard_blinking(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["newSwitchPos"] = _machine_events["ENV_Hazard_blinking"]["newSwitchPos"].getValue().toString();
+
+    _current_trace.push({name: "ENV_Hazard_blinking", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.newSwitchPos ?? _machine_events["ENV_Hazard_blinking"]["newSwitchPos"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["ENV_Hazard_blinking"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["ENV_Hazard_blinking"].disabled = true;
+        }
+        createOptionList("ENV_Hazard_blinking", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["ENV_Hazard_blinking"]);
+
+_svg_events["warningLightOuter"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("warningLightOuter");
+_svg_events["warningLightOuter"].onclick = function() {
+  var parameters = {
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["ENV_Hazard_blinking"] == null ?? true) {
+      transition = _machine["_tr_ENV_Hazard_blinking"]();
+      _transition_list[index]["ENV_Hazard_blinking"] = transition;
+  } else {
+      transition = _transition_list[index]["ENV_Hazard_blinking"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event ENV_Hazard_blinking is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.newSwitchPos ?? _machine_events["ENV_Hazard_blinking"]["newSwitchPos"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event ENV_Hazard_blinking!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event ENV_Hazard_blinking!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.newSwitchPos ?? _machine_events["ENV_Hazard_blinking"]["newSwitchPos"].getValue(), ];
+    var returnValue = _machine.ENV_Hazard_blinking(...parameters);
+    createHistoryElement("ENV_Hazard_blinking(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["newSwitchPos"] = _machine_events["ENV_Hazard_blinking"]["newSwitchPos"].getValue().toString();
+
+    _current_trace.push({name: "ENV_Hazard_blinking", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.newSwitchPos ?? _machine_events["ENV_Hazard_blinking"]["newSwitchPos"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["ENV_Hazard_blinking"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["ENV_Hazard_blinking"].disabled = true;
+        }
+        createOptionList("ENV_Hazard_blinking", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["RTIME_Tip_blinking_Timeout"] = document.createElement("button");
+var delta_label = document.createElement("label")
+delta_label.textContent = "delta:";
+delta_label.htmlFor="delta";
+_param_div.appendChild(delta_label);
+var delta = document.createElement("input");
+delta.id="delta";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="RTIME_Tip_blinking_Timeout_delta_datalist";
+_param_div.appendChild(_param_datalist);
+delta.setAttribute("list", "RTIME_Tip_blinking_Timeout_delta_datalist");
+delta.getValue = function() {return new BInteger(parseInt(this.value))}
+delta.parseValue = function(value) {return new BInteger(parseInt(value))}
+_param_div.appendChild(delta);
+_machine_events["RTIME_Tip_blinking_Timeout"]["delta"] = delta;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["RTIME_Tip_blinking_Timeout"].style.gridColumn="-1";
+_machine_events["RTIME_Tip_blinking_Timeout"].innerHTML = "RTIME_Tip_blinking_Timeout";
+_machine_events["RTIME_Tip_blinking_Timeout"].parameterNames = ["delta", ];
+_machine_events["RTIME_Tip_blinking_Timeout"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["RTIME_Tip_blinking_Timeout"] == null ?? true) {
+      transition = _machine["_tr_RTIME_Tip_blinking_Timeout"]();
+      _transition_list[index]["RTIME_Tip_blinking_Timeout"] = transition;
+  } else {
+      transition = _transition_list[index]["RTIME_Tip_blinking_Timeout"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event RTIME_Tip_blinking_Timeout is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.delta ?? _machine_events["RTIME_Tip_blinking_Timeout"]["delta"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event RTIME_Tip_blinking_Timeout!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event RTIME_Tip_blinking_Timeout!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.delta ?? _machine_events["RTIME_Tip_blinking_Timeout"]["delta"].getValue(), ];
+    var returnValue = _machine.RTIME_Tip_blinking_Timeout(...parameters);
+    createHistoryElement("RTIME_Tip_blinking_Timeout(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["delta"] = _machine_events["RTIME_Tip_blinking_Timeout"]["delta"].getValue().toString();
+
+    _current_trace.push({name: "RTIME_Tip_blinking_Timeout", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.delta ?? _machine_events["RTIME_Tip_blinking_Timeout"]["delta"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["RTIME_Tip_blinking_Timeout"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["RTIME_Tip_blinking_Timeout"].disabled = true;
+        }
+        createOptionList("RTIME_Tip_blinking_Timeout", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["RTIME_Tip_blinking_Timeout"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["RTIME_Passes"] = document.createElement("button");
+var delta_label = document.createElement("label")
+delta_label.textContent = "delta:";
+delta_label.htmlFor="delta";
+_param_div.appendChild(delta_label);
+var delta = document.createElement("input");
+delta.id="delta";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="RTIME_Passes_delta_datalist";
+_param_div.appendChild(_param_datalist);
+delta.setAttribute("list", "RTIME_Passes_delta_datalist");
+delta.getValue = function() {return new BInteger(parseInt(this.value))}
+delta.parseValue = function(value) {return new BInteger(parseInt(value))}
+_param_div.appendChild(delta);
+_machine_events["RTIME_Passes"]["delta"] = delta;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["RTIME_Passes"].style.gridColumn="-1";
+_machine_events["RTIME_Passes"].innerHTML = "RTIME_Passes";
+_machine_events["RTIME_Passes"].parameterNames = ["delta", ];
+_machine_events["RTIME_Passes"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["RTIME_Passes"] == null ?? true) {
+      transition = _machine["_tr_RTIME_Passes"]();
+      _transition_list[index]["RTIME_Passes"] = transition;
+  } else {
+      transition = _transition_list[index]["RTIME_Passes"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event RTIME_Passes is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.delta ?? _machine_events["RTIME_Passes"]["delta"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event RTIME_Passes!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event RTIME_Passes!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.delta ?? _machine_events["RTIME_Passes"]["delta"].getValue(), ];
+    var returnValue = _machine.RTIME_Passes(...parameters);
+    createHistoryElement("RTIME_Passes(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["delta"] = _machine_events["RTIME_Passes"]["delta"].getValue().toString();
+
+    _current_trace.push({name: "RTIME_Passes", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.delta ?? _machine_events["RTIME_Passes"]["delta"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["RTIME_Passes"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["RTIME_Passes"].disabled = true;
+        }
+        createOptionList("RTIME_Passes", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["RTIME_Passes"]);
+
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["ENV_Turn_EngineOn"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["ENV_Turn_EngineOn"].style.gridColumn="-1";
+_machine_events["ENV_Turn_EngineOn"].innerHTML = "ENV_Turn_EngineOn";
+_machine_events["ENV_Turn_EngineOn"].parameterNames = [];
+_machine_events["ENV_Turn_EngineOn"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["ENV_Turn_EngineOn"] == null ?? true) {
+      transition = _machine["_tr_ENV_Turn_EngineOn"]();
+      _transition_list[index]["ENV_Turn_EngineOn"] = transition;
+  } else {
+      transition = _transition_list[index]["ENV_Turn_EngineOn"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event ENV_Turn_EngineOn is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event ENV_Turn_EngineOn!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event ENV_Turn_EngineOn!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.ENV_Turn_EngineOn(...parameters);
+    createHistoryElement("ENV_Turn_EngineOn(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "ENV_Turn_EngineOn", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["ENV_Turn_EngineOn"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["ENV_Turn_EngineOn"].disabled = true;
+        }
+        createOptionList("ENV_Turn_EngineOn", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["ENV_Turn_EngineOn"]);
+
+_svg_events["front-window"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("front-window");
+_svg_events["front-window"].onclick = function() {
+  var parameters = {
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["ENV_Turn_EngineOn"] == null ?? true) {
+      transition = _machine["_tr_ENV_Turn_EngineOn"]();
+      _transition_list[index]["ENV_Turn_EngineOn"] = transition;
+  } else {
+      transition = _transition_list[index]["ENV_Turn_EngineOn"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event ENV_Turn_EngineOn is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event ENV_Turn_EngineOn!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event ENV_Turn_EngineOn!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.ENV_Turn_EngineOn(...parameters);
+    createHistoryElement("ENV_Turn_EngineOn(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "ENV_Turn_EngineOn", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["ENV_Turn_EngineOn"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["ENV_Turn_EngineOn"].disabled = true;
+        }
+        createOptionList("ENV_Turn_EngineOn", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_svg_events["key-on-position"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("key-on-position");
+_svg_events["key-on-position"].onclick = function() {
+  var parameters = {
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["ENV_Turn_EngineOn"] == null ?? true) {
+      transition = _machine["_tr_ENV_Turn_EngineOn"]();
+      _transition_list[index]["ENV_Turn_EngineOn"] = transition;
+  } else {
+      transition = _transition_list[index]["ENV_Turn_EngineOn"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event ENV_Turn_EngineOn is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event ENV_Turn_EngineOn!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event ENV_Turn_EngineOn!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.ENV_Turn_EngineOn(...parameters);
+    createHistoryElement("ENV_Turn_EngineOn(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "ENV_Turn_EngineOn", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["ENV_Turn_EngineOn"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["ENV_Turn_EngineOn"].disabled = true;
+        }
+        createOptionList("ENV_Turn_EngineOn", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["RTIME_BlinkerOff"] = document.createElement("button");
+var delta_label = document.createElement("label")
+delta_label.textContent = "delta:";
+delta_label.htmlFor="delta";
+_param_div.appendChild(delta_label);
+var delta = document.createElement("input");
+delta.id="delta";
+_param_datalist = document.createElement("datalist");
+_param_datalist.id="RTIME_BlinkerOff_delta_datalist";
+_param_div.appendChild(_param_datalist);
+delta.setAttribute("list", "RTIME_BlinkerOff_delta_datalist");
+delta.getValue = function() {return new BInteger(parseInt(this.value))}
+delta.parseValue = function(value) {return new BInteger(parseInt(value))}
+_param_div.appendChild(delta);
+_machine_events["RTIME_BlinkerOff"]["delta"] = delta;
+
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["RTIME_BlinkerOff"].style.gridColumn="-1";
+_machine_events["RTIME_BlinkerOff"].innerHTML = "RTIME_BlinkerOff";
+_machine_events["RTIME_BlinkerOff"].parameterNames = ["delta", ];
+_machine_events["RTIME_BlinkerOff"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["RTIME_BlinkerOff"] == null ?? true) {
+      transition = _machine["_tr_RTIME_BlinkerOff"]();
+      _transition_list[index]["RTIME_BlinkerOff"] = transition;
+  } else {
+      transition = _transition_list[index]["RTIME_BlinkerOff"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event RTIME_BlinkerOff is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.delta ?? _machine_events["RTIME_BlinkerOff"]["delta"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event RTIME_BlinkerOff!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event RTIME_BlinkerOff!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.delta ?? _machine_events["RTIME_BlinkerOff"]["delta"].getValue(), ];
+    var returnValue = _machine.RTIME_BlinkerOff(...parameters);
+    createHistoryElement("RTIME_BlinkerOff(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["delta"] = _machine_events["RTIME_BlinkerOff"]["delta"].getValue().toString();
+
+    _current_trace.push({name: "RTIME_BlinkerOff", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.delta ?? _machine_events["RTIME_BlinkerOff"]["delta"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["RTIME_BlinkerOff"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["RTIME_BlinkerOff"].disabled = true;
+        }
+        createOptionList("RTIME_BlinkerOff", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["RTIME_BlinkerOff"]);
+
+_svg_events["C-right"] = document.getElementById("LichtUebersicht_v4").contentDocument.getElementById("C-right");
+_svg_events["C-right"].onclick = function() {
+  var parameters = {
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["RTIME_BlinkerOff"] == null ?? true) {
+      transition = _machine["_tr_RTIME_BlinkerOff"]();
+      _transition_list[index]["RTIME_BlinkerOff"] = transition;
+  } else {
+      transition = _transition_list[index]["RTIME_BlinkerOff"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event RTIME_BlinkerOff is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [parameters?.delta ?? _machine_events["RTIME_BlinkerOff"]["delta"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event RTIME_BlinkerOff!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event RTIME_BlinkerOff!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [parameters?.delta ?? _machine_events["RTIME_BlinkerOff"]["delta"].getValue(), ];
+    var returnValue = _machine.RTIME_BlinkerOff(...parameters);
+    createHistoryElement("RTIME_BlinkerOff(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+    parametersJSON["delta"] = _machine_events["RTIME_BlinkerOff"]["delta"].getValue().toString();
+
+    _current_trace.push({name: "RTIME_BlinkerOff", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [parameters?.delta ?? _machine_events["RTIME_BlinkerOff"]["delta"].getValue(), ].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["RTIME_BlinkerOff"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["RTIME_BlinkerOff"].disabled = true;
+        }
+        createOptionList("RTIME_BlinkerOff", transition);
+    }
+    alert(error.message);
+  }
+}
+
+
+
+updateVisuals();
+if(_operations_view.querySelectorAll("label").length == 0) {
+    document.documentElement.style.setProperty('--noneOrGrid', 'none');
+}
+
+function displayTrace(trace) {
+    selectHistoryElement(-_history_view.querySelector(".active").index);
+    let transitions = trace.transitionList
+    for(let transition of transitions) {
+      if(transition.name.startsWith("$")) {
+        continue;
+      }
+      if(transition.params == null) {
+        transition.params = {};
+      }
+      let parameters = Object.keys(transition.params).map(param => _machine_events[transition.name][param].parseValue(transition.params[param]))
+      let returnValue = _machine[transition.name](...parameters);
+      createHistoryElement(transition.name + "(" + parameters.join(", ") + ")" + (returnValue? " (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+      let parametersJSON = {};
+
+      _current_trace.push({name: transition.name, params: parametersJSON});
+    }
+    updateVisuals();
+    selectHistoryElement(_history_view.querySelector("span:last-of-type").index-_history_view.querySelector(".active").index);
+}
+
+function importTrace() {
+    var _file_input = document.querySelector("#_upload_trace_input");
+    _file_input.accept = ".prob2trace";
+
+    _file_input.onchange = async _ => {
+        let files = Array.from(_file_input.files);
+        let file = files[0];
+        let response = await fetch(file.name);
+        let data = await response.text();
+        let trace = JSON.parse(data);
+        createScenarioElement(file.name, trace);
+
+        try {
+            displayTrace(trace);
+        } catch (error) {
+            alert("Trace could not be completely imported.");
+            console.error(error);
+        }
+    };
+
+    _file_input.click();
+}
+
+function exportTrace() {
+  var transitions = _current_trace;
+  var object = {
+    description: "Created from B2Program JS Export",
+    transitionList: transitions,
+    metadata: {
+      fileType: "Trace",
+      formatVersion: 1,
+      creator: "B2Program JS",
+      modelName: "PitmanController_TIME_MC_v4"
+    }
+  };
+  const blob = new Blob([JSON.stringify(object, null, '\t')]);
+  const a = document.createElement('a');
+  a.href = URL.createObjectURL(blob);
+  a.download = 'Scenario.prob2trace';
+  a.click();
+}
+
+function sleep(ms) {
+    return new Promise(resolve => setTimeout(resolve, ms));
+}
+
+async function runTrace(ms) {
+    let firstElement = _history_view.querySelector("span");
+    firstElement.click();
+    let currentHistoryElement = _history_view.querySelector(".active");
+    let index = currentHistoryElement.index + 1;
+    while (index >= 0 && index < _state_list.length) {
+      selectHistoryElement(1);
+      await sleep(ms);
+      currentHistoryElement = _history_view.querySelector(".active");
+      index = currentHistoryElement.index + 1;
+    }
+}
\ No newline at end of file
diff --git a/B2Program/LightModel/PitmanController_TIME_MC_v4.html b/B2Program/LightModel/PitmanController_TIME_MC_v4.html
new file mode 100644
index 0000000000000000000000000000000000000000..ba72204f99f9f4c15f5e3a7eb59836334db174a4
--- /dev/null
+++ b/B2Program/LightModel/PitmanController_TIME_MC_v4.html
@@ -0,0 +1,147 @@
+<!doctype html>
+
+<html lang="en">
+<head>
+  <meta charset="utf-8">
+  <title>PitmanController_TIME_MC_v4</title>
+<head>
+
+<body>
+  <div>
+    <h1>Visualization <br></h1>
+    <object id="LichtUebersicht_v4" data="LichtUebersicht_v4.svg" type="image/svg+xml"></object>
+  </div>
+  <div>
+      <h1>Operations View <br></h1>
+      <div id="_operations_view">
+        <div class="param" style="grid-column: span 2;">Parameter</div>
+        <div style="text-align: center; grid-column: -1;">Event</div>
+      </div>
+  </div>
+  <div>
+    <h1>History View <br></h1>
+    <div id="_history_view_buttons">
+        <input id="_upload_trace_input" type="file" style="display:none;"></input>
+        <input id="_export_trace" type="file" style="display:none;"></input>
+    </div>
+    <div id="_history_view">
+    </div>
+    <br>
+    <br>
+    <h1>Scenario View <br></h1>
+    <div id="_scenario_view">
+    </div>
+  </div>
+  <div id="_state_view">
+    <h1>State View <br></h1>
+    <div id="_state_view_variables" class="state_view_section">
+        <div class="state_view_header collapsed" onclick="collapse(this)">Variables</div>
+    </div>
+    <div id="_state_view_constants" class="state_view_section">
+        <div class="state_view_header collapsed" onclick="collapse(this)">Constants</div>
+    </div>
+    <div id="_state_view_sets" class="state_view_section">
+            <div class="state_view_header collapsed" onclick="collapse(this)">Sets</div>
+        </div>
+    <div id="_state_view_invariant" class="state_view_section">
+            <div class="state_view_header collapsed" onclick="collapse(this)">Invariant</div>
+        </div>
+  </div>
+  <script type="module" src="./immutable/dist/immutable.es.js"></script>
+  <script type="module" src="./btypes/BTuple.js"></script>
+  <script type="module" src="./btypes/BRelation.js"></script>
+  <script type="module" src="./btypes/BBoolean.js"></script>
+  <script type="module" src="./btypes/BSet.js"></script>
+  <script type="module" src="./btypes/BObject.js"></script>
+  <script type="module" src="./btypes/BInteger.js"></script>
+  <script type="module" src="./PitmanController_TIME_MC_v4.js"></script>
+  <script type="module" src="./PitmanController_TIME_MC_v4-visualisation.js" defer></script>
+</body>
+
+<script>
+function collapse(element) {
+    element.classList.toggle("collapsed");
+}
+</script>
+<style>
+#_operations_view{
+    display: grid;
+    grid-template-columns: auto auto auto;
+    gap: 0.5%;
+    margin-bottom: auto;
+    margin-right: 1rem;
+}
+:root {
+    --noneOrGrid: grid;
+}
+.param{
+    display: var(--noneOrGrid);
+    grid-column: span 2;
+    grid-template-columns: subgrid;
+    gap: 5px;
+}
+#_history_view{
+    margin-bottom: auto;
+    margin-right: 1rem;
+    overflow-y  : auto;
+    padding-right: 18px;
+    max-height: 90vh;
+}
+#_history_view > span.active {
+    background: lightblue;
+}
+#_history_view_buttons {
+    display: grid;
+    grid-template-columns: 1fr 1fr;
+}
+
+#_scenario_view{
+    margin-right: 1rem;
+    overflow-y  : auto;
+    padding-right: 18px;
+    gap: 5%;
+    display: grid;
+}
+#_scenario_view > span.active {
+    background: lightblue;
+}
+#_scenario_view_buttons {
+    display: grid;
+    grid-template-columns: 1fr 1fr;
+}
+
+.state_view_section {
+    display: grid;
+    grid-template-columns: auto auto;
+    gap: 0px 20px;
+}
+.state_view_header {
+    grid-column: 1 / -1;
+    border-bottom: 1px solid black;
+}
+
+.state_view_header:only-child {
+    display: none;
+}
+
+.state_view_header::after {
+    content: "\25B2";
+    margin-left: 5px;
+    float: right;
+}
+.collapsed ~ * {
+    display: none;
+}
+.collapsed::after {
+    content: "\25BC";
+}
+body {
+display: flex;
+flex-direction: row;
+flex-wrap: wrap;
+gap: 20px;
+align-items: start;
+}
+</style>
+
+</html>
\ No newline at end of file
diff --git a/B2Program/LightModel/PitmanController_TIME_MC_v4.js b/B2Program/LightModel/PitmanController_TIME_MC_v4.js
new file mode 100644
index 0000000000000000000000000000000000000000..7a5e968041d79a7addd51f2470b7aae9117ae832
--- /dev/null
+++ b/B2Program/LightModel/PitmanController_TIME_MC_v4.js
@@ -0,0 +1,233 @@
+import { BTuple } from './btypes/BTuple.js';
+import { BInteger } from './btypes/BInteger.js';
+import { BRelation } from './btypes/BRelation.js';
+import { BBoolean } from './btypes/BBoolean.js';
+import { BSet } from './btypes/BSet.js';
+import { enum_PITMAN_POSITION } from "./Sensors.js";
+import { PITMAN_POSITION } from "./Sensors.js";
+import { enum_SWITCH_STATUS } from "./Sensors.js";
+import { SWITCH_STATUS } from "./Sensors.js";
+import { enum_TIMERS } from "./GenericTimersMC.js";
+import { TIMERS } from "./GenericTimersMC.js";
+import { enum_DIRECTIONS } from "./BlinkLamps_v3.js";
+import { DIRECTIONS } from "./BlinkLamps_v3.js";
+import GenericTimersMC from './GenericTimersMC.js';
+import BlinkLamps_v3 from './BlinkLamps_v3.js';
+import Sensors from './Sensors.js';
+import { BUtils } from "./btypes/BUtils.js";
+import { SelectError } from "./btypes/BUtils.js";
+export default class PitmanController_TIME_MC_v4 {
+    constructor() {
+        this._BlinkLamps_v3 = new BlinkLamps_v3();
+        this._Sensors = new Sensors();
+        this._GenericTimersMC = new GenericTimersMC();
+        PitmanController_TIME_MC_v4.pitman_direction = new BRelation(new BTuple(new PITMAN_POSITION(enum_PITMAN_POSITION.Neutral), new DIRECTIONS(enum_DIRECTIONS.neutral_blink)), new BTuple(new PITMAN_POSITION(enum_PITMAN_POSITION.Downward5), new DIRECTIONS(enum_DIRECTIONS.left_blink)), new BTuple(new PITMAN_POSITION(enum_PITMAN_POSITION.Downward7), new DIRECTIONS(enum_DIRECTIONS.left_blink)), new BTuple(new PITMAN_POSITION(enum_PITMAN_POSITION.Upward5), new DIRECTIONS(enum_DIRECTIONS.right_blink)), new BTuple(new PITMAN_POSITION(enum_PITMAN_POSITION.Upward7), new DIRECTIONS(enum_DIRECTIONS.right_blink)));
+        this._GenericTimersMC.AbsoluteSetDeadline(new TIMERS(enum_TIMERS.blink_deadline), new BInteger(500));
+    }
+    _copy() {
+        var _a, _b, _c;
+        let _instance = Object.create(PitmanController_TIME_MC_v4.prototype);
+        for (let key of Object.keys(this)) {
+            _instance[key] = (_c = (_b = (_a = this[key])._copy) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : this[key];
+        }
+        return _instance;
+    }
+    ENV_Pitman_Tip_blinking_start(newPos) {
+        if ((new BBoolean(this._Sensors._get_PITMAN_TIP_BLINKING().elementOf(newPos).booleanValue() && newPos.unequal(this._Sensors._get_pitmanArmUpDown()).booleanValue())).booleanValue()) {
+            this._Sensors.SET_Pitman_Tip_blinking_short(newPos);
+            if ((new BBoolean(this._Sensors._get_hazardWarningSwitchOn().equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off)).booleanValue() && this._Sensors._get_engineOn().equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+                this._BlinkLamps_v3.SET_BlinkersOn(PitmanController_TIME_MC_v4.pitman_direction.functionCall(newPos), new BInteger(3));
+            }
+            this._GenericTimersMC.AddDeadline(new TIMERS(enum_TIMERS.tip_deadline), new BInteger(500));
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    RTIME_Tip_blinking_Timeout(delta) {
+        if ((BSet.interval(new BInteger(0), new BInteger(500)).elementOf(delta)).booleanValue()) {
+            if ((new BBoolean(new BBoolean(this._Sensors._get_PITMAN_TIP_BLINKING().elementOf(this._Sensors._get_pitmanArmUpDown()).booleanValue() && this._BlinkLamps_v3._get_remaining_blinks().greater(new BInteger(1)).booleanValue()).booleanValue() && this._BlinkLamps_v3._get_active_blinkers().equal(new BSet(PitmanController_TIME_MC_v4.pitman_direction.functionCall(this._Sensors._get_pitmanArmUpDown()))).booleanValue())).booleanValue()) {
+                this._BlinkLamps_v3.SET_RemainingBlinks(new BInteger(1).negative());
+            }
+            this._GenericTimersMC.IncreaseTimeUntilDeadline(new TIMERS(enum_TIMERS.tip_deadline), delta);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    RTIME_BlinkerOn(delta) {
+        if ((BSet.interval(new BInteger(0), new BInteger(500)).elementOf(delta)).booleanValue()) {
+            this._BlinkLamps_v3.TIME_BlinkerOn();
+            this._GenericTimersMC.IncreaseTimeUntilCyclicDeadline(new TIMERS(enum_TIMERS.blink_deadline), delta, new BInteger(500));
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    RTIME_BlinkerOff(delta) {
+        if ((BSet.interval(new BInteger(0), new BInteger(500)).elementOf(delta)).booleanValue()) {
+            this._BlinkLamps_v3.TIME_BlinkerOff();
+            this._GenericTimersMC.IncreaseTimeUntilCyclicDeadline(new TIMERS(enum_TIMERS.blink_deadline), delta, new BInteger(500));
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    RTIME_Nothing(delta, newOnCycle) {
+        if ((new BBoolean(BSet.interval(new BInteger(0), new BInteger(500)).elementOf(delta).booleanValue() && BUtils.BOOL.elementOf(newOnCycle).booleanValue())).booleanValue()) {
+            this._BlinkLamps_v3.TIME_Nothing(newOnCycle);
+            this._GenericTimersMC.IncreaseTimeUntilCyclicDeadline(new TIMERS(enum_TIMERS.blink_deadline), delta, new BInteger(100));
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    RTIME_Passes(delta) {
+        if ((new BSet(new BInteger(100)).elementOf(delta)).booleanValue()) {
+            this._GenericTimersMC.IncreaseTime(delta);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    ENV_Turn_EngineOn() {
+        this._Sensors.SET_EngineOn();
+        if ((new BBoolean(this._Sensors._get_PITMAN_DIRECTION_BLINKING().elementOf(this._Sensors._get_pitmanArmUpDown()).booleanValue() && this._Sensors._get_hazardWarningSwitchOn().equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off)).booleanValue())).booleanValue()) {
+            this._BlinkLamps_v3.SET_BlinkersOn(PitmanController_TIME_MC_v4.pitman_direction.functionCall(this._Sensors._get_pitmanArmUpDown()), new BInteger(1).negative());
+        }
+    }
+    ENV_Turn_EngineOff() {
+        this._Sensors.SET_EngineOff();
+        if ((this._Sensors._get_hazardWarningSwitchOn().equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off))).booleanValue()) {
+            this._BlinkLamps_v3.SET_AllBlinkersOff();
+        }
+    }
+    ENV_Pitman_DirectionBlinking(newPos) {
+        if ((new BBoolean(this._Sensors._get_hazardWarningSwitchOn().equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off)).booleanValue() && this._Sensors._get_engineOn().equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this._BlinkLamps_v3.SET_BlinkersOn(PitmanController_TIME_MC_v4.pitman_direction.functionCall(newPos), new BInteger(1).negative());
+        }
+        this._Sensors.SET_Pitman_DirectionBlinking(newPos);
+    }
+    ENV_Pitman_Reset_to_Neutral() {
+        this._Sensors.SET_Pitman_Reset_to_Neutral();
+        if ((new BBoolean(this._Sensors._get_hazardWarningSwitchOn().equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off)).booleanValue() && this._BlinkLamps_v3._get_remaining_blinks().equal(new BInteger(1).negative()).booleanValue())).booleanValue()) {
+            this._BlinkLamps_v3.SET_AllBlinkersOff();
+        }
+    }
+    ENV_Hazard_blinking(newSwitchPos) {
+        if ((new BBoolean(this._Sensors._get__SWITCH_STATUS().elementOf(newSwitchPos).booleanValue() && newSwitchPos.unequal(this._Sensors._get_hazardWarningSwitchOn()).booleanValue())).booleanValue()) {
+            if ((newSwitchPos.equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_on))).booleanValue()) {
+                this._BlinkLamps_v3.SET_AllBlinkersOn();
+            }
+            else if ((newSwitchPos.equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off))).booleanValue()) {
+                if ((new BBoolean(this._Sensors._get_pitmanArmUpDown().equal(new PITMAN_POSITION(enum_PITMAN_POSITION.Neutral)).booleanValue() || this._Sensors._get_engineOn().equal(new BBoolean(false)).booleanValue())).booleanValue()) {
+                    this._BlinkLamps_v3.SET_AllBlinkersOff();
+                }
+                else if ((this._Sensors._get_PITMAN_DIRECTION_BLINKING().notElementOf(this._Sensors._get_pitmanArmUpDown())).booleanValue()) {
+                    this._BlinkLamps_v3.SET_AllBlinkersOff();
+                }
+                else {
+                    this._BlinkLamps_v3.SET_BlinkersOn(PitmanController_TIME_MC_v4.pitman_direction.functionCall(this._Sensors._get_pitmanArmUpDown()), this._BlinkLamps_v3._get_remaining_blinks());
+                }
+            }
+            this._Sensors.SET_Hazard_blinking(newSwitchPos);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    _get_pitman_direction() {
+        return PitmanController_TIME_MC_v4.pitman_direction;
+    }
+    _tr_ENV_Pitman_Tip_blinking_start() {
+        let _ic_set_0 = new BSet();
+        for (let _ic_newPos_1 of this._Sensors._get_PITMAN_TIP_BLINKING()) {
+            if ((_ic_newPos_1.unequal(this._Sensors._get_pitmanArmUpDown())).booleanValue()) {
+                _ic_set_0 = _ic_set_0.union(new BSet(_ic_newPos_1));
+            }
+        }
+        return _ic_set_0;
+    }
+    _tr_RTIME_Tip_blinking_Timeout() {
+        let _ic_set_1 = new BSet();
+        for (let _ic_delta_1 of BSet.interval(new BInteger(0), new BInteger(500))) {
+            _ic_set_1 = _ic_set_1.union(new BSet(_ic_delta_1));
+        }
+        return _ic_set_1;
+    }
+    _tr_RTIME_BlinkerOn() {
+        let _ic_set_2 = new BSet();
+        for (let _ic_delta_1 of BSet.interval(new BInteger(0), new BInteger(500))) {
+            _ic_set_2 = _ic_set_2.union(new BSet(_ic_delta_1));
+        }
+        return _ic_set_2;
+    }
+    _tr_RTIME_BlinkerOff() {
+        let _ic_set_3 = new BSet();
+        for (let _ic_delta_1 of BSet.interval(new BInteger(0), new BInteger(500))) {
+            _ic_set_3 = _ic_set_3.union(new BSet(_ic_delta_1));
+        }
+        return _ic_set_3;
+    }
+    _tr_RTIME_Nothing() {
+        let _ic_set_4 = new BSet();
+        for (let _ic_delta_1 of BSet.interval(new BInteger(0), new BInteger(500))) {
+            for (let _ic_newOnCycle_1 of BUtils.BOOL) {
+                _ic_set_4 = _ic_set_4.union(new BSet(new BTuple(_ic_delta_1, _ic_newOnCycle_1)));
+            }
+        }
+        return _ic_set_4;
+    }
+    _tr_RTIME_Passes() {
+        let _ic_set_5 = new BSet();
+        for (let _ic_delta_1 of new BSet(new BInteger(100))) {
+            _ic_set_5 = _ic_set_5.union(new BSet(_ic_delta_1));
+        }
+        return _ic_set_5;
+    }
+    _tr_ENV_Turn_EngineOn() {
+        return true;
+    }
+    _tr_ENV_Turn_EngineOff() {
+        return true;
+    }
+    _tr_ENV_Pitman_DirectionBlinking() {
+        let _ic_set_8 = new BSet();
+        for (let _ic_newPos_1 of this._Sensors._get__PITMAN_POSITION()) {
+            if ((_ic_newPos_1.unequal(this._Sensors._get_pitmanArmUpDown())).booleanValue()) {
+                _ic_set_8 = _ic_set_8.union(new BSet(_ic_newPos_1));
+            }
+        }
+        return _ic_set_8;
+    }
+    _tr_ENV_Pitman_Reset_to_Neutral() {
+        return true;
+    }
+    _tr_ENV_Hazard_blinking() {
+        let _ic_set_10 = new BSet();
+        for (let _ic_newSwitchPos_1 of this._Sensors._get__SWITCH_STATUS()) {
+            if ((_ic_newSwitchPos_1.unequal(this._Sensors._get_hazardWarningSwitchOn())).booleanValue()) {
+                _ic_set_10 = _ic_set_10.union(new BSet(_ic_newSwitchPos_1));
+            }
+        }
+        return _ic_set_10;
+    }
+    _check_inv_1() {
+        return new BBoolean(!this._Sensors._get_hazardWarningSwitchOn().equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_on)).booleanValue() || this._BlinkLamps_v3._get_active_blinkers().equal(this._BlinkLamps_v3._get_BLINK_DIRECTION()).booleanValue()).booleanValue();
+    }
+    _check_inv_2() {
+        return new BBoolean(!new BBoolean(this._Sensors._get_hazardWarningSwitchOn().equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off)).booleanValue() && this._BlinkLamps_v3._get_remaining_blinks().equal(new BInteger(1).negative()).booleanValue()).booleanValue() || this._BlinkLamps_v3._get_active_blinkers().equal(new BSet(PitmanController_TIME_MC_v4.pitman_direction.functionCall(this._Sensors._get_pitmanArmUpDown()))).booleanValue()).booleanValue();
+    }
+    _check_inv_3() {
+        return new BBoolean(!new BBoolean(this._Sensors._get_PITMAN_DIRECTION_BLINKING().elementOf(this._Sensors._get_pitmanArmUpDown()).booleanValue() && this._Sensors._get_engineOn().equal(new BBoolean(true)).booleanValue()).booleanValue() || new BSet(PitmanController_TIME_MC_v4.pitman_direction.functionCall(this._Sensors._get_pitmanArmUpDown())).subset(this._BlinkLamps_v3._get_active_blinkers()).booleanValue()).booleanValue();
+    }
+    _check_inv_4() {
+        return new BBoolean(!new BBoolean(this._Sensors._get_engineOn().equal(new BBoolean(false)).booleanValue() && this._Sensors._get_hazardWarningSwitchOn().equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off)).booleanValue()).booleanValue() || this._BlinkLamps_v3._get_active_blinkers().equal(new BSet()).booleanValue()).booleanValue();
+    }
+    _check_inv_5() {
+        return new BBoolean(!this._Sensors._get_hazardWarningSwitchOn().equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_on)).booleanValue() || this._BlinkLamps_v3._get_remaining_blinks().equal(new BInteger(1).negative()).booleanValue()).booleanValue();
+    }
+    _check_inv_6() {
+        return new BBoolean(!new BBoolean(this._Sensors._get_PITMAN_DIRECTION_BLINKING().elementOf(this._Sensors._get_pitmanArmUpDown()).booleanValue() && this._Sensors._get_engineOn().equal(new BBoolean(true)).booleanValue()).booleanValue() || this._BlinkLamps_v3._get_remaining_blinks().equal(new BInteger(1).negative()).booleanValue()).booleanValue();
+    }
+}
diff --git a/B2Program/LightModel/PitmanController_TIME_MC_v4.json b/B2Program/LightModel/PitmanController_TIME_MC_v4.json
new file mode 100644
index 0000000000000000000000000000000000000000..0574f2ca4aca422d8eaa21017c1b6b26885dabc5
--- /dev/null
+++ b/B2Program/LightModel/PitmanController_TIME_MC_v4.json
@@ -0,0 +1,114 @@
+{
+  "machineName": "PitmanController_TIME_MC_v4",
+  "variables": [],
+  "operationFunctions": [
+    {
+      "opName": "ENV_Pitman_Tip_blinking_start",
+      "parameterTypes": [
+        "PitmanController_TIME_MC_v4$Sensors.PITMAN_POSITION"
+      ]
+    },
+    {
+      "opName": "RTIME_Tip_blinking_Timeout",
+      "parameterTypes": [
+        "de.hhu.stups.btypes.BInteger"
+      ]
+    },
+    {
+      "opName": "RTIME_BlinkerOn",
+      "parameterTypes": [
+        "de.hhu.stups.btypes.BInteger"
+      ]
+    },
+    {
+      "opName": "RTIME_BlinkerOff",
+      "parameterTypes": [
+        "de.hhu.stups.btypes.BInteger"
+      ]
+    },
+    {
+      "opName": "RTIME_Nothing",
+      "parameterTypes": [
+        "de.hhu.stups.btypes.BInteger",
+        "de.hhu.stups.btypes.BBoolean"
+      ]
+    },
+    {
+      "opName": "RTIME_Passes",
+      "parameterTypes": [
+        "de.hhu.stups.btypes.BInteger"
+      ]
+    },
+    {
+      "opName": "ENV_Turn_EngineOn",
+      "parameterTypes": []
+    },
+    {
+      "opName": "ENV_Turn_EngineOff",
+      "parameterTypes": []
+    },
+    {
+      "opName": "ENV_Pitman_DirectionBlinking",
+      "parameterTypes": [
+        "PitmanController_TIME_MC_v4$Sensors.PITMAN_POSITION"
+      ]
+    },
+    {
+      "opName": "ENV_Pitman_Reset_to_Neutral",
+      "parameterTypes": []
+    },
+    {
+      "opName": "ENV_Hazard_blinking",
+      "parameterTypes": [
+        "PitmanController_TIME_MC_v4$Sensors.SWITCH_STATUS"
+      ]
+    }
+  ],
+  "transitionEvaluationFunctions": {
+    "RTIME_BlinkerOn": "_tr_RTIME_BlinkerOn",
+    "ENV_Turn_EngineOff": "_tr_ENV_Turn_EngineOff",
+    "ENV_Pitman_Tip_blinking_start": "_tr_ENV_Pitman_Tip_blinking_start",
+    "ENV_Turn_EngineOn": "_tr_ENV_Turn_EngineOn",
+    "RTIME_BlinkerOff": "_tr_RTIME_BlinkerOff",
+    "RTIME_Passes": "_tr_RTIME_Passes",
+    "RTIME_Nothing": "_tr_RTIME_Nothing",
+    "ENV_Pitman_DirectionBlinking": "_tr_ENV_Pitman_DirectionBlinking",
+    "ENV_Pitman_Reset_to_Neutral": "_tr_ENV_Pitman_Reset_to_Neutral",
+    "RTIME_Tip_blinking_Timeout": "_tr_RTIME_Tip_blinking_Timeout",
+    "ENV_Hazard_blinking": "_tr_ENV_Hazard_blinking"
+  },
+  "invariants": [
+    "_check_inv_1",
+    "_check_inv_2",
+    "_check_inv_3",
+    "_check_inv_4",
+    "_check_inv_5",
+    "_check_inv_6"
+  ],
+  "invariantDependency": {
+    "RTIME_BlinkerOn": [],
+    "ENV_Turn_EngineOff": [],
+    "ENV_Pitman_Tip_blinking_start": [],
+    "ENV_Turn_EngineOn": [],
+    "RTIME_BlinkerOff": [],
+    "RTIME_Passes": [],
+    "RTIME_Nothing": [],
+    "ENV_Pitman_DirectionBlinking": [],
+    "ENV_Pitman_Reset_to_Neutral": [],
+    "RTIME_Tip_blinking_Timeout": [],
+    "ENV_Hazard_blinking": []
+  },
+  "guardDependency": {
+    "RTIME_BlinkerOn": [],
+    "ENV_Turn_EngineOff": [],
+    "ENV_Pitman_Tip_blinking_start": [],
+    "ENV_Turn_EngineOn": [],
+    "RTIME_BlinkerOff": [],
+    "RTIME_Passes": [],
+    "RTIME_Nothing": [],
+    "ENV_Pitman_DirectionBlinking": [],
+    "ENV_Pitman_Reset_to_Neutral": [],
+    "RTIME_Tip_blinking_Timeout": [],
+    "ENV_Hazard_blinking": []
+  }
+}
\ No newline at end of file
diff --git a/B2Program/LightModel/PitmanController_TIME_MC_v4.ts b/B2Program/LightModel/PitmanController_TIME_MC_v4.ts
new file mode 100644
index 0000000000000000000000000000000000000000..edbe2a2c4659cae15f855dee47c6976e35682994
--- /dev/null
+++ b/B2Program/LightModel/PitmanController_TIME_MC_v4.ts
@@ -0,0 +1,263 @@
+import {BTuple} from './btypes/BTuple.js';
+import {BInteger} from './btypes/BInteger.js';
+import {BRelation} from './btypes/BRelation.js';
+import {BBoolean} from './btypes/BBoolean.js';
+import {BSet} from './btypes/BSet.js';
+import {BObject} from './btypes/BObject.js';
+import {enum_PITMAN_POSITION} from "./Sensors.js"
+import {PITMAN_POSITION} from "./Sensors.js"
+import {enum_SWITCH_STATUS} from "./Sensors.js"
+import {SWITCH_STATUS} from "./Sensors.js"
+import {enum_TIMERS} from "./GenericTimersMC.js"
+import {TIMERS} from "./GenericTimersMC.js"
+import {enum_DIRECTIONS} from "./BlinkLamps_v3.js"
+import {DIRECTIONS} from "./BlinkLamps_v3.js"
+import GenericTimersMC from './GenericTimersMC.js';
+import BlinkLamps_v3 from './BlinkLamps_v3.js';
+import Sensors from './Sensors.js';
+import {BUtils} from "./btypes/BUtils.js";
+import {SelectError} from "./btypes/BUtils.js";
+
+
+
+export default class PitmanController_TIME_MC_v4 {
+
+    _BlinkLamps_v3: BlinkLamps_v3 = new BlinkLamps_v3();
+    _Sensors: Sensors = new Sensors();
+    _GenericTimersMC: GenericTimersMC = new GenericTimersMC();
+
+    private static pitman_direction: BRelation<PITMAN_POSITION, DIRECTIONS>;
+
+
+
+    constructor() {
+        PitmanController_TIME_MC_v4.pitman_direction = new BRelation<PITMAN_POSITION, DIRECTIONS>(new BTuple(new PITMAN_POSITION(enum_PITMAN_POSITION.Neutral), new DIRECTIONS(enum_DIRECTIONS.neutral_blink)), new BTuple(new PITMAN_POSITION(enum_PITMAN_POSITION.Downward5), new DIRECTIONS(enum_DIRECTIONS.left_blink)), new BTuple(new PITMAN_POSITION(enum_PITMAN_POSITION.Downward7), new DIRECTIONS(enum_DIRECTIONS.left_blink)), new BTuple(new PITMAN_POSITION(enum_PITMAN_POSITION.Upward5), new DIRECTIONS(enum_DIRECTIONS.right_blink)), new BTuple(new PITMAN_POSITION(enum_PITMAN_POSITION.Upward7), new DIRECTIONS(enum_DIRECTIONS.right_blink)));
+        this._GenericTimersMC.AbsoluteSetDeadline(new TIMERS(enum_TIMERS.blink_deadline),new BInteger(500));
+    }
+
+    public _copy(): PitmanController_TIME_MC_v4 {
+        let _instance = Object.create(PitmanController_TIME_MC_v4.prototype);
+        for(let key of Object.keys(this)) {
+            _instance[key] = this[key]._copy?.() ?? this[key];
+        }
+        return _instance;
+    }
+
+     ENV_Pitman_Tip_blinking_start(newPos: PITMAN_POSITION): void {
+        if((new BBoolean(this._Sensors._get_PITMAN_TIP_BLINKING().elementOf(newPos).booleanValue() && newPos.unequal(this._Sensors._get_pitmanArmUpDown()).booleanValue())).booleanValue()) {
+            this._Sensors.SET_Pitman_Tip_blinking_short(newPos);
+            if((new BBoolean(this._Sensors._get_hazardWarningSwitchOn().equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off)).booleanValue() && this._Sensors._get_engineOn().equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+                this._BlinkLamps_v3.SET_BlinkersOn(PitmanController_TIME_MC_v4.pitman_direction.functionCall(newPos),new BInteger(3));
+            } 
+            this._GenericTimersMC.AddDeadline(new TIMERS(enum_TIMERS.tip_deadline),new BInteger(500));
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     RTIME_Tip_blinking_Timeout(delta: BInteger): void {
+        if((BSet.interval(new BInteger(0), new BInteger(500)).elementOf(delta)).booleanValue()) {
+            if((new BBoolean(new BBoolean(this._Sensors._get_PITMAN_TIP_BLINKING().elementOf(this._Sensors._get_pitmanArmUpDown()).booleanValue() && this._BlinkLamps_v3._get_remaining_blinks().greater(new BInteger(1)).booleanValue()).booleanValue() && this._BlinkLamps_v3._get_active_blinkers().equal(new BSet(PitmanController_TIME_MC_v4.pitman_direction.functionCall(this._Sensors._get_pitmanArmUpDown()))).booleanValue())).booleanValue()) {
+                this._BlinkLamps_v3.SET_RemainingBlinks(new BInteger(1).negative());
+            } 
+            this._GenericTimersMC.IncreaseTimeUntilDeadline(new TIMERS(enum_TIMERS.tip_deadline),delta);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     RTIME_BlinkerOn(delta: BInteger): void {
+        if((BSet.interval(new BInteger(0), new BInteger(500)).elementOf(delta)).booleanValue()) {
+            this._BlinkLamps_v3.TIME_BlinkerOn();
+            this._GenericTimersMC.IncreaseTimeUntilCyclicDeadline(new TIMERS(enum_TIMERS.blink_deadline),delta,new BInteger(500));
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     RTIME_BlinkerOff(delta: BInteger): void {
+        if((BSet.interval(new BInteger(0), new BInteger(500)).elementOf(delta)).booleanValue()) {
+            this._BlinkLamps_v3.TIME_BlinkerOff();
+            this._GenericTimersMC.IncreaseTimeUntilCyclicDeadline(new TIMERS(enum_TIMERS.blink_deadline),delta,new BInteger(500));
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     RTIME_Nothing(delta: BInteger, newOnCycle: BBoolean): void {
+        if((new BBoolean(BSet.interval(new BInteger(0), new BInteger(500)).elementOf(delta).booleanValue() && BUtils.BOOL.elementOf(newOnCycle).booleanValue())).booleanValue()) {
+            this._BlinkLamps_v3.TIME_Nothing(newOnCycle);
+            this._GenericTimersMC.IncreaseTimeUntilCyclicDeadline(new TIMERS(enum_TIMERS.blink_deadline),delta,new BInteger(100));
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     RTIME_Passes(delta: BInteger): void {
+        if((new BSet(new BInteger(100)).elementOf(delta)).booleanValue()) {
+            this._GenericTimersMC.IncreaseTime(delta);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     ENV_Turn_EngineOn(): void {
+        this._Sensors.SET_EngineOn();
+        if((new BBoolean(this._Sensors._get_PITMAN_DIRECTION_BLINKING().elementOf(this._Sensors._get_pitmanArmUpDown()).booleanValue() && this._Sensors._get_hazardWarningSwitchOn().equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off)).booleanValue())).booleanValue()) {
+            this._BlinkLamps_v3.SET_BlinkersOn(PitmanController_TIME_MC_v4.pitman_direction.functionCall(this._Sensors._get_pitmanArmUpDown()),new BInteger(1).negative());
+        } 
+    }
+
+     ENV_Turn_EngineOff(): void {
+        this._Sensors.SET_EngineOff();
+        if((this._Sensors._get_hazardWarningSwitchOn().equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off))).booleanValue()) {
+            this._BlinkLamps_v3.SET_AllBlinkersOff();
+        } 
+    }
+
+     ENV_Pitman_DirectionBlinking(newPos: PITMAN_POSITION): void {
+        if((new BBoolean(this._Sensors._get_hazardWarningSwitchOn().equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off)).booleanValue() && this._Sensors._get_engineOn().equal(new BBoolean(true)).booleanValue())).booleanValue()) {
+            this._BlinkLamps_v3.SET_BlinkersOn(PitmanController_TIME_MC_v4.pitman_direction.functionCall(newPos),new BInteger(1).negative());
+        } 
+        this._Sensors.SET_Pitman_DirectionBlinking(newPos);
+    }
+
+     ENV_Pitman_Reset_to_Neutral(): void {
+        this._Sensors.SET_Pitman_Reset_to_Neutral();
+        if((new BBoolean(this._Sensors._get_hazardWarningSwitchOn().equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off)).booleanValue() && this._BlinkLamps_v3._get_remaining_blinks().equal(new BInteger(1).negative()).booleanValue())).booleanValue()) {
+            this._BlinkLamps_v3.SET_AllBlinkersOff();
+        } 
+    }
+
+     ENV_Hazard_blinking(newSwitchPos: SWITCH_STATUS): void {
+        if((new BBoolean(this._Sensors._get__SWITCH_STATUS().elementOf(newSwitchPos).booleanValue() && newSwitchPos.unequal(this._Sensors._get_hazardWarningSwitchOn()).booleanValue())).booleanValue()) {
+            if((newSwitchPos.equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_on))).booleanValue()) {
+                this._BlinkLamps_v3.SET_AllBlinkersOn();
+            } else if((newSwitchPos.equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off))).booleanValue()) {
+                if((new BBoolean(this._Sensors._get_pitmanArmUpDown().equal(new PITMAN_POSITION(enum_PITMAN_POSITION.Neutral)).booleanValue() || this._Sensors._get_engineOn().equal(new BBoolean(false)).booleanValue())).booleanValue()) {
+                    this._BlinkLamps_v3.SET_AllBlinkersOff();
+                } else if((this._Sensors._get_PITMAN_DIRECTION_BLINKING().notElementOf(this._Sensors._get_pitmanArmUpDown())).booleanValue()) {
+                    this._BlinkLamps_v3.SET_AllBlinkersOff();
+                } else {
+                    this._BlinkLamps_v3.SET_BlinkersOn(PitmanController_TIME_MC_v4.pitman_direction.functionCall(this._Sensors._get_pitmanArmUpDown()),this._BlinkLamps_v3._get_remaining_blinks());
+                }
+            }
+            this._Sensors.SET_Hazard_blinking(newSwitchPos);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+    _get_pitman_direction(): BRelation<PITMAN_POSITION, DIRECTIONS> {
+        return PitmanController_TIME_MC_v4.pitman_direction;
+    }
+
+    _tr_ENV_Pitman_Tip_blinking_start(): BSet<PITMAN_POSITION> {
+        let _ic_set_0: BSet<PITMAN_POSITION> = new BSet<PITMAN_POSITION>();
+        for(let _ic_newPos_1 of this._Sensors._get_PITMAN_TIP_BLINKING()) {
+            if((_ic_newPos_1.unequal(this._Sensors._get_pitmanArmUpDown())).booleanValue()) {
+                _ic_set_0 = _ic_set_0.union(new BSet<PITMAN_POSITION>(_ic_newPos_1));
+            }
+
+        }
+        return _ic_set_0;
+    }
+
+    _tr_RTIME_Tip_blinking_Timeout(): BSet<BInteger> {
+        let _ic_set_1: BSet<BInteger> = new BSet<BInteger>();
+        for(let _ic_delta_1 of BSet.interval(new BInteger(0), new BInteger(500))) {
+            _ic_set_1 = _ic_set_1.union(new BSet<BInteger>(_ic_delta_1));
+
+        }
+        return _ic_set_1;
+    }
+
+    _tr_RTIME_BlinkerOn(): BSet<BInteger> {
+        let _ic_set_2: BSet<BInteger> = new BSet<BInteger>();
+        for(let _ic_delta_1 of BSet.interval(new BInteger(0), new BInteger(500))) {
+            _ic_set_2 = _ic_set_2.union(new BSet<BInteger>(_ic_delta_1));
+
+        }
+        return _ic_set_2;
+    }
+
+    _tr_RTIME_BlinkerOff(): BSet<BInteger> {
+        let _ic_set_3: BSet<BInteger> = new BSet<BInteger>();
+        for(let _ic_delta_1 of BSet.interval(new BInteger(0), new BInteger(500))) {
+            _ic_set_3 = _ic_set_3.union(new BSet<BInteger>(_ic_delta_1));
+
+        }
+        return _ic_set_3;
+    }
+
+    _tr_RTIME_Nothing(): BSet<BTuple<BInteger, BBoolean>> {
+        let _ic_set_4: BSet<BTuple<BInteger, BBoolean>> = new BSet<BTuple<BInteger, BBoolean>>();
+        for(let _ic_delta_1 of BSet.interval(new BInteger(0), new BInteger(500))) {
+            for(let _ic_newOnCycle_1 of BUtils.BOOL) {
+                _ic_set_4 = _ic_set_4.union(new BSet<BTuple<BInteger, BBoolean>>(new BTuple(_ic_delta_1, _ic_newOnCycle_1)));
+
+            }
+        }
+        return _ic_set_4;
+    }
+
+    _tr_RTIME_Passes(): BSet<BInteger> {
+        let _ic_set_5: BSet<BInteger> = new BSet<BInteger>();
+        for(let _ic_delta_1 of new BSet(new BInteger(100))) {
+            _ic_set_5 = _ic_set_5.union(new BSet<BInteger>(_ic_delta_1));
+
+        }
+        return _ic_set_5;
+    }
+
+    _tr_ENV_Turn_EngineOn(): boolean {
+        return true;
+    }
+
+    _tr_ENV_Turn_EngineOff(): boolean {
+        return true;
+    }
+
+    _tr_ENV_Pitman_DirectionBlinking(): BSet<PITMAN_POSITION> {
+        let _ic_set_8: BSet<PITMAN_POSITION> = new BSet<PITMAN_POSITION>();
+        for(let _ic_newPos_1 of this._Sensors._get__PITMAN_POSITION()) {
+            if((_ic_newPos_1.unequal(this._Sensors._get_pitmanArmUpDown())).booleanValue()) {
+                _ic_set_8 = _ic_set_8.union(new BSet<PITMAN_POSITION>(_ic_newPos_1));
+            }
+
+        }
+        return _ic_set_8;
+    }
+
+    _tr_ENV_Pitman_Reset_to_Neutral(): boolean {
+        return true;
+    }
+
+    _tr_ENV_Hazard_blinking(): BSet<SWITCH_STATUS> {
+        let _ic_set_10: BSet<SWITCH_STATUS> = new BSet<SWITCH_STATUS>();
+        for(let _ic_newSwitchPos_1 of this._Sensors._get__SWITCH_STATUS()) {
+            if((_ic_newSwitchPos_1.unequal(this._Sensors._get_hazardWarningSwitchOn())).booleanValue()) {
+                _ic_set_10 = _ic_set_10.union(new BSet<SWITCH_STATUS>(_ic_newSwitchPos_1));
+            }
+
+        }
+        return _ic_set_10;
+    }
+
+    _check_inv_1() {
+        return new BBoolean(!this._Sensors._get_hazardWarningSwitchOn().equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_on)).booleanValue() || this._BlinkLamps_v3._get_active_blinkers().equal(this._BlinkLamps_v3._get_BLINK_DIRECTION()).booleanValue()).booleanValue();
+    }_check_inv_2() {
+        return new BBoolean(!new BBoolean(this._Sensors._get_hazardWarningSwitchOn().equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off)).booleanValue() && this._BlinkLamps_v3._get_remaining_blinks().equal(new BInteger(1).negative()).booleanValue()).booleanValue() || this._BlinkLamps_v3._get_active_blinkers().equal(new BSet(PitmanController_TIME_MC_v4.pitman_direction.functionCall(this._Sensors._get_pitmanArmUpDown()))).booleanValue()).booleanValue();
+    }_check_inv_3() {
+        return new BBoolean(!new BBoolean(this._Sensors._get_PITMAN_DIRECTION_BLINKING().elementOf(this._Sensors._get_pitmanArmUpDown()).booleanValue() && this._Sensors._get_engineOn().equal(new BBoolean(true)).booleanValue()).booleanValue() || new BSet(PitmanController_TIME_MC_v4.pitman_direction.functionCall(this._Sensors._get_pitmanArmUpDown())).subset(this._BlinkLamps_v3._get_active_blinkers()).booleanValue()).booleanValue();
+    }_check_inv_4() {
+        return new BBoolean(!new BBoolean(this._Sensors._get_engineOn().equal(new BBoolean(false)).booleanValue() && this._Sensors._get_hazardWarningSwitchOn().equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off)).booleanValue()).booleanValue() || this._BlinkLamps_v3._get_active_blinkers().equal(new BSet()).booleanValue()).booleanValue();
+    }_check_inv_5() {
+        return new BBoolean(!this._Sensors._get_hazardWarningSwitchOn().equal(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_on)).booleanValue() || this._BlinkLamps_v3._get_remaining_blinks().equal(new BInteger(1).negative()).booleanValue()).booleanValue();
+    }_check_inv_6() {
+        return new BBoolean(!new BBoolean(this._Sensors._get_PITMAN_DIRECTION_BLINKING().elementOf(this._Sensors._get_pitmanArmUpDown()).booleanValue() && this._Sensors._get_engineOn().equal(new BBoolean(true)).booleanValue()).booleanValue() || this._BlinkLamps_v3._get_remaining_blinks().equal(new BInteger(1).negative()).booleanValue()).booleanValue();
+    }
+
+
+}
+
diff --git a/B2Program/LightModel/PitmanController_TIME_v3_Trace7.prob2trace b/B2Program/LightModel/PitmanController_TIME_v3_Trace7.prob2trace
new file mode 100644
index 0000000000000000000000000000000000000000..4496593fdcc86f781ceec6a0370d2ad5c1a80377
--- /dev/null
+++ b/B2Program/LightModel/PitmanController_TIME_v3_Trace7.prob2trace
@@ -0,0 +1,3803 @@
+{
+  "description": "",
+  "transitionList": [
+    {
+      "name": "$setup_constants",
+      "params": {},
+      "results": {},
+      "destState": {
+        "pitman_direction": "{(Neutral↦neutral_blink),(Downward5↦left_blink),(Downward7↦left_blink),(Upward5↦right_blink),(Upward7↦right_blink)}",
+        "BLINK_DIRECTION": "{left_blink,right_blink}",
+        "PITMAN_TIP_BLINKING": "{Downward5,Upward5}",
+        "LAMP_STATUS": "{0,100}",
+        "lamp_off": "0",
+        "cycleMaxLampStatus": "{(FALSE↦0),(TRUE↦100)}",
+        "lamp_on": "100",
+        "GenericTimersMC.TIMERS": "{blink_deadline,tip_deadline}",
+        "BLINK_CYCLE_COUNTER": "{-1,0,1,2,3}",
+        "PITMAN_DIRECTION_BLINKING": "{Downward7,Upward7}"
+      },
+      "destStateNotChanged": [],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "$initialise_machine",
+      "params": {},
+      "results": {},
+      "destState": {
+        "blinkRight": "0",
+        "engineOn": "FALSE",
+        "onCycle": "FALSE",
+        "keyState": "KeyInsertedOnPosition",
+        "pitmanArmUpDown": "Neutral",
+        "remaining_blinks": "0",
+        "active_blinkers": "∅",
+        "hazardWarningSwitchOn": "switch_off",
+        "curDeadlines": "{(blink_deadline↦500)}",
+        "blinkLeft": "0"
+      },
+      "destStateNotChanged": [],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "500",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {
+        "curDeadlines": "{(blink_deadline↦100)}"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "ENV_Turn_EngineOn",
+      "params": {},
+      "results": {},
+      "destState": {
+        "engineOn": "TRUE"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "ENV_Pitman_DirectionBlinking",
+      "params": {
+        "newPos": "Upward7"
+      },
+      "results": {},
+      "destState": {
+        "pitmanArmUpDown": "Upward7",
+        "remaining_blinks": "-1",
+        "active_blinkers": "{right_blink}"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_BlinkerOn",
+      "params": {
+        "delta": "100"
+      },
+      "results": {},
+      "destState": {
+        "blinkRight": "100",
+        "onCycle": "TRUE",
+        "curDeadlines": "{(blink_deadline↦500)}"
+      },
+      "destStateNotChanged": [
+        "engineOn",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_BlinkerOff",
+      "params": {
+        "delta": "500"
+      },
+      "results": {},
+      "destState": {
+        "blinkRight": "0",
+        "onCycle": "FALSE"
+      },
+      "destStateNotChanged": [
+        "engineOn",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_BlinkerOn",
+      "params": {
+        "delta": "500"
+      },
+      "results": {},
+      "destState": {
+        "blinkRight": "100",
+        "onCycle": "TRUE"
+      },
+      "destStateNotChanged": [
+        "engineOn",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Passes",
+      "params": {
+        "delta": "100"
+      },
+      "results": {},
+      "destState": {
+        "curDeadlines": "{(blink_deadline↦400)}"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Passes",
+      "params": {
+        "delta": "100"
+      },
+      "results": {},
+      "destState": {
+        "curDeadlines": "{(blink_deadline↦300)}"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "ENV_Pitman_Reset_to_Neutral",
+      "params": {},
+      "results": {},
+      "destState": {
+        "blinkRight": "0",
+        "pitmanArmUpDown": "Neutral",
+        "remaining_blinks": "0",
+        "active_blinkers": "∅"
+      },
+      "destStateNotChanged": [
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "300",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {
+        "onCycle": "FALSE",
+        "curDeadlines": "{(blink_deadline↦100)}"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "ENV_Pitman_Tip_blinking_start",
+      "params": {
+        "newPos": "Downward5"
+      },
+      "results": {},
+      "destState": {
+        "pitmanArmUpDown": "Downward5",
+        "remaining_blinks": "3",
+        "active_blinkers": "{left_blink}",
+        "curDeadlines": "{(blink_deadline↦100),(tip_deadline↦500)}"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "hazardWarningSwitchOn",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_BlinkerOn",
+      "params": {
+        "delta": "100"
+      },
+      "results": {},
+      "destState": {
+        "remaining_blinks": "2",
+        "onCycle": "TRUE",
+        "curDeadlines": "{(blink_deadline↦500),(tip_deadline↦400)}",
+        "blinkLeft": "100"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "keyState",
+        "pitmanArmUpDown",
+        "active_blinkers",
+        "hazardWarningSwitchOn"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Passes",
+      "params": {
+        "delta": "100"
+      },
+      "results": {},
+      "destState": {
+        "curDeadlines": "{(blink_deadline↦400),(tip_deadline↦300)}"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "ENV_Pitman_Reset_to_Neutral",
+      "params": {},
+      "results": {},
+      "destState": {
+        "pitmanArmUpDown": "Neutral"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Tip_blinking_Timeout",
+      "params": {
+        "delta": "300"
+      },
+      "results": {},
+      "destState": {
+        "curDeadlines": "{(blink_deadline↦100)}"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Passes",
+      "params": {
+        "delta": "100"
+      },
+      "results": {},
+      "destState": {
+        "curDeadlines": "{(blink_deadline↦0)}"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_BlinkerOff",
+      "params": {
+        "delta": "0"
+      },
+      "results": {},
+      "destState": {
+        "onCycle": "FALSE",
+        "curDeadlines": "{(blink_deadline↦500)}",
+        "blinkLeft": "0"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Passes",
+      "params": {
+        "delta": "100"
+      },
+      "results": {},
+      "destState": {
+        "curDeadlines": "{(blink_deadline↦400)}"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Passes",
+      "params": {
+        "delta": "100"
+      },
+      "results": {},
+      "destState": {
+        "curDeadlines": "{(blink_deadline↦300)}"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "ENV_Hazard_blinking",
+      "params": {
+        "newSwitchPos": "switch_on"
+      },
+      "results": {},
+      "destState": {
+        "remaining_blinks": "-1",
+        "active_blinkers": "{left_blink,right_blink}",
+        "hazardWarningSwitchOn": "switch_on"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_BlinkerOn",
+      "params": {
+        "delta": "300"
+      },
+      "results": {},
+      "destState": {
+        "blinkRight": "100",
+        "onCycle": "TRUE",
+        "curDeadlines": "{(blink_deadline↦500)}",
+        "blinkLeft": "100"
+      },
+      "destStateNotChanged": [
+        "engineOn",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_BlinkerOff",
+      "params": {
+        "delta": "500"
+      },
+      "results": {},
+      "destState": {
+        "blinkRight": "0",
+        "onCycle": "FALSE",
+        "blinkLeft": "0"
+      },
+      "destStateNotChanged": [
+        "engineOn",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_BlinkerOn",
+      "params": {
+        "delta": "500"
+      },
+      "results": {},
+      "destState": {
+        "blinkRight": "100",
+        "onCycle": "TRUE",
+        "blinkLeft": "100"
+      },
+      "destStateNotChanged": [
+        "engineOn",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_BlinkerOff",
+      "params": {
+        "delta": "500"
+      },
+      "results": {},
+      "destState": {
+        "blinkRight": "0",
+        "onCycle": "FALSE",
+        "blinkLeft": "0"
+      },
+      "destStateNotChanged": [
+        "engineOn",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_BlinkerOn",
+      "params": {
+        "delta": "500"
+      },
+      "results": {},
+      "destState": {
+        "blinkRight": "100",
+        "onCycle": "TRUE",
+        "blinkLeft": "100"
+      },
+      "destStateNotChanged": [
+        "engineOn",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Passes",
+      "params": {
+        "delta": "100"
+      },
+      "results": {},
+      "destState": {
+        "curDeadlines": "{(blink_deadline↦400)}"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Passes",
+      "params": {
+        "delta": "100"
+      },
+      "results": {},
+      "destState": {
+        "curDeadlines": "{(blink_deadline↦300)}"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "ENV_Pitman_Tip_blinking_start",
+      "params": {
+        "newPos": "Upward5"
+      },
+      "results": {},
+      "destState": {
+        "pitmanArmUpDown": "Upward5",
+        "curDeadlines": "{(blink_deadline↦300),(tip_deadline↦500)}"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Passes",
+      "params": {
+        "delta": "100"
+      },
+      "results": {},
+      "destState": {
+        "curDeadlines": "{(blink_deadline↦200),(tip_deadline↦400)}"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "ENV_Pitman_Reset_to_Neutral",
+      "params": {},
+      "results": {},
+      "destState": {
+        "pitmanArmUpDown": "Neutral"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_BlinkerOff",
+      "params": {
+        "delta": "200"
+      },
+      "results": {},
+      "destState": {
+        "blinkRight": "0",
+        "onCycle": "FALSE",
+        "curDeadlines": "{(blink_deadline↦500),(tip_deadline↦200)}",
+        "blinkLeft": "0"
+      },
+      "destStateNotChanged": [
+        "engineOn",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Tip_blinking_Timeout",
+      "params": {
+        "delta": "200"
+      },
+      "results": {},
+      "destState": {
+        "curDeadlines": "{(blink_deadline↦300)}"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_BlinkerOn",
+      "params": {
+        "delta": "300"
+      },
+      "results": {},
+      "destState": {
+        "blinkRight": "100",
+        "onCycle": "TRUE",
+        "curDeadlines": "{(blink_deadline↦500)}",
+        "blinkLeft": "100"
+      },
+      "destStateNotChanged": [
+        "engineOn",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Passes",
+      "params": {
+        "delta": "100"
+      },
+      "results": {},
+      "destState": {
+        "curDeadlines": "{(blink_deadline↦400)}"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Passes",
+      "params": {
+        "delta": "100"
+      },
+      "results": {},
+      "destState": {
+        "curDeadlines": "{(blink_deadline↦300)}"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "ENV_Hazard_blinking",
+      "params": {
+        "newSwitchPos": "switch_off"
+      },
+      "results": {},
+      "destState": {
+        "blinkRight": "0",
+        "remaining_blinks": "0",
+        "active_blinkers": "∅",
+        "hazardWarningSwitchOn": "switch_off",
+        "blinkLeft": "0"
+      },
+      "destStateNotChanged": [
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "curDeadlines"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "300",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {
+        "onCycle": "FALSE",
+        "curDeadlines": "{(blink_deadline↦100)}"
+      },
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    },
+    {
+      "name": "RTIME_Nothing",
+      "params": {
+        "delta": "100",
+        "newOnCycle": "FALSE"
+      },
+      "results": {},
+      "destState": {},
+      "destStateNotChanged": [
+        "blinkRight",
+        "engineOn",
+        "onCycle",
+        "keyState",
+        "pitmanArmUpDown",
+        "remaining_blinks",
+        "active_blinkers",
+        "hazardWarningSwitchOn",
+        "curDeadlines",
+        "blinkLeft"
+      ],
+      "preds": [],
+      "postconditions": [],
+      "description": ""
+    }
+  ],
+  "variableNames": [
+    "active_blinkers",
+    "blinkLeft",
+    "blinkRight",
+    "curDeadlines",
+    "engineOn",
+    "hazardWarningSwitchOn",
+    "keyState",
+    "onCycle",
+    "pitmanArmUpDown",
+    "remaining_blinks"
+  ],
+  "constantNames": [
+    "BLINK_DIRECTION",
+    "LAMP_STATUS",
+    "lamp_on",
+    "lamp_off",
+    "BLINK_CYCLE_COUNTER",
+    "cycleMaxLampStatus",
+    "PITMAN_DIRECTION_BLINKING",
+    "PITMAN_TIP_BLINKING",
+    "pitman_direction",
+    "GenericTimersMC.TIMERS"
+  ],
+  "setNames": [
+    "DIRECTIONS",
+    "SWITCH_STATUS",
+    "PITMAN_POSITION",
+    "KEY_STATE",
+    "PTIMERS"
+  ],
+  "machineOperationInfos": {
+    "PitmanController_v6.SET_AllBlinkersOn": {
+      "operationName": "PitmanController_v6.SET_AllBlinkersOn",
+      "parameterNames": [],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "BLINK_DIRECTION",
+        "cycleMaxLampStatus",
+        "onCycle"
+      ],
+      "writtenVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "remaining_blinks"
+      ],
+      "nonDetWrittenVariables": [],
+      "typeMap": {
+        "'BLINK_DIRECTION'": "set(global('DIRECTIONS'))"
+      }
+    },
+    "IncreaseTimeUntilDeadline": {
+      "operationName": "IncreaseTimeUntilDeadline",
+      "parameterNames": [
+        "timer",
+        "delta"
+      ],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "curDeadlines"
+      ],
+      "writtenVariables": [
+        "curDeadlines"
+      ],
+      "nonDetWrittenVariables": [],
+      "typeMap": {
+        "timer": "global('PTIMERS')",
+        "delta": "integer"
+      }
+    },
+    "PitmanController_v6.SET_Pitman_DirectionBlinking": {
+      "operationName": "PitmanController_v6.SET_Pitman_DirectionBlinking",
+      "parameterNames": [
+        "newPos"
+      ],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "PITMAN_DIRECTION_BLINKING",
+        "pitmanArmUpDown"
+      ],
+      "writtenVariables": [
+        "pitmanArmUpDown"
+      ],
+      "nonDetWrittenVariables": [],
+      "typeMap": {
+        "'PITMAN_DIRECTION_BLINKING'": "set(global('PITMAN_POSITION'))",
+        "newPos": "global('PITMAN_POSITION')"
+      }
+    },
+    "ENV_Turn_EngineOn": {
+      "operationName": "ENV_Turn_EngineOn",
+      "parameterNames": [],
+      "outputParameterNames": [],
+      "topLevel": true,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "BLINK_CYCLE_COUNTER",
+        "BLINK_DIRECTION",
+        "PITMAN_DIRECTION_BLINKING",
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "cycleMaxLampStatus",
+        "engineOn",
+        "hazardWarningSwitchOn",
+        "keyState",
+        "lamp_off",
+        "onCycle",
+        "pitmanArmUpDown",
+        "pitman_direction",
+        "remaining_blinks"
+      ],
+      "writtenVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "engineOn",
+        "remaining_blinks"
+      ],
+      "nonDetWrittenVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "remaining_blinks"
+      ],
+      "typeMap": {
+        "'PITMAN_DIRECTION_BLINKING'": "set(global('PITMAN_POSITION'))",
+        "'BLINK_CYCLE_COUNTER'": "set(integer)",
+        "'BLINK_DIRECTION'": "set(global('DIRECTIONS'))"
+      }
+    },
+    "TIME_Nothing": {
+      "operationName": "TIME_Nothing",
+      "parameterNames": [
+        "newOnCycle"
+      ],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "lamp_off"
+      ],
+      "writtenVariables": [
+        "onCycle"
+      ],
+      "nonDetWrittenVariables": [],
+      "typeMap": {
+        "newOnCycle": "boolean"
+      }
+    },
+    "ENV_Pitman_Tip_blinking_short": {
+      "operationName": "ENV_Pitman_Tip_blinking_short",
+      "parameterNames": [
+        "newPos"
+      ],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "BLINK_CYCLE_COUNTER",
+        "BLINK_DIRECTION",
+        "PITMAN_TIP_BLINKING",
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "cycleMaxLampStatus",
+        "engineOn",
+        "hazardWarningSwitchOn",
+        "lamp_off",
+        "onCycle",
+        "pitmanArmUpDown",
+        "pitman_direction",
+        "remaining_blinks"
+      ],
+      "writtenVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "pitmanArmUpDown",
+        "remaining_blinks"
+      ],
+      "nonDetWrittenVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "remaining_blinks"
+      ],
+      "typeMap": {
+        "'PITMAN_TIP_BLINKING'": "set(global('PITMAN_POSITION'))",
+        "'BLINK_CYCLE_COUNTER'": "set(integer)",
+        "'BLINK_DIRECTION'": "set(global('DIRECTIONS'))",
+        "newPos": "global('PITMAN_POSITION')"
+      }
+    },
+    "AbsoluteSetDeadline": {
+      "operationName": "AbsoluteSetDeadline",
+      "parameterNames": [
+        "timer",
+        "deadline"
+      ],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "GenericTimersMC.TIMERS",
+        "curDeadlines"
+      ],
+      "writtenVariables": [
+        "curDeadlines"
+      ],
+      "nonDetWrittenVariables": [],
+      "typeMap": {
+        "timer": "global('PTIMERS')",
+        "'GenericTimersMC.TIMERS'": "set(global('PTIMERS'))",
+        "deadline": "integer"
+      }
+    },
+    "RTIME_BlinkerOn": {
+      "operationName": "RTIME_BlinkerOn",
+      "parameterNames": [
+        "delta"
+      ],
+      "outputParameterNames": [],
+      "topLevel": true,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "curDeadlines",
+        "lamp_off",
+        "lamp_on",
+        "remaining_blinks"
+      ],
+      "writtenVariables": [
+        "blinkLeft",
+        "blinkRight",
+        "curDeadlines",
+        "onCycle",
+        "remaining_blinks"
+      ],
+      "nonDetWrittenVariables": [
+        "blinkLeft",
+        "blinkRight",
+        "remaining_blinks"
+      ],
+      "typeMap": {
+        "delta": "integer"
+      }
+    },
+    "PitmanController_v6.SET_EngineOn": {
+      "operationName": "PitmanController_v6.SET_EngineOn",
+      "parameterNames": [],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "engineOn",
+        "keyState"
+      ],
+      "writtenVariables": [
+        "engineOn"
+      ],
+      "nonDetWrittenVariables": [],
+      "typeMap": {}
+    },
+    "PitmanController_v6.SET_RemainingBlinks": {
+      "operationName": "PitmanController_v6.SET_RemainingBlinks",
+      "parameterNames": [
+        "rem"
+      ],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "BLINK_CYCLE_COUNTER",
+        "remaining_blinks"
+      ],
+      "writtenVariables": [
+        "remaining_blinks"
+      ],
+      "nonDetWrittenVariables": [],
+      "typeMap": {
+        "rem": "integer",
+        "'BLINK_CYCLE_COUNTER'": "set(integer)"
+      }
+    },
+    "PitmanController_v6.SET_EngineOff": {
+      "operationName": "PitmanController_v6.SET_EngineOff",
+      "parameterNames": [],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "engineOn"
+      ],
+      "writtenVariables": [
+        "engineOn"
+      ],
+      "nonDetWrittenVariables": [],
+      "typeMap": {}
+    },
+    "RTIME_Passes": {
+      "operationName": "RTIME_Passes",
+      "parameterNames": [
+        "delta"
+      ],
+      "outputParameterNames": [],
+      "topLevel": true,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "curDeadlines"
+      ],
+      "writtenVariables": [
+        "curDeadlines"
+      ],
+      "nonDetWrittenVariables": [],
+      "typeMap": {
+        "delta": "integer"
+      }
+    },
+    "ENV_Pitman_DirectionBlinking": {
+      "operationName": "ENV_Pitman_DirectionBlinking",
+      "parameterNames": [
+        "newPos"
+      ],
+      "outputParameterNames": [],
+      "topLevel": true,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "BLINK_CYCLE_COUNTER",
+        "BLINK_DIRECTION",
+        "PITMAN_DIRECTION_BLINKING",
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "cycleMaxLampStatus",
+        "engineOn",
+        "hazardWarningSwitchOn",
+        "lamp_off",
+        "onCycle",
+        "pitmanArmUpDown",
+        "pitman_direction",
+        "remaining_blinks"
+      ],
+      "writtenVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "pitmanArmUpDown",
+        "remaining_blinks"
+      ],
+      "nonDetWrittenVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "remaining_blinks"
+      ],
+      "typeMap": {
+        "'PITMAN_DIRECTION_BLINKING'": "set(global('PITMAN_POSITION'))",
+        "'BLINK_CYCLE_COUNTER'": "set(integer)",
+        "'BLINK_DIRECTION'": "set(global('DIRECTIONS'))",
+        "newPos": "global('PITMAN_POSITION')"
+      }
+    },
+    "ENV_Pitman_Reset_to_Neutral": {
+      "operationName": "ENV_Pitman_Reset_to_Neutral",
+      "parameterNames": [],
+      "outputParameterNames": [],
+      "topLevel": true,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "hazardWarningSwitchOn",
+        "lamp_off",
+        "pitmanArmUpDown",
+        "remaining_blinks"
+      ],
+      "writtenVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "pitmanArmUpDown",
+        "remaining_blinks"
+      ],
+      "nonDetWrittenVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "remaining_blinks"
+      ],
+      "typeMap": {}
+    },
+    "IncreaseTime": {
+      "operationName": "IncreaseTime",
+      "parameterNames": [
+        "delta"
+      ],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "curDeadlines"
+      ],
+      "writtenVariables": [
+        "curDeadlines"
+      ],
+      "nonDetWrittenVariables": [],
+      "typeMap": {
+        "delta": "integer"
+      }
+    },
+    "TIME_Tip_blinking_Timeout": {
+      "operationName": "TIME_Tip_blinking_Timeout",
+      "parameterNames": [],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "BLINK_CYCLE_COUNTER",
+        "PITMAN_TIP_BLINKING",
+        "active_blinkers",
+        "pitmanArmUpDown",
+        "pitman_direction",
+        "remaining_blinks"
+      ],
+      "writtenVariables": [
+        "remaining_blinks"
+      ],
+      "nonDetWrittenVariables": [],
+      "typeMap": {
+        "'PITMAN_TIP_BLINKING'": "set(global('PITMAN_POSITION'))",
+        "'BLINK_CYCLE_COUNTER'": "set(integer)"
+      }
+    },
+    "AddDeadline": {
+      "operationName": "AddDeadline",
+      "parameterNames": [
+        "timer",
+        "deadline"
+      ],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "GenericTimersMC.TIMERS",
+        "curDeadlines"
+      ],
+      "writtenVariables": [
+        "curDeadlines"
+      ],
+      "nonDetWrittenVariables": [],
+      "typeMap": {
+        "timer": "global('PTIMERS')",
+        "'GenericTimersMC.TIMERS'": "set(global('PTIMERS'))",
+        "deadline": "integer"
+      }
+    },
+    "ENV_Pitman_Tip_blinking_start": {
+      "operationName": "ENV_Pitman_Tip_blinking_start",
+      "parameterNames": [
+        "newPos"
+      ],
+      "outputParameterNames": [],
+      "topLevel": true,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "BLINK_CYCLE_COUNTER",
+        "BLINK_DIRECTION",
+        "GenericTimersMC.TIMERS",
+        "PITMAN_TIP_BLINKING",
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "curDeadlines",
+        "cycleMaxLampStatus",
+        "engineOn",
+        "hazardWarningSwitchOn",
+        "lamp_off",
+        "onCycle",
+        "pitmanArmUpDown",
+        "pitman_direction",
+        "remaining_blinks"
+      ],
+      "writtenVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "curDeadlines",
+        "pitmanArmUpDown",
+        "remaining_blinks"
+      ],
+      "nonDetWrittenVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "remaining_blinks"
+      ],
+      "typeMap": {
+        "'GenericTimersMC.TIMERS'": "set(global('PTIMERS'))",
+        "'PITMAN_TIP_BLINKING'": "set(global('PITMAN_POSITION'))",
+        "'BLINK_CYCLE_COUNTER'": "set(integer)",
+        "'BLINK_DIRECTION'": "set(global('DIRECTIONS'))",
+        "newPos": "global('PITMAN_POSITION')"
+      }
+    },
+    "TIME_BlinkerOn": {
+      "operationName": "TIME_BlinkerOn",
+      "parameterNames": [],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "lamp_off",
+        "lamp_on",
+        "remaining_blinks"
+      ],
+      "writtenVariables": [
+        "blinkLeft",
+        "blinkRight",
+        "onCycle",
+        "remaining_blinks"
+      ],
+      "nonDetWrittenVariables": [
+        "blinkLeft",
+        "blinkRight",
+        "remaining_blinks"
+      ],
+      "typeMap": {}
+    },
+    "PitmanController_v6.SET_Hazard_blinking": {
+      "operationName": "PitmanController_v6.SET_Hazard_blinking",
+      "parameterNames": [
+        "newSwitchPos"
+      ],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "hazardWarningSwitchOn"
+      ],
+      "writtenVariables": [
+        "hazardWarningSwitchOn"
+      ],
+      "nonDetWrittenVariables": [],
+      "typeMap": {
+        "newSwitchPos": "global('SWITCH_STATUS')"
+      }
+    },
+    "IncreaseTimeUntilCyclicDeadline": {
+      "operationName": "IncreaseTimeUntilCyclicDeadline",
+      "parameterNames": [
+        "timer",
+        "delta",
+        "newDelta"
+      ],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "curDeadlines"
+      ],
+      "writtenVariables": [
+        "curDeadlines"
+      ],
+      "nonDetWrittenVariables": [],
+      "typeMap": {
+        "timer": "global('PTIMERS')",
+        "delta": "integer",
+        "newDelta": "integer"
+      }
+    },
+    "PitmanController_v6.SET_AllBlinkersOff": {
+      "operationName": "PitmanController_v6.SET_AllBlinkersOff",
+      "parameterNames": [],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "lamp_off"
+      ],
+      "writtenVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "remaining_blinks"
+      ],
+      "nonDetWrittenVariables": [],
+      "typeMap": {}
+    },
+    "PitmanController_v6.SET_BlinkersOn": {
+      "operationName": "PitmanController_v6.SET_BlinkersOn",
+      "parameterNames": [
+        "direction",
+        "rem"
+      ],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "BLINK_CYCLE_COUNTER",
+        "BLINK_DIRECTION",
+        "cycleMaxLampStatus",
+        "lamp_off",
+        "onCycle"
+      ],
+      "writtenVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "remaining_blinks"
+      ],
+      "nonDetWrittenVariables": [
+        "blinkLeft",
+        "blinkRight"
+      ],
+      "typeMap": {
+        "rem": "integer",
+        "'BLINK_CYCLE_COUNTER'": "set(integer)",
+        "'BLINK_DIRECTION'": "set(global('DIRECTIONS'))",
+        "direction": "global('DIRECTIONS')"
+      }
+    },
+    "PitmanController_v6.SET_Pitman_Tip_blinking_short": {
+      "operationName": "PitmanController_v6.SET_Pitman_Tip_blinking_short",
+      "parameterNames": [
+        "newPos"
+      ],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "PITMAN_TIP_BLINKING",
+        "pitmanArmUpDown"
+      ],
+      "writtenVariables": [
+        "pitmanArmUpDown"
+      ],
+      "nonDetWrittenVariables": [],
+      "typeMap": {
+        "'PITMAN_TIP_BLINKING'": "set(global('PITMAN_POSITION'))",
+        "newPos": "global('PITMAN_POSITION')"
+      }
+    },
+    "RTIME_Tip_blinking_Timeout": {
+      "operationName": "RTIME_Tip_blinking_Timeout",
+      "parameterNames": [
+        "delta"
+      ],
+      "outputParameterNames": [],
+      "topLevel": true,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "BLINK_CYCLE_COUNTER",
+        "PITMAN_TIP_BLINKING",
+        "active_blinkers",
+        "curDeadlines",
+        "pitmanArmUpDown",
+        "pitman_direction",
+        "remaining_blinks"
+      ],
+      "writtenVariables": [
+        "curDeadlines",
+        "remaining_blinks"
+      ],
+      "nonDetWrittenVariables": [
+        "remaining_blinks"
+      ],
+      "typeMap": {
+        "delta": "integer",
+        "'PITMAN_TIP_BLINKING'": "set(global('PITMAN_POSITION'))",
+        "'BLINK_CYCLE_COUNTER'": "set(integer)"
+      }
+    },
+    "TIME_BlinkerOff": {
+      "operationName": "TIME_BlinkerOff",
+      "parameterNames": [],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "lamp_off",
+        "remaining_blinks"
+      ],
+      "writtenVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "onCycle"
+      ],
+      "nonDetWrittenVariables": [
+        "active_blinkers"
+      ],
+      "typeMap": {}
+    },
+    "PitmanController_v6.SET_Pitman_Reset_to_Neutral": {
+      "operationName": "PitmanController_v6.SET_Pitman_Reset_to_Neutral",
+      "parameterNames": [],
+      "outputParameterNames": [],
+      "topLevel": false,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "pitmanArmUpDown"
+      ],
+      "writtenVariables": [
+        "pitmanArmUpDown"
+      ],
+      "nonDetWrittenVariables": [],
+      "typeMap": {}
+    },
+    "ENV_Turn_EngineOff": {
+      "operationName": "ENV_Turn_EngineOff",
+      "parameterNames": [],
+      "outputParameterNames": [],
+      "topLevel": true,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "engineOn",
+        "hazardWarningSwitchOn",
+        "lamp_off",
+        "remaining_blinks"
+      ],
+      "writtenVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "engineOn",
+        "remaining_blinks"
+      ],
+      "nonDetWrittenVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "remaining_blinks"
+      ],
+      "typeMap": {}
+    },
+    "RTIME_BlinkerOff": {
+      "operationName": "RTIME_BlinkerOff",
+      "parameterNames": [
+        "delta"
+      ],
+      "outputParameterNames": [],
+      "topLevel": true,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "curDeadlines",
+        "lamp_off",
+        "remaining_blinks"
+      ],
+      "writtenVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "curDeadlines",
+        "onCycle"
+      ],
+      "nonDetWrittenVariables": [
+        "active_blinkers"
+      ],
+      "typeMap": {
+        "delta": "integer"
+      }
+    },
+    "RTIME_Nothing": {
+      "operationName": "RTIME_Nothing",
+      "parameterNames": [
+        "delta",
+        "newOnCycle"
+      ],
+      "outputParameterNames": [],
+      "topLevel": true,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "curDeadlines",
+        "lamp_off"
+      ],
+      "writtenVariables": [
+        "curDeadlines",
+        "onCycle"
+      ],
+      "nonDetWrittenVariables": [],
+      "typeMap": {
+        "newOnCycle": "boolean",
+        "delta": "integer"
+      }
+    },
+    "ENV_Hazard_blinking": {
+      "operationName": "ENV_Hazard_blinking",
+      "parameterNames": [
+        "newSwitchPos"
+      ],
+      "outputParameterNames": [],
+      "topLevel": true,
+      "type": "CLASSICAL_B",
+      "readVariables": [
+        "BLINK_CYCLE_COUNTER",
+        "BLINK_DIRECTION",
+        "PITMAN_DIRECTION_BLINKING",
+        "cycleMaxLampStatus",
+        "engineOn",
+        "hazardWarningSwitchOn",
+        "lamp_off",
+        "onCycle",
+        "pitmanArmUpDown",
+        "pitman_direction",
+        "remaining_blinks"
+      ],
+      "writtenVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "hazardWarningSwitchOn",
+        "remaining_blinks"
+      ],
+      "nonDetWrittenVariables": [
+        "active_blinkers",
+        "blinkLeft",
+        "blinkRight",
+        "remaining_blinks"
+      ],
+      "typeMap": {
+        "newSwitchPos": "global('SWITCH_STATUS')",
+        "'PITMAN_DIRECTION_BLINKING'": "set(global('PITMAN_POSITION'))",
+        "'BLINK_CYCLE_COUNTER'": "set(integer)",
+        "'BLINK_DIRECTION'": "set(global('DIRECTIONS'))"
+      }
+    }
+  },
+  "globalIdentifierTypes": {
+    "engineOn": "boolean",
+    "keyState": "global('KEY_STATE')",
+    "pitmanArmUpDown": "global('PITMAN_POSITION')",
+    "remaining_blinks": "integer",
+    "cycleMaxLampStatus": "set(couple(boolean,integer))",
+    "active_blinkers": "set(global('DIRECTIONS'))",
+    "curDeadlines": "set(couple(global('PTIMERS'),integer))",
+    "blinkRight": "integer",
+    "pitman_direction": "set(couple(global('PITMAN_POSITION'),global('DIRECTIONS')))",
+    "onCycle": "boolean",
+    "lamp_off": "integer",
+    "hazardWarningSwitchOn": "global('SWITCH_STATUS')",
+    "lamp_on": "integer",
+    "blinkLeft": "integer"
+  },
+  "metadata": {
+    "fileType": "Trace",
+    "formatVersion": 5,
+    "savedAt": "2022-05-19T11:38:55.718738Z",
+    "creator": "traceReplay",
+    "proB2KernelVersion": "4.0.0-SNAPSHOT",
+    "proBCliVersion": "1.12.0-nightly",
+    "modelName": "PitmanController_TIME_MC_v4"
+  }
+}
\ No newline at end of file
diff --git a/B2Program/LightModel/Sensors.js b/B2Program/LightModel/Sensors.js
new file mode 100644
index 0000000000000000000000000000000000000000..5ec206f2cb934d059f415e4035337895a65c01d1
--- /dev/null
+++ b/B2Program/LightModel/Sensors.js
@@ -0,0 +1,197 @@
+import { BBoolean } from './btypes/BBoolean.js';
+import { BSet } from './btypes/BSet.js';
+import { SelectError } from "./btypes/BUtils.js";
+export var enum_SWITCH_STATUS;
+(function (enum_SWITCH_STATUS) {
+    enum_SWITCH_STATUS[enum_SWITCH_STATUS["switch_on"] = 0] = "switch_on";
+    enum_SWITCH_STATUS[enum_SWITCH_STATUS["switch_off"] = 1] = "switch_off";
+})(enum_SWITCH_STATUS || (enum_SWITCH_STATUS = {}));
+export class SWITCH_STATUS {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof SWITCH_STATUS)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_SWITCH_STATUS[this.value].toString();
+    }
+    static get_switch_on() { return new SWITCH_STATUS(enum_SWITCH_STATUS.switch_on); }
+    static get_switch_off() { return new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off); }
+}
+export var enum_PITMAN_POSITION;
+(function (enum_PITMAN_POSITION) {
+    enum_PITMAN_POSITION[enum_PITMAN_POSITION["Neutral"] = 0] = "Neutral";
+    enum_PITMAN_POSITION[enum_PITMAN_POSITION["Downward5"] = 1] = "Downward5";
+    enum_PITMAN_POSITION[enum_PITMAN_POSITION["Downward7"] = 2] = "Downward7";
+    enum_PITMAN_POSITION[enum_PITMAN_POSITION["Upward5"] = 3] = "Upward5";
+    enum_PITMAN_POSITION[enum_PITMAN_POSITION["Upward7"] = 4] = "Upward7";
+})(enum_PITMAN_POSITION || (enum_PITMAN_POSITION = {}));
+export class PITMAN_POSITION {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof PITMAN_POSITION)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_PITMAN_POSITION[this.value].toString();
+    }
+    static get_Neutral() { return new PITMAN_POSITION(enum_PITMAN_POSITION.Neutral); }
+    static get_Downward5() { return new PITMAN_POSITION(enum_PITMAN_POSITION.Downward5); }
+    static get_Downward7() { return new PITMAN_POSITION(enum_PITMAN_POSITION.Downward7); }
+    static get_Upward5() { return new PITMAN_POSITION(enum_PITMAN_POSITION.Upward5); }
+    static get_Upward7() { return new PITMAN_POSITION(enum_PITMAN_POSITION.Upward7); }
+}
+export var enum_KEY_STATE;
+(function (enum_KEY_STATE) {
+    enum_KEY_STATE[enum_KEY_STATE["NoKeyInserted"] = 0] = "NoKeyInserted";
+    enum_KEY_STATE[enum_KEY_STATE["KeyInserted"] = 1] = "KeyInserted";
+    enum_KEY_STATE[enum_KEY_STATE["KeyInsertedOnPosition"] = 2] = "KeyInsertedOnPosition";
+})(enum_KEY_STATE || (enum_KEY_STATE = {}));
+export class KEY_STATE {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof KEY_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_KEY_STATE[this.value].toString();
+    }
+    static get_NoKeyInserted() { return new KEY_STATE(enum_KEY_STATE.NoKeyInserted); }
+    static get_KeyInserted() { return new KEY_STATE(enum_KEY_STATE.KeyInserted); }
+    static get_KeyInsertedOnPosition() { return new KEY_STATE(enum_KEY_STATE.KeyInsertedOnPosition); }
+}
+export default class Sensors {
+    constructor() {
+        Sensors.PITMAN_DIRECTION_BLINKING = new BSet(new PITMAN_POSITION(enum_PITMAN_POSITION.Downward7), new PITMAN_POSITION(enum_PITMAN_POSITION.Upward7));
+        Sensors.PITMAN_TIP_BLINKING = new BSet(new PITMAN_POSITION(enum_PITMAN_POSITION.Downward5), new PITMAN_POSITION(enum_PITMAN_POSITION.Upward5));
+        this.hazardWarningSwitchOn = new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off);
+        this.pitmanArmUpDown = new PITMAN_POSITION(enum_PITMAN_POSITION.Neutral);
+        this.keyState = new KEY_STATE(enum_KEY_STATE.KeyInsertedOnPosition);
+        this.engineOn = new BBoolean(false);
+    }
+    _copy() {
+        var _a, _b, _c;
+        let _instance = Object.create(Sensors.prototype);
+        for (let key of Object.keys(this)) {
+            _instance[key] = (_c = (_b = (_a = this[key])._copy) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : this[key];
+        }
+        return _instance;
+    }
+    SET_EngineOn() {
+        if ((new BBoolean(this.engineOn.equal(new BBoolean(false)).booleanValue() && this.keyState.equal(new KEY_STATE(enum_KEY_STATE.KeyInsertedOnPosition)).booleanValue())).booleanValue()) {
+            this.engineOn = new BBoolean(true);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    SET_EngineOff() {
+        if ((this.engineOn.equal(new BBoolean(true))).booleanValue()) {
+            this.engineOn = new BBoolean(false);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    SET_Pitman_DirectionBlinking(newPos) {
+        if ((new BBoolean(Sensors.PITMAN_DIRECTION_BLINKING.elementOf(newPos).booleanValue() && newPos.unequal(this.pitmanArmUpDown).booleanValue())).booleanValue()) {
+            this.pitmanArmUpDown = newPos;
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    SET_Pitman_Reset_to_Neutral() {
+        if ((this.pitmanArmUpDown.unequal(new PITMAN_POSITION(enum_PITMAN_POSITION.Neutral))).booleanValue()) {
+            this.pitmanArmUpDown = new PITMAN_POSITION(enum_PITMAN_POSITION.Neutral);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    SET_Pitman_Tip_blinking_short(newPos) {
+        if ((new BBoolean(Sensors.PITMAN_TIP_BLINKING.elementOf(newPos).booleanValue() && newPos.unequal(this.pitmanArmUpDown).booleanValue())).booleanValue()) {
+            this.pitmanArmUpDown = newPos;
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    SET_Hazard_blinking(newSwitchPos) {
+        if ((new BBoolean(Sensors._SWITCH_STATUS.elementOf(newSwitchPos).booleanValue() && newSwitchPos.unequal(this.hazardWarningSwitchOn).booleanValue())).booleanValue()) {
+            this.hazardWarningSwitchOn = newSwitchPos;
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    _get_PITMAN_DIRECTION_BLINKING() {
+        return Sensors.PITMAN_DIRECTION_BLINKING;
+    }
+    _get_PITMAN_TIP_BLINKING() {
+        return Sensors.PITMAN_TIP_BLINKING;
+    }
+    _get_hazardWarningSwitchOn() {
+        return this.hazardWarningSwitchOn;
+    }
+    _get_pitmanArmUpDown() {
+        return this.pitmanArmUpDown;
+    }
+    _get_keyState() {
+        return this.keyState;
+    }
+    _get_engineOn() {
+        return this.engineOn;
+    }
+    _get__SWITCH_STATUS() {
+        return Sensors._SWITCH_STATUS;
+    }
+    _get__PITMAN_POSITION() {
+        return Sensors._PITMAN_POSITION;
+    }
+    _get__KEY_STATE() {
+        return Sensors._KEY_STATE;
+    }
+}
+Sensors._SWITCH_STATUS = new BSet(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_on), new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off));
+Sensors._PITMAN_POSITION = new BSet(new PITMAN_POSITION(enum_PITMAN_POSITION.Neutral), new PITMAN_POSITION(enum_PITMAN_POSITION.Downward5), new PITMAN_POSITION(enum_PITMAN_POSITION.Downward7), new PITMAN_POSITION(enum_PITMAN_POSITION.Upward5), new PITMAN_POSITION(enum_PITMAN_POSITION.Upward7));
+Sensors._KEY_STATE = new BSet(new KEY_STATE(enum_KEY_STATE.NoKeyInserted), new KEY_STATE(enum_KEY_STATE.KeyInserted), new KEY_STATE(enum_KEY_STATE.KeyInsertedOnPosition));
diff --git a/B2Program/LightModel/Sensors.ts b/B2Program/LightModel/Sensors.ts
new file mode 100644
index 0000000000000000000000000000000000000000..7be588a9a168a24861c9b1372c80ba5c786486e1
--- /dev/null
+++ b/B2Program/LightModel/Sensors.ts
@@ -0,0 +1,259 @@
+import {BBoolean} from './btypes/BBoolean.js';
+import {BSet} from './btypes/BSet.js';
+import {BObject} from './btypes/BObject.js';
+import {BUtils} from "./btypes/BUtils.js";
+import {SelectError} from "./btypes/BUtils.js";
+
+export enum enum_SWITCH_STATUS {
+    switch_on,
+    switch_off
+}
+
+export class SWITCH_STATUS implements BObject{
+    value: enum_SWITCH_STATUS;
+
+    constructor(value: enum_SWITCH_STATUS) {
+        this.value = value;
+    }
+
+    equal(other: SWITCH_STATUS) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: SWITCH_STATUS) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof SWITCH_STATUS)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_SWITCH_STATUS[this.value].toString();
+    }
+
+    static get_switch_on () {return new SWITCH_STATUS(enum_SWITCH_STATUS.switch_on);}
+    static get_switch_off () {return new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off);}
+
+
+}
+
+export enum enum_PITMAN_POSITION {
+    Neutral,
+    Downward5,
+    Downward7,
+    Upward5,
+    Upward7
+}
+
+export class PITMAN_POSITION implements BObject{
+    value: enum_PITMAN_POSITION;
+
+    constructor(value: enum_PITMAN_POSITION) {
+        this.value = value;
+    }
+
+    equal(other: PITMAN_POSITION) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: PITMAN_POSITION) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof PITMAN_POSITION)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_PITMAN_POSITION[this.value].toString();
+    }
+
+    static get_Neutral () {return new PITMAN_POSITION(enum_PITMAN_POSITION.Neutral);}
+    static get_Downward5 () {return new PITMAN_POSITION(enum_PITMAN_POSITION.Downward5);}
+    static get_Downward7 () {return new PITMAN_POSITION(enum_PITMAN_POSITION.Downward7);}
+    static get_Upward5 () {return new PITMAN_POSITION(enum_PITMAN_POSITION.Upward5);}
+    static get_Upward7 () {return new PITMAN_POSITION(enum_PITMAN_POSITION.Upward7);}
+
+
+}
+
+export enum enum_KEY_STATE {
+    NoKeyInserted,
+    KeyInserted,
+    KeyInsertedOnPosition
+}
+
+export class KEY_STATE implements BObject{
+    value: enum_KEY_STATE;
+
+    constructor(value: enum_KEY_STATE) {
+        this.value = value;
+    }
+
+    equal(other: KEY_STATE) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: KEY_STATE) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof KEY_STATE)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_KEY_STATE[this.value].toString();
+    }
+
+    static get_NoKeyInserted () {return new KEY_STATE(enum_KEY_STATE.NoKeyInserted);}
+    static get_KeyInserted () {return new KEY_STATE(enum_KEY_STATE.KeyInserted);}
+    static get_KeyInsertedOnPosition () {return new KEY_STATE(enum_KEY_STATE.KeyInsertedOnPosition);}
+
+
+}
+
+
+export default class Sensors {
+
+
+    private static PITMAN_DIRECTION_BLINKING: BSet<PITMAN_POSITION>;
+    private static PITMAN_TIP_BLINKING: BSet<PITMAN_POSITION>;
+
+    private static _SWITCH_STATUS: BSet<SWITCH_STATUS> = new BSet(new SWITCH_STATUS(enum_SWITCH_STATUS.switch_on), new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off));
+    private static _PITMAN_POSITION: BSet<PITMAN_POSITION> = new BSet(new PITMAN_POSITION(enum_PITMAN_POSITION.Neutral), new PITMAN_POSITION(enum_PITMAN_POSITION.Downward5), new PITMAN_POSITION(enum_PITMAN_POSITION.Downward7), new PITMAN_POSITION(enum_PITMAN_POSITION.Upward5), new PITMAN_POSITION(enum_PITMAN_POSITION.Upward7));
+    private static _KEY_STATE: BSet<KEY_STATE> = new BSet(new KEY_STATE(enum_KEY_STATE.NoKeyInserted), new KEY_STATE(enum_KEY_STATE.KeyInserted), new KEY_STATE(enum_KEY_STATE.KeyInsertedOnPosition));
+
+    private hazardWarningSwitchOn: SWITCH_STATUS;
+    private pitmanArmUpDown: PITMAN_POSITION;
+    private keyState: KEY_STATE;
+    private engineOn: BBoolean;
+
+    constructor() {
+        Sensors.PITMAN_DIRECTION_BLINKING = new BSet(new PITMAN_POSITION(enum_PITMAN_POSITION.Downward7), new PITMAN_POSITION(enum_PITMAN_POSITION.Upward7));
+        Sensors.PITMAN_TIP_BLINKING = new BSet(new PITMAN_POSITION(enum_PITMAN_POSITION.Downward5), new PITMAN_POSITION(enum_PITMAN_POSITION.Upward5));
+        this.hazardWarningSwitchOn = new SWITCH_STATUS(enum_SWITCH_STATUS.switch_off);
+        this.pitmanArmUpDown = new PITMAN_POSITION(enum_PITMAN_POSITION.Neutral);
+        this.keyState = new KEY_STATE(enum_KEY_STATE.KeyInsertedOnPosition);
+        this.engineOn = new BBoolean(false);
+    }
+
+    public _copy(): Sensors {
+        let _instance = Object.create(Sensors.prototype);
+        for(let key of Object.keys(this)) {
+            _instance[key] = this[key]._copy?.() ?? this[key];
+        }
+        return _instance;
+    }
+
+     SET_EngineOn(): void {
+        if((new BBoolean(this.engineOn.equal(new BBoolean(false)).booleanValue() && this.keyState.equal(new KEY_STATE(enum_KEY_STATE.KeyInsertedOnPosition)).booleanValue())).booleanValue()) {
+            this.engineOn = new BBoolean(true);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     SET_EngineOff(): void {
+        if((this.engineOn.equal(new BBoolean(true))).booleanValue()) {
+            this.engineOn = new BBoolean(false);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     SET_Pitman_DirectionBlinking(newPos: PITMAN_POSITION): void {
+        if((new BBoolean(Sensors.PITMAN_DIRECTION_BLINKING.elementOf(newPos).booleanValue() && newPos.unequal(this.pitmanArmUpDown).booleanValue())).booleanValue()) {
+            this.pitmanArmUpDown = newPos;
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     SET_Pitman_Reset_to_Neutral(): void {
+        if((this.pitmanArmUpDown.unequal(new PITMAN_POSITION(enum_PITMAN_POSITION.Neutral))).booleanValue()) {
+            this.pitmanArmUpDown = new PITMAN_POSITION(enum_PITMAN_POSITION.Neutral);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     SET_Pitman_Tip_blinking_short(newPos: PITMAN_POSITION): void {
+        if((new BBoolean(Sensors.PITMAN_TIP_BLINKING.elementOf(newPos).booleanValue() && newPos.unequal(this.pitmanArmUpDown).booleanValue())).booleanValue()) {
+            this.pitmanArmUpDown = newPos;
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     SET_Hazard_blinking(newSwitchPos: SWITCH_STATUS): void {
+        if((new BBoolean(Sensors._SWITCH_STATUS.elementOf(newSwitchPos).booleanValue() && newSwitchPos.unequal(this.hazardWarningSwitchOn).booleanValue())).booleanValue()) {
+            this.hazardWarningSwitchOn = newSwitchPos;
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+    _get_PITMAN_DIRECTION_BLINKING(): BSet<PITMAN_POSITION> {
+        return Sensors.PITMAN_DIRECTION_BLINKING;
+    }
+
+    _get_PITMAN_TIP_BLINKING(): BSet<PITMAN_POSITION> {
+        return Sensors.PITMAN_TIP_BLINKING;
+    }
+
+    _get_hazardWarningSwitchOn(): SWITCH_STATUS {
+        return this.hazardWarningSwitchOn;
+    }
+
+    _get_pitmanArmUpDown(): PITMAN_POSITION {
+        return this.pitmanArmUpDown;
+    }
+
+    _get_keyState(): KEY_STATE {
+        return this.keyState;
+    }
+
+    _get_engineOn(): BBoolean {
+        return this.engineOn;
+    }
+
+    _get__SWITCH_STATUS(): BSet<SWITCH_STATUS> {
+        return Sensors._SWITCH_STATUS;
+    }
+
+    _get__PITMAN_POSITION(): BSet<PITMAN_POSITION> {
+        return Sensors._PITMAN_POSITION;
+    }
+
+    _get__KEY_STATE(): BSet<KEY_STATE> {
+        return Sensors._KEY_STATE;
+    }
+
+
+
+
+}
+
diff --git a/B2Program/LightModel/blinking_machine.json b/B2Program/LightModel/blinking_machine.json
new file mode 100644
index 0000000000000000000000000000000000000000..36019ea3df9b9dc9c7133d0f7be718c1fecf9c80
--- /dev/null
+++ b/B2Program/LightModel/blinking_machine.json
@@ -0,0 +1,35 @@
+{
+  "svg":"LichtUebersicht.svg",
+  "items":[
+    {
+    "id":"A-right",
+    "attr":"fill",
+    "value":"IF right_blink:active_blinkers THEN IF blink_lamps_status=lamp_on THEN \"yellow\" ELSE \"#ffffcc\" END ELSE \"#f4eed7\" END"
+    },
+    {
+    "id":"B-right",
+    "attr":"fill",
+    "value":"IF right_blink:active_blinkers THEN IF blink_lamps_status=lamp_on THEN \"yellow\" ELSE \"#ffffcc\" END ELSE \"white\" END"
+    },
+    {
+    "id":"C-right",
+    "attr":"fill",
+    "value":"IF right_blink:active_blinkers THEN IF blink_lamps_status=lamp_on THEN \"orange\" ELSE \"#ffe6cc\" END ELSE \"#d40000\" END"
+    },
+    {
+    "id":"A-left",
+    "attr":"fill",
+    "value":"IF left_blink:active_blinkers THEN IF blink_lamps_status=lamp_on THEN \"yellow\" ELSE \"#ffffcc\" END ELSE \"#f4eed7\" END"
+    },
+    {
+    "id":"B-left",
+    "attr":"fill",
+    "value":"IF left_blink:active_blinkers THEN IF blink_lamps_status=lamp_on THEN \"yellow\" ELSE \"#ffffcc\" END ELSE \"white\" END"
+    },
+    {
+    "id":"C-left",
+    "attr":"fill",
+    "value":"IF left_blink:active_blinkers THEN IF blink_lamps_status=lamp_on THEN \"orange\" ELSE \"#ffe6cc\" END ELSE \"#d40000\" END"
+    }
+]
+}
diff --git a/B2Program/LightModel/blinking_visb_v2.json b/B2Program/LightModel/blinking_visb_v2.json
new file mode 100644
index 0000000000000000000000000000000000000000..ee48743b03f4c74e993314b16c1b27cec40582bd
--- /dev/null
+++ b/B2Program/LightModel/blinking_visb_v2.json
@@ -0,0 +1,136 @@
+{
+  "svg":"LichtUebersicht_v2.svg",
+  "items":[
+    {
+    "id":"A-right",
+    "attr":"fill",
+    "value":"IF right_blink:active_blinkers THEN IF blinkRight=lamp_off THEN \"#ffe6cc\" ELSE \"orange\" END ELSE \"white\" END"
+    },
+    {
+    "id":"A-right",
+    "attr":"stroke-opacity",
+    "value":"IF right_blink:active_blinkers THEN \"0.5\" ELSE \"1\" END"
+    },
+    
+    {
+    "id":"B-right",
+    "attr":"stroke-opacity",
+    "value":"IF right_blink:active_blinkers THEN \"0.5\" ELSE \"1\" END"
+    },
+    {
+    "id":"B-right",
+    "attr":"fill",
+    "value":"IF right_blink:active_blinkers THEN IF blinkRight=lamp_off THEN \"#ffe6cc\" ELSE \"orange\" END ELSE \"white\" END"
+    },
+    
+    {
+    "id":"C-right",
+    "attr":"fill",
+    "value":"IF right_blink:active_blinkers THEN IF blinkRight=lamp_off THEN \"#ffe6cc\" ELSE \"orange\" END ELSE \"white\" END"
+    },
+    {
+    "id":"C-right",
+    "attr":"stroke-opacity",
+    "value":"IF right_blink:active_blinkers THEN \"0.5\" ELSE \"1\" END"
+    },
+    
+    {
+    "id":"A-left",
+    "attr":"fill",
+    "value":"IF left_blink:active_blinkers THEN IF blinkLeft=lamp_off THEN \"#ffe6cc\" ELSE \"orange\" END ELSE \"white\" END"
+    },
+    {
+    "id":"A-left",
+    "attr":"stroke-opacity",
+    "value":"IF left_blink:active_blinkers THEN \"0.5\" ELSE \"1\" END"
+    },
+    
+    {
+    "id":"B-left",
+    "attr":"stroke-opacity",
+    "value":"IF left_blink:active_blinkers THEN \"0.5\" ELSE \"1\" END"
+    },
+    {
+    "id":"B-left",
+    "attr":"fill",
+    "value":"IF left_blink:active_blinkers THEN IF blinkLeft=lamp_off THEN \"#ffe6cc\" ELSE \"orange\" END ELSE \"white\" END"
+    },
+    
+    {
+    "id":"C-left",
+    "attr":"fill",
+    "value":"IF left_blink:active_blinkers THEN IF blinkLeft=lamp_off THEN \"#ffe6cc\" ELSE \"orange\" END ELSE \"white\" END"
+    },
+    {
+    "id":"C-left",
+    "attr":"stroke-opacity",
+    "value":"IF left_blink:active_blinkers THEN \"0.5\" ELSE \"1\" END"
+    },
+    
+    {
+    "id":"front-window",
+    "attr":"fill",
+    "value":"IF engineOn=TRUE THEN \"#f2f2f2\" ELSE \"white\" END"
+    },
+    {
+    "id":"back-window",
+    "attr":"fill",
+    "value":"IF engineOn=TRUE THEN \"#f2f2f2\" ELSE \"white\" END"
+    },
+    {
+    "id":"warningLight",
+    "attr":"fill-opacity",
+    "value":"IF hazardWarningSwitchOn=switch_on THEN \"0.6\" ELSE \"0.1\" END"
+    },
+    
+    {
+    "id":"PitmanNeutral",
+    "attr":"fill-opacity",
+    "value":"IF pitmanArmUpDown=Neutral THEN \"1\" ELSE \"0.2\" END"
+    },
+    {
+    "id":"PitmanUpward",
+    "attr":"fill-opacity",
+    "value":"IF pitmanArmUpDown=Upward7 THEN \"1\" ELSIF pitmanArmUpDown=Upward5 THEN \"0.7\" ELSE \"0.2\" END"
+    },
+    {
+    "id":"PitmanDownward",
+    "attr":"fill-opacity",
+    "value":"IF pitmanArmUpDown=Downward7 THEN \"1\" ELSIF pitmanArmUpDown=Downward5 THEN \"0.7\" ELSE \"0.2\" END"
+    },
+    
+    {
+    "id":"car_outline",
+    "attr":"stroke-opacity",
+    "value":"IF engineOn=TRUE THEN \"1.0\" ELSE \"0.5\" END"
+    }
+],
+  "events":[
+    {
+      "id":"warningLight",
+      "event":"ENV_Hazard_blinking"
+    },
+    {
+      "id":"front-window",
+      "event":"ENV_Turn_EngineOn"
+    },
+    {
+      "id":"PitmanNeutral",
+      "event":"ENV_Pitman_Reset_to_Neutral"
+    },
+    {
+      "id":"PitmanUpward",
+      "event":"ENV_Pitman_DirectionBlinking",
+      "predicates":[
+        "newPos=Upward7"
+      ]
+    },
+    {
+      "id":"PitmanDownward",
+      "event":"ENV_Pitman_DirectionBlinking",
+      "predicates":[
+        "newPos=Downward7"
+      ]
+    }
+    ]
+}
diff --git a/B2Program/LightModel/blinking_visb_v4.json b/B2Program/LightModel/blinking_visb_v4.json
new file mode 100644
index 0000000000000000000000000000000000000000..16ea799d6d7868bacd5918a1057b8426df31f718
--- /dev/null
+++ b/B2Program/LightModel/blinking_visb_v4.json
@@ -0,0 +1,205 @@
+{
+  "svg":"LichtUebersicht_v4.svg",
+  "items":[
+    {
+    "id":"timer-text",
+    "attr":"text",
+    "value":"\"\""
+    },
+    {
+    "id":"key-inserted",
+    "attr":"visibility",
+    "value":"IF keyState=NoKeyInserted THEN \"visible\" ELSE \"hidden\" END"
+    },
+    {
+    "id":"key-on-position",
+    "attr":"visibility",
+    "value":"IF keyState=NoKeyInserted or engineOn=TRUE THEN \"hidden\" ELSE \"visible\" END"
+    },
+    {
+    "id":"key-on-text",
+    "attr":"fill",
+    "value":"IF keyState=NoKeyInserted or engineOn=TRUE THEN \"#f2f2f2\" ELSE \"#ccffcc\" END"
+    },
+    {
+    "id":"engine-start",
+    "attr":"visibility",
+    "value":"IF keyState=NoKeyInserted or engineOn=FALSE THEN \"hidden\" ELSE \"visible\" END"
+    },
+    {
+    "id":"A-right",
+    "attr":"fill",
+    "value":"IF right_blink:active_blinkers THEN IF blinkRight=lamp_off THEN \"#ffe6cc\" ELSE \"orange\" END ELSE \"white\" END"
+    },
+    {
+    "id":"A-right",
+    "attr":"stroke-opacity",
+    "value":"IF right_blink:active_blinkers THEN \"0.5\" ELSE \"1\" END"
+    },
+    
+    {
+    "id":"B-right",
+    "attr":"stroke-opacity",
+    "value":"IF right_blink:active_blinkers THEN \"0.5\" ELSE \"1\" END"
+    },
+    {
+    "id":"B-right",
+    "attr":"fill",
+    "value":"IF right_blink:active_blinkers THEN IF blinkRight=lamp_off THEN \"#ffe6cc\" ELSE \"orange\" END ELSE \"white\" END"
+    },
+    
+    {
+    "id":"C-right",
+    "attr":"fill",
+    "value":"IF right_blink:active_blinkers THEN IF blinkRight=lamp_off THEN \"#ffe6cc\" ELSE \"orange\" END ELSE \"white\" END"
+    },
+    {
+    "id":"C-right",
+    "attr":"stroke-opacity",
+    "value":"IF right_blink:active_blinkers THEN \"0.5\" ELSE \"1\" END"
+    },
+    
+    {
+    "id":"A-left",
+    "attr":"fill",
+    "value":"IF left_blink:active_blinkers THEN IF blinkLeft=lamp_off THEN \"#ffe6cc\" ELSE \"orange\" END ELSE \"white\" END"
+    },
+    {
+    "id":"A-left",
+    "attr":"stroke-opacity",
+    "value":"IF left_blink:active_blinkers THEN \"0.5\" ELSE \"1\" END"
+    },
+    
+    {
+    "id":"B-left",
+    "attr":"stroke-opacity",
+    "value":"IF left_blink:active_blinkers THEN \"0.5\" ELSE \"1\" END"
+    },
+    {
+    "id":"B-left",
+    "attr":"fill",
+    "value":"IF left_blink:active_blinkers THEN IF blinkLeft=lamp_off THEN \"#ffe6cc\" ELSE \"orange\" END ELSE \"white\" END"
+    },
+    
+    {
+    "id":"C-left",
+    "attr":"fill",
+    "value":"IF left_blink:active_blinkers THEN IF blinkLeft=lamp_off THEN \"#ffe6cc\" ELSE \"orange\" END ELSE \"white\" END"
+    },
+    {
+    "id":"C-left",
+    "attr":"stroke-opacity",
+    "value":"IF left_blink:active_blinkers THEN \"0.5\" ELSE \"1\" END"
+    },
+    
+    {
+    "id":"front-window",
+    "attr":"fill",
+    "value":"IF engineOn=TRUE THEN \"#f2f2f2\" ELSE \"white\" END"
+    },
+    {
+    "id":"back-window",
+    "attr":"fill",
+    "value":"IF engineOn=TRUE THEN \"#f2f2f2\" ELSE \"white\" END"
+    },
+    {
+    "id":"warningLight",
+    "attr":"fill-opacity",
+    "value":"IF hazardWarningSwitchOn=switch_on THEN \"0.7\" ELSE \"0.05\" END"
+    },
+    
+    {
+    "id":"PitmanNeutral",
+    "attr":"fill-opacity",
+    "value":"IF pitmanArmUpDown=Neutral THEN \"1\" ELSE \"0.2\" END"
+    },
+    {
+    "id":"PitmanUpward",
+    "attr":"fill-opacity",
+    "value":"IF pitmanArmUpDown=Upward7 THEN \"1\" ELSE IF pitmanArmUpDown=Upward5 THEN \"0.85\" ELSE \"0.2\" END END"
+    },
+    {
+    "id":"circle-PitmanUpward",
+    "attr":"stroke-opacity",
+    "value":"IF pitmanArmUpDown=Upward7 THEN \"1\" ELSE IF pitmanArmUpDown=Upward5 THEN \"0.6\" ELSE \"0.5\" END END"
+    },
+    {
+    "id":"circle-PitmanUpward",
+    "attr":"stroke-width",
+    "value":"IF pitmanArmUpDown=Upward7 THEN \"1\" ELSE IF pitmanArmUpDown=Upward5 THEN \"0.6\" ELSE \"0.565\" END END"
+    },
+    {
+    "id":"PitmanDownward",
+    "attr":"fill-opacity",
+    "value":"IF pitmanArmUpDown=Downward7 THEN \"1\" ELSE IF pitmanArmUpDown=Downward5 THEN \"0.85\" ELSE \"0.2\" END END"
+    },
+    {
+    "id":"circle-PitmanDownward",
+    "attr":"stroke-opacity",
+    "value":"IF pitmanArmUpDown=Downward7 THEN \"1\" ELSE IF pitmanArmUpDown=Downward5 THEN \"0.6\" ELSE \"0.5\" END END"
+    },
+    {
+    "id":"circle-PitmanDownward",
+    "attr":"stroke-width",
+    "value":"IF pitmanArmUpDown=Downward7 THEN \"1\" ELSE IF pitmanArmUpDown=Downward5 THEN \"0.6\" ELSE \"0.565\" END END"
+    },
+    
+    {
+    "id":"car_outline",
+    "attr":"stroke-opacity",
+    "value":"IF engineOn=TRUE THEN \"1.0\" ELSE \"0.5\" END"
+    }
+],
+  "events":[
+    {
+      "id":"warningLightOuter",
+      "event":"ENV_Hazard_blinking"
+    },
+    {
+      "id":"front-window",
+      "event":"ENV_Turn_EngineOn"
+    },
+    {
+      "id":"PitmanNeutral",
+      "event":"ENV_Pitman_Reset_to_Neutral"
+    },
+    {
+      "id":"PitmanUpward",
+      "event":"ENV_Pitman_DirectionBlinking",
+      "predicates":[
+        "newPos=Upward7"
+      ]
+    },
+    {
+      "id":"PitmanDownward",
+      "event":"ENV_Pitman_DirectionBlinking",
+      "predicates":[
+        "newPos=Downward7"
+      ]
+    },
+    {
+      "id":"engine-start",
+      "event":"ENV_Turn_EngineOff"
+    },
+    {
+      "id":"key-on-position",
+      "event":"ENV_Turn_EngineOn"
+    },
+    {
+      "id":"A-left",
+      "event":"RTIME_BlinkerOn"
+    },
+    {
+      "id":"B-left",
+      "event":"RTIME_BlinkerOn"
+    },
+    {
+      "id":"C-left",
+      "event":"RTIME_BlinkerOn"
+    },
+    {
+      "id":"C-right",
+      "event":"RTIME_BlinkerOff"
+    }
+    ]
+}
diff --git a/B2Program/LightModel/blinking_visb_v4_time.json b/B2Program/LightModel/blinking_visb_v4_time.json
new file mode 100644
index 0000000000000000000000000000000000000000..6e5d0c588208132cf56809141cd4c3a466b2e054
--- /dev/null
+++ b/B2Program/LightModel/blinking_visb_v4_time.json
@@ -0,0 +1,210 @@
+{
+  "svg":"LichtUebersicht_v4.svg",
+  "items":[
+    {
+    "id":"timer-text",
+    "attr":"text",
+    "value":"curTime"
+    },
+    {
+    "id":"key-inserted",
+    "attr":"visibility",
+    "value":"IF keyState=NoKeyInserted THEN \"visible\" ELSE \"hidden\" END"
+    },
+    {
+    "id":"key-on-position",
+    "attr":"visibility",
+    "value":"IF keyState=NoKeyInserted or engineOn=TRUE THEN \"hidden\" ELSE \"visible\" END"
+    },
+    {
+    "id":"key-on-text",
+    "attr":"fill",
+    "value":"IF keyState=NoKeyInserted or engineOn=TRUE THEN \"#f2f2f2\" ELSE \"#ccffcc\" END"
+    },
+    {
+    "id":"engine-start",
+    "attr":"visibility",
+    "value":"IF keyState=NoKeyInserted or engineOn=FALSE THEN \"hidden\" ELSE \"visible\" END"
+    },
+    {
+    "id":"engine-start-text",
+    "attr":"fill",
+    "value":"IF keyState=NoKeyInserted or engineOn=FALSE THEN \"#f2f2f2\" ELSE \"#ccffcc\" END"
+    },
+    {
+    "id":"A-right",
+    "attr":"fill",
+    "value":"IF right_blink:active_blinkers THEN IF blinkRight=lamp_off THEN \"#ffe6cc\" ELSE \"orange\" END ELSE \"white\" END"
+    },
+    {
+    "id":"A-right",
+    "attr":"stroke-opacity",
+    "value":"IF right_blink:active_blinkers THEN \"0.5\" ELSE \"1\" END"
+    },
+    
+    {
+    "id":"B-right",
+    "attr":"stroke-opacity",
+    "value":"IF right_blink:active_blinkers THEN \"0.5\" ELSE \"1\" END"
+    },
+    {
+    "id":"B-right",
+    "attr":"fill",
+    "value":"IF right_blink:active_blinkers THEN IF blinkRight=lamp_off THEN \"#ffe6cc\" ELSE \"orange\" END ELSE \"white\" END"
+    },
+    
+    {
+    "id":"C-right",
+    "attr":"fill",
+    "value":"IF right_blink:active_blinkers THEN IF blinkRight=lamp_off THEN \"#ffe6cc\" ELSE \"orange\" END ELSE \"white\" END"
+    },
+    {
+    "id":"C-right",
+    "attr":"stroke-opacity",
+    "value":"IF right_blink:active_blinkers THEN \"0.5\" ELSE \"1\" END"
+    },
+    
+    {
+    "id":"A-left",
+    "attr":"fill",
+    "value":"IF left_blink:active_blinkers THEN IF blinkLeft=lamp_off THEN \"#ffe6cc\" ELSE \"orange\" END ELSE \"white\" END"
+    },
+    {
+    "id":"A-left",
+    "attr":"stroke-opacity",
+    "value":"IF left_blink:active_blinkers THEN \"0.5\" ELSE \"1\" END"
+    },
+    
+    {
+    "id":"B-left",
+    "attr":"stroke-opacity",
+    "value":"IF left_blink:active_blinkers THEN \"0.5\" ELSE \"1\" END"
+    },
+    {
+    "id":"B-left",
+    "attr":"fill",
+    "value":"IF left_blink:active_blinkers THEN IF blinkLeft=lamp_off THEN \"#ffe6cc\" ELSE \"orange\" END ELSE \"white\" END"
+    },
+    
+    {
+    "id":"C-left",
+    "attr":"fill",
+    "value":"IF left_blink:active_blinkers THEN IF blinkLeft=lamp_off THEN \"#ffe6cc\" ELSE \"orange\" END ELSE \"white\" END"
+    },
+    {
+    "id":"C-left",
+    "attr":"stroke-opacity",
+    "value":"IF left_blink:active_blinkers THEN \"0.5\" ELSE \"1\" END"
+    },
+    
+    {
+    "id":"front-window",
+    "attr":"fill",
+    "value":"IF engineOn=TRUE THEN \"#f2f2f2\" ELSE \"white\" END"
+    },
+    {
+    "id":"back-window",
+    "attr":"fill",
+    "value":"IF engineOn=TRUE THEN \"#f2f2f2\" ELSE \"white\" END"
+    },
+    {
+    "id":"warningLight",
+    "attr":"fill-opacity",
+    "value":"IF hazardWarningSwitchOn=switch_on THEN \"0.7\" ELSE \"0.05\" END"
+    },
+    
+    {
+    "id":"PitmanNeutral",
+    "attr":"fill-opacity",
+    "value":"IF pitmanArmUpDown=Neutral THEN \"1\" ELSE \"0.2\" END"
+    },
+    {
+    "id":"PitmanUpward",
+    "attr":"fill-opacity",
+    "value":"IF pitmanArmUpDown=Upward7 THEN \"1\" ELSE IF pitmanArmUpDown=Upward5 THEN \"0.85\" ELSE \"0.2\" END END"
+    },
+    {
+    "id":"circle-PitmanUpward",
+    "attr":"stroke-opacity",
+    "value":"IF pitmanArmUpDown=Upward7 THEN \"1\" ELSE IF pitmanArmUpDown=Upward5 THEN \"0.6\" ELSE \"0.5\" END END"
+    },
+    {
+    "id":"circle-PitmanUpward",
+    "attr":"stroke-width",
+    "value":"IF pitmanArmUpDown=Upward7 THEN \"1\" ELSE IF pitmanArmUpDown=Upward5 THEN \"0.6\" ELSE \"0.565\" END END"
+    },
+    {
+    "id":"PitmanDownward",
+    "attr":"fill-opacity",
+    "value":"IF pitmanArmUpDown=Downward7 THEN \"1\" ELSE IF pitmanArmUpDown=Downward5 THEN \"0.85\" ELSE \"0.2\" END END"
+    },
+    {
+    "id":"circle-PitmanDownward",
+    "attr":"stroke-opacity",
+    "value":"IF pitmanArmUpDown=Downward7 THEN \"1\" ELSE IF pitmanArmUpDown=Downward5 THEN \"0.6\" ELSE \"0.5\" END END"
+    },
+    {
+    "id":"circle-PitmanDownward",
+    "attr":"stroke-width",
+    "value":"IF pitmanArmUpDown=Downward7 THEN \"1\" ELSE IF pitmanArmUpDown=Downward5 THEN \"0.6\" ELSE \"0.565\" END END"
+    },
+    
+    {
+    "id":"car_outline",
+    "attr":"stroke-opacity",
+    "value":"IF engineOn=TRUE THEN \"1.0\" ELSE \"0.5\" END"
+    }
+],
+  "events":[
+    {
+      "id":"warningLightOuter",
+      "event":"ENV_Hazard_blinking"
+    },
+    {
+      "id":"front-window",
+      "event":"ENV_Turn_EngineOn"
+    },
+    {
+      "id":"PitmanNeutral",
+      "event":"ENV_Pitman_Reset_to_Neutral"
+    },
+    {
+      "id":"PitmanUpward",
+      "event":"ENV_Pitman_DirectionBlinking",
+      "predicates":[
+        "newPos=Upward7"
+      ]
+    },
+    {
+      "id":"PitmanDownward",
+      "event":"ENV_Pitman_DirectionBlinking",
+      "predicates":[
+        "newPos=Downward7"
+      ]
+    },
+    {
+      "id":"engine-start",
+      "event":"ENV_Turn_EngineOff"
+    },
+    {
+      "id":"key-on-position",
+      "event":"ENV_Turn_EngineOn"
+    },
+    {
+      "id":"A-left",
+      "event":"RTIME_BlinkerOn"
+    },
+    {
+      "id":"B-left",
+      "event":"RTIME_BlinkerOn"
+    },
+    {
+      "id":"C-left",
+      "event":"RTIME_BlinkerOn"
+    },
+    {
+      "id":"C-right",
+      "event":"RTIME_BlinkerOff"
+    }
+    ]
+}
diff --git a/B2Program/LightModel/btypes/BBoolean.js b/B2Program/LightModel/btypes/BBoolean.js
new file mode 100755
index 0000000000000000000000000000000000000000..130448faa26383f85f2db7a048581e0778fdb1d5
--- /dev/null
+++ b/B2Program/LightModel/btypes/BBoolean.js
@@ -0,0 +1,49 @@
+export class BBoolean {
+    constructor(value) {
+        if (typeof (value) === 'boolean') {
+            this.value = value;
+        }
+        else if (typeof value === 'string') {
+            this.value = value.toLowerCase() === 'true';
+        }
+        else {
+            this.value = value.value;
+        }
+    }
+    and(other) {
+        return new BBoolean(this.value && other.value);
+    }
+    or(other) {
+        return new BBoolean(this.value || other.value);
+    }
+    not() {
+        return new BBoolean(!this.value);
+    }
+    implies(other) {
+        return this.not().or(other);
+    }
+    equivalent(other) {
+        return this.implies(other).and(other.implies(this));
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    equals(other) {
+        if (!(other instanceof BBoolean)) {
+            return false;
+        }
+        return this.equal(other).booleanValue();
+    }
+    unequal(other) {
+        return new BBoolean(this.value != other.value);
+    }
+    booleanValue() {
+        return this.value;
+    }
+    toString() {
+        return this.value.toString();
+    }
+    hashCode() {
+        return this.value ? 1 : 0;
+    }
+}
diff --git a/B2Program/LightModel/btypes/BInteger.js b/B2Program/LightModel/btypes/BInteger.js
new file mode 100755
index 0000000000000000000000000000000000000000..11c2723b5e4781ff02f7a59b101aebb174d65cbf
--- /dev/null
+++ b/B2Program/LightModel/btypes/BInteger.js
@@ -0,0 +1,108 @@
+import { BBoolean } from './BBoolean.js';
+export class BInteger {
+    constructor(value) {
+        this.value = value;
+    }
+    equals(obj) {
+        if (obj instanceof BInteger) {
+            return this.compareTo(obj) === 0;
+        }
+        return false;
+    }
+    static build(value) {
+        return new BInteger(value);
+    }
+    compareTo(o) {
+        return this.value - o.value;
+    }
+    lessEqual(o) {
+        return new BBoolean(this.compareTo(o) <= 0);
+    }
+    greaterEqual(o) {
+        return new BBoolean(this.compareTo(o) >= 0);
+    }
+    less(o) {
+        return new BBoolean(this.compareTo(o) < 0);
+    }
+    greater(o) {
+        return new BBoolean(this.compareTo(o) > 0);
+    }
+    equal(o) {
+        return new BBoolean(this.compareTo(o) === 0);
+    }
+    unequal(o) {
+        return new BBoolean(this.compareTo(o) != 0);
+    }
+    intValue() {
+        return this.value;
+    }
+    plus(o) {
+        return new BInteger(this.value + o.value);
+    }
+    toString() {
+        return this.value.toString();
+    }
+    minus(o) {
+        return new BInteger(this.value - o.value);
+    }
+    multiply(o) {
+        return new BInteger(this.value * o.value);
+    }
+    power(o) {
+        return new BInteger(this.value ^ o.value);
+    }
+    divide(o) {
+        return new BInteger(~~(this.value / o.value));
+    }
+    modulo(o) {
+        return new BInteger(this.value % o.value);
+    }
+    succ() {
+        return new BInteger(this.value + 1);
+    }
+    pred() {
+        return new BInteger(this.value - 1);
+    }
+    leftShift() {
+        return new BInteger(this.value << 1);
+    }
+    rightShift() {
+        return new BInteger(this.value >> 1);
+    }
+    isCase(o) {
+        return this.equals(o);
+    }
+    negative() {
+        return new BInteger(-this.value);
+    }
+    positive() {
+        return this;
+    }
+    getValue() {
+        return this.value;
+    }
+    isInteger() {
+        return new BBoolean(true);
+    }
+    isNotInteger() {
+        return new BBoolean(false);
+    }
+    isNatural() {
+        return this.greaterEqual(new BInteger(0));
+    }
+    isNotNatural() {
+        return this.isNatural().not();
+    }
+    isNatural1() {
+        return this.greater(new BInteger(0));
+    }
+    isNotNatural1() {
+        return this.isNatural1().not();
+    }
+    hashCode() {
+        const prime = 31;
+        let result = 1;
+        result = prime * result + this.value;
+        return result;
+    }
+}
diff --git a/B2Program/LightModel/btypes/BObject.js b/B2Program/LightModel/btypes/BObject.js
new file mode 100755
index 0000000000000000000000000000000000000000..51b475ea3aeca5d23cebf2760f968f115e965477
--- /dev/null
+++ b/B2Program/LightModel/btypes/BObject.js
@@ -0,0 +1,8 @@
+export class BObject {
+    equals(other) {
+        return false;
+    }
+    hashCode() {
+        return 0;
+    }
+}
diff --git a/B2Program/LightModel/btypes/BRelation.js b/B2Program/LightModel/btypes/BRelation.js
new file mode 100755
index 0000000000000000000000000000000000000000..361218789a087230718b877c9cb7ef474771c1bb
--- /dev/null
+++ b/B2Program/LightModel/btypes/BRelation.js
@@ -0,0 +1,791 @@
+import { BTuple } from "./BTuple.js";
+import { BSet } from "./BSet.js";
+import { BInteger } from "./BInteger.js";
+import { BBoolean } from "./BBoolean.js";
+import { BString } from "./BString.js";
+import { BStruct } from "./BStruct.js";
+import * as immutable from "../immutable/dist/immutable.es.js";
+export class BRelation {
+    constructor(...args) {
+        if (args.length === 0) {
+            this.map = immutable.Map();
+        }
+        else if (args.length == 1 && args[0] instanceof immutable.Map) {
+            this.map = args[0];
+        }
+        else {
+            this.map = immutable.Map();
+            for (let e of args) {
+                let key = e.projection1();
+                let value = e.projection2();
+                let set = this.map.get(key);
+                if (set == null) {
+                    set = immutable.Set();
+                }
+                set = set.add(value);
+                this.map = this.map.set(key, set);
+            }
+        }
+    }
+    static fromSet(set) {
+        let resultMap = immutable.Map();
+        set.getSet().forEach((e) => {
+            let key = e.projection1();
+            let value = e.projection2();
+            let range = resultMap.get(key);
+            if (range == null) {
+                range = immutable.Set([value]);
+                resultMap = resultMap.set(key, range);
+            }
+            else {
+                range = range.add(value);
+                resultMap = resultMap.set(key, range);
+            }
+        });
+        return new BRelation(resultMap);
+    }
+    equals(o) {
+        if (o == null || !(o instanceof BRelation))
+            return false;
+        return this.map.equals(o.map);
+    }
+    intersect(relation) {
+        let otherMap = relation.map;
+        let otherDomain = immutable.Set(otherMap.keys());
+        let thisDomain = immutable.Set(this.map.keys());
+        let intersectionDomain = thisDomain.intersect(otherDomain);
+        let differenceDomain = thisDomain.subtract(otherDomain);
+        let resultMap = this.map;
+        intersectionDomain.forEach((domainElement) => {
+            let thisRangeSet = this.map.get(domainElement);
+            let otherRangeSet = otherMap.get(domainElement);
+            resultMap = resultMap.set(domainElement, thisRangeSet.intersect(otherRangeSet));
+        });
+        differenceDomain.forEach((domainElement) => {
+            resultMap = resultMap.set(domainElement, immutable.Set());
+        });
+        return new BRelation(resultMap);
+    }
+    difference(relation) {
+        let otherMap = relation.map;
+        let otherDomain = otherMap.keys();
+        let thisDomain = immutable.Set(this.map.keys());
+        let differenceDomain = thisDomain.subtract(otherDomain);
+        let restDomain = thisDomain.subtract(differenceDomain);
+        let resultMap = this.map;
+        differenceDomain.forEach((domainElement) => {
+            let thisRangeSet = this.map.get(domainElement);
+            let otherRangeSet = otherMap.get(domainElement);
+            resultMap = resultMap.set(domainElement, thisRangeSet.subtract(otherRangeSet));
+        });
+        restDomain.forEach((domainElement) => {
+            resultMap = resultMap.set(domainElement, immutable.Set());
+        });
+        return new BRelation(resultMap);
+    }
+    union(relation) {
+        let otherMap = relation.map;
+        let otherDomain = immutable.Set(otherMap.keys());
+        let resultMap = this.map;
+        for (let domainElement of otherDomain) {
+            let thisRangeSet = this.map.get(domainElement);
+            let otherRangeSet = otherMap.get(domainElement);
+            resultMap = resultMap.set(domainElement, thisRangeSet == null ? otherRangeSet : otherRangeSet == null ? otherRangeSet : thisRangeSet.union(otherRangeSet));
+        }
+        return new BRelation(resultMap);
+    }
+    size() {
+        let size = 0;
+        let thisDomain = immutable.Set(this.map.keys());
+        for (let domainElement of thisDomain) {
+            let thisRangeSet = this.map.get(domainElement);
+            if (thisRangeSet == null) {
+                continue;
+            }
+            size += thisRangeSet.size;
+        }
+        return size;
+    }
+    card() {
+        return new BInteger(this.size());
+    }
+    equal(o) {
+        return new BBoolean(this.equals(o));
+    }
+    unequal(o) {
+        return new BBoolean(!this.equals(o));
+    }
+    elementOf(object) {
+        let prj1 = object.projection1();
+        let prj2 = object.projection2();
+        if (!this.map.has(prj1)) {
+            return new BBoolean(false);
+        }
+        let range = this.map.get(prj1);
+        return new BBoolean(range.has(prj2));
+    }
+    notElementOf(object) {
+        let prj1 = object.projection1();
+        let prj2 = object.projection2();
+        if (!this.map.has(prj1)) {
+            return new BBoolean(true);
+        }
+        let range = this.map.get(prj1);
+        return new BBoolean(!range.has(prj2));
+    }
+    relationImage(domain) {
+        let resultSet = immutable.Set();
+        for (let this_domain_elem of this.map.keys()) {
+            for (let other_domain_elem of domain.set) {
+                if (other_domain_elem.equals(this_domain_elem)) {
+                    let thisRangeSet = this.map.get(this_domain_elem);
+                    if (thisRangeSet != null) {
+                        resultSet = BSet.immutableSetUnion(resultSet, thisRangeSet);
+                    }
+                }
+            }
+        }
+        return new BSet(resultSet);
+    }
+    functionCall(arg) {
+        let range = this.map.get(arg);
+        if (range == null) {
+            throw new Error("Argument is not in the domain of this relation");
+        }
+        for (let element of range) {
+            return element;
+        }
+        throw new Error("Argument is not in the domain of this relation");
+    }
+    pow() {
+        let thisMap = this.map;
+        let thisDomain = immutable.Set(thisMap.keys());
+        let result = new BSet();
+        let start = new BRelation();
+        let queue = [];
+        queue.push(start);
+        result = result.union(new BSet(start));
+        while (queue.length !== 0) {
+            let currentSet = queue.pop();
+            for (let domainElement of thisDomain) {
+                let range = thisMap.get(domainElement);
+                range.forEach((rangeElement) => {
+                    let nextRelation = currentSet.union(BRelation.fromSet(new BSet(new BTuple(domainElement, rangeElement))));
+                    let previousSize = result.size().intValue();
+                    result = result.union(new BSet(nextRelation));
+                    if (previousSize < result.size().intValue()) {
+                        queue.push(nextRelation);
+                    }
+                });
+            }
+        }
+        return result;
+    }
+    pow1() {
+        return this.pow().difference(new BSet(new BRelation()));
+    }
+    fin() {
+        return this.pow();
+    }
+    fin1() {
+        return this.pow1();
+    }
+    domain() {
+        let resultSet = immutable.Set(this.map.keys());
+        for (let domainElement of this.map.keys()) {
+            let range = this.map.get(domainElement);
+            if (range.size === 0) {
+                resultSet = resultSet.remove(domainElement);
+            }
+        }
+        return new BSet(resultSet);
+    }
+    range() {
+        let set = immutable.Set.union(this.map.values());
+        return new BSet(set);
+    }
+    inverse() {
+        let thisMap = this.map;
+        let keys = immutable.Set(thisMap.keys());
+        let resultMap = immutable.Map();
+        for (let domainElement of keys) {
+            let range = this.map.get(domainElement);
+            range.forEach((rangeElement) => {
+                let currentRange = resultMap.get(rangeElement);
+                if (currentRange == null) {
+                    currentRange = immutable.Set();
+                }
+                currentRange = currentRange.union(immutable.Set([domainElement]));
+                resultMap = resultMap.set(rangeElement, currentRange);
+            });
+        }
+        return new BRelation(resultMap);
+    }
+    domainRestriction(arg) {
+        let resultMap = this.map;
+        outer_loop: for (let obj of resultMap.keys()) {
+            for (let obj2 of arg.set) {
+                if (obj2.equals(obj)) {
+                    continue outer_loop;
+                }
+            }
+            resultMap = resultMap.delete(obj);
+        }
+        return new BRelation(resultMap);
+    }
+    domainSubstraction(arg) {
+        let resultMap = this.map;
+        for (let obj of resultMap.keys()) {
+            for (let obj2 of arg.set) {
+                if (obj2.equals(obj)) {
+                    resultMap = resultMap.delete(obj);
+                    break;
+                }
+            }
+        }
+        return new BRelation(resultMap);
+    }
+    rangeRestriction(arg) {
+        let otherSet = arg.getSet();
+        let thisDomain = immutable.Set(this.map.keys());
+        let resultMap = this.map;
+        for (let domainElement of thisDomain) {
+            let thisRangeSet = this.map.get(domainElement);
+            resultMap = resultMap.set(domainElement, BSet.immutableSetIntersection(thisRangeSet, otherSet));
+        }
+        return new BRelation(resultMap);
+    }
+    rangeSubstraction(arg) {
+        let otherSet = arg.getSet();
+        let thisDomain = immutable.Set(this.map.keys());
+        let resultMap = this.map;
+        for (let domainElement of thisDomain) {
+            let thisRangeSet = this.map.get(domainElement);
+            resultMap = resultMap.set(domainElement, BSet.immutableSetDifference(thisRangeSet, otherSet));
+        }
+        return new BRelation(resultMap);
+    }
+    override(arg) {
+        let otherMap = arg.map;
+        let otherDomain = immutable.Set(otherMap.keys());
+        let resultMap = this.map;
+        outer_loop: for (let domainElement of otherDomain) {
+            for (let thisDomainElement of resultMap.keys()) {
+                if (thisDomainElement.equals(domainElement)) {
+                    let range = otherMap.get(domainElement);
+                    resultMap = resultMap.set(thisDomainElement, range);
+                    continue outer_loop;
+                }
+            }
+            resultMap = resultMap.set(domainElement, otherMap.get(domainElement));
+        }
+        return new BRelation(resultMap);
+    }
+    first() {
+        return this.functionCall(new BInteger(1));
+    }
+    last() {
+        return this.functionCall(this.card());
+    }
+    reverse() {
+        let size = this.card();
+        let resultMap = immutable.Map();
+        for (let i = new BInteger(1); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            let rangeElement = this.functionCall(size.minus(i).succ());
+            resultMap = resultMap.set(i, immutable.Set([rangeElement]));
+        }
+        return new BRelation(resultMap);
+    }
+    front() {
+        return this.domainSubstraction(new BSet(this.card()));
+    }
+    tail() {
+        let size = this.card();
+        let resultMap = immutable.Map();
+        for (let i = new BInteger(2); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            let rangeElement = this.functionCall(i);
+            resultMap = resultMap.set(i.pred(), immutable.Set([rangeElement]));
+        }
+        return new BRelation(resultMap);
+    }
+    take(n) {
+        let size = this.card();
+        if (n.greaterEqual(size).booleanValue()) {
+            return new BRelation(this.map);
+        }
+        let resultMap = this.map;
+        //Remove sets with index greater than n
+        for (let i = n.succ(); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            for (let index of resultMap.keys()) {
+                if (index.equals(i)) {
+                    resultMap = resultMap.delete(index);
+                    break;
+                }
+            }
+        }
+        return new BRelation(resultMap);
+    }
+    drop(n) {
+        let size = this.card();
+        let thisMap = this.map;
+        let resultMap = immutable.Map();
+        for (let i = n.succ(); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            let currentSet = thisMap.get(i);
+            resultMap = resultMap.set(i.minus(n), currentSet);
+        }
+        return new BRelation(resultMap);
+    }
+    concat(arg) {
+        let resultMap = this.map;
+        let otherMap = arg.map;
+        let size = this.card();
+        for (let i = new BInteger(1); i.lessEqual(arg.card()).booleanValue(); i = i.succ()) {
+            resultMap = resultMap.set(size.plus(i), otherMap.get(i));
+        }
+        return new BRelation(resultMap);
+    }
+    conc() {
+        let result = new BRelation();
+        let size = this.card();
+        for (let i = new BInteger(1); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            result = result.concat(this.functionCall(i));
+        }
+        return result;
+    }
+    append(arg) {
+        let resultMap = this.map;
+        resultMap = resultMap.set(this.card().succ(), immutable.Set([arg]));
+        return new BRelation(resultMap);
+    }
+    prepend(arg) {
+        let resultMap = immutable.Map();
+        let thisMap = this.map;
+        let size = this.card();
+        for (let i = new BInteger(1); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            resultMap = resultMap.set(i.succ(), thisMap.get(i));
+        }
+        resultMap = resultMap.set(new BInteger(1), immutable.Set([arg]));
+        return new BRelation(resultMap);
+    }
+    directProduct(arg) {
+        let thisMap = this.map;
+        let thisDomain = immutable.Set(thisMap.keys());
+        let otherMap = arg.map;
+        let resultMap = immutable.Map();
+        for (let domainElement of thisDomain) {
+            let thisRange = this.map.get(domainElement);
+            let otherRange = otherMap.get(domainElement);
+            if (otherRange == undefined) {
+                continue;
+            }
+            let resultRange = immutable.Set();
+            thisRange.forEach((lhs) => {
+                otherRange.forEach((rhs) => {
+                    resultRange = immutable.Set.union([resultRange, immutable.Set([new BTuple(lhs, rhs)])]);
+                });
+            });
+            resultMap = resultMap.set(domainElement, resultRange);
+        }
+        return new BRelation(resultMap);
+    }
+    parallelProduct(arg) {
+        let thisMap = this.map;
+        let thisDomain = immutable.Set(thisMap.keys());
+        let otherMap = arg.map;
+        let otherDomain = immutable.Set(otherMap.keys());
+        let resultMap = immutable.Map();
+        for (let domainElementThis of thisDomain) {
+            for (let domainElementOther of otherDomain) {
+                let thisRange = thisMap.get(domainElementThis);
+                let otherRange = otherMap.get(domainElementOther);
+                let resultRange = immutable.Set();
+                thisRange.forEach((lhs) => {
+                    otherRange.forEach((rhs) => {
+                        resultRange = resultRange.union(immutable.Set([new BTuple(lhs, rhs)]));
+                    });
+                });
+                let tuple = new BTuple(domainElementThis, domainElementOther);
+                resultMap = resultMap.set(tuple, resultRange);
+            }
+        }
+        return new BRelation(resultMap);
+    }
+    composition(arg) {
+        let otherMap = arg.map;
+        let resultMap = immutable.Map();
+        for (let domainElement of this.map.keys()) {
+            let range = this.map.get(domainElement);
+            let set = immutable.Set();
+            range.forEach((rangeElement) => {
+                let union_element = otherMap.get(rangeElement);
+                if (union_element == null) {
+                    return;
+                }
+                set = set.union(union_element);
+            });
+            resultMap = resultMap.set(domainElement, set);
+        }
+        return new BRelation(resultMap);
+    }
+    iterate(n) {
+        let thisRelation = this;
+        let result = BRelation.identity(this.domain().union(this.range()));
+        for (let i = new BInteger(1); i.lessEqual(n).booleanValue(); i = i.succ()) {
+            result = result.composition(thisRelation);
+        }
+        return result;
+    }
+    closure() {
+        let thisRelation = this;
+        let result = BRelation.identity(this.domain().union(this.range()));
+        let nextResult = result.composition(thisRelation);
+        let lastResult = result;
+        do {
+            lastResult = result;
+            result = result.union(nextResult);
+            nextResult = result.composition(thisRelation);
+        } while (!result.equal(lastResult).booleanValue());
+        return result;
+    }
+    closure1() {
+        let thisRelation = this;
+        let result = this;
+        let nextResult = result.composition(thisRelation);
+        let lastResult = null;
+        do {
+            lastResult = result;
+            result = result.union(nextResult);
+            nextResult = result.composition(thisRelation);
+        } while (!result.equal(lastResult).booleanValue());
+        return result;
+    }
+    static projection1(arg1, arg2) {
+        let argSet1 = arg1.getSet();
+        let argSet2 = arg2.getSet();
+        let resultMap = immutable.Map();
+        argSet1.forEach((e1) => {
+            argSet2.forEach((e2) => {
+                let tuple = new BTuple(e1, e2);
+                resultMap = resultMap.set(tuple, immutable.Set([e1]));
+            });
+        });
+        return new BRelation(resultMap);
+    }
+    static projection2(arg1, arg2) {
+        let argSet1 = arg1.getSet();
+        let argSet2 = arg2.getSet();
+        let resultMap = immutable.Map();
+        argSet1.forEach((e1) => {
+            argSet2.forEach((e2) => {
+                let tuple = new BTuple(e1, e2);
+                resultMap = resultMap.set(tuple, immutable.Set([e2]));
+            });
+        });
+        return new BRelation(resultMap);
+    }
+    fnc() {
+        let thisMap = this.map;
+        let domain = this.domain().getSet();
+        let resultMap = immutable.Map();
+        domain.forEach((domainElement) => {
+            let range = thisMap.get(domainElement);
+            let rangeSet = new BSet([range]);
+            resultMap = resultMap.set(domainElement, immutable.Set([rangeSet]));
+        });
+        return new BRelation(resultMap);
+    }
+    rel() {
+        let domain = this.domain().getSet();
+        let resultMap = immutable.Map();
+        domain.forEach((domainElement) => {
+            let range = this.functionCall(domainElement);
+            let rangeSet = range.getSet();
+            resultMap = resultMap.set(domainElement, rangeSet);
+        });
+        return new BRelation(resultMap);
+    }
+    static identity(arg) {
+        let resultMap = immutable.Map();
+        arg.getSet().forEach((e) => {
+            resultMap = resultMap.set(e, immutable.Set([e]));
+        });
+        return new BRelation(resultMap);
+    }
+    static cartesianProduct(arg1, arg2) {
+        let resultMap = immutable.Map();
+        arg1.getSet().forEach((e1) => {
+            resultMap = resultMap.set(e1, arg2.getSet());
+        });
+        return new BRelation(resultMap);
+    }
+    nondeterminism() {
+        let domain = immutable.Set(this.map.keys());
+        let index = Math.floor(Math.random() * domain.size);
+        let i = 0;
+        let domainElement = undefined;
+        for (let obj of domain) {
+            if (i == index) {
+                domainElement = obj;
+                break;
+            }
+            i++;
+        }
+        if (domainElement == undefined) {
+            return null;
+        }
+        let range = this.map.get(domainElement);
+        if (range != null) {
+            index = Math.floor(Math.random() * range.size);
+            i = 0;
+            for (let obj of range) {
+                if (i == index) {
+                    return new BTuple(domainElement, obj);
+                }
+                i++;
+            }
+        }
+        return null;
+    }
+    isTotal(domain) {
+        return new BBoolean(this.domain().equal(domain));
+    }
+    isTotalInteger() {
+        return new BBoolean(false);
+    }
+    isTotalNatural() {
+        return new BBoolean(false);
+    }
+    isTotalNatural1() {
+        return new BBoolean(false);
+    }
+    isTotalString() {
+        return new BBoolean(false);
+    }
+    isTotalStruct() {
+        return new BBoolean(false);
+    }
+    isPartial(domain) {
+        return this.domain().strictSubset(domain);
+    }
+    isPartialInteger() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger) {
+                return new BBoolean(true);
+            }
+            else {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isPartialNatural() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isPartialNatural1() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural1().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isPartialString() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BString && !e.isString().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isPartialStruct() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BStruct && !e.isRecord().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomain(domain) {
+        return this.domain().subset(domain);
+    }
+    checkDomainInteger() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger) {
+                return new BBoolean(true);
+            }
+            else {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomainNatural() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomainNatural1() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural1().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomainString() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BString && !e.isString().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomainStruct() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BStruct && !e.isRecord().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRange(range) {
+        return this.range().subset(range);
+    }
+    checkRangeInteger() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BInteger) {
+                return new BBoolean(true);
+            }
+            else {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRangeNatural() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRangeNatural1() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural1().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRangeString() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BString && !e.isString().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRangeStruct() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BStruct && !e.isRecord().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isRelation() {
+        return new BBoolean(true);
+    }
+    isFunction() {
+        this.domain().getSet().forEach((element) => {
+            let range = this.map.get(element);
+            if (range.size > 1) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isSurjection(range) {
+        return new BBoolean(this.range().equal(range));
+    }
+    isSurjectionInteger() {
+        return new BBoolean(false);
+    }
+    isSurjectionNatural() {
+        return new BBoolean(false);
+    }
+    isSurjectionNatural1() {
+        return new BBoolean(false);
+    }
+    isSurjectionString() {
+        return new BBoolean(false);
+    }
+    isSurjectionStruct() {
+        return new BBoolean(false);
+    }
+    isInjection() {
+        let visited = immutable.Set();
+        this.domain().getSet().forEach((element) => {
+            let range = this.map.get(element);
+            range.forEach((rangeElement) => {
+                if (visited.contains(rangeElement)) {
+                    return new BBoolean(false);
+                }
+                visited = visited.union(immutable.Set([rangeElement]));
+            });
+        });
+        return new BBoolean(true);
+    }
+    isBijection(range) {
+        return this.isSurjection(range).and(this.isInjection());
+    }
+    isBijectionInteger() {
+        return new BBoolean(false);
+    }
+    isBijectionNatural() {
+        return new BBoolean(false);
+    }
+    isBijectionNatural1() {
+        return new BBoolean(false);
+    }
+    isBijectionString() {
+        return new BBoolean(false);
+    }
+    isBijectionStruct() {
+        return new BBoolean(false);
+    }
+    toString() {
+        let size = this.size();
+        let i = 0;
+        let sb = "";
+        sb = sb + "{";
+        for (let domainElement of this.map.keys()) {
+            let range = this.map.get(domainElement);
+            range.forEach((rangeElement) => {
+                sb += "(";
+                sb += domainElement.toString();
+                sb += " |-> ";
+                sb += rangeElement.toString();
+                sb += ")";
+                if (i + 1 < size) {
+                    sb += ", ";
+                }
+                i++;
+            });
+        }
+        sb += "}";
+        return sb.toString();
+    }
+    hashCode() {
+        return this.map.hashCode();
+    }
+}
diff --git a/B2Program/LightModel/btypes/BSet.js b/B2Program/LightModel/btypes/BSet.js
new file mode 100755
index 0000000000000000000000000000000000000000..3cd16d85d4636b667b9741b6fbb3816b02d71da6
--- /dev/null
+++ b/B2Program/LightModel/btypes/BSet.js
@@ -0,0 +1,359 @@
+import { BBoolean } from "./BBoolean.js";
+import { BInteger } from "./BInteger.js";
+import { BRelation } from "./BRelation.js";
+import { BString } from "./BString.js";
+import { BStruct } from "./BStruct.js";
+import * as immutable from "../immutable/dist/immutable.es.js";
+export class BSet {
+    constructor(...args) {
+        if (args.length == 1 && args[0] instanceof immutable.Set) {
+            this.set = args[0];
+        }
+        else {
+            this.set = immutable.Set();
+            for (let x of args) {
+                this.set = this.set.add(x);
+            }
+        }
+    }
+    /* Make this class iterable */
+    [Symbol.iterator]() {
+        return this.set[Symbol.iterator]();
+    }
+    toString() {
+        let sb = "{";
+        this.set.forEach(element => {
+            if (sb.length > 1) {
+                sb += ", ";
+            }
+            sb += element.toString();
+        });
+        sb += "}";
+        return sb;
+    }
+    union(other = null) {
+        if (other == null) {
+            if (this.set.size === 0) {
+                return new BSet();
+            }
+            else if (this.set.values().next().value instanceof BSet) {
+                let result = immutable.Set();
+                for (let current_set of this.set) {
+                    result = BSet.immutableSetUnion(result, current_set.set);
+                }
+                return new BSet(result);
+            }
+            else if (this.set.values().next().value instanceof BRelation) {
+                let result = immutable.Map();
+                for (let current_set of this.set) {
+                    result = BSet.immutableMapUnion(result, current_set.map);
+                }
+                return new BRelation(result);
+            }
+            else {
+                throw new Error("Generalized Union is only possible on immutable.Sets of immutable.Sets or Relations");
+            }
+        }
+        let result = BSet.immutableSetUnion(this.set, other.set);
+        return new BSet(result);
+    }
+    static immutableSetUnion(s1, s2) {
+        return s1.union(s2);
+    }
+    static immutableSetDifference(s1, s2) {
+        return s1.subtract(s2);
+    }
+    static immutableSetIntersection(s1, s2) {
+        return s1.intersect(s2);
+    }
+    static immutableMapUnion(m1, m2) {
+        let result = m2;
+        outer_loop: for (let current_element of m1.keys()) {
+            for (let result_element of result.keys()) {
+                if (current_element.equals(result_element)) {
+                    let result_set = result.get(result_element);
+                    let current_set = m1.get(current_element);
+                    result = result.set(result_element, BSet.immutableSetUnion(result_set != null ? result_set : immutable.Set(), current_set != null ? current_set : immutable.Set()));
+                    continue outer_loop;
+                }
+            }
+            result = result.set(current_element, m1.get(current_element));
+        }
+        return result;
+    }
+    static immutableMapIntersection(m1, m2) {
+        let result = immutable.Map();
+        elem_loop: for (let result_element of m2.keys()) {
+            for (let current_element of m1.keys()) {
+                if (current_element.equals(result_element)) {
+                    let result_set = m2.get(result_element);
+                    let current_set = m1.get(current_element);
+                    result = result.set(result_element, BSet.immutableSetIntersection(result_set != null ? result_set : immutable.Set(), current_set != null ? current_set : immutable.Set()));
+                    continue elem_loop;
+                }
+            }
+            result.delete(result_element);
+        }
+        return result;
+    }
+    intersect(other = null) {
+        if (other == null) {
+            if (this.set.size === 0) {
+                return new BSet();
+            }
+            else if (this.set.values().next().value instanceof BSet) {
+                let result = this.set.values().next().value.set;
+                for (let current_set of this.set) {
+                    result = BSet.immutableSetDifference(result, BSet.immutableSetDifference(result, current_set.set));
+                }
+                return new BSet(result);
+            }
+            else if (this.set.values().next().value instanceof BRelation) {
+                let result = this.set.values().next().value.map;
+                for (let current_set of this.set) {
+                    result = BSet.immutableMapIntersection(result, current_set.map);
+                }
+                return new BRelation(result);
+            }
+            else {
+                throw new Error("Generalized Intersection is only possible on immutable.Sets of immutable.Sets or Relations");
+            }
+        }
+        let new_set = BSet.immutableSetDifference(this.set, BSet.immutableSetDifference(this.set, other.set));
+        return new BSet(new_set);
+    }
+    difference(other) {
+        let set = BSet.immutableSetDifference(this.set, other.set);
+        return new BSet(set);
+    }
+    card() {
+        return new BInteger(this.set.size);
+    }
+    size() {
+        return new BInteger(this.set.size);
+    }
+    elementOf(obj) {
+        return new BBoolean(this.set.has(obj));
+    }
+    notElementOf(obj) {
+        return new BBoolean(!this.set.has(obj));
+    }
+    subset(other) {
+        this_set_loop: for (let elem of this.set) {
+            for (let other_elem of other.set) {
+                if (other_elem.equals(elem)) {
+                    continue this_set_loop;
+                }
+            }
+            return new BBoolean(false);
+        }
+        return new BBoolean(true);
+    }
+    notSubset(other) {
+        this_set_loop: for (let elem of this.set) {
+            for (let other_elem of other.set) {
+                if (other_elem.equals(elem)) {
+                    continue this_set_loop;
+                }
+            }
+            return new BBoolean(true);
+        }
+        return new BBoolean(false);
+    }
+    strictSubset(other) {
+        return this.size().less(other.size()).and(this.subset(other));
+    }
+    strictNotSubset(other) {
+        return this.size().equal(other.size()).and(this.notSubset(other));
+    }
+    contains(other) {
+        return other.toString() in this.set;
+    }
+    containsAll(other) {
+        for (let o of other.set) {
+            if (!(o in this.set)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    isEmpty() {
+        return this.set.size === 0;
+    }
+    equals(other) {
+        return this.equal(other).booleanValue();
+    }
+    equal(other) {
+        if (!(other instanceof BSet)) {
+            return new BBoolean(false);
+        }
+        return this.subset(other).and(other.subset(this));
+    }
+    unequal(other) {
+        return this.equal(other).not();
+    }
+    nondeterminism() {
+        let values = [];
+        for (let item of this.set) {
+            values.push(item);
+        }
+        return values[Math.floor(Math.random() * values.length)];
+    }
+    min() {
+        return this.set.reduce((a, v) => { if (a < v) {
+            return a;
+        } return v; });
+    }
+    max() {
+        return this.set.reduce((a, v) => { if (a > v) {
+            return a;
+        } return v; });
+    }
+    pow() {
+        let result = new BSet();
+        let start = new BSet();
+        let queue = [start];
+        result = result.union(new BSet(start));
+        while (queue.length != 0) {
+            let currentSet = queue.pop();
+            for (let element of this.set) {
+                let nextSet = currentSet.union(new BSet(element));
+                let previousSize = result.size();
+                result = result.union(new BSet(nextSet));
+                if (previousSize < result.size()) {
+                    queue.push(nextSet);
+                }
+            }
+        }
+        return result;
+    }
+    pow1() {
+        return this.pow().difference(new BSet(new BSet()));
+    }
+    // Only finite subsets are supported so fin = pow
+    fin() {
+        return this.pow();
+    }
+    fin1() {
+        return this.pow1();
+    }
+    subsetOfInteger() {
+        for (let element of this.set) {
+            if (element instanceof BInteger) {
+                return false;
+            }
+        }
+        return true;
+    }
+    strictSubsetOfInteger() {
+        return this.subsetOfInteger();
+    }
+    notSubsetOfInteger() {
+        return !this.subsetOfInteger();
+    }
+    notStrictSubsetOfInteger() {
+        return !this.strictSubsetOfInteger();
+    }
+    subsetOfNatural() {
+        for (let element of this.set) {
+            if (!(element instanceof BInteger && element.isNatural().booleanValue())) {
+                return false;
+            }
+        }
+        return true;
+    }
+    strictSubsetOfNatural() {
+        return this.subsetOfNatural();
+    }
+    notSubsetOfNatural() {
+        return !this.subsetOfNatural();
+    }
+    notStrictSubsetOfNatural() {
+        return !this.strictSubsetOfNatural();
+    }
+    subsetOfNatural1() {
+        for (let element of this.set) {
+            if (!(element instanceof BInteger && element.isNatural1().booleanValue())) {
+                return false;
+            }
+        }
+        return true;
+    }
+    subsetOfString() {
+        for (let element of this.set) {
+            if (!(element instanceof BString)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    strictSubsetOfString() {
+        return this.subsetOfString();
+    }
+    notSubsetOfString() {
+        return !this.subsetOfString();
+    }
+    notStrictSubsetOfString() {
+        return !this.strictSubsetOfString();
+    }
+    subsetOfStruct() {
+        for (let element of this.set) {
+            if (!(element instanceof BStruct)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    strictSubsetOfStruct() {
+        return this.subsetOfStruct();
+    }
+    notSubsetOfStruct() {
+        return !this.subsetOfStruct();
+    }
+    notStrictSubsetOfStruct() {
+        return !this.strictSubsetOfStruct();
+    }
+    equalInteger() {
+        return new BBoolean(false);
+    }
+    unequalInteger() {
+        return new BBoolean(true);
+    }
+    equalNatural() {
+        return new BBoolean(false);
+    }
+    unequalNatural() {
+        return new BBoolean(true);
+    }
+    equalNatural1() {
+        return new BBoolean(false);
+    }
+    unequalNatural1() {
+        return new BBoolean(true);
+    }
+    equalString() {
+        return new BBoolean(false);
+    }
+    unequalString() {
+        return new BBoolean(true);
+    }
+    equalStruct() {
+        return new BBoolean(false);
+    }
+    unequalStruct() {
+        return new BBoolean(true);
+    }
+    getSet() {
+        return this.set;
+    }
+    static interval(a, b) {
+        if (b.less(a).booleanValue()) {
+            return new BSet();
+        }
+        const range = [...Array(b.minus(a).intValue() + 1).keys()].map(e => new BInteger(e).plus(a));
+        return new BSet(immutable.Set(range));
+    }
+    hashCode() {
+        return this.set.hashCode();
+    }
+}
diff --git a/B2Program/LightModel/btypes/BString.js b/B2Program/LightModel/btypes/BString.js
new file mode 100755
index 0000000000000000000000000000000000000000..ff8e795b9a5997e3dad032029e78fb40dba7f7a1
--- /dev/null
+++ b/B2Program/LightModel/btypes/BString.js
@@ -0,0 +1,46 @@
+import { BBoolean } from "./BBoolean.js";
+export class BString {
+    constructor(value) {
+        this.value = value;
+    }
+    getValue() {
+        return this.value;
+    }
+    equals(o) {
+        if (o == null || o instanceof BString) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    length() {
+        return this.value.length;
+    }
+    isEmpty() {
+        return this.value === "";
+    }
+    toString() {
+        return '"' + this.value + '"';
+    }
+    isCase(o) {
+        return this.value == o;
+    }
+    isString() {
+        return new BBoolean(true);
+    }
+    isNotString() {
+        return new BBoolean(false);
+    }
+    hashCode() {
+        let hash = 0;
+        if (this.value.length === 0) {
+            return hash;
+        }
+        for (let i = 0; i < this.value.length; i++) {
+            let chr = this.value.charCodeAt(i);
+            hash = ((hash << 5) - hash) + chr;
+            hash |= 0; // Convert to 32bit integer
+        }
+        return hash;
+    }
+    ;
+}
diff --git a/B2Program/LightModel/btypes/BStruct.js b/B2Program/LightModel/btypes/BStruct.js
new file mode 100755
index 0000000000000000000000000000000000000000..196b0fa0e643f72a865a96d09c27c76f5ed92fdd
--- /dev/null
+++ b/B2Program/LightModel/btypes/BStruct.js
@@ -0,0 +1,9 @@
+import { BBoolean } from "./BBoolean.js";
+export class BStruct {
+    isRecord() {
+        return new BBoolean(true);
+    }
+    isNotRecord() {
+        return new BBoolean(false);
+    }
+}
diff --git a/B2Program/LightModel/btypes/BTuple.js b/B2Program/LightModel/btypes/BTuple.js
new file mode 100755
index 0000000000000000000000000000000000000000..49f6bba5979626f54da241bc2aee21b680b45674
--- /dev/null
+++ b/B2Program/LightModel/btypes/BTuple.js
@@ -0,0 +1,34 @@
+import { BBoolean } from "./BBoolean.js";
+export class BTuple {
+    constructor(first, second) {
+        if (first == null || second == null) {
+            throw new RangeError("Arguments of Tuple cant be null or undefined");
+        }
+        this.first = first;
+        this.second = second;
+    }
+    equals(o) {
+        if (o == null || !(o instanceof BTuple)) {
+            return false;
+        }
+        return o.projection1().equals(this.first) && o.projection2().equals(this.second);
+    }
+    toString() {
+        return "(" + this.projection1() + " |-> " + this.projection2() + ')';
+    }
+    projection1() {
+        return this.first;
+    }
+    projection2() {
+        return this.second;
+    }
+    equal(o) {
+        return new BBoolean(this.equals(o));
+    }
+    unequal(o) {
+        return new BBoolean(!this.equals(o));
+    }
+    hashCode() {
+        return this.first.hashCode() ^ (this.second.hashCode() << 1);
+    }
+}
diff --git a/B2Program/LightModel/btypes/BUtils.js b/B2Program/LightModel/btypes/BUtils.js
new file mode 100755
index 0000000000000000000000000000000000000000..cc0de5b897c6bf57f395a844a2717aaf89ba68b1
--- /dev/null
+++ b/B2Program/LightModel/btypes/BUtils.js
@@ -0,0 +1,11 @@
+import { BSet } from "./BSet.js";
+import { BBoolean } from "./BBoolean.js";
+export class BUtils {
+}
+BUtils.BOOL = new BSet(new BBoolean(true), new BBoolean(false));
+export class SelectError extends Error {
+    constructor(msg) {
+        super(msg);
+        Object.setPrototypeOf(this, SelectError.prototype);
+    }
+}
\ No newline at end of file
diff --git a/B2Program/LightModel/immutable/LICENSE b/B2Program/LightModel/immutable/LICENSE
new file mode 100755
index 0000000000000000000000000000000000000000..cde61b6c53dda799b707ddf13c067fada5140acf
--- /dev/null
+++ b/B2Program/LightModel/immutable/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2014-present, Facebook, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/B2Program/LightModel/immutable/dist/immutable.es.js b/B2Program/LightModel/immutable/dist/immutable.es.js
new file mode 100755
index 0000000000000000000000000000000000000000..aecd6fe13a5026d8567ff123f8bdd6b79452e394
--- /dev/null
+++ b/B2Program/LightModel/immutable/dist/immutable.es.js
@@ -0,0 +1,5818 @@
+/**
+ * Copyright (c) 2014-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+// Used for setting prototype methods that IE8 chokes on.
+var DELETE = 'delete';
+
+// Constants describing the size of trie nodes.
+var SHIFT = 5; // Resulted in best performance after ______?
+var SIZE = 1 << SHIFT;
+var MASK = SIZE - 1;
+
+// A consistent shared value representing "not set" which equals nothing other
+// than itself, and nothing that could be provided externally.
+var NOT_SET = {};
+
+// Boolean references, Rough equivalent of `bool &`.
+function MakeRef() {
+  return { value: false };
+}
+
+function SetRef(ref) {
+  if (ref) {
+    ref.value = true;
+  }
+}
+
+// A function which returns a value representing an "owner" for transient writes
+// to tries. The return value will only ever equal itself, and will not equal
+// the return of any subsequent call of this function.
+function OwnerID() {}
+
+function ensureSize(iter) {
+  if (iter.size === undefined) {
+    iter.size = iter.__iterate(returnTrue);
+  }
+  return iter.size;
+}
+
+function wrapIndex(iter, index) {
+  // This implements "is array index" which the ECMAString spec defines as:
+  //
+  //     A String property name P is an array index if and only if
+  //     ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal
+  //     to 2^32−1.
+  //
+  // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects
+  if (typeof index !== 'number') {
+    var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32
+    if ('' + uint32Index !== index || uint32Index === 4294967295) {
+      return NaN;
+    }
+    index = uint32Index;
+  }
+  return index < 0 ? ensureSize(iter) + index : index;
+}
+
+function returnTrue() {
+  return true;
+}
+
+function wholeSlice(begin, end, size) {
+  return (
+    ((begin === 0 && !isNeg(begin)) ||
+      (size !== undefined && begin <= -size)) &&
+    (end === undefined || (size !== undefined && end >= size))
+  );
+}
+
+function resolveBegin(begin, size) {
+  return resolveIndex(begin, size, 0);
+}
+
+function resolveEnd(end, size) {
+  return resolveIndex(end, size, size);
+}
+
+function resolveIndex(index, size, defaultIndex) {
+  // Sanitize indices using this shorthand for ToInt32(argument)
+  // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32
+  return index === undefined
+    ? defaultIndex
+    : isNeg(index)
+      ? size === Infinity
+        ? size
+        : Math.max(0, size + index) | 0
+      : size === undefined || size === index
+        ? index
+        : Math.min(size, index) | 0;
+}
+
+function isNeg(value) {
+  // Account for -0 which is negative, but not less than 0.
+  return value < 0 || (value === 0 && 1 / value === -Infinity);
+}
+
+// Note: value is unchanged to not break immutable-devtools.
+var IS_COLLECTION_SYMBOL = '@@__IMMUTABLE_ITERABLE__@@';
+
+function isCollection(maybeCollection) {
+  return Boolean(maybeCollection && maybeCollection[IS_COLLECTION_SYMBOL]);
+}
+
+var IS_KEYED_SYMBOL = '@@__IMMUTABLE_KEYED__@@';
+
+function isKeyed(maybeKeyed) {
+  return Boolean(maybeKeyed && maybeKeyed[IS_KEYED_SYMBOL]);
+}
+
+var IS_INDEXED_SYMBOL = '@@__IMMUTABLE_INDEXED__@@';
+
+function isIndexed(maybeIndexed) {
+  return Boolean(maybeIndexed && maybeIndexed[IS_INDEXED_SYMBOL]);
+}
+
+function isAssociative(maybeAssociative) {
+  return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);
+}
+
+var Collection = function Collection(value) {
+  return isCollection(value) ? value : Seq(value);
+};
+
+var KeyedCollection = /*@__PURE__*/(function (Collection) {
+  function KeyedCollection(value) {
+    return isKeyed(value) ? value : KeyedSeq(value);
+  }
+
+  if ( Collection ) KeyedCollection.__proto__ = Collection;
+  KeyedCollection.prototype = Object.create( Collection && Collection.prototype );
+  KeyedCollection.prototype.constructor = KeyedCollection;
+
+  return KeyedCollection;
+}(Collection));
+
+var IndexedCollection = /*@__PURE__*/(function (Collection) {
+  function IndexedCollection(value) {
+    return isIndexed(value) ? value : IndexedSeq(value);
+  }
+
+  if ( Collection ) IndexedCollection.__proto__ = Collection;
+  IndexedCollection.prototype = Object.create( Collection && Collection.prototype );
+  IndexedCollection.prototype.constructor = IndexedCollection;
+
+  return IndexedCollection;
+}(Collection));
+
+var SetCollection = /*@__PURE__*/(function (Collection) {
+  function SetCollection(value) {
+    return isCollection(value) && !isAssociative(value) ? value : SetSeq(value);
+  }
+
+  if ( Collection ) SetCollection.__proto__ = Collection;
+  SetCollection.prototype = Object.create( Collection && Collection.prototype );
+  SetCollection.prototype.constructor = SetCollection;
+
+  return SetCollection;
+}(Collection));
+
+Collection.Keyed = KeyedCollection;
+Collection.Indexed = IndexedCollection;
+Collection.Set = SetCollection;
+
+var IS_SEQ_SYMBOL = '@@__IMMUTABLE_SEQ__@@';
+
+function isSeq(maybeSeq) {
+  return Boolean(maybeSeq && maybeSeq[IS_SEQ_SYMBOL]);
+}
+
+var IS_RECORD_SYMBOL = '@@__IMMUTABLE_RECORD__@@';
+
+function isRecord(maybeRecord) {
+  return Boolean(maybeRecord && maybeRecord[IS_RECORD_SYMBOL]);
+}
+
+function isImmutable(maybeImmutable) {
+  return isCollection(maybeImmutable) || isRecord(maybeImmutable);
+}
+
+var IS_ORDERED_SYMBOL = '@@__IMMUTABLE_ORDERED__@@';
+
+function isOrdered(maybeOrdered) {
+  return Boolean(maybeOrdered && maybeOrdered[IS_ORDERED_SYMBOL]);
+}
+
+var ITERATE_KEYS = 0;
+var ITERATE_VALUES = 1;
+var ITERATE_ENTRIES = 2;
+
+var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
+var FAUX_ITERATOR_SYMBOL = '@@iterator';
+
+var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL;
+
+var Iterator = function Iterator(next) {
+  this.next = next;
+};
+
+Iterator.prototype.toString = function toString () {
+  return '[Iterator]';
+};
+
+Iterator.KEYS = ITERATE_KEYS;
+Iterator.VALUES = ITERATE_VALUES;
+Iterator.ENTRIES = ITERATE_ENTRIES;
+
+Iterator.prototype.inspect = Iterator.prototype.toSource = function() {
+  return this.toString();
+};
+Iterator.prototype[ITERATOR_SYMBOL] = function() {
+  return this;
+};
+
+function iteratorValue(type, k, v, iteratorResult) {
+  var value = type === 0 ? k : type === 1 ? v : [k, v];
+  iteratorResult
+    ? (iteratorResult.value = value)
+    : (iteratorResult = {
+        value: value,
+        done: false,
+      });
+  return iteratorResult;
+}
+
+function iteratorDone() {
+  return { value: undefined, done: true };
+}
+
+function hasIterator(maybeIterable) {
+  return !!getIteratorFn(maybeIterable);
+}
+
+function isIterator(maybeIterator) {
+  return maybeIterator && typeof maybeIterator.next === 'function';
+}
+
+function getIterator(iterable) {
+  var iteratorFn = getIteratorFn(iterable);
+  return iteratorFn && iteratorFn.call(iterable);
+}
+
+function getIteratorFn(iterable) {
+  var iteratorFn =
+    iterable &&
+    ((REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) ||
+      iterable[FAUX_ITERATOR_SYMBOL]);
+  if (typeof iteratorFn === 'function') {
+    return iteratorFn;
+  }
+}
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+function isArrayLike(value) {
+  if (Array.isArray(value) || typeof value === 'string') {
+    return true;
+  }
+
+  return (
+    value &&
+    typeof value === 'object' &&
+    Number.isInteger(value.length) &&
+    value.length >= 0 &&
+    (value.length === 0
+      ? // Only {length: 0} is considered Array-like.
+        Object.keys(value).length === 1
+      : // An object is only Array-like if it has a property where the last value
+        // in the array-like may be found (which could be undefined).
+        value.hasOwnProperty(value.length - 1))
+  );
+}
+
+var Seq = /*@__PURE__*/(function (Collection$$1) {
+  function Seq(value) {
+    return value === null || value === undefined
+      ? emptySequence()
+      : isImmutable(value)
+        ? value.toSeq()
+        : seqFromValue(value);
+  }
+
+  if ( Collection$$1 ) Seq.__proto__ = Collection$$1;
+  Seq.prototype = Object.create( Collection$$1 && Collection$$1.prototype );
+  Seq.prototype.constructor = Seq;
+
+  Seq.prototype.toSeq = function toSeq () {
+    return this;
+  };
+
+  Seq.prototype.toString = function toString () {
+    return this.__toString('Seq {', '}');
+  };
+
+  Seq.prototype.cacheResult = function cacheResult () {
+    if (!this._cache && this.__iterateUncached) {
+      this._cache = this.entrySeq().toArray();
+      this.size = this._cache.length;
+    }
+    return this;
+  };
+
+  // abstract __iterateUncached(fn, reverse)
+
+  Seq.prototype.__iterate = function __iterate (fn, reverse) {
+    var cache = this._cache;
+    if (cache) {
+      var size = cache.length;
+      var i = 0;
+      while (i !== size) {
+        var entry = cache[reverse ? size - ++i : i++];
+        if (fn(entry[1], entry[0], this) === false) {
+          break;
+        }
+      }
+      return i;
+    }
+    return this.__iterateUncached(fn, reverse);
+  };
+
+  // abstract __iteratorUncached(type, reverse)
+
+  Seq.prototype.__iterator = function __iterator (type, reverse) {
+    var cache = this._cache;
+    if (cache) {
+      var size = cache.length;
+      var i = 0;
+      return new Iterator(function () {
+        if (i === size) {
+          return iteratorDone();
+        }
+        var entry = cache[reverse ? size - ++i : i++];
+        return iteratorValue(type, entry[0], entry[1]);
+      });
+    }
+    return this.__iteratorUncached(type, reverse);
+  };
+
+  return Seq;
+}(Collection));
+
+var KeyedSeq = /*@__PURE__*/(function (Seq) {
+  function KeyedSeq(value) {
+    return value === null || value === undefined
+      ? emptySequence().toKeyedSeq()
+      : isCollection(value)
+        ? isKeyed(value)
+          ? value.toSeq()
+          : value.fromEntrySeq()
+        : isRecord(value)
+          ? value.toSeq()
+          : keyedSeqFromValue(value);
+  }
+
+  if ( Seq ) KeyedSeq.__proto__ = Seq;
+  KeyedSeq.prototype = Object.create( Seq && Seq.prototype );
+  KeyedSeq.prototype.constructor = KeyedSeq;
+
+  KeyedSeq.prototype.toKeyedSeq = function toKeyedSeq () {
+    return this;
+  };
+
+  return KeyedSeq;
+}(Seq));
+
+var IndexedSeq = /*@__PURE__*/(function (Seq) {
+  function IndexedSeq(value) {
+    return value === null || value === undefined
+      ? emptySequence()
+      : isCollection(value)
+        ? isKeyed(value)
+          ? value.entrySeq()
+          : value.toIndexedSeq()
+        : isRecord(value)
+          ? value.toSeq().entrySeq()
+          : indexedSeqFromValue(value);
+  }
+
+  if ( Seq ) IndexedSeq.__proto__ = Seq;
+  IndexedSeq.prototype = Object.create( Seq && Seq.prototype );
+  IndexedSeq.prototype.constructor = IndexedSeq;
+
+  IndexedSeq.of = function of (/*...values*/) {
+    return IndexedSeq(arguments);
+  };
+
+  IndexedSeq.prototype.toIndexedSeq = function toIndexedSeq () {
+    return this;
+  };
+
+  IndexedSeq.prototype.toString = function toString () {
+    return this.__toString('Seq [', ']');
+  };
+
+  return IndexedSeq;
+}(Seq));
+
+var SetSeq = /*@__PURE__*/(function (Seq) {
+  function SetSeq(value) {
+    return (isCollection(value) && !isAssociative(value)
+      ? value
+      : IndexedSeq(value)
+    ).toSetSeq();
+  }
+
+  if ( Seq ) SetSeq.__proto__ = Seq;
+  SetSeq.prototype = Object.create( Seq && Seq.prototype );
+  SetSeq.prototype.constructor = SetSeq;
+
+  SetSeq.of = function of (/*...values*/) {
+    return SetSeq(arguments);
+  };
+
+  SetSeq.prototype.toSetSeq = function toSetSeq () {
+    return this;
+  };
+
+  return SetSeq;
+}(Seq));
+
+Seq.isSeq = isSeq;
+Seq.Keyed = KeyedSeq;
+Seq.Set = SetSeq;
+Seq.Indexed = IndexedSeq;
+
+Seq.prototype[IS_SEQ_SYMBOL] = true;
+
+// #pragma Root Sequences
+
+var ArraySeq = /*@__PURE__*/(function (IndexedSeq) {
+  function ArraySeq(array) {
+    this._array = array;
+    this.size = array.length;
+  }
+
+  if ( IndexedSeq ) ArraySeq.__proto__ = IndexedSeq;
+  ArraySeq.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
+  ArraySeq.prototype.constructor = ArraySeq;
+
+  ArraySeq.prototype.get = function get (index, notSetValue) {
+    return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue;
+  };
+
+  ArraySeq.prototype.__iterate = function __iterate (fn, reverse) {
+    var array = this._array;
+    var size = array.length;
+    var i = 0;
+    while (i !== size) {
+      var ii = reverse ? size - ++i : i++;
+      if (fn(array[ii], ii, this) === false) {
+        break;
+      }
+    }
+    return i;
+  };
+
+  ArraySeq.prototype.__iterator = function __iterator (type, reverse) {
+    var array = this._array;
+    var size = array.length;
+    var i = 0;
+    return new Iterator(function () {
+      if (i === size) {
+        return iteratorDone();
+      }
+      var ii = reverse ? size - ++i : i++;
+      return iteratorValue(type, ii, array[ii]);
+    });
+  };
+
+  return ArraySeq;
+}(IndexedSeq));
+
+var ObjectSeq = /*@__PURE__*/(function (KeyedSeq) {
+  function ObjectSeq(object) {
+    var keys = Object.keys(object);
+    this._object = object;
+    this._keys = keys;
+    this.size = keys.length;
+  }
+
+  if ( KeyedSeq ) ObjectSeq.__proto__ = KeyedSeq;
+  ObjectSeq.prototype = Object.create( KeyedSeq && KeyedSeq.prototype );
+  ObjectSeq.prototype.constructor = ObjectSeq;
+
+  ObjectSeq.prototype.get = function get (key, notSetValue) {
+    if (notSetValue !== undefined && !this.has(key)) {
+      return notSetValue;
+    }
+    return this._object[key];
+  };
+
+  ObjectSeq.prototype.has = function has (key) {
+    return hasOwnProperty.call(this._object, key);
+  };
+
+  ObjectSeq.prototype.__iterate = function __iterate (fn, reverse) {
+    var object = this._object;
+    var keys = this._keys;
+    var size = keys.length;
+    var i = 0;
+    while (i !== size) {
+      var key = keys[reverse ? size - ++i : i++];
+      if (fn(object[key], key, this) === false) {
+        break;
+      }
+    }
+    return i;
+  };
+
+  ObjectSeq.prototype.__iterator = function __iterator (type, reverse) {
+    var object = this._object;
+    var keys = this._keys;
+    var size = keys.length;
+    var i = 0;
+    return new Iterator(function () {
+      if (i === size) {
+        return iteratorDone();
+      }
+      var key = keys[reverse ? size - ++i : i++];
+      return iteratorValue(type, key, object[key]);
+    });
+  };
+
+  return ObjectSeq;
+}(KeyedSeq));
+ObjectSeq.prototype[IS_ORDERED_SYMBOL] = true;
+
+var CollectionSeq = /*@__PURE__*/(function (IndexedSeq) {
+  function CollectionSeq(collection) {
+    this._collection = collection;
+    this.size = collection.length || collection.size;
+  }
+
+  if ( IndexedSeq ) CollectionSeq.__proto__ = IndexedSeq;
+  CollectionSeq.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
+  CollectionSeq.prototype.constructor = CollectionSeq;
+
+  CollectionSeq.prototype.__iterateUncached = function __iterateUncached (fn, reverse) {
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var collection = this._collection;
+    var iterator = getIterator(collection);
+    var iterations = 0;
+    if (isIterator(iterator)) {
+      var step;
+      while (!(step = iterator.next()).done) {
+        if (fn(step.value, iterations++, this) === false) {
+          break;
+        }
+      }
+    }
+    return iterations;
+  };
+
+  CollectionSeq.prototype.__iteratorUncached = function __iteratorUncached (type, reverse) {
+    if (reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    var collection = this._collection;
+    var iterator = getIterator(collection);
+    if (!isIterator(iterator)) {
+      return new Iterator(iteratorDone);
+    }
+    var iterations = 0;
+    return new Iterator(function () {
+      var step = iterator.next();
+      return step.done ? step : iteratorValue(type, iterations++, step.value);
+    });
+  };
+
+  return CollectionSeq;
+}(IndexedSeq));
+
+// # pragma Helper functions
+
+var EMPTY_SEQ;
+
+function emptySequence() {
+  return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([]));
+}
+
+function keyedSeqFromValue(value) {
+  var seq = Array.isArray(value)
+    ? new ArraySeq(value)
+    : hasIterator(value)
+      ? new CollectionSeq(value)
+      : undefined;
+  if (seq) {
+    return seq.fromEntrySeq();
+  }
+  if (typeof value === 'object') {
+    return new ObjectSeq(value);
+  }
+  throw new TypeError(
+    'Expected Array or collection object of [k, v] entries, or keyed object: ' +
+      value
+  );
+}
+
+function indexedSeqFromValue(value) {
+  var seq = maybeIndexedSeqFromValue(value);
+  if (seq) {
+    return seq;
+  }
+  throw new TypeError(
+    'Expected Array or collection object of values: ' + value
+  );
+}
+
+function seqFromValue(value) {
+  var seq = maybeIndexedSeqFromValue(value);
+  if (seq) {
+    return seq;
+  }
+  if (typeof value === 'object') {
+    return new ObjectSeq(value);
+  }
+  throw new TypeError(
+    'Expected Array or collection object of values, or keyed object: ' + value
+  );
+}
+
+function maybeIndexedSeqFromValue(value) {
+  return isArrayLike(value)
+    ? new ArraySeq(value)
+    : hasIterator(value)
+      ? new CollectionSeq(value)
+      : undefined;
+}
+
+var IS_MAP_SYMBOL = '@@__IMMUTABLE_MAP__@@';
+
+function isMap(maybeMap) {
+  return Boolean(maybeMap && maybeMap[IS_MAP_SYMBOL]);
+}
+
+function isOrderedMap(maybeOrderedMap) {
+  return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);
+}
+
+function isValueObject(maybeValue) {
+  return Boolean(
+    maybeValue &&
+      typeof maybeValue.equals === 'function' &&
+      typeof maybeValue.hashCode === 'function'
+  );
+}
+
+/**
+ * An extension of the "same-value" algorithm as [described for use by ES6 Map
+ * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality)
+ *
+ * NaN is considered the same as NaN, however -0 and 0 are considered the same
+ * value, which is different from the algorithm described by
+ * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
+ *
+ * This is extended further to allow Objects to describe the values they
+ * represent, by way of `valueOf` or `equals` (and `hashCode`).
+ *
+ * Note: because of this extension, the key equality of Immutable.Map and the
+ * value equality of Immutable.Set will differ from ES6 Map and Set.
+ *
+ * ### Defining custom values
+ *
+ * The easiest way to describe the value an object represents is by implementing
+ * `valueOf`. For example, `Date` represents a value by returning a unix
+ * timestamp for `valueOf`:
+ *
+ *     var date1 = new Date(1234567890000); // Fri Feb 13 2009 ...
+ *     var date2 = new Date(1234567890000);
+ *     date1.valueOf(); // 1234567890000
+ *     assert( date1 !== date2 );
+ *     assert( Immutable.is( date1, date2 ) );
+ *
+ * Note: overriding `valueOf` may have other implications if you use this object
+ * where JavaScript expects a primitive, such as implicit string coercion.
+ *
+ * For more complex types, especially collections, implementing `valueOf` may
+ * not be performant. An alternative is to implement `equals` and `hashCode`.
+ *
+ * `equals` takes another object, presumably of similar type, and returns true
+ * if it is equal. Equality is symmetrical, so the same result should be
+ * returned if this and the argument are flipped.
+ *
+ *     assert( a.equals(b) === b.equals(a) );
+ *
+ * `hashCode` returns a 32bit integer number representing the object which will
+ * be used to determine how to store the value object in a Map or Set. You must
+ * provide both or neither methods, one must not exist without the other.
+ *
+ * Also, an important relationship between these methods must be upheld: if two
+ * values are equal, they *must* return the same hashCode. If the values are not
+ * equal, they might have the same hashCode; this is called a hash collision,
+ * and while undesirable for performance reasons, it is acceptable.
+ *
+ *     if (a.equals(b)) {
+ *       assert( a.hashCode() === b.hashCode() );
+ *     }
+ *
+ * All Immutable collections are Value Objects: they implement `equals()`
+ * and `hashCode()`.
+ */
+function is(valueA, valueB) {
+  if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {
+    return true;
+  }
+  if (!valueA || !valueB) {
+    return false;
+  }
+  if (
+    typeof valueA.valueOf === 'function' &&
+    typeof valueB.valueOf === 'function'
+  ) {
+    valueA = valueA.valueOf();
+    valueB = valueB.valueOf();
+    if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {
+      return true;
+    }
+    if (!valueA || !valueB) {
+      return false;
+    }
+  }
+  return !!(
+    isValueObject(valueA) &&
+    isValueObject(valueB) &&
+    valueA.equals(valueB)
+  );
+}
+
+var imul =
+  typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2
+    ? Math.imul
+    : function imul(a, b) {
+        a |= 0; // int
+        b |= 0; // int
+        var c = a & 0xffff;
+        var d = b & 0xffff;
+        // Shift by 0 fixes the sign on the high part.
+        return (c * d + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0)) | 0; // int
+      };
+
+// v8 has an optimization for storing 31-bit signed numbers.
+// Values which have either 00 or 11 as the high order bits qualify.
+// This function drops the highest order bit in a signed number, maintaining
+// the sign bit.
+function smi(i32) {
+  return ((i32 >>> 1) & 0x40000000) | (i32 & 0xbfffffff);
+}
+
+var defaultValueOf = Object.prototype.valueOf;
+
+function hash(o) {
+  switch (typeof o) {
+    case 'boolean':
+      // The hash values for built-in constants are a 1 value for each 5-byte
+      // shift region expect for the first, which encodes the value. This
+      // reduces the odds of a hash collision for these common values.
+      return o ? 0x42108421 : 0x42108420;
+    case 'number':
+      return hashNumber(o);
+    case 'string':
+      return o.length > STRING_HASH_CACHE_MIN_STRLEN
+        ? cachedHashString(o)
+        : hashString(o);
+    case 'object':
+    case 'function':
+      if (o === null) {
+        return 0x42108422;
+      }
+      if (typeof o.hashCode === 'function') {
+        // Drop any high bits from accidentally long hash codes.
+        return smi(o.hashCode(o));
+      }
+      if (o.valueOf !== defaultValueOf && typeof o.valueOf === 'function') {
+        o = o.valueOf(o);
+      }
+      return hashJSObj(o);
+    case 'undefined':
+      return 0x42108423;
+    default:
+      if (typeof o.toString === 'function') {
+        return hashString(o.toString());
+      }
+      throw new Error('Value type ' + typeof o + ' cannot be hashed.');
+  }
+}
+
+// Compress arbitrarily large numbers into smi hashes.
+function hashNumber(n) {
+  if (n !== n || n === Infinity) {
+    return 0;
+  }
+  var hash = n | 0;
+  if (hash !== n) {
+    hash ^= n * 0xffffffff;
+  }
+  while (n > 0xffffffff) {
+    n /= 0xffffffff;
+    hash ^= n;
+  }
+  return smi(hash);
+}
+
+function cachedHashString(string) {
+  var hashed = stringHashCache[string];
+  if (hashed === undefined) {
+    hashed = hashString(string);
+    if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) {
+      STRING_HASH_CACHE_SIZE = 0;
+      stringHashCache = {};
+    }
+    STRING_HASH_CACHE_SIZE++;
+    stringHashCache[string] = hashed;
+  }
+  return hashed;
+}
+
+// http://jsperf.com/hashing-strings
+function hashString(string) {
+  // This is the hash from JVM
+  // The hash code for a string is computed as
+  // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1],
+  // where s[i] is the ith character of the string and n is the length of
+  // the string. We "mod" the result to make it between 0 (inclusive) and 2^31
+  // (exclusive) by dropping high bits.
+  var hashed = 0;
+  for (var ii = 0; ii < string.length; ii++) {
+    hashed = (31 * hashed + string.charCodeAt(ii)) | 0;
+  }
+  return smi(hashed);
+}
+
+function hashJSObj(obj) {
+  var hashed;
+  if (usingWeakMap) {
+    hashed = weakMap.get(obj);
+    if (hashed !== undefined) {
+      return hashed;
+    }
+  }
+
+  hashed = obj[UID_HASH_KEY];
+  if (hashed !== undefined) {
+    return hashed;
+  }
+
+  if (!canDefineProperty) {
+    hashed = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY];
+    if (hashed !== undefined) {
+      return hashed;
+    }
+
+    hashed = getIENodeHash(obj);
+    if (hashed !== undefined) {
+      return hashed;
+    }
+  }
+
+  hashed = ++objHashUID;
+  if (objHashUID & 0x40000000) {
+    objHashUID = 0;
+  }
+
+  if (usingWeakMap) {
+    weakMap.set(obj, hashed);
+  } else if (isExtensible !== undefined && isExtensible(obj) === false) {
+    throw new Error('Non-extensible objects are not allowed as keys.');
+  } else if (canDefineProperty) {
+    Object.defineProperty(obj, UID_HASH_KEY, {
+      enumerable: false,
+      configurable: false,
+      writable: false,
+      value: hashed,
+    });
+  } else if (
+    obj.propertyIsEnumerable !== undefined &&
+    obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable
+  ) {
+    // Since we can't define a non-enumerable property on the object
+    // we'll hijack one of the less-used non-enumerable properties to
+    // save our hash on it. Since this is a function it will not show up in
+    // `JSON.stringify` which is what we want.
+    obj.propertyIsEnumerable = function() {
+      return this.constructor.prototype.propertyIsEnumerable.apply(
+        this,
+        arguments
+      );
+    };
+    obj.propertyIsEnumerable[UID_HASH_KEY] = hashed;
+  } else if (obj.nodeType !== undefined) {
+    // At this point we couldn't get the IE `uniqueID` to use as a hash
+    // and we couldn't use a non-enumerable property to exploit the
+    // dontEnum bug so we simply add the `UID_HASH_KEY` on the node
+    // itself.
+    obj[UID_HASH_KEY] = hashed;
+  } else {
+    throw new Error('Unable to set a non-enumerable property on object.');
+  }
+
+  return hashed;
+}
+
+// Get references to ES5 object methods.
+var isExtensible = Object.isExtensible;
+
+// True if Object.defineProperty works as expected. IE8 fails this test.
+var canDefineProperty = (function() {
+  try {
+    Object.defineProperty({}, '@', {});
+    return true;
+  } catch (e) {
+    return false;
+  }
+})();
+
+// IE has a `uniqueID` property on DOM nodes. We can construct the hash from it
+// and avoid memory leaks from the IE cloneNode bug.
+function getIENodeHash(node) {
+  if (node && node.nodeType > 0) {
+    switch (node.nodeType) {
+      case 1: // Element
+        return node.uniqueID;
+      case 9: // Document
+        return node.documentElement && node.documentElement.uniqueID;
+    }
+  }
+}
+
+// If possible, use a WeakMap.
+var usingWeakMap = typeof WeakMap === 'function';
+var weakMap;
+if (usingWeakMap) {
+  weakMap = new WeakMap();
+}
+
+var objHashUID = 0;
+
+var UID_HASH_KEY = '__immutablehash__';
+if (typeof Symbol === 'function') {
+  UID_HASH_KEY = Symbol(UID_HASH_KEY);
+}
+
+var STRING_HASH_CACHE_MIN_STRLEN = 16;
+var STRING_HASH_CACHE_MAX_SIZE = 255;
+var STRING_HASH_CACHE_SIZE = 0;
+var stringHashCache = {};
+
+var ToKeyedSequence = /*@__PURE__*/(function (KeyedSeq$$1) {
+  function ToKeyedSequence(indexed, useKeys) {
+    this._iter = indexed;
+    this._useKeys = useKeys;
+    this.size = indexed.size;
+  }
+
+  if ( KeyedSeq$$1 ) ToKeyedSequence.__proto__ = KeyedSeq$$1;
+  ToKeyedSequence.prototype = Object.create( KeyedSeq$$1 && KeyedSeq$$1.prototype );
+  ToKeyedSequence.prototype.constructor = ToKeyedSequence;
+
+  ToKeyedSequence.prototype.get = function get (key, notSetValue) {
+    return this._iter.get(key, notSetValue);
+  };
+
+  ToKeyedSequence.prototype.has = function has (key) {
+    return this._iter.has(key);
+  };
+
+  ToKeyedSequence.prototype.valueSeq = function valueSeq () {
+    return this._iter.valueSeq();
+  };
+
+  ToKeyedSequence.prototype.reverse = function reverse () {
+    var this$1 = this;
+
+    var reversedSequence = reverseFactory(this, true);
+    if (!this._useKeys) {
+      reversedSequence.valueSeq = function () { return this$1._iter.toSeq().reverse(); };
+    }
+    return reversedSequence;
+  };
+
+  ToKeyedSequence.prototype.map = function map (mapper, context) {
+    var this$1 = this;
+
+    var mappedSequence = mapFactory(this, mapper, context);
+    if (!this._useKeys) {
+      mappedSequence.valueSeq = function () { return this$1._iter.toSeq().map(mapper, context); };
+    }
+    return mappedSequence;
+  };
+
+  ToKeyedSequence.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._iter.__iterate(function (v, k) { return fn(v, k, this$1); }, reverse);
+  };
+
+  ToKeyedSequence.prototype.__iterator = function __iterator (type, reverse) {
+    return this._iter.__iterator(type, reverse);
+  };
+
+  return ToKeyedSequence;
+}(KeyedSeq));
+ToKeyedSequence.prototype[IS_ORDERED_SYMBOL] = true;
+
+var ToIndexedSequence = /*@__PURE__*/(function (IndexedSeq$$1) {
+  function ToIndexedSequence(iter) {
+    this._iter = iter;
+    this.size = iter.size;
+  }
+
+  if ( IndexedSeq$$1 ) ToIndexedSequence.__proto__ = IndexedSeq$$1;
+  ToIndexedSequence.prototype = Object.create( IndexedSeq$$1 && IndexedSeq$$1.prototype );
+  ToIndexedSequence.prototype.constructor = ToIndexedSequence;
+
+  ToIndexedSequence.prototype.includes = function includes (value) {
+    return this._iter.includes(value);
+  };
+
+  ToIndexedSequence.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    var i = 0;
+    reverse && ensureSize(this);
+    return this._iter.__iterate(
+      function (v) { return fn(v, reverse ? this$1.size - ++i : i++, this$1); },
+      reverse
+    );
+  };
+
+  ToIndexedSequence.prototype.__iterator = function __iterator (type, reverse) {
+    var this$1 = this;
+
+    var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
+    var i = 0;
+    reverse && ensureSize(this);
+    return new Iterator(function () {
+      var step = iterator.next();
+      return step.done
+        ? step
+        : iteratorValue(
+            type,
+            reverse ? this$1.size - ++i : i++,
+            step.value,
+            step
+          );
+    });
+  };
+
+  return ToIndexedSequence;
+}(IndexedSeq));
+
+var ToSetSequence = /*@__PURE__*/(function (SetSeq$$1) {
+  function ToSetSequence(iter) {
+    this._iter = iter;
+    this.size = iter.size;
+  }
+
+  if ( SetSeq$$1 ) ToSetSequence.__proto__ = SetSeq$$1;
+  ToSetSequence.prototype = Object.create( SetSeq$$1 && SetSeq$$1.prototype );
+  ToSetSequence.prototype.constructor = ToSetSequence;
+
+  ToSetSequence.prototype.has = function has (key) {
+    return this._iter.includes(key);
+  };
+
+  ToSetSequence.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._iter.__iterate(function (v) { return fn(v, v, this$1); }, reverse);
+  };
+
+  ToSetSequence.prototype.__iterator = function __iterator (type, reverse) {
+    var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
+    return new Iterator(function () {
+      var step = iterator.next();
+      return step.done
+        ? step
+        : iteratorValue(type, step.value, step.value, step);
+    });
+  };
+
+  return ToSetSequence;
+}(SetSeq));
+
+var FromEntriesSequence = /*@__PURE__*/(function (KeyedSeq$$1) {
+  function FromEntriesSequence(entries) {
+    this._iter = entries;
+    this.size = entries.size;
+  }
+
+  if ( KeyedSeq$$1 ) FromEntriesSequence.__proto__ = KeyedSeq$$1;
+  FromEntriesSequence.prototype = Object.create( KeyedSeq$$1 && KeyedSeq$$1.prototype );
+  FromEntriesSequence.prototype.constructor = FromEntriesSequence;
+
+  FromEntriesSequence.prototype.entrySeq = function entrySeq () {
+    return this._iter.toSeq();
+  };
+
+  FromEntriesSequence.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._iter.__iterate(function (entry) {
+      // Check if entry exists first so array access doesn't throw for holes
+      // in the parent iteration.
+      if (entry) {
+        validateEntry(entry);
+        var indexedCollection = isCollection(entry);
+        return fn(
+          indexedCollection ? entry.get(1) : entry[1],
+          indexedCollection ? entry.get(0) : entry[0],
+          this$1
+        );
+      }
+    }, reverse);
+  };
+
+  FromEntriesSequence.prototype.__iterator = function __iterator (type, reverse) {
+    var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
+    return new Iterator(function () {
+      while (true) {
+        var step = iterator.next();
+        if (step.done) {
+          return step;
+        }
+        var entry = step.value;
+        // Check if entry exists first so array access doesn't throw for holes
+        // in the parent iteration.
+        if (entry) {
+          validateEntry(entry);
+          var indexedCollection = isCollection(entry);
+          return iteratorValue(
+            type,
+            indexedCollection ? entry.get(0) : entry[0],
+            indexedCollection ? entry.get(1) : entry[1],
+            step
+          );
+        }
+      }
+    });
+  };
+
+  return FromEntriesSequence;
+}(KeyedSeq));
+
+ToIndexedSequence.prototype.cacheResult = ToKeyedSequence.prototype.cacheResult = ToSetSequence.prototype.cacheResult = FromEntriesSequence.prototype.cacheResult = cacheResultThrough;
+
+function flipFactory(collection) {
+  var flipSequence = makeSequence(collection);
+  flipSequence._iter = collection;
+  flipSequence.size = collection.size;
+  flipSequence.flip = function () { return collection; };
+  flipSequence.reverse = function() {
+    var reversedSequence = collection.reverse.apply(this); // super.reverse()
+    reversedSequence.flip = function () { return collection.reverse(); };
+    return reversedSequence;
+  };
+  flipSequence.has = function (key) { return collection.includes(key); };
+  flipSequence.includes = function (key) { return collection.has(key); };
+  flipSequence.cacheResult = cacheResultThrough;
+  flipSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    return collection.__iterate(function (v, k) { return fn(k, v, this$1) !== false; }, reverse);
+  };
+  flipSequence.__iteratorUncached = function(type, reverse) {
+    if (type === ITERATE_ENTRIES) {
+      var iterator = collection.__iterator(type, reverse);
+      return new Iterator(function () {
+        var step = iterator.next();
+        if (!step.done) {
+          var k = step.value[0];
+          step.value[0] = step.value[1];
+          step.value[1] = k;
+        }
+        return step;
+      });
+    }
+    return collection.__iterator(
+      type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES,
+      reverse
+    );
+  };
+  return flipSequence;
+}
+
+function mapFactory(collection, mapper, context) {
+  var mappedSequence = makeSequence(collection);
+  mappedSequence.size = collection.size;
+  mappedSequence.has = function (key) { return collection.has(key); };
+  mappedSequence.get = function (key, notSetValue) {
+    var v = collection.get(key, NOT_SET);
+    return v === NOT_SET
+      ? notSetValue
+      : mapper.call(context, v, key, collection);
+  };
+  mappedSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    return collection.__iterate(
+      function (v, k, c) { return fn(mapper.call(context, v, k, c), k, this$1) !== false; },
+      reverse
+    );
+  };
+  mappedSequence.__iteratorUncached = function(type, reverse) {
+    var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
+    return new Iterator(function () {
+      var step = iterator.next();
+      if (step.done) {
+        return step;
+      }
+      var entry = step.value;
+      var key = entry[0];
+      return iteratorValue(
+        type,
+        key,
+        mapper.call(context, entry[1], key, collection),
+        step
+      );
+    });
+  };
+  return mappedSequence;
+}
+
+function reverseFactory(collection, useKeys) {
+  var this$1 = this;
+
+  var reversedSequence = makeSequence(collection);
+  reversedSequence._iter = collection;
+  reversedSequence.size = collection.size;
+  reversedSequence.reverse = function () { return collection; };
+  if (collection.flip) {
+    reversedSequence.flip = function() {
+      var flipSequence = flipFactory(collection);
+      flipSequence.reverse = function () { return collection.flip(); };
+      return flipSequence;
+    };
+  }
+  reversedSequence.get = function (key, notSetValue) { return collection.get(useKeys ? key : -1 - key, notSetValue); };
+  reversedSequence.has = function (key) { return collection.has(useKeys ? key : -1 - key); };
+  reversedSequence.includes = function (value) { return collection.includes(value); };
+  reversedSequence.cacheResult = cacheResultThrough;
+  reversedSequence.__iterate = function(fn, reverse) {
+    var this$1 = this;
+
+    var i = 0;
+    reverse && ensureSize(collection);
+    return collection.__iterate(
+      function (v, k) { return fn(v, useKeys ? k : reverse ? this$1.size - ++i : i++, this$1); },
+      !reverse
+    );
+  };
+  reversedSequence.__iterator = function (type, reverse) {
+    var i = 0;
+    reverse && ensureSize(collection);
+    var iterator = collection.__iterator(ITERATE_ENTRIES, !reverse);
+    return new Iterator(function () {
+      var step = iterator.next();
+      if (step.done) {
+        return step;
+      }
+      var entry = step.value;
+      return iteratorValue(
+        type,
+        useKeys ? entry[0] : reverse ? this$1.size - ++i : i++,
+        entry[1],
+        step
+      );
+    });
+  };
+  return reversedSequence;
+}
+
+function filterFactory(collection, predicate, context, useKeys) {
+  var filterSequence = makeSequence(collection);
+  if (useKeys) {
+    filterSequence.has = function (key) {
+      var v = collection.get(key, NOT_SET);
+      return v !== NOT_SET && !!predicate.call(context, v, key, collection);
+    };
+    filterSequence.get = function (key, notSetValue) {
+      var v = collection.get(key, NOT_SET);
+      return v !== NOT_SET && predicate.call(context, v, key, collection)
+        ? v
+        : notSetValue;
+    };
+  }
+  filterSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    var iterations = 0;
+    collection.__iterate(function (v, k, c) {
+      if (predicate.call(context, v, k, c)) {
+        iterations++;
+        return fn(v, useKeys ? k : iterations - 1, this$1);
+      }
+    }, reverse);
+    return iterations;
+  };
+  filterSequence.__iteratorUncached = function(type, reverse) {
+    var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
+    var iterations = 0;
+    return new Iterator(function () {
+      while (true) {
+        var step = iterator.next();
+        if (step.done) {
+          return step;
+        }
+        var entry = step.value;
+        var key = entry[0];
+        var value = entry[1];
+        if (predicate.call(context, value, key, collection)) {
+          return iteratorValue(type, useKeys ? key : iterations++, value, step);
+        }
+      }
+    });
+  };
+  return filterSequence;
+}
+
+function countByFactory(collection, grouper, context) {
+  var groups = Map().asMutable();
+  collection.__iterate(function (v, k) {
+    groups.update(grouper.call(context, v, k, collection), 0, function (a) { return a + 1; });
+  });
+  return groups.asImmutable();
+}
+
+function groupByFactory(collection, grouper, context) {
+  var isKeyedIter = isKeyed(collection);
+  var groups = (isOrdered(collection) ? OrderedMap() : Map()).asMutable();
+  collection.__iterate(function (v, k) {
+    groups.update(
+      grouper.call(context, v, k, collection),
+      function (a) { return ((a = a || []), a.push(isKeyedIter ? [k, v] : v), a); }
+    );
+  });
+  var coerce = collectionClass(collection);
+  return groups.map(function (arr) { return reify(collection, coerce(arr)); }).asImmutable();
+}
+
+function sliceFactory(collection, begin, end, useKeys) {
+  var originalSize = collection.size;
+
+  if (wholeSlice(begin, end, originalSize)) {
+    return collection;
+  }
+
+  var resolvedBegin = resolveBegin(begin, originalSize);
+  var resolvedEnd = resolveEnd(end, originalSize);
+
+  // begin or end will be NaN if they were provided as negative numbers and
+  // this collection's size is unknown. In that case, cache first so there is
+  // a known size and these do not resolve to NaN.
+  if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) {
+    return sliceFactory(collection.toSeq().cacheResult(), begin, end, useKeys);
+  }
+
+  // Note: resolvedEnd is undefined when the original sequence's length is
+  // unknown and this slice did not supply an end and should contain all
+  // elements after resolvedBegin.
+  // In that case, resolvedSize will be NaN and sliceSize will remain undefined.
+  var resolvedSize = resolvedEnd - resolvedBegin;
+  var sliceSize;
+  if (resolvedSize === resolvedSize) {
+    sliceSize = resolvedSize < 0 ? 0 : resolvedSize;
+  }
+
+  var sliceSeq = makeSequence(collection);
+
+  // If collection.size is undefined, the size of the realized sliceSeq is
+  // unknown at this point unless the number of items to slice is 0
+  sliceSeq.size =
+    sliceSize === 0 ? sliceSize : (collection.size && sliceSize) || undefined;
+
+  if (!useKeys && isSeq(collection) && sliceSize >= 0) {
+    sliceSeq.get = function(index, notSetValue) {
+      index = wrapIndex(this, index);
+      return index >= 0 && index < sliceSize
+        ? collection.get(index + resolvedBegin, notSetValue)
+        : notSetValue;
+    };
+  }
+
+  sliceSeq.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    if (sliceSize === 0) {
+      return 0;
+    }
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var skipped = 0;
+    var isSkipping = true;
+    var iterations = 0;
+    collection.__iterate(function (v, k) {
+      if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {
+        iterations++;
+        return (
+          fn(v, useKeys ? k : iterations - 1, this$1) !== false &&
+          iterations !== sliceSize
+        );
+      }
+    });
+    return iterations;
+  };
+
+  sliceSeq.__iteratorUncached = function(type, reverse) {
+    if (sliceSize !== 0 && reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    // Don't bother instantiating parent iterator if taking 0.
+    if (sliceSize === 0) {
+      return new Iterator(iteratorDone);
+    }
+    var iterator = collection.__iterator(type, reverse);
+    var skipped = 0;
+    var iterations = 0;
+    return new Iterator(function () {
+      while (skipped++ < resolvedBegin) {
+        iterator.next();
+      }
+      if (++iterations > sliceSize) {
+        return iteratorDone();
+      }
+      var step = iterator.next();
+      if (useKeys || type === ITERATE_VALUES || step.done) {
+        return step;
+      }
+      if (type === ITERATE_KEYS) {
+        return iteratorValue(type, iterations - 1, undefined, step);
+      }
+      return iteratorValue(type, iterations - 1, step.value[1], step);
+    });
+  };
+
+  return sliceSeq;
+}
+
+function takeWhileFactory(collection, predicate, context) {
+  var takeSequence = makeSequence(collection);
+  takeSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var iterations = 0;
+    collection.__iterate(
+      function (v, k, c) { return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$1); }
+    );
+    return iterations;
+  };
+  takeSequence.__iteratorUncached = function(type, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
+    var iterating = true;
+    return new Iterator(function () {
+      if (!iterating) {
+        return iteratorDone();
+      }
+      var step = iterator.next();
+      if (step.done) {
+        return step;
+      }
+      var entry = step.value;
+      var k = entry[0];
+      var v = entry[1];
+      if (!predicate.call(context, v, k, this$1)) {
+        iterating = false;
+        return iteratorDone();
+      }
+      return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);
+    });
+  };
+  return takeSequence;
+}
+
+function skipWhileFactory(collection, predicate, context, useKeys) {
+  var skipSequence = makeSequence(collection);
+  skipSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var isSkipping = true;
+    var iterations = 0;
+    collection.__iterate(function (v, k, c) {
+      if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {
+        iterations++;
+        return fn(v, useKeys ? k : iterations - 1, this$1);
+      }
+    });
+    return iterations;
+  };
+  skipSequence.__iteratorUncached = function(type, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
+    var skipping = true;
+    var iterations = 0;
+    return new Iterator(function () {
+      var step;
+      var k;
+      var v;
+      do {
+        step = iterator.next();
+        if (step.done) {
+          if (useKeys || type === ITERATE_VALUES) {
+            return step;
+          }
+          if (type === ITERATE_KEYS) {
+            return iteratorValue(type, iterations++, undefined, step);
+          }
+          return iteratorValue(type, iterations++, step.value[1], step);
+        }
+        var entry = step.value;
+        k = entry[0];
+        v = entry[1];
+        skipping && (skipping = predicate.call(context, v, k, this$1));
+      } while (skipping);
+      return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);
+    });
+  };
+  return skipSequence;
+}
+
+function concatFactory(collection, values) {
+  var isKeyedCollection = isKeyed(collection);
+  var iters = [collection]
+    .concat(values)
+    .map(function (v) {
+      if (!isCollection(v)) {
+        v = isKeyedCollection
+          ? keyedSeqFromValue(v)
+          : indexedSeqFromValue(Array.isArray(v) ? v : [v]);
+      } else if (isKeyedCollection) {
+        v = KeyedCollection(v);
+      }
+      return v;
+    })
+    .filter(function (v) { return v.size !== 0; });
+
+  if (iters.length === 0) {
+    return collection;
+  }
+
+  if (iters.length === 1) {
+    var singleton = iters[0];
+    if (
+      singleton === collection ||
+      (isKeyedCollection && isKeyed(singleton)) ||
+      (isIndexed(collection) && isIndexed(singleton))
+    ) {
+      return singleton;
+    }
+  }
+
+  var concatSeq = new ArraySeq(iters);
+  if (isKeyedCollection) {
+    concatSeq = concatSeq.toKeyedSeq();
+  } else if (!isIndexed(collection)) {
+    concatSeq = concatSeq.toSetSeq();
+  }
+  concatSeq = concatSeq.flatten(true);
+  concatSeq.size = iters.reduce(function (sum, seq) {
+    if (sum !== undefined) {
+      var size = seq.size;
+      if (size !== undefined) {
+        return sum + size;
+      }
+    }
+  }, 0);
+  return concatSeq;
+}
+
+function flattenFactory(collection, depth, useKeys) {
+  var flatSequence = makeSequence(collection);
+  flatSequence.__iterateUncached = function(fn, reverse) {
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var iterations = 0;
+    var stopped = false;
+    function flatDeep(iter, currentDepth) {
+      iter.__iterate(function (v, k) {
+        if ((!depth || currentDepth < depth) && isCollection(v)) {
+          flatDeep(v, currentDepth + 1);
+        } else {
+          iterations++;
+          if (fn(v, useKeys ? k : iterations - 1, flatSequence) === false) {
+            stopped = true;
+          }
+        }
+        return !stopped;
+      }, reverse);
+    }
+    flatDeep(collection, 0);
+    return iterations;
+  };
+  flatSequence.__iteratorUncached = function(type, reverse) {
+    if (reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    var iterator = collection.__iterator(type, reverse);
+    var stack = [];
+    var iterations = 0;
+    return new Iterator(function () {
+      while (iterator) {
+        var step = iterator.next();
+        if (step.done !== false) {
+          iterator = stack.pop();
+          continue;
+        }
+        var v = step.value;
+        if (type === ITERATE_ENTRIES) {
+          v = v[1];
+        }
+        if ((!depth || stack.length < depth) && isCollection(v)) {
+          stack.push(iterator);
+          iterator = v.__iterator(type, reverse);
+        } else {
+          return useKeys ? step : iteratorValue(type, iterations++, v, step);
+        }
+      }
+      return iteratorDone();
+    });
+  };
+  return flatSequence;
+}
+
+function flatMapFactory(collection, mapper, context) {
+  var coerce = collectionClass(collection);
+  return collection
+    .toSeq()
+    .map(function (v, k) { return coerce(mapper.call(context, v, k, collection)); })
+    .flatten(true);
+}
+
+function interposeFactory(collection, separator) {
+  var interposedSequence = makeSequence(collection);
+  interposedSequence.size = collection.size && collection.size * 2 - 1;
+  interposedSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    var iterations = 0;
+    collection.__iterate(
+      function (v) { return (!iterations || fn(separator, iterations++, this$1) !== false) &&
+        fn(v, iterations++, this$1) !== false; },
+      reverse
+    );
+    return iterations;
+  };
+  interposedSequence.__iteratorUncached = function(type, reverse) {
+    var iterator = collection.__iterator(ITERATE_VALUES, reverse);
+    var iterations = 0;
+    var step;
+    return new Iterator(function () {
+      if (!step || iterations % 2) {
+        step = iterator.next();
+        if (step.done) {
+          return step;
+        }
+      }
+      return iterations % 2
+        ? iteratorValue(type, iterations++, separator)
+        : iteratorValue(type, iterations++, step.value, step);
+    });
+  };
+  return interposedSequence;
+}
+
+function sortFactory(collection, comparator, mapper) {
+  if (!comparator) {
+    comparator = defaultComparator;
+  }
+  var isKeyedCollection = isKeyed(collection);
+  var index = 0;
+  var entries = collection
+    .toSeq()
+    .map(function (v, k) { return [k, v, index++, mapper ? mapper(v, k, collection) : v]; })
+    .valueSeq()
+    .toArray();
+  entries.sort(function (a, b) { return comparator(a[3], b[3]) || a[2] - b[2]; }).forEach(
+    isKeyedCollection
+      ? function (v, i) {
+          entries[i].length = 2;
+        }
+      : function (v, i) {
+          entries[i] = v[1];
+        }
+  );
+  return isKeyedCollection
+    ? KeyedSeq(entries)
+    : isIndexed(collection)
+      ? IndexedSeq(entries)
+      : SetSeq(entries);
+}
+
+function maxFactory(collection, comparator, mapper) {
+  if (!comparator) {
+    comparator = defaultComparator;
+  }
+  if (mapper) {
+    var entry = collection
+      .toSeq()
+      .map(function (v, k) { return [v, mapper(v, k, collection)]; })
+      .reduce(function (a, b) { return (maxCompare(comparator, a[1], b[1]) ? b : a); });
+    return entry && entry[0];
+  }
+  return collection.reduce(function (a, b) { return (maxCompare(comparator, a, b) ? b : a); });
+}
+
+function maxCompare(comparator, a, b) {
+  var comp = comparator(b, a);
+  // b is considered the new max if the comparator declares them equal, but
+  // they are not equal and b is in fact a nullish value.
+  return (
+    (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) ||
+    comp > 0
+  );
+}
+
+function zipWithFactory(keyIter, zipper, iters, zipAll) {
+  var zipSequence = makeSequence(keyIter);
+  var sizes = new ArraySeq(iters).map(function (i) { return i.size; });
+  zipSequence.size = zipAll ? sizes.max() : sizes.min();
+  // Note: this a generic base implementation of __iterate in terms of
+  // __iterator which may be more generically useful in the future.
+  zipSequence.__iterate = function(fn, reverse) {
+    /* generic:
+    var iterator = this.__iterator(ITERATE_ENTRIES, reverse);
+    var step;
+    var iterations = 0;
+    while (!(step = iterator.next()).done) {
+      iterations++;
+      if (fn(step.value[1], step.value[0], this) === false) {
+        break;
+      }
+    }
+    return iterations;
+    */
+    // indexed:
+    var iterator = this.__iterator(ITERATE_VALUES, reverse);
+    var step;
+    var iterations = 0;
+    while (!(step = iterator.next()).done) {
+      if (fn(step.value, iterations++, this) === false) {
+        break;
+      }
+    }
+    return iterations;
+  };
+  zipSequence.__iteratorUncached = function(type, reverse) {
+    var iterators = iters.map(
+      function (i) { return ((i = Collection(i)), getIterator(reverse ? i.reverse() : i)); }
+    );
+    var iterations = 0;
+    var isDone = false;
+    return new Iterator(function () {
+      var steps;
+      if (!isDone) {
+        steps = iterators.map(function (i) { return i.next(); });
+        isDone = zipAll ? steps.every(function (s) { return s.done; }) : steps.some(function (s) { return s.done; });
+      }
+      if (isDone) {
+        return iteratorDone();
+      }
+      return iteratorValue(
+        type,
+        iterations++,
+        zipper.apply(null, steps.map(function (s) { return s.value; }))
+      );
+    });
+  };
+  return zipSequence;
+}
+
+// #pragma Helper Functions
+
+function reify(iter, seq) {
+  return iter === seq ? iter : isSeq(iter) ? seq : iter.constructor(seq);
+}
+
+function validateEntry(entry) {
+  if (entry !== Object(entry)) {
+    throw new TypeError('Expected [K, V] tuple: ' + entry);
+  }
+}
+
+function collectionClass(collection) {
+  return isKeyed(collection)
+    ? KeyedCollection
+    : isIndexed(collection)
+      ? IndexedCollection
+      : SetCollection;
+}
+
+function makeSequence(collection) {
+  return Object.create(
+    (isKeyed(collection)
+      ? KeyedSeq
+      : isIndexed(collection)
+        ? IndexedSeq
+        : SetSeq
+    ).prototype
+  );
+}
+
+function cacheResultThrough() {
+  if (this._iter.cacheResult) {
+    this._iter.cacheResult();
+    this.size = this._iter.size;
+    return this;
+  }
+  return Seq.prototype.cacheResult.call(this);
+}
+
+function defaultComparator(a, b) {
+  if (a === undefined && b === undefined) {
+    return 0;
+  }
+
+  if (a === undefined) {
+    return 1;
+  }
+
+  if (b === undefined) {
+    return -1;
+  }
+
+  return a > b ? 1 : a < b ? -1 : 0;
+}
+
+// http://jsperf.com/copy-array-inline
+function arrCopy(arr, offset) {
+  offset = offset || 0;
+  var len = Math.max(0, arr.length - offset);
+  var newArr = new Array(len);
+  for (var ii = 0; ii < len; ii++) {
+    newArr[ii] = arr[ii + offset];
+  }
+  return newArr;
+}
+
+function invariant(condition, error) {
+  if (!condition) { throw new Error(error); }
+}
+
+function assertNotInfinite(size) {
+  invariant(
+    size !== Infinity,
+    'Cannot perform this action with an infinite size.'
+  );
+}
+
+function coerceKeyPath(keyPath) {
+  if (isArrayLike(keyPath) && typeof keyPath !== 'string') {
+    return keyPath;
+  }
+  if (isOrdered(keyPath)) {
+    return keyPath.toArray();
+  }
+  throw new TypeError(
+    'Invalid keyPath: expected Ordered Collection or Array: ' + keyPath
+  );
+}
+
+function isPlainObj(value) {
+  return (
+    value &&
+    (typeof value.constructor !== 'function' ||
+      value.constructor.name === 'Object')
+  );
+}
+
+/**
+ * Returns true if the value is a potentially-persistent data structure, either
+ * provided by Immutable.js or a plain Array or Object.
+ */
+function isDataStructure(value) {
+  return (
+    typeof value === 'object' &&
+    (isImmutable(value) || Array.isArray(value) || isPlainObj(value))
+  );
+}
+
+/**
+ * Converts a value to a string, adding quotes if a string was provided.
+ */
+function quoteString(value) {
+  try {
+    return typeof value === 'string' ? JSON.stringify(value) : String(value);
+  } catch (_ignoreError) {
+    return JSON.stringify(value);
+  }
+}
+
+function has(collection, key) {
+  return isImmutable(collection)
+    ? collection.has(key)
+    : isDataStructure(collection) && hasOwnProperty.call(collection, key);
+}
+
+function get(collection, key, notSetValue) {
+  return isImmutable(collection)
+    ? collection.get(key, notSetValue)
+    : !has(collection, key)
+      ? notSetValue
+      : typeof collection.get === 'function'
+        ? collection.get(key)
+        : collection[key];
+}
+
+function shallowCopy(from) {
+  if (Array.isArray(from)) {
+    return arrCopy(from);
+  }
+  var to = {};
+  for (var key in from) {
+    if (hasOwnProperty.call(from, key)) {
+      to[key] = from[key];
+    }
+  }
+  return to;
+}
+
+function remove(collection, key) {
+  if (!isDataStructure(collection)) {
+    throw new TypeError(
+      'Cannot update non-data-structure value: ' + collection
+    );
+  }
+  if (isImmutable(collection)) {
+    if (!collection.remove) {
+      throw new TypeError(
+        'Cannot update immutable value without .remove() method: ' + collection
+      );
+    }
+    return collection.remove(key);
+  }
+  if (!hasOwnProperty.call(collection, key)) {
+    return collection;
+  }
+  var collectionCopy = shallowCopy(collection);
+  if (Array.isArray(collectionCopy)) {
+    collectionCopy.splice(key, 1);
+  } else {
+    delete collectionCopy[key];
+  }
+  return collectionCopy;
+}
+
+function set(collection, key, value) {
+  if (!isDataStructure(collection)) {
+    throw new TypeError(
+      'Cannot update non-data-structure value: ' + collection
+    );
+  }
+  if (isImmutable(collection)) {
+    if (!collection.set) {
+      throw new TypeError(
+        'Cannot update immutable value without .set() method: ' + collection
+      );
+    }
+    return collection.set(key, value);
+  }
+  if (hasOwnProperty.call(collection, key) && value === collection[key]) {
+    return collection;
+  }
+  var collectionCopy = shallowCopy(collection);
+  collectionCopy[key] = value;
+  return collectionCopy;
+}
+
+function updateIn(collection, keyPath, notSetValue, updater) {
+  if (!updater) {
+    updater = notSetValue;
+    notSetValue = undefined;
+  }
+  var updatedValue = updateInDeeply(
+    isImmutable(collection),
+    collection,
+    coerceKeyPath(keyPath),
+    0,
+    notSetValue,
+    updater
+  );
+  return updatedValue === NOT_SET ? notSetValue : updatedValue;
+}
+
+function updateInDeeply(
+  inImmutable,
+  existing,
+  keyPath,
+  i,
+  notSetValue,
+  updater
+) {
+  var wasNotSet = existing === NOT_SET;
+  if (i === keyPath.length) {
+    var existingValue = wasNotSet ? notSetValue : existing;
+    var newValue = updater(existingValue);
+    return newValue === existingValue ? existing : newValue;
+  }
+  if (!wasNotSet && !isDataStructure(existing)) {
+    throw new TypeError(
+      'Cannot update within non-data-structure value in path [' +
+        keyPath.slice(0, i).map(quoteString) +
+        ']: ' +
+        existing
+    );
+  }
+  var key = keyPath[i];
+  var nextExisting = wasNotSet ? NOT_SET : get(existing, key, NOT_SET);
+  var nextUpdated = updateInDeeply(
+    nextExisting === NOT_SET ? inImmutable : isImmutable(nextExisting),
+    nextExisting,
+    keyPath,
+    i + 1,
+    notSetValue,
+    updater
+  );
+  return nextUpdated === nextExisting
+    ? existing
+    : nextUpdated === NOT_SET
+      ? remove(existing, key)
+      : set(
+          wasNotSet ? (inImmutable ? emptyMap() : {}) : existing,
+          key,
+          nextUpdated
+        );
+}
+
+function setIn(collection, keyPath, value) {
+  return updateIn(collection, keyPath, NOT_SET, function () { return value; });
+}
+
+function setIn$1(keyPath, v) {
+  return setIn(this, keyPath, v);
+}
+
+function removeIn(collection, keyPath) {
+  return updateIn(collection, keyPath, function () { return NOT_SET; });
+}
+
+function deleteIn(keyPath) {
+  return removeIn(this, keyPath);
+}
+
+function update(collection, key, notSetValue, updater) {
+  return updateIn(collection, [key], notSetValue, updater);
+}
+
+function update$1(key, notSetValue, updater) {
+  return arguments.length === 1
+    ? key(this)
+    : update(this, key, notSetValue, updater);
+}
+
+function updateIn$1(keyPath, notSetValue, updater) {
+  return updateIn(this, keyPath, notSetValue, updater);
+}
+
+function merge() {
+  var iters = [], len = arguments.length;
+  while ( len-- ) iters[ len ] = arguments[ len ];
+
+  return mergeIntoKeyedWith(this, iters);
+}
+
+function mergeWith(merger) {
+  var iters = [], len = arguments.length - 1;
+  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
+
+  if (typeof merger !== 'function') {
+    throw new TypeError('Invalid merger function: ' + merger);
+  }
+  return mergeIntoKeyedWith(this, iters, merger);
+}
+
+function mergeIntoKeyedWith(collection, collections, merger) {
+  var iters = [];
+  for (var ii = 0; ii < collections.length; ii++) {
+    var collection$1 = KeyedCollection(collections[ii]);
+    if (collection$1.size !== 0) {
+      iters.push(collection$1);
+    }
+  }
+  if (iters.length === 0) {
+    return collection;
+  }
+  if (
+    collection.toSeq().size === 0 &&
+    !collection.__ownerID &&
+    iters.length === 1
+  ) {
+    return collection.constructor(iters[0]);
+  }
+  return collection.withMutations(function (collection) {
+    var mergeIntoCollection = merger
+      ? function (value, key) {
+          update(
+            collection,
+            key,
+            NOT_SET,
+            function (oldVal) { return (oldVal === NOT_SET ? value : merger(oldVal, value, key)); }
+          );
+        }
+      : function (value, key) {
+          collection.set(key, value);
+        };
+    for (var ii = 0; ii < iters.length; ii++) {
+      iters[ii].forEach(mergeIntoCollection);
+    }
+  });
+}
+
+function merge$1(collection) {
+  var sources = [], len = arguments.length - 1;
+  while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
+
+  return mergeWithSources(collection, sources);
+}
+
+function mergeWith$1(merger, collection) {
+  var sources = [], len = arguments.length - 2;
+  while ( len-- > 0 ) sources[ len ] = arguments[ len + 2 ];
+
+  return mergeWithSources(collection, sources, merger);
+}
+
+function mergeDeep(collection) {
+  var sources = [], len = arguments.length - 1;
+  while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
+
+  return mergeDeepWithSources(collection, sources);
+}
+
+function mergeDeepWith(merger, collection) {
+  var sources = [], len = arguments.length - 2;
+  while ( len-- > 0 ) sources[ len ] = arguments[ len + 2 ];
+
+  return mergeDeepWithSources(collection, sources, merger);
+}
+
+function mergeDeepWithSources(collection, sources, merger) {
+  return mergeWithSources(collection, sources, deepMergerWith(merger));
+}
+
+function mergeWithSources(collection, sources, merger) {
+  if (!isDataStructure(collection)) {
+    throw new TypeError(
+      'Cannot merge into non-data-structure value: ' + collection
+    );
+  }
+  if (isImmutable(collection)) {
+    return typeof merger === 'function' && collection.mergeWith
+      ? collection.mergeWith.apply(collection, [ merger ].concat( sources ))
+      : collection.merge
+        ? collection.merge.apply(collection, sources)
+        : collection.concat.apply(collection, sources);
+  }
+  var isArray = Array.isArray(collection);
+  var merged = collection;
+  var Collection$$1 = isArray ? IndexedCollection : KeyedCollection;
+  var mergeItem = isArray
+    ? function (value) {
+        // Copy on write
+        if (merged === collection) {
+          merged = shallowCopy(merged);
+        }
+        merged.push(value);
+      }
+    : function (value, key) {
+        var hasVal = hasOwnProperty.call(merged, key);
+        var nextVal =
+          hasVal && merger ? merger(merged[key], value, key) : value;
+        if (!hasVal || nextVal !== merged[key]) {
+          // Copy on write
+          if (merged === collection) {
+            merged = shallowCopy(merged);
+          }
+          merged[key] = nextVal;
+        }
+      };
+  for (var i = 0; i < sources.length; i++) {
+    Collection$$1(sources[i]).forEach(mergeItem);
+  }
+  return merged;
+}
+
+function deepMergerWith(merger) {
+  function deepMerger(oldValue, newValue, key) {
+    return isDataStructure(oldValue) && isDataStructure(newValue)
+      ? mergeWithSources(oldValue, [newValue], deepMerger)
+      : merger
+        ? merger(oldValue, newValue, key)
+        : newValue;
+  }
+  return deepMerger;
+}
+
+function mergeDeep$1() {
+  var iters = [], len = arguments.length;
+  while ( len-- ) iters[ len ] = arguments[ len ];
+
+  return mergeDeepWithSources(this, iters);
+}
+
+function mergeDeepWith$1(merger) {
+  var iters = [], len = arguments.length - 1;
+  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
+
+  return mergeDeepWithSources(this, iters, merger);
+}
+
+function mergeIn(keyPath) {
+  var iters = [], len = arguments.length - 1;
+  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
+
+  return updateIn(this, keyPath, emptyMap(), function (m) { return mergeWithSources(m, iters); });
+}
+
+function mergeDeepIn(keyPath) {
+  var iters = [], len = arguments.length - 1;
+  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
+
+  return updateIn(this, keyPath, emptyMap(), function (m) { return mergeDeepWithSources(m, iters); }
+  );
+}
+
+function withMutations(fn) {
+  var mutable = this.asMutable();
+  fn(mutable);
+  return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this;
+}
+
+function asMutable() {
+  return this.__ownerID ? this : this.__ensureOwner(new OwnerID());
+}
+
+function asImmutable() {
+  return this.__ensureOwner();
+}
+
+function wasAltered() {
+  return this.__altered;
+}
+
+var Map = /*@__PURE__*/(function (KeyedCollection$$1) {
+  function Map(value) {
+    return value === null || value === undefined
+      ? emptyMap()
+      : isMap(value) && !isOrdered(value)
+        ? value
+        : emptyMap().withMutations(function (map) {
+            var iter = KeyedCollection$$1(value);
+            assertNotInfinite(iter.size);
+            iter.forEach(function (v, k) { return map.set(k, v); });
+          });
+  }
+
+  if ( KeyedCollection$$1 ) Map.__proto__ = KeyedCollection$$1;
+  Map.prototype = Object.create( KeyedCollection$$1 && KeyedCollection$$1.prototype );
+  Map.prototype.constructor = Map;
+
+  Map.of = function of () {
+    var keyValues = [], len = arguments.length;
+    while ( len-- ) keyValues[ len ] = arguments[ len ];
+
+    return emptyMap().withMutations(function (map) {
+      for (var i = 0; i < keyValues.length; i += 2) {
+        if (i + 1 >= keyValues.length) {
+          throw new Error('Missing value for key: ' + keyValues[i]);
+        }
+        map.set(keyValues[i], keyValues[i + 1]);
+      }
+    });
+  };
+
+  Map.prototype.toString = function toString () {
+    return this.__toString('Map {', '}');
+  };
+
+  // @pragma Access
+
+  Map.prototype.get = function get (k, notSetValue) {
+    return this._root
+      ? this._root.get(0, undefined, k, notSetValue)
+      : notSetValue;
+  };
+
+  // @pragma Modification
+
+  Map.prototype.set = function set (k, v) {
+    return updateMap(this, k, v);
+  };
+
+  Map.prototype.remove = function remove (k) {
+    return updateMap(this, k, NOT_SET);
+  };
+
+  Map.prototype.deleteAll = function deleteAll (keys) {
+    var collection = Collection(keys);
+
+    if (collection.size === 0) {
+      return this;
+    }
+
+    return this.withMutations(function (map) {
+      collection.forEach(function (key) { return map.remove(key); });
+    });
+  };
+
+  Map.prototype.clear = function clear () {
+    if (this.size === 0) {
+      return this;
+    }
+    if (this.__ownerID) {
+      this.size = 0;
+      this._root = null;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return emptyMap();
+  };
+
+  // @pragma Composition
+
+  Map.prototype.sort = function sort (comparator) {
+    // Late binding
+    return OrderedMap(sortFactory(this, comparator));
+  };
+
+  Map.prototype.sortBy = function sortBy (mapper, comparator) {
+    // Late binding
+    return OrderedMap(sortFactory(this, comparator, mapper));
+  };
+
+  Map.prototype.map = function map (mapper, context) {
+    return this.withMutations(function (map) {
+      map.forEach(function (value, key) {
+        map.set(key, mapper.call(context, value, key, map));
+      });
+    });
+  };
+
+  // @pragma Mutability
+
+  Map.prototype.__iterator = function __iterator (type, reverse) {
+    return new MapIterator(this, type, reverse);
+  };
+
+  Map.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    var iterations = 0;
+    this._root &&
+      this._root.iterate(function (entry) {
+        iterations++;
+        return fn(entry[1], entry[0], this$1);
+      }, reverse);
+    return iterations;
+  };
+
+  Map.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    if (!ownerID) {
+      if (this.size === 0) {
+        return emptyMap();
+      }
+      this.__ownerID = ownerID;
+      this.__altered = false;
+      return this;
+    }
+    return makeMap(this.size, this._root, ownerID, this.__hash);
+  };
+
+  return Map;
+}(KeyedCollection));
+
+Map.isMap = isMap;
+
+var MapPrototype = Map.prototype;
+MapPrototype[IS_MAP_SYMBOL] = true;
+MapPrototype[DELETE] = MapPrototype.remove;
+MapPrototype.removeAll = MapPrototype.deleteAll;
+MapPrototype.setIn = setIn$1;
+MapPrototype.removeIn = MapPrototype.deleteIn = deleteIn;
+MapPrototype.update = update$1;
+MapPrototype.updateIn = updateIn$1;
+MapPrototype.merge = MapPrototype.concat = merge;
+MapPrototype.mergeWith = mergeWith;
+MapPrototype.mergeDeep = mergeDeep$1;
+MapPrototype.mergeDeepWith = mergeDeepWith$1;
+MapPrototype.mergeIn = mergeIn;
+MapPrototype.mergeDeepIn = mergeDeepIn;
+MapPrototype.withMutations = withMutations;
+MapPrototype.wasAltered = wasAltered;
+MapPrototype.asImmutable = asImmutable;
+MapPrototype['@@transducer/init'] = MapPrototype.asMutable = asMutable;
+MapPrototype['@@transducer/step'] = function(result, arr) {
+  return result.set(arr[0], arr[1]);
+};
+MapPrototype['@@transducer/result'] = function(obj) {
+  return obj.asImmutable();
+};
+
+// #pragma Trie Nodes
+
+var ArrayMapNode = function ArrayMapNode(ownerID, entries) {
+  this.ownerID = ownerID;
+  this.entries = entries;
+};
+
+ArrayMapNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  var entries = this.entries;
+  for (var ii = 0, len = entries.length; ii < len; ii++) {
+    if (is(key, entries[ii][0])) {
+      return entries[ii][1];
+    }
+  }
+  return notSetValue;
+};
+
+ArrayMapNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  var removed = value === NOT_SET;
+
+  var entries = this.entries;
+  var idx = 0;
+  var len = entries.length;
+  for (; idx < len; idx++) {
+    if (is(key, entries[idx][0])) {
+      break;
+    }
+  }
+  var exists = idx < len;
+
+  if (exists ? entries[idx][1] === value : removed) {
+    return this;
+  }
+
+  SetRef(didAlter);
+  (removed || !exists) && SetRef(didChangeSize);
+
+  if (removed && entries.length === 1) {
+    return; // undefined
+  }
+
+  if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) {
+    return createNodes(ownerID, entries, key, value);
+  }
+
+  var isEditable = ownerID && ownerID === this.ownerID;
+  var newEntries = isEditable ? entries : arrCopy(entries);
+
+  if (exists) {
+    if (removed) {
+      idx === len - 1
+        ? newEntries.pop()
+        : (newEntries[idx] = newEntries.pop());
+    } else {
+      newEntries[idx] = [key, value];
+    }
+  } else {
+    newEntries.push([key, value]);
+  }
+
+  if (isEditable) {
+    this.entries = newEntries;
+    return this;
+  }
+
+  return new ArrayMapNode(ownerID, newEntries);
+};
+
+var BitmapIndexedNode = function BitmapIndexedNode(ownerID, bitmap, nodes) {
+  this.ownerID = ownerID;
+  this.bitmap = bitmap;
+  this.nodes = nodes;
+};
+
+BitmapIndexedNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+  var bit = 1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK);
+  var bitmap = this.bitmap;
+  return (bitmap & bit) === 0
+    ? notSetValue
+    : this.nodes[popCount(bitmap & (bit - 1))].get(
+        shift + SHIFT,
+        keyHash,
+        key,
+        notSetValue
+      );
+};
+
+BitmapIndexedNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+  var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
+  var bit = 1 << keyHashFrag;
+  var bitmap = this.bitmap;
+  var exists = (bitmap & bit) !== 0;
+
+  if (!exists && value === NOT_SET) {
+    return this;
+  }
+
+  var idx = popCount(bitmap & (bit - 1));
+  var nodes = this.nodes;
+  var node = exists ? nodes[idx] : undefined;
+  var newNode = updateNode(
+    node,
+    ownerID,
+    shift + SHIFT,
+    keyHash,
+    key,
+    value,
+    didChangeSize,
+    didAlter
+  );
+
+  if (newNode === node) {
+    return this;
+  }
+
+  if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {
+    return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode);
+  }
+
+  if (
+    exists &&
+    !newNode &&
+    nodes.length === 2 &&
+    isLeafNode(nodes[idx ^ 1])
+  ) {
+    return nodes[idx ^ 1];
+  }
+
+  if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) {
+    return newNode;
+  }
+
+  var isEditable = ownerID && ownerID === this.ownerID;
+  var newBitmap = exists ? (newNode ? bitmap : bitmap ^ bit) : bitmap | bit;
+  var newNodes = exists
+    ? newNode
+      ? setAt(nodes, idx, newNode, isEditable)
+      : spliceOut(nodes, idx, isEditable)
+    : spliceIn(nodes, idx, newNode, isEditable);
+
+  if (isEditable) {
+    this.bitmap = newBitmap;
+    this.nodes = newNodes;
+    return this;
+  }
+
+  return new BitmapIndexedNode(ownerID, newBitmap, newNodes);
+};
+
+var HashArrayMapNode = function HashArrayMapNode(ownerID, count, nodes) {
+  this.ownerID = ownerID;
+  this.count = count;
+  this.nodes = nodes;
+};
+
+HashArrayMapNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+  var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
+  var node = this.nodes[idx];
+  return node
+    ? node.get(shift + SHIFT, keyHash, key, notSetValue)
+    : notSetValue;
+};
+
+HashArrayMapNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+  var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
+  var removed = value === NOT_SET;
+  var nodes = this.nodes;
+  var node = nodes[idx];
+
+  if (removed && !node) {
+    return this;
+  }
+
+  var newNode = updateNode(
+    node,
+    ownerID,
+    shift + SHIFT,
+    keyHash,
+    key,
+    value,
+    didChangeSize,
+    didAlter
+  );
+  if (newNode === node) {
+    return this;
+  }
+
+  var newCount = this.count;
+  if (!node) {
+    newCount++;
+  } else if (!newNode) {
+    newCount--;
+    if (newCount < MIN_HASH_ARRAY_MAP_SIZE) {
+      return packNodes(ownerID, nodes, newCount, idx);
+    }
+  }
+
+  var isEditable = ownerID && ownerID === this.ownerID;
+  var newNodes = setAt(nodes, idx, newNode, isEditable);
+
+  if (isEditable) {
+    this.count = newCount;
+    this.nodes = newNodes;
+    return this;
+  }
+
+  return new HashArrayMapNode(ownerID, newCount, newNodes);
+};
+
+var HashCollisionNode = function HashCollisionNode(ownerID, keyHash, entries) {
+  this.ownerID = ownerID;
+  this.keyHash = keyHash;
+  this.entries = entries;
+};
+
+HashCollisionNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  var entries = this.entries;
+  for (var ii = 0, len = entries.length; ii < len; ii++) {
+    if (is(key, entries[ii][0])) {
+      return entries[ii][1];
+    }
+  }
+  return notSetValue;
+};
+
+HashCollisionNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+
+  var removed = value === NOT_SET;
+
+  if (keyHash !== this.keyHash) {
+    if (removed) {
+      return this;
+    }
+    SetRef(didAlter);
+    SetRef(didChangeSize);
+    return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]);
+  }
+
+  var entries = this.entries;
+  var idx = 0;
+  var len = entries.length;
+  for (; idx < len; idx++) {
+    if (is(key, entries[idx][0])) {
+      break;
+    }
+  }
+  var exists = idx < len;
+
+  if (exists ? entries[idx][1] === value : removed) {
+    return this;
+  }
+
+  SetRef(didAlter);
+  (removed || !exists) && SetRef(didChangeSize);
+
+  if (removed && len === 2) {
+    return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]);
+  }
+
+  var isEditable = ownerID && ownerID === this.ownerID;
+  var newEntries = isEditable ? entries : arrCopy(entries);
+
+  if (exists) {
+    if (removed) {
+      idx === len - 1
+        ? newEntries.pop()
+        : (newEntries[idx] = newEntries.pop());
+    } else {
+      newEntries[idx] = [key, value];
+    }
+  } else {
+    newEntries.push([key, value]);
+  }
+
+  if (isEditable) {
+    this.entries = newEntries;
+    return this;
+  }
+
+  return new HashCollisionNode(ownerID, this.keyHash, newEntries);
+};
+
+var ValueNode = function ValueNode(ownerID, keyHash, entry) {
+  this.ownerID = ownerID;
+  this.keyHash = keyHash;
+  this.entry = entry;
+};
+
+ValueNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  return is(key, this.entry[0]) ? this.entry[1] : notSetValue;
+};
+
+ValueNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  var removed = value === NOT_SET;
+  var keyMatch = is(key, this.entry[0]);
+  if (keyMatch ? value === this.entry[1] : removed) {
+    return this;
+  }
+
+  SetRef(didAlter);
+
+  if (removed) {
+    SetRef(didChangeSize);
+    return; // undefined
+  }
+
+  if (keyMatch) {
+    if (ownerID && ownerID === this.ownerID) {
+      this.entry[1] = value;
+      return this;
+    }
+    return new ValueNode(ownerID, this.keyHash, [key, value]);
+  }
+
+  SetRef(didChangeSize);
+  return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]);
+};
+
+// #pragma Iterators
+
+ArrayMapNode.prototype.iterate = HashCollisionNode.prototype.iterate = function(
+  fn,
+  reverse
+) {
+  var entries = this.entries;
+  for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {
+    if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {
+      return false;
+    }
+  }
+};
+
+BitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate = function(
+  fn,
+  reverse
+) {
+  var nodes = this.nodes;
+  for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {
+    var node = nodes[reverse ? maxIndex - ii : ii];
+    if (node && node.iterate(fn, reverse) === false) {
+      return false;
+    }
+  }
+};
+
+// eslint-disable-next-line no-unused-vars
+ValueNode.prototype.iterate = function(fn, reverse) {
+  return fn(this.entry);
+};
+
+var MapIterator = /*@__PURE__*/(function (Iterator$$1) {
+  function MapIterator(map, type, reverse) {
+    this._type = type;
+    this._reverse = reverse;
+    this._stack = map._root && mapIteratorFrame(map._root);
+  }
+
+  if ( Iterator$$1 ) MapIterator.__proto__ = Iterator$$1;
+  MapIterator.prototype = Object.create( Iterator$$1 && Iterator$$1.prototype );
+  MapIterator.prototype.constructor = MapIterator;
+
+  MapIterator.prototype.next = function next () {
+    var type = this._type;
+    var stack = this._stack;
+    while (stack) {
+      var node = stack.node;
+      var index = stack.index++;
+      var maxIndex = (void 0);
+      if (node.entry) {
+        if (index === 0) {
+          return mapIteratorValue(type, node.entry);
+        }
+      } else if (node.entries) {
+        maxIndex = node.entries.length - 1;
+        if (index <= maxIndex) {
+          return mapIteratorValue(
+            type,
+            node.entries[this._reverse ? maxIndex - index : index]
+          );
+        }
+      } else {
+        maxIndex = node.nodes.length - 1;
+        if (index <= maxIndex) {
+          var subNode = node.nodes[this._reverse ? maxIndex - index : index];
+          if (subNode) {
+            if (subNode.entry) {
+              return mapIteratorValue(type, subNode.entry);
+            }
+            stack = this._stack = mapIteratorFrame(subNode, stack);
+          }
+          continue;
+        }
+      }
+      stack = this._stack = this._stack.__prev;
+    }
+    return iteratorDone();
+  };
+
+  return MapIterator;
+}(Iterator));
+
+function mapIteratorValue(type, entry) {
+  return iteratorValue(type, entry[0], entry[1]);
+}
+
+function mapIteratorFrame(node, prev) {
+  return {
+    node: node,
+    index: 0,
+    __prev: prev,
+  };
+}
+
+function makeMap(size, root, ownerID, hash$$1) {
+  var map = Object.create(MapPrototype);
+  map.size = size;
+  map._root = root;
+  map.__ownerID = ownerID;
+  map.__hash = hash$$1;
+  map.__altered = false;
+  return map;
+}
+
+var EMPTY_MAP;
+function emptyMap() {
+  return EMPTY_MAP || (EMPTY_MAP = makeMap(0));
+}
+
+function updateMap(map, k, v) {
+  var newRoot;
+  var newSize;
+  if (!map._root) {
+    if (v === NOT_SET) {
+      return map;
+    }
+    newSize = 1;
+    newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]);
+  } else {
+    var didChangeSize = MakeRef();
+    var didAlter = MakeRef();
+    newRoot = updateNode(
+      map._root,
+      map.__ownerID,
+      0,
+      undefined,
+      k,
+      v,
+      didChangeSize,
+      didAlter
+    );
+    if (!didAlter.value) {
+      return map;
+    }
+    newSize = map.size + (didChangeSize.value ? (v === NOT_SET ? -1 : 1) : 0);
+  }
+  if (map.__ownerID) {
+    map.size = newSize;
+    map._root = newRoot;
+    map.__hash = undefined;
+    map.__altered = true;
+    return map;
+  }
+  return newRoot ? makeMap(newSize, newRoot) : emptyMap();
+}
+
+function updateNode(
+  node,
+  ownerID,
+  shift,
+  keyHash,
+  key,
+  value,
+  didChangeSize,
+  didAlter
+) {
+  if (!node) {
+    if (value === NOT_SET) {
+      return node;
+    }
+    SetRef(didAlter);
+    SetRef(didChangeSize);
+    return new ValueNode(ownerID, keyHash, [key, value]);
+  }
+  return node.update(
+    ownerID,
+    shift,
+    keyHash,
+    key,
+    value,
+    didChangeSize,
+    didAlter
+  );
+}
+
+function isLeafNode(node) {
+  return (
+    node.constructor === ValueNode || node.constructor === HashCollisionNode
+  );
+}
+
+function mergeIntoNode(node, ownerID, shift, keyHash, entry) {
+  if (node.keyHash === keyHash) {
+    return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]);
+  }
+
+  var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK;
+  var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
+
+  var newNode;
+  var nodes =
+    idx1 === idx2
+      ? [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)]
+      : ((newNode = new ValueNode(ownerID, keyHash, entry)),
+        idx1 < idx2 ? [node, newNode] : [newNode, node]);
+
+  return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes);
+}
+
+function createNodes(ownerID, entries, key, value) {
+  if (!ownerID) {
+    ownerID = new OwnerID();
+  }
+  var node = new ValueNode(ownerID, hash(key), [key, value]);
+  for (var ii = 0; ii < entries.length; ii++) {
+    var entry = entries[ii];
+    node = node.update(ownerID, 0, undefined, entry[0], entry[1]);
+  }
+  return node;
+}
+
+function packNodes(ownerID, nodes, count, excluding) {
+  var bitmap = 0;
+  var packedII = 0;
+  var packedNodes = new Array(count);
+  for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) {
+    var node = nodes[ii];
+    if (node !== undefined && ii !== excluding) {
+      bitmap |= bit;
+      packedNodes[packedII++] = node;
+    }
+  }
+  return new BitmapIndexedNode(ownerID, bitmap, packedNodes);
+}
+
+function expandNodes(ownerID, nodes, bitmap, including, node) {
+  var count = 0;
+  var expandedNodes = new Array(SIZE);
+  for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) {
+    expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined;
+  }
+  expandedNodes[including] = node;
+  return new HashArrayMapNode(ownerID, count + 1, expandedNodes);
+}
+
+function popCount(x) {
+  x -= (x >> 1) & 0x55555555;
+  x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
+  x = (x + (x >> 4)) & 0x0f0f0f0f;
+  x += x >> 8;
+  x += x >> 16;
+  return x & 0x7f;
+}
+
+function setAt(array, idx, val, canEdit) {
+  var newArray = canEdit ? array : arrCopy(array);
+  newArray[idx] = val;
+  return newArray;
+}
+
+function spliceIn(array, idx, val, canEdit) {
+  var newLen = array.length + 1;
+  if (canEdit && idx + 1 === newLen) {
+    array[idx] = val;
+    return array;
+  }
+  var newArray = new Array(newLen);
+  var after = 0;
+  for (var ii = 0; ii < newLen; ii++) {
+    if (ii === idx) {
+      newArray[ii] = val;
+      after = -1;
+    } else {
+      newArray[ii] = array[ii + after];
+    }
+  }
+  return newArray;
+}
+
+function spliceOut(array, idx, canEdit) {
+  var newLen = array.length - 1;
+  if (canEdit && idx === newLen) {
+    array.pop();
+    return array;
+  }
+  var newArray = new Array(newLen);
+  var after = 0;
+  for (var ii = 0; ii < newLen; ii++) {
+    if (ii === idx) {
+      after = 1;
+    }
+    newArray[ii] = array[ii + after];
+  }
+  return newArray;
+}
+
+var MAX_ARRAY_MAP_SIZE = SIZE / 4;
+var MAX_BITMAP_INDEXED_SIZE = SIZE / 2;
+var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;
+
+var IS_LIST_SYMBOL = '@@__IMMUTABLE_LIST__@@';
+
+function isList(maybeList) {
+  return Boolean(maybeList && maybeList[IS_LIST_SYMBOL]);
+}
+
+var List = /*@__PURE__*/(function (IndexedCollection$$1) {
+  function List(value) {
+    var empty = emptyList();
+    if (value === null || value === undefined) {
+      return empty;
+    }
+    if (isList(value)) {
+      return value;
+    }
+    var iter = IndexedCollection$$1(value);
+    var size = iter.size;
+    if (size === 0) {
+      return empty;
+    }
+    assertNotInfinite(size);
+    if (size > 0 && size < SIZE) {
+      return makeList(0, size, SHIFT, null, new VNode(iter.toArray()));
+    }
+    return empty.withMutations(function (list) {
+      list.setSize(size);
+      iter.forEach(function (v, i) { return list.set(i, v); });
+    });
+  }
+
+  if ( IndexedCollection$$1 ) List.__proto__ = IndexedCollection$$1;
+  List.prototype = Object.create( IndexedCollection$$1 && IndexedCollection$$1.prototype );
+  List.prototype.constructor = List;
+
+  List.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  List.prototype.toString = function toString () {
+    return this.__toString('List [', ']');
+  };
+
+  // @pragma Access
+
+  List.prototype.get = function get (index, notSetValue) {
+    index = wrapIndex(this, index);
+    if (index >= 0 && index < this.size) {
+      index += this._origin;
+      var node = listNodeFor(this, index);
+      return node && node.array[index & MASK];
+    }
+    return notSetValue;
+  };
+
+  // @pragma Modification
+
+  List.prototype.set = function set (index, value) {
+    return updateList(this, index, value);
+  };
+
+  List.prototype.remove = function remove (index) {
+    return !this.has(index)
+      ? this
+      : index === 0
+        ? this.shift()
+        : index === this.size - 1
+          ? this.pop()
+          : this.splice(index, 1);
+  };
+
+  List.prototype.insert = function insert (index, value) {
+    return this.splice(index, 0, value);
+  };
+
+  List.prototype.clear = function clear () {
+    if (this.size === 0) {
+      return this;
+    }
+    if (this.__ownerID) {
+      this.size = this._origin = this._capacity = 0;
+      this._level = SHIFT;
+      this._root = this._tail = null;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return emptyList();
+  };
+
+  List.prototype.push = function push (/*...values*/) {
+    var values = arguments;
+    var oldSize = this.size;
+    return this.withMutations(function (list) {
+      setListBounds(list, 0, oldSize + values.length);
+      for (var ii = 0; ii < values.length; ii++) {
+        list.set(oldSize + ii, values[ii]);
+      }
+    });
+  };
+
+  List.prototype.pop = function pop () {
+    return setListBounds(this, 0, -1);
+  };
+
+  List.prototype.unshift = function unshift (/*...values*/) {
+    var values = arguments;
+    return this.withMutations(function (list) {
+      setListBounds(list, -values.length);
+      for (var ii = 0; ii < values.length; ii++) {
+        list.set(ii, values[ii]);
+      }
+    });
+  };
+
+  List.prototype.shift = function shift () {
+    return setListBounds(this, 1);
+  };
+
+  // @pragma Composition
+
+  List.prototype.concat = function concat (/*...collections*/) {
+    var arguments$1 = arguments;
+
+    var seqs = [];
+    for (var i = 0; i < arguments.length; i++) {
+      var argument = arguments$1[i];
+      var seq = IndexedCollection$$1(
+        typeof argument !== 'string' && hasIterator(argument)
+          ? argument
+          : [argument]
+      );
+      if (seq.size !== 0) {
+        seqs.push(seq);
+      }
+    }
+    if (seqs.length === 0) {
+      return this;
+    }
+    if (this.size === 0 && !this.__ownerID && seqs.length === 1) {
+      return this.constructor(seqs[0]);
+    }
+    return this.withMutations(function (list) {
+      seqs.forEach(function (seq) { return seq.forEach(function (value) { return list.push(value); }); });
+    });
+  };
+
+  List.prototype.setSize = function setSize (size) {
+    return setListBounds(this, 0, size);
+  };
+
+  List.prototype.map = function map (mapper, context) {
+    var this$1 = this;
+
+    return this.withMutations(function (list) {
+      for (var i = 0; i < this$1.size; i++) {
+        list.set(i, mapper.call(context, list.get(i), i, list));
+      }
+    });
+  };
+
+  // @pragma Iteration
+
+  List.prototype.slice = function slice (begin, end) {
+    var size = this.size;
+    if (wholeSlice(begin, end, size)) {
+      return this;
+    }
+    return setListBounds(
+      this,
+      resolveBegin(begin, size),
+      resolveEnd(end, size)
+    );
+  };
+
+  List.prototype.__iterator = function __iterator (type, reverse) {
+    var index = reverse ? this.size : 0;
+    var values = iterateList(this, reverse);
+    return new Iterator(function () {
+      var value = values();
+      return value === DONE
+        ? iteratorDone()
+        : iteratorValue(type, reverse ? --index : index++, value);
+    });
+  };
+
+  List.prototype.__iterate = function __iterate (fn, reverse) {
+    var index = reverse ? this.size : 0;
+    var values = iterateList(this, reverse);
+    var value;
+    while ((value = values()) !== DONE) {
+      if (fn(value, reverse ? --index : index++, this) === false) {
+        break;
+      }
+    }
+    return index;
+  };
+
+  List.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    if (!ownerID) {
+      if (this.size === 0) {
+        return emptyList();
+      }
+      this.__ownerID = ownerID;
+      this.__altered = false;
+      return this;
+    }
+    return makeList(
+      this._origin,
+      this._capacity,
+      this._level,
+      this._root,
+      this._tail,
+      ownerID,
+      this.__hash
+    );
+  };
+
+  return List;
+}(IndexedCollection));
+
+List.isList = isList;
+
+var ListPrototype = List.prototype;
+ListPrototype[IS_LIST_SYMBOL] = true;
+ListPrototype[DELETE] = ListPrototype.remove;
+ListPrototype.merge = ListPrototype.concat;
+ListPrototype.setIn = setIn$1;
+ListPrototype.deleteIn = ListPrototype.removeIn = deleteIn;
+ListPrototype.update = update$1;
+ListPrototype.updateIn = updateIn$1;
+ListPrototype.mergeIn = mergeIn;
+ListPrototype.mergeDeepIn = mergeDeepIn;
+ListPrototype.withMutations = withMutations;
+ListPrototype.wasAltered = wasAltered;
+ListPrototype.asImmutable = asImmutable;
+ListPrototype['@@transducer/init'] = ListPrototype.asMutable = asMutable;
+ListPrototype['@@transducer/step'] = function(result, arr) {
+  return result.push(arr);
+};
+ListPrototype['@@transducer/result'] = function(obj) {
+  return obj.asImmutable();
+};
+
+var VNode = function VNode(array, ownerID) {
+  this.array = array;
+  this.ownerID = ownerID;
+};
+
+// TODO: seems like these methods are very similar
+
+VNode.prototype.removeBefore = function removeBefore (ownerID, level, index) {
+  if (index === level ? 1 << level : this.array.length === 0) {
+    return this;
+  }
+  var originIndex = (index >>> level) & MASK;
+  if (originIndex >= this.array.length) {
+    return new VNode([], ownerID);
+  }
+  var removingFirst = originIndex === 0;
+  var newChild;
+  if (level > 0) {
+    var oldChild = this.array[originIndex];
+    newChild =
+      oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index);
+    if (newChild === oldChild && removingFirst) {
+      return this;
+    }
+  }
+  if (removingFirst && !newChild) {
+    return this;
+  }
+  var editable = editableVNode(this, ownerID);
+  if (!removingFirst) {
+    for (var ii = 0; ii < originIndex; ii++) {
+      editable.array[ii] = undefined;
+    }
+  }
+  if (newChild) {
+    editable.array[originIndex] = newChild;
+  }
+  return editable;
+};
+
+VNode.prototype.removeAfter = function removeAfter (ownerID, level, index) {
+  if (index === (level ? 1 << level : 0) || this.array.length === 0) {
+    return this;
+  }
+  var sizeIndex = ((index - 1) >>> level) & MASK;
+  if (sizeIndex >= this.array.length) {
+    return this;
+  }
+
+  var newChild;
+  if (level > 0) {
+    var oldChild = this.array[sizeIndex];
+    newChild =
+      oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index);
+    if (newChild === oldChild && sizeIndex === this.array.length - 1) {
+      return this;
+    }
+  }
+
+  var editable = editableVNode(this, ownerID);
+  editable.array.splice(sizeIndex + 1);
+  if (newChild) {
+    editable.array[sizeIndex] = newChild;
+  }
+  return editable;
+};
+
+var DONE = {};
+
+function iterateList(list, reverse) {
+  var left = list._origin;
+  var right = list._capacity;
+  var tailPos = getTailOffset(right);
+  var tail = list._tail;
+
+  return iterateNodeOrLeaf(list._root, list._level, 0);
+
+  function iterateNodeOrLeaf(node, level, offset) {
+    return level === 0
+      ? iterateLeaf(node, offset)
+      : iterateNode(node, level, offset);
+  }
+
+  function iterateLeaf(node, offset) {
+    var array = offset === tailPos ? tail && tail.array : node && node.array;
+    var from = offset > left ? 0 : left - offset;
+    var to = right - offset;
+    if (to > SIZE) {
+      to = SIZE;
+    }
+    return function () {
+      if (from === to) {
+        return DONE;
+      }
+      var idx = reverse ? --to : from++;
+      return array && array[idx];
+    };
+  }
+
+  function iterateNode(node, level, offset) {
+    var values;
+    var array = node && node.array;
+    var from = offset > left ? 0 : (left - offset) >> level;
+    var to = ((right - offset) >> level) + 1;
+    if (to > SIZE) {
+      to = SIZE;
+    }
+    return function () {
+      while (true) {
+        if (values) {
+          var value = values();
+          if (value !== DONE) {
+            return value;
+          }
+          values = null;
+        }
+        if (from === to) {
+          return DONE;
+        }
+        var idx = reverse ? --to : from++;
+        values = iterateNodeOrLeaf(
+          array && array[idx],
+          level - SHIFT,
+          offset + (idx << level)
+        );
+      }
+    };
+  }
+}
+
+function makeList(origin, capacity, level, root, tail, ownerID, hash) {
+  var list = Object.create(ListPrototype);
+  list.size = capacity - origin;
+  list._origin = origin;
+  list._capacity = capacity;
+  list._level = level;
+  list._root = root;
+  list._tail = tail;
+  list.__ownerID = ownerID;
+  list.__hash = hash;
+  list.__altered = false;
+  return list;
+}
+
+var EMPTY_LIST;
+function emptyList() {
+  return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT));
+}
+
+function updateList(list, index, value) {
+  index = wrapIndex(list, index);
+
+  if (index !== index) {
+    return list;
+  }
+
+  if (index >= list.size || index < 0) {
+    return list.withMutations(function (list) {
+      index < 0
+        ? setListBounds(list, index).set(0, value)
+        : setListBounds(list, 0, index + 1).set(index, value);
+    });
+  }
+
+  index += list._origin;
+
+  var newTail = list._tail;
+  var newRoot = list._root;
+  var didAlter = MakeRef();
+  if (index >= getTailOffset(list._capacity)) {
+    newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter);
+  } else {
+    newRoot = updateVNode(
+      newRoot,
+      list.__ownerID,
+      list._level,
+      index,
+      value,
+      didAlter
+    );
+  }
+
+  if (!didAlter.value) {
+    return list;
+  }
+
+  if (list.__ownerID) {
+    list._root = newRoot;
+    list._tail = newTail;
+    list.__hash = undefined;
+    list.__altered = true;
+    return list;
+  }
+  return makeList(list._origin, list._capacity, list._level, newRoot, newTail);
+}
+
+function updateVNode(node, ownerID, level, index, value, didAlter) {
+  var idx = (index >>> level) & MASK;
+  var nodeHas = node && idx < node.array.length;
+  if (!nodeHas && value === undefined) {
+    return node;
+  }
+
+  var newNode;
+
+  if (level > 0) {
+    var lowerNode = node && node.array[idx];
+    var newLowerNode = updateVNode(
+      lowerNode,
+      ownerID,
+      level - SHIFT,
+      index,
+      value,
+      didAlter
+    );
+    if (newLowerNode === lowerNode) {
+      return node;
+    }
+    newNode = editableVNode(node, ownerID);
+    newNode.array[idx] = newLowerNode;
+    return newNode;
+  }
+
+  if (nodeHas && node.array[idx] === value) {
+    return node;
+  }
+
+  if (didAlter) {
+    SetRef(didAlter);
+  }
+
+  newNode = editableVNode(node, ownerID);
+  if (value === undefined && idx === newNode.array.length - 1) {
+    newNode.array.pop();
+  } else {
+    newNode.array[idx] = value;
+  }
+  return newNode;
+}
+
+function editableVNode(node, ownerID) {
+  if (ownerID && node && ownerID === node.ownerID) {
+    return node;
+  }
+  return new VNode(node ? node.array.slice() : [], ownerID);
+}
+
+function listNodeFor(list, rawIndex) {
+  if (rawIndex >= getTailOffset(list._capacity)) {
+    return list._tail;
+  }
+  if (rawIndex < 1 << (list._level + SHIFT)) {
+    var node = list._root;
+    var level = list._level;
+    while (node && level > 0) {
+      node = node.array[(rawIndex >>> level) & MASK];
+      level -= SHIFT;
+    }
+    return node;
+  }
+}
+
+function setListBounds(list, begin, end) {
+  // Sanitize begin & end using this shorthand for ToInt32(argument)
+  // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32
+  if (begin !== undefined) {
+    begin |= 0;
+  }
+  if (end !== undefined) {
+    end |= 0;
+  }
+  var owner = list.__ownerID || new OwnerID();
+  var oldOrigin = list._origin;
+  var oldCapacity = list._capacity;
+  var newOrigin = oldOrigin + begin;
+  var newCapacity =
+    end === undefined
+      ? oldCapacity
+      : end < 0
+        ? oldCapacity + end
+        : oldOrigin + end;
+  if (newOrigin === oldOrigin && newCapacity === oldCapacity) {
+    return list;
+  }
+
+  // If it's going to end after it starts, it's empty.
+  if (newOrigin >= newCapacity) {
+    return list.clear();
+  }
+
+  var newLevel = list._level;
+  var newRoot = list._root;
+
+  // New origin might need creating a higher root.
+  var offsetShift = 0;
+  while (newOrigin + offsetShift < 0) {
+    newRoot = new VNode(
+      newRoot && newRoot.array.length ? [undefined, newRoot] : [],
+      owner
+    );
+    newLevel += SHIFT;
+    offsetShift += 1 << newLevel;
+  }
+  if (offsetShift) {
+    newOrigin += offsetShift;
+    oldOrigin += offsetShift;
+    newCapacity += offsetShift;
+    oldCapacity += offsetShift;
+  }
+
+  var oldTailOffset = getTailOffset(oldCapacity);
+  var newTailOffset = getTailOffset(newCapacity);
+
+  // New size might need creating a higher root.
+  while (newTailOffset >= 1 << (newLevel + SHIFT)) {
+    newRoot = new VNode(
+      newRoot && newRoot.array.length ? [newRoot] : [],
+      owner
+    );
+    newLevel += SHIFT;
+  }
+
+  // Locate or create the new tail.
+  var oldTail = list._tail;
+  var newTail =
+    newTailOffset < oldTailOffset
+      ? listNodeFor(list, newCapacity - 1)
+      : newTailOffset > oldTailOffset
+        ? new VNode([], owner)
+        : oldTail;
+
+  // Merge Tail into tree.
+  if (
+    oldTail &&
+    newTailOffset > oldTailOffset &&
+    newOrigin < oldCapacity &&
+    oldTail.array.length
+  ) {
+    newRoot = editableVNode(newRoot, owner);
+    var node = newRoot;
+    for (var level = newLevel; level > SHIFT; level -= SHIFT) {
+      var idx = (oldTailOffset >>> level) & MASK;
+      node = node.array[idx] = editableVNode(node.array[idx], owner);
+    }
+    node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail;
+  }
+
+  // If the size has been reduced, there's a chance the tail needs to be trimmed.
+  if (newCapacity < oldCapacity) {
+    newTail = newTail && newTail.removeAfter(owner, 0, newCapacity);
+  }
+
+  // If the new origin is within the tail, then we do not need a root.
+  if (newOrigin >= newTailOffset) {
+    newOrigin -= newTailOffset;
+    newCapacity -= newTailOffset;
+    newLevel = SHIFT;
+    newRoot = null;
+    newTail = newTail && newTail.removeBefore(owner, 0, newOrigin);
+
+    // Otherwise, if the root has been trimmed, garbage collect.
+  } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) {
+    offsetShift = 0;
+
+    // Identify the new top root node of the subtree of the old root.
+    while (newRoot) {
+      var beginIndex = (newOrigin >>> newLevel) & MASK;
+      if ((beginIndex !== newTailOffset >>> newLevel) & MASK) {
+        break;
+      }
+      if (beginIndex) {
+        offsetShift += (1 << newLevel) * beginIndex;
+      }
+      newLevel -= SHIFT;
+      newRoot = newRoot.array[beginIndex];
+    }
+
+    // Trim the new sides of the new root.
+    if (newRoot && newOrigin > oldOrigin) {
+      newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift);
+    }
+    if (newRoot && newTailOffset < oldTailOffset) {
+      newRoot = newRoot.removeAfter(
+        owner,
+        newLevel,
+        newTailOffset - offsetShift
+      );
+    }
+    if (offsetShift) {
+      newOrigin -= offsetShift;
+      newCapacity -= offsetShift;
+    }
+  }
+
+  if (list.__ownerID) {
+    list.size = newCapacity - newOrigin;
+    list._origin = newOrigin;
+    list._capacity = newCapacity;
+    list._level = newLevel;
+    list._root = newRoot;
+    list._tail = newTail;
+    list.__hash = undefined;
+    list.__altered = true;
+    return list;
+  }
+  return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail);
+}
+
+function getTailOffset(size) {
+  return size < SIZE ? 0 : ((size - 1) >>> SHIFT) << SHIFT;
+}
+
+var OrderedMap = /*@__PURE__*/(function (Map$$1) {
+  function OrderedMap(value) {
+    return value === null || value === undefined
+      ? emptyOrderedMap()
+      : isOrderedMap(value)
+        ? value
+        : emptyOrderedMap().withMutations(function (map) {
+            var iter = KeyedCollection(value);
+            assertNotInfinite(iter.size);
+            iter.forEach(function (v, k) { return map.set(k, v); });
+          });
+  }
+
+  if ( Map$$1 ) OrderedMap.__proto__ = Map$$1;
+  OrderedMap.prototype = Object.create( Map$$1 && Map$$1.prototype );
+  OrderedMap.prototype.constructor = OrderedMap;
+
+  OrderedMap.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  OrderedMap.prototype.toString = function toString () {
+    return this.__toString('OrderedMap {', '}');
+  };
+
+  // @pragma Access
+
+  OrderedMap.prototype.get = function get (k, notSetValue) {
+    var index = this._map.get(k);
+    return index !== undefined ? this._list.get(index)[1] : notSetValue;
+  };
+
+  // @pragma Modification
+
+  OrderedMap.prototype.clear = function clear () {
+    if (this.size === 0) {
+      return this;
+    }
+    if (this.__ownerID) {
+      this.size = 0;
+      this._map.clear();
+      this._list.clear();
+      return this;
+    }
+    return emptyOrderedMap();
+  };
+
+  OrderedMap.prototype.set = function set (k, v) {
+    return updateOrderedMap(this, k, v);
+  };
+
+  OrderedMap.prototype.remove = function remove (k) {
+    return updateOrderedMap(this, k, NOT_SET);
+  };
+
+  OrderedMap.prototype.wasAltered = function wasAltered () {
+    return this._map.wasAltered() || this._list.wasAltered();
+  };
+
+  OrderedMap.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._list.__iterate(
+      function (entry) { return entry && fn(entry[1], entry[0], this$1); },
+      reverse
+    );
+  };
+
+  OrderedMap.prototype.__iterator = function __iterator (type, reverse) {
+    return this._list.fromEntrySeq().__iterator(type, reverse);
+  };
+
+  OrderedMap.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    var newMap = this._map.__ensureOwner(ownerID);
+    var newList = this._list.__ensureOwner(ownerID);
+    if (!ownerID) {
+      if (this.size === 0) {
+        return emptyOrderedMap();
+      }
+      this.__ownerID = ownerID;
+      this._map = newMap;
+      this._list = newList;
+      return this;
+    }
+    return makeOrderedMap(newMap, newList, ownerID, this.__hash);
+  };
+
+  return OrderedMap;
+}(Map));
+
+OrderedMap.isOrderedMap = isOrderedMap;
+
+OrderedMap.prototype[IS_ORDERED_SYMBOL] = true;
+OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove;
+
+function makeOrderedMap(map, list, ownerID, hash) {
+  var omap = Object.create(OrderedMap.prototype);
+  omap.size = map ? map.size : 0;
+  omap._map = map;
+  omap._list = list;
+  omap.__ownerID = ownerID;
+  omap.__hash = hash;
+  return omap;
+}
+
+var EMPTY_ORDERED_MAP;
+function emptyOrderedMap() {
+  return (
+    EMPTY_ORDERED_MAP ||
+    (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList()))
+  );
+}
+
+function updateOrderedMap(omap, k, v) {
+  var map = omap._map;
+  var list = omap._list;
+  var i = map.get(k);
+  var has = i !== undefined;
+  var newMap;
+  var newList;
+  if (v === NOT_SET) {
+    // removed
+    if (!has) {
+      return omap;
+    }
+    if (list.size >= SIZE && list.size >= map.size * 2) {
+      newList = list.filter(function (entry, idx) { return entry !== undefined && i !== idx; });
+      newMap = newList
+        .toKeyedSeq()
+        .map(function (entry) { return entry[0]; })
+        .flip()
+        .toMap();
+      if (omap.__ownerID) {
+        newMap.__ownerID = newList.__ownerID = omap.__ownerID;
+      }
+    } else {
+      newMap = map.remove(k);
+      newList = i === list.size - 1 ? list.pop() : list.set(i, undefined);
+    }
+  } else if (has) {
+    if (v === list.get(i)[1]) {
+      return omap;
+    }
+    newMap = map;
+    newList = list.set(i, [k, v]);
+  } else {
+    newMap = map.set(k, list.size);
+    newList = list.set(list.size, [k, v]);
+  }
+  if (omap.__ownerID) {
+    omap.size = newMap.size;
+    omap._map = newMap;
+    omap._list = newList;
+    omap.__hash = undefined;
+    return omap;
+  }
+  return makeOrderedMap(newMap, newList);
+}
+
+var IS_STACK_SYMBOL = '@@__IMMUTABLE_STACK__@@';
+
+function isStack(maybeStack) {
+  return Boolean(maybeStack && maybeStack[IS_STACK_SYMBOL]);
+}
+
+var Stack = /*@__PURE__*/(function (IndexedCollection$$1) {
+  function Stack(value) {
+    return value === null || value === undefined
+      ? emptyStack()
+      : isStack(value)
+        ? value
+        : emptyStack().pushAll(value);
+  }
+
+  if ( IndexedCollection$$1 ) Stack.__proto__ = IndexedCollection$$1;
+  Stack.prototype = Object.create( IndexedCollection$$1 && IndexedCollection$$1.prototype );
+  Stack.prototype.constructor = Stack;
+
+  Stack.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  Stack.prototype.toString = function toString () {
+    return this.__toString('Stack [', ']');
+  };
+
+  // @pragma Access
+
+  Stack.prototype.get = function get (index, notSetValue) {
+    var head = this._head;
+    index = wrapIndex(this, index);
+    while (head && index--) {
+      head = head.next;
+    }
+    return head ? head.value : notSetValue;
+  };
+
+  Stack.prototype.peek = function peek () {
+    return this._head && this._head.value;
+  };
+
+  // @pragma Modification
+
+  Stack.prototype.push = function push (/*...values*/) {
+    var arguments$1 = arguments;
+
+    if (arguments.length === 0) {
+      return this;
+    }
+    var newSize = this.size + arguments.length;
+    var head = this._head;
+    for (var ii = arguments.length - 1; ii >= 0; ii--) {
+      head = {
+        value: arguments$1[ii],
+        next: head,
+      };
+    }
+    if (this.__ownerID) {
+      this.size = newSize;
+      this._head = head;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return makeStack(newSize, head);
+  };
+
+  Stack.prototype.pushAll = function pushAll (iter) {
+    iter = IndexedCollection$$1(iter);
+    if (iter.size === 0) {
+      return this;
+    }
+    if (this.size === 0 && isStack(iter)) {
+      return iter;
+    }
+    assertNotInfinite(iter.size);
+    var newSize = this.size;
+    var head = this._head;
+    iter.__iterate(function (value) {
+      newSize++;
+      head = {
+        value: value,
+        next: head,
+      };
+    }, /* reverse */ true);
+    if (this.__ownerID) {
+      this.size = newSize;
+      this._head = head;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return makeStack(newSize, head);
+  };
+
+  Stack.prototype.pop = function pop () {
+    return this.slice(1);
+  };
+
+  Stack.prototype.clear = function clear () {
+    if (this.size === 0) {
+      return this;
+    }
+    if (this.__ownerID) {
+      this.size = 0;
+      this._head = undefined;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return emptyStack();
+  };
+
+  Stack.prototype.slice = function slice (begin, end) {
+    if (wholeSlice(begin, end, this.size)) {
+      return this;
+    }
+    var resolvedBegin = resolveBegin(begin, this.size);
+    var resolvedEnd = resolveEnd(end, this.size);
+    if (resolvedEnd !== this.size) {
+      // super.slice(begin, end);
+      return IndexedCollection$$1.prototype.slice.call(this, begin, end);
+    }
+    var newSize = this.size - resolvedBegin;
+    var head = this._head;
+    while (resolvedBegin--) {
+      head = head.next;
+    }
+    if (this.__ownerID) {
+      this.size = newSize;
+      this._head = head;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return makeStack(newSize, head);
+  };
+
+  // @pragma Mutability
+
+  Stack.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    if (!ownerID) {
+      if (this.size === 0) {
+        return emptyStack();
+      }
+      this.__ownerID = ownerID;
+      this.__altered = false;
+      return this;
+    }
+    return makeStack(this.size, this._head, ownerID, this.__hash);
+  };
+
+  // @pragma Iteration
+
+  Stack.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return new ArraySeq(this.toArray()).__iterate(
+        function (v, k) { return fn(v, k, this$1); },
+        reverse
+      );
+    }
+    var iterations = 0;
+    var node = this._head;
+    while (node) {
+      if (fn(node.value, iterations++, this) === false) {
+        break;
+      }
+      node = node.next;
+    }
+    return iterations;
+  };
+
+  Stack.prototype.__iterator = function __iterator (type, reverse) {
+    if (reverse) {
+      return new ArraySeq(this.toArray()).__iterator(type, reverse);
+    }
+    var iterations = 0;
+    var node = this._head;
+    return new Iterator(function () {
+      if (node) {
+        var value = node.value;
+        node = node.next;
+        return iteratorValue(type, iterations++, value);
+      }
+      return iteratorDone();
+    });
+  };
+
+  return Stack;
+}(IndexedCollection));
+
+Stack.isStack = isStack;
+
+var StackPrototype = Stack.prototype;
+StackPrototype[IS_STACK_SYMBOL] = true;
+StackPrototype.shift = StackPrototype.pop;
+StackPrototype.unshift = StackPrototype.push;
+StackPrototype.unshiftAll = StackPrototype.pushAll;
+StackPrototype.withMutations = withMutations;
+StackPrototype.wasAltered = wasAltered;
+StackPrototype.asImmutable = asImmutable;
+StackPrototype['@@transducer/init'] = StackPrototype.asMutable = asMutable;
+StackPrototype['@@transducer/step'] = function(result, arr) {
+  return result.unshift(arr);
+};
+StackPrototype['@@transducer/result'] = function(obj) {
+  return obj.asImmutable();
+};
+
+function makeStack(size, head, ownerID, hash) {
+  var map = Object.create(StackPrototype);
+  map.size = size;
+  map._head = head;
+  map.__ownerID = ownerID;
+  map.__hash = hash;
+  map.__altered = false;
+  return map;
+}
+
+var EMPTY_STACK;
+function emptyStack() {
+  return EMPTY_STACK || (EMPTY_STACK = makeStack(0));
+}
+
+var IS_SET_SYMBOL = '@@__IMMUTABLE_SET__@@';
+
+function isSet(maybeSet) {
+  return Boolean(maybeSet && maybeSet[IS_SET_SYMBOL]);
+}
+
+function isOrderedSet(maybeOrderedSet) {
+  return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);
+}
+
+function deepEqual(a, b) {
+  if (a === b) {
+    return true;
+  }
+
+  if (
+    !isCollection(b) ||
+    (a.size !== undefined && b.size !== undefined && a.size !== b.size) ||
+    (a.__hash !== undefined &&
+      b.__hash !== undefined &&
+      a.__hash !== b.__hash) ||
+    isKeyed(a) !== isKeyed(b) ||
+    isIndexed(a) !== isIndexed(b) ||
+    isOrdered(a) !== isOrdered(b)
+  ) {
+    return false;
+  }
+
+  if (a.size === 0 && b.size === 0) {
+    return true;
+  }
+
+  var notAssociative = !isAssociative(a);
+
+  if (isOrdered(a)) {
+    var entries = a.entries();
+    return (
+      b.every(function (v, k) {
+        var entry = entries.next().value;
+        return entry && is(entry[1], v) && (notAssociative || is(entry[0], k));
+      }) && entries.next().done
+    );
+  }
+
+  var flipped = false;
+
+  if (a.size === undefined) {
+    if (b.size === undefined) {
+      if (typeof a.cacheResult === 'function') {
+        a.cacheResult();
+      }
+    } else {
+      flipped = true;
+      var _ = a;
+      a = b;
+      b = _;
+    }
+  }
+
+  var allEqual = true;
+  var bSize = b.__iterate(function (v, k) {
+    if (
+      notAssociative
+        ? !a.has(v)
+        : flipped
+          ? !is(v, a.get(k, NOT_SET))
+          : !is(a.get(k, NOT_SET), v)
+    ) {
+      allEqual = false;
+      return false;
+    }
+  });
+
+  return allEqual && a.size === bSize;
+}
+
+/**
+ * Contributes additional methods to a constructor
+ */
+function mixin(ctor, methods) {
+  var keyCopier = function (key) {
+    ctor.prototype[key] = methods[key];
+  };
+  Object.keys(methods).forEach(keyCopier);
+  Object.getOwnPropertySymbols &&
+    Object.getOwnPropertySymbols(methods).forEach(keyCopier);
+  return ctor;
+}
+
+function toJS(value) {
+  if (!value || typeof value !== 'object') {
+    return value;
+  }
+  if (!isCollection(value)) {
+    if (!isDataStructure(value)) {
+      return value;
+    }
+    value = Seq(value);
+  }
+  if (isKeyed(value)) {
+    var result$1 = {};
+    value.__iterate(function (v, k) {
+      result$1[k] = toJS(v);
+    });
+    return result$1;
+  }
+  var result = [];
+  value.__iterate(function (v) {
+    result.push(toJS(v));
+  });
+  return result;
+}
+
+var Set = /*@__PURE__*/(function (SetCollection$$1) {
+  function Set(value) {
+    return value === null || value === undefined
+      ? emptySet()
+      : isSet(value) && !isOrdered(value)
+        ? value
+        : emptySet().withMutations(function (set) {
+            var iter = SetCollection$$1(value);
+            assertNotInfinite(iter.size);
+            iter.forEach(function (v) { return set.add(v); });
+          });
+  }
+
+  if ( SetCollection$$1 ) Set.__proto__ = SetCollection$$1;
+  Set.prototype = Object.create( SetCollection$$1 && SetCollection$$1.prototype );
+  Set.prototype.constructor = Set;
+
+  Set.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  Set.fromKeys = function fromKeys (value) {
+    return this(KeyedCollection(value).keySeq());
+  };
+
+  Set.intersect = function intersect (sets) {
+    sets = Collection(sets).toArray();
+    return sets.length
+      ? SetPrototype.intersect.apply(Set(sets.pop()), sets)
+      : emptySet();
+  };
+
+  Set.union = function union (sets) {
+    sets = Collection(sets).toArray();
+    return sets.length
+      ? SetPrototype.union.apply(Set(sets.pop()), sets)
+      : emptySet();
+  };
+
+  Set.prototype.toString = function toString () {
+    return this.__toString('Set {', '}');
+  };
+
+  // @pragma Access
+
+  Set.prototype.has = function has (value) {
+    return this._map.has(value);
+  };
+
+  // @pragma Modification
+
+  Set.prototype.add = function add (value) {
+    return updateSet(this, this._map.set(value, value));
+  };
+
+  Set.prototype.remove = function remove (value) {
+    return updateSet(this, this._map.remove(value));
+  };
+
+  Set.prototype.clear = function clear () {
+    return updateSet(this, this._map.clear());
+  };
+
+  // @pragma Composition
+
+  Set.prototype.map = function map (mapper, context) {
+    var this$1 = this;
+
+    var removes = [];
+    var adds = [];
+    this.forEach(function (value) {
+      var mapped = mapper.call(context, value, value, this$1);
+      if (mapped !== value) {
+        removes.push(value);
+        adds.push(mapped);
+      }
+    });
+    return this.withMutations(function (set) {
+      removes.forEach(function (value) { return set.remove(value); });
+      adds.forEach(function (value) { return set.add(value); });
+    });
+  };
+
+  Set.prototype.union = function union () {
+    var iters = [], len = arguments.length;
+    while ( len-- ) iters[ len ] = arguments[ len ];
+
+    iters = iters.filter(function (x) { return x.size !== 0; });
+    if (iters.length === 0) {
+      return this;
+    }
+    if (this.size === 0 && !this.__ownerID && iters.length === 1) {
+      return this.constructor(iters[0]);
+    }
+    return this.withMutations(function (set) {
+      for (var ii = 0; ii < iters.length; ii++) {
+        SetCollection$$1(iters[ii]).forEach(function (value) { return set.add(value); });
+      }
+    });
+  };
+
+  Set.prototype.intersect = function intersect () {
+    var iters = [], len = arguments.length;
+    while ( len-- ) iters[ len ] = arguments[ len ];
+
+    if (iters.length === 0) {
+      return this;
+    }
+    iters = iters.map(function (iter) { return SetCollection$$1(iter); });
+    var toRemove = [];
+    this.forEach(function (value) {
+      if (!iters.every(function (iter) { return iter.includes(value); })) {
+        toRemove.push(value);
+      }
+    });
+    return this.withMutations(function (set) {
+      toRemove.forEach(function (value) {
+        set.remove(value);
+      });
+    });
+  };
+
+  Set.prototype.subtract = function subtract () {
+    var iters = [], len = arguments.length;
+    while ( len-- ) iters[ len ] = arguments[ len ];
+
+    if (iters.length === 0) {
+      return this;
+    }
+    iters = iters.map(function (iter) { return SetCollection$$1(iter); });
+    var toRemove = [];
+    this.forEach(function (value) {
+      if (iters.some(function (iter) { return iter.includes(value); })) {
+        toRemove.push(value);
+      }
+    });
+    return this.withMutations(function (set) {
+      toRemove.forEach(function (value) {
+        set.remove(value);
+      });
+    });
+  };
+
+  Set.prototype.sort = function sort (comparator) {
+    // Late binding
+    return OrderedSet(sortFactory(this, comparator));
+  };
+
+  Set.prototype.sortBy = function sortBy (mapper, comparator) {
+    // Late binding
+    return OrderedSet(sortFactory(this, comparator, mapper));
+  };
+
+  Set.prototype.wasAltered = function wasAltered () {
+    return this._map.wasAltered();
+  };
+
+  Set.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._map.__iterate(function (k) { return fn(k, k, this$1); }, reverse);
+  };
+
+  Set.prototype.__iterator = function __iterator (type, reverse) {
+    return this._map.__iterator(type, reverse);
+  };
+
+  Set.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    var newMap = this._map.__ensureOwner(ownerID);
+    if (!ownerID) {
+      if (this.size === 0) {
+        return this.__empty();
+      }
+      this.__ownerID = ownerID;
+      this._map = newMap;
+      return this;
+    }
+    return this.__make(newMap, ownerID);
+  };
+
+  return Set;
+}(SetCollection));
+
+Set.isSet = isSet;
+
+var SetPrototype = Set.prototype;
+SetPrototype[IS_SET_SYMBOL] = true;
+SetPrototype[DELETE] = SetPrototype.remove;
+SetPrototype.merge = SetPrototype.concat = SetPrototype.union;
+SetPrototype.withMutations = withMutations;
+SetPrototype.asImmutable = asImmutable;
+SetPrototype['@@transducer/init'] = SetPrototype.asMutable = asMutable;
+SetPrototype['@@transducer/step'] = function(result, arr) {
+  return result.add(arr);
+};
+SetPrototype['@@transducer/result'] = function(obj) {
+  return obj.asImmutable();
+};
+
+SetPrototype.__empty = emptySet;
+SetPrototype.__make = makeSet;
+
+function updateSet(set, newMap) {
+  if (set.__ownerID) {
+    set.size = newMap.size;
+    set._map = newMap;
+    return set;
+  }
+  return newMap === set._map
+    ? set
+    : newMap.size === 0
+      ? set.__empty()
+      : set.__make(newMap);
+}
+
+function makeSet(map, ownerID) {
+  var set = Object.create(SetPrototype);
+  set.size = map ? map.size : 0;
+  set._map = map;
+  set.__ownerID = ownerID;
+  return set;
+}
+
+var EMPTY_SET;
+function emptySet() {
+  return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap()));
+}
+
+/**
+ * Returns a lazy seq of nums from start (inclusive) to end
+ * (exclusive), by step, where start defaults to 0, step to 1, and end to
+ * infinity. When start is equal to end, returns empty list.
+ */
+var Range = /*@__PURE__*/(function (IndexedSeq$$1) {
+  function Range(start, end, step) {
+    if (!(this instanceof Range)) {
+      return new Range(start, end, step);
+    }
+    invariant(step !== 0, 'Cannot step a Range by 0');
+    start = start || 0;
+    if (end === undefined) {
+      end = Infinity;
+    }
+    step = step === undefined ? 1 : Math.abs(step);
+    if (end < start) {
+      step = -step;
+    }
+    this._start = start;
+    this._end = end;
+    this._step = step;
+    this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);
+    if (this.size === 0) {
+      if (EMPTY_RANGE) {
+        return EMPTY_RANGE;
+      }
+      EMPTY_RANGE = this;
+    }
+  }
+
+  if ( IndexedSeq$$1 ) Range.__proto__ = IndexedSeq$$1;
+  Range.prototype = Object.create( IndexedSeq$$1 && IndexedSeq$$1.prototype );
+  Range.prototype.constructor = Range;
+
+  Range.prototype.toString = function toString () {
+    if (this.size === 0) {
+      return 'Range []';
+    }
+    return (
+      'Range [ ' +
+      this._start +
+      '...' +
+      this._end +
+      (this._step !== 1 ? ' by ' + this._step : '') +
+      ' ]'
+    );
+  };
+
+  Range.prototype.get = function get (index, notSetValue) {
+    return this.has(index)
+      ? this._start + wrapIndex(this, index) * this._step
+      : notSetValue;
+  };
+
+  Range.prototype.includes = function includes (searchValue) {
+    var possibleIndex = (searchValue - this._start) / this._step;
+    return (
+      possibleIndex >= 0 &&
+      possibleIndex < this.size &&
+      possibleIndex === Math.floor(possibleIndex)
+    );
+  };
+
+  Range.prototype.slice = function slice (begin, end) {
+    if (wholeSlice(begin, end, this.size)) {
+      return this;
+    }
+    begin = resolveBegin(begin, this.size);
+    end = resolveEnd(end, this.size);
+    if (end <= begin) {
+      return new Range(0, 0);
+    }
+    return new Range(
+      this.get(begin, this._end),
+      this.get(end, this._end),
+      this._step
+    );
+  };
+
+  Range.prototype.indexOf = function indexOf (searchValue) {
+    var offsetValue = searchValue - this._start;
+    if (offsetValue % this._step === 0) {
+      var index = offsetValue / this._step;
+      if (index >= 0 && index < this.size) {
+        return index;
+      }
+    }
+    return -1;
+  };
+
+  Range.prototype.lastIndexOf = function lastIndexOf (searchValue) {
+    return this.indexOf(searchValue);
+  };
+
+  Range.prototype.__iterate = function __iterate (fn, reverse) {
+    var size = this.size;
+    var step = this._step;
+    var value = reverse ? this._start + (size - 1) * step : this._start;
+    var i = 0;
+    while (i !== size) {
+      if (fn(value, reverse ? size - ++i : i++, this) === false) {
+        break;
+      }
+      value += reverse ? -step : step;
+    }
+    return i;
+  };
+
+  Range.prototype.__iterator = function __iterator (type, reverse) {
+    var size = this.size;
+    var step = this._step;
+    var value = reverse ? this._start + (size - 1) * step : this._start;
+    var i = 0;
+    return new Iterator(function () {
+      if (i === size) {
+        return iteratorDone();
+      }
+      var v = value;
+      value += reverse ? -step : step;
+      return iteratorValue(type, reverse ? size - ++i : i++, v);
+    });
+  };
+
+  Range.prototype.equals = function equals (other) {
+    return other instanceof Range
+      ? this._start === other._start &&
+          this._end === other._end &&
+          this._step === other._step
+      : deepEqual(this, other);
+  };
+
+  return Range;
+}(IndexedSeq));
+
+var EMPTY_RANGE;
+
+function getIn(collection, searchKeyPath, notSetValue) {
+  var keyPath = coerceKeyPath(searchKeyPath);
+  var i = 0;
+  while (i !== keyPath.length) {
+    collection = get(collection, keyPath[i++], NOT_SET);
+    if (collection === NOT_SET) {
+      return notSetValue;
+    }
+  }
+  return collection;
+}
+
+function getIn$1(searchKeyPath, notSetValue) {
+  return getIn(this, searchKeyPath, notSetValue);
+}
+
+function hasIn(collection, keyPath) {
+  return getIn(collection, keyPath, NOT_SET) !== NOT_SET;
+}
+
+function hasIn$1(searchKeyPath) {
+  return hasIn(this, searchKeyPath);
+}
+
+function toObject() {
+  assertNotInfinite(this.size);
+  var object = {};
+  this.__iterate(function (v, k) {
+    object[k] = v;
+  });
+  return object;
+}
+
+// Note: all of these methods are deprecated.
+Collection.isIterable = isCollection;
+Collection.isKeyed = isKeyed;
+Collection.isIndexed = isIndexed;
+Collection.isAssociative = isAssociative;
+Collection.isOrdered = isOrdered;
+
+Collection.Iterator = Iterator;
+
+mixin(Collection, {
+  // ### Conversion to other types
+
+  toArray: function toArray() {
+    assertNotInfinite(this.size);
+    var array = new Array(this.size || 0);
+    var useTuples = isKeyed(this);
+    var i = 0;
+    this.__iterate(function (v, k) {
+      // Keyed collections produce an array of tuples.
+      array[i++] = useTuples ? [k, v] : v;
+    });
+    return array;
+  },
+
+  toIndexedSeq: function toIndexedSeq() {
+    return new ToIndexedSequence(this);
+  },
+
+  toJS: function toJS$1() {
+    return toJS(this);
+  },
+
+  toKeyedSeq: function toKeyedSeq() {
+    return new ToKeyedSequence(this, true);
+  },
+
+  toMap: function toMap() {
+    // Use Late Binding here to solve the circular dependency.
+    return Map(this.toKeyedSeq());
+  },
+
+  toObject: toObject,
+
+  toOrderedMap: function toOrderedMap() {
+    // Use Late Binding here to solve the circular dependency.
+    return OrderedMap(this.toKeyedSeq());
+  },
+
+  toOrderedSet: function toOrderedSet() {
+    // Use Late Binding here to solve the circular dependency.
+    return OrderedSet(isKeyed(this) ? this.valueSeq() : this);
+  },
+
+  toSet: function toSet() {
+    // Use Late Binding here to solve the circular dependency.
+    return Set(isKeyed(this) ? this.valueSeq() : this);
+  },
+
+  toSetSeq: function toSetSeq() {
+    return new ToSetSequence(this);
+  },
+
+  toSeq: function toSeq() {
+    return isIndexed(this)
+      ? this.toIndexedSeq()
+      : isKeyed(this)
+        ? this.toKeyedSeq()
+        : this.toSetSeq();
+  },
+
+  toStack: function toStack() {
+    // Use Late Binding here to solve the circular dependency.
+    return Stack(isKeyed(this) ? this.valueSeq() : this);
+  },
+
+  toList: function toList() {
+    // Use Late Binding here to solve the circular dependency.
+    return List(isKeyed(this) ? this.valueSeq() : this);
+  },
+
+  // ### Common JavaScript methods and properties
+
+  toString: function toString() {
+    return '[Collection]';
+  },
+
+  __toString: function __toString(head, tail) {
+    if (this.size === 0) {
+      return head + tail;
+    }
+    return (
+      head +
+      ' ' +
+      this.toSeq()
+        .map(this.__toStringMapper)
+        .join(', ') +
+      ' ' +
+      tail
+    );
+  },
+
+  // ### ES6 Collection methods (ES6 Array and Map)
+
+  concat: function concat() {
+    var values = [], len = arguments.length;
+    while ( len-- ) values[ len ] = arguments[ len ];
+
+    return reify(this, concatFactory(this, values));
+  },
+
+  includes: function includes(searchValue) {
+    return this.some(function (value) { return is(value, searchValue); });
+  },
+
+  entries: function entries() {
+    return this.__iterator(ITERATE_ENTRIES);
+  },
+
+  every: function every(predicate, context) {
+    assertNotInfinite(this.size);
+    var returnValue = true;
+    this.__iterate(function (v, k, c) {
+      if (!predicate.call(context, v, k, c)) {
+        returnValue = false;
+        return false;
+      }
+    });
+    return returnValue;
+  },
+
+  filter: function filter(predicate, context) {
+    return reify(this, filterFactory(this, predicate, context, true));
+  },
+
+  find: function find(predicate, context, notSetValue) {
+    var entry = this.findEntry(predicate, context);
+    return entry ? entry[1] : notSetValue;
+  },
+
+  forEach: function forEach(sideEffect, context) {
+    assertNotInfinite(this.size);
+    return this.__iterate(context ? sideEffect.bind(context) : sideEffect);
+  },
+
+  join: function join(separator) {
+    assertNotInfinite(this.size);
+    separator = separator !== undefined ? '' + separator : ',';
+    var joined = '';
+    var isFirst = true;
+    this.__iterate(function (v) {
+      isFirst ? (isFirst = false) : (joined += separator);
+      joined += v !== null && v !== undefined ? v.toString() : '';
+    });
+    return joined;
+  },
+
+  keys: function keys() {
+    return this.__iterator(ITERATE_KEYS);
+  },
+
+  map: function map(mapper, context) {
+    return reify(this, mapFactory(this, mapper, context));
+  },
+
+  reduce: function reduce$1(reducer, initialReduction, context) {
+    return reduce(
+      this,
+      reducer,
+      initialReduction,
+      context,
+      arguments.length < 2,
+      false
+    );
+  },
+
+  reduceRight: function reduceRight(reducer, initialReduction, context) {
+    return reduce(
+      this,
+      reducer,
+      initialReduction,
+      context,
+      arguments.length < 2,
+      true
+    );
+  },
+
+  reverse: function reverse() {
+    return reify(this, reverseFactory(this, true));
+  },
+
+  slice: function slice(begin, end) {
+    return reify(this, sliceFactory(this, begin, end, true));
+  },
+
+  some: function some(predicate, context) {
+    return !this.every(not(predicate), context);
+  },
+
+  sort: function sort(comparator) {
+    return reify(this, sortFactory(this, comparator));
+  },
+
+  values: function values() {
+    return this.__iterator(ITERATE_VALUES);
+  },
+
+  // ### More sequential methods
+
+  butLast: function butLast() {
+    return this.slice(0, -1);
+  },
+
+  isEmpty: function isEmpty() {
+    return this.size !== undefined ? this.size === 0 : !this.some(function () { return true; });
+  },
+
+  count: function count(predicate, context) {
+    return ensureSize(
+      predicate ? this.toSeq().filter(predicate, context) : this
+    );
+  },
+
+  countBy: function countBy(grouper, context) {
+    return countByFactory(this, grouper, context);
+  },
+
+  equals: function equals(other) {
+    return deepEqual(this, other);
+  },
+
+  entrySeq: function entrySeq() {
+    var collection = this;
+    if (collection._cache) {
+      // We cache as an entries array, so we can just return the cache!
+      return new ArraySeq(collection._cache);
+    }
+    var entriesSequence = collection
+      .toSeq()
+      .map(entryMapper)
+      .toIndexedSeq();
+    entriesSequence.fromEntrySeq = function () { return collection.toSeq(); };
+    return entriesSequence;
+  },
+
+  filterNot: function filterNot(predicate, context) {
+    return this.filter(not(predicate), context);
+  },
+
+  findEntry: function findEntry(predicate, context, notSetValue) {
+    var found = notSetValue;
+    this.__iterate(function (v, k, c) {
+      if (predicate.call(context, v, k, c)) {
+        found = [k, v];
+        return false;
+      }
+    });
+    return found;
+  },
+
+  findKey: function findKey(predicate, context) {
+    var entry = this.findEntry(predicate, context);
+    return entry && entry[0];
+  },
+
+  findLast: function findLast(predicate, context, notSetValue) {
+    return this.toKeyedSeq()
+      .reverse()
+      .find(predicate, context, notSetValue);
+  },
+
+  findLastEntry: function findLastEntry(predicate, context, notSetValue) {
+    return this.toKeyedSeq()
+      .reverse()
+      .findEntry(predicate, context, notSetValue);
+  },
+
+  findLastKey: function findLastKey(predicate, context) {
+    return this.toKeyedSeq()
+      .reverse()
+      .findKey(predicate, context);
+  },
+
+  first: function first(notSetValue) {
+    return this.find(returnTrue, null, notSetValue);
+  },
+
+  flatMap: function flatMap(mapper, context) {
+    return reify(this, flatMapFactory(this, mapper, context));
+  },
+
+  flatten: function flatten(depth) {
+    return reify(this, flattenFactory(this, depth, true));
+  },
+
+  fromEntrySeq: function fromEntrySeq() {
+    return new FromEntriesSequence(this);
+  },
+
+  get: function get(searchKey, notSetValue) {
+    return this.find(function (_, key) { return is(key, searchKey); }, undefined, notSetValue);
+  },
+
+  getIn: getIn$1,
+
+  groupBy: function groupBy(grouper, context) {
+    return groupByFactory(this, grouper, context);
+  },
+
+  has: function has(searchKey) {
+    return this.get(searchKey, NOT_SET) !== NOT_SET;
+  },
+
+  hasIn: hasIn$1,
+
+  isSubset: function isSubset(iter) {
+    iter = typeof iter.includes === 'function' ? iter : Collection(iter);
+    return this.every(function (value) { return iter.includes(value); });
+  },
+
+  isSuperset: function isSuperset(iter) {
+    iter = typeof iter.isSubset === 'function' ? iter : Collection(iter);
+    return iter.isSubset(this);
+  },
+
+  keyOf: function keyOf(searchValue) {
+    return this.findKey(function (value) { return is(value, searchValue); });
+  },
+
+  keySeq: function keySeq() {
+    return this.toSeq()
+      .map(keyMapper)
+      .toIndexedSeq();
+  },
+
+  last: function last(notSetValue) {
+    return this.toSeq()
+      .reverse()
+      .first(notSetValue);
+  },
+
+  lastKeyOf: function lastKeyOf(searchValue) {
+    return this.toKeyedSeq()
+      .reverse()
+      .keyOf(searchValue);
+  },
+
+  max: function max(comparator) {
+    return maxFactory(this, comparator);
+  },
+
+  maxBy: function maxBy(mapper, comparator) {
+    return maxFactory(this, comparator, mapper);
+  },
+
+  min: function min(comparator) {
+    return maxFactory(
+      this,
+      comparator ? neg(comparator) : defaultNegComparator
+    );
+  },
+
+  minBy: function minBy(mapper, comparator) {
+    return maxFactory(
+      this,
+      comparator ? neg(comparator) : defaultNegComparator,
+      mapper
+    );
+  },
+
+  rest: function rest() {
+    return this.slice(1);
+  },
+
+  skip: function skip(amount) {
+    return amount === 0 ? this : this.slice(Math.max(0, amount));
+  },
+
+  skipLast: function skipLast(amount) {
+    return amount === 0 ? this : this.slice(0, -Math.max(0, amount));
+  },
+
+  skipWhile: function skipWhile(predicate, context) {
+    return reify(this, skipWhileFactory(this, predicate, context, true));
+  },
+
+  skipUntil: function skipUntil(predicate, context) {
+    return this.skipWhile(not(predicate), context);
+  },
+
+  sortBy: function sortBy(mapper, comparator) {
+    return reify(this, sortFactory(this, comparator, mapper));
+  },
+
+  take: function take(amount) {
+    return this.slice(0, Math.max(0, amount));
+  },
+
+  takeLast: function takeLast(amount) {
+    return this.slice(-Math.max(0, amount));
+  },
+
+  takeWhile: function takeWhile(predicate, context) {
+    return reify(this, takeWhileFactory(this, predicate, context));
+  },
+
+  takeUntil: function takeUntil(predicate, context) {
+    return this.takeWhile(not(predicate), context);
+  },
+
+  update: function update(fn) {
+    return fn(this);
+  },
+
+  valueSeq: function valueSeq() {
+    return this.toIndexedSeq();
+  },
+
+  // ### Hashable Object
+
+  hashCode: function hashCode() {
+    return this.__hash || (this.__hash = hashCollection(this));
+  },
+
+  // ### Internal
+
+  // abstract __iterate(fn, reverse)
+
+  // abstract __iterator(type, reverse)
+});
+
+var CollectionPrototype = Collection.prototype;
+CollectionPrototype[IS_COLLECTION_SYMBOL] = true;
+CollectionPrototype[ITERATOR_SYMBOL] = CollectionPrototype.values;
+CollectionPrototype.toJSON = CollectionPrototype.toArray;
+CollectionPrototype.__toStringMapper = quoteString;
+CollectionPrototype.inspect = CollectionPrototype.toSource = function() {
+  return this.toString();
+};
+CollectionPrototype.chain = CollectionPrototype.flatMap;
+CollectionPrototype.contains = CollectionPrototype.includes;
+
+mixin(KeyedCollection, {
+  // ### More sequential methods
+
+  flip: function flip() {
+    return reify(this, flipFactory(this));
+  },
+
+  mapEntries: function mapEntries(mapper, context) {
+    var this$1 = this;
+
+    var iterations = 0;
+    return reify(
+      this,
+      this.toSeq()
+        .map(function (v, k) { return mapper.call(context, [k, v], iterations++, this$1); })
+        .fromEntrySeq()
+    );
+  },
+
+  mapKeys: function mapKeys(mapper, context) {
+    var this$1 = this;
+
+    return reify(
+      this,
+      this.toSeq()
+        .flip()
+        .map(function (k, v) { return mapper.call(context, k, v, this$1); })
+        .flip()
+    );
+  },
+});
+
+var KeyedCollectionPrototype = KeyedCollection.prototype;
+KeyedCollectionPrototype[IS_KEYED_SYMBOL] = true;
+KeyedCollectionPrototype[ITERATOR_SYMBOL] = CollectionPrototype.entries;
+KeyedCollectionPrototype.toJSON = toObject;
+KeyedCollectionPrototype.__toStringMapper = function (v, k) { return quoteString(k) + ': ' + quoteString(v); };
+
+mixin(IndexedCollection, {
+  // ### Conversion to other types
+
+  toKeyedSeq: function toKeyedSeq() {
+    return new ToKeyedSequence(this, false);
+  },
+
+  // ### ES6 Collection methods (ES6 Array and Map)
+
+  filter: function filter(predicate, context) {
+    return reify(this, filterFactory(this, predicate, context, false));
+  },
+
+  findIndex: function findIndex(predicate, context) {
+    var entry = this.findEntry(predicate, context);
+    return entry ? entry[0] : -1;
+  },
+
+  indexOf: function indexOf(searchValue) {
+    var key = this.keyOf(searchValue);
+    return key === undefined ? -1 : key;
+  },
+
+  lastIndexOf: function lastIndexOf(searchValue) {
+    var key = this.lastKeyOf(searchValue);
+    return key === undefined ? -1 : key;
+  },
+
+  reverse: function reverse() {
+    return reify(this, reverseFactory(this, false));
+  },
+
+  slice: function slice(begin, end) {
+    return reify(this, sliceFactory(this, begin, end, false));
+  },
+
+  splice: function splice(index, removeNum /*, ...values*/) {
+    var numArgs = arguments.length;
+    removeNum = Math.max(removeNum || 0, 0);
+    if (numArgs === 0 || (numArgs === 2 && !removeNum)) {
+      return this;
+    }
+    // If index is negative, it should resolve relative to the size of the
+    // collection. However size may be expensive to compute if not cached, so
+    // only call count() if the number is in fact negative.
+    index = resolveBegin(index, index < 0 ? this.count() : this.size);
+    var spliced = this.slice(0, index);
+    return reify(
+      this,
+      numArgs === 1
+        ? spliced
+        : spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum))
+    );
+  },
+
+  // ### More collection methods
+
+  findLastIndex: function findLastIndex(predicate, context) {
+    var entry = this.findLastEntry(predicate, context);
+    return entry ? entry[0] : -1;
+  },
+
+  first: function first(notSetValue) {
+    return this.get(0, notSetValue);
+  },
+
+  flatten: function flatten(depth) {
+    return reify(this, flattenFactory(this, depth, false));
+  },
+
+  get: function get(index, notSetValue) {
+    index = wrapIndex(this, index);
+    return index < 0 ||
+      (this.size === Infinity || (this.size !== undefined && index > this.size))
+      ? notSetValue
+      : this.find(function (_, key) { return key === index; }, undefined, notSetValue);
+  },
+
+  has: function has(index) {
+    index = wrapIndex(this, index);
+    return (
+      index >= 0 &&
+      (this.size !== undefined
+        ? this.size === Infinity || index < this.size
+        : this.indexOf(index) !== -1)
+    );
+  },
+
+  interpose: function interpose(separator) {
+    return reify(this, interposeFactory(this, separator));
+  },
+
+  interleave: function interleave(/*...collections*/) {
+    var collections = [this].concat(arrCopy(arguments));
+    var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, collections);
+    var interleaved = zipped.flatten(true);
+    if (zipped.size) {
+      interleaved.size = zipped.size * collections.length;
+    }
+    return reify(this, interleaved);
+  },
+
+  keySeq: function keySeq() {
+    return Range(0, this.size);
+  },
+
+  last: function last(notSetValue) {
+    return this.get(-1, notSetValue);
+  },
+
+  skipWhile: function skipWhile(predicate, context) {
+    return reify(this, skipWhileFactory(this, predicate, context, false));
+  },
+
+  zip: function zip(/*, ...collections */) {
+    var collections = [this].concat(arrCopy(arguments));
+    return reify(this, zipWithFactory(this, defaultZipper, collections));
+  },
+
+  zipAll: function zipAll(/*, ...collections */) {
+    var collections = [this].concat(arrCopy(arguments));
+    return reify(this, zipWithFactory(this, defaultZipper, collections, true));
+  },
+
+  zipWith: function zipWith(zipper /*, ...collections */) {
+    var collections = arrCopy(arguments);
+    collections[0] = this;
+    return reify(this, zipWithFactory(this, zipper, collections));
+  },
+});
+
+var IndexedCollectionPrototype = IndexedCollection.prototype;
+IndexedCollectionPrototype[IS_INDEXED_SYMBOL] = true;
+IndexedCollectionPrototype[IS_ORDERED_SYMBOL] = true;
+
+mixin(SetCollection, {
+  // ### ES6 Collection methods (ES6 Array and Map)
+
+  get: function get(value, notSetValue) {
+    return this.has(value) ? value : notSetValue;
+  },
+
+  includes: function includes(value) {
+    return this.has(value);
+  },
+
+  // ### More sequential methods
+
+  keySeq: function keySeq() {
+    return this.valueSeq();
+  },
+});
+
+SetCollection.prototype.has = CollectionPrototype.includes;
+SetCollection.prototype.contains = SetCollection.prototype.includes;
+
+// Mixin subclasses
+
+mixin(KeyedSeq, KeyedCollection.prototype);
+mixin(IndexedSeq, IndexedCollection.prototype);
+mixin(SetSeq, SetCollection.prototype);
+
+// #pragma Helper functions
+
+function reduce(collection, reducer, reduction, context, useFirst, reverse) {
+  assertNotInfinite(collection.size);
+  collection.__iterate(function (v, k, c) {
+    if (useFirst) {
+      useFirst = false;
+      reduction = v;
+    } else {
+      reduction = reducer.call(context, reduction, v, k, c);
+    }
+  }, reverse);
+  return reduction;
+}
+
+function keyMapper(v, k) {
+  return k;
+}
+
+function entryMapper(v, k) {
+  return [k, v];
+}
+
+function not(predicate) {
+  return function() {
+    return !predicate.apply(this, arguments);
+  };
+}
+
+function neg(predicate) {
+  return function() {
+    return -predicate.apply(this, arguments);
+  };
+}
+
+function defaultZipper() {
+  return arrCopy(arguments);
+}
+
+function defaultNegComparator(a, b) {
+  return a < b ? 1 : a > b ? -1 : 0;
+}
+
+function hashCollection(collection) {
+  if (collection.size === Infinity) {
+    return 0;
+  }
+  var ordered = isOrdered(collection);
+  var keyed = isKeyed(collection);
+  var h = ordered ? 1 : 0;
+  var size = collection.__iterate(
+    keyed
+      ? ordered
+        ? function (v, k) {
+            h = (31 * h + hashMerge(hash(v), hash(k))) | 0;
+          }
+        : function (v, k) {
+            h = (h + hashMerge(hash(v), hash(k))) | 0;
+          }
+      : ordered
+        ? function (v) {
+            h = (31 * h + hash(v)) | 0;
+          }
+        : function (v) {
+            h = (h + hash(v)) | 0;
+          }
+  );
+  return murmurHashOfSize(size, h);
+}
+
+function murmurHashOfSize(size, h) {
+  h = imul(h, 0xcc9e2d51);
+  h = imul((h << 15) | (h >>> -15), 0x1b873593);
+  h = imul((h << 13) | (h >>> -13), 5);
+  h = ((h + 0xe6546b64) | 0) ^ size;
+  h = imul(h ^ (h >>> 16), 0x85ebca6b);
+  h = imul(h ^ (h >>> 13), 0xc2b2ae35);
+  h = smi(h ^ (h >>> 16));
+  return h;
+}
+
+function hashMerge(a, b) {
+  return (a ^ (b + 0x9e3779b9 + (a << 6) + (a >> 2))) | 0; // int
+}
+
+var OrderedSet = /*@__PURE__*/(function (Set$$1) {
+  function OrderedSet(value) {
+    return value === null || value === undefined
+      ? emptyOrderedSet()
+      : isOrderedSet(value)
+        ? value
+        : emptyOrderedSet().withMutations(function (set) {
+            var iter = SetCollection(value);
+            assertNotInfinite(iter.size);
+            iter.forEach(function (v) { return set.add(v); });
+          });
+  }
+
+  if ( Set$$1 ) OrderedSet.__proto__ = Set$$1;
+  OrderedSet.prototype = Object.create( Set$$1 && Set$$1.prototype );
+  OrderedSet.prototype.constructor = OrderedSet;
+
+  OrderedSet.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  OrderedSet.fromKeys = function fromKeys (value) {
+    return this(KeyedCollection(value).keySeq());
+  };
+
+  OrderedSet.prototype.toString = function toString () {
+    return this.__toString('OrderedSet {', '}');
+  };
+
+  return OrderedSet;
+}(Set));
+
+OrderedSet.isOrderedSet = isOrderedSet;
+
+var OrderedSetPrototype = OrderedSet.prototype;
+OrderedSetPrototype[IS_ORDERED_SYMBOL] = true;
+OrderedSetPrototype.zip = IndexedCollectionPrototype.zip;
+OrderedSetPrototype.zipWith = IndexedCollectionPrototype.zipWith;
+
+OrderedSetPrototype.__empty = emptyOrderedSet;
+OrderedSetPrototype.__make = makeOrderedSet;
+
+function makeOrderedSet(map, ownerID) {
+  var set = Object.create(OrderedSetPrototype);
+  set.size = map ? map.size : 0;
+  set._map = map;
+  set.__ownerID = ownerID;
+  return set;
+}
+
+var EMPTY_ORDERED_SET;
+function emptyOrderedSet() {
+  return (
+    EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap()))
+  );
+}
+
+var Record = function Record(defaultValues, name) {
+  var hasInitialized;
+
+  var RecordType = function Record(values) {
+    var this$1 = this;
+
+    if (values instanceof RecordType) {
+      return values;
+    }
+    if (!(this instanceof RecordType)) {
+      return new RecordType(values);
+    }
+    if (!hasInitialized) {
+      hasInitialized = true;
+      var keys = Object.keys(defaultValues);
+      var indices = (RecordTypePrototype._indices = {});
+      // Deprecated: left to attempt not to break any external code which
+      // relies on a ._name property existing on record instances.
+      // Use Record.getDescriptiveName() instead
+      RecordTypePrototype._name = name;
+      RecordTypePrototype._keys = keys;
+      RecordTypePrototype._defaultValues = defaultValues;
+      for (var i = 0; i < keys.length; i++) {
+        var propName = keys[i];
+        indices[propName] = i;
+        if (RecordTypePrototype[propName]) {
+          /* eslint-disable no-console */
+          typeof console === 'object' &&
+            console.warn &&
+            console.warn(
+              'Cannot define ' +
+                recordName(this) +
+                ' with property "' +
+                propName +
+                '" since that property name is part of the Record API.'
+            );
+          /* eslint-enable no-console */
+        } else {
+          setProp(RecordTypePrototype, propName);
+        }
+      }
+    }
+    this.__ownerID = undefined;
+    this._values = List().withMutations(function (l) {
+      l.setSize(this$1._keys.length);
+      KeyedCollection(values).forEach(function (v, k) {
+        l.set(this$1._indices[k], v === this$1._defaultValues[k] ? undefined : v);
+      });
+    });
+  };
+
+  var RecordTypePrototype = (RecordType.prototype = Object.create(
+    RecordPrototype
+  ));
+  RecordTypePrototype.constructor = RecordType;
+
+  if (name) {
+    RecordType.displayName = name;
+  }
+
+  return RecordType;
+};
+
+Record.prototype.toString = function toString () {
+  var str = recordName(this) + ' { ';
+  var keys = this._keys;
+  var k;
+  for (var i = 0, l = keys.length; i !== l; i++) {
+    k = keys[i];
+    str += (i ? ', ' : '') + k + ': ' + quoteString(this.get(k));
+  }
+  return str + ' }';
+};
+
+Record.prototype.equals = function equals (other) {
+  return (
+    this === other ||
+    (other &&
+      this._keys === other._keys &&
+      recordSeq(this).equals(recordSeq(other)))
+  );
+};
+
+Record.prototype.hashCode = function hashCode () {
+  return recordSeq(this).hashCode();
+};
+
+// @pragma Access
+
+Record.prototype.has = function has (k) {
+  return this._indices.hasOwnProperty(k);
+};
+
+Record.prototype.get = function get (k, notSetValue) {
+  if (!this.has(k)) {
+    return notSetValue;
+  }
+  var index = this._indices[k];
+  var value = this._values.get(index);
+  return value === undefined ? this._defaultValues[k] : value;
+};
+
+// @pragma Modification
+
+Record.prototype.set = function set (k, v) {
+  if (this.has(k)) {
+    var newValues = this._values.set(
+      this._indices[k],
+      v === this._defaultValues[k] ? undefined : v
+    );
+    if (newValues !== this._values && !this.__ownerID) {
+      return makeRecord(this, newValues);
+    }
+  }
+  return this;
+};
+
+Record.prototype.remove = function remove (k) {
+  return this.set(k);
+};
+
+Record.prototype.clear = function clear () {
+  var newValues = this._values.clear().setSize(this._keys.length);
+  return this.__ownerID ? this : makeRecord(this, newValues);
+};
+
+Record.prototype.wasAltered = function wasAltered () {
+  return this._values.wasAltered();
+};
+
+Record.prototype.toSeq = function toSeq () {
+  return recordSeq(this);
+};
+
+Record.prototype.toJS = function toJS$1 () {
+  return toJS(this);
+};
+
+Record.prototype.entries = function entries () {
+  return this.__iterator(ITERATE_ENTRIES);
+};
+
+Record.prototype.__iterator = function __iterator (type, reverse) {
+  return recordSeq(this).__iterator(type, reverse);
+};
+
+Record.prototype.__iterate = function __iterate (fn, reverse) {
+  return recordSeq(this).__iterate(fn, reverse);
+};
+
+Record.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+  if (ownerID === this.__ownerID) {
+    return this;
+  }
+  var newValues = this._values.__ensureOwner(ownerID);
+  if (!ownerID) {
+    this.__ownerID = ownerID;
+    this._values = newValues;
+    return this;
+  }
+  return makeRecord(this, newValues, ownerID);
+};
+
+Record.isRecord = isRecord;
+Record.getDescriptiveName = recordName;
+var RecordPrototype = Record.prototype;
+RecordPrototype[IS_RECORD_SYMBOL] = true;
+RecordPrototype[DELETE] = RecordPrototype.remove;
+RecordPrototype.deleteIn = RecordPrototype.removeIn = deleteIn;
+RecordPrototype.getIn = getIn$1;
+RecordPrototype.hasIn = CollectionPrototype.hasIn;
+RecordPrototype.merge = merge;
+RecordPrototype.mergeWith = mergeWith;
+RecordPrototype.mergeIn = mergeIn;
+RecordPrototype.mergeDeep = mergeDeep$1;
+RecordPrototype.mergeDeepWith = mergeDeepWith$1;
+RecordPrototype.mergeDeepIn = mergeDeepIn;
+RecordPrototype.setIn = setIn$1;
+RecordPrototype.update = update$1;
+RecordPrototype.updateIn = updateIn$1;
+RecordPrototype.withMutations = withMutations;
+RecordPrototype.asMutable = asMutable;
+RecordPrototype.asImmutable = asImmutable;
+RecordPrototype[ITERATOR_SYMBOL] = RecordPrototype.entries;
+RecordPrototype.toJSON = RecordPrototype.toObject =
+  CollectionPrototype.toObject;
+RecordPrototype.inspect = RecordPrototype.toSource = function() {
+  return this.toString();
+};
+
+function makeRecord(likeRecord, values, ownerID) {
+  var record = Object.create(Object.getPrototypeOf(likeRecord));
+  record._values = values;
+  record.__ownerID = ownerID;
+  return record;
+}
+
+function recordName(record) {
+  return record.constructor.displayName || record.constructor.name || 'Record';
+}
+
+function recordSeq(record) {
+  return keyedSeqFromValue(record._keys.map(function (k) { return [k, record.get(k)]; }));
+}
+
+function setProp(prototype, name) {
+  try {
+    Object.defineProperty(prototype, name, {
+      get: function() {
+        return this.get(name);
+      },
+      set: function(value) {
+        invariant(this.__ownerID, 'Cannot set on an immutable record.');
+        this.set(name, value);
+      },
+    });
+  } catch (error) {
+    // Object.defineProperty failed. Probably IE8.
+  }
+}
+
+/**
+ * Returns a lazy Seq of `value` repeated `times` times. When `times` is
+ * undefined, returns an infinite sequence of `value`.
+ */
+var Repeat = /*@__PURE__*/(function (IndexedSeq$$1) {
+  function Repeat(value, times) {
+    if (!(this instanceof Repeat)) {
+      return new Repeat(value, times);
+    }
+    this._value = value;
+    this.size = times === undefined ? Infinity : Math.max(0, times);
+    if (this.size === 0) {
+      if (EMPTY_REPEAT) {
+        return EMPTY_REPEAT;
+      }
+      EMPTY_REPEAT = this;
+    }
+  }
+
+  if ( IndexedSeq$$1 ) Repeat.__proto__ = IndexedSeq$$1;
+  Repeat.prototype = Object.create( IndexedSeq$$1 && IndexedSeq$$1.prototype );
+  Repeat.prototype.constructor = Repeat;
+
+  Repeat.prototype.toString = function toString () {
+    if (this.size === 0) {
+      return 'Repeat []';
+    }
+    return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]';
+  };
+
+  Repeat.prototype.get = function get (index, notSetValue) {
+    return this.has(index) ? this._value : notSetValue;
+  };
+
+  Repeat.prototype.includes = function includes (searchValue) {
+    return is(this._value, searchValue);
+  };
+
+  Repeat.prototype.slice = function slice (begin, end) {
+    var size = this.size;
+    return wholeSlice(begin, end, size)
+      ? this
+      : new Repeat(
+          this._value,
+          resolveEnd(end, size) - resolveBegin(begin, size)
+        );
+  };
+
+  Repeat.prototype.reverse = function reverse () {
+    return this;
+  };
+
+  Repeat.prototype.indexOf = function indexOf (searchValue) {
+    if (is(this._value, searchValue)) {
+      return 0;
+    }
+    return -1;
+  };
+
+  Repeat.prototype.lastIndexOf = function lastIndexOf (searchValue) {
+    if (is(this._value, searchValue)) {
+      return this.size;
+    }
+    return -1;
+  };
+
+  Repeat.prototype.__iterate = function __iterate (fn, reverse) {
+    var size = this.size;
+    var i = 0;
+    while (i !== size) {
+      if (fn(this._value, reverse ? size - ++i : i++, this) === false) {
+        break;
+      }
+    }
+    return i;
+  };
+
+  Repeat.prototype.__iterator = function __iterator (type, reverse) {
+    var this$1 = this;
+
+    var size = this.size;
+    var i = 0;
+    return new Iterator(
+      function () { return i === size
+          ? iteratorDone()
+          : iteratorValue(type, reverse ? size - ++i : i++, this$1._value); }
+    );
+  };
+
+  Repeat.prototype.equals = function equals (other) {
+    return other instanceof Repeat
+      ? is(this._value, other._value)
+      : deepEqual(other);
+  };
+
+  return Repeat;
+}(IndexedSeq));
+
+var EMPTY_REPEAT;
+
+function fromJS(value, converter) {
+  return fromJSWith(
+    [],
+    converter || defaultConverter,
+    value,
+    '',
+    converter && converter.length > 2 ? [] : undefined,
+    { '': value }
+  );
+}
+
+function fromJSWith(stack, converter, value, key, keyPath, parentValue) {
+  var toSeq = Array.isArray(value)
+    ? IndexedSeq
+    : isPlainObj(value)
+      ? KeyedSeq
+      : null;
+  if (toSeq) {
+    if (~stack.indexOf(value)) {
+      throw new TypeError('Cannot convert circular structure to Immutable');
+    }
+    stack.push(value);
+    keyPath && key !== '' && keyPath.push(key);
+    var converted = converter.call(
+      parentValue,
+      key,
+      toSeq(value).map(function (v, k) { return fromJSWith(stack, converter, v, k, keyPath, value); }
+      ),
+      keyPath && keyPath.slice()
+    );
+    stack.pop();
+    keyPath && keyPath.pop();
+    return converted;
+  }
+  return value;
+}
+
+function defaultConverter(k, v) {
+  return isKeyed(v) ? v.toMap() : v.toList();
+}
+
+var version = "4.0.0-rc.11";
+
+var Immutable = {
+  version: version,
+
+  Collection: Collection,
+  // Note: Iterable is deprecated
+  Iterable: Collection,
+
+  Seq: Seq,
+  Map: Map,
+  OrderedMap: OrderedMap,
+  List: List,
+  Stack: Stack,
+  Set: Set,
+  OrderedSet: OrderedSet,
+
+  Record: Record,
+  Range: Range,
+  Repeat: Repeat,
+
+  is: is,
+  fromJS: fromJS,
+  hash: hash,
+
+  isImmutable: isImmutable,
+  isCollection: isCollection,
+  isKeyed: isKeyed,
+  isIndexed: isIndexed,
+  isAssociative: isAssociative,
+  isOrdered: isOrdered,
+  isValueObject: isValueObject,
+  isSeq: isSeq,
+  isList: isList,
+  isMap: isMap,
+  isOrderedMap: isOrderedMap,
+  isStack: isStack,
+  isSet: isSet,
+  isOrderedSet: isOrderedSet,
+  isRecord: isRecord,
+
+  get: get,
+  getIn: getIn,
+  has: has,
+  hasIn: hasIn,
+  merge: merge$1,
+  mergeDeep: mergeDeep,
+  mergeWith: mergeWith$1,
+  mergeDeepWith: mergeDeepWith,
+  remove: remove,
+  removeIn: removeIn,
+  set: set,
+  setIn: setIn,
+  update: update,
+  updateIn: updateIn,
+};
+
+// Note: Iterable is deprecated
+var Iterable = Collection;
+
+export default Immutable;
+export { version, Collection, Iterable, Seq, Map, OrderedMap, List, Stack, Set, OrderedSet, Record, Range, Repeat, is, fromJS, hash, isImmutable, isCollection, isKeyed, isIndexed, isAssociative, isOrdered, isValueObject, get, getIn, has, hasIn, merge$1 as merge, mergeDeep, mergeWith$1 as mergeWith, mergeDeepWith, remove, removeIn, set, setIn, update, updateIn };
diff --git a/B2Program/TrafficLight/Trace.prob2trace b/B2Program/TrafficLight/Trace.prob2trace
new file mode 100644
index 0000000000000000000000000000000000000000..0447513d1125dbd056ed24b3d4eaba1a8789dcf6
--- /dev/null
+++ b/B2Program/TrafficLight/Trace.prob2trace
@@ -0,0 +1,23 @@
+{
+	"description": "Created from B2Program JS Export",
+	"transitionList": [
+		{
+			"name": "$initialise_machine",
+			"params": {}
+		},
+		{
+			"name": "peds_g",
+			"params": {}
+		},
+		{
+			"name": "peds_r",
+			"params": {}
+		}
+	],
+	"metadata": {
+		"fileType": "Trace",
+		"formatVersion": 1,
+		"creator": "B2Program JS",
+		"modelName": "TrafficLight"
+	}
+}
diff --git a/B2Program/TrafficLight/TrafficLight-visualisation.js b/B2Program/TrafficLight/TrafficLight-visualisation.js
new file mode 100644
index 0000000000000000000000000000000000000000..3353be88b4cb92a40235fa4a02eb52969c5e6b19
--- /dev/null
+++ b/B2Program/TrafficLight/TrafficLight-visualisation.js
@@ -0,0 +1,1052 @@
+import TrafficLight from "./TrafficLight.js";
+import {SelectError} from "./btypes/BUtils.js";
+import {colors} from "./TrafficLight.js"
+
+import {enum_colors} from "./TrafficLight.js"
+
+import {BTuple} from "./btypes/BTuple.js";
+import {BSet} from "./btypes/BSet.js";
+import {BBoolean} from "./btypes/BBoolean.js";
+import {BObject} from "./btypes/BObject.js";
+import {BString} from "./btypes/BString.js";
+
+var _machine = new TrafficLight();
+var _state_list = [];
+var _transition_list = [];
+var _included_machines = {};
+_included_machines["TrafficLight"] = function(){return _machine};
+var _state_view_vars = document.getElementById("_state_view_variables");
+var _state_view_consts = document.getElementById("_state_view_constants");
+var _state_view_sets = document.getElementById("_state_view_sets");
+var _state_view_invariant = document.getElementById("_state_view_invariant");
+var _svg_vars = {}
+_svg_vars["cars_green"] = document.getElementById("traffic_light").contentDocument.getElementById("cars_green")
+_svg_vars["peds_green"] = document.getElementById("traffic_light").contentDocument.getElementById("peds_green")
+_svg_vars["peds_red"] = document.getElementById("traffic_light").contentDocument.getElementById("peds_red")
+_svg_vars["cars_red"] = document.getElementById("traffic_light").contentDocument.getElementById("cars_red")
+_svg_vars["cars_yellow_1"] = document.getElementById("traffic_light").contentDocument.getElementById("cars_yellow_1")
+_svg_vars["cars_yellow_2"] = document.getElementById("traffic_light").contentDocument.getElementById("cars_yellow_2")
+var _machine_vars = {}
+var _var_label;
+var _var_div;
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["TrafficLight"]()._get_tl_cars();
+_var_div.id = "_var_tl_cars";
+_machine_vars["tl_cars"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_tl_cars";
+_var_label.innerHTML = "TrafficLight.tl_cars";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["TrafficLight"]()._get_tl_peds();
+_var_div.id = "_var_tl_peds";
+_machine_vars["tl_peds"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_tl_peds";
+_var_label.innerHTML = "TrafficLight.tl_peds";
+_state_view_vars.appendChild(_var_label);
+_state_view_vars.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["TrafficLight"]()._get__colors();
+_var_div.id = "_var_colors";
+_machine_vars["colors"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_var_colors";
+_var_label.innerHTML = "TrafficLight.colors";
+_state_view_sets.appendChild(_var_label);
+_state_view_sets.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["TrafficLight"]()._check_inv_1();
+_var_div.id = "_check_inv_1";
+_machine_vars["_check_inv_1"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_1";
+_var_label.innerHTML = "tl_cars:colors";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["TrafficLight"]()._check_inv_2();
+_var_div.id = "_check_inv_2";
+_machine_vars["_check_inv_2"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_2";
+_var_label.innerHTML = "tl_peds:{red,green}";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+_var_div = document.createElement("div");
+_var_div.innerHTML = _included_machines["TrafficLight"]()._check_inv_3();
+_var_div.id = "_check_inv_3";
+_machine_vars["_check_inv_3"] = _var_div;
+_var_label = document.createElement("label");
+_var_label.htmlFor = "_check_inv_3";
+_var_label.innerHTML = "tl_peds=red or tl_cars=red";
+_state_view_invariant.appendChild(_var_label);
+_state_view_invariant.appendChild(_var_div);
+
+function updateVisuals () {
+  _svg_vars["cars_green"].setAttribute("fill", (_machine._get_tl_cars().equal(new colors(enum_colors.green)).booleanValue() ? new BString("green") : new BString("black")).getValue());
+  _svg_vars["peds_red"].setAttribute("fill", (_machine._get_tl_peds().equal(new colors(enum_colors.red)).booleanValue() ? new BString("red") : new BString("black")).getValue());
+  _svg_vars["cars_yellow_2"].setAttribute("visibility", (_machine._get_tl_cars().unequal(new colors(enum_colors.red)).booleanValue() ? new BString("visible") : new BString("hidden")).getValue());
+  _svg_vars["cars_yellow_1"].setAttribute("fill", (new BBoolean(_machine._get_tl_cars().equal(new colors(enum_colors.yellow)).booleanValue() || _machine._get_tl_cars().equal(new colors(enum_colors.redyellow)).booleanValue()).booleanValue() ? new BString("yellow") : new BString("black")).getValue());
+  _svg_vars["cars_yellow_2"].setAttribute("fill", (new BBoolean(_machine._get_tl_cars().equal(new colors(enum_colors.yellow)).booleanValue() || _machine._get_tl_cars().equal(new colors(enum_colors.redyellow)).booleanValue()).booleanValue() ? new BString("yellow") : new BString("black")).getValue());
+  _svg_vars["cars_yellow_1"].setAttribute("visibility", (_machine._get_tl_cars().unequal(new colors(enum_colors.green)).booleanValue() ? new BString("visible") : new BString("hidden")).getValue());
+  _svg_vars["peds_green"].setAttribute("fill", (_machine._get_tl_peds().equal(new colors(enum_colors.green)).booleanValue() ? new BString("green") : new BString("black")).getValue());
+  _svg_vars["cars_red"].setAttribute("fill", (new BBoolean(_machine._get_tl_cars().equal(new colors(enum_colors.red)).booleanValue() || _machine._get_tl_cars().equal(new colors(enum_colors.redyellow)).booleanValue()).booleanValue() ? new BString("red") : new BString("black")).getValue());
+  _machine_vars["tl_cars"].innerHTML = _included_machines["TrafficLight"]()._get_tl_cars();
+  _machine_vars["tl_peds"].innerHTML = _included_machines["TrafficLight"]()._get_tl_peds();
+  for (let i = 1; i <= 3; i++) {
+    _machine_vars["_check_inv_"+i].innerHTML = _machine["_check_inv_"+i]();
+  }
+  checkTransitions();
+}
+
+var _history_view_buttons = document.getElementById("_history_view_buttons");
+var _buttonLeft = document.createElement("button");
+var _buttonRight = document.createElement("button");
+var _buttonUpload = document.createElement("button");
+var _buttonExport = document.createElement("button");
+var _inputUpload = document.createElement("input");
+var _buttonRun10 = document.createElement("button");
+var _buttonRun500 = document.createElement("button");
+
+function flattenTuple(tuple) {
+    if(!(tuple instanceof BTuple)) {
+        return [tuple];
+    }
+    return [tuple.projection1(), ...flattenTuple(tuple.projection2())];
+}
+
+function createOptionList(event, transition) {
+    let collator = new Intl.Collator([], {numeric: true});
+    for(let index in _machine_events[event].parameterNames) {
+        let parameter = _machine_events[event].parameterNames[index];
+        var datalist = document.querySelector("#" + event + "_" + parameter + "_datalist");
+        datalist.replaceChildren();
+        for(let value of Array.of(...transition).sort((a, b) => collator.compare(a, b))) {
+            let option = document.createElement("option");
+            value = flattenTuple(value);
+            option.text = value[index].toString();
+            datalist.appendChild(option);
+        }
+    }
+}
+
+function checkTransitions () {
+    let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+    for(event in _machine_events) {
+      var transition;
+      if(_transition_list[index]?.[event] == null ?? true) {
+         transition = _machine["_tr_" + event]();
+         _transition_list[index][event] = transition;
+      } else {
+         transition = _transition_list[index][event];
+      }
+      if(!(transition instanceof BSet)) {
+        _machine_events[event].disabled = !transition;
+      } else if (transition.size().intValue() == 0) {
+        _machine_events[event].disabled = true;
+      } else {
+        let collator = new Intl.Collator([], {numeric: true});
+        for(let current_transition of transition) {
+            try {
+                var current_machine = _machine._copy();
+                current_machine[event](...flattenTuple(current_transition));
+            } catch (error) {
+                  if(! error instanceof SelectError) {
+                      throw error;
+                  }
+                  transition = transition.difference(new BSet(current_transition));
+            }
+        }
+        if(transition.size().intValue() == 0) {
+            _machine_events[event].disabled = true;
+        } else {
+            _machine_events[event].disabled = false;
+        }
+        createOptionList(event, transition);
+      }
+    }
+    _buttonLeft.disabled = document.querySelector(".active").index <= 0;
+    _buttonRight.disabled = document.querySelector(".active").index >= document.querySelector("span:last-of-type").index;
+}
+
+_operations_view = document.getElementById("_operations_view");
+_history_view = document.getElementById("_history_view");
+_scenario_view = document.getElementById("_scenario_view");
+
+var _history_onclick_function = function () {
+  _machine = _state_list[this.index]._copy();
+  document.querySelectorAll("span").forEach(el => el.classList.remove("active"));
+  this.classList.add("active");
+  updateVisuals();
+}
+
+function createHistoryElement(text, index) {
+  var history_element = document.createElement("span");
+  history_element.innerHTML = text + "</br>";
+  history_element.index = index;
+  document.querySelectorAll("span.active").forEach(element => element.classList.remove("active"));
+  history_element.classList.add("active");
+  history_element.onclick = _history_onclick_function;
+  _state_list = _state_list.slice(0, index);
+  _state_list.push(_machine._copy());
+  _transition_list = _transition_list.slice(0, index);
+  _transition_list.push({});
+  while(_history_view.querySelectorAll("span").length > index && _history_view.lastChild !== null) {
+    _history_view.removeChild(_history_view.lastChild);
+  }
+  _history_view.appendChild(history_element);
+}
+
+function selectHistoryElement(offset) {
+  let currentHistoryElement = _history_view.querySelector(".active");
+  let index = currentHistoryElement.index + offset;
+  if (index < 0 || index >= _state_list.length) {
+    return;
+  }
+  currentHistoryElement.classList.remove("active");
+  _machine = _state_list[index]._copy();
+  _history_view.querySelectorAll(".active").forEach(el => el.classList.remove("active"));
+  currentHistoryElement = _history_view.querySelector("span:nth-of-type(" + (index + 1) + ")");
+  currentHistoryElement.classList.add("active");
+  updateVisuals();
+}
+
+function createScenarioElement(text, trace) {
+  var scenario_element = document.createElement("button");
+  var remove_element = document.createElement("button");
+  scenario_element.innerHTML = text + "</br>";
+  remove_element.innerHTML = "X";
+  var div_element = document.createElement("div");
+  div_element.appendChild(scenario_element);
+  div_element.appendChild(remove_element);
+  _scenario_view.appendChild(div_element);
+  scenario_element.onclick = function() {
+    displayTrace(trace);
+  };
+  remove_element.onclick = function() {
+    _scenario_view.removeChild(div_element);
+  };
+}
+
+
+_buttonLeft.innerHTML="&#9664;";
+_buttonLeft.onclick = function(){selectHistoryElement(-1)};
+_buttonRight.innerHTML="&#9654;";
+_buttonRight.onclick = function(){selectHistoryElement(1)};
+_history_view_buttons.appendChild(_buttonLeft);
+_history_view_buttons.appendChild(_buttonRight);
+
+_buttonUpload.textContent = "Import trace";
+_buttonUpload.onclick = importTrace;
+_history_view_buttons.appendChild(_buttonUpload);
+
+_buttonExport.textContent = "Export trace";
+_buttonExport.onclick = exportTrace;
+_history_view_buttons.appendChild(_buttonExport);
+
+_buttonRun10.textContent = "Run trace(10ms)";
+_buttonRun10.onclick = function(){runTrace(10);};
+_history_view_buttons.appendChild(_buttonRun10);
+
+_buttonRun500.textContent = "Run trace(500ms)";
+_buttonRun500.onclick = function(){runTrace(500);};
+_history_view_buttons.appendChild(_buttonRun500);
+
+createHistoryElement("Initialisation", 0);
+var _current_trace = [{name: "$initialise_machine", params: {}}];
+
+var _param_div;
+var _param_datalist;
+var _onclick_function;
+var _machine_events = {};
+var _svg_events = {};
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["cars_y"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["cars_y"].style.gridColumn="-1";
+_machine_events["cars_y"].innerHTML = "cars_y";
+_machine_events["cars_y"].parameterNames = [];
+_machine_events["cars_y"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["cars_y"] == null ?? true) {
+      transition = _machine["_tr_cars_y"]();
+      _transition_list[index]["cars_y"] = transition;
+  } else {
+      transition = _transition_list[index]["cars_y"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event cars_y is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event cars_y!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event cars_y!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.cars_y(...parameters);
+    createHistoryElement("cars_y(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "cars_y", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["cars_y"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["cars_y"].disabled = true;
+        }
+        createOptionList("cars_y", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["cars_y"]);
+
+_svg_events["cars_yellow_2"] = document.getElementById("traffic_light").contentDocument.getElementById("cars_yellow_2");
+_svg_events["cars_yellow_2"].onclick = function() {
+  var parameters = {
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["cars_y"] == null ?? true) {
+      transition = _machine["_tr_cars_y"]();
+      _transition_list[index]["cars_y"] = transition;
+  } else {
+      transition = _transition_list[index]["cars_y"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event cars_y is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event cars_y!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event cars_y!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.cars_y(...parameters);
+    createHistoryElement("cars_y(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "cars_y", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["cars_y"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["cars_y"].disabled = true;
+        }
+        createOptionList("cars_y", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["peds_g"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["peds_g"].style.gridColumn="-1";
+_machine_events["peds_g"].innerHTML = "peds_g";
+_machine_events["peds_g"].parameterNames = [];
+_machine_events["peds_g"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["peds_g"] == null ?? true) {
+      transition = _machine["_tr_peds_g"]();
+      _transition_list[index]["peds_g"] = transition;
+  } else {
+      transition = _transition_list[index]["peds_g"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event peds_g is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event peds_g!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event peds_g!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.peds_g(...parameters);
+    createHistoryElement("peds_g(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "peds_g", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["peds_g"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["peds_g"].disabled = true;
+        }
+        createOptionList("peds_g", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["peds_g"]);
+
+_svg_events["peds_green"] = document.getElementById("traffic_light").contentDocument.getElementById("peds_green");
+_svg_events["peds_green"].onclick = function() {
+  var parameters = {
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["peds_g"] == null ?? true) {
+      transition = _machine["_tr_peds_g"]();
+      _transition_list[index]["peds_g"] = transition;
+  } else {
+      transition = _transition_list[index]["peds_g"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event peds_g is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event peds_g!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event peds_g!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.peds_g(...parameters);
+    createHistoryElement("peds_g(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "peds_g", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["peds_g"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["peds_g"].disabled = true;
+        }
+        createOptionList("peds_g", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["cars_r"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["cars_r"].style.gridColumn="-1";
+_machine_events["cars_r"].innerHTML = "cars_r";
+_machine_events["cars_r"].parameterNames = [];
+_machine_events["cars_r"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["cars_r"] == null ?? true) {
+      transition = _machine["_tr_cars_r"]();
+      _transition_list[index]["cars_r"] = transition;
+  } else {
+      transition = _transition_list[index]["cars_r"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event cars_r is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event cars_r!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event cars_r!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.cars_r(...parameters);
+    createHistoryElement("cars_r(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "cars_r", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["cars_r"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["cars_r"].disabled = true;
+        }
+        createOptionList("cars_r", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["cars_r"]);
+
+_svg_events["cars_red"] = document.getElementById("traffic_light").contentDocument.getElementById("cars_red");
+_svg_events["cars_red"].onclick = function() {
+  var parameters = {
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["cars_r"] == null ?? true) {
+      transition = _machine["_tr_cars_r"]();
+      _transition_list[index]["cars_r"] = transition;
+  } else {
+      transition = _transition_list[index]["cars_r"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event cars_r is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event cars_r!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event cars_r!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.cars_r(...parameters);
+    createHistoryElement("cars_r(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "cars_r", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["cars_r"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["cars_r"].disabled = true;
+        }
+        createOptionList("cars_r", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["peds_r"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["peds_r"].style.gridColumn="-1";
+_machine_events["peds_r"].innerHTML = "peds_r";
+_machine_events["peds_r"].parameterNames = [];
+_machine_events["peds_r"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["peds_r"] == null ?? true) {
+      transition = _machine["_tr_peds_r"]();
+      _transition_list[index]["peds_r"] = transition;
+  } else {
+      transition = _transition_list[index]["peds_r"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event peds_r is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event peds_r!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event peds_r!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.peds_r(...parameters);
+    createHistoryElement("peds_r(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "peds_r", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["peds_r"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["peds_r"].disabled = true;
+        }
+        createOptionList("peds_r", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["peds_r"]);
+
+_svg_events["peds_red"] = document.getElementById("traffic_light").contentDocument.getElementById("peds_red");
+_svg_events["peds_red"].onclick = function() {
+  var parameters = {
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["peds_r"] == null ?? true) {
+      transition = _machine["_tr_peds_r"]();
+      _transition_list[index]["peds_r"] = transition;
+  } else {
+      transition = _transition_list[index]["peds_r"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event peds_r is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event peds_r!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event peds_r!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.peds_r(...parameters);
+    createHistoryElement("peds_r(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "peds_r", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["peds_r"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["peds_r"].disabled = true;
+        }
+        createOptionList("peds_r", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["cars_ry"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["cars_ry"].style.gridColumn="-1";
+_machine_events["cars_ry"].innerHTML = "cars_ry";
+_machine_events["cars_ry"].parameterNames = [];
+_machine_events["cars_ry"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["cars_ry"] == null ?? true) {
+      transition = _machine["_tr_cars_ry"]();
+      _transition_list[index]["cars_ry"] = transition;
+  } else {
+      transition = _transition_list[index]["cars_ry"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event cars_ry is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event cars_ry!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event cars_ry!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.cars_ry(...parameters);
+    createHistoryElement("cars_ry(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "cars_ry", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["cars_ry"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["cars_ry"].disabled = true;
+        }
+        createOptionList("cars_ry", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["cars_ry"]);
+
+_svg_events["cars_yellow_1"] = document.getElementById("traffic_light").contentDocument.getElementById("cars_yellow_1");
+_svg_events["cars_yellow_1"].onclick = function() {
+  var parameters = {
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["cars_ry"] == null ?? true) {
+      transition = _machine["_tr_cars_ry"]();
+      _transition_list[index]["cars_ry"] = transition;
+  } else {
+      transition = _transition_list[index]["cars_ry"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event cars_ry is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event cars_ry!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event cars_ry!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.cars_ry(...parameters);
+    createHistoryElement("cars_ry(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "cars_ry", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["cars_ry"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["cars_ry"].disabled = true;
+        }
+        createOptionList("cars_ry", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_param_div = document.createElement("div");
+_param_div.classList.add("param");
+_machine_events["cars_g"] = document.createElement("button");
+_operations_view.appendChild(_param_div);
+
+
+_machine_events["cars_g"].style.gridColumn="-1";
+_machine_events["cars_g"].innerHTML = "cars_g";
+_machine_events["cars_g"].parameterNames = [];
+_machine_events["cars_g"].onclick = function() {
+  var parameters = {};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["cars_g"] == null ?? true) {
+      transition = _machine["_tr_cars_g"]();
+      _transition_list[index]["cars_g"] = transition;
+  } else {
+      transition = _transition_list[index]["cars_g"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event cars_g is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event cars_g!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event cars_g!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.cars_g(...parameters);
+    createHistoryElement("cars_g(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "cars_g", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["cars_g"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["cars_g"].disabled = true;
+        }
+        createOptionList("cars_g", transition);
+    }
+    alert(error.message);
+  }
+}
+
+_operations_view.appendChild(_machine_events["cars_g"]);
+
+_svg_events["cars_green"] = document.getElementById("traffic_light").contentDocument.getElementById("cars_green");
+_svg_events["cars_green"].onclick = function() {
+  var parameters = {
+};
+  let index = [..._history_view.children].indexOf(_history_view.querySelector(".active"));
+  var transition;
+  if(_transition_list[index]?.["cars_g"] == null ?? true) {
+      transition = _machine["_tr_cars_g"]();
+      _transition_list[index]["cars_g"] = transition;
+  } else {
+      transition = _transition_list[index]["cars_g"];
+  }
+  if(!(transition instanceof BSet)) {
+    if(!transition) {
+        alert("Event cars_g is not enabled!");
+        return;
+    }
+  } else {
+    try  {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+    } catch {
+        alert("Invalid parameters for event cars_g!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+    if(! transition.elementOf(parameterTuple).booleanValue()) {
+        alert("Invalid parameters for event cars_g!\nPossible values are:\n" + transition.toString());
+        return;
+    }
+  }
+  try {
+    var parameters = [];
+    var returnValue = _machine.cars_g(...parameters);
+    createHistoryElement("cars_g(" + parameters.join(", ") + ")" + (returnValue? " -> (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+    let parametersJSON = {};
+
+    _current_trace.push({name: "cars_g", params: parametersJSON});
+    updateVisuals();
+  } catch (error) {
+    if(! error instanceof SelectError) {
+        throw error;
+    }
+    if(transition instanceof BSet) {
+        var parameterTuple = [].reduce((a, e) => new BTuple(a, e));
+        transition = transition.difference(new BSet(parameterTuple));
+        _transition_list[index]["cars_g"] = transition;
+        if(transition.size().intValue() == 0) {
+            _machine_events["cars_g"].disabled = true;
+        }
+        createOptionList("cars_g", transition);
+    }
+    alert(error.message);
+  }
+}
+
+
+
+updateVisuals();
+if(_operations_view.querySelectorAll("label").length == 0) {
+    document.documentElement.style.setProperty('--noneOrGrid', 'none');
+}
+
+function displayTrace(trace) {
+    selectHistoryElement(-_history_view.querySelector(".active").index);
+    let transitions = trace.transitionList
+    for(let transition of transitions) {
+      if(transition.name.startsWith("$")) {
+        continue;
+      }
+      if(transition.params == null) {
+        transition.params = {};
+      }
+      let parameters = Object.keys(transition.params).map(param => _machine_events[transition.name][param].parseValue(transition.params[param]))
+      let returnValue = _machine[transition.name](...parameters);
+      createHistoryElement(transition.name + "(" + parameters.join(", ") + ")" + (returnValue? " (" + returnValue.toString() + ")": ""), _history_view.querySelector(".active").index + 1);
+      let parametersJSON = {};
+
+      _current_trace.push({name: transition.name, params: parametersJSON});
+    }
+    updateVisuals();
+    selectHistoryElement(_history_view.querySelector("span:last-of-type").index-_history_view.querySelector(".active").index);
+}
+
+function importTrace() {
+    var _file_input = document.querySelector("#_upload_trace_input");
+    _file_input.accept = ".prob2trace";
+
+    _file_input.onchange = async _ => {
+        let files = Array.from(_file_input.files);
+        let file = files[0];
+        let response = await fetch(file.name);
+        let data = await response.text();
+        let trace = JSON.parse(data);
+        createScenarioElement(file.name, trace);
+
+        try {
+            displayTrace(trace);
+        } catch (error) {
+            alert("Trace could not be completely imported.");
+            console.error(error);
+        }
+    };
+
+    _file_input.click();
+}
+
+function exportTrace() {
+  var transitions = _current_trace;
+  var object = {
+    description: "Created from B2Program JS Export",
+    transitionList: transitions,
+    metadata: {
+      fileType: "Trace",
+      formatVersion: 1,
+      creator: "B2Program JS",
+      modelName: "TrafficLight"
+    }
+  };
+  const blob = new Blob([JSON.stringify(object, null, '\t')]);
+  const a = document.createElement('a');
+  a.href = URL.createObjectURL(blob);
+  a.download = 'Scenario.prob2trace';
+  a.click();
+}
+
+function sleep(ms) {
+    return new Promise(resolve => setTimeout(resolve, ms));
+}
+
+async function runTrace(ms) {
+    let firstElement = _history_view.querySelector("span");
+    firstElement.click();
+    let currentHistoryElement = _history_view.querySelector(".active");
+    let index = currentHistoryElement.index + 1;
+    while (index >= 0 && index < _state_list.length) {
+      selectHistoryElement(1);
+      await sleep(ms);
+      currentHistoryElement = _history_view.querySelector(".active");
+      index = currentHistoryElement.index + 1;
+    }
+}
diff --git a/B2Program/TrafficLight/TrafficLight.html b/B2Program/TrafficLight/TrafficLight.html
new file mode 100644
index 0000000000000000000000000000000000000000..9553c00715e1fadbd22574e2082b428e8ba80c08
--- /dev/null
+++ b/B2Program/TrafficLight/TrafficLight.html
@@ -0,0 +1,145 @@
+<!doctype html>
+
+<html lang="en">
+<head>
+  <meta charset="utf-8">
+  <title>TrafficLight</title>
+<head>
+
+<body>
+  <div>
+    <h1>Visualization <br></h1>
+    <object id="traffic_light" data="traffic_light.svg" type="image/svg+xml"></object>
+  </div>
+  <div>
+      <h1>Operations View <br></h1>
+      <div id="_operations_view">
+        <div class="param" style="grid-column: span 2;">Parameter</div>
+        <div style="text-align: center; grid-column: -1;">Event</div>
+      </div>
+  </div>
+  <div>
+    <h1>History View <br></h1>
+    <div id="_history_view_buttons">
+        <input id="_upload_trace_input" type="file" style="display:none;"></input>
+        <input id="_export_trace" type="file" style="display:none;"></input>
+    </div>
+    <div id="_history_view">
+    </div>
+    <br>
+    <br>
+    <h1>Scenario View <br></h1>
+    <div id="_scenario_view">
+    </div>
+  </div>
+  <div id="_state_view">
+    <h1>State View <br></h1>
+    <div id="_state_view_variables" class="state_view_section">
+        <div class="state_view_header collapsed" onclick="collapse(this)">Variables</div>
+    </div>
+    <div id="_state_view_constants" class="state_view_section">
+        <div class="state_view_header collapsed" onclick="collapse(this)">Constants</div>
+    </div>
+    <div id="_state_view_sets" class="state_view_section">
+            <div class="state_view_header collapsed" onclick="collapse(this)">Sets</div>
+        </div>
+    <div id="_state_view_invariant" class="state_view_section">
+            <div class="state_view_header collapsed" onclick="collapse(this)">Invariant</div>
+        </div>
+  </div>
+  <script type="module" src="./immutable/dist/immutable.es.js"></script>
+  <script type="module" src="./btypes/BTuple.js"></script>
+  <script type="module" src="./btypes/BBoolean.js"></script>
+  <script type="module" src="./btypes/BSet.js"></script>
+  <script type="module" src="./btypes/BObject.js"></script>
+  <script type="module" src="./TrafficLight.js"></script>
+  <script type="module" src="./TrafficLight-visualisation.js" defer></script>
+</body>
+
+<script>
+function collapse(element) {
+    element.classList.toggle("collapsed");
+}
+</script>
+<style>
+#_operations_view{
+    display: grid;
+    grid-template-columns: auto auto auto;
+    gap: 0.5%;
+    margin-bottom: auto;
+    margin-right: 1rem;
+}
+:root {
+    --noneOrGrid: grid;
+}
+.param{
+    display: var(--noneOrGrid);
+    grid-column: span 2;
+    grid-template-columns: subgrid;
+    gap: 5px;
+}
+#_history_view{
+    margin-bottom: auto;
+    margin-right: 1rem;
+    overflow-y  : auto;
+    padding-right: 18px;
+    max-height: 90vh;
+}
+#_history_view > span.active {
+    background: lightblue;
+}
+#_history_view_buttons {
+    display: grid;
+    grid-template-columns: 1fr 1fr;
+}
+
+#_scenario_view{
+    margin-right: 1rem;
+    overflow-y  : auto;
+    padding-right: 18px;
+    gap: 5%;
+    display: grid;
+}
+#_scenario_view > span.active {
+    background: lightblue;
+}
+#_scenario_view_buttons {
+    display: grid;
+    grid-template-columns: 1fr 1fr;
+}
+
+.state_view_section {
+    display: grid;
+    grid-template-columns: auto auto;
+    gap: 0px 20px;
+}
+.state_view_header {
+    grid-column: 1 / -1;
+    border-bottom: 1px solid black;
+}
+
+.state_view_header:only-child {
+    display: none;
+}
+
+.state_view_header::after {
+    content: "\25B2";
+    margin-left: 5px;
+    float: right;
+}
+.collapsed ~ * {
+    display: none;
+}
+.collapsed::after {
+    content: "\25BC";
+}
+body {
+display: flex;
+flex-direction: row;
+flex-wrap: wrap;
+gap: 20px;
+align-items: start;
+}
+</style>
+
+</html>
\ No newline at end of file
diff --git a/B2Program/TrafficLight/TrafficLight.ts b/B2Program/TrafficLight/TrafficLight.ts
new file mode 100644
index 0000000000000000000000000000000000000000..57805df47415a42bfdfef8aa5562f3134b5e3152
--- /dev/null
+++ b/B2Program/TrafficLight/TrafficLight.ts
@@ -0,0 +1,170 @@
+import {BTuple} from './btypes/BTuple.js';
+import {BBoolean} from './btypes/BBoolean.js';
+import {BSet} from './btypes/BSet.js';
+import {BObject} from './btypes/BObject.js';
+import {BUtils} from "./btypes/BUtils.js";
+import {SelectError} from "./btypes/BUtils.js";
+
+export enum enum_colors {
+    red,
+    redyellow,
+    yellow,
+    green
+}
+
+export class colors implements BObject{
+    value: enum_colors;
+
+    constructor(value: enum_colors) {
+        this.value = value;
+    }
+
+    equal(other: colors) {
+        return new BBoolean(this.value === other.value);
+    }
+
+    unequal(other: colors) {
+        return new BBoolean(this.value !== other.value);
+    }
+
+    equals(o: any) {
+        if(!(o instanceof colors)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+
+    hashCode() {
+        return 0;
+    }
+
+    toString() {
+        return enum_colors[this.value].toString();
+    }
+
+    static get_red () {return new colors(enum_colors.red);}
+    static get_redyellow () {return new colors(enum_colors.redyellow);}
+    static get_yellow () {return new colors(enum_colors.yellow);}
+    static get_green () {return new colors(enum_colors.green);}
+
+
+}
+
+
+export default class TrafficLight {
+
+
+
+    private static _colors: BSet<colors> = new BSet(new colors(enum_colors.red), new colors(enum_colors.redyellow), new colors(enum_colors.yellow), new colors(enum_colors.green));
+
+    private tl_cars: colors;
+    private tl_peds: colors;
+
+    constructor() {
+        this.tl_cars = new colors(enum_colors.red);
+        this.tl_peds = new colors(enum_colors.red);
+    }
+
+    public _copy(): TrafficLight {
+        let _instance = Object.create(TrafficLight.prototype);
+        for(let key of Object.keys(this)) {
+            _instance[key] = this[key]._copy?.() ?? this[key];
+        }
+        return _instance;
+    }
+
+     cars_ry(): void {
+        if((new BBoolean(this.tl_cars.equal(new colors(enum_colors.red)).booleanValue() && this.tl_peds.equal(new colors(enum_colors.red)).booleanValue())).booleanValue()) {
+            this.tl_cars = new colors(enum_colors.redyellow);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     cars_y(): void {
+        if((new BBoolean(this.tl_cars.equal(new colors(enum_colors.green)).booleanValue() && this.tl_peds.equal(new colors(enum_colors.red)).booleanValue())).booleanValue()) {
+            this.tl_cars = new colors(enum_colors.yellow);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     cars_g(): void {
+        if((new BBoolean(this.tl_cars.equal(new colors(enum_colors.redyellow)).booleanValue() && this.tl_peds.equal(new colors(enum_colors.red)).booleanValue())).booleanValue()) {
+            this.tl_cars = new colors(enum_colors.green);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     cars_r(): void {
+        if((new BBoolean(this.tl_cars.equal(new colors(enum_colors.yellow)).booleanValue() && this.tl_peds.equal(new colors(enum_colors.red)).booleanValue())).booleanValue()) {
+            this.tl_cars = new colors(enum_colors.red);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     peds_r(): void {
+        if((new BBoolean(this.tl_peds.equal(new colors(enum_colors.green)).booleanValue() && this.tl_cars.equal(new colors(enum_colors.red)).booleanValue())).booleanValue()) {
+            this.tl_peds = new colors(enum_colors.red);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+     peds_g(): void {
+        if((new BBoolean(this.tl_peds.equal(new colors(enum_colors.red)).booleanValue() && this.tl_cars.equal(new colors(enum_colors.red)).booleanValue())).booleanValue()) {
+            this.tl_peds = new colors(enum_colors.green);
+        }  else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+
+    _get_tl_cars(): colors {
+        return this.tl_cars;
+    }
+
+    _get_tl_peds(): colors {
+        return this.tl_peds;
+    }
+
+    _get__colors(): BSet<colors> {
+        return TrafficLight._colors;
+    }
+
+    _tr_cars_ry(): boolean {
+        return new BBoolean(this.tl_cars.equal(new colors(enum_colors.red)).booleanValue() && this.tl_peds.equal(new colors(enum_colors.red)).booleanValue()).booleanValue();
+    }
+
+    _tr_cars_y(): boolean {
+        return new BBoolean(this.tl_cars.equal(new colors(enum_colors.green)).booleanValue() && this.tl_peds.equal(new colors(enum_colors.red)).booleanValue()).booleanValue();
+    }
+
+    _tr_cars_g(): boolean {
+        return new BBoolean(this.tl_cars.equal(new colors(enum_colors.redyellow)).booleanValue() && this.tl_peds.equal(new colors(enum_colors.red)).booleanValue()).booleanValue();
+    }
+
+    _tr_cars_r(): boolean {
+        return new BBoolean(this.tl_cars.equal(new colors(enum_colors.yellow)).booleanValue() && this.tl_peds.equal(new colors(enum_colors.red)).booleanValue()).booleanValue();
+    }
+
+    _tr_peds_r(): boolean {
+        return new BBoolean(this.tl_peds.equal(new colors(enum_colors.green)).booleanValue() && this.tl_cars.equal(new colors(enum_colors.red)).booleanValue()).booleanValue();
+    }
+
+    _tr_peds_g(): boolean {
+        return new BBoolean(this.tl_peds.equal(new colors(enum_colors.red)).booleanValue() && this.tl_cars.equal(new colors(enum_colors.red)).booleanValue()).booleanValue();
+    }
+
+    _check_inv_1() {
+        return TrafficLight._colors.elementOf(this.tl_cars).booleanValue();
+    }_check_inv_2() {
+        return new BSet(new colors(enum_colors.red), new colors(enum_colors.green)).elementOf(this.tl_peds).booleanValue();
+    }_check_inv_3() {
+        return new BBoolean(this.tl_peds.equal(new colors(enum_colors.red)).booleanValue() || this.tl_cars.equal(new colors(enum_colors.red)).booleanValue()).booleanValue();
+    }
+
+
+}
+
diff --git a/B2Program/TrafficLight/Trafficlight.js b/B2Program/TrafficLight/Trafficlight.js
new file mode 100644
index 0000000000000000000000000000000000000000..0437e69056a9131098372aa49c31e416e06d7230
--- /dev/null
+++ b/B2Program/TrafficLight/Trafficlight.js
@@ -0,0 +1,136 @@
+import { BBoolean } from './btypes/BBoolean.js';
+import { BSet } from './btypes/BSet.js';
+import { SelectError } from "./btypes/BUtils.js";
+export var enum_colors;
+(function (enum_colors) {
+    enum_colors[enum_colors["red"] = 0] = "red";
+    enum_colors[enum_colors["redyellow"] = 1] = "redyellow";
+    enum_colors[enum_colors["yellow"] = 2] = "yellow";
+    enum_colors[enum_colors["green"] = 3] = "green";
+})(enum_colors || (enum_colors = {}));
+export class colors {
+    constructor(value) {
+        this.value = value;
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    unequal(other) {
+        return new BBoolean(this.value !== other.value);
+    }
+    equals(o) {
+        if (!(o instanceof colors)) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    hashCode() {
+        return 0;
+    }
+    toString() {
+        return enum_colors[this.value].toString();
+    }
+    static get_red() { return new colors(enum_colors.red); }
+    static get_redyellow() { return new colors(enum_colors.redyellow); }
+    static get_yellow() { return new colors(enum_colors.yellow); }
+    static get_green() { return new colors(enum_colors.green); }
+}
+export default class TrafficLight {
+    constructor() {
+        this.tl_cars = new colors(enum_colors.red);
+        this.tl_peds = new colors(enum_colors.red);
+    }
+    _copy() {
+        var _a, _b, _c;
+        let _instance = Object.create(TrafficLight.prototype);
+        for (let key of Object.keys(this)) {
+            _instance[key] = (_c = (_b = (_a = this[key])._copy) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : this[key];
+        }
+        return _instance;
+    }
+    cars_ry() {
+        if ((new BBoolean(this.tl_cars.equal(new colors(enum_colors.red)).booleanValue() && this.tl_peds.equal(new colors(enum_colors.red)).booleanValue())).booleanValue()) {
+            this.tl_cars = new colors(enum_colors.redyellow);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    cars_y() {
+        if ((new BBoolean(this.tl_cars.equal(new colors(enum_colors.green)).booleanValue() && this.tl_peds.equal(new colors(enum_colors.red)).booleanValue())).booleanValue()) {
+            this.tl_cars = new colors(enum_colors.yellow);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    cars_g() {
+        if ((new BBoolean(this.tl_cars.equal(new colors(enum_colors.redyellow)).booleanValue() && this.tl_peds.equal(new colors(enum_colors.red)).booleanValue())).booleanValue()) {
+            this.tl_cars = new colors(enum_colors.green);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    cars_r() {
+        if ((new BBoolean(this.tl_cars.equal(new colors(enum_colors.yellow)).booleanValue() && this.tl_peds.equal(new colors(enum_colors.red)).booleanValue())).booleanValue()) {
+            this.tl_cars = new colors(enum_colors.red);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    peds_r() {
+        if ((new BBoolean(this.tl_peds.equal(new colors(enum_colors.green)).booleanValue() && this.tl_cars.equal(new colors(enum_colors.red)).booleanValue())).booleanValue()) {
+            this.tl_peds = new colors(enum_colors.red);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    peds_g() {
+        if ((new BBoolean(this.tl_peds.equal(new colors(enum_colors.red)).booleanValue() && this.tl_cars.equal(new colors(enum_colors.red)).booleanValue())).booleanValue()) {
+            this.tl_peds = new colors(enum_colors.green);
+        }
+        else {
+            throw new SelectError("Parameters are invalid!");
+        }
+    }
+    _get_tl_cars() {
+        return this.tl_cars;
+    }
+    _get_tl_peds() {
+        return this.tl_peds;
+    }
+    _get__colors() {
+        return TrafficLight._colors;
+    }
+    _tr_cars_ry() {
+        return new BBoolean(this.tl_cars.equal(new colors(enum_colors.red)).booleanValue() && this.tl_peds.equal(new colors(enum_colors.red)).booleanValue()).booleanValue();
+    }
+    _tr_cars_y() {
+        return new BBoolean(this.tl_cars.equal(new colors(enum_colors.green)).booleanValue() && this.tl_peds.equal(new colors(enum_colors.red)).booleanValue()).booleanValue();
+    }
+    _tr_cars_g() {
+        return new BBoolean(this.tl_cars.equal(new colors(enum_colors.redyellow)).booleanValue() && this.tl_peds.equal(new colors(enum_colors.red)).booleanValue()).booleanValue();
+    }
+    _tr_cars_r() {
+        return new BBoolean(this.tl_cars.equal(new colors(enum_colors.yellow)).booleanValue() && this.tl_peds.equal(new colors(enum_colors.red)).booleanValue()).booleanValue();
+    }
+    _tr_peds_r() {
+        return new BBoolean(this.tl_peds.equal(new colors(enum_colors.green)).booleanValue() && this.tl_cars.equal(new colors(enum_colors.red)).booleanValue()).booleanValue();
+    }
+    _tr_peds_g() {
+        return new BBoolean(this.tl_peds.equal(new colors(enum_colors.red)).booleanValue() && this.tl_cars.equal(new colors(enum_colors.red)).booleanValue()).booleanValue();
+    }
+    _check_inv_1() {
+        return TrafficLight._colors.elementOf(this.tl_cars).booleanValue();
+    }
+    _check_inv_2() {
+        return new BSet(new colors(enum_colors.red), new colors(enum_colors.green)).elementOf(this.tl_peds).booleanValue();
+    }
+    _check_inv_3() {
+        return new BBoolean(this.tl_peds.equal(new colors(enum_colors.red)).booleanValue() || this.tl_cars.equal(new colors(enum_colors.red)).booleanValue()).booleanValue();
+    }
+}
+TrafficLight._colors = new BSet(new colors(enum_colors.red), new colors(enum_colors.redyellow), new colors(enum_colors.yellow), new colors(enum_colors.green));
diff --git a/B2Program/TrafficLight/btypes/BBoolean.js b/B2Program/TrafficLight/btypes/BBoolean.js
new file mode 100755
index 0000000000000000000000000000000000000000..130448faa26383f85f2db7a048581e0778fdb1d5
--- /dev/null
+++ b/B2Program/TrafficLight/btypes/BBoolean.js
@@ -0,0 +1,49 @@
+export class BBoolean {
+    constructor(value) {
+        if (typeof (value) === 'boolean') {
+            this.value = value;
+        }
+        else if (typeof value === 'string') {
+            this.value = value.toLowerCase() === 'true';
+        }
+        else {
+            this.value = value.value;
+        }
+    }
+    and(other) {
+        return new BBoolean(this.value && other.value);
+    }
+    or(other) {
+        return new BBoolean(this.value || other.value);
+    }
+    not() {
+        return new BBoolean(!this.value);
+    }
+    implies(other) {
+        return this.not().or(other);
+    }
+    equivalent(other) {
+        return this.implies(other).and(other.implies(this));
+    }
+    equal(other) {
+        return new BBoolean(this.value === other.value);
+    }
+    equals(other) {
+        if (!(other instanceof BBoolean)) {
+            return false;
+        }
+        return this.equal(other).booleanValue();
+    }
+    unequal(other) {
+        return new BBoolean(this.value != other.value);
+    }
+    booleanValue() {
+        return this.value;
+    }
+    toString() {
+        return this.value.toString();
+    }
+    hashCode() {
+        return this.value ? 1 : 0;
+    }
+}
diff --git a/B2Program/TrafficLight/btypes/BInteger.js b/B2Program/TrafficLight/btypes/BInteger.js
new file mode 100755
index 0000000000000000000000000000000000000000..11c2723b5e4781ff02f7a59b101aebb174d65cbf
--- /dev/null
+++ b/B2Program/TrafficLight/btypes/BInteger.js
@@ -0,0 +1,108 @@
+import { BBoolean } from './BBoolean.js';
+export class BInteger {
+    constructor(value) {
+        this.value = value;
+    }
+    equals(obj) {
+        if (obj instanceof BInteger) {
+            return this.compareTo(obj) === 0;
+        }
+        return false;
+    }
+    static build(value) {
+        return new BInteger(value);
+    }
+    compareTo(o) {
+        return this.value - o.value;
+    }
+    lessEqual(o) {
+        return new BBoolean(this.compareTo(o) <= 0);
+    }
+    greaterEqual(o) {
+        return new BBoolean(this.compareTo(o) >= 0);
+    }
+    less(o) {
+        return new BBoolean(this.compareTo(o) < 0);
+    }
+    greater(o) {
+        return new BBoolean(this.compareTo(o) > 0);
+    }
+    equal(o) {
+        return new BBoolean(this.compareTo(o) === 0);
+    }
+    unequal(o) {
+        return new BBoolean(this.compareTo(o) != 0);
+    }
+    intValue() {
+        return this.value;
+    }
+    plus(o) {
+        return new BInteger(this.value + o.value);
+    }
+    toString() {
+        return this.value.toString();
+    }
+    minus(o) {
+        return new BInteger(this.value - o.value);
+    }
+    multiply(o) {
+        return new BInteger(this.value * o.value);
+    }
+    power(o) {
+        return new BInteger(this.value ^ o.value);
+    }
+    divide(o) {
+        return new BInteger(~~(this.value / o.value));
+    }
+    modulo(o) {
+        return new BInteger(this.value % o.value);
+    }
+    succ() {
+        return new BInteger(this.value + 1);
+    }
+    pred() {
+        return new BInteger(this.value - 1);
+    }
+    leftShift() {
+        return new BInteger(this.value << 1);
+    }
+    rightShift() {
+        return new BInteger(this.value >> 1);
+    }
+    isCase(o) {
+        return this.equals(o);
+    }
+    negative() {
+        return new BInteger(-this.value);
+    }
+    positive() {
+        return this;
+    }
+    getValue() {
+        return this.value;
+    }
+    isInteger() {
+        return new BBoolean(true);
+    }
+    isNotInteger() {
+        return new BBoolean(false);
+    }
+    isNatural() {
+        return this.greaterEqual(new BInteger(0));
+    }
+    isNotNatural() {
+        return this.isNatural().not();
+    }
+    isNatural1() {
+        return this.greater(new BInteger(0));
+    }
+    isNotNatural1() {
+        return this.isNatural1().not();
+    }
+    hashCode() {
+        const prime = 31;
+        let result = 1;
+        result = prime * result + this.value;
+        return result;
+    }
+}
diff --git a/B2Program/TrafficLight/btypes/BObject.js b/B2Program/TrafficLight/btypes/BObject.js
new file mode 100755
index 0000000000000000000000000000000000000000..51b475ea3aeca5d23cebf2760f968f115e965477
--- /dev/null
+++ b/B2Program/TrafficLight/btypes/BObject.js
@@ -0,0 +1,8 @@
+export class BObject {
+    equals(other) {
+        return false;
+    }
+    hashCode() {
+        return 0;
+    }
+}
diff --git a/B2Program/TrafficLight/btypes/BRelation.js b/B2Program/TrafficLight/btypes/BRelation.js
new file mode 100755
index 0000000000000000000000000000000000000000..361218789a087230718b877c9cb7ef474771c1bb
--- /dev/null
+++ b/B2Program/TrafficLight/btypes/BRelation.js
@@ -0,0 +1,791 @@
+import { BTuple } from "./BTuple.js";
+import { BSet } from "./BSet.js";
+import { BInteger } from "./BInteger.js";
+import { BBoolean } from "./BBoolean.js";
+import { BString } from "./BString.js";
+import { BStruct } from "./BStruct.js";
+import * as immutable from "../immutable/dist/immutable.es.js";
+export class BRelation {
+    constructor(...args) {
+        if (args.length === 0) {
+            this.map = immutable.Map();
+        }
+        else if (args.length == 1 && args[0] instanceof immutable.Map) {
+            this.map = args[0];
+        }
+        else {
+            this.map = immutable.Map();
+            for (let e of args) {
+                let key = e.projection1();
+                let value = e.projection2();
+                let set = this.map.get(key);
+                if (set == null) {
+                    set = immutable.Set();
+                }
+                set = set.add(value);
+                this.map = this.map.set(key, set);
+            }
+        }
+    }
+    static fromSet(set) {
+        let resultMap = immutable.Map();
+        set.getSet().forEach((e) => {
+            let key = e.projection1();
+            let value = e.projection2();
+            let range = resultMap.get(key);
+            if (range == null) {
+                range = immutable.Set([value]);
+                resultMap = resultMap.set(key, range);
+            }
+            else {
+                range = range.add(value);
+                resultMap = resultMap.set(key, range);
+            }
+        });
+        return new BRelation(resultMap);
+    }
+    equals(o) {
+        if (o == null || !(o instanceof BRelation))
+            return false;
+        return this.map.equals(o.map);
+    }
+    intersect(relation) {
+        let otherMap = relation.map;
+        let otherDomain = immutable.Set(otherMap.keys());
+        let thisDomain = immutable.Set(this.map.keys());
+        let intersectionDomain = thisDomain.intersect(otherDomain);
+        let differenceDomain = thisDomain.subtract(otherDomain);
+        let resultMap = this.map;
+        intersectionDomain.forEach((domainElement) => {
+            let thisRangeSet = this.map.get(domainElement);
+            let otherRangeSet = otherMap.get(domainElement);
+            resultMap = resultMap.set(domainElement, thisRangeSet.intersect(otherRangeSet));
+        });
+        differenceDomain.forEach((domainElement) => {
+            resultMap = resultMap.set(domainElement, immutable.Set());
+        });
+        return new BRelation(resultMap);
+    }
+    difference(relation) {
+        let otherMap = relation.map;
+        let otherDomain = otherMap.keys();
+        let thisDomain = immutable.Set(this.map.keys());
+        let differenceDomain = thisDomain.subtract(otherDomain);
+        let restDomain = thisDomain.subtract(differenceDomain);
+        let resultMap = this.map;
+        differenceDomain.forEach((domainElement) => {
+            let thisRangeSet = this.map.get(domainElement);
+            let otherRangeSet = otherMap.get(domainElement);
+            resultMap = resultMap.set(domainElement, thisRangeSet.subtract(otherRangeSet));
+        });
+        restDomain.forEach((domainElement) => {
+            resultMap = resultMap.set(domainElement, immutable.Set());
+        });
+        return new BRelation(resultMap);
+    }
+    union(relation) {
+        let otherMap = relation.map;
+        let otherDomain = immutable.Set(otherMap.keys());
+        let resultMap = this.map;
+        for (let domainElement of otherDomain) {
+            let thisRangeSet = this.map.get(domainElement);
+            let otherRangeSet = otherMap.get(domainElement);
+            resultMap = resultMap.set(domainElement, thisRangeSet == null ? otherRangeSet : otherRangeSet == null ? otherRangeSet : thisRangeSet.union(otherRangeSet));
+        }
+        return new BRelation(resultMap);
+    }
+    size() {
+        let size = 0;
+        let thisDomain = immutable.Set(this.map.keys());
+        for (let domainElement of thisDomain) {
+            let thisRangeSet = this.map.get(domainElement);
+            if (thisRangeSet == null) {
+                continue;
+            }
+            size += thisRangeSet.size;
+        }
+        return size;
+    }
+    card() {
+        return new BInteger(this.size());
+    }
+    equal(o) {
+        return new BBoolean(this.equals(o));
+    }
+    unequal(o) {
+        return new BBoolean(!this.equals(o));
+    }
+    elementOf(object) {
+        let prj1 = object.projection1();
+        let prj2 = object.projection2();
+        if (!this.map.has(prj1)) {
+            return new BBoolean(false);
+        }
+        let range = this.map.get(prj1);
+        return new BBoolean(range.has(prj2));
+    }
+    notElementOf(object) {
+        let prj1 = object.projection1();
+        let prj2 = object.projection2();
+        if (!this.map.has(prj1)) {
+            return new BBoolean(true);
+        }
+        let range = this.map.get(prj1);
+        return new BBoolean(!range.has(prj2));
+    }
+    relationImage(domain) {
+        let resultSet = immutable.Set();
+        for (let this_domain_elem of this.map.keys()) {
+            for (let other_domain_elem of domain.set) {
+                if (other_domain_elem.equals(this_domain_elem)) {
+                    let thisRangeSet = this.map.get(this_domain_elem);
+                    if (thisRangeSet != null) {
+                        resultSet = BSet.immutableSetUnion(resultSet, thisRangeSet);
+                    }
+                }
+            }
+        }
+        return new BSet(resultSet);
+    }
+    functionCall(arg) {
+        let range = this.map.get(arg);
+        if (range == null) {
+            throw new Error("Argument is not in the domain of this relation");
+        }
+        for (let element of range) {
+            return element;
+        }
+        throw new Error("Argument is not in the domain of this relation");
+    }
+    pow() {
+        let thisMap = this.map;
+        let thisDomain = immutable.Set(thisMap.keys());
+        let result = new BSet();
+        let start = new BRelation();
+        let queue = [];
+        queue.push(start);
+        result = result.union(new BSet(start));
+        while (queue.length !== 0) {
+            let currentSet = queue.pop();
+            for (let domainElement of thisDomain) {
+                let range = thisMap.get(domainElement);
+                range.forEach((rangeElement) => {
+                    let nextRelation = currentSet.union(BRelation.fromSet(new BSet(new BTuple(domainElement, rangeElement))));
+                    let previousSize = result.size().intValue();
+                    result = result.union(new BSet(nextRelation));
+                    if (previousSize < result.size().intValue()) {
+                        queue.push(nextRelation);
+                    }
+                });
+            }
+        }
+        return result;
+    }
+    pow1() {
+        return this.pow().difference(new BSet(new BRelation()));
+    }
+    fin() {
+        return this.pow();
+    }
+    fin1() {
+        return this.pow1();
+    }
+    domain() {
+        let resultSet = immutable.Set(this.map.keys());
+        for (let domainElement of this.map.keys()) {
+            let range = this.map.get(domainElement);
+            if (range.size === 0) {
+                resultSet = resultSet.remove(domainElement);
+            }
+        }
+        return new BSet(resultSet);
+    }
+    range() {
+        let set = immutable.Set.union(this.map.values());
+        return new BSet(set);
+    }
+    inverse() {
+        let thisMap = this.map;
+        let keys = immutable.Set(thisMap.keys());
+        let resultMap = immutable.Map();
+        for (let domainElement of keys) {
+            let range = this.map.get(domainElement);
+            range.forEach((rangeElement) => {
+                let currentRange = resultMap.get(rangeElement);
+                if (currentRange == null) {
+                    currentRange = immutable.Set();
+                }
+                currentRange = currentRange.union(immutable.Set([domainElement]));
+                resultMap = resultMap.set(rangeElement, currentRange);
+            });
+        }
+        return new BRelation(resultMap);
+    }
+    domainRestriction(arg) {
+        let resultMap = this.map;
+        outer_loop: for (let obj of resultMap.keys()) {
+            for (let obj2 of arg.set) {
+                if (obj2.equals(obj)) {
+                    continue outer_loop;
+                }
+            }
+            resultMap = resultMap.delete(obj);
+        }
+        return new BRelation(resultMap);
+    }
+    domainSubstraction(arg) {
+        let resultMap = this.map;
+        for (let obj of resultMap.keys()) {
+            for (let obj2 of arg.set) {
+                if (obj2.equals(obj)) {
+                    resultMap = resultMap.delete(obj);
+                    break;
+                }
+            }
+        }
+        return new BRelation(resultMap);
+    }
+    rangeRestriction(arg) {
+        let otherSet = arg.getSet();
+        let thisDomain = immutable.Set(this.map.keys());
+        let resultMap = this.map;
+        for (let domainElement of thisDomain) {
+            let thisRangeSet = this.map.get(domainElement);
+            resultMap = resultMap.set(domainElement, BSet.immutableSetIntersection(thisRangeSet, otherSet));
+        }
+        return new BRelation(resultMap);
+    }
+    rangeSubstraction(arg) {
+        let otherSet = arg.getSet();
+        let thisDomain = immutable.Set(this.map.keys());
+        let resultMap = this.map;
+        for (let domainElement of thisDomain) {
+            let thisRangeSet = this.map.get(domainElement);
+            resultMap = resultMap.set(domainElement, BSet.immutableSetDifference(thisRangeSet, otherSet));
+        }
+        return new BRelation(resultMap);
+    }
+    override(arg) {
+        let otherMap = arg.map;
+        let otherDomain = immutable.Set(otherMap.keys());
+        let resultMap = this.map;
+        outer_loop: for (let domainElement of otherDomain) {
+            for (let thisDomainElement of resultMap.keys()) {
+                if (thisDomainElement.equals(domainElement)) {
+                    let range = otherMap.get(domainElement);
+                    resultMap = resultMap.set(thisDomainElement, range);
+                    continue outer_loop;
+                }
+            }
+            resultMap = resultMap.set(domainElement, otherMap.get(domainElement));
+        }
+        return new BRelation(resultMap);
+    }
+    first() {
+        return this.functionCall(new BInteger(1));
+    }
+    last() {
+        return this.functionCall(this.card());
+    }
+    reverse() {
+        let size = this.card();
+        let resultMap = immutable.Map();
+        for (let i = new BInteger(1); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            let rangeElement = this.functionCall(size.minus(i).succ());
+            resultMap = resultMap.set(i, immutable.Set([rangeElement]));
+        }
+        return new BRelation(resultMap);
+    }
+    front() {
+        return this.domainSubstraction(new BSet(this.card()));
+    }
+    tail() {
+        let size = this.card();
+        let resultMap = immutable.Map();
+        for (let i = new BInteger(2); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            let rangeElement = this.functionCall(i);
+            resultMap = resultMap.set(i.pred(), immutable.Set([rangeElement]));
+        }
+        return new BRelation(resultMap);
+    }
+    take(n) {
+        let size = this.card();
+        if (n.greaterEqual(size).booleanValue()) {
+            return new BRelation(this.map);
+        }
+        let resultMap = this.map;
+        //Remove sets with index greater than n
+        for (let i = n.succ(); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            for (let index of resultMap.keys()) {
+                if (index.equals(i)) {
+                    resultMap = resultMap.delete(index);
+                    break;
+                }
+            }
+        }
+        return new BRelation(resultMap);
+    }
+    drop(n) {
+        let size = this.card();
+        let thisMap = this.map;
+        let resultMap = immutable.Map();
+        for (let i = n.succ(); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            let currentSet = thisMap.get(i);
+            resultMap = resultMap.set(i.minus(n), currentSet);
+        }
+        return new BRelation(resultMap);
+    }
+    concat(arg) {
+        let resultMap = this.map;
+        let otherMap = arg.map;
+        let size = this.card();
+        for (let i = new BInteger(1); i.lessEqual(arg.card()).booleanValue(); i = i.succ()) {
+            resultMap = resultMap.set(size.plus(i), otherMap.get(i));
+        }
+        return new BRelation(resultMap);
+    }
+    conc() {
+        let result = new BRelation();
+        let size = this.card();
+        for (let i = new BInteger(1); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            result = result.concat(this.functionCall(i));
+        }
+        return result;
+    }
+    append(arg) {
+        let resultMap = this.map;
+        resultMap = resultMap.set(this.card().succ(), immutable.Set([arg]));
+        return new BRelation(resultMap);
+    }
+    prepend(arg) {
+        let resultMap = immutable.Map();
+        let thisMap = this.map;
+        let size = this.card();
+        for (let i = new BInteger(1); i.lessEqual(size).booleanValue(); i = i.succ()) {
+            resultMap = resultMap.set(i.succ(), thisMap.get(i));
+        }
+        resultMap = resultMap.set(new BInteger(1), immutable.Set([arg]));
+        return new BRelation(resultMap);
+    }
+    directProduct(arg) {
+        let thisMap = this.map;
+        let thisDomain = immutable.Set(thisMap.keys());
+        let otherMap = arg.map;
+        let resultMap = immutable.Map();
+        for (let domainElement of thisDomain) {
+            let thisRange = this.map.get(domainElement);
+            let otherRange = otherMap.get(domainElement);
+            if (otherRange == undefined) {
+                continue;
+            }
+            let resultRange = immutable.Set();
+            thisRange.forEach((lhs) => {
+                otherRange.forEach((rhs) => {
+                    resultRange = immutable.Set.union([resultRange, immutable.Set([new BTuple(lhs, rhs)])]);
+                });
+            });
+            resultMap = resultMap.set(domainElement, resultRange);
+        }
+        return new BRelation(resultMap);
+    }
+    parallelProduct(arg) {
+        let thisMap = this.map;
+        let thisDomain = immutable.Set(thisMap.keys());
+        let otherMap = arg.map;
+        let otherDomain = immutable.Set(otherMap.keys());
+        let resultMap = immutable.Map();
+        for (let domainElementThis of thisDomain) {
+            for (let domainElementOther of otherDomain) {
+                let thisRange = thisMap.get(domainElementThis);
+                let otherRange = otherMap.get(domainElementOther);
+                let resultRange = immutable.Set();
+                thisRange.forEach((lhs) => {
+                    otherRange.forEach((rhs) => {
+                        resultRange = resultRange.union(immutable.Set([new BTuple(lhs, rhs)]));
+                    });
+                });
+                let tuple = new BTuple(domainElementThis, domainElementOther);
+                resultMap = resultMap.set(tuple, resultRange);
+            }
+        }
+        return new BRelation(resultMap);
+    }
+    composition(arg) {
+        let otherMap = arg.map;
+        let resultMap = immutable.Map();
+        for (let domainElement of this.map.keys()) {
+            let range = this.map.get(domainElement);
+            let set = immutable.Set();
+            range.forEach((rangeElement) => {
+                let union_element = otherMap.get(rangeElement);
+                if (union_element == null) {
+                    return;
+                }
+                set = set.union(union_element);
+            });
+            resultMap = resultMap.set(domainElement, set);
+        }
+        return new BRelation(resultMap);
+    }
+    iterate(n) {
+        let thisRelation = this;
+        let result = BRelation.identity(this.domain().union(this.range()));
+        for (let i = new BInteger(1); i.lessEqual(n).booleanValue(); i = i.succ()) {
+            result = result.composition(thisRelation);
+        }
+        return result;
+    }
+    closure() {
+        let thisRelation = this;
+        let result = BRelation.identity(this.domain().union(this.range()));
+        let nextResult = result.composition(thisRelation);
+        let lastResult = result;
+        do {
+            lastResult = result;
+            result = result.union(nextResult);
+            nextResult = result.composition(thisRelation);
+        } while (!result.equal(lastResult).booleanValue());
+        return result;
+    }
+    closure1() {
+        let thisRelation = this;
+        let result = this;
+        let nextResult = result.composition(thisRelation);
+        let lastResult = null;
+        do {
+            lastResult = result;
+            result = result.union(nextResult);
+            nextResult = result.composition(thisRelation);
+        } while (!result.equal(lastResult).booleanValue());
+        return result;
+    }
+    static projection1(arg1, arg2) {
+        let argSet1 = arg1.getSet();
+        let argSet2 = arg2.getSet();
+        let resultMap = immutable.Map();
+        argSet1.forEach((e1) => {
+            argSet2.forEach((e2) => {
+                let tuple = new BTuple(e1, e2);
+                resultMap = resultMap.set(tuple, immutable.Set([e1]));
+            });
+        });
+        return new BRelation(resultMap);
+    }
+    static projection2(arg1, arg2) {
+        let argSet1 = arg1.getSet();
+        let argSet2 = arg2.getSet();
+        let resultMap = immutable.Map();
+        argSet1.forEach((e1) => {
+            argSet2.forEach((e2) => {
+                let tuple = new BTuple(e1, e2);
+                resultMap = resultMap.set(tuple, immutable.Set([e2]));
+            });
+        });
+        return new BRelation(resultMap);
+    }
+    fnc() {
+        let thisMap = this.map;
+        let domain = this.domain().getSet();
+        let resultMap = immutable.Map();
+        domain.forEach((domainElement) => {
+            let range = thisMap.get(domainElement);
+            let rangeSet = new BSet([range]);
+            resultMap = resultMap.set(domainElement, immutable.Set([rangeSet]));
+        });
+        return new BRelation(resultMap);
+    }
+    rel() {
+        let domain = this.domain().getSet();
+        let resultMap = immutable.Map();
+        domain.forEach((domainElement) => {
+            let range = this.functionCall(domainElement);
+            let rangeSet = range.getSet();
+            resultMap = resultMap.set(domainElement, rangeSet);
+        });
+        return new BRelation(resultMap);
+    }
+    static identity(arg) {
+        let resultMap = immutable.Map();
+        arg.getSet().forEach((e) => {
+            resultMap = resultMap.set(e, immutable.Set([e]));
+        });
+        return new BRelation(resultMap);
+    }
+    static cartesianProduct(arg1, arg2) {
+        let resultMap = immutable.Map();
+        arg1.getSet().forEach((e1) => {
+            resultMap = resultMap.set(e1, arg2.getSet());
+        });
+        return new BRelation(resultMap);
+    }
+    nondeterminism() {
+        let domain = immutable.Set(this.map.keys());
+        let index = Math.floor(Math.random() * domain.size);
+        let i = 0;
+        let domainElement = undefined;
+        for (let obj of domain) {
+            if (i == index) {
+                domainElement = obj;
+                break;
+            }
+            i++;
+        }
+        if (domainElement == undefined) {
+            return null;
+        }
+        let range = this.map.get(domainElement);
+        if (range != null) {
+            index = Math.floor(Math.random() * range.size);
+            i = 0;
+            for (let obj of range) {
+                if (i == index) {
+                    return new BTuple(domainElement, obj);
+                }
+                i++;
+            }
+        }
+        return null;
+    }
+    isTotal(domain) {
+        return new BBoolean(this.domain().equal(domain));
+    }
+    isTotalInteger() {
+        return new BBoolean(false);
+    }
+    isTotalNatural() {
+        return new BBoolean(false);
+    }
+    isTotalNatural1() {
+        return new BBoolean(false);
+    }
+    isTotalString() {
+        return new BBoolean(false);
+    }
+    isTotalStruct() {
+        return new BBoolean(false);
+    }
+    isPartial(domain) {
+        return this.domain().strictSubset(domain);
+    }
+    isPartialInteger() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger) {
+                return new BBoolean(true);
+            }
+            else {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isPartialNatural() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isPartialNatural1() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural1().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isPartialString() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BString && !e.isString().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isPartialStruct() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BStruct && !e.isRecord().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomain(domain) {
+        return this.domain().subset(domain);
+    }
+    checkDomainInteger() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger) {
+                return new BBoolean(true);
+            }
+            else {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomainNatural() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomainNatural1() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural1().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomainString() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BString && !e.isString().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkDomainStruct() {
+        this.domain().getSet().forEach((e) => {
+            if (e instanceof BStruct && !e.isRecord().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRange(range) {
+        return this.range().subset(range);
+    }
+    checkRangeInteger() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BInteger) {
+                return new BBoolean(true);
+            }
+            else {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRangeNatural() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRangeNatural1() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BInteger && !e.isNatural1().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRangeString() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BString && !e.isString().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    checkRangeStruct() {
+        this.range().getSet().forEach((e) => {
+            if (e instanceof BStruct && !e.isRecord().booleanValue()) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isRelation() {
+        return new BBoolean(true);
+    }
+    isFunction() {
+        this.domain().getSet().forEach((element) => {
+            let range = this.map.get(element);
+            if (range.size > 1) {
+                return new BBoolean(false);
+            }
+        });
+        return new BBoolean(true);
+    }
+    isSurjection(range) {
+        return new BBoolean(this.range().equal(range));
+    }
+    isSurjectionInteger() {
+        return new BBoolean(false);
+    }
+    isSurjectionNatural() {
+        return new BBoolean(false);
+    }
+    isSurjectionNatural1() {
+        return new BBoolean(false);
+    }
+    isSurjectionString() {
+        return new BBoolean(false);
+    }
+    isSurjectionStruct() {
+        return new BBoolean(false);
+    }
+    isInjection() {
+        let visited = immutable.Set();
+        this.domain().getSet().forEach((element) => {
+            let range = this.map.get(element);
+            range.forEach((rangeElement) => {
+                if (visited.contains(rangeElement)) {
+                    return new BBoolean(false);
+                }
+                visited = visited.union(immutable.Set([rangeElement]));
+            });
+        });
+        return new BBoolean(true);
+    }
+    isBijection(range) {
+        return this.isSurjection(range).and(this.isInjection());
+    }
+    isBijectionInteger() {
+        return new BBoolean(false);
+    }
+    isBijectionNatural() {
+        return new BBoolean(false);
+    }
+    isBijectionNatural1() {
+        return new BBoolean(false);
+    }
+    isBijectionString() {
+        return new BBoolean(false);
+    }
+    isBijectionStruct() {
+        return new BBoolean(false);
+    }
+    toString() {
+        let size = this.size();
+        let i = 0;
+        let sb = "";
+        sb = sb + "{";
+        for (let domainElement of this.map.keys()) {
+            let range = this.map.get(domainElement);
+            range.forEach((rangeElement) => {
+                sb += "(";
+                sb += domainElement.toString();
+                sb += " |-> ";
+                sb += rangeElement.toString();
+                sb += ")";
+                if (i + 1 < size) {
+                    sb += ", ";
+                }
+                i++;
+            });
+        }
+        sb += "}";
+        return sb.toString();
+    }
+    hashCode() {
+        return this.map.hashCode();
+    }
+}
diff --git a/B2Program/TrafficLight/btypes/BSet.js b/B2Program/TrafficLight/btypes/BSet.js
new file mode 100755
index 0000000000000000000000000000000000000000..3cd16d85d4636b667b9741b6fbb3816b02d71da6
--- /dev/null
+++ b/B2Program/TrafficLight/btypes/BSet.js
@@ -0,0 +1,359 @@
+import { BBoolean } from "./BBoolean.js";
+import { BInteger } from "./BInteger.js";
+import { BRelation } from "./BRelation.js";
+import { BString } from "./BString.js";
+import { BStruct } from "./BStruct.js";
+import * as immutable from "../immutable/dist/immutable.es.js";
+export class BSet {
+    constructor(...args) {
+        if (args.length == 1 && args[0] instanceof immutable.Set) {
+            this.set = args[0];
+        }
+        else {
+            this.set = immutable.Set();
+            for (let x of args) {
+                this.set = this.set.add(x);
+            }
+        }
+    }
+    /* Make this class iterable */
+    [Symbol.iterator]() {
+        return this.set[Symbol.iterator]();
+    }
+    toString() {
+        let sb = "{";
+        this.set.forEach(element => {
+            if (sb.length > 1) {
+                sb += ", ";
+            }
+            sb += element.toString();
+        });
+        sb += "}";
+        return sb;
+    }
+    union(other = null) {
+        if (other == null) {
+            if (this.set.size === 0) {
+                return new BSet();
+            }
+            else if (this.set.values().next().value instanceof BSet) {
+                let result = immutable.Set();
+                for (let current_set of this.set) {
+                    result = BSet.immutableSetUnion(result, current_set.set);
+                }
+                return new BSet(result);
+            }
+            else if (this.set.values().next().value instanceof BRelation) {
+                let result = immutable.Map();
+                for (let current_set of this.set) {
+                    result = BSet.immutableMapUnion(result, current_set.map);
+                }
+                return new BRelation(result);
+            }
+            else {
+                throw new Error("Generalized Union is only possible on immutable.Sets of immutable.Sets or Relations");
+            }
+        }
+        let result = BSet.immutableSetUnion(this.set, other.set);
+        return new BSet(result);
+    }
+    static immutableSetUnion(s1, s2) {
+        return s1.union(s2);
+    }
+    static immutableSetDifference(s1, s2) {
+        return s1.subtract(s2);
+    }
+    static immutableSetIntersection(s1, s2) {
+        return s1.intersect(s2);
+    }
+    static immutableMapUnion(m1, m2) {
+        let result = m2;
+        outer_loop: for (let current_element of m1.keys()) {
+            for (let result_element of result.keys()) {
+                if (current_element.equals(result_element)) {
+                    let result_set = result.get(result_element);
+                    let current_set = m1.get(current_element);
+                    result = result.set(result_element, BSet.immutableSetUnion(result_set != null ? result_set : immutable.Set(), current_set != null ? current_set : immutable.Set()));
+                    continue outer_loop;
+                }
+            }
+            result = result.set(current_element, m1.get(current_element));
+        }
+        return result;
+    }
+    static immutableMapIntersection(m1, m2) {
+        let result = immutable.Map();
+        elem_loop: for (let result_element of m2.keys()) {
+            for (let current_element of m1.keys()) {
+                if (current_element.equals(result_element)) {
+                    let result_set = m2.get(result_element);
+                    let current_set = m1.get(current_element);
+                    result = result.set(result_element, BSet.immutableSetIntersection(result_set != null ? result_set : immutable.Set(), current_set != null ? current_set : immutable.Set()));
+                    continue elem_loop;
+                }
+            }
+            result.delete(result_element);
+        }
+        return result;
+    }
+    intersect(other = null) {
+        if (other == null) {
+            if (this.set.size === 0) {
+                return new BSet();
+            }
+            else if (this.set.values().next().value instanceof BSet) {
+                let result = this.set.values().next().value.set;
+                for (let current_set of this.set) {
+                    result = BSet.immutableSetDifference(result, BSet.immutableSetDifference(result, current_set.set));
+                }
+                return new BSet(result);
+            }
+            else if (this.set.values().next().value instanceof BRelation) {
+                let result = this.set.values().next().value.map;
+                for (let current_set of this.set) {
+                    result = BSet.immutableMapIntersection(result, current_set.map);
+                }
+                return new BRelation(result);
+            }
+            else {
+                throw new Error("Generalized Intersection is only possible on immutable.Sets of immutable.Sets or Relations");
+            }
+        }
+        let new_set = BSet.immutableSetDifference(this.set, BSet.immutableSetDifference(this.set, other.set));
+        return new BSet(new_set);
+    }
+    difference(other) {
+        let set = BSet.immutableSetDifference(this.set, other.set);
+        return new BSet(set);
+    }
+    card() {
+        return new BInteger(this.set.size);
+    }
+    size() {
+        return new BInteger(this.set.size);
+    }
+    elementOf(obj) {
+        return new BBoolean(this.set.has(obj));
+    }
+    notElementOf(obj) {
+        return new BBoolean(!this.set.has(obj));
+    }
+    subset(other) {
+        this_set_loop: for (let elem of this.set) {
+            for (let other_elem of other.set) {
+                if (other_elem.equals(elem)) {
+                    continue this_set_loop;
+                }
+            }
+            return new BBoolean(false);
+        }
+        return new BBoolean(true);
+    }
+    notSubset(other) {
+        this_set_loop: for (let elem of this.set) {
+            for (let other_elem of other.set) {
+                if (other_elem.equals(elem)) {
+                    continue this_set_loop;
+                }
+            }
+            return new BBoolean(true);
+        }
+        return new BBoolean(false);
+    }
+    strictSubset(other) {
+        return this.size().less(other.size()).and(this.subset(other));
+    }
+    strictNotSubset(other) {
+        return this.size().equal(other.size()).and(this.notSubset(other));
+    }
+    contains(other) {
+        return other.toString() in this.set;
+    }
+    containsAll(other) {
+        for (let o of other.set) {
+            if (!(o in this.set)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    isEmpty() {
+        return this.set.size === 0;
+    }
+    equals(other) {
+        return this.equal(other).booleanValue();
+    }
+    equal(other) {
+        if (!(other instanceof BSet)) {
+            return new BBoolean(false);
+        }
+        return this.subset(other).and(other.subset(this));
+    }
+    unequal(other) {
+        return this.equal(other).not();
+    }
+    nondeterminism() {
+        let values = [];
+        for (let item of this.set) {
+            values.push(item);
+        }
+        return values[Math.floor(Math.random() * values.length)];
+    }
+    min() {
+        return this.set.reduce((a, v) => { if (a < v) {
+            return a;
+        } return v; });
+    }
+    max() {
+        return this.set.reduce((a, v) => { if (a > v) {
+            return a;
+        } return v; });
+    }
+    pow() {
+        let result = new BSet();
+        let start = new BSet();
+        let queue = [start];
+        result = result.union(new BSet(start));
+        while (queue.length != 0) {
+            let currentSet = queue.pop();
+            for (let element of this.set) {
+                let nextSet = currentSet.union(new BSet(element));
+                let previousSize = result.size();
+                result = result.union(new BSet(nextSet));
+                if (previousSize < result.size()) {
+                    queue.push(nextSet);
+                }
+            }
+        }
+        return result;
+    }
+    pow1() {
+        return this.pow().difference(new BSet(new BSet()));
+    }
+    // Only finite subsets are supported so fin = pow
+    fin() {
+        return this.pow();
+    }
+    fin1() {
+        return this.pow1();
+    }
+    subsetOfInteger() {
+        for (let element of this.set) {
+            if (element instanceof BInteger) {
+                return false;
+            }
+        }
+        return true;
+    }
+    strictSubsetOfInteger() {
+        return this.subsetOfInteger();
+    }
+    notSubsetOfInteger() {
+        return !this.subsetOfInteger();
+    }
+    notStrictSubsetOfInteger() {
+        return !this.strictSubsetOfInteger();
+    }
+    subsetOfNatural() {
+        for (let element of this.set) {
+            if (!(element instanceof BInteger && element.isNatural().booleanValue())) {
+                return false;
+            }
+        }
+        return true;
+    }
+    strictSubsetOfNatural() {
+        return this.subsetOfNatural();
+    }
+    notSubsetOfNatural() {
+        return !this.subsetOfNatural();
+    }
+    notStrictSubsetOfNatural() {
+        return !this.strictSubsetOfNatural();
+    }
+    subsetOfNatural1() {
+        for (let element of this.set) {
+            if (!(element instanceof BInteger && element.isNatural1().booleanValue())) {
+                return false;
+            }
+        }
+        return true;
+    }
+    subsetOfString() {
+        for (let element of this.set) {
+            if (!(element instanceof BString)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    strictSubsetOfString() {
+        return this.subsetOfString();
+    }
+    notSubsetOfString() {
+        return !this.subsetOfString();
+    }
+    notStrictSubsetOfString() {
+        return !this.strictSubsetOfString();
+    }
+    subsetOfStruct() {
+        for (let element of this.set) {
+            if (!(element instanceof BStruct)) {
+                return false;
+            }
+        }
+        return true;
+    }
+    strictSubsetOfStruct() {
+        return this.subsetOfStruct();
+    }
+    notSubsetOfStruct() {
+        return !this.subsetOfStruct();
+    }
+    notStrictSubsetOfStruct() {
+        return !this.strictSubsetOfStruct();
+    }
+    equalInteger() {
+        return new BBoolean(false);
+    }
+    unequalInteger() {
+        return new BBoolean(true);
+    }
+    equalNatural() {
+        return new BBoolean(false);
+    }
+    unequalNatural() {
+        return new BBoolean(true);
+    }
+    equalNatural1() {
+        return new BBoolean(false);
+    }
+    unequalNatural1() {
+        return new BBoolean(true);
+    }
+    equalString() {
+        return new BBoolean(false);
+    }
+    unequalString() {
+        return new BBoolean(true);
+    }
+    equalStruct() {
+        return new BBoolean(false);
+    }
+    unequalStruct() {
+        return new BBoolean(true);
+    }
+    getSet() {
+        return this.set;
+    }
+    static interval(a, b) {
+        if (b.less(a).booleanValue()) {
+            return new BSet();
+        }
+        const range = [...Array(b.minus(a).intValue() + 1).keys()].map(e => new BInteger(e).plus(a));
+        return new BSet(immutable.Set(range));
+    }
+    hashCode() {
+        return this.set.hashCode();
+    }
+}
diff --git a/B2Program/TrafficLight/btypes/BString.js b/B2Program/TrafficLight/btypes/BString.js
new file mode 100755
index 0000000000000000000000000000000000000000..ff8e795b9a5997e3dad032029e78fb40dba7f7a1
--- /dev/null
+++ b/B2Program/TrafficLight/btypes/BString.js
@@ -0,0 +1,46 @@
+import { BBoolean } from "./BBoolean.js";
+export class BString {
+    constructor(value) {
+        this.value = value;
+    }
+    getValue() {
+        return this.value;
+    }
+    equals(o) {
+        if (o == null || o instanceof BString) {
+            return false;
+        }
+        return this.value === o.value;
+    }
+    length() {
+        return this.value.length;
+    }
+    isEmpty() {
+        return this.value === "";
+    }
+    toString() {
+        return '"' + this.value + '"';
+    }
+    isCase(o) {
+        return this.value == o;
+    }
+    isString() {
+        return new BBoolean(true);
+    }
+    isNotString() {
+        return new BBoolean(false);
+    }
+    hashCode() {
+        let hash = 0;
+        if (this.value.length === 0) {
+            return hash;
+        }
+        for (let i = 0; i < this.value.length; i++) {
+            let chr = this.value.charCodeAt(i);
+            hash = ((hash << 5) - hash) + chr;
+            hash |= 0; // Convert to 32bit integer
+        }
+        return hash;
+    }
+    ;
+}
diff --git a/B2Program/TrafficLight/btypes/BStruct.js b/B2Program/TrafficLight/btypes/BStruct.js
new file mode 100755
index 0000000000000000000000000000000000000000..196b0fa0e643f72a865a96d09c27c76f5ed92fdd
--- /dev/null
+++ b/B2Program/TrafficLight/btypes/BStruct.js
@@ -0,0 +1,9 @@
+import { BBoolean } from "./BBoolean.js";
+export class BStruct {
+    isRecord() {
+        return new BBoolean(true);
+    }
+    isNotRecord() {
+        return new BBoolean(false);
+    }
+}
diff --git a/B2Program/TrafficLight/btypes/BTuple.js b/B2Program/TrafficLight/btypes/BTuple.js
new file mode 100755
index 0000000000000000000000000000000000000000..49f6bba5979626f54da241bc2aee21b680b45674
--- /dev/null
+++ b/B2Program/TrafficLight/btypes/BTuple.js
@@ -0,0 +1,34 @@
+import { BBoolean } from "./BBoolean.js";
+export class BTuple {
+    constructor(first, second) {
+        if (first == null || second == null) {
+            throw new RangeError("Arguments of Tuple cant be null or undefined");
+        }
+        this.first = first;
+        this.second = second;
+    }
+    equals(o) {
+        if (o == null || !(o instanceof BTuple)) {
+            return false;
+        }
+        return o.projection1().equals(this.first) && o.projection2().equals(this.second);
+    }
+    toString() {
+        return "(" + this.projection1() + " |-> " + this.projection2() + ')';
+    }
+    projection1() {
+        return this.first;
+    }
+    projection2() {
+        return this.second;
+    }
+    equal(o) {
+        return new BBoolean(this.equals(o));
+    }
+    unequal(o) {
+        return new BBoolean(!this.equals(o));
+    }
+    hashCode() {
+        return this.first.hashCode() ^ (this.second.hashCode() << 1);
+    }
+}
diff --git a/B2Program/TrafficLight/btypes/BUtils.js b/B2Program/TrafficLight/btypes/BUtils.js
new file mode 100755
index 0000000000000000000000000000000000000000..cc0de5b897c6bf57f395a844a2717aaf89ba68b1
--- /dev/null
+++ b/B2Program/TrafficLight/btypes/BUtils.js
@@ -0,0 +1,11 @@
+import { BSet } from "./BSet.js";
+import { BBoolean } from "./BBoolean.js";
+export class BUtils {
+}
+BUtils.BOOL = new BSet(new BBoolean(true), new BBoolean(false));
+export class SelectError extends Error {
+    constructor(msg) {
+        super(msg);
+        Object.setPrototypeOf(this, SelectError.prototype);
+    }
+}
\ No newline at end of file
diff --git a/B2Program/TrafficLight/immutable/LICENSE b/B2Program/TrafficLight/immutable/LICENSE
new file mode 100755
index 0000000000000000000000000000000000000000..cde61b6c53dda799b707ddf13c067fada5140acf
--- /dev/null
+++ b/B2Program/TrafficLight/immutable/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2014-present, Facebook, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/B2Program/TrafficLight/immutable/dist/immutable.es.js b/B2Program/TrafficLight/immutable/dist/immutable.es.js
new file mode 100755
index 0000000000000000000000000000000000000000..aecd6fe13a5026d8567ff123f8bdd6b79452e394
--- /dev/null
+++ b/B2Program/TrafficLight/immutable/dist/immutable.es.js
@@ -0,0 +1,5818 @@
+/**
+ * Copyright (c) 2014-present, Facebook, Inc.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE file in the root directory of this source tree.
+ */
+
+// Used for setting prototype methods that IE8 chokes on.
+var DELETE = 'delete';
+
+// Constants describing the size of trie nodes.
+var SHIFT = 5; // Resulted in best performance after ______?
+var SIZE = 1 << SHIFT;
+var MASK = SIZE - 1;
+
+// A consistent shared value representing "not set" which equals nothing other
+// than itself, and nothing that could be provided externally.
+var NOT_SET = {};
+
+// Boolean references, Rough equivalent of `bool &`.
+function MakeRef() {
+  return { value: false };
+}
+
+function SetRef(ref) {
+  if (ref) {
+    ref.value = true;
+  }
+}
+
+// A function which returns a value representing an "owner" for transient writes
+// to tries. The return value will only ever equal itself, and will not equal
+// the return of any subsequent call of this function.
+function OwnerID() {}
+
+function ensureSize(iter) {
+  if (iter.size === undefined) {
+    iter.size = iter.__iterate(returnTrue);
+  }
+  return iter.size;
+}
+
+function wrapIndex(iter, index) {
+  // This implements "is array index" which the ECMAString spec defines as:
+  //
+  //     A String property name P is an array index if and only if
+  //     ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal
+  //     to 2^32−1.
+  //
+  // http://www.ecma-international.org/ecma-262/6.0/#sec-array-exotic-objects
+  if (typeof index !== 'number') {
+    var uint32Index = index >>> 0; // N >>> 0 is shorthand for ToUint32
+    if ('' + uint32Index !== index || uint32Index === 4294967295) {
+      return NaN;
+    }
+    index = uint32Index;
+  }
+  return index < 0 ? ensureSize(iter) + index : index;
+}
+
+function returnTrue() {
+  return true;
+}
+
+function wholeSlice(begin, end, size) {
+  return (
+    ((begin === 0 && !isNeg(begin)) ||
+      (size !== undefined && begin <= -size)) &&
+    (end === undefined || (size !== undefined && end >= size))
+  );
+}
+
+function resolveBegin(begin, size) {
+  return resolveIndex(begin, size, 0);
+}
+
+function resolveEnd(end, size) {
+  return resolveIndex(end, size, size);
+}
+
+function resolveIndex(index, size, defaultIndex) {
+  // Sanitize indices using this shorthand for ToInt32(argument)
+  // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32
+  return index === undefined
+    ? defaultIndex
+    : isNeg(index)
+      ? size === Infinity
+        ? size
+        : Math.max(0, size + index) | 0
+      : size === undefined || size === index
+        ? index
+        : Math.min(size, index) | 0;
+}
+
+function isNeg(value) {
+  // Account for -0 which is negative, but not less than 0.
+  return value < 0 || (value === 0 && 1 / value === -Infinity);
+}
+
+// Note: value is unchanged to not break immutable-devtools.
+var IS_COLLECTION_SYMBOL = '@@__IMMUTABLE_ITERABLE__@@';
+
+function isCollection(maybeCollection) {
+  return Boolean(maybeCollection && maybeCollection[IS_COLLECTION_SYMBOL]);
+}
+
+var IS_KEYED_SYMBOL = '@@__IMMUTABLE_KEYED__@@';
+
+function isKeyed(maybeKeyed) {
+  return Boolean(maybeKeyed && maybeKeyed[IS_KEYED_SYMBOL]);
+}
+
+var IS_INDEXED_SYMBOL = '@@__IMMUTABLE_INDEXED__@@';
+
+function isIndexed(maybeIndexed) {
+  return Boolean(maybeIndexed && maybeIndexed[IS_INDEXED_SYMBOL]);
+}
+
+function isAssociative(maybeAssociative) {
+  return isKeyed(maybeAssociative) || isIndexed(maybeAssociative);
+}
+
+var Collection = function Collection(value) {
+  return isCollection(value) ? value : Seq(value);
+};
+
+var KeyedCollection = /*@__PURE__*/(function (Collection) {
+  function KeyedCollection(value) {
+    return isKeyed(value) ? value : KeyedSeq(value);
+  }
+
+  if ( Collection ) KeyedCollection.__proto__ = Collection;
+  KeyedCollection.prototype = Object.create( Collection && Collection.prototype );
+  KeyedCollection.prototype.constructor = KeyedCollection;
+
+  return KeyedCollection;
+}(Collection));
+
+var IndexedCollection = /*@__PURE__*/(function (Collection) {
+  function IndexedCollection(value) {
+    return isIndexed(value) ? value : IndexedSeq(value);
+  }
+
+  if ( Collection ) IndexedCollection.__proto__ = Collection;
+  IndexedCollection.prototype = Object.create( Collection && Collection.prototype );
+  IndexedCollection.prototype.constructor = IndexedCollection;
+
+  return IndexedCollection;
+}(Collection));
+
+var SetCollection = /*@__PURE__*/(function (Collection) {
+  function SetCollection(value) {
+    return isCollection(value) && !isAssociative(value) ? value : SetSeq(value);
+  }
+
+  if ( Collection ) SetCollection.__proto__ = Collection;
+  SetCollection.prototype = Object.create( Collection && Collection.prototype );
+  SetCollection.prototype.constructor = SetCollection;
+
+  return SetCollection;
+}(Collection));
+
+Collection.Keyed = KeyedCollection;
+Collection.Indexed = IndexedCollection;
+Collection.Set = SetCollection;
+
+var IS_SEQ_SYMBOL = '@@__IMMUTABLE_SEQ__@@';
+
+function isSeq(maybeSeq) {
+  return Boolean(maybeSeq && maybeSeq[IS_SEQ_SYMBOL]);
+}
+
+var IS_RECORD_SYMBOL = '@@__IMMUTABLE_RECORD__@@';
+
+function isRecord(maybeRecord) {
+  return Boolean(maybeRecord && maybeRecord[IS_RECORD_SYMBOL]);
+}
+
+function isImmutable(maybeImmutable) {
+  return isCollection(maybeImmutable) || isRecord(maybeImmutable);
+}
+
+var IS_ORDERED_SYMBOL = '@@__IMMUTABLE_ORDERED__@@';
+
+function isOrdered(maybeOrdered) {
+  return Boolean(maybeOrdered && maybeOrdered[IS_ORDERED_SYMBOL]);
+}
+
+var ITERATE_KEYS = 0;
+var ITERATE_VALUES = 1;
+var ITERATE_ENTRIES = 2;
+
+var REAL_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
+var FAUX_ITERATOR_SYMBOL = '@@iterator';
+
+var ITERATOR_SYMBOL = REAL_ITERATOR_SYMBOL || FAUX_ITERATOR_SYMBOL;
+
+var Iterator = function Iterator(next) {
+  this.next = next;
+};
+
+Iterator.prototype.toString = function toString () {
+  return '[Iterator]';
+};
+
+Iterator.KEYS = ITERATE_KEYS;
+Iterator.VALUES = ITERATE_VALUES;
+Iterator.ENTRIES = ITERATE_ENTRIES;
+
+Iterator.prototype.inspect = Iterator.prototype.toSource = function() {
+  return this.toString();
+};
+Iterator.prototype[ITERATOR_SYMBOL] = function() {
+  return this;
+};
+
+function iteratorValue(type, k, v, iteratorResult) {
+  var value = type === 0 ? k : type === 1 ? v : [k, v];
+  iteratorResult
+    ? (iteratorResult.value = value)
+    : (iteratorResult = {
+        value: value,
+        done: false,
+      });
+  return iteratorResult;
+}
+
+function iteratorDone() {
+  return { value: undefined, done: true };
+}
+
+function hasIterator(maybeIterable) {
+  return !!getIteratorFn(maybeIterable);
+}
+
+function isIterator(maybeIterator) {
+  return maybeIterator && typeof maybeIterator.next === 'function';
+}
+
+function getIterator(iterable) {
+  var iteratorFn = getIteratorFn(iterable);
+  return iteratorFn && iteratorFn.call(iterable);
+}
+
+function getIteratorFn(iterable) {
+  var iteratorFn =
+    iterable &&
+    ((REAL_ITERATOR_SYMBOL && iterable[REAL_ITERATOR_SYMBOL]) ||
+      iterable[FAUX_ITERATOR_SYMBOL]);
+  if (typeof iteratorFn === 'function') {
+    return iteratorFn;
+  }
+}
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+function isArrayLike(value) {
+  if (Array.isArray(value) || typeof value === 'string') {
+    return true;
+  }
+
+  return (
+    value &&
+    typeof value === 'object' &&
+    Number.isInteger(value.length) &&
+    value.length >= 0 &&
+    (value.length === 0
+      ? // Only {length: 0} is considered Array-like.
+        Object.keys(value).length === 1
+      : // An object is only Array-like if it has a property where the last value
+        // in the array-like may be found (which could be undefined).
+        value.hasOwnProperty(value.length - 1))
+  );
+}
+
+var Seq = /*@__PURE__*/(function (Collection$$1) {
+  function Seq(value) {
+    return value === null || value === undefined
+      ? emptySequence()
+      : isImmutable(value)
+        ? value.toSeq()
+        : seqFromValue(value);
+  }
+
+  if ( Collection$$1 ) Seq.__proto__ = Collection$$1;
+  Seq.prototype = Object.create( Collection$$1 && Collection$$1.prototype );
+  Seq.prototype.constructor = Seq;
+
+  Seq.prototype.toSeq = function toSeq () {
+    return this;
+  };
+
+  Seq.prototype.toString = function toString () {
+    return this.__toString('Seq {', '}');
+  };
+
+  Seq.prototype.cacheResult = function cacheResult () {
+    if (!this._cache && this.__iterateUncached) {
+      this._cache = this.entrySeq().toArray();
+      this.size = this._cache.length;
+    }
+    return this;
+  };
+
+  // abstract __iterateUncached(fn, reverse)
+
+  Seq.prototype.__iterate = function __iterate (fn, reverse) {
+    var cache = this._cache;
+    if (cache) {
+      var size = cache.length;
+      var i = 0;
+      while (i !== size) {
+        var entry = cache[reverse ? size - ++i : i++];
+        if (fn(entry[1], entry[0], this) === false) {
+          break;
+        }
+      }
+      return i;
+    }
+    return this.__iterateUncached(fn, reverse);
+  };
+
+  // abstract __iteratorUncached(type, reverse)
+
+  Seq.prototype.__iterator = function __iterator (type, reverse) {
+    var cache = this._cache;
+    if (cache) {
+      var size = cache.length;
+      var i = 0;
+      return new Iterator(function () {
+        if (i === size) {
+          return iteratorDone();
+        }
+        var entry = cache[reverse ? size - ++i : i++];
+        return iteratorValue(type, entry[0], entry[1]);
+      });
+    }
+    return this.__iteratorUncached(type, reverse);
+  };
+
+  return Seq;
+}(Collection));
+
+var KeyedSeq = /*@__PURE__*/(function (Seq) {
+  function KeyedSeq(value) {
+    return value === null || value === undefined
+      ? emptySequence().toKeyedSeq()
+      : isCollection(value)
+        ? isKeyed(value)
+          ? value.toSeq()
+          : value.fromEntrySeq()
+        : isRecord(value)
+          ? value.toSeq()
+          : keyedSeqFromValue(value);
+  }
+
+  if ( Seq ) KeyedSeq.__proto__ = Seq;
+  KeyedSeq.prototype = Object.create( Seq && Seq.prototype );
+  KeyedSeq.prototype.constructor = KeyedSeq;
+
+  KeyedSeq.prototype.toKeyedSeq = function toKeyedSeq () {
+    return this;
+  };
+
+  return KeyedSeq;
+}(Seq));
+
+var IndexedSeq = /*@__PURE__*/(function (Seq) {
+  function IndexedSeq(value) {
+    return value === null || value === undefined
+      ? emptySequence()
+      : isCollection(value)
+        ? isKeyed(value)
+          ? value.entrySeq()
+          : value.toIndexedSeq()
+        : isRecord(value)
+          ? value.toSeq().entrySeq()
+          : indexedSeqFromValue(value);
+  }
+
+  if ( Seq ) IndexedSeq.__proto__ = Seq;
+  IndexedSeq.prototype = Object.create( Seq && Seq.prototype );
+  IndexedSeq.prototype.constructor = IndexedSeq;
+
+  IndexedSeq.of = function of (/*...values*/) {
+    return IndexedSeq(arguments);
+  };
+
+  IndexedSeq.prototype.toIndexedSeq = function toIndexedSeq () {
+    return this;
+  };
+
+  IndexedSeq.prototype.toString = function toString () {
+    return this.__toString('Seq [', ']');
+  };
+
+  return IndexedSeq;
+}(Seq));
+
+var SetSeq = /*@__PURE__*/(function (Seq) {
+  function SetSeq(value) {
+    return (isCollection(value) && !isAssociative(value)
+      ? value
+      : IndexedSeq(value)
+    ).toSetSeq();
+  }
+
+  if ( Seq ) SetSeq.__proto__ = Seq;
+  SetSeq.prototype = Object.create( Seq && Seq.prototype );
+  SetSeq.prototype.constructor = SetSeq;
+
+  SetSeq.of = function of (/*...values*/) {
+    return SetSeq(arguments);
+  };
+
+  SetSeq.prototype.toSetSeq = function toSetSeq () {
+    return this;
+  };
+
+  return SetSeq;
+}(Seq));
+
+Seq.isSeq = isSeq;
+Seq.Keyed = KeyedSeq;
+Seq.Set = SetSeq;
+Seq.Indexed = IndexedSeq;
+
+Seq.prototype[IS_SEQ_SYMBOL] = true;
+
+// #pragma Root Sequences
+
+var ArraySeq = /*@__PURE__*/(function (IndexedSeq) {
+  function ArraySeq(array) {
+    this._array = array;
+    this.size = array.length;
+  }
+
+  if ( IndexedSeq ) ArraySeq.__proto__ = IndexedSeq;
+  ArraySeq.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
+  ArraySeq.prototype.constructor = ArraySeq;
+
+  ArraySeq.prototype.get = function get (index, notSetValue) {
+    return this.has(index) ? this._array[wrapIndex(this, index)] : notSetValue;
+  };
+
+  ArraySeq.prototype.__iterate = function __iterate (fn, reverse) {
+    var array = this._array;
+    var size = array.length;
+    var i = 0;
+    while (i !== size) {
+      var ii = reverse ? size - ++i : i++;
+      if (fn(array[ii], ii, this) === false) {
+        break;
+      }
+    }
+    return i;
+  };
+
+  ArraySeq.prototype.__iterator = function __iterator (type, reverse) {
+    var array = this._array;
+    var size = array.length;
+    var i = 0;
+    return new Iterator(function () {
+      if (i === size) {
+        return iteratorDone();
+      }
+      var ii = reverse ? size - ++i : i++;
+      return iteratorValue(type, ii, array[ii]);
+    });
+  };
+
+  return ArraySeq;
+}(IndexedSeq));
+
+var ObjectSeq = /*@__PURE__*/(function (KeyedSeq) {
+  function ObjectSeq(object) {
+    var keys = Object.keys(object);
+    this._object = object;
+    this._keys = keys;
+    this.size = keys.length;
+  }
+
+  if ( KeyedSeq ) ObjectSeq.__proto__ = KeyedSeq;
+  ObjectSeq.prototype = Object.create( KeyedSeq && KeyedSeq.prototype );
+  ObjectSeq.prototype.constructor = ObjectSeq;
+
+  ObjectSeq.prototype.get = function get (key, notSetValue) {
+    if (notSetValue !== undefined && !this.has(key)) {
+      return notSetValue;
+    }
+    return this._object[key];
+  };
+
+  ObjectSeq.prototype.has = function has (key) {
+    return hasOwnProperty.call(this._object, key);
+  };
+
+  ObjectSeq.prototype.__iterate = function __iterate (fn, reverse) {
+    var object = this._object;
+    var keys = this._keys;
+    var size = keys.length;
+    var i = 0;
+    while (i !== size) {
+      var key = keys[reverse ? size - ++i : i++];
+      if (fn(object[key], key, this) === false) {
+        break;
+      }
+    }
+    return i;
+  };
+
+  ObjectSeq.prototype.__iterator = function __iterator (type, reverse) {
+    var object = this._object;
+    var keys = this._keys;
+    var size = keys.length;
+    var i = 0;
+    return new Iterator(function () {
+      if (i === size) {
+        return iteratorDone();
+      }
+      var key = keys[reverse ? size - ++i : i++];
+      return iteratorValue(type, key, object[key]);
+    });
+  };
+
+  return ObjectSeq;
+}(KeyedSeq));
+ObjectSeq.prototype[IS_ORDERED_SYMBOL] = true;
+
+var CollectionSeq = /*@__PURE__*/(function (IndexedSeq) {
+  function CollectionSeq(collection) {
+    this._collection = collection;
+    this.size = collection.length || collection.size;
+  }
+
+  if ( IndexedSeq ) CollectionSeq.__proto__ = IndexedSeq;
+  CollectionSeq.prototype = Object.create( IndexedSeq && IndexedSeq.prototype );
+  CollectionSeq.prototype.constructor = CollectionSeq;
+
+  CollectionSeq.prototype.__iterateUncached = function __iterateUncached (fn, reverse) {
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var collection = this._collection;
+    var iterator = getIterator(collection);
+    var iterations = 0;
+    if (isIterator(iterator)) {
+      var step;
+      while (!(step = iterator.next()).done) {
+        if (fn(step.value, iterations++, this) === false) {
+          break;
+        }
+      }
+    }
+    return iterations;
+  };
+
+  CollectionSeq.prototype.__iteratorUncached = function __iteratorUncached (type, reverse) {
+    if (reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    var collection = this._collection;
+    var iterator = getIterator(collection);
+    if (!isIterator(iterator)) {
+      return new Iterator(iteratorDone);
+    }
+    var iterations = 0;
+    return new Iterator(function () {
+      var step = iterator.next();
+      return step.done ? step : iteratorValue(type, iterations++, step.value);
+    });
+  };
+
+  return CollectionSeq;
+}(IndexedSeq));
+
+// # pragma Helper functions
+
+var EMPTY_SEQ;
+
+function emptySequence() {
+  return EMPTY_SEQ || (EMPTY_SEQ = new ArraySeq([]));
+}
+
+function keyedSeqFromValue(value) {
+  var seq = Array.isArray(value)
+    ? new ArraySeq(value)
+    : hasIterator(value)
+      ? new CollectionSeq(value)
+      : undefined;
+  if (seq) {
+    return seq.fromEntrySeq();
+  }
+  if (typeof value === 'object') {
+    return new ObjectSeq(value);
+  }
+  throw new TypeError(
+    'Expected Array or collection object of [k, v] entries, or keyed object: ' +
+      value
+  );
+}
+
+function indexedSeqFromValue(value) {
+  var seq = maybeIndexedSeqFromValue(value);
+  if (seq) {
+    return seq;
+  }
+  throw new TypeError(
+    'Expected Array or collection object of values: ' + value
+  );
+}
+
+function seqFromValue(value) {
+  var seq = maybeIndexedSeqFromValue(value);
+  if (seq) {
+    return seq;
+  }
+  if (typeof value === 'object') {
+    return new ObjectSeq(value);
+  }
+  throw new TypeError(
+    'Expected Array or collection object of values, or keyed object: ' + value
+  );
+}
+
+function maybeIndexedSeqFromValue(value) {
+  return isArrayLike(value)
+    ? new ArraySeq(value)
+    : hasIterator(value)
+      ? new CollectionSeq(value)
+      : undefined;
+}
+
+var IS_MAP_SYMBOL = '@@__IMMUTABLE_MAP__@@';
+
+function isMap(maybeMap) {
+  return Boolean(maybeMap && maybeMap[IS_MAP_SYMBOL]);
+}
+
+function isOrderedMap(maybeOrderedMap) {
+  return isMap(maybeOrderedMap) && isOrdered(maybeOrderedMap);
+}
+
+function isValueObject(maybeValue) {
+  return Boolean(
+    maybeValue &&
+      typeof maybeValue.equals === 'function' &&
+      typeof maybeValue.hashCode === 'function'
+  );
+}
+
+/**
+ * An extension of the "same-value" algorithm as [described for use by ES6 Map
+ * and Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map#Key_equality)
+ *
+ * NaN is considered the same as NaN, however -0 and 0 are considered the same
+ * value, which is different from the algorithm described by
+ * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
+ *
+ * This is extended further to allow Objects to describe the values they
+ * represent, by way of `valueOf` or `equals` (and `hashCode`).
+ *
+ * Note: because of this extension, the key equality of Immutable.Map and the
+ * value equality of Immutable.Set will differ from ES6 Map and Set.
+ *
+ * ### Defining custom values
+ *
+ * The easiest way to describe the value an object represents is by implementing
+ * `valueOf`. For example, `Date` represents a value by returning a unix
+ * timestamp for `valueOf`:
+ *
+ *     var date1 = new Date(1234567890000); // Fri Feb 13 2009 ...
+ *     var date2 = new Date(1234567890000);
+ *     date1.valueOf(); // 1234567890000
+ *     assert( date1 !== date2 );
+ *     assert( Immutable.is( date1, date2 ) );
+ *
+ * Note: overriding `valueOf` may have other implications if you use this object
+ * where JavaScript expects a primitive, such as implicit string coercion.
+ *
+ * For more complex types, especially collections, implementing `valueOf` may
+ * not be performant. An alternative is to implement `equals` and `hashCode`.
+ *
+ * `equals` takes another object, presumably of similar type, and returns true
+ * if it is equal. Equality is symmetrical, so the same result should be
+ * returned if this and the argument are flipped.
+ *
+ *     assert( a.equals(b) === b.equals(a) );
+ *
+ * `hashCode` returns a 32bit integer number representing the object which will
+ * be used to determine how to store the value object in a Map or Set. You must
+ * provide both or neither methods, one must not exist without the other.
+ *
+ * Also, an important relationship between these methods must be upheld: if two
+ * values are equal, they *must* return the same hashCode. If the values are not
+ * equal, they might have the same hashCode; this is called a hash collision,
+ * and while undesirable for performance reasons, it is acceptable.
+ *
+ *     if (a.equals(b)) {
+ *       assert( a.hashCode() === b.hashCode() );
+ *     }
+ *
+ * All Immutable collections are Value Objects: they implement `equals()`
+ * and `hashCode()`.
+ */
+function is(valueA, valueB) {
+  if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {
+    return true;
+  }
+  if (!valueA || !valueB) {
+    return false;
+  }
+  if (
+    typeof valueA.valueOf === 'function' &&
+    typeof valueB.valueOf === 'function'
+  ) {
+    valueA = valueA.valueOf();
+    valueB = valueB.valueOf();
+    if (valueA === valueB || (valueA !== valueA && valueB !== valueB)) {
+      return true;
+    }
+    if (!valueA || !valueB) {
+      return false;
+    }
+  }
+  return !!(
+    isValueObject(valueA) &&
+    isValueObject(valueB) &&
+    valueA.equals(valueB)
+  );
+}
+
+var imul =
+  typeof Math.imul === 'function' && Math.imul(0xffffffff, 2) === -2
+    ? Math.imul
+    : function imul(a, b) {
+        a |= 0; // int
+        b |= 0; // int
+        var c = a & 0xffff;
+        var d = b & 0xffff;
+        // Shift by 0 fixes the sign on the high part.
+        return (c * d + ((((a >>> 16) * d + c * (b >>> 16)) << 16) >>> 0)) | 0; // int
+      };
+
+// v8 has an optimization for storing 31-bit signed numbers.
+// Values which have either 00 or 11 as the high order bits qualify.
+// This function drops the highest order bit in a signed number, maintaining
+// the sign bit.
+function smi(i32) {
+  return ((i32 >>> 1) & 0x40000000) | (i32 & 0xbfffffff);
+}
+
+var defaultValueOf = Object.prototype.valueOf;
+
+function hash(o) {
+  switch (typeof o) {
+    case 'boolean':
+      // The hash values for built-in constants are a 1 value for each 5-byte
+      // shift region expect for the first, which encodes the value. This
+      // reduces the odds of a hash collision for these common values.
+      return o ? 0x42108421 : 0x42108420;
+    case 'number':
+      return hashNumber(o);
+    case 'string':
+      return o.length > STRING_HASH_CACHE_MIN_STRLEN
+        ? cachedHashString(o)
+        : hashString(o);
+    case 'object':
+    case 'function':
+      if (o === null) {
+        return 0x42108422;
+      }
+      if (typeof o.hashCode === 'function') {
+        // Drop any high bits from accidentally long hash codes.
+        return smi(o.hashCode(o));
+      }
+      if (o.valueOf !== defaultValueOf && typeof o.valueOf === 'function') {
+        o = o.valueOf(o);
+      }
+      return hashJSObj(o);
+    case 'undefined':
+      return 0x42108423;
+    default:
+      if (typeof o.toString === 'function') {
+        return hashString(o.toString());
+      }
+      throw new Error('Value type ' + typeof o + ' cannot be hashed.');
+  }
+}
+
+// Compress arbitrarily large numbers into smi hashes.
+function hashNumber(n) {
+  if (n !== n || n === Infinity) {
+    return 0;
+  }
+  var hash = n | 0;
+  if (hash !== n) {
+    hash ^= n * 0xffffffff;
+  }
+  while (n > 0xffffffff) {
+    n /= 0xffffffff;
+    hash ^= n;
+  }
+  return smi(hash);
+}
+
+function cachedHashString(string) {
+  var hashed = stringHashCache[string];
+  if (hashed === undefined) {
+    hashed = hashString(string);
+    if (STRING_HASH_CACHE_SIZE === STRING_HASH_CACHE_MAX_SIZE) {
+      STRING_HASH_CACHE_SIZE = 0;
+      stringHashCache = {};
+    }
+    STRING_HASH_CACHE_SIZE++;
+    stringHashCache[string] = hashed;
+  }
+  return hashed;
+}
+
+// http://jsperf.com/hashing-strings
+function hashString(string) {
+  // This is the hash from JVM
+  // The hash code for a string is computed as
+  // s[0] * 31 ^ (n - 1) + s[1] * 31 ^ (n - 2) + ... + s[n - 1],
+  // where s[i] is the ith character of the string and n is the length of
+  // the string. We "mod" the result to make it between 0 (inclusive) and 2^31
+  // (exclusive) by dropping high bits.
+  var hashed = 0;
+  for (var ii = 0; ii < string.length; ii++) {
+    hashed = (31 * hashed + string.charCodeAt(ii)) | 0;
+  }
+  return smi(hashed);
+}
+
+function hashJSObj(obj) {
+  var hashed;
+  if (usingWeakMap) {
+    hashed = weakMap.get(obj);
+    if (hashed !== undefined) {
+      return hashed;
+    }
+  }
+
+  hashed = obj[UID_HASH_KEY];
+  if (hashed !== undefined) {
+    return hashed;
+  }
+
+  if (!canDefineProperty) {
+    hashed = obj.propertyIsEnumerable && obj.propertyIsEnumerable[UID_HASH_KEY];
+    if (hashed !== undefined) {
+      return hashed;
+    }
+
+    hashed = getIENodeHash(obj);
+    if (hashed !== undefined) {
+      return hashed;
+    }
+  }
+
+  hashed = ++objHashUID;
+  if (objHashUID & 0x40000000) {
+    objHashUID = 0;
+  }
+
+  if (usingWeakMap) {
+    weakMap.set(obj, hashed);
+  } else if (isExtensible !== undefined && isExtensible(obj) === false) {
+    throw new Error('Non-extensible objects are not allowed as keys.');
+  } else if (canDefineProperty) {
+    Object.defineProperty(obj, UID_HASH_KEY, {
+      enumerable: false,
+      configurable: false,
+      writable: false,
+      value: hashed,
+    });
+  } else if (
+    obj.propertyIsEnumerable !== undefined &&
+    obj.propertyIsEnumerable === obj.constructor.prototype.propertyIsEnumerable
+  ) {
+    // Since we can't define a non-enumerable property on the object
+    // we'll hijack one of the less-used non-enumerable properties to
+    // save our hash on it. Since this is a function it will not show up in
+    // `JSON.stringify` which is what we want.
+    obj.propertyIsEnumerable = function() {
+      return this.constructor.prototype.propertyIsEnumerable.apply(
+        this,
+        arguments
+      );
+    };
+    obj.propertyIsEnumerable[UID_HASH_KEY] = hashed;
+  } else if (obj.nodeType !== undefined) {
+    // At this point we couldn't get the IE `uniqueID` to use as a hash
+    // and we couldn't use a non-enumerable property to exploit the
+    // dontEnum bug so we simply add the `UID_HASH_KEY` on the node
+    // itself.
+    obj[UID_HASH_KEY] = hashed;
+  } else {
+    throw new Error('Unable to set a non-enumerable property on object.');
+  }
+
+  return hashed;
+}
+
+// Get references to ES5 object methods.
+var isExtensible = Object.isExtensible;
+
+// True if Object.defineProperty works as expected. IE8 fails this test.
+var canDefineProperty = (function() {
+  try {
+    Object.defineProperty({}, '@', {});
+    return true;
+  } catch (e) {
+    return false;
+  }
+})();
+
+// IE has a `uniqueID` property on DOM nodes. We can construct the hash from it
+// and avoid memory leaks from the IE cloneNode bug.
+function getIENodeHash(node) {
+  if (node && node.nodeType > 0) {
+    switch (node.nodeType) {
+      case 1: // Element
+        return node.uniqueID;
+      case 9: // Document
+        return node.documentElement && node.documentElement.uniqueID;
+    }
+  }
+}
+
+// If possible, use a WeakMap.
+var usingWeakMap = typeof WeakMap === 'function';
+var weakMap;
+if (usingWeakMap) {
+  weakMap = new WeakMap();
+}
+
+var objHashUID = 0;
+
+var UID_HASH_KEY = '__immutablehash__';
+if (typeof Symbol === 'function') {
+  UID_HASH_KEY = Symbol(UID_HASH_KEY);
+}
+
+var STRING_HASH_CACHE_MIN_STRLEN = 16;
+var STRING_HASH_CACHE_MAX_SIZE = 255;
+var STRING_HASH_CACHE_SIZE = 0;
+var stringHashCache = {};
+
+var ToKeyedSequence = /*@__PURE__*/(function (KeyedSeq$$1) {
+  function ToKeyedSequence(indexed, useKeys) {
+    this._iter = indexed;
+    this._useKeys = useKeys;
+    this.size = indexed.size;
+  }
+
+  if ( KeyedSeq$$1 ) ToKeyedSequence.__proto__ = KeyedSeq$$1;
+  ToKeyedSequence.prototype = Object.create( KeyedSeq$$1 && KeyedSeq$$1.prototype );
+  ToKeyedSequence.prototype.constructor = ToKeyedSequence;
+
+  ToKeyedSequence.prototype.get = function get (key, notSetValue) {
+    return this._iter.get(key, notSetValue);
+  };
+
+  ToKeyedSequence.prototype.has = function has (key) {
+    return this._iter.has(key);
+  };
+
+  ToKeyedSequence.prototype.valueSeq = function valueSeq () {
+    return this._iter.valueSeq();
+  };
+
+  ToKeyedSequence.prototype.reverse = function reverse () {
+    var this$1 = this;
+
+    var reversedSequence = reverseFactory(this, true);
+    if (!this._useKeys) {
+      reversedSequence.valueSeq = function () { return this$1._iter.toSeq().reverse(); };
+    }
+    return reversedSequence;
+  };
+
+  ToKeyedSequence.prototype.map = function map (mapper, context) {
+    var this$1 = this;
+
+    var mappedSequence = mapFactory(this, mapper, context);
+    if (!this._useKeys) {
+      mappedSequence.valueSeq = function () { return this$1._iter.toSeq().map(mapper, context); };
+    }
+    return mappedSequence;
+  };
+
+  ToKeyedSequence.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._iter.__iterate(function (v, k) { return fn(v, k, this$1); }, reverse);
+  };
+
+  ToKeyedSequence.prototype.__iterator = function __iterator (type, reverse) {
+    return this._iter.__iterator(type, reverse);
+  };
+
+  return ToKeyedSequence;
+}(KeyedSeq));
+ToKeyedSequence.prototype[IS_ORDERED_SYMBOL] = true;
+
+var ToIndexedSequence = /*@__PURE__*/(function (IndexedSeq$$1) {
+  function ToIndexedSequence(iter) {
+    this._iter = iter;
+    this.size = iter.size;
+  }
+
+  if ( IndexedSeq$$1 ) ToIndexedSequence.__proto__ = IndexedSeq$$1;
+  ToIndexedSequence.prototype = Object.create( IndexedSeq$$1 && IndexedSeq$$1.prototype );
+  ToIndexedSequence.prototype.constructor = ToIndexedSequence;
+
+  ToIndexedSequence.prototype.includes = function includes (value) {
+    return this._iter.includes(value);
+  };
+
+  ToIndexedSequence.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    var i = 0;
+    reverse && ensureSize(this);
+    return this._iter.__iterate(
+      function (v) { return fn(v, reverse ? this$1.size - ++i : i++, this$1); },
+      reverse
+    );
+  };
+
+  ToIndexedSequence.prototype.__iterator = function __iterator (type, reverse) {
+    var this$1 = this;
+
+    var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
+    var i = 0;
+    reverse && ensureSize(this);
+    return new Iterator(function () {
+      var step = iterator.next();
+      return step.done
+        ? step
+        : iteratorValue(
+            type,
+            reverse ? this$1.size - ++i : i++,
+            step.value,
+            step
+          );
+    });
+  };
+
+  return ToIndexedSequence;
+}(IndexedSeq));
+
+var ToSetSequence = /*@__PURE__*/(function (SetSeq$$1) {
+  function ToSetSequence(iter) {
+    this._iter = iter;
+    this.size = iter.size;
+  }
+
+  if ( SetSeq$$1 ) ToSetSequence.__proto__ = SetSeq$$1;
+  ToSetSequence.prototype = Object.create( SetSeq$$1 && SetSeq$$1.prototype );
+  ToSetSequence.prototype.constructor = ToSetSequence;
+
+  ToSetSequence.prototype.has = function has (key) {
+    return this._iter.includes(key);
+  };
+
+  ToSetSequence.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._iter.__iterate(function (v) { return fn(v, v, this$1); }, reverse);
+  };
+
+  ToSetSequence.prototype.__iterator = function __iterator (type, reverse) {
+    var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
+    return new Iterator(function () {
+      var step = iterator.next();
+      return step.done
+        ? step
+        : iteratorValue(type, step.value, step.value, step);
+    });
+  };
+
+  return ToSetSequence;
+}(SetSeq));
+
+var FromEntriesSequence = /*@__PURE__*/(function (KeyedSeq$$1) {
+  function FromEntriesSequence(entries) {
+    this._iter = entries;
+    this.size = entries.size;
+  }
+
+  if ( KeyedSeq$$1 ) FromEntriesSequence.__proto__ = KeyedSeq$$1;
+  FromEntriesSequence.prototype = Object.create( KeyedSeq$$1 && KeyedSeq$$1.prototype );
+  FromEntriesSequence.prototype.constructor = FromEntriesSequence;
+
+  FromEntriesSequence.prototype.entrySeq = function entrySeq () {
+    return this._iter.toSeq();
+  };
+
+  FromEntriesSequence.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._iter.__iterate(function (entry) {
+      // Check if entry exists first so array access doesn't throw for holes
+      // in the parent iteration.
+      if (entry) {
+        validateEntry(entry);
+        var indexedCollection = isCollection(entry);
+        return fn(
+          indexedCollection ? entry.get(1) : entry[1],
+          indexedCollection ? entry.get(0) : entry[0],
+          this$1
+        );
+      }
+    }, reverse);
+  };
+
+  FromEntriesSequence.prototype.__iterator = function __iterator (type, reverse) {
+    var iterator = this._iter.__iterator(ITERATE_VALUES, reverse);
+    return new Iterator(function () {
+      while (true) {
+        var step = iterator.next();
+        if (step.done) {
+          return step;
+        }
+        var entry = step.value;
+        // Check if entry exists first so array access doesn't throw for holes
+        // in the parent iteration.
+        if (entry) {
+          validateEntry(entry);
+          var indexedCollection = isCollection(entry);
+          return iteratorValue(
+            type,
+            indexedCollection ? entry.get(0) : entry[0],
+            indexedCollection ? entry.get(1) : entry[1],
+            step
+          );
+        }
+      }
+    });
+  };
+
+  return FromEntriesSequence;
+}(KeyedSeq));
+
+ToIndexedSequence.prototype.cacheResult = ToKeyedSequence.prototype.cacheResult = ToSetSequence.prototype.cacheResult = FromEntriesSequence.prototype.cacheResult = cacheResultThrough;
+
+function flipFactory(collection) {
+  var flipSequence = makeSequence(collection);
+  flipSequence._iter = collection;
+  flipSequence.size = collection.size;
+  flipSequence.flip = function () { return collection; };
+  flipSequence.reverse = function() {
+    var reversedSequence = collection.reverse.apply(this); // super.reverse()
+    reversedSequence.flip = function () { return collection.reverse(); };
+    return reversedSequence;
+  };
+  flipSequence.has = function (key) { return collection.includes(key); };
+  flipSequence.includes = function (key) { return collection.has(key); };
+  flipSequence.cacheResult = cacheResultThrough;
+  flipSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    return collection.__iterate(function (v, k) { return fn(k, v, this$1) !== false; }, reverse);
+  };
+  flipSequence.__iteratorUncached = function(type, reverse) {
+    if (type === ITERATE_ENTRIES) {
+      var iterator = collection.__iterator(type, reverse);
+      return new Iterator(function () {
+        var step = iterator.next();
+        if (!step.done) {
+          var k = step.value[0];
+          step.value[0] = step.value[1];
+          step.value[1] = k;
+        }
+        return step;
+      });
+    }
+    return collection.__iterator(
+      type === ITERATE_VALUES ? ITERATE_KEYS : ITERATE_VALUES,
+      reverse
+    );
+  };
+  return flipSequence;
+}
+
+function mapFactory(collection, mapper, context) {
+  var mappedSequence = makeSequence(collection);
+  mappedSequence.size = collection.size;
+  mappedSequence.has = function (key) { return collection.has(key); };
+  mappedSequence.get = function (key, notSetValue) {
+    var v = collection.get(key, NOT_SET);
+    return v === NOT_SET
+      ? notSetValue
+      : mapper.call(context, v, key, collection);
+  };
+  mappedSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    return collection.__iterate(
+      function (v, k, c) { return fn(mapper.call(context, v, k, c), k, this$1) !== false; },
+      reverse
+    );
+  };
+  mappedSequence.__iteratorUncached = function(type, reverse) {
+    var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
+    return new Iterator(function () {
+      var step = iterator.next();
+      if (step.done) {
+        return step;
+      }
+      var entry = step.value;
+      var key = entry[0];
+      return iteratorValue(
+        type,
+        key,
+        mapper.call(context, entry[1], key, collection),
+        step
+      );
+    });
+  };
+  return mappedSequence;
+}
+
+function reverseFactory(collection, useKeys) {
+  var this$1 = this;
+
+  var reversedSequence = makeSequence(collection);
+  reversedSequence._iter = collection;
+  reversedSequence.size = collection.size;
+  reversedSequence.reverse = function () { return collection; };
+  if (collection.flip) {
+    reversedSequence.flip = function() {
+      var flipSequence = flipFactory(collection);
+      flipSequence.reverse = function () { return collection.flip(); };
+      return flipSequence;
+    };
+  }
+  reversedSequence.get = function (key, notSetValue) { return collection.get(useKeys ? key : -1 - key, notSetValue); };
+  reversedSequence.has = function (key) { return collection.has(useKeys ? key : -1 - key); };
+  reversedSequence.includes = function (value) { return collection.includes(value); };
+  reversedSequence.cacheResult = cacheResultThrough;
+  reversedSequence.__iterate = function(fn, reverse) {
+    var this$1 = this;
+
+    var i = 0;
+    reverse && ensureSize(collection);
+    return collection.__iterate(
+      function (v, k) { return fn(v, useKeys ? k : reverse ? this$1.size - ++i : i++, this$1); },
+      !reverse
+    );
+  };
+  reversedSequence.__iterator = function (type, reverse) {
+    var i = 0;
+    reverse && ensureSize(collection);
+    var iterator = collection.__iterator(ITERATE_ENTRIES, !reverse);
+    return new Iterator(function () {
+      var step = iterator.next();
+      if (step.done) {
+        return step;
+      }
+      var entry = step.value;
+      return iteratorValue(
+        type,
+        useKeys ? entry[0] : reverse ? this$1.size - ++i : i++,
+        entry[1],
+        step
+      );
+    });
+  };
+  return reversedSequence;
+}
+
+function filterFactory(collection, predicate, context, useKeys) {
+  var filterSequence = makeSequence(collection);
+  if (useKeys) {
+    filterSequence.has = function (key) {
+      var v = collection.get(key, NOT_SET);
+      return v !== NOT_SET && !!predicate.call(context, v, key, collection);
+    };
+    filterSequence.get = function (key, notSetValue) {
+      var v = collection.get(key, NOT_SET);
+      return v !== NOT_SET && predicate.call(context, v, key, collection)
+        ? v
+        : notSetValue;
+    };
+  }
+  filterSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    var iterations = 0;
+    collection.__iterate(function (v, k, c) {
+      if (predicate.call(context, v, k, c)) {
+        iterations++;
+        return fn(v, useKeys ? k : iterations - 1, this$1);
+      }
+    }, reverse);
+    return iterations;
+  };
+  filterSequence.__iteratorUncached = function(type, reverse) {
+    var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
+    var iterations = 0;
+    return new Iterator(function () {
+      while (true) {
+        var step = iterator.next();
+        if (step.done) {
+          return step;
+        }
+        var entry = step.value;
+        var key = entry[0];
+        var value = entry[1];
+        if (predicate.call(context, value, key, collection)) {
+          return iteratorValue(type, useKeys ? key : iterations++, value, step);
+        }
+      }
+    });
+  };
+  return filterSequence;
+}
+
+function countByFactory(collection, grouper, context) {
+  var groups = Map().asMutable();
+  collection.__iterate(function (v, k) {
+    groups.update(grouper.call(context, v, k, collection), 0, function (a) { return a + 1; });
+  });
+  return groups.asImmutable();
+}
+
+function groupByFactory(collection, grouper, context) {
+  var isKeyedIter = isKeyed(collection);
+  var groups = (isOrdered(collection) ? OrderedMap() : Map()).asMutable();
+  collection.__iterate(function (v, k) {
+    groups.update(
+      grouper.call(context, v, k, collection),
+      function (a) { return ((a = a || []), a.push(isKeyedIter ? [k, v] : v), a); }
+    );
+  });
+  var coerce = collectionClass(collection);
+  return groups.map(function (arr) { return reify(collection, coerce(arr)); }).asImmutable();
+}
+
+function sliceFactory(collection, begin, end, useKeys) {
+  var originalSize = collection.size;
+
+  if (wholeSlice(begin, end, originalSize)) {
+    return collection;
+  }
+
+  var resolvedBegin = resolveBegin(begin, originalSize);
+  var resolvedEnd = resolveEnd(end, originalSize);
+
+  // begin or end will be NaN if they were provided as negative numbers and
+  // this collection's size is unknown. In that case, cache first so there is
+  // a known size and these do not resolve to NaN.
+  if (resolvedBegin !== resolvedBegin || resolvedEnd !== resolvedEnd) {
+    return sliceFactory(collection.toSeq().cacheResult(), begin, end, useKeys);
+  }
+
+  // Note: resolvedEnd is undefined when the original sequence's length is
+  // unknown and this slice did not supply an end and should contain all
+  // elements after resolvedBegin.
+  // In that case, resolvedSize will be NaN and sliceSize will remain undefined.
+  var resolvedSize = resolvedEnd - resolvedBegin;
+  var sliceSize;
+  if (resolvedSize === resolvedSize) {
+    sliceSize = resolvedSize < 0 ? 0 : resolvedSize;
+  }
+
+  var sliceSeq = makeSequence(collection);
+
+  // If collection.size is undefined, the size of the realized sliceSeq is
+  // unknown at this point unless the number of items to slice is 0
+  sliceSeq.size =
+    sliceSize === 0 ? sliceSize : (collection.size && sliceSize) || undefined;
+
+  if (!useKeys && isSeq(collection) && sliceSize >= 0) {
+    sliceSeq.get = function(index, notSetValue) {
+      index = wrapIndex(this, index);
+      return index >= 0 && index < sliceSize
+        ? collection.get(index + resolvedBegin, notSetValue)
+        : notSetValue;
+    };
+  }
+
+  sliceSeq.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    if (sliceSize === 0) {
+      return 0;
+    }
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var skipped = 0;
+    var isSkipping = true;
+    var iterations = 0;
+    collection.__iterate(function (v, k) {
+      if (!(isSkipping && (isSkipping = skipped++ < resolvedBegin))) {
+        iterations++;
+        return (
+          fn(v, useKeys ? k : iterations - 1, this$1) !== false &&
+          iterations !== sliceSize
+        );
+      }
+    });
+    return iterations;
+  };
+
+  sliceSeq.__iteratorUncached = function(type, reverse) {
+    if (sliceSize !== 0 && reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    // Don't bother instantiating parent iterator if taking 0.
+    if (sliceSize === 0) {
+      return new Iterator(iteratorDone);
+    }
+    var iterator = collection.__iterator(type, reverse);
+    var skipped = 0;
+    var iterations = 0;
+    return new Iterator(function () {
+      while (skipped++ < resolvedBegin) {
+        iterator.next();
+      }
+      if (++iterations > sliceSize) {
+        return iteratorDone();
+      }
+      var step = iterator.next();
+      if (useKeys || type === ITERATE_VALUES || step.done) {
+        return step;
+      }
+      if (type === ITERATE_KEYS) {
+        return iteratorValue(type, iterations - 1, undefined, step);
+      }
+      return iteratorValue(type, iterations - 1, step.value[1], step);
+    });
+  };
+
+  return sliceSeq;
+}
+
+function takeWhileFactory(collection, predicate, context) {
+  var takeSequence = makeSequence(collection);
+  takeSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var iterations = 0;
+    collection.__iterate(
+      function (v, k, c) { return predicate.call(context, v, k, c) && ++iterations && fn(v, k, this$1); }
+    );
+    return iterations;
+  };
+  takeSequence.__iteratorUncached = function(type, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
+    var iterating = true;
+    return new Iterator(function () {
+      if (!iterating) {
+        return iteratorDone();
+      }
+      var step = iterator.next();
+      if (step.done) {
+        return step;
+      }
+      var entry = step.value;
+      var k = entry[0];
+      var v = entry[1];
+      if (!predicate.call(context, v, k, this$1)) {
+        iterating = false;
+        return iteratorDone();
+      }
+      return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);
+    });
+  };
+  return takeSequence;
+}
+
+function skipWhileFactory(collection, predicate, context, useKeys) {
+  var skipSequence = makeSequence(collection);
+  skipSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var isSkipping = true;
+    var iterations = 0;
+    collection.__iterate(function (v, k, c) {
+      if (!(isSkipping && (isSkipping = predicate.call(context, v, k, c)))) {
+        iterations++;
+        return fn(v, useKeys ? k : iterations - 1, this$1);
+      }
+    });
+    return iterations;
+  };
+  skipSequence.__iteratorUncached = function(type, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    var iterator = collection.__iterator(ITERATE_ENTRIES, reverse);
+    var skipping = true;
+    var iterations = 0;
+    return new Iterator(function () {
+      var step;
+      var k;
+      var v;
+      do {
+        step = iterator.next();
+        if (step.done) {
+          if (useKeys || type === ITERATE_VALUES) {
+            return step;
+          }
+          if (type === ITERATE_KEYS) {
+            return iteratorValue(type, iterations++, undefined, step);
+          }
+          return iteratorValue(type, iterations++, step.value[1], step);
+        }
+        var entry = step.value;
+        k = entry[0];
+        v = entry[1];
+        skipping && (skipping = predicate.call(context, v, k, this$1));
+      } while (skipping);
+      return type === ITERATE_ENTRIES ? step : iteratorValue(type, k, v, step);
+    });
+  };
+  return skipSequence;
+}
+
+function concatFactory(collection, values) {
+  var isKeyedCollection = isKeyed(collection);
+  var iters = [collection]
+    .concat(values)
+    .map(function (v) {
+      if (!isCollection(v)) {
+        v = isKeyedCollection
+          ? keyedSeqFromValue(v)
+          : indexedSeqFromValue(Array.isArray(v) ? v : [v]);
+      } else if (isKeyedCollection) {
+        v = KeyedCollection(v);
+      }
+      return v;
+    })
+    .filter(function (v) { return v.size !== 0; });
+
+  if (iters.length === 0) {
+    return collection;
+  }
+
+  if (iters.length === 1) {
+    var singleton = iters[0];
+    if (
+      singleton === collection ||
+      (isKeyedCollection && isKeyed(singleton)) ||
+      (isIndexed(collection) && isIndexed(singleton))
+    ) {
+      return singleton;
+    }
+  }
+
+  var concatSeq = new ArraySeq(iters);
+  if (isKeyedCollection) {
+    concatSeq = concatSeq.toKeyedSeq();
+  } else if (!isIndexed(collection)) {
+    concatSeq = concatSeq.toSetSeq();
+  }
+  concatSeq = concatSeq.flatten(true);
+  concatSeq.size = iters.reduce(function (sum, seq) {
+    if (sum !== undefined) {
+      var size = seq.size;
+      if (size !== undefined) {
+        return sum + size;
+      }
+    }
+  }, 0);
+  return concatSeq;
+}
+
+function flattenFactory(collection, depth, useKeys) {
+  var flatSequence = makeSequence(collection);
+  flatSequence.__iterateUncached = function(fn, reverse) {
+    if (reverse) {
+      return this.cacheResult().__iterate(fn, reverse);
+    }
+    var iterations = 0;
+    var stopped = false;
+    function flatDeep(iter, currentDepth) {
+      iter.__iterate(function (v, k) {
+        if ((!depth || currentDepth < depth) && isCollection(v)) {
+          flatDeep(v, currentDepth + 1);
+        } else {
+          iterations++;
+          if (fn(v, useKeys ? k : iterations - 1, flatSequence) === false) {
+            stopped = true;
+          }
+        }
+        return !stopped;
+      }, reverse);
+    }
+    flatDeep(collection, 0);
+    return iterations;
+  };
+  flatSequence.__iteratorUncached = function(type, reverse) {
+    if (reverse) {
+      return this.cacheResult().__iterator(type, reverse);
+    }
+    var iterator = collection.__iterator(type, reverse);
+    var stack = [];
+    var iterations = 0;
+    return new Iterator(function () {
+      while (iterator) {
+        var step = iterator.next();
+        if (step.done !== false) {
+          iterator = stack.pop();
+          continue;
+        }
+        var v = step.value;
+        if (type === ITERATE_ENTRIES) {
+          v = v[1];
+        }
+        if ((!depth || stack.length < depth) && isCollection(v)) {
+          stack.push(iterator);
+          iterator = v.__iterator(type, reverse);
+        } else {
+          return useKeys ? step : iteratorValue(type, iterations++, v, step);
+        }
+      }
+      return iteratorDone();
+    });
+  };
+  return flatSequence;
+}
+
+function flatMapFactory(collection, mapper, context) {
+  var coerce = collectionClass(collection);
+  return collection
+    .toSeq()
+    .map(function (v, k) { return coerce(mapper.call(context, v, k, collection)); })
+    .flatten(true);
+}
+
+function interposeFactory(collection, separator) {
+  var interposedSequence = makeSequence(collection);
+  interposedSequence.size = collection.size && collection.size * 2 - 1;
+  interposedSequence.__iterateUncached = function(fn, reverse) {
+    var this$1 = this;
+
+    var iterations = 0;
+    collection.__iterate(
+      function (v) { return (!iterations || fn(separator, iterations++, this$1) !== false) &&
+        fn(v, iterations++, this$1) !== false; },
+      reverse
+    );
+    return iterations;
+  };
+  interposedSequence.__iteratorUncached = function(type, reverse) {
+    var iterator = collection.__iterator(ITERATE_VALUES, reverse);
+    var iterations = 0;
+    var step;
+    return new Iterator(function () {
+      if (!step || iterations % 2) {
+        step = iterator.next();
+        if (step.done) {
+          return step;
+        }
+      }
+      return iterations % 2
+        ? iteratorValue(type, iterations++, separator)
+        : iteratorValue(type, iterations++, step.value, step);
+    });
+  };
+  return interposedSequence;
+}
+
+function sortFactory(collection, comparator, mapper) {
+  if (!comparator) {
+    comparator = defaultComparator;
+  }
+  var isKeyedCollection = isKeyed(collection);
+  var index = 0;
+  var entries = collection
+    .toSeq()
+    .map(function (v, k) { return [k, v, index++, mapper ? mapper(v, k, collection) : v]; })
+    .valueSeq()
+    .toArray();
+  entries.sort(function (a, b) { return comparator(a[3], b[3]) || a[2] - b[2]; }).forEach(
+    isKeyedCollection
+      ? function (v, i) {
+          entries[i].length = 2;
+        }
+      : function (v, i) {
+          entries[i] = v[1];
+        }
+  );
+  return isKeyedCollection
+    ? KeyedSeq(entries)
+    : isIndexed(collection)
+      ? IndexedSeq(entries)
+      : SetSeq(entries);
+}
+
+function maxFactory(collection, comparator, mapper) {
+  if (!comparator) {
+    comparator = defaultComparator;
+  }
+  if (mapper) {
+    var entry = collection
+      .toSeq()
+      .map(function (v, k) { return [v, mapper(v, k, collection)]; })
+      .reduce(function (a, b) { return (maxCompare(comparator, a[1], b[1]) ? b : a); });
+    return entry && entry[0];
+  }
+  return collection.reduce(function (a, b) { return (maxCompare(comparator, a, b) ? b : a); });
+}
+
+function maxCompare(comparator, a, b) {
+  var comp = comparator(b, a);
+  // b is considered the new max if the comparator declares them equal, but
+  // they are not equal and b is in fact a nullish value.
+  return (
+    (comp === 0 && b !== a && (b === undefined || b === null || b !== b)) ||
+    comp > 0
+  );
+}
+
+function zipWithFactory(keyIter, zipper, iters, zipAll) {
+  var zipSequence = makeSequence(keyIter);
+  var sizes = new ArraySeq(iters).map(function (i) { return i.size; });
+  zipSequence.size = zipAll ? sizes.max() : sizes.min();
+  // Note: this a generic base implementation of __iterate in terms of
+  // __iterator which may be more generically useful in the future.
+  zipSequence.__iterate = function(fn, reverse) {
+    /* generic:
+    var iterator = this.__iterator(ITERATE_ENTRIES, reverse);
+    var step;
+    var iterations = 0;
+    while (!(step = iterator.next()).done) {
+      iterations++;
+      if (fn(step.value[1], step.value[0], this) === false) {
+        break;
+      }
+    }
+    return iterations;
+    */
+    // indexed:
+    var iterator = this.__iterator(ITERATE_VALUES, reverse);
+    var step;
+    var iterations = 0;
+    while (!(step = iterator.next()).done) {
+      if (fn(step.value, iterations++, this) === false) {
+        break;
+      }
+    }
+    return iterations;
+  };
+  zipSequence.__iteratorUncached = function(type, reverse) {
+    var iterators = iters.map(
+      function (i) { return ((i = Collection(i)), getIterator(reverse ? i.reverse() : i)); }
+    );
+    var iterations = 0;
+    var isDone = false;
+    return new Iterator(function () {
+      var steps;
+      if (!isDone) {
+        steps = iterators.map(function (i) { return i.next(); });
+        isDone = zipAll ? steps.every(function (s) { return s.done; }) : steps.some(function (s) { return s.done; });
+      }
+      if (isDone) {
+        return iteratorDone();
+      }
+      return iteratorValue(
+        type,
+        iterations++,
+        zipper.apply(null, steps.map(function (s) { return s.value; }))
+      );
+    });
+  };
+  return zipSequence;
+}
+
+// #pragma Helper Functions
+
+function reify(iter, seq) {
+  return iter === seq ? iter : isSeq(iter) ? seq : iter.constructor(seq);
+}
+
+function validateEntry(entry) {
+  if (entry !== Object(entry)) {
+    throw new TypeError('Expected [K, V] tuple: ' + entry);
+  }
+}
+
+function collectionClass(collection) {
+  return isKeyed(collection)
+    ? KeyedCollection
+    : isIndexed(collection)
+      ? IndexedCollection
+      : SetCollection;
+}
+
+function makeSequence(collection) {
+  return Object.create(
+    (isKeyed(collection)
+      ? KeyedSeq
+      : isIndexed(collection)
+        ? IndexedSeq
+        : SetSeq
+    ).prototype
+  );
+}
+
+function cacheResultThrough() {
+  if (this._iter.cacheResult) {
+    this._iter.cacheResult();
+    this.size = this._iter.size;
+    return this;
+  }
+  return Seq.prototype.cacheResult.call(this);
+}
+
+function defaultComparator(a, b) {
+  if (a === undefined && b === undefined) {
+    return 0;
+  }
+
+  if (a === undefined) {
+    return 1;
+  }
+
+  if (b === undefined) {
+    return -1;
+  }
+
+  return a > b ? 1 : a < b ? -1 : 0;
+}
+
+// http://jsperf.com/copy-array-inline
+function arrCopy(arr, offset) {
+  offset = offset || 0;
+  var len = Math.max(0, arr.length - offset);
+  var newArr = new Array(len);
+  for (var ii = 0; ii < len; ii++) {
+    newArr[ii] = arr[ii + offset];
+  }
+  return newArr;
+}
+
+function invariant(condition, error) {
+  if (!condition) { throw new Error(error); }
+}
+
+function assertNotInfinite(size) {
+  invariant(
+    size !== Infinity,
+    'Cannot perform this action with an infinite size.'
+  );
+}
+
+function coerceKeyPath(keyPath) {
+  if (isArrayLike(keyPath) && typeof keyPath !== 'string') {
+    return keyPath;
+  }
+  if (isOrdered(keyPath)) {
+    return keyPath.toArray();
+  }
+  throw new TypeError(
+    'Invalid keyPath: expected Ordered Collection or Array: ' + keyPath
+  );
+}
+
+function isPlainObj(value) {
+  return (
+    value &&
+    (typeof value.constructor !== 'function' ||
+      value.constructor.name === 'Object')
+  );
+}
+
+/**
+ * Returns true if the value is a potentially-persistent data structure, either
+ * provided by Immutable.js or a plain Array or Object.
+ */
+function isDataStructure(value) {
+  return (
+    typeof value === 'object' &&
+    (isImmutable(value) || Array.isArray(value) || isPlainObj(value))
+  );
+}
+
+/**
+ * Converts a value to a string, adding quotes if a string was provided.
+ */
+function quoteString(value) {
+  try {
+    return typeof value === 'string' ? JSON.stringify(value) : String(value);
+  } catch (_ignoreError) {
+    return JSON.stringify(value);
+  }
+}
+
+function has(collection, key) {
+  return isImmutable(collection)
+    ? collection.has(key)
+    : isDataStructure(collection) && hasOwnProperty.call(collection, key);
+}
+
+function get(collection, key, notSetValue) {
+  return isImmutable(collection)
+    ? collection.get(key, notSetValue)
+    : !has(collection, key)
+      ? notSetValue
+      : typeof collection.get === 'function'
+        ? collection.get(key)
+        : collection[key];
+}
+
+function shallowCopy(from) {
+  if (Array.isArray(from)) {
+    return arrCopy(from);
+  }
+  var to = {};
+  for (var key in from) {
+    if (hasOwnProperty.call(from, key)) {
+      to[key] = from[key];
+    }
+  }
+  return to;
+}
+
+function remove(collection, key) {
+  if (!isDataStructure(collection)) {
+    throw new TypeError(
+      'Cannot update non-data-structure value: ' + collection
+    );
+  }
+  if (isImmutable(collection)) {
+    if (!collection.remove) {
+      throw new TypeError(
+        'Cannot update immutable value without .remove() method: ' + collection
+      );
+    }
+    return collection.remove(key);
+  }
+  if (!hasOwnProperty.call(collection, key)) {
+    return collection;
+  }
+  var collectionCopy = shallowCopy(collection);
+  if (Array.isArray(collectionCopy)) {
+    collectionCopy.splice(key, 1);
+  } else {
+    delete collectionCopy[key];
+  }
+  return collectionCopy;
+}
+
+function set(collection, key, value) {
+  if (!isDataStructure(collection)) {
+    throw new TypeError(
+      'Cannot update non-data-structure value: ' + collection
+    );
+  }
+  if (isImmutable(collection)) {
+    if (!collection.set) {
+      throw new TypeError(
+        'Cannot update immutable value without .set() method: ' + collection
+      );
+    }
+    return collection.set(key, value);
+  }
+  if (hasOwnProperty.call(collection, key) && value === collection[key]) {
+    return collection;
+  }
+  var collectionCopy = shallowCopy(collection);
+  collectionCopy[key] = value;
+  return collectionCopy;
+}
+
+function updateIn(collection, keyPath, notSetValue, updater) {
+  if (!updater) {
+    updater = notSetValue;
+    notSetValue = undefined;
+  }
+  var updatedValue = updateInDeeply(
+    isImmutable(collection),
+    collection,
+    coerceKeyPath(keyPath),
+    0,
+    notSetValue,
+    updater
+  );
+  return updatedValue === NOT_SET ? notSetValue : updatedValue;
+}
+
+function updateInDeeply(
+  inImmutable,
+  existing,
+  keyPath,
+  i,
+  notSetValue,
+  updater
+) {
+  var wasNotSet = existing === NOT_SET;
+  if (i === keyPath.length) {
+    var existingValue = wasNotSet ? notSetValue : existing;
+    var newValue = updater(existingValue);
+    return newValue === existingValue ? existing : newValue;
+  }
+  if (!wasNotSet && !isDataStructure(existing)) {
+    throw new TypeError(
+      'Cannot update within non-data-structure value in path [' +
+        keyPath.slice(0, i).map(quoteString) +
+        ']: ' +
+        existing
+    );
+  }
+  var key = keyPath[i];
+  var nextExisting = wasNotSet ? NOT_SET : get(existing, key, NOT_SET);
+  var nextUpdated = updateInDeeply(
+    nextExisting === NOT_SET ? inImmutable : isImmutable(nextExisting),
+    nextExisting,
+    keyPath,
+    i + 1,
+    notSetValue,
+    updater
+  );
+  return nextUpdated === nextExisting
+    ? existing
+    : nextUpdated === NOT_SET
+      ? remove(existing, key)
+      : set(
+          wasNotSet ? (inImmutable ? emptyMap() : {}) : existing,
+          key,
+          nextUpdated
+        );
+}
+
+function setIn(collection, keyPath, value) {
+  return updateIn(collection, keyPath, NOT_SET, function () { return value; });
+}
+
+function setIn$1(keyPath, v) {
+  return setIn(this, keyPath, v);
+}
+
+function removeIn(collection, keyPath) {
+  return updateIn(collection, keyPath, function () { return NOT_SET; });
+}
+
+function deleteIn(keyPath) {
+  return removeIn(this, keyPath);
+}
+
+function update(collection, key, notSetValue, updater) {
+  return updateIn(collection, [key], notSetValue, updater);
+}
+
+function update$1(key, notSetValue, updater) {
+  return arguments.length === 1
+    ? key(this)
+    : update(this, key, notSetValue, updater);
+}
+
+function updateIn$1(keyPath, notSetValue, updater) {
+  return updateIn(this, keyPath, notSetValue, updater);
+}
+
+function merge() {
+  var iters = [], len = arguments.length;
+  while ( len-- ) iters[ len ] = arguments[ len ];
+
+  return mergeIntoKeyedWith(this, iters);
+}
+
+function mergeWith(merger) {
+  var iters = [], len = arguments.length - 1;
+  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
+
+  if (typeof merger !== 'function') {
+    throw new TypeError('Invalid merger function: ' + merger);
+  }
+  return mergeIntoKeyedWith(this, iters, merger);
+}
+
+function mergeIntoKeyedWith(collection, collections, merger) {
+  var iters = [];
+  for (var ii = 0; ii < collections.length; ii++) {
+    var collection$1 = KeyedCollection(collections[ii]);
+    if (collection$1.size !== 0) {
+      iters.push(collection$1);
+    }
+  }
+  if (iters.length === 0) {
+    return collection;
+  }
+  if (
+    collection.toSeq().size === 0 &&
+    !collection.__ownerID &&
+    iters.length === 1
+  ) {
+    return collection.constructor(iters[0]);
+  }
+  return collection.withMutations(function (collection) {
+    var mergeIntoCollection = merger
+      ? function (value, key) {
+          update(
+            collection,
+            key,
+            NOT_SET,
+            function (oldVal) { return (oldVal === NOT_SET ? value : merger(oldVal, value, key)); }
+          );
+        }
+      : function (value, key) {
+          collection.set(key, value);
+        };
+    for (var ii = 0; ii < iters.length; ii++) {
+      iters[ii].forEach(mergeIntoCollection);
+    }
+  });
+}
+
+function merge$1(collection) {
+  var sources = [], len = arguments.length - 1;
+  while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
+
+  return mergeWithSources(collection, sources);
+}
+
+function mergeWith$1(merger, collection) {
+  var sources = [], len = arguments.length - 2;
+  while ( len-- > 0 ) sources[ len ] = arguments[ len + 2 ];
+
+  return mergeWithSources(collection, sources, merger);
+}
+
+function mergeDeep(collection) {
+  var sources = [], len = arguments.length - 1;
+  while ( len-- > 0 ) sources[ len ] = arguments[ len + 1 ];
+
+  return mergeDeepWithSources(collection, sources);
+}
+
+function mergeDeepWith(merger, collection) {
+  var sources = [], len = arguments.length - 2;
+  while ( len-- > 0 ) sources[ len ] = arguments[ len + 2 ];
+
+  return mergeDeepWithSources(collection, sources, merger);
+}
+
+function mergeDeepWithSources(collection, sources, merger) {
+  return mergeWithSources(collection, sources, deepMergerWith(merger));
+}
+
+function mergeWithSources(collection, sources, merger) {
+  if (!isDataStructure(collection)) {
+    throw new TypeError(
+      'Cannot merge into non-data-structure value: ' + collection
+    );
+  }
+  if (isImmutable(collection)) {
+    return typeof merger === 'function' && collection.mergeWith
+      ? collection.mergeWith.apply(collection, [ merger ].concat( sources ))
+      : collection.merge
+        ? collection.merge.apply(collection, sources)
+        : collection.concat.apply(collection, sources);
+  }
+  var isArray = Array.isArray(collection);
+  var merged = collection;
+  var Collection$$1 = isArray ? IndexedCollection : KeyedCollection;
+  var mergeItem = isArray
+    ? function (value) {
+        // Copy on write
+        if (merged === collection) {
+          merged = shallowCopy(merged);
+        }
+        merged.push(value);
+      }
+    : function (value, key) {
+        var hasVal = hasOwnProperty.call(merged, key);
+        var nextVal =
+          hasVal && merger ? merger(merged[key], value, key) : value;
+        if (!hasVal || nextVal !== merged[key]) {
+          // Copy on write
+          if (merged === collection) {
+            merged = shallowCopy(merged);
+          }
+          merged[key] = nextVal;
+        }
+      };
+  for (var i = 0; i < sources.length; i++) {
+    Collection$$1(sources[i]).forEach(mergeItem);
+  }
+  return merged;
+}
+
+function deepMergerWith(merger) {
+  function deepMerger(oldValue, newValue, key) {
+    return isDataStructure(oldValue) && isDataStructure(newValue)
+      ? mergeWithSources(oldValue, [newValue], deepMerger)
+      : merger
+        ? merger(oldValue, newValue, key)
+        : newValue;
+  }
+  return deepMerger;
+}
+
+function mergeDeep$1() {
+  var iters = [], len = arguments.length;
+  while ( len-- ) iters[ len ] = arguments[ len ];
+
+  return mergeDeepWithSources(this, iters);
+}
+
+function mergeDeepWith$1(merger) {
+  var iters = [], len = arguments.length - 1;
+  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
+
+  return mergeDeepWithSources(this, iters, merger);
+}
+
+function mergeIn(keyPath) {
+  var iters = [], len = arguments.length - 1;
+  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
+
+  return updateIn(this, keyPath, emptyMap(), function (m) { return mergeWithSources(m, iters); });
+}
+
+function mergeDeepIn(keyPath) {
+  var iters = [], len = arguments.length - 1;
+  while ( len-- > 0 ) iters[ len ] = arguments[ len + 1 ];
+
+  return updateIn(this, keyPath, emptyMap(), function (m) { return mergeDeepWithSources(m, iters); }
+  );
+}
+
+function withMutations(fn) {
+  var mutable = this.asMutable();
+  fn(mutable);
+  return mutable.wasAltered() ? mutable.__ensureOwner(this.__ownerID) : this;
+}
+
+function asMutable() {
+  return this.__ownerID ? this : this.__ensureOwner(new OwnerID());
+}
+
+function asImmutable() {
+  return this.__ensureOwner();
+}
+
+function wasAltered() {
+  return this.__altered;
+}
+
+var Map = /*@__PURE__*/(function (KeyedCollection$$1) {
+  function Map(value) {
+    return value === null || value === undefined
+      ? emptyMap()
+      : isMap(value) && !isOrdered(value)
+        ? value
+        : emptyMap().withMutations(function (map) {
+            var iter = KeyedCollection$$1(value);
+            assertNotInfinite(iter.size);
+            iter.forEach(function (v, k) { return map.set(k, v); });
+          });
+  }
+
+  if ( KeyedCollection$$1 ) Map.__proto__ = KeyedCollection$$1;
+  Map.prototype = Object.create( KeyedCollection$$1 && KeyedCollection$$1.prototype );
+  Map.prototype.constructor = Map;
+
+  Map.of = function of () {
+    var keyValues = [], len = arguments.length;
+    while ( len-- ) keyValues[ len ] = arguments[ len ];
+
+    return emptyMap().withMutations(function (map) {
+      for (var i = 0; i < keyValues.length; i += 2) {
+        if (i + 1 >= keyValues.length) {
+          throw new Error('Missing value for key: ' + keyValues[i]);
+        }
+        map.set(keyValues[i], keyValues[i + 1]);
+      }
+    });
+  };
+
+  Map.prototype.toString = function toString () {
+    return this.__toString('Map {', '}');
+  };
+
+  // @pragma Access
+
+  Map.prototype.get = function get (k, notSetValue) {
+    return this._root
+      ? this._root.get(0, undefined, k, notSetValue)
+      : notSetValue;
+  };
+
+  // @pragma Modification
+
+  Map.prototype.set = function set (k, v) {
+    return updateMap(this, k, v);
+  };
+
+  Map.prototype.remove = function remove (k) {
+    return updateMap(this, k, NOT_SET);
+  };
+
+  Map.prototype.deleteAll = function deleteAll (keys) {
+    var collection = Collection(keys);
+
+    if (collection.size === 0) {
+      return this;
+    }
+
+    return this.withMutations(function (map) {
+      collection.forEach(function (key) { return map.remove(key); });
+    });
+  };
+
+  Map.prototype.clear = function clear () {
+    if (this.size === 0) {
+      return this;
+    }
+    if (this.__ownerID) {
+      this.size = 0;
+      this._root = null;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return emptyMap();
+  };
+
+  // @pragma Composition
+
+  Map.prototype.sort = function sort (comparator) {
+    // Late binding
+    return OrderedMap(sortFactory(this, comparator));
+  };
+
+  Map.prototype.sortBy = function sortBy (mapper, comparator) {
+    // Late binding
+    return OrderedMap(sortFactory(this, comparator, mapper));
+  };
+
+  Map.prototype.map = function map (mapper, context) {
+    return this.withMutations(function (map) {
+      map.forEach(function (value, key) {
+        map.set(key, mapper.call(context, value, key, map));
+      });
+    });
+  };
+
+  // @pragma Mutability
+
+  Map.prototype.__iterator = function __iterator (type, reverse) {
+    return new MapIterator(this, type, reverse);
+  };
+
+  Map.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    var iterations = 0;
+    this._root &&
+      this._root.iterate(function (entry) {
+        iterations++;
+        return fn(entry[1], entry[0], this$1);
+      }, reverse);
+    return iterations;
+  };
+
+  Map.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    if (!ownerID) {
+      if (this.size === 0) {
+        return emptyMap();
+      }
+      this.__ownerID = ownerID;
+      this.__altered = false;
+      return this;
+    }
+    return makeMap(this.size, this._root, ownerID, this.__hash);
+  };
+
+  return Map;
+}(KeyedCollection));
+
+Map.isMap = isMap;
+
+var MapPrototype = Map.prototype;
+MapPrototype[IS_MAP_SYMBOL] = true;
+MapPrototype[DELETE] = MapPrototype.remove;
+MapPrototype.removeAll = MapPrototype.deleteAll;
+MapPrototype.setIn = setIn$1;
+MapPrototype.removeIn = MapPrototype.deleteIn = deleteIn;
+MapPrototype.update = update$1;
+MapPrototype.updateIn = updateIn$1;
+MapPrototype.merge = MapPrototype.concat = merge;
+MapPrototype.mergeWith = mergeWith;
+MapPrototype.mergeDeep = mergeDeep$1;
+MapPrototype.mergeDeepWith = mergeDeepWith$1;
+MapPrototype.mergeIn = mergeIn;
+MapPrototype.mergeDeepIn = mergeDeepIn;
+MapPrototype.withMutations = withMutations;
+MapPrototype.wasAltered = wasAltered;
+MapPrototype.asImmutable = asImmutable;
+MapPrototype['@@transducer/init'] = MapPrototype.asMutable = asMutable;
+MapPrototype['@@transducer/step'] = function(result, arr) {
+  return result.set(arr[0], arr[1]);
+};
+MapPrototype['@@transducer/result'] = function(obj) {
+  return obj.asImmutable();
+};
+
+// #pragma Trie Nodes
+
+var ArrayMapNode = function ArrayMapNode(ownerID, entries) {
+  this.ownerID = ownerID;
+  this.entries = entries;
+};
+
+ArrayMapNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  var entries = this.entries;
+  for (var ii = 0, len = entries.length; ii < len; ii++) {
+    if (is(key, entries[ii][0])) {
+      return entries[ii][1];
+    }
+  }
+  return notSetValue;
+};
+
+ArrayMapNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  var removed = value === NOT_SET;
+
+  var entries = this.entries;
+  var idx = 0;
+  var len = entries.length;
+  for (; idx < len; idx++) {
+    if (is(key, entries[idx][0])) {
+      break;
+    }
+  }
+  var exists = idx < len;
+
+  if (exists ? entries[idx][1] === value : removed) {
+    return this;
+  }
+
+  SetRef(didAlter);
+  (removed || !exists) && SetRef(didChangeSize);
+
+  if (removed && entries.length === 1) {
+    return; // undefined
+  }
+
+  if (!exists && !removed && entries.length >= MAX_ARRAY_MAP_SIZE) {
+    return createNodes(ownerID, entries, key, value);
+  }
+
+  var isEditable = ownerID && ownerID === this.ownerID;
+  var newEntries = isEditable ? entries : arrCopy(entries);
+
+  if (exists) {
+    if (removed) {
+      idx === len - 1
+        ? newEntries.pop()
+        : (newEntries[idx] = newEntries.pop());
+    } else {
+      newEntries[idx] = [key, value];
+    }
+  } else {
+    newEntries.push([key, value]);
+  }
+
+  if (isEditable) {
+    this.entries = newEntries;
+    return this;
+  }
+
+  return new ArrayMapNode(ownerID, newEntries);
+};
+
+var BitmapIndexedNode = function BitmapIndexedNode(ownerID, bitmap, nodes) {
+  this.ownerID = ownerID;
+  this.bitmap = bitmap;
+  this.nodes = nodes;
+};
+
+BitmapIndexedNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+  var bit = 1 << ((shift === 0 ? keyHash : keyHash >>> shift) & MASK);
+  var bitmap = this.bitmap;
+  return (bitmap & bit) === 0
+    ? notSetValue
+    : this.nodes[popCount(bitmap & (bit - 1))].get(
+        shift + SHIFT,
+        keyHash,
+        key,
+        notSetValue
+      );
+};
+
+BitmapIndexedNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+  var keyHashFrag = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
+  var bit = 1 << keyHashFrag;
+  var bitmap = this.bitmap;
+  var exists = (bitmap & bit) !== 0;
+
+  if (!exists && value === NOT_SET) {
+    return this;
+  }
+
+  var idx = popCount(bitmap & (bit - 1));
+  var nodes = this.nodes;
+  var node = exists ? nodes[idx] : undefined;
+  var newNode = updateNode(
+    node,
+    ownerID,
+    shift + SHIFT,
+    keyHash,
+    key,
+    value,
+    didChangeSize,
+    didAlter
+  );
+
+  if (newNode === node) {
+    return this;
+  }
+
+  if (!exists && newNode && nodes.length >= MAX_BITMAP_INDEXED_SIZE) {
+    return expandNodes(ownerID, nodes, bitmap, keyHashFrag, newNode);
+  }
+
+  if (
+    exists &&
+    !newNode &&
+    nodes.length === 2 &&
+    isLeafNode(nodes[idx ^ 1])
+  ) {
+    return nodes[idx ^ 1];
+  }
+
+  if (exists && newNode && nodes.length === 1 && isLeafNode(newNode)) {
+    return newNode;
+  }
+
+  var isEditable = ownerID && ownerID === this.ownerID;
+  var newBitmap = exists ? (newNode ? bitmap : bitmap ^ bit) : bitmap | bit;
+  var newNodes = exists
+    ? newNode
+      ? setAt(nodes, idx, newNode, isEditable)
+      : spliceOut(nodes, idx, isEditable)
+    : spliceIn(nodes, idx, newNode, isEditable);
+
+  if (isEditable) {
+    this.bitmap = newBitmap;
+    this.nodes = newNodes;
+    return this;
+  }
+
+  return new BitmapIndexedNode(ownerID, newBitmap, newNodes);
+};
+
+var HashArrayMapNode = function HashArrayMapNode(ownerID, count, nodes) {
+  this.ownerID = ownerID;
+  this.count = count;
+  this.nodes = nodes;
+};
+
+HashArrayMapNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+  var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
+  var node = this.nodes[idx];
+  return node
+    ? node.get(shift + SHIFT, keyHash, key, notSetValue)
+    : notSetValue;
+};
+
+HashArrayMapNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+  var idx = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
+  var removed = value === NOT_SET;
+  var nodes = this.nodes;
+  var node = nodes[idx];
+
+  if (removed && !node) {
+    return this;
+  }
+
+  var newNode = updateNode(
+    node,
+    ownerID,
+    shift + SHIFT,
+    keyHash,
+    key,
+    value,
+    didChangeSize,
+    didAlter
+  );
+  if (newNode === node) {
+    return this;
+  }
+
+  var newCount = this.count;
+  if (!node) {
+    newCount++;
+  } else if (!newNode) {
+    newCount--;
+    if (newCount < MIN_HASH_ARRAY_MAP_SIZE) {
+      return packNodes(ownerID, nodes, newCount, idx);
+    }
+  }
+
+  var isEditable = ownerID && ownerID === this.ownerID;
+  var newNodes = setAt(nodes, idx, newNode, isEditable);
+
+  if (isEditable) {
+    this.count = newCount;
+    this.nodes = newNodes;
+    return this;
+  }
+
+  return new HashArrayMapNode(ownerID, newCount, newNodes);
+};
+
+var HashCollisionNode = function HashCollisionNode(ownerID, keyHash, entries) {
+  this.ownerID = ownerID;
+  this.keyHash = keyHash;
+  this.entries = entries;
+};
+
+HashCollisionNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  var entries = this.entries;
+  for (var ii = 0, len = entries.length; ii < len; ii++) {
+    if (is(key, entries[ii][0])) {
+      return entries[ii][1];
+    }
+  }
+  return notSetValue;
+};
+
+HashCollisionNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  if (keyHash === undefined) {
+    keyHash = hash(key);
+  }
+
+  var removed = value === NOT_SET;
+
+  if (keyHash !== this.keyHash) {
+    if (removed) {
+      return this;
+    }
+    SetRef(didAlter);
+    SetRef(didChangeSize);
+    return mergeIntoNode(this, ownerID, shift, keyHash, [key, value]);
+  }
+
+  var entries = this.entries;
+  var idx = 0;
+  var len = entries.length;
+  for (; idx < len; idx++) {
+    if (is(key, entries[idx][0])) {
+      break;
+    }
+  }
+  var exists = idx < len;
+
+  if (exists ? entries[idx][1] === value : removed) {
+    return this;
+  }
+
+  SetRef(didAlter);
+  (removed || !exists) && SetRef(didChangeSize);
+
+  if (removed && len === 2) {
+    return new ValueNode(ownerID, this.keyHash, entries[idx ^ 1]);
+  }
+
+  var isEditable = ownerID && ownerID === this.ownerID;
+  var newEntries = isEditable ? entries : arrCopy(entries);
+
+  if (exists) {
+    if (removed) {
+      idx === len - 1
+        ? newEntries.pop()
+        : (newEntries[idx] = newEntries.pop());
+    } else {
+      newEntries[idx] = [key, value];
+    }
+  } else {
+    newEntries.push([key, value]);
+  }
+
+  if (isEditable) {
+    this.entries = newEntries;
+    return this;
+  }
+
+  return new HashCollisionNode(ownerID, this.keyHash, newEntries);
+};
+
+var ValueNode = function ValueNode(ownerID, keyHash, entry) {
+  this.ownerID = ownerID;
+  this.keyHash = keyHash;
+  this.entry = entry;
+};
+
+ValueNode.prototype.get = function get (shift, keyHash, key, notSetValue) {
+  return is(key, this.entry[0]) ? this.entry[1] : notSetValue;
+};
+
+ValueNode.prototype.update = function update (ownerID, shift, keyHash, key, value, didChangeSize, didAlter) {
+  var removed = value === NOT_SET;
+  var keyMatch = is(key, this.entry[0]);
+  if (keyMatch ? value === this.entry[1] : removed) {
+    return this;
+  }
+
+  SetRef(didAlter);
+
+  if (removed) {
+    SetRef(didChangeSize);
+    return; // undefined
+  }
+
+  if (keyMatch) {
+    if (ownerID && ownerID === this.ownerID) {
+      this.entry[1] = value;
+      return this;
+    }
+    return new ValueNode(ownerID, this.keyHash, [key, value]);
+  }
+
+  SetRef(didChangeSize);
+  return mergeIntoNode(this, ownerID, shift, hash(key), [key, value]);
+};
+
+// #pragma Iterators
+
+ArrayMapNode.prototype.iterate = HashCollisionNode.prototype.iterate = function(
+  fn,
+  reverse
+) {
+  var entries = this.entries;
+  for (var ii = 0, maxIndex = entries.length - 1; ii <= maxIndex; ii++) {
+    if (fn(entries[reverse ? maxIndex - ii : ii]) === false) {
+      return false;
+    }
+  }
+};
+
+BitmapIndexedNode.prototype.iterate = HashArrayMapNode.prototype.iterate = function(
+  fn,
+  reverse
+) {
+  var nodes = this.nodes;
+  for (var ii = 0, maxIndex = nodes.length - 1; ii <= maxIndex; ii++) {
+    var node = nodes[reverse ? maxIndex - ii : ii];
+    if (node && node.iterate(fn, reverse) === false) {
+      return false;
+    }
+  }
+};
+
+// eslint-disable-next-line no-unused-vars
+ValueNode.prototype.iterate = function(fn, reverse) {
+  return fn(this.entry);
+};
+
+var MapIterator = /*@__PURE__*/(function (Iterator$$1) {
+  function MapIterator(map, type, reverse) {
+    this._type = type;
+    this._reverse = reverse;
+    this._stack = map._root && mapIteratorFrame(map._root);
+  }
+
+  if ( Iterator$$1 ) MapIterator.__proto__ = Iterator$$1;
+  MapIterator.prototype = Object.create( Iterator$$1 && Iterator$$1.prototype );
+  MapIterator.prototype.constructor = MapIterator;
+
+  MapIterator.prototype.next = function next () {
+    var type = this._type;
+    var stack = this._stack;
+    while (stack) {
+      var node = stack.node;
+      var index = stack.index++;
+      var maxIndex = (void 0);
+      if (node.entry) {
+        if (index === 0) {
+          return mapIteratorValue(type, node.entry);
+        }
+      } else if (node.entries) {
+        maxIndex = node.entries.length - 1;
+        if (index <= maxIndex) {
+          return mapIteratorValue(
+            type,
+            node.entries[this._reverse ? maxIndex - index : index]
+          );
+        }
+      } else {
+        maxIndex = node.nodes.length - 1;
+        if (index <= maxIndex) {
+          var subNode = node.nodes[this._reverse ? maxIndex - index : index];
+          if (subNode) {
+            if (subNode.entry) {
+              return mapIteratorValue(type, subNode.entry);
+            }
+            stack = this._stack = mapIteratorFrame(subNode, stack);
+          }
+          continue;
+        }
+      }
+      stack = this._stack = this._stack.__prev;
+    }
+    return iteratorDone();
+  };
+
+  return MapIterator;
+}(Iterator));
+
+function mapIteratorValue(type, entry) {
+  return iteratorValue(type, entry[0], entry[1]);
+}
+
+function mapIteratorFrame(node, prev) {
+  return {
+    node: node,
+    index: 0,
+    __prev: prev,
+  };
+}
+
+function makeMap(size, root, ownerID, hash$$1) {
+  var map = Object.create(MapPrototype);
+  map.size = size;
+  map._root = root;
+  map.__ownerID = ownerID;
+  map.__hash = hash$$1;
+  map.__altered = false;
+  return map;
+}
+
+var EMPTY_MAP;
+function emptyMap() {
+  return EMPTY_MAP || (EMPTY_MAP = makeMap(0));
+}
+
+function updateMap(map, k, v) {
+  var newRoot;
+  var newSize;
+  if (!map._root) {
+    if (v === NOT_SET) {
+      return map;
+    }
+    newSize = 1;
+    newRoot = new ArrayMapNode(map.__ownerID, [[k, v]]);
+  } else {
+    var didChangeSize = MakeRef();
+    var didAlter = MakeRef();
+    newRoot = updateNode(
+      map._root,
+      map.__ownerID,
+      0,
+      undefined,
+      k,
+      v,
+      didChangeSize,
+      didAlter
+    );
+    if (!didAlter.value) {
+      return map;
+    }
+    newSize = map.size + (didChangeSize.value ? (v === NOT_SET ? -1 : 1) : 0);
+  }
+  if (map.__ownerID) {
+    map.size = newSize;
+    map._root = newRoot;
+    map.__hash = undefined;
+    map.__altered = true;
+    return map;
+  }
+  return newRoot ? makeMap(newSize, newRoot) : emptyMap();
+}
+
+function updateNode(
+  node,
+  ownerID,
+  shift,
+  keyHash,
+  key,
+  value,
+  didChangeSize,
+  didAlter
+) {
+  if (!node) {
+    if (value === NOT_SET) {
+      return node;
+    }
+    SetRef(didAlter);
+    SetRef(didChangeSize);
+    return new ValueNode(ownerID, keyHash, [key, value]);
+  }
+  return node.update(
+    ownerID,
+    shift,
+    keyHash,
+    key,
+    value,
+    didChangeSize,
+    didAlter
+  );
+}
+
+function isLeafNode(node) {
+  return (
+    node.constructor === ValueNode || node.constructor === HashCollisionNode
+  );
+}
+
+function mergeIntoNode(node, ownerID, shift, keyHash, entry) {
+  if (node.keyHash === keyHash) {
+    return new HashCollisionNode(ownerID, keyHash, [node.entry, entry]);
+  }
+
+  var idx1 = (shift === 0 ? node.keyHash : node.keyHash >>> shift) & MASK;
+  var idx2 = (shift === 0 ? keyHash : keyHash >>> shift) & MASK;
+
+  var newNode;
+  var nodes =
+    idx1 === idx2
+      ? [mergeIntoNode(node, ownerID, shift + SHIFT, keyHash, entry)]
+      : ((newNode = new ValueNode(ownerID, keyHash, entry)),
+        idx1 < idx2 ? [node, newNode] : [newNode, node]);
+
+  return new BitmapIndexedNode(ownerID, (1 << idx1) | (1 << idx2), nodes);
+}
+
+function createNodes(ownerID, entries, key, value) {
+  if (!ownerID) {
+    ownerID = new OwnerID();
+  }
+  var node = new ValueNode(ownerID, hash(key), [key, value]);
+  for (var ii = 0; ii < entries.length; ii++) {
+    var entry = entries[ii];
+    node = node.update(ownerID, 0, undefined, entry[0], entry[1]);
+  }
+  return node;
+}
+
+function packNodes(ownerID, nodes, count, excluding) {
+  var bitmap = 0;
+  var packedII = 0;
+  var packedNodes = new Array(count);
+  for (var ii = 0, bit = 1, len = nodes.length; ii < len; ii++, bit <<= 1) {
+    var node = nodes[ii];
+    if (node !== undefined && ii !== excluding) {
+      bitmap |= bit;
+      packedNodes[packedII++] = node;
+    }
+  }
+  return new BitmapIndexedNode(ownerID, bitmap, packedNodes);
+}
+
+function expandNodes(ownerID, nodes, bitmap, including, node) {
+  var count = 0;
+  var expandedNodes = new Array(SIZE);
+  for (var ii = 0; bitmap !== 0; ii++, bitmap >>>= 1) {
+    expandedNodes[ii] = bitmap & 1 ? nodes[count++] : undefined;
+  }
+  expandedNodes[including] = node;
+  return new HashArrayMapNode(ownerID, count + 1, expandedNodes);
+}
+
+function popCount(x) {
+  x -= (x >> 1) & 0x55555555;
+  x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
+  x = (x + (x >> 4)) & 0x0f0f0f0f;
+  x += x >> 8;
+  x += x >> 16;
+  return x & 0x7f;
+}
+
+function setAt(array, idx, val, canEdit) {
+  var newArray = canEdit ? array : arrCopy(array);
+  newArray[idx] = val;
+  return newArray;
+}
+
+function spliceIn(array, idx, val, canEdit) {
+  var newLen = array.length + 1;
+  if (canEdit && idx + 1 === newLen) {
+    array[idx] = val;
+    return array;
+  }
+  var newArray = new Array(newLen);
+  var after = 0;
+  for (var ii = 0; ii < newLen; ii++) {
+    if (ii === idx) {
+      newArray[ii] = val;
+      after = -1;
+    } else {
+      newArray[ii] = array[ii + after];
+    }
+  }
+  return newArray;
+}
+
+function spliceOut(array, idx, canEdit) {
+  var newLen = array.length - 1;
+  if (canEdit && idx === newLen) {
+    array.pop();
+    return array;
+  }
+  var newArray = new Array(newLen);
+  var after = 0;
+  for (var ii = 0; ii < newLen; ii++) {
+    if (ii === idx) {
+      after = 1;
+    }
+    newArray[ii] = array[ii + after];
+  }
+  return newArray;
+}
+
+var MAX_ARRAY_MAP_SIZE = SIZE / 4;
+var MAX_BITMAP_INDEXED_SIZE = SIZE / 2;
+var MIN_HASH_ARRAY_MAP_SIZE = SIZE / 4;
+
+var IS_LIST_SYMBOL = '@@__IMMUTABLE_LIST__@@';
+
+function isList(maybeList) {
+  return Boolean(maybeList && maybeList[IS_LIST_SYMBOL]);
+}
+
+var List = /*@__PURE__*/(function (IndexedCollection$$1) {
+  function List(value) {
+    var empty = emptyList();
+    if (value === null || value === undefined) {
+      return empty;
+    }
+    if (isList(value)) {
+      return value;
+    }
+    var iter = IndexedCollection$$1(value);
+    var size = iter.size;
+    if (size === 0) {
+      return empty;
+    }
+    assertNotInfinite(size);
+    if (size > 0 && size < SIZE) {
+      return makeList(0, size, SHIFT, null, new VNode(iter.toArray()));
+    }
+    return empty.withMutations(function (list) {
+      list.setSize(size);
+      iter.forEach(function (v, i) { return list.set(i, v); });
+    });
+  }
+
+  if ( IndexedCollection$$1 ) List.__proto__ = IndexedCollection$$1;
+  List.prototype = Object.create( IndexedCollection$$1 && IndexedCollection$$1.prototype );
+  List.prototype.constructor = List;
+
+  List.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  List.prototype.toString = function toString () {
+    return this.__toString('List [', ']');
+  };
+
+  // @pragma Access
+
+  List.prototype.get = function get (index, notSetValue) {
+    index = wrapIndex(this, index);
+    if (index >= 0 && index < this.size) {
+      index += this._origin;
+      var node = listNodeFor(this, index);
+      return node && node.array[index & MASK];
+    }
+    return notSetValue;
+  };
+
+  // @pragma Modification
+
+  List.prototype.set = function set (index, value) {
+    return updateList(this, index, value);
+  };
+
+  List.prototype.remove = function remove (index) {
+    return !this.has(index)
+      ? this
+      : index === 0
+        ? this.shift()
+        : index === this.size - 1
+          ? this.pop()
+          : this.splice(index, 1);
+  };
+
+  List.prototype.insert = function insert (index, value) {
+    return this.splice(index, 0, value);
+  };
+
+  List.prototype.clear = function clear () {
+    if (this.size === 0) {
+      return this;
+    }
+    if (this.__ownerID) {
+      this.size = this._origin = this._capacity = 0;
+      this._level = SHIFT;
+      this._root = this._tail = null;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return emptyList();
+  };
+
+  List.prototype.push = function push (/*...values*/) {
+    var values = arguments;
+    var oldSize = this.size;
+    return this.withMutations(function (list) {
+      setListBounds(list, 0, oldSize + values.length);
+      for (var ii = 0; ii < values.length; ii++) {
+        list.set(oldSize + ii, values[ii]);
+      }
+    });
+  };
+
+  List.prototype.pop = function pop () {
+    return setListBounds(this, 0, -1);
+  };
+
+  List.prototype.unshift = function unshift (/*...values*/) {
+    var values = arguments;
+    return this.withMutations(function (list) {
+      setListBounds(list, -values.length);
+      for (var ii = 0; ii < values.length; ii++) {
+        list.set(ii, values[ii]);
+      }
+    });
+  };
+
+  List.prototype.shift = function shift () {
+    return setListBounds(this, 1);
+  };
+
+  // @pragma Composition
+
+  List.prototype.concat = function concat (/*...collections*/) {
+    var arguments$1 = arguments;
+
+    var seqs = [];
+    for (var i = 0; i < arguments.length; i++) {
+      var argument = arguments$1[i];
+      var seq = IndexedCollection$$1(
+        typeof argument !== 'string' && hasIterator(argument)
+          ? argument
+          : [argument]
+      );
+      if (seq.size !== 0) {
+        seqs.push(seq);
+      }
+    }
+    if (seqs.length === 0) {
+      return this;
+    }
+    if (this.size === 0 && !this.__ownerID && seqs.length === 1) {
+      return this.constructor(seqs[0]);
+    }
+    return this.withMutations(function (list) {
+      seqs.forEach(function (seq) { return seq.forEach(function (value) { return list.push(value); }); });
+    });
+  };
+
+  List.prototype.setSize = function setSize (size) {
+    return setListBounds(this, 0, size);
+  };
+
+  List.prototype.map = function map (mapper, context) {
+    var this$1 = this;
+
+    return this.withMutations(function (list) {
+      for (var i = 0; i < this$1.size; i++) {
+        list.set(i, mapper.call(context, list.get(i), i, list));
+      }
+    });
+  };
+
+  // @pragma Iteration
+
+  List.prototype.slice = function slice (begin, end) {
+    var size = this.size;
+    if (wholeSlice(begin, end, size)) {
+      return this;
+    }
+    return setListBounds(
+      this,
+      resolveBegin(begin, size),
+      resolveEnd(end, size)
+    );
+  };
+
+  List.prototype.__iterator = function __iterator (type, reverse) {
+    var index = reverse ? this.size : 0;
+    var values = iterateList(this, reverse);
+    return new Iterator(function () {
+      var value = values();
+      return value === DONE
+        ? iteratorDone()
+        : iteratorValue(type, reverse ? --index : index++, value);
+    });
+  };
+
+  List.prototype.__iterate = function __iterate (fn, reverse) {
+    var index = reverse ? this.size : 0;
+    var values = iterateList(this, reverse);
+    var value;
+    while ((value = values()) !== DONE) {
+      if (fn(value, reverse ? --index : index++, this) === false) {
+        break;
+      }
+    }
+    return index;
+  };
+
+  List.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    if (!ownerID) {
+      if (this.size === 0) {
+        return emptyList();
+      }
+      this.__ownerID = ownerID;
+      this.__altered = false;
+      return this;
+    }
+    return makeList(
+      this._origin,
+      this._capacity,
+      this._level,
+      this._root,
+      this._tail,
+      ownerID,
+      this.__hash
+    );
+  };
+
+  return List;
+}(IndexedCollection));
+
+List.isList = isList;
+
+var ListPrototype = List.prototype;
+ListPrototype[IS_LIST_SYMBOL] = true;
+ListPrototype[DELETE] = ListPrototype.remove;
+ListPrototype.merge = ListPrototype.concat;
+ListPrototype.setIn = setIn$1;
+ListPrototype.deleteIn = ListPrototype.removeIn = deleteIn;
+ListPrototype.update = update$1;
+ListPrototype.updateIn = updateIn$1;
+ListPrototype.mergeIn = mergeIn;
+ListPrototype.mergeDeepIn = mergeDeepIn;
+ListPrototype.withMutations = withMutations;
+ListPrototype.wasAltered = wasAltered;
+ListPrototype.asImmutable = asImmutable;
+ListPrototype['@@transducer/init'] = ListPrototype.asMutable = asMutable;
+ListPrototype['@@transducer/step'] = function(result, arr) {
+  return result.push(arr);
+};
+ListPrototype['@@transducer/result'] = function(obj) {
+  return obj.asImmutable();
+};
+
+var VNode = function VNode(array, ownerID) {
+  this.array = array;
+  this.ownerID = ownerID;
+};
+
+// TODO: seems like these methods are very similar
+
+VNode.prototype.removeBefore = function removeBefore (ownerID, level, index) {
+  if (index === level ? 1 << level : this.array.length === 0) {
+    return this;
+  }
+  var originIndex = (index >>> level) & MASK;
+  if (originIndex >= this.array.length) {
+    return new VNode([], ownerID);
+  }
+  var removingFirst = originIndex === 0;
+  var newChild;
+  if (level > 0) {
+    var oldChild = this.array[originIndex];
+    newChild =
+      oldChild && oldChild.removeBefore(ownerID, level - SHIFT, index);
+    if (newChild === oldChild && removingFirst) {
+      return this;
+    }
+  }
+  if (removingFirst && !newChild) {
+    return this;
+  }
+  var editable = editableVNode(this, ownerID);
+  if (!removingFirst) {
+    for (var ii = 0; ii < originIndex; ii++) {
+      editable.array[ii] = undefined;
+    }
+  }
+  if (newChild) {
+    editable.array[originIndex] = newChild;
+  }
+  return editable;
+};
+
+VNode.prototype.removeAfter = function removeAfter (ownerID, level, index) {
+  if (index === (level ? 1 << level : 0) || this.array.length === 0) {
+    return this;
+  }
+  var sizeIndex = ((index - 1) >>> level) & MASK;
+  if (sizeIndex >= this.array.length) {
+    return this;
+  }
+
+  var newChild;
+  if (level > 0) {
+    var oldChild = this.array[sizeIndex];
+    newChild =
+      oldChild && oldChild.removeAfter(ownerID, level - SHIFT, index);
+    if (newChild === oldChild && sizeIndex === this.array.length - 1) {
+      return this;
+    }
+  }
+
+  var editable = editableVNode(this, ownerID);
+  editable.array.splice(sizeIndex + 1);
+  if (newChild) {
+    editable.array[sizeIndex] = newChild;
+  }
+  return editable;
+};
+
+var DONE = {};
+
+function iterateList(list, reverse) {
+  var left = list._origin;
+  var right = list._capacity;
+  var tailPos = getTailOffset(right);
+  var tail = list._tail;
+
+  return iterateNodeOrLeaf(list._root, list._level, 0);
+
+  function iterateNodeOrLeaf(node, level, offset) {
+    return level === 0
+      ? iterateLeaf(node, offset)
+      : iterateNode(node, level, offset);
+  }
+
+  function iterateLeaf(node, offset) {
+    var array = offset === tailPos ? tail && tail.array : node && node.array;
+    var from = offset > left ? 0 : left - offset;
+    var to = right - offset;
+    if (to > SIZE) {
+      to = SIZE;
+    }
+    return function () {
+      if (from === to) {
+        return DONE;
+      }
+      var idx = reverse ? --to : from++;
+      return array && array[idx];
+    };
+  }
+
+  function iterateNode(node, level, offset) {
+    var values;
+    var array = node && node.array;
+    var from = offset > left ? 0 : (left - offset) >> level;
+    var to = ((right - offset) >> level) + 1;
+    if (to > SIZE) {
+      to = SIZE;
+    }
+    return function () {
+      while (true) {
+        if (values) {
+          var value = values();
+          if (value !== DONE) {
+            return value;
+          }
+          values = null;
+        }
+        if (from === to) {
+          return DONE;
+        }
+        var idx = reverse ? --to : from++;
+        values = iterateNodeOrLeaf(
+          array && array[idx],
+          level - SHIFT,
+          offset + (idx << level)
+        );
+      }
+    };
+  }
+}
+
+function makeList(origin, capacity, level, root, tail, ownerID, hash) {
+  var list = Object.create(ListPrototype);
+  list.size = capacity - origin;
+  list._origin = origin;
+  list._capacity = capacity;
+  list._level = level;
+  list._root = root;
+  list._tail = tail;
+  list.__ownerID = ownerID;
+  list.__hash = hash;
+  list.__altered = false;
+  return list;
+}
+
+var EMPTY_LIST;
+function emptyList() {
+  return EMPTY_LIST || (EMPTY_LIST = makeList(0, 0, SHIFT));
+}
+
+function updateList(list, index, value) {
+  index = wrapIndex(list, index);
+
+  if (index !== index) {
+    return list;
+  }
+
+  if (index >= list.size || index < 0) {
+    return list.withMutations(function (list) {
+      index < 0
+        ? setListBounds(list, index).set(0, value)
+        : setListBounds(list, 0, index + 1).set(index, value);
+    });
+  }
+
+  index += list._origin;
+
+  var newTail = list._tail;
+  var newRoot = list._root;
+  var didAlter = MakeRef();
+  if (index >= getTailOffset(list._capacity)) {
+    newTail = updateVNode(newTail, list.__ownerID, 0, index, value, didAlter);
+  } else {
+    newRoot = updateVNode(
+      newRoot,
+      list.__ownerID,
+      list._level,
+      index,
+      value,
+      didAlter
+    );
+  }
+
+  if (!didAlter.value) {
+    return list;
+  }
+
+  if (list.__ownerID) {
+    list._root = newRoot;
+    list._tail = newTail;
+    list.__hash = undefined;
+    list.__altered = true;
+    return list;
+  }
+  return makeList(list._origin, list._capacity, list._level, newRoot, newTail);
+}
+
+function updateVNode(node, ownerID, level, index, value, didAlter) {
+  var idx = (index >>> level) & MASK;
+  var nodeHas = node && idx < node.array.length;
+  if (!nodeHas && value === undefined) {
+    return node;
+  }
+
+  var newNode;
+
+  if (level > 0) {
+    var lowerNode = node && node.array[idx];
+    var newLowerNode = updateVNode(
+      lowerNode,
+      ownerID,
+      level - SHIFT,
+      index,
+      value,
+      didAlter
+    );
+    if (newLowerNode === lowerNode) {
+      return node;
+    }
+    newNode = editableVNode(node, ownerID);
+    newNode.array[idx] = newLowerNode;
+    return newNode;
+  }
+
+  if (nodeHas && node.array[idx] === value) {
+    return node;
+  }
+
+  if (didAlter) {
+    SetRef(didAlter);
+  }
+
+  newNode = editableVNode(node, ownerID);
+  if (value === undefined && idx === newNode.array.length - 1) {
+    newNode.array.pop();
+  } else {
+    newNode.array[idx] = value;
+  }
+  return newNode;
+}
+
+function editableVNode(node, ownerID) {
+  if (ownerID && node && ownerID === node.ownerID) {
+    return node;
+  }
+  return new VNode(node ? node.array.slice() : [], ownerID);
+}
+
+function listNodeFor(list, rawIndex) {
+  if (rawIndex >= getTailOffset(list._capacity)) {
+    return list._tail;
+  }
+  if (rawIndex < 1 << (list._level + SHIFT)) {
+    var node = list._root;
+    var level = list._level;
+    while (node && level > 0) {
+      node = node.array[(rawIndex >>> level) & MASK];
+      level -= SHIFT;
+    }
+    return node;
+  }
+}
+
+function setListBounds(list, begin, end) {
+  // Sanitize begin & end using this shorthand for ToInt32(argument)
+  // http://www.ecma-international.org/ecma-262/6.0/#sec-toint32
+  if (begin !== undefined) {
+    begin |= 0;
+  }
+  if (end !== undefined) {
+    end |= 0;
+  }
+  var owner = list.__ownerID || new OwnerID();
+  var oldOrigin = list._origin;
+  var oldCapacity = list._capacity;
+  var newOrigin = oldOrigin + begin;
+  var newCapacity =
+    end === undefined
+      ? oldCapacity
+      : end < 0
+        ? oldCapacity + end
+        : oldOrigin + end;
+  if (newOrigin === oldOrigin && newCapacity === oldCapacity) {
+    return list;
+  }
+
+  // If it's going to end after it starts, it's empty.
+  if (newOrigin >= newCapacity) {
+    return list.clear();
+  }
+
+  var newLevel = list._level;
+  var newRoot = list._root;
+
+  // New origin might need creating a higher root.
+  var offsetShift = 0;
+  while (newOrigin + offsetShift < 0) {
+    newRoot = new VNode(
+      newRoot && newRoot.array.length ? [undefined, newRoot] : [],
+      owner
+    );
+    newLevel += SHIFT;
+    offsetShift += 1 << newLevel;
+  }
+  if (offsetShift) {
+    newOrigin += offsetShift;
+    oldOrigin += offsetShift;
+    newCapacity += offsetShift;
+    oldCapacity += offsetShift;
+  }
+
+  var oldTailOffset = getTailOffset(oldCapacity);
+  var newTailOffset = getTailOffset(newCapacity);
+
+  // New size might need creating a higher root.
+  while (newTailOffset >= 1 << (newLevel + SHIFT)) {
+    newRoot = new VNode(
+      newRoot && newRoot.array.length ? [newRoot] : [],
+      owner
+    );
+    newLevel += SHIFT;
+  }
+
+  // Locate or create the new tail.
+  var oldTail = list._tail;
+  var newTail =
+    newTailOffset < oldTailOffset
+      ? listNodeFor(list, newCapacity - 1)
+      : newTailOffset > oldTailOffset
+        ? new VNode([], owner)
+        : oldTail;
+
+  // Merge Tail into tree.
+  if (
+    oldTail &&
+    newTailOffset > oldTailOffset &&
+    newOrigin < oldCapacity &&
+    oldTail.array.length
+  ) {
+    newRoot = editableVNode(newRoot, owner);
+    var node = newRoot;
+    for (var level = newLevel; level > SHIFT; level -= SHIFT) {
+      var idx = (oldTailOffset >>> level) & MASK;
+      node = node.array[idx] = editableVNode(node.array[idx], owner);
+    }
+    node.array[(oldTailOffset >>> SHIFT) & MASK] = oldTail;
+  }
+
+  // If the size has been reduced, there's a chance the tail needs to be trimmed.
+  if (newCapacity < oldCapacity) {
+    newTail = newTail && newTail.removeAfter(owner, 0, newCapacity);
+  }
+
+  // If the new origin is within the tail, then we do not need a root.
+  if (newOrigin >= newTailOffset) {
+    newOrigin -= newTailOffset;
+    newCapacity -= newTailOffset;
+    newLevel = SHIFT;
+    newRoot = null;
+    newTail = newTail && newTail.removeBefore(owner, 0, newOrigin);
+
+    // Otherwise, if the root has been trimmed, garbage collect.
+  } else if (newOrigin > oldOrigin || newTailOffset < oldTailOffset) {
+    offsetShift = 0;
+
+    // Identify the new top root node of the subtree of the old root.
+    while (newRoot) {
+      var beginIndex = (newOrigin >>> newLevel) & MASK;
+      if ((beginIndex !== newTailOffset >>> newLevel) & MASK) {
+        break;
+      }
+      if (beginIndex) {
+        offsetShift += (1 << newLevel) * beginIndex;
+      }
+      newLevel -= SHIFT;
+      newRoot = newRoot.array[beginIndex];
+    }
+
+    // Trim the new sides of the new root.
+    if (newRoot && newOrigin > oldOrigin) {
+      newRoot = newRoot.removeBefore(owner, newLevel, newOrigin - offsetShift);
+    }
+    if (newRoot && newTailOffset < oldTailOffset) {
+      newRoot = newRoot.removeAfter(
+        owner,
+        newLevel,
+        newTailOffset - offsetShift
+      );
+    }
+    if (offsetShift) {
+      newOrigin -= offsetShift;
+      newCapacity -= offsetShift;
+    }
+  }
+
+  if (list.__ownerID) {
+    list.size = newCapacity - newOrigin;
+    list._origin = newOrigin;
+    list._capacity = newCapacity;
+    list._level = newLevel;
+    list._root = newRoot;
+    list._tail = newTail;
+    list.__hash = undefined;
+    list.__altered = true;
+    return list;
+  }
+  return makeList(newOrigin, newCapacity, newLevel, newRoot, newTail);
+}
+
+function getTailOffset(size) {
+  return size < SIZE ? 0 : ((size - 1) >>> SHIFT) << SHIFT;
+}
+
+var OrderedMap = /*@__PURE__*/(function (Map$$1) {
+  function OrderedMap(value) {
+    return value === null || value === undefined
+      ? emptyOrderedMap()
+      : isOrderedMap(value)
+        ? value
+        : emptyOrderedMap().withMutations(function (map) {
+            var iter = KeyedCollection(value);
+            assertNotInfinite(iter.size);
+            iter.forEach(function (v, k) { return map.set(k, v); });
+          });
+  }
+
+  if ( Map$$1 ) OrderedMap.__proto__ = Map$$1;
+  OrderedMap.prototype = Object.create( Map$$1 && Map$$1.prototype );
+  OrderedMap.prototype.constructor = OrderedMap;
+
+  OrderedMap.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  OrderedMap.prototype.toString = function toString () {
+    return this.__toString('OrderedMap {', '}');
+  };
+
+  // @pragma Access
+
+  OrderedMap.prototype.get = function get (k, notSetValue) {
+    var index = this._map.get(k);
+    return index !== undefined ? this._list.get(index)[1] : notSetValue;
+  };
+
+  // @pragma Modification
+
+  OrderedMap.prototype.clear = function clear () {
+    if (this.size === 0) {
+      return this;
+    }
+    if (this.__ownerID) {
+      this.size = 0;
+      this._map.clear();
+      this._list.clear();
+      return this;
+    }
+    return emptyOrderedMap();
+  };
+
+  OrderedMap.prototype.set = function set (k, v) {
+    return updateOrderedMap(this, k, v);
+  };
+
+  OrderedMap.prototype.remove = function remove (k) {
+    return updateOrderedMap(this, k, NOT_SET);
+  };
+
+  OrderedMap.prototype.wasAltered = function wasAltered () {
+    return this._map.wasAltered() || this._list.wasAltered();
+  };
+
+  OrderedMap.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._list.__iterate(
+      function (entry) { return entry && fn(entry[1], entry[0], this$1); },
+      reverse
+    );
+  };
+
+  OrderedMap.prototype.__iterator = function __iterator (type, reverse) {
+    return this._list.fromEntrySeq().__iterator(type, reverse);
+  };
+
+  OrderedMap.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    var newMap = this._map.__ensureOwner(ownerID);
+    var newList = this._list.__ensureOwner(ownerID);
+    if (!ownerID) {
+      if (this.size === 0) {
+        return emptyOrderedMap();
+      }
+      this.__ownerID = ownerID;
+      this._map = newMap;
+      this._list = newList;
+      return this;
+    }
+    return makeOrderedMap(newMap, newList, ownerID, this.__hash);
+  };
+
+  return OrderedMap;
+}(Map));
+
+OrderedMap.isOrderedMap = isOrderedMap;
+
+OrderedMap.prototype[IS_ORDERED_SYMBOL] = true;
+OrderedMap.prototype[DELETE] = OrderedMap.prototype.remove;
+
+function makeOrderedMap(map, list, ownerID, hash) {
+  var omap = Object.create(OrderedMap.prototype);
+  omap.size = map ? map.size : 0;
+  omap._map = map;
+  omap._list = list;
+  omap.__ownerID = ownerID;
+  omap.__hash = hash;
+  return omap;
+}
+
+var EMPTY_ORDERED_MAP;
+function emptyOrderedMap() {
+  return (
+    EMPTY_ORDERED_MAP ||
+    (EMPTY_ORDERED_MAP = makeOrderedMap(emptyMap(), emptyList()))
+  );
+}
+
+function updateOrderedMap(omap, k, v) {
+  var map = omap._map;
+  var list = omap._list;
+  var i = map.get(k);
+  var has = i !== undefined;
+  var newMap;
+  var newList;
+  if (v === NOT_SET) {
+    // removed
+    if (!has) {
+      return omap;
+    }
+    if (list.size >= SIZE && list.size >= map.size * 2) {
+      newList = list.filter(function (entry, idx) { return entry !== undefined && i !== idx; });
+      newMap = newList
+        .toKeyedSeq()
+        .map(function (entry) { return entry[0]; })
+        .flip()
+        .toMap();
+      if (omap.__ownerID) {
+        newMap.__ownerID = newList.__ownerID = omap.__ownerID;
+      }
+    } else {
+      newMap = map.remove(k);
+      newList = i === list.size - 1 ? list.pop() : list.set(i, undefined);
+    }
+  } else if (has) {
+    if (v === list.get(i)[1]) {
+      return omap;
+    }
+    newMap = map;
+    newList = list.set(i, [k, v]);
+  } else {
+    newMap = map.set(k, list.size);
+    newList = list.set(list.size, [k, v]);
+  }
+  if (omap.__ownerID) {
+    omap.size = newMap.size;
+    omap._map = newMap;
+    omap._list = newList;
+    omap.__hash = undefined;
+    return omap;
+  }
+  return makeOrderedMap(newMap, newList);
+}
+
+var IS_STACK_SYMBOL = '@@__IMMUTABLE_STACK__@@';
+
+function isStack(maybeStack) {
+  return Boolean(maybeStack && maybeStack[IS_STACK_SYMBOL]);
+}
+
+var Stack = /*@__PURE__*/(function (IndexedCollection$$1) {
+  function Stack(value) {
+    return value === null || value === undefined
+      ? emptyStack()
+      : isStack(value)
+        ? value
+        : emptyStack().pushAll(value);
+  }
+
+  if ( IndexedCollection$$1 ) Stack.__proto__ = IndexedCollection$$1;
+  Stack.prototype = Object.create( IndexedCollection$$1 && IndexedCollection$$1.prototype );
+  Stack.prototype.constructor = Stack;
+
+  Stack.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  Stack.prototype.toString = function toString () {
+    return this.__toString('Stack [', ']');
+  };
+
+  // @pragma Access
+
+  Stack.prototype.get = function get (index, notSetValue) {
+    var head = this._head;
+    index = wrapIndex(this, index);
+    while (head && index--) {
+      head = head.next;
+    }
+    return head ? head.value : notSetValue;
+  };
+
+  Stack.prototype.peek = function peek () {
+    return this._head && this._head.value;
+  };
+
+  // @pragma Modification
+
+  Stack.prototype.push = function push (/*...values*/) {
+    var arguments$1 = arguments;
+
+    if (arguments.length === 0) {
+      return this;
+    }
+    var newSize = this.size + arguments.length;
+    var head = this._head;
+    for (var ii = arguments.length - 1; ii >= 0; ii--) {
+      head = {
+        value: arguments$1[ii],
+        next: head,
+      };
+    }
+    if (this.__ownerID) {
+      this.size = newSize;
+      this._head = head;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return makeStack(newSize, head);
+  };
+
+  Stack.prototype.pushAll = function pushAll (iter) {
+    iter = IndexedCollection$$1(iter);
+    if (iter.size === 0) {
+      return this;
+    }
+    if (this.size === 0 && isStack(iter)) {
+      return iter;
+    }
+    assertNotInfinite(iter.size);
+    var newSize = this.size;
+    var head = this._head;
+    iter.__iterate(function (value) {
+      newSize++;
+      head = {
+        value: value,
+        next: head,
+      };
+    }, /* reverse */ true);
+    if (this.__ownerID) {
+      this.size = newSize;
+      this._head = head;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return makeStack(newSize, head);
+  };
+
+  Stack.prototype.pop = function pop () {
+    return this.slice(1);
+  };
+
+  Stack.prototype.clear = function clear () {
+    if (this.size === 0) {
+      return this;
+    }
+    if (this.__ownerID) {
+      this.size = 0;
+      this._head = undefined;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return emptyStack();
+  };
+
+  Stack.prototype.slice = function slice (begin, end) {
+    if (wholeSlice(begin, end, this.size)) {
+      return this;
+    }
+    var resolvedBegin = resolveBegin(begin, this.size);
+    var resolvedEnd = resolveEnd(end, this.size);
+    if (resolvedEnd !== this.size) {
+      // super.slice(begin, end);
+      return IndexedCollection$$1.prototype.slice.call(this, begin, end);
+    }
+    var newSize = this.size - resolvedBegin;
+    var head = this._head;
+    while (resolvedBegin--) {
+      head = head.next;
+    }
+    if (this.__ownerID) {
+      this.size = newSize;
+      this._head = head;
+      this.__hash = undefined;
+      this.__altered = true;
+      return this;
+    }
+    return makeStack(newSize, head);
+  };
+
+  // @pragma Mutability
+
+  Stack.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    if (!ownerID) {
+      if (this.size === 0) {
+        return emptyStack();
+      }
+      this.__ownerID = ownerID;
+      this.__altered = false;
+      return this;
+    }
+    return makeStack(this.size, this._head, ownerID, this.__hash);
+  };
+
+  // @pragma Iteration
+
+  Stack.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    if (reverse) {
+      return new ArraySeq(this.toArray()).__iterate(
+        function (v, k) { return fn(v, k, this$1); },
+        reverse
+      );
+    }
+    var iterations = 0;
+    var node = this._head;
+    while (node) {
+      if (fn(node.value, iterations++, this) === false) {
+        break;
+      }
+      node = node.next;
+    }
+    return iterations;
+  };
+
+  Stack.prototype.__iterator = function __iterator (type, reverse) {
+    if (reverse) {
+      return new ArraySeq(this.toArray()).__iterator(type, reverse);
+    }
+    var iterations = 0;
+    var node = this._head;
+    return new Iterator(function () {
+      if (node) {
+        var value = node.value;
+        node = node.next;
+        return iteratorValue(type, iterations++, value);
+      }
+      return iteratorDone();
+    });
+  };
+
+  return Stack;
+}(IndexedCollection));
+
+Stack.isStack = isStack;
+
+var StackPrototype = Stack.prototype;
+StackPrototype[IS_STACK_SYMBOL] = true;
+StackPrototype.shift = StackPrototype.pop;
+StackPrototype.unshift = StackPrototype.push;
+StackPrototype.unshiftAll = StackPrototype.pushAll;
+StackPrototype.withMutations = withMutations;
+StackPrototype.wasAltered = wasAltered;
+StackPrototype.asImmutable = asImmutable;
+StackPrototype['@@transducer/init'] = StackPrototype.asMutable = asMutable;
+StackPrototype['@@transducer/step'] = function(result, arr) {
+  return result.unshift(arr);
+};
+StackPrototype['@@transducer/result'] = function(obj) {
+  return obj.asImmutable();
+};
+
+function makeStack(size, head, ownerID, hash) {
+  var map = Object.create(StackPrototype);
+  map.size = size;
+  map._head = head;
+  map.__ownerID = ownerID;
+  map.__hash = hash;
+  map.__altered = false;
+  return map;
+}
+
+var EMPTY_STACK;
+function emptyStack() {
+  return EMPTY_STACK || (EMPTY_STACK = makeStack(0));
+}
+
+var IS_SET_SYMBOL = '@@__IMMUTABLE_SET__@@';
+
+function isSet(maybeSet) {
+  return Boolean(maybeSet && maybeSet[IS_SET_SYMBOL]);
+}
+
+function isOrderedSet(maybeOrderedSet) {
+  return isSet(maybeOrderedSet) && isOrdered(maybeOrderedSet);
+}
+
+function deepEqual(a, b) {
+  if (a === b) {
+    return true;
+  }
+
+  if (
+    !isCollection(b) ||
+    (a.size !== undefined && b.size !== undefined && a.size !== b.size) ||
+    (a.__hash !== undefined &&
+      b.__hash !== undefined &&
+      a.__hash !== b.__hash) ||
+    isKeyed(a) !== isKeyed(b) ||
+    isIndexed(a) !== isIndexed(b) ||
+    isOrdered(a) !== isOrdered(b)
+  ) {
+    return false;
+  }
+
+  if (a.size === 0 && b.size === 0) {
+    return true;
+  }
+
+  var notAssociative = !isAssociative(a);
+
+  if (isOrdered(a)) {
+    var entries = a.entries();
+    return (
+      b.every(function (v, k) {
+        var entry = entries.next().value;
+        return entry && is(entry[1], v) && (notAssociative || is(entry[0], k));
+      }) && entries.next().done
+    );
+  }
+
+  var flipped = false;
+
+  if (a.size === undefined) {
+    if (b.size === undefined) {
+      if (typeof a.cacheResult === 'function') {
+        a.cacheResult();
+      }
+    } else {
+      flipped = true;
+      var _ = a;
+      a = b;
+      b = _;
+    }
+  }
+
+  var allEqual = true;
+  var bSize = b.__iterate(function (v, k) {
+    if (
+      notAssociative
+        ? !a.has(v)
+        : flipped
+          ? !is(v, a.get(k, NOT_SET))
+          : !is(a.get(k, NOT_SET), v)
+    ) {
+      allEqual = false;
+      return false;
+    }
+  });
+
+  return allEqual && a.size === bSize;
+}
+
+/**
+ * Contributes additional methods to a constructor
+ */
+function mixin(ctor, methods) {
+  var keyCopier = function (key) {
+    ctor.prototype[key] = methods[key];
+  };
+  Object.keys(methods).forEach(keyCopier);
+  Object.getOwnPropertySymbols &&
+    Object.getOwnPropertySymbols(methods).forEach(keyCopier);
+  return ctor;
+}
+
+function toJS(value) {
+  if (!value || typeof value !== 'object') {
+    return value;
+  }
+  if (!isCollection(value)) {
+    if (!isDataStructure(value)) {
+      return value;
+    }
+    value = Seq(value);
+  }
+  if (isKeyed(value)) {
+    var result$1 = {};
+    value.__iterate(function (v, k) {
+      result$1[k] = toJS(v);
+    });
+    return result$1;
+  }
+  var result = [];
+  value.__iterate(function (v) {
+    result.push(toJS(v));
+  });
+  return result;
+}
+
+var Set = /*@__PURE__*/(function (SetCollection$$1) {
+  function Set(value) {
+    return value === null || value === undefined
+      ? emptySet()
+      : isSet(value) && !isOrdered(value)
+        ? value
+        : emptySet().withMutations(function (set) {
+            var iter = SetCollection$$1(value);
+            assertNotInfinite(iter.size);
+            iter.forEach(function (v) { return set.add(v); });
+          });
+  }
+
+  if ( SetCollection$$1 ) Set.__proto__ = SetCollection$$1;
+  Set.prototype = Object.create( SetCollection$$1 && SetCollection$$1.prototype );
+  Set.prototype.constructor = Set;
+
+  Set.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  Set.fromKeys = function fromKeys (value) {
+    return this(KeyedCollection(value).keySeq());
+  };
+
+  Set.intersect = function intersect (sets) {
+    sets = Collection(sets).toArray();
+    return sets.length
+      ? SetPrototype.intersect.apply(Set(sets.pop()), sets)
+      : emptySet();
+  };
+
+  Set.union = function union (sets) {
+    sets = Collection(sets).toArray();
+    return sets.length
+      ? SetPrototype.union.apply(Set(sets.pop()), sets)
+      : emptySet();
+  };
+
+  Set.prototype.toString = function toString () {
+    return this.__toString('Set {', '}');
+  };
+
+  // @pragma Access
+
+  Set.prototype.has = function has (value) {
+    return this._map.has(value);
+  };
+
+  // @pragma Modification
+
+  Set.prototype.add = function add (value) {
+    return updateSet(this, this._map.set(value, value));
+  };
+
+  Set.prototype.remove = function remove (value) {
+    return updateSet(this, this._map.remove(value));
+  };
+
+  Set.prototype.clear = function clear () {
+    return updateSet(this, this._map.clear());
+  };
+
+  // @pragma Composition
+
+  Set.prototype.map = function map (mapper, context) {
+    var this$1 = this;
+
+    var removes = [];
+    var adds = [];
+    this.forEach(function (value) {
+      var mapped = mapper.call(context, value, value, this$1);
+      if (mapped !== value) {
+        removes.push(value);
+        adds.push(mapped);
+      }
+    });
+    return this.withMutations(function (set) {
+      removes.forEach(function (value) { return set.remove(value); });
+      adds.forEach(function (value) { return set.add(value); });
+    });
+  };
+
+  Set.prototype.union = function union () {
+    var iters = [], len = arguments.length;
+    while ( len-- ) iters[ len ] = arguments[ len ];
+
+    iters = iters.filter(function (x) { return x.size !== 0; });
+    if (iters.length === 0) {
+      return this;
+    }
+    if (this.size === 0 && !this.__ownerID && iters.length === 1) {
+      return this.constructor(iters[0]);
+    }
+    return this.withMutations(function (set) {
+      for (var ii = 0; ii < iters.length; ii++) {
+        SetCollection$$1(iters[ii]).forEach(function (value) { return set.add(value); });
+      }
+    });
+  };
+
+  Set.prototype.intersect = function intersect () {
+    var iters = [], len = arguments.length;
+    while ( len-- ) iters[ len ] = arguments[ len ];
+
+    if (iters.length === 0) {
+      return this;
+    }
+    iters = iters.map(function (iter) { return SetCollection$$1(iter); });
+    var toRemove = [];
+    this.forEach(function (value) {
+      if (!iters.every(function (iter) { return iter.includes(value); })) {
+        toRemove.push(value);
+      }
+    });
+    return this.withMutations(function (set) {
+      toRemove.forEach(function (value) {
+        set.remove(value);
+      });
+    });
+  };
+
+  Set.prototype.subtract = function subtract () {
+    var iters = [], len = arguments.length;
+    while ( len-- ) iters[ len ] = arguments[ len ];
+
+    if (iters.length === 0) {
+      return this;
+    }
+    iters = iters.map(function (iter) { return SetCollection$$1(iter); });
+    var toRemove = [];
+    this.forEach(function (value) {
+      if (iters.some(function (iter) { return iter.includes(value); })) {
+        toRemove.push(value);
+      }
+    });
+    return this.withMutations(function (set) {
+      toRemove.forEach(function (value) {
+        set.remove(value);
+      });
+    });
+  };
+
+  Set.prototype.sort = function sort (comparator) {
+    // Late binding
+    return OrderedSet(sortFactory(this, comparator));
+  };
+
+  Set.prototype.sortBy = function sortBy (mapper, comparator) {
+    // Late binding
+    return OrderedSet(sortFactory(this, comparator, mapper));
+  };
+
+  Set.prototype.wasAltered = function wasAltered () {
+    return this._map.wasAltered();
+  };
+
+  Set.prototype.__iterate = function __iterate (fn, reverse) {
+    var this$1 = this;
+
+    return this._map.__iterate(function (k) { return fn(k, k, this$1); }, reverse);
+  };
+
+  Set.prototype.__iterator = function __iterator (type, reverse) {
+    return this._map.__iterator(type, reverse);
+  };
+
+  Set.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+    if (ownerID === this.__ownerID) {
+      return this;
+    }
+    var newMap = this._map.__ensureOwner(ownerID);
+    if (!ownerID) {
+      if (this.size === 0) {
+        return this.__empty();
+      }
+      this.__ownerID = ownerID;
+      this._map = newMap;
+      return this;
+    }
+    return this.__make(newMap, ownerID);
+  };
+
+  return Set;
+}(SetCollection));
+
+Set.isSet = isSet;
+
+var SetPrototype = Set.prototype;
+SetPrototype[IS_SET_SYMBOL] = true;
+SetPrototype[DELETE] = SetPrototype.remove;
+SetPrototype.merge = SetPrototype.concat = SetPrototype.union;
+SetPrototype.withMutations = withMutations;
+SetPrototype.asImmutable = asImmutable;
+SetPrototype['@@transducer/init'] = SetPrototype.asMutable = asMutable;
+SetPrototype['@@transducer/step'] = function(result, arr) {
+  return result.add(arr);
+};
+SetPrototype['@@transducer/result'] = function(obj) {
+  return obj.asImmutable();
+};
+
+SetPrototype.__empty = emptySet;
+SetPrototype.__make = makeSet;
+
+function updateSet(set, newMap) {
+  if (set.__ownerID) {
+    set.size = newMap.size;
+    set._map = newMap;
+    return set;
+  }
+  return newMap === set._map
+    ? set
+    : newMap.size === 0
+      ? set.__empty()
+      : set.__make(newMap);
+}
+
+function makeSet(map, ownerID) {
+  var set = Object.create(SetPrototype);
+  set.size = map ? map.size : 0;
+  set._map = map;
+  set.__ownerID = ownerID;
+  return set;
+}
+
+var EMPTY_SET;
+function emptySet() {
+  return EMPTY_SET || (EMPTY_SET = makeSet(emptyMap()));
+}
+
+/**
+ * Returns a lazy seq of nums from start (inclusive) to end
+ * (exclusive), by step, where start defaults to 0, step to 1, and end to
+ * infinity. When start is equal to end, returns empty list.
+ */
+var Range = /*@__PURE__*/(function (IndexedSeq$$1) {
+  function Range(start, end, step) {
+    if (!(this instanceof Range)) {
+      return new Range(start, end, step);
+    }
+    invariant(step !== 0, 'Cannot step a Range by 0');
+    start = start || 0;
+    if (end === undefined) {
+      end = Infinity;
+    }
+    step = step === undefined ? 1 : Math.abs(step);
+    if (end < start) {
+      step = -step;
+    }
+    this._start = start;
+    this._end = end;
+    this._step = step;
+    this.size = Math.max(0, Math.ceil((end - start) / step - 1) + 1);
+    if (this.size === 0) {
+      if (EMPTY_RANGE) {
+        return EMPTY_RANGE;
+      }
+      EMPTY_RANGE = this;
+    }
+  }
+
+  if ( IndexedSeq$$1 ) Range.__proto__ = IndexedSeq$$1;
+  Range.prototype = Object.create( IndexedSeq$$1 && IndexedSeq$$1.prototype );
+  Range.prototype.constructor = Range;
+
+  Range.prototype.toString = function toString () {
+    if (this.size === 0) {
+      return 'Range []';
+    }
+    return (
+      'Range [ ' +
+      this._start +
+      '...' +
+      this._end +
+      (this._step !== 1 ? ' by ' + this._step : '') +
+      ' ]'
+    );
+  };
+
+  Range.prototype.get = function get (index, notSetValue) {
+    return this.has(index)
+      ? this._start + wrapIndex(this, index) * this._step
+      : notSetValue;
+  };
+
+  Range.prototype.includes = function includes (searchValue) {
+    var possibleIndex = (searchValue - this._start) / this._step;
+    return (
+      possibleIndex >= 0 &&
+      possibleIndex < this.size &&
+      possibleIndex === Math.floor(possibleIndex)
+    );
+  };
+
+  Range.prototype.slice = function slice (begin, end) {
+    if (wholeSlice(begin, end, this.size)) {
+      return this;
+    }
+    begin = resolveBegin(begin, this.size);
+    end = resolveEnd(end, this.size);
+    if (end <= begin) {
+      return new Range(0, 0);
+    }
+    return new Range(
+      this.get(begin, this._end),
+      this.get(end, this._end),
+      this._step
+    );
+  };
+
+  Range.prototype.indexOf = function indexOf (searchValue) {
+    var offsetValue = searchValue - this._start;
+    if (offsetValue % this._step === 0) {
+      var index = offsetValue / this._step;
+      if (index >= 0 && index < this.size) {
+        return index;
+      }
+    }
+    return -1;
+  };
+
+  Range.prototype.lastIndexOf = function lastIndexOf (searchValue) {
+    return this.indexOf(searchValue);
+  };
+
+  Range.prototype.__iterate = function __iterate (fn, reverse) {
+    var size = this.size;
+    var step = this._step;
+    var value = reverse ? this._start + (size - 1) * step : this._start;
+    var i = 0;
+    while (i !== size) {
+      if (fn(value, reverse ? size - ++i : i++, this) === false) {
+        break;
+      }
+      value += reverse ? -step : step;
+    }
+    return i;
+  };
+
+  Range.prototype.__iterator = function __iterator (type, reverse) {
+    var size = this.size;
+    var step = this._step;
+    var value = reverse ? this._start + (size - 1) * step : this._start;
+    var i = 0;
+    return new Iterator(function () {
+      if (i === size) {
+        return iteratorDone();
+      }
+      var v = value;
+      value += reverse ? -step : step;
+      return iteratorValue(type, reverse ? size - ++i : i++, v);
+    });
+  };
+
+  Range.prototype.equals = function equals (other) {
+    return other instanceof Range
+      ? this._start === other._start &&
+          this._end === other._end &&
+          this._step === other._step
+      : deepEqual(this, other);
+  };
+
+  return Range;
+}(IndexedSeq));
+
+var EMPTY_RANGE;
+
+function getIn(collection, searchKeyPath, notSetValue) {
+  var keyPath = coerceKeyPath(searchKeyPath);
+  var i = 0;
+  while (i !== keyPath.length) {
+    collection = get(collection, keyPath[i++], NOT_SET);
+    if (collection === NOT_SET) {
+      return notSetValue;
+    }
+  }
+  return collection;
+}
+
+function getIn$1(searchKeyPath, notSetValue) {
+  return getIn(this, searchKeyPath, notSetValue);
+}
+
+function hasIn(collection, keyPath) {
+  return getIn(collection, keyPath, NOT_SET) !== NOT_SET;
+}
+
+function hasIn$1(searchKeyPath) {
+  return hasIn(this, searchKeyPath);
+}
+
+function toObject() {
+  assertNotInfinite(this.size);
+  var object = {};
+  this.__iterate(function (v, k) {
+    object[k] = v;
+  });
+  return object;
+}
+
+// Note: all of these methods are deprecated.
+Collection.isIterable = isCollection;
+Collection.isKeyed = isKeyed;
+Collection.isIndexed = isIndexed;
+Collection.isAssociative = isAssociative;
+Collection.isOrdered = isOrdered;
+
+Collection.Iterator = Iterator;
+
+mixin(Collection, {
+  // ### Conversion to other types
+
+  toArray: function toArray() {
+    assertNotInfinite(this.size);
+    var array = new Array(this.size || 0);
+    var useTuples = isKeyed(this);
+    var i = 0;
+    this.__iterate(function (v, k) {
+      // Keyed collections produce an array of tuples.
+      array[i++] = useTuples ? [k, v] : v;
+    });
+    return array;
+  },
+
+  toIndexedSeq: function toIndexedSeq() {
+    return new ToIndexedSequence(this);
+  },
+
+  toJS: function toJS$1() {
+    return toJS(this);
+  },
+
+  toKeyedSeq: function toKeyedSeq() {
+    return new ToKeyedSequence(this, true);
+  },
+
+  toMap: function toMap() {
+    // Use Late Binding here to solve the circular dependency.
+    return Map(this.toKeyedSeq());
+  },
+
+  toObject: toObject,
+
+  toOrderedMap: function toOrderedMap() {
+    // Use Late Binding here to solve the circular dependency.
+    return OrderedMap(this.toKeyedSeq());
+  },
+
+  toOrderedSet: function toOrderedSet() {
+    // Use Late Binding here to solve the circular dependency.
+    return OrderedSet(isKeyed(this) ? this.valueSeq() : this);
+  },
+
+  toSet: function toSet() {
+    // Use Late Binding here to solve the circular dependency.
+    return Set(isKeyed(this) ? this.valueSeq() : this);
+  },
+
+  toSetSeq: function toSetSeq() {
+    return new ToSetSequence(this);
+  },
+
+  toSeq: function toSeq() {
+    return isIndexed(this)
+      ? this.toIndexedSeq()
+      : isKeyed(this)
+        ? this.toKeyedSeq()
+        : this.toSetSeq();
+  },
+
+  toStack: function toStack() {
+    // Use Late Binding here to solve the circular dependency.
+    return Stack(isKeyed(this) ? this.valueSeq() : this);
+  },
+
+  toList: function toList() {
+    // Use Late Binding here to solve the circular dependency.
+    return List(isKeyed(this) ? this.valueSeq() : this);
+  },
+
+  // ### Common JavaScript methods and properties
+
+  toString: function toString() {
+    return '[Collection]';
+  },
+
+  __toString: function __toString(head, tail) {
+    if (this.size === 0) {
+      return head + tail;
+    }
+    return (
+      head +
+      ' ' +
+      this.toSeq()
+        .map(this.__toStringMapper)
+        .join(', ') +
+      ' ' +
+      tail
+    );
+  },
+
+  // ### ES6 Collection methods (ES6 Array and Map)
+
+  concat: function concat() {
+    var values = [], len = arguments.length;
+    while ( len-- ) values[ len ] = arguments[ len ];
+
+    return reify(this, concatFactory(this, values));
+  },
+
+  includes: function includes(searchValue) {
+    return this.some(function (value) { return is(value, searchValue); });
+  },
+
+  entries: function entries() {
+    return this.__iterator(ITERATE_ENTRIES);
+  },
+
+  every: function every(predicate, context) {
+    assertNotInfinite(this.size);
+    var returnValue = true;
+    this.__iterate(function (v, k, c) {
+      if (!predicate.call(context, v, k, c)) {
+        returnValue = false;
+        return false;
+      }
+    });
+    return returnValue;
+  },
+
+  filter: function filter(predicate, context) {
+    return reify(this, filterFactory(this, predicate, context, true));
+  },
+
+  find: function find(predicate, context, notSetValue) {
+    var entry = this.findEntry(predicate, context);
+    return entry ? entry[1] : notSetValue;
+  },
+
+  forEach: function forEach(sideEffect, context) {
+    assertNotInfinite(this.size);
+    return this.__iterate(context ? sideEffect.bind(context) : sideEffect);
+  },
+
+  join: function join(separator) {
+    assertNotInfinite(this.size);
+    separator = separator !== undefined ? '' + separator : ',';
+    var joined = '';
+    var isFirst = true;
+    this.__iterate(function (v) {
+      isFirst ? (isFirst = false) : (joined += separator);
+      joined += v !== null && v !== undefined ? v.toString() : '';
+    });
+    return joined;
+  },
+
+  keys: function keys() {
+    return this.__iterator(ITERATE_KEYS);
+  },
+
+  map: function map(mapper, context) {
+    return reify(this, mapFactory(this, mapper, context));
+  },
+
+  reduce: function reduce$1(reducer, initialReduction, context) {
+    return reduce(
+      this,
+      reducer,
+      initialReduction,
+      context,
+      arguments.length < 2,
+      false
+    );
+  },
+
+  reduceRight: function reduceRight(reducer, initialReduction, context) {
+    return reduce(
+      this,
+      reducer,
+      initialReduction,
+      context,
+      arguments.length < 2,
+      true
+    );
+  },
+
+  reverse: function reverse() {
+    return reify(this, reverseFactory(this, true));
+  },
+
+  slice: function slice(begin, end) {
+    return reify(this, sliceFactory(this, begin, end, true));
+  },
+
+  some: function some(predicate, context) {
+    return !this.every(not(predicate), context);
+  },
+
+  sort: function sort(comparator) {
+    return reify(this, sortFactory(this, comparator));
+  },
+
+  values: function values() {
+    return this.__iterator(ITERATE_VALUES);
+  },
+
+  // ### More sequential methods
+
+  butLast: function butLast() {
+    return this.slice(0, -1);
+  },
+
+  isEmpty: function isEmpty() {
+    return this.size !== undefined ? this.size === 0 : !this.some(function () { return true; });
+  },
+
+  count: function count(predicate, context) {
+    return ensureSize(
+      predicate ? this.toSeq().filter(predicate, context) : this
+    );
+  },
+
+  countBy: function countBy(grouper, context) {
+    return countByFactory(this, grouper, context);
+  },
+
+  equals: function equals(other) {
+    return deepEqual(this, other);
+  },
+
+  entrySeq: function entrySeq() {
+    var collection = this;
+    if (collection._cache) {
+      // We cache as an entries array, so we can just return the cache!
+      return new ArraySeq(collection._cache);
+    }
+    var entriesSequence = collection
+      .toSeq()
+      .map(entryMapper)
+      .toIndexedSeq();
+    entriesSequence.fromEntrySeq = function () { return collection.toSeq(); };
+    return entriesSequence;
+  },
+
+  filterNot: function filterNot(predicate, context) {
+    return this.filter(not(predicate), context);
+  },
+
+  findEntry: function findEntry(predicate, context, notSetValue) {
+    var found = notSetValue;
+    this.__iterate(function (v, k, c) {
+      if (predicate.call(context, v, k, c)) {
+        found = [k, v];
+        return false;
+      }
+    });
+    return found;
+  },
+
+  findKey: function findKey(predicate, context) {
+    var entry = this.findEntry(predicate, context);
+    return entry && entry[0];
+  },
+
+  findLast: function findLast(predicate, context, notSetValue) {
+    return this.toKeyedSeq()
+      .reverse()
+      .find(predicate, context, notSetValue);
+  },
+
+  findLastEntry: function findLastEntry(predicate, context, notSetValue) {
+    return this.toKeyedSeq()
+      .reverse()
+      .findEntry(predicate, context, notSetValue);
+  },
+
+  findLastKey: function findLastKey(predicate, context) {
+    return this.toKeyedSeq()
+      .reverse()
+      .findKey(predicate, context);
+  },
+
+  first: function first(notSetValue) {
+    return this.find(returnTrue, null, notSetValue);
+  },
+
+  flatMap: function flatMap(mapper, context) {
+    return reify(this, flatMapFactory(this, mapper, context));
+  },
+
+  flatten: function flatten(depth) {
+    return reify(this, flattenFactory(this, depth, true));
+  },
+
+  fromEntrySeq: function fromEntrySeq() {
+    return new FromEntriesSequence(this);
+  },
+
+  get: function get(searchKey, notSetValue) {
+    return this.find(function (_, key) { return is(key, searchKey); }, undefined, notSetValue);
+  },
+
+  getIn: getIn$1,
+
+  groupBy: function groupBy(grouper, context) {
+    return groupByFactory(this, grouper, context);
+  },
+
+  has: function has(searchKey) {
+    return this.get(searchKey, NOT_SET) !== NOT_SET;
+  },
+
+  hasIn: hasIn$1,
+
+  isSubset: function isSubset(iter) {
+    iter = typeof iter.includes === 'function' ? iter : Collection(iter);
+    return this.every(function (value) { return iter.includes(value); });
+  },
+
+  isSuperset: function isSuperset(iter) {
+    iter = typeof iter.isSubset === 'function' ? iter : Collection(iter);
+    return iter.isSubset(this);
+  },
+
+  keyOf: function keyOf(searchValue) {
+    return this.findKey(function (value) { return is(value, searchValue); });
+  },
+
+  keySeq: function keySeq() {
+    return this.toSeq()
+      .map(keyMapper)
+      .toIndexedSeq();
+  },
+
+  last: function last(notSetValue) {
+    return this.toSeq()
+      .reverse()
+      .first(notSetValue);
+  },
+
+  lastKeyOf: function lastKeyOf(searchValue) {
+    return this.toKeyedSeq()
+      .reverse()
+      .keyOf(searchValue);
+  },
+
+  max: function max(comparator) {
+    return maxFactory(this, comparator);
+  },
+
+  maxBy: function maxBy(mapper, comparator) {
+    return maxFactory(this, comparator, mapper);
+  },
+
+  min: function min(comparator) {
+    return maxFactory(
+      this,
+      comparator ? neg(comparator) : defaultNegComparator
+    );
+  },
+
+  minBy: function minBy(mapper, comparator) {
+    return maxFactory(
+      this,
+      comparator ? neg(comparator) : defaultNegComparator,
+      mapper
+    );
+  },
+
+  rest: function rest() {
+    return this.slice(1);
+  },
+
+  skip: function skip(amount) {
+    return amount === 0 ? this : this.slice(Math.max(0, amount));
+  },
+
+  skipLast: function skipLast(amount) {
+    return amount === 0 ? this : this.slice(0, -Math.max(0, amount));
+  },
+
+  skipWhile: function skipWhile(predicate, context) {
+    return reify(this, skipWhileFactory(this, predicate, context, true));
+  },
+
+  skipUntil: function skipUntil(predicate, context) {
+    return this.skipWhile(not(predicate), context);
+  },
+
+  sortBy: function sortBy(mapper, comparator) {
+    return reify(this, sortFactory(this, comparator, mapper));
+  },
+
+  take: function take(amount) {
+    return this.slice(0, Math.max(0, amount));
+  },
+
+  takeLast: function takeLast(amount) {
+    return this.slice(-Math.max(0, amount));
+  },
+
+  takeWhile: function takeWhile(predicate, context) {
+    return reify(this, takeWhileFactory(this, predicate, context));
+  },
+
+  takeUntil: function takeUntil(predicate, context) {
+    return this.takeWhile(not(predicate), context);
+  },
+
+  update: function update(fn) {
+    return fn(this);
+  },
+
+  valueSeq: function valueSeq() {
+    return this.toIndexedSeq();
+  },
+
+  // ### Hashable Object
+
+  hashCode: function hashCode() {
+    return this.__hash || (this.__hash = hashCollection(this));
+  },
+
+  // ### Internal
+
+  // abstract __iterate(fn, reverse)
+
+  // abstract __iterator(type, reverse)
+});
+
+var CollectionPrototype = Collection.prototype;
+CollectionPrototype[IS_COLLECTION_SYMBOL] = true;
+CollectionPrototype[ITERATOR_SYMBOL] = CollectionPrototype.values;
+CollectionPrototype.toJSON = CollectionPrototype.toArray;
+CollectionPrototype.__toStringMapper = quoteString;
+CollectionPrototype.inspect = CollectionPrototype.toSource = function() {
+  return this.toString();
+};
+CollectionPrototype.chain = CollectionPrototype.flatMap;
+CollectionPrototype.contains = CollectionPrototype.includes;
+
+mixin(KeyedCollection, {
+  // ### More sequential methods
+
+  flip: function flip() {
+    return reify(this, flipFactory(this));
+  },
+
+  mapEntries: function mapEntries(mapper, context) {
+    var this$1 = this;
+
+    var iterations = 0;
+    return reify(
+      this,
+      this.toSeq()
+        .map(function (v, k) { return mapper.call(context, [k, v], iterations++, this$1); })
+        .fromEntrySeq()
+    );
+  },
+
+  mapKeys: function mapKeys(mapper, context) {
+    var this$1 = this;
+
+    return reify(
+      this,
+      this.toSeq()
+        .flip()
+        .map(function (k, v) { return mapper.call(context, k, v, this$1); })
+        .flip()
+    );
+  },
+});
+
+var KeyedCollectionPrototype = KeyedCollection.prototype;
+KeyedCollectionPrototype[IS_KEYED_SYMBOL] = true;
+KeyedCollectionPrototype[ITERATOR_SYMBOL] = CollectionPrototype.entries;
+KeyedCollectionPrototype.toJSON = toObject;
+KeyedCollectionPrototype.__toStringMapper = function (v, k) { return quoteString(k) + ': ' + quoteString(v); };
+
+mixin(IndexedCollection, {
+  // ### Conversion to other types
+
+  toKeyedSeq: function toKeyedSeq() {
+    return new ToKeyedSequence(this, false);
+  },
+
+  // ### ES6 Collection methods (ES6 Array and Map)
+
+  filter: function filter(predicate, context) {
+    return reify(this, filterFactory(this, predicate, context, false));
+  },
+
+  findIndex: function findIndex(predicate, context) {
+    var entry = this.findEntry(predicate, context);
+    return entry ? entry[0] : -1;
+  },
+
+  indexOf: function indexOf(searchValue) {
+    var key = this.keyOf(searchValue);
+    return key === undefined ? -1 : key;
+  },
+
+  lastIndexOf: function lastIndexOf(searchValue) {
+    var key = this.lastKeyOf(searchValue);
+    return key === undefined ? -1 : key;
+  },
+
+  reverse: function reverse() {
+    return reify(this, reverseFactory(this, false));
+  },
+
+  slice: function slice(begin, end) {
+    return reify(this, sliceFactory(this, begin, end, false));
+  },
+
+  splice: function splice(index, removeNum /*, ...values*/) {
+    var numArgs = arguments.length;
+    removeNum = Math.max(removeNum || 0, 0);
+    if (numArgs === 0 || (numArgs === 2 && !removeNum)) {
+      return this;
+    }
+    // If index is negative, it should resolve relative to the size of the
+    // collection. However size may be expensive to compute if not cached, so
+    // only call count() if the number is in fact negative.
+    index = resolveBegin(index, index < 0 ? this.count() : this.size);
+    var spliced = this.slice(0, index);
+    return reify(
+      this,
+      numArgs === 1
+        ? spliced
+        : spliced.concat(arrCopy(arguments, 2), this.slice(index + removeNum))
+    );
+  },
+
+  // ### More collection methods
+
+  findLastIndex: function findLastIndex(predicate, context) {
+    var entry = this.findLastEntry(predicate, context);
+    return entry ? entry[0] : -1;
+  },
+
+  first: function first(notSetValue) {
+    return this.get(0, notSetValue);
+  },
+
+  flatten: function flatten(depth) {
+    return reify(this, flattenFactory(this, depth, false));
+  },
+
+  get: function get(index, notSetValue) {
+    index = wrapIndex(this, index);
+    return index < 0 ||
+      (this.size === Infinity || (this.size !== undefined && index > this.size))
+      ? notSetValue
+      : this.find(function (_, key) { return key === index; }, undefined, notSetValue);
+  },
+
+  has: function has(index) {
+    index = wrapIndex(this, index);
+    return (
+      index >= 0 &&
+      (this.size !== undefined
+        ? this.size === Infinity || index < this.size
+        : this.indexOf(index) !== -1)
+    );
+  },
+
+  interpose: function interpose(separator) {
+    return reify(this, interposeFactory(this, separator));
+  },
+
+  interleave: function interleave(/*...collections*/) {
+    var collections = [this].concat(arrCopy(arguments));
+    var zipped = zipWithFactory(this.toSeq(), IndexedSeq.of, collections);
+    var interleaved = zipped.flatten(true);
+    if (zipped.size) {
+      interleaved.size = zipped.size * collections.length;
+    }
+    return reify(this, interleaved);
+  },
+
+  keySeq: function keySeq() {
+    return Range(0, this.size);
+  },
+
+  last: function last(notSetValue) {
+    return this.get(-1, notSetValue);
+  },
+
+  skipWhile: function skipWhile(predicate, context) {
+    return reify(this, skipWhileFactory(this, predicate, context, false));
+  },
+
+  zip: function zip(/*, ...collections */) {
+    var collections = [this].concat(arrCopy(arguments));
+    return reify(this, zipWithFactory(this, defaultZipper, collections));
+  },
+
+  zipAll: function zipAll(/*, ...collections */) {
+    var collections = [this].concat(arrCopy(arguments));
+    return reify(this, zipWithFactory(this, defaultZipper, collections, true));
+  },
+
+  zipWith: function zipWith(zipper /*, ...collections */) {
+    var collections = arrCopy(arguments);
+    collections[0] = this;
+    return reify(this, zipWithFactory(this, zipper, collections));
+  },
+});
+
+var IndexedCollectionPrototype = IndexedCollection.prototype;
+IndexedCollectionPrototype[IS_INDEXED_SYMBOL] = true;
+IndexedCollectionPrototype[IS_ORDERED_SYMBOL] = true;
+
+mixin(SetCollection, {
+  // ### ES6 Collection methods (ES6 Array and Map)
+
+  get: function get(value, notSetValue) {
+    return this.has(value) ? value : notSetValue;
+  },
+
+  includes: function includes(value) {
+    return this.has(value);
+  },
+
+  // ### More sequential methods
+
+  keySeq: function keySeq() {
+    return this.valueSeq();
+  },
+});
+
+SetCollection.prototype.has = CollectionPrototype.includes;
+SetCollection.prototype.contains = SetCollection.prototype.includes;
+
+// Mixin subclasses
+
+mixin(KeyedSeq, KeyedCollection.prototype);
+mixin(IndexedSeq, IndexedCollection.prototype);
+mixin(SetSeq, SetCollection.prototype);
+
+// #pragma Helper functions
+
+function reduce(collection, reducer, reduction, context, useFirst, reverse) {
+  assertNotInfinite(collection.size);
+  collection.__iterate(function (v, k, c) {
+    if (useFirst) {
+      useFirst = false;
+      reduction = v;
+    } else {
+      reduction = reducer.call(context, reduction, v, k, c);
+    }
+  }, reverse);
+  return reduction;
+}
+
+function keyMapper(v, k) {
+  return k;
+}
+
+function entryMapper(v, k) {
+  return [k, v];
+}
+
+function not(predicate) {
+  return function() {
+    return !predicate.apply(this, arguments);
+  };
+}
+
+function neg(predicate) {
+  return function() {
+    return -predicate.apply(this, arguments);
+  };
+}
+
+function defaultZipper() {
+  return arrCopy(arguments);
+}
+
+function defaultNegComparator(a, b) {
+  return a < b ? 1 : a > b ? -1 : 0;
+}
+
+function hashCollection(collection) {
+  if (collection.size === Infinity) {
+    return 0;
+  }
+  var ordered = isOrdered(collection);
+  var keyed = isKeyed(collection);
+  var h = ordered ? 1 : 0;
+  var size = collection.__iterate(
+    keyed
+      ? ordered
+        ? function (v, k) {
+            h = (31 * h + hashMerge(hash(v), hash(k))) | 0;
+          }
+        : function (v, k) {
+            h = (h + hashMerge(hash(v), hash(k))) | 0;
+          }
+      : ordered
+        ? function (v) {
+            h = (31 * h + hash(v)) | 0;
+          }
+        : function (v) {
+            h = (h + hash(v)) | 0;
+          }
+  );
+  return murmurHashOfSize(size, h);
+}
+
+function murmurHashOfSize(size, h) {
+  h = imul(h, 0xcc9e2d51);
+  h = imul((h << 15) | (h >>> -15), 0x1b873593);
+  h = imul((h << 13) | (h >>> -13), 5);
+  h = ((h + 0xe6546b64) | 0) ^ size;
+  h = imul(h ^ (h >>> 16), 0x85ebca6b);
+  h = imul(h ^ (h >>> 13), 0xc2b2ae35);
+  h = smi(h ^ (h >>> 16));
+  return h;
+}
+
+function hashMerge(a, b) {
+  return (a ^ (b + 0x9e3779b9 + (a << 6) + (a >> 2))) | 0; // int
+}
+
+var OrderedSet = /*@__PURE__*/(function (Set$$1) {
+  function OrderedSet(value) {
+    return value === null || value === undefined
+      ? emptyOrderedSet()
+      : isOrderedSet(value)
+        ? value
+        : emptyOrderedSet().withMutations(function (set) {
+            var iter = SetCollection(value);
+            assertNotInfinite(iter.size);
+            iter.forEach(function (v) { return set.add(v); });
+          });
+  }
+
+  if ( Set$$1 ) OrderedSet.__proto__ = Set$$1;
+  OrderedSet.prototype = Object.create( Set$$1 && Set$$1.prototype );
+  OrderedSet.prototype.constructor = OrderedSet;
+
+  OrderedSet.of = function of (/*...values*/) {
+    return this(arguments);
+  };
+
+  OrderedSet.fromKeys = function fromKeys (value) {
+    return this(KeyedCollection(value).keySeq());
+  };
+
+  OrderedSet.prototype.toString = function toString () {
+    return this.__toString('OrderedSet {', '}');
+  };
+
+  return OrderedSet;
+}(Set));
+
+OrderedSet.isOrderedSet = isOrderedSet;
+
+var OrderedSetPrototype = OrderedSet.prototype;
+OrderedSetPrototype[IS_ORDERED_SYMBOL] = true;
+OrderedSetPrototype.zip = IndexedCollectionPrototype.zip;
+OrderedSetPrototype.zipWith = IndexedCollectionPrototype.zipWith;
+
+OrderedSetPrototype.__empty = emptyOrderedSet;
+OrderedSetPrototype.__make = makeOrderedSet;
+
+function makeOrderedSet(map, ownerID) {
+  var set = Object.create(OrderedSetPrototype);
+  set.size = map ? map.size : 0;
+  set._map = map;
+  set.__ownerID = ownerID;
+  return set;
+}
+
+var EMPTY_ORDERED_SET;
+function emptyOrderedSet() {
+  return (
+    EMPTY_ORDERED_SET || (EMPTY_ORDERED_SET = makeOrderedSet(emptyOrderedMap()))
+  );
+}
+
+var Record = function Record(defaultValues, name) {
+  var hasInitialized;
+
+  var RecordType = function Record(values) {
+    var this$1 = this;
+
+    if (values instanceof RecordType) {
+      return values;
+    }
+    if (!(this instanceof RecordType)) {
+      return new RecordType(values);
+    }
+    if (!hasInitialized) {
+      hasInitialized = true;
+      var keys = Object.keys(defaultValues);
+      var indices = (RecordTypePrototype._indices = {});
+      // Deprecated: left to attempt not to break any external code which
+      // relies on a ._name property existing on record instances.
+      // Use Record.getDescriptiveName() instead
+      RecordTypePrototype._name = name;
+      RecordTypePrototype._keys = keys;
+      RecordTypePrototype._defaultValues = defaultValues;
+      for (var i = 0; i < keys.length; i++) {
+        var propName = keys[i];
+        indices[propName] = i;
+        if (RecordTypePrototype[propName]) {
+          /* eslint-disable no-console */
+          typeof console === 'object' &&
+            console.warn &&
+            console.warn(
+              'Cannot define ' +
+                recordName(this) +
+                ' with property "' +
+                propName +
+                '" since that property name is part of the Record API.'
+            );
+          /* eslint-enable no-console */
+        } else {
+          setProp(RecordTypePrototype, propName);
+        }
+      }
+    }
+    this.__ownerID = undefined;
+    this._values = List().withMutations(function (l) {
+      l.setSize(this$1._keys.length);
+      KeyedCollection(values).forEach(function (v, k) {
+        l.set(this$1._indices[k], v === this$1._defaultValues[k] ? undefined : v);
+      });
+    });
+  };
+
+  var RecordTypePrototype = (RecordType.prototype = Object.create(
+    RecordPrototype
+  ));
+  RecordTypePrototype.constructor = RecordType;
+
+  if (name) {
+    RecordType.displayName = name;
+  }
+
+  return RecordType;
+};
+
+Record.prototype.toString = function toString () {
+  var str = recordName(this) + ' { ';
+  var keys = this._keys;
+  var k;
+  for (var i = 0, l = keys.length; i !== l; i++) {
+    k = keys[i];
+    str += (i ? ', ' : '') + k + ': ' + quoteString(this.get(k));
+  }
+  return str + ' }';
+};
+
+Record.prototype.equals = function equals (other) {
+  return (
+    this === other ||
+    (other &&
+      this._keys === other._keys &&
+      recordSeq(this).equals(recordSeq(other)))
+  );
+};
+
+Record.prototype.hashCode = function hashCode () {
+  return recordSeq(this).hashCode();
+};
+
+// @pragma Access
+
+Record.prototype.has = function has (k) {
+  return this._indices.hasOwnProperty(k);
+};
+
+Record.prototype.get = function get (k, notSetValue) {
+  if (!this.has(k)) {
+    return notSetValue;
+  }
+  var index = this._indices[k];
+  var value = this._values.get(index);
+  return value === undefined ? this._defaultValues[k] : value;
+};
+
+// @pragma Modification
+
+Record.prototype.set = function set (k, v) {
+  if (this.has(k)) {
+    var newValues = this._values.set(
+      this._indices[k],
+      v === this._defaultValues[k] ? undefined : v
+    );
+    if (newValues !== this._values && !this.__ownerID) {
+      return makeRecord(this, newValues);
+    }
+  }
+  return this;
+};
+
+Record.prototype.remove = function remove (k) {
+  return this.set(k);
+};
+
+Record.prototype.clear = function clear () {
+  var newValues = this._values.clear().setSize(this._keys.length);
+  return this.__ownerID ? this : makeRecord(this, newValues);
+};
+
+Record.prototype.wasAltered = function wasAltered () {
+  return this._values.wasAltered();
+};
+
+Record.prototype.toSeq = function toSeq () {
+  return recordSeq(this);
+};
+
+Record.prototype.toJS = function toJS$1 () {
+  return toJS(this);
+};
+
+Record.prototype.entries = function entries () {
+  return this.__iterator(ITERATE_ENTRIES);
+};
+
+Record.prototype.__iterator = function __iterator (type, reverse) {
+  return recordSeq(this).__iterator(type, reverse);
+};
+
+Record.prototype.__iterate = function __iterate (fn, reverse) {
+  return recordSeq(this).__iterate(fn, reverse);
+};
+
+Record.prototype.__ensureOwner = function __ensureOwner (ownerID) {
+  if (ownerID === this.__ownerID) {
+    return this;
+  }
+  var newValues = this._values.__ensureOwner(ownerID);
+  if (!ownerID) {
+    this.__ownerID = ownerID;
+    this._values = newValues;
+    return this;
+  }
+  return makeRecord(this, newValues, ownerID);
+};
+
+Record.isRecord = isRecord;
+Record.getDescriptiveName = recordName;
+var RecordPrototype = Record.prototype;
+RecordPrototype[IS_RECORD_SYMBOL] = true;
+RecordPrototype[DELETE] = RecordPrototype.remove;
+RecordPrototype.deleteIn = RecordPrototype.removeIn = deleteIn;
+RecordPrototype.getIn = getIn$1;
+RecordPrototype.hasIn = CollectionPrototype.hasIn;
+RecordPrototype.merge = merge;
+RecordPrototype.mergeWith = mergeWith;
+RecordPrototype.mergeIn = mergeIn;
+RecordPrototype.mergeDeep = mergeDeep$1;
+RecordPrototype.mergeDeepWith = mergeDeepWith$1;
+RecordPrototype.mergeDeepIn = mergeDeepIn;
+RecordPrototype.setIn = setIn$1;
+RecordPrototype.update = update$1;
+RecordPrototype.updateIn = updateIn$1;
+RecordPrototype.withMutations = withMutations;
+RecordPrototype.asMutable = asMutable;
+RecordPrototype.asImmutable = asImmutable;
+RecordPrototype[ITERATOR_SYMBOL] = RecordPrototype.entries;
+RecordPrototype.toJSON = RecordPrototype.toObject =
+  CollectionPrototype.toObject;
+RecordPrototype.inspect = RecordPrototype.toSource = function() {
+  return this.toString();
+};
+
+function makeRecord(likeRecord, values, ownerID) {
+  var record = Object.create(Object.getPrototypeOf(likeRecord));
+  record._values = values;
+  record.__ownerID = ownerID;
+  return record;
+}
+
+function recordName(record) {
+  return record.constructor.displayName || record.constructor.name || 'Record';
+}
+
+function recordSeq(record) {
+  return keyedSeqFromValue(record._keys.map(function (k) { return [k, record.get(k)]; }));
+}
+
+function setProp(prototype, name) {
+  try {
+    Object.defineProperty(prototype, name, {
+      get: function() {
+        return this.get(name);
+      },
+      set: function(value) {
+        invariant(this.__ownerID, 'Cannot set on an immutable record.');
+        this.set(name, value);
+      },
+    });
+  } catch (error) {
+    // Object.defineProperty failed. Probably IE8.
+  }
+}
+
+/**
+ * Returns a lazy Seq of `value` repeated `times` times. When `times` is
+ * undefined, returns an infinite sequence of `value`.
+ */
+var Repeat = /*@__PURE__*/(function (IndexedSeq$$1) {
+  function Repeat(value, times) {
+    if (!(this instanceof Repeat)) {
+      return new Repeat(value, times);
+    }
+    this._value = value;
+    this.size = times === undefined ? Infinity : Math.max(0, times);
+    if (this.size === 0) {
+      if (EMPTY_REPEAT) {
+        return EMPTY_REPEAT;
+      }
+      EMPTY_REPEAT = this;
+    }
+  }
+
+  if ( IndexedSeq$$1 ) Repeat.__proto__ = IndexedSeq$$1;
+  Repeat.prototype = Object.create( IndexedSeq$$1 && IndexedSeq$$1.prototype );
+  Repeat.prototype.constructor = Repeat;
+
+  Repeat.prototype.toString = function toString () {
+    if (this.size === 0) {
+      return 'Repeat []';
+    }
+    return 'Repeat [ ' + this._value + ' ' + this.size + ' times ]';
+  };
+
+  Repeat.prototype.get = function get (index, notSetValue) {
+    return this.has(index) ? this._value : notSetValue;
+  };
+
+  Repeat.prototype.includes = function includes (searchValue) {
+    return is(this._value, searchValue);
+  };
+
+  Repeat.prototype.slice = function slice (begin, end) {
+    var size = this.size;
+    return wholeSlice(begin, end, size)
+      ? this
+      : new Repeat(
+          this._value,
+          resolveEnd(end, size) - resolveBegin(begin, size)
+        );
+  };
+
+  Repeat.prototype.reverse = function reverse () {
+    return this;
+  };
+
+  Repeat.prototype.indexOf = function indexOf (searchValue) {
+    if (is(this._value, searchValue)) {
+      return 0;
+    }
+    return -1;
+  };
+
+  Repeat.prototype.lastIndexOf = function lastIndexOf (searchValue) {
+    if (is(this._value, searchValue)) {
+      return this.size;
+    }
+    return -1;
+  };
+
+  Repeat.prototype.__iterate = function __iterate (fn, reverse) {
+    var size = this.size;
+    var i = 0;
+    while (i !== size) {
+      if (fn(this._value, reverse ? size - ++i : i++, this) === false) {
+        break;
+      }
+    }
+    return i;
+  };
+
+  Repeat.prototype.__iterator = function __iterator (type, reverse) {
+    var this$1 = this;
+
+    var size = this.size;
+    var i = 0;
+    return new Iterator(
+      function () { return i === size
+          ? iteratorDone()
+          : iteratorValue(type, reverse ? size - ++i : i++, this$1._value); }
+    );
+  };
+
+  Repeat.prototype.equals = function equals (other) {
+    return other instanceof Repeat
+      ? is(this._value, other._value)
+      : deepEqual(other);
+  };
+
+  return Repeat;
+}(IndexedSeq));
+
+var EMPTY_REPEAT;
+
+function fromJS(value, converter) {
+  return fromJSWith(
+    [],
+    converter || defaultConverter,
+    value,
+    '',
+    converter && converter.length > 2 ? [] : undefined,
+    { '': value }
+  );
+}
+
+function fromJSWith(stack, converter, value, key, keyPath, parentValue) {
+  var toSeq = Array.isArray(value)
+    ? IndexedSeq
+    : isPlainObj(value)
+      ? KeyedSeq
+      : null;
+  if (toSeq) {
+    if (~stack.indexOf(value)) {
+      throw new TypeError('Cannot convert circular structure to Immutable');
+    }
+    stack.push(value);
+    keyPath && key !== '' && keyPath.push(key);
+    var converted = converter.call(
+      parentValue,
+      key,
+      toSeq(value).map(function (v, k) { return fromJSWith(stack, converter, v, k, keyPath, value); }
+      ),
+      keyPath && keyPath.slice()
+    );
+    stack.pop();
+    keyPath && keyPath.pop();
+    return converted;
+  }
+  return value;
+}
+
+function defaultConverter(k, v) {
+  return isKeyed(v) ? v.toMap() : v.toList();
+}
+
+var version = "4.0.0-rc.11";
+
+var Immutable = {
+  version: version,
+
+  Collection: Collection,
+  // Note: Iterable is deprecated
+  Iterable: Collection,
+
+  Seq: Seq,
+  Map: Map,
+  OrderedMap: OrderedMap,
+  List: List,
+  Stack: Stack,
+  Set: Set,
+  OrderedSet: OrderedSet,
+
+  Record: Record,
+  Range: Range,
+  Repeat: Repeat,
+
+  is: is,
+  fromJS: fromJS,
+  hash: hash,
+
+  isImmutable: isImmutable,
+  isCollection: isCollection,
+  isKeyed: isKeyed,
+  isIndexed: isIndexed,
+  isAssociative: isAssociative,
+  isOrdered: isOrdered,
+  isValueObject: isValueObject,
+  isSeq: isSeq,
+  isList: isList,
+  isMap: isMap,
+  isOrderedMap: isOrderedMap,
+  isStack: isStack,
+  isSet: isSet,
+  isOrderedSet: isOrderedSet,
+  isRecord: isRecord,
+
+  get: get,
+  getIn: getIn,
+  has: has,
+  hasIn: hasIn,
+  merge: merge$1,
+  mergeDeep: mergeDeep,
+  mergeWith: mergeWith$1,
+  mergeDeepWith: mergeDeepWith,
+  remove: remove,
+  removeIn: removeIn,
+  set: set,
+  setIn: setIn,
+  update: update,
+  updateIn: updateIn,
+};
+
+// Note: Iterable is deprecated
+var Iterable = Collection;
+
+export default Immutable;
+export { version, Collection, Iterable, Seq, Map, OrderedMap, List, Stack, Set, OrderedSet, Record, Range, Repeat, is, fromJS, hash, isImmutable, isCollection, isKeyed, isIndexed, isAssociative, isOrdered, isValueObject, get, getIn, has, hasIn, merge$1 as merge, mergeDeep, mergeWith$1 as mergeWith, mergeDeepWith, remove, removeIn, set, setIn, update, updateIn };
diff --git a/B2Program/TrafficLight/traffic_light.json b/B2Program/TrafficLight/traffic_light.json
new file mode 100755
index 0000000000000000000000000000000000000000..fdf8e3c1d1ff17c4b1f549e193d875596a1904e7
--- /dev/null
+++ b/B2Program/TrafficLight/traffic_light.json
@@ -0,0 +1,71 @@
+{
+  "svg":"traffic_light.svg",
+  "items":[
+    {
+      "id":"cars_red",
+      "attr":"fill",
+      "value":"IF tl_cars = red or tl_cars = redyellow THEN \"red\" ELSE \"black\" END"
+    },
+    {
+      "id":"cars_yellow_1",
+      "attr":"fill",
+      "value":"IF tl_cars = yellow or tl_cars = redyellow THEN \"yellow\" ELSE \"black\" END"
+    },
+    {
+      "id":"cars_yellow_1",
+      "attr":"visibility",
+      "value":"IF tl_cars /= green THEN \"visible\" ELSE \"hidden\" END"
+    },
+    {
+      "id":"cars_yellow_2",
+      "attr":"fill",
+      "value":"IF tl_cars = yellow or tl_cars = redyellow THEN \"yellow\" ELSE \"black\" END"
+    },
+    {
+      "id":"cars_yellow_2",
+      "attr":"visibility",
+      "value":"IF tl_cars /= red THEN \"visible\" ELSE \"hidden\" END"
+    },
+    {
+      "id":"cars_green",
+      "attr":"fill",
+      "value":"IF tl_cars = green THEN \"green\" ELSE \"black\" END"
+    },
+    {
+      "id":"peds_red",
+      "attr":"fill",
+      "value":"IF tl_peds = red THEN \"red\" ELSE \"black\" END"
+    },
+    {
+      "id":"peds_green",
+      "attr":"fill",
+      "value":"IF tl_peds = green THEN \"green\" ELSE \"black\" END"
+    }
+  ],
+  "events": [
+      {
+        "id":"cars_red",
+        "event":"cars_r"
+      },
+      {
+        "id":"cars_yellow_1",
+        "event":"cars_ry"
+      },
+      {
+        "id":"cars_yellow_2",
+        "event":"cars_y"
+      },
+      {
+        "id":"cars_green",
+        "event":"cars_g"
+      },
+      {
+        "id":"peds_red",
+        "event":"peds_r"
+      },
+      {
+        "id":"peds_green",
+        "event":"peds_g"
+      }
+  ]
+}
diff --git a/B2Program/TrafficLight/traffic_light.svg b/B2Program/TrafficLight/traffic_light.svg
new file mode 100755
index 0000000000000000000000000000000000000000..8b20aa8581ddcf37c3b7acc5ed89cff4e22b3e32
--- /dev/null
+++ b/B2Program/TrafficLight/traffic_light.svg
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   width="300"
+   height="300"
+   viewBox="0 0 300.0 300.0"
+   version="1.1"
+   id="traffic_light_visualsiation">
+  <defs
+     id="defs2" />
+  <metadata
+     id="metadata5">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+    <g id="traffic_light_cars">
+      <circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" id="cars_red"/>
+      <circle cx="50" cy="150" r="40" stroke="black" stroke-width="3" fill="yellow" visibility="visible" id="cars_yellow_1"/>
+      <circle cx="50" cy="150" r="40" stroke="black" stroke-width="3" fill="yellow" visibility="hidden" id="cars_yellow_2"/>
+      <circle cx="50" cy="250" r="40" stroke="black" stroke-width="3" fill="green" id="cars_green"/>
+    </g>
+    <g id="traffic_light_peds">
+      <circle cx="150" cy="50" r="40" stroke="black" stroke-width="3" fill="red" id="peds_red"/>
+      <circle cx="150" cy="150" r="40" stroke="black" stroke-width="3" fill="green" id="peds_green"/>
+    </g>
+</svg>