"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=require("./types.js");function _(t){return C(t)||R(t)||S(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 S(t,u){if(!!t){if(typeof t=="string")return g(t,u);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 g(t,u)}}function R(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function C(t){if(Array.isArray(t))return g(t)}function g(t,u){(u==null||u>t.length)&&(u=t.length);for(var r=0,i=new Array(u);r<u;r++)i[r]=t[r];return i}function D(t,u){if(!(t instanceof u))throw new TypeError("Cannot call a class as a function")}function b(t,u){for(var r=0;r<u.length;r++){var i=u[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function T(t,u,r){return u&&b(t.prototype,u),r&&b(t,r),t}function h(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?h=function(r){return typeof r}:h=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},h(t)}var x=w.COLOR_MODES_STANDARD.light,v=function(u){return u&&h(u)==="object"},c=function(u,r,i){for(var a=r.split("."),n=u;a.length;){var e=a.shift();if(n.hasOwnProperty(e)===!1)if(i&&n.hasOwnProperty(i)===!0&&n[i].hasOwnProperty(e)===!0)n[i][e]instanceof y?n=n[i][e].getValue(null,null,n,i):n=n[i][e];else return;else n[e]instanceof y?n=n[e].getValue(null,null,n,i):n=n[e]}return n},A=function(u,r,i){for(var a=r.split("."),n=a.pop(),e=u;a.length;){var o=a.shift();e.hasOwnProperty(o)===!1&&(e[o]={}),e=e[o]}return e[n]=i,!0},y=function(){function t(u){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];D(this,t),this.computer=u,this.dependencies=r}return T(t,[{key:"getValue",value:function(r){var i=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(i,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(i,s,n))!==null&&l!==void 0?l:c(r,s,n)}))}}]),t}();function j(t,u){return new y(t,u)}var L=function(u,r,i){var a={themeName:u.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 d=l?"".concat(l,".").concat(f):"".concat(f);if([].concat(_(Object.values(w.COLOR_MODES_STANDARD)),[i]).includes(f)){if(f!==i)return;var P=new RegExp("(\\.".concat(i,"\\b)|(\\b").concat(i,"\\.)"));d=d.replace(P,"")}var O=s&&c(a,d);if(!O||v(O)){var m=e[f]instanceof y?e[f].getValue(e.root,o.root,a,i):e[f],p=o[f]instanceof y?o[f].getValue(e.root,o.root,a,i):o[f];v(m)&&!Array.isArray(m)?n(m,p!=null?p:{},s,d):A(a,d,p!=null?p:m)}})}return n(u,r),n(r,{},!0),a},I=function(u,r){var i={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 v(l)&&!Array.isArray(l)?new Proxy({model:l,root:e.root,key:"_".concat(e.key)},i):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:u,root:u,key:r},i);return a};exports.Computed=y;exports.DEFAULT_COLOR_MODE=x;exports.buildTheme=I;exports.computed=j;exports.getComputed=L;exports.getOn=c;exports.setOn=A;
//# sourceMappingURL=utils.js.map
