1(function(d){typeof define=="function"&&define.amd?define(d):d()})((function(){"use strict";class d{escapeHtml(t){const e=document.createElement("div");return e.textContent=t,e.innerHTML}escapeHtmlAttribute(t){return t.replaceAll(/[&<>"']/g,e=>{switch(e){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";case"'":return"'";default:return e}})}}class X extends d{#t;#i;#r;#e;#c;#s=null;constructor(t,e,s,o,r){super(),this.#t=t,this.#i=e,this.#r=s,this.#e=o,this.#c=r}render(t,e,s){if(this.#s){this.#h();return}const o=document.createElement("dialog");switch(o.className="consent-banner",o.dir=this.#r.is_rtl?"rtl":"ltr",o.setAttribute("closedby","none"),o.setAttribute("aria-label","Cookie banner"),o.addEventListener("cancel",r=>{r.preventDefault()}),this.#i){case"opt_out_banner":o.className+=" consent-banner--opt-out",o.innerHTML=this.#l();break;case"opt_in_banner":o.className+=" consent-banner--opt-in",o.innerHTML=this.#a();break;default:o.className+=" consent-banner--opt-in-strict",o.innerHTML=this.#d()}this.#o(o,t,e,s),this.#t.appendChild(o),this.#s=o,setTimeout(()=>this.#h(),10)}destroy(){this.#s&&(this.#u(),this.#s.remove(),this.#s=null)}#l(){const t=this.#r,e=this.escapeHtml(t.description).replaceAll(/\[\[preferences_button]](.*?)\[\[\/preferences_button]]/g,'<button class="consent-banner__link" data-action="customize">$1</button>');return` 2 <div class="consent-banner__container consent-banner__container--opt-out"> 3 <div class="consent-banner__header"> 4 <p class="consent-banner__title">${this.escapeHtml(t.title)}</p> 5 <button class="consent-banner__close" data-action="close" aria-label="Close"> 6 <svg
7 viewBox="0 0 24 24" 8 width="14" 9 height="14" 10 stroke="currentColor" 11 stroke-width="2.5" 12 stroke-linecap="round" 13 fill="none" 14 > 15 <path d="M18 6L6 18M6 6l12 12"/> 16 </svg> 17 </button> 18 </div> 19 <p class="consent-banner__description consent-banner__description--opt-out">${e}</p> 20 <a class="consent-banner__link" href="${this.escapeHtmlAttribute(this.#e)}" aria-label="More information about your privacy, opens in a new tab" rel="noopener" target="_blank" >${this.escapeHtml(t.cookie_policy)}</a> 21 </div> 22 `}#a(){const t=this.#r,e=this.escapeHtml(t.description).replaceAll(/\[\[policy_link]](.*?)\[\[\/policy_link]]/g,`<a class="consent-banner__link" href="${this.escapeHtmlAttribute(this.#e)}" aria-label="More information about your privacy, opens in a new tab" rel="noopener" target="_blank" >$1</a>`),s=this.#c?"":`<p class="consent-banner__title">${this.escapeHtml(t.title)}</p>`,o=this.#c?"":`<button class="consent-banner__button consent-banner__button--icon" data-action="customize" aria-label="${this.escapeHtmlAttribute(t.customize)}"> 23 </button>`,r=this.#c?`<button class="consent-banner__button consent-banner__button--secondary" data-action="customize" aria-label="${this.escapeHtmlAttribute(t.customize)}"> 24 ${this.escapeHtml(t.customize)} 25 </button>`:"";return` 26 <div class="consent-banner__container consent-banner__container--opt-in"> 27 <div class="consent-banner__content consent-banner__content--opt-in"> 28 ${s} 29 <p class="consent-banner__description">${e}</p> 30 </div> 31 <div class="consent-banner__actions"> 32 ${o} 33 <button class="consent-banner__button consent-banner__button--primary" data-action="reject"> 34 ${this.escapeHtml(t.reject_all)} 35 </button> 36 <button class="consent-banner__button consent-banner__button--primary" data-action="accept"> 37 ${this.escapeHtml(t.accept_all)} 38 </button> 39 ${r} 40 </div> 41 </div> 42 `}#d(){const t=this.#r,s=this.escapeHtml(t.description).replaceAll(/\[\[policy_link]](.*?)\[\[\/policy_link]]/g,`<a class="consent-banner__link consent-banner__link--opt-in-strict" href="${this.escapeHtmlAttribute(this.#e)}" aria-label="More information about your privacy, opens in a new tab" rel="noopener" target="_blank" >$1</a>`).split(String.raw`\n`).map(o=>`<p class="consent-banner__description consent-banner__description--opt-in-strict">${o}</p>`).join("");return` 43 <div class="consent-banner__container consent-banner__container--opt-in-strict"> 44 <div class="consent-banner__content consent-banner__content--opt-in-strict"> 45 <p class="consent-banner__title consent-banner__title--opt-in-strict">${this.escapeHtml(t.title)}</p> 46 ${s} 47 </div> 48 <div class="consent-banner__actions consent-banner__actions--opt-in-strict"> 49 <div class="consent-banner__actions-group"> 50 <button class="consent-banner__button consent-banner__button--primary" data-action="reject"> 51 ${this.escapeHtml(t.reject_all)} 52 </button> 53 <button class="consent-banner__button consent-banner__button--primary" data-action="accept"> 54 ${this.escapeHtml(t.accept_all)} 55 </button> 56 </div> 57 <button class="consent-banner__button consent-banner__button--text" data-action="customize"> 58 ${this.escapeHtml(t.customize)} 59 </button> 60 </div> 61 </div> 62 `}#o(t,e,s,o){const r=t.querySelector('[data-action="accept"]'),i=t.querySelector('[data-action="reject"]'),c=t.querySelector('[data-action="customize"]');t.querySelector('[data-action="close"]')?.addEventListener("click",()=>{e(),this.#u()}),r?.addEventListener("click",()=>{e()}),i?.addEventListener("click",()=>{s()}),c?.addEventListener("click",()=>{o()})}#h(){if(this.#s){if(this.#i==="opt_in_strict_banner"){this.#s.showModal?.();return}this.#s.show?.()}}#u(){this.#s?.close?.()}}const Q=5;class Z extends d{#t=null;render(t){if(this.#t)return;const e=Array.from({length:Q}).map(()=>` 63 <div class="consent-pc-modal__skeleton-row">
64 <span class="consent-pc-modal__skeleton-bar"></span> 65 <span class="consent-pc-modal__skeleton-bar"></span> 66 </div>`).join(""),s=document.createElement("dialog");s.className="consent-pc-modal__skeleton",s.setAttribute("aria-busy","true"),s.setAttribute("aria-label","Loading privacy preferences"),s.innerHTML=` 67 <div class="consent-pc-modal__skeleton-content"> 68 <div class="consent-pc-modal__skeleton-header"> 69 <span class="consent-pc-modal__skeleton-bar"></span> 70 </div> 71 <div class="consent-pc-modal__skeleton-body"> 72 <span class="consent-pc-modal__skeleton-bar"></span> 73 <span class="consent-pc-modal__skeleton-bar"></span> 74 <div class="consent-pc-modal__skeleton-categories">${e}</div> 75 </div> 76 <div class="consent-pc-modal__skeleton-footer"> 77 <span class="consent-pc-modal__skeleton-bar"></span> 78 </div> 79 </div> 80 `,t.appendChild(s),this.#t=s,s.showModal?.()}destroy(){this.#t&&(this.#t.open&&this.#t.close?.(),this.#t.remove(),this.#t=null)}}const p="2.6.0",tt="https://capital.com/cookies-policy",et="capital",N="77939bf3-fa99-55d5-bb2b-2555f8219df0",nt="cmp_template_",O="consent_preferences",f=365,D=1440*60*1e3,st=f*D,ot=void 0,$={css:"consent-sdk.min.css",cssV2:"consent-sdk-v2.min.css"},g={script:"consent-sdk-modal.min.js",css:"consent-sdk-modal.min.css",cssV2:"consent-sdk-modal-v2.min.css",globalName:"ConsentSDKModal"},M={script:"consent-sdk-fallback.min.js",globalName:"ConsentSDKFallback"},rt=(n,t)=>new Promise((e,s)=>{const o=document.createElement("script");o.src=n,t&&(o.fetchPriority=t),o.onload=()=>e(),o.onerror=()=>s(new Error(`[ConsentSDK] Failed to load script: ${n}`)),document.head.appendChild(o)}),P=(n,t)=>document.querySelector(`link[href="${n}"]`)?Promise.resolve():new Promise(e=>{const s=document.createElement("link");s.rel="stylesheet",s.href=n,t&&(s.id=t),s.onload=()=>e(),s.onerror=()=>{console.error(`[ConsentSDK] Failed to load CSS from: ${n}`),e()};const o=document.querySelector("script");o?.parentNode?o.parentNode.insertBefore(s,o):document.head.appendChild(s)}),it=()=>{const n=document.querySelectorAll("script[src]");return Array.from(n).find(t=>t.src.includes("consent-sdk")&&!t.src.includes("consent-sdk-fallback"))},L=()=>{const n=document.querySelectorAll("script[src]");return Array.from(n).find(t=>t.src.includes("/src/index.ts"))},w=()=>{const n=L();if(n)return new URL(n.src).origin;const t=it();return t?t.src.substring(0,t.src.lastIndexOf("/")):"."},at=()=>!!L(),S=new Map,B=n=>{const t=S.get(n.globalName);if(t)return t;const e=w();let s;{const r=[rt(`${e}/${n.script}`,n.fetchPriority)];n.stylesheet&&r.push(P(`${e}/${n.stylesheet}`)),s=Promise.all(r).then(()=>{const i=globalThis[n.globalName];if(typeof i!="object"||i===null)throw new Error(`[ConsentSDK] Chunk "${n.globalName}" not registered after script load`);return i})}const o=s.catch(r=>{throw S.delete(n.globalName),r});return S.set(n.globalName,o),o},ct=n=>B({script:g.script,stylesheet:n?g.cssV2:g.css,globalName:g.globalName,fetchPriority:"high"}),R=()=>B({script:M.script,globalName:M.globalName}),K=(n,t=f)=>!Number.isFinite(n)||n<=0?!0:Date.now()>n+t*D;let T=0;const U=n=>{n[6]=(n[6]??0)&15|64,n[8]=(n[8]??0)&63|128;let t="";for(let e=0;e<n.length;e+=1)t+=((n[e]??0)+256).toString(16).slice(1),(e===3||e===5||e===7||e===9)&&(t+="-");return t},_=(n,t,e)=>{for(let s=0;s<4;s+=1)n[t+s]=e>>>s*8&255},lt=n=>{T=T+1>>>0;const t=Date.now(),e=Math.floor((globalThis.performance?globalThis.performance.now():0)*1e3);_(n,0,t>>>0),_(n,4,Math.floor(t/4294967296)),_(n,8,e>>>0),_(n,12,T)},x=()=>{const n=globalThis.crypto;if(typeof n?.randomUUID=="function")return n.randomUUID();const t=new Uint8Array(16);return typeof n?.getRandomValues=="function"?(n.getRandomValues(t),U(t)):(lt(t),U(t))},ht=n=>{if(!n.ok||n.status>=400)throw new Error("Network error");return n},v=async(n,t)=>{const e=await globalThis.fetch(n,t);return ht(e)},F=async(n,t,e,s,o,r=0)=>{try{return await v(n,t)}catch(i){if(o?.(i,r),r>=e)throw i;return await new Promise((c,a)=>{setTimeout(()=>{F(n,t,e,s,o,r+1).then(c).catch(a)},s)})}},z=(n,t)=>`${nt}${N}_${n.toUpperCase()}_${t.toLowerCase()}`,H=n=>typeof n=="object"&&n!==null&&!Array.isArray(n),ut=n=>
80H(n)&&(n.etag===null||typeof n.etag=="string")&&typeof n.cachedAt=="number"&&H(n.template),dt=(n,t)=>{try{const e=sessionStorage.getItem(z(n,t));if(e===null)return null;const s=JSON.parse(e);return ut(s)?s:null}catch{return null}},pt=(n,t,e)=>{try{sessionStorage.setItem(z(n,t),JSON.stringify(e))}catch{}},mt=["test","localhost"].some(n=>globalThis.location.hostname.startsWith(n))||globalThis.location.hostname.includes(".website.test.")?"https://test-cmp.capital.com/api":"https://cmp.capital.com/api",ft="/pack",gt="/cookie",q=(n,t,e)=>`${mt}${n}/${N}/${encodeURIComponent(t)}/${encodeURIComponent(e)}`,V=async(n,t)=>{const e=q(ft,n,t),s=await v(e,{method:"GET"}),o=s.headers.get("ETag"),r=await s.json();return pt(n,t,{etag:o,template:r,cachedAt:Date.now()}),{etag:o,template:r}},_t=async(n,t,e,s)=>{try{const{etag:o,template:r}=await V(n,t);o!==null&&e!==null&&o!==e&&s(r)}catch{}},bt=async(n,t,e)=>{try{const s=dt(n,t);if(s)return _t(n,t,s.etag,e),s.template;const{template:o}=await V(n,t);return o}catch(s){return console.warn("ConsentSDK: failed to load pack data:",s),null}},yt=async(n,t,e)=>{try{let s=q(gt,n,t);return e&&(s+=`?snapshot_version=${encodeURIComponent(e)}`),await(await v(s,{method:"GET"})).json()}catch(s){return console.warn("ConsentSDK: failed to load cookie data:",s),null}},Ct=(n,t)=>{const e=kt();for(const s of e){const o=wt(t,s.name);if(!o)continue;n[o]||(b(s.name,s.path),s.domain&&(b(s.name,s.path,s.domain),s.domain.startsWith(".")||b(s.name,s.path,`.${s.domain}`)))}},kt=()=>{if(typeof document>"u")return[];try{const n=document.location.hostname;return document.cookie.split(";").map(t=>{const[e,...s]=t.split("="),o=(e??"").trim(),r=s.join("=").trim();return{name:o,value:r,domain:n,path:"/"}})}catch(n){if(n instanceof DOMException&&n.name==="SecurityError")return console.error("Failed to read cookies",n),[];throw n}},wt=(n,t)=>n.find(e=>e.cookies.find(s=>s.cookie_name.split(",").map(o=>o.trim()).includes(t)))?.key??"",St=({name:n,value:t,daysToExpire:e,expiryStartFrom:s,cookieDomain:o})=>{try{const r=s??new Date;r.setTime(r.getTime()+e*24*60*60*1e3);const i=`expires=${r.toUTCString()}`,c=o?`; domain=${o}`:"",a="; SameSite=Lax",l=document.location.protocol==="https:"?"; Secure":"";document.cookie=`${n}=${t}; ${i}${c}; path=/${a}${l}`}catch(r){if(r instanceof DOMException&&r.name==="SecurityError")return;throw r}},h=n=>{try{const t=`${n}=`,e=document.cookie.split(";");for(let s=0;s<e.length;s++){let o=e[s]??"";for(;o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(t)===0)return o.substring(t.length,o.length)}return null}catch(t){if(t instanceof DOMException&&t.name==="SecurityError")return null;throw t}},b=(n,t="/",e)=>{try{const s=e?`; domain=${e}`:"";document.cookie=`${n}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=${t}${s}`}catch(s){if(s instanceof DOMException&&s.name==="SecurityError"){console.error("Failed to delete cookie",s);return}throw s}},Tt=n=>{const t=n.trim();if(!t)return"en";const s=t.replaceAll("_","-").split("-").filter(Boolean),o=(s[0]||"").toLowerCase();if(!o)return"en";const r=s.slice(1);if(o==="zh"){const i=r.find(k=>/^[a-zA-Z]{4}$/.test(k)),c=r.find(k=>/^[a-zA-Z]{2}$/.test(k)||/^[0-9]{3}$/.test(k)),a=i?i.toLowerCase():null,l=c?c.toUpperCase():null;return a==="hans"?"zh-hans":a==="hant"?"zh-hant":l==="CN"||l==="SG"?"zh-hans":l==="TW"||l==="HK"||l==="MO"?"zh-hant":"zh-hans"}return o},vt=()=>{const n=Array.isArray(navigator.languages)&&navigator.languages[0]||navigator.language||"en";return Tt(n)},Et=n=>{const t=n?"-v2":"",e=n?$.cssV2:$.css,s=at()?`${w()}/src/styles/main${t}.css`:`${w()}/${e}`;return P(s,"consent-sdk-styles")},At={C0001:"necessary",C0002:"performance",C0003:"functional",C0004:"targeting"},It="OptanonConsent",Nt="cookieBanner",j="OptanonAlertBoxClosed",Ot=()=>{try{const n=h(It);if(!n)return[null,null];const t=Dt(n);return t.groups?$t()?[Mt(t.groups),t?.consentId??null]:[null,null]:[null,null]}catch(n){return console.warn("OneTrust migration failed:",n),[null,null]}},Dt=n=>{const t={},e=n.split("&");for(const s of e){const[o,...r]=s.split("=");if(o&&r.length>0){const i=r.join("=");t[o]=decodeURIComponent(i)}}return t},$t=()=>h(j)!==null||h(Nt)!==null,Mt=n=>{const t=n.split(","),e={necessary:!0,performance:!1,functional:!1,targeting:!1};let s=!1;for(const o of t){const r=o.split(":");if(r.length!==2)continue;const[i,c]=r,a=At[i];a&&(s=!0,a!=="necessary"&&(e[a]=c==="1"))}return s?e:null},Pt=()=>h(j),y=(n,t)=>{try{localStorage.setItem(n,t)}catch{console.error("Failed to set localStorage")}},m=n=>{try{return localStorage.getItem(n)}catch{return console.error("Failed to get localStorage"),null}},C=n=>{try{localStorage.removeItem(n)}catch{console.error("Failed to delete localStorage")}};class Lt{#t;#i;#r;#e;
80constructor(t=O,e,s=f){this.#t=t,this.#i=e,this.#r=s,this.#e=`${t}_pending_consent_id`}save(t,e){const s=JSON.stringify(t);try{if(St({name:this.#t,value:s,daysToExpire:this.#r,cookieDomain:this.#i,expiryStartFrom:e}),!h(this.#t))throw new Error("Cookie set failed.")}catch(o){console.warn("Failed to set cookie, falling back to localStorage:",o),y(this.#t,s)}}load(){try{const t=h(this.#t);if(t)return JSON.parse(t);const e=m(this.#t);if(e){const s=JSON.parse(e);return K(s.timestamp,this.#r)?(C(this.#t),null):s}}catch(t){console.error("Failed to load consent state:",t)}return null}clear(){b(this.#t,"/",this.#i),C(this.#t),this.clearPendingConsentId()}savePendingConsentId(t){y(this.#e,t)}loadPendingConsentId(){return m(this.#e)}clearPendingConsentId(){C(this.#e)}}const u="consent_pending_tracking",Bt=10,Rt=300*1e3;let E=null;const Kt=n=>{try{const t=m(u);let e=t?JSON.parse(t):[];Array.isArray(e)||(e=[]),e.length>=Bt&&e.shift(),e.push(n),y(u,JSON.stringify(e))}catch{}},J=n=>{try{const t=m(u);if(!t)return;const e=JSON.parse(t);if(!Array.isArray(e))return;const s=e.findIndex(n);if(s===-1)return;e.splice(s,1),e.length?y(u,JSON.stringify(e)):C(u)}catch{}},Ut=async(n,t)=>{try{await n(t);const e=JSON.stringify(t);J(s=>JSON.stringify(s)===e)}catch{}},G=n=>{const t=m(u);if(!t)return;let e;try{if(e=JSON.parse(t),!Array.isArray(e))return}catch{return}for(const s of e)Ut(n,s)},xt=n=>{G(n),E&&globalThis.clearInterval(E),E=globalThis.setInterval(()=>G(n),Rt)},A=globalThis.location.hostname,Y=/^([a-z0-9-]+)-capital\.website\.test\./.exec(A)?.[1],Ft=["test","localhost"].some(n=>A.startsWith(n)),zt=/^test([1-9]\d*)(?=\.)/.exec(A)?.[1]??"",Ht=Ft?`https://test-api-website${zt}.capital.com/api/v2`:"https://api-website.capital.com/api/v2",qt=Y?`https://${Y}-backend.website.test.capital.com/api/v2`:Ht,Vt="/service-point/sync",jt=10,Jt=1e3,W=async n=>{const t={"Content-Type":"text/plain; charset=utf-8"},e=globalThis.btoa(JSON.stringify([n]));await F(`${qt}${Vt}`,{body:e,headers:t,keepalive:!0,method:"POST"},jt,Jt,s=>{console.warn("ConsentSDK: error in sending analytics:",s)})},Gt=async n=>{try{await W(n),J(t=>t.consentId===n.consentId&&t.timestamp===n.timestamp)}catch{}},Yt=()=>{xt(W)},Wt=n=>{const t={...n,timezone:-new Date().getTimezoneOffset()/60,eventName:"userCMPConsent",consentVersion:p,url:globalThis.location.href,userAgent:navigator.userAgent,referrer:document.referrer};Kt(t),Gt(t)},Xt=n=>{try{const t=new URL(n,globalThis.location.origin);if(t.protocol==="http:"||t.protocol==="https:")return t.href}catch{console.error("Invalid URL provided to validateLink")}return""},Qt=n=>{const e=(n.trim().toLowerCase().replace(/^https?:\/\//,"").split(/[/?#]/)[0]??"").split(".").filter(Boolean);return e.length<2?null:e[e.length-2]??null},I={opt_out_banner:0,opt_in_banner:1,opt_in_strict_banner:2};class Zt{#t;#i;#r;#e;#c;#s;#l;#a=null;#d=null;#o;#h;#u;#p=!1;#m=!1;#n={timestamp:0,version:p,consentId:""};#C=Promise.resolve();#f=null;get version(){return p}constructor(t={}){this.#e=new Lt(O,ot,f),this.#t=t.appVersion??"",this.#s=t.country?.toUpperCase()??"",this.#l=t.language??this.#V(),this.#i=Xt(t.cookiePolicyLink??tt),this.#r=t.ignoreShowBannerOnInit??!1,this.#c=t.isV2Design===!0}
80async init(){if(this.#o){console.warn("ConsentSDK has already initialized");return}if(this.#C=Et(this.#c),await this.#k(),!document.body){console.warn("ConsentSDK: document.body is unavailable, aborting init");return}this.#R();const t=document.createElement("div");t.className="consent-sdk",document.body.appendChild(t),this.#o=t,this.#r||await this.tryToShowBanner(),Yt(),this.#b("ready",{mode:this.getMode(),country:this.#s,state:this.#n,reconsentAwaiting:this.#p})}getConsent(){return{...this.#n}}isReconsentAwaiting(){return this.#p}updateConsent(t,e){const s={...this.#n},o=t.consentId??this.#e.loadPendingConsentId();this.#n=this.#O({...this.#n,...t,...o&&{consentId:o},timestamp:e?.getTime()??Date.now(),version:p,consentMode:this.getMode(),fallback:this.#m}),this.#e.save(this.#n,e),this.#p=!1,o&&this.#e.clearPendingConsentId(),this.#E().then(a=>Ct(this.#n,a.categories)).catch(()=>{}),this.#b("consent-changed",{oldState:{...s,expiresAt:this.#v(s.timestamp)},newState:{...this.#n,expiresAt:this.#v(this.#n.timestamp)}});const{timestamp:r,consentId:i,otm:c}=this.#n;Wt({appVersion:this.#t,tenant:Qt(globalThis.location.hostname)??et,cookieBannerVersion:this.getMode(),details:this.#q(),timestamp:r,consentId:i,country:this.#s,language:this.#l,expiresAt:this.#v(r),otm:!!c,fallback:this.#m,templateSnapshotVersion:this.#g()?.template_snapshot_version??"0",cookieSnapshotVersion:this.#g()?.cookie_snapshot_version??"0"})}hasConsent(t){return this.#n[t]===!0}async openPreferences(){if(!this.#o){console.warn("ConsentSDK is not initialized");return}if(!this.#u){this.#f??=this.#P();let t;try{t=await this.#f}catch(e){this.#f=null,console.warn("Failed to load preferences modal",e);return}if(!t){this.#f=null;return}this.#u=t,this.#f=null}await this.#C,this.#u.updateState(this.#n),this.#u.render(t=>this.#W(t))}async#P(){if(!this.#o)return null;const t=this.#j();if(!t)return null;const e=new Z;e.render(this.#o);try{const{PreferenceCenterModal:s}=await ct(this.#c);return new s(this.#o,t.content,this.#y(),this.#i,this.#n,this.#c,()=>this.#E().then(o=>new Map(o.categories.map(({key:r,cookies:i})=>[r,i]))))}finally{e.destroy()}}async tryToShowBanner(){if(!this.#o){console.warn("ConsentSDK is not initialized");return}this.#X()||await this.#J()}getMode(){return this.#D()?.key??"opt_in_strict_banner"}getCountry(){return this.#s}async setCountry(t){this.#s=t.toUpperCase(),await this.#k(),this.#x(),this.#_(),await this.tryToShowBanner(),this.#b("country-changed",{country:this.#s,mode:this.getMode()})}async setLanguage(t){this.#l=t.toLowerCase(),await this.#k(),this.#$(),await this.#L(),this.#b("language-changed",{language:this.#l})}reset(){this.#e.clear(),this.#p=!1,this.#n=this.#w(),this.#o&&(this.#_(),this.#o.remove(),this.#o=null),this.init(),this.#b("consent-reset",{consent:this.#n})}async#L(){this.#h&&(this.#M(),await this.tryToShowBanner())}async#E(){this.#d||(this.#d=this.#B());const t=await this.#d;if(!t)throw this.#d=null,new Error("Failed to load cookie data");return t}async#B(){const t=await yt(this.#s,this.#l,this.#g()?.cookie_snapshot_version);if(t)return t;try{const e=await R();return this.#m=!0,e.getFallbackCookieData()}catch(e){return console.warn("[ConsentSDK] Failed to load fallback chunk",e),null}}async#k(){if(!this.#s||!this.#l)return;this.#d=null;const t=this.#a,e=await bt(this.#s,this.#l,s=>{this.#a=s,this.#d=null});if(e){this.#a===t&&(this.#a=e),this.#m=!1;return}try{const s=await R();this.#a=s.getFallbackPackData(this.#s),this.#m=this.#a!==null}catch(s){console.warn("[ConsentSDK] Failed to load fallback chunk",s),this.#a=null,this.#m=!1}}#w(){const t=this.getMode()==="opt_out_banner";return{...this.#S(t),timestamp:Date.now(),version:p,consentId:x(),consentMode:this.getMode()}}#R(){this.#p=!1,this.#n=this.#w();const t=this.#e.load();if(t){this.#K(t);return}this.#e.loadPendingConsentId()||this.#U()}#K(t){this.#A(t.timestamp,t.consentId)||this.#I(t.consentMode,t.consentId)||(this.#n=this.#O({...this.#n,...t}),t.consentId?t.consentMode||this.#e.save(this.#n,new Date(t.timestamp)):this.updateConsent({consentId:x()},new Date(t.timestamp)))}#U(){const[t,e]=Ot();if(!t)return;const s=Pt(),o=s?new Date(s):void 0,r=o?.getTime()??Date.now();
80K(r)||this.#A(r,e)||this.updateConsent({...t,...e&&{consentId:e},otm:!0},o)}#A(t,e){return this.#z(t)?(this.#N(e),!0):!1}#I(t,e){return this.#F(t)?(this.#N(e),!0):!1}#N(t){this.#e.clear(),this.#p=!0,t&&this.#e.savePendingConsentId(t)}#x(){const t=this.#e.load();t&&this.#I(t.consentMode,t.consentId)&&(this.#n=this.#w())}#F(t){if(!t)return!1;const e=I[this.getMode()],s=t in I?I[t]:0;return e>s}#z(t){if(!Number.isFinite(t))return!1;const e=this.#H();return e===null?!1:e>t}#H(){const t=this.#T().reduce((e,s)=>{const o=s.reconsent_required_at;if(!o)return e;const r=Date.parse(o);return Number.isFinite(r)&&e.push(r),e},[]);return t.length?Math.max(...t):null}#S(t){const e={};return this.#y().forEach(s=>{e[s.key]=s.requires_consent?!0:t}),e}#q(){const t={};return this.#y().forEach(e=>{t[e.key]=this.#n[e.key]===!0}),t}#O(t){const e=this.#y();if(!e.length)return t;const s={...t};return e.forEach(o=>{o.requires_consent&&(s[o.key]=!0)}),s}#g(){return this.#a?this.#a:(console.warn("Template data is not loaded yet"),null)}#y(){return this.#g()?.categories??[]}#T(){return this.#g()?.templates??[]}#V(){return vt()}#D(){const t=this.#T().find(e=>e.role==="banner"||e.role==="default_banner");return t||(console.warn("Template data is missing banner template"),null)}#j(){const t=this.#T().find(e=>e.role==="modal");return t||(console.warn("Template data is missing modal template"),null)}async#J(){if(!this.#o){console.warn("ConsentSDK is not initialized");return}if(this.#g()){if(!this.#h){const e=this.#D();if(!e)return;this.#h=new X(this.#o,this.getMode(),e.content,this.#i,this.#c)}await this.#C,this.#h.render(()=>this.#G(),()=>this.#Y(),()=>this.openPreferences())}}#G(){this.updateConsent(this.#S(!0)),this.#_()}#Y(){this.updateConsent(this.#S(!1)),this.#_()}#W(t){this.updateConsent(t),this.#_()}#_(){this.#$(),this.#M()}#$(){this.#u?.destroy(),this.#u=null,this.#f=null}#M(){this.#h?.destroy(),this.#h=null}#X(){return this.#e.load()!==null}#v(t){return new Date(t).getTime()+st}#b(t,e){const s=new CustomEvent(`consent-sdk:${t}`,{detail:e,bubbles:!0,cancelable:!0});globalThis.dispatchEvent(s)}}if(typeof window<"u"){const n=window.ConsentSDKConfig,t=new Zt(n),e=()=>{window.ConsentSDK={version:t.version,getConsent:()=>t.getConsent(),isReconsentAwaiting:()=>t.isReconsentAwaiting(),updateConsent:o=>t.updateConsent(o),hasConsent:o=>t.hasConsent(o),openPreferences:()=>t.openPreferences(),tryToShowBanner:()=>t.tryToShowBanner(),getMode:()=>t.getMode(),getCountry:()=>t.getCountry(),setCountry:o=>t.setCountry(o),setLanguage:o=>t.setLanguage(o),reset:()=>t.reset()}},s=async()=>{await t.init(),e()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{s()}):s()}}));
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.