@genesislcap/design-system-configurator 15.68.0 → 15.68.1

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.
@@ -0,0 +1,2 @@
1
+ "use strict";(self.webpackChunk_genesislcap_design_system_configurator=self.webpackChunk_genesislcap_design_system_configurator||[]).push([[277],{79780(e,t,s){s.d(t,{Es:()=>n,vp:()=>o});var r=s(38370);class i extends BroadcastChannel{constructor(){super(...arguments),this.postMessage=(...e)=>{const[t,s]=e;super.postMessage({type:t,detail:s})},this.isMessageType=(e,t)=>{var s;return(null===(s=t.data)||void 0===s?void 0:s.type)===e}}}const n=e=>{class t extends i{constructor(){super(e)}}return r.DI.createInterface(e=>e.transient(t))},o=e=>new i(e)},40113(e,t,s){s.d(t,{N:()=>y});var r=s(55823),i=s(92277),n=s(33681),o=s(38370),a=s(97156),c=s(57963),d=s(21281),h=s(10447),u=s(56653),l=s(98316),E=s(17465);const g=o.DI.createInterface();function v(){return(null===navigator||void 0===navigator?void 0:navigator.credentials)?"PasswordCredential"in window||(E.v.warn("PasswordCredential not available in this browser."),!1):(E.v.warn("CredentialsContainer not available in this browser."),!1)}const S=":";function R(e="",t=S,s){return e.split(t,s).map(e=>e.trim()).filter(e=>""!==e)}function p(e,t=S){const s="string"==typeof e&&e.trim();return!!s&&s.includes(t)}function m(e,t=S){return"string"==typeof e&&e.trim()?(e.match(new RegExp(t,"g"))||[]).length:0}function T(e,t=S){for(const s of e)if(p(s,t))return s;return e.find(e=>"string"==typeof e&&""!==e.trim())}function f(e,t,s){const r="string"==typeof e&&e.trim();return!r||s&&!r.includes(s)||m(r)>1?s&&t&&s!==t?`${t}:${s}`:t||s:r}function _(e="credential"){E.v.warn(`Unable to migrate legacy ${e} to latest format. Please remove from your browser.`)}const A={password:!0,mediation:"optional"},O={cookie:{path:"/",name:"credentials",expires:7300,storePasswords:!1}};let I=class{constructor(e,t=O){this.session=e,this.config=t}createBasicCredentials(e){return{type:u.h.BASIC,username:e.username,password:e.password,mfaToken:this.getMFAToken()}}createRefreshCredentials(e){var t,s,r;return{type:u.h.REFRESH,username:null!==(t=null==e?void 0:e.username)&&void 0!==t?t:this.getUsername(),refreshToken:null!==(s=null==e?void 0:e.refreshToken)&&void 0!==s?s:this.getRefreshToken(),mfaToken:null!==(r=null==e?void 0:e.mfaToken)&&void 0!==r?r:this.getMFAToken()}}createSSOCredentials(e){var t;return{type:u.h.SSO,ssoToken:null!==(t=null==e?void 0:e.ssoToken)&&void 0!==t?t:this.getSSOToken()}}validateBasicCredentials(e){return e&&!!e.username&&!!e.password}validateRefreshCredentials(e){return e&&!!e.refreshToken&&!!e.username}validateSSOCredentials(e){return e&&!!e.ssoToken}validateUserCredentialData(e,t){const s=e&&!!e.id&&!!e.name&&!e.name.includes(S)&&m(e.id)<=1;return t?s&&!!e.password:s}normaliseLegacyCredentialData(e,t){if(this.validateUserCredentialData(e,!0))return[e,!0];if(this.validateUserCredentialData(t))return[t,!1];if(e)try{const t=e,[s]=R(t.name||t.id),[r,i]=R(T([t.id,t.name]));return[{id:f(t.id||t.name,s,i),name:s,password:t.password||""},!0]}catch(e){_("PasswordCredential")}if(t)try{const e=t,[s]=R(e.name||e.username||e.organisation),[r,i]=R(T([e.organisation||e.username||e.name]));return[{id:f(e.id||e.username||e.name,s,i),name:s,password:e.password||""},!1]}catch(e){_("cookie")}return[void 0,!1]}storeCredentialsInContainer(e){return(0,r.sH)(this,void 0,void 0,function*(){if(!v())return;const t=new PasswordCredential(e);return E.v.debug("Storing credentials in CredentialsContainer"),navigator.credentials.store(t)})}getCredentialsFromContainer(){return(0,r.sH)(this,arguments,void 0,function*(e=A){if(v())return E.v.debug("Getting credentials from CredentialsContainer"),yield navigator.credentials.get(e)})}storeCredentialsInCookie(e){const{password:t}=e,s=(0,r.Tt)(e,["password"]),i=this.config.cookie.storePasswords?e:s;return E.v.debug("Storing credentials in cookie"),!!h.A.set(this.config.cookie.name,JSON.stringify(i),{expires:this.config.cookie.expires,domain:location.hostname,path:this.config.cookie.path,secure:!0})}getCredentialsFromCookie(){E.v.debug("Getting credentials from cookie");const e=h.A.get(this.config.cookie.name);return e?JSON.parse(e):void 0}storeCredentials(e){return(0,r.sH)(this,void 0,void 0,function*(){if(v()){const t=yield this.storeCredentialsInContainer(e);return Promise.resolve(!!t)}return Promise.resolve(this.storeCredentialsInCookie(e))})}getCredentials(e){return(0,r.sH)(this,void 0,void 0,function*(){return v()?this.getCredentialsFromContainer(e):Promise.resolve(this.getCredentialsFromCookie())})}getSSOToken(){return this.session.getSessionStorageItem("ssoToken")}getUsername(){return this.session.getSessionStorageItem("username")||this.session.getLocalStorageItem("username")}getRefreshToken(){return this.session.getSessionStorageItem("refreshToken")||this.session.getLocalStorageItem("refreshToken")}getMFAToken(){return this.session.getSessionStorageItem("mfaToken")}removeCookie(){h.A.remove(this.config.cookie.name,{domain:location.hostname,path:this.config.cookie.path})}removeSSOToken(){this.session.removeSessionStorageItem("ssoToken")}removeUsername(){this.session.removeSessionStorageItem("username"),this.session.removeLocalStorageItem("username")}removeRefreshToken(){this.session.removeSessionStorageItem("refreshToken"),this.session.removeLocalStorageItem("refreshToken")}removeMFAToken(){this.session.removeSessionStorageItem("mfaToken")}removeAll(){this.removeCookie(),this.removeSSOToken(),this.removeUsername(),this.removeRefreshToken(),this.removeMFAToken()}preventSilentAccess(){return v()&&navigator.credentials.preventSilentAccess()}};I=(0,r.Cg)([(0,r.Qj)(0,l.N),(0,r.Qj)(1,(0,o.optional)(g))],I);const C=o.DI.createInterface(e=>e.singleton(I));var b=s(56093);const M=e=>Array.isArray(e)?e.map(e=>null!=e?e:""):[],N=e=>{try{if("EVENT_LOGIN_AUTH_ACK"===(null==e?void 0:e.MESSAGE_TYPE)){const{DETAILS:r}=e,i=e.UPDATE_QUEUE_DETAILS;return{messageType:e.MESSAGE_TYPE,sourceRef:e.SOURCE_REF,userName:e.USER_NAME,updateQueue:null==i?void 0:i.UPDATE_QUEUE,zeroMqProxyModeEnabled:null==i?void 0:i.ZERO_MQ_PROXY_MODE_ENABLED,zeroMqProxyInboundPort:null==i?void 0:i.ZERO_MQ_PROXY_INBOUND_PORT,zeroMqProxyOutboundPort:null==i?void 0:i.ZERO_MQ_PROXY_OUTBOUND_PORT,userKVs:e.USER,details:r?{system:(s=r.SYSTEM,s?{date:s.DATE}:null),heartbeatIntervalSecs:r.HEARTBEAT_INTERVAL_SECONDS,failedLoginAttempts:r.FAILED_LOGIN_ATTEMPTS,rejectedLoginAttempts:r.REJECTED_LOGIN_ATTEMPTS,lastLoginDatetime:r.LAST_LOGIN_DATE_TIME,daysToPasswordExpiry:r.DAYS_TO_PASSWORD_EXPIRY,product:(t=r.PRODUCT,t?t.map(e=>({name:e.NAME,version:e.VERSION})):[])}:null,permission:M(e.PERMISSION),profile:M(e.PROFILE)}}throw new Error("No Entity mapping implementation for provided DTO")}catch(e){throw E.v.error(e),e}var t,s};let L=class{loggedUserResultChanged(){var e;null===(e=this.isLoggedInSubject)||void 0===e||e.next(this.isLoggedIn)}get isLoggedIn$(){return this.isLoggedInSubject.asObservable()}get isLoggedIn(){return this.currentUser.isAuthenticated}constructor(e,t,s,r,i){this.session=e,this.connect=t,this.messageBuilder=s,this.credentialManager=r,this.currentUser=i,this.isWorking=!1,this.isLoggedInSubject=new a.t(this.isLoggedIn),this.currentUser.addAuthenticationChangeListener(e=>{var t;null===(t=this.isLoggedInSubject)||void 0===t||t.next(e.detail)})}login(e){return(0,r.sH)(this,void 0,void 0,function*(){var t;this.isWorking=!0;try{const s=this.messageBuilder.createLoginMessage(e),r=yield this.connect.send(s);if(!r||r.ERROR||(null===(t=r.DETAILS)||void 0===t?void 0:t.ERROR))throw new u.l(s,r);this.applyAuthResults({authToken:r.SESSION_AUTH_TOKEN,refreshToken:r.REFRESH_AUTH_TOKEN,profiles:r.PROFILE,username:r.USER_NAME,permissions:r.PERMISSION,sessionId:r.SESSION_ID}),this.currentUser.set(N(r)),this.session.setAuthResult(r),E.v.debug("Login Authentication Result:",r)}catch(e){if(E.v.error((0,b.O)("Login Authentication Error:",null==e?void 0:e.received),e),!(e instanceof u.l&&e.isIgnorableError()))throw this.removeAuthResults(),this.currentUser.unset(),e;E.v.warn("Ignoring authentication error as it is a known edge case.")}finally{this.isWorking=!1}return this.loggedUserResult})}logout(){return(0,r.sH)(this,void 0,void 0,function*(){var e;this.isWorking=!0;let t={success:!1};try{const s=this.messageBuilder.createLogoutMessage(this.loggedUserResult);this.session.deleteUserFromSessionStorage();const{CODE:r,DETAILS:i,ERROR:n,MESSAGE_TYPE:o,OIDC_LOGOUT_URL:a}=yield this.connect.send(s),c=null!==(e=null==i?void 0:i.ERROR)&&void 0!==e?e:n,h=o===d.Go.LOGOUT_NACK;h&&E.v.warn("Unexpected Logout NACK received during logout.",c),t={success:o===d.Go.LOGOUT_ACK||r===d.x6.SESSION_NOT_FOUND||!h,error:c},a&&window.open(a,"_self")}catch(e){const s=new u.l(e.sentMessage,e.receivedMessage);if(E.v.error((0,b.O)("Logout Authentication Error:",s.received),s),!s.isIgnorableError())throw e;E.v.warn("Ignoring authentication error as it is a known edge case."),t.success=!0}finally{this.removeAuthResults(),this.currentUser.unset(),this.isWorking=!1}return t})}reAuthFromSession(){return(0,r.sH)(this,void 0,void 0,function*(){const e=yield this.ensureConnection(),t=this.credentialManager.createRefreshCredentials();if(e&&this.credentialManager.validateRefreshCredentials(t)){const e=this.messageBuilder.createRefreshTokenMessage(),t=yield this.connect.send(e);if((null==t?void 0:t.MESSAGE_TYPE)===d.Gp.EVENT_LOGIN_AUTH_ACK)return this.session.setAuthResult(t),this.currentUser.set(N(t)),this.applyAuthResults(this.getLoggedUserFromMessage(t)),!0}return this.session.deleteUserFromSessionStorage(),this.currentUser.unset(),!1})}ensureConnection(){return(0,r.sH)(this,void 0,void 0,function*(){if(this.connect.isConnected)return!0;const e=this.session.getSessionStorageItem("hostUrl");return!!e&&this.connect.connect(e)})}getLoggedUserFromMessage(e){const t=e.USER_NAME,s=e.SESSION_AUTH_TOKEN,r=e.REFRESH_AUTH_TOKEN;return t&&s&&r?{username:t,authToken:s,refreshToken:r,profiles:e.PROFILE,permissions:e.PERMISSION,sessionId:e.SESSION_ID}:null}applyAuthResults(e){e?this.loggedUserResult={authToken:e.authToken,refreshToken:e.refreshToken,profiles:e.profiles,username:e.username,permissions:e.permissions,sessionId:e.sessionId}:this.removeAuthResults()}removeAuthResults(){this.loggedUserResult=null}};(0,r.Cg)([n.observable],L.prototype,"isWorking",void 0),(0,r.Cg)([n.observable],L.prototype,"loggedUserResult",void 0),L=(0,r.Cg)([(0,r.Qj)(0,l.N),(0,r.Qj)(1,c.dm),(0,r.Qj)(2,d.lT),(0,r.Qj)(3,C),(0,r.Qj)(4,i.KJ)],L);const y=o.DI.createInterface(e=>e.singleton(L))},56653(e,t,s){var r;s.d(t,{h:()=>r,l:()=>i}),function(e){e.BASIC="BASIC",e.SSO="SSO",e.JWT="JWT",e.REFRESH="REFRESH"}(r||(r={}));class i extends Error{constructor(e,t,s="Auth Failed \n"){super(s),this.sent=e,this.received=t,Object.setPrototypeOf(this,i.prototype)}isIgnorableError(){var e,t,s,r,i,n,o,a;return!!(null===(r=null===(s=null===(t=null===(e=this.received)||void 0===e?void 0:e.DETAILS)||void 0===t?void 0:t.ERROR)||void 0===s?void 0:s.toLowerCase())||void 0===r?void 0:r.includes("request needs the user to be logged"))||!!(null===(a=null===(o=null===(n=null===(i=this.received)||void 0===i?void 0:i.DETAILS)||void 0===n?void 0:n.ERROR)||void 0===o?void 0:o.toLowerCase())||void 0===a?void 0:a.includes("is not logged in"))}getMessageError(){var e,t;return Array.isArray(null===(e=this.received)||void 0===e?void 0:e.ERROR)?null===(t=this.received)||void 0===t?void 0:t.ERROR.map(e=>this.errorDetailFormatter(e)).join("\n"):""}getDetailsError(){var e,t,s,r;return Array.isArray(null===(t=null===(e=this.received)||void 0===e?void 0:e.DETAILS)||void 0===t?void 0:t.ERROR)?null===(r=null===(s=this.received)||void 0===s?void 0:s.DETAILS)||void 0===r?void 0:r.ERROR.map(e=>this.errorDetailFormatter(e)).join("\n"):""}hasPasswordExpiredError(){return this.hasErrorCode("PASSWORD_EXPIRED")}hasMFAError(){return this.hasErrorCode("MFA_REQUIRED")||this.hasErrorCode("MFA_FAILED")}requiresTermsAndConditions(){return this.hasErrorCode("TERMS_ACCEPTANCE_REQUIRED")}hasErrorCode(e){var t,s;return!!Array.isArray(null===(t=this.received)||void 0===t?void 0:t.ERROR)&&(null===(s=this.received)||void 0===s?void 0:s.ERROR.some(t=>t.CODE===e))}errorDetailFormatter(e){return`\n ${e.CODE}: \n ${e.TEXT}`}}},24669(e,t,s){s.d(t,{EQ:()=>a,a4:()=>o});var r=s(17190),i=s(38370);class n{constructor(){this.streamListeners=(0,r.r)(),this.streamCompleteListeners=(0,r.r)(),this.streamErrorListeners=(0,r.r)(),this.commitListeners=(0,r.r)(),this.metadataListeners=(0,r.r)(),this.commitResponseListeners=(0,r.r)()}addStreamListener(e,t,s){var r,i,n;const o=null===(r=this.streamListeners)||void 0===r?void 0:r.subscribe(e),a=null===(i=this.streamCompleteListeners)||void 0===i?void 0:i.subscribe(t),c=null===(n=this.streamErrorListeners)||void 0===n?void 0:n.subscribe(s);return()=>{o(),a(),c()}}onStreamEvent(e,t,s,r){var i;null===(i=this.streamListeners)||void 0===i||i.publish(new CustomEvent("connect-stream-event",{detail:{functions:r,message:t,resourceName:e,stream:s}}))}onStreamErrorEvent(e,t,s){var r;null===(r=this.streamErrorListeners)||void 0===r||r.publish(new CustomEvent("connect-stream-error-event",{detail:{resourceName:e,stream:t,error:s}}))}onStreamCompleteEvent(e,t){var s;null===(s=this.streamCompleteListeners)||void 0===s||s.publish(new CustomEvent("connect-stream-complete-event",{detail:{resourceName:e,stream:t}}))}addCommitListener(e){var t;return null===(t=this.commitListeners)||void 0===t?void 0:t.subscribe(e)}onCommitEvent(e,t){var s;null===(s=this.commitListeners)||void 0===s||s.publish(new CustomEvent("connect-commit-event",{detail:{eventName:e,message:t}}))}addMetadataListener(e){var t;return null===(t=this.metadataListeners)||void 0===t?void 0:t.subscribe(e)}onMetadataEvent(e,t,s){var r;null===(r=this.metadataListeners)||void 0===r||r.publish(new CustomEvent("connect-metadata-event",{detail:{resourceName:e,message:t,error:s}}))}addCommitResponseListener(e){var t;return null===(t=this.commitResponseListeners)||void 0===t?void 0:t.subscribe(e)}onCommitResponseEvent(e,t){var s;null===(s=this.commitResponseListeners)||void 0===s||s.publish(new CustomEvent("connect-commit-response-event",{detail:{eventName:e,response:t}}))}}const o=i.DI.createInterface(e=>e.singleton(n)),a=i.DI.createInterface(e=>e.aliasTo(o))},57963(e,t,s){s.d(t,{dm:()=>W,tn:()=>x});var r=s(55823),i=s(84686),n=s(77679),o=s(33681),a=s(38370),c=s(77909);class d{constructor(){this.cachedMetadata=new Map,this.cachedJsonSchema=new Map,this.cachedResources=null,this.cachedRequests=new Map}getMetadataFor(e){return this.cachedMetadata.get(e)}getJsonSchemaFor(e){return this.cachedJsonSchema.get(e)}getResources(){return this.cachedResources}hasMetadataFor(e){return this.cachedMetadata.has(e)}hasJsonSchemaFor(e){return this.cachedJsonSchema.has(e)}hasResources(){return null!==this.cachedResources}setMetadataFor(e,t){this.cachedMetadata.set(e,t)}setJsonSchemaFor(e,t){this.cachedJsonSchema.set(e,t)}setResources(e){this.cachedResources=e}getRequestFor(e){return this.cachedRequests.get(e)}hasRequestFor(e){return this.cachedRequests.has(e)}setRequestFor(e,t){this.cachedRequests.set(e,t)}}const h=a.DI.createInterface(e=>e.singleton(d));var u=s(17465),l=s(56093),E=s(24669),g=s(49587),v=s(49229),S=s(13160),R=s(97156),p=s(45655),m=s(1762),T=s(53940),f=s(84190),_=s(78213),A=s(66640),O=s(36090),I=s(51046),C=s(16220),b=s(98316),M=s(32748);const N={polling:Object.assign({POLLING_MAP:{EVENT_AMEND_USER:{TEMP_FREQUENCY:500,AMOUNT_OF_POLLS:5,QUERIES:["ALL_USERS"]}},POLLING_INTERVAL_MAP:{ALL_TRADES:5e3,ALL_USERS:5e3,ALL_PROCESSES_STATUS:1e4},POLLING_FREQUENCY:5e3},{})},L=a.DI.createInterface(e=>e.instance(N));var y,U=s(21281);let D=y=class{constructor(e,t){this.http=e,this.messageBuilder=t}toHttpHost(e){if(!e)return"";let t=e;return t.startsWith("ws")&&(t=t.replace("ws","http")),t.endsWith("/")||(t=t.concat("/")),t}post(e,t){return this.http.post(y.getUrl(e,t),{body:y.getBody(t),headers:this.messageBuilder.createHTTPHeadersFromMessage(t)})}get(e,t){return this.http.get(y.getUrl(e,t),{headers:this.messageBuilder.createHTTPHeadersFromMessage(t)})}requestServer(e,t){let s=y.getUrl(e,t);const r=[];return t.REQUEST&&Object.keys(t.REQUEST).length>0&&Object.keys(t.REQUEST).forEach(e=>{const s=t.REQUEST[e];null==s||Number.isNaN(s)||r.push(`REQUEST.${e}=${encodeURIComponent(String(s))}`)}),t.DETAILS&&Object.keys(t.DETAILS).forEach(e=>{const s=t.DETAILS[e];null==s||Number.isNaN(s)||r.push(`${e}=${encodeURIComponent(String(s))}`)}),r.length>0&&(s=`${s}?${r.join("&")}`),u.v.debug(`HTTP transport - REQUEST_SERVER GET URL: ${s}`),this.http.get(s,{headers:this.messageBuilder.createHTTPHeadersFromMessage(t)})}static getBody(e){return JSON.stringify(e)}static getUrl(e,t){const s=t.MESSAGE_TYPE;let r=t.MESSAGE_TYPE.replace(/_/g,"-").toLowerCase();return s===U.Gp.DATA_LOGON&&(r=t.DETAILS.DATASOURCE_NAME.replace(/_/g,"-").toLowerCase()),`${e}${r}`}};D=y=(0,r.Cg)([(0,r.Qj)(0,M.l),(0,r.Qj)(1,U.lT)],D);const w=a.DI.createInterface(e=>e.singleton(D));var P=s(16183);const F=(e,t)=>((null==t?void 0:t.ROW)&&e&&e.length>0?t.ROW.forEach(t=>{const s=t;if(s&&s.DETAILS){const r=s.DETAILS.ROW_REF,i=s.DETAILS.OPERATION;"INSERT"===i&&(e.find(e=>{var t;return(null===(t=e.DETAILS)||void 0===t?void 0:t.ROW_REF)===r})||e.unshift(s)),"DELETE"===i&&(e=e.filter(e=>{var s,r;return(null===(s=t.DETAILS)||void 0===s?void 0:s.ROW_REF)!==(null===(r=e.DETAILS)||void 0===r?void 0:r.ROW_REF)})),"MODIFY"===i&&(e=e.map(e=>{var t;return(null===(t=e.DETAILS)||void 0===t?void 0:t.ROW_REF)===r?Object.assign(Object.assign({},e),s):e}))}}):!t||e&&0!==e.length||(e=[...new Set(t.ROW)]),e);var G;let H=G=class{get isConnected(){return this._isConnected}set isConnected(e){this._isConnected=e,this.isConnectedSubject.next(this._isConnected)}constructor(e,t,s,r,i,n,o){var a;this.http=e,this.messageBuilder=t,this.session=s,this.metaCache=r,this.serializer=i,this.config=n,this.transport=o,this.isWorking=!1,this._isConnected=!1,this.isConnectedSubject=new R.t(this._isConnected),this.isConnected$=null===(a=this.isConnectedSubject)||void 0===a?void 0:a.asObservable(),this.ongoingTurbo={},this.streams=new Map,this.inFlightRequests=new Map,this.ongoingRefresh=null}handleSessionRefresh(){return this.ongoingRefresh||(this.ongoingRefresh=(()=>(0,r.sH)(this,void 0,void 0,function*(){const e=this.host;this.disconnect();let t=yield(0,P.$G)();return t===P.vE.HANDLED_BY_OTHER_TAB&&(yield new Promise(e=>{setTimeout(e,G.REAUTH_WAIT_MS)}),t=yield(0,P.$G)()),(t===P.vE.SUCCESS||t===P.vE.ALREADY_VALID)&&(this.connect(e),!0)}))().finally(()=>{this.ongoingRefresh=null})),this.ongoingRefresh}checkHost(){return(0,r.sH)(this,void 0,void 0,function*(){try{return this.getMessage({MESSAGE_TYPE:U.Go.HEARTBEAT_PING,SOURCE_REF:"host check"}).then(e=>e.MESSAGE_TYPE===U.Go.HEARTBEAT_PONG)}catch(e){return u.v.error(e),!1}})}send(e,t){return(0,r.sH)(this,void 0,void 0,function*(){if(this.ongoingRefresh){if(!(yield this.ongoingRefresh))throw new Error("Cannot send message: session refresh failed")}return this.transport.post(this.host,e)})}httpMode(){return!0}setValidSession(e){u.v.deprecated("setValidSession","Please refrain from calling this API as this state is managed internally.","15.0.0")}connect(e){return(0,r.sH)(this,void 0,void 0,function*(){return this.host=this.transport.toHttpHost(e),this.checkHost().then(e=>(this.isConnected=e,this.session.setSessionStorageItem("hostUrl",this.host),e))})}disconnect(){this.isConnected=!1,this.streams.clear(),this.ongoingTurbo={},this.host=void 0}snapshot(e,t){return(0,r.sH)(this,void 0,void 0,function*(){const s=this.messageBuilder.createDataLogonMessage(e,t);return u.v.debug(`HTTP MODE - ${s.MESSAGE_TYPE} (snapshot) message created -> `,s),this.send(s).then(e=>(this.dataLogoff(s.SOURCE_REF).catch(e=>u.v.error(e)),e))})}stream(e,t,s,r){var i,n;const o=this.messageBuilder.createDataLogonMessage(e,r);u.v.debug(`HTTP MODE - ${o.MESSAGE_TYPE} (stream) message created -> `,o);const a=o.SOURCE_REF,c=(null===(n=null===(i=this.config.polling)||void 0===i?void 0:i.POLLING_INTERVAL_MAP)||void 0===n?void 0:n[e])||this.config.polling.POLLING_FREQUENCY;this.streams.set(a,{SOURCE_REF:a,POLLING_FREQUENCY:new R.t(c),RESOURCE_NAME:e});const d=this.streams.get(a).POLLING_FREQUENCY,h=(0,p.x)((0,m.H)(this.send(o)),d.pipe((0,T.p)(()=>"visible"===document.visibilityState)).pipe((0,f.n)(e=>(0,_.Y)(e))).pipe((0,f.n)(()=>(0,m.H)(this.getMessage(o))))).pipe((0,A.v)(()=>this.streams.has(a)),(0,O.L)({count:G.MAX_RETRIES,delay:(e,t)=>{var s;const r=e;u.v.error(`Retry ${t}/${G.MAX_RETRIES}: status ${null!==(s=r.status)&&void 0!==s?s:"unknown"}`,r);if(!(0===r.status||r.status&&r.status>=S.v.BAD_REQUEST&&r.status<S.v.INTERNAL_SERVER_ERROR))throw e;return r.status===S.v.NOT_FOUND&&this.streams.delete(a),r.status===S.v.UNAUTHORIZED?(0,m.H)(this.handleSessionRefresh()):(0,I.O)(G.RETRY_DELAY_MS)}}),(0,C.j)(()=>{u.v.debug(`Terminating stream for ${e} - ${a}`),this.dataLogoff(a)}));return this.streams.get(a).STREAM=h,h}streamState(e,t=()=>{},s=()=>{},r,i=[]){return this.stream(e,t,s,r).pipe((0,c.S)(F,i))}streamWithoutAutoTeardown(e,t,s,r){return u.v.deprecated("streamWithoutAutoTeardown","Please use 'stream' api instead.","15.0.0"),this.stream(e,t,s,r)}getMessage(e){return(0,r.sH)(this,void 0,void 0,function*(){if(this.ongoingRefresh){if(!(yield this.ongoingRefresh))throw new Error("Cannot get message: session refresh failed")}return this.transport.get(this.host,e)})}getMoreRows(e){return(0,r.sH)(this,void 0,void 0,function*(){const t=this.messageBuilder.createMoreRowsMessage(e);return u.v.debug(`HTTP MODE - ${t.MESSAGE_TYPE} message created -> `,t),this.send(t)})}getMoreColumns(e){return(0,r.sH)(this,void 0,void 0,function*(){const t=this.messageBuilder.createMoreColumnsMessage(e);return this.send(t)})}dataLogoff(e){return(0,r.sH)(this,void 0,void 0,function*(){const t=this.messageBuilder.createDataLogoffMessage(e);return this.send(t).then(t=>(this.streams.has(e)&&(u.v.debug(`Removing stream ${e}`),this.streams.delete(e)),t))})}getMetadata(e){return(0,r.sH)(this,arguments,void 0,function*(e,t=!0){if(t&&this.metaCache.hasMetadataFor(e))return u.v.debug(`HTTP MODE - Cached metadata retrieved for ${e}`),this.metaCache.getMetadataFor(e);const s=this.messageBuilder.createMetaRequestMessage(e);u.v.debug(`HTTP MODE - ${s.MESSAGE_TYPE} (metadata) message created -> `,s);const r=yield this.send(s).then(e=>e.DETAILS);return Object.keys(r).length&&this.metaCache.setMetadataFor(e,r),r})}getJSONSchema(e){return(0,r.sH)(this,void 0,void 0,function*(){const t=this.messageBuilder.createMetaRequestMessage(e,U.Gp.JSON_SCHEMA_REQUEST);return u.v.debug(`HTTP MODE! - ${t.MESSAGE_TYPE} (json schema) message created -> `,t),this.send(t)})}request(e,t){return(0,r.sH)(this,arguments,void 0,function*(e,t,s=!1){const r=(0,U.d2)(e,t);if(s&&this.metaCache.hasRequestFor(r))return u.v.debug(`HTTP MODE - Cached request response retrieved for ${r}`),this.metaCache.getRequestFor(r);const i=this.inFlightRequests.get(r);if(i)return u.v.debug(`HTTP MODE - In-flight request collapsed for ${r}`),i;const n=this.messageBuilder.createRequestMessage(e,t);u.v.debug(`HTTP MODE! - ${n.MESSAGE_TYPE} (request server) message created -> `,n);const o=this.transport.requestServer(this.host,n).finally(()=>{this.inFlightRequests.delete(r)});this.inFlightRequests.set(r,o);const a=yield o;return s&&a&&this.metaCache.setRequestFor(r,a),a})}getAvailableResources(e){return(0,r.sH)(this,arguments,void 0,function*(e,t=!0){if(t&&this.metaCache.hasResources())return u.v.debug("HTTP MODE - Cached resources retrieved"),this.metaCache.getResources();const s=this.messageBuilder.createResourcesMessage(e);u.v.debug(`HTTP MODE! - ${s.MESSAGE_TYPE} (getResources) message created -> `,s);const r=yield this.send(s);return this.metaCache.setResources(r),r})}commitEvent(e,t){return(0,r.sH)(this,void 0,void 0,function*(){const s=this.messageBuilder.createCommitMessage(e,t);return u.v.debug(`HTTP MODE! - ${s.MESSAGE_TYPE} (commit) message created -> `,s),this.send(s).then(t=>(this.maybeTurbo(e,t),t))})}maybeTurbo(e,t){var s;if(!(null===(s=null==t?void 0:t.MESSAGE_TYPE)||void 0===s?void 0:s.endsWith("_ACK")))return;if(this.ongoingTurbo[e])return void u.v.debug(`${e} polling frequency is already accelerated.`);const r=this.config.polling.POLLING_MAP[e];if(!(null==r?void 0:r.TEMP_FREQUENCY)||!r.AMOUNT_OF_POLLS)return;const i=r.TEMP_FREQUENCY,n=i*r.AMOUNT_OF_POLLS,o=JSON.parse(JSON.stringify(this.config.polling.POLLING_INTERVAL_MAP)),a=JSON.parse(JSON.stringify(this.config.polling.POLLING_INTERVAL_MAP));for(const e of r.QUERIES)a[e]=i,o[e]||(o[e]=this.config.polling.POLLING_FREQUENCY);u.v.debug(`${e} TRIGGERED -> ENFORCING TURBO | FREQUENCY=${i}ms DURATION=${n}`),this.ongoingTurbo[e]=!0,this.updateIntervals({polling:{POLLING_INTERVAL_MAP:a}}),setTimeout(()=>{u.v.debug(`RESTORED ORIGINAL POLLING INTERVALS FOR ${e}`),this.updateIntervals({polling:{POLLING_INTERVAL_MAP:o}}),this.ongoingTurbo[e]=!1},n)}updateIntervals(e){const{POLLING_INTERVAL_MAP:t}=e.polling;t&&(this.config.polling.POLLING_INTERVAL_MAP=t,this.handlePollingIntervalMapUpdate(t))}handlePollingIntervalMapUpdate(e){if(e)for(const t in e){if(!e.hasOwnProperty(t))continue;const s=e[t];this.config.polling.POLLING_INTERVAL_MAP[t]=s,u.v.debug(`Setting polling frequency for ${t} = ${s}`),[...this.streams.values()].filter(e=>e.RESOURCE_NAME===t).forEach(e=>{var t;return null===(t=null==e?void 0:e.POLLING_FREQUENCY)||void 0===t?void 0:t.next(s)})}}};H.REAUTH_WAIT_MS=5e3,H.RETRY_DELAY_MS=1e3,H.MAX_RETRIES=3,(0,r.Cg)([o.observable],H.prototype,"host",void 0),(0,r.Cg)([o.observable],H.prototype,"isWorking",void 0),(0,r.Cg)([o.observable],H.prototype,"_isConnected",void 0),(0,r.Cg)([o.volatile],H.prototype,"isConnected",null),H=G=(0,r.Cg)([(0,r.Qj)(0,M.l),(0,r.Qj)(1,U.lT),(0,r.Qj)(2,b.N),(0,r.Qj)(3,h),(0,r.Qj)(4,v.b_),(0,r.Qj)(5,L),(0,r.Qj)(6,w)],H);const k=a.DI.createInterface(e=>e.singleton(H));var $=s(45230);let V=class{get isConnected(){return this.socket.isConnected}get isConnectedSubject(){return this.socket.isConnectedSubject}get isConnected$(){var e;return null===(e=this.socket.isConnectedSubject)||void 0===e?void 0:e.asObservable()}get host(){return this.socket.host}constructor(e,t,s,r,i,n){this.socket=e,this.messageBuilder=t,this.metaCache=s,this.events=r,this.config=i,this.transport=n,this.isWorking=!1,this.inFlightRequests=new Map}httpMode(){return!1}get useHttpReqRep(){return"true"===i.Tp||(0,n.m4)("forceHttpReqRep")}get httpHost(){return this.transport.toHttpHost(this.socket.host)}sendReqRep(e){return this.useHttpReqRep?this.transport.post(this.httpHost,e):this.socket.send(e)}setValidSession(e){u.v.deprecated("setValidSession","Please refrain from calling this API as this state is managed internally.","15.0.0")}send(e,t){return this.socket.send(e,t)}connect(){return(0,r.sH)(this,arguments,void 0,function*(e=i.vN){return this.socket.reset(),this.socket.connect(e,this.config.connect,this.config.reconnect)})}disconnect(){this.socket.reset()}snapshot(e,t){return(0,r.sH)(this,void 0,void 0,function*(){const s=this.messageBuilder.createDataLogonMessage(e,t);return u.v.debug(`${s.MESSAGE_TYPE} (snapshot) message created -> `,s),this.socket.send(s)})}stream(e,t,s,r){const i=this.messageBuilder.createDataLogonMessage(e,r);u.v.debug(`${i.MESSAGE_TYPE} (stream) message created -> `,i);const n=performance.now();let o=null;const a=this.socket.sendForStream(i,(...s)=>{null===o&&(o=performance.now(),u.v.debug(`[stream:${e}] time to initial response: ${(o-n).toFixed(2)}ms`)),t(...s)},t=>{s(t),this.events.onStreamErrorEvent(e,a,t)},()=>{this.events.onStreamCompleteEvent(e,a)});return this.events.onStreamEvent(e,i,a,{onMessage:t,onError:s}),a}streamState(e,t=()=>{},s=()=>{},r,i=[]){return this.stream(e,t,s,r).pipe((0,c.S)(F,i))}streamWithoutAutoTeardown(e,t,s,r){u.v.deprecated("streamWithoutAutoTeardown","Please use 'stream' api instead.","15.0.0");const i=this.messageBuilder.createDataLogonMessage(e,r);u.v.debug(`${i.MESSAGE_TYPE} (stream without auto-teardown) message created -> `,i);const n=this.socket.sendForStreamWithoutTeardown(i,t,t=>{s(t),this.events.onStreamErrorEvent(e,n,t)});return this.events.onStreamEvent(e,i,n,{onMessage:t,onError:s}),n}getMoreRows(e,t){return(0,r.sH)(this,void 0,void 0,function*(){const s=this.messageBuilder.createMoreRowsMessage(e,t);return u.v.debug(`${s.MESSAGE_TYPE} message created -> `,s),this.socket.send(s,!1)})}getMoreColumns(e){return(0,r.sH)(this,void 0,void 0,function*(){const t=this.messageBuilder.createMoreColumnsMessage(e);return this.socket.send(t)})}dataLogoff(e){return(0,r.sH)(this,void 0,void 0,function*(){const t=this.messageBuilder.createDataLogoffMessage(e);return u.v.debug(`${t.MESSAGE_TYPE} message created -> `,t),this.socket.send(t)})}getMetadata(e){return(0,r.sH)(this,arguments,void 0,function*(e,t=!0){var s;if(t&&this.metaCache.hasMetadataFor(e))return u.v.debug(`Cached metadata retrieved for ${e}`),this.metaCache.getMetadataFor(e);const r=this.messageBuilder.createMetaRequestMessage(e);let i,n;u.v.debug(`${r.MESSAGE_TYPE} (metadata) message created -> `,r);try{this.isWorking=!0;const t=yield this.sendReqRep(r);i=null!==(s=null==t?void 0:t.DETAILS)&&void 0!==s?s:{},Object.keys(i).length&&this.metaCache.setMetadataFor(e,i)}catch(t){throw n=t,u.v.error((0,l.O)(`Metadata request failed for ${e}`,t),t),t instanceof Error?t:new Error(String(t))}finally{this.events.onMetadataEvent(e,r,n),this.isWorking=!1}return i})}getJSONSchema(e){return(0,r.sH)(this,arguments,void 0,function*(e,t=!0){var s;if(t&&this.metaCache.hasJsonSchemaFor(e))return u.v.debug(`Cached JsonSchema retrieved for ${e}`),this.metaCache.getJsonSchemaFor(e);const r=this.messageBuilder.createMetaRequestMessage(e,U.Gp.JSON_SCHEMA_REQUEST);let i;u.v.debug(`${r.MESSAGE_TYPE} (json schema) message created -> `,r);try{this.isWorking=!0,i=null!==(s=yield this.sendReqRep(r))&&void 0!==s?s:{},Object.keys(i).length&&this.metaCache.setJsonSchemaFor(e,i)}catch(t){u.v.error((0,l.O)(`JSON schema request failed for ${e}`,t),t)}finally{this.isWorking=!1}return i})}request(e,t){return(0,r.sH)(this,arguments,void 0,function*(e,t,s=!1){const r=(0,U.d2)(e,t);if(s&&this.metaCache.hasRequestFor(r))return u.v.debug(`Cached request response retrieved for ${r}`),this.metaCache.getRequestFor(r);const i=this.inFlightRequests.get(r);if(i)return u.v.debug(`In-flight request collapsed for ${r}`),i;const n=this.messageBuilder.createRequestMessage(e,t);u.v.debug(`${n.MESSAGE_TYPE} (request server) message created -> `,n);const o=(this.useHttpReqRep?this.transport.requestServer(this.httpHost,n):this.socket.send(n)).finally(()=>{this.inFlightRequests.delete(r)});this.inFlightRequests.set(r,o);const a=yield o;return s&&a&&this.metaCache.setRequestFor(r,a),a})}getAvailableResources(e){return(0,r.sH)(this,arguments,void 0,function*(e,t=!0){if(t&&this.metaCache.hasResources())return u.v.debug("Cached resources retrieved"),this.metaCache.getResources();const s=this.messageBuilder.createResourcesMessage(e);u.v.debug(`${s.MESSAGE_TYPE} (resources) message created -> `,s);const r=yield this.sendReqRep(s);return this.metaCache.setResources(r),r})}commitEvent(e,t){return(0,r.sH)(this,void 0,void 0,function*(){const s=this.messageBuilder.createCommitMessage(e,t);u.v.debug(`${s.MESSAGE_TYPE} (commit) message created -> `,s);const r=this.sendReqRep(s);return this.events.onCommitEvent(e,s),r.then(t=>(this.events.onCommitResponseEvent(e,t),t))})}};(0,r.Cg)([o.observable],V.prototype,"isWorking",void 0),V=(0,r.Cg)([(0,r.Qj)(0,$.yQ),(0,r.Qj)(1,U.lT),(0,r.Qj)(2,h),(0,r.Qj)(3,E.EQ),(0,r.Qj)(4,g.R),(0,r.Qj)(5,w)],V);const B="true"===i.PF||(0,n.m4)("forceHttp"),q=a.DI.createInterface(e=>e.singleton(V)),W=a.DI.createInterface(e=>B?e.aliasTo(k):e.aliasTo(q));function x(){return a.DI.getOrCreateDOMContainer().get(W)}},49587(e,t,s){s.d(t,{R:()=>n});var r=s(38370);const i={connect:{alwaysOn:!1,enableHeartbeat:!0,enableHeartbeatLogging:!1,verboseHeartbeat:!1,enableMessageLogging:!1},reconnect:{reconnectAttempts:10,reconnectInterval:1e4,reconnectStreams:!0},isWebSocketExpression:new RegExp(/wss?:\/\/[-a-zA-Z0-9@:%._+~#=]{1,256}\b([-a-zA-Z0-9()@:%_+.~#?&/=]*)\b\/*$/,"i")},n=r.DI.createInterface(e=>e.instance(i))},32748(e,t,s){s.d(t,{l:()=>a});var r=s(55823),i=s(49229),n=s(38370);let o=class{constructor(e){this.serializer=e}get(e,t){return(0,r.sH)(this,void 0,void 0,function*(){const s=yield fetch(e,Object.assign(Object.assign({credentials:"include",headers:{"Content-type":"application/json; charset=UTF-8"}},t),{method:"GET"}));return this.handleResponse(s,t)})}post(e,t){return(0,r.sH)(this,void 0,void 0,function*(){const s=yield fetch(e,Object.assign(Object.assign({credentials:"include",headers:{"Content-type":"application/json; charset=UTF-8"}},t),{method:"POST"}));return this.handleResponse(s,t)})}handleResponse(e,t){return(0,r.sH)(this,void 0,void 0,function*(){var s;if(e.redirected)return window.location.href=e.url,new Promise(()=>{});if(null===(s=t.onResponse)||void 0===s||s.call(t,e),304===e.status)return;if(!e.ok)throw function(e){const t=new Error(`HTTP error: ${e.status} ${e.statusText}`);return t.status=e.status,t.message=e.statusText,t}(e);return(t.serializer||this.serializer).deserialize(e)})}};o=(0,r.Cg)([(0,r.Qj)(0,i.b_)],o);const a=n.DI.createInterface(e=>e.singleton(o))},21281(e,t,s){s.d(t,{Go:()=>r,Gp:()=>i,d2:()=>l,lT:()=>v,x6:()=>n,z2:()=>E});var r,i,n,o=s(55823),a=s(32808),c=s(38370),d=s(56653),h=s(98316);!function(e){e.LOGON_ACK="LOGON_ACK",e.LOGON_NACK="LOGON_NACK",e.LOGOFF_ACK="LOGOFF_ACK",e.LOGOFF_NACK="LOGOFF_NACK",e.HEARTBEAT_PING="HEARTBEAT_PING",e.HEARTBEAT_PONG="HEARTBEAT_PONG",e.MORE_ROWS="MORE_ROWS",e.MORE_COLUMNS="MORE_COLUMNS",e.MORE_COLUMNS_ACK="MORE_COLUMNS_ACK",e.MSG_ACK="MSG_ACK",e.MSG_NACK="MSG_NACK",e.LOGOUT_ACK="LOGOUT_ACK",e.LOGOUT_NACK="LOGOUT_NACK",e.QUERY_UPDATE="QUERY_UPDATE"}(r||(r={})),function(e){e.EVENT_LOGIN_AUTH="EVENT_LOGIN_AUTH",e.EVENT_LOGIN_AUTH_ACK="EVENT_LOGIN_AUTH_ACK",e.EVENT_LOGIN_AUTH_NACK="EVENT_LOGIN_AUTH_NACK",e.EVENT_LOGOUT="EVENT_LOGOUT",e.DATA_LOGON="DATA_LOGON",e.DATA_LOGOFF="DATA_LOGOFF",e.META_REQUEST="META_REQUEST",e.JSON_SCHEMA_REQUEST="JSON_SCHEMA_REQUEST",e.RESOURCES_REQUEST="RESOURCES_REQUEST",e.RESOURCES_REQUEST_ACK="RESOURCES_REQUEST_ACK",e.RESOURCES_REQUEST_NACK="RESOURCES_REQUEST_NACK",e.EVENT_CHANGE_USER_PASSWORD="EVENT_CHANGE_USER_PASSWORD",e.EVENT_SELF_SERVICE_PASSWORD_RESET="EVENT_SELF_SERVICE_PASSWORD_RESET",e.EVENT_PASSWORD_RESET_ACTION="EVENT_PASSWORD_RESET_ACTION"}(i||(i={})),function(e){e.SESSION_NOT_FOUND="SESSION_NOT_FOUND",e.UNKNOWN_MESSAGE_TYPE="UNKNOWN_MESSAGE_TYPE"}(n||(n={}));const u=e=>Array.isArray(e)?e.map(u):e&&"object"==typeof e&&e.constructor===Object?Object.keys(e).sort().reduce((t,s)=>(t[s]=u(e[s]),t),{}):e;function l(e,t){return`${e}::${JSON.stringify(u(null!=t?t:{}))}`}const E=(e,t)=>!!Array.isArray(null==e?void 0:e.ERROR)&&(null==e?void 0:e.ERROR.some(e=>{var s,r;return(null===(s=e.CODE)||void 0===s?void 0:s.includes(`${t}`))||(null===(r=e.STATUS_CODE)||void 0===r?void 0:r.includes(`${t}`))}));let g=class{constructor(e,t){this.session=e,this.uuid=t}createLoginMessage(e){let t;switch(e.type){case d.h.BASIC:t={USER_NAME:e.username,PASSWORD:e.password,MFA_CODE:e.mfaToken};break;case d.h.REFRESH:t={USER_NAME:e.username,REFRESH_AUTH_TOKEN:e.refreshToken,MFA_CODE:e.mfaToken};break;case d.h.SSO:t={SSO_TOKEN:e.ssoToken};break;case d.h.JWT:t={JWT:e.jwt,DOMAIN:e.domain}}return{DETAILS:t,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:i.EVENT_LOGIN_AUTH}}createLogoutMessage(e){var t,s;return{SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:i.EVENT_LOGOUT,SESSION_AUTH_TOKEN:null!==(t=e.authToken)&&void 0!==t?t:this.session.getSessionStorageItem("authToken"),SESSION_ID:null!==(s=e.sessionId)&&void 0!==s?s:this.session.getSessionStorageItem("sessionId")}}createDataLogonMessage(e,t){return{SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:i.DATA_LOGON,DETAILS:Object.assign({DATASOURCE_NAME:e},t),SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}createDataLogoffMessage(e){return{SOURCE_REF:e,MESSAGE_TYPE:i.DATA_LOGOFF,SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}createRequestMessage(e,t){return Object.assign({SOURCE_REF:this.uuid.createId(),SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken"),MESSAGE_TYPE:e.startsWith("REQ_")?e:`REQ_${e}`},t)}createResourcesMessage(e){return Object.assign({SOURCE_REF:this.uuid.createId(),SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken"),MESSAGE_TYPE:i.RESOURCES_REQUEST},e)}createMetaRequestMessage(e,t=i.META_REQUEST){return{SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:t,DETAILS:{FEATURE:e},SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}createCommitMessage(e,t){return Object.assign({SOURCE_REF:this.uuid.createId(),SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken"),MESSAGE_TYPE:e},t)}createRefreshTokenMessage(){return{SOURCE_REF:this.uuid.createId(),SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken"),MESSAGE_TYPE:i.EVENT_LOGIN_AUTH,DETAILS:{REFRESH_AUTH_TOKEN:this.session.getSessionStorageItem("refreshToken"),MFA_CODE:this.session.getSessionStorageItem("mfaToken")}}}createChangePasswordMessage(e,t,s){return{USER_NAME:e,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:i.EVENT_CHANGE_USER_PASSWORD,DETAILS:{OLD_PASSWORD:t,NEW_PASSWORD:s}}}createForgotPasswordMessage(e,t,s=e){return{USER_NAME:s,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:i.EVENT_SELF_SERVICE_PASSWORD_RESET,DETAILS:{USER_NAME:e,RETURN_URL:t}}}createForgotPasswordTokenMessage(e,t,s,r=e){return{USER_NAME:r,SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:i.EVENT_PASSWORD_RESET_ACTION,DETAILS:{USER_NAME:e,RESET_TOKEN:t,NEW_PASSWORD:s}}}createMoreRowsMessage(e,t){return{SOURCE_REF:this.uuid.createId(),MESSAGE_TYPE:r.MORE_ROWS,DETAILS:{SOURCE_REF:e,VIEW_NUMBER:t},SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}createMoreColumnsMessage(e){return Object.assign(Object.assign({},this.createMoreRowsMessage(e)),{MESSAGE_TYPE:r.MORE_COLUMNS})}createHTTPHeadersFromMessage(e,t="application/json; charset=UTF-8"){const s={"Content-type":t};return e.SOURCE_REF&&(s["source-ref"]=e.SOURCE_REF,s.SOURCE_REF=e.SOURCE_REF),e.SESSION_AUTH_TOKEN&&(s["SESSION-AUTH-TOKEN"]=e.SESSION_AUTH_TOKEN),e.MESSAGE_TYPE===i.EVENT_LOGOUT&&(s["SESSION-ID"]=e.SESSION_ID),s}createHeartbeatPingMessage(e=!1){return{MESSAGE_TYPE:r.HEARTBEAT_PING,SOURCE_REF:this.uuid.createId(),VERBOSE:e,DETAILS:{},SESSION_AUTH_TOKEN:this.session.getSessionStorageItem("authToken")}}};g=(0,o.Cg)([(0,o.Qj)(0,h.N),(0,o.Qj)(1,a.k)],g);const v=c.DI.createInterface(e=>e.singleton(g))},16183(e,t,s){s.d(t,{$G:()=>l,Lj:()=>g,Z8:()=>E,vE:()=>h});var r=s(55823),i=s(84686),n=s(38370),o=s(17465),a=s(32748);const c="reauthActionLock",d=[408,429];var h;!function(e){e.SUCCESS="SUCCESS",e.FAILED="FAILED",e.HANDLED_BY_OTHER_TAB="HANDLED_BY_OTHER_TAB",e.ALREADY_VALID="ALREADY_VALID"}(h||(h={}));function u(){return(0,r.sH)(this,void 0,void 0,function*(){const e=n.DI.getOrCreateDOMContainer().get(a.l);try{const t=yield e.post(i.aW,{body:JSON.stringify({DETAILS:{},MESSAGE_TYPE:"EVENT_LOGIN_AUTH"})});return"EVENT_LOGIN_AUTH_ACK"===t.MESSAGE_TYPE||(o.v.debug("Session refresh rejected: ",t.ERROR),!1)}catch(e){if((e=>{const t=null==e?void 0:e.status;return"number"==typeof t&&t>=400&&t<500&&!d.includes(t)})(e))return o.v.debug(`Session refresh rejected with HTTP ${e.status}`),!1;throw e}})}function l(){return(0,r.sH)(this,arguments,void 0,function*(e={}){const{reloadOnFailure:t=!0,signal:s}=e;if(function(){const e=parseInt(localStorage.getItem(c)||"0");Date.now()-e>3e4&&localStorage.removeItem(c)}(),localStorage.getItem(c)||(localStorage.setItem(c,Date.now().toString()),0))return h.HANDLED_BY_OTHER_TAB;try{if(yield function(e){return(0,r.sH)(this,void 0,void 0,function*(){const t=yield fetch(i.Be,{credentials:"include",signal:e});return 401!==t.status&&"EVENT_LOGIN_DETAILS_ACK"===(yield t.json()).MESSAGE_TYPE})}(s))return h.ALREADY_VALID;return(yield u())?h.SUCCESS:(t&&window.location.reload(),h.FAILED)}finally{localStorage.removeItem(c)}})}function E(e){const t=s=>{s.key===c&&null===s.newValue&&(e(),window.removeEventListener("storage",t))};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)}function g(e){return new Promise(t=>{const s=()=>{r(),e.removeEventListener("abort",s),t()},r=E(s);e.aborted?s():e.addEventListener("abort",s)})}},45230(e,t,s){s.d(t,{yQ:()=>k,Ol:()=>$});var r=s(55823),i=s(92277),n=s(84686),o=s(49229),a=s(32808),c=s(33681),d=s(38370),h=s(50049),u=s(37970),l=s(26274),E=s(1762),g=s(75841),v=s(84190),S=s(67130),R=s(28138),p=s(66640),m=s(53940),T=s(48653),f=s(98316),_=s(17465),A=s(56093),O=s(49587),I=s(32748),C=s(21281);const b=1e4,M=6e4;var N;!function(e){e.Linear="linear",e.Exponential="exponential"}(N||(N={}));const L=(e,t)=>{const{reconnectInterval:s=b}=e,r=s>M?M:s,i=Math.round(Math.log2(M/r));return r*Math.pow(2,t%i)},y=e=>{const{reconnectInterval:t=b}=e;return t>M?M:t};var U=s(16183),D=s(5709);class w{constructor(e){this.interval=e}get workerScript(){return`\n const startTime = Date.now();\n setInterval(function() {\n self.postMessage(Date.now() - startTime);\n }, ${this.interval});\n `}start(e){this.stop(),this.runWorker(e)}stop(){this.worker&&(this.worker.terminate(),delete this.worker)}runWorker(e){this.worker||(this.worker=new Worker(URL.createObjectURL(new Blob([this.workerScript],{type:"text/javascript"}))),this.worker.onmessage=t=>e(t.data))}}class P extends h.B{constructor(){super()}}u.c;class F{constructor(e,t,s,r){this._message=e,this._onMessage=t,this._onError=s,this._isSubscription=r}get sentMessage(){return this._message}get onReceivedMessage(){return this._onMessage}get onReceivedError(){return this._onError}get isSubscription(){return this._isSubscription}}const G=e=>new Promise(t=>{e.addEventListener("abort",()=>t(void 0),{once:!0})});let H=class{get isConfigured(){return this.status.isConfigured}get isConnecting(){return this.status.isConnecting}get isConnected(){return this.status.isConnected}get isConnectedSubject(){return this.status.isConnectedSubject}get isDisconnected(){return this.status.isDisconnected}get isDisconnectedByServer(){return this.status.isDisconnectedByServer}get isReconnecting(){return this.status.isReconnecting}get hasValidSession(){return _.v.deprecated("get hasValidSession","Use `User.isAuthenticated` from `@genesislcap/foundation-user` instead.","15.0.0"),this.user.isAuthenticated}set hasValidSession(e){_.v.deprecated("set hasValidSession","Please refrain from calling this API as this state is managed internally.","15.0.0")}get host(){var e;return null!==(e=this.url)&&void 0!==e?e:n.vN}constructor(e,t,s,r,i,n,o){this.messageBuilder=e,this.session=t,this.serializer=s,this.uuid=r,this.status=i,this.user=n,this.config=o,this.defaultInterval=1e4,this.secondsMultiplier=1e3,this.sessionCheckTimeout=1e4,this.heartbeatIsEnabled=!0,this.heartbeatInterval=this.defaultInterval,this.socketMessages=()=>this.wsMessages}get heartbeatLoggingIsEnabled(){var e,t;return null!==(t=null===(e=this.connectOptions)||void 0===e?void 0:e.enableHeartbeatLogging)&&void 0!==t&&t}get messageLoggingIsEnabled(){var e,t;return null!==(t=null===(e=this.connectOptions)||void 0===e?void 0:e.enableMessageLogging)&&void 0!==t&&t}connect(e=n.vN,t,s){var i;return this.url=e,this.connectOptions=null!=t?t:this.config.connect,this.reconnectOptions=null!=s?s:this.config.reconnect,(null===(i=this.config.isWebSocketExpression)||void 0===i?void 0:i.test(this.host))?new Promise(e=>{var t,s,i,n;_.v.info(`${this.isReconnecting?"Reconnecting":"Connecting"} to ${this.url}`),this.status.isConnecting=!this.isReconnecting;(!this.isReconnecting||!(null===(t=this.reconnectOptions)||void 0===t?void 0:t.reconnectStreams))&&this.cleanMessages(),null===(s=this.socketSubscription)||void 0===s||s.unsubscribe(),this.websocket=new T.Q({url:this.url,openObserver:{next:()=>{this.session.setSessionStorageItem("hostUrl",this.url),this.status.isConnected=!0,this.prepareHeartbeat(),_.v.info("WebSocket connection is now open"),e(this.isConnected)}},closeObserver:{next:t=>{this.status.onClose(t),this.isDisconnectedByServer&&_.v.info(`WebSocket connection was closed due an error - Code: ${t.code} ${t.reason?" | Reason: "+t.reason:""}`),e(this.isConnected)}},serializer:e=>this.serializer.serialize(e),deserializer:e=>this.serializer.deserialize(e)});this.socketSubscription=this.websocket.subscribe(null!==(n=null===(i=this.connectOptions)||void 0===i?void 0:i.connectObserver)&&void 0!==n?n:{next:e=>(0,r.sH)(this,void 0,void 0,function*(){const t=`Response Message received for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;this.logMessageTypeFlow(e.MESSAGE_TYPE,_.v.info,t);const{SOURCE_REF:s,MESSAGE_TYPE:r}=e,i=this.getMessageHandler(s,r);if(!i)return void(e.MESSAGE_TYPE===C.Go.MSG_NACK&&e.ERROR&&e.ERROR.forEach(t=>{_.v.error((0,A.O)(`MessageType: ${e.MESSAGE_TYPE} | Error Details:`,t),t)}));let n=!1;switch(e.MESSAGE_TYPE){case C.Gp.EVENT_LOGIN_AUTH_ACK:this.applyServerHeartbeatInterval(e.DETAILS);break;case C.Go.LOGOUT_ACK:return i.onReceivedMessage.call(this,e),void this.cleanMessages();case C.Go.LOGON_ACK:return;case C.Go.LOGOFF_ACK:break;case C.Go.QUERY_UPDATE:i.isSubscription||this.sendDataLogoff(s);break;case C.Go.MSG_NACK:case C.Go.LOGON_NACK:n=!0}n?i.onReceivedError.call(this,{receivedMessage:e,sentMessage:i.sentMessage}):i.onReceivedMessage.call(this,e),this.wsMessages.next(e),i.isSubscription||this.removeMessageHandler(s)}),error:e=>{_.v.debug("Error found: ",e),this.reconnect()},complete:()=>{var e;this.isDisconnectedByServer&&(null===(e=this.connectOptions)||void 0===e?void 0:e.alwaysOn)?this.reconnect():_.v.info("Connection is now closed")}}),this.status.isConfigured=!0}):(_.v.error(`Specified host (${this.host}) is not valid WebSocket url. Connection will not proceed.`),void _.v.warn("Make sure the host url starts with wss:// or ws://"))}handleExpiredSession(){return(0,r.sH)(this,void 0,void 0,function*(){if(this.usesCookieAuth)yield this.handleCookieBasedReauth();else{const e=this.messageBuilder.createRefreshTokenMessage(),t=yield this.send(e);this.session.setAuthResult(t),this.updateSessionAndSubscriptions(t)}})}get usesCookieAuth(){return!this.session.getSessionStorageItem("refreshToken")}handleCookieBasedReauth(){return(0,r.sH)(this,void 0,void 0,function*(){const e=yield(0,U.$G)();e!==U.vE.HANDLED_BY_OTHER_TAB?e!==U.vE.FAILED&&(yield this.connect()):(0,U.Z8)(()=>this.connect())})}updateSessionAndSubscriptions(e){(null==e?void 0:e.MESSAGE_TYPE)===C.Gp.EVENT_LOGIN_AUTH_ACK&&this.wsMessageHandlers.forEach(t=>{t.isSubscription&&(t.sentMessage.SESSION_AUTH_TOKEN=e.SESSION_AUTH_TOKEN,this.websocket.next(t.sentMessage))})}applyServerHeartbeatInterval(e){var t,s;const r=null!==(t=null==e?void 0:e.HEARTBEAT_INTERVAL_SECONDS)&&void 0!==t?t:0;r>0&&void 0===(null===(s=this.connectOptions)||void 0===s?void 0:s.heartbeatInterval)&&(this.heartbeatInterval=r*this.secondsMultiplier,this.prepareHeartbeat())}prepareHeartbeat(){var e,t,s,i;this.heartbeatTicker&&this.heartbeatTicker.stop();const n=()=>(0,r.sH)(this,void 0,void 0,function*(){var e,t,s;if(!this.isConnected)return;const r=this.messageBuilder.createHeartbeatPingMessage(null===(e=this.connectOptions)||void 0===e?void 0:e.verboseHeartbeat);(null===(t=this.connectOptions)||void 0===t?void 0:t.heartbeatPingCallback)&&this.connectOptions.heartbeatPingCallback(r);const i=yield this.send(r);this.user.isAuthenticated&&!i.IS_AUTHENTICATED&&this.handleExpiredSession(),(null===(s=this.connectOptions)||void 0===s?void 0:s.heartbeatPongCallback)&&this.connectOptions.heartbeatPongCallback(i),this.heartbeatIsEnabled=i.MESSAGE_TYPE===C.Go.HEARTBEAT_PONG&&i.SOURCE_REF===r.SOURCE_REF});if(null!==(t=null===(e=this.connectOptions)||void 0===e?void 0:e.enableHeartbeat)&&void 0!==t?t:this.heartbeatIsEnabled){const e=null!==(i=null===(s=this.connectOptions)||void 0===s?void 0:s.heartbeatInterval)&&void 0!==i?i:this.heartbeatInterval;this.heartbeatTicker=new w(e),this.heartbeatTicker.start(()=>{this.websocket&&this.isConnected&&(n(),this.heartbeatLoggingIsEnabled&&_.v.debug(`Sending a heartbeat ping every ${e} ms`))})}}reconnect(){var e,t,s,r,i;const n=!(null===(e=this.connectOptions)||void 0===e?void 0:e.alwaysOn)&&!1===(null===(t=this.connectOptions)||void 0===t?void 0:t.enableHeartbeat);if(this.isReconnecting||n)return;this.status.isReconnecting=!0;const o=(null===(s=this.reconnectOptions)||void 0===s?void 0:s.reconnectStrategy)===N.Exponential?L:y,a=this.isConnectedSubject.asObservable().pipe((0,v.n)(e=>e?(0,g.of)(-1):((e,t)=>new u.c(s=>{let r,i=0;return function n(){s.next(i),s.closed||(clearTimeout(r),r=setTimeout(n,t(e,i)),i+=1)}(),()=>{clearTimeout(r)}}))(this.reconnectOptions,o).pipe((0,S.p)((e,t)=>{var s,r,i;const n=(null===(s=this.connectOptions)||void 0===s?void 0:s.alwaysOn)?t+1:null!==(i=null===(r=this.reconnectOptions)||void 0===r?void 0:r.reconnectAttempts)&&void 0!==i?i:10;return t>=n?(this.status.reconnectionLimitReached=!0,(0,l.$)(()=>new Error(`Max reconnect attempts ${n} reached.`))):e>0&&this.user.isAuthenticated&&this.usesCookieAuth?(0,E.H)(this.refreshSessionBeforeReconnect()).pipe((0,R.T)(()=>t)):(0,g.of)(t)}))),(0,p.v)(()=>this.websocket&&!this.isConnected));a.subscribe(null!==(i=null===(r=this.reconnectOptions)||void 0===r?void 0:r.reconnectObserver)&&void 0!==i?i:{next:e=>{_.v.debug(`Attempt no. ${e+1} to reconnect`),this.websocket.complete(),this.connect(this.url,this.connectOptions,this.reconnectOptions)},error:e=>{var t;_.v.debug(e),null===(t=this.socketSubscription)||void 0===t||t.unsubscribe(),this.status.isReconnecting=!1},complete:()=>{_.v.info(this.isConnected?"Reconnected":"Disconnected"),this.status.isReconnecting=!1,this.wsMessageHandlers.forEach(e=>{e.isSubscription&&this.websocket.next(e.sentMessage)})}})}refreshSessionBeforeReconnect(){return(0,r.sH)(this,void 0,void 0,function*(){const e=AbortSignal.timeout(this.sessionCheckTimeout),t=yield Promise.race([(0,U.$G)({reloadOnFailure:!1,signal:e}),G(e)]).catch(e=>{_.v.debug("Could not check the session before reconnecting: ",e)});if(t===U.vE.FAILED)throw this.reloadPage(),new Error("Session expired and could not be refreshed.");t===U.vE.HANDLED_BY_OTHER_TAB&&(yield(0,U.Lj)(e))})}reloadPage(){window.location.reload()}reset(){this.status.isConnected=!1,this.status.isConfigured=!1,this.websocket&&this.websocket.complete(),this.websocket=null,this.cleanMessages()}cleanMessages(){this.wsMessages&&this.wsMessages.complete(),this.wsMessages=new P,this.wsMessageHandlers=new Map}send(e,t=!0){if(!this.isConnected)return Promise.reject(new Error("WebSocket connection is closed"));const s=`Sending Message for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;return this.logMessageTypeFlow(e.MESSAGE_TYPE,_.v.info,s),new Promise((s,r)=>{const i=e=>{s(e)},n=e=>{r(e)};t&&this.setMessageHandler(e,i,n),this.websocket.next(e)})}sendForStream(e,t,s,r){if(!this.isConnected)return(0,l.$)(()=>new Error("WebSocket connection is closed"));const i=`Sending Message (stream) for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;return this.logMessageTypeFlow(e.MESSAGE_TYPE,_.v.info,i),this.setMessageHandler(e,t,s,!0),c.DOM.queueUpdate(()=>this.websocket.next(e)),new u.c(t=>{const s=this.wsMessages.pipe((0,m.p)(t=>t.SOURCE_REF===e.SOURCE_REF)).subscribe({next:e=>{t.next(e)},error:e=>{t.error(e)},complete:()=>{t.complete()}});return()=>{s.unsubscribe(),this.sendDataLogoff(e.SOURCE_REF),this.removeMessageHandler(e.SOURCE_REF),r&&r()}})}sendForStreamWithoutTeardown(e,t,s){if(!this.isConnected)return(0,l.$)(()=>new Error("WebSocket connection is closed"));const r=`Sending Message (stream) for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;return this.logMessageTypeFlow(e.MESSAGE_TYPE,_.v.info,r),this.setMessageHandler(e,t,s,!0),this.websocket.next(e),this.wsMessages.pipe((0,m.p)(t=>t.SOURCE_REF===e.SOURCE_REF))}setMessageHandler(e,t,s,r=!1){const i=`Setting Message Handler for SourceRef: ${e.SOURCE_REF} | MessageType: ${e.MESSAGE_TYPE}`;this.logMessageTypeFlow(e.MESSAGE_TYPE,_.v.debug,i),this.wsMessageHandlers.set(e.SOURCE_REF,new F(e,t,s,r))}sendDataLogoff(e){this.send(this.messageBuilder.createDataLogoffMessage(e),!1)}removeMessageHandler(e){this.wsMessageHandlers.delete(e)}getMessageHandler(e,t){const s=`Getting Message Handler for SourceRef: ${e} | MessageType: ${t}`;return this.logMessageTypeFlow(t,_.v.debug,s),this.wsMessageHandlers.get(e)}logMessageTypeFlow(e,t,s){switch(e){case C.Gp.DATA_LOGOFF:t(s);break;case C.Go.HEARTBEAT_PING:case C.Go.HEARTBEAT_PONG:this.heartbeatLoggingIsEnabled&&t(s);break;default:this.messageLoggingIsEnabled&&t(s)}}};(0,r.Cg)([c.observable],H.prototype,"websocket",void 0),(0,r.Cg)([c.observable],H.prototype,"wsMessages",void 0),(0,r.Cg)([c.observable],H.prototype,"wsMessageHandlers",void 0),(0,r.Cg)([I.l],H.prototype,"http",void 0),(0,r.Cg)([c.observable],H.prototype,"heartbeatIsEnabled",void 0),H=(0,r.Cg)([(0,r.Qj)(0,C.lT),(0,r.Qj)(1,f.N),(0,r.Qj)(2,o.b_),(0,r.Qj)(3,a.k),(0,r.Qj)(4,D.S5),(0,r.Qj)(5,i.KJ),(0,r.Qj)(6,O.R)],H);const k=d.DI.createInterface(e=>e.singleton(H));function $(){return d.DI.getOrCreateDOMContainer().get(k)}},5709(e,t,s){s.d(t,{S5:()=>d});var r=s(55823),i=s(92277),n=s(33681),o=s(38370),a=s(97156);class c{constructor(){this.isConfigured=!1,this.isConnecting=!1,this.isConnected=!1,this.isReconnecting=!1,this.reconnectionLimitReached=!1,this.isConnectedSubject=new a.t(this.isConnected)}get hasValidSession(){return this.user.isAuthenticated}get isDisconnected(){return!this.isConnected}get isDisconnectedByServer(){return void 0!==this.closedClean&&!this.closedClean}isConnectedChanged(){var e;this.isConnected&&this.resetClosedState(),this.isConnecting=!1,this.isReconnecting=!1,null===(e=this.isConnectedSubject)||void 0===e||e.next(this.isConnected)}isReconnectingChanged(){this.isReconnecting&&(this.reconnectionLimitReached=!1)}resetClosedState(){this.closedCode=void 0,this.closedReason=void 0,this.closedClean=void 0}serialize(){return{isConfigured:this.isConfigured,isConnecting:this.isConnecting,isConnected:this.isConnected,isDisconnected:this.isDisconnected,isDisconnectedByServer:this.isDisconnectedByServer,isReconnecting:this.isReconnecting,reconnectionLimitReached:this.reconnectionLimitReached,hasValidSession:this.hasValidSession,closedCode:this.closedCode,closedReason:this.closedReason,closedClean:this.closedClean}}onClose(e){this.isConnected=!1,this.closedCode=e.code,this.closedReason=e.reason,this.closedClean=e.wasClean}}(0,r.Cg)([n.observable],c.prototype,"isConfigured",void 0),(0,r.Cg)([n.observable],c.prototype,"isConnecting",void 0),(0,r.Cg)([n.observable],c.prototype,"isConnected",void 0),(0,r.Cg)([n.observable],c.prototype,"isReconnecting",void 0),(0,r.Cg)([n.observable],c.prototype,"reconnectionLimitReached",void 0),(0,r.Cg)([n.observable],c.prototype,"closedCode",void 0),(0,r.Cg)([n.observable],c.prototype,"closedReason",void 0),(0,r.Cg)([n.observable],c.prototype,"closedClean",void 0),(0,r.Cg)([i.KJ],c.prototype,"user",void 0);const d=o.DI.createInterface(e=>e.singleton(c))},34193(e,t,s){s.d(t,{d:()=>i});var r=s(17465);function i(e,t="ROW_REF"){const s=e=>{var s;const r=null!==(s=e.DETAILS[t])&&void 0!==s?s:e[t],i=Object.assign(Object.assign({},e),{[t]:r});return delete i.DETAILS,i},i=[],n=[],o=[];for(const t of e.ROW)if(t.DETAILS)switch(t.DETAILS.OPERATION){case"INSERT":i.push(s(t));break;case"MODIFY":o.push(s(t));break;case"DELETE":n.push(s(t));break;default:r.v.error(`Unsupported operation type: '${t.DETAILS.OPERATION}'`)}return{inserts:i,deletes:n,updates:o,SOURCE_REF:e.SOURCE_REF}}},70002(e,t,s){s.d(t,{SG:()=>n,TA:()=>o,kG:()=>i});var r=s(6884);function i(e){const t=null==e?NaN:Number(e);return Number.isFinite(t)?0===t?1/0:t:r.OD.MAX_VIEW_1000}function n(e){return!1===e.moreRows?"end":e.rowsHeld>=i(e.maxView)?e.movingView?"more":"view-full":e.emptyReply?"stalled":"more"}function o(e){const t=i(e.maxView),s=null!=(r=e.maxView)&&Number.isFinite(Number(r))?`${t}`:`${t}, the server default`;var r;const n=e.totalRows;if("stalled"===e.status)return`${e.resourceName} stopped at ${e.rowsHeld} rows: the server answered MORE_ROWS with an empty page while still reporting more rows, with room left in the view (MAX_VIEW ${s}). This is not the MAX_VIEW cap; check the data server log for "Problem building client message".`;if(!e.emptyReply&&void 0!==n&&n<=e.rowsHeld)return;const o=void 0!==n&&n>e.rowsHeld,a=o?` of ${n}`:"",c=e.emptyReply||o?" and the server holds more rows past it":", so any rows past it are not loaded";return`${e.resourceName} stopped at ${e.rowsHeld}${a} rows: the DATASERVER view is full at MAX_VIEW (${s})${c}. Raise ${e.attribute} past the row count to reach the rest.`}},6884(e,t,s){s.d(t,{aB:()=>h,OD:()=>c});var r=s(38370);function i(e,t){const s=new Date(e),r=s.getUTCFullYear(),i=String(s.getUTCMonth()+1).padStart(2,"0"),n=String(s.getUTCDate()).padStart(2,"0");if(t)return`${r}${i}${n}`;return`${r}${i}${n}-${String(s.getUTCHours()).padStart(2,"0")}:${String(s.getUTCMinutes()).padStart(2,"0")}`}const n={n:"\n",r:"\r",t:"\t",b:"\b",f:"\f"};function o(e){const t=e.trim(),s=/^(['"])([\s\S]*)\1$/.exec(t);return s?s[2].replace(/\\([\s\S])/g,(e,t)=>{var s;return null!==(s=n[t])&&void 0!==s?s:t}):t}var a=s(34193);class c{}c.MAX_ROWS_250=250,c.MAX_VIEW_1000=1e3,c.REQ_REP_POLLING_INTERVAL_MS=1e4,c.DATASERVER_ROW_ID="ROW_REF",c.REQUEST_SERVER_ROW_ID="RECORD_ID",c.DEFAULT_PAGINATION_PAGE_SIZE=25,c.DEFAULT_REQ_REP_OFFSET=0;const d={options:{criteria:"",isSnapshot:!1,maxRows:c.MAX_ROWS_250,maxView:c.MAX_VIEW_1000,pollingInterval:c.REQ_REP_POLLING_INTERVAL_MS,movingView:!1,orderBy:"",resourceName:"",reverse:!1,pollTriggerEvents:[]},criteriaToFields:function(e){if(!e)return{};const t=e.split("&&").map(e=>e.trim()),s={};return t.forEach(e=>{if(e)if(e.startsWith("Expr"))!function(e,t){const s=e.match(/Expr\.(\w+)\(/);if(s)switch(s[1]){case"dateIsToday":{const s=/Expr\.dateIsToday\((\w+)\)/,r=e.match(s);if(r){const[,e]=r,s=new Date;t[`${e}_FROM`]=`${s.toISOString().replace(/-/g,"").split("T")[0]}-00:00`,s.setDate(s.getDate()+1),t[`${e}_TO`]=`${s.toISOString().replace(/-/g,"").split("T")[0]}-00:00`}break}case"dateTimeIsGreaterEqual":{const s=/Expr\.dateTimeIsGreaterEqual\((\w+), ?(['"].+['"])\)/,r=e.match(s);if(r){const[,e,s]=r;t[`${e}_FROM`]=o(s)}break}case"dateTimeIsLessEqual":{const s=/Expr\.dateTimeIsLessEqual\((\w+), ?(['"].+['"])\)/,r=e.match(s);if(r){const[,e,s]=r;t[`${e}_TO`]=o(s)}break}case"dateIsGreaterEqual":{const s=/Expr\.dateIsGreaterEqual\((\w+), ?(['"].+['"])\)/,r=e.match(s);if(r){const[,e,s]=r;t[`${e}_FROM`]=o(s)}break}case"dateIsLessEqual":{const s=/Expr\.dateIsLessEqual\((\w+), ?(['"].+['"])\)/,r=e.match(s);if(r){const[,e,s]=r;t[`${e}_TO`]=o(s)}break}case"containsIgnoreCase":{const s=/Expr\.containsIgnoreCase\((\w+), ?(['"].+['"])\)/,r=e.match(s);if(r){const[,e,s]=r;t[e]=`*${o(s)}*`}break}}}(e,s);else if(/[A-Z_]+\s*(>=|<=)\s*\d+/.test(e)){const t=e.match(/([A-Z_]+)\s*>=\s*(\d+)/);if(t){const[,e,r]=t,n=parseInt(r,10),o=e.toUpperCase(),a=o.includes("DATE")&&!o.includes("DATETIME");s[`${e}_FROM`]=i(n,a)}const r=e.match(/([A-Z_]+)\s*<=\s*(\d+)/);if(r){const[,e,t]=r,n=parseInt(t,10),o=e.toUpperCase(),a=o.includes("DATE")&&!o.includes("DATETIME");s[`${e}_TO`]=i(n,a)}}else!function(e,t){const s=e.indexOf("=");t[e.substr(0,s).trim().replace(/["']/g,"")]=o(e.slice(s).replace(/^==?/,""))}(e,s)}),s},dataServerResultFilter:a.d},h=r.DI.createInterface(e=>e.instance(d))},49964(e,t,s){s.d(t,{oy:()=>O,yW:()=>A});var r=s(55823),i=s(33681),n=s(38370),o=s(50049),a=s(8790),c=s(1762),d=s(51046),h=s(65052),u=s(84190),l=s(66640),E=s(40113),g=s(57963),v=s(24669),S=s(48707),R=s(87917),p=s(17465),m=s(56093),T=s(6884),f=s(39087);let _=class{get initialized(){var e;return!!(null===(e=this.status)||void 0===e?void 0:e.isInitialized)}constructor(e,t,s,r,i){this.connect=e,this.auth=t,this.resources=s,this.config=r,this.connectEvents=i,this.fetchMetadataRequired=!0,this.startStreamRequired=!0,this.originalFieldDef=[],this.fieldMetadata=[],this.requestFields=[],this.customRequestFields=[],this.availableIndexes=[],this.availableSortableFields=[],this.availableCriteriaFields=[],this.criteriaOnlyRequest=!1,this.loadMoreCount=0,this.readOnly=!0,this._allParams=null,this.pollTrigger$=new o.B}triggerPoll(){this.pollTrigger$.next()}validResourceName(e){return p.v.deprecated("Datasource.validResourceName","Use `GenesisResources.isValidResource` instead."),!!e&&!!e.trim().length}init(e){return(0,r.sH)(this,arguments,void 0,function*(e,t=this.fetchMetadataRequired,s=this.startStreamRequired){this.fetchMetadataRequired=t,this.options=Object.assign(Object.assign({},this.config.options),e),this.invalidateCache();const r=this.options.resourceName;if(!(this.connect.isConnected||(yield this.connect.connect())))return p.v.error(`Unable to connect to ${this.connect.host} to get ${r} datasource`),this.reportStatus(),!1;return(yield this.resources.isValidResource(r))?(this.resourceType=yield this.resources.getResourceTypeFor(r),this.resourceType?(this.fetchMetadataRequired&&(yield this.fetchAndApplyMetadata(this.options.resourceName),this._allParams=null),p.v.debug(`Initializing ${r} datasource from ${this.connect.host}`),!this.options.isSnapshot&&s&&(this.pollTrigger$=new o.B,this.stream=yield this.createStream()),p.v.debug(`${r} datasource initialization ${this.initialized?"was successful.":"has failed."}`),this.reportStatus(),this.initialized):(p.v.error(`Unable to get the resource type for ${r} datasource from ${this.connect.host}`),this.reportStatus(),!1)):(p.v.error(`${r} datasource does not exist on ${this.connect.host}`),this.reportStatus(),!1)})}startStream(){return(0,r.sH)(this,void 0,void 0,function*(){this.options.isSnapshot||void 0!==this.stream||(this.stream=yield this.createStream())})}destroy(){var e,t;p.v.debug("Datasource.destroy",null===(e=this.options)||void 0===e?void 0:e.resourceName),this.commitResponseUnsubscribe&&(this.commitResponseUnsubscribe(),this.commitResponseUnsubscribe=void 0),null===(t=this.pollTrigger$)||void 0===t||t.complete(),this.status=void 0,this.fetchMetadataRequired=!0,this.options={},this.resourceType=void 0,this.availableIndexes=[],this.availableSortableFields=[],this.availableCriteriaFields=[],this.originalFieldDef=[],this.fieldMetadata=[],this.requestFields=[],this.criteriaOnlyRequest=!1,this.loadMoreCount=0,this.stream=void 0}get allResourceParams(){var e;if(this._allParams)return this._allParams;let t;if(this.options.orderBy)if(this.criteriaOnlyRequest||(null===(e=this.availableIndexes)||void 0===e?void 0:e.findIndex(e=>e.NAME===this.options.orderBy))>-1)t=this.options.orderBy;else{const e=this.availableIndexes.map(e=>e.NAME);p.v.warn("Specified [orderBy] index is not valid and will not be used. See https://learn.genesis.global/docs/database/data-types/index-entities/ - Available indexes:",e)}return this._allParams={CRITERIA_MATCH:this.options.criteria,MAX_ROWS:this.options.maxRows,ORDER_BY:t,VIEW_NUMBER:this.options.viewNumber,FIELDS:this.options.fields,MAX_VIEW:this.options.maxView,MOVING_VIEW:this.options.movingView,REVERSE:this.options.reverse,DISABLE_POLLING:this.options.disablePolling,OFFSET:this.options.offset,POLLING_INTERVAL:this.options.pollingInterval,REQUEST:this.options.request},p.v.debug("Getting configured params:",this._allParams),this._allParams}get dataserverOnlyParams(){return{CRITERIA_MATCH:this.allResourceParams.CRITERIA_MATCH,MAX_ROWS:this.allResourceParams.MAX_ROWS,VIEW_NUMBER:this.allResourceParams.VIEW_NUMBER,FIELDS:this.allResourceParams.FIELDS,MAX_VIEW:this.allResourceParams.MAX_VIEW,MOVING_VIEW:this.allResourceParams.MOVING_VIEW,ORDER_BY:this.allResourceParams.ORDER_BY,REVERSE:this.allResourceParams.REVERSE}}get requestOnlyParams(){const e=this.allResourceParams,{REQUEST:t}=e,s=(0,r.Tt)(e,["REQUEST"]);return{DETAILS:{CRITERIA_MATCH:this.options.requestAutoSetup?void 0:s.CRITERIA_MATCH,MAX_ROWS:s.MAX_ROWS,OFFSET:s.OFFSET,ORDER_BY:s.ORDER_BY,VIEW_NUMBER:s.VIEW_NUMBER},REQUEST:this.criteriaOnlyRequest?{}:null!=t?t:this.buildRequestFields()}}buildRequestFields(){if(!this.options.requestAutoSetup)return{};const e=Object.fromEntries(this.requestFields.map(e=>[e.NAME,"*"])),t=this.options.criteria?this.config.criteriaToFields(this.options.criteria):{};return Object.assign(Object.assign({},e),t)}updateLoadMoreCount(e){this.loadMoreCount=e}snapshot(e){return(0,r.sH)(this,void 0,void 0,function*(){switch(p.v.debug(`Requesting snapshot for ${this.options.resourceName} (${this.resourceType}).`),this.resourceType){case f.v.DATASERVER:return this.connect.snapshot(this.options.resourceName,Object.assign(Object.assign({},this.dataserverOnlyParams),e));case f.v.REQUEST_SERVER:return this.connect.request(this.options.resourceName,Object.assign(Object.assign({},this.requestOnlyParams),e));default:throw new Error(`Snapshot not supported for selected resource type: ${this.resourceType}`)}})}snapshotFiltered(){return(0,r.sH)(this,arguments,void 0,function*(e="ROW_REF"){const t=yield this.snapshot();return Array.isArray(t)?t:t.REPLY?t.REPLY:t.ROW?this.config.dataServerResultFilter(t,e).inserts:void 0})}createStream(){return(0,r.sH)(this,void 0,void 0,function*(){if(![f.v.DATASERVER,f.v.REQUEST_SERVER].includes(this.resourceType))throw new Error(`Streaming not supported for selected resource type: ${this.resourceType}`);return this.resourceType===f.v.DATASERVER?this.createDataserverStream():(p.v.debug(`Creating fake stream by polling ${this.options.resourceName} REQUEST_SERVER`),this.createReqRepStream())})}createDataserverStream(){return(0,r.sH)(this,void 0,void 0,function*(){return this.connect.stream(this.options.resourceName,e=>{},e=>p.v.error((0,m.O)(`${this.options.resourceName} stream failed`,e),e),this.dataserverOnlyParams)})}createReqRepStream(){this.commitResponseUnsubscribe=this.connectEvents.addCommitResponseListener(e=>{var t;const{eventName:s,response:r}=e.detail;this.options.pollTriggerEvents&&this.options.pollTriggerEvents.includes(s)&&(null===(t=r.MESSAGE_TYPE)||void 0===t?void 0:t.endsWith("_ACK"))&&(p.v.debug(`Received commit response for ${s}, triggering poll.`),this.triggerPoll())});const e=this.allResourceParams.DISABLE_POLLING?void 0:this.allResourceParams.POLLING_INTERVAL,t=()=>{const e=this.requestOnlyParams;if(this.resourceType===f.v.REQUEST_SERVER&&this.loadMoreCount>0){const t=25,s=(this.options.maxRows||t)*(this.loadMoreCount+1);e.DETAILS.MAX_ROWS=s}return(0,a.z)([this.connect.isConnected$,this.auth.isLoggedIn$]).pipe((0,l.v)(()=>this.connect.isConnected&&this.auth.isLoggedIn),(0,u.n)(()=>(0,c.H)(this.snapshot(e))))};return e?this.pollTrigger$.pipe((0,h.Z)(0),(0,u.n)(()=>(0,d.O)(0,e).pipe((0,u.n)(t)))):this.pollTrigger$.pipe((0,h.Z)(0),(0,u.n)(t))}fetchAndApplyMetadata(e){return(0,r.sH)(this,void 0,void 0,function*(){var t,s,r,i;try{p.v.debug(`Requesting metadata for ${this.options.resourceName} Datasource`);const e=yield this.connect.getMetadata(this.options.resourceName);e&&(this.availableIndexes=null!==(t=e.INDEXES)&&void 0!==t?t:[],this.availableSortableFields=null!==(s=e.SORTABLE_FIELDS)&&void 0!==s?s:[],this.availableCriteriaFields=null!==(r=e.CRITERIA_FIELDS)&&void 0!==r?r:[],this.originalFieldDef=(0,S.a)(e),this.fieldMetadata=(0,S.X)(this.originalFieldDef),this.requestFields=e.REQUEST_FIELD||[],this.customRequestFields=e.FIELD||[],this.criteriaOnlyRequest=e.CRITERIA_ONLY_REQUEST||!1,this.fetchMetadataRequired=!1),this.status=this.normaliseStatus({isInitialized:!0,metadataRequired:!0,hasMetadata:(null===(i=this.fieldMetadata)||void 0===i?void 0:i.length)>0})}catch(t){p.v.error((0,m.O)(`Metadata Fetch failed for ${e}:`,t),t),this.status=this.normaliseStatus({isInitialized:!1,metadataRequired:!0,hasMetadata:!1})}})}reportStatus(e={}){var t;const s=null!==(t=this.config.eventEmitter)&&void 0!==t?t:document;this.status=this.normaliseStatus(e),p.v.debug(`Dispatching '${f.w}'`,this.status),null==s||s.dispatchEvent(new CustomEvent(f.w,{detail:this.status,bubbles:s!==document,composed:!0}))}normaliseStatus(e){var t,s,r,i,n;const o=null!==(t=e.isInitialized)&&void 0!==t?t:this.initialized,a=null!==(s=e.metadataRequired)&&void 0!==s?s:this.fetchMetadataRequired,c=null!==(r=e.hasMetadata)&&void 0!==r?r:(null===(i=this.fieldMetadata)||void 0===i?void 0:i.length)>0;return{name:null===(n=this.options)||void 0===n?void 0:n.resourceName,type:this.resourceType,isInitialized:o,metadataRequired:a,hasMetadata:c}}invalidateCache(){this._allParams=null}};(0,r.Cg)([i.observable],_.prototype,"status",void 0),(0,r.Cg)([i.observable],_.prototype,"fetchMetadataRequired",void 0),(0,r.Cg)([i.observable],_.prototype,"startStreamRequired",void 0),(0,r.Cg)([i.observable],_.prototype,"originalFieldDef",void 0),(0,r.Cg)([i.observable],_.prototype,"fieldMetadata",void 0),(0,r.Cg)([i.observable],_.prototype,"requestFields",void 0),(0,r.Cg)([i.observable],_.prototype,"customRequestFields",void 0),(0,r.Cg)([i.observable],_.prototype,"availableIndexes",void 0),(0,r.Cg)([i.observable],_.prototype,"availableSortableFields",void 0),(0,r.Cg)([i.observable],_.prototype,"availableCriteriaFields",void 0),(0,r.Cg)([i.observable],_.prototype,"criteriaOnlyRequest",void 0),(0,r.Cg)([i.observable],_.prototype,"loadMoreCount",void 0),(0,r.Cg)([i.observable],_.prototype,"readOnly",void 0),(0,r.Cg)([i.observable],_.prototype,"stream",void 0),_=(0,r.Cg)([(0,r.Qj)(0,g.dm),(0,r.Qj)(1,E.N),(0,r.Qj)(2,R.ME),(0,r.Qj)(3,T.aB),(0,r.Qj)(4,v.a4)],_);const A=n.DI.createInterface(e=>e.transient(_));function O(){return n.DI.getOrCreateDOMContainer().get(A)}},40370(e,t,s){s.d(t,{C:()=>a});var r=s(55823),i=s(33681),n=s(17465),o=s(39087);const a=e=>{class t extends e{constructor(){super(),this.hasOwnProperty("onDatasourceStatusChanged")||(this.onDatasourceStatusChanged=e=>{var t;const s=void 0!==this.data;this.resourceName||s||n.v.warn("Target classes must have a resourceName or data property to use the DatasourceEventHandler mixin.");const r=e.detail;if(r.name===this.resourceName){const e=null!==(t=this.datasourceStatus)&&void 0!==t?t:{isInitialized:!1,hasMetadata:!1};(e.isInitialized!==r.isInitialized||r.metadataRequired&&e.hasMetadata!==r.hasMetadata)&&(this.datasourceStatus=r)}})}datasourceStatusChanged(e,t){n.v.debug("Target classes should override the datasourceStatusChanged method of the DatasourceEventHandler mixin to respond to changes in the target datasource.")}connectedCallback(){super.connectedCallback(),document.addEventListener(o.w,this.onDatasourceStatusChanged,{passive:!0,capture:!0})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(o.w,this.onDatasourceStatusChanged,{capture:!0})}}return(0,r.Cg)([i.observable],t.prototype,"datasourceStatus",void 0),t}},39087(e,t,s){var r;s.d(t,{v:()=>r,w:()=>i}),function(e){e.DATASERVER="DATASERVER",e.EVENT_HANDLER="EVENT_HANDLER",e.REQUEST_SERVER="REQUEST_SERVER"}(r||(r={}));const i="datasource-status-changed"},96730(e,t,s){function r(e,t=";"){return e?e.split(t).map(e=>e.trim()).sort((e,t)=>e.localeCompare(t)).join(t):e}s.d(t,{Q:()=>r})},41119(e,t,s){var r;s.d(t,{v:()=>i,w:()=>r}),function(e){e.STRING="STRING",e.NUMBER="NUMBER",e.BOOLEAN="BOOLEAN",e.ENUM="ENUM",e.DATE="DATE",e.DATETIME="DATETIME",e.CUSTOM="CUSTOM",e.NANO_TIMESTAMP="NANO_TIMESTAMP"}(r||(r={}));const i={STRING:r.STRING,ENUM:r.ENUM,BOOLEAN:r.BOOLEAN,INT:r.NUMBER,LONG:r.NUMBER,DOUBLE:r.NUMBER,BIGDECIMAL:r.NUMBER,DATE:r.DATE,DATETIME:r.DATETIME,NANO_TIMESTAMP:r.NANO_TIMESTAMP}},48707(e,t,s){s.d(t,{X:()=>o,a:()=>a});var r=s(39087),i=s(17465),n=s(41119);const o=e=>e?e.map(e=>{const t={name:e.NAME,type:n.v[e.TYPE]||n.w.STRING};if(e.TYPE===n.w.ENUM&&e.VALID_VALUES)try{t.enumOptions=Array.isArray(e.VALID_VALUES)?e.VALID_VALUES:e.VALID_VALUES.split("|")}catch(e){i.v.error(e),t.enumOptions=[]}return t}):null,a=e=>{var t;const s=null==e?void 0:e.TYPE;if(s===r.v.DATASERVER)return e.FIELD||[];if(s===r.v.REQUEST_SERVER)return e.REPLY_FIELD||(null===(t=e.REPLY)||void 0===t?void 0:t.FIELD)||[];throw new Error(`Unsupported resource type: ${s}`)}},87917(e,t,s){s.d(t,{ME:()=>l});var r=s(55823),i=s(38370),n=s(57963),o=s(17465),a=s(79780);const c={throwWhenUnavailable:!0,throwWhenUnknown:!1},d=i.DI.createInterface(e=>e.instance(c)),h=(0,a.Es)("genesis-resources");let u=class{constructor(e,t){this.connect=e,this.config=t}isValidResource(e){return(0,r.sH)(this,void 0,void 0,function*(){if(!(e=null==e?void 0:e.trim()))return!1;yield this.fetchResources();return!!this.resources.find(t=>t.RESOURCE_NAME===e)})}getResourceTypeFor(e){return(0,r.sH)(this,void 0,void 0,function*(){yield this.fetchResources();const t=this.resources.find(t=>t.RESOURCE_NAME===e);if(t)return t.RESOURCE_TYPE;const s=`${e} resource does not exist.`;if(o.v.error(s),this.config.throwWhenUnknown)throw new Error(s)})}getAllResources(){return(0,r.sH)(this,void 0,void 0,function*(){return this.resources||(yield this.fetchResources()),this.resources})}destroy(){this.resources=void 0,this.resourcesPromise=void 0}fetchResources(){return(0,r.sH)(this,void 0,void 0,function*(){var e;if(this.resources)return Promise.resolve();if(this.resourcesPromise)yield this.resourcesPromise;else{this.resourcesPromise=this.connect.getAvailableResources();const t=yield this.resourcesPromise;if(this.resources=null==t?void 0:t.RESOURCES,!(null===(e=this.resources)||void 0===e?void 0:e.length)){const e="Genesis resources unavailable.";if(o.v.error(e),this.config.throwWhenUnavailable)throw new Error(e)}this.postLoadedMessage(),this.resourcesPromise=void 0}})}postLoadedMessage(){const e=i.DI.getOrCreateDOMContainer().get(h);e.postMessage("resources-loaded",this.resources),e.close()}};u=(0,r.Cg)([(0,r.Qj)(0,n.dm),(0,r.Qj)(1,d)],u);const l=i.DI.createInterface(e=>e.singleton(u))},98316(e,t,s){s.d(t,{N:()=>n});var r=s(38370);class i{constructor(){this.storageKeyPrefix="",this.returnUrl=this.getSessionStorageItem("returnUrl")||""}deleteUserFromSessionStorage(){["authToken","refreshToken","sessionId","ssoToken"].forEach(e=>this.removeSessionStorageItem(e)),this.removeLocalStorageItem("refreshToken")}setStorageKeyPrefix(e){this.storageKeyPrefix=`${e.replace(/\s/g,"")}/`}setAuthResult(e){var t;this.setSessionStorageItem("authToken",e.SESSION_AUTH_TOKEN),this.setSessionStorageItem("refreshToken",e.REFRESH_AUTH_TOKEN),this.setSessionStorageItem("username",e.USER_NAME),this.setSessionStorageItem("sessionId",e.SESSION_ID),(null===(t=e.DETAILS)||void 0===t?void 0:t.MFA_CODE)&&this.setSessionStorageItem("mfaToken",e.DETAILS.MFA_CODE)}captureReturnUrl(){const{pathname:e,search:t,hash:s}=location;if(e&&(e.includes("/login")||e.includes("/auth")))return;const r=`${"/"!==e?e:""}`;this.returnUrl=`${r}${t}${s}`,this.setSessionStorageItem("returnUrl",this.returnUrl)}setItem(e,t,s){"local"===s?localStorage.setItem(this.storageKeyPrefix+e,t):sessionStorage.setItem(this.storageKeyPrefix+e,t)}getItem(e,t){return"local"===t?localStorage.getItem(this.storageKeyPrefix+e):sessionStorage.getItem(this.storageKeyPrefix+e)}removeItem(e,t){"local"===t?localStorage.removeItem(this.storageKeyPrefix+e):sessionStorage.removeItem(this.storageKeyPrefix+e)}setLocalStorageItem(e,t){this.setItem(e,t,"local")}setSessionStorageItem(e,t){this.setItem(e,t,"session")}getLocalStorageItem(e){return this.getItem(e,"local")}getSessionStorageItem(e){return this.getItem(e,"session")}removeLocalStorageItem(e){this.removeItem(e,"local")}removeSessionStorageItem(e){this.removeItem(e,"session")}}const n=r.DI.createInterface(e=>e.singleton(i))},56093(e,t,s){s.d(t,{O:()=>r});const r=(e,t)=>{const s=(e=>{const t=null==e?void 0:e.ERROR,s=Array.isArray(t)?t[0]:e,r=null==s?void 0:s.CODE;return"string"==typeof r||"number"==typeof r?String(r):void 0})(t);return void 0===s?e:`${e} [${s}]`}},17465(e,t,s){s.d(t,{v:()=>r});const r=(0,s(66506).createLogger)("foundation-comms")},14609(e,t,s){s.d(t,{b:()=>o});const r=(0,s(66506).createLogger)("foundation-criteria");var i=s(86636);const n="default";class o{constructor(){this.expressions={},this.And=(e,t={})=>this.withExpression(e,t,i.r.And()),this.Or=(e,t={})=>this.withExpression(e,t,i.r.Or()),this.Not=(e,t={})=>this.withExpression(e,t,i.r.Not())}withExpression(e,t={},s=i.r.And()){const{condition:o,join:a,groupName:c}=t,d=(e,t=n)=>{var r;const i=null!==(r=this.expressions[t])&&void 0!==r?r:[];this.expressions[t]=[...i,{join:s||a,condition:o,expression:e}]};if(Array.isArray(e))if(a){const t=e.filter(e=>{const t=e instanceof i.r;return t&&r.warn("Inline joins will be discarded when join is defined in ExpressionOptions"),!t});if(c)t.forEach(e=>{d(e,c)});else{const e=(h=a,t.flat().flatMap((e,t,s)=>s.length-1!==t?[e,h]:e));d(e,n)}}else d(e,n);else d(e,"string"==typeof e?n:e.group);var h;return this}build(e){const t=Object.entries(this.expressions).reduce((e,[t,s])=>Object.assign(Object.assign({},e),{[t]:`(${s.filter(({condition:e})=>!e||e()).map(({expression:e,join:t},s,r)=>this.parseExpression(e,r[s-1],t)).join("")})`}),{});return e?e(t):`(${Object.values(t).join(" && ")})`}reset(){this.expressions={}}parseExpression(e,t,s){const r=[];return s&&t&&r.push(` ${s.operator} `),"string"==typeof e?r.push(e):Array.isArray(e)?(e.forEach((e,t,s)=>{if(e instanceof i.r){if(s[t-1]instanceof i.r)throw new Error("Adjacent Join operations detected")}}),r.push(`(${e.map(e=>this.parseExpression(e,void 0)).join("")})`)):e instanceof i.r?r.push(` ${e.operator} `):e&&r.push(e.serialiser(e)),r.join("")}}},58749(e,t,s){s.d(t,{K:()=>i});var r=s(95553);class i{constructor(e){this.serialiser=r.n.EQ,this.build=()=>{if(!this.field)throw new Error("Missing required param 'field'");if(void 0===this.value)throw new Error("Missing required param 'value'");if(!this.serialiser)throw new Error("Missing required param 'serialise'");return{field:this.field,value:this.value,serialiser:this.serialiser,params:this.params,valueGetter:this.valueGetter,group:this.group}},e&&(this.field=e.field,this.value=e.value,this.serialiser=e.serialiser,this.params=e.params,this.valueGetter=e.valueGetter,this.group=e.group)}withField(e){return this.field=e,this}withValue(e){return this.value=e,this}withSerialiser(e){return this.serialiser=e,this}withParams(e){return this.params=e,this}withValueGetter(e){return this.valueGetter=e,this}withGroup(e){return this.group=e,this}}},95553(e,t,s){s.d(t,{E:()=>i,n:()=>d});var r=s(86636);const i=e=>e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r"),n=e=>{const{value:t}=e;return e.valueGetter?e.valueGetter(t):"function"==typeof t?t(e):Array.isArray(t)?t.join(","):"string"==typeof t?(e=>`'${i(e)}'`)(t):t},o=e=>t=>`${t.field} ${e} ${n(t)}`,a=e=>o(r.X.NE)(e),c=e=>`${e.field}.contains(${n(e)})`,d={AND:e=>o(r.X.AND)(e),OR:e=>o(r.X.OR)(e),NOT:a,GT:e=>o(r.X.GT)(e),GE:e=>o(r.X.GE)(e),LT:e=>o(r.X.LT)(e),LE:e=>o(r.X.LE)(e),NE:a,EQ:e=>o(r.X.EQ)(e),equals:e=>`${e.field}.equals(${n(e)})`,equalsIgnoreCase:e=>`${e.field}.equalsIgnoreCase(${n(e)})`,contains:c,fieldContains:c,containsIgnoreCase:e=>`Expr.containsIgnoreCase(${e.field}, ${n(e)})`,startsWith:e=>`${e.field}.startsWith(${n(e)})`,endsWith:e=>`${e.field}.endsWith(${n(e)})`,dateIsToday:e=>`Expr.dateIsToday(${e.field})`,dateIsEqual:e=>`Expr.dateIsEqual(${e.field}, ${n(e)})`,dateIsGreaterEqual:e=>`Expr.dateIsGreaterEqual(${e.field}, ${n(e)})`,dateIsLessEqual:e=>`Expr.dateIsLessEqual(${e.field}, ${n(e)})`,dateTimeIsGreaterEqual:e=>`Expr.dateTimeIsGreaterEqual(${e.field}, ${n(e)})`,dateTimeIsLessEqual:e=>`Expr.dateTimeIsLessEqual(${e.field}, ${n(e)})`}},86636(e,t,s){var r;s.d(t,{X:()=>r,r:()=>i}),function(e){e.AND="&&",e.OR="||",e.NOT="!",e.GT=">",e.GE=">=",e.LT="<",e.LE="<=",e.NE="!=",e.EQ="=="}(r||(r={}));class i{constructor(e){this.$$operator=e}static And(){return new i(r.AND)}static Or(){return new i(r.OR)}static Not(){return new i(r.NOT)}static GreaterThan(){return new i(r.GT)}static GreaterThanOrEqual(){return new i(r.GE)}static LessThan(){return new i(r.LT)}static LessThanOrEqual(){return new i(r.LE)}static NotEqual(){return new i(r.NE)}static Equal(){return new i(r.EQ)}get operator(){return this.$$operator}}},92277(e,t,s){s.d(t,{KJ:()=>E});var r=s(55823),i=s(17190),n=s(33681),o=s(38370),a=s(79780);const c=(0,s(66506).createLogger)("foundation-user"),d={trackActionExclusions:[],trackPathExclusions:[""],setUser(e,t){if(e.isAuthenticated)throw new Error("User already set. If this is intentional, please call User.unset first.");return c.debug("setUser",t),e.rawProperties=structuredClone(t),e.userKVs=t.userKVs,e.details=t.details,e.permission=t.permission,e.profile=t.profile,e.sourceRef=t.sourceRef,e.userName=t.userName,e.isAuthenticated=!0,e},unsetUser:e=>(c.debug("unsetUser"),e.rawProperties=void 0,e.userKVs=void 0,e.details=void 0,e.permission=void 0,e.profile=void 0,e.sourceRef=void 0,e.userName=void 0,e.isAuthenticated=!1,e)},h=o.DI.createInterface(e=>e.instance(d)),u=(0,a.Es)("genesis-user");class l{constructor(){this.pathHistory=[],this.actionHistory=[],this.isAuthenticated=!1,this.authenticationChangeListeners=(0,i.r)()}set(e){return this.config.setUser(this,e)}unset(){return this.config.unsetUser(this)}get isAnonymous(){return!this.isAuthenticated}isAdmin(){return this.hasProfile("ADMIN")}isBanned(){return this.hasProfile("BANNED")}hasPermission(e){return this.hasKey(this.permission,e)}hasProfile(e){return this.hasKey(this.profile,e)}trackPath(){const{pathname:e,search:t,hash:s}=location,r=`${`${"/"!==e?e:""}`}${t}${s}`;if(!this.config.trackPathExclusions.includes(r))return this.pathHistory.push(r),r}clearPaths(){this.pathHistory=[]}lastPath(){const e=this.pathHistory.length;return e>0?this.pathHistory[e-1]:void 0}trackAction(e){this.config.trackActionExclusions.includes(e)||this.actionHistory.push(e)}clearActions(){this.actionHistory=[]}lastAction(){const e=this.actionHistory.length;return e>0?this.actionHistory[e-1]:void 0}clearTrackingHistory(){this.clearPaths(),this.clearActions()}hasKey(e,t){return!!(e&&e.length&&t)&&(Array.isArray(t)||(t=[t]),t.some(t=>e.includes(t)))}addAuthenticationChangeListener(e){var t;return null===(t=this.authenticationChangeListeners)||void 0===t?void 0:t.subscribe(e)}isAuthenticatedChanged(){var e;null===(e=this.authenticationChangeListeners)||void 0===e||e.publish(new CustomEvent("user-authentication-change",{detail:this.isAuthenticated}));const t=o.DI.getOrCreateDOMContainer().get(u);t.postMessage("user-authentication-change",this.isAuthenticated),t.close()}userNameChanged(){n.Observable.notify(this,"username")}get username(){return n.Observable.track(this,"username"),this.userName}permissionChanged(){n.Observable.notify(this,"permissions")}get permissions(){return n.Observable.track(this,"permissions"),this.permission}profileChanged(){n.Observable.notify(this,"profiles")}get profiles(){return n.Observable.track(this,"profiles"),this.profile}hasAdminProfile(){return this.isAdmin()}}(0,r.Cg)([h],l.prototype,"config",void 0),(0,r.Cg)([n.observable],l.prototype,"pathHistory",void 0),(0,r.Cg)([n.observable],l.prototype,"actionHistory",void 0),(0,r.Cg)([n.observable],l.prototype,"isAuthenticated",void 0),(0,r.Cg)([n.observable],l.prototype,"userKVs",void 0),(0,r.Cg)([n.observable],l.prototype,"details",void 0),(0,r.Cg)([n.observable],l.prototype,"permission",void 0),(0,r.Cg)([n.observable],l.prototype,"profile",void 0),(0,r.Cg)([n.observable],l.prototype,"sourceRef",void 0),(0,r.Cg)([n.observable],l.prototype,"userName",void 0),(0,r.Cg)([n.observable],l.prototype,"rawProperties",void 0);const E=o.DI.createInterface(e=>e.singleton(l))},68424(e,t,s){s.d(t,{DW:()=>n,JH:()=>o});var r=s(52945),i=s(28745);function n(e,t){let s=e;for(;s;){const e=s.tagName.toLowerCase();if(e.endsWith("-design-system-provider")){const t=e.split("-design-system-provider")[0];if(t)return i.v.debug(`Found provider by ancestor search: ${e}, prefix: ${t}`),{element:s,prefix:t}}s=s.parentElement?s.parentElement:s.getRootNode&&s.getRootNode()instanceof ShadowRoot?s.getRootNode().host:null}const n=document.querySelectorAll('[class*="-design-system-provider"],[id*="-design-system-provider"]'),o=Array.from(n),a=(0,r.fI)(document).filter(e=>{var t;const s=null===(t=e.tagName)||void 0===t?void 0:t.toLowerCase();return(null==s?void 0:s.endsWith("-design-system-provider"))||!1});if(o.push(...a),o.length>0){const e=o[0],t=e.tagName.toLowerCase(),s=t.split("-design-system-provider")[0];if(s)return i.v.debug(`Found provider by document search: ${t}, prefix: ${s}`),{element:e,prefix:s}}return i.v.debug(`No provider found. Falling back to ${t}.`),{element:null,prefix:t}}function o(e,t){return n(e,t).prefix}},40729(e,t,s){s.d(t,{O:()=>d});var r=s(33681);const i=new Map([["FAST-TEXT-AREA","input"],["FAST-TEXT-FIELD","input"],["FOUNDATION-TEXT-AREA","input"],["FOUNDATION-TEXT-FIELD","input"],["INPUT","input"],["ZERO-TEXT-FIELD","input"]]);function n(e){this.keyAttr||(this.target[this.targetName]=e)}function o(e,t){this.keyAttr&&(this.updateTarget=n),this.originalBind.call(this,e,t),this.target.addEventListener(this.changeEvent,this.changeHandler)}function a(){this.originalUnbind.call(this),this.target.removeEventListener(this.changeEvent,this.changeHandler)}class c extends r.HTMLBindingDirective{constructor(e,t,s,r){super(e),this.keyAttr=r,this.conversionType=t,this.eventName=s}createBehavior(e){const t=super.createBehavior(e);return t.originalBind=t.bind,t.originalUnbind=t.unbind,t.keyAttr=this.keyAttr,t.bind=o,t.unbind=a,t.changeEvent=function(e,t){var s;const r=e.tagName;return"default"===t?null!==(s=i.get(r))&&void 0!==s?s:"change":t}(e,this.eventName),t.changeHandler=()=>{const e="boolean"===this.conversionType?t.target.checked:t.target.value;if(this.keyAttr){const s=t.bindingObserver.last,r=t.target[this.keyAttr];s.propertySource[s.propertyName][r]=this.convert(e)}else{const s=t.bindingObserver.last;s.propertySource[s.propertyName]=this.convert(e)}},t}convert(e){if(null==e)return e;switch(this.conversionType){case"time":const t=new Date(e).getTime();return isNaN(t)?void 0:t;case"number":return e.length?Number(e):void 0;case"string":return String(e);case"boolean":return Boolean(e);default:return e}}}function d(e,t="string",s="default",r){return new c(e,t,s,r)}},84686(e,t,s){s.d(t,{Be:()=>R,H6:()=>O,OB:()=>n,PF:()=>o,Tp:()=>a,aW:()=>v,vN:()=>d});var r=s(77679);let i="webpack";try{i="webpack"}catch(e){}let n="/";try{n="auto".replace(/\/$/,"")}catch(e){}let o,a,c="gwf";try{"undefined"!=typeof SOCKET_EXT&&(c=SOCKET_EXT)}catch(e){}try{o=FORCE_HTTP}catch(e){}try{a=FORCE_HTTP_REQREP}catch(e){}const d=`${location.protocol.replace("http","ws")}//${location.host}${n}/${c}/`;let h,u,l,E,g=`${"true"===o||(0,r.m4)("forceHttp")?location.protocol:location.protocol.replace("http","ws")}//${location.host}/${c}/`;try{"undefined"!=typeof API_HOST&&(g=API_HOST)}catch(e){}try{h=""}catch(e){}try{u=DEFAULT_ORGANISATION}catch(e){}try{l=DEFAULT_PASSWORD}catch(e){}try{E=DEFAULT_USER}catch(e){}let v="gwf/event-login-auth";"undefined"!=typeof GENX_LOGIN_URL&&(v=GENX_LOGIN_URL);let S="gwf/event-login-auth";"undefined"!=typeof GENX_LOGIN_REFRESH_URL&&(S=GENX_LOGIN_REFRESH_URL);let R="gwf/event-login-details";"undefined"!=typeof GENX_LOGIN_DETAILS_URL&&(R=GENX_LOGIN_DETAILS_URL);let p="gwf/event-logout";"undefined"!=typeof GENX_LOGOUT_URL&&(p=GENX_LOGOUT_URL);let m="gwf/event-change-user-password";"undefined"!=typeof GENX_CHANGE_PASSWORD_URL&&(m=GENX_CHANGE_PASSWORD_URL);let T="gwf/event-self-service-password-reset";"undefined"!=typeof GENX_FORGOT_PASSWORD_URL&&(T=GENX_FORGOT_PASSWORD_URL);let f="gwf/event-password-reset-action";"undefined"!=typeof GENX_RESET_PASSWORD_URL&&(f=GENX_RESET_PASSWORD_URL);let _="gwf/sso/list";"undefined"!=typeof GENX_SSO_LIST_URL&&(_=GENX_SSO_LIST_URL);let A="gwf/{type}/login?idp={id}";"undefined"!=typeof GENX_SSO_LOGIN_URL&&(A=GENX_SSO_LOGIN_URL);let O="default";"undefined"!=typeof GENX_ENVIRONMENT_LEVEL&&(O=GENX_ENVIRONMENT_LEVEL);let I="gwf/auth/accept-terms";"undefined"!=typeof GENX_ACCEPT_TERMS_URL&&(I=GENX_ACCEPT_TERMS_URL)},77679(e,t,s){s.d(t,{m4:()=>i});const r="feature.",i=e=>((e,t)=>{if(!t)return!1;const s=`${r}${t}`.toLowerCase(),i=new URLSearchParams(e);for(const[e]of i.entries())if(e.toLowerCase()===s)return!0;return!1})(window.location.search,e)},12066(e,t,s){s.d(t,{CL:()=>r,Ey:()=>n,h5:()=>a,zT:()=>i});function r(e){return!e||isNaN(e)?null:new Date(e).toISOString().slice(0,10)}function i(e){return!e||isNaN(e)?null:new Date(e).toISOString().slice(0,19).replace("T"," ")}function n(e,t){return t?i(e):r(e)}const o={year:"numeric",month:"2-digit",day:"2-digit",timeZone:"UTC"};function a(e="en-GB",t=o){return s=>s&&"number"==typeof s.value?new Intl.DateTimeFormat(e,t).format(s.value):""}},17190(e,t,s){s.d(t,{j:()=>i,r:()=>r});const r=()=>{let e=[];return{subscribe:t=>(e.push(t),()=>e=e.filter(e=>e!==t)),publish(t){e.forEach(e=>e(t))}}},i=(e,t)=>{const s={root:document.documentElement},r=new IntersectionObserver(e=>{e.forEach(e=>{t(e.intersectionRatio>0)})},s);return r.observe(e),()=>{r.disconnect()}}},49229(e,t,s){s.d(t,{b_:()=>l});var r=s(55823),i=s(38370),n=s(88474),o=s(52776),a=s(30630);const c=i.DI.createInterface();function d(e){return Number.isSafeInteger(+e)?Number(e):(0,n.Fq)(e)?BigInt.asIntN(64,e):parseFloat(e)}const h={parse:e=>(0,o.qg)(e,null,d),stringify:e=>(0,a.A)(e)};let u=class{constructor(e=h){this.config=e,this.serialize=e=>this.config.stringify(e)}deserialize(e){return e?"string"==typeof e?this.config.parse(e):e&&e.ok?e.text().then(e=>this.config.parse(e)):(e&&e.data&&(e=e.data),this.config.parse(e)):Promise.resolve({})}};u=(0,r.Cg)([(0,r.Qj)(0,(0,i.optional)(c))],u);const l=i.DI.createInterface(e=>e.singleton(u))},20633(e,t,s){s.d(t,{N:()=>r});const r=(...e)=>{var t;null==(t=()=>{e.forEach(e=>{})})||t()}},32808(e,t,s){s.d(t,{k:()=>c});var r=s(55823),i=s(38370),n=s(31261),o=s(28745);class a{constructor(){}createId(e=!1){const t=(0,n.A)();return e&&o.v.debug(`UUID.createID ${t}`),t}createRemoteId(){return(0,r.sH)(this,arguments,void 0,function*(e=!1){const t=(0,n.A)();return e&&o.v.debug(`UUID.createRemoteID ${t}`),t})}}const c=i.DI.createInterface(e=>e.singleton(a))}}]);
2
+ //# sourceMappingURL=277.78fab82e461bc0b972645dcf39de59e8.js.map