File: //opt/netdata/usr/local/local/share/netdata/web/v3/9244.558d00fde4362ce38470.chunk.js
try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="587cc119-ed99-4b8e-a77a-4f4300a66aca",e._sentryDebugIdIdentifier="sentry-dbid-587cc119-ed99-4b8e-a77a-4f4300a66aca")}()}catch(e){}!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"4a6f9fc3e5ef7db74fd7e8c2578a2d2965fcfdc1"}}catch(e){}}(),(self.webpackChunkcloud_frontend=self.webpackChunkcloud_frontend||[]).push([[9244],{72060:(t,o,n)=>{n.d(o,{A:()=>r});const r=t=>{try{if(!t)return null;const e=document.createElement("a");return e.href=t,/https?/.test(e.protocol)?new URL(e.protocol+"//"+e.host+e.pathname+e.search+e.hash).toString():null}catch(e){return null}}},79244:(t,o,n)=>{n.r(o),n.d(o,{default:()=>D});n(98992),n(72577),n(81454);var r=n(96540),a=n(88934),s=n(86663),i=n(91130),d=n(16866),c=n(49389),u=n(46587),l=n(72060),g=n(258),f=n(63872),w=n(24182),h=n(24609),_=n(14457);const p=()=>{const t=(0,u.uW)("id"),o=(0,u.uW)("name"),n=(0,u.uW)("email"),a=(0,u.uW)("createdAt"),s=(0,u.uW)("verifiedEmail"),i=(0,u.uW)("avatarUrl"),d=(0,h.UV)("loaded"),c=(0,h.UV)("ids"),[,l,g]=(0,_.A)();(0,r.useEffect)((()=>{t&&d&&!l&&(e=>{let{avatar:t,createdAt:o,email:n,id:r,name:a,spacesCount:s,verifiedEmail:i,maxNodesCount:d}=e;if(!window.envSettings.tracking)return;if(n&&n.includes("@netdata.msdc.co"))return;if(r&&"00000000-0000-0000-0000-000000000000"===r)return;if(n&&n.includes("anonymous@netdata.cloud"))return;const c=new Date,u=c.toISOString(),l=new Date(o),g=Math.floor((c-l)/864e5);window.dataLayer&&(window.dataLayer.push({event:"UserInfoAvailable",user_id:r,userIdentifier:r,userName:a,userEmail:n,userAccountCreatedAt:o,userAccountCreatedDaysAgo:g,userAvatarURL:t,userEmailVerified:i,spacesCount:s}),window.posthog?.__loaded&&(window.posthog.identify(r),window.posthog.people.set({email:n||"unknown email",name:a,netdata_cloud_account_created_at:o,netdata_cloud_account_created_days_ago:g,spacesCount:s,maxNodesCount:d}),window.posthog.register({netdata_cloud_account_created_days_ago:g,...window.localNetdataRegistry?{...window.localNetdataRegistry.pg?{netdata_registry_person_guid:window.localNetdataRegistry.pg}:{},...window.localNetdataRegistry.mg?{netdata_registry_machine_guid:window.localNetdataRegistry.mg}:{}}:{}}),window.posthog.register_once({event_source:"cloud",netdata_cloud_account_created_at:o,netdata_cloud_account_email:n||"unknown email",netdata_cloud_account_id:r,netdata_cloud_signed_in_at:u})))})({avatar:i,createdAt:a,email:n,id:t,name:o,spacesCount:c.length,verifiedEmail:s,maxNodesCount:g})}),[t,d,l]),(0,r.useEffect)((()=>{if(window.posthog?.__loaded)try{window.posthog.onFeatureFlags((function(){window.posthog.isFeatureEnabled&&window.posthog.isFeatureEnabled("user-age-less-than-7d")&&window.posthog.startSessionRecording()}))}catch(e){}}),[])},m=()=>{if(!window.posthog?.__loaded)return;const e=(new Date).toISOString();window.posthog.register_once({event_source:"cloud",posthog_first_seen_at:e,posthog_first_distinct_id:"get_distinct_id"in window.posthog&&window.posthog.get_distinct_id()})},y=()=>(0,r.useEffect)(m,[]);var A=n(16015),b=n(58618),v=n(39189),R=n(39175),E=n(25279),I=n(81691),C=n(89942),S=n(41395),k=n(47090),U=n(3319);const N=()=>{const e=(0,r.useRef)(),[,t]=(0,f.A)(),{error_msg_key:o,error_msg:n}=(0,C.PP)(),{sendLog:a}=(0,U.A)();(0,r.useEffect)((()=>{if(o&&e.current!=o){e.current=o;const r=n?(0,S.Zr)(decodeURIComponent(n)):void 0,s=(0,k.o)(o,r);t({header:"Error",text:s}),a({feature:"url-hash-error",isFailure:!0,errorMsgKey:o,message:s})}}),[e.current,o,n,t,a])};var $=n(74848);const x=e=>{let{errorRetry:t,token:o,redirectUri:n}=e;const a=s.parseUrl(decodeURIComponent(t)),{url:i,query:d}=a,{redirect_uri:c}=d,u=(0,r.useRef)(!1);return u.current||(u.current=!0,window.location=`${i}?token=${o}&redirect_uri=${c||n}`),null},D=()=>{(0,c.Ay)();const e=(0,u.uW)("isLoaded"),t=(0,u.uW)("isAnonymous");(0,w.A)(),y(),p(),(0,r.useEffect)((()=>{if(!R.Ay){const e=window.localStorage.getItem(I.lO.visitor);if(e)window.envSettings.visitor=e;else{const e=(0,E.A)();window.localStorage.setItem(I.lO.visitor,e),window.envSettings.visitor=e}}}),[]),(0,r.useEffect)((()=>{sessionStorage.getItem(I.yq.session)||sessionStorage.setItem(I.yq.session,(0,E.A)())}),[]),N();const o=(0,a.RQ)("/sign-in/mobile-app/*"),n=(0,a.RQ)("/sign-in/*"),h=(0,a.RQ)("/sign-up/*"),_=!!n||!!h,m=(()=>{const[,e]=(0,f.A)();return(0,r.useCallback)((function(){let{origin:t,id:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!t)return;const n=decodeURIComponent(o);(0,A.ys)(o).then((t=>{let{data:o=[]}=t;return o.length?i.A.get(d._9).then((e=>{let{data:t}=e;return Promise.any(t.map((e=>i.A.get((0,b.tK)({spaceId:e.id})).then((t=>{let{data:n}=t;return Promise.any(n.map((t=>(0,g.uQ)({roomId:t.id,spaceId:e.id}).then((n=>{let{nodes:r}=n;const a=r.find((e=>{let{id:t}=e;return o.includes(t)}));if(!a)throw new Error("can't find matching node");const{protocol:s,host:i}=window.location;return`${s}//${i}/spaces/${e.slug}/rooms/${t.slug}/nodes/${a.id}`})))))})))))})).catch((()=>{})):(0,A.iY)(n).then((t=>{let{data:o}=t;const{claimed:n}=o;throw e(n?{errorMsgKey:"ErrForbidden",errorMessage:"You tried to access this Node on Netdata and you don't have access to it. Please contact your Space admin to give you access to it."}:{errorMsgKey:"ErrForbidden",errorMessage:"This Node isn't connected to Netdata. Please connect it, if you have permission for it, or contact your Space admin."}),"no access"}))})).then((e=>{e&&setTimeout(location.assign(e))})).catch((()=>{}))}),[])})(),C=(0,v.A)();if(!e||C.isFetching||C.hasAccess&&!_||o)return null;const{pathname:S,search:k,hash:U}=window.location,{error_retry:D,token:F}=s.parse(U),{cloudRoute:W,redirect_uri:L,...T}=s.parse(k);if(!t&&D)return(0,$.jsx)(x,{errorRetry:D,token:F,redirectUri:L});if(!t&&_){if(W){const e=W.includes("join-callback")?decodeURI(W):W,t=Array.isArray(e)?e[0]:e;return(0,$.jsx)(a.C5,{replace:!0,to:t})}const e=(0,l.A)(L);return e?(m(T),window.location.replace(decodeURIComponent(e)),null):(0,$.jsx)(a.C5,{replace:!0,to:"/spaces"})}if(R.Ay)return null;if(t&&!_){const e=U.includes("join-callback")?U:encodeURIComponent(U),t=`${k}${k?"&":"?"}cloudRoute=${S}`;return(0,$.jsx)(a.C5,{replace:!0,to:{pathname:"/sign-in",search:t,hash:e}})}return null}}}]);