!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";n.r(e);var r,o,a,i,u,c=Object({name:"P&G",pixelUrl:"https://feed.pghub.io/tag",disallowSyncUrlOverride:!0,syncType:"IFRAME"});function l(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function f(){return(f=Object.assign||function(t){for(var e=1;e0&&void 0!==arguments[0]?arguments[0]:[],e=this.getTapadMetaCookie(),n=e.thirdPartyCookies,r=p(e,["thirdPartyCookies"]),o=t.some((function(t){return t.value.toLowerCase()==="OptedOut".toLowerCase()}));if(o)this.setTapadMetaCookie({id:"OptedOut"});else{var a=f(f({},null!=n?n:{}),t.reduce((function(t,e){var n=e.name,r=e.value;return f(f({},t),l({},n,r))}),{}));this.setTapadMetaCookie(f(f({},r),{thirdPartyCookies:a}))}}},{key:"setTapadMetaCookieLastSyncTime",value:function(t){var e=this.getTapadMetaCookie();this.setTapadMetaCookie(f(f({},e),{lastSyncTime:t}))}},{key:"setTapadMetaCookie",value:function(e){t.storeInAllStores(this.storageKey,JSON.stringify(e))}}])&&s(e.prototype,n),r&&s(e,r),t}();function y(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,o,a=[],i=!0,u=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);i=!0);}catch(t){u=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(u)throw o}}return a}(t,e)||m(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(){return(v=Object.assign||function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.data,r=t.idParams,o=b(t,["data","idParams"]);return[].concat(h(P(v(v({},o),w))),h(S(null!=n?n:{},e)),h(j(null!=r?r:{}))).join("&")}function P(t){return Object.keys(t).map((function(e){return[e,t[e]]})).filter((function(t){var e=y(t,2);e[0];return null!=e[1]})).map((function(t){var e=y(t,2),n=e[0],r=e[1];return"".concat(encodeURIComponent(n),"=").concat(encodeURIComponent(r))}))}function S(t,e){return 0===Object.keys(t).length?[]:e?Object.keys(t).map((function(e){return[e,t[e]]})).filter((function(t){var e=y(t,2);e[0];return null!=e[1]})).map((function(t){var e=y(t,2),n=e[0],r=e[1];return"data.".concat(encodeURIComponent(n),"=").concat(encodeURIComponent(r))})):["data=".concat(encodeURIComponent(JSON.stringify(t)))]}function j(t){return Object.keys(t).map((function(e){return[e,t[e]]})).filter((function(t){var e=y(t,2);e[0];return null!=e[1]})).map((function(t){var e=y(t,2),n=e[0],r=e[1];return Object.keys(r).map((function(t){return[t,r[t]]})).filter((function(t){var e=y(t,2);e[0];return null!=e[1]})).map((function(t){var e=y(t,2),r=e[0],o=e[1];return"id.".concat(n,".").concat(r,"=").concat(encodeURIComponent(o))})).join("&")}))}function k(t,e){for(var n=0;n]* src="([^"]*)"[^>]*>/g,r=n.exec(t);null!=r;)e.push(r[1]),r=n.exec(t);return e}},{key:"appendPixels",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];e.forEach((function(e){var n=t.windowRef.document.createElement("amp-img");n.setAttribute("src",e),n.setAttribute("layout","fixed"),n.setAttribute("height","1"),n.setAttribute("width","1"),t.windowRef.document.body.appendChild(n)}))}}])&&x(e.prototype,n),r&&x(e,r),a}(C);function B(){return null!=(null===navigator||void 0===navigator?void 0:navigator.userAgentData)}function N(){return B()?(t=["platformVersion","fullVersionList","model","architecture","bitness"],B()?navigator.userAgentData.getHighEntropyValues(t):Promise.resolve(void 0)):Promise.resolve(void 0);var t}function J(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,o,a=[],i=!0,u=!1;try{for(n=n.call(t);!(i=(r=n.next()).done)&&(a.push(r.value),!e||a.length!==e);i=!0);}catch(t){u=!0,o=t}finally{try{i||null==n.return||n.return()}finally{if(u)throw o}}return a}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return X(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return X(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function X(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,o=new t(e,n,null==r?window:r);return n.env===a.AMP||o.isOptedOut()||o.createId(),o}},{key:"ampInitAndSync",value:function(){var e=this;return null==AMP||null==AMP.getState?Promise.resolve({status:r.FAILURE,error:"AMP not defined"}):AMP.getState("Tapad").then((function(n){var r=e.coerceAmpState(n),o=r.config,i=r.metadata,u=r.data,c=r.ids,l={document};return t.init(i,K(K({},o),{env:a.AMP}),l).sync(u,c)}))}},{key:"coerceAmpState",value:function(t){return null==t?{metadata:{},config:{},data:{},ids:{}}:function(t){if(null==t)return{};try{return JSON.parse(t)}catch(t){return{}}}(t)}},{key:"buildIdsQueryObject",value:function(t){if(null!=t)return Object.keys(t).map((function(e){return[e,t[e]]})).reduce((function(t,e){var n=J(e,2),r=n[0],o=n[1];return t[r]="string"==typeof o?{value:o}:o,t}),{})}}],(n=[{key:"sync",value:function(t,e){var n=this;return this.config.env!==a.AMP&&this.isOptedOut()?Promise.reject("OptedOut"):this.buildQueryParams(t,e).then((function(t){return n.pixelApi.sync(t)})).then((function(){return{status:r.SUCCESS}})).catch((function(t){return{status:r.FAILURE,error:t}}))}},{key:"cookie",get:function(){return this.config.env===a.AMP?{}:this.storageManager.getTapadMetaCookie()}},{key:"isOptedOut",value:function(){return this.config.env!==a.AMP&&"OptedOut"===this.cookie.id}},{key:"createId",value:function(){this.config.env!==a.AMP&&null==this.cookie.id&&this.storageManager.setTapadMetaCookieId(M())}},{key:"buildQueryParams",value:function(e,n){var r=this;return N().then((function(t){return null==t?"":JSON.stringify(t)})).then((function(o){var a,i,c,l,f;return{gdpr:r.metadata.gdpr,us_privacy:r.metadata.ccpa,gdpr_consent:r.metadata.gdpr_consent,referrer_url:null===(a=r.windowRef.document)||void 0===a?void 0:a.referrer,page_url:null===(c=null===(i=r.windowRef.document)||void 0===i?void 0:i.location)||void 0===c?void 0:c.href,owner:r.config.name,bp_id:null!==(f=null!==(l=r.metadata.sid)&&void 0!==l?l:r.metadata.bpid)&&void 0!==f?f:r.metadata.bp_id,partner:r.config.partner,partner_id:r.metadata.partnerId,partner_device_id:r.metadata.partnerDeviceId,partner_url:r.metadata.partnerUrl,data:e,idParams:t.buildIdsQueryObject(n),ch:o,initiator:u.js}}))}}])&&Q(e.prototype,n),i&&Q(e,i),t}();null!=(null===(V=window.AMP)||void 0===V?void 0:V.getState)?q.ampInitAndSync():window.Tapad=q}]);