1"use strict";(self.webpackChunkstorefront_platform=self.webpackChunkstorefront_platform||[]).push([[8975],{68975:(e,t,n)=>{function r(e,t="&",n="="){return(e||"").split(t).filter(Boolean).reduce((e,t)=>{const[r,i]=t.split(n).filter(Boolean).map(e=>decodeURIComponent(e||""));return e[r]=i,e},{})}function i(e,t="&",n="="){return e&&Object.keys(e).map(t=>encodeURIComponent(t)+n+encodeURIComponent(e[t])).join(t)}function s(){const[e,t="",n=""]=window.location.href.split(/[#?]/g);let i=Object.assign(r(t),r(n));0===Object.keys(i).length&&(i={signedOut:!0}),window.top.postMessage(i,window.location.origin)}n.d(t,{SJ:()=>o,ws:()=>y,YX:()=>s});class o{constructor(e={}){this.storage=e.storage||window.localStorage,this.original_uri=e.original_uri||window.location.href,this.redirect_uri=e.redirect_uri||this.original_uri.split(/[#?]/g)[0],this.post_logout_redirect_uri=e.post_logout_redirect_uri||this.redirect_uri}navigateTo(e){return window.location.href=e,o.INCOMPLETE}async signin(e,t){const{original_uri:n}=this;return/\berror=/.test(n)?Promise.reject(new Error("Unable to authorize.")):/\bstate=/.test(n)?this.signinRedirectCallback(e):this.signinRedirectEntry(e,t)}async signinRedirectEntry(e,t){const{original_uri:n,redirect_uri:r}=this,i={redirect_uri:r},s=await e.createAuthorizationParams(i),o=await t.enrich(s),a={client_id:s.client_id,state:s.state,redirect_uri:r,original_uri:n,...o};try{this.storage.setItem(a.state,JSON.stringify(a));const e=JSON.parse(this.storage.getItem(a.state)||null);if(!e||e.state!==a.state)throw new Error("Storage is limited. Please do not use Private or Incognito mode.")}catch(e){throw new Error("Unable to authorize due to the storage reason: "+e.message)}const c=await e.createAuthorizationUrl(s);return this.navigateTo(c)}async signinRedirectCallback(e){const{original_uri:t}=this,n=await e.parseAuthorizationResponse(t);let r=null;const i=JSON.parse(this.storage.getItem(n.state)||null),{history:s,location:a,document:c}=window;if(!i){if(s.length>0&&c.referrer.indexOf(a.host)>-1)return s.back(),o.INCOMPLETE;throw new Error("Missing state.")}if(this.storage.removeItem(n.state),i.original_uri&&s.replaceState(s.state,c.title,i.original_uri),n.access_token)r=n;else{const t=n.code;if(!t)throw new Error("Missing authorization code.");const s={grant_type:"authorization_code",code:t,redirect_uri:i.redirect_uri};i.code_verifier&&(s.code_verifier=i.code_verifier),r=await e.performTokenRequest(s)}return r}refresh(e,t){const n={grant_type:"refresh_token",refresh_token:t};return e.performTokenRequest(n)}async signout(e,t,n){const r={};t&&(r.id_token_hint=t);const i=n||this.post_logout_redirect_uri;i&&(r.post_logout_redirect_uri=i);const s=await e.createEndSessionUrl(r);return this.navigateTo(s)}}function a(e){const t={},n=()=>{t.timer&&window.clearTimeout(t.timer)};return t.promise=new Promise((e,r)=>{t.resolve=function(r){return n(),t.value=r,e(r),this},t.reject=function(e){return n(),r(e),this}}),e&&(t.timer=window.setTimeout(()=>t.reject(new Error("The operation has timed out")),e)),t}function c(e){return e&&(t=function(e){return e.split(".",3)}(e)[1],JSON.parse(window.atob(t)));var t}async function u(){const e=h(96),t=await async function(e){return d(l(await async function(e){const t=await window.crypto.subtle.digest("SHA-256",function(e){const t=new Uint8Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=e.charCodeAt(n);return t}(e));return new Uint8Array(t)}(e)))}(e);return{code_verifier:e,code_challenge:t,code_challenge_method:"S256"}}function h(e){const t=new Uint8Array(e);return window.crypto.getRandomValues(t),d(l(t)).substr(0,e)}function l(e){return window.btoa(function(e){return String.fromCharCode.apply(String,e)}(e))}function d(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=+$/,"")}o.INCOMPLETE=new Promise(e=>e);class f{constructor(e,t){this.settings=e,this.oidcMetadataClient=t}async createAuthorizationParams(e={}){const{client_id:t,scope:n,extra:r={}}=this.settings;return{...{client_id:t,state:h(32),nonce:h(32),scope:n},...r,...e}}async createAuthorizationUrl(e){let{authorization_endpoint:t}=await this.oidcMetadataClient.getMetadata();const n=i(e);return n&&(t+="?"+n),t}async parseAuthorizationResponse(e){const[t,n=""]=e.split(/[#?]/g),i=r(n);return this.ensureSuccessResponse(i)}async createEndSessionUrl(e){let{end_session_endpoint:t}=await this.oidcMetadataClient.getMetadata();const n=i(e);return n&&(t+="?"+n),t}async performTokenRequest(e){const{token_endpoint:t}=await this.oidcMetadataClient.getMetadata();return this.fetch(t,{method:"POST",headers:{Authorization:this.getBasicAuth(),Accept:"application/json;charset=UTF-8","Content-Type":"application/x-www-form-urlencoded"},body:i(e)}).then(e=>e.json()).then(e=>this.ensureSuccessResponse(e))}fetch(e,t){return(this.settings.fetch||window.fetch).call(window,e,t)}getBasicAuth(){const{client_id:e,client_secret:t}=this.settings;return"Basic "+btoa(e+":"+t)}
1ensureSuccessResponse(e){if("error"in e)throw new Error(e.error_description||e.error);return e}}class _{async enrich(e){const t={response_type:"id_token token",response_mode:"fragment"};return Object.assign(e,t),t}}class g{async enrich(e){const t={response_type:"code",response_mode:"query"};return Object.assign(e,t),t}}class p extends g{async enrich(e){const t=await super.enrich(e),n=await u();return t.code_verifier=n.code_verifier,e.code_challenge=n.code_challenge,e.code_challenge_method=n.code_challenge_method,t}}class w{constructor(e,t="/connect"){this.authority=e,this.path=t}async getMetadata(){const e=this.authority+this.path;return{issuer:this.authority,authorization_endpoint:e+"/authorize",token_endpoint:e+"/token",userinfo_endpoint:e+"/userinfo",end_session_endpoint:e+"/endsession"}}}class m{constructor(){this.events=document.createElement("div")}on(e,t){return this.events.addEventListener(e,t),()=>this.events.removeEventListener(e,t)}emit(e,t){this.events.dispatchEvent(this.createEvent(e,t))}createEvent(e,t){if("function"==typeof CustomEvent)return new CustomEvent(e,{detail:t});{const n=document.createEvent("CustomEvent");return n.initCustomEvent(e,!1,!1,t),n}}}const k={claims:[],createOidcMetadataClient:e=>new w(e.authority),createOidcClient:(e,t)=>new f(e,t)};class y{constructor(e={}){this.events=new m,e={...k,...e},this.claims=["client_id","idp","sub","email"].concat(e.claims),this.clock_skew=Math.max(Number(e.clock_skew),0)||120,this.transport=e.transport&&"signin"in e.transport?e.transport:new o(e.transport),this.grantFrow=e.grantFlow||function(e){switch(e){case"Implicit":return new _;case"AuthorizationCode":return new g;case"AuthorizationCodeWithProofKey":return new p}throw new Error("Unsupported '"+e+"' client type.")}(e.client_type);const t=e.createOidcMetadataClient(e);this.oidcClient=e.createOidcClient(e,t),this.userInfo=a().resolve(y.Anonymous)}async getUserInfo(e=null){let t=await this.userInfo.promise;if(t!==this.userInfo.value)return this.getUserInfo(e);const{tokens:{refresh_token:n="",access_token:r="",exp:i=0}={}}=t;if(n){const s=Boolean(e)&&e===r,o=Date.now()-i>0;(s||o)&&(t=await this.lockUserInfo(()=>(this.events.emit("exchange",{access_token:r,refresh_token:n}),this.transport.refresh(this.oidcClient,n)),t))}else if(e)throw new Error("Unable to refresh the user tokens: refresh_token is missing.");return t}getAccessToken(e=null){return this.getUserInfo(e).then(e=>{const t=e.tokens;return t&&t.access_token})}signin(){return this.events.emit("signin"),this.lockUserInfo(()=>this.transport.signin(this.oidcClient,this.grantFrow))}async signout(e){return this.events.emit("signout"),this.lockUserInfo(t=>{const{tokens:{id_token:n=null}={}}=t;return this.transport.signout(this.oidcClient,n,e)})}async lockUserInfo(e,t=null){return t=t||await this.userInfo.promise,this.userInfo=a(),new Promise(async(n,r)=>{try{const r=await e(t);t=this.buildUserInfo(r,t),this.userInfo.resolve(t),this.events.emit("received",{userInfo:t,tokenResponse:r}),n(t)}catch(e){if("message"in e&&e.message.indexOf("invalid_grant")>-1){const n=t.tokens;"refresh_token"in n&&(this.events.emit("abandoned",{refresh_token:n.refresh_token}),n.refresh_token=null,e=new Error("Unable to refresh the user tokens: refresh_token has expired."))}this.userInfo.resolve(t),this.events.emit("error",{error:e}),r(e)}})}buildUserInfo(e,t=null){let n=e;if(n){if("tokens"in t){const e=t.tokens,r={id_token:n.id_token||e.id_token,refresh_token:n.refresh_token||e.refresh_token};n={...e,...n,...r}}const e=Date.now();n.iat=e,n.exp=(r=e,i=n.expires_in,s=this.clock_skew,o=r,1e3*(Math.trunc(o/1e3)+i-s));const a={...v(n.id_token),...v(n.access_token)};return t=this.claims.reduce((e,t)=>(e[t]=a[t],e),{tokens:n})}var r,i,s,o;return y.Anonymous}}function v(e){try{return e?c(e):{}}catch(e){return{}}}y.Anonymous=Object.freeze({})}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.