(()=>{"use strict";var t=function(){var t;console.log("Extracting RSI checkout data");var e,n=null===(t=_rsi)||void 0===t?void 0:t.cart;return n?n.items.map((function(t){return{id:"".concat(t.id),name:t.title,price:"".concat(t.presentment_price),quantity:t.quantity}})):(e=document.querySelectorAll("._rsi-modal-line-item"),Array.from(e).map((function(t,e){var n=t.querySelector("._rsi-modal-line-item-title").innerText,o=t.querySelector("._rsi-modal-line-item-final-price").innerText.replace(/[^0-9.,-]+/g,"");return t.querySelector("._rsi-modal-line-item-quantity").innerText,{id:t.attributes["data-line-item-variant-id"].value,name:n,price:o}})))},e=function(t,e,n,o){fetch("https://events-v2.adtrace.ai/event",{method:"POST",headers:{"Content-Type":"application/json","Shopify-Domain":window.Shopify.shop,"User-Agent":navigator.userAgent,"X-AdTrace-Origin":"theme-app-extension"},body:JSON.stringify({event_id:t,event_name:e,contents:Array.isArray(n)?n:[n],currency:o,event_context:{page:{url:window.location.href,referrer:document.referrer}},cookie:document.cookie})}).catch((function(t){console.error(t)}))},n=function(t){return"string"==typeof t&&t.includes(",")&&(t=","===t[t.length-3]?t.replace(".","").replace(",","."):t.replace(",","")),t},o=function(){var t=(new Date).getTime(),e=performance&&performance.now&&1e3*performance.now()||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(n){var o=16*Math.random();return t>0?(o=(t+o)%16|0,t=Math.floor(t/16)):(o=(e+o)%16|0,e=Math.floor(e/16)),("x"==n?o:7&o|8).toString(16)}))};function r(t){return function(t){if(Array.isArray(t))return i(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 i(t,e);var n=Object.prototype.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)?i(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 i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n1&&void 0!==arguments[1]?arguments[1]:{};return r.call(window,e,i).then((function(r){if("string"==typeof e&&e.includes(c)){console.log("RSI ORDER");try{var i=t();a("CompletePayment",i[0],n,o)}catch(t){console.log(t)}}return r}))}}(0,n,o),function(e,n,o){var r=window.XMLHttpRequest.prototype.send;window.XMLHttpRequest.prototype.send=function(){var e=this;this.addEventListener("load",(function(){if(e._url&&"string"==typeof e._url&&e._url.includes(c)){console.log("RSI ORDER");try{var r=t();a("CompletePayment",r[0],n,o)}catch(t){console.log(t)}}}));for(var i=arguments.length,d=new Array(i),u=0;u