@interopio/home-ui-react 1.2.5 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -44,5 +44,5 @@ Valid keys: `+JSON.stringify(Object.keys(E),null," "));var P=ie(F,B,N,M,A+"."+B
44
44
  `,10)+1,a=o.substring(i)+(r?"//# sourceMappingURL="+r:""),c=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(c)}var po,ho,mo,In,Gl=(po="Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwohZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Y2xhc3MgZSBleHRlbmRzIEVycm9ye2NvbnN0cnVjdG9yKHQscil7c3VwZXIociksdGhpcy5lcnJvcj10LHRoaXMuZXJyb3JfZGVzY3JpcHRpb249cixPYmplY3Quc2V0UHJvdG90eXBlT2YodGhpcyxlLnByb3RvdHlwZSl9c3RhdGljIGZyb21QYXlsb2FkKHtlcnJvcjp0LGVycm9yX2Rlc2NyaXB0aW9uOnJ9KXtyZXR1cm4gbmV3IGUodCxyKX19Y2xhc3MgdCBleHRlbmRzIGV7Y29uc3RydWN0b3IoZSxzKXtzdXBlcigibWlzc2luZ19yZWZyZXNoX3Rva2VuIixgTWlzc2luZyBSZWZyZXNoIFRva2VuIChhdWRpZW5jZTogJyR7cihlLFsiZGVmYXVsdCJdKX0nLCBzY29wZTogJyR7cihzKX0nKWApLHRoaXMuYXVkaWVuY2U9ZSx0aGlzLnNjb3BlPXMsT2JqZWN0LnNldFByb3RvdHlwZU9mKHRoaXMsdC5wcm90b3R5cGUpfX1mdW5jdGlvbiByKGUsdD1bXSl7cmV0dXJuIGUmJiF0LmluY2x1ZGVzKGUpP2U6IiJ9Y29uc3Qgcz1lPT57dmFye2NsaWVudElkOnR9PWUscj1mdW5jdGlvbihlLHQpe3ZhciByPXt9O2Zvcih2YXIgcyBpbiBlKU9iamVjdC5wcm90b3R5cGUuaGFzT3duUHJvcGVydHkuY2FsbChlLHMpJiZ0LmluZGV4T2Yocyk8MCYmKHJbc109ZVtzXSk7aWYobnVsbCE9ZSYmImZ1bmN0aW9uIj09dHlwZW9mIE9iamVjdC5nZXRPd25Qcm9wZXJ0eVN5bWJvbHMpe3ZhciBvPTA7Zm9yKHM9T2JqZWN0LmdldE93blByb3BlcnR5U3ltYm9scyhlKTtvPHMubGVuZ3RoO28rKyl0LmluZGV4T2Yoc1tvXSk8MCYmT2JqZWN0LnByb3RvdHlwZS5wcm9wZXJ0eUlzRW51bWVyYWJsZS5jYWxsKGUsc1tvXSkmJihyW3Nbb11dPWVbc1tvXV0pfXJldHVybiByfShlLFsiY2xpZW50SWQiXSk7cmV0dXJuIG5ldyBVUkxTZWFyY2hQYXJhbXMoKGU9Pk9iamVjdC5rZXlzKGUpLmZpbHRlcigodD0+dm9pZCAwIT09ZVt0XSkpLnJlZHVjZSgoKHQscik9Pk9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSx0KSx7W3JdOmVbcl19KSkse30pKShPYmplY3QuYXNzaWduKHtjbGllbnRfaWQ6dH0scikpKS50b1N0cmluZygpfTtsZXQgbz17fTtjb25zdCBuPShlLHQpPT5gJHtlfXwke3R9YDthZGRFdmVudExpc3RlbmVyKCJtZXNzYWdlIiwoYXN5bmMoe2RhdGE6e3RpbWVvdXQ6ZSxhdXRoOnIsZmV0Y2hVcmw6aSxmZXRjaE9wdGlvbnM6Yyx1c2VGb3JtRGF0YTphfSxwb3J0czpbZl19KT0+e2xldCBwO2NvbnN0e2F1ZGllbmNlOmwsc2NvcGU6dX09cnx8e307dHJ5e2NvbnN0IHI9YT8oZT0+e2NvbnN0IHQ9bmV3IFVSTFNlYXJjaFBhcmFtcyhlKSxyPXt9O3JldHVybiB0LmZvckVhY2goKChlLHQpPT57clt0XT1lfSkpLHJ9KShjLmJvZHkpOkpTT04ucGFyc2UoYy5ib2R5KTtpZighci5yZWZyZXNoX3Rva2VuJiYicmVmcmVzaF90b2tlbiI9PT1yLmdyYW50X3R5cGUpe2NvbnN0IGU9KChlLHQpPT5vW24oZSx0KV0pKGwsdSk7aWYoIWUpdGhyb3cgbmV3IHQobCx1KTtjLmJvZHk9YT9zKE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxyKSx7cmVmcmVzaF90b2tlbjplfSkpOkpTT04uc3RyaW5naWZ5KE9iamVjdC5hc3NpZ24oT2JqZWN0LmFzc2lnbih7fSxyKSx7cmVmcmVzaF90b2tlbjplfSkpfWxldCBkLGc7ImZ1bmN0aW9uIj09dHlwZW9mIEFib3J0Q29udHJvbGxlciYmKGQ9bmV3IEFib3J0Q29udHJvbGxlcixjLnNpZ25hbD1kLnNpZ25hbCk7dHJ5e2c9YXdhaXQgUHJvbWlzZS5yYWNlKFsoaD1lLG5ldyBQcm9taXNlKChlPT5zZXRUaW1lb3V0KGUsaCkpKSksZmV0Y2goaSxPYmplY3QuYXNzaWduKHt9LGMpKV0pfWNhdGNoKGUpe3JldHVybiB2b2lkIGYucG9zdE1lc3NhZ2Uoe2Vycm9yOmUubWVzc2FnZX0pfWlmKCFnKXJldHVybiBkJiZkLmFib3J0KCksdm9pZCBmLnBvc3RNZXNzYWdlKHtlcnJvcjoiVGltZW91dCB3aGVuIGV4ZWN1dGluZyAnZmV0Y2gnIn0pO3A9YXdhaXQgZy5qc29uKCkscC5yZWZyZXNoX3Rva2VuPygoKGUsdCxyKT0+e29bbih0LHIpXT1lfSkocC5yZWZyZXNoX3Rva2VuLGwsdSksZGVsZXRlIHAucmVmcmVzaF90b2tlbik6KChlLHQpPT57ZGVsZXRlIG9bbihlLHQpXX0pKGwsdSksZi5wb3N0TWVzc2FnZSh7b2s6Zy5vayxqc29uOnB9KX1jYXRjaChlKXtmLnBvc3RNZXNzYWdlKHtvazohMSxqc29uOntlcnJvcjplLmVycm9yLGVycm9yX2Rlc2NyaXB0aW9uOmUubWVzc2FnZX19KX12YXIgaH0pKX0oKTsKCg==",ho=null,mo=!1,function(t){return In=In||$l(po,ho,mo),new Worker(In,t)});const Nn={};class ql{constructor(e,n){this.cache=e,this.clientId=n,this.manifestKey=this.createManifestKeyFrom(this.clientId)}async add(e){var n;const r=new Set(((n=await this.cache.get(this.manifestKey))===null||n===void 0?void 0:n.keys)||[]);r.add(e),await this.cache.set(this.manifestKey,{keys:[...r]})}async remove(e){const n=await this.cache.get(this.manifestKey);if(n){const r=new Set(n.keys);return r.delete(e),r.size>0?await this.cache.set(this.manifestKey,{keys:[...r]}):await this.cache.remove(this.manifestKey)}}get(){return this.cache.get(this.manifestKey)}clear(){return this.cache.remove(this.manifestKey)}createManifestKeyFrom(e){return`@@auth0spajs@@::${e}`}}const Kl={memory:()=>new Oi().enclosedCache,localstorage:()=>new Fl},vo=t=>Kl[t],go=t=>{const{openUrl:e,onRedirect:n}=t,r=Ne(t,["openUrl","onRedirect"]);return Object.assign(Object.assign({},r),{openUrl:e===!1||e?e:n})},An=new Il;class Yl{constructor(e){let n,r;if(this.userCache=new Oi().enclosedCache,this.defaultOptions={authorizationParams:{scope:"openid profile email"},useRefreshTokensFallback:!1,useFormData:!0},this._releaseLockOnPageHide=async()=>{await An.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)},this.options=Object.assign(Object.assign(Object.assign({},this.defaultOptions),e),{authorizationParams:Object.assign(Object.assign({},this.defaultOptions.authorizationParams),e.authorizationParams)}),typeof window<"u"&&(()=>{if(!Kt())throw new Error("For security reasons, `window.crypto` is required to run `auth0-spa-js`.");if(Kt().subtle===void 0)throw new Error(`
45
45
  auth0-spa-js must run on a secure origin. See https://github.com/auth0/auth0-spa-js/blob/master/FAQ.md#why-do-i-get-auth0-spa-js-must-run-on-a-secure-origin for more information.
46
46
  `)})(),e.cache&&e.cacheLocation&&console.warn("Both `cache` and `cacheLocation` options have been specified in the Auth0Client configuration; ignoring `cacheLocation` and using `cache`."),e.cache)r=e.cache;else{if(n=e.cacheLocation||"memory",!vo(n))throw new Error(`Invalid cache location "${n}"`);r=vo(n)()}this.httpTimeoutMs=e.httpTimeoutInSeconds?1e3*e.httpTimeoutInSeconds:1e4,this.cookieStorage=e.legacySameSiteCookie===!1?dt:Bl,this.orgHintCookieName=`auth0.${this.options.clientId}.organization_hint`,this.isAuthenticatedCookieName=(a=>`auth0.${a}.is.authenticated`)(this.options.clientId),this.sessionCheckExpiryDays=e.sessionCheckExpiryDays||1;const o=e.useCookiesForTransactions?this.cookieStorage:Zl;var i;this.scope=$t("openid",this.options.authorizationParams.scope,this.options.useRefreshTokens?"offline_access":""),this.transactionManager=new Hl(o,this.options.clientId),this.nowProvider=this.options.nowProvider||Ci,this.cacheManager=new Ul(r,r.allKeys?void 0:new ql(r,this.options.clientId),this.nowProvider),this.domainUrl=(i=this.options.domain,/^https?:\/\//.test(i)?i:`https://${i}`),this.tokenIssuer=((a,c)=>a?a.startsWith("https://")?a:`https://${a}/`:`${c}/`)(this.options.issuer,this.domainUrl),typeof window<"u"&&window.Worker&&this.options.useRefreshTokens&&n==="memory"&&(this.worker=new Gl)}_url(e){const n=encodeURIComponent(btoa(JSON.stringify(this.options.auth0Client||xi)));return`${this.domainUrl}${e}&auth0Client=${n}`}_authorizeUrl(e){return this._url(`/authorize?${or(e)}`)}async _verifyIdToken(e,n,r){const o=await this.nowProvider();return zl({iss:this.tokenIssuer,aud:this.options.clientId,id_token:e,nonce:n,organizationId:r,leeway:this.options.leeway,max_age:(i=this.options.authorizationParams.max_age,typeof i!="string"?i:parseInt(i,10)||void 0),now:o});var i}_processOrgIdHint(e){e?this.cookieStorage.save(this.orgHintCookieName,e,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}):this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain})}async _prepareAuthorizeUrl(e,n,r){const o=uo(_n()),i=uo(_n()),a=_n(),c=(f=>{const p=new Uint8Array(f);return(d=>{const h={"+":"-","/":"_","=":""};return d.replace(/[+/=]/g,m=>h[m])})(window.btoa(String.fromCharCode(...Array.from(p))))})(await(async f=>await Kt().subtle.digest({name:"SHA-256"},new TextEncoder().encode(f)))(a)),l=((f,p,d,h,m,v,g,w)=>Object.assign(Object.assign(Object.assign({client_id:f.clientId},f.authorizationParams),d),{scope:$t(p,d.scope),response_type:"code",response_mode:w||"query",state:h,nonce:m,redirect_uri:g||f.authorizationParams.redirect_uri,code_challenge:v,code_challenge_method:"S256"}))(this.options,this.scope,e,o,i,c,e.redirect_uri||this.options.authorizationParams.redirect_uri||r,n?.response_mode),u=this._authorizeUrl(l);return{nonce:i,code_verifier:a,scope:l.scope,audience:l.audience||"default",redirect_uri:l.redirect_uri,state:o,url:u}}async loginWithPopup(e,n){var r;if(e=e||{},!(n=n||{}).popup&&(n.popup=(c=>{const l=window.screenX+(window.innerWidth-400)/2,u=window.screenY+(window.innerHeight-600)/2;return window.open(c,"auth0:authorize:popup",`left=${l},top=${u},width=400,height=600,resizable,scrollbars=yes,status=1`)})(""),!n.popup))throw new Error("Unable to open a popup for loginWithPopup - window.open returned `null`");const o=await this._prepareAuthorizeUrl(e.authorizationParams||{},{response_mode:"web_message"},window.location.origin);n.popup.location.href=o.url;const i=await(c=>new Promise((l,u)=>{let f;const p=setInterval(()=>{c.popup&&c.popup.closed&&(clearInterval(p),clearTimeout(d),window.removeEventListener("message",f,!1),u(new jr(c.popup)))},1e3),d=setTimeout(()=>{clearInterval(p),u(new Or(c.popup)),window.removeEventListener("message",f,!1)},1e3*(c.timeoutInSeconds||60));f=function(h){if(h.data&&h.data.type==="authorization_response"){if(clearTimeout(d),clearInterval(p),window.removeEventListener("message",f,!1),c.popup.close(),h.data.response.error)return u(Oe.fromPayload(h.data.response));l(h.data.response)}},window.addEventListener("message",f)}))(Object.assign(Object.assign({},n),{timeoutInSeconds:n.timeoutInSeconds||this.options.authorizeTimeoutInSeconds||60}));if(o.state!==i.state)throw new Error("Invalid state");const a=((r=e.authorizationParams)===null||r===void 0?void 0:r.organization)||this.options.authorizationParams.organization;await this._requestToken({audience:o.audience,scope:o.scope,code_verifier:o.code_verifier,grant_type:"authorization_code",code:i.code,redirect_uri:o.redirect_uri},{nonceIn:o.nonce,organizationId:a})}async getUser(){var e;const n=await this._getIdTokenFromCache();return(e=n?.decodedToken)===null||e===void 0?void 0:e.user}async getIdTokenClaims(){var e;const n=await this._getIdTokenFromCache();return(e=n?.decodedToken)===null||e===void 0?void 0:e.claims}async loginWithRedirect(e={}){var n;const r=go(e),{openUrl:o,fragment:i,appState:a}=r,c=Ne(r,["openUrl","fragment","appState"]),l=((n=c.authorizationParams)===null||n===void 0?void 0:n.organization)||this.options.authorizationParams.organization,u=await this._prepareAuthorizeUrl(c.authorizationParams||{}),{url:f}=u,p=Ne(u,["url"]);this.transactionManager.create(Object.assign(Object.assign(Object.assign({},p),{appState:a}),l&&{organizationId:l}));const d=i?`${f}#${i}`:f;o?await o(d):window.location.assign(d)}async handleRedirectCallback(e=window.location.href){const n=e.split("?").slice(1);if(n.length===0)throw new Error("There are no query params available for parsing.");const{state:r,code:o,error:i,error_description:a}=(p=>{p.indexOf("#")>-1&&(p=p.substring(0,p.indexOf("#")));const d=new URLSearchParams(p);return{state:d.get("state"),code:d.get("code")||void 0,error:d.get("error")||void 0,error_description:d.get("error_description")||void 0}})(n.join("")),c=this.transactionManager.get();if(!c)throw new Error("Invalid state");if(this.transactionManager.remove(),i)throw new Cr(i,a||i,r,c.appState);if(!c.code_verifier||c.state&&c.state!==r)throw new Error("Invalid state");const l=c.organizationId,u=c.nonce,f=c.redirect_uri;return await this._requestToken(Object.assign({audience:c.audience,scope:c.scope,code_verifier:c.code_verifier,grant_type:"authorization_code",code:o},f?{redirect_uri:f}:{}),{nonceIn:u,organizationId:l}),{appState:c.appState}}async checkSession(e){if(!this.cookieStorage.get(this.isAuthenticatedCookieName)){if(!this.cookieStorage.get("auth0.is.authenticated"))return;this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove("auth0.is.authenticated")}try{await this.getTokenSilently(e)}catch{}}async getTokenSilently(e={}){var n;const r=Object.assign(Object.assign({cacheMode:"on"},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:$t(this.scope,(n=e.authorizationParams)===null||n===void 0?void 0:n.scope)})}),o=await((i,a)=>{let c=Nn[a];return c||(c=i().finally(()=>{delete Nn[a],c=null}),Nn[a]=c),c})(()=>this._getTokenSilently(r),`${this.options.clientId}::${r.authorizationParams.audience}::${r.authorizationParams.scope}`);return e.detailedResponse?o:o?.access_token}async _getTokenSilently(e){const{cacheMode:n}=e,r=Ne(e,["cacheMode"]);if(n!=="off"){const o=await this._getEntryFromCache({scope:r.authorizationParams.scope,audience:r.authorizationParams.audience||"default",clientId:this.options.clientId});if(o)return o}if(n!=="cache-only"){if(!await(async(o,i=3)=>{for(let a=0;a<i;a++)if(await o())return!0;return!1})(()=>An.acquireLock("auth0.lock.getTokenSilently",5e3),10))throw new Dt;try{if(window.addEventListener("pagehide",this._releaseLockOnPageHide),n!=="off"){const u=await this._getEntryFromCache({scope:r.authorizationParams.scope,audience:r.authorizationParams.audience||"default",clientId:this.options.clientId});if(u)return u}const o=this.options.useRefreshTokens?await this._getTokenUsingRefreshToken(r):await this._getTokenFromIFrame(r),{id_token:i,access_token:a,oauthTokenScope:c,expires_in:l}=o;return Object.assign(Object.assign({id_token:i,access_token:a},c?{scope:c}:null),{expires_in:l})}finally{await An.releaseLock("auth0.lock.getTokenSilently"),window.removeEventListener("pagehide",this._releaseLockOnPageHide)}}}async getTokenWithPopup(e={},n={}){var r;const o=Object.assign(Object.assign({},e),{authorizationParams:Object.assign(Object.assign(Object.assign({},this.options.authorizationParams),e.authorizationParams),{scope:$t(this.scope,(r=e.authorizationParams)===null||r===void 0?void 0:r.scope)})});return n=Object.assign(Object.assign({},Nl),n),await this.loginWithPopup(o,n),(await this.cacheManager.get(new Ae({scope:o.authorizationParams.scope,audience:o.authorizationParams.audience||"default",clientId:this.options.clientId}))).access_token}async isAuthenticated(){return!!await this.getUser()}_buildLogoutUrl(e){e.clientId!==null?e.clientId=e.clientId||this.options.clientId:delete e.clientId;const n=e.logoutParams||{},{federated:r}=n,o=Ne(n,["federated"]),i=r?"&federated":"";return this._url(`/v2/logout?${or(Object.assign({clientId:e.clientId},o))}`)+i}async logout(e={}){const n=go(e),{openUrl:r}=n,o=Ne(n,["openUrl"]);e.clientId===null?await this.cacheManager.clear():await this.cacheManager.clear(e.clientId||this.options.clientId),this.cookieStorage.remove(this.orgHintCookieName,{cookieDomain:this.options.cookieDomain}),this.cookieStorage.remove(this.isAuthenticatedCookieName,{cookieDomain:this.options.cookieDomain}),this.userCache.remove("@@user@@");const i=this._buildLogoutUrl(o);r?await r(i):r!==!1&&window.location.assign(i)}async _getTokenFromIFrame(e){const n=Object.assign(Object.assign({},e.authorizationParams),{prompt:"none"}),r=this.cookieStorage.get(this.orgHintCookieName);r&&!n.organization&&(n.organization=r);const{url:o,state:i,nonce:a,code_verifier:c,redirect_uri:l,scope:u,audience:f}=await this._prepareAuthorizeUrl(n,{response_mode:"web_message"},window.location.origin);try{if(window.crossOriginIsolated)throw new Oe("login_required","The application is running in a Cross-Origin Isolated context, silently retrieving a token without refresh token is not possible.");const p=e.timeoutInSeconds||this.options.authorizeTimeoutInSeconds,d=await((m,v,g=60)=>new Promise((w,j)=>{const O=window.document.createElement("iframe");O.setAttribute("width","0"),O.setAttribute("height","0"),O.style.display="none";const C=()=>{window.document.body.contains(O)&&(window.document.body.removeChild(O),window.removeEventListener("message",b,!1))};let b;const k=setTimeout(()=>{j(new Dt),C()},1e3*g);b=function(_){if(_.origin!=v||!_.data||_.data.type!=="authorization_response")return;const S=_.source;S&&S.close(),_.data.response.error?j(Oe.fromPayload(_.data.response)):w(_.data.response),clearTimeout(k),window.removeEventListener("message",b,!1),setTimeout(C,2e3)},window.addEventListener("message",b,!1),window.document.body.appendChild(O),O.setAttribute("src",m)}))(o,this.domainUrl,p);if(i!==d.state)throw new Error("Invalid state");const h=await this._requestToken(Object.assign(Object.assign({},e.authorizationParams),{code_verifier:c,code:d.code,grant_type:"authorization_code",redirect_uri:l,timeout:e.authorizationParams.timeout||this.httpTimeoutMs}),{nonceIn:a});return Object.assign(Object.assign({},h),{scope:u,oauthTokenScope:h.scope,audience:f})}catch(p){throw p.error==="login_required"&&this.logout({openUrl:!1}),p}}async _getTokenUsingRefreshToken(e){const n=await this.cacheManager.get(new Ae({scope:e.authorizationParams.scope,audience:e.authorizationParams.audience||"default",clientId:this.options.clientId}));if(!(n&&n.refresh_token||this.worker)){if(this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw new yn(e.authorizationParams.audience||"default",e.authorizationParams.scope)}const r=e.authorizationParams.redirect_uri||this.options.authorizationParams.redirect_uri||window.location.origin,o=typeof e.timeoutInSeconds=="number"?1e3*e.timeoutInSeconds:null;try{const i=await this._requestToken(Object.assign(Object.assign(Object.assign({},e.authorizationParams),{grant_type:"refresh_token",refresh_token:n&&n.refresh_token,redirect_uri:r}),o&&{timeout:o}));return Object.assign(Object.assign({},i),{scope:e.authorizationParams.scope,oauthTokenScope:i.scope,audience:e.authorizationParams.audience||"default"})}catch(i){if((i.message.indexOf("Missing Refresh Token")>-1||i.message&&i.message.indexOf("invalid refresh token")>-1)&&this.options.useRefreshTokensFallback)return await this._getTokenFromIFrame(e);throw i}}async _saveEntryInCache(e){const{id_token:n,decodedToken:r}=e,o=Ne(e,["id_token","decodedToken"]);this.userCache.set("@@user@@",{id_token:n,decodedToken:r}),await this.cacheManager.setIdToken(this.options.clientId,e.id_token,e.decodedToken),await this.cacheManager.set(o)}async _getIdTokenFromCache(){const e=this.options.authorizationParams.audience||"default",n=await this.cacheManager.getIdToken(new Ae({clientId:this.options.clientId,audience:e,scope:this.scope})),r=this.userCache.get("@@user@@");return n&&n.id_token===r?.id_token?r:(this.userCache.set("@@user@@",n),n)}async _getEntryFromCache({scope:e,audience:n,clientId:r}){const o=await this.cacheManager.get(new Ae({scope:e,audience:n,clientId:r}),60);if(o&&o.access_token){const{access_token:i,oauthTokenScope:a,expires_in:c}=o,l=await this._getIdTokenFromCache();return l&&Object.assign(Object.assign({id_token:l.id_token,access_token:i},a?{scope:a}:null),{expires_in:c})}}async _requestToken(e,n){const{nonceIn:r,organizationId:o}=n||{},i=await Dl(Object.assign({baseUrl:this.domainUrl,client_id:this.options.clientId,auth0Client:this.options.auth0Client,useFormData:this.options.useFormData,timeout:this.httpTimeoutMs},e),this.worker),a=await this._verifyIdToken(i.id_token,r,o);return await this._saveEntryInCache(Object.assign(Object.assign(Object.assign(Object.assign({},i),{decodedToken:a,scope:e.scope,audience:e.audience||"default"}),i.scope?{oauthTokenScope:i.scope}:null),{client_id:this.options.clientId})),this.cookieStorage.save(this.isAuthenticatedCookieName,!0,{daysUntilExpire:this.sessionCheckExpiryDays,cookieDomain:this.options.cookieDomain}),this._processOrgIdHint(a.claims.org_id),Object.assign(Object.assign({},i),{decodedToken:a})}}var Si={isAuthenticated:!1,isLoading:!0},Fe=function(){throw new Error("You forgot to wrap your component in <Auth0Provider>.")},Xl=ue(ue({},Si),{buildAuthorizeUrl:Fe,buildLogoutUrl:Fe,getAccessTokenSilently:Fe,getAccessTokenWithPopup:Fe,getIdTokenClaims:Fe,loginWithRedirect:Fe,loginWithPopup:Fe,logout:Fe,handleRedirectCallback:Fe}),ki=y.createContext(Xl),Jl=function(t){Tl(e,t);function e(n,r){var o=t.call(this,r||n)||this;return o.error=n,o.error_description=r,Object.setPrototypeOf(o,e.prototype),o}return e}(Error),Ql=/[?&]code=[^&]+/,eu=/[?&]state=[^&]+/,tu=/[?&]error=[^&]+/,nu=function(t){return t===void 0&&(t=window.location.search),(Ql.test(t)||tu.test(t))&&eu.test(t)},Pi=function(t){return function(e){return"error"in e?new Jl(e.error,e.error_description):e instanceof Error?e:new Error(t)}},yo=Pi("Login failed"),Rn=Pi("Get access token failed"),Ti=function(t){var e;t?.redirectUri&&(console.warn("Using `redirectUri` has been deprecated, please use `authorizationParams.redirect_uri` instead as `redirectUri` will be no longer supported in a future version"),t.authorizationParams=t.authorizationParams||{},t.authorizationParams.redirect_uri=t.redirectUri,delete t.redirectUri),!((e=t?.authorizationParams)===null||e===void 0)&&e.redirectUri&&(console.warn("Using `authorizationParams.redirectUri` has been deprecated, please use `authorizationParams.redirect_uri` instead as `authorizationParams.redirectUri` will be removed in a future version"),t.authorizationParams.redirect_uri=t.authorizationParams.redirectUri,delete t.authorizationParams.redirectUri)},ru=function(t,e){switch(e.type){case"LOGIN_POPUP_STARTED":return ue(ue({},t),{isLoading:!0});case"LOGIN_POPUP_COMPLETE":case"INITIALISED":return ue(ue({},t),{isAuthenticated:!!e.user,user:e.user,isLoading:!1,error:void 0});case"HANDLE_REDIRECT_COMPLETE":case"GET_ACCESS_TOKEN_COMPLETE":return t.user===e.user?t:ue(ue({},t),{isAuthenticated:!!e.user,user:e.user});case"LOGOUT":return ue(ue({},t),{isAuthenticated:!1,user:void 0});case"ERROR":return ue(ue({},t),{isLoading:!1,error:e.error})}},ou=function(t){return Ti(t),ue(ue({},t),{auth0Client:{name:"auth0-react",version:"2.0.1"}})},iu=function(t){window.history.replaceState({},document.title,t?.returnTo||window.location.pathname)},su=function(t){var e=t.children,n=t.skipRedirectCallback,r=t.onRedirectCallback,o=r===void 0?iu:r,i=t.context,a=i===void 0?ki:i,c=_l(t,["children","skipRedirectCallback","onRedirectCallback","context"]),l=y.useState(function(){return new Yl(ou(c))})[0],u=y.useReducer(ru,Si),f=u[0],p=u[1],d=y.useRef(!1);y.useEffect(function(){d.current||(d.current=!0,function(){return ct(void 0,void 0,void 0,function(){var b,k,_;return lt(this,function(S){switch(S.label){case 0:return S.trys.push([0,7,,8]),b=void 0,nu()&&!n?[4,l.handleRedirectCallback()]:[3,3];case 1:return k=S.sent().appState,[4,l.getUser()];case 2:return b=S.sent(),o(k,b),[3,6];case 3:return[4,l.checkSession()];case 4:return S.sent(),[4,l.getUser()];case 5:b=S.sent(),S.label=6;case 6:return p({type:"INITIALISED",user:b}),[3,8];case 7:return _=S.sent(),p({type:"ERROR",error:yo(_)}),[3,8];case 8:return[2]}})})}())},[l,o,n]);var h=y.useCallback(function(b){return Ti(b),l.loginWithRedirect(b)},[l]),m=y.useCallback(function(b,k){return ct(void 0,void 0,void 0,function(){var _,S;return lt(this,function(I){switch(I.label){case 0:p({type:"LOGIN_POPUP_STARTED"}),I.label=1;case 1:return I.trys.push([1,3,,4]),[4,l.loginWithPopup(b,k)];case 2:return I.sent(),[3,4];case 3:return _=I.sent(),p({type:"ERROR",error:yo(_)}),[2];case 4:return[4,l.getUser()];case 5:return S=I.sent(),p({type:"LOGIN_POPUP_COMPLETE",user:S}),[2]}})})},[l]),v=y.useCallback(function(b){return b===void 0&&(b={}),ct(void 0,void 0,void 0,function(){return lt(this,function(k){switch(k.label){case 0:return[4,l.logout(b)];case 1:return k.sent(),(b.openUrl||b.openUrl===!1)&&p({type:"LOGOUT"}),[2]}})})},[l]),g=y.useCallback(function(b){return ct(void 0,void 0,void 0,function(){var k,_,S,I;return lt(this,function(R){switch(R.label){case 0:return R.trys.push([0,2,3,5]),[4,l.getTokenSilently(b)];case 1:return k=R.sent(),[3,5];case 2:throw _=R.sent(),Rn(_);case 3:return S=p,I={type:"GET_ACCESS_TOKEN_COMPLETE"},[4,l.getUser()];case 4:return S.apply(void 0,[(I.user=R.sent(),I)]),[7];case 5:return[2,k]}})})},[l]),w=y.useCallback(function(b,k){return ct(void 0,void 0,void 0,function(){var _,S,I,R;return lt(this,function(W){switch(W.label){case 0:return W.trys.push([0,2,3,5]),[4,l.getTokenWithPopup(b,k)];case 1:return _=W.sent(),[3,5];case 2:throw S=W.sent(),Rn(S);case 3:return I=p,R={type:"GET_ACCESS_TOKEN_COMPLETE"},[4,l.getUser()];case 4:return I.apply(void 0,[(R.user=W.sent(),R)]),[7];case 5:return[2,_]}})})},[l]),j=y.useCallback(function(){return l.getIdTokenClaims()},[l]),O=y.useCallback(function(b){return ct(void 0,void 0,void 0,function(){var k,_,S;return lt(this,function(I){switch(I.label){case 0:return I.trys.push([0,2,3,5]),[4,l.handleRedirectCallback(b)];case 1:return[2,I.sent()];case 2:throw k=I.sent(),Rn(k);case 3:return _=p,S={type:"HANDLE_REDIRECT_COMPLETE"},[4,l.getUser()];case 4:return _.apply(void 0,[(S.user=I.sent(),S)]),[7];case 5:return[2]}})})},[l]),C=y.useMemo(function(){return ue(ue({},f),{getAccessTokenSilently:g,getAccessTokenWithPopup:w,getIdTokenClaims:j,loginWithRedirect:h,loginWithPopup:m,logout:v,handleRedirectCallback:O})},[f,g,w,j,h,m,v,O]);return y.createElement(a.Provider,{value:C},e)},au=function(t){return t===void 0&&(t=ki),y.useContext(t)};const on={[Qe.WINDOW_MANAGEMENT]:{heading:"Allow Window Management",description:"io.Connect Browser requires permission to arrange windows on your desktop.",guidelines:{default:"To allow window management, click the icon to the left of the address bar."},label:"Allow window management",Image:jl,openPermissionsPrompt:({handleDeferredPermission:t,handlePermissionsPromptClose:e})=>{window.getScreenDetails().catch(async()=>{const{state:n}=await navigator.permissions.query({name:Qe.WINDOW_MANAGEMENT});n==="prompt"&&t()}).finally(e)}},[Qe.NOTIFICATIONS]:{heading:"Allow Browser Notifications",description:`io.Connect Browser requires permission to send notifications to the desktop.
47
- This won't allow any other browser notifications.`,guidelines:{default:"To allow browser notifications, click the icon to the left of the address bar.",edge:'To allow browser notifications, click the icon to the left of the address bar, or the "Bell" icon to the right of the address bar.'},label:"Allow browser notifications",Image:yl,openPermissionsPrompt:({handleDeferredPermission:t,handlePermissionsPromptClose:e})=>{Notification.requestPermission().then(async()=>{const{state:n}=await navigator.permissions.query({name:Qe.NOTIFICATIONS});n==="prompt"&&t()}).finally(e)}}},cu={edgeNotificationsPermissionTimeout:15e3};const lu=({isActiveItem:t=()=>!1,permissionStatuses:e})=>s.jsx("ul",{className:"permissions-list",children:Object.entries(on).map(([n,r],o)=>{const i=t(n),a=e.find(({stableName:c})=>c===n);return s.jsxs("li",{className:G("permissions-list-item",i&&"active"),children:[s.jsx("div",{children:a?.state==="granted"?s.jsx(oe,{name:"check"}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:i?"icon-arrow":""}),s.jsxs("span",{children:[o+1,"."]})]})}),r.label]},n)})}),uu=({onReopenPromptClick:t})=>{const e=s.jsxs(s.Fragment,{children:['Please, click "Allow" when the browser prompt appears.',s.jsx("br",{}),s.jsxs("strong",{children:["If a browser prompt doesn't appear, click the icon to the left of the",s.jsx("br",{}),"address bar to manually grant the permission."]})]});return s.jsx(vn,{description:e,Image:Cl,title:"Something went wrong!",children:s.jsx(pn,{className:"io-btn-primary permissions-prompt-button",onClick:t,children:"Reopen the Prompt"})})},_i=({deniedPermissionName:t})=>{const{permission:e}=Ge(),r=lr().name?.toLowerCase()||"",o=Object.values(e.statuses).filter(a=>a.stableName===t||a.state==="denied"),i=s.jsxs(s.Fragment,{children:["The current browser settings block critical functionalities of io.Connect Browser.",s.jsx("br",{}),"To enable io.Connect Browser to operate properly, you must grant browser permissions manually."]});return s.jsx(vn,{description:i,Image:Ol,title:"Setup Was Unsuccessful",children:s.jsx("ul",{className:"permissions-guidelines-list",children:o.map((a,c)=>s.jsx("li",{children:on[a.stableName].guidelines[r]||on[a.stableName].guidelines.default},c))})})},du=({edgeNotificationsPermissionTimeout:t,isNotificationsPermissionPromptOpen:e})=>{const{name:n}=lr(),{permission:r}=Ge(),[o,i]=y.useState(!1);return y.useEffect(()=>{if(!e||n!=="Edge")return;const a=setTimeout(()=>i(!0),t);return()=>clearTimeout(a)},[n,t,e]),y.useEffect(()=>{if(!o)return;r.statuses.some(({stableName:c,state:l})=>c===Qe.NOTIFICATIONS&&l==="granted")&&i(!1)},[o,r.statuses]),{hasEdgeNotificationsPermissionError:o}},zt=()=>s.jsx("span",{className:"loader"}),fu=({settings:t})=>{const{permission:e}=Ge(),[n,r]=y.useState(!1),[o,i]=y.useState(!1),a=e.statuses.find(({state:p})=>p==="prompt"),{hasEdgeNotificationsPermissionError:c}=du({edgeNotificationsPermissionTimeout:t.edgeNotificationsPermissionTimeout,isNotificationsPermissionPromptOpen:o&&a?.stableName===Qe.NOTIFICATIONS});if(!a||e.isDenied)throw new Error('The "PermissionSteps" component should not be used in case there is no pending permission or there is a denied permission.');if(c)return s.jsx(_i,{deniedPermissionName:"notifications"});const l=on[a.stableName],u=()=>{i(!0),l.openPermissionsPrompt({handleDeferredPermission:()=>r(!0),handlePermissionsPromptClose:()=>i(!1)})},f=()=>{r(!1),u()};return n?s.jsx(uu,{onReopenPromptClick:f}):s.jsxs(vn,{description:l.description,heading:l.heading,Image:l.Image,title:"First-Time User Setup",children:[s.jsx(lu,{isActiveItem:p=>p===a.stableName,permissionStatuses:e.statuses}),s.jsx("p",{className:"mb-12 permissions-prompt-instructions",children:'Click "Allow" when the prompt appears.'}),s.jsx(pn,{className:"io-btn-primary permissions-prompt-button",disabled:o,onClick:u,children:"Open Permission Prompt"}),o&&s.jsx(zt,{})]})},pu=({settings:t})=>{const{permission:e}=Ge();return e.isLoading?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mb-32",children:"Checking browser permissions ..."}),s.jsx(zt,{})]}):e.isDenied?s.jsx(_i,{}):s.jsx(fu,{settings:t})},bn=({components:{Logo:t=rt}={},settings:e={}})=>s.jsx(vi,{Logo:t,children:s.jsx(pu,{settings:{...cu,...e}})}),Ii=({components:t,className:e})=>{const n=t?.Logo||rt;return s.jsx("div",{className:"logout-backdrop",children:s.jsxs("div",{className:G(e,"logout-container flex flex-column ai-center"),children:[s.jsx(n,{}),s.jsx("h1",{className:"text-center mb-8",children:"Logging out..."}),s.jsx(zt,{})]})})},Sr=({className:t="text-center mb-3",text:e="Making Your Work Flow"})=>s.jsxs(s.Fragment,{children:[s.jsx("h1",{className:t,children:e}),s.jsx("p",{children:"Integrate apps, simplify user experiences and accelerate digital transformation."})]}),hu=({components:t})=>{const e=t?.Logo||rt,n=t?.Heading||Sr;return s.jsxs(s.Fragment,{children:[s.jsx(e,{}),s.jsx(n,{}),s.jsx(zt,{})]})},Ni=({onLogin:t})=>s.jsx(di,{children:s.jsx(Wt,{onClick:t,className:"io-btn-primary",children:"Log In"})}),kr=()=>s.jsxs(s.Fragment,{children:[s.jsx("h1",{className:"text-center mb-8",children:"Verifying credentials..."}),s.jsx(zt,{})]}),Pr=({Logo:t,children:e,className:n})=>s.jsxs("div",{className:G(n,"login-container flex flex-column ai-center"),children:[s.jsx(t,{}),e]}),Ai=({className:t,onLogin:e,isLoading:n,components:r})=>{const o=r?.Logo||rt,i=r?.Heading||Sr;return s.jsx(Pr,{className:t,Logo:o,children:n?s.jsx(kr,{}):s.jsxs(s.Fragment,{children:[s.jsx(i,{}),s.jsx(Ni,{onLogin:e})]})})},bo=(t,e)=>{const n=e.value,r=n.trim().length>3;return{value:n,isValid:r}},mu=({onLogin:t,setIsLoading:e,loginError:n,setLoginError:r,userInputName:o})=>{const[i,a]=y.useReducer(bo,{value:"",isValid:!1}),[c,l]=y.useReducer(bo,{value:"",isValid:!1}),[u,f]=y.useState(!1),[p,d]=y.useState(!1),{isValid:h}=i,{isValid:m}=c,v=h&&m,g=b=>a({value:b.target.value}),w=b=>l({value:b.target.value}),j=()=>{h||f(!0)},O=()=>{m||d(!0)},C=async b=>{if(b.preventDefault(),!!v){e(!0);try{await t(i.value,c.value)}catch(k){r(k)}e(!1)}};return s.jsxs(di,{onSubmit:C,children:[s.jsxs(nr,{className:"io-control-input io-control-error",children:[s.jsx("input",{autoFocus:!0,autoComplete:"off",type:"text",placeholder:`Enter your ${o??"email"}`,value:i.value,onChange:g,onBlur:j,onFocus:()=>f(!1),className:G("io-input",u&&"input-error")}),u&&s.jsxs("div",{children:[s.jsx(oe,{name:"close"}),`The ${o??"email"} does not meet the length requirements`]})]}),s.jsxs(nr,{className:"io-control-input io-control-error",children:[s.jsx("input",{autoComplete:"off",type:"password",placeholder:"Enter your password",value:c.value,onChange:w,onBlur:O,onFocus:()=>d(!1),className:G("io-input",p&&"input-error")}),p&&s.jsxs("div",{children:[s.jsx(oe,{name:"close"}),"The password does not meet the length requirements"]})]}),s.jsx(pn,{type:"submit",className:"io-btn-primary",children:"Log In"}),n&&s.jsxs("div",{className:"pb-2 login-error-feedback",children:[s.jsx(oe,{name:"close"}),s.jsx("p",{children:n.message})]})]})};const Ri=({className:t,onLogin:e,components:n,userInputName:r})=>{const[o,i]=y.useState(!1),[a,c]=y.useState(null),l=n?.Logo||rt,u=n?.Heading||Sr;return s.jsx(Pr,{className:G(t,"simple-login"),Logo:l,children:o?s.jsx(kr,{}):s.jsxs(s.Fragment,{children:[s.jsx(u,{}),s.jsx(mu,{onLogin:e,setIsLoading:i,loginError:a,setLoginError:c,userInputName:r})]})})},vu=ye({id:fe,username:$(fe),email:$(fe),firstName:$(fe),lastName:$(fe),avatarUrl:$(fe),token:$(fe),password:$(fe)}),gu=t=>{const{onLogout:e,user:n,launchpad:r,icon:o}=t;return s.jsx(Qi,{user:n,onLogout:e,icon:o,components:r?.components})},Li=y.createContext(void 0),yu=()=>{const t=y.useContext(Li);if(t===void 0)throw new Error("useWorkspaceComponentsContext must be used within an WorkspaceComponentsContextProvider");return t},bu=()=>{const{HeaderLogoArea:t,workspaceLogoProps:e}=yu();return t?s.jsx(t,{...e}):s.jsx(gu,{...e})};function wu(t,e){const[n,r]=y.useState(!0),o=y.useContext(ee.IOConnectContext);return y.useEffect(()=>{let i;return(async()=>{if(!o.workspaces)return;let a;try{a=await o.workspaces.getWorkspaceById(t)}catch(l){console.warn(l);return}const c=a.getAllGroups().find(l=>l.id===e);c&&(i=await c.onLockConfigurationChanged(({showAddWindowButton:l})=>{l!==void 0&&r(l)}),r(!!c.showAddWindowButton))})(),()=>i?.()},[t,e,o.workspaces]),n}const xu=({groupId:t,workspaceId:e})=>{const n=wu(e,t),r=y.useCallback(o=>{ht.showAddApplicationPopup({bounds:o,groupId:t,workspaceId:e})},[t,e]);return n&&s.jsx(ht.AddWindowButton,{title:"Add App",visible:n,showPopup:r})},Cu=t=>s.jsx(ht.GroupHeaderButtons,{...t,addWindow:{visible:!1,showPopup:t.addWindow.showPopup}}),Tr=({onLogout:t,user:e,workspaces:n,launchpad:r})=>{const o=n?.HeaderLogoArea,i={onLogout:t,user:e,launchpad:r};return s.jsx(Li.Provider,{value:{workspaceLogoProps:i,HeaderLogoArea:o},children:s.jsx(ht,{components:{...n?.components,header:{...n?.components?.header,LogoComponent:bu},groupHeader:{AfterTabsComponent:xu,ButtonsComponent:Cu,...n?.components?.groupHeader}}})})},Ou=({config:t})=>{const{setupFlow:e,getIOConnectConfig:n}=t,r=t.login,{permission:o}=Ge(),[i,a]=an("localStorage",ls,vu),[c,l]=y.useState(!1),u=y.useCallback(async(p,d)=>{const h=await r.onLogin(p,d);a(h)},[r,a]),f=y.useCallback(()=>{l(!0),r.onLogout?.(),a(null)},[r,a]);return c?s.jsx(Ii,{components:r.components}):i?!o.isSetupCompleted&&e?.enabled!==!1?s.jsx(bn,{settings:e?.settings,components:e?.components}):s.jsx(ee.IOConnectProvider,{settings:n(i),children:s.jsx(Tr,{workspaces:t?.workspaces,launchpad:t?.launchpad,onLogout:f,user:i})}):s.jsx(Ri,{onLogin:u,components:r.components,userInputName:r.userInputName})},ir={POPUP:"popup",REDIRECT:"redirect"},ju=({config:t})=>{const[e,n]=y.useState(void 0),{permission:r}=Ge(),o=au(),{setupFlow:i,getIOConnectConfig:a}=t,c=t.login.components?.Logo||rt,u=(t.login.loginType??ir.REDIRECT)===ir.REDIRECT?o.loginWithRedirect:o.loginWithPopup,f=y.useMemo(()=>o.user?.email?{username:o.user.name,id:o.user.email,token:e}:null,[o.user,e]);return y.useEffect(()=>{o.isAuthenticated&&o.getAccessTokenSilently().then(n).catch(console.warn)},[o]),!o.isAuthenticated||!f?s.jsx(Ai,{isLoading:o.isLoading,onLogin:u,components:t.login.components}):e?!r.isSetupCompleted&&i?.enabled!==!1?s.jsx(bn,{settings:i?.settings,components:i?.components}):s.jsx(ee.IOConnectProvider,{settings:a({...o.user,token:e}),children:s.jsx(Tr,{workspaces:t.workspaces,launchpad:t.launchpad,onLogout:o.logout,user:f})}):s.jsx(Pr,{Logo:c,children:s.jsx(kr,{})})},Eu=({config:t})=>{const{setupFlow:e,ioConnectConfig:n}=t,{permission:r}=Ge();return!r.isSetupCompleted&&e?.enabled!==!1?s.jsx(bn,{settings:e?.settings,components:e?.components}):s.jsx(ee.IOConnectProvider,{settings:n,children:s.jsx(Tr,{workspaces:t.workspaces,launchpad:t.launchpad})})},Mi=ye({Logo:$(me().andThen(t=>Re(t,"Logo"))),Heading:$(me().andThen(t=>Re(t,"Heading")))}),Su=Xt(...Object.values(ir).map(t=>Rt(t))),ku=ye({type:Rt("auth0"),loginType:$(Su),providerOptions:me(),components:$(Mi)}),Pu=ye({type:Rt("simple"),onLogin:me().andThen(t=>Re(t,"onLogin")),onLogout:$(me().andThen(t=>Re(t,"onLogout"))),userInputName:$(fe),components:$(Mi)}),Tu=Xt(ku,Pu),_u=ye({edgeNotificationsPermissionTimeout:$(bs)}),Iu=ye({Logo:$(me().andThen(t=>Re(t,"Logo")))}),Nu=ye({enabled:$(Lo()),components:$(Iu),settings:$(_u)}),Au=ye({components:$(me()),HeaderLogoArea:$(me().andThen(t=>Re(t,"HeaderLogoArea")))}),Ru=ye({sections:$(me()),Sections:$(me().andThen(t=>Re(t,"Sections"))),NotificationsPanel:$(Xt(me().andThen(t=>Re(t,"NotificationsPanel")),Rt(null))),UserPanel:$(Xt(me().andThen(t=>Re(t,"UserPanel")),Rt(null)))}),Lu=ye({components:$(Ru)}),Mu=ye({getIOConnectConfig:me().andThen(t=>Re(t,"getIOConnectConfig")),login:$(Tu),setupFlow:$(Nu),workspaces:$(Au),launchpad:$(Lu)}),Du=({config:t})=>{const e=Mu.runWithException(t),n=e.login,r=e.launchpad?.components;if(r?.sections&&r?.Sections)throw new Error("Launchpad sections are overspecified. Please provide either a JSX element or a React component.");if(n?.type==="simple")return s.jsx(Ou,{config:e});if(n?.type==="auth0"){const{providerOptions:o}=n;return s.jsx(su,{...o,authorizationParams:{...o.authorizationParams,redirect_uri:o.authorizationParams?.redirect_uri??window.location.origin},children:s.jsx(ju,{config:e})})}return s.jsx(Eu,{config:e})},Di=()=>"getScreenDetails"in window,Fu=({config:t})=>Di()?s.jsx(wi,{children:s.jsx(Du,{config:t})}):s.jsx(gi,{}),Fi=t=>t?.split(" ").map(e=>e[0]?.toUpperCase()).join(""),Ui=y.forwardRef((t,e)=>{const{onSearch:n,searchTerm:r,onClear:o}=t,i=y.useContext(ee.IOConnectContext);return y.useEffect(()=>{!i||!i.search||i.search.setDebounceMS(450)},[i]),s.jsxs("div",{className:"search","data-testid":"search-bar",children:[s.jsx("input",{type:"search",ref:e,className:"io-input",placeholder:"Find anything",value:r,onChange:n}),s.jsx(oe,{name:"delete-left",className:r.length!==0?"active":"",onClick:o,"data-testid":"delete-icon"})]})}),Uu=t=>t.reduce((e,n)=>{const{type:r}=n,o=n.id||n.displayName;if(!o||r.name===Ue.LAYOUT)return e;let i=[];r.name===Ue.APPLICATION?i=So:r.name===Ue.WORKSPACE?i=ko:n.secondaryActions&&(i=n.secondaryActions.map(({name:u,method:f,params:p,target:d})=>({name:u,interopParams:{method:f,params:p,target:d}})));const a={id:o,title:n.displayName||o,description:n.description,type:r.name,iconSrc:n.iconURL,mainAction:n.action,contextMenuActions:i},c=e.findIndex(({title:u})=>r.displayName?u===r.displayName:u===r.name),l=e[c];return l?[...e.slice(0,c),{...l,items:[...l.items,a]},...e.slice(c+1)]:[...e,{id:r.name,title:r.displayName||r.name,items:[a]}]},[]);function Hi(t){const{resultsToRender:e,isLoading:n}=_s(t.searchTerm),r=xt(),o=Os(),i=Ho(),a=Wo(),c=Uu(e),l=zo(),u=Vo(),f=(d,h)=>{const m=d.type===Ue.APPLICATION?l:d.type===Ue.WORKSPACE?u:null;m&&m(d,h)},p=async(d,h)=>{const{item:m,modifier:v,selectedContextMenuActionName:g}=h,{type:w,id:j,mainAction:O}=m,C=g?m.contextMenuActions?.find(b=>b.name===g):null;C?.interopParams?o(C.interopParams):g?f(m,g):O?o(O):w===Ue.APPLICATION?a(j,v).catch(b=>{console.error("Failed to start application",{error:b})}):w===Ue.WORKSPACE&&i(j,v).catch(b=>{console.error("Failed to restore workspace",{error:b})}),v!==ln.SHIFT&&r.close()};return n?s.jsx("p",{style:{padding:"12px 24px"},children:"Loading..."}):e.length===0?s.jsx("p",{style:{padding:"12px 24px"},children:"No results found."}):s.jsx("ul",{children:c.map((d,h)=>s.jsx(hn,{config:d,isFavoritismEnabled:!1,onItemClick:p},d.id||h))})}const Hu=(t,e,n)=>{const{isSectionCollapsible:r,sortOrder:o=At.ASCENDING,...i}=n;return{id:"workspaces-section",title:"Workspaces",items:sr({items:t,sortOrder:o,ascendingCompare:Po,descendingCompare:To}).map(l=>({...l,type:Ue.WORKSPACE,isOpen:e[l.title]?.length>0,contextMenuActions:ko})),isCollapsible:r,...i}},Wi=t=>{const{displayCount:e,isSectionCollapsible:n,showAllItems:r,sortOrder:o}=t,i=Is(),a=Ns(),c=Ho(),l=Vo(),u=y.useMemo(()=>Hu(i,a,{...{displayCount:e,showAllItems:r},isSectionCollapsible:n,sortOrder:o}),[i,a,e,n,r,o]),f=p=>{const{item:d,modifier:h,selectedContextMenuActionName:m}=p;if(!m)return c(d.id,h).catch(v=>{console.error("Failed to restore workspace",{error:v})});l(d,m)};return s.jsx(mn,{config:u,onItemClick:f})},Wu=()=>s.jsxs(s.Fragment,{children:[s.jsx(yi,{}),s.jsx(Wi,{}),s.jsx(mi,{})]}),zu={success:"check"},wo={SET_AS_DEFAULT:"setAsDefault",DELETE:"delete"},Vu=t=>[{name:wo.SET_AS_DEFAULT,displayName:"Set as Default",disabled:t.isDefault},{name:wo.DELETE,displayName:"Delete",disabled:t.name===ni||t.isDefault}],xo=t=>async e=>{e.stopPropagation();try{await t()}catch(n){console.error("Failed to handle layout action: ",n)}},Bu=t=>{const{layouts:e}=t,{setSelectedLayout:n,setDefaultLayout:r}=xt(),o=zs(),i=cr();return s.jsxs("div",{"data-testid":"available-layouts",children:[s.jsx("h6",{children:"Available Layouts"}),e.map(a=>s.jsxs("div",{className:G("layouts-item flex ai-center",a.isSelected&&"active"),"data-testid":"layout-item",children:[s.jsx("div",{className:"loaded me-8",children:a.isSelected&&s.jsx(oe,{size:12,name:"check"})}),s.jsx("div",{className:G("name",{bold:a.isSelected}),onClick:()=>{i(a.name,n)},children:a.name}),s.jsxs("div",{className:"type",children:[a.type,a.isDefault?"/Default":""]}),s.jsx(vr,{iconSize:16,iconName:"ellipsis",actions:Vu(a),onActionItemClick:(c,l)=>o(a,l.name,r)})]},a.name))]})},Co=t=>{const{inputValue:e,setNotification:n,className:r=""}=t,{selectedLayout:o,setSelectedLayout:i}=xt(),a=cr(),c=y.useContext(ee.IOConnectContext),l=[{label:"Save",type:"save",onClick:xo(async()=>{await c.layouts.save({name:e,type:"Global"}),i({name:e}),n({message:"Saved",type:"success"})}),testId:"save-button"},{label:"Restore",type:"restore",onClick:xo(()=>{o&&a(o.name)}),testId:"restore-button"}];return s.jsx("div",{className:G("layout-actions",r),"data-testid":"layout-actions",children:l.map(({label:u,type:f,disabled:p,onClick:d,testId:h})=>s.jsx("button",{onClick:d,disabled:p,className:"io-btn","data-testid":h,children:u},f))})},Zu=({className:t,message:e,type:n})=>s.jsxs("div",{className:G("layout-notification",`layout-notification-${n}`,t),"data-testid":"layout-notification",children:[s.jsx(oe,{size:12,name:zu[n]}),s.jsx("span",{"data-testid":"layout-notification-message",children:e})]}),zi=()=>{const t=y.useRef(null),[e,n]=y.useState(!1),[r,o]=y.useState(null),i=js(),{defaultLayout:a,selectedLayout:c}=xt(),[l,u]=y.useState("");y.useEffect(()=>{if(!e)return;const p=h=>{t.current?.contains(h.target)||n(!1)},d=()=>{document.activeElement?.nodeName==="IFRAME"&&n(!1)};return document.addEventListener("click",p,!0),window.addEventListener("blur",d,!0),()=>{document.removeEventListener("click",p,!0),window.removeEventListener("blur",d,!0)}},[e]),y.useEffect(()=>{if(!r)return;const p=setTimeout(()=>o(null),3e3);return()=>clearTimeout(p)},[r]),y.useEffect(()=>{c&&u(c.name)},[c]);const f=()=>{n(p=>!p),c&&u(c.name)};return s.jsxs("footer",{className:"footer",ref:t,"data-testid":"layouts-panel",children:[s.jsxs("div",{"aria-label":"Layouts panel","aria-expanded":e,role:"button",...mt(f),className:"selected-layout flex ai-center","data-testid":"selected-layout",children:[s.jsx("span",{className:G("name",{hidden:e}),"data-testid":"selected-layout-name",children:c?.name||"No selected layout"}),s.jsxs("div",{className:"flex ai-center","data-testid":"layout-actions-and-toggle",children:[!e&&s.jsx(Co,{inputValue:l,setNotification:o}),s.jsx(oe,{className:G("ms-8","layouts-panel-toggle-button",{"layouts-panel-toggle-button-rotated":e}),name:"chevron-up","data-testid":"layouts-panel-toggle"})]})]}),s.jsx(li,{isOpen:e,children:s.jsxs("div",{className:"layouts-container",children:[s.jsxs("div",{className:"layouts-settings",children:[s.jsx("input",{className:"io-input",onChange:p=>u(p.target.value),value:l,"data-testid":"layout-name-input"}),s.jsx(Co,{className:"group",inputValue:l,setNotification:o})]}),s.jsx(Bu,{layouts:i.map(p=>({...p,isSelected:p.name===c?.name,isDefault:p.name===a?.name}))})]})}),r?s.jsx(Zu,{className:G({"ms-8 me-8":e}),message:r.message,type:r.type}):s.jsx("div",{className:"powered-by",children:"Powered by io.Connect Browser"})]})},$u=t=>{const e=new Date(t),n=e.getHours(),r=e.getMinutes().toString().padStart(2,"0"),o=e.getSeconds().toString().padStart(2,"0"),i=n>=12?"PM":"AM",a=e.getMonth()+1,c=e.getDate(),l=e.getFullYear();return`${n%12}:${r}:${o} ${i} ${a}/${c}/${l}`},Vi=t=>{const{severity:e="None",id:n,timestamp:r,title:o,body:i,actions:a}=t.notificationData,c=y.useContext(ee.IOConnectContext),l=()=>{c&&c.notifications.clear(n).catch(console.error)},u=async p=>{p.stopPropagation();try{await c.notifications.click(n),l()}catch(d){console.error(d)}},f=a?.map(({action:p,title:d})=>({children:d,onClick:async h=>{h.stopPropagation();try{await c.notifications.click(n,p),l()}catch(m){console.error(m)}}}));return s.jsxs("div",{className:"notifications-list-item",style:{borderLeftColor:Es[e]},onClick:u,"data-testid":"notification-container",children:[s.jsxs("div",{className:"notification-header","data-testid":"notification-header",children:[s.jsx("h4",{children:o}),s.jsx(oe,{onClick:p=>{p.stopPropagation(),l()},className:"io-btn close-btn",size:16,name:"close","data-testid":"close-icon"})]}),i&&s.jsx("p",{"data-testid":"notification-body",children:i}),r&&s.jsx("p",{"data-testid":"notification-timestamp",children:$u(r)}),f&&s.jsx(gn,{className:"notification-actions","data-testid":"notification-actions",items:f})]})},_r=t=>{const{className:e}=t,n=Fo().length;return n>0?s.jsx("span",{className:G("notifications-badge",e),"data-testid":"notifications-badge",children:n<10?n:"9+"}):null},Bi=t=>{const{className:e,iconSize:n=24,...r}=t;return s.jsxs("div",{className:G(e,"notifications-icon"),"data-testid":"notifications-icon",...r,children:[s.jsx(oe,{size:n,name:"bell"}),s.jsx(_r,{})]})},Zi=()=>{const{onNotificationsSort:t,sortedNotifications:e}=Ts(),n=y.useContext(ee.IOConnectContext),r=y.useCallback(()=>{n&&n.notifications.clearAll().catch(console.error)},[n]);return s.jsxs("div",{className:"notifications-panel","data-testid":"notifications-panel",children:[s.jsxs("div",{className:"header","data-testid":"notifications-panel-header",children:[s.jsx("div",{className:"header-caption",children:s.jsxs("div",{children:["Notifications (",e.length,")"]})}),s.jsx(gn,{items:[{children:"Latest",onClick:()=>t("timestamp")},{children:"By Priority",onClick:()=>t("severity")}]})]}),e.length?s.jsx("div",{className:"notifications-list","data-testid":"notifications-list",children:e.map(o=>s.jsx(Vi,{notificationData:o},o.id))}):s.jsx("div",{className:"no-notifications",children:"No notifications"}),s.jsx("div",{className:"footer","data-testid":"notifications-panel-footer",children:s.jsx(Wt,{children:"Clear All",onClick:r})})]})},Gu=({user:t})=>{const e=y.useContext(ee.IOConnectContext),n=t?.username||"N A";return s.jsxs("div",{className:"flex info info-top",children:[s.jsxs("div",{children:[s.jsx("h4",{children:n}),s.jsxs("p",{children:["PROD"," | ","Version "+e.version]})]}),s.jsx("div",{className:"flex badge",children:Fi(n)})]})},$i=()=>{const t=y.useContext(ee.IOConnectContext),[e,n]=y.useState([]);y.useEffect(()=>{t&&t.themes?.list().then(o=>n(o)).catch(console.warn)},[t]);const r=async(o,i)=>{i.name&&t.themes?.select(i.name).catch(console.warn)};return s.jsxs("div",{className:"info info-middle",children:[s.jsx("h4",{children:"Settings"}),s.jsxs("div",{className:"flex ai-center",children:[s.jsx("label",{style:{textAlign:"right",width:"40%"},children:"Theme"}),s.jsx("div",{style:{width:"60%",marginLeft:"auto"},children:s.jsx(gn,{onItemClick:r,items:e.map(({name:o,displayName:i})=>({name:o,children:i}))})})]})]})},Gi=({title:t,description:e,links:n=[],onLogout:r,user:o})=>{const[i,a]=an("sessionStorage",Ro,ti),c=y.useContext(ee.IOConnectContext),l=async()=>{try{r?.()}catch(u){console.error(u)}a(null),await c.webPlatform?.system.shutdown(),window.location.reload()};return s.jsxs("div",{className:"info info-bottom flex flex-column",children:[s.jsx("h4",{children:t||"Support"}),s.jsx("p",{children:e||"New set of thoughtfully curated items and the ability to configure them."}),s.jsx("ul",{children:n.map(({children:u,...f})=>s.jsx("li",{children:s.jsx("a",{...f,children:u})},f.href))}),o?.id&&s.jsx("div",{children:s.jsx(Wt,{onClick:l,children:"Log Out"})})]})},qi=({onLogout:t,user:e})=>s.jsxs(s.Fragment,{children:[s.jsx(Gu,{user:e}),s.jsx($i,{}),s.jsx(Gi,{onLogout:t,user:e})]}),Ki=t=>{const{initials:e,className:n,...r}=t;return s.jsx("div",{className:G(n,"user-panel-icon"),...r,children:e})},Oo=({children:t,closeFn:e,open:n=!1,showCloseButton:r=!0})=>{const o=y.useRef(null);return y.useEffect(()=>{n?o.current?.showModal():o.current?.close()},[n]),s.jsx("dialog",{ref:o,onClose:()=>{n&&e()},onClick:i=>{i.target.nodeName==="DIALOG"&&e()},children:s.jsxs("div",{className:"dialog-backer",children:[r&&s.jsx(oe,{onClick:e,className:"btn-close io-btn io-btn-icon",size:16,name:"close"}),t]})})};function Yi(t){const{open:e,setOpen:n,onLogout:r,className:o,components:i={},user:a,...c}=t,[l,u]=y.useState(""),[f,p]=y.useState(!1),[d,h]=y.useState(!1),m=y.useRef(null),v=i?.NotificationsPanel!==null,g=i?.UserPanel!==null,w=i?.NotificationsPanel??Zi,j=i?.UserPanel??qi;y.useEffect(()=>{if(e){m.current?.focus();return}u("")},[e]);const O=_=>{u(_.target.value)},C=()=>{u("")},b=i.Sections?s.jsx(i.Sections,{}):i.sections,k=s.jsx(hl,{children:s.jsx("ul",{children:b??s.jsx(Wu,{})})});return s.jsxs(lc,{setOpen:n,isOpen:e,children:[s.jsxs("div",{className:G(o),...c,children:[s.jsxs("header",{children:[s.jsx(Ui,{ref:m,searchTerm:l,onSearch:O,onClear:C}),s.jsxs("div",{className:"action-area",children:[v&&s.jsx(Bi,{"aria-label":"Notifications",role:"button",...mt(()=>p(!0))}),g&&s.jsx(Ki,{initials:Fi(a?.username||"N A"),"aria-label":"Profile and Settings",role:"button",...mt(()=>h(!0))})]}),s.jsx(oe,{className:"btn-close io-btn io-btn-icon",size:16,name:"close",handleClick:()=>n(!1)})]}),s.jsx("main",{children:l.trim().length<3?k:s.jsx(Hi,{searchTerm:l})}),s.jsx(zi,{})]}),v&&s.jsx(Oo,{open:f,closeFn:()=>p(!1),children:s.jsx(w,{})}),g&&s.jsx(Oo,{open:d,closeFn:()=>h(!1),children:s.jsx(j,{onLogout:r,user:a})})]})}const Xi=()=>s.jsxs(s.Fragment,{children:[s.jsx(ht.Logo,{frameId:""}),s.jsx(_r,{})]}),qu="_workspaceLogo_t3m7s_1",jo={workspaceLogo:qu,"launchpad-popup":"_launchpad-popup_t3m7s_9","slide-in":"_slide-in_t3m7s_32"},Ji=t=>{const[e,n]=y.useState(!1),r=y.useRef(null),o=y.useRef(null),{icon:i,children:a}=t;return y.useEffect(()=>{if(!e)return;const c=u=>{const f=u.target!==r.current&&!r.current?.contains(u.target);!(u.target===o.current||o.current?.contains(u.target))&&f&&n(!1)},l=()=>{document.activeElement?.nodeName==="IFRAME"&&n(!1)};return document.addEventListener("mouseup",c,!0),window.addEventListener("blur",l,!0),()=>{document.removeEventListener("mouseup",c,!0),window.removeEventListener("blur",l,!0)}},[e]),s.jsxs("div",{ref:r,children:[s.jsx("button",{"aria-label":"Launchpad",onClick:()=>n(c=>!c),className:`io-logo ${e===!0?"active":""}`,ref:o,children:s.jsx("div",{className:"logo-wrapper",children:i})}),s.jsx("div",{children:s.jsx("div",{className:G(jo["launchpad-popup"],{[jo["slide-in"]]:e}),children:a({open:e,setOpen:n})})})]})},Qi=t=>{const{icon:e,components:n,user:r,onLogout:o}=t;return s.jsx(Ji,{icon:e??s.jsx(Xi,{}),children:({open:i,setOpen:a})=>s.jsx(Yi,{open:i,setOpen:a,components:n,user:r,onLogout:o})})};exports.ApplicationsSection=mi;exports.Auth0LoginForm=Ni;exports.Auth0LoginPage=Ai;exports.BaseSection=hn;exports.BaseSectionHeader=Ao;exports.BaseSectionItem=ei;exports.BrowserNotSupported=gi;exports.Button=Wt;exports.ButtonGroup=gn;exports.ContextMenu=Qo;exports.DropdownButton=vr;exports.FavoritesSection=yi;exports.IOConnectHome=Fu;exports.IOConnectHomeProvider=wi;exports.Icon=oe;exports.ImgIcon=ar;exports.Launchpad=Yi;exports.LaunchpadSlidePanel=Qi;exports.LayoutsPanel=zi;exports.LoginLoader=hu;exports.Logo=Xi;exports.LogoutPage=Ii;exports.Notification=Vi;exports.NotificationsBadge=_r;exports.NotificationsIcon=Bi;exports.NotificationsPanel=Zi;exports.PermissionsSetup=bn;exports.SearchBar=Ui;exports.SearchResults=Hi;exports.Section=mn;exports.SettingsCard=$i;exports.SimpleLoginPage=Ri;exports.SlidePanel=Ji;exports.SupportCard=Gi;exports.UserPanel=qi;exports.UserPanelIcon=Ki;exports.WorkspacesSection=Wi;exports.useFavoriteEntities=cn;exports.useIOConnectHome=Ge;exports.useIsBrowserSupported=Di;
47
+ This won't allow any other browser notifications.`,guidelines:{default:"To allow browser notifications, click the icon to the left of the address bar.",edge:'To allow browser notifications, click the icon to the left of the address bar, or the "Bell" icon to the right of the address bar.'},label:"Allow browser notifications",Image:yl,openPermissionsPrompt:({handleDeferredPermission:t,handlePermissionsPromptClose:e})=>{Notification.requestPermission().then(async()=>{const{state:n}=await navigator.permissions.query({name:Qe.NOTIFICATIONS});n==="prompt"&&t()}).finally(e)}}},cu={edgeNotificationsPermissionTimeout:15e3};const lu=({isActiveItem:t=()=>!1,permissionStatuses:e})=>s.jsx("ul",{className:"permissions-list",children:Object.entries(on).map(([n,r],o)=>{const i=t(n),a=e.find(({stableName:c})=>c===n);return s.jsxs("li",{className:G("permissions-list-item",i&&"active"),children:[s.jsx("div",{children:a?.state==="granted"?s.jsx(oe,{name:"check"}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:i?"icon-arrow":""}),s.jsxs("span",{children:[o+1,"."]})]})}),r.label]},n)})}),uu=({onReopenPromptClick:t})=>{const e=s.jsxs(s.Fragment,{children:['Please, click "Allow" when the browser prompt appears.',s.jsx("br",{}),s.jsxs("strong",{children:["If a browser prompt doesn't appear, click the icon to the left of the",s.jsx("br",{}),"address bar to manually grant the permission."]})]});return s.jsx(vn,{description:e,Image:Cl,title:"Something went wrong!",children:s.jsx(pn,{className:"io-btn-primary permissions-prompt-button",onClick:t,children:"Reopen the Prompt"})})},_i=({deniedPermissionName:t})=>{const{permission:e}=Ge(),r=lr().name?.toLowerCase()||"",o=Object.values(e.statuses).filter(a=>a.stableName===t||a.state==="denied"),i=s.jsxs(s.Fragment,{children:["The current browser settings block critical functionalities of io.Connect Browser.",s.jsx("br",{}),"To enable io.Connect Browser to operate properly, you must grant browser permissions manually."]});return s.jsx(vn,{description:i,Image:Ol,title:"Setup Was Unsuccessful",children:s.jsx("ul",{className:"permissions-guidelines-list",children:o.map((a,c)=>s.jsx("li",{children:on[a.stableName].guidelines[r]||on[a.stableName].guidelines.default},c))})})},du=({edgeNotificationsPermissionTimeout:t,isNotificationsPermissionPromptOpen:e})=>{const{name:n}=lr(),{permission:r}=Ge(),[o,i]=y.useState(!1);return y.useEffect(()=>{if(!e||n!=="Edge")return;const a=setTimeout(()=>i(!0),t);return()=>clearTimeout(a)},[n,t,e]),y.useEffect(()=>{if(!o)return;r.statuses.some(({stableName:c,state:l})=>c===Qe.NOTIFICATIONS&&l==="granted")&&i(!1)},[o,r.statuses]),{hasEdgeNotificationsPermissionError:o}},zt=()=>s.jsx("span",{className:"loader"}),fu=({settings:t})=>{const{permission:e}=Ge(),[n,r]=y.useState(!1),[o,i]=y.useState(!1),a=e.statuses.find(({state:p})=>p==="prompt"),{hasEdgeNotificationsPermissionError:c}=du({edgeNotificationsPermissionTimeout:t.edgeNotificationsPermissionTimeout,isNotificationsPermissionPromptOpen:o&&a?.stableName===Qe.NOTIFICATIONS});if(!a||e.isDenied)throw new Error('The "PermissionSteps" component should not be used in case there is no pending permission or there is a denied permission.');if(c)return s.jsx(_i,{deniedPermissionName:"notifications"});const l=on[a.stableName],u=()=>{i(!0),l.openPermissionsPrompt({handleDeferredPermission:()=>r(!0),handlePermissionsPromptClose:()=>i(!1)})},f=()=>{r(!1),u()};return n?s.jsx(uu,{onReopenPromptClick:f}):s.jsxs(vn,{description:l.description,heading:l.heading,Image:l.Image,title:"First-Time User Setup",children:[s.jsx(lu,{isActiveItem:p=>p===a.stableName,permissionStatuses:e.statuses}),s.jsx("p",{className:"mb-12 permissions-prompt-instructions",children:'Click "Allow" when the prompt appears.'}),s.jsx(pn,{className:"io-btn-primary permissions-prompt-button",disabled:o,onClick:u,children:"Open Permission Prompt"}),o&&s.jsx(zt,{})]})},pu=({settings:t})=>{const{permission:e}=Ge();return e.isLoading?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mb-32",children:"Checking browser permissions ..."}),s.jsx(zt,{})]}):e.isDenied?s.jsx(_i,{}):s.jsx(fu,{settings:t})},bn=({components:{Logo:t=rt}={},settings:e={}})=>s.jsx(vi,{Logo:t,children:s.jsx(pu,{settings:{...cu,...e}})}),Ii=({components:t,className:e})=>{const n=t?.Logo||rt;return s.jsx("div",{className:"logout-backdrop",children:s.jsxs("div",{className:G(e,"logout-container flex flex-column ai-center"),children:[s.jsx(n,{}),s.jsx("h1",{className:"text-center mb-8",children:"Logging out..."}),s.jsx(zt,{})]})})},Sr=({className:t="text-center mb-3",text:e="Making Your Work Flow"})=>s.jsxs(s.Fragment,{children:[s.jsx("h1",{className:t,children:e}),s.jsx("p",{children:"Integrate apps, simplify user experiences and accelerate digital transformation."})]}),hu=({components:t})=>{const e=t?.Logo||rt,n=t?.Heading||Sr;return s.jsxs(s.Fragment,{children:[s.jsx(e,{}),s.jsx(n,{}),s.jsx(zt,{})]})},Ni=({onLogin:t})=>s.jsx(di,{children:s.jsx(Wt,{onClick:t,className:"io-btn-primary",children:"Log In"})}),kr=()=>s.jsxs(s.Fragment,{children:[s.jsx("h1",{className:"text-center mb-8",children:"Verifying credentials..."}),s.jsx(zt,{})]}),Pr=({Logo:t,children:e,className:n})=>s.jsxs("div",{className:G(n,"login-container flex flex-column ai-center"),children:[s.jsx(t,{}),e]}),Ai=({className:t,onLogin:e,isLoading:n,components:r})=>{const o=r?.Logo||rt,i=r?.Heading||Sr;return s.jsx(Pr,{className:t,Logo:o,children:n?s.jsx(kr,{}):s.jsxs(s.Fragment,{children:[s.jsx(i,{}),s.jsx(Ni,{onLogin:e})]})})},bo=(t,e)=>{const n=e.value,r=n.trim().length>3;return{value:n,isValid:r}},mu=({onLogin:t,setIsLoading:e,loginError:n,setLoginError:r,userInputName:o})=>{const[i,a]=y.useReducer(bo,{value:"",isValid:!1}),[c,l]=y.useReducer(bo,{value:"",isValid:!1}),[u,f]=y.useState(!1),[p,d]=y.useState(!1),{isValid:h}=i,{isValid:m}=c,v=h&&m,g=b=>a({value:b.target.value}),w=b=>l({value:b.target.value}),j=()=>{h||f(!0)},O=()=>{m||d(!0)},C=async b=>{if(b.preventDefault(),!!v){e(!0);try{await t(i.value,c.value)}catch(k){r(k)}e(!1)}};return s.jsxs(di,{onSubmit:C,children:[s.jsxs(nr,{className:"io-control-input io-control-error",children:[s.jsx("input",{autoFocus:!0,autoComplete:"off",type:"text",placeholder:`Enter your ${o??"email"}`,value:i.value,onChange:g,onBlur:j,onFocus:()=>f(!1),className:G("io-input",u&&"input-error")}),u&&s.jsxs("div",{children:[s.jsx(oe,{name:"close"}),`The ${o??"email"} does not meet the length requirements`]})]}),s.jsxs(nr,{className:"io-control-input io-control-error",children:[s.jsx("input",{autoComplete:"off",type:"password",placeholder:"Enter your password",value:c.value,onChange:w,onBlur:O,onFocus:()=>d(!1),className:G("io-input",p&&"input-error")}),p&&s.jsxs("div",{children:[s.jsx(oe,{name:"close"}),"The password does not meet the length requirements"]})]}),s.jsx(pn,{type:"submit",className:"io-btn-primary",children:"Log In"}),n&&s.jsxs("div",{className:"pb-2 login-error-feedback",children:[s.jsx(oe,{name:"close"}),s.jsx("p",{children:n.message})]})]})};const Ri=({className:t,onLogin:e,components:n,userInputName:r})=>{const[o,i]=y.useState(!1),[a,c]=y.useState(null),l=n?.Logo||rt,u=n?.Heading||Sr;return s.jsx(Pr,{className:G(t,"simple-login"),Logo:l,children:o?s.jsx(kr,{}):s.jsxs(s.Fragment,{children:[s.jsx(u,{}),s.jsx(mu,{onLogin:e,setIsLoading:i,loginError:a,setLoginError:c,userInputName:r})]})})},vu=ye({id:fe,username:$(fe),email:$(fe),firstName:$(fe),lastName:$(fe),avatarUrl:$(fe),token:$(fe),password:$(fe)}),gu=t=>{const{onLogout:e,user:n,launchpad:r,icon:o}=t;return s.jsx(Qi,{user:n,onLogout:e,icon:o,components:r?.components})},Li=y.createContext(void 0),yu=()=>{const t=y.useContext(Li);if(t===void 0)throw new Error("useWorkspaceComponentsContext must be used within an WorkspaceComponentsContextProvider");return t},bu=()=>{const{HeaderLogoArea:t,workspaceLogoProps:e}=yu();return t?s.jsx(t,{...e}):s.jsx(gu,{...e})};function wu(t,e){const[n,r]=y.useState(!0),o=y.useContext(ee.IOConnectContext);return y.useEffect(()=>{let i;return(async()=>{if(!o.workspaces)return;let a;try{a=await o.workspaces.getWorkspaceById(t)}catch(l){console.warn(l);return}const c=a.getAllGroups().find(l=>l.id===e);c&&(i=await c.onLockConfigurationChanged(({showAddWindowButton:l})=>{l!==void 0&&r(l)}),r(!!c.showAddWindowButton))})(),()=>i?.()},[t,e,o.workspaces]),n}const xu=({groupId:t,workspaceId:e})=>{const n=wu(e,t),r=y.useCallback(o=>{ht.showAddApplicationPopup({bounds:o,groupId:t,workspaceId:e})},[t,e]);return n&&s.jsx(ht.AddWindowButton,{title:"Add App",visible:n,showPopup:r})},Cu=t=>s.jsx(ht.GroupHeaderButtons,{...t,addWindow:{visible:!1,showPopup:t.addWindow.showPopup}}),Tr=({onLogout:t,user:e,workspaces:n,launchpad:r})=>{const o=n?.HeaderLogoArea,i={onLogout:t,user:e,launchpad:r};return s.jsx(Li.Provider,{value:{workspaceLogoProps:i,HeaderLogoArea:o},children:s.jsx(ht,{components:{...n?.components,header:{...n?.components?.header,LogoComponent:bu},groupHeader:{AfterTabsComponent:xu,ButtonsComponent:Cu,...n?.components?.groupHeader}}})})},Ou=({config:t})=>{const{setupFlow:e,getIOConnectConfig:n}=t,r=t.login,{permission:o}=Ge(),[i,a]=an("localStorage",ls,vu),[c,l]=y.useState(!1),u=y.useCallback(async(p,d)=>{const h=await r.onLogin(p,d);a(h)},[r,a]),f=y.useCallback(()=>{l(!0),r.onLogout?.(),a(null)},[r,a]);return c?s.jsx(Ii,{components:r.components}):i?!o.isSetupCompleted&&e?.enabled!==!1?s.jsx(bn,{settings:e?.settings,components:e?.components}):s.jsx(ee.IOConnectProvider,{settings:n(i),children:s.jsx(Tr,{workspaces:t?.workspaces,launchpad:t?.launchpad,onLogout:f,user:i})}):s.jsx(Ri,{onLogin:u,components:r.components,userInputName:r.userInputName})},ir={POPUP:"popup",REDIRECT:"redirect"},ju=({config:t})=>{const[e,n]=y.useState(void 0),{permission:r}=Ge(),o=au(),{setupFlow:i,getIOConnectConfig:a}=t,c=t.login.components?.Logo||rt,u=(t.login.loginType??ir.REDIRECT)===ir.REDIRECT?o.loginWithRedirect:o.loginWithPopup,f=y.useMemo(()=>o.user?.email?{username:o.user.name,id:o.user.email,token:e}:null,[o.user,e]);return y.useEffect(()=>{o.isAuthenticated&&o.getAccessTokenSilently().then(n).catch(console.warn)},[o]),!o.isAuthenticated||!f?s.jsx(Ai,{isLoading:o.isLoading,onLogin:u,components:t.login.components}):e?!r.isSetupCompleted&&i?.enabled!==!1?s.jsx(bn,{settings:i?.settings,components:i?.components}):s.jsx(ee.IOConnectProvider,{settings:a({...o.user,token:e}),children:s.jsx(Tr,{workspaces:t.workspaces,launchpad:t.launchpad,onLogout:o.logout,user:f})}):s.jsx(Pr,{Logo:c,children:s.jsx(kr,{})})},Eu=({config:t})=>{const{setupFlow:e,getIOConnectConfig:n}=t,{permission:r}=Ge();return!r.isSetupCompleted&&e?.enabled!==!1?s.jsx(bn,{settings:e?.settings,components:e?.components}):s.jsx(ee.IOConnectProvider,{settings:n(),children:s.jsx(Tr,{workspaces:t.workspaces,launchpad:t.launchpad})})},Mi=ye({Logo:$(me().andThen(t=>Re(t,"Logo"))),Heading:$(me().andThen(t=>Re(t,"Heading")))}),Su=Xt(...Object.values(ir).map(t=>Rt(t))),ku=ye({type:Rt("auth0"),loginType:$(Su),providerOptions:me(),components:$(Mi)}),Pu=ye({type:Rt("simple"),onLogin:me().andThen(t=>Re(t,"onLogin")),onLogout:$(me().andThen(t=>Re(t,"onLogout"))),userInputName:$(fe),components:$(Mi)}),Tu=Xt(ku,Pu),_u=ye({edgeNotificationsPermissionTimeout:$(bs)}),Iu=ye({Logo:$(me().andThen(t=>Re(t,"Logo")))}),Nu=ye({enabled:$(Lo()),components:$(Iu),settings:$(_u)}),Au=ye({components:$(me()),HeaderLogoArea:$(me().andThen(t=>Re(t,"HeaderLogoArea")))}),Ru=ye({sections:$(me()),Sections:$(me().andThen(t=>Re(t,"Sections"))),NotificationsPanel:$(Xt(me().andThen(t=>Re(t,"NotificationsPanel")),Rt(null))),UserPanel:$(Xt(me().andThen(t=>Re(t,"UserPanel")),Rt(null)))}),Lu=ye({components:$(Ru)}),Mu=ye({getIOConnectConfig:me().andThen(t=>Re(t,"getIOConnectConfig")),login:$(Tu),setupFlow:$(Nu),workspaces:$(Au),launchpad:$(Lu)}),Du=({config:t})=>{const e=y.useMemo(()=>Mu.runWithException(t),[t]),n=e.login,r=e.launchpad?.components;if(r?.sections&&r?.Sections)throw new Error("Launchpad sections are overspecified. Please provide either a JSX element or a React component.");if(n?.type==="simple")return s.jsx(Ou,{config:e});if(n?.type==="auth0"){const{providerOptions:o}=n;return s.jsx(su,{...o,authorizationParams:{...o.authorizationParams,redirect_uri:o.authorizationParams?.redirect_uri??window.location.origin},children:s.jsx(ju,{config:e})})}return s.jsx(Eu,{config:e})},Di=()=>"getScreenDetails"in window,Fu=({config:t})=>Di()?s.jsx(wi,{children:s.jsx(Du,{config:t})}):s.jsx(gi,{}),Fi=t=>t?.split(" ").map(e=>e[0]?.toUpperCase()).join(""),Ui=y.forwardRef((t,e)=>{const{onSearch:n,searchTerm:r,onClear:o}=t,i=y.useContext(ee.IOConnectContext);return y.useEffect(()=>{!i||!i.search||i.search.setDebounceMS(450)},[i]),s.jsxs("div",{className:"search","data-testid":"search-bar",children:[s.jsx("input",{type:"search",ref:e,className:"io-input",placeholder:"Find anything",value:r,onChange:n}),s.jsx(oe,{name:"delete-left",className:r.length!==0?"active":"",onClick:o,"data-testid":"delete-icon"})]})}),Uu=t=>t.reduce((e,n)=>{const{type:r}=n,o=n.id||n.displayName;if(!o||r.name===Ue.LAYOUT)return e;let i=[];r.name===Ue.APPLICATION?i=So:r.name===Ue.WORKSPACE?i=ko:n.secondaryActions&&(i=n.secondaryActions.map(({name:u,method:f,params:p,target:d})=>({name:u,interopParams:{method:f,params:p,target:d}})));const a={id:o,title:n.displayName||o,description:n.description,type:r.name,iconSrc:n.iconURL,mainAction:n.action,contextMenuActions:i},c=e.findIndex(({title:u})=>r.displayName?u===r.displayName:u===r.name),l=e[c];return l?[...e.slice(0,c),{...l,items:[...l.items,a]},...e.slice(c+1)]:[...e,{id:r.name,title:r.displayName||r.name,items:[a]}]},[]);function Hi(t){const{resultsToRender:e,isLoading:n}=_s(t.searchTerm),r=xt(),o=Os(),i=Ho(),a=Wo(),c=Uu(e),l=zo(),u=Vo(),f=(d,h)=>{const m=d.type===Ue.APPLICATION?l:d.type===Ue.WORKSPACE?u:null;m&&m(d,h)},p=async(d,h)=>{const{item:m,modifier:v,selectedContextMenuActionName:g}=h,{type:w,id:j,mainAction:O}=m,C=g?m.contextMenuActions?.find(b=>b.name===g):null;C?.interopParams?o(C.interopParams):g?f(m,g):O?o(O):w===Ue.APPLICATION?a(j,v).catch(b=>{console.error("Failed to start application",{error:b})}):w===Ue.WORKSPACE&&i(j,v).catch(b=>{console.error("Failed to restore workspace",{error:b})}),v!==ln.SHIFT&&r.close()};return n?s.jsx("p",{style:{padding:"12px 24px"},children:"Loading..."}):e.length===0?s.jsx("p",{style:{padding:"12px 24px"},children:"No results found."}):s.jsx("ul",{children:c.map((d,h)=>s.jsx(hn,{config:d,isFavoritismEnabled:!1,onItemClick:p},d.id||h))})}const Hu=(t,e,n)=>{const{isSectionCollapsible:r,sortOrder:o=At.ASCENDING,...i}=n;return{id:"workspaces-section",title:"Workspaces",items:sr({items:t,sortOrder:o,ascendingCompare:Po,descendingCompare:To}).map(l=>({...l,type:Ue.WORKSPACE,isOpen:e[l.title]?.length>0,contextMenuActions:ko})),isCollapsible:r,...i}},Wi=t=>{const{displayCount:e,isSectionCollapsible:n,showAllItems:r,sortOrder:o}=t,i=Is(),a=Ns(),c=Ho(),l=Vo(),u=y.useMemo(()=>Hu(i,a,{...{displayCount:e,showAllItems:r},isSectionCollapsible:n,sortOrder:o}),[i,a,e,n,r,o]),f=p=>{const{item:d,modifier:h,selectedContextMenuActionName:m}=p;if(!m)return c(d.id,h).catch(v=>{console.error("Failed to restore workspace",{error:v})});l(d,m)};return s.jsx(mn,{config:u,onItemClick:f})},Wu=()=>s.jsxs(s.Fragment,{children:[s.jsx(yi,{}),s.jsx(Wi,{}),s.jsx(mi,{})]}),zu={success:"check"},wo={SET_AS_DEFAULT:"setAsDefault",DELETE:"delete"},Vu=t=>[{name:wo.SET_AS_DEFAULT,displayName:"Set as Default",disabled:t.isDefault},{name:wo.DELETE,displayName:"Delete",disabled:t.name===ni||t.isDefault}],xo=t=>async e=>{e.stopPropagation();try{await t()}catch(n){console.error("Failed to handle layout action: ",n)}},Bu=t=>{const{layouts:e}=t,{setSelectedLayout:n,setDefaultLayout:r}=xt(),o=zs(),i=cr();return s.jsxs("div",{"data-testid":"available-layouts",children:[s.jsx("h6",{children:"Available Layouts"}),e.map(a=>s.jsxs("div",{className:G("layouts-item flex ai-center",a.isSelected&&"active"),"data-testid":"layout-item",children:[s.jsx("div",{className:"loaded me-8",children:a.isSelected&&s.jsx(oe,{size:12,name:"check"})}),s.jsx("div",{className:G("name",{bold:a.isSelected}),onClick:()=>{i(a.name,n)},children:a.name}),s.jsxs("div",{className:"type",children:[a.type,a.isDefault?"/Default":""]}),s.jsx(vr,{iconSize:16,iconName:"ellipsis",actions:Vu(a),onActionItemClick:(c,l)=>o(a,l.name,r)})]},a.name))]})},Co=t=>{const{inputValue:e,setNotification:n,className:r=""}=t,{selectedLayout:o,setSelectedLayout:i}=xt(),a=cr(),c=y.useContext(ee.IOConnectContext),l=[{label:"Save",type:"save",onClick:xo(async()=>{await c.layouts.save({name:e,type:"Global"}),i({name:e}),n({message:"Saved",type:"success"})}),testId:"save-button"},{label:"Restore",type:"restore",onClick:xo(()=>{o&&a(o.name)}),testId:"restore-button"}];return s.jsx("div",{className:G("layout-actions",r),"data-testid":"layout-actions",children:l.map(({label:u,type:f,disabled:p,onClick:d,testId:h})=>s.jsx("button",{onClick:d,disabled:p,className:"io-btn","data-testid":h,children:u},f))})},Zu=({className:t,message:e,type:n})=>s.jsxs("div",{className:G("layout-notification",`layout-notification-${n}`,t),"data-testid":"layout-notification",children:[s.jsx(oe,{size:12,name:zu[n]}),s.jsx("span",{"data-testid":"layout-notification-message",children:e})]}),zi=()=>{const t=y.useRef(null),[e,n]=y.useState(!1),[r,o]=y.useState(null),i=js(),{defaultLayout:a,selectedLayout:c}=xt(),[l,u]=y.useState("");y.useEffect(()=>{if(!e)return;const p=h=>{t.current?.contains(h.target)||n(!1)},d=()=>{document.activeElement?.nodeName==="IFRAME"&&n(!1)};return document.addEventListener("click",p,!0),window.addEventListener("blur",d,!0),()=>{document.removeEventListener("click",p,!0),window.removeEventListener("blur",d,!0)}},[e]),y.useEffect(()=>{if(!r)return;const p=setTimeout(()=>o(null),3e3);return()=>clearTimeout(p)},[r]),y.useEffect(()=>{c&&u(c.name)},[c]);const f=()=>{n(p=>!p),c&&u(c.name)};return s.jsxs("footer",{className:"footer",ref:t,"data-testid":"layouts-panel",children:[s.jsxs("div",{"aria-label":"Layouts panel","aria-expanded":e,role:"button",...mt(f),className:"selected-layout flex ai-center","data-testid":"selected-layout",children:[s.jsx("span",{className:G("name",{hidden:e}),"data-testid":"selected-layout-name",children:c?.name||"No selected layout"}),s.jsxs("div",{className:"flex ai-center","data-testid":"layout-actions-and-toggle",children:[!e&&s.jsx(Co,{inputValue:l,setNotification:o}),s.jsx(oe,{className:G("ms-8","layouts-panel-toggle-button",{"layouts-panel-toggle-button-rotated":e}),name:"chevron-up","data-testid":"layouts-panel-toggle"})]})]}),s.jsx(li,{isOpen:e,children:s.jsxs("div",{className:"layouts-container",children:[s.jsxs("div",{className:"layouts-settings",children:[s.jsx("input",{className:"io-input",onChange:p=>u(p.target.value),value:l,"data-testid":"layout-name-input"}),s.jsx(Co,{className:"group",inputValue:l,setNotification:o})]}),s.jsx(Bu,{layouts:i.map(p=>({...p,isSelected:p.name===c?.name,isDefault:p.name===a?.name}))})]})}),r?s.jsx(Zu,{className:G({"ms-8 me-8":e}),message:r.message,type:r.type}):s.jsx("div",{className:"powered-by",children:"Powered by io.Connect Browser"})]})},$u=t=>{const e=new Date(t),n=e.getHours(),r=e.getMinutes().toString().padStart(2,"0"),o=e.getSeconds().toString().padStart(2,"0"),i=n>=12?"PM":"AM",a=e.getMonth()+1,c=e.getDate(),l=e.getFullYear();return`${n%12}:${r}:${o} ${i} ${a}/${c}/${l}`},Vi=t=>{const{severity:e="None",id:n,timestamp:r,title:o,body:i,actions:a}=t.notificationData,c=y.useContext(ee.IOConnectContext),l=()=>{c&&c.notifications.clear(n).catch(console.error)},u=async p=>{p.stopPropagation();try{await c.notifications.click(n),l()}catch(d){console.error(d)}},f=a?.map(({action:p,title:d})=>({children:d,onClick:async h=>{h.stopPropagation();try{await c.notifications.click(n,p),l()}catch(m){console.error(m)}}}));return s.jsxs("div",{className:"notifications-list-item",style:{borderLeftColor:Es[e]},onClick:u,"data-testid":"notification-container",children:[s.jsxs("div",{className:"notification-header","data-testid":"notification-header",children:[s.jsx("h4",{children:o}),s.jsx(oe,{onClick:p=>{p.stopPropagation(),l()},className:"io-btn close-btn",size:16,name:"close","data-testid":"close-icon"})]}),i&&s.jsx("p",{"data-testid":"notification-body",children:i}),r&&s.jsx("p",{"data-testid":"notification-timestamp",children:$u(r)}),f&&s.jsx(gn,{className:"notification-actions","data-testid":"notification-actions",items:f})]})},_r=t=>{const{className:e}=t,n=Fo().length;return n>0?s.jsx("span",{className:G("notifications-badge",e),"data-testid":"notifications-badge",children:n<10?n:"9+"}):null},Bi=t=>{const{className:e,iconSize:n=24,...r}=t;return s.jsxs("div",{className:G(e,"notifications-icon"),"data-testid":"notifications-icon",...r,children:[s.jsx(oe,{size:n,name:"bell"}),s.jsx(_r,{})]})},Zi=()=>{const{onNotificationsSort:t,sortedNotifications:e}=Ts(),n=y.useContext(ee.IOConnectContext),r=y.useCallback(()=>{n&&n.notifications.clearAll().catch(console.error)},[n]);return s.jsxs("div",{className:"notifications-panel","data-testid":"notifications-panel",children:[s.jsxs("div",{className:"header","data-testid":"notifications-panel-header",children:[s.jsx("div",{className:"header-caption",children:s.jsxs("div",{children:["Notifications (",e.length,")"]})}),s.jsx(gn,{items:[{children:"Latest",onClick:()=>t("timestamp")},{children:"By Priority",onClick:()=>t("severity")}]})]}),e.length?s.jsx("div",{className:"notifications-list","data-testid":"notifications-list",children:e.map(o=>s.jsx(Vi,{notificationData:o},o.id))}):s.jsx("div",{className:"no-notifications",children:"No notifications"}),s.jsx("div",{className:"footer","data-testid":"notifications-panel-footer",children:s.jsx(Wt,{children:"Clear All",onClick:r})})]})},Gu=({user:t})=>{const e=y.useContext(ee.IOConnectContext),n=t?.username||"N A";return s.jsxs("div",{className:"flex info info-top",children:[s.jsxs("div",{children:[s.jsx("h4",{children:n}),s.jsxs("p",{children:["PROD"," | ","Version "+e.version]})]}),s.jsx("div",{className:"flex badge",children:Fi(n)})]})},$i=()=>{const t=y.useContext(ee.IOConnectContext),[e,n]=y.useState([]);y.useEffect(()=>{t&&t.themes?.list().then(o=>n(o)).catch(console.warn)},[t]);const r=async(o,i)=>{i.name&&t.themes?.select(i.name).catch(console.warn)};return s.jsxs("div",{className:"info info-middle",children:[s.jsx("h4",{children:"Settings"}),s.jsxs("div",{className:"flex ai-center",children:[s.jsx("label",{style:{textAlign:"right",width:"40%"},children:"Theme"}),s.jsx("div",{style:{width:"60%",marginLeft:"auto"},children:s.jsx(gn,{onItemClick:r,items:e.map(({name:o,displayName:i})=>({name:o,children:i}))})})]})]})},Gi=({title:t,description:e,links:n=[],onLogout:r,user:o})=>{const[i,a]=an("sessionStorage",Ro,ti),c=y.useContext(ee.IOConnectContext),l=async()=>{try{r?.()}catch(u){console.error(u)}a(null),await c.webPlatform?.system.shutdown(),window.location.reload()};return s.jsxs("div",{className:"info info-bottom flex flex-column",children:[s.jsx("h4",{children:t||"Support"}),s.jsx("p",{children:e||"New set of thoughtfully curated items and the ability to configure them."}),s.jsx("ul",{children:n.map(({children:u,...f})=>s.jsx("li",{children:s.jsx("a",{...f,children:u})},f.href))}),o?.id&&s.jsx("div",{children:s.jsx(Wt,{onClick:l,children:"Log Out"})})]})},qi=({onLogout:t,user:e})=>s.jsxs(s.Fragment,{children:[s.jsx(Gu,{user:e}),s.jsx($i,{}),s.jsx(Gi,{onLogout:t,user:e})]}),Ki=t=>{const{initials:e,className:n,...r}=t;return s.jsx("div",{className:G(n,"user-panel-icon"),...r,children:e})},Oo=({children:t,closeFn:e,open:n=!1,showCloseButton:r=!0})=>{const o=y.useRef(null);return y.useEffect(()=>{n?o.current?.showModal():o.current?.close()},[n]),s.jsx("dialog",{ref:o,onClose:()=>{n&&e()},onClick:i=>{i.target.nodeName==="DIALOG"&&e()},children:s.jsxs("div",{className:"dialog-backer",children:[r&&s.jsx(oe,{onClick:e,className:"btn-close io-btn io-btn-icon",size:16,name:"close"}),t]})})};function Yi(t){const{open:e,setOpen:n,onLogout:r,className:o,components:i={},user:a,...c}=t,[l,u]=y.useState(""),[f,p]=y.useState(!1),[d,h]=y.useState(!1),m=y.useRef(null),v=i?.NotificationsPanel!==null,g=i?.UserPanel!==null,w=i?.NotificationsPanel??Zi,j=i?.UserPanel??qi;y.useEffect(()=>{if(e){m.current?.focus();return}u("")},[e]);const O=_=>{u(_.target.value)},C=()=>{u("")},b=i.Sections?s.jsx(i.Sections,{}):i.sections,k=s.jsx(hl,{children:s.jsx("ul",{children:b??s.jsx(Wu,{})})});return s.jsxs(lc,{setOpen:n,isOpen:e,children:[s.jsxs("div",{className:G(o),...c,children:[s.jsxs("header",{children:[s.jsx(Ui,{ref:m,searchTerm:l,onSearch:O,onClear:C}),s.jsxs("div",{className:"action-area",children:[v&&s.jsx(Bi,{"aria-label":"Notifications",role:"button",...mt(()=>p(!0))}),g&&s.jsx(Ki,{initials:Fi(a?.username||"N A"),"aria-label":"Profile and Settings",role:"button",...mt(()=>h(!0))})]}),s.jsx(oe,{className:"btn-close io-btn io-btn-icon",size:16,name:"close",handleClick:()=>n(!1)})]}),s.jsx("main",{children:l.trim().length<3?k:s.jsx(Hi,{searchTerm:l})}),s.jsx(zi,{})]}),v&&s.jsx(Oo,{open:f,closeFn:()=>p(!1),children:s.jsx(w,{})}),g&&s.jsx(Oo,{open:d,closeFn:()=>h(!1),children:s.jsx(j,{onLogout:r,user:a})})]})}const Xi=()=>s.jsxs(s.Fragment,{children:[s.jsx(ht.Logo,{frameId:""}),s.jsx(_r,{})]}),qu="_workspaceLogo_t3m7s_1",jo={workspaceLogo:qu,"launchpad-popup":"_launchpad-popup_t3m7s_9","slide-in":"_slide-in_t3m7s_32"},Ji=t=>{const[e,n]=y.useState(!1),r=y.useRef(null),o=y.useRef(null),{icon:i,children:a}=t;return y.useEffect(()=>{if(!e)return;const c=u=>{const f=u.target!==r.current&&!r.current?.contains(u.target);!(u.target===o.current||o.current?.contains(u.target))&&f&&n(!1)},l=()=>{document.activeElement?.nodeName==="IFRAME"&&n(!1)};return document.addEventListener("mouseup",c,!0),window.addEventListener("blur",l,!0),()=>{document.removeEventListener("mouseup",c,!0),window.removeEventListener("blur",l,!0)}},[e]),s.jsxs("div",{ref:r,children:[s.jsx("button",{"aria-label":"Launchpad",onClick:()=>n(c=>!c),className:`io-logo ${e===!0?"active":""}`,ref:o,children:s.jsx("div",{className:"logo-wrapper",children:i})}),s.jsx("div",{children:s.jsx("div",{className:G(jo["launchpad-popup"],{[jo["slide-in"]]:e}),children:a({open:e,setOpen:n})})})]})},Qi=t=>{const{icon:e,components:n,user:r,onLogout:o}=t;return s.jsx(Ji,{icon:e??s.jsx(Xi,{}),children:({open:i,setOpen:a})=>s.jsx(Yi,{open:i,setOpen:a,components:n,user:r,onLogout:o})})};exports.ApplicationsSection=mi;exports.Auth0LoginForm=Ni;exports.Auth0LoginPage=Ai;exports.BaseSection=hn;exports.BaseSectionHeader=Ao;exports.BaseSectionItem=ei;exports.BrowserNotSupported=gi;exports.Button=Wt;exports.ButtonGroup=gn;exports.ContextMenu=Qo;exports.DropdownButton=vr;exports.FavoritesSection=yi;exports.IOConnectHome=Fu;exports.IOConnectHomeProvider=wi;exports.Icon=oe;exports.ImgIcon=ar;exports.Launchpad=Yi;exports.LaunchpadSlidePanel=Qi;exports.LayoutsPanel=zi;exports.LoginLoader=hu;exports.Logo=Xi;exports.LogoutPage=Ii;exports.Notification=Vi;exports.NotificationsBadge=_r;exports.NotificationsIcon=Bi;exports.NotificationsPanel=Zi;exports.PermissionsSetup=bn;exports.SearchBar=Ui;exports.SearchResults=Hi;exports.Section=mn;exports.SettingsCard=$i;exports.SimpleLoginPage=Ri;exports.SlidePanel=Ji;exports.SupportCard=Gi;exports.UserPanel=qi;exports.UserPanelIcon=Ki;exports.WorkspacesSection=Wi;exports.useFavoriteEntities=cn;exports.useIOConnectHome=Ge;exports.useIsBrowserSupported=Di;
48
48
  //# sourceMappingURL=index.js.map