/** * @id5io/id5-api.js * @version v1.0.55 * @link https://id5.io/ * @license Apache-2.0 */ !function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=17)}([function(e,g,m){"use strict";Object.defineProperty(g,"__esModule",{value:!0}),function(e){g.generateId=function(){if(void 0!==e&&void 0!==e.crypto&&void 0!==e.crypto.randomUUID)return e.crypto.randomUUID();return"".concat(1e6*Math.random()|0)},g.semanticVersionCompare=function(e,t){var n="^\\d+(\\.\\d+(\\.\\d+){0,1}){0,1}$";if(!e.match(n)||!t.match(n))return;var r=e.split("."),o=t.split("."),n=function(e){return parseInt(e)||0},e=function(e,t){t=e-t;return 0==t?0:t<0?-1:1},t=e(n(r[0]),n(o[0]));if(0!==t)return t;t=e(n(r[1]),n(o[1]));return 0!==t?t:e(n(r[2]),n(o[2]))},g.isA=c,g.isFn=d,g.isStr=h,g.isArray=p,g.isNumber=function(e){return c(e,o)},g.isPlainObject=function(e){return c(e,i)},g.isBoolean=function(e){return c(e,a)},g.isDefined=function(e){return void 0!==e},g.isEmpty=v,g._each=y,g.ajax=function(e,t,n){var r,o=3>>16,2246822507)^r(i^i>>>13,3266489909),(4294967296*(2097151&(i=r(i^i>>>16,2246822507)^r(o^o>>>13,3266489909)))+(o>>>0)).toString()},g.objectEntries=function(e){var t=Object.keys(e),n=t.length,r=new Array(n);for(;n--;)r[n]=[t[n],e[t[n]]];return r};var u=m(1);function l(e){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1e3*this.refreshInSeconds}},{key:"isStoredIdStale",value:function(){return this.storedDateTime<=0||12096e5e.refreshInSeconds&&(u=e.refreshInSeconds)}),Object(l.isNumber)(null==o||null===(t=o.cache_control)||void 0===t?void 0:t.max_age_sec)&&(u=o.cache_control.max_age_sec);n=n&&!this._clientStoreV1.storedConsentDataMatchesConsentData(n);return Object.assign(new h,{storedResponse:o,storedDateTime:i,pdHasChanged:s,segmentsHaveChanged:c,refreshInSeconds:u,nb:a,consentHasChanged:n})}},{key:"storeRequestData",value:function(e,t){var r=this;this._clientStoreV1.putHashedConsentData(e),t.forEach(function(e){var t=e.partnerId,n=e.pd,e=e.segments;r._clientStoreV1.isStoredPdUpToDate(t,n)||r._clientStoreV1.putHashedPd(t,n),r._clientStoreV1.putHashedSegments(t,e)})}},{key:"incNbs",value:function(e,t){var n=this;e.forEach(function(e){e=e.partnerId;t.nb[e]=n._clientStoreV1.incNb(e,t.nb[e])})}},{key:"storeResponse",value:function(e,t,n){var r=this;this._clientStoreV1.putResponse(t),this._clientStoreV1.setDateTime((new Date).toUTCString());var o=n?0:1;e.forEach(function(e){e=e.partnerId;r._clientStoreV1.setNb(e,o)})}},{key:"clearAll",value:function(e){var t=this;this._clientStoreV1.clearResponse(),this._clientStoreV1.clearDateTime(),e.forEach(function(e){e=e.partnerId;t._clientStoreV1.clearNb(e),t._clientStoreV1.clearHashedPd(e),t._clientStoreV1.clearHashedSegments(e)}),this._clientStoreV1.clearHashedConsentData()}}]),t}()},function(e,t,n){"use strict";n.d(t,"b",function(){return p}),n.d(t,"c",function(){return y}),n.d(t,"e",function(){return m}),n.d(t,"d",function(){return b}),n.d(t,"a",function(){return _});var o=n(1);function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e){return function(e){if(Array.isArray(e))return a(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}(e);try{for(a.s();!(i=a.n()).done;){var s=i.value;try{s.apply(void 0,r)}catch(e){this._log.error("Event ".concat(t," handler execution failed."),e)}}}catch(e){a.e(e)}finally{a.f()}}}},{key:"emit",value:function(e){if(void 0!==e&&h.includes(e)){for(var t=arguments.length,n=new Array(1e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(a)throw o}}}}function c(e,t){if(e){if("string"==typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n= 0 and <= 1");break;case"control":this._isExposed=!1,this.info("User is in control group!")}var o=this._userId!==r||!1===Object(i.d)(this._ext,e.ext);this._userIdAvailable=!0,this._userId=r,this._userIdAvailablePromiseResolver(r),this._ext=e.ext,this._fromCache=t,this.info("User id updated, hasChanged: ".concat(o,", fromCache: ").concat(t)),Object(i.k)(this._availableCallback)&&!1===this._availableCallbackFired&&(this._availableCallbackTimerId&&(this.info("Cancelling pending onAvailableCallback watchdog"),clearTimeout(this._availableCallbackTimerId),this._availableCallbackTimerId=void 0),this._availableCallbackTimerId=setTimeout(function(){return c.doFireOnAvailableCallBack(n)},0)),this._isRefreshing&&Object(i.k)(this._refreshCallback)&&!1===this._refreshCallbackFired&&(!1!==t&&!1!==this._isRefreshingWithFetch||(this._refreshCallbackTimerId&&(this.info("Cancelling pending onRefreshCallback watchdog"),clearTimeout(this._refreshCallbackTimerId),this._refreshCallbackTimerId=void 0),this._refreshCallbackTimerId=setTimeout(function(){return c.doFireOnRefreshCallBack(n)},0))),o&&Object(i.k)(this._updateCallback)&&setTimeout(function(){return c.doFireOnUpdateCallBack(n)},0)}},{key:"getUserId",value:function(){return!1===this._isExposed?"0":this._userId}},{key:"getLinkType",value:function(){return!1===this._isExposed?0:this.getExt().linkType}},{key:"getExt",value:function(){var e=!1===this._isExposed?{}:this._ext;return a({abTestingControlGroup:!this.exposeUserId()},e)}},{key:"isFromCache",value:function(){return this._fromCache}},{key:"exposeUserId",value:function(){return this._isExposed}},{key:"getUserIdAsEid",value:function(){return{source:r.c.ID5_EIDS_SOURCE,uids:[{atype:1,id:this.getUserId(),ext:this.getExt()}]}}},{key:"onAvailable",value:function(e,t){if(!Object(i.k)(e))throw new Error("onAvailable expect a function");var n;return Object(i.k)(this._availableCallback)?this.info("onAvailable was already called, ignoring"):(this._availableCallback=e,(n=this)._userIdAvailable?(this.info("User id already available firing callback immediately"),this._availableCallbackTimerId=setTimeout(function(){return c.doFireOnAvailableCallBack(n)},0)):0