!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,{_isDebug:()=>v,debug:()=>w,error:()=>h,info:()=>m,log:()=>m,setDebug:()=>b,warn:()=>g});var n={};t.r(n),t.d(n,{cmdLogEvent:()=>Ki,cmdLogPerf:()=>Gi});var r,o,i,a,c,u=(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}),f=function(){return u.window},s=function(){return u.document},l=function(){return u.navigator},p=function(){var t=f().location;return t&&t.hostname?t.hostname:""},y=function(){var t=p(),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},v=!1,b=function(t){v=!0===t||"true"===t},d=function(t){return f().console,function(){}},m=d(),h=d(),g=d(),w=function(){if(v){for(var t=arguments.length,e=new Array(t),n=0;n1&&void 0!==arguments[1])||arguments[1]||void 0!==t)return!0===t||1===t||"string"==typeof t&&("true"===t.toLowerCase()||"1"===t)},M=function(t){var e=parseInt(t,10);if(!isNaN(e))return e},B=function(t){return/^-?\d+$/.test(t)},F=function(){return function(t){var e=t.getUTCFullYear()+"-"+D(t.getUTCMonth()+1);if(e+="-"+D(t.getUTCDate())+"T"+D(t.getUTCHours())+":",e+=D(t.getUTCMinutes())+":"+D(t.getUTCSeconds()),t.getUTCMilliseconds){var n=t.getUTCMilliseconds();B(n)&&(e+="."+String((n/1e3).toFixed(3)).slice(2,5))}return e+"Z"}(new Date)},q=function(t){return"[object Array]"===Object.prototype.toString.call(t)},U=function(t,e){q(t)&&t.push({timestamp:F(),data:e})};function N(t){return N="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},N(t)}function V(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function K(t,e,n){return(e=z(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function G(t,e){for(var n=0;n0},ot=!1;function it(t){return it="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},it(t)}function at(t,e){for(var n=0;n3&&void 0!==arguments[3]?arguments[3]:{},o=r.queryParams,i=r.payload,a=r.requestHeaders,c=r.credentials,u=r.sendAsBeacon,s=void 0!==u&&u,p=T({},a),y=i?JSON.stringify(i):null;if(s&&pt&&!p.Authorization&&"POST"===e)try{var v=f().Blob;l().sendBeacon(t,new v([y],p))}catch(n){yt(t,e,y,p)}else!function(t,e,n,r,o){var i=f().fetch;lt&&i?i(t,{keepalive:!0,method:e,headers:r,body:n,credentials:o}).catch((function(o){yt(t,e,n,r)})):yt(t,e,n,r)}(t,e,y,p,c);!function(t,e,n,r,o){var i={endpoint:e,queryParams:n,method:r,payload:o};U(O(t),i)}(n,t,o,e,i)},bt=function(t,e){var n=O("config")[t];if(n&&e)return n[e]},dt=[{name:"EMAIL",regex:/[^@^=]+@[^@]+\.[^@^&]+/}],mt=function(t,e){if("string"!=typeof t)return t;for(var n=t,r=0;r0&&void 0!==arguments[0]?arguments[0]:"";return"https://".concat(t?t+".":"").concat(function(){if(ut)return ut;var t=y();if("secureserver.net"===(t=function(t){var e=t||y();return e.indexOf("godaddy.com")>=0||e.indexOf("secureserver.net")>=0}(t)?t:"secureserver.net")){var e=bt("build","env");t="prod"===e?t:"".concat(e,"-").concat(t)}return ut=t}())};function wt(t){return wt="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},wt(t)}function Ot(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){var r,o,i,a,c=[],u=!0,f=!1;try{if(i=(n=n.call(t)).next,0===e){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=i.call(n)).done)&&(c.push(r.value),c.length!==e);u=!0);}catch(t){f=!0,o=t}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(f)throw o}}return c}}(t,e)||jt(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 jt(t,e){if(t){if("string"==typeof t)return _t(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)?_t(t,e):void 0}}function _t(t,e){(null==e||e>t.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=f().attachEvent,o=f().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=s(),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=Ot(t,2),r=n[0],o=n[1];try{var i=Ot(r.split("|"),2),a=i[0],c={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(T(n,{events:n.events.slice(this._maxEvents)})),c[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&&et.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,c=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw i}}}}(Ht);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},Xt=function(t,e){"debug"===t&&b(e)},Yt=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}}])&&fe(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}();function pe(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=Pe,this}},{key:"required",value:function(){return this._fieldType=Ee,this}},{key:"stringify",value:function(){for(var t=new H,e=0;e0)try{n=Ie(e,"parse",this,3)([t||{}])}catch(t){throw""}return Object.freeze(n)}}])}(Ne),Ke=function(t){function e(){return Ae(this,e),Te(this,e,arguments)}return Re(e,t),Be(e,[{key:"parse",value:function(t){return this.validate(t),t}},{key:"stringify",value:function(){var t={};return t[this.name]=this._fieldType,t}}])}(Ne),Ge=function(t){function e(){return Ae(this,e),Te(this,e,arguments)}return Re(e,t),Be(e,[{key:"pattern",value:function(t){return this._pattern=t,this}},{key:"validate",value:function(t){Ie(e,"validate",this,3)([t]);var n=qe(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=Ie(e,"stringify",this,3)([]),n=this._pattern?" | pattern: ".concat(this._pattern):"";return t[this.name]="".concat(t[this.name]," | type: string").concat(n),t}}])}(Ke),ze=function(t){function e(){var t;return Ae(this,e),(t=Te(this,e)).definitionType="Object",t}return Re(e,t),Be(e,[{key:"stringify",value:function(){if(this._resolutionType===ke){var t={};return t["".concat(this.name," (").concat(this._fieldType,")")]=Ie(e,"stringify",this,3)([]),t}return Ie(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=ke,this}},{key:"extend",value:function(t){return t&&(this.properties=this.properties.concat(t)),this}}])}(Ne),He=function(t){function e(){var t;return Ae(this,e),(t=Te(this,e)).definitionType="Collection",t.minElements=0,t}return Re(e,t),Be(e,[{key:"parse",value:function(t){if(this.minElements&&(!t||t.length0?Ee:Pe,this}}])}(ze);function We(t){return We="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},We(t)}function $e(t){return function(t){if(Array.isArray(t))return Qe(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 Qe(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)?Qe(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 Qe(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,$e(this.asyncCommands.splice(e,1)))}t&&this.process({schema:this.pageViewSchema})}},{key:"process",value:function(t){Ye(n,"pushLog",this,3)([t]);try{var r=t.data,o=t.schema||t.interface,i=t.type,a=t.version||"v1",c=t.targets||[],u={eventId:ae()};this.beforeEvent&&this.beforeEvent(),function(){for(;Jtt.length)&&(e=t.length);for(var n=0,r=Array(e);n=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]}}("plid")},function(){var t=y().replace("dev-","").replace("test-","").replace("stg-","");if(Mn.hasOwnProperty(t))return Mn[t]}],Fn=function(){for(var t=0;t=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 p()},"page.path":function(t){return t.win.location.pathname},"page.virtualPath":function(){return dn.get("virtual_path")},"page.location":function(){return n=(t=ht()).length?(function(t){for(var e=0;et.length)&&(e=t.length);for(var n=0,r=Array(e);n0&&Yn(t,e,o)):n.events.forEach((function(n){r&&!r.includes(n.schemaId)||Yn(t,e,T(o,{event:n}))}))},er=function(t,e){var n=or();n.length>=nr&&g("".concat(t," subscribed to SCC after the eventQueue was full. Some events may have been lost.")),n.forEach((function(n){return tr(t,e,n)})),Zn[t]=e},nr=2e3,rr=[],or=function(){return[].concat(rr)};function ir(t){return ir="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},ir(t)}function ar(t,e){for(var n=0;nnr&&rr.shift(),this.internal.hasFired=!0}}var a}},{key:"_getSchemaId",value:function(){}},{key:"_getEvents",value:function(t){return[{schemaId:this._getSchemaId(),data:t}]}},{key:"_getGlobalSchemaId",value:function(){return Fn()?"urn:shared:user:events:/v2":"urn:shared:user:events:/v1"}},{key:"_getBusinessContext",value:function(){}},{key:"_getApiKey",value:function(){return Kt("eventBus","sccApiKey")}},{key:"_hasConversion",value:function(){}},{key:"_getWebContext",value:function(t){}}])&&sr(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(ur);function dr(t){return dr="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},dr(t)}function mr(t,e){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:{},e=t.eid,n=t.customProperties,r=t.eventCategory;return T({pageLevelProperties:T(Qt),identityRealm:Kt("identity","realm")},e&&{eid:e},n&&{customProperties:n},r&&{eventCategory:r})},Ur=function(t,e,n,r){var o={traffic:qr({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(Fr)&&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},Nr=function(t,e,n,r){null!=r&&null!=n&&0!==r&&0!==n&&n>r&&(t[e]=Math.round(n-r))},Vr=function(t,e,n,r){var o=Y(e);!function(t,e){Nr(t,"pageLoadTime",e.loadEventStart,e.navigationStart),Nr(t,"domContentLoadedTime",e.domContentLoadedEventStart,e.navigationStart),Nr(t,"domInteractiveTime",e.domInteractive,e.navigationStart),Nr(t,"pageDownloadTime",e.responseEnd,e.responseStart),Nr(t,"domainLookupTime",e.domainLookupEnd,e.domainLookupStart),Nr(t,"serverResponseTime",e.responseStart,e.requestStart),Nr(t,"serverConnectionTime",e.connectEnd,e.connectStart),Nr(t,"redirectionTime",e.fetchStart,e.navigationStart)}(o,e);var i={navigationType:e.navigationType,timing:{navigation:o},traffic:qr({customProperties:n}),producerEventId:t,contentLoadType:r};return"hard"===r&&(i.response=tt(e),i.timing.marks=e.marks,i.timing.measures=e.measures,i.timing.paint={firstPaint:e.fp,firstContentfulPaint:e.fcp,largestContentfulPaint:e.lcp}),i},Kr=function(t,e,n){return{timing:{paint:{largestContentfulPaint:e.LCP},vitals:{cumulativeLayoutShift:e.CLS,firstInputDelay:e.FID,timeToInteractive:e.timeToInteractive,interactionToNextPaint:e.INP}},traffic:qr({customProperties:n}),producerEventId:t}};function Gr(t){return Gr="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},Gr(t)}function zr(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&&zr(n.prototype,r),Object.defineProperty(n,"prototype",{writable:!1}),n;var n,r}(br);function Zr(t){return Zr="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},Zr(t)}function Xr(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=Array(e);n