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