const a="kingdee-modal",e="kingdee-alert",n="kingdee-confirm",l="kingdee-prompt",t="kingdee-overlay",r="kingdee-toast-container",o="kwc",s=9e3,u=1e4,c=2,i=1,y=Object.freeze({[t]:{pos:"absolute"},[a]:{pos:"absolute"},[e]:{pos:"absolute"},[n]:{pos:"absolute"},[l]:{pos:"absolute"},[r]:{pos:"fixed",maxNum:1,statName:"kwcToastContainerCount"}}),v="aura",k=9001,d=2,f={"ui:modal":{pos:"absolute"}},O={stack:[],callback:null,mixedOverlayPresent:!1,auraHighestZindex:9001,auraOverlayActive:!1,auraModalCount:0,auraAllOverlayCount:0,kwcModalCount:0,kwcToastContainerCount:0,kwcOverlayCount:0,kwcAllOverlayCount:0};function w(){O.callback&&O.kwcAllOverlayCount>0&&O.callback(O)}function C(a,e,n){const l={};if(!a||!e||(a!==o||a!==v)&&"string"!=typeof e)return null;if(l.overlayEngine=a,l.overlayType=e,n){const{zIndex:a,id:e,index:t}=n,r={};if(void 0!==a||null!==a){const e=parseInt(a,10);!Number.isNaN(e)&&(r.zIndex=e)}e&&"string"==typeof e&&(r.id=e),(void 0!==t||null!==t&&"number"==typeof t)&&(r.index=t),l.overlayDetails=r}return l}function g(){if(0===O.stack.length)m(),b();else{!function(a){a&&(a.hasAura?(O.auraModalCount=a.auraModals,O.auraOverlayCount=a.auraOverlays,O.auraAllOverlayCount=a.auraAllOverlays,O.auraOverlayActive=a.auraOverlayActive,a.auraHighestZIndex&&(O.auraHighestZindex=a.auraHighestZIndex)):m(),a.hasKwc?(O.kwcModalCount=a.kwcModals,O.kwcToastContainerCount=a.kwcToastContainers,O.kwcOverlayCount=a.kwcOverlays,O.kwcAllOverlayCount=a.kwcAllOverlays):b(),O.mixedOverlayPresent=a.hasKwc&&a.hasAura)}(function(){const e={hasKwc:!1,kwcOverlays:0,kwcAllOverlays:0,kwcModals:0,kwcToastContainers:0,hasAura:!1,auraModals:0,auraOverlays:0,auraAllOverlays:0,auraOverlayActive:!1,auraHighestZIndex:null},n=O.stack.length;return O.stack.forEach(({overlayEngine:l,overlayType:t,overlayDetails:s},u)=>{const c=l===v;if(l===o){e.hasKwc||(e.hasKwc=!0);const n=!!y[t];if(t&&n){const n=t===r;t===a?e.kwcModals++:n?e.kwcToastContainers++:e.kwcOverlays++,e.kwcAllOverlays++}}if(c){if(e.hasAura||(e.hasAura=!0),t&&(f[t]?e.auraModals++:e.auraOverlays++,e.auraAllOverlays++),s&&s.zIndex){const{zIndex:a}=s,{auraHighestZIndex:n}=e;!isNaN(a)&&(!n||a>n)&&(e.auraHighestZIndex=a)}n===u+1&&(e.auraOverlayActive=!0)}}),e}())}}function h(a){let{overlayDetails:e}=a;const{overlayEngine:n,overlayType:l}=a;!(!a||!n||!l)&&(n===o||n===v)&&(e=function(a){const e={},n={id:"string",zIndex:"number",index:"number"};return a&&"object"==typeof a?(Object.entries(a).forEach(([a,l])=>{n[a]&&typeof l===n[a]&&(e[a]=l)}),e):e}(e),O.stack.push({overlayEngine:n,overlayType:l,overlayDetails:e}),g(),w())}function A(a){const e=O.stack.length,{overlayEngine:n,overlayDetails:l}=a;let t=null,r=null;if(0!==e&&!(!a||!n)&&(n===o||n===v)){if(l&&l.id&&(t=l.id),t)for(let a=e-1;a>-1;a--)if(O.stack[a]){const{overlayDetails:{id:e}}=O.stack[a];if(e&&e===t){r=a;break}}null!==r&&(O.stack.splice(r,1),g(),w())}}function p(a,e){O.callback=e,a&&w()}function x(a){return O&&O[a]?O[a]:null}function b(){O.kwcModalCount=0,O.kwcToastContainerCount=0,O.kwcOverlayCount=0,O.kwcAllOverlayCount=0}function m(){O.auraModalCount=0,O.auraOverlayCount=0,O.auraAllOverlayCount=0,O.auraHighestZindex=9001,O.auraOverlayActive=!1,O.auraOverlayPresent=!1}function M(){let e=!1;if(O.stack?.length>0){const n=O.stack[O.stack.length-1];e=n?.overlayEngine===o&&n?.overlayType===a}return e}export{v as AURA_OVERLAY_ENGINE,f as AURA_OVERLAY_TYPES,k as AURA_STARTING_ZINDEX,d as AURA_ZINDEX_INCREMENT,o as KWC_OVERLAY_ENGINE,s as KWC_OVERLAY_STARTING_ZINDEX,y as KWC_OVERLAY_TYPES,u as KWC_TOAST_CONTAINER_STARTING_ZINDEX,c as KWC_ZINDEX_INCREMENT,i as KWC_ZINDEX_OFFSET,r as TYPE_TOAST_CONTAINER,h as addOverlayToSharedState,x as getStatCount,M as isKwcModalActive,C as normalizeOverlayDetails,A as removeOverlayFromSharedState,p as subscribeOverlay};
