import { COLOR_MODES_STANDARD as w } from "./types.js";
function A(t) {
  return S(t) || x(t) || _(t) || E();
}
function E() {
  throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
}
function _(t, i) {
  if (!!t) {
    if (typeof t == "string")
      return v(t, i);
    var r = Object.prototype.toString.call(t).slice(8, -1);
    if (r === "Object" && t.constructor && (r = t.constructor.name), r === "Map" || r === "Set")
      return Array.from(t);
    if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))
      return v(t, i);
  }
}
function x(t) {
  if (typeof Symbol < "u" && t[Symbol.iterator] != null || t["@@iterator"] != null)
    return Array.from(t);
}
function S(t) {
  if (Array.isArray(t))
    return v(t);
}
function v(t, i) {
  (i == null || i > t.length) && (i = t.length);
  for (var r = 0, u = new Array(i); r < i; r++)
    u[r] = t[r];
  return u;
}
function R(t, i) {
  if (!(t instanceof i))
    throw new TypeError("Cannot call a class as a function");
}
function b(t, i) {
  for (var r = 0; r < i.length; r++) {
    var u = i[r];
    u.enumerable = u.enumerable || !1, u.configurable = !0, "value" in u && (u.writable = !0), Object.defineProperty(t, u.key, u);
  }
}
function C(t, i, r) {
  return i && b(t.prototype, i), r && b(t, r), t;
}
function d(t) {
  return typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? d = function(r) {
    return typeof r;
  } : d = function(r) {
    return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
  }, d(t);
}
var j = w.light, g = function(i) {
  return i && d(i) === "object";
}, c = function(i, r, u) {
  for (var a = r.split("."), n = i; a.length; ) {
    var e = a.shift();
    if (n.hasOwnProperty(e) === !1)
      if (u && n.hasOwnProperty(u) === !0 && n[u].hasOwnProperty(e) === !0)
        n[u][e] instanceof h ? n = n[u][e].getValue(null, null, n, u) : n = n[u][e];
      else
        return;
    else
      n[e] instanceof h ? n = n[e].getValue(null, null, n, u) : n = n[e];
  }
  return n;
}, T = function(i, r, u) {
  for (var a = r.split("."), n = a.pop(), e = i; a.length; ) {
    var o = a.shift();
    e.hasOwnProperty(o) === !1 && (e[o] = {}), e = e[o];
  }
  return e[n] = u, !0;
}, h = /* @__PURE__ */ function() {
  function t(i) {
    var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
    R(this, t), this.computer = i, this.dependencies = r;
  }
  return C(t, [{
    key: "getValue",
    value: function(r) {
      var u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = arguments.length > 2 ? arguments[2] : void 0, n = arguments.length > 3 ? arguments[3] : void 0;
      if (!this.dependencies.length)
        return this.computer(a);
      if (!Array.isArray(this.dependencies)) {
        var e, o;
        return this.computer((e = (o = c(a, this.dependencies)) !== null && o !== void 0 ? o : c(u, this.dependencies, n)) !== null && e !== void 0 ? e : c(r, this.dependencies, n));
      }
      return this.computer(this.dependencies.map(function(s) {
        var l, f;
        return (l = (f = c(a, s)) !== null && f !== void 0 ? f : c(u, s, n)) !== null && l !== void 0 ? l : c(r, s, n);
      }));
    }
  }]), t;
}();
function I(t, i) {
  return new h(t, i);
}
var k = function(i, r, u) {
  var a = {
    themeName: i.key
  };
  function n(e, o) {
    var s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, l = arguments.length > 3 ? arguments[3] : void 0;
    Object.keys(e).forEach(function(f) {
      var y = l ? "".concat(l, ".").concat(f) : "".concat(f);
      if ([].concat(A(Object.values(w)), [u]).includes(f)) {
        if (f !== u)
          return;
        var P = new RegExp("(\\.".concat(u, "\\b)|(\\b").concat(u, "\\.)"));
        y = y.replace(P, "");
      }
      var O = s && c(a, y);
      if (!O || g(O)) {
        var m = e[f] instanceof h ? e[f].getValue(e.root, o.root, a, u) : e[f], p = o[f] instanceof h ? o[f].getValue(e.root, o.root, a, u) : o[f];
        g(m) && !Array.isArray(m) ? n(m, p != null ? p : {}, s, y) : T(a, y, p != null ? p : m);
      }
    });
  }
  return n(i, r), n(r, {}, !0), a;
}, K = function(i, r) {
  var u = {
    getPrototypeOf: function(e) {
      return Reflect.getPrototypeOf(e.model);
    },
    setPrototypeOf: function(e, o) {
      return Reflect.setPrototypeOf(e.model, o);
    },
    isExtensible: function(e) {
      return Reflect.isExtensible(e);
    },
    preventExtensions: function(e) {
      return Reflect.preventExtensions(e.model);
    },
    getOwnPropertyDescriptor: function(e, o) {
      return Reflect.getOwnPropertyDescriptor(e.model, o);
    },
    defineProperty: function(e, o, s) {
      return Reflect.defineProperty(e.model, o, s);
    },
    has: function(e, o) {
      return Reflect.has(e.model, o);
    },
    get: function(e, o) {
      if (o === "key")
        return e[o];
      if (o === "__proto__")
        return {};
      var s = o === "root" ? e : e.model || e, l = s[o];
      return g(l) && !Array.isArray(l) ? new Proxy({
        model: l,
        root: e.root,
        key: "_".concat(e.key)
      }, u) : l;
    },
    set: function(e) {
      return e;
    },
    deleteProperty: function(e) {
      return e;
    },
    ownKeys: function(e) {
      return Reflect.ownKeys(e.model);
    },
    apply: function(e) {
      return e;
    },
    construct: function(e) {
      return e;
    }
  }, a = new Proxy({
    model: i,
    root: i,
    key: r
  }, u);
  return a;
};
export {
  h as Computed,
  j as DEFAULT_COLOR_MODE,
  K as buildTheme,
  I as computed,
  k as getComputed,
  c as getOn,
  T as setOn
};
//# sourceMappingURL=utils.js.map
