@brndts/brndts-ads 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -420,6 +420,14 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
420
420
  var __getOwnPropNames = Object.getOwnPropertyNames;
421
421
  var __getProtoOf = Object.getPrototypeOf;
422
422
  var __hasOwnProp = Object.prototype.hasOwnProperty;
423
+ var __defNormalProp = function(obj, key, value2) {
424
+ return key in obj ? __defProp(obj, key, {
425
+ enumerable: true,
426
+ configurable: true,
427
+ writable: true,
428
+ value: value2
429
+ }) : obj[key] = value2;
430
+ };
423
431
  var __commonJS = function(cb, mod) {
424
432
  return function __require() {
425
433
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = {
@@ -474,6 +482,10 @@ var __toESM = function(mod, isNodeMode, target) {
474
482
  enumerable: true
475
483
  }) : target, mod);
476
484
  };
485
+ var __publicField = function(obj, key, value2) {
486
+ __defNormalProp(obj, (typeof key === "undefined" ? "undefined" : _type_of(key)) !== "symbol" ? key + "" : key, value2);
487
+ return value2;
488
+ };
477
489
  // node_modules/events/events.js
478
490
  var require_events = __commonJS({
479
491
  "node_modules/events/events.js": function(exports, module2) {
@@ -1051,7 +1063,7 @@ function isSyntheticEvent(wat) {
1051
1063
  function isInstanceOf(wat, base) {
1052
1064
  try {
1053
1065
  return _instanceof(wat, base);
1054
- } catch (_e) {
1066
+ } catch (_e2) {
1055
1067
  return false;
1056
1068
  }
1057
1069
  }
@@ -18687,47 +18699,19 @@ function getGeneralInfo() {
18687
18699
  function _getGeneralInfo() {
18688
18700
  _getGeneralInfo = // src/Common/info.ts
18689
18701
  _async_to_generator(function() {
18690
- var info, ipInfo, error;
18702
+ var info;
18691
18703
  return _ts_generator(this, function(_state) {
18692
- switch(_state.label){
18693
- case 0:
18694
- info = {};
18695
- _state.label = 1;
18696
- case 1:
18697
- _state.trys.push([
18698
- 1,
18699
- 3,
18700
- ,
18701
- 4
18702
- ]);
18703
- info.ua = navigator.userAgent;
18704
- info.domain = window.location.hostname;
18705
- return [
18706
- 4,
18707
- fetch("https://api.ipify.org?format=json").then(function(response) {
18708
- return response.json();
18709
- })
18710
- ];
18711
- case 2:
18712
- ipInfo = _state.sent();
18713
- info.ip = ipInfo.ip;
18714
- return [
18715
- 3,
18716
- 4
18717
- ];
18718
- case 3:
18719
- error = _state.sent();
18720
- console.log("Error getting info", error);
18721
- return [
18722
- 3,
18723
- 4
18724
- ];
18725
- case 4:
18726
- return [
18727
- 2,
18728
- info
18729
- ];
18704
+ info = {};
18705
+ try {
18706
+ info.ua = navigator.userAgent;
18707
+ info.domain = window.location.hostname;
18708
+ } catch (error) {
18709
+ console.log("Error getting info", error);
18730
18710
  }
18711
+ return [
18712
+ 2,
18713
+ info
18714
+ ];
18731
18715
  });
18732
18716
  });
18733
18717
  return _getGeneralInfo.apply(this, arguments);
@@ -20607,220 +20591,3607 @@ var KevelProvider = /*#__PURE__*/ function(ContentProvider) {
20607
20591
  ]);
20608
20592
  return KevelProvider;
20609
20593
  }(ContentProvider);
20610
- // src/Ads/Providers/SmartyAds/SmartyAdsSDK.ts
20611
- import { TCModel, TCString, GVL } from "@iabtcf/core";
20612
- GVL.baseUrl = "https://vendor-list.consensu.org/v3/";
20613
- var PARAMS = [
20614
- "res",
20615
- "m",
20616
- "ua",
20617
- "ip",
20618
- "w",
20619
- "h",
20620
- "gdpr",
20621
- "gdpr_consent",
20622
- "gpp",
20623
- "gpp_sid",
20624
- "coppa",
20625
- "page",
20626
- "domain",
20627
- "secure",
20628
- "lmt",
20629
- "dnt",
20630
- "ad_width",
20631
- "ad_height",
20632
- "language",
20633
- "cattax",
20634
- "keywords",
20635
- "placementId"
20636
- ];
20637
- var SmartyadsSDK = /*#__PURE__*/ function() {
20594
+ // node_modules/@iabtcf/core/lib/mjs/errors/DecodingError.js
20595
+ var DecodingError = /*#__PURE__*/ function(Error1) {
20638
20596
  "use strict";
20639
- function SmartyadsSDK() {
20640
- _class_call_check(this, SmartyadsSDK);
20597
+ _inherits(DecodingError, Error1);
20598
+ var _super = _create_super(DecodingError);
20599
+ function DecodingError(msg) {
20600
+ _class_call_check(this, DecodingError);
20601
+ var _this;
20602
+ _this = _super.call(this, msg);
20603
+ _this.name = "DecodingError";
20604
+ return _this;
20641
20605
  }
20642
- _create_class(SmartyadsSDK, [
20643
- {
20644
- key: "generateTCString",
20645
- value: function generateTCString() {
20646
- var _this = this;
20647
- return _async_to_generator(function() {
20648
- var tcModel;
20649
- return _ts_generator(this, function(_state) {
20650
- switch(_state.label){
20651
- case 0:
20652
- if (!!_this.gdprConsent) return [
20653
- 3,
20654
- 2
20655
- ];
20656
- tcModel = new TCModel(new GVL());
20657
- tcModel.vendorConsents.set(534);
20658
- return [
20659
- 4,
20660
- tcModel.gvl.readyPromise
20661
- ];
20662
- case 1:
20663
- _state.sent();
20664
- _this.gdprConsent = TCString.encode(tcModel);
20665
- console.log(_this.gdprConsent);
20666
- _state.label = 2;
20667
- case 2:
20668
- return [
20669
- 2,
20670
- _this.gdprConsent
20671
- ];
20672
- }
20673
- });
20674
- })();
20675
- }
20676
- },
20677
- {
20678
- key: "buildQueryParams",
20679
- value: /**
20680
- * Converts an object into a URL query string.
20681
- *
20682
- * @param params - The object to be converted into query parameters.
20683
- * @returns The query string with URL encoding.
20684
- */ function buildQueryParams(params) {
20685
- var _this = this;
20686
- return _async_to_generator(function() {
20687
- var queryString;
20688
- return _ts_generator(this, function(_state) {
20689
- switch(_state.label){
20690
- case 0:
20691
- if (!(params.gdpr === void 0)) return [
20692
- 3,
20693
- 2
20694
- ];
20695
- params.gdpr = 1;
20696
- return [
20697
- 4,
20698
- _this.generateTCString()
20699
- ];
20700
- case 1:
20701
- params.gdpr_consent = _state.sent();
20702
- _state.label = 2;
20703
- case 2:
20704
- queryString = PARAMS.map(function(key) {
20705
- var value2 = params[key];
20706
- if (value2 === null || value2 === void 0) {
20707
- return "";
20708
- }
20709
- return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value2));
20710
- }).filter(function(part) {
20711
- return part.length > 0;
20712
- }).join("&");
20713
- return [
20714
- 2,
20715
- queryString
20716
- ];
20717
- }
20718
- });
20719
- })();
20720
- }
20721
- },
20722
- {
20723
- key: "request",
20724
- value: function request(params) {
20725
- var _this = this;
20726
- return _async_to_generator(function() {
20727
- var _, _1;
20728
- return _ts_generator(this, function(_state) {
20729
- switch(_state.label){
20730
- case 0:
20731
- _1 = (_ = "https://n1.smartyads.com/?c=b&").concat;
20732
- return [
20733
- 4,
20734
- _this.buildQueryParams(params)
20735
- ];
20736
- case 1:
20737
- return [
20738
- 2,
20739
- fetch.apply(void 0, [
20740
- _1.apply(_, [
20741
- _state.sent()
20742
- ])
20743
- ]).then(function(response) {
20744
- if (!response.ok) {
20745
- throw new InternalError("Network response was not ok");
20746
- }
20747
- return response.json();
20748
- }).then(function(data) {
20749
- return data;
20750
- }).catch(function(error) {
20751
- throw error;
20752
- })
20753
- ];
20754
- }
20755
- });
20756
- })();
20757
- }
20758
- }
20759
- ]);
20760
- return SmartyadsSDK;
20761
- }();
20762
- // src/Ads/Providers/SmartyAds/SmartyadsProvider.ts
20763
- var SmartyadsProvider = /*#__PURE__*/ function(ContentProvider) {
20606
+ return DecodingError;
20607
+ }(_wrap_native_super(Error));
20608
+ // node_modules/@iabtcf/core/lib/mjs/errors/EncodingError.js
20609
+ var EncodingError = /*#__PURE__*/ function(Error1) {
20764
20610
  "use strict";
20765
- _inherits(SmartyadsProvider, ContentProvider);
20766
- var _super = _create_super(SmartyadsProvider);
20767
- function SmartyadsProvider(context, options) {
20768
- _class_call_check(this, SmartyadsProvider);
20611
+ _inherits(EncodingError, Error1);
20612
+ var _super = _create_super(EncodingError);
20613
+ function EncodingError(msg) {
20614
+ _class_call_check(this, EncodingError);
20769
20615
  var _this;
20770
- _this = _super.call(this, context, options);
20771
- _this.placements = options.placements || {};
20772
- _this.smartyads = new SmartyadsSDK();
20616
+ _this = _super.call(this, msg);
20617
+ _this.name = "EncodingError";
20773
20618
  return _this;
20774
20619
  }
20775
- _create_class(SmartyadsProvider, [
20620
+ return EncodingError;
20621
+ }(_wrap_native_super(Error));
20622
+ // node_modules/@iabtcf/core/lib/mjs/errors/GVLError.js
20623
+ var GVLError = /*#__PURE__*/ function(Error1) {
20624
+ "use strict";
20625
+ _inherits(GVLError, Error1);
20626
+ var _super = _create_super(GVLError);
20627
+ function GVLError(msg) {
20628
+ _class_call_check(this, GVLError);
20629
+ var _this;
20630
+ _this = _super.call(this, msg);
20631
+ _this.name = "GVLError";
20632
+ return _this;
20633
+ }
20634
+ return GVLError;
20635
+ }(_wrap_native_super(Error));
20636
+ // node_modules/@iabtcf/core/lib/mjs/errors/TCModelError.js
20637
+ var TCModelError = /*#__PURE__*/ function(Error1) {
20638
+ "use strict";
20639
+ _inherits(TCModelError, Error1);
20640
+ var _super = _create_super(TCModelError);
20641
+ function TCModelError(fieldName, passedValue) {
20642
+ var msg = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
20643
+ _class_call_check(this, TCModelError);
20644
+ var _this;
20645
+ _this = _super.call(this, "invalid value ".concat(passedValue, " passed for ").concat(fieldName, " ").concat(msg));
20646
+ _this.name = "TCModelError";
20647
+ return _this;
20648
+ }
20649
+ return TCModelError;
20650
+ }(_wrap_native_super(Error));
20651
+ // node_modules/@iabtcf/core/lib/mjs/encoder/Base64Url.js
20652
+ var Base64Url = /*#__PURE__*/ function() {
20653
+ "use strict";
20654
+ function Base64Url() {
20655
+ _class_call_check(this, Base64Url);
20656
+ }
20657
+ _create_class(Base64Url, null, [
20776
20658
  {
20777
- key: "getPlacement",
20778
- value: function getPlacement(regionId) {
20779
- var availablePlacements = Object.keys(this.placements).map(parseInt);
20780
- if (!availablePlacements.length) {
20781
- throw new Error("No available placements!");
20782
- }
20783
- var foundPlacement;
20784
- if (!regionId) {
20785
- foundPlacement = this.placements[availablePlacements[0]];
20786
- } else {
20787
- foundPlacement = this.placements[regionId];
20659
+ key: "encode",
20660
+ value: /**
20661
+ * encodes an arbitrary-length bitfield string into base64url
20662
+ *
20663
+ * @static
20664
+ * @param {string} str - arbitrary-length bitfield string to be encoded to base64url
20665
+ * @return {string} - base64url encoded result
20666
+ */ function encode(str) {
20667
+ if (!/^[0-1]+$/.test(str)) {
20668
+ throw new EncodingError("Invalid bitField");
20788
20669
  }
20789
- if (typeof foundPlacement === "number") {
20790
- return {
20791
- id: foundPlacement
20792
- };
20670
+ var padding = str.length % this.LCM;
20671
+ str += padding ? "0".repeat(this.LCM - padding) : "";
20672
+ var result = "";
20673
+ for(var i2 = 0; i2 < str.length; i2 += this.BASIS){
20674
+ result += this.DICT[parseInt(str.substr(i2, this.BASIS), 2)];
20793
20675
  }
20794
- return foundPlacement;
20676
+ return result;
20795
20677
  }
20796
20678
  },
20797
20679
  {
20798
- key: "request",
20799
- value: function request(params) {
20800
- var _this = this;
20801
- return _async_to_generator(function() {
20802
- var _params_params, placementInfo, smartyadsContent, div, index;
20803
- return _ts_generator(this, function(_state) {
20804
- switch(_state.label){
20805
- case 0:
20806
- if (!params || params.size.width === void 0 || params.size.width === 0 || params.size.height === void 0 || params.size.height === 0) {
20807
- throw new InternalError("No Params!");
20808
- }
20809
- placementInfo = _this.getPlacement((_params_params = params.params) === null || _params_params === void 0 ? void 0 : _params_params.regionId);
20810
- return [
20811
- 4,
20812
- _this.smartyads.request(_object_spread_props(_object_spread({}, _this.options), {
20813
- ad_width: placementInfo.w || params.size.width,
20814
- ad_height: placementInfo.h || params.size.height,
20815
- m: "api",
20816
- ua: _this.context.info.ua || navigator.userAgent,
20817
- w: window.innerWidth,
20818
- h: window.innerHeight,
20819
- domain: _this.context.info.domain || window.location.hostname,
20820
- page: window.location.href,
20821
- ip: _this.context.info.ip,
20822
- placementId: placementInfo.id
20823
- }))
20680
+ key: "decode",
20681
+ value: /**
20682
+ * decodes a base64url encoded bitfield string
20683
+ *
20684
+ * @static
20685
+ * @param {string} str - base64url encoded bitfield string to be decoded
20686
+ * @return {string} - bitfield string
20687
+ */ function decode(str) {
20688
+ if (!/^[A-Za-z0-9\-_]+$/.test(str)) {
20689
+ throw new DecodingError("Invalidly encoded Base64URL string");
20690
+ }
20691
+ var result = "";
20692
+ for(var i2 = 0; i2 < str.length; i2++){
20693
+ var strBits = this.REVERSE_DICT.get(str[i2]).toString(2);
20694
+ result += "0".repeat(this.BASIS - strBits.length) + strBits;
20695
+ }
20696
+ return result;
20697
+ }
20698
+ }
20699
+ ]);
20700
+ return Base64Url;
20701
+ }();
20702
+ /**
20703
+ * Base 64 URL character set. Different from standard Base64 char set
20704
+ * in that '+' and '/' are replaced with '-' and '_'.
20705
+ */ __publicField(Base64Url, "DICT", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");
20706
+ __publicField(Base64Url, "REVERSE_DICT", /* @__PURE__ */ new Map([
20707
+ [
20708
+ "A",
20709
+ 0
20710
+ ],
20711
+ [
20712
+ "B",
20713
+ 1
20714
+ ],
20715
+ [
20716
+ "C",
20717
+ 2
20718
+ ],
20719
+ [
20720
+ "D",
20721
+ 3
20722
+ ],
20723
+ [
20724
+ "E",
20725
+ 4
20726
+ ],
20727
+ [
20728
+ "F",
20729
+ 5
20730
+ ],
20731
+ [
20732
+ "G",
20733
+ 6
20734
+ ],
20735
+ [
20736
+ "H",
20737
+ 7
20738
+ ],
20739
+ [
20740
+ "I",
20741
+ 8
20742
+ ],
20743
+ [
20744
+ "J",
20745
+ 9
20746
+ ],
20747
+ [
20748
+ "K",
20749
+ 10
20750
+ ],
20751
+ [
20752
+ "L",
20753
+ 11
20754
+ ],
20755
+ [
20756
+ "M",
20757
+ 12
20758
+ ],
20759
+ [
20760
+ "N",
20761
+ 13
20762
+ ],
20763
+ [
20764
+ "O",
20765
+ 14
20766
+ ],
20767
+ [
20768
+ "P",
20769
+ 15
20770
+ ],
20771
+ [
20772
+ "Q",
20773
+ 16
20774
+ ],
20775
+ [
20776
+ "R",
20777
+ 17
20778
+ ],
20779
+ [
20780
+ "S",
20781
+ 18
20782
+ ],
20783
+ [
20784
+ "T",
20785
+ 19
20786
+ ],
20787
+ [
20788
+ "U",
20789
+ 20
20790
+ ],
20791
+ [
20792
+ "V",
20793
+ 21
20794
+ ],
20795
+ [
20796
+ "W",
20797
+ 22
20798
+ ],
20799
+ [
20800
+ "X",
20801
+ 23
20802
+ ],
20803
+ [
20804
+ "Y",
20805
+ 24
20806
+ ],
20807
+ [
20808
+ "Z",
20809
+ 25
20810
+ ],
20811
+ [
20812
+ "a",
20813
+ 26
20814
+ ],
20815
+ [
20816
+ "b",
20817
+ 27
20818
+ ],
20819
+ [
20820
+ "c",
20821
+ 28
20822
+ ],
20823
+ [
20824
+ "d",
20825
+ 29
20826
+ ],
20827
+ [
20828
+ "e",
20829
+ 30
20830
+ ],
20831
+ [
20832
+ "f",
20833
+ 31
20834
+ ],
20835
+ [
20836
+ "g",
20837
+ 32
20838
+ ],
20839
+ [
20840
+ "h",
20841
+ 33
20842
+ ],
20843
+ [
20844
+ "i",
20845
+ 34
20846
+ ],
20847
+ [
20848
+ "j",
20849
+ 35
20850
+ ],
20851
+ [
20852
+ "k",
20853
+ 36
20854
+ ],
20855
+ [
20856
+ "l",
20857
+ 37
20858
+ ],
20859
+ [
20860
+ "m",
20861
+ 38
20862
+ ],
20863
+ [
20864
+ "n",
20865
+ 39
20866
+ ],
20867
+ [
20868
+ "o",
20869
+ 40
20870
+ ],
20871
+ [
20872
+ "p",
20873
+ 41
20874
+ ],
20875
+ [
20876
+ "q",
20877
+ 42
20878
+ ],
20879
+ [
20880
+ "r",
20881
+ 43
20882
+ ],
20883
+ [
20884
+ "s",
20885
+ 44
20886
+ ],
20887
+ [
20888
+ "t",
20889
+ 45
20890
+ ],
20891
+ [
20892
+ "u",
20893
+ 46
20894
+ ],
20895
+ [
20896
+ "v",
20897
+ 47
20898
+ ],
20899
+ [
20900
+ "w",
20901
+ 48
20902
+ ],
20903
+ [
20904
+ "x",
20905
+ 49
20906
+ ],
20907
+ [
20908
+ "y",
20909
+ 50
20910
+ ],
20911
+ [
20912
+ "z",
20913
+ 51
20914
+ ],
20915
+ [
20916
+ "0",
20917
+ 52
20918
+ ],
20919
+ [
20920
+ "1",
20921
+ 53
20922
+ ],
20923
+ [
20924
+ "2",
20925
+ 54
20926
+ ],
20927
+ [
20928
+ "3",
20929
+ 55
20930
+ ],
20931
+ [
20932
+ "4",
20933
+ 56
20934
+ ],
20935
+ [
20936
+ "5",
20937
+ 57
20938
+ ],
20939
+ [
20940
+ "6",
20941
+ 58
20942
+ ],
20943
+ [
20944
+ "7",
20945
+ 59
20946
+ ],
20947
+ [
20948
+ "8",
20949
+ 60
20950
+ ],
20951
+ [
20952
+ "9",
20953
+ 61
20954
+ ],
20955
+ [
20956
+ "-",
20957
+ 62
20958
+ ],
20959
+ [
20960
+ "_",
20961
+ 63
20962
+ ]
20963
+ ]));
20964
+ /**
20965
+ * log2(64) = 6
20966
+ */ __publicField(Base64Url, "BASIS", 6);
20967
+ __publicField(Base64Url, "LCM", 24);
20968
+ // node_modules/@iabtcf/core/lib/mjs/Cloneable.js
20969
+ var Cloneable = /*#__PURE__*/ function() {
20970
+ "use strict";
20971
+ function Cloneable() {
20972
+ _class_call_check(this, Cloneable);
20973
+ }
20974
+ _create_class(Cloneable, [
20975
+ {
20976
+ /**
20977
+ * clone - returns a copy of the classes with new values and not references
20978
+ *
20979
+ * @return {T}
20980
+ */ key: "clone",
20981
+ value: function clone() {
20982
+ var _this = this;
20983
+ var myClone = new this.constructor();
20984
+ var keys = Object.keys(this);
20985
+ keys.forEach(function(key) {
20986
+ var value2 = _this.deepClone(_this[key]);
20987
+ if (value2 !== void 0) {
20988
+ myClone[key] = value2;
20989
+ }
20990
+ });
20991
+ return myClone;
20992
+ }
20993
+ },
20994
+ {
20995
+ /**
20996
+ * deepClone - recursive function that makes copies of reference values
20997
+ *
20998
+ * @param {unknown} item
20999
+ * @return {unknown}
21000
+ */ key: "deepClone",
21001
+ value: function deepClone(item) {
21002
+ var itsType = typeof item === "undefined" ? "undefined" : _type_of(item);
21003
+ if (itsType === "number" || itsType === "string" || itsType === "boolean") {
21004
+ return item;
21005
+ } else if (item !== null && itsType === "object") {
21006
+ if (typeof item.clone === "function") {
21007
+ return item.clone();
21008
+ } else if (_instanceof(item, Date)) {
21009
+ return new Date(item.getTime());
21010
+ } else if (item[Symbol.iterator] !== void 0) {
21011
+ var ar = [];
21012
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
21013
+ try {
21014
+ for(var _iterator = item[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
21015
+ var subItem = _step.value;
21016
+ ar.push(this.deepClone(subItem));
21017
+ }
21018
+ } catch (err) {
21019
+ _didIteratorError = true;
21020
+ _iteratorError = err;
21021
+ } finally{
21022
+ try {
21023
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
21024
+ _iterator.return();
21025
+ }
21026
+ } finally{
21027
+ if (_didIteratorError) {
21028
+ throw _iteratorError;
21029
+ }
21030
+ }
21031
+ }
21032
+ if (_instanceof(item, Array)) {
21033
+ return ar;
21034
+ } else {
21035
+ return new item.constructor(ar);
21036
+ }
21037
+ } else {
21038
+ var retr = {};
21039
+ for(var prop in item){
21040
+ if (item.hasOwnProperty(prop)) {
21041
+ retr[prop] = this.deepClone(item[prop]);
21042
+ }
21043
+ }
21044
+ return retr;
21045
+ }
21046
+ }
21047
+ }
21048
+ }
21049
+ ]);
21050
+ return Cloneable;
21051
+ }();
21052
+ // node_modules/@iabtcf/core/lib/mjs/model/BinarySearchTree.js
21053
+ var BinarySearchTree = /*#__PURE__*/ function(Cloneable) {
21054
+ "use strict";
21055
+ _inherits(_BinarySearchTree, Cloneable);
21056
+ var _super = _create_super(_BinarySearchTree);
21057
+ function _BinarySearchTree() {
21058
+ _class_call_check(this, _BinarySearchTree);
21059
+ var _this;
21060
+ _this = _super.call.apply(_super, [
21061
+ this
21062
+ ].concat(Array.prototype.slice.call(arguments)));
21063
+ __publicField(_assert_this_initialized(_this), "root", null);
21064
+ return _this;
21065
+ }
21066
+ _create_class(_BinarySearchTree, [
21067
+ {
21068
+ key: "getRoot",
21069
+ value: function getRoot() {
21070
+ return this.root;
21071
+ }
21072
+ },
21073
+ {
21074
+ key: "isEmpty",
21075
+ value: function isEmpty() {
21076
+ return !this.root;
21077
+ }
21078
+ },
21079
+ {
21080
+ key: "add",
21081
+ value: function add(value2) {
21082
+ var node = {
21083
+ value: value2,
21084
+ left: null,
21085
+ right: null
21086
+ };
21087
+ var current;
21088
+ if (this.isEmpty()) {
21089
+ this.root = node;
21090
+ } else {
21091
+ current = this.root;
21092
+ while(true){
21093
+ if (value2 < current.value) {
21094
+ if (current.left === null) {
21095
+ current.left = node;
21096
+ break;
21097
+ } else {
21098
+ current = current.left;
21099
+ }
21100
+ } else if (value2 > current.value) {
21101
+ if (current.right === null) {
21102
+ current.right = node;
21103
+ break;
21104
+ } else {
21105
+ current = current.right;
21106
+ }
21107
+ } else {
21108
+ break;
21109
+ }
21110
+ }
21111
+ }
21112
+ }
21113
+ },
21114
+ {
21115
+ /**
21116
+ * performs Morris in-order traversal
21117
+ * @return {number[]} sorted array
21118
+ */ key: "get",
21119
+ value: function get() {
21120
+ var retr = [];
21121
+ var current = this.root;
21122
+ while(current){
21123
+ if (!current.left) {
21124
+ retr.push(current.value);
21125
+ current = current.right;
21126
+ } else {
21127
+ var pre = current.left;
21128
+ while(pre.right && pre.right != current){
21129
+ pre = pre.right;
21130
+ }
21131
+ if (pre.right == current) {
21132
+ pre.right = null;
21133
+ retr.push(current.value);
21134
+ current = current.right;
21135
+ } else {
21136
+ pre.right = current;
21137
+ current = current.left;
21138
+ }
21139
+ }
21140
+ }
21141
+ return retr;
21142
+ }
21143
+ },
21144
+ {
21145
+ key: "contains",
21146
+ value: function contains(value2) {
21147
+ var retr = false;
21148
+ var current = this.root;
21149
+ while(current){
21150
+ if (current.value === value2) {
21151
+ retr = true;
21152
+ break;
21153
+ } else if (value2 > current.value) {
21154
+ current = current.right;
21155
+ } else if (value2 < current.value) {
21156
+ current = current.left;
21157
+ }
21158
+ }
21159
+ return retr;
21160
+ }
21161
+ },
21162
+ {
21163
+ key: "min",
21164
+ value: function min() {
21165
+ var current = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.root;
21166
+ var retr;
21167
+ while(current){
21168
+ if (current.left) {
21169
+ current = current.left;
21170
+ } else {
21171
+ retr = current.value;
21172
+ current = null;
21173
+ }
21174
+ }
21175
+ return retr;
21176
+ }
21177
+ },
21178
+ {
21179
+ key: "max",
21180
+ value: function max() {
21181
+ var current = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.root;
21182
+ var retr;
21183
+ while(current){
21184
+ if (current.right) {
21185
+ current = current.right;
21186
+ } else {
21187
+ retr = current.value;
21188
+ current = null;
21189
+ }
21190
+ }
21191
+ return retr;
21192
+ }
21193
+ },
21194
+ {
21195
+ key: "remove",
21196
+ value: function remove(value2) {
21197
+ var current = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.root;
21198
+ var parent = null;
21199
+ var parentSide = "left";
21200
+ while(current){
21201
+ if (value2 < current.value) {
21202
+ parent = current;
21203
+ current = current.left;
21204
+ parentSide = "left";
21205
+ } else if (value2 > current.value) {
21206
+ parent = current;
21207
+ current = current.right;
21208
+ parentSide = "right";
21209
+ } else {
21210
+ if (!current.left && !current.right) {
21211
+ if (parent) {
21212
+ parent[parentSide] = null;
21213
+ } else {
21214
+ this.root = null;
21215
+ }
21216
+ } else if (!current.left) {
21217
+ if (parent) {
21218
+ parent[parentSide] = current.right;
21219
+ } else {
21220
+ this.root = current.right;
21221
+ }
21222
+ } else if (!current.right) {
21223
+ if (parent) {
21224
+ parent[parentSide] = current.left;
21225
+ } else {
21226
+ this.root = current.left;
21227
+ }
21228
+ } else {
21229
+ var minVal = this.min(current.right);
21230
+ this.remove(minVal, current.right);
21231
+ current.value = minVal;
21232
+ }
21233
+ current = null;
21234
+ }
21235
+ }
21236
+ }
21237
+ }
21238
+ ], [
21239
+ {
21240
+ key: "build",
21241
+ value: /**
21242
+ * Build Binary Search Tree from the ordered number array.
21243
+ * The depth of the tree will be the `log2` of the array length.
21244
+ * @param {number[]} values number array in ascending order
21245
+ * @return {BinarySearchTree} Binary Search Tree
21246
+ */ function build(values) {
21247
+ if (!values || values.length === 0) {
21248
+ return null;
21249
+ } else if (values.length === 1) {
21250
+ var tree = new _BinarySearchTree();
21251
+ tree.add(values[0]);
21252
+ return tree;
21253
+ } else {
21254
+ var rootIndex = values.length >> 1;
21255
+ var tree1 = new _BinarySearchTree();
21256
+ tree1.add(values[rootIndex]);
21257
+ var root = tree1.getRoot();
21258
+ if (root) {
21259
+ if (rootIndex + 1 < values.length) {
21260
+ var rightTree = _BinarySearchTree.build(values.slice(rootIndex + 1));
21261
+ root.right = rightTree ? rightTree.getRoot() : null;
21262
+ }
21263
+ if (rootIndex - 1 > 0) {
21264
+ var leftTree = _BinarySearchTree.build(values.slice(0, rootIndex - 1));
21265
+ root.left = leftTree ? leftTree.getRoot() : null;
21266
+ }
21267
+ }
21268
+ return tree1;
21269
+ }
21270
+ }
21271
+ }
21272
+ ]);
21273
+ return _BinarySearchTree;
21274
+ }(Cloneable);
21275
+ // node_modules/@iabtcf/core/lib/mjs/model/ConsentLanguages.js
21276
+ var _ConsentLanguages = /*#__PURE__*/ function() {
21277
+ "use strict";
21278
+ function _ConsentLanguages() {
21279
+ _class_call_check(this, _ConsentLanguages);
21280
+ }
21281
+ _create_class(_ConsentLanguages, [
21282
+ {
21283
+ key: "has",
21284
+ value: function has(key) {
21285
+ return _ConsentLanguages.langSet.has(key);
21286
+ }
21287
+ },
21288
+ {
21289
+ key: "forEach",
21290
+ value: function forEach(callback) {
21291
+ _ConsentLanguages.langSet.forEach(callback);
21292
+ }
21293
+ },
21294
+ {
21295
+ key: "size",
21296
+ get: function get() {
21297
+ return _ConsentLanguages.langSet.size;
21298
+ }
21299
+ }
21300
+ ]);
21301
+ return _ConsentLanguages;
21302
+ }();
21303
+ __publicField(_ConsentLanguages, "langSet", /* @__PURE__ */ new Set([
21304
+ "BG",
21305
+ "CA",
21306
+ "CS",
21307
+ "DA",
21308
+ "DE",
21309
+ "EL",
21310
+ "EN",
21311
+ "ES",
21312
+ "ET",
21313
+ "FI",
21314
+ "FR",
21315
+ "HR",
21316
+ "HU",
21317
+ "IT",
21318
+ "JA",
21319
+ "LT",
21320
+ "LV",
21321
+ "MT",
21322
+ "NL",
21323
+ "NO",
21324
+ "PL",
21325
+ "PT",
21326
+ "RO",
21327
+ "RU",
21328
+ "SK",
21329
+ "SL",
21330
+ "SV",
21331
+ "TR",
21332
+ "ZH"
21333
+ ]));
21334
+ var ConsentLanguages = _ConsentLanguages;
21335
+ // node_modules/@iabtcf/core/lib/mjs/model/Fields.js
21336
+ var Fields = function Fields() {
21337
+ "use strict";
21338
+ _class_call_check(this, Fields);
21339
+ };
21340
+ __publicField(Fields, "cmpId", "cmpId");
21341
+ __publicField(Fields, "cmpVersion", "cmpVersion");
21342
+ __publicField(Fields, "consentLanguage", "consentLanguage");
21343
+ __publicField(Fields, "consentScreen", "consentScreen");
21344
+ __publicField(Fields, "created", "created");
21345
+ __publicField(Fields, "supportOOB", "supportOOB");
21346
+ __publicField(Fields, "isServiceSpecific", "isServiceSpecific");
21347
+ __publicField(Fields, "lastUpdated", "lastUpdated");
21348
+ __publicField(Fields, "numCustomPurposes", "numCustomPurposes");
21349
+ __publicField(Fields, "policyVersion", "policyVersion");
21350
+ __publicField(Fields, "publisherCountryCode", "publisherCountryCode");
21351
+ __publicField(Fields, "publisherCustomConsents", "publisherCustomConsents");
21352
+ __publicField(Fields, "publisherCustomLegitimateInterests", "publisherCustomLegitimateInterests");
21353
+ __publicField(Fields, "publisherLegitimateInterests", "publisherLegitimateInterests");
21354
+ __publicField(Fields, "publisherConsents", "publisherConsents");
21355
+ __publicField(Fields, "publisherRestrictions", "publisherRestrictions");
21356
+ __publicField(Fields, "purposeConsents", "purposeConsents");
21357
+ __publicField(Fields, "purposeLegitimateInterests", "purposeLegitimateInterests");
21358
+ __publicField(Fields, "purposeOneTreatment", "purposeOneTreatment");
21359
+ __publicField(Fields, "specialFeatureOptins", "specialFeatureOptins");
21360
+ __publicField(Fields, "useNonStandardStacks", "useNonStandardStacks");
21361
+ __publicField(Fields, "vendorConsents", "vendorConsents");
21362
+ __publicField(Fields, "vendorLegitimateInterests", "vendorLegitimateInterests");
21363
+ __publicField(Fields, "vendorListVersion", "vendorListVersion");
21364
+ __publicField(Fields, "vendorsAllowed", "vendorsAllowed");
21365
+ __publicField(Fields, "vendorsDisclosed", "vendorsDisclosed");
21366
+ __publicField(Fields, "version", "version");
21367
+ // node_modules/@iabtcf/core/lib/mjs/model/RestrictionType.js
21368
+ var RestrictionType;
21369
+ (function(RestrictionType2) {
21370
+ RestrictionType2[RestrictionType2["NOT_ALLOWED"] = 0] = "NOT_ALLOWED";
21371
+ RestrictionType2[RestrictionType2["REQUIRE_CONSENT"] = 1] = "REQUIRE_CONSENT";
21372
+ RestrictionType2[RestrictionType2["REQUIRE_LI"] = 2] = "REQUIRE_LI";
21373
+ })(RestrictionType || (RestrictionType = {}));
21374
+ // node_modules/@iabtcf/core/lib/mjs/model/PurposeRestriction.js
21375
+ var _PurposeRestriction = /*#__PURE__*/ function(Cloneable) {
21376
+ "use strict";
21377
+ _inherits(_PurposeRestriction, Cloneable);
21378
+ var _super = _create_super(_PurposeRestriction);
21379
+ function _PurposeRestriction(purposeId, restrictionType) {
21380
+ _class_call_check(this, _PurposeRestriction);
21381
+ var _this;
21382
+ _this = _super.call(this);
21383
+ __publicField(_assert_this_initialized(_this), "purposeId_");
21384
+ __publicField(_assert_this_initialized(_this), "restrictionType");
21385
+ if (purposeId !== void 0) {
21386
+ _this.purposeId = purposeId;
21387
+ }
21388
+ if (restrictionType !== void 0) {
21389
+ _this.restrictionType = restrictionType;
21390
+ }
21391
+ return _this;
21392
+ }
21393
+ _create_class(_PurposeRestriction, [
21394
+ {
21395
+ key: "hash",
21396
+ get: function get() {
21397
+ if (!this.isValid()) {
21398
+ throw new Error("cannot hash invalid PurposeRestriction");
21399
+ }
21400
+ return "".concat(this.purposeId).concat(_PurposeRestriction.hashSeparator).concat(this.restrictionType);
21401
+ }
21402
+ },
21403
+ {
21404
+ key: "purposeId",
21405
+ get: /**
21406
+ * @return {number} The purpose Id associated with a publisher
21407
+ * purpose-by-vendor restriction that resulted in a different consent or LI
21408
+ * status than the consent or LI purposes allowed lists.
21409
+ */ function get() {
21410
+ return this.purposeId_;
21411
+ },
21412
+ set: /**
21413
+ * @param {number} idNum - The purpose Id associated with a publisher
21414
+ * purpose-by-vendor restriction that resulted in a different consent or LI
21415
+ * status than the consent or LI purposes allowed lists.
21416
+ */ function set(idNum) {
21417
+ this.purposeId_ = idNum;
21418
+ }
21419
+ },
21420
+ {
21421
+ key: "isValid",
21422
+ value: function isValid() {
21423
+ return Number.isInteger(this.purposeId) && this.purposeId > 0 && (this.restrictionType === RestrictionType.NOT_ALLOWED || this.restrictionType === RestrictionType.REQUIRE_CONSENT || this.restrictionType === RestrictionType.REQUIRE_LI);
21424
+ }
21425
+ },
21426
+ {
21427
+ key: "isSameAs",
21428
+ value: function isSameAs(otherPR) {
21429
+ return this.purposeId === otherPR.purposeId && this.restrictionType === otherPR.restrictionType;
21430
+ }
21431
+ }
21432
+ ], [
21433
+ {
21434
+ key: "unHash",
21435
+ value: function unHash(hash) {
21436
+ var splitUp = hash.split(this.hashSeparator);
21437
+ var purpRestriction = new _PurposeRestriction();
21438
+ if (splitUp.length !== 2) {
21439
+ throw new TCModelError("hash", hash);
21440
+ }
21441
+ purpRestriction.purposeId = parseInt(splitUp[0], 10);
21442
+ purpRestriction.restrictionType = parseInt(splitUp[1], 10);
21443
+ return purpRestriction;
21444
+ }
21445
+ }
21446
+ ]);
21447
+ return _PurposeRestriction;
21448
+ }(Cloneable);
21449
+ __publicField(_PurposeRestriction, "hashSeparator", "-");
21450
+ var PurposeRestriction = _PurposeRestriction;
21451
+ // node_modules/@iabtcf/core/lib/mjs/model/PurposeRestrictionVector.js
21452
+ var PurposeRestrictionVector = /*#__PURE__*/ function(Cloneable) {
21453
+ "use strict";
21454
+ _inherits(PurposeRestrictionVector, Cloneable);
21455
+ var _super = _create_super(PurposeRestrictionVector);
21456
+ function PurposeRestrictionVector() {
21457
+ _class_call_check(this, PurposeRestrictionVector);
21458
+ var _this;
21459
+ _this = _super.call.apply(_super, [
21460
+ this
21461
+ ].concat(Array.prototype.slice.call(arguments)));
21462
+ /**
21463
+ * if this originatd from an encoded string we'll need a place to store the
21464
+ * bit length; it can be set and got from here
21465
+ */ __publicField(_assert_this_initialized(_this), "bitLength", 0);
21466
+ /**
21467
+ * a map indexed by a string which will be a 'hash' of the purpose and
21468
+ * restriction type.
21469
+ *
21470
+ * Using a BST to keep vendors in a sorted order for encoding later
21471
+ */ __publicField(_assert_this_initialized(_this), "map", /* @__PURE__ */ new Map());
21472
+ __publicField(_assert_this_initialized(_this), "gvl_");
21473
+ return _this;
21474
+ }
21475
+ _create_class(PurposeRestrictionVector, [
21476
+ {
21477
+ key: "has",
21478
+ value: function has(hash) {
21479
+ return this.map.has(hash);
21480
+ }
21481
+ },
21482
+ {
21483
+ key: "isOkToHave",
21484
+ value: function isOkToHave(restrictionType, purposeId, vendorId) {
21485
+ var _this_gvl;
21486
+ var result = true;
21487
+ if ((_this_gvl = this.gvl) === null || _this_gvl === void 0 ? void 0 : _this_gvl.vendors) {
21488
+ var vendor = this.gvl.vendors[vendorId];
21489
+ if (vendor) {
21490
+ if (restrictionType === RestrictionType.NOT_ALLOWED) {
21491
+ result = vendor.legIntPurposes.includes(purposeId) || vendor.purposes.includes(purposeId);
21492
+ } else if (vendor.flexiblePurposes.length) {
21493
+ switch(restrictionType){
21494
+ case RestrictionType.REQUIRE_CONSENT:
21495
+ result = vendor.flexiblePurposes.includes(purposeId) && vendor.legIntPurposes.includes(purposeId);
21496
+ break;
21497
+ case RestrictionType.REQUIRE_LI:
21498
+ result = vendor.flexiblePurposes.includes(purposeId) && vendor.purposes.includes(purposeId);
21499
+ break;
21500
+ }
21501
+ } else {
21502
+ result = false;
21503
+ }
21504
+ } else {
21505
+ result = false;
21506
+ }
21507
+ }
21508
+ return result;
21509
+ }
21510
+ },
21511
+ {
21512
+ /**
21513
+ * add - adds a given Vendor ID under a given Purpose Restriction
21514
+ *
21515
+ * @param {number} vendorId
21516
+ * @param {PurposeRestriction} purposeRestriction
21517
+ * @return {void}
21518
+ */ key: "add",
21519
+ value: function add(vendorId, purposeRestriction) {
21520
+ if (this.isOkToHave(purposeRestriction.restrictionType, purposeRestriction.purposeId, vendorId)) {
21521
+ var hash = purposeRestriction.hash;
21522
+ if (!this.has(hash)) {
21523
+ this.map.set(hash, new BinarySearchTree());
21524
+ this.bitLength = 0;
21525
+ }
21526
+ this.map.get(hash).add(vendorId);
21527
+ }
21528
+ }
21529
+ },
21530
+ {
21531
+ /**
21532
+ * restrictPurposeToLegalBasis - adds all Vendors under a given Purpose Restriction
21533
+ *
21534
+ * @param {PurposeRestriction} purposeRestriction
21535
+ * @return {void}
21536
+ */ key: "restrictPurposeToLegalBasis",
21537
+ value: function restrictPurposeToLegalBasis(purposeRestriction) {
21538
+ var vendors = this.gvl.vendorIds;
21539
+ var hash = purposeRestriction.hash;
21540
+ var lastEntry = function() {
21541
+ var value2;
21542
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
21543
+ try {
21544
+ for(var _iterator = vendors[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
21545
+ value2 = _step.value;
21546
+ ;
21547
+ }
21548
+ } catch (err) {
21549
+ _didIteratorError = true;
21550
+ _iteratorError = err;
21551
+ } finally{
21552
+ try {
21553
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
21554
+ _iterator.return();
21555
+ }
21556
+ } finally{
21557
+ if (_didIteratorError) {
21558
+ throw _iteratorError;
21559
+ }
21560
+ }
21561
+ }
21562
+ return value2;
21563
+ }();
21564
+ var values = _to_consumable_array(Array(lastEntry).keys()).map(function(i2) {
21565
+ return i2 + 1;
21566
+ });
21567
+ for(var i2 = 1; i2 <= lastEntry; i2++){
21568
+ if (!this.has(hash)) {
21569
+ this.map.set(hash, BinarySearchTree.build(values));
21570
+ this.bitLength = 0;
21571
+ }
21572
+ this.map.get(hash).add(i2);
21573
+ }
21574
+ }
21575
+ },
21576
+ {
21577
+ /**
21578
+ * getVendors - returns array of vendor ids optionally narrowed by a given
21579
+ * Purpose Restriction. If no purpose restriction is passed then all vendor
21580
+ * ids will be returned. One can expect this result to be a unique set of
21581
+ * ids no duplicates.
21582
+ *
21583
+ * @param {PurposeRestriction} [purposeRestriction] - optionally passed to
21584
+ * get only Vendor IDs restricted under the given Purpose Restriction
21585
+ * @return {number[]} - Unique ID set of vendors
21586
+ */ key: "getVendors",
21587
+ value: function getVendors(purposeRestriction) {
21588
+ var vendorIds = [];
21589
+ if (purposeRestriction) {
21590
+ var hash = purposeRestriction.hash;
21591
+ if (this.has(hash)) {
21592
+ vendorIds = this.map.get(hash).get();
21593
+ }
21594
+ } else {
21595
+ var vendorSet = /* @__PURE__ */ new Set();
21596
+ this.map.forEach(function(bst) {
21597
+ bst.get().forEach(function(vendorId) {
21598
+ vendorSet.add(vendorId);
21599
+ });
21600
+ });
21601
+ vendorIds = Array.from(vendorSet);
21602
+ }
21603
+ return vendorIds;
21604
+ }
21605
+ },
21606
+ {
21607
+ key: "getRestrictionType",
21608
+ value: function getRestrictionType(vendorId, purposeId) {
21609
+ var rType;
21610
+ this.getRestrictions(vendorId).forEach(function(purposeRestriction) {
21611
+ if (purposeRestriction.purposeId === purposeId) {
21612
+ if (rType === void 0 || rType > purposeRestriction.restrictionType) {
21613
+ rType = purposeRestriction.restrictionType;
21614
+ }
21615
+ }
21616
+ });
21617
+ return rType;
21618
+ }
21619
+ },
21620
+ {
21621
+ /**
21622
+ * vendorHasRestriction - determines whether a given Vendor ID is under a
21623
+ * given Purpose Restriction
21624
+ *
21625
+ * @param {number} vendorId
21626
+ * @param {PurposeRestriction} purposeRestriction
21627
+ * @return {boolean} - true if the give Vendor ID is under the given Purpose
21628
+ * Restriction
21629
+ */ key: "vendorHasRestriction",
21630
+ value: function vendorHasRestriction(vendorId, purposeRestriction) {
21631
+ var has = false;
21632
+ var restrictions = this.getRestrictions(vendorId);
21633
+ for(var i2 = 0; i2 < restrictions.length && !has; i2++){
21634
+ has = purposeRestriction.isSameAs(restrictions[i2]);
21635
+ }
21636
+ return has;
21637
+ }
21638
+ },
21639
+ {
21640
+ /**
21641
+ * getMaxVendorId - gets the Maximum Vendor ID regardless of Purpose
21642
+ * Restriction
21643
+ *
21644
+ * @return {number} - maximum Vendor ID
21645
+ */ key: "getMaxVendorId",
21646
+ value: function getMaxVendorId() {
21647
+ var retr = 0;
21648
+ this.map.forEach(function(bst) {
21649
+ retr = Math.max(bst.max(), retr);
21650
+ });
21651
+ return retr;
21652
+ }
21653
+ },
21654
+ {
21655
+ key: "getRestrictions",
21656
+ value: function getRestrictions(vendorId) {
21657
+ var retr = [];
21658
+ this.map.forEach(function(bst, hash) {
21659
+ if (vendorId) {
21660
+ if (bst.contains(vendorId)) {
21661
+ retr.push(PurposeRestriction.unHash(hash));
21662
+ }
21663
+ } else {
21664
+ retr.push(PurposeRestriction.unHash(hash));
21665
+ }
21666
+ });
21667
+ return retr;
21668
+ }
21669
+ },
21670
+ {
21671
+ key: "getPurposes",
21672
+ value: function getPurposes() {
21673
+ var purposeIds = /* @__PURE__ */ new Set();
21674
+ this.map.forEach(function(bst, hash) {
21675
+ purposeIds.add(PurposeRestriction.unHash(hash).purposeId);
21676
+ });
21677
+ return Array.from(purposeIds);
21678
+ }
21679
+ },
21680
+ {
21681
+ /**
21682
+ * remove - removes Vendor ID from a Purpose Restriction
21683
+ *
21684
+ * @param {number} vendorId
21685
+ * @param {PurposeRestriction} purposeRestriction
21686
+ * @return {void}
21687
+ */ key: "remove",
21688
+ value: function remove(vendorId, purposeRestriction) {
21689
+ var hash = purposeRestriction.hash;
21690
+ var bst = this.map.get(hash);
21691
+ if (bst) {
21692
+ bst.remove(vendorId);
21693
+ if (bst.isEmpty()) {
21694
+ this.map.delete(hash);
21695
+ this.bitLength = 0;
21696
+ }
21697
+ }
21698
+ }
21699
+ },
21700
+ {
21701
+ key: "gvl",
21702
+ get: /**
21703
+ * gvl returns local copy of the GVL these restrictions apply to
21704
+ *
21705
+ * @return {GVL}
21706
+ */ function get() {
21707
+ return this.gvl_;
21708
+ },
21709
+ set: /**
21710
+ * Essential for being able to determine whether we can actually set a
21711
+ * purpose restriction since they have to have a flexible legal basis
21712
+ *
21713
+ * @param {GVL} value - the GVL instance
21714
+ */ function set(value2) {
21715
+ var _this = this;
21716
+ if (!this.gvl_) {
21717
+ this.gvl_ = value2;
21718
+ this.map.forEach(function(bst, hash) {
21719
+ var purposeRestriction = PurposeRestriction.unHash(hash);
21720
+ var vendors = bst.get();
21721
+ vendors.forEach(function(vendorId) {
21722
+ if (!_this.isOkToHave(purposeRestriction.restrictionType, purposeRestriction.purposeId, vendorId)) {
21723
+ bst.remove(vendorId);
21724
+ }
21725
+ });
21726
+ });
21727
+ }
21728
+ }
21729
+ },
21730
+ {
21731
+ /**
21732
+ * isEmpty - whether or not this vector has any restrictions in it
21733
+ *
21734
+ * @return {boolean}
21735
+ */ key: "isEmpty",
21736
+ value: function isEmpty() {
21737
+ return this.map.size === 0;
21738
+ }
21739
+ },
21740
+ {
21741
+ key: "numRestrictions",
21742
+ get: /**
21743
+ * numRestrictions - returns the number of Purpose Restrictions.
21744
+ *
21745
+ * @return {number}
21746
+ */ function get() {
21747
+ return this.map.size;
21748
+ }
21749
+ }
21750
+ ]);
21751
+ return PurposeRestrictionVector;
21752
+ }(Cloneable);
21753
+ // node_modules/@iabtcf/core/lib/mjs/model/DeviceDisclosureStorageAccessType.js
21754
+ var DeviceDisclosureStorageAccessType;
21755
+ (function(DeviceDisclosureStorageAccessType2) {
21756
+ DeviceDisclosureStorageAccessType2["COOKIE"] = "cookie";
21757
+ DeviceDisclosureStorageAccessType2["WEB"] = "web";
21758
+ DeviceDisclosureStorageAccessType2["APP"] = "app";
21759
+ })(DeviceDisclosureStorageAccessType || (DeviceDisclosureStorageAccessType = {}));
21760
+ // node_modules/@iabtcf/core/lib/mjs/model/Segment.js
21761
+ var Segment;
21762
+ (function(Segment2) {
21763
+ Segment2["CORE"] = "core";
21764
+ Segment2["VENDORS_DISCLOSED"] = "vendorsDisclosed";
21765
+ Segment2["VENDORS_ALLOWED"] = "vendorsAllowed";
21766
+ Segment2["PUBLISHER_TC"] = "publisherTC";
21767
+ })(Segment || (Segment = {}));
21768
+ // node_modules/@iabtcf/core/lib/mjs/model/SegmentIDs.js
21769
+ var SegmentIDs = function SegmentIDs() {
21770
+ "use strict";
21771
+ _class_call_check(this, SegmentIDs);
21772
+ };
21773
+ /**
21774
+ * 0 = default - reserved for core string (does not need to be present in the core string)
21775
+ * 1 = OOB vendors disclosed
21776
+ * 2 = OOB vendors allowed
21777
+ * 3 = PublisherTC
21778
+ */ __publicField(SegmentIDs, "ID_TO_KEY", [
21779
+ Segment.CORE,
21780
+ Segment.VENDORS_DISCLOSED,
21781
+ Segment.VENDORS_ALLOWED,
21782
+ Segment.PUBLISHER_TC
21783
+ ]);
21784
+ var _obj;
21785
+ __publicField(SegmentIDs, "KEY_TO_ID", (_obj = {}, _define_property(_obj, Segment.CORE, 0), _define_property(_obj, Segment.VENDORS_DISCLOSED, 1), _define_property(_obj, Segment.VENDORS_ALLOWED, 2), _define_property(_obj, Segment.PUBLISHER_TC, 3), _obj));
21786
+ // node_modules/@iabtcf/core/lib/mjs/model/Vector.js
21787
+ var Vector = /*#__PURE__*/ function(Cloneable) {
21788
+ "use strict";
21789
+ _inherits(Vector, Cloneable);
21790
+ var _super = _create_super(Vector);
21791
+ function Vector() {
21792
+ _class_call_check(this, Vector);
21793
+ var _this;
21794
+ _this = _super.call.apply(_super, [
21795
+ this
21796
+ ].concat(Array.prototype.slice.call(arguments)));
21797
+ /**
21798
+ * if this originatd from an encoded string we'll need a place to store the
21799
+ * bit length; it can be set and got from here
21800
+ */ __publicField(_assert_this_initialized(_this), "bitLength", 0);
21801
+ __publicField(_assert_this_initialized(_this), "maxId_", 0);
21802
+ __publicField(_assert_this_initialized(_this), "set_", /* @__PURE__ */ new Set());
21803
+ return _this;
21804
+ }
21805
+ _create_class(Vector, [
21806
+ {
21807
+ key: Symbol.iterator,
21808
+ value: function value() {
21809
+ var i2;
21810
+ return _ts_generator(this, function(_state) {
21811
+ switch(_state.label){
21812
+ case 0:
21813
+ i2 = 1;
21814
+ _state.label = 1;
21815
+ case 1:
21816
+ if (!(i2 <= this.maxId)) return [
21817
+ 3,
21818
+ 4
21819
+ ];
21820
+ return [
21821
+ 4,
21822
+ [
21823
+ i2,
21824
+ this.has(i2)
21825
+ ]
21826
+ ];
21827
+ case 2:
21828
+ _state.sent();
21829
+ _state.label = 3;
21830
+ case 3:
21831
+ i2++;
21832
+ return [
21833
+ 3,
21834
+ 1
21835
+ ];
21836
+ case 4:
21837
+ return [
21838
+ 2
21839
+ ];
21840
+ }
21841
+ });
21842
+ }
21843
+ },
21844
+ {
21845
+ /**
21846
+ * values()
21847
+ *
21848
+ * @return {IterableIterator<number>} - returns an iterator of the positive
21849
+ * values in the set
21850
+ */ key: "values",
21851
+ value: function values() {
21852
+ return this.set_.values();
21853
+ }
21854
+ },
21855
+ {
21856
+ key: "maxId",
21857
+ get: /**
21858
+ * maxId
21859
+ *
21860
+ * @return {number} - the highest id in this Vector
21861
+ */ function get() {
21862
+ return this.maxId_;
21863
+ }
21864
+ },
21865
+ {
21866
+ /**
21867
+ * get
21868
+ *
21869
+ * @param {number} id - key for value to check
21870
+ * @return {boolean} - value of that key, if never set it will be false
21871
+ */ key: "has",
21872
+ value: function has(id) {
21873
+ return this.set_.has(id);
21874
+ }
21875
+ },
21876
+ {
21877
+ /**
21878
+ * unset
21879
+ *
21880
+ * @param {SingleIDOrCollection} id - id or ids to unset
21881
+ * @return {void}
21882
+ */ key: "unset",
21883
+ value: function unset(id) {
21884
+ var _this = this;
21885
+ if (Array.isArray(id)) {
21886
+ id.forEach(function(id2) {
21887
+ return _this.unset(id2);
21888
+ });
21889
+ } else if (typeof id === "object") {
21890
+ this.unset(Object.keys(id).map(function(strId) {
21891
+ return Number(strId);
21892
+ }));
21893
+ } else {
21894
+ this.set_.delete(Number(id));
21895
+ this.bitLength = 0;
21896
+ if (id === this.maxId) {
21897
+ this.maxId_ = 0;
21898
+ this.set_.forEach(function(id2) {
21899
+ _this.maxId_ = Math.max(_this.maxId, id2);
21900
+ });
21901
+ }
21902
+ }
21903
+ }
21904
+ },
21905
+ {
21906
+ key: "isIntMap",
21907
+ value: function isIntMap(item) {
21908
+ var _this = this;
21909
+ var result = typeof item === "object";
21910
+ result = result && Object.keys(item).every(function(key) {
21911
+ var itemResult = Number.isInteger(parseInt(key, 10));
21912
+ itemResult = itemResult && _this.isValidNumber(item[key].id);
21913
+ itemResult = itemResult && item[key].name !== void 0;
21914
+ return itemResult;
21915
+ });
21916
+ return result;
21917
+ }
21918
+ },
21919
+ {
21920
+ key: "isValidNumber",
21921
+ value: function isValidNumber(item) {
21922
+ return parseInt(item, 10) > 0;
21923
+ }
21924
+ },
21925
+ {
21926
+ key: "isSet",
21927
+ value: function isSet(item) {
21928
+ var result = false;
21929
+ if (_instanceof(item, Set)) {
21930
+ result = Array.from(item).every(this.isValidNumber);
21931
+ }
21932
+ return result;
21933
+ }
21934
+ },
21935
+ {
21936
+ /**
21937
+ * set - sets an item assumed to be a truthy value by its presence
21938
+ *
21939
+ * @param {SingleIDOrCollection} item - May be a single id (positive integer)
21940
+ * or collection of ids in a set, GVL Int Map, or Array.
21941
+ *
21942
+ * @return {void}
21943
+ */ key: "set",
21944
+ value: function set(item) {
21945
+ var _this = this;
21946
+ if (Array.isArray(item)) {
21947
+ item.forEach(function(item2) {
21948
+ return _this.set(item2);
21949
+ });
21950
+ } else if (this.isSet(item)) {
21951
+ this.set(Array.from(item));
21952
+ } else if (this.isIntMap(item)) {
21953
+ this.set(Object.keys(item).map(function(strId) {
21954
+ return Number(strId);
21955
+ }));
21956
+ } else if (this.isValidNumber(item)) {
21957
+ this.set_.add(item);
21958
+ this.maxId_ = Math.max(this.maxId, item);
21959
+ this.bitLength = 0;
21960
+ } else {
21961
+ throw new TCModelError("set()", item, "must be positive integer array, positive integer, Set<number>, or IntMap");
21962
+ }
21963
+ }
21964
+ },
21965
+ {
21966
+ key: "empty",
21967
+ value: function empty() {
21968
+ this.set_ = /* @__PURE__ */ new Set();
21969
+ }
21970
+ },
21971
+ {
21972
+ /**
21973
+ * forEach - to traverse from id=1 to id=maxId in a sequential non-sparse manner
21974
+ *
21975
+ *
21976
+ * @param {forEachCallback} callback - callback to execute
21977
+ * @return {void}
21978
+ *
21979
+ * @callback forEachCallback
21980
+ * @param {boolean} value - whether or not this id exists in the vector
21981
+ * @param {number} id - the id number of the current iteration
21982
+ */ key: "forEach",
21983
+ value: function forEach(callback) {
21984
+ for(var i2 = 1; i2 <= this.maxId; i2++){
21985
+ callback(this.has(i2), i2);
21986
+ }
21987
+ }
21988
+ },
21989
+ {
21990
+ key: "size",
21991
+ get: function get() {
21992
+ return this.set_.size;
21993
+ }
21994
+ },
21995
+ {
21996
+ key: "setAll",
21997
+ value: function setAll(intMap) {
21998
+ this.set(intMap);
21999
+ }
22000
+ }
22001
+ ]);
22002
+ return Vector;
22003
+ }(Cloneable);
22004
+ // node_modules/@iabtcf/core/lib/mjs/encoder/BitLength.js
22005
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
22006
+ var BitLength = function BitLength() {
22007
+ "use strict";
22008
+ _class_call_check(this, BitLength);
22009
+ };
22010
+ _a = Fields.cmpId, _b = Fields.cmpVersion, _c = Fields.consentLanguage, _d = Fields.consentScreen, _e = Fields.created, _f = Fields.isServiceSpecific, _g = Fields.lastUpdated, _h = Fields.policyVersion, _i = Fields.publisherCountryCode, _j = Fields.publisherLegitimateInterests, _k = Fields.publisherConsents, _l = Fields.purposeConsents, _m = Fields.purposeLegitimateInterests, _n = Fields.purposeOneTreatment, _o = Fields.specialFeatureOptins, _p = Fields.useNonStandardStacks, _q = Fields.vendorListVersion, _r = Fields.version;
22011
+ __publicField(BitLength, _a, 12);
22012
+ __publicField(BitLength, _b, 12);
22013
+ __publicField(BitLength, _c, 12);
22014
+ __publicField(BitLength, _d, 6);
22015
+ __publicField(BitLength, _e, 36);
22016
+ __publicField(BitLength, _f, 1);
22017
+ __publicField(BitLength, _g, 36);
22018
+ __publicField(BitLength, _h, 6);
22019
+ __publicField(BitLength, _i, 12);
22020
+ __publicField(BitLength, _j, 24);
22021
+ __publicField(BitLength, _k, 24);
22022
+ __publicField(BitLength, _l, 24);
22023
+ __publicField(BitLength, _m, 24);
22024
+ __publicField(BitLength, _n, 1);
22025
+ __publicField(BitLength, _o, 12);
22026
+ __publicField(BitLength, _p, 1);
22027
+ __publicField(BitLength, _q, 12);
22028
+ __publicField(BitLength, _r, 6);
22029
+ __publicField(BitLength, "anyBoolean", 1);
22030
+ __publicField(BitLength, "encodingType", 1);
22031
+ __publicField(BitLength, "maxId", 16);
22032
+ __publicField(BitLength, "numCustomPurposes", 6);
22033
+ __publicField(BitLength, "numEntries", 12);
22034
+ __publicField(BitLength, "numRestrictions", 12);
22035
+ __publicField(BitLength, "purposeId", 6);
22036
+ __publicField(BitLength, "restrictionType", 2);
22037
+ __publicField(BitLength, "segmentType", 3);
22038
+ __publicField(BitLength, "singleOrRange", 1);
22039
+ __publicField(BitLength, "vendorId", 16);
22040
+ // node_modules/@iabtcf/core/lib/mjs/encoder/field/BooleanEncoder.js
22041
+ var BooleanEncoder = /*#__PURE__*/ function() {
22042
+ "use strict";
22043
+ function BooleanEncoder() {
22044
+ _class_call_check(this, BooleanEncoder);
22045
+ }
22046
+ _create_class(BooleanEncoder, null, [
22047
+ {
22048
+ key: "encode",
22049
+ value: function encode(value2) {
22050
+ return String(Number(value2));
22051
+ }
22052
+ },
22053
+ {
22054
+ key: "decode",
22055
+ value: function decode(value2) {
22056
+ return value2 === "1";
22057
+ }
22058
+ }
22059
+ ]);
22060
+ return BooleanEncoder;
22061
+ }();
22062
+ // node_modules/@iabtcf/core/lib/mjs/encoder/field/IntEncoder.js
22063
+ var IntEncoder = /*#__PURE__*/ function() {
22064
+ "use strict";
22065
+ function IntEncoder() {
22066
+ _class_call_check(this, IntEncoder);
22067
+ }
22068
+ _create_class(IntEncoder, null, [
22069
+ {
22070
+ key: "encode",
22071
+ value: function encode(value2, numBits) {
22072
+ var bitString;
22073
+ if (typeof value2 === "string") {
22074
+ value2 = parseInt(value2, 10);
22075
+ }
22076
+ bitString = value2.toString(2);
22077
+ if (bitString.length > numBits || value2 < 0) {
22078
+ throw new EncodingError("".concat(value2, " too large to encode into ").concat(numBits));
22079
+ }
22080
+ if (bitString.length < numBits) {
22081
+ bitString = "0".repeat(numBits - bitString.length) + bitString;
22082
+ }
22083
+ return bitString;
22084
+ }
22085
+ },
22086
+ {
22087
+ key: "decode",
22088
+ value: function decode(value2, numBits) {
22089
+ if (numBits !== value2.length) {
22090
+ throw new DecodingError("invalid bit length");
22091
+ }
22092
+ return parseInt(value2, 2);
22093
+ }
22094
+ }
22095
+ ]);
22096
+ return IntEncoder;
22097
+ }();
22098
+ // node_modules/@iabtcf/core/lib/mjs/encoder/field/DateEncoder.js
22099
+ var DateEncoder = /*#__PURE__*/ function() {
22100
+ "use strict";
22101
+ function DateEncoder() {
22102
+ _class_call_check(this, DateEncoder);
22103
+ }
22104
+ _create_class(DateEncoder, null, [
22105
+ {
22106
+ key: "encode",
22107
+ value: function encode(value2, numBits) {
22108
+ return IntEncoder.encode(Math.round(value2.getTime() / 100), numBits);
22109
+ }
22110
+ },
22111
+ {
22112
+ key: "decode",
22113
+ value: function decode(value2, numBits) {
22114
+ if (numBits !== value2.length) {
22115
+ throw new DecodingError("invalid bit length");
22116
+ }
22117
+ var date = /* @__PURE__ */ new Date();
22118
+ date.setTime(IntEncoder.decode(value2, numBits) * 100);
22119
+ return date;
22120
+ }
22121
+ }
22122
+ ]);
22123
+ return DateEncoder;
22124
+ }();
22125
+ // node_modules/@iabtcf/core/lib/mjs/encoder/field/FixedVectorEncoder.js
22126
+ var FixedVectorEncoder = /*#__PURE__*/ function() {
22127
+ "use strict";
22128
+ function FixedVectorEncoder() {
22129
+ _class_call_check(this, FixedVectorEncoder);
22130
+ }
22131
+ _create_class(FixedVectorEncoder, null, [
22132
+ {
22133
+ key: "encode",
22134
+ value: function encode(value2, numBits) {
22135
+ var bitString = "";
22136
+ for(var i2 = 1; i2 <= numBits; i2++){
22137
+ bitString += BooleanEncoder.encode(value2.has(i2));
22138
+ }
22139
+ return bitString;
22140
+ }
22141
+ },
22142
+ {
22143
+ key: "decode",
22144
+ value: function decode(value2, numBits) {
22145
+ if (value2.length !== numBits) {
22146
+ throw new DecodingError("bitfield encoding length mismatch");
22147
+ }
22148
+ var vector = new Vector();
22149
+ for(var i2 = 1; i2 <= numBits; i2++){
22150
+ if (BooleanEncoder.decode(value2[i2 - 1])) {
22151
+ vector.set(i2);
22152
+ }
22153
+ }
22154
+ vector.bitLength = value2.length;
22155
+ return vector;
22156
+ }
22157
+ }
22158
+ ]);
22159
+ return FixedVectorEncoder;
22160
+ }();
22161
+ // node_modules/@iabtcf/core/lib/mjs/encoder/field/LangEncoder.js
22162
+ var LangEncoder = /*#__PURE__*/ function() {
22163
+ "use strict";
22164
+ function LangEncoder() {
22165
+ _class_call_check(this, LangEncoder);
22166
+ }
22167
+ _create_class(LangEncoder, null, [
22168
+ {
22169
+ key: "encode",
22170
+ value: function encode(value2, numBits) {
22171
+ value2 = value2.toUpperCase();
22172
+ var ASCII_START = 65;
22173
+ var firstLetter = value2.charCodeAt(0) - ASCII_START;
22174
+ var secondLetter = value2.charCodeAt(1) - ASCII_START;
22175
+ if (firstLetter < 0 || firstLetter > 25 || secondLetter < 0 || secondLetter > 25) {
22176
+ throw new EncodingError("invalid language code: ".concat(value2));
22177
+ }
22178
+ if (numBits % 2 === 1) {
22179
+ throw new EncodingError("numBits must be even, ".concat(numBits, " is not valid"));
22180
+ }
22181
+ numBits = numBits / 2;
22182
+ var firstLetterBString = IntEncoder.encode(firstLetter, numBits);
22183
+ var secondLetterBString = IntEncoder.encode(secondLetter, numBits);
22184
+ return firstLetterBString + secondLetterBString;
22185
+ }
22186
+ },
22187
+ {
22188
+ key: "decode",
22189
+ value: function decode(value2, numBits) {
22190
+ var retr;
22191
+ if (numBits === value2.length && !(value2.length % 2)) {
22192
+ var ASCII_START = 65;
22193
+ var mid = value2.length / 2;
22194
+ var firstLetter = IntEncoder.decode(value2.slice(0, mid), mid) + ASCII_START;
22195
+ var secondLetter = IntEncoder.decode(value2.slice(mid), mid) + ASCII_START;
22196
+ retr = String.fromCharCode(firstLetter) + String.fromCharCode(secondLetter);
22197
+ } else {
22198
+ throw new DecodingError("invalid bit length for language");
22199
+ }
22200
+ return retr;
22201
+ }
22202
+ }
22203
+ ]);
22204
+ return LangEncoder;
22205
+ }();
22206
+ // node_modules/@iabtcf/core/lib/mjs/encoder/field/PurposeRestrictionVectorEncoder.js
22207
+ var PurposeRestrictionVectorEncoder = /*#__PURE__*/ function() {
22208
+ "use strict";
22209
+ function PurposeRestrictionVectorEncoder() {
22210
+ _class_call_check(this, PurposeRestrictionVectorEncoder);
22211
+ }
22212
+ _create_class(PurposeRestrictionVectorEncoder, null, [
22213
+ {
22214
+ key: "encode",
22215
+ value: function encode(prVector) {
22216
+ var bitString = IntEncoder.encode(prVector.numRestrictions, BitLength.numRestrictions);
22217
+ if (!prVector.isEmpty()) {
22218
+ prVector.getRestrictions().forEach(function(purpRestriction) {
22219
+ var _loop = function(i2) {
22220
+ var vendorId = vendors[i2];
22221
+ if (startId === 0) {
22222
+ numEntries++;
22223
+ startId = vendorId;
22224
+ }
22225
+ var lastVendorId = vendors[len - 1];
22226
+ var gvlVendorIds = prVector.gvl.vendorIds;
22227
+ var nextGvlVendor = function(vendorId2) {
22228
+ while(++vendorId2 <= lastVendorId && !gvlVendorIds.has(vendorId2)){}
22229
+ return vendorId2;
22230
+ };
22231
+ if (i2 === len - 1 || vendors[i2 + 1] > nextGvlVendor(vendorId)) {
22232
+ var isRange = !(vendorId === startId);
22233
+ rangeField += BooleanEncoder.encode(isRange);
22234
+ rangeField += IntEncoder.encode(startId, BitLength.vendorId);
22235
+ if (isRange) {
22236
+ rangeField += IntEncoder.encode(vendorId, BitLength.vendorId);
22237
+ }
22238
+ startId = 0;
22239
+ }
22240
+ };
22241
+ bitString += IntEncoder.encode(purpRestriction.purposeId, BitLength.purposeId);
22242
+ bitString += IntEncoder.encode(purpRestriction.restrictionType, BitLength.restrictionType);
22243
+ var vendors = prVector.getVendors(purpRestriction);
22244
+ var len = vendors.length;
22245
+ var numEntries = 0;
22246
+ var startId = 0;
22247
+ var rangeField = "";
22248
+ for(var i2 = 0; i2 < len; i2++)_loop(i2);
22249
+ bitString += IntEncoder.encode(numEntries, BitLength.numEntries);
22250
+ bitString += rangeField;
22251
+ });
22252
+ }
22253
+ return bitString;
22254
+ }
22255
+ },
22256
+ {
22257
+ key: "decode",
22258
+ value: function decode(encodedString) {
22259
+ var index = 0;
22260
+ var vector = new PurposeRestrictionVector();
22261
+ var numRestrictions = IntEncoder.decode(encodedString.substr(index, BitLength.numRestrictions), BitLength.numRestrictions);
22262
+ index += BitLength.numRestrictions;
22263
+ for(var i2 = 0; i2 < numRestrictions; i2++){
22264
+ var purposeId = IntEncoder.decode(encodedString.substr(index, BitLength.purposeId), BitLength.purposeId);
22265
+ index += BitLength.purposeId;
22266
+ var restrictionType = IntEncoder.decode(encodedString.substr(index, BitLength.restrictionType), BitLength.restrictionType);
22267
+ index += BitLength.restrictionType;
22268
+ var purposeRestriction = new PurposeRestriction(purposeId, restrictionType);
22269
+ var numEntries = IntEncoder.decode(encodedString.substr(index, BitLength.numEntries), BitLength.numEntries);
22270
+ index += BitLength.numEntries;
22271
+ for(var j = 0; j < numEntries; j++){
22272
+ var isARange = BooleanEncoder.decode(encodedString.substr(index, BitLength.anyBoolean));
22273
+ index += BitLength.anyBoolean;
22274
+ var startOrOnlyVendorId = IntEncoder.decode(encodedString.substr(index, BitLength.vendorId), BitLength.vendorId);
22275
+ index += BitLength.vendorId;
22276
+ if (isARange) {
22277
+ var endVendorId = IntEncoder.decode(encodedString.substr(index, BitLength.vendorId), BitLength.vendorId);
22278
+ index += BitLength.vendorId;
22279
+ if (endVendorId < startOrOnlyVendorId) {
22280
+ throw new DecodingError("Invalid RangeEntry: endVendorId ".concat(endVendorId, " is less than ").concat(startOrOnlyVendorId));
22281
+ }
22282
+ for(var k = startOrOnlyVendorId; k <= endVendorId; k++){
22283
+ vector.add(k, purposeRestriction);
22284
+ }
22285
+ } else {
22286
+ vector.add(startOrOnlyVendorId, purposeRestriction);
22287
+ }
22288
+ }
22289
+ }
22290
+ vector.bitLength = index;
22291
+ return vector;
22292
+ }
22293
+ }
22294
+ ]);
22295
+ return PurposeRestrictionVectorEncoder;
22296
+ }();
22297
+ // node_modules/@iabtcf/core/lib/mjs/encoder/field/VectorEncodingType.js
22298
+ var VectorEncodingType;
22299
+ (function(VectorEncodingType2) {
22300
+ VectorEncodingType2[VectorEncodingType2["FIELD"] = 0] = "FIELD";
22301
+ VectorEncodingType2[VectorEncodingType2["RANGE"] = 1] = "RANGE";
22302
+ })(VectorEncodingType || (VectorEncodingType = {}));
22303
+ // node_modules/@iabtcf/core/lib/mjs/encoder/field/VendorVectorEncoder.js
22304
+ var VendorVectorEncoder = /*#__PURE__*/ function() {
22305
+ "use strict";
22306
+ function VendorVectorEncoder() {
22307
+ _class_call_check(this, VendorVectorEncoder);
22308
+ }
22309
+ _create_class(VendorVectorEncoder, null, [
22310
+ {
22311
+ key: "encode",
22312
+ value: function encode(value2) {
22313
+ var ranges = [];
22314
+ var range = [];
22315
+ var retrString = IntEncoder.encode(value2.maxId, BitLength.maxId);
22316
+ var bitField = "";
22317
+ var rangeIsSmaller;
22318
+ var headerLength = BitLength.maxId + BitLength.encodingType;
22319
+ var bitFieldLength = headerLength + value2.maxId;
22320
+ var minRangeLength = BitLength.vendorId * 2 + BitLength.singleOrRange + BitLength.numEntries;
22321
+ var rangeLength = headerLength + BitLength.numEntries;
22322
+ value2.forEach(function(curValue, i2) {
22323
+ bitField += BooleanEncoder.encode(curValue);
22324
+ rangeIsSmaller = value2.maxId > minRangeLength && rangeLength < bitFieldLength;
22325
+ if (rangeIsSmaller && curValue) {
22326
+ var nextValue = value2.has(i2 + 1);
22327
+ if (!nextValue) {
22328
+ range.push(i2);
22329
+ rangeLength += BitLength.vendorId;
22330
+ ranges.push(range);
22331
+ range = [];
22332
+ } else if (range.length === 0) {
22333
+ range.push(i2);
22334
+ rangeLength += BitLength.singleOrRange;
22335
+ rangeLength += BitLength.vendorId;
22336
+ }
22337
+ }
22338
+ });
22339
+ if (rangeIsSmaller) {
22340
+ retrString += String(VectorEncodingType.RANGE);
22341
+ retrString += this.buildRangeEncoding(ranges);
22342
+ } else {
22343
+ retrString += String(VectorEncodingType.FIELD);
22344
+ retrString += bitField;
22345
+ }
22346
+ return retrString;
22347
+ }
22348
+ },
22349
+ {
22350
+ key: "decode",
22351
+ value: function decode(value2, version) {
22352
+ var vector;
22353
+ var index = 0;
22354
+ var maxId = IntEncoder.decode(value2.substr(index, BitLength.maxId), BitLength.maxId);
22355
+ index += BitLength.maxId;
22356
+ var encodingType = IntEncoder.decode(value2.charAt(index), BitLength.encodingType);
22357
+ index += BitLength.encodingType;
22358
+ if (encodingType === VectorEncodingType.RANGE) {
22359
+ vector = new Vector();
22360
+ if (version === 1) {
22361
+ if (value2.substr(index, 1) === "1") {
22362
+ throw new DecodingError("Unable to decode default consent=1");
22363
+ }
22364
+ index++;
22365
+ }
22366
+ var numEntries = IntEncoder.decode(value2.substr(index, BitLength.numEntries), BitLength.numEntries);
22367
+ index += BitLength.numEntries;
22368
+ for(var i2 = 0; i2 < numEntries; i2++){
22369
+ var isIdRange = BooleanEncoder.decode(value2.charAt(index));
22370
+ index += BitLength.singleOrRange;
22371
+ var firstId = IntEncoder.decode(value2.substr(index, BitLength.vendorId), BitLength.vendorId);
22372
+ index += BitLength.vendorId;
22373
+ if (isIdRange) {
22374
+ var secondId = IntEncoder.decode(value2.substr(index, BitLength.vendorId), BitLength.vendorId);
22375
+ index += BitLength.vendorId;
22376
+ for(var j = firstId; j <= secondId; j++){
22377
+ vector.set(j);
22378
+ }
22379
+ } else {
22380
+ vector.set(firstId);
22381
+ }
22382
+ }
22383
+ } else {
22384
+ var bitField = value2.substr(index, maxId);
22385
+ index += maxId;
22386
+ vector = FixedVectorEncoder.decode(bitField, maxId);
22387
+ }
22388
+ vector.bitLength = index;
22389
+ return vector;
22390
+ }
22391
+ },
22392
+ {
22393
+ key: "buildRangeEncoding",
22394
+ value: function buildRangeEncoding(ranges) {
22395
+ var numEntries = ranges.length;
22396
+ var rangeString = IntEncoder.encode(numEntries, BitLength.numEntries);
22397
+ ranges.forEach(function(range) {
22398
+ var single = range.length === 1;
22399
+ rangeString += BooleanEncoder.encode(!single);
22400
+ rangeString += IntEncoder.encode(range[0], BitLength.vendorId);
22401
+ if (!single) {
22402
+ rangeString += IntEncoder.encode(range[1], BitLength.vendorId);
22403
+ }
22404
+ });
22405
+ return rangeString;
22406
+ }
22407
+ }
22408
+ ]);
22409
+ return VendorVectorEncoder;
22410
+ }();
22411
+ // node_modules/@iabtcf/core/lib/mjs/encoder/field/FieldEncoderMap.js
22412
+ function FieldEncoderMap() {
22413
+ var _obj;
22414
+ return _obj = {}, _define_property(_obj, Fields.version, IntEncoder), _define_property(_obj, Fields.created, DateEncoder), _define_property(_obj, Fields.lastUpdated, DateEncoder), _define_property(_obj, Fields.cmpId, IntEncoder), _define_property(_obj, Fields.cmpVersion, IntEncoder), _define_property(_obj, Fields.consentScreen, IntEncoder), _define_property(_obj, Fields.consentLanguage, LangEncoder), _define_property(_obj, Fields.vendorListVersion, IntEncoder), _define_property(_obj, Fields.policyVersion, IntEncoder), _define_property(_obj, Fields.isServiceSpecific, BooleanEncoder), _define_property(_obj, Fields.useNonStandardStacks, BooleanEncoder), _define_property(_obj, Fields.specialFeatureOptins, FixedVectorEncoder), _define_property(_obj, Fields.purposeConsents, FixedVectorEncoder), _define_property(_obj, Fields.purposeLegitimateInterests, FixedVectorEncoder), _define_property(_obj, Fields.purposeOneTreatment, BooleanEncoder), _define_property(_obj, Fields.publisherCountryCode, LangEncoder), _define_property(_obj, Fields.vendorConsents, VendorVectorEncoder), _define_property(_obj, Fields.vendorLegitimateInterests, VendorVectorEncoder), _define_property(_obj, Fields.publisherRestrictions, PurposeRestrictionVectorEncoder), _define_property(_obj, "segmentType", IntEncoder), _define_property(_obj, Fields.vendorsDisclosed, VendorVectorEncoder), _define_property(_obj, Fields.vendorsAllowed, VendorVectorEncoder), _define_property(_obj, Fields.publisherConsents, FixedVectorEncoder), _define_property(_obj, Fields.publisherLegitimateInterests, FixedVectorEncoder), _define_property(_obj, Fields.numCustomPurposes, IntEncoder), _define_property(_obj, Fields.publisherCustomConsents, FixedVectorEncoder), _define_property(_obj, Fields.publisherCustomLegitimateInterests, FixedVectorEncoder), _obj;
22415
+ }
22416
+ // node_modules/@iabtcf/core/lib/mjs/encoder/sequence/FieldSequence.js
22417
+ var FieldSequence = function FieldSequence() {
22418
+ "use strict";
22419
+ _class_call_check(this, FieldSequence);
22420
+ __publicField(this, "1", _define_property({}, Segment.CORE, [
22421
+ Fields.version,
22422
+ Fields.created,
22423
+ Fields.lastUpdated,
22424
+ Fields.cmpId,
22425
+ Fields.cmpVersion,
22426
+ Fields.consentScreen,
22427
+ Fields.consentLanguage,
22428
+ Fields.vendorListVersion,
22429
+ Fields.purposeConsents,
22430
+ Fields.vendorConsents
22431
+ ]));
22432
+ var _obj;
22433
+ __publicField(this, "2", (_obj = {}, _define_property(_obj, Segment.CORE, [
22434
+ Fields.version,
22435
+ Fields.created,
22436
+ Fields.lastUpdated,
22437
+ Fields.cmpId,
22438
+ Fields.cmpVersion,
22439
+ Fields.consentScreen,
22440
+ Fields.consentLanguage,
22441
+ Fields.vendorListVersion,
22442
+ Fields.policyVersion,
22443
+ Fields.isServiceSpecific,
22444
+ Fields.useNonStandardStacks,
22445
+ Fields.specialFeatureOptins,
22446
+ Fields.purposeConsents,
22447
+ Fields.purposeLegitimateInterests,
22448
+ Fields.purposeOneTreatment,
22449
+ Fields.publisherCountryCode,
22450
+ Fields.vendorConsents,
22451
+ Fields.vendorLegitimateInterests,
22452
+ Fields.publisherRestrictions
22453
+ ]), _define_property(_obj, Segment.PUBLISHER_TC, [
22454
+ Fields.publisherConsents,
22455
+ Fields.publisherLegitimateInterests,
22456
+ Fields.numCustomPurposes,
22457
+ Fields.publisherCustomConsents,
22458
+ Fields.publisherCustomLegitimateInterests
22459
+ ]), _define_property(_obj, Segment.VENDORS_ALLOWED, [
22460
+ Fields.vendorsAllowed
22461
+ ]), _define_property(_obj, Segment.VENDORS_DISCLOSED, [
22462
+ Fields.vendorsDisclosed
22463
+ ]), _obj));
22464
+ };
22465
+ // node_modules/@iabtcf/core/lib/mjs/encoder/sequence/SegmentSequence.js
22466
+ var SegmentSequence = function SegmentSequence(tcModel, options) {
22467
+ "use strict";
22468
+ _class_call_check(this, SegmentSequence);
22469
+ __publicField(this, "1", [
22470
+ Segment.CORE
22471
+ ]);
22472
+ __publicField(this, "2", [
22473
+ Segment.CORE
22474
+ ]);
22475
+ if (tcModel.version === 2) {
22476
+ if (tcModel.isServiceSpecific) {
22477
+ this["2"].push(Segment.PUBLISHER_TC);
22478
+ } else {
22479
+ var isForVendors = !!(options && options.isForVendors);
22480
+ if (!isForVendors || tcModel[Fields.supportOOB] === true) {
22481
+ this["2"].push(Segment.VENDORS_DISCLOSED);
22482
+ }
22483
+ if (isForVendors) {
22484
+ if (tcModel[Fields.supportOOB] && tcModel[Fields.vendorsAllowed].size > 0) {
22485
+ this["2"].push(Segment.VENDORS_ALLOWED);
22486
+ }
22487
+ this["2"].push(Segment.PUBLISHER_TC);
22488
+ }
22489
+ }
22490
+ }
22491
+ };
22492
+ // node_modules/@iabtcf/core/lib/mjs/encoder/SegmentEncoder.js
22493
+ var SegmentEncoder = /*#__PURE__*/ function() {
22494
+ "use strict";
22495
+ function SegmentEncoder() {
22496
+ _class_call_check(this, SegmentEncoder);
22497
+ }
22498
+ _create_class(SegmentEncoder, null, [
22499
+ {
22500
+ key: "encode",
22501
+ value: function encode(tcModel, segment) {
22502
+ var _this = this;
22503
+ var sequence;
22504
+ try {
22505
+ sequence = this.fieldSequence[String(tcModel.version)][segment];
22506
+ } catch (err) {
22507
+ throw new EncodingError("Unable to encode version: ".concat(tcModel.version, ", segment: ").concat(segment));
22508
+ }
22509
+ var bitField = "";
22510
+ if (segment !== Segment.CORE) {
22511
+ bitField = IntEncoder.encode(SegmentIDs.KEY_TO_ID[segment], BitLength.segmentType);
22512
+ }
22513
+ var fieldEncoderMap = FieldEncoderMap();
22514
+ sequence.forEach(function(key) {
22515
+ var value2 = tcModel[key];
22516
+ var encoder = fieldEncoderMap[key];
22517
+ var numBits = BitLength[key];
22518
+ if (numBits === void 0) {
22519
+ if (_this.isPublisherCustom(key)) {
22520
+ numBits = Number(tcModel[Fields.numCustomPurposes]);
22521
+ }
22522
+ }
22523
+ try {
22524
+ bitField += encoder.encode(value2, numBits);
22525
+ } catch (err) {
22526
+ throw new EncodingError("Error encoding ".concat(segment, "->").concat(key, ": ").concat(err.message));
22527
+ }
22528
+ });
22529
+ return Base64Url.encode(bitField);
22530
+ }
22531
+ },
22532
+ {
22533
+ key: "decode",
22534
+ value: function decode(encodedString, tcModel, segment) {
22535
+ var _this = this;
22536
+ var bitField = Base64Url.decode(encodedString);
22537
+ var bStringIdx = 0;
22538
+ if (segment === Segment.CORE) {
22539
+ tcModel.version = IntEncoder.decode(bitField.substr(bStringIdx, BitLength[Fields.version]), BitLength[Fields.version]);
22540
+ }
22541
+ if (segment !== Segment.CORE) {
22542
+ bStringIdx += BitLength.segmentType;
22543
+ }
22544
+ var sequence = this.fieldSequence[String(tcModel.version)][segment];
22545
+ var fieldEncoderMap = FieldEncoderMap();
22546
+ sequence.forEach(function(key) {
22547
+ var encoder = fieldEncoderMap[key];
22548
+ var numBits = BitLength[key];
22549
+ if (numBits === void 0) {
22550
+ if (_this.isPublisherCustom(key)) {
22551
+ numBits = Number(tcModel[Fields.numCustomPurposes]);
22552
+ }
22553
+ }
22554
+ if (numBits !== 0) {
22555
+ var bits = bitField.substr(bStringIdx, numBits);
22556
+ if (encoder === VendorVectorEncoder) {
22557
+ tcModel[key] = encoder.decode(bits, tcModel.version);
22558
+ } else {
22559
+ tcModel[key] = encoder.decode(bits, numBits);
22560
+ }
22561
+ if (Number.isInteger(numBits)) {
22562
+ bStringIdx += numBits;
22563
+ } else if (Number.isInteger(tcModel[key].bitLength)) {
22564
+ bStringIdx += tcModel[key].bitLength;
22565
+ } else {
22566
+ throw new DecodingError(key);
22567
+ }
22568
+ }
22569
+ });
22570
+ return tcModel;
22571
+ }
22572
+ },
22573
+ {
22574
+ key: "isPublisherCustom",
22575
+ value: function isPublisherCustom(key) {
22576
+ return key.indexOf("publisherCustom") === 0;
22577
+ }
22578
+ }
22579
+ ]);
22580
+ return SegmentEncoder;
22581
+ }();
22582
+ __publicField(SegmentEncoder, "fieldSequence", new FieldSequence());
22583
+ // node_modules/@iabtcf/core/lib/mjs/encoder/SemanticPreEncoder.js
22584
+ var SemanticPreEncoder = /*#__PURE__*/ function() {
22585
+ "use strict";
22586
+ function SemanticPreEncoder() {
22587
+ _class_call_check(this, SemanticPreEncoder);
22588
+ }
22589
+ _create_class(SemanticPreEncoder, null, [
22590
+ {
22591
+ key: "process",
22592
+ value: function process1(tcModel, options) {
22593
+ var gvl = tcModel.gvl;
22594
+ if (!gvl) {
22595
+ throw new EncodingError("Unable to encode TCModel without a GVL");
22596
+ }
22597
+ if (!gvl.isReady) {
22598
+ throw new EncodingError("Unable to encode TCModel tcModel.gvl.readyPromise is not resolved");
22599
+ }
22600
+ tcModel = tcModel.clone();
22601
+ tcModel.consentLanguage = gvl.language.toUpperCase();
22602
+ if ((options === null || options === void 0 ? void 0 : options.version) > 0 && (options === null || options === void 0 ? void 0 : options.version) <= this.processor.length) {
22603
+ tcModel.version = options.version;
22604
+ } else {
22605
+ tcModel.version = this.processor.length;
22606
+ }
22607
+ var processorFunctionIndex = tcModel.version - 1;
22608
+ if (!this.processor[processorFunctionIndex]) {
22609
+ throw new EncodingError("Invalid version: ".concat(tcModel.version));
22610
+ }
22611
+ return this.processor[processorFunctionIndex](tcModel, gvl);
22612
+ }
22613
+ }
22614
+ ]);
22615
+ return SemanticPreEncoder;
22616
+ }();
22617
+ __publicField(SemanticPreEncoder, "processor", [
22618
+ function(tcModel) {
22619
+ return tcModel;
22620
+ },
22621
+ function(tcModel, gvl) {
22622
+ tcModel.publisherRestrictions.gvl = gvl;
22623
+ tcModel.purposeLegitimateInterests.unset(1);
22624
+ var vectorToIntMap = /* @__PURE__ */ new Map();
22625
+ vectorToIntMap.set("legIntPurposes", tcModel.vendorLegitimateInterests);
22626
+ vectorToIntMap.set("purposes", tcModel.vendorConsents);
22627
+ vectorToIntMap.forEach(function(vector, gvlVendorKey) {
22628
+ vector.forEach(function(value2, vendorId) {
22629
+ if (value2) {
22630
+ var vendor = gvl.vendors[vendorId];
22631
+ if (!vendor || vendor.deletedDate) {
22632
+ vector.unset(vendorId);
22633
+ } else if (vendor[gvlVendorKey].length === 0) {
22634
+ if (gvlVendorKey === "legIntPurposes" && vendor["purposes"].length === 0 && vendor["legIntPurposes"].length === 0 && vendor["specialPurposes"].length > 0) {} else {
22635
+ if (tcModel.isServiceSpecific) {
22636
+ if (vendor.flexiblePurposes.length === 0) {
22637
+ vector.unset(vendorId);
22638
+ } else {
22639
+ var restrictions = tcModel.publisherRestrictions.getRestrictions(vendorId);
22640
+ var isValid = false;
22641
+ for(var i2 = 0, len = restrictions.length; i2 < len && !isValid; i2++){
22642
+ isValid = restrictions[i2].restrictionType === RestrictionType.REQUIRE_CONSENT && gvlVendorKey === "purposes" || restrictions[i2].restrictionType === RestrictionType.REQUIRE_LI && gvlVendorKey === "legIntPurposes";
22643
+ }
22644
+ if (!isValid) {
22645
+ vector.unset(vendorId);
22646
+ }
22647
+ }
22648
+ } else {
22649
+ vector.unset(vendorId);
22650
+ }
22651
+ }
22652
+ }
22653
+ }
22654
+ });
22655
+ });
22656
+ tcModel.vendorsDisclosed.set(gvl.vendors);
22657
+ return tcModel;
22658
+ }
22659
+ ]);
22660
+ // node_modules/@iabtcf/core/lib/mjs/Json.js
22661
+ var Json = /*#__PURE__*/ function() {
22662
+ "use strict";
22663
+ function Json() {
22664
+ _class_call_check(this, Json);
22665
+ }
22666
+ _create_class(Json, null, [
22667
+ {
22668
+ key: "absCall",
22669
+ value: function absCall(url2, body, sendCookies, timeout) {
22670
+ return new Promise(function(resolve, reject) {
22671
+ var req = new XMLHttpRequest();
22672
+ var onLoad = function() {
22673
+ if (req.readyState == XMLHttpRequest.DONE) {
22674
+ if (req.status >= 200 && req.status < 300) {
22675
+ var response = req.response;
22676
+ if (typeof response === "string") {
22677
+ try {
22678
+ response = JSON.parse(response);
22679
+ } catch (e2) {}
22680
+ }
22681
+ resolve(response);
22682
+ } else {
22683
+ reject(new Error("HTTP Status: ".concat(req.status, " response type: ").concat(req.responseType)));
22684
+ }
22685
+ }
22686
+ };
22687
+ var onError = function() {
22688
+ reject(new Error("error"));
22689
+ };
22690
+ var onAbort = function() {
22691
+ reject(new Error("aborted"));
22692
+ };
22693
+ var onTimeout = function() {
22694
+ reject(new Error("Timeout " + timeout + "ms " + url2));
22695
+ };
22696
+ req.withCredentials = sendCookies;
22697
+ req.addEventListener("load", onLoad);
22698
+ req.addEventListener("error", onError);
22699
+ req.addEventListener("abort", onAbort);
22700
+ if (body === null) {
22701
+ req.open("GET", url2, true);
22702
+ } else {
22703
+ req.open("POST", url2, true);
22704
+ }
22705
+ req.responseType = "json";
22706
+ req.timeout = timeout;
22707
+ req.ontimeout = onTimeout;
22708
+ req.send(body);
22709
+ });
22710
+ }
22711
+ },
22712
+ {
22713
+ key: "post",
22714
+ value: /**
22715
+ * @static
22716
+ * @param {string} url - full path to POST to
22717
+ * @param {object} body - JSON object to post
22718
+ * @param {boolean} sendCookies - Whether or not to send the XMLHttpRequest with credentials or not
22719
+ * @param {number} [timeout] - optional timeout in milliseconds
22720
+ * @return {Promise<object>} - if the server responds the response will be returned here
22721
+ */ function post(url2, body) {
22722
+ var sendCookies = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false, timeout = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
22723
+ return this.absCall(url2, JSON.stringify(body), sendCookies, timeout);
22724
+ }
22725
+ },
22726
+ {
22727
+ key: "fetch",
22728
+ value: /**
22729
+ * @static
22730
+ * @param {string} url - full path to the json
22731
+ * @param {boolean} sendCookies - Whether or not to send the XMLHttpRequest with credentials or not
22732
+ * @param {number} [timeout] - optional timeout in milliseconds
22733
+ * @return {Promise<object>} - resolves with parsed JSON
22734
+ */ function fetch1(url2) {
22735
+ var sendCookies = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, timeout = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
22736
+ return this.absCall(url2, null, sendCookies, timeout);
22737
+ }
22738
+ }
22739
+ ]);
22740
+ return Json;
22741
+ }();
22742
+ // node_modules/@iabtcf/core/lib/mjs/GVL.js
22743
+ var _GVL = /*#__PURE__*/ function(Cloneable) {
22744
+ "use strict";
22745
+ _inherits(_GVL, Cloneable);
22746
+ var _super = _create_super(_GVL);
22747
+ function _GVL(versionOrVendorList) {
22748
+ _class_call_check(this, _GVL);
22749
+ var _this;
22750
+ _this = _super.call(this);
22751
+ /**
22752
+ * @param {Promise} resolved when this GVL object is populated with the data
22753
+ * or rejected if there is an error.
22754
+ */ __publicField(_assert_this_initialized(_this), "readyPromise");
22755
+ /**
22756
+ * @param {number} gvlSpecificationVersion - schema version for the GVL that is used
22757
+ */ __publicField(_assert_this_initialized(_this), "gvlSpecificationVersion");
22758
+ /**
22759
+ * @param {number} incremented with each published file change
22760
+ */ __publicField(_assert_this_initialized(_this), "vendorListVersion");
22761
+ /**
22762
+ * @param {number} tcfPolicyVersion - The TCF MO will increment this value
22763
+ * whenever a GVL change (such as adding a new Purpose or Feature or a change
22764
+ * in Purpose wording) legally invalidates existing TC Strings and requires
22765
+ * CMPs to re-establish transparency and consent from users. If the policy
22766
+ * version number in the latest GVL is different from the value in your TC
22767
+ * String, then you need to re-establish transparency and consent for that
22768
+ * user. A version 1 format TC String is considered to have a version value
22769
+ * of 1.
22770
+ */ __publicField(_assert_this_initialized(_this), "tcfPolicyVersion");
22771
+ /**
22772
+ * @param {string | Date} lastUpdated - the date in which the vendor list
22773
+ * json file was last updated.
22774
+ */ __publicField(_assert_this_initialized(_this), "lastUpdated");
22775
+ /**
22776
+ * @param {IntMap<Purpose>} a collection of [[Purpose]]s
22777
+ */ __publicField(_assert_this_initialized(_this), "purposes");
22778
+ /**
22779
+ * @param {IntMap<Purpose>} a collection of [[Purpose]]s
22780
+ */ __publicField(_assert_this_initialized(_this), "specialPurposes");
22781
+ /**
22782
+ * @param {IntMap<Feature>} a collection of [[Feature]]s
22783
+ */ __publicField(_assert_this_initialized(_this), "features");
22784
+ /**
22785
+ * @param {IntMap<Feature>} a collection of [[Feature]]s
22786
+ */ __publicField(_assert_this_initialized(_this), "specialFeatures");
22787
+ /**
22788
+ * @param {boolean} internal reference of when the GVL is ready to be used
22789
+ */ __publicField(_assert_this_initialized(_this), "isReady_", false);
22790
+ /**
22791
+ * @param {IntMap<Vendor>} a collection of [[Vendor]]s
22792
+ */ __publicField(_assert_this_initialized(_this), "vendors_");
22793
+ __publicField(_assert_this_initialized(_this), "vendorIds");
22794
+ /**
22795
+ * @param {IntMap<Vendor>} a collection of [[Vendor]]. Used as a backup if a whitelist is sets
22796
+ */ __publicField(_assert_this_initialized(_this), "fullVendorList");
22797
+ /**
22798
+ * @param {ByPurposeVendorMap} vendors by purpose
22799
+ */ __publicField(_assert_this_initialized(_this), "byPurposeVendorMap");
22800
+ /**
22801
+ * @param {IDSetMap} vendors by special purpose
22802
+ */ __publicField(_assert_this_initialized(_this), "bySpecialPurposeVendorMap");
22803
+ /**
22804
+ * @param {IDSetMap} vendors by feature
22805
+ */ __publicField(_assert_this_initialized(_this), "byFeatureVendorMap");
22806
+ /**
22807
+ * @param {IDSetMap} vendors by special feature
22808
+ */ __publicField(_assert_this_initialized(_this), "bySpecialFeatureVendorMap");
22809
+ /**
22810
+ * @param {IntMap<Stack>} a collection of [[Stack]]s
22811
+ */ __publicField(_assert_this_initialized(_this), "stacks");
22812
+ __publicField(_assert_this_initialized(_this), "lang_");
22813
+ __publicField(_assert_this_initialized(_this), "isLatest", false);
22814
+ var url2 = _GVL.baseUrl;
22815
+ _this.lang_ = _GVL.DEFAULT_LANGUAGE;
22816
+ if (_this.isVendorList(versionOrVendorList)) {
22817
+ _this.populate(versionOrVendorList);
22818
+ _this.readyPromise = Promise.resolve();
22819
+ } else {
22820
+ if (!url2) {
22821
+ throw new GVLError("must specify GVL.baseUrl before loading GVL json");
22822
+ }
22823
+ if (versionOrVendorList > 0) {
22824
+ var version = versionOrVendorList;
22825
+ if (_GVL.CACHE.has(version)) {
22826
+ _this.populate(_GVL.CACHE.get(version));
22827
+ _this.readyPromise = Promise.resolve();
22828
+ } else {
22829
+ url2 += _GVL.versionedFilename.replace("[VERSION]", String(version));
22830
+ _this.readyPromise = _this.fetchJson(url2);
22831
+ }
22832
+ } else {
22833
+ if (_GVL.CACHE.has(_GVL.LATEST_CACHE_KEY)) {
22834
+ _this.populate(_GVL.CACHE.get(_GVL.LATEST_CACHE_KEY));
22835
+ _this.readyPromise = Promise.resolve();
22836
+ } else {
22837
+ _this.isLatest = true;
22838
+ _this.readyPromise = _this.fetchJson(url2 + _GVL.latestFilename);
22839
+ }
22840
+ }
22841
+ }
22842
+ return _this;
22843
+ }
22844
+ _create_class(_GVL, [
22845
+ {
22846
+ key: "cacheLanguage",
22847
+ value: function cacheLanguage() {
22848
+ if (!_GVL.LANGUAGE_CACHE.has(this.lang_)) {
22849
+ _GVL.LANGUAGE_CACHE.set(this.lang_, {
22850
+ purposes: this.purposes,
22851
+ specialPurposes: this.specialPurposes,
22852
+ features: this.features,
22853
+ specialFeatures: this.specialFeatures,
22854
+ stacks: this.stacks
22855
+ });
22856
+ }
22857
+ }
22858
+ },
22859
+ {
22860
+ key: "fetchJson",
22861
+ value: function fetchJson(url2) {
22862
+ var _this = this;
22863
+ return _async_to_generator(function() {
22864
+ var _, err;
22865
+ return _ts_generator(this, function(_state) {
22866
+ switch(_state.label){
22867
+ case 0:
22868
+ _state.trys.push([
22869
+ 0,
22870
+ 2,
22871
+ ,
22872
+ 3
22873
+ ]);
22874
+ _ = _this.populate;
22875
+ return [
22876
+ 4,
22877
+ Json.fetch(url2)
22878
+ ];
22879
+ case 1:
22880
+ _.apply(_this, [
22881
+ _state.sent()
22882
+ ]);
22883
+ return [
22884
+ 3,
22885
+ 3
22886
+ ];
22887
+ case 2:
22888
+ err = _state.sent();
22889
+ throw new GVLError(err.message);
22890
+ case 3:
22891
+ return [
22892
+ 2
22893
+ ];
22894
+ }
22895
+ });
22896
+ })();
22897
+ }
22898
+ },
22899
+ {
22900
+ /**
22901
+ * getJson - Method for getting the JSON that was downloaded to created this
22902
+ * `GVL` object
22903
+ *
22904
+ * @return {VendorList} - The basic JSON structure without the extra
22905
+ * functionality and methods of this class.
22906
+ */ key: "getJson",
22907
+ value: function getJson() {
22908
+ return JSON.parse(JSON.stringify({
22909
+ gvlSpecificationVersion: this.gvlSpecificationVersion,
22910
+ vendorListVersion: this.vendorListVersion,
22911
+ tcfPolicyVersion: this.tcfPolicyVersion,
22912
+ lastUpdated: this.lastUpdated,
22913
+ purposes: this.purposes,
22914
+ specialPurposes: this.specialPurposes,
22915
+ features: this.features,
22916
+ specialFeatures: this.specialFeatures,
22917
+ stacks: this.stacks,
22918
+ vendors: this.fullVendorList
22919
+ }));
22920
+ }
22921
+ },
22922
+ {
22923
+ key: "changeLanguage",
22924
+ value: /**
22925
+ * changeLanguage - retrieves the purpose language translation and sets the
22926
+ * internal language variable
22927
+ *
22928
+ * @param {string} lang - ISO 639-1 langauge code to change language to
22929
+ * @return {Promise<void | GVLError>} - returns the `readyPromise` and
22930
+ * resolves when this GVL is populated with the data from the language file.
22931
+ */ function changeLanguage(lang) {
22932
+ var _this = this;
22933
+ return _async_to_generator(function() {
22934
+ var langUpper, cached, prop, url2, err;
22935
+ return _ts_generator(this, function(_state) {
22936
+ switch(_state.label){
22937
+ case 0:
22938
+ langUpper = lang.toUpperCase();
22939
+ if (!_GVL.consentLanguages.has(langUpper)) return [
22940
+ 3,
22941
+ 6
22942
+ ];
22943
+ if (!(langUpper !== _this.lang_)) return [
22944
+ 3,
22945
+ 5
22946
+ ];
22947
+ _this.lang_ = langUpper;
22948
+ if (!_GVL.LANGUAGE_CACHE.has(langUpper)) return [
22949
+ 3,
22950
+ 1
22951
+ ];
22952
+ cached = _GVL.LANGUAGE_CACHE.get(langUpper);
22953
+ for(var prop in cached){
22954
+ if (cached.hasOwnProperty(prop)) {
22955
+ _this[prop] = cached[prop];
22956
+ }
22957
+ }
22958
+ return [
22959
+ 3,
22960
+ 5
22961
+ ];
22962
+ case 1:
22963
+ url2 = _GVL.baseUrl + _GVL.languageFilename.replace("[LANG]", lang);
22964
+ _state.label = 2;
22965
+ case 2:
22966
+ _state.trys.push([
22967
+ 2,
22968
+ 4,
22969
+ ,
22970
+ 5
22971
+ ]);
22972
+ return [
22973
+ 4,
22974
+ _this.fetchJson(url2)
22975
+ ];
22976
+ case 3:
22977
+ _state.sent();
22978
+ _this.cacheLanguage();
22979
+ return [
22980
+ 3,
22981
+ 5
22982
+ ];
22983
+ case 4:
22984
+ err = _state.sent();
22985
+ throw new GVLError("unable to load language: " + err.message);
22986
+ case 5:
22987
+ return [
22988
+ 3,
22989
+ 7
22990
+ ];
22991
+ case 6:
22992
+ throw new GVLError("unsupported language ".concat(lang));
22993
+ case 7:
22994
+ return [
22995
+ 2
22996
+ ];
22997
+ }
22998
+ });
22999
+ })();
23000
+ }
23001
+ },
23002
+ {
23003
+ key: "language",
23004
+ get: function get() {
23005
+ return this.lang_;
23006
+ }
23007
+ },
23008
+ {
23009
+ key: "isVendorList",
23010
+ value: function isVendorList(gvlObject) {
23011
+ return gvlObject !== void 0 && gvlObject.vendors !== void 0;
23012
+ }
23013
+ },
23014
+ {
23015
+ key: "populate",
23016
+ value: function populate(gvlObject) {
23017
+ this.purposes = gvlObject.purposes;
23018
+ this.specialPurposes = gvlObject.specialPurposes;
23019
+ this.features = gvlObject.features;
23020
+ this.specialFeatures = gvlObject.specialFeatures;
23021
+ this.stacks = gvlObject.stacks;
23022
+ if (this.isVendorList(gvlObject)) {
23023
+ this.gvlSpecificationVersion = gvlObject.gvlSpecificationVersion;
23024
+ this.tcfPolicyVersion = gvlObject.tcfPolicyVersion;
23025
+ this.vendorListVersion = gvlObject.vendorListVersion;
23026
+ this.lastUpdated = gvlObject.lastUpdated;
23027
+ if (typeof this.lastUpdated === "string") {
23028
+ this.lastUpdated = new Date(this.lastUpdated);
23029
+ }
23030
+ this.vendors_ = gvlObject.vendors;
23031
+ this.fullVendorList = gvlObject.vendors;
23032
+ this.mapVendors();
23033
+ this.isReady_ = true;
23034
+ if (this.isLatest) {
23035
+ _GVL.CACHE.set(_GVL.LATEST_CACHE_KEY, this.getJson());
23036
+ }
23037
+ if (!_GVL.CACHE.has(this.vendorListVersion)) {
23038
+ _GVL.CACHE.set(this.vendorListVersion, this.getJson());
23039
+ }
23040
+ }
23041
+ this.cacheLanguage();
23042
+ }
23043
+ },
23044
+ {
23045
+ key: "mapVendors",
23046
+ value: function mapVendors(vendorIds) {
23047
+ var _this = this;
23048
+ this.byPurposeVendorMap = {};
23049
+ this.bySpecialPurposeVendorMap = {};
23050
+ this.byFeatureVendorMap = {};
23051
+ this.bySpecialFeatureVendorMap = {};
23052
+ Object.keys(this.purposes).forEach(function(purposeId) {
23053
+ _this.byPurposeVendorMap[purposeId] = {
23054
+ legInt: /* @__PURE__ */ new Set(),
23055
+ consent: /* @__PURE__ */ new Set(),
23056
+ flexible: /* @__PURE__ */ new Set()
23057
+ };
23058
+ });
23059
+ Object.keys(this.specialPurposes).forEach(function(purposeId) {
23060
+ _this.bySpecialPurposeVendorMap[purposeId] = /* @__PURE__ */ new Set();
23061
+ });
23062
+ Object.keys(this.features).forEach(function(featureId) {
23063
+ _this.byFeatureVendorMap[featureId] = /* @__PURE__ */ new Set();
23064
+ });
23065
+ Object.keys(this.specialFeatures).forEach(function(featureId) {
23066
+ _this.bySpecialFeatureVendorMap[featureId] = /* @__PURE__ */ new Set();
23067
+ });
23068
+ if (!Array.isArray(vendorIds)) {
23069
+ vendorIds = Object.keys(this.fullVendorList).map(function(vId) {
23070
+ return +vId;
23071
+ });
23072
+ }
23073
+ this.vendorIds = new Set(vendorIds);
23074
+ this.vendors_ = vendorIds.reduce(function(vendors, vendorId) {
23075
+ var vendor = _this.vendors_[String(vendorId)];
23076
+ if (vendor && vendor.deletedDate === void 0) {
23077
+ vendor.purposes.forEach(function(purposeId) {
23078
+ var purpGroup = _this.byPurposeVendorMap[String(purposeId)];
23079
+ purpGroup.consent.add(vendorId);
23080
+ });
23081
+ vendor.specialPurposes.forEach(function(purposeId) {
23082
+ _this.bySpecialPurposeVendorMap[String(purposeId)].add(vendorId);
23083
+ });
23084
+ vendor.legIntPurposes.forEach(function(purposeId) {
23085
+ _this.byPurposeVendorMap[String(purposeId)].legInt.add(vendorId);
23086
+ });
23087
+ if (vendor.flexiblePurposes) {
23088
+ vendor.flexiblePurposes.forEach(function(purposeId) {
23089
+ _this.byPurposeVendorMap[String(purposeId)].flexible.add(vendorId);
23090
+ });
23091
+ }
23092
+ vendor.features.forEach(function(featureId) {
23093
+ _this.byFeatureVendorMap[String(featureId)].add(vendorId);
23094
+ });
23095
+ vendor.specialFeatures.forEach(function(featureId) {
23096
+ _this.bySpecialFeatureVendorMap[String(featureId)].add(vendorId);
23097
+ });
23098
+ vendors[vendorId] = vendor;
23099
+ }
23100
+ return vendors;
23101
+ }, {});
23102
+ }
23103
+ },
23104
+ {
23105
+ key: "getFilteredVendors",
23106
+ value: function getFilteredVendors(purposeOrFeature, id, subType, special) {
23107
+ var _this = this;
23108
+ var properPurposeOrFeature = purposeOrFeature.charAt(0).toUpperCase() + purposeOrFeature.slice(1);
23109
+ var vendorSet;
23110
+ var retr = {};
23111
+ if (purposeOrFeature === "purpose" && subType) {
23112
+ vendorSet = this["by" + properPurposeOrFeature + "VendorMap"][String(id)][subType];
23113
+ } else {
23114
+ vendorSet = this["by" + (special ? "Special" : "") + properPurposeOrFeature + "VendorMap"][String(id)];
23115
+ }
23116
+ vendorSet.forEach(function(vendorId) {
23117
+ retr[String(vendorId)] = _this.vendors[String(vendorId)];
23118
+ });
23119
+ return retr;
23120
+ }
23121
+ },
23122
+ {
23123
+ /**
23124
+ * getVendorsWithConsentPurpose
23125
+ *
23126
+ * @param {number} purposeId
23127
+ * @return {IntMap<Vendor>} - list of vendors that have declared the consent purpose id
23128
+ */ key: "getVendorsWithConsentPurpose",
23129
+ value: function getVendorsWithConsentPurpose(purposeId) {
23130
+ return this.getFilteredVendors("purpose", purposeId, "consent");
23131
+ }
23132
+ },
23133
+ {
23134
+ /**
23135
+ * getVendorsWithLegIntPurpose
23136
+ *
23137
+ * @param {number} purposeId
23138
+ * @return {IntMap<Vendor>} - list of vendors that have declared the legInt (Legitimate Interest) purpose id
23139
+ */ key: "getVendorsWithLegIntPurpose",
23140
+ value: function getVendorsWithLegIntPurpose(purposeId) {
23141
+ return this.getFilteredVendors("purpose", purposeId, "legInt");
23142
+ }
23143
+ },
23144
+ {
23145
+ /**
23146
+ * getVendorsWithFlexiblePurpose
23147
+ *
23148
+ * @param {number} purposeId
23149
+ * @return {IntMap<Vendor>} - list of vendors that have declared the flexible purpose id
23150
+ */ key: "getVendorsWithFlexiblePurpose",
23151
+ value: function getVendorsWithFlexiblePurpose(purposeId) {
23152
+ return this.getFilteredVendors("purpose", purposeId, "flexible");
23153
+ }
23154
+ },
23155
+ {
23156
+ /**
23157
+ * getVendorsWithSpecialPurpose
23158
+ *
23159
+ * @param {number} specialPurposeId
23160
+ * @return {IntMap<Vendor>} - list of vendors that have declared the special purpose id
23161
+ */ key: "getVendorsWithSpecialPurpose",
23162
+ value: function getVendorsWithSpecialPurpose(specialPurposeId) {
23163
+ return this.getFilteredVendors("purpose", specialPurposeId, void 0, true);
23164
+ }
23165
+ },
23166
+ {
23167
+ /**
23168
+ * getVendorsWithFeature
23169
+ *
23170
+ * @param {number} featureId
23171
+ * @return {IntMap<Vendor>} - list of vendors that have declared the feature id
23172
+ */ key: "getVendorsWithFeature",
23173
+ value: function getVendorsWithFeature(featureId) {
23174
+ return this.getFilteredVendors("feature", featureId);
23175
+ }
23176
+ },
23177
+ {
23178
+ /**
23179
+ * getVendorsWithSpecialFeature
23180
+ *
23181
+ * @param {number} specialFeatureId
23182
+ * @return {IntMap<Vendor>} - list of vendors that have declared the special feature id
23183
+ */ key: "getVendorsWithSpecialFeature",
23184
+ value: function getVendorsWithSpecialFeature(specialFeatureId) {
23185
+ return this.getFilteredVendors("feature", specialFeatureId, void 0, true);
23186
+ }
23187
+ },
23188
+ {
23189
+ key: "vendors",
23190
+ get: /**
23191
+ * vendors
23192
+ *
23193
+ * @return {IntMap<Vendor>} - the list of vendors as it would on the JSON file
23194
+ * except if `narrowVendorsTo` was called, it would be that narrowed list
23195
+ */ function get() {
23196
+ return this.vendors_;
23197
+ }
23198
+ },
23199
+ {
23200
+ /**
23201
+ * narrowVendorsTo - narrows vendors represented in this GVL to the list of ids passed in
23202
+ *
23203
+ * @param {number[]} vendorIds - list of ids to narrow this GVL to
23204
+ * @return {void}
23205
+ */ key: "narrowVendorsTo",
23206
+ value: function narrowVendorsTo(vendorIds) {
23207
+ this.mapVendors(vendorIds);
23208
+ }
23209
+ },
23210
+ {
23211
+ key: "isReady",
23212
+ get: /**
23213
+ * isReady - Whether or not this instance is ready to be used. This will be
23214
+ * immediately and synchronously true if a vendorlist object is passed into
23215
+ * the constructor or once the JSON vendorllist is retrieved.
23216
+ *
23217
+ * @return {boolean} whether or not the instance is ready to be interacted
23218
+ * with and all the data is populated
23219
+ */ function get() {
23220
+ return this.isReady_;
23221
+ }
23222
+ },
23223
+ {
23224
+ /**
23225
+ * clone - overrides base `clone()` method since GVL is a special class that
23226
+ * represents a JSON structure with some additional functionality.
23227
+ *
23228
+ * @return {GVL}
23229
+ */ key: "clone",
23230
+ value: function clone() {
23231
+ var result = new _GVL(this.getJson());
23232
+ if (this.lang_ !== _GVL.DEFAULT_LANGUAGE) {
23233
+ result.changeLanguage(this.lang_);
23234
+ }
23235
+ return result;
23236
+ }
23237
+ }
23238
+ ], [
23239
+ {
23240
+ key: "baseUrl",
23241
+ get: /**
23242
+ * baseUrl - Entities using the vendor-list.json are required by the iab to
23243
+ * host their own copy of it to reduce the load on the iab's infrastructure
23244
+ * so a 'base' url must be set to be put together with the versioning scheme
23245
+ * of the filenames.
23246
+ *
23247
+ * @static
23248
+ * @return {string} - returns the previously set baseUrl, the default is
23249
+ * `undefined`
23250
+ */ function get() {
23251
+ return this.baseUrl_;
23252
+ },
23253
+ set: /**
23254
+ * baseUrl - Entities using the vendor-list.json are required by the iab to
23255
+ * host their own copy of it to reduce the load on the iab's infrastructure
23256
+ * so a 'base' url must be set to be put together with the versioning scheme
23257
+ * of the filenames.
23258
+ *
23259
+ * @static
23260
+ * @param {string} url - the base url to load the vendor-list.json from. This is
23261
+ * broken out from the filename because it follows a different scheme for
23262
+ * latest file vs versioned files.
23263
+ *
23264
+ * @throws {GVLError} - If the url is http[s]://vendorlist.consensu.org/...
23265
+ * this will throw an error. IAB Europe requires that that CMPs and Vendors
23266
+ * cache their own copies of the GVL to minimize load on their
23267
+ * infrastructure. For more information regarding caching of the
23268
+ * vendor-list.json, please see [the TCF documentation on 'Caching the Global
23269
+ * Vendor List'
23270
+ * ](https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/IAB%20Tech%20Lab%20-%20Consent%20string%20and%20vendor%20list%20formats%20v2.md#caching-the-global-vendor-list)
23271
+ */ function set(url2) {
23272
+ var notValid = /^https?:\/\/vendorlist\.consensu\.org\//;
23273
+ if (notValid.test(url2)) {
23274
+ throw new GVLError("Invalid baseUrl! You may not pull directly from vendorlist.consensu.org and must provide your own cache");
23275
+ }
23276
+ if (url2.length > 0 && url2[url2.length - 1] !== "/") {
23277
+ url2 += "/";
23278
+ }
23279
+ this.baseUrl_ = url2;
23280
+ }
23281
+ },
23282
+ {
23283
+ key: "emptyLanguageCache",
23284
+ value: /**
23285
+ * emptyLanguageCache
23286
+ *
23287
+ * @param {string} [lang] - Optional ISO 639-1 langauge code to remove from
23288
+ * the cache. Should be one of the languages in GVL.consentLanguages set.
23289
+ * If not then the whole cache will be deleted.
23290
+ * @return {boolean} - true if anything was deleted from the cache
23291
+ */ function emptyLanguageCache(lang) {
23292
+ var retr = false;
23293
+ if (lang === void 0 && _GVL.LANGUAGE_CACHE.size > 0) {
23294
+ _GVL.LANGUAGE_CACHE = /* @__PURE__ */ new Map();
23295
+ retr = true;
23296
+ } else if (typeof lang === "string" && this.consentLanguages.has(lang.toUpperCase())) {
23297
+ _GVL.LANGUAGE_CACHE.delete(lang.toUpperCase());
23298
+ retr = true;
23299
+ }
23300
+ return retr;
23301
+ }
23302
+ },
23303
+ {
23304
+ key: "emptyCache",
23305
+ value: /**
23306
+ * emptyCache
23307
+ *
23308
+ * @param {number} [vendorListVersion] - version of the vendor list to delete
23309
+ * from the cache. If none is specified then the whole cache is deleted.
23310
+ * @return {boolean} - true if anything was deleted from the cache
23311
+ */ function emptyCache(vendorListVersion) {
23312
+ var retr = false;
23313
+ if (Number.isInteger(vendorListVersion) && vendorListVersion >= 0) {
23314
+ _GVL.CACHE.delete(vendorListVersion);
23315
+ retr = true;
23316
+ } else if (vendorListVersion === void 0) {
23317
+ _GVL.CACHE = /* @__PURE__ */ new Map();
23318
+ retr = true;
23319
+ }
23320
+ return retr;
23321
+ }
23322
+ },
23323
+ {
23324
+ key: "isInstanceOf",
23325
+ value: function isInstanceOf(questionableInstance) {
23326
+ var isSo = typeof questionableInstance === "object";
23327
+ return isSo && typeof questionableInstance.narrowVendorsTo === "function";
23328
+ }
23329
+ }
23330
+ ]);
23331
+ return _GVL;
23332
+ }(Cloneable);
23333
+ __publicField(_GVL, "LANGUAGE_CACHE", /* @__PURE__ */ new Map());
23334
+ __publicField(_GVL, "CACHE", /* @__PURE__ */ new Map());
23335
+ __publicField(_GVL, "LATEST_CACHE_KEY", 0);
23336
+ __publicField(_GVL, "DEFAULT_LANGUAGE", "EN");
23337
+ /**
23338
+ * Set of available consent languages published by the IAB
23339
+ */ __publicField(_GVL, "consentLanguages", new ConsentLanguages());
23340
+ __publicField(_GVL, "baseUrl_");
23341
+ /**
23342
+ * @static
23343
+ * @param {string} - the latest is assumed to be vendor-list.json because
23344
+ * that is what the iab uses, but it could be different... if you want
23345
+ */ __publicField(_GVL, "latestFilename", "vendor-list.json");
23346
+ /**
23347
+ * @static
23348
+ * @param {string} - the versioned name is assumed to be
23349
+ * vendor-list-v[VERSION].json where [VERSION] will be replaced with the
23350
+ * specified version. But it could be different... if you want just make
23351
+ * sure to include the [VERSION] macro if you have a numbering scheme, it's a
23352
+ * simple string substitution.
23353
+ *
23354
+ * eg.
23355
+ * ```javascript
23356
+ * GVL.baseUrl = "http://www.mydomain.com/iabcmp/";
23357
+ * GVL.versionedFilename = "vendorlist?getVersion=[VERSION]";
23358
+ * ```
23359
+ */ __publicField(_GVL, "versionedFilename", "archives/vendor-list-v[VERSION].json");
23360
+ /**
23361
+ * @param {string} - Translations of the names and descriptions for Purposes,
23362
+ * Special Purposes, Features, and Special Features to non-English languages
23363
+ * are contained in a file where attributes containing English content
23364
+ * (except vendor declaration information) are translated. The iab publishes
23365
+ * one following the scheme below where the LANG is the iso639-1 language
23366
+ * code. For a list of available translations
23367
+ * [please go here](https://register.consensu.org/Translation).
23368
+ *
23369
+ * eg.
23370
+ * ```javascript
23371
+ * GVL.baseUrl = "http://www.mydomain.com/iabcmp/";
23372
+ * GVL.languageFilename = "purposes?getPurposes=[LANG]";
23373
+ * ```
23374
+ */ __publicField(_GVL, "languageFilename", "purposes-[LANG].json");
23375
+ var GVL = _GVL;
23376
+ // node_modules/@iabtcf/core/lib/mjs/TCModel.js
23377
+ var TCModel = /*#__PURE__*/ function(Cloneable) {
23378
+ "use strict";
23379
+ _inherits(TCModel, Cloneable);
23380
+ var _super = _create_super(TCModel);
23381
+ function TCModel(gvl) {
23382
+ _class_call_check(this, TCModel);
23383
+ var _this;
23384
+ _this = _super.call(this);
23385
+ __publicField(_assert_this_initialized(_this), "isServiceSpecific_", false);
23386
+ __publicField(_assert_this_initialized(_this), "supportOOB_", true);
23387
+ __publicField(_assert_this_initialized(_this), "useNonStandardStacks_", false);
23388
+ __publicField(_assert_this_initialized(_this), "purposeOneTreatment_", false);
23389
+ __publicField(_assert_this_initialized(_this), "publisherCountryCode_", "AA");
23390
+ __publicField(_assert_this_initialized(_this), "version_", 2);
23391
+ __publicField(_assert_this_initialized(_this), "consentScreen_", 0);
23392
+ __publicField(_assert_this_initialized(_this), "policyVersion_", 2);
23393
+ __publicField(_assert_this_initialized(_this), "consentLanguage_", "EN");
23394
+ __publicField(_assert_this_initialized(_this), "cmpId_", 0);
23395
+ __publicField(_assert_this_initialized(_this), "cmpVersion_", 0);
23396
+ __publicField(_assert_this_initialized(_this), "vendorListVersion_", 0);
23397
+ __publicField(_assert_this_initialized(_this), "numCustomPurposes_", 0);
23398
+ // Member Variable for GVL
23399
+ __publicField(_assert_this_initialized(_this), "gvl_");
23400
+ __publicField(_assert_this_initialized(_this), "created");
23401
+ __publicField(_assert_this_initialized(_this), "lastUpdated");
23402
+ /**
23403
+ * The TCF designates certain Features as special, that is, a CMP must afford
23404
+ * the user a means to opt in to their use. These Special Features are
23405
+ * published and numbered in the GVL separately from normal Features.
23406
+ * Provides for up to 12 special features.
23407
+ */ __publicField(_assert_this_initialized(_this), "specialFeatureOptins", new Vector());
23408
+ /**
23409
+ * Renamed from `PurposesAllowed` in TCF v1.1
23410
+ * The user’s consent value for each Purpose established on the legal basis
23411
+ * of consent. Purposes are published in the Global Vendor List (see. [[GVL]]).
23412
+ */ __publicField(_assert_this_initialized(_this), "purposeConsents", new Vector());
23413
+ /**
23414
+ * The user’s permission for each Purpose established on the legal basis of
23415
+ * legitimate interest. If the user has exercised right-to-object for a
23416
+ * purpose.
23417
+ */ __publicField(_assert_this_initialized(_this), "purposeLegitimateInterests", new Vector());
23418
+ /**
23419
+ * The user’s consent value for each Purpose established on the legal basis
23420
+ * of consent, for the publisher. Purposes are published in the Global
23421
+ * Vendor List.
23422
+ */ __publicField(_assert_this_initialized(_this), "publisherConsents", new Vector());
23423
+ /**
23424
+ * The user’s permission for each Purpose established on the legal basis of
23425
+ * legitimate interest. If the user has exercised right-to-object for a
23426
+ * purpose.
23427
+ */ __publicField(_assert_this_initialized(_this), "publisherLegitimateInterests", new Vector());
23428
+ /**
23429
+ * The user’s consent value for each Purpose established on the legal basis
23430
+ * of consent, for the publisher. Purposes are published in the Global
23431
+ * Vendor List.
23432
+ */ __publicField(_assert_this_initialized(_this), "publisherCustomConsents", new Vector());
23433
+ /**
23434
+ * The user’s permission for each Purpose established on the legal basis of
23435
+ * legitimate interest. If the user has exercised right-to-object for a
23436
+ * purpose that is established in the publisher's custom purposes.
23437
+ */ __publicField(_assert_this_initialized(_this), "publisherCustomLegitimateInterests", new Vector());
23438
+ /**
23439
+ * set by a publisher if they wish to collect consent and LI Transparency for
23440
+ * purposes outside of the TCF
23441
+ */ __publicField(_assert_this_initialized(_this), "customPurposes");
23442
+ /**
23443
+ * Each [[Vendor]] is keyed by id. Their consent value is true if it is in
23444
+ * the Vector
23445
+ */ __publicField(_assert_this_initialized(_this), "vendorConsents", new Vector());
23446
+ /**
23447
+ * Each [[Vendor]] is keyed by id. Whether their Legitimate Interests
23448
+ * Disclosures have been established is stored as boolean.
23449
+ * see: [[Vector]]
23450
+ */ __publicField(_assert_this_initialized(_this), "vendorLegitimateInterests", new Vector());
23451
+ /**
23452
+ * The value included for disclosed vendors signals which vendors have been
23453
+ * disclosed to the user in the interface surfaced by the CMP. This section
23454
+ * content is required when writing a TC string to the global (consensu)
23455
+ * scope. When a CMP has read from and is updating a TC string from the
23456
+ * global consensu.org storage, the CMP MUST retain the existing disclosure
23457
+ * information and only add information for vendors that it has disclosed
23458
+ * that had not been disclosed by other CMPs in prior interactions with this
23459
+ * device/user agent.
23460
+ */ __publicField(_assert_this_initialized(_this), "vendorsDisclosed", new Vector());
23461
+ /**
23462
+ * Signals which vendors the publisher permits to use OOB legal bases.
23463
+ */ __publicField(_assert_this_initialized(_this), "vendorsAllowed", new Vector());
23464
+ __publicField(_assert_this_initialized(_this), "publisherRestrictions", new PurposeRestrictionVector());
23465
+ if (gvl) {
23466
+ _this.gvl = gvl;
23467
+ }
23468
+ _this.updated();
23469
+ return _this;
23470
+ }
23471
+ _create_class(TCModel, [
23472
+ {
23473
+ key: "gvl",
23474
+ get: /**
23475
+ * @return {GVL} the gvl instance set on this TCModel instance
23476
+ */ function get() {
23477
+ return this.gvl_;
23478
+ },
23479
+ set: /**
23480
+ * sets the [[GVL]] with side effects of also setting the `vendorListVersion`, `policyVersion`, and `consentLanguage`
23481
+ * @param {GVL} gvl
23482
+ */ function set(gvl) {
23483
+ if (!GVL.isInstanceOf(gvl)) {
23484
+ gvl = new GVL(gvl);
23485
+ }
23486
+ this.gvl_ = gvl;
23487
+ this.publisherRestrictions.gvl = gvl;
23488
+ }
23489
+ },
23490
+ {
23491
+ key: "cmpId",
23492
+ get: function get() {
23493
+ return this.cmpId_;
23494
+ },
23495
+ set: /**
23496
+ * @param {number} integer - A unique ID will be assigned to each Consent
23497
+ * Manager Provider (CMP) from the iab.
23498
+ *
23499
+ * @throws {TCModelError} if the value is not an integer greater than 1 as those are not valid.
23500
+ */ function set(integer) {
23501
+ integer = Number(integer);
23502
+ if (Number.isInteger(integer) && integer > 1) {
23503
+ this.cmpId_ = integer;
23504
+ } else {
23505
+ throw new TCModelError("cmpId", integer);
23506
+ }
23507
+ }
23508
+ },
23509
+ {
23510
+ key: "cmpVersion",
23511
+ get: function get() {
23512
+ return this.cmpVersion_;
23513
+ },
23514
+ set: /**
23515
+ * Each change to an operating CMP should receive a
23516
+ * new version number, for logging proof of consent. CmpVersion defined by
23517
+ * each CMP.
23518
+ *
23519
+ * @param {number} integer
23520
+ *
23521
+ * @throws {TCModelError} if the value is not an integer greater than 1 as those are not valid.
23522
+ */ function set(integer) {
23523
+ integer = Number(integer);
23524
+ if (Number.isInteger(integer) && integer > -1) {
23525
+ this.cmpVersion_ = integer;
23526
+ } else {
23527
+ throw new TCModelError("cmpVersion", integer);
23528
+ }
23529
+ }
23530
+ },
23531
+ {
23532
+ key: "consentScreen",
23533
+ get: function get() {
23534
+ return this.consentScreen_;
23535
+ },
23536
+ set: /**
23537
+ * The screen number is CMP and CmpVersion
23538
+ * specific, and is for logging proof of consent.(For example, a CMP could
23539
+ * keep records so that a publisher can request information about the context
23540
+ * in which consent was gathered.)
23541
+ *
23542
+ * @param {number} integer
23543
+ *
23544
+ * @throws {TCModelError} if the value is not an integer greater than 0 as those are not valid.
23545
+ */ function set(integer) {
23546
+ integer = Number(integer);
23547
+ if (Number.isInteger(integer) && integer > -1) {
23548
+ this.consentScreen_ = integer;
23549
+ } else {
23550
+ throw new TCModelError("consentScreen", integer);
23551
+ }
23552
+ }
23553
+ },
23554
+ {
23555
+ key: "consentLanguage",
23556
+ get: function get() {
23557
+ return this.consentLanguage_;
23558
+ },
23559
+ set: /**
23560
+ * @param {string} lang - [two-letter ISO 639-1 language
23561
+ * code](http://www.loc.gov/standards/iso639-2/php/code_list.php) in which
23562
+ * the CMP UI was presented
23563
+ *
23564
+ * @throws {TCModelError} if the value is not a length-2 string of alpha characters
23565
+ */ function set(lang) {
23566
+ this.consentLanguage_ = lang;
23567
+ }
23568
+ },
23569
+ {
23570
+ key: "publisherCountryCode",
23571
+ get: function get() {
23572
+ return this.publisherCountryCode_;
23573
+ },
23574
+ set: /**
23575
+ * @param {string} countryCode - [two-letter ISO 3166-1 alpha-2 country
23576
+ * code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) of the publisher,
23577
+ * determined by the CMP-settings of the publisher.
23578
+ *
23579
+ * @throws {TCModelError} if the value is not a length-2 string of alpha characters
23580
+ */ function set(countryCode) {
23581
+ if (/^([A-z]){2}$/.test(countryCode)) {
23582
+ this.publisherCountryCode_ = countryCode.toUpperCase();
23583
+ } else {
23584
+ throw new TCModelError("publisherCountryCode", countryCode);
23585
+ }
23586
+ }
23587
+ },
23588
+ {
23589
+ key: "vendorListVersion",
23590
+ get: function get() {
23591
+ if (this.gvl) {
23592
+ return this.gvl.vendorListVersion;
23593
+ } else {
23594
+ return this.vendorListVersion_;
23595
+ }
23596
+ },
23597
+ set: /**
23598
+ * Version of the GVL used to create this TCModel. Global
23599
+ * Vendor List versions will be released periodically.
23600
+ *
23601
+ * @param {number} integer
23602
+ *
23603
+ * @throws {TCModelError} if the value is not an integer greater than 0 as those are not valid.
23604
+ */ function set(integer) {
23605
+ integer = Number(integer) >> 0;
23606
+ if (integer < 0) {
23607
+ throw new TCModelError("vendorListVersion", integer);
23608
+ } else {
23609
+ this.vendorListVersion_ = integer;
23610
+ }
23611
+ }
23612
+ },
23613
+ {
23614
+ key: "policyVersion",
23615
+ get: function get() {
23616
+ if (this.gvl) {
23617
+ return this.gvl.tcfPolicyVersion;
23618
+ } else {
23619
+ return this.policyVersion_;
23620
+ }
23621
+ },
23622
+ set: /**
23623
+ * From the corresponding field in the GVL that was
23624
+ * used for obtaining consent. A new policy version invalidates existing
23625
+ * strings and requires CMPs to re-establish transparency and consent from
23626
+ * users.
23627
+ *
23628
+ * If a TCF policy version number is different from the one from the latest
23629
+ * GVL, the CMP must re-establish transparency and consent.
23630
+ *
23631
+ * @param {number} num - You do not need to set this. This comes
23632
+ * directly from the [[GVL]].
23633
+ *
23634
+ */ function set(num) {
23635
+ this.policyVersion_ = parseInt(num, 10);
23636
+ if (this.policyVersion_ < 0) {
23637
+ throw new TCModelError("policyVersion", num);
23638
+ }
23639
+ }
23640
+ },
23641
+ {
23642
+ key: "version",
23643
+ get: function get() {
23644
+ return this.version_;
23645
+ },
23646
+ set: function set(num) {
23647
+ this.version_ = parseInt(num, 10);
23648
+ }
23649
+ },
23650
+ {
23651
+ key: "isServiceSpecific",
23652
+ get: function get() {
23653
+ return this.isServiceSpecific_;
23654
+ },
23655
+ set: /**
23656
+ * Whether the signals encoded in this TC String were from site-specific
23657
+ * storage `true` versus ‘global’ consensu.org shared storage `false`. A
23658
+ * string intended to be stored in global/shared scope but the CMP is unable
23659
+ * to store due to a user agent not accepting third-party cookies would be
23660
+ * considered site-specific `true`.
23661
+ *
23662
+ * @param {boolean} bool - value to set. Some changes to other fields in this
23663
+ * model will automatically change this value like adding publisher
23664
+ * restrictions.
23665
+ */ function set(bool) {
23666
+ this.isServiceSpecific_ = bool;
23667
+ }
23668
+ },
23669
+ {
23670
+ key: "useNonStandardStacks",
23671
+ get: function get() {
23672
+ return this.useNonStandardStacks_;
23673
+ },
23674
+ set: /**
23675
+ * Non-standard stacks means that a CMP is using publisher-customized stack
23676
+ * descriptions. Stacks (in terms of purposes in a stack) are pre-set by the
23677
+ * IAB. As are titles. Descriptions are pre-set, but publishers can customize
23678
+ * them. If they do, they need to set this bit to indicate that they've
23679
+ * customized descriptions.
23680
+ *
23681
+ * @param {boolean} bool - value to set
23682
+ */ function set(bool) {
23683
+ this.useNonStandardStacks_ = bool;
23684
+ }
23685
+ },
23686
+ {
23687
+ key: "supportOOB",
23688
+ get: function get() {
23689
+ return this.supportOOB_;
23690
+ },
23691
+ set: /**
23692
+ * Whether or not this publisher supports OOB signaling. On Global TC String
23693
+ * OOB Vendors Disclosed will be included if the publish wishes to no allow
23694
+ * these vendors they should set this to false.
23695
+ * @param {boolean} bool - value to set
23696
+ */ function set(bool) {
23697
+ this.supportOOB_ = bool;
23698
+ }
23699
+ },
23700
+ {
23701
+ key: "purposeOneTreatment",
23702
+ get: function get() {
23703
+ return this.purposeOneTreatment_;
23704
+ },
23705
+ set: /**
23706
+ * `false` There is no special Purpose 1 status.
23707
+ * Purpose 1 was disclosed normally (consent) as expected by Policy. `true`
23708
+ * Purpose 1 not disclosed at all. CMPs use PublisherCC to indicate the
23709
+ * publisher’s country of establishment to help Vendors determine whether the
23710
+ * vendor requires Purpose 1 consent. In global scope TC strings, this field
23711
+ * must always have a value of `false`. When a CMP encounters a global scope
23712
+ * string with `purposeOneTreatment=true` then that string should be
23713
+ * considered invalid and the CMP must re-establish transparency and consent.
23714
+ *
23715
+ * @param {boolean} bool
23716
+ */ function set(bool) {
23717
+ this.purposeOneTreatment_ = bool;
23718
+ }
23719
+ },
23720
+ {
23721
+ /**
23722
+ * setAllVendorConsents - sets all vendors on the GVL Consent (true)
23723
+ *
23724
+ * @return {void}
23725
+ */ key: "setAllVendorConsents",
23726
+ value: function setAllVendorConsents() {
23727
+ this.vendorConsents.set(this.gvl.vendors);
23728
+ }
23729
+ },
23730
+ {
23731
+ /**
23732
+ * unsetAllVendorConsents - unsets all vendors on the GVL Consent (false)
23733
+ *
23734
+ * @return {void}
23735
+ */ key: "unsetAllVendorConsents",
23736
+ value: function unsetAllVendorConsents() {
23737
+ this.vendorConsents.empty();
23738
+ }
23739
+ },
23740
+ {
23741
+ /**
23742
+ * setAllVendorsDisclosed - sets all vendors on the GVL Vendors Disclosed (true)
23743
+ *
23744
+ * @return {void}
23745
+ */ key: "setAllVendorsDisclosed",
23746
+ value: function setAllVendorsDisclosed() {
23747
+ this.vendorsDisclosed.set(this.gvl.vendors);
23748
+ }
23749
+ },
23750
+ {
23751
+ /**
23752
+ * unsetAllVendorsDisclosed - unsets all vendors on the GVL Consent (false)
23753
+ *
23754
+ * @return {void}
23755
+ */ key: "unsetAllVendorsDisclosed",
23756
+ value: function unsetAllVendorsDisclosed() {
23757
+ this.vendorsDisclosed.empty();
23758
+ }
23759
+ },
23760
+ {
23761
+ /**
23762
+ * setAllVendorsAllowed - sets all vendors on the GVL Consent (true)
23763
+ *
23764
+ * @return {void}
23765
+ */ key: "setAllVendorsAllowed",
23766
+ value: function setAllVendorsAllowed() {
23767
+ this.vendorsAllowed.set(this.gvl.vendors);
23768
+ }
23769
+ },
23770
+ {
23771
+ /**
23772
+ * unsetAllVendorsAllowed - unsets all vendors on the GVL Consent (false)
23773
+ *
23774
+ * @return {void}
23775
+ */ key: "unsetAllVendorsAllowed",
23776
+ value: function unsetAllVendorsAllowed() {
23777
+ this.vendorsAllowed.empty();
23778
+ }
23779
+ },
23780
+ {
23781
+ /**
23782
+ * setAllVendorLegitimateInterests - sets all vendors on the GVL LegitimateInterests (true)
23783
+ *
23784
+ * @return {void}
23785
+ */ key: "setAllVendorLegitimateInterests",
23786
+ value: function setAllVendorLegitimateInterests() {
23787
+ this.vendorLegitimateInterests.set(this.gvl.vendors);
23788
+ }
23789
+ },
23790
+ {
23791
+ /**
23792
+ * unsetAllVendorLegitimateInterests - unsets all vendors on the GVL LegitimateInterests (false)
23793
+ *
23794
+ * @return {void}
23795
+ */ key: "unsetAllVendorLegitimateInterests",
23796
+ value: function unsetAllVendorLegitimateInterests() {
23797
+ this.vendorLegitimateInterests.empty();
23798
+ }
23799
+ },
23800
+ {
23801
+ /**
23802
+ * setAllPurposeConsents - sets all purposes on the GVL Consent (true)
23803
+ *
23804
+ * @return {void}
23805
+ */ key: "setAllPurposeConsents",
23806
+ value: function setAllPurposeConsents() {
23807
+ this.purposeConsents.set(this.gvl.purposes);
23808
+ }
23809
+ },
23810
+ {
23811
+ /**
23812
+ * unsetAllPurposeConsents - unsets all purposes on the GVL Consent (false)
23813
+ *
23814
+ * @return {void}
23815
+ */ key: "unsetAllPurposeConsents",
23816
+ value: function unsetAllPurposeConsents() {
23817
+ this.purposeConsents.empty();
23818
+ }
23819
+ },
23820
+ {
23821
+ /**
23822
+ * setAllPurposeLegitimateInterests - sets all purposes on the GVL LI Transparency (true)
23823
+ *
23824
+ * @return {void}
23825
+ */ key: "setAllPurposeLegitimateInterests",
23826
+ value: function setAllPurposeLegitimateInterests() {
23827
+ this.purposeLegitimateInterests.set(this.gvl.purposes);
23828
+ }
23829
+ },
23830
+ {
23831
+ /**
23832
+ * unsetAllPurposeLegitimateInterests - unsets all purposes on the GVL LI Transparency (false)
23833
+ *
23834
+ * @return {void}
23835
+ */ key: "unsetAllPurposeLegitimateInterests",
23836
+ value: function unsetAllPurposeLegitimateInterests() {
23837
+ this.purposeLegitimateInterests.empty();
23838
+ }
23839
+ },
23840
+ {
23841
+ /**
23842
+ * setAllSpecialFeatureOptins - sets all special featuresOptins on the GVL (true)
23843
+ *
23844
+ * @return {void}
23845
+ */ key: "setAllSpecialFeatureOptins",
23846
+ value: function setAllSpecialFeatureOptins() {
23847
+ this.specialFeatureOptins.set(this.gvl.specialFeatures);
23848
+ }
23849
+ },
23850
+ {
23851
+ /**
23852
+ * unsetAllSpecialFeatureOptins - unsets all special featuresOptins on the GVL (true)
23853
+ *
23854
+ * @return {void}
23855
+ */ key: "unsetAllSpecialFeatureOptins",
23856
+ value: function unsetAllSpecialFeatureOptins() {
23857
+ this.specialFeatureOptins.empty();
23858
+ }
23859
+ },
23860
+ {
23861
+ key: "setAll",
23862
+ value: function setAll() {
23863
+ this.setAllVendorConsents();
23864
+ this.setAllPurposeLegitimateInterests();
23865
+ this.setAllSpecialFeatureOptins();
23866
+ this.setAllPurposeConsents();
23867
+ this.setAllVendorLegitimateInterests();
23868
+ }
23869
+ },
23870
+ {
23871
+ key: "unsetAll",
23872
+ value: function unsetAll() {
23873
+ this.unsetAllVendorConsents();
23874
+ this.unsetAllPurposeLegitimateInterests();
23875
+ this.unsetAllSpecialFeatureOptins();
23876
+ this.unsetAllPurposeConsents();
23877
+ this.unsetAllVendorLegitimateInterests();
23878
+ }
23879
+ },
23880
+ {
23881
+ key: "numCustomPurposes",
23882
+ get: function get() {
23883
+ var len = this.numCustomPurposes_;
23884
+ if (typeof this.customPurposes === "object") {
23885
+ var purposeIds = Object.keys(this.customPurposes).sort(function(a, b) {
23886
+ return Number(a) - Number(b);
23887
+ });
23888
+ len = parseInt(purposeIds.pop(), 10);
23889
+ }
23890
+ return len;
23891
+ },
23892
+ set: function set(num) {
23893
+ this.numCustomPurposes_ = parseInt(num, 10);
23894
+ if (this.numCustomPurposes_ < 0) {
23895
+ throw new TCModelError("numCustomPurposes", num);
23896
+ }
23897
+ }
23898
+ },
23899
+ {
23900
+ /**
23901
+ * updated - updates the created and lastUpdated dates with a 'now' day-level UTC timestamp
23902
+ *
23903
+ * @return {void}
23904
+ */ key: "updated",
23905
+ value: function updated() {
23906
+ var date = /* @__PURE__ */ new Date();
23907
+ var utcDate = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate()));
23908
+ this.created = utcDate;
23909
+ this.lastUpdated = utcDate;
23910
+ }
23911
+ }
23912
+ ]);
23913
+ return TCModel;
23914
+ }(Cloneable);
23915
+ /**
23916
+ * Set of available consent languages published by the IAB
23917
+ */ __publicField(TCModel, "consentLanguages", GVL.consentLanguages);
23918
+ // node_modules/@iabtcf/core/lib/mjs/TCString.js
23919
+ var TCString = /*#__PURE__*/ function() {
23920
+ "use strict";
23921
+ function TCString() {
23922
+ _class_call_check(this, TCString);
23923
+ }
23924
+ _create_class(TCString, null, [
23925
+ {
23926
+ key: "encode",
23927
+ value: /**
23928
+ * encodes a model into a TCString
23929
+ *
23930
+ * @param {TCModel} tcModel - model to convert into encoded string
23931
+ * @param {EncodingOptions} options - for encoding options other than default
23932
+ * @return {string} - base64url encoded Transparency and Consent String
23933
+ */ function encode(tcModel, options) {
23934
+ var out = "";
23935
+ var sequence;
23936
+ tcModel = SemanticPreEncoder.process(tcModel, options);
23937
+ if (Array.isArray(options === null || options === void 0 ? void 0 : options.segments)) {
23938
+ sequence = options.segments;
23939
+ } else {
23940
+ sequence = new SegmentSequence(tcModel, options)["" + tcModel.version];
23941
+ }
23942
+ sequence.forEach(function(segment, idx) {
23943
+ var dotMaybe = "";
23944
+ if (idx < sequence.length - 1) {
23945
+ dotMaybe = ".";
23946
+ }
23947
+ out += SegmentEncoder.encode(tcModel, segment) + dotMaybe;
23948
+ });
23949
+ return out;
23950
+ }
23951
+ },
23952
+ {
23953
+ key: "decode",
23954
+ value: /**
23955
+ * Decodes a string into a TCModel
23956
+ *
23957
+ * @param {string} encodedTCString - base64url encoded Transparency and
23958
+ * Consent String to decode - can also be a single or group of segments of
23959
+ * the string
23960
+ * @param {string} [tcModel] - model to enhance with the information. If
23961
+ * none is passed a new instance of TCModel will be created.
23962
+ * @return {TCModel} - Returns populated TCModel
23963
+ */ function decode(encodedTCString, tcModel) {
23964
+ var segments = encodedTCString.split(".");
23965
+ var len = segments.length;
23966
+ if (!tcModel) {
23967
+ tcModel = new TCModel();
23968
+ }
23969
+ for(var i2 = 0; i2 < len; i2++){
23970
+ var segString = segments[i2];
23971
+ var firstChar = Base64Url.decode(segString.charAt(0));
23972
+ var segTypeBits = firstChar.substr(0, BitLength.segmentType);
23973
+ var segment = SegmentIDs.ID_TO_KEY[IntEncoder.decode(segTypeBits, BitLength.segmentType).toString()];
23974
+ SegmentEncoder.decode(segString, tcModel, segment);
23975
+ }
23976
+ return tcModel;
23977
+ }
23978
+ }
23979
+ ]);
23980
+ return TCString;
23981
+ }();
23982
+ // src/Ads/Providers/SmartyAds/SmartyAdsSDK.ts
23983
+ GVL.baseUrl = "https://vendor-list.consensu.org/v3/";
23984
+ var PARAMS = [
23985
+ "res",
23986
+ "m",
23987
+ "ua",
23988
+ "ip",
23989
+ "w",
23990
+ "h",
23991
+ "gdpr",
23992
+ "gdpr_consent",
23993
+ "gpp",
23994
+ "gpp_sid",
23995
+ "coppa",
23996
+ "page",
23997
+ "domain",
23998
+ "secure",
23999
+ "lmt",
24000
+ "dnt",
24001
+ "ad_width",
24002
+ "ad_height",
24003
+ "language",
24004
+ "cattax",
24005
+ "keywords",
24006
+ "placementId"
24007
+ ];
24008
+ var SmartyadsSDK = /*#__PURE__*/ function() {
24009
+ "use strict";
24010
+ function SmartyadsSDK() {
24011
+ _class_call_check(this, SmartyadsSDK);
24012
+ }
24013
+ _create_class(SmartyadsSDK, [
24014
+ {
24015
+ key: "generateTCString",
24016
+ value: function generateTCString() {
24017
+ var _this = this;
24018
+ return _async_to_generator(function() {
24019
+ var tcModel;
24020
+ return _ts_generator(this, function(_state) {
24021
+ switch(_state.label){
24022
+ case 0:
24023
+ if (!!_this.gdprConsent) return [
24024
+ 3,
24025
+ 2
24026
+ ];
24027
+ tcModel = new TCModel(new GVL());
24028
+ tcModel.vendorConsents.set(534);
24029
+ return [
24030
+ 4,
24031
+ tcModel.gvl.readyPromise
24032
+ ];
24033
+ case 1:
24034
+ _state.sent();
24035
+ _this.gdprConsent = TCString.encode(tcModel);
24036
+ console.log(_this.gdprConsent);
24037
+ _state.label = 2;
24038
+ case 2:
24039
+ return [
24040
+ 2,
24041
+ _this.gdprConsent
24042
+ ];
24043
+ }
24044
+ });
24045
+ })();
24046
+ }
24047
+ },
24048
+ {
24049
+ key: "buildQueryParams",
24050
+ value: /**
24051
+ * Converts an object into a URL query string.
24052
+ *
24053
+ * @param params - The object to be converted into query parameters.
24054
+ * @returns The query string with URL encoding.
24055
+ */ function buildQueryParams(params) {
24056
+ var _this = this;
24057
+ return _async_to_generator(function() {
24058
+ var queryString;
24059
+ return _ts_generator(this, function(_state) {
24060
+ switch(_state.label){
24061
+ case 0:
24062
+ if (!(params.gdpr === void 0)) return [
24063
+ 3,
24064
+ 2
24065
+ ];
24066
+ params.gdpr = 1;
24067
+ return [
24068
+ 4,
24069
+ _this.generateTCString()
24070
+ ];
24071
+ case 1:
24072
+ params.gdpr_consent = _state.sent();
24073
+ _state.label = 2;
24074
+ case 2:
24075
+ queryString = PARAMS.map(function(key) {
24076
+ var value2 = params[key];
24077
+ if (value2 === null || value2 === void 0) {
24078
+ return "";
24079
+ }
24080
+ return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value2));
24081
+ }).filter(function(part) {
24082
+ return part.length > 0;
24083
+ }).join("&");
24084
+ return [
24085
+ 2,
24086
+ queryString
24087
+ ];
24088
+ }
24089
+ });
24090
+ })();
24091
+ }
24092
+ },
24093
+ {
24094
+ key: "request",
24095
+ value: function request(params) {
24096
+ var _this = this;
24097
+ return _async_to_generator(function() {
24098
+ var _, _1;
24099
+ return _ts_generator(this, function(_state) {
24100
+ switch(_state.label){
24101
+ case 0:
24102
+ _1 = (_ = "https://n1.smartyads.com/?c=b&").concat;
24103
+ return [
24104
+ 4,
24105
+ _this.buildQueryParams(params)
24106
+ ];
24107
+ case 1:
24108
+ return [
24109
+ 2,
24110
+ fetch.apply(void 0, [
24111
+ _1.apply(_, [
24112
+ _state.sent()
24113
+ ])
24114
+ ]).then(function(response) {
24115
+ if (!response.ok) {
24116
+ throw new InternalError("Network response was not ok");
24117
+ }
24118
+ return response.json();
24119
+ }).then(function(data) {
24120
+ return data;
24121
+ }).catch(function(error) {
24122
+ throw error;
24123
+ })
24124
+ ];
24125
+ }
24126
+ });
24127
+ })();
24128
+ }
24129
+ }
24130
+ ]);
24131
+ return SmartyadsSDK;
24132
+ }();
24133
+ // src/Ads/Providers/SmartyAds/SmartyadsProvider.ts
24134
+ var SmartyadsProvider = /*#__PURE__*/ function(ContentProvider) {
24135
+ "use strict";
24136
+ _inherits(SmartyadsProvider, ContentProvider);
24137
+ var _super = _create_super(SmartyadsProvider);
24138
+ function SmartyadsProvider(context, options) {
24139
+ _class_call_check(this, SmartyadsProvider);
24140
+ var _this;
24141
+ _this = _super.call(this, context, options);
24142
+ _this.placements = options.placements || {};
24143
+ _this.smartyads = new SmartyadsSDK();
24144
+ return _this;
24145
+ }
24146
+ _create_class(SmartyadsProvider, [
24147
+ {
24148
+ key: "getPlacement",
24149
+ value: function getPlacement(regionId) {
24150
+ var availablePlacements = Object.keys(this.placements).map(parseInt);
24151
+ if (!availablePlacements.length) {
24152
+ throw new Error("No available placements!");
24153
+ }
24154
+ var foundPlacement;
24155
+ if (!regionId) {
24156
+ foundPlacement = this.placements[availablePlacements[0]];
24157
+ } else {
24158
+ foundPlacement = this.placements[regionId];
24159
+ }
24160
+ if (typeof foundPlacement === "number") {
24161
+ return {
24162
+ id: foundPlacement
24163
+ };
24164
+ }
24165
+ return foundPlacement;
24166
+ }
24167
+ },
24168
+ {
24169
+ key: "request",
24170
+ value: function request(params) {
24171
+ var _this = this;
24172
+ return _async_to_generator(function() {
24173
+ var _params_params, placementInfo, smartyadsContent, div, index;
24174
+ return _ts_generator(this, function(_state) {
24175
+ switch(_state.label){
24176
+ case 0:
24177
+ if (!params || params.size.width === void 0 || params.size.width === 0 || params.size.height === void 0 || params.size.height === 0) {
24178
+ throw new InternalError("No Params!");
24179
+ }
24180
+ placementInfo = _this.getPlacement((_params_params = params.params) === null || _params_params === void 0 ? void 0 : _params_params.regionId);
24181
+ return [
24182
+ 4,
24183
+ _this.smartyads.request(_object_spread_props(_object_spread({}, _this.options), {
24184
+ ad_width: placementInfo.w || params.size.width,
24185
+ ad_height: placementInfo.h || params.size.height,
24186
+ m: "api",
24187
+ ua: _this.context.info.ua || navigator.userAgent,
24188
+ w: window.innerWidth,
24189
+ h: window.innerHeight,
24190
+ domain: _this.context.info.domain || window.location.hostname,
24191
+ page: window.location.href,
24192
+ ip: _this.context.info.ip,
24193
+ placementId: placementInfo.id
24194
+ }))
20824
24195
  ];
20825
24196
  case 1:
20826
24197
  smartyadsContent = _state.sent();
@@ -21573,25 +24944,25 @@ function _iterableToArray(iter) {
21573
24944
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
21574
24945
  }
21575
24946
  function _iterableToArrayLimit(arr, i2) {
21576
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
21577
- if (_i == null) return;
24947
+ var _i2 = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
24948
+ if (_i2 == null) return;
21578
24949
  var _arr = [];
21579
- var _n = true;
21580
- var _d = false;
21581
- var _s, _e;
24950
+ var _n2 = true;
24951
+ var _d2 = false;
24952
+ var _s, _e2;
21582
24953
  try {
21583
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
24954
+ for(_i2 = _i2.call(arr); !(_n2 = (_s = _i2.next()).done); _n2 = true){
21584
24955
  _arr.push(_s.value);
21585
24956
  if (i2 && _arr.length === i2) break;
21586
24957
  }
21587
24958
  } catch (err) {
21588
- _d = true;
21589
- _e = err;
24959
+ _d2 = true;
24960
+ _e2 = err;
21590
24961
  } finally{
21591
24962
  try {
21592
- if (!_n && _i["return"] != null) _i["return"]();
24963
+ if (!_n2 && _i2["return"] != null) _i2["return"]();
21593
24964
  } finally{
21594
- if (_d) throw _e;
24965
+ if (_d2) throw _e2;
21595
24966
  }
21596
24967
  }
21597
24968
  return _arr;
@@ -26098,7 +29469,7 @@ var Request2 = /*#__PURE__*/ function(Emitter) {
26098
29469
  */ key: "create",
26099
29470
  value: function create() {
26100
29471
  var _this = this;
26101
- var _a;
29472
+ var _a2;
26102
29473
  var opts = pick(this.opts, "agent", "pfx", "key", "passphrase", "cert", "ca", "ciphers", "rejectUnauthorized", "autoUnref");
26103
29474
  opts.xdomain = !!this.opts.xd;
26104
29475
  var xhr = this.xhr = new XHR(opts);
@@ -26122,7 +29493,7 @@ var Request2 = /*#__PURE__*/ function(Emitter) {
26122
29493
  try {
26123
29494
  xhr.setRequestHeader("Accept", "*/*");
26124
29495
  } catch (e2) {}
26125
- (_a = this.opts.cookieJar) === null || _a === void 0 ? void 0 : _a.addCookies(xhr);
29496
+ (_a2 = this.opts.cookieJar) === null || _a2 === void 0 ? void 0 : _a2.addCookies(xhr);
26126
29497
  if ("withCredentials" in xhr) {
26127
29498
  xhr.withCredentials = this.opts.withCredentials;
26128
29499
  }
@@ -26130,9 +29501,9 @@ var Request2 = /*#__PURE__*/ function(Emitter) {
26130
29501
  xhr.timeout = this.opts.requestTimeout;
26131
29502
  }
26132
29503
  xhr.onreadystatechange = function() {
26133
- var _a2;
29504
+ var _a3;
26134
29505
  if (xhr.readyState === 3) {
26135
- (_a2 = _this.opts.cookieJar) === null || _a2 === void 0 ? void 0 : _a2.parseCookies(xhr);
29506
+ (_a3 = _this.opts.cookieJar) === null || _a3 === void 0 ? void 0 : _a3.parseCookies(xhr);
26136
29507
  }
26137
29508
  if (4 !== xhr.readyState) return;
26138
29509
  if (200 === xhr.status || 1223 === xhr.status) {
@@ -26483,8 +29854,8 @@ var WT = /*#__PURE__*/ function(Transport) {
26483
29854
  {
26484
29855
  key: "doClose",
26485
29856
  value: function doClose() {
26486
- var _a;
26487
- (_a = this.transport) === null || _a === void 0 ? void 0 : _a.close();
29857
+ var _a2;
29858
+ (_a2 = this.transport) === null || _a2 === void 0 ? void 0 : _a2.close();
26488
29859
  }
26489
29860
  }
26490
29861
  ]);
@@ -27761,8 +31132,8 @@ var Socket2 = /*#__PURE__*/ function(Emitter) {
27761
31132
  value: function _registerAckCallback(id, ack) {
27762
31133
  var _this = this;
27763
31134
  var _this1 = this;
27764
- var _a;
27765
- var timeout = (_a = this.flags.timeout) !== null && _a !== void 0 ? _a : this._opts.ackTimeout;
31135
+ var _a2;
31136
+ var timeout = (_a2 = this.flags.timeout) !== null && _a2 !== void 0 ? _a2 : this._opts.ackTimeout;
27766
31137
  if (timeout === void 0) {
27767
31138
  this.acks[id] = ack;
27768
31139
  return;
@@ -28518,7 +31889,7 @@ var Manager = /*#__PURE__*/ function(Emitter) {
28518
31889
  function Manager(uri, opts) {
28519
31890
  _class_call_check(this, Manager);
28520
31891
  var _this;
28521
- var _a;
31892
+ var _a2;
28522
31893
  _this = _super.call(this);
28523
31894
  _this.nsps = {};
28524
31895
  _this.subs = [];
@@ -28534,7 +31905,7 @@ var Manager = /*#__PURE__*/ function(Emitter) {
28534
31905
  _this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);
28535
31906
  _this.reconnectionDelay(opts.reconnectionDelay || 1e3);
28536
31907
  _this.reconnectionDelayMax(opts.reconnectionDelayMax || 5e3);
28537
- _this.randomizationFactor((_a = opts.randomizationFactor) !== null && _a !== void 0 ? _a : 0.5);
31908
+ _this.randomizationFactor((_a2 = opts.randomizationFactor) !== null && _a2 !== void 0 ? _a2 : 0.5);
28538
31909
  _this.backoff = new Backoff({
28539
31910
  min: _this.reconnectionDelay(),
28540
31911
  max: _this.reconnectionDelayMax(),
@@ -28570,30 +31941,30 @@ var Manager = /*#__PURE__*/ function(Emitter) {
28570
31941
  {
28571
31942
  key: "reconnectionDelay",
28572
31943
  value: function reconnectionDelay(v) {
28573
- var _a;
31944
+ var _a2;
28574
31945
  if (v === void 0) return this._reconnectionDelay;
28575
31946
  this._reconnectionDelay = v;
28576
- (_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setMin(v);
31947
+ (_a2 = this.backoff) === null || _a2 === void 0 ? void 0 : _a2.setMin(v);
28577
31948
  return this;
28578
31949
  }
28579
31950
  },
28580
31951
  {
28581
31952
  key: "randomizationFactor",
28582
31953
  value: function randomizationFactor(v) {
28583
- var _a;
31954
+ var _a2;
28584
31955
  if (v === void 0) return this._randomizationFactor;
28585
31956
  this._randomizationFactor = v;
28586
- (_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setJitter(v);
31957
+ (_a2 = this.backoff) === null || _a2 === void 0 ? void 0 : _a2.setJitter(v);
28587
31958
  return this;
28588
31959
  }
28589
31960
  },
28590
31961
  {
28591
31962
  key: "reconnectionDelayMax",
28592
31963
  value: function reconnectionDelayMax(v) {
28593
- var _a;
31964
+ var _a2;
28594
31965
  if (v === void 0) return this._reconnectionDelayMax;
28595
31966
  this._reconnectionDelayMax = v;
28596
- (_a = this.backoff) === null || _a === void 0 ? void 0 : _a.setMax(v);
31967
+ (_a2 = this.backoff) === null || _a2 === void 0 ? void 0 : _a2.setMax(v);
28597
31968
  return this;
28598
31969
  }
28599
31970
  },
@@ -30256,7 +33627,7 @@ var BrndtsAds = /*#__PURE__*/ function() {
30256
33627
  }
30257
33628
  } catch (error) {
30258
33629
  if (_instanceof(error, Error)) {
30259
- ErrorHandler.handle(error);
33630
+ this.context.logger.warn("Setup failed: no media element found!");
30260
33631
  }
30261
33632
  }
30262
33633
  }