@1consent/cli 0.1.0-beta.1 → 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 K(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 K(t.v,e)}}function ft(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 nn(t){return t==null||t===!1||t===0||t===""?!1:Array.isArray(t)?t.length>0:!0}function H(t,e,n,s,r,o){switch(t.t){case"text":r.appendChild(document.createTextNode(t.v));break;case"bind":{let i=K(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)H(i,o.scope,n,s,r);break;case"each":{let i=K(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)H(d,a,n,s,l,o);r.appendChild(l)}break}case"if":if(nn(K(t.path,e))){let i=document.createDocumentFragment();for(let c of t.body)H(c,e,n,s,i,o);r.appendChild(i)}break;case"if-not":if(!nn(K(t.path,e))){let i=document.createDocumentFragment();for(let c of t.body)H(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[p,m]of Object.entries(t.props))c[p]=us(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 p of i)H(p,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")ft(i,a.name,a.value);else if(a.k==="bind"){let l=K(a.value,e);ft(i,a.name,l)}else if(a.k==="concat"){let l=a.parts.map(d=>d.k==="str"?d.v:String(K(d.v,e)??"")).join("");ft(i,a.name,l)}let c=document.createDocumentFragment();for(let a of t.kids)H(a,e,n,s,c,o);i.appendChild(c),r.appendChild(i);break}}}function ps(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)H(i,e,t.components,n,s);return s}function gt(t,e,n,s={}){let r=ps(t,e,s);n.innerHTML="",n.appendChild(r)}function Se(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 sn=["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"],Nr=new Set(sn),Rr=sn.filter(t=>t.includes("-")).sort((t,e)=>e.length-t.length);function hs(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 mt(t){return typeof t=="string"&&hs(t)===t}function fs(t){return t.split("-")[0]||"en"}function rn(t){let e=fs(t).toLowerCase();return/^[a-z]{2}$/.test(e)?e:null}var gs=1440*60*1e3;var St="reload";var z=5;var on=["VA","CO","CT","MT","TX","OR","DE","NH","NJ","MN","NE","MD","TN","FL","IN","KY","RI"];function yt(t){return t===void 0?!0:on.indexOf(t.toUpperCase())!==-1}function ye(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function te(t){if(!ye(t))return!1;let e=t;return!(!(typeof e.appId=="string"&&typeof e.version=="number"&&typeof e.machine=="string"&&ye(e.languages)&&typeof e.languages.primary=="string"&&Array.isArray(e.languages.supported)&&e.languages.supported.length>0&&mt(e.languages.primary)&&e.languages.supported.every(mt)&&new Set(e.languages.supported).size===e.languages.supported.length&&e.languages.supported.includes(e.languages.primary)&&ye(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 wt(t){return t.cmp.trigger?t.framework.type==="us"?!0:!!t.appearance?.trigger:!1}function Ct(t){return te(t)&&t.framework.type==="gdpr"}function vt(t){if(!te(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(!ye(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 we(t){return te(t)&&t.framework.type==="us"}var se="1consent",Et=1;function N(t){return{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:z}:{},primaryLanguage:t.languages.primary}}function ne(){return{schemaVersion:Et,apps:{}}}function je(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function an(t){return je(t)&&t.schemaVersion===Et&&je(t.apps)}function Ke(t){if(!t)return ne();try{let e=JSON.parse(t);return an(e)?e:ne()}catch{return ne()}}function bt(t){return je(t)?Object.values(t).every(e=>typeof e=="boolean"):!1}function He(t){return je(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&&bt(t.services)&&bt(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 It(t,e=Date.now()){return He(t)?Se(t.expiresAt,e):!1}var Tt=["center-center","bottom-left","bottom-right","bottom-center"],cn=[...Tt,"panel-right"],ln=["left","center"],dn=["accept-first","reject-first"],un=["left","right","center","full"],pn=["equal","emphasize-accept"];var Kr=new Set(Tt),Hr=new Set(cn);var zr=new Set(ln),qr=new Set(dn),Wr=new Set(un),Yr=new Set(pn);function At(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")}var ie="1consent";var Ce=["data-1c-service","data-1c-service-tag","data-1c-tag"],ve="data-1c-category",Pt="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 R(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 re(t,e,n){t[e]=e in t?t[e]===!0&&n:n}function be(t,e,n,s){let r=gn(t,e,n,s);return{services:r.services,categories:r.categories}}function gn(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),re(r,a.id,l),a.catalogServiceKey&&re(r,a.catalogServiceKey,l),a.tag&&re(r,a.tag,l),a.name&&re(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,p=a.essential===!0||s[a.id]===!0||d;p&&a.essential!==!0&&s[a.id]===!0&&(i=!0),re(c,a.id,p),re(c,a.name,p)}return{services:r,categories:c,nonEssentialGranted:i}}function _t(t,e,n,s,r){let o=gn(t,e,n,s),i=r?.decisionTimestamp,c=i!==void 0&&Number.isSafeInteger(i)&&i>0?i+33696e6:0,a={v:R(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 Ee(){return typeof navigator>"u"?!1:navigator.globalPrivacyControl===!0}var Dt=2;function mn(t){return t==="A"||t==="D"||t==="G"}var Ss=/^[A-Za-z0-9_-]+$/,ys=/^[a-z0-9]+$/;function Ot(t){return t.length>0&&Ss.test(t)}function ws(t){return t.length>0&&ys.test(t)}function Cs(t){return t==="gdpr"||t==="tcf"||t==="us"}function vs(t){return t==="P"||t==="S"||t==="D"}function Sn(t){return mn(t.decision)&&typeof t.appId=="string"&&Ot(t.appId)&&typeof t.frameworkId=="string"&&Ot(t.frameworkId)&&Cs(t.frameworkType)&&vs(t.machine)&&typeof t.primaryLanguage=="string"&&Ot(t.primaryLanguage)&&typeof t.structuralVersion=="string"&&ws(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 hn(t){if(!/^(0|[1-9]\d*)$/.test(t))return null;let e=Number(t);return Number.isSafeInteger(e)&&String(e)===t?e:null}function Lt(t){if(!Sn(t))throw new TypeError(ie);return[Dt,t.decision,t.appId,t.frameworkId,t.frameworkType,t.machine,t.primaryLanguage,t.structuralVersion,t.consentEpoch,t.expiresAt].join(".")}function xt(t){if(!t)return null;let e=t.split(".");if(e.length!==10||e[0]!==String(Dt))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 p=hn(l),m=hn(d),y={decision:n,appId:s,frameworkId:r,frameworkType:o,machine:i,primaryLanguage:c,structuralVersion:a,consentEpoch:p,expiresAt:m};return Sn(y)?y:null}function M(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function q(t,e){return M(t)&&Object.entries(t).every(([n,s])=>/^[1-9]\d*$/.test(n)&&s===!0&&(typeof e=="number"?+n<=e:e[n]===!0))}function bs(t){return M(t)&&Object.entries(t).every(([e,n])=>/^(1[01]|[1-9])$/.test(e)&&M(n)&&Object.entries(n).every(([s,r])=>/^[1-9]\d*$/.test(s)&&+s<=65535&&(r===0||r===1||r===2)))}function yn(t){if(!M(t)||!M(t.purpose)||!M(t.vendor))return!1;let e=t.publisher;return!M(e)||!M(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)&&q(t.purpose.consents,11)&&q(t.purpose.legitimateInterests,11)&&Object.keys(t.purpose.legitimateInterests).every(n=>/^(2|[789]|1[01])$/.test(n))&&q(t.vendor.disclosedVendors,65535)&&q(t.vendor.consents,t.vendor.disclosedVendors)&&q(t.vendor.legitimateInterests,t.vendor.disclosedVendors)&&q(t.specialFeatureOptins,2)&&[e.consents,e.legitimateInterests,e.customPurpose.consents,e.customPurpose.legitimateInterests].every(n=>q(n,0))&&bs(e.restrictions)}function wn(t,e){return`${t}\0${JSON.stringify(e)}`}var Ie=4095,Cn=1,vn=10;function ze(t){return[...new Set(t)].sort((e,n)=>e-n).join(",")}var qe=class{config;framework;sampled;hadStoredConsent;buffer=[];impressionAt=null;decisionQueued=!1;pendingAction="granular";reportedCodes=new Set;abStamp;constructor(e,n,s,r){this.config=e,this.framework=r,this.sampled=Math.random()<e.sampleRate,this.hadStoredConsent=s.getConsentId()!==void 0;let o=typeof window<"u"?window.__1C_AB:void 0;if(this.abStamp=o?{abTestId:o.testId,abVariant:o.variant}:void 0,typeof document>"u"||(n.on("monitoring:error",c=>this.trackMonitoring(c.payload.code)),!this.sampled))return;n.on("view:transition",c=>{c.payload.to!=="none"&&this.trackImpression()}),n.on("view:change",c=>{c.payload.view!=="none"&&this.trackImpression()}),n.on("consent:accepted-all",()=>{this.pendingAction="accept_all"}),n.on("consent:rejected-all",()=>{this.pendingAction="deny_all"}),n.on("consent:rejected",()=>{this.pendingAction="deny_all"}),n.on("consent:saved",()=>this.trackDecision());let i=()=>{document.visibilityState==="hidden"&&this.flush()};document.addEventListener("visibilitychange",i),window.addEventListener("pagehide",()=>this.flush())}trackImpression(){if(this.impressionAt!==null)return;let e=Date.now();this.impressionAt=e,this.buffer.push({type:"impression",ts:e,hasConsentStored:this.hadStoredConsent,framework:this.framework,...this.abStamp})}trackDecision(){if(this.impressionAt===null||this.decisionQueued)return;this.decisionQueued=!0;let e=Date.now();this.buffer.push({type:"decision",ts:e,hasConsentStored:this.hadStoredConsent,framework:this.framework,action:this.pendingAction,tToConsentMs:e-this.impressionAt,...this.abStamp}),this.flush()}trackMonitoring(e){this.reportedCodes.has(e)||(this.reportedCodes.add(e),this.buffer.push({type:"monitoring",ts:Date.now(),hasConsentStored:this.hadStoredConsent,framework:this.framework,code:e,...this.abStamp}),this.flush())}flush(){if(this.buffer.length===0)return;let e=JSON.stringify({id:crypto.randomUUID(),token:this.config.token,events:this.buffer});this.buffer=[];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 D(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 Vt(t){return D(t)!==null}var Te=class{version=0;getVersion(){return this.version}increment(){return++this.version}reset(){this.version=0}};function B(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 Ae(t,e){if(!It(e)||e.consentEpoch<(t.consentEpoch??0)||e.structuralVersion!==R(t.services,t.categories))return;if(e.gpcRevocable&&Ee())return B(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 oe(t,e){for(let n of Object.keys(t))if(t[n]===!0&&e[n]!==!0)return!0;return!1}function ae(t){return t.consentDowngradeBehavior??St}function bn(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 Is(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=bn(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 p,m=5;if(a==="G"){let h=s[5];if(!h)throw new Error("Invalid consent string: missing granular payload");let f=h[0],E=h.slice(1);if(f!=="a"&&f!=="d"||!Is(E))throw new Error("Invalid consent string: malformed granular payload");p={mode:f,bits:E},m=6}let y=s[m],u=s[m+1];if(!y||!u)throw new Error("Invalid consent string: missing language or timestamp");let S=bn(u,"timestamp"),C=Math.floor(Date.now()/1e3),g=n.maxFutureSkewSeconds??0;if(S<=0||!Number.isSafeInteger(C)||C<0||!Number.isSafeInteger(g)||g<0||S>C+g)throw new Error("Invalid consent string: timestamp is not a past positive instant");let b={machine:r,configId:o,version:l,framework:c,state:a,...p?{payload:p}:{},language:y,timestamp:S};if(t.encode(b)!==e)throw new Error("Invalid consent string: noncanonical encoding");return b}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 kt=class{isAvailable;memoryStorage=new Map;persistenceFailureListeners=[];persistenceFailureNotified=!1;constructor(){this.isAvailable=this.checkAvailability()}checkAvailability(){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.isAvailable)try{return localStorage.getItem(e)}catch{this.isAvailable=!1}return this.memoryStorage.get(e)??null}setItem(e,n){if(this.isAvailable)try{localStorage.setItem(e,n);return}catch{this.isAvailable=!1}this.memoryStorage.set(e,n),this.notifyPersistenceFailure()}onPersistenceFailure(e){this.persistenceFailureListeners.push(e),this.persistenceFailureNotified&&e()}notifyPersistenceFailure(){if(!this.persistenceFailureNotified){this.persistenceFailureNotified=!0;for(let e of this.persistenceFailureListeners)e()}}removeItem(e){if(this.isAvailable)try{localStorage.removeItem(e)}catch{this.isAvailable=!1}this.memoryStorage.delete(e)}isLocalStorageAvailable(){return this.isAvailable}},ce=new kt;var X=class{read(){return ce.getItem(se)}write(e){ce.setItem(se,e)}remove(){ce.removeItem(se)}};function W(){return Math.floor(Date.now()/1e3)}function le(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function In(t){return le(t)&&typeof t.updatedAt=="number"&&le(t.frameworks)&&(t.consentId===void 0||typeof t.consentId=="string")}function We(t){return le(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"}function Y(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 de(t,e){let s=Ke(t).apps[e.appId];if(!In(s))return;let r=s.frameworks[e.frameworkId];return We(r)&&Y(r,e)?r:void 0}function En(t){let e={consent:t.value,firstSeenAt:t.firstSeenAt,lastSeenAt:t.lastSeenAt,...t.tcString===void 0?{}:{tcString:t.tcString},...t.uspString===void 0?{}:{uspString:t.uspString},...t.gppString===void 0?{}:{gppString:t.gppString},...t.limitSensitiveUse===void 0?{}:{limitSensitiveUse:t.limitSensitiveUse}};return Tn(e)?e:void 0}function Ts(t){return{value:t.consent,firstSeenAt:t.firstSeenAt,lastSeenAt:t.lastSeenAt,...t.tcString===void 0?{}:{tcString:t.tcString},...t.uspString===void 0?{}:{uspString:t.uspString},...t.gppString===void 0?{}:{gppString:t.gppString},...!("limitSensitiveUse"in t)||t.limitSensitiveUse===void 0?{}:{limitSensitiveUse:t.limitSensitiveUse}}}var J=class{storage;scope;MAX_PENDING=10;constructor(e,n){this.storage=e,this.scope=n}getScope(){return this.scope}readStore(){try{return Ke(this.storage.read())}catch{return ne()}}writeStore(e){this.storage.write(JSON.stringify(e))}mutate(e){let n=this.readStore();e(n),this.writeStore(n)}readApp(e){let n=e.apps[this.scope.appId];return In(n)?n:void 0}readFramework(e){let n=this.readApp(e)?.frameworks[this.scope.frameworkId];return We(n)&&n.type===this.scope.type?n:void 0}ensureApp(e,n){let s=this.readApp(e);if(s)return s.updatedAt=n,s;let r={updatedAt:n,frameworks:{}};return e.apps[this.scope.appId]=r,r}ensureFramework(e,n){let s=this.ensureApp(e,n),r=s.frameworks[this.scope.frameworkId];if(We(r)&&Y(r,this.scope))return r.updatedAt=n,r;let o={type:this.scope.type,machine:this.scope.machine,configVersion:this.scope.configVersion,consentEpoch:this.scope.consentEpoch,tcfPolicyVersion:this.scope.tcfPolicyVersion,primaryLanguage:this.scope.primaryLanguage,updatedAt:n};return We(r)&&(r.type===this.scope.type&&(o.prior=r.consent??r.prior),r.outbox&&(o.outbox=r.outbox)),s.frameworks[this.scope.frameworkId]=o,o}getConsent(){let e=this.readFramework(this.readStore());if(!(!e?.consent||!Y(e,this.scope)))return En(e.consent)}getLatestConsent(){let e=this.readFramework(this.readStore()),n=e?.consent??e?.prior;return n?En(n):void 0}getContents(){let e=this.getConsent();return e?[e]:[]}getConsentId(){return this.readApp(this.readStore())?.consentId}setConsentId(e){let n=W();this.mutate(s=>{this.ensureApp(s,n).consentId=e})}updateConsent(e,n){if(!this.readApp(this.readStore())?.consentId)throw new Error("[OneConsentStorage] Cannot store consent without consentId. Call setConsentId() first.");let r=W(),o={...e,firstSeenAt:r,lastSeenAt:r};Tn(o)&&this.mutate(i=>{let c=this.ensureFramework(i,r),a=c.consent;c.machine=this.scope.machine,c.configVersion=this.scope.configVersion,c.consentEpoch=this.scope.consentEpoch,this.scope.tcfPolicyVersion===void 0?delete c.tcfPolicyVersion:c.tcfPolicyVersion=this.scope.tcfPolicyVersion,c.primaryLanguage=this.scope.primaryLanguage,c.consent=Ts({...o,firstSeenAt:a?.firstSeenAt??r,lastSeenAt:r}),n&&(c.fastPath=n),delete c.prior})}setFastPath(e){let n=W();this.mutate(s=>{this.ensureFramework(s,n).fastPath=e})}getFastPath(){let e=this.readFramework(this.readStore());if(e&&Y(e,this.scope)&&He(e.fastPath))return e.fastPath}removeFastPath(){let e=W();this.mutate(n=>{let s=this.readFramework(n);!s||!Y(s,this.scope)||(delete s.fastPath,s.updatedAt=e,this.ensureApp(n,e))})}invalidateConsent(){let e=W();this.mutate(n=>{let s=this.readFramework(n);!s||!Y(s,this.scope)||(delete s.consent,delete s.fastPath,s.updatedAt=e,this.ensureApp(n,e))})}removeAll(){this.mutate(e=>{let n=this.readApp(e),s=this.readFramework(e);!n||!s||!Y(s,this.scope)||(delete n.frameworks[this.scope.frameworkId],n.updatedAt=W(),Object.keys(n.frameworks).length===0&&!n.experiment&&delete e.apps[this.scope.appId])})}getPendingEvents(){let e=this.readFramework(this.readStore())?.outbox?.consentEvents;return Array.isArray(e)?e.filter(As):[]}queuePendingEvent(e){let n=this.getPendingEvents().filter(r=>r.eventId!==e.eventId);n.push(e),n.length>this.MAX_PENDING&&console.warn(`[OneConsentStorage] Event queue full \u2014 dropping ${n.length-this.MAX_PENDING} oldest`);let s=W();this.mutate(r=>{this.ensureFramework(r,s).outbox={consentEvents:n.slice(-this.MAX_PENDING)}})}removePendingEvent(e){let n=this.getPendingEvents().filter(s=>s.eventId!==e);this.mutate(s=>{let r=this.readFramework(s);r&&(n.length?r.outbox={consentEvents:n}:delete r.outbox)})}};function As(t){return le(t)&&typeof t.url=="string"&&typeof t.eventId=="string"&&le(t.payload)}function Tn(t){return!le(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 An(t,e){let n=de(e,N(t));return Ae(t,n?.fastPath)}function Ft(t,e){let n=de(e,N(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}`}return JSON.stringify([r,s.tcString,s.uspString,s.gppString,s.limitSensitiveUse])}var Oe=class{bus;storage;config;constructor(e,n,s){this.bus=e,this.storage=n,this.config=s}getConfig(){return this.config}getDisplayLocale(){return this.config.languages.primary}getExternalConsentSnapshot(e){return An(this.config,e)}getCurrentExternalConsentSnapshot(){let e=this.getEnforcementConsentState();if(e.hasConsent)return B(this.config,{...e.categories,...e.services})}shouldReloadForExternalConsentChange(e,n){if(ae(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 oe(s,r)}hasExternalConsentChange(e,n){return e!==null||n!==null?Ft(this.config,e)!==Ft(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 Ye(t){if(typeof window>"u")return;let e=window.__1CONSENT_REACT_FASTPATH__;if(e)try{return 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!==R(t.services,t.categories)?void 0:e.reconcile()?e:void 0}catch{return}}function Os(){let t=globalThis;return typeof t.scheduler=="object"?t.scheduler:void 0}function Xe(t){let e=Os();if(e?.postTask)try{e.postTask(t,{priority:"user-visible"});return}catch{}setTimeout(t,0)}function On(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 Ps=[...Ce,ve].map(t=>`template[${t}]:not([${Pt}])`).join(",");function _s(){return document.readyState==="loading"?new Promise(t=>document.addEventListener("DOMContentLoaded",()=>t(),{once:!0})):Promise.resolve()}var Je=class{config;constructor(e){this.config=e}async unblockTemplates(e){await _s();let n=be(this.config.services,this.config.categories,e.services,e.categories),s=document.querySelectorAll(Ps);if(!s.length)return[];let r=new Set;for(let o=0;o<s.length;o++){let i=s[o];if(!i)continue;let c=this.grantedKey(i,n.services,n.categories);if(!c)continue;r.add(c);let a=i.content.cloneNode(!0);if(!(a instanceof DocumentFragment))continue;let l=a.querySelectorAll("script");for(let d=0;d<l.length;d++){let p=l[d];if(!p)continue;let m=On(p,{removeAttributes:[...Ce,ve]});p.replaceWith(m)}i.replaceWith(a)}return Array.from(r)}grantedKey(e,n,s){for(let o of Ce){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 Ds(t){return typeof t=="object"&&t!==null&&"translations"in t&&"themeCSS"in t}var Ls=250;function Pe(t,e){return`${t}::${e}`}function Ze(t){return t==="details"?"details":t==="trigger"?"trigger":"notice"}var k=class{config;services;bus;storage;viewEngine;currentLocale;translations=null;translationsCache=new Map;uiDataRequests=new Map;uiDataThemeCSS=null;_themeMode="auto";analytics;blockingAttached=!1;constructor(e,n){this.config=e,this.services=n,this.bus=n.bus,this.storage=n.storage,this.viewEngine=n.viewEngine,this.currentLocale=e.languages.primary,e.analytics&&(this.analytics=new qe(e.analytics,this.bus,this.storage,e.framework.type),ce.onPersistenceFailure(()=>{this.bus.emit({type:"monitoring:error",payload:{code:"optout_write_error"}})}))}attachBlocking(e){if(this.blockingAttached)throw new Error("[1ConsentController] blocking is already attached");this.blockingAttached=!0;let n=new Je(this.config),s=(r=!1)=>{let o=e.getEnforcementConsentState(),i=this.getAutoblocker();i&&i.updateConsent(o.services);let c=Ye(this.config);if(r&&c)try{let a=be(this.config.services,this.config.categories,o.services,o.categories);c.apply(a.services,a.categories)}catch{}Xe(()=>{i?.unblock(),!c&&n.unblockTemplates(o).catch(a=>{console.error("Template promotion failed",a)})})};this.bus.on("consent:saved",()=>s()),this.bus.on("consent:external",()=>{s(!0),e.isConsentRequired()&&this.openNotice().catch(()=>{})}),s()}getAutoblocker(){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.currentLocale)return;let n=this.config.languages.supported.find(s=>s===e);n&&(this.currentLocale=n,this.bus.emit({type:"language:changed",payload:{locale:n}}))}getLanguage(){return this.currentLocale}getTranslations(){return this.translations}async setLanguage(e){if(e===this.currentLocale&&this.translations)return;let n=Ze(this.viewEngine?.getCurrentView()),s=this.translationsCache.get(Pe(e,n));if(s){this.translations=s,this.currentLocale=e,this.bus.emit({type:"language:changed",payload:{locale:e}});return}let r=await this.requestUiData(e,n);if(r===null)throw new Error(`[1Consent] ui-data for ${e}/${n} unavailable`);this.translations=r.translations,this.currentLocale=e,this.bus.emit({type:"language:changed",payload:{locale:e}})}hasViewData(e){return e==="none"?!0:this.translationsCache.has(Pe(this.currentLocale,Ze(e)))}async ensureViewData(e){if(e==="none")return;let n=this.currentLocale,s=Ze(e),r=this.translationsCache.get(Pe(n,s));if(r){this.translations=r;return}let o=await this.requestUiData(n,s);o?.translations&&n===this.currentLocale&&(this.translations=o.translations)}requestUiData(e,n){let s=Pe(e,n),r=this.uiDataRequests.get(s);if(r)return r;let o=(async()=>{try{let i=await this.fetchUiDataWithRetry(e,n);return this.applyUiData(e,n,i),i}catch(i){return this.uiDataRequests.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.uiDataRequests.set(s,o),o}async fetchUiDataWithRetry(e,n){try{return await this.fetchUiData(e,n)}catch{return await new Promise(s=>setTimeout(s,Ls)),await this.fetchUiData(e,n)}}async fetchUiData(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(!Ds(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}applyUiData(e,n,s){s.translations&&this.translationsCache.set(Pe(e,n),s.translations),s.themeCSS!==this.uiDataThemeCSS&&(this.uiDataThemeCSS=s.themeCSS,this.viewEngine?.setThemeCSS(s.themeCSS)),s.translations&&e===this.currentLocale&&this.translations===null&&this.viewEngine&&this.viewEngine.getCurrentView()!=="none"&&Ze(this.viewEngine.getCurrentView())===n&&(this.translations=s.translations,this.viewEngine.refreshCurrentView())}getThemeMode(){return this._themeMode}setThemeMode(e){this._themeMode=e,this.bus.emit({type:"theme:changed",payload:{mode:e}})}viewEngineFactory;viewEngineCreation;setViewEngine(e){this.viewEngine=e,this.uiDataThemeCSS!==null&&e.setThemeCSS(this.uiDataThemeCSS)}setViewEngineFactory(e){this.viewEngineFactory=e}async ensureViewEngine(){if(!this.viewEngine&&this.viewEngineFactory){this.viewEngineCreation??=this.viewEngineFactory().catch(n=>{throw this.viewEngineCreation=void 0,n});let e=await this.viewEngineCreation;this.viewEngine||(this.viewEngine=e,this.uiDataThemeCSS!==null&&e.setThemeCSS(this.uiDataThemeCSS))}return this.viewEngine}get activeViewEngine(){return this.viewEngine}async showReturningVisitorTrigger(){if(!wt(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 _e=class{handlers=new Map;on(e,n){let s=this.handlers.get(e);return s||(s=new Set,this.handlers.set(e,s)),s.add(n),()=>this.off(e,n)}off(e,n){let s=this.handlers.get(e);s&&s.delete(n)}emit(e){let n=this.handlers.get(e.type);if(n)for(let s of n)s(e)}};function Pn(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 De(t,e,n,s){let r=_t(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");new J(new X,N(t)).setFastPath(o)}catch{}return n?.cookieMode==="clear"?U(t):n?.cookieMode!=="omit"&&Vs(t,e,r),Xe(()=>xs(t,r)),r}function xs(t,e){try{Ye(t)?.apply(e.s,e.c)}catch{}}function Qe(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 U(t){if(!(typeof document>"u"))try{let e=`${ie}=`,s=document.cookie.split(";").map(o=>o.trim()).find(o=>o.startsWith(e))?.slice(e.length),r=xt(s);if(r&&Se(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))return;document.cookie=`${ie}=; Path=/; SameSite=Lax; Max-Age=0`}catch{}}function Vs(t,e,n){if(!(typeof document>"u")){if(!t.syncCookie||!Se(n.e)){U(t);return}try{let s=Lt({decision:Pn(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=[`${ie}=${s}`,"Path=/","SameSite=Lax",`Expires=${new Date(n.e).toUTCString()}`];r&&o.push("Secure"),document.cookie=o.join("; ")}catch{}}}function Nt(t){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:(e,n)=>t.activeViewEngine?.registerDesign(e,n),getView:()=>{let e="engine"in t?t.engine:void 0;return e&&typeof e=="object"&&"isConsentRequired"in e&&typeof e.isConsentRequired=="function"&&e.isConsentRequired()?"main":null},get engine(){return"engine"in t?t.engine:void 0},get viewEngine(){return t.activeViewEngine}}}var $n=["center-center","bottom-left","bottom-right","bottom-center"],ks=[...$n,"panel-right"];new Set($n),new Set(ks);function Fs(t){return"tcf"in t&&t.tcf!=null&&typeof t.tcf=="object"}var _n="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(_n),_n.filter(t=>t.includes("-")).sort((t,e)=>e.length-t.length);function Ns(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 Dn(t){return typeof t=="string"&&Ns(t)===t}function O(t){return typeof t=="object"&&!!t&&!Array.isArray(t)}function Gn(t){if(!O(t))return!1;let e=t;return!(!(typeof e.appId=="string"&&typeof e.version=="number"&&typeof e.machine=="string"&&O(e.languages)&&typeof e.languages.primary=="string"&&Array.isArray(e.languages.supported)&&e.languages.supported.length>0&&Dn(e.languages.primary)&&e.languages.supported.every(Dn)&&new Set(e.languages.supported).size===e.languages.supported.length&&e.languages.supported.includes(e.languages.primary)&&O(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 Rs(t){return t.cmp.trigger?t.framework.type==="us"||!!t.appearance?.trigger:!1}function Rt(t){if(!Gn(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(!O(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 Ms(t){return Gn(t)&&t.framework.type==="us"}function Ln(t){return["openMain","openDetails","close","acceptAll","rejectAll","save","reset"].includes(t)}var Bt={open:"openMain",openNotice:"openMain"};function Bs(t,e=Bt){if(Ln(t))return t;let n=e[t];if(!n)throw Error(`[1CL] Unknown command: ${t}. No alias mapping found.`);if(!Ln(n))throw Error(`[1CL] Invalid alias target: ${t} \u2192 ${n}. Alias targets must be canonical commands.`);return n}function Us(t){return t?{...Bt,...t}:Bt}function Mt(t){return Array.isArray(t)&&t.every(e=>typeof e=="string")}function jn(t){return!t||typeof t!="object"||Object.entries(t).every(([e,n])=>e.endsWith("Url")?/^(https?:\/\/|mailto:[^@\s]+@[^@\s]+$)/i.test(String(n)):jn(n))}function et(t,e){return Array.isArray(t)&&t.every(n=>O(n)&&e.every(s=>typeof n[s]=="string"))}function $s(t){if(!O(t)||typeof t.id!="string"||typeof t.name!="string")return!1;let e=t.declaration;if(!O(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||et(a,l)),o=s==null||O(s)&&typeof s.label=="string"&&[[s.processingGrounds,["basis","label"]],[s.partyRoles,["partyKey","role"]]].every(([a,l])=>et(a,l))&&Mt(s.rights),i=t.operational,c=i==null||O(i)&&(i.domains===void 0||Array.isArray(i.domains)&&i.domains.every(a=>O(a)&&typeof a.domain=="string"&&typeof a.use=="string"))&&(i.sdks===void 0||Array.isArray(i.sdks)&&i.sdks.every(a=>O(a)&&typeof a.name=="string"&&typeof a.use=="string"));return(t.description==null||typeof t.description=="string")&&c&&r&&jn(t)&&et(e.purposes,["key","name"])&&Mt(e.dataCategories)&&Mt(e.technologies)&&(n===null||O(n)&&et(n.items,["key","type"]))&&O(e.links)&&Object.values(e.links).every(a=>typeof a=="string")&&o}function Kn(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 Gs=["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 Hn(t){return Array.from(t.querySelectorAll(Gs)).filter(e=>e instanceof HTMLElement&&e.getAttribute("tabindex")!=="-1"&&!e.closest("[hidden], [inert], [aria-hidden='true']"))}function js(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):Hn(t)[0]||(t.hasAttribute("tabindex")||(t.tabIndex=-1),t)}function Ks(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 zn(t,e){let n=Ks(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=Hn(t);if(l.length===0){a.preventDefault(),t.focus({preventScroll:!0});return}let d=l[0],p=l[l.length-1];if(!d||!p)return;let m=t.getRootNode(),y=m instanceof ShadowRoot?m.activeElement:document.activeElement;a.shiftKey&&(y===d||!t.contains(y))?(a.preventDefault(),p.focus({preventScroll:!0})):!a.shiftKey&&(y===p||!t.contains(y))&&(a.preventDefault(),d.focus({preventScroll:!0}))};t.addEventListener("keydown",i),js(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 xn=new Map,ue=null,Ut=null,$t=0;async function Vn(t,e,n,s,r,o){if(ue?.dataset.serviceId===t)return;let i=r||document.body,c=(i instanceof ShadowRoot?i.activeElement:null)??document.activeElement,a=c instanceof HTMLElement?c:null;Le();let l=++$t,d=e.cmp.serviceDetails.replace("{serviceId}",encodeURIComponent(t)),p=`${d}${d.includes("?")?"&":"?"}schema=2`,m=o??xn.get(p);if(!m){let h=await Hs(t,p);if(!h)return;xn.set(p,h),m=h}if(l!==$t)return;let y=s();if(!y)throw Error("[Modal] Missing i18n");Kn(n,y);let u=document.createElement("div");u.dataset.serviceId=t,gt(n,{service:m,ui:y},u,{view:"service-detail"}),ue=u,i.appendChild(ue);let S=u.querySelector('[role="dialog"]'),C=S instanceof HTMLElement?zn(S,u):()=>{},g=u.querySelector(".oc-service-modal__overlay");g?.addEventListener("click",h=>{h.target===g&&Le()}),u.querySelector('[data-1c="command:closeServiceDetail"]')?.addEventListener("click",h=>{h.preventDefault(),Le()});let b=h=>{h.key==="Escape"&&Le()};document.addEventListener("keydown",b),Ut=()=>{C(),document.removeEventListener("keydown",b),a?.isConnected&&a.focus({preventScroll:!0})},requestAnimationFrame(()=>{g?.classList.add("oc-service-modal--visible")})}function Le(){if($t+=1,!ue)return;let t=ue,e=Ut;ue=null,Ut=null,e?.(),t.remove()}async function Hs(t,e){try{let n=await fetch(e);if(n.ok){let s=await n.json();if($s(s))return s}}catch{}return console.error(`[ServiceDetail] Request failed for ${t}`),null}function zs(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 kn(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 Fn(t,e){let n=Bs(e,Us()),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:()=>Le()}[n];s?s():console.warn(`[1CL] Unknown canonical command: ${n}`)}function Nn(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 qs(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);Rn(t.engine,`category:${o}`,r)}else if(e.startsWith("service:")){let o=e.substring(8);Rn(t.engine,`service:${o}`,r)}}}function Rn(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 Ws(t,e){let n=s=>{let r=s.target,o=r.getAttribute?.("data-1c-backdrop");if(o){let l=kn(o);l&&(s.preventDefault(),l.type==="view"?Nn(e,l.name):Fn(e,l.name));return}let i=r.closest("[data-1c]");if(!i)return;let c=i.getAttribute("data-1c");if(!c)return;let a=kn(c);if(a)switch(a.type){case"command":s.preventDefault(),Fn(e,a.name);break;case"view":s.preventDefault(),Nn(e,a.name);break;case"consent":qs(e,a.name,i);break;case"dataset":s.preventDefault(),Ys(e,a.name,i);break;default:console.warn(`[1CL] Unknown command type: ${a.type}`)}};return t.addEventListener("click",n),()=>{t.removeEventListener("click",n)}}function Ys(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}Vn(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}Xs(o,i,t.config,t.getLanguage()).then(a=>{a&&Vn(`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 Xs(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(!At(d))return null;let p=d.disclosures,m=d.domains??[],y=d.sdks??[];if(p.length===0&&m.length===0&&y.length===0)return null;let u=p.map(g=>{let b=zs(g.maxAgeSeconds,s),h=[g.description,g.domains.length>0?`Domains: ${g.domains.join(", ")}`:void 0,g.purposes.length>0?`Purposes: ${g.purposes.map(f=>`P${f}`).join(", ")}`:g.specialPurposes.length===0?"Non-TCF purpose":void 0,g.specialPurposes.length>0?`Special purposes: ${g.specialPurposes.map(f=>`SP${f}`).join(", ")}`:void 0,g.optOut?"Opt-out mechanism":void 0,g.cookieRefresh?"Refreshed":void 0].filter(f=>!!f);return{key:g.identifier,type:g.type,duration:b,description:h.join(" \xB7 ")}}),S=Array.from(new Set(p.flatMap(g=>g.purposes).map(g=>`Purpose ${g}`))),C=Array.from(new Set([...p.map(g=>g.type),...y.map(g=>`SDK: ${g.name}`)]));return{id:`vendor-${t}`,name:e,...S.length>0&&{purposes:S},...C.length>0&&{technologiesUsed:C},...u.length>0&&{storage:{items:u}},operational:m.length>0||y.length>0?{...m.length>0&&{domains:m},...y.length>0&&{sdks:y}}:null,declaration:{purposes:S.map((g,b)=>({key:String(b),name:g})),dataCategories:[],technologies:C,deviceStorage:u.length>0?{items:u.map(g=>({...g,type:g.type==="cookie"?"cookie":"other"}))}:null,links:{}}}}var Js=class tt{index=new Map;static makeKey(e,n){return`${e}::${n??""}`}add(e,n,s){let r=tt.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=tt.makeKey(e,n),o=this.index.get(r);o&&(o.delete(s),o.size===0&&this.index.delete(r))}get(e,n){let s=tt.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}},Mn=new WeakMap;function xe(t){let e=Mn.get(t);return e||(e=new Js,Mn.set(t,e)),e}function Zs(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 Qs(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 Gt(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 jt(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)Gt(i,{value:r.value??i.checked,disabled:r.disabled??i.disabled})}}function qn(t,e,n){let s=Zs(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);jt(i.patches,e,i.version)}else for(let i of s)try{if(!n.engine?.resolve||!Vt(i.bindingKey))continue;let c=i.id?{bindingKey:i.bindingKey,id:i.id}:{bindingKey:i.bindingKey},a=n.engine.resolve(c);a&&Gt(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 er(t,e){Qs(t,e)}function tr(t,e){let n=new MutationObserver(s=>{for(let r of s){for(let o of r.addedNodes)o instanceof HTMLElement&&qn(o,t,e);for(let o of r.removedNodes)o instanceof HTMLElement&&er(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,jt(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,Gt(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 sr(t,e){qn(t,t,e);let n=nr(t,e),s=tr(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);jt(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 rr(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=or(e),{position:s,spacing:r,logoAlign:o,buttonOrder:i,buttonAlign:c,buttonEmphasis:a}=cr(t,n);return{state:e==="none"?"closed":"open",load:"ready",theme:ir(t),layer:n,framework:ar(t),position:s,spacing:r,logoAlign:o,buttonOrder:i,buttonAlign:c,buttonEmphasis:a}}function ir(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 or(t){return t==="main"?"notice":t==="details"?"details":"trigger"}function ar(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 cr(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 lr(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 Bn(t,e){lr(t,rr(e))}function dr(t,e){Bn(t,e);let n=()=>{Bn(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 ur(t){return"getOptOutOfSale"in t&&"getOptOutOfShare"in t&&"isGpcDetected"in t&&"getLimitSensitiveUse"in t&&"getSensitivePIInUse"in t}function pr(t,e,n){let s=Object.values(t.stacks),r=new Set(s.flatMap(u=>u.purposes)),o=new Set(s.flatMap(u=>u.specialFeatures)),i=new Set(n.flatMap(u=>u.specialFeatureIds)),c=Object.values(t.specialFeatures).filter(u=>i.has(u.id)),a=n.map(u=>{let S=t.vendors[u.id];if(!S)throw Error(`TCF UI data is missing configured vendor ${u.id}`);let C=new Set(u.consentPurposeIds),g=new Set(u.legitimateInterestPurposeIds),b=new Set(u.flexiblePurposeIds),h=new Set(u.specialFeatureIds);return{...S,purposes:S.purposes.filter(f=>C.has(f)),purposes_data:S.purposes_data.filter(f=>C.has(f.id)),legIntPurposes:S.legIntPurposes.filter(f=>g.has(f)),legIntPurposes_data:S.legIntPurposes_data.filter(f=>g.has(f.id)),flexiblePurposes:S.flexiblePurposes.filter(f=>b.has(f)),flexiblePurposes_data:S.flexiblePurposes_data.filter(f=>b.has(f.id)),specialFeatures:S.specialFeatures.filter(f=>h.has(f)),specialFeatures_data:S.specialFeatures_data.filter(f=>h.has(f.id))}}),l=Object.values(t.purposes).map(u=>{let S=a.filter(g=>g.purposes.includes(u.id)).length,C=a.filter(g=>g.legIntPurposes.includes(u.id)).length;return{...u,consentVendorCount:S,legitimateInterestVendorCount:C,hasConsentVendors:S>0,hasLegitimateInterestVendors:C>0}}),d=new Set(l.filter(u=>u.hasConsentVendors).map(u=>u.id)),p=s.map(u=>({...u,hasConsentControls:u.purposes.some(S=>d.has(S))||u.specialFeatures.length>0})),m=l.filter(u=>u.hasLegitimateInterestVendors),y=a.filter(u=>u.legIntPurposes.length>0).length;return{standardTexts:t.standardTexts,...e==="main"?{stacks:p,purposes:l.filter(u=>!r.has(u.id))}:{purposes:l},specialPurposes:Object.values(t.specialPurposes),dataCategories:Object.values(t.dataCategories),features:Object.values(t.features),specialFeatures:e==="main"?c.filter(u=>!o.has(u.id)):c,vendors:a,vendorCount:a.length,legitimateInterestPurposes:m,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 Un(t,e,n){let s=t?.[e];return{name:s?.name??n??e,...s?.description&&{description:s.description}}}var fr=["data-1c","data-1c-action"],Wn=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 fr){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 Rs(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;if(s!=="main"&&s!=="details"){let c=n?.()??{to:t,reason:e};this.transitionTo(c.to,c.reason);return}let r=this.transitionIntent+1,o=new Promise(c=>window.setTimeout(c,0)).then(async()=>{try{return await i?n?.()??{to:t,reason:e}:void 0}finally{this.pendingDismissalWork===o&&(this.pendingDismissalWork=null)}});n&&(this.pendingDismissalWork=o);let i=this.transitionTo("none",e);o.then(c=>{c&&c.to!=="none"&&r===this.transitionIntent&&this.currentView==="none"&&this.transitionTo(c.to,c.reason)})}saveDecision(t){this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","consent-given",()=>{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",()=>{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}`,f=this.shadowRoot.getElementById(h);f||(f=document.createElement("style"),f.id=h,this.shadowRoot.prepend(f)),f.textContent=e.css}let n=this.translationsProvider()??{},s=Fs(n)?n.tcf.gvl:void 0,r=(Rt(this.config)?this.config.vendors??[]:[]).length,o=h=>{let f={};for(let[E,w]of Object.entries(h))typeof w=="string"?f[E]=w.replace(/%VENDORS_COUNT%/g,String(r)):Array.isArray(w)?f[E]=w:w&&typeof w=="object"?f[E]=o(w):f[E]=w;return f},i=Rt(this.config)?o(n):n,c=Ms(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,...Un(i.vendors?.services,h.id,h.name??h.tag)}));Kn(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,...Un(i.vendors?.categories,h.id,h.name),services:l.filter(f=>f.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:pr(s,t,Rt(this.config)?this.config.vendors??[]:[])}:{},...ur(this.consentEngine)?{us:{optedOutOfSale:this.consentEngine.getOptOutOfSale(),optedOutOfShare:this.consentEngine.getOptOutOfShare(),gpcDetected:this.consentEngine.isGpcDetected(),sensitivePIInUse:this.consentEngine.getSensitivePIInUse(),limitSensitiveUse:this.consentEngine.getLimitSensitiveUse()}}:{}},p=this.renderTarget;if(!p)return console.error("[ViewEngine] Shadow root render target is missing"),!1;try{gt(e,d,p,{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 m=p.querySelector('[role="dialog"]'),y=this.isModalView(t);m instanceof HTMLElement&&(m.setAttribute("aria-modal",y?"true":"false"),y&&this.cleanupFunctions.push(zn(m,this.container)));let u=p.querySelector("select[data-1c-lang]");if(u instanceof HTMLSelectElement&&(u.value=this.currentLocale,u.disabled=this.languageChangePending,u.onchange=()=>{if(this.languageChangePending)return;let h=this.config.languages.supported.find(w=>w===u.value),f=this.controllerSetLanguage;if(!h||!f)return;u.disabled=!0,this.languageChangePending=!0;let E;try{E=f(h)}catch(w){E=Promise.reject(w)}E.catch(w=>{let _=this.renderTarget?.querySelector("select[data-1c-lang]");_ instanceof HTMLSelectElement&&(_.value=this.currentLocale),console.error("[ViewEngine] Language switch failed",w)}).finally(()=>{this.languageChangePending=!1;let w=this.renderTarget?.querySelector("select[data-1c-lang]");w instanceof HTMLSelectElement&&(w.disabled=!1)})}),p.textContent?.includes("[")){if(p.textContent?.includes("[ul]")){let _=/\[ul]([\s\S]*?)\[\/ul]/g,L=/\[li]([\s\S]*?)\[\/li]/g,x=document.createTreeWalker(p,NodeFilter.SHOW_TEXT),P=[],A;for(;A=x.nextNode();)A.textContent?.includes("[ul]")&&P.push(A);for(let Z of P){let j=Z.textContent||"",Q=document.createDocumentFragment(),V=0;_.lastIndex=0;let I;for(;(I=_.exec(j))!==null;){I.index>V&&Q.appendChild(document.createTextNode(j.slice(V,I.index)));let ee=document.createElement("ul");ee.className="oc-list";let Ge=I[1];L.lastIndex=0;let en;for(;(en=L.exec(Ge))!==null;){let tn=document.createElement("li");tn.textContent=en[1],ee.appendChild(tn)}Q.appendChild(ee),V=I.index+I[0].length}V<j.length&&Q.appendChild(document.createTextNode(j.slice(V))),Z.parentNode?.replaceChild(Q,Z)}}let h=/\[([abi])(?:\s+([^\]]*))?](.*?)\[\/\1]/g,f=document.createTreeWalker(p,NodeFilter.SHOW_TEXT),E=[],w;for(;w=f.nextNode();)w.textContent&&h.test(w.textContent)&&(E.push(w),h.lastIndex=0);for(let _ of E){let L=_.textContent||"",x=document.createDocumentFragment(),P=0;h.lastIndex=0;let A;for(;(A=h.exec(L))!==null;){A.index>P&&x.appendChild(document.createTextNode(L.slice(P,A.index)));let Z=A[1],j=A[2]||"",Q=A[3],V;if(Z==="a"){let I=document.createElement("a");I.className="oc-link";let ee=j.match(/href="([^"]*)"/),Ge=j.match(/action="([^"]*)"/);Ge?(I.href="#",I.setAttribute("data-1c-action",Ge[1])):ee?(I.href=ee[1],I.target="_blank",I.rel="noopener noreferrer"):I.href="#",V=I}else V=Z==="b"?document.createElement("strong"):document.createElement("em");V.textContent=Q,x.appendChild(V),P=A.index+A[0].length}P<L.length&&x.appendChild(document.createTextNode(L.slice(P))),_.parentNode?.replaceChild(x,_)}}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},C=sr(p,S),g=Ws(p,S),b=dr(this.container,S);return this.cleanupFunctions.push(C,g,b),!0}};var nt=class extends Oe{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 $=class extends nt{state;versionTracker=new Te;lastPersistedConsent;hasDowngradeBaseline;loadedStoredConsent=!1;storedLocale;displayLocale;constructor(e,n,s){super(e,n,s),this.displayLocale=s.languages.primary,this.state=this.loadInitialState();let r=Ae(s,n.getFastPath());this.hasDowngradeBaseline=r!==void 0||this.loadedStoredConsent,this.lastPersistedConsent=r??(this.loadedStoredConsent?B(this.config,this.rawConsentSnapshot()):{}),this.state.hasConsent&&this.isConsentExpired()&&this.invalidateStoredConsent(),this.bus.on("language:changed",o=>{this.setDisplayLocale(o.payload.locale)});try{this.bootSyncsFastPath()&&(this.state.hasConsent&&this.hasValidConsent()?(this.syncFastPath(),this.mergeConsentDowngradeBaseline(B(this.config,this.rawConsentSnapshot()))):(this.storage.removeFastPath(),U(this.config)))}catch{}this.flushPendingConsentEvents()}bootSyncsFastPath(){return!0}syncFastPath(e){De(this.config,this.getFastPathConsentMap(),this.getFastPathSyncOptions(),e)}reconcileExternalConsentChange(e,n,s=!1){!s&&!this.hasExternalConsentChange(e,n)||(this.reloadExternalConsentState(s),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.loadedStoredConsent=!1,this.storedLocale=void 0,this.state=this.loadInitialState(),(!this.state.hasConsent||!this.hasValidConsent())&&(n||s?this.invalidateStoredConsent():(this.state=this.freshVisitorState(),this.loadedStoredConsent=!1,this.storedLocale=void 0,U(this.config)))}getFastPathSyncOptions(){let e=this.getConsentTimestamp();return{...e===null?{}:{decisionTimestamp:e}}}getStoredLocale(){return this.storedLocale}getDisplayLocale(){return this.displayLocale}setDisplayLocale(e){this.displayLocale=e;try{this.persistDisplayLocale(e)}catch{}}persistDisplayLocale(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});this.storage.updateConsent({...n,consent:r}),this.storedLocale=e}getFastPathConsentMap(){return this.getConsent()}getConsentDowngradeSnapshot(){return B(this.config,this.getFastPathConsentMap())}extendConsentDowngradeBaseline(e){this.hasDowngradeBaseline&&(this.lastPersistedConsent={...this.lastPersistedConsent,...e})}mergeConsentDowngradeBaseline(e){let n={...this.lastPersistedConsent};for(let[s,r]of Object.entries(e))n[s]=n[s]===!0||r===!0;this.lastPersistedConsent=n,this.hasDowngradeBaseline=!0}loadInitialState(){let e=this.storage.getConsent();if(!e)return this.freshVisitorState();try{return this.stateFromStoredEntry(e)}catch(n){return console.error("[GdprEngine]",n),this.freshVisitorState()}}freshVisitorState(){return{hasConsent:!1,acceptedAll:!1,rejectedAll:!1,categories:this.getDefaultCategoryConsents(),services:this.getDefaultServiceConsents(),timestamp:Date.now()}}invalidateStoredConsent(){this.state=this.freshVisitorState(),this.storedLocale=void 0,this.loadedStoredConsent=!1,this.lastPersistedConsent={},this.hasDowngradeBaseline=!1;try{this.storage.invalidateConsent()}catch{}U(this.config)}clearFastPathSignals(){try{this.storage.removeFastPath()}catch{}U(this.config)}stateFromStoredEntry(e){let n=T.decodeForConfig(e.consent,this.config);this.storedLocale=n.language;let s=this.getDefaultCategoryConsents(),r=this.getDefaultServiceConsents(),o=this.changedSurfaceProjection();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(p=>!p.essential),d=T.decodeBitset(n.payload,l.length);l.forEach((p,m)=>{s[p.id]=d[m]??!1}),this.config.services.forEach(p=>{if(p.essential)r[p.id]=!0;else{let m=p.categoryId;r[p.id]=m?s[m]??!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.loadedStoredConsent=!0,{hasConsent:!0,acceptedAll:c,rejectedAll:a,categories:s,services:r,timestamp:n.timestamp*1e3}}changedSurfaceProjection(){let e=this.storage.getFastPath();if(!e||e.consentEpoch<(this.config.consentEpoch??0))return;let n=R(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.rawConsentSnapshot()}rawConsentSnapshot(){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(){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.hasDowngradeBaseline&&oe(this.lastPersistedConsent,e);this.saveToStorage(),this.lastPersistedConsent=e,this.hasDowngradeBaseline=!0,this.emit("consent:saved"),n&&ae(this.config)==="reload"&&window.location.reload()}saveToStorage(){let e=this.encodeConsentString(),n=this.storage.getConsentId();n||(n=crypto.randomUUID(),this.storage.setConsentId(n)),this.syncFastPath(r=>{this.persistToLocalStorage(e,r)});let s=this.buildConsentEvent(e,n);s&&(this.storage.queuePendingEvent(s),this.sendConsentEvent(s).then(r=>{r&&this.storage.removePendingEvent(s.eventId)}))}flushPendingConsentEvents(){for(let e of this.storage.getPendingEvents())this.sendConsentEvent(e).then(n=>{n&&this.storage.removePendingEvent(e.eventId)})}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)}encodeConsentString(){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.displayLocale,timestamp:Math.floor(Date.now()/1e3)})}buildConsentEvent(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.getEvidenceConsentValues(),i=o.length>0&&o.every(Boolean)?"accept_all":o.length>0&&o.every(a=>!a)?"deny_all":"granular",c=crypto.randomUUID();return{url:s,eventId:c,payload:{publicationToken:r,eventId:c,consentId:n,action:i,consentString:e}}}getEvidenceConsentValues(){let e=this.getFastPathConsentMap();return[...this.config.categories.filter(n=>!n.essential),...this.config.services.filter(n=>!n.essential)].map(n=>e[n.id]===!0)}async sendConsentEvent(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.getConsentState().hasConsent||this.isConsentExpired()||this.hasNewCategories())}hasValidConsent(){return!this.isConsentRequired()}getConsentTimestamp(){return this.state.timestamp||null}isConsentExpired(){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}hasNewCategories(){let e=Object.keys(this.state.categories);return(this.config.categories.map(s=>s.id)||[]).some(s=>!e.includes(s))}resolve(e){let n=D(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=D(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 Ve=class extends k{engine;constructor(e,n){super(e,n),this.engine=new $(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(){this.engine.acceptAll(),this.engine.save(),await this.close()}async rejectAll(){this.engine.rejectAll(),this.engine.save(),await this.close()}};var Kt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function st(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|Kt.indexOf(t[i]),r+=6,r>=8&&(r-=8,n[o++]=s>>r&255);if(rt(n)!==t)throw new Error("invalid base64url");return n}function rt(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+=Kt[n>>s&63];return s>0&&(e+=Kt[n<<6-s&63]??""),e}function F(){throw new Error("invalid TC")}function it(t,e,n){for(let s of n){let r=e*65536+s;t.has(r)&&F(),t.add(r)}}var Ht=53;function zt(t){if(!Number.isSafeInteger(t)||t<1||t>Ht)throw new Error(`Bit length must be an integer from 1 to ${Ht}`)}var pe=class{buffer;pointer=0;constructor(e){this.buffer=e}readBits(e){if(zt(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.pointer>=this.buffer.length*8)throw new Error("BitReader: Unexpected end of stream");let e=Math.floor(this.pointer/8),n=7-this.pointer%8,s=(this.buffer[e]??0)>>n&1;return this.pointer++,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 zt(e),this.pointer+e<=this.buffer.length*8}assertOnlyPadding(){let e=this.buffer.length*8-this.pointer;for(;e>0;)(e-- >7||this.readBit())&&F()}},ke=class{bits=[];writeBits(e,n){zt(n);let s=n===Ht?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.bits.push(r[o]==="1"?1:0)}writeBit(e){if(typeof e!="boolean")throw new Error("BitWriter: bit value must be boolean");this.bits.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.bits.length/8),n=new Uint8Array(e);for(let s=0;s<this.bits.length;s++){let r=Math.floor(s/8),o=7-s%8;if(this.bits[s]===1){let i=n[r];i!==void 0&&(n[r]=i|1<<o)}}return n}};function Fe(t){let e=st(t);if(e.length!==0)return new pe(e).readBits(3)}function ot(t){let e=t.split("."),n=e[0]??"",s=st(n),r=new pe(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),p=r.readLanguage(),m=r.readBits(12),y=r.readBits(6),u=r.readBool(),S=r.readBool(),C=qt(r,12),g=qt(r,24),b=qt(r,24),h=r.readBool(),f=r.readLanguage(),E=Wt(r),w=Wt(r),_=gr(r);r.assertOnlyPadding();let L={version:o,created:i,lastUpdated:c,cmpId:a,cmpVersion:l,consentScreen:d,consentLanguage:p,vendorListVersion:m,tcfPolicyVersion:y,isServiceSpecific:u,useNonStandardStacks:S,specialFeatureOptIns:C,purposeConsents:g,purposeLegitimateInterests:b,purposeOneTreatment:h,publisherCC:f,vendorConsents:E,vendorLegitimateInterests:w,publisherRestrictions:_};for(let x=1;x<e.length;x++){let P=new pe(st(e[x]??""));P.readBits(3)===1&&(L.disclosedVendors=Wt(P),P.assertOnlyPadding())}return L}function qt(t,e){let n=new Set;for(let s=1;s<=e;s++)t.readBool()&&n.add(s);return n}function Wt(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=Xn(t,t.readBits(12),e);return s.some(r=>r.end===e)||F(),Jn(s)}function Xn(t,e,n){let s=[];for(let r=0;r<e;r++){let o=t.readBool(),i=t.readBits(16);if(Yn(i,n),!o){s.push({start:i,end:i});continue}let c=t.readBits(16);Yn(c,n),c<=i&&F(),s.push({start:i,end:c})}return s}function Yn(t,e){(t<1||t>e)&&F()}function Jn(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 gr(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)&&F();let i=t.readBits(2);i>2&&F();let c=t.readBits(12),a=Jn(Xn(t,c,65535));it(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{he(n,"derived")}catch{throw new Error("TCF: invalid millisecond timestamp")}return n}function he(t,e){if(!Number.isSafeInteger(t)||t<0||t>68719476735||t%864e3!==0)throw new Error(`TCF: invalid ${e} timestamp`)}function ct(t,e){try{return he(t,"Created"),he(e,"LastUpdated"),t===e}catch{return!1}}function Zn(t){return{resolve(e){let n=t.stacks[e];return n?{purposes:n.purposes,specialFeatures:n.specialFeatures}:null}}}var lt=class t{decode;encode;opts;tc=null;originalSegments=[];constructor(e,n,s={}){this.decode=e,this.encode=n,this.opts=s,!this.opts.stackResolver&&this.opts.base&&(this.opts.stackResolver=Zn(this.opts.base))}static withBase(e,n,s,r={}){return new t(e,n,{...r,base:s,stackResolver:Zn(s)})}static raw(e,n,s={}){return new t(e,n,s)}load(e){let n=this.decode(e);if(this.tc=n,this.originalSegments=e.split("."),!ct(this.tc.created,this.tc.lastUpdated))throw new Error("TCF: invalid Created/LastUpdated timestamps");return this.tc}startNew(){this.originalSegments=[];let e=this.currentTimestamp();return this.tc={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.tc}getDecoded(){if(!this.tc)throw new Error("TCF: call load(tcString) first");return this.tc}toTcString(){let e=this.encode(this.getDecoded()).split(".");if(this.originalSegments.length<=1)return e.join(".");let n=new Set;for(let r of e.slice(1)){let o=Fe(r);o!==void 0&&n.add(o)}let s=this.originalSegments.slice(1).filter(r=>{let o=Fe(r);return o!==void 0&&!n.has(o)});return[...e,...s].join(".")}getPurposeConsent(e){return this.assertPurposeId(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.assertPurposeId(e),this.getDecoded().purposeLegitimateInterests.has(e)}getSpecialFeatureOptIn(e){return this.assertSpecialFeatureId(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.assertVendorId(e),this.getDecoded().vendorConsents.has(e)}getVendorLegitimateInterest(e){return this.assertVendorId(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.touch())}setPurposeConsent(e,n){return this.assertPurposeId(e),this.setInSet(this.getDecoded().purposeConsents,e,n)?this.touch():this}setPurposeLegitimateInterest(e,n){if(this.assertPurposeId(e),n&&this.shouldEnforceTcfPolicy()){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.setInSet(this.getDecoded().purposeLegitimateInterests,e,n)?this.touch():this}setVendorConsent(e,n){return this.assertVendorId(e),this.setInSet(this.getDecoded().vendorConsents,e,n)?this.touch():this}setVendorLegitimateInterest(e,n){return this.assertVendorId(e),this.setInSet(this.getDecoded().vendorLegitimateInterests,e,n)?this.touch():this}setSpecialFeatureOptIn(e,n){return this.assertSpecialFeatureId(e),this.setInSet(this.getDecoded().specialFeatureOptIns,e,n)?this.touch():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.assertPurposeId(e);let r=this.getDecoded(),o=new Set;for(let a of s)this.assertVendorId(a),o.add(a);let i=r.publisherRestrictions?.find(a=>a.purposeId===e);if(i?.restrictionType===n&&this.setsEqual(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.touch()}removePublisherRestrictionVendors(e,n){this.assertPurposeId(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.assertVendorId(a),c=i.vendorIds.delete(a)||c;return c?(i.vendorIds.size===0&&(r.splice(o,1),r.length===0&&delete s.publisherRestrictions),this.touch()):this}clearPublisherRestriction(e){this.assertPurposeId(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.touch())}setInSet(e,n,s){return e.has(n)===s?!1:(s?e.add(n):e.delete(n),!0)}setsEqual(e,n){return e.size===n.size&&[...e].every(s=>n.has(s))}touch(){let e=this.getDecoded(),n=this.currentTimestamp();return e.created=n,e.lastUpdated=n,this}currentTimestamp(){return at(this.opts.now?this.opts.now():Date.now())}shouldEnforceTcfPolicy(){return this.opts.enforceTcfPolicy!==!1}assertPurposeId(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})`)}assertVendorId(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}`:""})`)}assertSpecialFeatureId(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 Qn(t){let e=new ke,n=t.created??t.lastUpdated??at(Date.now()),s=t.created??n,r=t.lastUpdated??n;if(he(s,"Created"),he(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),Yt(e,t.specialFeatureOptIns??new Set,12,"special-feature"),Yt(e,t.purposeConsents??new Set,24,"purpose-consent"),Yt(e,t.purposeLegitimateInterests??new Set,24,"purpose-legitimate-interest"),e.writeBool(t.purposeOneTreatment??!1),e.writeLanguage(t.publisherCC??"aa"),Xt(e,t.vendorConsents,"vendor-consent"),Xt(e,t.vendorLegitimateInterests,"vendor-legitimate-interest"),mr(e,t.publisherRestrictions??[]);let c=e.toUint8Array(),a=rt(c);if(t.disclosedVendors===void 0)throw new Error("TCF 2.4: disclosed vendors are required");let l=new ke;l.writeBits(1,3),Xt(l,t.disclosedVendors,"disclosed-vendor");let d=l.toUint8Array();return`${a}.${rt(d)}`}function Yt(t,e,n,s){for(let r of e)G(r,1,n,s);for(let r=1;r<=n;r++)t.writeBool(e.has(r))}function Xt(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)G(a,1,65535,n);let r=s[s.length-1]??0,o=es(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),G(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 es(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 mr(t,e){G(e.length,0,2**12-1,"publisher restriction count");let n=new Set;t.writeBits(e.length,12);for(let s of e){G(s.purposeId,1,24,"publisher restriction purpose"),G(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)G(i,1,65535,"publisher restriction vendor");it(n,s.purposeId,r);let o=es(r);G(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 G(t,e,n,s){if(!Number.isSafeInteger(t)||t<e||t>n)throw new Error(`TCF: invalid ${s} ${t} (expected ${e}..${n})`)}function fe(t){return Object.fromEntries([...t].map(e=>[e.toString(),!0]))}function ts(t){try{let e=t.split(".").slice(1).map(n=>Fe(n));return e.length===1&&e[0]===1}catch{return!1}}function Sr(t,e){if(t.version!==2||!ct(t.created,t.lastUpdated)||t.cmpId!==Ie||t.tcfPolicyVersion!==z||!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:fe(t.purposeConsents),legitimateInterests:fe(t.purposeLegitimateInterests)},vendor:{consents:fe(t.vendorConsents),legitimateInterests:fe(t.vendorLegitimateInterests),disclosedVendors:fe(t.disclosedVendors)},specialFeatureOptins:fe(t.specialFeatureOptIns),publisher:{consents:{},legitimateInterests:{},customPurpose:{consents:{},legitimateInterests:{}},restrictions:n}};return yn(s)?s:void 0}var dt=class extends ${tcfController;tcfConfig;consentPurposeIds;legitimateInterestPurposeIds;specialFeatureIds;consentVendorIds;legitimateInterestVendorIds;legitimateInterestDisclosurePending=!1;constructor(e,n,s){super(e,n,s),this.tcfConfig=s;let r=s.vendors.map(c=>c.id);this.consentPurposeIds=[...new Set(s.vendors.flatMap(c=>c.consentPurposeIds))],this.legitimateInterestPurposeIds=[...new Set(s.vendors.flatMap(c=>c.legitimateInterestPurposeIds))],this.specialFeatureIds=[...new Set(s.vendors.flatMap(c=>c.specialFeatureIds))],this.consentVendorIds=s.vendors.filter(c=>c.consentPurposeIds.length>0).map(c=>c.id),this.legitimateInterestVendorIds=s.vendors.filter(c=>c.legitimateInterestPurposeIds.length>0).map(c=>c.id);let o={cmpId:Ie,cmpVersion:Cn,vendorListVersion:"vendorListVersion"in s.framework?s.framework.vendorListVersion:0,tcfPolicyVersion:z,purposeConsents:[],purposeLegitimateInterests:this.legitimateInterestPurposeIds,specialFeatureOptins:[],vendorConsents:[],vendorLegitimateInterests:this.legitimateInterestVendorIds,disclosedVendors:r,purposes:[...new Set([...this.consentPurposeIds,...this.legitimateInterestPurposeIds])],stacks:{}};this.tcfController=lt.withBase(ot,Qn,o);let i=this.restoreStoredTcDecision(r);if(i&&this.hasValidConsent())try{this.syncFastPath(),this.mergeConsentDowngradeBaseline(this.getConsentDowngradeSnapshot())}catch{}else this.clearFastPathSignals();i&&this.extendConsentDowngradeBaseline(this.getTcfDowngradeSnapshot())}bootSyncsFastPath(){return!1}reloadExternalConsentState(e=!1){super.reloadExternalConsentState(e);let n=this.tcfConfig.vendors.map(r=>r.id),s=this.restoreStoredTcDecision(n);this.legitimateInterestDisclosurePending=!e&&!s,this.legitimateInterestDisclosurePending&&(this.tcfController.setPurposeLegitimateInterests(this.legitimateInterestPurposeIds,!1),this.tcfController.setVendorLegitimateInterests(this.legitimateInterestVendorIds,!1))}markLegitimateInterestDisclosuresVisible(){!this.legitimateInterestDisclosurePending||this.state.hasConsent||(this.legitimateInterestDisclosurePending=!1,this.tcfController.setPurposeLegitimateInterests(this.legitimateInterestPurposeIds,!0),this.tcfController.setVendorLegitimateInterests(this.legitimateInterestVendorIds,!0),this.emit("consent:changed"))}restoreStoredTcDecision(e){let n=this.storage.getConsent(),s=!1;if(this.state.hasConsent&&n?.tcString&&ts(n.tcString))try{this.tcfController.load(n.tcString);let r=this.getTcfApiDecisionData();s=ze(Object.keys(r.vendor.disclosedVendors).map(Number))===ze(e)&&this.isApiDataCompatibleWithCurrentGvl(r)}catch{}return s||(this.startFreshTcModel(),n&&this.invalidateStoredConsent()),s}isApiDataCompatibleWithCurrentGvl(e){let n=(r,o)=>Object.keys(r).every(i=>o.includes(Number(i)));if(!n(e.purpose.consents,this.consentPurposeIds)||!n(e.purpose.legitimateInterests,this.legitimateInterestPurposeIds)||!n(e.vendor.consents,this.consentVendorIds)||!n(e.vendor.legitimateInterests,this.legitimateInterestVendorIds)||!n(e.specialFeatureOptins,this.specialFeatureIds))return!1;let s=new Map(this.tcfConfig.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:Qe(e),tcfCmpId:Ie,tcfValidationVersion:vn,tcfDisclosedVendorKey:ze(this.tcfConfig.vendors.map(s=>s.id)),tcfApiData:n,tcfApiDataIntegrity:Qe(wn(e,n))}}getConsentDowngradeSnapshot(){return{...super.getConsentDowngradeSnapshot(),...this.getTcfDowngradeSnapshot()}}getEvidenceConsentValues(){return[...super.getEvidenceConsentValues(),...Object.values(this.getTcfDowngradeSnapshot())]}getExternalConsentSnapshot(e){let n=super.getExternalConsentSnapshot(e),r=de(e,this.storage.getScope())?.consent?.tcString;if(!r)return n;try{let o=ot(r);if(o.version!==2||o.tcfPolicyVersion!==z||o.cmpId!==Ie)return n;let i={...n??{}};for(let c of this.consentPurposeIds)i[`tcf:purpose:${c}`]=o.purposeConsents.has(c);for(let c of this.legitimateInterestPurposeIds)i[`tcf:purposeLI:${c}`]=o.purposeLegitimateInterests.has(c);for(let c of this.specialFeatureIds)i[`tcf:specialFeature:${c}`]=o.specialFeatureOptIns.has(c);for(let c of this.consentVendorIds)i[`tcf:vendor:${c}`]=o.vendorConsents.has(c);for(let c of this.legitimateInterestVendorIds)i[`tcf:vendorLI:${c}`]=o.vendorLegitimateInterests.has(c);return i}catch{return n}}getCurrentExternalConsentSnapshot(){let e=super.getCurrentExternalConsentSnapshot();return e?{...e,...this.getTcfDowngradeSnapshot()}:void 0}getTcfDowngradeSnapshot(){let e={};for(let n of this.consentPurposeIds)e[`tcf:purpose:${n}`]=this.tcfController.getPurposeConsent(n);for(let n of this.legitimateInterestPurposeIds)e[`tcf:purposeLI:${n}`]=this.tcfController.getPurposeLegitimateInterest(n);for(let n of this.specialFeatureIds)e[`tcf:specialFeature:${n}`]=this.tcfController.getSpecialFeatureOptIn(n);for(let n of this.consentVendorIds)e[`tcf:vendor:${n}`]=this.tcfController.getVendorConsent(n);for(let n of this.legitimateInterestVendorIds)e[`tcf:vendorLI:${n}`]=this.tcfController.getVendorLegitimateInterest(n);return e}acceptAll(){super.acceptAll(),this.tcfController.setPurposeConsents(this.consentPurposeIds,!0),this.tcfController.setPurposeLegitimateInterests(this.legitimateInterestPurposeIds,!0),this.tcfController.setSpecialFeatureOptIns(this.specialFeatureIds,!0),this.tcfController.setVendorConsents(this.consentVendorIds,!0),this.tcfController.setVendorLegitimateInterests(this.legitimateInterestVendorIds,!0)}rejectAll(){super.rejectAll(),this.tcfController.setPurposeConsents(this.consentPurposeIds,!1),this.tcfController.setPurposeLegitimateInterests(this.legitimateInterestPurposeIds,!1),this.tcfController.setSpecialFeatureOptIns(this.specialFeatureIds,!1),this.tcfController.setVendorConsents(this.consentVendorIds,!1),this.tcfController.setVendorLegitimateInterests(this.legitimateInterestVendorIds,!1)}getPurposeConsent(e){return this.tcfController.getPurposeConsent(e)}setPurposeConsent(e,n){if(!this.consentPurposeIds.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.legitimateInterestPurposeIds.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.specialFeatureIds.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.consentVendorIds.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.legitimateInterestVendorIds.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=ot(e),s=ts(e)?Sr(n,this.tcfConfig.gcm!==void 0):void 0;if(!s||!this.isApiDataCompatibleWithCurrentGvl(s))throw new Error("Current TC model cannot produce complete current-GVL web TCData");return s}save(){this.syncTcConsentLanguage(),super.save()}getPurposes(){let e=[];for(let n of new Set([...this.consentPurposeIds,...this.legitimateInterestPurposeIds]))e.push({id:n,consent:this.getPurposeConsent(n),legitimateInterest:this.getPurposeLegitimateInterest(n)});return e}getSpecialFeatures(){let e=[];for(let n of this.specialFeatureIds)e.push({id:n,optIn:this.getSpecialFeatureOptIn(n)});return e}buildConsentEntry(e){return{consent:e,tcString:this.tcfController.toTcString()}}startFreshTcModel(){this.tcfController.startNew(),this.syncTcConsentLanguage()}syncTcConsentLanguage(){let e=rn(this.getDisplayLocale());e&&this.tcfController.setConsentLanguage(e)}getFrameworkPrefix(){return"tcf"}resolve(e){let n=D(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.resolvePurposeBinding(r);case"purposeLegitimateInterest":return this.resolvePurposeLegitimateInterestBinding(r);case"specialPurpose":return this.resolveSpecialPurposeBinding(r);case"feature":return this.resolveFeatureBinding(r);case"specialFeature":return this.resolveSpecialFeatureBinding(r);case"vendor":return this.resolveVendorBinding(r);case"vendorLegitimateInterest":return this.resolveVendorLegitimateInterestBinding(r);case"stack":return this.resolveStackBinding(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=D(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.resolvePurposeBinding(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.resolvePurposeLegitimateInterestBinding(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.resolveSpecialFeatureBinding(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.resolveVendorBinding(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.resolveVendorLegitimateInterestBinding(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.getStackDefinition(i);for(let l of c.purposes)this.consentPurposeIds.includes(l)&&(this.tcfController.setPurposeConsent(l,e.value),this.emit("purpose:toggled",{id:l,value:e.value}));for(let l of c.specialFeatures)this.specialFeatureIds.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.resolveStackBinding(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.consentPurposeIds.includes(l))continue;let d=this.resolvePurposeBinding(l);r.push({bindingKey:"consent:tcf.purpose",id:String(l),value:d.value,disabled:d.disabled})}for(let l of c.specialFeatures){if(!this.specialFeatureIds.includes(l))continue;let d=this.resolveSpecialFeatureBinding(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}}resolvePurposeBinding(e){if(!this.consentPurposeIds.includes(e))throw new Error(`[TCF Engine] Purpose ${e} has no consent legal basis`);return{value:this.getPurposeConsent(e),disabled:!1}}resolvePurposeLegitimateInterestBinding(e){if(!this.legitimateInterestPurposeIds.includes(e))throw new Error(`[TCF Engine] Purpose ${e} has no legitimate-interest legal basis`);return{value:this.getPurposeLegitimateInterest(e),disabled:!1}}resolveSpecialPurposeBinding(e){return{value:!0,disabled:!0}}resolveFeatureBinding(e){return{value:!0,disabled:!0}}resolveSpecialFeatureBinding(e){if(!this.specialFeatureIds.includes(e))throw new Error(`[TCF Engine] Special Feature ${e} was not disclosed`);return{value:this.getSpecialFeatureOptIn(e),disabled:!1}}resolveVendorBinding(e){if(!this.consentVendorIds.includes(e))throw new Error(`[TCF Engine] Vendor ${e} has no consent legal basis`);return{value:this.getVendorConsent(e),disabled:!1}}resolveVendorLegitimateInterestBinding(e){if(!this.legitimateInterestVendorIds.includes(e))throw new Error(`[TCF Engine] Vendor ${e} has no legitimate-interest legal basis`);return{value:this.getVendorLegitimateInterest(e),disabled:!1}}getStackDefinition(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}}resolveStackBinding(e){let n=this.getStackDefinition(e),s=n.purposes.filter(a=>this.consentPurposeIds.includes(a)),r=n.specialFeatures.filter(a=>this.specialFeatureIds.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 yr="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.",wr="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.",ss="Your choices apply only to this service.",rs="Ihre Auswahl gilt nur f\xFCr diesen Dienst.",is="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.",os="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.",Cr="These choices and objections apply only to this service.",vr="Diese Auswahl und Widerspr\xFCche gelten nur f\xFCr diesen Dienst.",br="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.",Er="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 ns(t){return t==="de"?rs:ss}function Ir(t){return t==="de"?os:is}function Tr(t){return t.split("-")[0]?.toLowerCase()==="de"?"de":"en"}function ut(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 Ar(t){return t==="de"?[rs,vr]:[ss,Cr]}function Or(t){return t==="de"?[os,Er]:[is,br]}function Pr(t,e,n=e){let s=Tr(n),r=s==="de"?wr:yr,o=Ar(s),i=Or(s),c=ut(t.description,ns(s),o),a=t.details,l=ut(ut(a?.description??"",ns(s),o),Ir(s),i),d=ut(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 Ne=class extends k{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())}normalizeTranslations(e,n,s){return Pr(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(){this.engine.acceptAll(),this.engine.save(),await this.close()}async rejectAll(){this.engine.rejectAll(),this.engine.save(),await this.close()}};var Jt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",Re=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=_r(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+=Jt[s]}return e}};function _r(t){let e=[1,2];for(;e[e.length-1]<t;)e.push(e[e.length-1]+e[e.length-2]);return e}var v={US_NATIONAL:7,US_CA:8,US_VA:9,US_CO:10,US_CT:12,US_FL:13},Zt={CA:v.US_CA,VA:v.US_VA,CO:v.US_CO,CT:v.US_CT,FL:v.US_FL};function as(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 cs(t){let{notice:e,optOut:n,sensitiveInUse:s,knownMinor:r,mspaFields:o}=as(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 ge=[{name:"MspaCoveredTransaction",bits:2},{name:"MspaOptOutOptionMode",bits:2},{name:"MspaServiceProviderMode",bits:2}],me={[v.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},...ge]},[v.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},...ge]},[v.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},...ge]},[v.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},...ge]},[v.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},...ge]},[v.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},...ge]}};function ls(t,e){if(t===v.US_NATIONAL)return{...cs(e)};let{notice:n,optOut:s,sensitiveInUse:r,knownMinor:o,mspaFields:i}=as(e),c={Gpc:e.gpcDetected,GpcSegmentType:1,GpcSegmentIncluded:!0};if(t===v.US_CA){let p=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(p),KnownChildSensitiveDataConsents:o?[1,1]:[0,0],PersonalDataConsents:0,...i,...c}}let a=me[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 p of a.fields){let m=l[p.name];if(m===void 0)throw new Error(`[GPP Encoder] No value mapping for field: ${p.name}`);d[p.name]="array"in p?new Array(p.array).fill(m):m}return{...d,...a.hasGpc?c:{}}}var Me=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 Re;return n.writeInt(3,6),n.writeInt(1,6),n.writeFibonacciRange(e),n.toBase64()}static encodeSection(e,n){let s=me[e];if(!s)return"";let r=ls(e,n),o=new Re;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 p=l[d];o.writeInt(typeof p=="number"?p:0,2)}}else o.writeInt(typeof a=="number"?a:0,c.bits)}if(!s.hasGpc)return o.toBase64();let i=new Re;return i.writeInt(1,2),i.writeBoolean(r.Gpc===!0),`${o.toBase64()}.${i.toBase64()}`}};var Be=class{bits=[];pos=0;constructor(e){for(let n of e){let s=Jt.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}},Ue=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&&me[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 Be(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=me[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 Be(r),c={};for(let u of s.fields)if("array"in u){let S=[];for(let C=0;C<u.array;C++)S.push(i.readInt(2));c[u.name]=S}else c[u.name]=i.readInt(u.bits);if(c.Version!==1)throw new Error(`[GPP Decoder] Unsupported ${s.prefix} version ${String(c.Version)}`);let l=c.SaleOptOut===1,p=(c.SharingOptOut??c.TargetedAdvertisingOptOut)===1,m=!1;if(e===v.US_NATIONAL||e===v.US_CA){let u=c.SensitiveDataProcessing;m=Array.isArray(u)&&u.some(S=>S===1)}let y=!1;if(s.hasGpc&&o){let u=new Be(o);u.readInt(2)===1&&(y=u.readBit())}return{saleOptOut:l,sharingOptOut:p,gpcDetected:y,limitSensitiveUse:m}}};function pt(){return{optedOutOfSale:!1,optedOutOfShare:!1,limitSensitiveUse:!1,gpcDetected:!1,timestamp:0,lastOptOutAt:0}}var Dr=365*24*60*60*1e3;function Lr(){return Ee()}function ds(){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 xr(){if(typeof globalThis>"u")return;let t=globalThis.__1C_GEO;return typeof t?.sensitiveOptIn=="boolean"?t.sensitiveOptIn:void 0}var ht=class extends ${usState=pt();gpcActive;mspaMode;sensitivePIInUse;knownMinors;visitorUsState;denyAllPosture;storedOptOut=!1;rawConsentStaged=!1;injectedSensitiveVerdict;constructor(e,n,s){super(e,n,s),this.gpcActive=Lr(),this.visitorUsState=ds(),this.injectedSensitiveVerdict=xr();let r=s.us;this.mspaMode=r?.mspaMode??"not_covered",this.sensitivePIInUse=r?.sensitivePIInUse===!0,this.knownMinors=r?.minorsPosture==="known_minors",this.denyAllPosture=r?.denyAll===!0,this.reloadUsProjectionFromStorage();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.hasValidStoredUsDecision();if(super.reloadExternalConsentState(e),!e&&n&&!s){this.failClosedForInvalidExternalDecision();return}this.reloadUsProjectionFromStorage(),e&&(this.rawConsentStaged=!1)}hasValidStoredUsDecision(){let e=this.storage.getConsent();if(!e)return!1;try{T.decodeForConfig(e.consent,this.config)}catch{return!1}if(e.gppString)try{return Ue.decode(e.gppString),!0}catch{}return typeof e.uspString=="string"&&/^1[YN-][YN-][YN-]$/.test(e.uspString)}failClosedForInvalidExternalDecision(){(this.storage.getConsent()||this.storage.getFastPath())&&this.invalidateStoredConsent(),this.usState={...pt(),optedOutOfSale:!0,optedOutOfShare:!0,gpcDetected:this.gpcActive},this.storedOptOut=!1}reloadUsProjectionFromStorage(){this.usState=this.loadUsState(),this.storedOptOut=(this.usState.optedOutOfSale||this.usState.optedOutOfShare)&&!this.knownMinors,this.gpcActive&&(this.usState.gpcDetected=!0),this.isSuppressed()&&(this.usState.optedOutOfSale=!0,this.usState.optedOutOfShare=!0)}isSuppressed(){return this.gpcActive||this.knownMinors}loadUsState(){let e=this.storage.getConsent()??this.storage.getLatestConsent();if(e){let n=0;try{let r=T.decodeForConfig(e.consent,this.config).timestamp*1e3;Number.isSafeInteger(r)&&r>0&&(n=r)}catch(s){console.warn("[US Engine] Stored consent timestamp invalid; fastpath stays cold:",s)}if(e.gppString)try{let{data:s}=Ue.decode(e.gppString),r=s.saleOptOut||s.sharingOptOut;return{optedOutOfSale:s.saleOptOut,optedOutOfShare:s.sharingOptOut,limitSensitiveUse:this.sensitivePIInUse&&(e.limitSensitiveUse??s.limitSensitiveUse)===!0,gpcDetected:!1,timestamp:n,lastOptOutAt:r?n:0}}catch(s){console.warn("[US Engine] Stored GPP string invalid, trying uspString:",s)}if(e.uspString){let s=e.uspString.charAt(2)==="Y";return{optedOutOfSale:s,optedOutOfShare:s,limitSensitiveUse:!1,gpcDetected:!1,timestamp:n,lastOptOutAt:s?n:0}}}return{...pt(),timestamp:Date.now()}}getFrameworkPrefix(){return"us"}acceptAll(){console.log("[US Engine] acceptAll()"),this.isSuppressed()||(this.usState.optedOutOfSale=!1,this.usState.optedOutOfShare=!1,this.usState.limitSensitiveUse=!1),super.acceptAll(),this.usState.timestamp=Date.now()}setCategoryConsent(e,n){this.rawConsentStaged=!0,super.setCategoryConsent(e,n)}setServiceConsent(e,n){this.rawConsentStaged=!0,super.setServiceConsent(e,n)}setConsent(e){this.rawConsentStaged=!0,super.setConsent(e)}save(){if(!this.state.hasConsent&&!this.rawConsentStaged){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.rawConsentStaged=!1}getEvidenceConsentValues(){let e=this.currentUsState();return[...super.getEvidenceConsentValues(),!e.optedOutOfSale,!e.optedOutOfShare,...this.sensitivePIInUse?[!e.limitSensitiveUse]:[]]}rejectAll(){console.log("[US Engine] rejectAll()"),super.rejectAll(),this.usState.optedOutOfSale=!0,this.usState.optedOutOfShare=!0,this.sensitivePIInUse&&(this.usState.limitSensitiveUse=!0),this.markOptOut()}markOptOut(){let e=Date.now();this.usState.timestamp=e,this.usState.lastOptOutAt=e}isWithinReconsentWindow(){let{lastOptOutAt:e}=this.currentUsState();return e>0&&Date.now()-e<Dr}getOptOutOfSale(){return this.usState.optedOutOfSale}setOptOutOfSale(e){if(!e&&this.isSuppressed()){console.warn("[US Engine] Cannot opt back in to sale \u2014 opt-out is locked");return}console.log(`[US Engine] setOptOutOfSale(${e})`),this.usState.optedOutOfSale=e,e?this.markOptOut():this.usState.timestamp=Date.now(),this.emit("consent:changed")}getOptOutOfShare(){return this.usState.optedOutOfShare}setOptOutOfShare(e){if(!e&&this.isSuppressed()){console.warn("[US Engine] Cannot opt back in to sharing \u2014 opt-out is locked");return}console.log(`[US Engine] setOptOutOfShare(${e})`),this.usState.optedOutOfShare=e,e?this.markOptOut():this.usState.timestamp=Date.now(),this.emit("consent:changed")}setOptOutOfSaleAndShare(e){if(!e&&this.isSuppressed()){console.warn("[US Engine] Cannot opt back in to sale/sharing \u2014 opt-out is locked");return}console.log(`[US Engine] setOptOutOfSaleAndShare(${e})`),this.usState.optedOutOfSale=e,this.usState.optedOutOfShare=e,e?this.markOptOut():this.usState.timestamp=Date.now(),this.emit("consent:changed")}getLimitSensitiveUse(){return this.usState.limitSensitiveUse}getSensitivePIInUse(){return this.sensitivePIInUse}setLimitSensitiveUse(e){if(!this.sensitivePIInUse){console.warn("[US Engine] setLimitSensitiveUse ignored \u2014 sensitive PI not in use");return}console.log(`[US Engine] setLimitSensitiveUse(${e})`),this.usState.limitSensitiveUse=e,e?this.markOptOut():this.usState.timestamp=Date.now(),this.emit("consent:changed")}isGpcDetected(){return this.gpcActive}getUsPrivacyState(){return{...this.usState}}getFastPathConsentMap(){return this.projectFastPath().map}projectFastPath(){let e=this.currentUsState(),n=this.state.hasConsent&&this.hasValidConsent(),s=this.sensitivePIInUse&&e.limitSensitiveUse,r=n||this.storedOptOut||this.gpcActive||e.limitSensitiveUse,i=(n?this.getConsentTimestamp():null)??(this.storedOptOut||e.limitSensitiveUse?e.timestamp:0);return e.optedOutOfSale||e.optedOutOfShare||this.isSuppressed()?{map:this.getEssentialOnlyConsents(),decided:r,posture:!r,decisionTimestamp:i}:s?{map:this.sensitiveSuppressedMap(n?super.getFastPathConsentMap():this.getAllGrantedConsents()),decided:r,posture:!r,decisionTimestamp:i}:n?{map:super.getFastPathConsentMap(),decided:!0,posture:!1,decisionTimestamp:i}:this.denyAllPosture?{map:this.getEssentialOnlyConsents(),decided:r,posture:!r,decisionTimestamp:i}:this.sensitivePIInUse&&(this.injectedSensitiveVerdict??yt(this.visitorUsState))?{map:this.sensitiveSuppressedMap(this.getAllGrantedConsents()),decided:r,posture:!r,decisionTimestamp:i}:{map:this.getAllGrantedConsents(),decided:r,posture:!r,decisionTimestamp:i}}getTaggedDenials(){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}sensitiveSuppressedMap(e){let n=this.getTaggedDenials();return n?{...e,...n}:this.getEssentialOnlyConsents()}getEssentialOnlyConsents(){return{...this.getDefaultCategoryConsents(),...this.getDefaultServiceConsents()}}getAllGrantedConsents(){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.projectFastPath(),s=n.decided&&n.decisionTimestamp>0;De(this.config,n.map,{gpcRevocable:!0,posture:n.posture,decisionTimestamp:n.decisionTimestamp,cookieMode:s?"decision":"clear"},e)}buildConsentEntry(e){return{consent:e,uspString:this.getUsPrivacyString(),gppString:this.getGppString(),limitSensitiveUse:this.usState?.limitSensitiveUse===!0}}currentUsState(){return this.usState??pt()}getApplicableGppSections(){let n=we(this.config)&&this.config.us?.stateGeo===!0?ds():void 0;return[(n?Zt[n]:void 0)??v.US_NATIONAL]}getUsNationalSectionData(){let e=this.currentUsState();return{saleOptOut:e.optedOutOfSale,sharingOptOut:e.optedOutOfShare,gpcDetected:e.gpcDetected,mspaMode:this.mspaMode,sensitivePIInUse:this.sensitivePIInUse,limitSensitiveUse:e.limitSensitiveUse,knownMinor:this.knownMinors}}getGppString(){return Me.encode(this.getUsNationalSectionData(),this.getApplicableGppSections())}resolve(e){let n=D(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.resolveSaleBinding();case"share":return this.resolveShareBinding();case"saleAndShare":return this.resolveSaleAndShareBinding();case"limitSensitiveUse":return this.resolveLimitSensitiveUseBinding();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=D(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.resolveSaleBinding();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled})}else if(s==="share"){this.setOptOutOfShare(e.value);let i=this.resolveShareBinding();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled})}else if(s==="limitSensitiveUse"){this.setLimitSensitiveUse(e.value);let i=this.resolveLimitSensitiveUseBinding();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled})}else if(s==="saleAndShare"){this.setOptOutOfSaleAndShare(e.value);let i=this.resolveSaleAndShareBinding();r.push({bindingKey:e.ref.bindingKey,value:i.value,disabled:i.disabled});let c=this.resolveSaleBinding();r.push({bindingKey:"consent:us.sale",value:c.value,disabled:c.disabled});let a=this.resolveShareBinding();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}}resolveSaleBinding(){return{value:this.usState.optedOutOfSale,disabled:this.isSuppressed()}}resolveShareBinding(){return{value:this.usState.optedOutOfShare,disabled:this.isSuppressed()}}resolveSaleAndShareBinding(){return{value:this.usState.optedOutOfSale&&this.usState.optedOutOfShare,disabled:this.isSuppressed()}}resolveLimitSensitiveUseBinding(){return{value:this.usState.limitSensitiveUse,disabled:!this.sensitivePIInUse}}getUsPrivacyString(){return`1Y${this.currentUsState().optedOutOfSale?"Y":"N"}-`}};var $e=class extends k{engine;constructor(e,n){super(e,n),this.engine=new ht(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(){this.engine.acceptAll(),this.engine.save(),await this.close()}async rejectAll(){this.engine.rejectAll(),this.engine.save(),await this.close()}};var Qt=window.__1CONSENT_CONFIG__;if(te(Qt)){let t=Qt,e=new _e,n=new J(new X,N(t)),s=Ct(t)?new Ve(t,{bus:e,storage:n}):vt(t)?new Ne(t,{bus:e,storage:n}):we(t)?new $e(t,{bus:e,storage:n}):null;if(!s)throw new Error("[Design Kit] Unsupported CMP framework config.");let r=Nt(s),o=new Wn(e,s.engine,()=>s.getTranslations(),()=>s.openDetails(),void 0,void 0,i=>s.setLanguage(i),()=>s.getThemeMode());window.__1consent=r,s.setViewEngine(o),s.init().catch(i=>console.error("[Design Kit] Controller init failed",i))}else Qt!==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.");