/*!
Copyright (c) 2026 Lenovo SSG BASD. All rights reserved.
@license Proprietary

This software is the confidential and proprietary property of Lenovo SSG BASD.
You shall not disclose such Confidential Information and shall use it only in
accordance with the terms of the license agreement.

--- Build Info ---
Version: 1.1.1
Build Time: 2026/2/26 17:21:00
Build Commit: 81e556ed827e2f043668506dae6fae8dbb9ef395
*/
import{getCurrentInstance as o,provide as e,computed as n,unref as i,inject as s,ref as r}from"vue";import{deepMerge as t}from"@gsc-basic/utils";import{useLocale as l}from"../../hooks/useLocale.js";import{configProviderContextKey as u,localeContextKey as a,zIndexContextKey as c,sizeInjectionKey as v,defaultInitialZIndex as d}from"./constants.js";const f=r();function p(e,i=void 0){const r=o()?s(u,f):f;return e?n(()=>r.value?.[e]??i):r}function m(o){const e=p(),s=l(n(()=>e.value?.locale)),r=n(()=>i(o)||e.value?.size||"");return z(n(()=>i(e)||{})),{locale:s,zIndex:e.value?.zIndex||d,size:r}}const z=(s,r,l=!1)=>{const d=!!o(),m=d?p():void 0,z=r?.provide??(d?e:void 0);if(!z)return void console.warn("provideGlobalConfig","provideGlobalConfig() can only be used inside setup().");const b=n(()=>{const o=i(s);return m?.value?t(m.value,o):o});return z(u,b),z(a,n(()=>i(b).locale)),z(c,n(()=>i(b).zIndex)),z(v,{size:n(()=>i(b).size||"")}),!l&&f.value||(f.value=i(b)),b};export{z as provideGlobalConfig,m as useGlobalComponentSettings,p as useGlobalConfig};