Liferay.Loader.define("data-engine-js-components-web@1.0.55/js/core/components/AutoFocus.es",["module","exports","require","liferay!frontend-js-react-web$react","../hooks/usePage.es"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.AutoFocus=function({children:e}){const t=(0,n.useRef)(),{activePage:r,containerElement:u}=(0,o.usePage)(),[c,i]=(0,n.useState)(0);return(0,n.useLayoutEffect)((()=>{if(t.current&&(null==u?void 0:u.current))if(t.current.querySelector(".loading-animation"))setTimeout((()=>i((e=>e+1))),5);else if(!document.activeElement){const e=t.current.querySelector("input"),r=document.querySelector(".ddm-form-builder--sidebar-open"),n=u.current.querySelector(".ddm-user-view-content");e&&!u.current.contains(document.activeElement)&&(r||n)&&(e.focus(),e.select&&e.select())}}),[r,t,u,c]),n.default.cloneElement(e,{ref:e=>{t.current=e}})};var n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=u();if(t&&t.has(e))return t.get(e);var r={},n=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if(Object.prototype.hasOwnProperty.call(e,o)){var c=n?Object.getOwnPropertyDescriptor(e,o):null;c&&(c.get||c.set)?Object.defineProperty(r,o,c):r[o]=e[o]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react")),o=r("../hooks/usePage.es");function u(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return u=function(){return e},e}}}));
//# sourceMappingURL=AutoFocus.es.js.map