"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("@emotion/css"),f=require("lodash-unified"),e=require("vue"),k=require("../../design-token/constants.js"),y=require("../../utils/cssinjs/utils.js"),g=require("../constants.js"),q=require("./use-locale.js"),b=require("./use-namespace.js"),x=require("./use-token.js"),d=o=>Object.keys(o),a=e.ref();function p(o,n=void 0){const r=e.getCurrentInstance()?e.inject(g.configProviderContextKey,a):a;return o?e.computed(()=>r.value?.[o]??n):r}const T=(o,n,r=!1)=>{const c=!!e.getCurrentInstance(),t=c?p():void 0,u=n?.provide??(c?e.provide:void 0);if(!u)return;const s=e.computed(()=>{const i=e.unref(o);return t?.value?K(t.value,i):i});u(g.configProviderContextKey,s),u(q.localeContextKey,e.computed(()=>s.value.aplusLocale)),u(b.namespaceContextKey,s.value.namespace);const l=e.computed(()=>({...f.merge(f.cloneDeep(k.defaultToken),s.value.aplusToken||{})})),v=e.ref();return e.watch(()=>l.value,()=>{const i=f.omit(l.value,["components"]),C=y.generateCssVar(i,{uniqueId:!0,skipUnit:[]});v.value=m.css(C)},{deep:!0,immediate:!0}),u(x.designTokenContextKey,{token:l,rootCls:v}),(r||!a.value)&&(a.value=s.value),s},K=(o,n)=>{const r=[...new Set([...d(o),...d(n)])],c={};for(const t of r)c[t]=n[t]!==void 0?n[t]:o[t];return c};exports.keysOf=d;exports.provideGlobalConfig=T;exports.useGlobalConfig=p;
