(()=>{"use strict";var t={228:t=>{var e=Object.prototype.hasOwnProperty,n="~";function r(){}function o(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function i(t,e,r,i,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var u=new o(r,i||t,a),c=n?n+e:e;return t._events[c]?t._events[c].fn?t._events[c]=[t._events[c],u]:t._events[c].push(u):(t._events[c]=u,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new r:delete t._events[e]}function u(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),u.prototype.eventNames=function(){var t,r,o=[];if(0===this._eventsCount)return o;for(r in t=this._events)e.call(t,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(t)):o},u.prototype.listeners=function(t){var e=n?n+t:t,r=this._events[e];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,i=r.length,a=new Array(i);o{const t=n(228),e={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let r;const o=new Uint8Array(16);function i(){if(!r&&(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!r))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(o)}const a=[];for(let t=0;t<256;++t)a.push((t+256).toString(16).slice(1));function u(t,e=0){return a[t[e+0]]+a[t[e+1]]+a[t[e+2]]+a[t[e+3]]+"-"+a[t[e+4]]+a[t[e+5]]+"-"+a[t[e+6]]+a[t[e+7]]+"-"+a[t[e+8]]+a[t[e+9]]+"-"+a[t[e+10]]+a[t[e+11]]+a[t[e+12]]+a[t[e+13]]+a[t[e+14]]+a[t[e+15]]}const c=function(t,n,r){if(e.randomUUID&&!n&&!t)return e.randomUUID();const o=(t=t||{}).random||(t.rng||i)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,n){r=r||0;for(let t=0;t<16;++t)n[r+t]=o[t];return n}return u(o)};function s(){return t=(new Date).getTime(),parseFloat(t.toString().replace(/(\d{3})$/,".$1"));var t}function l(){return c().replace(/-/g,"")}var f;function p(){return void 0!==window.pdst?f.VersionA:f.VersionB}!function(t){t.VersionA="a",t.VersionB="b"}(f||(f={}));var d={},h=!1,v=function(){d={key:null,lifetime:365,group:null,label:null,experiment:null}};function m(t){return Object.prototype.hasOwnProperty.call(d,t)?d[t]:null}v();var _=function(){return function(t){return"string"==typeof t?t:"number"==typeof t?t.toString():null}},y=function(){return function(t){var e=parseInt(t,10);return isNaN(e)?null:e}},g=function(){return function(t){var e=parseFloat(t);return isNaN(e)?null:e}},w=function(){return function(t){return["True","true","1",1,!0].indexOf(t)>-1||!(["False","false","0",0,!1].indexOf(t)>-1)&&null}},b=function(t){return function(e){var n;if(Array.isArray(e))n=e;else{if(null==e)return null;n=[e]}return t?n.map((function(e){return Object.keys(t).reduce((function(n,r){return n[r]=t[r](e[r]),n}),{})})):n}},O=function(t){return function(e){return e?t?Object.keys(t).reduce((function(n,r){return n[r]=t[r](e[r]),n}),{}):e:{}}};const S=function(){function t(){this.time=s(),this.action=null,this.group=null,this.label=null,this.experiment=null,this.fields={event_id:_()}}return t.prototype.update=function(t){var e=this;t&&Object.keys(this.fields).reduce((function(n,r){r in t&&(e[r]=t[r])}),{})},t.prototype.data=function(){var t=this;return{action:this.action,time:this.time,group:null!==this.group?this.group:m("group"),label:null!==this.label?this.label:m("label"),experiment:null!==this.experiment?this.experiment:m("experiment"),body:Object.keys(this.fields).reduce((function(e,n){return e[n]=t.fields[n](t[n]),e}),{})}},t}();var E,T=(E=function(t,e){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},E(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}E(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),A=function(){return A=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]5&&e.length<254},At=function(t){if(!t||"string"!=typeof t)return!1;var e=t.trim().replace(/[\s\-\(\)\+\.]/g,"");return/^\d{6,}$/.test(e)},jt={EMAIL:'[type="email"], [name*="email"], [id*="email"], [name*="mail"], [id*="mail"]',PHONE:'[type="tel"], [name*="phone"], [name*="mobile"], [id*="phone"], [name*="tel"], [id*="tel"]',FIRST_NAME:'[name*="first"], [name*="fname"], [name="firstname"], [name="firstName"], [name="FNAME"], [name*="first_name"], [name*="name_first"], [id="firstName"], [id="firstname"], [name*="full_name"], [name="fullname"], [name*="your-name"], [name*="customer_name"]',LAST_NAME:'[name*="last"], [name*="lname"], [name="lastname"], [name="lastName"], [name="LNAME"], [name*="last_name"], [name*="surname"], [name*="family_name"], [name*="name_last"], [id="lastName"], [id="lastname"]',DATE_OF_BIRTH:'[name*="dob"], [name*="birth"], [id*="dob"], [name*="birthday"], [id*="birthday"]'},Mt={email:jt.EMAIL,phone:jt.PHONE,lastName:jt.LAST_NAME,dateOfBirth:jt.DATE_OF_BIRTH,firstName:jt.FIRST_NAME},xt=["submit","send","sign up"],Pt="submit",kt=750;function Nt(t){var e,n,r=null!==(n=null===(e=t.textContent)||void 0===e?void 0:e.toLowerCase())&&void 0!==n?n:"",o="string"==typeof t.className?t.className.toLowerCase():"",i=t.getAttribute&&t.getAttribute("role")||"";return"submit"===t.type||xt.some((function(t){return r.includes(t)}))||o.includes(Pt)||"button"===i.toLowerCase()}function Ct(t){var e=function(t){return t?Object.entries(t).filter((function(t){var e=t[1];return Boolean(e)})).map((function(t){var e=t[0];return Mt[e]})).filter(Boolean):[]}(t);return e.join(", ")}function It(){try{return Boolean(window&&window.__pixelDebug__)}catch(t){return!1}}function Ut(){for(var t=[],e=0;e0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]0?(Ut("[Automated Matching] Form submission detected"),s(o,"form")):Ut("[Automated Matching] No target fields found in form")}else Ut("[Automated Matching] Event target is not a form:",t.target)},f=function(t){var e,n,r=t.target;if(r instanceof HTMLInputElement&&(o=r,a.length>0&&o.matches(a))){var o,u=null!==(n=null===(e=r.value)||void 0===e?void 0:e.trim())&&void 0!==n?n:"";u&&(r.matches(jt.EMAIL)?(i.email=Tt(u)?u:null,Ut("[Automated Matching] Field value stored:",r.name||r.id||r.type,u)):r.matches(jt.PHONE)?(i.phone=At(u)?u:null,Ut("[Automated Matching] Field value stored:",r.name||r.id||r.type,u)):r.matches(jt.FIRST_NAME)?(i.first_name=u,Ut("[Automated Matching] Field value stored:",r.name||r.id||r.type,u)):r.matches(jt.LAST_NAME)?(i.last_name=u,Ut("[Automated Matching] Field value stored:",r.name||r.id||r.type,u)):r.matches(jt.DATE_OF_BIRTH)&&(i.date_of_birth=u,Ut("[Automated Matching] Field value stored:",r.name||r.id||r.type,u)))}},p=function(t){var e=t.target,n=e.closest("form");n&&Nt(e)?(Ut("[Automated Matching] Click on form submit element detected:",e),l({target:n,type:"click-submit"})):"BUTTON"!==e.tagName&&!Nt(e)||!Object.values(i).some((function(t){return null!==t}))||e.closest("form")||(Ut("[Automated Matching] Non-form submission button clicked:",e),function(){var t=Lt({},i),e=Object.values(t).filter((function(t){return null!==t}));if(Ut("[Automated Matching] Field detection results:",{total_found:e.length,detected_fields:t}),e.length>0){Ut("[Automated Matching] Non-form submission detected");var n=JSON.stringify({detected_fields:t}),r=Date.now();if(c&&r-c.at0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]0&&(t=e),t?(Ut("[Automated Matching] Fetching config:",n="".concat(Bt,"/").concat(t)),[4,fetch(n,{headers:{Accept:"application/json"},method:"GET"})]):(Ut("[Automated Matching] No pixel id available yet; skipping config fetch"),[2,{enabled:!1,fields:void 0}]);case 1:return(r=c.sent()).ok?[4,r.json()]:(Ut("[Automated Matching] Config fetch failed:",r.status,r.statusText),[2,{enabled:!1,fields:void 0}]);case 2:return Ut("[Automated Matching] Config response:",o=c.sent()),o&&Array.isArray(o.aamFields)?(Ut("[Automated Matching] Effective AAM fields:",i=o.aamFields.filter((function(t){return Gt.has(t)}))),a=i.length>0,u=Ft(i),[2,{enabled:a,fields:a?[u]:void 0}]):[2,{enabled:!1,fields:void 0}];case 3:return Ut("[Automated Matching] Config fetch error:",c.sent()),[2,{enabled:!1,fields:void 0}];case 4:return[2]}}))}))}var Jt=function(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function u(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,u)}c((r=r.apply(t,e||[])).next())}))},zt=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]0?(x(mt,"1",3650),!0):void 0})()||(function(t){t.addListener("event",(function(e,n){R(e.data()),!0===n&&t.emit("send.events")}))}(t),function(t){t.addListener("debug.events",(function(e){t.addListener("event",e)}))}(t),function(t){var e=this;t.addListener("alias",(function(n,r){var o=["email","phone_number"].map((function(t){return z(e,void 0,void 0,(function(){var e,r;return $(this,(function(o){switch(o.label){case 0:return n&&Object.prototype.hasOwnProperty.call(n,t)&&"string"==typeof n[t]?(e=n,r=t,[4,J(n[t])]):[3,2];case 1:e[r]=o.sent(),o.label=2;case 2:return[2]}}))}))}));Promise.all(o).then((function(){t.emit("event",new F(n),r)}))}))}(t),function(t){var e=function(e,n){return t.emit("event",new Q(e),n)},n=function(e,n){return t.emit("event",new tt(e),n)},r=function(e,n){return t.emit("event",new rt(e),!1!==n)},o=function(e,n){return t.emit("event",new at(e),n)};t.on("product",e),t.on("PRODUCT",e),t.on("addtocart",n),t.on("ADDTOCART",n),t.on("purchase",r),t.on("PURCHASE",r),t.on("checkout",o),t.on("CHECKOUT",o)}(t),function(t){var e=function(e,n){return t.emit("event",new st(e),!1!==n)},n=function(e,n){return t.emit("event",new pt(e),n)};t.on("lead",e),t.on("LEAD",e),t.on("signup",n),t.on("SIGNUP",n)}(t),function(t){var e=function(e,n){t.emit("event",new vt(e),!1!==n)};t.on("click",e),t.on("CLICK",e)}(t),function(t){var e={},n=function(n,r){n&&n.hasOwnProperty&&M.forEach((function(t){n.hasOwnProperty(t)&&"string"==typeof n[t]&&(e[t]=n[t])})),t.emit("event",new j(e),r)};t.on("view",n),t.on("VIEW",n);var r=new URLSearchParams(window.location.search).get("spclid");r&&sessionStorage.setItem("click_id",r)}(t),B(t),function(t){var e=function(e){h?console.hasOwnProperty("warn")&&console.warn("pixel already configured."):(h=!0,e&&(d=Object.keys(e).reduce((function(t,n){return d.hasOwnProperty(n)&&(t[n]=e[n]),t}),Object.assign({},d))),t.emit("configured",d),t.emit("view"))},n=function(e){h?console.hasOwnProperty("warn")&&console.warn("pixel already configured."):(h=!0,e&&(d=Object.keys(e).reduce((function(t,n){return d.hasOwnProperty(n)&&(t[n]=e[n]),t}),Object.assign({},d))),t.emit("configured",d))};t.on("configure",e),t.on("CONFIGURE",e),t.on("conf",n),t.on("CONF",n)}(t),function(t){var e=function(e,n){var r=new gt("CUSTOM_EVENT_1",e);r.action=wt.CUSTOM_EVENT_1,t.emit("event",r,n)},n=function(e,n){var r=new gt("CUSTOM_EVENT_2",e);r.action=wt.CUSTOM_EVENT_2,t.emit("event",r,n)},r=function(e,n){var r=new gt("CUSTOM_EVENT_3",e);r.action=wt.CUSTOM_EVENT_3,t.emit("event",r,n)},o=function(e,n){var r=new gt("CUSTOM_EVENT_4",e);r.action=wt.CUSTOM_EVENT_4,t.emit("event",r,n)},i=function(e,n){var r=new gt("CUSTOM_EVENT_5",e);r.action=wt.CUSTOM_EVENT_5,t.emit("event",r,n)};t.on("CUSTOM_EVENT_1",e),t.on("custom_event_1",e),t.on("CUSTOM_EVENT_2",n),t.on("custom_event_2",n),t.on("CUSTOM_EVENT_3",r),t.on("custom_event_3",r),t.on("CUSTOM_EVENT_4",o),t.on("custom_event_4",o),t.on("CUSTOM_EVENT_5",i),t.on("custom_event_5",i)}(t),Vt(t),t.once("configured",(function(){!function(t){Jt(this,void 0,void 0,(function(){var e;return zt(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,Wt()];case 1:return Ut("[Automated Matching] Loaded config:",e=n.sent()),t.emit("automatedMatchingConfigReady",e),[3,3];case 2:return Ut("[Automated Matching] ERROR: Failed to load automated matching config:",n.sent()),t.emit("automatedMatchingConfigReady",{enabled:!1}),[3,3];case 3:return[2]}}))}))}(t)})),setTimeout((function(){!function(t,e){void 0===e&&(e=5e3),H(t);var n=setInterval((function(){H(t)}),e);setTimeout((function(){clearInterval(n)}),6e6),t.addListener("send.events",(function(){H(t)}))}(t)}),1))}(Kt);var Xt=function(t){console&&"function"==typeof console.warn&&console.warn("[Pixel SDK Warning] ".concat(t))},Qt=function(){for(var t=[],e=0;e0){var n=t[0],r=t[1],o=function(t){var e=t.toLowerCase();return $t.includes(e)?{valid:!0}:{valid:!1,error:"Unsupported event type: '".concat(t,"'. Supported events are: ").concat($t.join(", "))}}(n);return o.valid||Xt(o.error||"Invalid event: ".concat(n)),Kt.emit(n,r,t[2]),new Promise((function(t){Kt.once("api.captured",(function(){t()}))}))}return Xt("No event type specified"),Promise.resolve()};window.spdt&&window.spdt.q&&window.spdt.q.length&&window.spdt.q.forEach((function(t){Qt.apply(void 0,t)})),window.pdst&&window.pdst.q&&window.pdst.q.length&&window.pdst.q.forEach((function(t){Qt.apply(void 0,t)})),window.spdt=function(){for(var t=[],e=0;e