import*as e from"react";import n,{PrimeReactContext as t}from"primereact/api";import{ComponentBase as r,useHandleStyle as o}from"primereact/componentbase";import{useMergeProps as l,useMountEffect as c,useUpdateEffect as i,useUnmountEffect as u}from"primereact/hooks";import{Portal as a}from"primereact/portal";import{classNames as s,DomHandler as f,ZIndexUtils as p,ObjectUtils as m}from"primereact/utils";function b(){return b=Object.assign?Object.assign.bind():function(e){for(var n=1;ne.length)&&(n=e.length);for(var t=0,r=Array(n);t0?U.current.addEventListener("animationend",(function(){_()})):_()},_=function(){p.clear(U.current),N(!1),P.fullScreen&&(f.unblockBodyScroll(),C.current&&C.current.focus()),P.onUnblocked&&P.onUnblocked()},H=function(){if(P.fullScreen&&(f.blockBodyScroll(),C.current&&C.current.blur()),P.autoZIndex){var e=P.fullScreen?"modal":"overlay";p.set(e,U.current,O&&O.autoZIndex||n.autoZIndex,P.baseZIndex||O&&O.zIndex[e]||n.zIndex[e])}P.onBlocked&&P.onBlocked()};c((function(){B&&M()})),i((function(){P.blocked?M():z()}),[P.blocked]),u((function(){P.fullScreen&&f.unblockBodyScroll(),p.clear(U.current)})),e.useImperativeHandle(y,(function(){return{props:P,block:M,unblock:z,getElement:function(){return A.current}}}));var J=function(){if(B){var n=P.fullScreen?document.body:"self",t=k({className:s(P.className,R("mask")),style:w(w({},P.style),{},{position:P.fullScreen?"fixed":"absolute",top:"0",left:"0",width:"100%",height:"100%"})},D("mask")),r=P.template?m.getJSXElement(P.template,P):null,o=e.createElement("div",b({ref:U},t),r);return e.createElement(a,{element:o,appendTo:n,onMounted:H})}return null}(),L=k({id:P.id,ref:A,style:P.containerStyle,className:s(P.containerClassName,R("root")),"aria-busy":P.blocked},x.getOtherProps(P),D("root"));return e.createElement("div",L,P.children,J)}));I.displayName="BlockUI";export{I as BlockUI};