Liferay.Loader.define("data-engine-js-components-web@1.0.79/js/custom/form-report/components/sidebar/SidebarContext",["module","exports","require","liferay!frontend-js-react-web$react","../../hooks/useOnClickOutside"],(function(e,t,r){var n;window;{Object.defineProperty(t,"__esModule",{value:!0}),t.SidebarContextProvider=t.SidebarContext=void 0;var o=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=a();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 i=n?Object.getOwnPropertyDescriptor(e,o):null;i&&(i.get||i.set)?Object.defineProperty(r,o,i):r[o]=e[o]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react")),i=(n=r("../../hooks/useOnClickOutside"))&&n.__esModule?n:{default:n};function a(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return a=function(){return e},e}function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){u(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function u(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const e=(0,o.createContext)({});t.SidebarContext=e;const l=({children:t,dataEngineModule:r,formReportRecordsFieldValuesURL:n,portletNamespace:a})=>{const[c,u]=(0,o.useState)({field:null,isOpen:!1,totalEntries:0,type:null});return(0,o.useEffect)((()=>{const e=({target:e})=>{(0,i.default)(e,"#"+a+"sidebar-reports","#"+a+"-see-more")&&u((()=>({isOpen:!1})))};return window.addEventListener("click",e),()=>window.removeEventListener("click",e)})),o.default.createElement(e.Provider,{value:s(s({},c),{},{dataEngineModule:r,formReportRecordsFieldValuesURL:n,portletNamespace:a,toggleSidebar:(e,t,r,n)=>{const o=void 0!==e;u(o?()=>({field:e,isOpen:o,summary:t,totalEntries:r,type:n}):()=>s(s({},c),{},{isOpen:o}))}})},t)};t.SidebarContextProvider=l}}));
//# sourceMappingURL=SidebarContext.js.map