createArrayProxy(array, path) {
      Logger.debug(`Creating reactive array with path ${path} for`, array);
      return new Proxy(array, {
        get: (target, prop) => {
          if (typeof prop === "symbol") {
            return target[prop];
          }
          const value = target[prop];
          if (typeof value === "function" && ["push", "pop", "shift", "unshift", "splice", "sort", "reverse"].includes(prop)) {
            return (...args) => {
              const oldValue = [...target];
              const result = target[prop].apply(target, args);
              const context = {
                prop: path,
                oldValue,
                newValue: target,
                method: prop,
                args,
                preventDefault: false
              };
              this.middleware.process(context).then(() => {
                if (!context.preventDefault) {
                  this.emit("arrayChange", {
                    path,
                    method: prop,
                    args,
                    oldValue,
                    newValue: target
                  });
                  this.emit("change", {
                    path,
                    oldValue,
                    newValue: target,
                    method: prop,
                    args
                  });
                  if (this.watchers.has(path)) {
                    this.watchers.get(path).forEach((callback) => {
                      callback(target, oldValue);
                    });
                  }
                }
              });
              return result;
            };
          }
          if (typeof prop !== "symbol" && !isNaN(Number(prop))) {
            if (value && typeof value === "object") {
              return this.createReactiveProxy(value, `${path}[${prop}]`);
            }
          }
          return value;
        },
        set: async (target, prop, value) => {
          if (typeof prop === "symbol") {
            target[prop] = value;
            return true;
          }
          const fullPath = path ? `${path}.${prop}` : prop;
          const oldValue = target[prop];
          if (oldValue === value) {
            return true;
          }
          if (this.validators?.has(fullPath)) {
            const isValid = this.validators.get(fullPath)(value);
            if (!isValid) return false;
          }
          if (this.formatters?.has(fullPath)) {
            value = this.formatters.get(fullPath)(value);
          }
          target[prop] = value;
          if (value && typeof value === "object") {
            value = this.createReactiveProxy(value, `${path}[${prop}]`);
          }
          const context = {
            prop,
            oldValue,
            newValue: value,
            preventDefault: false
          };
          await this.middleware.process(context);
          if (context.preventDefault) {
            return true;
          }
          target[prop] = value;
          this.middleware.process(context).then(() => {
            if (!context.preventDefault) {
              this.emit("arrayChange", {
                path: fullPath,
                method: null,
                args: null,
                oldValue,
                newValue: value
              });
              this.emit("change", {
                path: fullPath,
                oldValue,
                newValue: value,
                arrayIndex: Number(prop)
              });
              if (this.watchers.has(fullPath)) {
                this.watchers.get(fullPath).forEach((callback) => {
                  callback(value, oldValue);
                });
              }
            }
          });
          return true;
        }
      });
    }
Creates a reactive proxy for an array.
The proxy intercepts standard array methods (for example, push, pop, shift, etc.)
to enable detection and reaction to structural changes in the array.
It also ensures that array elements are made reactive.

@param {Array} array - The array to be proxied.
@param {string} path - The path to the current property in the state tree.

@returns {Proxy} A proxy that wraps the given array to make it reactive.