@absmartly/sdk-plugins 1.3.2 → 1.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ABsmartlyDOMLite=t():e.ABsmartlyDOMLite=t()}(this,()=>(()=>{"use strict";var e={44:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a};Object.defineProperty(t,"__esModule",{value:!0}),t.OverridesPluginLite=void 0;var l=r(609),s=r(943),c=r(186),u=function(){function e(e){var t,r,n,i,o;if(this.initialized=!1,!e.context)throw new Error("[OverridesPluginLite] Context is required");this.config={context:e.context,cookieName:null!==(t=e.cookieName)&&void 0!==t?t:"absmartly_overrides",useQueryString:null===(r=e.useQueryString)||void 0===r||r,queryPrefix:null!==(n=e.queryPrefix)&&void 0!==n?n:"exp_",persistQueryToCookie:null!==(i=e.persistQueryToCookie)&&void 0!==i&&i,debug:null!==(o=e.debug)&&void 0!==o&&o},this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Initialized with config:",{cookieName:this.config.cookieName,useQueryString:this.config.useQueryString,queryPrefix:this.config.queryPrefix})}return e.prototype.ready=function(){return n(this,void 0,void 0,function(){var e,t,r,n,s,c,u,g,d,h,p;return i(this,function(i){if(this.initialized)return this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Already initialized"),[2];if(this.initialized=!0,this.registerWithContext(),this.registerGlobally(),e={},this.config.useQueryString&&"undefined"!=typeof window&&(e=this.getQueryStringOverrides(),this.config.persistQueryToCookie&&this.config.cookieName&&Object.keys(e).length>0&&this.persistOverridesToCookie(e)),0===Object.keys(e).length&&this.config.cookieName&&(e=this.getCookieOverrides()),0===Object.keys(e).length)return this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] No overrides found"),[2];try{for(t=o(Object.entries(e)),r=t.next();!r.done;r=t.next())n=a(r.value,2),s=n[0],c=n[1],u="number"==typeof c?c:c.variant,isNaN(u)?this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Skipping invalid variant for ".concat(s,": ").concat(u)):(null===(p=(h=this.config.context).override)||void 0===p||p.call(h,s,u),this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Override: ".concat(s," -> variant ").concat(u)))}catch(e){g={error:e}}finally{try{r&&!r.done&&(d=t.return)&&d.call(t)}finally{if(g)throw g.error}}return[2]})})},e.prototype.initialize=function(){return n(this,void 0,void 0,function(){return i(this,function(e){return[2,this.ready()]})})},e.prototype.getQueryStringOverrides=function(){if("undefined"==typeof window||!window.location)return{};var e=(0,c.getQueryStringOverrides)(this.config.queryPrefix);return this.config.debug&&Object.keys(e).length>0&&(0,l.logDebug)("[OverridesPluginLite] Query string overrides:",e),e},e.prototype.getCookieOverrides=function(){return"undefined"==typeof document?{}:(0,c.getCookieOverrides)(this.config.cookieName)},e.prototype.persistOverridesToCookie=function(e){if(this.config.cookieName&&"undefined"!=typeof document&&((0,c.persistOverridesToCookie)(e,{cookieName:this.config.cookieName}),this.config.debug)){var t=(0,c.serializeOverrides)(e);(0,l.logDebug)("[OverridesPluginLite] Persisted to cookie:",t)}},e.prototype.registerWithContext=function(){this.config.context&&(this.config.context.__plugins||(this.config.context.__plugins={}),this.config.context.__plugins.overridesPlugin={name:"OverridesPluginLite",version:"1.0.0",initialized:!0,capabilities:["cookie-overrides","query-overrides"],instance:this,timestamp:Date.now()},this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Registered with context at __plugins.overridesPlugin"))},e.prototype.unregisterFromContext=function(){var e,t;(null===(t=null===(e=this.config.context)||void 0===e?void 0:e.__plugins)||void 0===t?void 0:t.overridesPlugin)&&(delete this.config.context.__plugins.overridesPlugin,this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Unregistered from context"))},e.prototype.destroy=function(){this.initialized=!1,this.unregisterFromContext(),this.unregisterGlobally()},e.prototype.registerGlobally=function(){(0,s.registerPlugin)("overrides",{name:"OverridesPluginLite",version:"1.0.0",initialized:!0,timestamp:Date.now(),capabilities:["cookie-overrides","query-overrides"],instance:this}),this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Registered in global window.__ABSMARTLY_PLUGINS__")},e.prototype.unregisterGlobally=function(){(0,s.unregisterPlugin)("overrides"),this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Unregistered from global registry")},e}();t.OverridesPluginLite=u},91:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},l=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.CookiePlugin=void 0;var s=r(609),c=r(319),u=function(){function e(e){void 0===e&&(e={}),this.context=e.context,this.debug=e.debug||!1,this.cookieDomain=e.cookieDomain||".absmartly.com",this.cookiePath=e.cookiePath||"/",this.sameSite=e.sameSite||"Lax",this.secure=e.secure||!1,this.cookieExpiryDays=e.cookieExpiryDays||730,this.unitIdCookieName=e.unitIdCookieName||"abs",this.publicIdCookieName=e.publicIdCookieName||"abs_public",this.expiryCookieName=e.expiryCookieName||"abs_expiry",this.utmCookieName=e.utmCookieName||"abs_utm_params",this.utmParams=e.utmParamsList||["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],this.autoUpdateExpiry=!1!==e.autoUpdateExpiry,this.expiryCheckInterval=e.expiryCheckInterval||30}return e.prototype.debugLog=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.debug&&s.logDebug.apply(void 0,a(["[CookiePlugin]"],o(e),!1))},e.prototype.setCookie=function(e,t,r){var n=void 0!==r?r:this.cookieExpiryDays,i=(0,c.setCookie)(e,t,n,{domain:this.cookieDomain,path:this.cookiePath,sameSite:this.sameSite,secure:this.secure});return i&&this.debugLog("Set cookie ".concat(e,":"),t),i},e.prototype.deleteCookie=function(e){(0,c.deleteCookie)(e,{domain:this.cookieDomain,path:this.cookiePath})},e.prototype.getUnitId=function(){if(this.unitId)return this.unitId;var e=navigator.cookieEnabled,t=(0,c.isLocalStorageAvailable)(),r=null;return e&&(r=(0,c.getCookie)(this.unitIdCookieName)||(0,c.getCookie)(this.publicIdCookieName)),!r&&t&&(r=localStorage.getItem("abs_id")),r&&(this.unitId=r),r},e.prototype.setUnitId=function(e){this.unitId=e;var t=navigator.cookieEnabled,r=(0,c.isLocalStorageAvailable)();t&&(this.setCookie(this.unitIdCookieName,e),this.setCookie(this.publicIdCookieName,e),this.autoUpdateExpiry&&this.updateExpiryTimestamp()),r&&localStorage.setItem("abs_id",e),this.debugLog("Unit ID set:",e)},e.prototype.generateAndSetUnitId=function(){var e=(0,c.generateUniqueId)();return this.setUnitId(e),e},e.prototype.updateExpiryTimestamp=function(){if(navigator.cookieEnabled){var e=Date.now();this.setCookie(this.expiryCookieName,e.toString()),this.debugLog("Updated expiry timestamp:",e)}},e.prototype.isExpiryFresh=function(){if(!navigator.cookieEnabled)return!1;var e=(0,c.getCookie)(this.expiryCookieName);if(!e)return!1;try{var t=parseInt(e,10),r=(Date.now()-t)/864e5,n=r<=this.expiryCheckInterval;return this.debugLog("Expiry check:",{daysSinceSet:r,isFresh:n}),n}catch(e){return this.debugLog("Error parsing expiry cookie:",e),!1}},e.prototype.getUtmParams=function(){var e,t,r,n,i={},o=new URLSearchParams(window.location.search);try{for(var a=l(this.utmParams),s=a.next();!s.done;s=a.next()){var c=s.value;(h=o.get(c))&&(i[c]=h)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}if(0===Object.keys(i).length&&document.referrer)try{var u=new URL(document.referrer);try{for(var g=l(this.utmParams),d=g.next();!d.done;d=g.next()){var h;c=d.value;(h=u.searchParams.get(c))&&(i[c]=h)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=g.return)&&n.call(g)}finally{if(r)throw r.error}}}catch(e){this.debugLog("Error parsing referrer URL:",e)}if(0===Object.keys(i).length){var p=this.getStoredUtmParams();if(p)return p}return i},e.prototype.storeUtmParams=function(e){if(0!==Object.keys(e).length){var t={params:e,timestamp:Date.now()},r=navigator.cookieEnabled;if((0,c.isLocalStorageAvailable)())try{localStorage.setItem(this.utmCookieName,JSON.stringify(t)),this.debugLog("Stored UTM params in localStorage:",e)}catch(e){this.debugLog("Failed to store UTM params in localStorage:",e)}r&&(this.setCookie(this.utmCookieName,JSON.stringify(t),30),this.debugLog("Stored UTM params in cookie:",e))}},e.prototype.getStoredUtmParams=function(){var e=null,t=(0,c.isLocalStorageAvailable)(),r=navigator.cookieEnabled;if(t)try{e=localStorage.getItem(this.utmCookieName)}catch(e){this.debugLog("Failed to get UTM params from localStorage:",e)}if(!e&&r&&(e=(0,c.getCookie)(this.utmCookieName)),e)try{var n=JSON.parse(e);if(Date.now()-n.timestamp<2592e6)return n.params}catch(e){this.debugLog("Failed to parse stored UTM params:",e)}return null},e.prototype.applyUtmAttributesToContext=function(e){var t,r,n=e||this.context;if(n){var i=this.getUtmParams();Object.keys(i).length>0&&this.storeUtmParams(i);try{for(var a=l(Object.entries(i)),c=a.next();!c.done;c=a.next()){var u=o(c.value,2),g=u[0],d=u[1],h=g.slice(4);n.attribute(h,d),this.debugLog("Set attribute ".concat(h,":"),d)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}else(0,s.logDebug)("[CookiePlugin] No context available to apply UTM attributes")},e.prototype.clearAllCookies=function(){this.deleteCookie(this.unitIdCookieName),this.deleteCookie(this.publicIdCookieName),this.deleteCookie(this.expiryCookieName),this.deleteCookie(this.utmCookieName),(0,c.isLocalStorageAvailable)()&&(localStorage.removeItem("abs_id"),localStorage.removeItem(this.utmCookieName)),this.unitId=void 0,this.debugLog("All cookies and storage cleared")},e.prototype.ready=function(){return n(this,void 0,void 0,function(){var e;return i(this,function(t){return this.debugLog("Initializing CookiePlugin"),(e=this.getUnitId())?(this.debugLog("Using existing unit ID:",e),this.autoUpdateExpiry&&!this.isExpiryFresh()&&this.updateExpiryTimestamp()):(e=this.generateAndSetUnitId(),this.debugLog("Generated new unit ID:",e)),this.context&&this.applyUtmAttributesToContext(),this.debugLog("CookiePlugin initialized successfully"),[2]})})},e.prototype.initialize=function(){return n(this,void 0,void 0,function(){return i(this,function(e){return[2,this.ready()]})})},e.prototype.setContext=function(e){this.context=e,this.debugLog("Context set for CookiePlugin")},e.prototype.needsServerSideCookie=function(){var e=this.getUnitId(),t=navigator.cookieEnabled,r=(0,c.isLocalStorageAvailable)();if(e){if(t&&!this.isExpiryFresh())return this.debugLog("Existing ID present but expiry not fresh - need worker call"),!0}else if(t||r){var n=(0,c.getCookie)(this.expiryCookieName);return this.debugLog(n?"No existing ID but expiry cookie exists - need worker call":"No existing ID and no expiry cookie - need worker call"),!0}return!1},e.prototype.trackLanding=function(e){var t=e||this.context;if(t){var r=new URLSearchParams(window.location.search),n=this.utmParams.some(function(e){return r.get(e)}),i=document.referrer,o=i&&!i.includes(this.cookieDomain.replace(".","")),a=navigator.cookieEnabled||(0,c.isLocalStorageAvailable)(),l=!!((0,c.getCookie)(this.unitIdCookieName)||(0,c.getCookie)(this.publicIdCookieName)||(0,c.getCookie)(this.expiryCookieName)||(0,c.isLocalStorageAvailable)()&&localStorage.getItem("abs_id"));if(n||o||a&&!l){var u={referrer_url:i||"",landing_url:window.location.href,accepts_cookies:navigator.cookieEnabled,accepts_storage:(0,c.isLocalStorageAvailable)(),has_utm:n};this.debugLog("Tracking landing:",u),t.track("landing",u)}}else(0,s.logDebug)("[CookiePlugin] No context available for tracking landing")},e}();t.CookiePlugin=u},186:function(e,t){var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a};function i(e,i){var o,a;if(void 0===e&&(e=t.DEFAULT_OVERRIDE_QUERY_PREFIX),"undefined"==typeof window&&!i)return{};var l=i||new URLSearchParams(window.location.search),s={};try{for(var c=r(l.entries()),u=c.next();!u.done;u=c.next()){var g=n(u.value,2),d=g[0],h=g[1];if(d.startsWith(e)){var p=d.substring(e.length);if(p){var f=h.split(","),y=parseInt(f[0],10);isNaN(y)||(1===f.length?s[p]=y:s[p]={variant:y,env:f[1]?parseInt(f[1],10):void 0,id:f[2]?parseInt(f[2],10):void 0})}}}}catch(e){o={error:e}}finally{try{u&&!u.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}return s}function o(e){var t,i;if(!e)return{};var o={},a=e;e.includes("|")&&(a=(f=e.split("|"))[f.length-1]);if(!a)return{};var l=a.split(",");try{for(var s=r(l),c=s.next();!c.done;c=s.next()){var u=c.value,g=n(u.split(":"),2),d=g[0],h=g[1];if(d&&h){var p=decodeURIComponent(d),f=h.split("."),y=parseInt(f[0],10);isNaN(y)||(1===f.length?o[p]=y:o[p]={variant:y,env:f[1]?parseInt(f[1],10):void 0,id:f[2]?parseInt(f[2],10):void 0})}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(i=s.return)&&i.call(s)}finally{if(t)throw t.error}}return o}function a(e,n){var i,a;void 0===e&&(e=t.DEFAULT_OVERRIDE_COOKIE_NAME);var l=null!=n?n:"undefined"!=typeof document?document.cookie:"";if(!l)return{};var s=e+"=",c=l.split(";");try{for(var u=r(c),g=u.next();!g.done;g=u.next()){var d=g.value;if(0===(d=d.trim()).indexOf(s))return o(decodeURIComponent(d.substring(s.length)))}}catch(e){i={error:e}}finally{try{g&&!g.done&&(a=u.return)&&a.call(u)}finally{if(i)throw i.error}}return{}}function l(e){var t,i,o=[];try{for(var a=r(Object.entries(e)),l=a.next();!l.done;l=a.next()){var s=n(l.value,2),c=s[0],u=s[1],g=encodeURIComponent(c);if("number"==typeof u)o.push("".concat(g,":").concat(u));else{var d="".concat(g,":").concat(u.variant);void 0!==u.env&&(d+=".".concat(u.env)),void 0!==u.id&&(d+=".".concat(u.id)),o.push(d)}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}return o.join(",")}function s(e,r){if(void 0===r&&(r={}),"undefined"!=typeof document){var n=r.cookieName||t.DEFAULT_OVERRIDE_COOKIE_NAME,i=r.maxAge||86400,o=l(e);document.cookie="".concat(n,"=").concat(encodeURIComponent(o),";path=/;max-age=").concat(i)}}function c(e){var t,i,o={};try{for(var a=r(Object.entries(e)),l=a.next();!l.done;l=a.next()){var s=n(l.value,2),c=s[0],u=s[1];o[c]="number"==typeof u?u:u.variant}}catch(e){t={error:e}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}return o}Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_OVERRIDE_QUERY_PREFIX=t.DEFAULT_OVERRIDE_COOKIE_NAME=void 0,t.getQueryStringOverrides=i,t.parseOverrideCookie=o,t.getCookieOverrides=a,t.serializeOverrides=l,t.persistOverridesToCookie=s,t.getOverrides=function(e,r,n,o){void 0===e&&(e=t.DEFAULT_OVERRIDE_COOKIE_NAME);void 0===r&&(r=t.DEFAULT_OVERRIDE_QUERY_PREFIX);var l=i(r,n);if(Object.keys(l).length>0)return"undefined"!=typeof document&&s(l,{cookieName:e,maxAge:86400}),c(l);return c(a(e,o))},t.DEFAULT_OVERRIDE_COOKIE_NAME="absmartly_overrides",t.DEFAULT_OVERRIDE_QUERY_PREFIX="exp_"},214:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a};Object.defineProperty(t,"__esModule",{value:!0}),t.PendingChangeManager=void 0;var a=r(609),l=function(){function e(e,t){void 0===t&&(t=!1),this.applyFn=e,this.pending=new Map,this.observers=new Map,this.appliedSelectors=new Set,this.batchTimer=null,this.batchedWork=new Set,this.debug=t}return e.prototype.addPending=function(e){var t=e.change,r=e.observerRoot,i=r;r&&!document.querySelector(r)&&(this.debug&&(0,a.logDebug)("[ABsmartly] Observer root not found, using document:",r),i=void 0);var o="".concat(t.selector,"-").concat(i||"document");this.debug&&(0,a.logDebug)("[ABsmartly] Adding pending change for selector:",t.selector);var l=this.getObserverRoot(i).querySelector(t.selector);if(l)this.applyChange(l,n(n({},e),{observerRoot:i}));else{var s=this.pending.get(o)||[];s.push(n(n({},e),{observerRoot:i})),this.pending.set(o,s),this.ensureObserver(i)}},e.prototype.removePending=function(e,t,r){var n="".concat(e,"-").concat(r||"document"),i=this.pending.get(n);if(i){var o=i.filter(function(e){return e.experimentName!==t});0===o.length?this.pending.delete(n):this.pending.set(n,o)}this.checkObserverCleanup(r)},e.prototype.removeAllPending=function(e){var t,r;try{for(var n=i(this.pending.entries()),a=n.next();!a.done;a=n.next()){var l=o(a.value,2),s=l[0],c=l[1].filter(function(t){return t.experimentName!==e});0===c.length?this.pending.delete(s):this.pending.set(s,c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}this.cleanupObservers()},e.prototype.ensureObserver=function(e){var t=this,r=e||"document";if(!this.observers.has(r)){var n=this.getObserverRoot(e),i=new MutationObserver(function(r){t.handleMutations(r,e)});i.observe(n,{childList:!0,subtree:!0}),this.observers.set(r,i),this.debug&&(0,a.logDebug)("[ABsmartly] Started observer for root:",r)}},e.prototype.handleMutations=function(e,t){var r,n,a,l,s,c,u,g,d=this,h=[];try{for(var p=i(e),f=p.next();!f.done;f=p.next()){var y=f.value,v=function(e){var r,n,a,l;if(!(e instanceof Element))return"continue";var s=t||"document";try{for(var c=(r=void 0,i(m.pending.entries())),u=c.next();!u.done;u=c.next()){var g=o(u.value,2),p=g[0],f=g[1];if(p.endsWith("-".concat(s))){var y=function(t){var r,n,o=t.change;if(e.matches(o.selector))return h.push(function(){return d.applyChange(e,t)}),"continue";var a=e.querySelectorAll(o.selector),l=function(e){h.push(function(){return d.applyChange(e,t)})};try{for(var s=(r=void 0,i(a)),c=s.next();!c.done;c=s.next()){l(c.value)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}};try{for(var v=(a=void 0,i(f)),b=v.next();!b.done;b=v.next()){y(b.value)}}catch(e){a={error:e}}finally{try{b&&!b.done&&(l=v.return)&&l.call(v)}finally{if(a)throw a.error}}}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}},m=this;try{for(var b=(a=void 0,i(y.addedNodes)),x=b.next();!x.done;x=b.next()){v(x.value)}}catch(e){a={error:e}}finally{try{x&&!x.done&&(l=b.return)&&l.call(b)}finally{if(a)throw a.error}}}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}if(h.length>0)if("undefined"!=typeof requestAnimationFrame){requestAnimationFrame(function(){d.processBatchedWork()});try{for(var w=i(h),E=w.next();!E.done;E=w.next()){var S=E.value;this.batchedWork.add(S)}}catch(e){s={error:e}}finally{try{E&&!E.done&&(c=w.return)&&c.call(w)}finally{if(s)throw s.error}}}else try{for(var A=i(h),C=A.next();!C.done;C=A.next()){(S=C.value)()}}catch(e){u={error:e}}finally{try{C&&!C.done&&(g=A.return)&&g.call(A)}finally{if(u)throw u.error}}},e.prototype.processBatchedWork=function(){var e,t,r=Array.from(this.batchedWork);this.batchedWork.clear(),this.batchTimer=null,this.debug&&r.length>0&&(0,a.logDebug)("[ABsmartly] Processing batched work:",r.length,"items");try{for(var n=i(r),o=n.next();!o.done;o=n.next()){(0,o.value)()}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},e.prototype.applyChange=function(e,t){var r=t.change,n=t.experimentName,i=t.observerRoot,o="".concat(r.selector,"-").concat(i||"document","-").concat(n);if(!this.appliedSelectors.has(o)&&(this.debug&&(0,a.logDebug)("[ABsmartly] Applying pending change to element:",r.selector),this.applyFn(r,n,e))){this.appliedSelectors.add(o);var l="".concat(r.selector,"-").concat(i||"document"),s=this.pending.get(l);if(s){var c=s.filter(function(e){return e.experimentName!==n||e.change.selector!==r.selector});0===c.length?this.pending.delete(l):this.pending.set(l,c)}this.checkObserverCleanup(i)}},e.prototype.getObserverRoot=function(e){if(!e)return document.documentElement;var t=document.querySelector(e);return t||document.documentElement},e.prototype.checkObserverCleanup=function(e){var t,r,n=e||"document",o=!1;try{for(var l=i(this.pending.keys()),s=l.next();!s.done;s=l.next()){if(s.value.endsWith("-".concat(n))){o=!0;break}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}if(!o){var c=this.observers.get(n);c&&(c.disconnect(),this.observers.delete(n),this.debug&&(0,a.logDebug)("[ABsmartly] Disconnected observer for root:",n))}},e.prototype.cleanupObservers=function(){var e,t,r,n,o,l,s=[];try{for(var c=i(this.observers.keys()),u=c.next();!u.done;u=c.next()){var g=u.value,d=!1;try{for(var h=(r=void 0,i(this.pending.keys())),p=h.next();!p.done;p=h.next()){if(p.value.endsWith("-".concat(g))){d=!0;break}}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}d||s.push(g)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}try{for(var f=i(s),y=f.next();!y.done;y=f.next()){g=y.value;var v=this.observers.get(g);v&&(v.disconnect(),this.observers.delete(g),this.debug&&(0,a.logDebug)("[ABsmartly] Cleaned up observer for root:",g))}}catch(e){o={error:e}}finally{try{y&&!y.done&&(l=f.return)&&l.call(f)}finally{if(o)throw o.error}}},e.prototype.destroy=function(){var e,t;this.batchTimer&&(clearTimeout(this.batchTimer),this.batchTimer=null);try{for(var r=i(this.observers.values()),n=r.next();!n.done;n=r.next()){n.value.disconnect()}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.observers.clear(),this.pending.clear(),this.appliedSelectors.clear(),this.batchedWork.clear(),this.debug&&(0,a.logDebug)("[ABsmartly] PendingChangeManager destroyed")},e.prototype.getPendingCount=function(){var e,t,r=0;try{for(var n=i(this.pending.values()),o=n.next();!o.done;o=n.next()){r+=o.value.length}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},e.prototype.getAppliedCount=function(){return this.appliedSelectors.size},e.prototype.hasPendingForExperiment=function(e){var t,r;try{for(var n=i(this.pending.values()),o=n.next();!o.done;o=n.next()){if(o.value.some(function(t){return t.experimentName===e}))return!0}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return!1},e}();t.PendingChangeManager=l},253:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},o=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.HTMLInjector=void 0;var a=r(609),l=r(973),s=function(){function e(e){void 0===e&&(e=!1),this.injectedIds=new Set,this.debug=e}return e.prototype.parseInjectionKey=function(e){var t,r;try{for(var i=n(["headStart","headEnd","bodyStart","bodyEnd"]),o=i.next();!o.done;o=i.next()){var l=o.value;if(e===l)return{location:l,priority:0};if(e.startsWith(l)){var s=e.substring(l.length),c=parseInt(s,10);if(!isNaN(c))return{location:l,priority:c}}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return this.debug&&(0,a.logDebug)("[HTMLInjector] Invalid injection key:",e),null},e.prototype.collectInjections=function(e,t){var r,o,s,c,u,g,d,h;void 0===t&&(t=window.location.href);var p=new Map;try{for(var f=n(e),y=f.next();!y.done;y=f.next()){var v=i(y.value,2),m=v[0],b=v[1];try{for(var x=(s=void 0,n(b)),w=x.next();!w.done;w=x.next()){var E=i(w.value,2),S=E[0],A=E[1];if(A&&"object"==typeof A){if(A.urlFilter)if(!l.URLMatcher.matches(A.urlFilter,t)){this.debug&&(0,a.logDebug)("[HTMLInjector] Skipping ".concat(m," variant ").concat(S," - URL filter doesn't match:"),{currentUrl:t,urlFilter:A.urlFilter});continue}var C=A.data;if(C&&"object"==typeof C)try{for(var D=(u=void 0,n(Object.entries(C))),O=D.next();!O.done;O=D.next()){var _=i(O.value,2),k=_[0],P=_[1];if("string"==typeof P){var M=this.parseInjectionKey(k);if(M){var L={code:P,priority:M.priority,location:M.location};p.has(M.location)||p.set(M.location,[]),p.get(M.location).push(L),this.debug&&(0,a.logDebug)("[HTMLInjector] Collected injection:",{experiment:m,variant:S,location:M.location,priority:M.priority,codeLength:P.length})}}else this.debug&&(0,a.logDebug)("[HTMLInjector] Skipping non-string injection code for key ".concat(k,":"),P)}}catch(e){u={error:e}}finally{try{O&&!O.done&&(g=D.return)&&g.call(D)}finally{if(u)throw u.error}}else this.debug&&(0,a.logDebug)("[HTMLInjector] Invalid injection data for ".concat(m," variant ").concat(S,":"),C)}else this.debug&&(0,a.logDebug)("[HTMLInjector] Invalid injection data for ".concat(m," variant ").concat(S,":"),A)}}catch(e){s={error:e}}finally{try{w&&!w.done&&(c=x.return)&&c.call(x)}finally{if(s)throw s.error}}}}catch(e){r={error:e}}finally{try{y&&!y.done&&(o=f.return)&&o.call(f)}finally{if(r)throw r.error}}try{for(var T=n(p),I=T.next();!I.done;I=T.next()){var N=i(I.value,2),j=N[0],R=N[1];R.sort(function(e,t){return t.priority-e.priority}),this.debug&&(0,a.logDebug)("[HTMLInjector] Sorted ".concat(j," injections by priority:"),{location:j,count:R.length,priorities:R.map(function(e){return e.priority})})}}catch(e){d={error:e}}finally{try{I&&!I.done&&(h=T.return)&&h.call(T)}finally{if(d)throw d.error}}return p},e.prototype.inject=function(e){var t,r,l,s;try{for(var c=n(e),u=c.next();!u.done;u=c.next()){var g=i(u.value,2),d=g[0],h=g[1],p="headStart"===d||"bodyStart"===d?o([],i(h),!1).reverse():h;try{for(var f=(l=void 0,n(p)),y=f.next();!y.done;y=f.next()){var v=y.value;this.injectAtLocation(d,v.code)}}catch(e){l={error:e}}finally{try{y&&!y.done&&(s=f.return)&&s.call(f)}finally{if(l)throw l.error}}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}this.debug&&(0,a.logDebug)("[HTMLInjector] All injections complete")},e.prototype.injectAtLocation=function(e,t){var r=this.simpleHash(t),n="absmartly-inject-".concat(e,"-").concat(r);if(!this.injectedIds.has(n))try{switch(e){case"headStart":this.injectHeadStart(t,n);break;case"headEnd":this.injectHeadEnd(t,n);break;case"bodyStart":this.injectBodyStart(t,n);break;case"bodyEnd":this.injectBodyEnd(t,n)}this.injectedIds.add(n),this.debug&&(0,a.logDebug)("[HTMLInjector] Injected at ".concat(e,":"),{location:e,codeLength:t.length,injectionId:n})}catch(t){this.debug&&(0,a.logDebug)("[HTMLInjector] Error injecting at ".concat(e,":"),t)}},e.prototype.injectHeadStart=function(e,t){if(document.head){var r=this.createContainer(e,t);document.head.insertBefore(r,document.head.firstChild)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <head> element not found for headStart injection")},e.prototype.injectHeadEnd=function(e,t){if(document.head){var r=this.createContainer(e,t);document.head.appendChild(r)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <head> element not found for headEnd injection")},e.prototype.injectBodyStart=function(e,t){if(document.body){var r=this.createContainer(e,t);document.body.insertBefore(r,document.body.firstChild)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <body> element not found for bodyStart injection")},e.prototype.injectBodyEnd=function(e,t){if(document.body){var r=this.createContainer(e,t);document.body.appendChild(r)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <body> element not found for bodyEnd injection")},e.prototype.createContainer=function(e,t){var r=document.createElement("div");return r.id=t,r.setAttribute("data-absmartly-injection","true"),r.innerHTML=e,r},e.prototype.simpleHash=function(e){for(var t=0,r=0;r<e.length;r++){t=(t<<5)-t+e.charCodeAt(r),t&=t}return Math.abs(t).toString(36)},e.prototype.destroy=function(){var e,t;try{for(var r=n(this.injectedIds),i=r.next();!i.done;i=r.next()){var o=i.value,l=document.getElementById(o);l&&l.remove()}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.injectedIds.clear(),this.debug&&(0,a.logDebug)("[HTMLInjector] Destroyed and cleaned up all injections")},e}();t.HTMLInjector=s},319:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getCookie=function(e){var t,r="; ".concat(document.cookie).split("; ".concat(e,"="));if(2===r.length){return(null===(t=r.pop())||void 0===t?void 0:t.split(";").shift())||null}return null},t.setCookie=i,t.deleteCookie=function(e,t){void 0===t&&(t={});i(e,"",-1,t)},t.generateUniqueId=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2)},t.generateUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},t.isLocalStorageAvailable=function(){try{var e="__localStorage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}};var n=r(609);function i(e,t,r,i){void 0===i&&(i={});try{var o=new Date;o.setTime(o.getTime()+24*r*60*60*1e3);var a="expires=".concat(o.toUTCString()),l=i.path||"/",s="".concat(e,"=").concat(t,";").concat(a,";path=").concat(l);i.domain&&"localhost"!==i.domain&&(s+=";domain=".concat(i.domain));var c=i.sameSite||"Lax";return s+=";SameSite=".concat(c),i.secure&&(s+=";Secure"),document.cookie=s,!0}catch(t){return(0,n.logDebug)("Unable to set cookie ".concat(e,":"),t),!1}}},356:function(e,t,r){var n=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.VariantExtractor=void 0;var l=r(609),s=r(973),c=function(){function e(e,t,r){void 0===t&&(t="__dom_changes"),void 0===r&&(r=!1),this.cachedAllChanges=null,this.context=e,this.variableName=t,this.debug=r}return e.prototype.clearCache=function(){this.cachedAllChanges=null},e.prototype.extractAllChanges=function(){var e,t,r,n,s,c,u;if(this.cachedAllChanges)return this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Returning cached changes"),this.cachedAllChanges;var g=new Map;try{var d=this.context.data();if(this.debug&&(0,l.logDebug)("[VariantExtractor DEBUG] Raw context data structure:",{hasData:!!d,contextKeys:d?Object.keys(d):[],experimentCount:(null===(r=null==d?void 0:d.experiments)||void 0===r?void 0:r.length)||0,firstExperiment:(null===(n=null==d?void 0:d.experiments)||void 0===n?void 0:n[0])?{name:d.experiments[0].name,variantCount:(null===(s=d.experiments[0].variants)||void 0===s?void 0:s.length)||0,firstVariantStructure:(null===(c=d.experiments[0].variants)||void 0===c?void 0:c[0])?Object.keys(d.experiments[0].variants[0]):[]}:null,rawContextData:JSON.stringify(d).substring(0,500)+"..."}),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Extracting changes from context:",{hasData:!!d,experimentCount:(null===(u=null==d?void 0:d.experiments)||void 0===u?void 0:u.length)||0}),null==d?void 0:d.experiments){this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Available experiments:",d.experiments.map(function(e){var t;return{name:e.name,hasVariants:!!e.variants,variantCount:(null===(t=e.variants)||void 0===t?void 0:t.length)||0}}));try{for(var h=i(d.experiments),p=h.next();!p.done;p=h.next()){var f=p.value,y=this.extractAllVariantsForExperiment(f);y.size>0?(g.set(f.name,y),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Experiment '".concat(f.name,"' has DOM changes:"),{variantsWithChanges:Array.from(y.keys()),changesByVariant:Array.from(y.entries()).map(function(e){var t=o(e,2),r=t[0],n=t[1];return{variant:r,changeCount:n.length,changeTypes:a([],o(new Set(n.map(function(e){return e.type}))),!1)}})})):this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Experiment '".concat(f.name,"' has no DOM changes"))}}catch(t){e={error:t}}finally{try{p&&!p.done&&(t=h.return)&&t.call(h)}finally{if(e)throw e.error}}}}catch(e){(0,l.logDebug)("[ABsmartly] Error extracting DOM changes:",e)}return this.cachedAllChanges=g,g},e.prototype.extractAllVariantsForExperiment=function(e){var t,r=new Map;if(this.debug&&(0,l.logDebug)("[DEBUG] Processing experiment: ".concat(e.name," with ").concat((null===(t=e.variants)||void 0===t?void 0:t.length)||0," variants")),!e.variants)return(0,l.logDebug)("[DEBUG] No variants found for experiment: ".concat(e.name)),r;for(var n=0;n<e.variants.length;n++){var i=e.variants[n];if(i){var o=null;if(i.config)try{var a="string"==typeof i.config?JSON.parse(i.config):i.config;(0,l.logDebug)("[VariantExtractor DEBUG] [".concat(e.name,"] Parsed config for variant ").concat(n,":"),a),a&&a[this.variableName]?(o=a[this.variableName],(0,l.logDebug)("[VariantExtractor DEBUG] [".concat(e.name,"] ✓ Found DOM changes in config[").concat(this.variableName,"]:"),o)):(0,l.logDebug)("[VariantExtractor DEBUG] [".concat(e.name,"] ✗ No ").concat(this.variableName," field found in parsed config for variant ").concat(n))}catch(t){(0,l.logDebug)("[VariantExtractor DEBUG] [".concat(e.name,"] ✗ Failed to parse variant.config for variant ").concat(n,":"),t,"Raw config:","string"==typeof i.config?i.config.substring(0,100):"")}else(0,l.logDebug)("[VariantExtractor DEBUG] [".concat(e.name,"] ✗ No config field found for variant ").concat(n));if(o){var s=this.extractChangesFromData(o);s&&s.length>0&&r.set(n,s)}}}return r},e.prototype.extractChangesFromData=function(e){if(!e)return null;if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return(0,l.logDebug)("[ABsmartly] Failed to parse DOM changes JSON:",e),null}if(e&&"object"==typeof e&&!Array.isArray(e)&&"changes"in e){var t=e;return this.parseChanges(t.changes)}return this.parseChanges(e)},e.prototype.getExperimentChanges=function(e){var t=this.extractAllChanges().get(e);if(!t||0===t.size)return null;var r=this.context.peek(e);return null==r?(this.debug&&(0,l.logDebug)("[ABsmartly] No variant selected for ".concat(e)),null):t.get(r)||null},e.prototype.parseChanges=function(e){var t,r;if(!e)return null;if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return(0,l.logDebug)("[ABsmartly] Failed to parse DOM changes JSON:",e),null}if(!Array.isArray(e))return this.debug&&(0,l.logDebug)("[ABsmartly] DOM changes data is not an array"),null;var n=[];try{for(var o=i(e),a=o.next();!a.done;a=o.next()){var s=a.value;this.isValidChange(s)?n.push(s):this.debug&&(0,l.logDebug)("[ABsmartly] Invalid DOM change:",s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return n.length>0?n:null},e.prototype.isValidChange=function(e){if(!e||"object"!=typeof e)return!1;var t=e;if(void 0===t.selector||null===t.selector||!t.type)return!1;if(!["text","html","style","class","attribute","javascript","move","create","delete","styleRules"].includes(t.type))return!1;switch(t.type){case"class":if(!t.add&&!t.remove)return!1;if(t.add&&!Array.isArray(t.add))return!1;if(t.remove&&!Array.isArray(t.remove))return!1;break;case"move":if(!t.targetSelector)return!1;break;case"create":if(!t.element||!t.targetSelector)return!1;break;case"style":case"attribute":if(!t.value||"object"!=typeof t.value)return!1}return!0},e.prototype.getAllVariantChanges=function(e){var t=this.extractAllChanges().get(e);if(!t)return[];for(var r=Math.max.apply(Math,a([],o(t.keys()),!1)),n=[],i=0;i<=r;i++)n.push(t.get(i)||[]);return n},e.prototype.getExperiment=function(e){try{var t=this.context.data();return t&&t.experiments&&t.experiments.find(function(t){return t.name===e})||null}catch(t){return this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Failed to get experiment '".concat(e,"' - context may not be ready:"),t),null}},e.prototype.getAllVariantsData=function(e){var t=new Map;try{var r=this.context.data();if(!(null==r?void 0:r.experiments))return t;var n=r.experiments.find(function(t){return t.name===e});if(!(null==n?void 0:n.variants))return t;for(var i=0;i<n.variants.length;i++){var o=n.variants[i];if(o){var a=null;if(o.variables&&o.variables[this.variableName])a=o.variables[this.variableName];else if(o.config)try{var s="string"==typeof o.config?JSON.parse(o.config):o.config;s&&s[this.variableName]&&(a=s[this.variableName])}catch(e){(0,l.logDebug)("[VariantExtractor] Failed to parse variant.config:",e)}if(a){if("string"==typeof a)try{a=JSON.parse(a)}catch(e){(0,l.logDebug)("[ABsmartly] Failed to parse DOM changes JSON:",e);continue}t.set(i,a)}else t.set(i,null)}}}catch(e){(0,l.logDebug)("[ABsmartly] Error getting all variants data:",e)}return t},e.prototype.anyVariantMatchesURL=function(e,t){var r,n;void 0===t&&(t=window.location.href);var a=this.getAllVariantsData(e),l=!1;try{for(var c=i(a),u=c.next();!u.done;u=c.next()){var g=o(u.value,2)[1];if(g&&"object"==typeof g&&!Array.isArray(g)&&"urlFilter"in g){var d=g;if(d.urlFilter&&(l=!0,s.URLMatcher.matches(d.urlFilter,t)))return!0}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}return!l},e.prototype.extractAllInjectHTML=function(){var e,t,r=new Map;try{var n=this.context.data();if(this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Extracting __inject_html from context"),null==n?void 0:n.experiments)try{for(var o=i(n.experiments),a=o.next();!a.done;a=o.next()){var s=a.value,c=this.extractInjectHTMLForExperiment(s);c.size>0&&(r.set(s.name,c),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Experiment '".concat(s.name,"' has HTML injections:"),{variantsWithInjections:Array.from(c.keys())}))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}catch(e){(0,l.logDebug)("[ABsmartly] Error extracting __inject_html:",e)}return r},e.prototype.extractInjectHTMLForExperiment=function(e){var t=new Map;if(!e.variants)return t;for(var r=0;r<e.variants.length;r++){var i=e.variants[r];if(i){var o=null;if(i.variables&&i.variables.__inject_html)o=i.variables.__inject_html,this.debug&&(0,l.logDebug)("[VariantExtractor] Found __inject_html in variables for ".concat(e.name," variant ").concat(r));else if(i.config)try{var a="string"==typeof i.config?JSON.parse(i.config):i.config;a&&a.__inject_html&&(o=a.__inject_html,this.debug&&(0,l.logDebug)("[VariantExtractor] Found __inject_html in config for ".concat(e.name," variant ").concat(r)))}catch(t){(0,l.logDebug)("[VariantExtractor] Failed to parse variant.config for ".concat(e.name," variant ").concat(r,":"),t)}if(o&&"object"==typeof o&&!Array.isArray(o)){var s=o,c=s.urlFilter,u=n(s,["urlFilter"]),g={data:u,urlFilter:c||void 0};t.set(r,g),this.debug&&(0,l.logDebug)("[VariantExtractor] Extracted __inject_html for ".concat(e.name," variant ").concat(r,":"),{keys:Object.keys(u),hasUrlFilter:!!c})}else o&&this.debug&&(0,l.logDebug)("[VariantExtractor] Invalid __inject_html format in ".concat(e.name," variant ").concat(r),o)}}return t},e}();t.VariantExtractor=c},481:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMPersistenceManager=void 0;var o=r(609),a=function(){function e(e){this.watchedElements=new WeakMap,this.persistenceObserver=null,this.reapplyingElements=new Set,this.reapplyLogThrottle=new Map,this.appliedChanges=new Map,this.config=e}return e.prototype.watchElement=function(e,t,r){var i,a,l=this.watchedElements.get(e);l||(l=new Set,this.watchedElements.set(e,l)),l.add(t),this.appliedChanges.has(t)||this.appliedChanges.set(t,[]);var s=this.appliedChanges.get(t);if(!s.includes(r)&&(s.push(r),this.config.debug)){var c={};if(r.value&&"object"==typeof r.value)try{for(var u=n(Object.keys(r.value)),g=u.next();!g.done;g=u.next()){var d=g.value.replace(/([A-Z])/g,"-$1").toLowerCase();c[d]=e.style.getPropertyValue(d)}}catch(e){i={error:e}}finally{try{g&&!g.done&&(a=u.return)&&a.call(u)}finally{if(i)throw i.error}}(0,o.logDebug)("[WATCH-ELEMENT] Started watching element for persistence",{experimentName:t,selector:r.selector,element:e.tagName,changeType:r.type,value:r.value,currentStyles:"style"===r.type?c:void 0,timestamp:Date.now()})}this.persistenceObserver||this.setupPersistenceObserver()},e.prototype.unwatchElement=function(e,t){var r=this.watchedElements.get(e);r&&(r.delete(t),0===r.size&&this.watchedElements.delete(e))},e.prototype.unwatchExperiment=function(e){this.appliedChanges.delete(e)},e.prototype.getAppliedChanges=function(){return this.appliedChanges},e.prototype.clearAll=function(){this.appliedChanges.clear()},e.prototype.destroy=function(){this.persistenceObserver&&(this.persistenceObserver.disconnect(),this.persistenceObserver=null),this.appliedChanges.clear(),this.reapplyingElements.clear(),this.reapplyLogThrottle.clear()},e.prototype.setupPersistenceObserver=function(){var e=this;this.persistenceObserver||(this.config.debug&&(0,o.logDebug)("[PERSISTENCE-OBSERVER] Setting up persistence observer",{timestamp:Date.now()}),this.persistenceObserver=new MutationObserver(function(t){var r,a;e.config.debug&&(0,o.logDebug)("[MUTATION-DETECTED] Persistence observer detected mutations",{mutationCount:t.length,timestamp:Date.now()});var l=function(t){var r,a,l,s,c,u,g,d,h=t.target;if(e.reapplyingElements.has(h))return e.config.debug&&(0,o.logDebug)("[MUTATION-SKIP] Skipping mutation - currently reapplying",{element:h.tagName}),"continue";var p=e.watchedElements.get(h);if(p){if(e.config.debug){var f="mutation:".concat(h.tagName,":").concat(h.getAttribute("name")||h.className);(_=Date.now())-(k=e.reapplyLogThrottle.get(f)||0)>5e3&&((0,o.logDebug)("[MUTATION-ON-WATCHED] Mutation detected on watched element",{element:h.tagName,attributeName:t.attributeName,oldValue:t.oldValue,experiments:Array.from(p)}),e.reapplyLogThrottle.set(f,_))}try{for(var y=(r=void 0,n(p)),v=y.next();!v.done;v=y.next()){var m=v.value,b=e.appliedChanges.get(m);if(b)try{for(var x=(l=void 0,n(b)),w=x.next();!w.done;w=x.next()){var E=w.value,S=!1;if("style"===E.type&&"style"===t.attributeName&&!1!==E.persistStyle)S=e.checkStyleOverwritten(h,E.value);else if("attribute"===E.type&&!1!==E.persistAttribute){if(E.value&&"object"==typeof E.value)try{for(var A=(c=void 0,n(Object.keys(E.value))),C=A.next();!C.done;C=A.next()){var D=C.value;if(t.attributeName===D){S=e.checkAttributeOverwritten(h,E.value);break}}}catch(e){c={error:e}}finally{try{C&&!C.done&&(u=A.return)&&u.call(A)}finally{if(c)throw c.error}}}else"javascript"===E.type&&!0===E.persistScript&&E.value&&"string"==typeof E.value&&(S="style"===t.attributeName||"class"===t.attributeName);if(S){e.reapplyingElements.add(h);var O="".concat(m,"-").concat(E.selector),_=Date.now(),k=e.reapplyLogThrottle.get(O)||0;if(e.config.debug&&_-k>5e3&&((0,o.logDebug)("[REAPPLY-TRIGGERED] Reapplying after mutation (React/framework conflict detected)",{experimentName:m,selector:E.selector,element:h.tagName,changeType:E.type,timestamp:_}),e.reapplyLogThrottle.set(O,_),e.reapplyLogThrottle.size>100)){var P=_-6e4;try{for(var M=(g=void 0,n(e.reapplyLogThrottle.entries())),L=M.next();!L.done;L=M.next()){var T=i(L.value,2),I=T[0];T[1]<P&&e.reapplyLogThrottle.delete(I)}}catch(e){g={error:e}}finally{try{L&&!L.done&&(d=M.return)&&d.call(M)}finally{if(g)throw g.error}}}try{e.config.onReapply(E,m)}catch(t){e.config.debug&&(0,o.logDebug)("[REAPPLY-ERROR] Error during change re-application",{experimentName:m,selector:E.selector,changeType:E.type,error:t instanceof Error?t.message:String(t)})}finally{setTimeout(function(){e.reapplyingElements.delete(h)},0)}}}}catch(e){l={error:e}}finally{try{w&&!w.done&&(s=x.return)&&s.call(x)}finally{if(l)throw l.error}}}}catch(e){r={error:e}}finally{try{v&&!v.done&&(a=y.return)&&a.call(y)}finally{if(r)throw r.error}}}};try{for(var s=n(t),c=s.next();!c.done;c=s.next()){l(c.value)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(a=s.return)&&a.call(s)}finally{if(r)throw r.error}}}),this.persistenceObserver.observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0}),this.config.debug&&(0,o.logDebug)("[PERSISTENCE-OBSERVER] Setup complete - now observing mutations",{target:"document.body",observedAttributes:"all (filtered in handler to style/class)",subtree:!0,timestamp:Date.now()}))},e.prototype.checkStyleOverwritten=function(e,t){var r,o;try{for(var a=n(Object.entries(t)),l=a.next();!l.done;l=a.next()){var s=i(l.value,2),c=s[0],u=s[1],g=c.replace(/([A-Z])/g,"-$1").toLowerCase(),d=e.style.getPropertyValue(g),h=e.style.getPropertyPriority(g);if(d!==u||u.includes("!important")&&!h)return!0}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return!1},e.prototype.checkAttributeOverwritten=function(e,t){var r,o;try{for(var a=n(Object.entries(t)),l=a.next();!l.done;l=a.next()){var s=i(l.value,2),c=s[0],u=s[1];if(e.getAttribute(c)!==u)return!0}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return!1},e}();t.DOMPersistenceManager=a},574:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},609:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},o=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.DEBUG=void 0,t.logDebug=l,t.logChangeApplication=function(e,r,n,i,o){if(t.DEBUG){l("".concat(o?"✓":"✗"," Applied ").concat(n," change to ").concat(i," element(s)"),{experimentName:e,selector:r,changeType:n,elementsCount:i,success:o})}},t.logChangeRemoval=function(e,r,n,i){if(t.DEBUG){l("Restored ".concat(i," element(s) to original state"),{experimentName:e,selector:r,changeType:n,elementsCount:i,action:"restore"})}},t.logExperimentSummary=function(e,r,n,i){if(t.DEBUG){l('Experiment "'.concat(e,'" summary'),{experimentName:e,totalChanges:r,successfulChanges:n,pendingChanges:i,successRate:r>0?"".concat(Math.round(n/r*100),"%"):"N/A"})}},t.logStateOperation=function(e,r,n,i){if(t.DEBUG){l("State ".concat(e," operation"),{operation:e,selector:r,changeType:n,experimentName:i})}},t.logVisibilityEvent=function(e,r,n){if(t.DEBUG){l(n?"Element became visible - experiment triggered":"Element visibility changed",{experimentName:e,selector:r.className||r.id||r.tagName,triggered:n,action:"visibility"})}},t.logMessage=function(e,r,n){if(t.DEBUG){l("Message ".concat(e,": ").concat(r),{direction:e,messageType:r,payload:n,bridge:"extension"})}},t.logPerformance=function(e,r,i){if(t.DEBUG){l("Performance: ".concat(e," took ").concat(r,"ms"),n({operation:e,duration:r,performance:!0},i))}},t.logProductionWarn=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.warn.apply(console,o([e],i(t),!1))};var a=r(834);function l(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(t.DEBUG)if(2===e.length&&"string"==typeof e[0]&&"object"==typeof e[1]){var n=i(e,2),a=n[0],l=n[1];if(a.includes("Original state already stored"))return;if(a.includes("State store operation"))return;if(a.includes("Performance:")&&(null==l?void 0:l.duration)&&l.duration<5)return;if(a.includes("Message sent:")||a.includes("Message received:"))return;var s=(new Date).toISOString(),c="[ABsmartly Debug]";console.log("".concat(c," [").concat(s,"] ").concat(a),l)}else if(1===e.length&&"string"==typeof e[0]){if((a=e[0]).includes("Original state already stored"))return;if(a.includes("State store operation"))return;if(a.includes("Message sent:")||a.includes("Message received:"))return;s=(new Date).toISOString(),c="[ABsmartly Debug]";console.log("".concat(c," [").concat(s,"] ").concat(a))}else console.log.apply(console,o([],i(e),!1))}t.DEBUG=a.BUILD_DEBUG},639:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},693:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StyleSheetManager=void 0;var n=r(609),i=function(){function e(e,t){void 0===t&&(t=!1),this.id=e,this.styleEl=null,this.rules=new Map,this.debug=t}return e.prototype.ensure=function(){if(!(this.styleEl&&document.head.contains(this.styleEl)||(this.styleEl=document.getElementById(this.id),this.styleEl))){var e=document.createElement("style");e.id=this.id,e.setAttribute("data-absmartly-styles","true"),document.head.appendChild(e),this.styleEl=e,this.debug&&(0,n.logDebug)("[ABsmartly] Created stylesheet: ".concat(this.id))}return this.styleEl},e.prototype.setRule=function(e,t){this.rules.set(e,t),this.render(),this.debug&&(0,n.logDebug)("[ABsmartly] Set CSS rule for ".concat(e))},e.prototype.deleteRule=function(e){this.rules.delete(e)&&(this.render(),this.debug&&(0,n.logDebug)("[ABsmartly] Deleted CSS rule for ".concat(e)))},e.prototype.hasRule=function(e){return this.rules.has(e)},e.prototype.clear=function(){var e=this.rules.size>0;this.rules.clear(),e&&(this.render(),this.debug&&(0,n.logDebug)("[ABsmartly] Cleared all CSS rules from ".concat(this.id)))},e.prototype.destroy=function(){this.clear(),this.styleEl&&document.head.contains(this.styleEl)&&(this.styleEl.remove(),this.styleEl=null,this.debug&&(0,n.logDebug)("[ABsmartly] Destroyed stylesheet: ".concat(this.id)))},e.prototype.render=function(){var e=this.ensure(),t=Array.from(this.rules.values()).join("\n\n");e.textContent=t},e.prototype.getRulesCount=function(){return this.rules.size},e.prototype.getCssText=function(){return Array.from(this.rules.values()).join("\n\n")},e}();t.StyleSheetManager=i},702:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},l=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMChangesPluginLite=void 0;var s=r(964),c=r(356),u=r(693),g=r(713),d=r(253),h=r(609),p=r(973),f=r(481),y=r(943),v=r(834),m=function(){function e(t){var r,n,i,o,a,l,u,p,y=this;if(this.mutationObserver=null,this.exposedExperiments=new Set,this.eventListeners=new Map,this.styleManagers=new Map,this.initialized=!1,this.persistenceManager=null,this.antiFlickerTimeout=null,this.antiFlickerStyleId="absmartly-antiflicker",this.originalPushState=null,this.originalReplaceState=null,this.popstateHandler=null,this.config={context:t.context,autoApply:null===(r=t.autoApply)||void 0===r||r,spa:null===(n=t.spa)||void 0===n||n,visibilityTracking:null===(i=t.visibilityTracking)||void 0===i||i,variableName:null!==(o=t.variableName)&&void 0!==o?o:"__dom_changes",debug:null!==(a=t.debug)&&void 0!==a&&a,hideUntilReady:null!==(l=t.hideUntilReady)&&void 0!==l&&l,hideTimeout:null!==(u=t.hideTimeout)&&void 0!==u?u:3e3,hideTransition:null!==(p=t.hideTransition)&&void 0!==p&&p},!this.config.context)throw new Error("[ABsmartly] Context is required");console.log("[ABsmartly] DOMChangesPluginLite v".concat(e.VERSION," initialized")),this.registerWithContext(!1),this.registerGlobally(!1),this.config.hideUntilReady&&this.hideContent(),this.domManipulator=new s.DOMManipulatorLite(this.config.debug,this),this.variantExtractor=new c.VariantExtractor(this.config.context,this.config.variableName,this.config.debug),this.exposureTracker=new g.ExposureTracker(this.config.context,this.config.debug),this.htmlInjector=new d.HTMLInjector(this.config.debug),this.persistenceManager=new f.DOMPersistenceManager({debug:this.config.debug,onReapply:function(e,t){(0,h.logDebug)("[DOMChangesPluginLite] Re-applying change due to mutation",{experimentName:t,selector:e.selector,type:e.type}),y.domManipulator.applyChange(e,t)}}),this.readyPromise=this.config.context.ready().then(function(){return(0,h.logDebug)("[DOMChangesPluginLite] Context is ready, starting initialization"),y.initialize()}).catch(function(e){throw(0,h.logDebug)("[DOMChangesPluginLite] ERROR during initialization:",e),e})}return e.prototype.ready=function(){return i(this,void 0,void 0,function(){return o(this,function(e){return[2,this.readyPromise]})})},e.prototype.initialize=function(){return i(this,void 0,void 0,function(){var t,r,n;return o(this,function(i){switch(i.label){case 0:if(this.initialized)return(0,h.logDebug)("Plugin already initialized"),[2];t=performance.now(),(0,h.logDebug)("Initializing ABsmartly DOM Changes Plugin Lite",{version:e.VERSION,config:{autoApply:this.config.autoApply,spa:this.config.spa,visibilityTracking:this.config.visibilityTracking,DEBUG:h.DEBUG}}),i.label=1;case 1:return i.trys.push([1,4,,5]),this.config.spa?(this.setupMutationObserver(),this.setupURLChangeListener()):(0,h.logDebug)("[DOMChangesPluginLite] SPA mode disabled - skipping body observer"),this.config.autoApply?[4,this.applyInjectionsAndChanges()]:[3,3];case 2:i.sent(),i.label=3;case 3:return this.initialized=!0,this.registerWithContext(),this.registerGlobally(),this.emit("initialized"),r=performance.now()-t,(0,h.logPerformance)("Plugin initialization",r),(0,h.logDebug)("[ABsmartly] DOM plugin lite loaded successfully (v".concat(e.VERSION,")")),this.config.debug&&(0,h.logDebug)("[ABsmartly] DOM Changes Plugin Lite initialized with debug mode"),[3,5];case 4:throw n=i.sent(),(0,h.logDebug)("[ABsmartly] Failed to initialize plugin:",n),this.emit("error",{type:"initialization_error",error:(null==n?void 0:n.message)||String(n)}),n;case 5:return[2]}})})},e.prototype.setupMutationObserver=function(){var e=this,t=new MutationObserver(function(t){var r,n,i,o,s,c,u,g,d,p,f;try{for(var y=a(t),v=y.next();!v.done;v=y.next()){var m=v.value;if("childList"===m.type)try{for(var b=(i=void 0,a(m.addedNodes)),x=b.next();!x.done;x=b.next()){var w=x.value;if(w.nodeType===Node.ELEMENT_NODE){var E=w,S=(null===(f=e.persistenceManager)||void 0===f?void 0:f.getAppliedChanges())||new Map;try{for(var A=(s=void 0,a(S)),C=A.next();!C.done;C=A.next()){var D=l(C.value,2),O=D[0],_=D[1];try{for(var k=(u=void 0,a(_)),P=k.next();!P.done;P=k.next()){var M=P.value;try{var L=E.matches(M.selector)?[E]:Array.from(E.querySelectorAll(M.selector));try{for(var T=(d=void 0,a(L)),I=T.next();!I.done;I=T.next()){var N=I.value;e.config.debug&&(0,h.logDebug)("[SPA-REAPPLY] Re-applying change to newly added element (React hydration recovery)",{experimentName:O,selector:M.selector,element:N.tagName,changeType:M.type}),e.domManipulator.applyChange(M,O)}}catch(e){d={error:e}}finally{try{I&&!I.done&&(p=T.return)&&p.call(T)}finally{if(d)throw d.error}}}catch(e){}}}catch(e){u={error:e}}finally{try{P&&!P.done&&(g=k.return)&&g.call(k)}finally{if(u)throw u.error}}}}catch(e){s={error:e}}finally{try{C&&!C.done&&(c=A.return)&&c.call(A)}finally{if(s)throw s.error}}}}}catch(e){i={error:e}}finally{try{x&&!x.done&&(o=b.return)&&o.call(b)}finally{if(i)throw i.error}}}}catch(e){r={error:e}}finally{try{v&&!v.done&&(n=y.return)&&n.call(y)}finally{if(r)throw r.error}}}),r=function(){t.observe(document.body,{childList:!0,subtree:!0}),e.mutationObserver=t,(0,h.logDebug)("[DOMChangesPluginLite] MutationObserver started on document.body")};document.body?r():(new MutationObserver(function(e,t){document.body&&(t.disconnect(),r())}).observe(document.documentElement,{childList:!0}),(0,h.logDebug)("[DOMChangesPluginLite] Waiting for document.body..."))},e.prototype.setupURLChangeListener=function(){var e=this,t=function(){return i(e,void 0,void 0,function(){var e;return o(this,function(t){switch(t.label){case 0:return e=window.location.href,(0,h.logDebug)("[ABsmartly] URL changed, re-evaluating experiments:",e),[4,this.removeAllChanges()];case 1:return t.sent(),[4,this.applyInjectionsAndChanges()];case 2:return t.sent(),[2]}})})};this.popstateHandler=t,window.addEventListener("popstate",this.popstateHandler),this.originalPushState=history.pushState,this.originalReplaceState=history.replaceState;var r=this;history.pushState=function(e,n,i){r.originalPushState&&r.originalPushState.call(history,e,n,i),t()},history.replaceState=function(e,n,i){r.originalReplaceState&&r.originalReplaceState.call(history,e,n,i),t()},this.config.debug&&(0,h.logDebug)("[ABsmartly] URL change listener set up for SPA mode")},e.prototype.removeAllChanges=function(){return i(this,void 0,void 0,function(){return o(this,function(e){return this.exposedExperiments.clear(),this.styleManagers.clear(),this.persistenceManager&&this.persistenceManager.clearAll(),this.htmlInjector.destroy(),this.variantExtractor.clearCache(),this.config.debug&&(0,h.logDebug)("[ABsmartly] All change tracking cleared for URL change"),[2]})})},e.prototype.applyInjectionsAndChanges=function(){return i(this,void 0,void 0,function(){var e,t,r,n,i;return o(this,function(o){switch(o.label){case 0:e=performance.now(),t=window.location.href,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.config.context.ready()];case 2:return o.sent(),[3,4];case 3:return r=o.sent(),(0,h.logDebug)("[ABsmartly] Failed to wait for context ready:",r),[2];case 4:return n=this.variantExtractor.extractAllInjectHTML(),[4,Promise.all([this.applyHTMLInjections(n,t),this.applyChanges()])];case 5:return o.sent(),i=performance.now()-e,(0,h.logPerformance)("Apply injections and changes (parallel)",i),this.config.debug&&(0,h.logDebug)("[ABsmartly] HTML injections and DOM changes applied in parallel",{duration:"".concat(i.toFixed(2),"ms"),currentURL:t}),[2]}})})},e.prototype.applyHTMLInjections=function(e){return i(this,arguments,void 0,function(e,t){var r;return void 0===t&&(t=window.location.href),o(this,function(n){return 0===e.size?(this.config.debug&&(0,h.logDebug)("[ABsmartly] No HTML injections found"),[2]):(r=this.htmlInjector.collectInjections(e,t),this.htmlInjector.inject(r),this.config.debug&&(0,h.logDebug)("[ABsmartly] HTML injections complete",{experimentsWithInjections:e.size,totalLocations:r.size,currentUrl:t}),[2])})})},e.prototype.applyChanges=function(e){return i(this,void 0,void 0,function(){var t,r,n,i,s,c,u,g,d,f,y,v,m,b,x,w,E,S,A,C,D,O,_,k,P,M,L,T,I,N,j,R,U,B,V,F,G,z,H,W,q,J,Y,X,Q,K,$,Z,ee,te,re,ne,ie;return o(this,function(o){switch(o.label){case 0:t=performance.now(),r=window.location.href,(0,h.logDebug)("Starting to apply changes",{specificExperiment:e||"all",url:r,action:"apply_start"}),this.config.debug&&((0,h.logDebug)("[ABsmartly] === DOM Changes Application Starting ==="),(0,h.logDebug)("[ABsmartly] Target:",e||"all experiments"),(0,h.logDebug)("[ABsmartly] Current URL:",r),(0,h.logDebug)("[ABsmartly] Context ready:",!0)),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.config.context.ready()];case 2:return o.sent(),[3,4];case 3:return n=o.sent(),(0,h.logDebug)("[ABsmartly] Failed to wait for context ready:",n),[2];case 4:this.variantExtractor.clearCache(),i=this.getAllExperimentsData(),s=0,c=new Map,(0,h.logDebug)("[APPLY-CHANGES] Experiments found with DOM changes:",{experimentNames:Array.from(i.keys()),totalCount:i.size,currentURL:r}),0===i.size&&(0,h.logDebug)("[APPLY-CHANGES] ⚠️ No experiments found with DOM changes - nothing to process");try{for(u=a(i),g=u.next();!g.done;g=u.next())if(d=l(g.value,2),f=d[0],y=d[1],(0,h.logDebug)("[APPLY-CHANGES] [".concat(f,"] Starting to process experiment"),{experimentName:f,currentURL:r}),e&&f!==e)(0,h.logDebug)("[APPLY-CHANGES] [".concat(f,"] ⏭️ Skipping - filtering for different experiment"),{filteringFor:e});else if(null!=(v=this.config.context.peek(f)))if((0,h.logDebug)("[APPLY-CHANGES] [".concat(f,"] User assigned to variant ").concat(v)),m=y.variantData,b=y.urlFilter,x=y.globalDefaults,this.variantExtractor.anyVariantMatchesURL(f,r))if((0,h.logDebug)("[APPLY-CHANGES] [".concat(f,"] ✓ At least one variant matches current URL")),w=this.shouldApplyVisualChanges(m,b,r),E=this.extractChangesFromData(m,x),S=this.extractAllVariantChanges(f),A=S.some(function(e){return e&&e.length>0}),A){if(C={total:(null==E?void 0:E.length)||0,success:0,pending:0},this.config.debug&&(0,h.logDebug)("[ABsmartly] Processing experiment '".concat(f,"' - User is in variant ").concat(v,":"),{experimentName:f,userVariant:v,urlMatches:w,changeCount:(null==E?void 0:E.length)||0,userVariantHasChanges:((null==E?void 0:E.length)||0)>0,changes:(null==E?void 0:E.map(function(e){return{type:e.type,selector:e.selector,trigger:e.trigger_on_view?"viewport":"immediate"}}))||[]}),E&&0!==E.length||this.config.debug&&(0,h.logDebug)("[ABsmartly] User is in control variant ".concat(v," with no changes, but will still track for SRM prevention"),{experimentName:f,currentVariant:v}),w&&E&&E.length>0)try{for(K=void 0,D=a(E),O=D.next();!O.done;O=D.next())if("delete"===(J=O.value).type&&J.trigger_on_view)this.config.debug&&(0,h.logDebug)("[ABsmartly] Deferring delete change until after viewport trigger for '".concat(f,"'"),{selector:J.selector});else if(this.domManipulator.applyChange(J,f))s++,C.success++;else if("create"!==J.type&&"styleRules"!==J.type)try{0===document.querySelectorAll(J.selector).length&&(this.config.spa||J.waitForElement)&&C.pending++}catch(e){this.config.debug&&(0,h.logDebug)("[ABsmartly] Invalid selector: ".concat(J.selector),e)}}catch(e){K={error:e}}finally{try{O&&!O.done&&($=D.return)&&$.call(D)}finally{if(K)throw K.error}}else E&&E.length>0&&(0,h.logDebug)("[ABsmartly] Experiment '".concat(f,"' variant ").concat(v," doesn't match URL filter or has no changes, but setting up tracking for SRM prevention"));if(_=!1,k=!1,P=this.variantExtractor.getAllVariantsData(f),this.config.debug){(0,h.logDebug)("[ABsmartly] Checking trigger types for experiment '".concat(f,"' on URL: ").concat(r),{allVariantsDataSize:P.size,allVariantChangesLength:S.length});try{for(Z=void 0,M=a(P),L=M.next();!L.done;L=M.next())T=l(L.value,2),I=T[0],N=T[1],(0,h.logDebug)("[ABsmartly] Variant ".concat(I," data structure:"),{isArray:Array.isArray(N),isObject:"object"==typeof N,hasUrlFilter:N&&"object"==typeof N&&!Array.isArray(N)&&"urlFilter"in N,keys:N&&"object"==typeof N&&!Array.isArray(N)?Object.keys(N):"N/A"})}catch(e){Z={error:e}}finally{try{L&&!L.done&&(ee=M.return)&&ee.call(M)}finally{if(Z)throw Z.error}}}try{for(te=void 0,j=a(P),R=j.next();!R.done;R=j.next())if(U=l(R.value,2),B=U[0],V=U[1],(F=S[B])&&0!==F.length){if(G=!0,V&&"object"==typeof V&&!Array.isArray(V)&&"urlFilter"in(z=V)&&z.urlFilter&&(H=z,G=p.URLMatcher.matches(H.urlFilter,r),this.config.debug&&(0,h.logDebug)("[ABsmartly] Variant ".concat(B," has URL filter, matches: ").concat(G))),G){try{for(ne=void 0,W=a(F),q=W.next();!q.done&&((J=q.value).trigger_on_view?_=!0:k=!0,!_||!k);q=W.next());}catch(e){ne={error:e}}finally{try{q&&!q.done&&(ie=W.return)&&ie.call(W)}finally{if(ne)throw ne.error}}this.config.debug&&(0,h.logDebug)("[ABsmartly] Variant ".concat(B," matches URL - hasImmediate: ").concat(k,", hasViewport: ").concat(_))}else this.config.debug&&(0,h.logDebug)("[ABsmartly] Variant ".concat(B," does NOT match URL - skipping"));if(_&&k)break}}catch(e){te={error:e}}finally{try{R&&!R.done&&(re=j.return)&&re.call(j)}finally{if(te)throw te.error}}this.config.debug&&(0,h.logDebug)("[TRIGGER-DETECTION] [".concat(f,"] Final trigger decision for '").concat(f,"':"),{experimentName:f,userVariant:v,hasImmediateTrigger:k,hasViewportTrigger:_,willRegisterExperiment:_||k,userChangesCount:(null==E?void 0:E.length)||0,allVariantsChangesCount:S.map(function(e){return e.length})}),_||k?((0,h.logDebug)("[TRIGGER-DETECTION] [".concat(f,"] ✓ REGISTERING EXPERIMENT - Calling exposureTracker.registerExperiment()"),{experimentName:f,userVariant:v,hasImmediateTrigger:k,hasViewportTrigger:_,changesForUser:(null==E?void 0:E.length)||0,allVariantCounts:S.map(function(e,t){return{variant:t,count:e.length}})}),this.exposureTracker.registerExperiment(f,v||0,E||[],S,k,_)):(0,h.logDebug)("[TRIGGER-DETECTION] [".concat(f,"] ⚠️ No triggers detected - experiment will NOT be registered!"),{experimentName:f,userVariant:v,hasAnyChangesInAnyVariant:A,allVariantsChangesCount:S.map(function(e){return e.length})}),c.set(f,C),(0,h.logExperimentSummary)(f,C.total,C.success,C.pending)}else this.config.debug&&(0,h.logDebug)("[ABsmartly] Skipping experiment '".concat(f,"' - no variants have changes"));else(0,h.logDebug)("[APPLY-CHANGES] [".concat(f,"] ⏭️ Skipping - no variant matches URL: ").concat(r),{experimentName:f,currentURL:r});else(0,h.logDebug)("[APPLY-CHANGES] [".concat(f,"] ⏭️ Skipping - no variant assigned (peek returned ").concat(v,")"),{experimentName:f})}catch(e){X={error:e}}finally{try{g&&!g.done&&(Q=u.return)&&Q.call(u)}finally{if(X)throw X.error}}return Y=performance.now()-t,(0,h.logPerformance)("Apply changes",Y,{totalApplied:s,experiments:c.size}),this.config.debug&&((0,h.logDebug)("[ABsmartly] === DOM Changes Application Complete ==="),(0,h.logDebug)("[ABsmartly] Summary:",{totalChangesApplied:s,experimentsProcessed:c.size,duration:"".concat(Y.toFixed(2),"ms"),experiments:Array.from(c.entries()).map(function(e){var t=l(e,2),r=t[0],n=t[1];return{name:r,total:n.total,success:n.success,pending:n.pending,pendingReason:n.pending>0?"Elements not found yet (SPA mode will retry)":void 0}})})),this.config.hideUntilReady&&this.showContent(),(0,h.logDebug)("[ABsmartly] DOM changes applied"),this.emit("changes-applied",{count:s,experimentName:e}),[2]}})})},e.prototype.getAllExperimentsData=function(){var e,t,r=new Map,n=this.variantExtractor.extractAllChanges();(0,h.logDebug)("[GET-EXPERIMENTS] Extracting experiment data from context",{experimentsWithChanges:Array.from(n.keys()),totalCount:n.size});try{for(var i=a(n),o=i.next();!o.done;o=i.next()){var s=l(o.value,1)[0],c=this.config.context.peek(s);if((0,h.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] Checking experiment"),{experimentName:s,currentVariant:c,variantIsValid:null!=c}),null!=c){var u=this.variantExtractor.getAllVariantsData(s),g=u.get(c);this.config.debug&&(0,h.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] Variant data lookup:"),{experimentName:s,userVariant:c,variantDataExists:!!g,allVariantsInMap:Array.from(u.keys()),userVariantInMap:u.has(c)}),g||(0,h.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] ⚠️ User's variant ").concat(c," has no DOM changes (control variant)"),{availableVariants:Array.from(u.keys()),note:"Will still track for SRM prevention"}),(0,h.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] ✓ Including experiment (variant ").concat(c,")"));var d=null,p={};if(g&&"object"==typeof g&&!Array.isArray(g)&&"changes"in g){var f=g;d=f.urlFilter,p={waitForElement:f.waitForElement,persistStyle:f.persistStyle,persistAttribute:f.persistAttribute,persistScript:f.persistScript,important:f.important,observerRoot:f.observerRoot}}r.set(s,{variantData:g,urlFilter:d,globalDefaults:p})}else(0,h.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] ⏭️ Skipping - context.peek() returned ").concat(c))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return r},e.prototype.extractChangesFromData=function(e,t){if(!e)return null;var r=null;return Array.isArray(e)?r=e:"object"==typeof e&&"changes"in e&&(r=e.changes),r&&0!==r.length?r.map(function(e){var r,i,o,a,l,s;return n(n({},e),{waitForElement:null!==(r=e.waitForElement)&&void 0!==r?r:t.waitForElement,persistStyle:null!==(i=e.persistStyle)&&void 0!==i?i:t.persistStyle,persistAttribute:null!==(o=e.persistAttribute)&&void 0!==o?o:t.persistAttribute,persistScript:null!==(a=e.persistScript)&&void 0!==a?a:t.persistScript,important:null!==(l=e.important)&&void 0!==l?l:t.important,observerRoot:null!==(s=e.observerRoot)&&void 0!==s?s:t.observerRoot})}):null},e.prototype.extractAllVariantChanges=function(e){for(var t=this.variantExtractor.getAllVariantChanges(e),r=this.variantExtractor.getAllVariantsData(e),i=[],o=function(e){var o=t[e],a=r.get(e);if(!o||0===o.length)return i.push([]),"continue";var l={};if(a&&"object"==typeof a&&!Array.isArray(a)&&"changes"in a){var s=a;l={waitForElement:s.waitForElement,persistStyle:s.persistStyle,persistAttribute:s.persistAttribute,persistScript:s.persistScript,important:s.important,observerRoot:s.observerRoot}}var c=o.map(function(e){var t,r,i,o,a,s;return n(n({},e),{waitForElement:null!==(t=e.waitForElement)&&void 0!==t?t:l.waitForElement,persistStyle:null!==(r=e.persistStyle)&&void 0!==r?r:l.persistStyle,persistAttribute:null!==(i=e.persistAttribute)&&void 0!==i?i:l.persistAttribute,persistScript:null!==(o=e.persistScript)&&void 0!==o?o:l.persistScript,important:null!==(a=e.important)&&void 0!==a?a:l.important,observerRoot:null!==(s=e.observerRoot)&&void 0!==s?s:l.observerRoot})});i.push(c)},a=0;a<t.length;a++)o(a);return i},e.prototype.shouldApplyVisualChanges=function(e,t,r){return!!e&&(!!Array.isArray(e)||(!t||p.URLMatcher.matches(t,r)))},e.prototype.hasChanges=function(e){return this.domManipulator.hasChanges(e)},e.prototype.applyChange=function(e,t){(0,h.logDebug)("Applying single change via public API",{experimentName:t,selector:e.selector,changeType:e.type});try{var r=this.domManipulator.applyChange(e,t);return r?this.emit("change_applied",{experimentName:t,change:e}):this.emit("change_failed",{experimentName:t,change:e,reason:"selector_not_found_or_apply_failed"}),r}catch(r){return(0,h.logDebug)("[ABsmartly] Error applying change:",r),this.emit("error",{type:"change_apply_error",experimentName:t,change:e,error:(null==r?void 0:r.message)||String(r)}),!1}},e.prototype.on=function(e,t){var r=this.eventListeners.get(e)||[];r.push(t),this.eventListeners.set(e,r)},e.prototype.off=function(e,t){if(t){var r=this.eventListeners.get(e)||[],n=r.indexOf(t);-1!==n&&r.splice(n,1)}else this.eventListeners.delete(e)},e.prototype.emit=function(e,t){var r,n,i=this.eventListeners.get(e)||[];try{for(var o=a(i),l=o.next();!l.done;l=o.next()){var s=l.value;try{s(t)}catch(t){(0,h.logDebug)("[ABsmartly] Error in event listener for ".concat(e,":"),t)}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},e.prototype.getStyleManager=function(e){var t="absmartly-styles-".concat(e),r=this.styleManagers.get(e);return r||(r=new u.StyleSheetManager(t,this.config.debug),this.styleManagers.set(e,r)),r},e.prototype.buildCssRule=function(e,t,r){void 0===r&&(r=!0);var n=Object.entries(t).map(function(e){var t=l(e,2),n=t[0],i=t[1],o=n.replace(/([A-Z])/g,"-$1").toLowerCase(),a=r?" !important":"";return" ".concat(o,": ").concat(i).concat(a,";")}).join("\n");return"".concat(e," {\n").concat(n,"\n}")},e.prototype.buildStateRules=function(e,t,r){void 0===r&&(r=!0);var n=[];return t.normal&&n.push(this.buildCssRule(e,t.normal,r)),t.hover&&n.push(this.buildCssRule("".concat(e,":hover"),t.hover,r)),t.active&&n.push(this.buildCssRule("".concat(e,":active"),t.active,r)),t.focus&&n.push(this.buildCssRule("".concat(e,":focus"),t.focus,r)),n.join("\n\n")},e.prototype.refreshExperiments=function(){this.config.debug&&(0,h.logDebug)("[ABsmartly] Refreshing experiments and clearing cache"),this.variantExtractor.clearCache(),this.config.autoApply&&this.applyInjectionsAndChanges()},e.prototype.destroy=function(){var e,t;this.domManipulator.destroy(),this.exposureTracker.destroy(),this.htmlInjector.destroy();try{for(var r=a(this.styleManagers.values()),n=r.next();!n.done;n=r.next()){n.value.destroy()}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.styleManagers.clear(),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.persistenceManager&&(this.persistenceManager.destroy(),this.persistenceManager=null),null!==this.antiFlickerTimeout&&(clearTimeout(this.antiFlickerTimeout),this.antiFlickerTimeout=null);var i=document.getElementById(this.antiFlickerStyleId);i&&i.remove(),this.originalPushState&&(history.pushState=this.originalPushState),this.originalReplaceState&&(history.replaceState=this.originalReplaceState),this.popstateHandler&&(window.removeEventListener("popstate",this.popstateHandler),this.popstateHandler=null),this.eventListeners.clear(),this.exposedExperiments.clear(),this.unregisterFromContext(),this.unregisterGlobally(),this.initialized=!1,this.config.debug&&(0,h.logDebug)("[ABsmartly] DOM Changes Plugin Lite destroyed")},e.prototype.registerWithContext=function(t){void 0===t&&(t=!0),this.config.context&&(this.config.context.__plugins||(this.config.context.__plugins={}),this.config.context.__plugins.domPlugin={name:"DOMChangesPluginLite",version:e.VERSION,initialized:t,capabilities:["spa","visibility"],instance:this,timestamp:Date.now()},this.config.context.__domPlugin=this.config.context.__plugins.domPlugin,this.config.debug&&(0,h.logDebug)("[ABsmartly] DOMChangesPluginLite registered with context at __plugins.domPlugin (initialized=".concat(t,")")))},e.prototype.unregisterFromContext=function(){var e;this.config.context&&((null===(e=this.config.context.__plugins)||void 0===e?void 0:e.domPlugin)&&delete this.config.context.__plugins.domPlugin,this.config.context.__domPlugin&&delete this.config.context.__domPlugin,this.config.debug&&(0,h.logDebug)("[ABsmartly] DOMChangesPluginLite unregistered from context"))},e.prototype.registerGlobally=function(t){void 0===t&&(t=!0),(0,y.registerPlugin)("dom",{name:"DOMChangesPluginLite",version:e.VERSION,initialized:t,timestamp:Date.now(),capabilities:["spa","visibility","auto-apply"],instance:this}),this.config.debug&&(0,h.logDebug)("[ABsmartly] DOMChangesPluginLite registered in global window.__ABSMARTLY_PLUGINS__ (initialized=".concat(t,")"))},e.prototype.unregisterGlobally=function(){(0,y.unregisterPlugin)("dom"),this.config.debug&&(0,h.logDebug)("[ABsmartly] DOMChangesPluginLite unregistered from global registry")},e.prototype.hideContent=function(){var e=this,t=this.config.hideUntilReady;if(t&&!document.getElementById(this.antiFlickerStyleId)){var r=document.createElement("style");r.id=this.antiFlickerStyleId;var n=!1!==this.config.hideTransition;r.textContent="\n ".concat(t,n?" {\n visibility: hidden !important;\n opacity: 0 !important;\n }\n ":" {\n visibility: hidden !important;\n }\n "),document.head.appendChild(r),this.antiFlickerTimeout=window.setTimeout(function(){e.config.debug&&(0,h.logDebug)("[ABsmartly] Anti-flicker timeout reached (".concat(e.config.hideTimeout,"ms), showing content")),e.showContent()},this.config.hideTimeout),this.config.debug&&(0,h.logDebug)("[ABsmartly] Anti-flicker enabled (selector: '".concat(t,"', transition: ").concat(n?this.config.hideTransition:"none",", timeout: ").concat(this.config.hideTimeout,"ms)"))}},e.prototype.showContent=function(){var e=this;null!==this.antiFlickerTimeout&&(clearTimeout(this.antiFlickerTimeout),this.antiFlickerTimeout=null);var t=document.getElementById(this.antiFlickerStyleId);if(t)if(!1!==this.config.hideTransition){var r=this.config.hideUntilReady;t.textContent="\n ".concat(r," {\n opacity: 0 !important;\n transition: opacity ").concat(this.config.hideTransition," !important;\n }\n "),t.offsetHeight,t.textContent="\n ".concat(r," {\n opacity: 1 !important;\n transition: opacity ").concat(this.config.hideTransition," !important;\n }\n ");var n=1e3*parseFloat(this.config.hideTransition);setTimeout(function(){t.remove(),e.config.debug&&(0,h.logDebug)("[ABsmartly] Anti-flicker fade-in complete, style removed")},n),this.config.debug&&(0,h.logDebug)("[ABsmartly] Anti-flicker fading in with transition: ".concat(this.config.hideTransition))}else t.remove(),this.config.debug&&(0,h.logDebug)("[ABsmartly] Anti-flicker removed, content now visible")},e.prototype.watchElement=function(e,t,r){this.persistenceManager&&this.persistenceManager.watchElement(e,t,r)},e.prototype.unwatchElement=function(e,t){this.persistenceManager&&this.persistenceManager.unwatchElement(e,t)},e.VERSION=v.BUILD_VERSION,e}();t.DOMChangesPluginLite=m},713:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},l=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.ExposureTracker=void 0;var s=r(609),c=function(){function e(e,t){void 0===t&&(t=!1),this.context=e,this.experiments=new Map,this.trackedElements=new Map,this.mutationObserver=null,this.placeholders=new Map,this.debug=t,this.setupIntersectionObserver()}return e.prototype.registerExperiment=function(e,t,r,n,i,c){var u,g,d,h,p,f,y,v;this.debug&&(0,s.logDebug)("[EXPOSURE] [".concat(e,"] Registering experiment for exposure tracking"),{experimentName:e,currentVariant:t,hasImmediateTrigger:i,hasViewportTrigger:c,currentChangesCount:r.length,allVariantsCount:n.length,currentChangeTypes:r.map(function(e){return{type:e.type,selector:e.selector,trigger_on_view:e.trigger_on_view||!1}})});var m=new Set,b=new Set,x=new Map,w=new Set;try{for(var E=o(n),S=E.next();!S.done;S=E.next()){var A=S.value;try{for(var C=(d=void 0,o(A)),D=C.next();!D.done;D=C.next()){var O=D.value;O.trigger_on_view&&("move"===O.type?(x.has(O.selector)||x.set(O.selector,new Set),O.targetSelector&&x.get(O.selector).add(O.targetSelector)):"delete"===O.type?w.add(O.selector):m.add(O.selector))}}catch(e){d={error:e}}finally{try{D&&!D.done&&(h=C.return)&&h.call(C)}finally{if(d)throw d.error}}}}catch(e){u={error:e}}finally{try{S&&!S.done&&(g=E.return)&&g.call(E)}finally{if(u)throw u.error}}var _=function(r){for(var i,a,l=[],s=0;s<n.length;s++){var c=n[s].find(function(e){return"move"===e.type&&e.selector===r&&e.trigger_on_view});(null==c?void 0:c.targetSelector)&&l.push({targetSelector:c.targetSelector,position:c.position||"lastChild",variantIndex:s})}var u=l.findIndex(function(e){return e.variantIndex===t});if(u>=0){m.add(r);for(var g=0;g<l.length;g++){var d=l[g];g!==u&&k.createContainerPlaceholder(e,r,d.targetSelector,d.position)}}else{m.add(r);try{for(var h=(i=void 0,o(l)),p=h.next();!p.done;p=h.next()){d=p.value;k.createContainerPlaceholder(e,r,d.targetSelector,d.position)}}catch(e){i={error:e}}finally{try{p&&!p.done&&(a=h.return)&&a.call(h)}finally{if(i)throw i.error}}}},k=this;try{for(var P=o(x),M=P.next();!M.done;M=P.next()){_(a(M.value,1)[0])}}catch(e){p={error:e}}finally{try{M&&!M.done&&(f=P.return)&&f.call(P)}finally{if(p)throw p.error}}var L=function(t){r.some(function(e){return"delete"===e.type&&e.selector===t&&e.trigger_on_view})?0===T.createInPlacePlaceholder(e,t)&&(m.add(t),T.debug&&(0,s.logDebug)("[EXPOSURE] [".concat(e,"] Delete element doesn't exist yet - tracking selector for when it appears"),{selector:t})):m.add(t)},T=this;try{for(var I=o(w),N=I.next();!N.done;N=I.next()){L(N.value)}}catch(e){y={error:e}}finally{try{N&&!N.done&&(v=I.return)&&v.call(I)}finally{if(y)throw y.error}}var j={experimentName:e,variant:t,changes:r,allPossibleSelectors:new Set(l(l([],a(m),!1),a(b),!1)),triggered:!1,hasImmediateTrigger:i,hasViewportTrigger:c};this.experiments.set(e,j),this.debug&&(0,s.logDebug)("[ABsmartly] Experiment ".concat(e," will track selectors:"),Array.from(j.allPossibleSelectors)),i?((0,s.logDebug)("[EXPOSURE] [".concat(e,"] ✓ HAS IMMEDIATE TRIGGER - triggering exposure NOW"),{experimentName:e,currentVariant:t,allVariantCounts:n.map(function(e,t){return{variant:t,count:e.length}})}),this.triggerExposure(e).catch(function(t){(0,s.logDebug)("[EXPOSURE] [".concat(e,"] ✗ Failed to trigger exposure:"),t)})):c?((0,s.logDebug)("[EXPOSURE] [".concat(e,"] ✓ HAS VIEWPORT TRIGGER - setting up viewport observers"),{experimentName:e,currentVariant:t,selectorsToWatch:Array.from(j.allPossibleSelectors),allVariantCounts:n.map(function(e,t){return{variant:t,count:e.length}})}),this.observeSelectors(e,j.allPossibleSelectors)):(0,s.logDebug)("[EXPOSURE] [".concat(e,"] ⚠️ No immediate or viewport trigger detected - experiment will NOT be exposed!"),{experimentName:e,currentVariant:t,hasImmediateTrigger:i,hasViewportTrigger:c,currentChanges:r.map(function(e){return{type:e.type,trigger_on_view:e.trigger_on_view}})})},e.prototype.createContainerPlaceholder=function(e,t,r,n){var i,o;void 0===n&&(n="lastChild");var a=document.querySelector(r);if(a){var l="".concat(e,"-").concat(t,"-").concat(r,"-").concat(n);if(!this.placeholders.has(l)){var c=document.createElement("span");switch(c.style.cssText="\n display: inline-block;\n width: 1px;\n height: 1px;\n position: relative;\n left: -1px;\n visibility: hidden;\n pointer-events: none;\n font-size: 0;\n line-height: 0;\n overflow: hidden;\n ",c.setAttribute("data-absmartly-placeholder","true"),c.setAttribute("data-absmartly-original-selector",t),c.setAttribute("data-absmartly-experiment",e),c.setAttribute("aria-hidden","true"),n){case"firstChild":a.insertBefore(c,a.firstChild);break;case"lastChild":default:a.appendChild(c);break;case"before":null===(i=a.parentElement)||void 0===i||i.insertBefore(c,a);break;case"after":null===(o=a.parentElement)||void 0===o||o.insertBefore(c,a.nextSibling)}this.placeholders.set(l,c),this.trackElement(c,e),this.debug&&(0,s.logDebug)("[ABsmartly] Created placeholder for ".concat(t," at ").concat(r," (").concat(n,")"))}}},e.prototype.createInPlacePlaceholder=function(e,t){var r,n=document.querySelectorAll(t);if(0===n.length)return this.debug&&(0,s.logDebug)("[EXPOSURE] [".concat(e,"] No elements found for delete placeholder - will track selector instead"),{selector:t}),0;for(var i=0,o=0;o<n.length;o++){var a=n[o],l=t.replace(/[^a-zA-Z0-9-]/g,"_"),c="absmartly-delete-".concat(e,"-").concat(l,"-").concat(o),u="".concat(e,"-delete-").concat(t,"-").concat(o);if(!a.hasAttribute("data-absmartly-delete-placeholder")){var g=document.createElement("span");g.id=c,g.style.cssText="\n display: inline-block;\n width: 1px;\n height: 1px;\n position: relative;\n left: -1px;\n visibility: hidden;\n pointer-events: none;\n font-size: 0;\n line-height: 0;\n overflow: hidden;\n ",g.setAttribute("data-absmartly-placeholder","true"),g.setAttribute("data-absmartly-delete-placeholder","true"),g.setAttribute("data-absmartly-original-selector",t),g.setAttribute("data-absmartly-experiment",e),g.setAttribute("aria-hidden","true"),null===(r=a.parentElement)||void 0===r||r.insertBefore(g,a),a.remove(),this.placeholders.set(u,g),this.trackElement(g,e),i++,this.debug&&(0,s.logDebug)("[ABsmartly] Created in-place delete placeholder for ".concat(t," in experiment ").concat(e))}}return i},e.prototype.getOriginalParentForMove=function(e){var t=document.querySelector(e);return(null==t?void 0:t.parentElement)?this.getStableParentSelector(t.parentElement):null},e.prototype.getStableParentSelector=function(e){if(e.id)return"#".concat(e.id);if(e.className){var t=e.className.split(" ").filter(function(e){return e&&!e.startsWith("absmartly")});if(t.length>0)return".".concat(t[0])}var r=e.parentElement;if(r){var n=Array.from(r.children).indexOf(e);return"".concat(e.tagName.toLowerCase(),":nth-child(").concat(n+1,")")}return null},e.prototype.observeSelectors=function(e,t){var r,n,i,a;try{for(var l=o(t),s=l.next();!s.done;s=l.next()){var c=s.value,u=document.querySelectorAll(c);if(u.length>0)try{for(var g=(i=void 0,o(u)),d=g.next();!d.done;d=g.next()){var h=d.value;this.trackElement(h,e)}}catch(e){i={error:e}}finally{try{d&&!d.done&&(a=g.return)&&a.call(g)}finally{if(i)throw i.error}}else this.watchForSelector(c,e)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}},e.prototype.trackElement=function(e,t){this.trackedElements.has(e)?this.trackedElements.get(e).experiments.add(t):(this.trackedElements.set(e,{element:e,experiments:new Set([t]),isPlaceholder:e.hasAttribute("data-absmartly-placeholder")}),this.observer.observe(e))},e.prototype.watchForSelector=function(e,t){this.mutationObserver||this.setupMutationObserver()},e.prototype.setupIntersectionObserver=function(){var e=this;this.observer=new IntersectionObserver(function(t){var r,n;try{for(var i=o(t),a=i.next();!a.done;a=i.next()){var l=a.value;l.isIntersecting&&e.handleElementVisible(l.target)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},{threshold:.01,rootMargin:"0px"})},e.prototype.setupMutationObserver=function(){var e=this;this.mutationObserver=new MutationObserver(function(t){var r,n,i,a;try{for(var l=o(t),s=l.next();!s.done;s=l.next()){var c=s.value;try{for(var u=(i=void 0,o(c.addedNodes)),g=u.next();!g.done;g=u.next()){var d=g.value;d instanceof Element&&e.checkNewElement(d)}}catch(e){i={error:e}}finally{try{g&&!g.done&&(a=u.return)&&a.call(u)}finally{if(i)throw i.error}}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0})},e.prototype.checkNewElement=function(e){var t,r,n,i,l,s;try{for(var c=o(this.experiments),u=c.next();!u.done;u=c.next()){var g=a(u.value,2),d=g[0],h=g[1];try{for(var p=(n=void 0,o(h.allPossibleSelectors)),f=p.next();!f.done;f=p.next()){var y=f.value;e.matches(y)&&this.trackElement(e,d);try{for(var v=(l=void 0,o(e.querySelectorAll(y))),m=v.next();!m.done;m=v.next()){var b=m.value;this.trackElement(b,d)}}catch(e){l={error:e}}finally{try{m&&!m.done&&(s=v.return)&&s.call(v)}finally{if(l)throw l.error}}}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}},e.prototype.handleElementVisible=function(e){var t,r,n=this.trackedElements.get(e);if(n){var i=function(t){var r=a.experiments.get(t);if(r&&!r.triggered&&(a.triggerExposure(t).catch(function(e){(0,s.logDebug)("[ABsmartly] Failed to trigger exposure for ".concat(t,":"),e)}),a.debug)){var i=n.isPlaceholder?e.getAttribute("data-absmartly-original-selector"):a.getElementSelector(e);(0,s.logDebug)("[ABsmartly] Triggering exposure for ".concat(t," via ").concat(i))}},a=this;try{for(var l=o(n.experiments),c=l.next();!c.done;c=l.next()){i(c.value)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}}},e.prototype.triggerExposure=function(e){return n(this,void 0,void 0,function(){var t,r;return i(this,function(n){switch(n.label){case 0:return(t=this.experiments.get(e))?t.triggered?((0,s.logDebug)("[EXPOSURE] [".concat(e,"] Already triggered, skipping")),[2]):((0,s.logDebug)("[EXPOSURE] [".concat(e,"] ✓ CALLING context.treatment() to trigger exposure"),{experimentName:e,variant:t.variant}),[4,this.context.ready()]):((0,s.logDebug)("[EXPOSURE] [".concat(e,"] ✗ Cannot trigger - experiment not found in tracker")),[2]);case 1:return n.sent(),r=this.context.treatment(e),t.triggered=!0,(0,s.logDebug)("[EXPOSURE] [".concat(e,"] ✓✓ EXPOSURE TRIGGERED - context.treatment() completed"),{experimentName:e,variant:t.variant,treatment:r}),this.cleanupExperiment(e),[2]}})})},e.prototype.cleanupExperiment=function(e){var t,r,n,i;try{for(var l=o(this.trackedElements),s=l.next();!s.done;s=l.next()){var c=a(s.value,2),u=c[0],g=c[1];g.experiments.delete(e),0===g.experiments.size&&(this.observer.unobserve(u),this.trackedElements.delete(u))}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}try{for(var d=o(this.placeholders),h=d.next();!h.done;h=d.next()){var p=a(h.value,2),f=p[0],y=p[1];f.startsWith("".concat(e,"-"))&&(y.remove(),this.placeholders.delete(f))}}catch(e){n={error:e}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}var v=this.experiments.get(e);v&&v.allPossibleSelectors.clear(),Array.from(this.experiments.values()).every(function(e){return e.triggered})&&this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null)},e.prototype.getElementSelector=function(e){if(e.id)return"#".concat(e.id);if(e.className){var t=e.className.split(" ").filter(function(e){return e&&!e.startsWith("absmartly")});if(t.length>0)return".".concat(t.join("."))}return e.tagName.toLowerCase()},e.prototype.needsViewportTracking=function(e){var t,r=this.experiments.get(e);return null!==(t=null==r?void 0:r.hasViewportTrigger)&&void 0!==t&&t},e.prototype.isTriggered=function(e){var t,r=this.experiments.get(e);return null!==(t=null==r?void 0:r.triggered)&&void 0!==t&&t},e.prototype.destroy=function(){var e,t;this.observer.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect();try{for(var r=o(this.placeholders.values()),n=r.next();!n.done;n=r.next()){n.value.remove()}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.experiments.clear(),this.trackedElements.clear(),this.placeholders.clear(),this.debug&&(0,s.logDebug)("[ABsmartly] ExposureTracker destroyed")},e}();t.ExposureTracker=c},834:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BUILD_DEBUG=t.BUILD_VERSION=void 0,t.BUILD_VERSION="1.3.2",t.BUILD_DEBUG=!1},893:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.getOverrides=t.persistOverridesToCookie=t.serializeOverrides=t.getOverrideCookie=t.parseOverrideCookie=t.getQueryStringOverrides=t.isLocalStorageAvailable=t.generateUUID=t.generateUniqueId=t.deleteCookie=t.setCookie=t.getCookie=t.DOMPersistenceManager=t.DOMChangesPlugin=t.CookiePlugin=t.OverridesPluginLite=t.DOMChangesPluginLite=void 0;var o=r(702);Object.defineProperty(t,"DOMChangesPluginLite",{enumerable:!0,get:function(){return o.DOMChangesPluginLite}}),Object.defineProperty(t,"DOMChangesPlugin",{enumerable:!0,get:function(){return o.DOMChangesPluginLite}});var a=r(44);Object.defineProperty(t,"OverridesPluginLite",{enumerable:!0,get:function(){return a.OverridesPluginLite}});var l=r(91);Object.defineProperty(t,"CookiePlugin",{enumerable:!0,get:function(){return l.CookiePlugin}});var s=r(481);Object.defineProperty(t,"DOMPersistenceManager",{enumerable:!0,get:function(){return s.DOMPersistenceManager}}),i(r(574),t),i(r(639),t);var c=r(319);Object.defineProperty(t,"getCookie",{enumerable:!0,get:function(){return c.getCookie}}),Object.defineProperty(t,"setCookie",{enumerable:!0,get:function(){return c.setCookie}}),Object.defineProperty(t,"deleteCookie",{enumerable:!0,get:function(){return c.deleteCookie}}),Object.defineProperty(t,"generateUniqueId",{enumerable:!0,get:function(){return c.generateUniqueId}}),Object.defineProperty(t,"generateUUID",{enumerable:!0,get:function(){return c.generateUUID}}),Object.defineProperty(t,"isLocalStorageAvailable",{enumerable:!0,get:function(){return c.isLocalStorageAvailable}});var u=r(186);Object.defineProperty(t,"getQueryStringOverrides",{enumerable:!0,get:function(){return u.getQueryStringOverrides}}),Object.defineProperty(t,"parseOverrideCookie",{enumerable:!0,get:function(){return u.parseOverrideCookie}}),Object.defineProperty(t,"getOverrideCookie",{enumerable:!0,get:function(){return u.getCookieOverrides}}),Object.defineProperty(t,"serializeOverrides",{enumerable:!0,get:function(){return u.serializeOverrides}}),Object.defineProperty(t,"persistOverridesToCookie",{enumerable:!0,get:function(){return u.persistOverridesToCookie}}),Object.defineProperty(t,"getOverrides",{enumerable:!0,get:function(){return u.getOverrides}}),t.default=o.DOMChangesPluginLite},943:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.registerPlugin=function(e,t){if("undefined"==typeof window)return;window.__ABSMARTLY_PLUGINS__||(window.__ABSMARTLY_PLUGINS__={});window.__ABSMARTLY_PLUGINS__[e]=t},t.unregisterPlugin=function(e){if("undefined"==typeof window)return;window.__ABSMARTLY_PLUGINS__&&delete window.__ABSMARTLY_PLUGINS__[e]},t.isPluginRegistered=function(e){var t;if("undefined"==typeof window)return!1;return!(!window.__ABSMARTLY_PLUGINS__||!(null===(t=window.__ABSMARTLY_PLUGINS__[e])||void 0===t?void 0:t.initialized))},t.getRegisteredPlugins=function(){if("undefined"==typeof window)return{};return window.__ABSMARTLY_PLUGINS__||{}}},964:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},o=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMManipulatorLite=void 0;var a=r(609),l=r(214),s=function(){function e(e,t){void 0===e&&(e=!1);var r=this;this.appliedChanges=new Map,this.debug=e,this.plugin=t,this.pendingManager=new l.PendingChangeManager(function(e,t,n){return n?r.applyChangeToSpecificElement(e,t,n):r.applyChange(e,t)},e)}return e.prototype.executeUserJavaScript=function(e,t,r,n){var i="absmartly-experiment-".concat(r||"unknown",".js"),o="var _debug = (typeof _debug !== 'undefined' ? _debug : { debugLog: console.log.bind(console), debugWarn: console.warn.bind(console), debugError: console.error.bind(console) });\n";try{return new Function("element",o+e+"\n//# sourceURL=".concat(i))(t),!0}catch(d){var a=d instanceof Error?d.message:String(d);if(!(d instanceof EvalError||/unsafe-eval|Content Security Policy|CSP|refused to evaluate/i.test(a)))return this.reportJsExecutionFailure({experimentName:r,selector:n,reason:"runtime",error:a,stack:d instanceof Error?d.stack:void 0}),!1;try{var l="__absmartly_js_target_".concat(Date.now(),"_").concat(Math.floor(1e9*Math.random())),s="".concat(l,"_ran");window[l]=t,window[s]=!1;var c=document.createElement("script");c.textContent="(function(element){".concat(o).concat(e,"\n})(window['").concat(l,"']);\n")+"window['".concat(s,"'] = true;\n")+"try { delete window['".concat(l,"']; } catch(_e) { window['").concat(l,"'] = undefined; }\n")+"//# sourceURL=".concat(i),(document.head||document.documentElement).appendChild(c),c.remove();var u=!0===window[s];try{delete window[s]}catch(e){window[s]=void 0}return!!u||(this.reportJsExecutionFailure({experimentName:r,selector:n,reason:"csp",error:"CSP blocked dynamic script execution. eval(): ".concat(a,"; inline <script> did not execute (likely blocked by script-src without 'unsafe-inline').")}),!1)}catch(e){var g=e instanceof Error?e.message:String(e);return this.reportJsExecutionFailure({experimentName:r,selector:n,reason:"csp",error:"CSP blocked dynamic script execution. eval(): ".concat(a,"; inline <script>: ").concat(g),stack:e instanceof Error?e.stack:void 0}),!1}}},e.prototype.reportJsExecutionFailure=function(e){try{(0,a.logProductionWarn)("[ABsmartly] JavaScript DOM change failed (".concat(e.reason,') for "').concat(e.experimentName,'" selector "').concat(e.selector,'": ').concat(e.error),e.stack?{stack:e.stack}:void 0)}catch(e){}try{"undefined"!=typeof document&&"function"==typeof CustomEvent&&document.dispatchEvent(new CustomEvent("absmartly:js-error",{detail:e}))}catch(e){}},e.prototype.applyChange=function(e,t){var r,i,o,l,s,c,u,g,d,h,p,f,y,v,m=this;if(!e.enabled&&void 0!==e.enabled)return(0,a.logDebug)("Skipping disabled change for experiment: ".concat(t),{experimentName:t,selector:e.selector,changeType:e.type}),!1;var b=!!this.plugin.reapplyingElements&&Array.from(this.plugin.reapplyingElements).length>0,x=null===(g=null===(u=this.plugin.config)||void 0===u?void 0:u.context)||void 0===g?void 0:g.peek(t);this.debug&&(0,a.logDebug)("[DOM-APPLY] [".concat(t,"] ").concat(b?"RE-APPLYING":"APPLYING"," change"),{experimentName:t,userVariant:x,selector:e.selector,type:e.type,timestamp:Date.now(),callStack:null===(d=(new Error).stack)||void 0===d?void 0:d.split("\n").slice(2,4).join("\n")});try{if("styleRules"===e.type)return this.applyStyleRules(e,t);if("create"===e.type){if(e.element&&e.targetSelector)if(this.createElement(e,t))return this.trackAppliedChange(t,e),(0,a.logChangeApplication)(t,e.targetSelector,e.type,1,!0),!0;return!1}var w=document.querySelectorAll(e.selector),E=[];if(0===w.length)return e.waitForElement||(null===(h=this.plugin.config)||void 0===h?void 0:h.spa)?(this.debug&&(0,a.logDebug)("[ABsmartly] Element not found, adding to pending: ".concat(e.selector)),this.pendingManager.addPending({change:e,experimentName:t,observerRoot:e.observerRoot}),!0):(this.debug&&(0,a.logDebug)("[ABsmartly] No elements found for selector: ".concat(e.selector)),(0,a.logDebug)("No elements found for selector",{experimentName:t,selector:e.selector,changeType:e.type}),!1);try{for(var S=n(w),A=S.next();!A.done;A=S.next()){var C=A.value;if(this.debug&&"style"===e.type){var D={};if(e.value&&"object"==typeof e.value)try{for(var O=(o=void 0,n(Object.keys(e.value))),_=O.next();!_.done;_=O.next()){D[L=_.value.replace(/([A-Z])/g,"-$1").toLowerCase()]=C.style.getPropertyValue(L)}}catch(e){o={error:e}}finally{try{_&&!_.done&&(l=O.return)&&l.call(O)}finally{if(o)throw o.error}}(0,a.logDebug)("[DOM-BEFORE-APPLY] Element styles before change",{experimentName:t,selector:e.selector,element:C.tagName,oldStyles:D,newStyles:e.value})}if(this.applyChangeToElement(C,e),this.debug&&"style"===e.type){var k={};if(e.value&&"object"==typeof e.value)try{for(var P=(s=void 0,n(Object.keys(e.value))),M=P.next();!M.done;M=P.next()){var L;k[L=M.value.replace(/([A-Z])/g,"-$1").toLowerCase()]=C.style.getPropertyValue(L)}}catch(e){s={error:e}}finally{try{M&&!M.done&&(c=P.return)&&c.call(P)}finally{if(s)throw s.error}}(0,a.logDebug)("[DOM-AFTER-APPLY] Element styles after change",{experimentName:t,selector:e.selector,element:C.tagName,appliedStyles:k})}if("javascript"===e.type)if(e.value){var T=null===(f=null===(p=this.plugin.config)||void 0===p?void 0:p.context)||void 0===f?void 0:f.peek(t);this.debug&&(0,a.logDebug)("[JAVASCRIPT] [".concat(t,"] Executing JavaScript change"),{experimentName:t,userVariant:T,selector:e.selector,element:C.tagName,code:String(e.value).substring(0,100)+"..."});var I=String(e.value);this.executeUserJavaScript(I,C,t,e.selector)&&(E.push(C),this.debug&&(0,a.logDebug)("[JAVASCRIPT] [".concat(t,"] ✓ JavaScript executed successfully"),{experimentName:t,userVariant:T,selector:e.selector,element:C.tagName,code:I}))}else(0,a.logDebug)("[JAVASCRIPT] [".concat(t,"] ✗ No JavaScript code provided in change.value"),{experimentName:t,selector:e.selector});else if("move"===e.type){var N=e.targetSelector||(e.value&&"object"==typeof e.value?e.value.targetSelector:null),j=e.position||(e.value&&"object"==typeof e.value?e.value.position:null);if(N){var R=document.querySelector(N);R?(this.moveElement(C,R,j),E.push(C)):this.debug&&(0,a.logDebug)("[ABsmartly] Move target not found: ".concat(N))}}else E.push(C);"style"===e.type&&e.persistStyle||"attribute"===e.type&&e.persistAttribute||"javascript"===e.type&&!0===e.persistScript||(null===(y=this.plugin.config)||void 0===y?void 0:y.spa)?this.plugin.watchElement(C,t,e):this.debug&&(0,a.logDebug)("[WATCH-SKIP] NOT watching element - no persist flag and SPA disabled",{experimentName:t,selector:e.selector,element:C.tagName,changeType:e.type,spaMode:null===(v=this.plugin.config)||void 0===v?void 0:v.spa})}}catch(e){r={error:e}}finally{try{A&&!A.done&&(i=S.return)&&i.call(S)}finally{if(r)throw r.error}}if(E.length>0){this.trackAppliedChange(t,e),e.waitForElement&&this.pendingManager.removePending(e.selector,t,e.observerRoot);var U=E.some(function(e){var t;return null===(t=m.plugin.reapplyingElements)||void 0===t?void 0:t.has(e)});return U||(0,a.logChangeApplication)(t,e.selector,e.type,E.length,!0),!0}return(0,a.logChangeApplication)(t,e.selector,e.type,0,!1),!1}catch(r){return this.debug&&(0,a.logDebug)("[ABsmartly] Error applying DOM change:",r,e),(0,a.logDebug)("Error applying DOM change",{experimentName:t,selector:e.selector,changeType:e.type,error:r instanceof Error?r.message:"Unknown error"}),!1}},e.prototype.moveElement=function(e,t,r){var n,i,o;switch(r){case"before":null===(n=t.parentElement)||void 0===n||n.insertBefore(e,t);break;case"after":t.nextSibling?null===(i=t.parentElement)||void 0===i||i.insertBefore(e,t.nextSibling):null===(o=t.parentElement)||void 0===o||o.appendChild(e);break;case"firstChild":t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e);break;default:t.appendChild(e)}},e.prototype.createElement=function(e,t){var r,i;if(!e.element||!e.targetSelector)return null;var o=document.querySelector(e.targetSelector);if(!o)return this.debug&&(0,a.logDebug)("[ABsmartly] Create target not found: ".concat(e.targetSelector)),null;var l=document.createElement("div");l.innerHTML=e.element;var s=Array.from(l.children);if(0===s.length)return null;try{for(var c=n(s),u=c.next();!u.done;u=c.next()){var g=u.value;this.moveElement(g,o,e.position)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}return s[0]},e.prototype.applyStyleRules=function(e,t){try{var r=this.plugin.getStyleManager(t),n="".concat(e.selector,"::states"),i=void 0;if("string"==typeof e.value&&e.value.trim())i=e.value;else{if(!e.states)return!1;i=this.plugin.buildStateRules(e.selector,e.states,!1!==e.important)}return r.setRule(n,i),this.debug&&((0,a.logDebug)("[ABsmartly] Applied style rule: ".concat(n)),(0,a.logDebug)("[ABsmartly] CSS: ".concat(i))),this.trackAppliedChange(t,e),(0,a.logChangeApplication)(t,e.selector,"styleRules",1,!0),!0}catch(e){return this.debug&&(0,a.logDebug)("[ABsmartly] Error applying style rules:",e),!1}},e.prototype.applyChangeToElement=function(e,t){var r,l,s,c,u,g;switch(t.type){case"text":void 0!==t.value&&(e.textContent=String(t.value));break;case"html":void 0!==t.value&&(e.innerHTML=String(t.value));break;case"style":if(t.value&&"object"==typeof t.value)try{for(var d=n(Object.entries(t.value)),h=d.next();!h.done;h=d.next()){var p=i(h.value,2),f=p[0],y=p[1],v=f.replace(/([A-Z])/g,"-$1").toLowerCase(),m=!0===t.important?"important":"";e.style.setProperty(v,String(y),m)}}catch(e){r={error:e}}finally{try{h&&!h.done&&(l=d.return)&&l.call(d)}finally{if(r)throw r.error}}break;case"class":t.add&&Array.isArray(t.add)&&(s=e.classList).add.apply(s,o([],i(t.add),!1)),t.remove&&Array.isArray(t.remove)&&(c=e.classList).remove.apply(c,o([],i(t.remove),!1));break;case"attribute":if(t.value&&"object"==typeof t.value)try{for(var b=n(Object.entries(t.value)),x=b.next();!x.done;x=b.next()){var w=i(x.value,2),E=w[0];null==(y=w[1])?e.removeAttribute(E):e.setAttribute(E,String(y))}}catch(e){u={error:e}}finally{try{x&&!x.done&&(g=b.return)&&g.call(b)}finally{if(u)throw u.error}}break;case"move":if(t.value&&"object"==typeof t.value){var S=t.value,A=document.querySelector(S.targetSelector);A?this.moveElement(e,A,S.position):this.debug&&(0,a.logDebug)("[ABsmartly] Move target not found: ".concat(S.targetSelector))}break;case"delete":e.remove()}},e.prototype.applyChangeToSpecificElement=function(e,t,r){var n;try{if(this.applyChangeToElement(r,e),"javascript"===e.type&&e.value){if(this.debug&&(0,a.logDebug)("[JAVASCRIPT] [".concat(t,"] Executing JavaScript on specific element"),{experimentName:t,selector:e.selector,element:r.tagName,code:String(e.value).substring(0,100)+"..."}),!this.executeUserJavaScript(String(e.value),r,t,e.selector))return!1;this.debug&&(0,a.logDebug)("[JAVASCRIPT] [".concat(t,"] ✓ JavaScript executed successfully"),{experimentName:t,selector:e.selector,element:r.tagName})}else if("move"===e.type){var i=e.targetSelector||(e.value&&"object"==typeof e.value?e.value.targetSelector:null),o=e.position||(e.value&&"object"==typeof e.value?e.value.position:null);if(i){var l=document.querySelector(i);if(!l)return!1;this.moveElement(r,l,o)}}return("style"===e.type&&e.persistStyle||"attribute"===e.type&&e.persistAttribute||"javascript"===e.type&&!0===e.persistScript||(null===(n=this.plugin.config)||void 0===n?void 0:n.spa))&&this.plugin.watchElement(r,t,e),!0}catch(e){return this.debug&&(0,a.logDebug)("[ABsmartly] Error applying change to specific element:",e),!1}},e.prototype.trackAppliedChange=function(e,t){var r=this.appliedChanges.get(e);r||(r=new Set,this.appliedChanges.set(e,r));var n="".concat(t.selector,"-").concat(t.type);r.add(n)},e.prototype.hasChanges=function(e){return this.appliedChanges.has(e)},e.prototype.clearTracking=function(e){e?this.appliedChanges.delete(e):this.appliedChanges.clear()},e.prototype.removeAllPending=function(e){this.pendingManager.removeAllPending(e)},e.prototype.destroy=function(){this.pendingManager.destroy(),this.appliedChanges.clear()},e}();t.DOMManipulatorLite=s},973:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.URLMatcher=void 0;var n=r(609),i=function(){function e(){}return e.matches=function(e,t){void 0===t&&(t=window.location.href);var r=this.normalizeFilter(e),n=this.extractURLPart(t,r.matchType);return(!r.exclude||!this.matchesPatterns(r.exclude,n,r.mode))&&(!r.include||0!==r.include.length&&this.matchesPatterns(r.include,n,r.mode))},e.extractURLPart=function(e,t){void 0===t&&(t="path");try{var r=new URL(e);switch(t){case"full-url":return r.href;case"path":default:return r.pathname+r.hash;case"domain":return r.hostname;case"query":return r.search;case"hash":return r.hash}}catch(t){return(0,n.logDebug)("[ABsmartly] Failed to parse URL: ".concat(e),t),e}},e.matchesPatterns=function(e,t,r){var i=this;return void 0===r&&(r="simple"),e.some(function(e){if("regex"===r)try{return new RegExp(e).test(t)}catch(t){return(0,n.logDebug)("[ABsmartly] Invalid regex pattern: ".concat(e),t),!1}return i.matchSimplePattern(e,t)})},e.matchSimplePattern=function(e,t){var r=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");try{return new RegExp("^".concat(r,"$")).test(t)}catch(t){return(0,n.logDebug)("[ABsmartly] Invalid pattern: ".concat(e),t),!1}},e.normalizeFilter=function(e){return"string"==typeof e?{include:[e],exclude:[],mode:"simple",matchType:"path"}:Array.isArray(e)?{include:e.length>0?e:void 0,exclude:[],mode:"simple",matchType:"path"}:{include:e.include,exclude:e.exclude||[],mode:e.mode||"simple",matchType:e.matchType||"path"}},e}();t.URLMatcher=i}},t={};var r=function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}(893);return r})());
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ABsmartlyDOMLite=t():e.ABsmartlyDOMLite=t()}(this,()=>(()=>{"use strict";var e={44:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a};Object.defineProperty(t,"__esModule",{value:!0}),t.OverridesPluginLite=void 0;var l=r(609),s=r(943),c=r(186),u=function(){function e(e){var t,r,n,i,o;if(this.initialized=!1,!e.context)throw new Error("[OverridesPluginLite] Context is required");this.config={context:e.context,cookieName:null!==(t=e.cookieName)&&void 0!==t?t:"absmartly_overrides",useQueryString:null===(r=e.useQueryString)||void 0===r||r,queryPrefix:null!==(n=e.queryPrefix)&&void 0!==n?n:"exp_",persistQueryToCookie:null!==(i=e.persistQueryToCookie)&&void 0!==i&&i,debug:null!==(o=e.debug)&&void 0!==o&&o},this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Initialized with config:",{cookieName:this.config.cookieName,useQueryString:this.config.useQueryString,queryPrefix:this.config.queryPrefix})}return e.prototype.ready=function(){return n(this,void 0,void 0,function(){var e,t,r,n,s,c,u,g,d,h,p;return i(this,function(i){if(this.initialized)return this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Already initialized"),[2];if(this.initialized=!0,this.registerWithContext(),this.registerGlobally(),e={},this.config.useQueryString&&"undefined"!=typeof window&&(e=this.getQueryStringOverrides(),this.config.persistQueryToCookie&&this.config.cookieName&&Object.keys(e).length>0&&this.persistOverridesToCookie(e)),0===Object.keys(e).length&&this.config.cookieName&&(e=this.getCookieOverrides()),0===Object.keys(e).length)return this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] No overrides found"),[2];try{for(t=o(Object.entries(e)),r=t.next();!r.done;r=t.next())n=a(r.value,2),s=n[0],c=n[1],u="number"==typeof c?c:c.variant,isNaN(u)?this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Skipping invalid variant for ".concat(s,": ").concat(u)):(null===(p=(h=this.config.context).override)||void 0===p||p.call(h,s,u),this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Override: ".concat(s," -> variant ").concat(u)))}catch(e){g={error:e}}finally{try{r&&!r.done&&(d=t.return)&&d.call(t)}finally{if(g)throw g.error}}return[2]})})},e.prototype.initialize=function(){return n(this,void 0,void 0,function(){return i(this,function(e){return[2,this.ready()]})})},e.prototype.getQueryStringOverrides=function(){if("undefined"==typeof window||!window.location)return{};var e=(0,c.getQueryStringOverrides)(this.config.queryPrefix);return this.config.debug&&Object.keys(e).length>0&&(0,l.logDebug)("[OverridesPluginLite] Query string overrides:",e),e},e.prototype.getCookieOverrides=function(){return"undefined"==typeof document?{}:(0,c.getCookieOverrides)(this.config.cookieName)},e.prototype.persistOverridesToCookie=function(e){if(this.config.cookieName&&"undefined"!=typeof document&&((0,c.persistOverridesToCookie)(e,{cookieName:this.config.cookieName}),this.config.debug)){var t=(0,c.serializeOverrides)(e);(0,l.logDebug)("[OverridesPluginLite] Persisted to cookie:",t)}},e.prototype.registerWithContext=function(){this.config.context&&(this.config.context.__plugins||(this.config.context.__plugins={}),this.config.context.__plugins.overridesPlugin={name:"OverridesPluginLite",version:"1.0.0",initialized:!0,capabilities:["cookie-overrides","query-overrides"],instance:this,timestamp:Date.now()},this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Registered with context at __plugins.overridesPlugin"))},e.prototype.unregisterFromContext=function(){var e,t;(null===(t=null===(e=this.config.context)||void 0===e?void 0:e.__plugins)||void 0===t?void 0:t.overridesPlugin)&&(delete this.config.context.__plugins.overridesPlugin,this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Unregistered from context"))},e.prototype.destroy=function(){this.initialized=!1,this.unregisterFromContext(),this.unregisterGlobally()},e.prototype.registerGlobally=function(){(0,s.registerPlugin)("overrides",{name:"OverridesPluginLite",version:"1.0.0",initialized:!0,timestamp:Date.now(),capabilities:["cookie-overrides","query-overrides"],instance:this}),this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Registered in global window.__ABSMARTLY_PLUGINS__")},e.prototype.unregisterGlobally=function(){(0,s.unregisterPlugin)("overrides"),this.config.debug&&(0,l.logDebug)("[OverridesPluginLite] Unregistered from global registry")},e}();t.OverridesPluginLite=u},91:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},l=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.CookiePlugin=void 0;var s=r(609),c=r(319),u=function(){function e(e){void 0===e&&(e={}),this.context=e.context,this.debug=e.debug||!1,this.cookieDomain=e.cookieDomain||".absmartly.com",this.cookiePath=e.cookiePath||"/",this.sameSite=e.sameSite||"Lax",this.secure=e.secure||!1,this.cookieExpiryDays=e.cookieExpiryDays||730,this.unitIdCookieName=e.unitIdCookieName||"abs",this.publicIdCookieName=e.publicIdCookieName||"abs_public",this.expiryCookieName=e.expiryCookieName||"abs_expiry",this.utmCookieName=e.utmCookieName||"abs_utm_params",this.utmParams=e.utmParamsList||["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],this.autoUpdateExpiry=!1!==e.autoUpdateExpiry,this.expiryCheckInterval=e.expiryCheckInterval||30}return e.prototype.debugLog=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.debug&&s.logDebug.apply(void 0,a(["[CookiePlugin]"],o(e),!1))},e.prototype.setCookie=function(e,t,r){var n=void 0!==r?r:this.cookieExpiryDays,i=(0,c.setCookie)(e,t,n,{domain:this.cookieDomain,path:this.cookiePath,sameSite:this.sameSite,secure:this.secure});return i&&this.debugLog("Set cookie ".concat(e,":"),t),i},e.prototype.deleteCookie=function(e){(0,c.deleteCookie)(e,{domain:this.cookieDomain,path:this.cookiePath})},e.prototype.getUnitId=function(){if(this.unitId)return this.unitId;var e=navigator.cookieEnabled,t=(0,c.isLocalStorageAvailable)(),r=null;return e&&(r=(0,c.getCookie)(this.unitIdCookieName)||(0,c.getCookie)(this.publicIdCookieName)),!r&&t&&(r=localStorage.getItem("abs_id")),r&&(this.unitId=r),r},e.prototype.setUnitId=function(e){this.unitId=e;var t=navigator.cookieEnabled,r=(0,c.isLocalStorageAvailable)();t&&(this.setCookie(this.unitIdCookieName,e),this.setCookie(this.publicIdCookieName,e),this.autoUpdateExpiry&&this.updateExpiryTimestamp()),r&&localStorage.setItem("abs_id",e),this.debugLog("Unit ID set:",e)},e.prototype.generateAndSetUnitId=function(){var e=(0,c.generateUniqueId)();return this.setUnitId(e),e},e.prototype.updateExpiryTimestamp=function(){if(navigator.cookieEnabled){var e=Date.now();this.setCookie(this.expiryCookieName,e.toString()),this.debugLog("Updated expiry timestamp:",e)}},e.prototype.isExpiryFresh=function(){if(!navigator.cookieEnabled)return!1;var e=(0,c.getCookie)(this.expiryCookieName);if(!e)return!1;try{var t=parseInt(e,10),r=(Date.now()-t)/864e5,n=r<=this.expiryCheckInterval;return this.debugLog("Expiry check:",{daysSinceSet:r,isFresh:n}),n}catch(e){return this.debugLog("Error parsing expiry cookie:",e),!1}},e.prototype.getUtmParams=function(){var e,t,r,n,i={},o=new URLSearchParams(window.location.search);try{for(var a=l(this.utmParams),s=a.next();!s.done;s=a.next()){var c=s.value;(h=o.get(c))&&(i[c]=h)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}if(0===Object.keys(i).length&&document.referrer)try{var u=new URL(document.referrer);try{for(var g=l(this.utmParams),d=g.next();!d.done;d=g.next()){var h;c=d.value;(h=u.searchParams.get(c))&&(i[c]=h)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(n=g.return)&&n.call(g)}finally{if(r)throw r.error}}}catch(e){this.debugLog("Error parsing referrer URL:",e)}if(0===Object.keys(i).length){var p=this.getStoredUtmParams();if(p)return p}return i},e.prototype.storeUtmParams=function(e){if(0!==Object.keys(e).length){var t={params:e,timestamp:Date.now()},r=navigator.cookieEnabled;if((0,c.isLocalStorageAvailable)())try{localStorage.setItem(this.utmCookieName,JSON.stringify(t)),this.debugLog("Stored UTM params in localStorage:",e)}catch(e){this.debugLog("Failed to store UTM params in localStorage:",e)}r&&(this.setCookie(this.utmCookieName,JSON.stringify(t),30),this.debugLog("Stored UTM params in cookie:",e))}},e.prototype.getStoredUtmParams=function(){var e=null,t=(0,c.isLocalStorageAvailable)(),r=navigator.cookieEnabled;if(t)try{e=localStorage.getItem(this.utmCookieName)}catch(e){this.debugLog("Failed to get UTM params from localStorage:",e)}if(!e&&r&&(e=(0,c.getCookie)(this.utmCookieName)),e)try{var n=JSON.parse(e);if(Date.now()-n.timestamp<2592e6)return n.params}catch(e){this.debugLog("Failed to parse stored UTM params:",e)}return null},e.prototype.applyUtmAttributesToContext=function(e){var t,r,n=e||this.context;if(n){var i=this.getUtmParams();Object.keys(i).length>0&&this.storeUtmParams(i);try{for(var a=l(Object.entries(i)),c=a.next();!c.done;c=a.next()){var u=o(c.value,2),g=u[0],d=u[1],h=g.slice(4);n.attribute(h,d),this.debugLog("Set attribute ".concat(h,":"),d)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}else(0,s.logDebug)("[CookiePlugin] No context available to apply UTM attributes")},e.prototype.clearAllCookies=function(){this.deleteCookie(this.unitIdCookieName),this.deleteCookie(this.publicIdCookieName),this.deleteCookie(this.expiryCookieName),this.deleteCookie(this.utmCookieName),(0,c.isLocalStorageAvailable)()&&(localStorage.removeItem("abs_id"),localStorage.removeItem(this.utmCookieName)),this.unitId=void 0,this.debugLog("All cookies and storage cleared")},e.prototype.ready=function(){return n(this,void 0,void 0,function(){var e;return i(this,function(t){return this.debugLog("Initializing CookiePlugin"),(e=this.getUnitId())?(this.debugLog("Using existing unit ID:",e),this.autoUpdateExpiry&&!this.isExpiryFresh()&&this.updateExpiryTimestamp()):(e=this.generateAndSetUnitId(),this.debugLog("Generated new unit ID:",e)),this.context&&this.applyUtmAttributesToContext(),this.debugLog("CookiePlugin initialized successfully"),[2]})})},e.prototype.initialize=function(){return n(this,void 0,void 0,function(){return i(this,function(e){return[2,this.ready()]})})},e.prototype.setContext=function(e){this.context=e,this.debugLog("Context set for CookiePlugin")},e.prototype.needsServerSideCookie=function(){var e=this.getUnitId(),t=navigator.cookieEnabled,r=(0,c.isLocalStorageAvailable)();if(e){if(t&&!this.isExpiryFresh())return this.debugLog("Existing ID present but expiry not fresh - need worker call"),!0}else if(t||r){var n=(0,c.getCookie)(this.expiryCookieName);return this.debugLog(n?"No existing ID but expiry cookie exists - need worker call":"No existing ID and no expiry cookie - need worker call"),!0}return!1},e.prototype.trackLanding=function(e){var t=e||this.context;if(t){var r=new URLSearchParams(window.location.search),n=this.utmParams.some(function(e){return r.get(e)}),i=document.referrer,o=i&&!i.includes(this.cookieDomain.replace(".","")),a=navigator.cookieEnabled||(0,c.isLocalStorageAvailable)(),l=!!((0,c.getCookie)(this.unitIdCookieName)||(0,c.getCookie)(this.publicIdCookieName)||(0,c.getCookie)(this.expiryCookieName)||(0,c.isLocalStorageAvailable)()&&localStorage.getItem("abs_id"));if(n||o||a&&!l){var u={referrer_url:i||"",landing_url:window.location.href,accepts_cookies:navigator.cookieEnabled,accepts_storage:(0,c.isLocalStorageAvailable)(),has_utm:n};this.debugLog("Tracking landing:",u),t.track("landing",u)}}else(0,s.logDebug)("[CookiePlugin] No context available for tracking landing")},e}();t.CookiePlugin=u},186:function(e,t){var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a};function i(e,i){var o,a;if(void 0===e&&(e=t.DEFAULT_OVERRIDE_QUERY_PREFIX),"undefined"==typeof window&&!i)return{};var l=i||new URLSearchParams(window.location.search),s={};try{for(var c=r(l.entries()),u=c.next();!u.done;u=c.next()){var g=n(u.value,2),d=g[0],h=g[1];if(d.startsWith(e)){var p=d.substring(e.length);if(p){var f=h.split(","),y=parseInt(f[0],10);isNaN(y)||(1===f.length?s[p]=y:s[p]={variant:y,env:f[1]?parseInt(f[1],10):void 0,id:f[2]?parseInt(f[2],10):void 0})}}}}catch(e){o={error:e}}finally{try{u&&!u.done&&(a=c.return)&&a.call(c)}finally{if(o)throw o.error}}return s}function o(e){var t,i;if(!e)return{};var o={},a=e;e.includes("|")&&(a=(f=e.split("|"))[f.length-1]);if(!a)return{};var l=a.split(",");try{for(var s=r(l),c=s.next();!c.done;c=s.next()){var u=c.value,g=n(u.split(":"),2),d=g[0],h=g[1];if(d&&h){var p=decodeURIComponent(d),f=h.split("."),y=parseInt(f[0],10);isNaN(y)||(1===f.length?o[p]=y:o[p]={variant:y,env:f[1]?parseInt(f[1],10):void 0,id:f[2]?parseInt(f[2],10):void 0})}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(i=s.return)&&i.call(s)}finally{if(t)throw t.error}}return o}function a(e,n){var i,a;void 0===e&&(e=t.DEFAULT_OVERRIDE_COOKIE_NAME);var l=null!=n?n:"undefined"!=typeof document?document.cookie:"";if(!l)return{};var s=e+"=",c=l.split(";");try{for(var u=r(c),g=u.next();!g.done;g=u.next()){var d=g.value;if(0===(d=d.trim()).indexOf(s))return o(decodeURIComponent(d.substring(s.length)))}}catch(e){i={error:e}}finally{try{g&&!g.done&&(a=u.return)&&a.call(u)}finally{if(i)throw i.error}}return{}}function l(e){var t,i,o=[];try{for(var a=r(Object.entries(e)),l=a.next();!l.done;l=a.next()){var s=n(l.value,2),c=s[0],u=s[1],g=encodeURIComponent(c);if("number"==typeof u)o.push("".concat(g,":").concat(u));else{var d="".concat(g,":").concat(u.variant);void 0!==u.env&&(d+=".".concat(u.env)),void 0!==u.id&&(d+=".".concat(u.id)),o.push(d)}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}return o.join(",")}function s(e,r){if(void 0===r&&(r={}),"undefined"!=typeof document){var n=r.cookieName||t.DEFAULT_OVERRIDE_COOKIE_NAME,i=r.maxAge||86400,o=l(e);document.cookie="".concat(n,"=").concat(encodeURIComponent(o),";path=/;max-age=").concat(i)}}function c(e){var t,i,o={};try{for(var a=r(Object.entries(e)),l=a.next();!l.done;l=a.next()){var s=n(l.value,2),c=s[0],u=s[1];o[c]="number"==typeof u?u:u.variant}}catch(e){t={error:e}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}return o}Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_OVERRIDE_QUERY_PREFIX=t.DEFAULT_OVERRIDE_COOKIE_NAME=void 0,t.getQueryStringOverrides=i,t.parseOverrideCookie=o,t.getCookieOverrides=a,t.serializeOverrides=l,t.persistOverridesToCookie=s,t.getOverrides=function(e,r,n,o){void 0===e&&(e=t.DEFAULT_OVERRIDE_COOKIE_NAME);void 0===r&&(r=t.DEFAULT_OVERRIDE_QUERY_PREFIX);var l=i(r,n);if(Object.keys(l).length>0)return"undefined"!=typeof document&&s(l,{cookieName:e,maxAge:86400}),c(l);return c(a(e,o))},t.DEFAULT_OVERRIDE_COOKIE_NAME="absmartly_overrides",t.DEFAULT_OVERRIDE_QUERY_PREFIX="exp_"},214:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a};Object.defineProperty(t,"__esModule",{value:!0}),t.PendingChangeManager=void 0;var a=r(609),l=function(){function e(e,t){void 0===t&&(t=!1),this.applyFn=e,this.pending=new Map,this.observers=new Map,this.appliedSelectors=new Set,this.batchTimer=null,this.batchedWork=new Set,this.debug=t}return e.prototype.addPending=function(e){var t=e.change,r=e.observerRoot,i=r;r&&!document.querySelector(r)&&(this.debug&&(0,a.logDebug)("[ABsmartly] Observer root not found, using document:",r),i=void 0);var o="".concat(t.selector,"-").concat(i||"document");this.debug&&(0,a.logDebug)("[ABsmartly] Adding pending change for selector:",t.selector);var l=this.getObserverRoot(i).querySelector(t.selector);if(l)this.applyChange(l,n(n({},e),{observerRoot:i}));else{var s=this.pending.get(o)||[];s.push(n(n({},e),{observerRoot:i})),this.pending.set(o,s),this.ensureObserver(i)}},e.prototype.removePending=function(e,t,r){var n="".concat(e,"-").concat(r||"document"),i=this.pending.get(n);if(i){var o=i.filter(function(e){return e.experimentName!==t});0===o.length?this.pending.delete(n):this.pending.set(n,o)}this.checkObserverCleanup(r)},e.prototype.removeAllPending=function(e){var t,r;try{for(var n=i(this.pending.entries()),a=n.next();!a.done;a=n.next()){var l=o(a.value,2),s=l[0],c=l[1].filter(function(t){return t.experimentName!==e});0===c.length?this.pending.delete(s):this.pending.set(s,c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}this.cleanupObservers()},e.prototype.ensureObserver=function(e){var t=this,r=e||"document";if(!this.observers.has(r)){var n=this.getObserverRoot(e),i=new MutationObserver(function(r){t.handleMutations(r,e)});i.observe(n,{childList:!0,subtree:!0}),this.observers.set(r,i),this.debug&&(0,a.logDebug)("[ABsmartly] Started observer for root:",r)}},e.prototype.handleMutations=function(e,t){var r,n,a,l,s,c,u,g,d=this,h=[];try{for(var p=i(e),f=p.next();!f.done;f=p.next()){var y=f.value,v=function(e){var r,n,a,l;if(!(e instanceof Element))return"continue";var s=t||"document";try{for(var c=(r=void 0,i(m.pending.entries())),u=c.next();!u.done;u=c.next()){var g=o(u.value,2),p=g[0],f=g[1];if(p.endsWith("-".concat(s))){var y=function(t){var r,n,o=t.change;if(e.matches(o.selector))return h.push(function(){return d.applyChange(e,t)}),"continue";var a=e.querySelectorAll(o.selector),l=function(e){h.push(function(){return d.applyChange(e,t)})};try{for(var s=(r=void 0,i(a)),c=s.next();!c.done;c=s.next()){l(c.value)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}};try{for(var v=(a=void 0,i(f)),b=v.next();!b.done;b=v.next()){y(b.value)}}catch(e){a={error:e}}finally{try{b&&!b.done&&(l=v.return)&&l.call(v)}finally{if(a)throw a.error}}}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}},m=this;try{for(var b=(a=void 0,i(y.addedNodes)),x=b.next();!x.done;x=b.next()){v(x.value)}}catch(e){a={error:e}}finally{try{x&&!x.done&&(l=b.return)&&l.call(b)}finally{if(a)throw a.error}}}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}if(h.length>0)if("undefined"!=typeof requestAnimationFrame){requestAnimationFrame(function(){d.processBatchedWork()});try{for(var w=i(h),E=w.next();!E.done;E=w.next()){var S=E.value;this.batchedWork.add(S)}}catch(e){s={error:e}}finally{try{E&&!E.done&&(c=w.return)&&c.call(w)}finally{if(s)throw s.error}}}else try{for(var A=i(h),C=A.next();!C.done;C=A.next()){(S=C.value)()}}catch(e){u={error:e}}finally{try{C&&!C.done&&(g=A.return)&&g.call(A)}finally{if(u)throw u.error}}},e.prototype.processBatchedWork=function(){var e,t,r=Array.from(this.batchedWork);this.batchedWork.clear(),this.batchTimer=null,this.debug&&r.length>0&&(0,a.logDebug)("[ABsmartly] Processing batched work:",r.length,"items");try{for(var n=i(r),o=n.next();!o.done;o=n.next()){(0,o.value)()}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},e.prototype.applyChange=function(e,t){var r=t.change,n=t.experimentName,i=t.observerRoot,o="".concat(r.selector,"-").concat(i||"document","-").concat(n);if(!this.appliedSelectors.has(o)&&(this.debug&&(0,a.logDebug)("[ABsmartly] Applying pending change to element:",r.selector),this.applyFn(r,n,e))){this.appliedSelectors.add(o);var l="".concat(r.selector,"-").concat(i||"document"),s=this.pending.get(l);if(s){var c=s.filter(function(e){return e.experimentName!==n||e.change.selector!==r.selector});0===c.length?this.pending.delete(l):this.pending.set(l,c)}this.checkObserverCleanup(i)}},e.prototype.getObserverRoot=function(e){if(!e)return document.documentElement;var t=document.querySelector(e);return t||document.documentElement},e.prototype.checkObserverCleanup=function(e){var t,r,n=e||"document",o=!1;try{for(var l=i(this.pending.keys()),s=l.next();!s.done;s=l.next()){if(s.value.endsWith("-".concat(n))){o=!0;break}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}if(!o){var c=this.observers.get(n);c&&(c.disconnect(),this.observers.delete(n),this.debug&&(0,a.logDebug)("[ABsmartly] Disconnected observer for root:",n))}},e.prototype.cleanupObservers=function(){var e,t,r,n,o,l,s=[];try{for(var c=i(this.observers.keys()),u=c.next();!u.done;u=c.next()){var g=u.value,d=!1;try{for(var h=(r=void 0,i(this.pending.keys())),p=h.next();!p.done;p=h.next()){if(p.value.endsWith("-".concat(g))){d=!0;break}}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}d||s.push(g)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}try{for(var f=i(s),y=f.next();!y.done;y=f.next()){g=y.value;var v=this.observers.get(g);v&&(v.disconnect(),this.observers.delete(g),this.debug&&(0,a.logDebug)("[ABsmartly] Cleaned up observer for root:",g))}}catch(e){o={error:e}}finally{try{y&&!y.done&&(l=f.return)&&l.call(f)}finally{if(o)throw o.error}}},e.prototype.destroy=function(){var e,t;this.batchTimer&&(clearTimeout(this.batchTimer),this.batchTimer=null);try{for(var r=i(this.observers.values()),n=r.next();!n.done;n=r.next()){n.value.disconnect()}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.observers.clear(),this.pending.clear(),this.appliedSelectors.clear(),this.batchedWork.clear(),this.debug&&(0,a.logDebug)("[ABsmartly] PendingChangeManager destroyed")},e.prototype.getPendingCount=function(){var e,t,r=0;try{for(var n=i(this.pending.values()),o=n.next();!o.done;o=n.next()){r+=o.value.length}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},e.prototype.getAppliedCount=function(){return this.appliedSelectors.size},e.prototype.hasPendingForExperiment=function(e){var t,r;try{for(var n=i(this.pending.values()),o=n.next();!o.done;o=n.next()){if(o.value.some(function(t){return t.experimentName===e}))return!0}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return!1},e}();t.PendingChangeManager=l},253:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},o=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.HTMLInjector=void 0;var a=r(609),l=r(973),s=function(){function e(e){void 0===e&&(e=!1),this.injectedIds=new Set,this.debug=e}return e.prototype.parseInjectionKey=function(e){var t,r;try{for(var i=n(["headStart","headEnd","bodyStart","bodyEnd"]),o=i.next();!o.done;o=i.next()){var l=o.value;if(e===l)return{location:l,priority:0};if(e.startsWith(l)){var s=e.substring(l.length),c=parseInt(s,10);if(!isNaN(c))return{location:l,priority:c}}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return this.debug&&(0,a.logDebug)("[HTMLInjector] Invalid injection key:",e),null},e.prototype.collectInjections=function(e,t){var r,o,s,c,u,g,d,h;void 0===t&&(t=window.location.href);var p=new Map;try{for(var f=n(e),y=f.next();!y.done;y=f.next()){var v=i(y.value,2),m=v[0],b=v[1];try{for(var x=(s=void 0,n(b)),w=x.next();!w.done;w=x.next()){var E=i(w.value,2),S=E[0],A=E[1];if(A&&"object"==typeof A){if(A.urlFilter)if(!l.URLMatcher.matches(A.urlFilter,t)){this.debug&&(0,a.logDebug)("[HTMLInjector] Skipping ".concat(m," variant ").concat(S," - URL filter doesn't match:"),{currentUrl:t,urlFilter:A.urlFilter});continue}var C=A.data;if(C&&"object"==typeof C)try{for(var D=(u=void 0,n(Object.entries(C))),O=D.next();!O.done;O=D.next()){var _=i(O.value,2),k=_[0],P=_[1];if("string"==typeof P){var M=this.parseInjectionKey(k);if(M){var L={code:P,priority:M.priority,location:M.location};p.has(M.location)||p.set(M.location,[]),p.get(M.location).push(L),this.debug&&(0,a.logDebug)("[HTMLInjector] Collected injection:",{experiment:m,variant:S,location:M.location,priority:M.priority,codeLength:P.length})}}else this.debug&&(0,a.logDebug)("[HTMLInjector] Skipping non-string injection code for key ".concat(k,":"),P)}}catch(e){u={error:e}}finally{try{O&&!O.done&&(g=D.return)&&g.call(D)}finally{if(u)throw u.error}}else this.debug&&(0,a.logDebug)("[HTMLInjector] Invalid injection data for ".concat(m," variant ").concat(S,":"),C)}else this.debug&&(0,a.logDebug)("[HTMLInjector] Invalid injection data for ".concat(m," variant ").concat(S,":"),A)}}catch(e){s={error:e}}finally{try{w&&!w.done&&(c=x.return)&&c.call(x)}finally{if(s)throw s.error}}}}catch(e){r={error:e}}finally{try{y&&!y.done&&(o=f.return)&&o.call(f)}finally{if(r)throw r.error}}try{for(var T=n(p),I=T.next();!I.done;I=T.next()){var N=i(I.value,2),j=N[0],R=N[1];R.sort(function(e,t){return t.priority-e.priority}),this.debug&&(0,a.logDebug)("[HTMLInjector] Sorted ".concat(j," injections by priority:"),{location:j,count:R.length,priorities:R.map(function(e){return e.priority})})}}catch(e){d={error:e}}finally{try{I&&!I.done&&(h=T.return)&&h.call(T)}finally{if(d)throw d.error}}return p},e.prototype.inject=function(e){var t,r,l,s;try{for(var c=n(e),u=c.next();!u.done;u=c.next()){var g=i(u.value,2),d=g[0],h=g[1],p="headStart"===d||"bodyStart"===d?o([],i(h),!1).reverse():h;try{for(var f=(l=void 0,n(p)),y=f.next();!y.done;y=f.next()){var v=y.value;this.injectAtLocation(d,v.code)}}catch(e){l={error:e}}finally{try{y&&!y.done&&(s=f.return)&&s.call(f)}finally{if(l)throw l.error}}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}this.debug&&(0,a.logDebug)("[HTMLInjector] All injections complete")},e.prototype.injectAtLocation=function(e,t){var r=this.simpleHash(t),n="absmartly-inject-".concat(e,"-").concat(r);if(!this.injectedIds.has(n))try{switch(e){case"headStart":this.injectHeadStart(t,n);break;case"headEnd":this.injectHeadEnd(t,n);break;case"bodyStart":this.injectBodyStart(t,n);break;case"bodyEnd":this.injectBodyEnd(t,n)}this.injectedIds.add(n),this.debug&&(0,a.logDebug)("[HTMLInjector] Injected at ".concat(e,":"),{location:e,codeLength:t.length,injectionId:n})}catch(t){this.debug&&(0,a.logDebug)("[HTMLInjector] Error injecting at ".concat(e,":"),t)}},e.prototype.injectHeadStart=function(e,t){if(document.head){var r=this.createContainer(e,t);document.head.insertBefore(r,document.head.firstChild)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <head> element not found for headStart injection")},e.prototype.injectHeadEnd=function(e,t){if(document.head){var r=this.createContainer(e,t);document.head.appendChild(r)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <head> element not found for headEnd injection")},e.prototype.injectBodyStart=function(e,t){if(document.body){var r=this.createContainer(e,t);document.body.insertBefore(r,document.body.firstChild)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <body> element not found for bodyStart injection")},e.prototype.injectBodyEnd=function(e,t){if(document.body){var r=this.createContainer(e,t);document.body.appendChild(r)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <body> element not found for bodyEnd injection")},e.prototype.createContainer=function(e,t){var r=document.createElement("div");return r.id=t,r.setAttribute("data-absmartly-injection","true"),r.innerHTML=e,r},e.prototype.simpleHash=function(e){for(var t=0,r=0;r<e.length;r++){t=(t<<5)-t+e.charCodeAt(r),t&=t}return Math.abs(t).toString(36)},e.prototype.destroy=function(){var e,t;try{for(var r=n(this.injectedIds),i=r.next();!i.done;i=r.next()){var o=i.value,l=document.getElementById(o);l&&l.remove()}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.injectedIds.clear(),this.debug&&(0,a.logDebug)("[HTMLInjector] Destroyed and cleaned up all injections")},e}();t.HTMLInjector=s},319:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getCookie=function(e){var t,r="; ".concat(document.cookie).split("; ".concat(e,"="));if(2===r.length){return(null===(t=r.pop())||void 0===t?void 0:t.split(";").shift())||null}return null},t.setCookie=i,t.deleteCookie=function(e,t){void 0===t&&(t={});i(e,"",-1,t)},t.generateUniqueId=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2)},t.generateUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},t.isLocalStorageAvailable=function(){try{var e="__localStorage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}};var n=r(609);function i(e,t,r,i){void 0===i&&(i={});try{var o=new Date;o.setTime(o.getTime()+24*r*60*60*1e3);var a="expires=".concat(o.toUTCString()),l=i.path||"/",s="".concat(e,"=").concat(t,";").concat(a,";path=").concat(l);i.domain&&"localhost"!==i.domain&&(s+=";domain=".concat(i.domain));var c=i.sameSite||"Lax";return s+=";SameSite=".concat(c),i.secure&&(s+=";Secure"),document.cookie=s,!0}catch(t){return(0,n.logDebug)("Unable to set cookie ".concat(e,":"),t),!1}}},356:function(e,t,r){var n=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r},i=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.VariantExtractor=void 0;var l=r(609),s=r(973),c=function(){function e(e,t,r){void 0===t&&(t="__dom_changes"),void 0===r&&(r=!1),this.cachedAllChanges=null,this.context=e,this.variableName=t,this.debug=r}return e.prototype.clearCache=function(){this.cachedAllChanges=null},e.prototype.extractAllChanges=function(){var e,t,r,n,s,c,u;if(this.cachedAllChanges)return this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Returning cached changes"),this.cachedAllChanges;var g=new Map;try{var d=this.context.data();if(this.debug&&(0,l.logDebug)("[VariantExtractor DEBUG] Raw context data structure:",{hasData:!!d,contextKeys:d?Object.keys(d):[],experimentCount:(null===(r=null==d?void 0:d.experiments)||void 0===r?void 0:r.length)||0,firstExperiment:(null===(n=null==d?void 0:d.experiments)||void 0===n?void 0:n[0])?{name:d.experiments[0].name,variantCount:(null===(s=d.experiments[0].variants)||void 0===s?void 0:s.length)||0,firstVariantStructure:(null===(c=d.experiments[0].variants)||void 0===c?void 0:c[0])?Object.keys(d.experiments[0].variants[0]):[]}:null,rawContextData:JSON.stringify(d).substring(0,500)+"..."}),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Extracting changes from context:",{hasData:!!d,experimentCount:(null===(u=null==d?void 0:d.experiments)||void 0===u?void 0:u.length)||0}),null==d?void 0:d.experiments){this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Available experiments:",d.experiments.map(function(e){var t;return{name:e.name,hasVariants:!!e.variants,variantCount:(null===(t=e.variants)||void 0===t?void 0:t.length)||0}}));try{for(var h=i(d.experiments),p=h.next();!p.done;p=h.next()){var f=p.value,y=this.extractAllVariantsForExperiment(f);y.size>0?(g.set(f.name,y),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Experiment '".concat(f.name,"' has DOM changes:"),{variantsWithChanges:Array.from(y.keys()),changesByVariant:Array.from(y.entries()).map(function(e){var t=o(e,2),r=t[0],n=t[1];return{variant:r,changeCount:n.length,changeTypes:a([],o(new Set(n.map(function(e){return e.type}))),!1)}})})):this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Experiment '".concat(f.name,"' has no DOM changes"))}}catch(t){e={error:t}}finally{try{p&&!p.done&&(t=h.return)&&t.call(h)}finally{if(e)throw e.error}}}}catch(e){(0,l.logDebug)("[ABsmartly] Error extracting DOM changes:",e)}return this.cachedAllChanges=g,g},e.prototype.extractAllVariantsForExperiment=function(e){var t,r=new Map;if(this.debug&&(0,l.logDebug)("[DEBUG] Processing experiment: ".concat(e.name," with ").concat((null===(t=e.variants)||void 0===t?void 0:t.length)||0," variants")),!e.variants)return(0,l.logDebug)("[DEBUG] No variants found for experiment: ".concat(e.name)),r;for(var n=0;n<e.variants.length;n++){var i=e.variants[n];if(i){var o=null;if(i.config)try{var a="string"==typeof i.config?JSON.parse(i.config):i.config;(0,l.logDebug)("[VariantExtractor DEBUG] [".concat(e.name,"] Parsed config for variant ").concat(n,":"),a),a&&a[this.variableName]?(o=a[this.variableName],(0,l.logDebug)("[VariantExtractor DEBUG] [".concat(e.name,"] ✓ Found DOM changes in config[").concat(this.variableName,"]:"),o)):(0,l.logDebug)("[VariantExtractor DEBUG] [".concat(e.name,"] ✗ No ").concat(this.variableName," field found in parsed config for variant ").concat(n))}catch(t){(0,l.logDebug)("[VariantExtractor DEBUG] [".concat(e.name,"] ✗ Failed to parse variant.config for variant ").concat(n,":"),t,"Raw config:","string"==typeof i.config?i.config.substring(0,100):"")}else(0,l.logDebug)("[VariantExtractor DEBUG] [".concat(e.name,"] ✗ No config field found for variant ").concat(n));if(o){var s=this.extractChangesFromData(o);s&&s.length>0&&r.set(n,s)}}}return r},e.prototype.extractChangesFromData=function(e){if(!e)return null;if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return(0,l.logDebug)("[ABsmartly] Failed to parse DOM changes JSON:",e),null}if(e&&"object"==typeof e&&!Array.isArray(e)&&"changes"in e){var t=e;return this.parseChanges(t.changes)}return this.parseChanges(e)},e.prototype.getExperimentChanges=function(e){var t=this.extractAllChanges().get(e);if(!t||0===t.size)return null;var r=this.context.peek(e);return null==r?(this.debug&&(0,l.logDebug)("[ABsmartly] No variant selected for ".concat(e)),null):t.get(r)||null},e.prototype.parseChanges=function(e){var t,r;if(!e)return null;if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return(0,l.logDebug)("[ABsmartly] Failed to parse DOM changes JSON:",e),null}if(!Array.isArray(e))return this.debug&&(0,l.logDebug)("[ABsmartly] DOM changes data is not an array"),null;var n=[];try{for(var o=i(e),a=o.next();!a.done;a=o.next()){var s=a.value;this.isValidChange(s)?n.push(s):this.debug&&(0,l.logDebug)("[ABsmartly] Invalid DOM change:",s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return n.length>0?n:null},e.prototype.isValidChange=function(e){if(!e||"object"!=typeof e)return!1;var t=e;if(void 0===t.selector||null===t.selector||!t.type)return!1;if(!["text","html","style","class","attribute","javascript","move","create","delete","styleRules"].includes(t.type))return!1;switch(t.type){case"class":if(!t.add&&!t.remove)return!1;if(t.add&&!Array.isArray(t.add))return!1;if(t.remove&&!Array.isArray(t.remove))return!1;break;case"move":if(!t.targetSelector)return!1;break;case"create":if(!t.element||!t.targetSelector)return!1;break;case"style":case"attribute":if(!t.value||"object"!=typeof t.value)return!1}return!0},e.prototype.getAllVariantChanges=function(e){var t=this.extractAllChanges().get(e);if(!t)return[];for(var r=Math.max.apply(Math,a([],o(t.keys()),!1)),n=[],i=0;i<=r;i++)n.push(t.get(i)||[]);return n},e.prototype.getExperiment=function(e){try{var t=this.context.data();return t&&t.experiments&&t.experiments.find(function(t){return t.name===e})||null}catch(t){return this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Failed to get experiment '".concat(e,"' - context may not be ready:"),t),null}},e.prototype.getAllVariantsData=function(e){var t=new Map;try{var r=this.context.data();if(!(null==r?void 0:r.experiments))return t;var n=r.experiments.find(function(t){return t.name===e});if(!(null==n?void 0:n.variants))return t;for(var i=0;i<n.variants.length;i++){var o=n.variants[i];if(o){var a=null;if(o.variables&&o.variables[this.variableName])a=o.variables[this.variableName];else if(o.config)try{var s="string"==typeof o.config?JSON.parse(o.config):o.config;s&&s[this.variableName]&&(a=s[this.variableName])}catch(e){(0,l.logDebug)("[VariantExtractor] Failed to parse variant.config:",e)}if(a){if("string"==typeof a)try{a=JSON.parse(a)}catch(e){(0,l.logDebug)("[ABsmartly] Failed to parse DOM changes JSON:",e);continue}t.set(i,a)}else t.set(i,null)}}}catch(e){(0,l.logDebug)("[ABsmartly] Error getting all variants data:",e)}return t},e.prototype.anyVariantMatchesURL=function(e,t){var r,n;void 0===t&&(t=window.location.href);var a=this.getAllVariantsData(e),l=!1;try{for(var c=i(a),u=c.next();!u.done;u=c.next()){var g=o(u.value,2)[1];if(g&&"object"==typeof g&&!Array.isArray(g)&&"urlFilter"in g){var d=g;if(d.urlFilter&&(l=!0,s.URLMatcher.matches(d.urlFilter,t)))return!0}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}return!l},e.prototype.extractAllInjectHTML=function(){var e,t,r=new Map;try{var n=this.context.data();if(this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Extracting __inject_html from context"),null==n?void 0:n.experiments)try{for(var o=i(n.experiments),a=o.next();!a.done;a=o.next()){var s=a.value,c=this.extractInjectHTMLForExperiment(s);c.size>0&&(r.set(s.name,c),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Experiment '".concat(s.name,"' has HTML injections:"),{variantsWithInjections:Array.from(c.keys())}))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}catch(e){(0,l.logDebug)("[ABsmartly] Error extracting __inject_html:",e)}return r},e.prototype.extractInjectHTMLForExperiment=function(e){var t=new Map;if(!e.variants)return t;for(var r=0;r<e.variants.length;r++){var i=e.variants[r];if(i){var o=null;if(i.variables&&i.variables.__inject_html)o=i.variables.__inject_html,this.debug&&(0,l.logDebug)("[VariantExtractor] Found __inject_html in variables for ".concat(e.name," variant ").concat(r));else if(i.config)try{var a="string"==typeof i.config?JSON.parse(i.config):i.config;a&&a.__inject_html&&(o=a.__inject_html,this.debug&&(0,l.logDebug)("[VariantExtractor] Found __inject_html in config for ".concat(e.name," variant ").concat(r)))}catch(t){(0,l.logDebug)("[VariantExtractor] Failed to parse variant.config for ".concat(e.name," variant ").concat(r,":"),t)}if(o&&"object"==typeof o&&!Array.isArray(o)){var s=o,c=s.urlFilter,u=n(s,["urlFilter"]),g={data:u,urlFilter:c||void 0};t.set(r,g),this.debug&&(0,l.logDebug)("[VariantExtractor] Extracted __inject_html for ".concat(e.name," variant ").concat(r,":"),{keys:Object.keys(u),hasUrlFilter:!!c})}else o&&this.debug&&(0,l.logDebug)("[VariantExtractor] Invalid __inject_html format in ".concat(e.name," variant ").concat(r),o)}}return t},e}();t.VariantExtractor=c},481:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMPersistenceManager=void 0;var o=r(609),a=function(){function e(e){this.watchedElements=new WeakMap,this.persistenceObserver=null,this.reapplyingElements=new Set,this.reapplyLogThrottle=new Map,this.appliedChanges=new Map,this.config=e}return e.prototype.watchElement=function(e,t,r){var i,a,l=this.watchedElements.get(e);l||(l=new Set,this.watchedElements.set(e,l)),l.add(t),this.appliedChanges.has(t)||this.appliedChanges.set(t,[]);var s=this.appliedChanges.get(t);if(!s.includes(r)&&(s.push(r),this.config.debug)){var c={};if(r.value&&"object"==typeof r.value)try{for(var u=n(Object.keys(r.value)),g=u.next();!g.done;g=u.next()){var d=g.value.replace(/([A-Z])/g,"-$1").toLowerCase();c[d]=e.style.getPropertyValue(d)}}catch(e){i={error:e}}finally{try{g&&!g.done&&(a=u.return)&&a.call(u)}finally{if(i)throw i.error}}(0,o.logDebug)("[WATCH-ELEMENT] Started watching element for persistence",{experimentName:t,selector:r.selector,element:e.tagName,changeType:r.type,value:r.value,currentStyles:"style"===r.type?c:void 0,timestamp:Date.now()})}this.persistenceObserver||this.setupPersistenceObserver()},e.prototype.unwatchElement=function(e,t){var r=this.watchedElements.get(e);r&&(r.delete(t),0===r.size&&this.watchedElements.delete(e))},e.prototype.unwatchExperiment=function(e){this.appliedChanges.delete(e)},e.prototype.getAppliedChanges=function(){return this.appliedChanges},e.prototype.clearAll=function(){this.appliedChanges.clear()},e.prototype.destroy=function(){this.persistenceObserver&&(this.persistenceObserver.disconnect(),this.persistenceObserver=null),this.appliedChanges.clear(),this.reapplyingElements.clear(),this.reapplyLogThrottle.clear()},e.prototype.setupPersistenceObserver=function(){var e=this;this.persistenceObserver||(this.config.debug&&(0,o.logDebug)("[PERSISTENCE-OBSERVER] Setting up persistence observer",{timestamp:Date.now()}),this.persistenceObserver=new MutationObserver(function(t){var r,a;e.config.debug&&(0,o.logDebug)("[MUTATION-DETECTED] Persistence observer detected mutations",{mutationCount:t.length,timestamp:Date.now()});var l=function(t){var r,a,l,s,c,u,g,d,h=t.target;if(e.reapplyingElements.has(h))return e.config.debug&&(0,o.logDebug)("[MUTATION-SKIP] Skipping mutation - currently reapplying",{element:h.tagName}),"continue";var p=e.watchedElements.get(h);if(p){if(e.config.debug){var f="mutation:".concat(h.tagName,":").concat(h.getAttribute("name")||h.className);(_=Date.now())-(k=e.reapplyLogThrottle.get(f)||0)>5e3&&((0,o.logDebug)("[MUTATION-ON-WATCHED] Mutation detected on watched element",{element:h.tagName,attributeName:t.attributeName,oldValue:t.oldValue,experiments:Array.from(p)}),e.reapplyLogThrottle.set(f,_))}try{for(var y=(r=void 0,n(p)),v=y.next();!v.done;v=y.next()){var m=v.value,b=e.appliedChanges.get(m);if(b)try{for(var x=(l=void 0,n(b)),w=x.next();!w.done;w=x.next()){var E=w.value,S=!1;if("style"===E.type&&"style"===t.attributeName&&!1!==E.persistStyle)S=e.checkStyleOverwritten(h,E.value);else if("attribute"===E.type&&!1!==E.persistAttribute){if(E.value&&"object"==typeof E.value)try{for(var A=(c=void 0,n(Object.keys(E.value))),C=A.next();!C.done;C=A.next()){var D=C.value;if(t.attributeName===D){S=e.checkAttributeOverwritten(h,E.value);break}}}catch(e){c={error:e}}finally{try{C&&!C.done&&(u=A.return)&&u.call(A)}finally{if(c)throw c.error}}}else"javascript"===E.type&&!0===E.persistScript&&E.value&&"string"==typeof E.value&&(S="style"===t.attributeName||"class"===t.attributeName);if(S){e.reapplyingElements.add(h);var O="".concat(m,"-").concat(E.selector),_=Date.now(),k=e.reapplyLogThrottle.get(O)||0;if(e.config.debug&&_-k>5e3&&((0,o.logDebug)("[REAPPLY-TRIGGERED] Reapplying after mutation (React/framework conflict detected)",{experimentName:m,selector:E.selector,element:h.tagName,changeType:E.type,timestamp:_}),e.reapplyLogThrottle.set(O,_),e.reapplyLogThrottle.size>100)){var P=_-6e4;try{for(var M=(g=void 0,n(e.reapplyLogThrottle.entries())),L=M.next();!L.done;L=M.next()){var T=i(L.value,2),I=T[0];T[1]<P&&e.reapplyLogThrottle.delete(I)}}catch(e){g={error:e}}finally{try{L&&!L.done&&(d=M.return)&&d.call(M)}finally{if(g)throw g.error}}}try{e.config.onReapply(E,m)}catch(t){e.config.debug&&(0,o.logDebug)("[REAPPLY-ERROR] Error during change re-application",{experimentName:m,selector:E.selector,changeType:E.type,error:t instanceof Error?t.message:String(t)})}finally{setTimeout(function(){e.reapplyingElements.delete(h)},0)}}}}catch(e){l={error:e}}finally{try{w&&!w.done&&(s=x.return)&&s.call(x)}finally{if(l)throw l.error}}}}catch(e){r={error:e}}finally{try{v&&!v.done&&(a=y.return)&&a.call(y)}finally{if(r)throw r.error}}}};try{for(var s=n(t),c=s.next();!c.done;c=s.next()){l(c.value)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(a=s.return)&&a.call(s)}finally{if(r)throw r.error}}}),this.persistenceObserver.observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0}),this.config.debug&&(0,o.logDebug)("[PERSISTENCE-OBSERVER] Setup complete - now observing mutations",{target:"document.body",observedAttributes:"all (filtered in handler to style/class)",subtree:!0,timestamp:Date.now()}))},e.prototype.checkStyleOverwritten=function(e,t){var r,o;try{for(var a=n(Object.entries(t)),l=a.next();!l.done;l=a.next()){var s=i(l.value,2),c=s[0],u=s[1],g=c.replace(/([A-Z])/g,"-$1").toLowerCase(),d=e.style.getPropertyValue(g),h=e.style.getPropertyPriority(g);if(d!==u||u.includes("!important")&&!h)return!0}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return!1},e.prototype.checkAttributeOverwritten=function(e,t){var r,o;try{for(var a=n(Object.entries(t)),l=a.next();!l.done;l=a.next()){var s=i(l.value,2),c=s[0],u=s[1];if(e.getAttribute(c)!==u)return!0}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return!1},e}();t.DOMPersistenceManager=a},574:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},609:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},o=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.DEBUG=void 0,t.logDebug=l,t.logChangeApplication=function(e,r,n,i,o){if(t.DEBUG){l("".concat(o?"✓":"✗"," Applied ").concat(n," change to ").concat(i," element(s)"),{experimentName:e,selector:r,changeType:n,elementsCount:i,success:o})}},t.logChangeRemoval=function(e,r,n,i){if(t.DEBUG){l("Restored ".concat(i," element(s) to original state"),{experimentName:e,selector:r,changeType:n,elementsCount:i,action:"restore"})}},t.logExperimentSummary=function(e,r,n,i){if(t.DEBUG){l('Experiment "'.concat(e,'" summary'),{experimentName:e,totalChanges:r,successfulChanges:n,pendingChanges:i,successRate:r>0?"".concat(Math.round(n/r*100),"%"):"N/A"})}},t.logStateOperation=function(e,r,n,i){if(t.DEBUG){l("State ".concat(e," operation"),{operation:e,selector:r,changeType:n,experimentName:i})}},t.logVisibilityEvent=function(e,r,n){if(t.DEBUG){l(n?"Element became visible - experiment triggered":"Element visibility changed",{experimentName:e,selector:r.className||r.id||r.tagName,triggered:n,action:"visibility"})}},t.logMessage=function(e,r,n){if(t.DEBUG){l("Message ".concat(e,": ").concat(r),{direction:e,messageType:r,payload:n,bridge:"extension"})}},t.logPerformance=function(e,r,i){if(t.DEBUG){l("Performance: ".concat(e," took ").concat(r,"ms"),n({operation:e,duration:r,performance:!0},i))}},t.logProductionWarn=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];console.warn.apply(console,o([e],i(t),!1))};var a=r(834);function l(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(t.DEBUG)if(2===e.length&&"string"==typeof e[0]&&"object"==typeof e[1]){var n=i(e,2),a=n[0],l=n[1];if(a.includes("Original state already stored"))return;if(a.includes("State store operation"))return;if(a.includes("Performance:")&&(null==l?void 0:l.duration)&&l.duration<5)return;if(a.includes("Message sent:")||a.includes("Message received:"))return;var s=(new Date).toISOString(),c="[ABsmartly Debug]";console.log("".concat(c," [").concat(s,"] ").concat(a),l)}else if(1===e.length&&"string"==typeof e[0]){if((a=e[0]).includes("Original state already stored"))return;if(a.includes("State store operation"))return;if(a.includes("Message sent:")||a.includes("Message received:"))return;s=(new Date).toISOString(),c="[ABsmartly Debug]";console.log("".concat(c," [").concat(s,"] ").concat(a))}else console.log.apply(console,o([],i(e),!1))}t.DEBUG=a.BUILD_DEBUG},639:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},693:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StyleSheetManager=void 0;var n=r(609),i=function(){function e(e,t){void 0===t&&(t=!1),this.id=e,this.styleEl=null,this.rules=new Map,this.debug=t}return e.prototype.ensure=function(){if(!(this.styleEl&&document.head.contains(this.styleEl)||(this.styleEl=document.getElementById(this.id),this.styleEl))){var e=document.createElement("style");e.id=this.id,e.setAttribute("data-absmartly-styles","true"),document.head.appendChild(e),this.styleEl=e,this.debug&&(0,n.logDebug)("[ABsmartly] Created stylesheet: ".concat(this.id))}return this.styleEl},e.prototype.setRule=function(e,t){this.rules.set(e,t),this.render(),this.debug&&(0,n.logDebug)("[ABsmartly] Set CSS rule for ".concat(e))},e.prototype.deleteRule=function(e){this.rules.delete(e)&&(this.render(),this.debug&&(0,n.logDebug)("[ABsmartly] Deleted CSS rule for ".concat(e)))},e.prototype.hasRule=function(e){return this.rules.has(e)},e.prototype.clear=function(){var e=this.rules.size>0;this.rules.clear(),e&&(this.render(),this.debug&&(0,n.logDebug)("[ABsmartly] Cleared all CSS rules from ".concat(this.id)))},e.prototype.destroy=function(){this.clear(),this.styleEl&&document.head.contains(this.styleEl)&&(this.styleEl.remove(),this.styleEl=null,this.debug&&(0,n.logDebug)("[ABsmartly] Destroyed stylesheet: ".concat(this.id)))},e.prototype.render=function(){var e=this.ensure(),t=Array.from(this.rules.values()).join("\n\n");e.textContent=t},e.prototype.getRulesCount=function(){return this.rules.size},e.prototype.getCssText=function(){return Array.from(this.rules.values()).join("\n\n")},e}();t.StyleSheetManager=i},702:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},l=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMChangesPluginLite=void 0;var s=r(964),c=r(356),u=r(693),g=r(713),d=r(253),h=r(609),p=r(973),f=r(481),y=r(943),v=r(834),m=function(){function e(t){var r,n,i,o,a,l,u,p,y=this;if(this.mutationObserver=null,this.exposedExperiments=new Set,this.eventListeners=new Map,this.styleManagers=new Map,this.initialized=!1,this.persistenceManager=null,this.antiFlickerTimeout=null,this.antiFlickerStyleId="absmartly-antiflicker",this.originalPushState=null,this.originalReplaceState=null,this.popstateHandler=null,this.config={context:t.context,autoApply:null===(r=t.autoApply)||void 0===r||r,spa:null===(n=t.spa)||void 0===n||n,visibilityTracking:null===(i=t.visibilityTracking)||void 0===i||i,variableName:null!==(o=t.variableName)&&void 0!==o?o:"__dom_changes",debug:null!==(a=t.debug)&&void 0!==a&&a,hideUntilReady:null!==(l=t.hideUntilReady)&&void 0!==l&&l,hideTimeout:null!==(u=t.hideTimeout)&&void 0!==u?u:3e3,hideTransition:null!==(p=t.hideTransition)&&void 0!==p&&p},!this.config.context)throw new Error("[ABsmartly] Context is required");console.log("[ABsmartly] DOMChangesPluginLite v".concat(e.VERSION," initialized")),this.registerWithContext(!1),this.registerGlobally(!1),this.config.hideUntilReady&&this.hideContent(),this.domManipulator=new s.DOMManipulatorLite(this.config.debug,this),this.variantExtractor=new c.VariantExtractor(this.config.context,this.config.variableName,this.config.debug),this.exposureTracker=new g.ExposureTracker(this.config.context,this.config.debug),this.htmlInjector=new d.HTMLInjector(this.config.debug),this.persistenceManager=new f.DOMPersistenceManager({debug:this.config.debug,onReapply:function(e,t){(0,h.logDebug)("[DOMChangesPluginLite] Re-applying change due to mutation",{experimentName:t,selector:e.selector,type:e.type}),y.domManipulator.applyChange(e,t)}}),this.readyPromise=this.config.context.ready().then(function(){return(0,h.logDebug)("[DOMChangesPluginLite] Context is ready, starting initialization"),y.initialize()}).catch(function(e){throw(0,h.logDebug)("[DOMChangesPluginLite] ERROR during initialization:",e),e})}return e.prototype.ready=function(){return i(this,void 0,void 0,function(){return o(this,function(e){return[2,this.readyPromise]})})},e.prototype.initialize=function(){return i(this,void 0,void 0,function(){var t,r,n;return o(this,function(i){switch(i.label){case 0:if(this.initialized)return(0,h.logDebug)("Plugin already initialized"),[2];t=performance.now(),(0,h.logDebug)("Initializing ABsmartly DOM Changes Plugin Lite",{version:e.VERSION,config:{autoApply:this.config.autoApply,spa:this.config.spa,visibilityTracking:this.config.visibilityTracking,DEBUG:h.DEBUG}}),i.label=1;case 1:return i.trys.push([1,4,,5]),this.config.spa?(this.setupMutationObserver(),this.setupURLChangeListener()):(0,h.logDebug)("[DOMChangesPluginLite] SPA mode disabled - skipping body observer"),this.config.autoApply?[4,this.applyInjectionsAndChanges()]:[3,3];case 2:i.sent(),i.label=3;case 3:return this.initialized=!0,this.registerWithContext(),this.registerGlobally(),this.emit("initialized"),r=performance.now()-t,(0,h.logPerformance)("Plugin initialization",r),(0,h.logDebug)("[ABsmartly] DOM plugin lite loaded successfully (v".concat(e.VERSION,")")),this.config.debug&&(0,h.logDebug)("[ABsmartly] DOM Changes Plugin Lite initialized with debug mode"),[3,5];case 4:throw n=i.sent(),(0,h.logDebug)("[ABsmartly] Failed to initialize plugin:",n),this.emit("error",{type:"initialization_error",error:(null==n?void 0:n.message)||String(n)}),n;case 5:return[2]}})})},e.prototype.setupMutationObserver=function(){var e=this,t=new MutationObserver(function(t){var r,n,i,o,s,c,u,g,d,p,f;try{for(var y=a(t),v=y.next();!v.done;v=y.next()){var m=v.value;if("childList"===m.type)try{for(var b=(i=void 0,a(m.addedNodes)),x=b.next();!x.done;x=b.next()){var w=x.value;if(w.nodeType===Node.ELEMENT_NODE){var E=w,S=(null===(f=e.persistenceManager)||void 0===f?void 0:f.getAppliedChanges())||new Map;try{for(var A=(s=void 0,a(S)),C=A.next();!C.done;C=A.next()){var D=l(C.value,2),O=D[0],_=D[1];try{for(var k=(u=void 0,a(_)),P=k.next();!P.done;P=k.next()){var M=P.value;try{var L=E.matches(M.selector)?[E]:Array.from(E.querySelectorAll(M.selector));try{for(var T=(d=void 0,a(L)),I=T.next();!I.done;I=T.next()){var N=I.value;e.config.debug&&(0,h.logDebug)("[SPA-REAPPLY] Re-applying change to newly added element (React hydration recovery)",{experimentName:O,selector:M.selector,element:N.tagName,changeType:M.type}),e.domManipulator.applyChange(M,O)}}catch(e){d={error:e}}finally{try{I&&!I.done&&(p=T.return)&&p.call(T)}finally{if(d)throw d.error}}}catch(e){}}}catch(e){u={error:e}}finally{try{P&&!P.done&&(g=k.return)&&g.call(k)}finally{if(u)throw u.error}}}}catch(e){s={error:e}}finally{try{C&&!C.done&&(c=A.return)&&c.call(A)}finally{if(s)throw s.error}}}}}catch(e){i={error:e}}finally{try{x&&!x.done&&(o=b.return)&&o.call(b)}finally{if(i)throw i.error}}}}catch(e){r={error:e}}finally{try{v&&!v.done&&(n=y.return)&&n.call(y)}finally{if(r)throw r.error}}}),r=function(){t.observe(document.body,{childList:!0,subtree:!0}),e.mutationObserver=t,(0,h.logDebug)("[DOMChangesPluginLite] MutationObserver started on document.body")};document.body?r():(new MutationObserver(function(e,t){document.body&&(t.disconnect(),r())}).observe(document.documentElement,{childList:!0}),(0,h.logDebug)("[DOMChangesPluginLite] Waiting for document.body..."))},e.prototype.setupURLChangeListener=function(){var e=this,t=function(){return i(e,void 0,void 0,function(){var e;return o(this,function(t){switch(t.label){case 0:return e=window.location.href,(0,h.logDebug)("[ABsmartly] URL changed, re-evaluating experiments:",e),[4,this.removeAllChanges()];case 1:return t.sent(),[4,this.applyInjectionsAndChanges()];case 2:return t.sent(),[2]}})})};this.popstateHandler=t,window.addEventListener("popstate",this.popstateHandler),this.originalPushState=history.pushState,this.originalReplaceState=history.replaceState;var r=this;history.pushState=function(e,n,i){r.originalPushState&&r.originalPushState.call(history,e,n,i),t()},history.replaceState=function(e,n,i){r.originalReplaceState&&r.originalReplaceState.call(history,e,n,i),t()},this.config.debug&&(0,h.logDebug)("[ABsmartly] URL change listener set up for SPA mode")},e.prototype.removeAllChanges=function(){return i(this,void 0,void 0,function(){return o(this,function(e){return this.exposedExperiments.clear(),this.styleManagers.clear(),this.persistenceManager&&this.persistenceManager.clearAll(),this.htmlInjector.destroy(),this.variantExtractor.clearCache(),this.config.debug&&(0,h.logDebug)("[ABsmartly] All change tracking cleared for URL change"),[2]})})},e.prototype.applyInjectionsAndChanges=function(){return i(this,void 0,void 0,function(){var e,t,r,n,i;return o(this,function(o){switch(o.label){case 0:e=performance.now(),t=window.location.href,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.config.context.ready()];case 2:return o.sent(),[3,4];case 3:return r=o.sent(),(0,h.logDebug)("[ABsmartly] Failed to wait for context ready:",r),[2];case 4:return n=this.variantExtractor.extractAllInjectHTML(),[4,Promise.all([this.applyHTMLInjections(n,t),this.applyChanges()])];case 5:return o.sent(),i=performance.now()-e,(0,h.logPerformance)("Apply injections and changes (parallel)",i),this.config.debug&&(0,h.logDebug)("[ABsmartly] HTML injections and DOM changes applied in parallel",{duration:"".concat(i.toFixed(2),"ms"),currentURL:t}),[2]}})})},e.prototype.applyHTMLInjections=function(e){return i(this,arguments,void 0,function(e,t){var r;return void 0===t&&(t=window.location.href),o(this,function(n){return 0===e.size?(this.config.debug&&(0,h.logDebug)("[ABsmartly] No HTML injections found"),[2]):(r=this.htmlInjector.collectInjections(e,t),this.htmlInjector.inject(r),this.config.debug&&(0,h.logDebug)("[ABsmartly] HTML injections complete",{experimentsWithInjections:e.size,totalLocations:r.size,currentUrl:t}),[2])})})},e.prototype.applyChanges=function(e){return i(this,void 0,void 0,function(){var t,r,n,i,s,c,u,g,d,f,y,v,m,b,x,w,E,S,A,C,D,O,_,k,P,M,L,T,I,N,j,R,U,B,V,F,G,z,H,W,q,J,Y,X,Q,K,$,Z,ee,te,re,ne,ie;return o(this,function(o){switch(o.label){case 0:t=performance.now(),r=window.location.href,(0,h.logDebug)("Starting to apply changes",{specificExperiment:e||"all",url:r,action:"apply_start"}),this.config.debug&&((0,h.logDebug)("[ABsmartly] === DOM Changes Application Starting ==="),(0,h.logDebug)("[ABsmartly] Target:",e||"all experiments"),(0,h.logDebug)("[ABsmartly] Current URL:",r),(0,h.logDebug)("[ABsmartly] Context ready:",!0)),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.config.context.ready()];case 2:return o.sent(),[3,4];case 3:return n=o.sent(),(0,h.logDebug)("[ABsmartly] Failed to wait for context ready:",n),[2];case 4:this.variantExtractor.clearCache(),i=this.getAllExperimentsData(),s=0,c=new Map,(0,h.logDebug)("[APPLY-CHANGES] Experiments found with DOM changes:",{experimentNames:Array.from(i.keys()),totalCount:i.size,currentURL:r}),0===i.size&&(0,h.logDebug)("[APPLY-CHANGES] ⚠️ No experiments found with DOM changes - nothing to process");try{for(u=a(i),g=u.next();!g.done;g=u.next())if(d=l(g.value,2),f=d[0],y=d[1],(0,h.logDebug)("[APPLY-CHANGES] [".concat(f,"] Starting to process experiment"),{experimentName:f,currentURL:r}),e&&f!==e)(0,h.logDebug)("[APPLY-CHANGES] [".concat(f,"] ⏭️ Skipping - filtering for different experiment"),{filteringFor:e});else if(null!=(v=this.config.context.peek(f)))if((0,h.logDebug)("[APPLY-CHANGES] [".concat(f,"] User assigned to variant ").concat(v)),m=y.variantData,b=y.urlFilter,x=y.globalDefaults,this.variantExtractor.anyVariantMatchesURL(f,r))if((0,h.logDebug)("[APPLY-CHANGES] [".concat(f,"] ✓ At least one variant matches current URL")),w=this.shouldApplyVisualChanges(m,b,r),E=this.extractChangesFromData(m,x),S=this.extractAllVariantChanges(f),A=S.some(function(e){return e&&e.length>0}),A){if(C={total:(null==E?void 0:E.length)||0,success:0,pending:0},this.config.debug&&(0,h.logDebug)("[ABsmartly] Processing experiment '".concat(f,"' - User is in variant ").concat(v,":"),{experimentName:f,userVariant:v,urlMatches:w,changeCount:(null==E?void 0:E.length)||0,userVariantHasChanges:((null==E?void 0:E.length)||0)>0,changes:(null==E?void 0:E.map(function(e){return{type:e.type,selector:e.selector,trigger:e.trigger_on_view?"viewport":"immediate"}}))||[]}),E&&0!==E.length||this.config.debug&&(0,h.logDebug)("[ABsmartly] User is in control variant ".concat(v," with no changes, but will still track for SRM prevention"),{experimentName:f,currentVariant:v}),w&&E&&E.length>0)try{for(K=void 0,D=a(E),O=D.next();!O.done;O=D.next())if("delete"===(J=O.value).type&&J.trigger_on_view)this.config.debug&&(0,h.logDebug)("[ABsmartly] Deferring delete change until after viewport trigger for '".concat(f,"'"),{selector:J.selector});else if(this.domManipulator.applyChange(J,f))s++,C.success++;else if("create"!==J.type&&"styleRules"!==J.type)try{0===document.querySelectorAll(J.selector).length&&(this.config.spa||J.waitForElement)&&C.pending++}catch(e){this.config.debug&&(0,h.logDebug)("[ABsmartly] Invalid selector: ".concat(J.selector),e)}}catch(e){K={error:e}}finally{try{O&&!O.done&&($=D.return)&&$.call(D)}finally{if(K)throw K.error}}else E&&E.length>0&&(0,h.logDebug)("[ABsmartly] Experiment '".concat(f,"' variant ").concat(v," doesn't match URL filter or has no changes, but setting up tracking for SRM prevention"));if(_=!1,k=!1,P=this.variantExtractor.getAllVariantsData(f),this.config.debug){(0,h.logDebug)("[ABsmartly] Checking trigger types for experiment '".concat(f,"' on URL: ").concat(r),{allVariantsDataSize:P.size,allVariantChangesLength:S.length});try{for(Z=void 0,M=a(P),L=M.next();!L.done;L=M.next())T=l(L.value,2),I=T[0],N=T[1],(0,h.logDebug)("[ABsmartly] Variant ".concat(I," data structure:"),{isArray:Array.isArray(N),isObject:"object"==typeof N,hasUrlFilter:N&&"object"==typeof N&&!Array.isArray(N)&&"urlFilter"in N,keys:N&&"object"==typeof N&&!Array.isArray(N)?Object.keys(N):"N/A"})}catch(e){Z={error:e}}finally{try{L&&!L.done&&(ee=M.return)&&ee.call(M)}finally{if(Z)throw Z.error}}}try{for(te=void 0,j=a(P),R=j.next();!R.done;R=j.next())if(U=l(R.value,2),B=U[0],V=U[1],(F=S[B])&&0!==F.length){if(G=!0,V&&"object"==typeof V&&!Array.isArray(V)&&"urlFilter"in(z=V)&&z.urlFilter&&(H=z,G=p.URLMatcher.matches(H.urlFilter,r),this.config.debug&&(0,h.logDebug)("[ABsmartly] Variant ".concat(B," has URL filter, matches: ").concat(G))),G){try{for(ne=void 0,W=a(F),q=W.next();!q.done&&((J=q.value).trigger_on_view?_=!0:k=!0,!_||!k);q=W.next());}catch(e){ne={error:e}}finally{try{q&&!q.done&&(ie=W.return)&&ie.call(W)}finally{if(ne)throw ne.error}}this.config.debug&&(0,h.logDebug)("[ABsmartly] Variant ".concat(B," matches URL - hasImmediate: ").concat(k,", hasViewport: ").concat(_))}else this.config.debug&&(0,h.logDebug)("[ABsmartly] Variant ".concat(B," does NOT match URL - skipping"));if(_&&k)break}}catch(e){te={error:e}}finally{try{R&&!R.done&&(re=j.return)&&re.call(j)}finally{if(te)throw te.error}}this.config.debug&&(0,h.logDebug)("[TRIGGER-DETECTION] [".concat(f,"] Final trigger decision for '").concat(f,"':"),{experimentName:f,userVariant:v,hasImmediateTrigger:k,hasViewportTrigger:_,willRegisterExperiment:_||k,userChangesCount:(null==E?void 0:E.length)||0,allVariantsChangesCount:S.map(function(e){return e.length})}),_||k?((0,h.logDebug)("[TRIGGER-DETECTION] [".concat(f,"] ✓ REGISTERING EXPERIMENT - Calling exposureTracker.registerExperiment()"),{experimentName:f,userVariant:v,hasImmediateTrigger:k,hasViewportTrigger:_,changesForUser:(null==E?void 0:E.length)||0,allVariantCounts:S.map(function(e,t){return{variant:t,count:e.length}})}),this.exposureTracker.registerExperiment(f,v||0,E||[],S,k,_)):(0,h.logDebug)("[TRIGGER-DETECTION] [".concat(f,"] ⚠️ No triggers detected - experiment will NOT be registered!"),{experimentName:f,userVariant:v,hasAnyChangesInAnyVariant:A,allVariantsChangesCount:S.map(function(e){return e.length})}),c.set(f,C),(0,h.logExperimentSummary)(f,C.total,C.success,C.pending)}else this.config.debug&&(0,h.logDebug)("[ABsmartly] Skipping experiment '".concat(f,"' - no variants have changes"));else(0,h.logDebug)("[APPLY-CHANGES] [".concat(f,"] ⏭️ Skipping - no variant matches URL: ").concat(r),{experimentName:f,currentURL:r});else(0,h.logDebug)("[APPLY-CHANGES] [".concat(f,"] ⏭️ Skipping - no variant assigned (peek returned ").concat(v,")"),{experimentName:f})}catch(e){X={error:e}}finally{try{g&&!g.done&&(Q=u.return)&&Q.call(u)}finally{if(X)throw X.error}}return Y=performance.now()-t,(0,h.logPerformance)("Apply changes",Y,{totalApplied:s,experiments:c.size}),this.config.debug&&((0,h.logDebug)("[ABsmartly] === DOM Changes Application Complete ==="),(0,h.logDebug)("[ABsmartly] Summary:",{totalChangesApplied:s,experimentsProcessed:c.size,duration:"".concat(Y.toFixed(2),"ms"),experiments:Array.from(c.entries()).map(function(e){var t=l(e,2),r=t[0],n=t[1];return{name:r,total:n.total,success:n.success,pending:n.pending,pendingReason:n.pending>0?"Elements not found yet (SPA mode will retry)":void 0}})})),this.config.hideUntilReady&&this.showContent(),(0,h.logDebug)("[ABsmartly] DOM changes applied"),this.emit("changes-applied",{count:s,experimentName:e}),[2]}})})},e.prototype.getAllExperimentsData=function(){var e,t,r=new Map,n=this.variantExtractor.extractAllChanges();(0,h.logDebug)("[GET-EXPERIMENTS] Extracting experiment data from context",{experimentsWithChanges:Array.from(n.keys()),totalCount:n.size});try{for(var i=a(n),o=i.next();!o.done;o=i.next()){var s=l(o.value,1)[0],c=this.config.context.peek(s);if((0,h.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] Checking experiment"),{experimentName:s,currentVariant:c,variantIsValid:null!=c}),null!=c){var u=this.variantExtractor.getAllVariantsData(s),g=u.get(c);this.config.debug&&(0,h.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] Variant data lookup:"),{experimentName:s,userVariant:c,variantDataExists:!!g,allVariantsInMap:Array.from(u.keys()),userVariantInMap:u.has(c)}),g||(0,h.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] ⚠️ User's variant ").concat(c," has no DOM changes (control variant)"),{availableVariants:Array.from(u.keys()),note:"Will still track for SRM prevention"}),(0,h.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] ✓ Including experiment (variant ").concat(c,")"));var d=null,p={};if(g&&"object"==typeof g&&!Array.isArray(g)&&"changes"in g){var f=g;d=f.urlFilter,p={waitForElement:f.waitForElement,persistStyle:f.persistStyle,persistAttribute:f.persistAttribute,persistScript:f.persistScript,important:f.important,observerRoot:f.observerRoot}}r.set(s,{variantData:g,urlFilter:d,globalDefaults:p})}else(0,h.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] ⏭️ Skipping - context.peek() returned ").concat(c))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return r},e.prototype.extractChangesFromData=function(e,t){if(!e)return null;var r=null;return Array.isArray(e)?r=e:"object"==typeof e&&"changes"in e&&(r=e.changes),r&&0!==r.length?r.map(function(e){var r,i,o,a,l,s;return n(n({},e),{waitForElement:null!==(r=e.waitForElement)&&void 0!==r?r:t.waitForElement,persistStyle:null!==(i=e.persistStyle)&&void 0!==i?i:t.persistStyle,persistAttribute:null!==(o=e.persistAttribute)&&void 0!==o?o:t.persistAttribute,persistScript:null!==(a=e.persistScript)&&void 0!==a?a:t.persistScript,important:null!==(l=e.important)&&void 0!==l?l:t.important,observerRoot:null!==(s=e.observerRoot)&&void 0!==s?s:t.observerRoot})}):null},e.prototype.extractAllVariantChanges=function(e){for(var t=this.variantExtractor.getAllVariantChanges(e),r=this.variantExtractor.getAllVariantsData(e),i=[],o=function(e){var o=t[e],a=r.get(e);if(!o||0===o.length)return i.push([]),"continue";var l={};if(a&&"object"==typeof a&&!Array.isArray(a)&&"changes"in a){var s=a;l={waitForElement:s.waitForElement,persistStyle:s.persistStyle,persistAttribute:s.persistAttribute,persistScript:s.persistScript,important:s.important,observerRoot:s.observerRoot}}var c=o.map(function(e){var t,r,i,o,a,s;return n(n({},e),{waitForElement:null!==(t=e.waitForElement)&&void 0!==t?t:l.waitForElement,persistStyle:null!==(r=e.persistStyle)&&void 0!==r?r:l.persistStyle,persistAttribute:null!==(i=e.persistAttribute)&&void 0!==i?i:l.persistAttribute,persistScript:null!==(o=e.persistScript)&&void 0!==o?o:l.persistScript,important:null!==(a=e.important)&&void 0!==a?a:l.important,observerRoot:null!==(s=e.observerRoot)&&void 0!==s?s:l.observerRoot})});i.push(c)},a=0;a<t.length;a++)o(a);return i},e.prototype.shouldApplyVisualChanges=function(e,t,r){return!!e&&(!!Array.isArray(e)||(!t||p.URLMatcher.matches(t,r)))},e.prototype.hasChanges=function(e){return this.domManipulator.hasChanges(e)},e.prototype.applyChange=function(e,t){(0,h.logDebug)("Applying single change via public API",{experimentName:t,selector:e.selector,changeType:e.type});try{var r=this.domManipulator.applyChange(e,t);return r?this.emit("change_applied",{experimentName:t,change:e}):this.emit("change_failed",{experimentName:t,change:e,reason:"selector_not_found_or_apply_failed"}),r}catch(r){return(0,h.logDebug)("[ABsmartly] Error applying change:",r),this.emit("error",{type:"change_apply_error",experimentName:t,change:e,error:(null==r?void 0:r.message)||String(r)}),!1}},e.prototype.on=function(e,t){var r=this.eventListeners.get(e)||[];r.push(t),this.eventListeners.set(e,r)},e.prototype.off=function(e,t){if(t){var r=this.eventListeners.get(e)||[],n=r.indexOf(t);-1!==n&&r.splice(n,1)}else this.eventListeners.delete(e)},e.prototype.emit=function(e,t){var r,n,i=this.eventListeners.get(e)||[];try{for(var o=a(i),l=o.next();!l.done;l=o.next()){var s=l.value;try{s(t)}catch(t){(0,h.logDebug)("[ABsmartly] Error in event listener for ".concat(e,":"),t)}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},e.prototype.getStyleManager=function(e){var t="absmartly-styles-".concat(e),r=this.styleManagers.get(e);return r||(r=new u.StyleSheetManager(t,this.config.debug),this.styleManagers.set(e,r)),r},e.prototype.buildCssRule=function(e,t,r){void 0===r&&(r=!0);var n=Object.entries(t).map(function(e){var t=l(e,2),n=t[0],i=t[1],o=n.replace(/([A-Z])/g,"-$1").toLowerCase(),a=r?" !important":"";return" ".concat(o,": ").concat(i).concat(a,";")}).join("\n");return"".concat(e," {\n").concat(n,"\n}")},e.prototype.buildStateRules=function(e,t,r){void 0===r&&(r=!0);var n=[];return t.normal&&n.push(this.buildCssRule(e,t.normal,r)),t.hover&&n.push(this.buildCssRule("".concat(e,":hover"),t.hover,r)),t.active&&n.push(this.buildCssRule("".concat(e,":active"),t.active,r)),t.focus&&n.push(this.buildCssRule("".concat(e,":focus"),t.focus,r)),n.join("\n\n")},e.prototype.refreshExperiments=function(){this.config.debug&&(0,h.logDebug)("[ABsmartly] Refreshing experiments and clearing cache"),this.variantExtractor.clearCache(),this.config.autoApply&&this.applyInjectionsAndChanges()},e.prototype.destroy=function(){var e,t;this.domManipulator.destroy(),this.exposureTracker.destroy(),this.htmlInjector.destroy();try{for(var r=a(this.styleManagers.values()),n=r.next();!n.done;n=r.next()){n.value.destroy()}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.styleManagers.clear(),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.persistenceManager&&(this.persistenceManager.destroy(),this.persistenceManager=null),null!==this.antiFlickerTimeout&&(clearTimeout(this.antiFlickerTimeout),this.antiFlickerTimeout=null);var i=document.getElementById(this.antiFlickerStyleId);i&&i.remove(),this.originalPushState&&(history.pushState=this.originalPushState),this.originalReplaceState&&(history.replaceState=this.originalReplaceState),this.popstateHandler&&(window.removeEventListener("popstate",this.popstateHandler),this.popstateHandler=null),this.eventListeners.clear(),this.exposedExperiments.clear(),this.unregisterFromContext(),this.unregisterGlobally(),this.initialized=!1,this.config.debug&&(0,h.logDebug)("[ABsmartly] DOM Changes Plugin Lite destroyed")},e.prototype.registerWithContext=function(t){void 0===t&&(t=!0),this.config.context&&(this.config.context.__plugins||(this.config.context.__plugins={}),this.config.context.__plugins.domPlugin={name:"DOMChangesPluginLite",version:e.VERSION,initialized:t,capabilities:["spa","visibility"],instance:this,timestamp:Date.now()},this.config.context.__domPlugin=this.config.context.__plugins.domPlugin,this.config.debug&&(0,h.logDebug)("[ABsmartly] DOMChangesPluginLite registered with context at __plugins.domPlugin (initialized=".concat(t,")")))},e.prototype.unregisterFromContext=function(){var e;this.config.context&&((null===(e=this.config.context.__plugins)||void 0===e?void 0:e.domPlugin)&&delete this.config.context.__plugins.domPlugin,this.config.context.__domPlugin&&delete this.config.context.__domPlugin,this.config.debug&&(0,h.logDebug)("[ABsmartly] DOMChangesPluginLite unregistered from context"))},e.prototype.registerGlobally=function(t){void 0===t&&(t=!0),(0,y.registerPlugin)("dom",{name:"DOMChangesPluginLite",version:e.VERSION,initialized:t,timestamp:Date.now(),capabilities:["spa","visibility","auto-apply"],instance:this}),this.config.debug&&(0,h.logDebug)("[ABsmartly] DOMChangesPluginLite registered in global window.__ABSMARTLY_PLUGINS__ (initialized=".concat(t,")"))},e.prototype.unregisterGlobally=function(){(0,y.unregisterPlugin)("dom"),this.config.debug&&(0,h.logDebug)("[ABsmartly] DOMChangesPluginLite unregistered from global registry")},e.prototype.hideContent=function(){var e=this,t=this.config.hideUntilReady;if(t&&!document.getElementById(this.antiFlickerStyleId)){var r=document.createElement("style");r.id=this.antiFlickerStyleId;var n=!1!==this.config.hideTransition;r.textContent="\n ".concat(t,n?" {\n visibility: hidden !important;\n opacity: 0 !important;\n }\n ":" {\n visibility: hidden !important;\n }\n "),document.head.appendChild(r),this.antiFlickerTimeout=window.setTimeout(function(){e.config.debug&&(0,h.logDebug)("[ABsmartly] Anti-flicker timeout reached (".concat(e.config.hideTimeout,"ms), showing content")),e.showContent()},this.config.hideTimeout),this.config.debug&&(0,h.logDebug)("[ABsmartly] Anti-flicker enabled (selector: '".concat(t,"', transition: ").concat(n?this.config.hideTransition:"none",", timeout: ").concat(this.config.hideTimeout,"ms)"))}},e.prototype.showContent=function(){var e=this;null!==this.antiFlickerTimeout&&(clearTimeout(this.antiFlickerTimeout),this.antiFlickerTimeout=null);var t=document.getElementById(this.antiFlickerStyleId);if(t)if(!1!==this.config.hideTransition){var r=this.config.hideUntilReady;t.textContent="\n ".concat(r," {\n opacity: 0 !important;\n transition: opacity ").concat(this.config.hideTransition," !important;\n }\n "),t.offsetHeight,t.textContent="\n ".concat(r," {\n opacity: 1 !important;\n transition: opacity ").concat(this.config.hideTransition," !important;\n }\n ");var n=1e3*parseFloat(this.config.hideTransition);setTimeout(function(){t.remove(),e.config.debug&&(0,h.logDebug)("[ABsmartly] Anti-flicker fade-in complete, style removed")},n),this.config.debug&&(0,h.logDebug)("[ABsmartly] Anti-flicker fading in with transition: ".concat(this.config.hideTransition))}else t.remove(),this.config.debug&&(0,h.logDebug)("[ABsmartly] Anti-flicker removed, content now visible")},e.prototype.watchElement=function(e,t,r){this.persistenceManager&&this.persistenceManager.watchElement(e,t,r)},e.prototype.unwatchElement=function(e,t){this.persistenceManager&&this.persistenceManager.unwatchElement(e,t)},e.VERSION=v.BUILD_VERSION,e}();t.DOMChangesPluginLite=m},713:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},a=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},l=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.ExposureTracker=void 0;var s=r(609),c=function(){function e(e,t){void 0===t&&(t=!1),this.context=e,this.experiments=new Map,this.trackedElements=new Map,this.mutationObserver=null,this.placeholders=new Map,this.debug=t,this.setupIntersectionObserver()}return e.prototype.registerExperiment=function(e,t,r,n,i,c){var u,g,d,h,p,f,y,v;this.debug&&(0,s.logDebug)("[EXPOSURE] [".concat(e,"] Registering experiment for exposure tracking"),{experimentName:e,currentVariant:t,hasImmediateTrigger:i,hasViewportTrigger:c,currentChangesCount:r.length,allVariantsCount:n.length,currentChangeTypes:r.map(function(e){return{type:e.type,selector:e.selector,trigger_on_view:e.trigger_on_view||!1}})});var m=new Set,b=new Set,x=new Map,w=new Set;try{for(var E=o(n),S=E.next();!S.done;S=E.next()){var A=S.value;try{for(var C=(d=void 0,o(A)),D=C.next();!D.done;D=C.next()){var O=D.value;O.trigger_on_view&&("move"===O.type?(x.has(O.selector)||x.set(O.selector,new Set),O.targetSelector&&x.get(O.selector).add(O.targetSelector)):"delete"===O.type?w.add(O.selector):m.add(O.selector))}}catch(e){d={error:e}}finally{try{D&&!D.done&&(h=C.return)&&h.call(C)}finally{if(d)throw d.error}}}}catch(e){u={error:e}}finally{try{S&&!S.done&&(g=E.return)&&g.call(E)}finally{if(u)throw u.error}}var _=function(r){for(var i,a,l=[],s=0;s<n.length;s++){var c=n[s].find(function(e){return"move"===e.type&&e.selector===r&&e.trigger_on_view});(null==c?void 0:c.targetSelector)&&l.push({targetSelector:c.targetSelector,position:c.position||"lastChild",variantIndex:s})}var u=l.findIndex(function(e){return e.variantIndex===t});if(u>=0){m.add(r);for(var g=0;g<l.length;g++){var d=l[g];g!==u&&k.createContainerPlaceholder(e,r,d.targetSelector,d.position)}}else{m.add(r);try{for(var h=(i=void 0,o(l)),p=h.next();!p.done;p=h.next()){d=p.value;k.createContainerPlaceholder(e,r,d.targetSelector,d.position)}}catch(e){i={error:e}}finally{try{p&&!p.done&&(a=h.return)&&a.call(h)}finally{if(i)throw i.error}}}},k=this;try{for(var P=o(x),M=P.next();!M.done;M=P.next()){_(a(M.value,1)[0])}}catch(e){p={error:e}}finally{try{M&&!M.done&&(f=P.return)&&f.call(P)}finally{if(p)throw p.error}}var L=function(t){r.some(function(e){return"delete"===e.type&&e.selector===t&&e.trigger_on_view})?0===T.createInPlacePlaceholder(e,t)&&(m.add(t),T.debug&&(0,s.logDebug)("[EXPOSURE] [".concat(e,"] Delete element doesn't exist yet - tracking selector for when it appears"),{selector:t})):m.add(t)},T=this;try{for(var I=o(w),N=I.next();!N.done;N=I.next()){L(N.value)}}catch(e){y={error:e}}finally{try{N&&!N.done&&(v=I.return)&&v.call(I)}finally{if(y)throw y.error}}var j={experimentName:e,variant:t,changes:r,allPossibleSelectors:new Set(l(l([],a(m),!1),a(b),!1)),triggered:!1,hasImmediateTrigger:i,hasViewportTrigger:c};this.experiments.set(e,j),this.debug&&(0,s.logDebug)("[ABsmartly] Experiment ".concat(e," will track selectors:"),Array.from(j.allPossibleSelectors)),i?((0,s.logDebug)("[EXPOSURE] [".concat(e,"] ✓ HAS IMMEDIATE TRIGGER - triggering exposure NOW"),{experimentName:e,currentVariant:t,allVariantCounts:n.map(function(e,t){return{variant:t,count:e.length}})}),this.triggerExposure(e).catch(function(t){(0,s.logDebug)("[EXPOSURE] [".concat(e,"] ✗ Failed to trigger exposure:"),t)})):c?((0,s.logDebug)("[EXPOSURE] [".concat(e,"] ✓ HAS VIEWPORT TRIGGER - setting up viewport observers"),{experimentName:e,currentVariant:t,selectorsToWatch:Array.from(j.allPossibleSelectors),allVariantCounts:n.map(function(e,t){return{variant:t,count:e.length}})}),this.observeSelectors(e,j.allPossibleSelectors)):(0,s.logDebug)("[EXPOSURE] [".concat(e,"] ⚠️ No immediate or viewport trigger detected - experiment will NOT be exposed!"),{experimentName:e,currentVariant:t,hasImmediateTrigger:i,hasViewportTrigger:c,currentChanges:r.map(function(e){return{type:e.type,trigger_on_view:e.trigger_on_view}})})},e.prototype.createContainerPlaceholder=function(e,t,r,n){var i,o;void 0===n&&(n="lastChild");var a=document.querySelector(r);if(a){var l="".concat(e,"-").concat(t,"-").concat(r,"-").concat(n);if(!this.placeholders.has(l)){var c=document.createElement("span");switch(c.style.cssText="\n display: inline-block;\n width: 1px;\n height: 1px;\n position: relative;\n left: -1px;\n visibility: hidden;\n pointer-events: none;\n font-size: 0;\n line-height: 0;\n overflow: hidden;\n ",c.setAttribute("data-absmartly-placeholder","true"),c.setAttribute("data-absmartly-original-selector",t),c.setAttribute("data-absmartly-experiment",e),c.setAttribute("aria-hidden","true"),n){case"firstChild":a.insertBefore(c,a.firstChild);break;case"lastChild":default:a.appendChild(c);break;case"before":null===(i=a.parentElement)||void 0===i||i.insertBefore(c,a);break;case"after":null===(o=a.parentElement)||void 0===o||o.insertBefore(c,a.nextSibling)}this.placeholders.set(l,c),this.trackElement(c,e),this.debug&&(0,s.logDebug)("[ABsmartly] Created placeholder for ".concat(t," at ").concat(r," (").concat(n,")"))}}},e.prototype.createInPlacePlaceholder=function(e,t){var r,n=document.querySelectorAll(t);if(0===n.length)return this.debug&&(0,s.logDebug)("[EXPOSURE] [".concat(e,"] No elements found for delete placeholder - will track selector instead"),{selector:t}),0;for(var i=0,o=0;o<n.length;o++){var a=n[o],l=t.replace(/[^a-zA-Z0-9-]/g,"_"),c="absmartly-delete-".concat(e,"-").concat(l,"-").concat(o),u="".concat(e,"-delete-").concat(t,"-").concat(o);if(!a.hasAttribute("data-absmartly-delete-placeholder")){var g=document.createElement("span");g.id=c,g.style.cssText="\n display: inline-block;\n width: 1px;\n height: 1px;\n position: relative;\n left: -1px;\n visibility: hidden;\n pointer-events: none;\n font-size: 0;\n line-height: 0;\n overflow: hidden;\n ",g.setAttribute("data-absmartly-placeholder","true"),g.setAttribute("data-absmartly-delete-placeholder","true"),g.setAttribute("data-absmartly-original-selector",t),g.setAttribute("data-absmartly-experiment",e),g.setAttribute("aria-hidden","true"),null===(r=a.parentElement)||void 0===r||r.insertBefore(g,a),a.remove(),this.placeholders.set(u,g),this.trackElement(g,e),i++,this.debug&&(0,s.logDebug)("[ABsmartly] Created in-place delete placeholder for ".concat(t," in experiment ").concat(e))}}return i},e.prototype.getOriginalParentForMove=function(e){var t=document.querySelector(e);return(null==t?void 0:t.parentElement)?this.getStableParentSelector(t.parentElement):null},e.prototype.getStableParentSelector=function(e){if(e.id)return"#".concat(e.id);if(e.className){var t=e.className.split(" ").filter(function(e){return e&&!e.startsWith("absmartly")});if(t.length>0)return".".concat(t[0])}var r=e.parentElement;if(r){var n=Array.from(r.children).indexOf(e);return"".concat(e.tagName.toLowerCase(),":nth-child(").concat(n+1,")")}return null},e.prototype.observeSelectors=function(e,t){var r,n,i,a;try{for(var l=o(t),s=l.next();!s.done;s=l.next()){var c=s.value,u=document.querySelectorAll(c);if(u.length>0)try{for(var g=(i=void 0,o(u)),d=g.next();!d.done;d=g.next()){var h=d.value;this.trackElement(h,e)}}catch(e){i={error:e}}finally{try{d&&!d.done&&(a=g.return)&&a.call(g)}finally{if(i)throw i.error}}else this.watchForSelector(c,e)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}},e.prototype.trackElement=function(e,t){this.trackedElements.has(e)?this.trackedElements.get(e).experiments.add(t):(this.trackedElements.set(e,{element:e,experiments:new Set([t]),isPlaceholder:e.hasAttribute("data-absmartly-placeholder")}),this.observer.observe(e))},e.prototype.watchForSelector=function(e,t){this.mutationObserver||this.setupMutationObserver()},e.prototype.setupIntersectionObserver=function(){var e=this;this.observer=new IntersectionObserver(function(t){var r,n;try{for(var i=o(t),a=i.next();!a.done;a=i.next()){var l=a.value;l.isIntersecting&&e.handleElementVisible(l.target)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}},{threshold:.01,rootMargin:"0px"})},e.prototype.setupMutationObserver=function(){var e=this;this.mutationObserver=new MutationObserver(function(t){var r,n,i,a;try{for(var l=o(t),s=l.next();!s.done;s=l.next()){var c=s.value;try{for(var u=(i=void 0,o(c.addedNodes)),g=u.next();!g.done;g=u.next()){var d=g.value;d instanceof Element&&e.checkNewElement(d)}}catch(e){i={error:e}}finally{try{g&&!g.done&&(a=u.return)&&a.call(u)}finally{if(i)throw i.error}}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0})},e.prototype.checkNewElement=function(e){var t,r,n,i,l,s;try{for(var c=o(this.experiments),u=c.next();!u.done;u=c.next()){var g=a(u.value,2),d=g[0],h=g[1];try{for(var p=(n=void 0,o(h.allPossibleSelectors)),f=p.next();!f.done;f=p.next()){var y=f.value;e.matches(y)&&this.trackElement(e,d);try{for(var v=(l=void 0,o(e.querySelectorAll(y))),m=v.next();!m.done;m=v.next()){var b=m.value;this.trackElement(b,d)}}catch(e){l={error:e}}finally{try{m&&!m.done&&(s=v.return)&&s.call(v)}finally{if(l)throw l.error}}}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}},e.prototype.handleElementVisible=function(e){var t,r,n=this.trackedElements.get(e);if(n){var i=function(t){var r=a.experiments.get(t);if(r&&!r.triggered&&(a.triggerExposure(t).catch(function(e){(0,s.logDebug)("[ABsmartly] Failed to trigger exposure for ".concat(t,":"),e)}),a.debug)){var i=n.isPlaceholder?e.getAttribute("data-absmartly-original-selector"):a.getElementSelector(e);(0,s.logDebug)("[ABsmartly] Triggering exposure for ".concat(t," via ").concat(i))}},a=this;try{for(var l=o(n.experiments),c=l.next();!c.done;c=l.next()){i(c.value)}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}}},e.prototype.triggerExposure=function(e){return n(this,void 0,void 0,function(){var t,r;return i(this,function(n){switch(n.label){case 0:return(t=this.experiments.get(e))?t.triggered?((0,s.logDebug)("[EXPOSURE] [".concat(e,"] Already triggered, skipping")),[2]):((0,s.logDebug)("[EXPOSURE] [".concat(e,"] ✓ CALLING context.treatment() to trigger exposure"),{experimentName:e,variant:t.variant}),[4,this.context.ready()]):((0,s.logDebug)("[EXPOSURE] [".concat(e,"] ✗ Cannot trigger - experiment not found in tracker")),[2]);case 1:return n.sent(),r=this.context.treatment(e),t.triggered=!0,(0,s.logDebug)("[EXPOSURE] [".concat(e,"] ✓✓ EXPOSURE TRIGGERED - context.treatment() completed"),{experimentName:e,variant:t.variant,treatment:r}),this.cleanupExperiment(e),[2]}})})},e.prototype.cleanupExperiment=function(e){var t,r,n,i;try{for(var l=o(this.trackedElements),s=l.next();!s.done;s=l.next()){var c=a(s.value,2),u=c[0],g=c[1];g.experiments.delete(e),0===g.experiments.size&&(this.observer.unobserve(u),this.trackedElements.delete(u))}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}try{for(var d=o(this.placeholders),h=d.next();!h.done;h=d.next()){var p=a(h.value,2),f=p[0],y=p[1];f.startsWith("".concat(e,"-"))&&(y.remove(),this.placeholders.delete(f))}}catch(e){n={error:e}}finally{try{h&&!h.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}var v=this.experiments.get(e);v&&v.allPossibleSelectors.clear(),Array.from(this.experiments.values()).every(function(e){return e.triggered})&&this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null)},e.prototype.getElementSelector=function(e){if(e.id)return"#".concat(e.id);if(e.className){var t=e.className.split(" ").filter(function(e){return e&&!e.startsWith("absmartly")});if(t.length>0)return".".concat(t.join("."))}return e.tagName.toLowerCase()},e.prototype.needsViewportTracking=function(e){var t,r=this.experiments.get(e);return null!==(t=null==r?void 0:r.hasViewportTrigger)&&void 0!==t&&t},e.prototype.isTriggered=function(e){var t,r=this.experiments.get(e);return null!==(t=null==r?void 0:r.triggered)&&void 0!==t&&t},e.prototype.destroy=function(){var e,t;this.observer.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect();try{for(var r=o(this.placeholders.values()),n=r.next();!n.done;n=r.next()){n.value.remove()}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.experiments.clear(),this.trackedElements.clear(),this.placeholders.clear(),this.debug&&(0,s.logDebug)("[ABsmartly] ExposureTracker destroyed")},e}();t.ExposureTracker=c},834:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BUILD_DEBUG=t.BUILD_VERSION=void 0,t.BUILD_VERSION="1.3.4",t.BUILD_DEBUG=!1},893:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),i=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.getOverrides=t.persistOverridesToCookie=t.serializeOverrides=t.getOverrideCookie=t.parseOverrideCookie=t.getQueryStringOverrides=t.isLocalStorageAvailable=t.generateUUID=t.generateUniqueId=t.deleteCookie=t.setCookie=t.getCookie=t.DOMPersistenceManager=t.DOMChangesPlugin=t.CookiePlugin=t.OverridesPluginLite=t.DOMChangesPluginLite=void 0;var o=r(702);Object.defineProperty(t,"DOMChangesPluginLite",{enumerable:!0,get:function(){return o.DOMChangesPluginLite}}),Object.defineProperty(t,"DOMChangesPlugin",{enumerable:!0,get:function(){return o.DOMChangesPluginLite}});var a=r(44);Object.defineProperty(t,"OverridesPluginLite",{enumerable:!0,get:function(){return a.OverridesPluginLite}});var l=r(91);Object.defineProperty(t,"CookiePlugin",{enumerable:!0,get:function(){return l.CookiePlugin}});var s=r(481);Object.defineProperty(t,"DOMPersistenceManager",{enumerable:!0,get:function(){return s.DOMPersistenceManager}}),i(r(574),t),i(r(639),t);var c=r(319);Object.defineProperty(t,"getCookie",{enumerable:!0,get:function(){return c.getCookie}}),Object.defineProperty(t,"setCookie",{enumerable:!0,get:function(){return c.setCookie}}),Object.defineProperty(t,"deleteCookie",{enumerable:!0,get:function(){return c.deleteCookie}}),Object.defineProperty(t,"generateUniqueId",{enumerable:!0,get:function(){return c.generateUniqueId}}),Object.defineProperty(t,"generateUUID",{enumerable:!0,get:function(){return c.generateUUID}}),Object.defineProperty(t,"isLocalStorageAvailable",{enumerable:!0,get:function(){return c.isLocalStorageAvailable}});var u=r(186);Object.defineProperty(t,"getQueryStringOverrides",{enumerable:!0,get:function(){return u.getQueryStringOverrides}}),Object.defineProperty(t,"parseOverrideCookie",{enumerable:!0,get:function(){return u.parseOverrideCookie}}),Object.defineProperty(t,"getOverrideCookie",{enumerable:!0,get:function(){return u.getCookieOverrides}}),Object.defineProperty(t,"serializeOverrides",{enumerable:!0,get:function(){return u.serializeOverrides}}),Object.defineProperty(t,"persistOverridesToCookie",{enumerable:!0,get:function(){return u.persistOverridesToCookie}}),Object.defineProperty(t,"getOverrides",{enumerable:!0,get:function(){return u.getOverrides}}),t.default=o.DOMChangesPluginLite},943:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.registerPlugin=function(e,t){if("undefined"==typeof window)return;window.__ABSMARTLY_PLUGINS__||(window.__ABSMARTLY_PLUGINS__={});window.__ABSMARTLY_PLUGINS__[e]=t},t.unregisterPlugin=function(e){if("undefined"==typeof window)return;window.__ABSMARTLY_PLUGINS__&&delete window.__ABSMARTLY_PLUGINS__[e]},t.isPluginRegistered=function(e){var t;if("undefined"==typeof window)return!1;return!(!window.__ABSMARTLY_PLUGINS__||!(null===(t=window.__ABSMARTLY_PLUGINS__[e])||void 0===t?void 0:t.initialized))},t.getRegisteredPlugins=function(){if("undefined"==typeof window)return{};return window.__ABSMARTLY_PLUGINS__||{}}},964:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},o=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMManipulatorLite=void 0;var a=r(609),l=r(214),s=function(){function e(e,t){void 0===e&&(e=!1);var r=this;this.appliedChanges=new Map,this.debug=e,this.plugin=t,this.pendingManager=new l.PendingChangeManager(function(e,t,n){return n?r.applyChangeToSpecificElement(e,t,n):r.applyChange(e,t)},e)}return e.prototype.executeUserJavaScript=function(e,t,r,n){var i="absmartly-experiment-".concat(r||"unknown",".js"),o="var _debug = (typeof _debug !== 'undefined' ? _debug : { debugLog: console.log.bind(console), debugWarn: console.warn.bind(console), debugError: console.error.bind(console) });\n";try{return new Function("element",o+e+"\n//# sourceURL=".concat(i))(t),!0}catch(d){var a=d instanceof Error?d.message:String(d);if(!(d instanceof EvalError||/unsafe-eval|Content Security Policy|CSP|refused to evaluate/i.test(a)))return this.reportJsExecutionFailure({experimentName:r,selector:n,reason:"runtime",error:a,stack:d instanceof Error?d.stack:void 0}),!1;try{var l="__absmartly_js_target_".concat(Date.now(),"_").concat(Math.floor(1e9*Math.random())),s="".concat(l,"_ran");window[l]=t,window[s]=!1;var c=document.createElement("script");c.textContent="(function(element){".concat(o).concat(e,"\n})(window['").concat(l,"']);\n")+"window['".concat(s,"'] = true;\n")+"try { delete window['".concat(l,"']; } catch(_e) { window['").concat(l,"'] = undefined; }\n")+"//# sourceURL=".concat(i),(document.head||document.documentElement).appendChild(c),c.remove();var u=!0===window[s];try{delete window[s]}catch(e){window[s]=void 0}return!!u||(this.reportJsExecutionFailure({experimentName:r,selector:n,reason:"csp",error:"CSP blocked dynamic script execution. eval(): ".concat(a,"; inline <script> did not execute (likely blocked by script-src without 'unsafe-inline').")}),!1)}catch(e){var g=e instanceof Error?e.message:String(e);return this.reportJsExecutionFailure({experimentName:r,selector:n,reason:"csp",error:"CSP blocked dynamic script execution. eval(): ".concat(a,"; inline <script>: ").concat(g),stack:e instanceof Error?e.stack:void 0}),!1}}},e.prototype.reportJsExecutionFailure=function(e){try{(0,a.logProductionWarn)("[ABsmartly] JavaScript DOM change failed (".concat(e.reason,') for "').concat(e.experimentName,'" selector "').concat(e.selector,'": ').concat(e.error),e.stack?{stack:e.stack}:void 0)}catch(e){}try{"undefined"!=typeof document&&"function"==typeof CustomEvent&&document.dispatchEvent(new CustomEvent("absmartly:js-error",{detail:e}))}catch(e){}},e.prototype.applyChange=function(e,t){var r,i,o,l,s,c,u,g,d,h,p,f,y,v,m=this;if(!e.enabled&&void 0!==e.enabled)return(0,a.logDebug)("Skipping disabled change for experiment: ".concat(t),{experimentName:t,selector:e.selector,changeType:e.type}),!1;var b=!!this.plugin.reapplyingElements&&Array.from(this.plugin.reapplyingElements).length>0,x=null===(g=null===(u=this.plugin.config)||void 0===u?void 0:u.context)||void 0===g?void 0:g.peek(t);this.debug&&(0,a.logDebug)("[DOM-APPLY] [".concat(t,"] ").concat(b?"RE-APPLYING":"APPLYING"," change"),{experimentName:t,userVariant:x,selector:e.selector,type:e.type,timestamp:Date.now(),callStack:null===(d=(new Error).stack)||void 0===d?void 0:d.split("\n").slice(2,4).join("\n")});try{if("styleRules"===e.type)return this.applyStyleRules(e,t);if("create"===e.type){if(e.element&&e.targetSelector)if(this.createElement(e,t))return this.trackAppliedChange(t,e),(0,a.logChangeApplication)(t,e.targetSelector,e.type,1,!0),!0;return!1}var w=document.querySelectorAll(e.selector),E=[];if(0===w.length)return e.waitForElement||(null===(h=this.plugin.config)||void 0===h?void 0:h.spa)?(this.debug&&(0,a.logDebug)("[ABsmartly] Element not found, adding to pending: ".concat(e.selector)),this.pendingManager.addPending({change:e,experimentName:t,observerRoot:e.observerRoot}),!0):(this.debug&&(0,a.logDebug)("[ABsmartly] No elements found for selector: ".concat(e.selector)),(0,a.logDebug)("No elements found for selector",{experimentName:t,selector:e.selector,changeType:e.type}),!1);try{for(var S=n(w),A=S.next();!A.done;A=S.next()){var C=A.value;if(this.debug&&"style"===e.type){var D={};if(e.value&&"object"==typeof e.value)try{for(var O=(o=void 0,n(Object.keys(e.value))),_=O.next();!_.done;_=O.next()){D[L=_.value.replace(/([A-Z])/g,"-$1").toLowerCase()]=C.style.getPropertyValue(L)}}catch(e){o={error:e}}finally{try{_&&!_.done&&(l=O.return)&&l.call(O)}finally{if(o)throw o.error}}(0,a.logDebug)("[DOM-BEFORE-APPLY] Element styles before change",{experimentName:t,selector:e.selector,element:C.tagName,oldStyles:D,newStyles:e.value})}if(this.applyChangeToElement(C,e),this.debug&&"style"===e.type){var k={};if(e.value&&"object"==typeof e.value)try{for(var P=(s=void 0,n(Object.keys(e.value))),M=P.next();!M.done;M=P.next()){var L;k[L=M.value.replace(/([A-Z])/g,"-$1").toLowerCase()]=C.style.getPropertyValue(L)}}catch(e){s={error:e}}finally{try{M&&!M.done&&(c=P.return)&&c.call(P)}finally{if(s)throw s.error}}(0,a.logDebug)("[DOM-AFTER-APPLY] Element styles after change",{experimentName:t,selector:e.selector,element:C.tagName,appliedStyles:k})}if("javascript"===e.type)if(e.value){var T=null===(f=null===(p=this.plugin.config)||void 0===p?void 0:p.context)||void 0===f?void 0:f.peek(t);this.debug&&(0,a.logDebug)("[JAVASCRIPT] [".concat(t,"] Executing JavaScript change"),{experimentName:t,userVariant:T,selector:e.selector,element:C.tagName,code:String(e.value).substring(0,100)+"..."});var I=String(e.value);this.executeUserJavaScript(I,C,t,e.selector)&&(E.push(C),this.debug&&(0,a.logDebug)("[JAVASCRIPT] [".concat(t,"] ✓ JavaScript executed successfully"),{experimentName:t,userVariant:T,selector:e.selector,element:C.tagName,code:I}))}else(0,a.logDebug)("[JAVASCRIPT] [".concat(t,"] ✗ No JavaScript code provided in change.value"),{experimentName:t,selector:e.selector});else if("move"===e.type){var N=e.targetSelector||(e.value&&"object"==typeof e.value?e.value.targetSelector:null),j=e.position||(e.value&&"object"==typeof e.value?e.value.position:null);if(N){var R=document.querySelector(N);R?(this.moveElement(C,R,j),E.push(C)):this.debug&&(0,a.logDebug)("[ABsmartly] Move target not found: ".concat(N))}}else E.push(C);"style"===e.type&&e.persistStyle||"attribute"===e.type&&e.persistAttribute||"javascript"===e.type&&!0===e.persistScript||(null===(y=this.plugin.config)||void 0===y?void 0:y.spa)?this.plugin.watchElement(C,t,e):this.debug&&(0,a.logDebug)("[WATCH-SKIP] NOT watching element - no persist flag and SPA disabled",{experimentName:t,selector:e.selector,element:C.tagName,changeType:e.type,spaMode:null===(v=this.plugin.config)||void 0===v?void 0:v.spa})}}catch(e){r={error:e}}finally{try{A&&!A.done&&(i=S.return)&&i.call(S)}finally{if(r)throw r.error}}if(E.length>0){this.trackAppliedChange(t,e),e.waitForElement&&this.pendingManager.removePending(e.selector,t,e.observerRoot);var U=E.some(function(e){var t;return null===(t=m.plugin.reapplyingElements)||void 0===t?void 0:t.has(e)});return U||(0,a.logChangeApplication)(t,e.selector,e.type,E.length,!0),!0}return(0,a.logChangeApplication)(t,e.selector,e.type,0,!1),!1}catch(r){return this.debug&&(0,a.logDebug)("[ABsmartly] Error applying DOM change:",r,e),(0,a.logDebug)("Error applying DOM change",{experimentName:t,selector:e.selector,changeType:e.type,error:r instanceof Error?r.message:"Unknown error"}),!1}},e.prototype.moveElement=function(e,t,r){var n,i,o;switch(r){case"before":null===(n=t.parentElement)||void 0===n||n.insertBefore(e,t);break;case"after":t.nextSibling?null===(i=t.parentElement)||void 0===i||i.insertBefore(e,t.nextSibling):null===(o=t.parentElement)||void 0===o||o.appendChild(e);break;case"firstChild":t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e);break;default:t.appendChild(e)}},e.prototype.createElement=function(e,t){var r,i;if(!e.element||!e.targetSelector)return null;var o=document.querySelector(e.targetSelector);if(!o)return this.debug&&(0,a.logDebug)("[ABsmartly] Create target not found: ".concat(e.targetSelector)),null;var l=document.createElement("div");l.innerHTML=e.element;var s=Array.from(l.children);if(0===s.length)return null;try{for(var c=n(s),u=c.next();!u.done;u=c.next()){var g=u.value;this.moveElement(g,o,e.position)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}return s[0]},e.prototype.applyStyleRules=function(e,t){try{var r=this.plugin.getStyleManager(t),n="".concat(e.selector,"::states"),i=void 0;if("string"==typeof e.value&&e.value.trim())i=e.value;else{if(!e.states)return!1;i=this.plugin.buildStateRules(e.selector,e.states,!1!==e.important)}return r.setRule(n,i),this.debug&&((0,a.logDebug)("[ABsmartly] Applied style rule: ".concat(n)),(0,a.logDebug)("[ABsmartly] CSS: ".concat(i))),this.trackAppliedChange(t,e),(0,a.logChangeApplication)(t,e.selector,"styleRules",1,!0),!0}catch(e){return this.debug&&(0,a.logDebug)("[ABsmartly] Error applying style rules:",e),!1}},e.prototype.applyChangeToElement=function(e,t){var r,l,s,c,u,g;switch(t.type){case"text":void 0!==t.value&&(e.textContent=String(t.value));break;case"html":void 0!==t.value&&(e.innerHTML=String(t.value));break;case"style":if(t.value&&"object"==typeof t.value)try{for(var d=n(Object.entries(t.value)),h=d.next();!h.done;h=d.next()){var p=i(h.value,2),f=p[0],y=p[1],v=f.replace(/([A-Z])/g,"-$1").toLowerCase(),m=!0===t.important?"important":"";e.style.setProperty(v,String(y),m)}}catch(e){r={error:e}}finally{try{h&&!h.done&&(l=d.return)&&l.call(d)}finally{if(r)throw r.error}}break;case"class":t.add&&Array.isArray(t.add)&&(s=e.classList).add.apply(s,o([],i(t.add),!1)),t.remove&&Array.isArray(t.remove)&&(c=e.classList).remove.apply(c,o([],i(t.remove),!1));break;case"attribute":if(t.value&&"object"==typeof t.value)try{for(var b=n(Object.entries(t.value)),x=b.next();!x.done;x=b.next()){var w=i(x.value,2),E=w[0];null==(y=w[1])?e.removeAttribute(E):e.setAttribute(E,String(y))}}catch(e){u={error:e}}finally{try{x&&!x.done&&(g=b.return)&&g.call(b)}finally{if(u)throw u.error}}break;case"move":if(t.value&&"object"==typeof t.value){var S=t.value,A=document.querySelector(S.targetSelector);A?this.moveElement(e,A,S.position):this.debug&&(0,a.logDebug)("[ABsmartly] Move target not found: ".concat(S.targetSelector))}break;case"delete":e.remove()}},e.prototype.applyChangeToSpecificElement=function(e,t,r){var n;try{if(this.applyChangeToElement(r,e),"javascript"===e.type&&e.value){if(this.debug&&(0,a.logDebug)("[JAVASCRIPT] [".concat(t,"] Executing JavaScript on specific element"),{experimentName:t,selector:e.selector,element:r.tagName,code:String(e.value).substring(0,100)+"..."}),!this.executeUserJavaScript(String(e.value),r,t,e.selector))return!1;this.debug&&(0,a.logDebug)("[JAVASCRIPT] [".concat(t,"] ✓ JavaScript executed successfully"),{experimentName:t,selector:e.selector,element:r.tagName})}else if("move"===e.type){var i=e.targetSelector||(e.value&&"object"==typeof e.value?e.value.targetSelector:null),o=e.position||(e.value&&"object"==typeof e.value?e.value.position:null);if(i){var l=document.querySelector(i);if(!l)return!1;this.moveElement(r,l,o)}}return("style"===e.type&&e.persistStyle||"attribute"===e.type&&e.persistAttribute||"javascript"===e.type&&!0===e.persistScript||(null===(n=this.plugin.config)||void 0===n?void 0:n.spa))&&this.plugin.watchElement(r,t,e),!0}catch(e){return this.debug&&(0,a.logDebug)("[ABsmartly] Error applying change to specific element:",e),!1}},e.prototype.trackAppliedChange=function(e,t){var r=this.appliedChanges.get(e);r||(r=new Set,this.appliedChanges.set(e,r));var n="".concat(t.selector,"-").concat(t.type);r.add(n)},e.prototype.hasChanges=function(e){return this.appliedChanges.has(e)},e.prototype.clearTracking=function(e){e?this.appliedChanges.delete(e):this.appliedChanges.clear()},e.prototype.removeAllPending=function(e){this.pendingManager.removeAllPending(e)},e.prototype.destroy=function(){this.pendingManager.destroy(),this.appliedChanges.clear()},e}();t.DOMManipulatorLite=s},973:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.URLMatcher=void 0;var n=r(609),i=function(){function e(){}return e.matches=function(e,t){void 0===t&&(t=window.location.href);var r=this.normalizeFilter(e),n=this.extractURLPart(t,r.matchType);return(!r.exclude||!this.matchesPatterns(r.exclude,n,r.mode))&&(!r.include||0!==r.include.length&&this.matchesPatterns(r.include,n,r.mode))},e.extractURLPart=function(e,t){void 0===t&&(t="path");try{var r=new URL(e);switch(t){case"full-url":return r.href;case"path":default:return r.pathname+r.hash;case"domain":return r.hostname;case"query":return r.search;case"hash":return r.hash}}catch(t){return(0,n.logDebug)("[ABsmartly] Failed to parse URL: ".concat(e),t),e}},e.matchesPatterns=function(e,t,r){var i=this;return void 0===r&&(r="simple"),e.some(function(e){if("regex"===r)try{return new RegExp(e).test(t)}catch(t){return(0,n.logDebug)("[ABsmartly] Invalid regex pattern: ".concat(e),t),!1}return i.matchSimplePattern(e,t)})},e.matchSimplePattern=function(e,t){var r=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");try{return new RegExp("^".concat(r,"$")).test(t)}catch(t){return(0,n.logDebug)("[ABsmartly] Invalid pattern: ".concat(e),t),!1}},e.normalizeFilter=function(e){return"string"==typeof e?{include:[e],exclude:[],mode:"simple",matchType:"path"}:Array.isArray(e)?{include:e.length>0?e:void 0,exclude:[],mode:"simple",matchType:"path"}:{include:e.include,exclude:e.exclude||[],mode:e.mode||"simple",matchType:e.matchType||"path"}},e}();t.URLMatcher=i}},t={};var r=function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}(893);return r})());