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