LWR.define("@salesforce/label/MyCommunities.errorInFileDownload/v/0_10_11",["exports"],function(c){"use strict";var s="MyCommunities.errorInFileDownload";c.default=s,Object.defineProperty(c,"__esModule",{value:!0})}),LWR.define("@salesforce/label/MyCommunities.errorInFileDownload",["exports","@salesforce/label/MyCommunities.errorInFileDownload/v/0_10_11"],function(c,s){c.default=s&&typeof s=="object"&&"default"in s?s.default:s,Object.keys(s).forEach(function(r){r==="default"||c.hasOwnProperty(r)||Object.defineProperty(c,r,{enumerable:!0,get:function(){return s[r]}})})}),LWR.define("mobileruntime/hybridAppManager/v/1",["exports","lwr/loaderLegacy/v/0_10_11","logger/v/1","webruntime/routingService/v/1","@salesforce/site/Id/v/1","webruntime/transport/v/1","lwc/v/3_0_4","@app/basePath/v/1","@app/loginPath/v/1","@app/uiBasePath/v/1","@salesforce/label/MyCommunities.errorInFileDownload/v/0_10_11","webruntime/overrides/v/1"],function(c,s,r,U,F,S,p,j,x,B,V,w){"use strict";function h(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var W=h(F),P=h(j),b=h(x),H=h(B),G=h(V);function q(){if(window.navigator?.userAgent?.includes("android")){const{head:e}=document,t=document.createElement("script");t.src="/localhost/cordova.js",e.appendChild(t)}}function J(){window.native={sendAILTNData:function(e){if(!e?.logLines)return new Promise(function(t,n){n("Received null or invalid payload")})},refreshNotifications:function(){document.dispatchEvent(new CustomEvent("refreshNotifications",{detail:{},bubbles:!0,cancelable:!0,composed:!1}))},navigateTo:function(e){return new Promise(function(t,n){if(!e){n("Received invalid pageReference payload");return}U.generateUrl(e).then(o=>{window.open(new URL(o,window.location.href)),t()},o=>n(o))})}}}const Y=p.parseFragment`<div class="slds-backdrop slds-backdrop_open${0}"${2}></div>`,z={key:0},Q={"slds-modal":!0,"slds-fade-in-open":!0,"slds-modal_large":!0},X={classMap:{"slds-modal__container":!0},key:2},Z={classMap:{"slds-modal__header":!0},key:3},K={"slds-modal__title":!0,"slds-hyphenate":!0},$={"slds-modal__content":!0,"slds-var-p-around_medium":!0},ee={classMap:{"slds-text-align_center":!0,"slds-text-heading_small":!0,"slds-var-p-around_medium":!0},key:6},te={classMap:{"slds-modal__footer":!0},key:7},_={"slds-button":!0,"slds-button_brand":!0},ne={key:9},oe={key:11};function m(e,t,n,o){const{gid:a,d:i,t:l,h:d,b:f,st:u}=e,{_m0:g,_m1:R}=o;return[t.showModal?d("section",z,[d("section",{classMap:Q,attrs:{role:"dialog",tabindex:"-1","aria-labelledby":a("modal-heading-01"),"aria-modal":"true","aria-describedby":a("modal-content-id-1")},key:1},[d("div",X,[d("header",Z,[d("h2",{classMap:K,attrs:{id:a("modal-heading-01")},key:4},[l(i(t.labels.ModalHeader))])]),d("div",{classMap:$,attrs:{id:a("modal-content-id-1")},key:5},[d("div",ee,[l(i(t.modalBody))])]),d("footer",te,[t.config.forceAppUpdate?null:d("button",{classMap:_,key:8,on:{click:g||(o._m0=f(t.remindMeLater))}},[d("label",ne,[l(i(t.labels.RemindMeLater))])]),d("button",{classMap:_,key:10,on:{click:R||(o._m1=f(t.openStore))}},[d("label",oe,[l(i(t.labels.UpdateNow))])])])])]),u(Y(),13)]):null]}var ae=p.registerTemplate(m);m.stylesheets=[],m.stylesheetToken="lwc-2mvql2nutql",m.legacyStylesheetToken="mobileruntime-appUpdateModal_appUpdateModal",p.freezeTemplate(m);const ie={ModalHeader:"Update Your App",ForceUpdateModalBody:"You must update to the latest version of this app to continue using it.",ModalBody:"A new version of this app is available.Find and install the latest version of the app for your device.",RemindMeLater:"Remind Me Later",UpdateNow:"Update Now"};class E extends p.LightningElement{constructor(...t){super(...t);this.showModal=!0,this.config={}}get labels(){return ie}get modalBody(){return this.config.forceAppUpdate?this.labels.ForceUpdateModalBody:this.labels.ModalBody}openStore(){window.open(this.config?.minVersion?.url?.trim())}remindMeLater(){this.showModal=!1}}p.registerDecorators(E,{publicProps:{config:{config:0}},fields:["showModal"]});var re=p.registerComponent(E,{tmpl:ae,sel:"mobileruntime-app-update-modal",apiVersion:59});const se=`/services/data/v57.0/connect/sites/${W.default}/cms/delivery/contents?contentTypeFQN=sfdc_cms__mobilePublisherConfig&includeContentBody=true`;function y(e,t){if(!v()){r.log("Native JS API is not available");return}const{invokeNative:n}=window.mycommunities.nativejsapi;return n(e,t)}function le(e=""){return new RegExp("^([a-z]+://)","i").test(e)}function de(e=""){if(!le(e))return!1;const t=new URL(e),n=window.location.host;return t.host!==n}async function ce(){if(!v()){r.log("Native JS API is not available");return}q();try{const e=await S.fetch(se,{method:"GET"});if(e.status===200){const t=await e.json(),n=window.location.href.endsWith("/")?window.location.href.slice(0,-1):window.location.href,{nativeTabMenu:o={},mobilePublisherAppUpdateConfig:a={}}=t?.contents?.[0]?.contentBody||{};if(o?.menuItems?.forEach((i,l)=>{const{payload:d,name:f,...u}=i;o.menuItems[l]={...u,name:f||" ",id:(l+1)*10,position:l+1,targetUrl:n+i.targetUrl,iconDetails:{...u.iconDetails,mimeType:"image/png",url:`data:image/png;base64,${d}`}}}),a){const{forceAppUpdate:i=!1,enableAppUpdate:l=!1,minVersion:d={}}=a,f=be()?"ios":ye()?"android":"",u={forceAppUpdate:i,enableAppUpdate:l,minVersion:d[f]};ge("forceAppUpdate")?o.appUpdateConfig={enableAppUpdate:l,gracePeriod:i?0:15}:we(u)}L(o)}else r.log("Failed to fetch bottom tab bar. Status is: ",e.status),L(!0)}catch(e){r.log("Failed to fetch bottom tab bar",e),L(!0)}r.log("Initial load done! Splash Screen hidden")}function ue(e,t){const n=new URL(e||"",window.location.origin);e=n.href;const o="/servlet/networks/switch",a=n.pathname,i=a.indexOf("/s/"),l=i===-1?a:a.substring(0,i+2);return[o,encodeURIComponent(o)].some(d=>e.includes(d))||!l.startsWith(t)}function fe(e){if(!e)return null;switch(e.length){case 15:return Le(e);case 18:return e;default:return null}}function pe(){const{cordova:e}=window;return typeof e!="undefined"&&e&&e.require("cordova/channel")&&e.require("cordova/channel").onDeviceReady&&e.require("cordova/channel").onDeviceReady.state===2}function A(){return pe()?window.cordova.require("com.salesforce.plugin.oauth"):null}function he(e){if(!e)return!1;const t="/secur/logout.jsp";return e.includes(t)||e.includes(encodeURIComponent(t))}function me(e){const t=A();t&&t.logout(e)}function C(){r.log("hybrid_app_manager_utils:handle_page_loaded"),J(),v()&&(typeof window.mycommunities.nativejsapi.webAppPageLoadDone=="function"?(r.log("hybrid_app_manager_utils:handle_page_loaded: webAppPageLoadDone function called"),window.mycommunities.nativejsapi.webAppPageLoadDone()):r.log("hybrid_app_manager_utils:handle_page_loaded:webAppPageLoadDone function is not available"))}function L(e){const{webAppBootstrapDone:t}=window.mycommunities.nativejsapi;r.log("Triggering webAppBootstrapDone"),t(e)}function ge(e){return v()?window.mycommunities.nativejsapi.clientFeatures?.[e]?.enabled:!1}function we(e){const t=Ae();if(e.enableAppUpdate&&t){const n=e.minVersion.version;if(ve(t,n)){const a=p.createElement("app-update-modal",{is:re});a.config=e,document.body.appendChild(a)}}}function ve(e,t){let n=e.split("."),o=t.split("."),a=0;for(;n.length<o.length;)n.push("0");for(;o.length<n.length;)o.push("0");n=n.map(Number),o=o.map(Number);for(let i=0;i<n.length;++i)if(n[i]!==o[i])if(n[i]>o[i]){a=1;break}else{a=-1;break}return a===-1}function be(){const e=window?.navigator?.userAgent||"";return e.toLowerCase().includes("iphone")||e.toLowerCase().includes("ipad")}function ye(){return(window?.navigator?.userAgent||"").toLowerCase().includes("android")}function Ae(){const t=(window?.navigator?.userAgent||"").split("CommunityHybridContainer/")[1];return t&&(t.match(/(\d{1,3}\.)?(\d{1,3}\.)?(\d{1,3})/)||[])[0]}function Le(e){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456";for(let o=0;o<3;++o){let a=0;for(let i=0;i<5;i++){const l=e.charAt(o*5+i);l>="A"&&l<="Z"&&(a+=1<<i)}t+=n.charAt(a)}return e+t}function v(){return window?.mycommunities?.nativejsapi}const Me="/secur/frontdoor.jsp";function Re({routeUrl:e}){const t=A();t?t.authenticate(function(n){n&&n.accessToken&&(document.cookie=`sid=${n.accessToken}; path=/; secure=true`,e!=null&&window.open(e))},function(){r.logError("Error in handler Session Timeout. Cordova OAuth Plugin authentication failed.")}):r.logError("Error in handler Session Timeout. OAuth Plugin is not available.")}async function Ue(){let e=!1;const t=await s.load("@app/user/v/1");try{await s.load(`@app/user?c=${crypto.randomUUID()}`,"mobileruntime/hybridAppManager/v/1")}catch(n){e=!t.isGuest}return e}function D(e){const t=new URL(b.default,window.location.href),n=new URL(e,window.location.href);return b.default&&t.pathname===n.pathname&&t.origin===n.origin}function O(e){const t=A();t?t.authenticate(function(n){window.location.href=`${n.loginUrl}${Me}?sid=${n.accessToken}&retURL=${encodeURIComponent(e||H.default)}&display=touch`},function(){throw new Error("Authentication via Cordova OAuth Plugin failed.")}):window.location.href=e||b.default}function Pe(e){if(typeof e=="object"){const{attributes:{url:t}={url:null}}=e;if(D(t)){const n=new URL(t,window.location.href);return O(n.searchParams.get("startURL")),!1}}return!0}async function _e({next:{route:e,data:t}={}}={}){if(t&&t.isPublic!==!1)return!0;const{default:n}=await s.load("@app/user/v/1");if(n.isGuest){const o=await U.generateUrl(e);if(o){const a=new URL(o,window.location.href);return O(a.pathname+a.search+a.hash),!1}}return!0}const Ee=["/sfc/servlet.shepherd","/servlet/servlet.FileDownload","/servlet/fileField","version/renditionDownload"];function M(){r.log("Handle showing of Toast Message for Error case.")}function Ce(e){const t="/sfc/servlet.:type/:contentType/download/:recordId",n=new RegExp(t.replace(/:[^\s/]+/g,"([\\w-]+)")),o=e.match(n);if(o&&o.length===4)return{recordId:o[3]};const a="/servlet/servlet.:type?file=:recordId",i=new RegExp(a.replace(/:[^\s/?]+/g,"([\\w-]+)").replace(/\?/g,"[?]")),l=e.match(i);if(l&&l.length===3)return{recordId:l[2]};const d="/servlet/fileField";if(e.includes(d)){const u=new URLSearchParams(decodeURIComponent(e).split("?")[1]),g=u.get("entityId"),R=u.get("field");return{recordId:g,fieldId:R}}const f="version/renditionDownload";if(e.includes(f)){const g=new URL(e).searchParams.get("versionId");return{recordId:fe(g)}}return null}function De(e){const t=y("downloadFile",e);if(t)return t.catch(n=>{r.log(`Error while downloading file of record id: ${e.recordId} message: ${n}`&&n.message),M()})}function Oe(e){if(!e){r.log(`${G.default}. URL is ${e}`),M();return}const t=Ce(e);if(!t){r.log(`Parsing the file URL "${e}" yielded null`),M();return}return De(t)}function ke(e){return e=e||"",Ee.some(t=>e.indexOf(t)>-1)}const Te=globalThis.open;function k(e){const t=new URL(e,window.location.href);if(e=t.href,e.indexOf("/")!==0&&e.indexOf("http://")!==0&&e.indexOf("https://")!==0)return Te(e,"_self");if(he(e))me(e);else if(de(t))y("navigateToExternalURL",{url:e});else if(D(e))T({type:"standard__webPage",attributes:{url:t.pathname+t.searchParams+t.hash}},!1);else if(ke(e))Oe(e);else if(ue(e,P.default))y("navigateToExternalURL",{url:e});else{const n=t.pathname,o=n==="/"||n===P.default;T({type:"standard__webPage",attributes:{url:n}},o)}}function T(e,t){return document.dispatchEvent(new CustomEvent("notify-client-module",{cancelable:!0,composed:!0,detail:{action:"navigate",data:{routeObj:e,replaceState:t}}}))}function Ne(){Ie()}function Ie(){document.addEventListener("click",Se),document.addEventListener("notify-mobile-module",je)}function Fe({pathMatch:e,route:t,routeDefinition:n}){const{id:o}=t||{},{type:a}=t?.pageReference||{},{isRoot:i}=n?.metadata||{};document.dispatchEvent(new CustomEvent("routeChangeSuccess",{bubbles:!0,composed:!0,detail:{routeType:a,routeId:o,routeUrl:e,backNavigation:{canGoBack:!i}}}))}function Se(e){const t=e.composedPath()[0];if(t.tagName.toLowerCase()==="a")return e.preventDefault(),e.stopPropagation(),k(t.href)}function je({detail:e}){const{action:t,data:n}=e||{action:"",data:null};switch(t){case"navigationcompleted":Fe(n?.routeResult||{});break;default:r.log(`No such ${t} exists in notify-mobile-module event. Please re-check!!`);break}}function xe(){window.open=e=>k(e)}async function N(){return await ce(),/interactive|complete/.test(document.readyState)?C():document.addEventListener("DOMContentLoaded",C,!1),xe(),Ne()}function I(){return Re({routeUrl:window.location.pathname}),!1}w.PreNavigateOverrides.add(e=>_e(e)),w.NavigationOverrides.add(e=>Pe(e)),w.PageNavigationFailureOverrides.add(async({error:e,isPublic:t})=>{const n=await Ue();return e?.constructor?.name==="LoaderError"&&!t&&n?I():!0}),w.SessionTimeoutOverrides.add(()=>I());function Be(e){Object.entries(e).forEach(([t,n])=>{LWR.define(t,[],function(){return n})})}Be({"mobileruntime/hybridAppManager":N}),c.hybridAppManager=N,Object.defineProperty(c,"__esModule",{value:!0})}),LWR.define("mobileruntime/hybridAppManager",["exports","mobileruntime/hybridAppManager/v/1"],function(c,s){c.default=s&&typeof s=="object"&&"default"in s?s.default:s,Object.keys(s).forEach(function(r){r==="default"||c.hasOwnProperty(r)||Object.defineProperty(c,r,{enumerable:!0,get:function(){return s[r]}})})});
|