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

  var _reporterNs, _cclegacy, State, BtNode, _crd;

  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);
  }

  _export("BtNode", void 0);

  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 = class BtNode {
        constructor(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;
        }

        get CurrentState() {
          return this.currentState;
        }

        get ParentNode() {
          return this.parentNode;
        }

        get IsStopRequested() {
          return this.currentState == (_crd && State === void 0 ? (_reportPossibleCrUseOfState({
            error: Error()
          }), State) : State).STOP_REQUESTED;
        }

        get IsActive() {
          return this.currentState == (_crd && State === void 0 ? (_reportPossibleCrUseOfState({
            error: Error()
          }), State) : State).ACTIVE;
        }

        get Clock() {
          return this.RootNode.Clock;
        } // virtual


        SetRoot(rootNode) {
          this.RootNode = rootNode;
        }

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

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

        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 !!!!


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

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


        DoStart() {} // virtual


        DoStop() {} // virtual


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


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

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

      });

      _cclegacy._RF.pop();

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