primereact
Version:
PrimeReact is an open source UI library for React featuring a rich set of 90+ components, a theme designer, various theme alternatives such as Material, Bootstrap, Tailwind, premium templates and professional support. In addition, it integrates with Prime
2 lines (1 loc) • 24.5 kB
JavaScript
this.primereact=this.primereact||{},this.primereact.dialog=function(e,t,n,r,o,a,i,l,c,s,u,p){"use strict";function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function m(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var f=d(t),g=m(t),b=d(n);function h(){return h=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},h.apply(null,arguments)}function y(e){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},y(e)}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function x(e){if(Array.isArray(e))return v(e)}function O(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function w(e,t){if(e){if("string"==typeof e)return v(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?v(e,t):void 0}}function E(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function D(e,t){if("object"!=y(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=y(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}function S(e){var t=D(e,"string");return"symbol"==y(t)?t:t+""}function P(e,t,n){return(t=S(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function z(e){if(Array.isArray(e))return e}function I(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,l=[],c=!0,s=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(l.push(r.value),l.length!==t);c=!0);}catch(e){s=!0,o=e}finally{try{if(!c&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(s)throw o}}return l}}function j(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function k(e,t){return z(e)||I(e,t)||w(e,t)||j()}var R=r.ComponentBase.extend({defaultProps:{__TYPE:"FocusTrap",children:void 0},css:{styles:""},getProps:function(e){return i.ObjectUtils.getMergedProps(e,R.defaultProps)},getOtherProps:function(e){return i.ObjectUtils.getDiffProps(e,R.defaultProps)}});function C(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function H(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?C(Object(n),!0).forEach((function(t){P(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var _=f.default.memo(f.default.forwardRef((function(e,t){var r=f.default.useRef(null),o=f.default.useRef(null),l=f.default.useRef(null),c=f.default.useContext(n.PrimeReactContext),s=R.getProps(e,c),u={props:s};a.useStyle(R.css.styles,{name:"focustrap"});R.setMetaData(H({},u));f.default.useImperativeHandle(t,(function(){return{props:s,getInk:function(){return o.current},getTarget:function(){return r.current}}})),a.useMountEffect((function(){s.disabled||(r.current=h(),y(r.current))}));var p,d,m,g,b,h=function(){return o.current&&o.current.parentElement},y=function(e){var t=s||{},n=t.autoFocusSelector,r=t.firstFocusableSelector,o=void 0===r?"":r,a=t.autoFocus,l=void 0!==a&&a,c="".concat(v(void 0===n?"":n)),u="[autofocus]".concat(c,", [data-pc-autofocus='true']").concat(c),p=i.DomHandler.getFirstFocusableElement(e,u);l&&!p&&(p=i.DomHandler.getFirstFocusableElement(e,v(o))),i.DomHandler.focus(p)},v=function(e){return':not(.p-hidden-focusable):not([data-p-hidden-focusable="true"])'.concat(null!=e?e:"")},x=function(e){var t,n=e.currentTarget,o=e.relatedTarget,a=o!==n.$_pfocustrap_firsthiddenfocusableelement&&null!==(t=r.current)&&void 0!==t&&t.contains(o)?n.$_pfocustrap_firsthiddenfocusableelement:i.DomHandler.getLastFocusableElement(n.parentElement,v(n.$_pfocustrap_focusableselector));i.DomHandler.focus(a)};return d=void 0===(p=(s||{}).tabIndex)?0:p,g=(m=function(e,t,n){return f.default.createElement("span",{ref:e,className:"p-hidden-accessible p-hidden-focusable",tabIndex:d,role:"presentation","aria-hidden":!0,"data-p-hidden-accessible":!0,"data-p-hidden-focusable":!0,onFocus:t,"data-pc-section":n})})(o,(function(e){var t,n=e.currentTarget,o=e.relatedTarget,a=o!==n.$_pfocustrap_lasthiddenfocusableelement&&null!==(t=r.current)&&void 0!==t&&t.contains(o)?n.$_pfocustrap_lasthiddenfocusableelement:i.DomHandler.getFirstFocusableElement(n.parentElement,v(n.$_pfocustrap_focusableselector));i.DomHandler.focus(a)}),"firstfocusableelement"),b=m(l,x,"lastfocusableelement"),o.current&&l.current&&(o.current.$_pfocustrap_lasthiddenfocusableelement=l.current,l.current.$_pfocustrap_firsthiddenfocusableelement=o.current),f.default.createElement(f.default.Fragment,null,g,s.children,b)})));function N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function M(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?N(Object(n),!0).forEach((function(t){P(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var T=r.ComponentBase.extend({defaultProps:{__TYPE:"Dialog",__parentMetadata:null,appendTo:null,ariaCloseIconLabel:null,baseZIndex:0,blockScroll:!1,breakpoints:null,className:null,closable:!0,closeIcon:null,closeOnEscape:!0,content:null,contentClassName:null,contentStyle:null,dismissableMask:!1,draggable:!0,focusOnShow:!0,footer:null,footerClassName:null,header:null,headerClassName:null,headerStyle:null,icons:null,id:null,keepInViewport:!0,maskClassName:null,maskStyle:null,maximizable:!1,maximizeIcon:null,maximized:!1,minX:0,minY:0,minimizeIcon:null,modal:!0,onClick:null,onDrag:null,onDragEnd:null,onDragStart:null,onHide:null,onMaskClick:null,onMaximize:null,onResize:null,onResizeEnd:null,onResizeStart:null,onShow:null,position:"center",resizable:!0,rtl:!1,showHeader:!0,style:null,transitionOptions:null,visible:!1,children:void 0},css:{classes:{closeButtonIcon:"p-dialog-header-close-icon",closeButton:"p-dialog-header-icon p-dialog-header-close p-link",maximizableIcon:"p-dialog-header-maximize-icon",maximizableButton:"p-dialog-header-icon p-dialog-header-maximize p-link",header:function(e){return i.classNames("p-dialog-header",e.props.headerClassName)},headerTitle:"p-dialog-title",headerIcons:"p-dialog-header-icons",content:function(e){return i.classNames("p-dialog-content",e.props.contentClassName)},footer:function(e){return i.classNames("p-dialog-footer",e.props.footerClassName)},mask:function(e){var t=e.props,n=e.maskVisibleState,r=["center","left","right","top","top-left","top-right","bottom","bottom-left","bottom-right"].find((function(e){return e===t.position||e.replace("-","")===t.position}));return i.classNames("p-dialog-mask",r?"p-dialog-".concat(r):"",{"p-component-overlay p-component-overlay-enter":t.modal,"p-dialog-visible":n,"p-dialog-draggable":t.draggable,"p-dialog-resizable":t.resizable},t.maskClassName)},root:function(e){var t=e.maximized,n=e.context;return i.classNames("p-dialog p-component",{"p-dialog-rtl":e.props.rtl,"p-dialog-maximized":t,"p-dialog-default":!t,"p-input-filled":n&&"filled"===n.inputStyle||"filled"===b.default.inputStyle,"p-ripple-disabled":n&&!1===n.ripple||!1===b.default.ripple})},transition:"p-dialog"},styles:"\n@layer primereact {\n .p-dialog-mask {\n background-color: transparent;\n transition-property: background-color;\n }\n\n .p-dialog-visible {\n display: flex;\n }\n\n .p-dialog-mask.p-component-overlay {\n pointer-events: auto;\n }\n\n .p-dialog {\n display: flex;\n flex-direction: column;\n pointer-events: auto;\n max-height: 90%;\n transform: scale(1);\n position: relative;\n }\n\n .p-dialog-content {\n overflow-y: auto;\n flex-grow: 1;\n }\n\n .p-dialog-header {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n\n .p-dialog-footer {\n flex-shrink: 0;\n }\n\n .p-dialog .p-dialog-header-icons {\n display: flex;\n align-items: center;\n align-self: flex-start;\n flex-shrink: 0;\n }\n\n .p-dialog .p-dialog-header-icon {\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n position: relative;\n }\n\n .p-dialog .p-dialog-title {\n flex-grow: 1;\n }\n\n /* Fluid */\n .p-fluid .p-dialog-footer .p-button {\n width: auto;\n }\n\n /* Animation */\n /* Center */\n .p-dialog-enter {\n opacity: 0;\n transform: scale(0.7);\n }\n\n .p-dialog-enter-active {\n opacity: 1;\n transform: scale(1);\n transition: all 150ms cubic-bezier(0, 0, 0.2, 1);\n }\n\n .p-dialog-enter-done {\n transform: none;\n }\n\n .p-dialog-exit-active {\n opacity: 0;\n transform: scale(0.7);\n transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n /* Top, Bottom, Left, Right, Top* and Bottom* */\n .p-dialog-top .p-dialog,\n .p-dialog-bottom .p-dialog,\n .p-dialog-left .p-dialog,\n .p-dialog-right .p-dialog,\n .p-dialog-top-left .p-dialog,\n .p-dialog-top-right .p-dialog,\n .p-dialog-bottom-left .p-dialog,\n .p-dialog-bottom-right .p-dialog {\n margin: 0.75em;\n }\n\n .p-dialog-top .p-dialog-enter,\n .p-dialog-top .p-dialog-exit-active {\n transform: translate3d(0px, -100%, 0px);\n }\n\n .p-dialog-bottom .p-dialog-enter,\n .p-dialog-bottom .p-dialog-exit-active {\n transform: translate3d(0px, 100%, 0px);\n }\n\n .p-dialog-left .p-dialog-enter,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-enter,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-enter,\n .p-dialog-bottom-left .p-dialog-exit-active {\n transform: translate3d(-100%, 0px, 0px);\n }\n\n .p-dialog-right .p-dialog-enter,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-enter,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-enter,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transform: translate3d(100%, 0px, 0px);\n }\n\n .p-dialog-top .p-dialog-enter-active,\n .p-dialog-bottom .p-dialog-enter-active,\n .p-dialog-left .p-dialog-enter-active,\n .p-dialog-top-left .p-dialog-enter-active,\n .p-dialog-bottom-left .p-dialog-enter-active,\n .p-dialog-right .p-dialog-enter-active,\n .p-dialog-top-right .p-dialog-enter-active,\n .p-dialog-bottom-right .p-dialog-enter-active {\n transform: translate3d(0px, 0px, 0px);\n transition: all 0.3s ease-out;\n }\n\n .p-dialog-top .p-dialog-exit-active,\n .p-dialog-bottom .p-dialog-exit-active,\n .p-dialog-left .p-dialog-exit-active,\n .p-dialog-top-left .p-dialog-exit-active,\n .p-dialog-bottom-left .p-dialog-exit-active,\n .p-dialog-right .p-dialog-exit-active,\n .p-dialog-top-right .p-dialog-exit-active,\n .p-dialog-bottom-right .p-dialog-exit-active {\n transition: all 0.3s ease-out;\n }\n\n /* Maximize */\n .p-dialog-maximized {\n transition: none;\n transform: none;\n margin: 0;\n width: 100vw !important;\n height: 100vh !important;\n max-height: 100%;\n top: 0px !important;\n left: 0px !important;\n }\n\n .p-dialog-maximized .p-dialog-content {\n flex-grow: 1;\n }\n\n .p-confirm-dialog .p-dialog-content {\n display: flex;\n align-items: center;\n }\n\n /* Resizable */\n .p-dialog .p-resizable-handle {\n position: absolute;\n font-size: 0.1px;\n display: block;\n cursor: se-resize;\n width: 12px;\n height: 12px;\n right: 1px;\n bottom: 1px;\n }\n\n .p-dialog-draggable .p-dialog-header {\n cursor: move;\n }\n}\n",inlineStyles:{mask:function(e){var t=e.props;return M({position:"fixed",height:"100%",width:"100%",left:0,top:0,display:"flex",justifyContent:"left"===t.position||"top-left"===t.position||"bottom-left"===t.position?"flex-start":"right"===t.position||"top-right"===t.position||"bottom-right"===t.position?"flex-end":"center",alignItems:"top"===t.position||"top-left"===t.position||"top-right"===t.position?"flex-start":"bottom"===t.position||"bottom-left"===t.position||"bottom-right"===t.position?"flex-end":"center",pointerEvents:!t.modal&&"none"},t.maskStyle)}}}});function B(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function F(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?B(Object(n),!0).forEach((function(t){P(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var U=g.forwardRef((function(e,t){var d=a.useMergeProps(),m=g.useContext(n.PrimeReactContext),f=T.getProps(e,m),y=f.id?f.id:i.UniqueComponentId(),v=k(g.useState(y),2),D=v[0],S=k(g.useState(!1),2),P=S[0],z=S[1],I=k(g.useState(!1),2),j=I[0],R=I[1],C=k(g.useState(f.maximized),2),H=C[0],N=C[1],M=g.useRef(null),B=g.useRef(null),U=g.useRef(null),X=g.useRef(null),A=g.useRef(null),L=g.useRef(null),Y=g.useRef(null),$=g.useRef(!1),V=g.useRef(!1),Z=g.useRef(null),J=g.useRef(null),W=g.useRef(null),G=g.useRef(y),K=g.useRef(null),q=f.onMaximize?f.maximized:H,Q=j&&(f.blockScroll||f.maximizable&&q),ee=f.closable&&f.closeOnEscape&&j,te=a.useDisplayOrder("dialog",ee),ne=T.setMetaData(F(F({props:f},f.__parentMetadata),{},{state:{id:D,maximized:q,containerVisible:P}})),re=ne.ptm,oe=ne.cx,ae=ne.sx,ie=ne.isUnstyled;r.useHandleStyle(T.css.styles,ie,{name:"dialog"}),a.useGlobalOnEscapeKey({callback:function(e){ve(e)},when:ee&&te,priority:[a.ESC_KEY_HANDLING_PRIORITIES.DIALOG,te]});var le=k(a.useEventListener({type:"mousemove",target:function(){return window.document},listener:function(e){return Ie(e)}}),2),ce=le[0],se=le[1],ue=k(a.useEventListener({type:"mouseup",target:function(){return window.document},listener:function(e){return je(e)}}),2),pe=ue[0],de=ue[1],me=k(a.useEventListener({type:"mousemove",target:function(){return window.document},listener:function(e){return De(e)}}),2),fe=me[0],ge=me[1],be=k(a.useEventListener({type:"mouseup",target:function(){return window.document},listener:function(e){return Se(e)}}),2),he=be[0],ye=be[1],ve=function(e){f.onHide(e),e.preventDefault()},xe=function(e){U.current=e.target,f.onPointerDown&&f.onPointerDown(e)},Oe=function(e){f.dismissableMask&&f.modal&&B.current===e.target&&!U.current&&ve(e),f.onMaskClick&&f.onMaskClick(e),U.current=null},we=function(e){f.onMaximize?f.onMaximize({originalEvent:e,maximized:!q}):N((function(e){return!e})),e.preventDefault()},Ee=function(e){i.DomHandler.hasClass(e.target,"p-dialog-header-icon")||i.DomHandler.hasClass(e.target.parentElement,"p-dialog-header-icon")||f.draggable&&($.current=!0,Z.current=e.pageX,J.current=e.pageY,i.DomHandler.addClass(document.body,"p-unselectable-text"),f.onDragStart&&f.onDragStart(e))},De=function(e){if($.current){var t=i.DomHandler.getOuterWidth(M.current),n=i.DomHandler.getOuterHeight(M.current),r=e.pageX-Z.current,o=e.pageY-J.current,a=M.current.getBoundingClientRect(),l=a.left+r,c=a.top+o,s=i.DomHandler.getViewport(),u=getComputedStyle(M.current),p=parseFloat(u.marginLeft),d=parseFloat(u.marginTop);M.current.style.position="fixed",f.keepInViewport?(l>=f.minX&&l+t<s.width&&(Z.current=e.pageX,M.current.style.left=l-p+"px"),c>=f.minY&&c+n<s.height&&(J.current=e.pageY,M.current.style.top=c-d+"px")):(Z.current=e.pageX,M.current.style.left=l-p+"px",J.current=e.pageY,M.current.style.top=c-d+"px"),f.onDrag&&f.onDrag(e)}},Se=function(e){$.current&&($.current=!1,i.DomHandler.removeClass(document.body,"p-unselectable-text"),f.onDragEnd&&f.onDragEnd(e))},Pe=function(e){f.resizable&&(V.current=!0,Z.current=e.pageX,J.current=e.pageY,i.DomHandler.addClass(document.body,"p-unselectable-text"),f.onResizeStart&&f.onResizeStart(e))},ze=function(e,t,n){!n&&(n=i.DomHandler.getViewport());var r=parseInt(e);return/^(\d+|(\.\d+))(\.\d+)?%$/.test(e)?r*(n[t]/100):r},Ie=function(e){if(V.current){var t=e.pageX-Z.current,n=e.pageY-J.current,r=i.DomHandler.getOuterWidth(M.current),o=i.DomHandler.getOuterHeight(M.current),a=M.current.getBoundingClientRect(),l=i.DomHandler.getViewport(),c=!parseInt(M.current.style.top)||!parseInt(M.current.style.left),s=ze(M.current.style.minWidth,"width",l),u=ze(M.current.style.minHeight,"height",l),p=r+t,d=o+n;c&&(p+=t,d+=n),(!s||p>s)&&a.left+p<l.width&&(M.current.style.width=p+"px"),(!u||d>u)&&a.top+d<l.height&&(M.current.style.height=d+"px"),Z.current=e.pageX,J.current=e.pageY,f.onResize&&f.onResize(e)}},je=function(e){V.current&&(V.current=!1,i.DomHandler.removeClass(document.body,"p-unselectable-text"),f.onResizeEnd&&f.onResizeEnd(e))},ke=function(){M.current.style.position="",M.current.style.left="",M.current.style.top="",M.current.style.margin=""},Re=function(){M.current.setAttribute(G.current,"")},Ce=function(){var e;f.onShow&&f.onShow(),f.focusOnShow&&!((e=document.activeElement)&&M.current&&M.current.contains(e))&&f.closable&&f.showHeader&&Y.current&&Y.current.focus(),Ne()},He=function(){f.modal&&!ie()&&i.DomHandler.addClass(B.current,"p-component-overlay-leave")},_e=function(){$.current=!1,i.ZIndexUtils.clear(B.current),z(!1),Me(),i.DomHandler.focus(K.current),K.current=null},Ne=function(){Be()},Me=function(){Fe()},Te=function(e){if(e&&j){var t={id:D,hasBlockScroll:Q};document.primeDialogParams||(document.primeDialogParams=[]);var n=document.primeDialogParams.findIndex((function(e){return e.id===D}));document.primeDialogParams=-1===n?[].concat(x(r=document.primeDialogParams)||O(r)||w(r)||E(),[t]):document.primeDialogParams.toSpliced(n,1,t)}else document.primeDialogParams=document.primeDialogParams&&document.primeDialogParams.filter((function(e){return e.id!==D}));var r;document.primeDialogParams&&document.primeDialogParams.some((function(e){return e.hasBlockScroll}))?i.DomHandler.blockBodyScroll():i.DomHandler.unblockBodyScroll()},Be=function(){f.draggable&&(fe(),he()),f.resizable&&(ce(),pe())},Fe=function(){ge(),ye(),se(),de()},Ue=function(){W.current=i.DomHandler.createInlineStyle(m&&m.nonce||b.default.nonce,m&&m.styleContainer);var e="";for(var t in f.breakpoints)e+="\n @media screen and (max-width: ".concat(t,') {\n [data-pc-name="dialog"][').concat(G.current,"] {\n width: ").concat(f.breakpoints[t]," !important;\n }\n }\n ");W.current.innerHTML=e};a.useMountEffect((function(){Te(!0),f.visible&&z(!0)})),g.useEffect((function(){return f.breakpoints&&Ue(),function(){W.current=i.DomHandler.removeInlineStyle(W.current)}}),[f.breakpoints]),a.useUpdateEffect((function(){f.visible&&!P&&z(!0),f.visible!==j&&P&&R(f.visible),f.visible&&(K.current=document.activeElement)}),[f.visible,P]),a.useUpdateEffect((function(){P&&(i.ZIndexUtils.set("modal",B.current,m&&m.autoZIndex||b.default.autoZIndex,f.baseZIndex||m&&m.zIndex.modal||b.default.zIndex.modal),R(!0))}),[P]),a.useUpdateEffect((function(){Te(!0)}),[Q,j]),a.useUnmountEffect((function(){Me(),Te(!1),i.DomHandler.removeInlineStyle(W.current),i.ZIndexUtils.clear(B.current)})),g.useImperativeHandle(t,(function(){return{props:f,resetPosition:ke,getElement:function(){return M.current},getMask:function(){return B.current},getContent:function(){return X.current},getHeader:function(){return A.current},getFooter:function(){return L.current},getCloseButton:function(){return Y.current}}}));var Xe=function(){if(f.closable){var e=f.ariaCloseIconLabel||n.ariaLabel("close"),t=d({className:oe("closeButtonIcon"),"aria-hidden":!0},re("closeButtonIcon")),r=i.IconUtils.getJSXIcon(f.closeIcon||g.createElement(l.TimesIcon,t),F({},t),{props:f}),o=d({ref:Y,type:"button",className:oe("closeButton"),"aria-label":e,onClick:ve,onKeyDown:function(e){"Escape"!==e.key&&e.stopPropagation()}},re("closeButton"));return g.createElement("button",o,r,g.createElement(p.Ripple,null))}return null},Ae=function(){var e=d({className:oe("maximizableIcon")},re("maximizableIcon")),t=i.IconUtils.getJSXIcon(q?f.minimizeIcon||g.createElement(s.WindowMinimizeIcon,e):f.maximizeIcon||g.createElement(c.WindowMaximizeIcon,e),e,{props:f});if(f.maximizable){var n=d({type:"button",className:oe("maximizableButton"),onClick:we},re("maximizableButton"));return g.createElement("button",n,t,g.createElement(p.Ripple,null))}return null},Le=function(){if(f.showHeader){var e=Xe(),t=Ae(),n=i.ObjectUtils.getJSXElement(f.icons,f),r=i.ObjectUtils.getJSXElement(f.header,f),o=D+"_header",a=d({ref:A,style:f.headerStyle,className:oe("header"),onMouseDown:Ee},re("header")),l=d({id:o,className:oe("headerTitle")},re("headerTitle")),c=d({className:oe("headerIcons")},re("headerIcons"));return g.createElement("div",a,g.createElement("div",l,r),g.createElement("div",c,n,t,e))}return null},Ye=function(){var e=i.ObjectUtils.getJSXElement(f.footer,f),t=d({ref:L,className:oe("footer")},re("footer"));return e&&g.createElement("div",t,e)};return P&&function(){var t,n,r,a,l,c,s=D+"_header",p=D+"_content",b={enter:"center"===f.position?150:300,exit:"center"===f.position?150:300},y=d({ref:B,style:ae("mask"),className:oe("mask"),onPointerUp:Oe},re("mask")),v=d({ref:M,id:D,className:i.classNames(f.className,oe("root",{props:f,maximized:q,context:m})),style:f.style,onClick:f.onClick,role:"dialog","aria-labelledby":s,"aria-describedby":p,"aria-modal":f.modal,onPointerDown:xe},T.getOtherProps(f),re("root")),x=d({classNames:oe("transition"),timeout:b,in:j,options:f.transitionOptions,unmountOnExit:!0,onEnter:Re,onEntered:Ce,onExiting:He,onExited:_e},re("transition")),O=null;null!=e&&e.content?(c={header:f.header,content:f.message,message:null==f||null===(l=f.children)||void 0===l||null===(l=l[1])||void 0===l||null===(l=l.props)||void 0===l?void 0:l.children},O=i.ObjectUtils.getJSXElement(e.content,{headerRef:A,contentRef:X,footerRef:L,closeRef:Y,hide:ve,message:c})):(n=Le(),t=d({id:D+"_content",ref:X,style:f.contentStyle,className:oe("content")},re("content")),r=g.createElement("div",t,f.children),a=Ye(),O=g.createElement(g.Fragment,null,n,r,a,f.resizable?g.createElement("span",{className:"p-resizable-handle",style:{zIndex:90},onMouseDown:Pe}):null));var w=g.createElement("div",y,g.createElement(o.CSSTransition,h({nodeRef:M},x),g.createElement("div",v,g.createElement(_,{autoFocus:f.focusOnShow},O))));return g.createElement(u.Portal,{element:w,appendTo:f.appendTo,visible:!0})}()}));return U.displayName="Dialog",e.Dialog=U,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.api,primereact.componentbase,primereact.csstransition,primereact.hooks,primereact.utils,primereact.icons.times,primereact.icons.windowmaximize,primereact.icons.windowminimize,primereact.portal,primereact.ripple);