System.register(["__unresolved_0", "cc", "__unresolved_1"], function (_export, _context) {
  "use strict";

  var _reporterNs, _cclegacy, State, _crd, BtNode;

  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); 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 _reportPossibleCrUseOfState(extras) {
    _reporterNs.report("State", "./BtConst", _context.meta, extras);
  }

  function _reportPossibleCrUseOfComposite(extras) {
    _reporterNs.report("Composite", "./Composite/Composite", _context.meta, extras);
  }

  function _reportPossibleCrUseOfContainer(extras) {
    _reporterNs.report("Container", "./Container", _context.meta, extras);
  }

  function _reportPossibleCrUseOfRoot(extras) {
    _reporterNs.report("Root", "./Decorator/Root", _context.meta, extras);
  }

  return {
    setters: [function (_unresolved_) {
      _reporterNs = _unresolved_;
    }, function (_cc) {
      _cclegacy = _cc.cclegacy;
    }, function (_unresolved_2) {
      State = _unresolved_2.State;
    }],
    execute: function () {
      _crd = true;

      _cclegacy._RF.push({}, "fc7986LmghGh51KLcu0X7N7", "BtNode", undefined);

      _export("BtNode", BtNode = /*#__PURE__*/function () {
        function BtNode(name) {
          _defineProperty(this, "currentState", (_crd && State === void 0 ? (_reportPossibleCrUseOfState({
            error: Error()
          }), State) : State).INACTIVE);

          _defineProperty(this, "RootNode", void 0);

          _defineProperty(this, "parentNode", void 0);

          _defineProperty(this, "name", void 0);

          this.name = name;
        }

        var _proto = BtNode.prototype;

        // virtual
        _proto.SetRoot = function SetRoot(rootNode) {
          this.RootNode = rootNode;
        };

        _proto.SetParent = function SetParent(parent) {
          this.parentNode = parent;
        };

        _proto.Start = function Start() {
          this.currentState = (_crd && State === void 0 ? (_reportPossibleCrUseOfState({
            error: Error()
          }), State) : State).ACTIVE;
          this.DoStart();
        };

        _proto.Stop = function Stop() {
          this.currentState = (_crd && State === void 0 ? (_reportPossibleCrUseOfState({
            error: Error()
          }), State) : State).STOP_REQUESTED;
          this.DoStop();
        } // virtual
        /// THIS ABSOLUTLY HAS TO BE THE LAST CALL IN YOUR FUNCTION, NEVER MODIFY
        /// ANY STATE AFTER CALLING Stopped !!!!
        ;

        _proto.Stopped = function Stopped(success) {
          this.currentState = (_crd && State === void 0 ? (_reportPossibleCrUseOfState({
            error: Error()
          }), State) : State).INACTIVE;

          if (this.ParentNode != null) {
            this.ParentNode.ChildStopped(this, success);
          }
        } // virtual
        ;

        _proto.DoStart = function DoStart() {} // virtual
        ;

        _proto.DoStop = function DoStop() {} // virtual
        ;

        _proto.ParentCompositeStopped = function ParentCompositeStopped(composite) {
          this.DoParentCompositeStopped(composite);
        } // virtual
        /// THIS IS CALLED WHILE YOU ARE INACTIVE, IT's MEANT FOR DECORATORS TO REMOVE ANY PENDING
        /// OBSERVERS
        ;

        _proto.DoParentCompositeStopped = function DoParentCompositeStopped(composite) {/// be careful with this! // 但是我没有用过，嘿嘿 by liuchen.
        };

        _proto.GetPath = function GetPath() {
          if (this.ParentNode != null) {
            return this.ParentNode.GetPath() + "/" + this.name;
          } else {
            return this.name;
          }
        };

        _createClass(BtNode, [{
          key: "CurrentState",
          get: function get() {
            return this.currentState;
          }
        }, {
          key: "ParentNode",
          get: function get() {
            return this.parentNode;
          }
        }, {
          key: "IsStopRequested",
          get: function get() {
            return this.currentState == (_crd && State === void 0 ? (_reportPossibleCrUseOfState({
              error: Error()
            }), State) : State).STOP_REQUESTED;
          }
        }, {
          key: "IsActive",
          get: function get() {
            return this.currentState == (_crd && State === void 0 ? (_reportPossibleCrUseOfState({
              error: Error()
            }), State) : State).ACTIVE;
          }
        }, {
          key: "Clock",
          get: function get() {
            return this.RootNode.Clock;
          }
        }]);

        return BtNode;
      }());

      _cclegacy._RF.pop();

      _crd = false;
    }
  };
});
//# sourceMappingURL=BtNode.js.map