@absmartly/sdk-plugins 1.3.6 → 1.3.8

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.
Files changed (36) hide show
  1. package/dist/absmartly-cookie.min.js +1 -1
  2. package/dist/absmartly-dom-changes-core.min.js +1 -1
  3. package/dist/absmartly-dom-changes-lite.min.js +1 -1
  4. package/dist/absmartly-overrides-full.min.js +1 -1
  5. package/dist/absmartly-overrides-lite.min.js +1 -1
  6. package/dist/absmartly-sdk-plugins.min.js +1 -1
  7. package/dist/absmartly-vitals.min.js +1 -1
  8. package/es/core/DOMManipulatorLite.js +15 -14
  9. package/es/core/DOMManipulatorLite.js.map +1 -1
  10. package/es/core/ExposureTracker.js +114 -46
  11. package/es/core/ExposureTracker.js.map +1 -1
  12. package/es/generated/buildInfo.js +1 -1
  13. package/es/parsers/VariantExtractor.js +22 -1
  14. package/es/parsers/VariantExtractor.js.map +1 -1
  15. package/es/utils/URLMatcher.js +86 -6
  16. package/es/utils/URLMatcher.js.map +1 -1
  17. package/lib/core/DOMManipulatorLite.js +15 -14
  18. package/lib/core/DOMManipulatorLite.js.map +1 -1
  19. package/lib/core/ExposureTracker.d.ts +2 -0
  20. package/lib/core/ExposureTracker.js +114 -46
  21. package/lib/core/ExposureTracker.js.map +1 -1
  22. package/lib/generated/buildInfo.d.ts +1 -1
  23. package/lib/generated/buildInfo.js +1 -1
  24. package/lib/parsers/VariantExtractor.d.ts +5 -0
  25. package/lib/parsers/VariantExtractor.js +22 -1
  26. package/lib/parsers/VariantExtractor.js.map +1 -1
  27. package/lib/types/index.d.ts +8 -0
  28. package/lib/utils/URLMatcher.d.ts +15 -0
  29. package/lib/utils/URLMatcher.js +86 -6
  30. package/lib/utils/URLMatcher.js.map +1 -1
  31. package/package.json +1 -1
  32. package/types/core/ExposureTracker.d.ts +2 -0
  33. package/types/generated/buildInfo.d.ts +1 -1
  34. package/types/parsers/VariantExtractor.d.ts +5 -0
  35. package/types/types/index.d.ts +8 -0
  36. package/types/utils/URLMatcher.d.ts +15 -0
