Socket
Socket
Sign inDemoInstall

@iabtcf-preprod/core

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.5.7 to 1.5.8

2

lib/cjs/Cloneable.js

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Cloneable=void 0;class Cloneable{clone(){const e=new this.constructor;return Object.keys(this).forEach(o=>{const t=this.deepClone(this[o]);void 0!==t&&(e[o]=t)}),e}deepClone(e){const o=typeof e;if("number"===o||"string"===o||"boolean"===o)return e;if(null!==e&&"object"===o){if("function"==typeof e.clone)return e.clone();if(e instanceof Date)return new Date(e.getTime());if(void 0!==e[Symbol.iterator]){const o=[];for(const t of e)o.push(this.deepClone(t));return e instanceof Array?o:new e.constructor(o)}{const o={};for(const t in e)e.hasOwnProperty(t)&&(o[t]=this.deepClone(e[t]));return o}}}}exports.Cloneable=Cloneable;
"use strict";var __values=this&&this.__values||function(e){var r="function"==typeof Symbol&&Symbol.iterator,t=r&&e[r],n=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Cloneable=void 0;var Cloneable=function(){function e(){}return e.prototype.clone=function(){var e=this,r=new this.constructor;return Object.keys(this).forEach((function(t){var n=e.deepClone(e[t]);void 0!==n&&(r[t]=n)})),r},e.prototype.deepClone=function(e){var r,t,n=typeof e;if("number"===n||"string"===n||"boolean"===n)return e;if(null!==e&&"object"===n){if("function"==typeof e.clone)return e.clone();if(e instanceof Date)return new Date(e.getTime());if(void 0!==e[Symbol.iterator]){var o=[];try{for(var i=__values(e),l=i.next();!l.done;l=i.next()){var a=l.value;o.push(this.deepClone(a))}}catch(e){r={error:e}}finally{try{l&&!l.done&&(t=i.return)&&t.call(i)}finally{if(r)throw r.error}}return e instanceof Array?o:new e.constructor(o)}var u={};for(var f in e)e.hasOwnProperty(f)&&(u[f]=this.deepClone(e[f]));return u}},e}();exports.Cloneable=Cloneable;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Base64Url=void 0;const index_js_1=require("../errors/index.js");class Base64Url{static encode(e){if(!/^[0-1]+$/.test(e))throw new index_js_1.EncodingError("Invalid bitField");const t=e.length%this.LCM;e+=t?"0".repeat(this.LCM-t):"";let s="";for(let t=0;t<e.length;t+=this.BASIS)s+=this.DICT[parseInt(e.substr(t,this.BASIS),2)];return s}static decode(e){if(!/^[A-Za-z0-9\-_]+$/.test(e))throw new index_js_1.DecodingError("Invalidly encoded Base64URL string");let t="";for(let s=0;s<e.length;s++){const r=this.REVERSE_DICT.get(e[s]).toString(2);t+="0".repeat(this.BASIS-r.length)+r}return t}}exports.Base64Url=Base64Url,Base64Url.DICT="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",Base64Url.REVERSE_DICT=new Map([["A",0],["B",1],["C",2],["D",3],["E",4],["F",5],["G",6],["H",7],["I",8],["J",9],["K",10],["L",11],["M",12],["N",13],["O",14],["P",15],["Q",16],["R",17],["S",18],["T",19],["U",20],["V",21],["W",22],["X",23],["Y",24],["Z",25],["a",26],["b",27],["c",28],["d",29],["e",30],["f",31],["g",32],["h",33],["i",34],["j",35],["k",36],["l",37],["m",38],["n",39],["o",40],["p",41],["q",42],["r",43],["s",44],["t",45],["u",46],["v",47],["w",48],["x",49],["y",50],["z",51],["0",52],["1",53],["2",54],["3",55],["4",56],["5",57],["6",58],["7",59],["8",60],["9",61],["-",62],["_",63]]),Base64Url.BASIS=6,Base64Url.LCM=24;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Base64Url=void 0;var index_js_1=require("../errors/index.js"),Base64Url=function(){function e(){}return e.encode=function(e){if(!/^[0-1]+$/.test(e))throw new index_js_1.EncodingError("Invalid bitField");var r=e.length%this.LCM;e+=r?"0".repeat(this.LCM-r):"";for(var t="",n=0;n<e.length;n+=this.BASIS)t+=this.DICT[parseInt(e.substr(n,this.BASIS),2)];return t},e.decode=function(e){if(!/^[A-Za-z0-9\-_]+$/.test(e))throw new index_js_1.DecodingError("Invalidly encoded Base64URL string");for(var r="",t=0;t<e.length;t++){var n=this.REVERSE_DICT.get(e[t]).toString(2);r+="0".repeat(this.BASIS-n.length)+n}return r},e.DICT="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",e.REVERSE_DICT=new Map([["A",0],["B",1],["C",2],["D",3],["E",4],["F",5],["G",6],["H",7],["I",8],["J",9],["K",10],["L",11],["M",12],["N",13],["O",14],["P",15],["Q",16],["R",17],["S",18],["T",19],["U",20],["V",21],["W",22],["X",23],["Y",24],["Z",25],["a",26],["b",27],["c",28],["d",29],["e",30],["f",31],["g",32],["h",33],["i",34],["j",35],["k",36],["l",37],["m",38],["n",39],["o",40],["p",41],["q",42],["r",43],["s",44],["t",45],["u",46],["v",47],["w",48],["x",49],["y",50],["z",51],["0",52],["1",53],["2",54],["3",55],["4",56],["5",57],["6",58],["7",59],["8",60],["9",61],["-",62],["_",63]]),e.BASIS=6,e.LCM=24,e}();exports.Base64Url=Base64Url;

@@ -1,1 +0,1 @@

"use strict";var _a,_b,_c,_d,_e,_f,_g,_h,_j,_k,_l,_m,_o,_p,_q,_r,_s,_t;Object.defineProperty(exports,"__esModule",{value:!0}),exports.BitLength=void 0;const index_js_1=require("../model/index.js");class BitLength{}exports.BitLength=BitLength,_a=index_js_1.Fields.cmpId,_b=index_js_1.Fields.cmpVersion,_c=index_js_1.Fields.consentLanguage,_d=index_js_1.Fields.consentScreen,_e=index_js_1.Fields.created,_f=index_js_1.Fields.isServiceSpecific,_g=index_js_1.Fields.lastUpdated,_h=index_js_1.Fields.policyVersion,_j=index_js_1.Fields.publisherCountryCode,_k=index_js_1.Fields.publisherLegitimateInterests,_l=index_js_1.Fields.publisherConsents,_m=index_js_1.Fields.purposeConsents,_o=index_js_1.Fields.purposeLegitimateInterests,_p=index_js_1.Fields.purposeOneTreatment,_q=index_js_1.Fields.specialFeatureOptins,_r=index_js_1.Fields.useNonStandardStacks,_s=index_js_1.Fields.vendorListVersion,_t=index_js_1.Fields.version,BitLength[_a]=12,BitLength[_b]=12,BitLength[_c]=12,BitLength[_d]=6,BitLength[_e]=36,BitLength[_f]=1,BitLength[_g]=36,BitLength[_h]=6,BitLength[_j]=12,BitLength[_k]=24,BitLength[_l]=24,BitLength[_m]=24,BitLength[_o]=24,BitLength[_p]=1,BitLength[_q]=12,BitLength[_r]=1,BitLength[_s]=12,BitLength[_t]=6,BitLength.anyBoolean=1,BitLength.encodingType=1,BitLength.maxId=16,BitLength.numCustomPurposes=6,BitLength.numEntries=12,BitLength.numRestrictions=12,BitLength.purposeId=6,BitLength.restrictionType=2,BitLength.segmentType=3,BitLength.singleOrRange=1,BitLength.vendorId=16;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BitLength=void 0;var index_js_1=require("../model/index.js"),BitLength=function(){function e(){}var s,i,n,d,t,r,_,o,l,p,x,u,j,a,c,F,g,m;return s=index_js_1.Fields.cmpId,i=index_js_1.Fields.cmpVersion,n=index_js_1.Fields.consentLanguage,d=index_js_1.Fields.consentScreen,t=index_js_1.Fields.created,r=index_js_1.Fields.isServiceSpecific,_=index_js_1.Fields.lastUpdated,o=index_js_1.Fields.policyVersion,l=index_js_1.Fields.publisherCountryCode,p=index_js_1.Fields.publisherLegitimateInterests,x=index_js_1.Fields.publisherConsents,u=index_js_1.Fields.purposeConsents,j=index_js_1.Fields.purposeLegitimateInterests,a=index_js_1.Fields.purposeOneTreatment,c=index_js_1.Fields.specialFeatureOptins,F=index_js_1.Fields.useNonStandardStacks,g=index_js_1.Fields.vendorListVersion,m=index_js_1.Fields.version,e[s]=12,e[i]=12,e[n]=12,e[d]=6,e[t]=36,e[r]=1,e[_]=36,e[o]=6,e[l]=12,e[p]=24,e[x]=24,e[u]=24,e[j]=24,e[a]=1,e[c]=12,e[F]=1,e[g]=12,e[m]=6,e.anyBoolean=1,e.encodingType=1,e.maxId=16,e.numCustomPurposes=6,e.numEntries=12,e.numRestrictions=12,e.purposeId=6,e.restrictionType=2,e.segmentType=3,e.singleOrRange=1,e.vendorId=16,e}();exports.BitLength=BitLength;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BooleanEncoder=void 0;class BooleanEncoder{static encode(e){return String(Number(e))}static decode(e){return"1"===e}}exports.BooleanEncoder=BooleanEncoder;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BooleanEncoder=void 0;var BooleanEncoder=function(){function e(){}return e.encode=function(e){return String(Number(e))},e.decode=function(e){return"1"===e},e}();exports.BooleanEncoder=BooleanEncoder;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DateEncoder=void 0;const IntEncoder_js_1=require("./IntEncoder.js"),index_js_1=require("../../errors/index.js");class DateEncoder{static encode(e,n){return IntEncoder_js_1.IntEncoder.encode(Math.round(e.getTime()/100),n)}static decode(e,n){if(n!==e.length)throw new index_js_1.DecodingError("invalid bit length");const t=new Date;return t.setTime(100*IntEncoder_js_1.IntEncoder.decode(e,n)),t}}exports.DateEncoder=DateEncoder;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DateEncoder=void 0;var IntEncoder_js_1=require("./IntEncoder.js"),index_js_1=require("../../errors/index.js"),DateEncoder=function(){function e(){}return e.encode=function(e,n){return IntEncoder_js_1.IntEncoder.encode(Math.round(e.getTime()/100),n)},e.decode=function(e,n){if(n!==e.length)throw new index_js_1.DecodingError("invalid bit length");var r=new Date;return r.setTime(100*IntEncoder_js_1.IntEncoder.decode(e,n)),r},e}();exports.DateEncoder=DateEncoder;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FieldEncoderMap=void 0;const index_js_1=require("../../model/index.js"),BooleanEncoder_js_1=require("./BooleanEncoder.js"),DateEncoder_js_1=require("./DateEncoder.js"),FixedVectorEncoder_js_1=require("./FixedVectorEncoder.js"),IntEncoder_js_1=require("./IntEncoder.js"),LangEncoder_js_1=require("./LangEncoder.js"),PurposeRestrictionVectorEncoder_js_1=require("./PurposeRestrictionVectorEncoder.js"),VendorVectorEncoder_js_1=require("./VendorVectorEncoder.js");function FieldEncoderMap(){return{[index_js_1.Fields.version]:IntEncoder_js_1.IntEncoder,[index_js_1.Fields.created]:DateEncoder_js_1.DateEncoder,[index_js_1.Fields.lastUpdated]:DateEncoder_js_1.DateEncoder,[index_js_1.Fields.cmpId]:IntEncoder_js_1.IntEncoder,[index_js_1.Fields.cmpVersion]:IntEncoder_js_1.IntEncoder,[index_js_1.Fields.consentScreen]:IntEncoder_js_1.IntEncoder,[index_js_1.Fields.consentLanguage]:LangEncoder_js_1.LangEncoder,[index_js_1.Fields.vendorListVersion]:IntEncoder_js_1.IntEncoder,[index_js_1.Fields.policyVersion]:IntEncoder_js_1.IntEncoder,[index_js_1.Fields.isServiceSpecific]:BooleanEncoder_js_1.BooleanEncoder,[index_js_1.Fields.useNonStandardStacks]:BooleanEncoder_js_1.BooleanEncoder,[index_js_1.Fields.specialFeatureOptins]:FixedVectorEncoder_js_1.FixedVectorEncoder,[index_js_1.Fields.purposeConsents]:FixedVectorEncoder_js_1.FixedVectorEncoder,[index_js_1.Fields.purposeLegitimateInterests]:FixedVectorEncoder_js_1.FixedVectorEncoder,[index_js_1.Fields.purposeOneTreatment]:BooleanEncoder_js_1.BooleanEncoder,[index_js_1.Fields.publisherCountryCode]:LangEncoder_js_1.LangEncoder,[index_js_1.Fields.vendorConsents]:VendorVectorEncoder_js_1.VendorVectorEncoder,[index_js_1.Fields.vendorLegitimateInterests]:VendorVectorEncoder_js_1.VendorVectorEncoder,[index_js_1.Fields.publisherRestrictions]:PurposeRestrictionVectorEncoder_js_1.PurposeRestrictionVectorEncoder,segmentType:IntEncoder_js_1.IntEncoder,[index_js_1.Fields.vendorsDisclosed]:VendorVectorEncoder_js_1.VendorVectorEncoder,[index_js_1.Fields.vendorsAllowed]:VendorVectorEncoder_js_1.VendorVectorEncoder,[index_js_1.Fields.publisherConsents]:FixedVectorEncoder_js_1.FixedVectorEncoder,[index_js_1.Fields.publisherLegitimateInterests]:FixedVectorEncoder_js_1.FixedVectorEncoder,[index_js_1.Fields.numCustomPurposes]:IntEncoder_js_1.IntEncoder,[index_js_1.Fields.publisherCustomConsents]:FixedVectorEncoder_js_1.FixedVectorEncoder,[index_js_1.Fields.publisherCustomLegitimateInterests]:FixedVectorEncoder_js_1.FixedVectorEncoder}}exports.FieldEncoderMap=FieldEncoderMap;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FieldEncoderMap=void 0;var index_js_1=require("../../model/index.js"),BooleanEncoder_js_1=require("./BooleanEncoder.js"),DateEncoder_js_1=require("./DateEncoder.js"),FixedVectorEncoder_js_1=require("./FixedVectorEncoder.js"),IntEncoder_js_1=require("./IntEncoder.js"),LangEncoder_js_1=require("./LangEncoder.js"),PurposeRestrictionVectorEncoder_js_1=require("./PurposeRestrictionVectorEncoder.js"),VendorVectorEncoder_js_1=require("./VendorVectorEncoder.js");function FieldEncoderMap(){var e;return(e={})[index_js_1.Fields.version]=IntEncoder_js_1.IntEncoder,e[index_js_1.Fields.created]=DateEncoder_js_1.DateEncoder,e[index_js_1.Fields.lastUpdated]=DateEncoder_js_1.DateEncoder,e[index_js_1.Fields.cmpId]=IntEncoder_js_1.IntEncoder,e[index_js_1.Fields.cmpVersion]=IntEncoder_js_1.IntEncoder,e[index_js_1.Fields.consentScreen]=IntEncoder_js_1.IntEncoder,e[index_js_1.Fields.consentLanguage]=LangEncoder_js_1.LangEncoder,e[index_js_1.Fields.vendorListVersion]=IntEncoder_js_1.IntEncoder,e[index_js_1.Fields.policyVersion]=IntEncoder_js_1.IntEncoder,e[index_js_1.Fields.isServiceSpecific]=BooleanEncoder_js_1.BooleanEncoder,e[index_js_1.Fields.useNonStandardStacks]=BooleanEncoder_js_1.BooleanEncoder,e[index_js_1.Fields.specialFeatureOptins]=FixedVectorEncoder_js_1.FixedVectorEncoder,e[index_js_1.Fields.purposeConsents]=FixedVectorEncoder_js_1.FixedVectorEncoder,e[index_js_1.Fields.purposeLegitimateInterests]=FixedVectorEncoder_js_1.FixedVectorEncoder,e[index_js_1.Fields.purposeOneTreatment]=BooleanEncoder_js_1.BooleanEncoder,e[index_js_1.Fields.publisherCountryCode]=LangEncoder_js_1.LangEncoder,e[index_js_1.Fields.vendorConsents]=VendorVectorEncoder_js_1.VendorVectorEncoder,e[index_js_1.Fields.vendorLegitimateInterests]=VendorVectorEncoder_js_1.VendorVectorEncoder,e[index_js_1.Fields.publisherRestrictions]=PurposeRestrictionVectorEncoder_js_1.PurposeRestrictionVectorEncoder,e.segmentType=IntEncoder_js_1.IntEncoder,e[index_js_1.Fields.vendorsDisclosed]=VendorVectorEncoder_js_1.VendorVectorEncoder,e[index_js_1.Fields.vendorsAllowed]=VendorVectorEncoder_js_1.VendorVectorEncoder,e[index_js_1.Fields.publisherConsents]=FixedVectorEncoder_js_1.FixedVectorEncoder,e[index_js_1.Fields.publisherLegitimateInterests]=FixedVectorEncoder_js_1.FixedVectorEncoder,e[index_js_1.Fields.numCustomPurposes]=IntEncoder_js_1.IntEncoder,e[index_js_1.Fields.publisherCustomConsents]=FixedVectorEncoder_js_1.FixedVectorEncoder,e[index_js_1.Fields.publisherCustomLegitimateInterests]=FixedVectorEncoder_js_1.FixedVectorEncoder,e}exports.FieldEncoderMap=FieldEncoderMap;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FixedVectorEncoder=void 0;const BooleanEncoder_js_1=require("./BooleanEncoder.js"),index_js_1=require("../../errors/index.js"),index_js_2=require("../../model/index.js");class FixedVectorEncoder{static encode(e,o){let r="";for(let n=1;n<=o;n++)r+=BooleanEncoder_js_1.BooleanEncoder.encode(e.has(n));return r}static decode(e,o){if(e.length!==o)throw new index_js_1.DecodingError("bitfield encoding length mismatch");const r=new index_js_2.Vector;for(let n=1;n<=o;n++)BooleanEncoder_js_1.BooleanEncoder.decode(e[n-1])&&r.set(n);return r.bitLength=e.length,r}}exports.FixedVectorEncoder=FixedVectorEncoder;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FixedVectorEncoder=void 0;var BooleanEncoder_js_1=require("./BooleanEncoder.js"),index_js_1=require("../../errors/index.js"),index_js_2=require("../../model/index.js"),FixedVectorEncoder=function(){function e(){}return e.encode=function(e,o){for(var n="",r=1;r<=o;r++)n+=BooleanEncoder_js_1.BooleanEncoder.encode(e.has(r));return n},e.decode=function(e,o){if(e.length!==o)throw new index_js_1.DecodingError("bitfield encoding length mismatch");for(var n=new index_js_2.Vector,r=1;r<=o;r++)BooleanEncoder_js_1.BooleanEncoder.decode(e[r-1])&&n.set(r);return n.bitLength=e.length,n},e}();exports.FixedVectorEncoder=FixedVectorEncoder;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.IntEncoder=void 0;const index_js_1=require("../../errors/index.js");class IntEncoder{static encode(e,t){let n;if("string"==typeof e&&(e=parseInt(e,10)),n=e.toString(2),n.length>t||e<0)throw new index_js_1.EncodingError(`${e} too large to encode into ${t}`);return n.length<t&&(n="0".repeat(t-n.length)+n),n}static decode(e,t){if(t!==e.length)throw new index_js_1.DecodingError("invalid bit length");return parseInt(e,2)}}exports.IntEncoder=IntEncoder;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.IntEncoder=void 0;var index_js_1=require("../../errors/index.js"),IntEncoder=function(){function e(){}return e.encode=function(e,n){var t;if("string"==typeof e&&(e=parseInt(e,10)),(t=e.toString(2)).length>n||e<0)throw new index_js_1.EncodingError("".concat(e," too large to encode into ").concat(n));return t.length<n&&(t="0".repeat(n-t.length)+t),t},e.decode=function(e,n){if(n!==e.length)throw new index_js_1.DecodingError("invalid bit length");return parseInt(e,2)},e}();exports.IntEncoder=IntEncoder;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LangEncoder=void 0;const IntEncoder_js_1=require("./IntEncoder.js"),index_js_1=require("../../errors/index.js");class LangEncoder{static encode(e,n){const r=(e=e.toUpperCase()).charCodeAt(0)-65,o=e.charCodeAt(1)-65;if(r<0||r>25||o<0||o>25)throw new index_js_1.EncodingError("invalid language code: "+e);if(n%2==1)throw new index_js_1.EncodingError(`numBits must be even, ${n} is not valid`);n/=2;return IntEncoder_js_1.IntEncoder.encode(r,n)+IntEncoder_js_1.IntEncoder.encode(o,n)}static decode(e,n){let r;if(n!==e.length||e.length%2)throw new index_js_1.DecodingError("invalid bit length for language");{const n=65,o=e.length/2,t=IntEncoder_js_1.IntEncoder.decode(e.slice(0,o),o)+n,d=IntEncoder_js_1.IntEncoder.decode(e.slice(o),o)+n;r=String.fromCharCode(t)+String.fromCharCode(d)}return r}}exports.LangEncoder=LangEncoder;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LangEncoder=void 0;var IntEncoder_js_1=require("./IntEncoder.js"),index_js_1=require("../../errors/index.js"),LangEncoder=function(){function e(){}return e.encode=function(e,n){var r=(e=e.toUpperCase()).charCodeAt(0)-65,o=e.charCodeAt(1)-65;if(r<0||r>25||o<0||o>25)throw new index_js_1.EncodingError("invalid language code: ".concat(e));if(n%2==1)throw new index_js_1.EncodingError("numBits must be even, ".concat(n," is not valid"));return n/=2,IntEncoder_js_1.IntEncoder.encode(r,n)+IntEncoder_js_1.IntEncoder.encode(o,n)},e.decode=function(e,n){if(n!==e.length||e.length%2)throw new index_js_1.DecodingError("invalid bit length for language");var r=e.length/2,o=IntEncoder_js_1.IntEncoder.decode(e.slice(0,r),r)+65,d=IntEncoder_js_1.IntEncoder.decode(e.slice(r),r)+65;return String.fromCharCode(o)+String.fromCharCode(d)},e}();exports.LangEncoder=LangEncoder;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PurposeRestrictionVectorEncoder=void 0;const BitLength_js_1=require("../BitLength.js"),BooleanEncoder_js_1=require("./BooleanEncoder.js"),index_js_1=require("../../errors/index.js"),IntEncoder_js_1=require("./IntEncoder.js"),index_js_2=require("../../model/index.js");class PurposeRestrictionVectorEncoder{static encode(e){let t=IntEncoder_js_1.IntEncoder.encode(e.numRestrictions,BitLength_js_1.BitLength.numRestrictions);return e.isEmpty()||e.getRestrictions().forEach(n=>{t+=IntEncoder_js_1.IntEncoder.encode(n.purposeId,BitLength_js_1.BitLength.purposeId),t+=IntEncoder_js_1.IntEncoder.encode(n.restrictionType,BitLength_js_1.BitLength.restrictionType);const o=e.getVendors(n),s=o.length;let r=0,i=0,d="";for(let t=0;t<s;t++){const n=o[t];0===i&&(r++,i=n);const _=o[s-1],c=e.gvl.vendorIds,B=e=>{for(;++e<=_&&!c.has(e););return e};if(t===s-1||o[t+1]>B(n)){const e=!(n===i);d+=BooleanEncoder_js_1.BooleanEncoder.encode(e),d+=IntEncoder_js_1.IntEncoder.encode(i,BitLength_js_1.BitLength.vendorId),e&&(d+=IntEncoder_js_1.IntEncoder.encode(n,BitLength_js_1.BitLength.vendorId)),i=0}}t+=IntEncoder_js_1.IntEncoder.encode(r,BitLength_js_1.BitLength.numEntries),t+=d}),t}static decode(e){let t=0;const n=new index_js_2.PurposeRestrictionVector,o=IntEncoder_js_1.IntEncoder.decode(e.substr(t,BitLength_js_1.BitLength.numRestrictions),BitLength_js_1.BitLength.numRestrictions);t+=BitLength_js_1.BitLength.numRestrictions;for(let s=0;s<o;s++){const o=IntEncoder_js_1.IntEncoder.decode(e.substr(t,BitLength_js_1.BitLength.purposeId),BitLength_js_1.BitLength.purposeId);t+=BitLength_js_1.BitLength.purposeId;const s=IntEncoder_js_1.IntEncoder.decode(e.substr(t,BitLength_js_1.BitLength.restrictionType),BitLength_js_1.BitLength.restrictionType);t+=BitLength_js_1.BitLength.restrictionType;const r=new index_js_2.PurposeRestriction(o,s),i=IntEncoder_js_1.IntEncoder.decode(e.substr(t,BitLength_js_1.BitLength.numEntries),BitLength_js_1.BitLength.numEntries);t+=BitLength_js_1.BitLength.numEntries;for(let o=0;o<i;o++){const o=BooleanEncoder_js_1.BooleanEncoder.decode(e.substr(t,BitLength_js_1.BitLength.anyBoolean));t+=BitLength_js_1.BitLength.anyBoolean;const s=IntEncoder_js_1.IntEncoder.decode(e.substr(t,BitLength_js_1.BitLength.vendorId),BitLength_js_1.BitLength.vendorId);if(t+=BitLength_js_1.BitLength.vendorId,o){const o=IntEncoder_js_1.IntEncoder.decode(e.substr(t,BitLength_js_1.BitLength.vendorId),BitLength_js_1.BitLength.vendorId);if(t+=BitLength_js_1.BitLength.vendorId,o<s)throw new index_js_1.DecodingError(`Invalid RangeEntry: endVendorId ${o} is less than ${s}`);for(let e=s;e<=o;e++)n.add(e,r)}else n.add(s,r)}}return n.bitLength=t,n}}exports.PurposeRestrictionVectorEncoder=PurposeRestrictionVectorEncoder;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PurposeRestrictionVectorEncoder=void 0;var BitLength_js_1=require("../BitLength.js"),BooleanEncoder_js_1=require("./BooleanEncoder.js"),index_js_1=require("../../errors/index.js"),IntEncoder_js_1=require("./IntEncoder.js"),index_js_2=require("../../model/index.js"),PurposeRestrictionVectorEncoder=function(){function e(){}return e.encode=function(e){var n=IntEncoder_js_1.IntEncoder.encode(e.numRestrictions,BitLength_js_1.BitLength.numRestrictions);return e.isEmpty()||e.getRestrictions().forEach((function(t){n+=IntEncoder_js_1.IntEncoder.encode(t.purposeId,BitLength_js_1.BitLength.purposeId),n+=IntEncoder_js_1.IntEncoder.encode(t.restrictionType,BitLength_js_1.BitLength.restrictionType);for(var r=e.getVendors(t),o=r.length,i=0,s=0,d="",_=function(n){var t=r[n];0===s&&(i++,s=t);var _=r[o-1],c=e.gvl.vendorIds;if(n===o-1||r[n+1]>function(e){for(;++e<=_&&!c.has(e););return e}(t)){var B=!(t===s);d+=BooleanEncoder_js_1.BooleanEncoder.encode(B),d+=IntEncoder_js_1.IntEncoder.encode(s,BitLength_js_1.BitLength.vendorId),B&&(d+=IntEncoder_js_1.IntEncoder.encode(t,BitLength_js_1.BitLength.vendorId)),s=0}},c=0;c<o;c++)_(c);n+=IntEncoder_js_1.IntEncoder.encode(i,BitLength_js_1.BitLength.numEntries),n+=d})),n},e.decode=function(e){var n=0,t=new index_js_2.PurposeRestrictionVector,r=IntEncoder_js_1.IntEncoder.decode(e.substr(n,BitLength_js_1.BitLength.numRestrictions),BitLength_js_1.BitLength.numRestrictions);n+=BitLength_js_1.BitLength.numRestrictions;for(var o=0;o<r;o++){var i=IntEncoder_js_1.IntEncoder.decode(e.substr(n,BitLength_js_1.BitLength.purposeId),BitLength_js_1.BitLength.purposeId);n+=BitLength_js_1.BitLength.purposeId;var s=IntEncoder_js_1.IntEncoder.decode(e.substr(n,BitLength_js_1.BitLength.restrictionType),BitLength_js_1.BitLength.restrictionType);n+=BitLength_js_1.BitLength.restrictionType;var d=new index_js_2.PurposeRestriction(i,s),_=IntEncoder_js_1.IntEncoder.decode(e.substr(n,BitLength_js_1.BitLength.numEntries),BitLength_js_1.BitLength.numEntries);n+=BitLength_js_1.BitLength.numEntries;for(var c=0;c<_;c++){var B=BooleanEncoder_js_1.BooleanEncoder.decode(e.substr(n,BitLength_js_1.BitLength.anyBoolean));n+=BitLength_js_1.BitLength.anyBoolean;var g=IntEncoder_js_1.IntEncoder.decode(e.substr(n,BitLength_js_1.BitLength.vendorId),BitLength_js_1.BitLength.vendorId);if(n+=BitLength_js_1.BitLength.vendorId,B){var h=IntEncoder_js_1.IntEncoder.decode(e.substr(n,BitLength_js_1.BitLength.vendorId),BitLength_js_1.BitLength.vendorId);if(n+=BitLength_js_1.BitLength.vendorId,h<g)throw new index_js_1.DecodingError("Invalid RangeEntry: endVendorId ".concat(h," is less than ").concat(g));for(var L=g;L<=h;L++)t.add(L,d)}else t.add(g,d)}}return t.bitLength=n,t},e}();exports.PurposeRestrictionVectorEncoder=PurposeRestrictionVectorEncoder;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VendorVectorEncoder=void 0;const index_js_1=require("../../model/index.js"),index_js_2=require("../index.js"),IntEncoder_js_1=require("./IntEncoder.js"),BooleanEncoder_js_1=require("./BooleanEncoder.js"),FixedVectorEncoder_js_1=require("./FixedVectorEncoder.js"),VectorEncodingType_js_1=require("./VectorEncodingType.js"),index_js_3=require("../../errors/index.js");class VendorVectorEncoder{static encode(e){const n=[];let d,t=[],o=IntEncoder_js_1.IntEncoder.encode(e.maxId,index_js_2.BitLength.maxId),r="";const i=index_js_2.BitLength.maxId+index_js_2.BitLength.encodingType,s=i+e.maxId,_=2*index_js_2.BitLength.vendorId+index_js_2.BitLength.singleOrRange+index_js_2.BitLength.numEntries;let c=i+index_js_2.BitLength.numEntries;return e.forEach((o,i)=>{if(r+=BooleanEncoder_js_1.BooleanEncoder.encode(o),d=e.maxId>_&&c<s,d&&o){e.has(i+1)?0===t.length&&(t.push(i),c+=index_js_2.BitLength.singleOrRange,c+=index_js_2.BitLength.vendorId):(t.push(i),c+=index_js_2.BitLength.vendorId,n.push(t),t=[])}}),d?(o+=String(VectorEncodingType_js_1.VectorEncodingType.RANGE),o+=this.buildRangeEncoding(n)):(o+=String(VectorEncodingType_js_1.VectorEncodingType.FIELD),o+=r),o}static decode(e,n){let d,t=0;const o=IntEncoder_js_1.IntEncoder.decode(e.substr(t,index_js_2.BitLength.maxId),index_js_2.BitLength.maxId);t+=index_js_2.BitLength.maxId;const r=IntEncoder_js_1.IntEncoder.decode(e.charAt(t),index_js_2.BitLength.encodingType);if(t+=index_js_2.BitLength.encodingType,r===VectorEncodingType_js_1.VectorEncodingType.RANGE){if(d=new index_js_1.Vector,1===n){if("1"===e.substr(t,1))throw new index_js_3.DecodingError("Unable to decode default consent=1");t++}const o=IntEncoder_js_1.IntEncoder.decode(e.substr(t,index_js_2.BitLength.numEntries),index_js_2.BitLength.numEntries);t+=index_js_2.BitLength.numEntries;for(let n=0;n<o;n++){const n=BooleanEncoder_js_1.BooleanEncoder.decode(e.charAt(t));t+=index_js_2.BitLength.singleOrRange;const o=IntEncoder_js_1.IntEncoder.decode(e.substr(t,index_js_2.BitLength.vendorId),index_js_2.BitLength.vendorId);if(t+=index_js_2.BitLength.vendorId,n){const n=IntEncoder_js_1.IntEncoder.decode(e.substr(t,index_js_2.BitLength.vendorId),index_js_2.BitLength.vendorId);t+=index_js_2.BitLength.vendorId;for(let e=o;e<=n;e++)d.set(e)}else d.set(o)}}else{const n=e.substr(t,o);t+=o,d=FixedVectorEncoder_js_1.FixedVectorEncoder.decode(n,o)}return d.bitLength=t,d}static buildRangeEncoding(e){const n=e.length;let d=IntEncoder_js_1.IntEncoder.encode(n,index_js_2.BitLength.numEntries);return e.forEach(e=>{const n=1===e.length;d+=BooleanEncoder_js_1.BooleanEncoder.encode(!n),d+=IntEncoder_js_1.IntEncoder.encode(e[0],index_js_2.BitLength.vendorId),n||(d+=IntEncoder_js_1.IntEncoder.encode(e[1],index_js_2.BitLength.vendorId))}),d}}exports.VendorVectorEncoder=VendorVectorEncoder;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.VendorVectorEncoder=void 0;var index_js_1=require("../../model/index.js"),index_js_2=require("../index.js"),IntEncoder_js_1=require("./IntEncoder.js"),BooleanEncoder_js_1=require("./BooleanEncoder.js"),FixedVectorEncoder_js_1=require("./FixedVectorEncoder.js"),VectorEncodingType_js_1=require("./VectorEncodingType.js"),index_js_3=require("../../errors/index.js"),VendorVectorEncoder=function(){function e(){}return e.encode=function(e){var n,d=[],r=[],t=IntEncoder_js_1.IntEncoder.encode(e.maxId,index_js_2.BitLength.maxId),o="",i=index_js_2.BitLength.maxId+index_js_2.BitLength.encodingType,_=i+e.maxId,s=2*index_js_2.BitLength.vendorId+index_js_2.BitLength.singleOrRange+index_js_2.BitLength.numEntries,c=i+index_js_2.BitLength.numEntries;return e.forEach((function(t,i){(o+=BooleanEncoder_js_1.BooleanEncoder.encode(t),(n=e.maxId>s&&c<_)&&t)&&(e.has(i+1)?0===r.length&&(r.push(i),c+=index_js_2.BitLength.singleOrRange,c+=index_js_2.BitLength.vendorId):(r.push(i),c+=index_js_2.BitLength.vendorId,d.push(r),r=[]))})),n?(t+=String(VectorEncodingType_js_1.VectorEncodingType.RANGE),t+=this.buildRangeEncoding(d)):(t+=String(VectorEncodingType_js_1.VectorEncodingType.FIELD),t+=o),t},e.decode=function(e,n){var d,r=0,t=IntEncoder_js_1.IntEncoder.decode(e.substr(r,index_js_2.BitLength.maxId),index_js_2.BitLength.maxId);r+=index_js_2.BitLength.maxId;var o=IntEncoder_js_1.IntEncoder.decode(e.charAt(r),index_js_2.BitLength.encodingType);if(r+=index_js_2.BitLength.encodingType,o===VectorEncodingType_js_1.VectorEncodingType.RANGE){if(d=new index_js_1.Vector,1===n){if("1"===e.substr(r,1))throw new index_js_3.DecodingError("Unable to decode default consent=1");r++}var i=IntEncoder_js_1.IntEncoder.decode(e.substr(r,index_js_2.BitLength.numEntries),index_js_2.BitLength.numEntries);r+=index_js_2.BitLength.numEntries;for(var _=0;_<i;_++){var s=BooleanEncoder_js_1.BooleanEncoder.decode(e.charAt(r));r+=index_js_2.BitLength.singleOrRange;var c=IntEncoder_js_1.IntEncoder.decode(e.substr(r,index_js_2.BitLength.vendorId),index_js_2.BitLength.vendorId);if(r+=index_js_2.BitLength.vendorId,s){var j=IntEncoder_js_1.IntEncoder.decode(e.substr(r,index_js_2.BitLength.vendorId),index_js_2.BitLength.vendorId);r+=index_js_2.BitLength.vendorId;for(var E=c;E<=j;E++)d.set(E)}else d.set(c)}}else{var g=e.substr(r,t);r+=t,d=FixedVectorEncoder_js_1.FixedVectorEncoder.decode(g,t)}return d.bitLength=r,d},e.buildRangeEncoding=function(e){var n=e.length,d=IntEncoder_js_1.IntEncoder.encode(n,index_js_2.BitLength.numEntries);return e.forEach((function(e){var n=1===e.length;d+=BooleanEncoder_js_1.BooleanEncoder.encode(!n),d+=IntEncoder_js_1.IntEncoder.encode(e[0],index_js_2.BitLength.vendorId),n||(d+=IntEncoder_js_1.IntEncoder.encode(e[1],index_js_2.BitLength.vendorId))})),d},e}();exports.VendorVectorEncoder=VendorVectorEncoder;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SegmentEncoder=void 0;const Base64Url_js_1=require("./Base64Url.js"),BitLength_js_1=require("./BitLength.js"),index_js_1=require("./field/index.js"),index_js_2=require("./sequence/index.js"),index_js_3=require("../errors/index.js"),Fields_js_1=require("../model/Fields.js"),index_js_4=require("../model/index.js");class SegmentEncoder{static encode(e,s){let n;try{n=this.fieldSequence[String(e.version)][s]}catch(n){throw new index_js_3.EncodingError(`Unable to encode version: ${e.version}, segment: ${s}`)}let i="";s!==index_js_4.Segment.CORE&&(i=index_js_1.IntEncoder.encode(index_js_4.SegmentIDs.KEY_TO_ID[s],BitLength_js_1.BitLength.segmentType));const t=(0,index_js_1.FieldEncoderMap)();return n.forEach(n=>{const r=e[n],d=t[n];let o=BitLength_js_1.BitLength[n];void 0===o&&this.isPublisherCustom(n)&&(o=Number(e[Fields_js_1.Fields.numCustomPurposes]));try{i+=d.encode(r,o)}catch(e){throw new index_js_3.EncodingError(`Error encoding ${s}->${n}: ${e.message}`)}}),Base64Url_js_1.Base64Url.encode(i)}static decode(e,s,n){const i=Base64Url_js_1.Base64Url.decode(e);let t=0;n===index_js_4.Segment.CORE&&(s.version=index_js_1.IntEncoder.decode(i.substr(t,BitLength_js_1.BitLength[Fields_js_1.Fields.version]),BitLength_js_1.BitLength[Fields_js_1.Fields.version])),n!==index_js_4.Segment.CORE&&(t+=BitLength_js_1.BitLength.segmentType);const r=this.fieldSequence[String(s.version)][n],d=(0,index_js_1.FieldEncoderMap)();return r.forEach(e=>{const n=d[e];let r=BitLength_js_1.BitLength[e];if(void 0===r&&this.isPublisherCustom(e)&&(r=Number(s[Fields_js_1.Fields.numCustomPurposes])),0!==r){const d=i.substr(t,r);if(n===index_js_1.VendorVectorEncoder?s[e]=n.decode(d,s.version):s[e]=n.decode(d,r),Number.isInteger(r))t+=r;else{if(!Number.isInteger(s[e].bitLength))throw new index_js_3.DecodingError(e);t+=s[e].bitLength}}}),s}static isPublisherCustom(e){return 0===e.indexOf("publisherCustom")}}exports.SegmentEncoder=SegmentEncoder,SegmentEncoder.fieldSequence=new index_js_2.FieldSequence;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SegmentEncoder=void 0;var Base64Url_js_1=require("./Base64Url.js"),BitLength_js_1=require("./BitLength.js"),index_js_1=require("./field/index.js"),index_js_2=require("./sequence/index.js"),index_js_3=require("../errors/index.js"),Fields_js_1=require("../model/Fields.js"),index_js_4=require("../model/index.js"),SegmentEncoder=function(){function e(){}return e.encode=function(e,n){var s,i=this;try{s=this.fieldSequence[String(e.version)][n]}catch(s){throw new index_js_3.EncodingError("Unable to encode version: ".concat(e.version,", segment: ").concat(n))}var r="";n!==index_js_4.Segment.CORE&&(r=index_js_1.IntEncoder.encode(index_js_4.SegmentIDs.KEY_TO_ID[n],BitLength_js_1.BitLength.segmentType));var t=(0,index_js_1.FieldEncoderMap)();return s.forEach((function(s){var d=e[s],o=t[s],_=BitLength_js_1.BitLength[s];void 0===_&&i.isPublisherCustom(s)&&(_=Number(e[Fields_js_1.Fields.numCustomPurposes]));try{r+=o.encode(d,_)}catch(e){throw new index_js_3.EncodingError("Error encoding ".concat(n,"->").concat(s,": ").concat(e.message))}})),Base64Url_js_1.Base64Url.encode(r)},e.decode=function(e,n,s){var i=this,r=Base64Url_js_1.Base64Url.decode(e),t=0;s===index_js_4.Segment.CORE&&(n.version=index_js_1.IntEncoder.decode(r.substr(t,BitLength_js_1.BitLength[Fields_js_1.Fields.version]),BitLength_js_1.BitLength[Fields_js_1.Fields.version])),s!==index_js_4.Segment.CORE&&(t+=BitLength_js_1.BitLength.segmentType);var d=this.fieldSequence[String(n.version)][s],o=(0,index_js_1.FieldEncoderMap)();return d.forEach((function(e){var s=o[e],d=BitLength_js_1.BitLength[e];if(void 0===d&&i.isPublisherCustom(e)&&(d=Number(n[Fields_js_1.Fields.numCustomPurposes])),0!==d){var _=r.substr(t,d);if(s===index_js_1.VendorVectorEncoder?n[e]=s.decode(_,n.version):n[e]=s.decode(_,d),Number.isInteger(d))t+=d;else{if(!Number.isInteger(n[e].bitLength))throw new index_js_3.DecodingError(e);t+=n[e].bitLength}}})),n},e.isPublisherCustom=function(e){return 0===e.indexOf("publisherCustom")},e.fieldSequence=new index_js_2.FieldSequence,e}();exports.SegmentEncoder=SegmentEncoder;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SemanticPreEncoder=void 0;const index_js_1=require("../errors/index.js"),index_js_2=require("../model/index.js");class SemanticPreEncoder{static process(e,s){const r=e.gvl;if(!r)throw new index_js_1.EncodingError("Unable to encode TCModel without a GVL");if(!r.isReady)throw new index_js_1.EncodingError("Unable to encode TCModel tcModel.gvl.readyPromise is not resolved");(e=e.clone()).consentLanguage=r.language.toUpperCase(),(null==s?void 0:s.version)>0&&(null==s?void 0:s.version)<=this.processor.length?e.version=s.version:e.version=this.processor.length;const n=e.version-1;if(!this.processor[n])throw new index_js_1.EncodingError("Invalid version: "+e.version);return this.processor[n](e,r)}}exports.SemanticPreEncoder=SemanticPreEncoder,SemanticPreEncoder.processor=[e=>e,(e,s)=>{e.publisherRestrictions.gvl=s,e.purposeLegitimateInterests.unset(1);const r=new Map;return r.set("legIntPurposes",e.vendorLegitimateInterests),r.set("purposes",e.vendorConsents),r.forEach((r,n)=>{r.forEach((o,t)=>{if(o){const o=s.vendors[t];if(!o||o.deletedDate)r.unset(t);else if(0===o[n].length)if("legIntPurposes"===n&&0===o.purposes.length&&0===o.legIntPurposes.length&&o.specialPurposes.length>0);else if(e.isServiceSpecific)if(0===o.flexiblePurposes.length)r.unset(t);else{const s=e.publisherRestrictions.getRestrictions(t);let o=!1;for(let e=0,r=s.length;e<r&&!o;e++)o=s[e].restrictionType===index_js_2.RestrictionType.REQUIRE_CONSENT&&"purposes"===n||s[e].restrictionType===index_js_2.RestrictionType.REQUIRE_LI&&"legIntPurposes"===n;o||r.unset(t)}else r.unset(t)}})}),e.vendorsDisclosed.set(s.vendors),e}];
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SemanticPreEncoder=void 0;var index_js_1=require("../errors/index.js"),index_js_2=require("../model/index.js"),SemanticPreEncoder=function(){function e(){}return e.process=function(e,r){var s=e.gvl;if(!s)throw new index_js_1.EncodingError("Unable to encode TCModel without a GVL");if(!s.isReady)throw new index_js_1.EncodingError("Unable to encode TCModel tcModel.gvl.readyPromise is not resolved");(e=e.clone()).consentLanguage=s.language.toUpperCase(),(null==r?void 0:r.version)>0&&(null==r?void 0:r.version)<=this.processor.length?e.version=r.version:e.version=this.processor.length;var n=e.version-1;if(!this.processor[n])throw new index_js_1.EncodingError("Invalid version: ".concat(e.version));return this.processor[n](e,s)},e.processor=[function(e){return e},function(e,r){e.publisherRestrictions.gvl=r,e.purposeLegitimateInterests.unset(1);var s=new Map;return s.set("legIntPurposes",e.vendorLegitimateInterests),s.set("purposes",e.vendorConsents),s.forEach((function(s,n){s.forEach((function(o,t){if(o){var i=r.vendors[t];if(!i||i.deletedDate)s.unset(t);else if(0===i[n].length)if("legIntPurposes"===n&&0===i.purposes.length&&0===i.legIntPurposes.length&&i.specialPurposes.length>0);else if(e.isServiceSpecific)if(0===i.flexiblePurposes.length)s.unset(t);else{for(var c=e.publisherRestrictions.getRestrictions(t),l=!1,d=0,u=c.length;d<u&&!l;d++)l=c[d].restrictionType===index_js_2.RestrictionType.REQUIRE_CONSENT&&"purposes"===n||c[d].restrictionType===index_js_2.RestrictionType.REQUIRE_LI&&"legIntPurposes"===n;l||s.unset(t)}else s.unset(t)}}))})),e.vendorsDisclosed.set(r.vendors),e}],e}();exports.SemanticPreEncoder=SemanticPreEncoder;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FieldSequence=void 0;const index_js_1=require("../../model/index.js");class FieldSequence{constructor(){this[1]={[index_js_1.Segment.CORE]:[index_js_1.Fields.version,index_js_1.Fields.created,index_js_1.Fields.lastUpdated,index_js_1.Fields.cmpId,index_js_1.Fields.cmpVersion,index_js_1.Fields.consentScreen,index_js_1.Fields.consentLanguage,index_js_1.Fields.vendorListVersion,index_js_1.Fields.purposeConsents,index_js_1.Fields.vendorConsents]},this[2]={[index_js_1.Segment.CORE]:[index_js_1.Fields.version,index_js_1.Fields.created,index_js_1.Fields.lastUpdated,index_js_1.Fields.cmpId,index_js_1.Fields.cmpVersion,index_js_1.Fields.consentScreen,index_js_1.Fields.consentLanguage,index_js_1.Fields.vendorListVersion,index_js_1.Fields.policyVersion,index_js_1.Fields.isServiceSpecific,index_js_1.Fields.useNonStandardStacks,index_js_1.Fields.specialFeatureOptins,index_js_1.Fields.purposeConsents,index_js_1.Fields.purposeLegitimateInterests,index_js_1.Fields.purposeOneTreatment,index_js_1.Fields.publisherCountryCode,index_js_1.Fields.vendorConsents,index_js_1.Fields.vendorLegitimateInterests,index_js_1.Fields.publisherRestrictions],[index_js_1.Segment.PUBLISHER_TC]:[index_js_1.Fields.publisherConsents,index_js_1.Fields.publisherLegitimateInterests,index_js_1.Fields.numCustomPurposes,index_js_1.Fields.publisherCustomConsents,index_js_1.Fields.publisherCustomLegitimateInterests],[index_js_1.Segment.VENDORS_ALLOWED]:[index_js_1.Fields.vendorsAllowed],[index_js_1.Segment.VENDORS_DISCLOSED]:[index_js_1.Fields.vendorsDisclosed]}}}exports.FieldSequence=FieldSequence;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.FieldSequence=void 0;var index_js_1=require("../../model/index.js"),FieldSequence=function(){var e,s;this[1]=((e={})[index_js_1.Segment.CORE]=[index_js_1.Fields.version,index_js_1.Fields.created,index_js_1.Fields.lastUpdated,index_js_1.Fields.cmpId,index_js_1.Fields.cmpVersion,index_js_1.Fields.consentScreen,index_js_1.Fields.consentLanguage,index_js_1.Fields.vendorListVersion,index_js_1.Fields.purposeConsents,index_js_1.Fields.vendorConsents],e),this[2]=((s={})[index_js_1.Segment.CORE]=[index_js_1.Fields.version,index_js_1.Fields.created,index_js_1.Fields.lastUpdated,index_js_1.Fields.cmpId,index_js_1.Fields.cmpVersion,index_js_1.Fields.consentScreen,index_js_1.Fields.consentLanguage,index_js_1.Fields.vendorListVersion,index_js_1.Fields.policyVersion,index_js_1.Fields.isServiceSpecific,index_js_1.Fields.useNonStandardStacks,index_js_1.Fields.specialFeatureOptins,index_js_1.Fields.purposeConsents,index_js_1.Fields.purposeLegitimateInterests,index_js_1.Fields.purposeOneTreatment,index_js_1.Fields.publisherCountryCode,index_js_1.Fields.vendorConsents,index_js_1.Fields.vendorLegitimateInterests,index_js_1.Fields.publisherRestrictions],s[index_js_1.Segment.PUBLISHER_TC]=[index_js_1.Fields.publisherConsents,index_js_1.Fields.publisherLegitimateInterests,index_js_1.Fields.numCustomPurposes,index_js_1.Fields.publisherCustomConsents,index_js_1.Fields.publisherCustomLegitimateInterests],s[index_js_1.Segment.VENDORS_ALLOWED]=[index_js_1.Fields.vendorsAllowed],s[index_js_1.Segment.VENDORS_DISCLOSED]=[index_js_1.Fields.vendorsDisclosed],s)};exports.FieldSequence=FieldSequence;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SegmentSequence=void 0;const index_js_1=require("../../model/index.js");class SegmentSequence{constructor(e,s){if(this[1]=[index_js_1.Segment.CORE],this[2]=[index_js_1.Segment.CORE],2===e.version)if(e.isServiceSpecific)this[2].push(index_js_1.Segment.PUBLISHER_TC);else{const i=!(!s||!s.isForVendors);i&&!0!==e[index_js_1.Fields.supportOOB]||this[2].push(index_js_1.Segment.VENDORS_DISCLOSED),i&&(e[index_js_1.Fields.supportOOB]&&e[index_js_1.Fields.vendorsAllowed].size>0&&this[2].push(index_js_1.Segment.VENDORS_ALLOWED),this[2].push(index_js_1.Segment.PUBLISHER_TC))}}}exports.SegmentSequence=SegmentSequence;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SegmentSequence=void 0;var index_js_1=require("../../model/index.js"),SegmentSequence=function(e,s){if(this[1]=[index_js_1.Segment.CORE],this[2]=[index_js_1.Segment.CORE],2===e.version)if(e.isServiceSpecific)this[2].push(index_js_1.Segment.PUBLISHER_TC);else{var i=!(!s||!s.isForVendors);i&&!0!==e[index_js_1.Fields.supportOOB]||this[2].push(index_js_1.Segment.VENDORS_DISCLOSED),i&&(e[index_js_1.Fields.supportOOB]&&e[index_js_1.Fields.vendorsAllowed].size>0&&this[2].push(index_js_1.Segment.VENDORS_ALLOWED),this[2].push(index_js_1.Segment.PUBLISHER_TC))}};exports.SegmentSequence=SegmentSequence;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DecodingError=void 0;class DecodingError extends Error{constructor(r){super(r),this.name="DecodingError"}}exports.DecodingError=DecodingError;
"use strict";var __extends=this&&this.__extends||function(){var r=function(t,o){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])})(t,o)};return function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function e(){this.constructor=t}r(t,o),t.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.DecodingError=void 0;var DecodingError=function(r){function t(t){var o=r.call(this,t)||this;return o.name="DecodingError",o}return __extends(t,r),t}(Error);exports.DecodingError=DecodingError;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EncodingError=void 0;class EncodingError extends Error{constructor(r){super(r),this.name="EncodingError"}}exports.EncodingError=EncodingError;
"use strict";var __extends=this&&this.__extends||function(){var r=function(t,o){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])})(t,o)};return function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function n(){this.constructor=t}r(t,o),t.prototype=null===o?Object.create(o):(n.prototype=o.prototype,new n)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.EncodingError=void 0;var EncodingError=function(r){function t(t){var o=r.call(this,t)||this;return o.name="EncodingError",o}return __extends(t,r),t}(Error);exports.EncodingError=EncodingError;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.GVLError=void 0;class GVLError extends Error{constructor(r){super(r),this.name="GVLError"}}exports.GVLError=GVLError;
"use strict";var __extends=this&&this.__extends||function(){var r=function(t,o){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])})(t,o)};return function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function e(){this.constructor=t}r(t,o),t.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.GVLError=void 0;var GVLError=function(r){function t(t){var o=r.call(this,t)||this;return o.name="GVLError",o}return __extends(t,r),t}(Error);exports.GVLError=GVLError;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TCModelError=void 0;class TCModelError extends Error{constructor(r,e,o=""){super(`invalid value ${e} passed for ${r} ${o}`),this.name="TCModelError"}}exports.TCModelError=TCModelError;
"use strict";var __extends=this&&this.__extends||function(){var r=function(t,o){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(r[o]=t[o])})(t,o)};return function(t,o){if("function"!=typeof o&&null!==o)throw new TypeError("Class extends value "+String(o)+" is not a constructor or null");function e(){this.constructor=t}r(t,o),t.prototype=null===o?Object.create(o):(e.prototype=o.prototype,new e)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.TCModelError=void 0;var TCModelError=function(r){function t(t,o,e){void 0===e&&(e="");var n=r.call(this,"invalid value ".concat(o," passed for ").concat(t," ").concat(e))||this;return n.name="TCModelError",n}return __extends(t,r),t}(Error);exports.TCModelError=TCModelError;

@@ -1,1 +0,1 @@

"use strict";var __awaiter=this&&this.__awaiter||function(e,s,t,r){return new(t||(t=Promise))((function(i,n){function o(e){try{h(r.next(e))}catch(e){n(e)}}function a(e){try{h(r.throw(e))}catch(e){n(e)}}function h(e){var s;e.done?i(e.value):(s=e.value,s instanceof t?s:new t((function(e){e(s)}))).then(o,a)}h((r=r.apply(e,s||[])).next())}))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GVL=void 0;const Cloneable_js_1=require("./Cloneable.js"),index_js_1=require("./errors/index.js"),Json_js_1=require("./Json.js"),index_js_2=require("./model/index.js");class GVL extends Cloneable_js_1.Cloneable{constructor(e){super(),this.isReady_=!1,this.isLatest=!1;let s=GVL.baseUrl;if(this.lang_=GVL.DEFAULT_LANGUAGE,this.isVendorList(e))this.populate(e),this.readyPromise=Promise.resolve();else{if(!s)throw new index_js_1.GVLError("must specify GVL.baseUrl before loading GVL json");if(e>0){const t=e;GVL.CACHE.has(t)?(this.populate(GVL.CACHE.get(t)),this.readyPromise=Promise.resolve()):(s+=GVL.versionedFilename.replace("[VERSION]",String(t)),this.readyPromise=this.fetchJson(s))}else GVL.CACHE.has(GVL.LATEST_CACHE_KEY)?(this.populate(GVL.CACHE.get(GVL.LATEST_CACHE_KEY)),this.readyPromise=Promise.resolve()):(this.isLatest=!0,this.readyPromise=this.fetchJson(s+GVL.latestFilename))}}static set baseUrl(e){if(/^https?:\/\/vendorlist\.consensu\.org\//.test(e))throw new index_js_1.GVLError("Invalid baseUrl! You may not pull directly from vendorlist.consensu.org and must provide your own cache");e.length>0&&"/"!==e[e.length-1]&&(e+="/"),this.baseUrl_=e}static get baseUrl(){return this.baseUrl_}static emptyLanguageCache(e){let s=!1;return void 0===e&&GVL.LANGUAGE_CACHE.size>0?(GVL.LANGUAGE_CACHE=new Map,s=!0):"string"==typeof e&&this.consentLanguages.has(e.toUpperCase())&&(GVL.LANGUAGE_CACHE.delete(e.toUpperCase()),s=!0),s}static emptyCache(e){let s=!1;return Number.isInteger(e)&&e>=0?(GVL.CACHE.delete(e),s=!0):void 0===e&&(GVL.CACHE=new Map,s=!0),s}cacheLanguage(){GVL.LANGUAGE_CACHE.has(this.lang_)||GVL.LANGUAGE_CACHE.set(this.lang_,{purposes:this.purposes,specialPurposes:this.specialPurposes,features:this.features,specialFeatures:this.specialFeatures,stacks:this.stacks})}fetchJson(e){return __awaiter(this,void 0,void 0,(function*(){try{this.populate(yield Json_js_1.Json.fetch(e))}catch(e){throw new index_js_1.GVLError(e.message)}}))}getJson(){return JSON.parse(JSON.stringify({gvlSpecificationVersion:this.gvlSpecificationVersion,vendorListVersion:this.vendorListVersion,tcfPolicyVersion:this.tcfPolicyVersion,lastUpdated:this.lastUpdated,purposes:this.purposes,specialPurposes:this.specialPurposes,features:this.features,specialFeatures:this.specialFeatures,stacks:this.stacks,vendors:this.fullVendorList}))}changeLanguage(e){return __awaiter(this,void 0,void 0,(function*(){const s=e.toUpperCase();if(!GVL.consentLanguages.has(s))throw new index_js_1.GVLError("unsupported language "+e);if(s!==this.lang_)if(this.lang_=s,GVL.LANGUAGE_CACHE.has(s)){const e=GVL.LANGUAGE_CACHE.get(s);for(const s in e)e.hasOwnProperty(s)&&(this[s]=e[s])}else{const s=GVL.baseUrl+GVL.languageFilename.replace("[LANG]",e);try{yield this.fetchJson(s),this.cacheLanguage()}catch(e){throw new index_js_1.GVLError("unable to load language: "+e.message)}}}))}get language(){return this.lang_}isVendorList(e){return void 0!==e&&void 0!==e.vendors}populate(e){this.purposes=e.purposes,this.specialPurposes=e.specialPurposes,this.features=e.features,this.specialFeatures=e.specialFeatures,this.stacks=e.stacks,this.isVendorList(e)&&(this.gvlSpecificationVersion=e.gvlSpecificationVersion,this.tcfPolicyVersion=e.tcfPolicyVersion,this.vendorListVersion=e.vendorListVersion,this.lastUpdated=e.lastUpdated,"string"==typeof this.lastUpdated&&(this.lastUpdated=new Date(this.lastUpdated)),this.vendors_=e.vendors,this.fullVendorList=e.vendors,this.mapVendors(),this.isReady_=!0,this.isLatest&&GVL.CACHE.set(GVL.LATEST_CACHE_KEY,this.getJson()),GVL.CACHE.has(this.vendorListVersion)||GVL.CACHE.set(this.vendorListVersion,this.getJson())),this.cacheLanguage()}mapVendors(e){this.byPurposeVendorMap={},this.bySpecialPurposeVendorMap={},this.byFeatureVendorMap={},this.bySpecialFeatureVendorMap={},Object.keys(this.purposes).forEach(e=>{this.byPurposeVendorMap[e]={legInt:new Set,consent:new Set,flexible:new Set}}),Object.keys(this.specialPurposes).forEach(e=>{this.bySpecialPurposeVendorMap[e]=new Set}),Object.keys(this.features).forEach(e=>{this.byFeatureVendorMap[e]=new Set}),Object.keys(this.specialFeatures).forEach(e=>{this.bySpecialFeatureVendorMap[e]=new Set}),Array.isArray(e)||(e=Object.keys(this.fullVendorList).map(e=>+e)),this.vendorIds=new Set(e),this.vendors_=e.reduce((e,s)=>{const t=this.vendors_[String(s)];return t&&void 0===t.deletedDate&&(t.purposes.forEach(e=>{this.byPurposeVendorMap[String(e)].consent.add(s)}),t.specialPurposes.forEach(e=>{this.bySpecialPurposeVendorMap[String(e)].add(s)}),t.legIntPurposes.forEach(e=>{this.byPurposeVendorMap[String(e)].legInt.add(s)}),t.flexiblePurposes&&t.flexiblePurposes.forEach(e=>{this.byPurposeVendorMap[String(e)].flexible.add(s)}),t.features.forEach(e=>{this.byFeatureVendorMap[String(e)].add(s)}),t.specialFeatures.forEach(e=>{this.bySpecialFeatureVendorMap[String(e)].add(s)}),e[s]=t),e},{})}getFilteredVendors(e,s,t,r){const i=e.charAt(0).toUpperCase()+e.slice(1);let n;const o={};return n="purpose"===e&&t?this["by"+i+"VendorMap"][String(s)][t]:this["by"+(r?"Special":"")+i+"VendorMap"][String(s)],n.forEach(e=>{o[String(e)]=this.vendors[String(e)]}),o}getVendorsWithConsentPurpose(e){return this.getFilteredVendors("purpose",e,"consent")}getVendorsWithLegIntPurpose(e){return this.getFilteredVendors("purpose",e,"legInt")}getVendorsWithFlexiblePurpose(e){return this.getFilteredVendors("purpose",e,"flexible")}getVendorsWithSpecialPurpose(e){return this.getFilteredVendors("purpose",e,void 0,!0)}getVendorsWithFeature(e){return this.getFilteredVendors("feature",e)}getVendorsWithSpecialFeature(e){return this.getFilteredVendors("feature",e,void 0,!0)}get vendors(){return this.vendors_}narrowVendorsTo(e){this.mapVendors(e)}get isReady(){return this.isReady_}clone(){const e=new GVL(this.getJson());return this.lang_!==GVL.DEFAULT_LANGUAGE&&e.changeLanguage(this.lang_),e}static isInstanceOf(e){return"object"==typeof e&&"function"==typeof e.narrowVendorsTo}}exports.GVL=GVL,GVL.LANGUAGE_CACHE=new Map,GVL.CACHE=new Map,GVL.LATEST_CACHE_KEY=0,GVL.DEFAULT_LANGUAGE="EN",GVL.consentLanguages=new index_js_2.ConsentLanguages,GVL.latestFilename="vendor-list.json",GVL.versionedFilename="archives/vendor-list-v[VERSION].json",GVL.languageFilename="purposes-[LANG].json";
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),__awaiter=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(s,o){function i(e){try{u(n.next(e))}catch(e){o(e)}}function a(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,a)}u((n=n.apply(e,t||[])).next())}))},__generator=this&&this.__generator||function(e,t){var r,n,s,o,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(s=2&o[0]?n.return:o[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,o[1])).done)return s;switch(n=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(s=i.trys,(s=s.length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){i.label=o[1];break}if(6===o[0]&&i.label<s[1]){i.label=s[1],s=o;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(o);break}s[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{r=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.GVL=void 0;var Cloneable_js_1=require("./Cloneable.js"),index_js_1=require("./errors/index.js"),Json_js_1=require("./Json.js"),index_js_2=require("./model/index.js"),GVL=function(e){function t(r){var n=e.call(this)||this;n.isReady_=!1,n.isLatest=!1;var s=t.baseUrl;if(n.lang_=t.DEFAULT_LANGUAGE,n.isVendorList(r))n.populate(r),n.readyPromise=Promise.resolve();else{if(!s)throw new index_js_1.GVLError("must specify GVL.baseUrl before loading GVL json");if(r>0){var o=r;t.CACHE.has(o)?(n.populate(t.CACHE.get(o)),n.readyPromise=Promise.resolve()):(s+=t.versionedFilename.replace("[VERSION]",String(o)),n.readyPromise=n.fetchJson(s))}else t.CACHE.has(t.LATEST_CACHE_KEY)?(n.populate(t.CACHE.get(t.LATEST_CACHE_KEY)),n.readyPromise=Promise.resolve()):(n.isLatest=!0,n.readyPromise=n.fetchJson(s+t.latestFilename))}return n}return __extends(t,e),Object.defineProperty(t,"baseUrl",{get:function(){return this.baseUrl_},set:function(e){if(/^https?:\/\/vendorlist\.consensu\.org\//.test(e))throw new index_js_1.GVLError("Invalid baseUrl! You may not pull directly from vendorlist.consensu.org and must provide your own cache");e.length>0&&"/"!==e[e.length-1]&&(e+="/"),this.baseUrl_=e},enumerable:!1,configurable:!0}),t.emptyLanguageCache=function(e){var r=!1;return void 0===e&&t.LANGUAGE_CACHE.size>0?(t.LANGUAGE_CACHE=new Map,r=!0):"string"==typeof e&&this.consentLanguages.has(e.toUpperCase())&&(t.LANGUAGE_CACHE.delete(e.toUpperCase()),r=!0),r},t.emptyCache=function(e){var r=!1;return Number.isInteger(e)&&e>=0?(t.CACHE.delete(e),r=!0):void 0===e&&(t.CACHE=new Map,r=!0),r},t.prototype.cacheLanguage=function(){t.LANGUAGE_CACHE.has(this.lang_)||t.LANGUAGE_CACHE.set(this.lang_,{purposes:this.purposes,specialPurposes:this.specialPurposes,features:this.features,specialFeatures:this.specialFeatures,stacks:this.stacks})},t.prototype.fetchJson=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r;return __generator(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),t=this.populate,[4,Json_js_1.Json.fetch(e)];case 1:return t.apply(this,[n.sent()]),[3,3];case 2:throw r=n.sent(),new index_js_1.GVLError(r.message);case 3:return[2]}}))}))},t.prototype.getJson=function(){return JSON.parse(JSON.stringify({gvlSpecificationVersion:this.gvlSpecificationVersion,vendorListVersion:this.vendorListVersion,tcfPolicyVersion:this.tcfPolicyVersion,lastUpdated:this.lastUpdated,purposes:this.purposes,specialPurposes:this.specialPurposes,features:this.features,specialFeatures:this.specialFeatures,stacks:this.stacks,vendors:this.fullVendorList}))},t.prototype.changeLanguage=function(e){return __awaiter(this,void 0,void 0,(function(){var r,n,s,o,i;return __generator(this,(function(a){switch(a.label){case 0:if(r=e.toUpperCase(),!t.consentLanguages.has(r))return[3,6];if(r===this.lang_)return[3,5];if(this.lang_=r,!t.LANGUAGE_CACHE.has(r))return[3,1];for(s in n=t.LANGUAGE_CACHE.get(r))n.hasOwnProperty(s)&&(this[s]=n[s]);return[3,5];case 1:o=t.baseUrl+t.languageFilename.replace("[LANG]",e),a.label=2;case 2:return a.trys.push([2,4,,5]),[4,this.fetchJson(o)];case 3:return a.sent(),this.cacheLanguage(),[3,5];case 4:throw i=a.sent(),new index_js_1.GVLError("unable to load language: "+i.message);case 5:return[3,7];case 6:throw new index_js_1.GVLError("unsupported language ".concat(e));case 7:return[2]}}))}))},Object.defineProperty(t.prototype,"language",{get:function(){return this.lang_},enumerable:!1,configurable:!0}),t.prototype.isVendorList=function(e){return void 0!==e&&void 0!==e.vendors},t.prototype.populate=function(e){this.purposes=e.purposes,this.specialPurposes=e.specialPurposes,this.features=e.features,this.specialFeatures=e.specialFeatures,this.stacks=e.stacks,this.isVendorList(e)&&(this.gvlSpecificationVersion=e.gvlSpecificationVersion,this.tcfPolicyVersion=e.tcfPolicyVersion,this.vendorListVersion=e.vendorListVersion,this.lastUpdated=e.lastUpdated,"string"==typeof this.lastUpdated&&(this.lastUpdated=new Date(this.lastUpdated)),this.vendors_=e.vendors,this.fullVendorList=e.vendors,this.mapVendors(),this.isReady_=!0,this.isLatest&&t.CACHE.set(t.LATEST_CACHE_KEY,this.getJson()),t.CACHE.has(this.vendorListVersion)||t.CACHE.set(this.vendorListVersion,this.getJson())),this.cacheLanguage()},t.prototype.mapVendors=function(e){var t=this;this.byPurposeVendorMap={},this.bySpecialPurposeVendorMap={},this.byFeatureVendorMap={},this.bySpecialFeatureVendorMap={},Object.keys(this.purposes).forEach((function(e){t.byPurposeVendorMap[e]={legInt:new Set,consent:new Set,flexible:new Set}})),Object.keys(this.specialPurposes).forEach((function(e){t.bySpecialPurposeVendorMap[e]=new Set})),Object.keys(this.features).forEach((function(e){t.byFeatureVendorMap[e]=new Set})),Object.keys(this.specialFeatures).forEach((function(e){t.bySpecialFeatureVendorMap[e]=new Set})),Array.isArray(e)||(e=Object.keys(this.fullVendorList).map((function(e){return+e}))),this.vendorIds=new Set(e),this.vendors_=e.reduce((function(e,r){var n=t.vendors_[String(r)];return n&&void 0===n.deletedDate&&(n.purposes.forEach((function(e){t.byPurposeVendorMap[String(e)].consent.add(r)})),n.specialPurposes.forEach((function(e){t.bySpecialPurposeVendorMap[String(e)].add(r)})),n.legIntPurposes.forEach((function(e){t.byPurposeVendorMap[String(e)].legInt.add(r)})),n.flexiblePurposes&&n.flexiblePurposes.forEach((function(e){t.byPurposeVendorMap[String(e)].flexible.add(r)})),n.features.forEach((function(e){t.byFeatureVendorMap[String(e)].add(r)})),n.specialFeatures.forEach((function(e){t.bySpecialFeatureVendorMap[String(e)].add(r)})),e[r]=n),e}),{})},t.prototype.getFilteredVendors=function(e,t,r,n){var s=this,o=e.charAt(0).toUpperCase()+e.slice(1),i={};return("purpose"===e&&r?this["by"+o+"VendorMap"][String(t)][r]:this["by"+(n?"Special":"")+o+"VendorMap"][String(t)]).forEach((function(e){i[String(e)]=s.vendors[String(e)]})),i},t.prototype.getVendorsWithConsentPurpose=function(e){return this.getFilteredVendors("purpose",e,"consent")},t.prototype.getVendorsWithLegIntPurpose=function(e){return this.getFilteredVendors("purpose",e,"legInt")},t.prototype.getVendorsWithFlexiblePurpose=function(e){return this.getFilteredVendors("purpose",e,"flexible")},t.prototype.getVendorsWithSpecialPurpose=function(e){return this.getFilteredVendors("purpose",e,void 0,!0)},t.prototype.getVendorsWithFeature=function(e){return this.getFilteredVendors("feature",e)},t.prototype.getVendorsWithSpecialFeature=function(e){return this.getFilteredVendors("feature",e,void 0,!0)},Object.defineProperty(t.prototype,"vendors",{get:function(){return this.vendors_},enumerable:!1,configurable:!0}),t.prototype.narrowVendorsTo=function(e){this.mapVendors(e)},Object.defineProperty(t.prototype,"isReady",{get:function(){return this.isReady_},enumerable:!1,configurable:!0}),t.prototype.clone=function(){var e=new t(this.getJson());return this.lang_!==t.DEFAULT_LANGUAGE&&e.changeLanguage(this.lang_),e},t.isInstanceOf=function(e){return"object"==typeof e&&"function"==typeof e.narrowVendorsTo},t.LANGUAGE_CACHE=new Map,t.CACHE=new Map,t.LATEST_CACHE_KEY=0,t.DEFAULT_LANGUAGE="EN",t.consentLanguages=new index_js_2.ConsentLanguages,t.latestFilename="vendor-list.json",t.versionedFilename="archives/vendor-list-v[VERSION].json",t.languageFilename="purposes-[LANG].json",t}(Cloneable_js_1.Cloneable);exports.GVL=GVL;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Json=void 0;class Json{static absCall(e,t,s,r){return new Promise((n,o)=>{const a=new XMLHttpRequest;a.withCredentials=s,a.addEventListener("load",()=>{if(a.readyState==XMLHttpRequest.DONE)if(a.status>=200&&a.status<300){let e=a.response;if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}n(e)}else o(new Error(`HTTP Status: ${a.status} response type: ${a.responseType}`))}),a.addEventListener("error",()=>{o(new Error("error"))}),a.addEventListener("abort",()=>{o(new Error("aborted"))}),null===t?a.open("GET",e,!0):a.open("POST",e,!0),a.responseType="json",a.timeout=r,a.ontimeout=()=>{o(new Error("Timeout "+r+"ms "+e))},a.send(t)})}static post(e,t,s=!1,r=0){return this.absCall(e,JSON.stringify(t),s,r)}static fetch(e,t=!1,s=0){return this.absCall(e,null,t,s)}}exports.Json=Json;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Json=void 0;var Json=function(){function e(){}return e.absCall=function(e,t,n,r){return new Promise((function(o,s){var i=new XMLHttpRequest;i.withCredentials=n,i.addEventListener("load",(function(){if(i.readyState==XMLHttpRequest.DONE)if(i.status>=200&&i.status<300){var e=i.response;if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}o(e)}else s(new Error("HTTP Status: ".concat(i.status," response type: ").concat(i.responseType)))})),i.addEventListener("error",(function(){s(new Error("error"))})),i.addEventListener("abort",(function(){s(new Error("aborted"))})),null===t?i.open("GET",e,!0):i.open("POST",e,!0),i.responseType="json",i.timeout=r,i.ontimeout=function(){s(new Error("Timeout "+r+"ms "+e))},i.send(t)}))},e.post=function(e,t,n,r){return void 0===n&&(n=!1),void 0===r&&(r=0),this.absCall(e,JSON.stringify(t),n,r)},e.fetch=function(e,t,n){return void 0===t&&(t=!1),void 0===n&&(n=0),this.absCall(e,null,t,n)},e}();exports.Json=Json;

@@ -10,2 +10,3 @@ import { Cloneable } from '../Cloneable.js';

private root;
getRoot(): TreeNodeMaybe;
isEmpty(): boolean;

@@ -22,3 +23,10 @@ add(value: number): void;

remove(value: number, current?: TreeNodeMaybe): void;
/**
* Build Binary Search Tree from the ordered number array.
* The depth of the tree will be the `log2` of the array length.
* @param {number[]} values number array in ascending order
* @return {BinarySearchTree} Binary Search Tree
*/
static build(values?: number[]): BinarySearchTree | null;
}
export {};

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.BinarySearchTree=void 0;const Cloneable_js_1=require("../Cloneable.js");class BinarySearchTree extends Cloneable_js_1.Cloneable{constructor(){super(...arguments),this.root=null}isEmpty(){return!this.root}add(e){const t={value:e,left:null,right:null};let r;if(this.isEmpty())this.root=t;else for(r=this.root;;)if(e<r.value){if(null===r.left){r.left=t;break}r=r.left}else{if(!(e>r.value))break;if(null===r.right){r.right=t;break}r=r.right}}get(){const e=[];let t=this.root;for(;t;)if(t.left){let r=t.left;for(;r.right&&r.right!=t;)r=r.right;r.right==t?(r.right=null,e.push(t.value),t=t.right):(r.right=t,t=t.left)}else e.push(t.value),t=t.right;return e}contains(e){let t=!1,r=this.root;for(;r;){if(r.value===e){t=!0;break}e>r.value?r=r.right:e<r.value&&(r=r.left)}return t}min(e=this.root){let t;for(;e;)e.left?e=e.left:(t=e.value,e=null);return t}max(e=this.root){let t;for(;e;)e.right?e=e.right:(t=e.value,e=null);return t}remove(e,t=this.root){let r=null,l="left";for(;t;)if(e<t.value)r=t,t=t.left,l="left";else if(e>t.value)r=t,t=t.right,l="right";else{if(t.left||t.right)if(t.left)if(t.right){const e=this.min(t.right);this.remove(e,t.right),t.value=e}else r?r[l]=t.left:this.root=t.left;else r?r[l]=t.right:this.root=t.right;else r?r[l]=null:this.root=null;t=null}}}exports.BinarySearchTree=BinarySearchTree;
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function o(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.BinarySearchTree=void 0;var Cloneable_js_1=require("../Cloneable.js"),BinarySearchTree=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.root=null,e}return __extends(e,t),e.prototype.getRoot=function(){return this.root},e.prototype.isEmpty=function(){return!this.root},e.prototype.add=function(t){var e,r={value:t,left:null,right:null};if(this.isEmpty())this.root=r;else for(e=this.root;;)if(t<e.value){if(null===e.left){e.left=r;break}e=e.left}else{if(!(t>e.value))break;if(null===e.right){e.right=r;break}e=e.right}},e.prototype.get=function(){for(var t=[],e=this.root;e;)if(e.left){for(var r=e.left;r.right&&r.right!=e;)r=r.right;r.right==e?(r.right=null,t.push(e.value),e=e.right):(r.right=e,e=e.left)}else t.push(e.value),e=e.right;return t},e.prototype.contains=function(t){for(var e=!1,r=this.root;r;){if(r.value===t){e=!0;break}t>r.value?r=r.right:t<r.value&&(r=r.left)}return e},e.prototype.min=function(t){var e;for(void 0===t&&(t=this.root);t;)t.left?t=t.left:(e=t.value,t=null);return e},e.prototype.max=function(t){var e;for(void 0===t&&(t=this.root);t;)t.right?t=t.right:(e=t.value,t=null);return e},e.prototype.remove=function(t,e){void 0===e&&(e=this.root);for(var r=null,o="left";e;)if(t<e.value)r=e,e=e.left,o="left";else if(t>e.value)r=e,e=e.right,o="right";else{if(e.left||e.right)if(e.left)if(e.right){var i=this.min(e.right);this.remove(i,e.right),e.value=i}else r?r[o]=e.left:this.root=e.left;else r?r[o]=e.right:this.root=e.right;else r?r[o]=null:this.root=null;e=null}},e.build=function(t){if(t&&0!==t.length){if(1===t.length)return(r=new e).add(t[0]),r;var r,o=t.length>>1;(r=new e).add(t[o]);var i=r.getRoot();if(i){if(o+1<t.length){var l=e.build(t.slice(o+1));i.right=l?l.getRoot():null}if(o-1>0){var n=e.build(t.slice(0,o-1));i.left=n?n.getRoot():null}}return r}return null},e}(Cloneable_js_1.Cloneable);exports.BinarySearchTree=BinarySearchTree;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConsentLanguages=void 0;class ConsentLanguages{has(e){return ConsentLanguages.langSet.has(e)}forEach(e){ConsentLanguages.langSet.forEach(e)}get size(){return ConsentLanguages.langSet.size}}exports.ConsentLanguages=ConsentLanguages,ConsentLanguages.langSet=new Set(["BG","CA","CS","DA","DE","EL","EN","ES","ET","FI","FR","HR","HU","IT","JA","LT","LV","MT","NL","NO","PL","PT","RO","RU","SK","SL","SV","TR","ZH"]);
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ConsentLanguages=void 0;var ConsentLanguages=function(){function e(){}return e.prototype.has=function(n){return e.langSet.has(n)},e.prototype.forEach=function(n){e.langSet.forEach(n)},Object.defineProperty(e.prototype,"size",{get:function(){return e.langSet.size},enumerable:!1,configurable:!0}),e.langSet=new Set(["BG","CA","CS","DA","DE","EL","EN","ES","ET","FI","FR","HR","HU","IT","JA","LT","LV","MT","NL","NO","PL","PT","RO","RU","SK","SL","SV","TR","ZH"]),e}();exports.ConsentLanguages=ConsentLanguages;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Fields=void 0;class Fields{}exports.Fields=Fields,Fields.cmpId="cmpId",Fields.cmpVersion="cmpVersion",Fields.consentLanguage="consentLanguage",Fields.consentScreen="consentScreen",Fields.created="created",Fields.supportOOB="supportOOB",Fields.isServiceSpecific="isServiceSpecific",Fields.lastUpdated="lastUpdated",Fields.numCustomPurposes="numCustomPurposes",Fields.policyVersion="policyVersion",Fields.publisherCountryCode="publisherCountryCode",Fields.publisherCustomConsents="publisherCustomConsents",Fields.publisherCustomLegitimateInterests="publisherCustomLegitimateInterests",Fields.publisherLegitimateInterests="publisherLegitimateInterests",Fields.publisherConsents="publisherConsents",Fields.publisherRestrictions="publisherRestrictions",Fields.purposeConsents="purposeConsents",Fields.purposeLegitimateInterests="purposeLegitimateInterests",Fields.purposeOneTreatment="purposeOneTreatment",Fields.specialFeatureOptins="specialFeatureOptins",Fields.useNonStandardStacks="useNonStandardStacks",Fields.vendorConsents="vendorConsents",Fields.vendorLegitimateInterests="vendorLegitimateInterests",Fields.vendorListVersion="vendorListVersion",Fields.vendorsAllowed="vendorsAllowed",Fields.vendorsDisclosed="vendorsDisclosed",Fields.version="version";
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Fields=void 0;var Fields=function(){function e(){}return e.cmpId="cmpId",e.cmpVersion="cmpVersion",e.consentLanguage="consentLanguage",e.consentScreen="consentScreen",e.created="created",e.supportOOB="supportOOB",e.isServiceSpecific="isServiceSpecific",e.lastUpdated="lastUpdated",e.numCustomPurposes="numCustomPurposes",e.policyVersion="policyVersion",e.publisherCountryCode="publisherCountryCode",e.publisherCustomConsents="publisherCustomConsents",e.publisherCustomLegitimateInterests="publisherCustomLegitimateInterests",e.publisherLegitimateInterests="publisherLegitimateInterests",e.publisherConsents="publisherConsents",e.publisherRestrictions="publisherRestrictions",e.purposeConsents="purposeConsents",e.purposeLegitimateInterests="purposeLegitimateInterests",e.purposeOneTreatment="purposeOneTreatment",e.specialFeatureOptins="specialFeatureOptins",e.useNonStandardStacks="useNonStandardStacks",e.vendorConsents="vendorConsents",e.vendorLegitimateInterests="vendorLegitimateInterests",e.vendorListVersion="vendorListVersion",e.vendorsAllowed="vendorsAllowed",e.vendorsDisclosed="vendorsDisclosed",e.version="version",e}();exports.Fields=Fields;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PurposeRestriction=void 0;const Cloneable_js_1=require("../Cloneable.js"),index_js_1=require("../errors/index.js"),RestrictionType_js_1=require("./RestrictionType.js");class PurposeRestriction extends Cloneable_js_1.Cloneable{constructor(e,s){super(),void 0!==e&&(this.purposeId=e),void 0!==s&&(this.restrictionType=s)}static unHash(e){const s=e.split(this.hashSeparator),r=new PurposeRestriction;if(2!==s.length)throw new index_js_1.TCModelError("hash",e);return r.purposeId=parseInt(s[0],10),r.restrictionType=parseInt(s[1],10),r}get hash(){if(!this.isValid())throw new Error("cannot hash invalid PurposeRestriction");return`${this.purposeId}${PurposeRestriction.hashSeparator}${this.restrictionType}`}get purposeId(){return this.purposeId_}set purposeId(e){this.purposeId_=e}isValid(){return Number.isInteger(this.purposeId)&&this.purposeId>0&&(this.restrictionType===RestrictionType_js_1.RestrictionType.NOT_ALLOWED||this.restrictionType===RestrictionType_js_1.RestrictionType.REQUIRE_CONSENT||this.restrictionType===RestrictionType_js_1.RestrictionType.REQUIRE_LI)}isSameAs(e){return this.purposeId===e.purposeId&&this.restrictionType===e.restrictionType}}exports.PurposeRestriction=PurposeRestriction,PurposeRestriction.hashSeparator="-";
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.PurposeRestriction=void 0;var Cloneable_js_1=require("../Cloneable.js"),index_js_1=require("../errors/index.js"),RestrictionType_js_1=require("./RestrictionType.js"),PurposeRestriction=function(e){function t(t,r){var o=e.call(this)||this;return void 0!==t&&(o.purposeId=t),void 0!==r&&(o.restrictionType=r),o}return __extends(t,e),t.unHash=function(e){var r=e.split(this.hashSeparator),o=new t;if(2!==r.length)throw new index_js_1.TCModelError("hash",e);return o.purposeId=parseInt(r[0],10),o.restrictionType=parseInt(r[1],10),o},Object.defineProperty(t.prototype,"hash",{get:function(){if(!this.isValid())throw new Error("cannot hash invalid PurposeRestriction");return"".concat(this.purposeId).concat(t.hashSeparator).concat(this.restrictionType)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"purposeId",{get:function(){return this.purposeId_},set:function(e){this.purposeId_=e},enumerable:!1,configurable:!0}),t.prototype.isValid=function(){return Number.isInteger(this.purposeId)&&this.purposeId>0&&(this.restrictionType===RestrictionType_js_1.RestrictionType.NOT_ALLOWED||this.restrictionType===RestrictionType_js_1.RestrictionType.REQUIRE_CONSENT||this.restrictionType===RestrictionType_js_1.RestrictionType.REQUIRE_LI)},t.prototype.isSameAs=function(e){return this.purposeId===e.purposeId&&this.restrictionType===e.restrictionType},t.hashSeparator="-",t}(Cloneable_js_1.Cloneable);exports.PurposeRestriction=PurposeRestriction;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.PurposeRestrictionVector=void 0;const PurposeRestriction_js_1=require("./PurposeRestriction.js"),BinarySearchTree_js_1=require("./BinarySearchTree.js"),RestrictionType_js_1=require("./RestrictionType.js"),Cloneable_js_1=require("../Cloneable.js");class PurposeRestrictionVector extends Cloneable_js_1.Cloneable{constructor(){super(...arguments),this.bitLength=0,this.map=new Map}has(e){return this.map.has(e)}isOkToHave(e,s,t){var r;let i=!0;if(null===(r=this.gvl)||void 0===r?void 0:r.vendors){const r=this.gvl.vendors[t];if(r)if(e===RestrictionType_js_1.RestrictionType.NOT_ALLOWED)i=r.legIntPurposes.includes(s)||r.purposes.includes(s);else if(r.flexiblePurposes.length)switch(e){case RestrictionType_js_1.RestrictionType.REQUIRE_CONSENT:i=r.flexiblePurposes.includes(s)&&r.legIntPurposes.includes(s);break;case RestrictionType_js_1.RestrictionType.REQUIRE_LI:i=r.flexiblePurposes.includes(s)&&r.purposes.includes(s)}else i=!1;else i=!1}return i}add(e,s){if(this.isOkToHave(s.restrictionType,s.purposeId,e)){const t=s.hash;this.has(t)||(this.map.set(t,new BinarySearchTree_js_1.BinarySearchTree),this.bitLength=0),this.map.get(t).add(e)}}restrictPurposeToLegalBasis(e){const s=this.gvl.vendorIds,t=e.hash,r=function(){let e;for(e of s);return e}();for(let e=1;e<=r;e++)this.has(t)||(this.map.set(t,new BinarySearchTree_js_1.BinarySearchTree),this.bitLength=0),this.map.get(t).add(e)}getVendors(e){let s=[];if(e){const t=e.hash;this.has(t)&&(s=this.map.get(t).get())}else{const e=new Set;this.map.forEach(s=>{s.get().forEach(s=>{e.add(s)})}),s=Array.from(e)}return s}getRestrictionType(e,s){let t;return this.getRestrictions(e).forEach(e=>{e.purposeId===s&&(void 0===t||t>e.restrictionType)&&(t=e.restrictionType)}),t}vendorHasRestriction(e,s){let t=!1;const r=this.getRestrictions(e);for(let e=0;e<r.length&&!t;e++)t=s.isSameAs(r[e]);return t}getMaxVendorId(){let e=0;return this.map.forEach(s=>{e=Math.max(s.max(),e)}),e}getRestrictions(e){const s=[];return this.map.forEach((t,r)=>{e?t.contains(e)&&s.push(PurposeRestriction_js_1.PurposeRestriction.unHash(r)):s.push(PurposeRestriction_js_1.PurposeRestriction.unHash(r))}),s}getPurposes(){const e=new Set;return this.map.forEach((s,t)=>{e.add(PurposeRestriction_js_1.PurposeRestriction.unHash(t).purposeId)}),Array.from(e)}remove(e,s){const t=s.hash,r=this.map.get(t);r&&(r.remove(e),r.isEmpty()&&(this.map.delete(t),this.bitLength=0))}set gvl(e){this.gvl_||(this.gvl_=e,this.map.forEach((e,s)=>{const t=PurposeRestriction_js_1.PurposeRestriction.unHash(s);e.get().forEach(s=>{this.isOkToHave(t.restrictionType,t.purposeId,s)||e.remove(s)})}))}get gvl(){return this.gvl_}isEmpty(){return 0===this.map.size}get numRestrictions(){return this.map.size}}exports.PurposeRestrictionVector=PurposeRestrictionVector;
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(t,r)};return function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}(),__values=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],o=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},__read=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var o,n,i=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return s},__spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var o,n=0,i=t.length;n<i;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(exports,"__esModule",{value:!0}),exports.PurposeRestrictionVector=void 0;var PurposeRestriction_js_1=require("./PurposeRestriction.js"),BinarySearchTree_js_1=require("./BinarySearchTree.js"),RestrictionType_js_1=require("./RestrictionType.js"),Cloneable_js_1=require("../Cloneable.js"),PurposeRestrictionVector=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.bitLength=0,t.map=new Map,t}return __extends(t,e),t.prototype.has=function(e){return this.map.has(e)},t.prototype.isOkToHave=function(e,t,r){var o,n=!0;if(null===(o=this.gvl)||void 0===o?void 0:o.vendors){var i=this.gvl.vendors[r];if(i)if(e===RestrictionType_js_1.RestrictionType.NOT_ALLOWED)n=i.legIntPurposes.includes(t)||i.purposes.includes(t);else if(i.flexiblePurposes.length)switch(e){case RestrictionType_js_1.RestrictionType.REQUIRE_CONSENT:n=i.flexiblePurposes.includes(t)&&i.legIntPurposes.includes(t);break;case RestrictionType_js_1.RestrictionType.REQUIRE_LI:n=i.flexiblePurposes.includes(t)&&i.purposes.includes(t)}else n=!1;else n=!1}return n},t.prototype.add=function(e,t){if(this.isOkToHave(t.restrictionType,t.purposeId,e)){var r=t.hash;this.has(r)||(this.map.set(r,new BinarySearchTree_js_1.BinarySearchTree),this.bitLength=0),this.map.get(r).add(e)}},t.prototype.restrictPurposeToLegalBasis=function(e){for(var t=this.gvl.vendorIds,r=e.hash,o=function(){var e,r,o;try{for(var n=__values(t),i=n.next();!i.done;i=n.next())o=i.value}catch(t){e={error:t}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return o}(),n=__spreadArray([],__read(Array(o).keys()),!1).map((function(e){return e+1})),i=1;i<=o;i++)this.has(r)||(this.map.set(r,BinarySearchTree_js_1.BinarySearchTree.build(n)),this.bitLength=0),this.map.get(r).add(i)},t.prototype.getVendors=function(e){var t=[];if(e){var r=e.hash;this.has(r)&&(t=this.map.get(r).get())}else{var o=new Set;this.map.forEach((function(e){e.get().forEach((function(e){o.add(e)}))})),t=Array.from(o)}return t},t.prototype.getRestrictionType=function(e,t){var r;return this.getRestrictions(e).forEach((function(e){e.purposeId===t&&(void 0===r||r>e.restrictionType)&&(r=e.restrictionType)})),r},t.prototype.vendorHasRestriction=function(e,t){for(var r=!1,o=this.getRestrictions(e),n=0;n<o.length&&!r;n++)r=t.isSameAs(o[n]);return r},t.prototype.getMaxVendorId=function(){var e=0;return this.map.forEach((function(t){e=Math.max(t.max(),e)})),e},t.prototype.getRestrictions=function(e){var t=[];return this.map.forEach((function(r,o){e?r.contains(e)&&t.push(PurposeRestriction_js_1.PurposeRestriction.unHash(o)):t.push(PurposeRestriction_js_1.PurposeRestriction.unHash(o))})),t},t.prototype.getPurposes=function(){var e=new Set;return this.map.forEach((function(t,r){e.add(PurposeRestriction_js_1.PurposeRestriction.unHash(r).purposeId)})),Array.from(e)},t.prototype.remove=function(e,t){var r=t.hash,o=this.map.get(r);o&&(o.remove(e),o.isEmpty()&&(this.map.delete(r),this.bitLength=0))},Object.defineProperty(t.prototype,"gvl",{get:function(){return this.gvl_},set:function(e){var t=this;this.gvl_||(this.gvl_=e,this.map.forEach((function(e,r){var o=PurposeRestriction_js_1.PurposeRestriction.unHash(r);e.get().forEach((function(r){t.isOkToHave(o.restrictionType,o.purposeId,r)||e.remove(r)}))})))},enumerable:!1,configurable:!0}),t.prototype.isEmpty=function(){return 0===this.map.size},Object.defineProperty(t.prototype,"numRestrictions",{get:function(){return this.map.size},enumerable:!1,configurable:!0}),t}(Cloneable_js_1.Cloneable);exports.PurposeRestrictionVector=PurposeRestrictionVector;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SegmentIDs=void 0;const Segment_js_1=require("./Segment.js");class SegmentIDs{}exports.SegmentIDs=SegmentIDs,SegmentIDs.ID_TO_KEY=[Segment_js_1.Segment.CORE,Segment_js_1.Segment.VENDORS_DISCLOSED,Segment_js_1.Segment.VENDORS_ALLOWED,Segment_js_1.Segment.PUBLISHER_TC],SegmentIDs.KEY_TO_ID={[Segment_js_1.Segment.CORE]:0,[Segment_js_1.Segment.VENDORS_DISCLOSED]:1,[Segment_js_1.Segment.VENDORS_ALLOWED]:2,[Segment_js_1.Segment.PUBLISHER_TC]:3};
"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.SegmentIDs=void 0;var Segment_js_1=require("./Segment.js"),SegmentIDs=function(){function e(){}return e.ID_TO_KEY=[Segment_js_1.Segment.CORE,Segment_js_1.Segment.VENDORS_DISCLOSED,Segment_js_1.Segment.VENDORS_ALLOWED,Segment_js_1.Segment.PUBLISHER_TC],e.KEY_TO_ID=((_a={})[Segment_js_1.Segment.CORE]=0,_a[Segment_js_1.Segment.VENDORS_DISCLOSED]=1,_a[Segment_js_1.Segment.VENDORS_ALLOWED]=2,_a[Segment_js_1.Segment.PUBLISHER_TC]=3,_a),e}();exports.SegmentIDs=SegmentIDs;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Vector=void 0;const Cloneable_js_1=require("../Cloneable.js"),index_js_1=require("../errors/index.js");class Vector extends Cloneable_js_1.Cloneable{constructor(){super(...arguments),this.bitLength=0,this.maxId_=0,this.set_=new Set}*[Symbol.iterator](){for(let e=1;e<=this.maxId;e++)yield[e,this.has(e)]}values(){return this.set_.values()}get maxId(){return this.maxId_}has(e){return this.set_.has(e)}unset(e){Array.isArray(e)?e.forEach(e=>this.unset(e)):"object"==typeof e?this.unset(Object.keys(e).map(e=>Number(e))):(this.set_.delete(Number(e)),this.bitLength=0,e===this.maxId&&(this.maxId_=0,this.set_.forEach(e=>{this.maxId_=Math.max(this.maxId,e)})))}isIntMap(e){let t="object"==typeof e;return t=t&&Object.keys(e).every(t=>{let s=Number.isInteger(parseInt(t,10));return s=s&&this.isValidNumber(e[t].id),s=s&&void 0!==e[t].name,s}),t}isValidNumber(e){return parseInt(e,10)>0}isSet(e){let t=!1;return e instanceof Set&&(t=Array.from(e).every(this.isValidNumber)),t}set(e){if(Array.isArray(e))e.forEach(e=>this.set(e));else if(this.isSet(e))this.set(Array.from(e));else if(this.isIntMap(e))this.set(Object.keys(e).map(e=>Number(e)));else{if(!this.isValidNumber(e))throw new index_js_1.TCModelError("set()",e,"must be positive integer array, positive integer, Set<number>, or IntMap");this.set_.add(e),this.maxId_=Math.max(this.maxId,e),this.bitLength=0}}empty(){this.set_=new Set}forEach(e){for(let t=1;t<=this.maxId;t++)e(this.has(t),t)}get size(){return this.set_.size}setAll(e){this.set(e)}}exports.Vector=Vector;
"use strict";var __extends=this&&this.__extends||function(){var t=function(e,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),__generator=this&&this.__generator||function(t,e){var r,n,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,n=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=e.call(t,s)}catch(t){i=[6,t],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Vector=void 0;var Cloneable_js_1=require("../Cloneable.js"),index_js_1=require("../errors/index.js"),Vector=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.bitLength=0,e.maxId_=0,e.set_=new Set,e}return __extends(e,t),e.prototype[Symbol.iterator]=function(){var t;return __generator(this,(function(e){switch(e.label){case 0:t=1,e.label=1;case 1:return t<=this.maxId?[4,[t,this.has(t)]]:[3,4];case 2:e.sent(),e.label=3;case 3:return t++,[3,1];case 4:return[2]}}))},e.prototype.values=function(){return this.set_.values()},Object.defineProperty(e.prototype,"maxId",{get:function(){return this.maxId_},enumerable:!1,configurable:!0}),e.prototype.has=function(t){return this.set_.has(t)},e.prototype.unset=function(t){var e=this;Array.isArray(t)?t.forEach((function(t){return e.unset(t)})):"object"==typeof t?this.unset(Object.keys(t).map((function(t){return Number(t)}))):(this.set_.delete(Number(t)),this.bitLength=0,t===this.maxId&&(this.maxId_=0,this.set_.forEach((function(t){e.maxId_=Math.max(e.maxId,t)}))))},e.prototype.isIntMap=function(t){var e=this,r="object"==typeof t;return r=r&&Object.keys(t).every((function(r){var n=Number.isInteger(parseInt(r,10));return n=(n=n&&e.isValidNumber(t[r].id))&&void 0!==t[r].name}))},e.prototype.isValidNumber=function(t){return parseInt(t,10)>0},e.prototype.isSet=function(t){var e=!1;return t instanceof Set&&(e=Array.from(t).every(this.isValidNumber)),e},e.prototype.set=function(t){var e=this;if(Array.isArray(t))t.forEach((function(t){return e.set(t)}));else if(this.isSet(t))this.set(Array.from(t));else if(this.isIntMap(t))this.set(Object.keys(t).map((function(t){return Number(t)})));else{if(!this.isValidNumber(t))throw new index_js_1.TCModelError("set()",t,"must be positive integer array, positive integer, Set<number>, or IntMap");this.set_.add(t),this.maxId_=Math.max(this.maxId,t),this.bitLength=0}},e.prototype.empty=function(){this.set_=new Set},e.prototype.forEach=function(t){for(var e=1;e<=this.maxId;e++)t(this.has(e),e)},Object.defineProperty(e.prototype,"size",{get:function(){return this.set_.size},enumerable:!1,configurable:!0}),e.prototype.setAll=function(t){this.set(t)},e}(Cloneable_js_1.Cloneable);exports.Vector=Vector;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TCModel=void 0;const Cloneable_js_1=require("./Cloneable.js"),index_js_1=require("./errors/index.js"),GVL_js_1=require("./GVL.js"),index_js_2=require("./model/index.js");class TCModel extends Cloneable_js_1.Cloneable{constructor(e){super(),this.isServiceSpecific_=!1,this.supportOOB_=!0,this.useNonStandardStacks_=!1,this.purposeOneTreatment_=!1,this.publisherCountryCode_="AA",this.version_=2,this.consentScreen_=0,this.policyVersion_=2,this.consentLanguage_="EN",this.cmpId_=0,this.cmpVersion_=0,this.vendorListVersion_=0,this.numCustomPurposes_=0,this.specialFeatureOptins=new index_js_2.Vector,this.purposeConsents=new index_js_2.Vector,this.purposeLegitimateInterests=new index_js_2.Vector,this.publisherConsents=new index_js_2.Vector,this.publisherLegitimateInterests=new index_js_2.Vector,this.publisherCustomConsents=new index_js_2.Vector,this.publisherCustomLegitimateInterests=new index_js_2.Vector,this.vendorConsents=new index_js_2.Vector,this.vendorLegitimateInterests=new index_js_2.Vector,this.vendorsDisclosed=new index_js_2.Vector,this.vendorsAllowed=new index_js_2.Vector,this.publisherRestrictions=new index_js_2.PurposeRestrictionVector,e&&(this.gvl=e),this.updated()}set gvl(e){GVL_js_1.GVL.isInstanceOf(e)||(e=new GVL_js_1.GVL(e)),this.gvl_=e,this.publisherRestrictions.gvl=e}get gvl(){return this.gvl_}set cmpId(e){if(e=Number(e),!(Number.isInteger(e)&&e>1))throw new index_js_1.TCModelError("cmpId",e);this.cmpId_=e}get cmpId(){return this.cmpId_}set cmpVersion(e){if(e=Number(e),!(Number.isInteger(e)&&e>-1))throw new index_js_1.TCModelError("cmpVersion",e);this.cmpVersion_=e}get cmpVersion(){return this.cmpVersion_}set consentScreen(e){if(e=Number(e),!(Number.isInteger(e)&&e>-1))throw new index_js_1.TCModelError("consentScreen",e);this.consentScreen_=e}get consentScreen(){return this.consentScreen_}set consentLanguage(e){this.consentLanguage_=e}get consentLanguage(){return this.consentLanguage_}set publisherCountryCode(e){if(!/^([A-z]){2}$/.test(e))throw new index_js_1.TCModelError("publisherCountryCode",e);this.publisherCountryCode_=e.toUpperCase()}get publisherCountryCode(){return this.publisherCountryCode_}set vendorListVersion(e){if((e=Number(e)>>0)<0)throw new index_js_1.TCModelError("vendorListVersion",e);this.vendorListVersion_=e}get vendorListVersion(){return this.gvl?this.gvl.vendorListVersion:this.vendorListVersion_}set policyVersion(e){if(this.policyVersion_=parseInt(e,10),this.policyVersion_<0)throw new index_js_1.TCModelError("policyVersion",e)}get policyVersion(){return this.gvl?this.gvl.tcfPolicyVersion:this.policyVersion_}set version(e){this.version_=parseInt(e,10)}get version(){return this.version_}set isServiceSpecific(e){this.isServiceSpecific_=e}get isServiceSpecific(){return this.isServiceSpecific_}set useNonStandardStacks(e){this.useNonStandardStacks_=e}get useNonStandardStacks(){return this.useNonStandardStacks_}set supportOOB(e){this.supportOOB_=e}get supportOOB(){return this.supportOOB_}set purposeOneTreatment(e){this.purposeOneTreatment_=e}get purposeOneTreatment(){return this.purposeOneTreatment_}setAllVendorConsents(){this.vendorConsents.set(this.gvl.vendors)}unsetAllVendorConsents(){this.vendorConsents.empty()}setAllVendorsDisclosed(){this.vendorsDisclosed.set(this.gvl.vendors)}unsetAllVendorsDisclosed(){this.vendorsDisclosed.empty()}setAllVendorsAllowed(){this.vendorsAllowed.set(this.gvl.vendors)}unsetAllVendorsAllowed(){this.vendorsAllowed.empty()}setAllVendorLegitimateInterests(){this.vendorLegitimateInterests.set(this.gvl.vendors)}unsetAllVendorLegitimateInterests(){this.vendorLegitimateInterests.empty()}setAllPurposeConsents(){this.purposeConsents.set(this.gvl.purposes)}unsetAllPurposeConsents(){this.purposeConsents.empty()}setAllPurposeLegitimateInterests(){this.purposeLegitimateInterests.set(this.gvl.purposes)}unsetAllPurposeLegitimateInterests(){this.purposeLegitimateInterests.empty()}setAllSpecialFeatureOptins(){this.specialFeatureOptins.set(this.gvl.specialFeatures)}unsetAllSpecialFeatureOptins(){this.specialFeatureOptins.empty()}setAll(){this.setAllVendorConsents(),this.setAllPurposeLegitimateInterests(),this.setAllSpecialFeatureOptins(),this.setAllPurposeConsents(),this.setAllVendorLegitimateInterests()}unsetAll(){this.unsetAllVendorConsents(),this.unsetAllPurposeLegitimateInterests(),this.unsetAllSpecialFeatureOptins(),this.unsetAllPurposeConsents(),this.unsetAllVendorLegitimateInterests()}get numCustomPurposes(){let e=this.numCustomPurposes_;if("object"==typeof this.customPurposes){const s=Object.keys(this.customPurposes).sort((e,s)=>Number(e)-Number(s));e=parseInt(s.pop(),10)}return e}set numCustomPurposes(e){if(this.numCustomPurposes_=parseInt(e,10),this.numCustomPurposes_<0)throw new index_js_1.TCModelError("numCustomPurposes",e)}updated(){const e=new Date,s=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));this.created=s,this.lastUpdated=s}}exports.TCModel=TCModel,TCModel.consentLanguages=GVL_js_1.GVL.consentLanguages;
"use strict";var __extends=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function s(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(s.prototype=n.prototype,new s)}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.TCModel=void 0;var Cloneable_js_1=require("./Cloneable.js"),index_js_1=require("./errors/index.js"),GVL_js_1=require("./GVL.js"),index_js_2=require("./model/index.js"),TCModel=function(e){function t(t){var n=e.call(this)||this;return n.isServiceSpecific_=!1,n.supportOOB_=!0,n.useNonStandardStacks_=!1,n.purposeOneTreatment_=!1,n.publisherCountryCode_="AA",n.version_=2,n.consentScreen_=0,n.policyVersion_=2,n.consentLanguage_="EN",n.cmpId_=0,n.cmpVersion_=0,n.vendorListVersion_=0,n.numCustomPurposes_=0,n.specialFeatureOptins=new index_js_2.Vector,n.purposeConsents=new index_js_2.Vector,n.purposeLegitimateInterests=new index_js_2.Vector,n.publisherConsents=new index_js_2.Vector,n.publisherLegitimateInterests=new index_js_2.Vector,n.publisherCustomConsents=new index_js_2.Vector,n.publisherCustomLegitimateInterests=new index_js_2.Vector,n.vendorConsents=new index_js_2.Vector,n.vendorLegitimateInterests=new index_js_2.Vector,n.vendorsDisclosed=new index_js_2.Vector,n.vendorsAllowed=new index_js_2.Vector,n.publisherRestrictions=new index_js_2.PurposeRestrictionVector,t&&(n.gvl=t),n.updated(),n}return __extends(t,e),Object.defineProperty(t.prototype,"gvl",{get:function(){return this.gvl_},set:function(e){GVL_js_1.GVL.isInstanceOf(e)||(e=new GVL_js_1.GVL(e)),this.gvl_=e,this.publisherRestrictions.gvl=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cmpId",{get:function(){return this.cmpId_},set:function(e){if(e=Number(e),!(Number.isInteger(e)&&e>1))throw new index_js_1.TCModelError("cmpId",e);this.cmpId_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cmpVersion",{get:function(){return this.cmpVersion_},set:function(e){if(e=Number(e),!(Number.isInteger(e)&&e>-1))throw new index_js_1.TCModelError("cmpVersion",e);this.cmpVersion_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"consentScreen",{get:function(){return this.consentScreen_},set:function(e){if(e=Number(e),!(Number.isInteger(e)&&e>-1))throw new index_js_1.TCModelError("consentScreen",e);this.consentScreen_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"consentLanguage",{get:function(){return this.consentLanguage_},set:function(e){this.consentLanguage_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"publisherCountryCode",{get:function(){return this.publisherCountryCode_},set:function(e){if(!/^([A-z]){2}$/.test(e))throw new index_js_1.TCModelError("publisherCountryCode",e);this.publisherCountryCode_=e.toUpperCase()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"vendorListVersion",{get:function(){return this.gvl?this.gvl.vendorListVersion:this.vendorListVersion_},set:function(e){if((e=Number(e)>>0)<0)throw new index_js_1.TCModelError("vendorListVersion",e);this.vendorListVersion_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"policyVersion",{get:function(){return this.gvl?this.gvl.tcfPolicyVersion:this.policyVersion_},set:function(e){if(this.policyVersion_=parseInt(e,10),this.policyVersion_<0)throw new index_js_1.TCModelError("policyVersion",e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"version",{get:function(){return this.version_},set:function(e){this.version_=parseInt(e,10)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isServiceSpecific",{get:function(){return this.isServiceSpecific_},set:function(e){this.isServiceSpecific_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useNonStandardStacks",{get:function(){return this.useNonStandardStacks_},set:function(e){this.useNonStandardStacks_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"supportOOB",{get:function(){return this.supportOOB_},set:function(e){this.supportOOB_=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"purposeOneTreatment",{get:function(){return this.purposeOneTreatment_},set:function(e){this.purposeOneTreatment_=e},enumerable:!1,configurable:!0}),t.prototype.setAllVendorConsents=function(){this.vendorConsents.set(this.gvl.vendors)},t.prototype.unsetAllVendorConsents=function(){this.vendorConsents.empty()},t.prototype.setAllVendorsDisclosed=function(){this.vendorsDisclosed.set(this.gvl.vendors)},t.prototype.unsetAllVendorsDisclosed=function(){this.vendorsDisclosed.empty()},t.prototype.setAllVendorsAllowed=function(){this.vendorsAllowed.set(this.gvl.vendors)},t.prototype.unsetAllVendorsAllowed=function(){this.vendorsAllowed.empty()},t.prototype.setAllVendorLegitimateInterests=function(){this.vendorLegitimateInterests.set(this.gvl.vendors)},t.prototype.unsetAllVendorLegitimateInterests=function(){this.vendorLegitimateInterests.empty()},t.prototype.setAllPurposeConsents=function(){this.purposeConsents.set(this.gvl.purposes)},t.prototype.unsetAllPurposeConsents=function(){this.purposeConsents.empty()},t.prototype.setAllPurposeLegitimateInterests=function(){this.purposeLegitimateInterests.set(this.gvl.purposes)},t.prototype.unsetAllPurposeLegitimateInterests=function(){this.purposeLegitimateInterests.empty()},t.prototype.setAllSpecialFeatureOptins=function(){this.specialFeatureOptins.set(this.gvl.specialFeatures)},t.prototype.unsetAllSpecialFeatureOptins=function(){this.specialFeatureOptins.empty()},t.prototype.setAll=function(){this.setAllVendorConsents(),this.setAllPurposeLegitimateInterests(),this.setAllSpecialFeatureOptins(),this.setAllPurposeConsents(),this.setAllVendorLegitimateInterests()},t.prototype.unsetAll=function(){this.unsetAllVendorConsents(),this.unsetAllPurposeLegitimateInterests(),this.unsetAllSpecialFeatureOptins(),this.unsetAllPurposeConsents(),this.unsetAllVendorLegitimateInterests()},Object.defineProperty(t.prototype,"numCustomPurposes",{get:function(){var e=this.numCustomPurposes_;if("object"==typeof this.customPurposes){var t=Object.keys(this.customPurposes).sort((function(e,t){return Number(e)-Number(t)}));e=parseInt(t.pop(),10)}return e},set:function(e){if(this.numCustomPurposes_=parseInt(e,10),this.numCustomPurposes_<0)throw new index_js_1.TCModelError("numCustomPurposes",e)},enumerable:!1,configurable:!0}),t.prototype.updated=function(){var e=new Date,t=new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()));this.created=t,this.lastUpdated=t},t.consentLanguages=GVL_js_1.GVL.consentLanguages,t}(Cloneable_js_1.Cloneable);exports.TCModel=TCModel;

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TCString=void 0;const index_js_1=require("./encoder/index.js"),index_js_2=require("./model/index.js"),IntEncoder_js_1=require("./encoder/field/IntEncoder.js"),TCModel_js_1=require("./TCModel.js");class TCString{static encode(e,n){let t,s="";return e=index_js_1.SemanticPreEncoder.process(e,n),t=Array.isArray(null==n?void 0:n.segments)?n.segments:new index_js_1.SegmentSequence(e,n)[""+e.version],t.forEach((n,r)=>{let d="";r<t.length-1&&(d="."),s+=index_js_1.SegmentEncoder.encode(e,n)+d}),s}static decode(e,n){const t=e.split("."),s=t.length;n||(n=new TCModel_js_1.TCModel);for(let e=0;e<s;e++){const s=t[e],r=index_js_1.Base64Url.decode(s.charAt(0)).substr(0,index_js_1.BitLength.segmentType),d=index_js_2.SegmentIDs.ID_TO_KEY[IntEncoder_js_1.IntEncoder.decode(r,index_js_1.BitLength.segmentType).toString()];index_js_1.SegmentEncoder.decode(s,n,d)}return n}}exports.TCString=TCString;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.TCString=void 0;var index_js_1=require("./encoder/index.js"),index_js_2=require("./model/index.js"),IntEncoder_js_1=require("./encoder/field/IntEncoder.js"),TCModel_js_1=require("./TCModel.js"),TCString=function(){function e(){}return e.encode=function(e,n){var r,t="";return e=index_js_1.SemanticPreEncoder.process(e,n),(r=Array.isArray(null==n?void 0:n.segments)?n.segments:new index_js_1.SegmentSequence(e,n)[""+e.version]).forEach((function(n,d){var s="";d<r.length-1&&(s="."),t+=index_js_1.SegmentEncoder.encode(e,n)+s})),t},e.decode=function(e,n){var r=e.split("."),t=r.length;n||(n=new TCModel_js_1.TCModel);for(var d=0;d<t;d++){var s=r[d],i=index_js_1.Base64Url.decode(s.charAt(0)).substr(0,index_js_1.BitLength.segmentType),o=index_js_2.SegmentIDs.ID_TO_KEY[IntEncoder_js_1.IntEncoder.decode(i,index_js_1.BitLength.segmentType).toString()];index_js_1.SegmentEncoder.decode(s,n,o)}return n},e}();exports.TCString=TCString;

@@ -10,2 +10,3 @@ import { Cloneable } from '../Cloneable.js';

private root;
getRoot(): TreeNodeMaybe;
isEmpty(): boolean;

@@ -22,3 +23,10 @@ add(value: number): void;

remove(value: number, current?: TreeNodeMaybe): void;
/**
* Build Binary Search Tree from the ordered number array.
* The depth of the tree will be the `log2` of the array length.
* @param {number[]} values number array in ascending order
* @return {BinarySearchTree} Binary Search Tree
*/
static build(values?: number[]): BinarySearchTree | null;
}
export {};
import { Cloneable } from '../Cloneable.js';
export class BinarySearchTree extends Cloneable {
root = null;
getRoot() {
return this.root;
}
isEmpty() {

@@ -231,2 +234,35 @@ // if root is undefined or null then by definition this is empty

}
/**
* Build Binary Search Tree from the ordered number array.
* The depth of the tree will be the `log2` of the array length.
* @param {number[]} values number array in ascending order
* @return {BinarySearchTree} Binary Search Tree
*/
static build(values) {
if (!values || values.length === 0) {
return null;
}
else if (values.length === 1) {
const tree = new BinarySearchTree();
tree.add(values[0]);
return tree;
}
else {
const rootIndex = values.length >> 1;
const tree = new BinarySearchTree();
tree.add(values[rootIndex]);
const root = tree.getRoot();
if (root) {
if (rootIndex + 1 < values.length) {
const rightTree = BinarySearchTree.build(values.slice(rootIndex + 1));
root.right = rightTree ? rightTree.getRoot() : null;
}
if (rootIndex - 1 > 0) {
const leftTree = BinarySearchTree.build(values.slice(0, rootIndex - 1));
root.left = leftTree ? leftTree.getRoot() : null;
}
}
return tree;
}
}
}

@@ -110,5 +110,9 @@ import { PurposeRestriction } from './PurposeRestriction.js';

})();
/**
* Create an ordered array of vendor IDs from `1` (the minimum value for Vendor ID) to `lastEntry`
*/
const values = [...Array(lastEntry).keys()].map((i) => i + 1);
for (let i = 1; i <= lastEntry; i++) {
if (!this.has(hash)) {
this.map.set(hash, new BinarySearchTree());
this.map.set(hash, BinarySearchTree.build(values)); // use static method `build` to create a `BST` from the ordered array of IDs
this.bitLength = 0;

@@ -115,0 +119,0 @@ }

{
"name": "@iabtcf-preprod/core",
"version": "1.5.7",
"version": "1.5.8",
"description": "Ensures consistent encoding and decoding of TC Signals for the iab. Transparency and Consent Framework (TCF).",

@@ -31,3 +31,3 @@ "author": "Chris Paterson <tcf@chrispaterson.io>",

"devDependencies": {
"@iabtcf-preprod/testing": "1.5.7",
"@iabtcf-preprod/testing": "1.5.8",
"@istanbuljs/nyc-config-typescript": "^0.1.3",

@@ -44,3 +44,3 @@ "@types/sinon": "^10.0.11",

"jscover": "^1.0.0",
"jsdom": "19.0.0",
"jsdom": "16.5.0",
"jsdom-global": "3.0.2",

@@ -54,3 +54,3 @@ "mocha": "^9.2.0",

"source-map-support": "^0.5.12",
"terser": "^4.6.3",
"terser": "^4.8.1",
"ts-node": "^10.5.0",

@@ -64,3 +64,4 @@ "typedoc": "^0.22.11",

"publishConfig": {
"access": "public"
"access": "public",
"@iabtcf-preprod:registry": "https://registry.npmjs.org/"
},

@@ -67,0 +68,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc