@1consent/cli 0.1.0-beta.3 → 0.1.0
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.
- package/README.md +10 -11
- package/dist/cli.js +122 -23342
- package/dist/design-kit/index.js +8300 -2661
- package/dist/design-kit/runtime.js +1 -1
- package/dist/design-kit/ui/assets/index.css +1 -1
- package/dist/design-kit/ui/assets/index.js +15 -36
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
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"&>(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.");
|
|
1
|
+
function gt(t){return typeof t=="object"&&t!==null}function oe(t,e){let n=t.base?gt(e)?e[t.base]:void 0:e;t.root==="scope"&&(n=e);for(let r of t.path){if(!gt(n))return;n=n[r]}return n}function Is(t,e){switch(t.k){case"bool":return t.v;case"str":return t.v;case"path":return oe(t.v,e)}}function qt(t,e,n){if(n==null||n===!1){t.removeAttribute(e);return}if(n===!0){t.setAttribute(e,"");return}let r=String(n);if(e==="class"&&(r=r.trim().replace(/\s+/g," ")),r===""&&!e.startsWith("data-1c-")){t.removeAttribute(e);return}if(/^(?:href|src|action|formaction|xlink:href)$/i.test(e))try{if(new URL(r,document.baseURI).protocol==="javascript:"){t.removeAttribute(e);return}}catch{}t.setAttribute(e,r)}function Kn(t){return t==null||t===!1||t===0||t===""?!1:Array.isArray(t)?t.length>0:!0}function ae(t,e,n,r,s,i){switch(t.t){case"text":s.appendChild(document.createTextNode(t.v));break;case"bind":{let o=oe(t.p,e);if(o!=null){let a=String(o);s.appendChild(document.createTextNode(a))}break}case"children":if(i)for(let o of i.nodes)ae(o,i.scope,n,r,s);break;case"each":{let o=oe(t.list,e);if(Array.isArray(o))for(let a of o){let c={...gt(e)?e:void 0,[t.item]:a},l=document.createDocumentFragment();for(let u of t.body)ae(u,c,n,r,l,i);s.appendChild(l)}break}case"if":if(Kn(oe(t.path,e))){let o=document.createDocumentFragment();for(let a of t.body)ae(a,e,n,r,o,i);s.appendChild(o)}break;case"if-not":if(!Kn(oe(t.path,e))){let o=document.createDocumentFragment();for(let a of t.body)ae(a,e,n,r,o,i);s.appendChild(o)}break;case"use":{let o=n[t.name];if(!o){console.warn(`[1CL Executor] Component not found: ${t.name}`);return}let a={};for(let[f,p]of Object.entries(t.props))a[f]=Is(p,e);let c={...gt(e)?e:void 0,props:a},l=t.children&&t.children.length>0?{nodes:t.children,scope:e}:void 0,u=document.createDocumentFragment();for(let f of o)ae(f,c,n,r,u,l);s.appendChild(u);break}case"el":{let o=["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 c of t.attrs)if(c.k==="static")qt(o,c.name,c.value);else if(c.k==="bind"){let l=oe(c.value,e);qt(o,c.name,l)}else if(c.k==="concat"){let l=c.parts.map(u=>u.k==="str"?u.v:String(oe(u.v,e)??"")).join("");qt(o,c.name,l)}let a=document.createDocumentFragment();for(let c of t.kids)ae(c,e,n,r,a,i);o.appendChild(a),s.appendChild(o);break}}}function Wt(t,e,n={}){let r=document.createDocumentFragment(),s=n.view||"main",i=t.views[s];if(!i)return console.error(`[1CL Executor] View not found: ${s}`),r;for(let o of i)ae(o,e,t.components,n,r);return r}function zn(t,e,n,r={}){let s=Wt(t,e,r);n.innerHTML="",n.appendChild(s)}function Fe(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 As=/^[A-Za-z0-9_-]{1,64}$/;var Os=/^[\da-f]{8}(-[\da-f]{4}){3}-[\da-f]{12}$/i,_s=(t,e,n)=>typeof t=="string"&&e.test(t)&&!n?.test(t),Yt=t=>_s(t,As,Os);var xs=Intl.getCanonicalLocales,Ps=t=>{if(!(t.length<2||t.length>255))try{return xs(t)[0]}catch{return}};var Me=t=>typeof t=="string"&&Ps(t)===t;var Ds=1440*60*1e3;var Xt="reload";var ce=5;var Hn="dismiss";function Jt(t){return t.showClose!==!0?"hidden":t.closeMeans??Hn}function Zt(t,e){return e===!1?t.outsideStateBehavior:void 0}var qn=["VA","CO","CT","MT","TX","OR","DE","NH","NJ","MN","NE","MD","TN","FL","IN","KY","RI"];function Qt(t){return t===void 0?!0:qn.indexOf(t.toUpperCase())!==-1}function k(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Wn(t){return k(t)&&Yt(t.appId)&&Yt(t.frameworkId)}function pe(t){if(!k(t))return!1;let e=t;return!(!(typeof e.appId=="string"&&(e.publicIdentity===void 0||Wn(e.publicIdentity))&&typeof e.version=="number"&&k(e.languages)&&Array.isArray(e.languages.supported)&&Me(e.languages.primary)&&e.languages.supported.every(Me)&&new Set(e.languages.supported).size===e.languages.supported.length&&e.languages.supported.includes(e.languages.primary)&&k(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)&&k(e.appearance)&&k(e.framework))||e.machine!=="P"&&e.machine!=="S"&&e.machine!=="D")}function en(t){return t.cmp.trigger?t.framework.type==="us"?!0:!!t.appearance?.trigger:!1}function tn(t){return pe(t)&&t.framework.type==="gdpr"}function nn(t){if(!pe(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=r=>Array.isArray(r)&&r.every(s=>Number.isSafeInteger(s)&&s>0)&&new Set(r).size===r.length,n=[];for(let r of t.vendors){if(!k(r))return!1;let s=r.id;if(typeof s!="number"||!Number.isSafeInteger(s)||s<=0||!e(r.consentPurposeIds)||!e(r.legitimateInterestPurposeIds)||!e(r.flexiblePurposeIds)||!e(r.specialFeatureIds))return!1;n.push(s)}return new Set(n).size===n.length}function Be(t){return pe(t)&&t.framework.type==="us"}var me="1consent";function X(t){return t.browserStorageScope??me}var sn=1;function J(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:ce}:{},primaryLanguage:t.languages.primary}}function he(){return{schemaVersion:sn,apps:{}}}function ge(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function mt(t){return ge(t)&&t.schemaVersion===sn&&ge(t.apps)}function St(t){if(!t)return he();try{let e=JSON.parse(t);return mt(e)?e:he()}catch{return he()}}function Ue(t){return ge(t)?Object.values(t).every(e=>typeof e=="boolean"):!1}function Se(t){return ge(t)&&typeof t.structuralVersion=="string"&&t.structuralVersion.length>0&&Ue(t.services)&&Ue(t.categories)&&Yn(t.categoryOrder)&&Yn(t.serviceOrder)}function rn(t){return Array.isArray(t)&&t.every(e=>typeof e=="string")&&new Set(t).size===t.length}function Yn(t){return t===void 0||rn(t)}function on(t){return ge(t)&&rn(t.categories)&&rn(t.services)}function yt(t){return ge(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&&Ue(t.services)&&Ue(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 an(t,e=Date.now()){return yt(t)?Fe(t.expiresAt,e):!1}var Ns="1consent:browser-store",$e=new WeakSet,Xn=Promise.resolve();function Jn(t){let e=Xn.then(()=>{let n={owner:Symbol("memory-storage-owner")};$e.add(n);try{return t(n)}finally{$e.delete(n)}});return Xn=e.then(()=>{},()=>{}),e}function cn(t){return t!==void 0&&$e.has(t)}async function Zn(t){if(typeof navigator>"u"||!navigator.locks)throw new Error("[BrowserStorage] Native writer is unavailable; initialize the runtime coordinator.");return navigator.locks.request(Ns,async()=>{let e={owner:Symbol("browser-storage-owner")};$e.add(e);try{return await t(e)}finally{$e.delete(e)}})}var Qn=["center-center","bottom-left","bottom-right","bottom-center"],Ls=[...Qn,"panel-right"],er=["left","center"],tr=["accept-first","reject-first"],nr=["left","right","center","full"],rr=["equal","emphasize-accept"];var Co=new Set(er),wo=new Set(tr),vo=new Set(nr),Eo=new Set(rr);function ln(t){let e=c=>typeof c=="object"&&c!==null&&!Array.isArray(c);if(!e(t))return!1;let n=t,r=c=>Array.isArray(c)&&c.every(l=>typeof l=="number"&&Number.isSafeInteger(l)&&l>0),s=c=>Array.isArray(c)&&c.every(l=>typeof l=="string"),i=n.disclosures;if(!Array.isArray(i)||!i.every(c=>{if(!e(c))return!1;let l=c;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"&&s(l.domains)&&r(l.purposes)&&r(l.specialPurposes)&&(l.description===void 0||typeof l.description=="string")&&typeof l.optOut=="boolean"}))return!1;let o=n.domains;if(o!==void 0&&(!Array.isArray(o)||!o.every(c=>e(c)&&typeof c.domain=="string"&&typeof c.use=="string")))return!1;let a=n.sdks;return a===void 0||Array.isArray(a)&&a.every(c=>e(c)&&typeof c.name=="string"&&typeof c.use=="string")}var sr=["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"],To=new Set(sr),Io=sr.filter(t=>t.includes("-")).sort((t,e)=>e.length-t.length);function ks(t){return t.split("-")[0]||"en"}function ir(t){let e=ks(t).toLowerCase();return/^[a-z]{2}$/.test(e)?e:null}function K(t){return t.map(e=>e?"1":"0").join("")}function or(t){let e=t.categories+t.services+t.framework;return e.includes("1")?e.includes("0")?"granular":"accept_all":"deny_all"}function Ct(t){return t.includes("1")?t.includes("0")?"G":"A":"D"}function ar(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)]}function Rs(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let e=Object.entries(t);return e.length===4&&e.every(([n,r])=>{switch(n){case"success":return r===!0;case"eventId":case"consentId":return typeof r=="string"&&r.length>0;case"timestamp":{if(typeof r!="string")return!1;let s=Date.parse(r);return Number.isFinite(s)&&new Date(s).toISOString()===r}default:return!1}})}function cr(t,e,n){return!Number.isInteger(t)||t<100||t>599?"retry":t>=200&&t<300?n!==null&&Rs(e)&&e.eventId===n.eventId&&e.consentId===n.consentId?"acknowledged":"retry":t===408||t===421||t===425||t===429?"retry":t>=400&&t<500?"rejected":"retry"}var dr="1consent";var Ge=["data-1c-service","data-1c-service-tag","data-1c-tag"],je="data-1c-category",un="data-1c-resolved";function fn(t){return t.filter(e=>!e.essential).map(e=>e.id)}function ur(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 F(t,e){let n=t.map(s=>`${s.id}\0${s.name??""}\0${s.tag??""}\0${s.categoryId??""}\0${s.essential?1:0}${s.catalogServiceKey?`\0k\0${s.catalogServiceKey}`:""}${s.usSensitive?"\x001":""}`).sort(),r=e.map(s=>`${s.id}\0${s.name}\0${s.essential?1:0}`).sort();return ur(`s:${n.join("")}|c:${r.join("")}`)}function ye(t,e,n){t[e]=e in t?t[e]===!0&&n:n}function Ke(t,e,n,r){let s=fr(t,e,n,r);return{services:s.services,categories:s.categories}}function fr(t,e,n,r){let s={},i=new Map,o=!1;for(let c of t){let l=c.essential===!0||n[c.id]===!0;if(l&&c.essential!==!0&&(o=!0),ye(s,c.id,l),c.catalogServiceKey&&ye(s,c.catalogServiceKey,l),c.tag&&ye(s,c.tag,l),c.name&&ye(s,c.name,l),c.categoryId){let u=i.get(c.categoryId)??{total:0,granted:0};u.total+=1,l&&(u.granted+=1),i.set(c.categoryId,u)}}let a={};for(let c of e){let l=i.get(c.id),u=l!==void 0&&l.total>0&&l.granted===l.total,f=c.essential===!0||r[c.id]===!0||u;f&&c.essential!==!0&&r[c.id]===!0&&(o=!0),ye(a,c.id,f),ye(a,c.name,f)}return{services:s,categories:a,nonEssentialGranted:o}}function pn(t,e,n,r,s){let i=fr(t,e,n,r),o=s?.decisionTimestamp,a=o!==void 0&&Number.isSafeInteger(o)&&o>0?o+33696e6:0,c={v:F(t,e),e:Number.isSafeInteger(a)?a:0,s:i.services,c:i.categories};return s?.gpcRevocable===!0&&i.nonEssentialGranted&&(c.g=1),s?.posture===!0&&(c.p=1),c}function ze(){return typeof navigator>"u"?!1:navigator.globalPrivacyControl===!0}var hn=2;function pr(t){return t==="A"||t==="D"||t==="G"}var Fs=/^[A-Za-z0-9_-]+$/,Ms=/^[a-z0-9]+$/;function dn(t){return t.length>0&&Fs.test(t)}function Bs(t){return t.length>0&&Ms.test(t)}function Us(t){return t==="gdpr"||t==="tcf"||t==="us"}function $s(t){return t==="P"||t==="S"||t==="D"}function hr(t){return pr(t.decision)&&typeof t.appId=="string"&&dn(t.appId)&&typeof t.frameworkId=="string"&&dn(t.frameworkId)&&Us(t.frameworkType)&&$s(t.machine)&&typeof t.primaryLanguage=="string"&&dn(t.primaryLanguage)&&typeof t.structuralVersion=="string"&&Bs(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 lr(t){if(!/^(0|[1-9]\d*)$/.test(t))return null;let e=Number(t);return Number.isSafeInteger(e)&&String(e)===t?e:null}function gn(t){if(!hr(t))throw new TypeError(dr);return[hn,t.decision,t.appId,t.frameworkId,t.frameworkType,t.machine,t.primaryLanguage,t.structuralVersion,t.consentEpoch,t.expiresAt].join(".")}function mn(t){if(!t)return null;let e=t.split(".");if(e.length!==10||e[0]!==String(hn))return null;let n=e[1],r=e[2],s=e[3],i=e[4],o=e[5],a=e[6],c=e[7],l=e[8],u=e[9];if(!l||!u)return null;let f=lr(l),p=lr(u),h={decision:n,appId:r,frameworkId:s,frameworkType:i,machine:o,primaryLanguage:a,structuralVersion:c,consentEpoch:f,expiresAt:p};return hr(h)?h:null}function Z(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function le(t,e){return Z(t)&&Object.entries(t).every(([n,r])=>/^[1-9]\d*$/.test(n)&&r===!0&&(typeof e=="number"?+n<=e:e[n]===!0))}function Gs(t){return Z(t)&&Object.entries(t).every(([e,n])=>/^(1[01]|[1-9])$/.test(e)&&Z(n)&&Object.entries(n).every(([r,s])=>/^[1-9]\d*$/.test(r)&&+r<=65535&&(s===0||s===1||s===2)))}function gr(t){if(!Z(t)||!Z(t.purpose)||!Z(t.vendor))return!1;let e=t.publisher;return!Z(e)||!Z(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)&&le(t.purpose.consents,11)&&le(t.purpose.legitimateInterests,11)&&Object.keys(t.purpose.legitimateInterests).every(n=>/^(2|[789]|1[01])$/.test(n))&&le(t.vendor.disclosedVendors,65535)&&le(t.vendor.consents,t.vendor.disclosedVendors)&&le(t.vendor.legitimateInterests,t.vendor.disclosedVendors)&&le(t.specialFeatureOptins,2)&&[e.consents,e.legitimateInterests,e.customPurpose.consents,e.customPurpose.legitimateInterests].every(n=>le(n,0))&&Gs(e.restrictions)}function mr(t,e){return`${t}\0${JSON.stringify(e)}`}var Sr={en:"Your choices apply only to this service.",de:"Ihre Auswahl gilt nur f\xFCr diesen Dienst."},yr={en:"These choices and objections apply only to this service.",de:"Diese Auswahl und Widerspr\xFCche gelten nur f\xFCr diesen Dienst."},Sn={en:"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.",de:"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={en:"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.",de:"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."},wr={en:"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.",de:"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."};var He=4095,vr=1,Er=10;function wt(t){return[...new Set(t)].sort((e,n)=>e-n).join(",")}var vt=class{#e;#t;#r;#n=[];#s=null;#i=!1;#c="granular";#o=new Set;#a;constructor(e,n,r,s){this.#t=e,this.#r=s;let i=Math.random()<e.sampleRate;this.#e=r.getConsentId()!==void 0;let o=typeof window<"u"?window.__1C_AB:void 0;if(this.#a=o?{abTestId:o.testId,abVariant:o.variant}:void 0,typeof document>"u"||(n.on("monitoring:error",l=>this.#f(l.payload.code)),!i))return;n.on("view:transition",l=>{this.#l(l.payload.to)}),n.on("view:change",l=>{this.#l(l.payload.view)}),n.on("consent:accepted-all",()=>{this.#c="accept_all"});let a=()=>{this.#c="deny_all"};n.on("consent:rejected-all",a),n.on("consent:rejected",a),n.on("consent:saved",l=>this.#u(l));let c=()=>{document.visibilityState==="hidden"&&this.#d()};document.addEventListener("visibilitychange",c),window.addEventListener("pagehide",()=>this.#d())}#l(e){if(e!=="main"&&e!=="details"||this.#s!==null)return;let n=Date.now();this.#s=n,this.#n.push({type:"impression",usNotice:this.#r==="us",ts:n,hasConsentStored:this.#e,framework:this.#r,...this.#a})}#u(e){if(this.#s===null||this.#i)return;let n=this.#r==="us";if(n&&!e.payload?.usSaleShareOptOut){this.#d();return}this.#i=!0;let r=Date.now();this.#n.push({type:n?"us_opt_out":"decision",ts:r,hasConsentStored:this.#e,framework:this.#r,...this.#a,...n?{noticeTs:this.#s}:{action:this.#c},tToConsentMs:r-this.#s}),this.#d()}#f(e){this.#o.has(e)||(this.#o.add(e),this.#n.push({type:"monitoring",ts:Date.now(),hasConsentStored:this.#e,framework:this.#r,...this.#a,code:e}),this.#d())}#d(){if(this.#n.length===0)return;let e=JSON.stringify({id:crypto.randomUUID(),token:this.#t.token,events:this.#n});this.#n=[];let n=`${this.#t.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 M(t){if(!t.startsWith("consent:"))return null;let e=t.slice(8).split(".");if(e.length!==2)return null;let[n,r]=e;return n!=="gdpr"&&n!=="tcf"&&n!=="us"||!r?null:{framework:n,entity:r}}function Et(t){return M(t)!==null}var qe=class{version=0;getVersion(){return this.version}increment(){return++this.version}reset(){this.version=0}};function z(t,e,n=e){let r={};for(let s of t.categories)r[`category:${s.id}`]=e[s.id]===!0;for(let s of t.services)r[`service:${s.id}`]=n[s.id]===!0;return r}function We(t,e){if(!(!an(e)||e.consentEpoch<(t.consentEpoch??0)||e.structuralVersion!==F(t.services,t.categories)))return e.gpcRevocable&&ze()?z(t,{}):z(t,e.categories,e.services)}function Ce(t,e){return Object.keys(t).some(n=>t[n]===!0&&e[n]!==!0)}function we(t){return t.consentDowngradeBehavior??Xt}function br(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 Ks(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 O={encode(t){let e=[t.machine,t.configId,t.version.toString(36),t.framework,t.state];return t.state==="G"&&t.payload&&e.push(`${t.payload.mode}${t.payload.bits}`),e.push(t.language),e.push(t.timestamp.toString(36)),e.join(".")},decode(t,e={}){return O.decodeAtTime(t,Math.floor(Date.now()/1e3),e)},decodeAtTime(t,e,n={}){let r=t.split("."),s=r[0],i=r[1],o=r[2],a=r[3],c=r[4];if(s!=="P"&&s!=="S"&&s!=="D")throw new Error("Invalid consent string: unsupported machine");if(!i)throw new Error("Invalid consent string: missing config id");if(!o)throw new Error("Invalid consent string: missing codec version");let l=br(o,"codec version");if(l!==1)throw new Error("Invalid consent string: unsupported codec version");if(a!=="gdpr"&&a!=="tcf"&&a!=="us")throw new Error("Invalid consent string: unsupported framework");if(c!=="A"&&c!=="D"&&c!=="G")throw new Error("Invalid consent string: unsupported state");let u=c==="G"?8:7;if(r.length!==u)throw new Error("Invalid consent string: noncanonical component count");let f,p=5;if(c==="G"){let C=r[5];if(!C)throw new Error("Invalid consent string: missing granular payload");let I=C[0],S=C.slice(1);if(I!=="a"&&I!=="d"||!Ks(S))throw new Error("Invalid consent string: malformed granular payload");f={mode:I,bits:S},p=6}let h=r[p],d=r[p+1];if(!h||!d)throw new Error("Invalid consent string: missing language or timestamp");let m=br(d,"timestamp"),b=n.maxFutureSkewSeconds??0;if(m<=0||!Number.isSafeInteger(e)||e<0||!Number.isSafeInteger(b)||b<0||m>e+b)throw new Error("Invalid consent string: timestamp is not a past positive instant");let v={machine:s,configId:i,version:l,framework:a,state:c,...f?{payload:f}:{},language:h,timestamp:m};if(O.encode(v)!==t)throw new Error("Invalid consent string: noncanonical encoding");return v},decodeForConfig(t,e){let n=O.decode(t);if(n.machine!==e.machine||n.configId!==e.appId||n.framework!==e.framework.type)throw new Error("Invalid consent string: decision identity does not match live config");return n},encodeBitset(t){let e=t.filter(Boolean).length,n=t.length-e,r=e<=n?"a":"d",s=r==="a",i=new Uint8Array(Math.ceil(t.length/8));for(let a=0;a<i.length;a++){let c=0;for(let l=0;l<8;l++)t[a*8+l]===s&&(c|=1<<l);i[a]=c}let o=btoa(String.fromCharCode(...i)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");return{mode:r,bits:o}},decodeBitset(t,e){let n=t.bits.replace(/-/g,"+").replace(/_/g,"/"),r=atob(n),s=new Uint8Array(r.length);for(let a=0;a<r.length;a++)s[a]=r.charCodeAt(a);let i=t.mode,o=new Array(e).fill(i!=="a");for(let a=0;a<e;a++){let c=s[Math.floor(a/8)];c!==void 0&&c&1<<a%8&&(o[a]=i==="a")}return o}};var yn=class{#e;#t=typeof window<"u"&&window.origin==="null"&&window.parent!==window&&window.__1cStore||new Map;#r=[];constructor(){let e=`${me}: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 r=this.#r;this.#r=void 0,r?.forEach(s=>{s()})}onPersistenceFailure(e){this.#r?.push(e)??e()}removeItem(e){if(this.#e)try{localStorage.removeItem(e)}catch{this.#e=!1}this.#t.delete(e)}isLocalStorageAvailable(){return this.#e}},de=new yn;var ue=Symbol(),Ye=Symbol(),Tr=Symbol(),Q=Symbol(),Ir=Symbol(),$=Symbol(),Xe=Symbol(),H=Symbol(),Je=Symbol(),ve=Symbol(),bt=Symbol(),Ar=Symbol(),fe=Symbol(),T=Symbol(),zs={run:Zn,isActive:cn},be=class{lease;coordinator;key;constructor(e,n=zs,r=me){this.lease=e,this.coordinator=n,this.key=r}withExclusiveAccess(e){return(de.isLocalStorageAvailable()?this.coordinator.run:Jn)(r=>{let s=this.lease;this.lease=r;try{let i=e();if(i instanceof Promise)throw new Error("[OneConsentStorage] Writes must be synchronous.");return i}finally{this.lease=s}})}isExclusiveAccessHeld(){return cn(this.lease)||this.coordinator.isActive(this.lease)}assertExclusiveAccess(){if(!this.isExclusiveAccessHeld())throw new Error("[OneConsentStorage] Write requires exclusive access.")}read(){return de.getItem(this.key)}write(e){this.assertExclusiveAccess(),de.setItem(this.key,e)}remove(){this.assertExclusiveAccess(),de.removeItem(this.key)}};function ee(){return Math.floor(Date.now()/1e3)}function Te(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Tt(t){return Te(t)&&typeof t.updatedAt=="number"&&Te(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 Ee(t){return Te(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 Ze(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 Ae(t,e){let r=St(t).apps[e.appId];if(!Tt(r)||e.consentContinuityRevision!==void 0&&(r.consentContinuityRevision??0)>e.consentContinuityRevision)return;let s=r.frameworks[e.frameworkId];return Ee(s)&&Ze(s,e)?s:void 0}function Or(t){let e={};for(let n of["gdprChoices","decisionChoices","tcString","uspString","gppString","limitSensitiveUse","explicitSaleSharing","legacyAllowance"]){let r=t[n];r!==void 0&&Reflect.set(e,n,r)}return e}function Qe(t){let e={consent:t.value,firstSeenAt:t.firstSeenAt,lastSeenAt:t.lastSeenAt,...Or(t)};return _r(e)?e:void 0}function Hs(t){return{value:t.consent,firstSeenAt:t.firstSeenAt,lastSeenAt:t.lastSeenAt,...Or(t)}}var Cn=10,Ie=class{[fe];[T];constructor(e,n){this[fe]=e,this[T]=n}withExclusiveAccess(e){return this[fe].withExclusiveAccess?this[fe].withExclusiveAccess(e):Promise.resolve(e())}[ue](e){return e.consentDecisionAt??(e.consent?.lastSeenAt??0)*1e3}[Ye](e){let n=this[H](e);return n&&Ze(n,this[T])?n:void 0}[Tr](e,n,r){}getContinuityScopes(){return[]}getScope(){return this[T]}[Q](){try{return St(this[fe].read())}catch{return he()}}[Ir](e){this[fe].write(JSON.stringify(e))}[$](e){let n=this[Q](),r=e(n);return this[Ir](n),r}[Xe](e){let n=e.apps[this[T].appId];return Tt(n)?n:void 0}[H](e){let n=this[Xe](e)?.frameworks[this[T].frameworkId];return Ee(n)&&n.type===this[T].type?n:void 0}[Je](e,n){let r=this[Xe](e);if(r)return r.updatedAt=n,r;let s={updatedAt:n,frameworks:{}};return e.apps[this[T].appId]=s,s}[ve](e,n){let r=this[Je](e,n),s=r.frameworks[this[T].frameworkId];if(Ee(s)&&Ze(s,this[T]))return s.updatedAt=n,s;let i={type:this[T].type,machine:this[T].machine,configVersion:this[T].configVersion,consentEpoch:this[T].consentEpoch,tcfPolicyVersion:this[T].tcfPolicyVersion,primaryLanguage:this[T].primaryLanguage,updatedAt:n};return Ee(s)&&(s.type===this[T].type&&(i.prior=s.consent??s.prior),s.outbox&&(i.outbox=s.outbox)),r.frameworks[this[T].frameworkId]=i,i}[bt](e){let n=this[H](e);if(n&&(n.consentEpoch??0)>this[T].consentEpoch)throw new Error("[OneConsentStorage] A newer consent epoch is already stored.")}getConsent(){return this.getConsentSnapshot()?.content}getConsentSnapshot(){let e=this[Ye](this[Q]());if(!e?.consent)return;let n=Qe(e.consent);return n?{content:n,decisionAt:this[ue](e)}:void 0}getLatestConsentSnapshot(){let e=this[H](this[Q]()),n=e?.consent??e?.prior;if(e&&(e.consentInvalidatedAt??0)>=Math.max(this[ue](e),(n?.lastSeenAt??0)*1e3))return;let r=n?Qe(n):void 0;return r&&e?{content:r,decisionAt:this[ue](e),prior:!0}:void 0}readDocument(){return this[fe].read()}markConsentUnreadable(){this[$](e=>{if((this[H](e)?.consentEpoch??0)>this[T].consentEpoch)return;let n=this[ve](e,ee());delete n.consent,delete n.prior,delete n.fastPath,n.consentUnreadableAt=Date.now()})}getContents(){let e=this.getConsent();return e?[e]:[]}getConsentId(){return this[Xe](this[Q]())?.consentId}setConsentId(e){let n=ee();this[$](r=>{this[Je](r,n).consentId=e})}updateConsent(e,n){if(!this[Xe](this[Q]())?.consentId)throw new Error("[OneConsentStorage] Call setConsentId() before storing consent.");let r=ee(),s={...e,firstSeenAt:r,lastSeenAt:r};_r(s)&&this[$](i=>this[Ar](i,s,n,r))}[Ar](e,n,r,s){this[bt](e);let i=this[Ye](e)?.consent,o=this[ve](e,s),{configVersion:a,consentEpoch:c,tcfPolicyVersion:l}=this[T];return o.configVersion=a,o.consentEpoch=c,l===void 0&&delete o.tcfPolicyVersion,o.consent=Hs({...n,firstSeenAt:i?.firstSeenAt??s,lastSeenAt:s}),r&&(o.fastPath=r),o.consentDecisionAt=Math.max(Date.now(),this[ue](o)+1,(o.consentInvalidatedAt??0)+1),delete o.consentInvalidatedAt,delete o.consentUnreadableAt,delete o.prior,o}refreshFastPath(e,n){this.setFastPath(e)}amendConsent(e,n){let r=ee();this[$](s=>{this[bt](s);let i=this[Ye](s),o=i?.consent?Qe(i.consent):void 0;if(!i?.consent||!o||JSON.stringify({content:o,decisionAt:this[ue](i)})!==JSON.stringify(e))throw new Error("[OneConsentStorage] Consent changed during an amendment.");let a=this[ve](s,r);a.consent={...i.consent,...n},a.consentDecisionAt=this[ue](i),i.fastPath&&(a.fastPath=i.fastPath),this[Tr](s,a,r)})}setFastPath(e){let n=ee();this[$](r=>{this[bt](r),this[ve](r,n).fastPath=e})}getFastPath(){let e=this[Ye](this[Q]());if(e&&yt(e.fastPath))return e.fastPath}removeFastPath(){let e=ee();this[$](n=>{let r=this[H](n);!r||!Ze(r,this[T])||(r.consentEpoch??0)!==this[T].consentEpoch||(delete r.fastPath,r.updatedAt=e,this[Je](n,e))})}invalidateConsent(){let e=ee();return this[$](n=>{let r=this[H](n);return!r||!Ze(r,this[T])||(r.consentEpoch??0)!==this[T].consentEpoch?!1:(delete r.consent,delete r.fastPath,r.updatedAt=e,this[Je](n,e),!0)})}getPendingEvents(){let e=this[H](this[Q]())?.outbox?.consentEvents;return Array.isArray(e)?e.filter(qs):[]}queuePendingEvent(e){let n=this.getPendingEvents().filter(s=>s.eventId!==e.eventId);n.push(e),n.length>Cn&&console.warn(`[OneConsentStorage] Event queue full: dropping ${n.length-Cn} oldest`);let r=ee();this[$](s=>{this[ve](s,r).outbox={consentEvents:n.slice(-Cn)}})}removePendingEvent(e){let n=this.getPendingEvents().filter(r=>r.eventId!==e);this[$](r=>{let s=this[H](r);s&&(n.length?s.outbox={consentEvents:n}:delete s.outbox)})}};function qs(t){return Te(t)&&typeof t.url=="string"&&typeof t.eventId=="string"&&Te(t.payload)}function _r(t){if(!Te(t))return!1;let{consent:e,firstSeenAt:n,lastSeenAt:r,gdprChoices:s,decisionChoices:i,tcString:o,uspString:a,gppString:c,limitSensitiveUse:l,explicitSaleSharing:u,legacyAllowance:f}=t;return typeof e!="string"||e.length<5||typeof n!="number"||typeof r!="number"||s!==void 0&&(!Se(s)||i!==void 0||o!==void 0||a!==void 0||c!==void 0||l!==void 0)||i!==void 0&&!Se(i)?!1:[o,a,c].every(p=>p===void 0||typeof p=="string")&&(u===void 0||typeof u=="boolean"&&!!c)&&(l===void 0||typeof l=="boolean")&&(f===void 0||on(f))&&!(o!==void 0&&(a!==void 0||c!==void 0))}function xr(t,e){let n=Ae(e,J(t));return We(t,n?.fastPath)}function wn(t,e){let n=Ae(e,J(t)),r=n?.consent??(t.framework.type==="us"?n?.prior:void 0);if(!r)return;let s=r.value;try{O.decodeForConfig(r.value,t),s=r.value.replace(/\.[^.]+(\.[^.]+)$/,"$1")}catch{s=`!${s}`}let i=a=>Object.entries(a).sort(),o=a=>Se(a)?[a.structuralVersion,a.categoryOrder,a.serviceOrder,i(a.categories),i(a.services)]:a===void 0?void 0:[a];return JSON.stringify([s,o(r.gdprChoices),o(r.decisionChoices),r.tcString,r.uspString,r.gppString,r.limitSensitiveUse,r.explicitSaleSharing])}var et=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,r){this.bus=e,this.storage=n,this.config=r}withExclusiveAccess(e){return this.storage.withExclusiveAccess(e)}getConfig(){return this.config}getDisplayLocale(){return this.config.languages.primary}getExternalConsentSnapshot(e){return xr(this.config,e)}getCurrentExternalConsentSnapshot(){let e=this.getEnforcementConsentState();if(e.hasConsent)return z(this.config,{...e.categories,...e.services})}shouldReloadForExternalConsentChange(e,n){if(we(this.config)!=="reload")return!1;let r=e===null&&n===null?this.getCurrentExternalConsentSnapshot():this.getExternalConsentSnapshot(e);if(!r)return!1;let s=this.getExternalConsentSnapshot(n)??{};return Ce(r,s)}hasExternalConsentChange(e,n){return e!==null||n!==null?wn(this.config,e)!==wn(this.config,n):this.getCurrentExternalConsentSnapshot()!==void 0}emit(e){this.bus.emit(e)}on(e,n){return this.bus.on(e,n)}off(e,n){this.bus.off(e,n)}getEnforcementConsentState(){return this.getConsentState()}};function Pr(t){try{let e=JSON.parse(window.sessionStorage.getItem(t)??"{}");return k(e)?e:{}}catch{return{}}}function Dr(t){let e=J(t);return[e.type,e.machine,e.consentEpoch,e.tcfPolicyVersion].join(".")}var Nr=t=>`${t.appId}/${t.framework.id}`;function Lr(t){let e=X(t);try{window.sessionStorage.setItem(e,JSON.stringify({...Pr(e),[Nr(t)]:Dr(t)}))}catch{}}function kr(t){return Jt(t)==="dismiss"&&Pr(X(t))[Nr(t)]===Dr(t)}function tt(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!==F(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 Ws(){let t=globalThis.scheduler;return typeof t=="object"?t:void 0}function It(t){let e=Ws();if(e?.postTask)try{e.postTask(t,{priority:"user-visible"});return}catch{}setTimeout(t,0)}function Rr(){let t=[],e=!1,n=!1,r,s,i=()=>{if(!(e||n)){for(e=!0;!n&&t.length>0;){let o=t.shift();if(!o)break;if(!o.slot.isConnected||!o.allowed())continue;let a=o.recreate(o.source),c=a.hasAttribute("type")?a.type.trim().toLowerCase():a.getAttribute("language")?`text/${a.getAttribute("language")?.trim().toLowerCase()}`:"",l=c===""||/^(?:application|text)\/(?:x-)?(?:java|ecma)script$/.test(c)||/^text\/(?:javascript1\.[0-5]|jscript|livescript)$/.test(c);if(a.src&&l&&!a.hasAttribute("async")&&!a.defer&&!a.noModule){let u=new MutationObserver(()=>{a.isConnected||f()}),f=()=>{r===p&&(p(),e=!1,i())},p=()=>{u.disconnect(),a.removeEventListener("load",f),a.removeEventListener("error",f),r=void 0,s=void 0};r=p,s=()=>{(!a.isConnected||!o.allowed())&&(p(),e=!1)},a.addEventListener("load",f),a.addEventListener("error",f),u.observe(o.slot.ownerDocument,{childList:!0,subtree:!0}),o.slot.replaceWith(a),a.isConnected||f();return}o.slot.replaceWith(a)}e=!1}};return{activate(o,a,c,l){let u=Array.from(o.querySelectorAll("script"),p=>{let h=document.createComment("1c-script");return p.replaceWith(h),{source:p,slot:h,allowed:c,recreate:l}}),f=!e;e=!0,t.push(...u);try{a(o)}finally{f&&(e=!1),i()}},setPaused(o){n=o},recheck(){if(!n){s?.();for(let o=t.length-1;o>=0;o--){let a=t[o];a&&(!a.slot.isConnected||!a.allowed())&&t.splice(o,1)}}},flush:i,clear(){t.length=0,r?.(),e=!1}}}function vn(){return typeof window>"u"?void 0:window.__1CONSENT_CONFIG__}function Vr(t,e={}){let n=document.createElement("script");for(let r of t.attributes)n.setAttribute(r.name,r.value);t.src?t.hasAttribute("async")||(n.async=!1):n.text=t.text||t.textContent||"";for(let r of e.removeAttributes??[])n.removeAttribute(r);return n}var Ys=[...Ge,je].map(t=>`template[${t}]:not([${un}])`).join(",");function Xs(){return document.readyState==="loading"?new Promise(t=>document.addEventListener("DOMContentLoaded",()=>t(),{once:!0})):Promise.resolve()}function Fr(t){return JSON.stringify([t.appId,t.framework.id,t.framework.type,t.machine,t.languages.primary,t.consentEpoch??0])}var At=class{config;#e=Rr();#t;#r;#n=!1;#s;#i={services:{},categories:{}};constructor(e){this.config=e,this.#t=F(e.services,e.categories),this.#r=Fr(e)}setConsent(e,n,r=!1){this.#e.setPaused(r),this.#n=r,n!==void 0&&(this.#s=n===0?void 0:n),this.#i=Ke(this.config.services,this.config.categories,e.services,e.categories),this.#e.recheck()}#c(){let e=vn();return e!==void 0&&Fr(e)===this.#r&&F(e.services,e.categories)===this.#t}async unblockTemplates(e){if(this.#n)return[];if(this.setConsent(e),await Xs(),this.#n||!this.#c())return[];this.#e.flush();let n=document.querySelectorAll(Ys);if(!n.length)return[];let r=new Set;for(let s=0;s<n.length;s++){let i=n[s];if(!(i instanceof HTMLTemplateElement))continue;let o=this.#o(i,this.#i.services,this.#i.categories);if(!o)continue;r.add(o);let a=i.content.cloneNode(!0);a instanceof DocumentFragment&&this.#e.activate(a,c=>i.replaceWith(c),()=>this.#c()&&this.#o(i,this.#i.services,this.#i.categories)!==void 0,c=>Vr(c,{removeAttributes:[...Ge,je]}))}return Array.from(r)}#o(e,n,r){if(this.#s!==void 0&&Date.now()>this.#s)return;for(let i of Ge){let o=e.getAttribute(i);if(o!==null)return n[o]===!0?o:void 0}let s=e.getAttribute(je);if(s!==null&&r[s]===!0)return s}};function Js(t){return k(t)&&"translations"in t&&"themeCSS"in t&&(t.contentLanguage===void 0||Me(t.contentLanguage))}var Zs=250;function nt(t,e){return`${t}::${e}`}function Ot(t){return t==="details"?"details":t==="trigger"?"trigger":"notice"}var q=class{config;services;bus;storage;viewEngine;#e;#t=null;#r=new Map;#n=new Map;#s=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 vt(e.analytics,this.bus,this.storage,e.framework.type),de.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 At(this.config),r=()=>{let s=e.getEnforcementConsentState(),i=this.storage.getFastPath()?.expiresAt??0,o=e.isExternalConsentReconciliationPending();n.setConsent(s,i,o);let a=this.#o();a&&a.updateConsent(s.services);let c=tt(this.config);if(c)try{let l=Ke(this.config.services,this.config.categories,s.services,s.categories);c.updateConsent(l.services,l.categories,i,o)}catch{}It(()=>{if(a?.unblock(),c){c.promote();return}n.unblockTemplates(e.getEnforcementConsentState()).catch(l=>{console.error("Template promotion failed",l)})})};this.bus.on("consent:saved",r),this.bus.on("consent:pending",r),this.bus.on("notice:dismissed",()=>{e.isConsentRequired()&&Lr(this.config)}),this.bus.on("consent:external",()=>{r(),!this.bus.visitorInitiatedPrivacy&&e.isConsentRequired()&&this.openNotice().catch(()=>{})}),r()}#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(){let e=this.#a();if(!e||e===this.#e)return;let n=this.config.languages.supported.find(r=>r===e);n&&(this.#e=n,this.bus.emit({type:"language:changed",payload:{locale:n}}))}#a(){let e=this.storage.getLatestConsentSnapshot()?.content.consent;if(e)try{return O.decodeForConfig(e,this.config).language}catch{return}}getLanguage(){return this.#e}getTranslations(){return this.#t}async setLanguage(e){if(e===this.#e&&this.#t)return;let n=Ot(this.viewEngine?.getCurrentView()),r=this.#r.get(nt(e,n));if(r){this.#t=r,this.#e=e,await this.storage.withExclusiveAccess(()=>this.bus.emit({type:"language:changed",payload:{locale:e}}));return}let s=await this.#l(e,n);if(s===null)throw new Error(`[1Consent] ui-data for ${e}/${n} unavailable`);this.#t=s.translations,this.#e=e,await this.storage.withExclusiveAccess(()=>this.bus.emit({type:"language:changed",payload:{locale:e}}))}hasViewData(e){return e==="none"?!0:this.#r.has(nt(this.#e,Ot(e)))}async ensureViewData(e){if(e==="none")return;let n=this.#e,r=Ot(e),s=this.#r.get(nt(n,r));if(s){this.#t=s;return}let i=await this.#l(n,r);i?.translations&&n===this.#e&&(this.#t=i.translations)}#l(e,n){let r=nt(e,n),s=this.#n.get(r);if(s)return s;let i=(async()=>{try{let o=await this.#u(e,n);return this.#d(e,n,o),o}catch(o){return this.#n.delete(r),console.error(`[1Consent] ui-data for ${r} unavailable after retry. Labels and theme may be missing.`,o),null}})();return this.#n.set(r,i),i}async#u(e,n){try{return await this.#f(e,n)}catch{return await new Promise(r=>setTimeout(r,Zs)),await this.#f(e,n)}}async#f(e,n){let r=this.config.cmp.uiData.replace("{locale}",e).replace("{view}",n),s=await fetch(r);if(!s.ok)throw new Error(`HTTP ${s.status}`);let i=await s.json();if(!Js(i))throw new Error(`unexpected ui-data payload shape for ${e}/${n}`);return i.translations?{...i,translations:{...this.normalizeTranslations(i.translations,e,i.contentLanguage),contentLanguage:i.contentLanguage}}:i}normalizeTranslations(e,n,r){return e}#d(e,n,r){r.translations&&this.#r.set(nt(e,n),r.translations),r.themeCSS!==this.#s&&(this.#s=r.themeCSS,this.viewEngine?.setThemeCSS(r.themeCSS)),r.translations&&e===this.#e&&this.#t===null&&this.viewEngine&&this.viewEngine.getCurrentView()!=="none"&&Ot(this.viewEngine.getCurrentView())===n&&(this.#t=r.translations,this.viewEngine.refreshCurrentView())}getThemeMode(){return this.#i}setThemeMode(e){this.#i=e,this.bus.emit({type:"theme:changed",payload:{mode:e}})}#p;#g;setViewEngine(e){this.viewEngine=e,this.#s!==null&&e.setThemeCSS(this.#s)}setViewEngineFactory(e){this.#p=e}async ensureViewEngine(){if(!this.viewEngine&&this.#p){this.#g??=this.#p().catch(n=>{throw this.#g=void 0,n});let e=await this.#g;this.viewEngine||this.setViewEngine(e)}return this.viewEngine}get activeViewEngine(){return this.viewEngine}async showReturningVisitorTrigger(){if(!en(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 showInitialNotice(){if(kr(this.config)){await this.showReturningVisitorTrigger();return}let e=this.ensureViewData("main");await this.ensureViewEngine(),await Promise.all([this.ensureViewLoaded("main"),e])}async openNotice(){await(await this.ensureViewEngine())?.transitionTo("main","programmatic")}async openDetails(){await(await this.ensureViewEngine())?.transitionTo("details","programmatic")}async close(){await this.viewEngine?.transitionTo("none","programmatic")}async ensureViewLoaded(e){let n=await this.ensureViewEngine();!n||n.hasDesign(e)||await n.ensureViewBundle(e)}};function Qs(t,e){return t[e]??=new Set,t[e]}var rt=class{#e={};on(e,n){return Qs(this.#e,e).add(n),()=>this.off(e,n)}off(e,n){this.#e[e]?.delete(n)}emit(e){let n=this.#e[e.type];if(n)for(let r of n)r(e)}};function En(t){document.cookie=t}function Mr(t,e,n){let r=e();return r?Promise.resolve(r):new Promise((s,i)=>{let o=document.createElement("script");o.src=t,o.async=!0,o.onload=()=>{let a=e();a?s(a):(o.remove(),i(new Error(`[1consent] ${n} bundle loaded but did not register runtime`)))},o.onerror=()=>{o.remove(),i(new Error(`[1consent] failed to load ${n} bundle: ${o.src}`))},(document.head||document.documentElement).appendChild(o)})}async function _t(t){let e=globalThis.navigator?.locks,n=t.consentContinuity!==void 0,r=X(t),s=J(t);if(!n&&e)return new Ie(new be(void 0,void 0,r),s);let i=new URL(`${t.cmp.base}/runtime/${n?"experiment":"coordinator"}.v${t.signalsVersion||"1.0.0"}.js`,document.baseURI).href,o=await Mr(i,()=>{let c=n?window.__1CONSENT_EXPERIMENT_STORAGE__:window.__1CONSENT_STORAGE_COORDINATOR__;return c?.source===i&&typeof c.create=="function"===n?c:void 0},n?"experiment storage":"storage coordinator"),a=new be(void 0,e?void 0:o.coordinator,r);return o.create?o.create(t,a):new Ie(a,s)}function Br(t,e){let n=(r,s)=>K(r.filter(i=>!i.essential).map(i=>s[i.id]===!0));return Ct(n(t.categories,e.categories)+n(t.services,e.services))}function st(t,e,n,r){let s=pn(t.services,t.categories,e,e,n),i={structuralVersion:s.v,consentEpoch:t.consentEpoch??0,expiresAt:s.e,services:s.s,categories:s.c};if(n&&(n.decisionIntegrity&&(i.decisionIntegrity=n.decisionIntegrity),n.tcfCmpId!==void 0&&(i.tcfCmpId=n.tcfCmpId),n.tcfValidationVersion!==void 0&&(i.tcfValidationVersion=n.tcfValidationVersion),n.tcfDisclosedVendorKey!==void 0&&(i.tcfDisclosedVendorKey=n.tcfDisclosedVendorKey),n.tcfApiData!==void 0&&(i.tcfApiData=n.tcfApiData),n.tcfApiDataIntegrity!==void 0&&(i.tcfApiDataIntegrity=n.tcfApiDataIntegrity)),s.g===1&&(i.gpcRevocable=!0),s.p===1&&(i.posture=!0),r)r(i);else try{typeof localStorage<"u"&&_t(t).then(o=>o.withExclusiveAccess(()=>o.setFastPath(i))).catch(o=>console.error("[1Consent] Fast-path persistence failed",o))}catch{}return n?.cookieMode==="clear"?W(t):n?.cookieMode!=="omit"&&ei(t,e,s),tt(t)?.updateConsent(s.s,s.c,s.e),It(()=>{try{tt(t)?.promote()}catch{}}),s}function xt(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)}var Ur="; Path=/; SameSite=Lax";function W(t){if(globalThis.document)try{let e=X(t),n=`${e}=`,r=document.cookie.split(";").map(i=>i.trim()).find(i=>i.startsWith(n))?.slice(n.length),s=mn(r);if(s&&Fe(s.expiresAt)&&(s.appId!==t.appId||s.frameworkId!==t.framework.id||s.frameworkType!==t.framework.type||s.machine!==t.machine||s.primaryLanguage!==t.languages.primary||s.consentEpoch>(t.consentEpoch??0)))return;En(`${e}=${Ur}; Max-Age=0`)}catch{}}function ei(t,e,n){if(globalThis.document){if(!t.syncCookie||!Fe(n.e)){W(t);return}try{let r=gn({decision:Br(t,{categories:e,services: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}),s=globalThis.location?.protocol==="https:";En(`${X(t)}=${r}${Ur}; Expires=${new Date(n.e).toUTCString()}${s?"; Secure":""}`)}catch{}}}function ti(t){return typeof t=="object"&&t!==null&&["getConsent","setConsent","acceptAll","rejectAll","setCategoryConsent","setServiceConsent"].every(e=>typeof Reflect.get(t,e)=="function")}function bn(t){let e="engine"in t?t.engine:void 0,n=ti(e)?e:void 0,r=n?new Proxy({...n,setConsent:o=>t.storage.withExclusiveAccess(()=>n.setConsent(o))},{has(o,a){return Reflect.has(n,a)||Reflect.has(o,a)},get(o,a){if(a==="setConsent")return o.setConsent;let c=Reflect.get(n,a,n);if(typeof c!="function")return c;let l=c.bind(n);return["save","reconcileExternalConsentChange"].includes(String(a))?(...u)=>t.storage.withExclusiveAccess(()=>l(...u)):l}}):void 0,s=t.openNotice.bind(t),i={openDetails:t.openDetails.bind(t),close:t.close.bind(t),acceptAll:t.acceptAll.bind(t),rejectAll:t.rejectAll.bind(t)};return{config:t.config,init:t.init.bind(t),openNotice:s,...i,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:s,...i},registerDesign:(o,a)=>t.activeViewEngine?.registerDesign(o,a),getView:()=>{let o="engine"in t?t.engine:void 0;return o&&typeof o=="object"&&"isConsentRequired"in o&&typeof o.isConsentRequired=="function"&&o.isConsentRequired()?"main":null},get engine(){return r},get viewEngine(){return t.activeViewEngine}}}var ni={theme:"primary",position:"bottom-right",size:"default"};function ri(t,e){if(t)return t;let n=e.toLowerCase();return n==="us"||n==="tcf"?{...ni}:void 0}var si=/^[A-Za-z0-9_-]{1,64}$/,ii=/^[A-Za-z0-9_-]{12}$/,oi=/^[\da-f]{8}(-[\da-f]{4}){3}-[\da-f]{12}$/i,ts=(t,e,n)=>typeof t=="string"&&e.test(t)&&!n?.test(t),$r=t=>ts(t,si,oi),ai=t=>ts(t,ii),ci=Intl.getCanonicalLocales,li=t=>{if(!(t.length<2||t.length>255))try{return ci(t)[0]}catch{return}},On=t=>typeof t=="string"&&li(t)===t;function N(t){return typeof t=="object"&&!!t&&!Array.isArray(t)}function di(t){return N(t)&&$r(t.appId)&&$r(t.frameworkId)}function ns(t){if(!N(t))return!1;let e=t;return!(!(typeof e.appId=="string"&&(e.publicIdentity===void 0||di(e.publicIdentity))&&typeof e.version=="number"&&N(e.languages)&&Array.isArray(e.languages.supported)&&On(e.languages.primary)&&e.languages.supported.every(On)&&new Set(e.languages.supported).size===e.languages.supported.length&&e.languages.supported.includes(e.languages.primary)&&N(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)&&N(e.appearance)&&N(e.framework))||e.machine!=="P"&&e.machine!=="S"&&e.machine!=="D")}function ui(t){return t.cmp.trigger?t.framework.type==="us"||!!t.appearance?.trigger:!1}function Tn(t){if(!ns(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=r=>Array.isArray(r)&&r.every(s=>Number.isSafeInteger(s)&&s>0)&&new Set(r).size===r.length,n=[];for(let r of t.vendors){if(!N(r))return!1;let s=r.id;if(typeof s!="number"||!Number.isSafeInteger(s)||s<=0||!e(r.consentPurposeIds)||!e(r.legitimateInterestPurposeIds)||!e(r.flexiblePurposeIds)||!e(r.specialFeatureIds))return!1;n.push(s)}return new Set(n).size===n.length}function Gr(t){return ns(t)&&t.framework.type==="us"}function _n(t,e,n,r){let s=t?.[e],i=s?s.description:r;return{name:s?.name??n??e,description:i||null}}var fi={filled:"primary",outlined:"secondary",link:"link"};function pi(t){let e=t?.preferencesControl??"outlined";return{showPreferencesButton:e!=="none",preferencesButtonVariant:e==="none"?null:fi[e],showPreferencesDescriptionLink:e==="none"||t?.preferencesDescriptionLink===!0}}function hi(t,e){let n=(t.services||[]).map(s=>({...s,..._n(e?.services,s.id,s.name??s.tag)})),r=t.categories.map(s=>({...s,..._n(e?.categories,s.id,s.name),services:n.filter(i=>i.categoryId===s.id)})).filter(s=>s.services.length>0);return{categories:r,services:n,uncategorizedServices:n.filter(s=>!r.some(i=>i.id===s.categoryId)),appearance:{...t.appearance,useSwitchCategories:t.appearance?.categoryToggleType==="switch",useCheckboxCategories:t.appearance?.categoryToggleType!=="switch",useSwitchServices:t.appearance?.serviceToggleType!=="checkbox",useCheckboxServices:t.appearance?.serviceToggleType==="checkbox",...pi(t.appearance?.notice),rejectFirst:t.appearance?.notice.buttonOrder!=="accept-first",showClose:t.showClose===!0}}}function jr(t){return["openMain","openDetails","close","acceptAll","rejectAll","save","reset"].includes(t)}var xn={open:"openMain",openNotice:"openMain"};function gi(t,e=xn){if(jr(t))return t;let n=e[t];if(!n)throw Error(`[1CL] Unknown command: ${t}. No alias mapping found.`);if(!jr(n))throw Error(`[1CL] Invalid alias target: ${t} \u2192 ${n}. Alias targets must be canonical commands.`);return n}function mi(t){return t?{...xn,...t}:xn}function In(t){return Array.isArray(t)&&t.every(e=>typeof e=="string")}function rs(t){return!t||typeof t!="object"||Object.entries(t).every(([e,n])=>e.endsWith("Url")?/^(https?:\/\/|mailto:[^@\s]+@[^@\s]+$)/i.test(String(n)):rs(n))}function Oe(t,e){return Array.isArray(t)&&t.every(n=>N(n)&&e.every(r=>typeof n[r]=="string"))}function Si(t){return Kr(t)&&(t.localized===void 0||N(t.localized)&&Object.entries(t.localized).every(([e,n])=>On(e)&&Kr(n)&&!("localized"in n)&&n.id===t.id))}function Kr(t){if(!N(t)||typeof t.id!="string"||typeof t.name!="string")return!1;let e=t.declaration;if(!N(e))return!1;let n=e.deviceStorage,r=e.legalProfile,s=[[e.parties,["key","name","kind"]],[e.dataSources,["name"]],[e.recipients,["name"]],[e.processingLocations,["name"]],[e.retention,["period"]],[e.transfers,["destination"]]].every(([c,l])=>c===void 0||Oe(c,l)),i=r==null||N(r)&&typeof r.label=="string"&&[[r.processingGrounds,["basis","label"]],[r.partyRoles,["partyKey","role"]]].every(([c,l])=>Oe(c,l))&&In(r.rights),o=t.operational,a=o==null||N(o)&&(o.domains===void 0||Oe(o.domains,["domain","use"]))&&(o.sdks===void 0||Oe(o.sdks,["name","use"]));return(t.description==null||typeof t.description=="string")&&a&&s&&rs(t)&&Oe(e.purposes,["key","name"])&&In(e.dataCategories)&&In(e.technologies)&&(n===null||N(n)&&Oe(n.items,["key","type"]))&&N(e.links)&&Object.values(e.links).every(c=>typeof c=="string")&&i}function Nt(t,e){let n=t.templateLabels?.[e];if(typeof n!="string"||!n.trim())throw Error(`[TemplateLabels] Translate ui.templateLabels.${e} before using this design`);return n}function ss(t,e){let n=s=>{let i=s.base?[s.base,...s.path]:s.path;i[0]==="ui"&&i[1]==="templateLabels"&&i[2]&&Nt(e,i[2])},r=s=>{for(let i of s){if(i.t==="bind"&&n(i.p),i.t==="el"){for(let o of i.attrs)if(o.k==="bind"&&n(o.value),o.k==="concat")for(let a of o.parts)a.k==="bind"&&n(a.v);r(i.kids)}if((i.t==="each"||i.t==="if"||i.t==="if-not")&&r(i.body),i.t==="use"){for(let o of Object.values(i.props))o.k==="path"&&n(o.v);i.children&&r(i.children)}}};for(let s of[...Object.values(t.views),...Object.values(t.components)])r(s)}var yi=["data-1c","data-1c-action","data-1c-id"];function is(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:yi.map(r=>{let s=n.getAttribute(r);return s?`[${r}="${CSS.escape(s)}"]`:""}).join("")}}function os(t,e){let n=t?.element.isConnected?t.element:t?.selector?e?.querySelector(t.selector):null;n instanceof HTMLElement&&n.focus({preventScroll:!0})}var Ci=["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 as(t){return Array.from(t.querySelectorAll(Ci)).filter(e=>e instanceof HTMLElement&&e.getAttribute("tabindex")!=="-1"&&!e.closest("[hidden], [inert], [aria-hidden='true']"))}function wi(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):as(t)[0]||(t.hasAttribute("tabindex")||(t.tabIndex=-1),t)}function vi(t){let e=[],n=t;for(;;){let r=n.parentElement;if(r){for(let i of Array.from(r.children))i instanceof HTMLElement&&i!==n&&(e.push({element:i,inert:i.inert}),i.inert=!0);if(r===document.body)break;n=r;continue}let s=n.getRootNode();if(!(s instanceof ShadowRoot))break;for(let i of Array.from(s.children))i instanceof HTMLElement&&i!==n&&(e.push({element:i,inert:i.inert}),i.inert=!0);if(!(s.host instanceof HTMLElement))break;n=s.host}return e}function cs(t,e,n){let r=vi(e),s=document.documentElement.style,i=s.getPropertyValue("overflow"),o=s.getPropertyPriority("overflow");s.setProperty("overflow","hidden");let a=l=>{if(l.key==="Escape"){if(!n||l.isComposing)return;l.preventDefault(),l.stopPropagation(),n();return}if(l.key!=="Tab")return;let u=as(t);if(u.length===0){l.preventDefault(),t.focus({preventScroll:!0});return}let f=u[0],p=u[u.length-1];if(!f||!p)return;let h=t.getRootNode(),d=h instanceof ShadowRoot?h.activeElement:document.activeElement;l.shiftKey&&(d===f||!t.contains(d))?(l.preventDefault(),p.focus()):!l.shiftKey&&(d===p||!t.contains(d))&&(l.preventDefault(),f.focus())};t.addEventListener("keydown",a),wi(t).focus({preventScroll:!0});let c=!0;return()=>{if(c){c=!1,t.removeEventListener("keydown",a);for(let l of r)l.element.inert=l.inert;i?s.setProperty("overflow",i,o):s.removeProperty("overflow")}}}var Ei=["website_operator","representative","service_provider","infrastructure_provider","recipient","other"],bi=["cookie","local_storage","session_storage","indexed_db","cache_storage","other"],Ti=["voluntary","required","conditional","not_applicable","operator_determined"],Ii=["controller","processor","joint_controller","independent_controller","responsible_party","operator","business","service_provider","contractor","third_party","recipient","representative"],Pt=["yes","no","conditional","unknown"];function te(t,e,n){if(!e.includes(t))throw Error(`[ServiceDetail] Unsupported ${n}: ${t}`);return{[t]:!0}}function Ai(t){let{declaration:e}=t,{legalProfile:n,deviceStorage:r}=e,s=n?.usPrivacy;return{...t,declaration:{...e,parties:e.parties?.map(i=>({...i,kindFlags:te(i.kind,Ei,"party kind")})),deviceStorage:r&&{...r,items:r.items.map(i=>({...i,typeFlags:te(i.type,bi,"storage type")}))},legalProfile:n&&{...n,partyRoles:n.partyRoles.map(i=>{let o=e.parties?.find(a=>a.key===i.partyKey);if(!o)throw Error(`[ServiceDetail] Missing legal-role party: ${i.partyKey}`);return{...i,partyName:o.name,roleFlags:te(i.role,Ii,"legal role")}}),provisionRequirements:n.provisionRequirements?.map(i=>({...i,statusFlags:te(i.status,Ti,"provision status")})),usPrivacy:s&&{...s,saleFlags:te(s.sale,Pt,"sale practice"),sharingFlags:te(s.sharing,Pt,"sharing practice"),targetedAdvertisingFlags:te(s.targetedAdvertising,Pt,"targeted advertising practice"),sensitiveDataFlags:te(s.sensitiveData,Pt,"sensitive data practice")}}}}}function zr(t,e,n,r){let s=["id","data-1c","data-1c-id","href","name","aria-label"].flatMap(a=>{let c=e.getAttribute(a);if(!c)return[];let l=a==="aria-label"?Object.keys(n?.templateLabels??{}).find(u=>n?.templateLabels?.[u]===c):void 0;return[{name:a,value:l?r?.templateLabels?.[l]??c:c}]}),i=e.getAttribute("class");if(!s.length&&i&&s.push({name:"class",value:i}),!s.length)return null;let o=Array.from(t.querySelectorAll(e.localName)).filter(a=>a instanceof HTMLElement&&s.every(({name:c,value:l})=>a.getAttribute(c)===l));return o.length===1?o[0]??null:null}var Hr=new Map,G=null,Pn=0,Lt=null;async function qr(t,e,n,r,s,i){let o=s||document.body,a=e.cmp.serviceDetails;if(G?.element.dataset.serviceId===t&&G.element.parentNode===o&&G.snapshot===a)return;let c=is(o);_e();let l=++Pn;Lt=o;let u=typeof i=="function"?await i():null;if(typeof i=="function"&&!u)return;let f=typeof i=="function"?u?.():i;if(!f){let I=e.cmp.serviceIds?.[t];if(!ai(I))throw Error("[ServiceDetail] Public service identity is missing or invalid");let S=e.cmp.serviceDetails.replace("{serviceId}",I),g=`${S}${S.includes("?")?"&":"?"}schema=2`;if(f=Hr.get(g),!f){let x=await _i(t,g);if(!x)return;Hr.set(g,x),f=x}if(f.id!==t){console.error(`[ServiceDetail] Cached response identity does not match ${t}`);return}}if(l!==Pn)return;let p=f,h=u??(()=>p);Lt=null;let d=document.createElement("div");d.dataset.serviceId=t;let m=()=>{},b=null,v=(I=()=>{})=>{let S=r();if(!S)throw Error("[Modal] Missing i18n");ss(n,S);let g=b,x=h(),B=S.contentLanguage,L=(B?x.localized?.[B]??x.localized?.[B.split("-")[0]??B]:void 0)??x,se=_n(S.vendors?.services,t,L.name,L.description),y=Wt(n,{service:Ai({...L,...se}),ui:S},{view:"service-detail"}),_=o instanceof ShadowRoot?o.activeElement:document.activeElement,P=Array.from(d.querySelectorAll("*")).filter(E=>E.scrollTop||E.scrollLeft).map(E=>({element:E,top:E.scrollTop,left:E.scrollLeft}));m(),I(),b=S,d.replaceChildren(y),d.isConnected||o.appendChild(d),d.inert=!1;let w=d.querySelector('[role="dialog"]');m=w instanceof HTMLElement?cs(w,d):()=>{};for(let E of P){let D=zr(d,E.element,g,S);D&&(D.scrollTop=E.top,D.scrollLeft=E.left)}_ instanceof HTMLElement&&zr(d,_,g,S)?.focus({preventScroll:!0});let R=d.querySelector(".oc-service-modal__overlay");R?.addEventListener("click",E=>{E.target===R&&_e()}),d.querySelector('[data-1c="command:closeServiceDetail"]')?.addEventListener("click",E=>{E.preventDefault(),_e()}),requestAnimationFrame(()=>{R?.classList.add("oc-service-modal--visible")})};v();let C=I=>{I.key==="Escape"&&_e()};document.addEventListener("keydown",C),G={element:d,snapshot:a,refresh:v,cleanup:()=>{m(),document.removeEventListener("keydown",C),os(c,o)}}}function Oi(t,e=()=>{}){G&&G.element.parentNode===t?G.refresh(e):e()}function _e(t){if(t&&G?.element.parentNode!==t&&Lt!==t)return;Pn+=1,Lt=null;let e=G;G=null,e?.cleanup(),e?.element.remove()}async function _i(t,e){try{let n=await fetch(e);if(n.ok){let r=await n.json();if(Si(r)&&r.id===t)return r}}catch{}return console.error(`[ServiceDetail] Request failed for ${t}`),null}function xi(t,e,n){if(t===null)return Nt(n,"storageDurationNotApplicable");if(t===0)return Nt(n,"storageDurationSession");let r=[{unit:"day",seconds:86400},{unit:"hour",seconds:3600},{unit:"minute",seconds:60},{unit:"second",seconds:1}],s=t,i=[];for(let o of r){let a=Math.floor(s/o.seconds);s%=o.seconds,a>0&&i.push(new Intl.NumberFormat(e,{style:"unit",unit:o.unit,unitDisplay:"short"}).format(a))}return i.join(" ")}async function Pi(t,e,n,r,s){let i=new URL(n.cmp.serviceDetails.replace("{serviceId}","__tcf_vendor_selector__"),window.location.href),o=i.pathname.match(/^\/v\/([^/]+)\/services\/__tcf_vendor_selector__(?:\.json)?$/)?.[1];if(!o)return null;let a=new URL(`/v/${o}/tcf-vendors/${encodeURIComponent(t)}/storage.json`,i.origin),c=i.searchParams.get("version"),l=i.searchParams.get("stage");if(c)a.searchParams.set("version",c);else if(l==="preview")a.searchParams.set("stage",l);else return null;let u=await fetch(a);if(!u.ok)return null;let f=await u.json();if(!ln(f))return null;let p=f.disclosures,h=f.domains??[],d=f.sdks??[];return p.length===0&&h.length===0&&d.length===0?null:()=>{let m=s();if(!m)throw Error("[VendorStorage] Missing i18n");let b=r(),v=g=>Nt(m,g),C=p.map(g=>{let x=xi(g.maxAgeSeconds,b,m),B=[g.description,g.domains.length>0?`${v("storageDomains")}: ${g.domains.join(", ")}`:void 0,g.purposes.length>0?`${v("purposes")}: ${g.purposes.map(L=>`P${L}`).join(", ")}`:g.specialPurposes.length===0?v("storageNonTcfPurpose"):void 0,g.specialPurposes.length>0?`${v("storageSpecialPurposes")}: ${g.specialPurposes.map(L=>`SP${L}`).join(", ")}`:void 0,g.optOut?v("storageOptOut"):void 0,g.cookieRefresh?v("storageRefreshed"):void 0].filter(L=>!!L);return{key:g.identifier,type:g.type,duration:x,description:B.join(" \xB7 ")}}),I=Array.from(new Set(p.flatMap(g=>g.purposes).map(g=>v("storagePurpose").replace("{id}",String(g))))),S=Array.from(new Set([...p.map(g=>g.type),...d.map(g=>`${v("storageSdk")}: ${g.name}`)]));return{id:`vendor-${t}`,name:e??v("storageVendor").replace("{id}",t),...I.length>0&&{purposes:I},...S.length>0&&{technologiesUsed:S},...C.length>0&&{storage:{items:C}},operational:h.length>0||d.length>0?{...h.length>0&&{domains:h},...d.length>0&&{sdks:d}}:null,declaration:{purposes:I.map((g,x)=>({key:String(x),name:g})),dataCategories:[],technologies:S,deviceStorage:C.length>0?{items:C.map(g=>({...g,type:g.type==="cookie"?"cookie":"other"}))}:null,links:{}}}}}function Wr(t){let e=t.indexOf(":");if(e===-1)return console.warn(`[1CL] Invalid command binding format: ${t}`),null;let n=t.substring(0,e).trim();return n!=="command"&&n!=="consent"&&n!=="view"&&n!=="dataset"?(console.warn(`[1CL] Unknown command type: ${n}`),null):{type:n,name:t.substring(e+1).trim()}}function Yr(t,e){let n=gi(e,mi()),r={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:()=>_e()}[n];r?r():console.warn(`[1CL] Unknown canonical command: ${n}`)}function Xr(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 Di(t,e,n){if(!t.engine){console.error("[1CL] SDK engine not available");return}let r=n.querySelector('input[type="checkbox"]');if(r instanceof HTMLInputElement){let s=r.checked;if(e.startsWith("category:")){let i=e.substring(9);Jr(t.engine,`category:${i}`,s)}else if(e.startsWith("service:")){let i=e.substring(8);Jr(t.engine,`service:${i}`,s)}}}function Jr(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 Ni(t,e,n){let r=s=>{let i=s.target;if(!(i instanceof Element))return;let o=i.getAttribute("data-1c-backdrop");if(o){let u=Wr(o);u&&(s.preventDefault(),u.type==="view"?Xr(e,u.name):Yr(e,u.name));return}let a=i.closest("[data-1c]");if(!a)return;let c=a.getAttribute("data-1c");if(!c)return;let l=Wr(c);if(l)switch(l.type){case"command":s.preventDefault(),Yr(e,l.name);break;case"view":s.preventDefault(),Xr(e,l.name);break;case"consent":Di(e,l.name,a);break;case"dataset":s.preventDefault(),Li(e,l.name,a,n)}};return t.addEventListener("click",r),()=>{t.removeEventListener("click",r)}}function Li(t,e,n,r){if(!r)throw Error("[Commands] Missing dataset rendering context");let s=r.getShadowRoot();switch(e){case"serviceDetail":{let i=n.getAttribute("data-1c-id");if(!i){console.warn("[1CL] dataset:serviceDetail missing data-1c-id");return}let o=r.getCompiledView("service-detail");if(!o){console.warn("[1CL] No compiled service-detail template found");return}qr(i,t.config,o,t.getTranslations,s??void 0).catch(a=>{console.error("[1CL] Failed to open service detail modal:",a)});break}case"vendorStorage":{let i=n.getAttribute("data-1c-id");if(!i){console.warn("[1CL] dataset:vendorStorage missing data-1c-id");return}let o=n.getAttribute("data-1c-name"),a=r.getCompiledView("service-detail");if(!a){console.warn("[1CL] No compiled service-detail template found");return}qr(`vendor-${i}`,t.config,a,t.getTranslations,s??void 0,()=>Pi(i,o,t.config,t.getLanguage,t.getTranslations)).catch(c=>{console.error("[1CL] Failed to open vendor storage modal:",c)});break}default:console.warn(`[1CL] Unknown dataset command: ${e}`)}}var kt=['[data-1c^="consent:"][data-1c-id]','[data-1c="consent:us.sale"]','[data-1c="consent:us.share"]','[data-1c="consent:us.saleAndShare"]','[data-1c="consent:us.limitSensitiveUse"]'].join(", ");function ls(t){console.error(`[1CL] Unsupported consent binding: ${t}`)}function Dn({bindingKey:t,id:e}){return e?{bindingKey:t,id:e}:{bindingKey:t}}var ki=class Dt{index=new Map;static makeKey(e,n){return`${e}::${n??""}`}add(e,n,r){let s=Dt.makeKey(e,n),i=this.index.get(s);i||(i={bindingKey:e,id:n,elements:new Set},this.index.set(s,i)),i.elements.add(r)}remove(e,n,r){let s=Dt.makeKey(e,n),i=this.index.get(s);i&&(i.elements.delete(r),i.elements.size===0&&this.index.delete(s))}get(e,n){let r=Dt.makeKey(e,n);return this.index.get(r)?.elements??new Set}getAllBindings(){let e=[];for(let{bindingKey:n,id:r,elements:s}of this.index.values())for(let i of s){let o={element:i,bindingKey:n};r&&(o.id=r),e.push(o)}return e}clear(){this.index.clear()}get size(){let e=0;for(let n of this.index.values())e+=n.elements.size;return e}},Zr=new WeakMap;function it(t){let e=Zr.get(t);return e||(e=new ki,Zr.set(t,e)),e}function Ri(t,e){let n=[],r=it(e),s=[...t.querySelectorAll(kt)];t.matches(kt)&&s.push(t);for(let i of s){if(!(i instanceof HTMLInputElement))continue;let o=i.getAttribute("data-1c");if(!o)continue;if(!Et(o)){ls(o);continue}let a=i.getAttribute("data-1c-id")||void 0;r.add(o,a,i);let c={element:i,bindingKey:o};a&&(c.id=a),n.push(c)}return n}function Vi(t,e){let n=it(e),r=[...t.querySelectorAll(kt)];t.matches(kt)&&r.push(t);for(let s of r){if(!(s instanceof HTMLInputElement))continue;let i=s.getAttribute("data-1c");if(!i)continue;let o=s.getAttribute("data-1c-id")||void 0;n.remove(i,o,s)}}function Nn(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 r=it(e);for(let s of t){let i=r.get(s.bindingKey,s.id);for(let o of i)Nn(o,{value:s.value??o.checked,disabled:s.disabled??o.disabled})}}function ds(t,e,n){let r=Ri(t,e);if(r.length!==0)try{let s=n.engine;if(s?.resolveMany){let i=s.resolveMany(r.map(Dn));Ln(i.patches,e,i.version)}else for(let i of r)try{if(!s?.resolve)continue;let o=s.resolve(Dn(i));o&&Nn(i.element,o)}catch(o){console.error("[1CL] Failed to resolve binding:",i,o)}}catch(s){console.error("[1CL] Failed to hydrate bindings:",s)}}function Fi(t,e){Vi(t,e)}function Mi(t,e){let n=new MutationObserver(r=>{for(let s of r){for(let i of s.addedNodes)i instanceof HTMLElement&&ds(i,t,e);for(let i of s.removedNodes)i instanceof HTMLElement&&Fi(i,t)}});return n.observe(t,{childList:!0,subtree:!0}),()=>{n.disconnect()}}function Bi(t,e){let n=!1,r=s=>{if(n)return;let i=s.target;if(!(i instanceof HTMLInputElement))return;let o=i.getAttribute("data-1c");if(!o?.startsWith("consent:"))return;let a=i.getAttribute("data-1c-id")||"",c=i.checked,l=e.engine;if(l)if(!Et(o)||!l.apply||!l.resolve)ls(o);else try{let u=l.apply({ref:{bindingKey:o,id:a},value:c,source:"ui"});n=!0,Ln(u.patches,t,u.version),n=!1}catch(u){console.error("[1CL] Failed to apply consent change:",u);try{let f=l.resolve({bindingKey:o,id:a});n=!0,Nn(i,f),n=!1}catch(f){console.error("[1CL] Failed to revert state:",f)}}};return t.addEventListener("change",r,!0),()=>{t.removeEventListener("change",r,!0)}}function Ui(t,e){ds(t,t,e);let n=Bi(t,e),r=Mi(t,e),s=e.bus.on("consent:changed",()=>{let i=it(t).getAllBindings();try{let o=e.engine;if(o?.resolveMany){let a=o.resolveMany(i.map(Dn));Ln(a.patches,t,a.version)}}catch(o){console.error("[1CL] Failed to reconcile on consent:changed:",o)}});return()=>{n(),r(),s(),it(t).clear()}}function $i(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=ji(e),r=Ki(t),{position:s,spacing:i,logoAlign:o,buttonOrder:a,buttonAlign:c,buttonEmphasis:l}=zi(t,n,r);return{state:e==="none"?"closed":"open",load:"ready",theme:Gi(t),layer:n,framework:r,position:s,spacing:i,logoAlign:o,buttonOrder:a,buttonAlign:c,buttonEmphasis:l}}function Gi(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 ji(t){return t==="main"?"notice":t==="details"?"details":"trigger"}function Ki(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 zi(t,e,n){let r=t.config?.appearance,s=r?.notice,i=e==="trigger"?ri(r?.trigger,n)??s:e==="details"?r?.details:s;return{position:i?.position||"bottom-center",spacing:i?.size||"default",logoAlign:s?.logoAlignment||"left",buttonOrder:s?.buttonOrder||"reject-first",buttonAlign:s?.buttonAlignment||"right",buttonEmphasis:s?.buttonEmphasis||"equal"}}function Hi(t,e){let n=t.getRootNode(),r=n instanceof ShadowRoot?n.host:t;r.setAttribute("data-1c-state",e.state),r.setAttribute("data-1c-load",e.load),r.setAttribute("data-1c-theme",e.theme),r.setAttribute("data-1c-layer",e.layer),r.setAttribute("data-1c-framework",e.framework),r.setAttribute("data-1c-position",e.position),r.setAttribute("data-1c-spacing",e.spacing),r.setAttribute("data-1c-logo-align",e.logoAlign),r.setAttribute("data-1c-button-order",e.buttonOrder),r.setAttribute("data-1c-button-align",e.buttonAlign),r.setAttribute("data-1c-button-emphasis",e.buttonEmphasis)}function Qr(t,e){Hi(t,$i(e))}function qi(t,e){Qr(t,e);let n=()=>{Qr(t,e)},r=["view:transition","consent:changed","theme:changed"].map(s=>e.bus.on(s,n));return()=>{for(let s of r)s()}}function Wi(t,e){return new Promise((n,r)=>{let s=document.createElement("script");s.src=t,s.async=!0,s.onload=()=>n(void 0),s.onerror=i=>{s.remove(),r(i)},(document.head||document.documentElement).appendChild(s)})}function An(t,e,n,r=!1){let s=t.getElementById(e);s||(s=document.createElement("style"),s.id=e,r?t.prepend(s):t.append(s)),s.textContent=n}function Yi(t){return"getOptOutOfSale"in t&&"getOptOutOfShare"in t&&"isGpcDetected"in t&&"getLimitSensitiveUse"in t&&"getSensitivePIInUse"in t}function Xi(t,e,n){let r=Object.values(t.stacks),s=new Set(r.flatMap(d=>d.purposes)),i=new Set(r.flatMap(d=>d.specialFeatures)),o=new Set(n.flatMap(d=>d.specialFeatureIds)),a=Object.values(t.specialFeatures).filter(d=>o.has(d.id)),c=n.map(d=>{let m=t.vendors[d.id];if(!m)throw Error(`TCF UI data is missing configured vendor ${d.id}`);let b=new Set(d.consentPurposeIds),v=new Set(d.legitimateInterestPurposeIds),C=new Set(d.flexiblePurposeIds),I=new Set(d.specialFeatureIds);return{...m,purposes:m.purposes.filter(S=>b.has(S)),purposes_data:m.purposes_data.filter(S=>b.has(S.id)),legIntPurposes:m.legIntPurposes.filter(S=>v.has(S)),legIntPurposes_data:m.legIntPurposes_data.filter(S=>v.has(S.id)),flexiblePurposes:m.flexiblePurposes.filter(S=>C.has(S)),flexiblePurposes_data:m.flexiblePurposes_data.filter(S=>C.has(S.id)),specialFeatures:m.specialFeatures.filter(S=>I.has(S)),specialFeatures_data:m.specialFeatures_data.filter(S=>I.has(S.id))}}),l=Object.values(t.purposes).map(d=>{let m=c.filter(v=>v.purposes.includes(d.id)).length,b=c.filter(v=>v.legIntPurposes.includes(d.id)).length;return{...d,consentVendorCount:m,legitimateInterestVendorCount:b,hasConsentVendors:m>0,hasLegitimateInterestVendors:b>0}}),u=new Set(l.filter(d=>d.hasConsentVendors).map(d=>d.id)),f=r.map(d=>({...d,hasConsentControls:d.purposes.some(m=>u.has(m))||d.specialFeatures.length>0})),p=l.filter(d=>d.hasLegitimateInterestVendors),h=c.filter(d=>d.legIntPurposes.length>0).length;return{standardTexts:t.standardTexts,...e==="main"?{stacks:f,purposes:l.filter(d=>!s.has(d.id))}:{purposes:l},specialPurposes:Object.values(t.specialPurposes),dataCategories:Object.values(t.dataCategories),features:Object.values(t.features),specialFeatures:e==="main"?a.filter(d=>!i.has(d.id)):a,vendors:c,vendorCount:c.length,legitimateInterestPurposes:p,legitimateInterestVendorCount:h,hasLegitimateInterests:h>0}}function Ji(t){try{let e=t.split("-")[0]??t;return new Intl.DisplayNames([e],{type:"language"}).of(e)??t}catch{return t}}function es(t,e){let n=document.createTreeWalker(t,NodeFilter.SHOW_TEXT),r=[];for(let s=n.nextNode();s;s=n.nextNode())s instanceof Text&&s.textContent&&e(s.textContent)&&r.push(s);return r}var us=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,r,s,i,o,a=()=>"auto"){this.getThemeMode=a,this.bus=t,this.consentEngine=e,this.translationsProvider=n??(()=>null),this.controllerOpenDetails=r,this.ensureViewData=s??(async()=>{}),this.hasViewData=i??(()=>!0),this.controllerSetLanguage=o,this.config=e.getConfig(),this.currentLocale=e.getDisplayLocale(),this.consentEngine.on("consent:changed",()=>this.handleConsentChange()),this.bus.on("view:change",c=>{let l=c.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",c=>{let l=c.payload?.locale;l&&(this.currentLocale=l),this.currentView!=="none"&&this.mount(this.currentView)})}getCurrentView(){return this.currentView}hasDesign(t){return this.bundles.has(t)}setThemeCSS(t){this.themeCSS=t,this.shadowRoot&&(t===null?this.shadowRoot.getElementById("1c-style-theme")?.remove():An(this.shadowRoot,"1c-style-theme",t))}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.noticeRequired();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(t!=="none"&&t!=="main"&&t!=="details"&&t!=="trigger")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;let r=t==="none"||t==="trigger";if(r&&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 l=!this.bundles.has(t),u=this.ensureViewData(t);if(l||!this.hasViewData(t)){let[f]=await Promise.all([l?this.ensureViewBundle(t):Promise.resolve(!0),u]);if(s!==this.transitionIntent)return console.warn(`[ViewEngine] Transition ${n} \u2192 ${t} superseded by a newer transition`),!1;if(!f)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 i=this.isModalView(n),o=this.isModalView(t);o&&!i&&this.captureFocusReturnTarget();let a={from:n,to:t,reason:e};this.bus.emit({type:"view:before-transition",payload:a}),this.currentView=t;let c=!0;if(r&&this.shadowRoot&&_e(this.shadowRoot),t==="none"){for(let l of this.cleanupFunctions)l();this.cleanupFunctions=[],this.renderTarget&&(this.renderTarget.innerHTML="")}else c=this.mountSafely(t);return c?(this.bus.emit({type:"view:transition",payload:a}),i&&!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&&!i&&this.restoreFocusAfterModal(),!1)}isModalView(t){return t==="details"||t==="main"&&this.config.appearance?.showOverlay===!0}captureFocusReturnTarget(){this.focusReturnTarget||=is(this.shadowRoot)}restoreFocusAfterModal(){let t=this.focusReturnTarget;this.focusReturnTarget=null,os(t,this.renderTarget)}triggerEnabled(){return ui(this.config)&&!this.bus.hideTrigger}noticeRequired(){return!this.bus.visitorInitiatedPrivacy&&this.consentEngine.isConsentRequired()}initialize(){this.noticeRequired()?this.transitionTo("main","consent-required"):this.triggerEnabled()&&this.transitionTo("trigger","consent-given")}handleConsentChange(){this.currentView==="trigger"&&this.noticeRequired()&&this.transitionTo("main","consent-required")}handleConsentSaved(){(this.currentView==="main"||this.currentView==="details")&&this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","consent-given")}dismissModalThenTransition(t,e,n){let r=this.currentView,s=r==="main"||r==="details";if(!s&&!n){this.transitionTo(t,e);return}let i=this.transitionIntent+ +!!s,o=(s?new Promise(c=>window.setTimeout(c,0)):Promise.resolve()).then(async()=>{try{return await a?await n?.()??{to:t,reason:e}:void 0}finally{this.pendingDismissalWork===o&&(this.pendingDismissalWork=null)}});n&&(this.pendingDismissalWork=o);let a=s?this.transitionTo("none",e):Promise.resolve(!0);o.then(c=>{c&&(c.to!=="none"||!s)&&i===this.transitionIntent&&(this.currentView==="none"||!s)&&this.transitionTo(c.to,c.reason)}).catch(c=>{console.error("[1Consent] Consent action failed",c),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,e=this.bus.visitorInitiatedPrivacy;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"}});else if(t==="main"&&!e&&this.config.showClose===!0){if(this.config.closeMeans==="reject"){this.saveDecision(()=>this.consentEngine.rejectAll());return}this.bus.emit({type:"notice:dismissed"}),this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","user-action")}else t==="details"||t==="main"&&e?this.dismissModalThenTransition("none","user-action",()=>this.consentEngine.withExclusiveAccess(()=>{if(this.consentEngine.reconcileExternalConsentChange(null,null,!0),this.noticeRequired())return{to:"main",reason:"consent-required"};if((e||this.consentEngine.hasValidConsent())&&this.triggerEnabled())return{to:"trigger",reason:"consent-given"}})):this.consentEngine.hasValidConsent()?this.dismissModalThenTransition(this.triggerEnabled()?"trigger":"none","consent-given"):this.transitionTo("main","consent-required")}bundles=new Map;registerDesign(t,e){if(Object.keys(t.views).length===0)console.error("[ViewEngine] Registered design has no views");else for(let[n,r]of Object.entries(t.views)){let s=n.split(".").pop()||"main",i={version:t.version,views:{[s]:r},components:t.components},o=e||t.css;o&&(i.css=o),this.bundles.set(s,i),this.currentView===s&&this.mount(s)}}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}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=Wi(e,t).then(r=>{r&&(this.registerDesign(r),t==="main"&&this.transitionIntent===0&&this.transitionTo("main","programmatic"));let s=this.bundles.has(t);return s||this.viewLoadPromises.delete(t),s}).catch(r=>(console.error(`[ViewEngine] Failed to load view '${t}':`,r),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){let e=!1;return Oi(this.shadowRoot,()=>{e=this.mountParent(t)}),e}mountParent(t){for(let y of this.cleanupFunctions)y();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;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&&An(this.shadowRoot,"1c-style-theme",this.themeCSS,!0),An(this.shadowRoot,"1c-style-view",e.css??"",!0);let n=this.translationsProvider()??{},r="tcf"in n?n.tcf?.gvl:void 0,s=(Tn(this.config)?this.config.vendors??[]:[]).length,i=y=>{let _={...y};for(let P of Object.keys(_)){let w=Reflect.get(_,P);typeof w=="string"?Reflect.set(_,P,w.replace(/%VENDORS_COUNT%/g,String(s))):w&&typeof w=="object"&&!Array.isArray(w)&&Reflect.set(_,P,i(w))}return _},o=Tn(this.config)?i(n):n,a=Gr(this.config)?this.config.us?.doNotSellLinkUrl:void 0,c=a&&Array.isArray(o.legalLinks)&&o.legalLinks.some(y=>y.url==="/do-not-sell")?o.legalLinks.map(y=>y.url==="/do-not-sell"?{...y,url:a}:y):o.legalLinks,l=this.config.shopifyPrivacyPolicyUrl,u=y=>l?y?.map(_=>_.shopifyPolicyDefault===!0&&_.url==="/privacy-policy"?{..._,url:l}:_):y,f=u(c),p=u(o.details?.legalLinks),{categories:h,services:d,uncategorizedServices:m,appearance:b}=hi(this.config,o.vendors);ss(e,o);let v={config:this.config,consent:{categories:this.consentEngine.getCategoryConsents(),services:this.consentEngine.getServiceConsents()},ui:{view:t,...o,...f===o.legalLinks?{}:{legalLinks:f},...p===o.details?.legalLinks?{}:{details:{...o.details,legalLinks:p}}},categories:h,services:d,uncategorizedServices:m,appearance:this.bus.visitorInitiatedPrivacy?{...b,showClose:!0}:b,framework:this.config.framework,languages:{...this.config.languages,current:this.currentLocale,showSelector:this.config.languages.supported.length>1,options:this.config.languages.supported.map(y=>({code:y,label:this.config.languages.labels?.[y]??Ji(y)}))},...r?{tcf:Xi(r,t,Tn(this.config)?this.config.vendors??[]:[])}:{},...Yi(this.consentEngine)?{us:{optedOutOfSale:this.consentEngine.getOptOutOfSale(),optedOutOfShare:this.consentEngine.getOptOutOfShare(),gpcDetected:this.consentEngine.isGpcDetected(),sensitivePIInUse:this.consentEngine.getSensitivePIInUse(),limitSensitiveUse:this.consentEngine.getLimitSensitiveUse(),knownMinors:Gr(this.config)?this.config.us?.minorsPosture==="known_minors":!1}}:{}},C=this.renderTarget;if(!C)return console.error("[ViewEngine] Shadow root render target is missing"),!1;try{zn(e,v,C,{view:t})}catch(y){return console.error(`[ViewEngine] Failed to mount view ${t}:`,y),this.bus.emit({type:"monitoring:error",payload:{code:"render_error"}}),!1}let I=C.querySelector('[role="dialog"]'),S=this.isModalView(t);I instanceof HTMLElement&&(I.setAttribute("aria-modal",S?"true":"false"),S&&this.cleanupFunctions.push(cs(I,this.container,t==="details"?()=>this.closeCurrentView():void 0)));let g=C.querySelector("select[data-1c-lang]");if(g instanceof HTMLSelectElement&&(g.value=this.currentLocale,g.disabled=this.languageChangePending,g.onchange=()=>{if(this.languageChangePending)return;let y=this.config.languages.supported.find(w=>w===g.value),_=this.controllerSetLanguage;if(!y||!_)return;g.disabled=!0,this.languageChangePending=!0;let P;try{P=_(y)}catch(w){P=Promise.reject(w)}P.catch(w=>{let R=this.renderTarget?.querySelector("select[data-1c-lang]");R instanceof HTMLSelectElement&&(R.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)})}),C.textContent?.includes("[")){if(C.textContent?.includes("[ul]")){let P=/\[ul]([\s\S]*?)\[\/ul]/g,w=/\[li]([\s\S]*?)\[\/li]/g,R=es(C,E=>E.includes("[ul]"));for(let E of R){let D=E.textContent||"",ie=document.createDocumentFragment(),Y=0;for(let U of D.matchAll(P)){U.index>Y&&ie.appendChild(document.createTextNode(D.slice(Y,U.index)));let V=document.createElement("ul");V.className="oc-list";for(let ht of(U[1]??"").matchAll(w)){let Ve=document.createElement("li");Ve.textContent=ht[1]??"",V.appendChild(Ve)}ie.appendChild(V),Y=U.index+U[0].length}Y<D.length&&ie.appendChild(document.createTextNode(D.slice(Y))),E.parentNode?.replaceChild(ie,E)}}let y=/\[([abi])(?:\s+([^\]]*))?](.*?)\[\/\1]/g,_=es(C,P=>{let w=y.test(P);return y.lastIndex=0,w});for(let P of _){let w=P.textContent||"",R=document.createDocumentFragment(),E=0;for(let D of w.matchAll(y)){D.index>E&&R.appendChild(document.createTextNode(w.slice(E,D.index)));let ie=D[1],Y=D[2]||"",U;if(ie==="a"){let V=document.createElement("a");V.className="oc-link";let ht=Y.match(/href="([^"]*)"/)?.[1],Ve=Y.match(/action="([^"]*)"/)?.[1];Ve===void 0?ht===void 0?V.href="#":(V.href=ht,V.target="_blank",V.rel="noopener noreferrer"):(V.href="#",V.setAttribute("data-1c",Ve)),U=V}else U=ie==="b"?document.createElement("strong"):document.createElement("em");U.textContent=D[3]??"",R.appendChild(U),E=D.index+D[0].length}E<w.length&&R.appendChild(document.createTextNode(w.slice(E))),P.parentNode?.replaceChild(R,P)}}let x={config:this.config,engine:this.consentEngine,getLanguage:()=>this.currentLocale,getTranslations:()=>this.translationsProvider(),cmp:{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()},viewEngine:this,bus:this.bus,getThemeMode:this.getThemeMode},B=Ui(C,x),L=Ni(C,x,{getCompiledView:y=>this.getCompiledView(y),getShadowRoot:()=>this.shadowRoot}),se=qi(this.container,x);return this.cleanupFunctions.push(B,L,se),!0}};var Rt=class extends et{};var ne=class extends Rt{validatedStoredDecision;legacyRecord;state;versionTracker=new qe;#e;#t;#r=!1;#n;#s;constructor(e,n,r){super(e,n,r),this.#s=r.languages.primary,this.state=this.#o();let s=We(r,n.getFastPath());this.#t=s!==void 0||this.#r,this.#e=s??(this.#r?z(this.config,this.#d()):{}),this.state.hasConsent&&this.#S()&&this.invalidateStoredConsent(),this.bus.on("language:changed",i=>{this.#i(i.payload.locale)});try{this.bootSyncsFastPath()&&(this.state.hasConsent&&this.hasValidConsent()?(this.syncFastPath(),this.mergeConsentDowngradeBaseline(z(this.config,this.#d()))):(this.storage.removeFastPath(),W(this.config)))}catch{}this.#g()}bootSyncsFastPath(){return!0}syncFastPath(e){st(this.config,this.getFastPathConsentMap(),this.getFastPathSyncOptions(),e??(n=>this.storage.refreshFastPath(n,this.validatedStoredDecision)))}reconcileExternalConsentChange(e,n,r=!1){if(!(!r&&!this.hasExternalConsentChange(e,n))){this.externalReconciliationPending=!1;try{this.reloadExternalConsentState(r)}catch(s){throw this.externalReconciliationPending=!0,s}this.versionTracker.increment(),r||this.mergeConsentDowngradeBaseline(this.getConsentDowngradeSnapshot()),this.emit({type:"consent:changed"}),r||this.emit({type:"consent:external"})}}reloadExternalConsentState(e=!1){let n=this.storage.getConsent(),r=this.storage.getFastPath();this.#r=!1,this.#n=void 0,this.state=this.#o(),(!this.state.hasConsent||!this.hasValidConsent())&&(this.legacyRecord==="reask"?this.clearFastPathSignals():n||r?this.invalidateStoredConsent():(this.state=this.freshVisitorState(),this.#r=!1,this.#n=void 0,W(this.config)))}getFastPathSyncOptions(){let e=this.getConsentTimestamp();return{...e===null?{}:{decisionTimestamp:e}}}getStoredLocale(){return this.#n}getDisplayLocale(){return this.#s}#i(e){this.#s=e;try{this.#c(e)}catch{}}#c(e){if(!this.state.hasConsent)return;let n=this.storage.getConsent();if(!n)return;let r=O.decodeForConfig(n.consent,this.config);if(r.language===e)return;let s=O.encode({...r,language:e}),i=this.storage.getConsentSnapshot();i&&(this.storage.amendConsent(i,{value:s}),this.validatedStoredDecision=this.storage.getConsentSnapshot(),this.#n=e)}getFastPathConsentMap(){return this.#d()}getConsentDowngradeSnapshot(){return z(this.config,this.getFastPathConsentMap())}extendConsentDowngradeBaseline(e){this.#t&&(this.#e={...this.#e,...e})}mergeConsentDowngradeBaseline(e){let n={...this.#e};for(let[r,s]of Object.entries(e))n[r]=n[r]===!0||s===!0;this.#e=n,this.#t=!0}#o(){this.validatedStoredDecision=void 0;let e=this.storage.getConsentSnapshot(),n=e?.content;if(this.legacyRecord=void 0,!n)return this.freshVisitorState();try{let r=this.#a(n);return r.hasConsent&&(this.validatedStoredDecision=e),r}catch(r){return console.error("[GdprEngine]",r),this.freshVisitorState()}}freshVisitorState(){return{hasConsent:!1,acceptedAll:!1,rejectedAll:!1,categories:this.getDefaultCategoryConsents(),services:this.getDefaultServiceConsents(),timestamp:Date.now()}}invalidateStoredConsent(){this.validatedStoredDecision=void 0,this.state=this.freshVisitorState(),this.#n=void 0,this.#r=!1,this.#e={},this.#t=!1;let e=!1;try{e=this.storage.invalidateConsent()}catch{}if(W(this.config),e)for(let n of this.storage.getContinuityScopes())n.frameworkId!==this.config.framework.id&&W({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{}W(this.config)}#a(e){let n=O.decodeForConfig(e.consent,this.config);this.#n=n.language;let r=this.getDefaultCategoryConsents(),s=this.getDefaultServiceConsents(),i=e.gdprChoices??e.decisionChoices,o=i?.structuralVersion===F(this.config.services,this.config.categories);if(i===void 0||!o&&(!i.categoryOrder||!i.serviceOrder))return this.#l(n,r,s);if(o){let u=(d,m)=>Object.keys(m).length===d.length&&d.every(b=>Object.hasOwn(m,b.id)&&(!b.essential||m[b.id]===!0)),f=this.config.categories.filter(d=>!d.essential),p=i.categoryOrder??f.map(d=>d.id),h=n.payload?O.decodeBitset(n.payload,p.length):[];if(!u(this.config.categories,i.categories)||!u(this.config.services,i.services)||p.length!==f.length||!p.every((d,m)=>f.some(b=>b.id===d)&&i.categories[d]===(n.state==="A"||n.state==="G"&&h[m]===!0)))throw new Error("[GdprConsentEngine] Stored choices disagree with their decision.")}let a=(u,f,p,h)=>{for(let{id:d,essential:m}of u)!m&&(o||h?.includes(d))&&typeof p[d]=="boolean"&&(f[d]=p[d]===!0)};a(this.config.categories,r,i.categories,i.categoryOrder),a(this.config.services,s,i.services,i.serviceOrder);let{acceptedAll:c,rejectedAll:l}=this.#u(r,s);return this.#r=!0,{hasConsent:!0,acceptedAll:c,rejectedAll:l,categories:r,services:s,timestamp:n.timestamp*1e3}}#l(e,n,r){let s=e.timestamp*1e3;return e.state==="D"||this.#h(s)?(this.#h(s)||(this.legacyRecord="refusal"),this.#r=!0,{hasConsent:!0,...this.#u(n,r),categories:n,services:r,timestamp:s}):(this.legacyRecord="reask",this.freshVisitorState())}#u(e,n){let r=this.config.categories.filter(s=>!s.essential).map(s=>e[s.id]);return this.getFrameworkPrefix()==="gdpr"&&(r.push(...this.config.services.filter(s=>!s.essential).map(s=>n[s.id])),r.length===0)?{acceptedAll:!1,rejectedAll:!1}:{acceptedAll:r.every(s=>s===!0),rejectedAll:r.every(s=>!s)}}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}#f(e){for(let n of this.config.categories)this.state.categories[n.id]=e||n.essential===!0;for(let n of this.config.services)this.state.services[n.id]=e||n.essential===!0;this.state.acceptedAll=e,this.state.rejectedAll=!e,this.state.hasConsent=!0,this.state.timestamp=Date.now(),this.emit({type:e?"consent:accepted-all":"consent:rejected-all"}),this.emit({type:"consent:changed"})}acceptAll(){this.#f(!0)}rejectAll(){this.#f(!1)}getConsent(){return this.#d()}#d(){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({type:"consent:changed"}),this.save()}getConsentState(){return{...this.state}}getEnforcementConsentState(){if(this.externalReconciliationPending)return this.freshVisitorState();let e=this.getFastPathConsentMap(),n={},r={};for(let s of this.config.categories)n[s.id]=e[s.id]===!0;for(let s of this.config.services)r[s.id]=e[s.id]===!0;return{...this.state,categories:n,services:r}}getCategoryConsent(e){return this.state.categories[e]||!1}setCategoryConsent(e,n){let r=this.config.categories.find(s=>s.id===e);r&&(r.essential&&!n||(this.state.categories[e]=n,this.state.timestamp=Date.now(),this.config.services.filter(s=>s.categoryId===e).forEach(s=>{this.setServiceConsent(s.id,n)}),this.emit({type:"category:toggled",payload:{id:e,value:n}}),this.emit({type:"consent:changed"})))}getServiceConsent(e){return this.state.services[e]||!1}setServiceConsent(e,n){let r=this.config.services.find(s=>s.id===e);r&&(r.essential&&!n||(this.state.services[e]=n,this.state.timestamp=Date.now(),this.emit({type:"service:toggled",payload:{id:e,value:n}}),this.emit({type:"consent:changed"})))}getCategoryConsents(){return{...this.state.categories}}getServiceConsents(){return{...this.state.services}}savedConsentEvent(){return{type:"consent:saved"}}save(){this.state.hasConsent=!0,this.state.timestamp=Date.now(),this.getFrameworkPrefix()==="gdpr"&&Object.assign(this.state,this.#u(this.state.categories,this.state.services));let e=this.getConsentDowngradeSnapshot(),n=this.#t&&Ce(this.#e,e);this.#p(),this.legacyRecord=void 0,this.#e=e,this.#t=!0,this.emit(this.savedConsentEvent()),n&&we(this.config)==="reload"&&(this.bus.beforeNavigation??(s=>s()))(()=>window.location.reload())}#p(){let e=this.#w();this.state.timestamp=O.decodeForConfig(e,this.config).timestamp*1e3;let n=this.storage.getConsentId();n||(n=crypto.randomUUID(),this.storage.setConsentId(n)),this.syncFastPath(s=>{this.persistToLocalStorage(e,s)}),this.validatedStoredDecision=this.storage.getConsentSnapshot();let r=this.#y(e,n);r&&(this.storage.queuePendingEvent(r),this.#C(r).then(async s=>{s&&await this.storage.withExclusiveAccess(()=>this.storage.removePendingEvent(r.eventId))}).catch(s=>console.error("[1Consent] Consent receipt cleanup failed",s)))}#g(){for(let e of this.storage.getPendingEvents())this.#C(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==="tcf"?null:n==="gdpr"?{consent:e,gdprChoices:this.recordedChoices()}:{consent:e,decisionChoices:this.recordedChoices()}}recordedChoices(){return{categoryOrder:fn(this.config.categories),serviceOrder:fn(this.config.services),structuralVersion:F(this.config.services,this.config.categories),services:{...this.state.services},categories:{...this.state.categories}}}persistToLocalStorage(e,n){let r=this.buildConsentEntry(e);r&&this.storage.updateConsent(r,n)}#w(){let e=this.config.categories.filter(s=>!s.essential).map(s=>this.state.categories[s.id]===!0),n=Ct(K(e)),r=n==="G"?O.encodeBitset(e):void 0;return O.encode({machine:this.config.machine,configId:this.config.appId,version:1,framework:this.getFrameworkPrefix(),state:n,payload:r,language:this.#s,timestamp:Math.floor(Date.now()/1e3)})}#y(e,n){let r=this.config.cmp?.consentApiUrl;if(!r)return null;let s=this.config.consentPublicationToken;if(!s)return console.error("[Consent] Missing signed publication context"),null;let i=this.getEvidenceConsentDecision(),o=or(i),a=crypto.randomUUID();return{url:r,eventId:a,payload:{publicationToken:s,eventId:a,consentId:n,action:o,decision:i,consentString:e}}}getEvidenceConsentDecision(){let e=this.getFastPathConsentMap(),n=s=>K(s.filter(i=>!i.essential).map(i=>e[i.id]===!0)),r=n(this.config.categories);return{version:1,categoryProjection:r,categories:r,services:n(this.config.services),framework:""}}async#C(e){try{let n=await fetch(`${e.url}/v1/consent`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e.payload),keepalive:!0}),r=e.payload.eventId===e.eventId&&typeof e.payload.consentId=="string"?{eventId:e.eventId,consentId:e.payload.consentId}:null,s=n.ok?await n.json():void 0,i=cr(n.status,s,r);return i==="rejected"?(console.error(`[Consent] Event permanently rejected (HTTP ${n.status})`),!0):(n.ok&&i!=="acknowledged"&&console.error("[Consent] Invalid queue acknowledgement; event remains queued"),i==="acknowledged")}catch(n){return console.error("Consent failed",n),!1}}isConsentRequired(){return!!(this.externalReconciliationPending||!this.getConsentState().hasConsent||this.#S()||this.#v())}hasValidConsent(){return!this.isConsentRequired()}getConsentTimestamp(){return this.state.timestamp||null}#S(){return this.#h(this.getConsentTimestamp())}#h(e){let n=Date.now();return e===null||!Number.isSafeInteger(e)||e<=0||!Number.isSafeInteger(n)||n<0||e>n?!0:n-e>33696e6}#v(){let e=Object.keys(this.state.categories);return(this.config.categories.map(r=>r.id)||[]).some(r=>!e.includes(r))}resolve(e){let n=M(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:r}=n;if(r==="category")return this.resolveCategoryBinding(e.id);if(r==="service")return this.resolveServiceBinding(e.id);throw new Error(`[GDPR Engine] Unknown entity type: ${r}`)}resolveMany(e){let n=[];for(let r of e)try{let s=this.resolve(r);if(!r.id)continue;n.push({bindingKey:r.bindingKey,id:r.id,value:s.value,disabled:s.disabled})}catch(s){console.error("GDPR binding",r,s)}return{patches:n,version:this.versionTracker.getVersion()}}getFrameworkPrefix(){return"gdpr"}apply(e){let n=M(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:r}=n,s=[];if(r==="category"){this.setCategoryConsent(e.ref.id,e.value);let o=this.resolveCategoryBinding(e.ref.id);s.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:o.value,disabled:o.disabled});let a=this.config.services.filter(c=>c.categoryId===e.ref.id);for(let c of a){let l=this.resolveServiceBinding(c.id);s.push({bindingKey:`consent:${this.getFrameworkPrefix()}.service`,id:c.id,value:l.value,disabled:l.disabled})}}else if(r==="service"){this.setServiceConsent(e.ref.id,e.value);let o=this.resolveServiceBinding(e.ref.id);s.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:o.value,disabled:o.disabled});let a=this.config.services.find(c=>c.id===e.ref.id);if(a?.categoryId){let c=this.resolveCategoryBinding(a.categoryId);s.push({bindingKey:`consent:${this.getFrameworkPrefix()}.category`,id:a.categoryId,value:c.value,disabled:c.disabled})}}else throw new Error(`[GDPR Engine] Unknown entity type: ${r}`);let i=this.versionTracker.increment();return{patches:s,version:i}}resolveCategoryBinding(e){let n=this.config.categories.find(i=>i.id===e);if(!n)throw new Error(`[GDPR Engine] Category not found: ${e}`);if(n.essential)return{value:!0,disabled:!0};let r=this.config.services.filter(i=>i.categoryId===e),s;return r.length===0?s=this.state.categories[e]||!1:s=r.every(i=>this.state.services[i.id]),{value:s,disabled:!1}}resolveServiceBinding(e){let n=this.config.services.find(s=>s.id===e);if(!n)throw new Error(`[GDPR Engine] Service not found: ${e}`);return n.essential?{value:!0,disabled:!0}:this.config.categories.find(s=>s.id===n.categoryId)?.essential?{value:!0,disabled:!0}:{value:this.state.services[e]||!1,disabled:!1}}};var ot=class extends q{engine;constructor(e,n){super(e,n),this.engine=new ne(this.bus,this.storage,e),this.attachBlocking(this.engine),this.resolveInitialLocale()}async init(){this.engine.isConsentRequired()?await this.showInitialNotice():(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 kn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function Vt(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)),r=0,s=0,i=0;for(let o of t)r=r<<6|kn.indexOf(o),s+=6,s>=8&&(s-=8,n[i++]=r>>s&255);if(Ft(n)!==t)throw new Error("invalid base64url");return n}function Ft(t){let e="",n=0,r=0;for(let s=0;s<t.length;s++)for(n=n<<8|(t[s]??0),r+=8;r>=6;)r-=6,e+=kn[n>>r&63];return r>0&&(e+=kn[n<<6-r&63]??""),e}function j(){throw new Error("invalid TC")}function Mt(t,e,n){for(let r of n){let s=e*65536+r;t.has(s)&&j(),t.add(s)}}var Rn=53;function Vn(t){if(!Number.isSafeInteger(t)||t<1||t>Rn)throw new Error(`Bit length must be an integer from 1 to ${Rn}`)}var xe=class{buffer;#e=0;constructor(e){this.buffer=e}readBits(e){if(Vn(e),e>32){let r=0;for(let s=0;s<e;s++)r=r*2+(this.readBit()?1:0);return r}let n=0;for(let r=0;r<e;r++)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,r=(this.buffer[e]??0)>>n&1;return this.#e++,r===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 r=String.fromCharCode(e+65),s=String.fromCharCode(n+65);return(r+s).toLowerCase()}hasMore(){return this.hasMoreBits(1)}hasMoreBits(e){return Vn(e),this.#e+e<=this.buffer.length*8}assertOnlyPadding(){let e=this.buffer.length*8-this.#e;for(e>7&&(e>23||this.buffer.length%3!==0)&&j();e-- >0;)this.readBit()&&j()}},at=class{#e=[];writeBits(e,n){Vn(n);let r=n===Rn?Number.MAX_SAFE_INTEGER:2**n-1;if(!Number.isSafeInteger(e)||e<0||e>r)throw new Error(`BitWriter: value ${e} does not fit in ${n} bits`);let s=e.toString(2).padStart(n,"0");for(let i=0;i<n;i++)this.#e.push(s[i]==="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 r=0;r<this.#e.length;r++){let s=Math.floor(r/8),i=7-r%8;if(this.#e[r]===1){let o=n[s];o!==void 0&&(n[s]=o|1<<i)}}return n}};function ct(t){let e=Vt(t);if(e.length!==0)return new xe(e).readBits(3)}function Bt(t){let e=t.split("."),n=e[0]??"",r=Vt(n),s=new xe(r),i=s.readBits(6);if(i!==2)throw new Error(`TCF: unsupported TC string version ${i}`);let o=s.readBits(36),a=s.readBits(36),c=s.readBits(12),l=s.readBits(12),u=s.readBits(6),f=s.readLanguage(),p=s.readBits(12),h=s.readBits(6),d=s.readBool(),m=s.readBool(),b=Fn(s,12),v=Fn(s,24),C=Fn(s,24),I=s.readBool(),S=s.readLanguage(),g=Mn(s),x=Mn(s),B=Zi(s);s.assertOnlyPadding();let L={version:i,created:o,lastUpdated:a,cmpId:c,cmpVersion:l,consentScreen:u,consentLanguage:f,vendorListVersion:p,tcfPolicyVersion:h,isServiceSpecific:d,useNonStandardStacks:m,specialFeatureOptIns:b,purposeConsents:v,purposeLegitimateInterests:C,purposeOneTreatment:I,publisherCC:S,vendorConsents:g,vendorLegitimateInterests:x,publisherRestrictions:B};for(let se=1;se<e.length;se++){let y=new xe(Vt(e[se]??""));y.readBits(3)===1&&(L.disclosedVendors=Mn(y),y.assertOnlyPadding())}return L}function Fn(t,e){let n=new Set;for(let r=1;r<=e;r++)t.readBool()&&n.add(r);return n}function Mn(t){let e=t.readBits(16);if(!t.readBool()){let s=new Set;for(let i=1;i<=e;i++)t.readBool()&&s.add(i);return s}let r=ps(t,t.readBits(12),e);return r.some(s=>s.end===e)||j(),hs(r)}function ps(t,e,n){let r=[];for(let s=0;s<e;s++){let i=t.readBool(),o=t.readBits(16);if(fs(o,n),!i){r.push({start:o,end:o});continue}let a=t.readBits(16);fs(a,n),a<=o&&j(),r.push({start:o,end:a})}return r}function fs(t,e){(t<1||t>e)&&j()}function hs(t){let e=new Set;t.sort((r,s)=>r.start-s.start||r.end-s.end);let n=0;for(let r of t){let s=Math.max(r.start,n+1);for(let i=s;i<=r.end;i++)e.add(i);n=Math.max(n,r.end)}return e}function Zi(t){let e=t.readBits(12),n=[],r=new Set;for(let s=0;s<e;s++){let i=t.readBits(6);(i<1||i>24)&&j();let o=t.readBits(2);o>2&&j();let a=t.readBits(12),c=hs(ps(t,a,65535));Mt(r,i,c),n.push({purposeId:i,restrictionType:o,vendorIds:c})}return n}function Ut(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{Pe(n,"derived")}catch{throw new Error("TCF: invalid millisecond timestamp")}return n}function Pe(t,e){if(!Number.isSafeInteger(t)||t<0||t>68719476735||t%864e3!==0)throw new Error(`TCF: invalid ${e} timestamp`)}function $t(t,e){try{return Pe(t,"Created"),Pe(e,"LastUpdated"),t===e}catch{return!1}}function gs(t){return{resolve(e){let n=t.stacks[e];return n?{purposes:n.purposes,specialFeatures:n.specialFeatures}:null}}}var Gt=class t{decode;encode;opts;#e=null;#t=[];constructor(e,n,r={}){this.decode=e,this.encode=n,this.opts=r,!this.opts.stackResolver&&this.opts.base&&(this.opts.stackResolver=gs(this.opts.base))}static withBase(e,n,r,s={}){return new t(e,n,{...s,base:r,stackResolver:gs(r)})}static raw(e,n,r={}){return new t(e,n,r)}load(e){let n=this.decode(e);if(this.#e=n,this.#t=e.split("."),!$t(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 s of e.slice(1)){let i=ct(s);i!==void 0&&n.add(i)}let r=this.#t.slice(1).filter(s=>{let i=ct(s);return i!==void 0&&!n.has(i)});return[...e,...r].join(".")}getPurposeConsent(e){return this.#o(e),this.getDecoded().purposeConsents.has(e)}getPurposeConsents(){let e={},n=this.getDecoded().purposeConsents;for(let r=1;r<=24;r++)e[r]=n.has(r);return e}getPurposeLegitimateInterest(e){return this.#o(e),this.getDecoded().purposeLegitimateInterests.has(e)}getSpecialFeatureOptIn(e){return this.#l(e),this.getDecoded().specialFeatureOptIns.has(e)}getSpecialFeatureOptIns(){let e={},n=this.getDecoded().specialFeatureOptIns;for(let r=1;r<=12;r++)e[r]=n.has(r);return e}getVendorConsent(e){return this.#a(e),this.getDecoded().vendorConsents.has(e)}getVendorLegitimateInterest(e){return this.#a(e),this.getDecoded().vendorLegitimateInterests.has(e)}setVendorListVersion(e){if(!Number.isInteger(e)||e<1||e>4095)throw new Error("[TcfController] Vendor list version must be an integer from 1 to 4095");let n=this.getDecoded();return n.vendorListVersion===e?this:(n.vendorListVersion=e,this.#s())}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 r=this.getDecoded();return r.consentLanguage===n?this:(r.consentLanguage=n,this.#s())}setPurposeConsent(e,n){return this.#o(e),this.#r(this.getDecoded().purposeConsents,e,n)?this.#s():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.#r(this.getDecoded().purposeLegitimateInterests,e,n)?this.#s():this}setVendorConsent(e,n){return this.#a(e),this.#r(this.getDecoded().vendorConsents,e,n)?this.#s():this}setVendorLegitimateInterest(e,n){return this.#a(e),this.#r(this.getDecoded().vendorLegitimateInterests,e,n)?this.#s():this}setSpecialFeatureOptIn(e,n){return this.#l(e),this.#r(this.getDecoded().specialFeatureOptIns,e,n)?this.#s():this}setPurposeConsents(e,n){for(let r of e)this.setPurposeConsent(r,n);return this}setPurposeLegitimateInterests(e,n){for(let r of e)this.setPurposeLegitimateInterest(r,n);return this}setVendorConsents(e,n){for(let r of e)this.setVendorConsent(r,n);return this}setVendorLegitimateInterests(e,n){for(let r of e)this.setVendorLegitimateInterest(r,n);return this}setSpecialFeatureOptIns(e,n){for(let r of e)this.setSpecialFeatureOptIn(r,n);return this}applyStack(e,n){let r=this.opts.stackResolver;if(!r)throw new Error("TCF: applyStack requires opts.base or opts.stackResolver");let s=r.resolve(e);if(!s)throw new Error(`TCF: unknown stackId ${e}`);return s.purposes?.length&&this.setPurposeConsents(s.purposes,n),s.purposeLI?.length&&this.setPurposeLegitimateInterests(s.purposeLI,n),s.vendors?.length&&this.setVendorConsents(s.vendors,n),s.vendorLI?.length&&this.setVendorLegitimateInterests(s.vendorLI,n),s.specialFeatures?.length&&this.setSpecialFeatureOptIns(s.specialFeatures,n),this}setPublisherRestriction(e,n,r){this.#o(e);let s=this.getDecoded(),i=new Set;for(let c of r)this.#a(c),i.add(c);let o=s.publisherRestrictions?.find(c=>c.purposeId===e);if(o?.restrictionType===n&&this.#n(o.vendorIds,i))return this;s.publisherRestrictions||(s.publisherRestrictions=[]);let a=o;return a?(a.restrictionType=n,a.vendorIds.clear()):(a={purposeId:e,restrictionType:n,vendorIds:new Set},s.publisherRestrictions.push(a)),a.vendorIds=i,this.#s()}removePublisherRestrictionVendors(e,n){this.#o(e);let r=this.getDecoded(),s=r.publisherRestrictions;if(!s?.length)return this;let i=s.findIndex(c=>c.purposeId===e);if(i===-1)return this;let o=s[i];if(!o)return this;let a=!1;for(let c of n)this.#a(c),a=o.vendorIds.delete(c)||a;return a?(o.vendorIds.size===0&&(s.splice(i,1),s.length===0&&delete r.publisherRestrictions),this.#s()):this}clearPublisherRestriction(e){this.#o(e);let n=this.getDecoded(),r=n.publisherRestrictions;if(!r?.length)return this;let s=r.findIndex(i=>i.purposeId===e);return s===-1?this:(r.splice(s,1),r.length===0&&delete n.publisherRestrictions,this.#s())}#r(e,n,r){return e.has(n)===r?!1:(r?e.add(n):e.delete(n),!0)}#n(e,n){return e.size===n.size&&[...e].every(r=>n.has(r))}#s(){let e=this.getDecoded(),n=this.#i();return e.created=n,e.lastUpdated=n,this}#i(){return Ut(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}`:""})`)}#l(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 ms(t){let e=new at,n=t.created??t.lastUpdated??Ut(Date.now()),r=t.created??n,s=t.lastUpdated??n;if(Pe(r,"Created"),Pe(s,"LastUpdated"),r!==s)throw new Error("TCF: Created and LastUpdated must be equal");let i=t.version??2;if(i!==2)throw new Error(`TCF: unsupported TC string version ${i}`);e.writeBits(i,6),e.writeBits(r,36),e.writeBits(s,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 o=t.tcfPolicyVersion??5;if(o!==5)throw new Error(`TCF 2.4: unsupported policy version ${o}`);e.writeBits(o,6),e.writeBool(t.isServiceSpecific??!1),e.writeBool(t.useNonStandardStacks??!1),Bn(e,t.specialFeatureOptIns??new Set,12,"special-feature"),Bn(e,t.purposeConsents??new Set,24,"purpose-consent"),Bn(e,t.purposeLegitimateInterests??new Set,24,"purpose-legitimate-interest"),e.writeBool(t.purposeOneTreatment??!1),e.writeLanguage(t.publisherCC??"aa"),Un(e,t.vendorConsents,"vendor-consent"),Un(e,t.vendorLegitimateInterests,"vendor-legitimate-interest"),Qi(e,t.publisherRestrictions??[]);let a=e.toUint8Array(),c=Ft(a);if(t.disclosedVendors===void 0)throw new Error("TCF 2.4: disclosed vendors are required");let l=new at;l.writeBits(1,3),Un(l,t.disclosedVendors,"disclosed-vendor");let u=l.toUint8Array();return`${c}.${Ft(u)}`}function Bn(t,e,n,r){for(let s of e)re(s,1,n,r);for(let s=1;s<=n;s++)t.writeBool(e.has(s))}function Un(t,e,n){if(e.size===0){t.writeBits(0,16),t.writeBool(!1);return}let r=Array.from(e).sort((c,l)=>c-l);for(let c of r)re(c,1,65535,n);let s=r[r.length-1]??0,i=Ss(r),o=s,a=12+i.reduce((c,l)=>c+1+16+(l.start===l.end?0:16),0);if(o<=a){t.writeBits(s,16),t.writeBool(!1);for(let c=1;c<=s;c++)t.writeBool(e.has(c))}else{t.writeBits(s,16),t.writeBool(!0),re(i.length,0,2**12-1,`${n} range count`),t.writeBits(i.length,12);for(let c of i)c.start===c.end?(t.writeBool(!1),t.writeBits(c.start,16)):(t.writeBool(!0),t.writeBits(c.start,16),t.writeBits(c.end,16))}}function Ss(t){let e=[];if(t.length===0)return e;let n=t[0]??0,r=n;for(let s=1;s<t.length;s++){let i=t[s]??0;i===r+1?r=i:(e.push({start:n,end:r}),n=i,r=n)}return e.push({start:n,end:r}),e}function Qi(t,e){re(e.length,0,2**12-1,"publisher restriction count");let n=new Set;t.writeBits(e.length,12);for(let r of e){re(r.purposeId,1,24,"publisher restriction purpose"),re(r.restrictionType,0,2,"publisher restriction type"),t.writeBits(r.purposeId,6),t.writeBits(r.restrictionType,2);let s=Array.from(r.vendorIds).sort((o,a)=>o-a);for(let o of s)re(o,1,65535,"publisher restriction vendor");Mt(n,r.purposeId,s);let i=Ss(s);re(i.length,0,2**12-1,"publisher restriction range count"),t.writeBits(i.length,12);for(let o of i)o.start===o.end?(t.writeBool(!1),t.writeBits(o.start,16)):(t.writeBool(!0),t.writeBits(o.start,16),t.writeBits(o.end,16))}}function re(t,e,n,r){if(!Number.isSafeInteger(t)||t<e||t>n)throw new Error(`TCF: invalid ${r} ${t} (expected ${e}..${n})`)}function De(t){return Object.fromEntries([...t].map(e=>[e,!0]))}function ys(t){try{let e=t.split("."),n=e[1];return e.length===2&&n!==void 0&&ct(n)===1}catch{return!1}}function eo(t,e){if(t.version!==2||!$t(t.created,t.lastUpdated)||t.cmpId!==He||t.tcfPolicyVersion!==ce||!t.isServiceSpecific||!/^[a-z]{2}$/.test(t.consentLanguage)||!/^[a-z]{2}$/i.test(t.publisherCC)||!t.disclosedVendors)return;let n={};for(let s of t.publisherRestrictions??[]){if(s.restrictionType!==0&&s.restrictionType!==1&&s.restrictionType!==2)return;let i=s.purposeId.toString(),o=n[i]??{};for(let a of s.vendorIds){let c=a.toString();if(c in o)return;o[c]=s.restrictionType}n[i]=o}let r={...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:De(t.purposeConsents),legitimateInterests:De(t.purposeLegitimateInterests)},vendor:{consents:De(t.vendorConsents),legitimateInterests:De(t.vendorLegitimateInterests),disclosedVendors:De(t.disclosedVendors)},specialFeatureOptins:De(t.specialFeatureOptIns),publisher:{consents:{},legitimateInterests:{},customPurpose:{consents:{},legitimateInterests:{}},restrictions:n}};return gr(r)?r:void 0}var jt=class extends ne{tcfController;#e;#t;#r;#n;#s;#i;#c=!1;constructor(e,n,r){super(e,n,r),this.#e=r;let s=r.vendors.map(a=>a.id);[this.#t,this.#r,this.#n,this.#s,this.#i]=ar(r.vendors);let i={cmpId:He,cmpVersion:vr,vendorListVersion:"vendorListVersion"in r.framework?r.framework.vendorListVersion:0,tcfPolicyVersion:ce,purposeConsents:[],purposeLegitimateInterests:this.#r,specialFeatureOptins:[],vendorConsents:[],vendorLegitimateInterests:this.#i,disclosedVendors:s,purposes:[...new Set([...this.#t,...this.#r])],stacks:{}};this.tcfController=Gt.withBase(Bt,ms,i);let o=this.#o(s)==="decision";if(o&&this.hasValidConsent())try{this.syncFastPath(),this.mergeConsentDowngradeBaseline(this.getConsentDowngradeSnapshot())}catch{}else this.clearFastPathSignals();o&&this.extendConsentDowngradeBaseline(this.#l())}bootSyncsFastPath(){return!1}reloadExternalConsentState(e=!1){super.reloadExternalConsentState(e);let n=this.#e.vendors.map(s=>s.id),r=this.#o(n);this.#c=!e&&r===null,this.#c&&(this.tcfController.setPurposeLegitimateInterests(this.#r,!1),this.tcfController.setVendorLegitimateInterests(this.#i,!1))}markLegitimateInterestDisclosuresVisible(){!this.#c||this.state.hasConsent||(this.#c=!1,this.tcfController.setPurposeLegitimateInterests(this.#r,!0),this.tcfController.setVendorLegitimateInterests(this.#i,!0),this.emit({type:"consent:changed"}))}#o(e){let n=this.storage.getConsent(),r=!1;if((this.state.hasConsent||this.legacyRecord==="reask")&&n?.tcString&&ys(n.tcString))try{this.tcfController.load(n.tcString);let s=this.getTcfApiDecisionData();r=wt(Object.keys(s.vendor.disclosedVendors).map(Number))===wt(e)&&this.#a(s)}catch{}if(!r)this.#u(),n&&this.invalidateStoredConsent();else if(this.legacyRecord!==void 0){let s=this.getTcfApiDecisionData(),i=[s.purpose.consents,s.vendor.consents,s.specialFeatureOptins].some(o=>Object.values(o).some(Boolean));return this.legacyRecord==="refusal"&&!i?"decision":(this.legacyRecord==="refusal"&&(this.legacyRecord="reask",this.state=this.freshVisitorState(),this.clearFastPathSignals()),this.tcfController.setPurposeConsents(this.#t,!1),this.tcfController.setSpecialFeatureOptIns(this.#n,!1),this.tcfController.setVendorConsents(this.#s,!1),"objections")}return r?"decision":null}#a(e){let n=(s,i)=>Object.keys(s).every(o=>i.includes(Number(o)));if(!n(e.purpose.consents,this.#t)||!n(e.purpose.legitimateInterests,this.#r)||!n(e.vendor.consents,this.#s)||!n(e.vendor.legitimateInterests,this.#i)||!n(e.specialFeatureOptins,this.#n))return!1;let r=new Map(this.#e.vendors.map(s=>[s.id,s]));for(let[s,i]of Object.entries(e.publisher.restrictions)){let o=Number(s);for(let[a,c]of Object.entries(i)){let l=r.get(Number(a));if(!l||!(l.consentPurposeIds.includes(o)||l.legitimateInterestPurposeIds.includes(o))||c!==0&&!l.flexiblePurposeIds.includes(o)||c===2&&!l.legitimateInterestPurposeIds.includes(o))return!1}}return!0}getFastPathSyncOptions(){let e=this.getTcString(),n=this.getTcfApiDecisionData();return{...super.getFastPathSyncOptions(),decisionIntegrity:xt(e),tcfCmpId:He,tcfValidationVersion:Er,tcfDisclosedVendorKey:wt(this.#e.vendors.map(r=>r.id)),tcfApiData:n,tcfApiDataIntegrity:xt(mr(e,n))}}getConsentDowngradeSnapshot(){return{...super.getConsentDowngradeSnapshot(),...this.#l()}}getEvidenceConsentDecision(){return{...super.getEvidenceConsentDecision(),framework:K(Object.values(this.#l()))}}getExternalConsentSnapshot(e){let n=super.getExternalConsentSnapshot(e),s=Ae(e,this.storage.getScope())?.consent?.tcString;if(!s)return n;try{let i=Bt(s);return i.version!==2||i.tcfPolicyVersion!==ce||i.cmpId!==He?n:{...n,...this.#l(i)}}catch{return n}}getCurrentExternalConsentSnapshot(){let e=super.getCurrentExternalConsentSnapshot();return e?{...e,...this.#l()}:void 0}#l(e){let n={};for(let r of this.#t)n[`tcf:purpose:${r}`]=e?e.purposeConsents.has(r):this.tcfController.getPurposeConsent(r);for(let r of this.#r)n[`tcf:purposeLI:${r}`]=e?e.purposeLegitimateInterests.has(r):this.tcfController.getPurposeLegitimateInterest(r);for(let r of this.#n)n[`tcf:specialFeature:${r}`]=e?e.specialFeatureOptIns.has(r):this.tcfController.getSpecialFeatureOptIn(r);for(let r of this.#s)n[`tcf:vendor:${r}`]=e?e.vendorConsents.has(r):this.tcfController.getVendorConsent(r);for(let r of this.#i)n[`tcf:vendorLI:${r}`]=e?e.vendorLegitimateInterests.has(r):this.tcfController.getVendorLegitimateInterest(r);return n}acceptAll(){super.acceptAll(),this.tcfController.setPurposeConsents(this.#t,!0),this.tcfController.setPurposeLegitimateInterests(this.#r,!0),this.tcfController.setSpecialFeatureOptIns(this.#n,!0),this.tcfController.setVendorConsents(this.#s,!0),this.tcfController.setVendorLegitimateInterests(this.#i,!0)}rejectAll(){super.rejectAll(),this.tcfController.setPurposeConsents(this.#t,!1),this.tcfController.setPurposeLegitimateInterests(this.#r,!1),this.tcfController.setSpecialFeatureOptIns(this.#n,!1),this.tcfController.setVendorConsents(this.#s,!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({type:"purpose:toggled",payload:{id:e,value:n}}),this.emit({type:"consent:changed"})}getPurposeLegitimateInterest(e){return this.tcfController.getPurposeLegitimateInterest(e)}setPurposeLegitimateInterest(e,n){if(!this.#r.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({type:"purpose-legitimate-interest:toggled",payload:{id:e,value:n}}),this.emit({type:"consent:changed"})}getSpecialFeatureOptIn(e){return this.tcfController.getSpecialFeatureOptIn(e)}setSpecialFeatureOptIn(e,n){if(!this.#n.includes(e))throw new Error(`[TCF Engine] Special Feature ${e} was not disclosed`);this.tcfController.setSpecialFeatureOptIn(e,n),this.state.timestamp=Date.now(),this.emit({type:"special-feature:toggled",payload:{id:e,value:n}}),this.emit({type:"consent:changed"})}getVendorConsent(e){return this.tcfController.getVendorConsent(e)}setVendorConsent(e,n){if(!this.#s.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({type:"vendor:toggled",payload:{id:e,value:n}}),this.emit({type:"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({type:"vendor-legitimate-interest:toggled",payload:{id:e,value:n}}),this.emit({type:"consent:changed"})}getTcString(){return this.tcfController.toTcString()}getTcfApiDecisionData(){let e=this.getTcString(),n=Bt(e),r=ys(e)?eo(n,this.#e.gcm!==void 0):void 0;if(!r||!this.#a(r))throw new Error("Current TC model cannot produce complete current-GVL web TCData");return r}save(){this.tcfController.setVendorListVersion(this.#e.framework.vendorListVersion),this.#f(),super.save()}getPurposes(){let e=[];for(let n of new Set([...this.#t,...this.#r]))e.push({id:n,consent:this.getPurposeConsent(n),legitimateInterest:this.getPurposeLegitimateInterest(n)});return e}getSpecialFeatures(){let e=[];for(let n of this.#n)e.push({id:n,optIn:this.getSpecialFeatureOptIn(n)});return e}buildConsentEntry(e){return{consent:e,tcString:this.tcfController.toTcString(),decisionChoices:this.recordedChoices()}}#u(){this.tcfController.startNew(),this.#f()}#f(){let e=ir(this.getDisplayLocale());e&&this.tcfController.setConsentLanguage(e)}getFrameworkPrefix(){return"tcf"}resolve(e){let n=M(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:r}=n;if(!e.id)throw new Error(`[TCF Engine] ID required for TCF bindings: ${e.bindingKey}`);let s=parseInt(e.id,10);if(Number.isNaN(s))throw new Error(`[TCF Engine] Invalid numeric ID for TCF binding: ${e.id}`);switch(r){case"purpose":return this.#d(s);case"purposeLegitimateInterest":return this.#p(s);case"specialPurpose":return this.#g(s);case"feature":return this.#w(s);case"specialFeature":return this.#y(s);case"vendor":return this.#C(s);case"vendorLegitimateInterest":return this.#S(s);case"stack":return this.#v(s);default:throw new Error(`[TCF Engine] Unknown entity type: ${r}`)}}resolveMany(e){return{patches:e.map(r=>{let s=this.resolve(r);if(!r.id)throw new Error(`[TCF Engine] ID required for ${r.bindingKey}`);return{bindingKey:r.bindingKey,id:r.id,value:s.value,disabled:s.disabled}}),version:this.versionTracker.getVersion()}}apply(e){let n=M(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:r}=n,s=[];if(r==="purpose"){let o=parseInt(e.ref.id,10);this.setPurposeConsent(o,e.value);let a=this.#d(o);s.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:a.value,disabled:a.disabled})}else if(r==="purposeLegitimateInterest"){let o=parseInt(e.ref.id,10);this.setPurposeLegitimateInterest(o,e.value);let a=this.#p(o);s.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:a.value,disabled:a.disabled})}else if(r==="specialFeature"){let o=parseInt(e.ref.id,10);this.setSpecialFeatureOptIn(o,e.value);let a=this.#y(o);s.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:a.value,disabled:a.disabled})}else if(r==="vendor"){let o=parseInt(e.ref.id,10);this.setVendorConsent(o,e.value);let a=this.#C(o);s.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:a.value,disabled:a.disabled})}else if(r==="vendorLegitimateInterest"){let o=parseInt(e.ref.id,10);this.setVendorLegitimateInterest(o,e.value);let a=this.#S(o);s.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:a.value,disabled:a.disabled})}else if(r==="stack"){let o=parseInt(e.ref.id,10),a=this.#h(o);for(let l of a.purposes)this.#t.includes(l)&&(this.tcfController.setPurposeConsent(l,e.value),this.emit({type:"purpose:toggled",payload:{id:l,value:e.value}}));for(let l of a.specialFeatures)this.#n.includes(l)&&(this.tcfController.setSpecialFeatureOptIn(l,e.value),this.emit({type:"special-feature:toggled",payload:{id:l,value:e.value}}));this.state.timestamp=Date.now(),this.emit({type:"consent:changed"});let c=this.#v(o);s.push({bindingKey:e.ref.bindingKey,id:e.ref.id,value:c.value,disabled:c.disabled});for(let l of a.purposes){if(!this.#t.includes(l))continue;let u=this.#d(l);s.push({bindingKey:"consent:tcf.purpose",id:String(l),value:u.value,disabled:u.disabled})}for(let l of a.specialFeatures){if(!this.#n.includes(l))continue;let u=this.#y(l);s.push({bindingKey:"consent:tcf.specialFeature",id:String(l),value:u.value,disabled:u.disabled})}}else throw new Error(`[TCF Engine] Cannot apply changes to entity type: ${r}`);let i=this.versionTracker.increment();return{patches:s,version:i}}#d(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}}#p(e){if(!this.#r.includes(e))throw new Error(`[TCF Engine] Purpose ${e} has no legitimate-interest legal basis`);return{value:this.getPurposeLegitimateInterest(e),disabled:!1}}#g(e){return{value:!0,disabled:!0}}#w(e){return{value:!0,disabled:!0}}#y(e){if(!this.#n.includes(e))throw new Error(`[TCF Engine] Special Feature ${e} was not disclosed`);return{value:this.getSpecialFeatureOptIn(e),disabled:!1}}#C(e){if(!this.#s.includes(e))throw new Error(`[TCF Engine] Vendor ${e} has no consent legal basis`);return{value:this.getVendorConsent(e),disabled:!1}}#S(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}}#h(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 r=n.tcf?.gvl?.stacks?.[e];if(!r)throw new Error(`[TCF Engine] Unknown stack id: ${e}`);if(r.purposes.length+r.specialFeatures.length<2)throw new Error(`[TCF Engine] Invalid stack membership for id: ${e}`);return{purposes:r.purposes,specialFeatures:r.specialFeatures}}#v(e){let n=this.#h(e),r=n.purposes.filter(c=>this.#t.includes(c)),s=n.specialFeatures.filter(c=>this.#n.includes(c)),i=r.length+s.length>0,o=r.every(c=>this.getPurposeConsent(c)),a=s.every(c=>this.getSpecialFeatureOptIn(c));return{value:i&&o&&a,disabled:!i}}};function Kt(t,e,n=[e]){let r=t.toLowerCase();if(n.some(i=>r.includes(i.toLowerCase())))return t;let s=t.trimEnd();return s?`${s} ${e}`:e}function to(t,e,n=e){let r=n.split("-")[0]?.toLowerCase()==="de"?"de":"en",s=Sr[r],i=wr[r],o=[s,yr[r]],a=[Sn[r],Cr[r]],c=Kt(t.description,s,o),l=t.details,u=Kt(Kt(l?.description??"",s,o),Sn[r],a),f=Kt(u,i);return c===t.description&&l?.description===f?t:{...t,description:c,details:l?{...l,description:f}:{title:t.title,description:f,button:t.button,legalLinks:t.legalLinks}}}var lt=class extends q{engine;constructor(e,n){super(e,n),this.engine=new jt(this.bus,this.storage,e),this.attachBlocking(this.engine),this.resolveInitialLocale()}normalizeTranslations(e,n,r){return to(e,n,r)}async init(){this.engine.isConsentRequired()?await this.showInitialNotice():(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 A={US_NATIONAL:7,US_CA:8,US_VA:9,US_CO:10,US_CT:12,US_FL:13},zt={CA:A.US_CA,VA:A.US_VA,CO:A.US_CO,CT:A.US_CT,FL:A.US_FL};var $n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",dt=class{bits=[];writeBit(e){this.bits.push(e?1:0)}writeInt(e,n){for(let r=n-1;r>=0;r--)this.bits.push(e>>>r&1)}writeBoolean(e){this.writeBit(e)}writeFibonacciRange(e){let[n,...r]=e;if(n===void 0){this.writeInt(0,12);return}let s=[],i=n,o=i;for(let c of r)c===o+1||(s.push({start:i,end:o}),i=c),o=c;s.push({start:i,end:o}),this.writeInt(s.length,12);let a=0;for(let c of s)c.start===c.end?(this.writeBit(!1),this.writeFibonacci(c.start-a),a=c.start):(this.writeBit(!0),this.writeFibonacci(c.start-a),this.writeFibonacci(c.end-c.start),a=c.end)}writeFibonacci(e){let n=no(e),r=new Array(n.length).fill(!1),s=e;for(let o=n.length-1;o>=0&&s>0;o--){let a=n[o];a!==void 0&&a<=s&&(r[o]=!0,s-=a)}let i=r.length-1;for(;i>=0&&!r[i];)i--;for(let o=0;o<=i;o++)this.writeBit(r[o]===!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 r=0;for(let s of this.bits.slice(n,n+6))r=r<<1|s;e+=$n[r]}return e}};function no(t){let e=[1,2],n=1,r=2;for(;r<t;)[n,r]=[r,n+r],e.push(r);return e}function Cs(t){let e=t.mspaMode??"not_covered",n=e==="service_provider",r=!n&&t.sensitivePIInUse===!0,s=t.limitSensitiveUse===!0||t.sensitiveOptInRequired===!0;return{mode:e,sp:n,notice:n?0:1,optOut:i=>n?0:i?1:2,sensitiveInUse:r,sensitiveValue:r?s?1:2:0,knownMinor:!n&&t.knownMinor===!0,mspaFields:{MspaCoveredTransaction:e==="not_covered"?2:1,MspaOptOutOptionMode:e==="opt_out"?1:0,MspaServiceProviderMode:n?1:0}}}function ws(t){let{notice:e,optOut:n,sensitiveInUse:r,sensitiveValue:s,knownMinor:i,mspaFields:o}=Cs(t);return{Version:2,SharingNotice:e,SaleOptOutNotice:e,SharingOptOutNotice:e,TargetedAdvertisingOptOutNotice:e,SensitiveDataProcessingOptOutNotice:0,SensitiveDataLimitUseNotice:r?1:0,SaleOptOut:n(t.saleOptOut),SharingOptOut:n(t.sharingOptOut),TargetedAdvertisingOptOut:n(t.sharingOptOut),SensitiveDataProcessing:new Array(16).fill(s),KnownChildSensitiveDataConsents:i?[1,1,1]:[0,0,0],PersonalDataConsents:0,...o,Gpc:t.gpcDetected,GpcSegmentType:1,GpcSegmentIncluded:!0}}var Ne=[{name:"MspaCoveredTransaction",bits:2},{name:"MspaOptOutOptionMode",bits:2},{name:"MspaServiceProviderMode",bits:2}],Le={[A.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},...Ne]},[A.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},...Ne]},[A.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},...Ne]},[A.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},...Ne]},[A.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},...Ne]},[A.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},...Ne]}};function vs(t,e){if(t===A.US_NATIONAL)return{...ws(e)};let{notice:n,optOut:r,sensitiveInUse:s,sensitiveValue:i,knownMinor:o,mspaFields:a}=Cs(e),c={Gpc:e.gpcDetected,GpcSegmentType:1,GpcSegmentIncluded:!0};if(t===A.US_CA){let p=i;return{Version:1,SaleOptOutNotice:n,SharingOptOutNotice:n,SensitiveDataLimitUseNotice:s?1:0,SaleOptOut:r(e.saleOptOut),SharingOptOut:r(e.sharingOptOut),SensitiveDataProcessing:new Array(9).fill(p),KnownChildSensitiveDataConsents:o?[1,1]:[0,0],PersonalDataConsents:0,...a,...c}}let l=Le[t];if(!l)throw new Error(`[GPP Encoder] Unsupported section id: ${t}`);let u={Version:1,SharingNotice:n,ProcessingNotice:n,SaleOptOutNotice:n,TargetedAdvertisingOptOutNotice:n,SaleOptOut:r(e.saleOptOut),TargetedAdvertisingOptOut:r(e.sharingOptOut),SensitiveDataProcessing:s?1:0,KnownChildSensitiveDataConsents:o?1:0,AdditionalDataProcessingConsent:0,...a},f={};for(let p of l.fields){let h=u[p.name];if(h===void 0)throw new Error(`[GPP Encoder] No value mapping for field: ${p.name}`);f[p.name]="array"in p?new Array(p.array).fill(h):h}return{...f,...l.hasGpc?c:{}}}var ut={encode(t,e){let n=[...e].sort((i,o)=>i-o),r=ut.encodeHeader(n),s=n.map(i=>ut.encodeSection(i,t));return[r,...s].join("~")},encodeHeader(t){let e=new dt;return e.writeInt(3,6),e.writeInt(1,6),e.writeFibonacciRange(t),e.toBase64()},encodeSection(t,e){let n=Le[t];if(!n)return"";let r=vs(t,e),s=new dt;for(let o of n.fields){let a=r[o.name];if("array"in o){let c=Array.isArray(a)?a:[];for(let l=0;l<o.array;l++){let u=c[l];s.writeInt(typeof u=="number"?u:0,2)}}else s.writeInt(typeof a=="number"?a:0,o.bits)}if(!n.hasGpc)return s.toBase64();let i=new dt;return i.writeInt(1,2),i.writeBoolean(r.Gpc===!0),`${s.toBase64()}.${i.toBase64()}`}};function Es(t,{appId:e,frameworkId:n,type:r}){if(!t)return"none";let s;try{let i=JSON.parse(t);if(!mt(i))return"damaged";let o=i.apps[e];if(o!==void 0&&!Tt(o))return"damaged";s=o?.frameworks[n]}catch{return"damaged"}return typeof s!="object"||s===null||!("type"in s)||s.type!==r?"none":!Ee(s)||[s.consent,s.prior].some(i=>i&&!Qe(i))?"damaged":s.consentUnreadableAt===void 0?"none":"marked"}var ft=class{bits=[];pos=0;constructor(e){for(let n of e){let r=$n.indexOf(n);if(r<0)throw new Error(`[GPP Decoder] Invalid base64 character: ${n}`);for(let s=5;s>=0;s--)this.bits.push(r>>>s&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 r=0;r<e;r++)n=n<<1|(this.readBit()?1:0);return n}readFibonacci(){let e=[],n=!1;for(;;){let o=this.readBit();if(o&&n)break;e.push(o),n=o}let r=0,s=1,i=2;for(let o of e)o&&(r+=s),[s,i]=[i,s+i];return r}readFibonacciRange(){let e=this.readInt(12),n=[],r=0;for(let s=0;s<e;s++){let i=this.readBit(),o=this.readFibonacci()+r;if(i){let a=this.readFibonacci()+o;for(let c=o;c<=a;c++)n.push(c);r=a}else n.push(o),r=o}return n}},ke={decode(t){let e=t.split("~"),n=e[0];if(!n)throw new Error("[GPP Decoder] Empty GPP string");let r=ke.decodeHeader(n);if(r.length!==e.length-1)throw new Error(`[GPP Decoder] Header lists ${r.length} section(s) but ${e.length-1} present`);for(let s=0;s<r.length;s++){let i=r[s],o=e[s+1];if(i!==void 0&&o!==void 0&&Le[i])return{sectionIds:r,data:ke.decodeSection(i,o)}}throw new Error("[GPP Decoder] No supported US section present")},decodeHeader(t){let e=new ft(t),n=e.readInt(6);if(n!==3)throw new Error(`[GPP Decoder] Not a GPP header (type ${n})`);let r=e.readInt(6);if(r!==1)throw new Error(`[GPP Decoder] Unsupported GPP version ${r}`);return e.readFibonacciRange()},decodeSection(t,e){let n=Le[t];if(!n)throw new Error(`[GPP Decoder] Unsupported section id ${t}`);let[r,s]=e.split(".");if(!r)throw new Error("[GPP Decoder] Missing core subsection");let i=new ft(r),o={};for(let h of n.fields)if("array"in h){let d=[];for(let m=0;m<h.array;m++)d.push(i.readInt(2));o[h.name]=d}else o[h.name]=i.readInt(h.bits);let a=t===A.US_NATIONAL?2:1;if(o.Version!==a)throw new Error(`[GPP Decoder] Unsupported ${n.prefix} version ${String(o.Version)}`);let c=o.SaleOptOut===1,u=(o.SharingOptOut??o.TargetedAdvertisingOptOut)===1,f=!1;if(t===A.US_NATIONAL||t===A.US_CA){let h=o.SensitiveDataProcessing;f=Array.isArray(h)&&h.some(d=>d===1)}let p=!1;if(n.hasGpc&&s){let h=new ft(s);h.readInt(2)===1&&(p=h.readBit())}return{saleOptOut:c,sharingOptOut:u,gpcDetected:p,limitSensitiveUse:f}}};function Re(){return{optedOutOfSale:!1,optedOutOfShare:!1,limitSensitiveUse:!1,gpcDetected:!1,timestamp:0,lastOptOutAt:0}}var ro=365*24*60*60*1e3;function so(){return ze()}function Ts(){if(typeof globalThis>"u")return;let t=globalThis;if(!("__1C_GEO"in t))return;let e=t.__1C_GEO;return k(e)?e:void 0}function bs(){let t=Ts();if(!t||!("country"in t)||t.country!=="US"||!("region"in t)||typeof t.region!="string")return;let e=t.region.toUpperCase();return/^[A-Z]{2}$/.test(e)?e:void 0}function Gn(t){let e=Ts()?.[t];return typeof e=="boolean"?e:void 0}function io(t){let e="limitSensitiveUse"in t?t.limitSensitiveUse:void 0;try{let n=t.gppString?ke.decode(t.gppString).data:void 0;return n?.saleOptOut===!0||n?.sharingOptOut===!0||(e??n?.limitSensitiveUse)===!0}catch{return!0}}var Ht=class extends ne{#e=Re();#t;#r;#n;#s;#i;#c;#o=!1;#a=!1;#l=!1;#u=!1;#f=!1;#d;#p=!1;#g=0;#w;constructor(e,n,r){let s=n.getConsent();super(e,n,r),this.#x(s),this.#t=so(),this.#i=bs(),this.#w=Gn("sensitiveOptIn");let i=r.us;this.#r=i?.mspaMode??"not_covered",this.#n=i?.sensitivePIInUse===!0,this.#s=i?.minorsPosture==="known_minors",this.#c=i?.denyAll===!0,this.#S();try{this.syncFastPath(this.#p?()=>{}:void 0)}catch{}this.mergeConsentDowngradeBaseline(this.getConsentDowngradeSnapshot())}bootSyncsFastPath(){return!1}reloadExternalConsentState(e=!1){this.#f=!1;let n=this.state.hasConsent||this.storage.getConsent()!==void 0||this.storage.getFastPath()!==void 0,r=this.#y(),s=this.storage.getConsent();if(super.reloadExternalConsentState(e),this.#x(s),!e&&n&&!r){this.#C();return}this.#S(),e&&(this.#u=!1)}#y(){let e=this.storage.getConsent();if(!e)return!1;try{O.decodeForConfig(e.consent,this.config)}catch{return!1}if(e.gppString)try{return ke.decode(e.gppString),!0}catch{return!1}return!1}#C(){let e=this.storage.getConsent()!==void 0||this.#P()!=="none";(this.storage.getConsent()||this.storage.getFastPath())&&this.invalidateStoredConsent(),e&&this.#T(),this.#l=e,this.#e={...Re(),optedOutOfSale:!0,optedOutOfShare:!0,limitSensitiveUse:e&&this.#n,gpcDetected:this.#t},this.#o=!1,this.#a=!1,this.#g=this.#O()}#S(){this.#d=this.#R(),this.#e=this.#v(),this.#o=this.validatedStoredDecision!==void 0&&(this.#e.optedOutOfSale||this.#e.optedOutOfShare)&&!this.#s,this.#a=this.validatedStoredDecision!==void 0&&(this.#e.optedOutOfSale||this.#e.optedOutOfShare),this.#t&&(this.#e.gpcDetected=!0),this.#h()&&(this.#e.optedOutOfSale=!0,this.#e.optedOutOfShare=!0),this.#g=this.#O()}#h(){return this.#t||this.#s}#v(){this.#l=!1;let e=this.storage.getConsentSnapshot()??this.storage.getLatestConsentSnapshot(),n=e?.content;if(this.validatedStoredDecision=void 0,n){let s=0;try{let i=e?.prior?O.decode(n.consent):O.decodeForConfig(n.consent,this.config);if(i.configId!==this.config.appId||i.framework!=="us")throw new Error("US decision belongs to a different application or framework.");let o=i.timestamp*1e3;Number.isSafeInteger(o)&&o>0&&(s=o)}catch(i){return console.warn("[US Engine] Invalid stored consent timestamp",i),this.#I()}if(n.gppString)try{let{data:i}=ke.decode(n.gppString);this.validatedStoredDecision=e;let o=i.saleOptOut||i.sharingOptOut;return{optedOutOfSale:i.saleOptOut,optedOutOfShare:i.sharingOptOut,limitSensitiveUse:this.#n&&(n.limitSensitiveUse??i.limitSensitiveUse)===!0,gpcDetected:!1,timestamp:s,lastOptOutAt:o?s:0}}catch(i){console.warn("[US Engine] Stored GPP string invalid; decision rejected:",i)}return this.#I()}let r=this.#P();return r==="damaged"?this.#I():r==="marked"?this.#D():{...Re(),timestamp:Date.now()}}#x(e){e&&!this.storage.getConsent()&&io(e)&&this.#T()}#T(){try{this.storage.markConsentUnreadable()}catch(e){console.warn("[US Engine] Unreadable consent marker not stored",e)}}#I(){return this.invalidateStoredConsent(),this.#T(),this.#D()}#P(){return Es(this.storage.readDocument(),this.storage.getScope())}#D(){return this.#l=!0,{...Re(),optedOutOfSale:!0,optedOutOfShare:!0,limitSensitiveUse:this.#n}}getFrameworkPrefix(){return"us"}acceptAll(){this.#u=!0,this.#h()||(this.#V()||(this.#e.optedOutOfSale=!1,this.#e.optedOutOfShare=!1),this.#e.limitSensitiveUse=!1),super.acceptAll(),this.#e.timestamp=Date.now()}setCategoryConsent(e,n){this.#u=!0,super.setCategoryConsent(e,n)}setServiceConsent(e,n){this.#u=!0,super.setServiceConsent(e,n)}setConsent(e){this.#u=!0,super.setConsent(e)}save(){this.#u||this.#M();let e=this.#N(this.#m());if(e){for(let r of this.config.categories)e("categories",r)&&(this.state.categories[r.id]=!1);for(let r of this.config.services)e("services",r)&&(this.state.services[r.id]=!1)}super.save(),this.#u=!1;let n=this.#m();this.#a=n.optedOutOfSale||n.optedOutOfShare}#M(){let e=!this.state.hasConsent,n=e?void 0:this.#B(),r=(s,i,o)=>{(e||o[i.id]!==!0&&n?.(s,i))&&(o[i.id]=this.#A(s,i))};for(let s of this.config.categories)r("categories",s,this.state.categories);for(let s of this.config.services)r("services",s,this.state.services)}#B(){return this.#a?this.#E(!1):this.#n?this.#E(!0):void 0}#N(e){return e.optedOutOfSale||e.optedOutOfShare||this.#h()?this.#E(!1):this.#L(e)?this.#E(!0):void 0}#E(e){let n=e?this.#G():void 0;return(r,s)=>s.essential!==!0&&(!n||n[r].has(s.id))}#U(e){let n=this.#N(this.#m());return n?this.#$(e,n):e}#$(e,n){let r={...e};for(let s of this.config.categories)n("categories",s)&&(r[s.id]=!1);for(let s of this.config.services)n("services",s)&&(r[s.id]=!1);return r}#L(e){return this.#n&&e.limitSensitiveUse||this.#k()}#k(){return this.#n&&(this.#w??Qt(this.#i))}#R(){if(this.#p=!1,this.legacyRecord!=="reask")return;let e=this.storage.getConsentSnapshot(),n=e?.content.legacyAllowance;if(n)return n;let r=this.storage.getFastPath(),s=(o,a={})=>o.filter(({id:c})=>a[c]).map(({id:c})=>c),i={categories:s(this.config.categories,r?.categories),services:s(this.config.services,r?.services)};try{this.storage.amendConsent(e,{legacyAllowance:i})}catch(o){this.#p=!0,console.error("[US Engine] Legacy allowance not stored",o)}return i}#A(e,{id:n,essential:r}){return r===!0||(this.#d?.[e].includes(n)??!0)}#O(){return(this.#e.optedOutOfSale?1:0)|(this.#e.optedOutOfShare?2:0)}getEvidenceConsentDecision(){let e=this.#m();return{...super.getEvidenceConsentDecision(),framework:K([!e.optedOutOfSale,!e.optedOutOfShare,...this.#n?[!this.#L(e)]:[]])}}rejectAll(){this.#u=!0,super.rejectAll(),this.#V()||(this.#e.optedOutOfSale=!0,this.#e.optedOutOfShare=!0),this.#n&&(this.#e.limitSensitiveUse=!0),(this.#e.optedOutOfSale||this.#e.optedOutOfShare)&&this.#_()}#V(){return this.#f||this.getCommittedSaleSharingChoice()!==void 0}#_(){let e=Date.now();this.#e.timestamp=e,this.#e.lastOptOutAt=e}isWithinReconsentWindow(){let{lastOptOutAt:e}=this.#m();return e>0&&Date.now()-e<ro}getOptOutOfSale(){return this.#m().optedOutOfSale}setOptOutOfSale(e){this.#b(e,"sale")}getOptOutOfShare(){return this.#m().optedOutOfShare}setOptOutOfShare(e){this.#b(e,"share")}setOptOutOfSaleAndShare(e){this.#b(e,"saleAndShare")}#b(e,n,r=!0){let s=this.#h();if(!e&&s){console.warn("[US Engine] Sale/sharing opt-in is locked");return}this.#f=r&&!s,n!=="share"&&(this.#e.optedOutOfSale=e),n!=="sale"&&(this.#e.optedOutOfShare=e),e?this.#_():this.#e.timestamp=Date.now(),this.emit({type:"consent:changed"})}getLimitSensitiveUse(){return this.#e.limitSensitiveUse}getSensitivePIInUse(){return this.#n}setLimitSensitiveUse(e){if(!this.#n){console.warn("[US Engine] Sensitive PI is not in use");return}this.#e.limitSensitiveUse=e,e?this.#_():this.#e.timestamp=Date.now(),this.emit({type:"consent:changed"})}isGpcDetected(){return this.#t}getUsPrivacyState(){return{...this.#e}}getConsent(){let{categories:e,services:n}=this.getEnforcementConsentState();return{...e,...n}}getFastPathConsentMap(){return this.#F().map}#F(){let e=this.#m(),n=this.state.hasConsent&&this.hasValidConsent(),r=this.#n&&e.limitSensitiveUse,s=e.limitSensitiveUse&&!this.#l,i=n||this.#o||this.#t||s,a=(n?this.getConsentTimestamp():null)??(this.#o||s?e.timestamp:0),c=n?super.getFastPathConsentMap():this.#c&&!r?this.#j():this.#K();return{map:this.#U(c),decided:i,posture:!i,decisionTimestamp:a}}#G(){let e=this.config.services.filter(r=>r.usSensitive===!0&&r.essential!==!0);if(e.length===0)return;let n=new Set(e.map(r=>r.categoryId));return{services:new Set(e.map(r=>r.id)),categories:new Set(this.config.categories.filter(r=>n.has(r.id)&&r.essential!==!0).map(r=>r.id))}}#j(){return{...this.getDefaultCategoryConsents(),...this.getDefaultServiceConsents()}}#K(){let e={};return this.config.categories.forEach(n=>{e[n.id]=this.#A("categories",n)}),this.config.services.forEach(n=>{e[n.id]=this.#A("services",n)}),e}syncFastPath(e){let n=this.#F(),r=n.decided&&n.decisionTimestamp>0;st(this.config,n.map,{gpcRevocable:!0,posture:n.posture,decisionTimestamp:n.decisionTimestamp,cookieMode:r?"decision":"clear"},e??(s=>this.storage.refreshFastPath(s,this.validatedStoredDecision)))}clearFastPathSignals(){this.#R(),this.#p||super.clearFastPathSignals()}buildConsentEntry(e){let n=this.getCommittedSaleSharingChoice();return this.#f&&(this.getOptOutOfSale()||this.getOptOutOfShare()?n=!1:n===!1&&(n=!0)),{consent:e,decisionChoices:this.recordedChoices(),uspString:this.getUsPrivacyString(),gppString:this.getGppString(),limitSensitiveUse:this.#e?.limitSensitiveUse===!0,...n===void 0?{}:{explicitSaleSharing:n}}}getCommittedSaleSharingChoice(){return this.validatedStoredDecision?.content.explicitSaleSharing}savedConsentEvent(){let e=this.#O(),n=(e&~this.#g)!==0;this.#g=e;let r=this.#f?this.getCommittedSaleSharingChoice():void 0;return this.#f=!1,{type:"consent:saved",payload:{usSaleShareOptOut:!this.#h()&&n},...r===void 0?{}:{explicitSaleSharing:r}}}#m(){return this.externalReconciliationPending?{...Re(),optedOutOfSale:!0,optedOutOfShare:!0,limitSensitiveUse:!0}:this.#e??Re()}getApplicableGppSections(){let n=Be(this.config)&&this.config.us?.stateGeo===!0?bs():void 0;return[(n?zt[n]:void 0)??A.US_NATIONAL]}getUsNationalSectionData(){let e=this.#m();return{saleOptOut:e.optedOutOfSale,sharingOptOut:e.optedOutOfShare,gpcDetected:e.gpcDetected,mspaMode:this.#r,sensitivePIInUse:this.#n,limitSensitiveUse:e.limitSensitiveUse,sensitiveOptInRequired:this.#k(),knownMinor:this.#s}}getGppString(){return ut.encode(this.getUsNationalSectionData(),this.getApplicableGppSections())}resolve(e){let n=M(e.bindingKey);if(n?.framework!=="us")throw new Error(`[US Engine] Invalid binding key: ${e.bindingKey}`);let{entity:r}=n,{optedOutOfSale:s,optedOutOfShare:i,limitSensitiveUse:o}=this.#e;if(r==="limitSensitiveUse")return{value:o,disabled:!this.#n};if(r!=="sale"&&r!=="share"&&r!=="saleAndShare")throw new Error(`[US Engine] Unknown entity type: ${r}`);return{value:(r==="share"||s)&&(r==="sale"||i),disabled:this.#h()}}resolveMany(e){let n=[];for(let r of e)try{let s=this.resolve(r);n.push({bindingKey:r.bindingKey,value:s.value,disabled:s.disabled})}catch(s){console.error("[US Engine] Failed to resolve binding:",r,s)}return{patches:n,version:this.versionTracker.getVersion()}}apply(e){let n=M(e.ref.bindingKey);if(n?.framework!=="us")throw new Error(`[US Engine] Invalid binding key: ${e.ref.bindingKey}`);let{entity:r}=n;if(r==="limitSensitiveUse")this.setLimitSensitiveUse(e.value);else if(r==="sale"||r==="share"||r==="saleAndShare")this.#b(e.value,r,e.source==="ui");else throw new Error(`[US Engine] Unknown entity type: ${r}`);let s=[e.ref];r==="saleAndShare"&&s.push({bindingKey:"consent:us.sale"},{bindingKey:"consent:us.share"});let i=s.map(a=>({bindingKey:a.bindingKey,...this.resolve(a)})),o=this.versionTracker.increment();return{patches:i,version:o}}getUsPrivacyString(){return`1Y${this.#m().optedOutOfSale?"Y":"N"}-`}};var pt=class extends q{engine;constructor(e,n){super(e,n),this.engine=new Ht(this.bus,this.storage,e);let r=Zt(e,Gn("usStateCovered"));this.bus.visitorInitiatedPrivacy=r!==void 0,this.bus.hideTrigger=r==="none",this.attachBlocking(this.engine),this.resolveInitialLocale()}async init(){this.bus.emit({type:"consent:ready"});let e=!this.bus.visitorInitiatedPrivacy&&!this.engine.isGpcDetected()&&this.engine.isConsentRequired();e&&this.config.cmp.main?await this.showInitialNotice():!e&&!this.bus.hideTrigger&&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 jn=window.__1CONSENT_CONFIG__;if(pe(jn)){let t=jn,e=new rt;_t(t).then(async n=>{let r=await n.withExclusiveAccess(()=>tn(t)?new ot(t,{bus:e,storage:n}):nn(t)?new lt(t,{bus:e,storage:n}):Be(t)?new pt(t,{bus:e,storage:n}):null);if(!r)throw new Error("[Design Kit] Unsupported CMP framework config.");let s=bn(r),i=new us(e,r.engine,()=>r.getTranslations(),()=>r.openDetails(),o=>r.ensureViewData(o),o=>r.hasViewData(o),o=>r.setLanguage(o),()=>r.getThemeMode());window.__1consent=s,r.setViewEngine(i),r.init().catch(o=>console.error("[Design Kit] Controller init failed",o))}).catch(n=>console.error("[Design Kit] Runtime initialization failed",n))}else jn!==void 0&&console.error("[Design Kit] Refusing to initialize an invalid CMP runtime config.");
|