@absmartly/sdk-plugins 1.1.2 → 1.2.1

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 (98) hide show
  1. package/dist/absmartly-dom-changes-core.min.js +1 -1
  2. package/dist/absmartly-dom-changes-lite.min.js +1 -1
  3. package/dist/absmartly-overrides-full.min.js +1 -1
  4. package/dist/absmartly-overrides-lite.min.js +1 -1
  5. package/dist/absmartly-sdk-plugins.min.js +1 -1
  6. package/es/core/DOMChangesPluginLite.js +192 -220
  7. package/es/core/DOMChangesPluginLite.js.map +1 -1
  8. package/es/core/DOMManipulatorLite.js +66 -9
  9. package/es/core/DOMManipulatorLite.js.map +1 -1
  10. package/es/core/ExposureTracker.js +136 -11
  11. package/es/core/ExposureTracker.js.map +1 -1
  12. package/es/entries/dom-with-overrides-lite.js +3 -0
  13. package/es/entries/dom-with-overrides-lite.js.map +1 -1
  14. package/es/index.js +9 -2
  15. package/es/index.js.map +1 -1
  16. package/es/overrides/OverridesPlugin.js +2 -2
  17. package/es/overrides/OverridesPlugin.js.map +1 -1
  18. package/es/overrides/OverridesPluginLite.js +29 -1
  19. package/es/overrides/OverridesPluginLite.js.map +1 -1
  20. package/es/overrides/overridesUtils.js +27 -18
  21. package/es/overrides/overridesUtils.js.map +1 -1
  22. package/es/parsers/VariantExtractor.js +14 -7
  23. package/es/parsers/VariantExtractor.js.map +1 -1
  24. package/es/url-redirect/URLRedirectExtractor.js +185 -0
  25. package/es/url-redirect/URLRedirectExtractor.js.map +1 -0
  26. package/es/url-redirect/URLRedirectMatcher.js +115 -0
  27. package/es/url-redirect/URLRedirectMatcher.js.map +1 -0
  28. package/es/url-redirect/URLRedirectPlugin.js +350 -0
  29. package/es/url-redirect/URLRedirectPlugin.js.map +1 -0
  30. package/es/url-redirect/index.js +5 -0
  31. package/es/url-redirect/index.js.map +1 -0
  32. package/es/url-redirect/types.js +2 -0
  33. package/es/url-redirect/types.js.map +1 -0
  34. package/es/utils/persistence.js +278 -0
  35. package/es/utils/persistence.js.map +1 -0
  36. package/es/utils/plugin-registry.js +47 -0
  37. package/es/utils/plugin-registry.js.map +1 -0
  38. package/lib/core/DOMChangesPluginLite.d.ts +10 -7
  39. package/lib/core/DOMChangesPluginLite.js +192 -220
  40. package/lib/core/DOMChangesPluginLite.js.map +1 -1
  41. package/lib/core/DOMManipulatorLite.js +66 -9
  42. package/lib/core/DOMManipulatorLite.js.map +1 -1
  43. package/lib/core/ExposureTracker.d.ts +6 -0
  44. package/lib/core/ExposureTracker.js +136 -11
  45. package/lib/core/ExposureTracker.js.map +1 -1
  46. package/lib/entries/dom-with-overrides-lite.d.ts +2 -0
  47. package/lib/entries/dom-with-overrides-lite.js +3 -1
  48. package/lib/entries/dom-with-overrides-lite.js.map +1 -1
  49. package/lib/index.d.ts +8 -2
  50. package/lib/index.js +17 -1
  51. package/lib/index.js.map +1 -1
  52. package/lib/overrides/OverridesPlugin.js +2 -2
  53. package/lib/overrides/OverridesPlugin.js.map +1 -1
  54. package/lib/overrides/OverridesPluginLite.d.ts +8 -0
  55. package/lib/overrides/OverridesPluginLite.js +29 -1
  56. package/lib/overrides/OverridesPluginLite.js.map +1 -1
  57. package/lib/overrides/overridesUtils.d.ts +10 -5
  58. package/lib/overrides/overridesUtils.js +28 -18
  59. package/lib/overrides/overridesUtils.js.map +1 -1
  60. package/lib/parsers/VariantExtractor.js +14 -7
  61. package/lib/parsers/VariantExtractor.js.map +1 -1
  62. package/lib/types/index.d.ts +1 -0
  63. package/lib/url-redirect/URLRedirectExtractor.d.ts +16 -0
  64. package/lib/url-redirect/URLRedirectExtractor.js +188 -0
  65. package/lib/url-redirect/URLRedirectExtractor.js.map +1 -0
  66. package/lib/url-redirect/URLRedirectMatcher.d.ts +8 -0
  67. package/lib/url-redirect/URLRedirectMatcher.js +118 -0
  68. package/lib/url-redirect/URLRedirectMatcher.js.map +1 -0
  69. package/lib/url-redirect/URLRedirectPlugin.d.ts +21 -0
  70. package/lib/url-redirect/URLRedirectPlugin.js +353 -0
  71. package/lib/url-redirect/URLRedirectPlugin.js.map +1 -0
  72. package/lib/url-redirect/index.d.ts +4 -0
  73. package/lib/url-redirect/index.js +25 -0
  74. package/lib/url-redirect/index.js.map +1 -0
  75. package/lib/url-redirect/types.d.ts +29 -0
  76. package/lib/url-redirect/types.js +3 -0
  77. package/lib/url-redirect/types.js.map +1 -0
  78. package/lib/utils/persistence.d.ts +23 -0
  79. package/lib/utils/persistence.js +281 -0
  80. package/lib/utils/persistence.js.map +1 -0
  81. package/lib/utils/plugin-registry.d.ts +40 -0
  82. package/lib/utils/plugin-registry.js +53 -0
  83. package/lib/utils/plugin-registry.js.map +1 -0
  84. package/package.json +59 -3
  85. package/types/core/DOMChangesPluginLite.d.ts +10 -7
  86. package/types/core/ExposureTracker.d.ts +6 -0
  87. package/types/entries/dom-with-overrides-lite.d.ts +2 -0
  88. package/types/index.d.ts +8 -2
  89. package/types/overrides/OverridesPluginLite.d.ts +8 -0
  90. package/types/overrides/overridesUtils.d.ts +10 -5
  91. package/types/types/index.d.ts +1 -0
  92. package/types/url-redirect/URLRedirectExtractor.d.ts +16 -0
  93. package/types/url-redirect/URLRedirectMatcher.d.ts +8 -0
  94. package/types/url-redirect/URLRedirectPlugin.d.ts +21 -0
  95. package/types/url-redirect/index.d.ts +4 -0
  96. package/types/url-redirect/types.d.ts +29 -0
  97. package/types/utils/persistence.d.ts +23 -0
  98. package/types/utils/plugin-registry.d.ts +40 -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.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.")},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a};Object.defineProperty(t,"__esModule",{value:!0}),t.PendingChangeManager=void 0;var a=r(609),l=function(){function e(e,t){void 0===t&&(t=!1),this.applyFn=e,this.pending=new Map,this.observers=new Map,this.appliedSelectors=new Set,this.batchTimer=null,this.batchedWork=new Set,this.debug=t}return e.prototype.addPending=function(e){var t=e.change,r=e.observerRoot,i=r;r&&!document.querySelector(r)&&(this.debug&&(0,a.logDebug)("[ABsmartly] Observer root not found, using document:",r),i=void 0);var o="".concat(t.selector,"-").concat(i||"document");this.debug&&(0,a.logDebug)("[ABsmartly] Adding pending change for selector:",t.selector);var l=this.getObserverRoot(i).querySelector(t.selector);if(l)this.applyChange(l,n(n({},e),{observerRoot:i}));else{var s=this.pending.get(o)||[];s.push(n(n({},e),{observerRoot:i})),this.pending.set(o,s),this.ensureObserver(i)}},e.prototype.removePending=function(e,t,r){var n="".concat(e,"-").concat(r||"document"),i=this.pending.get(n);if(i){var o=i.filter(function(e){return e.experimentName!==t});0===o.length?this.pending.delete(n):this.pending.set(n,o)}this.checkObserverCleanup(r)},e.prototype.removeAllPending=function(e){var t,r;try{for(var n=i(this.pending.entries()),a=n.next();!a.done;a=n.next()){var l=o(a.value,2),s=l[0],c=l[1].filter(function(t){return t.experimentName!==e});0===c.length?this.pending.delete(s):this.pending.set(s,c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}this.cleanupObservers()},e.prototype.ensureObserver=function(e){var t=this,r=e||"document";if(!this.observers.has(r)){var n=this.getObserverRoot(e),i=new MutationObserver(function(r){t.handleMutations(r,e)});i.observe(n,{childList:!0,subtree:!0}),this.observers.set(r,i),this.debug&&(0,a.logDebug)("[ABsmartly] Started observer for root:",r)}},e.prototype.handleMutations=function(e,t){var r,n,a,l,s=this,c=[];try{for(var u=i(e),h=u.next();!h.done;h=u.next()){var g=h.value,p=function(e){var r,n,a,l;if(!(e instanceof Element))return"continue";var u=t||"document";try{for(var h=(r=void 0,i(d.pending.entries())),g=h.next();!g.done;g=h.next()){var p=o(g.value,2),f=p[0],y=p[1];if(f.endsWith("-".concat(u))){var v=function(t){var r=t.change;if(e.matches(r.selector))return c.push(function(){return s.applyChange(e,t)}),"continue";e.querySelectorAll(r.selector).forEach(function(e){c.push(function(){return s.applyChange(e,t)})})};try{for(var m=(a=void 0,i(y)),b=m.next();!b.done;b=m.next()){v(b.value)}}catch(e){a={error:e}}finally{try{b&&!b.done&&(l=m.return)&&l.call(m)}finally{if(a)throw a.error}}}}}catch(e){r={error:e}}finally{try{g&&!g.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}},d=this;try{for(var f=(a=void 0,i(g.addedNodes)),y=f.next();!y.done;y=f.next()){p(y.value)}}catch(e){a={error:e}}finally{try{y&&!y.done&&(l=f.return)&&l.call(f)}finally{if(a)throw a.error}}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}c.length>0&&this.batchWork(c)},e.prototype.batchWork=function(e){var t=this;e.forEach(function(e){return t.batchedWork.add(e)}),this.batchTimer&&clearTimeout(this.batchTimer),this.batchTimer=setTimeout(function(){t.processBatchedWork()},32)},e.prototype.processBatchedWork=function(){var e=Array.from(this.batchedWork);this.batchedWork.clear(),this.batchTimer=null,this.debug&&e.length>0&&(0,a.logDebug)("[ABsmartly] Processing batched work:",e.length,"items"),e.forEach(function(e){return e()})},e.prototype.applyChange=function(e,t){var r=t.change,n=t.experimentName,i=t.observerRoot,o="".concat(r.selector,"-").concat(i||"document","-").concat(n);if(!this.appliedSelectors.has(o)&&(this.debug&&(0,a.logDebug)("[ABsmartly] Applying pending change to element:",r.selector),this.applyFn(r,n,e))){this.appliedSelectors.add(o);var l="".concat(r.selector,"-").concat(i||"document"),s=this.pending.get(l);if(s){var c=s.filter(function(e){return e.experimentName!==n||e.change.selector!==r.selector});0===c.length?this.pending.delete(l):this.pending.set(l,c)}this.checkObserverCleanup(i)}},e.prototype.getObserverRoot=function(e){if(!e)return document.documentElement;var t=document.querySelector(e);return t||document.documentElement},e.prototype.checkObserverCleanup=function(e){var t,r,n=e||"document",o=!1;try{for(var l=i(this.pending.keys()),s=l.next();!s.done;s=l.next()){if(s.value.endsWith("-".concat(n))){o=!0;break}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}if(!o){var c=this.observers.get(n);c&&(c.disconnect(),this.observers.delete(n),this.debug&&(0,a.logDebug)("[ABsmartly] Disconnected observer for root:",n))}},e.prototype.cleanupObservers=function(){var e,t,r,n,o=this,l=[];try{for(var s=i(this.observers.keys()),c=s.next();!c.done;c=s.next()){var u=c.value,h=!1;try{for(var g=(r=void 0,i(this.pending.keys())),p=g.next();!p.done;p=g.next()){if(p.value.endsWith("-".concat(u))){h=!0;break}}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=g.return)&&n.call(g)}finally{if(r)throw r.error}}h||l.push(u)}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}l.forEach(function(e){var t=o.observers.get(e);t&&(t.disconnect(),o.observers.delete(e),o.debug&&(0,a.logDebug)("[ABsmartly] Cleaned up observer for root:",e))})},e.prototype.destroy=function(){var e,t;this.batchTimer&&(clearTimeout(this.batchTimer),this.batchTimer=null);try{for(var r=i(this.observers.values()),n=r.next();!n.done;n=r.next()){n.value.disconnect()}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.observers.clear(),this.pending.clear(),this.appliedSelectors.clear(),this.batchedWork.clear(),this.debug&&(0,a.logDebug)("[ABsmartly] PendingChangeManager destroyed")},e.prototype.getPendingCount=function(){var e,t,r=0;try{for(var n=i(this.pending.values()),o=n.next();!o.done;o=n.next()){r+=o.value.length}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}return r},e.prototype.getAppliedCount=function(){return this.appliedSelectors.size},e.prototype.hasPendingForExperiment=function(e){var t,r;try{for(var n=i(this.pending.values()),o=n.next();!o.done;o=n.next()){if(o.value.some(function(t){return t.experimentName===e}))return!0}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return!1},e}();t.PendingChangeManager=l},253:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},o=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.HTMLInjector=void 0;var a=r(609),l=r(973),s=function(){function e(e){void 0===e&&(e=!1),this.injectedIds=new Set,this.debug=e}return e.prototype.parseInjectionKey=function(e){var t,r;try{for(var i=n(["headStart","headEnd","bodyStart","bodyEnd"]),o=i.next();!o.done;o=i.next()){var l=o.value;if(e===l)return{location:l,priority:0};if(e.startsWith(l)){var s=e.substring(l.length),c=parseInt(s,10);if(!isNaN(c))return{location:l,priority:c}}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return this.debug&&(0,a.logDebug)("[HTMLInjector] Invalid injection key:",e),null},e.prototype.collectInjections=function(e,t){var r,o,s,c,u,h,g,p;void 0===t&&(t=window.location.href);var d=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)),E=x.next();!E.done;E=x.next()){var A=i(E.value,2),w=A[0],D=A[1];if(D&&"object"==typeof D){if(D.urlFilter)if(!l.URLMatcher.matches(D.urlFilter,t)){this.debug&&(0,a.logDebug)("[HTMLInjector] Skipping ".concat(m," variant ").concat(w," - URL filter doesn't match:"),{currentUrl:t,urlFilter:D.urlFilter});continue}var S=D.data;if(S&&"object"==typeof S)try{for(var C=(u=void 0,n(Object.entries(S))),O=C.next();!O.done;O=C.next()){var M=i(O.value,2),j=M[0],T=M[1];if("string"==typeof T){var B=this.parseInjectionKey(j);if(B){var _={code:T,priority:B.priority,location:B.location};d.has(B.location)||d.set(B.location,[]),d.get(B.location).push(_),this.debug&&(0,a.logDebug)("[HTMLInjector] Collected injection:",{experiment:m,variant:w,location:B.location,priority:B.priority,codeLength:T.length})}}else this.debug&&(0,a.logDebug)("[HTMLInjector] Skipping non-string injection code for key ".concat(j,":"),T)}}catch(e){u={error:e}}finally{try{O&&!O.done&&(h=C.return)&&h.call(C)}finally{if(u)throw u.error}}else this.debug&&(0,a.logDebug)("[HTMLInjector] Invalid injection data for ".concat(m," variant ").concat(w,":"),S)}else this.debug&&(0,a.logDebug)("[HTMLInjector] Invalid injection data for ".concat(m," variant ").concat(w,":"),D)}}catch(e){s={error:e}}finally{try{E&&!E.done&&(c=x.return)&&c.call(x)}finally{if(s)throw s.error}}}}catch(e){r={error:e}}finally{try{y&&!y.done&&(o=f.return)&&o.call(f)}finally{if(r)throw r.error}}try{for(var k=n(d),P=k.next();!P.done;P=k.next()){var L=i(P.value,2),R=L[0],N=L[1];N.sort(function(e,t){return t.priority-e.priority}),this.debug&&(0,a.logDebug)("[HTMLInjector] Sorted ".concat(R," injections by priority:"),{location:R,count:N.length,priorities:N.map(function(e){return e.priority})})}}catch(e){g={error:e}}finally{try{P&&!P.done&&(p=k.return)&&p.call(k)}finally{if(g)throw g.error}}return d},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],p=h[1],d="headStart"===g||"bodyStart"===g?o([],i(p),!1).reverse():p;try{for(var f=(l=void 0,n(d)),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,a.logDebug)("[HTMLInjector] All injections complete")},e.prototype.injectAtLocation=function(e,t){var r="absmartly-inject-".concat(e,"-").concat(Date.now(),"-").concat(Math.random());if(!this.injectedIds.has(r))try{switch(e){case"headStart":this.injectHeadStart(t,r);break;case"headEnd":this.injectHeadEnd(t,r);break;case"bodyStart":this.injectBodyStart(t,r);break;case"bodyEnd":this.injectBodyEnd(t,r)}this.injectedIds.add(r),this.debug&&(0,a.logDebug)("[HTMLInjector] Injected at ".concat(e,":"),{location:e,codeLength:t.length,injectionId:r})}catch(t){this.debug&&(0,a.logDebug)("[HTMLInjector] Error injecting at ".concat(e,":"),t)}},e.prototype.injectHeadStart=function(e,t){if(document.head){var r=this.createContainer(e,t);document.head.insertBefore(r,document.head.firstChild)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <head> element not found for headStart injection")},e.prototype.injectHeadEnd=function(e,t){if(document.head){var r=this.createContainer(e,t);document.head.appendChild(r)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <head> element not found for headEnd injection")},e.prototype.injectBodyStart=function(e,t){if(document.body){var r=this.createContainer(e,t);document.body.insertBefore(r,document.body.firstChild)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <body> element not found for bodyStart injection")},e.prototype.injectBodyEnd=function(e,t){if(document.body){var r=this.createContainer(e,t);document.body.appendChild(r)}else this.debug&&(0,a.logDebug)("[HTMLInjector] <body> element not found for bodyEnd injection")},e.prototype.createContainer=function(e,t){var r=document.createElement("div");return r.id=t,r.setAttribute("data-absmartly-injection","true"),r.innerHTML=e,r},e.prototype.destroy=function(){var e,t;try{for(var r=n(this.injectedIds),i=r.next();!i.done;i=r.next()){var o=i.value,l=document.getElementById(o);l&&l.remove()}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.injectedIds.clear(),this.debug&&(0,a.logDebug)("[HTMLInjector] Destroyed and cleaned up all injections")},e}();t.HTMLInjector=s},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 o=r(702);Object.defineProperty(t,"DOMChangesPluginLite",{enumerable:!0,get:function(){return o.DOMChangesPluginLite}}),Object.defineProperty(t,"DOMChangesPlugin",{enumerable:!0,get:function(){return o.DOMChangesPluginLite}}),i(r(574),t),t.default=o.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.")},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.VariantExtractor=void 0;var l=r(609),s=r(973),c=function(){function e(e,t,r){void 0===t&&(t="__dom_changes"),void 0===r&&(r=!1),this.cachedAllChanges=null,this.context=e,this.variableName=t,this.debug=r}return e.prototype.clearCache=function(){this.cachedAllChanges=null},e.prototype.extractAllChanges=function(){var e,t,r,n,s,c,u;if(this.cachedAllChanges)return this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Returning cached changes"),this.cachedAllChanges;var h=new Map;try{var g=this.context.data();if((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 p=i(g.experiments),d=p.next();!d.done;d=p.next()){var f=d.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=o(e,2),r=t[0],n=t[1];return{variant:r,changeCount:n.length,changeTypes:a([],o(new Set(n.map(function(e){return e.type}))),!1)}})})):this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Experiment '".concat(f.name,"' has no DOM changes"))}}catch(t){e={error:t}}finally{try{d&&!d.done&&(t=p.return)&&t.call(p)}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((0,l.logDebug)("[DEBUG] Processing experiment:",e.name,"with",(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:",e.name),r;for(var n=0;n<e.variants.length;n++){var i=e.variants[n];if(i){var o=null;if(i.config)try{var a="string"==typeof i.config?JSON.parse(i.config):i.config;(0,l.logDebug)("[VariantExtractor DEBUG] Parsed config for variant ".concat(n,":"),a),a&&a[this.variableName]?(o=a[this.variableName],(0,l.logDebug)("[VariantExtractor DEBUG] ✓ Found DOM changes in config[".concat(this.variableName,"]:"),o)):(0,l.logDebug)("[VariantExtractor DEBUG] ✗ No ".concat(this.variableName," field found in parsed config for variant ").concat(n))}catch(e){(0,l.logDebug)("[VariantExtractor DEBUG] ✗ Failed to parse variant.config for variant ".concat(n,":"),e,"Raw config:","string"==typeof i.config?i.config.substring(0,100):"")}else(0,l.logDebug)("[VariantExtractor DEBUG] ✗ No config field found for variant ".concat(n));if(o){var s=this.extractChangesFromData(o);s&&s.length>0&&r.set(n,s)}}}return r},e.prototype.extractChangesFromData=function(e){if(!e)return null;if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return(0,l.logDebug)("[ABsmartly] Failed to parse DOM changes JSON:",e),null}if(e&&"object"==typeof e&&!Array.isArray(e)&&"changes"in e){var t=e;return this.parseChanges(t.changes)}return this.parseChanges(e)},e.prototype.getExperimentChanges=function(e){var t=this.extractAllChanges().get(e);if(!t||0===t.size)return null;var r=this.context.peek(e);return null==r?(this.debug&&(0,l.logDebug)("[ABsmartly] No variant selected for ".concat(e)),null):t.get(r)||null},e.prototype.parseChanges=function(e){var t,r;if(!e)return null;if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return(0,l.logDebug)("[ABsmartly] Failed to parse DOM changes JSON:",e),null}if(!Array.isArray(e))return this.debug&&(0,l.logDebug)("[ABsmartly] DOM changes data is not an array"),null;var n=[];try{for(var o=i(e),a=o.next();!a.done;a=o.next()){var s=a.value;this.isValidChange(s)?n.push(s):this.debug&&(0,l.logDebug)("[ABsmartly] Invalid DOM change:",s)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}return n.length>0?n:null},e.prototype.isValidChange=function(e){if(!e||"object"!=typeof e)return!1;var t=e;if(void 0===t.selector||null===t.selector||!t.type)return!1;if(!["text","html","style","class","attribute","javascript","move","create","delete","styleRules"].includes(t.type))return!1;switch(t.type){case"class":if(!t.add&&!t.remove)return!1;if(t.add&&!Array.isArray(t.add))return!1;if(t.remove&&!Array.isArray(t.remove))return!1;break;case"move":if(!t.targetSelector)return!1;break;case"create":if(!t.element||!t.targetSelector)return!1;break;case"style":case"attribute":if(!t.value||"object"!=typeof t.value)return!1}return!0},e.prototype.getAllVariantChanges=function(e){var t=this.extractAllChanges().get(e);if(!t)return[];for(var r=Math.max.apply(Math,a([],o(t.keys()),!1)),n=[],i=0;i<=r;i++)n.push(t.get(i)||[]);return n},e.prototype.getExperiment=function(e){try{var t=this.context.data();return t&&t.experiments&&t.experiments.find(function(t){return t.name===e})||null}catch(t){return this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Failed to get experiment '".concat(e,"' - context may not be ready:"),t),null}},e.prototype.getAllVariantsData=function(e){var t=new Map;try{var r=this.context.data();if(!(null==r?void 0:r.experiments))return t;var n=r.experiments.find(function(t){return t.name===e});if(!(null==n?void 0:n.variants))return t;for(var i=0;i<n.variants.length;i++){var o=n.variants[i];if(o){var a=null;if(o.variables&&o.variables[this.variableName])a=o.variables[this.variableName];else if(o.config)try{var s="string"==typeof o.config?JSON.parse(o.config):o.config;s&&s[this.variableName]&&(a=s[this.variableName])}catch(e){(0,l.logDebug)("[VariantExtractor] Failed to parse variant.config:",e)}if(a){if("string"==typeof a)try{a=JSON.parse(a)}catch(e){(0,l.logDebug)("[ABsmartly] Failed to parse DOM changes JSON:",e);continue}t.set(i,a)}}}}catch(e){(0,l.logDebug)("[ABsmartly] Error getting all variants data:",e)}return t},e.prototype.anyVariantMatchesURL=function(e,t){var r,n;void 0===t&&(t=window.location.href);var a=this.getAllVariantsData(e),l=!1;try{for(var c=i(a),u=c.next();!u.done;u=c.next()){var 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,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 o=i(n.experiments),a=o.next();!a.done;a=o.next()){var s=a.value,c=this.extractInjectHTMLForExperiment(s);c.size>0&&(r.set(s.name,c),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Experiment '".concat(s.name,"' has HTML injections:"),{variantsWithInjections:Array.from(c.keys())}))}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}catch(e){(0,l.logDebug)("[ABsmartly] Error extracting __inject_html:",e)}return r},e.prototype.extractInjectHTMLForExperiment=function(e){var t=new Map;if(!e.variants)return t;for(var r=0;r<e.variants.length;r++){var i=e.variants[r];if(i){var o=null;if(i.variables&&i.variables.__inject_html)o=i.variables.__inject_html,this.debug&&(0,l.logDebug)("[VariantExtractor] Found __inject_html in variables for ".concat(e.name," variant ").concat(r));else if(i.config)try{var a="string"==typeof i.config?JSON.parse(i.config):i.config;a&&a.__inject_html&&(o=a.__inject_html,this.debug&&(0,l.logDebug)("[VariantExtractor] Found __inject_html in config for ".concat(e.name," variant ").concat(r)))}catch(t){(0,l.logDebug)("[VariantExtractor] Failed to parse variant.config for ".concat(e.name," variant ").concat(r,":"),t)}if(o&&"object"==typeof o&&!Array.isArray(o)){var s=o,c=s.urlFilter,u=n(s,["urlFilter"]),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 o&&this.debug&&(0,l.logDebug)("[VariantExtractor] Invalid __inject_html format in ".concat(e.name," variant ").concat(r),o)}}return t},e}();t.VariantExtractor=c},574:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},609:function(e,t){var r=this&&this.__assign||function(){return r=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},r.apply(this,arguments)},n=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},i=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};function o(){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 o=n(e,2),a=o[0],l=o[1];if(a.includes("Original state already stored"))return;if(a.includes("State store operation"))return;if(a.includes("Performance:")&&(null==l?void 0:l.duration)&&l.duration<5)return;if(a.includes("Message sent:")||a.includes("Message received:"))return;var s=(new Date).toISOString(),c="[ABsmartly Debug]";console.log("".concat(c," [").concat(s,"] ").concat(a),l)}else if(1===e.length&&"string"==typeof e[0]){if((a=e[0]).includes("Original state already stored"))return;if(a.includes("State store operation"))return;if(a.includes("Message sent:")||a.includes("Message received:"))return;s=(new Date).toISOString(),c="[ABsmartly Debug]";console.log("".concat(c," [").concat(s,"] ").concat(a))}else console.log.apply(console,i([],n(e),!1))}Object.defineProperty(t,"__esModule",{value:!0}),t.DEBUG=void 0,t.logDebug=o,t.logChangeApplication=function(e,r,n,i,a){if(t.DEBUG){o("".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){o("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){o('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){o("State ".concat(e," operation"),{operation:e,selector:r,changeType:n,experimentName:i})}},t.logVisibilityEvent=function(e,r,n){if(t.DEBUG){o(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){o("Message ".concat(e,": ").concat(r),{direction:e,messageType:r,payload:n,bridge:"extension"})}},t.logPerformance=function(e,n,i){if(t.DEBUG){o("Performance: ".concat(e," took ").concat(n,"ms"),r({operation:e,duration:n,performance:!0},i))}},t.DEBUG=!1},693:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StyleSheetManager=void 0;var n=r(609),i=function(){function e(e,t){void 0===t&&(t=!1),this.id=e,this.styleEl=null,this.rules=new Map,this.debug=t}return e.prototype.ensure=function(){if(!(this.styleEl&&document.head.contains(this.styleEl)||(this.styleEl=document.getElementById(this.id),this.styleEl))){var e=document.createElement("style");e.id=this.id,e.setAttribute("data-absmartly-styles","true"),document.head.appendChild(e),this.styleEl=e,this.debug&&(0,n.logDebug)("[ABsmartly] Created stylesheet: ".concat(this.id))}return this.styleEl},e.prototype.setRule=function(e,t){this.rules.set(e,t),this.render(),this.debug&&(0,n.logDebug)("[ABsmartly] Set CSS rule for ".concat(e))},e.prototype.deleteRule=function(e){this.rules.delete(e)&&(this.render(),this.debug&&(0,n.logDebug)("[ABsmartly] Deleted CSS rule for ".concat(e)))},e.prototype.hasRule=function(e){return this.rules.has(e)},e.prototype.clear=function(){var e=this.rules.size>0;this.rules.clear(),e&&(this.render(),this.debug&&(0,n.logDebug)("[ABsmartly] Cleared all CSS rules from ".concat(this.id)))},e.prototype.destroy=function(){this.clear(),this.styleEl&&document.head.contains(this.styleEl)&&(this.styleEl.remove(),this.styleEl=null,this.debug&&(0,n.logDebug)("[ABsmartly] Destroyed stylesheet: ".concat(this.id)))},e.prototype.render=function(){var e=this.ensure(),t=Array.from(this.rules.values()).join("\n\n");e.textContent=t},e.prototype.getRulesCount=function(){return this.rules.size},e.prototype.getCssText=function(){return Array.from(this.rules.values()).join("\n\n")},e}();t.StyleSheetManager=i},702:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)},i=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},o=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},a=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},l=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMChangesPluginLite=void 0;var s=r(964),c=r(356),u=r(693),h=r(713),g=r(253),p=r(609),d=r(973),f=function(){function e(t){var r,n,i,o,a,l,u,d,f=this;if(this.mutationObserver=null,this.exposedExperiments=new Set,this.eventListeners=new Map,this.styleManagers=new Map,this.initialized=!1,this.watchedElements=new WeakMap,this.persistenceObserver=null,this.reapplyingElements=new Set,this.reapplyLogThrottle=new Map,this.appliedChanges=new Map,this.antiFlickerTimeout=null,this.antiFlickerStyleId="absmartly-antiflicker",this.config={context:t.context,autoApply:null===(r=t.autoApply)||void 0===r||r,spa:null===(n=t.spa)||void 0===n||n,visibilityTracking:null===(i=t.visibilityTracking)||void 0===i||i,variableName:null!==(o=t.variableName)&&void 0!==o?o:"__dom_changes",debug:null!==(a=t.debug)&&void 0!==a&&a,hideUntilReady:null!==(l=t.hideUntilReady)&&void 0!==l&&l,hideTimeout:null!==(u=t.hideTimeout)&&void 0!==u?u:3e3,hideTransition:null!==(d=t.hideTransition)&&void 0!==d&&d},!this.config.context)throw new Error("[ABsmartly] Context is required");console.log("[ABsmartly] DOMChangesPluginLite v".concat(e.VERSION," initialized")),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.readyPromise=this.config.context.ready().then(function(){return(0,p.logDebug)("[DOMChangesPluginLite] Context is ready, starting initialization"),f.initialize()}).catch(function(e){throw(0,p.logDebug)("[DOMChangesPluginLite] ERROR during initialization:",e),e})}return e.prototype.ready=function(){return i(this,void 0,void 0,function(){return o(this,function(e){return[2,this.readyPromise]})})},e.prototype.initialize=function(){return i(this,void 0,void 0,function(){var t,r,n;return o(this,function(i){switch(i.label){case 0:if(this.initialized)return(0,p.logDebug)("Plugin already initialized"),[2];t=performance.now(),(0,p.logDebug)("Initializing ABsmartly DOM Changes Plugin Lite",{version:e.VERSION,config:{autoApply:this.config.autoApply,spa:this.config.spa,visibilityTracking:this.config.visibilityTracking,DEBUG:p.DEBUG}}),i.label=1;case 1:return i.trys.push([1,4,,5]),this.config.spa&&(this.setupMutationObserver(),this.setupURLChangeListener()),this.config.autoApply?[4,this.applyInjectionsAndChanges()]:[3,3];case 2:i.sent(),i.label=3;case 3:return this.initialized=!0,this.registerWithContext(),this.emit("initialized"),r=performance.now()-t,(0,p.logPerformance)("Plugin initialization",r),(0,p.logDebug)("[ABsmartly] DOM plugin lite loaded successfully (v".concat(e.VERSION,")")),this.config.debug&&(0,p.logDebug)("[ABsmartly] DOM Changes Plugin Lite initialized with debug mode"),[3,5];case 4:throw n=i.sent(),(0,p.logDebug)("[ABsmartly] Failed to initialize plugin:",n),n;case 5:return[2]}})})},e.prototype.setupMutationObserver=function(){var e=this,t=new MutationObserver(function(t){t.forEach(function(t){"childList"===t.type&&t.addedNodes.forEach(function(t){if(t.nodeType===Node.ELEMENT_NODE){var r=t;e.appliedChanges.forEach(function(t,n){t.forEach(function(t){try{(r.matches(t.selector)?[r]:Array.from(r.querySelectorAll(t.selector))).forEach(function(r){e.config.debug&&(0,p.logDebug)("[SPA-REAPPLY] Re-applying change to newly added element (React hydration recovery)",{experimentName:n,selector:t.selector,element:r.tagName,changeType:t.type}),e.domManipulator.applyChange(t,n)})}catch(e){}})})}})})});t.observe(document.body,{childList:!0,subtree:!0}),this.mutationObserver=t},e.prototype.setupURLChangeListener=function(){var e=this,t=function(){return i(e,void 0,void 0,function(){var e;return o(this,function(t){switch(t.label){case 0:return e=window.location.href,(0,p.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]}})})};window.addEventListener("popstate",t);var r=history.pushState,n=history.replaceState;history.pushState=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(history,e),t()},history.replaceState=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];n.apply(history,e),t()},this.config.debug&&(0,p.logDebug)("[ABsmartly] URL change listener set up for SPA mode")},e.prototype.removeAllChanges=function(){return i(this,void 0,void 0,function(){return o(this,function(e){return this.exposedExperiments.clear(),this.styleManagers.clear(),this.appliedChanges.clear(),this.htmlInjector.destroy(),this.variantExtractor.clearCache(),this.config.debug&&(0,p.logDebug)("[ABsmartly] All change tracking cleared for URL change"),[2]})})},e.prototype.applyInjectionsAndChanges=function(){return i(this,void 0,void 0,function(){var e,t,r,n,i;return o(this,function(o){switch(o.label){case 0:e=performance.now(),t=window.location.href,o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.config.context.ready()];case 2:return o.sent(),[3,4];case 3:return r=o.sent(),(0,p.logDebug)("[ABsmartly] Failed to wait for context ready:",r),[2];case 4:return n=this.variantExtractor.extractAllInjectHTML(),[4,Promise.all([this.applyHTMLInjections(n,t),this.applyChanges()])];case 5:return o.sent(),i=performance.now()-e,(0,p.logPerformance)("Apply injections and changes (parallel)",i),this.config.debug&&(0,p.logDebug)("[ABsmartly] HTML injections and DOM changes applied in parallel",{duration:"".concat(i.toFixed(2),"ms"),currentURL:t}),[2]}})})},e.prototype.applyHTMLInjections=function(e){return i(this,arguments,void 0,function(e,t){var r;return void 0===t&&(t=window.location.href),o(this,function(n){return 0===e.size?(this.config.debug&&(0,p.logDebug)("[ABsmartly] No HTML injections found"),[2]):(r=this.htmlInjector.collectInjections(e,t),this.htmlInjector.inject(r),this.config.debug&&(0,p.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,E,A,w,D,S,C,O,M,j,T,B,_,k,P,L,R,N,I,F,V,U,H,z,W,G,q,J,$,Y,Z,K;return o(this,function(o){switch(o.label){case 0:t=performance.now(),r=window.location.href,(0,p.logDebug)("Starting to apply changes",{specificExperiment:e||"all",url:r,action:"apply_start"}),this.config.debug&&((0,p.logDebug)("[ABsmartly] === DOM Changes Application Starting ==="),(0,p.logDebug)("[ABsmartly] Target:",e||"all experiments"),(0,p.logDebug)("[ABsmartly] Current URL:",r),(0,p.logDebug)("[ABsmartly] Context ready:",!0)),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this.config.context.ready()];case 2:return o.sent(),[3,4];case 3:return n=o.sent(),(0,p.logDebug)("[ABsmartly] Failed to wait for context ready:",n),[2];case 4:this.variantExtractor.clearCache(),i=this.getAllExperimentsData(),s=0,c=new Map,(0,p.logDebug)("[ABsmartly] Experiments to process:",Array.from(i.keys())),(0,p.logDebug)("[ABsmartly] Total experiments with changes:",i.size);try{for(u=a(i),h=u.next();!h.done;h=u.next())if(g=l(h.value,2),f=g[0],y=g[1],!e||f===e)if(v=this.config.context.peek(f),m=y.variantData,b=y.urlFilter,x=y.globalDefaults,this.variantExtractor.anyVariantMatchesURL(f,r))if(E=this.shouldApplyVisualChanges(m,b,r),A=this.extractChangesFromData(m,x),w=this.extractAllVariantChanges(f),D=w.some(function(e){return e&&e.length>0}),D){if(S={total:(null==A?void 0:A.length)||0,success:0,pending:0},this.config.debug&&(0,p.logDebug)("[ABsmartly] Processing experiment '".concat(f,"' (variant ").concat(v,"):"),{urlMatches:E,changeCount:(null==A?void 0:A.length)||0,userVariantHasChanges:((null==A?void 0:A.length)||0)>0,changes:(null==A?void 0:A.map(function(e){return{type:e.type,selector:e.selector,trigger:e.trigger_on_view?"viewport":"immediate"}}))||[]}),E&&A&&A.length>0)try{for(q=void 0,C=a(A),O=C.next();!O.done;O=C.next())if(H=O.value,this.domManipulator.applyChange(H,f))s++,S.success++;else if("create"!==H.type&&"styleRules"!==H.type)try{0===document.querySelectorAll(H.selector).length&&(this.config.spa||H.waitForElement)&&S.pending++}catch(e){this.config.debug&&(0,p.logDebug)("[ABsmartly] Invalid selector: ".concat(H.selector),e)}}catch(e){q={error:e}}finally{try{O&&!O.done&&(J=C.return)&&J.call(C)}finally{if(q)throw q.error}}else A&&A.length>0&&(0,p.logDebug)("[ABsmartly] Experiment '".concat(f,"' variant ").concat(v," doesn't match URL filter or has no changes, but setting up tracking for SRM prevention"));M=!1,j=!1,T=this.variantExtractor.getAllVariantsData(f),this.config.debug&&((0,p.logDebug)("[ABsmartly] Checking trigger types for experiment '".concat(f,"' on URL: ").concat(r),{allVariantsDataSize:T.size,allVariantChangesLength:w.length}),T.forEach(function(e,t){(0,p.logDebug)("[ABsmartly] Variant ".concat(t," data structure:"),{isArray:Array.isArray(e),isObject:"object"==typeof e,hasUrlFilter:e&&"object"==typeof e&&!Array.isArray(e)&&"urlFilter"in e,keys:e&&"object"==typeof e&&!Array.isArray(e)?Object.keys(e):"N/A"})}));try{for($=void 0,B=a(T),_=B.next();!_.done;_=B.next())if(k=l(_.value,2),P=k[0],L=k[1],(R=w[P])&&0!==R.length){if(N=!0,L&&"object"==typeof L&&!Array.isArray(L)&&"urlFilter"in(I=L)&&I.urlFilter&&(F=I,N=d.URLMatcher.matches(F.urlFilter,r),this.config.debug&&(0,p.logDebug)("[ABsmartly] Variant ".concat(P," has URL filter, matches: ").concat(N))),N){try{for(Z=void 0,V=a(R),U=V.next();!U.done&&((H=U.value).trigger_on_view?M=!0:j=!0,!M||!j);U=V.next());}catch(e){Z={error:e}}finally{try{U&&!U.done&&(K=V.return)&&K.call(V)}finally{if(Z)throw Z.error}}this.config.debug&&(0,p.logDebug)("[ABsmartly] Variant ".concat(P," matches URL - hasImmediate: ").concat(j,", hasViewport: ").concat(M))}else this.config.debug&&(0,p.logDebug)("[ABsmartly] Variant ".concat(P," does NOT match URL - skipping"));if(M&&j)break}}catch(e){$={error:e}}finally{try{_&&!_.done&&(Y=B.return)&&Y.call(B)}finally{if($)throw $.error}}this.config.debug&&(0,p.logDebug)("[ABsmartly] Final trigger decision for '".concat(f,"': hasImmediate=").concat(j,", hasViewport=").concat(M)),(M||j)&&this.exposureTracker.registerExperiment(f,v||0,A||[],w,j,M),c.set(f,S),(0,p.logExperimentSummary)(f,S.total,S.success,S.pending)}else this.config.debug&&(0,p.logDebug)("[ABsmartly] Skipping experiment '".concat(f,"' - no variants have changes"));else(0,p.logDebug)("[ABsmartly] Skipping experiment '".concat(f,"' - no variant matches URL: ").concat(r))}catch(e){W={error:e}}finally{try{h&&!h.done&&(G=u.return)&&G.call(u)}finally{if(W)throw W.error}}return z=performance.now()-t,(0,p.logPerformance)("Apply changes",z,{totalApplied:s,experiments:c.size}),this.config.debug&&((0,p.logDebug)("[ABsmartly] === DOM Changes Application Complete ==="),(0,p.logDebug)("[ABsmartly] Summary:",{totalChangesApplied:s,experimentsProcessed:c.size,duration:"".concat(z.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(),this.emit("changes-applied",{count:s,experimentName:e}),[2]}})})},e.prototype.getAllExperimentsData=function(){var e,t,r=new Map,n=this.variantExtractor.extractAllChanges();try{for(var i=a(n),o=i.next();!o.done;o=i.next()){var s=l(o.value,1)[0],c=this.config.context.peek(s);if(null!=c){var u=this.variantExtractor.getAllVariantsData(s).get(c);if(u){var h=null,g={};if(u&&"object"==typeof u&&!Array.isArray(u)&&"changes"in u){var p=u;h=p.urlFilter,g={waitForElement:p.waitForElement,persistStyle:p.persistStyle,important:p.important,observerRoot:p.observerRoot}}r.set(s,{variantData:u,urlFilter:h,globalDefaults:g})}}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return r},e.prototype.extractChangesFromData=function(e,t){var r=null;return Array.isArray(e)?r=e:e&&"object"==typeof e&&"changes"in e&&(r=e.changes),r&&0!==r.length?r.map(function(e){var r,i,o,a;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,important:null!==(o=e.important)&&void 0!==o?o:t.important,observerRoot:null!==(a=e.observerRoot)&&void 0!==a?a:t.observerRoot})}):null},e.prototype.extractAllVariantChanges=function(e){for(var t=this.variantExtractor.getAllVariantChanges(e),r=this.variantExtractor.getAllVariantsData(e),i=[],o=function(e){var o=t[e],a=r.get(e);if(!o||0===o.length)return i.push([]),"continue";var l={};if(a&&"object"==typeof a&&!Array.isArray(a)&&"changes"in a){var s=a;l={waitForElement:s.waitForElement,persistStyle:s.persistStyle,important:s.important,observerRoot:s.observerRoot}}var c=o.map(function(e){var t,r,i,o;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,important:null!==(i=e.important)&&void 0!==i?i:l.important,observerRoot:null!==(o=e.observerRoot)&&void 0!==o?o:l.observerRoot})});i.push(c)},a=0;a<t.length;a++)o(a);return i},e.prototype.shouldApplyVisualChanges=function(e,t,r){return!!Array.isArray(e)||(!t||d.URLMatcher.matches(t,r))},e.prototype.hasChanges=function(e){return this.domManipulator.hasChanges(e)},e.prototype.applyChange=function(e,t){(0,p.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}),r}catch(e){return this.config.debug&&(0,p.logDebug)("[ABsmartly] Error applying change:",e),!1}},e.prototype.on=function(e,t){var r=this.eventListeners.get(e)||[];r.push(t),this.eventListeners.set(e,r)},e.prototype.off=function(e,t){if(t){var r=this.eventListeners.get(e)||[],n=r.indexOf(t);-1!==n&&r.splice(n,1)}else this.eventListeners.delete(e)},e.prototype.emit=function(e,t){var r,n,i=this.eventListeners.get(e)||[];try{for(var o=a(i),l=o.next();!l.done;l=o.next()){var s=l.value;try{s(t)}catch(t){(0,p.logDebug)("[ABsmartly] Error in event listener for ".concat(e,":"),t)}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},e.prototype.getStyleManager=function(e){var t="absmartly-styles-".concat(e),r=this.styleManagers.get(e);return r||(r=new u.StyleSheetManager(t,this.config.debug),this.styleManagers.set(e,r)),r},e.prototype.buildCssRule=function(e,t,r){void 0===r&&(r=!0);var n=Object.entries(t).map(function(e){var t=l(e,2),n=t[0],i=t[1],o=n.replace(/([A-Z])/g,"-$1").toLowerCase(),a=r?" !important":"";return" ".concat(o,": ").concat(i).concat(a,";")}).join("\n");return"".concat(e," {\n").concat(n,"\n}")},e.prototype.buildStateRules=function(e,t,r){void 0===r&&(r=!0);var n=[];return t.normal&&n.push(this.buildCssRule(e,t.normal,r)),t.hover&&n.push(this.buildCssRule("".concat(e,":hover"),t.hover,r)),t.active&&n.push(this.buildCssRule("".concat(e,":active"),t.active,r)),t.focus&&n.push(this.buildCssRule("".concat(e,":focus"),t.focus,r)),n.join("\n\n")},e.prototype.refreshExperiments=function(){this.config.debug&&(0,p.logDebug)("[ABsmartly] Refreshing experiments and clearing cache"),this.variantExtractor.clearCache(),this.config.autoApply&&this.applyInjectionsAndChanges()},e.prototype.destroy=function(){this.domManipulator.destroy(),this.exposureTracker.destroy(),this.htmlInjector.destroy(),this.styleManagers.forEach(function(e){return e.destroy()}),this.styleManagers.clear(),this.mutationObserver&&(this.mutationObserver.disconnect(),this.mutationObserver=null),this.persistenceObserver&&(this.persistenceObserver.disconnect(),this.persistenceObserver=null),null!==this.antiFlickerTimeout&&(clearTimeout(this.antiFlickerTimeout),this.antiFlickerTimeout=null);var e=document.getElementById(this.antiFlickerStyleId);e&&e.remove(),this.eventListeners.clear(),this.exposedExperiments.clear(),this.watchedElements=new WeakMap,this.appliedChanges.clear(),this.reapplyingElements.clear(),this.reapplyLogThrottle.clear(),this.unregisterFromContext(),this.initialized=!1,this.config.debug&&(0,p.logDebug)("[ABsmartly] DOM Changes Plugin Lite destroyed")},e.prototype.registerWithContext=function(){this.config.context&&(this.config.context.__plugins||(this.config.context.__plugins={}),this.config.context.__plugins.domPlugin={name:"DOMChangesPluginLite",version:e.VERSION,initialized:!0,capabilities:["spa","visibility"],instance:this,timestamp:Date.now()},this.config.context.__domPlugin=this.config.context.__plugins.domPlugin,this.config.debug&&(0,p.logDebug)("[ABsmartly] DOMChangesPluginLite registered with context at __plugins.domPlugin"))},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,p.logDebug)("[ABsmartly] DOMChangesPluginLite unregistered from context"))},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,p.logDebug)("[ABsmartly] Anti-flicker timeout reached (".concat(e.config.hideTimeout,"ms), showing content")),e.showContent()},this.config.hideTimeout),this.config.debug&&(0,p.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,p.logDebug)("[ABsmartly] Anti-flicker fade-in complete, style removed")},n),this.config.debug&&(0,p.logDebug)("[ABsmartly] Anti-flicker fading in with transition: ".concat(this.config.hideTransition))}else t.remove(),this.config.debug&&(0,p.logDebug)("[ABsmartly] Anti-flicker removed, content now visible")},e.prototype.watchElement=function(e,t,r){var n=this.watchedElements.get(e);n||(n=new Set,this.watchedElements.set(e,n)),n.add(t),this.appliedChanges.has(t)||this.appliedChanges.set(t,[]);var i=this.appliedChanges.get(t);if(!i.includes(r)&&(i.push(r),this.config.debug)){var o={};r.value&&"object"==typeof r.value&&Object.keys(r.value).forEach(function(t){var r=t.replace(/([A-Z])/g,"-$1").toLowerCase();o[r]=e.style.getPropertyValue(r)}),(0,p.logDebug)("[WATCH-ELEMENT] Started watching element for persistence/hydration recovery",{experimentName:t,selector:r.selector,element:e.tagName,changeType:r.type,value:r.value,currentStyles:"style"===r.type?o: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.setupPersistenceObserver=function(){var e=this;this.persistenceObserver||(this.config.debug&&(0,p.logDebug)("[PERSISTENCE-OBSERVER] Setting up persistence observer",{timestamp:Date.now(),watchedElementsCount:this.watchedElements?"has WeakMap":"no WeakMap"}),this.persistenceObserver=new MutationObserver(function(t){e.config.debug&&(0,p.logDebug)("[MUTATION-DETECTED] Persistence observer detected mutations",{mutationCount:t.length,timestamp:Date.now(),mutations:t.map(function(e){var t;return{target:e.target.tagName,oldValue:null===(t=e.oldValue)||void 0===t?void 0:t.substring(0,100)}})}),t.forEach(function(t){var r=t.target;if(e.reapplyingElements.has(r))e.config.debug&&(0,p.logDebug)("[MUTATION-SKIP] Skipping mutation - currently reapplying",{element:r.tagName});else{var n=e.watchedElements.get(r);if(n){if(e.config.debug){var i="mutation:".concat(r.tagName,":").concat(r.getAttribute("name")||r.className),o=Date.now();o-(e.reapplyLogThrottle.get(i)||0)>5e3&&((0,p.logDebug)("[MUTATION-ON-WATCHED] Style mutation detected on watched element",{element:r.tagName,selector:r.getAttribute("name")||r.className,oldValue:t.oldValue,newValue:r.getAttribute("style"),experiments:Array.from(n)}),e.reapplyLogThrottle.set(i,o))}n.forEach(function(t){var n=e.appliedChanges.get(t);n&&n.forEach(function(n){var i,o;if("style"===n.type)if(e.checkStyleOverwritten(r,n.value)){e.reapplyingElements.add(r);var s="".concat(t,"-").concat(n.selector),c=Date.now(),u=e.reapplyLogThrottle.get(s)||0;if(e.config.debug&&c-u>5e3&&((0,p.logDebug)("[REAPPLY-TRIGGERED] Reapplying style after mutation (React/framework conflict detected)",{experimentName:t,selector:n.selector,element:r.tagName,timestamp:c,note:"This happens when the page framework (React/Vue/etc) fights with DOM changes"}),e.reapplyLogThrottle.set(s,c),e.reapplyLogThrottle.size>100)){var h=c-6e4;try{for(var g=a(e.reapplyLogThrottle.entries()),d=g.next();!d.done;d=g.next()){var f=l(d.value,2),y=f[0];f[1]<h&&e.reapplyLogThrottle.delete(y)}}catch(e){i={error:e}}finally{try{d&&!d.done&&(o=g.return)&&o.call(g)}finally{if(i)throw i.error}}}e.domManipulator.applyChange(n,t),setTimeout(function(){e.reapplyingElements.delete(r)},0)}else e.config.debug&&(0,p.logDebug)("[MUTATION-NO-REAPPLY] Style mutation detected but no reapply needed",{experimentName:t,selector:n.selector})})})}}})}),this.persistenceObserver.observe(document.body,{attributes:!0,attributeFilter:["style"],subtree:!0,attributeOldValue:!0}),this.config.debug&&(0,p.logDebug)("[PERSISTENCE-OBSERVER] Setup complete - now observing style mutations",{target:"document.body",attributeFilter:["style"],subtree:!0,attributeOldValue:!0,timestamp:Date.now()}))},e.prototype.checkStyleOverwritten=function(e,t){var r,n;try{for(var i=a(Object.entries(t)),o=i.next();!o.done;o=i.next()){var s=l(o.value,2),c=s[0],u=s[1],h=c.replace(/([A-Z])/g,"-$1").toLowerCase(),g=e.style.getPropertyValue(h),p=e.style.getPropertyPriority(h);if(g!==u||u.includes("!important")&&!p)return!0}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!1},e.VERSION="1.1.2",e}();t.DOMChangesPluginLite=f},713:function(e,t,r){var n=this&&this.__awaiter||function(e,t,r,n){return new(r||(r=Promise))(function(i,o){function a(e){try{s(n.next(e))}catch(e){o(e)}}function l(e){try{s(n.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r(function(e){e(t)})).then(a,l)}s((n=n.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var r,n,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function l(l){return function(s){return function(l){if(r)throw new TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(o=0)),o;)try{if(r=1,n&&(i=2&l[0]?n.return:l[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,l[1])).done)return i;switch(n=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,n=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],n=0}finally{r=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,s])}}},o=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},a=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.ExposureTracker=void 0;var l=r(609),s=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,s){var c=this;this.debug&&(0,l.logDebug)("[ABsmartly] Registering experiment ".concat(e," for exposure tracking"));var u=new Set,h=new Set,g=new Map;n.forEach(function(e){e.forEach(function(e){e.trigger_on_view&&("move"===e.type?(g.has(e.selector)||g.set(e.selector,new Set),e.targetSelector&&g.get(e.selector).add(e.targetSelector)):u.add(e.selector))})}),g.forEach(function(r,i){var o=[];n.forEach(function(e,t){var r=e.find(function(e){return"move"===e.type&&e.selector===i&&e.trigger_on_view});(null==r?void 0:r.targetSelector)&&o.push({targetSelector:r.targetSelector,position:r.position||"lastChild",variantIndex:t})});var a=o.findIndex(function(e){return e.variantIndex===t});a>=0?(u.add(i),o.forEach(function(t,r){r!==a&&c.createContainerPlaceholder(e,i,t.targetSelector,t.position)})):(u.add(i),o.forEach(function(t){c.createContainerPlaceholder(e,i,t.targetSelector,t.position)}))});var p={experimentName:e,variant:t,changes:r,allPossibleSelectors:new Set(a(a([],o(u),!1),o(h),!1)),triggered:!1,hasImmediateTrigger:i,hasViewportTrigger:s};this.experiments.set(e,p),this.debug&&(0,l.logDebug)("[ABsmartly] Experiment ".concat(e," will track selectors:"),Array.from(p.allPossibleSelectors)),i?this.triggerExposure(e).catch(function(t){(0,l.logDebug)("[ABsmartly] Failed to trigger exposure for ".concat(e,":"),t)}):s&&this.observeSelectors(e,p.allPossibleSelectors)},e.prototype.createContainerPlaceholder=function(e,t,r,n){var i,o;void 0===n&&(n="lastChild");var a=document.querySelector(r);if(a){var s="".concat(e,"-").concat(t,"-").concat(r,"-").concat(n);if(!this.placeholders.has(s)){var c=document.createElement("span");switch(c.style.cssText="\n display: inline-block;\n width: 1px;\n height: 1px;\n position: relative;\n left: -1px;\n visibility: hidden;\n pointer-events: none;\n font-size: 0;\n line-height: 0;\n overflow: hidden;\n ",c.setAttribute("data-absmartly-placeholder","true"),c.setAttribute("data-absmartly-original-selector",t),c.setAttribute("data-absmartly-experiment",e),c.setAttribute("aria-hidden","true"),n){case"firstChild":a.insertBefore(c,a.firstChild);break;case"lastChild":default:a.appendChild(c);break;case"before":null===(i=a.parentElement)||void 0===i||i.insertBefore(c,a);break;case"after":null===(o=a.parentElement)||void 0===o||o.insertBefore(c,a.nextSibling)}this.placeholders.set(s,c),this.trackElement(c,e),this.debug&&(0,l.logDebug)("[ABsmartly] Created placeholder for ".concat(t," at ").concat(r," (").concat(n,")"))}}},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=this;t.forEach(function(t){var n=document.querySelectorAll(t);n.length>0?n.forEach(function(t){r.trackElement(t,e)}):r.watchForSelector(t,e)})},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){t.forEach(function(t){t.isIntersecting&&e.handleElementVisible(t.target)})},{threshold:.01,rootMargin:"0px"})},e.prototype.setupMutationObserver=function(){var e=this;this.mutationObserver=new MutationObserver(function(t){t.forEach(function(t){t.addedNodes.forEach(function(t){t instanceof Element&&e.checkNewElement(t)})})}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0})},e.prototype.checkNewElement=function(e){var t=this;this.experiments.forEach(function(r,n){r.allPossibleSelectors.forEach(function(r){e.matches(r)&&t.trackElement(e,n),e.querySelectorAll(r).forEach(function(e){t.trackElement(e,n)})})})},e.prototype.handleElementVisible=function(e){var t=this,r=this.trackedElements.get(e);r&&r.experiments.forEach(function(n){var i=t.experiments.get(n);if(i&&!i.triggered&&(t.triggerExposure(n).catch(function(e){(0,l.logDebug)("[ABsmartly] Failed to trigger exposure for ".concat(n,":"),e)}),t.debug)){var o=r.isPlaceholder?e.getAttribute("data-absmartly-original-selector"):t.getElementSelector(e);(0,l.logDebug)("[ABsmartly] Triggering exposure for ".concat(n," via ").concat(o))}})},e.prototype.triggerExposure=function(e){return n(this,void 0,void 0,function(){var t;return i(this,function(r){switch(r.label){case 0:return!(t=this.experiments.get(e))||t.triggered?[2]:[4,this.context.ready()];case 1:return r.sent(),this.context.treatment(e),t.triggered=!0,this.debug&&(0,l.logDebug)("[ABsmartly] Exposure triggered for experiment: ".concat(e)),this.cleanupExperiment(e),[2]}})})},e.prototype.cleanupExperiment=function(e){var t=this;this.trackedElements.forEach(function(r,n){r.experiments.delete(e),0===r.experiments.size&&(t.observer.unobserve(n),t.trackedElements.delete(n))}),this.placeholders.forEach(function(r,n){n.startsWith("".concat(e,"-"))&&(r.remove(),t.placeholders.delete(n))});var r=this.experiments.get(e);r&&r.allPossibleSelectors.clear(),0===this.experiments.size&&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(){this.observer.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),this.placeholders.forEach(function(e){return e.remove()}),this.experiments.clear(),this.trackedElements.clear(),this.placeholders.clear(),this.debug&&(0,l.logDebug)("[ABsmartly] ExposureTracker destroyed")},e}();t.ExposureTracker=s},964:function(e,t,r){var n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},i=this&&this.__read||function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},o=this&&this.__spreadArray||function(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.DOMManipulatorLite=void 0;var a=r(609),l=r(214),s=function(){function e(e,t){void 0===e&&(e=!1);var r=this;this.appliedChanges=new Map,this.debug=e,this.plugin=t,this.pendingManager=new l.PendingChangeManager(function(e,t,n){return n?r.applyChangeToSpecificElement(e,t,n):r.applyChange(e,t)},e)}return e.prototype.applyChange=function(e,t){var r,n,i=this;if(!e.enabled&&void 0!==e.enabled)return(0,a.logDebug)("Skipping disabled change for experiment: ".concat(t),{experimentName:t,selector:e.selector,changeType:e.type}),!1;var o=!!this.plugin.reapplyingElements&&Array.from(this.plugin.reapplyingElements).length>0;this.debug&&(0,a.logDebug)("[DOM-APPLY] ".concat(o?"RE-APPLYING":"APPLYING"," change"),{experimentName:t,selector:e.selector,type:e.type,timestamp:Date.now(),callStack:null===(r=(new Error).stack)||void 0===r?void 0:r.split("\n").slice(2,4).join("\n")});try{if("styleRules"===e.type)return this.applyStyleRules(e,t);if("create"===e.type){if(e.element&&e.targetSelector)if(this.createElement(e,t))return this.trackAppliedChange(t,e),(0,a.logChangeApplication)(t,e.targetSelector,e.type,1,!0),!0;return!1}var l=document.querySelectorAll(e.selector),s=[];if(0===l.length)return e.waitForElement||(null===(n=this.plugin.config)||void 0===n?void 0:n.spa)?(this.debug&&(0,a.logDebug)("[ABsmartly] Element not found, adding to pending: ".concat(e.selector)),this.pendingManager.addPending({change:e,experimentName:t,observerRoot:e.observerRoot}),!0):(this.debug&&(0,a.logDebug)("[ABsmartly] No elements found for selector: ".concat(e.selector)),(0,a.logDebug)("No elements found for selector",{experimentName:t,selector:e.selector,changeType:e.type}),!1);if(l.forEach(function(r){var n,o;if(i.debug&&"style"===e.type){var l={};e.value&&"object"==typeof e.value&&Object.keys(e.value).forEach(function(e){var t=e.replace(/([A-Z])/g,"-$1").toLowerCase();l[t]=r.style.getPropertyValue(t)}),(0,a.logDebug)("[DOM-BEFORE-APPLY] Element styles before change",{experimentName:t,selector:e.selector,element:r.tagName,oldStyles:l,newStyles:e.value})}if(i.applyChangeToElement(r,e),i.debug&&"style"===e.type){var c={};e.value&&"object"==typeof e.value&&Object.keys(e.value).forEach(function(e){var t=e.replace(/([A-Z])/g,"-$1").toLowerCase();c[t]=r.style.getPropertyValue(t)}),(0,a.logDebug)("[DOM-AFTER-APPLY] Element styles after change",{experimentName:t,selector:e.selector,element:r.tagName,appliedStyles:c})}if("javascript"===e.type){if(e.value)try{new Function("element",String(e.value))(r),s.push(r)}catch(e){(0,a.logDebug)("[ABsmartly] JavaScript execution error:",e)}}else if("move"===e.type){var u=e.targetSelector||(e.value&&"object"==typeof e.value?e.value.targetSelector:null),h=e.position||(e.value&&"object"==typeof e.value?e.value.position:null);if(u){var g=document.querySelector(u);g?(i.moveElement(r,g,h),s.push(r)):i.debug&&(0,a.logDebug)("[ABsmartly] Move target not found: ".concat(u))}}else s.push(r);"style"===e.type&&e.persistStyle||(null===(n=i.plugin.config)||void 0===n?void 0:n.spa)?i.plugin.watchElement(r,t,e):"style"===e.type&&i.debug&&(0,a.logDebug)("[WATCH-SKIP] NOT watching element - persistStyle and SPA both disabled",{experimentName:t,selector:e.selector,element:r.tagName,persistStyle:e.persistStyle,spaMode:null===(o=i.plugin.config)||void 0===o?void 0:o.spa})}),s.length>0){this.trackAppliedChange(t,e),e.waitForElement&&this.pendingManager.removePending(e.selector,t,e.observerRoot);var c=s.some(function(e){var t;return null===(t=i.plugin.reapplyingElements)||void 0===t?void 0:t.has(e)});return c||(0,a.logChangeApplication)(t,e.selector,e.type,s.length,!0),!0}return(0,a.logChangeApplication)(t,e.selector,e.type,0,!1),!1}catch(r){return this.debug&&(0,a.logDebug)("[ABsmartly] Error applying DOM change:",r,e),(0,a.logDebug)("Error applying DOM change",{experimentName:t,selector:e.selector,changeType:e.type,error:r instanceof Error?r.message:"Unknown error"}),!1}},e.prototype.moveElement=function(e,t,r){var n,i,o;switch(r){case"before":null===(n=t.parentElement)||void 0===n||n.insertBefore(e,t);break;case"after":t.nextSibling?null===(i=t.parentElement)||void 0===i||i.insertBefore(e,t.nextSibling):null===(o=t.parentElement)||void 0===o||o.appendChild(e);break;case"firstChild":t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e);break;default:t.appendChild(e)}},e.prototype.createElement=function(e,t){var r,i;if(!e.element||!e.targetSelector)return null;var o=document.querySelector(e.targetSelector);if(!o)return this.debug&&(0,a.logDebug)("[ABsmartly] Create target not found: ".concat(e.targetSelector)),null;var l=document.createElement("div");l.innerHTML=e.element;var s=Array.from(l.children);if(0===s.length)return null;try{for(var c=n(s),u=c.next();!u.done;u=c.next()){var h=u.value;this.moveElement(h,o,e.position)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}return s[0]},e.prototype.applyStyleRules=function(e,t){try{var r=this.plugin.getStyleManager(t),n="".concat(e.selector,"::states"),i=void 0;if("string"==typeof e.value&&e.value.trim())i=e.value;else{if(!e.states)return!1;i=this.plugin.buildStateRules(e.selector,e.states,!1!==e.important)}return r.setRule(n,i),this.debug&&((0,a.logDebug)("[ABsmartly] Applied style rule: ".concat(n)),(0,a.logDebug)("[ABsmartly] CSS: ".concat(i))),this.trackAppliedChange(t,e),(0,a.logChangeApplication)(t,e.selector,"styleRules",1,!0),!0}catch(e){return this.debug&&(0,a.logDebug)("[ABsmartly] Error applying style rules:",e),!1}},e.prototype.applyChangeToElement=function(e,t){var r,n;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":t.value&&"object"==typeof t.value&&Object.entries(t.value).forEach(function(r){var n=i(r,2),o=n[0],a=n[1],l=o.replace(/([A-Z])/g,"-$1").toLowerCase(),s=!0===t.important?"important":"";e.style.setProperty(l,String(a),s)});break;case"class":t.add&&Array.isArray(t.add)&&(r=e.classList).add.apply(r,o([],i(t.add),!1)),t.remove&&Array.isArray(t.remove)&&(n=e.classList).remove.apply(n,o([],i(t.remove),!1));break;case"attribute":t.value&&"object"==typeof t.value&&Object.entries(t.value).forEach(function(t){var r=i(t,2),n=r[0],o=r[1];null==o?e.removeAttribute(n):e.setAttribute(n,String(o))});break;case"move":if(t.value&&"object"==typeof t.value){var l=t.value,s=document.querySelector(l.targetSelector);s?this.moveElement(e,s,l.position):this.debug&&(0,a.logDebug)("[ABsmartly] Move target not found: ".concat(l.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)try{new Function("element",String(e.value))(r)}catch(e){return(0,a.logDebug)("[ABsmartly] JavaScript execution error:",e),!1}else if("move"===e.type){var i=e.targetSelector||(e.value&&"object"==typeof e.value?e.value.targetSelector:null),o=e.position||(e.value&&"object"==typeof e.value?e.value.position:null);if(i){var l=document.querySelector(i);if(!l)return!1;this.moveElement(r,l,o)}}return("style"===e.type&&e.persistStyle||(null===(n=this.plugin.config)||void 0===n?void 0:n.spa))&&this.plugin.watchElement(r,t,e),!0}catch(e){return this.debug&&(0,a.logDebug)("[ABsmartly] Error applying change to specific element:",e),!1}},e.prototype.trackAppliedChange=function(e,t){var r=this.appliedChanges.get(e);r||(r=new Set,this.appliedChanges.set(e,r));var n="".concat(t.selector,"-").concat(t.type);r.add(n)},e.prototype.hasChanges=function(e){return this.appliedChanges.has(e)},e.prototype.clearTracking=function(e){e?this.appliedChanges.delete(e):this.appliedChanges.clear()},e.prototype.removeAllPending=function(e){this.pendingManager.removeAllPending(e)},e.prototype.destroy=function(){this.pendingManager.destroy(),this.appliedChanges.clear()},e}();t.DOMManipulatorLite=s},973:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.URLMatcher=void 0;var r=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 console.error("[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 console.error("[ABsmartly] Invalid regex pattern: ".concat(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 console.error("[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=r}},t={};var r=function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}(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=this,c=[];try{for(var u=i(e),g=u.next();!g.done;g=u.next()){var h=g.value,p=function(e){var r,n,o,l;if(!(e instanceof Element))return"continue";var u=t||"document";try{for(var g=(r=void 0,i(d.pending.entries())),h=g.next();!h.done;h=g.next()){var p=a(h.value,2),f=p[0],y=p[1];if(f.endsWith("-".concat(u))){var m=function(t){var r=t.change;if(e.matches(r.selector))return c.push(function(){return s.applyChange(e,t)}),"continue";e.querySelectorAll(r.selector).forEach(function(e){c.push(function(){return s.applyChange(e,t)})})};try{for(var v=(o=void 0,i(y)),b=v.next();!b.done;b=v.next()){m(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{h&&!h.done&&(n=g.return)&&n.call(g)}finally{if(r)throw r.error}}},d=this;try{for(var f=(o=void 0,i(h.addedNodes)),y=f.next();!y.done;y=f.next()){p(y.value)}}catch(e){o={error:e}}finally{try{y&&!y.done&&(l=f.return)&&l.call(f)}finally{if(o)throw o.error}}}}catch(e){r={error:e}}finally{try{g&&!g.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}c.length>0&&this.batchWork(c)},e.prototype.batchWork=function(e){var t=this;e.forEach(function(e){return t.batchedWork.add(e)}),this.batchTimer&&clearTimeout(this.batchTimer),this.batchTimer=setTimeout(function(){t.processBatchedWork()},32)},e.prototype.processBatchedWork=function(){var e=Array.from(this.batchedWork);this.batchedWork.clear(),this.batchTimer=null,this.debug&&e.length>0&&(0,o.logDebug)("[ABsmartly] Processing batched work:",e.length,"items"),e.forEach(function(e){return e()})},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=this,l=[];try{for(var s=i(this.observers.keys()),c=s.next();!c.done;c=s.next()){var u=c.value,g=!1;try{for(var h=(r=void 0,i(this.pending.keys())),p=h.next();!p.done;p=h.next()){if(p.value.endsWith("-".concat(u))){g=!0;break}}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}g||l.push(u)}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}l.forEach(function(e){var t=a.observers.get(e);t&&(t.disconnect(),a.observers.delete(e),a.debug&&(0,o.logDebug)("[ABsmartly] Cleaned up observer for root:",e))})},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,g,h,p;void 0===t&&(t=window.location.href);var d=new Map;try{for(var f=n(e),y=f.next();!y.done;y=f.next()){var m=i(y.value,2),v=m[0],b=m[1];try{for(var x=(s=void 0,n(b)),E=x.next();!E.done;E=x.next()){var A=i(E.value,2),w=A[0],S=A[1];if(S&&"object"==typeof S){if(S.urlFilter)if(!l.URLMatcher.matches(S.urlFilter,t)){this.debug&&(0,o.logDebug)("[HTMLInjector] Skipping ".concat(v," variant ").concat(w," - 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))),M=C.next();!M.done;M=C.next()){var O=i(M.value,2),_=O[0],P=O[1];if("string"==typeof P){var T=this.parseInjectionKey(_);if(T){var j={code:P,priority:T.priority,location:T.location};d.has(T.location)||d.set(T.location,[]),d.get(T.location).push(j),this.debug&&(0,o.logDebug)("[HTMLInjector] Collected injection:",{experiment:v,variant:w,location:T.location,priority:T.priority,codeLength:P.length})}}else this.debug&&(0,o.logDebug)("[HTMLInjector] Skipping non-string injection code for key ".concat(_,":"),P)}}catch(e){u={error:e}}finally{try{M&&!M.done&&(g=C.return)&&g.call(C)}finally{if(u)throw u.error}}else this.debug&&(0,o.logDebug)("[HTMLInjector] Invalid injection data for ".concat(v," variant ").concat(w,":"),D)}else this.debug&&(0,o.logDebug)("[HTMLInjector] Invalid injection data for ".concat(v," variant ").concat(w,":"),S)}}catch(e){s={error:e}}finally{try{E&&!E.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 N=n(d),R=N.next();!R.done;R=N.next()){var k=i(R.value,2),L=k[0],B=k[1];B.sort(function(e,t){return t.priority-e.priority}),this.debug&&(0,o.logDebug)("[HTMLInjector] Sorted ".concat(L," injections by priority:"),{location:L,count:B.length,priorities:B.map(function(e){return e.priority})})}}catch(e){h={error:e}}finally{try{R&&!R.done&&(p=N.return)&&p.call(N)}finally{if(h)throw h.error}}return d},e.prototype.inject=function(e){var t,r,l,s;try{for(var c=n(e),u=c.next();!u.done;u=c.next()){var g=i(u.value,2),h=g[0],p=g[1],d="headStart"===h||"bodyStart"===h?a([],i(p),!1).reverse():p;try{for(var f=(l=void 0,n(d)),y=f.next();!y.done;y=f.next()){var m=y.value;this.injectAtLocation(h,m.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="absmartly-inject-".concat(e,"-").concat(Date.now(),"-").concat(Math.random());if(!this.injectedIds.has(r))try{switch(e){case"headStart":this.injectHeadStart(t,r);break;case"headEnd":this.injectHeadEnd(t,r);break;case"bodyStart":this.injectBodyStart(t,r);break;case"bodyEnd":this.injectBodyEnd(t,r)}this.injectedIds.add(r),this.debug&&(0,o.logDebug)("[HTMLInjector] Injected at ".concat(e,":"),{location:e,codeLength:t.length,injectionId:r})}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.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 g=new Map;try{var h=this.context.data();if((0,l.logDebug)("[VariantExtractor DEBUG] Raw context data structure:",{hasData:!!h,contextKeys:h?Object.keys(h):[],experimentCount:(null===(r=null==h?void 0:h.experiments)||void 0===r?void 0:r.length)||0,firstExperiment:(null===(n=null==h?void 0:h.experiments)||void 0===n?void 0:n[0])?{name:h.experiments[0].name,variantCount:(null===(s=h.experiments[0].variants)||void 0===s?void 0:s.length)||0,firstVariantStructure:(null===(c=h.experiments[0].variants)||void 0===c?void 0:c[0])?Object.keys(h.experiments[0].variants[0]):[]}:null,rawContextData:JSON.stringify(h).substring(0,500)+"..."}),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Extracting changes from context:",{hasData:!!h,experimentCount:(null===(u=null==h?void 0:h.experiments)||void 0===u?void 0:u.length)||0}),null==h?void 0:h.experiments){this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Available experiments:",h.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 p=i(h.experiments),d=p.next();!d.done;d=p.next()){var f=d.value,y=this.extractAllVariantsForExperiment(f);y.size>0?(g.set(f.name,y),this.debug&&(0,l.logDebug)("[ABsmartly VariantExtractor] Experiment '".concat(f.name,"' has DOM changes:"),{variantsWithChanges:Array.from(y.keys()),changesByVariant:Array.from(y.entries()).map(function(e){var t=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{d&&!d.done&&(t=p.return)&&t.call(p)}finally{if(e)throw e.error}}}}catch(e){(0,l.logDebug)("[ABsmartly] Error extracting DOM changes:",e)}return this.cachedAllChanges=g,g},e.prototype.extractAllVariantsForExperiment=function(e){var t,r=new Map;if((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 g=a(u.value,2)[1];if(g&&"object"==typeof g&&!Array.isArray(g)&&"urlFilter"in g){var h=g;if(h.urlFilter&&(l=!0,s.URLMatcher.matches(h.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"]),g={data:u,urlFilter:c||void 0};t.set(r,g),this.debug&&(0,l.logDebug)("[VariantExtractor] Extracted __inject_html for ".concat(e.name," variant ").concat(r,":"),{keys:Object.keys(u),hasUrlFilter:!!c})}else 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 n=this.watchedElements.get(e);n||(n=new Set,this.watchedElements.set(e,n)),n.add(t),this.appliedChanges.has(t)||this.appliedChanges.set(t,[]);var i=this.appliedChanges.get(t);if(!i.includes(r)&&(i.push(r),this.config.debug)){var o={};r.value&&"object"==typeof r.value&&Object.keys(r.value).forEach(function(t){var r=t.replace(/([A-Z])/g,"-$1").toLowerCase();o[r]=e.style.getPropertyValue(r)}),(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?o: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){e.config.debug&&(0,a.logDebug)("[MUTATION-DETECTED] Persistence observer detected mutations",{mutationCount:t.length,timestamp:Date.now()}),t.forEach(function(t){var r=t.target;if(e.reapplyingElements.has(r))e.config.debug&&(0,a.logDebug)("[MUTATION-SKIP] Skipping mutation - currently reapplying",{element:r.tagName});else{var o=e.watchedElements.get(r);if(o){if(e.config.debug){var l="mutation:".concat(r.tagName,":").concat(r.getAttribute("name")||r.className),s=Date.now();s-(e.reapplyLogThrottle.get(l)||0)>5e3&&((0,a.logDebug)("[MUTATION-ON-WATCHED] Mutation detected on watched element",{element:r.tagName,attributeName:t.attributeName,oldValue:t.oldValue,experiments:Array.from(o)}),e.reapplyLogThrottle.set(l,s))}o.forEach(function(o){var l=e.appliedChanges.get(o);l&&l.forEach(function(l){var s,c,u,g,h=!1;if("style"===l.type&&"style"===t.attributeName&&!1!==l.persistStyle)h=e.checkStyleOverwritten(r,l.value);else if("attribute"===l.type&&!1!==l.persistAttribute&&l.value&&"object"==typeof l.value)try{for(var p=n(Object.keys(l.value)),d=p.next();!d.done;d=p.next()){var f=d.value;if(t.attributeName===f){h=e.checkAttributeOverwritten(r,l.value);break}}}catch(e){s={error:e}}finally{try{d&&!d.done&&(c=p.return)&&c.call(p)}finally{if(s)throw s.error}}if(h){e.reapplyingElements.add(r);var y="".concat(o,"-").concat(l.selector),m=Date.now(),v=e.reapplyLogThrottle.get(y)||0;if(e.config.debug&&m-v>5e3&&((0,a.logDebug)("[REAPPLY-TRIGGERED] Reapplying after mutation (React/framework conflict detected)",{experimentName:o,selector:l.selector,element:r.tagName,changeType:l.type,timestamp:m}),e.reapplyLogThrottle.set(y,m),e.reapplyLogThrottle.size>100)){var b=m-6e4;try{for(var x=n(e.reapplyLogThrottle.entries()),E=x.next();!E.done;E=x.next()){var A=i(E.value,2),w=A[0];A[1]<b&&e.reapplyLogThrottle.delete(w)}}catch(e){u={error:e}}finally{try{E&&!E.done&&(g=x.return)&&g.call(x)}finally{if(u)throw u.error}}}e.config.onReapply(l,o),setTimeout(function(){e.reapplyingElements.delete(r)},0)}})})}}})}),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",attributeFilter:["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],g=c.replace(/([A-Z])/g,"-$1").toLowerCase(),h=e.style.getPropertyValue(g),p=e.style.getPropertyPriority(g);if(h!==u||u.includes("!important")&&!p)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){var r=this&&this.__assign||function(){return r=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},r.apply(this,arguments)},n=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},i=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))};function a(){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 a=n(e,2),o=a[0],l=a[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,i([],n(e),!1))}Object.defineProperty(t,"__esModule",{value:!0}),t.DEBUG=void 0,t.logDebug=a,t.logChangeApplication=function(e,r,n,i,o){if(t.DEBUG){a("".concat(o?"✓":"✗"," Applied ").concat(n," change to ").concat(i," element(s)"),{experimentName:e,selector:r,changeType:n,elementsCount:i,success:o})}},t.logChangeRemoval=function(e,r,n,i){if(t.DEBUG){a("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){a('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){a("State ".concat(e," operation"),{operation:e,selector:r,changeType:n,experimentName:i})}},t.logVisibilityEvent=function(e,r,n){if(t.DEBUG){a(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){a("Message ".concat(e,": ").concat(r),{direction:e,messageType:r,payload:n,bridge:"extension"})}},t.logPerformance=function(e,n,i){if(t.DEBUG){a("Performance: ".concat(e," took ").concat(n,"ms"),r({operation:e,duration:n,performance:!0},i))}},t.DEBUG=!1},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),g=r(713),h=r(253),p=r(609),d=r(973),f=r(481),y=r(943),m=function(){function e(t){var r,n,i,a,o,l,u,d,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.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!==(d=t.hideTransition)&&void 0!==d&&d},!this.config.context)throw new Error("[ABsmartly] Context is required");console.log("[ABsmartly] DOMChangesPluginLite v".concat(e.VERSION," initialized")),this.config.hideUntilReady&&this.hideContent(),this.domManipulator=new s.DOMManipulatorLite(this.config.debug,this),this.variantExtractor=new c.VariantExtractor(this.config.context,this.config.variableName,this.config.debug),this.exposureTracker=new g.ExposureTracker(this.config.context,this.config.debug),this.htmlInjector=new h.HTMLInjector(this.config.debug),this.persistenceManager=new f.DOMPersistenceManager({debug:this.config.debug,onReapply:function(e,t){(0,p.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,p.logDebug)("[DOMChangesPluginLite] Context is ready, starting initialization"),y.initialize()}).catch(function(e){throw(0,p.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,p.logDebug)("Plugin already initialized"),[2];t=performance.now(),(0,p.logDebug)("Initializing ABsmartly DOM Changes Plugin Lite",{version:e.VERSION,config:{autoApply:this.config.autoApply,spa:this.config.spa,visibilityTracking:this.config.visibilityTracking,DEBUG:p.DEBUG}}),i.label=1;case 1:return i.trys.push([1,4,,5]),this.config.spa?(this.setupMutationObserver(),this.setupURLChangeListener()):(0,p.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,p.logPerformance)("Plugin initialization",r),(0,p.logDebug)("[ABsmartly] DOM plugin lite loaded successfully (v".concat(e.VERSION,")")),this.config.debug&&(0,p.logDebug)("[ABsmartly] DOM Changes Plugin Lite initialized with debug mode"),[3,5];case 4:throw n=i.sent(),(0,p.logDebug)("[ABsmartly] Failed to initialize plugin:",n),n;case 5:return[2]}})})},e.prototype.setupMutationObserver=function(){var e=this,t=new MutationObserver(function(t){t.forEach(function(t){"childList"===t.type&&t.addedNodes.forEach(function(t){var r;if(t.nodeType===Node.ELEMENT_NODE){var n=t;((null===(r=e.persistenceManager)||void 0===r?void 0:r.getAppliedChanges())||new Map).forEach(function(t,r){t.forEach(function(t){try{(n.matches(t.selector)?[n]:Array.from(n.querySelectorAll(t.selector))).forEach(function(n){e.config.debug&&(0,p.logDebug)("[SPA-REAPPLY] Re-applying change to newly added element (React hydration recovery)",{experimentName:r,selector:t.selector,element:n.tagName,changeType:t.type}),e.domManipulator.applyChange(t,r)})}catch(e){}})})}})})}),r=function(){t.observe(document.body,{childList:!0,subtree:!0}),e.mutationObserver=t,(0,p.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,p.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,p.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]}})})};window.addEventListener("popstate",t);var r=history.pushState,n=history.replaceState;history.pushState=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];r.apply(history,e),t()},history.replaceState=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];n.apply(history,e),t()},this.config.debug&&(0,p.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,p.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,p.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,p.logPerformance)("Apply injections and changes (parallel)",i),this.config.debug&&(0,p.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,p.logDebug)("[ABsmartly] No HTML injections found"),[2]):(r=this.htmlInjector.collectInjections(e,t),this.htmlInjector.inject(r),this.config.debug&&(0,p.logDebug)("[ABsmartly] HTML injections complete",{experimentsWithInjections:e.size,totalLocations:r.size,currentUrl:t}),[2])})})},e.prototype.applyChanges=function(e){return i(this,void 0,void 0,function(){var t,r,n,i,s,c,u,g,h,f,y,m,v,b,x,E,A,w,S,D,C,M,O,_,P,T,j,N,R,k,L,B,I,V,F,U,G,H,z,W,J,Y,X,q,$,Z;return a(this,function(a){switch(a.label){case 0:t=performance.now(),r=window.location.href,(0,p.logDebug)("Starting to apply changes",{specificExperiment:e||"all",url:r,action:"apply_start"}),this.config.debug&&((0,p.logDebug)("[ABsmartly] === DOM Changes Application Starting ==="),(0,p.logDebug)("[ABsmartly] Target:",e||"all experiments"),(0,p.logDebug)("[ABsmartly] Current URL:",r),(0,p.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,p.logDebug)("[ABsmartly] Failed to wait for context ready:",n),[2];case 4:this.variantExtractor.clearCache(),i=this.getAllExperimentsData(),s=0,c=new Map,(0,p.logDebug)("[APPLY-CHANGES] Experiments found with DOM changes:",{experimentNames:Array.from(i.keys()),totalCount:i.size,currentURL:r}),0===i.size&&(0,p.logDebug)("[APPLY-CHANGES] ⚠️ No experiments found with DOM changes - nothing to process");try{for(u=o(i),g=u.next();!g.done;g=u.next())if(h=l(g.value,2),f=h[0],y=h[1],(0,p.logDebug)("[APPLY-CHANGES] [".concat(f,"] Starting to process experiment"),{experimentName:f,currentURL:r}),e&&f!==e)(0,p.logDebug)("[APPLY-CHANGES] [".concat(f,"] ⏭️ Skipping - filtering for different experiment"),{filteringFor:e});else if(null!=(m=this.config.context.peek(f)))if((0,p.logDebug)("[APPLY-CHANGES] [".concat(f,"] User assigned to variant ").concat(m)),v=y.variantData,b=y.urlFilter,x=y.globalDefaults,this.variantExtractor.anyVariantMatchesURL(f,r))if((0,p.logDebug)("[APPLY-CHANGES] [".concat(f,"] ✓ At least one variant matches current URL")),E=this.shouldApplyVisualChanges(v,b,r),A=this.extractChangesFromData(v,x),w=this.extractAllVariantChanges(f),S=w.some(function(e){return e&&e.length>0}),S){if(D={total:(null==A?void 0:A.length)||0,success:0,pending:0},this.config.debug&&(0,p.logDebug)("[ABsmartly] Processing experiment '".concat(f,"' - User is in variant ").concat(m,":"),{experimentName:f,userVariant:m,urlMatches:E,changeCount:(null==A?void 0:A.length)||0,userVariantHasChanges:((null==A?void 0:A.length)||0)>0,changes:(null==A?void 0:A.map(function(e){return{type:e.type,selector:e.selector,trigger:e.trigger_on_view?"viewport":"immediate"}}))||[]}),A&&0!==A.length||this.config.debug&&(0,p.logDebug)("[ABsmartly] User is in control variant ".concat(m," with no changes, but will still track for SRM prevention"),{experimentName:f,currentVariant:m}),E&&A&&A.length>0)try{for(J=void 0,C=o(A),M=C.next();!M.done;M=C.next())if("delete"===(G=M.value).type&&G.trigger_on_view)this.config.debug&&(0,p.logDebug)("[ABsmartly] Deferring delete change until after viewport trigger for '".concat(f,"'"),{selector:G.selector});else if(this.domManipulator.applyChange(G,f))s++,D.success++;else if("create"!==G.type&&"styleRules"!==G.type)try{0===document.querySelectorAll(G.selector).length&&(this.config.spa||G.waitForElement)&&D.pending++}catch(e){this.config.debug&&(0,p.logDebug)("[ABsmartly] Invalid selector: ".concat(G.selector),e)}}catch(e){J={error:e}}finally{try{M&&!M.done&&(Y=C.return)&&Y.call(C)}finally{if(J)throw J.error}}else A&&A.length>0&&(0,p.logDebug)("[ABsmartly] Experiment '".concat(f,"' variant ").concat(m," doesn't match URL filter or has no changes, but setting up tracking for SRM prevention"));O=!1,_=!1,P=this.variantExtractor.getAllVariantsData(f),this.config.debug&&((0,p.logDebug)("[ABsmartly] Checking trigger types for experiment '".concat(f,"' on URL: ").concat(r),{allVariantsDataSize:P.size,allVariantChangesLength:w.length}),P.forEach(function(e,t){(0,p.logDebug)("[ABsmartly] Variant ".concat(t," data structure:"),{isArray:Array.isArray(e),isObject:"object"==typeof e,hasUrlFilter:e&&"object"==typeof e&&!Array.isArray(e)&&"urlFilter"in e,keys:e&&"object"==typeof e&&!Array.isArray(e)?Object.keys(e):"N/A"})}));try{for(X=void 0,T=o(P),j=T.next();!j.done;j=T.next())if(N=l(j.value,2),R=N[0],k=N[1],(L=w[R])&&0!==L.length){if(B=!0,k&&"object"==typeof k&&!Array.isArray(k)&&"urlFilter"in(I=k)&&I.urlFilter&&(V=I,B=d.URLMatcher.matches(V.urlFilter,r),this.config.debug&&(0,p.logDebug)("[ABsmartly] Variant ".concat(R," has URL filter, matches: ").concat(B))),B){try{for($=void 0,F=o(L),U=F.next();!U.done&&((G=U.value).trigger_on_view?O=!0:_=!0,!O||!_);U=F.next());}catch(e){$={error:e}}finally{try{U&&!U.done&&(Z=F.return)&&Z.call(F)}finally{if($)throw $.error}}this.config.debug&&(0,p.logDebug)("[ABsmartly] Variant ".concat(R," matches URL - hasImmediate: ").concat(_,", hasViewport: ").concat(O))}else this.config.debug&&(0,p.logDebug)("[ABsmartly] Variant ".concat(R," does NOT match URL - skipping"));if(O&&_)break}}catch(e){X={error:e}}finally{try{j&&!j.done&&(q=T.return)&&q.call(T)}finally{if(X)throw X.error}}this.config.debug&&(0,p.logDebug)("[TRIGGER-DETECTION] [".concat(f,"] Final trigger decision for '").concat(f,"':"),{experimentName:f,userVariant:m,hasImmediateTrigger:_,hasViewportTrigger:O,willRegisterExperiment:O||_,userChangesCount:(null==A?void 0:A.length)||0,allVariantsChangesCount:w.map(function(e){return e.length})}),O||_?((0,p.logDebug)("[TRIGGER-DETECTION] [".concat(f,"] ✓ REGISTERING EXPERIMENT - Calling exposureTracker.registerExperiment()"),{experimentName:f,userVariant:m,hasImmediateTrigger:_,hasViewportTrigger:O,changesForUser:(null==A?void 0:A.length)||0,allVariantCounts:w.map(function(e,t){return{variant:t,count:e.length}})}),this.exposureTracker.registerExperiment(f,m||0,A||[],w,_,O)):(0,p.logDebug)("[TRIGGER-DETECTION] [".concat(f,"] ⚠️ No triggers detected - experiment will NOT be registered!"),{experimentName:f,userVariant:m,hasAnyChangesInAnyVariant:S,allVariantsChangesCount:w.map(function(e){return e.length})}),c.set(f,D),(0,p.logExperimentSummary)(f,D.total,D.success,D.pending)}else this.config.debug&&(0,p.logDebug)("[ABsmartly] Skipping experiment '".concat(f,"' - no variants have changes"));else(0,p.logDebug)("[APPLY-CHANGES] [".concat(f,"] ⏭️ Skipping - no variant matches URL: ").concat(r),{experimentName:f,currentURL:r});else(0,p.logDebug)("[APPLY-CHANGES] [".concat(f,"] ⏭️ Skipping - no variant assigned (peek returned ").concat(m,")"),{experimentName:f})}catch(e){z={error:e}}finally{try{g&&!g.done&&(W=u.return)&&W.call(u)}finally{if(z)throw z.error}}return H=performance.now()-t,(0,p.logPerformance)("Apply changes",H,{totalApplied:s,experiments:c.size}),this.config.debug&&((0,p.logDebug)("[ABsmartly] === DOM Changes Application Complete ==="),(0,p.logDebug)("[ABsmartly] Summary:",{totalChangesApplied:s,experimentsProcessed:c.size,duration:"".concat(H.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(),this.emit("changes-applied",{count:s,experimentName:e}),[2]}})})},e.prototype.getAllExperimentsData=function(){var e,t,r=new Map,n=this.variantExtractor.extractAllChanges();(0,p.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,p.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] Checking experiment"),{experimentName:s,currentVariant:c,variantIsValid:null!=c}),null!=c){var u=this.variantExtractor.getAllVariantsData(s),g=u.get(c);this.config.debug&&(0,p.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] Variant data lookup:"),{experimentName:s,userVariant:c,variantDataExists:!!g,allVariantsInMap:Array.from(u.keys()),userVariantInMap:u.has(c)}),g||(0,p.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,p.logDebug)("[GET-EXPERIMENTS] [".concat(s,"] ✓ Including experiment (variant ").concat(c,")"));var h=null,d={};if(g&&"object"==typeof g&&!Array.isArray(g)&&"changes"in g){var f=g;h=f.urlFilter,d={waitForElement:f.waitForElement,persistStyle:f.persistStyle,important:f.important,observerRoot:f.observerRoot}}r.set(s,{variantData:g,urlFilter:h,globalDefaults:d})}else(0,p.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;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,important:null!==(a=e.important)&&void 0!==a?a:t.important,observerRoot:null!==(o=e.observerRoot)&&void 0!==o?o: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,important:s.important,observerRoot:s.observerRoot}}var c=a.map(function(e){var t,r,i,a;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,important:null!==(i=e.important)&&void 0!==i?i:l.important,observerRoot:null!==(a=e.observerRoot)&&void 0!==a?a: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||d.URLMatcher.matches(t,r)))},e.prototype.hasChanges=function(e){return this.domManipulator.hasChanges(e)},e.prototype.applyChange=function(e,t){(0,p.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}),r}catch(e){return this.config.debug&&(0,p.logDebug)("[ABsmartly] Error applying change:",e),!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,p.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,p.logDebug)("[ABsmartly] Refreshing experiments and clearing cache"),this.variantExtractor.clearCache(),this.config.autoApply&&this.applyInjectionsAndChanges()},e.prototype.destroy=function(){this.domManipulator.destroy(),this.exposureTracker.destroy(),this.htmlInjector.destroy(),this.styleManagers.forEach(function(e){return e.destroy()}),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 e=document.getElementById(this.antiFlickerStyleId);e&&e.remove(),this.eventListeners.clear(),this.exposedExperiments.clear(),this.unregisterFromContext(),this.unregisterGlobally(),this.initialized=!1,this.config.debug&&(0,p.logDebug)("[ABsmartly] DOM Changes Plugin Lite destroyed")},e.prototype.registerWithContext=function(){this.config.context&&(this.config.context.__plugins||(this.config.context.__plugins={}),this.config.context.__plugins.domPlugin={name:"DOMChangesPluginLite",version:e.VERSION,initialized:!0,capabilities:["spa","visibility"],instance:this,timestamp:Date.now()},this.config.context.__domPlugin=this.config.context.__plugins.domPlugin,this.config.debug&&(0,p.logDebug)("[ABsmartly] DOMChangesPluginLite registered with context at __plugins.domPlugin"))},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,p.logDebug)("[ABsmartly] DOMChangesPluginLite unregistered from context"))},e.prototype.registerGlobally=function(){(0,y.registerPlugin)("dom",{name:"DOMChangesPluginLite",version:e.VERSION,initialized:!0,timestamp:Date.now(),capabilities:["spa","visibility","auto-apply"],instance:this}),this.config.debug&&(0,p.logDebug)("[ABsmartly] DOMChangesPluginLite registered in global window.__ABSMARTLY_PLUGINS__")},e.prototype.unregisterGlobally=function(){(0,y.unregisterPlugin)("dom"),this.config.debug&&(0,p.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,p.logDebug)("[ABsmartly] Anti-flicker timeout reached (".concat(e.config.hideTimeout,"ms), showing content")),e.showContent()},this.config.hideTimeout),this.config.debug&&(0,p.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,p.logDebug)("[ABsmartly] Anti-flicker fade-in complete, style removed")},n),this.config.debug&&(0,p.logDebug)("[ABsmartly] Anti-flicker fading in with transition: ".concat(this.config.hideTransition))}else t.remove(),this.config.debug&&(0,p.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="1.2.1",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.__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.ExposureTracker=void 0;var l=r(609),s=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,s){var c=this;this.debug&&(0,l.logDebug)("[EXPOSURE] [".concat(e,"] Registering experiment for exposure tracking"),{experimentName:e,currentVariant:t,hasImmediateTrigger:i,hasViewportTrigger:s,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 u=new Set,g=new Set,h=new Map,p=new Set;n.forEach(function(e){e.forEach(function(e){e.trigger_on_view&&("move"===e.type?(h.has(e.selector)||h.set(e.selector,new Set),e.targetSelector&&h.get(e.selector).add(e.targetSelector)):"delete"===e.type?p.add(e.selector):u.add(e.selector))})}),h.forEach(function(r,i){var a=[];n.forEach(function(e,t){var r=e.find(function(e){return"move"===e.type&&e.selector===i&&e.trigger_on_view});(null==r?void 0:r.targetSelector)&&a.push({targetSelector:r.targetSelector,position:r.position||"lastChild",variantIndex:t})});var o=a.findIndex(function(e){return e.variantIndex===t});o>=0?(u.add(i),a.forEach(function(t,r){r!==o&&c.createContainerPlaceholder(e,i,t.targetSelector,t.position)})):(u.add(i),a.forEach(function(t){c.createContainerPlaceholder(e,i,t.targetSelector,t.position)}))}),p.forEach(function(t){r.some(function(e){return"delete"===e.type&&e.selector===t&&e.trigger_on_view})?0===c.createInPlacePlaceholder(e,t)&&(u.add(t),c.debug&&(0,l.logDebug)("[EXPOSURE] [".concat(e,"] Delete element doesn't exist yet - tracking selector for when it appears"),{selector:t})):u.add(t)});var d={experimentName:e,variant:t,changes:r,allPossibleSelectors:new Set(o(o([],a(u),!1),a(g),!1)),triggered:!1,hasImmediateTrigger:i,hasViewportTrigger:s};this.experiments.set(e,d),this.debug&&(0,l.logDebug)("[ABsmartly] Experiment ".concat(e," will track selectors:"),Array.from(d.allPossibleSelectors)),i?((0,l.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,l.logDebug)("[EXPOSURE] [".concat(e,"] ✗ Failed to trigger exposure:"),t)})):s?((0,l.logDebug)("[EXPOSURE] [".concat(e,"] ✓ HAS VIEWPORT TRIGGER - setting up viewport observers"),{experimentName:e,currentVariant:t,selectorsToWatch:Array.from(d.allPossibleSelectors),allVariantCounts:n.map(function(e,t){return{variant:t,count:e.length}})}),this.observeSelectors(e,d.allPossibleSelectors)):(0,l.logDebug)("[EXPOSURE] [".concat(e,"] ⚠️ No immediate or viewport trigger detected - experiment will NOT be exposed!"),{experimentName:e,currentVariant:t,hasImmediateTrigger:i,hasViewportTrigger:s,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 s="".concat(e,"-").concat(t,"-").concat(r,"-").concat(n);if(!this.placeholders.has(s)){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(s,c),this.trackElement(c,e),this.debug&&(0,l.logDebug)("[ABsmartly] Created placeholder for ".concat(t," at ").concat(r," (").concat(n,")"))}}},e.prototype.createInPlacePlaceholder=function(e,t){var r=this,n=document.querySelectorAll(t);if(0===n.length)return this.debug&&(0,l.logDebug)("[EXPOSURE] [".concat(e,"] No elements found for delete placeholder - will track selector instead"),{selector:t}),0;var i=0;return n.forEach(function(n,a){var o,s=t.replace(/[^a-zA-Z0-9-]/g,"_"),c="absmartly-delete-".concat(e,"-").concat(s,"-").concat(a),u="".concat(e,"-delete-").concat(t,"-").concat(a);if(!n.hasAttribute("data-absmartly-delete-placeholder")){var g=document.createElement("span");g.id=c,g.style.cssText="\n display: inline-block;\n width: 1px;\n height: 1px;\n position: relative;\n left: -1px;\n visibility: hidden;\n pointer-events: none;\n font-size: 0;\n line-height: 0;\n overflow: hidden;\n ",g.setAttribute("data-absmartly-placeholder","true"),g.setAttribute("data-absmartly-delete-placeholder","true"),g.setAttribute("data-absmartly-original-selector",t),g.setAttribute("data-absmartly-experiment",e),g.setAttribute("aria-hidden","true"),null===(o=n.parentElement)||void 0===o||o.insertBefore(g,n),n.remove(),r.placeholders.set(u,g),r.trackElement(g,e),i++,r.debug&&(0,l.logDebug)("[ABsmartly] Created in-place delete placeholder for ".concat(t," in experiment ").concat(e))}}),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=this;t.forEach(function(t){var n=document.querySelectorAll(t);n.length>0?n.forEach(function(t){r.trackElement(t,e)}):r.watchForSelector(t,e)})},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){t.forEach(function(t){t.isIntersecting&&e.handleElementVisible(t.target)})},{threshold:.01,rootMargin:"0px"})},e.prototype.setupMutationObserver=function(){var e=this;this.mutationObserver=new MutationObserver(function(t){t.forEach(function(t){t.addedNodes.forEach(function(t){t instanceof Element&&e.checkNewElement(t)})})}),this.mutationObserver.observe(document.body,{childList:!0,subtree:!0})},e.prototype.checkNewElement=function(e){var t=this;this.experiments.forEach(function(r,n){r.allPossibleSelectors.forEach(function(r){e.matches(r)&&t.trackElement(e,n),e.querySelectorAll(r).forEach(function(e){t.trackElement(e,n)})})})},e.prototype.handleElementVisible=function(e){var t=this,r=this.trackedElements.get(e);r&&r.experiments.forEach(function(n){var i=t.experiments.get(n);if(i&&!i.triggered&&(t.triggerExposure(n).catch(function(e){(0,l.logDebug)("[ABsmartly] Failed to trigger exposure for ".concat(n,":"),e)}),t.debug)){var a=r.isPlaceholder?e.getAttribute("data-absmartly-original-selector"):t.getElementSelector(e);(0,l.logDebug)("[ABsmartly] Triggering exposure for ".concat(n," via ").concat(a))}})},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,l.logDebug)("[EXPOSURE] [".concat(e,"] Already triggered, skipping")),[2]):((0,l.logDebug)("[EXPOSURE] [".concat(e,"] ✓ CALLING context.treatment() to trigger exposure"),{experimentName:e,variant:t.variant}),[4,this.context.ready()]):((0,l.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,l.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=this;this.trackedElements.forEach(function(r,n){r.experiments.delete(e),0===r.experiments.size&&(t.observer.unobserve(n),t.trackedElements.delete(n))}),this.placeholders.forEach(function(r,n){n.startsWith("".concat(e,"-"))&&(r.remove(),t.placeholders.delete(n))});var r=this.experiments.get(e);r&&r.allPossibleSelectors.clear(),0===this.experiments.size&&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(){this.observer.disconnect(),this.mutationObserver&&this.mutationObserver.disconnect(),this.placeholders.forEach(function(e){return e.remove()}),this.experiments.clear(),this.trackedElements.clear(),this.placeholders.clear(),this.debug&&(0,l.logDebug)("[ABsmartly] ExposureTracker destroyed")},e}();t.ExposureTracker=s},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.applyChange=function(e,t){var r,n,i,a,l=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 s=!!this.plugin.reapplyingElements&&Array.from(this.plugin.reapplyingElements).length>0,c=null===(n=null===(r=this.plugin.config)||void 0===r?void 0:r.context)||void 0===n?void 0:n.peek(t);this.debug&&(0,o.logDebug)("[DOM-APPLY] [".concat(t,"] ").concat(s?"RE-APPLYING":"APPLYING"," change"),{experimentName:t,userVariant:c,selector:e.selector,type:e.type,timestamp:Date.now(),callStack:null===(i=(new Error).stack)||void 0===i?void 0:i.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 u=document.querySelectorAll(e.selector),g=[];if(0===u.length)return e.waitForElement||(null===(a=this.plugin.config)||void 0===a?void 0:a.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);if(u.forEach(function(r){var n,i,a,s;if(l.debug&&"style"===e.type){var c={};e.value&&"object"==typeof e.value&&Object.keys(e.value).forEach(function(e){var t=e.replace(/([A-Z])/g,"-$1").toLowerCase();c[t]=r.style.getPropertyValue(t)}),(0,o.logDebug)("[DOM-BEFORE-APPLY] Element styles before change",{experimentName:t,selector:e.selector,element:r.tagName,oldStyles:c,newStyles:e.value})}if(l.applyChangeToElement(r,e),l.debug&&"style"===e.type){var u={};e.value&&"object"==typeof e.value&&Object.keys(e.value).forEach(function(e){var t=e.replace(/([A-Z])/g,"-$1").toLowerCase();u[t]=r.style.getPropertyValue(t)}),(0,o.logDebug)("[DOM-AFTER-APPLY] Element styles after change",{experimentName:t,selector:e.selector,element:r.tagName,appliedStyles:u})}if("javascript"===e.type)if(e.value){var h=null===(i=null===(n=l.plugin.config)||void 0===n?void 0:n.context)||void 0===i?void 0:i.peek(t);try{l.debug&&(0,o.logDebug)("[JAVASCRIPT] [".concat(t,"] Executing JavaScript change"),{experimentName:t,userVariant:h,selector:e.selector,element:r.tagName,code:String(e.value).substring(0,100)+"..."}),new Function("element",String(e.value))(r),g.push(r),l.debug&&(0,o.logDebug)("[JAVASCRIPT] [".concat(t,"] ✓ JavaScript executed successfully"),{experimentName:t,userVariant:h,selector:e.selector,element:r.tagName})}catch(n){(0,o.logDebug)("[JAVASCRIPT] [".concat(t,"] ✗ JavaScript execution error:"),{experimentName:t,userVariant:h,selector:e.selector,element:r.tagName,code:String(e.value),error:n instanceof Error?n.message:String(n),stack:n instanceof Error?n.stack:void 0})}}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 p=e.targetSelector||(e.value&&"object"==typeof e.value?e.value.targetSelector:null),d=e.position||(e.value&&"object"==typeof e.value?e.value.position:null);if(p){var f=document.querySelector(p);f?(l.moveElement(r,f,d),g.push(r)):l.debug&&(0,o.logDebug)("[ABsmartly] Move target not found: ".concat(p))}}else g.push(r);"style"===e.type&&e.persistStyle||(null===(a=l.plugin.config)||void 0===a?void 0:a.spa)?l.plugin.watchElement(r,t,e):"style"===e.type&&l.debug&&(0,o.logDebug)("[WATCH-SKIP] NOT watching element - persistStyle and SPA both disabled",{experimentName:t,selector:e.selector,element:r.tagName,persistStyle:e.persistStyle,spaMode:null===(s=l.plugin.config)||void 0===s?void 0:s.spa})}),g.length>0){this.trackAppliedChange(t,e),e.waitForElement&&this.pendingManager.removePending(e.selector,t,e.observerRoot);var h=g.some(function(e){var t;return null===(t=l.plugin.reapplyingElements)||void 0===t?void 0:t.has(e)});return h||(0,o.logChangeApplication)(t,e.selector,e.type,g.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 g=u.value;this.moveElement(g,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,n;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":t.value&&"object"==typeof t.value&&Object.entries(t.value).forEach(function(r){var n=i(r,2),a=n[0],o=n[1],l=a.replace(/([A-Z])/g,"-$1").toLowerCase(),s=!0===t.important?"important":"";e.style.setProperty(l,String(o),s)});break;case"class":t.add&&Array.isArray(t.add)&&(r=e.classList).add.apply(r,a([],i(t.add),!1)),t.remove&&Array.isArray(t.remove)&&(n=e.classList).remove.apply(n,a([],i(t.remove),!1));break;case"attribute":t.value&&"object"==typeof t.value&&Object.entries(t.value).forEach(function(t){var r=i(t,2),n=r[0],a=r[1];null==a?e.removeAttribute(n):e.setAttribute(n,String(a))});break;case"move":if(t.value&&"object"==typeof t.value){var l=t.value,s=document.querySelector(l.targetSelector);s?this.moveElement(e,s,l.position):this.debug&&(0,o.logDebug)("[ABsmartly] Move target not found: ".concat(l.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)try{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)+"..."}),new Function("element",String(e.value))(r),this.debug&&(0,o.logDebug)("[JAVASCRIPT] [".concat(t,"] ✓ JavaScript executed successfully"),{experimentName:t,selector:e.selector,element:r.tagName})}catch(n){return(0,o.logDebug)("[JAVASCRIPT] [".concat(t,"] ✗ JavaScript execution error on specific element:"),{experimentName:t,selector:e.selector,element:r.tagName,code:String(e.value),error:n instanceof Error?n.message:String(n),stack:n instanceof Error?n.stack:void 0}),!1}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||(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)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.URLMatcher=void 0;var r=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 console.error("[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 console.error("[ABsmartly] Invalid regex pattern: ".concat(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 console.error("[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=r}},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})());