import{o as e,h as t,i as s,r as i,j as n,m as o,S as r,p as a,v as c,u,q as l,s as d,A as p,b as h,D as v,x as f,z as g,B as m,E as I,F as C,G as y,H as S,J as E,L as V,M as T,g as b,P as D,Q as A,T as M,U as L,V as w,I as _,Y as k,R as N,N as R,a0 as O,a1 as F,a2 as P,a3 as U,a4 as G,a5 as Q,a6 as x,a7 as B,a8 as H,a9 as j,aa as q,ab as W,_ as z,K as X,ac as J,ad as K,ae as Y,af as Z,ag as $,ah as ee,ai as te,aj as se,ak as ie}from"./index.module.js";import ne from"./DefaultData-90e20df0-73e6fe6d.js";var oe,re,ae,ce,ue;(ue=oe||(oe={})).PING="ping",ue.GET_TC_DATA="getTCData",ue.GET_IN_APP_TC_DATA="getInAppTCData",ue.GET_VENDOR_LIST="getVendorList",ue.ADD_EVENT_LISTENER="addEventListener",ue.REMOVE_EVENT_LISTENER="removeEventListener",function(e){e.STUB="stub",e.LOADING="loading",e.LOADED="loaded",e.ERROR="error"}(re||(re={})),function(e){e.VISIBLE="visible",e.HIDDEN="hidden",e.DISABLED="disabled"}(ae||(ae={})),function(e){e.TC_LOADED="tcloaded",e.CMP_UI_SHOWN="cmpuishown",e.USER_ACTION_COMPLETE="useractioncomplete"}(ce||(ce={}));var le=function(){function t(e,s,o,r){i(this,t),n(this,"listenerId",void 0),n(this,"callback",void 0),n(this,"next",void 0),n(this,"param",void 0),n(this,"success",!0),Object.assign(this,{callback:e,listenerId:o,param:s,next:r});try{this.respond()}catch(e){this.invokeCallback(null)}}return e(t,[{key:"invokeCallback",value:function(e){var t=null!==e;"function"==typeof this.next?this.callback(this.next,e,t):this.callback(e,t)}}]),t}(),de=function(n){t(r,le);var o=s(r);function r(){return i(this,r),o.apply(this,arguments)}return e(r,[{key:"respond",value:function(){this.throwIfParamInvalid(),this.invokeCallback(new Ee(this.param,this.listenerId))}},{key:"throwIfParamInvalid",value:function(){if(!(void 0===this.param||Array.isArray(this.param)&&this.param.every(Number.isInteger)))throw new Error("Invalid Parameter")}}]),r}(),pe=function(){function t(){i(this,t),n(this,"eventQueue",new Map),n(this,"queueNumber",0)}return e(t,[{key:"add",value:function(e){return this.eventQueue.set(this.queueNumber,e),this.queueNumber++}},{key:"remove",value:function(e){return this.eventQueue.delete(e)}},{key:"exec",value:function(){this.eventQueue.forEach((function(e,t){new de(e.callback,e.param,t,e.next)}))}},{key:"clear",value:function(){this.queueNumber=0,this.eventQueue.clear()}},{key:"size",get:function(){return this.eventQueue.size}}]),t}(),he=function(){function t(){i(this,t)}return e(t,null,[{key:"reset",value:function(){delete this.cmpId,delete this.cmpVersion,delete this.eventStatus,delete this.gdprApplies,delete this.tcModel,delete this.tcString,delete this.tcfPolicyVersion,this.cmpStatus=re.LOADING,this.disabled=!1,this.displayStatus=ae.HIDDEN,this.eventQueue.clear()}}]),t}();n(he,"apiVersion","2"),n(he,"tcfPolicyVersion",void 0),n(he,"eventQueue",new pe),n(he,"cmpStatus",re.LOADING),n(he,"disabled",!1),n(he,"displayStatus",ae.HIDDEN),n(he,"cmpId",void 0),n(he,"cmpVersion",void 0),n(he,"eventStatus",void 0),n(he,"gdprApplies",void 0),n(he,"tcModel",void 0),n(he,"tcString",void 0);var ve,fe,ge,me,Ie,Ce,ye=e((function e(){i(this,e),n(this,"cmpId",he.cmpId),n(this,"cmpVersion",he.cmpVersion),n(this,"gdprApplies",he.gdprApplies),n(this,"tcfPolicyVersion",he.tcfPolicyVersion)})),Se=function(r){t(c,ye);var a=s(c);function c(){var e;i(this,c);for(var t=arguments.length,s=new Array(t),r=0;r0)for(var s=e.getMaxVendorId(),i=function(){var s=n.toString();e.getRestrictions(n).forEach((function(e){var i=e.purposeId.toString();t[i]||(t[i]={}),t[i][s]=e.restrictionType}))},n=1;n<=s;n++)i();return t}},{key:"createVectorField",value:function(e,t){return t?t.reduce((function(t,s){return t[String(s)]=e.has(Number(s)),t}),{}):r(e).reduce((function(e,t){return e[t[0].toString(10)]=t[1],e}),{})}}]),u}(),Ve=function(n){t(a,Ee);var o=s(a);function a(e){var t;return i(this,a),delete(t=o.call(this,e)).outOfBand,t}return e(a,[{key:"createVectorField",value:function(e){return r(e).reduce((function(e,t){return e+(t[1]?"1":"0")}),"")}},{key:"createRestrictions",value:function(e){var t={};if(e.numRestrictions>0){var s=e.getMaxVendorId();e.getRestrictions().forEach((function(e){t[e.purposeId.toString()]="_".repeat(s)}));for(var i=function(s){var i=s+1;e.getRestrictions(i).forEach((function(e){var i=e.restrictionType.toString(),n=e.purposeId.toString(),o=t[n].substr(0,s),r=t[n].substr(s+1);t[n]=o+i+r}))},n=0;n3?i-3:0),o=3;o3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4?arguments[4]:void 0;i(this,t),n(this,"callResponder",void 0),n(this,"isServiceSpecific",void 0),n(this,"numUpdates",0),this.throwIfInvalidInt(s,"cmpId",2),this.throwIfInvalidInt(o,"cmpVersion",0),he.cmpId=s,he.cmpVersion=o,he.tcfPolicyVersion=e,this.isServiceSpecific=!!r,this.callResponder=new Ne(a)}return e(t,[{key:"throwIfInvalidInt",value:function(e,t,s){if(!("number"==typeof e&&Number.isInteger(e)&&e>=s))throw new Error("Invalid ".concat(t,": ").concat(e))}},{key:"update",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(he.disabled)throw new Error("CmpApi Disabled");he.cmpStatus=re.LOADED,t?(he.displayStatus=ae.VISIBLE,he.eventStatus=ce.CMP_UI_SHOWN):void 0===he.tcModel?(he.displayStatus=ae.DISABLED,he.eventStatus=ce.TC_LOADED):(he.displayStatus=ae.HIDDEN,he.eventStatus=ce.USER_ACTION_COMPLETE),he.gdprApplies=null!==e,he.gdprApplies?(""===e?(he.tcModel=new l,he.tcModel.cmpId=he.cmpId,he.tcModel.cmpVersion=he.cmpVersion,he.tcModel.policyVersion=he.tcfPolicyVersion):he.tcModel=d.decode(e),he.tcModel.isServiceSpecific=this.isServiceSpecific,he.tcfPolicyVersion=Number(he.tcModel.policyVersion),he.tcString=e):he.tcModel=null,0===this.numUpdates?this.callResponder.purgeQueuedCalls():he.eventQueue.exec(),this.numUpdates++}},{key:"disable",value:function(){he.disabled=!0,he.cmpStatus=re.ERROR}}]),t}(),Oe=function(e){function t(t,s,i,n,o,r,a,c){var u=e.call(this,i,o)||this;u.policyVersion=4,u.locationInstance=J.getInstance(),u.botInstance=K.getInstance(),u.previousStorage=null,u.selectedVendorsIncludeNonDisclosed=!1,u.cmpApi={},u.tcModel=null,u.tcfData=null,u.vendors=[];var l=t.tcf2,d=l.changedPurposes,p=l.cmpId,h=l.cmpVersion,v=l.consensuScriptPath,f=l.dataRetentionPeriodLabel,g=l.disabledSpecialFeatures,m=l.gdprApplies,C=l.hideLegitimateInterestToggles,y=l.publisherCountryCode,S=l.purposeOneTreatment,E=l.selectedStacks,V=l.selectedVendorIds,T=l.tcfv2HistoryDisabled,b=l.vendorIdsOutsideEUList;return u.changedPurposes=Y(d),u.cmpId=p||5,u.cmpVersion=h||Z(),u.policyVersion="2.2"===t.tcf2.version?4:2,u.consensuScriptPath=$(v),u.consensuSubdomain=ee(t.tcf2.consensuDomain),u.dataRetentionLabel=f,u.disabledSpecialFeatures=g||[],u.gdprApplies=te(m,!1),u.hideLegitimateInterestToggles=C,u.isAnalyticsEnabled=!0===t.consentAnalytics,u.isApiV2Enabled=!0===t.consentAPIv2,u.isConsentXDeviceEnabled=!0===t.consentXDevice,u.publisherCountryCode=y||"DE",u.purposeOneTreatment=te(S,!1),u.resurfaceOptions=se(s),u.stackIds=E||[],u.tcfv2HistoryDisabled=T,u.useGranularChoice=ie(t.tcf2.firstLayerHideToggles,t.tcf2.secondLayerHideToggles),u.vendorIds=V||[],u.vendorIdsOutsideEUList=b||[],u.selectedLanguage=I(r),u.enableDeprecatedV1ConsentSaving=c,u.cmpApi=new Re(u.policyVersion,u.cmpId,u.cmpVersion,!0),u.dataTransferSettings=n,u.excludeAcceptAllVendors=a,u}return p(t,e),t.prototype.updateControllerId=function(e){this.dataTransferSettings.controllerId=e},t.prototype.acceptAllDisclosed=function(e){var t,s;return h(this,void 0,void 0,(function(){var i,n,o,r=this;return v(this,(function(a){switch(a.label){case 0:return(i=this.tcModel)?(n=[],o=[],this.getVendors().forEach((function(e){var t=e.id,s=e.legitimateInterestPurposes,a=e.purposes,c=e.specialPurposes,u=-1===r.excludeAcceptAllVendors.indexOf(t);a.length?(u&&i.vendorConsents.set(t),n=n.concat(a.map((function(e){return e.id})))):u&&i.vendorConsents.unset(t),s.length||c.length&&0===s.length&&0===a.length?(u&&i.vendorLegitimateInterests.set(t),o=o.concat(s.map((function(e){return e.id})))):u&&i.vendorLegitimateInterests.unset(t)})),i.purposeConsents.set(f(n)),i.purposeLegitimateInterests.set(f(o)),this.hideLegitimateInterestToggles&&(i.unsetAllVendorLegitimateInterests(),i.unsetAllPurposeLegitimateInterests()),i.specialFeatureOptins.set(g(null===(s=null===(t=this.tcModel)||void 0===t?void 0:t.gvl)||void 0===s?void 0:s.stacks,this.getVendors(),this.disabledSpecialFeatures,this.stackIds)),this.tcModel=i,[4,this.updateTCString(e)]):[2];case 1:return a.sent(),[2]}}))}))},t.prototype.areAllPurposesAccepted=function(){var e,t;return m(this.tcModel,null===(e=this.tcModel)||void 0===e?void 0:e.gvl.stacks,null===(t=this.tcModel)||void 0===t?void 0:t.gvl.purposes,this.vendors,this.disabledSpecialFeatures,this.stackIds,this.purposeOneTreatment,this.useGranularChoice,this.hideLegitimateInterestToggles).every((function(e){var t=!0,s=!0;return e.showConsentToggle&&null!==e.consent&&(t=e.consent),e.showLegitimateInterestToggle&&null!==e.legitimateInterestConsent&&(s=e.legitimateInterestConsent),t&&s}))},t.prototype.areAllVendorsAccepted=function(){return this.getVendors().every((function(e){var t=!0,s=!0;return e.showConsentToggle&&null!==e.consent&&(t=e.consent),e.showLegitimateInterestConsentToggle&&null!==e.legitimateInterestConsent&&(s=e.legitimateInterestConsent),t&&s}))},t.prototype.changeLanguage=function(e){return h(this,void 0,void 0,(function(){var t;return v(this,(function(s){switch(s.label){case 0:return t=I(e),[4,this.resetGVLWithLanguage("en"===t?"".concat(t,"-v2"):t)];case 1:return s.sent(),this.tcModel&&this.tcModel.gvl.narrowVendorsTo(this.vendorIds),this.resetTcfData(),[2]}}))}))},t.prototype.denyAllDisclosed=function(e){return h(this,void 0,void 0,(function(){var t;return v(this,(function(s){switch(s.label){case 0:return this.tcModel?(this.tcModel.unsetAllVendorConsents(),this.tcModel.unsetAllVendorLegitimateInterests(),t=C(this.tcModel.gvl.stacks,this.getVendors(),this.disabledSpecialFeatures,this.stackIds,this.purposeOneTreatment),this.tcModel.purposeConsents.unset(t),this.tcModel.purposeLegitimateInterests.unset(t),this.tcModel.specialFeatureOptins.unset(g(this.tcModel.gvl.stacks,this.getVendors(),this.disabledSpecialFeatures,this.stackIds)),[4,this.updateTCString(e)]):[2];case 1:return s.sent(),[2]}}))}))},t.prototype.getSelectedVendorsIncludeNonDisclosed=function(){return this.selectedVendorsIncludeNonDisclosed},t.prototype.getTcModel=function(){return this.tcModel},t.prototype.getTCFData=function(){var e,t,s,i,n,o,r,a,c;return this.tcfData||(this.tcfData={features:y(this.getVendors(),null===(t=null===(e=this.tcModel)||void 0===e?void 0:e.gvl)||void 0===t?void 0:t.features),purposes:m(this.tcModel,null===(s=this.tcModel)||void 0===s?void 0:s.gvl.stacks,null===(i=this.tcModel)||void 0===i?void 0:i.gvl.purposes,this.getVendors(),this.disabledSpecialFeatures,this.stackIds,this.purposeOneTreatment,this.useGranularChoice,this.hideLegitimateInterestToggles),specialFeatures:S(this.tcModel,null===(n=this.tcModel)||void 0===n?void 0:n.gvl,this.getVendors(),this.disabledSpecialFeatures,this.stackIds,this.useGranularChoice),specialPurposes:E(null===(r=null===(o=this.tcModel)||void 0===o?void 0:o.gvl)||void 0===r?void 0:r.specialPurposes,this.getVendors()),stacks:V(null===(c=null===(a=this.tcModel)||void 0===a?void 0:a.gvl)||void 0===c?void 0:c.stacks,this.disabledSpecialFeatures,this.stackIds),vendors:this.getVendors()}),this.tcfData},t.prototype.getGdprApplies=function(){return h(this,void 0,void 0,(function(){return v(this,(function(e){switch(e.label){case 0:return this.gdprApplies?[4,this.locationInstance.getIsUserInEU()]:[2,!0];case 1:return[2,e.sent()]}}))}))},t.prototype.getTCString=function(e){return this.tcModel?d.encode(this.tcModel,e):""},t.prototype.getTCFDisclosedVendorsSegmentString=function(){return this.getTCString({segments:[T.VENDORS_DISCLOSED]})},t.prototype.init=function(e){return h(this,void 0,void 0,(function(){var t;return v(this,(function(s){switch(s.label){case 0:return this.previousStorage=b.fetchTCFData(),(t="")||(t=b.fetchTCString()||""),[4,this.initTCModel(t,e)];case 1:return s.sent(),this.botInstance.isRobot()&&this.acceptAllDisclosed(1),[2]}}))}))},t.prototype.setUIAsClosed=function(){return h(this,void 0,void 0,(function(){return v(this,(function(e){return[2,this.cmpApiUpdate(b.fetchTCString(),!1)]}))}))},t.prototype.setUIAsOpen=function(){return h(this,void 0,void 0,(function(){return v(this,(function(e){return[2,this.cmpApiUpdate(b.fetchTCString(),!0)]}))}))},t.prototype.shouldResurfaceUI=function(){var e=this.resurfaceOptions;return e.onIABLegalBasisChanged&&D(this.previousStorage,this.tcModel)||e.onVendorAdded&&A(this.previousStorage,this.getVendors())||e.onPurposeChanged&&M(this.previousStorage,this.getVendors())||e.onPeriodEnded&&L(this.previousStorage)},t.prototype.updateChoices=function(e,t){return h(this,void 0,void 0,(function(){return v(this,(function(s){switch(s.label){case 0:return e.purposes?[4,this.savePurposes(e.purposes)]:[3,2];case 1:s.sent(),s.label=2;case 2:return e.specialFeatures?[4,this.saveSpecialFeatures(e.specialFeatures)]:[3,4];case 3:s.sent(),s.label=4;case 4:return e.vendors?[4,this.saveVendors(e.vendors)]:[3,6];case 5:s.sent(),s.label=6;case 6:return this.tcModel&&this.hideLegitimateInterestToggles&&(this.tcModel.unsetAllVendorLegitimateInterests(),this.tcModel.unsetAllPurposeLegitimateInterests()),e.purposes||e.specialFeatures||e.vendors?[4,this.updateTCString(t)]:[3,8];case 7:s.sent(),s.label=8;case 8:return[2]}}))}))},t.prototype.resetTcf=function(){this.cmpApi={},this.selectedVendorsIncludeNonDisclosed=!1,this.tcModel={},this.tcfData=null,this.vendors=[]},t.prototype.applyPurposeRestrictions=function(e,t){var s=this;e.forEach((function(e){var i,n=new w(e,t);null===(i=s.tcModel)||void 0===i||i.publisherRestrictions.restrictPurposeToLegalBasis(n)}))},t.prototype.cmpApiUpdate=function(e,t){return h(this,void 0,void 0,(function(){return v(this,(function(s){switch(s.label){case 0:return[4,this.getGdprApplies()];case 1:return s.sent()?this.cmpApi.update(e,t):this.cmpApi.update(null),[2]}}))}))},t.prototype.getVendors=function(){return _(this.vendors)||this.setVendors(),this.vendors},t.prototype.initTCModel=function(e,t,s){return void 0===s&&(s=4),h(this,void 0,void 0,(function(){var i,n,o,r,c,u,p;return v(this,(function(h){switch(h.label){case 0:if(this.isPolicyVersion4()?(a.baseUrl=t?O:F,a.languageFilename=P,a.latestFilename=U):(a.baseUrl=t?G:Q,a.languageFilename=x,a.latestFilename=B),(i=new a).tcfPolicyVersion=s,this.tcModel=new l(i),this.tcModel.policyVersion=s,this.tcModel.cmpId=this.cmpId,this.tcModel.cmpVersion=this.cmpVersion,this.tcModel.isServiceSpecific=!0,this.tcModel.publisherCountryCode=this.publisherCountryCode,this.tcModel.purposeOneTreatment=this.purposeOneTreatment,e)try{n=this.tcModel.gvl,this.tcModel=d.decode(e,this.tcModel),this.isPolicyVersion4()&&this.tcModel.purposeLegitimateInterests.unset([1,3,4,5,6]),this.tcModel.gvl=n}catch(e){console.warn(H.INIT_TCF_ERROR,e)}if(null===this.tcModel)throw new Error(H.TC_MODEL_UNDEFINED);if(!this.selectedLanguage)throw new Error(H.SELECTED_LANGUAGE_UNDEFINED);return[4,this.tcModel.gvl.readyPromise.catch((function(e){console.warn(H.RESET_GVL_FAILURE,e)}))];case 1:return h.sent(),this.tcModel.gvl.narrowVendorsTo(this.vendorIds),o=N([],R(this.tcModel.gvl.vendorIds),!1),r=I(this.selectedLanguage),[4,this.resetGVLWithLanguage("en"===r?"".concat(r,"-v2"):r)];case 2:return h.sent(),c=this.changedPurposes,u=c.purposes,p=c.legitimateInterestPurposes,this.applyPurposeRestrictions(u,k.REQUIRE_CONSENT),this.applyPurposeRestrictions(p,k.REQUIRE_LI),this.setSelectedVendorsIncludeNonDisclosed(o),[2]}}))}))},t.prototype.resetGVLWithLanguage=function(e){var t,s;return h(this,void 0,void 0,(function(){var i;return v(this,(function(n){return i=I(e),[2,null===(s=null===(t=this.tcModel)||void 0===t?void 0:t.gvl)||void 0===s?void 0:s.changeLanguage(i).catch((function(e){console.warn(H.RESET_GVL_FAILURE,e)}))]}))}))},t.prototype.resetTcfData=function(){this.setVendors(),this.tcfData=null},t.prototype.setSelectedVendorsIncludeNonDisclosed=function(e){var t=b.fetchTCFVendorsDisclosedObject();e.some((function(e){return!j(e,t)}))&&(this.selectedVendorsIncludeNonDisclosed=!0)},t.prototype.savePurposes=function(e){return h(this,void 0,void 0,(function(){var t;return v(this,(function(s){return(t=this.tcModel)?(e.forEach((function(e){e.consent?t.purposeConsents.set(e.id):t.purposeConsents.unset(e.id),e.legitimateInterestConsent?t.purposeLegitimateInterests.set(e.id):t.purposeLegitimateInterests.unset(e.id)})),[2]):[2]}))}))},t.prototype.saveSpecialFeatures=function(e){return h(this,void 0,void 0,(function(){var t;return v(this,(function(s){return(t=this.tcModel)?(e.forEach((function(e){e.consent?t.specialFeatureOptins.set(e.id):t.specialFeatureOptins.unset(e.id)})),[2]):[2]}))}))},t.prototype.saveVendors=function(e){return h(this,void 0,void 0,(function(){var t;return v(this,(function(s){return(t=this.tcModel)?(e.forEach((function(e){e.consent?t.vendorConsents.set(e.id):t.vendorConsents.unset(e.id),e.legitimateInterestConsent?t.vendorLegitimateInterests.set(e.id):t.vendorLegitimateInterests.unset(e.id)})),[2]):[2]}))}))},t.prototype.setVendors=function(){this.vendors=q(this.tcModel,this.disabledSpecialFeatures,this.useGranularChoice,this.hideLegitimateInterestToggles,this.purposeOneTreatment,this.vendorIdsOutsideEUList,this.dataRetentionLabel)},t.prototype.getTcfData=function(){return{tcString:this.getTCString(),timestamp:Date.now(),vendors:W(this.getVendors())}},t.prototype.injectTCString=function(e){return h(this,void 0,void 0,(function(){var t,s;return v(this,(function(i){switch(i.label){case 0:return t=d.decode(e),this.isPolicyVersion4()&&t.purposeLegitimateInterests.unset([1,3,4,5,6]),this.tcModel&&t.lastUpdated>=this.tcModel.lastUpdated?(s=this.getTcfData(),b.saveTCFData(z(z({},s),{tcString:e})),[4,this.saveTCFData(s)]):[3,2];case 1:return i.sent(),[2,!0];case 2:return[2,!1]}}))}))},t.prototype.isPolicyVersion4=function(){return 4===this.policyVersion},t.prototype.saveTCFData=function(e){return h(this,void 0,void 0,(function(){return v(this,(function(t){return[2,X.getInstance().saveTCFConsents(this.dataTransferSettings,e,"onTcfStringChange","explicit",this.isApiV2Enabled?{isAnalyticsEnabled:this.isAnalyticsEnabled,isConsentAPIv2Enabled:this.isConsentXDeviceEnabled}:null,this.enableDeprecatedV1ConsentSaving)]}))}))},t.prototype.updateTCString=function(e){return h(this,void 0,void 0,(function(){var t;return v(this,(function(s){switch(s.label){case 0:return this.tcModel&&(this.isPolicyVersion4()&&this.tcModel.purposeLegitimateInterests.unset([1,3,4,5,6]),this.tcModel.consentScreen=e,this.tcModel.updated()),t=this.getTcfData(),b.saveTCFData(t),[4,this.cmpApiUpdate(t.tcString,!1)];case 1:return s.sent(),this.resetTcfData(),this.botInstance.isRobot()?[3,3]:[4,this.saveTCFData(t)];case 2:s.sent(),s.label=3;case 3:return[2]}}))}))},t.prototype.getVendorsCount=function(){return this.getVendors().length||0},t}(ne);export{Oe as default};