!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("scc-c2",[],e):"object"==typeof exports?exports["scc-c2"]=e():t["scc-c2"]=e()}(self,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{_reset:()=>R,debug:()=>A,error:()=>I,info:()=>C,log:()=>C,setDebug:()=>T,warn:()=>x});var n={};t.r(n),t.d(n,{cmdLogEvent:()=>Gi,cmdLogPerf:()=>Ki});var r,o,i,a,u,c,f=(r="",i={document:o=Object.create({get cookie(){return r},set cookie(t){r=t}})},a={},"undefined"==typeof window?{window:i,document:o,navigator:a}:{window:window||i,document:window.document||o,navigator:navigator||a}),s=function(){return f.window},l=function(){return f.document},p=function(){return f.navigator},y=function(){var t=s().location;return t&&t.hostname?t.hostname:""},v=function(){var t=y(),e=t.split("."),n=e.length;return n>2&&(t="".concat(e[n-2],".").concat(e[n-1]),2!==e[n-2].length&&3!==e[n-2].length||2!==e[n-1].length||(t="".concat(e[n-3],".").concat(t))),t},b=function(t,e){var n=L("config")[t];if(n&&e)return n[e]},d=[{name:"EMAIL",regex:/[^@^=]+@[^@]+\.[^@^&]+/}],m=function(t,e){if("string"!=typeof t)return t;for(var n=t,r=0;r1&&void 0!==arguments[1])||arguments[1]||void 0!==t)return!0===t||1===t||"string"==typeof t&&("true"===t.toLowerCase()||"1"===t)},w=function(t){var e=parseInt(t,10);if(!isNaN(e))return e},O=function(t){return/^-?\d+$/.test(t)},j=function(t){var e;return(t=t||(null===(e=s())||void 0===e||null===(e=e.location)||void 0===e?void 0:e.search))?("?"===t.substr(0,1)&&(t=t.substring(1)),t.split("&")):[]},_=function(t,e,n){for(var r=j(n),o=r.length-1;o>=0;o--){var i=r[o].split("=");if(e){if((i[0]+"").toLowerCase()===(t+"").toLowerCase())return i[1]}else if(i[0]===t)return i[1]}},S=!1,P={},E=function(){return"true"===_("scc_debug",!0)||S},k=function(t,e){var n="".concat(t,":").concat(e);if(P[n])return P[n];var r=s().console;if((E()||e)&&r&&r[t]){var o=Function.prototype.bind?Function.prototype.bind.call(r[t],r):function(){for(var e=arguments.length,n=new Array(e),o=0;o0},dt=!1;function mt(t){return mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mt(t)}function ht(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=Array(e);n1&&void 0!==arguments[1]?arguments[1]:10;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._eventQueue=[],this._sendBatchCallback=e,this._maxEvents=r,this._isFlushing=!1,this._bindHandlers(),this._processInterval=setInterval((function(){n._sendBatch()}),250)},(e=[{key:"_bindHandlers",value:function(){var t=this,e=this._hidePage.bind(this),n=this._showPage.bind(this),r=s().attachEvent,o=s().addEventListener;o?(o("beforeunload",e,!1),o("pagehide",e,!1),o("pageshow",n,!1)):r&&(r("beforeunload",e),r("pagehide",e),r("pageshow",n));var i=l(),a=i.addEventListener;a&&a("visibilitychange",function(){"hidden"===i.visibilityState&&t._hidePage(),"visible"===i.visibilityState&&t._showPage()}.bind(this))}},{key:"_hidePage",value:function(){for(this._isFlushing=!0;this._eventQueue.length>0;)this._sendBatch()}},{key:"_showPage",value:function(){this._isFlushing=!1}},{key:"_sendRequests",value:function(t){var e=this;Object.entries(t).forEach((function(t){var n=Et(t,2),r=n[0],o=n[1];try{var i=Et(r.split("|"),2),a=i[0],u={schemaId:i[1],data:[]};Object.values(o).forEach((function(t){if(t.events.length>10)for(var e=t.events.length/10,n=0;nthis._maxEvents&&this.pushEvent(V(n,{events:n.events.slice(this._maxEvents)})),u[a]=i,Math.min(n.events.length,this._maxEvents)}},{key:"_sendBatch",value:function(t){var e=0,n={},r=[];for(t&&(e+=this._processEvent(n,r,t));this._eventQueue.length>0&&e3&&void 0!==arguments[3]?arguments[3]:{},o=r.queryParams,i=r.payload,a=r.requestHeaders,u=r.credentials,c=r.sendAsBeacon,f=void 0!==c&&c,l=V({},a),y=i?JSON.stringify(i):null;if(f&&_t&&!l.Authorization&&"POST"===e)try{var v=s().Blob;p().sendBeacon(t,new v([y],l))}catch(n){St(t,e,y,l)}else!function(t,e,n,r,o){var i=s().fetch;jt&&i?i(t,{keepalive:!0,method:e,headers:r,body:n,credentials:o}).catch((function(o){St(t,e,n,r)})):St(t,e,n,r)}(t,e,y,l,u);!function(t,e,n,r,o){var i={endpoint:e,queryParams:n,method:r,payload:o};X(L(t),i)}(n,t,o,e,i)}("".concat(function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return"https://".concat(t?t+".":"").concat(function(){if(u)return u;var t=v();if("secureserver.net"===(t=function(t){var e=t||v();return e.indexOf("godaddy.com")>=0||e.indexOf("secureserver.net")>=0}(t)?t:"secureserver.net")){var e=b("build","env");t="prod"===e?t:"".concat(e,"-").concat(t)}return u=t}())}("csp"),"/eventbus/web?clientid=").concat(n),"POST",Rt,{payload:t,sendAsBeacon:r})};function Dt(t){return Dt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dt(t)}function Bt(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=Array(e);n=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:o}}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 i,a=!0,u=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}(Zt);try{for(n.s();!(e=n.n()).done;){var r=e.value;if(t.startsWith("".concat(r,".")))return!1}}catch(t){n.e(t)}finally{n.f()}return!0},re=function(t,e){"debug"===t&&T("true"===e||!0===e)},oe=function(){var t,e,n=function(){for(var t={},e=0;et.length)&&(e=t.length);for(var n=0,r=Array(e);n0;)this.process(this.asyncCommands.shift());this.loaded=!0}}])&&ve(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function me(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n0&&!this.allowedValuesList.includes(t))throw"Input '".concat(t,"' for property '").concat(this.name,"' is not one of the allowed values (").concat(this.allowedValuesList,").")}},{key:"optional",value:function(){return this._fieldType=Ie,this}},{key:"required",value:function(){return this._fieldType=xe,this}},{key:"stringify",value:function(){for(var t=new ot,e=0;e0)try{n=De(e,"parse",this,3)([t||{}])}catch(t){throw""}return Object.freeze(n)}}])}(We),$e=function(t){function e(){return Ue(this,e),Re(this,e,arguments)}return Fe(e,t),Ne(e,[{key:"parse",value:function(t){return this.validate(t),t}},{key:"stringify",value:function(){var t={};return t[this.name]=this._fieldType,t}}])}(We),Qe=function(t){function e(){return Ue(this,e),Re(this,e,arguments)}return Fe(e,t),Ne(e,[{key:"pattern",value:function(t){return this._pattern=t,this}},{key:"validate",value:function(t){De(e,"validate",this,3)([t]);var n=Ke(t);if("string"===n){if(this._pattern&&!t.match(this._pattern))throw"Input ".concat(t," does not match ").concat(this._pattern)}else if("undefined"!==n&&null!=t)throw"Input is not a string"}},{key:"stringify",value:function(){var t=De(e,"stringify",this,3)([]),n=this._pattern?" | pattern: ".concat(this._pattern):"";return t[this.name]="".concat(t[this.name]," | type: string").concat(n),t}}])}($e),Je=function(t){function e(){var t;return Ue(this,e),(t=Re(this,e)).definitionType="Object",t}return Fe(e,t),Ne(e,[{key:"stringify",value:function(){if(this._resolutionType===Ae){var t={};return t["".concat(this.name," (").concat(this._fieldType,")")]=De(e,"stringify",this,3)([]),t}return De(e,"stringify",this,3)([])}},{key:"substitute",value:function(t){return this.properties=this.properties.concat(t),this._resolutionType="sub",this}},{key:"map",value:function(t,e){return this.name=t,this.properties=this.properties.concat(e),this._resolutionType=Ae,this}},{key:"extend",value:function(t){return t&&(this.properties=this.properties.concat(t)),this}}])}(We),Ze=function(t){function e(){var t;return Ue(this,e),(t=Re(this,e)).definitionType="Collection",t.minElements=0,t}return Fe(e,t),Ne(e,[{key:"parse",value:function(t){if(this.minElements&&(!t||t.length0?xe:Ie,this}}])}(Je);function Xe(t){return Xe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xe(t)}function Ye(t){return function(t){if(Array.isArray(t))return tn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return tn(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?tn(t,e):void 0}}(t)||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 tn(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n=0;e--){var n=this.asyncCommands[e];n.schema!==this.pageViewSchema||n.data&&n.data.virtual_path||(t=!1),"set_config"===n.schema&&this.process.apply(this,Ye(this.asyncCommands.splice(e,1)))}t&&this.process({schema:this.pageViewSchema})}},{key:"process",value:function(t){on(n,"pushLog",this,3)([t]);try{var r=t.data,o=t.schema||t.interface,i=t.type,a=t.version||"v1",u=t.targets||[],c={eventId:le()};this.beforeEvent&&this.beforeEvent(),function(){for(;eet.length)&&(e=t.length);for(var n=0,r=Array(e);n=0;n--)e[n]=e[n].trim(),e[n]||e.splice(n,1);if(e.length>0)for(;e.length<3;)e.push("Other");return e.join(" / ")}()},"page.host":function(){return y()},"page.path":function(t){return t.win.location.pathname},"page.virtualPath":function(){return On.get("virtual_path")},"page.location":function(){return n=(t=j()).length?(function(t){for(var e=0;et.length)&&(e=t.length);for(var n=0,r=Array(e);n0&&ur(t,e,o)):n.events.forEach((function(n){r&&!r.includes(n.schemaId)||ur(t,e,V(o,{event:n}))}))},fr=function(t,e){var n=pr();n.length>=sr&&x("".concat(t," subscribed to SCC after the eventQueue was full. Some events may have been lost.")),n.forEach((function(n){return cr(t,e,n)})),ir[t]=e},sr=2e3,lr=[],pr=function(){return[].concat(lr)},yr="urn:shared:user:event:/data-platform/signals/click/v1",vr="urn:shared:user:event:/data-platform/signals/impression/v1",br="urn:shared:user:event:/data-platform/signals/element-action/v1",dr="urn:shared:user:event:/data-platform/signals/traffic-event/v1",mr="urn:shared:user:event:/data-platform/signals/experiment-assignment/v1",hr="urn:shared:user:event:/appconfig/id-percentage-evaluation/v1";var gr=function(t){var e,n=t.schemaId,r=t.baseGlobal,o=t.override,i=t.defaultVersion,a="urn:shared:ai:events:/agent/v1"===n,u=a?function(t,e){var n=t||{},r=n.traceId,o=n.context,i=n.client,a=void 0===i?{}:i,u=a.userAgent,c=a.sdk,f=n.consent,s=n.page,l=void 0===s?{}:s,p=l.host,y=l.path,v=l.location,b=n.site,d=n.agent;return $(N({traceId:r,context:o,client:{userAgent:u,sdk:c},consent:f,page:{host:p,path:y,location:v},site:b,agent:d},e))}(r,o):r;return{global:u,version:a?(e=u,function(t){for(var e=2166136261,n=0;n>>0;return e.toString()}(JSON.stringify(Q(e)))):i}},wr=function(t){var e,n,r=t.globalSchemaId,o=t.globalOverride,i=t.businessContext,a=t.events,u=t.webContext,c=t.routing,f=void 0===c?{}:c,s=f.eventBusApiKey,l=f.hasConversion,p=f.targets;if(Z(a)&&0!==a.length){for(var y=J(),v=0;vsr&&lr.shift()}};function Or(t){return Or="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Or(t)}function jr(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},e=t.eid,n=t.customProperties,r=t.eventCategory;return V({pageLevelProperties:V(te),identityRealm:$t("identity","realm")},e&&{eid:e},n&&{customProperties:n},r&&{eventCategory:r})},Fr=function(t,e,n,r){var o={traffic:Mr({eid:e,customProperties:r}),producerEventId:t};if(e){var i=function(t){return t.split(".")}(e),a=function(t){return t[t.length-1]}(i);(function(t){return!!(t.match(Br)&&t.length<=500)})(e)&&function(t,e,n){return e===n&&t.length>=5&&t.length<=6}(i,a,n)&&(o.element=function(t,e){var n=6===t.length?1:0,r={area:t[0],product:t[1],section:t[2+n],widget:t[3+n]};return["impression","click"].includes(e)||(r.action=e),r}(i,a))}return o},qr=function(t,e,n,r){null!=r&&null!=n&&0!==r&&0!==n&&n>r&&(t[e]=Math.round(n-r))},Ur=function(t,e,n,r){var o=lt(e);!function(t,e){qr(t,"pageLoadTime",e.loadEventStart,e.navigationStart),qr(t,"domContentLoadedTime",e.domContentLoadedEventStart,e.navigationStart),qr(t,"domInteractiveTime",e.domInteractive,e.navigationStart),qr(t,"pageDownloadTime",e.responseEnd,e.responseStart),qr(t,"domainLookupTime",e.domainLookupEnd,e.domainLookupStart),qr(t,"serverResponseTime",e.responseStart,e.requestStart),qr(t,"serverConnectionTime",e.connectEnd,e.connectStart),qr(t,"redirectionTime",e.fetchStart,e.navigationStart)}(o,e);var i={navigationType:e.navigationType,timing:{navigation:o},traffic:Mr({customProperties:n}),producerEventId:t,contentLoadType:r};return"hard"===r&&(i.response=pt(e),i.timing.marks=e.marks,i.timing.measures=e.measures,i.timing.paint={firstPaint:e.fp,firstContentfulPaint:e.fcp,largestContentfulPaint:e.lcp}),i},Vr=function(t,e,n){return{timing:{paint:{largestContentfulPaint:e.LCP},vitals:{cumulativeLayoutShift:e.CLS,firstInputDelay:e.FID,timeToInteractive:e.timeToInteractive,interactionToNextPaint:e.INP}},traffic:Mr({customProperties:n}),producerEventId:t}};function Nr(t){return Nr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nr(t)}function Gr(t,e){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:"".concat(e.area,".").concat(e.product,".").concat(e.section,".").concat(e.widget,".").concat(t)}},{key:"_transformLegacyPromo",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.eid,o=n.customProperties,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return{id:i.id,name:i.name,creative_name:i.creative,creative_slot:i.position,type:t,properties:o,eid:this._buildLegacyEid(t,e,r)}}},{key:"_isPromo",value:function(t){return t.promotion&&Object.keys(t.promotion).length>0}}],r&&Gr(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(kr);function Qr(t){return Qr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qr(t)}function Jr(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=Array(e);n