@luigi-project/core 2.4.1-dev.202308300028 → 2.4.1-dev.202308310027
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/luigi.js +1 -1
- package/luigi.js.map +1 -1
- package/package.json +1 -1
package/luigi.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function Fe(){}function nw(i,e){for(const t in e)i[t]=e[t];return i}function iw(i){return!!i&&(typeof i=="object"||typeof i=="function")&&typeof i.then=="function"}function Zg(i){return i()}function Mf(){return Object.create(null)}function Ze(i){i.forEach(Zg)}function Dl(i){return typeof i=="function"}function Tt(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}let Xs;function lt(i,e){return Xs||(Xs=document.createElement("a")),Xs.href=e,i===Xs.href}function lw(i){return Object.keys(i).length===0}function Lo(i,...e){if(i==null)return Fe;const t=i.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function rl(i){let e;return Lo(i,t=>e=t)(),e}function ki(i,e,t){i.$$.on_destroy.push(Lo(e,t))}function Xg(i,e,t,n){if(i){const l=$g(i,e,t,n);return i[0](l)}}function $g(i,e,t,n){return i[1]&&n?nw(t.ctx.slice(),i[1](n(e))):t.ctx}function xg(i,e,t,n){if(i[2]&&n){const l=i[2](n(t));if(e.dirty===void 0)return l;if(typeof l=="object"){const r=[],s=Math.max(e.dirty.length,l.length);for(let o=0;o<s;o+=1)r[o]=e.dirty[o]|l[o];return r}return e.dirty|l}return e.dirty}function e_(i,e,t,n,l,r){if(l){const s=$g(e,t,n,r);i.p(s,l)}}function t_(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 ei(i){return i==null?"":i}function rw(i){return i&&Dl(i.destroy)?i.destroy:Fe}function w(i,e){i.appendChild(e)}function E(i,e,t){i.insertBefore(e,t||null)}function A(i){i.parentNode&&i.parentNode.removeChild(i)}function ct(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 sw(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function ye(i){return document.createTextNode(i)}function K(){return ye(" ")}function Se(){return ye("")}function le(i,e,t,n){return i.addEventListener(e,t,n),()=>i.removeEventListener(e,t,n)}function Mt(i){return function(e){return e.preventDefault(),i.call(this,e)}}function Ut(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 aw(i){return Array.from(i.childNodes)}function Ne(i,e){e=""+e,i.wholeText!==e&&(i.data=e)}function Of(i,e){i.value=e==null?"":e}function oi(i,e,t,n){t===null?i.style.removeProperty(e):i.style.setProperty(e,t,n?"important":"")}function bi(i,e,t){i.classList[t?"add":"remove"](e)}function ow(i,e,{bubbles:t=!1,cancelable:n=!1}={}){const l=document.createEvent("CustomEvent");return l.initCustomEvent(i,t,n,e),l}class gr{constructor(e=!1){this.is_svg=!1,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=sw(t.nodeName):this.e=k(t.nodeName),this.t=t,this.c(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.childNodes)}i(e){for(let t=0;t<this.n.length;t+=1)E(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(A)}}let Yr;function Mi(i){Yr=i}function ul(){if(!Yr)throw new Error("Function called outside component initialization");return Yr}function zn(i){ul().$$.before_update.push(i)}function Jt(i){ul().$$.on_mount.push(i)}function ua(i){ul().$$.after_update.push(i)}function Zr(i){ul().$$.on_destroy.push(i)}function Ht(){const i=ul();return(e,t,{cancelable:n=!1}={})=>{const l=i.$$.callbacks[e];if(l){const r=ow(e,t,{cancelable:n});return l.slice().forEach(s=>{s.call(i,r)}),!r.defaultPrevented}return!0}}function jr(i,e){return ul().$$.context.set(i,e),e}function ht(i){return ul().$$.context.get(i)}function Ll(i,e){const t=i.$$.callbacks[e.type];t&&t.slice().forEach(n=>n.call(this,e))}const ar=[],$e=[],xs=[],yo=[],uw=Promise.resolve();let Po=!1;function fw(){Po||(Po=!0,uw.then(Ao))}function No(i){xs.push(i)}function bt(i){yo.push(i)}const ko=new Set;let lr=0;function Ao(){if(lr!==0)return;const i=Yr;do{try{for(;lr<ar.length;){const e=ar[lr];lr++,Mi(e),cw(e.$$)}}catch(e){throw ar.length=0,lr=0,e}for(Mi(null),ar.length=0,lr=0;$e.length;)$e.pop()();for(let e=0;e<xs.length;e+=1){const t=xs[e];ko.has(t)||(ko.add(t),t())}xs.length=0}while(ar.length);for(;yo.length;)yo.pop()();Po=!1,ko.clear(),Mi(i)}function cw(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(No)}}const ea=new Set;let Al;function Le(){Al={r:0,c:[],p:Al}}function Ae(){Al.r||Ze(Al.c),Al=Al.p}function U(i,e){i&&i.i&&(ea.delete(i),i.i(e))}function q(i,e,t,n){if(i&&i.o){if(ea.has(i))return;ea.add(i),Al.c.push(()=>{ea.delete(i),n&&(t&&i.d(1),n())}),i.o(e)}else n&&n()}function na(i,e){const t=e.token={};function n(l,r,s,o){if(e.token!==t)return;e.resolved=o;let c=e.ctx;s!==void 0&&(c=c.slice(),c[s]=o);const g=l&&(e.current=l)(c);let h=!1;e.block&&(e.blocks?e.blocks.forEach((_,p)=>{p!==r&&_&&(Le(),q(_,1,1,()=>{e.blocks[p]===_&&(e.blocks[p]=null)}),Ae())}):e.block.d(1),g.c(),U(g,1),g.m(e.mount(),e.anchor),h=!0),e.block=g,e.blocks&&(e.blocks[r]=g),h&&Ao()}if(iw(i)){const l=ul();if(i.then(r=>{Mi(l),n(e.then,1,e.value,r),Mi(null)},r=>{if(Mi(l),n(e.catch,2,e.error,r),Mi(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 n_(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)}const Fi=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function vt(i,e,t){const n=i.$$.props[e];n!==void 0&&(i.$$.bound[n]=t,t(i.$$.ctx[n]))}function Ke(i){i&&i.c()}function Ge(i,e,t,n){const{fragment:l,after_update:r}=i.$$;l&&l.m(e,t),n||No(()=>{const s=i.$$.on_mount.map(Zg).filter(Dl);i.$$.on_destroy?i.$$.on_destroy.push(...s):Ze(s),i.$$.on_mount=[]}),r.forEach(No)}function qe(i,e){const t=i.$$;t.fragment!==null&&(Ze(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function dw(i,e){i.$$.dirty[0]===-1&&(ar.push(i),fw(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function At(i,e,t,n,l,r,s,o=[-1]){const c=Yr;Mi(i);const g=i.$$={fragment:null,ctx:[],props:r,update:Fe,not_equal:l,bound:Mf(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:Mf(),dirty:o,skip_bound:!1,root:e.target||c.$$.root};s&&s(g.root);let h=!1;if(g.ctx=t?t(i,e.props||{},(_,p,...b)=>{const v=b.length?b[0]:p;return g.ctx&&l(g.ctx[_],g.ctx[_]=v)&&(!g.skip_bound&&g.bound[_]&&g.bound[_](v),h&&dw(i,_)),p}):[],g.update(),h=!0,Ze(g.before_update),g.fragment=n?n(g.ctx):!1,e.target){if(e.hydrate){const _=aw(e.target);g.fragment&&g.fragment.l(_),_.forEach(A)}else g.fragment&&g.fragment.c();e.intro&&U(i.$$.fragment),Ge(i,e.target,e.anchor,e.customElement),Ao()}Mi(c)}class Et{$destroy(){qe(this,1),this.$destroy=Fe}$on(e,t){if(!Dl(t))return Fe;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&&!lw(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}class hw{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),ne.isPromise(e)?e:this.wrapAsPromise(e)}getConfigValueFromObjectAsync(e,t,...n){let l=ne.getConfigValueFromObject(e,t);return ne.isFunction(l)?this.applyFunctionPromisified(l,n):this.wrapAsPromise(l)}}const ia=new hw;class gw{convertCustomMessageInternalToUser(e){return e.data}convertCustomMessageUserToInternal(e){return{msg:"custom",data:e}}}const la=new gw;class _w{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 Wn=new _w;class pw{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()=>{Yw.luigiAfterInit(),await this.executeConfigFnAsync("lifecycleHooks.luigiAfterInit")}))}getConfig(){return this.config}configChanged(...e){const t=on.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),ui.getLuigiContainer().appendChild(n)}getConfigValue(e){return ne.getConfigValueFromObject(this.getConfig(),e)}getConfigBooleanValue(e){const t=ne.getConfigValueFromObject(this.getConfig(),e);return t===!0||t==="true"}getConfigValueAsync(e,...t){return ia.getConfigValueFromObjectAsync(this.getConfig(),e,t)}async executeConfigFnAsync(e,t=!1,...n){const l=this.getConfigValue(e);if(ne.isFunction(l))try{return await ia.applyFunctionPromisified(l,n)}catch(r){if(t)return Promise.reject(r)}return Promise.resolve(void 0)}isAuthorizationEnabled(){return vi.isAuthorizationEnabled()}unload(){this.initialized=!1,nn.unload(),An.removeAllEventListeners();const e=ui.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&&ne.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&&ne.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(){Wn.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)}}const ra=new pw;class mw{constructor(){}isAuthorizationEnabled(){return!!ie.getConfigValue("auth.use")}login(){this.isAuthorizationEnabled()&&nn.startAuthorization()}logout(){this.isAuthorizationEnabled()&&nn.logout()}async handleAuthEvent(e,t,n,l){const r=await ie.executeConfigFnAsync("auth.events."+e,!1,t,n);let s=r===void 0||!!r;if(s&&l){window.location.href=l;return}return s}get store(){return ie.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:()=>ai.getStorageKey(),getStorageType:()=>ai.getStorageType(),getAuthData:()=>ai.getAuthData(),setAuthData:e=>ai.setAuthData(e),removeAuthData:()=>ai.removeAuthData(),setNewlyAuthorized:()=>ai.setNewlyAuthorized()}}}const i_=new mw,$t={desktopMinWidth:600},bw=[{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"}],vw={cssSelector:"[luigi-app-root]"},ww={cssSelector:"[luigi-app-loading-indicator]"};class Sw{getLuigiContainer(){return this.getCustomLuigiContainer()||this.getDefaultLuigiContainer()}isCustomLuigiContainer(){return Boolean(this.getLuigiContainer()===this.getCustomLuigiContainer())}getCustomLuigiContainer(){return document.querySelector(vw.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 Ie.getMicrofrontendsInDom()}getMicrofrontendIframes(){return Ie.getMicrofrontendIframes()}getCurrentMicrofrontendIframe(){return Ie.getCurrentMicrofrontendIframe()}getNavFooterContainer(){return document.getElementsByClassName("lui-side-nav__footer")[0]}}const l_=new Sw;class kw{constructor(){this.promises={}}setPromise(e,t){this.promises[e]=t}getPromise(e){return this.promises[e]}}class xn extends kw{constructor(e){super(),Object.assign(this,e),this.options={preserveView:!1,nodeParams:{},errorSkipNavigation:!1,fromContext:null,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 s=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=ne.createRemotePromise(),c={msg:"luigi.navigation.open",params:Object.assign(this.options,{link:e,relative:s,modal:n,splitView:l,drawer:r}),remotePromiseId:o.id};return this.sendPostMessageToLuigiCore(c),o}openAsModal(e,t={},n){if(ne.isFunction(n)){const l=ne.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}fromVirtualTreeRoot(){return this.options.fromContext=null,this.options.fromClosestContext=!1,this.options.fromVirtualTreeRoot=!0,this}withParams(e){return e&&Object.assign(this.options.nodeParams,e),this}pathExists(e){if(ne.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)})}sendPostMessageToLuigiCore(e){window.postMessage(e,"*")}}class Cw{constructor(){}updateTopNavigation(){window.postMessage({msg:"luigi.navigation.update-badge-counters"},"*")}navigate(e,t,n,l,r){return new xn().navigate(e,t,n,l,r)}openAsModal(e,t,n){return new xn().openAsModal(e,t,n)}openAsSplitView(e,t={}){if(e==="/"){console.warn("Navigation with an absolute path prevented.");return}return new xn().openAsSplitView(e,t)}openAsDrawer(e,t){return new xn().openAsDrawer(e,t)}fromContext(e){return new xn().fromContext(e)}fromClosestContext(){return new xn().fromClosestContext()}fromVirtualTreeRoot(){return new xn().fromVirtualTreeRoot()}withParams(e){return new xn().withParams(e)}pathExists(e){return new xn().pathExists(e)}hasBack(){return new xn().hasBack()}goBack(e){return new xn().goBack(e)}}const r_=new Cw,yw={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"}}},Pw=yw;class Nw{constructor(){this.currentLocaleStorageKey="luigi.currentLocale",this.defaultLocale="en",this.translationTable=Pw,this.listeners={}}_init(){on.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(ne.isFunction(e)){const t=ne.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)}),ra.configChanged()}_initCustomImplementation(){this.translationImpl=ra.getConfigValue("settings.customTranslationImplementation"),ne.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 s=l[r];if(t.hasOwnProperty(s)&&typeof t[s]=="object")t=t[s];else return n?this.findInterpolations(t[s],n):t[s]}}findInterpolations(e,t){return Object.keys(t).forEach(n=>{e=e.replace(new RegExp("{"+hr.escapeKeyForRegexp(n)+"}","gi"),t[n])}),e}}const s_=new Nw;class Iw{sendToAll(e){const t=la.convertCustomMessageUserToInternal(e);Ie.getMicrofrontendsInDom().map(n=>n.container).map(n=>Ie.sendMessageToIframe(n,t))}send(e,t){const n=la.convertCustomMessageUserToInternal(t);Ie.getMicrofrontendsInDom().filter(l=>l.id===e).map(l=>l.container).map(l=>Ie.sendMessageToIframe(l,n))}}const Tw=new Iw,rr=[];function Lw(i,e){return{subscribe:cr(i,e).subscribe}}function cr(i,e=Fe){let t;const n=new Set;function l(o){if(Tt(i,o)&&(i=o,t)){const c=!rr.length;for(const g of n)g[1](),rr.push(g,i);if(c){for(let g=0;g<rr.length;g+=2)rr[g][0](rr[g+1]);rr.length=0}}}function r(o){l(o(i))}function s(o,c=Fe){const g=[o,c];return n.add(g),n.size===1&&(t=e(l)||Fe),o(i),()=>{n.delete(g),n.size===0&&(t(),t=null)}}return{set:l,update:r,subscribe:s}}class Aw{initial(){this.responsiveNavSetting=ie.getConfigValue("settings.responsiveNavigation");const e=this.responsiveNavSetting==="semiCollapsible"||this.responsiveNavSetting==="Fiori3";JSON.parse(localStorage.getItem(ke.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<$t.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<$t.desktopMinWidth&&this.previousWindowWidth>=$t.desktopMinWidth,n=window.innerWidth!==0&&window.innerWidth>$t.desktopMinWidth&&this.previousWindowWidth>=$t.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(ke.COL_NAV_KEY,e),this.valueChangedFns instanceof Array&&this.valueChangedFns.forEach(n=>n({isSemiCollapsed:this.isSemiCollapsed}))}isStoredCollapsed(){return JSON.parse(localStorage.getItem(ke.COL_NAV_KEY))}getCollapsed(){return this.isStoredCollapsed()?!0:this.isSemiCollapsed}closePopupMenu(e){return e&&(e=null,document.getElementsByClassName("fd-app__sidebar")[0].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].setAttribute("style","overflow-y:hidden;"),window.setTimeout(function(){document.getElementsByClassName("lui-fd-side-nav-wrapper")[0].setAttribute("style","overflow-y:auto;")})),this.isSemiCollapsed}}const mi=new Aw;class Ew{constructor(){this.documentTitle=cr()}hideAppLoadingIndicator(){const e=document.querySelector(ww.cssSelector);e&&(e.classList.add("hidden"),setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e)},500))}showAlert(e){if(ne.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(ne.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 rl(this.documentTitle)}collapseLeftSideNav(e){mi.setCollapsed(e)}openUserSettings(){Luigi.openUserSettings()}closeUserSettings(){Luigi.closeUserSettings()}removeBackdrop(){new xn().sendPostMessageToLuigiCore({msg:"luigi.remove-backdrop"})}getDirtyStatus(){return Luigi.getDirtyStatus()}}const a_=new Ew;class Rw{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 o_=new Rw;class Dw{constructor(){this.currentTheme}async getAvailableThemes(){return await ie.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=ie.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!!ie.getConfigValue("settings.theming")}async getCSSVariables(){if(!window.Luigi.__cssVars){const e=ie.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){ne.isFunction(ie.getConfigValue("settings.theming.variables.errorHandling"))?ie.getConfigValue("settings.theming.variables.errorHandling")(t):console.error("CSS variables file error: ",t)}else ie.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=ie.getConfigValue("settings.theming");t&&t.nodeViewURLDecorator&&t.nodeViewURLDecorator.queryStringParameter&&Qr.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")};on.doOnStoreChange(window.Luigi._store,()=>{e()},["settings.theming"])}}const u_=new Dw;class Vw{constructor(){this.featureToggleList=cr([])}setFeatureToggle(e,t=!1){!this.isValid(e)||e.startsWith("!")&&!t||this.isDuplicatedOrDisabled(e)||rl(this.featureToggleList).push(e)}unsetFeatureToggle(e){if(!this.isValid(e))return;const t=rl(this.featureToggleList).indexOf(e);if(t===-1){console.warn("Feature toggle name is not in the list.");return}rl(this.featureToggleList).splice(t,1)}getActiveFeatureToggleList(){return[...rl(this.featureToggleList)].filter(e=>!e.startsWith("!"))}isValid(e){return ne.isString(e)?!0:(console.warn("Feature toggle name is not valid or not of type 'string'"),!1)}isDuplicatedOrDisabled(e){return rl(this.featureToggleList).includes(e)?(console.warn("Feature toggle name already exists"),!0):rl(this.featureToggleList).includes(`!${e}`)?(console.warn("Disabled feature toggle can not be activated"),!0):!1}}const f_=new Vw;class Mw{constructor(){}getSearchParams(){const e={},t=new URL(location);if(ie.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(!ne.isObject(e)){console.log("Params argument must be an object");return}const n=new URL(location);ie.getConfigValue("routing.useHashRouting")?n.hash=me.addParamsOnHashRouting(e,n.hash):me.modifySearchParams(e,n.searchParams),this.handleBrowserHistory(t,n),ie.configChanged()}addNodeParams(e,t){if(!ne.isObject(e)){console.log("Params argument must be an object");return}const n=me.getContentViewParamPrefix(),l=new URL(location);ie.getConfigValue("routing.useHashRouting")?l.hash=me.addParamsOnHashRouting(e,l.hash,n):me.modifySearchParams(e,l.searchParams,n),this.handleBrowserHistory(t,l),ie.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 ie.getConfigValue("routing.useHashRouting")&&e.split("#").length===2?"":e.split("#").pop()}setAnchor(e){if(ie.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 c_=new Mw,ie=ra,vi=i_,ui=l_,d_=r_,pt=s_,Xr=a_,Ow=o_,Io=u_,Eo=f_,sl=c_;window.Luigi=ra;window.Luigi.auth=()=>i_;window.Luigi.elements=()=>l_;window.Luigi.navigation=()=>r_;window.Luigi.i18n=()=>s_;window.Luigi.customMessages=()=>Tw;window.Luigi.ux=()=>a_;window.Luigi.globalSearch=()=>o_;window.Luigi.theming=()=>u_;window.Luigi.featureToggles=()=>f_;window.Luigi.routing=()=>c_;class Fw{constructor(){this.iframeNavFallbackTimeout=2e3,this.timeoutHandle}getActiveIframe(e){return[...e.children].filter(n=>n.tagName==="IFRAME").find(ne.isElementVisible)}setActiveIframeToPrevious(e){const t=Ie.getMainIframes(),n=this.getPreservedViewsInDom(t);if(n.length===0)return;const l=this.getActiveIframe(e);Ie.hideElementChildren(e),l&&e.removeChild(l),n[0].pv=void 0,n[0].style.display="block"}removeInactiveIframes(e){Array.from(e.children).forEach(n=>{!ne.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)}getAllViewGroupSettings(){return ie.getConfigValue("navigation.viewGroupSettings")}getViewGroupSettings(e){const t=this.getAllViewGroupSettings();return e&&t&&t[e]?t[e]:{}}canCache(e){const t=this.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:pt.getCurrentLocale()})};Ie.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=this.getViewGroupSettings(o.vg);if(c&&this.notifyInactiveIframes(),o.style.display="none",c.preloadUrl){const g={msg:"luigi.navigate",viewUrl:c.preloadUrl,context:JSON.stringify({}),nodeParams:JSON.stringify({}),pathParams:JSON.stringify({}),internal:JSON.stringify({currentLocale:pt.getCurrentLocale()})};Ie.sendMessageToIframe(o,g)}}o===t&&(r=!0)}),t&&(t.style.display="block",r||e.insertBefore(t,e.firstChild))}return t}setOkResponseHandler(e,t,n){this.timeoutHandle=setTimeout(async()=>{e.navigateOk?e.navigateOk=void 0:(Ie.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)):ke.handleUnresponsiveClient(e))},e.timeout)}initHandshakeFailed(e){if(!(e&&e.iframe&&e.iframe.luigi))return!0;const t=e.iframe.luigi.clientVersion;return e.iframe.luigi.initOk===void 0?!0:!t||ne.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 s=Ie.isSameViewGroup(e,t),o=this.hasIsolatedView(l.previousNodeValues.isolateView,s,e.isolateAllViews),c=this.hasIsolatedView(l.isolateView,s,e.isolateAllViews),g=Ie.canReuseIframe(e,t);let h=this.getActiveIframe(n);const _=Ie.getMainIframes(),p=this.getPreservedViewsInDom(_);let b,v=!1;if(p.length>0&&(b=p.shift(),b===h&&(v=!0,h=void 0,e.iframe=void 0)),!v&&!t.get().isNavigateBack){h&&o&&(h=this.switchActiveIframe(n,void 0,!0)),h&&c&&(h=this.switchActiveIframe(n,void 0,!h.vg));let S;if(!c&&l.viewGroup){const C=Ie.getMainIframes().filter(N=>N.vg===l.viewGroup);C.length>0&&(S=C[0],h=this.switchActiveIframe(n,S,h&&!h.vg))}h&&!S&&(h.vg?h=this.switchActiveIframe(n,void 0,!1):g||(h=this.switchActiveIframe(n,void 0,!0))),e.iframe=h}if(!e.iframe||this.initHandshakeFailed(e)){if(e.iframe&&n.removeChild(e.iframe),v?(this.notifyInactiveIframes(),Ie.hideElementChildren(n)):Ie.removeElementChildren(n),l.viewUrl){ne.getConfigValueFromObject(l,"currentNode.loadingIndicator.enabled")!==!1?t.set({showLoadingIndicator:!0}):t.set({showLoadingIndicator:!1}),e.navigateOk=void 0;const S=l.viewGroup&&!c&&this.canCache(l.viewGroup);e.iframe=Ie.createIframe(r,S?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 C=["init",JSON.stringify(l.context)];Ie.sendMessageToIframe(e.iframe,C)}):e.iframe.addEventListener("load",()=>{e.iframe._ready=!0});const y=l.currentNode.pageErrorHandler;y?this.checkIframe(y,t,r,e,n):e.defaultPageErrorHandler&&this.checkIframe(e.defaultPageErrorHandler,t,r,e,n)}}else{t.set({showLoadingIndicator:!1});const S=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 y=await t.prepareInternalData(e),C={msg:"luigi.navigate",viewUrl:r,context:JSON.stringify(Object.assign({},l.context,{goBackContext:S})),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(y)};l.isNavigationSyncEnabled?(Ie.getVisibleIframes().forEach(I=>{I!==e.iframe&&(I.userSettingsGroup?Luigi.readUserSettings().then(D=>{Ie.sendMessageToIframe(I,{msg:"luigi.navigate",context:{userSettingsData:D[I.userSettingsGroup]},internal:Ie.applyCoreStateData(I.luigi._lastUpdatedMessage.internal)})}):Ie.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:Ie.applyCoreStateData(I.luigi._lastUpdatedMessage.internal)}))}),Ie.sendMessageToIframe(e.iframe,C),this.setOkResponseHandler(e,t,n)):t.set({isNavigationSyncEnabled:!0}),t.set({goBackContext:void 0,isNavigateBack:!1})}}}const Ln=new Fw;class Uw{constructor(){this.preloadBatchSize=1,this.shouldPreload=!1}preloadViewGroups(e=3,t){if(ie.getConfigValue("navigation.preloadViewGroups")===!1)return;const l=Ln.getAllViewGroupSettings();if(!l)return;const r=Ie.getIframeContainer(),s=Ie.getMainIframes(),o=new Date().getTime();if(s.filter(_=>_.luigi&&_.luigi.preloading&&o-_.luigi.createdAt<3e4).length>0){console.debug("skipping view group preloading (busy)");return}const g=s.map(_=>_.vg).filter(Boolean),h=Object.entries(l).filter(([_,p])=>!g.includes(_)).filter(([_,p])=>p&&p.preloadUrl);t&&h.forEach(([_,p])=>{p.loadOnStartup&&this.preloadIframeOnBackground(p,_,r)}),!t&&h.filter((_,p)=>p<e).forEach(([_,p])=>{console.debug("preloading view group "+_+" - "+p.preloadUrl),this.preloadIframeOnBackground(p,_,r)})}preloadIframeOnBackground(e,t,n){const l=Ie.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 sr=new Uw;class Bw{async getNavigationPath(e,t=""){try{const n=ne.getTrimmedUrl(t);if(!e)return console.error("No navigation nodes provided in the configuration."),[{}];let l;if(Wn.hasRootNode()&&(l=Wn.getRootNode().node),!l){const g=await e;ne.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),Wn.setRootNode(l)}const r=n.split("/"),s=await this.buildNode(r,[l],l.children,l.context||{}),o=s.navigationPath.filter(g=>g.pathSegment).map(g=>g.pathSegment);s.isExistingRoute=!n||r.length===o.length;const c=n.split("/");return s.matchedPath=c.filter((g,h)=>o[h]&&o[h].startsWith(":")||o[h]===g).join("/"),s}catch(n){console.error("Failed to load top navigation nodes.",n)}}async getChildren(e,t){if(!e)return[];let n=[];if(Wn.hasChildren(e)){let r=Wn.getChildren(e);r&&(n=r.children)}else try{n=await ia.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 Wn.setChildren(e,{children:n,filteredChildren:l}),l}async getFilteredChildren(e){return Wn.hasChildren(e)?Vt.getChildrenFromCache(e):await Vt.getChildren(e)}getChildrenFromCache(e){let t=Wn.getChildren(e);return t?t.filteredChildren:[]}getAccessibleNodes(e,t,n){return t?t.filter(l=>ke.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,s)=>{const o=r.shift();let c={};return r.length?(c.pathSegment=o,s.hideFromNav&&(c.hideFromNav=s.hideFromNav),c.children=[l(r,s)]):(c=n,c.pathSegment=o),c};return l(t,e)}return e}async buildNode(e,t,n,l,r={}){l.parentNavigationContexts||(l.parentNavigationContexts=[]);let s={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 g=ke.applyContext(l,c.context,c.navigationContext);c.pathSegment.startsWith(":")&&(r[c.pathSegment.replace(":","")]=hr.sanitizeParam(o)),g=me.substituteDynamicParamsInObject(g,r);try{this.buildVirtualTree(c,e,r);let h=await this.getChildren(c,g);const _=e.slice(1);s=this.buildNode(_,t,h,g,r)}catch(h){console.error("Error getting nodes children",h)}}}return s}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,s=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 g=["_*","virtualTree","parent","children","keepSelectedForChildren","navigationContext"],h=ne.removeProperties(e,g);Object.assign(h,{pathSegment:":virtualSegment_"+o,label:":virtualSegment_"+o,viewUrl:ne.trimTrailingSlash(this.buildVirtualViewUrl(s,n,o)),_virtualTree:!0,_virtualPathIndex:o,_virtualViewUrl:s});const _=Array.isArray(e.children)&&e.children.length>0?e.children[0]._virtualTree:!1;e.children&&!_&&console.warn(`Found both virtualTree and children nodes defined on a navigation node.
|
|
1
|
+
function Fe(){}function nw(i,e){for(const t in e)i[t]=e[t];return i}function iw(i){return!!i&&(typeof i=="object"||typeof i=="function")&&typeof i.then=="function"}function Zg(i){return i()}function Mf(){return Object.create(null)}function Ze(i){i.forEach(Zg)}function Dl(i){return typeof i=="function"}function Tt(i,e){return i!=i?e==e:i!==e||i&&typeof i=="object"||typeof i=="function"}let Xs;function lt(i,e){return Xs||(Xs=document.createElement("a")),Xs.href=e,i===Xs.href}function lw(i){return Object.keys(i).length===0}function Lo(i,...e){if(i==null)return Fe;const t=i.subscribe(...e);return t.unsubscribe?()=>t.unsubscribe():t}function rl(i){let e;return Lo(i,t=>e=t)(),e}function ki(i,e,t){i.$$.on_destroy.push(Lo(e,t))}function Xg(i,e,t,n){if(i){const l=$g(i,e,t,n);return i[0](l)}}function $g(i,e,t,n){return i[1]&&n?nw(t.ctx.slice(),i[1](n(e))):t.ctx}function xg(i,e,t,n){if(i[2]&&n){const l=i[2](n(t));if(e.dirty===void 0)return l;if(typeof l=="object"){const r=[],s=Math.max(e.dirty.length,l.length);for(let o=0;o<s;o+=1)r[o]=e.dirty[o]|l[o];return r}return e.dirty|l}return e.dirty}function e_(i,e,t,n,l,r){if(l){const s=$g(e,t,n,r);i.p(s,l)}}function t_(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 ei(i){return i==null?"":i}function rw(i){return i&&Dl(i.destroy)?i.destroy:Fe}function w(i,e){i.appendChild(e)}function E(i,e,t){i.insertBefore(e,t||null)}function A(i){i.parentNode&&i.parentNode.removeChild(i)}function ct(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 sw(i){return document.createElementNS("http://www.w3.org/2000/svg",i)}function ye(i){return document.createTextNode(i)}function K(){return ye(" ")}function Se(){return ye("")}function le(i,e,t,n){return i.addEventListener(e,t,n),()=>i.removeEventListener(e,t,n)}function Mt(i){return function(e){return e.preventDefault(),i.call(this,e)}}function Ut(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 aw(i){return Array.from(i.childNodes)}function Ne(i,e){e=""+e,i.wholeText!==e&&(i.data=e)}function Of(i,e){i.value=e==null?"":e}function oi(i,e,t,n){t===null?i.style.removeProperty(e):i.style.setProperty(e,t,n?"important":"")}function bi(i,e,t){i.classList[t?"add":"remove"](e)}function ow(i,e,{bubbles:t=!1,cancelable:n=!1}={}){const l=document.createEvent("CustomEvent");return l.initCustomEvent(i,t,n,e),l}class gr{constructor(e=!1){this.is_svg=!1,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=sw(t.nodeName):this.e=k(t.nodeName),this.t=t,this.c(e)),this.i(n)}h(e){this.e.innerHTML=e,this.n=Array.from(this.e.childNodes)}i(e){for(let t=0;t<this.n.length;t+=1)E(this.t,this.n[t],e)}p(e){this.d(),this.h(e),this.i(this.a)}d(){this.n.forEach(A)}}let Yr;function Mi(i){Yr=i}function ul(){if(!Yr)throw new Error("Function called outside component initialization");return Yr}function zn(i){ul().$$.before_update.push(i)}function Jt(i){ul().$$.on_mount.push(i)}function ua(i){ul().$$.after_update.push(i)}function Zr(i){ul().$$.on_destroy.push(i)}function Ht(){const i=ul();return(e,t,{cancelable:n=!1}={})=>{const l=i.$$.callbacks[e];if(l){const r=ow(e,t,{cancelable:n});return l.slice().forEach(s=>{s.call(i,r)}),!r.defaultPrevented}return!0}}function jr(i,e){return ul().$$.context.set(i,e),e}function ht(i){return ul().$$.context.get(i)}function Ll(i,e){const t=i.$$.callbacks[e.type];t&&t.slice().forEach(n=>n.call(this,e))}const ar=[],$e=[],xs=[],yo=[],uw=Promise.resolve();let Po=!1;function fw(){Po||(Po=!0,uw.then(Ao))}function No(i){xs.push(i)}function bt(i){yo.push(i)}const ko=new Set;let lr=0;function Ao(){if(lr!==0)return;const i=Yr;do{try{for(;lr<ar.length;){const e=ar[lr];lr++,Mi(e),cw(e.$$)}}catch(e){throw ar.length=0,lr=0,e}for(Mi(null),ar.length=0,lr=0;$e.length;)$e.pop()();for(let e=0;e<xs.length;e+=1){const t=xs[e];ko.has(t)||(ko.add(t),t())}xs.length=0}while(ar.length);for(;yo.length;)yo.pop()();Po=!1,ko.clear(),Mi(i)}function cw(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(No)}}const ea=new Set;let Al;function Le(){Al={r:0,c:[],p:Al}}function Ae(){Al.r||Ze(Al.c),Al=Al.p}function U(i,e){i&&i.i&&(ea.delete(i),i.i(e))}function q(i,e,t,n){if(i&&i.o){if(ea.has(i))return;ea.add(i),Al.c.push(()=>{ea.delete(i),n&&(t&&i.d(1),n())}),i.o(e)}else n&&n()}function na(i,e){const t=e.token={};function n(l,r,s,o){if(e.token!==t)return;e.resolved=o;let c=e.ctx;s!==void 0&&(c=c.slice(),c[s]=o);const g=l&&(e.current=l)(c);let h=!1;e.block&&(e.blocks?e.blocks.forEach((_,p)=>{p!==r&&_&&(Le(),q(_,1,1,()=>{e.blocks[p]===_&&(e.blocks[p]=null)}),Ae())}):e.block.d(1),g.c(),U(g,1),g.m(e.mount(),e.anchor),h=!0),e.block=g,e.blocks&&(e.blocks[r]=g),h&&Ao()}if(iw(i)){const l=ul();if(i.then(r=>{Mi(l),n(e.then,1,e.value,r),Mi(null)},r=>{if(Mi(l),n(e.catch,2,e.error,r),Mi(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 n_(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)}const Fi=typeof window<"u"?window:typeof globalThis<"u"?globalThis:global;function vt(i,e,t){const n=i.$$.props[e];n!==void 0&&(i.$$.bound[n]=t,t(i.$$.ctx[n]))}function Ke(i){i&&i.c()}function Ge(i,e,t,n){const{fragment:l,after_update:r}=i.$$;l&&l.m(e,t),n||No(()=>{const s=i.$$.on_mount.map(Zg).filter(Dl);i.$$.on_destroy?i.$$.on_destroy.push(...s):Ze(s),i.$$.on_mount=[]}),r.forEach(No)}function qe(i,e){const t=i.$$;t.fragment!==null&&(Ze(t.on_destroy),t.fragment&&t.fragment.d(e),t.on_destroy=t.fragment=null,t.ctx=[])}function dw(i,e){i.$$.dirty[0]===-1&&(ar.push(i),fw(),i.$$.dirty.fill(0)),i.$$.dirty[e/31|0]|=1<<e%31}function At(i,e,t,n,l,r,s,o=[-1]){const c=Yr;Mi(i);const g=i.$$={fragment:null,ctx:[],props:r,update:Fe,not_equal:l,bound:Mf(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(c?c.$$.context:[])),callbacks:Mf(),dirty:o,skip_bound:!1,root:e.target||c.$$.root};s&&s(g.root);let h=!1;if(g.ctx=t?t(i,e.props||{},(_,p,...b)=>{const v=b.length?b[0]:p;return g.ctx&&l(g.ctx[_],g.ctx[_]=v)&&(!g.skip_bound&&g.bound[_]&&g.bound[_](v),h&&dw(i,_)),p}):[],g.update(),h=!0,Ze(g.before_update),g.fragment=n?n(g.ctx):!1,e.target){if(e.hydrate){const _=aw(e.target);g.fragment&&g.fragment.l(_),_.forEach(A)}else g.fragment&&g.fragment.c();e.intro&&U(i.$$.fragment),Ge(i,e.target,e.anchor,e.customElement),Ao()}Mi(c)}class Et{$destroy(){qe(this,1),this.$destroy=Fe}$on(e,t){if(!Dl(t))return Fe;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&&!lw(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}class hw{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),ne.isPromise(e)?e:this.wrapAsPromise(e)}getConfigValueFromObjectAsync(e,t,...n){let l=ne.getConfigValueFromObject(e,t);return ne.isFunction(l)?this.applyFunctionPromisified(l,n):this.wrapAsPromise(l)}}const ia=new hw;class gw{convertCustomMessageInternalToUser(e){return e.data}convertCustomMessageUserToInternal(e){return{msg:"custom",data:e}}}const la=new gw;class _w{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 Wn=new _w;class pw{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()=>{Yw.luigiAfterInit(),await this.executeConfigFnAsync("lifecycleHooks.luigiAfterInit")}))}getConfig(){return this.config}configChanged(...e){const t=on.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),ui.getLuigiContainer().appendChild(n)}getConfigValue(e){return ne.getConfigValueFromObject(this.getConfig(),e)}getConfigBooleanValue(e){const t=ne.getConfigValueFromObject(this.getConfig(),e);return t===!0||t==="true"}getConfigValueAsync(e,...t){return ia.getConfigValueFromObjectAsync(this.getConfig(),e,t)}async executeConfigFnAsync(e,t=!1,...n){const l=this.getConfigValue(e);if(ne.isFunction(l))try{return await ia.applyFunctionPromisified(l,n)}catch(r){if(t)return Promise.reject(r)}return Promise.resolve(void 0)}isAuthorizationEnabled(){return vi.isAuthorizationEnabled()}unload(){this.initialized=!1,nn.unload(),An.removeAllEventListeners();const e=ui.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&&ne.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&&ne.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(){Wn.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)||{}}}const ra=new pw;class mw{constructor(){}isAuthorizationEnabled(){return!!ie.getConfigValue("auth.use")}login(){this.isAuthorizationEnabled()&&nn.startAuthorization()}logout(){this.isAuthorizationEnabled()&&nn.logout()}async handleAuthEvent(e,t,n,l){const r=await ie.executeConfigFnAsync("auth.events."+e,!1,t,n);let s=r===void 0||!!r;if(s&&l){window.location.href=l;return}return s}get store(){return ie.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:()=>ai.getStorageKey(),getStorageType:()=>ai.getStorageType(),getAuthData:()=>ai.getAuthData(),setAuthData:e=>ai.setAuthData(e),removeAuthData:()=>ai.removeAuthData(),setNewlyAuthorized:()=>ai.setNewlyAuthorized()}}}const i_=new mw,$t={desktopMinWidth:600},bw=[{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"}],vw={cssSelector:"[luigi-app-root]"},ww={cssSelector:"[luigi-app-loading-indicator]"};class Sw{getLuigiContainer(){return this.getCustomLuigiContainer()||this.getDefaultLuigiContainer()}isCustomLuigiContainer(){return Boolean(this.getLuigiContainer()===this.getCustomLuigiContainer())}getCustomLuigiContainer(){return document.querySelector(vw.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 Ie.getMicrofrontendsInDom()}getMicrofrontendIframes(){return Ie.getMicrofrontendIframes()}getCurrentMicrofrontendIframe(){return Ie.getCurrentMicrofrontendIframe()}getNavFooterContainer(){return document.getElementsByClassName("lui-side-nav__footer")[0]}}const l_=new Sw;class kw{constructor(){this.promises={}}setPromise(e,t){this.promises[e]=t}getPromise(e){return this.promises[e]}}class xn extends kw{constructor(e){super(),Object.assign(this,e),this.options={preserveView:!1,nodeParams:{},errorSkipNavigation:!1,fromContext:null,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 s=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=ne.createRemotePromise(),c={msg:"luigi.navigation.open",params:Object.assign(this.options,{link:e,relative:s,modal:n,splitView:l,drawer:r}),remotePromiseId:o.id};return this.sendPostMessageToLuigiCore(c),o}openAsModal(e,t={},n){if(ne.isFunction(n)){const l=ne.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}fromVirtualTreeRoot(){return this.options.fromContext=null,this.options.fromClosestContext=!1,this.options.fromVirtualTreeRoot=!0,this}withParams(e){return e&&Object.assign(this.options.nodeParams,e),this}pathExists(e){if(ne.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)})}sendPostMessageToLuigiCore(e){window.postMessage(e,"*")}}class Cw{constructor(){}updateTopNavigation(){window.postMessage({msg:"luigi.navigation.update-badge-counters"},"*")}navigate(e,t,n,l,r){return new xn().navigate(e,t,n,l,r)}openAsModal(e,t,n){return new xn().openAsModal(e,t,n)}openAsSplitView(e,t={}){if(e==="/"){console.warn("Navigation with an absolute path prevented.");return}return new xn().openAsSplitView(e,t)}openAsDrawer(e,t){return new xn().openAsDrawer(e,t)}fromContext(e){return new xn().fromContext(e)}fromClosestContext(){return new xn().fromClosestContext()}fromVirtualTreeRoot(){return new xn().fromVirtualTreeRoot()}withParams(e){return new xn().withParams(e)}pathExists(e){return new xn().pathExists(e)}hasBack(){return new xn().hasBack()}goBack(e){return new xn().goBack(e)}}const r_=new Cw,yw={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"}}},Pw=yw;class Nw{constructor(){this.currentLocaleStorageKey="luigi.currentLocale",this.defaultLocale="en",this.translationTable=Pw,this.listeners={}}_init(){on.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(ne.isFunction(e)){const t=ne.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)}),ra.configChanged()}_initCustomImplementation(){this.translationImpl=ra.getConfigValue("settings.customTranslationImplementation"),ne.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 s=l[r];if(t.hasOwnProperty(s)&&typeof t[s]=="object")t=t[s];else return n?this.findInterpolations(t[s],n):t[s]}}findInterpolations(e,t){return Object.keys(t).forEach(n=>{e=e.replace(new RegExp("{"+hr.escapeKeyForRegexp(n)+"}","gi"),t[n])}),e}}const s_=new Nw;class Iw{sendToAll(e){const t=la.convertCustomMessageUserToInternal(e);Ie.getMicrofrontendsInDom().map(n=>n.container).map(n=>Ie.sendMessageToIframe(n,t))}send(e,t){const n=la.convertCustomMessageUserToInternal(t);Ie.getMicrofrontendsInDom().filter(l=>l.id===e).map(l=>l.container).map(l=>Ie.sendMessageToIframe(l,n))}}const Tw=new Iw,rr=[];function Lw(i,e){return{subscribe:cr(i,e).subscribe}}function cr(i,e=Fe){let t;const n=new Set;function l(o){if(Tt(i,o)&&(i=o,t)){const c=!rr.length;for(const g of n)g[1](),rr.push(g,i);if(c){for(let g=0;g<rr.length;g+=2)rr[g][0](rr[g+1]);rr.length=0}}}function r(o){l(o(i))}function s(o,c=Fe){const g=[o,c];return n.add(g),n.size===1&&(t=e(l)||Fe),o(i),()=>{n.delete(g),n.size===0&&(t(),t=null)}}return{set:l,update:r,subscribe:s}}class Aw{initial(){this.responsiveNavSetting=ie.getConfigValue("settings.responsiveNavigation");const e=this.responsiveNavSetting==="semiCollapsible"||this.responsiveNavSetting==="Fiori3";JSON.parse(localStorage.getItem(ke.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<$t.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<$t.desktopMinWidth&&this.previousWindowWidth>=$t.desktopMinWidth,n=window.innerWidth!==0&&window.innerWidth>$t.desktopMinWidth&&this.previousWindowWidth>=$t.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(ke.COL_NAV_KEY,e),this.valueChangedFns instanceof Array&&this.valueChangedFns.forEach(n=>n({isSemiCollapsed:this.isSemiCollapsed}))}isStoredCollapsed(){return JSON.parse(localStorage.getItem(ke.COL_NAV_KEY))}getCollapsed(){return this.isStoredCollapsed()?!0:this.isSemiCollapsed}closePopupMenu(e){return e&&(e=null,document.getElementsByClassName("fd-app__sidebar")[0].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].setAttribute("style","overflow-y:hidden;"),window.setTimeout(function(){document.getElementsByClassName("lui-fd-side-nav-wrapper")[0].setAttribute("style","overflow-y:auto;")})),this.isSemiCollapsed}}const mi=new Aw;class Ew{constructor(){this.documentTitle=cr()}hideAppLoadingIndicator(){const e=document.querySelector(ww.cssSelector);e&&(e.classList.add("hidden"),setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e)},500))}showAlert(e){if(ne.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(ne.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 rl(this.documentTitle)}collapseLeftSideNav(e){mi.setCollapsed(e)}openUserSettings(){Luigi.openUserSettings()}closeUserSettings(){Luigi.closeUserSettings()}removeBackdrop(){new xn().sendPostMessageToLuigiCore({msg:"luigi.remove-backdrop"})}getDirtyStatus(){return Luigi.getDirtyStatus()}}const a_=new Ew;class Rw{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 o_=new Rw;class Dw{constructor(){this.currentTheme}async getAvailableThemes(){return await ie.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=ie.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!!ie.getConfigValue("settings.theming")}async getCSSVariables(){if(!window.Luigi.__cssVars){const e=ie.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){ne.isFunction(ie.getConfigValue("settings.theming.variables.errorHandling"))?ie.getConfigValue("settings.theming.variables.errorHandling")(t):console.error("CSS variables file error: ",t)}else ie.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=ie.getConfigValue("settings.theming");t&&t.nodeViewURLDecorator&&t.nodeViewURLDecorator.queryStringParameter&&Qr.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")};on.doOnStoreChange(window.Luigi._store,()=>{e()},["settings.theming"])}}const u_=new Dw;class Vw{constructor(){this.featureToggleList=cr([])}setFeatureToggle(e,t=!1){!this.isValid(e)||e.startsWith("!")&&!t||this.isDuplicatedOrDisabled(e)||rl(this.featureToggleList).push(e)}unsetFeatureToggle(e){if(!this.isValid(e))return;const t=rl(this.featureToggleList).indexOf(e);if(t===-1){console.warn("Feature toggle name is not in the list.");return}rl(this.featureToggleList).splice(t,1)}getActiveFeatureToggleList(){return[...rl(this.featureToggleList)].filter(e=>!e.startsWith("!"))}isValid(e){return ne.isString(e)?!0:(console.warn("Feature toggle name is not valid or not of type 'string'"),!1)}isDuplicatedOrDisabled(e){return rl(this.featureToggleList).includes(e)?(console.warn("Feature toggle name already exists"),!0):rl(this.featureToggleList).includes(`!${e}`)?(console.warn("Disabled feature toggle can not be activated"),!0):!1}}const f_=new Vw;class Mw{constructor(){}getSearchParams(){const e={},t=new URL(location);if(ie.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(!ne.isObject(e)){console.log("Params argument must be an object");return}const n=new URL(location);ie.getConfigValue("routing.useHashRouting")?n.hash=me.addParamsOnHashRouting(e,n.hash):me.modifySearchParams(e,n.searchParams),this.handleBrowserHistory(t,n),ie.configChanged()}addNodeParams(e,t){if(!ne.isObject(e)){console.log("Params argument must be an object");return}const n=me.getContentViewParamPrefix(),l=new URL(location);ie.getConfigValue("routing.useHashRouting")?l.hash=me.addParamsOnHashRouting(e,l.hash,n):me.modifySearchParams(e,l.searchParams,n),this.handleBrowserHistory(t,l),ie.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 ie.getConfigValue("routing.useHashRouting")&&e.split("#").length===2?"":e.split("#").pop()}setAnchor(e){if(ie.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 c_=new Mw,ie=ra,vi=i_,ui=l_,d_=r_,pt=s_,Xr=a_,Ow=o_,Io=u_,Eo=f_,sl=c_;window.Luigi=ra;window.Luigi.auth=()=>i_;window.Luigi.elements=()=>l_;window.Luigi.navigation=()=>r_;window.Luigi.i18n=()=>s_;window.Luigi.customMessages=()=>Tw;window.Luigi.ux=()=>a_;window.Luigi.globalSearch=()=>o_;window.Luigi.theming=()=>u_;window.Luigi.featureToggles=()=>f_;window.Luigi.routing=()=>c_;class Fw{constructor(){this.iframeNavFallbackTimeout=2e3,this.timeoutHandle}getActiveIframe(e){return[...e.children].filter(n=>n.tagName==="IFRAME").find(ne.isElementVisible)}setActiveIframeToPrevious(e){const t=Ie.getMainIframes(),n=this.getPreservedViewsInDom(t);if(n.length===0)return;const l=this.getActiveIframe(e);Ie.hideElementChildren(e),l&&e.removeChild(l),n[0].pv=void 0,n[0].style.display="block"}removeInactiveIframes(e){Array.from(e.children).forEach(n=>{!ne.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)}getAllViewGroupSettings(){return ie.getConfigValue("navigation.viewGroupSettings")}getViewGroupSettings(e){const t=this.getAllViewGroupSettings();return e&&t&&t[e]?t[e]:{}}canCache(e){const t=this.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:pt.getCurrentLocale()})};Ie.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=this.getViewGroupSettings(o.vg);if(c&&this.notifyInactiveIframes(),o.style.display="none",c.preloadUrl){const g={msg:"luigi.navigate",viewUrl:c.preloadUrl,context:JSON.stringify({}),nodeParams:JSON.stringify({}),pathParams:JSON.stringify({}),internal:JSON.stringify({currentLocale:pt.getCurrentLocale()})};Ie.sendMessageToIframe(o,g)}}o===t&&(r=!0)}),t&&(t.style.display="block",r||e.insertBefore(t,e.firstChild))}return t}setOkResponseHandler(e,t,n){this.timeoutHandle=setTimeout(async()=>{e.navigateOk?e.navigateOk=void 0:(Ie.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)):ke.handleUnresponsiveClient(e))},e.timeout)}initHandshakeFailed(e){if(!(e&&e.iframe&&e.iframe.luigi))return!0;const t=e.iframe.luigi.clientVersion;return e.iframe.luigi.initOk===void 0?!0:!t||ne.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 s=Ie.isSameViewGroup(e,t),o=this.hasIsolatedView(l.previousNodeValues.isolateView,s,e.isolateAllViews),c=this.hasIsolatedView(l.isolateView,s,e.isolateAllViews),g=Ie.canReuseIframe(e,t);let h=this.getActiveIframe(n);const _=Ie.getMainIframes(),p=this.getPreservedViewsInDom(_);let b,v=!1;if(p.length>0&&(b=p.shift(),b===h&&(v=!0,h=void 0,e.iframe=void 0)),!v&&!t.get().isNavigateBack){h&&o&&(h=this.switchActiveIframe(n,void 0,!0)),h&&c&&(h=this.switchActiveIframe(n,void 0,!h.vg));let S;if(!c&&l.viewGroup){const C=Ie.getMainIframes().filter(N=>N.vg===l.viewGroup);C.length>0&&(S=C[0],h=this.switchActiveIframe(n,S,h&&!h.vg))}h&&!S&&(h.vg?h=this.switchActiveIframe(n,void 0,!1):g||(h=this.switchActiveIframe(n,void 0,!0))),e.iframe=h}if(!e.iframe||this.initHandshakeFailed(e)){if(e.iframe&&n.removeChild(e.iframe),v?(this.notifyInactiveIframes(),Ie.hideElementChildren(n)):Ie.removeElementChildren(n),l.viewUrl){ne.getConfigValueFromObject(l,"currentNode.loadingIndicator.enabled")!==!1?t.set({showLoadingIndicator:!0}):t.set({showLoadingIndicator:!1}),e.navigateOk=void 0;const S=l.viewGroup&&!c&&this.canCache(l.viewGroup);e.iframe=Ie.createIframe(r,S?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 C=["init",JSON.stringify(l.context)];Ie.sendMessageToIframe(e.iframe,C)}):e.iframe.addEventListener("load",()=>{e.iframe._ready=!0});const y=l.currentNode.pageErrorHandler;y?this.checkIframe(y,t,r,e,n):e.defaultPageErrorHandler&&this.checkIframe(e.defaultPageErrorHandler,t,r,e,n)}}else{t.set({showLoadingIndicator:!1});const S=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 y=await t.prepareInternalData(e),C={msg:"luigi.navigate",viewUrl:r,context:JSON.stringify(Object.assign({},l.context,{goBackContext:S})),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(y)};l.isNavigationSyncEnabled?(Ie.getVisibleIframes().forEach(I=>{I!==e.iframe&&(I.userSettingsGroup?Luigi.readUserSettings().then(D=>{Ie.sendMessageToIframe(I,{msg:"luigi.navigate",context:{userSettingsData:D[I.userSettingsGroup]},internal:Ie.applyCoreStateData(I.luigi._lastUpdatedMessage.internal)})}):Ie.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:Ie.applyCoreStateData(I.luigi._lastUpdatedMessage.internal)}))}),Ie.sendMessageToIframe(e.iframe,C),this.setOkResponseHandler(e,t,n)):t.set({isNavigationSyncEnabled:!0}),t.set({goBackContext:void 0,isNavigateBack:!1})}}}const Ln=new Fw;class Uw{constructor(){this.preloadBatchSize=1,this.shouldPreload=!1}preloadViewGroups(e=3,t){if(ie.getConfigValue("navigation.preloadViewGroups")===!1)return;const l=Ln.getAllViewGroupSettings();if(!l)return;const r=Ie.getIframeContainer(),s=Ie.getMainIframes(),o=new Date().getTime();if(s.filter(_=>_.luigi&&_.luigi.preloading&&o-_.luigi.createdAt<3e4).length>0){console.debug("skipping view group preloading (busy)");return}const g=s.map(_=>_.vg).filter(Boolean),h=Object.entries(l).filter(([_,p])=>!g.includes(_)).filter(([_,p])=>p&&p.preloadUrl);t&&h.forEach(([_,p])=>{p.loadOnStartup&&this.preloadIframeOnBackground(p,_,r)}),!t&&h.filter((_,p)=>p<e).forEach(([_,p])=>{console.debug("preloading view group "+_+" - "+p.preloadUrl),this.preloadIframeOnBackground(p,_,r)})}preloadIframeOnBackground(e,t,n){const l=Ie.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 sr=new Uw;class Bw{async getNavigationPath(e,t=""){try{const n=ne.getTrimmedUrl(t);if(!e)return console.error("No navigation nodes provided in the configuration."),[{}];let l;if(Wn.hasRootNode()&&(l=Wn.getRootNode().node),!l){const _=await e;ne.isObject(_)?(l=_,l.pathSegment&&(l.pathSegment="",console.warn("Root node must have an empty path segment. Provided path segment will be ignored."))):l={children:_},l.children=await this.getChildren(l),Wn.setRootNode(l)}const r=n.split("/"),o={...ie.getConfigValue("navigation.globalContext")||{},...l.context||{}},c=await this.buildNode(r,[l],l.children,o),g=c.navigationPath.filter(_=>_.pathSegment).map(_=>_.pathSegment);c.isExistingRoute=!n||r.length===g.length;const h=n.split("/");return c.matchedPath=h.filter((_,p)=>g[p]&&g[p].startsWith(":")||g[p]===_).join("/"),c}catch(n){console.error("Failed to load top navigation nodes.",n)}}async getChildren(e,t){if(!e)return[];let n=[];if(Wn.hasChildren(e)){let r=Wn.getChildren(e);r&&(n=r.children)}else try{n=await ia.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 Wn.setChildren(e,{children:n,filteredChildren:l}),l}async getFilteredChildren(e){return Wn.hasChildren(e)?Vt.getChildrenFromCache(e):await Vt.getChildren(e)}getChildrenFromCache(e){let t=Wn.getChildren(e);return t?t.filteredChildren:[]}getAccessibleNodes(e,t,n){return t?t.filter(l=>ke.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,s)=>{const o=r.shift();let c={};return r.length?(c.pathSegment=o,s.hideFromNav&&(c.hideFromNav=s.hideFromNav),c.children=[l(r,s)]):(c=n,c.pathSegment=o),c};return l(t,e)}return e}async buildNode(e,t,n,l,r={}){l.parentNavigationContexts||(l.parentNavigationContexts=[]);let s={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 g=ke.applyContext(l,c.context,c.navigationContext);c.pathSegment.startsWith(":")&&(r[c.pathSegment.replace(":","")]=hr.sanitizeParam(o)),g=me.substituteDynamicParamsInObject(g,r);try{this.buildVirtualTree(c,e,r);let h=await this.getChildren(c,g);const _=e.slice(1);s=this.buildNode(_,t,h,g,r)}catch(h){console.error("Error getting nodes children",h)}}}return s}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,s=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 g=["_*","virtualTree","parent","children","keepSelectedForChildren","navigationContext"],h=ne.removeProperties(e,g);Object.assign(h,{pathSegment:":virtualSegment_"+o,label:":virtualSegment_"+o,viewUrl:ne.trimTrailingSlash(this.buildVirtualViewUrl(s,n,o)),_virtualTree:!0,_virtualPathIndex:o,_virtualViewUrl:s});const _=Array.isArray(e.children)&&e.children.length>0?e.children[0]._virtualTree:!1;e.children&&!_&&console.warn(`Found both virtualTree and children nodes defined on a navigation node.
|
|
2
2
|
Children nodes are redundant and ignored when virtualTree is enabled.
|
|
3
3
|
Please refer to documentation`),e.children=[h]}}findMatchingNode(e,t){let n=null;const l=t.filter(s=>!!s.pathSegment).length,r=t.filter(s=>s.pathSegment&&s.pathSegment.startsWith(":")).length;return e=e.includes("#")?e.split("#").shift():e,l>1&&(r===1&&(console.warn(`Invalid node setup detected.
|
|
4
4
|
Static and dynamic nodes cannot be used together on the same level. Static node gets cleaned up.
|