@1consent/cli 0.1.0-beta.2 → 0.1.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- function W(t,e){let n=t.base?e[t.base]:e;t.root==="scope"&&(n=e);for(let s of t.path){if(n==null)return;n=n[s]}return n}function Us(t,e){switch(t.k){case"bool":return t.v;case"str":return t.v;case"path":return W(t.v,e)}}function xt(t,e,n){if(n==null||n===!1){t.removeAttribute(e);return}if(n===!0){t.setAttribute(e,"");return}let s=String(n);if(e==="class"&&(s=s.trim().replace(/\s+/g," ")),s===""&&!e.startsWith("data-1c-")){t.removeAttribute(e);return}t.setAttribute(e,s)}function Cn(t){return t==null||t===!1||t===0||t===""?!1:Array.isArray(t)?t.length>0:!0}function Y(t,e,n,s,r,o){switch(t.t){case"text":r.appendChild(document.createTextNode(t.v));break;case"bind":{let i=W(t.p,e);if(i!=null){let c=String(i);r.appendChild(document.createTextNode(c))}break}case"children":if(o)for(let i of o.nodes)Y(i,o.scope,n,s,r);break;case"each":{let i=W(t.list,e);if(Array.isArray(i))for(let c of i){let a={...e,[t.item]:c},l=document.createDocumentFragment();for(let d of t.body)Y(d,a,n,s,l,o);r.appendChild(l)}break}case"if":if(Cn(W(t.path,e))){let i=document.createDocumentFragment();for(let c of t.body)Y(c,e,n,s,i,o);r.appendChild(i)}break;case"if-not":if(!Cn(W(t.path,e))){let i=document.createDocumentFragment();for(let c of t.body)Y(c,e,n,s,i,o);r.appendChild(i)}break;case"use":{let i=n[t.name];if(!i){console.warn(`[1CL Executor] Component not found: ${t.name}`);return}let c={};for(let[u,p]of Object.entries(t.props))c[u]=Us(p,e);let a={...e,props:c},l=t.children&&t.children.length>0?{nodes:t.children,scope:e}:void 0,d=document.createDocumentFragment();for(let u of i)Y(u,a,n,s,d,l);r.appendChild(d);break}case"el":{let i=["svg","path","g","circle","rect","line","polyline","polygon","defs","clipPath"].includes(t.tag)?document.createElementNS("http://www.w3.org/2000/svg",t.tag):document.createElement(t.tag);for(let a of t.attrs)if(a.k==="static")xt(i,a.name,a.value);else if(a.k==="bind"){let l=W(a.value,e);xt(i,a.name,l)}else if(a.k==="concat"){let l=a.parts.map(d=>d.k==="str"?d.v:String(W(d.v,e)??"")).join("");xt(i,a.name,l)}let c=document.createDocumentFragment();for(let a of t.kids)Y(a,e,n,s,c,o);i.appendChild(c),r.appendChild(i);break}}}function $s(t,e,n={}){let s=document.createDocumentFragment(),r=n.view||"main",o=t.views[r];if(!o)return console.error(`[1CL Executor] View not found: ${r}`),s;for(let i of o)Y(i,e,t.components,n,s);return s}function _t(t,e,n,s={}){let r=$s(t,e,s);n.innerHTML="",n.appendChild(r)}function Ie(t,e=Date.now()){if(!Number.isSafeInteger(t)||t<=0||!Number.isSafeInteger(e)||e<0)return!1;let n=e+33696e6;return Number.isSafeInteger(n)?t>=e&&t<=n:!1}var vn=["ar","bg","bs","ca","cs","cy","da","de","el","en","es","et","eu","fi","fr","gl","he","hi","hr","hu","id","is","it","ja","ka","ko","lt","lv","mk","ms","mt","nl","no","pl","pt-br","pt-pt","ro","ru","sk","sl","sq","sr-latn","sr-cyrl","sv","sw","th","tl","tr","uk","vi","zh","zh-hant"],pi=new Set(vn),gi=vn.filter(t=>t.includes("-")).sort((t,e)=>e.length-t.length);function Gs(t){if(typeof t!="string")return null;let e=t.trim();if(e.length<2||e.length>255)return null;try{return Intl.getCanonicalLocales(e)[0]??null}catch{return null}}function Pt(t){return typeof t=="string"&&Gs(t)===t}function js(t){return t.split("-")[0]||"en"}function En(t){let e=js(t).toLowerCase();return/^[a-z]{2}$/.test(e)?e:null}var Ks=1440*60*1e3;var Dt="reload";var X=5;var bn=["VA","CO","CT","MT","TX","OR","DE","NH","NJ","MN","NE","MD","TN","FL","IN","KY","RI"];function Lt(t){return t===void 0?!0:bn.indexOf(t.toUpperCase())!==-1}function Ae(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function re(t){if(!Ae(t))return!1;let e=t;return!(!(typeof e.appId=="string"&&typeof e.version=="number"&&typeof e.machine=="string"&&Ae(e.languages)&&typeof e.languages.primary=="string"&&Array.isArray(e.languages.supported)&&e.languages.supported.length>0&&Pt(e.languages.primary)&&e.languages.supported.every(Pt)&&new Set(e.languages.supported).size===e.languages.supported.length&&e.languages.supported.includes(e.languages.primary)&&Ae(e.cmp)&&typeof e.cmp.main=="string"&&typeof e.cmp.uiData=="string"&&typeof e.cmp.serviceDetails=="string"&&Array.isArray(e.categories)&&Array.isArray(e.services)&&Array.isArray(e.scripts)&&typeof e.appearance=="object"&&e.appearance!==null&&typeof e.framework=="object"&&e.framework!==null)||!["P","S","D"].includes(e.machine))}function kt(t){return t.cmp.trigger?t.framework.type==="us"?!0:!!t.appearance?.trigger:!1}function Nt(t){return re(t)&&t.framework.type==="gdpr"}function Vt(t){if(!re(t)||t.framework.type!=="tcf"||!("vendorListVersion"in t.framework)||!Number.isSafeInteger(t.framework.vendorListVersion)||t.framework.vendorListVersion<=0||!("vendors"in t)||!Array.isArray(t.vendors))return!1;let e=s=>Array.isArray(s)&&s.every(r=>Number.isSafeInteger(r)&&r>0)&&new Set(s).size===s.length,n=[];for(let s of t.vendors){if(!Ae(s))return!1;let r=s.id;if(typeof r!="number"||!Number.isSafeInteger(r)||r<=0||!e(s.consentPurposeIds)||!e(s.legitimateInterestPurposeIds)||!e(s.flexiblePurposeIds)||!e(s.specialFeatureIds))return!1;n.push(r)}return new Set(n).size===n.length}function Oe(t){return re(t)&&t.framework.type==="us"}var oe="1consent",Rt=1;function ae(t){return{...t.consentContinuity?{consentContinuityRevision:t.consentContinuity.revision}:{},appId:t.appId,frameworkId:t.framework.id,type:t.framework.type,machine:t.machine,configVersion:t.version,consentEpoch:t.consentEpoch??0,...t.framework.type==="tcf"?{tcfPolicyVersion:X}:{},primaryLanguage:t.languages.primary}}function ie(){return{schemaVersion:Rt,apps:{}}}function st(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Tn(t){return st(t)&&t.schemaVersion===Rt&&st(t.apps)}function rt(t){if(!t)return ie();try{let e=JSON.parse(t);return Tn(e)?e:ie()}catch{return ie()}}function Ft(t){return st(t)?Object.values(t).every(e=>typeof e=="boolean"):!1}function it(t){return st(t)?typeof t.structuralVersion=="string"&&typeof t.consentEpoch=="number"&&Number.isSafeInteger(t.consentEpoch)&&t.consentEpoch>=0&&typeof t.expiresAt=="number"&&Number.isSafeInteger(t.expiresAt)&&t.expiresAt>=0&&Ft(t.services)&&Ft(t.categories)&&(t.decisionIntegrity===void 0||typeof t.decisionIntegrity=="string")&&(t.tcfCmpId===void 0||typeof t.tcfCmpId=="number"&&Number.isSafeInteger(t.tcfCmpId)&&t.tcfCmpId>=0&&t.tcfCmpId<=4095)&&(t.tcfValidationVersion===void 0||typeof t.tcfValidationVersion=="number"&&Number.isSafeInteger(t.tcfValidationVersion)&&t.tcfValidationVersion>0)&&(t.tcfDisclosedVendorKey===void 0||typeof t.tcfDisclosedVendorKey=="string"&&/^(?:[1-9]\d*(?:,[1-9]\d*)*)?$/.test(t.tcfDisclosedVendorKey))&&(t.tcfApiDataIntegrity===void 0||typeof t.tcfApiDataIntegrity=="string")&&(t.gpcRevocable===void 0||t.gpcRevocable===!0)&&(t.posture===void 0||t.posture===!0):!1}function Mt(t,e=Date.now()){return it(t)?Ie(t.expiresAt,e):!1}var Hs="1consent:browser-store",xe=new WeakSet,In=Promise.resolve();function An(t){let e=In.then(()=>{let n={owner:Symbol("memory-storage-owner")};xe.add(n);try{return t(n)}finally{xe.delete(n)}});return In=e.then(()=>{},()=>{}),e}function Bt(t){return t!==void 0&&xe.has(t)}async function On(t){if(typeof navigator>"u"||!navigator.locks)throw new Error("[BrowserStorage] Native writer is unavailable; initialize the runtime coordinator.");return navigator.locks.request(Hs,async()=>{let e={owner:Symbol("browser-storage-owner")};xe.add(e);try{return await t(e)}finally{xe.delete(e)}})}var Ut=["center-center","bottom-left","bottom-right","bottom-center"],xn=[...Ut,"panel-right"],_n=["left","center"],Pn=["accept-first","reject-first"],Dn=["left","right","center","full"],Ln=["equal","emphasize-accept"];var bi=new Set(Ut),Ti=new Set(xn);var Ii=new Set(_n),Ai=new Set(Pn),Oi=new Set(Dn),xi=new Set(Ln);function $t(t){let e=a=>typeof a=="object"&&a!==null&&!Array.isArray(a);if(!e(t))return!1;let n=t,s=a=>Array.isArray(a)&&a.every(l=>typeof l=="number"&&Number.isSafeInteger(l)&&l>0),r=a=>Array.isArray(a)&&a.every(l=>typeof l=="string"),o=n.disclosures;if(!Array.isArray(o)||!o.every(a=>{if(!e(a))return!1;let l=a;return typeof l.identifier=="string"&&["cookie","web","app"].includes(String(l.type))&&(l.maxAgeSeconds===null||typeof l.maxAgeSeconds=="number"&&Number.isSafeInteger(l.maxAgeSeconds)&&l.maxAgeSeconds>=0)&&typeof l.cookieRefresh=="boolean"&&r(l.domains)&&s(l.purposes)&&s(l.specialPurposes)&&(l.description===void 0||typeof l.description=="string")&&typeof l.optOut=="boolean"}))return!1;let i=n.domains;if(i!==void 0&&(!Array.isArray(i)||!i.every(a=>e(a)&&typeof a.domain=="string"&&typeof a.use=="string")))return!1;let c=n.sdks;return c===void 0||Array.isArray(c)&&c.every(a=>e(a)&&typeof a.name=="string"&&typeof a.use=="string")}function J(t){return t.map(e=>e?"1":"0").join("")}function kn(t){let e=t.categories+t.services+t.framework;return e.length===0||e.includes("0")&&e.includes("1")?"granular":e.includes("1")?"accept_all":"deny_all"}function Nn(t){return[[...new Set(t.flatMap(e=>e.consentPurposeIds))],[...new Set(t.flatMap(e=>e.legitimateInterestPurposeIds))],[...new Set(t.flatMap(e=>e.specialFeatureIds))],t.filter(e=>e.consentPurposeIds.length>0).map(e=>e.id),t.filter(e=>e.legitimateInterestPurposeIds.length>0).map(e=>e.id)]}var le="1consent";var _e=["data-1c-service","data-1c-service-tag","data-1c-tag"],Pe="data-1c-category",jt="data-1c-resolved";function Fn(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return e.toString(36)}function D(t,e){let n=t.map(r=>`${r.id}\0${r.name??""}\0${r.tag??""}\0${r.categoryId??""}\0${r.essential?1:0}${r.catalogServiceKey?`\0k\0${r.catalogServiceKey}`:""}${r.usSensitive?"\x001":""}`).sort(),s=e.map(r=>`${r.id}\0${r.name}\0${r.essential?1:0}`).sort();return Fn(`s:${n.join("")}|c:${s.join("")}`)}function ce(t,e,n){t[e]=e in t?t[e]===!0&&n:n}function De(t,e,n,s){let r=Rn(t,e,n,s);return{services:r.services,categories:r.categories}}function Rn(t,e,n,s){let r={},o=new Map,i=!1;for(let a of t){let l=a.essential===!0||n[a.id]===!0;if(l&&a.essential!==!0&&(i=!0),ce(r,a.id,l),a.catalogServiceKey&&ce(r,a.catalogServiceKey,l),a.tag&&ce(r,a.tag,l),a.name&&ce(r,a.name,l),a.categoryId){let d=o.get(a.categoryId)??{total:0,granted:0};d.total+=1,l&&(d.granted+=1),o.set(a.categoryId,d)}}let c={};for(let a of e){let l=o.get(a.id),d=l!==void 0&&l.total>0&&l.granted===l.total,u=a.essential===!0||s[a.id]===!0||d;u&&a.essential!==!0&&s[a.id]===!0&&(i=!0),ce(c,a.id,u),ce(c,a.name,u)}return{services:r,categories:c,nonEssentialGranted:i}}function Kt(t,e,n,s,r){let o=Rn(t,e,n,s),i=r?.decisionTimestamp,c=i!==void 0&&Number.isSafeInteger(i)&&i>0?i+33696e6:0,a={v:D(t,e),e:Number.isSafeInteger(c)?c:0,s:o.services,c:o.categories};return r?.gpcRevocable===!0&&o.nonEssentialGranted&&(a.g=1),r?.posture===!0&&(a.p=1),a}function Le(){return typeof navigator>"u"?!1:navigator.globalPrivacyControl===!0}var Ht=2;function Mn(t){return t==="A"||t==="D"||t==="G"}var qs=/^[A-Za-z0-9_-]+$/,Ws=/^[a-z0-9]+$/;function Gt(t){return t.length>0&&qs.test(t)}function Ys(t){return t.length>0&&Ws.test(t)}function Xs(t){return t==="gdpr"||t==="tcf"||t==="us"}function Js(t){return t==="P"||t==="S"||t==="D"}function Bn(t){return Mn(t.decision)&&typeof t.appId=="string"&&Gt(t.appId)&&typeof t.frameworkId=="string"&&Gt(t.frameworkId)&&Xs(t.frameworkType)&&Js(t.machine)&&typeof t.primaryLanguage=="string"&&Gt(t.primaryLanguage)&&typeof t.structuralVersion=="string"&&Ys(t.structuralVersion)&&typeof t.consentEpoch=="number"&&Number.isSafeInteger(t.consentEpoch)&&t.consentEpoch>=0&&typeof t.expiresAt=="number"&&Number.isSafeInteger(t.expiresAt)&&t.expiresAt>0}function Vn(t){if(!/^(0|[1-9]\d*)$/.test(t))return null;let e=Number(t);return Number.isSafeInteger(e)&&String(e)===t?e:null}function zt(t){if(!Bn(t))throw new TypeError(le);return[Ht,t.decision,t.appId,t.frameworkId,t.frameworkType,t.machine,t.primaryLanguage,t.structuralVersion,t.consentEpoch,t.expiresAt].join(".")}function qt(t){if(!t)return null;let e=t.split(".");if(e.length!==10||e[0]!==String(Ht))return null;let n=e[1],s=e[2],r=e[3],o=e[4],i=e[5],c=e[6],a=e[7],l=e[8],d=e[9];if(!l||!d)return null;let u=Vn(l),p=Vn(d),y={decision:n,appId:s,frameworkId:r,frameworkType:o,machine:i,primaryLanguage:c,structuralVersion:a,consentEpoch:u,expiresAt:p};return Bn(y)?y:null}function $(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Z(t,e){return $(t)&&Object.entries(t).every(([n,s])=>/^[1-9]\d*$/.test(n)&&s===!0&&(typeof e=="number"?+n<=e:e[n]===!0))}function Zs(t){return $(t)&&Object.entries(t).every(([e,n])=>/^(1[01]|[1-9])$/.test(e)&&$(n)&&Object.entries(n).every(([s,r])=>/^[1-9]\d*$/.test(s)&&+s<=65535&&(r===0||r===1||r===2)))}function Un(t){if(!$(t)||!$(t.purpose)||!$(t.vendor))return!1;let e=t.publisher;return!$(e)||!$(e.customPurpose)?!1:(t.enableAdvertiserConsentMode===void 0||t.enableAdvertiserConsentMode===!0)&&[t.tcfPolicyVersion,t.cmpId,t.cmpVersion].every(n=>typeof n=="number"&&Number.isSafeInteger(n)&&n>=0&&n<2**12)&&[t.isServiceSpecific,t.useNonStandardTexts,t.purposeOneTreatment].every(n=>typeof n=="boolean")&&typeof t.publisherCC=="string"&&/^[A-Z]{2}$/.test(t.publisherCC)&&Z(t.purpose.consents,11)&&Z(t.purpose.legitimateInterests,11)&&Object.keys(t.purpose.legitimateInterests).every(n=>/^(2|[789]|1[01])$/.test(n))&&Z(t.vendor.disclosedVendors,65535)&&Z(t.vendor.consents,t.vendor.disclosedVendors)&&Z(t.vendor.legitimateInterests,t.vendor.disclosedVendors)&&Z(t.specialFeatureOptins,2)&&[e.consents,e.legitimateInterests,e.customPurpose.consents,e.customPurpose.legitimateInterests].every(n=>Z(n,0))&&Zs(e.restrictions)}function $n(t,e){return`${t}\0${JSON.stringify(e)}`}var ke=4095,Gn=1,jn=10;function ot(t){return[...new Set(t)].sort((e,n)=>e-n).join(",")}var at=class{config;framework;#e;#t;#s=[];#n=null;#r=!1;#i="granular";#c=new Set;#o;constructor(e,n,s,r){this.config=e,this.framework=r,this.#e=Math.random()<e.sampleRate,this.#t=s.getConsentId()!==void 0;let o=typeof window<"u"?window.__1C_AB:void 0;if(this.#o=o?{abTestId:o.testId,abVariant:o.variant}:void 0,typeof document>"u"||(n.on("monitoring:error",c=>this.#f(c.payload.code)),!this.#e))return;n.on("view:transition",c=>{c.payload.to!=="none"&&this.#a()}),n.on("view:change",c=>{c.payload.view!=="none"&&this.#a()}),n.on("consent:accepted-all",()=>{this.#i="accept_all"}),n.on("consent:rejected-all",()=>{this.#i="deny_all"}),n.on("consent:rejected",()=>{this.#i="deny_all"}),n.on("consent:saved",()=>this.#d());let i=()=>{document.visibilityState==="hidden"&&this.#u()};document.addEventListener("visibilitychange",i),window.addEventListener("pagehide",()=>this.#u())}#a(){if(this.#n!==null)return;let e=Date.now();this.#n=e,this.#s.push({type:"impression",ts:e,hasConsentStored:this.#t,framework:this.framework,...this.#o})}#d(){if(this.#n===null||this.#r)return;this.#r=!0;let e=Date.now();this.#s.push({type:"decision",ts:e,hasConsentStored:this.#t,framework:this.framework,action:this.#i,tToConsentMs:e-this.#n,...this.#o}),this.#u()}#f(e){this.#c.has(e)||(this.#c.add(e),this.#s.push({type:"monitoring",ts:Date.now(),hasConsentStored:this.#t,framework:this.framework,code:e,...this.#o}),this.#u())}#u(){if(this.#s.length===0)return;let e=JSON.stringify({id:crypto.randomUUID(),token:this.config.token,events:this.#s});this.#s=[];let n=`${this.config.url}/v1/analytics`;typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(n,new Blob([e],{type:"text/plain"}))||fetch(n,{method:"POST",body:e,keepalive:!0}).catch(()=>{})}};function L(t){if(!t.startsWith("consent:"))return null;let e=t.slice(8).split(".");if(e.length!==2)return null;let[n,s]=e;return n!=="gdpr"&&n!=="tcf"&&n!=="us"||!s?null:{framework:n,entity:s}}function Wt(t){return L(t)!==null}var Ne=class{version=0;getVersion(){return this.version}increment(){return++this.version}reset(){this.version=0}};function G(t,e){let n={};for(let s of t.categories)n[`category:${s.id}`]=e[s.id]===!0;for(let s of t.services)n[`service:${s.id}`]=e[s.id]===!0;return n}function Ve(t,e){if(!Mt(e)||e.consentEpoch<(t.consentEpoch??0)||e.structuralVersion!==D(t.services,t.categories))return;if(e.gpcRevocable&&Le())return G(t,{});let n={};for(let s of t.categories)n[`category:${s.id}`]=e.categories[s.id]===!0;for(let s of t.services)n[`service:${s.id}`]=e.services[s.id]===!0;return n}function de(t,e){for(let n of Object.keys(t))if(t[n]===!0&&e[n]!==!0)return!0;return!1}function ue(t){return t.consentDowngradeBehavior??Dt}function Kn(t,e){if(!/^[0-9a-z]+$/.test(t))throw new Error(`Invalid consent string: ${e} is not canonical base36`);let n=Number.parseInt(t,36);if(!Number.isSafeInteger(n)||n.toString(36)!==t)throw new Error(`Invalid consent string: ${e} is not a safe canonical integer`);return n}function er(t){if(!/^[A-Za-z0-9_-]*$/.test(t)||t.length%4===1)return!1;try{let e=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=atob(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")===t}catch{return!1}}var b=class t{static encode(e){let n=[e.machine,e.configId,e.version.toString(36),e.framework,e.state];return e.state==="G"&&e.payload&&n.push(`${e.payload.mode}${e.payload.bits}`),n.push(e.language),n.push(e.timestamp.toString(36)),n.join(".")}static decode(e,n={}){let s=e.split("."),r=s[0],o=s[1],i=s[2],c=s[3],a=s[4];if(r!=="P"&&r!=="S"&&r!=="D")throw new Error("Invalid consent string: unsupported machine");if(!o)throw new Error("Invalid consent string: missing config id");if(!i)throw new Error("Invalid consent string: missing codec version");let l=Kn(i,"codec version");if(l!==1)throw new Error("Invalid consent string: unsupported codec version");if(c!=="gdpr"&&c!=="tcf"&&c!=="us")throw new Error("Invalid consent string: unsupported framework");if(a!=="A"&&a!=="D"&&a!=="G")throw new Error("Invalid consent string: unsupported state");let d=a==="G"?8:7;if(s.length!==d)throw new Error("Invalid consent string: noncanonical component count");let u,p=5;if(a==="G"){let h=s[5];if(!h)throw new Error("Invalid consent string: missing granular payload");let g=h[0],I=h.slice(1);if(g!=="a"&&g!=="d"||!er(I))throw new Error("Invalid consent string: malformed granular payload");u={mode:g,bits:I},p=6}let y=s[p],f=s[p+1];if(!y||!f)throw new Error("Invalid consent string: missing language or timestamp");let S=Kn(f,"timestamp"),v=Math.floor(Date.now()/1e3),m=n.maxFutureSkewSeconds??0;if(S<=0||!Number.isSafeInteger(v)||v<0||!Number.isSafeInteger(m)||m<0||S>v+m)throw new Error("Invalid consent string: timestamp is not a past positive instant");let T={machine:r,configId:o,version:l,framework:c,state:a,...u?{payload:u}:{},language:y,timestamp:S};if(t.encode(T)!==e)throw new Error("Invalid consent string: noncanonical encoding");return T}static decodeForConfig(e,n){let s=t.decode(e);if(s.machine!==n.machine||s.configId!==n.appId||s.framework!==n.framework.type)throw new Error("Invalid consent string: decision identity does not match live config");return s}static encodeBitset(e){let n=e.filter(Boolean).length,s=e.length-n,r=n<=s?"a":"d",o=r==="a",i=new Uint8Array(Math.ceil(e.length/8));for(let a=0;a<e.length;a++)if(e[a]===o){let l=Math.floor(a/8),d=a%8;i[l]|=1<<d}let c=btoa(String.fromCharCode(...i)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return{mode:r,bits:c}}static decodeBitset(e,n){let s=e.bits.replace(/-/g,"+").replace(/_/g,"/"),r=atob(s),o=new Uint8Array(r.length);for(let a=0;a<r.length;a++)o[a]=r.charCodeAt(a);let i=e.mode,c=new Array(n).fill(i!=="a");for(let a=0;a<n;a++){let l=Math.floor(a/8),d=a%8;l<o.length&&o[l]&1<<d&&(c[a]=i==="a")}return c}};var Yt=class{#e;#t=new Map;#s=[];#n=!1;constructor(){this.#e=this.#r()}#r(){let e="__1c_storage_test__";try{localStorage.setItem(e,"test");let n=localStorage.getItem(e);return localStorage.removeItem(e),n==="test"}catch{return!1}}getItem(e){if(this.#e)try{return localStorage.getItem(e)}catch{this.#e=!1}return this.#t.get(e)??null}setItem(e,n){if(this.#e)try{localStorage.setItem(e,n);return}catch{this.#e=!1}this.#t.set(e,n),this.#i()}onPersistenceFailure(e){this.#s.push(e),this.#n&&e()}#i(){if(!this.#n){this.#n=!0;for(let e of this.#s)e()}}removeItem(e){if(this.#e)try{localStorage.removeItem(e)}catch{this.#e=!1}this.#t.delete(e)}isLocalStorageAvailable(){return this.#e}},Q=new Yt;var ee=Symbol(),Fe=Symbol(),Hn=Symbol(),j=Symbol(),zn=Symbol(),F=Symbol(),fe=Symbol(),R=Symbol(),Re=Symbol(),Me=Symbol(),ct=Symbol(),qn=Symbol(),he=Symbol(),w=Symbol(),tr={run:On,isActive:Bt},ge=class{lease;coordinator;constructor(e,n=tr){this.lease=e,this.coordinator=n}withExclusiveAccess(e){return(Q.isLocalStorageAvailable()?this.coordinator.run:An)(s=>{let r=this.lease;this.lease=s;try{let o=e();if(o instanceof Promise)throw new Error("[OneConsentStorage] Writes must be synchronous.");return o}finally{this.lease=r}})}isExclusiveAccessHeld(){return Bt(this.lease)||this.coordinator.isActive(this.lease)}assertExclusiveAccess(){if(!this.isExclusiveAccessHeld())throw new Error("[OneConsentStorage] Write requires exclusive access.")}read(){return Q.getItem(oe)}write(e){this.assertExclusiveAccess(),Q.setItem(oe,e)}remove(){this.assertExclusiveAccess(),Q.removeItem(oe)}};function K(){return Math.floor(Date.now()/1e3)}function me(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Wn(t){return me(t)&&typeof t.updatedAt=="number"&&me(t.frameworks)&&(t.consentContinuityRevision===void 0||typeof t.consentContinuityRevision=="number"&&Number.isSafeInteger(t.consentContinuityRevision)&&t.consentContinuityRevision>=0)&&(t.consentId===void 0||typeof t.consentId=="string")}function lt(t){return me(t)&&(t.type==="gdpr"||t.type==="tcf"||t.type==="us")&&(t.machine==="P"||t.machine==="S"||t.machine==="D")&&typeof t.configVersion=="number"&&(t.consentEpoch===void 0||typeof t.consentEpoch=="number"&&Number.isSafeInteger(t.consentEpoch)&&t.consentEpoch>=0)&&(t.tcfPolicyVersion===void 0||typeof t.tcfPolicyVersion=="number"&&Number.isSafeInteger(t.tcfPolicyVersion)&&t.tcfPolicyVersion>=0)&&typeof t.primaryLanguage=="string"&&typeof t.updatedAt=="number"&&(t.consentContinuityKey===void 0||typeof t.consentContinuityKey=="string")&&[t.consentDecisionAt,t.consentInvalidatedAt].every(e=>e===void 0||typeof e=="number"&&Number.isSafeInteger(e)&&e>=0)}function pe(t,e){return t.type===e.type&&t.machine===e.machine&&(t.consentEpoch??0)>=e.consentEpoch&&(e.tcfPolicyVersion===void 0||t.tcfPolicyVersion===e.tcfPolicyVersion)&&t.primaryLanguage===e.primaryLanguage}function Se(t,e){let s=rt(t).apps[e.appId];if(!Wn(s)||e.consentContinuityRevision!==void 0&&(s.consentContinuityRevision??0)>e.consentContinuityRevision)return;let r=s.frameworks[e.frameworkId];return lt(r)&&pe(r,e)?r:void 0}function Yn(t){let e={};return t.tcString!==void 0&&(e.tcString=t.tcString),t.uspString!==void 0&&(e.uspString=t.uspString),t.gppString!==void 0&&(e.gppString=t.gppString),t.limitSensitiveUse!==void 0&&(e.limitSensitiveUse=t.limitSensitiveUse),e}function Xt(t){let e={consent:t.value,firstSeenAt:t.firstSeenAt,lastSeenAt:t.lastSeenAt,...Yn(t)};return Xn(e)?e:void 0}function nr(t){return{value:t.consent,firstSeenAt:t.firstSeenAt,lastSeenAt:t.lastSeenAt,...Yn(t)}}var Jt=10,Be=class{[he];[w];constructor(e,n){this[he]=e,this[w]=n}withExclusiveAccess(e){return this[he].withExclusiveAccess?this[he].withExclusiveAccess(e):Promise.resolve(e())}[ee](e){return e.consentDecisionAt??(e.consent?.lastSeenAt??0)*1e3}[Fe](e){let n=this[R](e);return n&&pe(n,this[w])?n:void 0}[Hn](e,n,s){}getContinuityScopes(){return[]}getScope(){return this[w]}[j](){try{return rt(this[he].read())}catch{return ie()}}[zn](e){this[he].write(JSON.stringify(e))}[F](e){let n=this[j](),s=e(n);return this[zn](n),s}[fe](e){let n=e.apps[this[w].appId];return Wn(n)?n:void 0}[R](e){let n=this[fe](e)?.frameworks[this[w].frameworkId];return lt(n)&&n.type===this[w].type?n:void 0}[Re](e,n){let s=this[fe](e);if(s)return s.updatedAt=n,s;let r={updatedAt:n,frameworks:{}};return e.apps[this[w].appId]=r,r}[Me](e,n){let s=this[Re](e,n),r=s.frameworks[this[w].frameworkId];if(lt(r)&&pe(r,this[w]))return r.updatedAt=n,r;let o={type:this[w].type,machine:this[w].machine,configVersion:this[w].configVersion,consentEpoch:this[w].consentEpoch,tcfPolicyVersion:this[w].tcfPolicyVersion,primaryLanguage:this[w].primaryLanguage,updatedAt:n};return lt(r)&&(r.type===this[w].type&&(o.prior=r.consent??r.prior),r.outbox&&(o.outbox=r.outbox)),s.frameworks[this[w].frameworkId]=o,o}[ct](e){let n=this[R](e);if(n&&(n.consentEpoch??0)>this[w].consentEpoch)throw new Error("[OneConsentStorage] A newer consent epoch is already stored.")}getConsent(){return this.getConsentSnapshot()?.content}getConsentSnapshot(){let e=this[Fe](this[j]());if(!e?.consent)return;let n=Xt(e.consent);return n?{content:n,decisionAt:this[ee](e)}:void 0}getLatestConsent(){return this.getLatestConsentSnapshot()?.content}getLatestConsentSnapshot(){let e=this[R](this[j]()),n=e?.consent??e?.prior;if(e&&(e.consentInvalidatedAt??0)>=Math.max(this[ee](e),(n?.lastSeenAt??0)*1e3))return;let s=n?Xt(n):void 0;return s&&e?{content:s,decisionAt:this[ee](e),prior:!0}:void 0}getContents(){let e=this.getConsent();return e?[e]:[]}getConsentId(){return this[fe](this[j]())?.consentId}setConsentId(e){let n=K();this[F](s=>{this[Re](s,n).consentId=e})}updateConsent(e,n){if(!this[fe](this[j]())?.consentId)throw new Error("[OneConsentStorage] Call setConsentId() before storing consent.");let s=K(),r={...e,firstSeenAt:s,lastSeenAt:s};Xn(r)&&this[F](o=>this[qn](o,r,n,s))}[qn](e,n,s,r){this[ct](e);let o=this[Fe](e)?.consent,i=this[Me](e,r);return i.machine=this[w].machine,i.configVersion=this[w].configVersion,i.consentEpoch=this[w].consentEpoch,this[w].tcfPolicyVersion===void 0?delete i.tcfPolicyVersion:i.tcfPolicyVersion=this[w].tcfPolicyVersion,i.primaryLanguage=this[w].primaryLanguage,i.consent=nr({...n,firstSeenAt:o?.firstSeenAt??r,lastSeenAt:r}),s&&(i.fastPath=s),i.consentDecisionAt=Math.max(Date.now(),this[ee](i)+1,(i.consentInvalidatedAt??0)+1),delete i.consentInvalidatedAt,delete i.prior,i}refreshFastPath(e,n){this.setFastPath(e)}updateConsentLocale(e,n){let s=K();this[F](r=>{this[ct](r);let o=this[Fe](r),i=o?.consent?Xt(o.consent):void 0;if(!o||!i||JSON.stringify({content:i,decisionAt:this[ee](o)})!==JSON.stringify(e))throw new Error("[OneConsentStorage] Consent changed during locale refresh.");let c=this[Me](r,s);c.consent={...o.consent,value:n,firstSeenAt:i.firstSeenAt,lastSeenAt:i.lastSeenAt},c.consentDecisionAt=this[ee](o),o.fastPath&&(c.fastPath=o.fastPath),this[Hn](r,c,s)})}setFastPath(e){let n=K();this[F](s=>{this[ct](s),this[Me](s,n).fastPath=e})}getFastPath(){let e=this[Fe](this[j]());if(e&&it(e.fastPath))return e.fastPath}removeFastPath(){let e=K();this[F](n=>{let s=this[R](n);!s||!pe(s,this[w])||(s.consentEpoch??0)!==this[w].consentEpoch||(delete s.fastPath,s.updatedAt=e,this[Re](n,e))})}invalidateConsent(){let e=K();return this[F](n=>{let s=this[R](n);return!s||!pe(s,this[w])||(s.consentEpoch??0)!==this[w].consentEpoch?!1:(delete s.consent,delete s.fastPath,s.updatedAt=e,this[Re](n,e),!0)})}removeAll(){this[F](e=>{let n=this[fe](e),s=this[R](e);!n||!s||!pe(s,this[w])||(delete n.frameworks[this[w].frameworkId],n.updatedAt=K(),Object.keys(n.frameworks).length===0&&!n.experiment&&delete e.apps[this[w].appId])})}getPendingEvents(){let e=this[R](this[j]())?.outbox?.consentEvents;return Array.isArray(e)?e.filter(sr):[]}queuePendingEvent(e){let n=this.getPendingEvents().filter(r=>r.eventId!==e.eventId);n.push(e),n.length>Jt&&console.warn(`[OneConsentStorage] Event queue full \u2014 dropping ${n.length-Jt} oldest`);let s=K();this[F](r=>{this[Me](r,s).outbox={consentEvents:n.slice(-Jt)}})}removePendingEvent(e){let n=this.getPendingEvents().filter(s=>s.eventId!==e);this[F](s=>{let r=this[R](s);r&&(n.length?r.outbox={consentEvents:n}:delete r.outbox)})}};function sr(t){return me(t)&&typeof t.url=="string"&&typeof t.eventId=="string"&&me(t.payload)}function Xn(t){return!me(t)||typeof t.consent!="string"||t.consent.length<5||typeof t.firstSeenAt!="number"||typeof t.lastSeenAt!="number"||t.tcString!==void 0&&typeof t.tcString!="string"||t.uspString!==void 0&&typeof t.uspString!="string"||t.gppString!==void 0&&typeof t.gppString!="string"||t.limitSensitiveUse!==void 0&&typeof t.limitSensitiveUse!="boolean"?!1:!(t.tcString!==void 0&&(t.uspString!==void 0||t.gppString!==void 0))}function Jn(t,e){let n=Se(e,ae(t));return Ve(t,n?.fastPath)}function Zt(t,e){let n=Se(e,ae(t)),s=n?.consent??(t.framework.type==="us"?n?.prior:void 0);if(!s)return;let r=s.value;try{b.decodeForConfig(s.value,t),r=s.value.replace(/\.[^.]+(\.[^.]+)$/,"$1")}catch{r=`!${r}`}return JSON.stringify([r,s.tcString,s.uspString,s.gppString,s.limitSensitiveUse])}var Ue=class{externalReconciliationPending=!1;beginExternalConsentReconciliation(e,n){return this.hasExternalConsentChange(e,n)?(this.externalReconciliationPending=!0,this.bus.emit({type:"consent:pending"}),!0):!1}isExternalConsentReconciliationPending(){return this.externalReconciliationPending}bus;storage;config;constructor(e,n,s){this.bus=e,this.storage=n,this.config=s}withExclusiveAccess(e){return this.storage.withExclusiveAccess(e)}getConfig(){return this.config}getDisplayLocale(){return this.config.languages.primary}getExternalConsentSnapshot(e){return Jn(this.config,e)}getCurrentExternalConsentSnapshot(){let e=this.getEnforcementConsentState();if(e.hasConsent)return G(this.config,{...e.categories,...e.services})}shouldReloadForExternalConsentChange(e,n){if(ue(this.config)!=="reload")return!1;let s=e===null&&n===null?this.getCurrentExternalConsentSnapshot():this.getExternalConsentSnapshot(e);if(!s)return!1;let r=this.getExternalConsentSnapshot(n)??{};return de(s,r)}hasExternalConsentChange(e,n){return e!==null||n!==null?Zt(this.config,e)!==Zt(this.config,n):this.getCurrentExternalConsentSnapshot()!==void 0}emit(e,n){this.bus.emit({type:e,payload:n})}on(e,n){this.bus.on(e,n)}getEnforcementConsentState(){return this.getConsentState()}};function $e(t){if(typeof window>"u")return;let e=window.__1CONSENT_REACT_FASTPATH__;if(e)try{if(typeof e.apply!="function"||typeof e.resolve!="function"||typeof e.reconcile!="function"||typeof e.destroy!="function"||e.appId!==t.appId||e.frameworkId!==t.framework.id||e.frameworkType!==t.framework.type||e.machine!==t.machine||e.primaryLanguage!==t.languages.primary||e.consentEpoch!==(t.consentEpoch??0)||e.structuralVersion!==D(t.services,t.categories))return;if(e.supportsPendingConsent!==!0||typeof e.updateConsent!="function"||typeof e.promote!="function"){e.destroy();return}return e.reconcile()?e:void 0}catch{return}}function rr(){let t=globalThis;return typeof t.scheduler=="object"?t.scheduler:void 0}function dt(t){let e=rr();if(e?.postTask)try{e.postTask(t,{priority:"user-visible"});return}catch{}setTimeout(t,0)}function Zn(){let t=[],e=!1,n=!1,s,r,o=()=>{if(!(e||n)){for(e=!0;!n&&t.length>0;){let i=t.shift();if(!i)break;if(!i.slot.isConnected||!i.allowed())continue;let c=i.recreate(i.source),a=c.hasAttribute("type")?c.type.trim().toLowerCase():c.getAttribute("language")?`text/${c.getAttribute("language")?.trim().toLowerCase()}`:"",l=a===""||/^(?:application|text)\/(?:x-)?(?:java|ecma)script$/.test(a)||/^text\/(?:javascript1\.[0-5]|jscript|livescript)$/.test(a);if(c.src&&l&&!c.hasAttribute("async")&&!c.defer&&!c.noModule){let d=new MutationObserver(()=>{c.isConnected||u()}),u=()=>{s===p&&(p(),e=!1,o())},p=()=>{d.disconnect(),c.removeEventListener("load",u),c.removeEventListener("error",u),s=void 0,r=void 0};s=p,r=()=>{(!c.isConnected||!i.allowed())&&(p(),e=!1)},c.addEventListener("load",u),c.addEventListener("error",u),d.observe(i.slot.ownerDocument,{childList:!0,subtree:!0}),i.slot.replaceWith(c),c.isConnected||u();return}i.slot.replaceWith(c)}e=!1}};return{activate(i,c,a,l){let d=Array.from(i.querySelectorAll("script"),p=>{let y=document.createComment("1c-script");return p.replaceWith(y),{source:p,slot:y,allowed:a,recreate:l}}),u=!e;e=!0,t.push(...d);try{c(i)}finally{u&&(e=!1),o()}},setPaused(i){n=i},recheck(){if(!n){r?.();for(let i=t.length-1;i>=0;i--){let c=t[i];c&&(!c.slot.isConnected||!c.allowed())&&t.splice(i,1)}}},flush:o,clear(){t.length=0,s?.(),e=!1}}}function Qn(){return typeof window>"u"?void 0:window.__1CONSENT_CONFIG__}function es(t,e={}){let n=document.createElement("script");for(let s of t.attributes)n.setAttribute(s.name,s.value);t.src?t.hasAttribute("async")||(n.async=!1):n.text=t.text||t.textContent||"";for(let s of e.removeAttributes??[])n.removeAttribute(s);return n}var ir=[..._e,Pe].map(t=>`template[${t}]:not([${jt}])`).join(",");function or(){return document.readyState==="loading"?new Promise(t=>document.addEventListener("DOMContentLoaded",()=>t(),{once:!0})):Promise.resolve()}function ts(t){return JSON.stringify([t.appId,t.framework.id,t.framework.type,t.machine,t.languages.primary,t.consentEpoch??0])}var ut=class{config;#e=Zn();#t;#s;#n=!1;#r;#i={services:{},categories:{}};constructor(e){this.config=e,this.#t=D(e.services,e.categories),this.#s=ts(e)}setConsent(e,n,s=!1){this.#e.setPaused(s),this.#n=s,n!==void 0&&(this.#r=n===0?void 0:n),this.#i=De(this.config.services,this.config.categories,e.services,e.categories),this.#e.recheck()}#c(){let e=Qn();return e!==void 0&&ts(e)===this.#s&&D(e.services,e.categories)===this.#t}async unblockTemplates(e){if(this.#n)return[];if(this.setConsent(e),await or(),this.#n||!this.#c())return[];this.#e.flush();let n=document.querySelectorAll(ir);if(!n.length)return[];let s=new Set;for(let r=0;r<n.length;r++){let o=n[r];if(!o)continue;let i=this.#o(o,this.#i.services,this.#i.categories);if(!i)continue;s.add(i);let c=o.content.cloneNode(!0);c instanceof DocumentFragment&&this.#e.activate(c,a=>o.replaceWith(a),()=>this.#c()&&this.#o(o,this.#i.services,this.#i.categories)!==void 0,a=>es(a,{removeAttributes:[..._e,Pe]}))}return Array.from(s)}#o(e,n,s){if(this.#r!==void 0&&Date.now()>this.#r)return;for(let o of _e){let i=e.getAttribute(o);if(i!==null)return n[i]===!0?i:void 0}let r=e.getAttribute(Pe);if(r!==null&&s[r]===!0)return r}};function ar(t){return typeof t=="object"&&t!==null&&"translations"in t&&"themeCSS"in t}var cr=250;function Ge(t,e){return`${t}::${e}`}function ft(t){return t==="details"?"details":t==="trigger"?"trigger":"notice"}var M=class{config;services;bus;storage;viewEngine;#e;#t=null;#s=new Map;#n=new Map;#r=null;#i="auto";analytics;#c=!1;constructor(e,n){this.config=e,this.services=n,this.bus=n.bus,this.storage=n.storage,this.viewEngine=n.viewEngine,this.#e=e.languages.primary,e.analytics&&(this.analytics=new at(e.analytics,this.bus,this.storage,e.framework.type),Q.onPersistenceFailure(()=>{this.bus.emit({type:"monitoring:error",payload:{code:"optout_write_error"}})}))}attachBlocking(e){if(this.#c)throw new Error("[1ConsentController] blocking is already attached");this.#c=!0;let n=new ut(this.config),s=()=>{let r=e.getEnforcementConsentState(),o=this.storage.getFastPath()?.expiresAt??0,i=e.isExternalConsentReconciliationPending();n.setConsent(r,o,i);let c=this.#o();c&&c.updateConsent(r.services);let a=$e(this.config);if(a)try{let l=De(this.config.services,this.config.categories,r.services,r.categories);a.updateConsent(l.services,l.categories,o,i)}catch{}dt(()=>{if(c?.unblock(),a){a.promote();return}n.unblockTemplates(e.getEnforcementConsentState()).catch(l=>{console.error("Template promotion failed",l)})})};this.bus.on("consent:saved",()=>s()),this.bus.on("consent:pending",()=>s()),this.bus.on("consent:external",()=>{s(),e.isConsentRequired()&&this.openNotice().catch(()=>{})}),s()}#o(){if(typeof window>"u"||!this.config.autoblocker?.enabled)return;let e=window.__1CONSENT_AUTOBLOCKER__;if(!e){console.error("Autoblocker missing");return}if(!(e.scope.appId!==this.config.appId||e.scope.frameworkId!==this.config.framework.id))return e}resolveInitialLocale(e){if(!e||e===this.#e)return;let n=this.config.languages.supported.find(s=>s===e);n&&(this.#e=n,this.bus.emit({type:"language:changed",payload:{locale:n}}))}getLanguage(){return this.#e}getTranslations(){return this.#t}async setLanguage(e){if(e===this.#e&&this.#t)return;let n=ft(this.viewEngine?.getCurrentView()),s=this.#s.get(Ge(e,n));if(s){this.#t=s,this.#e=e,await this.storage.withExclusiveAccess(()=>this.bus.emit({type:"language:changed",payload:{locale:e}}));return}let r=await this.#a(e,n);if(r===null)throw new Error(`[1Consent] ui-data for ${e}/${n} unavailable`);this.#t=r.translations,this.#e=e,await this.storage.withExclusiveAccess(()=>this.bus.emit({type:"language:changed",payload:{locale:e}}))}hasViewData(e){return e==="none"?!0:this.#s.has(Ge(this.#e,ft(e)))}async ensureViewData(e){if(e==="none")return;let n=this.#e,s=ft(e),r=this.#s.get(Ge(n,s));if(r){this.#t=r;return}let o=await this.#a(n,s);o?.translations&&n===this.#e&&(this.#t=o.translations)}#a(e,n){let s=Ge(e,n),r=this.#n.get(s);if(r)return r;let o=(async()=>{try{let i=await this.#d(e,n);return this.#u(e,n,i),i}catch(i){return this.#n.delete(s),console.error(`[1Consent] ui-data for ${s} unavailable after retry \u2014 the consent UI will render WITHOUT translations/theme:`,i),null}})();return this.#n.set(s,o),o}async#d(e,n){try{return await this.#f(e,n)}catch{return await new Promise(s=>setTimeout(s,cr)),await this.#f(e,n)}}async#f(e,n){let s=this.config.cmp.uiData.replace("{locale}",e).replace("{view}",n),r=await fetch(s);if(!r.ok)throw new Error(`HTTP ${r.status}`);let o=await r.json();if(!ar(o))throw new Error(`unexpected ui-data payload shape for ${e}/${n}`);return o.translations?{...o,translations:this.normalizeTranslations(o.translations,e,o.contentLanguage)}:o}normalizeTranslations(e,n,s){return e}#u(e,n,s){s.translations&&this.#s.set(Ge(e,n),s.translations),s.themeCSS!==this.#r&&(this.#r=s.themeCSS,this.viewEngine?.setThemeCSS(s.themeCSS)),s.translations&&e===this.#e&&this.#t===null&&this.viewEngine&&this.viewEngine.getCurrentView()!=="none"&&ft(this.viewEngine.getCurrentView())===n&&(this.#t=s.translations,this.viewEngine.refreshCurrentView())}getThemeMode(){return this.#i}setThemeMode(e){this.#i=e,this.bus.emit({type:"theme:changed",payload:{mode:e}})}#h;#l;setViewEngine(e){this.viewEngine=e,this.#r!==null&&e.setThemeCSS(this.#r)}setViewEngineFactory(e){this.#h=e}async ensureViewEngine(){if(!this.viewEngine&&this.#h){this.#l??=this.#h().catch(n=>{throw this.#l=void 0,n});let e=await this.#l;this.viewEngine||(this.viewEngine=e,this.#r!==null&&e.setThemeCSS(this.#r))}return this.viewEngine}get activeViewEngine(){return this.viewEngine}async showReturningVisitorTrigger(){if(!kt(this.config))return;let e=this.ensureViewData("trigger"),n=await this.ensureViewEngine();n&&(await Promise.all([this.ensureViewLoaded("trigger"),e]),await n.transitionTo("trigger","consent-given"))}async openNotice(){let e=await this.ensureViewEngine();e&&await e.transitionTo("main","programmatic")}async openDetails(){let e=await this.ensureViewEngine();e&&await e.transitionTo("details","programmatic")}async close(){this.viewEngine&&await this.viewEngine.transitionTo("none","programmatic")}async ensureViewLoaded(e){let n=await this.ensureViewEngine();!n||n.hasDesign(e)||await n.ensureViewBundle(e)}};var je=class{#e=new Map;on(e,n){let s=this.#e.get(e);return s||(s=new Set,this.#e.set(e,s)),s.add(n),()=>this.off(e,n)}off(e,n){let s=this.#e.get(e);s&&s.delete(n)}emit(e){let n=this.#e.get(e.type);if(n)for(let s of n)s(e)}};function ns(t,e,n){let s=e();return s?Promise.resolve(s):new Promise((r,o)=>{let i=document.createElement("script");i.src=t,i.async=!0,i.onload=()=>{let c=e();c?r(c):(i.remove(),o(new Error(`[1consent] ${n} bundle loaded but did not register runtime`)))},i.onerror=()=>{i.remove(),o(new Error(`[1consent] failed to load ${n} bundle: ${i.src}`))},(document.head||document.documentElement).appendChild(i)})}async function ht(t){let e=typeof navigator<"u"&&!!navigator.locks;if(t.consentContinuity===void 0&&e)return new Be(new ge,ae(t));let n=new URL(`${t.cmp.base}/runtime/experiment.v${t.signalsVersion||"1.0.0"}.js`,document.baseURI).href,s=await ns(n,()=>{let r=window.__1CONSENT_EXPERIMENT_STORAGE__;return r?.source===n?r:void 0},"experiment storage");return s.create(t,new ge(void 0,e?void 0:s.coordinator))}function ss(t,e){let n=[...t.services.filter(s=>!s.essential).map(s=>s.id),...t.categories.filter(s=>!s.essential).map(s=>s.id)];return n.length===0||n.every(s=>e[s]===!0)?"A":n.every(s=>!e[s])?"D":"G"}function Ke(t,e,n,s){let r=Kt(t.services,t.categories,e,e,n),o={structuralVersion:r.v,consentEpoch:t.consentEpoch??0,expiresAt:r.e,services:r.s,categories:r.c,...n?.decisionIntegrity?{decisionIntegrity:n.decisionIntegrity}:{},...n?.tcfCmpId!==void 0?{tcfCmpId:n.tcfCmpId}:{},...n?.tcfValidationVersion!==void 0?{tcfValidationVersion:n.tcfValidationVersion}:{},...n?.tcfDisclosedVendorKey!==void 0?{tcfDisclosedVendorKey:n.tcfDisclosedVendorKey}:{},...n?.tcfApiData!==void 0?{tcfApiData:n.tcfApiData}:{},...n?.tcfApiDataIntegrity!==void 0?{tcfApiDataIntegrity:n.tcfApiDataIntegrity}:{},...r.g===1?{gpcRevocable:!0}:{},...r.p===1?{posture:!0}:{}};if(s)s(o);else try{if(typeof localStorage>"u")throw new Error("localStorage unavailable");ht(t).then(i=>i.withExclusiveAccess(()=>i.setFastPath(o))).catch(i=>console.error("[1Consent] Fast-path persistence failed",i))}catch{}return n?.cookieMode==="clear"?B(t):n?.cookieMode!=="omit"&&dr(t,e,r),$e(t)?.updateConsent(r.s,r.c,r.e),dt(()=>lr(t)),r}function lr(t){try{$e(t)?.promote()}catch{}}function pt(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0).toString(36)}function B(t){if(!(typeof document>"u"))try{let e=`${le}=`,s=document.cookie.split(";").map(o=>o.trim()).find(o=>o.startsWith(e))?.slice(e.length),r=qt(s);if(r&&Ie(r.expiresAt)&&(r.appId!==t.appId||r.frameworkId!==t.framework.id||r.frameworkType!==t.framework.type||r.machine!==t.machine||r.primaryLanguage!==t.languages.primary||r.consentEpoch>(t.consentEpoch??0)))return;document.cookie=`${le}=; Path=/; SameSite=Lax; Max-Age=0`}catch{}}function dr(t,e,n){if(!(typeof document>"u")){if(!t.syncCookie||!Ie(n.e)){B(t);return}try{let s=zt({decision:ss(t,e),appId:t.appId,frameworkId:t.framework.id,frameworkType:t.framework.type,machine:t.machine,primaryLanguage:t.languages.primary,structuralVersion:n.v,consentEpoch:t.consentEpoch??0,expiresAt:n.e}),r=typeof location<"u"&&location.protocol==="https:",o=[`${le}=${s}`,"Path=/","SameSite=Lax",`Expires=${new Date(n.e).toUTCString()}`];r&&o.push("Secure"),document.cookie=o.join("; ")}catch{}}}function ur(t){return typeof t=="object"&&t!==null&&"getConsent"in t&&typeof t.getConsent=="function"&&"setConsent"in t&&typeof t.setConsent=="function"&&"acceptAll"in t&&typeof t.acceptAll=="function"&&"rejectAll"in t&&typeof t.rejectAll=="function"&&"setCategoryConsent"in t&&typeof t.setCategoryConsent=="function"&&"setServiceConsent"in t&&typeof t.setServiceConsent=="function"}function Qt(t){let e="engine"in t?t.engine:void 0,n=ur(e)?e:void 0,s=n?new Proxy({...n,setConsent:r=>t.storage.withExclusiveAccess(()=>n.setConsent(r))},{has(r,o){return Reflect.has(n,o)||Reflect.has(r,o)},get(r,o){if(o==="setConsent")return r.setConsent;let i=Reflect.get(n,o,n);if(typeof i!="function")return i;let c=i.bind(n);return["save","reconcileExternalConsentChange"].includes(String(o))?(...a)=>t.storage.withExclusiveAccess(()=>c(...a)):c}}):void 0;return{config:t.config,init:t.init.bind(t),openNotice:t.openNotice.bind(t),openDetails:t.openDetails.bind(t),close:t.close.bind(t),acceptAll:t.acceptAll.bind(t),rejectAll:t.rejectAll.bind(t),getLanguage:t.getLanguage.bind(t),getTranslations:t.getTranslations.bind(t),setLanguage:t.setLanguage.bind(t),getThemeMode:t.getThemeMode.bind(t),setThemeMode:t.setThemeMode.bind(t),bus:t.bus,cmp:{getState:()=>t.activeViewEngine?.getCurrentView()||"none",openCmp:t.openNotice.bind(t),openDetails:t.openDetails.bind(t),close:t.close.bind(t),acceptAll:t.acceptAll.bind(t),rejectAll:t.rejectAll.bind(t)},registerDesign:(r,o)=>t.activeViewEngine?.registerDesign(r,o),getView:()=>{let r="engine"in t?t.engine:void 0;return r&&typeof r=="object"&&"isConsentRequired"in r&&typeof r.isConsentRequired=="function"&&r.isConsentRequired()?"main":null},get engine(){return s},get viewEngine(){return t.activeViewEngine}}}var ms=["center-center","bottom-left","bottom-right","bottom-center"],fr=[...ms,"panel-right"];new Set(ms),new Set(fr);function hr(t){return"tcf"in t&&t.tcf!=null&&typeof t.tcf=="object"}var rs="ar.bg.bs.ca.cs.cy.da.de.el.en.es.et.eu.fi.fr.gl.he.hi.hr.hu.id.is.it.ja.ka.ko.lt.lv.mk.ms.mt.nl.no.pl.pt-br.pt-pt.ro.ru.sk.sl.sq.sr-latn.sr-cyrl.sv.sw.th.tl.tr.uk.vi.zh.zh-hant".split(".");new Set(rs),rs.filter(t=>t.includes("-")).sort((t,e)=>e.length-t.length);function pr(t){if(typeof t!="string")return null;let e=t.trim();if(e.length<2||e.length>255)return null;try{return Intl.getCanonicalLocales(e)[0]??null}catch{return null}}function is(t){return typeof t=="string"&&pr(t)===t}function x(t){return typeof t=="object"&&!!t&&!Array.isArray(t)}function Ss(t){if(!x(t))return!1;let e=t;return!(!(typeof e.appId=="string"&&typeof e.version=="number"&&typeof e.machine=="string"&&x(e.languages)&&typeof e.languages.primary=="string"&&Array.isArray(e.languages.supported)&&e.languages.supported.length>0&&is(e.languages.primary)&&e.languages.supported.every(is)&&new Set(e.languages.supported).size===e.languages.supported.length&&e.languages.supported.includes(e.languages.primary)&&x(e.cmp)&&typeof e.cmp.main=="string"&&typeof e.cmp.uiData=="string"&&typeof e.cmp.serviceDetails=="string"&&Array.isArray(e.categories)&&Array.isArray(e.services)&&Array.isArray(e.scripts)&&typeof e.appearance=="object"&&e.appearance!==null&&typeof e.framework=="object"&&e.framework!==null)||!["P","S","D"].includes(e.machine))}function gr(t){return t.cmp.trigger?t.framework.type==="us"||!!t.appearance?.trigger:!1}function en(t){if(!Ss(t)||t.framework.type!=="tcf"||!("vendorListVersion"in t.framework)||!Number.isSafeInteger(t.framework.vendorListVersion)||t.framework.vendorListVersion<=0||!("vendors"in t)||!Array.isArray(t.vendors))return!1;let e=s=>Array.isArray(s)&&s.every(r=>Number.isSafeInteger(r)&&r>0)&&new Set(s).size===s.length,n=[];for(let s of t.vendors){if(!x(s))return!1;let r=s.id;if(typeof r!="number"||!Number.isSafeInteger(r)||r<=0||!e(s.consentPurposeIds)||!e(s.legitimateInterestPurposeIds)||!e(s.flexiblePurposeIds)||!e(s.specialFeatureIds))return!1;n.push(r)}return new Set(n).size===n.length}function mr(t){return Ss(t)&&t.framework.type==="us"}function os(t){return["openMain","openDetails","close","acceptAll","rejectAll","save","reset"].includes(t)}var nn={open:"openMain",openNotice:"openMain"};function Sr(t,e=nn){if(os(t))return t;let n=e[t];if(!n)throw Error(`[1CL] Unknown command: ${t}. No alias mapping found.`);if(!os(n))throw Error(`[1CL] Invalid alias target: ${t} \u2192 ${n}. Alias targets must be canonical commands.`);return n}function yr(t){return t?{...nn,...t}:nn}function tn(t){return Array.isArray(t)&&t.every(e=>typeof e=="string")}function ys(t){return!t||typeof t!="object"||Object.entries(t).every(([e,n])=>e.endsWith("Url")?/^(https?:\/\/|mailto:[^@\s]+@[^@\s]+$)/i.test(String(n)):ys(n))}function gt(t,e){return Array.isArray(t)&&t.every(n=>x(n)&&e.every(s=>typeof n[s]=="string"))}function wr(t){if(!x(t)||typeof t.id!="string"||typeof t.name!="string")return!1;let e=t.declaration;if(!x(e))return!1;let n=e.deviceStorage,s=e.legalProfile,r=[[e.parties,["key","name","kind"]],[e.dataSources,["name"]],[e.recipients,["name"]],[e.processingLocations,["name"]],[e.retention,["period"]],[e.transfers,["destination"]]].every(([a,l])=>a===void 0||gt(a,l)),o=s==null||x(s)&&typeof s.label=="string"&&[[s.processingGrounds,["basis","label"]],[s.partyRoles,["partyKey","role"]]].every(([a,l])=>gt(a,l))&&tn(s.rights),i=t.operational,c=i==null||x(i)&&(i.domains===void 0||Array.isArray(i.domains)&&i.domains.every(a=>x(a)&&typeof a.domain=="string"&&typeof a.use=="string"))&&(i.sdks===void 0||Array.isArray(i.sdks)&&i.sdks.every(a=>x(a)&&typeof a.name=="string"&&typeof a.use=="string"));return(t.description==null||typeof t.description=="string")&&c&&r&&ys(t)&&gt(e.purposes,["key","name"])&&tn(e.dataCategories)&&tn(e.technologies)&&(n===null||x(n)&&gt(n.items,["key","type"]))&&x(e.links)&&Object.values(e.links).every(a=>typeof a=="string")&&o}function ws(t,e){let n=r=>{let o=r.base?[r.base,...r.path]:r.path;if(o[0]!=="ui"||o[1]!=="templateLabels"||!o[2])return;let i=o[2],c=e.templateLabels?.[i];if(typeof c!="string"||!c.trim())throw Error(`[TemplateLabels] Translate ui.templateLabels.${i} before using this design`)},s=r=>{for(let o of r){if(o.t==="bind"&&n(o.p),o.t==="el"){for(let i of o.attrs)if(i.k==="bind"&&n(i.value),i.k==="concat")for(let c of i.parts)c.k==="bind"&&n(c.v);s(o.kids)}if((o.t==="each"||o.t==="if"||o.t==="if-not")&&s(o.body),o.t==="use"){for(let i of Object.values(o.props))i.k==="path"&&n(i.v);o.children&&s(o.children)}}};for(let r of[...Object.values(t.views),...Object.values(t.components)])s(r)}var Cr=["a[href]","area[href]","button:not([disabled])","input:not([disabled]):not([type='hidden'])","select:not([disabled])","textarea:not([disabled])","iframe","[contenteditable='true']","[tabindex]:not([tabindex='-1'])"].join(",");function Cs(t){return Array.from(t.querySelectorAll(Cr)).filter(e=>e instanceof HTMLElement&&e.getAttribute("tabindex")!=="-1"&&!e.closest("[hidden], [inert], [aria-hidden='true']"))}function vr(t){let e=t.querySelector("[data-1c-initial-focus]");if(e instanceof HTMLElement)return e;let n=t.querySelector("h1, h2, h3, h4, h5, h6");return n instanceof HTMLElement?(n.hasAttribute("tabindex")||(n.tabIndex=-1),n):Cs(t)[0]||(t.hasAttribute("tabindex")||(t.tabIndex=-1),t)}function Er(t){let e=[],n=t;for(;;){let s=n.parentElement;if(s){for(let o of Array.from(s.children))!(o instanceof HTMLElement)||o===n||(e.push({element:o,inert:o.inert}),o.inert=!0);if(s===document.body)break;n=s;continue}let r=n.getRootNode();if(!(r instanceof ShadowRoot))break;for(let o of Array.from(r.children))!(o instanceof HTMLElement)||o===n||(e.push({element:o,inert:o.inert}),o.inert=!0);if(!(r.host instanceof HTMLElement))break;n=r.host}return e}function vs(t,e){let n=Er(e),s=document.documentElement.style,r=s.getPropertyValue("overflow"),o=s.getPropertyPriority("overflow");s.setProperty("overflow","hidden");let i=a=>{if(a.key!=="Tab")return;let l=Cs(t);if(l.length===0){a.preventDefault(),t.focus({preventScroll:!0});return}let d=l[0],u=l[l.length-1];if(!d||!u)return;let p=t.getRootNode(),y=p instanceof ShadowRoot?p.activeElement:document.activeElement;a.shiftKey&&(y===d||!t.contains(y))?(a.preventDefault(),u.focus({preventScroll:!0})):!a.shiftKey&&(y===u||!t.contains(y))&&(a.preventDefault(),d.focus({preventScroll:!0}))};t.addEventListener("keydown",i),vr(t).focus({preventScroll:!0});let c=!0;return()=>{if(c){c=!1,t.removeEventListener("keydown",i);for(let a of n)a.element.inert=a.inert;r?s.setProperty("overflow",r,o):s.removeProperty("overflow")}}}var as=new Map,ye=null,sn=null,rn=0;async function cs(t,e,n,s,r,o){if(ye?.dataset.serviceId===t)return;let i=r||document.body,c=(i instanceof ShadowRoot?i.activeElement:null)??document.activeElement,a=c instanceof HTMLElement?c:null;He();let l=++rn,d=e.cmp.serviceDetails.replace("{serviceId}",encodeURIComponent(t)),u=`${d}${d.includes("?")?"&":"?"}schema=2`,p=o??as.get(u);if(!p){let h=await br(t,u);if(!h)return;as.set(u,h),p=h}if(l!==rn)return;let y=s();if(!y)throw Error("[Modal] Missing i18n");ws(n,y);let f=document.createElement("div");f.dataset.serviceId=t,_t(n,{service:p,ui:y},f,{view:"service-detail"}),ye=f,i.appendChild(ye);let S=f.querySelector('[role="dialog"]'),v=S instanceof HTMLElement?vs(S,f):()=>{},m=f.querySelector(".oc-service-modal__overlay");m?.addEventListener("click",h=>{h.target===m&&He()}),f.querySelector('[data-1c="command:closeServiceDetail"]')?.addEventListener("click",h=>{h.preventDefault(),He()});let T=h=>{h.key==="Escape"&&He()};document.addEventListener("keydown",T),sn=()=>{v(),document.removeEventListener("keydown",T),a?.isConnected&&a.focus({preventScroll:!0})},requestAnimationFrame(()=>{m?.classList.add("oc-service-modal--visible")})}function He(){if(rn+=1,!ye)return;let t=ye,e=sn;ye=null,sn=null,e?.(),t.remove()}async function br(t,e){try{let n=await fetch(e);if(n.ok){let s=await n.json();if(wr(s))return s}}catch{}return console.error(`[ServiceDetail] Request failed for ${t}`),null}function Tr(t,e){let n=e.split("-")[0]==="de";if(t===null)return n?"Nicht zutreffend":"Not applicable";if(t===0)return n?"Sitzung":"Session";let s=[{unit:"day",seconds:86400},{unit:"hour",seconds:3600},{unit:"minute",seconds:60},{unit:"second",seconds:1}],r=t,o=[];for(let i of s){let c=Math.floor(r/i.seconds);r%=i.seconds,c>0&&o.push(new Intl.NumberFormat(e,{style:"unit",unit:i.unit,unitDisplay:"short"}).format(c))}return o.join(" ")}function ls(t){let e=t.indexOf(":");return e===-1?(console.warn(`[1CL] Invalid command binding format: ${t}`),null):{type:t.substring(0,e).trim(),name:t.substring(e+1).trim()}}function ds(t,e){let n=Sr(e,yr()),s={openMain:()=>t.cmp.openCmp(),openDetails:()=>t.cmp.openDetails(),close:()=>t.cmp.close(),acceptAll:()=>t.cmp.acceptAll(),rejectAll:()=>t.cmp.rejectAll(),save:()=>t.cmp.save?.(),reset:()=>t.cmp.reset?.(),closeServiceDetail:()=>He()}[n];s?s():console.warn(`[1CL] Unknown canonical command: ${n}`)}function us(t,e){let n={notice:()=>t.cmp?.openCmp(),details:()=>t.cmp?.openDetails(),close:()=>t.cmp?.close()}[e];n?n():console.warn(`[1CL] Unknown view command: ${e}`)}function Ir(t,e,n){if(!t.engine){console.error("[1CL] SDK engine not available");return}let s=n.querySelector('input[type="checkbox"]');if(s){let r=s.checked;if(e.startsWith("category:")){let o=e.substring(9);fs(t.engine,`category:${o}`,r)}else if(e.startsWith("service:")){let o=e.substring(8);fs(t.engine,`service:${o}`,r)}}}function fs(t,e,n){return e.startsWith("category:")?(t.setCategoryConsent(e.substring(9),n),!0):e.startsWith("service:")?(t.setServiceConsent(e.substring(8),n),!0):!1}function Ar(t,e){let n=s=>{let r=s.target,o=r.getAttribute?.("data-1c-backdrop");if(o){let l=ls(o);l&&(s.preventDefault(),l.type==="view"?us(e,l.name):ds(e,l.name));return}let i=r.closest("[data-1c]");if(!i)return;let c=i.getAttribute("data-1c");if(!c)return;let a=ls(c);if(a)switch(a.type){case"command":s.preventDefault(),ds(e,a.name);break;case"view":s.preventDefault(),us(e,a.name);break;case"consent":Ir(e,a.name,i);break;case"dataset":s.preventDefault(),Or(e,a.name,i);break;default:console.warn(`[1CL] Unknown command type: ${a.type}`)}};return t.addEventListener("click",n),()=>{t.removeEventListener("click",n)}}function Or(t,e,n){let s=t.viewEngine,r=t.getShadowRoot?.();switch(e){case"serviceDetail":{let o=n.getAttribute("data-1c-id");if(!o){console.warn("[1CL] dataset:serviceDetail missing data-1c-id");return}let i=s?.getCompiledView?.("service-detail");if(!i){console.warn("[1CL] No compiled service-detail template found");return}cs(o,t.config,i,t.getTranslations,r??void 0).catch(c=>{console.error("[1CL] Failed to open service detail modal:",c)});break}case"vendorStorage":{let o=n.getAttribute("data-1c-id");if(!o){console.warn("[1CL] dataset:vendorStorage missing data-1c-id");return}let i=n.getAttribute("data-1c-name")??`Vendor ${o}`,c=s?.getCompiledView?.("service-detail");if(!c){console.warn("[1CL] No compiled service-detail template found");return}xr(o,i,t.config,t.getLanguage()).then(a=>{a&&cs(`vendor-${o}`,t.config,c,t.getTranslations,r??void 0,a).catch(l=>{console.error("[1CL] Failed to open vendor storage modal:",l)})}).catch(a=>{console.error("[1CL] Failed to fetch vendor storage:",a)});break}default:console.warn(`[1CL] Unknown dataset command: ${e}`)}}async function xr(t,e,n,s=n.languages.primary){let r=new URL(n.cmp.serviceDetails.replace("{serviceId}","__tcf_vendor_selector__"),window.location.href),o=r.pathname.match(/^\/v\/([^/]+)\/services\/__tcf_vendor_selector__(?:\.json)?$/)?.[1];if(!o)return null;let i=new URL(`/v/${o}/tcf-vendors/${encodeURIComponent(t)}/storage.json`,r.origin),c=r.searchParams.get("version"),a=r.searchParams.get("stage");if(c)i.searchParams.set("version",c);else if(a==="preview")i.searchParams.set("stage",a);else return null;let l=await fetch(i);if(!l.ok)return null;let d=await l.json();if(!$t(d))return null;let u=d.disclosures,p=d.domains??[],y=d.sdks??[];if(u.length===0&&p.length===0&&y.length===0)return null;let f=u.map(m=>{let T=Tr(m.maxAgeSeconds,s),h=[m.description,m.domains.length>0?`Domains: ${m.domains.join(", ")}`:void 0,m.purposes.length>0?`Purposes: ${m.purposes.map(g=>`P${g}`).join(", ")}`:m.specialPurposes.length===0?"Non-TCF purpose":void 0,m.specialPurposes.length>0?`Special purposes: ${m.specialPurposes.map(g=>`SP${g}`).join(", ")}`:void 0,m.optOut?"Opt-out mechanism":void 0,m.cookieRefresh?"Refreshed":void 0].filter(g=>!!g);return{key:m.identifier,type:m.type,duration:T,description:h.join(" \xB7 ")}}),S=Array.from(new Set(u.flatMap(m=>m.purposes).map(m=>`Purpose ${m}`))),v=Array.from(new Set([...u.map(m=>m.type),...y.map(m=>`SDK: ${m.name}`)]));return{id:`vendor-${t}`,name:e,...S.length>0&&{purposes:S},...v.length>0&&{technologiesUsed:v},...f.length>0&&{storage:{items:f}},operational:p.length>0||y.length>0?{...p.length>0&&{domains:p},...y.length>0&&{sdks:y}}:null,declaration:{purposes:S.map((m,T)=>({key:String(T),name:m})),dataCategories:[],technologies:v,deviceStorage:f.length>0?{items:f.map(m=>({...m,type:m.type==="cookie"?"cookie":"other"}))}:null,links:{}}}}var _r=class mt{index=new Map;static makeKey(e,n){return`${e}::${n??""}`}add(e,n,s){let r=mt.makeKey(e,n);this.index.has(r)||this.index.set(r,new Set),this.index.get(r)?.add(s)}remove(e,n,s){let r=mt.makeKey(e,n),o=this.index.get(r);o&&(o.delete(s),o.size===0&&this.index.delete(r))}get(e,n){let s=mt.makeKey(e,n);return this.index.get(s)??new Set}getAllBindings(){let e=[];for(let[n,s]of this.index.entries()){let[r,o]=n.split("::");for(let i of s){let c={element:i,bindingKey:r};o&&(c.id=o),e.push(c)}}return e}clear(){this.index.clear()}get size(){let e=0;for(let n of this.index.values())e+=n.size;return e}},hs=new WeakMap;function ze(t){let e=hs.get(t);return e||(e=new _r,hs.set(t,e)),e}function Pr(t,e){let n=[],s=ze(e),r='[data-1c^="consent:"][data-1c-id]',o='[data-1c="consent:us.sale"], [data-1c="consent:us.share"], [data-1c="consent:us.saleAndShare"]',i=[...t.querySelectorAll(r),...t.querySelectorAll(o)];(t.matches(r)||t.matches(o))&&i.push(t);for(let c of i){if(!(c instanceof HTMLInputElement))continue;let a=c.getAttribute("data-1c");if(!a)continue;let l=c.getAttribute("data-1c-id")||void 0;s.add(a,l,c);let d={element:c,bindingKey:a};l&&(d.id=l),n.push(d)}return n}function Dr(t,e){let n=ze(e),s='[data-1c^="consent:"][data-1c-id]',r='[data-1c="consent:us.sale"], [data-1c="consent:us.share"], [data-1c="consent:us.saleAndShare"]',o=[...t.querySelectorAll(s),...t.querySelectorAll(r)];(t.matches(s)||t.matches(r))&&o.push(t);for(let i of o){if(!(i instanceof HTMLInputElement))continue;let c=i.getAttribute("data-1c");if(!c)continue;let a=i.getAttribute("data-1c-id")||void 0;n.remove(c,a,i)}}function on(t,e){t.checked=e.value,t.disabled=e.disabled,t.setAttribute("aria-checked",String(e.value)),t.setAttribute("aria-disabled",String(e.disabled))}function an(t,e,n){let s=ze(e);for(let r of t){let o=s.get(r.bindingKey,r.id);for(let i of o)on(i,{value:r.value??i.checked,disabled:r.disabled??i.disabled})}}function Es(t,e,n){let s=Pr(t,e);if(s.length===0)return;let r=s.map(o=>({bindingKey:o.bindingKey,id:o.id}));try{let o=n.engine;if(n.engine&&typeof o.resolveMany=="function"){let i=o.resolveMany(r);an(i.patches,e,i.version)}else for(let i of s)try{if(!n.engine?.resolve||!Wt(i.bindingKey))continue;let c=i.id?{bindingKey:i.bindingKey,id:i.id}:{bindingKey:i.bindingKey},a=n.engine.resolve(c);a&&on(i.element,a)}catch(c){console.error("[1CL] Failed to resolve binding:",i,c)}}catch(o){console.error("[1CL] Failed to hydrate bindings:",o)}}function Lr(t,e){Dr(t,e)}function kr(t,e){let n=new MutationObserver(s=>{for(let r of s){for(let o of r.addedNodes)o instanceof HTMLElement&&Es(o,t,e);for(let o of r.removedNodes)o instanceof HTMLElement&&Lr(o,t)}});return n.observe(t,{childList:!0,subtree:!0}),()=>{n.disconnect()}}function Nr(t,e){let n=!1,s=r=>{if(n)return;let o=r.target;if(!(o instanceof HTMLInputElement))return;let i=o.getAttribute("data-1c");if(!i?.startsWith("consent:"))return;let c=o.getAttribute("data-1c-id")||"",a=o.checked;try{if(!e.engine)return;let l=e.engine.apply({ref:{bindingKey:i,id:c},value:a,source:"ui"});n=!0,an(l.patches,t,l.version),n=!1}catch(l){console.error("[1CL] Failed to apply consent change:",l);try{let d=e.engine.resolve({bindingKey:i,id:c});n=!0,on(o,d),n=!1}catch(d){console.error("[1CL] Failed to revert state:",d)}}};return t.addEventListener("change",s,!0),()=>{t.removeEventListener("change",s,!0)}}function Vr(t,e){Es(t,t,e);let n=Nr(t,e),s=kr(t,e),r=e.bus.on("consent:changed",()=>{let o=ze(t).getAllBindings().map(i=>({bindingKey:i.bindingKey,id:i.id}));try{let i=e.engine;if(e.engine&&typeof i.resolveMany=="function"){let c=i.resolveMany(o);an(c.patches,t,c.version)}}catch(i){console.error("[1CL] Failed to reconcile on consent:changed:",i)}});return()=>{n(),s(),r(),ze(t).clear()}}function Fr(t){if(!t)throw Error("[1CL State] SDK instance is missing");if(!t.viewEngine)throw Error("[1CL State] SDK viewEngine is missing");if(!t.viewEngine.getCurrentView)throw Error("[1CL State] viewEngine.getCurrentView method is missing");let e=t.viewEngine.getCurrentView(),n=Mr(e),{position:s,spacing:r,logoAlign:o,buttonOrder:i,buttonAlign:c,buttonEmphasis:a}=Ur(t,n);return{state:e==="none"?"closed":"open",load:"ready",theme:Rr(t),layer:n,framework:Br(t),position:s,spacing:r,logoAlign:o,buttonOrder:i,buttonAlign:c,buttonEmphasis:a}}function Rr(t){if(!t.config)throw Error("[1CL State] SDK config is missing");let e=typeof t.getThemeMode=="function"?t.getThemeMode():"auto";return e==="light"||e==="dark"?e:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Mr(t){return t==="main"?"notice":t==="details"?"details":"trigger"}function Br(t){if(!t.config)throw Error("[1CL State] SDK config is missing");if(!t.config.framework)throw Error("[1CL State] Framework configuration is missing");if(!t.config.framework.type)throw Error("[1CL State] Framework type is missing");let e=t.config.framework.type.toLowerCase();if(e==="tcf"||e==="us"||e==="gdpr")return e;throw Error(`[1CL State] Unknown framework type: ${e}`)}function Ur(t,e){let n=t.config?.appearance,s=n?.notice,r={logoAlign:s?.logoAlignment||"left",buttonOrder:s?.buttonOrder||"reject-first",buttonAlign:s?.buttonAlignment||"right",buttonEmphasis:s?.buttonEmphasis||"equal"};if(!n)return{position:"bottom-center",spacing:"default",...r};if(e==="trigger"&&n.trigger)return{position:n.trigger.position||"bottom-right",spacing:n.trigger.size||"default",...r};let o=e==="details"?n.details:n.notice;return{position:o?.position||"bottom-center",spacing:o?.size||"default",...r}}function $r(t,e){let n=t.getRootNode(),s=n instanceof ShadowRoot?n.host:t;s.setAttribute("data-1c-state",e.state),s.setAttribute("data-1c-load",e.load),s.setAttribute("data-1c-theme",e.theme),s.setAttribute("data-1c-layer",e.layer),s.setAttribute("data-1c-framework",e.framework),s.setAttribute("data-1c-position",e.position),s.setAttribute("data-1c-spacing",e.spacing),s.setAttribute("data-1c-logo-align",e.logoAlign),s.setAttribute("data-1c-button-order",e.buttonOrder),s.setAttribute("data-1c-button-align",e.buttonAlign),s.setAttribute("data-1c-button-emphasis",e.buttonEmphasis)}function ps(t,e){$r(t,Fr(e))}function Gr(t,e){ps(t,e);let n=()=>{ps(t,e)},s=["view:transition","consent:changed","theme:changed"];return s.forEach(r=>{e.bus.on(r,n)}),()=>{s.forEach(r=>{e.bus.off(r,n)})}}function jr(t){return"getOptOutOfSale"in t&&"getOptOutOfShare"in t&&"isGpcDetected"in t&&"getLimitSensitiveUse"in t&&"getSensitivePIInUse"in t}function Kr(t,e,n){let s=Object.values(t.stacks),r=new Set(s.flatMap(f=>f.purposes)),o=new Set(s.flatMap(f=>f.specialFeatures)),i=new Set(n.flatMap(f=>f.specialFeatureIds)),c=Object.values(t.specialFeatures).filter(f=>i.has(f.id)),a=n.map(f=>{let S=t.vendors[f.id];if(!S)throw Error(`TCF UI data is missing configured vendor ${f.id}`);let v=new Set(f.consentPurposeIds),m=new Set(f.legitimateInterestPurposeIds),T=new Set(f.flexiblePurposeIds),h=new Set(f.specialFeatureIds);return{...S,purposes:S.purposes.filter(g=>v.has(g)),purposes_data:S.purposes_data.filter(g=>v.has(g.id)),legIntPurposes:S.legIntPurposes.filter(g=>m.has(g)),legIntPurposes_data:S.legIntPurposes_data.filter(g=>m.has(g.id)),flexiblePurposes:S.flexiblePurposes.filter(g=>T.has(g)),flexiblePurposes_data:S.flexiblePurposes_data.filter(g=>T.has(g.id)),specialFeatures:S.specialFeatures.filter(g=>h.has(g)),specialFeatures_data:S.specialFeatures_data.filter(g=>h.has(g.id))}}),l=Object.values(t.purposes).map(f=>{let S=a.filter(m=>m.purposes.includes(f.id)).length,v=a.filter(m=>m.legIntPurposes.includes(f.id)).length;return{...f,consentVendorCount:S,legitimateInterestVendorCount:v,hasConsentVendors:S>0,hasLegitimateInterestVendors:v>0}}),d=new Set(l.filter(f=>f.hasConsentVendors).map(f=>f.id)),u=s.map(f=>({...f,hasConsentControls:f.purposes.some(S=>d.has(S))||f.specialFeatures.length>0})),p=l.filter(f=>f.hasLegitimateInterestVendors),y=a.filter(f=>f.legIntPurposes.length>0).length;return{standardTexts:t.standardTexts,...e==="main"?{stacks:u,purposes:l.filter(f=>!r.has(f.id))}:{purposes:l},specialPurposes:Object.values(t.specialPurposes),dataCategories:Object.values(t.dataCategories),features:Object.values(t.features),specialFeatures:e==="main"?c.filter(f=>!o.has(f.id)):c,vendors:a,vendorCount:a.length,legitimateInterestPurposes:p,legitimateInterestVendorCount:y,hasLegitimateInterests:y>0}}function Hr(t){try{let e=t.split("-")[0];return new Intl.DisplayNames([e],{type:"language"}).of(e)??t}catch{return t}}function gs(t,e,n){let s=t?.[e];return{name:s?.name??n??e,...s?.description&&{description:s.description}}}var zr=["data-1c","data-1c-action"],bs=class{getThemeMode;currentView="none";bus;consentEngine;config;container=null;shadowRoot=null;renderTarget=null;cleanupFunctions=[];focusReturnTarget=null;currentLocale;viewLoadPromises=new Map;transitionIntent=0;pendingDismissalWork=null;translationsProvider;themeCSS=null;controllerOpenDetails;controllerSetLanguage;languageChangePending=!1;ensureViewData;hasViewData;constructor(t,e,n,s,r,o,i,c=()=>"auto"){this.getThemeMode=c,this.bus=t,this.consentEngine=e,this.translationsProvider=n??(()=>null),this.controllerOpenDetails=s,this.ensureViewData=r??(async()=>{}),this.hasViewData=o??(()=>!0),this.controllerSetLanguage=i,this.config=e.getConfig(),this.currentLocale=e.getDisplayLocale(),this.consentEngine.on("consent:changed",()=>this.handleConsentChange()),this.bus.on("view:change",a=>{if(a&&typeof a=="object"&&"payload"in a){let l=a.payload?.view;l&&this.transitionTo(l)}}),this.consentEngine.on("consent:saved",()=>this.handleConsentSaved()),this.consentEngine.on("consent:external",()=>{this.consentEngine.hasValidConsent()&&this.handleConsentSaved()}),this.consentEngine.on("consent:accepted-all",()=>this.handleConsentSaved()),this.consentEngine.on("consent:rejected-all",()=>this.handleConsentSaved()),this.bus.on("language:changed",a=>{if(a&&typeof a=="object"&&"payload"in a){let l=a.payload;l?.locale&&(this.currentLocale=l.locale)}this.currentView!=="none"&&this.mount(this.currentView)})}getCurrentView(){return this.currentView}hasDesign(t){return this.bundles.has(t)}setThemeCSS(t){if(this.themeCSS=t,!this.shadowRoot)return;let e=this.shadowRoot.getElementById("1c-style-theme");if(t===null){e?.remove();return}if(e)e.textContent=t;else{let n=document.createElement("style");n.id="1c-style-theme",n.textContent=t,this.shadowRoot.append(n)}}refreshCurrentView(){this.currentView!=="none"&&this.mount(this.currentView)}getCompiledView(t){return this.bundles.get(t)}canCloseView(t){switch(t){case"main":return this.config.showClose===!0||!this.consentEngine.isConsentRequired();case"details":return!0;case"trigger":return!0;case"none":return!0}}async transitionTo(t,e="programmatic"){let n=this.currentView;if(n===t)return this.pendingDismissalWork&&(this.transitionIntent+=1),!0;if(!this.isValidTransition(n,t))return console.warn(`[ViewEngine] Invalid transition: ${n} \u2192 ${t}`),!1;if(t==="trigger"&&!this.triggerEnabled())return console.warn("[ViewEngine] Trigger view is disabled for this configuration"),!1;if((t==="none"||t==="trigger")&&e!=="consent-given"&&!this.canCloseView(n))return console.warn(`[ViewEngine] Cannot close current view: ${n}`),!1;let s=++this.transitionIntent;if(t!=="none"&&this.pendingDismissalWork&&(await this.pendingDismissalWork,s!==this.transitionIntent))return!1;if(t!=="none"){let a=!this.bundles.has(t),l=this.ensureViewData(t);if(a||!this.hasViewData(t)){let[d]=await Promise.all([a?this.ensureViewBundle(t):Promise.resolve(!0),l]);if(s!==this.transitionIntent)return console.warn(`[ViewEngine] Transition ${n} \u2192 ${t} superseded by a newer transition`),!1;if(!d)return console.error(`[ViewEngine] View bundle unavailable: ${t}`),this.bus.emit({type:"monitoring:error",payload:{code:"render_error"}}),t==="trigger"&&this.transitionTo("none",e)}}let r=this.isModalView(n),o=this.isModalView(t);o&&!r&&this.captureFocusReturnTarget();let i={from:n,to:t,reason:e};this.bus.emit({type:"view:before-transition",payload:i}),this.currentView=t;let c=!0;if(t==="none"){for(let a of this.cleanupFunctions)a();this.cleanupFunctions=[],this.renderTarget&&(this.renderTarget.innerHTML="")}else c=this.mountSafely(t);return c?(this.bus.emit({type:"view:transition",payload:i}),r&&!o&&this.restoreFocusAfterModal(),!0):(this.currentView=n,n==="none"||this.mountSafely(n)||(this.currentView="none",this.renderTarget&&(this.renderTarget.innerHTML=""),this.bus.emit({type:"view:transition",payload:{from:n,to:"none"}})),o&&!r&&this.restoreFocusAfterModal(),!1)}isModalView(t){return t==="details"||t==="main"&&this.config.appearance?.showOverlay===!0}activeHTMLElement(){let t=this.shadowRoot?.activeElement;return t instanceof HTMLElement?t:document.activeElement instanceof HTMLElement?document.activeElement:null}captureFocusReturnTarget(){if(this.focusReturnTarget)return;let t=this.activeHTMLElement();if(!(!t||t===document.body||t===document.documentElement)){for(let e of zr){let n=t.getAttribute(e);if(n){this.focusReturnTarget={element:t,binding:{attribute:e,value:n}};return}}this.focusReturnTarget={element:t}}}restoreFocusAfterModal(){let t=this.focusReturnTarget;if(this.focusReturnTarget=null,!t)return;if(t.element.isConnected){t.element.focus({preventScroll:!0});return}if(!t.binding||!this.renderTarget)return;let e=this.renderTarget.querySelectorAll(`[${t.binding.attribute}]`);for(let n of e)if(n instanceof HTMLElement&&n.getAttribute(t.binding.attribute)===t.binding.value){n.focus({preventScroll:!0});return}}isValidTransition(t,e){return{none:["main","details","trigger"],main:["details","trigger","none"],details:["main","trigger","none"],trigger:["main","details","none"]}[t]?.includes(e)??!1}triggerEnabled(){return gr(this.config)}initialize(){this.consentEngine.isConsentRequired()?this.transitionTo("main","consent-required"):this.triggerEnabled()&&this.transitionTo("trigger","consent-given")}handleConsentChange(){if(this.currentView==="trigger"&&this.consentEngine.isConsentRequired()){this.transitionTo("main","consent-required");return}}handleConsentSaved(){(this.currentView==="main"||this.currentView==="details")&&this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","consent-given")}dismissModalThenTransition(t,e,n){let s=this.currentView,r=s==="main"||s==="details";if(!r&&!n){this.transitionTo(t,e);return}let o=this.transitionIntent+ +!!r,i=(r?new Promise(a=>window.setTimeout(a,0)):Promise.resolve()).then(async()=>{try{return await c?await n?.()??{to:t,reason:e}:void 0}finally{this.pendingDismissalWork===i&&(this.pendingDismissalWork=null)}});n&&(this.pendingDismissalWork=i);let c=r?this.transitionTo("none",e):Promise.resolve(!0);i.then(a=>{a&&(a.to!=="none"||!r)&&o===this.transitionIntent&&(this.currentView==="none"||!r)&&this.transitionTo(a.to,a.reason)}).catch(a=>{console.error("[1Consent] Consent action failed",a),this.transitionTo("main","user-action")})}saveDecision(t){this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","consent-given",()=>this.consentEngine.withExclusiveAccess(()=>{t?.(),this.consentEngine.save()}))}openNotice(){this.transitionTo("main","user-action")}openDetails(){this.transitionTo("details","user-action")}closeCurrentView(){let t=this.currentView;if(!this.canCloseView(t)){console.warn(`[ViewEngine] Cannot close ${t} - consent required`),this.bus.emit({type:"view:close-blocked",payload:{view:t,reason:"consent-required"}});return}if(t==="main"&&this.config.showClose===!0&&this.config.closeMeans==="reject"){this.saveDecision(()=>this.consentEngine.rejectAll());return}if(t==="main"&&this.config.showClose===!0){this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","user-action");return}if(t==="details"){this.dismissModalThenTransition("none","user-action",()=>this.consentEngine.withExclusiveAccess(()=>{if(this.consentEngine.reconcileExternalConsentChange(null,null,!0),this.consentEngine.isConsentRequired())return{to:"main",reason:"consent-required"};if(this.consentEngine.hasValidConsent()&&this.triggerEnabled())return{to:"trigger",reason:"consent-given"}}));return}this.consentEngine.hasValidConsent()?this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","consent-given"):this.transitionTo("main","consent-required")}bundles=new Map;registerDesign(t,e){let n=Object.keys(t.views);if(n.length===0){console.error("[ViewEngine] Registered design has no views");return}for(let s of n){let r=s.split(".").pop()||"main",o={version:t.version,views:{[r]:t.views[s]},components:t.components},i=e||t.css;i&&(o.css=i),this.bundles.set(r,o),this.currentView===r&&this.mount(r)}}viewBundleUrl(t){let e=this.config.cmp;if(t==="main")return e.main;if(t==="details")return e.details;if(t==="trigger")return e.trigger}loadViewScript(t){return new Promise((e,n)=>{let s=document.createElement("script");s.src=t,s.async=!0,s.onload=()=>e(),s.onerror=r=>{s.remove(),n(r)},(document.head||document.documentElement).appendChild(s)})}ensureViewBundle(t){if(this.bundles.has(t))return Promise.resolve(!0);let e=this.viewBundleUrl(t);if(!e)return Promise.resolve(!1);let n=this.viewLoadPromises.get(t);return n||(n=this.loadViewScript(e).then(()=>{let s=this.bundles.has(t);return s||this.viewLoadPromises.delete(t),s}).catch(s=>(console.error(`[ViewEngine] Failed to load view '${t}':`,s),this.viewLoadPromises.delete(t),!1)),this.viewLoadPromises.set(t,n)),n}closeToNone(){this.renderTarget&&(this.renderTarget.innerHTML=""),this.currentView="none",this.bus.emit({type:"view:change",payload:{view:"none"}})}mountSafely(t){try{return this.mount(t)}catch(e){return console.error(`[ViewEngine] Failed to mount view ${t}:`,e),this.bus.emit({type:"monitoring:error",payload:{code:"render_error"}}),!1}}mount(t){for(let h of this.cleanupFunctions)h();this.cleanupFunctions=[];let e=this.bundles.get(t);if(!e)return t!=="none"&&(console.warn(`[ViewEngine] No bundle found for view: ${t}`),this.closeToNone()),!1;if(this.container||(this.container=document.getElementById("1c-cmp-container"),this.container||(this.container=document.createElement("div"),this.container.id="1c-cmp-container",(document.body||document.documentElement).appendChild(this.container))),this.shadowRoot||(this.shadowRoot=this.container.attachShadow({mode:"open"}),this.renderTarget=document.createElement("div"),this.renderTarget.id="1c-cmp-root",this.shadowRoot.appendChild(this.renderTarget)),this.themeCSS){let h=this.shadowRoot.getElementById("1c-style-theme");h||(h=document.createElement("style"),h.id="1c-style-theme",this.shadowRoot.prepend(h)),h.textContent=this.themeCSS}if(e.css){let h=`1c-style-${t}`,g=this.shadowRoot.getElementById(h);g||(g=document.createElement("style"),g.id=h,this.shadowRoot.prepend(g)),g.textContent=e.css}let n=this.translationsProvider()??{},s=hr(n)?n.tcf.gvl:void 0,r=(en(this.config)?this.config.vendors??[]:[]).length,o=h=>{let g={};for(let[I,C]of Object.entries(h))typeof C=="string"?g[I]=C.replace(/%VENDORS_COUNT%/g,String(r)):Array.isArray(C)?g[I]=C:C&&typeof C=="object"?g[I]=o(C):g[I]=C;return g},i=en(this.config)?o(n):n,c=mr(this.config)?this.config.us?.doNotSellLinkUrl:void 0,a=c&&Array.isArray(i.legalLinks)&&i.legalLinks.some(h=>h.url==="/do-not-sell")?i.legalLinks.map(h=>h.url==="/do-not-sell"?{...h,url:c}:h):i.legalLinks,l=(this.config.services||[]).map(h=>({...h,...gs(i.vendors?.services,h.id,h.name??h.tag)}));ws(e,i);let d={config:this.config,consent:{categories:this.consentEngine.getCategoryConsents(),services:this.consentEngine.getServiceConsents()},ui:{view:t,...i,...a===i.legalLinks?{}:{legalLinks:a}},categories:(this.config.categories||[]).map(h=>({...h,...gs(i.vendors?.categories,h.id,h.name),services:l.filter(g=>g.categoryId===h.id)})).filter(h=>h.services.length>0),services:l,appearance:{...this.config.appearance,useSwitchCategories:this.config.appearance?.categoryToggleType==="switch",useCheckboxCategories:this.config.appearance?.categoryToggleType!=="switch",useSwitchServices:this.config.appearance?.serviceToggleType!=="checkbox",useCheckboxServices:this.config.appearance?.serviceToggleType==="checkbox",showClose:this.config.showClose===!0},framework:this.config.framework,languages:{...this.config.languages,current:this.currentLocale,showSelector:this.config.languages.supported.length>1,options:this.config.languages.supported.map(h=>({code:h,label:this.config.languages.labels?.[h]??Hr(h)}))},...s?{tcf:Kr(s,t,en(this.config)?this.config.vendors??[]:[])}:{},...jr(this.consentEngine)?{us:{optedOutOfSale:this.consentEngine.getOptOutOfSale(),optedOutOfShare:this.consentEngine.getOptOutOfShare(),gpcDetected:this.consentEngine.isGpcDetected(),sensitivePIInUse:this.consentEngine.getSensitivePIInUse(),limitSensitiveUse:this.consentEngine.getLimitSensitiveUse()}}:{}},u=this.renderTarget;if(!u)return console.error("[ViewEngine] Shadow root render target is missing"),!1;try{_t(e,d,u,{view:t})}catch(h){return console.error(`[ViewEngine] Failed to mount view ${t}:`,h),this.bus.emit({type:"monitoring:error",payload:{code:"render_error"}}),!1}let p=u.querySelector('[role="dialog"]'),y=this.isModalView(t);p instanceof HTMLElement&&(p.setAttribute("aria-modal",y?"true":"false"),y&&this.cleanupFunctions.push(vs(p,this.container)));let f=u.querySelector("select[data-1c-lang]");if(f instanceof HTMLSelectElement&&(f.value=this.currentLocale,f.disabled=this.languageChangePending,f.onchange=()=>{if(this.languageChangePending)return;let h=this.config.languages.supported.find(C=>C===f.value),g=this.controllerSetLanguage;if(!h||!g)return;f.disabled=!0,this.languageChangePending=!0;let I;try{I=g(h)}catch(C){I=Promise.reject(C)}I.catch(C=>{let P=this.renderTarget?.querySelector("select[data-1c-lang]");P instanceof HTMLSelectElement&&(P.value=this.currentLocale),console.error("[ViewEngine] Language switch failed",C)}).finally(()=>{this.languageChangePending=!1;let C=this.renderTarget?.querySelector("select[data-1c-lang]");C instanceof HTMLSelectElement&&(C.disabled=!1)})}),u.textContent?.includes("[")){if(u.textContent?.includes("[ul]")){let P=/\[ul]([\s\S]*?)\[\/ul]/g,k=/\[li]([\s\S]*?)\[\/li]/g,N=document.createTreeWalker(u,NodeFilter.SHOW_TEXT),_=[],O;for(;O=N.nextNode();)O.textContent?.includes("[ul]")&&_.push(O);for(let te of _){let q=te.textContent||"",ne=document.createDocumentFragment(),V=0;P.lastIndex=0;let A;for(;(A=P.exec(q))!==null;){A.index>V&&ne.appendChild(document.createTextNode(q.slice(V,A.index)));let se=document.createElement("ul");se.className="oc-list";let nt=A[1];k.lastIndex=0;let yn;for(;(yn=k.exec(nt))!==null;){let wn=document.createElement("li");wn.textContent=yn[1],se.appendChild(wn)}ne.appendChild(se),V=A.index+A[0].length}V<q.length&&ne.appendChild(document.createTextNode(q.slice(V))),te.parentNode?.replaceChild(ne,te)}}let h=/\[([abi])(?:\s+([^\]]*))?](.*?)\[\/\1]/g,g=document.createTreeWalker(u,NodeFilter.SHOW_TEXT),I=[],C;for(;C=g.nextNode();)C.textContent&&h.test(C.textContent)&&(I.push(C),h.lastIndex=0);for(let P of I){let k=P.textContent||"",N=document.createDocumentFragment(),_=0;h.lastIndex=0;let O;for(;(O=h.exec(k))!==null;){O.index>_&&N.appendChild(document.createTextNode(k.slice(_,O.index)));let te=O[1],q=O[2]||"",ne=O[3],V;if(te==="a"){let A=document.createElement("a");A.className="oc-link";let se=q.match(/href="([^"]*)"/),nt=q.match(/action="([^"]*)"/);nt?(A.href="#",A.setAttribute("data-1c-action",nt[1])):se?(A.href=se[1],A.target="_blank",A.rel="noopener noreferrer"):A.href="#",V=A}else V=te==="b"?document.createElement("strong"):document.createElement("em");V.textContent=ne,N.appendChild(V),_=O.index+O[0].length}_<k.length&&N.appendChild(document.createTextNode(k.slice(_))),P.parentNode?.replaceChild(N,P)}}let S={config:this.config,engine:this.consentEngine,getLanguage:()=>this.currentLocale,getTranslations:()=>this.translationsProvider(),cmp:{getState:()=>this.currentView,openCmp:()=>this.transitionTo("main","programmatic"),openDetails:()=>this.controllerOpenDetails?this.controllerOpenDetails().then(()=>!0):this.transitionTo("details","programmatic"),close:()=>this.closeCurrentView(),acceptAll:()=>this.saveDecision(()=>this.consentEngine.acceptAll()),rejectAll:()=>this.saveDecision(()=>this.consentEngine.rejectAll()),save:()=>this.saveDecision(),reset:()=>this.consentEngine.reset?.()},viewEngine:this,bus:this.bus,getThemeMode:this.getThemeMode,getShadowRoot:()=>this.shadowRoot},v=Vr(u,S),m=Ar(u,S),T=Gr(this.container,S);return this.cleanupFunctions.push(v,m,T),!0}};var St=class extends Ue{on(e,n){return this.bus.on(e,n)}off(e,n){this.bus.off(e,n)}emit(e,n){this.bus.emit({type:e,payload:n})}};var H=class extends St{validatedStoredDecision;state;versionTracker=new Ne;#e;#t;#s=!1;#n;#r;constructor(e,n,s){super(e,n,s),this.#r=s.languages.primary,this.state=this.#o();let r=Ve(s,n.getFastPath());this.#t=r!==void 0||this.#s,this.#e=r??(this.#s?G(this.config,this.#f()):{}),this.state.hasConsent&&this.#p()&&this.invalidateStoredConsent(),this.bus.on("language:changed",o=>{this.#i(o.payload.locale)});try{this.bootSyncsFastPath()&&(this.state.hasConsent&&this.hasValidConsent()?(this.syncFastPath(),this.mergeConsentDowngradeBaseline(G(this.config,this.#f()))):(this.storage.removeFastPath(),B(this.config)))}catch{}this.#h()}bootSyncsFastPath(){return!0}syncFastPath(e){Ke(this.config,this.getFastPathConsentMap(),this.getFastPathSyncOptions(),e??(n=>this.storage.refreshFastPath(n,this.validatedStoredDecision)))}reconcileExternalConsentChange(e,n,s=!1){if(!(!s&&!this.hasExternalConsentChange(e,n))){this.externalReconciliationPending=!1;try{this.reloadExternalConsentState(s)}catch(r){throw this.externalReconciliationPending=!0,r}this.versionTracker.increment(),s||this.mergeConsentDowngradeBaseline(this.getConsentDowngradeSnapshot()),this.emit("consent:changed"),s||this.emit("consent:external")}}reloadExternalConsentState(e=!1){let n=this.storage.getConsent(),s=this.storage.getFastPath();this.#s=!1,this.#n=void 0,this.state=this.#o(),(!this.state.hasConsent||!this.hasValidConsent())&&(n||s?this.invalidateStoredConsent():(this.state=this.freshVisitorState(),this.#s=!1,this.#n=void 0,B(this.config)))}getFastPathSyncOptions(){let e=this.getConsentTimestamp();return{...e===null?{}:{decisionTimestamp:e}}}getStoredLocale(){return this.#n}getDisplayLocale(){return this.#r}#i(e){this.#r=e;try{this.#c(e)}catch{}}#c(e){if(!this.state.hasConsent)return;let n=this.storage.getConsent();if(!n)return;let s=b.decodeForConfig(n.consent,this.config);if(s.language===e)return;let r=b.encode({...s,language:e}),o=this.storage.getConsentSnapshot();o&&(this.storage.updateConsentLocale(o,r),this.validatedStoredDecision=this.storage.getConsentSnapshot(),this.#n=e)}getFastPathConsentMap(){return this.getConsent()}getConsentDowngradeSnapshot(){return G(this.config,this.getFastPathConsentMap())}extendConsentDowngradeBaseline(e){this.#t&&(this.#e={...this.#e,...e})}mergeConsentDowngradeBaseline(e){let n={...this.#e};for(let[s,r]of Object.entries(e))n[s]=n[s]===!0||r===!0;this.#e=n,this.#t=!0}#o(){this.validatedStoredDecision=void 0;let e=this.storage.getConsentSnapshot(),n=e?.content;if(!n)return this.freshVisitorState();try{let s=this.#a(n);return this.validatedStoredDecision=e,s}catch(s){return console.error("[GdprEngine]",s),this.freshVisitorState()}}freshVisitorState(){return{hasConsent:!1,acceptedAll:!1,rejectedAll:!1,categories:this.getDefaultCategoryConsents(),services:this.getDefaultServiceConsents(),timestamp:Date.now()}}invalidateStoredConsent(){this.validatedStoredDecision=void 0,this.state=this.freshVisitorState(),this.#n=void 0,this.#s=!1,this.#e={},this.#t=!1;let e=!1;try{e=this.storage.invalidateConsent()}catch{}if(B(this.config),e)for(let n of this.storage.getContinuityScopes())n.frameworkId!==this.config.framework.id&&B({appId:n.appId,framework:{id:n.frameworkId,type:n.type},machine:n.machine,languages:{primary:n.primaryLanguage},consentEpoch:n.consentEpoch})}clearFastPathSignals(){try{this.storage.removeFastPath()}catch{}B(this.config)}#a(e){let n=b.decodeForConfig(e.consent,this.config);this.#n=n.language;let s=this.getDefaultCategoryConsents(),r=this.getDefaultServiceConsents(),o=this.#d();if(o){for(let l of this.config.categories)!l.essential&&typeof o.categories[l.id]=="boolean"&&(s[l.id]=o.categories[l.id]===!0);for(let l of this.config.services)!l.essential&&typeof o.services[l.id]=="boolean"&&(r[l.id]=o.services[l.id]===!0)}else if(n.state==="A")Object.keys(s).forEach(l=>{s[l]=!0}),Object.keys(r).forEach(l=>{r[l]=!0});else if(n.state!=="D"){if(n.state==="G"&&n.payload){let l=this.config.categories.filter(u=>!u.essential),d=b.decodeBitset(n.payload,l.length);l.forEach((u,p)=>{s[u.id]=d[p]??!1}),this.config.services.forEach(u=>{if(u.essential)r[u.id]=!0;else{let p=u.categoryId;r[u.id]=p?s[p]??!1:!1}})}}let i=this.config.categories.filter(l=>!l.essential),c=i.every(l=>s[l.id]===!0),a=i.every(l=>!s[l.id]);return this.#s=!0,{hasConsent:!0,acceptedAll:c,rejectedAll:a,categories:s,services:r,timestamp:n.timestamp*1e3}}#d(){let e=this.storage.getFastPath();if(!e||e.consentEpoch<(this.config.consentEpoch??0))return;let n=D(this.config.services,this.config.categories);return e.structuralVersion===n?void 0:e}getDefaultCategoryConsents(){let e={};return this.config.categories.forEach(n=>{e[n.id]=n.essential===!0}),e}getDefaultServiceConsents(){let e={};return this.config.services.forEach(n=>{e[n.id]=n.essential===!0}),e}acceptAll(){this.config.categories.forEach(e=>{this.state.categories[e.id]=!0}),this.config.services.forEach(e=>{this.state.services[e.id]=!0}),this.state.acceptedAll=!0,this.state.rejectedAll=!1,this.state.hasConsent=!0,this.state.timestamp=Date.now(),this.emit("consent:accepted-all"),this.emit("consent:changed")}rejectAll(){this.config.categories.forEach(e=>{this.state.categories[e.id]=e.essential===!0}),this.config.services.forEach(e=>{this.state.services[e.id]=e.essential===!0}),this.state.acceptedAll=!1,this.state.rejectedAll=!0,this.state.hasConsent=!0,this.state.timestamp=Date.now(),this.emit("consent:rejected-all"),this.emit("consent:changed")}getConsent(){return this.#f()}#f(){return{...this.state.categories,...this.state.services}}setConsent(e){Object.keys(this.state.categories).forEach(n=>{typeof e[n]=="boolean"&&(this.state.categories[n]=e[n])}),Object.keys(this.state.services).forEach(n=>{typeof e[n]=="boolean"&&(this.state.services[n]=e[n])}),this.state.timestamp=Date.now(),this.emit("consent:changed"),this.save()}getConsentState(){return{...this.state}}getEnforcementConsentState(){if(this.externalReconciliationPending)return this.freshVisitorState();let e=this.getFastPathConsentMap(),n={},s={};for(let r of this.config.categories)n[r.id]=e[r.id]===!0;for(let r of this.config.services)s[r.id]=e[r.id]===!0;return{...this.state,categories:n,services:s}}getCategoryConsent(e){return this.state.categories[e]||!1}setCategoryConsent(e,n){let s=this.config.categories.find(r=>r.id===e);s&&(s.essential&&!n||(this.state.categories[e]=n,this.state.timestamp=Date.now(),this.config.services.filter(r=>r.categoryId===e).forEach(r=>{this.setServiceConsent(r.id,n)}),this.emit("category:toggled",{id:e,value:n}),this.emit("consent:changed")))}getServiceConsent(e){return this.state.services[e]||!1}setServiceConsent(e,n){let s=this.config.services.find(r=>r.id===e);s&&(s.essential&&!n||(this.state.services[e]=n,this.state.timestamp=Date.now(),this.emit("service:toggled",{id:e,value:n}),this.emit("consent:changed")))}getCategoryConsents(){return{...this.state.categories}}getServiceConsents(){return{...this.state.services}}save(){this.state.hasConsent=!0,this.state.timestamp=Date.now();let e=this.getConsentDowngradeSnapshot(),n=this.#t&&de(this.#e,e);this.#u(),this.#e=e,this.#t=!0,this.emit("consent:saved"),n&&ue(this.config)==="reload"&&window.location.reload()}#u(){let e=this.#l();this.state.timestamp=b.decodeForConfig(e,this.config).timestamp*1e3;let n=this.storage.getConsentId();n||(n=crypto.randomUUID(),this.storage.setConsentId(n)),this.syncFastPath(r=>{this.persistToLocalStorage(e,r)}),this.validatedStoredDecision=this.storage.getConsentSnapshot();let s=this.#w(e,n);s&&(this.storage.queuePendingEvent(s),this.#g(s).then(async r=>{r&&await this.storage.withExclusiveAccess(()=>this.storage.removePendingEvent(s.eventId))}).catch(r=>console.error("[1Consent] Consent receipt cleanup failed",r)))}#h(){for(let e of this.storage.getPendingEvents())this.#g(e).then(async n=>{n&&await this.storage.withExclusiveAccess(()=>this.storage.removePendingEvent(e.eventId))}).catch(n=>console.error("[1Consent] Consent receipt retry cleanup failed",n))}buildConsentEntry(e){let n=this.getFrameworkPrefix();return n==="gdpr"||n==="us"?{consent:e}:null}persistToLocalStorage(e,n){let s=this.buildConsentEntry(e);s&&this.storage.updateConsent(s,n)}#l(){let e=this.config.categories.filter(i=>!i.essential),n=e.every(i=>this.state.categories[i.id]===!0),s=e.every(i=>!this.state.categories[i.id]),r,o;if(n)r="A";else if(s)r="D";else{r="G";let i=e.map(c=>this.state.categories[c.id]===!0);o=b.encodeBitset(i)}return b.encode({machine:this.config.machine,configId:this.config.appId,version:1,framework:this.getFrameworkPrefix(),state:r,payload:o,language:this.#r,timestamp:Math.floor(Date.now()/1e3)})}#w(e,n){let s=this.config.cmp?.consentApiUrl;if(!s)return null;let r=this.config.consentPublicationToken;if(!r)return console.error("[Consent] Missing signed publication context"),null;let o=this.getEvidenceConsentDecision(),i=kn(o),c=crypto.randomUUID();return{url:s,eventId:c,payload:{publicationToken:r,eventId:c,consentId:n,action:i,decision:o,consentString:e}}}getEvidenceConsentDecision(){let e=this.getFastPathConsentMap(),n=r=>J(r.filter(o=>!o.essential).map(o=>e[o.id]===!0)),s=n(this.config.categories);return{version:1,categoryProjection:s,categories:s,services:n(this.config.services),framework:""}}async#g(e){try{let n=await fetch(`${e.url}/v1/consent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e.payload),keepalive:!0});return n.status>=400&&n.status<500?(console.error("permanently rejected"),!0):n.ok}catch(n){return console.error("Consent failed",n),!1}}isConsentRequired(){return!!(this.externalReconciliationPending||!this.getConsentState().hasConsent||this.#p()||this.#m())}hasValidConsent(){return!this.isConsentRequired()}getConsentTimestamp(){return this.state.timestamp||null}#p(){let e=this.getConsentTimestamp(),n=Date.now();return e===null||!Number.isSafeInteger(e)||e<=0||!Number.isSafeInteger(n)||n<0||e>n?!0:n-e>33696e6}#m(){let e=Object.keys(this.state.categories);return(this.config.categories.map(s=>s.id)||[]).some(s=>!e.includes(s))}resolve(e){let n=L(e.bindingKey);if(n?.framework!=="gdpr")throw new Error(`[GDPR Engine] Invalid binding key: ${e.bindingKey}`);if(!e.id)throw new Error(`[GDPR Engine] ID required for GDPR bindings: ${e.bindingKey}`);let{entity:s}=n;if(s==="category")return this.resolveCategoryBinding(e.id);if(s==="service")return this.resolveServiceBinding(e.id);throw new Error(`[GDPR Engine] Unknown entity type: ${s}`)}resolveMany(e){let n=[];for(let s of e)try{let r=this.resolve(s);if(!s.id)continue;n.push({bindingKey:s.bindingKey,id:s.id,value:r.value,disabled:r.disabled})}catch(r){console.error("GDPR binding",s,r)}return{patches:n,version:this.versionTracker.getVersion()}}getFrameworkPrefix(){return"gdpr"}apply(e){let n=L(e.ref.bindingKey);if(n?.framework!=="gdpr")throw new Error(`[GDPR Engine] Invalid binding key: ${e.ref.bindingKey}`);if(!e.ref.id)throw new Error(`[GDPR Engine] ID required for GDPR bindings: ${e.ref.bindingKey}`);let{entity:s}=n,r=[];if(s==="category"){this.setCategoryConsent(e.ref.id,e.value);let i=this.resolveCategoryBinding(e.ref.id);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:i.value,disabled:i.disabled});let c=this.config.services.filter(a=>a.categoryId===e.ref.id);for(let a of c){let l=this.resolveServiceBinding(a.id);r.push({bindingKey:`consent:${this.getFrameworkPrefix()}.service`,id:a.id,value:l.value,disabled:l.disabled})}}else if(s==="service"){this.setServiceConsent(e.ref.id,e.value);let i=this.resolveServiceBinding(e.ref.id);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:i.value,disabled:i.disabled});let c=this.config.services.find(a=>a.id===e.ref.id);if(c?.categoryId){let a=this.resolveCategoryBinding(c.categoryId);r.push({bindingKey:`consent:${this.getFrameworkPrefix()}.category`,id:c.categoryId,value:a.value,disabled:a.disabled})}}else throw new Error(`[GDPR Engine] Unknown entity type: ${s}`);let o=this.versionTracker.increment();return{patches:r,version:o}}resolveCategoryBinding(e){let n=this.config.categories.find(o=>o.id===e);if(!n)throw new Error(`[GDPR Engine] Category not found: ${e}`);if(n.essential)return{value:!0,disabled:!0};let s=this.config.services.filter(o=>o.categoryId===e),r;return s.length===0?r=this.state.categories[e]||!1:r=s.every(o=>this.state.services[o.id]),{value:r,disabled:!1}}resolveServiceBinding(e){let n=this.config.services.find(r=>r.id===e);if(!n)throw new Error(`[GDPR Engine] Service not found: ${e}`);return n.essential?{value:!0,disabled:!0}:this.config.categories.find(r=>r.id===n.categoryId)?.essential?{value:!0,disabled:!0}:{value:this.state.services[e]||!1,disabled:!1}}};var qe=class extends M{engine;constructor(e,n){super(e,n),this.engine=new H(this.bus,this.storage,e),this.attachBlocking(this.engine),this.resolveInitialLocale(this.engine.getStoredLocale())}async init(){if(this.engine.isConsentRequired()){let n=this.ensureViewData("main");await this.ensureViewEngine(),await Promise.all([this.ensureViewLoaded("main"),n])}else await this.showReturningVisitorTrigger(),this.bus.emit({type:"consent:ready"})}async acceptAll(){await this.storage.withExclusiveAccess(()=>{this.engine.acceptAll(),this.engine.save()}),await this.close()}async rejectAll(){await this.storage.withExclusiveAccess(()=>{this.engine.rejectAll(),this.engine.save()}),await this.close()}};var cn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function yt(t){if(!/^[A-Za-z0-9_-]*$/.test(t)||t.length%4===1)throw new Error("invalid base64url");let e=t.length,n=new Uint8Array(Math.floor(e*6/8)),s=0,r=0,o=0;for(let i=0;i<e;i++)s=s<<6|cn.indexOf(t[i]),r+=6,r>=8&&(r-=8,n[o++]=s>>r&255);if(wt(n)!==t)throw new Error("invalid base64url");return n}function wt(t){let e="",n=0,s=0;for(let r=0;r<t.length;r++)for(n=n<<8|(t[r]??0),s+=8;s>=6;)s-=6,e+=cn[n>>s&63];return s>0&&(e+=cn[n<<6-s&63]??""),e}function U(){throw new Error("invalid TC")}function Ct(t,e,n){for(let s of n){let r=e*65536+s;t.has(r)&&U(),t.add(r)}}var ln=53;function dn(t){if(!Number.isSafeInteger(t)||t<1||t>ln)throw new Error(`Bit length must be an integer from 1 to ${ln}`)}var we=class{buffer;#e=0;constructor(e){this.buffer=e}readBits(e){if(dn(e),e>32){let s=0;for(let r=0;r<e;r++)s=s*2+(this.readBit()?1:0);return s}let n=0;for(let s=0;s<e;s++)n=n<<1|(this.readBit()?1:0);return n>>>0}readBit(){if(this.#e>=this.buffer.length*8)throw new Error("BitReader: Unexpected end of stream");let e=Math.floor(this.#e/8),n=7-this.#e%8,s=(this.buffer[e]??0)>>n&1;return this.#e++,s===1}readBool(){return this.readBit()}readLanguage(){let e=this.readBits(6),n=this.readBits(6);if(e>25||n>25)throw new Error("BitReader: invalid alpha-2 language field");let s=String.fromCharCode(e+65),r=String.fromCharCode(n+65);return(s+r).toLowerCase()}hasMore(){return this.hasMoreBits(1)}hasMoreBits(e){return dn(e),this.#e+e<=this.buffer.length*8}assertOnlyPadding(){let e=this.buffer.length*8-this.#e;for(;e>0;)(e-- >7||this.readBit())&&U()}},We=class{#e=[];writeBits(e,n){dn(n);let s=n===ln?Number.MAX_SAFE_INTEGER:2**n-1;if(!Number.isSafeInteger(e)||e<0||e>s)throw new Error(`BitWriter: value ${e} does not fit in ${n} bits`);let r=e.toString(2).padStart(n,"0");for(let o=0;o<n;o++)this.#e.push(r[o]==="1"?1:0)}writeBit(e){if(typeof e!="boolean")throw new Error("BitWriter: bit value must be boolean");this.#e.push(e?1:0)}writeBool(e){this.writeBit(e)}writeLanguage(e){if(!/^[A-Za-z]{2}$/.test(e))throw new Error("BitWriter: language must be exactly two ASCII letters");let n=e.toUpperCase();this.writeBits(n.charCodeAt(0)-65,6),this.writeBits(n.charCodeAt(1)-65,6)}toUint8Array(){let e=Math.ceil(this.#e.length/8),n=new Uint8Array(e);for(let s=0;s<this.#e.length;s++){let r=Math.floor(s/8),o=7-s%8;if(this.#e[s]===1){let i=n[r];i!==void 0&&(n[r]=i|1<<o)}}return n}};function Ye(t){let e=yt(t);if(e.length!==0)return new we(e).readBits(3)}function vt(t){let e=t.split("."),n=e[0]??"",s=yt(n),r=new we(s),o=r.readBits(6);if(o!==2)throw new Error(`TCF: unsupported TC string version ${o}`);let i=r.readBits(36),c=r.readBits(36),a=r.readBits(12),l=r.readBits(12),d=r.readBits(6),u=r.readLanguage(),p=r.readBits(12),y=r.readBits(6),f=r.readBool(),S=r.readBool(),v=un(r,12),m=un(r,24),T=un(r,24),h=r.readBool(),g=r.readLanguage(),I=fn(r),C=fn(r),P=qr(r);r.assertOnlyPadding();let k={version:o,created:i,lastUpdated:c,cmpId:a,cmpVersion:l,consentScreen:d,consentLanguage:u,vendorListVersion:p,tcfPolicyVersion:y,isServiceSpecific:f,useNonStandardStacks:S,specialFeatureOptIns:v,purposeConsents:m,purposeLegitimateInterests:T,purposeOneTreatment:h,publisherCC:g,vendorConsents:I,vendorLegitimateInterests:C,publisherRestrictions:P};for(let N=1;N<e.length;N++){let _=new we(yt(e[N]??""));_.readBits(3)===1&&(k.disclosedVendors=fn(_),_.assertOnlyPadding())}return k}function un(t,e){let n=new Set;for(let s=1;s<=e;s++)t.readBool()&&n.add(s);return n}function fn(t){let e=t.readBits(16);if(!t.readBool()){let r=new Set;for(let o=1;o<=e;o++)t.readBool()&&r.add(o);return r}let s=Is(t,t.readBits(12),e);return s.some(r=>r.end===e)||U(),As(s)}function Is(t,e,n){let s=[];for(let r=0;r<e;r++){let o=t.readBool(),i=t.readBits(16);if(Ts(i,n),!o){s.push({start:i,end:i});continue}let c=t.readBits(16);Ts(c,n),c<=i&&U(),s.push({start:i,end:c})}return s}function Ts(t,e){(t<1||t>e)&&U()}function As(t){let e=new Set;t.sort((s,r)=>s.start-r.start||s.end-r.end);let n=0;for(let s of t){let r=Math.max(s.start,n+1);for(let o=r;o<=s.end;o++)e.add(o);n=Math.max(n,s.end)}return e}function qr(t){let e=t.readBits(12),n=[],s=new Set;for(let r=0;r<e;r++){let o=t.readBits(6);(o<1||o>24)&&U();let i=t.readBits(2);i>2&&U();let c=t.readBits(12),a=As(Is(t,c,65535));Ct(s,o,a),n.push({purposeId:o,restrictionType:i,vendorIds:a})}return n}function Et(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("TCF: invalid millisecond timestamp");let e=new Date(t),n=Math.round(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())/100);try{Ce(n,"derived")}catch{throw new Error("TCF: invalid millisecond timestamp")}return n}function Ce(t,e){if(!Number.isSafeInteger(t)||t<0||t>68719476735||t%864e3!==0)throw new Error(`TCF: invalid ${e} timestamp`)}function bt(t,e){try{return Ce(t,"Created"),Ce(e,"LastUpdated"),t===e}catch{return!1}}function Os(t){return{resolve(e){let n=t.stacks[e];return n?{purposes:n.purposes,specialFeatures:n.specialFeatures}:null}}}var Tt=class t{decode;encode;opts;#e=null;#t=[];constructor(e,n,s={}){this.decode=e,this.encode=n,this.opts=s,!this.opts.stackResolver&&this.opts.base&&(this.opts.stackResolver=Os(this.opts.base))}static withBase(e,n,s,r={}){return new t(e,n,{...r,base:s,stackResolver:Os(s)})}static raw(e,n,s={}){return new t(e,n,s)}load(e){let n=this.decode(e);if(this.#e=n,this.#t=e.split("."),!bt(this.#e.created,this.#e.lastUpdated))throw new Error("TCF: invalid Created/LastUpdated timestamps");return this.#e}startNew(){this.#t=[];let e=this.#i();return this.#e={version:2,created:e,lastUpdated:e,cmpId:this.opts.base?.cmpId??0,cmpVersion:this.opts.base?.cmpVersion??1,consentScreen:1,consentLanguage:"en",vendorListVersion:this.opts.base?.vendorListVersion||0,tcfPolicyVersion:this.opts.base?.tcfPolicyVersion??5,isServiceSpecific:!0,useNonStandardStacks:!1,specialFeatureOptIns:new Set(this.opts.base?.specialFeatureOptins||[]),purposeConsents:new Set(this.opts.base?.purposeConsents||[]),purposeLegitimateInterests:new Set(this.opts.base?.purposeLegitimateInterests||[]),purposeOneTreatment:!1,publisherCC:"AA",vendorConsents:new Set(this.opts.base?.vendorConsents||[]),vendorLegitimateInterests:new Set(this.opts.base?.vendorLegitimateInterests||[]),disclosedVendors:new Set(this.opts.base?.disclosedVendors??[])},this.#e}getDecoded(){if(!this.#e)throw new Error("TCF: call load(tcString) first");return this.#e}toTcString(){let e=this.encode(this.getDecoded()).split(".");if(this.#t.length<=1)return e.join(".");let n=new Set;for(let r of e.slice(1)){let o=Ye(r);o!==void 0&&n.add(o)}let s=this.#t.slice(1).filter(r=>{let o=Ye(r);return o!==void 0&&!n.has(o)});return[...e,...s].join(".")}getPurposeConsent(e){return this.#o(e),this.getDecoded().purposeConsents.has(e)}getPurposeConsents(){let e={},n=this.getDecoded().purposeConsents;for(let s=1;s<=24;s++)e[s]=n.has(s);return e}getPurposeLegitimateInterest(e){return this.#o(e),this.getDecoded().purposeLegitimateInterests.has(e)}getSpecialFeatureOptIn(e){return this.#d(e),this.getDecoded().specialFeatureOptIns.has(e)}getSpecialFeatureOptIns(){let e={},n=this.getDecoded().specialFeatureOptIns;for(let s=1;s<=12;s++)e[s]=n.has(s);return e}getVendorConsent(e){return this.#a(e),this.getDecoded().vendorConsents.has(e)}getVendorLegitimateInterest(e){return this.#a(e),this.getDecoded().vendorLegitimateInterests.has(e)}setConsentLanguage(e){let n=e.toLowerCase();if(!/^[a-z]{2}$/.test(n))throw new Error("TCF: consentLanguage must be a two-letter ISO 639-1 code");let s=this.getDecoded();return s.consentLanguage===n?this:(s.consentLanguage=n,this.#r())}setPurposeConsent(e,n){return this.#o(e),this.#s(this.getDecoded().purposeConsents,e,n)?this.#r():this}setPurposeLegitimateInterest(e,n){if(this.#o(e),n&&this.#c()){if(e===1)throw new Error("TCF Policy: Purpose 1 requires consent, not legitimate interest");if(e>=3&&e<=6)throw new Error(`TCF 2.4: Purpose ${e} requires consent and cannot use legitimate interest`)}return this.#s(this.getDecoded().purposeLegitimateInterests,e,n)?this.#r():this}setVendorConsent(e,n){return this.#a(e),this.#s(this.getDecoded().vendorConsents,e,n)?this.#r():this}setVendorLegitimateInterest(e,n){return this.#a(e),this.#s(this.getDecoded().vendorLegitimateInterests,e,n)?this.#r():this}setSpecialFeatureOptIn(e,n){return this.#d(e),this.#s(this.getDecoded().specialFeatureOptIns,e,n)?this.#r():this}setPurposeConsents(e,n){for(let s of e)this.setPurposeConsent(s,n);return this}setPurposeLegitimateInterests(e,n){for(let s of e)this.setPurposeLegitimateInterest(s,n);return this}setVendorConsents(e,n){for(let s of e)this.setVendorConsent(s,n);return this}setVendorLegitimateInterests(e,n){for(let s of e)this.setVendorLegitimateInterest(s,n);return this}setSpecialFeatureOptIns(e,n){for(let s of e)this.setSpecialFeatureOptIn(s,n);return this}applyStack(e,n){let s=this.opts.stackResolver;if(!s)throw new Error("TCF: applyStack requires opts.base or opts.stackResolver");let r=s.resolve(e);if(!r)throw new Error(`TCF: unknown stackId ${e}`);return r.purposes?.length&&this.setPurposeConsents(r.purposes,n),r.purposeLI?.length&&this.setPurposeLegitimateInterests(r.purposeLI,n),r.vendors?.length&&this.setVendorConsents(r.vendors,n),r.vendorLI?.length&&this.setVendorLegitimateInterests(r.vendorLI,n),r.specialFeatures?.length&&this.setSpecialFeatureOptIns(r.specialFeatures,n),this}setPublisherRestriction(e,n,s){this.#o(e);let r=this.getDecoded(),o=new Set;for(let a of s)this.#a(a),o.add(a);let i=r.publisherRestrictions?.find(a=>a.purposeId===e);if(i?.restrictionType===n&&this.#n(i.vendorIds,o))return this;r.publisherRestrictions||(r.publisherRestrictions=[]);let c=i;return c?(c.restrictionType=n,c.vendorIds.clear()):(c={purposeId:e,restrictionType:n,vendorIds:new Set},r.publisherRestrictions.push(c)),c.vendorIds=o,this.#r()}removePublisherRestrictionVendors(e,n){this.#o(e);let s=this.getDecoded(),r=s.publisherRestrictions;if(!r?.length)return this;let o=r.findIndex(a=>a.purposeId===e);if(o===-1)return this;let i=r[o];if(!i)return this;let c=!1;for(let a of n)this.#a(a),c=i.vendorIds.delete(a)||c;return c?(i.vendorIds.size===0&&(r.splice(o,1),r.length===0&&delete s.publisherRestrictions),this.#r()):this}clearPublisherRestriction(e){this.#o(e);let n=this.getDecoded(),s=n.publisherRestrictions;if(!s?.length)return this;let r=s.findIndex(o=>o.purposeId===e);return r===-1?this:(s.splice(r,1),s.length===0&&delete n.publisherRestrictions,this.#r())}#s(e,n,s){return e.has(n)===s?!1:(s?e.add(n):e.delete(n),!0)}#n(e,n){return e.size===n.size&&[...e].every(s=>n.has(s))}#r(){let e=this.getDecoded(),n=this.#i();return e.created=n,e.lastUpdated=n,this}#i(){return Et(this.opts.now?this.opts.now():Date.now())}#c(){return this.opts.enforceTcfPolicy!==!1}#o(e){if(!this.opts.validateIds)return;let n=this.opts.maxPurposeId??24;if(!Number.isInteger(e)||e<1||e>n)throw new Error(`TCF: invalid purposeId ${e} (expected 1..${n})`)}#a(e){if(!this.opts.validateIds)return;let n=this.opts.maxVendorId;if(!Number.isInteger(e)||e<1||n!=null&&e>n)throw new Error(`TCF: invalid vendorId ${e} (expected >=1${n!=null?` and <=${n}`:""})`)}#d(e){if(!this.opts.validateIds)return;let n=this.opts.maxSpecialFeatureId??12;if(!Number.isInteger(e)||e<1||e>n)throw new Error(`TCF: invalid specialFeatureId ${e} (expected 1..${n})`)}};function xs(t){let e=new We,n=t.created??t.lastUpdated??Et(Date.now()),s=t.created??n,r=t.lastUpdated??n;if(Ce(s,"Created"),Ce(r,"LastUpdated"),s!==r)throw new Error("TCF: Created and LastUpdated must be equal");let o=t.version??2;if(o!==2)throw new Error(`TCF: unsupported TC string version ${o}`);e.writeBits(o,6),e.writeBits(s,36),e.writeBits(r,36),e.writeBits(t.cmpId??0,12),e.writeBits(t.cmpVersion??0,12),e.writeBits(t.consentScreen??0,6),e.writeLanguage(t.consentLanguage??"en"),e.writeBits(t.vendorListVersion??0,12);let i=t.tcfPolicyVersion??5;if(i!==5)throw new Error(`TCF 2.4: unsupported policy version ${i}`);e.writeBits(i,6),e.writeBool(t.isServiceSpecific??!1),e.writeBool(t.useNonStandardStacks??!1),hn(e,t.specialFeatureOptIns??new Set,12,"special-feature"),hn(e,t.purposeConsents??new Set,24,"purpose-consent"),hn(e,t.purposeLegitimateInterests??new Set,24,"purpose-legitimate-interest"),e.writeBool(t.purposeOneTreatment??!1),e.writeLanguage(t.publisherCC??"aa"),pn(e,t.vendorConsents,"vendor-consent"),pn(e,t.vendorLegitimateInterests,"vendor-legitimate-interest"),Wr(e,t.publisherRestrictions??[]);let c=e.toUint8Array(),a=wt(c);if(t.disclosedVendors===void 0)throw new Error("TCF 2.4: disclosed vendors are required");let l=new We;l.writeBits(1,3),pn(l,t.disclosedVendors,"disclosed-vendor");let d=l.toUint8Array();return`${a}.${wt(d)}`}function hn(t,e,n,s){for(let r of e)z(r,1,n,s);for(let r=1;r<=n;r++)t.writeBool(e.has(r))}function pn(t,e,n){if(e.size===0){t.writeBits(0,16),t.writeBool(!1);return}let s=Array.from(e).sort((a,l)=>a-l);for(let a of s)z(a,1,65535,n);let r=s[s.length-1]??0,o=_s(s),i=r,c=12+o.reduce((a,l)=>a+1+16+(l.start===l.end?0:16),0);if(i<=c){t.writeBits(r,16),t.writeBool(!1);for(let a=1;a<=r;a++)t.writeBool(e.has(a))}else{t.writeBits(r,16),t.writeBool(!0),z(o.length,0,2**12-1,`${n} range count`),t.writeBits(o.length,12);for(let a of o)a.start===a.end?(t.writeBool(!1),t.writeBits(a.start,16)):(t.writeBool(!0),t.writeBits(a.start,16),t.writeBits(a.end,16))}}function _s(t){let e=[];if(t.length===0)return e;let n=t[0]??0,s=n;for(let r=1;r<t.length;r++){let o=t[r]??0;o===s+1?s=o:(e.push({start:n,end:s}),n=o,s=n)}return e.push({start:n,end:s}),e}function Wr(t,e){z(e.length,0,2**12-1,"publisher restriction count");let n=new Set;t.writeBits(e.length,12);for(let s of e){z(s.purposeId,1,24,"publisher restriction purpose"),z(s.restrictionType,0,2,"publisher restriction type"),t.writeBits(s.purposeId,6),t.writeBits(s.restrictionType,2);let r=Array.from(s.vendorIds).sort((i,c)=>i-c);for(let i of r)z(i,1,65535,"publisher restriction vendor");Ct(n,s.purposeId,r);let o=_s(r);z(o.length,0,2**12-1,"publisher restriction range count"),t.writeBits(o.length,12);for(let i of o)i.start===i.end?(t.writeBool(!1),t.writeBits(i.start,16)):(t.writeBool(!0),t.writeBits(i.start,16),t.writeBits(i.end,16))}}function z(t,e,n,s){if(!Number.isSafeInteger(t)||t<e||t>n)throw new Error(`TCF: invalid ${s} ${t} (expected ${e}..${n})`)}function ve(t){return Object.fromEntries([...t].map(e=>[e.toString(),!0]))}function Ps(t){try{let e=t.split(".").slice(1).map(n=>Ye(n));return e.length===1&&e[0]===1}catch{return!1}}function Yr(t,e){if(t.version!==2||!bt(t.created,t.lastUpdated)||t.cmpId!==ke||t.tcfPolicyVersion!==X||!t.isServiceSpecific||!/^[a-z]{2}$/.test(t.consentLanguage)||!/^[a-z]{2}$/i.test(t.publisherCC)||!t.disclosedVendors)return;let n={};for(let r of t.publisherRestrictions??[]){if(r.restrictionType!==0&&r.restrictionType!==1&&r.restrictionType!==2)return;let o=r.purposeId.toString(),i=n[o]??{};for(let c of r.vendorIds){let a=c.toString();if(a in i)return;i[a]=r.restrictionType}n[o]=i}let s={...e?{enableAdvertiserConsentMode:!0}:{},tcfPolicyVersion:t.tcfPolicyVersion,cmpId:t.cmpId,cmpVersion:t.cmpVersion,isServiceSpecific:t.isServiceSpecific,useNonStandardTexts:t.useNonStandardStacks,publisherCC:t.publisherCC.toUpperCase(),purposeOneTreatment:t.purposeOneTreatment,purpose:{consents:ve(t.purposeConsents),legitimateInterests:ve(t.purposeLegitimateInterests)},vendor:{consents:ve(t.vendorConsents),legitimateInterests:ve(t.vendorLegitimateInterests),disclosedVendors:ve(t.disclosedVendors)},specialFeatureOptins:ve(t.specialFeatureOptIns),publisher:{consents:{},legitimateInterests:{},customPurpose:{consents:{},legitimateInterests:{}},restrictions:n}};return Un(s)?s:void 0}var It=class extends H{tcfController;#e;#t;#s;#n;#r;#i;#c=!1;constructor(e,n,s){super(e,n,s),this.#e=s;let r=s.vendors.map(c=>c.id);[this.#t,this.#s,this.#n,this.#r,this.#i]=Nn(s.vendors);let o={cmpId:ke,cmpVersion:Gn,vendorListVersion:"vendorListVersion"in s.framework?s.framework.vendorListVersion:0,tcfPolicyVersion:X,purposeConsents:[],purposeLegitimateInterests:this.#s,specialFeatureOptins:[],vendorConsents:[],vendorLegitimateInterests:this.#i,disclosedVendors:r,purposes:[...new Set([...this.#t,...this.#s])],stacks:{}};this.tcfController=Tt.withBase(vt,xs,o);let i=this.#o(r);if(i&&this.hasValidConsent())try{this.syncFastPath(),this.mergeConsentDowngradeBaseline(this.getConsentDowngradeSnapshot())}catch{}else this.clearFastPathSignals();i&&this.extendConsentDowngradeBaseline(this.#d())}bootSyncsFastPath(){return!1}reloadExternalConsentState(e=!1){super.reloadExternalConsentState(e);let n=this.#e.vendors.map(r=>r.id),s=this.#o(n);this.#c=!e&&!s,this.#c&&(this.tcfController.setPurposeLegitimateInterests(this.#s,!1),this.tcfController.setVendorLegitimateInterests(this.#i,!1))}markLegitimateInterestDisclosuresVisible(){!this.#c||this.state.hasConsent||(this.#c=!1,this.tcfController.setPurposeLegitimateInterests(this.#s,!0),this.tcfController.setVendorLegitimateInterests(this.#i,!0),this.emit("consent:changed"))}#o(e){let n=this.storage.getConsent(),s=!1;if(this.state.hasConsent&&n?.tcString&&Ps(n.tcString))try{this.tcfController.load(n.tcString);let r=this.getTcfApiDecisionData();s=ot(Object.keys(r.vendor.disclosedVendors).map(Number))===ot(e)&&this.#a(r)}catch{}return s||(this.#f(),n&&this.invalidateStoredConsent()),s}#a(e){let n=(r,o)=>Object.keys(r).every(i=>o.includes(Number(i)));if(!n(e.purpose.consents,this.#t)||!n(e.purpose.legitimateInterests,this.#s)||!n(e.vendor.consents,this.#r)||!n(e.vendor.legitimateInterests,this.#i)||!n(e.specialFeatureOptins,this.#n))return!1;let s=new Map(this.#e.vendors.map(r=>[r.id,r]));for(let[r,o]of Object.entries(e.publisher.restrictions)){let i=Number(r);for(let[c,a]of Object.entries(o)){let l=s.get(Number(c));if(!l||!(l.consentPurposeIds.includes(i)||l.legitimateInterestPurposeIds.includes(i))||a!==0&&!l.flexiblePurposeIds.includes(i)||a===2&&!l.legitimateInterestPurposeIds.includes(i))return!1}}return!0}getFastPathSyncOptions(){let e=this.getTcString(),n=this.getTcfApiDecisionData();return{...super.getFastPathSyncOptions(),decisionIntegrity:pt(e),tcfCmpId:ke,tcfValidationVersion:jn,tcfDisclosedVendorKey:ot(this.#e.vendors.map(s=>s.id)),tcfApiData:n,tcfApiDataIntegrity:pt($n(e,n))}}getConsentDowngradeSnapshot(){return{...super.getConsentDowngradeSnapshot(),...this.#d()}}getEvidenceConsentDecision(){return{...super.getEvidenceConsentDecision(),framework:J(Object.values(this.#d()))}}getExternalConsentSnapshot(e){let n=super.getExternalConsentSnapshot(e),r=Se(e,this.storage.getScope())?.consent?.tcString;if(!r)return n;try{let o=vt(r);if(o.version!==2||o.tcfPolicyVersion!==X||o.cmpId!==ke)return n;let i={...n??{}};for(let c of this.#t)i[`tcf:purpose:${c}`]=o.purposeConsents.has(c);for(let c of this.#s)i[`tcf:purposeLI:${c}`]=o.purposeLegitimateInterests.has(c);for(let c of this.#n)i[`tcf:specialFeature:${c}`]=o.specialFeatureOptIns.has(c);for(let c of this.#r)i[`tcf:vendor:${c}`]=o.vendorConsents.has(c);for(let c of this.#i)i[`tcf:vendorLI:${c}`]=o.vendorLegitimateInterests.has(c);return i}catch{return n}}getCurrentExternalConsentSnapshot(){let e=super.getCurrentExternalConsentSnapshot();return e?{...e,...this.#d()}:void 0}#d(){let e={};for(let n of this.#t)e[`tcf:purpose:${n}`]=this.tcfController.getPurposeConsent(n);for(let n of this.#s)e[`tcf:purposeLI:${n}`]=this.tcfController.getPurposeLegitimateInterest(n);for(let n of this.#n)e[`tcf:specialFeature:${n}`]=this.tcfController.getSpecialFeatureOptIn(n);for(let n of this.#r)e[`tcf:vendor:${n}`]=this.tcfController.getVendorConsent(n);for(let n of this.#i)e[`tcf:vendorLI:${n}`]=this.tcfController.getVendorLegitimateInterest(n);return e}acceptAll(){super.acceptAll(),this.tcfController.setPurposeConsents(this.#t,!0),this.tcfController.setPurposeLegitimateInterests(this.#s,!0),this.tcfController.setSpecialFeatureOptIns(this.#n,!0),this.tcfController.setVendorConsents(this.#r,!0),this.tcfController.setVendorLegitimateInterests(this.#i,!0)}rejectAll(){super.rejectAll(),this.tcfController.setPurposeConsents(this.#t,!1),this.tcfController.setPurposeLegitimateInterests(this.#s,!1),this.tcfController.setSpecialFeatureOptIns(this.#n,!1),this.tcfController.setVendorConsents(this.#r,!1),this.tcfController.setVendorLegitimateInterests(this.#i,!1)}getPurposeConsent(e){return this.tcfController.getPurposeConsent(e)}setPurposeConsent(e,n){if(!this.#t.includes(e))throw new Error(`[TCF Engine] Purpose ${e} was not disclosed for consent`);this.tcfController.setPurposeConsent(e,n),this.state.timestamp=Date.now(),this.emit("purpose:toggled",{id:e,value:n}),this.emit("consent:changed")}getPurposeLegitimateInterest(e){return this.tcfController.getPurposeLegitimateInterest(e)}setPurposeLegitimateInterest(e,n){if(!this.#s.includes(e))throw new Error(`[TCF Engine] Purpose ${e} was not disclosed for legitimate interest`);this.tcfController.setPurposeLegitimateInterest(e,n),this.state.timestamp=Date.now(),this.emit("purpose-legitimate-interest:toggled",{id:e,value:n}),this.emit("consent:changed")}getSpecialFeatureOptIn(e){return this.tcfController.getSpecialFeatureOptIn(e)}setSpecialFeatureOptIn(e,n){if(!this.#n.includes(e))throw new Error(`[TCF Engine] Special Feature ${e} was not disclosed`);this.tcfController.setSpecialFeatureOptIn(e,n),this.state.timestamp=Date.now(),this.emit("special-feature:toggled",{id:e,value:n}),this.emit("consent:changed")}getVendorConsent(e){return this.tcfController.getVendorConsent(e)}setVendorConsent(e,n){if(!this.#r.includes(e))throw new Error(`[TCF Engine] Vendor ${e} was not disclosed for consent`);this.tcfController.setVendorConsent(e,n),this.state.timestamp=Date.now(),this.emit("vendor:toggled",{id:e,value:n}),this.emit("consent:changed")}getVendorLegitimateInterest(e){return this.tcfController.getVendorLegitimateInterest(e)}setVendorLegitimateInterest(e,n){if(!this.#i.includes(e))throw new Error(`[TCF Engine] Vendor ${e} was not disclosed for legitimate interest`);this.tcfController.setVendorLegitimateInterest(e,n),this.state.timestamp=Date.now(),this.emit("vendor-legitimate-interest:toggled",{id:e,value:n}),this.emit("consent:changed")}getTcString(){return this.tcfController.toTcString()}getTcfApiDecisionData(){let e=this.getTcString(),n=vt(e),s=Ps(e)?Yr(n,this.#e.gcm!==void 0):void 0;if(!s||!this.#a(s))throw new Error("Current TC model cannot produce complete current-GVL web TCData");return s}save(){this.#u(),super.save()}getPurposes(){let e=[];for(let n of new Set([...this.#t,...this.#s]))e.push({id:n,consent:this.getPurposeConsent(n),legitimateInterest:this.getPurposeLegitimateInterest(n)});return e}getSpecialFeatures(){let e=[];for(let n of this.#n)e.push({id:n,optIn:this.getSpecialFeatureOptIn(n)});return e}buildConsentEntry(e){return{consent:e,tcString:this.tcfController.toTcString()}}#f(){this.tcfController.startNew(),this.#u()}#u(){let e=En(this.getDisplayLocale());e&&this.tcfController.setConsentLanguage(e)}getFrameworkPrefix(){return"tcf"}resolve(e){let n=L(e.bindingKey);if(n?.framework==="gdpr")return super.resolve(e);if(n?.framework!=="tcf")throw new Error(`[TCF Engine] Invalid binding key: ${e.bindingKey}`);let{entity:s}=n;if(!e.id)throw new Error(`[TCF Engine] ID required for TCF bindings: ${e.bindingKey}`);let r=parseInt(e.id,10);if(Number.isNaN(r))throw new Error(`[TCF Engine] Invalid numeric ID for TCF binding: ${e.id}`);switch(s){case"purpose":return this.#h(r);case"purposeLegitimateInterest":return this.#l(r);case"specialPurpose":return this.#w(r);case"feature":return this.#g(r);case"specialFeature":return this.#p(r);case"vendor":return this.#m(r);case"vendorLegitimateInterest":return this.#v(r);case"stack":return this.#y(r);default:throw new Error(`[TCF Engine] Unknown entity type: ${s}`)}}resolveMany(e){return{patches:e.map(s=>{let r=this.resolve(s);if(!s.id)throw new Error(`[TCF Engine] ID required for ${s.bindingKey}`);return{bindingKey:s.bindingKey,id:s.id,value:r.value,disabled:r.disabled}}),version:this.versionTracker.getVersion()}}apply(e){let n=L(e.ref.bindingKey);if(n?.framework==="gdpr")return super.apply(e);if(n?.framework!=="tcf")throw new Error(`[TCF Engine] Invalid binding key: ${e.ref.bindingKey}`);if(!e.ref.id)throw new Error(`[TCF Engine] ID required for TCF bindings: ${e.ref.bindingKey}`);let{entity:s}=n,r=[];if(s==="purpose"){let i=parseInt(e.ref.id,10);this.setPurposeConsent(i,e.value);let c=this.#h(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="purposeLegitimateInterest"){let i=parseInt(e.ref.id,10);this.setPurposeLegitimateInterest(i,e.value);let c=this.#l(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="specialFeature"){let i=parseInt(e.ref.id,10);this.setSpecialFeatureOptIn(i,e.value);let c=this.#p(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="vendor"){let i=parseInt(e.ref.id,10);this.setVendorConsent(i,e.value);let c=this.#m(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="vendorLegitimateInterest"){let i=parseInt(e.ref.id,10);this.setVendorLegitimateInterest(i,e.value);let c=this.#v(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="stack"){let i=parseInt(e.ref.id,10),c=this.#C(i);for(let l of c.purposes)this.#t.includes(l)&&(this.tcfController.setPurposeConsent(l,e.value),this.emit("purpose:toggled",{id:l,value:e.value}));for(let l of c.specialFeatures)this.#n.includes(l)&&(this.tcfController.setSpecialFeatureOptIn(l,e.value),this.emit("special-feature:toggled",{id:l,value:e.value}));this.state.timestamp=Date.now(),this.emit("consent:changed");let a=this.#y(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:a.value,disabled:a.disabled});for(let l of c.purposes){if(!this.#t.includes(l))continue;let d=this.#h(l);r.push({bindingKey:"consent:tcf.purpose",id:String(l),value:d.value,disabled:d.disabled})}for(let l of c.specialFeatures){if(!this.#n.includes(l))continue;let d=this.#p(l);r.push({bindingKey:"consent:tcf.specialFeature",id:String(l),value:d.value,disabled:d.disabled})}}else throw new Error(`[TCF Engine] Cannot apply changes to entity type: ${s}`);let o=this.versionTracker.increment();return{patches:r,version:o}}#h(e){if(!this.#t.includes(e))throw new Error(`[TCF Engine] Purpose ${e} has no consent legal basis`);return{value:this.getPurposeConsent(e),disabled:!1}}#l(e){if(!this.#s.includes(e))throw new Error(`[TCF Engine] Purpose ${e} has no legitimate-interest legal basis`);return{value:this.getPurposeLegitimateInterest(e),disabled:!1}}#w(e){return{value:!0,disabled:!0}}#g(e){return{value:!0,disabled:!0}}#p(e){if(!this.#n.includes(e))throw new Error(`[TCF Engine] Special Feature ${e} was not disclosed`);return{value:this.getSpecialFeatureOptIn(e),disabled:!1}}#m(e){if(!this.#r.includes(e))throw new Error(`[TCF Engine] Vendor ${e} has no consent legal basis`);return{value:this.getVendorConsent(e),disabled:!1}}#v(e){if(!this.#i.includes(e))throw new Error(`[TCF Engine] Vendor ${e} has no legitimate-interest legal basis`);return{value:this.getVendorLegitimateInterest(e),disabled:!1}}#C(e){if(typeof window>"u")throw new Error("[TCF Engine] Stack UI data is unavailable outside the browser");let n=window.__1consent?.getTranslations();if(!n||!("tcf"in n))throw new Error("[TCF Engine] Stack UI data is unavailable");let s=n.tcf?.gvl?.stacks?.[e];if(!s)throw new Error(`[TCF Engine] Unknown stack id: ${e}`);if(s.purposes.length+s.specialFeatures.length<2)throw new Error(`[TCF Engine] Invalid stack membership for id: ${e}`);return{purposes:s.purposes,specialFeatures:s.specialFeatures}}#y(e){let n=this.#C(e),s=n.purposes.filter(a=>this.#t.includes(a)),r=n.specialFeatures.filter(a=>this.#n.includes(a)),o=s.length+r.length>0,i=s.every(a=>this.getPurposeConsent(a)),c=r.every(a=>this.getSpecialFeatureOptIn(a));return{value:o&&i&&c,disabled:!o}}};var Xr="Your choices for IAB vendors apply only to Purposes and Special Features. You cannot object here to processing for the Special Purposes disclosed by a vendor. Vendors may use Special Features for Special Purpose 1 (ensuring security, preventing and detecting fraud, and fixing errors), regardless of your Special Feature choices.",Jr="Ihre Auswahl f\xFCr IAB-Anbieter gilt nur f\xFCr Zwecke und Besondere Funktionen. Der Verarbeitung f\xFCr die von einem Anbieter offengelegten Besonderen Zwecke k\xF6nnen Sie hier nicht widersprechen. Anbieter d\xFCrfen Besondere Funktionen f\xFCr den Besonderen Zweck 1 (Sicherheit gew\xE4hrleisten, Betrug verhindern und erkennen sowie Fehler beheben) unabh\xE4ngig von Ihrer Auswahl zu Besonderen Funktionen verwenden.",Ls="Your choices apply only to this service.",ks="Ihre Auswahl gilt nur f\xFCr diesen Dienst.",Ns="1Consent stores the TC String in first-party browser local storage (\u201C1consent\u201D) for up to 390 days. With server sync enabled, the \u201C1consent\u201D cookie stores only a compact decision signal until then.",Vs="1Consent speichert den TC String bis zu 390 Tage im lokalen Erstanbieter-Browserspeicher (\u201E1consent\u201C). Bei aktivierter Server-Synchronisierung enth\xE4lt das \u201E1consent\u201C-Cookie bis dahin nur ein kompaktes Entscheidungssignal.",Zr="These choices and objections apply only to this service.",Qr="Diese Auswahl und Widerspr\xFCche gelten nur f\xFCr diesen Dienst.",ei="1Consent stores your privacy choices and TC String in first-party browser local storage under the key \u201C1consent\u201D for up to 390 days. If this service enables server-readable consent synchronisation, 1Consent also stores a compact first-party decision signal (not the TC String) in a cookie named \u201C1consent\u201D until the same expiry.",ti="1Consent speichert Ihre Datenschutzauswahl und den TC String bis zu 390 Tage lang im lokalen Erstanbieter-Browserspeicher unter dem Schl\xFCssel \u201E1consent\u201C. Falls dieser Dienst die serverlesbare Einwilligungssynchronisierung aktiviert, speichert 1Consent au\xDFerdem bis zum selben Ablaufdatum ein kompaktes Erstanbieter-Entscheidungssignal (nicht den TC String) in einem Cookie namens \u201E1consent\u201C.";function Ds(t){return t==="de"?ks:Ls}function ni(t){return t==="de"?Vs:Ns}function si(t){return t.split("-")[0]?.toLowerCase()==="de"?"de":"en"}function At(t,e,n){let s=t.toLowerCase();if(n.some(o=>s.includes(o.toLowerCase())))return t;let r=t.trimEnd();return r.length===0?e:`${r} ${e}`}function ri(t){return t==="de"?[ks,Qr]:[Ls,Zr]}function ii(t){return t==="de"?[Vs,ti]:[Ns,ei]}function oi(t,e,n=e){let s=si(n),r=s==="de"?Jr:Xr,o=ri(s),i=ii(s),c=At(t.description,Ds(s),o),a=t.details,l=At(At(a?.description??"",Ds(s),o),ni(s),i),d=At(l,r,[r]);return c===t.description&&a?.description===d?t:{...t,description:c,details:a?{...a,description:d}:{title:t.title,description:d,button:t.button,legalLinks:t.legalLinks}}}var Xe=class extends M{engine;constructor(e,n){super(e,n),this.engine=new It(this.bus,this.storage,e),this.attachBlocking(this.engine),this.resolveInitialLocale(this.engine.getStoredLocale())}normalizeTranslations(e,n,s){return oi(e,n,s)}async init(){if(this.engine.isConsentRequired()){let n=this.ensureViewData("main");await this.ensureViewEngine(),await Promise.all([this.ensureViewLoaded("main"),n])}else await this.showReturningVisitorTrigger(),this.bus.emit({type:"consent:ready"})}async acceptAll(){await this.storage.withExclusiveAccess(()=>{this.engine.acceptAll(),this.engine.save()}),await this.close()}async rejectAll(){await this.storage.withExclusiveAccess(()=>{this.engine.rejectAll(),this.engine.save()}),await this.close()}};var gn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",Je=class{bits=[];writeBit(e){this.bits.push(e?1:0)}writeInt(e,n){for(let s=n-1;s>=0;s--)this.bits.push(e>>>s&1)}writeBoolean(e){this.writeBit(e)}writeFibonacciRange(e){if(e.length===0){this.writeInt(0,12);return}let n=[],s=e[0],r=s;for(let i=1;i<e.length;i++){let c=e[i];c===r+1||(n.push({start:s,end:r}),s=c),r=c}n.push({start:s,end:r}),this.writeInt(n.length,12);let o=0;for(let i of n)i.start===i.end?(this.writeBit(!1),this.writeFibonacci(i.start-o),o=i.start):(this.writeBit(!0),this.writeFibonacci(i.start-o),this.writeFibonacci(i.end-i.start),o=i.end)}writeFibonacci(e){let n=ai(e),s=new Array(n.length).fill(!1),r=e;for(let i=n.length-1;i>=0&&r>0;i--)n[i]<=r&&(s[i]=!0,r-=n[i]);let o=s.length-1;for(;o>=0&&!s[o];)o--;for(let i=0;i<=o;i++)this.writeBit(s[i]===!0);this.writeBit(!0)}get length(){return this.bits.length}toBase64(){for(;this.bits.length%6!==0;)this.bits.push(0);let e="";for(let n=0;n<this.bits.length;n+=6){let s=this.bits[n]<<5|this.bits[n+1]<<4|this.bits[n+2]<<3|this.bits[n+3]<<2|this.bits[n+4]<<1|this.bits[n+5];e+=gn[s]}return e}};function ai(t){let e=[1,2];for(;e[e.length-1]<t;)e.push(e[e.length-1]+e[e.length-2]);return e}var E={US_NATIONAL:7,US_CA:8,US_VA:9,US_CO:10,US_CT:12,US_FL:13},mn={CA:E.US_CA,VA:E.US_VA,CO:E.US_CO,CT:E.US_CT,FL:E.US_FL};function Fs(t){let e=t.mspaMode??"not_covered",n=e==="service_provider";return{mode:e,sp:n,notice:n?0:1,optOut:s=>n?0:s?1:2,sensitiveInUse:!n&&t.sensitivePIInUse===!0,knownMinor:!n&&t.knownMinor===!0,mspaFields:{MspaCoveredTransaction:e==="not_covered"?2:1,MspaOptOutOptionMode:e==="opt_out"?1:0,MspaServiceProviderMode:n?1:0}}}function Rs(t){let{notice:e,optOut:n,sensitiveInUse:s,knownMinor:r,mspaFields:o}=Fs(t),i=s?t.limitSensitiveUse===!0?1:2:0;return{Version:1,SharingNotice:e,SaleOptOutNotice:e,SharingOptOutNotice:e,TargetedAdvertisingOptOutNotice:e,SensitiveDataProcessingOptOutNotice:0,SensitiveDataLimitUseNotice:s?1:0,SaleOptOut:n(t.saleOptOut),SharingOptOut:n(t.sharingOptOut),TargetedAdvertisingOptOut:n(t.sharingOptOut),SensitiveDataProcessing:new Array(16).fill(i),KnownChildSensitiveDataConsents:r?[1,1,1]:[0,0,0],PersonalDataConsents:0,...o,Gpc:t.gpcDetected,GpcSegmentType:1,GpcSegmentIncluded:!0}}var Ee=[{name:"MspaCoveredTransaction",bits:2},{name:"MspaOptOutOptionMode",bits:2},{name:"MspaServiceProviderMode",bits:2}],be={[E.US_NATIONAL]:{prefix:"usnat",hasGpc:!0,fields:[{name:"Version",bits:6},{name:"SharingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"SharingOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SensitiveDataProcessingOptOutNotice",bits:2},{name:"SensitiveDataLimitUseNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"SharingOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:16},{name:"KnownChildSensitiveDataConsents",array:3},{name:"PersonalDataConsents",bits:2},...Ee]},[E.US_CA]:{prefix:"usca",hasGpc:!0,fields:[{name:"Version",bits:6},{name:"SaleOptOutNotice",bits:2},{name:"SharingOptOutNotice",bits:2},{name:"SensitiveDataLimitUseNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"SharingOptOut",bits:2},{name:"SensitiveDataProcessing",array:9},{name:"KnownChildSensitiveDataConsents",array:2},{name:"PersonalDataConsents",bits:2},...Ee]},[E.US_VA]:{prefix:"usva",hasGpc:!1,fields:[{name:"Version",bits:6},{name:"SharingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:8},{name:"KnownChildSensitiveDataConsents",bits:2},...Ee]},[E.US_CO]:{prefix:"usco",hasGpc:!0,fields:[{name:"Version",bits:6},{name:"SharingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:7},{name:"KnownChildSensitiveDataConsents",bits:2},...Ee]},[E.US_CT]:{prefix:"usct",hasGpc:!0,fields:[{name:"Version",bits:6},{name:"SharingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:8},{name:"KnownChildSensitiveDataConsents",array:3},...Ee]},[E.US_FL]:{prefix:"usfl",hasGpc:!1,fields:[{name:"Version",bits:6},{name:"ProcessingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:8},{name:"KnownChildSensitiveDataConsents",array:3},{name:"AdditionalDataProcessingConsent",bits:2},...Ee]}};function Ms(t,e){if(t===E.US_NATIONAL)return{...Rs(e)};let{notice:n,optOut:s,sensitiveInUse:r,knownMinor:o,mspaFields:i}=Fs(e),c={Gpc:e.gpcDetected,GpcSegmentType:1,GpcSegmentIncluded:!0};if(t===E.US_CA){let u=r?e.limitSensitiveUse===!0?1:2:0;return{Version:1,SaleOptOutNotice:n,SharingOptOutNotice:n,SensitiveDataLimitUseNotice:r?1:0,SaleOptOut:s(e.saleOptOut),SharingOptOut:s(e.sharingOptOut),SensitiveDataProcessing:new Array(9).fill(u),KnownChildSensitiveDataConsents:o?[1,1]:[0,0],PersonalDataConsents:0,...i,...c}}let a=be[t];if(!a)throw new Error(`[GPP Encoder] Unsupported section id: ${t}`);let l={Version:1,SharingNotice:n,ProcessingNotice:n,SaleOptOutNotice:n,TargetedAdvertisingOptOutNotice:n,SaleOptOut:s(e.saleOptOut),TargetedAdvertisingOptOut:s(e.sharingOptOut),SensitiveDataProcessing:r?1:0,KnownChildSensitiveDataConsents:o?1:0,AdditionalDataProcessingConsent:0,...i},d={};for(let u of a.fields){let p=l[u.name];if(p===void 0)throw new Error(`[GPP Encoder] No value mapping for field: ${u.name}`);d[u.name]="array"in u?new Array(u.array).fill(p):p}return{...d,...a.hasGpc?c:{}}}var Ze=class t{static encode(e,n){let s=[...n].sort((i,c)=>i-c),r=t.encodeHeader(s),o=s.map(i=>t.encodeSection(i,e));return[r,...o].join("~")}static encodeHeader(e){let n=new Je;return n.writeInt(3,6),n.writeInt(1,6),n.writeFibonacciRange(e),n.toBase64()}static encodeSection(e,n){let s=be[e];if(!s)return"";let r=Ms(e,n),o=new Je;for(let c of s.fields){let a=r[c.name];if("array"in c){let l=Array.isArray(a)?a:[];for(let d=0;d<c.array;d++){let u=l[d];o.writeInt(typeof u=="number"?u:0,2)}}else o.writeInt(typeof a=="number"?a:0,c.bits)}if(!s.hasGpc)return o.toBase64();let i=new Je;return i.writeInt(1,2),i.writeBoolean(r.Gpc===!0),`${o.toBase64()}.${i.toBase64()}`}};var Qe=class{bits=[];pos=0;constructor(e){for(let n of e){let s=gn.indexOf(n);if(s<0)throw new Error(`[GPP Decoder] Invalid base64 character: ${n}`);for(let r=5;r>=0;r--)this.bits.push(s>>>r&1)}}readBit(){let e=this.bits[this.pos];if(e===void 0)throw new Error("[GPP Decoder] Read past end of segment");return this.pos++,e===1}readInt(e){let n=0;for(let s=0;s<e;s++)n=n<<1|(this.readBit()?1:0);return n}readFibonacci(){let e=[],n=!1;for(;;){let i=this.readBit();if(i&&n)break;e.push(i),n=i}let s=0,r=1,o=2;for(let i of e)i&&(s+=r),[r,o]=[o,r+o];return s}readFibonacciRange(){let e=this.readInt(12),n=[],s=0;for(let r=0;r<e;r++){let o=this.readBit(),i=this.readFibonacci()+s;if(o){let c=this.readFibonacci()+i;for(let a=i;a<=c;a++)n.push(a);s=c}else n.push(i),s=i}return n}},et=class t{static decode(e){let n=e.split("~"),s=n[0];if(!s)throw new Error("[GPP Decoder] Empty GPP string");let r=t.decodeHeader(s);if(r.length!==n.length-1)throw new Error(`[GPP Decoder] Header lists ${r.length} section(s) but ${n.length-1} present`);for(let o=0;o<r.length;o++){let i=r[o],c=n[o+1];if(i!==void 0&&c!==void 0&&be[i])return{sectionIds:r,data:t.decodeSection(i,c)}}throw new Error("[GPP Decoder] No supported US section present")}static decodeHeader(e){let n=new Qe(e),s=n.readInt(6);if(s!==3)throw new Error(`[GPP Decoder] Not a GPP header (type ${s})`);let r=n.readInt(6);if(r!==1)throw new Error(`[GPP Decoder] Unsupported GPP version ${r}`);return n.readFibonacciRange()}static decodeSection(e,n){let s=be[e];if(!s)throw new Error(`[GPP Decoder] Unsupported section id ${e}`);let[r,o]=n.split(".");if(!r)throw new Error("[GPP Decoder] Missing core subsection");let i=new Qe(r),c={};for(let f of s.fields)if("array"in f){let S=[];for(let v=0;v<f.array;v++)S.push(i.readInt(2));c[f.name]=S}else c[f.name]=i.readInt(f.bits);if(c.Version!==1)throw new Error(`[GPP Decoder] Unsupported ${s.prefix} version ${String(c.Version)}`);let l=c.SaleOptOut===1,u=(c.SharingOptOut??c.TargetedAdvertisingOptOut)===1,p=!1;if(e===E.US_NATIONAL||e===E.US_CA){let f=c.SensitiveDataProcessing;p=Array.isArray(f)&&f.some(S=>S===1)}let y=!1;if(s.hasGpc&&o){let f=new Qe(o);f.readInt(2)===1&&(y=f.readBit())}return{saleOptOut:l,sharingOptOut:u,gpcDetected:y,limitSensitiveUse:p}}};function Te(){return{optedOutOfSale:!1,optedOutOfShare:!1,limitSensitiveUse:!1,gpcDetected:!1,timestamp:0,lastOptOutAt:0}}var ci=365*24*60*60*1e3;function li(){return Le()}function Bs(){if(typeof globalThis>"u")return;let t=globalThis.__1C_GEO;if(t?.country!=="US"||typeof t.region!="string")return;let e=t.region.toUpperCase();return/^[A-Z]{2}$/.test(e)?e:void 0}function di(){if(typeof globalThis>"u")return;let t=globalThis.__1C_GEO;return typeof t?.sensitiveOptIn=="boolean"?t.sensitiveOptIn:void 0}var Ot=class extends H{#e=Te();#t;#s;#n;#r;#i;#c;#o=!1;#a=!1;#d;constructor(e,n,s){super(e,n,s),this.#t=li(),this.#i=Bs(),this.#d=di();let r=s.us;this.#s=r?.mspaMode??"not_covered",this.#n=r?.sensitivePIInUse===!0,this.#r=r?.minorsPosture==="known_minors",this.#c=r?.denyAll===!0,this.#h();try{this.syncFastPath()}catch{}this.mergeConsentDowngradeBaseline(this.getConsentDowngradeSnapshot())}bootSyncsFastPath(){return!1}reloadExternalConsentState(e=!1){let n=this.state.hasConsent||this.storage.getConsent()!==void 0||this.storage.getFastPath()!==void 0,s=this.#f();if(super.reloadExternalConsentState(e),!e&&n&&!s){this.#u();return}this.#h(),e&&(this.#a=!1)}#f(){let e=this.storage.getConsent();if(!e)return!1;try{b.decodeForConfig(e.consent,this.config)}catch{return!1}if(e.gppString)try{return et.decode(e.gppString),!0}catch{}return typeof e.uspString=="string"&&/^1[YN-][YN-][YN-]$/.test(e.uspString)}#u(){(this.storage.getConsent()||this.storage.getFastPath())&&this.invalidateStoredConsent(),this.#e={...Te(),optedOutOfSale:!0,optedOutOfShare:!0,gpcDetected:this.#t},this.#o=!1}#h(){this.#e=this.#w(),this.#o=this.validatedStoredDecision!==void 0&&(this.#e.optedOutOfSale||this.#e.optedOutOfShare)&&!this.#r,this.#t&&(this.#e.gpcDetected=!0),this.#l()&&(this.#e.optedOutOfSale=!0,this.#e.optedOutOfShare=!0)}#l(){return this.#t||this.#r}#w(){let e=this.storage.getConsentSnapshot()??this.storage.getLatestConsentSnapshot(),n=e?.content;if(this.validatedStoredDecision=void 0,n){let s=0;try{let r=e?.prior?b.decode(n.consent):b.decodeForConfig(n.consent,this.config);if(r.configId!==this.config.appId||r.framework!=="us")throw new Error("US decision belongs to a different application or framework.");let o=r.timestamp*1e3;Number.isSafeInteger(o)&&o>0&&(s=o)}catch(r){return console.warn("[US Engine] Stored consent timestamp invalid; fastpath stays cold:",r),this.#g()}if(n.gppString)try{let{data:r}=et.decode(n.gppString);this.validatedStoredDecision=e;let o=r.saleOptOut||r.sharingOptOut;return{optedOutOfSale:r.saleOptOut,optedOutOfShare:r.sharingOptOut,limitSensitiveUse:this.#n&&(n.limitSensitiveUse??r.limitSensitiveUse)===!0,gpcDetected:!1,timestamp:s,lastOptOutAt:o?s:0}}catch(r){console.warn("[US Engine] Stored GPP string invalid, trying uspString:",r)}if(typeof n.uspString=="string"&&/^1[YN-][YN-][YN-]$/.test(n.uspString)){let r=n.uspString.charAt(2)==="Y";return this.validatedStoredDecision=e,{optedOutOfSale:r,optedOutOfShare:r,limitSensitiveUse:!1,gpcDetected:!1,timestamp:s,lastOptOutAt:r?s:0}}return this.#g()}return{...Te(),timestamp:Date.now()}}#g(){return this.invalidateStoredConsent(),{...Te(),optedOutOfSale:!0,optedOutOfShare:!0}}getFrameworkPrefix(){return"us"}acceptAll(){console.log("[US Engine] acceptAll()"),this.#l()||(this.#e.optedOutOfSale=!1,this.#e.optedOutOfShare=!1,this.#e.limitSensitiveUse=!1),super.acceptAll(),this.#e.timestamp=Date.now()}setCategoryConsent(e,n){this.#a=!0,super.setCategoryConsent(e,n)}setServiceConsent(e,n){this.#a=!0,super.setServiceConsent(e,n)}setConsent(e){this.#a=!0,super.setConsent(e)}save(){if(!this.state.hasConsent&&!this.#a){for(let e of this.config.categories)this.state.categories[e.id]=!0;for(let e of this.config.services)this.state.services[e.id]=!0}super.save(),this.#a=!1}getEvidenceConsentDecision(){let e=this.#S();return{...super.getEvidenceConsentDecision(),categoryProjection:J(this.config.categories.filter(n=>!n.essential).map(n=>this.state.categories[n.id]===!0)),framework:J([!e.optedOutOfSale,!e.optedOutOfShare,...this.#n?[!e.limitSensitiveUse]:[]])}}rejectAll(){console.log("[US Engine] rejectAll()"),super.rejectAll(),this.#e.optedOutOfSale=!0,this.#e.optedOutOfShare=!0,this.#n&&(this.#e.limitSensitiveUse=!0),this.#p()}#p(){let e=Date.now();this.#e.timestamp=e,this.#e.lastOptOutAt=e}isWithinReconsentWindow(){let{lastOptOutAt:e}=this.#S();return e>0&&Date.now()-e<ci}getOptOutOfSale(){return this.#S().optedOutOfSale}setOptOutOfSale(e){if(!e&&this.#l()){console.warn("[US Engine] Cannot opt back in to sale \u2014 opt-out is locked");return}console.log(`[US Engine] setOptOutOfSale(${e})`),this.#e.optedOutOfSale=e,e?this.#p():this.#e.timestamp=Date.now(),this.emit("consent:changed")}getOptOutOfShare(){return this.#S().optedOutOfShare}setOptOutOfShare(e){if(!e&&this.#l()){console.warn("[US Engine] Cannot opt back in to sharing \u2014 opt-out is locked");return}console.log(`[US Engine] setOptOutOfShare(${e})`),this.#e.optedOutOfShare=e,e?this.#p():this.#e.timestamp=Date.now(),this.emit("consent:changed")}setOptOutOfSaleAndShare(e){if(!e&&this.#l()){console.warn("[US Engine] Cannot opt back in to sale/sharing \u2014 opt-out is locked");return}console.log(`[US Engine] setOptOutOfSaleAndShare(${e})`),this.#e.optedOutOfSale=e,this.#e.optedOutOfShare=e,e?this.#p():this.#e.timestamp=Date.now(),this.emit("consent:changed")}getLimitSensitiveUse(){return this.#e.limitSensitiveUse}getSensitivePIInUse(){return this.#n}setLimitSensitiveUse(e){if(!this.#n){console.warn("[US Engine] setLimitSensitiveUse ignored \u2014 sensitive PI not in use");return}console.log(`[US Engine] setLimitSensitiveUse(${e})`),this.#e.limitSensitiveUse=e,e?this.#p():this.#e.timestamp=Date.now(),this.emit("consent:changed")}isGpcDetected(){return this.#t}getUsPrivacyState(){return{...this.#e}}getFastPathConsentMap(){return this.#m().map}#m(){let e=this.#S(),n=this.state.hasConsent&&this.hasValidConsent(),s=this.#n&&e.limitSensitiveUse,r=n||this.#o||this.#t||e.limitSensitiveUse,i=(n?this.getConsentTimestamp():null)??(this.#o||e.limitSensitiveUse?e.timestamp:0);return e.optedOutOfSale||e.optedOutOfShare||this.#l()?{map:this.#y(),decided:r,posture:!r,decisionTimestamp:i}:s?{map:this.#C(n?super.getFastPathConsentMap():this.#E()),decided:r,posture:!r,decisionTimestamp:i}:n?{map:super.getFastPathConsentMap(),decided:!0,posture:!1,decisionTimestamp:i}:this.#c?{map:this.#y(),decided:r,posture:!r,decisionTimestamp:i}:this.#n&&(this.#d??Lt(this.#i))?{map:this.#C(this.#E()),decided:r,posture:!r,decisionTimestamp:i}:{map:this.#E(),decided:r,posture:!r,decisionTimestamp:i}}#v(){let e=this.config.services.filter(r=>r.usSensitive===!0&&r.essential!==!0);if(e.length===0)return;let n={};for(let r of e)n[r.id]=!1;let s=new Set(e.map(r=>r.categoryId).filter(r=>r!==void 0));return this.config.categories.forEach(r=>{s.has(r.id)&&r.essential!==!0&&(n[r.id]=!1)}),n}#C(e){let n=this.#v();return n?{...e,...n}:this.#y()}#y(){return{...this.getDefaultCategoryConsents(),...this.getDefaultServiceConsents()}}#E(){let e={};return this.config.categories.forEach(n=>{e[n.id]=!0}),this.config.services.forEach(n=>{e[n.id]=!0}),e}syncFastPath(e){let n=this.#m(),s=n.decided&&n.decisionTimestamp>0;Ke(this.config,n.map,{gpcRevocable:!0,posture:n.posture,decisionTimestamp:n.decisionTimestamp,cookieMode:s?"decision":"clear"},e??(r=>this.storage.refreshFastPath(r,this.validatedStoredDecision)))}buildConsentEntry(e){return{consent:e,uspString:this.getUsPrivacyString(),gppString:this.getGppString(),limitSensitiveUse:this.#e?.limitSensitiveUse===!0}}#S(){return this.externalReconciliationPending?{...Te(),optedOutOfSale:!0,optedOutOfShare:!0,limitSensitiveUse:!0}:this.#e??Te()}getApplicableGppSections(){let n=Oe(this.config)&&this.config.us?.stateGeo===!0?Bs():void 0;return[(n?mn[n]:void 0)??E.US_NATIONAL]}getUsNationalSectionData(){let e=this.#S();return{saleOptOut:e.optedOutOfSale,sharingOptOut:e.optedOutOfShare,gpcDetected:e.gpcDetected,mspaMode:this.#s,sensitivePIInUse:this.#n,limitSensitiveUse:e.limitSensitiveUse,knownMinor:this.#r}}getGppString(){return Ze.encode(this.getUsNationalSectionData(),this.getApplicableGppSections())}resolve(e){let n=L(e.bindingKey);if(n?.framework!=="us")throw new Error(`[US Engine] Invalid binding key: ${e.bindingKey}`);let{entity:s}=n;switch(s){case"sale":return this.#b();case"share":return this.#T();case"saleAndShare":return this.#I();case"limitSensitiveUse":return this.#A();default:throw new Error(`[US Engine] Unknown entity type: ${s}`)}}resolveMany(e){let n=[];for(let s of e)try{let r=this.resolve(s);n.push({bindingKey:s.bindingKey,value:r.value,disabled:r.disabled})}catch(r){console.error("[US Engine] Failed to resolve binding:",s,r)}return{patches:n,version:this.versionTracker.getVersion()}}apply(e){let n=L(e.ref.bindingKey);if(n?.framework!=="us")throw new Error(`[US Engine] Invalid binding key: ${e.ref.bindingKey}`);let{entity:s}=n,r=[];if(s==="sale"){this.setOptOutOfSale(e.value);let i=this.#b();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled})}else if(s==="share"){this.setOptOutOfShare(e.value);let i=this.#T();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled})}else if(s==="limitSensitiveUse"){this.setLimitSensitiveUse(e.value);let i=this.#A();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled})}else if(s==="saleAndShare"){this.setOptOutOfSaleAndShare(e.value);let i=this.#I();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled});let c=this.#b();r.push({bindingKey:"consent:us.sale",value:c.value,disabled:c.disabled});let a=this.#T();r.push({bindingKey:"consent:us.share",value:a.value,disabled:a.disabled})}else throw new Error(`[US Engine] Unknown entity type: ${s}`);let o=this.versionTracker.increment();return{patches:r,version:o}}#b(){return{value:this.#e.optedOutOfSale,disabled:this.#l()}}#T(){return{value:this.#e.optedOutOfShare,disabled:this.#l()}}#I(){return{value:this.#e.optedOutOfSale&&this.#e.optedOutOfShare,disabled:this.#l()}}#A(){return{value:this.#e.limitSensitiveUse,disabled:!this.#n}}getUsPrivacyString(){return`1Y${this.#S().optedOutOfSale?"Y":"N"}-`}};var tt=class extends M{engine;constructor(e,n){super(e,n),this.engine=new Ot(this.bus,this.storage,e),this.attachBlocking(this.engine),this.resolveInitialLocale(this.engine.getStoredLocale())}async init(){this.bus.emit({type:"consent:ready"});let e=!this.engine.isGpcDetected()&&this.engine.isConsentRequired();if(e&&this.config.cmp.main){let n=this.ensureViewData("main");await this.ensureViewEngine(),await Promise.all([this.ensureViewLoaded("main"),n])}else e||await this.showReturningVisitorTrigger()}async acceptAll(){await this.storage.withExclusiveAccess(()=>{this.engine.acceptAll(),this.engine.save()}),await this.close()}async rejectAll(){await this.storage.withExclusiveAccess(()=>{this.engine.rejectAll(),this.engine.save()}),await this.close()}};var Sn=window.__1CONSENT_CONFIG__;if(re(Sn)){let t=Sn,e=new je;ht(t).then(async n=>{let s=await n.withExclusiveAccess(()=>Nt(t)?new qe(t,{bus:e,storage:n}):Vt(t)?new Xe(t,{bus:e,storage:n}):Oe(t)?new tt(t,{bus:e,storage:n}):null);if(!s)throw new Error("[Design Kit] Unsupported CMP framework config.");let r=Qt(s),o=new bs(e,s.engine,()=>s.getTranslations(),()=>s.openDetails(),i=>s.ensureViewData(i),i=>s.hasViewData(i),i=>s.setLanguage(i),()=>s.getThemeMode());window.__1consent=r,s.setViewEngine(o),s.init().catch(i=>console.error("[Design Kit] Controller init failed",i))}).catch(n=>console.error("[Design Kit] Runtime initialization failed",n))}else Sn!==void 0&&console.error("[Design Kit] Refusing to initialize an invalid CMP runtime config.");
1
+ function J(t,e){let n=t.base?e[t.base]:e;t.root==="scope"&&(n=e);for(let s of t.path){if(n==null)return;n=n[s]}return n}function Ks(t,e){switch(t.k){case"bool":return t.v;case"str":return t.v;case"path":return J(t.v,e)}}function kt(t,e,n){if(n==null||n===!1){t.removeAttribute(e);return}if(n===!0){t.setAttribute(e,"");return}let s=String(n);if(e==="class"&&(s=s.trim().replace(/\s+/g," ")),s===""&&!e.startsWith("data-1c-")){t.removeAttribute(e);return}t.setAttribute(e,s)}function En(t){return t==null||t===!1||t===0||t===""?!1:Array.isArray(t)?t.length>0:!0}function Z(t,e,n,s,r,o){switch(t.t){case"text":r.appendChild(document.createTextNode(t.v));break;case"bind":{let i=J(t.p,e);if(i!=null){let c=String(i);r.appendChild(document.createTextNode(c))}break}case"children":if(o)for(let i of o.nodes)Z(i,o.scope,n,s,r);break;case"each":{let i=J(t.list,e);if(Array.isArray(i))for(let c of i){let a={...e,[t.item]:c},l=document.createDocumentFragment();for(let d of t.body)Z(d,a,n,s,l,o);r.appendChild(l)}break}case"if":if(En(J(t.path,e))){let i=document.createDocumentFragment();for(let c of t.body)Z(c,e,n,s,i,o);r.appendChild(i)}break;case"if-not":if(!En(J(t.path,e))){let i=document.createDocumentFragment();for(let c of t.body)Z(c,e,n,s,i,o);r.appendChild(i)}break;case"use":{let i=n[t.name];if(!i){console.warn(`[1CL Executor] Component not found: ${t.name}`);return}let c={};for(let[u,m]of Object.entries(t.props))c[u]=Ks(m,e);let a={...e,props:c},l=t.children&&t.children.length>0?{nodes:t.children,scope:e}:void 0,d=document.createDocumentFragment();for(let u of i)Z(u,a,n,s,d,l);r.appendChild(d);break}case"el":{let i=["svg","path","g","circle","rect","line","polyline","polygon","defs","clipPath"].includes(t.tag)?document.createElementNS("http://www.w3.org/2000/svg",t.tag):document.createElement(t.tag);for(let a of t.attrs)if(a.k==="static")kt(i,a.name,a.value);else if(a.k==="bind"){let l=J(a.value,e);kt(i,a.name,l)}else if(a.k==="concat"){let l=a.parts.map(d=>d.k==="str"?d.v:String(J(d.v,e)??"")).join("");kt(i,a.name,l)}let c=document.createDocumentFragment();for(let a of t.kids)Z(a,e,n,s,c,o);i.appendChild(c),r.appendChild(i);break}}}function Lt(t,e,n={}){let s=document.createDocumentFragment(),r=n.view||"main",o=t.views[r];if(!o)return console.error(`[1CL Executor] View not found: ${r}`),s;for(let i of o)Z(i,e,t.components,n,s);return s}function bn(t,e,n,s={}){let r=Lt(t,e,s);n.innerHTML="",n.appendChild(r)}function _e(t,e=Date.now()){if(!Number.isSafeInteger(t)||t<=0||!Number.isSafeInteger(e)||e<0)return!1;let n=e+33696e6;return Number.isSafeInteger(n)?t>=e&&t<=n:!1}var Tn=["ar","bg","bs","ca","cs","cy","da","de","el","en","es","et","eu","fi","fr","gl","he","hi","hr","hu","id","is","it","ja","ka","ko","lt","lv","mk","ms","mt","nl","no","pl","pt-br","pt-pt","ro","ru","sk","sl","sq","sr-latn","sr-cyrl","sv","sw","th","tl","tr","uk","vi","zh","zh-hant"],_i=new Set(Tn),xi=Tn.filter(t=>t.includes("-")).sort((t,e)=>e.length-t.length);function zs(t){if(typeof t!="string")return null;let e=t.trim();if(e.length<2||e.length>255)return null;try{return Intl.getCanonicalLocales(e)[0]??null}catch{return null}}function Nt(t){return typeof t=="string"&&zs(t)===t}function Hs(t){return t.split("-")[0]||"en"}function In(t){let e=Hs(t).toLowerCase();return/^[a-z]{2}$/.test(e)?e:null}var qs=1440*60*1e3;var Vt="reload";var Q=5;var An=["VA","CO","CT","MT","TX","OR","DE","NH","NJ","MN","NE","MD","TN","FL","IN","KY","RI"];function Ft(t){return t===void 0?!0:An.indexOf(t.toUpperCase())!==-1}function $(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Ws(t){return typeof t=="string"&&/^[A-Za-z0-9_-]{1,64}$/.test(t)&&!/^[\da-f]{8}(-[\da-f]{4}){3}-[\da-f]{12}$/i.test(t)}function On(t){return $(t)&&[t.appId,t.frameworkId].every(Ws)}function ce(t){if(!$(t))return!1;let e=t;return!(!(typeof e.appId=="string"&&(e.publicIdentity===void 0||On(e.publicIdentity))&&typeof e.version=="number"&&$(e.languages)&&Array.isArray(e.languages.supported)&&Nt(e.languages.primary)&&e.languages.supported.every(Nt)&&new Set(e.languages.supported).size===e.languages.supported.length&&e.languages.supported.includes(e.languages.primary)&&$(e.cmp)&&typeof e.cmp.main=="string"&&typeof e.cmp.uiData=="string"&&typeof e.cmp.serviceDetails=="string"&&Array.isArray(e.categories)&&Array.isArray(e.services)&&Array.isArray(e.scripts)&&$(e.appearance)&&$(e.framework))||e.machine!=="P"&&e.machine!=="S"&&e.machine!=="D")}function Rt(t){return t.cmp.trigger?t.framework.type==="us"?!0:!!t.appearance?.trigger:!1}function Mt(t){return ce(t)&&t.framework.type==="gdpr"}function Bt(t){if(!ce(t)||t.framework.type!=="tcf"||!("vendorListVersion"in t.framework)||!Number.isSafeInteger(t.framework.vendorListVersion)||t.framework.vendorListVersion<=0||!("vendors"in t)||!Array.isArray(t.vendors))return!1;let e=s=>Array.isArray(s)&&s.every(r=>Number.isSafeInteger(r)&&r>0)&&new Set(s).size===s.length,n=[];for(let s of t.vendors){if(!$(s))return!1;let r=s.id;if(typeof r!="number"||!Number.isSafeInteger(r)||r<=0||!e(s.consentPurposeIds)||!e(s.legitimateInterestPurposeIds)||!e(s.flexiblePurposeIds)||!e(s.specialFeatureIds))return!1;n.push(r)}return new Set(n).size===n.length}function xe(t){return ce(t)&&t.framework.type==="us"}var G="1consent",Ut=1;function ee(t){return{...t.consentContinuity?{consentContinuityRevision:t.consentContinuity.revision}:{},appId:t.appId,frameworkId:t.framework.id,type:t.framework.type,machine:t.machine,configVersion:t.version,consentEpoch:t.consentEpoch??0,...t.framework.type==="tcf"?{tcfPolicyVersion:Q}:{},primaryLanguage:t.languages.primary}}function le(){return{schemaVersion:Ut,apps:{}}}function Pe(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function _n(t){return Pe(t)&&t.schemaVersion===Ut&&Pe(t.apps)}function at(t){if(!t)return le();try{let e=JSON.parse(t);return _n(e)?e:le()}catch{return le()}}function De(t){return Pe(t)?Object.values(t).every(e=>typeof e=="boolean"):!1}function ke(t){return Pe(t)&&typeof t.structuralVersion=="string"&&t.structuralVersion.length>0&&De(t.services)&&De(t.categories)&&(t.categoryOrder===void 0||Array.isArray(t.categoryOrder)&&t.categoryOrder.every(e=>typeof e=="string")&&new Set(t.categoryOrder).size===t.categoryOrder.length)}function ct(t){return Pe(t)?typeof t.structuralVersion=="string"&&typeof t.consentEpoch=="number"&&Number.isSafeInteger(t.consentEpoch)&&t.consentEpoch>=0&&typeof t.expiresAt=="number"&&Number.isSafeInteger(t.expiresAt)&&t.expiresAt>=0&&De(t.services)&&De(t.categories)&&(t.decisionIntegrity===void 0||typeof t.decisionIntegrity=="string")&&(t.tcfCmpId===void 0||typeof t.tcfCmpId=="number"&&Number.isSafeInteger(t.tcfCmpId)&&t.tcfCmpId>=0&&t.tcfCmpId<=4095)&&(t.tcfValidationVersion===void 0||typeof t.tcfValidationVersion=="number"&&Number.isSafeInteger(t.tcfValidationVersion)&&t.tcfValidationVersion>0)&&(t.tcfDisclosedVendorKey===void 0||typeof t.tcfDisclosedVendorKey=="string"&&/^(?:[1-9]\d*(?:,[1-9]\d*)*)?$/.test(t.tcfDisclosedVendorKey))&&(t.tcfApiDataIntegrity===void 0||typeof t.tcfApiDataIntegrity=="string")&&(t.gpcRevocable===void 0||t.gpcRevocable===!0)&&(t.posture===void 0||t.posture===!0):!1}function $t(t,e=Date.now()){return ct(t)?_e(t.expiresAt,e):!1}var Ys="1consent:browser-store",Le=new WeakSet,xn=Promise.resolve();function Pn(t){let e=xn.then(()=>{let n={owner:Symbol("memory-storage-owner")};Le.add(n);try{return t(n)}finally{Le.delete(n)}});return xn=e.then(()=>{},()=>{}),e}function Gt(t){return t!==void 0&&Le.has(t)}async function Dn(t){if(typeof navigator>"u"||!navigator.locks)throw new Error("[BrowserStorage] Native writer is unavailable; initialize the runtime coordinator.");return navigator.locks.request(Ys,async()=>{let e={owner:Symbol("browser-storage-owner")};Le.add(e);try{return await t(e)}finally{Le.delete(e)}})}var kn=["center-center","bottom-left","bottom-right","bottom-center"],Xs=[...kn,"panel-right"],Ln=["left","center"],Nn=["accept-first","reject-first"],Vn=["left","right","center","full"],Fn=["equal","emphasize-accept"];var Ri=new Set(Ln),Mi=new Set(Nn),Bi=new Set(Vn),Ui=new Set(Fn);function jt(t){let e=a=>typeof a=="object"&&a!==null&&!Array.isArray(a);if(!e(t))return!1;let n=t,s=a=>Array.isArray(a)&&a.every(l=>typeof l=="number"&&Number.isSafeInteger(l)&&l>0),r=a=>Array.isArray(a)&&a.every(l=>typeof l=="string"),o=n.disclosures;if(!Array.isArray(o)||!o.every(a=>{if(!e(a))return!1;let l=a;return typeof l.identifier=="string"&&["cookie","web","app"].includes(String(l.type))&&(l.maxAgeSeconds===null||typeof l.maxAgeSeconds=="number"&&Number.isSafeInteger(l.maxAgeSeconds)&&l.maxAgeSeconds>=0)&&typeof l.cookieRefresh=="boolean"&&r(l.domains)&&s(l.purposes)&&s(l.specialPurposes)&&(l.description===void 0||typeof l.description=="string")&&typeof l.optOut=="boolean"}))return!1;let i=n.domains;if(i!==void 0&&(!Array.isArray(i)||!i.every(a=>e(a)&&typeof a.domain=="string"&&typeof a.use=="string")))return!1;let c=n.sdks;return c===void 0||Array.isArray(c)&&c.every(a=>e(a)&&typeof a.name=="string"&&typeof a.use=="string")}function te(t){return t.map(e=>e?"1":"0").join("")}function Rn(t){let e=t.categories+t.services+t.framework;return e.length===0||e.includes("0")&&e.includes("1")?"granular":e.includes("1")?"accept_all":"deny_all"}function Mn(t){return[[...new Set(t.flatMap(e=>e.consentPurposeIds))],[...new Set(t.flatMap(e=>e.legitimateInterestPurposeIds))],[...new Set(t.flatMap(e=>e.specialFeatureIds))],t.filter(e=>e.consentPurposeIds.length>0).map(e=>e.id),t.filter(e=>e.legitimateInterestPurposeIds.length>0).map(e=>e.id)]}var ue="1consent";var Ne=["data-1c-service","data-1c-service-tag","data-1c-tag"],Ve="data-1c-category",zt="data-1c-resolved";function Un(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return e.toString(36)}function x(t,e){let n=t.map(r=>`${r.id}\0${r.name??""}\0${r.tag??""}\0${r.categoryId??""}\0${r.essential?1:0}${r.catalogServiceKey?`\0k\0${r.catalogServiceKey}`:""}${r.usSensitive?"\x001":""}`).sort(),s=e.map(r=>`${r.id}\0${r.name}\0${r.essential?1:0}`).sort();return Un(`s:${n.join("")}|c:${s.join("")}`)}function de(t,e,n){t[e]=e in t?t[e]===!0&&n:n}function Fe(t,e,n,s){let r=$n(t,e,n,s);return{services:r.services,categories:r.categories}}function $n(t,e,n,s){let r={},o=new Map,i=!1;for(let a of t){let l=a.essential===!0||n[a.id]===!0;if(l&&a.essential!==!0&&(i=!0),de(r,a.id,l),a.catalogServiceKey&&de(r,a.catalogServiceKey,l),a.tag&&de(r,a.tag,l),a.name&&de(r,a.name,l),a.categoryId){let d=o.get(a.categoryId)??{total:0,granted:0};d.total+=1,l&&(d.granted+=1),o.set(a.categoryId,d)}}let c={};for(let a of e){let l=o.get(a.id),d=l!==void 0&&l.total>0&&l.granted===l.total,u=a.essential===!0||s[a.id]===!0||d;u&&a.essential!==!0&&s[a.id]===!0&&(i=!0),de(c,a.id,u),de(c,a.name,u)}return{services:r,categories:c,nonEssentialGranted:i}}function Ht(t,e,n,s,r){let o=$n(t,e,n,s),i=r?.decisionTimestamp,c=i!==void 0&&Number.isSafeInteger(i)&&i>0?i+33696e6:0,a={v:x(t,e),e:Number.isSafeInteger(c)?c:0,s:o.services,c:o.categories};return r?.gpcRevocable===!0&&o.nonEssentialGranted&&(a.g=1),r?.posture===!0&&(a.p=1),a}function Re(){return typeof navigator>"u"?!1:navigator.globalPrivacyControl===!0}var qt=2;function Gn(t){return t==="A"||t==="D"||t==="G"}var Zs=/^[A-Za-z0-9_-]+$/,Qs=/^[a-z0-9]+$/;function Kt(t){return t.length>0&&Zs.test(t)}function er(t){return t.length>0&&Qs.test(t)}function tr(t){return t==="gdpr"||t==="tcf"||t==="us"}function nr(t){return t==="P"||t==="S"||t==="D"}function jn(t){return Gn(t.decision)&&typeof t.appId=="string"&&Kt(t.appId)&&typeof t.frameworkId=="string"&&Kt(t.frameworkId)&&tr(t.frameworkType)&&nr(t.machine)&&typeof t.primaryLanguage=="string"&&Kt(t.primaryLanguage)&&typeof t.structuralVersion=="string"&&er(t.structuralVersion)&&typeof t.consentEpoch=="number"&&Number.isSafeInteger(t.consentEpoch)&&t.consentEpoch>=0&&typeof t.expiresAt=="number"&&Number.isSafeInteger(t.expiresAt)&&t.expiresAt>0}function Bn(t){if(!/^(0|[1-9]\d*)$/.test(t))return null;let e=Number(t);return Number.isSafeInteger(e)&&String(e)===t?e:null}function Wt(t){if(!jn(t))throw new TypeError(ue);return[qt,t.decision,t.appId,t.frameworkId,t.frameworkType,t.machine,t.primaryLanguage,t.structuralVersion,t.consentEpoch,t.expiresAt].join(".")}function Yt(t){if(!t)return null;let e=t.split(".");if(e.length!==10||e[0]!==String(qt))return null;let n=e[1],s=e[2],r=e[3],o=e[4],i=e[5],c=e[6],a=e[7],l=e[8],d=e[9];if(!l||!d)return null;let u=Bn(l),m=Bn(d),g={decision:n,appId:s,frameworkId:r,frameworkType:o,machine:i,primaryLanguage:c,structuralVersion:a,consentEpoch:u,expiresAt:m};return jn(g)?g:null}function j(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function ne(t,e){return j(t)&&Object.entries(t).every(([n,s])=>/^[1-9]\d*$/.test(n)&&s===!0&&(typeof e=="number"?+n<=e:e[n]===!0))}function sr(t){return j(t)&&Object.entries(t).every(([e,n])=>/^(1[01]|[1-9])$/.test(e)&&j(n)&&Object.entries(n).every(([s,r])=>/^[1-9]\d*$/.test(s)&&+s<=65535&&(r===0||r===1||r===2)))}function Kn(t){if(!j(t)||!j(t.purpose)||!j(t.vendor))return!1;let e=t.publisher;return!j(e)||!j(e.customPurpose)?!1:(t.enableAdvertiserConsentMode===void 0||t.enableAdvertiserConsentMode===!0)&&[t.tcfPolicyVersion,t.cmpId,t.cmpVersion].every(n=>typeof n=="number"&&Number.isSafeInteger(n)&&n>=0&&n<2**12)&&[t.isServiceSpecific,t.useNonStandardTexts,t.purposeOneTreatment].every(n=>typeof n=="boolean")&&typeof t.publisherCC=="string"&&/^[A-Z]{2}$/.test(t.publisherCC)&&ne(t.purpose.consents,11)&&ne(t.purpose.legitimateInterests,11)&&Object.keys(t.purpose.legitimateInterests).every(n=>/^(2|[789]|1[01])$/.test(n))&&ne(t.vendor.disclosedVendors,65535)&&ne(t.vendor.consents,t.vendor.disclosedVendors)&&ne(t.vendor.legitimateInterests,t.vendor.disclosedVendors)&&ne(t.specialFeatureOptins,2)&&[e.consents,e.legitimateInterests,e.customPurpose.consents,e.customPurpose.legitimateInterests].every(n=>ne(n,0))&&sr(e.restrictions)}function zn(t,e){return`${t}\0${JSON.stringify(e)}`}var Me=4095,Hn=1,qn=10;function lt(t){return[...new Set(t)].sort((e,n)=>e-n).join(",")}var dt=class{config;framework;#e;#t;#n=[];#s=null;#r=!1;#i="granular";#c=new Set;#o;constructor(e,n,s,r){this.config=e,this.framework=r,this.#e=Math.random()<e.sampleRate,this.#t=s.getConsentId()!==void 0;let o=typeof window<"u"?window.__1C_AB:void 0;if(this.#o=o?{abTestId:o.testId,abVariant:o.variant}:void 0,typeof document>"u"||(n.on("monitoring:error",c=>this.#p(c.payload.code)),!this.#e))return;n.on("view:transition",c=>{c.payload.to!=="none"&&this.#a()}),n.on("view:change",c=>{c.payload.view!=="none"&&this.#a()}),n.on("consent:accepted-all",()=>{this.#i="accept_all"}),n.on("consent:rejected-all",()=>{this.#i="deny_all"}),n.on("consent:rejected",()=>{this.#i="deny_all"}),n.on("consent:saved",()=>this.#d());let i=()=>{document.visibilityState==="hidden"&&this.#u()};document.addEventListener("visibilitychange",i),window.addEventListener("pagehide",()=>this.#u())}#a(){if(this.#s!==null)return;let e=Date.now();this.#s=e,this.#n.push({type:"impression",ts:e,hasConsentStored:this.#t,framework:this.framework,...this.#o})}#d(){if(this.#s===null||this.#r)return;this.#r=!0;let e=Date.now();this.#n.push({type:"decision",ts:e,hasConsentStored:this.#t,framework:this.framework,action:this.#i,tToConsentMs:e-this.#s,...this.#o}),this.#u()}#p(e){this.#c.has(e)||(this.#c.add(e),this.#n.push({type:"monitoring",ts:Date.now(),hasConsentStored:this.#t,framework:this.framework,code:e,...this.#o}),this.#u())}#u(){if(this.#n.length===0)return;let e=JSON.stringify({id:crypto.randomUUID(),token:this.config.token,events:this.#n});this.#n=[];let n=`${this.config.url}/v1/analytics`;typeof navigator.sendBeacon=="function"&&navigator.sendBeacon(n,new Blob([e],{type:"text/plain"}))||fetch(n,{method:"POST",body:e,keepalive:!0}).catch(()=>{})}};function k(t){if(!t.startsWith("consent:"))return null;let e=t.slice(8).split(".");if(e.length!==2)return null;let[n,s]=e;return n!=="gdpr"&&n!=="tcf"&&n!=="us"||!s?null:{framework:n,entity:s}}function Xt(t){return k(t)!==null}var Be=class{version=0;getVersion(){return this.version}increment(){return++this.version}reset(){this.version=0}};function K(t,e){let n={};for(let s of t.categories)n[`category:${s.id}`]=e[s.id]===!0;for(let s of t.services)n[`service:${s.id}`]=e[s.id]===!0;return n}function Ue(t,e){if(!$t(e)||e.consentEpoch<(t.consentEpoch??0)||e.structuralVersion!==x(t.services,t.categories))return;if(e.gpcRevocable&&Re())return K(t,{});let n={};for(let s of t.categories)n[`category:${s.id}`]=e.categories[s.id]===!0;for(let s of t.services)n[`service:${s.id}`]=e.services[s.id]===!0;return n}function he(t,e){for(let n of Object.keys(t))if(t[n]===!0&&e[n]!==!0)return!0;return!1}function fe(t){return t.consentDowngradeBehavior??Vt}function Wn(t,e){if(!/^[0-9a-z]+$/.test(t))throw new Error(`Invalid consent string: ${e} is not canonical base36`);let n=Number.parseInt(t,36);if(!Number.isSafeInteger(n)||n.toString(36)!==t)throw new Error(`Invalid consent string: ${e} is not a safe canonical integer`);return n}function ir(t){if(!/^[A-Za-z0-9_-]*$/.test(t)||t.length%4===1)return!1;try{let e=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=atob(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")===t}catch{return!1}}var T=class t{static encode(e){let n=[e.machine,e.configId,e.version.toString(36),e.framework,e.state];return e.state==="G"&&e.payload&&n.push(`${e.payload.mode}${e.payload.bits}`),n.push(e.language),n.push(e.timestamp.toString(36)),n.join(".")}static decode(e,n={}){let s=e.split("."),r=s[0],o=s[1],i=s[2],c=s[3],a=s[4];if(r!=="P"&&r!=="S"&&r!=="D")throw new Error("Invalid consent string: unsupported machine");if(!o)throw new Error("Invalid consent string: missing config id");if(!i)throw new Error("Invalid consent string: missing codec version");let l=Wn(i,"codec version");if(l!==1)throw new Error("Invalid consent string: unsupported codec version");if(c!=="gdpr"&&c!=="tcf"&&c!=="us")throw new Error("Invalid consent string: unsupported framework");if(a!=="A"&&a!=="D"&&a!=="G")throw new Error("Invalid consent string: unsupported state");let d=a==="G"?8:7;if(s.length!==d)throw new Error("Invalid consent string: noncanonical component count");let u,m=5;if(a==="G"){let f=s[5];if(!f)throw new Error("Invalid consent string: missing granular payload");let S=f[0],E=f.slice(1);if(S!=="a"&&S!=="d"||!ir(E))throw new Error("Invalid consent string: malformed granular payload");u={mode:S,bits:E},m=6}let g=s[m],h=s[m+1];if(!g||!h)throw new Error("Invalid consent string: missing language or timestamp");let y=Wn(h,"timestamp"),v=Math.floor(Date.now()/1e3),p=n.maxFutureSkewSeconds??0;if(y<=0||!Number.isSafeInteger(v)||v<0||!Number.isSafeInteger(p)||p<0||y>v+p)throw new Error("Invalid consent string: timestamp is not a past positive instant");let A={machine:r,configId:o,version:l,framework:c,state:a,...u?{payload:u}:{},language:g,timestamp:y};if(t.encode(A)!==e)throw new Error("Invalid consent string: noncanonical encoding");return A}static decodeForConfig(e,n){let s=t.decode(e);if(s.machine!==n.machine||s.configId!==n.appId||s.framework!==n.framework.type)throw new Error("Invalid consent string: decision identity does not match live config");return s}static encodeBitset(e){let n=e.filter(Boolean).length,s=e.length-n,r=n<=s?"a":"d",o=r==="a",i=new Uint8Array(Math.ceil(e.length/8));for(let a=0;a<e.length;a++)if(e[a]===o){let l=Math.floor(a/8),d=a%8;i[l]|=1<<d}let c=btoa(String.fromCharCode(...i)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return{mode:r,bits:c}}static decodeBitset(e,n){let s=e.bits.replace(/-/g,"+").replace(/_/g,"/"),r=atob(s),o=new Uint8Array(r.length);for(let a=0;a<r.length;a++)o[a]=r.charCodeAt(a);let i=e.mode,c=new Array(n).fill(i!=="a");for(let a=0;a<n;a++){let l=Math.floor(a/8),d=a%8;l<o.length&&o[l]&1<<d&&(c[a]=i==="a")}return c}};var Jt=class{#e;#t=typeof window<"u"&&window.origin==="null"&&window.parent!==window&&window.__1cStore||new Map;#n=[];constructor(){let e=`${G}:test`;try{localStorage.setItem(e,e),this.#e=localStorage.getItem(e)===e,localStorage.removeItem(e)}catch{this.#e=!1}}getItem(e){if(this.#e)try{return localStorage.getItem(e)}catch{this.#e=!1}return this.#t.get(e)??null}setItem(e,n){if(this.#e)try{localStorage.setItem(e,n);return}catch{this.#e=!1}this.#t.set(e,n);let s=this.#n;this.#n=void 0,s?.forEach(r=>{r()})}onPersistenceFailure(e){this.#n?.push(e)??e()}removeItem(e){if(this.#e)try{localStorage.removeItem(e)}catch{this.#e=!1}this.#t.delete(e)}isLocalStorageAvailable(){return this.#e}},se=new Jt;var re=Symbol(),$e=Symbol(),Yn=Symbol(),z=Symbol(),Xn=Symbol(),F=Symbol(),pe=Symbol(),R=Symbol(),Ge=Symbol(),je=Symbol(),ut=Symbol(),Jn=Symbol(),ge=Symbol(),w=Symbol(),or={run:Dn,isActive:Gt},Se=class{lease;coordinator;constructor(e,n=or){this.lease=e,this.coordinator=n}withExclusiveAccess(e){return(se.isLocalStorageAvailable()?this.coordinator.run:Pn)(s=>{let r=this.lease;this.lease=s;try{let o=e();if(o instanceof Promise)throw new Error("[OneConsentStorage] Writes must be synchronous.");return o}finally{this.lease=r}})}isExclusiveAccessHeld(){return Gt(this.lease)||this.coordinator.isActive(this.lease)}assertExclusiveAccess(){if(!this.isExclusiveAccessHeld())throw new Error("[OneConsentStorage] Write requires exclusive access.")}read(){return se.getItem(G)}write(e){this.assertExclusiveAccess(),se.setItem(G,e)}remove(){this.assertExclusiveAccess(),se.removeItem(G)}};function H(){return Math.floor(Date.now()/1e3)}function ye(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Zn(t){return ye(t)&&typeof t.updatedAt=="number"&&ye(t.frameworks)&&(t.consentContinuityRevision===void 0||typeof t.consentContinuityRevision=="number"&&Number.isSafeInteger(t.consentContinuityRevision)&&t.consentContinuityRevision>=0)&&(t.consentId===void 0||typeof t.consentId=="string")}function ht(t){return ye(t)&&(t.type==="gdpr"||t.type==="tcf"||t.type==="us")&&(t.machine==="P"||t.machine==="S"||t.machine==="D")&&typeof t.configVersion=="number"&&(t.consentEpoch===void 0||typeof t.consentEpoch=="number"&&Number.isSafeInteger(t.consentEpoch)&&t.consentEpoch>=0)&&(t.tcfPolicyVersion===void 0||typeof t.tcfPolicyVersion=="number"&&Number.isSafeInteger(t.tcfPolicyVersion)&&t.tcfPolicyVersion>=0)&&typeof t.primaryLanguage=="string"&&typeof t.updatedAt=="number"&&(t.consentContinuityKey===void 0||typeof t.consentContinuityKey=="string")&&[t.consentDecisionAt,t.consentInvalidatedAt].every(e=>e===void 0||typeof e=="number"&&Number.isSafeInteger(e)&&e>=0)}function me(t,e){return t.type===e.type&&t.machine===e.machine&&(t.consentEpoch??0)>=e.consentEpoch&&(e.tcfPolicyVersion===void 0||t.tcfPolicyVersion===e.tcfPolicyVersion)&&t.primaryLanguage===e.primaryLanguage}function Ce(t,e){let s=at(t).apps[e.appId];if(!Zn(s)||e.consentContinuityRevision!==void 0&&(s.consentContinuityRevision??0)>e.consentContinuityRevision)return;let r=s.frameworks[e.frameworkId];return ht(r)&&me(r,e)?r:void 0}function Qn(t){let e={};return t.gdprChoices!==void 0&&(e.gdprChoices=t.gdprChoices),t.tcString!==void 0&&(e.tcString=t.tcString),t.uspString!==void 0&&(e.uspString=t.uspString),t.gppString!==void 0&&(e.gppString=t.gppString),t.limitSensitiveUse!==void 0&&(e.limitSensitiveUse=t.limitSensitiveUse),e}function Zt(t){let e={consent:t.value,firstSeenAt:t.firstSeenAt,lastSeenAt:t.lastSeenAt,...Qn(t)};return es(e)?e:void 0}function ar(t){return{value:t.consent,firstSeenAt:t.firstSeenAt,lastSeenAt:t.lastSeenAt,...Qn(t)}}var Qt=10,we=class{[ge];[w];constructor(e,n){this[ge]=e,this[w]=n}withExclusiveAccess(e){return this[ge].withExclusiveAccess?this[ge].withExclusiveAccess(e):Promise.resolve(e())}[re](e){return e.consentDecisionAt??(e.consent?.lastSeenAt??0)*1e3}[$e](e){let n=this[R](e);return n&&me(n,this[w])?n:void 0}[Yn](e,n,s){}getContinuityScopes(){return[]}getScope(){return this[w]}[z](){try{return at(this[ge].read())}catch{return le()}}[Xn](e){this[ge].write(JSON.stringify(e))}[F](e){let n=this[z](),s=e(n);return this[Xn](n),s}[pe](e){let n=e.apps[this[w].appId];return Zn(n)?n:void 0}[R](e){let n=this[pe](e)?.frameworks[this[w].frameworkId];return ht(n)&&n.type===this[w].type?n:void 0}[Ge](e,n){let s=this[pe](e);if(s)return s.updatedAt=n,s;let r={updatedAt:n,frameworks:{}};return e.apps[this[w].appId]=r,r}[je](e,n){let s=this[Ge](e,n),r=s.frameworks[this[w].frameworkId];if(ht(r)&&me(r,this[w]))return r.updatedAt=n,r;let o={type:this[w].type,machine:this[w].machine,configVersion:this[w].configVersion,consentEpoch:this[w].consentEpoch,tcfPolicyVersion:this[w].tcfPolicyVersion,primaryLanguage:this[w].primaryLanguage,updatedAt:n};return ht(r)&&(r.type===this[w].type&&(o.prior=r.consent??r.prior),r.outbox&&(o.outbox=r.outbox)),s.frameworks[this[w].frameworkId]=o,o}[ut](e){let n=this[R](e);if(n&&(n.consentEpoch??0)>this[w].consentEpoch)throw new Error("[OneConsentStorage] A newer consent epoch is already stored.")}getConsent(){return this.getConsentSnapshot()?.content}getConsentSnapshot(){let e=this[$e](this[z]());if(!e?.consent)return;let n=Zt(e.consent);return n?{content:n,decisionAt:this[re](e)}:void 0}getLatestConsent(){return this.getLatestConsentSnapshot()?.content}getLatestConsentSnapshot(){let e=this[R](this[z]()),n=e?.consent??e?.prior;if(e&&(e.consentInvalidatedAt??0)>=Math.max(this[re](e),(n?.lastSeenAt??0)*1e3))return;let s=n?Zt(n):void 0;return s&&e?{content:s,decisionAt:this[re](e),prior:!0}:void 0}getContents(){let e=this.getConsent();return e?[e]:[]}getConsentId(){return this[pe](this[z]())?.consentId}setConsentId(e){let n=H();this[F](s=>{this[Ge](s,n).consentId=e})}updateConsent(e,n){if(!this[pe](this[z]())?.consentId)throw new Error("[OneConsentStorage] Call setConsentId() before storing consent.");let s=H(),r={...e,firstSeenAt:s,lastSeenAt:s};es(r)&&this[F](o=>this[Jn](o,r,n,s))}[Jn](e,n,s,r){this[ut](e);let o=this[$e](e)?.consent,i=this[je](e,r);return i.machine=this[w].machine,i.configVersion=this[w].configVersion,i.consentEpoch=this[w].consentEpoch,this[w].tcfPolicyVersion===void 0?delete i.tcfPolicyVersion:i.tcfPolicyVersion=this[w].tcfPolicyVersion,i.primaryLanguage=this[w].primaryLanguage,i.consent=ar({...n,firstSeenAt:o?.firstSeenAt??r,lastSeenAt:r}),s&&(i.fastPath=s),i.consentDecisionAt=Math.max(Date.now(),this[re](i)+1,(i.consentInvalidatedAt??0)+1),delete i.consentInvalidatedAt,delete i.prior,i}refreshFastPath(e,n){this.setFastPath(e)}updateConsentLocale(e,n){let s=H();this[F](r=>{this[ut](r);let o=this[$e](r),i=o?.consent?Zt(o.consent):void 0;if(!o||!i||JSON.stringify({content:i,decisionAt:this[re](o)})!==JSON.stringify(e))throw new Error("[OneConsentStorage] Consent changed during locale refresh.");let c=this[je](r,s);c.consent={...o.consent,value:n,firstSeenAt:i.firstSeenAt,lastSeenAt:i.lastSeenAt},c.consentDecisionAt=this[re](o),o.fastPath&&(c.fastPath=o.fastPath),this[Yn](r,c,s)})}setFastPath(e){let n=H();this[F](s=>{this[ut](s),this[je](s,n).fastPath=e})}getFastPath(){let e=this[$e](this[z]());if(e&&ct(e.fastPath))return e.fastPath}removeFastPath(){let e=H();this[F](n=>{let s=this[R](n);!s||!me(s,this[w])||(s.consentEpoch??0)!==this[w].consentEpoch||(delete s.fastPath,s.updatedAt=e,this[Ge](n,e))})}invalidateConsent(){let e=H();return this[F](n=>{let s=this[R](n);return!s||!me(s,this[w])||(s.consentEpoch??0)!==this[w].consentEpoch?!1:(delete s.consent,delete s.fastPath,s.updatedAt=e,this[Ge](n,e),!0)})}removeAll(){this[F](e=>{let n=this[pe](e),s=this[R](e);!n||!s||!me(s,this[w])||(delete n.frameworks[this[w].frameworkId],n.updatedAt=H(),Object.keys(n.frameworks).length===0&&!n.experiment&&delete e.apps[this[w].appId])})}getPendingEvents(){let e=this[R](this[z]())?.outbox?.consentEvents;return Array.isArray(e)?e.filter(cr):[]}queuePendingEvent(e){let n=this.getPendingEvents().filter(r=>r.eventId!==e.eventId);n.push(e),n.length>Qt&&console.warn(`[OneConsentStorage] Event queue full \u2014 dropping ${n.length-Qt} oldest`);let s=H();this[F](r=>{this[je](r,s).outbox={consentEvents:n.slice(-Qt)}})}removePendingEvent(e){let n=this.getPendingEvents().filter(s=>s.eventId!==e);this[F](s=>{let r=this[R](s);r&&(n.length?r.outbox={consentEvents:n}:delete r.outbox)})}};function cr(t){return ye(t)&&typeof t.url=="string"&&typeof t.eventId=="string"&&ye(t.payload)}function es(t){return!ye(t)||typeof t.consent!="string"||t.consent.length<5||typeof t.firstSeenAt!="number"||typeof t.lastSeenAt!="number"||t.gdprChoices!==void 0&&(!ke(t.gdprChoices)||t.tcString!==void 0||t.uspString!==void 0||t.gppString!==void 0||t.limitSensitiveUse!==void 0)||t.tcString!==void 0&&typeof t.tcString!="string"||t.uspString!==void 0&&typeof t.uspString!="string"||t.gppString!==void 0&&typeof t.gppString!="string"||t.limitSensitiveUse!==void 0&&typeof t.limitSensitiveUse!="boolean"?!1:!(t.tcString!==void 0&&(t.uspString!==void 0||t.gppString!==void 0))}function ts(t,e){let n=Ce(e,ee(t));return Ue(t,n?.fastPath)}function en(t,e){let n=Ce(e,ee(t)),s=n?.consent??(t.framework.type==="us"?n?.prior:void 0);if(!s)return;let r=s.value;try{T.decodeForConfig(s.value,t),r=s.value.replace(/\.[^.]+(\.[^.]+)$/,"$1")}catch{r=`!${r}`}let o=s.gdprChoices,i=a=>Object.keys(a).sort().map(l=>[l,a[l]]),c=ke(o)?[o.structuralVersion,o.categoryOrder,i(o.categories),i(o.services)]:o===void 0?void 0:["invalid",o];return JSON.stringify([r,c,s.tcString,s.uspString,s.gppString,s.limitSensitiveUse])}var Ke=class{externalReconciliationPending=!1;beginExternalConsentReconciliation(e,n){return this.hasExternalConsentChange(e,n)?(this.externalReconciliationPending=!0,this.bus.emit({type:"consent:pending"}),!0):!1}isExternalConsentReconciliationPending(){return this.externalReconciliationPending}bus;storage;config;constructor(e,n,s){this.bus=e,this.storage=n,this.config=s}withExclusiveAccess(e){return this.storage.withExclusiveAccess(e)}getConfig(){return this.config}getDisplayLocale(){return this.config.languages.primary}getExternalConsentSnapshot(e){return ts(this.config,e)}getCurrentExternalConsentSnapshot(){let e=this.getEnforcementConsentState();if(e.hasConsent)return K(this.config,{...e.categories,...e.services})}shouldReloadForExternalConsentChange(e,n){if(fe(this.config)!=="reload")return!1;let s=e===null&&n===null?this.getCurrentExternalConsentSnapshot():this.getExternalConsentSnapshot(e);if(!s)return!1;let r=this.getExternalConsentSnapshot(n)??{};return he(s,r)}hasExternalConsentChange(e,n){return e!==null||n!==null?en(this.config,e)!==en(this.config,n):this.getCurrentExternalConsentSnapshot()!==void 0}emit(e,n){this.bus.emit({type:e,payload:n})}on(e,n){this.bus.on(e,n)}getEnforcementConsentState(){return this.getConsentState()}};function ze(t){if(typeof window>"u")return;let e=window.__1CONSENT_REACT_FASTPATH__;if(e)try{if(typeof e.apply!="function"||typeof e.resolve!="function"||typeof e.reconcile!="function"||typeof e.destroy!="function"||e.appId!==t.appId||e.frameworkId!==t.framework.id||e.frameworkType!==t.framework.type||e.machine!==t.machine||e.primaryLanguage!==t.languages.primary||e.consentEpoch!==(t.consentEpoch??0)||e.structuralVersion!==x(t.services,t.categories))return;if(e.supportsPendingConsent!==!0||typeof e.updateConsent!="function"||typeof e.promote!="function"){e.destroy();return}return e.reconcile()?e:void 0}catch{return}}function lr(){let t=globalThis;return typeof t.scheduler=="object"?t.scheduler:void 0}function ft(t){let e=lr();if(e?.postTask)try{e.postTask(t,{priority:"user-visible"});return}catch{}setTimeout(t,0)}function ns(){let t=[],e=!1,n=!1,s,r,o=()=>{if(!(e||n)){for(e=!0;!n&&t.length>0;){let i=t.shift();if(!i)break;if(!i.slot.isConnected||!i.allowed())continue;let c=i.recreate(i.source),a=c.hasAttribute("type")?c.type.trim().toLowerCase():c.getAttribute("language")?`text/${c.getAttribute("language")?.trim().toLowerCase()}`:"",l=a===""||/^(?:application|text)\/(?:x-)?(?:java|ecma)script$/.test(a)||/^text\/(?:javascript1\.[0-5]|jscript|livescript)$/.test(a);if(c.src&&l&&!c.hasAttribute("async")&&!c.defer&&!c.noModule){let d=new MutationObserver(()=>{c.isConnected||u()}),u=()=>{s===m&&(m(),e=!1,o())},m=()=>{d.disconnect(),c.removeEventListener("load",u),c.removeEventListener("error",u),s=void 0,r=void 0};s=m,r=()=>{(!c.isConnected||!i.allowed())&&(m(),e=!1)},c.addEventListener("load",u),c.addEventListener("error",u),d.observe(i.slot.ownerDocument,{childList:!0,subtree:!0}),i.slot.replaceWith(c),c.isConnected||u();return}i.slot.replaceWith(c)}e=!1}};return{activate(i,c,a,l){let d=Array.from(i.querySelectorAll("script"),m=>{let g=document.createComment("1c-script");return m.replaceWith(g),{source:m,slot:g,allowed:a,recreate:l}}),u=!e;e=!0,t.push(...d);try{c(i)}finally{u&&(e=!1),o()}},setPaused(i){n=i},recheck(){if(!n){r?.();for(let i=t.length-1;i>=0;i--){let c=t[i];c&&(!c.slot.isConnected||!c.allowed())&&t.splice(i,1)}}},flush:o,clear(){t.length=0,s?.(),e=!1}}}function ss(){return typeof window>"u"?void 0:window.__1CONSENT_CONFIG__}function rs(t,e={}){let n=document.createElement("script");for(let s of t.attributes)n.setAttribute(s.name,s.value);t.src?t.hasAttribute("async")||(n.async=!1):n.text=t.text||t.textContent||"";for(let s of e.removeAttributes??[])n.removeAttribute(s);return n}var dr=[...Ne,Ve].map(t=>`template[${t}]:not([${zt}])`).join(",");function ur(){return document.readyState==="loading"?new Promise(t=>document.addEventListener("DOMContentLoaded",()=>t(),{once:!0})):Promise.resolve()}function is(t){return JSON.stringify([t.appId,t.framework.id,t.framework.type,t.machine,t.languages.primary,t.consentEpoch??0])}var pt=class{config;#e=ns();#t;#n;#s=!1;#r;#i={services:{},categories:{}};constructor(e){this.config=e,this.#t=x(e.services,e.categories),this.#n=is(e)}setConsent(e,n,s=!1){this.#e.setPaused(s),this.#s=s,n!==void 0&&(this.#r=n===0?void 0:n),this.#i=Fe(this.config.services,this.config.categories,e.services,e.categories),this.#e.recheck()}#c(){let e=ss();return e!==void 0&&is(e)===this.#n&&x(e.services,e.categories)===this.#t}async unblockTemplates(e){if(this.#s)return[];if(this.setConsent(e),await ur(),this.#s||!this.#c())return[];this.#e.flush();let n=document.querySelectorAll(dr);if(!n.length)return[];let s=new Set;for(let r=0;r<n.length;r++){let o=n[r];if(!o)continue;let i=this.#o(o,this.#i.services,this.#i.categories);if(!i)continue;s.add(i);let c=o.content.cloneNode(!0);c instanceof DocumentFragment&&this.#e.activate(c,a=>o.replaceWith(a),()=>this.#c()&&this.#o(o,this.#i.services,this.#i.categories)!==void 0,a=>rs(a,{removeAttributes:[...Ne,Ve]}))}return Array.from(s)}#o(e,n,s){if(this.#r!==void 0&&Date.now()>this.#r)return;for(let o of Ne){let i=e.getAttribute(o);if(i!==null)return n[i]===!0?i:void 0}let r=e.getAttribute(Ve);if(r!==null&&s[r]===!0)return r}};function hr(t){return typeof t=="object"&&t!==null&&"translations"in t&&"themeCSS"in t}var fr=250;function He(t,e){return`${t}::${e}`}function gt(t){return t==="details"?"details":t==="trigger"?"trigger":"notice"}var M=class{config;services;bus;storage;viewEngine;#e;#t=null;#n=new Map;#s=new Map;#r=null;#i="auto";analytics;#c=!1;constructor(e,n){this.config=e,this.services=n,this.bus=n.bus,this.storage=n.storage,this.viewEngine=n.viewEngine,this.#e=e.languages.primary,e.analytics&&(this.analytics=new dt(e.analytics,this.bus,this.storage,e.framework.type),se.onPersistenceFailure(()=>{this.bus.emit({type:"monitoring:error",payload:{code:"optout_write_error"}})}))}attachBlocking(e){if(this.#c)throw new Error("[1ConsentController] blocking is already attached");this.#c=!0;let n=new pt(this.config),s=()=>{let r=e.getEnforcementConsentState(),o=this.storage.getFastPath()?.expiresAt??0,i=e.isExternalConsentReconciliationPending();n.setConsent(r,o,i);let c=this.#o();c&&c.updateConsent(r.services);let a=ze(this.config);if(a)try{let l=Fe(this.config.services,this.config.categories,r.services,r.categories);a.updateConsent(l.services,l.categories,o,i)}catch{}ft(()=>{if(c?.unblock(),a){a.promote();return}n.unblockTemplates(e.getEnforcementConsentState()).catch(l=>{console.error("Template promotion failed",l)})})};this.bus.on("consent:saved",()=>s()),this.bus.on("consent:pending",()=>s()),this.bus.on("consent:external",()=>{s(),e.isConsentRequired()&&this.openNotice().catch(()=>{})}),s()}#o(){if(typeof window>"u"||!this.config.autoblocker?.enabled)return;let e=window.__1CONSENT_AUTOBLOCKER__;if(!e){console.error("Autoblocker missing");return}if(!(e.scope.appId!==this.config.appId||e.scope.frameworkId!==this.config.framework.id))return e}resolveInitialLocale(e){if(!e||e===this.#e)return;let n=this.config.languages.supported.find(s=>s===e);n&&(this.#e=n,this.bus.emit({type:"language:changed",payload:{locale:n}}))}getLanguage(){return this.#e}getTranslations(){return this.#t}async setLanguage(e){if(e===this.#e&&this.#t)return;let n=gt(this.viewEngine?.getCurrentView()),s=this.#n.get(He(e,n));if(s){this.#t=s,this.#e=e,await this.storage.withExclusiveAccess(()=>this.bus.emit({type:"language:changed",payload:{locale:e}}));return}let r=await this.#a(e,n);if(r===null)throw new Error(`[1Consent] ui-data for ${e}/${n} unavailable`);this.#t=r.translations,this.#e=e,await this.storage.withExclusiveAccess(()=>this.bus.emit({type:"language:changed",payload:{locale:e}}))}hasViewData(e){return e==="none"?!0:this.#n.has(He(this.#e,gt(e)))}async ensureViewData(e){if(e==="none")return;let n=this.#e,s=gt(e),r=this.#n.get(He(n,s));if(r){this.#t=r;return}let o=await this.#a(n,s);o?.translations&&n===this.#e&&(this.#t=o.translations)}#a(e,n){let s=He(e,n),r=this.#s.get(s);if(r)return r;let o=(async()=>{try{let i=await this.#d(e,n);return this.#u(e,n,i),i}catch(i){return this.#s.delete(s),console.error(`[1Consent] ui-data for ${s} unavailable after retry \u2014 the consent UI will render WITHOUT translations/theme:`,i),null}})();return this.#s.set(s,o),o}async#d(e,n){try{return await this.#p(e,n)}catch{return await new Promise(s=>setTimeout(s,fr)),await this.#p(e,n)}}async#p(e,n){let s=this.config.cmp.uiData.replace("{locale}",e).replace("{view}",n),r=await fetch(s);if(!r.ok)throw new Error(`HTTP ${r.status}`);let o=await r.json();if(!hr(o))throw new Error(`unexpected ui-data payload shape for ${e}/${n}`);return o.translations?{...o,translations:this.normalizeTranslations(o.translations,e,o.contentLanguage)}:o}normalizeTranslations(e,n,s){return e}#u(e,n,s){s.translations&&this.#n.set(He(e,n),s.translations),s.themeCSS!==this.#r&&(this.#r=s.themeCSS,this.viewEngine?.setThemeCSS(s.themeCSS)),s.translations&&e===this.#e&&this.#t===null&&this.viewEngine&&this.viewEngine.getCurrentView()!=="none"&&gt(this.viewEngine.getCurrentView())===n&&(this.#t=s.translations,this.viewEngine.refreshCurrentView())}getThemeMode(){return this.#i}setThemeMode(e){this.#i=e,this.bus.emit({type:"theme:changed",payload:{mode:e}})}#h;#l;setViewEngine(e){this.viewEngine=e,this.#r!==null&&e.setThemeCSS(this.#r)}setViewEngineFactory(e){this.#h=e}async ensureViewEngine(){if(!this.viewEngine&&this.#h){this.#l??=this.#h().catch(n=>{throw this.#l=void 0,n});let e=await this.#l;this.viewEngine||(this.viewEngine=e,this.#r!==null&&e.setThemeCSS(this.#r))}return this.viewEngine}get activeViewEngine(){return this.viewEngine}async showReturningVisitorTrigger(){if(!Rt(this.config))return;let e=this.ensureViewData("trigger"),n=await this.ensureViewEngine();n&&(await Promise.all([this.ensureViewLoaded("trigger"),e]),await n.transitionTo("trigger","consent-given"))}async openNotice(){let e=await this.ensureViewEngine();e&&await e.transitionTo("main","programmatic")}async openDetails(){let e=await this.ensureViewEngine();e&&await e.transitionTo("details","programmatic")}async close(){this.viewEngine&&await this.viewEngine.transitionTo("none","programmatic")}async ensureViewLoaded(e){let n=await this.ensureViewEngine();!n||n.hasDesign(e)||await n.ensureViewBundle(e)}};var qe=class{#e=new Map;on(e,n){let s=this.#e.get(e);return s||(s=new Set,this.#e.set(e,s)),s.add(n),()=>this.off(e,n)}off(e,n){let s=this.#e.get(e);s&&s.delete(n)}emit(e){let n=this.#e.get(e.type);if(n)for(let s of n)s(e)}};function os(t,e,n){let s=e();return s?Promise.resolve(s):new Promise((r,o)=>{let i=document.createElement("script");i.src=t,i.async=!0,i.onload=()=>{let c=e();c?r(c):(i.remove(),o(new Error(`[1consent] ${n} bundle loaded but did not register runtime`)))},i.onerror=()=>{i.remove(),o(new Error(`[1consent] failed to load ${n} bundle: ${i.src}`))},(document.head||document.documentElement).appendChild(i)})}async function mt(t){let e=typeof navigator<"u"&&!!navigator.locks;if(t.consentContinuity===void 0&&e)return new we(new Se,ee(t));let n=t.consentContinuity!==void 0,s=new URL(`${t.cmp.base}/runtime/${n?"experiment":"coordinator"}.v${t.signalsVersion||"1.0.0"}.js`,document.baseURI).href,r=await os(s,()=>{let i=n?window.__1CONSENT_EXPERIMENT_STORAGE__:window.__1CONSENT_STORAGE_COORDINATOR__;return i?.source===s&&typeof i.create=="function"===n?i:void 0},n?"experiment storage":"storage coordinator"),o=new Se(void 0,e?void 0:r.coordinator);return r.create?r.create(t,o):new we(o,ee(t))}function as(t,e){let n=[...t.services.filter(s=>!s.essential).map(s=>s.id),...t.categories.filter(s=>!s.essential).map(s=>s.id)];return n.length===0||n.every(s=>e[s]===!0)?"A":n.every(s=>!e[s])?"D":"G"}function We(t,e,n,s){let r=Ht(t.services,t.categories,e,e,n),o={structuralVersion:r.v,consentEpoch:t.consentEpoch??0,expiresAt:r.e,services:r.s,categories:r.c,...n?.decisionIntegrity?{decisionIntegrity:n.decisionIntegrity}:{},...n?.tcfCmpId!==void 0?{tcfCmpId:n.tcfCmpId}:{},...n?.tcfValidationVersion!==void 0?{tcfValidationVersion:n.tcfValidationVersion}:{},...n?.tcfDisclosedVendorKey!==void 0?{tcfDisclosedVendorKey:n.tcfDisclosedVendorKey}:{},...n?.tcfApiData!==void 0?{tcfApiData:n.tcfApiData}:{},...n?.tcfApiDataIntegrity!==void 0?{tcfApiDataIntegrity:n.tcfApiDataIntegrity}:{},...r.g===1?{gpcRevocable:!0}:{},...r.p===1?{posture:!0}:{}};if(s)s(o);else try{if(typeof localStorage>"u")throw new Error("localStorage unavailable");mt(t).then(i=>i.withExclusiveAccess(()=>i.setFastPath(o))).catch(i=>console.error("[1Consent] Fast-path persistence failed",i))}catch{}return n?.cookieMode==="clear"?B(t):n?.cookieMode!=="omit"&&gr(t,e,r),ze(t)?.updateConsent(r.s,r.c,r.e),ft(()=>pr(t)),r}function pr(t){try{ze(t)?.promote()}catch{}}function St(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return(e>>>0).toString(36)}function B(t){if(!(typeof document>"u"))try{let e=`${ue}=`,s=document.cookie.split(";").map(o=>o.trim()).find(o=>o.startsWith(e))?.slice(e.length),r=Yt(s);if(r&&_e(r.expiresAt)&&(r.appId!==t.appId||r.frameworkId!==t.framework.id||r.frameworkType!==t.framework.type||r.machine!==t.machine||r.primaryLanguage!==t.languages.primary||r.consentEpoch>(t.consentEpoch??0)))return;document.cookie=`${ue}=; Path=/; SameSite=Lax; Max-Age=0`}catch{}}function gr(t,e,n){if(!(typeof document>"u")){if(!t.syncCookie||!_e(n.e)){B(t);return}try{let s=Wt({decision:as(t,e),appId:t.appId,frameworkId:t.framework.id,frameworkType:t.framework.type,machine:t.machine,primaryLanguage:t.languages.primary,structuralVersion:n.v,consentEpoch:t.consentEpoch??0,expiresAt:n.e}),r=typeof location<"u"&&location.protocol==="https:",o=[`${ue}=${s}`,"Path=/","SameSite=Lax",`Expires=${new Date(n.e).toUTCString()}`];r&&o.push("Secure"),document.cookie=o.join("; ")}catch{}}}function mr(t){return typeof t=="object"&&t!==null&&"getConsent"in t&&typeof t.getConsent=="function"&&"setConsent"in t&&typeof t.setConsent=="function"&&"acceptAll"in t&&typeof t.acceptAll=="function"&&"rejectAll"in t&&typeof t.rejectAll=="function"&&"setCategoryConsent"in t&&typeof t.setCategoryConsent=="function"&&"setServiceConsent"in t&&typeof t.setServiceConsent=="function"}function tn(t){let e="engine"in t?t.engine:void 0,n=mr(e)?e:void 0,s=n?new Proxy({...n,setConsent:r=>t.storage.withExclusiveAccess(()=>n.setConsent(r))},{has(r,o){return Reflect.has(n,o)||Reflect.has(r,o)},get(r,o){if(o==="setConsent")return r.setConsent;let i=Reflect.get(n,o,n);if(typeof i!="function")return i;let c=i.bind(n);return["save","reconcileExternalConsentChange"].includes(String(o))?(...a)=>t.storage.withExclusiveAccess(()=>c(...a)):c}}):void 0;return{config:t.config,init:t.init.bind(t),openNotice:t.openNotice.bind(t),openDetails:t.openDetails.bind(t),close:t.close.bind(t),acceptAll:t.acceptAll.bind(t),rejectAll:t.rejectAll.bind(t),getLanguage:t.getLanguage.bind(t),getTranslations:t.getTranslations.bind(t),setLanguage:t.setLanguage.bind(t),getThemeMode:t.getThemeMode.bind(t),setThemeMode:t.setThemeMode.bind(t),bus:t.bus,cmp:{getState:()=>t.activeViewEngine?.getCurrentView()||"none",openCmp:t.openNotice.bind(t),openDetails:t.openDetails.bind(t),close:t.close.bind(t),acceptAll:t.acceptAll.bind(t),rejectAll:t.rejectAll.bind(t)},registerDesign:(r,o)=>t.activeViewEngine?.registerDesign(r,o),getView:()=>{let r="engine"in t?t.engine:void 0;return r&&typeof r=="object"&&"isConsentRequired"in r&&typeof r.isConsentRequired=="function"&&r.isConsentRequired()?"main":null},get engine(){return s},get viewEngine(){return t.activeViewEngine}}}var Sr={theme:"primary",position:"bottom-right",size:"default"};function yr(t,e){return t||(e.toLowerCase()==="us"?{...Sr}:void 0)}function wr(t){return"tcf"in t&&t.tcf!=null&&typeof t.tcf=="object"}var cs="ar.bg.bs.ca.cs.cy.da.de.el.en.es.et.eu.fi.fr.gl.he.hi.hr.hu.id.is.it.ja.ka.ko.lt.lv.mk.ms.mt.nl.no.pl.pt-br.pt-pt.ro.ru.sk.sl.sq.sr-latn.sr-cyrl.sv.sw.th.tl.tr.uk.vi.zh.zh-hant".split(".");new Set(cs),cs.filter(t=>t.includes("-")).sort((t,e)=>e.length-t.length);function Cr(t){if(typeof t!="string")return null;let e=t.trim();if(e.length<2||e.length>255)return null;try{return Intl.getCanonicalLocales(e)[0]??null}catch{return null}}function ls(t){return typeof t=="string"&&Cr(t)===t}function I(t){return typeof t=="object"&&!!t&&!Array.isArray(t)}function vr(t){return typeof t=="string"&&/^[A-Za-z0-9_-]{1,64}$/.test(t)&&!/^[\da-f]{8}(-[\da-f]{4}){3}-[\da-f]{12}$/i.test(t)}function Er(t){return I(t)&&[t.appId,t.frameworkId].every(vr)}function ws(t){if(!I(t))return!1;let e=t;return!(!(typeof e.appId=="string"&&(e.publicIdentity===void 0||Er(e.publicIdentity))&&typeof e.version=="number"&&I(e.languages)&&Array.isArray(e.languages.supported)&&ls(e.languages.primary)&&e.languages.supported.every(ls)&&new Set(e.languages.supported).size===e.languages.supported.length&&e.languages.supported.includes(e.languages.primary)&&I(e.cmp)&&typeof e.cmp.main=="string"&&typeof e.cmp.uiData=="string"&&typeof e.cmp.serviceDetails=="string"&&Array.isArray(e.categories)&&Array.isArray(e.services)&&Array.isArray(e.scripts)&&I(e.appearance)&&I(e.framework))||e.machine!=="P"&&e.machine!=="S"&&e.machine!=="D")}function br(t){return t.cmp.trigger?t.framework.type==="us"||!!t.appearance?.trigger:!1}function nn(t){if(!ws(t)||t.framework.type!=="tcf"||!("vendorListVersion"in t.framework)||!Number.isSafeInteger(t.framework.vendorListVersion)||t.framework.vendorListVersion<=0||!("vendors"in t)||!Array.isArray(t.vendors))return!1;let e=s=>Array.isArray(s)&&s.every(r=>Number.isSafeInteger(r)&&r>0)&&new Set(s).size===s.length,n=[];for(let s of t.vendors){if(!I(s))return!1;let r=s.id;if(typeof r!="number"||!Number.isSafeInteger(r)||r<=0||!e(s.consentPurposeIds)||!e(s.legitimateInterestPurposeIds)||!e(s.flexiblePurposeIds)||!e(s.specialFeatureIds))return!1;n.push(r)}return new Set(n).size===n.length}function Tr(t){return ws(t)&&t.framework.type==="us"}function ds(t){return["openMain","openDetails","close","acceptAll","rejectAll","save","reset"].includes(t)}var rn={open:"openMain",openNotice:"openMain"};function Ir(t,e=rn){if(ds(t))return t;let n=e[t];if(!n)throw Error(`[1CL] Unknown command: ${t}. No alias mapping found.`);if(!ds(n))throw Error(`[1CL] Invalid alias target: ${t} \u2192 ${n}. Alias targets must be canonical commands.`);return n}function Ar(t){return t?{...rn,...t}:rn}function sn(t){return Array.isArray(t)&&t.every(e=>typeof e=="string")}function Cs(t){return!t||typeof t!="object"||Object.entries(t).every(([e,n])=>e.endsWith("Url")?/^(https?:\/\/|mailto:[^@\s]+@[^@\s]+$)/i.test(String(n)):Cs(n))}function yt(t,e){return Array.isArray(t)&&t.every(n=>I(n)&&e.every(s=>typeof n[s]=="string"))}function Or(t){if(!I(t)||typeof t.id!="string"||typeof t.name!="string")return!1;let e=t.declaration;if(!I(e))return!1;let n=e.deviceStorage,s=e.legalProfile,r=[[e.parties,["key","name","kind"]],[e.dataSources,["name"]],[e.recipients,["name"]],[e.processingLocations,["name"]],[e.retention,["period"]],[e.transfers,["destination"]]].every(([a,l])=>a===void 0||yt(a,l)),o=s==null||I(s)&&typeof s.label=="string"&&[[s.processingGrounds,["basis","label"]],[s.partyRoles,["partyKey","role"]]].every(([a,l])=>yt(a,l))&&sn(s.rights),i=t.operational,c=i==null||I(i)&&(i.domains===void 0||Array.isArray(i.domains)&&i.domains.every(a=>I(a)&&typeof a.domain=="string"&&typeof a.use=="string"))&&(i.sdks===void 0||Array.isArray(i.sdks)&&i.sdks.every(a=>I(a)&&typeof a.name=="string"&&typeof a.use=="string"));return(t.description==null||typeof t.description=="string")&&c&&r&&Cs(t)&&yt(e.purposes,["key","name"])&&sn(e.dataCategories)&&sn(e.technologies)&&(n===null||I(n)&&yt(n.items,["key","type"]))&&I(e.links)&&Object.values(e.links).every(a=>typeof a=="string")&&o}function vs(t,e){let n=r=>{let o=r.base?[r.base,...r.path]:r.path;if(o[0]!=="ui"||o[1]!=="templateLabels"||!o[2])return;let i=o[2],c=e.templateLabels?.[i];if(typeof c!="string"||!c.trim())throw Error(`[TemplateLabels] Translate ui.templateLabels.${i} before using this design`)},s=r=>{for(let o of r){if(o.t==="bind"&&n(o.p),o.t==="el"){for(let i of o.attrs)if(i.k==="bind"&&n(i.value),i.k==="concat")for(let c of i.parts)c.k==="bind"&&n(c.v);s(o.kids)}if((o.t==="each"||o.t==="if"||o.t==="if-not")&&s(o.body),o.t==="use"){for(let i of Object.values(o.props))i.k==="path"&&n(i.v);o.children&&s(o.children)}}};for(let r of[...Object.values(t.views),...Object.values(t.components)])s(r)}function on(t,e,n,s){let r=t?.[e],o=r?r.description:s;return{name:r?.name??n??e,description:o||null}}var _r=["data-1c","data-1c-action","data-1c-id"];function Es(t){let e=t instanceof ShadowRoot?t.activeElement:null,n=e instanceof HTMLElement?e:document.activeElement;return!(n instanceof HTMLElement)||n===document.body||n===document.documentElement?null:{element:n,selector:_r.map(s=>{let r=n.getAttribute(s);return r?`[${s}="${CSS.escape(r)}"]`:""}).join("")}}function bs(t,e){let n=t?.element.isConnected?t.element:t?.selector?e?.querySelector(t.selector):null;n instanceof HTMLElement&&n.focus({preventScroll:!0})}var xr=["a[href]","area[href]","button:not([disabled])","input:not([disabled]):not([type='hidden'])","select:not([disabled])","textarea:not([disabled])","iframe","[contenteditable='true']","[tabindex]:not([tabindex='-1'])"].join(",");function Ts(t){return Array.from(t.querySelectorAll(xr)).filter(e=>e instanceof HTMLElement&&e.getAttribute("tabindex")!=="-1"&&!e.closest("[hidden], [inert], [aria-hidden='true']"))}function Pr(t){let e=t.querySelector("[data-1c-initial-focus]");if(e instanceof HTMLElement)return e;let n=t.querySelector("h1, h2, h3, h4, h5, h6");return n instanceof HTMLElement?(n.hasAttribute("tabindex")||(n.tabIndex=-1),n):Ts(t)[0]||(t.hasAttribute("tabindex")||(t.tabIndex=-1),t)}function Dr(t){let e=[],n=t;for(;;){let s=n.parentElement;if(s){for(let o of Array.from(s.children))!(o instanceof HTMLElement)||o===n||(e.push({element:o,inert:o.inert}),o.inert=!0);if(s===document.body)break;n=s;continue}let r=n.getRootNode();if(!(r instanceof ShadowRoot))break;for(let o of Array.from(r.children))!(o instanceof HTMLElement)||o===n||(e.push({element:o,inert:o.inert}),o.inert=!0);if(!(r.host instanceof HTMLElement))break;n=r.host}return e}function Is(t,e){let n=Dr(e),s=document.documentElement.style,r=s.getPropertyValue("overflow"),o=s.getPropertyPriority("overflow");s.setProperty("overflow","hidden");let i=a=>{if(a.key!=="Tab")return;let l=Ts(t);if(l.length===0){a.preventDefault(),t.focus({preventScroll:!0});return}let d=l[0],u=l[l.length-1];if(!d||!u)return;let m=t.getRootNode(),g=m instanceof ShadowRoot?m.activeElement:document.activeElement;a.shiftKey&&(g===d||!t.contains(g))?(a.preventDefault(),u.focus()):!a.shiftKey&&(g===u||!t.contains(g))&&(a.preventDefault(),d.focus())};t.addEventListener("keydown",i),Pr(t).focus({preventScroll:!0});let c=!0;return()=>{if(c){c=!1,t.removeEventListener("keydown",i);for(let a of n)a.element.inert=a.inert;r?s.setProperty("overflow",r,o):s.removeProperty("overflow")}}}var kr=["website_operator","representative","service_provider","infrastructure_provider","recipient","other"],Lr=["cookie","local_storage","session_storage","indexed_db","cache_storage","other"],Nr=["voluntary","required","conditional","not_applicable","operator_determined"],Vr=["controller","processor","joint_controller","independent_controller","responsible_party","operator","business","service_provider","contractor","third_party","recipient","representative"],wt=["yes","no","conditional","unknown"];function q(t,e,n){if(!e.includes(t))throw Error(`[ServiceDetail] Unsupported ${n}: ${t}`);return{[t]:!0}}function Fr(t){let{declaration:e}=t,{legalProfile:n,deviceStorage:s}=e,r=n?.usPrivacy;return{...t,declaration:{...e,parties:e.parties?.map(o=>({...o,kindFlags:q(o.kind,kr,"party kind")})),deviceStorage:s&&{...s,items:s.items.map(o=>({...o,typeFlags:q(o.type,Lr,"storage type")}))},legalProfile:n&&{...n,partyRoles:n.partyRoles.map(o=>{let i=e.parties?.find(c=>c.key===o.partyKey);if(!i)throw Error(`[ServiceDetail] Missing legal-role party: ${o.partyKey}`);return{...o,partyName:i.name,roleFlags:q(o.role,Vr,"legal role")}}),provisionRequirements:n.provisionRequirements?.map(o=>({...o,statusFlags:q(o.status,Nr,"provision status")})),usPrivacy:r&&{...r,saleFlags:q(r.sale,wt,"sale practice"),sharingFlags:q(r.sharing,wt,"sharing practice"),targetedAdvertisingFlags:q(r.targetedAdvertising,wt,"targeted advertising practice"),sensitiveDataFlags:q(r.sensitiveData,wt,"sensitive data practice")}}}}}var us=new Map,ve=null,an=0;async function hs(t,e,n,s,r,o){if(ve?.element.dataset.serviceId===t)return;let i=r||document.body,c=Es(i);Ye();let a=++an,l=e.cmp.serviceDetails.replace("{serviceId}",encodeURIComponent(t)),d=`${l}${l.includes("?")?"&":"?"}schema=2`,u=o??us.get(d);if(!u){let p=await Mr(t,d);if(!p)return;us.set(d,p),u=p}if(a!==an)return;let m=u,g=document.createElement("div");g.dataset.serviceId=t;let h=()=>{},y=()=>{let p=s();if(!p)throw Error("[Modal] Missing i18n");vs(n,p);let A=on(p.vendors?.services,t,m.name,m.description),f=Lt(n,{service:Fr({...m,...A}),ui:p},{view:"service-detail"});h(),g.replaceChildren(f),g.isConnected||i.appendChild(g),g.inert=!1;let S=g.querySelector('[role="dialog"]');h=S instanceof HTMLElement?Is(S,g):()=>{};let E=g.querySelector(".oc-service-modal__overlay");E?.addEventListener("click",C=>{C.target===E&&Ye()}),g.querySelector('[data-1c="command:closeServiceDetail"]')?.addEventListener("click",C=>{C.preventDefault(),Ye()}),requestAnimationFrame(()=>{E?.classList.add("oc-service-modal--visible")})};y();let v=p=>{p.key==="Escape"&&Ye()};document.addEventListener("keydown",v),ve={element:g,refresh:y,cleanup:()=>{h(),document.removeEventListener("keydown",v),bs(c,i)}}}function Rr(t){ve?.element.parentNode===t&&ve.refresh()}function Ye(){an+=1;let t=ve;ve=null,t?.cleanup(),t?.element.remove()}async function Mr(t,e){try{let n=await fetch(e);if(n.ok){let s=await n.json();if(Or(s))return s}}catch{}return console.error(`[ServiceDetail] Request failed for ${t}`),null}function Br(t,e){let n=e.split("-")[0]==="de";if(t===null)return n?"Nicht zutreffend":"Not applicable";if(t===0)return n?"Sitzung":"Session";let s=[{unit:"day",seconds:86400},{unit:"hour",seconds:3600},{unit:"minute",seconds:60},{unit:"second",seconds:1}],r=t,o=[];for(let i of s){let c=Math.floor(r/i.seconds);r%=i.seconds,c>0&&o.push(new Intl.NumberFormat(e,{style:"unit",unit:i.unit,unitDisplay:"short"}).format(c))}return o.join(" ")}function fs(t){let e=t.indexOf(":");return e===-1?(console.warn(`[1CL] Invalid command binding format: ${t}`),null):{type:t.substring(0,e).trim(),name:t.substring(e+1).trim()}}function ps(t,e){let n=Ir(e,Ar()),s={openMain:()=>t.cmp.openCmp(),openDetails:()=>t.cmp.openDetails(),close:()=>t.cmp.close(),acceptAll:()=>t.cmp.acceptAll(),rejectAll:()=>t.cmp.rejectAll(),save:()=>t.cmp.save?.(),reset:()=>t.cmp.reset?.(),closeServiceDetail:()=>Ye()}[n];s?s():console.warn(`[1CL] Unknown canonical command: ${n}`)}function gs(t,e){let n={notice:()=>t.cmp?.openCmp(),details:()=>t.cmp?.openDetails(),close:()=>t.cmp?.close()}[e];n?n():console.warn(`[1CL] Unknown view command: ${e}`)}function Ur(t,e,n){if(!t.engine){console.error("[1CL] SDK engine not available");return}let s=n.querySelector('input[type="checkbox"]');if(s){let r=s.checked;if(e.startsWith("category:")){let o=e.substring(9);ms(t.engine,`category:${o}`,r)}else if(e.startsWith("service:")){let o=e.substring(8);ms(t.engine,`service:${o}`,r)}}}function ms(t,e,n){return e.startsWith("category:")?(t.setCategoryConsent(e.substring(9),n),!0):e.startsWith("service:")?(t.setServiceConsent(e.substring(8),n),!0):!1}function $r(t,e){let n=s=>{let r=s.target,o=r.getAttribute?.("data-1c-backdrop");if(o){let l=fs(o);l&&(s.preventDefault(),l.type==="view"?gs(e,l.name):ps(e,l.name));return}let i=r.closest("[data-1c]");if(!i)return;let c=i.getAttribute("data-1c");if(!c)return;let a=fs(c);if(a)switch(a.type){case"command":s.preventDefault(),ps(e,a.name);break;case"view":s.preventDefault(),gs(e,a.name);break;case"consent":Ur(e,a.name,i);break;case"dataset":s.preventDefault(),Gr(e,a.name,i);break;default:console.warn(`[1CL] Unknown command type: ${a.type}`)}};return t.addEventListener("click",n),()=>{t.removeEventListener("click",n)}}function Gr(t,e,n){let s=t.viewEngine,r=t.getShadowRoot?.();switch(e){case"serviceDetail":{let o=n.getAttribute("data-1c-id");if(!o){console.warn("[1CL] dataset:serviceDetail missing data-1c-id");return}let i=s?.getCompiledView?.("service-detail");if(!i){console.warn("[1CL] No compiled service-detail template found");return}hs(o,t.config,i,t.getTranslations,r??void 0).catch(c=>{console.error("[1CL] Failed to open service detail modal:",c)});break}case"vendorStorage":{let o=n.getAttribute("data-1c-id");if(!o){console.warn("[1CL] dataset:vendorStorage missing data-1c-id");return}let i=n.getAttribute("data-1c-name")??`Vendor ${o}`,c=s?.getCompiledView?.("service-detail");if(!c){console.warn("[1CL] No compiled service-detail template found");return}jr(o,i,t.config,t.getLanguage()).then(a=>{a&&hs(`vendor-${o}`,t.config,c,t.getTranslations,r??void 0,a).catch(l=>{console.error("[1CL] Failed to open vendor storage modal:",l)})}).catch(a=>{console.error("[1CL] Failed to fetch vendor storage:",a)});break}default:console.warn(`[1CL] Unknown dataset command: ${e}`)}}async function jr(t,e,n,s=n.languages.primary){let r=new URL(n.cmp.serviceDetails.replace("{serviceId}","__tcf_vendor_selector__"),window.location.href),o=r.pathname.match(/^\/v\/([^/]+)\/services\/__tcf_vendor_selector__(?:\.json)?$/)?.[1];if(!o)return null;let i=new URL(`/v/${o}/tcf-vendors/${encodeURIComponent(t)}/storage.json`,r.origin),c=r.searchParams.get("version"),a=r.searchParams.get("stage");if(c)i.searchParams.set("version",c);else if(a==="preview")i.searchParams.set("stage",a);else return null;let l=await fetch(i);if(!l.ok)return null;let d=await l.json();if(!jt(d))return null;let u=d.disclosures,m=d.domains??[],g=d.sdks??[];if(u.length===0&&m.length===0&&g.length===0)return null;let h=u.map(p=>{let A=Br(p.maxAgeSeconds,s),f=[p.description,p.domains.length>0?`Domains: ${p.domains.join(", ")}`:void 0,p.purposes.length>0?`Purposes: ${p.purposes.map(S=>`P${S}`).join(", ")}`:p.specialPurposes.length===0?"Non-TCF purpose":void 0,p.specialPurposes.length>0?`Special purposes: ${p.specialPurposes.map(S=>`SP${S}`).join(", ")}`:void 0,p.optOut?"Opt-out mechanism":void 0,p.cookieRefresh?"Refreshed":void 0].filter(S=>!!S);return{key:p.identifier,type:p.type,duration:A,description:f.join(" \xB7 ")}}),y=Array.from(new Set(u.flatMap(p=>p.purposes).map(p=>`Purpose ${p}`))),v=Array.from(new Set([...u.map(p=>p.type),...g.map(p=>`SDK: ${p.name}`)]));return{id:`vendor-${t}`,name:e,...y.length>0&&{purposes:y},...v.length>0&&{technologiesUsed:v},...h.length>0&&{storage:{items:h}},operational:m.length>0||g.length>0?{...m.length>0&&{domains:m},...g.length>0&&{sdks:g}}:null,declaration:{purposes:y.map((p,A)=>({key:String(A),name:p})),dataCategories:[],technologies:v,deviceStorage:h.length>0?{items:h.map(p=>({...p,type:p.type==="cookie"?"cookie":"other"}))}:null,links:{}}}}var Kr=class Ct{index=new Map;static makeKey(e,n){return`${e}::${n??""}`}add(e,n,s){let r=Ct.makeKey(e,n);this.index.has(r)||this.index.set(r,new Set),this.index.get(r)?.add(s)}remove(e,n,s){let r=Ct.makeKey(e,n),o=this.index.get(r);o&&(o.delete(s),o.size===0&&this.index.delete(r))}get(e,n){let s=Ct.makeKey(e,n);return this.index.get(s)??new Set}getAllBindings(){let e=[];for(let[n,s]of this.index.entries()){let[r,o]=n.split("::");for(let i of s){let c={element:i,bindingKey:r};o&&(c.id=o),e.push(c)}}return e}clear(){this.index.clear()}get size(){let e=0;for(let n of this.index.values())e+=n.size;return e}},Ss=new WeakMap;function Xe(t){let e=Ss.get(t);return e||(e=new Kr,Ss.set(t,e)),e}function zr(t,e){let n=[],s=Xe(e),r='[data-1c^="consent:"][data-1c-id]',o='[data-1c="consent:us.sale"], [data-1c="consent:us.share"], [data-1c="consent:us.saleAndShare"]',i=[...t.querySelectorAll(r),...t.querySelectorAll(o)];(t.matches(r)||t.matches(o))&&i.push(t);for(let c of i){if(!(c instanceof HTMLInputElement))continue;let a=c.getAttribute("data-1c");if(!a)continue;let l=c.getAttribute("data-1c-id")||void 0;s.add(a,l,c);let d={element:c,bindingKey:a};l&&(d.id=l),n.push(d)}return n}function Hr(t,e){let n=Xe(e),s='[data-1c^="consent:"][data-1c-id]',r='[data-1c="consent:us.sale"], [data-1c="consent:us.share"], [data-1c="consent:us.saleAndShare"]',o=[...t.querySelectorAll(s),...t.querySelectorAll(r)];(t.matches(s)||t.matches(r))&&o.push(t);for(let i of o){if(!(i instanceof HTMLInputElement))continue;let c=i.getAttribute("data-1c");if(!c)continue;let a=i.getAttribute("data-1c-id")||void 0;n.remove(c,a,i)}}function cn(t,e){t.checked=e.value,t.disabled=e.disabled,t.setAttribute("aria-checked",String(e.value)),t.setAttribute("aria-disabled",String(e.disabled))}function ln(t,e,n){let s=Xe(e);for(let r of t){let o=s.get(r.bindingKey,r.id);for(let i of o)cn(i,{value:r.value??i.checked,disabled:r.disabled??i.disabled})}}function As(t,e,n){let s=zr(t,e);if(s.length===0)return;let r=s.map(o=>({bindingKey:o.bindingKey,id:o.id}));try{let o=n.engine;if(n.engine&&typeof o.resolveMany=="function"){let i=o.resolveMany(r);ln(i.patches,e,i.version)}else for(let i of s)try{if(!n.engine?.resolve||!Xt(i.bindingKey))continue;let c=i.id?{bindingKey:i.bindingKey,id:i.id}:{bindingKey:i.bindingKey},a=n.engine.resolve(c);a&&cn(i.element,a)}catch(c){console.error("[1CL] Failed to resolve binding:",i,c)}}catch(o){console.error("[1CL] Failed to hydrate bindings:",o)}}function qr(t,e){Hr(t,e)}function Wr(t,e){let n=new MutationObserver(s=>{for(let r of s){for(let o of r.addedNodes)o instanceof HTMLElement&&As(o,t,e);for(let o of r.removedNodes)o instanceof HTMLElement&&qr(o,t)}});return n.observe(t,{childList:!0,subtree:!0}),()=>{n.disconnect()}}function Yr(t,e){let n=!1,s=r=>{if(n)return;let o=r.target;if(!(o instanceof HTMLInputElement))return;let i=o.getAttribute("data-1c");if(!i?.startsWith("consent:"))return;let c=o.getAttribute("data-1c-id")||"",a=o.checked;try{if(!e.engine)return;let l=e.engine.apply({ref:{bindingKey:i,id:c},value:a,source:"ui"});n=!0,ln(l.patches,t,l.version),n=!1}catch(l){console.error("[1CL] Failed to apply consent change:",l);try{let d=e.engine.resolve({bindingKey:i,id:c});n=!0,cn(o,d),n=!1}catch(d){console.error("[1CL] Failed to revert state:",d)}}};return t.addEventListener("change",s,!0),()=>{t.removeEventListener("change",s,!0)}}function Xr(t,e){As(t,t,e);let n=Yr(t,e),s=Wr(t,e),r=e.bus.on("consent:changed",()=>{let o=Xe(t).getAllBindings().map(i=>({bindingKey:i.bindingKey,id:i.id}));try{let i=e.engine;if(e.engine&&typeof i.resolveMany=="function"){let c=i.resolveMany(o);ln(c.patches,t,c.version)}}catch(i){console.error("[1CL] Failed to reconcile on consent:changed:",i)}});return()=>{n(),s(),r(),Xe(t).clear()}}function Jr(t){if(!t)throw Error("[1CL State] SDK instance is missing");if(!t.viewEngine)throw Error("[1CL State] SDK viewEngine is missing");if(!t.viewEngine.getCurrentView)throw Error("[1CL State] viewEngine.getCurrentView method is missing");let e=t.viewEngine.getCurrentView(),n=Qr(e),s=ei(t),{position:r,spacing:o,logoAlign:i,buttonOrder:c,buttonAlign:a,buttonEmphasis:l}=ti(t,n,s);return{state:e==="none"?"closed":"open",load:"ready",theme:Zr(t),layer:n,framework:s,position:r,spacing:o,logoAlign:i,buttonOrder:c,buttonAlign:a,buttonEmphasis:l}}function Zr(t){if(!t.config)throw Error("[1CL State] SDK config is missing");let e=typeof t.getThemeMode=="function"?t.getThemeMode():"auto";return e==="light"||e==="dark"?e:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Qr(t){return t==="main"?"notice":t==="details"?"details":"trigger"}function ei(t){if(!t.config)throw Error("[1CL State] SDK config is missing");if(!t.config.framework)throw Error("[1CL State] Framework configuration is missing");if(!t.config.framework.type)throw Error("[1CL State] Framework type is missing");let e=t.config.framework.type.toLowerCase();if(e==="tcf"||e==="us"||e==="gdpr")return e;throw Error(`[1CL State] Unknown framework type: ${e}`)}function ti(t,e,n){let s=t.config?.appearance,r=s?.notice,o=e==="trigger"?yr(s?.trigger,n)??r:e==="details"?s?.details:r;return{position:o?.position||"bottom-center",spacing:o?.size||"default",logoAlign:r?.logoAlignment||"left",buttonOrder:r?.buttonOrder||"reject-first",buttonAlign:r?.buttonAlignment||"right",buttonEmphasis:r?.buttonEmphasis||"equal"}}function ni(t,e){let n=t.getRootNode(),s=n instanceof ShadowRoot?n.host:t;s.setAttribute("data-1c-state",e.state),s.setAttribute("data-1c-load",e.load),s.setAttribute("data-1c-theme",e.theme),s.setAttribute("data-1c-layer",e.layer),s.setAttribute("data-1c-framework",e.framework),s.setAttribute("data-1c-position",e.position),s.setAttribute("data-1c-spacing",e.spacing),s.setAttribute("data-1c-logo-align",e.logoAlign),s.setAttribute("data-1c-button-order",e.buttonOrder),s.setAttribute("data-1c-button-align",e.buttonAlign),s.setAttribute("data-1c-button-emphasis",e.buttonEmphasis)}function ys(t,e){ni(t,Jr(e))}function si(t,e){ys(t,e);let n=()=>{ys(t,e)},s=["view:transition","consent:changed","theme:changed"];return s.forEach(r=>{e.bus.on(r,n)}),()=>{s.forEach(r=>{e.bus.off(r,n)})}}function ri(t){return"getOptOutOfSale"in t&&"getOptOutOfShare"in t&&"isGpcDetected"in t&&"getLimitSensitiveUse"in t&&"getSensitivePIInUse"in t}function ii(t,e,n){let s=Object.values(t.stacks),r=new Set(s.flatMap(h=>h.purposes)),o=new Set(s.flatMap(h=>h.specialFeatures)),i=new Set(n.flatMap(h=>h.specialFeatureIds)),c=Object.values(t.specialFeatures).filter(h=>i.has(h.id)),a=n.map(h=>{let y=t.vendors[h.id];if(!y)throw Error(`TCF UI data is missing configured vendor ${h.id}`);let v=new Set(h.consentPurposeIds),p=new Set(h.legitimateInterestPurposeIds),A=new Set(h.flexiblePurposeIds),f=new Set(h.specialFeatureIds);return{...y,purposes:y.purposes.filter(S=>v.has(S)),purposes_data:y.purposes_data.filter(S=>v.has(S.id)),legIntPurposes:y.legIntPurposes.filter(S=>p.has(S)),legIntPurposes_data:y.legIntPurposes_data.filter(S=>p.has(S.id)),flexiblePurposes:y.flexiblePurposes.filter(S=>A.has(S)),flexiblePurposes_data:y.flexiblePurposes_data.filter(S=>A.has(S.id)),specialFeatures:y.specialFeatures.filter(S=>f.has(S)),specialFeatures_data:y.specialFeatures_data.filter(S=>f.has(S.id))}}),l=Object.values(t.purposes).map(h=>{let y=a.filter(p=>p.purposes.includes(h.id)).length,v=a.filter(p=>p.legIntPurposes.includes(h.id)).length;return{...h,consentVendorCount:y,legitimateInterestVendorCount:v,hasConsentVendors:y>0,hasLegitimateInterestVendors:v>0}}),d=new Set(l.filter(h=>h.hasConsentVendors).map(h=>h.id)),u=s.map(h=>({...h,hasConsentControls:h.purposes.some(y=>d.has(y))||h.specialFeatures.length>0})),m=l.filter(h=>h.hasLegitimateInterestVendors),g=a.filter(h=>h.legIntPurposes.length>0).length;return{standardTexts:t.standardTexts,...e==="main"?{stacks:u,purposes:l.filter(h=>!r.has(h.id))}:{purposes:l},specialPurposes:Object.values(t.specialPurposes),dataCategories:Object.values(t.dataCategories),features:Object.values(t.features),specialFeatures:e==="main"?c.filter(h=>!o.has(h.id)):c,vendors:a,vendorCount:a.length,legitimateInterestPurposes:m,legitimateInterestVendorCount:g,hasLegitimateInterests:g>0}}function oi(t){try{let e=t.split("-")[0];return new Intl.DisplayNames([e],{type:"language"}).of(e)??t}catch{return t}}var Os=class{getThemeMode;currentView="none";bus;consentEngine;config;container=null;shadowRoot=null;renderTarget=null;cleanupFunctions=[];focusReturnTarget=null;currentLocale;viewLoadPromises=new Map;transitionIntent=0;pendingDismissalWork=null;translationsProvider;themeCSS=null;controllerOpenDetails;controllerSetLanguage;languageChangePending=!1;ensureViewData;hasViewData;constructor(t,e,n,s,r,o,i,c=()=>"auto"){this.getThemeMode=c,this.bus=t,this.consentEngine=e,this.translationsProvider=n??(()=>null),this.controllerOpenDetails=s,this.ensureViewData=r??(async()=>{}),this.hasViewData=o??(()=>!0),this.controllerSetLanguage=i,this.config=e.getConfig(),this.currentLocale=e.getDisplayLocale(),this.consentEngine.on("consent:changed",()=>this.handleConsentChange()),this.bus.on("view:change",a=>{if(a&&typeof a=="object"&&"payload"in a){let l=a.payload?.view;l&&this.transitionTo(l)}}),this.consentEngine.on("consent:saved",()=>this.handleConsentSaved()),this.consentEngine.on("consent:external",()=>{this.consentEngine.hasValidConsent()&&this.handleConsentSaved()}),this.consentEngine.on("consent:accepted-all",()=>this.handleConsentSaved()),this.consentEngine.on("consent:rejected-all",()=>this.handleConsentSaved()),this.bus.on("language:changed",a=>{if(a&&typeof a=="object"&&"payload"in a){let l=a.payload;l?.locale&&(this.currentLocale=l.locale)}this.currentView!=="none"&&(this.mount(this.currentView),this.shadowRoot&&Rr(this.shadowRoot))})}getCurrentView(){return this.currentView}hasDesign(t){return this.bundles.has(t)}setThemeCSS(t){if(this.themeCSS=t,!this.shadowRoot)return;let e=this.shadowRoot.getElementById("1c-style-theme");if(t===null){e?.remove();return}if(e)e.textContent=t;else{let n=document.createElement("style");n.id="1c-style-theme",n.textContent=t,this.shadowRoot.append(n)}}refreshCurrentView(){this.currentView!=="none"&&this.mount(this.currentView)}getCompiledView(t){return this.bundles.get(t)}canCloseView(t){switch(t){case"main":return this.config.showClose===!0||!this.consentEngine.isConsentRequired();case"details":return!0;case"trigger":return!0;case"none":return!0}}async transitionTo(t,e="programmatic"){let n=this.currentView;if(n===t)return this.pendingDismissalWork&&(this.transitionIntent+=1),!0;if(!this.isValidTransition(n,t))return console.warn(`[ViewEngine] Invalid transition: ${n} \u2192 ${t}`),!1;if(t==="trigger"&&!this.triggerEnabled())return console.warn("[ViewEngine] Trigger view is disabled for this configuration"),!1;if((t==="none"||t==="trigger")&&e!=="consent-given"&&!this.canCloseView(n))return console.warn(`[ViewEngine] Cannot close current view: ${n}`),!1;let s=++this.transitionIntent;if(t!=="none"&&this.pendingDismissalWork&&(await this.pendingDismissalWork,s!==this.transitionIntent))return!1;if(t!=="none"){let a=!this.bundles.has(t),l=this.ensureViewData(t);if(a||!this.hasViewData(t)){let[d]=await Promise.all([a?this.ensureViewBundle(t):Promise.resolve(!0),l]);if(s!==this.transitionIntent)return console.warn(`[ViewEngine] Transition ${n} \u2192 ${t} superseded by a newer transition`),!1;if(!d)return console.error(`[ViewEngine] View bundle unavailable: ${t}`),this.bus.emit({type:"monitoring:error",payload:{code:"render_error"}}),t==="trigger"&&this.transitionTo("none",e)}}let r=this.isModalView(n),o=this.isModalView(t);o&&!r&&this.captureFocusReturnTarget();let i={from:n,to:t,reason:e};this.bus.emit({type:"view:before-transition",payload:i}),this.currentView=t;let c=!0;if(t==="none"){for(let a of this.cleanupFunctions)a();this.cleanupFunctions=[],this.renderTarget&&(this.renderTarget.innerHTML="")}else c=this.mountSafely(t);return c?(this.bus.emit({type:"view:transition",payload:i}),r&&!o&&this.restoreFocusAfterModal(),!0):(this.currentView=n,n==="none"||this.mountSafely(n)||(this.currentView="none",this.renderTarget&&(this.renderTarget.innerHTML=""),this.bus.emit({type:"view:transition",payload:{from:n,to:"none"}})),o&&!r&&this.restoreFocusAfterModal(),!1)}isModalView(t){return t==="details"||t==="main"&&this.config.appearance?.showOverlay===!0}captureFocusReturnTarget(){this.focusReturnTarget||=Es(this.shadowRoot)}restoreFocusAfterModal(){let t=this.focusReturnTarget;this.focusReturnTarget=null,bs(t,this.renderTarget)}isValidTransition(t,e){return{none:["main","details","trigger"],main:["details","trigger","none"],details:["main","trigger","none"],trigger:["main","details","none"]}[t]?.includes(e)??!1}triggerEnabled(){return br(this.config)}initialize(){this.consentEngine.isConsentRequired()?this.transitionTo("main","consent-required"):this.triggerEnabled()&&this.transitionTo("trigger","consent-given")}handleConsentChange(){if(this.currentView==="trigger"&&this.consentEngine.isConsentRequired()){this.transitionTo("main","consent-required");return}}handleConsentSaved(){(this.currentView==="main"||this.currentView==="details")&&this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","consent-given")}dismissModalThenTransition(t,e,n){let s=this.currentView,r=s==="main"||s==="details";if(!r&&!n){this.transitionTo(t,e);return}let o=this.transitionIntent+ +!!r,i=(r?new Promise(a=>window.setTimeout(a,0)):Promise.resolve()).then(async()=>{try{return await c?await n?.()??{to:t,reason:e}:void 0}finally{this.pendingDismissalWork===i&&(this.pendingDismissalWork=null)}});n&&(this.pendingDismissalWork=i);let c=r?this.transitionTo("none",e):Promise.resolve(!0);i.then(a=>{a&&(a.to!=="none"||!r)&&o===this.transitionIntent&&(this.currentView==="none"||!r)&&this.transitionTo(a.to,a.reason)}).catch(a=>{console.error("[1Consent] Consent action failed",a),this.transitionTo("main","user-action")})}saveDecision(t){this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","consent-given",()=>this.consentEngine.withExclusiveAccess(()=>{t?.(),this.consentEngine.save()}))}openNotice(){this.transitionTo("main","user-action")}openDetails(){this.transitionTo("details","user-action")}closeCurrentView(){let t=this.currentView;if(!this.canCloseView(t)){console.warn(`[ViewEngine] Cannot close ${t} - consent required`),this.bus.emit({type:"view:close-blocked",payload:{view:t,reason:"consent-required"}});return}if(t==="main"&&this.config.showClose===!0&&this.config.closeMeans==="reject"){this.saveDecision(()=>this.consentEngine.rejectAll());return}if(t==="main"&&this.config.showClose===!0){this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","user-action");return}if(t==="details"){this.dismissModalThenTransition("none","user-action",()=>this.consentEngine.withExclusiveAccess(()=>{if(this.consentEngine.reconcileExternalConsentChange(null,null,!0),this.consentEngine.isConsentRequired())return{to:"main",reason:"consent-required"};if(this.consentEngine.hasValidConsent()&&this.triggerEnabled())return{to:"trigger",reason:"consent-given"}}));return}this.consentEngine.hasValidConsent()?this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","consent-given"):this.transitionTo("main","consent-required")}bundles=new Map;registerDesign(t,e){let n=Object.keys(t.views);if(n.length===0){console.error("[ViewEngine] Registered design has no views");return}for(let s of n){let r=s.split(".").pop()||"main",o={version:t.version,views:{[r]:t.views[s]},components:t.components},i=e||t.css;i&&(o.css=i),this.bundles.set(r,o),this.currentView===r&&this.mount(r)}}viewBundleUrl(t){let e=this.config.cmp;if(t==="main")return e.main;if(t==="details")return e.details;if(t==="trigger")return e.trigger}loadViewScript(t){return new Promise((e,n)=>{let s=document.createElement("script");s.src=t,s.async=!0,s.onload=()=>e(),s.onerror=r=>{s.remove(),n(r)},(document.head||document.documentElement).appendChild(s)})}ensureViewBundle(t){if(this.bundles.has(t))return Promise.resolve(!0);let e=this.viewBundleUrl(t);if(!e)return Promise.resolve(!1);let n=this.viewLoadPromises.get(t);return n||(n=this.loadViewScript(e).then(()=>{let s=this.bundles.has(t);return s||this.viewLoadPromises.delete(t),s}).catch(s=>(console.error(`[ViewEngine] Failed to load view '${t}':`,s),this.viewLoadPromises.delete(t),!1)),this.viewLoadPromises.set(t,n)),n}closeToNone(){this.renderTarget&&(this.renderTarget.innerHTML=""),this.currentView="none",this.bus.emit({type:"view:change",payload:{view:"none"}})}mountSafely(t){try{return this.mount(t)}catch(e){return console.error(`[ViewEngine] Failed to mount view ${t}:`,e),this.bus.emit({type:"monitoring:error",payload:{code:"render_error"}}),!1}}mount(t){for(let f of this.cleanupFunctions)f();this.cleanupFunctions=[];let e=this.bundles.get(t);if(!e)return t!=="none"&&(console.warn(`[ViewEngine] No bundle found for view: ${t}`),this.closeToNone()),!1;if(this.container||(this.container=document.getElementById("1c-cmp-container"),this.container||(this.container=document.createElement("div"),this.container.id="1c-cmp-container",(document.body||document.documentElement).appendChild(this.container))),this.shadowRoot||(this.shadowRoot=this.container.attachShadow({mode:"open"}),this.renderTarget=document.createElement("div"),this.renderTarget.id="1c-cmp-root",this.shadowRoot.appendChild(this.renderTarget)),this.themeCSS){let f=this.shadowRoot.getElementById("1c-style-theme");f||(f=document.createElement("style"),f.id="1c-style-theme",this.shadowRoot.prepend(f)),f.textContent=this.themeCSS}if(e.css){let f=`1c-style-${t}`,S=this.shadowRoot.getElementById(f);S||(S=document.createElement("style"),S.id=f,this.shadowRoot.prepend(S)),S.textContent=e.css}let n=this.translationsProvider()??{},s=wr(n)?n.tcf.gvl:void 0,r=(nn(this.config)?this.config.vendors??[]:[]).length,o=f=>{let S={};for(let[E,C]of Object.entries(f))typeof C=="string"?S[E]=C.replace(/%VENDORS_COUNT%/g,String(r)):Array.isArray(C)?S[E]=C:C&&typeof C=="object"?S[E]=o(C):S[E]=C;return S},i=nn(this.config)?o(n):n,c=Tr(this.config)?this.config.us?.doNotSellLinkUrl:void 0,a=c&&Array.isArray(i.legalLinks)&&i.legalLinks.some(f=>f.url==="/do-not-sell")?i.legalLinks.map(f=>f.url==="/do-not-sell"?{...f,url:c}:f):i.legalLinks,l=(this.config.services||[]).map(f=>({...f,...on(i.vendors?.services,f.id,f.name??f.tag)}));vs(e,i);let d={config:this.config,consent:{categories:this.consentEngine.getCategoryConsents(),services:this.consentEngine.getServiceConsents()},ui:{view:t,...i,...a===i.legalLinks?{}:{legalLinks:a}},categories:(this.config.categories||[]).map(f=>({...f,...on(i.vendors?.categories,f.id,f.name),services:l.filter(S=>S.categoryId===f.id)})).filter(f=>f.services.length>0),services:l,appearance:{...this.config.appearance,useSwitchCategories:this.config.appearance?.categoryToggleType==="switch",useCheckboxCategories:this.config.appearance?.categoryToggleType!=="switch",useSwitchServices:this.config.appearance?.serviceToggleType!=="checkbox",useCheckboxServices:this.config.appearance?.serviceToggleType==="checkbox",showClose:this.config.showClose===!0},framework:this.config.framework,languages:{...this.config.languages,current:this.currentLocale,showSelector:this.config.languages.supported.length>1,options:this.config.languages.supported.map(f=>({code:f,label:this.config.languages.labels?.[f]??oi(f)}))},...s?{tcf:ii(s,t,nn(this.config)?this.config.vendors??[]:[])}:{},...ri(this.consentEngine)?{us:{optedOutOfSale:this.consentEngine.getOptOutOfSale(),optedOutOfShare:this.consentEngine.getOptOutOfShare(),gpcDetected:this.consentEngine.isGpcDetected(),sensitivePIInUse:this.consentEngine.getSensitivePIInUse(),limitSensitiveUse:this.consentEngine.getLimitSensitiveUse()}}:{}},u=this.renderTarget;if(!u)return console.error("[ViewEngine] Shadow root render target is missing"),!1;try{bn(e,d,u,{view:t})}catch(f){return console.error(`[ViewEngine] Failed to mount view ${t}:`,f),this.bus.emit({type:"monitoring:error",payload:{code:"render_error"}}),!1}let m=u.querySelector('[role="dialog"]'),g=this.isModalView(t);m instanceof HTMLElement&&(m.setAttribute("aria-modal",g?"true":"false"),g&&this.cleanupFunctions.push(Is(m,this.container)));let h=u.querySelector("select[data-1c-lang]");if(h instanceof HTMLSelectElement&&(h.value=this.currentLocale,h.disabled=this.languageChangePending,h.onchange=()=>{if(this.languageChangePending)return;let f=this.config.languages.supported.find(C=>C===h.value),S=this.controllerSetLanguage;if(!f||!S)return;h.disabled=!0,this.languageChangePending=!0;let E;try{E=S(f)}catch(C){E=Promise.reject(C)}E.catch(C=>{let D=this.renderTarget?.querySelector("select[data-1c-lang]");D instanceof HTMLSelectElement&&(D.value=this.currentLocale),console.error("[ViewEngine] Language switch failed",C)}).finally(()=>{this.languageChangePending=!1;let C=this.renderTarget?.querySelector("select[data-1c-lang]");C instanceof HTMLSelectElement&&(C.disabled=!1)})}),u.textContent?.includes("[")){if(u.textContent?.includes("[ul]")){let D=/\[ul]([\s\S]*?)\[\/ul]/g,L=/\[li]([\s\S]*?)\[\/li]/g,N=document.createTreeWalker(u,NodeFilter.SHOW_TEXT),P=[],_;for(;_=N.nextNode();)_.textContent?.includes("[ul]")&&P.push(_);for(let ie of P){let X=ie.textContent||"",oe=document.createDocumentFragment(),V=0;D.lastIndex=0;let O;for(;(O=D.exec(X))!==null;){O.index>V&&oe.appendChild(document.createTextNode(X.slice(V,O.index)));let ae=document.createElement("ul");ae.className="oc-list";let ot=O[1];L.lastIndex=0;let Cn;for(;(Cn=L.exec(ot))!==null;){let vn=document.createElement("li");vn.textContent=Cn[1],ae.appendChild(vn)}oe.appendChild(ae),V=O.index+O[0].length}V<X.length&&oe.appendChild(document.createTextNode(X.slice(V))),ie.parentNode?.replaceChild(oe,ie)}}let f=/\[([abi])(?:\s+([^\]]*))?](.*?)\[\/\1]/g,S=document.createTreeWalker(u,NodeFilter.SHOW_TEXT),E=[],C;for(;C=S.nextNode();)C.textContent&&f.test(C.textContent)&&(E.push(C),f.lastIndex=0);for(let D of E){let L=D.textContent||"",N=document.createDocumentFragment(),P=0;f.lastIndex=0;let _;for(;(_=f.exec(L))!==null;){_.index>P&&N.appendChild(document.createTextNode(L.slice(P,_.index)));let ie=_[1],X=_[2]||"",oe=_[3],V;if(ie==="a"){let O=document.createElement("a");O.className="oc-link";let ae=X.match(/href="([^"]*)"/),ot=X.match(/action="([^"]*)"/);ot?(O.href="#",O.setAttribute("data-1c",ot[1])):ae?(O.href=ae[1],O.target="_blank",O.rel="noopener noreferrer"):O.href="#",V=O}else V=ie==="b"?document.createElement("strong"):document.createElement("em");V.textContent=oe,N.appendChild(V),P=_.index+_[0].length}P<L.length&&N.appendChild(document.createTextNode(L.slice(P))),D.parentNode?.replaceChild(N,D)}}let y={config:this.config,engine:this.consentEngine,getLanguage:()=>this.currentLocale,getTranslations:()=>this.translationsProvider(),cmp:{getState:()=>this.currentView,openCmp:()=>this.transitionTo("main","programmatic"),openDetails:()=>this.controllerOpenDetails?this.controllerOpenDetails().then(()=>!0):this.transitionTo("details","programmatic"),close:()=>this.closeCurrentView(),acceptAll:()=>this.saveDecision(()=>this.consentEngine.acceptAll()),rejectAll:()=>this.saveDecision(()=>this.consentEngine.rejectAll()),save:()=>this.saveDecision(),reset:()=>this.consentEngine.reset?.()},viewEngine:this,bus:this.bus,getThemeMode:this.getThemeMode,getShadowRoot:()=>this.shadowRoot},v=Xr(u,y),p=$r(u,y),A=si(this.container,y);return this.cleanupFunctions.push(v,p,A),!0}};var vt=class extends Ke{on(e,n){return this.bus.on(e,n)}off(e,n){this.bus.off(e,n)}emit(e,n){this.bus.emit({type:e,payload:n})}};var W=class extends vt{validatedStoredDecision;state;versionTracker=new Be;#e;#t;#n=!1;#s;#r;constructor(e,n,s){super(e,n,s),this.#r=s.languages.primary,this.state=this.#o();let r=Ue(s,n.getFastPath());this.#t=r!==void 0||this.#n,this.#e=r??(this.#n?K(this.config,this.#u()):{}),this.state.hasConsent&&this.#g()&&this.invalidateStoredConsent(),this.bus.on("language:changed",o=>{this.#i(o.payload.locale)});try{this.bootSyncsFastPath()&&(this.state.hasConsent&&this.hasValidConsent()?(this.syncFastPath(),this.mergeConsentDowngradeBaseline(K(this.config,this.#u()))):(this.storage.removeFastPath(),B(this.config)))}catch{}this.#l()}bootSyncsFastPath(){return!0}syncFastPath(e){We(this.config,this.getFastPathConsentMap(),this.getFastPathSyncOptions(),e??(n=>this.storage.refreshFastPath(n,this.validatedStoredDecision)))}reconcileExternalConsentChange(e,n,s=!1){if(!(!s&&!this.hasExternalConsentChange(e,n))){this.externalReconciliationPending=!1;try{this.reloadExternalConsentState(s)}catch(r){throw this.externalReconciliationPending=!0,r}this.versionTracker.increment(),s||this.mergeConsentDowngradeBaseline(this.getConsentDowngradeSnapshot()),this.emit("consent:changed"),s||this.emit("consent:external")}}reloadExternalConsentState(e=!1){let n=this.storage.getConsent(),s=this.storage.getFastPath();this.#n=!1,this.#s=void 0,this.state=this.#o(),(!this.state.hasConsent||!this.hasValidConsent())&&(n||s?this.invalidateStoredConsent():(this.state=this.freshVisitorState(),this.#n=!1,this.#s=void 0,B(this.config)))}getFastPathSyncOptions(){let e=this.getConsentTimestamp();return{...e===null?{}:{decisionTimestamp:e}}}getStoredLocale(){return this.#s}getDisplayLocale(){return this.#r}#i(e){this.#r=e;try{this.#c(e)}catch{}}#c(e){if(!this.state.hasConsent)return;let n=this.storage.getConsent();if(!n)return;let s=T.decodeForConfig(n.consent,this.config);if(s.language===e)return;let r=T.encode({...s,language:e}),o=this.storage.getConsentSnapshot();o&&(this.storage.updateConsentLocale(o,r),this.validatedStoredDecision=this.storage.getConsentSnapshot(),this.#s=e)}getFastPathConsentMap(){return this.getConsent()}getConsentDowngradeSnapshot(){return K(this.config,this.getFastPathConsentMap())}extendConsentDowngradeBaseline(e){this.#t&&(this.#e={...this.#e,...e})}mergeConsentDowngradeBaseline(e){let n={...this.#e};for(let[s,r]of Object.entries(e))n[s]=n[s]===!0||r===!0;this.#e=n,this.#t=!0}#o(){this.validatedStoredDecision=void 0;let e=this.storage.getConsentSnapshot(),n=e?.content;if(!n)return this.freshVisitorState();try{let s=this.#a(n);return this.validatedStoredDecision=e,s}catch(s){return console.error("[GdprEngine]",s),this.freshVisitorState()}}freshVisitorState(){return{hasConsent:!1,acceptedAll:!1,rejectedAll:!1,categories:this.getDefaultCategoryConsents(),services:this.getDefaultServiceConsents(),timestamp:Date.now()}}invalidateStoredConsent(){this.validatedStoredDecision=void 0,this.state=this.freshVisitorState(),this.#s=void 0,this.#n=!1,this.#e={},this.#t=!1;let e=!1;try{e=this.storage.invalidateConsent()}catch{}if(B(this.config),e)for(let n of this.storage.getContinuityScopes())n.frameworkId!==this.config.framework.id&&B({appId:n.appId,framework:{id:n.frameworkId,type:n.type},machine:n.machine,languages:{primary:n.primaryLanguage},consentEpoch:n.consentEpoch})}clearFastPathSignals(){try{this.storage.removeFastPath()}catch{}B(this.config)}#a(e){let n=T.decodeForConfig(e.consent,this.config);this.#s=n.language;let s=this.getDefaultCategoryConsents(),r=this.getDefaultServiceConsents(),o=e.gdprChoices??this.#p(),i=e.gdprChoices;if(i){if(this.getFrameworkPrefix()!=="gdpr")throw new Error("[GdprConsentEngine] GDPR choices require a GDPR decision.");if(i.structuralVersion===x(this.config.services,this.config.categories)){let l=(g,h)=>Object.keys(h).length===g.length&&g.every(y=>Object.hasOwn(h,y.id)&&(!y.essential||h[y.id]===!0)),d=this.config.categories.filter(g=>!g.essential),u=i.categoryOrder??d.map(g=>g.id),m=n.payload?T.decodeBitset(n.payload,u.length):[];if(!l(this.config.categories,i.categories)||!l(this.config.services,i.services)||u.length!==d.length||!u.every((g,h)=>d.some(y=>y.id===g)&&i.categories[g]===(n.state==="A"||n.state==="G"&&m[h]===!0)))throw new Error("[GdprConsentEngine] Stored GDPR choices disagree with their decision.")}}if(o){for(let l of this.config.categories)!l.essential&&typeof o.categories[l.id]=="boolean"&&(s[l.id]=o.categories[l.id]===!0);for(let l of this.config.services)!l.essential&&typeof o.services[l.id]=="boolean"&&(r[l.id]=o.services[l.id]===!0)}else if(n.state==="A")Object.keys(s).forEach(l=>{s[l]=!0}),Object.keys(r).forEach(l=>{r[l]=!0});else if(n.state!=="D"){if(n.state==="G"&&n.payload){let l=this.config.categories.filter(u=>!u.essential),d=T.decodeBitset(n.payload,l.length);l.forEach((u,m)=>{s[u.id]=d[m]??!1}),this.config.services.forEach(u=>{if(u.essential)r[u.id]=!0;else{let m=u.categoryId;r[u.id]=m?s[m]??!1:!1}})}}let{acceptedAll:c,rejectedAll:a}=this.#d(s,r);return this.#n=!0,{hasConsent:!0,acceptedAll:c,rejectedAll:a,categories:s,services:r,timestamp:n.timestamp*1e3}}#d(e,n){let s=this.config.categories.filter(r=>!r.essential).map(r=>e[r.id]);return this.getFrameworkPrefix()==="gdpr"&&(s.push(...this.config.services.filter(r=>!r.essential).map(r=>n[r.id])),s.length===0)?{acceptedAll:!1,rejectedAll:!1}:{acceptedAll:s.every(r=>r===!0),rejectedAll:s.every(r=>!r)}}#p(){let e=this.storage.getFastPath();if(!e||e.consentEpoch<(this.config.consentEpoch??0))return;let n=x(this.config.services,this.config.categories);return e.structuralVersion===n?void 0:e}getDefaultCategoryConsents(){let e={};return this.config.categories.forEach(n=>{e[n.id]=n.essential===!0}),e}getDefaultServiceConsents(){let e={};return this.config.services.forEach(n=>{e[n.id]=n.essential===!0}),e}acceptAll(){this.config.categories.forEach(e=>{this.state.categories[e.id]=!0}),this.config.services.forEach(e=>{this.state.services[e.id]=!0}),this.state.acceptedAll=!0,this.state.rejectedAll=!1,this.state.hasConsent=!0,this.state.timestamp=Date.now(),this.emit("consent:accepted-all"),this.emit("consent:changed")}rejectAll(){this.config.categories.forEach(e=>{this.state.categories[e.id]=e.essential===!0}),this.config.services.forEach(e=>{this.state.services[e.id]=e.essential===!0}),this.state.acceptedAll=!1,this.state.rejectedAll=!0,this.state.hasConsent=!0,this.state.timestamp=Date.now(),this.emit("consent:rejected-all"),this.emit("consent:changed")}getConsent(){return this.#u()}#u(){return{...this.state.categories,...this.state.services}}setConsent(e){for(let n of this.config.categories)(n.essential||typeof e[n.id]=="boolean")&&(this.state.categories[n.id]=n.essential===!0||e[n.id]===!0);for(let n of this.config.services)(n.essential||typeof e[n.id]=="boolean")&&(this.state.services[n.id]=n.essential===!0||e[n.id]===!0);this.state.timestamp=Date.now(),this.emit("consent:changed"),this.save()}getConsentState(){return{...this.state}}getEnforcementConsentState(){if(this.externalReconciliationPending)return this.freshVisitorState();let e=this.getFastPathConsentMap(),n={},s={};for(let r of this.config.categories)n[r.id]=e[r.id]===!0;for(let r of this.config.services)s[r.id]=e[r.id]===!0;return{...this.state,categories:n,services:s}}getCategoryConsent(e){return this.state.categories[e]||!1}setCategoryConsent(e,n){let s=this.config.categories.find(r=>r.id===e);s&&(s.essential&&!n||(this.state.categories[e]=n,this.state.timestamp=Date.now(),this.config.services.filter(r=>r.categoryId===e).forEach(r=>{this.setServiceConsent(r.id,n)}),this.emit("category:toggled",{id:e,value:n}),this.emit("consent:changed")))}getServiceConsent(e){return this.state.services[e]||!1}setServiceConsent(e,n){let s=this.config.services.find(r=>r.id===e);s&&(s.essential&&!n||(this.state.services[e]=n,this.state.timestamp=Date.now(),this.emit("service:toggled",{id:e,value:n}),this.emit("consent:changed")))}getCategoryConsents(){return{...this.state.categories}}getServiceConsents(){return{...this.state.services}}save(){this.state.hasConsent=!0,this.state.timestamp=Date.now(),this.getFrameworkPrefix()==="gdpr"&&Object.assign(this.state,this.#d(this.state.categories,this.state.services));let e=this.getConsentDowngradeSnapshot(),n=this.#t&&he(this.#e,e);this.#h(),this.#e=e,this.#t=!0,this.emit("consent:saved"),n&&fe(this.config)==="reload"&&window.location.reload()}#h(){let e=this.#C();this.state.timestamp=T.decodeForConfig(e,this.config).timestamp*1e3;let n=this.storage.getConsentId();n||(n=crypto.randomUUID(),this.storage.setConsentId(n)),this.syncFastPath(r=>{this.persistToLocalStorage(e,r)}),this.validatedStoredDecision=this.storage.getConsentSnapshot();let s=this.#S(e,n);s&&(this.storage.queuePendingEvent(s),this.#f(s).then(async r=>{r&&await this.storage.withExclusiveAccess(()=>this.storage.removePendingEvent(s.eventId))}).catch(r=>console.error("[1Consent] Consent receipt cleanup failed",r)))}#l(){for(let e of this.storage.getPendingEvents())this.#f(e).then(async n=>{n&&await this.storage.withExclusiveAccess(()=>this.storage.removePendingEvent(e.eventId))}).catch(n=>console.error("[1Consent] Consent receipt retry cleanup failed",n))}buildConsentEntry(e){let n=this.getFrameworkPrefix();return n==="gdpr"?{consent:e,gdprChoices:{categoryOrder:this.config.categories.filter(s=>!s.essential).map(s=>s.id),structuralVersion:x(this.config.services,this.config.categories),services:{...this.state.services},categories:{...this.state.categories}}}:n==="us"?{consent:e}:null}persistToLocalStorage(e,n){let s=this.buildConsentEntry(e);s&&this.storage.updateConsent(s,n)}#C(){let e=this.config.categories.filter(i=>!i.essential),n=e.every(i=>this.state.categories[i.id]===!0),s=e.every(i=>!this.state.categories[i.id]),r,o;if(n)r="A";else if(s)r="D";else{r="G";let i=e.map(c=>this.state.categories[c.id]===!0);o=T.encodeBitset(i)}return T.encode({machine:this.config.machine,configId:this.config.appId,version:1,framework:this.getFrameworkPrefix(),state:r,payload:o,language:this.#r,timestamp:Math.floor(Date.now()/1e3)})}#S(e,n){let s=this.config.cmp?.consentApiUrl;if(!s)return null;let r=this.config.consentPublicationToken;if(!r)return console.error("[Consent] Missing signed publication context"),null;let o=this.getEvidenceConsentDecision(),i=Rn(o),c=crypto.randomUUID();return{url:s,eventId:c,payload:{publicationToken:r,eventId:c,consentId:n,action:i,decision:o,consentString:e}}}getEvidenceConsentDecision(){let e=this.getFastPathConsentMap(),n=r=>te(r.filter(o=>!o.essential).map(o=>e[o.id]===!0)),s=n(this.config.categories);return{version:1,categoryProjection:s,categories:s,services:n(this.config.services),framework:""}}async#f(e){try{let n=await fetch(`${e.url}/v1/consent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e.payload),keepalive:!0});return n.status>=400&&n.status<500?(console.error("permanently rejected"),!0):n.ok}catch(n){return console.error("Consent failed",n),!1}}isConsentRequired(){return!!(this.externalReconciliationPending||!this.getConsentState().hasConsent||this.#g()||this.#y())}hasValidConsent(){return!this.isConsentRequired()}getConsentTimestamp(){return this.state.timestamp||null}#g(){let e=this.getConsentTimestamp(),n=Date.now();return e===null||!Number.isSafeInteger(e)||e<=0||!Number.isSafeInteger(n)||n<0||e>n?!0:n-e>33696e6}#y(){let e=Object.keys(this.state.categories);return(this.config.categories.map(s=>s.id)||[]).some(s=>!e.includes(s))}resolve(e){let n=k(e.bindingKey);if(n?.framework!=="gdpr")throw new Error(`[GDPR Engine] Invalid binding key: ${e.bindingKey}`);if(!e.id)throw new Error(`[GDPR Engine] ID required for GDPR bindings: ${e.bindingKey}`);let{entity:s}=n;if(s==="category")return this.resolveCategoryBinding(e.id);if(s==="service")return this.resolveServiceBinding(e.id);throw new Error(`[GDPR Engine] Unknown entity type: ${s}`)}resolveMany(e){let n=[];for(let s of e)try{let r=this.resolve(s);if(!s.id)continue;n.push({bindingKey:s.bindingKey,id:s.id,value:r.value,disabled:r.disabled})}catch(r){console.error("GDPR binding",s,r)}return{patches:n,version:this.versionTracker.getVersion()}}getFrameworkPrefix(){return"gdpr"}apply(e){let n=k(e.ref.bindingKey);if(n?.framework!=="gdpr")throw new Error(`[GDPR Engine] Invalid binding key: ${e.ref.bindingKey}`);if(!e.ref.id)throw new Error(`[GDPR Engine] ID required for GDPR bindings: ${e.ref.bindingKey}`);let{entity:s}=n,r=[];if(s==="category"){this.setCategoryConsent(e.ref.id,e.value);let i=this.resolveCategoryBinding(e.ref.id);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:i.value,disabled:i.disabled});let c=this.config.services.filter(a=>a.categoryId===e.ref.id);for(let a of c){let l=this.resolveServiceBinding(a.id);r.push({bindingKey:`consent:${this.getFrameworkPrefix()}.service`,id:a.id,value:l.value,disabled:l.disabled})}}else if(s==="service"){this.setServiceConsent(e.ref.id,e.value);let i=this.resolveServiceBinding(e.ref.id);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:i.value,disabled:i.disabled});let c=this.config.services.find(a=>a.id===e.ref.id);if(c?.categoryId){let a=this.resolveCategoryBinding(c.categoryId);r.push({bindingKey:`consent:${this.getFrameworkPrefix()}.category`,id:c.categoryId,value:a.value,disabled:a.disabled})}}else throw new Error(`[GDPR Engine] Unknown entity type: ${s}`);let o=this.versionTracker.increment();return{patches:r,version:o}}resolveCategoryBinding(e){let n=this.config.categories.find(o=>o.id===e);if(!n)throw new Error(`[GDPR Engine] Category not found: ${e}`);if(n.essential)return{value:!0,disabled:!0};let s=this.config.services.filter(o=>o.categoryId===e),r;return s.length===0?r=this.state.categories[e]||!1:r=s.every(o=>this.state.services[o.id]),{value:r,disabled:!1}}resolveServiceBinding(e){let n=this.config.services.find(r=>r.id===e);if(!n)throw new Error(`[GDPR Engine] Service not found: ${e}`);return n.essential?{value:!0,disabled:!0}:this.config.categories.find(r=>r.id===n.categoryId)?.essential?{value:!0,disabled:!0}:{value:this.state.services[e]||!1,disabled:!1}}};var Je=class extends M{engine;constructor(e,n){super(e,n),this.engine=new W(this.bus,this.storage,e),this.attachBlocking(this.engine),this.resolveInitialLocale(this.engine.getStoredLocale())}async init(){if(this.engine.isConsentRequired()){let n=this.ensureViewData("main");await this.ensureViewEngine(),await Promise.all([this.ensureViewLoaded("main"),n])}else await this.showReturningVisitorTrigger(),this.bus.emit({type:"consent:ready"})}async acceptAll(){await this.storage.withExclusiveAccess(()=>{this.engine.acceptAll(),this.engine.save()}),await this.close()}async rejectAll(){await this.storage.withExclusiveAccess(()=>{this.engine.rejectAll(),this.engine.save()}),await this.close()}};var dn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function Et(t){if(!/^[A-Za-z0-9_-]*$/.test(t)||t.length%4===1)throw new Error("invalid base64url");let e=t.length,n=new Uint8Array(Math.floor(e*6/8)),s=0,r=0,o=0;for(let i=0;i<e;i++)s=s<<6|dn.indexOf(t[i]),r+=6,r>=8&&(r-=8,n[o++]=s>>r&255);if(bt(n)!==t)throw new Error("invalid base64url");return n}function bt(t){let e="",n=0,s=0;for(let r=0;r<t.length;r++)for(n=n<<8|(t[r]??0),s+=8;s>=6;)s-=6,e+=dn[n>>s&63];return s>0&&(e+=dn[n<<6-s&63]??""),e}function U(){throw new Error("invalid TC")}function Tt(t,e,n){for(let s of n){let r=e*65536+s;t.has(r)&&U(),t.add(r)}}var un=53;function hn(t){if(!Number.isSafeInteger(t)||t<1||t>un)throw new Error(`Bit length must be an integer from 1 to ${un}`)}var Ee=class{buffer;#e=0;constructor(e){this.buffer=e}readBits(e){if(hn(e),e>32){let s=0;for(let r=0;r<e;r++)s=s*2+(this.readBit()?1:0);return s}let n=0;for(let s=0;s<e;s++)n=n<<1|(this.readBit()?1:0);return n>>>0}readBit(){if(this.#e>=this.buffer.length*8)throw new Error("BitReader: Unexpected end of stream");let e=Math.floor(this.#e/8),n=7-this.#e%8,s=(this.buffer[e]??0)>>n&1;return this.#e++,s===1}readBool(){return this.readBit()}readLanguage(){let e=this.readBits(6),n=this.readBits(6);if(e>25||n>25)throw new Error("BitReader: invalid alpha-2 language field");let s=String.fromCharCode(e+65),r=String.fromCharCode(n+65);return(s+r).toLowerCase()}hasMore(){return this.hasMoreBits(1)}hasMoreBits(e){return hn(e),this.#e+e<=this.buffer.length*8}assertOnlyPadding(){let e=this.buffer.length*8-this.#e;for(;e>0;)(e-- >7||this.readBit())&&U()}},Ze=class{#e=[];writeBits(e,n){hn(n);let s=n===un?Number.MAX_SAFE_INTEGER:2**n-1;if(!Number.isSafeInteger(e)||e<0||e>s)throw new Error(`BitWriter: value ${e} does not fit in ${n} bits`);let r=e.toString(2).padStart(n,"0");for(let o=0;o<n;o++)this.#e.push(r[o]==="1"?1:0)}writeBit(e){if(typeof e!="boolean")throw new Error("BitWriter: bit value must be boolean");this.#e.push(e?1:0)}writeBool(e){this.writeBit(e)}writeLanguage(e){if(!/^[A-Za-z]{2}$/.test(e))throw new Error("BitWriter: language must be exactly two ASCII letters");let n=e.toUpperCase();this.writeBits(n.charCodeAt(0)-65,6),this.writeBits(n.charCodeAt(1)-65,6)}toUint8Array(){let e=Math.ceil(this.#e.length/8),n=new Uint8Array(e);for(let s=0;s<this.#e.length;s++){let r=Math.floor(s/8),o=7-s%8;if(this.#e[s]===1){let i=n[r];i!==void 0&&(n[r]=i|1<<o)}}return n}};function Qe(t){let e=Et(t);if(e.length!==0)return new Ee(e).readBits(3)}function It(t){let e=t.split("."),n=e[0]??"",s=Et(n),r=new Ee(s),o=r.readBits(6);if(o!==2)throw new Error(`TCF: unsupported TC string version ${o}`);let i=r.readBits(36),c=r.readBits(36),a=r.readBits(12),l=r.readBits(12),d=r.readBits(6),u=r.readLanguage(),m=r.readBits(12),g=r.readBits(6),h=r.readBool(),y=r.readBool(),v=fn(r,12),p=fn(r,24),A=fn(r,24),f=r.readBool(),S=r.readLanguage(),E=pn(r),C=pn(r),D=ai(r);r.assertOnlyPadding();let L={version:o,created:i,lastUpdated:c,cmpId:a,cmpVersion:l,consentScreen:d,consentLanguage:u,vendorListVersion:m,tcfPolicyVersion:g,isServiceSpecific:h,useNonStandardStacks:y,specialFeatureOptIns:v,purposeConsents:p,purposeLegitimateInterests:A,purposeOneTreatment:f,publisherCC:S,vendorConsents:E,vendorLegitimateInterests:C,publisherRestrictions:D};for(let N=1;N<e.length;N++){let P=new Ee(Et(e[N]??""));P.readBits(3)===1&&(L.disclosedVendors=pn(P),P.assertOnlyPadding())}return L}function fn(t,e){let n=new Set;for(let s=1;s<=e;s++)t.readBool()&&n.add(s);return n}function pn(t){let e=t.readBits(16);if(!t.readBool()){let r=new Set;for(let o=1;o<=e;o++)t.readBool()&&r.add(o);return r}let s=xs(t,t.readBits(12),e);return s.some(r=>r.end===e)||U(),Ps(s)}function xs(t,e,n){let s=[];for(let r=0;r<e;r++){let o=t.readBool(),i=t.readBits(16);if(_s(i,n),!o){s.push({start:i,end:i});continue}let c=t.readBits(16);_s(c,n),c<=i&&U(),s.push({start:i,end:c})}return s}function _s(t,e){(t<1||t>e)&&U()}function Ps(t){let e=new Set;t.sort((s,r)=>s.start-r.start||s.end-r.end);let n=0;for(let s of t){let r=Math.max(s.start,n+1);for(let o=r;o<=s.end;o++)e.add(o);n=Math.max(n,s.end)}return e}function ai(t){let e=t.readBits(12),n=[],s=new Set;for(let r=0;r<e;r++){let o=t.readBits(6);(o<1||o>24)&&U();let i=t.readBits(2);i>2&&U();let c=t.readBits(12),a=Ps(xs(t,c,65535));Tt(s,o,a),n.push({purposeId:o,restrictionType:i,vendorIds:a})}return n}function At(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("TCF: invalid millisecond timestamp");let e=new Date(t),n=Math.round(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())/100);try{be(n,"derived")}catch{throw new Error("TCF: invalid millisecond timestamp")}return n}function be(t,e){if(!Number.isSafeInteger(t)||t<0||t>68719476735||t%864e3!==0)throw new Error(`TCF: invalid ${e} timestamp`)}function Ot(t,e){try{return be(t,"Created"),be(e,"LastUpdated"),t===e}catch{return!1}}function Ds(t){return{resolve(e){let n=t.stacks[e];return n?{purposes:n.purposes,specialFeatures:n.specialFeatures}:null}}}var _t=class t{decode;encode;opts;#e=null;#t=[];constructor(e,n,s={}){this.decode=e,this.encode=n,this.opts=s,!this.opts.stackResolver&&this.opts.base&&(this.opts.stackResolver=Ds(this.opts.base))}static withBase(e,n,s,r={}){return new t(e,n,{...r,base:s,stackResolver:Ds(s)})}static raw(e,n,s={}){return new t(e,n,s)}load(e){let n=this.decode(e);if(this.#e=n,this.#t=e.split("."),!Ot(this.#e.created,this.#e.lastUpdated))throw new Error("TCF: invalid Created/LastUpdated timestamps");return this.#e}startNew(){this.#t=[];let e=this.#i();return this.#e={version:2,created:e,lastUpdated:e,cmpId:this.opts.base?.cmpId??0,cmpVersion:this.opts.base?.cmpVersion??1,consentScreen:1,consentLanguage:"en",vendorListVersion:this.opts.base?.vendorListVersion||0,tcfPolicyVersion:this.opts.base?.tcfPolicyVersion??5,isServiceSpecific:!0,useNonStandardStacks:!1,specialFeatureOptIns:new Set(this.opts.base?.specialFeatureOptins||[]),purposeConsents:new Set(this.opts.base?.purposeConsents||[]),purposeLegitimateInterests:new Set(this.opts.base?.purposeLegitimateInterests||[]),purposeOneTreatment:!1,publisherCC:"AA",vendorConsents:new Set(this.opts.base?.vendorConsents||[]),vendorLegitimateInterests:new Set(this.opts.base?.vendorLegitimateInterests||[]),disclosedVendors:new Set(this.opts.base?.disclosedVendors??[])},this.#e}getDecoded(){if(!this.#e)throw new Error("TCF: call load(tcString) first");return this.#e}toTcString(){let e=this.encode(this.getDecoded()).split(".");if(this.#t.length<=1)return e.join(".");let n=new Set;for(let r of e.slice(1)){let o=Qe(r);o!==void 0&&n.add(o)}let s=this.#t.slice(1).filter(r=>{let o=Qe(r);return o!==void 0&&!n.has(o)});return[...e,...s].join(".")}getPurposeConsent(e){return this.#o(e),this.getDecoded().purposeConsents.has(e)}getPurposeConsents(){let e={},n=this.getDecoded().purposeConsents;for(let s=1;s<=24;s++)e[s]=n.has(s);return e}getPurposeLegitimateInterest(e){return this.#o(e),this.getDecoded().purposeLegitimateInterests.has(e)}getSpecialFeatureOptIn(e){return this.#d(e),this.getDecoded().specialFeatureOptIns.has(e)}getSpecialFeatureOptIns(){let e={},n=this.getDecoded().specialFeatureOptIns;for(let s=1;s<=12;s++)e[s]=n.has(s);return e}getVendorConsent(e){return this.#a(e),this.getDecoded().vendorConsents.has(e)}getVendorLegitimateInterest(e){return this.#a(e),this.getDecoded().vendorLegitimateInterests.has(e)}setConsentLanguage(e){let n=e.toLowerCase();if(!/^[a-z]{2}$/.test(n))throw new Error("TCF: consentLanguage must be a two-letter ISO 639-1 code");let s=this.getDecoded();return s.consentLanguage===n?this:(s.consentLanguage=n,this.#r())}setPurposeConsent(e,n){return this.#o(e),this.#n(this.getDecoded().purposeConsents,e,n)?this.#r():this}setPurposeLegitimateInterest(e,n){if(this.#o(e),n&&this.#c()){if(e===1)throw new Error("TCF Policy: Purpose 1 requires consent, not legitimate interest");if(e>=3&&e<=6)throw new Error(`TCF 2.4: Purpose ${e} requires consent and cannot use legitimate interest`)}return this.#n(this.getDecoded().purposeLegitimateInterests,e,n)?this.#r():this}setVendorConsent(e,n){return this.#a(e),this.#n(this.getDecoded().vendorConsents,e,n)?this.#r():this}setVendorLegitimateInterest(e,n){return this.#a(e),this.#n(this.getDecoded().vendorLegitimateInterests,e,n)?this.#r():this}setSpecialFeatureOptIn(e,n){return this.#d(e),this.#n(this.getDecoded().specialFeatureOptIns,e,n)?this.#r():this}setPurposeConsents(e,n){for(let s of e)this.setPurposeConsent(s,n);return this}setPurposeLegitimateInterests(e,n){for(let s of e)this.setPurposeLegitimateInterest(s,n);return this}setVendorConsents(e,n){for(let s of e)this.setVendorConsent(s,n);return this}setVendorLegitimateInterests(e,n){for(let s of e)this.setVendorLegitimateInterest(s,n);return this}setSpecialFeatureOptIns(e,n){for(let s of e)this.setSpecialFeatureOptIn(s,n);return this}applyStack(e,n){let s=this.opts.stackResolver;if(!s)throw new Error("TCF: applyStack requires opts.base or opts.stackResolver");let r=s.resolve(e);if(!r)throw new Error(`TCF: unknown stackId ${e}`);return r.purposes?.length&&this.setPurposeConsents(r.purposes,n),r.purposeLI?.length&&this.setPurposeLegitimateInterests(r.purposeLI,n),r.vendors?.length&&this.setVendorConsents(r.vendors,n),r.vendorLI?.length&&this.setVendorLegitimateInterests(r.vendorLI,n),r.specialFeatures?.length&&this.setSpecialFeatureOptIns(r.specialFeatures,n),this}setPublisherRestriction(e,n,s){this.#o(e);let r=this.getDecoded(),o=new Set;for(let a of s)this.#a(a),o.add(a);let i=r.publisherRestrictions?.find(a=>a.purposeId===e);if(i?.restrictionType===n&&this.#s(i.vendorIds,o))return this;r.publisherRestrictions||(r.publisherRestrictions=[]);let c=i;return c?(c.restrictionType=n,c.vendorIds.clear()):(c={purposeId:e,restrictionType:n,vendorIds:new Set},r.publisherRestrictions.push(c)),c.vendorIds=o,this.#r()}removePublisherRestrictionVendors(e,n){this.#o(e);let s=this.getDecoded(),r=s.publisherRestrictions;if(!r?.length)return this;let o=r.findIndex(a=>a.purposeId===e);if(o===-1)return this;let i=r[o];if(!i)return this;let c=!1;for(let a of n)this.#a(a),c=i.vendorIds.delete(a)||c;return c?(i.vendorIds.size===0&&(r.splice(o,1),r.length===0&&delete s.publisherRestrictions),this.#r()):this}clearPublisherRestriction(e){this.#o(e);let n=this.getDecoded(),s=n.publisherRestrictions;if(!s?.length)return this;let r=s.findIndex(o=>o.purposeId===e);return r===-1?this:(s.splice(r,1),s.length===0&&delete n.publisherRestrictions,this.#r())}#n(e,n,s){return e.has(n)===s?!1:(s?e.add(n):e.delete(n),!0)}#s(e,n){return e.size===n.size&&[...e].every(s=>n.has(s))}#r(){let e=this.getDecoded(),n=this.#i();return e.created=n,e.lastUpdated=n,this}#i(){return At(this.opts.now?this.opts.now():Date.now())}#c(){return this.opts.enforceTcfPolicy!==!1}#o(e){if(!this.opts.validateIds)return;let n=this.opts.maxPurposeId??24;if(!Number.isInteger(e)||e<1||e>n)throw new Error(`TCF: invalid purposeId ${e} (expected 1..${n})`)}#a(e){if(!this.opts.validateIds)return;let n=this.opts.maxVendorId;if(!Number.isInteger(e)||e<1||n!=null&&e>n)throw new Error(`TCF: invalid vendorId ${e} (expected >=1${n!=null?` and <=${n}`:""})`)}#d(e){if(!this.opts.validateIds)return;let n=this.opts.maxSpecialFeatureId??12;if(!Number.isInteger(e)||e<1||e>n)throw new Error(`TCF: invalid specialFeatureId ${e} (expected 1..${n})`)}};function ks(t){let e=new Ze,n=t.created??t.lastUpdated??At(Date.now()),s=t.created??n,r=t.lastUpdated??n;if(be(s,"Created"),be(r,"LastUpdated"),s!==r)throw new Error("TCF: Created and LastUpdated must be equal");let o=t.version??2;if(o!==2)throw new Error(`TCF: unsupported TC string version ${o}`);e.writeBits(o,6),e.writeBits(s,36),e.writeBits(r,36),e.writeBits(t.cmpId??0,12),e.writeBits(t.cmpVersion??0,12),e.writeBits(t.consentScreen??0,6),e.writeLanguage(t.consentLanguage??"en"),e.writeBits(t.vendorListVersion??0,12);let i=t.tcfPolicyVersion??5;if(i!==5)throw new Error(`TCF 2.4: unsupported policy version ${i}`);e.writeBits(i,6),e.writeBool(t.isServiceSpecific??!1),e.writeBool(t.useNonStandardStacks??!1),gn(e,t.specialFeatureOptIns??new Set,12,"special-feature"),gn(e,t.purposeConsents??new Set,24,"purpose-consent"),gn(e,t.purposeLegitimateInterests??new Set,24,"purpose-legitimate-interest"),e.writeBool(t.purposeOneTreatment??!1),e.writeLanguage(t.publisherCC??"aa"),mn(e,t.vendorConsents,"vendor-consent"),mn(e,t.vendorLegitimateInterests,"vendor-legitimate-interest"),ci(e,t.publisherRestrictions??[]);let c=e.toUint8Array(),a=bt(c);if(t.disclosedVendors===void 0)throw new Error("TCF 2.4: disclosed vendors are required");let l=new Ze;l.writeBits(1,3),mn(l,t.disclosedVendors,"disclosed-vendor");let d=l.toUint8Array();return`${a}.${bt(d)}`}function gn(t,e,n,s){for(let r of e)Y(r,1,n,s);for(let r=1;r<=n;r++)t.writeBool(e.has(r))}function mn(t,e,n){if(e.size===0){t.writeBits(0,16),t.writeBool(!1);return}let s=Array.from(e).sort((a,l)=>a-l);for(let a of s)Y(a,1,65535,n);let r=s[s.length-1]??0,o=Ls(s),i=r,c=12+o.reduce((a,l)=>a+1+16+(l.start===l.end?0:16),0);if(i<=c){t.writeBits(r,16),t.writeBool(!1);for(let a=1;a<=r;a++)t.writeBool(e.has(a))}else{t.writeBits(r,16),t.writeBool(!0),Y(o.length,0,2**12-1,`${n} range count`),t.writeBits(o.length,12);for(let a of o)a.start===a.end?(t.writeBool(!1),t.writeBits(a.start,16)):(t.writeBool(!0),t.writeBits(a.start,16),t.writeBits(a.end,16))}}function Ls(t){let e=[];if(t.length===0)return e;let n=t[0]??0,s=n;for(let r=1;r<t.length;r++){let o=t[r]??0;o===s+1?s=o:(e.push({start:n,end:s}),n=o,s=n)}return e.push({start:n,end:s}),e}function ci(t,e){Y(e.length,0,2**12-1,"publisher restriction count");let n=new Set;t.writeBits(e.length,12);for(let s of e){Y(s.purposeId,1,24,"publisher restriction purpose"),Y(s.restrictionType,0,2,"publisher restriction type"),t.writeBits(s.purposeId,6),t.writeBits(s.restrictionType,2);let r=Array.from(s.vendorIds).sort((i,c)=>i-c);for(let i of r)Y(i,1,65535,"publisher restriction vendor");Tt(n,s.purposeId,r);let o=Ls(r);Y(o.length,0,2**12-1,"publisher restriction range count"),t.writeBits(o.length,12);for(let i of o)i.start===i.end?(t.writeBool(!1),t.writeBits(i.start,16)):(t.writeBool(!0),t.writeBits(i.start,16),t.writeBits(i.end,16))}}function Y(t,e,n,s){if(!Number.isSafeInteger(t)||t<e||t>n)throw new Error(`TCF: invalid ${s} ${t} (expected ${e}..${n})`)}function Te(t){return Object.fromEntries([...t].map(e=>[e.toString(),!0]))}function Ns(t){try{let e=t.split(".").slice(1).map(n=>Qe(n));return e.length===1&&e[0]===1}catch{return!1}}function li(t,e){if(t.version!==2||!Ot(t.created,t.lastUpdated)||t.cmpId!==Me||t.tcfPolicyVersion!==Q||!t.isServiceSpecific||!/^[a-z]{2}$/.test(t.consentLanguage)||!/^[a-z]{2}$/i.test(t.publisherCC)||!t.disclosedVendors)return;let n={};for(let r of t.publisherRestrictions??[]){if(r.restrictionType!==0&&r.restrictionType!==1&&r.restrictionType!==2)return;let o=r.purposeId.toString(),i=n[o]??{};for(let c of r.vendorIds){let a=c.toString();if(a in i)return;i[a]=r.restrictionType}n[o]=i}let s={...e?{enableAdvertiserConsentMode:!0}:{},tcfPolicyVersion:t.tcfPolicyVersion,cmpId:t.cmpId,cmpVersion:t.cmpVersion,isServiceSpecific:t.isServiceSpecific,useNonStandardTexts:t.useNonStandardStacks,publisherCC:t.publisherCC.toUpperCase(),purposeOneTreatment:t.purposeOneTreatment,purpose:{consents:Te(t.purposeConsents),legitimateInterests:Te(t.purposeLegitimateInterests)},vendor:{consents:Te(t.vendorConsents),legitimateInterests:Te(t.vendorLegitimateInterests),disclosedVendors:Te(t.disclosedVendors)},specialFeatureOptins:Te(t.specialFeatureOptIns),publisher:{consents:{},legitimateInterests:{},customPurpose:{consents:{},legitimateInterests:{}},restrictions:n}};return Kn(s)?s:void 0}var xt=class extends W{tcfController;#e;#t;#n;#s;#r;#i;#c=!1;constructor(e,n,s){super(e,n,s),this.#e=s;let r=s.vendors.map(c=>c.id);[this.#t,this.#n,this.#s,this.#r,this.#i]=Mn(s.vendors);let o={cmpId:Me,cmpVersion:Hn,vendorListVersion:"vendorListVersion"in s.framework?s.framework.vendorListVersion:0,tcfPolicyVersion:Q,purposeConsents:[],purposeLegitimateInterests:this.#n,specialFeatureOptins:[],vendorConsents:[],vendorLegitimateInterests:this.#i,disclosedVendors:r,purposes:[...new Set([...this.#t,...this.#n])],stacks:{}};this.tcfController=_t.withBase(It,ks,o);let i=this.#o(r);if(i&&this.hasValidConsent())try{this.syncFastPath(),this.mergeConsentDowngradeBaseline(this.getConsentDowngradeSnapshot())}catch{}else this.clearFastPathSignals();i&&this.extendConsentDowngradeBaseline(this.#d())}bootSyncsFastPath(){return!1}reloadExternalConsentState(e=!1){super.reloadExternalConsentState(e);let n=this.#e.vendors.map(r=>r.id),s=this.#o(n);this.#c=!e&&!s,this.#c&&(this.tcfController.setPurposeLegitimateInterests(this.#n,!1),this.tcfController.setVendorLegitimateInterests(this.#i,!1))}markLegitimateInterestDisclosuresVisible(){!this.#c||this.state.hasConsent||(this.#c=!1,this.tcfController.setPurposeLegitimateInterests(this.#n,!0),this.tcfController.setVendorLegitimateInterests(this.#i,!0),this.emit("consent:changed"))}#o(e){let n=this.storage.getConsent(),s=!1;if(this.state.hasConsent&&n?.tcString&&Ns(n.tcString))try{this.tcfController.load(n.tcString);let r=this.getTcfApiDecisionData();s=lt(Object.keys(r.vendor.disclosedVendors).map(Number))===lt(e)&&this.#a(r)}catch{}return s||(this.#p(),n&&this.invalidateStoredConsent()),s}#a(e){let n=(r,o)=>Object.keys(r).every(i=>o.includes(Number(i)));if(!n(e.purpose.consents,this.#t)||!n(e.purpose.legitimateInterests,this.#n)||!n(e.vendor.consents,this.#r)||!n(e.vendor.legitimateInterests,this.#i)||!n(e.specialFeatureOptins,this.#s))return!1;let s=new Map(this.#e.vendors.map(r=>[r.id,r]));for(let[r,o]of Object.entries(e.publisher.restrictions)){let i=Number(r);for(let[c,a]of Object.entries(o)){let l=s.get(Number(c));if(!l||!(l.consentPurposeIds.includes(i)||l.legitimateInterestPurposeIds.includes(i))||a!==0&&!l.flexiblePurposeIds.includes(i)||a===2&&!l.legitimateInterestPurposeIds.includes(i))return!1}}return!0}getFastPathSyncOptions(){let e=this.getTcString(),n=this.getTcfApiDecisionData();return{...super.getFastPathSyncOptions(),decisionIntegrity:St(e),tcfCmpId:Me,tcfValidationVersion:qn,tcfDisclosedVendorKey:lt(this.#e.vendors.map(s=>s.id)),tcfApiData:n,tcfApiDataIntegrity:St(zn(e,n))}}getConsentDowngradeSnapshot(){return{...super.getConsentDowngradeSnapshot(),...this.#d()}}getEvidenceConsentDecision(){return{...super.getEvidenceConsentDecision(),framework:te(Object.values(this.#d()))}}getExternalConsentSnapshot(e){let n=super.getExternalConsentSnapshot(e),r=Ce(e,this.storage.getScope())?.consent?.tcString;if(!r)return n;try{let o=It(r);if(o.version!==2||o.tcfPolicyVersion!==Q||o.cmpId!==Me)return n;let i={...n??{}};for(let c of this.#t)i[`tcf:purpose:${c}`]=o.purposeConsents.has(c);for(let c of this.#n)i[`tcf:purposeLI:${c}`]=o.purposeLegitimateInterests.has(c);for(let c of this.#s)i[`tcf:specialFeature:${c}`]=o.specialFeatureOptIns.has(c);for(let c of this.#r)i[`tcf:vendor:${c}`]=o.vendorConsents.has(c);for(let c of this.#i)i[`tcf:vendorLI:${c}`]=o.vendorLegitimateInterests.has(c);return i}catch{return n}}getCurrentExternalConsentSnapshot(){let e=super.getCurrentExternalConsentSnapshot();return e?{...e,...this.#d()}:void 0}#d(){let e={};for(let n of this.#t)e[`tcf:purpose:${n}`]=this.tcfController.getPurposeConsent(n);for(let n of this.#n)e[`tcf:purposeLI:${n}`]=this.tcfController.getPurposeLegitimateInterest(n);for(let n of this.#s)e[`tcf:specialFeature:${n}`]=this.tcfController.getSpecialFeatureOptIn(n);for(let n of this.#r)e[`tcf:vendor:${n}`]=this.tcfController.getVendorConsent(n);for(let n of this.#i)e[`tcf:vendorLI:${n}`]=this.tcfController.getVendorLegitimateInterest(n);return e}acceptAll(){super.acceptAll(),this.tcfController.setPurposeConsents(this.#t,!0),this.tcfController.setPurposeLegitimateInterests(this.#n,!0),this.tcfController.setSpecialFeatureOptIns(this.#s,!0),this.tcfController.setVendorConsents(this.#r,!0),this.tcfController.setVendorLegitimateInterests(this.#i,!0)}rejectAll(){super.rejectAll(),this.tcfController.setPurposeConsents(this.#t,!1),this.tcfController.setPurposeLegitimateInterests(this.#n,!1),this.tcfController.setSpecialFeatureOptIns(this.#s,!1),this.tcfController.setVendorConsents(this.#r,!1),this.tcfController.setVendorLegitimateInterests(this.#i,!1)}getPurposeConsent(e){return this.tcfController.getPurposeConsent(e)}setPurposeConsent(e,n){if(!this.#t.includes(e))throw new Error(`[TCF Engine] Purpose ${e} was not disclosed for consent`);this.tcfController.setPurposeConsent(e,n),this.state.timestamp=Date.now(),this.emit("purpose:toggled",{id:e,value:n}),this.emit("consent:changed")}getPurposeLegitimateInterest(e){return this.tcfController.getPurposeLegitimateInterest(e)}setPurposeLegitimateInterest(e,n){if(!this.#n.includes(e))throw new Error(`[TCF Engine] Purpose ${e} was not disclosed for legitimate interest`);this.tcfController.setPurposeLegitimateInterest(e,n),this.state.timestamp=Date.now(),this.emit("purpose-legitimate-interest:toggled",{id:e,value:n}),this.emit("consent:changed")}getSpecialFeatureOptIn(e){return this.tcfController.getSpecialFeatureOptIn(e)}setSpecialFeatureOptIn(e,n){if(!this.#s.includes(e))throw new Error(`[TCF Engine] Special Feature ${e} was not disclosed`);this.tcfController.setSpecialFeatureOptIn(e,n),this.state.timestamp=Date.now(),this.emit("special-feature:toggled",{id:e,value:n}),this.emit("consent:changed")}getVendorConsent(e){return this.tcfController.getVendorConsent(e)}setVendorConsent(e,n){if(!this.#r.includes(e))throw new Error(`[TCF Engine] Vendor ${e} was not disclosed for consent`);this.tcfController.setVendorConsent(e,n),this.state.timestamp=Date.now(),this.emit("vendor:toggled",{id:e,value:n}),this.emit("consent:changed")}getVendorLegitimateInterest(e){return this.tcfController.getVendorLegitimateInterest(e)}setVendorLegitimateInterest(e,n){if(!this.#i.includes(e))throw new Error(`[TCF Engine] Vendor ${e} was not disclosed for legitimate interest`);this.tcfController.setVendorLegitimateInterest(e,n),this.state.timestamp=Date.now(),this.emit("vendor-legitimate-interest:toggled",{id:e,value:n}),this.emit("consent:changed")}getTcString(){return this.tcfController.toTcString()}getTcfApiDecisionData(){let e=this.getTcString(),n=It(e),s=Ns(e)?li(n,this.#e.gcm!==void 0):void 0;if(!s||!this.#a(s))throw new Error("Current TC model cannot produce complete current-GVL web TCData");return s}save(){this.#u(),super.save()}getPurposes(){let e=[];for(let n of new Set([...this.#t,...this.#n]))e.push({id:n,consent:this.getPurposeConsent(n),legitimateInterest:this.getPurposeLegitimateInterest(n)});return e}getSpecialFeatures(){let e=[];for(let n of this.#s)e.push({id:n,optIn:this.getSpecialFeatureOptIn(n)});return e}buildConsentEntry(e){return{consent:e,tcString:this.tcfController.toTcString()}}#p(){this.tcfController.startNew(),this.#u()}#u(){let e=In(this.getDisplayLocale());e&&this.tcfController.setConsentLanguage(e)}getFrameworkPrefix(){return"tcf"}resolve(e){let n=k(e.bindingKey);if(n?.framework==="gdpr")return super.resolve(e);if(n?.framework!=="tcf")throw new Error(`[TCF Engine] Invalid binding key: ${e.bindingKey}`);let{entity:s}=n;if(!e.id)throw new Error(`[TCF Engine] ID required for TCF bindings: ${e.bindingKey}`);let r=parseInt(e.id,10);if(Number.isNaN(r))throw new Error(`[TCF Engine] Invalid numeric ID for TCF binding: ${e.id}`);switch(s){case"purpose":return this.#h(r);case"purposeLegitimateInterest":return this.#l(r);case"specialPurpose":return this.#C(r);case"feature":return this.#S(r);case"specialFeature":return this.#f(r);case"vendor":return this.#g(r);case"vendorLegitimateInterest":return this.#y(r);case"stack":return this.#w(r);default:throw new Error(`[TCF Engine] Unknown entity type: ${s}`)}}resolveMany(e){return{patches:e.map(s=>{let r=this.resolve(s);if(!s.id)throw new Error(`[TCF Engine] ID required for ${s.bindingKey}`);return{bindingKey:s.bindingKey,id:s.id,value:r.value,disabled:r.disabled}}),version:this.versionTracker.getVersion()}}apply(e){let n=k(e.ref.bindingKey);if(n?.framework==="gdpr")return super.apply(e);if(n?.framework!=="tcf")throw new Error(`[TCF Engine] Invalid binding key: ${e.ref.bindingKey}`);if(!e.ref.id)throw new Error(`[TCF Engine] ID required for TCF bindings: ${e.ref.bindingKey}`);let{entity:s}=n,r=[];if(s==="purpose"){let i=parseInt(e.ref.id,10);this.setPurposeConsent(i,e.value);let c=this.#h(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="purposeLegitimateInterest"){let i=parseInt(e.ref.id,10);this.setPurposeLegitimateInterest(i,e.value);let c=this.#l(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="specialFeature"){let i=parseInt(e.ref.id,10);this.setSpecialFeatureOptIn(i,e.value);let c=this.#f(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="vendor"){let i=parseInt(e.ref.id,10);this.setVendorConsent(i,e.value);let c=this.#g(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="vendorLegitimateInterest"){let i=parseInt(e.ref.id,10);this.setVendorLegitimateInterest(i,e.value);let c=this.#y(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled})}else if(s==="stack"){let i=parseInt(e.ref.id,10),c=this.#v(i);for(let l of c.purposes)this.#t.includes(l)&&(this.tcfController.setPurposeConsent(l,e.value),this.emit("purpose:toggled",{id:l,value:e.value}));for(let l of c.specialFeatures)this.#s.includes(l)&&(this.tcfController.setSpecialFeatureOptIn(l,e.value),this.emit("special-feature:toggled",{id:l,value:e.value}));this.state.timestamp=Date.now(),this.emit("consent:changed");let a=this.#w(i);r.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:a.value,disabled:a.disabled});for(let l of c.purposes){if(!this.#t.includes(l))continue;let d=this.#h(l);r.push({bindingKey:"consent:tcf.purpose",id:String(l),value:d.value,disabled:d.disabled})}for(let l of c.specialFeatures){if(!this.#s.includes(l))continue;let d=this.#f(l);r.push({bindingKey:"consent:tcf.specialFeature",id:String(l),value:d.value,disabled:d.disabled})}}else throw new Error(`[TCF Engine] Cannot apply changes to entity type: ${s}`);let o=this.versionTracker.increment();return{patches:r,version:o}}#h(e){if(!this.#t.includes(e))throw new Error(`[TCF Engine] Purpose ${e} has no consent legal basis`);return{value:this.getPurposeConsent(e),disabled:!1}}#l(e){if(!this.#n.includes(e))throw new Error(`[TCF Engine] Purpose ${e} has no legitimate-interest legal basis`);return{value:this.getPurposeLegitimateInterest(e),disabled:!1}}#C(e){return{value:!0,disabled:!0}}#S(e){return{value:!0,disabled:!0}}#f(e){if(!this.#s.includes(e))throw new Error(`[TCF Engine] Special Feature ${e} was not disclosed`);return{value:this.getSpecialFeatureOptIn(e),disabled:!1}}#g(e){if(!this.#r.includes(e))throw new Error(`[TCF Engine] Vendor ${e} has no consent legal basis`);return{value:this.getVendorConsent(e),disabled:!1}}#y(e){if(!this.#i.includes(e))throw new Error(`[TCF Engine] Vendor ${e} has no legitimate-interest legal basis`);return{value:this.getVendorLegitimateInterest(e),disabled:!1}}#v(e){if(typeof window>"u")throw new Error("[TCF Engine] Stack UI data is unavailable outside the browser");let n=window.__1consent?.getTranslations();if(!n||!("tcf"in n))throw new Error("[TCF Engine] Stack UI data is unavailable");let s=n.tcf?.gvl?.stacks?.[e];if(!s)throw new Error(`[TCF Engine] Unknown stack id: ${e}`);if(s.purposes.length+s.specialFeatures.length<2)throw new Error(`[TCF Engine] Invalid stack membership for id: ${e}`);return{purposes:s.purposes,specialFeatures:s.specialFeatures}}#w(e){let n=this.#v(e),s=n.purposes.filter(a=>this.#t.includes(a)),r=n.specialFeatures.filter(a=>this.#s.includes(a)),o=s.length+r.length>0,i=s.every(a=>this.getPurposeConsent(a)),c=r.every(a=>this.getSpecialFeatureOptIn(a));return{value:o&&i&&c,disabled:!o}}};var di="Your choices for IAB vendors apply only to Purposes and Special Features. You cannot object here to processing for the Special Purposes disclosed by a vendor. Vendors may use Special Features for Special Purpose 1 (ensuring security, preventing and detecting fraud, and fixing errors), regardless of your Special Feature choices.",ui="Ihre Auswahl f\xFCr IAB-Anbieter gilt nur f\xFCr Zwecke und Besondere Funktionen. Der Verarbeitung f\xFCr die von einem Anbieter offengelegten Besonderen Zwecke k\xF6nnen Sie hier nicht widersprechen. Anbieter d\xFCrfen Besondere Funktionen f\xFCr den Besonderen Zweck 1 (Sicherheit gew\xE4hrleisten, Betrug verhindern und erkennen sowie Fehler beheben) unabh\xE4ngig von Ihrer Auswahl zu Besonderen Funktionen verwenden.",Fs="Your choices apply only to this service.",Rs="Ihre Auswahl gilt nur f\xFCr diesen Dienst.",Ms="1Consent stores the TC String in first-party browser local storage (\u201C1consent\u201D) for up to 390 days. With server sync enabled, the \u201C1consent\u201D cookie stores only a compact decision signal until then.",Bs="1Consent speichert den TC String bis zu 390 Tage im lokalen Erstanbieter-Browserspeicher (\u201E1consent\u201C). Bei aktivierter Server-Synchronisierung enth\xE4lt das \u201E1consent\u201C-Cookie bis dahin nur ein kompaktes Entscheidungssignal.",hi="These choices and objections apply only to this service.",fi="Diese Auswahl und Widerspr\xFCche gelten nur f\xFCr diesen Dienst.",pi="1Consent stores your privacy choices and TC String in first-party browser local storage under the key \u201C1consent\u201D for up to 390 days. If this service enables server-readable consent synchronisation, 1Consent also stores a compact first-party decision signal (not the TC String) in a cookie named \u201C1consent\u201D until the same expiry.",gi="1Consent speichert Ihre Datenschutzauswahl und den TC String bis zu 390 Tage lang im lokalen Erstanbieter-Browserspeicher unter dem Schl\xFCssel \u201E1consent\u201C. Falls dieser Dienst die serverlesbare Einwilligungssynchronisierung aktiviert, speichert 1Consent au\xDFerdem bis zum selben Ablaufdatum ein kompaktes Erstanbieter-Entscheidungssignal (nicht den TC String) in einem Cookie namens \u201E1consent\u201C.";function Vs(t){return t==="de"?Rs:Fs}function mi(t){return t==="de"?Bs:Ms}function Si(t){return t.split("-")[0]?.toLowerCase()==="de"?"de":"en"}function Pt(t,e,n){let s=t.toLowerCase();if(n.some(o=>s.includes(o.toLowerCase())))return t;let r=t.trimEnd();return r.length===0?e:`${r} ${e}`}function yi(t){return t==="de"?[Rs,fi]:[Fs,hi]}function wi(t){return t==="de"?[Bs,gi]:[Ms,pi]}function Ci(t,e,n=e){let s=Si(n),r=s==="de"?ui:di,o=yi(s),i=wi(s),c=Pt(t.description,Vs(s),o),a=t.details,l=Pt(Pt(a?.description??"",Vs(s),o),mi(s),i),d=Pt(l,r,[r]);return c===t.description&&a?.description===d?t:{...t,description:c,details:a?{...a,description:d}:{title:t.title,description:d,button:t.button,legalLinks:t.legalLinks}}}var et=class extends M{engine;constructor(e,n){super(e,n),this.engine=new xt(this.bus,this.storage,e),this.attachBlocking(this.engine),this.resolveInitialLocale(this.engine.getStoredLocale())}normalizeTranslations(e,n,s){return Ci(e,n,s)}async init(){if(this.engine.isConsentRequired()){let n=this.ensureViewData("main");await this.ensureViewEngine(),await Promise.all([this.ensureViewLoaded("main"),n])}else await this.showReturningVisitorTrigger(),this.bus.emit({type:"consent:ready"})}async acceptAll(){await this.storage.withExclusiveAccess(()=>{this.engine.acceptAll(),this.engine.save()}),await this.close()}async rejectAll(){await this.storage.withExclusiveAccess(()=>{this.engine.rejectAll(),this.engine.save()}),await this.close()}};var Sn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",tt=class{bits=[];writeBit(e){this.bits.push(e?1:0)}writeInt(e,n){for(let s=n-1;s>=0;s--)this.bits.push(e>>>s&1)}writeBoolean(e){this.writeBit(e)}writeFibonacciRange(e){if(e.length===0){this.writeInt(0,12);return}let n=[],s=e[0],r=s;for(let i=1;i<e.length;i++){let c=e[i];c===r+1||(n.push({start:s,end:r}),s=c),r=c}n.push({start:s,end:r}),this.writeInt(n.length,12);let o=0;for(let i of n)i.start===i.end?(this.writeBit(!1),this.writeFibonacci(i.start-o),o=i.start):(this.writeBit(!0),this.writeFibonacci(i.start-o),this.writeFibonacci(i.end-i.start),o=i.end)}writeFibonacci(e){let n=vi(e),s=new Array(n.length).fill(!1),r=e;for(let i=n.length-1;i>=0&&r>0;i--)n[i]<=r&&(s[i]=!0,r-=n[i]);let o=s.length-1;for(;o>=0&&!s[o];)o--;for(let i=0;i<=o;i++)this.writeBit(s[i]===!0);this.writeBit(!0)}get length(){return this.bits.length}toBase64(){for(;this.bits.length%6!==0;)this.bits.push(0);let e="";for(let n=0;n<this.bits.length;n+=6){let s=this.bits[n]<<5|this.bits[n+1]<<4|this.bits[n+2]<<3|this.bits[n+3]<<2|this.bits[n+4]<<1|this.bits[n+5];e+=Sn[s]}return e}};function vi(t){let e=[1,2];for(;e[e.length-1]<t;)e.push(e[e.length-1]+e[e.length-2]);return e}var b={US_NATIONAL:7,US_CA:8,US_VA:9,US_CO:10,US_CT:12,US_FL:13},yn={CA:b.US_CA,VA:b.US_VA,CO:b.US_CO,CT:b.US_CT,FL:b.US_FL};function Us(t){let e=t.mspaMode??"not_covered",n=e==="service_provider";return{mode:e,sp:n,notice:n?0:1,optOut:s=>n?0:s?1:2,sensitiveInUse:!n&&t.sensitivePIInUse===!0,knownMinor:!n&&t.knownMinor===!0,mspaFields:{MspaCoveredTransaction:e==="not_covered"?2:1,MspaOptOutOptionMode:e==="opt_out"?1:0,MspaServiceProviderMode:n?1:0}}}function $s(t){let{notice:e,optOut:n,sensitiveInUse:s,knownMinor:r,mspaFields:o}=Us(t),i=s?t.limitSensitiveUse===!0?1:2:0;return{Version:1,SharingNotice:e,SaleOptOutNotice:e,SharingOptOutNotice:e,TargetedAdvertisingOptOutNotice:e,SensitiveDataProcessingOptOutNotice:0,SensitiveDataLimitUseNotice:s?1:0,SaleOptOut:n(t.saleOptOut),SharingOptOut:n(t.sharingOptOut),TargetedAdvertisingOptOut:n(t.sharingOptOut),SensitiveDataProcessing:new Array(16).fill(i),KnownChildSensitiveDataConsents:r?[1,1,1]:[0,0,0],PersonalDataConsents:0,...o,Gpc:t.gpcDetected,GpcSegmentType:1,GpcSegmentIncluded:!0}}var Ie=[{name:"MspaCoveredTransaction",bits:2},{name:"MspaOptOutOptionMode",bits:2},{name:"MspaServiceProviderMode",bits:2}],Ae={[b.US_NATIONAL]:{prefix:"usnat",hasGpc:!0,fields:[{name:"Version",bits:6},{name:"SharingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"SharingOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SensitiveDataProcessingOptOutNotice",bits:2},{name:"SensitiveDataLimitUseNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"SharingOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:16},{name:"KnownChildSensitiveDataConsents",array:3},{name:"PersonalDataConsents",bits:2},...Ie]},[b.US_CA]:{prefix:"usca",hasGpc:!0,fields:[{name:"Version",bits:6},{name:"SaleOptOutNotice",bits:2},{name:"SharingOptOutNotice",bits:2},{name:"SensitiveDataLimitUseNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"SharingOptOut",bits:2},{name:"SensitiveDataProcessing",array:9},{name:"KnownChildSensitiveDataConsents",array:2},{name:"PersonalDataConsents",bits:2},...Ie]},[b.US_VA]:{prefix:"usva",hasGpc:!1,fields:[{name:"Version",bits:6},{name:"SharingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:8},{name:"KnownChildSensitiveDataConsents",bits:2},...Ie]},[b.US_CO]:{prefix:"usco",hasGpc:!0,fields:[{name:"Version",bits:6},{name:"SharingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:7},{name:"KnownChildSensitiveDataConsents",bits:2},...Ie]},[b.US_CT]:{prefix:"usct",hasGpc:!0,fields:[{name:"Version",bits:6},{name:"SharingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:8},{name:"KnownChildSensitiveDataConsents",array:3},...Ie]},[b.US_FL]:{prefix:"usfl",hasGpc:!1,fields:[{name:"Version",bits:6},{name:"ProcessingNotice",bits:2},{name:"SaleOptOutNotice",bits:2},{name:"TargetedAdvertisingOptOutNotice",bits:2},{name:"SaleOptOut",bits:2},{name:"TargetedAdvertisingOptOut",bits:2},{name:"SensitiveDataProcessing",array:8},{name:"KnownChildSensitiveDataConsents",array:3},{name:"AdditionalDataProcessingConsent",bits:2},...Ie]}};function Gs(t,e){if(t===b.US_NATIONAL)return{...$s(e)};let{notice:n,optOut:s,sensitiveInUse:r,knownMinor:o,mspaFields:i}=Us(e),c={Gpc:e.gpcDetected,GpcSegmentType:1,GpcSegmentIncluded:!0};if(t===b.US_CA){let u=r?e.limitSensitiveUse===!0?1:2:0;return{Version:1,SaleOptOutNotice:n,SharingOptOutNotice:n,SensitiveDataLimitUseNotice:r?1:0,SaleOptOut:s(e.saleOptOut),SharingOptOut:s(e.sharingOptOut),SensitiveDataProcessing:new Array(9).fill(u),KnownChildSensitiveDataConsents:o?[1,1]:[0,0],PersonalDataConsents:0,...i,...c}}let a=Ae[t];if(!a)throw new Error(`[GPP Encoder] Unsupported section id: ${t}`);let l={Version:1,SharingNotice:n,ProcessingNotice:n,SaleOptOutNotice:n,TargetedAdvertisingOptOutNotice:n,SaleOptOut:s(e.saleOptOut),TargetedAdvertisingOptOut:s(e.sharingOptOut),SensitiveDataProcessing:r?1:0,KnownChildSensitiveDataConsents:o?1:0,AdditionalDataProcessingConsent:0,...i},d={};for(let u of a.fields){let m=l[u.name];if(m===void 0)throw new Error(`[GPP Encoder] No value mapping for field: ${u.name}`);d[u.name]="array"in u?new Array(u.array).fill(m):m}return{...d,...a.hasGpc?c:{}}}var nt=class t{static encode(e,n){let s=[...n].sort((i,c)=>i-c),r=t.encodeHeader(s),o=s.map(i=>t.encodeSection(i,e));return[r,...o].join("~")}static encodeHeader(e){let n=new tt;return n.writeInt(3,6),n.writeInt(1,6),n.writeFibonacciRange(e),n.toBase64()}static encodeSection(e,n){let s=Ae[e];if(!s)return"";let r=Gs(e,n),o=new tt;for(let c of s.fields){let a=r[c.name];if("array"in c){let l=Array.isArray(a)?a:[];for(let d=0;d<c.array;d++){let u=l[d];o.writeInt(typeof u=="number"?u:0,2)}}else o.writeInt(typeof a=="number"?a:0,c.bits)}if(!s.hasGpc)return o.toBase64();let i=new tt;return i.writeInt(1,2),i.writeBoolean(r.Gpc===!0),`${o.toBase64()}.${i.toBase64()}`}};var st=class{bits=[];pos=0;constructor(e){for(let n of e){let s=Sn.indexOf(n);if(s<0)throw new Error(`[GPP Decoder] Invalid base64 character: ${n}`);for(let r=5;r>=0;r--)this.bits.push(s>>>r&1)}}readBit(){let e=this.bits[this.pos];if(e===void 0)throw new Error("[GPP Decoder] Read past end of segment");return this.pos++,e===1}readInt(e){let n=0;for(let s=0;s<e;s++)n=n<<1|(this.readBit()?1:0);return n}readFibonacci(){let e=[],n=!1;for(;;){let i=this.readBit();if(i&&n)break;e.push(i),n=i}let s=0,r=1,o=2;for(let i of e)i&&(s+=r),[r,o]=[o,r+o];return s}readFibonacciRange(){let e=this.readInt(12),n=[],s=0;for(let r=0;r<e;r++){let o=this.readBit(),i=this.readFibonacci()+s;if(o){let c=this.readFibonacci()+i;for(let a=i;a<=c;a++)n.push(a);s=c}else n.push(i),s=i}return n}},rt=class t{static decode(e){let n=e.split("~"),s=n[0];if(!s)throw new Error("[GPP Decoder] Empty GPP string");let r=t.decodeHeader(s);if(r.length!==n.length-1)throw new Error(`[GPP Decoder] Header lists ${r.length} section(s) but ${n.length-1} present`);for(let o=0;o<r.length;o++){let i=r[o],c=n[o+1];if(i!==void 0&&c!==void 0&&Ae[i])return{sectionIds:r,data:t.decodeSection(i,c)}}throw new Error("[GPP Decoder] No supported US section present")}static decodeHeader(e){let n=new st(e),s=n.readInt(6);if(s!==3)throw new Error(`[GPP Decoder] Not a GPP header (type ${s})`);let r=n.readInt(6);if(r!==1)throw new Error(`[GPP Decoder] Unsupported GPP version ${r}`);return n.readFibonacciRange()}static decodeSection(e,n){let s=Ae[e];if(!s)throw new Error(`[GPP Decoder] Unsupported section id ${e}`);let[r,o]=n.split(".");if(!r)throw new Error("[GPP Decoder] Missing core subsection");let i=new st(r),c={};for(let h of s.fields)if("array"in h){let y=[];for(let v=0;v<h.array;v++)y.push(i.readInt(2));c[h.name]=y}else c[h.name]=i.readInt(h.bits);if(c.Version!==1)throw new Error(`[GPP Decoder] Unsupported ${s.prefix} version ${String(c.Version)}`);let l=c.SaleOptOut===1,u=(c.SharingOptOut??c.TargetedAdvertisingOptOut)===1,m=!1;if(e===b.US_NATIONAL||e===b.US_CA){let h=c.SensitiveDataProcessing;m=Array.isArray(h)&&h.some(y=>y===1)}let g=!1;if(s.hasGpc&&o){let h=new st(o);h.readInt(2)===1&&(g=h.readBit())}return{saleOptOut:l,sharingOptOut:u,gpcDetected:g,limitSensitiveUse:m}}};function Oe(){return{optedOutOfSale:!1,optedOutOfShare:!1,limitSensitiveUse:!1,gpcDetected:!1,timestamp:0,lastOptOutAt:0}}var Ei=365*24*60*60*1e3;function bi(){return Re()}function js(){if(typeof globalThis>"u")return;let t=globalThis.__1C_GEO;if(t?.country!=="US"||typeof t.region!="string")return;let e=t.region.toUpperCase();return/^[A-Z]{2}$/.test(e)?e:void 0}function Ti(){if(typeof globalThis>"u")return;let t=globalThis.__1C_GEO;return typeof t?.sensitiveOptIn=="boolean"?t.sensitiveOptIn:void 0}var Dt=class extends W{#e=Oe();#t;#n;#s;#r;#i;#c;#o=!1;#a=!1;#d;constructor(e,n,s){super(e,n,s),this.#t=bi(),this.#i=js(),this.#d=Ti();let r=s.us;this.#n=r?.mspaMode??"not_covered",this.#s=r?.sensitivePIInUse===!0,this.#r=r?.minorsPosture==="known_minors",this.#c=r?.denyAll===!0,this.#h();try{this.syncFastPath()}catch{}this.mergeConsentDowngradeBaseline(this.getConsentDowngradeSnapshot())}bootSyncsFastPath(){return!1}reloadExternalConsentState(e=!1){let n=this.state.hasConsent||this.storage.getConsent()!==void 0||this.storage.getFastPath()!==void 0,s=this.#p();if(super.reloadExternalConsentState(e),!e&&n&&!s){this.#u();return}this.#h(),e&&(this.#a=!1)}#p(){let e=this.storage.getConsent();if(!e)return!1;try{T.decodeForConfig(e.consent,this.config)}catch{return!1}if(e.gppString)try{return rt.decode(e.gppString),!0}catch{}return typeof e.uspString=="string"&&/^1[YN-][YN-][YN-]$/.test(e.uspString)}#u(){(this.storage.getConsent()||this.storage.getFastPath())&&this.invalidateStoredConsent(),this.#e={...Oe(),optedOutOfSale:!0,optedOutOfShare:!0,gpcDetected:this.#t},this.#o=!1}#h(){this.#e=this.#C(),this.#o=this.validatedStoredDecision!==void 0&&(this.#e.optedOutOfSale||this.#e.optedOutOfShare)&&!this.#r,this.#t&&(this.#e.gpcDetected=!0),this.#l()&&(this.#e.optedOutOfSale=!0,this.#e.optedOutOfShare=!0)}#l(){return this.#t||this.#r}#C(){let e=this.storage.getConsentSnapshot()??this.storage.getLatestConsentSnapshot(),n=e?.content;if(this.validatedStoredDecision=void 0,n){let s=0;try{let r=e?.prior?T.decode(n.consent):T.decodeForConfig(n.consent,this.config);if(r.configId!==this.config.appId||r.framework!=="us")throw new Error("US decision belongs to a different application or framework.");let o=r.timestamp*1e3;Number.isSafeInteger(o)&&o>0&&(s=o)}catch(r){return console.warn("[US Engine] Stored consent timestamp invalid; fastpath stays cold:",r),this.#S()}if(n.gppString)try{let{data:r}=rt.decode(n.gppString);this.validatedStoredDecision=e;let o=r.saleOptOut||r.sharingOptOut;return{optedOutOfSale:r.saleOptOut,optedOutOfShare:r.sharingOptOut,limitSensitiveUse:this.#s&&(n.limitSensitiveUse??r.limitSensitiveUse)===!0,gpcDetected:!1,timestamp:s,lastOptOutAt:o?s:0}}catch(r){console.warn("[US Engine] Stored GPP string invalid, trying uspString:",r)}if(typeof n.uspString=="string"&&/^1[YN-][YN-][YN-]$/.test(n.uspString)){let r=n.uspString.charAt(2)==="Y";return this.validatedStoredDecision=e,{optedOutOfSale:r,optedOutOfShare:r,limitSensitiveUse:!1,gpcDetected:!1,timestamp:s,lastOptOutAt:r?s:0}}return this.#S()}return{...Oe(),timestamp:Date.now()}}#S(){return this.invalidateStoredConsent(),{...Oe(),optedOutOfSale:!0,optedOutOfShare:!0}}getFrameworkPrefix(){return"us"}acceptAll(){console.log("[US Engine] acceptAll()"),this.#l()||(this.#e.optedOutOfSale=!1,this.#e.optedOutOfShare=!1,this.#e.limitSensitiveUse=!1),super.acceptAll(),this.#e.timestamp=Date.now()}setCategoryConsent(e,n){this.#a=!0,super.setCategoryConsent(e,n)}setServiceConsent(e,n){this.#a=!0,super.setServiceConsent(e,n)}setConsent(e){this.#a=!0,super.setConsent(e)}save(){if(!this.state.hasConsent&&!this.#a){for(let e of this.config.categories)this.state.categories[e.id]=!0;for(let e of this.config.services)this.state.services[e.id]=!0}super.save(),this.#a=!1}getEvidenceConsentDecision(){let e=this.#m();return{...super.getEvidenceConsentDecision(),categoryProjection:te(this.config.categories.filter(n=>!n.essential).map(n=>this.state.categories[n.id]===!0)),framework:te([!e.optedOutOfSale,!e.optedOutOfShare,...this.#s?[!e.limitSensitiveUse]:[]])}}rejectAll(){console.log("[US Engine] rejectAll()"),super.rejectAll(),this.#e.optedOutOfSale=!0,this.#e.optedOutOfShare=!0,this.#s&&(this.#e.limitSensitiveUse=!0),this.#f()}#f(){let e=Date.now();this.#e.timestamp=e,this.#e.lastOptOutAt=e}isWithinReconsentWindow(){let{lastOptOutAt:e}=this.#m();return e>0&&Date.now()-e<Ei}getOptOutOfSale(){return this.#m().optedOutOfSale}setOptOutOfSale(e){if(!e&&this.#l()){console.warn("[US Engine] Cannot opt back in to sale \u2014 opt-out is locked");return}console.log(`[US Engine] setOptOutOfSale(${e})`),this.#e.optedOutOfSale=e,e?this.#f():this.#e.timestamp=Date.now(),this.emit("consent:changed")}getOptOutOfShare(){return this.#m().optedOutOfShare}setOptOutOfShare(e){if(!e&&this.#l()){console.warn("[US Engine] Cannot opt back in to sharing \u2014 opt-out is locked");return}console.log(`[US Engine] setOptOutOfShare(${e})`),this.#e.optedOutOfShare=e,e?this.#f():this.#e.timestamp=Date.now(),this.emit("consent:changed")}setOptOutOfSaleAndShare(e){if(!e&&this.#l()){console.warn("[US Engine] Cannot opt back in to sale/sharing \u2014 opt-out is locked");return}console.log(`[US Engine] setOptOutOfSaleAndShare(${e})`),this.#e.optedOutOfSale=e,this.#e.optedOutOfShare=e,e?this.#f():this.#e.timestamp=Date.now(),this.emit("consent:changed")}getLimitSensitiveUse(){return this.#e.limitSensitiveUse}getSensitivePIInUse(){return this.#s}setLimitSensitiveUse(e){if(!this.#s){console.warn("[US Engine] setLimitSensitiveUse ignored \u2014 sensitive PI not in use");return}console.log(`[US Engine] setLimitSensitiveUse(${e})`),this.#e.limitSensitiveUse=e,e?this.#f():this.#e.timestamp=Date.now(),this.emit("consent:changed")}isGpcDetected(){return this.#t}getUsPrivacyState(){return{...this.#e}}getFastPathConsentMap(){return this.#g().map}#g(){let e=this.#m(),n=this.state.hasConsent&&this.hasValidConsent(),s=this.#s&&e.limitSensitiveUse,r=n||this.#o||this.#t||e.limitSensitiveUse,i=(n?this.getConsentTimestamp():null)??(this.#o||e.limitSensitiveUse?e.timestamp:0);return e.optedOutOfSale||e.optedOutOfShare||this.#l()?{map:this.#w(),decided:r,posture:!r,decisionTimestamp:i}:s?{map:this.#v(n?super.getFastPathConsentMap():this.#E()),decided:r,posture:!r,decisionTimestamp:i}:n?{map:super.getFastPathConsentMap(),decided:!0,posture:!1,decisionTimestamp:i}:this.#c?{map:this.#w(),decided:r,posture:!r,decisionTimestamp:i}:this.#s&&(this.#d??Ft(this.#i))?{map:this.#v(this.#E()),decided:r,posture:!r,decisionTimestamp:i}:{map:this.#E(),decided:r,posture:!r,decisionTimestamp:i}}#y(){let e=this.config.services.filter(r=>r.usSensitive===!0&&r.essential!==!0);if(e.length===0)return;let n={};for(let r of e)n[r.id]=!1;let s=new Set(e.map(r=>r.categoryId).filter(r=>r!==void 0));return this.config.categories.forEach(r=>{s.has(r.id)&&r.essential!==!0&&(n[r.id]=!1)}),n}#v(e){let n=this.#y();return n?{...e,...n}:this.#w()}#w(){return{...this.getDefaultCategoryConsents(),...this.getDefaultServiceConsents()}}#E(){let e={};return this.config.categories.forEach(n=>{e[n.id]=!0}),this.config.services.forEach(n=>{e[n.id]=!0}),e}syncFastPath(e){let n=this.#g(),s=n.decided&&n.decisionTimestamp>0;We(this.config,n.map,{gpcRevocable:!0,posture:n.posture,decisionTimestamp:n.decisionTimestamp,cookieMode:s?"decision":"clear"},e??(r=>this.storage.refreshFastPath(r,this.validatedStoredDecision)))}buildConsentEntry(e){return{consent:e,uspString:this.getUsPrivacyString(),gppString:this.getGppString(),limitSensitiveUse:this.#e?.limitSensitiveUse===!0}}#m(){return this.externalReconciliationPending?{...Oe(),optedOutOfSale:!0,optedOutOfShare:!0,limitSensitiveUse:!0}:this.#e??Oe()}getApplicableGppSections(){let n=xe(this.config)&&this.config.us?.stateGeo===!0?js():void 0;return[(n?yn[n]:void 0)??b.US_NATIONAL]}getUsNationalSectionData(){let e=this.#m();return{saleOptOut:e.optedOutOfSale,sharingOptOut:e.optedOutOfShare,gpcDetected:e.gpcDetected,mspaMode:this.#n,sensitivePIInUse:this.#s,limitSensitiveUse:e.limitSensitiveUse,knownMinor:this.#r}}getGppString(){return nt.encode(this.getUsNationalSectionData(),this.getApplicableGppSections())}resolve(e){let n=k(e.bindingKey);if(n?.framework!=="us")throw new Error(`[US Engine] Invalid binding key: ${e.bindingKey}`);let{entity:s}=n;switch(s){case"sale":return this.#b();case"share":return this.#T();case"saleAndShare":return this.#I();case"limitSensitiveUse":return this.#A();default:throw new Error(`[US Engine] Unknown entity type: ${s}`)}}resolveMany(e){let n=[];for(let s of e)try{let r=this.resolve(s);n.push({bindingKey:s.bindingKey,value:r.value,disabled:r.disabled})}catch(r){console.error("[US Engine] Failed to resolve binding:",s,r)}return{patches:n,version:this.versionTracker.getVersion()}}apply(e){let n=k(e.ref.bindingKey);if(n?.framework!=="us")throw new Error(`[US Engine] Invalid binding key: ${e.ref.bindingKey}`);let{entity:s}=n,r=[];if(s==="sale"){this.setOptOutOfSale(e.value);let i=this.#b();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled})}else if(s==="share"){this.setOptOutOfShare(e.value);let i=this.#T();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled})}else if(s==="limitSensitiveUse"){this.setLimitSensitiveUse(e.value);let i=this.#A();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled})}else if(s==="saleAndShare"){this.setOptOutOfSaleAndShare(e.value);let i=this.#I();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled});let c=this.#b();r.push({bindingKey:"consent:us.sale",value:c.value,disabled:c.disabled});let a=this.#T();r.push({bindingKey:"consent:us.share",value:a.value,disabled:a.disabled})}else throw new Error(`[US Engine] Unknown entity type: ${s}`);let o=this.versionTracker.increment();return{patches:r,version:o}}#b(){return{value:this.#e.optedOutOfSale,disabled:this.#l()}}#T(){return{value:this.#e.optedOutOfShare,disabled:this.#l()}}#I(){return{value:this.#e.optedOutOfSale&&this.#e.optedOutOfShare,disabled:this.#l()}}#A(){return{value:this.#e.limitSensitiveUse,disabled:!this.#s}}getUsPrivacyString(){return`1Y${this.#m().optedOutOfSale?"Y":"N"}-`}};var it=class extends M{engine;constructor(e,n){super(e,n),this.engine=new Dt(this.bus,this.storage,e),this.attachBlocking(this.engine),this.resolveInitialLocale(this.engine.getStoredLocale())}async init(){this.bus.emit({type:"consent:ready"});let e=!this.engine.isGpcDetected()&&this.engine.isConsentRequired();if(e&&this.config.cmp.main){let n=this.ensureViewData("main");await this.ensureViewEngine(),await Promise.all([this.ensureViewLoaded("main"),n])}else e||await this.showReturningVisitorTrigger()}async acceptAll(){await this.storage.withExclusiveAccess(()=>{this.engine.acceptAll(),this.engine.save()}),await this.close()}async rejectAll(){await this.storage.withExclusiveAccess(()=>{this.engine.rejectAll(),this.engine.save()}),await this.close()}};var wn=window.__1CONSENT_CONFIG__;if(ce(wn)){let t=wn,e=new qe;mt(t).then(async n=>{let s=await n.withExclusiveAccess(()=>Mt(t)?new Je(t,{bus:e,storage:n}):Bt(t)?new et(t,{bus:e,storage:n}):xe(t)?new it(t,{bus:e,storage:n}):null);if(!s)throw new Error("[Design Kit] Unsupported CMP framework config.");let r=tn(s),o=new Os(e,s.engine,()=>s.getTranslations(),()=>s.openDetails(),i=>s.ensureViewData(i),i=>s.hasViewData(i),i=>s.setLanguage(i),()=>s.getThemeMode());window.__1consent=r,s.setViewEngine(o),s.init().catch(i=>console.error("[Design Kit] Controller init failed",i))}).catch(n=>console.error("[Design Kit] Runtime initialization failed",n))}else wn!==void 0&&console.error("[Design Kit] Refusing to initialize an invalid CMP runtime config.");