"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue"),m=require("@aplus-frontend/antdv"),l=require("lodash-unified"),C=require("../utils/warning.js"),n=require("../utils/config-provider-preset.js"),P=require("./config-provider-props.js"),h=require("./constants.js"),p=require("./hooks/use-global-config.js");function T(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!r.isVNode(o)}const i=r.ref({}),b=r.defineComponent({name:"AplusConfigProvider",props:P.configProviderProps(),setup(o,{slots:c}){C.useDevWarning("ConfigProvider")(!o.uiMode,"breaking","uiMode has been remove, see migrate guide https://aplus.aplnk.com/aplus-ui/guide/migrate-7.2.html");function e(a,f){return o[a]??t.value?.[a]??f}const t=p.useGlobalConfig(),d=r.computed(()=>l.merge(l.cloneDeep(t.value?.aplusToken||{}),o.aplusToken)),g=r.computed(()=>l.merge({...t.value?.valueTypeMap??{}},o.valueTypeMap)),s=r.computed(()=>({namespace:e("namespace",h.DEFAULT_NAMESPACE),apGrid:e("apGrid"),agGrid:e("agGrid"),apProCard:e("apProCard"),apImage:e("apImage"),apTitle:e("apTitle"),searchForm:e("searchForm"),apUpload:e("apUpload"),apDescriptions:e("apDescriptions"),apFilePreview:e("apFilePreview"),apExportGroup:e("apExportGroup"),apView:e("apView"),aplusLocale:e("aplusLocale"),aplusToken:d.value,api:e("api"),valueTypeMap:g.value,downloadCenterTriggerConfig:e("downloadCenterTriggerConfig"),scrollYDomName:e("scrollYDomName"),viewCacheOption:e("viewCacheOption")})),v=p.provideGlobalConfig(s);let u=!0;return r.watch(()=>o,a=>{i.value=n.mergeAntdProviderConfigWithCache(n.mergeAntdProvideConfig(a),i.value)},{deep:!0,immediate:!0}),r.onActivated(()=>{if(u){u=!1;return}i.value=n.mergeAntdProviderConfigWithCache(n.mergeAntdProvideConfig(o),i.value)}),()=>{let a;return r.createVNode(m.ConfigProvider,i.value,T(a=r.renderSlot(c,"default",{config:v?.value}))?a:{default:()=>[a]})}}});exports.ConfigProvider=b;exports.globalConfigCached=i;
