LWR.define("webruntime/connectApiEndpoint/v/1_66_1084-258_0",["exports","@salesforce/community/Id/v/1"],function(e,t){"use strict";function o(C){return C&&typeof C=="object"&&"default"in C?C:{default:C}}var v=o(t);const h="64.0",c={SEO_PROPERTIES:"seo-properties",SEO_OBJECT_RELATED_URL:"seo-object-related-url"};function p(C,f){const S=f.appVersion||h;switch(C){case c.SEO_PROPERTIES:return`/services/data/v${S}/connect/communities/${v.default}/seo/properties/${f.recordId}`;case c.SEO_OBJECT_RELATED_URL:{const d=encodeURIComponent(f.urlNameOrPath);return`/services/data/v${S}/connect/communities/${v.default}/seo/object-url/${f.scope}/${d}`}default:return null}}e.CONNECT_API_TYPES=c,e.constructApiEndpoint=p,Object.defineProperty(e,"__esModule",{value:!0})}),LWR.define("webruntime/connectApiEndpoint",["exports","webruntime/connectApiEndpoint/v/1_66_1084-258_0"],function(e,t){e.default=t&&typeof t=="object"&&"default"in t?t.default:t,Object.keys(t).forEach(function(o){o==="default"||e.hasOwnProperty(o)||Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[o]}})})}),LWR.define("webruntime/utils/v/1_66_1084-258_0",["exports"],function(e){"use strict";function t(u,A){if(!u)throw new Error(A)}function o(u){return typeof u=="object"&&u!==null&&!Array.isArray(u)}function v(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(u){const A=Math.random()*16|0;return(u==="x"?A:A&3|8).toString(16)})}function h(u){return typeof u=="string"&&/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i.test(u)}const c=new RegExp("^([a-z]+://|//)","i");function p(u){return u?c.test(u):!1}const C=new RegExp("/sfsites/c/.+","i");function f(u){return u?C.test(u):!1}function S(u,A){const P=JSON.stringify(A);if(!(window&&window.navigator&&window.navigator.sendBeacon&&window.navigator.sendBeacon(u,P))){const i=new XMLHttpRequest;i.open("POST",u,!0),i.setRequestHeader("Content-Type","text/plain;charset=UTF-8"),i.send(P)}}function d(u){return document?.querySelector(`meta[name="${u}"]`)?.getAttribute("content")||""}function y(){return d("basePath")}function R(){return d("deployTarget")||"CORE"}e.assert=t,e.getBasePathFromMetaTag=y,e.getDeployTargetFromMetaTag=R,e.isAbsoluteURL=p,e.isObject=o,e.isSfdcCoreURL=f,e.sendPayloadToServer=S,e.uuidValidate=h,e.uuidv4=v,Object.defineProperty(e,"__esModule",{value:!0})}),LWR.define("webruntime/utils",["exports","webruntime/utils/v/1_66_1084-258_0"],function(e,t){e.default=t&&typeof t=="object"&&"default"in t?t.default:t,Object.keys(t).forEach(function(o){o==="default"||e.hasOwnProperty(o)||Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[o]}})})}),LWR.define("webruntime/guestUuidCookieGenerator/v/1_66_1084-258_0",["exports","webruntime/utils/v/1_66_1084-258_0","webruntime/cookieStore/v/1_66_1084-258_0","@app/guestUuidCookieName/v/1"],function(e,t,o,v){"use strict";function h(d){return d&&typeof d=="object"&&"default"in d?d:{default:d}}var c=h(v);const p={guestUuidCookieMaxAge:365*24*60*60},{document:C}=globalThis;function f(d){if(!c.default)return;let y=o.getCookie(c.default)||d;t.uuidValidate(y)||(y=t.uuidv4()),typeof window=="undefined"?o.setCookiesFromObject({...o.getAllCookies(),[c.default]:y}):(C.cookie=`${c.default}=${y};Max-Age=${p.guestUuidCookieMaxAge};SameSite=LAX;Path=/`,o.setCookiesFromString(C.cookie),S())}function S(){const d={name:"set-guest-uuid",guestUuid:o.getCookie(c.default)};C.dispatchEvent(new CustomEvent("experience_interaction",{bubbles:!0,composed:!0,detail:d}))}e.setGuestUuidCookie=f,Object.defineProperty(e,"__esModule",{value:!0})}),LWR.define("webruntime/guestUuidCookieGenerator",["exports","webruntime/guestUuidCookieGenerator/v/1_66_1084-258_0"],function(e,t){e.default=t&&typeof t=="object"&&"default"in t?t.default:t,Object.keys(t).forEach(function(o){o==="default"||e.hasOwnProperty(o)||Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[o]}})})}),LWR.define("webruntime/cookieStore/v/1_66_1084-258_0",["exports","@app/authenticationCookieName/v/1","@app/guestUuidCookieName/v/1","@salesforce/site/Id/v/1"],function(e,t,o,v){"use strict";function h(i){return i&&typeof i=="object"&&"default"in i?i:{default:i}}var c=h(t),p=h(o),C=h(v);let f;function S(i){i&&typeof i=="object"&&(f=i)}function d(i){f=D(i)}function y(){const i=P(c.default);return i?i==="1"||i.includes(C.default):!1}function R(){return P(p.default)}function u(){return f}function A(){return Object.entries(f||{}).map(([i,H])=>`${i}=${H}`).join(";")}function P(i){return i?(typeof document!="undefined"&&d(document?.cookie),f&&f[i]):null}function D(i){return i&&typeof i=="string"?i.split(";").reduce((I,_)=>{const[M,W]=_.trim().split("=").map(decodeURIComponent);return I[M]=W,I},{}):null}e.getAllCookies=u,e.getAllCookiesString=A,e.getCookie=P,e.getGuestUuidCookie=R,e.hasSidCookie=y,e.setCookiesFromObject=S,e.setCookiesFromString=d,Object.defineProperty(e,"__esModule",{value:!0})}),LWR.define("webruntime/cookieStore",["exports","webruntime/cookieStore/v/1_66_1084-258_0"],function(e,t){e.default=t&&typeof t=="object"&&"default"in t?t.default:t,Object.keys(t).forEach(function(o){o==="default"||e.hasOwnProperty(o)||Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[o]}})})}),LWR.define("webruntime/bootstrapHook/v/1_66_1084-258_0",["exports","lwc/v/8_20_6","webruntime/cookieStore/v/1_66_1084-258_0","webruntime/guestUuidCookieGenerator/v/1_66_1084-258_0","webruntime/routingService/v/1_66_1084-258_0","@communities-webruntime/common/v/1_66_1084-258_0","webruntime/transport/v/1_66_1084-258_0","@salesforce/community/Id/v/1","webruntime/connectApiEndpoint/v/1_66_1084-258_0"],function(e,t,o,v,h,c,p,C,f){"use strict";function S(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var d=S(C);async function y({basePath:n,url:r}){const l=h.getLoginUrl(n,r),b={code:302,location:l};if(!o.hasSidCookie())return console.log("[LoginRedirection] Sid cookie not found, redirecting to login."),b;const g=await(await fetch(`${n}/webruntime/module/@app/user?json`)).json(),E=g.isGuest?"Session has expired, redirection to login.":"Session is still valid. No redirection.";return console.log(`[LoginRedirection] ${E}`),g.isGuest?b:null}class R extends Error{constructor(r,l,b){super(r);this.name="LwrStatusError",this.status=l,this.headers=b}}t.registerDecorators(R,{fields:["name"]});class u extends AggregateError{constructor(r,l,b){super(r,l);this.name="DataProviderAggregateError",this.dataProviderFailed=b}}const A=n=>n.status==="rejected",P=n=>n.status==="fulfilled";function D(n){return Object.keys(n||{}).length===0}function i(n,r){const l=typeof r=="string"?r:r.message;throw new Error(`Error in "getServerData" for "${n}"${l?`: ${l}`:""}`,{cause:r})}async function H(n){const{ssrContext:r,dataProviders:l,isPrivate:b,dataSerializers:w,staticTTL:g,dynamicTTL:E,routeMarkup:x}=n,k={...r.query,...r.params},N=[],$=[],L=[];let a;const U=s=>{p.isTooManyRequestsResponse(s)&&(a=new R("Too many requests",429,{"cache-control":c.CACHE_CONTROL_HEADER_NO_CACHE})),p.isDownForMaintenanceResponse(s)&&(a=new R("Down for maintenance",503,{"cache-control":c.CACHE_CONTROL_HEADER_NO_CACHE}))};p.addFetchObserver(U);const G=[];b&&G.push(y(r).then(s=>{s&&(a=new R("Redirect",s.code,{location:s.location||"","cache-control":c.CACHE_CONTROL_HEADER_NO_CACHE}))}).catch(s=>{if(s instanceof Error){const O=`Error in "getServerData" for "getServerLoginRedirect"${s.message?`: ${s.message}`:""}`;throw new Error(O,{cause:s})}})),G.push(...l.map(({preloadData:s,attributes:O,descriptor:m})=>s&&s({...r,attributes:O}).then(F=>({descriptor:m,response:F})).catch(F=>{L.push(m),i(m,F)})).filter(Boolean));const z=await Promise.allSettled(G).finally(()=>p.removeFetchObserver(U));if(a)throw a;const q=z.filter(A).map(({reason:s})=>s);if(q.length>0)throw new u(q,`${q.map(({message:s})=>s)}`,L);const Y=(l.length&&Object.keys(w)||[]).reduce((s,O)=>({...s,[O]:w[O]()}),{}),j={...x};let B=[],V=parseInt(E,10);z.filter(P).forEach(({value:s})=>{const{descriptor:O,response:m}=s??{};if(m?.markup)for(const T in m.markup)T==="title"?j[T]=m.markup.title||j[T]:Array.isArray(j[T])?j[T].includes(m.markup[T])||j[T].push(...m.markup[T]):j[T]=[...m.markup[T]];m?.warnings&&m.warnings.length>0?(B=[...B,...m.warnings],$.push(O)):O&&N.push(O);const X=parseInt(m?.cache?.ttl,10);isNaN(X)||(V=Math.min(V,X))});const Z=l.every(({isStatic:s,preloadData:O})=>s||!O)||Object.values(Y).every(({data:s}={})=>D(s))?g:Math.min(parseInt(E,10),V).toString(),ee={dataProvider:{success:N,warnings:$}};return{props:{url:r.url,routeParams:k,guestUuid:o.getGuestUuidCookie(),initialData:Y,metrics:ee},markup:j,cache:{ttl:Z},warnings:B}}async function I(n,r,l,b){if(!n||!r||!l||!b)return console.error(`[getRecordIdRedirect] one or more params are not defined - routeParams:${JSON.stringify(n)} appVersion:${r} communityId:${l} scope:${b}`),null;const w=f.constructApiEndpoint(f.CONNECT_API_TYPES.SEO_OBJECT_RELATED_URL,{appVersion:r,scope:b,urlNameOrPath:n.urlName||n.urlPath});if(console.log(`[getRecordIdRedirect] START fetch endpoint: ${w}`),w)try{const g=await p.fetch(w);if(console.log(`[getRecordIdRedirect] Returned with status: ${g.status}`),g.ok){const E=await g.json();if(E&&E.recordIdUrl)return E.recordIdUrl}}catch(g){return g instanceof Error&&console.error(`[getRecordIdRedirect] Failed to fetch recordIdUrl: ${g.message}`),null}finally{console.log(`[getRecordIdRedirect] END fetch endpoint: ${w}`)}return null}async function _({basePath:n,params:r},l,b,w){const g=await I(r,l,b,w);return g?{code:301,location:g}:(console.log(`[getRecordIdOrErrorRedirect] basePath: ${n}`),{code:302,location:`${n||""}/error`})}const M=n=>n.status==="rejected";async function W(n){const{ssrContext:r,isPrivate:l,appVersion:b,entityPrefix:w}=n,g=[];let E,x,k;const N=a=>{p.isTooManyRequestsResponse(a)&&(k=new R("Too many requests",429,{"cache-control":c.CACHE_CONTROL_HEADER_NO_CACHE})),p.isDownForMaintenanceResponse(a)&&(k=new R("Down for maintenance",503,{"cache-control":c.CACHE_CONTROL_HEADER_NO_CACHE}))};p.addFetchObserver(N),l&&g.push(y(r).then(a=>{a&&(E=a)}).catch(a=>{if(a instanceof Error){const U=`Error in "getServerData" for "getServerLoginRedirect"${a.message?`: ${a.message}`:""}`;throw new Error(U,{cause:a})}})),g.push(_(r,b,d.default,w).then(a=>{a&&(x=a)}).catch(a=>{throw new Error(`Error in "getServerData" for "getRecordIdOrErrorRedirect"${a.message?`: ${a.message}`:""}`,{cause:a})}));const L=(await Promise.allSettled(g).finally(()=>p.removeFetchObserver(N))).filter(M).map(({reason:a})=>a);if(L.length>0)throw new AggregateError(L,`${L.map(({message:a})=>a)}`);if(k?.status!==429&&k?.status!==503){if(E)k=new R("Redirect",E.code,{location:E.location||"","cache-control":c.CACHE_CONTROL_HEADER_NO_CACHE});else if(x){const{code:a,location:U}=x;k=new R("Redirect",a,{location:U||"","cache-control":a===301?"public, max-age=60":c.CACHE_CONTROL_HEADER_NO_CACHE})}console.log(`[routeAppRedirect] Redirecting to: ${k?.headers?.location}`)}if(k)throw k;return{}}let J=!1;function K(n){J||(t.setHooks({sanitizeHtmlContent(r){return r}}),J=!0),n.addServerDataCallback(({serverData:r})=>{globalThis.CLWR=globalThis.CLWR||{},Object.assign(globalThis.CLWR,{serverData:{initialData:r.initialData||Object.values(r)[0]?.initialData,url:r.url||Object.values(r)[0]?.url,routeParams:r.routeParams||Object.values(r)[0]?.routeParams}}),v.setGuestUuidCookie(r.guestUuid)}),typeof window=="undefined"&&typeof n.addRequestHook=="function"?n.addRequestHook(({cookies:r})=>{o.setCookiesFromObject(r),v.setGuestUuidCookie()}):typeof document!="undefined"&&o.setCookiesFromString(document?.cookie)}function Q(n,r){h.initializeServerRouter(r,n)}e.buildServerRouter=Q,e.default=K,e.getWebruntimeServerData=H,e.getWebruntimeServerDataForRedirect=W,Object.defineProperty(e,"__esModule",{value:!0})}),LWR.define("webruntime/bootstrapHook",["exports","webruntime/bootstrapHook/v/1_66_1084-258_0"],function(e,t){e.default=t&&typeof t=="object"&&"default"in t?t.default:t,Object.keys(t).forEach(function(o){o==="default"||e.hasOwnProperty(o)||Object.defineProperty(e,o,{enumerable:!0,get:function(){return t[o]}})})});