@luigi-project/core
Version:
Javascript library supporting consumers of the Luigi framework
26 lines • 546 kB
JavaScript
var nk=Object.defineProperty;var ik=(i,e,t)=>e in i?nk(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var Un=(i,e,t)=>ik(i,typeof e!="symbol"?e+"":e,t);function Ue(){}function lk(i,e){for(const t in e)i[t]=e[t];return i}function rk(i){return!!i&&(typeof i=="object"||typeof i=="function")&&typeof i.then=="function"}function Y_(i){return i()}function jf(){return Object.create(null)}function Ze(i){i.forEach(Y_)}function ki(i){return typeof i=="function"}function Rt(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}let ts;function nt(i,e){return i===e?!0:(ts||(ts=document.createElement("a")),ts.href=e,i===ts.href)}function ak(i){return Object.keys(i).length===0}function zo(i,...e){if(i==null){for(const n of e)n(void 0);return Ue}const t=i.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function hl(i){let e;return zo(i,t=>e=t)(),e}function Si(i,e,t){i.$$.on_destroy.push(zo(e,t))}function hs(i,e,t,n){if(i){const l=Q_(i,e,t,n);return i[0](l)}}function Q_(i,e,t,n){return i[1]&&n?lk(t.ctx.slice(),i[1](n(e))):t.ctx}function gs(i,e,t,n){return i[2],e.dirty}function _s(i,e,t,n,l,r){if(l){const a=Q_(e,t,n,r);i.p(a,l)}}function ps(i){if(i.ctx.length>32){const e=[],t=i.ctx.length/32;for(let n=0;n<t;n++)e[n]=-1;return e}return-1}function Bn(i){return i??""}function Z_(i){return i&&ki(i.destroy)?i.destroy:Ue}const wl=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function w(i,e){i.appendChild(e)}function L(i,e,t){i.insertBefore(e,t||null)}function T(i){i.parentNode&&i.parentNode.removeChild(i)}function dt(i,e){for(let t=0;t<i.length;t+=1)i[t]&&i[t].d(e)}function k(i){return document.createElement(i)}function sk(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function Te(i){return document.createTextNode(i)}function W(){return Te(" ")}function we(){return Te("")}function x(i,e,t,n){return i.addEventListener(e,t,n),()=>i.removeEventListener(e,t,n)}function kt(i){return function(e){return e.preventDefault(),i.call(this,e)}}function Dt(i){return function(e){return e.stopPropagation(),i.call(this,e)}}function f(i,e,t){t==null?i.removeAttribute(e):i.getAttribute(e)!==t&&i.setAttribute(e,t)}function ok(i){return Array.from(i.childNodes)}function Ae(i,e){e=""+e,i.data!==e&&(i.data=e)}function Jf(i,e){i.value=e??""}function ii(i,e,t,n){t==null?i.style.removeProperty(e):i.style.setProperty(e,t,"")}function Qt(i,e,t){i.classList.toggle(e,!!t)}function uk(i,e,{bubbles:t=!1,cancelable:n=!1}={}){return new CustomEvent(i,{detail:e,bubbles:t,cancelable:n})}class Cr{constructor(e=!1){Un(this,"is_svg",!1);Un(this,"e");Un(this,"n");Un(this,"t");Un(this,"a");this.is_svg=e,this.e=this.n=null}c(e){this.h(e)}m(e,t,n=null){this.e||(this.is_svg?this.e=sk(t.nodeName):this.e=k(t.nodeType===11?"TEMPLATE":t.nodeName),this.t=t.tagName!=="TEMPLATE"?t:t.content,this.c(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.nodeName==="TEMPLATE"?this.e.content.childNodes:this.e.childNodes)}i(e){for(let t=0;t<this.n.length;t+=1)L(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(T)}}let Xr;function Ki(i){Xr=i}function kl(){if(!Xr)throw new Error("Function called outside component initialization");return Xr}function Qn(i){kl().$$.before_update.push(i)}function ln(i){kl().$$.on_mount.push(i)}function ea(i){kl().$$.after_update.push(i)}function ta(i){kl().$$.on_destroy.push(i)}function Zt(){const i=kl();return(e,t,{cancelable:n=!1}={})=>{const l=i.$$.callbacks[e];if(l){const r=uk(e,t,{cancelable:n});return l.slice().forEach(a=>{a.call(i,r)}),!r.defaultPrevented}return!0}}function Yr(i,e){return kl().$$.context.set(i,e),e}function yt(i){return kl().$$.context.get(i)}function Gi(i,e){const t=i.$$.callbacks[e.type];t&&t.slice().forEach(n=>n.call(this,e))}const _r=[],Qe=[];let mr=[];const Fo=[],fk=Promise.resolve();let Uo=!1;function ck(){Uo||(Uo=!0,fk.then(Go))}function Bo(i){mr.push(i)}function St(i){Fo.push(i)}const Vo=new Set;let dr=0;function Go(){if(dr!==0)return;const i=Xr;do{try{for(;dr<_r.length;){const e=_r[dr];dr++,Ki(e),dk(e.$$)}}catch(e){throw _r.length=0,dr=0,e}for(Ki(null),_r.length=0,dr=0;Qe.length;)Qe.pop()();for(let e=0;e<mr.length;e+=1){const t=mr[e];Vo.has(t)||(Vo.add(t),t())}mr.length=0}while(_r.length);for(;Fo.length;)Fo.pop()();Uo=!1,Vo.clear(),Ki(i)}function dk(i){if(i.fragment!==null){i.update(),Ze(i.before_update);const e=i.dirty;i.dirty=[-1],i.fragment&&i.fragment.p(i.ctx,e),i.after_update.forEach(Bo)}}function hk(i){const e=[],t=[];mr.forEach(n=>i.indexOf(n)===-1?e.push(n):t.push(n)),t.forEach(n=>n()),mr=e}const is=new Set;let ql;function be(){ql={r:0,c:[],p:ql}}function ve(){ql.r||Ze(ql.c),ql=ql.p}function R(i,e){i&&i.i&&(is.delete(i),i.i(e))}function U(i,e,t,n){if(i&&i.o){if(is.has(i))return;is.add(i),ql.c.push(()=>{is.delete(i),n&&(t&&i.d(1),n())}),i.o(e)}else n&&n()}function rs(i,e){const t=e.token={};function n(l,r,a,o){if(e.token!==t)return;e.resolved=o;let c=e.ctx;a!==void 0&&(c=c.slice(),c[a]=o);const h=l&&(e.current=l)(c);let d=!1;e.block&&(e.blocks?e.blocks.forEach((g,p)=>{p!==r&&g&&(be(),U(g,1,1,()=>{e.blocks[p]===g&&(e.blocks[p]=null)}),ve())}):e.block.d(1),h.c(),R(h,1),h.m(e.mount(),e.anchor),d=!0),e.block=h,e.blocks&&(e.blocks[r]=h),d&&Go()}if(rk(i)){const l=kl();if(i.then(r=>{Ki(l),n(e.then,1,e.value,r),Ki(null)},r=>{if(Ki(l),n(e.catch,2,e.error,r),Ki(null),!e.hasCatch)throw r}),e.current!==e.pending)return n(e.pending,0),!0}else{if(e.current!==e.then)return n(e.then,1,e.value,i),!0;e.resolved=i}}function X_(i,e,t){const n=e.slice(),{resolved:l}=i;i.current===i.then&&(n[i.value]=l),i.current===i.catch&&(n[i.error]=l),i.block.p(n,t)}function Ve(i){return(i==null?void 0:i.length)!==void 0?i:Array.from(i)}function Ct(i,e,t){const n=i.$$.props[e];n!==void 0&&(i.$$.bound[n]=t,t(i.$$.ctx[n]))}function Be(i){i&&i.c()}function Me(i,e,t){const{fragment:n,after_update:l}=i.$$;n&&n.m(e,t),Bo(()=>{const r=i.$$.on_mount.map(Y_).filter(ki);i.$$.on_destroy?i.$$.on_destroy.push(...r):Ze(r),i.$$.on_mount=[]}),l.forEach(Bo)}function Fe(i,e){const t=i.$$;t.fragment!==null&&(hk(t.after_update),Ze(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function gk(i,e){i.$$.dirty[0]===-1&&(_r.push(i),ck(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function Vt(i,e,t,n,l,r,a=null,o=[-1]){const c=Xr;Ki(i);const h=i.$$={fragment:null,ctx:[],props:r,update:Ue,not_equal:l,bound:jf(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:jf(),dirty:o,skip_bound:!1,root:e.target||c.$$.root};a&&a(h.root);let d=!1;if(h.ctx=t?t(i,e.props||{},(g,p,...b)=>{const m=b.length?b[0]:p;return h.ctx&&l(h.ctx[g],h.ctx[g]=m)&&(!h.skip_bound&&h.bound[g]&&h.bound[g](m),d&&gk(i,g)),p}):[],h.update(),d=!0,Ze(h.before_update),h.fragment=n?n(h.ctx):!1,e.target){if(e.hydrate){const g=ok(e.target);h.fragment&&h.fragment.l(g),g.forEach(T)}else h.fragment&&h.fragment.c();e.intro&&R(i.$$.fragment),Me(i,e.target,e.anchor),Go()}Ki(c)}class Ot{constructor(){Un(this,"$$");Un(this,"$$set")}$destroy(){Fe(this,1),this.$destroy=Ue}$on(e,t){if(!ki(t))return Ue;const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const l=n.indexOf(t);l!==-1&&n.splice(l,1)}}$set(e){this.$$set&&!ak(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const _k="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(_k);class pk{constructor(){this.handles={},this.keyExistencyTimeout=2e4,this.keyExistencyCheckInterval=50}wrapAsPromise(e){return new Promise(t=>{t(e)})}applyFunctionPromisified(e,t){return e=e.apply(this,t),ie.isPromise(e)?e:this.wrapAsPromise(e)}getConfigValueFromObjectAsync(e,t,...n){let l=ie.getConfigValueFromObject(e,t);return ie.isFunction(l)?this.applyFunctionPromisified(l,n):this.wrapAsPromise(l)}}const as=new pk;class mk{convertCustomMessageInternalToUser(e){return e.data}convertCustomMessageUserToInternal(e){return{msg:"custom",data:e}}}const ss=new mk;class bk{constructor(){this.dataManagement=new Map}setChildren(e,t){this.dataManagement.set(e,t),this.navPath=""}getChildren(e){return e?this.dataManagement.get(e):{}}hasChildren(e){const t=this.getChildren(e);return t&&t.hasOwnProperty("children")}setRootNode(e){this.dataManagement.set("_luigiRootNode",{node:e})}getRootNode(){return this.dataManagement.get("_luigiRootNode")}hasRootNode(){return!!this.getRootNode()}deleteCache(){this.dataManagement.clear()}deleteNodesRecursively(e){if(this.hasChildren(e)){let t=this.getChildren(e).children;for(let n=0;n<t.length;n++)this.deleteNodesRecursively(t[n])}this.dataManagement.delete(e)}}const Yn=new bk;let vk=class{constructor(){this.configReadyCallback=function(){},this.initialized=!1,this.USER_SETTINGS_KEY="luigi.preferences.userSettings"}setConfigCallbacks(e){this.configReadyCallback=e}async setConfig(e){this.config=e,window.Luigi._store.update(()=>({config:e})),this._configModificationTimestamp=new Date,this.initialized||(this.initialized=!0,this.configReadyCallback().then(async()=>{xk.luigiAfterInit(),await this.executeConfigFnAsync("lifecycleHooks.luigiAfterInit")}))}getConfig(){return this.config}configChanged(...e){const t=vn.optimizeScope(e);t.length>0?t.forEach(n=>{window.Luigi._store.fire(n,{current:window.Luigi._store})}):window.Luigi._store.update(n=>n)}setErrorMessage(e){var t=document.createTextNode(e),n=document.createElement("div");n.setAttribute("class","fd-ui"),n.setAttribute("style","text-align: center;");var l=document.createElement("div");l.setAttribute("class","fd-message-strip fd-message-strip--error"),l.setAttribute("style","max-width: 800px; display: inline-block; margin-top: 40px;"),l.appendChild(t),n.appendChild(l),ji.getLuigiContainer().appendChild(n)}getConfigValue(e){return ie.getConfigValueFromObject(this.getConfig(),e)}getConfigBooleanValue(e){const t=ie.getConfigValueFromObject(this.getConfig(),e);return t===!0||t==="true"}getConfigValueAsync(e,...t){return as.getConfigValueFromObjectAsync(this.getConfig(),e,t)}async executeConfigFnAsync(e,t=!1,...n){const l=this.getConfigValue(e);if(ie.isFunction(l))try{return await as.applyFunctionPromisified(l,n)}catch(r){if(t)return Promise.reject(r)}return Promise.resolve(void 0)}isAuthorizationEnabled(){return wi.isAuthorizationEnabled()}unload(){this.initialized=!1,window.Luigi._store.clear(),gn.unload(),Hn.removeAllEventListeners();const e=ji.getLuigiContainer();for(;e.firstChild;)e.removeChild(e.lastChild)}async readUserSettings(){const e=await this.getConfigValueAsync("userSettings"),t=e||await this.getConfigValueAsync("settings.userSettings");if(t&&ie.isFunction(t.readUserSettings))return t.readUserSettings();const n=localStorage.getItem(this.USER_SETTINGS_KEY);return n&&JSON.parse(n)}async storeUserSettings(e,t){const n=await this.getConfigValueAsync("userSettings"),l=n||await this.getConfigValueAsync("settings.userSettings");if(l&&ie.isFunction(l.storeUserSettings))return l.storeUserSettings(e,t);localStorage.setItem(this.USER_SETTINGS_KEY,JSON.stringify(e)),this.configChanged()}reset(){const e=this.getConfig();this.unload(),this.setConfig(e)}clearNavigationCache(){Yn.deleteCache();const e=t=>{t&&t.forEach&&t.forEach(n=>{n.titleResolver&&n.titleResolver._cache&&(n.titleResolver._cache=void 0),n.children&&e(n.children)})};e(this.getConfig().navigation.nodes)}setGlobalContext(e,t){this.config&&this.config.navigation&&(this.config.navigation.globalContext=e,t||this.configChanged("navigation"))}getGlobalContext(){var e,t;return((t=(e=this.config)==null?void 0:e.navigation)==null?void 0:t.globalContext)||{}}updateContextValues(e){const t=Ee.getMicrofrontendIframes();t&&t.length>0&&t.forEach(n=>{n.luigi&&Ee.sendMessageToIframe(n,{msg:"luigi.navigate",context:JSON.stringify(Object.assign({},JSON.parse(n.luigi._lastUpdatedMessage.context),e)),nodeParams:n.luigi._lastUpdatedMessage.nodeParams,pathParams:JSON.stringify(Object.assign({},n.luigi.pathParams)),searchParams:JSON.stringify(Object.assign({},me.prepareSearchParamsForClient(n.luigi.currentNode))),internal:Ee.applyCoreStateData(JSON.parse(n.luigi._lastUpdatedMessage.internal))})}),document.querySelector(".wcContainer")&&document.querySelectorAll("[lui_web_component=true]").forEach(l=>{l.context=Object.assign({},l.context,e)})}};const os=new vk;let wk=class{constructor(){}isAuthorizationEnabled(){return!!ne.getConfigValue("auth.use")}login(){this.isAuthorizationEnabled()&&gn.startAuthorization()}logout(){this.isAuthorizationEnabled()&&gn.logout()}async handleAuthEvent(e,t,n,l){const r=await ne.executeConfigFnAsync("auth.events."+e,!1,t,n);let a=r===void 0||!!r;if(a&&l){window.location.href=l;return}return a}get store(){return ne.initialized||console.warn("Luigi Core is not initialized yet. Consider moving your code to the luigiAfterInit lifecycle hook. Documentation: https://docs.luigi-project.io/docs/lifecycle-hooks"),{getStorageKey:()=>ci.getStorageKey(),getStorageType:()=>ci.getStorageType(),getAuthData:()=>ci.getAuthData(),setAuthData:e=>ci.setAuthData(e),removeAuthData:()=>ci.removeAuthData(),setNewlyAuthorized:()=>{ci.setNewlyAuthorized(),gn.resetExpirationChecks()}}}};const $_=new wk,hn={desktopMinWidth:600},kk=[{type:"main",selector:".iframeContainer iframe"},{type:"split-view",selector:".iframeSplitViewCnt iframe"},{type:"modal",selector:".iframeModalCtn._modal iframe"},{type:"drawer",selector:".iframeModalCtn._drawer iframe"},{type:"user-settings",selector:".iframeUserSettingsCtn iframe"}],Sk={cssSelector:"[luigi-app-root]"},Ck={cssSelector:"[luigi-app-loading-indicator]"};let yk=class{getLuigiContainer(){return this.getCustomLuigiContainer()||this.getDefaultLuigiContainer()}isCustomLuigiContainer(){return this.getLuigiContainer()===this.getCustomLuigiContainer()}getCustomLuigiContainer(){return document.querySelector(Sk.cssSelector)}getDefaultLuigiContainer(){return document.querySelector("body")}getShellbar(){return document.getElementsByClassName("lui-shellbar-wrapper")[0]}getShellbarActions(){return document.getElementsByClassName("lui-shellbar_group--actions")[0]}getMicrofrontends(){return Ee.getMicrofrontendsInDom()}getMicrofrontendIframes(){return Ee.getMicrofrontendIframes()}getCurrentMicrofrontendIframe(){return Ee.getCurrentMicrofrontendIframe()}getNavFooterContainer(){return document.getElementsByClassName("lui-side-nav__footer")[0]}};const x_=new yk;class Pk{constructor(){this.promises={}}setPromise(e,t){this.promises[e]=t}getPromise(e){return this.promises[e]}}class Ln extends Pk{constructor(e){super(),Object.assign(this,e),this.options={preserveView:!1,nodeParams:{},errorSkipNavigation:!1,fromContext:null,fromParent:!1,fromClosestContext:!1,relative:!1,link:""}}async navigate(e,t,n,l,r){if(this.options.errorSkipNavigation)return this.options.errorSkipNavigation=!1,Promise.reject(new Error("navigation skipped"));this.options.preserveView=t;const a=e[0]!=="/";if(e==="/"&&(n||l||r))return console.warn("Navigation with an absolute path prevented."),Promise.reject(new Error("Navigation with an absolute path prevented."));const o=ie.createRemotePromise(),c={msg:"luigi.navigation.open",params:Object.assign(this.options,{link:e,relative:a,modal:n,splitView:l,drawer:r}),remotePromiseId:o.id};return this.sendPostMessageToLuigiCore(c),o}navigateToIntent(e,t={}){var l;let n="#?intent=";if(n+=e,t&&((l=Object.keys(t))!=null&&l.length)){const r=Object.entries(t);if(r.length>0){n+="?";for(const[a,o]of r)n+=a+"="+o+"&";n=n.slice(0,-1)}}this.navigate(n)}openAsModal(e,t={},n){if(ie.isFunction(n)){const l=ie.createRemotePromise();l.then(r=>{n(r)}),t.onClosePromiseId=l.id}return this.navigate(e,!0,t)}openAsDrawer(e,t={}){return this.navigate(e,!0,void 0,void 0,t)}openAsSplitView(e,t={}){return this.navigate(e,!0,void 0,t),Luigi.splitView.splitViewHandle}fromContext(e){return this.options.fromContext=e,this}fromClosestContext(){return this.options.fromContext=null,this.options.fromClosestContext=!0,this.options.fromParent=!1,this}fromVirtualTreeRoot(){return this.options.fromContext=null,this.options.fromClosestContext=!1,this.options.fromVirtualTreeRoot=!0,this.options.fromParent=!1,this}fromParent(){return this.options.fromContext=null,this.options.fromClosestContext=!1,this.options.fromVirtualTreeRoot=!1,this.options.fromParent=!0,this}withParams(e){return e&&Object.assign(this.options.nodeParams,e),this}pathExists(e){if(ie.isFunction(Luigi.pathExists))return Luigi.pathExists(e);console.error("Luigi.navigation().pathExists(path) is only available inside your configuration, after the configuration was initialized with Luigi.setConfig().")}hasBack(){return Luigi.hasBack()}goBack(e){this.sendPostMessageToLuigiCore({msg:"luigi.navigation.back",goBackContext:e&&JSON.stringify(e)})}getCurrentRoute(){return Luigi._app.ctx[Luigi._app.props.buildPathForGetCurrentRoute](this.options)}sendPostMessageToLuigiCore(e){window.postMessage(e,"*")}}class Ik{constructor(){}updateTopNavigation(){window.postMessage({msg:"luigi.navigation.update-badge-counters"},"*")}navigate(e,t,n,l,r){return new Ln().navigate(e,t,n,l,r)}navigateToIntent(e,t){return new Ln().navigateToIntent(e,t)}openAsModal(e,t,n){return new Ln().openAsModal(e,t,n)}openAsSplitView(e,t={}){if(e==="/"){console.warn("Navigation with an absolute path prevented.");return}return new Ln().openAsSplitView(e,t)}openAsDrawer(e,t){return new Ln().openAsDrawer(e,t)}fromContext(e){return new Ln().fromContext(e)}fromClosestContext(){return new Ln().fromClosestContext()}fromVirtualTreeRoot(){return new Ln().fromVirtualTreeRoot()}fromParent(){return new Ln().fromParent()}getCurrentRoute(){return new Ln().getCurrentRoute()}withParams(e){return new Ln().withParams(e)}pathExists(e){return new Ln().pathExists(e)}hasBack(){return new Ln().hasBack()}goBack(e){return new Ln().goBack(e)}}const ep=new Ik,Nk={luigi:{unsavedChangesAlert:{header:"Unsaved changes detected",body:"Unsaved changes will be lost. Do you want to continue?"},confirmationModal:{header:"Confirmation",body:"Are you sure you want to do this?"},button:{dismiss:"No",confirm:"Yes"},requestedRouteNotFound:"Could not find the requested route {route}.",notExactTargetNode:"Could not map the exact target node for the requested route {route}.",navigation:{up:"Up"}}},Tk=Nk;class Lk{constructor(){this.currentLocaleStorageKey="luigi.currentLocale",this.defaultLocale="en",this.translationTable=Tk,this.listeners={}}_init(){vn.doOnStoreChange(window.Luigi._store,()=>{this._initCustomImplementation()},["settings"])}getCurrentLocale(){return sessionStorage.getItem(this.currentLocaleStorageKey)||this.defaultLocale}setCurrentLocale(e){e&&(sessionStorage.setItem(this.currentLocaleStorageKey,e),this._notifyLocaleChange(e))}addCurrentLocaleChangeListener(e){if(ie.isFunction(e)){const t=ie.getRandomId();return this.listeners[t]=e,t}else console.error("Provided locale change listener is not a function.")}removeCurrentLocaleChangeListener(e){e&&this.listeners[e]?delete this.listeners[e]:console.error("Unable to remove locale change listener - no listener registered for given ID.")}_notifyLocaleChange(e){Object.getOwnPropertyNames(this.listeners).forEach(t=>{this.listeners[t](e)}),os.configChanged()}_initCustomImplementation(){this.translationImpl=os.getConfigValue("settings.customTranslationImplementation"),ie.isFunction(this.translationImpl)&&(this.translationImpl=this.translationImpl())}getTranslation(e,t=void 0,n=void 0){if(!e)return"";if(this.translationImpl){const r=this.translationImpl.getTranslation(e,t,n);if(r!==e)return r}const l=this.findTranslation(e,this.translationTable,t);return l||e}findTranslation(e,t,n){let l=e.split(".");for(let r=0;r<l.length;r++){let a=l[r];if(t.hasOwnProperty(a)&&typeof t[a]=="object")t=t[a];else return n?this.findInterpolations(t[a],n):t[a]}}findInterpolations(e,t){return typeof e!="string"||!e.trim()||Object.keys(t).forEach(n=>{e=e.replace(new RegExp("{"+Sr.escapeKeyForRegexp(n)+"}","gi"),t[n])}),e}}const tp=new Lk;class Ak{sendToAll(e){const t=ss.convertCustomMessageUserToInternal(e);Ee.getMicrofrontendsInDom().map(n=>n.container).map(n=>Ee.sendMessageToIframe(n,t))}send(e,t){const n=ss.convertCustomMessageUserToInternal(t);Ee.getMicrofrontendsInDom().filter(l=>l.id===e).map(l=>l.container).map(l=>Ee.sendMessageToIframe(l,n))}}const Ek=new Ak,hr=[];function Rk(i,e){return{subscribe:vr(i,e).subscribe}}function vr(i,e=Ue){let t;const n=new Set;function l(o){if(Rt(i,o)&&(i=o,t)){const c=!hr.length;for(const h of n)h[1](),hr.push(h,i);if(c){for(let h=0;h<hr.length;h+=2)hr[h][0](hr[h+1]);hr.length=0}}}function r(o){l(o(i))}function a(o,c=Ue){const h=[o,c];return n.add(h),n.size===1&&(t=e(l,r)||Ue),o(i),()=>{n.delete(h),n.size===0&&t&&(t(),t=null)}}return{set:l,update:r,subscribe:a}}class Dk{initial(){this.responsiveNavSetting=ne.getConfigValue("settings.responsiveNavigation");const e=this.responsiveNavSetting==="semiCollapsible"||this.responsiveNavSetting==="Fiori3";JSON.parse(localStorage.getItem(le.COL_NAV_KEY))!==!1&&e&&(this.isSemiCollapsed=this.getCollapsed()),this.semiCollapsible=!!e;let t=this.isSemiCollapsed===void 0;return this.semiCollapsible&&window.innerWidth!==0&&window.innerWidth<hn.desktopMinWidth?this.isSemiCollapsed=t?!0:this.getCollapsed():this.isSemiCollapsed=t?!1:this.getCollapsed(),this.setCollapsed(this.isSemiCollapsed),this.previousWindowWidth=window.innerWidth,{isSemiCollapsed:this.isSemiCollapsed,semiCollapsible:this.semiCollapsible}}onValueChanged(e){this.valueChangedFns?this.valueChangedFns.push(e):this.valueChangedFns=[e]}onResize(e){const t=window.innerWidth!==0&&window.innerWidth<hn.desktopMinWidth&&this.previousWindowWidth>=hn.desktopMinWidth,n=window.innerWidth!==0&&window.innerWidth>hn.desktopMinWidth&&this.previousWindowWidth>=hn.desktopMinWidth;return t&&this.setCollapsed(!0,!1),!this.isStoredCollapsed()&&n&&this.setCollapsed(!1,!1),e=this.closePopupMenu(e),{isSemiCollapsed:this.isSemiCollapsed,selectedCategory:e}}setCollapsed(e,t=!0){document.body.classList.remove("semiCollapsed"),e&&document.body.classList.add("semiCollapsed"),this.isSemiCollapsed=e,t&&localStorage.setItem(le.COL_NAV_KEY,e),this.valueChangedFns instanceof Array&&this.valueChangedFns.forEach(n=>n({isSemiCollapsed:this.isSemiCollapsed}))}isStoredCollapsed(){return JSON.parse(localStorage.getItem(le.COL_NAV_KEY))}getCollapsed(){return this.isStoredCollapsed()?!0:this.isSemiCollapsed}closePopupMenu(e){var t;return e&&(e=null,(t=document.getElementsByClassName("fd-app__sidebar")[0])==null||t.classList.remove("isBlocked")),e}buttonClicked(e){return this.closePopupMenu(),this.getCollapsed()?this.setCollapsed(!1):(this.setCollapsed(!0),document.getElementsByClassName("lui-fd-side-nav-wrapper")[0]&&(document.getElementsByClassName("lui-fd-side-nav-wrapper")[0].setAttribute("style","overflow-y:hidden;"),window.setTimeout(function(){document.getElementsByClassName("lui-fd-side-nav-wrapper")[0].setAttribute("style","overflow-y:auto;")}))),this.isSemiCollapsed}}const vi=new Dk;let Vk=class{constructor(){this.documentTitle=vr()}hideAppLoadingIndicator(){const e=document.querySelector(Ck.cssSelector);e&&(e.classList.add("hidden"),setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e)},500))}showAlert(e){if(ie.isFunction(Luigi.showAlert))return Luigi.showAlert(e);console.error("Luigi.ux().showAlert() is only available inside your configuration, after the configuration was initialized with Luigi.setConfig().")}showConfirmationModal(e){if(ie.isFunction(Luigi.showConfirmationModal))return Luigi.showConfirmationModal(e);console.error("Luigi.ux().showConfirmationModal() is only available inside your configuration, after the configuration was initialized with Luigi.setConfig().")}setDocumentTitle(e){this.documentTitle.set(e),Luigi.configChanged("settings.header")}getDocumentTitle(){return hl(this.documentTitle)}collapseLeftSideNav(e){vi.setCollapsed(e)}openUserSettings(){Luigi.openUserSettings()}closeUserSettings(){Luigi.closeUserSettings()}removeBackdrop(){new Ln().sendPostMessageToLuigiCore({msg:"luigi.remove-backdrop"})}getDirtyStatus(){return Luigi.getDirtyStatus()}getCurrentTheme(){return Luigi.theming().getCurrentTheme()}};const np=new Vk;let Ok=class{openSearchField(){Luigi.openSearchField()}closeSearchField(){Luigi.closeSearchField()}clearSearchField(){Luigi.clearSearchField()}showSearchResult(e){Luigi.showSearchResult(e)}closeSearchResult(){Luigi.closeSearchResult()}getSearchString(){return Luigi.getGlobalSearchString()}setSearchString(e){Luigi.setGlobalSearchString(e)}setSearchInputPlaceholder(e){Luigi.setSearchInputPlaceholder(e)}};const ip=new Ok;let Mk=class{constructor(){this.currentTheme}async getAvailableThemes(){return await ne.getConfigValueAsync("settings.theming.themes")}setCurrentTheme(e){this.currentTheme=e,window.Luigi.__cssVars=void 0}async getThemeObject(e){const t=await this.getAvailableThemes();return t&&t.find(n=>n.id===e)}getCurrentTheme(){if(!this.isThemingAvailable())return!1;if(this.currentTheme)return this.currentTheme;const e=ne.getConfigValue("settings.theming");return e.defaultTheme||console.error("[Theming] getCurrentTheme() error. No theme set and no defaultTheme found in configuration",e),e.defaultTheme}isThemingAvailable(){return!!ne.getConfigValue("settings.theming")}async getCSSVariables(){if(!window.Luigi.__cssVars){const e=ne.getConfigValue("settings.theming.variables.file");if(e)try{const t=await fetch(e);window.Luigi.__cssVars=(await t.json()).root,Object.keys(window.Luigi.__cssVars).forEach(n=>{const l=getComputedStyle(document.documentElement).getPropertyValue("--"+n);l&&(window.Luigi.__cssVars[n]=l)})}catch(t){ie.isFunction(ne.getConfigValue("settings.theming.variables.errorHandling"))?ne.getConfigValue("settings.theming.variables.errorHandling")(t):console.error("CSS variables file error: ",t)}else ne.getConfigValue("settings.theming.variables")==="fiori"&&window.__luigiThemeVars?(window.Luigi.__cssVars={},window.__luigiThemeVars.forEach(t=>{window.Luigi.__cssVars[t]=getComputedStyle(document.documentElement).getPropertyValue("--"+t)})):window.Luigi.__cssVars={}}return window.Luigi.__cssVars}_init(){const e=()=>{const t=ne.getConfigValue("settings.theming");t&&t.nodeViewURLDecorator&&t.nodeViewURLDecorator.queryStringParameter&&$r.add({type:"queryString",uid:"theming",key:t.nodeViewURLDecorator.queryStringParameter.keyName,valueFn:()=>{const n=this.getCurrentTheme(),l=t.nodeViewURLDecorator.queryStringParameter.value;return l?l(n):n}}),t&&t.useFioriScrollbars===!0&&document.body.classList.add("fioriScrollbars")};vn.doOnStoreChange(window.Luigi._store,()=>{e()},["settings.theming"])}};const lp=new Mk;let Fk=class{constructor(){this.featureToggleList=vr([])}setFeatureToggle(e,t=!1){this.isValid(e)&&(e.startsWith("!")&&!t||this.isDuplicatedOrDisabled(e)||hl(this.featureToggleList).push(e))}unsetFeatureToggle(e){if(!this.isValid(e))return;const t=hl(this.featureToggleList).indexOf(e);if(t===-1){console.warn("Feature toggle name is not in the list.");return}hl(this.featureToggleList).splice(t,1)}getActiveFeatureToggleList(){return[...hl(this.featureToggleList)].filter(e=>!e.startsWith("!"))}isValid(e){return ie.isString(e)?!0:(console.warn("Feature toggle name is not valid or not of type 'string'"),!1)}isDuplicatedOrDisabled(e){return hl(this.featureToggleList).includes(e)?(console.warn("Feature toggle name already exists"),!0):hl(this.featureToggleList).includes(`!${e}`)?(console.warn("Disabled feature toggle can not be activated"),!0):!1}};const rp=new Fk;let Uk=class{constructor(){}getSearchParams(){const e={},t=new URL(location);if(ne.getConfigValue("routing.useHashRouting"))for(const[n,l]of new URLSearchParams(t.hash.split("?")[1]))e[n]=l;else for(const[n,l]of t.searchParams.entries())e[n]=l;return e}addSearchParams(e,t){if(!ie.isObject(e)){console.log("Params argument must be an object");return}const n=new URL(location);ne.getConfigValue("routing.useHashRouting")?n.hash=me.addParamsOnHashRouting(e,n.hash):me.modifySearchParams(e,n.searchParams),this.handleBrowserHistory(t,n),ne.configChanged()}addNodeParams(e,t){if(!ie.isObject(e)){console.log("Params argument must be an object");return}const n=me.getContentViewParamPrefix(),l=new URL(location);ne.getConfigValue("routing.useHashRouting")?l.hash=me.addParamsOnHashRouting(e,l.hash,n):me.modifySearchParams(e,l.searchParams,n),this.handleBrowserHistory(t,l),ne.configChanged()}sanitizeUrl(e){return new URL(location).origin===new URL(e).origin?e:void 0}handleBrowserHistory(e,t){const n=this.sanitizeUrl(t.href);if(!n){console.warn("invalid url: "+n);return}e?window.history.pushState({},"",n):window.history.replaceState({},"",n)}getAnchor(){const{hash:e}=new URL(location);return ne.getConfigValue("routing.useHashRouting")&&e.split("#").length===2?"":e.split("#").pop()}setAnchor(e){if(ne.getConfigValue("routing.useHashRouting")){const{hash:t}=new URL(location),n=t.split("#"),r=n.length>2?n.slice(0,-1):n;window.location.hash=[...r,e].join("#")}else window.location.hash=e}};const ap=new Uk,ne=os,wi=$_,ji=x_,sp=ep,At=tp,na=np,Bk=ip,Ho=lp,Ko=rp,gl=ap;window.Luigi=os;window.Luigi.auth=()=>$_;window.Luigi.elements=()=>x_;window.Luigi.navigation=()=>ep;window.Luigi.i18n=()=>tp;window.Luigi.customMessages=()=>Ek;window.Luigi.ux=()=>np;window.Luigi.globalSearch=()=>ip;window.Luigi.theming=()=>lp;window.Luigi.featureToggles=()=>rp;window.Luigi.routing=()=>ap;class Hk{constructor(){this.iframeNavFallbackTimeout=2e3,this.timeoutHandle}getActiveIframe(e){return[...e.children].filter(n=>n.tagName==="IFRAME").find(ie.isElementVisible)}setActiveIframeToPrevious(e){const t=Ee.getMainIframes(),n=this.getPreservedViewsInDom(t);if(n.length===0)return;const l=this.getActiveIframe(e);Ee.hideElementChildren(e),l&&e.removeChild(l),n[0].pv=void 0,n[0].style.display="block"}removeInactiveIframes(e){Array.from(e.children).forEach(n=>{!ie.isElementVisible(n)&&!n.vg&&n.tagName==="IFRAME"&&e.removeChild(n)})}hasIsolatedView(e,t,n){return e||n&&e!==!1&&!t}getPreservedViewsInDom(e){return e.filter(t=>t.pv)}canCache(e){const t=le.getViewGroupSettings(e);return t&&t.preloadUrl}notifyInactiveIframes(){const e={msg:"luigi-client.inactive-microfrontend",context:JSON.stringify({}),nodeParams:JSON.stringify({}),pathParams:JSON.stringify({}),internal:JSON.stringify({currentLocale:At.getCurrentLocale()})};Ee.sendMessageToVisibleIframes(e)}switchActiveIframe(e,t,n){const l=this.getActiveIframe(e);if(l!==t){let r=!1;Array.from(e.children).forEach(o=>{if(o===l)if(n)e.removeChild(o);else{const c=le.getViewGroupSettings(o.vg);if(c&&this.notifyInactiveIframes(),o.style.display="none",c.preloadUrl){const h={msg:"luigi.navigate",viewUrl:c.preloadUrl,context:JSON.stringify({}),nodeParams:JSON.stringify({}),pathParams:JSON.stringify({}),internal:JSON.stringify({currentLocale:At.getCurrentLocale()})};Ee.sendMessageToIframe(o,h)}}o===t&&(r=!0)}),t&&(t.style.display="block",r||e.insertBefore(t,e.firstChild))}return t}setOkResponseHandler(e,t,n){var r,a;(a=le.getViewGroupSettings((r=e.iframe)==null?void 0:r.vg))!=null&&a.noClientCheck||(this.timeoutHandle=setTimeout(async()=>{e.navigateOk?e.navigateOk=void 0:(Ee.removeIframe(e.iframe,n),e.iframe=void 0,e.isFallbackFrame=!0,console.info("navigate: luigi-client did not respond, using fallback by replacing iframe"),await this.navigateIframe(e,t,n))},this.iframeNavFallbackTimeout))}checkIframe(e,t,n,l,r){this.timeoutHandle=setTimeout(()=>{t.get().showLoadingIndicator&&(e.viewUrl?(n=e.viewUrl,t.set({viewUrl:n}),this.iframeNavFallbackTimeout=0,this.setOkResponseHandler(l,t,r)):le.handleUnresponsiveClient(e))},e.timeout)}initHandshakeFailed(e){var l;if(!(e&&e.iframe&&e.iframe.luigi))return!0;const t=e.iframe.luigi.clientVersion;return((l=le.getViewGroupSettings(e.iframe.vg))==null?void 0:l.noClientCheck)?!1:e.iframe.luigi.initOk===void 0?!0:!t||ie.semverCompare("1.1.1",t)!==-1?!1:!e.iframe.luigi.initOk}async navigateIframe(e,t,n){clearTimeout(this.timeoutHandle);const l=t.get();let r=l.viewUrl;r&&(r=me.substituteViewUrl(r,l));const a=Ee.isSameViewGroup(e,t),o=this.hasIsolatedView(l.previousNodeValues.isolateView,a,e.isolateAllViews),c=this.hasIsolatedView(l.isolateView,a,e.isolateAllViews),h=Ee.canReuseIframe(e,t);let d=this.getActiveIframe(n);const g=Ee.getMainIframes(),p=this.getPreservedViewsInDom(g);let b,m=!1;if(p.length>0&&(b=p.shift(),b===d&&(m=!0,d=void 0,e.iframe=void 0)),!m&&!t.get().isNavigateBack){d&&o&&(d=this.switchActiveIframe(n,void 0,!0)),d&&c&&(d=this.switchActiveIframe(n,void 0,!d.vg));let v;if(!c&&l.viewGroup){const y=Ee.getMainIframes().filter(P=>P.vg===l.viewGroup);y.length>0&&(v=y[0],d=this.switchActiveIframe(n,v,d&&!d.vg))}d&&!v&&(d.vg?d=this.switchActiveIframe(n,void 0,!1):h||(d=this.switchActiveIframe(n,void 0,!0))),e.iframe=d}if(!e.iframe||this.initHandshakeFailed(e)){if(e.iframe&&n.removeChild(e.iframe),m?(this.notifyInactiveIframes(),Ee.hideElementChildren(n)):Ee.removeElementChildren(n),l.viewUrl){ie.getConfigValueFromObject(l,"currentNode.loadingIndicator.enabled")!==!1?t.set({showLoadingIndicator:!0}):t.set({showLoadingIndicator:!1}),e.navigateOk=void 0;const v=l.viewGroup&&!c&&this.canCache(l.viewGroup);if(e.iframe=Ee.createIframe(r,v?l.viewGroup:void 0,t.get().currentNode,"main",l),n.insertBefore(e.iframe,n.firstChild),e.builderCompatibilityMode)e.iframe.addEventListener("load",()=>{e.iframe._ready=!0;const y=["init",JSON.stringify(l.context)];Ee.sendMessageToIframe(e.iframe,y)});else{const y=e.iframe;y.addEventListener("load",()=>{y._ready=!0})}const C=l.currentNode.pageErrorHandler;C?this.checkIframe(C,t,r,e,n):e.defaultPageErrorHandler&&this.checkIframe(e.defaultPageErrorHandler,t,r,e,n)}}else{t.set({showLoadingIndicator:!1});const v=t.get().goBackContext;e.iframe.style.display="block",e.iframe.luigi.nextViewUrl=r,e.iframe.luigi.nextClientPermissions=t.get().currentNode.clientPermissions,e.iframe.vg=this.canCache(l.viewGroup)?l.viewGroup:void 0,e.iframe.luigi.currentNode=l.currentNode;const C=await t.prepareInternalData(e),y={msg:"luigi.navigate",viewUrl:r,context:JSON.stringify(Object.assign({},l.context,{goBackContext:v})),nodeParams:JSON.stringify(Object.assign({},l.nodeParams)),pathParams:JSON.stringify(Object.assign({},l.pathParams)),searchParams:JSON.stringify(Object.assign({},me.prepareSearchParamsForClient(e.iframe.luigi.currentNode))),internal:JSON.stringify(C)};l.isNavigationSyncEnabled?(Ee.getVisibleIframes().forEach(I=>{I!==e.iframe&&(I.userSettingsGroup?Luigi.readUserSettings().then(N=>{Ee.sendMessageToIframe(I,{msg:"luigi.navigate",context:{userSettingsData:N[I.userSettingsGroup]},internal:Ee.applyCoreStateData(I.luigi._lastUpdatedMessage.internal)})}):Ee.sendMessageToIframe(I,{msg:"luigi.navigate",context:I.luigi._lastUpdatedMessage.context,nodeParams:I.luigi._lastUpdatedMessage.nodeParams,pathParams:JSON.stringify(Object.assign({},I.luigi.pathParams)),searchParams:JSON.stringify(Object.assign({},me.prepareSearchParamsForClient(e.iframe.luigi.currentNode))),internal:Ee.applyCoreStateData(I.luigi._lastUpdatedMessage.internal)}))}),Ee.sendMessageToIframe(e.iframe,y),this.setOkResponseHandler(e,t,n)):t.set({isNavigationSyncEnabled:!0}),t.set({goBackContext:void 0,isNavigateBack:!1})}}}const fi=new Hk;class Wk{constructor(){this.preloadBatchSize=1,this.shouldPreload=!1}preloadViewGroups(e=3,t){if(ne.getConfigValue("navigation.preloadViewGroups")===!1)return;const l=le.getAllViewGroupSettings();if(!l)return;const r=Ee.getIframeContainer(),a=Ee.getMainIframes(),o=new Date().getTime();if(a.filter(g=>g.luigi&&g.luigi.preloading&&o-g.luigi.createdAt<3e4).length>0){console.debug("skipping view group preloading (busy)");return}const h=a.map(g=>g.vg).filter(Boolean),d=Object.entries(l).filter(([g,p])=>!h.includes(g)).filter(([g,p])=>p&&p.preloadUrl);t&&d.forEach(([g,p])=>{p.loadOnStartup&&this.preloadIframeOnBackground(p,g,r)}),!t&&d.filter((g,p)=>p<e).forEach(([g,p])=>{console.debug("preloading view group "+g+" - "+p.preloadUrl),this.preloadIframeOnBackground(p,g,r)})}preloadIframeOnBackground(e,t,n){const l=Ee.createIframe(e.preloadUrl,t,null,"main");l.style.display="none",l.luigi.preloading=!0,n.appendChild(l)}preload(e){this.shouldPreload&&setTimeout(()=>{this.preloadViewGroups(this.preloadBatchSize,e)},e),this.shouldPreload=!0}viewGroupLoaded(e){if(e.luigi.preloading){const t=new Date().getTime()-e.luigi.createdAt;let n=1;t<500?n=3:t<1e3&&(n=2),this.preloadBatchSize=n,console.debug("preload batch size: "+this.preloadBatchSize),setTimeout(()=>{e.luigi.preloading=!1},this.preloadBatchSize>2?500:1e3)}}}const gr=new Wk;class qk{async getNavigationPath(e,t=""){try{const n=ie.getTrimmedUrl(t);if(!e)return console.error("No navigation nodes provided in the configuration."),[{}];let l;if(Yn.hasRootNode()&&(l=Yn.getRootNode().node),!l){const g=await e;ie.isObject(g)?(l=g,l.pathSegment&&(l.pathSegment="",console.warn("Root node must have an empty path segment. Provided path segment will be ignored."))):l={children:g},l.children=await this.getChildren(l),Yn.setRootNode(l)}const r=n.split("/"),o={...ne.getConfigValue("navigation.globalContext")||{},...l.context||{}},c=await this.buildNode(r,[l],l.children,o),h=c.navigationPath.filter(g=>g.pathSegment).map(g=>g.pathSegment);c.isExistingRoute=!n||r.length===h.length;const d=n.split("/");return c.matchedPath=d.filter((g,p)=>h[p]&&h[p].startsWith(":")||h[p]===g).join("/"),c}catch(n){console.error("Failed to load top navigation nodes.",n)}}async getChildren(e,t){if(!e)return[];let n=[];if(Yn.hasChildren(e)){let r=Yn.getChildren(e);r&&(n=r.children)}else try{n=await as.getConfigValueFromObjectAsync(e,"children",t||e.context),n==null&&(n=[]),n=n.map(r=>this.getExpandStructuralPathSegment(r)).map(r=>this.bindChildToParent(r,e))||[]}catch(r){console.error("Could not lazy-load children for node",r)}let l=this.getAccessibleNodes(e,n,t);return Yn.setChildren(e,{children:n,filteredChildren:l}),l}async getFilteredChildren(e){return Yn.hasChildren(e)?qt.getChildrenFromCache(e):await qt.getChildren(e)}getChildrenFromCache(e){let t=Yn.getChildren(e);return t?t.filteredChildren:[]}getAccessibleNodes(e,t,n){return t?t.filter(l=>le.isNodeAccessPermitted(l,e,n)):[]}bindChildToParent(e,t){return t&&t.pathSegment&&(e.parent=t),e}getExpandStructuralPathSegment(e){if(e&&e.pathSegment&&e.pathSegment.indexOf("/")!==-1){const t=e.pathSegment.split("/"),n={...e},l=(r,a)=>{const o=r.shift();let c={};return r.length?(c.pathSegment=o,a.hideFromNav&&(c.hideFromNav=a.hideFromNav),c.children=[l(r,a)]):(c=n,c.pathSegment=o),c};return l(t,e)}return e}async buildNode(e,t,n,l,r={}){l.parentNavigationContexts||(l.parentNavigationContexts=[]);let a={navigationPath:t,context:l,pathParams:r};if(e.length>0&&n&&n.length>0){const o=e[0],c=this.findMatchingNode(o,n);if(c){t.push(c);let h=le.applyContext(l,c.context,c.navigationContext);c.pathSegment.startsWith(":")&&(r[c.pathSegment.replace(":","")]=Sr.sanitizeParam(o)),h=me.substituteDynamicParamsInObject(h,r);try{this.buildVirtualTree(c,e,r);let d=await this.getChildren(c,h);const g=e.slice(1);a=this.buildNode(g,t,d,h,r)}catch(d){console.error("Error getting nodes children",d)}}}return a}buildVirtualViewUrl(e,t,n){let l="";for(const r in t)r.startsWith("virtualSegment")&&(l+=":"+r+"/");return n?(l+=":virtualSegment_"+n+"/",e+"/"+l):e}buildVirtualTree(e,t,n){const l=e.virtualTree,r=e._virtualTree,a=e._virtualViewUrl||e.viewUrl;if((l||r)&&t[0]){let o=e._virtualPathIndex;if(l&&(o=0,e.keepSelectedForChildren=!0),o>50)return;o++;const h=["_*","virtualTree","parent","children","keepSelectedForChildren","navigationContext"],d=ie.removeProperties(e,h);Object.assign(d,{pathSegment:":virtualSegment_"+o,label:":virtualSegment_"+o,viewUrl:ie.trimTrailingSlash(this.buildVirtualViewUrl(a,n,o)),_virtualTree:!0,_virtualPathIndex:o,_virtualViewUrl:a});const g=Array.isArray(e.children)&&e.children.length>0?e.children[0]._virtualTree:!1;e.children&&!g&&console.warn(`Found both virtualTree and children nodes defined on a navigation node.
Children nodes are redundant and ignored when virtualTree is enabled.
Please refer to documentation`),e.children=[d]}}findMatchingNode(e,t){let n=null;const l=t.filter(a=>!!a.pathSegment).length,r=t.filter(a=>a.pathSegment&&a.pathSegment.startsWith(":")).length;return e=e.includes("#")?e.split("#").shift():e,l>1&&(r===1&&(console.warn(`Invalid node setup detected.
Static and dynamic nodes cannot be used together on the same level. Static node gets cleaned up.
Remove the static node from the configuration to resolve this warning.
Affected pathSegment:`,e,"Children:",t),t=t.filter(a=>a.pathSegment&&a.pathSegment.startsWith(":"))),r>1)?(console.error(`Invalid node setup detected.
Multiple dynamic nodes are not allowed on the same level. Stopped navigation.
Invalid Children:`,t),null):(t.some(a=>{if(a.pathSegment===e||a.pathSegment&&a.pathSegment.startsWith(":"))return n=a,!0}),n)}onNodeChange(e,t){const n=ne.getConfigValue("navigation.nodeChangeHook");typeof n=="function"?n(e,t):n!==void 0&&console.warn("nodeChangeHook is not a function!")}getNodesToDisplay(e,t){if(e&&e.length>0)return{children:e};if(t.length>1&&(t[0].topNav===!1||t.length>2)){const n=t[t.length-2];if(Yn.hasChildren(n))return{children:this.getChildrenFromCache(n),parent:n}}return{children:[]}}getGroupedChildren(e,t){const n=this.getNodesToDisplay(e,t.pathData);return Array.isArray(n)?le.groupNodesBy(n,"category",!0):{children:le.groupNodesBy(n.children,"category",!0),parent:n.parent}}getTruncatedChildren(e){let t=!1,n=!1,l=[];return e.slice().reverse().forEach(r=>{(!t||r.tabNav)&&(r.tabNav===!1&&(n=!0),r.keepSelectedForChildren===!1?t=!0:(r.keepSelectedForChildren||r.tabNav&&!n&&!me.isDynamicNode(r))&&(t=!0,l=[])),l.push(r)}),l.reverse()}async getLeftNavData(e,t){var l;const n={};if(e.pathData&&e.pathData.length>0&&(e.pathData[0].topNav===!1||e.pathData.length>1)){const r=this.getTruncatedChildren(t.pathData);let a=[...r].pop(),o;(a.keepSelectedForChildren||a.tabNav)&&(o=a,r.pop(),a=[...r].pop());const c=await this.getChildren(a,(l=t.pathData)==null?void 0:l._context),h=this.getGroupedChildren(c,e);n.navParent=h.parent||a,n.context=e.pathData._context,n.hasCategoriesWithIcon=!1;const d=h.children;Object.values(d).forEach(p=>{!n.hasCategoriesWithIcon&&p&&p.metaInfo&&p.metaInfo.icon&&(n.hasCategoriesWithIcon=!0)}),n.selectedNode=o||a,n.children=d,ne.getConfigValue("settings.expandCategoryByNavigation")&&this.expandCategoriesByNavigationFn(n.children,n.selectedNode,le.getSideNavAccordionMode(n.selectedNode))}return n}expandCategoriesByNavigationFn(e,t,n){if(e)for(const[l,r]of Object.entries(e))r.forEach(a=>{a===t&&r.metaInfo&&r.metaInfo.collapsible&&le.storeExpandedState(r.metaInfo.categoryUid,!0,n)})}getTruncatedChildrenForTabNav(e){const t=[];for(let n=e.length-1;n>=0;n--)if(e[n].tabNav)return e.slice(0,n+2);return t}async getTabNavData(e,t){var l;const n={};if(e.pathData&&e.pathData.length>0&&(e.pathData[0].topNav===!1||e.pathData.length>1)){const a=[...this.getTruncatedChildrenForTabNav(t.pathData)].pop(),o=await this.getChildren(a.tabNav?a:le.getParentNode(a,e.pathData),(l=e.pathData)==null?void 0:l._context),c=this.getGroupedChildren(o,e).children;n.selectedNode=a,n.selectedNodeForTabNav=a,n.children=c}return n}async extractDataFromPath(e){const t=await this.getNavigationPath(ne.getConfigValueAsync("navigation.nodes"),e);return{nodeObject:me.getLastNodeObject(t),pathData:t}}async shouldPreventNavigation(e){return!!(e&&(ie.isFunction(e.onNodeActivation)||ie.isAsyncFunction(e.onNodeActivation))&&await e.onNodeActivation(e)===!1)}}const qt=new qk,ml={logout:{label:"Sign Out",icon:"log"},userSettingsProfileMenuEntry:{label:"Settings",icon:"settings"},userSettingsDialog:{dialogHeader:"User Settings",saveBtn:"Save",dismissBtn:"Cancel"},globalSearchCenteredCancelButton:"Cancel"},zk={externalLink:{sameWindow:!1}};class wr{constructor(e){e?(this.rendererObject=e,this.config=e.config||{}):this.config={}}createCompoundContainer(){return document.createElement("div")}createCompoundItemContainer(){return document.createElement("div")}attachCompoundItem(e,t){e.appendChild(t)}}class Gk extends wr{constructor(e){super(e||{use:{}}),e&&e.use&&e.use.extends&&(this.superRenderer=op({use:e.use.extends,config:e.config}))}createCompoundContainer(){return this.rendererObject.use.createCompoundContainer?this.rendererObject.use.createCompoundContainer(this.config,this.superRenderer):this.superRenderer?this.superRenderer.createCompoundContainer():super.createCompoundContainer()}createCompoundItemContainer(e){return this.rendererObject.use.createCompoundItemContainer?this.rendererObject.use.createCompoundItemContainer(e,this.config,this.superRenderer):this.superRenderer?this.superRenderer.createCompoundItemContainer(e):super.createCompoundItemContainer(e)}attachCompoundItem(e,t){this.rendererObject.use.attachCompoundItem?this.rendererObject.use.attachCompoundItem(e,t,this.superRenderer):this.superRenderer?this.superRenderer.attachCompoundItem(e,t):super.attachCompoundItem(e,t)}}class Kk extends wr{createCompoundContainer(){const e="__lui_compound_"+new Date().getTime(),t=document.createElement("div");t.classList.add(e);let n="";return this.config.layouts&&this.config.layouts.forEach(l=>{if(l.minWidth||l.maxWidth){let r="@media only screen ";l.minWidth!=null&&(r+=`and (min-width: ${l.minWidth}px) `),l.maxWidth!=null&&(r+=`and (max-width: ${l.maxWidth}px) `),r+=`{
.${e} {
grid-template-columns: ${l.columns||"auto"};
grid-template-rows: ${l.rows||"auto"};
grid-gap: ${l.gap||"0"};
}
}
`,n+=r}}),t.innerHTML=`
<style scoped>
.${e} {
display: grid;
grid-template-columns: ${this.config.columns||"auto"};
grid-template-rows: ${this.config.rows||"auto"};
grid-gap: ${this.config.gap||"0"};
min-height: ${this.config.minHeight||"auto"};
}
${n}
</style>
`,t}createCompoundItemContainer(e){const t=e||{},n=document.createElement("div");return n.setAttribute("style",`grid-row: ${t.row||"auto"}; grid-column: ${t.column||"auto"}`),n}}const op=i=>{const e=i.use;if(e){if(e==="grid")return new Kk(i);if(e.createCompoundContainer||e.createCompoundItemContainer||e.attachCompoundItem)return new Gk(i)}else return new wr(i);return new wr(i)},Yf=(i,e,t,n)=>{e.eventListeners&&e.eventListeners.forEach(l=>{const r=l.source+"."+l.name,a=i[r],o={wcElementId:t,wcElement:n,action:l.action,converter:l.dataConverter};a?a.push(o):i[r]=[o]})},jk=i=>Object.entries(i).reduce((e,t)=>(e[Qf(t[0])]=Qf(t[1]),e),{}),Qf=(i="")=>String(i).replaceAll("<","<").replaceAll(">",">").replaceAll(""",'"').replaceAll("'","'").replaceAll("/","/"),Jk="500px",Yk="0px";class Qk{constructor(){Un(this,"wcContainerData",new WeakMap)}dynamicImport(e){return import(/* webpackIgnore: true */e)}attachWC(e,t,n,l,r,a,o,c){if(n&&n.contains(t)){const h=document.createElement(e);a&&h.setAttribute("nodeId",a),h.setAttribute("lui_web_component",!0),this.initWC(h,e,n,r,l,a,o),n.replaceChild(h,t),c&&(this.removeTemporaryHeightFromCompoundItemContainer(n),this.wcContainerData.delete(n))}}initWC(e,t,n,l,r,a,o){const c=r.context;e.extendedContext=r,e.extendedContext.currentNode&&(e.extendedContext.clientPermissions=e.extendedContext.currentNode.clientPermissions);const h={linkManager:()=>{const g=window.Luigi.navigation();return new Proxy(g,{get(p,b){return b===p.getCurrentRoute.name?()=>{const m=new Promise(v=>{v(p.getCurrentRoute())});return m.toString=()=>p.getCurrentRoute(),m}:p[b]}})},uxManager:window.Luigi.ux,getCurrentLocale:()=>window.Luigi.i18n().getCurrentLocale(),publishEvent:g=>{n.eventBus&&n.eventBus.onPublishEvent(g,a,t)},getActiveFeatureToggleList:()=>window.Luigi.featureToggles().getActiveFeatureToggleList(),getActiveFeatureToggles:()=>window.Luigi.featureToggles().getActiveFeatureToggleList(),getPathParams:()=>{var g;return(g=e.extendedContext)!=null&&g.pathParams?e.extendedContext.pathParams:{}},getCoreSearchParams:()=>{const g={clientPermissions:e.extendedContext.clientPermissions};return me.prepareSearchParamsForClient(g)},getClientPermissions:()=>{var g;return(g=e.extendedContext)!=null&&g.clientPermissions?e.extendedContext.clientPermissions:{}},addNodeParams:(g,p)=>{o||window.Luigi.routing().addNodeParams(g,p)},getNodeParams:g=>{var b;if(o)return{};const p=(b=e.extendedContext)!=null&&b.nodeParams?e.extendedContext.nodeParams:{};return g?jk(p):e.extendedContext.nodeParams},setAnchor:g=>{o||window.Luigi.routing().setAnchor(g)},getAnchor:()=>window.Luigi.routing().getAnchor(),getUserSettings:async()=>await this.getUserSettingsForWc(n._luigi_node),setViewGroupData:g=>{const p=le.findViewGroup(n._luigi_node);if(p){const b=le.getViewGroupSettings(p);b._liveCustomData=g,ne.configChanged("navigation.viewgroupdata")}}};if(e.__postProcess){const g=new URL(document.baseURI).origin===new URL(l,document.baseURI).origin?new URL(l,document.baseURI):new URL("./",l);e.__postProcess(c,h,g.origin+g.pathname)}else e.context=c,e.nodeParams=r.nodeParams,e.LuigiClient=h;const d=ne.getConfigValue("settings.webcomponentCreationInterceptor");ie.isFunction(d)&&d(e,r.currentNode,r,a,o)}generateWCId(e){let t="",n=new URL(e,encodeURI(location.href)).href;for(let l=0;l<n.length;l++)t+=n.charCodeAt(l).toString(16);return"luigi-wc-"+t}registerWCFromUrl(e,t){const n=me.getI18nViewUrl(e);return new Promise((l,r)=>{this.checkWCUrl(n)?this.dynamicImport(n).then(a=>{try{if(!window.customElements.get(t)){let o=a.default;if(!HTMLElement.isPrototypeOf(o)){let c=Object.keys(a);for(let h=0;h<c.length&&(o=a[c[h]],!HTMLElement.isPrototypeOf(o));h++);}window.customElements.define(t,o)}l()}catch(o){r(o)}}).catch(a=>r(a)):(console.warn(`View URL '${n}' not allowed to be included`),r(`View URL '${n}' not allowed`))})}includeSelfRegisteredWCFromUrl(e,t,n){if(this.checkWCUrl(t)){window.Luigi._registerWebcomponent||(window.Luigi._registerWebcomponent=(r,a)=>{const o=this.generateWCId(r);window.customElements.get(o)||window.customElements.define(o,a)});let l=document.createElement