1!function(){"use strict";window.config={API_MICRO_SERVICES:{"X-Client-ID":"4d85090c-8b6d-4cba-9327-c024643be989",HOST:`${location.protocol}//${location.host.replace("www","api")}`}};const e=()=>document.cookie.replace(/(?:(?:^|.*;\s*)access_token\s*=\s*([^;]*).*$)|^.*$/,"$1"),t=(e,t="caveat-link",n="caveats")=>{if(!("ontouchstart"in document.documentElement))return;let a;a="orange-banner-static"===e?document.querySelectorAll(`.${e}`):document.querySelectorAll(e),a.forEach((a=>{let o;o="orange-banner-static"===e?a.querySelectorAll(`.${t}`):a.shadowRoot.querySelectorAll(`.${t}`),o.forEach((e=>{e.addEventListener("touchend",(e=>{document.querySelector(`#${n}`).scrollIntoView()}))}))}))},n=e=>e&&"string"==typeof e?e.replace(/_/g,"-"):e,a="X-BG-EUCRN",o=e=>{const t=(document.cookie?document.cookie.split("; "):[]).reduce(((t,n)=>{const a=n.split("="),o=a[0],i=a[1];return e===o&&t.push(i),t}),[]);return 1===t.length&&t.toString()};class i{createPreviouslyIdentifiedUser(){const e=o(a);return e?{[a]:e}:{}}}const r=t=>{const n=t.attributes["is-default"],r=o("access_token"),s=o(a);!n&&r&&s&&((t,n,o=()=>{})=>{const r=(new i).createPreviouslyIdentifiedUser(a);r["X-Client-ID"]=window.config.API_MICRO_SERVICES["X-Client-ID"],r["content-type"]="application/vnd.api+json";const s=e();s&&(r.Authorization=`Bearer ${s}`);const c=`${window.config.API_MICRO_SERVICES.HOST}/v${window.config.api.version}/${window.config.api.category}/${n}`;window.fetch(c,{method:"PATCH",headers:r,body:JSON.stringify(t)}).then((e=>o())).catch((e=>o()))})(((e,t="none")=>({data:{id:e.id,type:"personal-offers",attributes:{"page-name":window.config.api.page,"sub-channel":e.attributes["sub-channel"],rank:e.attributes.rank,"campaign-code":e.attributes["campaign-code"]||null,outcome:t}}}))(t,"Shown"),t.id)},s=(e,t)=>{const a=window.digitalData.events,o=((e,t)=>{const a=n(e.attributes["sub-channel"]),o=e.attributes.rank,i=n(e.attributes["product-name"]),r=n(e.attributes["offer-id"]);return{category:"personalOffer",subChannel:a,rank:o,treatmentId:i?`${r}:${i}`:r,campaignCode:n(e.attributes["campaign-code"])||"NA",bnaAction:t}})(e,t);return a.push(o),document.dispatchEvent(window.analyticsEvent),!0},c={pega:null};JSON.parse(window.sessionStorage.getItem("defaultResponse"))?c.pega=JSON.parse(window.sessionStorage.getItem("defaultResponse")):window.fetch("/aem6/content/dam/britishgas/beta/json/personalisation/default-response.json",{method:"GET"}).then((e=>e.json())).then((e=>{window.sessionStorage.setItem("defaultResponse",JSON.stringify(e.pega)),c.pega=JSON.parse(window.sessionStorage.getItem("defaultResponse"))})).catch((e=>{console.log("Error:response failed for default data",e)}));const d=e=>{const t=window.location.href.split("?")[1];if(t){const n=t.split("&");for(let t=0;t<n.length;t+=1){const a=n[t].split("=");if(a[0]===e){return a[1].split("#")[0]}}}return!1},l=()=>{switch((o("External_CID_Campaign")||d("cid")||"").substring(0,3)){case"aff":return"AFFILIATE";case"pmm":case"PPC":return"PAID_MEDIA";default:return""}},u=e=>{const n=$("#"+e),a=n.attr("sub-channel")?n.attr("sub-channel"):"ServiceShop_Hero";if(!n.attr("data-require-pega"))return;const o=JSON.parse(n.attr("data-require-pega")),i=n.find(".incentive-description"),c=n.find(".incentive-legal"),d=o.data.find((e=>e.attributes["sub-channel"]===a));if(d.attributes.hide){const e=document.getElementById("home-services-orange-banner");return void e.parentNode.removeChild(e)}const l=d.attributes.creative;var u;i.html(l["incentive-description"]),c.html(l["incentive-legal"]),u=d,Array.isArray(u)?u.forEach((e=>{r(e),s(e,"impression")})):(r(u),s(u,"impression")),t("orange-banner-static")},g="britishgas.marketingCode",w=()=>{const e=d("qc");if(e){try{window.sessionStorage.setItem(g,JSON.stringify(e))}catch(t){return e}return e}return(e=>{try{return JSON.parse(window.sessionStorage.getItem(e))}catch(e){return!1}})(g)},p=e=>JSON.stringify(c.pega[e]),f=(t=1,n="default",o="default",r=!0)=>{const s=w()?`marketingCode=${w()}`:"",c=(new i).createPreviouslyIdentifiedUser(a),d=e();let g=`${window.config.API_MICRO_SERVICES.HOST}/v${t}/${n}/?pageName=${o}&previousPage=${l()}`;return s&&(g+=`&${s}`),window.analyticsEvent=document.createEvent("Event"),window.analyticsEvent.initEvent("digitalData.event",!0,!0),window.digitalData?window.digitalData.events||(window.digitalData.events=[]):window.digitalData={events:[]},window.config.api={url:window.config.API_MICRO_SERVICES.HOST,version:t,category:n,page:o},c["X-Client-ID"]=window.config.API_MICRO_SERVICES["X-Client-ID"],r&&d&&(c.Authorization="Bearer "+d),window.fetch(g,{method:"get",headers:c}).then((e=>e.json())).then((e=>{if((e=>!e.data||e.data.length<1||e.errors)(e))return r&&d?(f(t,n,o,!1),!1):p(o);const a=JSON.stringify(e);return window.sessionStorage.setItem(o,a),a})).catch((e=>p(o))).then((e=>{e&&(e=>{const t=document.querySelectorAll("[data-require-pega]");if(Array.prototype.forEach.call(t,(t=>t.setAttribute("data-require-pega",[[e]]))),document.querySelectorAll("#home-services-orange-banner").length>0)try{u("home-services-orange-banner")}catch(e){}})(e)}))};window.getPegaData=f}();
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.