!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=(new Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="33edaa45-821b-4739-85f4-fc076d59e14b",e._sentryDebugIdIdentifier="sentry-dbid-33edaa45-821b-4739-85f4-fc076d59e14b")}catch(e){}}();var _global="undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{};_global.SENTRY_RELEASE={id:"8b7b01b6c705cf50f8050ce0fb8fc6b58fe68567"},(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[88],{10088:function(e,t,n){n.r(t),n.d(t,{default:function(){return _}});var a=n(29439),r=(n(91058),n(67294)),o=n(23855),i=n(12274),l=n(19013),u=n(13882);var s=n(29422),c=n(84314),d=n(49474),f=n(50157),m=n(11699),p=n(8958),b=n(82268),g=n(52149),D=n(24262),h=1440,w=2520,v=43200,y=86400;function Z(e,t){return(0,u.Z)(1,arguments),function(e,t,n){var a,r;(0,u.Z)(2,arguments);var o=(0,c.j)(),i=null!==(a=null!==(r=null===n||void 0===n?void 0:n.locale)&&void 0!==r?r:o.locale)&&void 0!==a?a:p.Z;if(!i.formatDistance)throw new RangeError("locale must contain formatDistance property");var s=(0,d.Z)(e,t);if(isNaN(s))throw new RangeError("Invalid time value");var Z,x,E=(0,g.Z)((0,b.Z)(n),{addSuffix:Boolean(null===n||void 0===n?void 0:n.addSuffix),comparison:s});s>0?(Z=(0,l.default)(t),x=(0,l.default)(e)):(Z=(0,l.default)(e),x=(0,l.default)(t));var I,S=(0,m.Z)(x,Z),M=((0,D.Z)(x)-(0,D.Z)(Z))/1e3,k=Math.round((S-M)/60);if(k<2)return null!==n&&void 0!==n&&n.includeSeconds?S<5?i.formatDistance("lessThanXSeconds",5,E):S<10?i.formatDistance("lessThanXSeconds",10,E):S<20?i.formatDistance("lessThanXSeconds",20,E):S<40?i.formatDistance("halfAMinute",0,E):S<60?i.formatDistance("lessThanXMinutes",1,E):i.formatDistance("xMinutes",1,E):0===k?i.formatDistance("lessThanXMinutes",1,E):i.formatDistance("xMinutes",k,E);if(k<45)return i.formatDistance("xMinutes",k,E);if(k<90)return i.formatDistance("aboutXHours",1,E);if(k<h){var X=Math.round(k/60);return i.formatDistance("aboutXHours",X,E)}if(k<w)return i.formatDistance("xDays",1,E);if(k<v){var P=Math.round(k/h);return i.formatDistance("xDays",P,E)}if(k<y)return I=Math.round(k/v),i.formatDistance("aboutXMonths",I,E);if((I=(0,f.Z)(x,Z))<12){var T=Math.round(k/v);return i.formatDistance("xMonths",T,E)}var _=I%12,L=Math.floor(I/12);return _<3?i.formatDistance("aboutXYears",L,E):_<9?i.formatDistance("overXYears",L,E):i.formatDistance("almostXYears",L+1,E)}(e,Date.now(),t)}var x=n(49546),E=n(26398),I=n(4480),S=n(93416),M=n(45916),k=n(91008),X=n(46667),P=(0,I.nZ)({key:"fetchLicense",get:function(){return E.Z.get("/api/v1/license").then((function(e){return e.data})).catch((function(){return null}))}}),T=(0,I.cn)({key:"licenseAtom",default:P}),_=function(){if(!window.envSettings.onprem)return null;var e=(0,I.$P)(T),t=(0,X.Z)(),n=(0,a.Z)(t,2),c=n[0],d=n[1],f=(0,r.useState)(),m=(0,a.Z)(f,2),p=m[0],b=m[1],g=(0,r.useState)(!1),D=(0,a.Z)(g,2),h=D[0],w=D[1];return(0,r.useEffect)((function(){if("hasValue"===e.state){var t=e.contents,n=(0,o.default)(t.exp);if(b(n),(0,i.default)(n)){var a=parseInt((n-new Date)/1e3/60/60/24);if(!(a>30)){var r=localStorage.getItem("dismissLicenceWarning");r&&(0,i.default)((0,o.default)(r))&&!function(e){return(0,u.Z)(1,arguments),(0,l.default)(e).getTime()<Date.now()}((0,o.default)(r))&&a>0||(d(!0),a<0&&w(!0))}}}}),[e]),c?h?r.createElement(S.Layer,{full:!0,backdropProps:{backdropBlur:"3px"}},r.createElement(M.Z,{testId:"onprem-banner",width:"100%",background:"errorBackground",position:"absolute",top:"0",tooltipProps:{align:"top"},zIndex:20},r.createElement(S.Flex,{justifyContent:"center",alignItems:"center",width:"100%",gap:2},r.createElement(S.Text,null,"Your Netdata Enterprise On-prem License has expired on ",(0,x.default)(p,"PPPP"),". Please contact your admin /"," ",r.createElement(k.Z,{"data-testid":"renew",href:"mailto:billing@netdata.cloud",as:"a",cursor:"pointer",textDecoration:"underline",color:"main"},"billing@netdata.cloud")," ","to renew your license.")))):r.createElement(M.Z,{testId:"onprem-banner",width:"100%",background:"warningBackground",position:"absolute",top:"0",onClose:function(){d(),localStorage.setItem("dismissLicenceWarning",(0,s.Z)(new Date,{days:1}).toISOString())},tooltipProps:{align:"top"},zIndex:20},r.createElement(S.Flex,{justifyContent:"center",alignItems:"center",width:"100%",gap:2},r.createElement(S.Text,null,"Your Netdata Enterprise On-prem License will expire in ",Z(p),". Please contact your admin /"," ",r.createElement(k.Z,{"data-testid":"renew",href:"mailto:billing@netdata.cloud",as:"a",cursor:"pointer",textDecoration:"underline",color:"main"},"billing@netdata.cloud")," ","to renew your license."))):null}}}]);