text: (function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
    typeof define === 'function' && define.amd ? define(factory) :
    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.rexdialog = factory());
  })(this, (function () { 'use strict';
  
    function _typeof(obj) {
      "@babel/helpers - typeof";
  
      return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
        return typeof obj;
      } : function (obj) {
        return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
      }, _typeof(obj);
    }
  
    function _classCallCheck(instance, Constructor) {
      if (!(instance instanceof Constructor)) {
        throw new TypeError("Cannot call a class as a function");
      }
    }
  
    function _defineProperties(target, props) {
      for (var i = 0; i < props.length; i++) {
        var descriptor = props[i];
        descriptor.enumerable = descriptor.enumerable || false;
        descriptor.configurable = true;
        if ("value" in descriptor) descriptor.writable = true;
        Object.defineProperty(target, descriptor.key, descriptor);
      }
    }
  
    function _createClass(Constructor, protoProps, staticProps) {
      if (protoProps) _defineProperties(Constructor.prototype, protoProps);
      if (staticProps) _defineProperties(Constructor, staticProps);
      Object.defineProperty(Constructor, "prototype", {
        writable: false
      });
      return Constructor;
    }
  
    function _defineProperty(obj, key, value) {
      if (key in obj) {
        Object.defineProperty(obj, key, {
          value: value,
          enumerable: true,
          configurable: true,
          writable: true
        });
      } else {
        obj[key] = value;
      }
  
      return obj;
    }
  
    function _inherits(subClass, superClass) {
      if (typeof superClass !== "function" && superClass !== null) {
        throw new TypeError("Super expression must either be null or a function");
      }
  
      subClass.prototype = Object.create(superClass && superClass.prototype, {
        constructor: {
          value: subClass,
          writable: true,
          configurable: true
        }
      });
      Object.defineProperty(subClass, "prototype", {
        writable: false
      });
      if (superClass) _setPrototypeOf(subClass, superClass);
    }
  
    function _getPrototypeOf(o) {
      _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
        return o.__proto__ || Object.getPrototypeOf(o);
      };
      return _getPrototypeOf(o);
    }
  
    function _setPrototypeOf(o, p) {
      _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
        o.__proto__ = p;
        return o;
      };
      return _setPrototypeOf(o, p);
    }
  
    function _isNativeReflectConstruct() {
      if (typeof Reflect === "undefined" || !Reflect.construct) return false;
      if (Reflect.construct.sham) return false;
      if (typeof Proxy === "function") return true;
  
      try {
        Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
        return true;
      } catch (e) {
        return false;
      }
    }
  
    function _assertThisInitialized(self) {
      if (self === void 0) {
        throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
      }
  
      return self;
    }
  
    function _possibleConstructorReturn(self, call) {
      if (call && (typeof call === "object" || typeof call === "function")) {
        return call;
      } else if (call !== void 0) {
        throw new TypeError("Derived constructors may only return object or undefined");
      }
  
      return _assertThisInitialized(self);
    }
  
    function _createSuper(Derived) {
      var hasNativeReflectConstruct = _isNativeReflectConstruct();
  
      return function _createSuperInternal() {
        var Super = _getPrototypeOf(Derived),
            result;
  
        if (hasNativeReflectConstruct) {
          var NewTarget = _getPrototypeOf(this).constructor;
  
          result = Reflect.construct(Super, arguments, NewTarget);
        } else {
          result = Super.apply(this, arguments);
        }
  
        return _possibleConstructorReturn(this, result);
      };
    }
  
    function _superPropBase(object, property) {
      while (!Object.prototype.hasOwnProperty.call(object, property)) {
        object = _getPrototypeOf(object);
        if (object === null) break;
      }
  
      return object;
    }
  
    function _get() {
      if (typeof Reflect !== "undefined" && Reflect.get) {
        _get = Reflect.get.bind();
      } else {
        _get = function _get(target, property, receiver) {
          var base = _superPropBase(target, property);
  
          if (!base) return;
          var desc = Object.getOwnPropertyDescriptor(base, property);
  
          if (desc.get) {
            return desc.get.call(arguments.length < 3 ? target : receiver);
          }
  
          return desc.value;
        };
      }
  
      return _get.apply(this, arguments);
    }
  
    function set(target, property, value, receiver) {
      if (typeof Reflect !== "undefined" && Reflect.set) {
        set = Reflect.set;
      } else {
        set = function set(target, property, value, receiver) {
          var base = _superPropBase(target, property);
  
          var desc;
  
          if (base) {
            desc = Object.getOwnPropertyDescriptor(base, property);
  
            if (desc.set) {
              desc.set.call(receiver, value);
              return true;
            } else if (!desc.writable) {
              return false;
            }
          }
  
          desc = Object.getOwnPropertyDescriptor(receiver, property);
  
          if (desc) {
            if (!desc.writable) {
              return false;
            }
  
            desc.value = value;
            Object.defineProperty(receiver, property, desc);
          } else {
            _defineProperty(receiver, property, value);
          }
  
          return true;
        };
      }
  
      return set(target, property, value, receiver);
    }
  
    function _set(target, property, value, receiver, isStrict) {
      var s = set(target, property, value, receiver || target);
  
      if (!s && isStrict) {
        throw new Error('failed to set property');
      }
  
      return value;
    }
  
    function _toConsumableArray(arr) {
      return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
    }
  
    function _arrayWithoutHoles(arr) {
      if (Array.isArray(arr)) return _arrayLikeToArray(arr);
    }
  
    function _iterableToArray(iter) {
      if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
    }
  
    function _unsupportedIterableToArray(o, minLen) {
      if (!o) return;
      if (typeof o === "string") return _arrayLikeToArray(o, minLen);
      var n = Object.prototype.toString.call(o).slice(8, -1);
      if (n === "Object" && o.constructor) n = o.constructor.name;
      if (n === "Map" || n === "Set") return Array.from(o);
      if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
    }
  
    function _arrayLikeToArray(arr, len) {
      if (len == null || len > arr.length) len = arr.length;
  
      for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
  
      return arr2;
    }
  
    function _nonIterableSpread() {
      throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
    }
  
    var Zone$1 = Phaser.GameObjects.Zone;
    var AddItem = Phaser.Utils.Array.Add;
    var RemoveItem$4 = Phaser.Utils.Array.Remove;
  
    var Base$1 = /*#__PURE__*/function (_Zone) {
      _inherits(Base, _Zone);
  
      var _super = _createSuper(Base);
  
      function Base(scene, x, y, width, height) {
        var _this;
  
        _classCallCheck(this, Base);
  
        if (x === undefined) {
          x = 0;
        }
  
        if (y === undefined) {
          y = 0;
        }
  
        if (width === undefined) {
          width = 1;
        }
  
        if (height === undefined) {
          height = 1;
        }
  
        _this = _super.call(this, scene, x, y, width, height);
        _this.children = [];
        return _this;
      }
  
      _createClass(Base, [{
        key: "destroy",
        value: function destroy(fromScene) {
          //  This Game Object has already been destroyed
          if (!this.scene) {
            return;
          }
  
          if (fromScene) {
            // Stop scene
            var child;
  
            for (var i = this.children.length - 1; i >= 0; i--) {
              child = this.children[i];
  
              if (!child.parentContainer && // Not in container
              !child.displayList // Not in scene, neither in layer
              ) {
                // Destroy child which is not in scene, container, or layer manually
                child.destroy(fromScene);
              }
            }
          } // Destroy/remove children
  
  
          this.clear(!fromScene);
  
          _get(_getPrototypeOf(Base.prototype), "destroy", this).call(this, fromScene);
        }
      }, {
        key: "contains",
        value: function contains(gameObject) {
          return this.children.indexOf(gameObject) !== -1;
        }
      }, {
        key: "add",
        value: function add(gameObjects) {
          var parent = this;
          AddItem(this.children, gameObjects, 0, // Callback of item added
          function (gameObject) {
            gameObject.once('destroy', parent.onChildDestroy, parent);
          }, this);
          return this;
        }
      }, {
        key: "remove",
        value: function remove(gameObjects, destroyChild) {
          var parent = this;
          RemoveItem$4(this.children, gameObjects, // Callback of item removed
          function (gameObject) {
            gameObject.off('destroy', parent.onChildDestroy, parent);
  
            if (destroyChild) {
              gameObject.destroy();
            }
          });
          return this;
        }
      }, {
        key: "onChildDestroy",
        value: function onChildDestroy(child, fromScene) {
          // Only remove reference
          this.remove(child, false);
        }
      }, {
        key: "clear",
        value: function clear(destroyChild) {
          var parent = this;
          var gameObject;
  
          for (var i = 0, cnt = this.children.length; i < cnt; i++) {
            gameObject = this.children[i];
            gameObject.off('destroy', parent.onChildDestroy, parent);
  
            if (destroyChild) {
              gameObject.destroy();
            }
          }
  
          this.children.length = 0;
          return this;
        }
      }]);
  
      return Base;
    }(Zone$1);
  
    var Components = Phaser.GameObjects.Components;
    Phaser.Class.mixin(Base$1, [Components.Alpha, Components.Flip]);
  
    var GetParent = function GetParent(gameObject, name) {
      var parent;
  
      if (name === undefined) {
        if (gameObject.hasOwnProperty('rexContainer')) {
          parent = gameObject.rexContainer.parent;
        }
      } else {
        parent = GetParent(gameObject);
  
        while (parent) {
          if (parent.name === name) {
            break;
          }
  
          parent = GetParent(parent);
        }
      }
  
      return parent;
    };
  
    var GetTopmostParent = function GetTopmostParent(gameObject) {
      var parent = GetParent(gameObject);
  
      while (parent) {
        gameObject = parent;
        parent = GetParent(parent);
      }
  
      return gameObject;
    };
  
    var DegToRad$2 = Phaser.Math.DegToRad;
    var RadToDeg$2 = Phaser.Math.RadToDeg;
  
    var GetLocalState = function GetLocalState(gameObject) {
      if (!gameObject.hasOwnProperty('rexContainer')) {
        var rexContainer = {
          parent: null,
          self: null,
          x: 0,
          y: 0,
          syncPosition: true,
          rotation: 0,
          syncRotation: true,
          scaleX: 0,
          scaleY: 0,
          syncScale: true,
          alpha: 0,
          syncAlpha: true,
          visible: true,
          active: true
        };
        Object.defineProperty(rexContainer, 'angle', {
          get: function get() {
            return RadToDeg$2(this.rotation);
          },
          set: function set(value) {
            this.rotation = DegToRad$2(value);
          }
        });
        Object.defineProperty(rexContainer, 'displayWidth', {
          get: function get() {
            return gameObject.width * this.scaleX;
          },
          set: function set(width) {
            this.scaleX = width / gameObject.width;
          }
        });
        Object.defineProperty(rexContainer, 'displayHeight', {
          get: function get() {
            return gameObject.height * this.scaleY;
          },
          set: function set(height) {
            this.scaleY = height / gameObject.height;
          }
        });
        gameObject.rexContainer = rexContainer;
      }
  
      return gameObject.rexContainer;
    };
  
    var Parent = {
      setParent: function setParent(gameObject, parent) {
        if (parent === undefined) {
          parent = this;
        }
  
        var localState = GetLocalState(gameObject);
  
        if (parent) {
          // Add to parent
          localState.parent = parent;
          localState.self = gameObject;
        } else {
          // Remove from parent
          localState.parent = null;
          localState.self = null;
        }
  
        return this;
      },
      getParent: function getParent(gameObject, name) {
        if (typeof gameObject === 'string') {
          name = gameObject;
          gameObject = undefined;
        }
  
        if (gameObject === undefined) {
          gameObject = this;
        }
  
        return GetParent(gameObject, name);
      },
      getTopmostParent: function getTopmostParent(gameObject) {
        if (gameObject === undefined) {
          gameObject = this;
        }
  
        return GetTopmostParent(gameObject);
      }
    };
  
    var GetValue$F = Phaser.Utils.Objects.GetValue;
    var BaseAdd = Base$1.prototype.add;
  
    var Add$6 = function Add(gameObject, config) {
      this.setParent(gameObject);
      var state = GetLocalState(gameObject);
      SetupSyncFlags(state, config);
      this.resetChildState(gameObject) // Reset local state of child
      .updateChildVisible(gameObject) // Apply parent's visible to child
      .updateChildActive(gameObject) // Apply parent's active to child
      .updateChildScrollFactor(gameObject) // Apply parent's scroll factor to child
      .updateChildMask(gameObject); // Apply parent's mask to child
  
      BaseAdd.call(this, gameObject);
      return this;
    };
  
    var AddLocal = function AddLocal(gameObject, config) {
      this.setParent(gameObject); // Set local state from child directly
  
      var state = GetLocalState(gameObject);
      SetupSyncFlags(state, config); // Position
  
      state.x = gameObject.x;
      state.y = gameObject.y;
      state.rotation = gameObject.rotation;
      state.scaleX = gameObject.scaleX;
      state.scaleY = gameObject.scaleY; // Alpha
  
      state.alpha = gameObject.alpha; // Visible
  
      state.visible = gameObject.visible; // Active
  
      state.active = gameObject.active;
      this.updateChildPosition(gameObject).updateChildAlpha(gameObject).updateChildVisible(gameObject) // Apply parent's visible to child
      .updateChildActive(gameObject) // Apply parent's active to child
      .updateChildScrollFactor(gameObject) // Apply parent's scroll factor to child
      .updateChildMask(gameObject); // Apply parent's mask to child
  
      BaseAdd.call(this, gameObject);
      return this;
    };
  
    var SetupSyncFlags = function SetupSyncFlags(state, config) {
      state.syncPosition = GetValue$F(config, 'syncPosition', true);
      state.syncRotation = GetValue$F(config, 'syncRotation', true);
      state.syncScale = GetValue$F(config, 'syncScale', true);
      state.syncAlpha = GetValue$F(config, 'syncAlpha', true);
    };
  
    var AddChild$1 = {
      // Can override this method
      add: function add(gameObject) {
        if (Array.isArray(gameObject)) {
          this.addMultiple(gameObject);
        } else {
          Add$6.call(this, gameObject);
        }
  
        return this;
      },
      // Don't override this method
      pin: function pin(gameObject, config) {
        if (Array.isArray(gameObject)) {
          this.addMultiple(gameObject, config);
        } else {
          Add$6.call(this, gameObject, config);
        }
  
        return this;
      },
      addMultiple: function addMultiple(gameObjects) {
        for (var i = 0, cnt = gameObjects.length; i < cnt; i++) {
          Add$6.call(this, gameObjects[i]);
        }
  
        return this;
      },
      addLocal: function addLocal(gameObject) {
        if (Array.isArray(gameObject)) {
          this.addMultiple(gameObject);
        } else {
          AddLocal.call(this, gameObject);
        }
  
        return this;
      },
      // Don't override this method
      pinLocal: function pinLocal(gameObject, config) {
        if (Array.isArray(gameObject)) {
          this.addMultiple(gameObject, config);
        } else {
          AddLocal.call(this, gameObject, config);
        }
  
        return this;
      },
      addLocalMultiple: function addLocalMultiple(gameObjects) {
        for (var i = 0, cnt = gameObjects.length; i < cnt; i++) {
          AddLocal.call(this, gameObjects[i]);
        }
  
        return this;
      }
    };
  
    var BaseRemove = Base$1.prototype.remove;
    var BaseClear = Base$1.prototype.clear;
    var RemoveChild$1 = {
      remove: function remove(gameObject, destroyChild) {
        if (GetParent(gameObject) !== this) {
          return this;
        }
  
        this.setParent(gameObject, null);
        BaseRemove.call(this, gameObject, destroyChild);
        return this;
      },
      clear: function clear(destroyChild) {
        for (var i = 0, cnt = this.children.length; i < cnt; i++) {
          this.setParent(this.children[i], null);
        }
  
        BaseClear.call(this, destroyChild);
        return this;
      }
    };
  
    var ChildState = {
      getLocalState: function getLocalState(gameObject) {
        return GetLocalState(gameObject);
      },
      resetChildState: function resetChildState(gameObject) {
        this.resetChildPositionState(gameObject).resetChildVisibleState(gameObject).resetChildAlphaState(gameObject).resetChildActiveState(gameObject);
        return this;
      },
      resetChildrenState: function resetChildrenState(gameObjects) {
        for (var i = 0, cnt = gameObjects.length; i < cnt; i++) {
          this.resetChildState(gameObjects[i]);
        }
  
        return this;
      },
      syncProperties: function syncProperties() {
        this.syncPosition().syncVisible().syncAlpha().syncActive().syncScrollFactor().syncMask();
        return this;
      }
    };
  
    var RotateAround$3 = Phaser.Math.RotateAround;
    var Transform = {
      worldToLocal: function worldToLocal(point) {
        // Transform
        point.x -= this.x;
        point.y -= this.y; // Rotate
  
        RotateAround$3(point, 0, 0, -this.rotation); // Scale
  
        point.x /= this.scaleX;
        point.y /= this.scaleY;
        return point;
      },
      localToWorld: function localToWorld(point) {
        // Scale
        point.x *= this.scaleX;
        point.y *= this.scaleY; // Rotate
  
        RotateAround$3(point, 0, 0, this.rotation); // Transform
  
        point.x += this.x;
        point.y += this.y;
        return point;
      }
    };
  
    var GetScale = function GetScale(a, b) {
      if (a === b) {
        return 1;
      } else {
        return a / b;
      }
    };
  
    var Position = {
      updateChildPosition: function updateChildPosition(child) {
        if (child.isRexContainerLite) {
          child.syncChildrenEnable = false;
        }
  
        var state = GetLocalState(child);
        var parent = state.parent;
  
        if (state.syncPosition) {
          child.x = state.x;
          child.y = state.y;
          parent.localToWorld(child);
        }
  
        if (state.syncRotation) {
          child.rotation = state.rotation + parent.rotation;
        }
  
        if (state.syncScale) {
          child.scaleX = state.scaleX * parent.scaleX;
          child.scaleY = state.scaleY * parent.scaleY;
        }
  
        if (child.isRexContainerLite) {
          child.syncChildrenEnable = true;
          child.syncPosition();
        }
  
        return this;
      },
      syncPosition: function syncPosition() {
        if (this.syncChildrenEnable) {
          this.children.forEach(this.updateChildPosition, this);
        }
  
        return this;
      },
      resetChildPositionState: function resetChildPositionState(child) {
        var state = GetLocalState(child);
        var parent = state.parent;
        state.x = child.x;
        state.y = child.y;
        parent.worldToLocal(state);
        state.scaleX = GetScale(child.scaleX, parent.scaleX);
        state.scaleY = GetScale(child.scaleY, parent.scaleY);
        state.rotation = child.rotation - parent.rotation;
        return this;
      },
      setChildPosition: function setChildPosition(child, x, y) {
        child.x = x;
        child.y = y;
        this.resetChildPositionState(child);
        return this;
      },
      setChildLocalPosition: function setChildLocalPosition(child, x, y) {
        var state = GetLocalState(child);
        state.x = x;
        state.y = y;
        this.updateChildPosition(child);
        return this;
      },
      resetLocalPositionState: function resetLocalPositionState() {
        var parent = GetLocalState(this).parent;
  
        if (parent) {
          parent.resetChildPositionState(this);
        }
  
        return this;
      }
    };
  
    var DegToRad$1 = Phaser.Math.DegToRad;
    var Rotation = {
      updateChildRotation: function updateChildRotation(child) {
        var state = GetLocalState(child);
        var parent = state.parent;
  
        if (state.syncRotation) {
          child.rotation = parent.rotation + state.rotation;
        }
  
        return this;
      },
      syncRotation: function syncRotation() {
        if (this.syncChildrenEnable) {
          this.children.forEach(this.updateChildRotation, this);
        }
  
        return this;
      },
      resetChildRotationState: function resetChildRotationState(child) {
        var state = GetLocalState(child);
        var parent = state.parent;
        state.rotation = child.rotation - parent.rotation;
        return this;
      },
      setChildRotation: function setChildRotation(child, rotation) {
        child.rotation = rotation;
        this.resetChildRotationState(child);
        return this;
      },
      setChildAngle: function setChildAngle(child, angle) {
        child.angle = angle;
        this.resetChildRotationState(child);
        return this;
      },
      setChildLocalRotation: function setChildLocalRotation(child, rotation) {
        var state = GetLocalState(child);
        state.rotation = rotation;
        this.updateChildRotation(child);
        return this;
      },
      setChildLocalAngle: function setChildLocalAngle(child, angle) {
        var state = GetLocalState(child);
        state.rotation = DegToRad$1(angle);
        this.updateChildRotation(child);
        return this;
      },
      resetLocalRotationState: function resetLocalRotationState() {
        var parent = GetLocalState(this).parent;
  
        if (parent) {
          parent.resetChildRotationState(this);
        }
  
        return this;
      }
    };
  
    var Scale$1 = {
      updateChildScale: function updateChildScale(child) {
        var state = GetLocalState(child);
        var parent = state.parent;
  
        if (state.syncScale) {
          child.scaleX = parent.scaleX * state.scaleX;
          child.scaleY = parent.scaleY * state.scaleY;
        }
  
        return this;
      },
      syncScale: function syncScale() {
        if (this.syncChildrenEnable) {
          this.children.forEach(this.updateChildScale, this);
        }
  
        return this;
      },
      resetChildScaleState: function resetChildScaleState(child) {
        var state = GetLocalState(child);
        var parent = state.parent;
        state.scaleX = GetScale(child.scaleX, parent.scaleX);
        state.scaleY = GetScale(child.scaleY, parent.scaleY);
        return this;
      },
      setChildScale: function setChildScale(child, scaleX, scaleY) {
        if (scaleY === undefined) {
          scaleY = scaleX;
        }
  
        child.scaleX = scaleX;
        child.scaleY = scaleY;
        this.resetChildScaleState(child);
        return this;
      },
      setChildLocalScale: function setChildLocalScale(child, scaleX, scaleY) {
        if (scaleY === undefined) {
          scaleY = scaleX;
        }
  
        var state = GetLocalState(child);
        state.scaleX = scaleX;
        state.scaleY = scaleY;
        this.updateChildScale(child);
        return this;
      },
      setChildDisplaySize: function setChildDisplaySize(child, width, height) {
        child.setDisplaySize(width, height);
        this.resetChildScaleState(child);
        return this;
      },
      resetLocalScaleState: function resetLocalScaleState() {
        var parent = GetLocalState(this).parent;
  
        if (parent) {
          parent.resetChildScaleState(this);
        }
  
        return this;
      }
    };
  
    /*
  
    Visible in localState:
  
      - visible: original visible of child
      - maskVisible: invisible by parent mask, see MaskChildren.js
          - undefined (not in masking) : Equal to mask visible
          - true (mask visible) : Inside, or across parent's visible area
          - false (maske invisible) : Out of parent's visible area
  
    Visible result of child = (parent visible) && (child visible) && (mask visible)
    */
    var Visible = {
      updateChildVisible: function updateChildVisible(child) {
        var localState = GetLocalState(child);
        var parent = localState.parent;
        var maskVisible = localState.hasOwnProperty('maskVisible') ? localState.maskVisible : true;
        child.visible = parent.visible && localState.visible && maskVisible;
        return this;
      },
      syncVisible: function syncVisible() {
        if (this.syncChildrenEnable) {
          this.children.forEach(this.updateChildVisible, this);
        }
  
        return this;
      },
      resetChildVisibleState: function resetChildVisibleState(child) {
        var localState = GetLocalState(child); // Delete maskVisible property
  
        if (localState.hasOwnProperty('maskVisible')) {
          delete localState.maskVisible;
        }
  
        localState.visible = child.visible;
        return this;
      },
      setChildVisible: function setChildVisible(child, visible) {
        // Visible of child will be affect by parent's visible, and mask visible
        this.setChildLocalVisible(child, visible);
        return this;
      },
      // Internal method
      setChildLocalVisible: function setChildLocalVisible(child, visible) {
        if (visible === undefined) {
          visible = true;
        }
  
        var localState = GetLocalState(child);
        localState.visible = visible;
        this.updateChildVisible(child);
        return this;
      },
      // Internal method
      setChildMaskVisible: function setChildMaskVisible(child, visible) {
        if (visible === undefined) {
          visible = true;
        }
  
        var localState = GetLocalState(child);
        localState.maskVisible = visible;
        this.updateChildVisible(child);
        return this;
      },
      resetLocalVisibleState: function resetLocalVisibleState() {
        var parent = GetLocalState(this).parent;
  
        if (parent) {
          parent.resetChildVisibleState(this);
        }
  
        return this;
      }
    };
  
    var Alpha = {
      updateChildAlpha: function updateChildAlpha(child) {
        var state = GetLocalState(child);
        var parent = state.parent;
  
        if (state.syncAlpha) {
          child.alpha = parent.alpha * state.alpha;
        }
  
        return this;
      },
      syncAlpha: function syncAlpha() {
        if (this.syncChildrenEnable) {
          this.children.forEach(this.updateChildAlpha, this);
        }
  
        return this;
      },
      resetChildAlphaState: function resetChildAlphaState(child) {
        var state = GetLocalState(child);
        var parent = state.parent;
        state.alpha = GetScale(child.alpha, parent.alpha);
        return this;
      },
      setChildAlpha: function setChildAlpha(child, alpha) {
        child.alpha = alpha;
        this.resetChildAlphaState(child);
        return this;
      },
      setChildLocalAlpha: function setChildLocalAlpha(child, alpha) {
        var state = GetLocalState(child);
        state.alpha = alpha;
        this.updateChildAlpha(child);
        return this;
      },
      resetLocalAlphaState: function resetLocalAlphaState() {
        var parent = GetLocalState(this).parent;
  
        if (parent) {
          parent.resetChildAlphaState(this);
        }
  
        return this;
      }
    };
  
    var Active = {
      updateChildActive: function updateChildActive(child) {
        var localState = GetLocalState(child);
        var parent = localState.parent;
        child.active = parent.active && localState.active;
        return this;
      },
      syncActive: function syncActive() {
        if (this.syncChildrenEnable) {
          this.children.forEach(this.updateChildActive, this);
        }
  
        return this;
      },
      resetChildActiveState: function resetChildActiveState(child) {
        var localState = GetLocalState(child);
        localState.active = child.active;
        return this;
      },
      setChildActive: function setChildActive(child, active) {
        child.active = active;
        this.resetChildActiveState(child);
        return this;
      },
      setChildLocalActive: function setChildLocalActive(child, active) {
        if (active === undefined) {
          active = true;
        }
  
        var localState = GetLocalState(child);
        localState.active = active;
        this.updateChildActive(child);
        return this;
      },
      resetLocalActiveState: function resetLocalActiveState() {
        var parent = GetLocalState(this).parent;
  
        if (parent) {
          parent.resetChildActiveState(this);
        }
  
        return this;
      }
    };
  
    var ScrollFactor = {
      updateChildScrollFactor: function updateChildScrollFactor(child) {
        var localState = GetLocalState(child);
        var parent = localState.parent;
        child.setScrollFactor(parent.scrollFactorX, parent.scrollFactorY);
        return this;
      },
      syncScrollFactor: function syncScrollFactor() {
        if (this.syncChildrenEnable) {
          this.children.forEach(this.updateChildScrollFactor, this);
        }
  
        return this;
      }
    };
  
    var Mask = {
      updateChildMask: function updateChildMask(child) {
        // Don't propagate null mask to clear children's mask
        if (this.mask == null) {
          return this;
        }
  
        var maskGameObject = this.mask.hasOwnProperty('geometryMask') ? this.mask.geometryMask : this.mask.bitmapMask;
  
        if (maskGameObject !== child) {
          child.mask = this.mask;
        }
  
        return this;
      },
      syncMask: function syncMask() {
        if (this.syncChildrenEnable) {
          this.children.forEach(this.updateChildMask, this);
        }
  
        return this;
      },
      setMask: function setMask(mask) {
        this.mask = mask;
        return this;
      },
      clearMask: function clearMask(destroyMask) {
        if (destroyMask === undefined) {
          destroyMask = false;
        }
  
        if (destroyMask && this.mask) {
          this.mask.destroy();
        }
  
        this.mask = null;
        return this;
      }
    };
  
    var SortGameObjectsByDepth = function SortGameObjectsByDepth(gameObjects, descending) {
      if (gameObjects.length === 0) {
        return gameObjects;
      }
  
      if (descending === undefined) {
        descending = false;
      }
  
      var scene = gameObjects[0].scene;
      var displayList = scene.sys.displayList;
      displayList.depthSort();
  
      if (descending) {
        gameObjects.sort(function (childA, childB) {
          return displayList.getIndex(childB) - displayList.getIndex(childA);
        });
      } else {
        gameObjects.sort(function (childA, childB) {
          return displayList.getIndex(childA) - displayList.getIndex(childB);
        });
      }
  
      return gameObjects;
    };
  
    var Depth = {
      setDepth: function setDepth(value, containerOnly) {
        this.depth = value;
  
        if (!containerOnly && this.children) {
          var children = this.getAllChildren();
  
          for (var i = 0, cnt = children.length; i < cnt; i++) {
            children[i].depth = value;
          }
        }
  
        return this;
      },
      swapDepth: function swapDepth(containerB) {
        var depthA = this.depth;
        var depthB = containerB.depth;
        this.setDepth(depthB);
        containerB.setDepth(depthA);
        return this;
      },
      incDepth: function incDepth(inc) {
        this.depth += inc;
  
        if (this.children) {
          var children = this.getAllChildren();
  
          for (var i = 0, cnt = children.length; i < cnt; i++) {
            children[i].depth += inc;
          }
        }
  
        return this;
      },
      moveDepthBelow: function moveDepthBelow(gameObject) {
        var displayList = gameObject.scene.children;
        var children = this.getAllChildren([this]);
        SortGameObjectsByDepth(children);
  
        for (var i = 0, cnt = children.length; i < cnt; i++) {
          var child = children[i];
  
          if (displayList.exists(child)) {
            displayList.moveBelow(gameObject, child);
            break;
          }
        }
  
        return this;
      },
      moveDepthAbove: function moveDepthAbove(gameObject) {
        var displayList = gameObject.scene.children;
        var children = this.getAllChildren([this]);
        SortGameObjectsByDepth(children, true);
  
        for (var i = 0, cnt = children.length; i < cnt; i++) {
          var child = children[i];
  
          if (displayList.exists(child)) {
            displayList.moveAbove(gameObject, child);
            break;
          }
        }
  
        return this;
      }
    };
  
    var DepthFirstSearch = function DepthFirstSearch(root, callback) {
      var skip = callback(root);
  
      if (!skip && root.isRexContainerLite) {
        var children = root.children;
  
        for (var i = 0, cnt = children.length; i < cnt; i++) {
          DepthFirstSearch(children[i], callback);
        }
      }
    };
  
    var BreadthFirstSearch = function BreadthFirstSearch(root, callback) {
      var queue = [root];
  
      while (queue.length > 0) {
        var current = queue.shift();
        var skip = callback(current);
  
        if (!skip && current.isRexContainerLite) {
          queue.push.apply(queue, _toConsumableArray(current.children));
        }
      }
    };
  
    var ArrayUtils = Phaser.Utils.Array;
    var Children = {
      getChildren: function getChildren(out) {
        if (!out) {
          out = this.children; // Return internal children array
        } else {
          for (var i = 0, cnt = this.children.length; i < cnt; i++) {
            out.push(this.children[i]);
          } // Copy children
  
        }
  
        return out;
      },
      getAllChildren: function getAllChildren(out) {
        if (out === undefined) {
          out = [];
        }
  
        var root = this;
        BreadthFirstSearch(root, function (child) {
          // Don't add root
          if (child === root) {
            return;
          }
  
          out.push(child);
        });
        return out;
      },
      getAllVisibleChildren: function getAllVisibleChildren(out) {
        if (out === undefined) {
          out = [];
        }
  
        var root = this;
        BreadthFirstSearch(root, function (child) {
          // Don't add root
          if (child === root) {
            return;
          } // Don't add invisible child
  
  
          if (!child.visible) {
            return true;
          }
  
          out.push(child);
        });
        return out;
      },
      bfs: function bfs(callback, root) {
        if (root === undefined) {
          root = this;
        }
  
        BreadthFirstSearch(root, callback);
        return this;
      },
      dfs: function dfs(callback, root) {
        if (root === undefined) {
          root = this;
        }
  
        DepthFirstSearch(root, callback);
        return this;
      },
      contains: function contains(gameObject) {
        // Override Base.contains method
        var parent = GetParent(gameObject);
  
        if (!parent) {
          return false;
        } else if (parent === this) {
          return true;
        } else {
          return this.contains(parent);
        }
      },
      getByName: function getByName(name, recursive) {
        if (!recursive) {
          return ArrayUtils.GetFirst(this.children, 'name', name); // object, or null if not found
        } else {
          // recursive
          // Breadth-first search
          var queue = [this];
          var parent, child;
  
          while (queue.length) {
            parent = queue.shift();
  
            for (var i = 0, cnt = parent.children.length; i < cnt; i++) {
              child = parent.children[i];
  
              if (child.name === name) {
                return child;
              } else if (child.isRexContainerLite) {
                queue.push(child);
              }
            }
          }
  
          return null;
        }
      },
      getRandom: function getRandom(startIndex, length) {
        return ArrayUtils.GetRandom(this.children, startIndex, length);
      },
      getFirst: function getFirst(property, value, startIndex, endIndex) {
        return ArrayUtils.GetFirstElement(this.children, property, value, startIndex, endIndex);
      },
      getAll: function getAll(property, value, startIndex, endIndex) {
        return ArrayUtils.GetAll(this.children, property, value, startIndex, endIndex);
      },
      count: function count(property, value, startIndex, endIndex) {
        return ArrayUtils.CountAllMatching(this.children, property, value, startIndex, endIndex);
      },
      swap: function swap(child1, child2) {
        ArrayUtils.Swap(this.children, child1, child2);
        return this;
      },
      setAll: function setAll(property, value, startIndex, endIndex) {
        ArrayUtils.SetAll(this.children, property, value, startIndex, endIndex);
        return this;
      }
    };
  
    var GetLocalStates = function GetLocalStates(gameObjects) {
      var localStates = [];
  
      for (var i = 0, cnt = gameObjects.length; i < cnt; i++) {
        var gameObject = gameObjects[i];
  
        if (!gameObject.hasOwnProperty('rexContainer')) {
          continue;
        }
  
        localStates.push(gameObject.rexContainer);
      }
  
      return localStates;
    };
  
    var GetScene = function GetScene(gameObjects) {
      for (var i = 0, cnt = gameObjects.length; i < cnt; i++) {
        var scene = gameObjects[i].scene;
  
        if (scene) {
          return scene;
        }
      }
  
      return null;
    };
  
    var UpdateChild = function UpdateChild(tween, key, target) {
      if (!target.parent) {
        // target object was removed, so remove this tween too
        tween.remove();
        return;
      }
  
      var parent = target.parent;
      var child = target.self;
  
      switch (key) {
        case 'x':
        case 'y':
          parent.updateChildPosition(child);
          break;
  
        case 'angle':
        case 'rotation':
          parent.updateChildRotation(child);
          break;
  
        case 'scaleX':
        case 'scaleY':
        case 'displayWidth':
        case 'displayHeight':
          parent.updateChildScale(child);
          break;
  
        case 'alpha':
          parent.updateChildAlpha(child);
          break;
  
        default:
          parent.updateChildPosition(child);
          parent.updateChildRotation(child);
          parent.updateChildScale(child);
          parent.updateChildAlpha(child);
          break;
      }
    };
  
    var Tween = {
      tweenChild: function tweenChild(tweenConfig) {
        var targets = tweenConfig.targets;
  
        if (!Array.isArray(targets)) {
          targets = [targets];
        }
  
        var scene = this.scene || GetScene(targets);
  
        if (!scene) {
          return;
        } // Map child game objects to local states
  
  
        tweenConfig.targets = GetLocalStates(targets);
        var tween = scene.tweens.add(tweenConfig); // Update child game object in 'update' event
  
        tween.on('update', UpdateChild);
        return tween;
      },
      createTweenChildConfig: function createTweenChildConfig(tweenConfig) {
        var targets = tweenConfig.targets;
  
        if (targets) {
          if (!Array.isArray(targets)) {
            targets = [targets];
          } // Map child game objects to local states
  
  
          tweenConfig.targets = GetLocalStates(targets);
        }
  
        var onUpdate = tweenConfig.onUpdate;
  
        tweenConfig.onUpdate = function (tween, target) {
          if (onUpdate) {
            onUpdate(tween, target);
          }
  
          UpdateChild(tween, undefined, target);
        };
  
        return tweenConfig;
      },
      tween: function tween(tweenConfig) {
        var scene = this.scene;
  
        if (!tweenConfig.targets) {
          tweenConfig.targets = this;
        }
  
        return scene.tweens.add(tweenConfig);
      },
      timelineChild: function timelineChild(timelineConfig) {
        var targets = timelineConfig.targets; // Map child game objects to local states
  
        if (targets) {
          if (!Array.isArray(targets)) {
            targets = [targets];
          }
  
          timelineConfig.targets = GetLocalStates(targets);
        }
  
        var tweens = timelineConfig.tweens;
  
        for (var i = 0, cnt = tweens.length; i < cnt; i++) {
          tweens[i] = this.createTweenChildConfig(tweens[i]);
        }
  
        var timeline = this.scene.tweens.timeline(timelineConfig);
        return timeline;
      }
    };
  
    var AddToLayer = function AddToLayer(layer) {
      var gameObjects = this.getAllChildren([this]);
      SortGameObjectsByDepth(gameObjects);
      layer.add(gameObjects);
      return this;
    };
  
    var AddToContainer = {
      addToLayer: AddToLayer,
      addToContainer: AddToLayer
    };
  
    var RotateAround$2 = Phaser.Math.RotateAround;
  
    var ChangeOrigin$1 = function ChangeOrigin(gameObject, originX, originY) {
      if (originY === undefined) {
        originY = originX;
      }
  
      var deltaXY = {
        x: (originX - gameObject.originX) * gameObject.displayWidth,
        y: (originY - gameObject.originY) * gameObject.displayHeight
      };
      RotateAround$2(deltaXY, 0, 0, gameObject.rotation);
      gameObject.originX = originX;
      gameObject.originY = originY;
      gameObject.x = gameObject.x + deltaXY.x;
      gameObject.y = gameObject.y + deltaXY.y;
      return gameObject;
    };
  
    var ChangeOrigin = function ChangeOrigin(originX, originY) {
      this.syncChildrenEnable = false;
      ChangeOrigin$1(this, originX, originY);
      this.syncChildrenEnable = true;
      var children = this.getAllChildren();
  
      for (var i = 0, cnt = children.length; i < cnt; i++) {
        this.resetChildPositionState(children[i]);
      }
  
      return this;
    };
  
    var methods$6 = {
      changeOrigin: ChangeOrigin
    };
    Object.assign(methods$6, Parent, AddChild$1, RemoveChild$1, ChildState, Transform, Position, Rotation, Scale$1, Visible, Alpha, Active, ScrollFactor, Mask, Depth, Children, Tween, AddToContainer);
  
    var ContainerLite = /*#__PURE__*/function (_Base) {
      _inherits(ContainerLite, _Base);
  
      var _super = _createSuper(ContainerLite);
  
      function ContainerLite(scene, x, y, width, height, children) {
        var _this;
  
        _classCallCheck(this, ContainerLite);
  
        _this = _super.call(this, scene, x, y, width, height);
        _this.type = 'rexContainerLite';
        _this.isRexContainerLite = true;
        _this.syncChildrenEnable = true;
        _this._active = true;
        _this._mask = null;
        _this._scrollFactorX = 1;
        _this._scrollFactorY = 1;
  
        if (children) {
          _this.add(children);
        }
  
        return _this;
      }
  
      _createClass(ContainerLite, [{
        key: "destroy",
        value: function destroy(fromScene) {
          //  This Game Object has already been destroyed
          if (!this.scene) {
            return;
          }
  
          this.syncChildrenEnable = false; // Don't sync properties changing anymore
  
          _get(_getPrototypeOf(ContainerLite.prototype), "destroy", this).call(this, fromScene);
        }
      }, {
        key: "resize",
        value: function resize(width, height) {
          this.setSize(width, height);
          return this;
        }
      }, {
        key: "x",
        get: function get() {
          return this._x;
        },
        set: function set(value) {
          if (this._x === value) {
            return;
          }
  
          this._x = value;
          this.syncPosition();
        }
      }, {
        key: "y",
        get: function get() {
          return this._y;
        },
        set: function set(value) {
          if (this._y === value) {
            return;
          }
  
          this._y = value;
          this.syncPosition();
        } // Override
  
      }, {
        key: "rotation",
        get: function get() {
          return _get(_getPrototypeOf(ContainerLite.prototype), "rotation", this);
        },
        set: function set(value) {
          if (this.rotation === value) {
            return;
          }
  
          _set(_getPrototypeOf(ContainerLite.prototype), "rotation", value, this, true);
  
          this.syncPosition();
        } // Override
  
      }, {
        key: "scaleX",
        get: function get() {
          return _get(_getPrototypeOf(ContainerLite.prototype), "scaleX", this);
        },
        set: function set(value) {
          if (this.scaleX === value) {
            return;
          }
  
          _set(_getPrototypeOf(ContainerLite.prototype), "scaleX", value, this, true);
  
          this.syncPosition();
        } // Override
  
      }, {
        key: "scaleY",
        get: function get() {
          return _get(_getPrototypeOf(ContainerLite.prototype), "scaleY", this);
        },
        set: function set(value) {
          if (this.scaleY === value) {
            return;
          }
  
          _set(_getPrototypeOf(ContainerLite.prototype), "scaleY", value, this, true);
  
          this.syncPosition();
        } // Override
  
      }, {
        key: "scale",
        get: function get() {
          return _get(_getPrototypeOf(ContainerLite.prototype), "scale", this);
        },
        set: function set(value) {
          if (this.scale === value) {
            return;
          }
  
          _set(_getPrototypeOf(ContainerLite.prototype), "scale", value, this, true);
  
          this.syncPosition();
        } // Override
  
      }, {
        key: "visible",
        get: function get() {
          return _get(_getPrototypeOf(ContainerLite.prototype), "visible", this);
        },
        set: function set(value) {
          if (_get(_getPrototypeOf(ContainerLite.prototype), "visible", this) === value) {
            return;
          }
  
          _set(_getPrototypeOf(ContainerLite.prototype), "visible", value, this, true);
  
          this.syncVisible();
        } // Override
  
      }, {
        key: "alpha",
        get: function get() {
          return _get(_getPrototypeOf(ContainerLite.prototype), "alpha", this);
        },
        set: function set(value) {
          if (_get(_getPrototypeOf(ContainerLite.prototype), "alpha", this) === value) {
            return;
          }
  
          _set(_getPrototypeOf(ContainerLite.prototype), "alpha", value, this, true);
  
          this.syncAlpha();
        } // Override
  
      }, {
        key: "active",
        get: function get() {
          return this._active;
        },
        set: function set(value) {
          if (this._active === value) {
            return;
          }
  
          this._active = value;
          this.syncActive();
        } // Override
  
      }, {
        key: "mask",
        get: function get() {
          return this._mask;
        },
        set: function set(mask) {
          if (this._mask === mask) {
            return;
          }
  
          this._mask = mask;
          this.syncMask();
        } // Override
  
      }, {
        key: "scrollFactorX",
        get: function get() {
          return this._scrollFactorX;
        },
        set: function set(value) {
          if (this._scrollFactorX === value) {
            return;
          }
  
          this._scrollFactorX = value;
          this.syncScrollFactor();
        }
      }, {
        key: "scrollFactorY",
        get: function get() {
          return this._scrollFactorY;
        },
        set: function set(value) {
          if (this._scrollFactorY === value) {
            return;
          }
  
          this._scrollFactorY = value;
          this.syncScrollFactor();
        } // Compatiable with container plugin
  
      }, {
        key: "list",
        get: function get() {
          return this.children;
        }
      }], [{
        key: "GetParent",
        value: function GetParent$1(child) {
          return GetParent(child);
        }
      }]);
  
      return ContainerLite;
    }(Base$1);
  
    Object.assign(ContainerLite.prototype, methods$6);
  
    var GetSizerConfig = function GetSizerConfig(gameObject) {
      if (!gameObject.hasOwnProperty('rexSizer')) {
        gameObject.rexSizer = {};
      }
  
      return gameObject.rexSizer;
    };
  
    var GetChildPrevState = function GetChildPrevState(child) {
      var childConfig = GetSizerConfig(child);
  
      if (!childConfig.hasOwnProperty('prevState')) {
        childConfig.prevState = {};
      }
  
      return childConfig.prevState;
    };
  
    var Rectangle$1 = Phaser.Geom.Rectangle;
    Phaser.Scale.Center;
  
    var GetViewport = function GetViewport(scene, out) {
      if (out === undefined) {
        out = new Rectangle$1();
      } else if (out === true) {
        out = globRect;
      }
  
      var scaleManager = scene.sys.scale;
      var baseSize = scaleManager.baseSize;
      var parentSize = scaleManager.parentSize;
      var canvasBounds = scaleManager.canvasBounds;
      var displayScale = scaleManager.displayScale;
      var x = canvasBounds.x >= 0 ? 0 : -(canvasBounds.x * displayScale.x);
      var y = canvasBounds.y >= 0 ? 0 : -(canvasBounds.y * displayScale.y);
      var width;
  
      if (parentSize.width >= canvasBounds.width) {
        width = baseSize.width;
      } else {
        width = baseSize.width - (canvasBounds.width - parentSize.width) * displayScale.x;
      }
  
      var height;
  
      if (parentSize.height >= canvasBounds.height) {
        height = baseSize.height;
      } else {
        height = baseSize.height - (canvasBounds.height - parentSize.height) * displayScale.y;
      }
  
      out.setTo(x, y, width, height);
      return out;
    };
  
    var globRect = new Rectangle$1();
  
    var PushIntoBounds = function PushIntoBounds(bounds) {
      if (bounds === undefined) {
        bounds = GetViewport(this.scene);
      }
  
      this.left = Math.max(this.left, bounds.left);
      this.right = Math.min(this.right, bounds.right);
      this.top = Math.max(this.top, bounds.top);
      this.bottom = Math.min(this.bottom, bounds.bottom);
      return this;
    };
  
    var ALIGN$1 = Phaser.Display.Align;
    var ALIGNMODE = {
      center: ALIGN$1.CENTER,
      left: ALIGN$1.LEFT_CENTER,
      right: ALIGN$1.RIGHT_CENTER,
      top: ALIGN$1.TOP_CENTER,
      bottom: ALIGN$1.BOTTOM_CENTER,
      'left-top': ALIGN$1.TOP_LEFT,
      'left-center': ALIGN$1.LEFT_CENTER,
      'left-bottom': ALIGN$1.BOTTOM_LEFT,
      'center-top': ALIGN$1.TOP_CENTER,
      'center-center': ALIGN$1.CENTER,
      'center-bottom': ALIGN$1.BOTTOM_CENTER,
      'right-top': ALIGN$1.TOP_RIGHT,
      'right-center': ALIGN$1.RIGHT_CENTER,
      'right-bottom': ALIGN$1.BOTTOM_RIGHT
    };
  
    var NOOP = function NOOP() {//  NOOP
    };
  
    var globZone = new Phaser.GameObjects.Zone({
      sys: {
        queueDepthSort: NOOP,
        events: {
          once: NOOP
        }
      }
    }, 0, 0, 1, 1);
    globZone.setOrigin(0);
  
    var ALIGN_CONST = {
      /**
      * A constant representing a top-left alignment or position.
      * @constant
      * @name Phaser.Display.Align.TOP_LEFT
      * @since 3.0.0
      * @type {integer}
      */
      TOP_LEFT: 0,
  
      /**
      * A constant representing a top-center alignment or position.
      * @constant
      * @name Phaser.Display.Align.TOP_CENTER
      * @since 3.0.0
      * @type {integer}
      */
      TOP_CENTER: 1,
  
      /**
      * A constant representing a top-right alignment or position.
      * @constant
      * @name Phaser.Display.Align.TOP_RIGHT
      * @since 3.0.0
      * @type {integer}
      */
      TOP_RIGHT: 2,
  
      /**
      * A constant representing a left-top alignment or position.
      * @constant
      * @name Phaser.Display.Align.LEFT_TOP
      * @since 3.0.0
      * @type {integer}
      */
      LEFT_TOP: 3,
  
      /**
      * A constant representing a left-center alignment or position.
      * @constant
      * @name Phaser.Display.Align.LEFT_CENTER
      * @since 3.0.0
      * @type {integer}
      */
      LEFT_CENTER: 4,
  
      /**
      * A constant representing a left-bottom alignment or position.
      * @constant
      * @name Phaser.Display.Align.LEFT_BOTTOM
      * @since 3.0.0
      * @type {integer}
      */
      LEFT_BOTTOM: 5,
  
      /**
      * A constant representing a center alignment or position.
      * @constant
      * @name Phaser.Display.Align.CENTER
      * @since 3.0.0
      * @type {integer}
      */
      CENTER: 6,
  
      /**
      * A constant representing a right-top alignment or position.
      * @constant
      * @name Phaser.Display.Align.RIGHT_TOP
      * @since 3.0.0
      * @type {integer}
      */
      RIGHT_TOP: 7,
  
      /**
      * A constant representing a right-center alignment or position.
      * @constant
      * @name Phaser.Display.Align.RIGHT_CENTER
      * @since 3.0.0
      * @type {integer}
      */
      RIGHT_CENTER: 8,
  
      /**
      * A constant representing a right-bottom alignment or position.
      * @constant
      * @name Phaser.Display.Align.RIGHT_BOTTOM
      * @since 3.0.0
      * @type {integer}
      */
      RIGHT_BOTTOM: 9,
  
      /**
      * A constant representing a bottom-left alignment or position.
      * @constant
      * @name Phaser.Display.Align.BOTTOM_LEFT
      * @since 3.0.0
      * @type {integer}
      */
      BOTTOM_LEFT: 10,
  
      /**
      * A constant representing a bottom-center alignment or position.
      * @constant
      * @name Phaser.Display.Align.BOTTOM_CENTER
      * @since 3.0.0
      * @type {integer}
      */
      BOTTOM_CENTER: 11,
  
      /**
      * A constant representing a bottom-right alignment or position.
      * @constant
      * @name Phaser.Display.Align.BOTTOM_RIGHT
      * @since 3.0.0
      * @type {integer}
      */
      BOTTOM_RIGHT: 12
    };
  
    var GetDisplayWidth = function GetDisplayWidth(gameObject) {
      if (gameObject.displayWidth !== undefined) {
        return gameObject.displayWidth;
      } else {
        return gameObject.width;
      }
    };
  
    var GetDisplayHeight = function GetDisplayHeight(gameObject) {
      if (gameObject.displayHeight !== undefined) {
        return gameObject.displayHeight;
      } else {
        return gameObject.height;
      }
    };
  
    var GetBottom = function GetBottom(gameObject) {
      var height = GetDisplayHeight(gameObject);
      return gameObject.y + height - height * gameObject.originY;
    };
  
    var GetCenterX = function GetCenterX(gameObject) {
      var width = GetDisplayWidth(gameObject);
      return gameObject.x - width * gameObject.originX + width * 0.5;
    };
  
    var SetBottom = function SetBottom(gameObject, value) {
      var height = GetDisplayHeight(gameObject);
      gameObject.y = value - height + height * gameObject.originY;
      return gameObject;
    };
  
    var SetCenterX = function SetCenterX(gameObject, x) {
      var width = GetDisplayWidth(gameObject);
      var offsetX = width * gameObject.originX;
      gameObject.x = x + offsetX - width * 0.5;
      return gameObject;
    };
  
    var BottomCenter = function BottomCenter(gameObject, alignIn, offsetX, offsetY) {
      if (offsetX === undefined) {
        offsetX = 0;
      }
  
      if (offsetY === undefined) {
        offsetY = 0;
      }
  
      SetCenterX(gameObject, GetCenterX(alignIn) + offsetX);
      SetBottom(gameObject, GetBottom(alignIn) + offsetY);
      return gameObject;
    };
  
    var GetLeft = function GetLeft(gameObject) {
      var width = GetDisplayWidth(gameObject);
      return gameObject.x - width * gameObject.originX;
    };
  
    var SetLeft = function SetLeft(gameObject, value) {
      var width = GetDisplayWidth(gameObject);
      gameObject.x = value + width * gameObject.originX;
      return gameObject;
    };
  
    var BottomLeft = function BottomLeft(gameObject, alignIn, offsetX, offsetY) {
      if (offsetX === undefined) {
        offsetX = 0;
      }
  
      if (offsetY === undefined) {
        offsetY = 0;
      }
  
      SetLeft(gameObject, GetLeft(alignIn) - offsetX);
      SetBottom(gameObject, GetBottom(alignIn) + offsetY);
      return gameObject;
    };
  
    var GetRight = function GetRight(gameObject) {
      var width = GetDisplayWidth(gameObject);
      return gameObject.x + width - width * gameObject.originX;
    };
  
    var SetRight = function SetRight(gameObject, value) {
      var width = GetDisplayWidth(gameObject);
      gameObject.x = value - width + width * gameObject.originX;
      return gameObject;
    };
  
    var BottomRight = function BottomRight(gameObject, alignIn, offsetX, offsetY) {
      if (offsetX === undefined) {
        offsetX = 0;
      }
  
      if (offsetY === undefined) {
        offsetY = 0;
      }
  
      SetRight(gameObject, GetRight(alignIn) + offsetX);
      SetBottom(gameObject, GetBottom(alignIn) + offsetY);
      return gameObject;
    };
  
    var SetCenterY = function SetCenterY(gameObject, y) {
      var height = GetDisplayHeight(gameObject);
      var offsetY = height * gameObject.originY;
      gameObject.y = y + offsetY - height * 0.5;
      return gameObject;
    };
  
    var CenterOn = function CenterOn(gameObject, x, y) {
      SetCenterX(gameObject, x);
      return SetCenterY(gameObject, y);
    };
  
    var GetCenterY = function GetCenterY(gameObject) {
      var height = GetDisplayHeight(gameObject);
      return gameObject.y - height * gameObject.originY + height * 0.5;
    };
  
    var Center = function Center(gameObject, alignIn, offsetX, offsetY) {
      if (offsetX === undefined) {
        offsetX = 0;
      }
  
      if (offsetY === undefined) {
        offsetY = 0;
      }
  
      CenterOn(gameObject, GetCenterX(alignIn) + offsetX, GetCenterY(alignIn) + offsetY);
      return gameObject;
    };
  
    var LeftCenter = function LeftCenter(gameObject, alignIn, offsetX, offsetY) {
      if (offsetX === undefined) {
        offsetX = 0;
      }
  
      if (offsetY === undefined) {
        offsetY = 0;
      }
  
      SetLeft(gameObject, GetLeft(alignIn) - offsetX);
      SetCenterY(gameObject, GetCenterY(alignIn) + offsetY);
      return gameObject;
    };
  
    var RightCenter = function RightCenter(gameObject, alignIn, offsetX, offsetY) {
      if (offsetX === undefined) {
        offsetX = 0;
      }
  
      if (offsetY === undefined) {
        offsetY = 0;
      }
  
      SetRight(gameObject, GetRight(alignIn) + offsetX);
      SetCenterY(gameObject, GetCenterY(alignIn) + offsetY);
      return gameObject;
    };
  
    var GetTop = function GetTop(gameObject) {
      var height = GetDisplayHeight(gameObject);
      return gameObject.y - height * gameObject.originY;
    };
  
    var SetTop = function SetTop(gameObject, value) {
      var height = GetDisplayHeight(gameObject);
      gameObject.y = value + height * gameObject.originY;
      return gameObject;
    };
  
    var TopCenter = function TopCenter(gameObject, alignIn, offsetX, offsetY) {
      if (offsetX === undefined) {
        offsetX = 0;
      }
  
      if (offsetY === undefined) {
        offsetY = 0;
      }
  
      SetCenterX(gameObject, GetCenterX(alignIn) + offsetX);
      SetTop(gameObject, GetTop(alignIn) - offsetY);
      return gameObject;
    };
  
    var TopLeft = function TopLeft(gameObject, alignIn, offsetX, offsetY) {
      if (offsetX === undefined) {
        offsetX = 0;
      }
  
      if (offsetY === undefined) {
        offsetY = 0;
      }
  
      SetLeft(gameObject, GetLeft(alignIn) - offsetX);
      SetTop(gameObject, GetTop(alignIn) - offsetY);
      return gameObject;
    };
  
    var TopRight = function TopRight(gameObject, alignIn, offsetX, offsetY) {
      if (offsetX === undefined) {
        offsetX = 0;
      }
  
      if (offsetY === undefined) {
        offsetY = 0;
      }
  
      SetRight(gameObject, GetRight(alignIn) + offsetX);
      SetTop(gameObject, GetTop(alignIn) - offsetY);
      return gameObject;
    };
  
    var AlignInMap = [];
    AlignInMap[ALIGN_CONST.BOTTOM_CENTER] = BottomCenter;
    AlignInMap[ALIGN_CONST.BOTTOM_LEFT] = BottomLeft;
    AlignInMap[ALIGN_CONST.BOTTOM_RIGHT] = BottomRight;
    AlignInMap[ALIGN_CONST.CENTER] = Center;
    AlignInMap[ALIGN_CONST.LEFT_CENTER] = LeftCenter;
    AlignInMap[ALIGN_CONST.RIGHT_CENTER] = RightCenter;
    AlignInMap[ALIGN_CONST.TOP_CENTER] = TopCenter;
    AlignInMap[ALIGN_CONST.TOP_LEFT] = TopLeft;
    AlignInMap[ALIGN_CONST.TOP_RIGHT] = TopRight;
  
    var QuickSet = function QuickSet(child, alignIn, position, offsetX, offsetY) {
      return AlignInMap[position](child, alignIn, offsetX, offsetY);
    };
  
    var AlignIn = function AlignIn(child, x, y, width, height, align) {
      globZone.setPosition(x, y).setSize(width, height);
      QuickSet(child, globZone, align);
    };
  
    var Rectangle = Phaser.Geom.Rectangle;
    var Vector2 = Phaser.Math.Vector2;
    var RotateAround$1 = Phaser.Math.RotateAround;
  
    var GetBounds = function GetBounds(gameObject, output) {
      if (output === undefined) {
        output = new Rectangle();
      } else if (output === true) {
        if (GlobRect$1 === undefined) {
          GlobRect$1 = new Rectangle();
        }
  
        output = GlobRect$1;
      }
  
      if (gameObject.getBounds) {
        return gameObject.getBounds(output);
      } //  We can use the output object to temporarily store the x/y coords in:
  
  
      var TLx, TLy, TRx, TRy, BLx, BLy, BRx, BRy; // Instead of doing a check if parent container is
      // defined per corner we only do it once.
  
      if (gameObject.parentContainer) {
        var parentMatrix = gameObject.parentContainer.getBoundsTransformMatrix();
        GetTopLeft(gameObject, output);
        parentMatrix.transformPoint(output.x, output.y, output);
        TLx = output.x;
        TLy = output.y;
        GetTopRight(gameObject, output);
        parentMatrix.transformPoint(output.x, output.y, output);
        TRx = output.x;
        TRy = output.y;
        GetBottomLeft(gameObject, output);
        parentMatrix.transformPoint(output.x, output.y, output);
        BLx = output.x;
        BLy = output.y;
        GetBottomRight(gameObject, output);
        parentMatrix.transformPoint(output.x, output.y, output);
        BRx = output.x;
        BRy = output.y;
      } else {
        GetTopLeft(gameObject, output);
        TLx = output.x;
        TLy = output.y;
        GetTopRight(gameObject, output);
        TRx = output.x;
        TRy = output.y;
        GetBottomLeft(gameObject, output);
        BLx = output.x;
        BLy = output.y;
        GetBottomRight(gameObject, output);
        BRx = output.x;
        BRy = output.y;
      }
  
      output.x = Math.min(TLx, TRx, BLx, BRx);
      output.y = Math.min(TLy, TRy, BLy, BRy);
      output.width = Math.max(TLx, TRx, BLx, BRx) - output.x;
      output.height = Math.max(TLy, TRy, BLy, BRy) - output.y;
      return output;
    };
  
    var GlobRect$1 = undefined;
  
    var GetTopLeft = function GetTopLeft(gameObject, output, includeParent) {
      if (output === undefined) {
        output = new Vector2();
      } else if (output === true) {
        if (GlobVector === undefined) {
          GlobVector = new Vector2();
        }
  
        output = GlobVector;
      }
  
      if (gameObject.getTopLeft) {
        return gameObject.getTopLeft(output);
      }
  
      output.x = gameObject.x - GetDisplayWidth(gameObject) * gameObject.originX;
      output.y = gameObject.y - GetDisplayHeight(gameObject) * gameObject.originY;
      return PrepareBoundsOutput(gameObject, output, includeParent);
    };
  
    var GetTopRight = function GetTopRight(gameObject, output, includeParent) {
      if (output === undefined) {
        output = new Vector2();
      } else if (output === true) {
        if (GlobVector === undefined) {
          GlobVector = new Vector2();
        }
  
        output = GlobVector;
      }
  
      if (gameObject.getTopRight) {
        return gameObject.getTopRight(output);
      }
  
      output.x = gameObject.x - GetDisplayWidth(gameObject) * gameObject.originX + GetDisplayWidth(gameObject);
      output.y = gameObject.y - GetDisplayHeight(gameObject) * gameObject.originY;
      return PrepareBoundsOutput(gameObject, output, includeParent);
    };
  
    var GetBottomLeft = function GetBottomLeft(gameObject, output, includeParent) {
      if (output === undefined) {
        output = new Vector2();
      } else if (output === true) {
        if (GlobVector === undefined) {
          GlobVector = new Vector2();
        }
  
        output = GlobVector;
      }
  
      if (gameObject.getBottomLeft) {
        return gameObject.getBottomLeft(output);
      }
  
      output.x = gameObject.x - GetDisplayWidth(gameObject) * gameObject.originX;
      output.y = gameObject.y - GetDisplayHeight(gameObject) * gameObject.originY + GetDisplayHeight(gameObject);
      return PrepareBoundsOutput(gameObject, output, includeParent);
    };
  
    var GetBottomRight = function GetBottomRight(gameObject, output, includeParent) {
      if (output === undefined) {
        output = new Vector2();
      } else if (output === true) {
        if (GlobVector === undefined) {
          GlobVector = new Vector2();
        }
  
        output = GlobVector;
      }
  
      if (gameObject.getBottomRight) {
        return gameObject.getBottomRight(output);
      }
  
      output.x = gameObject.x - GetDisplayWidth(gameObject) * gameObject.originX + GetDisplayWidth(gameObject);
      output.y = gameObject.y - GetDisplayHeight(gameObject) * gameObject.originY + GetDisplayHeight(gameObject);
      return PrepareBoundsOutput(gameObject, output, includeParent);
    };
  
    var GlobVector = undefined;
  
    var PrepareBoundsOutput = function PrepareBoundsOutput(gameObject, output, includeParent) {
      if (includeParent === undefined) {
        includeParent = false;
      }
  
      if (gameObject.rotation !== 0) {
        RotateAround$1(output, gameObject.x, gameObject.y, gameObject.rotation);
      }
  
      if (includeParent && gameObject.parentContainer) {
        var parentMatrix = gameObject.parentContainer.getBoundsTransformMatrix();
        parentMatrix.transformPoint(output.x, output.y, output);
      }
  
      return output;
    };
  
    var GetValue$E = Phaser.Utils.Objects.GetValue;
    var Group = Phaser.GameObjects.Group;
  
    var DrawBounds = function DrawBounds(graphics, config) {
      var scene = graphics.scene;
      var color;
      var createTextCallback, createTextCallbackScope, textAlign;
  
      if (typeof config === 'number') {
        color = config;
      } else {
        color = GetValue$E(config, 'color', 0xffffff);
        var nameTextConfig = GetValue$E(config, 'name', false);
  
        if (nameTextConfig) {
          createTextCallback = GetValue$E(nameTextConfig, 'createTextCallback', DefaultCreateTextCallback);
          createTextCallbackScope = GetValue$E(nameTextConfig, 'createTextCallbackScope', undefined);
          textAlign = GetValue$E(nameTextConfig, 'align', 'left-top');
  
          if (typeof textAlign === 'string') {
            textAlign = ALIGNMODE[textAlign];
          }
        }
      }
  
      if (createTextCallback && !graphics.children) {
        graphics.children = new Group(scene);
        graphics.once('destroy', function (graphics, fromScene) {
          graphics.children.destroy(!fromScene);
          graphics.children = undefined;
        });
        var graphicsClear = graphics.clear.bind(graphics);
  
        graphics.clear = function () {
          graphicsClear();
          graphics.children.clear(false, true);
        };
      }
  
      var children = this.getAllShownChildren([this]),
          child;
      var nameText;
  
      for (var i = 0, cnt = children.length; i < cnt; i++) {
        child = children[i];
  
        if (child.getBounds || child.width !== undefined && child.height !== undefined) {
          GlobRect = GetBounds(child, GlobRect);
        } else {
          continue;
        }
  
        if (color != null) {
          graphics.lineStyle(1, color).strokeRectShape(GlobRect);
        }
  
        if (child.name && createTextCallback) {
          if (createTextCallbackScope) {
            nameText = createTextCallback.call(createTextCallbackScope, scene);
          } else {
            nameText = createTextCallback(scene);
          }
  
          if (nameText) {
            nameText.setText(child.name);
            graphics.children.add(nameText);
            AlignIn(nameText, GlobRect.x, GlobRect.y, GlobRect.width, GlobRect.height, textAlign);
          }
        }
      }
  
      return this;
    };
  
    var DefaultCreateTextCallback = function DefaultCreateTextCallback(scene, child, childBoundsRect) {
      return scene.add.text(0, 0, '');
    };
  
    var GlobRect = undefined;
  
    var GetValue$D = Phaser.Utils.Objects.GetValue;
  
    var GetBoundsConfig = function GetBoundsConfig(config, out) {
      if (out === undefined) {
        out = {};
      }
  
      if (typeof config === 'number') {
        out.left = config;
        out.right = config;
        out.top = config;
        out.bottom = config;
      } else {
        out.left = GetValue$D(config, 'left', 0);
        out.right = GetValue$D(config, 'right', 0);
        out.top = GetValue$D(config, 'top', 0);
        out.bottom = GetValue$D(config, 'bottom', 0);
      }
  
      return out;
    };
  
    var ContainerAdd = ContainerLite.prototype.add;
  
    var AddChild = function AddChild(gameObject) {
      ContainerAdd.call(this, gameObject);
  
      if (this.sizerEventsEnable) {
        gameObject.emit('sizer.add', gameObject, this);
        this.emit('add', gameObject, this);
      }
  
      return this;
    };
  
    var AddChildMethods$6 = {
      addBackground: function addBackground(gameObject, paddingConfig, childKey) {
        if (this.backgroundChildren === undefined) {
          this.backgroundChildren = [];
        }
  
        if (typeof paddingConfig === 'string') {
          childKey = paddingConfig;
          paddingConfig = undefined;
        }
  
        if (paddingConfig === undefined) {
          paddingConfig = 0;
        }
  
        AddChild.call(this, gameObject);
        this.backgroundChildren.push(gameObject);
        var config = this.getSizerConfig(gameObject);
        config.padding = GetBoundsConfig(paddingConfig);
  
        if (childKey !== undefined) {
          this.addChildrenMap(childKey, gameObject);
        }
  
        return this;
      },
      isBackground: function isBackground(gameObject) {
        if (this.backgroundChildren === undefined) {
          return false;
        }
  
        return this.backgroundChildren.indexOf(gameObject) !== -1;
      }
    };
  
    var RemoveChildMethods$6 = {
      removeFromParentSizer: function removeFromParentSizer() {
        var parent = this.getParentSizer();
  
        if (parent) {
          parent.remove(this);
        }
  
        return this;
      }
    };
  
    var AddChildrenMap = function AddChildrenMap(key, gameObject) {
      if (this.childrenMap === undefined) {
        this.childrenMap = {};
      }
  
      this.childrenMap[key] = gameObject;
      return this;
    };
  
    var RemoveChildrenMap = function RemoveChildrenMap(key) {
      if (_typeof(key) === 'object') {
        var gameObject = key;
  
        for (var key in this.childrenMap) {
          if (this.childrenMap[key] === gameObject) {
            delete this.childrenMap[key];
            return this;
          }
        }
      }
  
      delete this.childrenMap[key];
      return this;
    };
  
    var GetElement = function GetElement(mapNameList, recursive) {
      if (typeof mapNameList === 'string') {
        mapNameList = mapNameList.split('.');
      }
  
      if (mapNameList.length === 0) {
        return undefined;
      }
  
      var name = mapNameList.shift(),
          element = null;
  
      if (name.charAt(0) === '#') {
        // Get element by name
        name = name.substring(1);
        element = this.getByName(name, recursive);
      } else if (name.indexOf('[') === -1) {
        // Get element by key
        if (this.childrenMap) {
          element = this.childrenMap[name];
        }
      } else {
        // Get element by key[]
        var innerMatch = name.match(RE_OBJ);
  
        if (innerMatch != null) {
          if (this.childrenMap) {
            var elements = this.childrenMap[innerMatch[1]];
  
            if (elements) {
              element = elements[innerMatch[2]];
            }
          }
        }
      }
  
      if (mapNameList.length === 0) {
        return element;
      } else if (element && element.childrenMap) {
        return element.getElement(mapNameList);
      } else {
        return null;
      }
    };
  
    var RE_OBJ = /(\S+)\[(\d+)\]/i;
  
    var GetValue$C = Phaser.Utils.Objects.GetValue;
  
    var GetPadding = function GetPadding(padding, key) {
      if (key === undefined) {
        return padding;
      }
  
      return padding[key];
    };
  
    var SetPadding = function SetPadding(padding, key, value) {
      var keyType = _typeof(key);
  
      if (keyType === 'string') {
        padding[key] = value;
      } else if (keyType === 'number') {
        padding.left = key;
        padding.right = key;
        padding.top = key;
        padding.bottom = key;
      } else {
        padding.left = GetValue$C(key, 'left', 0);
        padding.right = GetValue$C(key, 'right', 0);
        padding.top = GetValue$C(key, 'top', 0);
        padding.bottom = GetValue$C(key, 'bottom', 0);
      }
    };
  
    var PaddingMethods = {
      getInnerPadding: function getInnerPadding(key) {
        return GetPadding(this.space, key);
      },
      setInnerPadding: function setInnerPadding(key, value) {
        SetPadding(this.space, key, value);
        return this;
      },
      getOuterPadding: function getOuterPadding(key) {
        return GetPadding(this.getSizerConfig(this).padding, key);
      },
      setOuterPadding: function setOuterPadding(key, value) {
        SetPadding(this.getSizerConfig(this).padding, key, value);
        return this;
      },
      getChildOuterPadding: function getChildOuterPadding(child, key) {
        if (typeof child === 'string') {
          child = this.getElement(child);
        }
  
        return GetPadding(this.getSizerConfig(child).padding, key);
      },
      setChildOuterPadding: function setChildOuterPadding(child, key, value) {
        if (typeof child === 'string') {
          child = this.getElement(child);
        }
  
        SetPadding(this.getSizerConfig(child).padding, key, value);
        return this;
      }
    };
  
    var ResolveWidth$2 = function ResolveWidth(width) {
      if (width === undefined) {
        width = Math.max(this.childrenWidth, this.minWidth);
      }
  
      return width;
    };
  
    var ResolveChildrenWidth$1 = function ResolveChildrenWidth(parentWidth) {
      // Resolve width of sizer children
      var child, childWidth;
  
      for (var i in this.sizerChildren) {
        child = this.sizerChildren[i];
  
        if (child && child.isRexSizer && !child.ignoreLayout) {
          childWidth = this.getExpandedChildWidth(child, parentWidth);
          childWidth = child.resolveWidth(childWidth);
          child.resolveChildrenWidth(childWidth);
        }
      }
    };
  
    var ResolveHeight$2 = function ResolveHeight(height) {
      var minHeight = Math.max(this.childrenHeight, this.minHeight);
  
      if (height === undefined) {
        height = minHeight;
      }
  
      return height;
    };
  
    var GetChildWidth$1 = function GetChildWidth(child) {
      var childWidth;
  
      if (child.isRexSizer) {
        // Sizer game object
        childWidth = Math.max(child.minWidth, child.childrenWidth);
      } else {
        // Normal game object
        if (child.minWidth !== undefined) {
          // Force minWidth
          childWidth = child.minWidth;
        } else {
          childWidth = GetDisplayWidth(child);
        }
      }
  
      return childWidth;
    };
  
    var GetChildHeight = function GetChildHeight(child) {
      var childHeight;
  
      if (child.isRexSizer) {
        // Sizer game object
        childHeight = Math.max(child.minHeight, child.childrenHeight);
      } else {
        // Normal game object
        if (child.minHeight !== undefined) {
          // Force minHeight
          childHeight = child.minHeight;
        } else {
          childHeight = GetDisplayHeight(child);
        }
      }
  
      return childHeight;
    };
  
    // Override
    var GetExpandedChildWidth$2 = function GetExpandedChildWidth(child, parentWidth) {
      return parentWidth;
    };
  
    // Override
    var GetExpandedChildHeight$2 = function GetExpandedChildHeight(child, parentHeight) {
      return parentHeight;
    };
  
    // Override
    var GetChildrenWidth$3 = function GetChildrenWidth() {
      return 0;
    };
  
    // Override
    var GetChildrenHeight$3 = function GetChildrenHeight() {
      return 0;
    };
  
    var GetAllChildrenSizers = function GetAllChildrenSizers(out) {
      if (out === undefined) {
        out = [];
      }
  
      var startIdx = out.length;
      var children = this.getChildrenSizers(out);
      var endIdx = out.length;
  
      for (var i = startIdx; i < endIdx; i++) {
        children[i].getAllChildrenSizers(out);
      }
  
      return out;
    };
  
    // Default method
    var GetChildrenSizers$3 = function GetChildrenSizers(out) {
      if (out === undefined) {
        out = [];
      }
  
      return out;
    };
  
    var GetShownChildrenMethods = {
      getShownChildren: function getShownChildren(out) {
        if (out === undefined) {
          out = [];
        }
  
        var children = this.children,
            child;
  
        for (var i = 0, cnt = children.length; i < cnt; i++) {
          child = children[i];
  
          if (child.rexSizer && child.rexSizer.hidden) {
            // Don't add hidden child
            continue;
          }
  
          out.push(child);
        }
  
        return out;
      },
      getAllShownChildren: function getAllShownChildren(out) {
        if (out === undefined) {
          out = [];
        }
  
        var children = this.children,
            child;
  
        for (var i = 0, cnt = children.length; i < cnt; i++) {
          child = children[i];
  
          if (child.rexSizer && child.rexSizer.hidden) {
            // Don't add hidden child
            continue;
          }
  
          out.push(child);
  
          if (child.hasOwnProperty('isRexContainerLite')) {
            var _out;
  
            (_out = out).push.apply(_out, _toConsumableArray(child.getAllShownChildren()));
          }
        }
  
        return out;
      }
    };
  
    var PreLayout$3 = function PreLayout() {
      this._childrenWidth = undefined;
      this._childrenHeight = undefined;
      var children = this.getChildrenSizers(),
          child;
  
      for (var i = 0, cnt = children.length; i < cnt; i++) {
        child = children[i];
  
        if (child.ignoreLayout) {
          continue;
        }
  
        child.preLayout();
      }
    };
  
    var Layout = function Layout() {
      this.runLayout();
      return this;
    };
  
    // Override
    var RunLayout = function RunLayout(parent, newWidth, newHeight) {
      // Skip hidden or !dirty sizer
      if (this.ignoreLayout) {
        return this;
      }
  
      var isTopmostParent = !parent; // Preprocessor, top parent only
  
      if (isTopmostParent) {
        this.preLayout();
      } // Calculate parent width
  
  
      newWidth = this.resolveWidth(newWidth); // Calculate all children width, run width wrap
  
      if (isTopmostParent) {
        this.resolveChildrenWidth(newWidth);
        this.runWidthWrap(newWidth);
      } // Calculate parent height
  
  
      newHeight = this.resolveHeight(newHeight); // Resize parent
  
      this.resize(newWidth, newHeight);
  
      if (this.sizerEventsEnable) {
        if (this.layoutedChildren === undefined) {
          this.layoutedChildren = [];
        }
      } // Layout children    
  
  
      this.layoutChildren(); // Layout background children
  
      this.layoutBackgrounds();
  
      if (this.sizerEventsEnable) {
        this.emit('postlayout', this.layoutedChildren, this);
        this.layoutedChildren.length = 0;
      }
  
      return this.postLayout();
    };
  
    // Override
    var LayoutChildren$3 = function LayoutChildren() {};
  
    var PostLayout = function PostLayout(parent, newWidth, newHeight) {
      if (this._anchor) {
        this._anchor.updatePosition();
      }
  
      return this;
    };
  
    // Default method
    var RunWidthWrap$2 = function RunWidthWrap(parentWidth) {
      var child, childWidth;
  
      for (var i in this.sizerChildren) {
        child = this.sizerChildren[i];
  
        if (!child || child.isRexSizer && child.ignoreLayout || !child.runWidthWrap) {
          continue;
        }
  
        childWidth = this.getExpandedChildWidth(child, parentWidth);
  
        if (child.isRexSizer) {
          childWidth = child.resolveWidth(childWidth);
        }
  
        child.runWidthWrap(childWidth);
      }
  
      return this;
    };
  
    var EventEmitterMethods = {
      setEventEmitter: function setEventEmitter(eventEmitter, EventEmitterClass) {
        if (EventEmitterClass === undefined) {
          EventEmitterClass = Phaser.Events.EventEmitter; // Use built-in EventEmitter class by default
        }
  
        this._privateEE = eventEmitter === true || eventEmitter === undefined;
        this._eventEmitter = this._privateEE ? new EventEmitterClass() : eventEmitter;
        return this;
      },
      destroyEventEmitter: function destroyEventEmitter() {
        if (this._eventEmitter && this._privateEE) {
          this._eventEmitter.shutdown();
        }
  
        return this;
      },
      getEventEmitter: function getEventEmitter() {
        return this._eventEmitter;
      },
      on: function on() {
        if (this._eventEmitter) {
          this._eventEmitter.on.apply(this._eventEmitter, arguments);
        }
  
        return this;
      },
      once: function once() {
        if (this._eventEmitter) {
          this._eventEmitter.once.apply(this._eventEmitter, arguments);
        }
  
        return this;
      },
      off: function off() {
        if (this._eventEmitter) {
          this._eventEmitter.off.apply(this._eventEmitter, arguments);
        }
  
        return this;
      },
      emit: function emit(event) {
        if (this._eventEmitter && event) {
          this._eventEmitter.emit.apply(this._eventEmitter, arguments);
        }
  
        return this;
      },
      addListener: function addListener() {
        if (this._eventEmitter) {
          this._eventEmitter.addListener.apply(this._eventEmitter, arguments);
        }
  
        return this;
      },
      removeListener: function removeListener() {
        if (this._eventEmitter) {
          this._eventEmitter.removeListener.apply(this._eventEmitter, arguments);
        }
  
        return this;
      },
      removeAllListeners: function removeAllListeners() {
        if (this._eventEmitter) {
          this._eventEmitter.removeAllListeners.apply(this._eventEmitter, arguments);
        }
  
        return this;
      },
      listenerCount: function listenerCount() {
        if (this._eventEmitter) {
          return this._eventEmitter.listenerCount.apply(this._eventEmitter, arguments);
        }
  
        return 0;
      },
      listeners: function listeners() {
        if (this._eventEmitter) {
          return this._eventEmitter.listeners.apply(this._eventEmitter, arguments);
        }
  
        return [];
      },
      eventNames: function eventNames() {
        if (this._eventEmitter) {
          return this._eventEmitter.eventNames.apply(this._eventEmitter, arguments);
        }
  
        return [];
      }
    };
  
    var SceneClass = Phaser.Scene;
  
    var IsSceneObject = function IsSceneObject(object) {
      return object instanceof SceneClass;
    };
  
    var GetSceneObject = function GetSceneObject(object) {
      if (object == null || _typeof(object) !== 'object') {
        return null;
      } else if (IsSceneObject(object)) {
        // object = scene
        return object;
      } else if (object.scene && IsSceneObject(object.scene)) {
        // object = game object
        return object.scene;
      } else if (object.parent && object.parent.scene && IsSceneObject(object.parent.scene)) {
        // parent = bob object
        return object.parent.scene;
      }
    };
  
    var GetValue$B = Phaser.Utils.Objects.GetValue;
  
    var ComponentBase = /*#__PURE__*/function () {
      function ComponentBase(parent, config) {
        _classCallCheck(this, ComponentBase);
  
        this.parent = parent; // gameObject or scene
  
        this.scene = GetSceneObject(parent);
        this.isShutdown = false; // Event emitter, default is private event emitter
  
        this.setEventEmitter(GetValue$B(config, 'eventEmitter', true)); // Register callback of parent destroy event, also see `shutdown` method
  
        if (this.parent && this.parent === this.scene) {
          // parent is a scene
          this.scene.sys.events.once('shutdown', this.onSceneDestroy, this);
        } else if (this.parent && this.parent.once) {
          // bob object does not have event emitter
          this.parent.once('destroy', this.onParentDestroy, this);
        }
      }
  
      _createClass(ComponentBase, [{
        key: "shutdown",
        value: function shutdown(fromScene) {
          // Already shutdown
          if (this.isShutdown) {
            return;
          } // parent might not be shutdown yet
  
  
          if (this.parent && this.parent === this.scene) {
            // parent is a scene
            this.scene.sys.events.off('shutdown', this.onSceneDestroy, this);
          } else if (this.parent && this.parent.once) {
            // bob object does not have event emitter
            this.parent.off('destroy', this.onParentDestroy, this);
          }
  
          this.destroyEventEmitter();
          this.parent = undefined;
          this.scene = undefined;
          this.isShutdown = true;
        }
      }, {
        key: "destroy",
        value: function destroy(fromScene) {
          this.shutdown(fromScene);
        }
      }, {
        key: "onSceneDestroy",
        value: function onSceneDestroy() {
          this.destroy(true);
        }
      }, {
        key: "onParentDestroy",
        value: function onParentDestroy(parent, fromScene) {
          this.destroy(fromScene);
        }
      }]);
  
      return ComponentBase;
    }();
    Object.assign(ComponentBase.prototype, EventEmitterMethods);
  
    var Anchor = /*#__PURE__*/function (_ComponentBase) {
      _inherits(Anchor, _ComponentBase);
  
      var _super = _createSuper(Anchor);
  
      function Anchor(gameObject, config) {
        var _this;
  
        _classCallCheck(this, Anchor);
  
        _this = _super.call(this, gameObject, {
          eventEmitter: false
        }); // No event emitter
        // this.parent = gameObject;
  
        _this.viewport = undefined;
  
        _this.resetFromJSON(config);
  
        return _this;
      }
  
      _createClass(Anchor, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          if (o === undefined) {
            o = {};
          } // Position
  
  
          var alignX, configX;
  
          if (o.x !== undefined) {
            alignX = null;
            configX = o.x;
          } else if (o.left !== undefined) {
            alignX = 0;
            configX = o.left;
          } else if (o.right !== undefined) {
            alignX = 1;
            configX = o.right;
          } else if (o.centerX !== undefined) {
            alignX = 0.5;
            configX = o.centerX;
          }
  
          var alignY, configY;
  
          if (o.y !== undefined) {
            alignY = null;
            configY = o.y;
          } else if (o.top !== undefined) {
            alignY = 0;
            configY = o.top;
          } else if (o.bottom !== undefined) {
            alignY = 1;
            configY = o.bottom;
          } else if (o.centerY !== undefined) {
            alignY = 0.5;
            configY = o.centerY;
          }
  
          var percentageX, offsetX;
  
          if (configX !== undefined) {
            configX = configX.replace('left', '0%').replace('right', '100%').replace('center', '50%').split('%');
            percentageX = parseFloat(configX[0]) / 100;
            offsetX = configX[1] === '' ? 0 : parseFloat(configX[1]);
          }
  
          var percentageY, offsetY;
  
          if (configY !== undefined) {
            configY = configY.replace('top', '0%').replace('bottom', '100%').replace('center', '50%').split('%');
            percentageY = parseFloat(configY[0]) / 100;
            offsetY = configY[1] === '' ? 0 : parseFloat(configY[1]);
          } // Size
  
  
          var configWidth = o.width;
          var percentageWidth, paddingWidth;
  
          if (configWidth !== undefined) {
            configWidth = configWidth.split('%');
            percentageWidth = parseFloat(configWidth[0]) / 100;
            paddingWidth = configWidth[1] === '' ? 0 : parseFloat(configWidth[1]);
          }
  
          var configHeight = o.height;
          var percentageHeight, paddingHeight;
  
          if (configHeight !== undefined) {
            configHeight = configHeight.split('%');
            percentageHeight = parseFloat(configHeight[0]) / 100;
            paddingHeight = configHeight[1] === '' ? 0 : parseFloat(configHeight[1]);
          } // Position
  
  
          this.setAlign(alignX, alignY);
          this.setPercentage(percentageX, percentageY);
          this.setOffset(offsetX, offsetY); // Size
  
          this.setSizePercentage(percentageWidth, percentageHeight);
          this.setSizePadding(paddingWidth, paddingHeight);
          var onResizeCallback = o.onResizeCallback;
          var onResizeCallbackScope = o.onResizeCallbackScope;
  
          if (onResizeCallback !== undefined) {
            this.setResizeCallback(onResizeCallback, onResizeCallbackScope);
          }
  
          var onUpdateViewportCallback = o.onUpdateViewportCallback;
          var onUpdateViewportCallbackScope = o.onUpdateViewportCallbackScope;
  
          if (onUpdateViewportCallback !== undefined) {
            this.setUpdateViewportCallback(onUpdateViewportCallback, onUpdateViewportCallbackScope);
          }
  
          this.autoAnchor(o.enable);
          return this;
        }
      }, {
        key: "shutdown",
        value: function shutdown(fromScene) {
          // Already shutdown
          if (this.isShutdown) {
            return;
          }
  
          this.autoAnchor(false);
          this.viewport = undefined;
          this.onUpdateViewportCallback = undefined;
          this.onUpdateViewportCallbackScope = undefined;
          this.onResizeCallback = undefined;
          this.onResizeCallbackScope = undefined;
  
          _get(_getPrototypeOf(Anchor.prototype), "shutdown", this).call(this, fromScene);
        }
      }, {
        key: "autoAnchor",
        value: function autoAnchor(enable) {
          if (enable === undefined) {
            enable = true;
          }
  
          enable = !!enable;
  
          if (this.autoAnchorEnable === enable) {
            return this;
          }
  
          if (enable) {
            this.scene.sys.scale.on('resize', this.anchor, this);
            this.anchor();
          } else {
            this.scene.sys.scale.off('resize', this.anchor, this);
          }
  
          this.autoAnchorEnable = enable;
          return this;
        } // Position
  
      }, {
        key: "setAlign",
        value: function setAlign(x, y) {
          this.alignX = x;
          this.alignY = y;
          return this;
        }
      }, {
        key: "setPercentage",
        value: function setPercentage(x, y) {
          this.percentageX = x;
          this.percentageY = y;
          return this;
        }
      }, {
        key: "setOffset",
        value: function setOffset(x, y) {
          this.offsetX = x;
          this.offsetY = y;
          return this;
        } // Size
  
      }, {
        key: "setSizePercentage",
        value: function setSizePercentage(width, height) {
          this.percentageWidth = width;
          this.percentageHeight = height;
          return this;
        }
      }, {
        key: "setSizePadding",
        value: function setSizePadding(width, height) {
          this.paddingWidth = width;
          this.paddingHeight = height;
          return this;
        }
      }, {
        key: "setResizeCallback",
        value: function setResizeCallback(callback, scope) {
          this.onResizeCallback = callback;
          this.onResizeCallbackScope = scope;
          return this;
        }
      }, {
        key: "setUpdateViewportCallback",
        value: function setUpdateViewportCallback(callback, scope) {
          this.onUpdateViewportCallback = callback;
          this.onUpdateViewportCallbackScope = scope;
          return this;
        }
      }, {
        key: "anchor",
        value: function anchor() {
          this.updateViewport();
          this.updateSize();
          this.updatePosition();
          return this;
        }
      }, {
        key: "updateSize",
        value: function updateSize() {
          var callback = this.onResizeCallback,
              scope = this.onResizeCallbackScope;
          var newWidth = this.anchorWidth,
              newHeight = this.anchorHeight;
  
          if (newWidth === undefined && newHeight === undefined || !callback) {
            return;
          }
  
          var gameObject = this.parent;
  
          if (newWidth === undefined) {
            newWidth = gameObject.width;
          }
  
          if (newHeight === undefined) {
            newHeight = gameObject.height;
          }
  
          if (scope) {
            callback.call(scope, newWidth, newHeight, gameObject, this);
          } else {
            callback(newWidth, newHeight, gameObject, this);
          }
        }
      }, {
        key: "updatePosition",
        value: function updatePosition() {
          var gameObject = this.parent;
  
          if (this.alignX === null) {
            gameObject.x = this.anchorX;
          } else if (this.alignX !== undefined) {
            gameObject.x = this.anchorX + gameObject.displayWidth * (gameObject.originX - this.alignX);
          }
  
          if (this.alignY === null) {
            gameObject.y = this.anchorY;
          } else if (this.alignY !== undefined) {
            gameObject.y = this.anchorY + gameObject.displayHeight * (gameObject.originY - this.alignY);
          }
  
          return this;
        }
      }, {
        key: "anchorX",
        get: function get() {
          return this.viewport.x + this.viewport.width * this.percentageX + this.offsetX;
        }
      }, {
        key: "anchorY",
        get: function get() {
          return this.viewport.y + this.viewport.height * this.percentageY + this.offsetY;
        }
      }, {
        key: "anchorWidth",
        get: function get() {
          if (this.percentageWidth === undefined) {
            return undefined;
          }
  
          return this.viewport.width * this.percentageWidth + this.paddingWidth;
        }
      }, {
        key: "anchorHeight",
        get: function get() {
          if (this.percentageHeight === undefined) {
            return undefined;
          }
  
          return this.viewport.height * this.percentageHeight + this.paddingHeight;
        }
      }, {
        key: "updateViewport",
        value: function updateViewport() {
          this.viewport = GetViewport(this.scene, this.viewport ? this.viewport : true);
          var callback = this.onUpdateViewportCallback,
              scope = this.onUpdateViewportCallbackScope;
  
          if (callback) {
            if (scope) {
              callback.call(scope, this.viewport, this.parent, this);
            } else {
              callback(this.viewport, this.parent, this);
            }
          }
        }
      }]);
  
      return Anchor;
    }(ComponentBase);
  
    var SetAnchor = function SetAnchor(config) {
      if (config === undefined) {
        config = {};
      } // Assign default onResizeCallback if not given    
  
  
      var hasMinWidth = config.hasOwnProperty('width');
      var hasMinHeight = config.hasOwnProperty('height');
      var hasOnResizeCallback = config.hasOwnProperty('onResizeCallback');
  
      if ((hasMinWidth || hasMinHeight) && !hasOnResizeCallback) {
        config.onResizeCallback = function (width, height, sizer) {
          if (hasMinWidth) {
            sizer.setMinWidth(width);
          }
  
          if (hasMinHeight) {
            sizer.setMinHeight(height);
          }
  
          sizer.layout();
        };
      }
  
      if (this._anchor === undefined) {
        this._anchor = new Anchor(this, config);
      } else {
        this._anchor.resetFromJSON(config);
      }
  
      return this;
    };
  
    var GetValue$A = Phaser.Utils.Objects.GetValue;
  
    var TickTask = /*#__PURE__*/function (_ComponentBase) {
      _inherits(TickTask, _ComponentBase);
  
      var _super = _createSuper(TickTask);
  
      function TickTask(parent, config) {
        var _this;
  
        _classCallCheck(this, TickTask);
  
        _this = _super.call(this, parent, config);
        _this._isRunning = false;
        _this.isPaused = false;
        _this.tickingState = false;
  
        _this.setTickingMode(GetValue$A(config, 'tickingMode', 1)); // boot() later
  
  
        return _this;
      } // override
  
  
      _createClass(TickTask, [{
        key: "boot",
        value: function boot() {
          if (this.tickingMode === 2 && !this.tickingState) {
            this.startTicking();
          }
        } // override
  
      }, {
        key: "shutdown",
        value: function shutdown(fromScene) {
          // Already shutdown
          if (this.isShutdown) {
            return;
          }
  
          this.stop();
  
          if (this.tickingState) {
            this.stopTicking();
          }
  
          _get(_getPrototypeOf(TickTask.prototype), "shutdown", this).call(this, fromScene);
        }
      }, {
        key: "setTickingMode",
        value: function setTickingMode(mode) {
          if (typeof mode === 'string') {
            mode = TICKINGMODE[mode];
          }
  
          this.tickingMode = mode;
        } // override
  
      }, {
        key: "startTicking",
        value: function startTicking() {
          this.tickingState = true;
        } // override
  
      }, {
        key: "stopTicking",
        value: function stopTicking() {
          this.tickingState = false;
        }
      }, {
        key: "isRunning",
        get: function get() {
          return this._isRunning;
        },
        set: function set(value) {
          if (this._isRunning === value) {
            return;
          }
  
          this._isRunning = value;
  
          if (this.tickingMode === 1 && value != this.tickingState) {
            if (value) {
              this.startTicking();
            } else {
              this.stopTicking();
            }
          }
        }
      }, {
        key: "start",
        value: function start() {
          this.isPaused = false;
          this.isRunning = true;
          return this;
        }
      }, {
        key: "pause",
        value: function pause() {
          // Only can ba paused in running state
          if (this.isRunning) {
            this.isPaused = true;
            this.isRunning = false;
          }
  
          return this;
        }
      }, {
        key: "resume",
        value: function resume() {
          // Only can ba resumed in paused state (paused from running state)
          if (this.isPaused) {
            this.isRunning = true;
          }
  
          return this;
        }
      }, {
        key: "stop",
        value: function stop() {
          this.isPaused = false;
          this.isRunning = false;
          return this;
        }
      }, {
        key: "complete",
        value: function complete() {
          this.isPaused = false;
          this.isRunning = false;
          this.emit('complete', this.parent, this);
        }
      }]);
  
      return TickTask;
    }(ComponentBase);
  
    var TICKINGMODE = {
      'no': 0,
      'lazy': 1,
      'always': 2
    };
  
    var SceneUpdateTickTask = /*#__PURE__*/function (_TickTask) {
      _inherits(SceneUpdateTickTask, _TickTask);
  
      var _super = _createSuper(SceneUpdateTickTask);
  
      function SceneUpdateTickTask() {
        _classCallCheck(this, SceneUpdateTickTask);
  
        return _super.apply(this, arguments);
      }
  
      _createClass(SceneUpdateTickTask, [{
        key: "startTicking",
        value: function startTicking() {
          _get(_getPrototypeOf(SceneUpdateTickTask.prototype), "startTicking", this).call(this);
  
          this.scene.sys.events.on('update', this.update, this);
        }
      }, {
        key: "stopTicking",
        value: function stopTicking() {
          _get(_getPrototypeOf(SceneUpdateTickTask.prototype), "stopTicking", this).call(this);
  
          if (this.scene) {
            // Scene might be destoryed
            this.scene.sys.events.off('update', this.update, this);
          }
        } // update(time, delta) {
        //     
        // }
  
      }]);
  
      return SceneUpdateTickTask;
    }(TickTask);
  
    var GetValue$z = Phaser.Utils.Objects.GetValue;
    var Clamp = Phaser.Math.Clamp;
  
    var Timer = /*#__PURE__*/function () {
      function Timer(config) {
        _classCallCheck(this, Timer);
  
        this.resetFromJSON(config);
      }
  
      _createClass(Timer, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          this.state = GetValue$z(o, 'state', IDLE$6);
          this.timeScale = GetValue$z(o, 'timeScale', 1);
          this.delay = GetValue$z(o, 'delay', 0);
          this.repeat = GetValue$z(o, 'repeat', 0);
          this.repeatCounter = GetValue$z(o, 'repeatCounter', 0);
          this.duration = GetValue$z(o, 'duration', 0);
          this.nowTime = GetValue$z(o, 'nowTime', 0);
          this.justRestart = GetValue$z(o, 'justRestart', false);
        }
      }, {
        key: "toJSON",
        value: function toJSON() {
          return {
            state: this.state,
            timeScale: this.timeScale,
            delay: this.delay,
            repeat: this.repeat,
            repeatCounter: this.repeatCounter,
            duration: this.duration,
            nowTime: this.nowTime,
            justRestart: this.justRestart
          };
        }
      }, {
        key: "destroy",
        value: function destroy() {}
      }, {
        key: "setTimeScale",
        value: function setTimeScale(timeScale) {
          this.timeScale = timeScale;
          return this;
        }
      }, {
        key: "setDelay",
        value: function setDelay(delay) {
          if (delay === undefined) {
            delay = 0;
          }
  
          this.delay = delay;
          return this;
        }
      }, {
        key: "setDuration",
        value: function setDuration(duration) {
          this.duration = duration;
          return this;
        }
      }, {
        key: "setRepeat",
        value: function setRepeat(repeat) {
          this.repeat = repeat;
          return this;
        }
      }, {
        key: "setRepeatInfinity",
        value: function setRepeatInfinity() {
          this.repeat = -1;
          return this;
        }
      }, {
        key: "start",
        value: function start() {
          this.nowTime = this.delay > 0 ? -this.delay : 0;
          this.state = this.nowTime >= 0 ? COUNTDOWN : DELAY;
          this.repeatCounter = 0;
          return this;
        }
      }, {
        key: "stop",
        value: function stop() {
          this.state = IDLE$6;
          return this;
        }
      }, {
        key: "update",
        value: function update(time, delta) {
          if (this.state === IDLE$6 || this.state === DONE || delta === 0 || this.timeScale === 0) {
            return;
          }
  
          this.nowTime += delta * this.timeScale;
          this.state = this.nowTime >= 0 ? COUNTDOWN : DELAY;
          this.justRestart = false;
  
          if (this.nowTime >= this.duration) {
            if (this.repeat === -1 || this.repeatCounter < this.repeat) {
              this.repeatCounter++;
              this.justRestart = true;
              this.nowTime -= this.duration;
            } else {
              this.nowTime = this.duration;
              this.state = DONE;
            }
          }
        }
      }, {
        key: "t",
        get: function get() {
          var t;
  
          switch (this.state) {
            case IDLE$6:
            case DELAY:
              t = 0;
              break;
  
            case COUNTDOWN:
              t = this.nowTime / this.duration;
              break;
  
            case DONE:
              t = 1;
              break;
          }
  
          return Clamp(t, 0, 1);
        },
        set: function set(value) {
          value = Clamp(value, -1, 1);
  
          if (value < 0) {
            this.state = DELAY;
            this.nowTime = -this.delay * value;
          } else {
            this.state = COUNTDOWN;
            this.nowTime = this.duration * value;
  
            if (value === 1 && this.repeat !== 0) {
              this.repeatCounter++;
            }
          }
        }
      }, {
        key: "setT",
        value: function setT(t) {
          this.t = t;
          return this;
        }
      }, {
        key: "isIdle",
        get: function get() {
          return this.state === IDLE$6;
        }
      }, {
        key: "isDelay",
        get: function get() {
          return this.state === DELAY;
        }
      }, {
        key: "isCountDown",
        get: function get() {
          return this.state === COUNTDOWN;
        }
      }, {
        key: "isRunning",
        get: function get() {
          return this.state === DELAY || this.state === COUNTDOWN;
        }
      }, {
        key: "isDone",
        get: function get() {
          return this.state === DONE;
        }
      }, {
        key: "isOddIteration",
        get: function get() {
          return (this.repeatCounter & 1) === 1;
        }
      }, {
        key: "isEvenIteration",
        get: function get() {
          return (this.repeatCounter & 1) === 0;
        }
      }]);
  
      return Timer;
    }();
  
    var IDLE$6 = 0;
    var DELAY = 1;
    var COUNTDOWN = 2;
    var DONE = -1;
  
    var TimerTickTask = /*#__PURE__*/function (_TickTask) {
      _inherits(TimerTickTask, _TickTask);
  
      var _super = _createSuper(TimerTickTask);
  
      function TimerTickTask(parent, config) {
        var _this;
  
        _classCallCheck(this, TimerTickTask);
  
        _this = _super.call(this, parent, config);
        _this.timer = new Timer(); // boot() later 
  
        return _this;
      } // override
  
  
      _createClass(TimerTickTask, [{
        key: "shutdown",
        value: function shutdown(fromScene) {
          // Already shutdown
          if (this.isShutdown) {
            return;
          }
  
          _get(_getPrototypeOf(TimerTickTask.prototype), "shutdown", this).call(this, fromScene);
  
          this.timer.destroy();
          this.timer = undefined;
        }
      }, {
        key: "start",
        value: function start() {
          this.timer.start();
  
          _get(_getPrototypeOf(TimerTickTask.prototype), "start", this).call(this);
  
          return this;
        }
      }, {
        key: "stop",
        value: function stop() {
          this.timer.stop();
  
          _get(_getPrototypeOf(TimerTickTask.prototype), "stop", this).call(this);
  
          return this;
        }
      }, {
        key: "complete",
        value: function complete() {
          this.timer.stop();
  
          _get(_getPrototypeOf(TimerTickTask.prototype), "complete", this).call(this);
  
          return this;
        }
      }]);
  
      return TimerTickTask;
    }(SceneUpdateTickTask);
  
    var GetValue$y = Phaser.Utils.Objects.GetValue;
    var GetAdvancedValue$3 = Phaser.Utils.Objects.GetAdvancedValue;
    var GetEaseFunction = Phaser.Tweens.Builders.GetEaseFunction;
  
    var EaseValueTaskBase = /*#__PURE__*/function (_TickTask) {
      _inherits(EaseValueTaskBase, _TickTask);
  
      var _super = _createSuper(EaseValueTaskBase);
  
      function EaseValueTaskBase() {
        _classCallCheck(this, EaseValueTaskBase);
  
        return _super.apply(this, arguments);
      }
  
      _createClass(EaseValueTaskBase, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          this.timer.resetFromJSON(GetValue$y(o, 'timer'));
          this.setEnable(GetValue$y(o, 'enable', true));
          this.setTarget(GetValue$y(o, 'target', this.parent));
          this.setDelay(GetAdvancedValue$3(o, 'delay', 0));
          this.setDuration(GetAdvancedValue$3(o, 'duration', 1000));
          this.setEase(GetValue$y(o, 'ease', 'Linear'));
          this.setRepeat(GetValue$y(o, 'repeat', 0));
          return this;
        }
      }, {
        key: "setEnable",
        value: function setEnable(e) {
          if (e == undefined) {
            e = true;
          }
  
          this.enable = e;
          return this;
        }
      }, {
        key: "setTarget",
        value: function setTarget(target) {
          if (target === undefined) {
            target = this.parent;
          }
  
          this.target = target;
          return this;
        }
      }, {
        key: "setDelay",
        value: function setDelay(time) {
          this.delay = time;
          return this;
        }
      }, {
        key: "setDuration",
        value: function setDuration(time) {
          this.duration = time;
          return this;
        }
      }, {
        key: "setEase",
        value: function setEase(ease) {
          if (ease === undefined) {
            ease = 'Linear';
          }
  
          this.ease = ease;
          this.easeFn = GetEaseFunction(ease);
          return this;
        }
      }, {
        key: "setRepeat",
        value: function setRepeat(repeat) {
          this.repeat = repeat;
          return this;
        } // Override
  
      }, {
        key: "start",
        value: function start() {
          // Ignore start if timer is running, i.e. in DELAY, o RUN state
          if (this.timer.isRunning) {
            return this;
          }
  
          _get(_getPrototypeOf(EaseValueTaskBase.prototype), "start", this).call(this);
  
          return this;
        }
      }, {
        key: "restart",
        value: function restart() {
          this.timer.stop();
          this.start.apply(this, arguments);
          return this;
        }
      }, {
        key: "stop",
        value: function stop(toEnd) {
          if (toEnd === undefined) {
            toEnd = false;
          }
  
          _get(_getPrototypeOf(EaseValueTaskBase.prototype), "stop", this).call(this);
  
          if (toEnd) {
            this.timer.setT(1);
            this.updateGameObject(this.target, this.timer);
            this.complete();
          }
  
          return this;
        }
      }, {
        key: "update",
        value: function update(time, delta) {
          if (!this.isRunning || !this.enable || !this.parent.active) {
            return this;
          }
  
          var target = this.target,
              timer = this.timer;
          timer.update(time, delta); // isDelay, isCountDown, isDone
  
          if (!timer.isDelay) {
            this.updateGameObject(target, timer);
          }
  
          this.emit('update', target, this);
  
          if (timer.isDone) {
            this.complete();
          }
  
          return this;
        } // Override
  
      }, {
        key: "updateGameObject",
        value: function updateGameObject(target, timer) {}
      }]);
  
      return EaseValueTaskBase;
    }(TimerTickTask);
  
    var GetValue$x = Phaser.Utils.Objects.GetValue;
    var GetAdvancedValue$2 = Phaser.Utils.Objects.GetAdvancedValue;
    var Linear$3 = Phaser.Math.Linear;
  
    var Scale = /*#__PURE__*/function (_EaseValueTaskBase) {
      _inherits(Scale, _EaseValueTaskBase);
  
      var _super = _createSuper(Scale);
  
      function Scale(gameObject, config) {
        var _this;
  
        _classCallCheck(this, Scale);
  
        _this = _super.call(this, gameObject, config); // this.parent = gameObject;
        // this.timer
  
        _this.scaleStart = {};
        _this.scaleEnd = {};
  
        _this.resetFromJSON(config);
  
        _this.boot();
  
        return _this;
      }
  
      _createClass(Scale, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          _get(_getPrototypeOf(Scale.prototype), "resetFromJSON", this).call(this, o);
  
          this.setMode(GetValue$x(o, 'mode', 0));
          this.setScaleRange(GetAdvancedValue$2(o, 'start', undefined), GetAdvancedValue$2(o, 'end', 0));
          return this;
        }
      }, {
        key: "setMode",
        value: function setMode(m) {
          if (typeof m === 'string') {
            m = MODE$3[m];
          }
  
          this.mode = m;
          return this;
        }
      }, {
        key: "setScaleRange",
        value: function setScaleRange(start, end) {
          if (typeof start === 'number') {
            this.startX = start;
            this.startY = start;
          } else {
            this.startX = GetAdvancedValue$2(start, 'x', this.parent.scaleX);
            this.startY = GetAdvancedValue$2(start, 'y', this.parent.scaleY);
          }
  
          if (typeof end === 'number') {
            this.endX = end;
            this.endY = end;
          } else {
            this.endX = GetAdvancedValue$2(end, 'x', undefined);
            this.endY = GetAdvancedValue$2(end, 'y', undefined);
          }
  
          this.hasScaleX = this.startX !== undefined && this.endX !== undefined;
          this.hasScaleY = this.startY !== undefined && this.endY !== undefined;
          return this;
        }
      }, {
        key: "start",
        value: function start() {
          if (this.timer.isRunning) {
            return this;
          }
  
          var gameObject = this.parent;
  
          if (this.hasScaleX) {
            gameObject.scaleX = this.startX;
          }
  
          if (this.hasScaleY) {
            gameObject.scaleY = this.startY;
          }
  
          var repeat = this.repeat;
  
          if (this.mode === 2) {
            // Yoyo
            if (repeat !== -1) {
              repeat = (repeat + 1) * 2 - 1;
            }
          }
  
          this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(repeat);
  
          _get(_getPrototypeOf(Scale.prototype), "start", this).call(this);
  
          return this;
        }
      }, {
        key: "updateGameObject",
        value: function updateGameObject(gameObject, timer) {
          var t = timer.t;
  
          if (timer.isOddIteration) {
            // Yoyo
            t = 1 - t;
          }
  
          t = this.easeFn(t);
  
          if (this.hasScaleX) {
            gameObject.scaleX = Linear$3(this.startX, this.endX, t);
          }
  
          if (this.hasScaleY) {
            gameObject.scaleY = Linear$3(this.startY, this.endY, t);
          }
        }
      }, {
        key: "complete",
        value: function complete() {
          _get(_getPrototypeOf(Scale.prototype), "complete", this).call(this);
  
          if (this.mode === 1) {
            this.parent.destroy(); // Will also destroy this behavior
          }
  
          return this;
        }
      }]);
  
      return Scale;
    }(EaseValueTaskBase);
  
    var MODE$3 = {
      stop: 0,
      destroy: 1,
      yoyo: 2
    };
  
    var PopUp = function PopUp(gameObject, duration, orientation, ease, scale) {
      if (ease === undefined) {
        ease = 'Cubic';
      } // Ease scale from 0 to current scale
  
  
      var start, end;
  
      switch (orientation) {
        case 0:
        case 'x':
          start = {
            x: 0
          };
          end = {
            x: gameObject.scaleX
          };
          break;
  
        case 1:
        case 'y':
          start = {
            y: 0
          };
          end = {
            y: gameObject.scaleY
          };
          break;
  
        default:
          start = 0;
          end = gameObject.scale;
          break;
      }
  
      var config = {
        mode: 0,
        start: start,
        end: end,
        duration: duration,
        ease: ease
      };
  
      if (scale === undefined) {
        scale = new Scale(gameObject, config);
      } else {
        scale.resetFromJSON(config);
      }
  
      scale.restart();
      return scale;
    };
  
    var ScaleDownDestroy = function ScaleDownDestroy(gameObject, duration, orientation, ease, destroyMode, scale) {
      if (ease === undefined) {
        ease = 'Linear';
      } // Ease from current scale to 0
  
  
      if (destroyMode instanceof Scale) {
        scale = destroyMode;
        destroyMode = undefined;
      }
  
      if (destroyMode === undefined) {
        destroyMode = true;
      }
  
      var config = {};
      config.mode = destroyMode ? 1 : 0;
  
      switch (orientation) {
        case 0:
        case 'x':
          config.end = {
            x: 0
          };
          break;
  
        case 1:
        case 'y':
          config.end = {
            y: 0
          };
          break;
  
        default:
          config.end = 0;
          break;
      }
  
      config.duration = duration;
      config.ease = ease;
  
      if (scale === undefined) {
        scale = new Scale(gameObject, config);
      } else {
        scale.resetFromJSON(config);
      }
  
      scale.restart();
      return scale;
    };
  
    var Yoyo = function Yoyo(gameObject, duration, peakValue, repeat, orientation, ease, scale) {
      if (peakValue === undefined) {
        peakValue = 1.2;
      }
  
      if (repeat === undefined) {
        repeat = 0;
      }
  
      if (ease === undefined) {
        ease = 'Cubic';
      } // Ease scale from 0 to current scale
  
  
      var start, end;
  
      switch (orientation) {
        case 0:
        case 'x':
          start = {
            x: gameObject.scaleX
          };
          end = {
            x: peakValue
          };
          break;
  
        case 1:
        case 'y':
          start = {
            y: gameObject.scaleX
          };
          end = {
            y: peakValue
          };
          break;
  
        default:
          start = gameObject.scaleX;
          end = peakValue;
          break;
      }
  
      var config = {
        mode: 2,
        start: start,
        end: end,
        duration: duration / 2,
        ease: ease,
        repeat: repeat
      };
  
      if (scale === undefined) {
        scale = new Scale(gameObject, config);
      } else {
        scale.resetFromJSON(config);
      }
  
      scale.restart();
      return scale;
    };
  
    var WaitEvent = function WaitEvent(eventEmitter, eventName) {
      return new Promise(function (resolve, reject) {
        eventEmitter.once(eventName, function () {
          resolve();
        });
      });
    };
  
    var WaitComplete = function WaitComplete(eventEmitter) {
      return WaitEvent(eventEmitter, 'complete');
    };
  
    var IsPlainObject$b = Phaser.Utils.Objects.IsPlainObject;
  
    var OnInitScale = function OnInitScale(gameObject, scale) {
      // Route 'complete' of scale to gameObject
      scale.completeEventName = undefined;
      scale.on('complete', function () {
        if (scale.completeEventName) {
          gameObject.emit(scale.completeEventName, gameObject);
          scale.completeEventName = undefined;
        }
      }); // Update local state
  
      scale.on('update', function () {
        var parent = gameObject.getParentSizer();
  
        if (parent) {
          parent.resetChildPositionState(gameObject);
        }
      });
    };
  
    var ScaleMethods = {
      popUp: function popUp(duration, orientation, ease) {
        if (IsPlainObject$b(duration)) {
          var config = duration;
          duration = config.duration;
          orientation = config.orientation;
          ease = config.ease;
        }
  
        var isInit = this._scale === undefined;
        this._scale = PopUp(this, duration, orientation, ease, this._scale);
  
        if (isInit) {
          OnInitScale(this, this._scale);
        }
  
        this._scale.completeEventName = 'popup.complete';
        return this;
      },
      popUpPromise: function popUpPromise(duration, orientation, ease) {
        this.popUp(duration, orientation, ease);
        return WaitComplete(this._scale);
      },
      scaleDownDestroy: function scaleDownDestroy(duration, orientation, ease, destroyMode) {
        if (IsPlainObject$b(duration)) {
          var config = duration;
          duration = config.duration;
          orientation = config.orientation;
          ease = config.ease;
          destroyMode = config.destroy;
        }
  
        var isInit = this._scale === undefined;
        this._scale = ScaleDownDestroy(this, duration, orientation, ease, destroyMode, this._scale);
  
        if (isInit) {
          OnInitScale(this, this._scale);
        }
  
        this._scale.completeEventName = 'scaledown.complete';
        return this;
      },
      scaleDownDestroyPromise: function scaleDownDestroyPromise(duration, orientation, ease, destroyMode) {
        this.scaleDownDestroy(duration, orientation, ease, destroyMode);
        return WaitComplete(this._scale);
      },
      scaleDown: function scaleDown(duration, orientation, ease) {
        this.scaleDownDestroy(duration, orientation, ease, false);
        return this;
      },
      scaleDownPromise: function scaleDownPromise(duration, orientation, ease) {
        this.scaleDown(duration, orientation, ease);
        return WaitComplete(this._scale);
      },
      scaleYoyo: function scaleYoyo(duration, peakValue, repeat, orientation, ease) {
        if (IsPlainObject$b(duration)) {
          var config = duration;
          duration = config.duration;
          peakValue = config.peakValue;
          repeat = config.repeat;
          orientation = config.orientation;
          ease = config.ease;
        }
  
        var isInit = this._scale === undefined;
        this._scale = Yoyo(this, duration, peakValue, repeat, orientation, ease, this._scale);
  
        if (isInit) {
          OnInitScale(this, this._scale);
        }
  
        this._scale.completeEventName = 'scaleyoyo.complete';
        return this;
      },
      scaleYoyoPromise: function scaleYoyoPromise(duration, peakValue, repeat, orientation, ease) {
        this.scaleYoyo(duration, peakValue, repeat, orientation, ease);
        return WaitComplete(this._scale);
      }
    };
  
    var GetValue$w = Phaser.Utils.Objects.GetValue;
    var GetAdvancedValue$1 = Phaser.Utils.Objects.GetAdvancedValue;
    var Linear$2 = Phaser.Math.Linear;
  
    var Fade = /*#__PURE__*/function (_EaseValueTaskBase) {
      _inherits(Fade, _EaseValueTaskBase);
  
      var _super = _createSuper(Fade);
  
      function Fade(gameObject, config) {
        var _this;
  
        _classCallCheck(this, Fade);
  
        _this = _super.call(this, gameObject, config); // this.parent = gameObject;
        // this.timer
  
        _this.resetFromJSON(config);
  
        _this.boot();
  
        return _this;
      }
  
      _createClass(Fade, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          _get(_getPrototypeOf(Fade.prototype), "resetFromJSON", this).call(this, o);
  
          this.setMode(GetValue$w(o, 'mode', 0));
          this.setAlphaRange(GetAdvancedValue$1(o, 'start', this.parent.alpha), GetAdvancedValue$1(o, 'end', 0));
          return this;
        }
      }, {
        key: "setMode",
        value: function setMode(m) {
          if (typeof m === 'string') {
            m = MODE$2[m];
          }
  
          this.mode = m;
          return this;
        }
      }, {
        key: "setAlphaRange",
        value: function setAlphaRange(start, end) {
          this.alphaStart = start;
          this.alphaEnd = end;
          return this;
        }
      }, {
        key: "start",
        value: function start() {
          if (this.timer.isRunning) {
            return this;
          }
  
          var gameObject = this.parent;
          gameObject.setAlpha(this.alphaStart);
          this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(this.mode === 2 ? -1 : 0);
  
          _get(_getPrototypeOf(Fade.prototype), "start", this).call(this);
  
          return this;
        }
      }, {
        key: "updateGameObject",
        value: function updateGameObject(gameObject, timer) {
          var t = timer.t;
  
          if (timer.isOddIteration) {
            // Yoyo
            t = 1 - t;
          }
  
          gameObject.alpha = Linear$2(this.alphaStart, this.alphaEnd, t);
        }
      }, {
        key: "complete",
        value: function complete() {
          _get(_getPrototypeOf(Fade.prototype), "complete", this).call(this);
  
          if (this.mode === 1) {
            this.parent.destroy(); // Will also destroy this behavior
          }
  
          return this;
        }
      }]);
  
      return Fade;
    }(EaseValueTaskBase);
  
    var MODE$2 = {
      stop: 0,
      destroy: 1,
      yoyo: 2
    };
  
    var IsPlainObject$a = Phaser.Utils.Objects.IsPlainObject;
  
    var FadeIn = function FadeIn(gameObject, duration, alpha, fade) {
      var startAlpha, endAlpha;
  
      if (IsPlainObject$a(alpha)) {
        startAlpha = alpha.start;
        endAlpha = alpha.end;
      } else {
        endAlpha = alpha;
      }
  
      if (startAlpha === undefined) {
        startAlpha = 0;
      }
  
      if (endAlpha === undefined) {
        endAlpha = 1;
      }
  
      var config = {
        mode: 0,
        start: startAlpha,
        end: endAlpha,
        duration: duration
      };
  
      if (fade === undefined) {
        fade = new Fade(gameObject, config);
      } else {
        fade.resetFromJSON(config);
      }
  
      fade.restart();
      return fade;
    };
  
    var FadeOutDestroy = function FadeOutDestroy(gameObject, duration, destroyMode, fade) {
      if (destroyMode instanceof Fade) {
        fade = destroyMode;
        destroyMode = undefined;
      }
  
      if (destroyMode === undefined) {
        destroyMode = true;
      }
  
      var config = {
        mode: destroyMode ? 1 : 0,
        end: 0,
        duration: duration
      };
  
      if (fade === undefined) {
        fade = new Fade(gameObject, config);
      } else {
        fade.resetFromJSON(config);
      }
  
      fade.restart();
      return fade;
    };
  
    var IsPlainObject$9 = Phaser.Utils.Objects.IsPlainObject;
  
    var OnInitFade = function OnInitFade(gameObject, fade) {
      // Route 'complete' of fade to gameObject
      fade.completeEventName = undefined;
      fade.on('complete', function () {
        if (fade.completeEventName) {
          gameObject.emit(fade.completeEventName, gameObject);
          fade.completeEventName = undefined;
        }
      }); // Update local state
  
      fade.on('update', function () {
        var parent = gameObject.getParentSizer();
  
        if (parent) {
          parent.resetChildAlphaState(gameObject);
        }
      });
    };
  
    var FadeMethods = {
      fadeIn: function fadeIn(duration, alpha) {
        if (IsPlainObject$9(duration)) {
          var config = duration;
          duration = config.duration;
          alpha = config.alpha;
        }
  
        var isInit = this._fade === undefined;
        this._fade = FadeIn(this, duration, alpha, this._fade);
  
        if (isInit) {
          OnInitFade(this, this._fade);
        }
  
        this._fade.completeEventName = 'fadein.complete';
        return this;
      },
      fadeInPromise: function fadeInPromise(duration, alpha) {
        this.fadeIn(duration, alpha);
        return WaitComplete(this._fade);
      },
      fadeOutDestroy: function fadeOutDestroy(duration, destroyMode) {
        if (IsPlainObject$9(duration)) {
          var config = duration;
          duration = config.duration;
          destroyMode = config.destroy;
        }
  
        var isInit = this._fade === undefined;
        this._fade = FadeOutDestroy(this, duration, destroyMode, this._fade);
  
        if (isInit) {
          OnInitFade(this, this._fade);
        }
  
        this._fade.completeEventName = 'fadeout.complete';
        return this;
      },
      fadeOutDestroyPromise: function fadeOutDestroyPromise(duration, destroyMode) {
        this.fadeOutDestroy(duration, destroyMode);
        return WaitComplete(this._fade);
      },
      fadeOut: function fadeOut(duration) {
        this.fadeOutDestroy(duration, false);
        return this;
      },
      fadeOutPromise: function fadeOutPromise(duration) {
        this.fadeOut(duration);
        return WaitComplete(this._fade);
      }
    };
  
    var GetValue$v = Phaser.Utils.Objects.GetValue;
    var GetAdvancedValue = Phaser.Utils.Objects.GetAdvancedValue;
    var Linear$1 = Phaser.Math.Linear;
  
    var EaseMove = /*#__PURE__*/function (_EaseValueTaskBase) {
      _inherits(EaseMove, _EaseValueTaskBase);
  
      var _super = _createSuper(EaseMove);
  
      function EaseMove(gameObject, config) {
        var _this;
  
        _classCallCheck(this, EaseMove);
  
        _this = _super.call(this, gameObject, config); // this.parent = gameObject;
        // this.timer
  
        _this.resetFromJSON(config);
  
        _this.boot();
  
        return _this;
      }
  
      _createClass(EaseMove, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          _get(_getPrototypeOf(EaseMove.prototype), "resetFromJSON", this).call(this, o);
  
          this.setMode(GetValue$v(o, 'mode', 0));
  
          if (o && (o.hasOwnProperty('x') || o.hasOwnProperty('y'))) {
            var endX = GetAdvancedValue(o, 'x', undefined);
            var endY = GetAdvancedValue(o, 'y', undefined);
            this.setTargetPosition(endX, endY);
          } else {
            this.setTargetPosition(o);
          }
  
          return this;
        }
      }, {
        key: "setMode",
        value: function setMode(m) {
          if (typeof m === 'string') {
            m = MODE$1[m];
          }
  
          this.mode = m;
          return this;
        }
      }, {
        key: "setTargetPosition",
        value: function setTargetPosition(x, y) {
          if (typeof x === 'number' || typeof y === 'number') {
            // endX, endY
            // x,y : a number, or undefined
            this.startX = this.parent.x;
            this.startY = this.parent.y;
            this.endX = x;
            this.endY = y;
          } else {
            var config = x;
            this.startX = GetAdvancedValue(config, 'startX', undefined);
            this.startY = GetAdvancedValue(config, 'startY', undefined);
            this.endX = GetAdvancedValue(config, 'endX', undefined);
            this.endY = GetAdvancedValue(config, 'endY', undefined);
          }
  
          this.hasMoveX = this.startX !== undefined && this.endX !== undefined;
          this.hasMoveY = this.startY !== undefined && this.endY !== undefined;
          return this;
        }
      }, {
        key: "start",
        value: function start() {
          if (this.timer.isRunning) {
            return this;
          }
  
          var gameObject = this.parent;
  
          if (this.hasMoveX) {
            gameObject.x = this.startX;
          }
  
          if (this.hasMoveY) {
            gameObject.y = this.startY;
          }
  
          this.timer.setDelay(this.delay).setDuration(this.duration).setRepeat(this.mode === 2 ? -1 : 0);
  
          _get(_getPrototypeOf(EaseMove.prototype), "start", this).call(this);
  
          return this;
        }
      }, {
        key: "updateGameObject",
        value: function updateGameObject(gameObject, timer) {
          var t = timer.t;
  
          if (timer.isOddIteration) {
            // Yoyo
            t = 1 - t;
          }
  
          t = this.easeFn(t);
  
          if (this.hasMoveX) {
            gameObject.x = Linear$1(this.startX, this.endX, t);
          }
  
          if (this.hasMoveY) {
            gameObject.y = Linear$1(this.startY, this.endY, t);
          }
        }
      }, {
        key: "complete",
        value: function complete() {
          _get(_getPrototypeOf(EaseMove.prototype), "complete", this).call(this);
  
          if (this.mode === 1) {
            this.parent.destroy(); // Will also destroy this behavior
          }
  
          return this;
        }
      }]);
  
      return EaseMove;
    }(EaseValueTaskBase);
  
    var MODE$1 = {
      stop: 0,
      destroy: 1,
      yoyo: 2
    };
  
    var ParseValue = function ParseValue(propertyValue, startValue) {
      // propertyValue : number or string
      if (typeof propertyValue === 'number') {
        return propertyValue;
      } else {
        var op = propertyValue[0];
        var num = parseFloat(propertyValue.substr(2));
  
        switch (op) {
          case '+':
            return startValue + num;
  
          case '-':
            return startValue - num;
  
          case '*':
            return startValue * num;
  
          case '/':
            return startValue / num;
        }
      }
    };
  
    var EaseMoveTo = function EaseMoveTo(gameObject, duration, endX, endY, ease, destroyMode, easeMove) {
      if (destroyMode instanceof EaseMove) {
        easeMove = destroyMode;
        destroyMode = undefined;
      }
  
      if (destroyMode === undefined) {
        destroyMode = false;
      }
  
      var config = {};
      config.mode = destroyMode ? 1 : 0;
  
      if (endX !== undefined) {
        config.startX = gameObject.x;
        config.endX = ParseValue(endX, gameObject.x);
      }
  
      if (endY !== undefined) {
        config.startY = gameObject.y;
        config.endY = ParseValue(endY, gameObject.y);
      }
  
      config.duration = duration;
      config.ease = ease === undefined ? 'Linear' : ease;
  
      if (easeMove === undefined) {
        easeMove = new EaseMove(gameObject, config);
      } else {
        easeMove.resetFromJSON(config);
      }
  
      easeMove.restart();
      return easeMove;
    };
  
    var EaseMoveFrom = function EaseMoveFrom(gameObject, duration, startX, startY, ease, destroyMode, easeMove) {
      if (destroyMode instanceof EaseMove) {
        easeMove = destroyMode;
        destroyMode = undefined;
      }
  
      if (destroyMode === undefined) {
        destroyMode = false;
      }
  
      var config = {};
      config.mode = destroyMode ? 1 : 0;
  
      if (startX !== undefined) {
        config.startX = ParseValue(startX, gameObject.x);
        config.endX = gameObject.x;
      }
  
      if (startY !== undefined) {
        config.startY = ParseValue(startY, gameObject.y);
        config.endY = gameObject.y;
      }
  
      config.duration = duration;
      config.ease = ease === undefined ? 'Linear' : ease;
  
      if (easeMove === undefined) {
        easeMove = new EaseMove(gameObject, config);
      } else {
        easeMove.resetFromJSON(config);
      }
  
      easeMove.restart();
      return easeMove;
    };
  
    var IsPlainObject$8 = Phaser.Utils.Objects.IsPlainObject;
    var DistanceBetween$4 = Phaser.Math.Distance.Between;
  
    var OnInitEaseMove = function OnInitEaseMove(gameObject, easeMove) {
      // Route 'complete' of easeMove to gameObject
      easeMove.completeEventName = undefined;
      easeMove.on('complete', function () {
        if (easeMove.completeEventName) {
          gameObject.emit(easeMove.completeEventName, gameObject);
          easeMove.completeEventName = undefined;
        }
      }); // Update local state
  
      easeMove.on('update', function () {
        var parent = gameObject.getParentSizer();
  
        if (parent) {
          parent.resetChildPositionState(gameObject);
        }
      });
    };
  
    var EaseMoveMethods = {
      moveFrom: function moveFrom(duration, x, y, ease, destroyMode) {
        if (IsPlainObject$8(duration)) {
          var config = duration;
          x = config.x;
          y = config.y;
  
          if (config.hasOwnProperty('speed')) {
            duration = DistanceBetween$4(x, y, this.x, this.y) * 1000 / config.speed;
          } else {
            duration = config.duration;
          }
  
          ease = config.ease;
        }
  
        var isInit = this._easeMove === undefined;
        this._easeMove = EaseMoveFrom(this, duration, x, y, ease, destroyMode, this._easeMove);
  
        if (isInit) {
          OnInitEaseMove(this, this._easeMove);
        }
  
        this._easeMove.completeEventName = 'movefrom.complete';
        return this;
      },
      moveFromPromise: function moveFromPromise(duration, x, y, ease, destroyMode) {
        this.moveFrom(duration, x, y, ease, destroyMode);
        return WaitComplete(this._easeMove);
      },
      moveFromDestroy: function moveFromDestroy(duration, x, y, ease) {
        this.moveFrom(duration, x, y, ease, true);
        return this;
      },
      moveFromDestroyPromise: function moveFromDestroyPromise(duration, x, y, ease) {
        this.moveFromDestroy(duration, x, y, ease);
        return WaitComplete(this._easeMove);
      },
      moveTo: function moveTo(duration, x, y, ease, destroyMode) {
        if (IsPlainObject$8(duration)) {
          var config = duration;
          x = config.x;
          y = config.y;
  
          if (config.hasOwnProperty('speed')) {
            duration = DistanceBetween$4(x, y, this.x, this.y) * 1000 / config.speed;
          } else {
            duration = config.duration;
          }
  
          ease = config.ease;
        }
  
        var isInit = this._easeMove === undefined;
        this._easeMove = EaseMoveTo(this, duration, x, y, ease, destroyMode, this._easeMove);
  
        if (isInit) {
          OnInitEaseMove(this, this._easeMove);
        }
  
        this._easeMove.completeEventName = 'moveto.complete';
        return this;
      },
      moveToPromise: function moveToPromise(duration, x, y, ease, destroyMode) {
        this.moveTo(duration, x, y, ease, destroyMode);
        return WaitComplete(this._easeMove);
      },
      moveToDestroy: function moveToDestroy(duration, x, y, ease) {
        this.moveTo(duration, x, y, ease, true);
        return this;
      },
      moveToDestroyPromise: function moveToDestroyPromise(duration, x, y, ease) {
        this.moveToDestroy(duration, x, y, ease, true);
        return WaitComplete(this._easeMove);
      }
    };
  
    var GetValue$u = Phaser.Utils.Objects.GetValue;
  
    var ShakePosition = /*#__PURE__*/function (_TickTask) {
      _inherits(ShakePosition, _TickTask);
  
      var _super = _createSuper(ShakePosition);
  
      function ShakePosition(gameObject, config) {
        var _this;
  
        _classCallCheck(this, ShakePosition);
  
        _this = _super.call(this, gameObject, config); // this.parent = gameObject;
  
        _this.timer = new Timer();
  
        _this.resetFromJSON(config);
  
        _this.boot();
  
        return _this;
      }
  
      _createClass(ShakePosition, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          this.timer.resetFromJSON(GetValue$u(o, 'timer'));
          this.setEnable(GetValue$u(o, 'enable', true));
          this.setMode(GetValue$u(o, 'mode', 1));
          this.isRunning = GetValue$u(o, 'isRunning', false);
          this.setMagnitudeMode(GetValue$u(o, 'magnitudeMode', 1));
          this.setDuration(GetValue$u(o, 'duration', 500));
          this.setMagnitude(GetValue$u(o, 'magnitude', 10));
          this.ox = GetValue$u(o, 'ox', undefined);
          this.oy = GetValue$u(o, 'oy', undefined);
          return this;
        }
      }, {
        key: "toJSON",
        value: function toJSON() {
          return {
            timer: this.timer.toJSON(),
            enable: this.enable,
            mode: this.mode,
            isRunning: this.isRunning,
            magnitudeMode: magnitudeMode,
            duration: this.duration,
            magnitude: this.magnitude,
            ox: this.ox,
            oy: this.oy
          };
        } // override
  
      }, {
        key: "shutdown",
        value: function shutdown(fromScene) {
          // Already shutdown
          if (this.isShutdown) {
            return;
          }
  
          _get(_getPrototypeOf(ShakePosition.prototype), "shutdown", this).call(this, fromScene);
  
          this.timer.destroy();
          this.timer = undefined;
        }
      }, {
        key: "startTicking",
        value: function startTicking() {
          _get(_getPrototypeOf(ShakePosition.prototype), "startTicking", this).call(this);
  
          if (this.mode === 0) {
            // Effect mode
            this.scene.game.events.on('poststep', this.update, this);
            this.scene.game.events.on('prestep', this.backToOrigin, this);
          } else {
            // Behavior Mode
            this.scene.sys.events.on('preupdate', this.update, this);
          }
        }
      }, {
        key: "stopTicking",
        value: function stopTicking() {
          _get(_getPrototypeOf(ShakePosition.prototype), "stopTicking", this).call(this);
  
          if (this.scene) {
            // Scene might be destoryed
            if (this.mode === 0) {
              // Effect mode
              this.scene.game.events.off('poststep', this.update, this);
              this.scene.game.events.off('prestep', this.backToOrigin, this);
            } else {
              // Behavior Mode
              this.scene.sys.events.off('preupdate', this.update, this);
            }
          }
        }
      }, {
        key: "setEnable",
        value: function setEnable(e) {
          if (e == undefined) {
            e = true;
          }
  
          this.enable = e;
          return this;
        }
      }, {
        key: "setMode",
        value: function setMode(mode) {
          if (typeof mode === 'string') {
            mode = MODE[mode];
          }
  
          this.mode = mode;
          return this;
        }
      }, {
        key: "setMagnitudeMode",
        value: function setMagnitudeMode(magnitudeMode) {
          if (typeof magnitudeMode === 'string') {
            magnitudeMode = MANITUDEMODE[magnitudeMode];
          }
  
          this.magnitudeMode = magnitudeMode;
          return this;
        }
      }, {
        key: "setDuration",
        value: function setDuration(duration) {
          this.duration = duration;
          return this;
        }
      }, {
        key: "setMagnitude",
        value: function setMagnitude(magnitude) {
          this.magnitude = magnitude;
          return this;
        }
      }, {
        key: "start",
        value: function start(duration, magnitude) {
          if (typeof duration !== 'number') {
            var config = duration;
            magnitude = GetValue$u(config, 'magnitude', undefined);
            duration = GetValue$u(config, 'duration', undefined);
          }
  
          if (magnitude !== undefined) {
            this.setMagnitude(magnitude);
          }
  
          if (duration !== undefined) {
            this.setDuration(duration);
          }
  
          this.timer.setDuration(this.duration).start();
  
          _get(_getPrototypeOf(ShakePosition.prototype), "start", this).call(this);
  
          return this;
        }
      }, {
        key: "shake",
        value: function shake(duration, magnitude) {
          this.start(duration, magnitude);
          return this;
        }
      }, {
        key: "update",
        value: function update(time, delta) {
          if (!this.isRunning || !this.enable) {
            return this;
          }
  
          var gameObject = this.parent;
  
          if (!gameObject.active) {
            return this;
          }
  
          this.timer.update(time, delta);
  
          if (this.timer.isDone) {
            this.backToOrigin();
            this.complete();
          } else {
            if (this.ox === undefined) {
              this.ox = gameObject.x;
              this.oy = gameObject.y;
            }
  
            var magnitude = this.magnitude;
  
            if (this.magnitudeMode === 1) // decay
              {
                magnitude *= 1 - this.timer.t;
              }
  
            var a = Math.random() * Math.PI * 2;
            var offsetX = Math.cos(a) * magnitude;
            var offsetY = Math.sin(a) * magnitude;
            gameObject.setPosition(this.ox + offsetX, this.oy + offsetY);
          }
  
          return this;
        }
      }, {
        key: "backToOrigin",
        value: function backToOrigin() {
          if (!this.isRunning || !this.enable) {
            return this;
          }
  
          if (this.ox === undefined) {
            return this;
          }
  
          var gameObject = this.parent;
  
          if (this.ox === gameObject.x && this.oy === gameObject.y) {
            return this;
          }
  
          gameObject.setPosition(this.ox, this.oy);
          this.ox = undefined;
          this.oy = undefined;
          return this;
        }
      }]);
  
      return ShakePosition;
    }(TickTask);
  
    var MODE = {
      effect: 0,
      behavior: 1
    };
    var MANITUDEMODE = {
      constant: 0,
      decay: 1
    };
  
    var IsPlainObject$7 = Phaser.Utils.Objects.IsPlainObject;
  
    var OnInitShake = function OnInitShake(gameObject, shake) {
      // Route 'complete' of shake to gameObject
      shake.on('complete', function () {
        gameObject.emit('shake.complete', gameObject);
      }); // Shake effect won't change position
    };
  
    var ShakeMethods = {
      shake: function shake(duration, magnitude, magnitudeMode) {
        if (IsPlainObject$7(duration)) {
          var config = duration;
          duration = config.duration;
          magnitude = config.magnitude;
          magnitudeMode = config.magnitudeMode;
        }
  
        if (this._shake === undefined) {
          this._shake = new ShakePosition(this, {
            mode: 0,
            magnitudeMode: 1
          });
          OnInitShake(this, this._shake);
        }
  
        if (duration !== undefined) {
          this._shake.setDuration(duration);
        }
  
        if (magnitude !== undefined) {
          this._shake.setMagnitude(magnitude);
        }
  
        if (magnitudeMode !== undefined) {
          this._shake.setMagnitudeMode(magnitudeMode);
        }
  
        this._shake.shake();
  
        return this;
      },
      shakePromise: function shakePromise(duration, alpha) {
        this.shake(duration, alpha);
        return WaitComplete(this._shake);
      }
    };
  
    var GetValue$t = Phaser.Utils.Objects.GetValue;
    var Linear = Phaser.Math.Linear;
  
    var EaseValueTask = /*#__PURE__*/function (_EaseValueTaskBase) {
      _inherits(EaseValueTask, _EaseValueTaskBase);
  
      var _super = _createSuper(EaseValueTask);
  
      function EaseValueTask(gameObject, config) {
        var _this;
  
        _classCallCheck(this, EaseValueTask);
  
        _this = _super.call(this, gameObject, config); // this.parent = gameObject;
        // this.timer
  
        _this.resetFromJSON();
  
        _this.boot();
  
        return _this;
      }
  
      _createClass(EaseValueTask, [{
        key: "start",
        value: function start(config) {
          if (this.timer.isRunning) {
            return this;
          }
  
          var target = this.target;
          this.propertyKey = GetValue$t(config, 'key', 'value');
          var currentValue = target[this.propertyKey];
          this.fromValue = GetValue$t(config, 'from', currentValue);
          this.toValue = GetValue$t(config, 'to', currentValue);
          this.setEase(GetValue$t(config, 'ease', this.ease));
          this.setDuration(GetValue$t(config, 'duration', this.duration));
          this.timer.setDuration(this.duration);
          target[this.propertyKey] = this.fromValue;
  
          _get(_getPrototypeOf(EaseValueTask.prototype), "start", this).call(this);
  
          return this;
        }
      }, {
        key: "updateGameObject",
        value: function updateGameObject(target, timer) {
          var t = timer.t;
          t = this.easeFn(t);
          target[this.propertyKey] = Linear(this.fromValue, this.toValue, t);
        }
      }]);
  
      return EaseValueTask;
    }(EaseValueTaskBase);
  
    var IsPlainObject$6 = Phaser.Utils.Objects.IsPlainObject;
  
    var EaseData = /*#__PURE__*/function (_ComponentBase) {
      _inherits(EaseData, _ComponentBase);
  
      var _super = _createSuper(EaseData);
  
      function EaseData(parent, config) {
        var _this;
  
        _classCallCheck(this, EaseData);
  
        _this = _super.call(this, parent, config);
  
        _this.parent.setDataEnabled();
  
        _this.easeTasks = {};
        return _this;
      }
  
      _createClass(EaseData, [{
        key: "complete",
        value: function complete(key) {
          this.emit("complete-".concat(key), this.parent, this);
          this.emit('complete', key, this.parent, this);
        }
      }, {
        key: "getEaseTask",
        value: function getEaseTask(key) {
          var easeTask = this.easeTasks[key];
  
          if (easeTask === undefined) {
            easeTask = new EaseValueTask(this.parent);
            this.easeTasks[key] = easeTask;
            easeTask.setTarget(this.parent.data.values).on('complete', function () {
              this.complete(key);
            }, this);
          }
  
          return easeTask;
        }
      }, {
        key: "easeTo",
        value: function easeTo(key, value, duration, ease) {
          if (IsPlainObject$6(key)) {
            var config = key;
            key = config.key;
            value = config.value;
            duration = config.duration;
            ease = config.ease;
            var speed = config.speed;
  
            if (duration === undefined && speed !== undefined) {
              duration = Math.abs(value - this.parent.data.values[key]) / speed * 1000;
            }
          }
  
          if (duration === undefined) {
            duration = 1000;
          }
  
          if (ease === undefined) {
            ease = 'Linear';
          }
  
          var easeTask = this.getEaseTask(key);
          easeTask.restart({
            key: key,
            to: value,
            duration: duration,
            ease: ease
          });
          return this;
        }
      }, {
        key: "easeFrom",
        value: function easeFrom(key, value, duration, ease) {
          if (IsPlainObject$6(key)) {
            var config = key;
            key = config.key;
            value = config.value;
            duration = config.duration;
            ease = config.ease;
            var speed = config.speed;
  
            if (duration === undefined && speed !== undefined) {
              duration = Math.abs(value - this.parent.data.values[key]) / speed * 1000;
            }
          }
  
          if (duration === undefined) {
            duration = 1000;
          }
  
          if (ease === undefined) {
            ease = 'Linear';
          }
  
          var easeTask = this.getEaseTask(key);
          easeTask.restart({
            key: key,
            from: value,
            duration: duration,
            ease: ease
          });
          return this;
        }
      }, {
        key: "stopEase",
        value: function stopEase(key, toEnd) {
          if (toEnd === undefined) {
            toEnd = true;
          }
  
          var easeTask = this.easeTasks[key];
  
          if (easeTask) {
            easeTask.stop(toEnd);
          }
  
          return this;
        }
      }, {
        key: "stopAll",
        value: function stopAll(toEnd) {
          if (toEnd === undefined) {
            toEnd = true;
          }
  
          for (var key in this.easeTasks) {
            this.stopEase(key, toEnd);
          }
  
          return this;
        }
      }]);
  
      return EaseData;
    }(ComponentBase);
  
    var OnInitEaseData = function OnInitEaseData(gameObject, easeData) {
      // Route 'complete' of easeData to gameObject
      easeData.on('complete', function (key) {
        gameObject.emit("easedata.".concat(key, ".complete"), gameObject);
        gameObject.emit('easedata.complete', key, gameObject);
      });
    };
  
    var EaseDataMethods = {
      easeDataTo: function easeDataTo(key, value, duration, ease) {
        if (!this._easeData) {
          this._easeData = new EaseData(this);
          OnInitEaseData(this, this._easeData);
        }
  
        this._easeData.easeTo(key, value, duration, ease);
  
        return this;
      },
      easeDataToPromise: function easeDataToPromise(key, value, duration, ease) {
        this.easeDataTo(key, value, duration, ease);
        return WaitEvent(this._easeData, "complete-".concat(key));
      },
      stopEaseData: function stopEaseData(key, toEnd) {
        if (!this._easeData) {
          return this;
        }
  
        this._easeData.stopEase(key, toEnd);
  
        return this;
      },
      stopAllEaseData: function stopAllEaseData(toEnd) {
        if (!this._easeData) {
          return this;
        }
  
        this._easeData.stopAll(toEnd);
  
        return this;
      }
    };
  
    var Show = function Show(gameObject) {
      _hide(gameObject, false);
    };
  
    var Hide = function Hide(gameObject) {
      _hide(gameObject, true);
    };
  
    var IsShown = function IsShown(gameObject) {
      if (!gameObject) {
        return false;
      }
  
      var config = GetSizerConfig(gameObject);
      return !config.hidden;
    };
  
    var _hide = function _hide(gameObject, hidden) {
      if (!gameObject) {
        return;
      }
  
      var config = GetSizerConfig(gameObject);
      config.hidden = hidden;
      var parent = GetParent(gameObject);
  
      if (parent) {
        parent.setChildVisible(gameObject, !hidden);
      } else {
        gameObject.setVisible(!hidden);
      }
    };
  
    var HideMethods = {
      show: function show(gameObject) {
        if (gameObject === undefined) {
          gameObject = this;
        }
  
        Show(gameObject);
        return this;
      },
      hide: function hide(gameObject) {
        if (gameObject === undefined) {
          gameObject = this;
        }
  
        Hide(gameObject);
        return this;
      },
      isShow: function isShow(gameObject) {
        if (gameObject === undefined) {
          gameObject = this;
        }
  
        return IsShown(gameObject);
      }
    };
  
    var IsPointInBounds = function IsPointInBounds(gameObject, x, y, preTest, postTest) {
      // Can't get bounds
      if (!gameObject || !gameObject.getBounds) {
        return false;
      }
  
      if (preTest && !preTest(gameObject, x, y)) {
        return false;
      }
  
      var boundsRect = GetBounds(gameObject, true);
  
      if (!boundsRect.contains(x, y)) {
        return false;
      }
  
      if (postTest && !postTest(gameObject, x, y)) {
        return false;
      }
  
      return true;
    };
  
    var IsPointerInBounds = function IsPointerInBounds(gameObject, pointer, preTest, postTest) {
      if (pointer) {
        return IsPointInBounds(gameObject, pointer.x, pointer.y, preTest, postTest);
      } else {
        var inputManager = gameObject.scene.input.manager;
        var pointersTotal = inputManager.pointersTotal;
        var pointers = inputManager.pointers;
  
        for (var i = 0; i < pointersTotal; i++) {
          pointer = pointers[i];
  
          if (IsPointInBounds(gameObject, pointer.x, pointer.y, preTest, postTest)) {
            return true;
          }
        }
  
        return false;
      }
    };
  
    var IsInTouching = function IsInTouching(pointer, gameObject) {
      if (gameObject === undefined) {
        gameObject = this;
      }
  
      return IsPointerInBounds(gameObject, pointer);
    };
  
    var IsFunction = function IsFunction(obj) {
      return obj && typeof obj === 'function';
    };
  
    var IsArray = function IsArray(obj) {
      return Object.prototype.toString.call(obj) === '[object Array]';
    };
  
    var ContainsPoint = function ContainsPoint(gameObject, x, y, preTest, postTest) {
      return IsPointInBounds(gameObject, x, y, GetPreTestCallback(preTest), GetPostTestCallback(postTest));
    };
  
    var IsNotHiddenSizer = function IsNotHiddenSizer(gameObject) {
      var isHiddenSizer = gameObject.rexSizer && gameObject.rexSizer.hidden;
      return !isHiddenSizer;
    };
  
    var GetPreTestCallback = function GetPreTestCallback(preTest) {
      if (!preTest) {
        return IsNotHiddenSizer;
      }
  
      return function (gameObject, x, y) {
        if (!IsNotHiddenSizer(gameObject)) {
          return false;
        }
  
        preTest(gameObject, x, y);
        return true;
      };
    };
  
    var GetPostTestCallback = function GetPostTestCallback(postTest) {
      return postTest;
    };
  
    var PointToChild$1 = function PointToChild(x, y, preTest, postTest, children) {
      if (!IsFunction(preTest)) {
        children = preTest;
        preTest = undefined;
        postTest = undefined;
      }
  
      if (children === undefined) {
        if (this.sizerChildren) {
          children = this.sizerChildren;
        } else {
          children = this.children;
        }
      }
  
      if (IsArray(children)) {
        var child;
  
        for (var i = 0, cnt = children.length; i < cnt; i++) {
          child = children[i];
  
          if (ContainsPoint(child, x, y, preTest, postTest)) {
            return child;
          }
        }
      } else {
        var child;
  
        for (var key in children) {
          child = children[key];
  
          if (ContainsPoint(child, x, y, preTest, postTest)) {
            return child;
          }
        }
      }
  
      return null;
    };
  
    var GetParentSizerMethods = {
      getParentSizer: function getParentSizer(gameObject, name) {
        return this.getParent(gameObject, name);
      },
      getTopmostSizer: function getTopmostSizer(gameObject) {
        return this.getTopmostParent(gameObject);
      }
    };
  
    var ResizeGameObject = function ResizeGameObject(gameObject, newWidth, newHeight) {
      if (!gameObject || newWidth === undefined && newHeight === undefined) {
        return;
      }
  
      if (gameObject.resize) {
        // Has `resize` method
        if (newWidth === undefined) {
          newWidth = gameObject.width;
        }
  
        if (newHeight === undefined) {
          newHeight = gameObject.height;
        }
  
        gameObject.resize(newWidth, newHeight);
      } else {
        // Set display width/height
        if (newWidth !== undefined) {
          gameObject.displayWidth = newWidth;
        }
  
        if (newHeight !== undefined) {
          gameObject.displayHeight = newHeight;
        }
      }
    };
  
    var CopyState = function CopyState(gamObject, out) {
      if (out === undefined) {
        out = {};
      } else if (out === true) {
        out = GlobState;
      }
  
      out.x = gamObject.x;
      out.y = gamObject.y;
      out.scaleX = gamObject.scaleX;
      out.scaleY = gamObject.scaleY;
      out.width = gamObject.width;
      out.height = gamObject.height;
      out.displayWidth = gamObject.displayWidth;
      out.displayHeight = gamObject.displayHeight;
      return out;
    };
  
    var GlobState = {};
  
    var PreLayoutChild = function PreLayoutChild(child) {
      if (this.sizerEventsEnable) {
        CopyState(child, this.getChildPrevState(child));
        this.layoutedChildren.push(child);
      }
    };
  
    var LayoutChild = function LayoutChild(child, x, y, width, height, align, offsetX, offsetY) {
      AlignIn(child, x, y, width, height, align);
  
      if (offsetX !== undefined) {
        child.x += offsetX;
      }
  
      if (offsetY !== undefined) {
        child.y += offsetY;
      }
  
      this.resetChildPositionState(child);
  
      if (this.sizerEventsEnable) {
        child.emit('sizer.postlayout', child, this);
      }
    };
  
    var ALIGN_CENTER$3 = Phaser.Display.Align.CENTER;
  
    var LayoutBackgrounds = function LayoutBackgrounds() {
      if (this.backgroundChildren === undefined) {
        return;
      }
  
      var backgrounds = this.backgroundChildren;
      var startX = this.left,
          startY = this.top;
      var parentWidth = this.width,
          parentHeight = this.height;
      var child, childConfig, padding, x, y, width, height;
  
      for (var i = 0, cnt = backgrounds.length; i < cnt; i++) {
        child = backgrounds[i];
        childConfig = child.rexSizer;
  
        if (childConfig.hidden) {
          continue;
        }
  
        padding = childConfig.padding;
        PreLayoutChild.call(this, child);
        x = startX + padding.left;
        y = startY + padding.top;
        width = parentWidth - padding.left - padding.right;
        height = parentHeight - padding.top - padding.bottom;
        ResizeGameObject(child, width, height);
        LayoutChild.call(this, child, x, y, width, height, ALIGN_CENTER$3);
      }
    };
  
    var SetDraggable = function SetDraggable(senser, draggable) {
      var senserType = _typeof(senser);
  
      if (senserType === 'string') {
        senser = this.getElement(senser);
      } else if (senser === undefined || senserType != 'object') {
        draggable = senser;
        senser = this;
      }
  
      if (draggable === undefined) {
        draggable = true;
      }
  
      if (senser.input && senser.input.hasOwnProperty('draggable')) {
        // Draggable is already registered
        senser.input.draggable = draggable;
      } else if (draggable) {
        // Register draggable
        senser.setInteractive();
        senser.scene.input.setDraggable(senser);
        senser.on('drag', function (pointer, dragX, dragY) {
          var topmostParent = this.getTopmostSizer();
          topmostParent.x += dragX - senser.x;
          topmostParent.y += dragY - senser.y;
          topmostParent.emit('sizer.drag', pointer, dragX, dragY);
        }, this).on('dragstart', function (pointer, dragX, dragY) {
          var topmostParent = this.getTopmostSizer();
          topmostParent.emit('sizer.dragstart', pointer, dragX, dragY);
        }, this).on('dragend', function (pointer, dragX, dragY, dropped) {
          var topmostParent = this.getTopmostSizer();
          topmostParent.emit('sizer.dragend', pointer, dragX, dragY, dropped);
        }, this);
      } else ;
  
      return this;
    };
  
    var GetValue$s = Phaser.Utils.Objects.GetValue;
  
    var Button = /*#__PURE__*/function (_ComponentBase) {
      _inherits(Button, _ComponentBase);
  
      var _super = _createSuper(Button);
  
      function Button(gameObject, config) {
        var _this;
  
        _classCallCheck(this, Button);
  
        _this = _super.call(this, gameObject, config); // this.parent = gameObject;
  
        _this._enable = undefined;
        gameObject.setInteractive(GetValue$s(config, "inputConfig", undefined));
  
        _this.resetFromJSON(config);
  
        _this.boot();
  
        return _this;
      }
  
      _createClass(Button, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          this.pointer = undefined;
          this.lastClickTime = undefined;
          this.setEnable(GetValue$s(o, "enable", true));
          this.setMode(GetValue$s(o, "mode", 1));
          this.setClickInterval(GetValue$s(o, "clickInterval", 100));
          this.setDragThreshold(GetValue$s(o, 'threshold', undefined));
          return this;
        }
      }, {
        key: "boot",
        value: function boot() {
          var gameObject = this.parent;
          gameObject.on('pointerdown', this.onPress, this);
          gameObject.on('pointerup', this.onRelease, this);
          gameObject.on('pointerout', this.onPointOut, this);
          gameObject.on('pointermove', this.onMove, this);
          gameObject.on('pointerover', this.onOver, this);
          gameObject.on('pointeroutr', this.onOut, this);
        }
      }, {
        key: "shutdown",
        value: function shutdown(fromScene) {
          // Already shutdown
          if (this.isShutdown) {
            return;
          } // GameObject events will be removed when this gameObject destroyed 
          // this.parent.on('pointerdown', this.onPress, this);
          // this.parent.on('pointerup', this.onRelease, this);
          // this.parent.on('pointerout', this.onPointOut, this);
          // this.parent.on('pointermove', this.onMove, this);
  
  
          this.pointer = null;
  
          _get(_getPrototypeOf(Button.prototype), "shutdown", this).call(this, fromScene);
        }
      }, {
        key: "enable",
        get: function get() {
          return this._enable;
        },
        set: function set(e) {
          if (this._enable === e) {
            return;
          }
  
          if (!e) {
            this.cancel();
          }
  
          this._enable = e;
          var eventName = e ? 'enable' : 'disable';
          this.emit(eventName, this, this.parent);
        }
      }, {
        key: "setEnable",
        value: function setEnable(e) {
          if (e === undefined) {
            e = true;
          }
  
          this.enable = e;
          return this;
        }
      }, {
        key: "toggleEnable",
        value: function toggleEnable() {
          this.setEnable(!this.enable);
          return this;
        }
      }, {
        key: "setMode",
        value: function setMode(m) {
          if (typeof m === 'string') {
            m = CLICKMODE$1[m];
          }
  
          this.mode = m;
          return this;
        }
      }, {
        key: "setClickInterval",
        value: function setClickInterval(interval) {
          this.clickInterval = interval; // ms
  
          return this;
        }
      }, {
        key: "setDragThreshold",
        value: function setDragThreshold(distance) {
          this.dragThreshold = distance;
          return this;
        } // internal
  
      }, {
        key: "onPress",
        value: function onPress(pointer, localX, localY, event) {
          if (this.pointer !== undefined) {
            return;
          }
  
          this.pointer = pointer;
  
          if (this.mode === 0) {
            this.click(pointer.downTime, pointer, event);
          }
        }
      }, {
        key: "onRelease",
        value: function onRelease(pointer, localX, localY, event) {
          if (this.pointer !== pointer) {
            return;
          }
  
          if (this.mode === 1) {
            this.click(pointer.upTime, pointer, event);
          }
  
          this.pointer = undefined;
        }
      }, {
        key: "onPointOut",
        value: function onPointOut(pointer, event) {
          if (this.pointer !== pointer) {
            return;
          }
  
          this.cancel();
        }
      }, {
        key: "onMove",
        value: function onMove(pointer, localX, localY, event) {
          if (this.pointer !== pointer) {
            return;
          }
  
          if (this.dragThreshold === undefined) {
            return;
          }
  
          if (pointer.getDistance() >= this.dragThreshold) {
            this.cancel();
          }
        }
      }, {
        key: "click",
        value: function click(nowTime, pointer, event) {
          if (!this.enable) {
            return this;
          }
  
          if (nowTime === undefined) {
            // fires 'click' event manually
            this.emit('click', this, this.parent, pointer, event);
            return this;
          }
  
          this.pointer = undefined;
          var lastClickTime = this.lastClickTime;
  
          if (lastClickTime !== undefined && nowTime - lastClickTime <= this.clickInterval) {
            return this;
          }
  
          this.lastClickTime = nowTime;
          this.emit('click', this, this.parent, pointer, event);
          return this;
        }
      }, {
        key: "cancel",
        value: function cancel() {
          this.pointer = undefined;
          return this;
        }
      }, {
        key: "onOver",
        value: function onOver(pointer, localX, localY, event) {
          if (!this.enable) {
            return this;
          }
  
          this.emit('over', this, this.parent, pointer, event);
          return this;
        }
      }, {
        key: "onOut",
        value: function onOut(pointer, event) {
          if (!this.enable) {
            return this;
          }
  
          this.emit('out', this, this.parent, pointer, event);
          return this;
        }
      }]);
  
      return Button;
    }(ComponentBase);
  
    var CLICKMODE$1 = {
      press: 0,
      pointerdown: 0,
      release: 1,
      pointerup: 1
    };
  
    var ClickMethods = {
      onClick: function onClick(callback, scope, config) {
        if (!callback) {
          return this;
        }
  
        if (this._click === undefined) {
          this._click = new Button(this, config);
        }
  
        this._click.on('click', callback, scope);
  
        return this;
      },
      offClick: function offClick(callback, scope) {
        if (this._click === undefined) {
          return this;
        }
  
        this._click.off('click', callback, scope);
  
        return this;
      },
      enableClick: function enableClick(enabled) {
        if (this._click === undefined) {
          return this;
        }
  
        this._click.setEnable(enabled);
  
        return this;
      },
      disableClick: function disableClick() {
        if (this._click === undefined) {
          return this;
        }
  
        this._click.setEnable(false);
  
        return this;
      }
    };
  
    var IsPointerInHitArea = function IsPointerInHitArea(gameObject, pointer, preTest, postTest) {
      if (pointer) {
        if (preTest && !preTest(gameObject, pointer)) {
          return false;
        }
  
        if (!HitTest(gameObject, pointer)) {
          return false;
        }
  
        if (postTest && !postTest(gameObject, pointer)) {
          return false;
        }
  
        return true;
      } else {
        var inputManager = gameObject.scene.input.manager;
        var pointersTotal = inputManager.pointersTotal;
        var pointers = inputManager.pointers,
            pointer;
  
        for (var i = 0; i < pointersTotal; i++) {
          pointer = pointers[i];
  
          if (preTest && !preTest(gameObject, pointer)) {
            continue;
          }
  
          if (!HitTest(gameObject, pointer)) {
            continue;
          }
  
          if (postTest && !postTest(gameObject, pointer)) {
            continue;
          }
  
          return true;
        }
  
        return false;
      }
    };
  
    var HitTest = function HitTest(gameObject, pointer) {
      var scene = gameObject.scene;
      var cameras = scene.input.cameras.getCamerasBelowPointer(pointer);
      var inputManager = scene.input.manager;
      var gameObjects = [gameObject];
      var output;
  
      for (var i = 0, len = cameras.length; i < len; i++) {
        output = inputManager.hitTest(pointer, gameObjects, cameras[i]);
  
        if (output.length > 0) {
          return true;
        }
      }
  
      return false;
    };
  
    var GetValue$r = Phaser.Utils.Objects.GetValue;
  
    var ClickOutside = /*#__PURE__*/function (_ComponentBase) {
      _inherits(ClickOutside, _ComponentBase);
  
      var _super = _createSuper(ClickOutside);
  
      function ClickOutside(gameObject, config) {
        var _this;
  
        _classCallCheck(this, ClickOutside);
  
        _this = _super.call(this, gameObject, config); // this.parent = gameObject;
  
        _this._enable = undefined;
        var inputConfig = GetValue$r(config, "inputConfig", undefined);
  
        if (inputConfig) {
          gameObject.setInteractive(inputConfig);
        }
  
        _this.resetFromJSON(config);
  
        _this.boot();
  
        return _this;
      }
  
      _createClass(ClickOutside, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          this.setEnable(GetValue$r(o, "enable", true));
          this.setMode(GetValue$r(o, "mode", 1));
          this.setClickInterval(GetValue$r(o, "clickInterval", 100));
          return this;
        }
      }, {
        key: "boot",
        value: function boot() {
          var scene = this.parent.scene;
          scene.input.on('pointerdown', this.onPress, this);
          scene.input.on('pointerup', this.onRelease, this);
        }
      }, {
        key: "shutdown",
        value: function shutdown(fromScene) {
          // Already shutdown
          if (this.isShutdown) {
            return;
          }
  
          var scene = this.parent.scene;
          scene.input.off('pointerdown', this.onPress, this);
          scene.input.off('pointerup', this.onRelease, this);
  
          _get(_getPrototypeOf(ClickOutside.prototype), "shutdown", this).call(this, fromScene);
        }
      }, {
        key: "enable",
        get: function get() {
          return this._enable;
        },
        set: function set(e) {
          if (this._enable === e) {
            return;
          }
  
          this._enable = e;
          var eventName = e ? 'enable' : 'disable';
          this.emit(eventName, this, this.parent);
        }
      }, {
        key: "setEnable",
        value: function setEnable(e) {
          if (e === undefined) {
            e = true;
          }
  
          this.enable = e;
          return this;
        }
      }, {
        key: "toggleEnable",
        value: function toggleEnable() {
          this.setEnable(!this.enable);
          return this;
        }
      }, {
        key: "setMode",
        value: function setMode(m) {
          if (typeof m === 'string') {
            m = CLICKMODE[m];
          }
  
          this.mode = m;
          return this;
        }
      }, {
        key: "setClickInterval",
        value: function setClickInterval(interval) {
          this.clickInterval = interval; // ms
  
          return this;
        }
      }, {
        key: "isPointerInside",
        value: function isPointerInside(pointer) {
          var gameObject = this.parent;
          var isInsideCallback = gameObject.input ? IsPointerInHitArea : IsPointerInBounds;
          return isInsideCallback(gameObject, pointer);
        } // internal
  
      }, {
        key: "onPress",
        value: function onPress(pointer) {
          if (this.mode === 0) {
            // Do nothing if game object is not visible
            if (!this.parent.willRender(pointer.camera)) {
              return;
            }
  
            if (!this.isPointerInside(pointer)) {
              this.click(pointer.downTime, pointer);
            }
          }
        }
      }, {
        key: "onRelease",
        value: function onRelease(pointer) {
          if (this.mode === 1) {
            // Do nothing if game object is not visible
            if (!this.parent.willRender(pointer.camera)) {
              return;
            }
  
            if (!this.isPointerInside(pointer)) {
              this.click(pointer.upTime, pointer);
            }
          }
        }
      }, {
        key: "click",
        value: function click(nowTime, pointer) {
          if (!this.enable) {
            return this;
          }
  
          if (nowTime === undefined) {
            // fires 'clickoutside' event manually
            this.emit('clickoutside', this, this.parent, pointer);
            return this;
          }
  
          var lastClickTime = this.lastClickTime;
  
          if (lastClickTime !== undefined && nowTime - lastClickTime <= this.clickInterval) {
            return this;
          }
  
          this.lastClickTime = nowTime;
          this.emit('clickoutside', this, this.parent, pointer);
          return this;
        }
      }]);
  
      return ClickOutside;
    }(ComponentBase);
  
    var CLICKMODE = {
      press: 0,
      pointerdown: 0,
      release: 1,
      pointerup: 1
    };
  
    var ClickOutsideMethods = {
      onClickOutside: function onClickOutside(callback, scope, config) {
        if (!callback) {
          return this;
        }
  
        if (this._clickOutside === undefined) {
          this._clickOutside = new ClickOutside(this, config);
        }
  
        this._clickOutside.on('clickoutside', callback, scope);
  
        return this;
      },
      offClickOutside: function offClickOutside(callback, scope) {
        if (this._clickOutside === undefined) {
          return this;
        }
  
        this._clickOutside.off('clickoutside', callback, scope);
  
        return this;
      },
      enableClickOutside: function enableClickOutside(enabled) {
        if (this._clickOutside === undefined) {
          return this;
        }
  
        this._clickOutside.setEnable(enabled);
  
        return this;
      },
      disableClickOutside: function disableClickOutside() {
        if (this._clickOutside === undefined) {
          return this;
        }
  
        this._clickOutside.setEnable(false);
  
        return this;
      }
    };
  
    /**
     * @author       Richard Davey <rich@photonstorm.com>
     * @copyright    2019 Photon Storm Ltd.
     * @license      {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
     */
    //  Source object
    //  The key as a string, or an array of keys, i.e. 'banner', or 'banner.hideBanner'
    //  The default value to use if the key doesn't exist
  
    /**
     * Retrieves a value from an object.
     *
     * @function Phaser.Utils.Objects.GetValue
     * @since 3.0.0
     *
     * @param {object} source - The object to retrieve the value from.
     * @param {string} key - The name of the property to retrieve from the object. If a property is nested, the names of its preceding properties should be separated by a dot (`.`) - `banner.hideBanner` would return the value of the `hideBanner` property from the object stored in the `banner` property of the `source` object.
     * @param {*} defaultValue - The value to return if the `key` isn't found in the `source` object.
     *
     * @return {*} The value of the requested key.
     */
    var GetValue$q = function GetValue(source, key, defaultValue) {
      if (!source || typeof source === 'number') {
        return defaultValue;
      } else if (source.hasOwnProperty(key)) {
        return source[key];
      } else if (key.indexOf('.') !== -1) {
        var keys = key.split('.');
        var parent = source;
        var value = defaultValue; //  Use for loop here so we can break early
  
        for (var i = 0; i < keys.length; i++) {
          if (parent.hasOwnProperty(keys[i])) {
            //  Yes it has a key property, let's carry on down
            value = parent[keys[i]];
            parent = parent[keys[i]];
          } else {
            //  Can't go any further, so reset to default
            value = defaultValue;
            break;
          }
        }
  
        return value;
      } else {
        return defaultValue;
      }
    };
  
    var FSM = /*#__PURE__*/function () {
      /*
      var config = {
          start: 'A',   // default: undefined
          states: {
              A: {
                  next: 'B',  // function() { return 'B'; }
                  enter: function() {},
                  exit: function() {}
              },
              // ...
          },        
          extend: {
              i: 0,
              name: 'abc'
              // ...
          },
          init: function() {},
          enable: true,
          eventEmitter: true,
      };
      */
      function FSM(config) {
        _classCallCheck(this, FSM);
  
        // Attach get-next-state function
        var states = GetValue$q(config, 'states', undefined);
  
        if (states) {
          this.addStates(states);
        } // Attach extend members
  
  
        var extend = GetValue$q(config, 'extend', undefined);
  
        if (extend) {
          for (var name in extend) {
            if (!this.hasOwnProperty(name) || this[name] === undefined) {
              this[name] = extend[name];
            }
          }
        } // Event emitter
  
  
        var eventEmitter = GetValue$q(config, 'eventEmitter', undefined);
        var EventEmitterClass = GetValue$q(config, 'EventEmitterClass', undefined);
        this.setEventEmitter(eventEmitter, EventEmitterClass);
        this._stateLock = false;
        this.resetFromJSON(config);
      }
  
      _createClass(FSM, [{
        key: "shutdown",
        value: function shutdown() {
          this.destroyEventEmitter();
        }
      }, {
        key: "destroy",
        value: function destroy() {
          this.shutdown();
        }
      }, {
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          this.setEnable(GetValue$q(o, 'enable', true));
          this.start(GetValue$q(o, 'start', undefined));
          var init = GetValue$q(o, 'init', undefined);
  
          if (init) {
            init.call(this);
          }
  
          return this;
        }
      }, {
        key: "toJSON",
        value: function toJSON() {
          return {
            curState: this.state,
            prevState: this.prevState,
            enable: this.enable,
            start: this._start
          };
        }
      }, {
        key: "setEnable",
        value: function setEnable(e) {
          if (e === undefined) {
            e = true;
          }
  
          this.enable = e;
          return this;
        }
      }, {
        key: "toggleEnable",
        value: function toggleEnable() {
          this.setEnable(!this.enable);
          return this;
        }
      }, {
        key: "state",
        get: function get() {
          return this._state;
        },
        set: function set(newState) {
          if (!this.enable || this._stateLock) {
            return;
          }
  
          if (this._state === newState) {
            return;
          }
  
          this._prevState = this._state;
          this._state = newState;
          this._stateLock = true; // lock state
  
          this.emit('statechange', this);
  
          if (this._prevState != null) {
            var exitEventName = 'exit_' + this._prevState;
            var exitCallback = this[exitEventName];
  
            if (exitCallback) {
              exitCallback.call(this);
            }
  
            this.emit(exitEventName, this);
          }
  
          this._stateLock = false;
  
          if (this._state != null) {
            var enterEventName = 'enter_' + this._state;
            var enterCallback = this[enterEventName];
  
            if (enterCallback) {
              enterCallback.call(this);
            }
  
            this.emit(enterEventName, this);
          }
        }
      }, {
        key: "prevState",
        get: function get() {
          return this._prevState;
        }
      }, {
        key: "start",
        value: function start(state) {
          this._start = state;
          this._prevState = undefined;
          this._state = state; // Won't fire statechange events
  
          return this;
        }
      }, {
        key: "goto",
        value: function goto(nextState) {
          if (nextState != null) {
            this.state = nextState;
          }
  
          return this;
        }
      }, {
        key: "next",
        value: function next() {
          var nextState;
          var getNextState = this['next_' + this.state];
  
          if (getNextState) {
            if (typeof getNextState === 'string') {
              nextState = getNextState;
            } else {
              nextState = getNextState.call(this);
            }
          }
  
          this["goto"](nextState);
          return this;
        }
      }, {
        key: "addState",
        value: function addState(name, state) {
          if (typeof name !== 'string') {
            state = name;
            name = state.name;
          }
  
          var getNextStateCallback = state.next;
  
          if (getNextStateCallback) {
            this['next_' + name] = getNextStateCallback;
          }
  
          var exitCallback = state.exit;
  
          if (exitCallback) {
            this['exit_' + name] = exitCallback;
          }
  
          var enterCallback = state.enter;
  
          if (enterCallback) {
            this['enter_' + name] = enterCallback;
          }
  
          return this;
        }
      }, {
        key: "addStates",
        value: function addStates(states) {
          if (Array.isArray(states)) {
            for (var i = 0, cnt = states.length; i < cnt; i++) {
              this.addState(states[i]);
            }
          } else {
            for (var name in states) {
              this.addState(name, states[name]);
            }
          }
  
          return this;
        }
      }, {
        key: "runMethod",
        value: function runMethod(methodName, a1, a2, a3, a4, a5) {
          var fn = this[methodName + '_' + this.state];
  
          if (!fn) {
            return undefined;
          } // Copy from eventemitter3
  
  
          var len = arguments.length;
  
          switch (len) {
            case 1:
              return fn.call(this);
  
            case 2:
              return fn.call(this, a1);
  
            case 3:
              return fn.call(this, a1, a2);
  
            case 4:
              return fn.call(this, a1, a2, a3);
  
            case 5:
              return fn.call(this, a1, a2, a3, a4);
  
            case 6:
              return fn.call(this, a1, a2, a3, a4, a5);
          }
  
          var args = new Array(len - 1);
  
          for (var i = 1; i < len; i++) {
            args[i - 1] = arguments[i];
          }
  
          return fn.apply(this, args);
        }
      }, {
        key: "update",
        value: function update(time, delta) {
          this.runMethod('update', time, delta);
        }
      }, {
        key: "preupdate",
        value: function preupdate(time, delta) {
          this.runMethod('preupdate', time, delta);
        }
      }, {
        key: "postupdate",
        value: function postupdate(time, delta) {
          this.runMethod('postupdate', time, delta);
        }
      }]);
  
      return FSM;
    }();
  
    Object.assign(FSM.prototype, EventEmitterMethods);
  
    var Cooldown = /*#__PURE__*/function (_FSM) {
      _inherits(Cooldown, _FSM);
  
      var _super = _createSuper(Cooldown);
  
      function Cooldown() {
        var _this;
  
        _classCallCheck(this, Cooldown);
  
        _this = _super.call(this, {
          eventEmitter: false
        });
  
        _this["goto"]('IDLE');
  
        return _this;
      }
  
      _createClass(Cooldown, [{
        key: "setCooldownTime",
        value: function setCooldownTime(time) {
          this.cooldownTime = time;
          this.cooldownMode = time !== undefined;
          return this;
        }
      }, {
        key: "request",
        value: function request() {
          return this.runMethod('request');
        } // IDLE state
  
      }, {
        key: "update_IDLE",
        value: function update_IDLE() {
          this.compensationTime = 0;
        }
      }, {
        key: "request_IDLE",
        value: function request_IDLE() {
          this.next();
          return true;
        }
      }, {
        key: "next_IDLE",
        value: function next_IDLE() {
          if (this.cooldownMode) {
            return 'COOLDOWN';
          }
        } // COOLDOWN state
  
      }, {
        key: "enter_COOLDOWN",
        value: function enter_COOLDOWN() {
          this.remainderTime = this.cooldownTime + this.compensationTime;
        }
      }, {
        key: "update_COOLDOWN",
        value: function update_COOLDOWN(time, delta) {
          this.remainderTime -= delta;
  
          if (this.remainderTime < 0) {
            this.compensationTime = this.cooldownTime > delta ? -this.remainderTime : 0;
            this["goto"]('IDLE');
          }
        }
      }, {
        key: "request_COOLDOWN",
        value: function request_COOLDOWN() {
          return false;
        }
      }]);
  
      return Cooldown;
    }(FSM);
  
    var GetValue$p = Phaser.Utils.Objects.GetValue;
  
    var InTouching = /*#__PURE__*/function (_ComponentBase) {
      _inherits(InTouching, _ComponentBase);
  
      var _super = _createSuper(InTouching);
  
      function InTouching(gameObject, config) {
        var _this;
  
        _classCallCheck(this, InTouching);
  
        _this = _super.call(this, gameObject, config); // this.parent = gameObject;
  
        _this._enable = undefined;
        _this.cooldown = new Cooldown();
  
        _this.parent.setInteractive(GetValue$p(config, 'inputConfig', undefined));
  
        _this.resetFromJSON(config);
  
        _this.boot();
  
        return _this;
      }
  
      _createClass(InTouching, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          this.pointer = undefined;
          this.isInTouched = false;
          this.setEnable(GetValue$p(o, 'enable', true));
          this.setCooldown(GetValue$p(o, 'cooldown', undefined));
          return this;
        }
      }, {
        key: "boot",
        value: function boot() {
          var gameObject = this.parent;
          gameObject.on('pointerdown', this.onPointIn, this);
          gameObject.on('pointerover', this.onPointIn, this);
          gameObject.on('pointerup', this.onPointOut, this);
          gameObject.on('pointerout', this.onPointOut, this);
          this.scene.sys.events.on('preupdate', this.preupdate, this);
        }
      }, {
        key: "shutdown",
        value: function shutdown(fromScene) {
          // Already shutdown
          if (this.isShutdown) {
            return;
          } // GameObject events will be removed when this gameObject destroyed 
          // this.parent.off('pointerdown', this.onPointIn, this);
          // this.parent.off('pointerover', this.onPointIn, this);
          // this.parent.off('pointerup', this.onPointOut, this);
          // this.parent.off('pointerout', this.onPointOut, this);
  
  
          this.scene.sys.events.off('preupdate', this.preupdate, this);
          this.pointer = undefined;
  
          _get(_getPrototypeOf(InTouching.prototype), "shutdown", this).call(this, fromScene);
        }
      }, {
        key: "enable",
        get: function get() {
          return this._enable;
        },
        set: function set(e) {
          if (this._enable === e) {
            return;
          }
  
          if (!e) {
            this.isInTouched = false;
            this.pointer = undefined;
          }
  
          this._enable = e;
          return this;
        }
      }, {
        key: "setEnable",
        value: function setEnable(e) {
          if (e === undefined) {
            e = true;
          }
  
          this.enable = e;
          return this;
        }
      }, {
        key: "cooldownTime",
        get: function get() {
          return this.cooldown.cooldownTime;
        },
        set: function set(time) {
          this.cooldown.setCooldownTime(time);
        }
      }, {
        key: "setCooldown",
        value: function setCooldown(time) {
          this.cooldownTime = time;
          return this;
        }
      }, {
        key: "toggleEnable",
        value: function toggleEnable() {
          this.setEnable(!this.enable);
          return this;
        } // internal
  
      }, {
        key: "onPointIn",
        value: function onPointIn(pointer, localX, localY) {
          if (!this.enable || !pointer.isDown || this.pointer !== undefined) {
            return;
          }
  
          this.pointer = pointer;
          this.isInTouched = true;
        }
      }, {
        key: "onPointOut",
        value: function onPointOut(pointer) {
          if (!this.enable || this.pointer !== pointer) {
            return;
          }
  
          this.pointer = undefined;
          this.isInTouched = false;
        }
      }, {
        key: "preupdate",
        value: function preupdate(time, delta) {
          this.cooldown.update(time, delta);
  
          if (this.isInTouched && this.cooldown.request()) {
            this.emit('intouch', this, this.parent, this.pointer);
          }
        }
      }]);
  
      return InTouching;
    }(ComponentBase);
  
    var TouchingMethods = {
      onTouching: function onTouching(callback, scope, config) {
        if (!callback) {
          return this;
        }
  
        if (this._inTouching === undefined) {
          this._inTouching = new InTouching(this, config);
        }
  
        this._inTouching.on('intouch', callback, scope);
  
        return this;
      },
      offTouching: function offTouching(callback, scope) {
        if (this._click === undefined) {
          return this;
        }
  
        this._inTouching.off('intouch', callback, scope);
  
        return this;
      }
    };
  
    var PointToChild = function PointToChild(parents, x, y) {
      var parent;
  
      for (var i = 0, cnt = parents.length; i < cnt; i++) {
        parent = parents[i];
  
        if (!ContainsPoint(parent, x, y)) {
          continue;
        }
  
        return parent.pointToChild(x, y);
      }
  
      return null;
    };
  
    var EmitChildEvent = function EmitChildEvent(eventEmitter, eventName, parents, x, y, pointer, event) {
      var child;
  
      if (y === undefined) {
        child = x;
      } else {
        child = PointToChild(parents, x, y);
      }
  
      if (!child) {
        return;
      }
  
      eventEmitter.emit(eventName, child, pointer, event);
    };
  
    var GetValue$o = Phaser.Utils.Objects.GetValue;
  
    var ClickChild = function ClickChild(config) {
      var clickConfig = GetValue$o(config, 'click', undefined);
  
      if (clickConfig === false) {
        return;
      }
  
      if (clickConfig === undefined) {
        clickConfig = {};
      }
  
      if (!clickConfig.hasOwnProperty('threshold')) {
        clickConfig.threshold = 10;
      }
  
      var childrenInteractive = this._childrenInteractive;
      this._click = new Button(this, clickConfig);
  
      this._click.on('click', function (button, gameObject, pointer, event) {
        EmitChildEvent(childrenInteractive.eventEmitter, "".concat(childrenInteractive.eventNamePrefix, "click"), childrenInteractive.targetSizers, pointer.worldX, pointer.worldY, pointer, event);
      }, this);
    };
  
    var GetValue$n = Phaser.Utils.Objects.GetValue;
  
    var OverChild = function OverChild(config) {
      var overConfig = GetValue$n(config, 'over', undefined);
  
      if (overConfig === false) {
        return;
      }
  
      this.on('pointermove', OnMove, this).on('pointerover', OnMove, this).on('pointerout', OnOut, this); // pointer-up is included too
    };
  
    var OnMove = function OnMove(pointer, localX, localY, event) {
      var childrenInteractive = this._childrenInteractive;
      var child = PointToChild(childrenInteractive.targetSizers, pointer.worldX, pointer.worldY);
      var preChild = childrenInteractive.lastOverChild;
  
      if (child && preChild && child === preChild) {
        return;
      }
  
      childrenInteractive.lastOverChild = child;
      EmitChildEvent(childrenInteractive.eventEmitter, "".concat(childrenInteractive.eventNamePrefix, "out"), childrenInteractive.targetSizers, preChild, undefined, pointer, event);
      EmitChildEvent(childrenInteractive.eventEmitter, "".concat(childrenInteractive.eventNamePrefix, "over"), childrenInteractive.targetSizers, child, undefined, pointer, event);
    };
  
    var OnOut = function OnOut(pointer, event) {
      var childrenInteractive = this._childrenInteractive;
      var child = childrenInteractive.lastOverChild;
      childrenInteractive.lastOverChild = null;
      EmitChildEvent(childrenInteractive.eventEmitter, "".concat(childrenInteractive.eventNamePrefix, "out"), childrenInteractive.targetSizers, child, undefined, pointer, event);
    };
  
    var GetValue$m = Phaser.Utils.Objects.GetValue;
  
    var OnePointerTracer = /*#__PURE__*/function (_TickTask) {
      _inherits(OnePointerTracer, _TickTask);
  
      var _super = _createSuper(OnePointerTracer);
  
      function OnePointerTracer(gameObject, config) {
        var _this;
  
        _classCallCheck(this, OnePointerTracer);
  
        var scene = GetSceneObject(gameObject);
  
        if (scene === gameObject) {
          gameObject = undefined;
        }
  
        _this = _super.call(this, scene, config);
        _this.gameObject = gameObject;
  
        if (gameObject) {
          gameObject.setInteractive(GetValue$m(config, "inputConfig", undefined));
        }
  
        _this._enable = undefined;
  
        _this.resetFromJSON(config);
  
        _this.boot();
  
        return _this;
      }
  
      _createClass(OnePointerTracer, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          this.setEnable(GetValue$m(o, 'enable', true));
          this.setDetectBounds();
  
          if (this.gameObject === undefined) {
            this.setDetectBounds(GetValue$m(o, 'bounds', undefined));
          } else {
            this.setDetectBounds();
          }
  
          this.tracerState = TOUCH0$1; // this.recongizedState = new stateClass(this);
  
          this.pointer = undefined;
          this.lastPointer = undefined; // Last catched pointer
  
          this.movedState = false;
          this.isTouchingAnyObject = false;
          return this;
        }
      }, {
        key: "boot",
        value: function boot() {
          _get(_getPrototypeOf(OnePointerTracer.prototype), "boot", this).call(this);
  
          if (this.gameObject) {
            this.gameObject.on('pointerdown', this.onPointerDown, this);
          } else {
            this.scene.input.on('pointerdown', this.onPointerDown, this);
          }
  
          this.scene.input.on('pointerup', this.onPointerUp, this);
          this.scene.input.on('gameout', this.dragCancel, this);
          this.scene.input.on('pointermove', this.onPointerMove, this);
          this.scene.sys.events.once('shutdown', this.destroy, this);
        }
      }, {
        key: "shutdown",
        value: function shutdown(fromScene) {
          if (!this.scene) {
            return;
          }
  
          if (this.gameObject) ; else {
            this.scene.input.off('pointerdown', this.onPointerDown, this);
          }
  
          this.scene.input.off('pointerup', this.onPointerUp, this);
          this.scene.input.off('gameout', this.dragCancel, this);
          this.scene.input.off('pointermove', this.onPointerMove, this);
          this.scene.sys.events.off('shutdown', this.destroy, this);
          this.gameObject = undefined;
          this.bounds = undefined;
          this.pointer = undefined;
          this.lastPointer = undefined; // Last catched pointer
  
          this.movedState = false;
  
          _get(_getPrototypeOf(OnePointerTracer.prototype), "shutdown", this).call(this, fromScene);
        }
      }, {
        key: "enable",
        get: function get() {
          return this._enable;
        },
        set: function set(e) {
          if (this._enable === e) {
            return;
          }
  
          if (!e) {
            this.dragCancel();
          }
  
          this._enable = e;
          return this;
        }
      }, {
        key: "setEnable",
        value: function setEnable(e) {
          if (e === undefined) {
            e = true;
          }
  
          this.enable = e;
          return this;
        }
      }, {
        key: "setDetectBounds",
        value: function setDetectBounds(bounds) {
          this.bounds = bounds;
          return this;
        }
      }, {
        key: "toggleEnable",
        value: function toggleEnable() {
          this.setEnable(!this.enable);
          return this;
        }
      }, {
        key: "onPointerDown",
        value: function onPointerDown(pointer, gameObjects) {
          if (!this.enable) {
            return;
          }
  
          if (this.pointer !== undefined) {
            return;
          }
  
          var isInsideBounds = this.bounds ? this.bounds.contains(pointer.x, pointer.y) : true;
  
          if (!isInsideBounds) {
            return;
          }
  
          if (this.pointer === pointer) {
            return;
          }
  
          this.pointer = pointer;
          this.lastPointer = pointer;
          this.movedState = false;
          this.tracerState = TOUCH1$1;
  
          if (this.gameObject === undefined) {
            this.isTouchingAnyObject = gameObjects.length > 0;
          }
  
          this.onDragStart();
        }
      }, {
        key: "onPointerUp",
        value: function onPointerUp(pointer) {
          if (!this.enable) {
            return;
          }
  
          var isInsideBounds = this.bounds ? this.bounds.contains(pointer.x, pointer.y) : true;
  
          if (!isInsideBounds) {
            return;
          }
  
          if (this.pointer !== pointer) {
            return;
          }
  
          this.pointer = undefined;
          this.movedState = false;
          this.tracerState = TOUCH0$1;
          this.onDragEnd();
        }
      }, {
        key: "onPointerMove",
        value: function onPointerMove(pointer) {
          if (!this.enable) {
            return;
          }
  
          if (pointer.isDown) {
            var isInsideBounds = this.bounds ? this.bounds.contains(pointer.x, pointer.y) : true;
            var isCatchedPointer = this.pointer === pointer;
  
            if (!isCatchedPointer && isInsideBounds) ; else if (isCatchedPointer && !isInsideBounds) {
              // Pointer moves out of bounds
              this.onPointerUp(pointer);
            } else {
              // Pointer drags in bounds
              if (!this.movedState) {
                this.movedState = pointer.x !== pointer.downX || pointer.y !== pointer.downY;
              }
  
              if (this.movedState) {
                this.onDrag();
              }
            }
          }
        }
      }, {
        key: "dragCancel",
        value: function dragCancel() {
          if (this.tracerState === TOUCH1$1) {
            this.onDragEnd();
          }
  
          this.pointer = undefined;
          this.tracerState = TOUCH0$1;
          return this;
        }
      }, {
        key: "onDragStart",
        value: function onDragStart() {
          this.emit('dragstart', this);
        }
      }, {
        key: "onDragEnd",
        value: function onDragEnd() {
          this.emit('dragend', this);
        }
      }, {
        key: "onDrag",
        value: function onDrag() {
          this.emit('drag', this);
        } // onLastPointerMove() { }
  
      }, {
        key: "preUpdate",
        value: function preUpdate(time, delta) {}
      }, {
        key: "postUpdate",
        value: function postUpdate(time, delta) {}
      }, {
        key: "startTicking",
        value: function startTicking() {
          _get(_getPrototypeOf(OnePointerTracer.prototype), "startTicking", this).call(this);
  
          this.scene.sys.events.on('preupdate', this.preUpdate, this);
          this.scene.sys.events.on('postupdate', this.postUpdate, this);
        }
      }, {
        key: "stopTicking",
        value: function stopTicking() {
          _get(_getPrototypeOf(OnePointerTracer.prototype), "stopTicking", this).call(this);
  
          if (this.scene) {
            // Scene might be destoryed
            this.scene.sys.events.off('preupdate', this.preUpdate, this);
            this.scene.sys.events.off('postupdate', this.postUpdate, this);
          }
        }
      }, {
        key: "setRecongizedStateObject",
        value: function setRecongizedStateObject(stateObject) {
          this.recongizedState = stateObject;
          return this;
        }
      }, {
        key: "state",
        get: function get() {
          return this.recongizedState.state;
        },
        set: function set(newState) {
          this.recongizedState.state = newState;
        }
      }, {
        key: "cancel",
        value: function cancel() {
          this.state = IDLE$5;
          return this;
        }
      }]);
  
      return OnePointerTracer;
    }(TickTask);
  
    var TOUCH0$1 = 0;
    var TOUCH1$1 = 1;
    var IDLE$5 = 'IDLE';
  
    var GetValue$l = Phaser.Utils.Objects.GetValue;
    var DistanceBetween$3 = Phaser.Math.Distance.Between;
  
    var Tap = /*#__PURE__*/function (_OnePointerTracer) {
      _inherits(Tap, _OnePointerTracer);
  
      var _super = _createSuper(Tap);
  
      function Tap(gameObject, config) {
        var _this;
  
        _classCallCheck(this, Tap);
  
        _this = _super.call(this, gameObject, config);
  
        var self = _assertThisInitialized(_this);
  
        var stateConfig = {
          states: {
            IDLE: {
              enter: function enter() {
                self.stop();
                self.tapsCount = 0;
                self.x = 0;
                self.y = 0;
                self.worldX = 0;
                self.worldY = 0;
              },
              exit: function exit() {
                var pointer = self.lastPointer;
                self.x = pointer.x;
                self.y = pointer.y;
                self.worldX = pointer.worldX;
                self.worldY = pointer.worldY;
              }
            },
            BEGIN: {
              enter: function enter() {
                self.start();
                self.tapsCount = 0;
                self.emit('tappingstart', self, self.gameObject, self.lastPointer);
              }
            },
            RECOGNIZED: {
              enter: function enter() {
                self.start();
                self.emit('tap', self, self.gameObject, self.lastPointer);
                self.emit("".concat(self.tapsCount, "tap"), self, self.gameObject, self.lastPointer);
              }
            }
          },
          init: function init() {
            this.state = IDLE$4;
          },
          eventEmitter: false
        };
  
        _this.setRecongizedStateObject(new FSM(stateConfig));
  
        return _this;
      }
  
      _createClass(Tap, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          _get(_getPrototypeOf(Tap.prototype), "resetFromJSON", this).call(this, o);
  
          this.setHoldTime(GetValue$l(o, 'time', 250)); // min-hold-time of Press is 251
  
          this.setTapInterval(GetValue$l(o, 'tapInterval', 200));
          this.setDragThreshold(GetValue$l(o, 'threshold', 9));
          this.setTapOffset(GetValue$l(o, 'tapOffset', 10));
          var taps = GetValue$l(o, 'taps', undefined);
  
          if (taps !== undefined) {
            this.setTaps(taps);
          } else {
            this.setMaxTaps(GetValue$l(o, 'maxTaps', undefined));
            this.setMinTaps(GetValue$l(o, 'minTaps', undefined));
          }
  
          return this;
        }
      }, {
        key: "onDragStart",
        value: function onDragStart() {
          switch (this.state) {
            case IDLE$4:
              this.state = BEGIN$3;
              break;
  
            case BEGIN$3:
              var pointer = this.lastPointer;
              var tapsOffset = DistanceBetween$3(pointer.upX, pointer.upY, pointer.x, pointer.y);
  
              if (tapsOffset > this.tapOffset) {
                // Can't recognize next level, restart here
                this.state = RECOGNIZED$3;
                this.state = BEGIN$3;
              }
  
              break;
  
            case RECOGNIZED$3:
              this.state = BEGIN$3;
              break;
          }
        }
      }, {
        key: "onDragEnd",
        value: function onDragEnd() {
          if (this.state === BEGIN$3) {
            this.tapsCount++; // Try recognize next level
  
            this.emit('tapping', this, this.gameObject, this.lastPointer);
  
            if (this.maxTaps !== undefined && this.tapsCount === this.maxTaps) {
              // Reach to maxTaps, stop here                
              this.state = RECOGNIZED$3;
            }
          }
        }
      }, {
        key: "onDrag",
        value: function onDrag() {
          if (this.state === IDLE$4) {
            return;
          }
  
          if (this.pointer.getDistance() > this.dragThreshold) {
            // Cancel
            this.state = IDLE$4;
          }
        }
      }, {
        key: "preUpdate",
        value: function preUpdate(time, delta) {
          if (!this.isRunning || !this.enable) {
            return;
          }
  
          if (this.state === BEGIN$3) {
            var pointer = this.lastPointer;
  
            if (pointer.isDown) {
              var holdTime = time - pointer.downTime;
  
              if (holdTime > this.holdTime) {
                this.state = IDLE$4;
              }
            } else {
              // isUp
              var releasedTime = time - pointer.upTime;
  
              if (releasedTime > this.tapInterval) {
                if (this.minTaps === undefined || this.tapsCount >= this.minTaps) {
                  this.state = RECOGNIZED$3;
                } else {
                  this.state = IDLE$4;
                }
              }
            }
          }
        }
      }, {
        key: "postUpdate",
        value: function postUpdate(time, delta) {
          if (!this.isRunning || !this.enable) {
            return;
          } // Clear RECOGNIZED after update()
  
  
          if (this.state === RECOGNIZED$3) {
            this.state = IDLE$4;
          }
        }
      }, {
        key: "isTapped",
        get: function get() {
          return this.state === RECOGNIZED$3;
        }
      }, {
        key: "setHoldTime",
        value: function setHoldTime(time) {
          this.holdTime = time; // ms
  
          return this;
        }
      }, {
        key: "setTapInterval",
        value: function setTapInterval(time) {
          this.tapInterval = time; // ms
  
          return this;
        }
      }, {
        key: "setDragThreshold",
        value: function setDragThreshold(distance) {
          this.dragThreshold = distance;
          return this;
        }
      }, {
        key: "setTapOffset",
        value: function setTapOffset(distance) {
          this.tapOffset = distance;
          return this;
        }
      }, {
        key: "setMaxTaps",
        value: function setMaxTaps(taps) {
          this.maxTaps = taps;
          return this;
        }
      }, {
        key: "setMinTaps",
        value: function setMinTaps(taps) {
          this.minTaps = taps;
          return this;
        }
      }, {
        key: "setTaps",
        value: function setTaps(minTaps, maxTaps) {
          if (maxTaps === undefined) {
            maxTaps = minTaps;
          }
  
          this.setMinTaps(minTaps).setMaxTaps(maxTaps);
          return this;
        }
      }]);
  
      return Tap;
    }(OnePointerTracer);
  
    var IDLE$4 = 'IDLE';
    var BEGIN$3 = 'BEGIN';
    var RECOGNIZED$3 = 'RECOGNIZED';
  
    var GetValue$k = Phaser.Utils.Objects.GetValue;
  
    var Press = /*#__PURE__*/function (_OnePointerTracer) {
      _inherits(Press, _OnePointerTracer);
  
      var _super = _createSuper(Press);
  
      function Press(gameObject, config) {
        var _this;
  
        _classCallCheck(this, Press);
  
        _this = _super.call(this, gameObject, config);
  
        var self = _assertThisInitialized(_this);
  
        var stateConfig = {
          states: {
            IDLE: {
              enter: function enter() {
                self.x = 0;
                self.y = 0;
                self.worldX = 0;
                self.worldY = 0;
              },
              exit: function exit() {
                var pointer = self.lastPointer;
                self.x = pointer.x;
                self.y = pointer.y;
                self.worldX = pointer.worldX;
                self.worldY = pointer.worldY;
              }
            },
            BEGIN: {
              enter: function enter() {
                self.start();
              },
              exit: function exit() {
                self.stop();
              }
            },
            RECOGNIZED: {
              enter: function enter() {
                self.emit('pressstart', self, self.gameObject, self.lastPointer);
              },
              exit: function exit() {
                self.emit('pressend', self, self.gameObject, self.lastPointer);
              }
            }
          },
          init: function init() {
            this.state = IDLE$3;
          },
          eventEmitter: false
        };
  
        _this.setRecongizedStateObject(new FSM(stateConfig));
  
        return _this;
      }
  
      _createClass(Press, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          _get(_getPrototypeOf(Press.prototype), "resetFromJSON", this).call(this, o);
  
          this.setDragThreshold(GetValue$k(o, 'threshold', 9));
          this.setHoldTime(GetValue$k(o, 'time', 251));
          return this;
        }
      }, {
        key: "onDragStart",
        value: function onDragStart() {
          this.state = BEGIN$2;
  
          if (this.holdTime === 0) {
            this.state = RECOGNIZED$2;
          }
        }
      }, {
        key: "onDragEnd",
        value: function onDragEnd() {
          this.state = IDLE$3;
        }
      }, {
        key: "onDrag",
        value: function onDrag() {
          if (this.state === IDLE$3) {
            return;
          }
  
          if (this.pointer.getDistance() > this.dragThreshold) {
            this.state = IDLE$3;
          }
        }
      }, {
        key: "preUpdate",
        value: function preUpdate(time, delta) {
          if (!this.isRunning || !this.enable) {
            return;
          }
  
          if (this.state === BEGIN$2) {
            var holdTime = time - this.pointer.downTime;
  
            if (holdTime >= this.holdTime) {
              this.state = RECOGNIZED$2;
            }
          }
        }
      }, {
        key: "isPressed",
        get: function get() {
          return this.state === RECOGNIZED$2;
        }
      }, {
        key: "setHoldTime",
        value: function setHoldTime(time) {
          this.holdTime = time; // ms
  
          return this;
        }
      }, {
        key: "setDragThreshold",
        value: function setDragThreshold(distance) {
          this.dragThreshold = distance;
          return this;
        }
      }]);
  
      return Press;
    }(OnePointerTracer);
  
    var IDLE$3 = 'IDLE';
    var BEGIN$2 = 'BEGIN';
    var RECOGNIZED$2 = 'RECOGNIZED';
  
    Phaser.Utils.Objects.GetValue;
  
    var DistanceBetween$2 = Phaser.Math.Distance.Between;
    var AngleBetween$1 = Phaser.Math.Angle.Between;
    var VelocityMethods = {
      getDt: function getDt() {
        var game = this.scene.sys.game;
        var dt = game.loop.delta;
        return dt;
      },
      getVelocity: function getVelocity() {
        var p1 = this.pointer.position;
        var p0 = this.pointer.prevPosition;
        var d = DistanceBetween$2(p0.x, p0.y, p1.x, p1.y);
        var velocity = d / (this.getDt() * 0.001);
        return velocity;
      },
      getVelocityX: function getVelocityX() {
        var p1 = this.pointer.position;
        var p0 = this.pointer.prevPosition;
        var d = Math.abs(p1.x - p0.x);
        var velocity = d / (this.getDt() * 0.001);
        return velocity;
      },
      getVelocityY: function getVelocityY() {
        var p1 = this.pointer.position;
        var p0 = this.pointer.prevPosition;
        var d = Math.abs(p1.y - p0.y);
        var velocity = d / (this.getDt() * 0.001);
        return velocity;
      },
      getVelocityAngle: function getVelocityAngle() {
        var p1 = this.pointer.position;
        var p0 = this.pointer.prevPosition;
        var angle = AngleBetween$1(p0.x, p0.y, p1.x, p1.y);
        return angle;
      }
    };
  
    var DIRMODE = {
      'up&down': 0,
      'left&right': 1,
      '4dir': 2,
      '8dir': 3
    };
  
    var AngleToDirections = function AngleToDirections(angle, dirMode, out) {
      if (out === undefined) {
        out = {};
      } else if (out === true) {
        out = globOut;
      }
  
      out.left = false;
      out.right = false;
      out.up = false;
      out.down = false;
      angle = (angle + 360) % 360;
  
      switch (dirMode) {
        case 0:
          // up & down
          if (angle < 180) {
            out.down = true;
          } else {
            out.up = true;
          }
  
          break;
  
        case 1:
          // left & right
          if (angle > 90 && angle <= 270) {
            out.left = true;
          } else {
            out.right = true;
          }
  
          break;
  
        case 2:
          // 4 dir
          if (angle > 45 && angle <= 135) {
            out.down = true;
          } else if (angle > 135 && angle <= 225) {
            out.left = true;
          } else if (angle > 225 && angle <= 315) {
            out.up = true;
          } else {
            out.right = true;
          }
  
          break;
  
        case 3:
          // 8 dir
          if (angle > 22.5 && angle <= 67.5) {
            out.down = true;
            out.right = true;
          } else if (angle > 67.5 && angle <= 112.5) {
            out.down = true;
          } else if (angle > 112.5 && angle <= 157.5) {
            out.down = true;
            out.left = true;
          } else if (angle > 157.5 && angle <= 202.5) {
            out.left = true;
          } else if (angle > 202.5 && angle <= 247.5) {
            out.left = true;
            out.up = true;
          } else if (angle > 247.5 && angle <= 292.5) {
            out.up = true;
          } else if (angle > 292.5 && angle <= 337.5) {
            out.up = true;
            out.right = true;
          } else {
            out.right = true;
          }
  
          break;
      }
  
      return out;
    };
  
    var globOut = {};
  
    var GetValue$j = Phaser.Utils.Objects.GetValue;
    var RadToDeg$1 = Phaser.Math.RadToDeg;
  
    var Swipe = /*#__PURE__*/function (_OnePointerTracer) {
      _inherits(Swipe, _OnePointerTracer);
  
      var _super = _createSuper(Swipe);
  
      function Swipe(gameObject, config) {
        var _this;
  
        _classCallCheck(this, Swipe);
  
        _this = _super.call(this, gameObject, config);
  
        var self = _assertThisInitialized(_this);
  
        var stateConfig = {
          states: {
            IDLE: {
              enter: function enter() {
                self.x = 0;
                self.y = 0;
                self.worldX = 0;
                self.worldY = 0;
              },
              exit: function exit() {
                var pointer = self.lastPointer;
                self.x = pointer.x;
                self.y = pointer.y;
                self.worldX = pointer.worldX;
                self.worldY = pointer.worldY;
              }
            },
            BEGIN: {
              enter: function enter() {
                self.validDrag = false;
              }
            },
            RECOGNIZED: {
              enter: function enter() {
                self.start();
                self.updateDirectionStates();
                self.emit('swipe', self, self.gameObject, self.lastPointer);
              },
              exit: function exit() {
                self.stop();
                self.clearDirectionStates();
              }
            }
          },
          init: function init() {
            this.state = IDLE$2;
          },
          eventEmitter: false
        };
  
        _this.setRecongizedStateObject(new FSM(stateConfig));
  
        _this.clearDirectionStates();
  
        return _this;
      }
  
      _createClass(Swipe, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          _get(_getPrototypeOf(Swipe.prototype), "resetFromJSON", this).call(this, o);
  
          this.setDragThreshold(GetValue$j(o, 'threshold', 10));
          this.setVelocityThreshold(GetValue$j(o, 'velocityThreshold', 1000));
          this.setDirectionMode(GetValue$j(o, 'dir', '8dir'));
          return this;
        }
      }, {
        key: "onDragStart",
        value: function onDragStart() {
          this.state = BEGIN$1;
        }
      }, {
        key: "onDragEnd",
        value: function onDragEnd() {
          this.state = IDLE$2;
        }
      }, {
        key: "onDrag",
        value: function onDrag() {
          if (this.state === BEGIN$1) {
            if (!this.validDrag) {
              this.validDrag = this.dragThreshold === 0 || this.pointer.getDistance() >= this.dragThreshold;
            }
  
            if (this.validDrag && this.dragVelocity > this.velocityThreshold) {
              this.state = RECOGNIZED$1;
            }
          }
        }
      }, {
        key: "postUpdate",
        value: function postUpdate(time, delta) {
          if (!this.isRunning || !this.enable) {
            return;
          } // Clear RECOGNIZED after update()
  
  
          if (this.state === RECOGNIZED$1) {
            this.state = IDLE$2;
          }
        }
      }, {
        key: "isSwiped",
        get: function get() {
          return this.state === RECOGNIZED$1;
        }
      }, {
        key: "dragVelocity",
        get: function get() {
          var velocity;
  
          switch (this.dirMode) {
            case 0:
              velocity = this.getVelocityY();
              break;
            // up & down
  
            case 1:
              velocity = this.getVelocityX();
              break;
            // left & right
  
            default:
              velocity = this.getVelocity();
              break;
            // 4 dir, 8 dir
          }
  
          return velocity;
        }
      }, {
        key: "setDragThreshold",
        value: function setDragThreshold(distance) {
          this.dragThreshold = distance;
          return this;
        }
      }, {
        key: "setVelocityThreshold",
        value: function setVelocityThreshold(velocity) {
          this.velocityThreshold = velocity;
          return this;
        }
      }, {
        key: "setDirectionMode",
        value: function setDirectionMode(m) {
          if (typeof m === 'string') {
            m = DIRMODE[m];
          }
  
          this.dirMode = m;
          return this;
        }
      }, {
        key: "updateDirectionStates",
        value: function updateDirectionStates() {
          var angle = RadToDeg$1(this.getVelocityAngle());
          AngleToDirections(angle, this.dirMode, this);
          return this;
        }
      }, {
        key: "clearDirectionStates",
        value: function clearDirectionStates() {
          this.left = false;
          this.right = false;
          this.up = false;
          this.down = false;
          return this;
        }
      }]);
  
      return Swipe;
    }(OnePointerTracer);
  
    Object.assign(Swipe.prototype, VelocityMethods);
    var IDLE$2 = 'IDLE';
    var BEGIN$1 = 'BEGIN';
    var RECOGNIZED$1 = 'RECOGNIZED';
  
    var Clear = function Clear(obj) {
      if (_typeof(obj) !== 'object' || obj === null) {
        return obj;
      }
  
      if (Array.isArray(obj)) {
        obj.length = 0;
      } else {
        for (var key in obj) {
          delete obj[key];
        }
      }
  
      return obj;
    };
  
    var GetValue$i = Phaser.Utils.Objects.GetValue;
    var SpliceOne = Phaser.Utils.Array.SpliceOne;
    var DistanceBetween$1 = Phaser.Math.Distance.Between;
    var AngleBetween = Phaser.Math.Angle.Between;
  
    var TwoPointersTracer = /*#__PURE__*/function () {
      function TwoPointersTracer(scene, config) {
        _classCallCheck(this, TwoPointersTracer);
  
        var amount = scene.input.manager.pointersTotal - 1;
  
        if (amount < 2) {
          scene.input.addPointer(2 - amount);
        }
  
        this.scene = scene; // Event emitter
  
        this.setEventEmitter(GetValue$i(config, 'eventEmitter', undefined));
        this._enable = undefined;
        this.pointers = [];
        this.movedState = {};
        this.resetFromJSON(config);
        this.boot();
      }
  
      _createClass(TwoPointersTracer, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          this.setEnable(GetValue$i(o, "enable", true));
          this.bounds = GetValue$i(o, 'bounds', undefined);
          this.tracerState = TOUCH0;
          this.pointers.length = 0;
          Clear(this.movedState);
          return this;
        }
      }, {
        key: "boot",
        value: function boot() {
          this.scene.input.on('pointerdown', this.onPointerDown, this);
          this.scene.input.on('pointerup', this.onPointerUp, this);
          this.scene.input.on('gameout', this.dragCancel, this);
          this.scene.input.on('pointermove', this.onPointerMove, this);
          this.scene.sys.events.once('shutdown', this.destroy, this);
        }
      }, {
        key: "shutdown",
        value: function shutdown() {
          if (!this.scene) {
            return;
          }
  
          this.destroyEventEmitter();
          this.pointers.length = 0;
          Clear(this.movedState);
          this.scene.input.off('pointerdown', this.onPointerDown, this);
          this.scene.input.off('pointerup', this.onPointerUp, this);
          this.scene.input.off('gameout', this.dragCancel, this);
          this.scene.input.off('pointermove', this.onPointerMove, this);
          this.scene.sys.events.off('shutdown', this.destroy, this);
          this.scene = undefined;
        }
      }, {
        key: "destroy",
        value: function destroy() {
          this.shutdown();
        }
      }, {
        key: "enable",
        get: function get() {
          return this._enable;
        },
        set: function set(e) {
          if (this._enable === e) {
            return;
          }
  
          if (!e) {
            this.dragCancel();
          }
  
          this._enable = e;
          return this;
        }
      }, {
        key: "setEnable",
        value: function setEnable(e) {
          if (e === undefined) {
            e = true;
          }
  
          this.enable = e;
          return this;
        }
      }, {
        key: "toggleEnable",
        value: function toggleEnable() {
          this.setEnable(!this.enable);
          return this;
        }
      }, {
        key: "onPointerDown",
        value: function onPointerDown(pointer) {
          if (!this.enable) {
            return;
          }
  
          if (this.pointers.length === 2) {
            return;
          }
  
          var isInsideBounds = this.bounds ? this.bounds.contains(pointer.x, pointer.y) : true;
  
          if (!isInsideBounds) {
            return;
          }
  
          var index = this.pointers.indexOf(pointer);
  
          if (index !== -1) {
            // Already in catched pointers
            return;
          }
  
          this.movedState[pointer.id] = false;
          this.pointers.push(pointer);
  
          switch (this.tracerState) {
            case TOUCH0:
              this.tracerState = TOUCH1;
              this.onDrag1Start();
              break;
  
            case TOUCH1:
              this.tracerState = TOUCH2;
              this.onDrag2Start();
              break;
          }
        }
      }, {
        key: "onPointerUp",
        value: function onPointerUp(pointer) {
          if (!this.enable) {
            return;
          }
  
          var isInsideBounds = this.bounds ? this.bounds.contains(pointer.x, pointer.y) : true;
  
          if (!isInsideBounds) {
            return;
          }
  
          var index = this.pointers.indexOf(pointer);
  
          if (index === -1) {
            // Not in catched pointers
            return;
          } else {
            delete this.movedState[pointer.id];
            SpliceOne(this.pointers, index);
          }
  
          switch (this.tracerState) {
            case TOUCH1:
              this.tracerState = TOUCH0;
              this.onDrag1End();
              break;
  
            case TOUCH2:
              this.tracerState = TOUCH1;
              this.onDrag2End();
              this.onDrag1Start();
              break;
          }
        }
      }, {
        key: "onPointerMove",
        value: function onPointerMove(pointer) {
          if (!this.enable) {
            return;
          }
  
          if (pointer.isDown) {
            var isInsideBounds = this.bounds ? this.bounds.contains(pointer.x, pointer.y) : true;
            var isCatchedPointer = this.pointers.indexOf(pointer) !== -1;
  
            if (!isCatchedPointer && isInsideBounds) ; else if (isCatchedPointer && !isInsideBounds) {
              // Pointer moves out of bounds, lose pointer
              this.onPointerUp(pointer);
            } else {
              // Pointer drags in bounds
              if (!this.movedState[pointer.id]) {
                this.movedState[pointer.id] = pointer.x !== pointer.downX || pointer.y !== pointer.downY;
              }
  
              if (this.movedState[pointer.id]) {
                switch (this.tracerState) {
                  case TOUCH1:
                    this.onDrag1();
                    break;
  
                  case TOUCH2:
                    this.onDrag2();
                    break;
                }
              }
            }
          }
        }
      }, {
        key: "dragCancel",
        value: function dragCancel() {
          if (this.tracerState === TOUCH2) {
            this.onDrag2End();
          }
  
          this.pointers.length = 0;
          Clear(this.movedState);
          this.tracerState = TOUCH0;
          return this;
        }
      }, {
        key: "onDrag1Start",
        value: function onDrag1Start() {
          this.emit('drag1start', this);
        }
      }, {
        key: "onDrag1End",
        value: function onDrag1End() {
          this.emit('drag1end', this);
        }
      }, {
        key: "onDrag1",
        value: function onDrag1() {
          this.emit('drag1', this);
        }
      }, {
        key: "onDrag2Start",
        value: function onDrag2Start() {
          this.emit('drag2start', this);
        }
      }, {
        key: "onDrag2End",
        value: function onDrag2End() {
          this.emit('drag2end', this);
        }
      }, {
        key: "onDrag2",
        value: function onDrag2() {
          this.emit('drag2', this);
        }
      }, {
        key: "distanceBetween",
        get: function get() {
          if (this.tracerState !== TOUCH2) {
            return 0;
          }
  
          var p0 = this.pointers[0],
              p1 = this.pointers[1];
          return DistanceBetween$1(p0.x, p0.y, p1.x, p1.y);
        }
      }, {
        key: "angleBetween",
        get: function get() {
          if (this.tracerState !== TOUCH2) {
            return 0;
          }
  
          var p0 = this.pointers[0],
              p1 = this.pointers[1];
          return AngleBetween(p0.x, p0.y, p1.x, p1.y);
        }
      }, {
        key: "drag1Vector",
        get: function get() {
          var pointer = this.pointers[0];
  
          if (pointer && this.movedState[pointer.id]) {
            var p1 = pointer.position;
            var p0 = pointer.prevPosition;
            tmpDragVector.x = p1.x - p0.x;
            tmpDragVector.y = p1.y - p0.y;
          } else {
            tmpDragVector.x = 0;
            tmpDragVector.y = 0;
          }
  
          return tmpDragVector;
        }
      }, {
        key: "centerX",
        get: function get() {
          if (this.tracerState !== TOUCH2) {
            return 0;
          }
  
          var p0 = this.pointers[0].position;
          var p1 = this.pointers[1].position;
          return (p0.x + p1.x) / 2;
        }
      }, {
        key: "centerY",
        get: function get() {
          if (this.tracerState !== TOUCH2) {
            return 0;
          }
  
          var p0 = this.pointers[0].position;
          var p1 = this.pointers[1].position;
          return (p0.y + p1.y) / 2;
        }
      }, {
        key: "prevCenterX",
        get: function get() {
          if (this.tracerState !== TOUCH2) {
            return 0;
          }
  
          var preP0 = this.movedState[this.pointers[0].id] ? this.pointers[0].prevPosition : this.pointers[0].position;
          var preP1 = this.movedState[this.pointers[1].id] ? this.pointers[1].prevPosition : this.pointers[1].position;
          return (preP0.x + preP1.x) / 2;
        }
      }, {
        key: "prevCenterY",
        get: function get() {
          if (this.tracerState !== TOUCH2) {
            return 0;
          }
  
          var preP0 = this.movedState[this.pointers[0].id] ? this.pointers[0].prevPosition : this.pointers[0].position;
          var preP1 = this.movedState[this.pointers[1].id] ? this.pointers[1].prevPosition : this.pointers[1].position;
          return (preP0.y + preP1.y) / 2;
        }
      }, {
        key: "movementCenterX",
        get: function get() {
          return this.centerX - this.prevCenterX;
        }
      }, {
        key: "movementCenterY",
        get: function get() {
          return this.centerY - this.prevCenterY;
        }
      }, {
        key: "setRecongizedStateObject",
        value: function setRecongizedStateObject(stateObject) {
          this.recongizedState = stateObject;
          return this;
        }
      }, {
        key: "state",
        get: function get() {
          return this.recongizedState.state;
        },
        set: function set(newState) {
          this.recongizedState.state = newState;
        }
      }, {
        key: "cancel",
        value: function cancel() {
          this.state = IDLE$1;
          return this;
        }
      }]);
  
      return TwoPointersTracer;
    }();
  
    Object.assign(TwoPointersTracer.prototype, EventEmitterMethods);
    var tmpDragVector = {};
    var TOUCH0 = 0;
    var TOUCH1 = 1;
    var TOUCH2 = 2;
    var IDLE$1 = 'IDLE';
  
    Phaser.Utils.Objects.GetValue;
  
    var RotateAround = Phaser.Math.RotateAround;
  
    var RotateObjectAround = function RotateObjectAround(gameObject, x, y, angle) {
      RotateAround(gameObject, x, y, angle);
      gameObject.rotation += angle;
      return gameObject;
    };
  
    var ScreenXYToWorldXY = function ScreenXYToWorldXY(screenX, screenY, camera, out) {
      if (out === undefined) {
        out = {};
      } else if (out === true) {
        out = globalOut;
      }
  
      camera.getWorldPoint(screenX, screenY, out);
      return out;
    };
  
    var globalOut = {};
  
    var SpinObject = function SpinObject(gameObject, camera) {
      if (!this.isRotation) {
        return this;
      }
  
      if (camera === undefined) {
        camera = this.pointers[0].camera;
      }
  
      var movementX = this.movementCenterX,
          movementY = this.movementCenterY;
      var worldXY = ScreenXYToWorldXY(this.centerX, this.centerY, camera, true);
      var centerWorldX = worldXY.x;
      var centerWorldY = worldXY.y;
      var angle = this.rotation;
  
      if (Array.isArray(gameObject)) {
        var gameObjects = gameObject;
  
        for (var i = 0, cnt = gameObjects.length; i < cnt; i++) {
          gameObject = gameObjects[i];
          gameObject.x += movementX;
          gameObject.y += movementY;
          RotateObjectAround(gameObject, centerWorldX, centerWorldY, angle);
        }
      } else {
        gameObject.x += movementX;
        gameObject.y += movementY;
        RotateObjectAround(gameObject, centerWorldX, centerWorldY, angle);
      }
  
      return this;
    };
  
    var GetValue$h = Phaser.Utils.Objects.GetValue;
    var WrapDegrees = Phaser.Math.Angle.WrapDegrees; // Wrap degrees: -180 to 180 
  
    var ShortestBetween = Phaser.Math.Angle.ShortestBetween;
    var RadToDeg = Phaser.Math.RadToDeg;
    var DegToRad = Phaser.Math.DegToRad;
  
    var Rotate = /*#__PURE__*/function (_TwoPointersTracer) {
      _inherits(Rotate, _TwoPointersTracer);
  
      var _super = _createSuper(Rotate);
  
      function Rotate(scene, config) {
        var _this;
  
        _classCallCheck(this, Rotate);
  
        _this = _super.call(this, scene, config);
  
        var self = _assertThisInitialized(_this);
  
        var stateConfig = {
          states: {
            IDLE: {
              enter: function enter() {
                self.prevAngle = undefined;
                self.angle = 0;
              }
            },
            BEGIN: {},
            RECOGNIZED: {
              enter: function enter() {
                self.emit('rotatestart', self);
              },
              exit: function exit() {
                self.emit('rotateend', self);
              }
            }
          },
          init: function init() {
            this.state = IDLE;
          },
          eventEmitter: false
        };
  
        _this.setRecongizedStateObject(new FSM(stateConfig));
  
        return _this;
      }
  
      _createClass(Rotate, [{
        key: "resetFromJSON",
        value: function resetFromJSON(o) {
          _get(_getPrototypeOf(Rotate.prototype), "resetFromJSON", this).call(this, o);
  
          this.setDragThreshold(GetValue$h(o, 'threshold', 0));
          return this;
        }
      }, {
        key: "onDrag2Start",
        value: function onDrag2Start() {
          this.prevAngle = WrapDegrees(RadToDeg(this.angleBetween)); // Degrees
  
          this.state = BEGIN;
  
          if (this.dragThreshold === 0) {
            this.state = RECOGNIZED;
          }
        }
      }, {
        key: "onDrag2End",
        value: function onDrag2End() {
          this.state = IDLE;
        }
      }, {
        key: "onDrag2",
        value: function onDrag2() {
          switch (this.state) {
            case BEGIN:
              if (this.pointers[0].getDistance() >= this.dragThreshold && this.pointers[1].getDistance() >= this.dragThreshold) {
                var curAngle = WrapDegrees(RadToDeg(this.angleBetween));
                this.angle = ShortestBetween(this.prevAngle, curAngle);
                this.prevAngle = curAngle;
                this.state = RECOGNIZED;
              }
  
              break;
  
            case RECOGNIZED:
              var curAngle = WrapDegrees(RadToDeg(this.angleBetween));
              this.angle = ShortestBetween(this.prevAngle, curAngle);
              this.prevAngle = curAngle;
              this.emit('rotate', this);
              break;
          }
        }
      }, {
        key: "isRotated",
        get: function get() {
          return this.state === RECOGNIZED;
        }
      }, {
        key: "rotation",
        get: function get() {
          return DegToRad(this.angle);
        }
      }, {
        key: "setDragThreshold",
        value: function setDragThreshold(distance) {
          this.dragThreshold = distance;
          return this;
        }
      }]);
  
      return Rotate;
    }(TwoPointersTracer);
  
    var methods$5 = {
      spinObject: SpinObject
    };
    Object.assign(Rotate.prototype, methods$5);
    var IDLE = 'IDLE';
    var BEGIN = 'BEGIN';
    var RECOGNIZED = 'RECOGNIZED';
  
    var GetValue$g = Phaser.Utils.Objects.GetValue;
  
    var TapChild = function TapChild(config) {
      var tapConfig = GetValue$g(config, 'tap', undefined);
  
      if (tapConfig === false) {
        return;
      }
  
      var childrenInteractive = this._childrenInteractive;
      this._tap = new Tap(this, tapConfig);
  
      this._tap.on('tap', function (tap, gameObject, lastPointer) {
        EmitChildEvent(childrenInteractive.eventEmitter, "".concat(childrenInteractive.eventNamePrefix).concat(tap.tapsCount, "tap"), childrenInteractive.targetSizers, tap.worldX, tap.worldY, lastPointer);
      }, this);
    };
  
    var GetValue$f = Phaser.Utils.Objects.GetValue;
  
    var PressChild = function PressChild(config) {
      var pressConfig = GetValue$f(config, 'press', undefined);
  
      if (pressConfig === false) {
        return;
      }
  
      var childrenInteractive = this._childrenInteractive;
      this._press = new Press(this, pressConfig);
  
      this._press.on('pressstart', function (press, gameObject, lastPointer) {
        EmitChildEvent(childrenInteractive.eventEmitter, "".concat(childrenInteractive.eventNamePrefix, "pressstart"), childrenInteractive.targetSizers, press.worldX, press.worldY, lastPointer);
      }, this).on('pressend', function (press, gameObject, lastPointer) {
        EmitChildEvent(childrenInteractive.eventEmitter, "".concat(childrenInteractive.eventNamePrefix, "pressend"), childrenInteractive.targetSizers, press.worldX, press.worldY, lastPointer);
      }, this);
    };
  
    var GetValue$e = Phaser.Utils.Objects.GetValue;
  
    var SwipeChild = function SwipeChild(config) {
      var swipeConfig = GetValue$e(config, 'swipe', undefined);
  
      if (swipeConfig === false) {
        return;
      }
  
      if (swipeConfig === undefined) {
        swipeConfig = {};
      }
  
      if (!swipeConfig.hasOwnProperty('dir')) {
        swipeConfig.dir = '4dir';
      }
  
      var childrenInteractive = this._childrenInteractive;
      this._swipe = new Swipe(this, swipeConfig);
  
      this._swipe.on('swipe', function (swipe, gameObject, lastPointer) {
        var dirName = swipe.left ? 'left' : swipe.right ? 'right' : swipe.up ? 'up' : 'down';
        EmitChildEvent(childrenInteractive.eventEmitter, "".concat(childrenInteractive.eventNamePrefix, "swipe").concat(dirName), childrenInteractive.targetSizers, swipe.worldX, swipe.worldY, lastPointer);
      }, this);
    };
  
    var GetValue$d = Phaser.Utils.Objects.GetValue;
  
    var SetChildrenInteractive = function SetChildrenInteractive(gameObject, config) {
      gameObject.setInteractive();
      gameObject._childrenInteractive = {
        targetSizers: GetValue$d(config, 'targets', [gameObject]),
        eventEmitter: GetValue$d(config, 'eventEmitter', gameObject),
        eventNamePrefix: GetValue$d(config, 'inputEventPrefix', 'child.')
      };
      ClickChild.call(gameObject, config);
      OverChild.call(gameObject, config);
      TapChild.call(gameObject, config);
      PressChild.call(gameObject, config);
      SwipeChild.call(gameObject, config);
      return gameObject;
    };
  
    var SetChildrenInteractiveWrap = function SetChildrenInteractiveWrap(config) {
      SetChildrenInteractive(this, config);
      return this;
    };
  
    var BroadcastEvent = function BroadcastEvent() {
      var gameObjects = this.getAllChildren([this]);
  
      for (var i = 0, cnt = gameObjects.length; i < cnt; i++) {
        var gameObject = gameObjects[i];
        gameObject.emit.apply(gameObject, arguments);
      }
  
      return this;
    };
  
    var methods$4 = {
      getSizerConfig: GetSizerConfig,
      getChildPrevState: GetChildPrevState,
      pushIntoBounds: PushIntoBounds,
      drawBounds: DrawBounds,
      resolveWidth: ResolveWidth$2,
      resolveChildrenWidth: ResolveChildrenWidth$1,
      resolveHeight: ResolveHeight$2,
      getChildWidth: GetChildWidth$1,
      getChildHeight: GetChildHeight,
      getExpandedChildWidth: GetExpandedChildWidth$2,
      getExpandedChildHeight: GetExpandedChildHeight$2,
      getChildrenWidth: GetChildrenWidth$3,
      getChildrenHeight: GetChildrenHeight$3,
      addChildrenMap: AddChildrenMap,
      addElement: AddChildrenMap,
      removeChildrenMap: RemoveChildrenMap,
      getElement: GetElement,
      getAllChildrenSizers: GetAllChildrenSizers,
      getChildrenSizers: GetChildrenSizers$3,
      preLayout: PreLayout$3,
      layout: Layout,
      runLayout: RunLayout,
      layoutChildren: LayoutChildren$3,
      runWidthWrap: RunWidthWrap$2,
      layoutBackgrounds: LayoutBackgrounds,
      postLayout: PostLayout,
      setAnchor: SetAnchor,
      isInTouching: IsInTouching,
      pointToChild: PointToChild$1,
      setDraggable: SetDraggable,
      setChildrenInteractive: SetChildrenInteractiveWrap,
      broadcastEvent: BroadcastEvent
    };
    Object.assign(methods$4, PaddingMethods, AddChildMethods$6, RemoveChildMethods$6, GetParentSizerMethods, ScaleMethods, FadeMethods, EaseMoveMethods, ShakeMethods, EaseDataMethods, ClickMethods, ClickOutsideMethods, TouchingMethods, HideMethods, GetShownChildrenMethods);
  
    var GetValue$c = Phaser.Utils.Objects.GetValue;
  
    var Base = /*#__PURE__*/function (_Container) {
      _inherits(Base, _Container);
  
      var _super = _createSuper(Base);
  
      function Base(scene, x, y, minWidth, minHeight, config) {
        var _this;
  
        _classCallCheck(this, Base);
  
        _this = _super.call(this, scene, x, y, 2, 2);
        _this.isRexSizer = true;
  
        _this.setMinSize(minWidth, minHeight);
  
        _this.setName(GetValue$c(config, 'name', ''));
  
        _this.rexSizer = {};
        _this.space = {};
        _this.backgroundChildren = undefined;
        _this.sizerChildren = undefined; // [] or {}
  
        _this.layoutedChildren = undefined;
        var anchorConfig = GetValue$c(config, 'anchor', undefined);
  
        if (anchorConfig) {
          _this.setAnchor(anchorConfig);
        }
  
        _this.setInnerPadding(GetValue$c(config, 'space', 0));
  
        _this.setDraggable(GetValue$c(config, 'draggable', false));
  
        _this.setSizerEventsEnable(GetValue$c(config, 'sizerEvents', false));
  
        _this.setDirty(true);
  
        return _this;
      }
  
      _createClass(Base, [{
        key: "destroy",
        value: function destroy(fromScene) {
          //  This Game Object has already been destroyed
          if (!this.scene) {
            return;
          }
  
          if (fromScene) {
            // In this case, children will be cleared and destroy in scene level
            var sizers = this.getAllChildrenSizers([this]);
  
            for (var i = 0, cnt = sizers.length; i < cnt; i++) {
              sizers[i].sizerEventsEnable = false;
            }
          }
  
          _get(_getPrototypeOf(Base.prototype), "destroy", this).call(this, fromScene);
  
          Clear(this.backgroundChildren);
          Clear(this.sizerChildren);
          this.childrenMap = undefined;
          this.space = undefined;
          this.rexSizer = undefined;
          this.layoutedChildren = undefined;
        }
      }, {
        key: "setMinSize",
        value: function setMinSize(minWidth, minHeight) {
          this.setMinWidth(minWidth).setMinHeight(minHeight);
          return this;
        }
      }, {
        key: "setMinWidth",
        value: function setMinWidth(minWidth) {
          if (minWidth == null) {
            minWidth = 0;
          }
  
          this.minWidth = minWidth;
          return this;
        }
      }, {
        key: "setMinHeight",
        value: function setMinHeight(minHeight) {
          if (minHeight == null) {
            minHeight = 0;
          }
  
          this.minHeight = minHeight;
          return this;
        }
      }, {
        key: "setDirty",
        value: function setDirty(dirty) {
          if (dirty === undefined) {
            dirty = true;
          }
  
          this.dirty = dirty;
          return this;
        }
      }, {
        key: "setSizerEventsEnable",
        value: function setSizerEventsEnable(enable) {
          if (enable === undefined) {
            enable = true;
          }
  
          this.sizerEventsEnable = enable;
          return this;
        }
      }, {
        key: "ignoreLayout",
        get: function get() {
          // Skip hidden or !dirty sizer
          return this.rexSizer.hidden || !this.dirty;
        }
      }, {
        key: "childrenWidth",
        get: function get() {
          if (this._childrenWidth === undefined) {
            this._childrenWidth = this.getChildrenWidth();
          }
  
          return this._childrenWidth;
        }
      }, {
        key: "childrenHeight",
        get: function get() {
          if (this._childrenHeight === undefined) {
            this._childrenHeight = this.getChildrenHeight();
          }
  
          return this._childrenHeight;
        }
      }, {
        key: "left",
        get: function get() {
          return this.x - GetDisplayWidth(this) * this.originX;
        },
        set: function set(value) {
          this.x += value - this.left;
        }
      }, {
        key: "alignLeft",
        value: function alignLeft(value) {
          this.left = value;
          return this;
        }
      }, {
        key: "right",
        get: function get() {
          return this.left + GetDisplayWidth(this);
        },
        set: function set(value) {
          this.x += value - this.right;
        }
      }, {
        key: "alignRight",
        value: function alignRight(value) {
          this.right = value;
          return this;
        }
      }, {
        key: "centerX",
        get: function get() {
          return this.left + GetDisplayWidth(this) / 2;
        },
        set: function set(value) {
          this.x += value - this.centerX;
        }
      }, {
        key: "alignCenterX",
        value: function alignCenterX(value) {
          this.centerX = value;
          return this;
        }
      }, {
        key: "top",
        get: function get() {
          return this.y - GetDisplayHeight(this) * this.originY;
        },
        set: function set(value) {
          this.y += value - this.top;
        }
      }, {
        key: "alignTop",
        value: function alignTop(value) {
          this.top = value;
          return this;
        }
      }, {
        key: "bottom",
        get: function get() {
          return this.top + GetDisplayHeight(this);
        },
        set: function set(value) {
          this.y += value - this.bottom;
        }
      }, {
        key: "alignBottom",
        value: function alignBottom(value) {
          this.bottom = value;
          return this;
        }
      }, {
        key: "centerY",
        get: function get() {
          return this.top + GetDisplayHeight(this) / 2;
        },
        set: function set(value) {
          this.y += value - this.centerY;
        }
      }, {
        key: "alignCenterY",
        value: function alignCenterY(value) {
          this.centerY = value;
          return this;
        }
      }, {
        key: "innerLeft",
        get: function get() {
          return this.left + this.space.left;
        }
      }, {
        key: "innerRight",
        get: function get() {
          return this.right - this.space.right;
        }
      }, {
        key: "innerTop",
        get: function get() {
          return this.top + this.space.top;
        }
      }, {
        key: "innerBottom",
        get: function get() {
          return this.bottom - this.space.bottom;
        }
      }, {
        key: "innerWidth",
        get: function get() {
          return this.width - this.space.left - this.space.right;
        }
      }, {
        key: "innerHeight",
        get: function get() {
          return this.height - this.space.top - this.space.bottom;
        }
      }, {
        key: "minInnerWidth",
        get: function get() {
          var result = this.minWidth - this.space.left - this.space.right;
          return Math.max(result, 0);
        }
      }, {
        key: "minInnerHeight",
        get: function get() {
          var result = this.minHeight - this.space.top - this.space.bottom;
          return Math.max(result, 0);
        }
      }]);
  
      return Base;
    }(ContainerLite);
  
    Object.assign(Base.prototype, methods$4);
  
    var GetChildrenWidth$2 = function GetChildrenWidth(minimumMode) {
      if (this.rexSizer.hidden) {
        return 0;
      }
  
      if (minimumMode === undefined) {
        minimumMode = true;
      }
  
      var result = 0;
      var children = this.sizerChildren;
      var child, padding, childWidth;
  
      if (this.orientation === 0) {
        // x
        // Get summation of minimum width
        for (var i = 0, cnt = children.length; i < cnt; i++) {
          child = children[i];
  
          if (child.rexSizer.hidden) {
            continue;
          }
  
          if (child.rexSizer.proportion === 0 || minimumMode && child.rexSizer.proportion > 0) {
            childWidth = this.getChildWidth(child);
          } else {
            childWidth = 0;
          }
  
          padding = child.rexSizer.padding;
          childWidth += padding.left + padding.right;
  
          if (i > 0) {
            childWidth += this.space.item;
          }
  
          result += childWidth;
        }
      } else {
        // Get maximun width
        for (var i = 0, cnt = children.length; i < cnt; i++) {
          child = children[i];
  
          if (!child.hasOwnProperty('rexSizer')) {
            continue;
          }
  
          if (child.rexSizer.hidden) {
            continue;
          }
  
          padding = child.rexSizer.padding;
          childWidth = this.getChildWidth(child) + padding.left + padding.right;
          result = Math.max(childWidth, result);
        }
      }
  
      return result + this.space.left + this.space.right;
    };
  
    var GetChildrenHeight$2 = function GetChildrenHeight(minimumMode) {
      if (this.rexSizer.hidden) {
        return 0;
      }
  
      if (minimumMode === undefined) {
        minimumMode = true;
      }
  
      var result = 0;
      var children = this.sizerChildren;
      var child, padding, childHeight;
  
      if (this.orientation === 0) {
        // x
        // Get maximun height
        for (var i = 0, cnt = children.length; i < cnt; i++) {
          child = children[i];
  
          if (child.rexSizer.hidden) {
            continue;
          }
  
          padding = child.rexSizer.padding;
          childHeight = this.getChildHeight(child) + padding.top + padding.bottom;
          result = Math.max(childHeight, result);
        }
      } else {
        // Get summation of minimum height
        for (var i = 0, cnt = children.length; i < cnt; i++) {
          child = children[i];
  
          if (!child.hasOwnProperty('rexSizer')) {
            continue;
          }
  
          if (child.rexSizer.hidden) {
            continue;
          }
  
          padding = child.rexSizer.padding;
  
          if (child.rexSizer.proportion === 0 || minimumMode && child.rexSizer.proportion > 0) {
            childHeight = this.getChildHeight(child);
          } else {
            childHeight = 0;
          }
  
          childHeight += padding.top + padding.bottom;
  
          if (i > 0) {
            childHeight += this.space.item;
          }
  
          result += childHeight;
        }
      }
  
      return result + this.space.top + this.space.bottom;
    };
  
    var GetExpandedChildWidth$1 = function GetExpandedChildWidth(child, parentWidth) {
      if (parentWidth === undefined) {
        parentWidth = this.width;
      }
  
      var childWidth;
      var childConfig = child.rexSizer;
      var padding = childConfig.padding;
  
      if (this.orientation === 0) {
        // x
        if (childConfig.proportion > 0 && this.proportionLength > 0) {
          childWidth = childConfig.proportion * this.proportionLength;
        }
      } else {
        // y
        if (childConfig.expand) {
          var innerWidth = parentWidth - this.space.left - this.space.right;
          childWidth = innerWidth - padding.left - padding.right;
        }
      }
  
      return childWidth;
    };
  
    var GetExpandedChildHeight$1 = function GetExpandedChildHeight(child, parentHeight) {
      if (parentHeight === undefined) {
        parentHeight = this.height;
      }
  
      var childHeight;
      var childConfig = child.rexSizer;
      var padding = childConfig.padding;
  
      if (this.orientation === 0) {
        // x
        if (childConfig.expand) {
          var innerHeight = parentHeight - this.space.top - this.space.bottom;
          childHeight = innerHeight - padding.top - padding.bottom;
        }
      } else {
        // y
        if (childConfig.proportion > 0 && this.proportionLength > 0) {
          childHeight = childConfig.proportion * this.proportionLength;
        }
      }
  
      return childHeight;
    };
  
    var GetChildrenSizers$2 = function GetChildrenSizers(out) {
      if (out === undefined) {
        out = [];
      }
  
      var children = this.sizerChildren,
          child;
  
      for (var i = 0, cnt = children.length; i < cnt; i++) {
        child = children[i];
  
        if (child.isRexSizer) {
          out.push(child);
        }
      }
  
      return out;
    };
  
    var PreLayout$2 = function PreLayout() {
      this._childrenProportion = undefined;
      this.proportionLength = undefined;
      PreLayout$3.call(this);
      return this;
    };
  
    var CheckSize = function CheckSize(child, parent) {
      if (child.width < child.childrenWidth) {
        // Warning
        console.warn("Layout width error: Parent=".concat(parent.constructor.name, ", Child=").concat(child.constructor.name));
      }
  
      if (child.height < child.childrenHeight) {
        // Warning
        console.warn("Layout height error: Parent=".concat(parent.constructor.name, ", Child=").concat(child.constructor.name));
      }
    };
  
    var LayoutChildren$2 = function LayoutChildren() {
      var children = this.sizerChildren;
      var child, childConfig, padding;
      var startX = this.innerLeft,
          startY = this.innerTop;
      var innerWidth = this.innerWidth;
      var innerHeight = this.innerHeight;
      var itemX = startX,
          itemY = startY;
      var x, y, width, height; // Align zone
  
      var childWidth, childHeight;
  
      for (var i = 0, cnt = children.length; i < cnt; i++) {
        child = !this.rtl ? children[i] : children[cnt - i - 1];
  
        if (child.rexSizer.hidden) {
          continue;
        }
  
        childConfig = child.rexSizer;
        padding = childConfig.padding;
        PreLayoutChild.call(this, child); // Set size
  
        if (child.isRexSpace) {
          childWidth = 0;
          childHeight = 0;
        } else {
          childWidth = this.getExpandedChildWidth(child);
          childHeight = this.getExpandedChildHeight(child);
        }
  
        if (child.isRexSizer) {
          child.runLayout(this, childWidth, childHeight);
          CheckSize(child, this);
        } else {
          ResizeGameObject(child, childWidth, childHeight);
        }
  
        if (childWidth === undefined) {
          childWidth = GetDisplayWidth(child);
        }
  
        if (childHeight === undefined) {
          childHeight = GetDisplayHeight(child);
        } // Set position
  
  
        if (this.orientation === 0) {
          // x
          x = itemX + padding.left;
  
          if (childConfig.proportion === 0 || this.proportionLength === 0) {
            width = childWidth;
          } else {
            width = childConfig.proportion * this.proportionLength;
          }
  
          y = itemY + padding.top;
          height = innerHeight - padding.top - padding.bottom;
        } else {
          // y
          x = itemX + padding.left;
          width = innerWidth - padding.left - padding.right;
          y = itemY + padding.top;
  
          if (childConfig.proportion === 0 || this.proportionLength === 0) {
            height = childHeight;
          } else {
            height = childConfig.proportion * this.proportionLength;
          }
        }
  
        LayoutChild.call(this, child, x, y, width, height, childConfig.align);
  
        if (this.orientation === 0) {
          // x
          itemX += width + padding.left + padding.right + this.space.item;
        } else {
          // y
          itemY += height + padding.top + padding.bottom + this.space.item;
        }
      }
    };
  
    var ResolveWidth$1 = function ResolveWidth(width) {
      var width = ResolveWidth$2.call(this, width); // Calculate proportionLength
  
      if (this.proportionLength === undefined && this.orientation === 0) {
        var remainder = width - this.childrenWidth;
  
        if (remainder > 0) {
          remainder = width - this.getChildrenWidth(false);
          this.proportionLength = remainder / this.childrenProportion;
        } else {
          this.proportionLength = 0;
        }
      }
  
      return width;
    };
  
    var ResolveHeight$1 = function ResolveHeight(parent, height) {
      var height = ResolveHeight$2.call(this, parent, height); // Get proportionLength
  
      if (this.proportionLength === undefined && this.orientation === 1) {
        var remainder = height - this.childrenHeight;
  
        if (remainder > 0) {
          remainder = height - this.getChildrenHeight(false);
          this.proportionLength = remainder / this.childrenProportion;
        } else {
          this.proportionLength = 0;
        }
      }
  
      return height;
    };
  
    var Zone = Phaser.GameObjects.Zone;
  
    var Space = /*#__PURE__*/function (_Zone) {
      _inherits(Space, _Zone);
  
      var _super = _createSuper(Space);
  
      function Space(scene) {
        var _this;
  
        _classCallCheck(this, Space);
  
        _this = _super.call(this, scene, 0, 0, 1, 1); // Don't add Zone into scene
  
        _this.isRexSpace = true;
        return _this;
      }
  
      return _createClass(Space);
    }(Zone);
  
    var GetNearestChildIndex$1 = function GetNearestChildIndex(x, y) {
      var children = this.sizerChildren;
  
      if (children.length === 0) {
        return -1;
      }
  
      var nearestIndex = -1,
          minDistance = Infinity;
  
      for (var i = 0, cnt = children.length; i < cnt; i++) {
        var child = children[i];
        var distance;
  
        if (this.orientation === 0) {
          // x
          distance = Math.abs(child.left - x);
        } else {
          distance = Math.abs(child.top - y);
        }
  
        if (minDistance > distance) {
          minDistance = distance;
          nearestIndex = i;
        }
      } // Check right bound of last child
  
  
      var child = children[children.length - 1];
      var distance;
  
      if (this.orientation === 0) {
        // x
        distance = Math.abs(child.right - x);
      } else {
        distance = Math.abs(child.bottom - y);
      }
  
      if (minDistance > distance) {
        minDistance = distance;
        nearestIndex = i + 1;
      }
  
      return nearestIndex;
    };
  
    var IsPlainObject$5 = Phaser.Utils.Objects.IsPlainObject;
    var GetValue$b = Phaser.Utils.Objects.GetValue;
    var ALIGN_CENTER$2 = Phaser.Display.Align.CENTER;
    var PROPORTIONMODE = {
      min: 0,
      full: -1
    };
  
    var Add$5 = function Add(gameObject, proportion, align, paddingConfig, expand, childKey, index, minSize) {
      AddChild.call(this, gameObject);
      var isRexSpace = gameObject.isRexSpace;
  
      var proportionType = _typeof(proportion);
  
      if (proportion === null) {
        return this;
      } else if (proportionType === 'number') ; else if (proportionType === 'string') {
        proportion = PROPORTIONMODE[proportion];
      } else if (IsPlainObject$5(proportion)) {
        var config = proportion;
        proportion = GetValue$b(config, 'proportion', undefined);
        align = GetValue$b(config, 'align', ALIGN_CENTER$2);
        paddingConfig = GetValue$b(config, 'padding', 0);
        expand = GetValue$b(config, 'expand', false);
        childKey = GetValue$b(config, 'key', undefined);
        index = GetValue$b(config, 'index', undefined);
  
        if (!gameObject.isRexSizer) {
          // Get minSize from config
          if (this.orientation === 0) {
            // x
            minSize = GetValue$b(config, 'minWidth', undefined);
          } else {
            // y
            minSize = GetValue$b(config, 'minHeight', undefined);
          }
        }
      }
  
      if (typeof align === 'string') {
        align = ALIGNMODE[align];
      }
  
      if (proportion === undefined) {
        proportion = isRexSpace ? 1 : 0;
      }
  
      if (align === undefined) {
        align = ALIGN_CENTER$2;
      }
  
      if (paddingConfig === undefined) {
        paddingConfig = 0;
      }
  
      if (expand === undefined) {
        expand = false;
      }
  
      if (minSize === undefined) {
        if (isRexSpace) {
          minSize = 0;
        } else if (!gameObject.isRexSizer) {
          // Get minSize from game object
          if (this.orientation === 0) {
            // x
            minSize = gameObject._minWidth;
          } else {
            // y
            minSize = gameObject._minHeight;
          }
        }
      }
  
      var config = this.getSizerConfig(gameObject);
      config.proportion = proportion;
      config.align = align;
      config.padding = GetBoundsConfig(paddingConfig);
      config.expand = expand;
  
      if (index === undefined || index >= this.sizerChildren.length) {
        this.sizerChildren.push(gameObject);
      } else {
        this.sizerChildren.splice(index, 0, gameObject);
      }
  
      if (!gameObject.isRexSizer && proportion > 0) {
        // Expand normal game object
        if (this.orientation === 0) {
          // x
          // minSize is still undefined, uses current display width
          gameObject.minWidth = minSize === undefined ? GetDisplayWidth(gameObject) : minSize;
        } else {
          // minSize is still undefined, uses current display height
          gameObject.minHeight = minSize === undefined ? GetDisplayHeight(gameObject) : minSize;
        }
      }
  
      if (childKey !== undefined) {
        this.addChildrenMap(childKey, gameObject);
      }
  
      return this;
    };
  
    var AddChildMethods$5 = {
      add: Add$5,
      // sizer.add could be override
      addSpace: function addSpace(proportion) {
        this.insertSpace(undefined, proportion);
        return this;
      },
      insertSpace: function insertSpace(index, proportion) {
        if (proportion === undefined) {
          proportion = 1;
        }
  
        Add$5.call(this, new Space(this.scene), {
          proportion: proportion,
          minWidth: 0,
          minHeight: 0,
          index: index
        }); // No problem if sizer.add is override
  
        return this;
      },
      insert: function insert(index, gameObject, proportion, align, paddingConfig, expand, childKey, minSize) {
        if (IsPlainObject$5(proportion)) {
          proportion.index = index;
        }
  
        Add$5.call(this, gameObject, proportion, align, paddingConfig, expand, childKey, index, minSize); // No problem if sizer.add is override
  
        return this;
      },
      insertAtPosition: function insertAtPosition(x, y, gameObject, proportion, align, paddingConfig, expand, childKey, minSize) {
        var index = GetNearestChildIndex$1.call(this, x, y);
  
        if (index === -1) {
          index = undefined;
        }
  
        this.insert(index, gameObject, proportion, align, paddingConfig, expand, childKey, minSize);
        return this;
      }
    };
  
    var RemoveItem$3 = Phaser.Utils.Array.Remove;
    var ContainerRemove = ContainerLite.prototype.remove;
  
    var RemoveChild = function RemoveChild(gameObject, destroyChild) {
      if (this.isBackground(gameObject)) {
        RemoveItem$3(this.backgroundChildren, gameObject);
      }
  
      ContainerRemove.call(this, gameObject, destroyChild);
  
      if (!destroyChild && this.sizerEventsEnable) {
        gameObject.emit('sizer.remove', gameObject, this);
        this.emit('remove', gameObject, this);
      }
  
      return this;
    };
  
    var ContainerClear = ContainerLite.prototype.clear;
  
    var ClearChildren = function ClearChildren(destroyChild) {
      if (this.backgroundChildren) {
        this.backgroundChildren.length = 0;
      }
  
      var fireRemoveEvent = !destroyChild && this.sizerEventsEnable;
      var children;
  
      if (fireRemoveEvent) {
        children = this.getChildren([]);
      }
  
      ContainerClear.call(this, destroyChild);
  
      if (fireRemoveEvent) {
        var gameObject;
  
        for (var i = 0, cnt = children.length; i < cnt; i++) {
          gameObject = children[i];
          gameObject.emit('sizer.remove', gameObject, this);
          this.emit('remove', gameObject, this);
        }
      }
  
      return this;
    };
  
    var RemoveItem$2 = Phaser.Utils.Array.Remove;
    var RemoveChildMethods$5 = {
      remove: function remove(gameObject, destroyChild) {
        if (this.getParentSizer(gameObject) !== this) {
          return this;
        }
  
        RemoveItem$2(this.sizerChildren, gameObject);
        RemoveChild.call(this, gameObject, destroyChild);
        return this;
      },
      removeAll: function removeAll(destroyChild) {
        for (var i = this.sizerChildren.length - 1; i >= 0; i--) {
          this.remove(this.sizerChildren[i], destroyChild);
        }
  
        return this;
      },
      clear: function clear(destroyChild) {
        this.sizerChildren.length = 0;
        ClearChildren.call(this, destroyChild);
        return this;
      }
    };
  
    var methods$3 = {
      getChildrenWidth: GetChildrenWidth$2,
      getChildrenHeight: GetChildrenHeight$2,
      getExpandedChildWidth: GetExpandedChildWidth$1,
      getExpandedChildHeight: GetExpandedChildHeight$1,
      getChildrenSizers: GetChildrenSizers$2,
      preLayout: PreLayout$2,
      layoutChildren: LayoutChildren$2,
      resolveWidth: ResolveWidth$1,
      resolveHeight: ResolveHeight$1
    };
    Object.assign(methods$3, AddChildMethods$5, RemoveChildMethods$5);
  
    var GetChildrenProportion = function GetChildrenProportion() {
      var result = 0;
      var children = this.sizerChildren;
      var child, proportion;
  
      for (var i = 0, cnt = children.length; i < cnt; i++) {
        child = children[i];
  
        if (child.rexSizer.hidden) {
          continue;
        }
  
        proportion = child.rexSizer.proportion;
  
        if (proportion > 0) {
          result += proportion;
        }
      }
  
      return result;
    };
  
    var OrientationMode = {
      x: 0,
      h: 0,
      horizontal: 0,
      'left-to-right': 0,
      y: 1,
      v: 1,
      vertical: 1,
      'top-to-bottom': 1
    };
  
    var GetOrientationMode = function GetOrientationMode(orientation) {
      if (typeof orientation === 'string') {
        orientation = OrientationMode[orientation];
      }
  
      return orientation;
    };
  
    var IsPlainObject$4 = Phaser.Utils.Objects.IsPlainObject;
    var GetValue$a = Phaser.Utils.Objects.GetValue;
  
    var Sizer = /*#__PURE__*/function (_BaseSizer) {
      _inherits(Sizer, _BaseSizer);
  
      var _super = _createSuper(Sizer);
  
      function Sizer(scene, x, y, minWidth, minHeight, orientation, config) {
        var _this;
  
        _classCallCheck(this, Sizer);
  
        if (IsPlainObject$4(x)) {
          config = x;
          x = GetValue$a(config, 'x', 0);
          y = GetValue$a(config, 'y', 0);
          minWidth = GetValue$a(config, 'width', undefined);
          minHeight = GetValue$a(config, 'height', undefined);
          orientation = GetValue$a(config, 'orientation', 0);
        } else if (IsPlainObject$4(minWidth)) {
          config = minWidth;
          minWidth = GetValue$a(config, 'width', undefined);
          minHeight = GetValue$a(config, 'height', undefined);
          orientation = GetValue$a(config, 'orientation', 0);
        } else if (IsPlainObject$4(orientation)) {
          config = orientation;
          orientation = GetValue$a(config, 'orientation', 0);
        }
  
        if (orientation === undefined) {
          orientation = 0;
        }
  
        _this = _super.call(this, scene, x, y, minWidth, minHeight, config);
        _this.type = 'rexSizer';
        _this.sizerChildren = [];
  
        _this.setOrientation(orientation);
  
        _this.setItemSpacing(GetValue$a(config, 'space.item', 0));
  
        _this.setRTL(GetValue$a(config, 'rtl', false));
  
        _this.addChildrenMap('items', _this.sizerChildren);
  
        return _this;
      }
  
      _createClass(Sizer, [{
        key: "setOrientation",
        value: function setOrientation(orientation) {
          this.orientation = GetOrientationMode(orientation);
          return this;
        }
      }, {
        key: "setItemSpacing",
        value: function setItemSpacing(space) {
          this.space.item = space;
          return this;
        }
      }, {
        key: "setRTL",
        value: function setRTL(enable) {
          if (enable === undefined) {
            enable = true;
          }
  
          this.rtl = enable;
          return this;
        }
      }, {
        key: "childrenProportion",
        get: function get() {
          if (this._childrenProportion === undefined) {
            this._childrenProportion = GetChildrenProportion.call(this);
          }
  
          return this._childrenProportion;
        }
      }]);
  
      return Sizer;
    }(Base);
  
    Object.assign(Sizer.prototype, methods$3);
  
    var SizerAdd$2 = Sizer.prototype.add;
    var SizerAddSpace = Sizer.prototype.addSpace;
  
    var Add$4 = function Add(gameObject) {
      var isNormalGameObject = !gameObject.isRexSpace;
      var proportion = !isNormalGameObject || this.buttonsExpand ? 1 : 0;
  
      if (this.sizerChildren.length === 0) {
        // First element
        if (isNormalGameObject) {
          // Add space at head
          var hasHeadSpace = !this.buttonsExpand && (this.buttonsAlign === 'right' || this.buttonsAlign === 'center' || this.buttonsAlign === 'bottom');
  
          if (hasHeadSpace) {
            SizerAddSpace.call(this);
          }
  
          SizerAdd$2.call(this, gameObject, {
            proportion: proportion,
            expand: true
          }); // Add space at tail
  
          var hasTailSpace = !this.buttonsExpand && this.buttonsAlign === 'center';
  
          if (hasTailSpace) {
            SizerAddSpace.call(this);
          }
  
          this.hasTailSpace = hasTailSpace;
        } else {
          // A space
          SizerAdd$2.call(this, gameObject, {
            proportion: proportion,
            expand: true
          });
          this.hasTailSpace = false;
        }
      } else {
        // Others
        if (this.hasTailSpace) {
          var lastIndex = this.sizerChildren.length - 1;
          SizerAdd$2.call(this, gameObject, {
            index: lastIndex,
            proportion: proportion,
            expand: true
          });
        } else {
          SizerAdd$2.call(this, gameObject, {
            proportion: proportion,
            expand: true
          });
        }
      } // Space or other game object as button
  
  
      if (isNormalGameObject) {
        this.buttonGroup.add(gameObject);
      }
  
      return this;
    };
  
    var AddChildMethods$4 = {
      addButton: function addButton(gameObject) {
        if (IsArray(gameObject)) {
          var gameObjects = gameObject;
  
          for (var i = 0, cnt = gameObjects.length; i < cnt; i++) {
            Add$4.call(this, gameObjects[i]);
          }
        } else {
          Add$4.call(this, gameObject);
        }
  
        return this;
      },
      addButtons: function addButtons(gameObjects) {
        for (var i = 0, cnt = gameObjects.length; i < cnt; i++) {
          Add$4.call(this, gameObjects[i]);
        }
  
        return this;
      }
    };
  
    var SizerRmove$2 = Sizer.prototype.remove;
    var SizerClear$2 = Sizer.prototype.clear;
  
    var Remove$2 = function Remove(gameObject, destroyChild) {
      if (this.getParentSizer(gameObject) !== this) {
        return this;
      }
  
      this.buttonGroup.remove(gameObject);
      SizerRmove$2.call(this, gameObject, destroyChild);
      return this;
    };
  
    var RemoveChildMethods$4 = {
      remove: function remove(gameObject, destroyChild) {
        // Remove gameObject no matter it is a button or not
        if (IsArray(gameObject)) {
          var gameObjects = gameObject;
  
          for (var i = 0, cnt = gameObjects.length; i < cnt; i++) {
            Remove$2.call(this, gameObjects[i], destroyChild);
          }
        } else {
          Remove$2.call(this, gameObject, destroyChild);
        }
  
        return this;
      },
      clear: function clear(destroyChild) {
        var buttons = this.buttonGroup.buttons;
        buttons.length = 0;
        SizerClear$2.call(this, destroyChild);
        return this;
      },
      removeButton: function removeButton(gameObject, destroyChild) {
        var gameObject = this.getButton(gameObject); // Don't remove this gameObject, it is not a button
  
        if (!gameObject) {
          return this;
        }
  
        this.remove(gameObject, destroyChild);
        return this;
      },
      clearButtons: function clearButtons(destroyChild) {
        var buttons = this.buttonGroup.buttons;
  
        for (var i = buttons.length - 1; i >= 0; i--) {
          Remove$2.call(this, buttons[i], destroyChild);
        }
  
        return this;
      }
    };
  
    var AddMethods = {
      add: function add(gameObject) {
        this.buttons.push(gameObject);
  
        if (this.buttonsType) {
          var key = gameObject.name;
  
          if (key === '') {
            console.error("".concat(this.parent.constructor.name, ": Button key is an empty string"));
          } else if (this.buttonMap.hasOwnProperty(key)) {
            console.error("".concat(this.parent.constructor.name, ": Duplicate button key '").concat(key, "'"));
          }
  
          this.buttonMap[key] = gameObject;
          this.dataManager.set(key, undefined).set(key, false); // Trigger data event 'changedata'
        } //Default: Fire 'click' event when touch released after pressed.
  
  
        gameObject._buttonBehavior = new Button(gameObject, this.clickConfig);
  
        gameObject._buttonBehavior.on('click', function (buttonBehavior, gameObject, pointer, event) {
          this.fireEvent('button.click', gameObject, pointer, event);
        }, this).on('enable', function (buttonBehavior, gameObject) {
          this.fireEvent('button.enable', gameObject);
        }, this).on('disable', function (buttonBehavior, gameObject) {
          this.fireEvent('button.disable', gameObject);
        }, this);
  
        gameObject.on('pointerover', function (pointer, localX, localY, event) {
          this.fireEvent('button.over', gameObject, pointer, event);
        }, this).on('pointerout', function (pointer, event) {
          this.fireEvent('button.out', gameObject, pointer, event);
        }, this);
        return this;
      },
      addMultiple: function addMultiple(gameObjects) {
        for (var i = 0, cnt = gameObjects.length; i < cnt; i++) {
          this.add(gameObject[i]);
        }
  
        return this;
      }
    };
  
    var RemoveItem$1 = Phaser.Utils.Array.Remove;
    var RemoveMethods = {
      remove: function remove(gameObject) {
        RemoveItem$1(this.buttons, gameObject);
  
        if (this.buttonsType) {
          var key = gameObject.name;
          delete this.buttonMap[key];
          this.dataManager.remove(key);
        }
  
        return this;
      },
      clear: function clear() {
        this.buttons.length = 0;
  
        if (this.buttonsType) {
          for (var key in this.buttonMap) {
            delete this.buttonMap[key];
            this.dataManager.remove(key);
          }
        }
  
        return this;
      }
    };
  
    var FireEvent = function FireEvent(eventName, button) {
      var index;
  
      if (typeof button === 'number') {
        index = button;
        button = this.buttons[index];
  
        if (!button) {
          return;
        }
      } else {
        index = this.buttons.indexOf(button);
  
        if (index === -1) {
          return;
        }
      } // Buttons is a child. Fire internal events.
  
  
      for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
        args[_key - 2] = arguments[_key];
      }
  
      if (this.eventEmitter !== this.parent) {
        var _this$parent;
  
        (_this$parent = this.parent).emit.apply(_this$parent, [eventName, button, index].concat(args));
      }
  
      if (this.groupName !== undefined) {
        var _this$eventEmitter;
  
        (_this$eventEmitter = this.eventEmitter).emit.apply(_this$eventEmitter, [eventName, button, this.groupName, index].concat(args));
      } else {
        var _this$eventEmitter2;
  
        (_this$eventEmitter2 = this.eventEmitter).emit.apply(_this$eventEmitter2, [eventName, button, index].concat(args));
      }
    };
  
    var GetValue$9 = Phaser.Utils.Objects.GetValue;
  
    var Initialize = function Initialize(config) {
      // Assign this.dataManager
      var dataManager = GetValue$9(config, 'dataManager', undefined);
  
      if (dataManager === undefined) {
        var parent = this.parent;
        parent.setDataEnabled();
        dataManager = parent.data;
      }
  
      this.dataManager = dataManager; // Assign this.setValueCallback, this.setValueCallbackScope
  
      var setValueCallback, setValueCallbackScope;
      setValueCallback = GetValue$9(config, 'setValueCallback', undefined);
      setValueCallbackScope = GetValue$9(config, 'setValueCallbackScope', undefined);
  
      if (setValueCallback === undefined) {
        setValueCallback = GetValue$9(config, 'setButtonStateCallback', undefined);
        setValueCallbackScope = GetValue$9(config, 'setButtonStateCallbackScope', undefined);
      }
  
      this.setValueCallback = setValueCallback;
      this.setValueCallbackScope = setValueCallbackScope; // Register event callback
  
      dataManager.events.on("changedata", function (parent, key, value, previousValue) {
        var button = this.buttonMap[key];
  
        if (!button) {
          return;
        }
  
        var callback = this.setValueCallback;
        var scope = this.setValueCallbackScope;
  
        if (callback) {
          if (scope) {
            callback.call(scope, button, value, previousValue);
          } else {
            callback(button, value, previousValue);
          }
        }
  
        this.fireEvent('button.statechange', button, value, previousValue);
      }, this);
    };
  
    var SetTypeMethods = {
      setButtonsType: function setButtonsType(config) {
        if (config === undefined) {
          config = {};
        }
  
        var buttonsType = GetValue$9(config, 'buttonsType', config.type);
        this.buttonsType = buttonsType;
  
        switch (buttonsType) {
          case 'radio':
            this.setRadioType(config);
            break;
  
          case 'checkboxes':
            this.setCheckboxesType(config);
            break;
        }
  
        return this;
      },
      setRadioType: function setRadioType(config) {
        Initialize.call(this, config);
        var radioValue = undefined;
        var parent = this.parent,
            buttons = this.buttons,
            dataManager = this.dataManager;
        Object.defineProperty(parent, 'value', {
          get: function get() {
            return radioValue;
          },
          set: function set(newValue) {
            if (newValue === radioValue) {
              return;
            }
  
            radioValue = newValue; // Update state of button -> Fire `changedata-btnName` event -> setValueCallback                
  
            buttons.forEach(function (button) {
              var key = button.name;
              var state = dataManager.get(key);
  
              if (key === newValue) {
                if (!state) {
                  dataManager.set(key, true);
                }
              } else {
                if (state) {
                  dataManager.set(key, false);
                }
              }
            });
          },
          enumerable: true,
          configurable: true
        });
        parent.on('button.click', function (button) {
          parent.value = button.name;
        }); // button.click event -> parent.value -> dataManager -> changedata event -> ...
        // parent.value -> dataManager -> changedata event -> ...
  
        return this;
      },
      setCheckboxesType: function setCheckboxesType(config) {
        Initialize.call(this, config);
        var parent = this.parent,
            dataManager = this.dataManager;
        parent.on('button.click', function (button) {
          dataManager.toggle(button.name);
        }); // button.click event -> dataManager -> changedata event -> ...
        // dataManager.set() -> changedata event -> ...
  
        return this;
      },
      // Common
      clearAllButtonsState: function clearAllButtonsState() {
        for (var key in this.buttonMap) {
          this.dataManager.set(key, false);
        }
  
        return this;
      },
      getAllButtonsState: function getAllButtonsState() {
        var states = {};
  
        for (var key in this.buttonMap) {
          states[key] = this.dataManager.get(key);
        }
  
        return states;
      },
      // For radio
      setSelectedButtonName: function setSelectedButtonName(name) {
        this.parent.value = name;
        return this;
      },
      getSelectedButtonName: function getSelectedButtonName() {
        return this.parent.value;
      },
      // For checkboxes
      setButtonState: function setButtonState(name, state) {
        if (state === undefined) {
          state = true;
        }
  
        this.dataManager.set(name, state);
        return this;
      },
      getButtonState: function getButtonState(name) {
        return this.dataManager.get(name);
      }
    };
  
    var GetGameObjectByName = function GetGameObjectByName(children, name) {
      if (!children) {
        return null;
      } else if (IsArray(children)) {
        var child;
  
        for (var i = 0, cnt = children.length; i < cnt; i++) {
          child = TestName(children[i], name);
  
          if (child) {
            return child;
          }
        }
      } else {
        // Is plain object
        var child;
  
        for (var key in children) {
          child = TestName(children[key], name);
  
          if (child) {
            return child;
          }
        }
      }
    };
  
    var TestName = function TestName(gameObject, name) {
      if (!gameObject) {
        return null;
      } else if (gameObject.hasOwnProperty('name')) {
        return gameObject.name === name ? gameObject : null;
      } else {
        // Array, or plain object
        return GetElementByName(gameObject, name);
      }
    };
  
    var ButtonMethods$1 = {
      getButton: function getButton(index) {
        // buttonGroup and button-sizer have *buttons* member both
        var buttons = this.buttons,
            button;
  
        var indexType = _typeof(index);
  
        switch (indexType) {
          case 'number':
            button = buttons[index];
            break;
  
          case 'string':
            button = GetGameObjectByName(buttons, index);
            break;
  
          default:
            button = index;
  
            if (buttons.indexOf(button) === -1) {
              button = undefined;
            }
  
            break;
        }
  
        return button;
      },
      setButtonEnable: function setButtonEnable(index, enabled) {
        // buttonGroup and button-sizer have *buttons* member both
        var buttons = this.buttons;
  
        if (index === undefined || typeof index === 'boolean') {
          enabled = index;
  
          for (var i = 0, cnt = buttons.length; i < cnt; i++) {
            buttons[i]._buttonBehavior.setEnable(enabled);
          }
        } else {
          this.getButton(index)._buttonBehavior.setEnable(enabled);
        }
  
        return this;
      },
      toggleButtonEnable: function toggleButtonEnable(index) {
        // buttonGroup and button-sizer have *buttons* member both
        var buttons = this.buttons;
  
        if (index === undefined || typeof index === 'boolean') {
          for (var i = 0, cnt = buttons.length; i < cnt; i++) {
            buttons[i]._buttonBehavior.toggleEnable();
          }
        } else {
          this.getButton(index)._buttonBehavior.toggleEnable();
        }
  
        return this;
      },
      getButtonEnable: function getButtonEnable(index) {
        if (index === undefined) {
          index = 0;
        }
  
        return this.getButton(index)._buttonBehavior.enable;
      },
      emitButtonClick: function emitButtonClick(index) {
        // index or button game object
        // this: buttonGroup or button-sizer
        var buttonGroup = this.buttonGroup ? this.buttonGroup : this;
        buttonGroup.fireEvent('button.click', index);
        return this;
      },
      showButton: function showButton(index) {
        Show(this.getButton(index));
        return this;
      },
      hideButton: function hideButton(index) {
        Hide(this.getButton(index));
        return this;
      },
      isButtonShown: function isButtonShown(index) {
        IsShown(this.getButton(index));
        return this;
      },
      forEachButtton: function forEachButtton(callback, scope) {
        // buttonGroup and button-sizer have *buttons* member both
        var buttons = this.buttons;
  
        for (var i = 0, cnt = buttons.length; i < cnt; i++) {
          if (scope) {
            callback.call(scope, buttons[i], i, buttons);
          } else {
            callback(buttons[i], i, buttons);
          }
        }
  
        return this;
      }
    };
  
    var ButtonGroup = /*#__PURE__*/function () {
      function ButtonGroup(config) {
        _classCallCheck(this, ButtonGroup);
  
        this.parent = config.parent;
        this.eventEmitter = config.eventEmitter;
        this.groupName = config.groupName;
        this.clickConfig = config.clickConfig;
        this.buttonsType = undefined;
        this.buttons = [];
        this.buttonMap = {};
      }
  
      _createClass(ButtonGroup, [{
        key: "destroy",
        value: function destroy() {
          this.parent = undefined;
          this.eventEmitter = undefined;
          this.clickConfig = undefined;
          this.buttons = undefined; // GameObjects will be destroyed outside
        }
      }]);
  
      return ButtonGroup;
    }();
  
    var methods$2 = {
      fireEvent: FireEvent
    };
    Object.assign(ButtonGroup.prototype, AddMethods, RemoveMethods, SetTypeMethods, ButtonMethods$1, methods$2);
  
    // Include in Buttons/GridButtons/FixedWidthButtons class
    var ButtonStateMethods = {
      // Common
      clearAllButtonsState: function clearAllButtonsState() {
        this.buttonGroup.clearAllButtonsState();
        return this;
      },
      getAllButtonsState: function getAllButtonsState() {
        return this.buttonGroup.getAllButtonsState();
      },
      // For radio
      setSelectedButtonName: function setSelectedButtonName(name) {
        this.buttonGroup.setSelectedButtonName(name);
        return this;
      },
      getSelectedButtonName: function getSelectedButtonName() {
        return this.buttonGroup.getSelectedButtonName();
      },
      // For checkboxes
      setButtonState: function setButtonState(name, state) {
        this.buttonGroup.setButtonState(name, state);
        return this;
      },
      getButtonState: function getButtonState(name) {
        return this.buttonGroup.getButtonState(name);
      }
    };
  
    var GetValue$8 = Phaser.Utils.Objects.GetValue;
  
    var Buttons$1 = /*#__PURE__*/function (_Sizer) {
      _inherits(Buttons, _Sizer);
  
      var _super = _createSuper(Buttons);
  
      function Buttons(scene, config) {
        var _this;
  
        _classCallCheck(this, Buttons);
  
        if (config === undefined) {
          config = {};
        }
  
        var buttonSpace = config.space;
  
        if (typeof buttonSpace === 'number') {
          config.space = {
            item: buttonSpace
          };
        } // Create
  
  
        _this = _super.call(this, scene, config);
        _this.type = 'rexButtons';
        _this.buttonGroup = new ButtonGroup({
          parent: _assertThisInitialized(_this),
          eventEmitter: GetValue$8(config, 'eventEmitter', _assertThisInitialized(_this)),
          groupName: GetValue$8(config, 'groupName', undefined),
          clickConfig: GetValue$8(config, 'click', undefined)
        }).setButtonsType(config); // Add elements
  
        var background = GetValue$8(config, 'background', undefined);
        var buttons = GetValue$8(config, 'buttons', undefined); // Buttons properties
  
        _this.buttonsExpand = GetValue$8(config, 'expand', false);
        _this.buttonsAlign = GetValue$8(config, 'align', undefined); // undefined/left/top: no space                
  
        if (background) {
          _this.addBackground(background);
        }
  
        if (buttons) {
          _this.addButtons(buttons);
        }
  
        _this.addChildrenMap('background', background);
  
        _this.addChildrenMap('buttons', _this.buttonGroup.buttons);
  
        return _this;
      }
  
      _createClass(Buttons, [{
        key: "destroy",
        value: function destroy(fromScene) {
          //  This Game Object has already been destroyed
          if (!this.scene) {
            return;
          }
  
          _get(_getPrototypeOf(Buttons.prototype), "destroy", this).call(this, fromScene);
  
          this.buttonGroup.destroy();
          this.buttonGroup = undefined;
        }
      }, {
        key: "buttons",
        get: function get() {
          return this.buttonGroup.buttons;
        }
      }, {
        key: "groupName",
        get: function get() {
          return this.buttonGroup.groupName;
        },
        set: function set(value) {
          this.buttonGroup.groupName = value;
        }
      }, {
        key: "eventEmitter",
        get: function get() {
          return this.buttonGroup.eventEmitter;
        }
      }]);
  
      return Buttons;
    }(Sizer);
  
    Object.assign(Buttons$1.prototype, AddChildMethods$4, RemoveChildMethods$4, ButtonMethods$1, ButtonStateMethods);
  
    var GetChildrenWidth$1 = function GetChildrenWidth() {
      if (this.rexSizer.hidden) {
        return 0;
      } // Before RunChildrenWrap
  
  
      return this.maxChildWidth + this.space.left + this.space.right;
    };
  
    var GetChildrenHeight$1 = function GetChildrenHeight() {
      if (this.rexSizer.hidden) {
        return 0;
      } // After RunChildrenWrap
  
  
      return this.widthWrapResult.height + this.space.top + this.space.bottom;
    };
  
    var GetChildrenSizers$1 = function GetChildrenSizers(out) {
      if (out === undefined) {
        out = [];
      }
  
      var children = this.sizerChildren,
          child;
  
      for (var i = 0, cnt = children.length; i < cnt; i++) {
        child = children[i];
  
        if (child === '\n') {
          continue;
        }
  
        if (child.isRexSizer) {
          out.push(child);
        }
      }
  
      return out;
    };
  
    var PreLayout$1 = function PreLayout() {
      this._maxChildWidth = undefined;
      this._maxChildHeight = undefined;
      PreLayout$3.call(this);
      return this;
    };
  
    var LayoutChildren$1 = function LayoutChildren() {
      var innerLineWidth = this.innerWidth;
      var justifyPercentage = this.justifyPercentage;
      var itemSpace = this.space.item,
          lineSpace = this.space.line,
          indentLeftOdd = this.space.indentLeftOdd,
          indentLeftEven = this.space.indentLeftEven,
          indentTopOdd = this.space.indentTopOdd,
          indentTopEven = this.space.indentTopEven;
      var child,
          childConfig,
          padding,
          justifySpace = 0,
          indentLeft,
          indentTop;
      var startX = this.innerLeft,
          startY = this.innerTop;
      var x, y, width, height; // Align zone
  
      var lines = this.widthWrapResult.lines;
      var line, lineChlidren, remainderLineWidth;
      var itemX,
          itemY = startY;
  
      for (var i = 0, icnt = lines.length; i < icnt; i++) {
        // Layout this line
        line = lines[i];
        lineChlidren = line.children;
  
        if (this.rtl) {
          lineChlidren.reverse();
        }
  
        indentLeft = i % 2 ? indentLeftEven : indentLeftOdd;
        itemX = startX + indentLeft;
        remainderLineWidth = innerLineWidth - line.width;
  
        switch (this.align) {
          case 0:
            // left
            break;
  
          case 1:
            // right
            itemX += remainderLineWidth;
            break;
  
          case 2:
            // center
            itemX += remainderLineWidth / 2;
            break;
  
          case 3:
            // justify-left
            justifySpace = GetJustifySpace(innerLineWidth, remainderLineWidth, justifyPercentage, lineChlidren.length);
            break;
  
          case 4:
            // justify-right
            justifySpace = GetJustifySpace(innerLineWidth, remainderLineWidth, justifyPercentage, lineChlidren.length);
  
            if (justifySpace === 0) {
              // Align right
              itemX += remainderLineWidth;
            }
  
            break;
  
          case 5:
            // justify-center
            justifySpace = GetJustifySpace(innerLineWidth, remainderLineWidth, justifyPercentage, lineChlidren.length);
  
            if (justifySpace === 0) {
              // Align center
              itemX += remainderLineWidth / 2;
            }
  
            break;
        }
  
        for (var j = 0, jcnt = lineChlidren.length; j < jcnt; j++) {
          child = lineChlidren[j];
  
          if (child.rexSizer.hidden) {
            continue;
          }
  
          childConfig = child.rexSizer;
          padding = childConfig.padding;
          PreLayoutChild.call(this, child);
          x = itemX + padding.left;
  
          if (j > 0) {
            x += itemSpace;
          }
  
          indentTop = j % 2 ? indentTopEven : indentTopOdd;
          y = itemY + indentTop + padding.top;
          width = GetDisplayWidth(child);
          height = GetDisplayHeight(child);
          itemX = x + width + padding.right + justifySpace;
          LayoutChild.call(this, child, x, y, width, height, childConfig.align);
        }
  
        itemY += line.height + lineSpace;
      }
    };
  
    var GetJustifySpace = function GetJustifySpace(total, remainder, justifyPercentage, childCount) {
      return remainder / total <= justifyPercentage ? remainder / (childCount - 1) : 0;
    };
  
    var RunChildrenWrap = function RunChildrenWrap(lineWidth, out) {
      if (out === undefined) {
        out = {
          lines: [],
          width: 0,
          height: 0
        };
      } else {
        out.lines.length = 0;
        out.width = 0;
        out.height = 0;
      }
  
      var children = this.sizerChildren;
      var itemSpace = this.space.item,
          lineSpace = this.space.line,
          indentLeftOdd = this.space.indentLeftOdd,
          indentLeftEven = this.space.indentLeftEven,
          indentTopOdd = this.space.indentTopOdd,
          indentTopEven = this.space.indentTopEven;
      var child,
          childWidth,
          childHeight,
          remainder = 0,
          indentLeft;
      var lines = out.lines,
          lastLine = undefined,
          newLine;
  
      for (var i = 0, cnt = children.length; i < cnt; i++) {
        child = children[i];
  
        if (child === '\n') {
          child = undefined;
          childWidth = 0;
          newLine = true;
        } else {
          if (child.rexSizer.hidden) {
            continue;
          }
  
          if (child.isRexSizer) {
            child.layout(); // Use original size
          }
  
          childWidth = GetChildWidth(child);
          newLine = remainder < childWidth || lastLine === undefined;
        } // New line
  
  
        if (newLine) {
          if (lastLine) {
            lastLine.width = lineWidth - (remainder + itemSpace);
            out.width = Math.max(out.width, lastLine.width);
            out.height += lastLine.height + lineSpace;
          }
  
          lastLine = {
            children: [],
            // width: 0,
            height: 0
          };
          lines.push(lastLine);
          var indentLeft = lines.length % 2 ? indentLeftOdd : indentLeftEven;
          remainder = lineWidth - indentLeft;
        }
  
        remainder -= childWidth + itemSpace;
  
        if (child) {
          lastLine.children.push(child);
          childHeight = GeChildHeight(child);
          lastLine.height = Math.max(lastLine.height, childHeight);
        }
      }
  
      if (lastLine) {
        lastLine.width = lineWidth - (remainder + itemSpace);
        out.width = Math.max(out.width, lastLine.width);
        out.height += lastLine.height;
      }
  
      out.height += Math.max(indentTopOdd, indentTopEven);
      return out;
    };
  
    var GetChildWidth = function GetChildWidth(child) {
      var padding = child.rexSizer.padding;
      return GetDisplayWidth(child) + padding.left + padding.right;
    };
  
    var GeChildHeight = function GeChildHeight(child) {
      var padding = child.rexSizer.padding;
      return GetDisplayHeight(child) + padding.top + padding.bottom;
    };
  
    var RunWidthWrap$1 = function RunWidthWrap(width) {
      var innerWidth = width - this.space.left - this.space.right;
      this.widthWrapResult = RunChildrenWrap.call(this, innerWidth, this.widthWrapResult);
      RunWidthWrap$2.call(this, width);
    };
  
    var DistanceBetween = Phaser.Math.Distance.Between;
  
    var GetNearestChildIndex = function GetNearestChildIndex(x, y) {
      var children = this.sizerChildren;
  
      if (children.length === 0) {
        return -1;
      }
  
      var nearestIndex = -1,
          minDistance = Infinity;
  
      for (var i = 0, cnt = children.length; i < cnt; i++) {
        var child = children[i]; // position is not at this line
  
        if (Math.abs(child.centerY - y) > child.height / 2) {
          continue;
        } // Check left bound
  
  
        var distance = DistanceBetween(child.left, child.centerY, x, y);
  
        if (minDistance > distance) {
          minDistance = distance;
          nearestIndex = i;
        } // Is last child of this line
  
  
        var nextChild = children[i + 1];
  
        if (nextChild && nextChild.y === child.y) {
          continue;
        }
  
        var distance = DistanceBetween(child.right, child.centerY, x, y);
  
        if (minDistance > distance) {
          minDistance = distance;
          nearestIndex = i + 1;
        }
      }
  
      return nearestIndex;
    };
  
    var IsPlainObject$3 = Phaser.Utils.Objects.IsPlainObject;
    var GetValue$7 = Phaser.Utils.Objects.GetValue;
    var ALIGN_CENTER$1 = Phaser.Display.Align.CENTER;
  
    var Add$3 = function Add(gameObject, paddingConfig, childKey, index) {
      if (gameObject === '\n') {
        this.addNewLine();
        return this;
      }
  
      AddChild.call(this, gameObject);
  
      if (IsPlainObject$3(paddingConfig)) {
        var config = paddingConfig;
        paddingConfig = GetValue$7(config, 'padding', 0);
        childKey = GetValue$7(config, 'key', undefined);
        index = GetValue$7(config, 'index', undefined);
      }
  
      if (paddingConfig === undefined) {
        paddingConfig = 0;
      }
  
      var config = this.getSizerConfig(gameObject);
      config.align = ALIGN_CENTER$1;
      config.padding = GetBoundsConfig(paddingConfig);
  
      if (index === undefined || index >= this.sizerChildren.length) {
        this.sizerChildren.push(gameObject);
      } else {
        this.sizerChildren.splice(index, 0, gameObject);
      }
  
      if (childKey !== undefined) {
        this.addChildrenMap(childKey, gameObject);
      }
  
      return this;
    };
  
    var AddChildMethods$3 = {
      add: function add(gameObject, paddingConfig, childKey) {
        if (IsArray(gameObject)) {
          var gameObjects = gameObject;
  
          for (var i = 0, cnt = gameObjects.length; i < cnt; i++) {
            Add$3.call(this, gameObjects[i], paddingConfig);
          }
        } else {
          Add$3.call(this, gameObject, paddingConfig, childKey);
        }
  
        return this;
      },
      addNewLine: function addNewLine() {
        this.sizerChildren.push('\n');
        return this;
      },
      insert: function insert(index, gameObject, paddingConfig, childKey) {
        Add$3.call(this, gameObject, paddingConfig, childKey, index);
        return this;
      },
      insertAtPosition: function insertAtPosition(x, y, gameObject, paddingConfig, childKey) {
        var index = GetNearestChildIndex.call(this, x, y);
  
        if (index === -1) {
          index = undefined;
        }
  
        this.insert(index, gameObject, paddingConfig, childKey);
        return this;
      }
    };
  
    var RemoveItem = Phaser.Utils.Array.Remove;
    var RemoveChildMethods$3 = {
      remove: function remove(gameObject, destroyChild) {
        if (this.getParentSizer(gameObject) !== this) {
          return this;
        }
  
        RemoveItem(this.sizerChildren, gameObject);
        RemoveChild.call(this, gameObject, destroyChild);
        return this;
      },
      removeAll: function removeAll(destroyChild) {
        for (var i = this.sizerChildren.length - 1; i >= 0; i--) {
          this.remove(this.sizerChildren[i], destroyChild);
        }
  
        return this;
      },
      clear: function clear(destroyChild) {
        this.sizerChildren.length = 0;
        ClearChildren.call(this, destroyChild);
        return this;
      }
    };
  
    var methods$1 = {
      getChildrenWidth: GetChildrenWidth$1,
      getChildrenHeight: GetChildrenHeight$1,
      getChildrenSizers: GetChildrenSizers$1,
      preLayout: PreLayout$1,
      layoutChildren: LayoutChildren$1,
      runWidthWrap: RunWidthWrap$1
    };
    Object.assign(methods$1, AddChildMethods$3, RemoveChildMethods$3);
  
    var GetMaxChildWidth = function GetMaxChildWidth(children) {
      if (children === undefined) {
        children = this.sizerChildren;
      }
  
      var result = 0;
      var child, childWidth;
  
      for (var i = 0, cnt = children.length; i < cnt; i++) {
        child = children[i];
  
        if (child === '\n') {
          continue;
        }
  
        childWidth = this.getChildWidth(child);
        result = Math.max(childWidth, result);
      }
  
      return result;
    };
  
    var GetMaxChildHeight = function GetMaxChildHeight(children) {
      if (children === undefined) {
        children = this.sizerChildren;
      }
  
      var result = 0;
      var child, childHeight;
  
      for (var i = 0, cnt = children.length; i < cnt; i++) {
        child = children[i];
  
        if (child === '\n') {
          continue;
        }
  
        childHeight = child.isRexSizer ? Math.max(child.minHeight, child.childrenHeight) : child.hasOwnProperty('minHeight') ? child.minHeight : GetDisplayHeight(child);
        result = Math.max(childHeight, result);
      }
  
      return result;
    };
  
    var IsPlainObject$2 = Phaser.Utils.Objects.IsPlainObject;
    var GetValue$6 = Phaser.Utils.Objects.GetValue;
  
    var FixWidthSizer = /*#__PURE__*/function (_BaseSizer) {
      _inherits(FixWidthSizer, _BaseSizer);
  
      var _super = _createSuper(FixWidthSizer);
  
      function FixWidthSizer(scene, x, y, minWidth, minHeight, config) {
        var _this;
  
        _classCallCheck(this, FixWidthSizer);
  
        if (IsPlainObject$2(x)) {
          config = x;
          x = GetValue$6(config, 'x', 0);
          y = GetValue$6(config, 'y', 0);
          minWidth = GetValue$6(config, 'width', undefined);
          minHeight = GetValue$6(config, 'height', undefined);
        } else if (IsPlainObject$2(minWidth)) {
          config = minWidth;
          minWidth = GetValue$6(config, 'width', undefined);
          minHeight = GetValue$6(config, 'height', undefined);
        }
  
        _this = _super.call(this, scene, x, y, minWidth, minHeight, config);
        _this.type = 'rexFixWidthSizer';
        _this.sizerChildren = [];
  
        _this.setOrientation(GetValue$6(config, 'orientation', 0));
  
        _this.setItemSpacing(GetValue$6(config, 'space.item', 0));
  
        _this.setLineSpacing(GetValue$6(config, 'space.line', 0));
  
        _this.setIntentLeft(GetValue$6(config, 'space.indentLeftOdd', 0), GetValue$6(config, 'space.indentLeftEven', 0));
  
        _this.setIntentTop(GetValue$6(config, 'space.indentTopOdd', 0), GetValue$6(config, 'space.indentTopEven', 0));
  
        _this.setAlign(GetValue$6(config, 'align', 0));
  
        _this.setJustifyPercentage(GetValue$6(config, 'justifyPercentage', 0.25));
  
        _this.setRTL(GetValue$6(config, 'rtl', false));
  
        _this.addChildrenMap('items', _this.sizerChildren);
  
        return _this;
      }
  
      _createClass(FixWidthSizer, [{
        key: "setOrientation",
        value: function setOrientation(orientation) {
          this.orientation = GetOrientationMode(orientation);
          return this;
        }
      }, {
        key: "setItemSpacing",
        value: function setItemSpacing(space) {
          this.space.item = space;
          return this;
        }
      }, {
        key: "setLineSpacing",
        value: function setLineSpacing(space) {
          this.space.line = space;
          return this;
        }
      }, {
        key: "setIntentLeft",
        value: function setIntentLeft(odd, even) {
          this.space.indentLeftOdd = odd;
          this.space.indentLeftEven = even;
          return this;
        }
      }, {
        key: "setIntentTop",
        value: function setIntentTop(odd, even) {
          this.space.indentTopOdd = odd;
          this.space.indentTopEven = even;
          return this;
        }
      }, {
        key: "setAlign",
        value: function setAlign(align) {
          if (typeof align === 'string') {
            align = ALIGN[align];
          }
  
          this.align = align;
          return this;
        }
      }, {
        key: "setJustifyPercentage",
        value: function setJustifyPercentage(value) {
          this.justifyPercentage = value;
          return this;
        }
      }, {
        key: "setRTL",
        value: function setRTL(enabled) {
          if (enabled === undefined) {
            enabled = true;
          }
  
          this.rtl = enabled;
          return this;
        }
      }, {
        key: "maxChildWidth",
        get: function get() {
          if (this._maxChildWidth === undefined) {
            this._maxChildWidth = GetMaxChildWidth.call(this);
          }
  
          return this._maxChildWidth;
        }
      }, {
        key: "maxChildHeight",
        get: function get() {
          if (this._maxChildHeight === undefined) {
            this._maxChildHeight = GetMaxChildHeight.call(this);
          }
  
          return this._maxChildHeight;
        }
      }]);
  
      return FixWidthSizer;
    }(Base);
  
    var ALIGN = {
      left: 0,
      top: 0,
      right: 1,
      bottom: 1,
      center: 2,
      justify: 3,
      'justify-left': 3,
      'justify-top': 3,
      'justify-right': 4,
      'justify-bottom': 4,
      'justify-center': 5
    };
    Object.assign(FixWidthSizer.prototype, methods$1);
  
    var SizerAdd$1 = FixWidthSizer.prototype.add;
  
    var Add$2 = function Add(gameObject) {
      SizerAdd$1.call(this, gameObject);
      this.buttonGroup.add(gameObject);
      return this;
    };
  
    var AddChildMethods$2 = {
      addButton: function addButton(gameObject) {
        if (IsArray(gameObject)) {
          var gameObjects = gameObject;
  
          for (var i = 0, cnt = gameObjects.length; i < cnt; i++) {
            Add$2.call(this, gameObjects[i]);
          }
        } else {
          Add$2.call(this, gameObject);
        }
  
        return this;
      },
      addButtons: function addButtons(gameObjects) {
        if (IsArray(gameObjects[0])) {
          // 2d array
          var lines = gameObjects,
              line;
  
          for (var lineIdx = 0, lastLineIdx = lines.length - 1; lineIdx <= lastLineIdx; lineIdx++) {
            line = lines[lineIdx];
  
            for (var i = 0, cnt = line.length; i < cnt; i++) {
              Add$2.call(this, line[i]);
            }
  
            if (lineIdx > lastLineIdx) {
              SizerAdd$1.addNewLine(this);
            }
          }
        } else {
          // 1d array
          for (var i = 0, cnt = gameObjects.length; i < cnt; i++) {
            Add$2.call(this, gameObjects[i]);
          }
        }
  
        return this;
      }
    };
  
    var SizerRmove$1 = FixWidthSizer.prototype.remove;
    var SizerClear$1 = FixWidthSizer.prototype.clear;
  
    var Remove$1 = function Remove(gameObject, destroyChild) {
      var gameObject = this.getButton(gameObject);
  
      if (!gameObject) {
        return this;
      }
  
      this.buttonGroup.remove(gameObject);
      SizerRmove$1.call(this, gameObject, destroyChild);
      return this;
    };
  
    var RemoveChildMethods$2 = {
      remove: function remove(gameObject, destroyChild) {
        if (IsArray(gameObject)) {
          var gameObjects = gameObject;
  
          for (var i = 0, cnt = gameObjects.length; i < cnt; i++) {
            Remove$1.call(this, gameObjects[i], destroyChild);
          }
        } else {
          Remove$1.call(this, gameObject, destroyChild);
        }
  
        return this;
      },
      clear: function clear(destroyChild) {
        var buttons = this.buttonGroup.buttons;
        buttons.length = 0;
        SizerClear$1.call(this, destroyChild);
        return this;
      },
      removeButton: function removeButton(gameObject, destroyChild) {
        this.remove(gameObject, destroyChild);
        return this;
      },
      clearButtons: function clearButtons(destroyChild) {
        var buttons = this.buttonGroup.buttons;
  
        for (var i = buttons.length - 1; i >= 0; i--) {
          Remove$1.call(this, buttons[i], destroyChild);
        }
  
        return this;
      }
    };
  
    var GetValue$5 = Phaser.Utils.Objects.GetValue;
  
    var Buttons = /*#__PURE__*/function (_FixWidthSizer) {
      _inherits(Buttons, _FixWidthSizer);
  
      var _super = _createSuper(Buttons);
  
      function Buttons(scene, config) {
        var _this;
  
        _classCallCheck(this, Buttons);
  
        if (config === undefined) {
          config = {};
        }
  
        var buttonSpace = config.space;
  
        if (typeof buttonSpace === 'number') {
          config.space = {
            item: buttonSpace,
            line: buttonSpace
          };
        } // Create
  
  
        _this = _super.call(this, scene, config);
        _this.type = 'rexFixWidthButtons';
        _this.buttonGroup = new ButtonGroup({
          parent: _assertThisInitialized(_this),
          eventEmitter: GetValue$5(config, 'eventEmitter', _assertThisInitialized(_this)),
          groupName: GetValue$5(config, 'groupName', undefined),
          clickConfig: GetValue$5(config, 'click', undefined)
        }).setButtonsType(config); // Add elements
  
        var background = GetValue$5(config, 'background', undefined);
        var buttons = GetValue$5(config, 'buttons', undefined); // Buttons properties
  
        _this.buttonsAlign = GetValue$5(config, 'align', undefined);
  
        if (background) {
          _this.addBackground(background);
        }
  
        if (buttons) {
          _this.addButtons(buttons);
        }
  
        _this.addChildrenMap('background', background);
  
        _this.addChildrenMap('buttons', _this.buttonGroup.buttons);
  
        return _this;
      }
  
      _createClass(Buttons, [{
        key: "destroy",
        value: function destroy(fromScene) {
          //  This Game Object has already been destroyed
          if (!this.scene) {
            return;
          }
  
          _get(_getPrototypeOf(Buttons.prototype), "destroy", this).call(this, fromScene);
  
          this.buttonGroup.destroy();
          this.buttonGroup = undefined;
        }
      }, {
        key: "buttons",
        get: function get() {
          return this.buttonGroup.buttons;
        }
      }, {
        key: "groupName",
        get: function get() {
          return this.buttonGroup.groupName;
        },
        set: function set(value) {
          this.buttonGroup.groupName = value;
        }
      }, {
        key: "eventEmitter",
        get: function get() {
          return this.buttonGroup.eventEmitter;
        }
      }]);
  
      return Buttons;
    }(FixWidthSizer);
  
    Object.assign(Buttons.prototype, AddChildMethods$2, RemoveChildMethods$2, ButtonMethods$1, ButtonStateMethods);
  
    var Sum = function Sum() {
      return Array.prototype.reduce.call(arguments, Add$1, 0);
    };
  
    var Add$1 = function Add(a, b) {
      return a + b;
    };
  
    var GetChildrenWidth = function GetChildrenWidth() {
      if (this.rexSizer.hidden) {
        return 0;
      }
  
      var result = 0,
          columnWidth;
      var children = this.sizerChildren;
      var child, padding, childWidth, proportion;
  
      for (var i = 0; i < this.columnCount; i++) {
        proportion = this.columnProportions[i];
        columnWidth = 0;
  
        if (proportion === 0) {
          for (var j = 0; j < this.rowCount; j++) {
            child = children[j * this.columnCount + i];
  
            if (!child) {
              continue;
            }
  
            if (child.rexSizer.hidden) {
              continue;
            }
  
            padding = child.rexSizer.padding;
            childWidth = this.getChildWidth(child) + padding.left + padding.right;
            columnWidth = Math.max(columnWidth, childWidth);
          }
  
          result += columnWidth;
        } // else,(proportion > 0) : columnWidth is 0
  
  
        this.columnWidth[i] = columnWidth;
      }
  
      var space = this.space;
      var indentLeft = Math.max(space.indentLeftOdd, space.indentLeftEven);
      return result + Sum.apply(void 0, [space.left, indentLeft].concat(_toConsumableArray(space.column), [space.right]));
    };
  
    var GetChildrenHeight = function GetChildrenHeight() {
      if (this.rexSizer.hidden) {
        return 0;
      }
  
      var result = 0,
          rowHeight;
      var children = this.sizerChildren;
      var child, padding, childHeight, proportion;
  
      for (var i = 0; i < this.rowCount; i++) {
        proportion = this.rowProportions[i];
        rowHeight = 0;
  
        if (proportion === 0) {
          for (var j = 0; j < this.columnCount; j++) {
            child = children[i * this.columnCount + j];
  
            if (!child) {
              continue;
            }
  
            if (child.rexSizer.hidden) {
              continue;
            }
  
            childHeight = child.isRexSizer ? Math.max(child.minHeight, child.childrenHeight) : child.hasOwnProperty('minHeight') ? child.minHeight : GetDisplayHeight(child);
            padding = child.rexSizer.padding;
            childHeight += padding.top + padding.bottom;
            rowHeight = Math.max(rowHeight, childHeight);
          }
  
          result += rowHeight;
        } // else,(proportion > 0) : rowHeight is 0
  
  
        this.rowHeight[i] = rowHeight;
      }
  
      var space = this.space;
      var indentTop = Math.max(space.indentTopOdd, space.indentTopEven);
      return result + Sum.apply(void 0, [space.top, indentTop].concat(_toConsumableArray(space.row), [space.bottom]));
    };
  
    var GetExpandedChildWidth = function GetExpandedChildWidth(child, colWidth) {
      var childWidth;
      var childConfig = child.rexSizer;
  
      if (childConfig.expand) {
        var padding = childConfig.padding;
        childWidth = colWidth - padding.left - padding.right;
      }
  
      return childWidth;
    };
  
    var GetExpandedChildHeight = function GetExpandedChildHeight(child, rowHeight) {
      var childHeight;
      var childConfig = child.rexSizer;
  
      if (childConfig.expand) {
        var padding = childConfig.padding;
        childHeight = rowHeight - padding.top - padding.bottom;
      }
  
      return childHeight;
    };
  
    var GetChildrenSizers = function GetChildrenSizers(out) {
      if (out === undefined) {
        out = [];
      }
  
      var children = this.sizerChildren,
          child;
  
      for (var i = 0, cnt = children.length; i < cnt; i++) {
        child = children[i];
  
        if (child && child.isRexSizer) {
          out.push(child);
        }
      }
  
      return out;
    };
  
    var PreLayout = function PreLayout() {
      this._totalColumnProportions = undefined;
      this._totalRowProportions = undefined;
      this.proportionWidthLength = undefined;
      this.proportionHeightLength = undefined;
      PreLayout$3.call(this);
      return this;
    };
  
    var LayoutChildren = function LayoutChildren() {
      var child, childConfig, padding;
      var startX = this.innerLeft,
          startY = this.innerTop;
      var itemX,
          itemY = startY;
      var x, y, width, height; // Align zone
  
      var childWidth, childHeight; // Layout grid children
  
      var columnSpace = this.space.column,
          rowSpace = this.space.row,
          indentLeftOdd = this.space.indentLeftOdd,
          indentLeftEven = this.space.indentLeftEven,
          indentTopOdd = this.space.indentTopOdd,
          indentTopEven = this.space.indentTopEven;
      var colWidth, rowHeight;
      var indentLeft, indentTop;
  
      for (var rowIndex = 0; rowIndex < this.rowCount; rowIndex++) {
        rowHeight = this.getRowHeight(rowIndex);
        indentLeft = rowIndex % 2 ? indentLeftEven : indentLeftOdd;
        itemX = startX + indentLeft;
  
        for (var columnIndex = 0; columnIndex < this.columnCount; columnIndex++) {
          colWidth = this.getColumnWidth(columnIndex);
          child = this.getChildAt(columnIndex, rowIndex);
  
          if (!child || child.rexSizer.hidden) {
            itemX += colWidth + columnSpace[columnIndex];
            continue;
          }
  
          PreLayoutChild.call(this, child);
          childWidth = this.getExpandedChildWidth(child, colWidth);
          childHeight = this.getExpandedChildHeight(child, rowHeight);
  
          if (child.isRexSizer) {
            child.runLayout(this, childWidth, childHeight);
            CheckSize(child, this);
          } else {
            ResizeGameObject(child, childWidth, childHeight);
          }
  
          childConfig = child.rexSizer;
          padding = childConfig.padding;
          x = itemX + padding.left;
          width = colWidth - padding.left - padding.right;
          indentTop = columnIndex % 2 ? indentTopEven : indentTopOdd;
          y = itemY + indentTop + padding.top;
          height = rowHeight - padding.top - padding.bottom;
          LayoutChild.call(this, child, x, y, width, height, childConfig.align);
          itemX += colWidth + columnSpace[columnIndex];
        }
  
        itemY += rowHeight + rowSpace[rowIndex];
      }
    };
  
    var ResolveWidth = function ResolveWidth(width) {
      var width = ResolveWidth$2.call(this, width); // Get proportionLength
  
      if (this.proportionWidthLength === undefined) {
        var totalColumnProportions = this.totalColumnProportions;
  
        if (totalColumnProportions > 0) {
          var remainder = width - this.childrenWidth;
  
          if (remainder >= 0) {
            this.proportionWidthLength = remainder / totalColumnProportions;
          }
        } else {
          this.proportionWidthLength = 0;
        }
      }
  
      return width;
    };
  
    var ResolveHeight = function ResolveHeight(parent, height) {
      var height = ResolveHeight$2.call(this, parent, height); // Get proportionLength    
  
      if (this.proportionHeightLength === undefined) {
        var totalRowProportions = this.totalRowProportions;
  
        if (totalRowProportions > 0) {
          var remainder = height - this.childrenHeight;
  
          if (remainder >= 0) {
            this.proportionHeightLength = remainder / totalRowProportions;
          }
        } else {
          this.proportionHeightLength = 0;
        }
      }
  
      return height;
    };
  
    var ResolveChildrenWidth = function ResolveChildrenWidth(parentWidth) {
      // Resolve width of sizer children
      var child, childWidth;
      var colWidth;
  
      for (var i in this.sizerChildren) {
        child = this.sizerChildren[i];
  
        if (child && child.isRexSizer && !child.ignoreLayout) {
          colWidth = this.getColumnWidth(parseInt(i) % this.columnCount);
          childWidth = this.getExpandedChildWidth(child, colWidth);
          childWidth = child.resolveWidth(childWidth);
          child.resolveChildrenWidth(childWidth);
        }
      }
    };
  
    // Default method
    var RunWidthWrap = function RunWidthWrap(width) {
      var child, childWidth;
      var colWidth;
  
      for (var i in this.sizerChildren) {
        child = this.sizerChildren[i];
  
        if (!child || child.isRexSizer && child.ignoreLayout || !child.runWidthWrap) {
          continue;
        }
  
        colWidth = this.getColumnWidth(parseInt(i) % this.columnCount);
        childWidth = this.getExpandedChildWidth(child, colWidth);
  
        if (child.isRexSizer) {
          childWidth = child.resolveWidth(childWidth);
        }
  
        child.runWidthWrap(childWidth);
      }
  
      return this;
    };
  
    var IsPlainObject$1 = Phaser.Utils.Objects.IsPlainObject;
    var GetValue$4 = Phaser.Utils.Objects.GetValue;
    var ALIGN_CENTER = Phaser.Display.Align.CENTER;
  
    var GetEmptyCellIndex = function GetEmptyCellIndex(columnIndex, rowIndex, cells, columnCount, rowCount) {
      if (typeof columnIndex === 'number' || typeof rowIndex === 'number') {
        if (columnIndex === undefined) {
          var idx;
  
          for (var i = 0; i < columnCount; i++) {
            idx = rowIndex * columnCount + i;
  
            if (!cells[idx]) {
              return idx;
            }
          }
        } else if (rowIndex === undefined) {
          var idx;
  
          for (var i = 0; i < rowCount; i++) {
            idx = i * columnCount + columnIndex;
  
            if (!cells[idx]) {
              return idx;
            }
          }
        } else {
          var idx = rowIndex * columnCount + columnIndex;
  
          if (!cells[idx]) {
            return idx;
          }
        }
      } else if (rowIndex === true) {
        var idx;
  
        for (var i = 0; i < columnCount; i++) {
          for (var j = 0; j < rowCount; j++) {
            idx = j * columnCount + i;
  
            if (!cells[idx]) {
              return idx;
            }
          }
        }
      } else {
        for (var i = 0, cnt = cells.length; i < cnt; i++) {
          if (!cells[i]) {
            return i;
          }
        }
      }
  
      return null;
    };
  
    var Add = function Add(gameObject, columnIndex, rowIndex, align, paddingConfig, expand, childKey) {
      AddChild.call(this, gameObject);
  
      if (IsPlainObject$1(columnIndex)) {
        var config = columnIndex;
        columnIndex = GetValue$4(config, 'column', undefined);
        rowIndex = GetValue$4(config, 'row', undefined);
        align = GetValue$4(config, 'align', ALIGN_CENTER);
        paddingConfig = GetValue$4(config, 'padding', 0);
        expand = GetValue$4(config, 'expand', false);
        childKey = GetValue$4(config, 'key', undefined);
      } // Get insert index
  
  
      var itemIndex = GetEmptyCellIndex(columnIndex, rowIndex, this.sizerChildren, this.columnCount, this.rowCount);
  
      if (itemIndex === null) {
        // Specific index mode
        if (typeof columnIndex === 'number' && typeof rowIndex === 'number') {
          return this;
        }
  
        if (rowIndex === true || typeof rowIndex === 'number') {
          this.addEmptyColumn();
        } else {
          this.addEmptyRow();
        } // Get insert index again
  
  
        itemIndex = GetEmptyCellIndex(columnIndex, rowIndex, this.sizerChildren, this.columnCount, this.rowCount);
      }
  
      if (typeof align === 'string') {
        align = ALIGNMODE[align];
      }
  
      if (align === undefined) {
        align = ALIGN_CENTER;
      }
  
      if (paddingConfig === undefined) {
        paddingConfig = 0;
      }
  
      if (expand === undefined) {
        expand = true;
      }
  
      var config = this.getSizerConfig(gameObject);
      config.align = align;
      config.padding = GetBoundsConfig(paddingConfig);
      config.expand = expand;
      this.sizerChildren[itemIndex] = gameObject;
  
      if (childKey !== undefined) {
        this.addChildrenMap(childKey, gameObject);
      }
  
      return this;
    };
  
    var AddChildMethods$1 = {
      add: Add
    };
  
    var Fill = function Fill(arr, value, startIdx, endIdx) {
      if (startIdx === undefined) {
        startIdx = 0;
      }
  
      if (endIdx === undefined) {
        endIdx = arr.length - 1;
      }
  
      for (var i = startIdx; i <= endIdx; i++) {
        arr[i] = value;
      }
  
      return arr;
    };
  
    var RemoveChildMethods$1 = {
      remove: function remove(gameObject, destroyChild) {
        if (this.getParentSizer(gameObject) !== this) {
          return this;
        }
  
        var idx = this.sizerChildren.indexOf(gameObject);
  
        if (idx !== -1) {
          this.sizerChildren[idx] = null;
        }
  
        RemoveChild.call(this, gameObject, destroyChild);
        return this;
      },
      removeAt: function removeAt(columnIndex, rowIndex, destroyChild) {
        var child = this.getChildAt(columnIndex, rowIndex);
  
        if (child) {
          this.remove(child, destroyChild);
        }
  
        return this;
      },
      removeAll: function removeAll(destroyChild) {
        for (var i = this.sizerChildren.length - 1; i >= 0; i--) {
          var child = this.sizerChildren[i];
  
          if (!child) {
            continue;
          }
  
          this.remove(child, destroyChild);
        }
  
        return this;
      },
      clear: function clear(destroyChild) {
        Fill(this.sizerChildren, null);
        ClearChildren.call(this, destroyChild);
        return this;
      }
    };
  
    var GetValue$3 = Phaser.Utils.Objects.GetValue;
  
    var ResetGrid = function ResetGrid(columnCount, rowCount, columnProportions, rowProportions, space) {
      if (columnProportions === undefined) {
        columnProportions = 0;
      }
  
      if (rowProportions === undefined) {
        rowProportions = 0;
      }
  
      this.columnCount = columnCount;
      this.rowCount = rowCount;
      this.gridCount = columnCount * rowCount; // children
  
      if (this.sizerChildren === undefined) {
        this.sizerChildren = [];
      } else {
        this.removeAll();
      }
  
      this.sizerChildren.length = columnCount * rowCount;
      Fill(this.sizerChildren, null); // proportions
  
      this.columnProportions = [];
      this.columnProportions.length = columnCount;
  
      if (typeof columnProportions === 'number') {
        Fill(this.columnProportions, columnProportions);
      } else {
        for (var i = 0; i < columnCount; i++) {
          this.columnProportions[i] = columnProportions[i] || 0;
        }
      }
  
      this.rowProportions = [];
      this.rowProportions.length = rowCount;
  
      if (typeof rowProportions === 'number') {
        Fill(this.rowProportions, rowProportions);
      } else {
        for (var i = 0; i < rowCount; i++) {
          this.rowProportions[i] = rowProportions[i] || 0;
        }
      } // width & height
  
  
      this.columnWidth = [];
      this.columnWidth.length = columnCount;
      this.rowHeight = [];
      this.rowHeight.length = rowCount; // space
  
      this.space.column = [];
      this.space.column.length = columnCount - 1;
      var columnSpace = GetValue$3(space, 'column', 0);
  
      if (typeof columnSpace === 'number') {
        Fill(this.space.column, columnSpace);
      } else {
        for (var i = 0, cnt = this.space.column.length; i < cnt; i++) {
          this.space.column[i] = columnSpace[i] || 0;
        }
      }
  
      this.space.row = [];
      this.space.row.length = rowCount - 1;
      var rowSpace = GetValue$3(space, 'row', 0);
  
      if (typeof rowSpace === 'number') {
        Fill(this.space.row, rowSpace);
      } else {
        for (var i = 0, cnt = this.space.row.length; i < cnt; i++) {
          this.space.row[i] = rowSpace[i] || 0;
        }
      }
  
      return this;
    };
  
    var InseryEmptyRow = function InseryEmptyRow(rowIndex, proportion, space) {
      if (proportion === undefined) {
        proportion = this.rowProportions[0] || 0;
      }
  
      if (space === undefined) {
        space = this.space.row[0] || 0;
      }
  
      this.rowCount += 1;
      this.gridCount += this.columnCount;
      var args = [rowIndex * this.columnCount, 0];
  
      for (var i = 0; i < this.columnCount; i++) {
        args.push(null);
      }
  
      this.sizerChildren.splice.apply(this.sizerChildren, args);
      this.rowProportions.push(proportion);
      this.rowHeight.length += 1; // this.rowHeight will be recalculated when layout()    
  
      this.space.row.splice(rowIndex, 0, space);
      return this;
    };
  
    var AddEmptyRow = function AddEmptyRow(proportion, space) {
      InseryEmptyRow.call(this, this.rowCount, proportion, space);
      return this;
    };
  
    var InsertEmptyColumn = function InsertEmptyColumn(colIndex, proportion, space) {
      if (proportion === undefined) {
        proportion = this.columnProportions[0] || 0;
      }
  
      if (space === undefined) {
        space = this.space.column[0] || 0;
      }
  
      this.columnCount += 1;
      this.gridCount += this.rowCount;
  
      for (var i = this.rowCount - 1; i >= 0; i--) {
        var insertIndex = i * this.columnCount + colIndex;
        this.sizerChildren.splice(insertIndex, 0, null);
      }
  
      this.columnProportions.push(proportion);
      this.columnWidth.length += 1; // this.columnWidth will be recalculated when layout()    
  
      this.space.column.splice(colIndex, 0, space);
      return this;
    };
  
    var AddEmptyColumn = function AddEmptyColumn(proportion, space) {
      InsertEmptyColumn.call(this, this.columnCount, proportion, space);
      return this;
    };
  
    var methods = {
      getChildrenWidth: GetChildrenWidth,
      getChildrenHeight: GetChildrenHeight,
      getExpandedChildWidth: GetExpandedChildWidth,
      getExpandedChildHeight: GetExpandedChildHeight,
      getChildrenSizers: GetChildrenSizers,
      preLayout: PreLayout,
      layoutChildren: LayoutChildren,
      resolveWidth: ResolveWidth,
      resolveHeight: ResolveHeight,
      resolveChildrenWidth: ResolveChildrenWidth,
      runWidthWrap: RunWidthWrap,
      resetGrid: ResetGrid,
      inseryEmptyRow: InseryEmptyRow,
      addEmptyRow: AddEmptyRow,
      insertEmptyColumn: InsertEmptyColumn,
      addEmptyColumn: AddEmptyColumn
    };
    Object.assign(methods, AddChildMethods$1, RemoveChildMethods$1);
  
    var GetTotalColumnProportions = function GetTotalColumnProportions() {
      var result = 0,
          proportion;
  
      for (var i = 0; i < this.columnCount; i++) {
        proportion = this.columnProportions[i];
  
        if (proportion > 0) {
          result += proportion;
        }
      }
  
      return result;
    };
  
    var GetTotalRowProportions = function GetTotalRowProportions() {
      var result = 0,
          proportion;
  
      for (var i = 0; i < this.rowCount; i++) {
        proportion = this.rowProportions[i];
  
        if (proportion > 0) {
          result += proportion;
        }
      }
  
      return result;
    };
  
    var IsPlainObject = Phaser.Utils.Objects.IsPlainObject;
    var GetValue$2 = Phaser.Utils.Objects.GetValue;
  
    var GridSizer = /*#__PURE__*/function (_BaseSizer) {
      _inherits(GridSizer, _BaseSizer);
  
      var _super = _createSuper(GridSizer);
  
      function GridSizer(scene, x, y, minWidth, minHeight, columnCount, rowCount, columnProportions, rowProportions, config) {
        var _this;
  
        _classCallCheck(this, GridSizer);
  
        if (IsPlainObject(x)) {
          config = x;
          x = GetValue$2(config, 'x', 0);
          y = GetValue$2(config, 'y', 0);
          minWidth = GetValue$2(config, 'width', undefined);
          minHeight = GetValue$2(config, 'height', undefined);
          columnCount = GetValue$2(config, 'column', config.col || 0);
          rowCount = GetValue$2(config, 'row', 0);
          columnProportions = GetValue$2(config, 'columnProportions', 0);
          rowProportions = GetValue$2(config, 'rowProportions', 0);
        } else if (IsPlainObject(minWidth)) {
          config = minWidth;
          minWidth = GetValue$2(config, 'width', undefined);
          minHeight = GetValue$2(config, 'height', undefined);
          columnCount = GetValue$2(config, 'column', config.col || 0);
          rowCount = GetValue$2(config, 'row', 0);
          columnProportions = GetValue$2(config, 'columnProportions', 0);
          rowProportions = GetValue$2(config, 'rowProportions', 0);
        } else if (IsPlainObject(columnCount)) {
          config = columnCount;
          columnCount = GetValue$2(config, 'column', config.col || 0);
          rowCount = GetValue$2(config, 'row', 0);
          columnProportions = GetValue$2(config, 'columnProportions', 0);
          rowProportions = GetValue$2(config, 'rowProportions', 0);
        } else if (IsPlainObject(columnProportions)) {
          config = columnProportions;
          columnProportions = GetValue$2(config, 'columnProportions', 0);
          rowProportions = GetValue$2(config, 'rowProportions', 0);
        }
  
        _this = _super.call(this, scene, x, y, minWidth, minHeight, config);
        _this.type = 'rexGridSizer';
  
        _this.resetGrid(columnCount, rowCount, columnProportions, rowProportions, GetValue$2(config, 'space', undefined));
  
        _this.setIndentLeft(GetValue$2(config, 'space.indentLeftOdd', 0), GetValue$2(config, 'space.indentLeftEven', 0));
  
        _this.setIndentTop(GetValue$2(config, 'space.indentTopOdd', 0), GetValue$2(config, 'space.indentTopEven', 0));
  
        _this.addChildrenMap('items', _this.sizerChildren);
  
        var createCellContainerCallback = GetValue$2(config, 'createCellContainerCallback');
  
        if (createCellContainerCallback) {
          for (var y = 0, ycnt = _this.rowCount; y < ycnt; y++) {
            for (var x = 0, xcnt = _this.columnCount; x < xcnt; x++) {
              var addConfig = {
                column: x,
                row: y
              };
              var child = createCellContainerCallback(scene, x, y, addConfig);
  
              if (child) {
                _this.add(child, addConfig);
              }
            }
          }
        }
  
        return _this;
      }
  
      _createClass(GridSizer, [{
        key: "destroy",
        value: function destroy(fromScene) {
          //  This Game Object has already been destroyed
          if (!this.scene) {
            return;
          }
  
          _get(_getPrototypeOf(GridSizer.prototype), "destroy", this).call(this, fromScene); // More free resources
  
  
          this.columnProportions = undefined;
          this.rowProportions = undefined;
          this.columnWidth = undefined;
          this.rowHeight = undefined;
        }
      }, {
        key: "setIndentLeft",
        value: function setIndentLeft(odd, even) {
          this.space.indentLeftOdd = odd;
          this.space.indentLeftEven = even;
          return this;
        }
      }, {
        key: "setIndentTop",
        value: function setIndentTop(odd, even) {
          this.space.indentTopOdd = odd;
          this.space.indentTopEven = even;
          return this;
        }
      }, {
        key: "setColumnProportion",
        value: function setColumnProportion(columnIndex, proportion) {
          if (columnIndex >= this.columnProportions.length) {
            return this;
          }
  
          this.columnProportions[columnIndex] = proportion;
          return this;
        }
      }, {
        key: "setRowProportion",
        value: function setRowProportion(rowIndex, proportion) {
          if (rowIndex >= this.rowProportions.length) {
            return this;
          }
  
          this.rowProportions[rowIndex] = proportion;
          return this;
        }
      }, {
        key: "totalColumnProportions",
        get: function get() {
          if (this._totalColumnProportions === undefined) {
            this._totalColumnProportions = GetTotalColumnProportions.call(this);
          }
  
          return this._totalColumnProportions;
        }
      }, {
        key: "totalRowProportions",
        get: function get() {
          if (this._totalRowProportions === undefined) {
            this._totalRowProportions = GetTotalRowProportions.call(this);
          }
  
          return this._totalRowProportions;
        }
      }, {
        key: "getChildAt",
        value: function getChildAt(columnIndex, rowIndex) {
          return this.sizerChildren[rowIndex * this.columnCount + columnIndex];
        }
      }, {
        key: "childToGridIndex",
        value: function childToGridIndex(child, out) {
          if (!child) {
            return null;
          }
  
          var index = this.sizerChildren.indexOf(child);
  
          if (index === -1) {
            return null;
          }
  
          if (out === undefined) {
            out = {};
          }
  
          out.x = index % this.columnCount;
          out.y = Math.floor(index / this.columnCount);
          return out;
        }
      }, {
        key: "getColumnWidth",
        value: function getColumnWidth(columnIndex) {
          var colProportion = this.columnProportions[columnIndex];
          var colWidth = colProportion === 0 ? this.columnWidth[columnIndex] : colProportion * this.proportionWidthLength;
          return colWidth;
        }
      }, {
        key: "getRowHeight",
        value: function getRowHeight(rowIndex) {
          var rowProportion = this.rowProportions[rowIndex];
          var rowHeight = rowProportion === 0 ? this.rowHeight[rowIndex] : rowProportion * this.proportionHeightLength;
          return rowHeight;
        }
      }]);
  
      return GridSizer;
    }(Base);
  
    Object.assign(GridSizer.prototype, methods);
  
    var SizerAdd = GridSizer.prototype.add;
    var AddChildMethods = {
      addButton: function addButton(gameObject, columnIndex, rowIndex) {
        SizerAdd.call(this, gameObject, columnIndex, rowIndex, undefined, 0, this.buttonsExpand);
        this.buttonGroup.add(gameObject);
        return this;
      },
      addButtons: function addButtons(gameObjects, rowThenColumn) {
        for (var i = 0, cnt = gameObjects; i < cnt; i++) {
          this.addButton(gameObjects[i], undefined, rowThenColumn);
        }
  
        return this;
      }
    };
  
    var SizerRmove = GridSizer.prototype.remove;
    var SizerClear = GridSizer.prototype.clear;
  
    var Remove = function Remove(gameObject, destroyChild) {
      var gameObject = this.getButton(gameObject);
  
      if (!gameObject) {
        return this;
      }
  
      this.buttonGroup.remove(gameObject);
      SizerRmove.call(this, gameObject, destroyChild);
      return this;
    };
  
    var RemoveChildMethods = {
      remove: function remove(gameObject, destroyChild) {
        if (IsArray(gameObject)) {
          var gameObjects = gameObject;
  
          for (var i = 0, cnt = gameObjects.length; i < cnt; i++) {
            Remove.call(this, gameObjects[i], destroyChild);
          }
        } else {
          Remove.call(this, gameObject, destroyChild);
        }
  
        return this;
      },
      clear: function clear(destroyChild) {
        var buttons = this.buttonGroup.buttons;
        buttons.length = 0;
        SizerClear.call(this, destroyChild);
        return this;
      },
      removeButton: function removeButton(gameObject, destroyChild) {
        this.remove(gameObject, destroyChild);
        return this;
      },
      clearButtons: function clearButtons(destroyChild) {
        var buttons = this.buttonGroup.buttons;
  
        for (var i = buttons.length - 1; i >= 0; i--) {
          Remove.call(this, buttons[i], destroyChild);
        }
  
        return this;
      }
    };
  
    var GetValue$1 = Phaser.Utils.Objects.GetValue;
  
    var GridButtons = /*#__PURE__*/function (_GridSizer) {
      _inherits(GridButtons, _GridSizer);
  
      var _super = _createSuper(GridButtons);
  
      function GridButtons(scene, config) {
        var _this;
  
        _classCallCheck(this, GridButtons);
  
        if (config === undefined) {
          config = {};
        }
  
        var rowCount = GetValue$1(config, 'row', 0);
        var columnCount = GetValue$1(config, 'column', config.col || 0);
        var createCellContainerCallback = GetValue$1(config, 'createCellContainerCallback');
        var buttons = GetValue$1(config, 'buttons', undefined);
        var buttonsExpand = GetValue$1(config, 'expand', true);
        var buttonProportion = buttonsExpand ? 1 : 0;
  
        if (createCellContainerCallback) {
          config.createCellContainerCallback = undefined;
        }
  
        if (buttons !== undefined) {
          rowCount = Math.max(rowCount, buttons.length);
  
          for (var i = 0, cnt = buttons.length; i < cnt; i++) {
            columnCount = Math.max(columnCount, buttons[i].length);
          }
        }
  
        config.row = rowCount;
        config.column = columnCount;
        config.columnProportions = buttonProportion;
        config.rowProportions = buttonProportion; // Create
  
        _this = _super.call(this, scene, config);
        _this.type = 'rexGridButtons';
        _this.buttonGroup = new ButtonGroup({
          parent: _assertThisInitialized(_this),
          eventEmitter: GetValue$1(config, 'eventEmitter', _assertThisInitialized(_this)),
          groupName: GetValue$1(config, 'groupName', undefined),
          clickConfig: GetValue$1(config, 'click', undefined)
        }).setButtonsType(config); // Add elements
  
        var background = GetValue$1(config, 'background', undefined); // Buttons properties
  
        _this.buttonsExpand = buttonsExpand;
        GetValue$1(config, 'space', undefined);
  
        if (background) {
          _this.addBackground(background);
        }
  
        if (buttons) {
          var rowButtons, button;
  
          for (var r = 0, rcnt = buttons.length; r < rcnt; r++) {
            // row
            rowButtons = buttons[r];
  
            for (var c = 0, ccnt = rowButtons.length; c < ccnt; c++) {
              // col
              button = rowButtons[c];
  
              if (button) {
                _this.addButton(button, c, r);
              }
            }
          }
        } else if (createCellContainerCallback) {
          for (var y = 0; y < rowCount; y++) {
            for (var x = 0; x < columnCount; x++) {
              var button = createCellContainerCallback(scene, x, y);
  
              if (button) {
                _this.addButton(button, x, y);
              }
            }
          }
        }
  
        _this.addChildrenMap('background', background);
  
        _this.addChildrenMap('buttons', _this.buttonGroup.buttons);
  
        return _this;
      }
  
      _createClass(GridButtons, [{
        key: "destroy",
        value: function destroy(fromScene) {
          //  This Game Object has already been destroyed
          if (!this.scene) {
            return;
          }
  
          _get(_getPrototypeOf(GridButtons.prototype), "destroy", this).call(this, fromScene);
  
          this.buttonGroup.destroy();
          this.buttonGroup = undefined;
        }
      }, {
        key: "buttons",
        get: function get() {
          return this.buttonGroup.buttons;
        }
      }, {
        key: "groupName",
        get: function get() {
          return this.buttonGroup.groupName;
        },
        set: function set(value) {
          this.buttonGroup.groupName = value;
        }
      }, {
        key: "eventEmitter",
        get: function get() {
          return this.buttonGroup.eventEmitter;
        }
      }]);
  
      return GridButtons;
    }(GridSizer);
  
    Object.assign(GridButtons.prototype, AddChildMethods, RemoveChildMethods, ButtonMethods$1, ButtonStateMethods);
  
    var ButtonMethods = {
      getChoice: function getChoice(index) {
        var choicesSizer = this.childrenMap.choicesSizer;
  
        if (choicesSizer) {
          return choicesSizer.getButton(index);
        } else {
          return undefined;
        }
      },
      getAction: function getAction(index) {
        return this.childrenMap.actionsSizer.getButton(index);
      },
      getToolbar: function getToolbar(index) {
        return this.childrenMap.toolbarSizer.getButton(index);
      },
      getLeftToolbar: function getLeftToolbar(index) {
        return this.childrenMap.leftToolbarSizer.getButton(index);
      },
      setChoiceEnable: function setChoiceEnable(index, enabled) {
        var choicesSizer = this.childrenMap.choicesSizer;
  
        if (choicesSizer) {
          choicesSizer.setButtonEnable(index, enabled);
        }
  
        return this;
      },
      setActionEnable: function setActionEnable(index, enabled) {
        this.childrenMap.actionsSizer.setButtonEnable(index, enabled);
        return this;
      },
      setToolbarEnable: function setToolbarEnable(index, enabled) {
        this.childrenMap.toolbarSizer.setButtonEnable(index, enabled);
        return this;
      },
      setLeftToolbarEnable: function setLeftToolbarEnable(index, enabled) {
        this.childrenMap.leftToolbarSizer.setButtonEnable(index, enabled);
        return this;
      },
      toggleChoiceEnable: function toggleChoiceEnable(index) {
        var choicesSizer = this.childrenMap.choicesSizer;
  
        if (choicesSizer) {
          choicesSizer.toggleButtonEnable(index);
        }
  
        return this;
      },
      toggleActionEnable: function toggleActionEnable(index) {
        this.childrenMap.actionsSizer.toggleButtonEnable(index);
        return this;
      },
      toggleToolbarEnable: function toggleToolbarEnable(index) {
        this.childrenMap.toolbarSizer.toggleButtonEnable(index);
        return this;
      },
      toggleLeftToolbarEnable: function toggleLeftToolbarEnable(index) {
        this.childrenMap.leftToolbarSizer.toggleButtonEnable(index);
        return this;
      },
      getChoiceEnable: function getChoiceEnable(index) {
        var choicesSizer = this.childrenMap.choicesSizer;
  
        if (choicesSizer) {
          return choicesSizer.getButtonEnable(index);
        } else {
          return false;
        }
      },
      getActionEnable: function getActionEnable(index) {
        return this.childrenMap.actionsSizer.getButtonEnable(index);
      },
      getToolbarEnable: function getToolbarEnable(index) {
        return this.childrenMap.toolbarSizer.getButtonEnable(index);
      },
      getLeftToolbarEnable: function getLeftToolbarEnable(index) {
        return this.childrenMap.leftToolbarSizer.getButtonEnable(index);
      },
      emitChoiceClick: function emitChoiceClick(index) {
        var choicesSizer = this.childrenMap.choicesSizer;
  
        if (choicesSizer) {
          choicesSizer.emitButtonClick(index);
        }
  
        return this;
      },
      emitActionClick: function emitActionClick(index) {
        this.childrenMap.actionsSizer.emitButtonClick(index);
        return this;
      },
      emitToolbarClick: function emitToolbarClick(index) {
        this.childrenMap.toolbarSizer.emitButtonClick(index);
        return this;
      },
      emitLeftToolbarClick: function emitLeftToolbarClick(index) {
        this.childrenMap.leftToolbarSizer.emitButtonClick(index);
        return this;
      },
      showChoice: function showChoice(index) {
        var choicesSizer = this.childrenMap.choicesSizer;
  
        if (choicesSizer) {
          choicesSizer.showButton(index);
        }
  
        return this;
      },
      showAction: function showAction(index) {
        this.childrenMap.actionsSizer.showButton(index);
        return this;
      },
      showToolbar: function showToolbar(index) {
        this.childrenMap.toolbarSizer.showButton(index);
        return this;
      },
      showLeftToolbar: function showLeftToolbar(index) {
        this.childrenMap.leftToolbarSizer.showButton(index);
        return this;
      },
      hideChoice: function hideChoice(index) {
        var choicesSizer = this.childrenMap.choicesSizer;
  
        if (choicesSizer) {
          choicesSizer.hideButton(index);
        }
  
        return this;
      },
      hideAction: function hideAction(index) {
        this.childrenMap.actionsSizer.hideButton(index);
        return this;
      },
      hideToolbar: function hideToolbar(index) {
        this.childrenMap.toolbarSizer.hideButton(index);
        return this;
      },
      hideLeftToolbar: function hideLeftToolbar(index) {
        this.childrenMap.leftToolbarSizer.hideButton(index);
        return this;
      },
      addChoice: function addChoice(gameObject) {
        var choicesSizer = this.childrenMap.choicesSizer;
  
        if (choicesSizer) {
          choicesSizer.addButton(gameObject);
        }
  
        return this;
      },
      addAction: function addAction(gameObject) {
        this.childrenMap.actionsSizer.addButton(gameObject);
        return this;
      },
      addToolbar: function addToolbar(gameObject) {
        this.childrenMap.toolbarSizer.addButton(gameObject);
        return this;
      },
      addLeftToolbar: function addLeftToolbar(gameObject) {
        this.childrenMap.leftToolbarSizer.addButton(gameObject);
        return this;
      },
      removeChoice: function removeChoice(index, destroyChild) {
        var choicesSizer = this.childrenMap.choicesSizer;
  
        if (choicesSizer) {
          choicesSizer.removeButton(index, destroyChild);
        }
  
        return this;
      },
      removeAction: function removeAction(index, destroyChild) {
        this.childrenMap.actionsSizer.removeButton(index, destroyChild);
        return this;
      },
      removeToolbar: function removeToolbar(index, destroyChild) {
        this.childrenMap.toolbarSizer.removeButton(index, destroyChild);
        return this;
      },
      removeLeftToolbar: function removeLeftToolbar(index, destroyChild) {
        this.childrenMap.leftToolbarSizer.removeButton(index, destroyChild);
        return this;
      },
      clearChoices: function clearChoices(destroyChild) {
        var choicesSizer = this.childrenMap.choicesSizer;
  
        if (choicesSizer) {
          choicesSizer.clearButtons(destroyChild);
        }
  
        return this;
      },
      clearActions: function clearActions(destroyChild) {
        this.childrenMap.actionsSizer.clearButtons(destroyChild);
        return this;
      },
      clearToolbar: function clearToolbar(destroyChild) {
        this.childrenMap.toolbarSizer.clearButtons(destroyChild);
        return this;
      },
      clearLeftToolbar: function clearLeftToolbar(destroyChild) {
        this.childrenMap.leftToolbarSizer.clearButtons(destroyChild);
        return this;
      },
      forEachChoice: function forEachChoice(callback, scope) {
        var choicesSizer = this.childrenMap.choicesSizer;
  
        if (choicesSizer) {
          choicesSizer.forEachButtton(callback, scope);
        }
  
        return this;
      },
      forEachAction: function forEachAction(callback, scope) {
        this.childrenMap.actionsSizer.forEachButtton(callback, scope);
        return this;
      },
      forEachToolbar: function forEachToolbar(callback, scope) {
        this.childrenMap.toolbarSizer.forEachButtton(callback, scope);
        return this;
      },
      forEachLeftToolbar: function forEachLeftToolbar(callback, scope) {
        this.childrenMap.leftToolbarSizer.forEachButtton(callback, scope);
        return this;
      },
      setAllButtonsEnable: function setAllButtonsEnable(enabled) {
        if (enabled === undefined) {
          enabled = true;
        }
  
        if (this.childrenMap.toolbarSizer) {
          this.setToolbarEnable(enabled);
        }
  
        if (this.childrenMap.leftToolbarSizer) {
          this.setLeftToolbarEnable(enabled);
        }
  
        if (this.childrenMap.actionsSizer) {
          this.setActionEnable(enabled);
        }
  
        if (this.childrenMap.choicesSizer) {
          this.setChoiceEnable(enabled);
        }
  
        return this;
      },
      // Checkboxes
      getChoicesButtonStates: function getChoicesButtonStates() {
        var choicesSizer = this.childrenMap.choicesSizer;
  
        if (choicesSizer) {
          return choicesSizer.getAllButtonsState();
        } else {
          return {};
        }
      },
      getChoicesButtonState: function getChoicesButtonState(name) {
        var choicesSizer = this.childrenMap.choicesSizer;
  
        if (name === undefined) {
          if (choicesSizer) {
            return choicesSizer.getAllButtonsState();
          } else {
            return {};
          }
        } else {
          if (choicesSizer) {
            return choicesSizer.getButtonState(name);
          } else {
            return false;
          }
        }
      },
      setChoicesButtonState: function setChoicesButtonState(name, state) {
        var choicesSizer = this.childrenMap.choicesSizer;
  
        if (choicesSizer) {
          choicesSizer.setButtonState(name, state);
        }
  
        return this;
      },
      clearChoicesButtonStates: function clearChoicesButtonStates() {
        var choicesSizer = this.childrenMap.choicesSizer;
  
        if (choicesSizer) {
          choicesSizer.clearAllButtonsState();
        }
  
        return this;
      },
      // Radio buttons
      getChoicesSelectedButtonName: function getChoicesSelectedButtonName() {
        var choicesSizer = this.childrenMap.choicesSizer;
  
        if (choicesSizer) {
          return choicesSizer.getSelectedButtonName();
        } else {
          return '';
        }
      },
      setChoicesSelectedButtonName: function setChoicesSelectedButtonName(name) {
        var choicesSizer = this.childrenMap.choicesSizer;
  
        if (choicesSizer) {
          choicesSizer.setSelectedButtonName(name);
        }
  
        return this;
      }
    };
  
    var GetValue = Phaser.Utils.Objects.GetValue;
  
    var Dialog = /*#__PURE__*/function (_Sizer) {
      _inherits(Dialog, _Sizer);
  
      var _super = _createSuper(Dialog);
  
      function Dialog(scene, config) {
        var _this;
  
        _classCallCheck(this, Dialog);
  
        if (config === undefined) {
          config = {};
        } // Create sizer        
  
  
        config.orientation = 1; // Top to bottom
  
        _this = _super.call(this, scene, config);
        _this.type = 'rexDialog';
        _this.eventEmitter = GetValue(config, 'eventEmitter', _assertThisInitialized(_this)); // Add elements
  
        var background = GetValue(config, 'background', undefined);
        var title = GetValue(config, 'title', undefined);
        var toolbar = GetValue(config, 'toolbar', undefined);
        var toolbarBackground = GetValue(config, 'toolbarBackground', undefined);
        var leftToolbar = GetValue(config, 'leftToolbar', undefined);
        var leftToolbarBackground = GetValue(config, 'leftToolbarBackground', undefined);
        var content = GetValue(config, 'content', undefined);
        var description = GetValue(config, 'description', undefined);
        var choicesSizer;
        var choices = GetValue(config, 'choices', undefined);
        var choicesBackground = GetValue(config, 'choicesBackground', undefined);
        var actionsSizer;
        var actions = GetValue(config, 'actions', undefined);
        var actionsBackground = GetValue(config, 'actionsBackground', undefined);
        var clickConfig = GetValue(config, 'click', undefined);
  
        if (background) {
          _this.addBackground(background);
        }
  
        var toolbarSizer;
  
        if (toolbar) {
          toolbarSizer = new Buttons$1(scene, {
            groupName: 'toolbar',
            background: toolbarBackground,
            buttons: toolbar,
            orientation: 0,
            // Left-right
            space: {
              item: GetValue(config, 'space.toolbarItem', 0)
            },
            click: clickConfig,
            eventEmitter: _this.eventEmitter
          });
        }
  
        var leftToolbarSizer;
  
        if (leftToolbar) {
          leftToolbarSizer = new Buttons$1(scene, {
            groupName: 'leftToolbar',
            background: leftToolbarBackground,
            buttons: leftToolbar,
            orientation: 0,
            // Left-right
            space: {
              item: GetValue(config, 'space.leftToolbarItem', 0)
            },
            click: clickConfig,
            eventEmitter: _this.eventEmitter
          });
        } // title only
  
  
        if (title && !toolbar && !leftToolbar) {
          var align = GetValue(config, 'align.title', 'center');
          var titleSpace = GetValue(config, 'space.title', 0);
          var padding;
  
          if (content || description || choices || actions) {
            padding = {
              bottom: titleSpace
            };
          }
  
          var expand = GetValue(config, 'expand.title', true);
  
          _this.add(title, {
            align: align,
            padding: padding,
            expand: expand
          });
        } // toolbar only
  
  
        if (toolbar && !title && !leftToolbar) {
          var titleSpace = GetValue(config, 'space.title', 0);
          var padding;
  
          if (content || description || choices || actions) {
            padding = {
              bottom: titleSpace
            };
          }
  
          var expand = GetValue(config, 'expand.toolbar', true);
  
          _this.add(toolbarSizer, {
            align: 'right',
            padding: padding,
            expand: expand
          });
        } // leftToolbar only
  
  
        if (leftToolbar && !title && !toolbar) {
          var titleSpace = GetValue(config, 'space.title', 0);
          var padding;
  
          if (content || description || choices || actions) {
            padding = {
              bottom: titleSpace
            };
          }
  
          var expand = GetValue(config, 'expand.leftToolbar', true);
  
          _this.add(leftToolbarSizer, {
            align: 'left',
            padding: padding,
            expand: expand
          });
        } // tilte and (toolbar or leftToolbar)
  
  
        if (title && (toolbar || leftToolbar)) {
          var titleSizer = new Sizer(scene, {
            orientation: 0
          }); // Add leftToolbar
  
          if (leftToolbarSizer) {
            titleSizer.add(leftToolbarSizer, {
              align: 'right',
              expand: false
            });
          } // Add title
  
  
          var align = GetValue(config, 'align.title', 'left');
          var expand = GetValue(config, 'expand.title', true); // Add space if not expand
  
          if (!expand && (align === 'right' || align === 'center')) {
            titleSizer.addSpace();
          }
  
          var padding = {
            left: GetValue(config, 'space.titleLeft', 0),
            right: GetValue(config, 'space.titleRight', 0)
          };
          var proportion = expand ? 1 : 0;
          titleSizer.add(title, {
            proportion: proportion,
            align: 'center',
            padding: padding,
            expand: expand
          }); // Add space if not expand
  
          if (!expand && (align === 'left' || align === 'center')) {
            titleSizer.addSpace();
          } // Add toolbar
  
  
          if (toolbarSizer) {
            titleSizer.add(toolbarSizer, {
              align: 'right',
              expand: false
            });
          } // Add sizer to dialog
  
  
          var titleSpace = GetValue(config, 'space.title', 0);
          var padding;
  
          if (content || description || choices || actions) {
            padding = {
              bottom: titleSpace
            };
          }
  
          _this.add(titleSizer, {
            align: 'center',
            padding: padding,
            expand: true
          });
        }
  
        if (content) {
          var align = GetValue(config, 'align.content', 'center');
          var contentSpace = GetValue(config, 'space.content', 0);
          var padding = {
            left: GetValue(config, 'space.contentLeft', 0),
            right: GetValue(config, 'space.contentRight', 0),
            bottom: description || choices || actions ? contentSpace : 0
          };
          var expand = GetValue(config, 'expand.content', true);
  
          _this.add(content, {
            align: align,
            padding: padding,
            expand: expand
          });
        }
  
        if (description) {
          var align = GetValue(config, 'align.description', 'center');
          var descriptionSpace = GetValue(config, 'space.description', 0);
          var padding = {
            left: GetValue(config, 'space.descriptionLeft', 0),
            right: GetValue(config, 'space.descriptionRight', 0),
            bottom: choices || actions ? descriptionSpace : 0
          };
          var expand = GetValue(config, 'expand.description', true);
  
          _this.add(description, {
            align: align,
            padding: padding,
            expand: expand
          });
        }
  
        if (choices) {
          var choicesType = GetValue(config, 'choicesType', '').split('-');
          var ButtonsClass = Contains(choicesType, 'wrap') ? Buttons : Contains(choicesType, 'grid') ? GridButtons : Buttons$1;
          var buttonsType = Contains(choicesType, 'radio') ? 'radio' : Contains(choicesType, 'checkboxes') ? 'checkboxes' : undefined;
          var space = {
            left: GetValue(config, 'space.choicesBackgroundLeft', 0),
            right: GetValue(config, 'space.choicesBackgroundRight', 0),
            top: GetValue(config, 'space.choicesBackgroundTop', 0),
            bottom: GetValue(config, 'space.choicesBackgroundBottom', 0)
          };
          var itemSpace = GetValue(config, 'space.choice', 0);
  
          if (ButtonsClass === Buttons$1) {
            space.item = itemSpace;
          } else if (ButtonsClass === Buttons) {
            space.item = itemSpace;
            space.line = GetValue(config, 'space.choiceLine', itemSpace);
          } else {
            // GridButtons
            space.column = GetValue(config, 'space.choiceColumn', itemSpace);
            space.row = GetValue(config, 'space.choiceRow', itemSpace);
          }
  
          var choicesConfig = {
            width: GetValue(config, 'choicesWidth', undefined),
            height: GetValue(config, 'choicesHeight', undefined),
            groupName: 'choices',
            buttonsType: buttonsType,
            background: choicesBackground,
            buttons: choices,
            space: space,
            click: clickConfig,
            eventEmitter: _this.eventEmitter,
            setValueCallback: GetValue(config, 'choicesSetValueCallback', undefined),
            setValueCallbackScope: GetValue(config, 'choicesSetValueCallbackScope', undefined)
          };
  
          if (ButtonsClass === Buttons$1) {
            choicesConfig.orientation = Contains(choicesType, 'x') ? 0 : 1;
          }
  
          choicesSizer = new ButtonsClass(scene, choicesConfig);
          var choicesSpace = GetValue(config, 'space.choices', 0);
          var padding = {
            left: GetValue(config, 'space.choicesLeft', 0),
            right: GetValue(config, 'space.choicesRight', 0),
            bottom: actions ? choicesSpace : 0
          };
          var align = GetValue(config, 'align.choices', 'center');
          var expand = GetValue(config, 'expand.choices', true);
  
          _this.add(choicesSizer, {
            align: align,
            padding: padding,
            expand: expand
          });
        }
  
        if (actions) {
          actionsSizer = new Buttons$1(scene, {
            groupName: 'actions',
            background: actionsBackground,
            buttons: actions,
            orientation: 0,
            // Left-right
            space: {
              item: GetValue(config, 'space.action', 0)
            },
            expand: GetValue(config, 'expand.actions', false),
            align: GetValue(config, 'align.actions', 'center'),
            click: clickConfig,
            eventEmitter: _this.eventEmitter
          });
          var padding = {
            left: GetValue(config, 'space.actionsLeft', 0),
            right: GetValue(config, 'space.actionsRight', 0)
          };
  
          _this.add(actionsSizer, {
            align: 'center',
            padding: padding,
            expand: true
          });
        }
  
        _this.addChildrenMap('background', background);
  
        _this.addChildrenMap('title', title);
  
        _this.addChildrenMap('toolbar', toolbar);
  
        _this.addChildrenMap('leftToolbar', leftToolbar);
  
        _this.addChildrenMap('content', content);
  
        _this.addChildrenMap('description', description);
  
        _this.addChildrenMap('choices', choices);
  
        _this.addChildrenMap('actions', actions);
  
        _this.addChildrenMap('choicesSizer', choicesSizer);
  
        _this.addChildrenMap('actionsSizer', actionsSizer);
  
        _this.addChildrenMap('toolbarSizer', toolbarSizer);
  
        _this.addChildrenMap('leftToolbarSizer', leftToolbarSizer);
  
        return _this;
      }
  
      return _createClass(Dialog);
    }(Sizer);
  
    var Contains = function Contains(arr, item) {
      return arr.indexOf(item) !== -1;
    };
  
    Object.assign(Dialog.prototype, ButtonMethods);
  
    return Dialog;
  
  }));
  