@absmartly/sdk-plugins 1.0.1 → 1.1.0
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.
- package/dist/absmartly-cookie.min.js +1 -1
- package/dist/absmartly-dom-changes-core.min.js +1 -1
- package/dist/absmartly-dom-changes-lite.min.js +1 -1
- package/dist/absmartly-overrides-full.min.js +1 -1
- package/dist/absmartly-sdk-plugins.min.js +1 -1
- package/dist/absmartly-vitals.min.js +1 -1
- package/es/cookies/CookiePlugin.js +31 -61
- package/es/cookies/CookiePlugin.js.map +1 -1
- package/es/cookies/cookieUtils.js +82 -0
- package/es/cookies/cookieUtils.js.map +1 -0
- package/es/cookies/index.js +1 -0
- package/es/cookies/index.js.map +1 -1
- package/es/core/DOMChangesPluginLite.js +103 -20
- package/es/core/DOMChangesPluginLite.js.map +1 -1
- package/es/core/DOMManipulatorLite.js +64 -9
- package/es/core/DOMManipulatorLite.js.map +1 -1
- package/es/entries/dom-with-overrides-lite.js +6 -1
- package/es/entries/dom-with-overrides-lite.js.map +1 -1
- package/es/index.js +4 -0
- package/es/index.js.map +1 -1
- package/es/overrides/index.js +1 -0
- package/es/overrides/index.js.map +1 -1
- package/es/overrides/overridesUtils.js +255 -0
- package/es/overrides/overridesUtils.js.map +1 -0
- package/es/utils/debug.js +2 -1
- package/es/utils/debug.js.map +1 -1
- package/es/vitals/WebVitalsPlugin.js +65 -54
- package/es/vitals/WebVitalsPlugin.js.map +1 -1
- package/lib/cookies/CookiePlugin.d.ts +0 -3
- package/lib/cookies/CookiePlugin.js +31 -61
- package/lib/cookies/CookiePlugin.js.map +1 -1
- package/lib/cookies/cookieUtils.d.ts +34 -0
- package/lib/cookies/cookieUtils.js +90 -0
- package/lib/cookies/cookieUtils.js.map +1 -0
- package/lib/cookies/index.d.ts +2 -0
- package/lib/cookies/index.js +8 -1
- package/lib/cookies/index.js.map +1 -1
- package/lib/core/DOMChangesPluginLite.d.ts +1 -1
- package/lib/core/DOMChangesPluginLite.js +103 -20
- package/lib/core/DOMChangesPluginLite.js.map +1 -1
- package/lib/core/DOMManipulatorLite.js +64 -9
- package/lib/core/DOMManipulatorLite.js.map +1 -1
- package/lib/entries/dom-with-overrides-lite.d.ts +7 -1
- package/lib/entries/dom-with-overrides-lite.js +19 -1
- package/lib/entries/dom-with-overrides-lite.js.map +1 -1
- package/lib/index.d.ts +4 -0
- package/lib/index.js +17 -1
- package/lib/index.js.map +1 -1
- package/lib/overrides/index.d.ts +2 -0
- package/lib/overrides/index.js +8 -1
- package/lib/overrides/index.js.map +1 -1
- package/lib/overrides/overridesUtils.d.ts +48 -0
- package/lib/overrides/overridesUtils.js +263 -0
- package/lib/overrides/overridesUtils.js.map +1 -0
- package/lib/utils/debug.js +2 -1
- package/lib/utils/debug.js.map +1 -1
- package/lib/vitals/WebVitalsPlugin.d.ts +1 -2
- package/lib/vitals/WebVitalsPlugin.js +98 -54
- package/lib/vitals/WebVitalsPlugin.js.map +1 -1
- package/package.json +4 -1
- package/types/cookies/CookiePlugin.d.ts +0 -3
- package/types/cookies/cookieUtils.d.ts +34 -0
- package/types/cookies/index.d.ts +2 -0
- package/types/core/DOMChangesPluginLite.d.ts +1 -1
- package/types/entries/dom-with-overrides-lite.d.ts +7 -1
- package/types/index.d.ts +4 -0
- package/types/overrides/index.d.ts +2 -0
- package/types/overrides/overridesUtils.d.ts +48 -0
- package/types/vitals/WebVitalsPlugin.d.ts +1 -2
|
@@ -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.ABsmartlyOverridesFull=t():e.ABsmartlyOverridesFull=t()}(this,()=>(()=>{"use strict";var e={44:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.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 i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a};Object.defineProperty(t,"__esModule",{value:!0}),t.OverridesPluginLite=void 0;var s=i(609),l=function(){function e(e){var t,i,n,r,o;if(this.initialized=!1,!e.context)throw new Error("[OverridesPluginLite] Context is required");this.config={context:e.context,cookieName:null!==(t=e.cookieName)&&void 0!==t?t:"absmartly_overrides",useQueryString:null===(i=e.useQueryString)||void 0===i||i,queryPrefix:null!==(n=e.queryPrefix)&&void 0!==n?n:"_exp_",persistQueryToCookie:null!==(r=e.persistQueryToCookie)&&void 0!==r&&r,debug:null!==(o=e.debug)&&void 0!==o&&o},this.config.debug&&(0,s.logDebug)("[OverridesPluginLite] Initialized with config:",{cookieName:this.config.cookieName,useQueryString:this.config.useQueryString,queryPrefix:this.config.queryPrefix})}return e.prototype.ready=function(){return n(this,void 0,void 0,function(){var e,t,i,n,l,u,c,d,f,g,p;return r(this,function(r){if(this.initialized)return this.config.debug&&(0,s.logDebug)("[OverridesPluginLite] Already initialized"),[2];if(this.initialized=!0,this.registerWithContext(),e={},this.config.useQueryString&&"undefined"!=typeof window&&(e=this.getQueryStringOverrides(),this.config.persistQueryToCookie&&this.config.cookieName&&Object.keys(e).length>0&&this.persistOverridesToCookie(e)),0===Object.keys(e).length&&this.config.cookieName&&(e=this.getCookieOverrides()),0===Object.keys(e).length)return this.config.debug&&(0,s.logDebug)("[OverridesPluginLite] No overrides found"),[2];try{for(t=o(Object.entries(e)),i=t.next();!i.done;i=t.next())n=a(i.value,2),l=n[0],u=n[1],c="number"==typeof u?u:u.variant,isNaN(c)?this.config.debug&&(0,s.logDebug)("[OverridesPluginLite] Skipping invalid variant for ".concat(l,": ").concat(c)):(null===(p=(g=this.config.context).override)||void 0===p||p.call(g,l,c),this.config.debug&&(0,s.logDebug)("[OverridesPluginLite] Override: ".concat(l," -> variant ").concat(c)))}catch(e){d={error:e}}finally{try{i&&!i.done&&(f=t.return)&&f.call(t)}finally{if(d)throw d.error}}return[2]})})},e.prototype.initialize=function(){return n(this,void 0,void 0,function(){return r(this,function(e){return[2,this.ready()]})})},e.prototype.getQueryStringOverrides=function(){var e,t;if("undefined"==typeof window||!window.location)return{};var i=new URLSearchParams(window.location.search),n={},r=this.config.queryPrefix;try{for(var l=o(i.entries()),u=l.next();!u.done;u=l.next()){var c=a(u.value,2),d=c[0],f=c[1];if(d.startsWith(r)){var g=d.substring(r.length);if(g){var p=f.split(","),h=parseInt(p[0],10);isNaN(h)||(1===p.length?n[g]=h:n[g]={variant:h,env:p[1]?parseInt(p[1],10):void 0,id:p[2]?parseInt(p[2],10):void 0})}}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}return this.config.debug&&Object.keys(n).length>0&&(0,s.logDebug)("[OverridesPluginLite] Query string overrides:",n),n},e.prototype.getCookieOverrides=function(){var e,t;if("undefined"==typeof document)return{};var i=this.config.cookieName+"=",n=document.cookie.split(";");try{for(var r=o(n),a=r.next();!a.done;a=r.next()){var s=a.value;if(0===(s=s.trim()).indexOf(i)){var l=decodeURIComponent(s.substring(i.length));return this.parseCookieValue(l)}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return{}},e.prototype.parseCookieValue=function(e){var t,i;if(!e)return{};var n={},r=e;e.includes("|")&&(r=(h=e.split("|"))[h.length-1]);if(!r)return{};var s=r.split(",");try{for(var l=o(s),u=l.next();!u.done;u=l.next()){var c=u.value,d=a(c.split(":"),2),f=d[0],g=d[1];if(f&&g){var p=decodeURIComponent(f),h=g.split("."),v=parseInt(h[0],10);isNaN(v)||(1===h.length?n[p]=v:n[p]={variant:v,env:h[1]?parseInt(h[1],10):void 0,id:h[2]?parseInt(h[2],10):void 0})}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(t)throw t.error}}return n},e.prototype.persistOverridesToCookie=function(e){var t,i;if(this.config.cookieName&&"undefined"!=typeof document){var n=[];try{for(var r=o(Object.entries(e)),l=r.next();!l.done;l=r.next()){var u=a(l.value,2),c=u[0],d=u[1],f=encodeURIComponent(c);if("number"==typeof d)n.push("".concat(f,":").concat(d));else{var g="".concat(f,":").concat(d.variant);void 0!==d.env&&(g+=".".concat(d.env)),void 0!==d.id&&(g+=".".concat(d.id)),n.push(g)}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}var p=n.join(",");document.cookie="".concat(this.config.cookieName,"=").concat(encodeURIComponent(p),";path=/;max-age=").concat(86400),this.config.debug&&(0,s.logDebug)("[OverridesPluginLite] Persisted to cookie:",p)}},e.prototype.registerWithContext=function(){this.config.context&&(this.config.context.__plugins||(this.config.context.__plugins={}),this.config.context.__plugins.overridesPlugin={name:"OverridesPluginLite",version:"1.0.0",initialized:!0,capabilities:["cookie-overrides","query-overrides"],instance:this,timestamp:Date.now()},this.config.debug&&(0,s.logDebug)("[OverridesPluginLite] Registered with context at __plugins.overridesPlugin"))},e.prototype.unregisterFromContext=function(){var e,t;(null===(t=null===(e=this.config.context)||void 0===e?void 0:e.__plugins)||void 0===t?void 0:t.overridesPlugin)&&(delete this.config.context.__plugins.overridesPlugin,this.config.debug&&(0,s.logDebug)("[OverridesPluginLite] Unregistered from context"))},e.prototype.destroy=function(){this.initialized=!1,this.unregisterFromContext()},e}();t.OverridesPluginLite=l},91:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},o=this&&this.__read||function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a},a=this&&this.__spreadArray||function(e,t,i){if(i||2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.CookiePlugin=void 0;var s=i(609),l=function(){function e(e){void 0===e&&(e={}),this.context=e.context,this.debug=e.debug||!1,this.cookieDomain=e.cookieDomain||".absmartly.com",this.cookiePath=e.cookiePath||"/",this.sameSite=e.sameSite||"Lax",this.secure=e.secure||!1,this.cookieExpiryDays=e.cookieExpiryDays||730,this.unitIdCookieName=e.unitIdCookieName||"abs",this.publicIdCookieName=e.publicIdCookieName||"abs_public",this.expiryCookieName=e.expiryCookieName||"abs_expiry",this.utmCookieName=e.utmCookieName||"abs_utm_params",this.utmParams=e.utmParamsList||["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],this.autoUpdateExpiry=!1!==e.autoUpdateExpiry,this.expiryCheckInterval=e.expiryCheckInterval||30}return e.prototype.debugLog=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.debug&&s.logDebug.apply(void 0,a(["[CookiePlugin]"],o(e),!1))},e.prototype.getCookie=function(e){var t,i="; ".concat(document.cookie).split("; ".concat(e,"="));return 2===i.length&&(null===(t=i.pop())||void 0===t?void 0:t.split(";").shift())||null},e.prototype.setCookie=function(e,t,i){try{var n=new Date,r=void 0!==i?i:this.cookieExpiryDays;n.setTime(n.getTime()+24*r*60*60*1e3);var o="expires=".concat(n.toUTCString()),a="".concat(e,"=").concat(t,";").concat(o,";path=").concat(this.cookiePath);return this.cookieDomain&&"localhost"!==this.cookieDomain&&(a+=";domain=".concat(this.cookieDomain)),a+=";SameSite=".concat(this.sameSite),this.secure&&(a+=";Secure"),document.cookie=a,this.debugLog("Set cookie ".concat(e,":"),t),!0}catch(t){return(0,s.logDebug)("[CookiePlugin] Unable to set cookie ".concat(e,":"),t),!1}},e.prototype.deleteCookie=function(e){this.setCookie(e,"",-1)},e.prototype.isLocalStorageAvailable=function(){try{var e="__localStorage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}},e.prototype.generateFastUniqueID=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2)},e.prototype.getUnitId=function(){if(this.unitId)return this.unitId;var e=navigator.cookieEnabled,t=this.isLocalStorageAvailable(),i=null;return e&&(i=this.getCookie(this.unitIdCookieName)||this.getCookie(this.publicIdCookieName)),!i&&t&&(i=localStorage.getItem("abs_id")),i&&(this.unitId=i),i},e.prototype.setUnitId=function(e){this.unitId=e;var t=navigator.cookieEnabled,i=this.isLocalStorageAvailable();t&&(this.setCookie(this.unitIdCookieName,e),this.setCookie(this.publicIdCookieName,e),this.autoUpdateExpiry&&this.updateExpiryTimestamp()),i&&localStorage.setItem("abs_id",e),this.debugLog("Unit ID set:",e)},e.prototype.generateAndSetUnitId=function(){var e=this.generateFastUniqueID();return this.setUnitId(e),e},e.prototype.updateExpiryTimestamp=function(){if(navigator.cookieEnabled){var e=Date.now();this.setCookie(this.expiryCookieName,e.toString()),this.debugLog("Updated expiry timestamp:",e)}},e.prototype.isExpiryFresh=function(){if(!navigator.cookieEnabled)return!1;var e=this.getCookie(this.expiryCookieName);if(!e)return!1;try{var t=parseInt(e,10),i=(Date.now()-t)/864e5,n=i<=this.expiryCheckInterval;return this.debugLog("Expiry check:",{daysSinceSet:i,isFresh:n}),n}catch(e){return this.debugLog("Error parsing expiry cookie:",e),!1}},e.prototype.getUtmParams=function(){var e={},t=new URLSearchParams(window.location.search);if(this.utmParams.forEach(function(i){var n=t.get(i);n&&(e[i]=n)}),0===Object.keys(e).length&&document.referrer)try{var i=new URL(document.referrer);this.utmParams.forEach(function(t){var n=i.searchParams.get(t);n&&(e[t]=n)})}catch(e){this.debugLog("Error parsing referrer URL:",e)}if(0===Object.keys(e).length){var n=this.getStoredUtmParams();if(n)return n}return e},e.prototype.storeUtmParams=function(e){if(0!==Object.keys(e).length){var t={params:e,timestamp:Date.now()},i=navigator.cookieEnabled;if(this.isLocalStorageAvailable())try{localStorage.setItem(this.utmCookieName,JSON.stringify(t)),this.debugLog("Stored UTM params in localStorage:",e)}catch(e){this.debugLog("Failed to store UTM params in localStorage:",e)}i&&(this.setCookie(this.utmCookieName,JSON.stringify(t),30),this.debugLog("Stored UTM params in cookie:",e))}},e.prototype.getStoredUtmParams=function(){var e=null,t=this.isLocalStorageAvailable(),i=navigator.cookieEnabled;if(t)try{e=localStorage.getItem(this.utmCookieName)}catch(e){this.debugLog("Failed to get UTM params from localStorage:",e)}if(!e&&i&&(e=this.getCookie(this.utmCookieName)),e)try{var n=JSON.parse(e);if(Date.now()-n.timestamp<2592e6)return n.params}catch(e){this.debugLog("Failed to parse stored UTM params:",e)}return null},e.prototype.applyUtmAttributesToContext=function(e){var t=this,i=e||this.context;if(i){var n=this.getUtmParams();Object.keys(n).length>0&&this.storeUtmParams(n),Object.entries(n).forEach(function(e){var n=o(e,2),r=n[0],a=n[1],s=r.slice(4);i.attribute(s,a),t.debugLog("Set attribute ".concat(s,":"),a)})}else(0,s.logDebug)("[CookiePlugin] No context available to apply UTM attributes")},e.prototype.clearAllCookies=function(){this.deleteCookie(this.unitIdCookieName),this.deleteCookie(this.publicIdCookieName),this.deleteCookie(this.expiryCookieName),this.deleteCookie(this.utmCookieName),this.isLocalStorageAvailable()&&(localStorage.removeItem("abs_id"),localStorage.removeItem(this.utmCookieName)),this.unitId=void 0,this.debugLog("All cookies and storage cleared")},e.prototype.initialize=function(){return n(this,void 0,void 0,function(){var e;return r(this,function(t){return this.debugLog("Initializing CookiePlugin"),(e=this.getUnitId())?(this.debugLog("Using existing unit ID:",e),this.autoUpdateExpiry&&!this.isExpiryFresh()&&this.updateExpiryTimestamp()):(e=this.generateAndSetUnitId(),this.debugLog("Generated new unit ID:",e)),this.context&&this.applyUtmAttributesToContext(),this.debugLog("CookiePlugin initialized successfully"),[2]})})},e.prototype.setContext=function(e){this.context=e,this.debugLog("Context set for CookiePlugin")},e.prototype.needsWorkerCall=function(e){var t=e||new URLSearchParams(window.location.search);if(Array.from(t.keys()).some(function(e){return e.startsWith("exp_")}))return this.debugLog("Worker call needed due to experiment overrides"),!0;var i=this.getUnitId(),n=navigator.cookieEnabled,r=this.isLocalStorageAvailable();if(i){if(n&&!this.isExpiryFresh())return this.debugLog("Existing ID present but expiry not fresh - need worker call"),!0}else if(n||r){var o=this.getCookie(this.expiryCookieName);return this.debugLog(o?"No existing ID but expiry cookie exists - need worker call":"No existing ID and no expiry cookie - need worker call"),!0}return!1},e.prototype.trackLanding=function(e){var t=e||this.context;if(t){var i=new URLSearchParams(window.location.search),n=this.utmParams.some(function(e){return i.get(e)}),r=document.referrer,o=r&&!r.includes(this.cookieDomain.replace(".","")),a=navigator.cookieEnabled||this.isLocalStorageAvailable(),l=!!(this.getCookie(this.unitIdCookieName)||this.getCookie(this.publicIdCookieName)||this.getCookie(this.expiryCookieName)||this.isLocalStorageAvailable()&&localStorage.getItem("abs_id"));if(n||o||a&&!l){var u={referrer_url:r||"",landing_url:window.location.href,accepts_cookies:navigator.cookieEnabled,accepts_storage:this.isLocalStorageAvailable(),has_utm:n};this.debugLog("Tracking landing:",u),t.track("landing",u)}}else(0,s.logDebug)("[CookiePlugin] No context available for tracking landing")},e}();t.CookiePlugin=l},241:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,r)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),r=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||n(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),t.CookiePlugin=t.BrowserCookieAdapter=t.OverridesPlugin=t.OverridesPluginFull=void 0;var o=i(977);Object.defineProperty(t,"OverridesPluginFull",{enumerable:!0,get:function(){return o.OverridesPluginFull}}),Object.defineProperty(t,"OverridesPlugin",{enumerable:!0,get:function(){return o.OverridesPluginFull}});var a=i(637);Object.defineProperty(t,"BrowserCookieAdapter",{enumerable:!0,get:function(){return a.BrowserCookieAdapter}});var s=i(91);Object.defineProperty(t,"CookiePlugin",{enumerable:!0,get:function(){return s.CookiePlugin}}),r(i(639),t),t.default=o.OverridesPluginFull},248:function(e,t,i){var n,r=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),o=this&&this.__assign||function(){return o=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},o.apply(this,arguments)},a=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},l=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.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.")},u=this&&this.__read||function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a};Object.defineProperty(t,"__esModule",{value:!0}),t.OverridesPlugin=void 0;var c=i(44),d=i(609),f=function(e){function t(t){var i,n,r,o,a,s,l,u,c,f,g,p,h,v,y,m,b,x,k,C,O,P=e.call(this,{context:t.context,cookieName:t.cookieName,useQueryString:null!==(i=t.useQueryString)&&void 0!==i?i:"undefined"!=typeof window,queryPrefix:null!==(n=t.queryPrefix)&&void 0!==n?n:"_exp_",persistQueryToCookie:null!==(r=t.persistQueryToCookie)&&void 0!==r&&r,debug:null!==(o=t.debug)&&void 0!==o&&o})||this;if(P.onExperimentsAddedCallbacks=[],!t.context)throw new Error("[OverridesPlugin] Context is required");P.isServerSide="undefined"==typeof window;var _,w=t.sdkEndpoint;w||((_=t.context)._endpoint?w=_._endpoint:(null===(a=_._config)||void 0===a?void 0:a.endpoint)?w=_._config.endpoint:(null===(s=_._dataProvider)||void 0===s?void 0:s._endpoint)?w=_._dataProvider._endpoint:(null===(l=_._options)||void 0===l?void 0:l.endpoint)&&(w=_._options.endpoint.replace("/v1","")));if(!w&&!t.absmartlyEndpoint&&!((_=t.context)._endpoint||(null===(u=_._config)||void 0===u?void 0:u.endpoint)||(null===(c=_._dataProvider)||void 0===c?void 0:c._endpoint)||(null===(f=_._options)||void 0===f?void 0:f.endpoint)))throw new Error("[OverridesPlugin] SDK endpoint must be provided if not available from context");return P.fullConfig={context:t.context,cookieName:t.cookieName,cookieAdapter:t.cookieAdapter,cookieOptions:null!==(g=t.cookieOptions)&&void 0!==g?g:{path:"/"},useQueryString:null!==(p=t.useQueryString)&&void 0!==p?p:!P.isServerSide,queryPrefix:null!==(h=t.queryPrefix)&&void 0!==h?h:"_exp_",envParam:null!==(v=t.envParam)&&void 0!==v?v:"env",persistQueryToCookie:null!==(y=t.persistQueryToCookie)&&void 0!==y&&y,url:t.url,absmartlyEndpoint:null!==(m=t.absmartlyEndpoint)&&void 0!==m?m:"",sdkEndpoint:w||"",domChangesFieldName:null!==(b=t.domChangesFieldName)&&void 0!==b?b:"__dom_changes",sdkApiKey:null!==(x=t.sdkApiKey)&&void 0!==x?x:"",application:null!==(k=t.application)&&void 0!==k?k:"",environment:null!==(C=t.environment)&&void 0!==C?C:"",debug:null!==(O=t.debug)&&void 0!==O&&O},P.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Initialized with config:",{isServerSide:P.isServerSide,cookieName:P.fullConfig.cookieName,useQueryString:P.fullConfig.useQueryString,queryPrefix:P.fullConfig.queryPrefix,envParam:P.fullConfig.envParam,persistQueryToCookie:P.fullConfig.persistQueryToCookie,sdkEndpoint:P.fullConfig.sdkEndpoint,absmartlyEndpoint:P.fullConfig.absmartlyEndpoint}),P}return r(t,e),t.prototype.ready=function(){return a(this,void 0,void 0,function(){var e;return s(this,function(t){switch(t.label){case 0:return this.initialized?(this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Already initialized, skipping re-initialization"),[2]):(this.initialized=!0,this.registerWithContext(),e=this.getOverrides(),0===Object.keys(e.overrides).length?(this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] No overrides found"),[2]):[4,this.applyOverridesWithFetching(e.overrides,e.devEnv)]);case 1:return t.sent(),[2]}})})},t.prototype.initialize=function(){return a(this,void 0,void 0,function(){return s(this,function(e){return[2,this.ready()]})})},t.prototype.getOverrides=function(){var e={overrides:{},devEnv:null};if(this.fullConfig.cookieName){var t=this.getEnhancedCookieOverrides();e.overrides=o({},t.overrides),e.devEnv=t.devEnv}if(this.fullConfig.useQueryString){var i=this.getEnhancedQueryStringOverrides();Object.keys(i.overrides).length>0&&(e.overrides=o(o({},e.overrides),i.overrides),null!==i.devEnv&&(e.devEnv=i.devEnv),this.fullConfig.persistQueryToCookie&&this.fullConfig.cookieName&&this.persistEnhancedOverridesToCookie(e))}return e},t.prototype.getEnhancedQueryStringOverrides=function(){var e,t;try{var i=void 0;if(this.isServerSide){if(!this.fullConfig.url)return{overrides:{},devEnv:null};var n="string"==typeof this.fullConfig.url?new URL(this.fullConfig.url):this.fullConfig.url;i=new URLSearchParams(n.search)}else i=new URLSearchParams(window.location.search);var r={},o=null;if(this.fullConfig.envParam){var a=i.get(this.fullConfig.envParam);a&&(o=a)}var s=this.fullConfig.queryPrefix;try{for(var c=l(i.entries()),f=c.next();!f.done;f=c.next()){var g=u(f.value,2),p=g[0],h=g[1];if(p.startsWith(s)){var v=p.substring(s.length);if(v){var y=h.split(","),m=parseInt(y[0],10);isNaN(m)||(1===y.length?r[v]=m:r[v]={variant:m,env:y[1]?parseInt(y[1],10):void 0,id:y[2]?parseInt(y[2],10):void 0})}}}}catch(t){e={error:t}}finally{try{f&&!f.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}return this.fullConfig.debug&&Object.keys(r).length>0&&(0,d.logDebug)("[OverridesPlugin] Query string overrides:",r,"env:",o),{overrides:r,devEnv:o}}catch(e){return(0,d.logDebug)("[OverridesPlugin] Error parsing query string:",e),{overrides:{},devEnv:null}}},t.prototype.getEnhancedCookieOverrides=function(){var e,t;if(!this.fullConfig.cookieName)return{overrides:{},devEnv:null};var i=null;if(this.fullConfig.cookieAdapter)i=this.fullConfig.cookieAdapter.get(this.fullConfig.cookieName);else if("undefined"!=typeof document){var n=this.fullConfig.cookieName+"=",r=document.cookie.split(";");try{for(var o=l(r),a=o.next();!a.done;a=o.next()){var s=a.value;if(0===(s=s.trim()).indexOf(n)){i=decodeURIComponent(s.substring(n.length));break}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}this.fullConfig.debug&&i&&(0,d.logDebug)("[OverridesPlugin] Raw cookie value:",i);var u=this.parseEnhancedCookieValue(i);return this.fullConfig.debug&&Object.keys(u.overrides).length>0&&(0,d.logDebug)("[OverridesPlugin] Parsed cookie overrides:",u),u},t.prototype.parseEnhancedCookieValue=function(e){var t,i;if(!e)return{overrides:{},devEnv:null};try{var n=null,r=e;if(e.startsWith("devEnv=")){var o=e.split("|");n=decodeURIComponent(o[0].substring(7)),r=o[1]||""}var a={};if(r){var s=r.split(",");try{for(var c=l(s),f=c.next();!f.done;f=c.next()){var g=f.value,p=u(g.split(":"),2),h=p[0],v=p[1];if(h&&v){var y=decodeURIComponent(h),m=(o=v.split("."),parseInt(o[0],10));isNaN(m)||(1===o.length?a[y]=m:a[y]={variant:m,env:o[1]?parseInt(o[1],10):void 0,id:o[2]?parseInt(o[2],10):void 0})}}}catch(e){t={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(t)throw t.error}}}return{overrides:a,devEnv:n}}catch(e){return(0,d.logDebug)("[OverridesPlugin] Error parsing overrides:",e),{overrides:{},devEnv:null}}},t.prototype.persistEnhancedOverridesToCookie=function(e){var t,i;if(this.fullConfig.cookieName){var n=[];e.devEnv&&n.push("devEnv=".concat(encodeURIComponent(e.devEnv)));var r=[];try{for(var a=l(Object.entries(e.overrides)),s=a.next();!s.done;s=a.next()){var c=u(s.value,2),f=c[0],g=c[1],p=encodeURIComponent(f);if("number"==typeof g)r.push("".concat(p,":").concat(g));else{var h=g,v="".concat(p,":").concat(h.variant);void 0!==h.env&&(v+=".".concat(h.env)),void 0!==h.id&&(v+=".".concat(h.id)),r.push(v)}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}var y=n.length>0?"".concat(n.join("|"),"|").concat(r.join(",")):r.join(",");if(this.fullConfig.cookieAdapter){var m=o({},this.fullConfig.cookieOptions);this.isServerSide&&(void 0===m.httpOnly&&(m.httpOnly=!0),void 0===m.secure&&(m.secure=!0),void 0===m.sameSite&&(m.sameSite="lax")),this.fullConfig.cookieAdapter.set(this.fullConfig.cookieName,y,m)}else if("undefined"!=typeof document){m=this.fullConfig.cookieOptions||{};var b="".concat(this.fullConfig.cookieName,"=").concat(encodeURIComponent(y));m.path&&(b+=";path=".concat(m.path)),m.maxAge&&(b+=";max-age=".concat(m.maxAge));var x=m;if(x.expires){var k=x.expires instanceof Date?x.expires.toUTCString():x.expires;b+=";expires=".concat(k)}m.domain&&(b+=";domain=".concat(m.domain)),m.secure&&(b+=";secure"),m.sameSite&&(b+=";samesite=".concat(m.sameSite)),document.cookie=b}this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Persisted to cookie:",y)}},t.prototype.applyOverridesWithFetching=function(e,t){return a(this,void 0,void 0,function(){var i,n,r,o,a,c,f,g,p,h,v,y,m,b,x,k,C,O;return s(this,function(s){switch(s.label){case 0:(0,d.logDebug)("[OverridesPlugin] Initializing with overrides:",e),(0,d.logDebug)("[OverridesPlugin] Dev environment:",t),i=[],n=new Set;try{for(r=l(Object.entries(e)),o=r.next();!o.done;o=r.next())a=u(o.value,2),c=a[0],m=a[1],1===(f="number"==typeof m?{variant:m}:m).env?((0,d.logDebug)("[OverridesPlugin] ".concat(c," categorized as DEV experiment (env=1)")),i.push([c,f])):2===f.env&&f.id?((0,d.logDebug)("[OverridesPlugin] ".concat(c," categorized as DRAFT experiment (env=2, id=").concat(f.id,")")),n.add(f.id)):(0,d.logDebug)("[OverridesPlugin] ".concat(c," categorized as RUNNING experiment (env=").concat(f.env||0,")"))}catch(e){x={error:e}}finally{try{o&&!o.done&&(k=r.return)&&k.call(r)}finally{if(x)throw x.error}}return(0,d.logDebug)("[OverridesPlugin] Categorization summary:",{total_overrides:Object.keys(e).length,dev_experiments:i.length,draft_experiments:n.size,running_experiments:Object.keys(e).length-i.length-n.size,dev_environment:t}),n.size>0?((0,d.logDebug)("[OverridesPlugin] Will fetch ".concat(n.size," DRAFT experiments from API")),[4,this.fetchFromAPI(Array.from(n))]):[3,2];case 1:s.sent(),s.label=2;case 2:return g=t||this.fullConfig.environment||null,i.length>0&&g?((0,d.logDebug)("[OverridesPlugin] Will fetch ".concat(i.length," DEV experiments for environment: ").concat(g)),[4,this.fetchFromDevSDK(i,g)]):[3,4];case 3:return s.sent(),[3,5];case 4:i.length>0&&(0,d.logDebug)("[OverridesPlugin] Have ".concat(i.length," DEV experiments but NO devEnv specified - NOT fetching")),s.label=5;case 5:try{for(p=l(Object.entries(e)),h=p.next();!h.done;h=p.next())v=u(h.value,2),y=v[0],m=v[1],b="number"==typeof m?m:m.variant,this.fullConfig.context.override(y,b),this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Override: ".concat(y," -> variant ").concat(b))}catch(e){C={error:e}}finally{try{h&&!h.done&&(O=p.return)&&O.call(p)}finally{if(C)throw C.error}}return[2]}})})},t.prototype.fetchFromAPI=function(e){return a(this,void 0,void 0,function(){var t,i,n,r,o,a;return s(this,function(s){switch(s.label){case 0:if(0===e.length)return this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] No experiment IDs to fetch from API"),[2];(t=this.fullConfig.absmartlyEndpoint)||(t=this.fullConfig.sdkEndpoint.replace(".absmartly.io",".absmartly.com")),t.endsWith("/v1")&&(t=t.slice(0,-3)),t.startsWith("http")||(t="https://".concat(t)),i="".concat(t,"/v1/experiments?ids=").concat(e.join(",")),this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Fetching non-running experiments from API:",i),s.label=1;case 1:return s.trys.push([1,4,,5]),n={"Content-Type":"application/json"},this.fullConfig.sdkApiKey&&(n.Authorization="ApiKey ".concat(this.fullConfig.sdkApiKey)),[4,fetch(i,{method:"GET",credentials:"include",headers:n,mode:"cors"})];case 2:return r=s.sent(),(0,d.logDebug)("[OverridesPlugin] API Response status:",r.status,r.statusText),r.ok?[4,r.json()]:((0,d.logDebug)("[OverridesPlugin] API request failed with status ".concat(r.status)),401===r.status&&(0,d.logDebug)("[OverridesPlugin] Check if you need to log in to the ABsmartly console first"),[2]);case 3:return(o=s.sent()).experiments&&(this.injectExperimentsIntoContext(o.experiments),this.notifyExperimentsAdded()),[3,5];case 4:return a=s.sent(),(0,d.logDebug)("[OverridesPlugin] Failed to fetch experiments from API:",a),[3,5];case 5:return[2]}})})},t.prototype.fetchFromDevSDK=function(e,t){return a(this,void 0,void 0,function(){var e,i,n,r,a,l,c;return s(this,function(s){switch(s.label){case 0:(e=this.fullConfig.sdkEndpoint).startsWith("http")||(e="https://".concat(e)),e.endsWith("/v1")&&(e=e.slice(0,-3)),i="".concat(e,"/v1/context?environment=").concat(encodeURIComponent(t)),this.fullConfig.application&&(i+="&application=".concat(encodeURIComponent(this.fullConfig.application))),this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Fetching development experiments from SDK:",i),s.label=1;case 1:return s.trys.push([1,4,,5]),n={},this.fullConfig.sdkApiKey&&(n.Authorization="ApiKey ".concat(this.fullConfig.sdkApiKey)),[4,fetch(i,{method:"GET",headers:n})];case 2:return r=s.sent(),(0,d.logDebug)("[OverridesPlugin] DEV Response status:",r.status,r.statusText),r.ok?[4,r.json()]:((0,d.logDebug)("[OverridesPlugin] DEV SDK request failed with status ".concat(r.status)),[2]);case 3:return(a=s.sent()).experiments&&(l=Object.entries(a.experiments).map(function(e){var t=u(e,2),i=t[0],n=t[1];return o(o({},n),{name:i})}),this.injectExperimentsIntoContext(l),this.notifyExperimentsAdded()),[3,5];case 4:return c=s.sent(),(0,d.logDebug)("[OverridesPlugin] Failed to fetch experiments from dev SDK:",c),[3,5];case 5:return[2]}})})},t.prototype.injectExperimentsIntoContext=function(e){var t,i,n,r,a,s=this.fullConfig.context.data.bind(this.fullConfig.context),c=new Map;try{for(var f=l(e),g=f.next();!g.done;g=f.next()){var p=g.value,h={id:p.id,name:p.name,unitType:(null===(r=p.unit_type)||void 0===r?void 0:r.name)||"user_id",iteration:p.iteration||1,seedHi:0,seedLo:0,split:p.split||[],trafficSeedHi:0,trafficSeedLo:0,trafficSplit:[0,1],fullOnVariant:0,applications:(null===(a=p.applications)||void 0===a?void 0:a.map(function(e){var t;return{name:(null===(t=e.application)||void 0===t?void 0:t.name)||e.name}}))||[],variants:[],audience:p.audience||"",audienceStrict:p.audience_strict||!1};if(p.variants&&Array.isArray(p.variants))for(var v=0;v<p.variants.length;v++){var y=p.variants[v],m={name:y.name||"Variant ".concat(v),config:"string"==typeof y.config?y.config:JSON.stringify(y.config||{})};if(y.variables)m.variables=y.variables;else if(y.config)try{var b="string"==typeof y.config?JSON.parse(y.config):y.config,x=this.fullConfig.domChangesFieldName;b[x]&&(m.variables=((n={})[x]=b[x],n),(0,d.logDebug)("[OverridesPlugin] Variant ".concat(v," has DOM changes field '").concat(x,"'")))}catch(e){(0,d.logDebug)("[OverridesPlugin] Failed to parse variant config:",e)}h.variants[v]=m}c.set(p.name,h)}}catch(e){t={error:e}}finally{try{g&&!g.done&&(i=f.return)&&i.call(f)}finally{if(t)throw t.error}}this.fullConfig.context.data=function(){var e,t,i=s();if(!i)return i;var n=i.experiments||[],r=new Set(n.map(function(e){return e.name})),a=function(e,t){if(r.has(e)){var i=n.findIndex(function(t){return t.name===e});i>=0&&(n[i]=t)}else n.push(t)};try{for(var d=l(c),f=d.next();!f.done;f=d.next()){var g=u(f.value,2);a(g[0],g[1])}}catch(t){e={error:t}}finally{try{f&&!f.done&&(t=d.return)&&t.call(d)}finally{if(e)throw e.error}}return o(o({},i),{experiments:n})},this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Injected ".concat(e.length," experiments into context"))},t.prototype.onExperimentsAdded=function(e){this.onExperimentsAddedCallbacks.push(e)},t.prototype.notifyExperimentsAdded=function(){var e,t;this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Notifying ".concat(this.onExperimentsAddedCallbacks.length," listeners about new experiments"));try{for(var i=l(this.onExperimentsAddedCallbacks),n=i.next();!n.done;n=i.next()){var r=n.value;try{r()}catch(e){(0,d.logDebug)("[OverridesPlugin] Error in experiments added callback:",e)}}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},t.prototype.registerWithContext=function(){this.fullConfig.context&&(this.fullConfig.context.__plugins||(this.fullConfig.context.__plugins={}),this.fullConfig.context.__plugins.overridesPlugin={name:"OverridesPlugin",version:"1.0.0",initialized:!0,capabilities:["cookie-overrides","query-overrides","api-fetch","dev-environments"],instance:this,timestamp:Date.now()},this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Registered with context at __plugins.overridesPlugin"))},t.prototype.unregisterFromContext=function(){var e,t;(null===(t=null===(e=this.fullConfig.context)||void 0===e?void 0:e.__plugins)||void 0===t?void 0:t.overridesPlugin)&&(delete this.fullConfig.context.__plugins.overridesPlugin,this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Unregistered from context"))},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.unregisterFromContext(),this.onExperimentsAddedCallbacks=[]},t}(c.OverridesPluginLite);t.OverridesPlugin=f},609:function(e,t){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)},n=this&&this.__read||function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a},r=this&&this.__spreadArray||function(e,t,i){if(i||2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))};function o(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];if(t.DEBUG)if(2===e.length&&"string"==typeof e[0]&&"object"==typeof e[1]){var o=n(e,2),a=o[0],s=o[1];if(a.includes("Original state already stored"))return;if(a.includes("State store operation"))return;if(a.includes("Performance:")&&(null==s?void 0:s.duration)&&s.duration<5)return;if(a.includes("Message sent:")||a.includes("Message received:"))return;var l=(new Date).toISOString(),u="[ABsmartly Debug]";console.log("".concat(u," [").concat(l,"] ").concat(a),s)}else if(1===e.length&&"string"==typeof e[0]){if((a=e[0]).includes("Original state already stored"))return;if(a.includes("State store operation"))return;if(a.includes("Message sent:")||a.includes("Message received:"))return;l=(new Date).toISOString(),u="[ABsmartly Debug]";console.log("".concat(u," [").concat(l,"] ").concat(a))}else console.log.apply(console,r([],n(e),!1))}Object.defineProperty(t,"__esModule",{value:!0}),t.DEBUG=void 0,t.logDebug=o,t.logChangeApplication=function(e,i,n,r,a){if(t.DEBUG){o("".concat(a?"✓":"✗"," Applied ").concat(n," change to ").concat(r," element(s)"),{experimentName:e,selector:i,changeType:n,elementsCount:r,success:a})}},t.logChangeRemoval=function(e,i,n,r){if(t.DEBUG){o("Restored ".concat(r," element(s) to original state"),{experimentName:e,selector:i,changeType:n,elementsCount:r,action:"restore"})}},t.logExperimentSummary=function(e,i,n,r){if(t.DEBUG){o('Experiment "'.concat(e,'" summary'),{experimentName:e,totalChanges:i,successfulChanges:n,pendingChanges:r,successRate:i>0?"".concat(Math.round(n/i*100),"%"):"N/A"})}},t.logStateOperation=function(e,i,n,r){if(t.DEBUG){o("State ".concat(e," operation"),{operation:e,selector:i,changeType:n,experimentName:r})}},t.logVisibilityEvent=function(e,i,n){if(t.DEBUG){o(n?"Element became visible - experiment triggered":"Element visibility changed",{experimentName:e,selector:i.className||i.id||i.tagName,triggered:n,action:"visibility"})}},t.logMessage=function(e,i,n){if(t.DEBUG){o("Message ".concat(e,": ").concat(i),{direction:e,messageType:i,payload:n,bridge:"extension"})}},t.logPerformance=function(e,n,r){if(t.DEBUG){o("Performance: ".concat(e," took ").concat(n,"ms"),i({operation:e,duration:n,performance:!0},r))}},t.DEBUG=!1},637:function(e,t){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)},n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserCookieAdapter=void 0;var r=function(){function e(){}return e.prototype.get=function(e){var t,i,r=e+"=",o=document.cookie.split(";");try{for(var a=n(o),s=a.next();!s.done;s=a.next()){var l=s.value;if(0===(l=l.trim()).indexOf(r))return decodeURIComponent(l.substring(r.length))}}catch(e){t={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}return null},e.prototype.set=function(e,t,i){var n="".concat(e,"=").concat(encodeURIComponent(t));i&&(i.path&&(n+="; path=".concat(i.path)),i.domain&&(n+="; domain=".concat(i.domain)),void 0!==i.maxAge&&(n+="; max-age=".concat(i.maxAge)),i.secure&&(n+="; secure"),i.sameSite&&(n+="; samesite=".concat(i.sameSite))),document.cookie=n},e.prototype.delete=function(e,t){this.set(e,"",i(i({},t),{maxAge:0}))},e}();t.BrowserCookieAdapter=r},639:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},977:function(e,t,i){var n,r=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.OverridesPluginFull=void 0;var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(i(248).OverridesPlugin);t.OverridesPluginFull=o}},t={};var i=function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,i),o.exports}(241);return i})());
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.ABsmartlyOverridesFull=t():e.ABsmartlyOverridesFull=t()}(this,()=>(()=>{"use strict";var e={44:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.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 i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a};Object.defineProperty(t,"__esModule",{value:!0}),t.OverridesPluginLite=void 0;var s=i(609),l=function(){function e(e){var t,i,n,r,o;if(this.initialized=!1,!e.context)throw new Error("[OverridesPluginLite] Context is required");this.config={context:e.context,cookieName:null!==(t=e.cookieName)&&void 0!==t?t:"absmartly_overrides",useQueryString:null===(i=e.useQueryString)||void 0===i||i,queryPrefix:null!==(n=e.queryPrefix)&&void 0!==n?n:"_exp_",persistQueryToCookie:null!==(r=e.persistQueryToCookie)&&void 0!==r&&r,debug:null!==(o=e.debug)&&void 0!==o&&o},this.config.debug&&(0,s.logDebug)("[OverridesPluginLite] Initialized with config:",{cookieName:this.config.cookieName,useQueryString:this.config.useQueryString,queryPrefix:this.config.queryPrefix})}return e.prototype.ready=function(){return n(this,void 0,void 0,function(){var e,t,i,n,l,u,c,d,f,g,p;return r(this,function(r){if(this.initialized)return this.config.debug&&(0,s.logDebug)("[OverridesPluginLite] Already initialized"),[2];if(this.initialized=!0,this.registerWithContext(),e={},this.config.useQueryString&&"undefined"!=typeof window&&(e=this.getQueryStringOverrides(),this.config.persistQueryToCookie&&this.config.cookieName&&Object.keys(e).length>0&&this.persistOverridesToCookie(e)),0===Object.keys(e).length&&this.config.cookieName&&(e=this.getCookieOverrides()),0===Object.keys(e).length)return this.config.debug&&(0,s.logDebug)("[OverridesPluginLite] No overrides found"),[2];try{for(t=o(Object.entries(e)),i=t.next();!i.done;i=t.next())n=a(i.value,2),l=n[0],u=n[1],c="number"==typeof u?u:u.variant,isNaN(c)?this.config.debug&&(0,s.logDebug)("[OverridesPluginLite] Skipping invalid variant for ".concat(l,": ").concat(c)):(null===(p=(g=this.config.context).override)||void 0===p||p.call(g,l,c),this.config.debug&&(0,s.logDebug)("[OverridesPluginLite] Override: ".concat(l," -> variant ").concat(c)))}catch(e){d={error:e}}finally{try{i&&!i.done&&(f=t.return)&&f.call(t)}finally{if(d)throw d.error}}return[2]})})},e.prototype.initialize=function(){return n(this,void 0,void 0,function(){return r(this,function(e){return[2,this.ready()]})})},e.prototype.getQueryStringOverrides=function(){var e,t;if("undefined"==typeof window||!window.location)return{};var i=new URLSearchParams(window.location.search),n={},r=this.config.queryPrefix;try{for(var l=o(i.entries()),u=l.next();!u.done;u=l.next()){var c=a(u.value,2),d=c[0],f=c[1];if(d.startsWith(r)){var g=d.substring(r.length);if(g){var p=f.split(","),v=parseInt(p[0],10);isNaN(v)||(1===p.length?n[g]=v:n[g]={variant:v,env:p[1]?parseInt(p[1],10):void 0,id:p[2]?parseInt(p[2],10):void 0})}}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}return this.config.debug&&Object.keys(n).length>0&&(0,s.logDebug)("[OverridesPluginLite] Query string overrides:",n),n},e.prototype.getCookieOverrides=function(){var e,t;if("undefined"==typeof document)return{};var i=this.config.cookieName+"=",n=document.cookie.split(";");try{for(var r=o(n),a=r.next();!a.done;a=r.next()){var s=a.value;if(0===(s=s.trim()).indexOf(i)){var l=decodeURIComponent(s.substring(i.length));return this.parseCookieValue(l)}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return{}},e.prototype.parseCookieValue=function(e){var t,i;if(!e)return{};var n={},r=e;e.includes("|")&&(r=(v=e.split("|"))[v.length-1]);if(!r)return{};var s=r.split(",");try{for(var l=o(s),u=l.next();!u.done;u=l.next()){var c=u.value,d=a(c.split(":"),2),f=d[0],g=d[1];if(f&&g){var p=decodeURIComponent(f),v=g.split("."),h=parseInt(v[0],10);isNaN(h)||(1===v.length?n[p]=h:n[p]={variant:h,env:v[1]?parseInt(v[1],10):void 0,id:v[2]?parseInt(v[2],10):void 0})}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(t)throw t.error}}return n},e.prototype.persistOverridesToCookie=function(e){var t,i;if(this.config.cookieName&&"undefined"!=typeof document){var n=[];try{for(var r=o(Object.entries(e)),l=r.next();!l.done;l=r.next()){var u=a(l.value,2),c=u[0],d=u[1],f=encodeURIComponent(c);if("number"==typeof d)n.push("".concat(f,":").concat(d));else{var g="".concat(f,":").concat(d.variant);void 0!==d.env&&(g+=".".concat(d.env)),void 0!==d.id&&(g+=".".concat(d.id)),n.push(g)}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(i=r.return)&&i.call(r)}finally{if(t)throw t.error}}var p=n.join(",");document.cookie="".concat(this.config.cookieName,"=").concat(encodeURIComponent(p),";path=/;max-age=").concat(86400),this.config.debug&&(0,s.logDebug)("[OverridesPluginLite] Persisted to cookie:",p)}},e.prototype.registerWithContext=function(){this.config.context&&(this.config.context.__plugins||(this.config.context.__plugins={}),this.config.context.__plugins.overridesPlugin={name:"OverridesPluginLite",version:"1.0.0",initialized:!0,capabilities:["cookie-overrides","query-overrides"],instance:this,timestamp:Date.now()},this.config.debug&&(0,s.logDebug)("[OverridesPluginLite] Registered with context at __plugins.overridesPlugin"))},e.prototype.unregisterFromContext=function(){var e,t;(null===(t=null===(e=this.config.context)||void 0===e?void 0:e.__plugins)||void 0===t?void 0:t.overridesPlugin)&&(delete this.config.context.__plugins.overridesPlugin,this.config.debug&&(0,s.logDebug)("[OverridesPluginLite] Unregistered from context"))},e.prototype.destroy=function(){this.initialized=!1,this.unregisterFromContext()},e}();t.OverridesPluginLite=l},91:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},o=this&&this.__read||function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a},a=this&&this.__spreadArray||function(e,t,i){if(i||2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0}),t.CookiePlugin=void 0;var s=i(609),l=i(319),u=function(){function e(e){void 0===e&&(e={}),this.context=e.context,this.debug=e.debug||!1,this.cookieDomain=e.cookieDomain||".absmartly.com",this.cookiePath=e.cookiePath||"/",this.sameSite=e.sameSite||"Lax",this.secure=e.secure||!1,this.cookieExpiryDays=e.cookieExpiryDays||730,this.unitIdCookieName=e.unitIdCookieName||"abs",this.publicIdCookieName=e.publicIdCookieName||"abs_public",this.expiryCookieName=e.expiryCookieName||"abs_expiry",this.utmCookieName=e.utmCookieName||"abs_utm_params",this.utmParams=e.utmParamsList||["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],this.autoUpdateExpiry=!1!==e.autoUpdateExpiry,this.expiryCheckInterval=e.expiryCheckInterval||30}return e.prototype.debugLog=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.debug&&s.logDebug.apply(void 0,a(["[CookiePlugin]"],o(e),!1))},e.prototype.setCookie=function(e,t,i){var n=void 0!==i?i:this.cookieExpiryDays,r=(0,l.setCookie)(e,t,n,{domain:this.cookieDomain,path:this.cookiePath,sameSite:this.sameSite,secure:this.secure});return r&&this.debugLog("Set cookie ".concat(e,":"),t),r},e.prototype.deleteCookie=function(e){(0,l.deleteCookie)(e,{domain:this.cookieDomain,path:this.cookiePath})},e.prototype.getUnitId=function(){if(this.unitId)return this.unitId;var e=navigator.cookieEnabled,t=(0,l.isLocalStorageAvailable)(),i=null;return e&&(i=(0,l.getCookie)(this.unitIdCookieName)||(0,l.getCookie)(this.publicIdCookieName)),!i&&t&&(i=localStorage.getItem("abs_id")),i&&(this.unitId=i),i},e.prototype.setUnitId=function(e){this.unitId=e;var t=navigator.cookieEnabled,i=(0,l.isLocalStorageAvailable)();t&&(this.setCookie(this.unitIdCookieName,e),this.setCookie(this.publicIdCookieName,e),this.autoUpdateExpiry&&this.updateExpiryTimestamp()),i&&localStorage.setItem("abs_id",e),this.debugLog("Unit ID set:",e)},e.prototype.generateAndSetUnitId=function(){var e=(0,l.generateUniqueId)();return this.setUnitId(e),e},e.prototype.updateExpiryTimestamp=function(){if(navigator.cookieEnabled){var e=Date.now();this.setCookie(this.expiryCookieName,e.toString()),this.debugLog("Updated expiry timestamp:",e)}},e.prototype.isExpiryFresh=function(){if(!navigator.cookieEnabled)return!1;var e=(0,l.getCookie)(this.expiryCookieName);if(!e)return!1;try{var t=parseInt(e,10),i=(Date.now()-t)/864e5,n=i<=this.expiryCheckInterval;return this.debugLog("Expiry check:",{daysSinceSet:i,isFresh:n}),n}catch(e){return this.debugLog("Error parsing expiry cookie:",e),!1}},e.prototype.getUtmParams=function(){var e={},t=new URLSearchParams(window.location.search);if(this.utmParams.forEach(function(i){var n=t.get(i);n&&(e[i]=n)}),0===Object.keys(e).length&&document.referrer)try{var i=new URL(document.referrer);this.utmParams.forEach(function(t){var n=i.searchParams.get(t);n&&(e[t]=n)})}catch(e){this.debugLog("Error parsing referrer URL:",e)}if(0===Object.keys(e).length){var n=this.getStoredUtmParams();if(n)return n}return e},e.prototype.storeUtmParams=function(e){if(0!==Object.keys(e).length){var t={params:e,timestamp:Date.now()},i=navigator.cookieEnabled;if((0,l.isLocalStorageAvailable)())try{localStorage.setItem(this.utmCookieName,JSON.stringify(t)),this.debugLog("Stored UTM params in localStorage:",e)}catch(e){this.debugLog("Failed to store UTM params in localStorage:",e)}i&&(this.setCookie(this.utmCookieName,JSON.stringify(t),30),this.debugLog("Stored UTM params in cookie:",e))}},e.prototype.getStoredUtmParams=function(){var e=null,t=(0,l.isLocalStorageAvailable)(),i=navigator.cookieEnabled;if(t)try{e=localStorage.getItem(this.utmCookieName)}catch(e){this.debugLog("Failed to get UTM params from localStorage:",e)}if(!e&&i&&(e=(0,l.getCookie)(this.utmCookieName)),e)try{var n=JSON.parse(e);if(Date.now()-n.timestamp<2592e6)return n.params}catch(e){this.debugLog("Failed to parse stored UTM params:",e)}return null},e.prototype.applyUtmAttributesToContext=function(e){var t=this,i=e||this.context;if(i){var n=this.getUtmParams();Object.keys(n).length>0&&this.storeUtmParams(n),Object.entries(n).forEach(function(e){var n=o(e,2),r=n[0],a=n[1],s=r.slice(4);i.attribute(s,a),t.debugLog("Set attribute ".concat(s,":"),a)})}else(0,s.logDebug)("[CookiePlugin] No context available to apply UTM attributes")},e.prototype.clearAllCookies=function(){this.deleteCookie(this.unitIdCookieName),this.deleteCookie(this.publicIdCookieName),this.deleteCookie(this.expiryCookieName),this.deleteCookie(this.utmCookieName),(0,l.isLocalStorageAvailable)()&&(localStorage.removeItem("abs_id"),localStorage.removeItem(this.utmCookieName)),this.unitId=void 0,this.debugLog("All cookies and storage cleared")},e.prototype.initialize=function(){return n(this,void 0,void 0,function(){var e;return r(this,function(t){return this.debugLog("Initializing CookiePlugin"),(e=this.getUnitId())?(this.debugLog("Using existing unit ID:",e),this.autoUpdateExpiry&&!this.isExpiryFresh()&&this.updateExpiryTimestamp()):(e=this.generateAndSetUnitId(),this.debugLog("Generated new unit ID:",e)),this.context&&this.applyUtmAttributesToContext(),this.debugLog("CookiePlugin initialized successfully"),[2]})})},e.prototype.setContext=function(e){this.context=e,this.debugLog("Context set for CookiePlugin")},e.prototype.needsWorkerCall=function(e){var t=e||new URLSearchParams(window.location.search);if(Array.from(t.keys()).some(function(e){return e.startsWith("exp_")}))return this.debugLog("Worker call needed due to experiment overrides"),!0;var i=this.getUnitId(),n=navigator.cookieEnabled,r=(0,l.isLocalStorageAvailable)();if(i){if(n&&!this.isExpiryFresh())return this.debugLog("Existing ID present but expiry not fresh - need worker call"),!0}else if(n||r){var o=(0,l.getCookie)(this.expiryCookieName);return this.debugLog(o?"No existing ID but expiry cookie exists - need worker call":"No existing ID and no expiry cookie - need worker call"),!0}return!1},e.prototype.trackLanding=function(e){var t=e||this.context;if(t){var i=new URLSearchParams(window.location.search),n=this.utmParams.some(function(e){return i.get(e)}),r=document.referrer,o=r&&!r.includes(this.cookieDomain.replace(".","")),a=navigator.cookieEnabled||(0,l.isLocalStorageAvailable)(),u=!!((0,l.getCookie)(this.unitIdCookieName)||(0,l.getCookie)(this.publicIdCookieName)||(0,l.getCookie)(this.expiryCookieName)||(0,l.isLocalStorageAvailable)()&&localStorage.getItem("abs_id"));if(n||o||a&&!u){var c={referrer_url:r||"",landing_url:window.location.href,accepts_cookies:navigator.cookieEnabled,accepts_storage:(0,l.isLocalStorageAvailable)(),has_utm:n};this.debugLog("Tracking landing:",c),t.track("landing",c)}}else(0,s.logDebug)("[CookiePlugin] No context available for tracking landing")},e}();t.CookiePlugin=u},241:function(e,t,i){var n=this&&this.__createBinding||(Object.create?function(e,t,i,n){void 0===n&&(n=i);var r=Object.getOwnPropertyDescriptor(t,i);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[i]}}),Object.defineProperty(e,n,r)}:function(e,t,i,n){void 0===n&&(n=i),e[n]=t[i]}),r=this&&this.__exportStar||function(e,t){for(var i in e)"default"===i||Object.prototype.hasOwnProperty.call(t,i)||n(t,e,i)};Object.defineProperty(t,"__esModule",{value:!0}),t.CookiePlugin=t.BrowserCookieAdapter=t.OverridesPlugin=t.OverridesPluginFull=void 0;var o=i(977);Object.defineProperty(t,"OverridesPluginFull",{enumerable:!0,get:function(){return o.OverridesPluginFull}}),Object.defineProperty(t,"OverridesPlugin",{enumerable:!0,get:function(){return o.OverridesPluginFull}});var a=i(637);Object.defineProperty(t,"BrowserCookieAdapter",{enumerable:!0,get:function(){return a.BrowserCookieAdapter}});var s=i(91);Object.defineProperty(t,"CookiePlugin",{enumerable:!0,get:function(){return s.CookiePlugin}}),r(i(639),t),t.default=o.OverridesPluginFull},248:function(e,t,i){var n,r=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}),o=this&&this.__assign||function(){return o=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},o.apply(this,arguments)},a=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))(function(r,o){function a(e){try{l(n.next(e))}catch(e){o(e)}}function s(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i(function(e){e(t)})).then(a,s)}l((n=n.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var i,n,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(l){return function(s){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(i=1,n&&(r=2&s[0]?n.return:s[0]?n.throw||((r=n.return)&&r.call(n),0):n.next)&&!(r=r.call(n,s[1])).done)return r;switch(n=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{i=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,l])}}},l=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.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.")},u=this&&this.__read||function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a};Object.defineProperty(t,"__esModule",{value:!0}),t.OverridesPlugin=void 0;var c=i(44),d=i(609),f=function(e){function t(t){var i,n,r,o,a,s,l,u,c,f,g,p,v,h,y,m,b,x,k,C,O,P=e.call(this,{context:t.context,cookieName:t.cookieName,useQueryString:null!==(i=t.useQueryString)&&void 0!==i?i:"undefined"!=typeof window,queryPrefix:null!==(n=t.queryPrefix)&&void 0!==n?n:"_exp_",persistQueryToCookie:null!==(r=t.persistQueryToCookie)&&void 0!==r&&r,debug:null!==(o=t.debug)&&void 0!==o&&o})||this;if(P.onExperimentsAddedCallbacks=[],!t.context)throw new Error("[OverridesPlugin] Context is required");P.isServerSide="undefined"==typeof window;var _,w=t.sdkEndpoint;w||((_=t.context)._endpoint?w=_._endpoint:(null===(a=_._config)||void 0===a?void 0:a.endpoint)?w=_._config.endpoint:(null===(s=_._dataProvider)||void 0===s?void 0:s._endpoint)?w=_._dataProvider._endpoint:(null===(l=_._options)||void 0===l?void 0:l.endpoint)&&(w=_._options.endpoint.replace("/v1","")));if(!w&&!t.absmartlyEndpoint&&!((_=t.context)._endpoint||(null===(u=_._config)||void 0===u?void 0:u.endpoint)||(null===(c=_._dataProvider)||void 0===c?void 0:c._endpoint)||(null===(f=_._options)||void 0===f?void 0:f.endpoint)))throw new Error("[OverridesPlugin] SDK endpoint must be provided if not available from context");return P.fullConfig={context:t.context,cookieName:t.cookieName,cookieAdapter:t.cookieAdapter,cookieOptions:null!==(g=t.cookieOptions)&&void 0!==g?g:{path:"/"},useQueryString:null!==(p=t.useQueryString)&&void 0!==p?p:!P.isServerSide,queryPrefix:null!==(v=t.queryPrefix)&&void 0!==v?v:"_exp_",envParam:null!==(h=t.envParam)&&void 0!==h?h:"env",persistQueryToCookie:null!==(y=t.persistQueryToCookie)&&void 0!==y&&y,url:t.url,absmartlyEndpoint:null!==(m=t.absmartlyEndpoint)&&void 0!==m?m:"",sdkEndpoint:w||"",domChangesFieldName:null!==(b=t.domChangesFieldName)&&void 0!==b?b:"__dom_changes",sdkApiKey:null!==(x=t.sdkApiKey)&&void 0!==x?x:"",application:null!==(k=t.application)&&void 0!==k?k:"",environment:null!==(C=t.environment)&&void 0!==C?C:"",debug:null!==(O=t.debug)&&void 0!==O&&O},P.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Initialized with config:",{isServerSide:P.isServerSide,cookieName:P.fullConfig.cookieName,useQueryString:P.fullConfig.useQueryString,queryPrefix:P.fullConfig.queryPrefix,envParam:P.fullConfig.envParam,persistQueryToCookie:P.fullConfig.persistQueryToCookie,sdkEndpoint:P.fullConfig.sdkEndpoint,absmartlyEndpoint:P.fullConfig.absmartlyEndpoint}),P}return r(t,e),t.prototype.ready=function(){return a(this,void 0,void 0,function(){var e;return s(this,function(t){switch(t.label){case 0:return this.initialized?(this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Already initialized, skipping re-initialization"),[2]):(this.initialized=!0,this.registerWithContext(),e=this.getOverrides(),0===Object.keys(e.overrides).length?(this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] No overrides found"),[2]):[4,this.applyOverridesWithFetching(e.overrides,e.devEnv)]);case 1:return t.sent(),[2]}})})},t.prototype.initialize=function(){return a(this,void 0,void 0,function(){return s(this,function(e){return[2,this.ready()]})})},t.prototype.getOverrides=function(){var e={overrides:{},devEnv:null};if(this.fullConfig.cookieName){var t=this.getEnhancedCookieOverrides();e.overrides=o({},t.overrides),e.devEnv=t.devEnv}if(this.fullConfig.useQueryString){var i=this.getEnhancedQueryStringOverrides();Object.keys(i.overrides).length>0&&(e.overrides=o(o({},e.overrides),i.overrides),null!==i.devEnv&&(e.devEnv=i.devEnv),this.fullConfig.persistQueryToCookie&&this.fullConfig.cookieName&&this.persistEnhancedOverridesToCookie(e))}return e},t.prototype.getEnhancedQueryStringOverrides=function(){var e,t;try{var i=void 0;if(this.isServerSide){if(!this.fullConfig.url)return{overrides:{},devEnv:null};var n="string"==typeof this.fullConfig.url?new URL(this.fullConfig.url):this.fullConfig.url;i=new URLSearchParams(n.search)}else i=new URLSearchParams(window.location.search);var r={},o=null;if(this.fullConfig.envParam){var a=i.get(this.fullConfig.envParam);a&&(o=a)}var s=this.fullConfig.queryPrefix;try{for(var c=l(i.entries()),f=c.next();!f.done;f=c.next()){var g=u(f.value,2),p=g[0],v=g[1];if(p.startsWith(s)){var h=p.substring(s.length);if(h){var y=v.split(","),m=parseInt(y[0],10);isNaN(m)||(1===y.length?r[h]=m:r[h]={variant:m,env:y[1]?parseInt(y[1],10):void 0,id:y[2]?parseInt(y[2],10):void 0})}}}}catch(t){e={error:t}}finally{try{f&&!f.done&&(t=c.return)&&t.call(c)}finally{if(e)throw e.error}}return this.fullConfig.debug&&Object.keys(r).length>0&&(0,d.logDebug)("[OverridesPlugin] Query string overrides:",r,"env:",o),{overrides:r,devEnv:o}}catch(e){return(0,d.logDebug)("[OverridesPlugin] Error parsing query string:",e),{overrides:{},devEnv:null}}},t.prototype.getEnhancedCookieOverrides=function(){var e,t;if(!this.fullConfig.cookieName)return{overrides:{},devEnv:null};var i=null;if(this.fullConfig.cookieAdapter)i=this.fullConfig.cookieAdapter.get(this.fullConfig.cookieName);else if("undefined"!=typeof document){var n=this.fullConfig.cookieName+"=",r=document.cookie.split(";");try{for(var o=l(r),a=o.next();!a.done;a=o.next()){var s=a.value;if(0===(s=s.trim()).indexOf(n)){i=decodeURIComponent(s.substring(n.length));break}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}this.fullConfig.debug&&i&&(0,d.logDebug)("[OverridesPlugin] Raw cookie value:",i);var u=this.parseEnhancedCookieValue(i);return this.fullConfig.debug&&Object.keys(u.overrides).length>0&&(0,d.logDebug)("[OverridesPlugin] Parsed cookie overrides:",u),u},t.prototype.parseEnhancedCookieValue=function(e){var t,i;if(!e)return{overrides:{},devEnv:null};try{var n=null,r=e;if(e.startsWith("devEnv=")){var o=e.split("|");n=decodeURIComponent(o[0].substring(7)),r=o[1]||""}var a={};if(r){var s=r.split(",");try{for(var c=l(s),f=c.next();!f.done;f=c.next()){var g=f.value,p=u(g.split(":"),2),v=p[0],h=p[1];if(v&&h){var y=decodeURIComponent(v),m=(o=h.split("."),parseInt(o[0],10));isNaN(m)||(1===o.length?a[y]=m:a[y]={variant:m,env:o[1]?parseInt(o[1],10):void 0,id:o[2]?parseInt(o[2],10):void 0})}}}catch(e){t={error:e}}finally{try{f&&!f.done&&(i=c.return)&&i.call(c)}finally{if(t)throw t.error}}}return{overrides:a,devEnv:n}}catch(e){return(0,d.logDebug)("[OverridesPlugin] Error parsing overrides:",e),{overrides:{},devEnv:null}}},t.prototype.persistEnhancedOverridesToCookie=function(e){var t,i;if(this.fullConfig.cookieName){var n=[];e.devEnv&&n.push("devEnv=".concat(encodeURIComponent(e.devEnv)));var r=[];try{for(var a=l(Object.entries(e.overrides)),s=a.next();!s.done;s=a.next()){var c=u(s.value,2),f=c[0],g=c[1],p=encodeURIComponent(f);if("number"==typeof g)r.push("".concat(p,":").concat(g));else{var v=g,h="".concat(p,":").concat(v.variant);void 0!==v.env&&(h+=".".concat(v.env)),void 0!==v.id&&(h+=".".concat(v.id)),r.push(h)}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}var y=n.length>0?"".concat(n.join("|"),"|").concat(r.join(",")):r.join(",");if(this.fullConfig.cookieAdapter){var m=o({},this.fullConfig.cookieOptions);this.isServerSide&&(void 0===m.httpOnly&&(m.httpOnly=!0),void 0===m.secure&&(m.secure=!0),void 0===m.sameSite&&(m.sameSite="lax")),this.fullConfig.cookieAdapter.set(this.fullConfig.cookieName,y,m)}else if("undefined"!=typeof document){m=this.fullConfig.cookieOptions||{};var b="".concat(this.fullConfig.cookieName,"=").concat(encodeURIComponent(y));m.path&&(b+=";path=".concat(m.path)),m.maxAge&&(b+=";max-age=".concat(m.maxAge));var x=m;if(x.expires){var k=x.expires instanceof Date?x.expires.toUTCString():x.expires;b+=";expires=".concat(k)}m.domain&&(b+=";domain=".concat(m.domain)),m.secure&&(b+=";secure"),m.sameSite&&(b+=";samesite=".concat(m.sameSite)),document.cookie=b}this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Persisted to cookie:",y)}},t.prototype.applyOverridesWithFetching=function(e,t){return a(this,void 0,void 0,function(){var i,n,r,o,a,c,f,g,p,v,h,y,m,b,x,k,C,O;return s(this,function(s){switch(s.label){case 0:(0,d.logDebug)("[OverridesPlugin] Initializing with overrides:",e),(0,d.logDebug)("[OverridesPlugin] Dev environment:",t),i=[],n=new Set;try{for(r=l(Object.entries(e)),o=r.next();!o.done;o=r.next())a=u(o.value,2),c=a[0],m=a[1],1===(f="number"==typeof m?{variant:m}:m).env?((0,d.logDebug)("[OverridesPlugin] ".concat(c," categorized as DEV experiment (env=1)")),i.push([c,f])):2===f.env&&f.id?((0,d.logDebug)("[OverridesPlugin] ".concat(c," categorized as DRAFT experiment (env=2, id=").concat(f.id,")")),n.add(f.id)):(0,d.logDebug)("[OverridesPlugin] ".concat(c," categorized as RUNNING experiment (env=").concat(f.env||0,")"))}catch(e){x={error:e}}finally{try{o&&!o.done&&(k=r.return)&&k.call(r)}finally{if(x)throw x.error}}return(0,d.logDebug)("[OverridesPlugin] Categorization summary:",{total_overrides:Object.keys(e).length,dev_experiments:i.length,draft_experiments:n.size,running_experiments:Object.keys(e).length-i.length-n.size,dev_environment:t}),n.size>0?((0,d.logDebug)("[OverridesPlugin] Will fetch ".concat(n.size," DRAFT experiments from API")),[4,this.fetchFromAPI(Array.from(n))]):[3,2];case 1:s.sent(),s.label=2;case 2:return g=t||this.fullConfig.environment||null,i.length>0&&g?((0,d.logDebug)("[OverridesPlugin] Will fetch ".concat(i.length," DEV experiments for environment: ").concat(g)),[4,this.fetchFromDevSDK(i,g)]):[3,4];case 3:return s.sent(),[3,5];case 4:i.length>0&&(0,d.logDebug)("[OverridesPlugin] Have ".concat(i.length," DEV experiments but NO devEnv specified - NOT fetching")),s.label=5;case 5:try{for(p=l(Object.entries(e)),v=p.next();!v.done;v=p.next())h=u(v.value,2),y=h[0],m=h[1],b="number"==typeof m?m:m.variant,this.fullConfig.context.override(y,b),this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Override: ".concat(y," -> variant ").concat(b))}catch(e){C={error:e}}finally{try{v&&!v.done&&(O=p.return)&&O.call(p)}finally{if(C)throw C.error}}return[2]}})})},t.prototype.fetchFromAPI=function(e){return a(this,void 0,void 0,function(){var t,i,n,r,o,a;return s(this,function(s){switch(s.label){case 0:if(0===e.length)return this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] No experiment IDs to fetch from API"),[2];(t=this.fullConfig.absmartlyEndpoint)||(t=this.fullConfig.sdkEndpoint.replace(".absmartly.io",".absmartly.com")),t.endsWith("/v1")&&(t=t.slice(0,-3)),t.startsWith("http")||(t="https://".concat(t)),i="".concat(t,"/v1/experiments?ids=").concat(e.join(",")),this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Fetching non-running experiments from API:",i),s.label=1;case 1:return s.trys.push([1,4,,5]),n={"Content-Type":"application/json"},this.fullConfig.sdkApiKey&&(n.Authorization="ApiKey ".concat(this.fullConfig.sdkApiKey)),[4,fetch(i,{method:"GET",credentials:"include",headers:n,mode:"cors"})];case 2:return r=s.sent(),(0,d.logDebug)("[OverridesPlugin] API Response status:",r.status,r.statusText),r.ok?[4,r.json()]:((0,d.logDebug)("[OverridesPlugin] API request failed with status ".concat(r.status)),401===r.status&&(0,d.logDebug)("[OverridesPlugin] Check if you need to log in to the ABsmartly console first"),[2]);case 3:return(o=s.sent()).experiments&&(this.injectExperimentsIntoContext(o.experiments),this.notifyExperimentsAdded()),[3,5];case 4:return a=s.sent(),(0,d.logDebug)("[OverridesPlugin] Failed to fetch experiments from API:",a),[3,5];case 5:return[2]}})})},t.prototype.fetchFromDevSDK=function(e,t){return a(this,void 0,void 0,function(){var e,i,n,r,a,l,c;return s(this,function(s){switch(s.label){case 0:(e=this.fullConfig.sdkEndpoint).startsWith("http")||(e="https://".concat(e)),e.endsWith("/v1")&&(e=e.slice(0,-3)),i="".concat(e,"/v1/context?environment=").concat(encodeURIComponent(t)),this.fullConfig.application&&(i+="&application=".concat(encodeURIComponent(this.fullConfig.application))),this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Fetching development experiments from SDK:",i),s.label=1;case 1:return s.trys.push([1,4,,5]),n={},this.fullConfig.sdkApiKey&&(n.Authorization="ApiKey ".concat(this.fullConfig.sdkApiKey)),[4,fetch(i,{method:"GET",headers:n})];case 2:return r=s.sent(),(0,d.logDebug)("[OverridesPlugin] DEV Response status:",r.status,r.statusText),r.ok?[4,r.json()]:((0,d.logDebug)("[OverridesPlugin] DEV SDK request failed with status ".concat(r.status)),[2]);case 3:return(a=s.sent()).experiments&&(l=Object.entries(a.experiments).map(function(e){var t=u(e,2),i=t[0],n=t[1];return o(o({},n),{name:i})}),this.injectExperimentsIntoContext(l),this.notifyExperimentsAdded()),[3,5];case 4:return c=s.sent(),(0,d.logDebug)("[OverridesPlugin] Failed to fetch experiments from dev SDK:",c),[3,5];case 5:return[2]}})})},t.prototype.injectExperimentsIntoContext=function(e){var t,i,n,r,a,s=this.fullConfig.context.data.bind(this.fullConfig.context),c=new Map;try{for(var f=l(e),g=f.next();!g.done;g=f.next()){var p=g.value,v={id:p.id,name:p.name,unitType:(null===(r=p.unit_type)||void 0===r?void 0:r.name)||"user_id",iteration:p.iteration||1,seedHi:0,seedLo:0,split:p.split||[],trafficSeedHi:0,trafficSeedLo:0,trafficSplit:[0,1],fullOnVariant:0,applications:(null===(a=p.applications)||void 0===a?void 0:a.map(function(e){var t;return{name:(null===(t=e.application)||void 0===t?void 0:t.name)||e.name}}))||[],variants:[],audience:p.audience||"",audienceStrict:p.audience_strict||!1};if(p.variants&&Array.isArray(p.variants))for(var h=0;h<p.variants.length;h++){var y=p.variants[h],m={name:y.name||"Variant ".concat(h),config:"string"==typeof y.config?y.config:JSON.stringify(y.config||{})};if(y.variables)m.variables=y.variables;else if(y.config)try{var b="string"==typeof y.config?JSON.parse(y.config):y.config,x=this.fullConfig.domChangesFieldName;b[x]&&(m.variables=((n={})[x]=b[x],n),(0,d.logDebug)("[OverridesPlugin] Variant ".concat(h," has DOM changes field '").concat(x,"'")))}catch(e){(0,d.logDebug)("[OverridesPlugin] Failed to parse variant config:",e)}v.variants[h]=m}c.set(p.name,v)}}catch(e){t={error:e}}finally{try{g&&!g.done&&(i=f.return)&&i.call(f)}finally{if(t)throw t.error}}this.fullConfig.context.data=function(){var e,t,i=s();if(!i)return i;var n=i.experiments||[],r=new Set(n.map(function(e){return e.name})),a=function(e,t){if(r.has(e)){var i=n.findIndex(function(t){return t.name===e});i>=0&&(n[i]=t)}else n.push(t)};try{for(var d=l(c),f=d.next();!f.done;f=d.next()){var g=u(f.value,2);a(g[0],g[1])}}catch(t){e={error:t}}finally{try{f&&!f.done&&(t=d.return)&&t.call(d)}finally{if(e)throw e.error}}return o(o({},i),{experiments:n})},this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Injected ".concat(e.length," experiments into context"))},t.prototype.onExperimentsAdded=function(e){this.onExperimentsAddedCallbacks.push(e)},t.prototype.notifyExperimentsAdded=function(){var e,t;this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Notifying ".concat(this.onExperimentsAddedCallbacks.length," listeners about new experiments"));try{for(var i=l(this.onExperimentsAddedCallbacks),n=i.next();!n.done;n=i.next()){var r=n.value;try{r()}catch(e){(0,d.logDebug)("[OverridesPlugin] Error in experiments added callback:",e)}}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},t.prototype.registerWithContext=function(){this.fullConfig.context&&(this.fullConfig.context.__plugins||(this.fullConfig.context.__plugins={}),this.fullConfig.context.__plugins.overridesPlugin={name:"OverridesPlugin",version:"1.0.0",initialized:!0,capabilities:["cookie-overrides","query-overrides","api-fetch","dev-environments"],instance:this,timestamp:Date.now()},this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Registered with context at __plugins.overridesPlugin"))},t.prototype.unregisterFromContext=function(){var e,t;(null===(t=null===(e=this.fullConfig.context)||void 0===e?void 0:e.__plugins)||void 0===t?void 0:t.overridesPlugin)&&(delete this.fullConfig.context.__plugins.overridesPlugin,this.fullConfig.debug&&(0,d.logDebug)("[OverridesPlugin] Unregistered from context"))},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.unregisterFromContext(),this.onExperimentsAddedCallbacks=[]},t}(c.OverridesPluginLite);t.OverridesPlugin=f},319:(e,t)=>{function i(e,t,i,n){void 0===n&&(n={});try{var r=new Date;r.setTime(r.getTime()+24*i*60*60*1e3);var o="expires=".concat(r.toUTCString()),a=n.path||"/",s="".concat(e,"=").concat(t,";").concat(o,";path=").concat(a);n.domain&&"localhost"!==n.domain&&(s+=";domain=".concat(n.domain));var l=n.sameSite||"Lax";return s+=";SameSite=".concat(l),n.secure&&(s+=";Secure"),document.cookie=s,!0}catch(t){return console.error("Unable to set cookie ".concat(e,":"),t),!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.getCookie=function(e){var t,i="; ".concat(document.cookie).split("; ".concat(e,"="));if(2===i.length){return(null===(t=i.pop())||void 0===t?void 0:t.split(";").shift())||null}return null},t.setCookie=i,t.deleteCookie=function(e,t){void 0===t&&(t={});i(e,"",-1,t)},t.generateUniqueId=function(){return Date.now().toString(36)+Math.random().toString(36).substring(2)},t.generateUUID=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})},t.isLocalStorageAvailable=function(){try{var e="__localStorage_test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch(e){return!1}}},609:function(e,t){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)},n=this&&this.__read||function(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,r,o=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){r={error:e}}finally{try{n&&!n.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return a},r=this&&this.__spreadArray||function(e,t,i){if(i||2===arguments.length)for(var n,r=0,o=t.length;r<o;r++)!n&&r in t||(n||(n=Array.prototype.slice.call(t,0,r)),n[r]=t[r]);return e.concat(n||Array.prototype.slice.call(t))};function o(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];if(t.DEBUG)if(2===e.length&&"string"==typeof e[0]&&"object"==typeof e[1]){var o=n(e,2),a=o[0],s=o[1];if(a.includes("Original state already stored"))return;if(a.includes("State store operation"))return;if(a.includes("Performance:")&&(null==s?void 0:s.duration)&&s.duration<5)return;if(a.includes("Message sent:")||a.includes("Message received:"))return;var l=(new Date).toISOString(),u="[ABsmartly Debug]";console.log("".concat(u," [").concat(l,"] ").concat(a),s)}else if(1===e.length&&"string"==typeof e[0]){if((a=e[0]).includes("Original state already stored"))return;if(a.includes("State store operation"))return;if(a.includes("Message sent:")||a.includes("Message received:"))return;l=(new Date).toISOString(),u="[ABsmartly Debug]";console.log("".concat(u," [").concat(l,"] ").concat(a))}else console.log.apply(console,r([],n(e),!1))}Object.defineProperty(t,"__esModule",{value:!0}),t.DEBUG=void 0,t.logDebug=o,t.logChangeApplication=function(e,i,n,r,a){if(t.DEBUG){o("".concat(a?"✓":"✗"," Applied ").concat(n," change to ").concat(r," element(s)"),{experimentName:e,selector:i,changeType:n,elementsCount:r,success:a})}},t.logChangeRemoval=function(e,i,n,r){if(t.DEBUG){o("Restored ".concat(r," element(s) to original state"),{experimentName:e,selector:i,changeType:n,elementsCount:r,action:"restore"})}},t.logExperimentSummary=function(e,i,n,r){if(t.DEBUG){o('Experiment "'.concat(e,'" summary'),{experimentName:e,totalChanges:i,successfulChanges:n,pendingChanges:r,successRate:i>0?"".concat(Math.round(n/i*100),"%"):"N/A"})}},t.logStateOperation=function(e,i,n,r){if(t.DEBUG){o("State ".concat(e," operation"),{operation:e,selector:i,changeType:n,experimentName:r})}},t.logVisibilityEvent=function(e,i,n){if(t.DEBUG){o(n?"Element became visible - experiment triggered":"Element visibility changed",{experimentName:e,selector:i.className||i.id||i.tagName,triggered:n,action:"visibility"})}},t.logMessage=function(e,i,n){if(t.DEBUG){o("Message ".concat(e,": ").concat(i),{direction:e,messageType:i,payload:n,bridge:"extension"})}},t.logPerformance=function(e,n,r){if(t.DEBUG){o("Performance: ".concat(e," took ").concat(n,"ms"),i({operation:e,duration:n,performance:!0},r))}},t.DEBUG=!1},637:function(e,t){var i=this&&this.__assign||function(){return i=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},i.apply(this,arguments)},n=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],n=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserCookieAdapter=void 0;var r=function(){function e(){}return e.prototype.get=function(e){var t,i,r=e+"=",o=document.cookie.split(";");try{for(var a=n(o),s=a.next();!s.done;s=a.next()){var l=s.value;if(0===(l=l.trim()).indexOf(r))return decodeURIComponent(l.substring(r.length))}}catch(e){t={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(t)throw t.error}}return null},e.prototype.set=function(e,t,i){var n="".concat(e,"=").concat(encodeURIComponent(t));i&&(i.path&&(n+="; path=".concat(i.path)),i.domain&&(n+="; domain=".concat(i.domain)),void 0!==i.maxAge&&(n+="; max-age=".concat(i.maxAge)),i.secure&&(n+="; secure"),i.sameSite&&(n+="; samesite=".concat(i.sameSite))),document.cookie=n},e.prototype.delete=function(e,t){this.set(e,"",i(i({},t),{maxAge:0}))},e}();t.BrowserCookieAdapter=r},639:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},977:function(e,t,i){var n,r=this&&this.__extends||(n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},n(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});Object.defineProperty(t,"__esModule",{value:!0}),t.OverridesPluginFull=void 0;var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(i(248).OverridesPlugin);t.OverridesPluginFull=o}},t={};var i=function i(n){var r=t[n];if(void 0!==r)return r.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,i),o.exports}(241);return i})());
|