@@ -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.ABsmartlyCookie=t():e.ABsmartlyCookie=t()}(this,()=>(()=>{"use strict";var e={91:function(e,t,o){var i=this&&this.__awaiter||function(e,t,o,i){return new(o||(o=Promise))(function(r,n){function a(e){try{c(i.next(e))}catch(e){n(e)}}function s(e){try{c(i.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(a,s)}c((i=i.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var o,i,r,n={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(o)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(n=0)),n;)try{if(o=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if(!(r=n.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){n=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){n.label=s[1];break}if(6===s[0]&&n.label<r[1]){n.label=r[1],r=s;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(s);break}r[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{o=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},n=this&&this.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var i,r,n=o.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(r)throw r.error}}return a},a=this&&this.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var i,r=0,n=t.length;r<n;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))},s=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],i=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],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 c=o(609),l=o(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&&c.logDebug.apply(void 0,a(["[CookiePlugin]"],n(e),!1))},e.prototype.setCookie=function(e,t,o){var i=void 0!==o?o:this.cookieExpiryDays,r=(0,l.setCookie)(e,t,i,{domain:this.cookieDomain,path:this.cookiePath,sameSite:this.sameSite,secure:this.secure});return r&&this.debugLog("Set cookie ".concat(e,":"),t),r},e.prototype.deleteCookie=function(e){(0,l.deleteCookie)(e,{domain:this.cookieDomain,path:this.cookiePath})},e.prototype.getUnitId=function(){if(this.unitId)return this.unitId;var e=navigator.cookieEnabled,t=(0,l.isLocalStorageAvailable)(),o=null;return e&&(o=(0,l.getCookie)(this.unitIdCookieName)||(0,l.getCookie)(this.publicIdCookieName)),!o&&t&&(o=localStorage.getItem("abs_id")),o&&(this.unitId=o),o},e.prototype.setUnitId=function(e){this.unitId=e;var t=navigator.cookieEnabled,o=(0,l.isLocalStorageAvailable)();t&&(this.setCookie(this.unitIdCookieName,e),this.setCookie(this.publicIdCookieName,e),this.autoUpdateExpiry&&this.updateExpiryTimestamp()),o&&localStorage.setItem("abs_id",e),this.debugLog("Unit ID set:",e)},e.prototype.generateAndSetUnitId=function(){var e=(0,l.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,l.getCookie)(this.expiryCookieName);if(!e)return!1;try{var t=parseInt(e,10),o=(Date.now()-t)/864e5,i=o<=this.expiryCheckInterval;return this.debugLog("Expiry check:",{daysSinceSet:o,isFresh:i}),i}catch(e){return this.debugLog("Error parsing expiry cookie:",e),!1}},e.prototype.getUtmParams=function(){var e,t,o,i,r={},n=new URLSearchParams(window.location.search);try{for(var a=s(this.utmParams),c=a.next();!c.done;c=a.next()){var l=c.value;(p=n.get(l))&&(r[l]=p)}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}if(0===Object.keys(r).length&&document.referrer)try{var u=new URL(document.referrer);try{for(var g=s(this.utmParams),d=g.next();!d.done;d=g.next()){var p;l=d.value;(p=u.searchParams.get(l))&&(r[l]=p)}}catch(e){o={error:e}}finally{try{d&&!d.done&&(i=g.return)&&i.call(g)}finally{if(o)throw o.error}}}catch(e){this.debugLog("Error parsing referrer URL:",e)}if(0===Object.keys(r).length){var h=this.getStoredUtmParams();if(h)return h}return r},e.prototype.storeUtmParams=function(e){if(0!==Object.keys(e).length){var t={params:e,timestamp:Date.now()},o=navigator.cookieEnabled;if((0,l.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)}o&&(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,l.isLocalStorageAvailable)(),o=navigator.cookieEnabled;if(t)try{e=localStorage.getItem(this.utmCookieName)}catch(e){this.debugLog("Failed to get UTM params from localStorage:",e)}if(!e&&o&&(e=(0,l.getCookie)(this.utmCookieName)),e)try{var i=JSON.parse(e);if(Date.now()-i.timestamp<2592e6)return i.params}catch(e){this.debugLog("Failed to parse stored UTM params:",e)}return null},e.prototype.applyUtmAttributesToContext=function(e){var t,o,i=e||this.context;if(i){var r=this.getUtmParams();Object.keys(r).length>0&&this.storeUtmParams(r);try{for(var a=s(Object.entries(r)),l=a.next();!l.done;l=a.next()){var u=n(l.value,2),g=u[0],d=u[1],p=g.slice(4);i.attribute(p,d),this.debugLog("Set attribute ".concat(p,":"),d)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(o=a.return)&&o.call(a)}finally{if(t)throw t.error}}}else(0,c.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,l.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 i(this,void 0,void 0,function(){var e;return r(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 i(this,void 0,void 0,function(){return r(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,o=(0,l.isLocalStorageAvailable)();if(e){if(t&&!this.isExpiryFresh())return this.debugLog("Existing ID present but expiry not fresh - need worker call"),!0}else if(t||o){var i=(0,l.getCookie)(this.expiryCookieName);return this.debugLog(i?"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 o=new URLSearchParams(window.location.search),i=this.utmParams.some(function(e){return o.get(e)}),r=document.referrer,n=r&&!r.includes(this.cookieDomain.replace(".","")),a=navigator.cookieEnabled||(0,l.isLocalStorageAvailable)(),s=!!((0,l.getCookie)(this.unitIdCookieName)||(0,l.getCookie)(this.publicIdCookieName)||(0,l.getCookie)(this.expiryCookieName)||(0,l.isLocalStorageAvailable)()&&localStorage.getItem("abs_id"));if(i||n||a&&!s){var u={referrer_url:r||"",landing_url:window.location.href,accepts_cookies:navigator.cookieEnabled,accepts_storage:(0,l.isLocalStorageAvailable)(),has_utm:i};this.debugLog("Tracking landing:",u),t.track("landing",u)}}else(0,c.logDebug)("[CookiePlugin] No context available for tracking landing")},e}();t.CookiePlugin=u},319:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getCookie=function(e){var t,o="; ".concat(document.cookie).split("; ".concat(e,"="));if(2===o.length){return(null===(t=o.pop())||void 0===t?void 0:t.split(";").shift())||null}return null},t.setCookie=r,t.deleteCookie=function(e,t){void 0===t&&(t={});r(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 i=o(609);function r(e,t,o,r){void 0===r&&(r={});try{var n=new Date;n.setTime(n.getTime()+24*o*60*60*1e3);var a="expires=".concat(n.toUTCString()),s=r.path||"/",c="".concat(e,"=").concat(t,";").concat(a,";path=").concat(s);r.domain&&"localhost"!==r.domain&&(c+=";domain=".concat(r.domain));var l=r.sameSite||"Lax";return c+=";SameSite=".concat(l),r.secure&&(c+=";Secure"),document.cookie=c,!0}catch(t){return(0,i.logDebug)("Unable to set cookie ".concat(e,":"),t),!1}}},609:function(e,t,o){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++)for(var r in t=arguments[o])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)},r=this&&this.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var i,r,n=o.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(r)throw r.error}}return a},n=this&&this.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var i,r=0,n=t.length;r<n;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.DEBUG=void 0,t.logDebug=s,t.logChangeApplication=function(e,o,i,r,n){if(t.DEBUG){s("".concat(n?"✓":"✗"," Applied ").concat(i," change to ").concat(r," element(s)"),{experimentName:e,selector:o,changeType:i,elementsCount:r,success:n})}},t.logChangeRemoval=function(e,o,i,r){if(t.DEBUG){s("Restored ".concat(r," element(s) to original state"),{experimentName:e,selector:o,changeType:i,elementsCount:r,action:"restore"})}},t.logExperimentSummary=function(e,o,i,r){if(t.DEBUG){s('Experiment "'.concat(e,'" summary'),{experimentName:e,totalChanges:o,successfulChanges:i,pendingChanges:r,successRate:o>0?"".concat(Math.round(i/o*100),"%"):"N/A"})}},t.logStateOperation=function(e,o,i,r){if(t.DEBUG){s("State ".concat(e," operation"),{operation:e,selector:o,changeType:i,experimentName:r})}},t.logVisibilityEvent=function(e,o,i){if(t.DEBUG){s(i?"Element became visible - experiment triggered":"Element visibility changed",{experimentName:e,selector:o.className||o.id||o.tagName,triggered:i,action:"visibility"})}},t.logMessage=function(e,o,i){if(t.DEBUG){s("Message ".concat(e,": ").concat(o),{direction:e,messageType:o,payload:i,bridge:"extension"})}},t.logPerformance=function(e,o,r){if(t.DEBUG){s("Performance: ".concat(e," took ").concat(o,"ms"),i({operation:e,duration:o,performance:!0},r))}},t.logProductionWarn=function(e){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];console.warn.apply(console,n([e],r(t),!1))};var a=o(834);function s(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];if(t.DEBUG)if(2===e.length&&"string"==typeof e[0]&&"object"==typeof e[1]){var i=r(e,2),a=i[0],s=i[1];if(a.includes("Original state already stored"))return;if(a.includes("State store operation"))return;if(a.includes("Performance:")&&(null==s?void 0:s.duration)&&s.duration<5)return;if(a.includes("Message sent:")||a.includes("Message received:"))return;var c=(new Date).toISOString(),l="[ABsmartly Debug]";console.log("".concat(l," [").concat(c,"] ").concat(a),s)}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;c=(new Date).toISOString(),l="[ABsmartly Debug]";console.log("".concat(l," [").concat(c,"] ").concat(a))}else console.log.apply(console,n([],r(e),!1))}t.DEBUG=a.BUILD_DEBUG},834:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BUILD_DEBUG=t.BUILD_VERSION=void 0,t.BUILD_VERSION="1.3.6",t.BUILD_DEBUG=!1}},t={};function o(i){var r=t[i];if(void 0!==r)return r.exports;var n=t[i]={exports:{}};return e[i].call(n.exports,n,n.exports,o),n.exports}var i={};return(()=>{var e=i;Object.defineProperty(e,"__esModule",{value:!0}),e.CookiePlugin=void 0;var t=o(91);Object.defineProperty(e,"CookiePlugin",{enumerable:!0,get:function(){return t.CookiePlugin}}),e.default=t.CookiePlugin})(),i})());
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ABsmartlyCookie=t():e.ABsmartlyCookie=t()}(this,()=>(()=>{"use strict";var e={91:function(e,t,o){var i=this&&this.__awaiter||function(e,t,o,i){return new(o||(o=Promise))(function(r,n){function a(e){try{c(i.next(e))}catch(e){n(e)}}function s(e){try{c(i.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o(function(e){e(t)})).then(a,s)}c((i=i.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var o,i,r,n={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(o)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(n=0)),n;)try{if(o=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if(!(r=n.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){n=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){n.label=s[1];break}if(6===s[0]&&n.label<r[1]){n.label=r[1],r=s;break}if(r&&n.label<r[2]){n.label=r[2],n.ops.push(s);break}r[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{o=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},n=this&&this.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var i,r,n=o.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(r)throw r.error}}return a},a=this&&this.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var i,r=0,n=t.length;r<n;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))},s=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,o=t&&e[t],i=0;if(o)return o.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],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 c=o(609),l=o(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&&c.logDebug.apply(void 0,a(["[CookiePlugin]"],n(e),!1))},e.prototype.setCookie=function(e,t,o){var i=void 0!==o?o:this.cookieExpiryDays,r=(0,l.setCookie)(e,t,i,{domain:this.cookieDomain,path:this.cookiePath,sameSite:this.sameSite,secure:this.secure});return r&&this.debugLog("Set cookie ".concat(e,":"),t),r},e.prototype.deleteCookie=function(e){(0,l.deleteCookie)(e,{domain:this.cookieDomain,path:this.cookiePath})},e.prototype.getUnitId=function(){if(this.unitId)return this.unitId;var e=navigator.cookieEnabled,t=(0,l.isLocalStorageAvailable)(),o=null;return e&&(o=(0,l.getCookie)(this.unitIdCookieName)||(0,l.getCookie)(this.publicIdCookieName)),!o&&t&&(o=localStorage.getItem("abs_id")),o&&(this.unitId=o),o},e.prototype.setUnitId=function(e){this.unitId=e;var t=navigator.cookieEnabled,o=(0,l.isLocalStorageAvailable)();t&&(this.setCookie(this.unitIdCookieName,e),this.setCookie(this.publicIdCookieName,e),this.autoUpdateExpiry&&this.updateExpiryTimestamp()),o&&localStorage.setItem("abs_id",e),this.debugLog("Unit ID set:",e)},e.prototype.generateAndSetUnitId=function(){var e=(0,l.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,l.getCookie)(this.expiryCookieName);if(!e)return!1;try{var t=parseInt(e,10),o=(Date.now()-t)/864e5,i=o<=this.expiryCheckInterval;return this.debugLog("Expiry check:",{daysSinceSet:o,isFresh:i}),i}catch(e){return this.debugLog("Error parsing expiry cookie:",e),!1}},e.prototype.getUtmParams=function(){var e,t,o,i,r={},n=new URLSearchParams(window.location.search);try{for(var a=s(this.utmParams),c=a.next();!c.done;c=a.next()){var l=c.value;(p=n.get(l))&&(r[l]=p)}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}if(0===Object.keys(r).length&&document.referrer)try{var u=new URL(document.referrer);try{for(var g=s(this.utmParams),d=g.next();!d.done;d=g.next()){var p;l=d.value;(p=u.searchParams.get(l))&&(r[l]=p)}}catch(e){o={error:e}}finally{try{d&&!d.done&&(i=g.return)&&i.call(g)}finally{if(o)throw o.error}}}catch(e){this.debugLog("Error parsing referrer URL:",e)}if(0===Object.keys(r).length){var h=this.getStoredUtmParams();if(h)return h}return r},e.prototype.storeUtmParams=function(e){if(0!==Object.keys(e).length){var t={params:e,timestamp:Date.now()},o=navigator.cookieEnabled;if((0,l.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)}o&&(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,l.isLocalStorageAvailable)(),o=navigator.cookieEnabled;if(t)try{e=localStorage.getItem(this.utmCookieName)}catch(e){this.debugLog("Failed to get UTM params from localStorage:",e)}if(!e&&o&&(e=(0,l.getCookie)(this.utmCookieName)),e)try{var i=JSON.parse(e);if(Date.now()-i.timestamp<2592e6)return i.params}catch(e){this.debugLog("Failed to parse stored UTM params:",e)}return null},e.prototype.applyUtmAttributesToContext=function(e){var t,o,i=e||this.context;if(i){var r=this.getUtmParams();Object.keys(r).length>0&&this.storeUtmParams(r);try{for(var a=s(Object.entries(r)),l=a.next();!l.done;l=a.next()){var u=n(l.value,2),g=u[0],d=u[1],p=g.slice(4);i.attribute(p,d),this.debugLog("Set attribute ".concat(p,":"),d)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(o=a.return)&&o.call(a)}finally{if(t)throw t.error}}}else(0,c.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,l.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 i(this,void 0,void 0,function(){var e;return r(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 i(this,void 0,void 0,function(){return r(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,o=(0,l.isLocalStorageAvailable)();if(e){if(t&&!this.isExpiryFresh())return this.debugLog("Existing ID present but expiry not fresh - need worker call"),!0}else if(t||o){var i=(0,l.getCookie)(this.expiryCookieName);return this.debugLog(i?"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 o=new URLSearchParams(window.location.search),i=this.utmParams.some(function(e){return o.get(e)}),r=document.referrer,n=r&&!r.includes(this.cookieDomain.replace(".","")),a=navigator.cookieEnabled||(0,l.isLocalStorageAvailable)(),s=!!((0,l.getCookie)(this.unitIdCookieName)||(0,l.getCookie)(this.publicIdCookieName)||(0,l.getCookie)(this.expiryCookieName)||(0,l.isLocalStorageAvailable)()&&localStorage.getItem("abs_id"));if(i||n||a&&!s){var u={referrer_url:r||"",landing_url:window.location.href,accepts_cookies:navigator.cookieEnabled,accepts_storage:(0,l.isLocalStorageAvailable)(),has_utm:i};this.debugLog("Tracking landing:",u),t.track("landing",u)}}else(0,c.logDebug)("[CookiePlugin] No context available for tracking landing")},e}();t.CookiePlugin=u},319:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getCookie=function(e){var t,o="; ".concat(document.cookie).split("; ".concat(e,"="));if(2===o.length){return(null===(t=o.pop())||void 0===t?void 0:t.split(";").shift())||null}return null},t.setCookie=r,t.deleteCookie=function(e,t){void 0===t&&(t={});r(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 i=o(609);function r(e,t,o,r){void 0===r&&(r={});try{var n=new Date;n.setTime(n.getTime()+24*o*60*60*1e3);var a="expires=".concat(n.toUTCString()),s=r.path||"/",c="".concat(e,"=").concat(t,";").concat(a,";path=").concat(s);r.domain&&"localhost"!==r.domain&&(c+=";domain=".concat(r.domain));var l=r.sameSite||"Lax";return c+=";SameSite=".concat(l),r.secure&&(c+=";Secure"),document.cookie=c,!0}catch(t){return(0,i.logDebug)("Unable to set cookie ".concat(e,":"),t),!1}}},609:function(e,t,o){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++)for(var r in t=arguments[o])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)},r=this&&this.__read||function(e,t){var o="function"==typeof Symbol&&e[Symbol.iterator];if(!o)return e;var i,r,n=o.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(r)throw r.error}}return a},n=this&&this.__spreadArray||function(e,t,o){if(o||2===arguments.length)for(var i,r=0,n=t.length;r<n;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.DEBUG=void 0,t.logDebug=s,t.logChangeApplication=function(e,o,i,r,n){if(t.DEBUG){s("".concat(n?"✓":"✗"," Applied ").concat(i," change to ").concat(r," element(s)"),{experimentName:e,selector:o,changeType:i,elementsCount:r,success:n})}},t.logChangeRemoval=function(e,o,i,r){if(t.DEBUG){s("Restored ".concat(r," element(s) to original state"),{experimentName:e,selector:o,changeType:i,elementsCount:r,action:"restore"})}},t.logExperimentSummary=function(e,o,i,r){if(t.DEBUG){s('Experiment "'.concat(e,'" summary'),{experimentName:e,totalChanges:o,successfulChanges:i,pendingChanges:r,successRate:o>0?"".concat(Math.round(i/o*100),"%"):"N/A"})}},t.logStateOperation=function(e,o,i,r){if(t.DEBUG){s("State ".concat(e," operation"),{operation:e,selector:o,changeType:i,experimentName:r})}},t.logVisibilityEvent=function(e,o,i){if(t.DEBUG){s(i?"Element became visible - experiment triggered":"Element visibility changed",{experimentName:e,selector:o.className||o.id||o.tagName,triggered:i,action:"visibility"})}},t.logMessage=function(e,o,i){if(t.DEBUG){s("Message ".concat(e,": ").concat(o),{direction:e,messageType:o,payload:i,bridge:"extension"})}},t.logPerformance=function(e,o,r){if(t.DEBUG){s("Performance: ".concat(e," took ").concat(o,"ms"),i({operation:e,duration:o,performance:!0},r))}},t.logProductionWarn=function(e){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];console.warn.apply(console,n([e],r(t),!1))};var a=o(834);function s(){for(var e=[],o=0;o<arguments.length;o++)e[o]=arguments[o];if(t.DEBUG)if(2===e.length&&"string"==typeof e[0]&&"object"==typeof e[1]){var i=r(e,2),a=i[0],s=i[1];if(a.includes("Original state already stored"))return;if(a.includes("State store operation"))return;if(a.includes("Performance:")&&(null==s?void 0:s.duration)&&s.duration<5)return;if(a.includes("Message sent:")||a.includes("Message received:"))return;var c=(new Date).toISOString(),l="[ABsmartly Debug]";console.log("".concat(l," [").concat(c,"] ").concat(a),s)}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;c=(new Date).toISOString(),l="[ABsmartly Debug]";console.log("".concat(l," [").concat(c,"] ").concat(a))}else console.log.apply(console,n([],r(e),!1))}t.DEBUG=a.BUILD_DEBUG},834:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BUILD_DEBUG=t.BUILD_VERSION=void 0,t.BUILD_VERSION="1.3.8",t.BUILD_DEBUG=!1}},t={};function o(i){var r=t[i];if(void 0!==r)return r.exports;var n=t[i]={exports:{}};return e[i].call(n.exports,n,n.exports,o),n.exports}var i={};return(()=>{var e=i;Object.defineProperty(e,"__esModule",{value:!0}),e.CookiePlugin=void 0;var t=o(91);Object.defineProperty(e,"CookiePlugin",{enumerable:!0,get:function(){return t.CookiePlugin}}),e.default=t.CookiePlugin})(),i})());
@@ -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.ABsmartlyDOM=t():e.ABsmartlyDOM=t()}(this,()=>(()=>{"use strict";var e={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.")},a=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o};Object.defineProperty(t,"__esModule",{value:!0}),t.PendingChangeManager=void 0;var o=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,o.logDebug)("[ABsmartly] Observer root not found, using document:",r),i=void 0);var a="".concat(t.selector,"-").concat(i||"document");this.debug&&(0,o.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(a)||[];s.push(n(n({},e),{observerRoot:i})),this.pending.set(a,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 a=i.filter(function(e){return e.experimentName!==t});0===a.length?this.pending.delete(n):this.pending.set(n,a)}this.checkObserverCleanup(r)},e.prototype.removeAllPending=function(e){var t,r;try{for(var n=i(this.pending.entries()),o=n.next();!o.done;o=n.next()){var l=a(o.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{o&&!o.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,o.logDebug)("[ABsmartly] Started observer for root:",r)}},e.prototype.handleMutations=function(e,t){var r,n,o,l,s,c,u,h,g=this,d=[];try{for(var p=i(e),f=p.next();!f.done;f=p.next()){var y=f.value,v=function(e){var r,n,o,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 h=a(u.value,2),p=h[0],f=h[1];if(p.endsWith("-".concat(s))){var y=function(t){var r,n,a=t.change;if(e.matches(a.selector))return d.push(function(){return g.applyChange(e,t)}),"continue";var o=e.querySelectorAll(a.selector),l=function(e){d.push(function(){return g.applyChange(e,t)})};try{for(var s=(r=void 0,i(o)),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=(o=void 0,i(f)),b=v.next();!b.done;b=v.next()){y(b.value)}}catch(e){o={error:e}}finally{try{b&&!b.done&&(l=v.return)&&l.call(v)}finally{if(o)throw o.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=(o=void 0,i(y.addedNodes)),x=b.next();!x.done;x=b.next()){v(x.value)}}catch(e){o={error:e}}finally{try{x&&!x.done&&(l=b.return)&&l.call(b)}finally{if(o)throw o.error}}}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}if(d.length>0)if("undefined"!=typeof requestAnimationFrame){requestAnimationFrame(function(){g.processBatchedWork()});try{for(var w=i(d),E=w.next();!E.done;E=w.next()){var A=E.value;this.batchedWork.add(A)}}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 S=i(d),D=S.next();!D.done;D=S.next()){(A=D.value)()}}catch(e){u={error:e}}finally{try{D&&!D.done&&(h=S.return)&&h.call(S)}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,o.logDebug)("[ABsmartly] Processing batched work:",r.length,"items");try{for(var n=i(r),a=n.next();!a.done;a=n.next()){(0,a.value)()}}catch(t){e={error:t}}finally{try{a&&!a.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,a="".concat(r.selector,"-").concat(i||"document","-").concat(n);if(!this.appliedSelectors.has(a)&&(this.debug&&(0,o.logDebug)("[ABsmartly] Applying pending change to element:",r.selector),this.applyFn(r,n,e))){this.appliedSelectors.add(a);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",a=!1;try{for(var l=i(this.pending.keys()),s=l.next();!s.done;s=l.next()){if(s.value.endsWith("-".concat(n))){a=!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(!a){var c=this.observers.get(n);c&&(c.disconnect(),this.observers.delete(n),this.debug&&(0,o.logDebug)("[ABsmartly] Disconnected observer for root:",n))}},e.prototype.cleanupObservers=function(){var e,t,r,n,a,l,s=[];try{for(var c=i(this.observers.keys()),u=c.next();!u.done;u=c.next()){var h=u.value,g=!1;try{for(var d=(r=void 0,i(this.pending.keys())),p=d.next();!p.done;p=d.next()){if(p.value.endsWith("-".concat(h))){g=!0;break}}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}g||s.push(h)}}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()){h=y.value;var v=this.observers.get(h);v&&(v.disconnect(),this.observers.delete(h),this.debug&&(0,o.logDebug)("[ABsmartly] Cleaned up observer for root:",h))}}catch(e){a={error:e}}finally{try{y&&!y.done&&(l=f.return)&&l.call(f)}finally{if(a)throw a.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,o.logDebug)("[ABsmartly] PendingChangeManager destroyed")},e.prototype.getPendingCount=function(){var e,t,r=0;try{for(var n=i(this.pending.values()),a=n.next();!a.done;a=n.next()){r+=a.value.length}}catch(t){e={error:t}}finally{try{a&&!a.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()),a=n.next();!a.done;a=n.next()){if(a.value.some(function(t){return t.experimentName===e}))return!0}}catch(e){t={error:e}}finally{try{a&&!a.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,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},a=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;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 o=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"]),a=i.next();!a.done;a=i.next()){var l=a.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{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return this.debug&&(0,o.logDebug)("[HTMLInjector] Invalid injection key:",e),null},e.prototype.collectInjections=function(e,t){var r,a,s,c,u,h,g,d;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),A=E[0],S=E[1];if(S&&"object"==typeof S){if(S.urlFilter)if(!l.URLMatcher.matches(S.urlFilter,t)){this.debug&&(0,o.logDebug)("[HTMLInjector] Skipping ".concat(m," variant ").concat(A," - URL filter doesn't match:"),{currentUrl:t,urlFilter:S.urlFilter});continue}var D=S.data;if(D&&"object"==typeof D)try{for(var C=(u=void 0,n(Object.entries(D))),_=C.next();!_.done;_=C.next()){var M=i(_.value,2),O=M[0],P=M[1];if("string"==typeof P){var T=this.parseInjectionKey(O);if(T){var j={code:P,priority:T.priority,location:T.location};p.has(T.location)||p.set(T.location,[]),p.get(T.location).push(j),this.debug&&(0,o.logDebug)("[HTMLInjector] Collected injection:",{experiment:m,variant:A,location:T.location,priority:T.priority,codeLength:P.length})}}else this.debug&&(0,o.logDebug)("[HTMLInjector] Skipping non-string injection code for key ".concat(O,":"),P)}}catch(e){u={error:e}}finally{try{_&&!_.done&&(h=C.return)&&h.call(C)}finally{if(u)throw u.error}}else this.debug&&(0,o.logDebug)("[HTMLInjector] Invalid injection data for ".concat(m," variant ").concat(A,":"),D)}else this.debug&&(0,o.logDebug)("[HTMLInjector] Invalid injection data for ".concat(m," variant ").concat(A,":"),S)}}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&&(a=f.return)&&a.call(f)}finally{if(r)throw r.error}}try{for(var R=n(p),N=R.next();!N.done;N=R.next()){var L=i(N.value,2),k=L[0],B=L[1];B.sort(function(e,t){return t.priority-e.priority}),this.debug&&(0,o.logDebug)("[HTMLInjector] Sorted ".concat(k," injections by priority:"),{location:k,count:B.length,priorities:B.map(function(e){return e.priority})})}}catch(e){g={error:e}}finally{try{N&&!N.done&&(d=R.return)&&d.call(R)}finally{if(g)throw g.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 h=i(u.value,2),g=h[0],d=h[1],p="headStart"===g||"bodyStart"===g?a([],i(d),!1).reverse():d;try{for(var f=(l=void 0,n(p)),y=f.next();!y.done;y=f.next()){var v=y.value;this.injectAtLocation(g,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,o.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,o.logDebug)("[HTMLInjector] Injected at ".concat(e,":"),{location:e,codeLength:t.length,injectionId:n})}catch(t){this.debug&&(0,o.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,o.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,o.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,o.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,o.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 a=i.value,l=document.getElementById(a);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,o.logDebug)("[HTMLInjector] Destroyed and cleaned up all injections")},e}();t.HTMLInjector=s},254: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.DOMChangesPlugin=t.DOMChangesPluginLite=void 0;var a=r(702);Object.defineProperty(t,"DOMChangesPluginLite",{enumerable:!0,get:function(){return a.DOMChangesPluginLite}}),Object.defineProperty(t,"DOMChangesPlugin",{enumerable:!0,get:function(){return a.DOMChangesPluginLite}}),i(r(574),t),t.default=a.DOMChangesPluginLite},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.")},a=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},o=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;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 h=new Map;try{var g=this.context.data();if(this.debug&&(0,l.logDebug)("[VariantExtractor DEBUG] Raw context data structure:",{hasData:!!g,contextKeys:g?Object.keys(g):[],experimentCount:(null===(r=null==g?void 0:g.experiments)||void 0===r?void 0:r.length)||0,firstExperiment:(null===(n=null==g?void 0:g.experiments)||void 0===n?void 0:n[0])?{name:g.experiments[0].name,variantCount:(null===(s=g.experiments[0].variants)||void 0===s?void 0:s.length)||0,firstVariantStructure:(null===(c=g.experiments[0].variants)||void 0===c?void 0:c[0])?Object.keys(g.experiments[0].variants[0]):[]}:null,rawContextData:JSON.stringify(g).substring(0,500)+"..."}),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Extracting changes from context:",{hasData:!!g,experimentCount:(null===(u=null==g?void 0:g.experiments)||void 0===u?void 0:u.length)||0}),null==g?void 0:g.experiments){this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Available experiments:",g.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 d=i(g.experiments),p=d.next();!p.done;p=d.next()){var f=p.value,y=this.extractAllVariantsForExperiment(f);y.size>0?(h.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=a(e,2),r=t[0],n=t[1];return{variant:r,changeCount:n.length,changeTypes:o([],a(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=d.return)&&t.call(d)}finally{if(e)throw e.error}}}}catch(e){(0,l.logDebug)("[ABsmartly] Error extracting DOM changes:",e)}return this.cachedAllChanges=h,h},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 a=null;if(i.config)try{var o="string"==typeof i.config?JSON.parse(i.config):i.config;(0,l.logDebug)("[VariantExtractor DEBUG] [".concat(e.name,"] Parsed config for variant ").concat(n,":"),o),o&&o[this.variableName]?(a=o[this.variableName],(0,l.logDebug)("[VariantExtractor DEBUG] [".concat(e.name,"] ✓ Found DOM changes in config[").concat(this.variableName,"]:"),a)):(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(a){var s=this.extractChangesFromData(a);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 a=i(e),o=a.next();!o.done;o=a.next()){var s=o.value;this.isValidChange(s)?n.push(s):this.debug&&(0,l.logDebug)("[ABsmartly] Invalid DOM change:",s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}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,o([],a(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 a=n.variants[i];if(a){var o=null;if(a.variables&&a.variables[this.variableName])o=a.variables[this.variableName];else if(a.config)try{var s="string"==typeof a.config?JSON.parse(a.config):a.config;s&&s[this.variableName]&&(o=s[this.variableName])}catch(e){(0,l.logDebug)("[VariantExtractor] Failed to parse variant.config:",e)}if(o){if("string"==typeof o)try{o=JSON.parse(o)}catch(e){(0,l.logDebug)("[ABsmartly] Failed to parse DOM changes JSON:",e);continue}t.set(i,o)}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 o=this.getAllVariantsData(e),l=!1;try{for(var c=i(o),u=c.next();!u.done;u=c.next()){var h=a(u.value,2)[1];if(h&&"object"==typeof h&&!Array.isArray(h)&&"urlFilter"in h){var g=h;if(g.urlFilter&&(l=!0,s.URLMatcher.matches(g.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 a=i(n.experiments),o=a.next();!o.done;o=a.next()){var s=o.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{o&&!o.done&&(t=a.return)&&t.call(a)}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 a=null;if(i.variables&&i.variables.__inject_html)a=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 o="string"==typeof i.config?JSON.parse(i.config):i.config;o&&o.__inject_html&&(a=o.__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(a&&"object"==typeof a&&!Array.isArray(a)){var s=a,c=s.urlFilter,u=n(s,["urlFilter"]),h={data:u,urlFilter:c||void 0};t.set(r,h),this.debug&&(0,l.logDebug)("[VariantExtractor] Extracted __inject_html for ".concat(e.name," variant ").concat(r,":"),{keys:Object.keys(u),hasUrlFilter:!!c})}else a&&this.debug&&(0,l.logDebug)("[VariantExtractor] Invalid __inject_html format in ".concat(e.name," variant ").concat(r),a)}}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,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMPersistenceManager=void 0;var a=r(609),o=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,o,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)),h=u.next();!h.done;h=u.next()){var g=h.value.replace(/([A-Z])/g,"-$1").toLowerCase();c[g]=e.style.getPropertyValue(g)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}(0,a.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,a.logDebug)("[PERSISTENCE-OBSERVER] Setting up persistence observer",{timestamp:Date.now()}),this.persistenceObserver=new MutationObserver(function(t){var r,o;e.config.debug&&(0,a.logDebug)("[MUTATION-DETECTED] Persistence observer detected mutations",{mutationCount:t.length,timestamp:Date.now()});var l=function(t){var r,o,l,s,c,u,h,g,d=t.target;if(e.reapplyingElements.has(d))return e.config.debug&&(0,a.logDebug)("[MUTATION-SKIP] Skipping mutation - currently reapplying",{element:d.tagName}),"continue";var p=e.watchedElements.get(d);if(p){if(e.config.debug){var f="mutation:".concat(d.tagName,":").concat(d.getAttribute("name")||d.className);(M=Date.now())-(O=e.reapplyLogThrottle.get(f)||0)>5e3&&((0,a.logDebug)("[MUTATION-ON-WATCHED] Mutation detected on watched element",{element:d.tagName,attributeName:t.attributeName,oldValue:t.oldValue,experiments:Array.from(p)}),e.reapplyLogThrottle.set(f,M))}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,A=!1;if("style"===E.type&&"style"===t.attributeName&&!1!==E.persistStyle)A=e.checkStyleOverwritten(d,E.value);else if("attribute"===E.type&&!1!==E.persistAttribute){if(E.value&&"object"==typeof E.value)try{for(var S=(c=void 0,n(Object.keys(E.value))),D=S.next();!D.done;D=S.next()){var C=D.value;if(t.attributeName===C){A=e.checkAttributeOverwritten(d,E.value);break}}}catch(e){c={error:e}}finally{try{D&&!D.done&&(u=S.return)&&u.call(S)}finally{if(c)throw c.error}}}else"javascript"===E.type&&!0===E.persistScript&&E.value&&"string"==typeof E.value&&(A="style"===t.attributeName||"class"===t.attributeName);if(A){e.reapplyingElements.add(d);var _="".concat(m,"-").concat(E.selector),M=Date.now(),O=e.reapplyLogThrottle.get(_)||0;if(e.config.debug&&M-O>5e3&&((0,a.logDebug)("[REAPPLY-TRIGGERED] Reapplying after mutation (React/framework conflict detected)",{experimentName:m,selector:E.selector,element:d.tagName,changeType:E.type,timestamp:M}),e.reapplyLogThrottle.set(_,M),e.reapplyLogThrottle.size>100)){var P=M-6e4;try{for(var T=(h=void 0,n(e.reapplyLogThrottle.entries())),j=T.next();!j.done;j=T.next()){var R=i(j.value,2),N=R[0];R[1]<P&&e.reapplyLogThrottle.delete(N)}}catch(e){h={error:e}}finally{try{j&&!j.done&&(g=T.return)&&g.call(T)}finally{if(h)throw h.error}}}try{e.config.onReapply(E,m)}catch(t){e.config.debug&&(0,a.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(d)},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&&(o=y.return)&&o.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&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}),this.persistenceObserver.observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0}),this.config.debug&&(0,a.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,a;try{for(var o=n(Object.entries(t)),l=o.next();!l.done;l=o.next()){var s=i(l.value,2),c=s[0],u=s[1],h=c.replace(/([A-Z])/g,"-$1").toLowerCase(),g=e.style.getPropertyValue(h),d=e.style.getPropertyPriority(h);if(g!==u||u.includes("!important")&&!d)return!0}}catch(e){r={error:e}}finally{try{l&&!l.done&&(a=o.return)&&a.call(o)}finally{if(r)throw r.error}}return!1},e.prototype.checkAttributeOverwritten=function(e,t){var r,a;try{for(var o=n(Object.entries(t)),l=o.next();!l.done;l=o.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&&(a=o.return)&&a.call(o)}finally{if(r)throw r.error}}return!1},e}();t.DOMPersistenceManager=o},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,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},a=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;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,a){if(t.DEBUG){l("".concat(a?"✓":"✗"," Applied ").concat(n," change to ").concat(i," element(s)"),{experimentName:e,selector:r,changeType:n,elementsCount:i,success:a})}},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,a([e],i(t),!1))};var o=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),o=n[0],l=n[1];if(o.includes("Original state already stored"))return;if(o.includes("State store operation"))return;if(o.includes("Performance:")&&(null==l?void 0:l.duration)&&l.duration<5)return;if(o.includes("Message sent:")||o.includes("Message received:"))return;var s=(new Date).toISOString(),c="[ABsmartly Debug]";console.log("".concat(c," [").concat(s,"] ").concat(o),l)}else if(1===e.length&&"string"==typeof e[0]){if((o=e[0]).includes("Original state already stored"))return;if(o.includes("State store operation"))return;if(o.includes("Message sent:")||o.includes("Message received:"))return;s=(new Date).toISOString(),c="[ABsmartly Debug]";console.log("".concat(c," [").concat(s,"] ").concat(o))}else console.log.apply(console,a([],i(e),!1))}t.DEBUG=o.BUILD_DEBUG},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,a){function o(e){try{s(n.next(e))}catch(e){a(e)}}function l(e){try{s(n.throw(e))}catch(e){a(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(o,l)}s((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=l(0),o.throw=l(1),o.return=l(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(a=0)),a;)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 a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){a.label=l[1];break}if(6===l[0]&&a.label<i[1]){a.label=i[1],i=l;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(l);break}i[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}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.")},l=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMChangesPluginLite=void 0;var s=r(964),c=r(356),u=r(693),h=r(713),g=r(253),d=r(609),p=r(973),f=r(481),y=r(943),v=r(834),m=function(){function e(t){var r,n,i,a,o,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!==(a=t.variableName)&&void 0!==a?a:"__dom_changes",debug:null!==(o=t.debug)&&void 0!==o&&o,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 h.ExposureTracker(this.config.context,this.config.debug),this.htmlInjector=new g.HTMLInjector(this.config.debug),this.persistenceManager=new f.DOMPersistenceManager({debug:this.config.debug,onReapply:function(e,t){(0,d.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,d.logDebug)("[DOMChangesPluginLite] Context is ready, starting initialization"),y.initialize()}).catch(function(e){throw(0,d.logDebug)("[DOMChangesPluginLite] ERROR during initialization:",e),e})}return e.prototype.ready=function(){return i(this,void 0,void 0,function(){return a(this,function(e){return[2,this.readyPromise]})})},e.prototype.initialize=function(){return i(this,void 0,void 0,function(){var t,r,n;return a(this,function(i){switch(i.label){case 0:if(this.initialized)return(0,d.logDebug)("Plugin already initialized"),[2];t=performance.now(),(0,d.logDebug)("Initializing ABsmartly DOM Changes Plugin Lite",{version:e.VERSION,config:{autoApply:this.config.autoApply,spa:this.config.spa,visibilityTracking:this.config.visibilityTracking,DEBUG:d.DEBUG}}),i.label=1;case 1:return i.trys.push([1,4,,5]),this.config.spa?(this.setupMutationObserver(),this.setupURLChangeListener()):(0,d.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,d.logPerformance)("Plugin initialization",r),(0,d.logDebug)("[ABsmartly] DOM plugin lite loaded successfully (v".concat(e.VERSION,")")),this.config.debug&&(0,d.logDebug)("[ABsmartly] DOM Changes Plugin Lite initialized with debug mode"),[3,5];case 4:throw n=i.sent(),(0,d.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,a,s,c,u,h,g,p,f;try{for(var y=o(t),v=y.next();!v.done;v=y.next()){var m=v.value;if("childList"===m.type)try{for(var b=(i=void 0,o(m.addedNodes)),x=b.next();!x.done;x=b.next()){var w=x.value;if(w.nodeType===Node.ELEMENT_NODE){var E=w,A=(null===(f=e.persistenceManager)||void 0===f?void 0:f.getAppliedChanges())||new Map;try{for(var S=(s=void 0,o(A)),D=S.next();!D.done;D=S.next()){var C=l(D.value,2),_=C[0],M=C[1];try{for(var O=(u=void 0,o(M)),P=O.next();!P.done;P=O.next()){var T=P.value;try{var j=E.matches(T.selector)?[E]:Array.from(E.querySelectorAll(T.selector));try{for(var R=(g=void 0,o(j)),N=R.next();!N.done;N=R.next()){var L=N.value;e.config.debug&&(0,d.logDebug)("[SPA-REAPPLY] Re-applying change to newly added element (React hydration recovery)",{experimentName:_,selector:T.selector,element:L.tagName,changeType:T.type}),e.domManipulator.applyChange(T,_)}}catch(e){g={error:e}}finally{try{N&&!N.done&&(p=R.return)&&p.call(R)}finally{if(g)throw g.error}}}catch(e){}}}catch(e){u={error:e}}finally{try{P&&!P.done&&(h=O.return)&&h.call(O)}finally{if(u)throw u.error}}}}catch(e){s={error:e}}finally{try{D&&!D.done&&(c=S.return)&&c.call(S)}finally{if(s)throw s.error}}}}}catch(e){i={error:e}}finally{try{x&&!x.done&&(a=b.return)&&a.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,d.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,d.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 a(this,function(t){switch(t.label){case 0:return e=window.location.href,(0,d.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,d.logDebug)("[ABsmartly] URL change listener set up for SPA mode")},e.prototype.removeAllChanges=function(){return i(this,void 0,void 0,function(){return a(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,d.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 a(this,function(a){switch(a.label){case 0:e=performance.now(),t=window.location.href,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.config.context.ready()];case 2:return a.sent(),[3,4];case 3:return r=a.sent(),(0,d.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 a.sent(),i=performance.now()-e,(0,d.logPerformance)("Apply injections and changes (parallel)",i),this.config.debug&&(0,d.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),a(this,function(n){return 0===e.size?(this.config.debug&&(0,d.logDebug)("[ABsmartly] No HTML injections found"),[2]):(r=this.htmlInjector.collectInjections(e,t),this.htmlInjector.inject(r),this.config.debug&&(0,d.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,h,g,f,y,v,m,b,x,w,E,A,S,D,C,_,M,O,P,T,j,R,N,L,k,B,I,V,U,F,G,H,z,W,J,Y,q,X,$,Z,K,Q,ee,te,re,ne,ie,ae,oe;return a(this,function(a){switch(a.label){case 0:t=performance.now(),r=window.location.href,(0,d.logDebug)("Starting to apply changes",{specificExperiment:e||"all",url:r,action:"apply_start"}),this.config.debug&&((0,d.logDebug)("[ABsmartly] === DOM Changes Application Starting ==="),(0,d.logDebug)("[ABsmartly] Target:",e||"all experiments"),(0,d.logDebug)("[ABsmartly] Current URL:",r),(0,d.logDebug)("[ABsmartly] Context ready:",!0)),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.config.context.ready()];case 2:return a.sent(),[3,4];case 3:return n=a.sent(),(0,d.logDebug)("[ABsmartly] Failed to wait for context ready:",n),[2];case 4:this.variantExtractor.clearCache(),i=this.getAllExperimentsData(),s=0,c=new Map,(0,d.logDebug)("[APPLY-CHANGES] Experiments found with DOM changes:",{experimentNames:Array.from(i.keys()),totalCount:i.size,currentURL:r}),0===i.size&&(0,d.logDebug)("[APPLY-CHANGES] ⚠️ No experiments found with DOM changes - nothing to process");try{for(u=o(i),h=u.next();!h.done;h=u.next())if(g=l(h.value,2),f=g[0],y=g[1],(0,d.logDebug)("[APPLY-CHANGES] [".concat(f,"] Starting to process experiment"),{experimentName:f,currentURL:r}),e&&f!==e)(0,d.logDebug)("[APPLY-CHANGES] [".concat(f,"] ⏭️ Skipping - filtering for different experiment"),{filteringFor:e});else if(null!=(v=this.config.context.peek(f)))if((0,d.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,d.logDebug)("[APPLY-CHANGES] [".concat(f,"] ✓ At least one variant matches current URL")),w=this.shouldApplyVisualChanges(m,b,r),E=this.extractChangesFromData(m,x),A=this.extractAllVariantChanges(f),S=A.some(function(e){return e&&e.length>0}),S){if(D={total:(null==E?void 0:E.length)||0,success:0,pending:0},this.config.debug&&(0,d.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,d.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(Q=void 0,C=o(E),_=C.next();!_.done;_=C.next())if("delete"===(X=_.value).type&&X.trigger_on_view)this.config.debug&&(0,d.logDebug)("[ABsmartly] Deferring delete change until after viewport trigger for '".concat(f,"'"),{selector:X.selector});else if(this.domManipulator.applyChange(X,f))s++,D.success++;else if("create"!==X.type&&"styleRules"!==X.type)try{0===document.querySelectorAll(X.selector).length&&(this.config.spa||X.waitForElement)&&D.pending++}catch(e){this.config.debug&&(0,d.logDebug)("[ABsmartly] Invalid selector: ".concat(X.selector),e)}}catch(e){Q={error:e}}finally{try{_&&!_.done&&(ee=C.return)&&ee.call(C)}finally{if(Q)throw Q.error}}else E&&E.length>0&&(0,d.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(M=!1,O=!1,P=this.variantExtractor.getAllVariantsData(f),this.config.debug){(0,d.logDebug)("[ABsmartly] Checking trigger types for experiment '".concat(f,"' on URL: ").concat(r),{allVariantsDataSize:P.size,allVariantChangesLength:A.length});try{for(te=void 0,T=o(P),j=T.next();!j.done;j=T.next())R=l(j.value,2),N=R[0],L=R[1],(0,d.logDebug)("[ABsmartly] Variant ".concat(N," data structure:"),{isArray:Array.isArray(L),isObject:"object"==typeof L,hasUrlFilter:L&&"object"==typeof L&&!Array.isArray(L)&&"urlFilter"in L,keys:L&&"object"==typeof L&&!Array.isArray(L)?Object.keys(L):"N/A"})}catch(e){te={error:e}}finally{try{j&&!j.done&&(re=T.return)&&re.call(T)}finally{if(te)throw te.error}}}try{for(ne=void 0,k=o(P),B=k.next();!B.done;B=k.next())if(I=l(B.value,2),V=I[0],U=I[1],(F=A[V])&&0!==F.length){if(G=!0,U&&"object"==typeof U&&!Array.isArray(U)&&"urlFilter"in(H=U)&&H.urlFilter&&(z=H,G=p.URLMatcher.matches(z.urlFilter,r),this.config.debug&&(0,d.logDebug)("[ABsmartly] Variant ".concat(V," has URL filter, matches: ").concat(G))),G){W=!1,J=!1;try{for(ae=void 0,Y=o(F),q=Y.next();!q.done;q=Y.next())(X=q.value).trigger_on_view?W=!0:this.hasImmediateDomAnchor(X)&&(J=!0)}catch(e){ae={error:e}}finally{try{q&&!q.done&&(oe=Y.return)&&oe.call(Y)}finally{if(ae)throw ae.error}}W&&(M=!0),J&&(O=!0),this.config.debug&&(0,d.logDebug)("[ABsmartly] Variant ".concat(V," matches URL - hasImmediate: ").concat(J,", hasViewport: ").concat(W),{experimentName:f,variantIndex:V,hasImmediateDomAnchor:J})}else this.config.debug&&(0,d.logDebug)("[ABsmartly] Variant ".concat(V," does NOT match URL - skipping"));if(M&&O)break}}catch(e){ne={error:e}}finally{try{B&&!B.done&&(ie=k.return)&&ie.call(k)}finally{if(ne)throw ne.error}}this.config.debug&&(0,d.logDebug)("[TRIGGER-DETECTION] [".concat(f,"] Final trigger decision for '").concat(f,"':"),{experimentName:f,userVariant:v,hasImmediateTrigger:O,hasViewportTrigger:M,willRegisterExperiment:M||O,userChangesCount:(null==E?void 0:E.length)||0,allVariantsChangesCount:A.map(function(e){return e.length})}),M||O?((0,d.logDebug)("[TRIGGER-DETECTION] [".concat(f,"] ✓ REGISTERING EXPERIMENT - Calling exposureTracker.registerExperiment()"),{experimentName:f,userVariant:v,hasImmediateTrigger:O,hasViewportTrigger:M,changesForUser:(null==E?void 0:E.length)||0,allVariantCounts:A.map(function(e,t){return{variant:t,count:e.length}})}),this.exposureTracker.registerExperiment(f,v||0,E||[],A,O,M)):(0,d.logDebug)("[TRIGGER-DETECTION] [".concat(f,"] ⚠️ No triggers detected - experiment will NOT be registered!"),{experimentName:f,userVariant:v,hasAnyChangesInAnyVariant:S,allVariantsChangesCount:A.map(function(e){return e.length})}),c.set(f,D),(0,d.logExperimentSummary)(f,D.total,D.success,D.pending)}else this.config.debug&&(0,d.logDebug)("[ABsmartly] Skipping experiment '".concat(f,"' - no variants have changes"));else(0,d.logDebug)("[APPLY-CHANGES] [".concat(f,"] ⏭️ Skipping - no variant matches URL: ").concat(r),{experimentName:f,currentURL:r});else(0,d.logDebug)("[APPLY-CHANGES] [".concat(f,"] ⏭️ Skipping - no variant assigned (peek returned ").concat(v,")"),{experimentName:f})}catch(e){Z={error:e}}finally{try{h&&!h.done&&(K=u.return)&&K.call(u)}finally{if(Z)throw Z.error}}return $=performance.now()-t,(0,d.logPerformance)("Apply changes",$,{totalApplied:s,experiments:c.size}),this.config.debug&&((0,d.logDebug)("[ABsmartly] === DOM Changes Application Complete ==="),(0,d.logDebug)("[ABsmartly] Summary:",{totalChangesApplied:s,experimentsProcessed:c.size,duration:"".concat($.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,d.logDebug)("[ABsmartly] DOM changes applied"),this.emit("changes-applied",{count:s,experimentName:e}),[2]}})})},e.prototype.hasImmediateDomAnchor=function(e){try{return e.waitForElement?null!==document.querySelector(e.observerRoot||"body"):"create"===e.type?!!e.targetSelector&&null!==document.querySelector(e.targetSelector):null!==document.querySelector(e.selector)}catch(t){return this.config.debug&&(0,d.logDebug)("[ABsmartly] Failed to evaluate immediate DOM anchor:",{selector:e.selector,targetSelector:e.targetSelector,type:e.type,error:t}),!1}},e.prototype.getAllExperimentsData=function(){var e,t,r=new Map,n=this.variantExtractor.extractAllChanges();(0,d.logDebug)("[GET-EXPERIMENTS] Extracting experiment data from context",{experimentsWithChanges:Array.from(n.keys()),totalCount:n.size});try{for(var i=o(n),a=i.next();!a.done;a=i.next()){var s=l(a.value,1)[0],c=this.config.context.peek(s);if((0,d.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] Checking experiment"),{experimentName:s,currentVariant:c,variantIsValid:null!=c}),null!=c){var u=this.variantExtractor.getAllVariantsData(s),h=u.get(c);this.config.debug&&(0,d.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] Variant data lookup:"),{experimentName:s,userVariant:c,variantDataExists:!!h,allVariantsInMap:Array.from(u.keys()),userVariantInMap:u.has(c)}),h||(0,d.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,d.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] ✓ Including experiment (variant ").concat(c,")"));var g=null,p={};if(h&&"object"==typeof h&&!Array.isArray(h)&&"changes"in h){var f=h;g=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:h,urlFilter:g,globalDefaults:p})}else(0,d.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] ⏭️ Skipping - context.peek() returned ").concat(c))}}catch(t){e={error:t}}finally{try{a&&!a.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,a,o,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!==(a=e.persistAttribute)&&void 0!==a?a:t.persistAttribute,persistScript:null!==(o=e.persistScript)&&void 0!==o?o: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=[],a=function(e){var a=t[e],o=r.get(e);if(!a||0===a.length)return i.push([]),"continue";var l={};if(o&&"object"==typeof o&&!Array.isArray(o)&&"changes"in o){var s=o;l={waitForElement:s.waitForElement,persistStyle:s.persistStyle,persistAttribute:s.persistAttribute,persistScript:s.persistScript,important:s.important,observerRoot:s.observerRoot}}var c=a.map(function(e){var t,r,i,a,o,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!==(a=e.persistScript)&&void 0!==a?a:l.persistScript,important:null!==(o=e.important)&&void 0!==o?o:l.important,observerRoot:null!==(s=e.observerRoot)&&void 0!==s?s:l.observerRoot})});i.push(c)},o=0;o<t.length;o++)a(o);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,d.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,d.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 a=o(i),l=a.next();!l.done;l=a.next()){var s=l.value;try{s(t)}catch(t){(0,d.logDebug)("[ABsmartly] Error in event listener for ".concat(e,":"),t)}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}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],a=n.replace(/([A-Z])/g,"-$1").toLowerCase(),o=r?" !important":"";return" ".concat(a,": ").concat(i).concat(o,";")}).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,d.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=o(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,d.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,d.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,d.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,d.logDebug)("[ABsmartly] DOMChangesPluginLite registered in global window.__ABSMARTLY_PLUGINS__ (initialized=".concat(t,")"))},e.prototype.unregisterGlobally=function(){(0,y.unregisterPlugin)("dom"),this.config.debug&&(0,d.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,d.logDebug)("[ABsmartly] Anti-flicker timeout reached (".concat(e.config.hideTimeout,"ms), showing content")),e.showContent()},this.config.hideTimeout),this.config.debug&&(0,d.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,d.logDebug)("[ABsmartly] Anti-flicker fade-in complete, style removed")},n),this.config.debug&&(0,d.logDebug)("[ABsmartly] Anti-flicker fading in with transition: ".concat(this.config.hideTransition))}else t.remove(),this.config.debug&&(0,d.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,a){function o(e){try{s(n.next(e))}catch(e){a(e)}}function l(e){try{s(n.throw(e))}catch(e){a(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(o,l)}s((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=l(0),o.throw=l(1),o.return=l(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(a=0)),a;)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 a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){a.label=l[1];break}if(6===l[0]&&a.label<i[1]){a.label=i[1],i=l;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(l);break}i[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}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.")},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},l=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;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,h,g,d,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=a(n),A=E.next();!A.done;A=E.next()){var S=A.value;try{for(var D=(g=void 0,a(S)),C=D.next();!C.done;C=D.next()){var _=C.value;_.trigger_on_view&&("move"===_.type?(x.has(_.selector)||x.set(_.selector,new Set),_.targetSelector&&x.get(_.selector).add(_.targetSelector)):"delete"===_.type?w.add(_.selector):m.add(_.selector))}}catch(e){g={error:e}}finally{try{C&&!C.done&&(d=D.return)&&d.call(D)}finally{if(g)throw g.error}}}}catch(e){u={error:e}}finally{try{A&&!A.done&&(h=E.return)&&h.call(E)}finally{if(u)throw u.error}}var M=function(r){for(var i,o,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 h=0;h<l.length;h++){var g=l[h];h!==u&&O.createContainerPlaceholder(e,r,g.targetSelector,g.position)}}else{m.add(r);try{for(var d=(i=void 0,a(l)),p=d.next();!p.done;p=d.next()){g=p.value;O.createContainerPlaceholder(e,r,g.targetSelector,g.position)}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}},O=this;try{for(var P=a(x),T=P.next();!T.done;T=P.next()){M(o(T.value,1)[0])}}catch(e){p={error:e}}finally{try{T&&!T.done&&(f=P.return)&&f.call(P)}finally{if(p)throw p.error}}var j=function(t){r.some(function(e){return"delete"===e.type&&e.selector===t&&e.trigger_on_view})?0===R.createInPlacePlaceholder(e,t)&&(m.add(t),R.debug&&(0,s.logDebug)("[EXPOSURE] [".concat(e,"] Delete element doesn't exist yet - tracking selector for when it appears"),{selector:t})):m.add(t)},R=this;try{for(var N=a(w),L=N.next();!L.done;L=N.next()){j(L.value)}}catch(e){y={error:e}}finally{try{L&&!L.done&&(v=N.return)&&v.call(N)}finally{if(y)throw y.error}}var k={experimentName:e,variant:t,changes:r,allPossibleSelectors:new Set(l(l([],o(m),!1),o(b),!1)),triggered:!1,hasImmediateTrigger:i,hasViewportTrigger:c};this.experiments.set(e,k),this.debug&&(0,s.logDebug)("[ABsmartly] Experiment ".concat(e," will track selectors:"),Array.from(k.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(k.allPossibleSelectors),allVariantCounts:n.map(function(e,t){return{variant:t,count:e.length}})}),this.observeSelectors(e,k.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,a;void 0===n&&(n="lastChild");var o=document.querySelector(r);if(o){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":o.insertBefore(c,o.firstChild);break;case"lastChild":default:o.appendChild(c);break;case"before":null===(i=o.parentElement)||void 0===i||i.insertBefore(c,o);break;case"after":null===(a=o.parentElement)||void 0===a||a.insertBefore(c,o.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,a=0;a<n.length;a++){var o=n[a],l=t.replace(/[^a-zA-Z0-9-]/g,"_"),c="absmartly-delete-".concat(e,"-").concat(l,"-").concat(a),u="".concat(e,"-delete-").concat(t,"-").concat(a);if(!o.hasAttribute("data-absmartly-delete-placeholder")){var h=document.createElement("span");h.id=c,h.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 ",h.setAttribute("data-absmartly-placeholder","true"),h.setAttribute("data-absmartly-delete-placeholder","true"),h.setAttribute("data-absmartly-original-selector",t),h.setAttribute("data-absmartly-experiment",e),h.setAttribute("aria-hidden","true"),null===(r=o.parentElement)||void 0===r||r.insertBefore(h,o),o.remove(),this.placeholders.set(u,h),this.trackElement(h,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,o;try{for(var l=a(t),s=l.next();!s.done;s=l.next()){var c=s.value,u=document.querySelectorAll(c);if(u.length>0)try{for(var h=(i=void 0,a(u)),g=h.next();!g.done;g=h.next()){var d=g.value;this.trackElement(d,e)}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=h.return)&&o.call(h)}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=a(t),o=i.next();!o.done;o=i.next()){var l=o.value;l.isIntersecting&&e.handleElementVisible(l.target)}}catch(e){r={error:e}}finally{try{o&&!o.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,o;try{for(var l=a(t),s=l.next();!s.done;s=l.next()){var c=s.value;try{for(var u=(i=void 0,a(c.addedNodes)),h=u.next();!h.done;h=u.next()){var g=h.value;g instanceof Element&&e.checkNewElement(g)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=u.return)&&o.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=a(this.experiments),u=c.next();!u.done;u=c.next()){var h=o(u.value,2),g=h[0],d=h[1];try{for(var p=(n=void 0,a(d.allPossibleSelectors)),f=p.next();!f.done;f=p.next()){var y=f.value;e.matches(y)&&this.trackElement(e,g);try{for(var v=(l=void 0,a(e.querySelectorAll(y))),m=v.next();!m.done;m=v.next()){var b=m.value;this.trackElement(b,g)}}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=o.experiments.get(t);if(r&&!r.triggered&&(o.triggerExposure(t).catch(function(e){(0,s.logDebug)("[ABsmartly] Failed to trigger exposure for ".concat(t,":"),e)}),o.debug)){var i=n.isPlaceholder?e.getAttribute("data-absmartly-original-selector"):o.getElementSelector(e);(0,s.logDebug)("[ABsmartly] Triggering exposure for ".concat(t," via ").concat(i))}},o=this;try{for(var l=a(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=a(this.trackedElements),s=l.next();!s.done;s=l.next()){var c=o(s.value,2),u=c[0],h=c[1];h.experiments.delete(e),0===h.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 g=a(this.placeholders),d=g.next();!d.done;d=g.next()){var p=o(d.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{d&&!d.done&&(i=g.return)&&i.call(g)}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=a(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.6",t.BUILD_DEBUG=!1},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,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},a=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;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 o=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"),a="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",a+e+"\n//# sourceURL=".concat(i))(t),!0}catch(g){var o=g instanceof Error?g.message:String(g);if(!(g instanceof EvalError||/unsafe-eval|Content Security Policy|CSP|refused to evaluate/i.test(o)))return this.reportJsExecutionFailure({experimentName:r,selector:n,reason:"runtime",error:o,stack:g instanceof Error?g.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(a).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(o,"; inline <script> did not execute (likely blocked by script-src without 'unsafe-inline').")}),!1)}catch(e){var h=e instanceof Error?e.message:String(e);return this.reportJsExecutionFailure({experimentName:r,selector:n,reason:"csp",error:"CSP blocked dynamic script execution. eval(): ".concat(o,"; inline <script>: ").concat(h),stack:e instanceof Error?e.stack:void 0}),!1}}},e.prototype.reportJsExecutionFailure=function(e){try{(0,o.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,a,l,s,c,u,h,g,d,p,f,y,v,m=this;if(!e.enabled&&void 0!==e.enabled)return(0,o.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===(h=null===(u=this.plugin.config)||void 0===u?void 0:u.context)||void 0===h?void 0:h.peek(t);this.debug&&(0,o.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===(g=(new Error).stack)||void 0===g?void 0:g.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,o.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===(d=this.plugin.config)||void 0===d?void 0:d.spa)?(this.debug&&(0,o.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,o.logDebug)("[ABsmartly] No elements found for selector: ".concat(e.selector)),(0,o.logDebug)("No elements found for selector",{experimentName:t,selector:e.selector,changeType:e.type}),!1);try{for(var A=n(w),S=A.next();!S.done;S=A.next()){var D=S.value;if(this.debug&&"style"===e.type){var C={};if(e.value&&"object"==typeof e.value)try{for(var _=(a=void 0,n(Object.keys(e.value))),M=_.next();!M.done;M=_.next()){C[j=M.value.replace(/([A-Z])/g,"-$1").toLowerCase()]=D.style.getPropertyValue(j)}}catch(e){a={error:e}}finally{try{M&&!M.done&&(l=_.return)&&l.call(_)}finally{if(a)throw a.error}}(0,o.logDebug)("[DOM-BEFORE-APPLY] Element styles before change",{experimentName:t,selector:e.selector,element:D.tagName,oldStyles:C,newStyles:e.value})}if(this.applyChangeToElement(D,e),this.debug&&"style"===e.type){var O={};if(e.value&&"object"==typeof e.value)try{for(var P=(s=void 0,n(Object.keys(e.value))),T=P.next();!T.done;T=P.next()){var j;O[j=T.value.replace(/([A-Z])/g,"-$1").toLowerCase()]=D.style.getPropertyValue(j)}}catch(e){s={error:e}}finally{try{T&&!T.done&&(c=P.return)&&c.call(P)}finally{if(s)throw s.error}}(0,o.logDebug)("[DOM-AFTER-APPLY] Element styles after change",{experimentName:t,selector:e.selector,element:D.tagName,appliedStyles:O})}if("javascript"===e.type)if(e.value){var R=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,o.logDebug)("[JAVASCRIPT] [".concat(t,"] Executing JavaScript change"),{experimentName:t,userVariant:R,selector:e.selector,element:D.tagName,code:String(e.value).substring(0,100)+"..."});var N=String(e.value);this.executeUserJavaScript(N,D,t,e.selector)&&(E.push(D),this.debug&&(0,o.logDebug)("[JAVASCRIPT] [".concat(t,"] ✓ JavaScript executed successfully"),{experimentName:t,userVariant:R,selector:e.selector,element:D.tagName,code:N}))}else(0,o.logDebug)("[JAVASCRIPT] [".concat(t,"] ✗ No JavaScript code provided in change.value"),{experimentName:t,selector:e.selector});else if("move"===e.type){var L=e.targetSelector||(e.value&&"object"==typeof e.value?e.value.targetSelector:null),k=e.position||(e.value&&"object"==typeof e.value?e.value.position:null);if(L){var B=document.querySelector(L);B?(this.moveElement(D,B,k),E.push(D)):this.debug&&(0,o.logDebug)("[ABsmartly] Move target not found: ".concat(L))}}else E.push(D);"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(D,t,e):this.debug&&(0,o.logDebug)("[WATCH-SKIP] NOT watching element - no persist flag and SPA disabled",{experimentName:t,selector:e.selector,element:D.tagName,changeType:e.type,spaMode:null===(v=this.plugin.config)||void 0===v?void 0:v.spa})}}catch(e){r={error:e}}finally{try{S&&!S.done&&(i=A.return)&&i.call(A)}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 I=E.some(function(e){var t;return null===(t=m.plugin.reapplyingElements)||void 0===t?void 0:t.has(e)});return I||(0,o.logChangeApplication)(t,e.selector,e.type,E.length,!0),!0}return(0,o.logChangeApplication)(t,e.selector,e.type,0,!1),!1}catch(r){return this.debug&&(0,o.logDebug)("[ABsmartly] Error applying DOM change:",r,e),(0,o.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,a;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===(a=t.parentElement)||void 0===a||a.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 a=document.querySelector(e.targetSelector);if(!a)return this.debug&&(0,o.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 h=u.value;this.moveElement(h,a,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,o.logDebug)("[ABsmartly] Applied style rule: ".concat(n)),(0,o.logDebug)("[ABsmartly] CSS: ".concat(i))),this.trackAppliedChange(t,e),(0,o.logChangeApplication)(t,e.selector,"styleRules",1,!0),!0}catch(e){return this.debug&&(0,o.logDebug)("[ABsmartly] Error applying style rules:",e),!1}},e.prototype.applyChangeToElement=function(e,t){var r,l,s,c,u,h;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 g=n(Object.entries(t.value)),d=g.next();!d.done;d=g.next()){var p=i(d.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{d&&!d.done&&(l=g.return)&&l.call(g)}finally{if(r)throw r.error}}break;case"class":t.add&&Array.isArray(t.add)&&(s=e.classList).add.apply(s,a([],i(t.add),!1)),t.remove&&Array.isArray(t.remove)&&(c=e.classList).remove.apply(c,a([],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&&(h=b.return)&&h.call(b)}finally{if(u)throw u.error}}break;case"move":if(t.value&&"object"==typeof t.value){var A=t.value,S=document.querySelector(A.targetSelector);S?this.moveElement(e,S,A.position):this.debug&&(0,o.logDebug)("[ABsmartly] Move target not found: ".concat(A.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,o.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,o.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),a=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,a)}}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,o.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 a=t[n]={exports:{}};return e[n].call(a.exports,a,a.exports,r),a.exports}(254);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.ABsmartlyDOM=t():e.ABsmartlyDOM=t()}(this,()=>(()=>{"use strict";var e={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.")},a=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o};Object.defineProperty(t,"__esModule",{value:!0}),t.PendingChangeManager=void 0;var o=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,o.logDebug)("[ABsmartly] Observer root not found, using document:",r),i=void 0);var a="".concat(t.selector,"-").concat(i||"document");this.debug&&(0,o.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(a)||[];s.push(n(n({},e),{observerRoot:i})),this.pending.set(a,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 a=i.filter(function(e){return e.experimentName!==t});0===a.length?this.pending.delete(n):this.pending.set(n,a)}this.checkObserverCleanup(r)},e.prototype.removeAllPending=function(e){var t,r;try{for(var n=i(this.pending.entries()),o=n.next();!o.done;o=n.next()){var l=a(o.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{o&&!o.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,o.logDebug)("[ABsmartly] Started observer for root:",r)}},e.prototype.handleMutations=function(e,t){var r,n,o,l,s,c,u,h,g=this,d=[];try{for(var p=i(e),f=p.next();!f.done;f=p.next()){var y=f.value,v=function(e){var r,n,o,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 h=a(u.value,2),p=h[0],f=h[1];if(p.endsWith("-".concat(s))){var y=function(t){var r,n,a=t.change;if(e.matches(a.selector))return d.push(function(){return g.applyChange(e,t)}),"continue";var o=e.querySelectorAll(a.selector),l=function(e){d.push(function(){return g.applyChange(e,t)})};try{for(var s=(r=void 0,i(o)),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=(o=void 0,i(f)),b=v.next();!b.done;b=v.next()){y(b.value)}}catch(e){o={error:e}}finally{try{b&&!b.done&&(l=v.return)&&l.call(v)}finally{if(o)throw o.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=(o=void 0,i(y.addedNodes)),x=b.next();!x.done;x=b.next()){v(x.value)}}catch(e){o={error:e}}finally{try{x&&!x.done&&(l=b.return)&&l.call(b)}finally{if(o)throw o.error}}}}catch(e){r={error:e}}finally{try{f&&!f.done&&(n=p.return)&&n.call(p)}finally{if(r)throw r.error}}if(d.length>0)if("undefined"!=typeof requestAnimationFrame){requestAnimationFrame(function(){g.processBatchedWork()});try{for(var w=i(d),E=w.next();!E.done;E=w.next()){var A=E.value;this.batchedWork.add(A)}}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 S=i(d),D=S.next();!D.done;D=S.next()){(A=D.value)()}}catch(e){u={error:e}}finally{try{D&&!D.done&&(h=S.return)&&h.call(S)}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,o.logDebug)("[ABsmartly] Processing batched work:",r.length,"items");try{for(var n=i(r),a=n.next();!a.done;a=n.next()){(0,a.value)()}}catch(t){e={error:t}}finally{try{a&&!a.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,a="".concat(r.selector,"-").concat(i||"document","-").concat(n);if(!this.appliedSelectors.has(a)&&(this.debug&&(0,o.logDebug)("[ABsmartly] Applying pending change to element:",r.selector),this.applyFn(r,n,e))){this.appliedSelectors.add(a);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",a=!1;try{for(var l=i(this.pending.keys()),s=l.next();!s.done;s=l.next()){if(s.value.endsWith("-".concat(n))){a=!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(!a){var c=this.observers.get(n);c&&(c.disconnect(),this.observers.delete(n),this.debug&&(0,o.logDebug)("[ABsmartly] Disconnected observer for root:",n))}},e.prototype.cleanupObservers=function(){var e,t,r,n,a,l,s=[];try{for(var c=i(this.observers.keys()),u=c.next();!u.done;u=c.next()){var h=u.value,g=!1;try{for(var d=(r=void 0,i(this.pending.keys())),p=d.next();!p.done;p=d.next()){if(p.value.endsWith("-".concat(h))){g=!0;break}}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}g||s.push(h)}}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()){h=y.value;var v=this.observers.get(h);v&&(v.disconnect(),this.observers.delete(h),this.debug&&(0,o.logDebug)("[ABsmartly] Cleaned up observer for root:",h))}}catch(e){a={error:e}}finally{try{y&&!y.done&&(l=f.return)&&l.call(f)}finally{if(a)throw a.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,o.logDebug)("[ABsmartly] PendingChangeManager destroyed")},e.prototype.getPendingCount=function(){var e,t,r=0;try{for(var n=i(this.pending.values()),a=n.next();!a.done;a=n.next()){r+=a.value.length}}catch(t){e={error:t}}finally{try{a&&!a.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()),a=n.next();!a.done;a=n.next()){if(a.value.some(function(t){return t.experimentName===e}))return!0}}catch(e){t={error:e}}finally{try{a&&!a.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,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},a=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;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 o=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"]),a=i.next();!a.done;a=i.next()){var l=a.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{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return this.debug&&(0,o.logDebug)("[HTMLInjector] Invalid injection key:",e),null},e.prototype.collectInjections=function(e,t){var r,a,s,c,u,h,g,d;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),A=E[0],S=E[1];if(S&&"object"==typeof S){if(S.urlFilter)if(!l.URLMatcher.matches(S.urlFilter,t)){this.debug&&(0,o.logDebug)("[HTMLInjector] Skipping ".concat(m," variant ").concat(A," - URL filter doesn't match:"),{currentUrl:t,urlFilter:S.urlFilter});continue}var D=S.data;if(D&&"object"==typeof D)try{for(var C=(u=void 0,n(Object.entries(D))),_=C.next();!_.done;_=C.next()){var O=i(_.value,2),M=O[0],P=O[1];if("string"==typeof P){var T=this.parseInjectionKey(M);if(T){var R={code:P,priority:T.priority,location:T.location};p.has(T.location)||p.set(T.location,[]),p.get(T.location).push(R),this.debug&&(0,o.logDebug)("[HTMLInjector] Collected injection:",{experiment:m,variant:A,location:T.location,priority:T.priority,codeLength:P.length})}}else this.debug&&(0,o.logDebug)("[HTMLInjector] Skipping non-string injection code for key ".concat(M,":"),P)}}catch(e){u={error:e}}finally{try{_&&!_.done&&(h=C.return)&&h.call(C)}finally{if(u)throw u.error}}else this.debug&&(0,o.logDebug)("[HTMLInjector] Invalid injection data for ".concat(m," variant ").concat(A,":"),D)}else this.debug&&(0,o.logDebug)("[HTMLInjector] Invalid injection data for ".concat(m," variant ").concat(A,":"),S)}}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&&(a=f.return)&&a.call(f)}finally{if(r)throw r.error}}try{for(var j=n(p),N=j.next();!N.done;N=j.next()){var L=i(N.value,2),k=L[0],B=L[1];B.sort(function(e,t){return t.priority-e.priority}),this.debug&&(0,o.logDebug)("[HTMLInjector] Sorted ".concat(k," injections by priority:"),{location:k,count:B.length,priorities:B.map(function(e){return e.priority})})}}catch(e){g={error:e}}finally{try{N&&!N.done&&(d=j.return)&&d.call(j)}finally{if(g)throw g.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 h=i(u.value,2),g=h[0],d=h[1],p="headStart"===g||"bodyStart"===g?a([],i(d),!1).reverse():d;try{for(var f=(l=void 0,n(p)),y=f.next();!y.done;y=f.next()){var v=y.value;this.injectAtLocation(g,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,o.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,o.logDebug)("[HTMLInjector] Injected at ".concat(e,":"),{location:e,codeLength:t.length,injectionId:n})}catch(t){this.debug&&(0,o.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,o.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,o.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,o.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,o.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 a=i.value,l=document.getElementById(a);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,o.logDebug)("[HTMLInjector] Destroyed and cleaned up all injections")},e}();t.HTMLInjector=s},254: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.DOMChangesPlugin=t.DOMChangesPluginLite=void 0;var a=r(702);Object.defineProperty(t,"DOMChangesPluginLite",{enumerable:!0,get:function(){return a.DOMChangesPluginLite}}),Object.defineProperty(t,"DOMChangesPlugin",{enumerable:!0,get:function(){return a.DOMChangesPluginLite}}),i(r(574),t),t.default=a.DOMChangesPluginLite},356: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.__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},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.")},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},l=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;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 s=r(609),c=r(973),u=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,i,c,u;if(this.cachedAllChanges)return this.debug&&(0,s.logDebug)("[ABsmartly VariantExtractor] Returning cached changes"),this.cachedAllChanges;var h=new Map;try{var g=this.context.data();if(this.debug&&(0,s.logDebug)("[VariantExtractor DEBUG] Raw context data structure:",{hasData:!!g,contextKeys:g?Object.keys(g):[],experimentCount:(null===(r=null==g?void 0:g.experiments)||void 0===r?void 0:r.length)||0,firstExperiment:(null===(n=null==g?void 0:g.experiments)||void 0===n?void 0:n[0])?{name:g.experiments[0].name,variantCount:(null===(i=g.experiments[0].variants)||void 0===i?void 0:i.length)||0,firstVariantStructure:(null===(c=g.experiments[0].variants)||void 0===c?void 0:c[0])?Object.keys(g.experiments[0].variants[0]):[]}:null,rawContextData:JSON.stringify(g).substring(0,500)+"..."}),this.debug&&(0,s.logDebug)("[ABsmartly VariantExtractor] Extracting changes from context:",{hasData:!!g,experimentCount:(null===(u=null==g?void 0:g.experiments)||void 0===u?void 0:u.length)||0}),null==g?void 0:g.experiments){this.debug&&(0,s.logDebug)("[ABsmartly VariantExtractor] Available experiments:",g.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 d=a(g.experiments),p=d.next();!p.done;p=d.next()){var f=p.value,y=this.extractAllVariantsForExperiment(f);y.size>0?(h.set(f.name,y),this.debug&&(0,s.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:l([],o(new Set(n.map(function(e){return e.type}))),!1)}})})):this.debug&&(0,s.logDebug)("[ABsmartly VariantExtractor] Experiment '".concat(f.name,"' has no DOM changes"))}}catch(t){e={error:t}}finally{try{p&&!p.done&&(t=d.return)&&t.call(d)}finally{if(e)throw e.error}}}}catch(e){(0,s.logDebug)("[ABsmartly] Error extracting DOM changes:",e)}return this.cachedAllChanges=h,h},e.prototype.extractAllVariantsForExperiment=function(e){var t,r=new Map;if(this.debug&&(0,s.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,s.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 a=null;if(i.config)try{var o="string"==typeof i.config?JSON.parse(i.config):i.config;(0,s.logDebug)("[VariantExtractor DEBUG] [".concat(e.name,"] Parsed config for variant ").concat(n,":"),o),o&&o[this.variableName]?(a=o[this.variableName],(0,s.logDebug)("[VariantExtractor DEBUG] [".concat(e.name,"] ✓ Found DOM changes in config[").concat(this.variableName,"]:"),a)):(0,s.logDebug)("[VariantExtractor DEBUG] [".concat(e.name,"] ✗ No ").concat(this.variableName," field found in parsed config for variant ").concat(n))}catch(t){(0,s.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,s.logDebug)("[VariantExtractor DEBUG] [".concat(e.name,"] ✗ No config field found for variant ").concat(n));if(a){var l=this.extractChangesFromData(a);l&&l.length>0&&r.set(n,l)}}}return r},e.prototype.extractChangesFromData=function(e){if(!e)return null;if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return(0,s.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,s.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,s.logDebug)("[ABsmartly] Failed to parse DOM changes JSON:",e),null}if(!Array.isArray(e))return this.debug&&(0,s.logDebug)("[ABsmartly] DOM changes data is not an array"),null;var n=[];try{for(var i=a(e),o=i.next();!o.done;o=i.next()){var l=o.value;this.isValidChange(l)?n.push(this.normalizeChange(l)):this.debug&&(0,s.logDebug)("[ABsmartly] Invalid DOM change:",l)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n.length>0?n:null},e.prototype.normalizeChange=function(e){return void 0===e.trigger_on_view&&void 0!==e.triggerOnView?n(n({},e),{trigger_on_view:e.triggerOnView}):e},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,l([],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,s.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 a=n.variants[i];if(a){var o=null;if(a.variables&&a.variables[this.variableName])o=a.variables[this.variableName];else if(a.config)try{var l="string"==typeof a.config?JSON.parse(a.config):a.config;l&&l[this.variableName]&&(o=l[this.variableName])}catch(e){(0,s.logDebug)("[VariantExtractor] Failed to parse variant.config:",e)}if(o){if("string"==typeof o)try{o=JSON.parse(o)}catch(e){(0,s.logDebug)("[ABsmartly] Failed to parse DOM changes JSON:",e);continue}t.set(i,o)}else t.set(i,null)}}}catch(e){(0,s.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 i=this.getAllVariantsData(e),l=!1;try{for(var s=a(i),u=s.next();!u.done;u=s.next()){var h=o(u.value,2)[1];if(h&&"object"==typeof h&&!Array.isArray(h)&&"urlFilter"in h){var g=h;if(g.urlFilter&&(l=!0,c.URLMatcher.matches(g.urlFilter,t)))return!0}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}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,s.logDebug)("[ABsmartly VariantExtractor] Extracting __inject_html from context"),null==n?void 0:n.experiments)try{for(var i=a(n.experiments),o=i.next();!o.done;o=i.next()){var l=o.value,c=this.extractInjectHTMLForExperiment(l);c.size>0&&(r.set(l.name,c),this.debug&&(0,s.logDebug)("[ABsmartly VariantExtractor] Experiment '".concat(l.name,"' has HTML injections:"),{variantsWithInjections:Array.from(c.keys())}))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}}catch(e){(0,s.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 n=e.variants[r];if(n){var a=null;if(n.variables&&n.variables.__inject_html)a=n.variables.__inject_html,this.debug&&(0,s.logDebug)("[VariantExtractor] Found __inject_html in variables for ".concat(e.name," variant ").concat(r));else if(n.config)try{var o="string"==typeof n.config?JSON.parse(n.config):n.config;o&&o.__inject_html&&(a=o.__inject_html,this.debug&&(0,s.logDebug)("[VariantExtractor] Found __inject_html in config for ".concat(e.name," variant ").concat(r)))}catch(t){(0,s.logDebug)("[VariantExtractor] Failed to parse variant.config for ".concat(e.name," variant ").concat(r,":"),t)}if(a&&"object"==typeof a&&!Array.isArray(a)){var l=a,c=l.urlFilter,u=i(l,["urlFilter"]),h={data:u,urlFilter:c||void 0};t.set(r,h),this.debug&&(0,s.logDebug)("[VariantExtractor] Extracted __inject_html for ".concat(e.name," variant ").concat(r,":"),{keys:Object.keys(u),hasUrlFilter:!!c})}else a&&this.debug&&(0,s.logDebug)("[VariantExtractor] Invalid __inject_html format in ".concat(e.name," variant ").concat(r),a)}}return t},e}();t.VariantExtractor=u},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,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMPersistenceManager=void 0;var a=r(609),o=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,o,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)),h=u.next();!h.done;h=u.next()){var g=h.value.replace(/([A-Z])/g,"-$1").toLowerCase();c[g]=e.style.getPropertyValue(g)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}(0,a.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,a.logDebug)("[PERSISTENCE-OBSERVER] Setting up persistence observer",{timestamp:Date.now()}),this.persistenceObserver=new MutationObserver(function(t){var r,o;e.config.debug&&(0,a.logDebug)("[MUTATION-DETECTED] Persistence observer detected mutations",{mutationCount:t.length,timestamp:Date.now()});var l=function(t){var r,o,l,s,c,u,h,g,d=t.target;if(e.reapplyingElements.has(d))return e.config.debug&&(0,a.logDebug)("[MUTATION-SKIP] Skipping mutation - currently reapplying",{element:d.tagName}),"continue";var p=e.watchedElements.get(d);if(p){if(e.config.debug){var f="mutation:".concat(d.tagName,":").concat(d.getAttribute("name")||d.className);(O=Date.now())-(M=e.reapplyLogThrottle.get(f)||0)>5e3&&((0,a.logDebug)("[MUTATION-ON-WATCHED] Mutation detected on watched element",{element:d.tagName,attributeName:t.attributeName,oldValue:t.oldValue,experiments:Array.from(p)}),e.reapplyLogThrottle.set(f,O))}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,A=!1;if("style"===E.type&&"style"===t.attributeName&&!1!==E.persistStyle)A=e.checkStyleOverwritten(d,E.value);else if("attribute"===E.type&&!1!==E.persistAttribute){if(E.value&&"object"==typeof E.value)try{for(var S=(c=void 0,n(Object.keys(E.value))),D=S.next();!D.done;D=S.next()){var C=D.value;if(t.attributeName===C){A=e.checkAttributeOverwritten(d,E.value);break}}}catch(e){c={error:e}}finally{try{D&&!D.done&&(u=S.return)&&u.call(S)}finally{if(c)throw c.error}}}else"javascript"===E.type&&!0===E.persistScript&&E.value&&"string"==typeof E.value&&(A="style"===t.attributeName||"class"===t.attributeName);if(A){e.reapplyingElements.add(d);var _="".concat(m,"-").concat(E.selector),O=Date.now(),M=e.reapplyLogThrottle.get(_)||0;if(e.config.debug&&O-M>5e3&&((0,a.logDebug)("[REAPPLY-TRIGGERED] Reapplying after mutation (React/framework conflict detected)",{experimentName:m,selector:E.selector,element:d.tagName,changeType:E.type,timestamp:O}),e.reapplyLogThrottle.set(_,O),e.reapplyLogThrottle.size>100)){var P=O-6e4;try{for(var T=(h=void 0,n(e.reapplyLogThrottle.entries())),R=T.next();!R.done;R=T.next()){var j=i(R.value,2),N=j[0];j[1]<P&&e.reapplyLogThrottle.delete(N)}}catch(e){h={error:e}}finally{try{R&&!R.done&&(g=T.return)&&g.call(T)}finally{if(h)throw h.error}}}try{e.config.onReapply(E,m)}catch(t){e.config.debug&&(0,a.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(d)},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&&(o=y.return)&&o.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&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}),this.persistenceObserver.observe(document.body,{attributes:!0,subtree:!0,attributeOldValue:!0}),this.config.debug&&(0,a.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,a;try{for(var o=n(Object.entries(t)),l=o.next();!l.done;l=o.next()){var s=i(l.value,2),c=s[0],u=s[1],h=c.replace(/([A-Z])/g,"-$1").toLowerCase(),g=e.style.getPropertyValue(h),d=e.style.getPropertyPriority(h);if(g!==u||u.includes("!important")&&!d)return!0}}catch(e){r={error:e}}finally{try{l&&!l.done&&(a=o.return)&&a.call(o)}finally{if(r)throw r.error}}return!1},e.prototype.checkAttributeOverwritten=function(e,t){var r,a;try{for(var o=n(Object.entries(t)),l=o.next();!l.done;l=o.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&&(a=o.return)&&a.call(o)}finally{if(r)throw r.error}}return!1},e}();t.DOMPersistenceManager=o},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,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},a=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;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,a){if(t.DEBUG){l("".concat(a?"✓":"✗"," Applied ").concat(n," change to ").concat(i," element(s)"),{experimentName:e,selector:r,changeType:n,elementsCount:i,success:a})}},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,a([e],i(t),!1))};var o=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),o=n[0],l=n[1];if(o.includes("Original state already stored"))return;if(o.includes("State store operation"))return;if(o.includes("Performance:")&&(null==l?void 0:l.duration)&&l.duration<5)return;if(o.includes("Message sent:")||o.includes("Message received:"))return;var s=(new Date).toISOString(),c="[ABsmartly Debug]";console.log("".concat(c," [").concat(s,"] ").concat(o),l)}else if(1===e.length&&"string"==typeof e[0]){if((o=e[0]).includes("Original state already stored"))return;if(o.includes("State store operation"))return;if(o.includes("Message sent:")||o.includes("Message received:"))return;s=(new Date).toISOString(),c="[ABsmartly Debug]";console.log("".concat(c," [").concat(s,"] ").concat(o))}else console.log.apply(console,a([],i(e),!1))}t.DEBUG=o.BUILD_DEBUG},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,a){function o(e){try{s(n.next(e))}catch(e){a(e)}}function l(e){try{s(n.throw(e))}catch(e){a(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(o,l)}s((n=n.apply(e,t||[])).next())})},a=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=l(0),o.throw=l(1),o.return=l(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(a=0)),a;)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 a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){a.label=l[1];break}if(6===l[0]&&a.label<i[1]){a.label=i[1],i=l;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(l);break}i[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}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.")},l=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMChangesPluginLite=void 0;var s=r(964),c=r(356),u=r(693),h=r(713),g=r(253),d=r(609),p=r(973),f=r(481),y=r(943),v=r(834),m=function(){function e(t){var r,n,i,a,o,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!==(a=t.variableName)&&void 0!==a?a:"__dom_changes",debug:null!==(o=t.debug)&&void 0!==o&&o,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 h.ExposureTracker(this.config.context,this.config.debug),this.htmlInjector=new g.HTMLInjector(this.config.debug),this.persistenceManager=new f.DOMPersistenceManager({debug:this.config.debug,onReapply:function(e,t){(0,d.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,d.logDebug)("[DOMChangesPluginLite] Context is ready, starting initialization"),y.initialize()}).catch(function(e){throw(0,d.logDebug)("[DOMChangesPluginLite] ERROR during initialization:",e),e})}return e.prototype.ready=function(){return i(this,void 0,void 0,function(){return a(this,function(e){return[2,this.readyPromise]})})},e.prototype.initialize=function(){return i(this,void 0,void 0,function(){var t,r,n;return a(this,function(i){switch(i.label){case 0:if(this.initialized)return(0,d.logDebug)("Plugin already initialized"),[2];t=performance.now(),(0,d.logDebug)("Initializing ABsmartly DOM Changes Plugin Lite",{version:e.VERSION,config:{autoApply:this.config.autoApply,spa:this.config.spa,visibilityTracking:this.config.visibilityTracking,DEBUG:d.DEBUG}}),i.label=1;case 1:return i.trys.push([1,4,,5]),this.config.spa?(this.setupMutationObserver(),this.setupURLChangeListener()):(0,d.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,d.logPerformance)("Plugin initialization",r),(0,d.logDebug)("[ABsmartly] DOM plugin lite loaded successfully (v".concat(e.VERSION,")")),this.config.debug&&(0,d.logDebug)("[ABsmartly] DOM Changes Plugin Lite initialized with debug mode"),[3,5];case 4:throw n=i.sent(),(0,d.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,a,s,c,u,h,g,p,f;try{for(var y=o(t),v=y.next();!v.done;v=y.next()){var m=v.value;if("childList"===m.type)try{for(var b=(i=void 0,o(m.addedNodes)),x=b.next();!x.done;x=b.next()){var w=x.value;if(w.nodeType===Node.ELEMENT_NODE){var E=w,A=(null===(f=e.persistenceManager)||void 0===f?void 0:f.getAppliedChanges())||new Map;try{for(var S=(s=void 0,o(A)),D=S.next();!D.done;D=S.next()){var C=l(D.value,2),_=C[0],O=C[1];try{for(var M=(u=void 0,o(O)),P=M.next();!P.done;P=M.next()){var T=P.value;try{var R=E.matches(T.selector)?[E]:Array.from(E.querySelectorAll(T.selector));try{for(var j=(g=void 0,o(R)),N=j.next();!N.done;N=j.next()){var L=N.value;e.config.debug&&(0,d.logDebug)("[SPA-REAPPLY] Re-applying change to newly added element (React hydration recovery)",{experimentName:_,selector:T.selector,element:L.tagName,changeType:T.type}),e.domManipulator.applyChange(T,_)}}catch(e){g={error:e}}finally{try{N&&!N.done&&(p=j.return)&&p.call(j)}finally{if(g)throw g.error}}}catch(e){}}}catch(e){u={error:e}}finally{try{P&&!P.done&&(h=M.return)&&h.call(M)}finally{if(u)throw u.error}}}}catch(e){s={error:e}}finally{try{D&&!D.done&&(c=S.return)&&c.call(S)}finally{if(s)throw s.error}}}}}catch(e){i={error:e}}finally{try{x&&!x.done&&(a=b.return)&&a.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,d.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,d.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 a(this,function(t){switch(t.label){case 0:return e=window.location.href,(0,d.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,d.logDebug)("[ABsmartly] URL change listener set up for SPA mode")},e.prototype.removeAllChanges=function(){return i(this,void 0,void 0,function(){return a(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,d.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 a(this,function(a){switch(a.label){case 0:e=performance.now(),t=window.location.href,a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.config.context.ready()];case 2:return a.sent(),[3,4];case 3:return r=a.sent(),(0,d.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 a.sent(),i=performance.now()-e,(0,d.logPerformance)("Apply injections and changes (parallel)",i),this.config.debug&&(0,d.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),a(this,function(n){return 0===e.size?(this.config.debug&&(0,d.logDebug)("[ABsmartly] No HTML injections found"),[2]):(r=this.htmlInjector.collectInjections(e,t),this.htmlInjector.inject(r),this.config.debug&&(0,d.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,h,g,f,y,v,m,b,x,w,E,A,S,D,C,_,O,M,P,T,R,j,N,L,k,B,I,V,U,F,G,H,z,J,W,Y,q,X,$,Z,K,Q,ee,te,re,ne,ie,ae,oe;return a(this,function(a){switch(a.label){case 0:t=performance.now(),r=window.location.href,(0,d.logDebug)("Starting to apply changes",{specificExperiment:e||"all",url:r,action:"apply_start"}),this.config.debug&&((0,d.logDebug)("[ABsmartly] === DOM Changes Application Starting ==="),(0,d.logDebug)("[ABsmartly] Target:",e||"all experiments"),(0,d.logDebug)("[ABsmartly] Current URL:",r),(0,d.logDebug)("[ABsmartly] Context ready:",!0)),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this.config.context.ready()];case 2:return a.sent(),[3,4];case 3:return n=a.sent(),(0,d.logDebug)("[ABsmartly] Failed to wait for context ready:",n),[2];case 4:this.variantExtractor.clearCache(),i=this.getAllExperimentsData(),s=0,c=new Map,(0,d.logDebug)("[APPLY-CHANGES] Experiments found with DOM changes:",{experimentNames:Array.from(i.keys()),totalCount:i.size,currentURL:r}),0===i.size&&(0,d.logDebug)("[APPLY-CHANGES] ⚠️ No experiments found with DOM changes - nothing to process");try{for(u=o(i),h=u.next();!h.done;h=u.next())if(g=l(h.value,2),f=g[0],y=g[1],(0,d.logDebug)("[APPLY-CHANGES] [".concat(f,"] Starting to process experiment"),{experimentName:f,currentURL:r}),e&&f!==e)(0,d.logDebug)("[APPLY-CHANGES] [".concat(f,"] ⏭️ Skipping - filtering for different experiment"),{filteringFor:e});else if(null!=(v=this.config.context.peek(f)))if((0,d.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,d.logDebug)("[APPLY-CHANGES] [".concat(f,"] ✓ At least one variant matches current URL")),w=this.shouldApplyVisualChanges(m,b,r),E=this.extractChangesFromData(m,x),A=this.extractAllVariantChanges(f),S=A.some(function(e){return e&&e.length>0}),S){if(D={total:(null==E?void 0:E.length)||0,success:0,pending:0},this.config.debug&&(0,d.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,d.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(Q=void 0,C=o(E),_=C.next();!_.done;_=C.next())if("delete"===(X=_.value).type&&X.trigger_on_view)this.config.debug&&(0,d.logDebug)("[ABsmartly] Deferring delete change until after viewport trigger for '".concat(f,"'"),{selector:X.selector});else if(this.domManipulator.applyChange(X,f))s++,D.success++;else if("create"!==X.type&&"styleRules"!==X.type)try{0===document.querySelectorAll(X.selector).length&&(this.config.spa||X.waitForElement)&&D.pending++}catch(e){this.config.debug&&(0,d.logDebug)("[ABsmartly] Invalid selector: ".concat(X.selector),e)}}catch(e){Q={error:e}}finally{try{_&&!_.done&&(ee=C.return)&&ee.call(C)}finally{if(Q)throw Q.error}}else E&&E.length>0&&(0,d.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(O=!1,M=!1,P=this.variantExtractor.getAllVariantsData(f),this.config.debug){(0,d.logDebug)("[ABsmartly] Checking trigger types for experiment '".concat(f,"' on URL: ").concat(r),{allVariantsDataSize:P.size,allVariantChangesLength:A.length});try{for(te=void 0,T=o(P),R=T.next();!R.done;R=T.next())j=l(R.value,2),N=j[0],L=j[1],(0,d.logDebug)("[ABsmartly] Variant ".concat(N," data structure:"),{isArray:Array.isArray(L),isObject:"object"==typeof L,hasUrlFilter:L&&"object"==typeof L&&!Array.isArray(L)&&"urlFilter"in L,keys:L&&"object"==typeof L&&!Array.isArray(L)?Object.keys(L):"N/A"})}catch(e){te={error:e}}finally{try{R&&!R.done&&(re=T.return)&&re.call(T)}finally{if(te)throw te.error}}}try{for(ne=void 0,k=o(P),B=k.next();!B.done;B=k.next())if(I=l(B.value,2),V=I[0],U=I[1],(F=A[V])&&0!==F.length){if(G=!0,U&&"object"==typeof U&&!Array.isArray(U)&&"urlFilter"in(H=U)&&H.urlFilter&&(z=H,G=p.URLMatcher.matches(z.urlFilter,r),this.config.debug&&(0,d.logDebug)("[ABsmartly] Variant ".concat(V," has URL filter, matches: ").concat(G))),G){J=!1,W=!1;try{for(ae=void 0,Y=o(F),q=Y.next();!q.done;q=Y.next())(X=q.value).trigger_on_view?J=!0:this.hasImmediateDomAnchor(X)&&(W=!0)}catch(e){ae={error:e}}finally{try{q&&!q.done&&(oe=Y.return)&&oe.call(Y)}finally{if(ae)throw ae.error}}J&&(O=!0),W&&(M=!0),this.config.debug&&(0,d.logDebug)("[ABsmartly] Variant ".concat(V," matches URL - hasImmediate: ").concat(W,", hasViewport: ").concat(J),{experimentName:f,variantIndex:V,hasImmediateDomAnchor:W})}else this.config.debug&&(0,d.logDebug)("[ABsmartly] Variant ".concat(V," does NOT match URL - skipping"));if(O&&M)break}}catch(e){ne={error:e}}finally{try{B&&!B.done&&(ie=k.return)&&ie.call(k)}finally{if(ne)throw ne.error}}this.config.debug&&(0,d.logDebug)("[TRIGGER-DETECTION] [".concat(f,"] Final trigger decision for '").concat(f,"':"),{experimentName:f,userVariant:v,hasImmediateTrigger:M,hasViewportTrigger:O,willRegisterExperiment:O||M,userChangesCount:(null==E?void 0:E.length)||0,allVariantsChangesCount:A.map(function(e){return e.length})}),O||M?((0,d.logDebug)("[TRIGGER-DETECTION] [".concat(f,"] ✓ REGISTERING EXPERIMENT - Calling exposureTracker.registerExperiment()"),{experimentName:f,userVariant:v,hasImmediateTrigger:M,hasViewportTrigger:O,changesForUser:(null==E?void 0:E.length)||0,allVariantCounts:A.map(function(e,t){return{variant:t,count:e.length}})}),this.exposureTracker.registerExperiment(f,v||0,E||[],A,M,O)):(0,d.logDebug)("[TRIGGER-DETECTION] [".concat(f,"] ⚠️ No triggers detected - experiment will NOT be registered!"),{experimentName:f,userVariant:v,hasAnyChangesInAnyVariant:S,allVariantsChangesCount:A.map(function(e){return e.length})}),c.set(f,D),(0,d.logExperimentSummary)(f,D.total,D.success,D.pending)}else this.config.debug&&(0,d.logDebug)("[ABsmartly] Skipping experiment '".concat(f,"' - no variants have changes"));else(0,d.logDebug)("[APPLY-CHANGES] [".concat(f,"] ⏭️ Skipping - no variant matches URL: ").concat(r),{experimentName:f,currentURL:r});else(0,d.logDebug)("[APPLY-CHANGES] [".concat(f,"] ⏭️ Skipping - no variant assigned (peek returned ").concat(v,")"),{experimentName:f})}catch(e){Z={error:e}}finally{try{h&&!h.done&&(K=u.return)&&K.call(u)}finally{if(Z)throw Z.error}}return $=performance.now()-t,(0,d.logPerformance)("Apply changes",$,{totalApplied:s,experiments:c.size}),this.config.debug&&((0,d.logDebug)("[ABsmartly] === DOM Changes Application Complete ==="),(0,d.logDebug)("[ABsmartly] Summary:",{totalChangesApplied:s,experimentsProcessed:c.size,duration:"".concat($.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,d.logDebug)("[ABsmartly] DOM changes applied"),this.emit("changes-applied",{count:s,experimentName:e}),[2]}})})},e.prototype.hasImmediateDomAnchor=function(e){try{return e.waitForElement?null!==document.querySelector(e.observerRoot||"body"):"create"===e.type?!!e.targetSelector&&null!==document.querySelector(e.targetSelector):null!==document.querySelector(e.selector)}catch(t){return this.config.debug&&(0,d.logDebug)("[ABsmartly] Failed to evaluate immediate DOM anchor:",{selector:e.selector,targetSelector:e.targetSelector,type:e.type,error:t}),!1}},e.prototype.getAllExperimentsData=function(){var e,t,r=new Map,n=this.variantExtractor.extractAllChanges();(0,d.logDebug)("[GET-EXPERIMENTS] Extracting experiment data from context",{experimentsWithChanges:Array.from(n.keys()),totalCount:n.size});try{for(var i=o(n),a=i.next();!a.done;a=i.next()){var s=l(a.value,1)[0],c=this.config.context.peek(s);if((0,d.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] Checking experiment"),{experimentName:s,currentVariant:c,variantIsValid:null!=c}),null!=c){var u=this.variantExtractor.getAllVariantsData(s),h=u.get(c);this.config.debug&&(0,d.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] Variant data lookup:"),{experimentName:s,userVariant:c,variantDataExists:!!h,allVariantsInMap:Array.from(u.keys()),userVariantInMap:u.has(c)}),h||(0,d.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,d.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] ✓ Including experiment (variant ").concat(c,")"));var g=null,p={};if(h&&"object"==typeof h&&!Array.isArray(h)&&"changes"in h){var f=h;g=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:h,urlFilter:g,globalDefaults:p})}else(0,d.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] ⏭️ Skipping - context.peek() returned ").concat(c))}}catch(t){e={error:t}}finally{try{a&&!a.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,a,o,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!==(a=e.persistAttribute)&&void 0!==a?a:t.persistAttribute,persistScript:null!==(o=e.persistScript)&&void 0!==o?o: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=[],a=function(e){var a=t[e],o=r.get(e);if(!a||0===a.length)return i.push([]),"continue";var l={};if(o&&"object"==typeof o&&!Array.isArray(o)&&"changes"in o){var s=o;l={waitForElement:s.waitForElement,persistStyle:s.persistStyle,persistAttribute:s.persistAttribute,persistScript:s.persistScript,important:s.important,observerRoot:s.observerRoot}}var c=a.map(function(e){var t,r,i,a,o,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!==(a=e.persistScript)&&void 0!==a?a:l.persistScript,important:null!==(o=e.important)&&void 0!==o?o:l.important,observerRoot:null!==(s=e.observerRoot)&&void 0!==s?s:l.observerRoot})});i.push(c)},o=0;o<t.length;o++)a(o);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,d.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,d.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 a=o(i),l=a.next();!l.done;l=a.next()){var s=l.value;try{s(t)}catch(t){(0,d.logDebug)("[ABsmartly] Error in event listener for ".concat(e,":"),t)}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}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],a=n.replace(/([A-Z])/g,"-$1").toLowerCase(),o=r?" !important":"";return" ".concat(a,": ").concat(i).concat(o,";")}).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,d.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=o(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,d.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,d.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,d.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,d.logDebug)("[ABsmartly] DOMChangesPluginLite registered in global window.__ABSMARTLY_PLUGINS__ (initialized=".concat(t,")"))},e.prototype.unregisterGlobally=function(){(0,y.unregisterPlugin)("dom"),this.config.debug&&(0,d.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,d.logDebug)("[ABsmartly] Anti-flicker timeout reached (".concat(e.config.hideTimeout,"ms), showing content")),e.showContent()},this.config.hideTimeout),this.config.debug&&(0,d.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,d.logDebug)("[ABsmartly] Anti-flicker fade-in complete, style removed")},n),this.config.debug&&(0,d.logDebug)("[ABsmartly] Anti-flicker fading in with transition: ".concat(this.config.hideTransition))}else t.remove(),this.config.debug&&(0,d.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,a){function o(e){try{s(n.next(e))}catch(e){a(e)}}function l(e){try{s(n.throw(e))}catch(e){a(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(o,l)}s((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=l(0),o.throw=l(1),o.return=l(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(a=0)),a;)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 a.label++,{value:l[1],done:!1};case 5:a.label++,n=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){a=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){a.label=l[1];break}if(6===l[0]&&a.label<i[1]){a.label=i[1],i=l;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(l);break}i[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}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.")},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},l=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;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,h,g,d,p,f,y,v,m,b,x,w;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 E=new Set,A=new Set,S=new Map,D=new Set,C=new Map;try{for(var _=a(n),O=_.next();!O.done;O=_.next()){var M=O.value;try{for(var P=(g=void 0,a(M)),T=P.next();!T.done;T=P.next()){var R=T.value;if(R.trigger_on_view)if("move"===R.type)S.has(R.selector)||S.set(R.selector,new Set),R.targetSelector&&S.get(R.selector).add(R.targetSelector);else if("delete"===R.type)D.add(R.selector);else if("create"===R.type)if(R.targetSelector){var j=R.position||"lastChild";(W=C.get(R.targetSelector))||(W=new Set,C.set(R.targetSelector,W)),W.add(j)}else this.debug&&(0,s.logDebug)("[EXPOSURE] [".concat(e,"] Skipping create change with no targetSelector — manipulator can't apply it either"),{change:R});else E.add(R.selector)}}catch(e){g={error:e}}finally{try{T&&!T.done&&(d=P.return)&&d.call(P)}finally{if(g)throw g.error}}}}catch(e){u={error:e}}finally{try{O&&!O.done&&(h=_.return)&&h.call(_)}finally{if(u)throw u.error}}var N=function(r){for(var i,o,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){E.add(r);for(var h=0;h<l.length;h++){var g=l[h];h!==u&&L.createContainerPlaceholder(e,r,g.targetSelector,g.position)}}else{E.add(r);try{for(var d=(i=void 0,a(l)),p=d.next();!p.done;p=d.next()){g=p.value;L.createContainerPlaceholder(e,r,g.targetSelector,g.position)}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}},L=this;try{for(var k=a(S),B=k.next();!B.done;B=k.next()){N(o(B.value,1)[0])}}catch(e){p={error:e}}finally{try{B&&!B.done&&(f=k.return)&&f.call(k)}finally{if(p)throw p.error}}var I=function(t){r.some(function(e){return"delete"===e.type&&e.selector===t&&e.trigger_on_view})?0===V.createInPlacePlaceholder(e,t)&&(E.add(t),V.debug&&(0,s.logDebug)("[EXPOSURE] [".concat(e,"] Delete element doesn't exist yet - tracking selector for when it appears"),{selector:t})):E.add(t)},V=this;try{for(var U=a(D),F=U.next();!F.done;F=U.next()){I(F.value)}}catch(e){y={error:e}}finally{try{F&&!F.done&&(v=U.return)&&v.call(U)}finally{if(y)throw y.error}}try{for(var G=a(C),H=G.next();!H.done;H=G.next()){var z=o(H.value,2),J=z[0],W=z[1],Y=!1;try{for(var q=(x=void 0,a(W)),X=q.next();!X.done;X=q.next()){j=X.value;this.createContainerPlaceholder(e,"__create_placeholder__",J,j)&&(Y=!0)}}catch(e){x={error:e}}finally{try{X&&!X.done&&(w=q.return)&&w.call(q)}finally{if(x)throw x.error}}Y||E.add(J)}}catch(e){m={error:e}}finally{try{H&&!H.done&&(b=G.return)&&b.call(G)}finally{if(m)throw m.error}}var $={experimentName:e,variant:t,changes:r,allPossibleSelectors:new Set(l(l([],o(E),!1),o(A),!1)),triggered:!1,hasImmediateTrigger:i,hasViewportTrigger:c};this.experiments.set(e,$),this.debug&&(0,s.logDebug)("[ABsmartly] Experiment ".concat(e," will track selectors:"),Array.from($.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($.allPossibleSelectors),allVariantCounts:n.map(function(e,t){return{variant:t,count:e.length}})}),this.observeSelectors(e,$.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,a;void 0===n&&(n="lastChild");var o=document.querySelector(r);if(!o)return!1;var l="".concat(e,"-").concat(t,"-").concat(r,"-").concat(n);if(this.placeholders.has(l))return!0;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":o.insertBefore(c,o.firstChild);break;case"lastChild":default:o.appendChild(c);break;case"before":null===(i=o.parentElement)||void 0===i||i.insertBefore(c,o);break;case"after":null===(a=o.parentElement)||void 0===a||a.insertBefore(c,o.nextSibling)}return 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,")")),!0},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,a=0;a<n.length;a++){var o=n[a],l=t.replace(/[^a-zA-Z0-9-]/g,"_"),c="absmartly-delete-".concat(e,"-").concat(l,"-").concat(a),u="".concat(e,"-delete-").concat(t,"-").concat(a);if(!o.hasAttribute("data-absmartly-delete-placeholder")){var h=document.createElement("span");h.id=c,h.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 ",h.setAttribute("data-absmartly-placeholder","true"),h.setAttribute("data-absmartly-delete-placeholder","true"),h.setAttribute("data-absmartly-original-selector",t),h.setAttribute("data-absmartly-experiment",e),h.setAttribute("aria-hidden","true"),null===(r=o.parentElement)||void 0===r||r.insertBefore(h,o),o.remove(),this.placeholders.set(u,h),this.trackElement(h,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,o;try{for(var l=a(t),s=l.next();!s.done;s=l.next()){var c=s.value,u=document.querySelectorAll(c);if(u.length>0)try{for(var h=(i=void 0,a(u)),g=h.next();!g.done;g=h.next()){var d=g.value;this.trackElement(d,e)}}catch(e){i={error:e}}finally{try{g&&!g.done&&(o=h.return)&&o.call(h)}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=a(t),o=i.next();!o.done;o=i.next()){var l=o.value;l.isIntersecting&&e.handleElementVisible(l.target)}}catch(e){r={error:e}}finally{try{o&&!o.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,o;try{for(var l=a(t),s=l.next();!s.done;s=l.next()){var c=s.value;try{for(var u=(i=void 0,a(c.addedNodes)),h=u.next();!h.done;h=u.next()){var g=h.value;g instanceof Element&&e.checkNewElement(g)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=u.return)&&o.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=a(this.experiments),u=c.next();!u.done;u=c.next()){var h=o(u.value,2),g=h[0],d=h[1];try{for(var p=(n=void 0,a(d.allPossibleSelectors)),f=p.next();!f.done;f=p.next()){var y=f.value;e.matches(y)&&this.trackElement(e,g);try{for(var v=(l=void 0,a(e.querySelectorAll(y))),m=v.next();!m.done;m=v.next()){var b=m.value;this.trackElement(b,g)}}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=o.experiments.get(t);if(r&&!r.triggered&&(o.triggerExposure(t).catch(function(e){(0,s.logDebug)("[ABsmartly] Failed to trigger exposure for ".concat(t,":"),e)}),o.debug)){var i=n.isPlaceholder?e.getAttribute("data-absmartly-original-selector"):o.getElementSelector(e);(0,s.logDebug)("[ABsmartly] Triggering exposure for ".concat(t," via ").concat(i))}},o=this;try{for(var l=a(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=a(this.trackedElements),s=l.next();!s.done;s=l.next()){var c=o(s.value,2),u=c[0],h=c[1];h.experiments.delete(e),0===h.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 g=a(this.placeholders),d=g.next();!d.done;d=g.next()){var p=o(d.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{d&&!d.done&&(i=g.return)&&i.call(g)}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=a(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.8",t.BUILD_DEBUG=!1},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,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o},a=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;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 o=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"),a="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",a+e+"\n//# sourceURL=".concat(i))(t),!0}catch(g){var o=g instanceof Error?g.message:String(g);if(!(g instanceof EvalError||/unsafe-eval|Content Security Policy|CSP|refused to evaluate/i.test(o)))return this.reportJsExecutionFailure({experimentName:r,selector:n,reason:"runtime",error:o,stack:g instanceof Error?g.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(a).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(o,"; inline <script> did not execute (likely blocked by script-src without 'unsafe-inline').")}),!1)}catch(e){var h=e instanceof Error?e.message:String(e);return this.reportJsExecutionFailure({experimentName:r,selector:n,reason:"csp",error:"CSP blocked dynamic script execution. eval(): ".concat(o,"; inline <script>: ").concat(h),stack:e instanceof Error?e.stack:void 0}),!1}}},e.prototype.reportJsExecutionFailure=function(e){try{(0,o.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,a,l,s,c,u,h,g,d,p,f,y,v,m,b=this;if(null!==(u=e.disabled)&&void 0!==u?u:!1===e.enabled)return(0,o.logDebug)("Skipping disabled change for experiment: ".concat(t),{experimentName:t,selector:e.selector,changeType:e.type}),!1;var x=!!this.plugin.reapplyingElements&&Array.from(this.plugin.reapplyingElements).length>0,w=null===(g=null===(h=this.plugin.config)||void 0===h?void 0:h.context)||void 0===g?void 0:g.peek(t);this.debug&&(0,o.logDebug)("[DOM-APPLY] [".concat(t,"] ").concat(x?"RE-APPLYING":"APPLYING"," change"),{experimentName:t,userVariant:w,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,o.logChangeApplication)(t,e.targetSelector,e.type,1,!0),!0;return!1}var E=document.querySelectorAll(e.selector),A=[];if(0===E.length)return e.waitForElement||(null===(p=this.plugin.config)||void 0===p?void 0:p.spa)?(this.debug&&(0,o.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,o.logDebug)("[ABsmartly] No elements found for selector: ".concat(e.selector)),(0,o.logDebug)("No elements found for selector",{experimentName:t,selector:e.selector,changeType:e.type}),!1);try{for(var S=n(E),D=S.next();!D.done;D=S.next()){var C=D.value;if(this.debug&&"style"===e.type){var _={};if(e.value&&"object"==typeof e.value)try{for(var O=(a=void 0,n(Object.keys(e.value))),M=O.next();!M.done;M=O.next()){_[j=M.value.replace(/([A-Z])/g,"-$1").toLowerCase()]=C.style.getPropertyValue(j)}}catch(e){a={error:e}}finally{try{M&&!M.done&&(l=O.return)&&l.call(O)}finally{if(a)throw a.error}}(0,o.logDebug)("[DOM-BEFORE-APPLY] Element styles before change",{experimentName:t,selector:e.selector,element:C.tagName,oldStyles:_,newStyles:e.value})}if(this.applyChangeToElement(C,e),this.debug&&"style"===e.type){var P={};if(e.value&&"object"==typeof e.value)try{for(var T=(s=void 0,n(Object.keys(e.value))),R=T.next();!R.done;R=T.next()){var j;P[j=R.value.replace(/([A-Z])/g,"-$1").toLowerCase()]=C.style.getPropertyValue(j)}}catch(e){s={error:e}}finally{try{R&&!R.done&&(c=T.return)&&c.call(T)}finally{if(s)throw s.error}}(0,o.logDebug)("[DOM-AFTER-APPLY] Element styles after change",{experimentName:t,selector:e.selector,element:C.tagName,appliedStyles:P})}if("javascript"===e.type)if(e.value){var N=null===(y=null===(f=this.plugin.config)||void 0===f?void 0:f.context)||void 0===y?void 0:y.peek(t);this.debug&&(0,o.logDebug)("[JAVASCRIPT] [".concat(t,"] Executing JavaScript change"),{experimentName:t,userVariant:N,selector:e.selector,element:C.tagName,code:String(e.value).substring(0,100)+"..."});var L=String(e.value);this.executeUserJavaScript(L,C,t,e.selector)&&(A.push(C),this.debug&&(0,o.logDebug)("[JAVASCRIPT] [".concat(t,"] ✓ JavaScript executed successfully"),{experimentName:t,userVariant:N,selector:e.selector,element:C.tagName,code:L}))}else(0,o.logDebug)("[JAVASCRIPT] [".concat(t,"] ✗ No JavaScript code provided in change.value"),{experimentName:t,selector:e.selector});else if("move"===e.type){var k=e.targetSelector||(e.value&&"object"==typeof e.value?e.value.targetSelector:null),B=e.position||(e.value&&"object"==typeof e.value?e.value.position:null);if(k){var I=document.querySelector(k);I?(this.moveElement(C,I,B),A.push(C)):this.debug&&(0,o.logDebug)("[ABsmartly] Move target not found: ".concat(k))}}else A.push(C);"style"===e.type&&e.persistStyle||"attribute"===e.type&&e.persistAttribute||"javascript"===e.type&&!0===e.persistScript||(null===(v=this.plugin.config)||void 0===v?void 0:v.spa)?this.plugin.watchElement(C,t,e):this.debug&&(0,o.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===(m=this.plugin.config)||void 0===m?void 0:m.spa})}}catch(e){r={error:e}}finally{try{D&&!D.done&&(i=S.return)&&i.call(S)}finally{if(r)throw r.error}}if(A.length>0){this.trackAppliedChange(t,e),e.waitForElement&&this.pendingManager.removePending(e.selector,t,e.observerRoot);var V=A.some(function(e){var t;return null===(t=b.plugin.reapplyingElements)||void 0===t?void 0:t.has(e)});return V||(0,o.logChangeApplication)(t,e.selector,e.type,A.length,!0),!0}return(0,o.logChangeApplication)(t,e.selector,e.type,0,!1),!1}catch(r){return this.debug&&(0,o.logDebug)("[ABsmartly] Error applying DOM change:",r,e),(0,o.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,a;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===(a=t.parentElement)||void 0===a||a.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 a=document.querySelector(e.targetSelector);if(!a)return this.debug&&(0,o.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 h=u.value;this.moveElement(h,a,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,o.logDebug)("[ABsmartly] Applied style rule: ".concat(n)),(0,o.logDebug)("[ABsmartly] CSS: ".concat(i))),this.trackAppliedChange(t,e),(0,o.logChangeApplication)(t,e.selector,"styleRules",1,!0),!0}catch(e){return this.debug&&(0,o.logDebug)("[ABsmartly] Error applying style rules:",e),!1}},e.prototype.applyChangeToElement=function(e,t){var r,l,s,c,u,h;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 g=n(Object.entries(t.value)),d=g.next();!d.done;d=g.next()){var p=i(d.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{d&&!d.done&&(l=g.return)&&l.call(g)}finally{if(r)throw r.error}}break;case"class":t.add&&Array.isArray(t.add)&&(s=e.classList).add.apply(s,a([],i(t.add),!1)),t.remove&&Array.isArray(t.remove)&&(c=e.classList).remove.apply(c,a([],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&&(h=b.return)&&h.call(b)}finally{if(u)throw u.error}}break;case"move":if(t.value&&"object"==typeof t.value){var A=t.value,S=document.querySelector(A.targetSelector);S?this.moveElement(e,S,A.position):this.debug&&(0,o.logDebug)("[ABsmartly] Move target not found: ".concat(A.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,o.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,o.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),a=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,a)}}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,o.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: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.")};Object.defineProperty(t,"__esModule",{value:!0}),t.URLMatcher=void 0;var i=r(609),a=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,i.logDebug)("[ABsmartly] Failed to parse URL: ".concat(e),t),e}},e.matchesPatterns=function(e,t,r){var n=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,i.logDebug)("[ABsmartly] ⚠️ Invalid regex in URL filter, pattern ignored: ".concat(JSON.stringify(e)),t),!1}return n.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,i.logDebug)("[ABsmartly] Invalid pattern: ".concat(e),t),!1}},e.normalizeFilter=function(e){if("string"==typeof e)return{include:this.sanitizePatterns([e]),exclude:[],mode:"simple",matchType:"path"};if(Array.isArray(e))return{include:e.length>0?this.sanitizePatterns(e):void 0,exclude:[],mode:"simple",matchType:"path"};var t=e.mode||"simple";return{include:null==e.include?void 0:this.sanitizePatterns(e.include,t),exclude:this.sanitizePatterns(e.exclude||[],t),mode:t,matchType:e.matchType||"path"}},e.sanitizePatterns=function(e,t){var r,a;void 0===t&&(t="simple");var o=Array.isArray(e)?e:[e],l=[];try{for(var s=n(o),c=s.next();!c.done;c=s.next()){var u=c.value;if("string"==typeof u){var h=u.trim();h?h!==u?"regex"===t&&this.trimChangesRegexMeaning(u,h)?((0,i.logDebug)("[ABsmartly] ⚠️ URL filter regex ".concat(JSON.stringify(u)," has surrounding whitespace, ")+"but trimming would change its meaning - using it as is"),l.push(u)):((0,i.logDebug)("[ABsmartly] ⚠️ URL filter pattern ".concat(JSON.stringify(u)," has surrounding whitespace - ")+"using ".concat(JSON.stringify(h))),l.push(h)):l.push(u):(0,i.logDebug)("[ABsmartly] ⚠️ URL filter pattern ".concat(JSON.stringify(u)," is empty, ignoring"))}else(0,i.logDebug)("[ABsmartly] ⚠️ URL filter pattern is not a string, ignoring:",u)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(a=s.return)&&a.call(s)}finally{if(r)throw r.error}}return l},e.trimChangesRegexMeaning=function(e,t){try{return new RegExp(t).test("")&&!new RegExp(e).test("")}catch(e){return!0}},e}();t.URLMatcher=a}},t={};var r=function r(n){var i=t[n];if(void 0!==i)return i.exports;var a=t[n]={exports:{}};return e[n].call(a.exports,a,a.exports,r),a.exports}(254);return r})());