"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/objectWithoutProperties"),s=require("react"),n=require("prop-types"),o=require("@material-ui/core"),t=require("classnames"),i=require("moment-timezone"),c=require("./effects/useXProps.js"),u=require("./constants.js"),a=require("./utils/replaceUndefinedValuesWithNull.js"),l=require("../DevCenterAppContainer/DevCenterAppContainer.js");require("../../../icons/WithCustomSize.js");var p=require("../../../icons/IconParkProvider.js");require("../../../icons/customIcons/icons/AddMessage.js"),require("../../../icons/customIcons/icons/Attention.js"),require("../../../icons/customIcons/icons/Collapse.js"),require("../../../icons/customIcons/icons/Expand.js"),require("../../../icons/customIcons/icons/FolderClosed.js"),require("../../../icons/customIcons/icons/FolderClosedFilled.js"),require("../../../icons/customIcons/icons/FolderOpened.js"),require("../../../icons/customIcons/icons/GreaterOrEqual.js"),require("../../../icons/customIcons/icons/LessOrEqual.js"),require("../../../icons/customIcons/icons/Search.js"),require("../../../icons/customIcons/icons/Wellhub.js"),require("../../../icons/customIcons/icons/MultiRuler.js"),require("../../../icons/customIcons/icons/Checkbox.js"),require("../../../icons/customIcons/icons/CheckboxChecked.js"),require("../../../icons/customIcons/icons/CheckboxIndeterminate.js"),require("../../../icons/customIcons/icons/Radio.js"),require("../../../icons/customIcons/icons/RadioChecked.js"),require("../../../icons/customIcons/icons/SimulFrac.js"),require("../../../icons/customIcons/icons/ZipperFrac.js"),require("../../../icons/customIcons/icons/CautionFilled.js");var d=require("../../../hocs/withMUIProvidersHOC.js");require("../../../hocs/withAssetEditorLockHOC.js");var m=require("../AppContext.js"),f=require("../../../constants/theme.js"),j=require("../../../CLI/hocs/constants.js"),C=require("../../../utils/themeVariables.js"),q=require("../../../CLI/hocs/utils.js"),I=require("../../../permissions/PermissionsContext.js"),h=require("../../../utils/index.js");require("../../../config/initGlobalDependencies.js"),require("../../../styles/globalStyles.js"),require("./DevCenterAppZoidComponent.js");var b=require("react/jsx-runtime");function g(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var P=g(e),v=g(r),A=g(n),O=g(t),E=g(i),S=["appContextValue","globalMixpanelEventTracker","globalNotificationToastsAPI","onSettingChange","onSettingsChange","permissionsContextValue","timezone","userUnits"];function x(e,r){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),s.push.apply(s,n)}return s}function y(e){for(var r=1;r<arguments.length;r++){var s=null!=arguments[r]?arguments[r]:{};r%2?x(Object(s),!0).forEach((function(r){P.default(e,r,s[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):x(Object(s)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(s,r))}))}return e}var D=d(l),T=o.makeStyles((function(){return{"@global":{body:{backgroundColor:"transparent",overflow:"hidden"}}}}));function L(e){var r,n=e.CLIAppComponent,o=e.CLIAppSettings,t=e.containerReportClassName;T();var i=c.useXProps(),l=i.appContextValue,d=i.globalMixpanelEventTracker,g=i.globalNotificationToastsAPI,P=i.onSettingChange,A=i.onSettingsChange,x=i.permissionsContextValue,L=i.timezone,w=i.userUnits,k=v.default(i,S),R=k.location.pathname.startsWith("/reports/")||q.isPDFReportView,M=null!==(r=localStorage.getItem(j.LOCAL_STORAGE_APP_THEME_KEY))&&void 0!==r?r:f.THEMES.DARK,N=!R&&M===f.THEMES.DARK;s.useEffect((function(){C.setThemeVariables(N)}),[N]),s.useEffect((function(){window[Symbol.for("notificationToasts")]=g,window[Symbol.for("logToMixpanel")]=d}),[g,d]);var V=s.useRef(!0);return V.current&&(V.current=!1,h.updateUserUnits({userUnits:w})),s.useEffect((function(){return L&&E.default.tz.setDefault(L),function(){return E.default.tz.setDefault(null)}}),[L]),b.jsx(I.PermissionsContext.Provider,{value:x,children:b.jsx(m.Provider,{value:l,children:b.jsx(p.IconParkProvider,{children:b.jsx("div",{id:u.ISOLATED_PAGE_APP_CONTAINER_ID,className:O.default(R&&t),children:b.jsx(D,y(y({},k),{},{theme:N?f.THEMES.DARK:f.THEMES.LIGHT,onSettingsChange:function(e){return A(a.replaceUndefinedValuesWithNull(e))},onSettingChange:function(e,r){return P(e,a.replaceUndefinedValuesWithNull(r))},CLIAppComponent:n,CLIAppSettings:o}))})})})})}L.propTypes={CLIAppComponent:A.default.func,CLIAppSettings:A.default.func,containerReportClassName:A.default.string},L.defaultProps={CLIAppComponent:null,CLIAppSettings:null,containerReportClassName:null},exports.DevCenterIsolatedAppPage=L;
