@growthbook/edge-utils 0.2.6 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +4 -2
- package/dist/app.js.map +1 -1
- package/dist/attributes.js +1 -1
- package/dist/attributes.js.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/domMutations.js +1 -1
- package/dist/domMutations.js.map +1 -1
- package/dist/generated/sdkWrapper.d.ts +1 -1
- package/dist/generated/sdkWrapper.js +1 -1
- package/dist/generated/sdkWrapper.js.map +1 -1
- package/package.json +2 -2
- package/src/app.ts +4 -2
- package/src/attributes.ts +1 -1
- package/src/config.ts +1 -1
- package/src/domMutations.ts +1 -1
- package/src/generated/sdkWrapper.ts +1 -1
package/dist/app.js
CHANGED
|
@@ -231,7 +231,7 @@ next) {
|
|
|
231
231
|
};
|
|
232
232
|
let root;
|
|
233
233
|
if (context.config.alwaysParseDOM) {
|
|
234
|
-
root = (0, node_html_parser_1.parse)(body);
|
|
234
|
+
root = (0, node_html_parser_1.parse)(body, { comment: true });
|
|
235
235
|
}
|
|
236
236
|
// Body ready hook (pre-DOM-mutations):
|
|
237
237
|
const onBodyReadyParams = Object.assign(Object.assign({}, onOriginFetchParams), { originHeaders, resHeaders, body, setBody, root });
|
|
@@ -278,7 +278,9 @@ function getOriginUrl(context, currentURL, wasRedirected) {
|
|
|
278
278
|
const currentParsedURL = new URL(currentURL);
|
|
279
279
|
const proxyParsedURL = wasRedirected && ["edge", "everywhere"].includes(context.config.runCrossOriginUrlRedirectExperiments)
|
|
280
280
|
? new URL(currentURL)
|
|
281
|
-
:
|
|
281
|
+
: proxyTarget.startsWith("http://") || proxyTarget.startsWith("https://")
|
|
282
|
+
? new URL(proxyTarget)
|
|
283
|
+
: new URL(proxyTarget, currentURL);
|
|
282
284
|
const protocol = proxyParsedURL.protocol
|
|
283
285
|
? proxyParsedURL.protocol
|
|
284
286
|
: currentParsedURL.protocol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C;QAC7D,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;IACvB,CAAC;IACD,MAAM,IAAI,GAAG,gBAAgB,CAAC,QAAQ,EAAE,CAAC;IACzC,IAAI,gBAAgB,CAAC,MAAM,EAAE,CAAC;QAC5B,MAAM,IAAI,gBAAgB,CAAC,MAAM,CAAC;IACpC,CAAC;IACD,IAAI,gBAAgB,CAAC,IAAI,EAAE,CAAC;QAC1B,MAAM,IAAI,gBAAgB,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,eAAe,CAAC,OAAY;IACnC,IAAI,OAAO,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;QACrD,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,OAAO,IAAI,EAAE,CAAC;AACvB,CAAC"}
|
package/dist/attributes.js
CHANGED
|
@@ -84,7 +84,7 @@ function getUtmAttributes(urlObj) {
|
|
|
84
84
|
// Store utm- params in sessionStorage for future page loads
|
|
85
85
|
let utms = {};
|
|
86
86
|
// Add utm params from querystring
|
|
87
|
-
if (
|
|
87
|
+
if (urlObj.search) {
|
|
88
88
|
const params = new URLSearchParams(urlObj.search);
|
|
89
89
|
["source", "medium", "campaign", "term", "content"].forEach((k) => {
|
|
90
90
|
// Querystring is in snake_case
|
package/dist/attributes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attributes.js","sourceRoot":"","sources":["../src/attributes.ts"],"names":[],"mappings":";;AAIA,8CA0BC;AAKD,0BAuBC;AAKD,8CAyCC;AArGD,gFAAgF;AAChF,SAAgB,iBAAiB,CAC/B,GAAsB,EACtB,GAAQ,EACR,GAAW,EACX,aAAmD,EACnD,WAAoB,KAAK;IAEzB,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC;IAEhC,MAAM,kB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UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YAChE,+BAA+B;YAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,EAAE,CAAC;YACzB,+BAA+B;YAC/B,MAAM,IAAI,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAErD,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACtB,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YACvC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/config.js
CHANGED
|
@@ -56,7 +56,7 @@ exports.defaultContext = {
|
|
|
56
56
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
57
|
function getConfig(env) {
|
|
58
58
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
59
|
-
const config = exports.defaultContext.config;
|
|
59
|
+
const config = Object.assign({}, exports.defaultContext.config);
|
|
60
60
|
config.proxyTarget = (_a = env.PROXY_TARGET) !== null && _a !== void 0 ? _a : exports.defaultContext.config.proxyTarget;
|
|
61
61
|
config.forwardProxyHeaders = ["true", "1"].includes((_b = env.FORWARD_PROXY_HEADERS) !== null && _b !== void 0 ? _b : "" + exports.defaultContext.config.forwardProxyHeaders);
|
|
62
62
|
config.followRedirects = ["true", "1"].includes((_c = env.FOLLOW_REDIRECTS) !== null && _c !== void 0 ? _c : "" + exports.defaultContext.config.followRedirects);
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],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this, arguments, void 0, function* ({ body, setBody, root, nonce, domChanges, }) {
|
|
16
16
|
if (!domChanges.length)
|
|
17
17
|
return;
|
|
18
|
-
root = root !== null && root !== void 0 ? root : (0, node_html_parser_1.parse)(body);
|
|
18
|
+
root = root !== null && root !== void 0 ? root : (0, node_html_parser_1.parse)(body, { comment: true });
|
|
19
19
|
if (!root)
|
|
20
20
|
return;
|
|
21
21
|
const headEl = root.querySelector("head");
|
package/dist/domMutations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domMutations.js","sourceRoot":"","sources":["../src/domMutations.ts"],"names":[],"mappings":";;;;;;;;;;;AAGA,8CAqKC;AAvKD,uDAAsD;AAEtD,SAAsB,iBAAiB;yDAAC,EACtC,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,KAAK,EACL,UAAU,GAOX;QACC,IAAI,CAAC,UAAU,CAAC,MAAM;YAAE,OAAO;QAC/B,IAAI,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,IAAA,wBAAK,EAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"domMutations.js","sourceRoot":"","sources":["../src/domMutations.ts"],"names":[],"mappings":";;;;;;;;;;;AAGA,8CAqKC;AAvKD,uDAAsD;AAEtD,SAAsB,iBAAiB;yDAAC,EACtC,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,KAAK,EACL,UAAU,GAOX;QACC,IAAI,CAAC,UAAU,CAAC,MAAM;YAAE,OAAO;QAC/B,IAAI,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,IAAA,wBAAK,EAAC,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9C,IAAI,CAAC,IAAI;YAAE,OAAO;QAElB,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAE1C,UAAU,CAAC,OAAO,CAAC,CAAC,EAAE,YAAY,EAAE,GAAG,EAAE,E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AAY,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;gBAC7B,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;QAED,SAAS,QAAQ,CACf,QAAgB,EAChB,EAAmE;YAEnE,IAAI,CAAC,IAAI;gBAAE,OAAO;YAClB,MAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;YAC5C,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;gBACb,IAAI,CAAC,IAAI;oBAAE,OAAO;gBAClB,MAAM,EAAE,oBAAoB,EAAE,cAAc,EAAE,GAAG,EAAE,EAAE,CAAC;gBACtD,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;gBAClD,MAAM,YAAY,GAAG,oBAAoB;oBACvC,CAAC,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,CAAC,oBAAoB,CAAC;oBAC7C,CAAC,CAAC,IAAI,CAAC;gBACT,IAAI,MAAM,IAAI,YAAY,EAAE,CAAC;oBAC3B,YAAY,CAAC,kBAAkB,CAAC,aAAa,EAAE,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;oBAC9D,EAAE,CAAC,MAAM,EAAE,CAAC;gBACd,CAAC;qBAAM,IAAI,MAAM,EAAE,CAAC;oBAClB,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;gBACzB,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const sdkWrapper = "var _growthbook=function(){\"use strict\";function t(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}var e=function e(n,r){function i(e,i,s){if(\"undefined\"!=typeof document){\"number\"==typeof(s=t({},r,s)).expires&&(s.expires=new Date(Date.now()+864e5*s.expires)),s.expires&&(s.expires=s.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o=\"\";for(var u in s)s[u]&&(o+=\"; \"+u,!0!==s[u]&&(o+=\"=\"+s[u].split(\";\")[0]));return document.cookie=e+\"=\"+n.write(i,e)+o}}return Object.create({set:i,get:function(t){if(\"undefined\"!=typeof document&&(!arguments.length||t)){for(var e=document.cookie?document.cookie.split(\"; \"):[],r={},i=0;i<e.length;i++){var s=e[i].split(\"=\"),o=s.slice(1).join(\"=\");try{var u=decodeURIComponent(s[0]);if(r[u]=n.read(o,u),t===u)break}catch(t){}}return t?r[t]:r}},remove:function(e,n){i(e,\"\",t({},n,{expires:-1}))},withAttributes:function(n){return e(this.converter,t({},this.attributes,n))},withConverter:function(n){return e(t({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(n)}})}({read:function(t){return'\"'===t[0]&&(t=t.slice(1,-1)),t.replace(/(%[\\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:\"/\"}),n=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,r={revert:function(){}},i=new Map,s=new Set;function o(t){var e=i.get(t);return e||i.set(t,e={element:t,attributes:{}}),e}function u(t,e,n,r,i){var s=n(t),o={isDirty:!1,originalValue:s,virtualValue:s,mutations:[],el:t,t:null,observer:new MutationObserver((function(){if(\"position\"!==e||!o.t){\"position\"===e&&(o.t=setTimeout((function(){o.t=null}),1e3));var r=n(t);\"position\"===e&&r.parentNode===o.virtualValue.parentNode&&r.insertBeforeNode===o.virtualValue.insertBeforeNode||r!==o.virtualValue&&(o.originalValue=r,i(o))}})),mutationRunner:i,setValue:r,getCurrentValue:n};return\"position\"===e&&t.parentNode?o.observer.observe(t.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):o.observer.observe(t,function(t){return\"html\"===t?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[t]}}(e)),o}function c(t,e){var n=e.getCurrentValue(e.el);e.virtualValue=t,t&&\"string\"!=typeof t?n&&t.parentNode===n.parentNode&&t.insertBeforeNode===n.insertBeforeNode||(e.isDirty=!0,C()):t!==n&&(e.isDirty=!0,C())}function a(t){var e=t.originalValue;t.mutations.forEach((function(t){return e=t.mutate(e)})),c(function(t){return v||(v=document.createElement(\"div\")),v.innerHTML=t,v.innerHTML}(e),t)}function l(t){var e=new Set(t.originalValue.split(/\\s+/).filter(Boolean));t.mutations.forEach((function(t){return t.mutate(e)})),c(Array.from(e).filter(Boolean).join(\" \"),t)}function h(t){var e=t.originalValue;t.mutations.forEach((function(t){return e=t.mutate(e)})),c(e,t)}function f(t){var e=t.originalValue;t.mutations.forEach((function(t){var n=function(t){var e=t.insertBeforeSelector,n=document.querySelector(t.parentSelector);if(!n)return null;var r=e?document.querySelector(e):null;return e&&!r?null:{parentNode:n,insertBeforeNode:r}}(t.mutate());e=n||e})),c(e,t)}var d=function(t){return t.innerHTML},w=function(t,e){return t.innerHTML=e};function p(t){var e=o(t);return e.html||(e.html=u(t,\"html\",d,w,a)),e.html}var y=function(t){return{parentNode:t.parentElement,insertBeforeNode:t.nextElementSibling}},g=function(t,e){e.insertBeforeNode&&!e.parentNode.contains(e.insertBeforeNode)||e.parentNode.insertBefore(t,e.insertBeforeNode)};function m(t){var e=o(t);return e.position||(e.position=u(t,\"position\",y,g,f)),e.position}var v,b,k=function(t,e){return e?t.className=e:t.removeAttribute(\"class\")},S=function(t){return t.className};function A(t){var e=o(t);return e.classes||(e.classes=u(t,\"class\",S,k,l)),e.classes}function _(t,e){var n,r=o(t);return r.attributes[e]||(r.attributes[e]=u(t,e,(n=e,function(t){var e;return null!=(e=t.getAttribute(n))?e:null}),function(t){return function(e,n){return null!==n?e.setAttribute(t,n):e.removeAttribute(t)}}(e),h)),r.attributes[e]}function x(t,e,n){if(n.isDirty){n.isDirty=!1;var r=n.virtualValue;n.mutations.length||function(t,e){var n,r,s=i.get(t);if(s)if(\"html\"===e)null==(n=s.html)||null==(r=n.observer)||r.disconnect(),delete s.html;else if(\"class\"===e){var o,u;null==(o=s.classes)||null==(u=o.observer)||u.disconnect(),delete s.classes}else if(\"position\"===e){var c,a;null==(c=s.position)||null==(a=c.observer)||a.disconnect(),delete s.position}else{var l,h,f;null==(l=s.attributes)||null==(h=l[e])||null==(f=h.observer)||f.disconnect(),delete s.attributes[e]}}(t,e),n.setValue(t,r)}}function $(t,e){t.html&&x(e,\"html\",t.html),t.classes&&x(e,\"class\",t.classes),t.position&&x(e,\"position\",t.position),Object.keys(t.attributes).forEach((function(n){x(e,n,t.attributes[n])}))}function C(){i.forEach($)}function E(t){if(\"position\"!==t.kind||1!==t.elements.size){var e=new Set(t.elements);document.querySelectorAll(t.selector).forEach((function(n){e.has(n)||(t.elements.add(n),function(t,e){var n=null;\"html\"===t.kind?n=p(e):\"class\"===t.kind?n=A(e):\"attribute\"===t.kind?n=_(e,t.attribute):\"position\"===t.kind&&(n=m(e)),n&&(n.mutations.push(t),n.mutationRunner(n))}(t,n))}))}}function O(){s.forEach(E)}function T(t){return\"undefined\"==typeof document?r:(s.add(t),E(t),{revert:function(){var e;(e=t).elements.forEach((function(t){return function(t,e){var n=null;if(\"html\"===t.kind?n=p(e):\"class\"===t.kind?n=A(e):\"attribute\"===t.kind?n=_(e,t.attribute):\"position\"===t.kind&&(n=m(e)),n){var r=n.mutations.indexOf(t);-1!==r&&n.mutations.splice(r,1),n.mutationRunner(n)}}(e,t)})),e.elements.clear(),s.delete(e)}})}function N(t,e){return T({kind:\"html\",elements:new Set,mutate:e,selector:t})}function D(t,e){return T({kind:\"class\",elements:new Set,mutate:e,selector:t})}function F(t,e,i){return n.test(e)?\"class\"===e||\"className\"===e?D(t,(function(t){var e=i(Array.from(t).join(\" \"));t.clear(),e&&e.split(/\\s+/g).filter(Boolean).forEach((function(e){return t.add(e)}))})):T({kind:\"attribute\",attribute:e,elements:new Set,mutate:i,selector:t}):r}\"undefined\"!=typeof document&&(b||(b=new MutationObserver((function(){O()}))),O(),b.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}));const M={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function R(t){let e=2166136261;const n=t.length;for(let r=0;r<n;r++)e^=t.charCodeAt(r),e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24);return e>>>0}function B(t,e,n){return 2===n?R(R(t+e)+\"\")%1e4/1e4:1===n?R(e+t)%1e3/1e3:null}function I(t,e){return t>=e[0]&&t<e[1]}function U(t){try{const e=t.replace(/([^\\\\])\\//g,\"$1\\\\/\");return new RegExp(e)}catch(t){return void console.error(t)}}function V(t,e){if(!e.length)return!1;let n=!1,r=!1;for(let i=0;i<e.length;i++){const s=j(t,e[i].type,e[i].pattern);if(!1===e[i].include){if(s)return!1}else n=!0,s&&(r=!0)}return r||!n}function j(t,e,n){try{const r=new URL(t,\"https://_\");if(\"regex\"===e){const t=U(n);return!!t&&(t.test(r.href)||t.test(r.href.substring(r.origin.length)))}return\"simple\"===e&&function(t,e){try{const n=new URL(e.replace(/^([^:/?]*)\\./i,\"https://$1.\").replace(/\\*/g,\"_____\"),\"https://_____\"),r=[[t.host,n.host,!1],[t.pathname,n.pathname,!0]];return n.hash&&r.push([t.hash,n.hash,!1]),n.searchParams.forEach(((e,n)=>{r.push([t.searchParams.get(n)||\"\",e,!1])})),!r.some((t=>!function(t,e,n){try{let r=e.replace(/[*.+?^${}()|[\\]\\\\]/g,\"\\\\$&\").replace(/_____/g,\".*\");return n&&(r=\"\\\\/?\"+r.replace(/(^\\/|\\/$)/g,\"\")+\"\\\\/?\"),new RegExp(\"^\"+r+\"$\",\"i\").test(t)}catch(t){return!1}}(t[0],t[1],t[2])))}catch(t){return!1}}(r,n)}catch(t){return!1}}const J=t=>Uint8Array.from(atob(t),(t=>t.charCodeAt(0)));async function P(t,e,n){if(e=e||\"\",!(n=n||globalThis.crypto&&globalThis.crypto.subtle||M.SubtleCrypto))throw new Error(\"No SubtleCrypto implementation found\");try{const r=await n.importKey(\"raw\",J(e),{name:\"AES-CBC\",length:128},!0,[\"encrypt\",\"decrypt\"]),[i,s]=t.split(\".\"),o=await n.decrypt({name:\"AES-CBC\",iv:J(i)},r,J(s));return(new TextDecoder).decode(o)}catch(t){throw new Error(\"Failed to decrypt\")}}function L(t){return\"string\"==typeof t?t:JSON.stringify(t)}function K(t){\"number\"==typeof t&&(t+=\"\"),t&&\"string\"==typeof t||(t=\"0\");const e=t.replace(/(^v|\\+.*$)/g,\"\").split(/[-.]/);return 3===e.length&&e.push(\"~\"),e.map((t=>t.match(/^[0-9]+$/)?t.padStart(5,\" \"):t)).join(\"-\")}function H(){let t;try{t=\"1.6.1\"}catch(e){t=\"\"}return t}function q(t){return\"object\"==typeof t&&null!==t}function G(t){return t.urlPatterns&&t.variations.some((t=>q(t)&&\"urlRedirect\"in t))?\"redirect\":t.variations.some((t=>q(t)&&(t.domMutations||\"js\"in t||\"css\"in t)))?\"visual\":\"unknown\"}async function z(t,e){return new Promise((n=>{let r,i=!1;const s=t=>{i||(i=!0,r&&clearTimeout(r),n(t||null))};e&&(r=setTimeout((()=>s()),e)),t.then((t=>s(t))).catch((()=>s()))}))}const Z={staleTTL:6e4,maxAge:144e5,cacheKey:\"gbFeaturesCache\",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},Q=M,W={fetchFeaturesCall:t=>{let{host:e,clientKey:n,headers:r}=t;return Q.fetch(`${e}/api/features/${n}`,{headers:r})},fetchRemoteEvalCall:t=>{let{host:e,clientKey:n,payload:r,headers:i}=t;const s={method:\"POST\",headers:{\"Content-Type\":\"application/json\",...i},body:JSON.stringify(r)};return Q.fetch(`${e}/api/eval/${n}`,s)},eventSourceCall:t=>{let{host:e,clientKey:n,headers:r}=t;return r?new Q.EventSource(`${e}/sub/${n}`,{headers:r}):new Q.EventSource(`${e}/sub/${n}`)},startIdleListener:()=>{let t;if(\"undefined\"==typeof window||\"undefined\"==typeof document)return;const e=()=>{\"visible\"===document.visibilityState?(window.clearTimeout(t),nt.forEach((t=>{t&&\"idle\"===t.state&&wt(t)}))):\"hidden\"===document.visibilityState&&(t=window.setTimeout(it,Z.idleStreamInterval))};return document.addEventListener(\"visibilitychange\",e),()=>document.removeEventListener(\"visibilitychange\",e)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(Q.localStorage=globalThis.localStorage)}catch(t){}const X=new Map;let Y=!1;const tt=new Map,et=new Map,nt=new Map,rt=new Set;function it(){nt.forEach((t=>{t&&(t.state=\"idle\",dt(t))}))}async function st(){try{if(!Q.localStorage)return;await Q.localStorage.setItem(Z.cacheKey,JSON.stringify(Array.from(tt.entries())))}catch(t){}}function ot(t){const[e,n]=t.getApiInfo();return`${e}||${n}`}function ut(t){const e=ot(t);if(!(\"isRemoteEval\"in t)||!t.isRemoteEval())return e;const n=t.getAttributes(),r=t.getCacheKeyAttributes()||Object.keys(t.getAttributes()),i={};r.forEach((t=>{i[t]=n[t]}));const s=t.getForcedVariations(),o=t.getUrl();return`${e}||${JSON.stringify({ca:i,fv:s,url:o})}`}function ct(){const t=Array.from(tt.entries()).map((t=>{let[e,n]=t;return{key:e,staleAt:n.staleAt.getTime()}})).sort(((t,e)=>t.staleAt-e.staleAt)),e=Math.min(Math.max(0,tt.size-Z.maxEntries),tt.size);for(let n=0;n<e;n++)tt.delete(t[n].key)}function at(t,e,n){const r=n.dateUpdated||\"\",i=new Date(Date.now()+Z.staleTTL),s=Z.disableCache?void 0:tt.get(e);if(s&&r&&s.version===r)return s.staleAt=i,void st();Z.disableCache||(tt.set(e,{data:n,version:r,staleAt:i,sse:rt.has(t)}),ct()),st();const o=X.get(t);o&&o.forEach((t=>async function(t,e){await t.setPayload(e||t.getPayload())}(t,n)))}async function lt(t){const{apiHost:e,apiRequestHeaders:n}=t.getApiHosts(),r=t.getClientKey(),i=\"isRemoteEval\"in t&&t.isRemoteEval(),s=ot(t),o=ut(t);let u=et.get(o);return u||(u=(i?W.fetchRemoteEvalCall({host:e,clientKey:r,payload:{attributes:t.getAttributes(),forcedVariations:t.getForcedVariations(),forcedFeatures:Array.from(t.getForcedFeatures().entries()),url:t.getUrl()},headers:n}):W.fetchFeaturesCall({host:e,clientKey:r,headers:n})).then((t=>{if(!t.ok)throw new Error(`HTTP error: ${t.status}`);return\"enabled\"===t.headers.get(\"x-sse-support\")&&rt.add(s),t.json()})).then((e=>(at(s,o,e),ht(t),et.delete(o),{data:e,success:!0,source:\"network\"}))).catch((t=>(et.delete(o),{data:null,source:\"error\",success:!1,error:t}))),et.set(o,u)),u}function ht(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=ot(t),r=ut(t),{streamingHost:i,streamingHostRequestHeaders:s}=t.getApiHosts(),o=t.getClientKey();if(e&&rt.add(n),Z.backgroundSync&&rt.has(n)&&Q.EventSource){if(nt.has(n))return;const t={src:null,host:i,clientKey:o,headers:s,cb:e=>{try{if(\"features-updated\"===e.type){const t=X.get(n);t&&t.forEach((t=>{lt(t)}))}else if(\"features\"===e.type){const t=JSON.parse(e.data);at(n,r,t)}t.errors=0}catch(e){ft(t)}},errors:0,state:\"active\"};nt.set(n,t),wt(t)}}function ft(t){if(\"idle\"!==t.state&&(t.errors++,t.errors>3||t.src&&2===t.src.readyState)){const e=Math.pow(3,t.errors-3)*(1e3+1e3*Math.random());dt(t),setTimeout((()=>{[\"idle\",\"active\"].includes(t.state)||wt(t)}),Math.min(e,3e5))}}function dt(t){t.src&&(t.src.onopen=null,t.src.onerror=null,t.src.close(),t.src=null,\"active\"===t.state&&(t.state=\"disabled\"))}function wt(t){t.src=W.eventSourceCall({host:t.host,clientKey:t.clientKey,headers:t.headers}),t.state=\"active\",t.src.addEventListener(\"features\",t.cb),t.src.addEventListener(\"features-updated\",t.cb),t.src.onerror=()=>ft(t),t.src.onopen=()=>{t.errors=0}}function pt(t,e){dt(t),nt.delete(e)}function yt(t,e){if(e.streaming){if(!t.getClientKey())throw new Error(\"Must specify clientKey to enable streaming\");e.payload&&ht(t,!0),function(t){const e=ot(t),n=X.get(e)||new Set;n.add(t),X.set(e,n)}(t)}}const gt={};function mt(t,e,n){n=n||{};for(const[r,i]of Object.entries(e))switch(r){case\"$or\":if(!_t(t,i,n))return!1;break;case\"$nor\":if(_t(t,i,n))return!1;break;case\"$and\":if(!xt(t,i,n))return!1;break;case\"$not\":if(mt(t,i,n))return!1;break;default:if(!bt(i,vt(t,r),n))return!1}return!0}function vt(t,e){const n=e.split(\".\");let r=t;for(let t=0;t<n.length;t++){if(!r||\"object\"!=typeof r||!(n[t]in r))return null;r=r[n[t]]}return r}function bt(t,e,n){if(\"string\"==typeof t)return e+\"\"===t;if(\"number\"==typeof t)return 1*e===t;if(\"boolean\"==typeof t)return null!==e&&!!e===t;if(null===t)return null===e;if(Array.isArray(t)||!kt(t))return JSON.stringify(e)===JSON.stringify(t);for(const r in t)if(!At(r,e,t[r],n))return!1;return!0}function kt(t){const e=Object.keys(t);return e.length>0&&e.filter((t=>\"$\"===t[0])).length===e.length}function St(t,e){return Array.isArray(t)?t.some((t=>e.includes(t))):e.includes(t)}function At(t,e,n,r){switch(t){case\"$veq\":return K(e)===K(n);case\"$vne\":return K(e)!==K(n);case\"$vgt\":return K(e)>K(n);case\"$vgte\":return K(e)>=K(n);case\"$vlt\":return K(e)<K(n);case\"$vlte\":return K(e)<=K(n);case\"$eq\":return e===n;case\"$ne\":return e!==n;case\"$lt\":return e<n;case\"$lte\":return e<=n;case\"$gt\":return e>n;case\"$gte\":return e>=n;case\"$exists\":return n?null!=e:null==e;case\"$in\":return!!Array.isArray(n)&&St(e,n);case\"$inGroup\":return St(e,r[n]||[]);case\"$notInGroup\":return!St(e,r[n]||[]);case\"$nin\":return!!Array.isArray(n)&&!St(e,n);case\"$not\":return!bt(n,e,r);case\"$size\":return!!Array.isArray(e)&&bt(n,e.length,r);case\"$elemMatch\":return function(t,e,n){if(!Array.isArray(t))return!1;const r=kt(e)?t=>bt(e,t,n):t=>mt(t,e,n);for(let e=0;e<t.length;e++)if(t[e]&&r(t[e]))return!0;return!1}(e,n,r);case\"$all\":if(!Array.isArray(e))return!1;for(let t=0;t<n.length;t++){let i=!1;for(let s=0;s<e.length;s++)if(bt(n[t],e[s],r)){i=!0;break}if(!i)return!1}return!0;case\"$regex\":try{return(i=n,gt[i]||(gt[i]=new RegExp(i.replace(/([^\\\\])\\//g,\"$1\\\\/\"))),gt[i]).test(e)}catch(t){return!1}case\"$type\":return function(t){if(null===t)return\"null\";if(Array.isArray(t))return\"array\";const e=typeof t;return[\"string\",\"number\",\"boolean\",\"object\",\"undefined\"].includes(e)?e:\"unknown\"}(e)===n;default:return console.error(\"Unknown operator: \"+t),!1}var i}function _t(t,e,n){if(!e.length)return!0;for(let r=0;r<e.length;r++)if(mt(t,e[r],n))return!0;return!1}function xt(t,e,n){for(let r=0;r<e.length;r++)if(!mt(t,e[r],n))return!1;return!0}const $t=\"Feature Evaluated\",Ct=\"Experiment Viewed\";async function Et(t){try{await t()}catch(t){}}function Ot(t,e,n){if(t.user.trackedExperiments){const r=Pt(e,n);if(t.user.trackedExperiments.has(r))return[];t.user.trackedExperiments.add(r)}t.user.enableDevMode&&t.user.devLogs&&t.user.devLogs.push({experiment:e,result:n,timestamp:Date.now().toString(),logType:\"experiment\"});const r=[];if(t.global.trackingCallback){const i=t.global.trackingCallback;r.push(Et((()=>i(e,n,t.user))))}if(t.user.trackingCallback){const i=t.user.trackingCallback;r.push(Et((()=>i(e,n))))}if(t.global.eventLogger){const i=t.global.eventLogger;r.push(Et((()=>i(Ct,{experimentId:e.key,variationId:n.key,hashAttribute:n.hashAttribute,hashValue:n.hashValue},t.user))))}return r}function Tt(t,e){if(e.stack.evaluatedFeatures.has(t))return Dt(e,t,null,\"cyclicPrerequisite\");e.stack.evaluatedFeatures.add(t),e.stack.id=t;const n=function(t){const e=new Map;return t.global.forcedFeatureValues&&t.global.forcedFeatureValues.forEach(((t,n)=>e.set(n,t))),t.user.forcedFeatureValues&&t.user.forcedFeatureValues.forEach(((t,n)=>e.set(n,t))),e}(e);if(n.has(t))return Dt(e,t,n.get(t),\"override\");if(!e.global.features||!e.global.features[t])return Dt(e,t,null,\"unknownFeature\");const r=e.global.features[t];if(r.rules){const n=new Set(e.stack.evaluatedFeatures);t:for(const i of r.rules){if(i.parentConditions)for(const r of i.parentConditions){e.stack.evaluatedFeatures=new Set(n);const i=Tt(r.id,e);if(\"cyclicPrerequisite\"===i.source)return Dt(e,t,null,\"cyclicPrerequisite\");if(!mt({value:i.value},r.condition||{})){if(r.gate)return Dt(e,t,null,\"prerequisite\");continue t}}if(i.filters&&Rt(i.filters,e))continue;if(\"force\"in i){if(i.condition&&!Mt(i.condition,e))continue;if(!Bt(e,i.seed||t,i.hashAttribute,e.user.saveStickyBucketAssignmentDoc&&!i.disableStickyBucketing?i.fallbackAttribute:void 0,i.range,i.coverage,i.hashVersion))continue;return i.tracks&&i.tracks.forEach((t=>{!Ot(e,t.experiment,t.result).length&&e.global.saveDeferredTrack&&e.global.saveDeferredTrack({experiment:t.experiment,result:t.result})})),Dt(e,t,i.force,\"force\",i.id)}if(!i.variations)continue;const r={variations:i.variations,key:i.key||t};\"coverage\"in i&&(r.coverage=i.coverage),i.weights&&(r.weights=i.weights),i.hashAttribute&&(r.hashAttribute=i.hashAttribute),i.fallbackAttribute&&(r.fallbackAttribute=i.fallbackAttribute),i.disableStickyBucketing&&(r.disableStickyBucketing=i.disableStickyBucketing),void 0!==i.bucketVersion&&(r.bucketVersion=i.bucketVersion),void 0!==i.minBucketVersion&&(r.minBucketVersion=i.minBucketVersion),i.namespace&&(r.namespace=i.namespace),i.meta&&(r.meta=i.meta),i.ranges&&(r.ranges=i.ranges),i.name&&(r.name=i.name),i.phase&&(r.phase=i.phase),i.seed&&(r.seed=i.seed),i.hashVersion&&(r.hashVersion=i.hashVersion),i.filters&&(r.filters=i.filters),i.condition&&(r.condition=i.condition);const{result:s}=Nt(r,t,e);if(e.global.onExperimentEval&&e.global.onExperimentEval(r,s),s.inExperiment&&!s.passthrough)return Dt(e,t,s.value,\"experiment\",i.id,r,s)}}return Dt(e,t,void 0===r.defaultValue?null:r.defaultValue,\"defaultValue\")}function Nt(t,e,n){const r=t.key,i=t.variations.length;if(i<2)return{result:It(n,t,-1,!1,e)};if(!1===n.global.enabled||!1===n.user.enabled)return{result:It(n,t,-1,!1,e)};if(t=function(t,e){const n=t.key,r=e.global.overrides;return r&&r[n]&&\"string\"==typeof(t=Object.assign({},t,r[n])).url&&(t.url=U(t.url)),t}(t,n),t.urlPatterns&&!V(n.user.url||\"\",t.urlPatterns))return{result:It(n,t,-1,!1,e)};const s=function(t,e,n){if(!e)return null;const r=e.split(\"?\")[1];if(!r)return null;const i=r.replace(/#.*/,\"\").split(\"&\").map((t=>t.split(\"=\",2))).filter((e=>{let[n]=e;return n===t})).map((t=>{let[,e]=t;return parseInt(e)}));return i.length>0&&i[0]>=0&&i[0]<n?i[0]:null}(r,n.user.url||\"\",i);if(null!==s)return{result:It(n,t,s,!1,e)};const o=function(t){return t.global.forcedVariations&&t.user.forcedVariations?{...t.global.forcedVariations,...t.user.forcedVariations}:t.global.forcedVariations?t.global.forcedVariations:t.user.forcedVariations?t.user.forcedVariations:{}}(n);if(r in o)return{result:It(n,t,o[r],!1,e)};if(\"draft\"===t.status||!1===t.active)return{result:It(n,t,-1,!1,e)};const{hashAttribute:u,hashValue:c}=Ut(n,t.hashAttribute,n.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing?t.fallbackAttribute:void 0);if(!c)return{result:It(n,t,-1,!1,e)};let a=-1,l=!1,h=!1;if(n.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing){const{variation:e,versionIsBlocked:r}=function(t){let{ctx:e,expKey:n,expBucketVersion:r,expHashAttribute:i,expFallbackAttribute:s,expMinBucketVersion:o,expMeta:u}=t;r=r||0,o=o||0,i=i||\"id\",u=u||[];const c=Vt(n,r),a=function(t,e,n){if(!t.user.stickyBucketAssignmentDocs)return{};const{hashAttribute:r,hashValue:i}=Ut(t,e),s=jt(r,L(i)),{hashAttribute:o,hashValue:u}=Ut(t,n),c=u?jt(o,L(u)):null,a={};return c&&t.user.stickyBucketAssignmentDocs[c]&&Object.assign(a,t.user.stickyBucketAssignmentDocs[c].assignments||{}),t.user.stickyBucketAssignmentDocs[s]&&Object.assign(a,t.user.stickyBucketAssignmentDocs[s].assignments||{}),a}(e,i,s);if(o>0)for(let t=0;t<=o;t++)if(void 0!==a[Vt(n,t)])return{variation:-1,versionIsBlocked:!0};const l=a[c];if(void 0===l)return{variation:-1};const h=u.findIndex((t=>t.key===l));return h<0?{variation:-1}:{variation:h}}({ctx:n,expKey:t.key,expBucketVersion:t.bucketVersion,expHashAttribute:t.hashAttribute,expFallbackAttribute:t.fallbackAttribute,expMinBucketVersion:t.minBucketVersion,expMeta:t.meta});l=e>=0,a=e,h=!!r}if(!l){if(t.filters){if(Rt(t.filters,n))return{result:It(n,t,-1,!1,e)}}else if(t.namespace&&!function(t,e){const n=B(\"__\"+e[0],t,1);return null!==n&&n>=e[1]&&n<e[2]}(c,t.namespace))return{result:It(n,t,-1,!1,e)};if(t.include&&!function(t){try{return t()}catch(t){return console.error(t),!1}}(t.include))return{result:It(n,t,-1,!1,e)};if(t.condition&&!Mt(t.condition,n))return{result:It(n,t,-1,!1,e)};if(t.parentConditions){const r=new Set(n.stack.evaluatedFeatures);for(const i of t.parentConditions){n.stack.evaluatedFeatures=new Set(r);const s=Tt(i.id,n);if(\"cyclicPrerequisite\"===s.source)return{result:It(n,t,-1,!1,e)};if(!mt({value:s.value},i.condition||{}))return{result:It(n,t,-1,!1,e)}}}if(t.groups&&!function(t,e){const n=e.global.groups||{};for(let e=0;e<t.length;e++)if(n[t[e]])return!0;return!1}(t.groups,n))return{result:It(n,t,-1,!1,e)}}if(t.url&&!function(t,e){const n=e.user.url;if(!n)return!1;const r=n.replace(/^https?:\\/\\//,\"\").replace(/^[^/]*\\//,\"/\");return!!t.test(n)||!!t.test(r)}(t.url,n))return{result:It(n,t,-1,!1,e)};const f=B(t.seed||r,c,t.hashVersion||1);if(null===f)return{result:It(n,t,-1,!1,e)};if(l||(a=function(t,e){for(let n=0;n<e.length;n++)if(I(t,e[n]))return n;return-1}(f,t.ranges||function(t,e,n){(e=void 0===e?1:e)<0?e=0:e>1&&(e=1);const r=(i=t)<=0?[]:new Array(i).fill(1/i);var i;(n=n||r).length!==t&&(n=r);const s=n.reduce(((t,e)=>e+t),0);(s<.99||s>1.01)&&(n=r);let o=0;return n.map((t=>{const n=o;return o+=t,[n,n+e*t]}))}(i,void 0===t.coverage?1:t.coverage,t.weights))),h)return{result:It(n,t,-1,!1,e,void 0,!0)};if(a<0)return{result:It(n,t,-1,!1,e)};if(\"force\"in t)return{result:It(n,t,void 0===t.force?-1:t.force,!1,e)};if(n.global.qaMode||n.user.qaMode)return{result:It(n,t,-1,!1,e)};if(\"stopped\"===t.status)return{result:It(n,t,-1,!1,e)};const d=It(n,t,a,!0,e,f,l);if(n.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing){const{changed:e,key:r,doc:i}=function(t,e,n,r){const i=jt(e,n),s=t.user.stickyBucketAssignmentDocs&&t.user.stickyBucketAssignmentDocs[i]&&t.user.stickyBucketAssignmentDocs[i].assignments||{},o={...s,...r};return{key:i,doc:{attributeName:e,attributeValue:n,assignments:o},changed:JSON.stringify(s)!==JSON.stringify(o)}}(n,u,L(c),{[Vt(t.key,t.bucketVersion)]:d.key});e&&(n.user.stickyBucketAssignmentDocs=n.user.stickyBucketAssignmentDocs||{},n.user.stickyBucketAssignmentDocs[r]=i,n.user.saveStickyBucketAssignmentDoc(i))}const w=Ot(n,t,d);0===w.length&&n.global.saveDeferredTrack&&n.global.saveDeferredTrack({experiment:t,result:d});const p=w.length?1===w.length?w[0]:Promise.all(w).then((()=>{})):void 0;return\"changeId\"in t&&t.changeId&&n.global.recordChangeId&&n.global.recordChangeId(t.changeId),{result:d,trackingCall:p}}function Dt(t,e,n,r,i,s,o){const u={value:n,on:!!n,off:!n,source:r,ruleId:i||\"\"};return s&&(u.experiment=s),o&&(u.experimentResult=o),\"override\"!==r&&function(t,e,n){if(t.user.trackedFeatureUsage){const r=JSON.stringify(n.value);if(t.user.trackedFeatureUsage[e]===r)return;t.user.trackedFeatureUsage[e]=r,t.user.enableDevMode&&t.user.devLogs&&t.user.devLogs.push({featureKey:e,result:n,timestamp:Date.now().toString(),logType:\"feature\"})}if(t.global.onFeatureUsage){const r=t.global.onFeatureUsage;Et((()=>r(e,n,t.user)))}if(t.user.onFeatureUsage){const r=t.user.onFeatureUsage;Et((()=>r(e,n)))}if(t.global.eventLogger){const r=t.global.eventLogger;Et((()=>r($t,{feature:e,source:n.source,value:n.value,ruleId:\"defaultValue\"===n.source?\"$default\":n.ruleId||\"\",variationId:n.experimentResult?n.experimentResult.key:\"\"},t.user)))}}(t,e,u),u}function Ft(t){return{...t.user.attributes,...t.user.attributeOverrides}}function Mt(t,e){return mt(Ft(e),t,e.global.savedGroups||{})}function Rt(t,e){return t.some((t=>{const{hashValue:n}=Ut(e,t.attribute);if(!n)return!0;const r=B(t.seed,n,t.hashVersion||2);return null===r||!t.ranges.some((t=>I(r,t)))}))}function Bt(t,e,n,r,i,s,o){if(!i&&void 0===s)return!0;if(!i&&0===s)return!1;const{hashValue:u}=Ut(t,n,r);if(!u)return!1;const c=B(e,u,o||1);return null!==c&&(i?I(c,i):void 0===s||c<=s)}function It(t,e,n,r,i,s,o){let u=!0;(n<0||n>=e.variations.length)&&(n=0,u=!1);const{hashAttribute:c,hashValue:a}=Ut(t,e.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0),l=e.meta?e.meta[n]:{},h={key:l.key||\"\"+n,featureId:i,inExperiment:u,hashUsed:r,variationId:n,value:e.variations[n],hashAttribute:c,hashValue:a,stickyBucketUsed:!!o};return l.name&&(h.name=l.name),void 0!==s&&(h.bucket=s),l.passthrough&&(h.passthrough=l.passthrough),h}function Ut(t,e,n){let r=e||\"id\",i=\"\";const s=Ft(t);return s[r]&&(i=s[r]),!i&&n&&(s[n]&&(i=s[n]),i&&(r=n)),{hashAttribute:r,hashValue:i}}function Vt(t,e){return`${t}__${e=e||0}`}function jt(t,e){return`${t}||${e}`}function Jt(t,e){const n={},r=function(t,e){const n=new Set,r=e&&e.features?e.features:t.global.features||{},i=e&&e.experiments?e.experiments:t.global.experiments||[];return Object.keys(r).forEach((t=>{const e=r[t];if(e.rules)for(const t of e.rules)t.variations&&(n.add(t.hashAttribute||\"id\"),t.fallbackAttribute&&n.add(t.fallbackAttribute))})),i.map((t=>{n.add(t.hashAttribute||\"id\"),t.fallbackAttribute&&n.add(t.fallbackAttribute)})),Array.from(n)}(t,e);return r.forEach((e=>{const{hashValue:r}=Ut(t,e);n[e]=L(r)})),n}function Pt(t,e){return e.hashAttribute+e.hashValue+t.key+e.variationId}const Lt=\"undefined\"!=typeof window&&\"undefined\"!=typeof document,Kt=H();class Ht{constructor(t){this.prefix=(t=t||{}).prefix||\"\"}async getAllAssignments(t){const e={};return(await Promise.all(Object.entries(t).map((t=>{let[e,n]=t;return this.getAssignments(e,n)})))).forEach((t=>{if(t){const n=jt(t.attributeName,t.attributeValue);e[n]=t}})),e}getKey(t,e){return`${this.prefix}${t}||${e}`}}class qt extends Ht{async getAssignments(t,e){return this.getAssignmentsSync(t,e)}async saveAssignments(t){this.saveAssignmentsSync(t)}getAllAssignmentsSync(t){const e={};return Object.entries(t).map((t=>{let[e,n]=t;return this.getAssignmentsSync(e,n)})).forEach((t=>{if(t){const n=jt(t.attributeName,t.attributeValue);e[n]=t}})),e}}function Gt(t){return{browser:t.match(/Edg/)?\"edge\":t.match(/Chrome/)?\"chrome\":t.match(/Firefox/)?\"firefox\":t.match(/Safari/)?\"safari\":\"unknown\",deviceType:t.match(/Mobi/)?\"mobile\":\"desktop\"}}function zt(t){return t?{url:t.href,path:t.pathname,host:t.host,query:t.search}:{}}function Zt(t,e){const n=new Date;n.setTime(n.getTime()+3456e7),document.cookie=t+\"=\"+e+\";path=/;expires=\"+n.toUTCString()}function Qt(t){const e=(\"; \"+document.cookie).split(`; ${t}=`);return 2===e.length?e[1].split(\";\")[0]:\"\"}function Wt(t){return t&&t.randomUUID?t.randomUUID():\"10000000-1000-4000-8000-100000000000\".replace(/[018]/g,(e=>(e^(t&&t.getRandomValues?t.getRandomValues(new Uint8Array(1))[0]:Math.floor(256*Math.random()))&15>>e/4).toString(16)))}function Xt(t){let e={};try{const t=sessionStorage.getItem(\"utm_params\");t&&(e=JSON.parse(t))}catch(t){}if(t&&t.search){const n=new URLSearchParams(t.search);let r=!1;if([\"source\",\"medium\",\"campaign\",\"term\",\"content\"].forEach((t=>{const i=`utm_${t}`,s=\"utm\"+t[0].toUpperCase()+t.slice(1);n.has(i)&&(e[s]=n.get(i)||\"\",r=!0)})),r)try{sessionStorage.setItem(\"utm_params\",JSON.stringify(e))}catch(t){}}return e}function Yt(){if(\"undefined\"==typeof window||!window.dataLayer||!window.dataLayer.forEach)return{};const t={};return window.dataLayer.forEach((e=>{e&&\"object\"==typeof e&&!(\"length\"in e)&&(\"event\"in e||Object.keys(e).forEach((n=>{if(\"string\"!=typeof n||n.match(/^(gtm)/))return;const r=e[n];[\"string\",\"number\",\"boolean\"].includes(typeof r)&&(t[n]=r)})))})),t}const te=H();function ee(t){return\"string\"==typeof t?t:null}function ne(t){let{eventName:e,properties:n,attributes:r,url:i}=t;const{nested:s,topLevel:o}=function(t){const{user_id:e,device_id:n,anonymous_id:r,id:i,page_id:s,session_id:o,utmCampaign:u,utmContent:c,utmMedium:a,utmSource:l,utmTerm:h,pageTitle:f,...d}=t;return{nested:d,topLevel:{user_id:ee(e),device_id:ee(n||r||i),page_id:ee(s),session_id:ee(o),utm_campaign:ee(u)||void 0,utm_content:ee(c)||void 0,utm_medium:ee(a)||void 0,utm_source:ee(l)||void 0,utm_term:ee(h)||void 0,page_title:ee(f)||void 0}}}(r||{});return{event_name:e,properties_json:n||{},...o,sdk_language:\"js\",sdk_version:te,url:i,context_json:s}}async function re(t){let{clientKey:e,ingestorHost:n,events:r}=t;if(!r.length)return;const i=`${n||\"https://us1.gb-ingest.com\"}/track?client_key=${e}`,s=JSON.stringify(r);try{await fetch(i,{method:\"POST\",body:s,headers:{Accept:\"application/json\",\"Content-Type\":\"text/plain\"},credentials:\"omit\"})}catch(t){console.error(\"Failed to track event\",t)}}window.dataLayer=window.dataLayer||[];const ie=document.currentScript,se=ie?ie.dataset:{},oe=window.growthbook_config||{};let ue,ce;function ae(){window.clearTimeout(ue);let t=oe.antiFlickerTimeout??(se.antiFlickerTimeout?parseInt(se.antiFlickerTimeout):null)??3500;isFinite(t)||(t=3500);try{if(!document.getElementById(\"gb-anti-flicker-style\")){const t=document.createElement(\"style\");t.setAttribute(\"id\",\"gb-anti-flicker-style\"),t.innerHTML=\".gb-anti-flicker { opacity: 0 !important; pointer-events: none; }\",document.head.appendChild(t)}document.documentElement.classList.add(\"gb-anti-flicker\"),ue=window.setTimeout(le,t)}catch(t){console.error(t)}}function le(){window.clearTimeout(ue);try{document.documentElement.classList.remove(\"gb-anti-flicker\")}catch(t){console.error(t)}}(oe.antiFlicker||se.antiFlicker)&&ae(),\"cookie\"===oe.useStickyBucketService||\"cookie\"===se.useStickyBucketService?ce=new class extends qt{constructor(t){let{prefix:e=\"gbStickyBuckets__\",jsCookie:n,cookieAttributes:r={expires:180}}=t;super(),this.prefix=e,this.jsCookie=n,this.cookieAttributes=r}getAssignmentsSync(t,e){const n=this.getKey(t,e);let r=null;if(!this.jsCookie)return r;try{const t=this.jsCookie.get(n),e=JSON.parse(t||\"{}\");e.attributeName&&e.attributeValue&&e.assignments&&(r=e)}catch(t){}return r}async saveAssignmentsSync(t){const e=this.getKey(t.attributeName,t.attributeValue);if(!this.jsCookie)return;const n=JSON.stringify(t);this.jsCookie.set(e,n,this.cookieAttributes)}}({prefix:oe.stickyBucketPrefix||se.stickyBucketPrefix||void 0,jsCookie:e}):\"localStorage\"!==oe.useStickyBucketService&&\"localStorage\"!==se.useStickyBucketService||(ce=new class extends Ht{constructor(t){t=t||{},super(),this.prefix=t.prefix||\"gbStickyBuckets__\";try{this.localStorage=t.localStorage||globalThis.localStorage}catch(t){}}async getAssignments(t,e){const n=this.getKey(t,e);let r=null;if(!this.localStorage)return r;try{const t=await this.localStorage.getItem(n)||\"{}\",e=JSON.parse(t);e.attributeName&&e.attributeValue&&e.assignments&&(r=e)}catch(t){}return r}async saveAssignments(t){const e=this.getKey(t.attributeName,t.attributeValue);if(this.localStorage)try{await this.localStorage.setItem(e,JSON.stringify(t))}catch(t){}}}({prefix:oe.stickyBucketPrefix||se.stickyBucketPrefix||void 0}));const he=se.uuid||oe.uuid,fe=[function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(\"undefined\"==typeof window)throw new Error(\"autoAttributesPlugin only works in the browser\");const e=t.uuidCookieName||\"gbuuid\",n=t.uuidKey||\"id\";let r=t.uuid||\"\";function i(){Zt(e,r)}function s(){return r||(r=Qt(e),r||(r=Wt(window.crypto),r))}function o(t){const e=navigator.userAgent,r=s();(t.uuidAutoPersist??!t.uuid)&&i();const o=location;return{...Yt(),[n]:r,...zt(o),pageTitle:document.title,...Gt(e),...Xt(o)}}return document.addEventListener(\"growthbookpersist\",(()=>{i()})),e=>{if(\"createScopedInstance\"in e)return;const n=o(t);n.url&&e.setURL(n.url),e.updateAttributes(n);let r=n.url;const i=setInterval((()=>{location.href!==r&&(r=location.href,e.setURL(r),e.updateAttributes(o(t)))}),500),s=()=>{location.href!==r&&(r=location.href,e.setURL(r)),e.updateAttributes(o(t))};document.addEventListener(\"growthbookrefresh\",s),\"onDestroy\"in e&&e.onDestroy((()=>{clearInterval(i),document.removeEventListener(\"growthbookrefresh\",s)}))}}({uuid:he,uuidCookieName:oe.uuidCookieName||se.uuidCookieName,uuidKey:oe.uuidKey||se.uuidKey,uuidAutoPersist:!he&&null==se.noAutoCookies})],de=se.tracking||\"gtag,gtm,segment\";if(\"none\"!==de){const t=de.toLowerCase().split(\",\").map((t=>t.trim()));t.includes(\"growthbook\")&&fe.push(function(){let{queueFlushInterval:t=100,ingestorHost:e,enable:n=!0,debug:r,dedupeCacheSize:i=1e3,dedupeKeyAttributes:s=[],eventFilter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return u=>{const c=u.getClientKey();if(!c)throw new Error(\"clientKey must be specified to use event logging\");const a=new Set;if(\"setEventLogger\"in u){let l=[],h=null;const f=async()=>{const t=l;l=[],h&&clearTimeout(h),h=null,t.length&&await re({clientKey:c,events:t,ingestorHost:e})};let d=null;u.setEventLogger((async(e,u,c)=>{const w={eventName:e,properties:u,attributes:c.attributes||{},url:c.url||\"\"};if(o&&!o(w))return;if(e===$t||e===Ct){const t={eventName:e,properties:u};for(const e of s)t[\"attr:\"+e]=w.attributes[e];const n=JSON.stringify(t);if(a.has(n))return a.delete(n),void a.add(n);if(a.add(n),a.size>i){const t=a.values().next().value;t&&a.delete(t)}}const p=ne(w);r&&console.log(\"Logging event to GrowthBook\",JSON.parse(JSON.stringify(p))),n&&(l.push(p),d||(d=new Promise(((e,n)=>{h=setTimeout((()=>{f().then(e).catch(n),d=null}),t)}))),await d)})),\"undefined\"!=typeof document&&document.visibilityState&&document.addEventListener(\"visibilitychange\",(()=>{\"hidden\"===document.visibilityState&&f().catch(console.error)})),\"onDestroy\"in u&&u.onDestroy((()=>{f().catch(console.error)}))}if(\"undefined\"!=typeof window&&!(\"createScopedInstance\"in u)){const t=Array.isArray(window.gbEvents)?window.gbEvents:[];window.gbEvents={push:t=>{\"isDestroyed\"in u&&u.isDestroyed()?window.gbEvents=[t]:\"string\"==typeof t?u.logEvent(t):t&&u.logEvent(t.eventName,t.properties)}};for(const e of t)window.gbEvents.push(e)}}}({ingestorHost:se.eventIngestorHost})),oe.trackingCallback||fe.push(function(){let{additionalCallback:t,trackers:e=[\"gtag\",\"gtm\",\"segment\"]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(\"undefined\"==typeof window)throw new Error(\"thirdPartyTrackingPlugin only works in the browser\");return n=>{n.setTrackingCallback((async(n,r)=>{const i=[],s={experiment_id:n.key,variation_id:r.key};if(t&&i.push(Promise.resolve(t(n,r))),e.includes(\"gtag\")&&window.gtag){let t;const e=new Promise((e=>{t=e}));i.push(e),window.gtag(\"event\",\"experiment_viewed\",{...s,event_callback:t})}if(e.includes(\"gtm\")&&window.dataLayer){let t;const e=new Promise((e=>{t=e}));i.push(e),window.dataLayer.push({event:\"experiment_viewed\",...s,eventCallback:t})}if(e.includes(\"segment\")&&window.analytics&&window.analytics.track){window.analytics.track(\"Experiment Viewed\",s);const t=new Promise((t=>window.setTimeout(t,300)));i.push(t)}await Promise.all(i)}))}}({additionalCallback:oe.additionalTrackingCallback,trackers:t}))}const we=new class{constructor(t){if(t=t||{},this.version=Kt,this.i=this.context=t,this.o=t.renderer||null,this.u=new Set,this.l=new Set,this.h={},this.debug=!!t.debug,this.p=new Set,this.ready=!1,this.g=new Map,this.m=new Map,this.v=new Set,this.k=!1,this.S=\"\",this.A=new Map,this._=!t.disableExperimentsOnLoad,this.$=[],this.logs=[],this.log=this.log.bind(this),this.C=this.C.bind(this),this.O=this.O.bind(this),this.T=this.T.bind(this),t.remoteEval){if(t.decryptionKey)throw new Error(\"Encryption is not available for remoteEval\");if(!t.clientKey)throw new Error(\"Missing clientKey\");let e=!1;try{e=!!new URL(t.apiHost||\"\").hostname.match(/growthbook\\.io$/i)}catch(t){}if(e)throw new Error(\"Cannot use remoteEval on GrowthBook Cloud\")}else if(t.cacheKeyAttributes)throw new Error(\"cacheKeyAttributes are only used for remoteEval\");if(t.stickyBucketService){const e=t.stickyBucketService;this.N=t=>e.saveAssignments(t)}if(t.plugins)for(const e of t.plugins)e(this);if(t.features&&(this.ready=!0),Lt&&t.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event(\"gbloaded\"))),t.experiments&&(this.ready=!0,this.D()),this.i.stickyBucketService&&this.i.stickyBucketAssignmentDocs)for(const t in this.i.stickyBucketAssignmentDocs){const e=this.i.stickyBucketAssignmentDocs[t];e&&this.i.stickyBucketService.saveAssignments(e).catch((()=>{}))}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(t){this.F=t;const e=await async function(t,e,n){if((t={...t}).encryptedFeatures){try{t.features=JSON.parse(await P(t.encryptedFeatures,e,n))}catch(t){console.error(t)}delete t.encryptedFeatures}if(t.encryptedExperiments){try{t.experiments=JSON.parse(await P(t.encryptedExperiments,e,n))}catch(t){console.error(t)}delete t.encryptedExperiments}if(t.encryptedSavedGroups){try{t.savedGroups=JSON.parse(await P(t.encryptedSavedGroups,e,n))}catch(t){console.error(t)}delete t.encryptedSavedGroups}return t}(t,this.i.decryptionKey);this.M=e,await this.refreshStickyBuckets(e),e.features&&(this.i.features=e.features),e.savedGroups&&(this.i.savedGroups=e.savedGroups),e.experiments&&(this.i.experiments=e.experiments,this.D()),this.ready=!0,this.R()}initSync(t){this.k=!0;const e=t.payload;if(e.encryptedExperiments||e.encryptedFeatures)throw new Error(\"initSync does not support encrypted payloads\");return this.i.stickyBucketService&&!this.i.stickyBucketAssignmentDocs&&(this.i.stickyBucketAssignmentDocs=this.generateStickyBucketAssignmentDocsSync(this.i.stickyBucketService,e)),this.F=e,this.M=e,e.features&&(this.i.features=e.features),e.experiments&&(this.i.experiments=e.experiments,this.D()),this.ready=!0,yt(this,t),this}async init(t){if(this.k=!0,(t=t||{}).cacheSettings&&(Object.assign(Z,t.cacheSettings),Z.backgroundSync||(rt.clear(),nt.forEach(pt),X.clear(),W.stopIdleListener())),t.payload)return await this.setPayload(t.payload),yt(this,t),{success:!0,source:\"init\"};{const{data:e,...n}=await this.B({...t,allowStale:!0});return yt(this,t),await this.setPayload(e||{}),n}}async loadFeatures(t){t=t||{},await this.init({skipCache:t.skipCache,timeout:t.timeout,streaming:(this.i.backgroundSync??!0)&&(t.autoRefresh||this.i.subscribeToChanges)})}async refreshFeatures(t){const e=await this.B({...t||{},allowStale:!1});e.data&&await this.setPayload(e.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return function(t){const e=t.apiHost||\"https://cdn.growthbook.io\";return{apiHost:e.replace(/\\/*$/,\"\"),streamingHost:(t.streamingHost||e).replace(/\\/*$/,\"\"),apiRequestHeaders:t.apiHostRequestHeaders,streamingHostRequestHeaders:t.streamingHostRequestHeaders}}(this.i)}getClientKey(){return this.i.clientKey||\"\"}getPayload(){return this.F||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this.M||this.getPayload()}isRemoteEval(){return this.i.remoteEval||!1}getCacheKeyAttributes(){return this.i.cacheKeyAttributes}async B(t){let{timeout:e,skipCache:n,allowStale:r,streaming:i}=t;if(!this.i.clientKey)throw new Error(\"Missing clientKey\");return async function(t){let{instance:e,timeout:n,skipCache:r,allowStale:i,backgroundSync:s}=t;return s||(Z.backgroundSync=!1),async function(t){let{instance:e,allowStale:n,timeout:r,skipCache:i}=t;const s=ot(e),o=ut(e),u=new Date,c=new Date(u.getTime()-Z.maxAge+Z.staleTTL);await async function(){if(!Y){Y=!0;try{if(Q.localStorage){const t=await Q.localStorage.getItem(Z.cacheKey);if(!Z.disableCache&&t){const e=JSON.parse(t);e&&Array.isArray(e)&&e.forEach((t=>{let[e,n]=t;tt.set(e,{...n,staleAt:new Date(n.staleAt)})})),ct()}}}catch(t){}if(!Z.disableIdleStreams){const t=W.startIdleListener();t&&(W.stopIdleListener=t)}}}();const a=Z.disableCache||i?void 0:tt.get(o);return a&&(n||a.staleAt>u)&&a.staleAt>c?(a.sse&&rt.add(s),a.staleAt<u?lt(e):ht(e),{data:a.data,success:!0,source:\"cache\"}):await z(lt(e),r)||{data:null,success:!1,source:\"timeout\",error:new Error(\"Timeout\")}}({instance:e,allowStale:i,timeout:n,skipCache:r})}({instance:this,timeout:e,skipCache:n||this.i.disableCache,allowStale:r,backgroundSync:i??this.i.backgroundSync??!0})}R(){if(this.o)try{this.o()}catch(t){console.error(\"Failed to render\",t)}}setFeatures(t){this.i.features=t,this.ready=!0,this.R()}async setEncryptedFeatures(t,e,n){const r=await P(t,e||this.i.decryptionKey,n);this.setFeatures(JSON.parse(r))}setExperiments(t){this.i.experiments=t,this.ready=!0,this.D()}async setEncryptedExperiments(t,e,n){const r=await P(t,e||this.i.decryptionKey,n);this.setExperiments(JSON.parse(r))}async setAttributes(t){this.i.attributes=t,this.i.stickyBucketService&&await this.refreshStickyBuckets(),this.i.remoteEval?await this.I():(this.R(),this.D())}async updateAttributes(t){return this.setAttributes({...this.i.attributes,...t})}async setAttributeOverrides(t){this.i.attributeOverrides=t,this.i.stickyBucketService&&await this.refreshStickyBuckets(),this.i.remoteEval?await this.I():(this.R(),this.D())}async setForcedVariations(t){this.i.forcedVariations=t||{},this.i.remoteEval?await this.I():(this.R(),this.D())}setForcedFeatures(t){this.i.forcedFeatureValues=t,this.R()}async setURL(t){if(t!==this.i.url){if(this.i.url=t,this.S=\"\",this.i.remoteEval)return await this.I(),void this.D(!0);this.D(!0)}}getAttributes(){return{...this.i.attributes,...this.i.attributeOverrides}}getForcedVariations(){return this.i.forcedVariations||{}}getForcedFeatures(){return this.i.forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this.i.stickyBucketAssignmentDocs||{}}getUrl(){return this.i.url||\"\"}getFeatures(){return this.i.features||{}}getExperiments(){return this.i.experiments||[]}getCompletedChangeIds(){return Array.from(this.l)}subscribe(t){return this.p.add(t),()=>{this.p.delete(t)}}async I(){if(!this.i.remoteEval)return;if(!this.k)return;const t=await this.B({allowStale:!1});t.data&&await this.setPayload(t.data)}getAllResults(){return new Map(this.g)}onDestroy(t){this.$.push(t)}isDestroyed(){return!!this.U}destroy(){var t;this.U=!0,this.$.forEach((t=>{try{t()}catch(t){console.error(t)}})),this.p.clear(),this.g.clear(),this.u.clear(),this.l.clear(),this.A.clear(),this.h={},this.$=[],this.F=void 0,this.N=void 0,t=this,X.forEach((e=>e.delete(t))),this.logs=[],Lt&&window._growthbook===this&&delete window._growthbook,this.m.forEach((t=>{t.undo()})),this.m.clear(),this.v.clear()}setRenderer(t){this.o=t}forceVariation(t,e){this.i.forcedVariations=this.i.forcedVariations||{},this.i.forcedVariations[t]=e,this.i.remoteEval?this.I():(this.D(),this.R())}run(t){const{result:e}=Nt(t,null,this.V());return this.O(t,e),e}triggerExperiment(t){return this.v.add(t),this.i.experiments?this.i.experiments.filter((e=>e.key===t)).map((t=>this.j(t))).filter((t=>null!==t)):null}triggerAutoExperiments(){this._=!0,this.D(!0)}V(){return{user:this.J(),global:this.P(),stack:{evaluatedFeatures:new Set}}}J(){return{attributes:this.i.user?{...this.i.user,...this.i.attributes}:this.i.attributes,enableDevMode:this.i.enableDevMode,blockedChangeIds:this.i.blockedChangeIds,stickyBucketAssignmentDocs:this.i.stickyBucketAssignmentDocs,url:this.L(),forcedVariations:this.i.forcedVariations,forcedFeatureValues:this.i.forcedFeatureValues,attributeOverrides:this.i.attributeOverrides,saveStickyBucketAssignmentDoc:this.N,trackingCallback:this.i.trackingCallback,onFeatureUsage:this.i.onFeatureUsage,devLogs:this.logs,trackedExperiments:this.u,trackedFeatureUsage:this.h}}P(){return{features:this.i.features,experiments:this.i.experiments,log:this.log,enabled:this.i.enabled,qaMode:this.i.qaMode,savedGroups:this.i.savedGroups,groups:this.i.groups,overrides:this.i.overrides,onExperimentEval:this.p.size>0?this.O:void 0,recordChangeId:this.T,saveDeferredTrack:this.C,eventLogger:this.i.eventLogger}}j(t,e){const n=this.m.get(t);if(t.manual&&!this.v.has(t.key)&&!n)return null;let r,i;this.K(t)?r=It(this.V(),t,-1,!1,\"\"):(({result:r,trackingCall:i}=Nt(t,null,this.V())),this.O(t,r));const s=JSON.stringify(r.value);if(!e&&r.inExperiment&&n&&n.valueHash===s)return r;if(n&&this.H(t),r.inExperiment){const e=G(t);if(\"redirect\"===e&&r.value.urlRedirect&&t.urlPatterns){const e=t.persistQueryString?function(t,e){let n,r;try{n=new URL(t),r=new URL(e)}catch(t){return console.error(`Unable to merge query strings: ${t}`),e}return n.searchParams.forEach(((t,e)=>{r.searchParams.has(e)||r.searchParams.set(e,t)})),r.toString()}(this.L(),r.value.urlRedirect):r.value.urlRedirect;if(V(e,t.urlPatterns))return this.log(\"Skipping redirect because original URL matches redirect URL\",{id:t.key}),r;this.S=e;const{navigate:n,delay:s}=this.q();if(n)if(Lt)Promise.all([...i?[z(i,this.i.maxNavigateDelay??1e3)]:[],new Promise((t=>window.setTimeout(t,this.i.navigateDelay??s)))]).then((()=>{try{n(e)}catch(t){console.error(t)}}));else try{n(e)}catch(t){console.error(t)}}else if(\"visual\"===e){const e=this.i.applyDomChangesCallback?this.i.applyDomChangesCallback(r.value):this.G(r.value);e&&this.m.set(t,{undo:e,valueHash:s})}}return r}H(t){const e=this.m.get(t);e&&(e.undo(),this.m.delete(t))}D(t){if(!this._)return;const e=this.i.experiments||[],n=new Set(e);this.m.forEach(((t,e)=>{n.has(e)||(t.undo(),this.m.delete(e))}));for(const n of e){const e=this.j(n,t);if(null!=e&&e.inExperiment&&\"redirect\"===G(n))break}}O(t,e){const n=t.key,r=this.g.get(n);r&&r.result.inExperiment===e.inExperiment&&r.result.variationId===e.variationId||(this.g.set(n,{experiment:t,result:e}),this.p.forEach((n=>{try{n(t,e)}catch(t){console.error(t)}})))}T(t){this.l.add(t)}isOn(t){return this.evalFeature(t).on}isOff(t){return this.evalFeature(t).off}getFeatureValue(t,e){const n=this.evalFeature(t).value;return null===n?e:n}feature(t){return this.evalFeature(t)}evalFeature(t){return Tt(t,this.V())}log(t,e){this.debug&&(this.i.log?this.i.log(t,e):console.log(t,e))}getDeferredTrackingCalls(){return Array.from(this.A.values())}setDeferredTrackingCalls(t){this.A=new Map(t.filter((t=>t&&t.experiment&&t.result)).map((t=>[Pt(t.experiment,t.result),t])))}async fireDeferredTrackingCalls(){if(!this.i.trackingCallback)return;const t=[];this.A.forEach((e=>{e&&e.experiment&&e.result?t.push(this.i.trackingCallback(e.experiment,e.result)):console.error(\"Invalid deferred tracking call\",{call:e})})),this.A.clear(),await Promise.all(t)}setTrackingCallback(t){this.i.trackingCallback=t,this.fireDeferredTrackingCalls()}setEventLogger(t){this.i.eventLogger=t}async logEvent(t,e){if(this.U)console.error(\"Cannot log event to destroyed GrowthBook instance\");else if(this.i.enableDevMode&&this.logs.push({eventName:t,properties:e,timestamp:Date.now().toString(),logType:\"event\"}),this.i.eventLogger)try{await this.i.eventLogger(t,e||{},this.J())}catch(t){console.error(t)}else console.error(\"No event logger configured\")}C(t){this.A.set(Pt(t.experiment,t.result),t)}L(){return this.i.url||(Lt?window.location.href:\"\")}K(t){const e=G(t);if(\"visual\"===e){if(this.i.disableVisualExperiments)return!0;if(this.i.disableJsInjection&&t.variations.some((t=>t.js)))return!0}else{if(\"redirect\"!==e)return!0;if(this.i.disableUrlRedirectExperiments)return!0;try{const e=new URL(this.L());for(const n of t.variations){if(!n||!n.urlRedirect)continue;const t=new URL(n.urlRedirect);if(this.i.disableCrossOriginUrlRedirectExperiments){if(t.protocol!==e.protocol)return!0;if(t.host!==e.host)return!0}}}catch(e){return this.log(\"Error parsing current or redirect URL\",{id:t.key,error:e}),!0}}return!(!t.changeId||!(this.i.blockedChangeIds||[]).includes(t.changeId))}getRedirectUrl(){return this.S}q(){return this.i.navigate?{navigate:this.i.navigate,delay:0}:Lt?{navigate:t=>{window.location.replace(t)},delay:100}:{navigate:null,delay:0}}G(t){if(!Lt)return;const e=[];if(t.css){const n=document.createElement(\"style\");n.innerHTML=t.css,document.head.appendChild(n),e.push((()=>n.remove()))}if(t.js){const n=document.createElement(\"script\");n.innerHTML=t.js,this.i.jsInjectionNonce&&(n.nonce=this.i.jsInjectionNonce),document.head.appendChild(n),e.push((()=>n.remove()))}return t.domMutations&&t.domMutations.forEach((t=>{e.push(function(t){var e=t.selector,n=t.action,i=t.value,s=t.attribute,o=t.parentSelector,u=t.insertBeforeSelector;if(\"html\"===s){if(\"append\"===n)return N(e,(function(t){return t+(null!=i?i:\"\")}));if(\"set\"===n)return N(e,(function(){return null!=i?i:\"\"}))}else if(\"class\"===s){if(\"append\"===n)return D(e,(function(t){i&&t.add(i)}));if(\"remove\"===n)return D(e,(function(t){i&&t.delete(i)}));if(\"set\"===n)return D(e,(function(t){t.clear(),i&&t.add(i)}))}else if(\"position\"===s){if(\"set\"===n&&o)return function(t,e){return T({kind:\"position\",elements:new Set,mutate:function(){return{insertBeforeSelector:u,parentSelector:o}},selector:t})}(e)}else{if(\"append\"===n)return F(e,s,(function(t){return null!==t?t+(null!=i?i:\"\"):null!=i?i:\"\"}));if(\"set\"===n)return F(e,s,(function(){return null!=i?i:\"\"}));if(\"remove\"===n)return F(e,s,(function(){return null}))}return r}(t).revert)})),()=>{e.forEach((t=>t()))}}async refreshStickyBuckets(t){if(this.i.stickyBucketService){const e=this.V(),n=await async function(t,e,n){const r=Jt(t,n);return e.getAllAssignments(r)}(e,this.i.stickyBucketService,t);this.i.stickyBucketAssignmentDocs=n}}generateStickyBucketAssignmentDocsSync(t,e){if(!(\"getAllAssignmentsSync\"in t))return void console.error(\"generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync\");const n=Jt(this.V(),e);return t.getAllAssignmentsSync(n)}inDevMode(){return!!this.i.enableDevMode}}({enableDevMode:!0,...se,remoteEval:!!se.remoteEval,...oe,plugins:fe,stickyBucketService:ce});we.setRenderer((()=>{document.dispatchEvent(new CustomEvent(\"growthbookdata\"))})),we.init({payload:oe.payload,streaming:!(oe.noStreaming||se.noStreaming||!1===oe.backgroundSync),cacheSettings:oe.cacheSettings}).then((()=>{(oe.antiFlicker||se.antiFlicker)&&(we.getRedirectUrl()?ae():le())}));const pe=t=>{try{t&&t(we)}catch(t){console.error(\"Uncaught growthbook_queue error\",t)}};return window.growthbook_queue&&Array.isArray(window.growthbook_queue)&&window.growthbook_queue.forEach((t=>{pe(t)})),window.growthbook_queue={push:t=>{pe(t)}},we}();\n//# sourceMappingURL=auto.min.js.map\n";
|
|
1
|
+
export declare const sdkWrapper = "var _growthbook=function(){\"use strict\";function t(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}var e=function e(n,r){function i(e,i,s){if(\"undefined\"!=typeof document){\"number\"==typeof(s=t({},r,s)).expires&&(s.expires=new Date(Date.now()+864e5*s.expires)),s.expires&&(s.expires=s.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o=\"\";for(var u in s)s[u]&&(o+=\"; \"+u,!0!==s[u]&&(o+=\"=\"+s[u].split(\";\")[0]));return document.cookie=e+\"=\"+n.write(i,e)+o}}return Object.create({set:i,get:function(t){if(\"undefined\"!=typeof document&&(!arguments.length||t)){for(var e=document.cookie?document.cookie.split(\"; \"):[],r={},i=0;i<e.length;i++){var s=e[i].split(\"=\"),o=s.slice(1).join(\"=\");try{var u=decodeURIComponent(s[0]);if(r[u]=n.read(o,u),t===u)break}catch(t){}}return t?r[t]:r}},remove:function(e,n){i(e,\"\",t({},n,{expires:-1}))},withAttributes:function(n){return e(this.converter,t({},this.attributes,n))},withConverter:function(n){return e(t({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(n)}})}({read:function(t){return'\"'===t[0]&&(t=t.slice(1,-1)),t.replace(/(%[\\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:\"/\"}),n=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,r={revert:function(){}},i=new Map,s=new Set;function o(t){var e=i.get(t);return e||i.set(t,e={element:t,attributes:{}}),e}function u(t,e,n,r,i){var s=n(t),o={isDirty:!1,originalValue:s,virtualValue:s,mutations:[],el:t,t:null,observer:new MutationObserver((function(){if(\"position\"!==e||!o.t){\"position\"===e&&(o.t=setTimeout((function(){o.t=null}),1e3));var r=n(t);\"position\"===e&&r.parentNode===o.virtualValue.parentNode&&r.insertBeforeNode===o.virtualValue.insertBeforeNode||r!==o.virtualValue&&(o.originalValue=r,i(o))}})),mutationRunner:i,setValue:r,getCurrentValue:n};return\"position\"===e&&t.parentNode?o.observer.observe(t.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):o.observer.observe(t,function(t){return\"html\"===t?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[t]}}(e)),o}function c(t,e){var n=e.getCurrentValue(e.el);e.virtualValue=t,t&&\"string\"!=typeof t?n&&t.parentNode===n.parentNode&&t.insertBeforeNode===n.insertBeforeNode||(e.isDirty=!0,C()):t!==n&&(e.isDirty=!0,C())}function a(t){var e=t.originalValue;t.mutations.forEach((function(t){return e=t.mutate(e)})),c(function(t){return v||(v=document.createElement(\"div\")),v.innerHTML=t,v.innerHTML}(e),t)}function l(t){var e=new Set(t.originalValue.split(/\\s+/).filter(Boolean));t.mutations.forEach((function(t){return t.mutate(e)})),c(Array.from(e).filter(Boolean).join(\" \"),t)}function h(t){var e=t.originalValue;t.mutations.forEach((function(t){return e=t.mutate(e)})),c(e,t)}function f(t){var e=t.originalValue;t.mutations.forEach((function(t){var n=function(t){var e=t.insertBeforeSelector,n=document.querySelector(t.parentSelector);if(!n)return null;var r=e?document.querySelector(e):null;return e&&!r?null:{parentNode:n,insertBeforeNode:r}}(t.mutate());e=n||e})),c(e,t)}var d=function(t){return t.innerHTML},w=function(t,e){return t.innerHTML=e};function y(t){var e=o(t);return e.html||(e.html=u(t,\"html\",d,w,a)),e.html}var p=function(t){return{parentNode:t.parentElement,insertBeforeNode:t.nextElementSibling}},g=function(t,e){e.insertBeforeNode&&!e.parentNode.contains(e.insertBeforeNode)||e.parentNode.insertBefore(t,e.insertBeforeNode)};function m(t){var e=o(t);return e.position||(e.position=u(t,\"position\",p,g,f)),e.position}var v,b,k=function(t,e){return e?t.className=e:t.removeAttribute(\"class\")},S=function(t){return t.className};function A(t){var e=o(t);return e.classes||(e.classes=u(t,\"class\",S,k,l)),e.classes}function _(t,e){var n,r=o(t);return r.attributes[e]||(r.attributes[e]=u(t,e,(n=e,function(t){var e;return null!=(e=t.getAttribute(n))?e:null}),function(t){return function(e,n){return null!==n?e.setAttribute(t,n):e.removeAttribute(t)}}(e),h)),r.attributes[e]}function $(t,e,n){if(n.isDirty){n.isDirty=!1;var r=n.virtualValue;n.mutations.length||function(t,e){var n,r,s=i.get(t);if(s)if(\"html\"===e)null==(n=s.html)||null==(r=n.observer)||r.disconnect(),delete s.html;else if(\"class\"===e){var o,u;null==(o=s.classes)||null==(u=o.observer)||u.disconnect(),delete s.classes}else if(\"position\"===e){var c,a;null==(c=s.position)||null==(a=c.observer)||a.disconnect(),delete s.position}else{var l,h,f;null==(l=s.attributes)||null==(h=l[e])||null==(f=h.observer)||f.disconnect(),delete s.attributes[e]}}(t,e),n.setValue(t,r)}}function x(t,e){t.html&&$(e,\"html\",t.html),t.classes&&$(e,\"class\",t.classes),t.position&&$(e,\"position\",t.position),Object.keys(t.attributes).forEach((function(n){$(e,n,t.attributes[n])}))}function C(){i.forEach(x)}function E(t){if(\"position\"!==t.kind||1!==t.elements.size){var e=new Set(t.elements);document.querySelectorAll(t.selector).forEach((function(n){e.has(n)||(t.elements.add(n),function(t,e){var n=null;\"html\"===t.kind?n=y(e):\"class\"===t.kind?n=A(e):\"attribute\"===t.kind?n=_(e,t.attribute):\"position\"===t.kind&&(n=m(e)),n&&(n.mutations.push(t),n.mutationRunner(n))}(t,n))}))}}function O(){s.forEach(E)}function T(t){return\"undefined\"==typeof document?r:(s.add(t),E(t),{revert:function(){var e;(e=t).elements.forEach((function(t){return function(t,e){var n=null;if(\"html\"===t.kind?n=y(e):\"class\"===t.kind?n=A(e):\"attribute\"===t.kind?n=_(e,t.attribute):\"position\"===t.kind&&(n=m(e)),n){var r=n.mutations.indexOf(t);-1!==r&&n.mutations.splice(r,1),n.mutationRunner(n)}}(e,t)})),e.elements.clear(),s.delete(e)}})}function N(t,e){return T({kind:\"html\",elements:new Set,mutate:e,selector:t})}function D(t,e){return T({kind:\"class\",elements:new Set,mutate:e,selector:t})}function F(t,e,i){return n.test(e)?\"class\"===e||\"className\"===e?D(t,(function(t){var e=i(Array.from(t).join(\" \"));t.clear(),e&&e.split(/\\s+/g).filter(Boolean).forEach((function(e){return t.add(e)}))})):T({kind:\"attribute\",attribute:e,elements:new Set,mutate:i,selector:t}):r}\"undefined\"!=typeof document&&(b||(b=new MutationObserver((function(){O()}))),O(),b.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}));const M={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function R(t){let e=2166136261;const n=t.length;for(let r=0;r<n;r++)e^=t.charCodeAt(r),e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24);return e>>>0}function B(t,e,n){return 2===n?R(R(t+e)+\"\")%1e4/1e4:1===n?R(e+t)%1e3/1e3:null}function I(t,e){return t>=e[0]&&t<e[1]}function U(t){try{const e=t.replace(/([^\\\\])\\//g,\"$1\\\\/\");return new RegExp(e)}catch(t){return void console.error(t)}}function V(t,e){if(!e.length)return!1;let n=!1,r=!1;for(let i=0;i<e.length;i++){const s=j(t,e[i].type,e[i].pattern);if(!1===e[i].include){if(s)return!1}else n=!0,s&&(r=!0)}return r||!n}function j(t,e,n){try{const r=new URL(t,\"https://_\");if(\"regex\"===e){const t=U(n);return!!t&&(t.test(r.href)||t.test(r.href.substring(r.origin.length)))}return\"simple\"===e&&function(t,e){try{const n=new URL(e.replace(/^([^:/?]*)\\./i,\"https://$1.\").replace(/\\*/g,\"_____\"),\"https://_____\"),r=[[t.host,n.host,!1],[t.pathname,n.pathname,!0]];return n.hash&&r.push([t.hash,n.hash,!1]),n.searchParams.forEach(((e,n)=>{r.push([t.searchParams.get(n)||\"\",e,!1])})),!r.some((t=>!function(t,e,n){try{let r=e.replace(/[*.+?^${}()|[\\]\\\\]/g,\"\\\\$&\").replace(/_____/g,\".*\");return n&&(r=\"\\\\/?\"+r.replace(/(^\\/|\\/$)/g,\"\")+\"\\\\/?\"),new RegExp(\"^\"+r+\"$\",\"i\").test(t)}catch(t){return!1}}(t[0],t[1],t[2])))}catch(t){return!1}}(r,n)}catch(t){return!1}}const J=t=>Uint8Array.from(atob(t),(t=>t.charCodeAt(0)));async function P(t,e,n){if(e=e||\"\",!(n=n||globalThis.crypto&&globalThis.crypto.subtle||M.SubtleCrypto))throw new Error(\"No SubtleCrypto implementation found\");try{const r=await n.importKey(\"raw\",J(e),{name:\"AES-CBC\",length:128},!0,[\"encrypt\",\"decrypt\"]),[i,s]=t.split(\".\"),o=await n.decrypt({name:\"AES-CBC\",iv:J(i)},r,J(s));return(new TextDecoder).decode(o)}catch(t){throw new Error(\"Failed to decrypt\")}}function L(t){return\"string\"==typeof t?t:JSON.stringify(t)}function K(t){\"number\"==typeof t&&(t+=\"\"),t&&\"string\"==typeof t||(t=\"0\");const e=t.replace(/(^v|\\+.*$)/g,\"\").split(/[-.]/);return 3===e.length&&e.push(\"~\"),e.map((t=>t.match(/^[0-9]+$/)?t.padStart(5,\" \"):t)).join(\"-\")}function H(){let t;try{t=\"1.6.4\"}catch(e){t=\"\"}return t}function q(t){return\"object\"==typeof t&&null!==t}function G(t){return t.urlPatterns&&t.variations.some((t=>q(t)&&\"urlRedirect\"in t))?\"redirect\":t.variations.some((t=>q(t)&&(t.domMutations||\"js\"in t||\"css\"in t)))?\"visual\":\"unknown\"}async function z(t,e){return new Promise((n=>{let r,i=!1;const s=t=>{i||(i=!0,r&&clearTimeout(r),n(t||null))};e&&(r=setTimeout((()=>s()),e)),t.then((t=>s(t))).catch((()=>s()))}))}const Z={staleTTL:6e4,maxAge:144e5,cacheKey:\"gbFeaturesCache\",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},Q=M,W={fetchFeaturesCall:({host:t,clientKey:e,headers:n})=>Q.fetch(`${t}/api/features/${e}`,{headers:n}),fetchRemoteEvalCall:({host:t,clientKey:e,payload:n,headers:r})=>{const i={method:\"POST\",headers:{\"Content-Type\":\"application/json\",...r},body:JSON.stringify(n)};return Q.fetch(`${t}/api/eval/${e}`,i)},eventSourceCall:({host:t,clientKey:e,headers:n})=>n?new Q.EventSource(`${t}/sub/${e}`,{headers:n}):new Q.EventSource(`${t}/sub/${e}`),startIdleListener:()=>{let t;if(\"undefined\"==typeof window||\"undefined\"==typeof document)return;const e=()=>{\"visible\"===document.visibilityState?(window.clearTimeout(t),nt.forEach((t=>{t&&\"idle\"===t.state&&wt(t)}))):\"hidden\"===document.visibilityState&&(t=window.setTimeout(it,Z.idleStreamInterval))};return document.addEventListener(\"visibilitychange\",e),()=>document.removeEventListener(\"visibilitychange\",e)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(Q.localStorage=globalThis.localStorage)}catch(t){}const X=new Map;let Y=!1;const tt=new Map,et=new Map,nt=new Map,rt=new Set;function it(){nt.forEach((t=>{t&&(t.state=\"idle\",dt(t))}))}async function st(){try{if(!Q.localStorage)return;await Q.localStorage.setItem(Z.cacheKey,JSON.stringify(Array.from(tt.entries())))}catch(t){}}function ot(t){const[e,n]=t.getApiInfo();return`${e}||${n}`}function ut(t){const e=ot(t);if(!(\"isRemoteEval\"in t)||!t.isRemoteEval())return e;const n=t.getAttributes(),r=t.getCacheKeyAttributes()||Object.keys(t.getAttributes()),i={};r.forEach((t=>{i[t]=n[t]}));const s=t.getForcedVariations(),o=t.getUrl();return`${e}||${JSON.stringify({ca:i,fv:s,url:o})}`}function ct(){const t=Array.from(tt.entries()).map((([t,e])=>({key:t,staleAt:e.staleAt.getTime()}))).sort(((t,e)=>t.staleAt-e.staleAt)),e=Math.min(Math.max(0,tt.size-Z.maxEntries),tt.size);for(let n=0;n<e;n++)tt.delete(t[n].key)}function at(t,e,n){const r=n.dateUpdated||\"\",i=new Date(Date.now()+Z.staleTTL),s=Z.disableCache?void 0:tt.get(e);if(s&&r&&s.version===r)return s.staleAt=i,void st();Z.disableCache||(tt.set(e,{data:n,version:r,staleAt:i,sse:rt.has(t)}),ct()),st();const o=X.get(t);o&&o.forEach((t=>async function(t,e){await t.setPayload(e||t.getPayload())}(t,n)))}async function lt(t){const{apiHost:e,apiRequestHeaders:n}=t.getApiHosts(),r=t.getClientKey(),i=\"isRemoteEval\"in t&&t.isRemoteEval(),s=ot(t),o=ut(t);let u=et.get(o);return u||(u=(i?W.fetchRemoteEvalCall({host:e,clientKey:r,payload:{attributes:t.getAttributes(),forcedVariations:t.getForcedVariations(),forcedFeatures:Array.from(t.getForcedFeatures().entries()),url:t.getUrl()},headers:n}):W.fetchFeaturesCall({host:e,clientKey:r,headers:n})).then((t=>{if(!t.ok)throw new Error(`HTTP error: ${t.status}`);return\"enabled\"===t.headers.get(\"x-sse-support\")&&rt.add(s),t.json()})).then((e=>(at(s,o,e),ht(t),et.delete(o),{data:e,success:!0,source:\"network\"}))).catch((t=>(et.delete(o),{data:null,source:\"error\",success:!1,error:t}))),et.set(o,u)),u}function ht(t,e=!1){const n=ot(t),r=ut(t),{streamingHost:i,streamingHostRequestHeaders:s}=t.getApiHosts(),o=t.getClientKey();if(e&&rt.add(n),Z.backgroundSync&&rt.has(n)&&Q.EventSource){if(nt.has(n))return;const t={src:null,host:i,clientKey:o,headers:s,cb:e=>{try{if(\"features-updated\"===e.type){const t=X.get(n);t&&t.forEach((t=>{lt(t)}))}else if(\"features\"===e.type){const t=JSON.parse(e.data);at(n,r,t)}t.errors=0}catch(e){ft(t)}},errors:0,state:\"active\"};nt.set(n,t),wt(t)}}function ft(t){if(\"idle\"!==t.state&&(t.errors++,t.errors>3||t.src&&2===t.src.readyState)){const e=Math.pow(3,t.errors-3)*(1e3+1e3*Math.random());dt(t),setTimeout((()=>{[\"idle\",\"active\"].includes(t.state)||wt(t)}),Math.min(e,3e5))}}function dt(t){t.src&&(t.src.onopen=null,t.src.onerror=null,t.src.close(),t.src=null,\"active\"===t.state&&(t.state=\"disabled\"))}function wt(t){t.src=W.eventSourceCall({host:t.host,clientKey:t.clientKey,headers:t.headers}),t.state=\"active\",t.src.addEventListener(\"features\",t.cb),t.src.addEventListener(\"features-updated\",t.cb),t.src.onerror=()=>ft(t),t.src.onopen=()=>{t.errors=0}}function yt(t,e){dt(t),nt.delete(e)}function pt(){rt.clear(),nt.forEach(yt),X.clear(),W.stopIdleListener()}function gt(t,e){if(e.streaming){if(!t.getClientKey())throw new Error(\"Must specify clientKey to enable streaming\");e.payload&&ht(t,!0),function(t){const e=ot(t),n=X.get(e)||new Set;n.add(t),X.set(e,n)}(t)}}const mt={};function vt(t,e,n){n=n||{};for(const[r,i]of Object.entries(e))switch(r){case\"$or\":if(!Ct(t,i,n))return!1;break;case\"$nor\":if(Ct(t,i,n))return!1;break;case\"$and\":if(!Et(t,i,n))return!1;break;case\"$not\":if(vt(t,i,n))return!1;break;default:if(!St(i,bt(t,r),n))return!1}return!0}function bt(t,e){const n=e.split(\".\");let r=t;for(let t=0;t<n.length;t++){if(!r||\"object\"!=typeof r||!(n[t]in r))return null;r=r[n[t]]}return r}function kt(t,e=!1){const n=`${t}${e?\"/i\":\"\"}`;return mt[n]||(mt[n]=new RegExp(t.replace(/([^\\\\])\\//g,\"$1\\\\/\"),e?\"i\":void 0)),mt[n]}function St(t,e,n,r=!1){if(\"string\"==typeof t)return r?String(e).toLowerCase()===t.toLowerCase():e+\"\"===t;if(\"number\"==typeof t)return 1*e===t;if(\"boolean\"==typeof t)return null!==e&&!!e===t;if(null===t)return null===e;if(Array.isArray(t)||!At(t))return JSON.stringify(e)===JSON.stringify(t);for(const r in t)if(!xt(r,e,t[r],n))return!1;return!0}function At(t){const e=Object.keys(t);return e.length>0&&e.filter((t=>\"$\"===t[0])).length===e.length}function _t(t,e,n=!1){if(n){const n=t=>\"string\"==typeof t?t.toLowerCase():t;return Array.isArray(t)?t.some((t=>e.some((e=>n(t)===n(e))))):e.some((e=>n(t)===n(e)))}return Array.isArray(t)?t.some((t=>e.includes(t))):e.includes(t)}function $t(t,e,n,r=!1){if(!Array.isArray(t))return!1;for(let i=0;i<e.length;i++){let s=!1;for(let o=0;o<t.length;o++)if(St(e[i],t[o],n,r)){s=!0;break}if(!s)return!1}return!0}function xt(t,e,n,r){switch(t){case\"$veq\":return K(e)===K(n);case\"$vne\":return K(e)!==K(n);case\"$vgt\":return K(e)>K(n);case\"$vgte\":return K(e)>=K(n);case\"$vlt\":return K(e)<K(n);case\"$vlte\":return K(e)<=K(n);case\"$eq\":return e===n;case\"$ne\":return e!==n;case\"$lt\":return e<n;case\"$lte\":return e<=n;case\"$gt\":return e>n;case\"$gte\":return e>=n;case\"$exists\":return n?null!=e:null==e;case\"$in\":return!!Array.isArray(n)&&_t(e,n);case\"$ini\":return!!Array.isArray(n)&&_t(e,n,!0);case\"$inGroup\":return _t(e,r[n]||[]);case\"$notInGroup\":return!_t(e,r[n]||[]);case\"$nin\":return!!Array.isArray(n)&&!_t(e,n);case\"$nini\":return!!Array.isArray(n)&&!_t(e,n,!0);case\"$not\":return!St(n,e,r);case\"$size\":return!!Array.isArray(e)&&St(n,e.length,r);case\"$elemMatch\":return function(t,e,n){if(!Array.isArray(t))return!1;const r=At(e)?t=>St(e,t,n):t=>vt(t,e,n);for(let e=0;e<t.length;e++)if(t[e]&&r(t[e]))return!0;return!1}(e,n,r);case\"$all\":return!!Array.isArray(n)&&$t(e,n,r);case\"$alli\":return!!Array.isArray(n)&&$t(e,n,r,!0);case\"$regex\":try{return kt(n).test(e)}catch(t){return!1}case\"$regexi\":try{return kt(n,!0).test(e)}catch(t){return!1}case\"$type\":return function(t){if(null===t)return\"null\";if(Array.isArray(t))return\"array\";const e=typeof t;return[\"string\",\"number\",\"boolean\",\"object\",\"undefined\"].includes(e)?e:\"unknown\"}(e)===n;default:return console.error(\"Unknown operator: \"+t),!1}}function Ct(t,e,n){if(!e.length)return!0;for(let r=0;r<e.length;r++)if(vt(t,e[r],n))return!0;return!1}function Et(t,e,n){for(let r=0;r<e.length;r++)if(!vt(t,e[r],n))return!1;return!0}const Ot=\"Feature Evaluated\",Tt=\"Experiment Viewed\";async function Nt(t){try{await t()}catch(t){}}function Dt(t,e,n){if(t.user.trackedExperiments){const r=Ht(e,n);if(t.user.trackedExperiments.has(r))return[];t.user.trackedExperiments.add(r)}t.user.enableDevMode&&t.user.devLogs&&t.user.devLogs.push({experiment:e,result:n,timestamp:Date.now().toString(),logType:\"experiment\"});const r=[];if(t.global.trackingCallback){const i=t.global.trackingCallback;r.push(Nt((()=>i(e,n,t.user))))}if(t.user.trackingCallback){const i=t.user.trackingCallback;r.push(Nt((()=>i(e,n))))}if(t.global.eventLogger){const i=t.global.eventLogger;r.push(Nt((()=>i(Tt,{experimentId:e.key,variationId:n.key,hashAttribute:n.hashAttribute,hashValue:n.hashValue},t.user))))}return r}function Ft(t,e){if(e.stack.evaluatedFeatures.has(t))return Rt(e,t,null,\"cyclicPrerequisite\");e.stack.evaluatedFeatures.add(t),e.stack.id=t;const n=function(t){const e=new Map;return t.global.forcedFeatureValues&&t.global.forcedFeatureValues.forEach(((t,n)=>e.set(n,t))),t.user.forcedFeatureValues&&t.user.forcedFeatureValues.forEach(((t,n)=>e.set(n,t))),e}(e);if(n.has(t))return Rt(e,t,n.get(t),\"override\");if(!e.global.features||!e.global.features[t])return Rt(e,t,null,\"unknownFeature\");const r=e.global.features[t];if(r.rules){const n=new Set(e.stack.evaluatedFeatures);t:for(const i of r.rules){if(i.parentConditions)for(const r of i.parentConditions){e.stack.evaluatedFeatures=new Set(n);const i=Ft(r.id,e);if(\"cyclicPrerequisite\"===i.source)return Rt(e,t,null,\"cyclicPrerequisite\");if(!vt({value:i.value},r.condition||{})){if(r.gate)return Rt(e,t,null,\"prerequisite\");continue t}}if(i.filters&&Ut(i.filters,e))continue;if(\"force\"in i){if(i.condition&&!It(i.condition,e))continue;if(!Vt(e,i.seed||t,i.hashAttribute,e.user.saveStickyBucketAssignmentDoc&&!i.disableStickyBucketing?i.fallbackAttribute:void 0,i.range,i.coverage,i.hashVersion))continue;return i.tracks&&i.tracks.forEach((t=>{!Dt(e,t.experiment,t.result).length&&e.global.saveDeferredTrack&&e.global.saveDeferredTrack({experiment:t.experiment,result:t.result})})),Rt(e,t,i.force,\"force\",i.id)}if(!i.variations)continue;const r={variations:i.variations,key:i.key||t};\"coverage\"in i&&(r.coverage=i.coverage),i.weights&&(r.weights=i.weights),i.hashAttribute&&(r.hashAttribute=i.hashAttribute),i.fallbackAttribute&&(r.fallbackAttribute=i.fallbackAttribute),i.disableStickyBucketing&&(r.disableStickyBucketing=i.disableStickyBucketing),void 0!==i.bucketVersion&&(r.bucketVersion=i.bucketVersion),void 0!==i.minBucketVersion&&(r.minBucketVersion=i.minBucketVersion),i.namespace&&(r.namespace=i.namespace),i.meta&&(r.meta=i.meta),i.ranges&&(r.ranges=i.ranges),i.name&&(r.name=i.name),i.phase&&(r.phase=i.phase),i.seed&&(r.seed=i.seed),i.hashVersion&&(r.hashVersion=i.hashVersion),i.filters&&(r.filters=i.filters),i.condition&&(r.condition=i.condition);const{result:s}=Mt(r,t,e);if(e.global.onExperimentEval&&e.global.onExperimentEval(r,s),s.inExperiment&&!s.passthrough)return Rt(e,t,s.value,\"experiment\",i.id,r,s)}}return Rt(e,t,void 0===r.defaultValue?null:r.defaultValue,\"defaultValue\")}function Mt(t,e,n){const r=t.key,i=t.variations.length;if(i<2)return{result:jt(n,t,-1,!1,e)};if(!1===n.global.enabled||!1===n.user.enabled)return{result:jt(n,t,-1,!1,e)};if(t=function(t,e){const n=t.key,r=e.global.overrides;return r&&r[n]&&\"string\"==typeof(t=Object.assign({},t,r[n])).url&&(t.url=U(t.url)),t}(t,n),t.urlPatterns&&!V(n.user.url||\"\",t.urlPatterns))return{result:jt(n,t,-1,!1,e)};const s=function(t,e,n){if(!e)return null;const r=e.split(\"?\")[1];if(!r)return null;const i=r.replace(/#.*/,\"\").split(\"&\").map((t=>t.split(\"=\",2))).filter((([e])=>e===t)).map((([,t])=>parseInt(t)));return i.length>0&&i[0]>=0&&i[0]<n?i[0]:null}(r,n.user.url||\"\",i);if(null!==s)return{result:jt(n,t,s,!1,e)};const o=function(t){return t.global.forcedVariations&&t.user.forcedVariations?{...t.global.forcedVariations,...t.user.forcedVariations}:t.global.forcedVariations?t.global.forcedVariations:t.user.forcedVariations?t.user.forcedVariations:{}}(n);if(r in o)return{result:jt(n,t,o[r],!1,e)};if(\"draft\"===t.status||!1===t.active)return{result:jt(n,t,-1,!1,e)};const{hashAttribute:u,hashValue:c}=Jt(n,t.hashAttribute,n.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing?t.fallbackAttribute:void 0);if(!c)return{result:jt(n,t,-1,!1,e)};let a=-1,l=!1,h=!1;if(n.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing){const{variation:e,versionIsBlocked:r}=function({ctx:t,expKey:e,expBucketVersion:n,expHashAttribute:r,expFallbackAttribute:i,expMinBucketVersion:s,expMeta:o}){s=s||0,r=r||\"id\",o=o||[];const u=Pt(e,n=n||0),c=function(t,e,n){if(!t.user.stickyBucketAssignmentDocs)return{};const{hashAttribute:r,hashValue:i}=Jt(t,e),s=Lt(r,L(i)),{hashAttribute:o,hashValue:u}=Jt(t,n),c=u?Lt(o,L(u)):null,a={};return c&&t.user.stickyBucketAssignmentDocs[c]&&Object.assign(a,t.user.stickyBucketAssignmentDocs[c].assignments||{}),t.user.stickyBucketAssignmentDocs[s]&&Object.assign(a,t.user.stickyBucketAssignmentDocs[s].assignments||{}),a}(t,r,i);if(s>0)for(let t=0;t<s;t++)if(void 0!==c[Pt(e,t)])return{variation:-1,versionIsBlocked:!0};const a=c[u];if(void 0===a)return{variation:-1};const l=o.findIndex((t=>t.key===a));return l<0?{variation:-1}:{variation:l}}({ctx:n,expKey:t.key,expBucketVersion:t.bucketVersion,expHashAttribute:t.hashAttribute,expFallbackAttribute:t.fallbackAttribute,expMinBucketVersion:t.minBucketVersion,expMeta:t.meta});l=e>=0,a=e,h=!!r}if(!l){if(t.filters){if(Ut(t.filters,n))return{result:jt(n,t,-1,!1,e)}}else if(t.namespace&&!function(t,e){const n=B(\"__\"+e[0],t,1);return null!==n&&n>=e[1]&&n<e[2]}(c,t.namespace))return{result:jt(n,t,-1,!1,e)};if(t.include&&!function(t){try{return t()}catch(t){return console.error(t),!1}}(t.include))return{result:jt(n,t,-1,!1,e)};if(t.condition&&!It(t.condition,n))return{result:jt(n,t,-1,!1,e)};if(t.parentConditions){const r=new Set(n.stack.evaluatedFeatures);for(const i of t.parentConditions){n.stack.evaluatedFeatures=new Set(r);const s=Ft(i.id,n);if(\"cyclicPrerequisite\"===s.source)return{result:jt(n,t,-1,!1,e)};if(!vt({value:s.value},i.condition||{}))return{result:jt(n,t,-1,!1,e)}}}if(t.groups&&!function(t,e){const n=e.global.groups||{};for(let e=0;e<t.length;e++)if(n[t[e]])return!0;return!1}(t.groups,n))return{result:jt(n,t,-1,!1,e)}}if(t.url&&!function(t,e){const n=e.user.url;if(!n)return!1;const r=n.replace(/^https?:\\/\\//,\"\").replace(/^[^/]*\\//,\"/\");return!!t.test(n)||!!t.test(r)}(t.url,n))return{result:jt(n,t,-1,!1,e)};const f=B(t.seed||r,c,t.hashVersion||1);if(null===f)return{result:jt(n,t,-1,!1,e)};if(l||(a=function(t,e){for(let n=0;n<e.length;n++)if(I(t,e[n]))return n;return-1}(f,t.ranges||function(t,e,n){(e=void 0===e?1:e)<0?e=0:e>1&&(e=1);const r=(i=t)<=0?[]:new Array(i).fill(1/i);var i;(n=n||r).length!==t&&(n=r);const s=n.reduce(((t,e)=>e+t),0);(s<.99||s>1.01)&&(n=r);let o=0;return n.map((t=>{const n=o;return o+=t,[n,n+e*t]}))}(i,void 0===t.coverage?1:t.coverage,t.weights))),h)return{result:jt(n,t,-1,!1,e,void 0,!0)};if(a<0)return{result:jt(n,t,-1,!1,e)};if(\"force\"in t)return{result:jt(n,t,void 0===t.force?-1:t.force,!1,e)};if(n.global.qaMode||n.user.qaMode)return{result:jt(n,t,-1,!1,e)};if(\"stopped\"===t.status)return{result:jt(n,t,-1,!1,e)};const d=jt(n,t,a,!0,e,f,l);if(n.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing){const{changed:e,key:r,doc:i}=function(t,e,n,r){const i=Lt(e,n),s=t.user.stickyBucketAssignmentDocs&&t.user.stickyBucketAssignmentDocs[i]&&t.user.stickyBucketAssignmentDocs[i].assignments||{},o={...s,...r};return{key:i,doc:{attributeName:e,attributeValue:n,assignments:o},changed:JSON.stringify(s)!==JSON.stringify(o)}}(n,u,L(c),{[Pt(t.key,t.bucketVersion)]:d.key});e&&(n.user.stickyBucketAssignmentDocs=n.user.stickyBucketAssignmentDocs||{},n.user.stickyBucketAssignmentDocs[r]=i,n.user.saveStickyBucketAssignmentDoc(i))}const w=Dt(n,t,d);0===w.length&&n.global.saveDeferredTrack&&n.global.saveDeferredTrack({experiment:t,result:d});const y=w.length?1===w.length?w[0]:Promise.all(w).then((()=>{})):void 0;return\"changeId\"in t&&t.changeId&&n.global.recordChangeId&&n.global.recordChangeId(t.changeId),{result:d,trackingCall:y}}function Rt(t,e,n,r,i,s,o){const u={value:n,on:!!n,off:!n,source:r,ruleId:i||\"\"};return s&&(u.experiment=s),o&&(u.experimentResult=o),\"override\"!==r&&function(t,e,n){if(t.user.trackedFeatureUsage){const r=JSON.stringify(n.value);if(t.user.trackedFeatureUsage[e]===r)return;t.user.trackedFeatureUsage[e]=r,t.user.enableDevMode&&t.user.devLogs&&t.user.devLogs.push({featureKey:e,result:n,timestamp:Date.now().toString(),logType:\"feature\"})}if(t.global.onFeatureUsage){const r=t.global.onFeatureUsage;Nt((()=>r(e,n,t.user)))}if(t.user.onFeatureUsage){const r=t.user.onFeatureUsage;Nt((()=>r(e,n)))}if(t.global.eventLogger){const r=t.global.eventLogger;Nt((()=>r(Ot,{feature:e,source:n.source,value:n.value,ruleId:\"defaultValue\"===n.source?\"$default\":n.ruleId||\"\",variationId:n.experimentResult?n.experimentResult.key:\"\"},t.user)))}}(t,e,u),u}function Bt(t){return{...t.user.attributes,...t.user.attributeOverrides}}function It(t,e){return vt(Bt(e),t,e.global.savedGroups||{})}function Ut(t,e){return t.some((t=>{const{hashValue:n}=Jt(e,t.attribute);if(!n)return!0;const r=B(t.seed,n,t.hashVersion||2);return null===r||!t.ranges.some((t=>I(r,t)))}))}function Vt(t,e,n,r,i,s,o){if(!i&&void 0===s)return!0;if(!i&&0===s)return!1;const{hashValue:u}=Jt(t,n,r);if(!u)return!1;const c=B(e,u,o||1);return null!==c&&(i?I(c,i):void 0===s||c<=s)}function jt(t,e,n,r,i,s,o){let u=!0;(n<0||n>=e.variations.length)&&(n=0,u=!1);const{hashAttribute:c,hashValue:a}=Jt(t,e.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0),l=e.meta?e.meta[n]:{},h={key:l.key||\"\"+n,featureId:i,inExperiment:u,hashUsed:r,variationId:n,value:e.variations[n],hashAttribute:c,hashValue:a,stickyBucketUsed:!!o};return l.name&&(h.name=l.name),void 0!==s&&(h.bucket=s),l.passthrough&&(h.passthrough=l.passthrough),h}function Jt(t,e,n){let r=e||\"id\",i=\"\";const s=Bt(t);return s[r]&&(i=s[r]),!i&&n&&(s[n]&&(i=s[n]),i&&(r=n)),{hashAttribute:r,hashValue:i}}function Pt(t,e){return`${t}__${e=e||0}`}function Lt(t,e){return`${t}||${e}`}function Kt(t,e){const n={},r=function(t,e){const n=new Set,r=e&&e.features?e.features:t.global.features||{},i=e&&e.experiments?e.experiments:t.global.experiments||[];return Object.keys(r).forEach((t=>{const e=r[t];if(e.rules)for(const t of e.rules)t.variations&&(n.add(t.hashAttribute||\"id\"),t.fallbackAttribute&&n.add(t.fallbackAttribute))})),i.map((t=>{n.add(t.hashAttribute||\"id\"),t.fallbackAttribute&&n.add(t.fallbackAttribute)})),Array.from(n)}(t,e);return r.forEach((e=>{const{hashValue:r}=Jt(t,e);n[e]=L(r)})),n}function Ht(t,e){return e.hashAttribute+e.hashValue+t.key+e.variationId}const qt=\"undefined\"!=typeof window&&\"undefined\"!=typeof document,Gt=H();class zt{constructor(t){this.prefix=(t=t||{}).prefix||\"\"}async getAllAssignments(t){const e={};return(await Promise.all(Object.entries(t).map((([t,e])=>this.getAssignments(t,e))))).forEach((t=>{if(t){const n=Lt(t.attributeName,t.attributeValue);e[n]=t}})),e}getKey(t,e){return`${this.prefix}${t}||${e}`}}class Zt extends zt{async getAssignments(t,e){return this.getAssignmentsSync(t,e)}async saveAssignments(t){this.saveAssignmentsSync(t)}getAllAssignmentsSync(t){const e={};return Object.entries(t).map((([t,e])=>this.getAssignmentsSync(t,e))).forEach((t=>{if(t){const n=Lt(t.attributeName,t.attributeValue);e[n]=t}})),e}}function Qt(t){return{browser:t.match(/Edg/)?\"edge\":t.match(/Chrome/)?\"chrome\":t.match(/Firefox/)?\"firefox\":t.match(/Safari/)?\"safari\":\"unknown\",deviceType:t.match(/Mobi/)?\"mobile\":\"desktop\"}}function Wt(t){return t?{url:t.href,path:t.pathname,host:t.host,query:t.search}:{}}function Xt(t){let e={};try{const t=sessionStorage.getItem(\"utm_params\");t&&(e=JSON.parse(t))}catch(t){}if(t&&t.search){const n=new URLSearchParams(t.search);let r=!1;if([\"source\",\"medium\",\"campaign\",\"term\",\"content\"].forEach((t=>{const i=`utm_${t}`,s=\"utm\"+t[0].toUpperCase()+t.slice(1);n.has(i)&&(e[s]=n.get(i)||\"\",r=!0)})),r)try{sessionStorage.setItem(\"utm_params\",JSON.stringify(e))}catch(t){}}return e}function Yt(){if(\"undefined\"==typeof window||!window.dataLayer||!window.dataLayer.forEach)return{};const t={};return window.dataLayer.forEach((e=>{e&&\"object\"==typeof e&&!(\"length\"in e)&&(\"event\"in e||Object.keys(e).forEach((n=>{if(\"string\"!=typeof n||n.match(/^(gtm)/))return;const r=e[n];[\"string\",\"number\",\"boolean\"].includes(typeof r)&&(t[n]=r)})))})),t}const te=H();function ee(t){return\"string\"==typeof t?t:null}window.dataLayer=window.dataLayer||[];const ne=document.currentScript,re=ne?ne.dataset:{},ie=window.growthbook_config||{};let se,oe;function ue(){window.clearTimeout(se);let t=ie.antiFlickerTimeout??(re.antiFlickerTimeout?parseInt(re.antiFlickerTimeout):null)??3500;isFinite(t)||(t=3500);try{if(!document.getElementById(\"gb-anti-flicker-style\")){const t=document.createElement(\"style\");t.setAttribute(\"id\",\"gb-anti-flicker-style\"),t.innerHTML=\".gb-anti-flicker { opacity: 0 !important; pointer-events: none; }\",document.head.appendChild(t)}document.documentElement.classList.add(\"gb-anti-flicker\"),se=window.setTimeout(ce,t)}catch(t){console.error(t)}}function ce(){window.clearTimeout(se);try{document.documentElement.classList.remove(\"gb-anti-flicker\")}catch(t){console.error(t)}}(ie.antiFlicker||re.antiFlicker)&&ue(),\"cookie\"===ie.useStickyBucketService||\"cookie\"===re.useStickyBucketService?oe=new class extends Zt{constructor({prefix:t=\"gbStickyBuckets__\",jsCookie:e,cookieAttributes:n={expires:180}}){super(),this.prefix=t,this.jsCookie=e,this.cookieAttributes=n}getAssignmentsSync(t,e){const n=this.getKey(t,e);let r=null;if(!this.jsCookie)return r;try{const t=this.jsCookie.get(n),e=JSON.parse(t||\"{}\");e.attributeName&&e.attributeValue&&e.assignments&&(r=e)}catch(t){}return r}async saveAssignmentsSync(t){const e=this.getKey(t.attributeName,t.attributeValue);if(!this.jsCookie)return;const n=JSON.stringify(t);this.jsCookie.set(e,n,this.cookieAttributes)}}({prefix:ie.stickyBucketPrefix||re.stickyBucketPrefix||void 0,jsCookie:e}):\"localStorage\"!==ie.useStickyBucketService&&\"localStorage\"!==re.useStickyBucketService||(oe=new class extends zt{constructor(t){t=t||{},super(),this.prefix=t.prefix||\"gbStickyBuckets__\";try{this.localStorage=t.localStorage||globalThis.localStorage}catch(t){}}async getAssignments(t,e){const n=this.getKey(t,e);let r=null;if(!this.localStorage)return r;try{const t=await this.localStorage.getItem(n)||\"{}\",e=JSON.parse(t);e.attributeName&&e.attributeValue&&e.assignments&&(r=e)}catch(t){}return r}async saveAssignments(t){const e=this.getKey(t.attributeName,t.attributeValue);if(this.localStorage)try{await this.localStorage.setItem(e,JSON.stringify(t))}catch(t){}}}({prefix:ie.stickyBucketPrefix||re.stickyBucketPrefix||void 0}));const ae=re.uuid||ie.uuid,le=[function(t={}){if(\"undefined\"==typeof window)throw new Error(\"autoAttributesPlugin only works in the browser\");const e=t.uuidCookieName||\"gbuuid\",n=t.uuidKey||\"id\";let r=t.uuid||\"\";function i(){!function(t,e){const n=new Date;n.setTime(n.getTime()+3456e7),document.cookie=t+\"=\"+e+\";path=/;expires=\"+n.toUTCString()}(e,r)}function s(t){const s=navigator.userAgent,o=r||(r=function(t){const e=(\"; \"+document.cookie).split(`; ${t}=`);return 2===e.length?e[1].split(\";\")[0]:\"\"}(e),r||(u=window.crypto,r=u&&u.randomUUID?u.randomUUID():\"10000000-1000-4000-8000-100000000000\".replace(/[018]/g,(t=>(t^(u&&u.getRandomValues?u.getRandomValues(new Uint8Array(1))[0]:Math.floor(256*Math.random()))&15>>t/4).toString(16))),r));var u;(t.uuidAutoPersist??!t.uuid)&&i();const c=location;return{...Yt(),[n]:o,...Wt(c),pageTitle:document.title,...Qt(s),...Xt(c)}}return document.addEventListener(\"growthbookpersist\",(()=>{i()})),e=>{if(\"createScopedInstance\"in e)return;const n=s(t);n.url&&e.setURL(n.url),e.updateAttributes(n);let r=n.url;const i=setInterval((()=>{location.href!==r&&(r=location.href,e.setURL(r),e.updateAttributes(s(t)))}),500),o=()=>{location.href!==r&&(r=location.href,e.setURL(r)),e.updateAttributes(s(t))};document.addEventListener(\"growthbookrefresh\",o),\"onDestroy\"in e&&e.onDestroy((()=>{clearInterval(i),document.removeEventListener(\"growthbookrefresh\",o)}))}}({uuid:ae,uuidCookieName:ie.uuidCookieName||re.uuidCookieName,uuidKey:ie.uuidKey||re.uuidKey,uuidAutoPersist:!ae&&null==re.noAutoCookies})],he=re.tracking||\"gtag,gtm,segment\";if(\"none\"!==he){const t=he.toLowerCase().split(\",\").map((t=>t.trim()));t.includes(\"growthbook\")&&le.push(function({queueFlushInterval:t=100,ingestorHost:e,enable:n=!0,debug:r,dedupeCacheSize:i=1e3,dedupeKeyAttributes:s=[],eventFilter:o}={}){return u=>{const c=u.getClientKey();if(!c)throw new Error(\"clientKey must be specified to use event logging\");const a=new Set;if(\"setEventLogger\"in u){let l=[],h=null;const f=async()=>{const t=l;l=[],h&&clearTimeout(h),h=null,t.length&&await async function({clientKey:t,ingestorHost:e,events:n}){if(!n.length)return;const r=`${e||\"https://us1.gb-ingest.com\"}/track?client_key=${t}`,i=JSON.stringify(n);try{await fetch(r,{method:\"POST\",body:i,headers:{Accept:\"application/json\",\"Content-Type\":\"text/plain\"},credentials:\"omit\"})}catch(t){console.error(\"Failed to track event\",t)}}({clientKey:c,events:t,ingestorHost:e})};let d=null;u.setEventLogger((async(e,u,c)=>{const w={eventName:e,properties:u,attributes:c.attributes||{},url:c.url||\"\"};if(o&&!o(w))return;if(e===Ot||e===Tt){const t={eventName:e,properties:u};for(const e of s)t[\"attr:\"+e]=w.attributes[e];const n=JSON.stringify(t);if(a.has(n))return a.delete(n),void a.add(n);if(a.add(n),a.size>i){const t=a.values().next().value;t&&a.delete(t)}}const y=function({eventName:t,properties:e,attributes:n,url:r}){const{nested:i,topLevel:s}=function(t){const{user_id:e,device_id:n,anonymous_id:r,id:i,page_id:s,session_id:o,utmCampaign:u,utmContent:c,utmMedium:a,utmSource:l,utmTerm:h,pageTitle:f,...d}=t;return{nested:d,topLevel:{user_id:ee(e),device_id:ee(n||r||i),page_id:ee(s),session_id:ee(o),utm_campaign:ee(u)||void 0,utm_content:ee(c)||void 0,utm_medium:ee(a)||void 0,utm_source:ee(l)||void 0,utm_term:ee(h)||void 0,page_title:ee(f)||void 0}}}(n||{});return{event_name:t,properties_json:e||{},...s,sdk_language:\"js\",sdk_version:te,url:r,context_json:i}}(w);r&&console.log(\"Logging event to GrowthBook\",JSON.parse(JSON.stringify(y))),n&&(l.push(y),d||(d=new Promise(((e,n)=>{h=setTimeout((()=>{f().then(e).catch(n),d=null}),t)}))),await d)})),\"undefined\"!=typeof document&&document.visibilityState&&document.addEventListener(\"visibilitychange\",(()=>{\"hidden\"===document.visibilityState&&f().catch(console.error)})),\"onDestroy\"in u&&u.onDestroy((()=>{f().catch(console.error)}))}if(\"undefined\"!=typeof window&&!(\"createScopedInstance\"in u)){const t=Array.isArray(window.gbEvents)?window.gbEvents:[];window.gbEvents={push:t=>{\"isDestroyed\"in u&&u.isDestroyed()?window.gbEvents=[t]:\"string\"==typeof t?u.logEvent(t):t&&u.logEvent(t.eventName,t.properties)}};for(const e of t)window.gbEvents.push(e)}}}({ingestorHost:re.eventIngestorHost})),ie.trackingCallback||le.push(function({additionalCallback:t,trackers:e=[\"gtag\",\"gtm\",\"segment\"]}={}){if(\"undefined\"==typeof window)throw new Error(\"thirdPartyTrackingPlugin only works in the browser\");return n=>{n.setTrackingCallback((async(n,r)=>{const i=[],s={experiment_id:n.key,variation_id:r.key};if(t&&i.push(Promise.resolve(t(n,r))),e.includes(\"gtag\")&&window.gtag){let t;const e=new Promise((e=>{t=e}));i.push(e),window.gtag(\"event\",\"experiment_viewed\",{...s,event_callback:t})}if(e.includes(\"gtm\")&&window.dataLayer){let t;const e=new Promise((e=>{t=e}));i.push(e),window.dataLayer.push({event:\"experiment_viewed\",...s,eventCallback:t})}if(e.includes(\"segment\")&&window.analytics&&window.analytics.track){window.analytics.track(\"Experiment Viewed\",s);const t=new Promise((t=>window.setTimeout(t,300)));i.push(t)}await Promise.all(i)}))}}({additionalCallback:ie.additionalTrackingCallback,trackers:t}))}const fe=new class{constructor(t){if(t=t||{},this.version=Gt,this.i=this.context=t,this.o=t.renderer||null,this.u=new Set,this.l=new Set,this.h={},this.debug=!!t.debug,this.p=new Set,this.ready=!1,this.g=new Map,this.m=new Map,this.v=new Set,this.k=!1,this.S=\"\",this.A=new Map,this._=!t.disableExperimentsOnLoad,this.$=[],this.logs=[],this.log=this.log.bind(this),this.C=this.C.bind(this),this.O=this.O.bind(this),this.T=this.T.bind(this),this.N=this.N.bind(this),t.remoteEval){if(t.decryptionKey)throw new Error(\"Encryption is not available for remoteEval\");if(!t.clientKey)throw new Error(\"Missing clientKey\");let e=!1;try{e=!!new URL(t.apiHost||\"\").hostname.match(/growthbook\\.io$/i)}catch(t){}if(e)throw new Error(\"Cannot use remoteEval on GrowthBook Cloud\")}else if(t.cacheKeyAttributes)throw new Error(\"cacheKeyAttributes are only used for remoteEval\");if(t.stickyBucketService){const e=t.stickyBucketService;this.D=t=>e.saveAssignments(t)}if(t.plugins)for(const e of t.plugins)e(this);if(t.features&&(this.ready=!0),qt&&t.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event(\"gbloaded\"))),t.experiments&&(this.ready=!0,this.F()),this.i.stickyBucketService&&this.i.stickyBucketAssignmentDocs)for(const t in this.i.stickyBucketAssignmentDocs){const e=this.i.stickyBucketAssignmentDocs[t];e&&this.i.stickyBucketService.saveAssignments(e).catch((()=>{}))}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(t){this.M=t;const e=await async function(t,e,n){if((t={...t}).encryptedFeatures){try{t.features=JSON.parse(await P(t.encryptedFeatures,e,n))}catch(t){console.error(t)}delete t.encryptedFeatures}if(t.encryptedExperiments){try{t.experiments=JSON.parse(await P(t.encryptedExperiments,e,n))}catch(t){console.error(t)}delete t.encryptedExperiments}if(t.encryptedSavedGroups){try{t.savedGroups=JSON.parse(await P(t.encryptedSavedGroups,e,n))}catch(t){console.error(t)}delete t.encryptedSavedGroups}return t}(t,this.i.decryptionKey);this.R=e,await this.refreshStickyBuckets(e),e.features&&(this.i.features=e.features),e.savedGroups&&(this.i.savedGroups=e.savedGroups),e.experiments&&(this.i.experiments=e.experiments,this.F()),this.ready=!0,this.B()}initSync(t){this.k=!0;const e=t.payload;if(e.encryptedExperiments||e.encryptedFeatures)throw new Error(\"initSync does not support encrypted payloads\");return this.i.stickyBucketService&&!this.i.stickyBucketAssignmentDocs&&(this.i.stickyBucketAssignmentDocs=this.generateStickyBucketAssignmentDocsSync(this.i.stickyBucketService,e)),this.M=e,this.R=e,e.features&&(this.i.features=e.features),e.experiments&&(this.i.experiments=e.experiments,this.F()),this.ready=!0,gt(this,t),this}async init(t){if(this.k=!0,(t=t||{}).cacheSettings&&(Object.assign(Z,t.cacheSettings),Z.backgroundSync||pt()),t.payload)return await this.setPayload(t.payload),gt(this,t),{success:!0,source:\"init\"};{const{data:e,...n}=await this.I({...t,allowStale:!0});return gt(this,t),await this.setPayload(e||{}),n}}async loadFeatures(t){t=t||{},await this.init({skipCache:t.skipCache,timeout:t.timeout,streaming:(this.i.backgroundSync??!0)&&(t.autoRefresh||this.i.subscribeToChanges)})}async refreshFeatures(t){const e=await this.I({...t||{},allowStale:!1});e.data&&await this.setPayload(e.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return function(t){const e=t.apiHost||\"https://cdn.growthbook.io\";return{apiHost:e.replace(/\\/*$/,\"\"),streamingHost:(t.streamingHost||e).replace(/\\/*$/,\"\"),apiRequestHeaders:t.apiHostRequestHeaders,streamingHostRequestHeaders:t.streamingHostRequestHeaders}}(this.i)}getClientKey(){return this.i.clientKey||\"\"}getPayload(){return this.M||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this.R||this.getPayload()}isRemoteEval(){return this.i.remoteEval||!1}getCacheKeyAttributes(){return this.i.cacheKeyAttributes}async I({timeout:t,skipCache:e,allowStale:n,streaming:r}){if(!this.i.clientKey)throw new Error(\"Missing clientKey\");return async function({instance:t,timeout:e,skipCache:n,allowStale:r,backgroundSync:i}){return i||(Z.backgroundSync=!1),async function({instance:t,allowStale:e,timeout:n,skipCache:r}){const i=ot(t),s=ut(t),o=new Date,u=new Date(o.getTime()-Z.maxAge+Z.staleTTL);await async function(){if(!Y){Y=!0;try{if(Q.localStorage){const t=await Q.localStorage.getItem(Z.cacheKey);if(!Z.disableCache&&t){const e=JSON.parse(t);e&&Array.isArray(e)&&e.forEach((([t,e])=>{tt.set(t,{...e,staleAt:new Date(e.staleAt)})})),ct()}}}catch(t){}if(!Z.disableIdleStreams){const t=W.startIdleListener();t&&(W.stopIdleListener=t)}}}();const c=Z.disableCache||r?void 0:tt.get(s);return c&&(e||c.staleAt>o)&&c.staleAt>u?(c.sse&&rt.add(i),c.staleAt<o?lt(t):ht(t),{data:c.data,success:!0,source:\"cache\"}):await z(lt(t),n)||{data:null,success:!1,source:\"timeout\",error:new Error(\"Timeout\")}}({instance:t,allowStale:r,timeout:e,skipCache:n})}({instance:this,timeout:t,skipCache:e||this.i.disableCache,allowStale:n,backgroundSync:r??this.i.backgroundSync??!0})}B(){if(this.o)try{this.o()}catch(t){console.error(\"Failed to render\",t)}}setFeatures(t){this.i.features=t,this.ready=!0,this.B()}async setEncryptedFeatures(t,e,n){const r=await P(t,e||this.i.decryptionKey,n);this.setFeatures(JSON.parse(r))}setExperiments(t){this.i.experiments=t,this.ready=!0,this.F()}async setEncryptedExperiments(t,e,n){const r=await P(t,e||this.i.decryptionKey,n);this.setExperiments(JSON.parse(r))}async setAttributes(t){this.i.attributes=t,this.i.stickyBucketService&&await this.refreshStickyBuckets(),this.i.remoteEval?await this.U():(this.B(),this.F())}async updateAttributes(t){return this.setAttributes({...this.i.attributes,...t})}async setAttributeOverrides(t){this.i.attributeOverrides=t,this.i.stickyBucketService&&await this.refreshStickyBuckets(),this.i.remoteEval?await this.U():(this.B(),this.F())}async setForcedVariations(t){this.i.forcedVariations=t||{},this.i.remoteEval?await this.U():(this.B(),this.F())}setForcedFeatures(t){this.i.forcedFeatureValues=t,this.B()}async setURL(t){if(t!==this.i.url){if(this.i.url=t,this.S=\"\",this.i.remoteEval)return await this.U(),void this.F(!0);this.F(!0)}}getAttributes(){return{...this.i.attributes,...this.i.attributeOverrides}}getForcedVariations(){return this.i.forcedVariations||{}}getForcedFeatures(){return this.i.forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this.i.stickyBucketAssignmentDocs||{}}getUrl(){return this.i.url||\"\"}getFeatures(){return this.i.features||{}}getExperiments(){return this.i.experiments||[]}getCompletedChangeIds(){return Array.from(this.l)}subscribe(t){return this.p.add(t),()=>{this.p.delete(t)}}async U(){if(!this.i.remoteEval)return;if(!this.k)return;const t=await this.I({allowStale:!1});t.data&&await this.setPayload(t.data)}getAllResults(){return new Map(this.g)}onDestroy(t){this.$.push(t)}isDestroyed(){return!!this.V}destroy(t){var e;t=t||{},this.V=!0,this.$.forEach((t=>{try{t()}catch(t){console.error(t)}})),this.p.clear(),this.g.clear(),this.u.clear(),this.l.clear(),this.A.clear(),this.h={},this.$=[],this.M=void 0,this.D=void 0,e=this,X.forEach((t=>t.delete(e))),t.destroyAllStreams&&pt(),this.logs=[],qt&&window._growthbook===this&&delete window._growthbook,this.m.forEach((t=>{t.undo()})),this.m.clear(),this.v.clear()}setRenderer(t){this.o=t}forceVariation(t,e){this.i.forcedVariations=this.i.forcedVariations||{},this.i.forcedVariations[t]=e,this.i.remoteEval?this.U():(this.F(),this.B())}run(t){const{result:e}=Mt(t,null,this.j());return this.O(t,e),e}triggerExperiment(t){return this.v.add(t),this.i.experiments?this.i.experiments.filter((e=>e.key===t)).map((t=>this.J(t))).filter((t=>null!==t)):null}triggerAutoExperiments(){this._=!0,this.F(!0)}j(){return{user:this.P(),global:this.L(),stack:{evaluatedFeatures:new Set}}}P(){return{attributes:this.i.user?{...this.i.user,...this.i.attributes}:this.i.attributes,enableDevMode:this.i.enableDevMode,blockedChangeIds:this.i.blockedChangeIds,stickyBucketAssignmentDocs:this.i.stickyBucketAssignmentDocs,url:this.K(),forcedVariations:this.i.forcedVariations,forcedFeatureValues:this.i.forcedFeatureValues,attributeOverrides:this.i.attributeOverrides,saveStickyBucketAssignmentDoc:this.D,trackingCallback:this.i.trackingCallback,onFeatureUsage:this.i.onFeatureUsage,devLogs:this.logs,trackedExperiments:this.u,trackedFeatureUsage:this.h}}L(){return{features:this.i.features,experiments:this.i.experiments,log:this.log,enabled:this.i.enabled,qaMode:this.i.qaMode,savedGroups:this.i.savedGroups,groups:this.i.groups,overrides:this.i.overrides,onExperimentEval:this.O,recordChangeId:this.N,saveDeferredTrack:this.C,eventLogger:this.i.eventLogger}}J(t,e){const n=this.m.get(t);if(t.manual&&!this.v.has(t.key)&&!n)return null;let r,i;this.H(t)?r=jt(this.j(),t,-1,!1,\"\"):(({result:r,trackingCall:i}=Mt(t,null,this.j())),this.O(t,r));const s=JSON.stringify(r.value);if(!e&&r.inExperiment&&n&&n.valueHash===s)return r;if(n&&this.q(t),r.inExperiment){const e=G(t);if(\"redirect\"===e&&r.value.urlRedirect&&t.urlPatterns){const e=t.persistQueryString?function(t,e){let n,r;try{n=new URL(t),r=new URL(e)}catch(t){return console.error(`Unable to merge query strings: ${t}`),e}return n.searchParams.forEach(((t,e)=>{r.searchParams.has(e)||r.searchParams.set(e,t)})),r.toString()}(this.K(),r.value.urlRedirect):r.value.urlRedirect;if(V(e,t.urlPatterns))return this.log(\"Skipping redirect because original URL matches redirect URL\",{id:t.key}),r;this.S=e;const{navigate:n,delay:s}=this.G();if(n)if(qt)Promise.all([...i?[z(i,this.i.maxNavigateDelay??1e3)]:[],new Promise((t=>window.setTimeout(t,this.i.navigateDelay??s)))]).then((()=>{try{n(e)}catch(t){console.error(t)}}));else try{n(e)}catch(t){console.error(t)}}else if(\"visual\"===e){const e=this.i.applyDomChangesCallback?this.i.applyDomChangesCallback(r.value):this.Z(r.value);e&&this.m.set(t,{undo:e,valueHash:s})}}return r}q(t){const e=this.m.get(t);e&&(e.undo(),this.m.delete(t))}F(t){if(!this._)return;const e=this.i.experiments||[],n=new Set(e);this.m.forEach(((t,e)=>{n.has(e)||(t.undo(),this.m.delete(e))}));for(const n of e){const e=this.J(n,t);if(e&&e.inExperiment&&\"redirect\"===G(n))break}}O(t,e){const n=this.g.get(t.key);this.g.set(t.key,{experiment:t,result:e}),this.p.size>0&&this.T(t,e,n)}T(t,e,n){n&&n.result.inExperiment===e.inExperiment&&n.result.variationId===e.variationId||this.p.forEach((n=>{try{n(t,e)}catch(t){console.error(t)}}))}N(t){this.l.add(t)}isOn(t){return this.evalFeature(t).on}isOff(t){return this.evalFeature(t).off}getFeatureValue(t,e){const n=this.evalFeature(t).value;return null===n?e:n}feature(t){return this.evalFeature(t)}evalFeature(t){return Ft(t,this.j())}log(t,e){this.debug&&(this.i.log?this.i.log(t,e):console.log(t,e))}getDeferredTrackingCalls(){return Array.from(this.A.values())}setDeferredTrackingCalls(t){this.A=new Map(t.filter((t=>t&&t.experiment&&t.result)).map((t=>[Ht(t.experiment,t.result),t])))}async fireDeferredTrackingCalls(){if(!this.i.trackingCallback)return;const t=[];this.A.forEach((e=>{e&&e.experiment&&e.result?t.push(this.i.trackingCallback(e.experiment,e.result)):console.error(\"Invalid deferred tracking call\",{call:e})})),this.A.clear(),await Promise.all(t)}setTrackingCallback(t){this.i.trackingCallback=t,this.fireDeferredTrackingCalls()}setEventLogger(t){this.i.eventLogger=t}async logEvent(t,e){if(this.V)console.error(\"Cannot log event to destroyed GrowthBook instance\");else if(this.i.enableDevMode&&this.logs.push({eventName:t,properties:e,timestamp:Date.now().toString(),logType:\"event\"}),this.i.eventLogger)try{await this.i.eventLogger(t,e||{},this.P())}catch(t){console.error(t)}else console.error(\"No event logger configured\")}C(t){this.A.set(Ht(t.experiment,t.result),t)}K(){return this.i.url||(qt?window.location.href:\"\")}H(t){const e=G(t);if(\"visual\"===e){if(this.i.disableVisualExperiments)return!0;if(this.i.disableJsInjection&&t.variations.some((t=>t.js)))return!0}else{if(\"redirect\"!==e)return!0;if(this.i.disableUrlRedirectExperiments)return!0;try{const e=new URL(this.K());for(const n of t.variations){if(!n||!n.urlRedirect)continue;const t=new URL(n.urlRedirect);if(this.i.disableCrossOriginUrlRedirectExperiments){if(t.protocol!==e.protocol)return!0;if(t.host!==e.host)return!0}}}catch(e){return this.log(\"Error parsing current or redirect URL\",{id:t.key,error:e}),!0}}return!(!t.changeId||!(this.i.blockedChangeIds||[]).includes(t.changeId))}getRedirectUrl(){return this.S}G(){return this.i.navigate?{navigate:this.i.navigate,delay:0}:qt?{navigate:t=>{window.location.replace(t)},delay:100}:{navigate:null,delay:0}}Z(t){if(!qt)return;const e=[];if(t.css){const n=document.createElement(\"style\");n.innerHTML=t.css,document.head.appendChild(n),e.push((()=>n.remove()))}if(t.js){const n=document.createElement(\"script\");n.innerHTML=t.js,this.i.jsInjectionNonce&&(n.nonce=this.i.jsInjectionNonce),document.head.appendChild(n),e.push((()=>n.remove()))}return t.domMutations&&t.domMutations.forEach((t=>{e.push(function(t){var e=t.selector,n=t.action,i=t.value,s=t.attribute,o=t.parentSelector,u=t.insertBeforeSelector;if(\"html\"===s){if(\"append\"===n)return N(e,(function(t){return t+(null!=i?i:\"\")}));if(\"set\"===n)return N(e,(function(){return null!=i?i:\"\"}))}else if(\"class\"===s){if(\"append\"===n)return D(e,(function(t){i&&t.add(i)}));if(\"remove\"===n)return D(e,(function(t){i&&t.delete(i)}));if(\"set\"===n)return D(e,(function(t){t.clear(),i&&t.add(i)}))}else if(\"position\"===s){if(\"set\"===n&&o)return function(t,e){return T({kind:\"position\",elements:new Set,mutate:function(){return{insertBeforeSelector:u,parentSelector:o}},selector:t})}(e)}else{if(\"append\"===n)return F(e,s,(function(t){return null!==t?t+(null!=i?i:\"\"):null!=i?i:\"\"}));if(\"set\"===n)return F(e,s,(function(){return null!=i?i:\"\"}));if(\"remove\"===n)return F(e,s,(function(){return null}))}return r}(t).revert)})),()=>{e.forEach((t=>t()))}}async refreshStickyBuckets(t){if(this.i.stickyBucketService){const e=this.j(),n=await async function(t,e,n){const r=Kt(t,n);return e.getAllAssignments(r)}(e,this.i.stickyBucketService,t);this.i.stickyBucketAssignmentDocs=n}}generateStickyBucketAssignmentDocsSync(t,e){if(!(\"getAllAssignmentsSync\"in t))return void console.error(\"generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync\");const n=Kt(this.j(),e);return t.getAllAssignmentsSync(n)}inDevMode(){return!!this.i.enableDevMode}}({enableDevMode:!0,...re,remoteEval:!!re.remoteEval,...ie,plugins:le,stickyBucketService:oe});fe.setRenderer((()=>{document.dispatchEvent(new CustomEvent(\"growthbookdata\"))})),fe.init({payload:ie.payload,streaming:!(ie.noStreaming||re.noStreaming||!1===ie.backgroundSync),cacheSettings:ie.cacheSettings}).then((()=>{(ie.antiFlicker||re.antiFlicker)&&(fe.getRedirectUrl()?ue():ce())}));const de=t=>{try{t&&t(fe)}catch(t){console.error(\"Uncaught growthbook_queue error\",t)}};return window.growthbook_queue&&Array.isArray(window.growthbook_queue)&&window.growthbook_queue.forEach((t=>{de(t)})),window.growthbook_queue={push:t=>{de(t)}},fe}();\n//# sourceMappingURL=auto.min.js.map\n";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.sdkWrapper = void 0;
|
|
4
|
-
exports.sdkWrapper = "var _growthbook=function(){\"use strict\";function t(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}var e=function e(n,r){function i(e,i,s){if(\"undefined\"!=typeof document){\"number\"==typeof(s=t({},r,s)).expires&&(s.expires=new Date(Date.now()+864e5*s.expires)),s.expires&&(s.expires=s.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o=\"\";for(var u in s)s[u]&&(o+=\"; \"+u,!0!==s[u]&&(o+=\"=\"+s[u].split(\";\")[0]));return document.cookie=e+\"=\"+n.write(i,e)+o}}return Object.create({set:i,get:function(t){if(\"undefined\"!=typeof document&&(!arguments.length||t)){for(var e=document.cookie?document.cookie.split(\"; \"):[],r={},i=0;i<e.length;i++){var s=e[i].split(\"=\"),o=s.slice(1).join(\"=\");try{var u=decodeURIComponent(s[0]);if(r[u]=n.read(o,u),t===u)break}catch(t){}}return t?r[t]:r}},remove:function(e,n){i(e,\"\",t({},n,{expires:-1}))},withAttributes:function(n){return e(this.converter,t({},this.attributes,n))},withConverter:function(n){return e(t({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(n)}})}({read:function(t){return\'\"\'===t[0]&&(t=t.slice(1,-1)),t.replace(/(%[\\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:\"/\"}),n=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,r={revert:function(){}},i=new Map,s=new Set;function o(t){var e=i.get(t);return e||i.set(t,e={element:t,attributes:{}}),e}function u(t,e,n,r,i){var s=n(t),o={isDirty:!1,originalValue:s,virtualValue:s,mutations:[],el:t,t:null,observer:new MutationObserver((function(){if(\"position\"!==e||!o.t){\"position\"===e&&(o.t=setTimeout((function(){o.t=null}),1e3));var r=n(t);\"position\"===e&&r.parentNode===o.virtualValue.parentNode&&r.insertBeforeNode===o.virtualValue.insertBeforeNode||r!==o.virtualValue&&(o.originalValue=r,i(o))}})),mutationRunner:i,setValue:r,getCurrentValue:n};return\"position\"===e&&t.parentNode?o.observer.observe(t.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):o.observer.observe(t,function(t){return\"html\"===t?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[t]}}(e)),o}function c(t,e){var n=e.getCurrentValue(e.el);e.virtualValue=t,t&&\"string\"!=typeof t?n&&t.parentNode===n.parentNode&&t.insertBeforeNode===n.insertBeforeNode||(e.isDirty=!0,C()):t!==n&&(e.isDirty=!0,C())}function a(t){var e=t.originalValue;t.mutations.forEach((function(t){return e=t.mutate(e)})),c(function(t){return v||(v=document.createElement(\"div\")),v.innerHTML=t,v.innerHTML}(e),t)}function l(t){var e=new Set(t.originalValue.split(/\\s+/).filter(Boolean));t.mutations.forEach((function(t){return t.mutate(e)})),c(Array.from(e).filter(Boolean).join(\" \"),t)}function h(t){var e=t.originalValue;t.mutations.forEach((function(t){return e=t.mutate(e)})),c(e,t)}function f(t){var e=t.originalValue;t.mutations.forEach((function(t){var n=function(t){var e=t.insertBeforeSelector,n=document.querySelector(t.parentSelector);if(!n)return null;var r=e?document.querySelector(e):null;return e&&!r?null:{parentNode:n,insertBeforeNode:r}}(t.mutate());e=n||e})),c(e,t)}var d=function(t){return t.innerHTML},w=function(t,e){return t.innerHTML=e};function p(t){var e=o(t);return e.html||(e.html=u(t,\"html\",d,w,a)),e.html}var y=function(t){return{parentNode:t.parentElement,insertBeforeNode:t.nextElementSibling}},g=function(t,e){e.insertBeforeNode&&!e.parentNode.contains(e.insertBeforeNode)||e.parentNode.insertBefore(t,e.insertBeforeNode)};function m(t){var e=o(t);return e.position||(e.position=u(t,\"position\",y,g,f)),e.position}var v,b,k=function(t,e){return e?t.className=e:t.removeAttribute(\"class\")},S=function(t){return t.className};function A(t){var e=o(t);return e.classes||(e.classes=u(t,\"class\",S,k,l)),e.classes}function _(t,e){var n,r=o(t);return r.attributes[e]||(r.attributes[e]=u(t,e,(n=e,function(t){var e;return null!=(e=t.getAttribute(n))?e:null}),function(t){return function(e,n){return null!==n?e.setAttribute(t,n):e.removeAttribute(t)}}(e),h)),r.attributes[e]}function x(t,e,n){if(n.isDirty){n.isDirty=!1;var r=n.virtualValue;n.mutations.length||function(t,e){var n,r,s=i.get(t);if(s)if(\"html\"===e)null==(n=s.html)||null==(r=n.observer)||r.disconnect(),delete s.html;else if(\"class\"===e){var o,u;null==(o=s.classes)||null==(u=o.observer)||u.disconnect(),delete s.classes}else if(\"position\"===e){var c,a;null==(c=s.position)||null==(a=c.observer)||a.disconnect(),delete s.position}else{var l,h,f;null==(l=s.attributes)||null==(h=l[e])||null==(f=h.observer)||f.disconnect(),delete s.attributes[e]}}(t,e),n.setValue(t,r)}}function $(t,e){t.html&&x(e,\"html\",t.html),t.classes&&x(e,\"class\",t.classes),t.position&&x(e,\"position\",t.position),Object.keys(t.attributes).forEach((function(n){x(e,n,t.attributes[n])}))}function C(){i.forEach($)}function E(t){if(\"position\"!==t.kind||1!==t.elements.size){var e=new Set(t.elements);document.querySelectorAll(t.selector).forEach((function(n){e.has(n)||(t.elements.add(n),function(t,e){var n=null;\"html\"===t.kind?n=p(e):\"class\"===t.kind?n=A(e):\"attribute\"===t.kind?n=_(e,t.attribute):\"position\"===t.kind&&(n=m(e)),n&&(n.mutations.push(t),n.mutationRunner(n))}(t,n))}))}}function O(){s.forEach(E)}function T(t){return\"undefined\"==typeof document?r:(s.add(t),E(t),{revert:function(){var e;(e=t).elements.forEach((function(t){return function(t,e){var n=null;if(\"html\"===t.kind?n=p(e):\"class\"===t.kind?n=A(e):\"attribute\"===t.kind?n=_(e,t.attribute):\"position\"===t.kind&&(n=m(e)),n){var r=n.mutations.indexOf(t);-1!==r&&n.mutations.splice(r,1),n.mutationRunner(n)}}(e,t)})),e.elements.clear(),s.delete(e)}})}function N(t,e){return T({kind:\"html\",elements:new Set,mutate:e,selector:t})}function D(t,e){return T({kind:\"class\",elements:new Set,mutate:e,selector:t})}function F(t,e,i){return n.test(e)?\"class\"===e||\"className\"===e?D(t,(function(t){var e=i(Array.from(t).join(\" \"));t.clear(),e&&e.split(/\\s+/g).filter(Boolean).forEach((function(e){return t.add(e)}))})):T({kind:\"attribute\",attribute:e,elements:new Set,mutate:i,selector:t}):r}\"undefined\"!=typeof document&&(b||(b=new MutationObserver((function(){O()}))),O(),b.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}));const M={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function R(t){let e=2166136261;const n=t.length;for(let r=0;r<n;r++)e^=t.charCodeAt(r),e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24);return e>>>0}function B(t,e,n){return 2===n?R(R(t+e)+\"\")%1e4/1e4:1===n?R(e+t)%1e3/1e3:null}function I(t,e){return t>=e[0]&&t<e[1]}function U(t){try{const e=t.replace(/([^\\\\])\\//g,\"$1\\\\/\");return new RegExp(e)}catch(t){return void console.error(t)}}function V(t,e){if(!e.length)return!1;let n=!1,r=!1;for(let i=0;i<e.length;i++){const s=j(t,e[i].type,e[i].pattern);if(!1===e[i].include){if(s)return!1}else n=!0,s&&(r=!0)}return r||!n}function j(t,e,n){try{const r=new URL(t,\"https://_\");if(\"regex\"===e){const t=U(n);return!!t&&(t.test(r.href)||t.test(r.href.substring(r.origin.length)))}return\"simple\"===e&&function(t,e){try{const n=new URL(e.replace(/^([^:/?]*)\\./i,\"https://$1.\").replace(/\\*/g,\"_____\"),\"https://_____\"),r=[[t.host,n.host,!1],[t.pathname,n.pathname,!0]];return n.hash&&r.push([t.hash,n.hash,!1]),n.searchParams.forEach(((e,n)=>{r.push([t.searchParams.get(n)||\"\",e,!1])})),!r.some((t=>!function(t,e,n){try{let r=e.replace(/[*.+?^${}()|[\\]\\\\]/g,\"\\\\$&\").replace(/_____/g,\".*\");return n&&(r=\"\\\\/?\"+r.replace(/(^\\/|\\/$)/g,\"\")+\"\\\\/?\"),new RegExp(\"^\"+r+\"$\",\"i\").test(t)}catch(t){return!1}}(t[0],t[1],t[2])))}catch(t){return!1}}(r,n)}catch(t){return!1}}const J=t=>Uint8Array.from(atob(t),(t=>t.charCodeAt(0)));async function P(t,e,n){if(e=e||\"\",!(n=n||globalThis.crypto&&globalThis.crypto.subtle||M.SubtleCrypto))throw new Error(\"No SubtleCrypto implementation found\");try{const r=await n.importKey(\"raw\",J(e),{name:\"AES-CBC\",length:128},!0,[\"encrypt\",\"decrypt\"]),[i,s]=t.split(\".\"),o=await n.decrypt({name:\"AES-CBC\",iv:J(i)},r,J(s));return(new TextDecoder).decode(o)}catch(t){throw new Error(\"Failed to decrypt\")}}function L(t){return\"string\"==typeof t?t:JSON.stringify(t)}function K(t){\"number\"==typeof t&&(t+=\"\"),t&&\"string\"==typeof t||(t=\"0\");const e=t.replace(/(^v|\\+.*$)/g,\"\").split(/[-.]/);return 3===e.length&&e.push(\"~\"),e.map((t=>t.match(/^[0-9]+$/)?t.padStart(5,\" \"):t)).join(\"-\")}function H(){let t;try{t=\"1.6.1\"}catch(e){t=\"\"}return t}function q(t){return\"object\"==typeof t&&null!==t}function G(t){return t.urlPatterns&&t.variations.some((t=>q(t)&&\"urlRedirect\"in t))?\"redirect\":t.variations.some((t=>q(t)&&(t.domMutations||\"js\"in t||\"css\"in t)))?\"visual\":\"unknown\"}async function z(t,e){return new Promise((n=>{let r,i=!1;const s=t=>{i||(i=!0,r&&clearTimeout(r),n(t||null))};e&&(r=setTimeout((()=>s()),e)),t.then((t=>s(t))).catch((()=>s()))}))}const Z={staleTTL:6e4,maxAge:144e5,cacheKey:\"gbFeaturesCache\",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},Q=M,W={fetchFeaturesCall:t=>{let{host:e,clientKey:n,headers:r}=t;return Q.fetch(`${e}/api/features/${n}`,{headers:r})},fetchRemoteEvalCall:t=>{let{host:e,clientKey:n,payload:r,headers:i}=t;const s={method:\"POST\",headers:{\"Content-Type\":\"application/json\",...i},body:JSON.stringify(r)};return Q.fetch(`${e}/api/eval/${n}`,s)},eventSourceCall:t=>{let{host:e,clientKey:n,headers:r}=t;return r?new Q.EventSource(`${e}/sub/${n}`,{headers:r}):new Q.EventSource(`${e}/sub/${n}`)},startIdleListener:()=>{let t;if(\"undefined\"==typeof window||\"undefined\"==typeof document)return;const e=()=>{\"visible\"===document.visibilityState?(window.clearTimeout(t),nt.forEach((t=>{t&&\"idle\"===t.state&&wt(t)}))):\"hidden\"===document.visibilityState&&(t=window.setTimeout(it,Z.idleStreamInterval))};return document.addEventListener(\"visibilitychange\",e),()=>document.removeEventListener(\"visibilitychange\",e)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(Q.localStorage=globalThis.localStorage)}catch(t){}const X=new Map;let Y=!1;const tt=new Map,et=new Map,nt=new Map,rt=new Set;function it(){nt.forEach((t=>{t&&(t.state=\"idle\",dt(t))}))}async function st(){try{if(!Q.localStorage)return;await Q.localStorage.setItem(Z.cacheKey,JSON.stringify(Array.from(tt.entries())))}catch(t){}}function ot(t){const[e,n]=t.getApiInfo();return`${e}||${n}`}function ut(t){const e=ot(t);if(!(\"isRemoteEval\"in t)||!t.isRemoteEval())return e;const n=t.getAttributes(),r=t.getCacheKeyAttributes()||Object.keys(t.getAttributes()),i={};r.forEach((t=>{i[t]=n[t]}));const s=t.getForcedVariations(),o=t.getUrl();return`${e}||${JSON.stringify({ca:i,fv:s,url:o})}`}function ct(){const t=Array.from(tt.entries()).map((t=>{let[e,n]=t;return{key:e,staleAt:n.staleAt.getTime()}})).sort(((t,e)=>t.staleAt-e.staleAt)),e=Math.min(Math.max(0,tt.size-Z.maxEntries),tt.size);for(let n=0;n<e;n++)tt.delete(t[n].key)}function at(t,e,n){const r=n.dateUpdated||\"\",i=new Date(Date.now()+Z.staleTTL),s=Z.disableCache?void 0:tt.get(e);if(s&&r&&s.version===r)return s.staleAt=i,void st();Z.disableCache||(tt.set(e,{data:n,version:r,staleAt:i,sse:rt.has(t)}),ct()),st();const o=X.get(t);o&&o.forEach((t=>async function(t,e){await t.setPayload(e||t.getPayload())}(t,n)))}async function lt(t){const{apiHost:e,apiRequestHeaders:n}=t.getApiHosts(),r=t.getClientKey(),i=\"isRemoteEval\"in t&&t.isRemoteEval(),s=ot(t),o=ut(t);let u=et.get(o);return u||(u=(i?W.fetchRemoteEvalCall({host:e,clientKey:r,payload:{attributes:t.getAttributes(),forcedVariations:t.getForcedVariations(),forcedFeatures:Array.from(t.getForcedFeatures().entries()),url:t.getUrl()},headers:n}):W.fetchFeaturesCall({host:e,clientKey:r,headers:n})).then((t=>{if(!t.ok)throw new Error(`HTTP error: ${t.status}`);return\"enabled\"===t.headers.get(\"x-sse-support\")&&rt.add(s),t.json()})).then((e=>(at(s,o,e),ht(t),et.delete(o),{data:e,success:!0,source:\"network\"}))).catch((t=>(et.delete(o),{data:null,source:\"error\",success:!1,error:t}))),et.set(o,u)),u}function ht(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=ot(t),r=ut(t),{streamingHost:i,streamingHostRequestHeaders:s}=t.getApiHosts(),o=t.getClientKey();if(e&&rt.add(n),Z.backgroundSync&&rt.has(n)&&Q.EventSource){if(nt.has(n))return;const t={src:null,host:i,clientKey:o,headers:s,cb:e=>{try{if(\"features-updated\"===e.type){const t=X.get(n);t&&t.forEach((t=>{lt(t)}))}else if(\"features\"===e.type){const t=JSON.parse(e.data);at(n,r,t)}t.errors=0}catch(e){ft(t)}},errors:0,state:\"active\"};nt.set(n,t),wt(t)}}function ft(t){if(\"idle\"!==t.state&&(t.errors++,t.errors>3||t.src&&2===t.src.readyState)){const e=Math.pow(3,t.errors-3)*(1e3+1e3*Math.random());dt(t),setTimeout((()=>{[\"idle\",\"active\"].includes(t.state)||wt(t)}),Math.min(e,3e5))}}function dt(t){t.src&&(t.src.onopen=null,t.src.onerror=null,t.src.close(),t.src=null,\"active\"===t.state&&(t.state=\"disabled\"))}function wt(t){t.src=W.eventSourceCall({host:t.host,clientKey:t.clientKey,headers:t.headers}),t.state=\"active\",t.src.addEventListener(\"features\",t.cb),t.src.addEventListener(\"features-updated\",t.cb),t.src.onerror=()=>ft(t),t.src.onopen=()=>{t.errors=0}}function pt(t,e){dt(t),nt.delete(e)}function yt(t,e){if(e.streaming){if(!t.getClientKey())throw new Error(\"Must specify clientKey to enable streaming\");e.payload&&ht(t,!0),function(t){const e=ot(t),n=X.get(e)||new Set;n.add(t),X.set(e,n)}(t)}}const gt={};function mt(t,e,n){n=n||{};for(const[r,i]of Object.entries(e))switch(r){case\"$or\":if(!_t(t,i,n))return!1;break;case\"$nor\":if(_t(t,i,n))return!1;break;case\"$and\":if(!xt(t,i,n))return!1;break;case\"$not\":if(mt(t,i,n))return!1;break;default:if(!bt(i,vt(t,r),n))return!1}return!0}function vt(t,e){const n=e.split(\".\");let r=t;for(let t=0;t<n.length;t++){if(!r||\"object\"!=typeof r||!(n[t]in r))return null;r=r[n[t]]}return r}function bt(t,e,n){if(\"string\"==typeof t)return e+\"\"===t;if(\"number\"==typeof t)return 1*e===t;if(\"boolean\"==typeof t)return null!==e&&!!e===t;if(null===t)return null===e;if(Array.isArray(t)||!kt(t))return JSON.stringify(e)===JSON.stringify(t);for(const r in t)if(!At(r,e,t[r],n))return!1;return!0}function kt(t){const e=Object.keys(t);return e.length>0&&e.filter((t=>\"$\"===t[0])).length===e.length}function St(t,e){return Array.isArray(t)?t.some((t=>e.includes(t))):e.includes(t)}function At(t,e,n,r){switch(t){case\"$veq\":return K(e)===K(n);case\"$vne\":return K(e)!==K(n);case\"$vgt\":return K(e)>K(n);case\"$vgte\":return K(e)>=K(n);case\"$vlt\":return K(e)<K(n);case\"$vlte\":return K(e)<=K(n);case\"$eq\":return e===n;case\"$ne\":return e!==n;case\"$lt\":return e<n;case\"$lte\":return e<=n;case\"$gt\":return e>n;case\"$gte\":return e>=n;case\"$exists\":return n?null!=e:null==e;case\"$in\":return!!Array.isArray(n)&&St(e,n);case\"$inGroup\":return St(e,r[n]||[]);case\"$notInGroup\":return!St(e,r[n]||[]);case\"$nin\":return!!Array.isArray(n)&&!St(e,n);case\"$not\":return!bt(n,e,r);case\"$size\":return!!Array.isArray(e)&&bt(n,e.length,r);case\"$elemMatch\":return function(t,e,n){if(!Array.isArray(t))return!1;const r=kt(e)?t=>bt(e,t,n):t=>mt(t,e,n);for(let e=0;e<t.length;e++)if(t[e]&&r(t[e]))return!0;return!1}(e,n,r);case\"$all\":if(!Array.isArray(e))return!1;for(let t=0;t<n.length;t++){let i=!1;for(let s=0;s<e.length;s++)if(bt(n[t],e[s],r)){i=!0;break}if(!i)return!1}return!0;case\"$regex\":try{return(i=n,gt[i]||(gt[i]=new RegExp(i.replace(/([^\\\\])\\//g,\"$1\\\\/\"))),gt[i]).test(e)}catch(t){return!1}case\"$type\":return function(t){if(null===t)return\"null\";if(Array.isArray(t))return\"array\";const e=typeof t;return[\"string\",\"number\",\"boolean\",\"object\",\"undefined\"].includes(e)?e:\"unknown\"}(e)===n;default:return console.error(\"Unknown operator: \"+t),!1}var i}function _t(t,e,n){if(!e.length)return!0;for(let r=0;r<e.length;r++)if(mt(t,e[r],n))return!0;return!1}function xt(t,e,n){for(let r=0;r<e.length;r++)if(!mt(t,e[r],n))return!1;return!0}const $t=\"Feature Evaluated\",Ct=\"Experiment Viewed\";async function Et(t){try{await t()}catch(t){}}function Ot(t,e,n){if(t.user.trackedExperiments){const r=Pt(e,n);if(t.user.trackedExperiments.has(r))return[];t.user.trackedExperiments.add(r)}t.user.enableDevMode&&t.user.devLogs&&t.user.devLogs.push({experiment:e,result:n,timestamp:Date.now().toString(),logType:\"experiment\"});const r=[];if(t.global.trackingCallback){const i=t.global.trackingCallback;r.push(Et((()=>i(e,n,t.user))))}if(t.user.trackingCallback){const i=t.user.trackingCallback;r.push(Et((()=>i(e,n))))}if(t.global.eventLogger){const i=t.global.eventLogger;r.push(Et((()=>i(Ct,{experimentId:e.key,variationId:n.key,hashAttribute:n.hashAttribute,hashValue:n.hashValue},t.user))))}return r}function Tt(t,e){if(e.stack.evaluatedFeatures.has(t))return Dt(e,t,null,\"cyclicPrerequisite\");e.stack.evaluatedFeatures.add(t),e.stack.id=t;const n=function(t){const e=new Map;return t.global.forcedFeatureValues&&t.global.forcedFeatureValues.forEach(((t,n)=>e.set(n,t))),t.user.forcedFeatureValues&&t.user.forcedFeatureValues.forEach(((t,n)=>e.set(n,t))),e}(e);if(n.has(t))return Dt(e,t,n.get(t),\"override\");if(!e.global.features||!e.global.features[t])return Dt(e,t,null,\"unknownFeature\");const r=e.global.features[t];if(r.rules){const n=new Set(e.stack.evaluatedFeatures);t:for(const i of r.rules){if(i.parentConditions)for(const r of i.parentConditions){e.stack.evaluatedFeatures=new Set(n);const i=Tt(r.id,e);if(\"cyclicPrerequisite\"===i.source)return Dt(e,t,null,\"cyclicPrerequisite\");if(!mt({value:i.value},r.condition||{})){if(r.gate)return Dt(e,t,null,\"prerequisite\");continue t}}if(i.filters&&Rt(i.filters,e))continue;if(\"force\"in i){if(i.condition&&!Mt(i.condition,e))continue;if(!Bt(e,i.seed||t,i.hashAttribute,e.user.saveStickyBucketAssignmentDoc&&!i.disableStickyBucketing?i.fallbackAttribute:void 0,i.range,i.coverage,i.hashVersion))continue;return i.tracks&&i.tracks.forEach((t=>{!Ot(e,t.experiment,t.result).length&&e.global.saveDeferredTrack&&e.global.saveDeferredTrack({experiment:t.experiment,result:t.result})})),Dt(e,t,i.force,\"force\",i.id)}if(!i.variations)continue;const r={variations:i.variations,key:i.key||t};\"coverage\"in i&&(r.coverage=i.coverage),i.weights&&(r.weights=i.weights),i.hashAttribute&&(r.hashAttribute=i.hashAttribute),i.fallbackAttribute&&(r.fallbackAttribute=i.fallbackAttribute),i.disableStickyBucketing&&(r.disableStickyBucketing=i.disableStickyBucketing),void 0!==i.bucketVersion&&(r.bucketVersion=i.bucketVersion),void 0!==i.minBucketVersion&&(r.minBucketVersion=i.minBucketVersion),i.namespace&&(r.namespace=i.namespace),i.meta&&(r.meta=i.meta),i.ranges&&(r.ranges=i.ranges),i.name&&(r.name=i.name),i.phase&&(r.phase=i.phase),i.seed&&(r.seed=i.seed),i.hashVersion&&(r.hashVersion=i.hashVersion),i.filters&&(r.filters=i.filters),i.condition&&(r.condition=i.condition);const{result:s}=Nt(r,t,e);if(e.global.onExperimentEval&&e.global.onExperimentEval(r,s),s.inExperiment&&!s.passthrough)return Dt(e,t,s.value,\"experiment\",i.id,r,s)}}return Dt(e,t,void 0===r.defaultValue?null:r.defaultValue,\"defaultValue\")}function Nt(t,e,n){const r=t.key,i=t.variations.length;if(i<2)return{result:It(n,t,-1,!1,e)};if(!1===n.global.enabled||!1===n.user.enabled)return{result:It(n,t,-1,!1,e)};if(t=function(t,e){const n=t.key,r=e.global.overrides;return r&&r[n]&&\"string\"==typeof(t=Object.assign({},t,r[n])).url&&(t.url=U(t.url)),t}(t,n),t.urlPatterns&&!V(n.user.url||\"\",t.urlPatterns))return{result:It(n,t,-1,!1,e)};const s=function(t,e,n){if(!e)return null;const r=e.split(\"?\")[1];if(!r)return null;const i=r.replace(/#.*/,\"\").split(\"&\").map((t=>t.split(\"=\",2))).filter((e=>{let[n]=e;return n===t})).map((t=>{let[,e]=t;return parseInt(e)}));return i.length>0&&i[0]>=0&&i[0]<n?i[0]:null}(r,n.user.url||\"\",i);if(null!==s)return{result:It(n,t,s,!1,e)};const o=function(t){return t.global.forcedVariations&&t.user.forcedVariations?{...t.global.forcedVariations,...t.user.forcedVariations}:t.global.forcedVariations?t.global.forcedVariations:t.user.forcedVariations?t.user.forcedVariations:{}}(n);if(r in o)return{result:It(n,t,o[r],!1,e)};if(\"draft\"===t.status||!1===t.active)return{result:It(n,t,-1,!1,e)};const{hashAttribute:u,hashValue:c}=Ut(n,t.hashAttribute,n.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing?t.fallbackAttribute:void 0);if(!c)return{result:It(n,t,-1,!1,e)};let a=-1,l=!1,h=!1;if(n.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing){const{variation:e,versionIsBlocked:r}=function(t){let{ctx:e,expKey:n,expBucketVersion:r,expHashAttribute:i,expFallbackAttribute:s,expMinBucketVersion:o,expMeta:u}=t;r=r||0,o=o||0,i=i||\"id\",u=u||[];const c=Vt(n,r),a=function(t,e,n){if(!t.user.stickyBucketAssignmentDocs)return{};const{hashAttribute:r,hashValue:i}=Ut(t,e),s=jt(r,L(i)),{hashAttribute:o,hashValue:u}=Ut(t,n),c=u?jt(o,L(u)):null,a={};return c&&t.user.stickyBucketAssignmentDocs[c]&&Object.assign(a,t.user.stickyBucketAssignmentDocs[c].assignments||{}),t.user.stickyBucketAssignmentDocs[s]&&Object.assign(a,t.user.stickyBucketAssignmentDocs[s].assignments||{}),a}(e,i,s);if(o>0)for(let t=0;t<=o;t++)if(void 0!==a[Vt(n,t)])return{variation:-1,versionIsBlocked:!0};const l=a[c];if(void 0===l)return{variation:-1};const h=u.findIndex((t=>t.key===l));return h<0?{variation:-1}:{variation:h}}({ctx:n,expKey:t.key,expBucketVersion:t.bucketVersion,expHashAttribute:t.hashAttribute,expFallbackAttribute:t.fallbackAttribute,expMinBucketVersion:t.minBucketVersion,expMeta:t.meta});l=e>=0,a=e,h=!!r}if(!l){if(t.filters){if(Rt(t.filters,n))return{result:It(n,t,-1,!1,e)}}else if(t.namespace&&!function(t,e){const n=B(\"__\"+e[0],t,1);return null!==n&&n>=e[1]&&n<e[2]}(c,t.namespace))return{result:It(n,t,-1,!1,e)};if(t.include&&!function(t){try{return t()}catch(t){return console.error(t),!1}}(t.include))return{result:It(n,t,-1,!1,e)};if(t.condition&&!Mt(t.condition,n))return{result:It(n,t,-1,!1,e)};if(t.parentConditions){const r=new Set(n.stack.evaluatedFeatures);for(const i of t.parentConditions){n.stack.evaluatedFeatures=new Set(r);const s=Tt(i.id,n);if(\"cyclicPrerequisite\"===s.source)return{result:It(n,t,-1,!1,e)};if(!mt({value:s.value},i.condition||{}))return{result:It(n,t,-1,!1,e)}}}if(t.groups&&!function(t,e){const n=e.global.groups||{};for(let e=0;e<t.length;e++)if(n[t[e]])return!0;return!1}(t.groups,n))return{result:It(n,t,-1,!1,e)}}if(t.url&&!function(t,e){const n=e.user.url;if(!n)return!1;const r=n.replace(/^https?:\\/\\//,\"\").replace(/^[^/]*\\//,\"/\");return!!t.test(n)||!!t.test(r)}(t.url,n))return{result:It(n,t,-1,!1,e)};const f=B(t.seed||r,c,t.hashVersion||1);if(null===f)return{result:It(n,t,-1,!1,e)};if(l||(a=function(t,e){for(let n=0;n<e.length;n++)if(I(t,e[n]))return n;return-1}(f,t.ranges||function(t,e,n){(e=void 0===e?1:e)<0?e=0:e>1&&(e=1);const r=(i=t)<=0?[]:new Array(i).fill(1/i);var i;(n=n||r).length!==t&&(n=r);const s=n.reduce(((t,e)=>e+t),0);(s<.99||s>1.01)&&(n=r);let o=0;return n.map((t=>{const n=o;return o+=t,[n,n+e*t]}))}(i,void 0===t.coverage?1:t.coverage,t.weights))),h)return{result:It(n,t,-1,!1,e,void 0,!0)};if(a<0)return{result:It(n,t,-1,!1,e)};if(\"force\"in t)return{result:It(n,t,void 0===t.force?-1:t.force,!1,e)};if(n.global.qaMode||n.user.qaMode)return{result:It(n,t,-1,!1,e)};if(\"stopped\"===t.status)return{result:It(n,t,-1,!1,e)};const d=It(n,t,a,!0,e,f,l);if(n.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing){const{changed:e,key:r,doc:i}=function(t,e,n,r){const i=jt(e,n),s=t.user.stickyBucketAssignmentDocs&&t.user.stickyBucketAssignmentDocs[i]&&t.user.stickyBucketAssignmentDocs[i].assignments||{},o={...s,...r};return{key:i,doc:{attributeName:e,attributeValue:n,assignments:o},changed:JSON.stringify(s)!==JSON.stringify(o)}}(n,u,L(c),{[Vt(t.key,t.bucketVersion)]:d.key});e&&(n.user.stickyBucketAssignmentDocs=n.user.stickyBucketAssignmentDocs||{},n.user.stickyBucketAssignmentDocs[r]=i,n.user.saveStickyBucketAssignmentDoc(i))}const w=Ot(n,t,d);0===w.length&&n.global.saveDeferredTrack&&n.global.saveDeferredTrack({experiment:t,result:d});const p=w.length?1===w.length?w[0]:Promise.all(w).then((()=>{})):void 0;return\"changeId\"in t&&t.changeId&&n.global.recordChangeId&&n.global.recordChangeId(t.changeId),{result:d,trackingCall:p}}function Dt(t,e,n,r,i,s,o){const u={value:n,on:!!n,off:!n,source:r,ruleId:i||\"\"};return s&&(u.experiment=s),o&&(u.experimentResult=o),\"override\"!==r&&function(t,e,n){if(t.user.trackedFeatureUsage){const r=JSON.stringify(n.value);if(t.user.trackedFeatureUsage[e]===r)return;t.user.trackedFeatureUsage[e]=r,t.user.enableDevMode&&t.user.devLogs&&t.user.devLogs.push({featureKey:e,result:n,timestamp:Date.now().toString(),logType:\"feature\"})}if(t.global.onFeatureUsage){const r=t.global.onFeatureUsage;Et((()=>r(e,n,t.user)))}if(t.user.onFeatureUsage){const r=t.user.onFeatureUsage;Et((()=>r(e,n)))}if(t.global.eventLogger){const r=t.global.eventLogger;Et((()=>r($t,{feature:e,source:n.source,value:n.value,ruleId:\"defaultValue\"===n.source?\"$default\":n.ruleId||\"\",variationId:n.experimentResult?n.experimentResult.key:\"\"},t.user)))}}(t,e,u),u}function Ft(t){return{...t.user.attributes,...t.user.attributeOverrides}}function Mt(t,e){return mt(Ft(e),t,e.global.savedGroups||{})}function Rt(t,e){return t.some((t=>{const{hashValue:n}=Ut(e,t.attribute);if(!n)return!0;const r=B(t.seed,n,t.hashVersion||2);return null===r||!t.ranges.some((t=>I(r,t)))}))}function Bt(t,e,n,r,i,s,o){if(!i&&void 0===s)return!0;if(!i&&0===s)return!1;const{hashValue:u}=Ut(t,n,r);if(!u)return!1;const c=B(e,u,o||1);return null!==c&&(i?I(c,i):void 0===s||c<=s)}function It(t,e,n,r,i,s,o){let u=!0;(n<0||n>=e.variations.length)&&(n=0,u=!1);const{hashAttribute:c,hashValue:a}=Ut(t,e.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0),l=e.meta?e.meta[n]:{},h={key:l.key||\"\"+n,featureId:i,inExperiment:u,hashUsed:r,variationId:n,value:e.variations[n],hashAttribute:c,hashValue:a,stickyBucketUsed:!!o};return l.name&&(h.name=l.name),void 0!==s&&(h.bucket=s),l.passthrough&&(h.passthrough=l.passthrough),h}function Ut(t,e,n){let r=e||\"id\",i=\"\";const s=Ft(t);return s[r]&&(i=s[r]),!i&&n&&(s[n]&&(i=s[n]),i&&(r=n)),{hashAttribute:r,hashValue:i}}function Vt(t,e){return`${t}__${e=e||0}`}function jt(t,e){return`${t}||${e}`}function Jt(t,e){const n={},r=function(t,e){const n=new Set,r=e&&e.features?e.features:t.global.features||{},i=e&&e.experiments?e.experiments:t.global.experiments||[];return Object.keys(r).forEach((t=>{const e=r[t];if(e.rules)for(const t of e.rules)t.variations&&(n.add(t.hashAttribute||\"id\"),t.fallbackAttribute&&n.add(t.fallbackAttribute))})),i.map((t=>{n.add(t.hashAttribute||\"id\"),t.fallbackAttribute&&n.add(t.fallbackAttribute)})),Array.from(n)}(t,e);return r.forEach((e=>{const{hashValue:r}=Ut(t,e);n[e]=L(r)})),n}function Pt(t,e){return e.hashAttribute+e.hashValue+t.key+e.variationId}const Lt=\"undefined\"!=typeof window&&\"undefined\"!=typeof document,Kt=H();class Ht{constructor(t){this.prefix=(t=t||{}).prefix||\"\"}async getAllAssignments(t){const e={};return(await Promise.all(Object.entries(t).map((t=>{let[e,n]=t;return this.getAssignments(e,n)})))).forEach((t=>{if(t){const n=jt(t.attributeName,t.attributeValue);e[n]=t}})),e}getKey(t,e){return`${this.prefix}${t}||${e}`}}class qt extends Ht{async getAssignments(t,e){return this.getAssignmentsSync(t,e)}async saveAssignments(t){this.saveAssignmentsSync(t)}getAllAssignmentsSync(t){const e={};return Object.entries(t).map((t=>{let[e,n]=t;return this.getAssignmentsSync(e,n)})).forEach((t=>{if(t){const n=jt(t.attributeName,t.attributeValue);e[n]=t}})),e}}function Gt(t){return{browser:t.match(/Edg/)?\"edge\":t.match(/Chrome/)?\"chrome\":t.match(/Firefox/)?\"firefox\":t.match(/Safari/)?\"safari\":\"unknown\",deviceType:t.match(/Mobi/)?\"mobile\":\"desktop\"}}function zt(t){return t?{url:t.href,path:t.pathname,host:t.host,query:t.search}:{}}function Zt(t,e){const n=new Date;n.setTime(n.getTime()+3456e7),document.cookie=t+\"=\"+e+\";path=/;expires=\"+n.toUTCString()}function Qt(t){const e=(\"; \"+document.cookie).split(`; ${t}=`);return 2===e.length?e[1].split(\";\")[0]:\"\"}function Wt(t){return t&&t.randomUUID?t.randomUUID():\"10000000-1000-4000-8000-100000000000\".replace(/[018]/g,(e=>(e^(t&&t.getRandomValues?t.getRandomValues(new Uint8Array(1))[0]:Math.floor(256*Math.random()))&15>>e/4).toString(16)))}function Xt(t){let e={};try{const t=sessionStorage.getItem(\"utm_params\");t&&(e=JSON.parse(t))}catch(t){}if(t&&t.search){const n=new URLSearchParams(t.search);let r=!1;if([\"source\",\"medium\",\"campaign\",\"term\",\"content\"].forEach((t=>{const i=`utm_${t}`,s=\"utm\"+t[0].toUpperCase()+t.slice(1);n.has(i)&&(e[s]=n.get(i)||\"\",r=!0)})),r)try{sessionStorage.setItem(\"utm_params\",JSON.stringify(e))}catch(t){}}return e}function Yt(){if(\"undefined\"==typeof window||!window.dataLayer||!window.dataLayer.forEach)return{};const t={};return window.dataLayer.forEach((e=>{e&&\"object\"==typeof e&&!(\"length\"in e)&&(\"event\"in e||Object.keys(e).forEach((n=>{if(\"string\"!=typeof n||n.match(/^(gtm)/))return;const r=e[n];[\"string\",\"number\",\"boolean\"].includes(typeof r)&&(t[n]=r)})))})),t}const te=H();function ee(t){return\"string\"==typeof t?t:null}function ne(t){let{eventName:e,properties:n,attributes:r,url:i}=t;const{nested:s,topLevel:o}=function(t){const{user_id:e,device_id:n,anonymous_id:r,id:i,page_id:s,session_id:o,utmCampaign:u,utmContent:c,utmMedium:a,utmSource:l,utmTerm:h,pageTitle:f,...d}=t;return{nested:d,topLevel:{user_id:ee(e),device_id:ee(n||r||i),page_id:ee(s),session_id:ee(o),utm_campaign:ee(u)||void 0,utm_content:ee(c)||void 0,utm_medium:ee(a)||void 0,utm_source:ee(l)||void 0,utm_term:ee(h)||void 0,page_title:ee(f)||void 0}}}(r||{});return{event_name:e,properties_json:n||{},...o,sdk_language:\"js\",sdk_version:te,url:i,context_json:s}}async function re(t){let{clientKey:e,ingestorHost:n,events:r}=t;if(!r.length)return;const i=`${n||\"https://us1.gb-ingest.com\"}/track?client_key=${e}`,s=JSON.stringify(r);try{await fetch(i,{method:\"POST\",body:s,headers:{Accept:\"application/json\",\"Content-Type\":\"text/plain\"},credentials:\"omit\"})}catch(t){console.error(\"Failed to track event\",t)}}window.dataLayer=window.dataLayer||[];const ie=document.currentScript,se=ie?ie.dataset:{},oe=window.growthbook_config||{};let ue,ce;function ae(){window.clearTimeout(ue);let t=oe.antiFlickerTimeout??(se.antiFlickerTimeout?parseInt(se.antiFlickerTimeout):null)??3500;isFinite(t)||(t=3500);try{if(!document.getElementById(\"gb-anti-flicker-style\")){const t=document.createElement(\"style\");t.setAttribute(\"id\",\"gb-anti-flicker-style\"),t.innerHTML=\".gb-anti-flicker { opacity: 0 !important; pointer-events: none; }\",document.head.appendChild(t)}document.documentElement.classList.add(\"gb-anti-flicker\"),ue=window.setTimeout(le,t)}catch(t){console.error(t)}}function le(){window.clearTimeout(ue);try{document.documentElement.classList.remove(\"gb-anti-flicker\")}catch(t){console.error(t)}}(oe.antiFlicker||se.antiFlicker)&&ae(),\"cookie\"===oe.useStickyBucketService||\"cookie\"===se.useStickyBucketService?ce=new class extends qt{constructor(t){let{prefix:e=\"gbStickyBuckets__\",jsCookie:n,cookieAttributes:r={expires:180}}=t;super(),this.prefix=e,this.jsCookie=n,this.cookieAttributes=r}getAssignmentsSync(t,e){const n=this.getKey(t,e);let r=null;if(!this.jsCookie)return r;try{const t=this.jsCookie.get(n),e=JSON.parse(t||\"{}\");e.attributeName&&e.attributeValue&&e.assignments&&(r=e)}catch(t){}return r}async saveAssignmentsSync(t){const e=this.getKey(t.attributeName,t.attributeValue);if(!this.jsCookie)return;const n=JSON.stringify(t);this.jsCookie.set(e,n,this.cookieAttributes)}}({prefix:oe.stickyBucketPrefix||se.stickyBucketPrefix||void 0,jsCookie:e}):\"localStorage\"!==oe.useStickyBucketService&&\"localStorage\"!==se.useStickyBucketService||(ce=new class extends Ht{constructor(t){t=t||{},super(),this.prefix=t.prefix||\"gbStickyBuckets__\";try{this.localStorage=t.localStorage||globalThis.localStorage}catch(t){}}async getAssignments(t,e){const n=this.getKey(t,e);let r=null;if(!this.localStorage)return r;try{const t=await this.localStorage.getItem(n)||\"{}\",e=JSON.parse(t);e.attributeName&&e.attributeValue&&e.assignments&&(r=e)}catch(t){}return r}async saveAssignments(t){const e=this.getKey(t.attributeName,t.attributeValue);if(this.localStorage)try{await this.localStorage.setItem(e,JSON.stringify(t))}catch(t){}}}({prefix:oe.stickyBucketPrefix||se.stickyBucketPrefix||void 0}));const he=se.uuid||oe.uuid,fe=[function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(\"undefined\"==typeof window)throw new Error(\"autoAttributesPlugin only works in the browser\");const e=t.uuidCookieName||\"gbuuid\",n=t.uuidKey||\"id\";let r=t.uuid||\"\";function i(){Zt(e,r)}function s(){return r||(r=Qt(e),r||(r=Wt(window.crypto),r))}function o(t){const e=navigator.userAgent,r=s();(t.uuidAutoPersist??!t.uuid)&&i();const o=location;return{...Yt(),[n]:r,...zt(o),pageTitle:document.title,...Gt(e),...Xt(o)}}return document.addEventListener(\"growthbookpersist\",(()=>{i()})),e=>{if(\"createScopedInstance\"in e)return;const n=o(t);n.url&&e.setURL(n.url),e.updateAttributes(n);let r=n.url;const i=setInterval((()=>{location.href!==r&&(r=location.href,e.setURL(r),e.updateAttributes(o(t)))}),500),s=()=>{location.href!==r&&(r=location.href,e.setURL(r)),e.updateAttributes(o(t))};document.addEventListener(\"growthbookrefresh\",s),\"onDestroy\"in e&&e.onDestroy((()=>{clearInterval(i),document.removeEventListener(\"growthbookrefresh\",s)}))}}({uuid:he,uuidCookieName:oe.uuidCookieName||se.uuidCookieName,uuidKey:oe.uuidKey||se.uuidKey,uuidAutoPersist:!he&&null==se.noAutoCookies})],de=se.tracking||\"gtag,gtm,segment\";if(\"none\"!==de){const t=de.toLowerCase().split(\",\").map((t=>t.trim()));t.includes(\"growthbook\")&&fe.push(function(){let{queueFlushInterval:t=100,ingestorHost:e,enable:n=!0,debug:r,dedupeCacheSize:i=1e3,dedupeKeyAttributes:s=[],eventFilter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return u=>{const c=u.getClientKey();if(!c)throw new Error(\"clientKey must be specified to use event logging\");const a=new Set;if(\"setEventLogger\"in u){let l=[],h=null;const f=async()=>{const t=l;l=[],h&&clearTimeout(h),h=null,t.length&&await re({clientKey:c,events:t,ingestorHost:e})};let d=null;u.setEventLogger((async(e,u,c)=>{const w={eventName:e,properties:u,attributes:c.attributes||{},url:c.url||\"\"};if(o&&!o(w))return;if(e===$t||e===Ct){const t={eventName:e,properties:u};for(const e of s)t[\"attr:\"+e]=w.attributes[e];const n=JSON.stringify(t);if(a.has(n))return a.delete(n),void a.add(n);if(a.add(n),a.size>i){const t=a.values().next().value;t&&a.delete(t)}}const p=ne(w);r&&console.log(\"Logging event to GrowthBook\",JSON.parse(JSON.stringify(p))),n&&(l.push(p),d||(d=new Promise(((e,n)=>{h=setTimeout((()=>{f().then(e).catch(n),d=null}),t)}))),await d)})),\"undefined\"!=typeof document&&document.visibilityState&&document.addEventListener(\"visibilitychange\",(()=>{\"hidden\"===document.visibilityState&&f().catch(console.error)})),\"onDestroy\"in u&&u.onDestroy((()=>{f().catch(console.error)}))}if(\"undefined\"!=typeof window&&!(\"createScopedInstance\"in u)){const t=Array.isArray(window.gbEvents)?window.gbEvents:[];window.gbEvents={push:t=>{\"isDestroyed\"in u&&u.isDestroyed()?window.gbEvents=[t]:\"string\"==typeof t?u.logEvent(t):t&&u.logEvent(t.eventName,t.properties)}};for(const e of t)window.gbEvents.push(e)}}}({ingestorHost:se.eventIngestorHost})),oe.trackingCallback||fe.push(function(){let{additionalCallback:t,trackers:e=[\"gtag\",\"gtm\",\"segment\"]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(\"undefined\"==typeof window)throw new Error(\"thirdPartyTrackingPlugin only works in the browser\");return n=>{n.setTrackingCallback((async(n,r)=>{const i=[],s={experiment_id:n.key,variation_id:r.key};if(t&&i.push(Promise.resolve(t(n,r))),e.includes(\"gtag\")&&window.gtag){let t;const e=new Promise((e=>{t=e}));i.push(e),window.gtag(\"event\",\"experiment_viewed\",{...s,event_callback:t})}if(e.includes(\"gtm\")&&window.dataLayer){let t;const e=new Promise((e=>{t=e}));i.push(e),window.dataLayer.push({event:\"experiment_viewed\",...s,eventCallback:t})}if(e.includes(\"segment\")&&window.analytics&&window.analytics.track){window.analytics.track(\"Experiment Viewed\",s);const t=new Promise((t=>window.setTimeout(t,300)));i.push(t)}await Promise.all(i)}))}}({additionalCallback:oe.additionalTrackingCallback,trackers:t}))}const we=new class{constructor(t){if(t=t||{},this.version=Kt,this.i=this.context=t,this.o=t.renderer||null,this.u=new Set,this.l=new Set,this.h={},this.debug=!!t.debug,this.p=new Set,this.ready=!1,this.g=new Map,this.m=new Map,this.v=new Set,this.k=!1,this.S=\"\",this.A=new Map,this._=!t.disableExperimentsOnLoad,this.$=[],this.logs=[],this.log=this.log.bind(this),this.C=this.C.bind(this),this.O=this.O.bind(this),this.T=this.T.bind(this),t.remoteEval){if(t.decryptionKey)throw new Error(\"Encryption is not available for remoteEval\");if(!t.clientKey)throw new Error(\"Missing clientKey\");let e=!1;try{e=!!new URL(t.apiHost||\"\").hostname.match(/growthbook\\.io$/i)}catch(t){}if(e)throw new Error(\"Cannot use remoteEval on GrowthBook Cloud\")}else if(t.cacheKeyAttributes)throw new Error(\"cacheKeyAttributes are only used for remoteEval\");if(t.stickyBucketService){const e=t.stickyBucketService;this.N=t=>e.saveAssignments(t)}if(t.plugins)for(const e of t.plugins)e(this);if(t.features&&(this.ready=!0),Lt&&t.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event(\"gbloaded\"))),t.experiments&&(this.ready=!0,this.D()),this.i.stickyBucketService&&this.i.stickyBucketAssignmentDocs)for(const t in this.i.stickyBucketAssignmentDocs){const e=this.i.stickyBucketAssignmentDocs[t];e&&this.i.stickyBucketService.saveAssignments(e).catch((()=>{}))}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(t){this.F=t;const e=await async function(t,e,n){if((t={...t}).encryptedFeatures){try{t.features=JSON.parse(await P(t.encryptedFeatures,e,n))}catch(t){console.error(t)}delete t.encryptedFeatures}if(t.encryptedExperiments){try{t.experiments=JSON.parse(await P(t.encryptedExperiments,e,n))}catch(t){console.error(t)}delete t.encryptedExperiments}if(t.encryptedSavedGroups){try{t.savedGroups=JSON.parse(await P(t.encryptedSavedGroups,e,n))}catch(t){console.error(t)}delete t.encryptedSavedGroups}return t}(t,this.i.decryptionKey);this.M=e,await this.refreshStickyBuckets(e),e.features&&(this.i.features=e.features),e.savedGroups&&(this.i.savedGroups=e.savedGroups),e.experiments&&(this.i.experiments=e.experiments,this.D()),this.ready=!0,this.R()}initSync(t){this.k=!0;const e=t.payload;if(e.encryptedExperiments||e.encryptedFeatures)throw new Error(\"initSync does not support encrypted payloads\");return this.i.stickyBucketService&&!this.i.stickyBucketAssignmentDocs&&(this.i.stickyBucketAssignmentDocs=this.generateStickyBucketAssignmentDocsSync(this.i.stickyBucketService,e)),this.F=e,this.M=e,e.features&&(this.i.features=e.features),e.experiments&&(this.i.experiments=e.experiments,this.D()),this.ready=!0,yt(this,t),this}async init(t){if(this.k=!0,(t=t||{}).cacheSettings&&(Object.assign(Z,t.cacheSettings),Z.backgroundSync||(rt.clear(),nt.forEach(pt),X.clear(),W.stopIdleListener())),t.payload)return await this.setPayload(t.payload),yt(this,t),{success:!0,source:\"init\"};{const{data:e,...n}=await this.B({...t,allowStale:!0});return yt(this,t),await this.setPayload(e||{}),n}}async loadFeatures(t){t=t||{},await this.init({skipCache:t.skipCache,timeout:t.timeout,streaming:(this.i.backgroundSync??!0)&&(t.autoRefresh||this.i.subscribeToChanges)})}async refreshFeatures(t){const e=await this.B({...t||{},allowStale:!1});e.data&&await this.setPayload(e.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return function(t){const e=t.apiHost||\"https://cdn.growthbook.io\";return{apiHost:e.replace(/\\/*$/,\"\"),streamingHost:(t.streamingHost||e).replace(/\\/*$/,\"\"),apiRequestHeaders:t.apiHostRequestHeaders,streamingHostRequestHeaders:t.streamingHostRequestHeaders}}(this.i)}getClientKey(){return this.i.clientKey||\"\"}getPayload(){return this.F||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this.M||this.getPayload()}isRemoteEval(){return this.i.remoteEval||!1}getCacheKeyAttributes(){return this.i.cacheKeyAttributes}async B(t){let{timeout:e,skipCache:n,allowStale:r,streaming:i}=t;if(!this.i.clientKey)throw new Error(\"Missing clientKey\");return async function(t){let{instance:e,timeout:n,skipCache:r,allowStale:i,backgroundSync:s}=t;return s||(Z.backgroundSync=!1),async function(t){let{instance:e,allowStale:n,timeout:r,skipCache:i}=t;const s=ot(e),o=ut(e),u=new Date,c=new Date(u.getTime()-Z.maxAge+Z.staleTTL);await async function(){if(!Y){Y=!0;try{if(Q.localStorage){const t=await Q.localStorage.getItem(Z.cacheKey);if(!Z.disableCache&&t){const e=JSON.parse(t);e&&Array.isArray(e)&&e.forEach((t=>{let[e,n]=t;tt.set(e,{...n,staleAt:new Date(n.staleAt)})})),ct()}}}catch(t){}if(!Z.disableIdleStreams){const t=W.startIdleListener();t&&(W.stopIdleListener=t)}}}();const a=Z.disableCache||i?void 0:tt.get(o);return a&&(n||a.staleAt>u)&&a.staleAt>c?(a.sse&&rt.add(s),a.staleAt<u?lt(e):ht(e),{data:a.data,success:!0,source:\"cache\"}):await z(lt(e),r)||{data:null,success:!1,source:\"timeout\",error:new Error(\"Timeout\")}}({instance:e,allowStale:i,timeout:n,skipCache:r})}({instance:this,timeout:e,skipCache:n||this.i.disableCache,allowStale:r,backgroundSync:i??this.i.backgroundSync??!0})}R(){if(this.o)try{this.o()}catch(t){console.error(\"Failed to render\",t)}}setFeatures(t){this.i.features=t,this.ready=!0,this.R()}async setEncryptedFeatures(t,e,n){const r=await P(t,e||this.i.decryptionKey,n);this.setFeatures(JSON.parse(r))}setExperiments(t){this.i.experiments=t,this.ready=!0,this.D()}async setEncryptedExperiments(t,e,n){const r=await P(t,e||this.i.decryptionKey,n);this.setExperiments(JSON.parse(r))}async setAttributes(t){this.i.attributes=t,this.i.stickyBucketService&&await this.refreshStickyBuckets(),this.i.remoteEval?await this.I():(this.R(),this.D())}async updateAttributes(t){return this.setAttributes({...this.i.attributes,...t})}async setAttributeOverrides(t){this.i.attributeOverrides=t,this.i.stickyBucketService&&await this.refreshStickyBuckets(),this.i.remoteEval?await this.I():(this.R(),this.D())}async setForcedVariations(t){this.i.forcedVariations=t||{},this.i.remoteEval?await this.I():(this.R(),this.D())}setForcedFeatures(t){this.i.forcedFeatureValues=t,this.R()}async setURL(t){if(t!==this.i.url){if(this.i.url=t,this.S=\"\",this.i.remoteEval)return await this.I(),void this.D(!0);this.D(!0)}}getAttributes(){return{...this.i.attributes,...this.i.attributeOverrides}}getForcedVariations(){return this.i.forcedVariations||{}}getForcedFeatures(){return this.i.forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this.i.stickyBucketAssignmentDocs||{}}getUrl(){return this.i.url||\"\"}getFeatures(){return this.i.features||{}}getExperiments(){return this.i.experiments||[]}getCompletedChangeIds(){return Array.from(this.l)}subscribe(t){return this.p.add(t),()=>{this.p.delete(t)}}async I(){if(!this.i.remoteEval)return;if(!this.k)return;const t=await this.B({allowStale:!1});t.data&&await this.setPayload(t.data)}getAllResults(){return new Map(this.g)}onDestroy(t){this.$.push(t)}isDestroyed(){return!!this.U}destroy(){var t;this.U=!0,this.$.forEach((t=>{try{t()}catch(t){console.error(t)}})),this.p.clear(),this.g.clear(),this.u.clear(),this.l.clear(),this.A.clear(),this.h={},this.$=[],this.F=void 0,this.N=void 0,t=this,X.forEach((e=>e.delete(t))),this.logs=[],Lt&&window._growthbook===this&&delete window._growthbook,this.m.forEach((t=>{t.undo()})),this.m.clear(),this.v.clear()}setRenderer(t){this.o=t}forceVariation(t,e){this.i.forcedVariations=this.i.forcedVariations||{},this.i.forcedVariations[t]=e,this.i.remoteEval?this.I():(this.D(),this.R())}run(t){const{result:e}=Nt(t,null,this.V());return this.O(t,e),e}triggerExperiment(t){return this.v.add(t),this.i.experiments?this.i.experiments.filter((e=>e.key===t)).map((t=>this.j(t))).filter((t=>null!==t)):null}triggerAutoExperiments(){this._=!0,this.D(!0)}V(){return{user:this.J(),global:this.P(),stack:{evaluatedFeatures:new Set}}}J(){return{attributes:this.i.user?{...this.i.user,...this.i.attributes}:this.i.attributes,enableDevMode:this.i.enableDevMode,blockedChangeIds:this.i.blockedChangeIds,stickyBucketAssignmentDocs:this.i.stickyBucketAssignmentDocs,url:this.L(),forcedVariations:this.i.forcedVariations,forcedFeatureValues:this.i.forcedFeatureValues,attributeOverrides:this.i.attributeOverrides,saveStickyBucketAssignmentDoc:this.N,trackingCallback:this.i.trackingCallback,onFeatureUsage:this.i.onFeatureUsage,devLogs:this.logs,trackedExperiments:this.u,trackedFeatureUsage:this.h}}P(){return{features:this.i.features,experiments:this.i.experiments,log:this.log,enabled:this.i.enabled,qaMode:this.i.qaMode,savedGroups:this.i.savedGroups,groups:this.i.groups,overrides:this.i.overrides,onExperimentEval:this.p.size>0?this.O:void 0,recordChangeId:this.T,saveDeferredTrack:this.C,eventLogger:this.i.eventLogger}}j(t,e){const n=this.m.get(t);if(t.manual&&!this.v.has(t.key)&&!n)return null;let r,i;this.K(t)?r=It(this.V(),t,-1,!1,\"\"):(({result:r,trackingCall:i}=Nt(t,null,this.V())),this.O(t,r));const s=JSON.stringify(r.value);if(!e&&r.inExperiment&&n&&n.valueHash===s)return r;if(n&&this.H(t),r.inExperiment){const e=G(t);if(\"redirect\"===e&&r.value.urlRedirect&&t.urlPatterns){const e=t.persistQueryString?function(t,e){let n,r;try{n=new URL(t),r=new URL(e)}catch(t){return console.error(`Unable to merge query strings: ${t}`),e}return n.searchParams.forEach(((t,e)=>{r.searchParams.has(e)||r.searchParams.set(e,t)})),r.toString()}(this.L(),r.value.urlRedirect):r.value.urlRedirect;if(V(e,t.urlPatterns))return this.log(\"Skipping redirect because original URL matches redirect URL\",{id:t.key}),r;this.S=e;const{navigate:n,delay:s}=this.q();if(n)if(Lt)Promise.all([...i?[z(i,this.i.maxNavigateDelay??1e3)]:[],new Promise((t=>window.setTimeout(t,this.i.navigateDelay??s)))]).then((()=>{try{n(e)}catch(t){console.error(t)}}));else try{n(e)}catch(t){console.error(t)}}else if(\"visual\"===e){const e=this.i.applyDomChangesCallback?this.i.applyDomChangesCallback(r.value):this.G(r.value);e&&this.m.set(t,{undo:e,valueHash:s})}}return r}H(t){const e=this.m.get(t);e&&(e.undo(),this.m.delete(t))}D(t){if(!this._)return;const e=this.i.experiments||[],n=new Set(e);this.m.forEach(((t,e)=>{n.has(e)||(t.undo(),this.m.delete(e))}));for(const n of e){const e=this.j(n,t);if(null!=e&&e.inExperiment&&\"redirect\"===G(n))break}}O(t,e){const n=t.key,r=this.g.get(n);r&&r.result.inExperiment===e.inExperiment&&r.result.variationId===e.variationId||(this.g.set(n,{experiment:t,result:e}),this.p.forEach((n=>{try{n(t,e)}catch(t){console.error(t)}})))}T(t){this.l.add(t)}isOn(t){return this.evalFeature(t).on}isOff(t){return this.evalFeature(t).off}getFeatureValue(t,e){const n=this.evalFeature(t).value;return null===n?e:n}feature(t){return this.evalFeature(t)}evalFeature(t){return Tt(t,this.V())}log(t,e){this.debug&&(this.i.log?this.i.log(t,e):console.log(t,e))}getDeferredTrackingCalls(){return Array.from(this.A.values())}setDeferredTrackingCalls(t){this.A=new Map(t.filter((t=>t&&t.experiment&&t.result)).map((t=>[Pt(t.experiment,t.result),t])))}async fireDeferredTrackingCalls(){if(!this.i.trackingCallback)return;const t=[];this.A.forEach((e=>{e&&e.experiment&&e.result?t.push(this.i.trackingCallback(e.experiment,e.result)):console.error(\"Invalid deferred tracking call\",{call:e})})),this.A.clear(),await Promise.all(t)}setTrackingCallback(t){this.i.trackingCallback=t,this.fireDeferredTrackingCalls()}setEventLogger(t){this.i.eventLogger=t}async logEvent(t,e){if(this.U)console.error(\"Cannot log event to destroyed GrowthBook instance\");else if(this.i.enableDevMode&&this.logs.push({eventName:t,properties:e,timestamp:Date.now().toString(),logType:\"event\"}),this.i.eventLogger)try{await this.i.eventLogger(t,e||{},this.J())}catch(t){console.error(t)}else console.error(\"No event logger configured\")}C(t){this.A.set(Pt(t.experiment,t.result),t)}L(){return this.i.url||(Lt?window.location.href:\"\")}K(t){const e=G(t);if(\"visual\"===e){if(this.i.disableVisualExperiments)return!0;if(this.i.disableJsInjection&&t.variations.some((t=>t.js)))return!0}else{if(\"redirect\"!==e)return!0;if(this.i.disableUrlRedirectExperiments)return!0;try{const e=new URL(this.L());for(const n of t.variations){if(!n||!n.urlRedirect)continue;const t=new URL(n.urlRedirect);if(this.i.disableCrossOriginUrlRedirectExperiments){if(t.protocol!==e.protocol)return!0;if(t.host!==e.host)return!0}}}catch(e){return this.log(\"Error parsing current or redirect URL\",{id:t.key,error:e}),!0}}return!(!t.changeId||!(this.i.blockedChangeIds||[]).includes(t.changeId))}getRedirectUrl(){return this.S}q(){return this.i.navigate?{navigate:this.i.navigate,delay:0}:Lt?{navigate:t=>{window.location.replace(t)},delay:100}:{navigate:null,delay:0}}G(t){if(!Lt)return;const e=[];if(t.css){const n=document.createElement(\"style\");n.innerHTML=t.css,document.head.appendChild(n),e.push((()=>n.remove()))}if(t.js){const n=document.createElement(\"script\");n.innerHTML=t.js,this.i.jsInjectionNonce&&(n.nonce=this.i.jsInjectionNonce),document.head.appendChild(n),e.push((()=>n.remove()))}return t.domMutations&&t.domMutations.forEach((t=>{e.push(function(t){var e=t.selector,n=t.action,i=t.value,s=t.attribute,o=t.parentSelector,u=t.insertBeforeSelector;if(\"html\"===s){if(\"append\"===n)return N(e,(function(t){return t+(null!=i?i:\"\")}));if(\"set\"===n)return N(e,(function(){return null!=i?i:\"\"}))}else if(\"class\"===s){if(\"append\"===n)return D(e,(function(t){i&&t.add(i)}));if(\"remove\"===n)return D(e,(function(t){i&&t.delete(i)}));if(\"set\"===n)return D(e,(function(t){t.clear(),i&&t.add(i)}))}else if(\"position\"===s){if(\"set\"===n&&o)return function(t,e){return T({kind:\"position\",elements:new Set,mutate:function(){return{insertBeforeSelector:u,parentSelector:o}},selector:t})}(e)}else{if(\"append\"===n)return F(e,s,(function(t){return null!==t?t+(null!=i?i:\"\"):null!=i?i:\"\"}));if(\"set\"===n)return F(e,s,(function(){return null!=i?i:\"\"}));if(\"remove\"===n)return F(e,s,(function(){return null}))}return r}(t).revert)})),()=>{e.forEach((t=>t()))}}async refreshStickyBuckets(t){if(this.i.stickyBucketService){const e=this.V(),n=await async function(t,e,n){const r=Jt(t,n);return e.getAllAssignments(r)}(e,this.i.stickyBucketService,t);this.i.stickyBucketAssignmentDocs=n}}generateStickyBucketAssignmentDocsSync(t,e){if(!(\"getAllAssignmentsSync\"in t))return void console.error(\"generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync\");const n=Jt(this.V(),e);return t.getAllAssignmentsSync(n)}inDevMode(){return!!this.i.enableDevMode}}({enableDevMode:!0,...se,remoteEval:!!se.remoteEval,...oe,plugins:fe,stickyBucketService:ce});we.setRenderer((()=>{document.dispatchEvent(new CustomEvent(\"growthbookdata\"))})),we.init({payload:oe.payload,streaming:!(oe.noStreaming||se.noStreaming||!1===oe.backgroundSync),cacheSettings:oe.cacheSettings}).then((()=>{(oe.antiFlicker||se.antiFlicker)&&(we.getRedirectUrl()?ae():le())}));const pe=t=>{try{t&&t(we)}catch(t){console.error(\"Uncaught growthbook_queue error\",t)}};return window.growthbook_queue&&Array.isArray(window.growthbook_queue)&&window.growthbook_queue.forEach((t=>{pe(t)})),window.growthbook_queue={push:t=>{pe(t)}},we}();\n//# sourceMappingURL=auto.min.js.map\n";
|
|
4
|
+
exports.sdkWrapper = "var _growthbook=function(){\"use strict\";function t(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}var e=function e(n,r){function i(e,i,s){if(\"undefined\"!=typeof document){\"number\"==typeof(s=t({},r,s)).expires&&(s.expires=new Date(Date.now()+864e5*s.expires)),s.expires&&(s.expires=s.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o=\"\";for(var u in s)s[u]&&(o+=\"; \"+u,!0!==s[u]&&(o+=\"=\"+s[u].split(\";\")[0]));return document.cookie=e+\"=\"+n.write(i,e)+o}}return Object.create({set:i,get:function(t){if(\"undefined\"!=typeof document&&(!arguments.length||t)){for(var e=document.cookie?document.cookie.split(\"; \"):[],r={},i=0;i<e.length;i++){var s=e[i].split(\"=\"),o=s.slice(1).join(\"=\");try{var u=decodeURIComponent(s[0]);if(r[u]=n.read(o,u),t===u)break}catch(t){}}return t?r[t]:r}},remove:function(e,n){i(e,\"\",t({},n,{expires:-1}))},withAttributes:function(n){return e(this.converter,t({},this.attributes,n))},withConverter:function(n){return e(t({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(n)}})}({read:function(t){return\'\"\'===t[0]&&(t=t.slice(1,-1)),t.replace(/(%[\\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:\"/\"}),n=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,r={revert:function(){}},i=new Map,s=new Set;function o(t){var e=i.get(t);return e||i.set(t,e={element:t,attributes:{}}),e}function u(t,e,n,r,i){var s=n(t),o={isDirty:!1,originalValue:s,virtualValue:s,mutations:[],el:t,t:null,observer:new MutationObserver((function(){if(\"position\"!==e||!o.t){\"position\"===e&&(o.t=setTimeout((function(){o.t=null}),1e3));var r=n(t);\"position\"===e&&r.parentNode===o.virtualValue.parentNode&&r.insertBeforeNode===o.virtualValue.insertBeforeNode||r!==o.virtualValue&&(o.originalValue=r,i(o))}})),mutationRunner:i,setValue:r,getCurrentValue:n};return\"position\"===e&&t.parentNode?o.observer.observe(t.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):o.observer.observe(t,function(t){return\"html\"===t?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[t]}}(e)),o}function c(t,e){var n=e.getCurrentValue(e.el);e.virtualValue=t,t&&\"string\"!=typeof t?n&&t.parentNode===n.parentNode&&t.insertBeforeNode===n.insertBeforeNode||(e.isDirty=!0,C()):t!==n&&(e.isDirty=!0,C())}function a(t){var e=t.originalValue;t.mutations.forEach((function(t){return e=t.mutate(e)})),c(function(t){return v||(v=document.createElement(\"div\")),v.innerHTML=t,v.innerHTML}(e),t)}function l(t){var e=new Set(t.originalValue.split(/\\s+/).filter(Boolean));t.mutations.forEach((function(t){return t.mutate(e)})),c(Array.from(e).filter(Boolean).join(\" \"),t)}function h(t){var e=t.originalValue;t.mutations.forEach((function(t){return e=t.mutate(e)})),c(e,t)}function f(t){var e=t.originalValue;t.mutations.forEach((function(t){var n=function(t){var e=t.insertBeforeSelector,n=document.querySelector(t.parentSelector);if(!n)return null;var r=e?document.querySelector(e):null;return e&&!r?null:{parentNode:n,insertBeforeNode:r}}(t.mutate());e=n||e})),c(e,t)}var d=function(t){return t.innerHTML},w=function(t,e){return t.innerHTML=e};function y(t){var e=o(t);return e.html||(e.html=u(t,\"html\",d,w,a)),e.html}var p=function(t){return{parentNode:t.parentElement,insertBeforeNode:t.nextElementSibling}},g=function(t,e){e.insertBeforeNode&&!e.parentNode.contains(e.insertBeforeNode)||e.parentNode.insertBefore(t,e.insertBeforeNode)};function m(t){var e=o(t);return e.position||(e.position=u(t,\"position\",p,g,f)),e.position}var v,b,k=function(t,e){return e?t.className=e:t.removeAttribute(\"class\")},S=function(t){return t.className};function A(t){var e=o(t);return e.classes||(e.classes=u(t,\"class\",S,k,l)),e.classes}function _(t,e){var n,r=o(t);return r.attributes[e]||(r.attributes[e]=u(t,e,(n=e,function(t){var e;return null!=(e=t.getAttribute(n))?e:null}),function(t){return function(e,n){return null!==n?e.setAttribute(t,n):e.removeAttribute(t)}}(e),h)),r.attributes[e]}function $(t,e,n){if(n.isDirty){n.isDirty=!1;var r=n.virtualValue;n.mutations.length||function(t,e){var n,r,s=i.get(t);if(s)if(\"html\"===e)null==(n=s.html)||null==(r=n.observer)||r.disconnect(),delete s.html;else if(\"class\"===e){var o,u;null==(o=s.classes)||null==(u=o.observer)||u.disconnect(),delete s.classes}else if(\"position\"===e){var c,a;null==(c=s.position)||null==(a=c.observer)||a.disconnect(),delete s.position}else{var l,h,f;null==(l=s.attributes)||null==(h=l[e])||null==(f=h.observer)||f.disconnect(),delete s.attributes[e]}}(t,e),n.setValue(t,r)}}function x(t,e){t.html&&$(e,\"html\",t.html),t.classes&&$(e,\"class\",t.classes),t.position&&$(e,\"position\",t.position),Object.keys(t.attributes).forEach((function(n){$(e,n,t.attributes[n])}))}function C(){i.forEach(x)}function E(t){if(\"position\"!==t.kind||1!==t.elements.size){var e=new Set(t.elements);document.querySelectorAll(t.selector).forEach((function(n){e.has(n)||(t.elements.add(n),function(t,e){var n=null;\"html\"===t.kind?n=y(e):\"class\"===t.kind?n=A(e):\"attribute\"===t.kind?n=_(e,t.attribute):\"position\"===t.kind&&(n=m(e)),n&&(n.mutations.push(t),n.mutationRunner(n))}(t,n))}))}}function O(){s.forEach(E)}function T(t){return\"undefined\"==typeof document?r:(s.add(t),E(t),{revert:function(){var e;(e=t).elements.forEach((function(t){return function(t,e){var n=null;if(\"html\"===t.kind?n=y(e):\"class\"===t.kind?n=A(e):\"attribute\"===t.kind?n=_(e,t.attribute):\"position\"===t.kind&&(n=m(e)),n){var r=n.mutations.indexOf(t);-1!==r&&n.mutations.splice(r,1),n.mutationRunner(n)}}(e,t)})),e.elements.clear(),s.delete(e)}})}function N(t,e){return T({kind:\"html\",elements:new Set,mutate:e,selector:t})}function D(t,e){return T({kind:\"class\",elements:new Set,mutate:e,selector:t})}function F(t,e,i){return n.test(e)?\"class\"===e||\"className\"===e?D(t,(function(t){var e=i(Array.from(t).join(\" \"));t.clear(),e&&e.split(/\\s+/g).filter(Boolean).forEach((function(e){return t.add(e)}))})):T({kind:\"attribute\",attribute:e,elements:new Set,mutate:i,selector:t}):r}\"undefined\"!=typeof document&&(b||(b=new MutationObserver((function(){O()}))),O(),b.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}));const M={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function R(t){let e=2166136261;const n=t.length;for(let r=0;r<n;r++)e^=t.charCodeAt(r),e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24);return e>>>0}function B(t,e,n){return 2===n?R(R(t+e)+\"\")%1e4/1e4:1===n?R(e+t)%1e3/1e3:null}function I(t,e){return t>=e[0]&&t<e[1]}function U(t){try{const e=t.replace(/([^\\\\])\\//g,\"$1\\\\/\");return new RegExp(e)}catch(t){return void console.error(t)}}function V(t,e){if(!e.length)return!1;let n=!1,r=!1;for(let i=0;i<e.length;i++){const s=j(t,e[i].type,e[i].pattern);if(!1===e[i].include){if(s)return!1}else n=!0,s&&(r=!0)}return r||!n}function j(t,e,n){try{const r=new URL(t,\"https://_\");if(\"regex\"===e){const t=U(n);return!!t&&(t.test(r.href)||t.test(r.href.substring(r.origin.length)))}return\"simple\"===e&&function(t,e){try{const n=new URL(e.replace(/^([^:/?]*)\\./i,\"https://$1.\").replace(/\\*/g,\"_____\"),\"https://_____\"),r=[[t.host,n.host,!1],[t.pathname,n.pathname,!0]];return n.hash&&r.push([t.hash,n.hash,!1]),n.searchParams.forEach(((e,n)=>{r.push([t.searchParams.get(n)||\"\",e,!1])})),!r.some((t=>!function(t,e,n){try{let r=e.replace(/[*.+?^${}()|[\\]\\\\]/g,\"\\\\$&\").replace(/_____/g,\".*\");return n&&(r=\"\\\\/?\"+r.replace(/(^\\/|\\/$)/g,\"\")+\"\\\\/?\"),new RegExp(\"^\"+r+\"$\",\"i\").test(t)}catch(t){return!1}}(t[0],t[1],t[2])))}catch(t){return!1}}(r,n)}catch(t){return!1}}const J=t=>Uint8Array.from(atob(t),(t=>t.charCodeAt(0)));async function P(t,e,n){if(e=e||\"\",!(n=n||globalThis.crypto&&globalThis.crypto.subtle||M.SubtleCrypto))throw new Error(\"No SubtleCrypto implementation found\");try{const r=await n.importKey(\"raw\",J(e),{name:\"AES-CBC\",length:128},!0,[\"encrypt\",\"decrypt\"]),[i,s]=t.split(\".\"),o=await n.decrypt({name:\"AES-CBC\",iv:J(i)},r,J(s));return(new TextDecoder).decode(o)}catch(t){throw new Error(\"Failed to decrypt\")}}function L(t){return\"string\"==typeof t?t:JSON.stringify(t)}function K(t){\"number\"==typeof t&&(t+=\"\"),t&&\"string\"==typeof t||(t=\"0\");const e=t.replace(/(^v|\\+.*$)/g,\"\").split(/[-.]/);return 3===e.length&&e.push(\"~\"),e.map((t=>t.match(/^[0-9]+$/)?t.padStart(5,\" \"):t)).join(\"-\")}function H(){let t;try{t=\"1.6.4\"}catch(e){t=\"\"}return t}function q(t){return\"object\"==typeof t&&null!==t}function G(t){return t.urlPatterns&&t.variations.some((t=>q(t)&&\"urlRedirect\"in t))?\"redirect\":t.variations.some((t=>q(t)&&(t.domMutations||\"js\"in t||\"css\"in t)))?\"visual\":\"unknown\"}async function z(t,e){return new Promise((n=>{let r,i=!1;const s=t=>{i||(i=!0,r&&clearTimeout(r),n(t||null))};e&&(r=setTimeout((()=>s()),e)),t.then((t=>s(t))).catch((()=>s()))}))}const Z={staleTTL:6e4,maxAge:144e5,cacheKey:\"gbFeaturesCache\",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},Q=M,W={fetchFeaturesCall:({host:t,clientKey:e,headers:n})=>Q.fetch(`${t}/api/features/${e}`,{headers:n}),fetchRemoteEvalCall:({host:t,clientKey:e,payload:n,headers:r})=>{const i={method:\"POST\",headers:{\"Content-Type\":\"application/json\",...r},body:JSON.stringify(n)};return Q.fetch(`${t}/api/eval/${e}`,i)},eventSourceCall:({host:t,clientKey:e,headers:n})=>n?new Q.EventSource(`${t}/sub/${e}`,{headers:n}):new Q.EventSource(`${t}/sub/${e}`),startIdleListener:()=>{let t;if(\"undefined\"==typeof window||\"undefined\"==typeof document)return;const e=()=>{\"visible\"===document.visibilityState?(window.clearTimeout(t),nt.forEach((t=>{t&&\"idle\"===t.state&&wt(t)}))):\"hidden\"===document.visibilityState&&(t=window.setTimeout(it,Z.idleStreamInterval))};return document.addEventListener(\"visibilitychange\",e),()=>document.removeEventListener(\"visibilitychange\",e)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(Q.localStorage=globalThis.localStorage)}catch(t){}const X=new Map;let Y=!1;const tt=new Map,et=new Map,nt=new Map,rt=new Set;function it(){nt.forEach((t=>{t&&(t.state=\"idle\",dt(t))}))}async function st(){try{if(!Q.localStorage)return;await Q.localStorage.setItem(Z.cacheKey,JSON.stringify(Array.from(tt.entries())))}catch(t){}}function ot(t){const[e,n]=t.getApiInfo();return`${e}||${n}`}function ut(t){const e=ot(t);if(!(\"isRemoteEval\"in t)||!t.isRemoteEval())return e;const n=t.getAttributes(),r=t.getCacheKeyAttributes()||Object.keys(t.getAttributes()),i={};r.forEach((t=>{i[t]=n[t]}));const s=t.getForcedVariations(),o=t.getUrl();return`${e}||${JSON.stringify({ca:i,fv:s,url:o})}`}function ct(){const t=Array.from(tt.entries()).map((([t,e])=>({key:t,staleAt:e.staleAt.getTime()}))).sort(((t,e)=>t.staleAt-e.staleAt)),e=Math.min(Math.max(0,tt.size-Z.maxEntries),tt.size);for(let n=0;n<e;n++)tt.delete(t[n].key)}function at(t,e,n){const r=n.dateUpdated||\"\",i=new Date(Date.now()+Z.staleTTL),s=Z.disableCache?void 0:tt.get(e);if(s&&r&&s.version===r)return s.staleAt=i,void st();Z.disableCache||(tt.set(e,{data:n,version:r,staleAt:i,sse:rt.has(t)}),ct()),st();const o=X.get(t);o&&o.forEach((t=>async function(t,e){await t.setPayload(e||t.getPayload())}(t,n)))}async function lt(t){const{apiHost:e,apiRequestHeaders:n}=t.getApiHosts(),r=t.getClientKey(),i=\"isRemoteEval\"in t&&t.isRemoteEval(),s=ot(t),o=ut(t);let u=et.get(o);return u||(u=(i?W.fetchRemoteEvalCall({host:e,clientKey:r,payload:{attributes:t.getAttributes(),forcedVariations:t.getForcedVariations(),forcedFeatures:Array.from(t.getForcedFeatures().entries()),url:t.getUrl()},headers:n}):W.fetchFeaturesCall({host:e,clientKey:r,headers:n})).then((t=>{if(!t.ok)throw new Error(`HTTP error: ${t.status}`);return\"enabled\"===t.headers.get(\"x-sse-support\")&&rt.add(s),t.json()})).then((e=>(at(s,o,e),ht(t),et.delete(o),{data:e,success:!0,source:\"network\"}))).catch((t=>(et.delete(o),{data:null,source:\"error\",success:!1,error:t}))),et.set(o,u)),u}function ht(t,e=!1){const n=ot(t),r=ut(t),{streamingHost:i,streamingHostRequestHeaders:s}=t.getApiHosts(),o=t.getClientKey();if(e&&rt.add(n),Z.backgroundSync&&rt.has(n)&&Q.EventSource){if(nt.has(n))return;const t={src:null,host:i,clientKey:o,headers:s,cb:e=>{try{if(\"features-updated\"===e.type){const t=X.get(n);t&&t.forEach((t=>{lt(t)}))}else if(\"features\"===e.type){const t=JSON.parse(e.data);at(n,r,t)}t.errors=0}catch(e){ft(t)}},errors:0,state:\"active\"};nt.set(n,t),wt(t)}}function ft(t){if(\"idle\"!==t.state&&(t.errors++,t.errors>3||t.src&&2===t.src.readyState)){const e=Math.pow(3,t.errors-3)*(1e3+1e3*Math.random());dt(t),setTimeout((()=>{[\"idle\",\"active\"].includes(t.state)||wt(t)}),Math.min(e,3e5))}}function dt(t){t.src&&(t.src.onopen=null,t.src.onerror=null,t.src.close(),t.src=null,\"active\"===t.state&&(t.state=\"disabled\"))}function wt(t){t.src=W.eventSourceCall({host:t.host,clientKey:t.clientKey,headers:t.headers}),t.state=\"active\",t.src.addEventListener(\"features\",t.cb),t.src.addEventListener(\"features-updated\",t.cb),t.src.onerror=()=>ft(t),t.src.onopen=()=>{t.errors=0}}function yt(t,e){dt(t),nt.delete(e)}function pt(){rt.clear(),nt.forEach(yt),X.clear(),W.stopIdleListener()}function gt(t,e){if(e.streaming){if(!t.getClientKey())throw new Error(\"Must specify clientKey to enable streaming\");e.payload&&ht(t,!0),function(t){const e=ot(t),n=X.get(e)||new Set;n.add(t),X.set(e,n)}(t)}}const mt={};function vt(t,e,n){n=n||{};for(const[r,i]of Object.entries(e))switch(r){case\"$or\":if(!Ct(t,i,n))return!1;break;case\"$nor\":if(Ct(t,i,n))return!1;break;case\"$and\":if(!Et(t,i,n))return!1;break;case\"$not\":if(vt(t,i,n))return!1;break;default:if(!St(i,bt(t,r),n))return!1}return!0}function bt(t,e){const n=e.split(\".\");let r=t;for(let t=0;t<n.length;t++){if(!r||\"object\"!=typeof r||!(n[t]in r))return null;r=r[n[t]]}return r}function kt(t,e=!1){const n=`${t}${e?\"/i\":\"\"}`;return mt[n]||(mt[n]=new RegExp(t.replace(/([^\\\\])\\//g,\"$1\\\\/\"),e?\"i\":void 0)),mt[n]}function St(t,e,n,r=!1){if(\"string\"==typeof t)return r?String(e).toLowerCase()===t.toLowerCase():e+\"\"===t;if(\"number\"==typeof t)return 1*e===t;if(\"boolean\"==typeof t)return null!==e&&!!e===t;if(null===t)return null===e;if(Array.isArray(t)||!At(t))return JSON.stringify(e)===JSON.stringify(t);for(const r in t)if(!xt(r,e,t[r],n))return!1;return!0}function At(t){const e=Object.keys(t);return e.length>0&&e.filter((t=>\"$\"===t[0])).length===e.length}function _t(t,e,n=!1){if(n){const n=t=>\"string\"==typeof t?t.toLowerCase():t;return Array.isArray(t)?t.some((t=>e.some((e=>n(t)===n(e))))):e.some((e=>n(t)===n(e)))}return Array.isArray(t)?t.some((t=>e.includes(t))):e.includes(t)}function $t(t,e,n,r=!1){if(!Array.isArray(t))return!1;for(let i=0;i<e.length;i++){let s=!1;for(let o=0;o<t.length;o++)if(St(e[i],t[o],n,r)){s=!0;break}if(!s)return!1}return!0}function xt(t,e,n,r){switch(t){case\"$veq\":return K(e)===K(n);case\"$vne\":return K(e)!==K(n);case\"$vgt\":return K(e)>K(n);case\"$vgte\":return K(e)>=K(n);case\"$vlt\":return K(e)<K(n);case\"$vlte\":return K(e)<=K(n);case\"$eq\":return e===n;case\"$ne\":return e!==n;case\"$lt\":return e<n;case\"$lte\":return e<=n;case\"$gt\":return e>n;case\"$gte\":return e>=n;case\"$exists\":return n?null!=e:null==e;case\"$in\":return!!Array.isArray(n)&&_t(e,n);case\"$ini\":return!!Array.isArray(n)&&_t(e,n,!0);case\"$inGroup\":return _t(e,r[n]||[]);case\"$notInGroup\":return!_t(e,r[n]||[]);case\"$nin\":return!!Array.isArray(n)&&!_t(e,n);case\"$nini\":return!!Array.isArray(n)&&!_t(e,n,!0);case\"$not\":return!St(n,e,r);case\"$size\":return!!Array.isArray(e)&&St(n,e.length,r);case\"$elemMatch\":return function(t,e,n){if(!Array.isArray(t))return!1;const r=At(e)?t=>St(e,t,n):t=>vt(t,e,n);for(let e=0;e<t.length;e++)if(t[e]&&r(t[e]))return!0;return!1}(e,n,r);case\"$all\":return!!Array.isArray(n)&&$t(e,n,r);case\"$alli\":return!!Array.isArray(n)&&$t(e,n,r,!0);case\"$regex\":try{return kt(n).test(e)}catch(t){return!1}case\"$regexi\":try{return kt(n,!0).test(e)}catch(t){return!1}case\"$type\":return function(t){if(null===t)return\"null\";if(Array.isArray(t))return\"array\";const e=typeof t;return[\"string\",\"number\",\"boolean\",\"object\",\"undefined\"].includes(e)?e:\"unknown\"}(e)===n;default:return console.error(\"Unknown operator: \"+t),!1}}function Ct(t,e,n){if(!e.length)return!0;for(let r=0;r<e.length;r++)if(vt(t,e[r],n))return!0;return!1}function Et(t,e,n){for(let r=0;r<e.length;r++)if(!vt(t,e[r],n))return!1;return!0}const Ot=\"Feature Evaluated\",Tt=\"Experiment Viewed\";async function Nt(t){try{await t()}catch(t){}}function Dt(t,e,n){if(t.user.trackedExperiments){const r=Ht(e,n);if(t.user.trackedExperiments.has(r))return[];t.user.trackedExperiments.add(r)}t.user.enableDevMode&&t.user.devLogs&&t.user.devLogs.push({experiment:e,result:n,timestamp:Date.now().toString(),logType:\"experiment\"});const r=[];if(t.global.trackingCallback){const i=t.global.trackingCallback;r.push(Nt((()=>i(e,n,t.user))))}if(t.user.trackingCallback){const i=t.user.trackingCallback;r.push(Nt((()=>i(e,n))))}if(t.global.eventLogger){const i=t.global.eventLogger;r.push(Nt((()=>i(Tt,{experimentId:e.key,variationId:n.key,hashAttribute:n.hashAttribute,hashValue:n.hashValue},t.user))))}return r}function Ft(t,e){if(e.stack.evaluatedFeatures.has(t))return Rt(e,t,null,\"cyclicPrerequisite\");e.stack.evaluatedFeatures.add(t),e.stack.id=t;const n=function(t){const e=new Map;return t.global.forcedFeatureValues&&t.global.forcedFeatureValues.forEach(((t,n)=>e.set(n,t))),t.user.forcedFeatureValues&&t.user.forcedFeatureValues.forEach(((t,n)=>e.set(n,t))),e}(e);if(n.has(t))return Rt(e,t,n.get(t),\"override\");if(!e.global.features||!e.global.features[t])return Rt(e,t,null,\"unknownFeature\");const r=e.global.features[t];if(r.rules){const n=new Set(e.stack.evaluatedFeatures);t:for(const i of r.rules){if(i.parentConditions)for(const r of i.parentConditions){e.stack.evaluatedFeatures=new Set(n);const i=Ft(r.id,e);if(\"cyclicPrerequisite\"===i.source)return Rt(e,t,null,\"cyclicPrerequisite\");if(!vt({value:i.value},r.condition||{})){if(r.gate)return Rt(e,t,null,\"prerequisite\");continue t}}if(i.filters&&Ut(i.filters,e))continue;if(\"force\"in i){if(i.condition&&!It(i.condition,e))continue;if(!Vt(e,i.seed||t,i.hashAttribute,e.user.saveStickyBucketAssignmentDoc&&!i.disableStickyBucketing?i.fallbackAttribute:void 0,i.range,i.coverage,i.hashVersion))continue;return i.tracks&&i.tracks.forEach((t=>{!Dt(e,t.experiment,t.result).length&&e.global.saveDeferredTrack&&e.global.saveDeferredTrack({experiment:t.experiment,result:t.result})})),Rt(e,t,i.force,\"force\",i.id)}if(!i.variations)continue;const r={variations:i.variations,key:i.key||t};\"coverage\"in i&&(r.coverage=i.coverage),i.weights&&(r.weights=i.weights),i.hashAttribute&&(r.hashAttribute=i.hashAttribute),i.fallbackAttribute&&(r.fallbackAttribute=i.fallbackAttribute),i.disableStickyBucketing&&(r.disableStickyBucketing=i.disableStickyBucketing),void 0!==i.bucketVersion&&(r.bucketVersion=i.bucketVersion),void 0!==i.minBucketVersion&&(r.minBucketVersion=i.minBucketVersion),i.namespace&&(r.namespace=i.namespace),i.meta&&(r.meta=i.meta),i.ranges&&(r.ranges=i.ranges),i.name&&(r.name=i.name),i.phase&&(r.phase=i.phase),i.seed&&(r.seed=i.seed),i.hashVersion&&(r.hashVersion=i.hashVersion),i.filters&&(r.filters=i.filters),i.condition&&(r.condition=i.condition);const{result:s}=Mt(r,t,e);if(e.global.onExperimentEval&&e.global.onExperimentEval(r,s),s.inExperiment&&!s.passthrough)return Rt(e,t,s.value,\"experiment\",i.id,r,s)}}return Rt(e,t,void 0===r.defaultValue?null:r.defaultValue,\"defaultValue\")}function Mt(t,e,n){const r=t.key,i=t.variations.length;if(i<2)return{result:jt(n,t,-1,!1,e)};if(!1===n.global.enabled||!1===n.user.enabled)return{result:jt(n,t,-1,!1,e)};if(t=function(t,e){const n=t.key,r=e.global.overrides;return r&&r[n]&&\"string\"==typeof(t=Object.assign({},t,r[n])).url&&(t.url=U(t.url)),t}(t,n),t.urlPatterns&&!V(n.user.url||\"\",t.urlPatterns))return{result:jt(n,t,-1,!1,e)};const s=function(t,e,n){if(!e)return null;const r=e.split(\"?\")[1];if(!r)return null;const i=r.replace(/#.*/,\"\").split(\"&\").map((t=>t.split(\"=\",2))).filter((([e])=>e===t)).map((([,t])=>parseInt(t)));return i.length>0&&i[0]>=0&&i[0]<n?i[0]:null}(r,n.user.url||\"\",i);if(null!==s)return{result:jt(n,t,s,!1,e)};const o=function(t){return t.global.forcedVariations&&t.user.forcedVariations?{...t.global.forcedVariations,...t.user.forcedVariations}:t.global.forcedVariations?t.global.forcedVariations:t.user.forcedVariations?t.user.forcedVariations:{}}(n);if(r in o)return{result:jt(n,t,o[r],!1,e)};if(\"draft\"===t.status||!1===t.active)return{result:jt(n,t,-1,!1,e)};const{hashAttribute:u,hashValue:c}=Jt(n,t.hashAttribute,n.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing?t.fallbackAttribute:void 0);if(!c)return{result:jt(n,t,-1,!1,e)};let a=-1,l=!1,h=!1;if(n.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing){const{variation:e,versionIsBlocked:r}=function({ctx:t,expKey:e,expBucketVersion:n,expHashAttribute:r,expFallbackAttribute:i,expMinBucketVersion:s,expMeta:o}){s=s||0,r=r||\"id\",o=o||[];const u=Pt(e,n=n||0),c=function(t,e,n){if(!t.user.stickyBucketAssignmentDocs)return{};const{hashAttribute:r,hashValue:i}=Jt(t,e),s=Lt(r,L(i)),{hashAttribute:o,hashValue:u}=Jt(t,n),c=u?Lt(o,L(u)):null,a={};return c&&t.user.stickyBucketAssignmentDocs[c]&&Object.assign(a,t.user.stickyBucketAssignmentDocs[c].assignments||{}),t.user.stickyBucketAssignmentDocs[s]&&Object.assign(a,t.user.stickyBucketAssignmentDocs[s].assignments||{}),a}(t,r,i);if(s>0)for(let t=0;t<s;t++)if(void 0!==c[Pt(e,t)])return{variation:-1,versionIsBlocked:!0};const a=c[u];if(void 0===a)return{variation:-1};const l=o.findIndex((t=>t.key===a));return l<0?{variation:-1}:{variation:l}}({ctx:n,expKey:t.key,expBucketVersion:t.bucketVersion,expHashAttribute:t.hashAttribute,expFallbackAttribute:t.fallbackAttribute,expMinBucketVersion:t.minBucketVersion,expMeta:t.meta});l=e>=0,a=e,h=!!r}if(!l){if(t.filters){if(Ut(t.filters,n))return{result:jt(n,t,-1,!1,e)}}else if(t.namespace&&!function(t,e){const n=B(\"__\"+e[0],t,1);return null!==n&&n>=e[1]&&n<e[2]}(c,t.namespace))return{result:jt(n,t,-1,!1,e)};if(t.include&&!function(t){try{return t()}catch(t){return console.error(t),!1}}(t.include))return{result:jt(n,t,-1,!1,e)};if(t.condition&&!It(t.condition,n))return{result:jt(n,t,-1,!1,e)};if(t.parentConditions){const r=new Set(n.stack.evaluatedFeatures);for(const i of t.parentConditions){n.stack.evaluatedFeatures=new Set(r);const s=Ft(i.id,n);if(\"cyclicPrerequisite\"===s.source)return{result:jt(n,t,-1,!1,e)};if(!vt({value:s.value},i.condition||{}))return{result:jt(n,t,-1,!1,e)}}}if(t.groups&&!function(t,e){const n=e.global.groups||{};for(let e=0;e<t.length;e++)if(n[t[e]])return!0;return!1}(t.groups,n))return{result:jt(n,t,-1,!1,e)}}if(t.url&&!function(t,e){const n=e.user.url;if(!n)return!1;const r=n.replace(/^https?:\\/\\//,\"\").replace(/^[^/]*\\//,\"/\");return!!t.test(n)||!!t.test(r)}(t.url,n))return{result:jt(n,t,-1,!1,e)};const f=B(t.seed||r,c,t.hashVersion||1);if(null===f)return{result:jt(n,t,-1,!1,e)};if(l||(a=function(t,e){for(let n=0;n<e.length;n++)if(I(t,e[n]))return n;return-1}(f,t.ranges||function(t,e,n){(e=void 0===e?1:e)<0?e=0:e>1&&(e=1);const r=(i=t)<=0?[]:new Array(i).fill(1/i);var i;(n=n||r).length!==t&&(n=r);const s=n.reduce(((t,e)=>e+t),0);(s<.99||s>1.01)&&(n=r);let o=0;return n.map((t=>{const n=o;return o+=t,[n,n+e*t]}))}(i,void 0===t.coverage?1:t.coverage,t.weights))),h)return{result:jt(n,t,-1,!1,e,void 0,!0)};if(a<0)return{result:jt(n,t,-1,!1,e)};if(\"force\"in t)return{result:jt(n,t,void 0===t.force?-1:t.force,!1,e)};if(n.global.qaMode||n.user.qaMode)return{result:jt(n,t,-1,!1,e)};if(\"stopped\"===t.status)return{result:jt(n,t,-1,!1,e)};const d=jt(n,t,a,!0,e,f,l);if(n.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing){const{changed:e,key:r,doc:i}=function(t,e,n,r){const i=Lt(e,n),s=t.user.stickyBucketAssignmentDocs&&t.user.stickyBucketAssignmentDocs[i]&&t.user.stickyBucketAssignmentDocs[i].assignments||{},o={...s,...r};return{key:i,doc:{attributeName:e,attributeValue:n,assignments:o},changed:JSON.stringify(s)!==JSON.stringify(o)}}(n,u,L(c),{[Pt(t.key,t.bucketVersion)]:d.key});e&&(n.user.stickyBucketAssignmentDocs=n.user.stickyBucketAssignmentDocs||{},n.user.stickyBucketAssignmentDocs[r]=i,n.user.saveStickyBucketAssignmentDoc(i))}const w=Dt(n,t,d);0===w.length&&n.global.saveDeferredTrack&&n.global.saveDeferredTrack({experiment:t,result:d});const y=w.length?1===w.length?w[0]:Promise.all(w).then((()=>{})):void 0;return\"changeId\"in t&&t.changeId&&n.global.recordChangeId&&n.global.recordChangeId(t.changeId),{result:d,trackingCall:y}}function Rt(t,e,n,r,i,s,o){const u={value:n,on:!!n,off:!n,source:r,ruleId:i||\"\"};return s&&(u.experiment=s),o&&(u.experimentResult=o),\"override\"!==r&&function(t,e,n){if(t.user.trackedFeatureUsage){const r=JSON.stringify(n.value);if(t.user.trackedFeatureUsage[e]===r)return;t.user.trackedFeatureUsage[e]=r,t.user.enableDevMode&&t.user.devLogs&&t.user.devLogs.push({featureKey:e,result:n,timestamp:Date.now().toString(),logType:\"feature\"})}if(t.global.onFeatureUsage){const r=t.global.onFeatureUsage;Nt((()=>r(e,n,t.user)))}if(t.user.onFeatureUsage){const r=t.user.onFeatureUsage;Nt((()=>r(e,n)))}if(t.global.eventLogger){const r=t.global.eventLogger;Nt((()=>r(Ot,{feature:e,source:n.source,value:n.value,ruleId:\"defaultValue\"===n.source?\"$default\":n.ruleId||\"\",variationId:n.experimentResult?n.experimentResult.key:\"\"},t.user)))}}(t,e,u),u}function Bt(t){return{...t.user.attributes,...t.user.attributeOverrides}}function It(t,e){return vt(Bt(e),t,e.global.savedGroups||{})}function Ut(t,e){return t.some((t=>{const{hashValue:n}=Jt(e,t.attribute);if(!n)return!0;const r=B(t.seed,n,t.hashVersion||2);return null===r||!t.ranges.some((t=>I(r,t)))}))}function Vt(t,e,n,r,i,s,o){if(!i&&void 0===s)return!0;if(!i&&0===s)return!1;const{hashValue:u}=Jt(t,n,r);if(!u)return!1;const c=B(e,u,o||1);return null!==c&&(i?I(c,i):void 0===s||c<=s)}function jt(t,e,n,r,i,s,o){let u=!0;(n<0||n>=e.variations.length)&&(n=0,u=!1);const{hashAttribute:c,hashValue:a}=Jt(t,e.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0),l=e.meta?e.meta[n]:{},h={key:l.key||\"\"+n,featureId:i,inExperiment:u,hashUsed:r,variationId:n,value:e.variations[n],hashAttribute:c,hashValue:a,stickyBucketUsed:!!o};return l.name&&(h.name=l.name),void 0!==s&&(h.bucket=s),l.passthrough&&(h.passthrough=l.passthrough),h}function Jt(t,e,n){let r=e||\"id\",i=\"\";const s=Bt(t);return s[r]&&(i=s[r]),!i&&n&&(s[n]&&(i=s[n]),i&&(r=n)),{hashAttribute:r,hashValue:i}}function Pt(t,e){return`${t}__${e=e||0}`}function Lt(t,e){return`${t}||${e}`}function Kt(t,e){const n={},r=function(t,e){const n=new Set,r=e&&e.features?e.features:t.global.features||{},i=e&&e.experiments?e.experiments:t.global.experiments||[];return Object.keys(r).forEach((t=>{const e=r[t];if(e.rules)for(const t of e.rules)t.variations&&(n.add(t.hashAttribute||\"id\"),t.fallbackAttribute&&n.add(t.fallbackAttribute))})),i.map((t=>{n.add(t.hashAttribute||\"id\"),t.fallbackAttribute&&n.add(t.fallbackAttribute)})),Array.from(n)}(t,e);return r.forEach((e=>{const{hashValue:r}=Jt(t,e);n[e]=L(r)})),n}function Ht(t,e){return e.hashAttribute+e.hashValue+t.key+e.variationId}const qt=\"undefined\"!=typeof window&&\"undefined\"!=typeof document,Gt=H();class zt{constructor(t){this.prefix=(t=t||{}).prefix||\"\"}async getAllAssignments(t){const e={};return(await Promise.all(Object.entries(t).map((([t,e])=>this.getAssignments(t,e))))).forEach((t=>{if(t){const n=Lt(t.attributeName,t.attributeValue);e[n]=t}})),e}getKey(t,e){return`${this.prefix}${t}||${e}`}}class Zt extends zt{async getAssignments(t,e){return this.getAssignmentsSync(t,e)}async saveAssignments(t){this.saveAssignmentsSync(t)}getAllAssignmentsSync(t){const e={};return Object.entries(t).map((([t,e])=>this.getAssignmentsSync(t,e))).forEach((t=>{if(t){const n=Lt(t.attributeName,t.attributeValue);e[n]=t}})),e}}function Qt(t){return{browser:t.match(/Edg/)?\"edge\":t.match(/Chrome/)?\"chrome\":t.match(/Firefox/)?\"firefox\":t.match(/Safari/)?\"safari\":\"unknown\",deviceType:t.match(/Mobi/)?\"mobile\":\"desktop\"}}function Wt(t){return t?{url:t.href,path:t.pathname,host:t.host,query:t.search}:{}}function Xt(t){let e={};try{const t=sessionStorage.getItem(\"utm_params\");t&&(e=JSON.parse(t))}catch(t){}if(t&&t.search){const n=new URLSearchParams(t.search);let r=!1;if([\"source\",\"medium\",\"campaign\",\"term\",\"content\"].forEach((t=>{const i=`utm_${t}`,s=\"utm\"+t[0].toUpperCase()+t.slice(1);n.has(i)&&(e[s]=n.get(i)||\"\",r=!0)})),r)try{sessionStorage.setItem(\"utm_params\",JSON.stringify(e))}catch(t){}}return e}function Yt(){if(\"undefined\"==typeof window||!window.dataLayer||!window.dataLayer.forEach)return{};const t={};return window.dataLayer.forEach((e=>{e&&\"object\"==typeof e&&!(\"length\"in e)&&(\"event\"in e||Object.keys(e).forEach((n=>{if(\"string\"!=typeof n||n.match(/^(gtm)/))return;const r=e[n];[\"string\",\"number\",\"boolean\"].includes(typeof r)&&(t[n]=r)})))})),t}const te=H();function ee(t){return\"string\"==typeof t?t:null}window.dataLayer=window.dataLayer||[];const ne=document.currentScript,re=ne?ne.dataset:{},ie=window.growthbook_config||{};let se,oe;function ue(){window.clearTimeout(se);let t=ie.antiFlickerTimeout??(re.antiFlickerTimeout?parseInt(re.antiFlickerTimeout):null)??3500;isFinite(t)||(t=3500);try{if(!document.getElementById(\"gb-anti-flicker-style\")){const t=document.createElement(\"style\");t.setAttribute(\"id\",\"gb-anti-flicker-style\"),t.innerHTML=\".gb-anti-flicker { opacity: 0 !important; pointer-events: none; }\",document.head.appendChild(t)}document.documentElement.classList.add(\"gb-anti-flicker\"),se=window.setTimeout(ce,t)}catch(t){console.error(t)}}function ce(){window.clearTimeout(se);try{document.documentElement.classList.remove(\"gb-anti-flicker\")}catch(t){console.error(t)}}(ie.antiFlicker||re.antiFlicker)&&ue(),\"cookie\"===ie.useStickyBucketService||\"cookie\"===re.useStickyBucketService?oe=new class extends Zt{constructor({prefix:t=\"gbStickyBuckets__\",jsCookie:e,cookieAttributes:n={expires:180}}){super(),this.prefix=t,this.jsCookie=e,this.cookieAttributes=n}getAssignmentsSync(t,e){const n=this.getKey(t,e);let r=null;if(!this.jsCookie)return r;try{const t=this.jsCookie.get(n),e=JSON.parse(t||\"{}\");e.attributeName&&e.attributeValue&&e.assignments&&(r=e)}catch(t){}return r}async saveAssignmentsSync(t){const e=this.getKey(t.attributeName,t.attributeValue);if(!this.jsCookie)return;const n=JSON.stringify(t);this.jsCookie.set(e,n,this.cookieAttributes)}}({prefix:ie.stickyBucketPrefix||re.stickyBucketPrefix||void 0,jsCookie:e}):\"localStorage\"!==ie.useStickyBucketService&&\"localStorage\"!==re.useStickyBucketService||(oe=new class extends zt{constructor(t){t=t||{},super(),this.prefix=t.prefix||\"gbStickyBuckets__\";try{this.localStorage=t.localStorage||globalThis.localStorage}catch(t){}}async getAssignments(t,e){const n=this.getKey(t,e);let r=null;if(!this.localStorage)return r;try{const t=await this.localStorage.getItem(n)||\"{}\",e=JSON.parse(t);e.attributeName&&e.attributeValue&&e.assignments&&(r=e)}catch(t){}return r}async saveAssignments(t){const e=this.getKey(t.attributeName,t.attributeValue);if(this.localStorage)try{await this.localStorage.setItem(e,JSON.stringify(t))}catch(t){}}}({prefix:ie.stickyBucketPrefix||re.stickyBucketPrefix||void 0}));const ae=re.uuid||ie.uuid,le=[function(t={}){if(\"undefined\"==typeof window)throw new Error(\"autoAttributesPlugin only works in the browser\");const e=t.uuidCookieName||\"gbuuid\",n=t.uuidKey||\"id\";let r=t.uuid||\"\";function i(){!function(t,e){const n=new Date;n.setTime(n.getTime()+3456e7),document.cookie=t+\"=\"+e+\";path=/;expires=\"+n.toUTCString()}(e,r)}function s(t){const s=navigator.userAgent,o=r||(r=function(t){const e=(\"; \"+document.cookie).split(`; ${t}=`);return 2===e.length?e[1].split(\";\")[0]:\"\"}(e),r||(u=window.crypto,r=u&&u.randomUUID?u.randomUUID():\"10000000-1000-4000-8000-100000000000\".replace(/[018]/g,(t=>(t^(u&&u.getRandomValues?u.getRandomValues(new Uint8Array(1))[0]:Math.floor(256*Math.random()))&15>>t/4).toString(16))),r));var u;(t.uuidAutoPersist??!t.uuid)&&i();const c=location;return{...Yt(),[n]:o,...Wt(c),pageTitle:document.title,...Qt(s),...Xt(c)}}return document.addEventListener(\"growthbookpersist\",(()=>{i()})),e=>{if(\"createScopedInstance\"in e)return;const n=s(t);n.url&&e.setURL(n.url),e.updateAttributes(n);let r=n.url;const i=setInterval((()=>{location.href!==r&&(r=location.href,e.setURL(r),e.updateAttributes(s(t)))}),500),o=()=>{location.href!==r&&(r=location.href,e.setURL(r)),e.updateAttributes(s(t))};document.addEventListener(\"growthbookrefresh\",o),\"onDestroy\"in e&&e.onDestroy((()=>{clearInterval(i),document.removeEventListener(\"growthbookrefresh\",o)}))}}({uuid:ae,uuidCookieName:ie.uuidCookieName||re.uuidCookieName,uuidKey:ie.uuidKey||re.uuidKey,uuidAutoPersist:!ae&&null==re.noAutoCookies})],he=re.tracking||\"gtag,gtm,segment\";if(\"none\"!==he){const t=he.toLowerCase().split(\",\").map((t=>t.trim()));t.includes(\"growthbook\")&&le.push(function({queueFlushInterval:t=100,ingestorHost:e,enable:n=!0,debug:r,dedupeCacheSize:i=1e3,dedupeKeyAttributes:s=[],eventFilter:o}={}){return u=>{const c=u.getClientKey();if(!c)throw new Error(\"clientKey must be specified to use event logging\");const a=new Set;if(\"setEventLogger\"in u){let l=[],h=null;const f=async()=>{const t=l;l=[],h&&clearTimeout(h),h=null,t.length&&await async function({clientKey:t,ingestorHost:e,events:n}){if(!n.length)return;const r=`${e||\"https://us1.gb-ingest.com\"}/track?client_key=${t}`,i=JSON.stringify(n);try{await fetch(r,{method:\"POST\",body:i,headers:{Accept:\"application/json\",\"Content-Type\":\"text/plain\"},credentials:\"omit\"})}catch(t){console.error(\"Failed to track event\",t)}}({clientKey:c,events:t,ingestorHost:e})};let d=null;u.setEventLogger((async(e,u,c)=>{const w={eventName:e,properties:u,attributes:c.attributes||{},url:c.url||\"\"};if(o&&!o(w))return;if(e===Ot||e===Tt){const t={eventName:e,properties:u};for(const e of s)t[\"attr:\"+e]=w.attributes[e];const n=JSON.stringify(t);if(a.has(n))return a.delete(n),void a.add(n);if(a.add(n),a.size>i){const t=a.values().next().value;t&&a.delete(t)}}const y=function({eventName:t,properties:e,attributes:n,url:r}){const{nested:i,topLevel:s}=function(t){const{user_id:e,device_id:n,anonymous_id:r,id:i,page_id:s,session_id:o,utmCampaign:u,utmContent:c,utmMedium:a,utmSource:l,utmTerm:h,pageTitle:f,...d}=t;return{nested:d,topLevel:{user_id:ee(e),device_id:ee(n||r||i),page_id:ee(s),session_id:ee(o),utm_campaign:ee(u)||void 0,utm_content:ee(c)||void 0,utm_medium:ee(a)||void 0,utm_source:ee(l)||void 0,utm_term:ee(h)||void 0,page_title:ee(f)||void 0}}}(n||{});return{event_name:t,properties_json:e||{},...s,sdk_language:\"js\",sdk_version:te,url:r,context_json:i}}(w);r&&console.log(\"Logging event to GrowthBook\",JSON.parse(JSON.stringify(y))),n&&(l.push(y),d||(d=new Promise(((e,n)=>{h=setTimeout((()=>{f().then(e).catch(n),d=null}),t)}))),await d)})),\"undefined\"!=typeof document&&document.visibilityState&&document.addEventListener(\"visibilitychange\",(()=>{\"hidden\"===document.visibilityState&&f().catch(console.error)})),\"onDestroy\"in u&&u.onDestroy((()=>{f().catch(console.error)}))}if(\"undefined\"!=typeof window&&!(\"createScopedInstance\"in u)){const t=Array.isArray(window.gbEvents)?window.gbEvents:[];window.gbEvents={push:t=>{\"isDestroyed\"in u&&u.isDestroyed()?window.gbEvents=[t]:\"string\"==typeof t?u.logEvent(t):t&&u.logEvent(t.eventName,t.properties)}};for(const e of t)window.gbEvents.push(e)}}}({ingestorHost:re.eventIngestorHost})),ie.trackingCallback||le.push(function({additionalCallback:t,trackers:e=[\"gtag\",\"gtm\",\"segment\"]}={}){if(\"undefined\"==typeof window)throw new Error(\"thirdPartyTrackingPlugin only works in the browser\");return n=>{n.setTrackingCallback((async(n,r)=>{const i=[],s={experiment_id:n.key,variation_id:r.key};if(t&&i.push(Promise.resolve(t(n,r))),e.includes(\"gtag\")&&window.gtag){let t;const e=new Promise((e=>{t=e}));i.push(e),window.gtag(\"event\",\"experiment_viewed\",{...s,event_callback:t})}if(e.includes(\"gtm\")&&window.dataLayer){let t;const e=new Promise((e=>{t=e}));i.push(e),window.dataLayer.push({event:\"experiment_viewed\",...s,eventCallback:t})}if(e.includes(\"segment\")&&window.analytics&&window.analytics.track){window.analytics.track(\"Experiment Viewed\",s);const t=new Promise((t=>window.setTimeout(t,300)));i.push(t)}await Promise.all(i)}))}}({additionalCallback:ie.additionalTrackingCallback,trackers:t}))}const fe=new class{constructor(t){if(t=t||{},this.version=Gt,this.i=this.context=t,this.o=t.renderer||null,this.u=new Set,this.l=new Set,this.h={},this.debug=!!t.debug,this.p=new Set,this.ready=!1,this.g=new Map,this.m=new Map,this.v=new Set,this.k=!1,this.S=\"\",this.A=new Map,this._=!t.disableExperimentsOnLoad,this.$=[],this.logs=[],this.log=this.log.bind(this),this.C=this.C.bind(this),this.O=this.O.bind(this),this.T=this.T.bind(this),this.N=this.N.bind(this),t.remoteEval){if(t.decryptionKey)throw new Error(\"Encryption is not available for remoteEval\");if(!t.clientKey)throw new Error(\"Missing clientKey\");let e=!1;try{e=!!new URL(t.apiHost||\"\").hostname.match(/growthbook\\.io$/i)}catch(t){}if(e)throw new Error(\"Cannot use remoteEval on GrowthBook Cloud\")}else if(t.cacheKeyAttributes)throw new Error(\"cacheKeyAttributes are only used for remoteEval\");if(t.stickyBucketService){const e=t.stickyBucketService;this.D=t=>e.saveAssignments(t)}if(t.plugins)for(const e of t.plugins)e(this);if(t.features&&(this.ready=!0),qt&&t.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event(\"gbloaded\"))),t.experiments&&(this.ready=!0,this.F()),this.i.stickyBucketService&&this.i.stickyBucketAssignmentDocs)for(const t in this.i.stickyBucketAssignmentDocs){const e=this.i.stickyBucketAssignmentDocs[t];e&&this.i.stickyBucketService.saveAssignments(e).catch((()=>{}))}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(t){this.M=t;const e=await async function(t,e,n){if((t={...t}).encryptedFeatures){try{t.features=JSON.parse(await P(t.encryptedFeatures,e,n))}catch(t){console.error(t)}delete t.encryptedFeatures}if(t.encryptedExperiments){try{t.experiments=JSON.parse(await P(t.encryptedExperiments,e,n))}catch(t){console.error(t)}delete t.encryptedExperiments}if(t.encryptedSavedGroups){try{t.savedGroups=JSON.parse(await P(t.encryptedSavedGroups,e,n))}catch(t){console.error(t)}delete t.encryptedSavedGroups}return t}(t,this.i.decryptionKey);this.R=e,await this.refreshStickyBuckets(e),e.features&&(this.i.features=e.features),e.savedGroups&&(this.i.savedGroups=e.savedGroups),e.experiments&&(this.i.experiments=e.experiments,this.F()),this.ready=!0,this.B()}initSync(t){this.k=!0;const e=t.payload;if(e.encryptedExperiments||e.encryptedFeatures)throw new Error(\"initSync does not support encrypted payloads\");return this.i.stickyBucketService&&!this.i.stickyBucketAssignmentDocs&&(this.i.stickyBucketAssignmentDocs=this.generateStickyBucketAssignmentDocsSync(this.i.stickyBucketService,e)),this.M=e,this.R=e,e.features&&(this.i.features=e.features),e.experiments&&(this.i.experiments=e.experiments,this.F()),this.ready=!0,gt(this,t),this}async init(t){if(this.k=!0,(t=t||{}).cacheSettings&&(Object.assign(Z,t.cacheSettings),Z.backgroundSync||pt()),t.payload)return await this.setPayload(t.payload),gt(this,t),{success:!0,source:\"init\"};{const{data:e,...n}=await this.I({...t,allowStale:!0});return gt(this,t),await this.setPayload(e||{}),n}}async loadFeatures(t){t=t||{},await this.init({skipCache:t.skipCache,timeout:t.timeout,streaming:(this.i.backgroundSync??!0)&&(t.autoRefresh||this.i.subscribeToChanges)})}async refreshFeatures(t){const e=await this.I({...t||{},allowStale:!1});e.data&&await this.setPayload(e.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return function(t){const e=t.apiHost||\"https://cdn.growthbook.io\";return{apiHost:e.replace(/\\/*$/,\"\"),streamingHost:(t.streamingHost||e).replace(/\\/*$/,\"\"),apiRequestHeaders:t.apiHostRequestHeaders,streamingHostRequestHeaders:t.streamingHostRequestHeaders}}(this.i)}getClientKey(){return this.i.clientKey||\"\"}getPayload(){return this.M||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this.R||this.getPayload()}isRemoteEval(){return this.i.remoteEval||!1}getCacheKeyAttributes(){return this.i.cacheKeyAttributes}async I({timeout:t,skipCache:e,allowStale:n,streaming:r}){if(!this.i.clientKey)throw new Error(\"Missing clientKey\");return async function({instance:t,timeout:e,skipCache:n,allowStale:r,backgroundSync:i}){return i||(Z.backgroundSync=!1),async function({instance:t,allowStale:e,timeout:n,skipCache:r}){const i=ot(t),s=ut(t),o=new Date,u=new Date(o.getTime()-Z.maxAge+Z.staleTTL);await async function(){if(!Y){Y=!0;try{if(Q.localStorage){const t=await Q.localStorage.getItem(Z.cacheKey);if(!Z.disableCache&&t){const e=JSON.parse(t);e&&Array.isArray(e)&&e.forEach((([t,e])=>{tt.set(t,{...e,staleAt:new Date(e.staleAt)})})),ct()}}}catch(t){}if(!Z.disableIdleStreams){const t=W.startIdleListener();t&&(W.stopIdleListener=t)}}}();const c=Z.disableCache||r?void 0:tt.get(s);return c&&(e||c.staleAt>o)&&c.staleAt>u?(c.sse&&rt.add(i),c.staleAt<o?lt(t):ht(t),{data:c.data,success:!0,source:\"cache\"}):await z(lt(t),n)||{data:null,success:!1,source:\"timeout\",error:new Error(\"Timeout\")}}({instance:t,allowStale:r,timeout:e,skipCache:n})}({instance:this,timeout:t,skipCache:e||this.i.disableCache,allowStale:n,backgroundSync:r??this.i.backgroundSync??!0})}B(){if(this.o)try{this.o()}catch(t){console.error(\"Failed to render\",t)}}setFeatures(t){this.i.features=t,this.ready=!0,this.B()}async setEncryptedFeatures(t,e,n){const r=await P(t,e||this.i.decryptionKey,n);this.setFeatures(JSON.parse(r))}setExperiments(t){this.i.experiments=t,this.ready=!0,this.F()}async setEncryptedExperiments(t,e,n){const r=await P(t,e||this.i.decryptionKey,n);this.setExperiments(JSON.parse(r))}async setAttributes(t){this.i.attributes=t,this.i.stickyBucketService&&await this.refreshStickyBuckets(),this.i.remoteEval?await this.U():(this.B(),this.F())}async updateAttributes(t){return this.setAttributes({...this.i.attributes,...t})}async setAttributeOverrides(t){this.i.attributeOverrides=t,this.i.stickyBucketService&&await this.refreshStickyBuckets(),this.i.remoteEval?await this.U():(this.B(),this.F())}async setForcedVariations(t){this.i.forcedVariations=t||{},this.i.remoteEval?await this.U():(this.B(),this.F())}setForcedFeatures(t){this.i.forcedFeatureValues=t,this.B()}async setURL(t){if(t!==this.i.url){if(this.i.url=t,this.S=\"\",this.i.remoteEval)return await this.U(),void this.F(!0);this.F(!0)}}getAttributes(){return{...this.i.attributes,...this.i.attributeOverrides}}getForcedVariations(){return this.i.forcedVariations||{}}getForcedFeatures(){return this.i.forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this.i.stickyBucketAssignmentDocs||{}}getUrl(){return this.i.url||\"\"}getFeatures(){return this.i.features||{}}getExperiments(){return this.i.experiments||[]}getCompletedChangeIds(){return Array.from(this.l)}subscribe(t){return this.p.add(t),()=>{this.p.delete(t)}}async U(){if(!this.i.remoteEval)return;if(!this.k)return;const t=await this.I({allowStale:!1});t.data&&await this.setPayload(t.data)}getAllResults(){return new Map(this.g)}onDestroy(t){this.$.push(t)}isDestroyed(){return!!this.V}destroy(t){var e;t=t||{},this.V=!0,this.$.forEach((t=>{try{t()}catch(t){console.error(t)}})),this.p.clear(),this.g.clear(),this.u.clear(),this.l.clear(),this.A.clear(),this.h={},this.$=[],this.M=void 0,this.D=void 0,e=this,X.forEach((t=>t.delete(e))),t.destroyAllStreams&&pt(),this.logs=[],qt&&window._growthbook===this&&delete window._growthbook,this.m.forEach((t=>{t.undo()})),this.m.clear(),this.v.clear()}setRenderer(t){this.o=t}forceVariation(t,e){this.i.forcedVariations=this.i.forcedVariations||{},this.i.forcedVariations[t]=e,this.i.remoteEval?this.U():(this.F(),this.B())}run(t){const{result:e}=Mt(t,null,this.j());return this.O(t,e),e}triggerExperiment(t){return this.v.add(t),this.i.experiments?this.i.experiments.filter((e=>e.key===t)).map((t=>this.J(t))).filter((t=>null!==t)):null}triggerAutoExperiments(){this._=!0,this.F(!0)}j(){return{user:this.P(),global:this.L(),stack:{evaluatedFeatures:new Set}}}P(){return{attributes:this.i.user?{...this.i.user,...this.i.attributes}:this.i.attributes,enableDevMode:this.i.enableDevMode,blockedChangeIds:this.i.blockedChangeIds,stickyBucketAssignmentDocs:this.i.stickyBucketAssignmentDocs,url:this.K(),forcedVariations:this.i.forcedVariations,forcedFeatureValues:this.i.forcedFeatureValues,attributeOverrides:this.i.attributeOverrides,saveStickyBucketAssignmentDoc:this.D,trackingCallback:this.i.trackingCallback,onFeatureUsage:this.i.onFeatureUsage,devLogs:this.logs,trackedExperiments:this.u,trackedFeatureUsage:this.h}}L(){return{features:this.i.features,experiments:this.i.experiments,log:this.log,enabled:this.i.enabled,qaMode:this.i.qaMode,savedGroups:this.i.savedGroups,groups:this.i.groups,overrides:this.i.overrides,onExperimentEval:this.O,recordChangeId:this.N,saveDeferredTrack:this.C,eventLogger:this.i.eventLogger}}J(t,e){const n=this.m.get(t);if(t.manual&&!this.v.has(t.key)&&!n)return null;let r,i;this.H(t)?r=jt(this.j(),t,-1,!1,\"\"):(({result:r,trackingCall:i}=Mt(t,null,this.j())),this.O(t,r));const s=JSON.stringify(r.value);if(!e&&r.inExperiment&&n&&n.valueHash===s)return r;if(n&&this.q(t),r.inExperiment){const e=G(t);if(\"redirect\"===e&&r.value.urlRedirect&&t.urlPatterns){const e=t.persistQueryString?function(t,e){let n,r;try{n=new URL(t),r=new URL(e)}catch(t){return console.error(`Unable to merge query strings: ${t}`),e}return n.searchParams.forEach(((t,e)=>{r.searchParams.has(e)||r.searchParams.set(e,t)})),r.toString()}(this.K(),r.value.urlRedirect):r.value.urlRedirect;if(V(e,t.urlPatterns))return this.log(\"Skipping redirect because original URL matches redirect URL\",{id:t.key}),r;this.S=e;const{navigate:n,delay:s}=this.G();if(n)if(qt)Promise.all([...i?[z(i,this.i.maxNavigateDelay??1e3)]:[],new Promise((t=>window.setTimeout(t,this.i.navigateDelay??s)))]).then((()=>{try{n(e)}catch(t){console.error(t)}}));else try{n(e)}catch(t){console.error(t)}}else if(\"visual\"===e){const e=this.i.applyDomChangesCallback?this.i.applyDomChangesCallback(r.value):this.Z(r.value);e&&this.m.set(t,{undo:e,valueHash:s})}}return r}q(t){const e=this.m.get(t);e&&(e.undo(),this.m.delete(t))}F(t){if(!this._)return;const e=this.i.experiments||[],n=new Set(e);this.m.forEach(((t,e)=>{n.has(e)||(t.undo(),this.m.delete(e))}));for(const n of e){const e=this.J(n,t);if(e&&e.inExperiment&&\"redirect\"===G(n))break}}O(t,e){const n=this.g.get(t.key);this.g.set(t.key,{experiment:t,result:e}),this.p.size>0&&this.T(t,e,n)}T(t,e,n){n&&n.result.inExperiment===e.inExperiment&&n.result.variationId===e.variationId||this.p.forEach((n=>{try{n(t,e)}catch(t){console.error(t)}}))}N(t){this.l.add(t)}isOn(t){return this.evalFeature(t).on}isOff(t){return this.evalFeature(t).off}getFeatureValue(t,e){const n=this.evalFeature(t).value;return null===n?e:n}feature(t){return this.evalFeature(t)}evalFeature(t){return Ft(t,this.j())}log(t,e){this.debug&&(this.i.log?this.i.log(t,e):console.log(t,e))}getDeferredTrackingCalls(){return Array.from(this.A.values())}setDeferredTrackingCalls(t){this.A=new Map(t.filter((t=>t&&t.experiment&&t.result)).map((t=>[Ht(t.experiment,t.result),t])))}async fireDeferredTrackingCalls(){if(!this.i.trackingCallback)return;const t=[];this.A.forEach((e=>{e&&e.experiment&&e.result?t.push(this.i.trackingCallback(e.experiment,e.result)):console.error(\"Invalid deferred tracking call\",{call:e})})),this.A.clear(),await Promise.all(t)}setTrackingCallback(t){this.i.trackingCallback=t,this.fireDeferredTrackingCalls()}setEventLogger(t){this.i.eventLogger=t}async logEvent(t,e){if(this.V)console.error(\"Cannot log event to destroyed GrowthBook instance\");else if(this.i.enableDevMode&&this.logs.push({eventName:t,properties:e,timestamp:Date.now().toString(),logType:\"event\"}),this.i.eventLogger)try{await this.i.eventLogger(t,e||{},this.P())}catch(t){console.error(t)}else console.error(\"No event logger configured\")}C(t){this.A.set(Ht(t.experiment,t.result),t)}K(){return this.i.url||(qt?window.location.href:\"\")}H(t){const e=G(t);if(\"visual\"===e){if(this.i.disableVisualExperiments)return!0;if(this.i.disableJsInjection&&t.variations.some((t=>t.js)))return!0}else{if(\"redirect\"!==e)return!0;if(this.i.disableUrlRedirectExperiments)return!0;try{const e=new URL(this.K());for(const n of t.variations){if(!n||!n.urlRedirect)continue;const t=new URL(n.urlRedirect);if(this.i.disableCrossOriginUrlRedirectExperiments){if(t.protocol!==e.protocol)return!0;if(t.host!==e.host)return!0}}}catch(e){return this.log(\"Error parsing current or redirect URL\",{id:t.key,error:e}),!0}}return!(!t.changeId||!(this.i.blockedChangeIds||[]).includes(t.changeId))}getRedirectUrl(){return this.S}G(){return this.i.navigate?{navigate:this.i.navigate,delay:0}:qt?{navigate:t=>{window.location.replace(t)},delay:100}:{navigate:null,delay:0}}Z(t){if(!qt)return;const e=[];if(t.css){const n=document.createElement(\"style\");n.innerHTML=t.css,document.head.appendChild(n),e.push((()=>n.remove()))}if(t.js){const n=document.createElement(\"script\");n.innerHTML=t.js,this.i.jsInjectionNonce&&(n.nonce=this.i.jsInjectionNonce),document.head.appendChild(n),e.push((()=>n.remove()))}return t.domMutations&&t.domMutations.forEach((t=>{e.push(function(t){var e=t.selector,n=t.action,i=t.value,s=t.attribute,o=t.parentSelector,u=t.insertBeforeSelector;if(\"html\"===s){if(\"append\"===n)return N(e,(function(t){return t+(null!=i?i:\"\")}));if(\"set\"===n)return N(e,(function(){return null!=i?i:\"\"}))}else if(\"class\"===s){if(\"append\"===n)return D(e,(function(t){i&&t.add(i)}));if(\"remove\"===n)return D(e,(function(t){i&&t.delete(i)}));if(\"set\"===n)return D(e,(function(t){t.clear(),i&&t.add(i)}))}else if(\"position\"===s){if(\"set\"===n&&o)return function(t,e){return T({kind:\"position\",elements:new Set,mutate:function(){return{insertBeforeSelector:u,parentSelector:o}},selector:t})}(e)}else{if(\"append\"===n)return F(e,s,(function(t){return null!==t?t+(null!=i?i:\"\"):null!=i?i:\"\"}));if(\"set\"===n)return F(e,s,(function(){return null!=i?i:\"\"}));if(\"remove\"===n)return F(e,s,(function(){return null}))}return r}(t).revert)})),()=>{e.forEach((t=>t()))}}async refreshStickyBuckets(t){if(this.i.stickyBucketService){const e=this.j(),n=await async function(t,e,n){const r=Kt(t,n);return e.getAllAssignments(r)}(e,this.i.stickyBucketService,t);this.i.stickyBucketAssignmentDocs=n}}generateStickyBucketAssignmentDocsSync(t,e){if(!(\"getAllAssignmentsSync\"in t))return void console.error(\"generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync\");const n=Kt(this.j(),e);return t.getAllAssignmentsSync(n)}inDevMode(){return!!this.i.enableDevMode}}({enableDevMode:!0,...re,remoteEval:!!re.remoteEval,...ie,plugins:le,stickyBucketService:oe});fe.setRenderer((()=>{document.dispatchEvent(new CustomEvent(\"growthbookdata\"))})),fe.init({payload:ie.payload,streaming:!(ie.noStreaming||re.noStreaming||!1===ie.backgroundSync),cacheSettings:ie.cacheSettings}).then((()=>{(ie.antiFlicker||re.antiFlicker)&&(fe.getRedirectUrl()?ue():ce())}));const de=t=>{try{t&&t(fe)}catch(t){console.error(\"Uncaught growthbook_queue error\",t)}};return window.growthbook_queue&&Array.isArray(window.growthbook_queue)&&window.growthbook_queue.forEach((t=>{de(t)})),window.growthbook_queue={push:t=>{de(t)}},fe}();\n//# sourceMappingURL=auto.min.js.map\n";
|
|
5
5
|
//# sourceMappingURL=sdkWrapper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdkWrapper.js","sourceRoot":"","sources":["../../src/generated/sdkWrapper.ts"],"names":[],"mappings":";;;AACa,QAAA,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"sdkWrapper.js","sourceRoot":"","sources":["../../src/generated/sdkWrapper.ts"],"names":[],"mappings":";;;AACa,QAAA,UAAU,GAAG,ulmDAAulmD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@growthbook/edge-utils",
|
|
3
3
|
"description": "Edge worker base app",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.8",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dev": "node scripts/generate-sdk-wrapper.js && tsc --watch"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@growthbook/growthbook": "^1.6.
|
|
22
|
+
"@growthbook/growthbook": "^1.6.4",
|
|
23
23
|
"node-html-parser": "^7.0.1",
|
|
24
24
|
"pako": "^2.1.0"
|
|
25
25
|
},
|
package/src/app.ts
CHANGED
|
@@ -265,7 +265,7 @@ export async function edgeApp<Req, Res>(
|
|
|
265
265
|
|
|
266
266
|
let root: HTMLElement | undefined;
|
|
267
267
|
if (context.config.alwaysParseDOM) {
|
|
268
|
-
root = parse(body);
|
|
268
|
+
root = parse(body, { comment: true });
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
// Body ready hook (pre-DOM-mutations):
|
|
@@ -316,7 +316,9 @@ export function getOriginUrl<Req, Res>(context: Context<Req, Res>, currentURL: s
|
|
|
316
316
|
const currentParsedURL = new URL(currentURL);
|
|
317
317
|
const proxyParsedURL = wasRedirected && ["edge", "everywhere"].includes(context.config.runCrossOriginUrlRedirectExperiments)
|
|
318
318
|
? new URL(currentURL)
|
|
319
|
-
:
|
|
319
|
+
: proxyTarget.startsWith("http://") || proxyTarget.startsWith("https://")
|
|
320
|
+
? new URL(proxyTarget)
|
|
321
|
+
: new URL(proxyTarget, currentURL);
|
|
320
322
|
|
|
321
323
|
const protocol = proxyParsedURL.protocol
|
|
322
324
|
? proxyParsedURL.protocol
|
package/src/attributes.ts
CHANGED
|
@@ -109,7 +109,7 @@ function getUtmAttributes(urlObj: URL) {
|
|
|
109
109
|
let utms: Record<string, string> = {};
|
|
110
110
|
|
|
111
111
|
// Add utm params from querystring
|
|
112
|
-
if (
|
|
112
|
+
if (urlObj.search) {
|
|
113
113
|
const params = new URLSearchParams(urlObj.search);
|
|
114
114
|
["source", "medium", "campaign", "term", "content"].forEach((k) => {
|
|
115
115
|
// Querystring is in snake_case
|
package/src/config.ts
CHANGED
|
@@ -110,7 +110,7 @@ export interface ConfigEnv {
|
|
|
110
110
|
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
112
112
|
export function getConfig(env: ConfigEnv): Config {
|
|
113
|
-
const config = defaultContext.config;
|
|
113
|
+
const config = { ...defaultContext.config };
|
|
114
114
|
|
|
115
115
|
config.proxyTarget = env.PROXY_TARGET ?? defaultContext.config.proxyTarget;
|
|
116
116
|
config.forwardProxyHeaders = ["true", "1"].includes(
|
package/src/domMutations.ts
CHANGED
|
@@ -15,7 +15,7 @@ export async function applyDomMutations({
|
|
|
15
15
|
domChanges: AutoExperimentVariation[];
|
|
16
16
|
}) {
|
|
17
17
|
if (!domChanges.length) return;
|
|
18
|
-
root = root ?? parse(body);
|
|
18
|
+
root = root ?? parse(body, { comment: true });
|
|
19
19
|
if (!root) return;
|
|
20
20
|
|
|
21
21
|
const headEl = root.querySelector("head");
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
|
|
2
|
-
export const sdkWrapper = "var _growthbook=function(){\"use strict\";function t(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}var e=function e(n,r){function i(e,i,s){if(\"undefined\"!=typeof document){\"number\"==typeof(s=t({},r,s)).expires&&(s.expires=new Date(Date.now()+864e5*s.expires)),s.expires&&(s.expires=s.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o=\"\";for(var u in s)s[u]&&(o+=\"; \"+u,!0!==s[u]&&(o+=\"=\"+s[u].split(\";\")[0]));return document.cookie=e+\"=\"+n.write(i,e)+o}}return Object.create({set:i,get:function(t){if(\"undefined\"!=typeof document&&(!arguments.length||t)){for(var e=document.cookie?document.cookie.split(\"; \"):[],r={},i=0;i<e.length;i++){var s=e[i].split(\"=\"),o=s.slice(1).join(\"=\");try{var u=decodeURIComponent(s[0]);if(r[u]=n.read(o,u),t===u)break}catch(t){}}return t?r[t]:r}},remove:function(e,n){i(e,\"\",t({},n,{expires:-1}))},withAttributes:function(n){return e(this.converter,t({},this.attributes,n))},withConverter:function(n){return e(t({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(n)}})}({read:function(t){return\'\"\'===t[0]&&(t=t.slice(1,-1)),t.replace(/(%[\\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:\"/\"}),n=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,r={revert:function(){}},i=new Map,s=new Set;function o(t){var e=i.get(t);return e||i.set(t,e={element:t,attributes:{}}),e}function u(t,e,n,r,i){var s=n(t),o={isDirty:!1,originalValue:s,virtualValue:s,mutations:[],el:t,t:null,observer:new MutationObserver((function(){if(\"position\"!==e||!o.t){\"position\"===e&&(o.t=setTimeout((function(){o.t=null}),1e3));var r=n(t);\"position\"===e&&r.parentNode===o.virtualValue.parentNode&&r.insertBeforeNode===o.virtualValue.insertBeforeNode||r!==o.virtualValue&&(o.originalValue=r,i(o))}})),mutationRunner:i,setValue:r,getCurrentValue:n};return\"position\"===e&&t.parentNode?o.observer.observe(t.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):o.observer.observe(t,function(t){return\"html\"===t?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[t]}}(e)),o}function c(t,e){var n=e.getCurrentValue(e.el);e.virtualValue=t,t&&\"string\"!=typeof t?n&&t.parentNode===n.parentNode&&t.insertBeforeNode===n.insertBeforeNode||(e.isDirty=!0,C()):t!==n&&(e.isDirty=!0,C())}function a(t){var e=t.originalValue;t.mutations.forEach((function(t){return e=t.mutate(e)})),c(function(t){return v||(v=document.createElement(\"div\")),v.innerHTML=t,v.innerHTML}(e),t)}function l(t){var e=new Set(t.originalValue.split(/\\s+/).filter(Boolean));t.mutations.forEach((function(t){return t.mutate(e)})),c(Array.from(e).filter(Boolean).join(\" \"),t)}function h(t){var e=t.originalValue;t.mutations.forEach((function(t){return e=t.mutate(e)})),c(e,t)}function f(t){var e=t.originalValue;t.mutations.forEach((function(t){var n=function(t){var e=t.insertBeforeSelector,n=document.querySelector(t.parentSelector);if(!n)return null;var r=e?document.querySelector(e):null;return e&&!r?null:{parentNode:n,insertBeforeNode:r}}(t.mutate());e=n||e})),c(e,t)}var d=function(t){return t.innerHTML},w=function(t,e){return t.innerHTML=e};function p(t){var e=o(t);return e.html||(e.html=u(t,\"html\",d,w,a)),e.html}var y=function(t){return{parentNode:t.parentElement,insertBeforeNode:t.nextElementSibling}},g=function(t,e){e.insertBeforeNode&&!e.parentNode.contains(e.insertBeforeNode)||e.parentNode.insertBefore(t,e.insertBeforeNode)};function m(t){var e=o(t);return e.position||(e.position=u(t,\"position\",y,g,f)),e.position}var v,b,k=function(t,e){return e?t.className=e:t.removeAttribute(\"class\")},S=function(t){return t.className};function A(t){var e=o(t);return e.classes||(e.classes=u(t,\"class\",S,k,l)),e.classes}function _(t,e){var n,r=o(t);return r.attributes[e]||(r.attributes[e]=u(t,e,(n=e,function(t){var e;return null!=(e=t.getAttribute(n))?e:null}),function(t){return function(e,n){return null!==n?e.setAttribute(t,n):e.removeAttribute(t)}}(e),h)),r.attributes[e]}function x(t,e,n){if(n.isDirty){n.isDirty=!1;var r=n.virtualValue;n.mutations.length||function(t,e){var n,r,s=i.get(t);if(s)if(\"html\"===e)null==(n=s.html)||null==(r=n.observer)||r.disconnect(),delete s.html;else if(\"class\"===e){var o,u;null==(o=s.classes)||null==(u=o.observer)||u.disconnect(),delete s.classes}else if(\"position\"===e){var c,a;null==(c=s.position)||null==(a=c.observer)||a.disconnect(),delete s.position}else{var l,h,f;null==(l=s.attributes)||null==(h=l[e])||null==(f=h.observer)||f.disconnect(),delete s.attributes[e]}}(t,e),n.setValue(t,r)}}function $(t,e){t.html&&x(e,\"html\",t.html),t.classes&&x(e,\"class\",t.classes),t.position&&x(e,\"position\",t.position),Object.keys(t.attributes).forEach((function(n){x(e,n,t.attributes[n])}))}function C(){i.forEach($)}function E(t){if(\"position\"!==t.kind||1!==t.elements.size){var e=new Set(t.elements);document.querySelectorAll(t.selector).forEach((function(n){e.has(n)||(t.elements.add(n),function(t,e){var n=null;\"html\"===t.kind?n=p(e):\"class\"===t.kind?n=A(e):\"attribute\"===t.kind?n=_(e,t.attribute):\"position\"===t.kind&&(n=m(e)),n&&(n.mutations.push(t),n.mutationRunner(n))}(t,n))}))}}function O(){s.forEach(E)}function T(t){return\"undefined\"==typeof document?r:(s.add(t),E(t),{revert:function(){var e;(e=t).elements.forEach((function(t){return function(t,e){var n=null;if(\"html\"===t.kind?n=p(e):\"class\"===t.kind?n=A(e):\"attribute\"===t.kind?n=_(e,t.attribute):\"position\"===t.kind&&(n=m(e)),n){var r=n.mutations.indexOf(t);-1!==r&&n.mutations.splice(r,1),n.mutationRunner(n)}}(e,t)})),e.elements.clear(),s.delete(e)}})}function N(t,e){return T({kind:\"html\",elements:new Set,mutate:e,selector:t})}function D(t,e){return T({kind:\"class\",elements:new Set,mutate:e,selector:t})}function F(t,e,i){return n.test(e)?\"class\"===e||\"className\"===e?D(t,(function(t){var e=i(Array.from(t).join(\" \"));t.clear(),e&&e.split(/\\s+/g).filter(Boolean).forEach((function(e){return t.add(e)}))})):T({kind:\"attribute\",attribute:e,elements:new Set,mutate:i,selector:t}):r}\"undefined\"!=typeof document&&(b||(b=new MutationObserver((function(){O()}))),O(),b.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}));const M={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function R(t){let e=2166136261;const n=t.length;for(let r=0;r<n;r++)e^=t.charCodeAt(r),e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24);return e>>>0}function B(t,e,n){return 2===n?R(R(t+e)+\"\")%1e4/1e4:1===n?R(e+t)%1e3/1e3:null}function I(t,e){return t>=e[0]&&t<e[1]}function U(t){try{const e=t.replace(/([^\\\\])\\//g,\"$1\\\\/\");return new RegExp(e)}catch(t){return void console.error(t)}}function V(t,e){if(!e.length)return!1;let n=!1,r=!1;for(let i=0;i<e.length;i++){const s=j(t,e[i].type,e[i].pattern);if(!1===e[i].include){if(s)return!1}else n=!0,s&&(r=!0)}return r||!n}function j(t,e,n){try{const r=new URL(t,\"https://_\");if(\"regex\"===e){const t=U(n);return!!t&&(t.test(r.href)||t.test(r.href.substring(r.origin.length)))}return\"simple\"===e&&function(t,e){try{const n=new URL(e.replace(/^([^:/?]*)\\./i,\"https://$1.\").replace(/\\*/g,\"_____\"),\"https://_____\"),r=[[t.host,n.host,!1],[t.pathname,n.pathname,!0]];return n.hash&&r.push([t.hash,n.hash,!1]),n.searchParams.forEach(((e,n)=>{r.push([t.searchParams.get(n)||\"\",e,!1])})),!r.some((t=>!function(t,e,n){try{let r=e.replace(/[*.+?^${}()|[\\]\\\\]/g,\"\\\\$&\").replace(/_____/g,\".*\");return n&&(r=\"\\\\/?\"+r.replace(/(^\\/|\\/$)/g,\"\")+\"\\\\/?\"),new RegExp(\"^\"+r+\"$\",\"i\").test(t)}catch(t){return!1}}(t[0],t[1],t[2])))}catch(t){return!1}}(r,n)}catch(t){return!1}}const J=t=>Uint8Array.from(atob(t),(t=>t.charCodeAt(0)));async function P(t,e,n){if(e=e||\"\",!(n=n||globalThis.crypto&&globalThis.crypto.subtle||M.SubtleCrypto))throw new Error(\"No SubtleCrypto implementation found\");try{const r=await n.importKey(\"raw\",J(e),{name:\"AES-CBC\",length:128},!0,[\"encrypt\",\"decrypt\"]),[i,s]=t.split(\".\"),o=await n.decrypt({name:\"AES-CBC\",iv:J(i)},r,J(s));return(new TextDecoder).decode(o)}catch(t){throw new Error(\"Failed to decrypt\")}}function L(t){return\"string\"==typeof t?t:JSON.stringify(t)}function K(t){\"number\"==typeof t&&(t+=\"\"),t&&\"string\"==typeof t||(t=\"0\");const e=t.replace(/(^v|\\+.*$)/g,\"\").split(/[-.]/);return 3===e.length&&e.push(\"~\"),e.map((t=>t.match(/^[0-9]+$/)?t.padStart(5,\" \"):t)).join(\"-\")}function H(){let t;try{t=\"1.6.1\"}catch(e){t=\"\"}return t}function q(t){return\"object\"==typeof t&&null!==t}function G(t){return t.urlPatterns&&t.variations.some((t=>q(t)&&\"urlRedirect\"in t))?\"redirect\":t.variations.some((t=>q(t)&&(t.domMutations||\"js\"in t||\"css\"in t)))?\"visual\":\"unknown\"}async function z(t,e){return new Promise((n=>{let r,i=!1;const s=t=>{i||(i=!0,r&&clearTimeout(r),n(t||null))};e&&(r=setTimeout((()=>s()),e)),t.then((t=>s(t))).catch((()=>s()))}))}const Z={staleTTL:6e4,maxAge:144e5,cacheKey:\"gbFeaturesCache\",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},Q=M,W={fetchFeaturesCall:t=>{let{host:e,clientKey:n,headers:r}=t;return Q.fetch(`${e}/api/features/${n}`,{headers:r})},fetchRemoteEvalCall:t=>{let{host:e,clientKey:n,payload:r,headers:i}=t;const s={method:\"POST\",headers:{\"Content-Type\":\"application/json\",...i},body:JSON.stringify(r)};return Q.fetch(`${e}/api/eval/${n}`,s)},eventSourceCall:t=>{let{host:e,clientKey:n,headers:r}=t;return r?new Q.EventSource(`${e}/sub/${n}`,{headers:r}):new Q.EventSource(`${e}/sub/${n}`)},startIdleListener:()=>{let t;if(\"undefined\"==typeof window||\"undefined\"==typeof document)return;const e=()=>{\"visible\"===document.visibilityState?(window.clearTimeout(t),nt.forEach((t=>{t&&\"idle\"===t.state&&wt(t)}))):\"hidden\"===document.visibilityState&&(t=window.setTimeout(it,Z.idleStreamInterval))};return document.addEventListener(\"visibilitychange\",e),()=>document.removeEventListener(\"visibilitychange\",e)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(Q.localStorage=globalThis.localStorage)}catch(t){}const X=new Map;let Y=!1;const tt=new Map,et=new Map,nt=new Map,rt=new Set;function it(){nt.forEach((t=>{t&&(t.state=\"idle\",dt(t))}))}async function st(){try{if(!Q.localStorage)return;await Q.localStorage.setItem(Z.cacheKey,JSON.stringify(Array.from(tt.entries())))}catch(t){}}function ot(t){const[e,n]=t.getApiInfo();return`${e}||${n}`}function ut(t){const e=ot(t);if(!(\"isRemoteEval\"in t)||!t.isRemoteEval())return e;const n=t.getAttributes(),r=t.getCacheKeyAttributes()||Object.keys(t.getAttributes()),i={};r.forEach((t=>{i[t]=n[t]}));const s=t.getForcedVariations(),o=t.getUrl();return`${e}||${JSON.stringify({ca:i,fv:s,url:o})}`}function ct(){const t=Array.from(tt.entries()).map((t=>{let[e,n]=t;return{key:e,staleAt:n.staleAt.getTime()}})).sort(((t,e)=>t.staleAt-e.staleAt)),e=Math.min(Math.max(0,tt.size-Z.maxEntries),tt.size);for(let n=0;n<e;n++)tt.delete(t[n].key)}function at(t,e,n){const r=n.dateUpdated||\"\",i=new Date(Date.now()+Z.staleTTL),s=Z.disableCache?void 0:tt.get(e);if(s&&r&&s.version===r)return s.staleAt=i,void st();Z.disableCache||(tt.set(e,{data:n,version:r,staleAt:i,sse:rt.has(t)}),ct()),st();const o=X.get(t);o&&o.forEach((t=>async function(t,e){await t.setPayload(e||t.getPayload())}(t,n)))}async function lt(t){const{apiHost:e,apiRequestHeaders:n}=t.getApiHosts(),r=t.getClientKey(),i=\"isRemoteEval\"in t&&t.isRemoteEval(),s=ot(t),o=ut(t);let u=et.get(o);return u||(u=(i?W.fetchRemoteEvalCall({host:e,clientKey:r,payload:{attributes:t.getAttributes(),forcedVariations:t.getForcedVariations(),forcedFeatures:Array.from(t.getForcedFeatures().entries()),url:t.getUrl()},headers:n}):W.fetchFeaturesCall({host:e,clientKey:r,headers:n})).then((t=>{if(!t.ok)throw new Error(`HTTP error: ${t.status}`);return\"enabled\"===t.headers.get(\"x-sse-support\")&&rt.add(s),t.json()})).then((e=>(at(s,o,e),ht(t),et.delete(o),{data:e,success:!0,source:\"network\"}))).catch((t=>(et.delete(o),{data:null,source:\"error\",success:!1,error:t}))),et.set(o,u)),u}function ht(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const n=ot(t),r=ut(t),{streamingHost:i,streamingHostRequestHeaders:s}=t.getApiHosts(),o=t.getClientKey();if(e&&rt.add(n),Z.backgroundSync&&rt.has(n)&&Q.EventSource){if(nt.has(n))return;const t={src:null,host:i,clientKey:o,headers:s,cb:e=>{try{if(\"features-updated\"===e.type){const t=X.get(n);t&&t.forEach((t=>{lt(t)}))}else if(\"features\"===e.type){const t=JSON.parse(e.data);at(n,r,t)}t.errors=0}catch(e){ft(t)}},errors:0,state:\"active\"};nt.set(n,t),wt(t)}}function ft(t){if(\"idle\"!==t.state&&(t.errors++,t.errors>3||t.src&&2===t.src.readyState)){const e=Math.pow(3,t.errors-3)*(1e3+1e3*Math.random());dt(t),setTimeout((()=>{[\"idle\",\"active\"].includes(t.state)||wt(t)}),Math.min(e,3e5))}}function dt(t){t.src&&(t.src.onopen=null,t.src.onerror=null,t.src.close(),t.src=null,\"active\"===t.state&&(t.state=\"disabled\"))}function wt(t){t.src=W.eventSourceCall({host:t.host,clientKey:t.clientKey,headers:t.headers}),t.state=\"active\",t.src.addEventListener(\"features\",t.cb),t.src.addEventListener(\"features-updated\",t.cb),t.src.onerror=()=>ft(t),t.src.onopen=()=>{t.errors=0}}function pt(t,e){dt(t),nt.delete(e)}function yt(t,e){if(e.streaming){if(!t.getClientKey())throw new Error(\"Must specify clientKey to enable streaming\");e.payload&&ht(t,!0),function(t){const e=ot(t),n=X.get(e)||new Set;n.add(t),X.set(e,n)}(t)}}const gt={};function mt(t,e,n){n=n||{};for(const[r,i]of Object.entries(e))switch(r){case\"$or\":if(!_t(t,i,n))return!1;break;case\"$nor\":if(_t(t,i,n))return!1;break;case\"$and\":if(!xt(t,i,n))return!1;break;case\"$not\":if(mt(t,i,n))return!1;break;default:if(!bt(i,vt(t,r),n))return!1}return!0}function vt(t,e){const n=e.split(\".\");let r=t;for(let t=0;t<n.length;t++){if(!r||\"object\"!=typeof r||!(n[t]in r))return null;r=r[n[t]]}return r}function bt(t,e,n){if(\"string\"==typeof t)return e+\"\"===t;if(\"number\"==typeof t)return 1*e===t;if(\"boolean\"==typeof t)return null!==e&&!!e===t;if(null===t)return null===e;if(Array.isArray(t)||!kt(t))return JSON.stringify(e)===JSON.stringify(t);for(const r in t)if(!At(r,e,t[r],n))return!1;return!0}function kt(t){const e=Object.keys(t);return e.length>0&&e.filter((t=>\"$\"===t[0])).length===e.length}function St(t,e){return Array.isArray(t)?t.some((t=>e.includes(t))):e.includes(t)}function At(t,e,n,r){switch(t){case\"$veq\":return K(e)===K(n);case\"$vne\":return K(e)!==K(n);case\"$vgt\":return K(e)>K(n);case\"$vgte\":return K(e)>=K(n);case\"$vlt\":return K(e)<K(n);case\"$vlte\":return K(e)<=K(n);case\"$eq\":return e===n;case\"$ne\":return e!==n;case\"$lt\":return e<n;case\"$lte\":return e<=n;case\"$gt\":return e>n;case\"$gte\":return e>=n;case\"$exists\":return n?null!=e:null==e;case\"$in\":return!!Array.isArray(n)&&St(e,n);case\"$inGroup\":return St(e,r[n]||[]);case\"$notInGroup\":return!St(e,r[n]||[]);case\"$nin\":return!!Array.isArray(n)&&!St(e,n);case\"$not\":return!bt(n,e,r);case\"$size\":return!!Array.isArray(e)&&bt(n,e.length,r);case\"$elemMatch\":return function(t,e,n){if(!Array.isArray(t))return!1;const r=kt(e)?t=>bt(e,t,n):t=>mt(t,e,n);for(let e=0;e<t.length;e++)if(t[e]&&r(t[e]))return!0;return!1}(e,n,r);case\"$all\":if(!Array.isArray(e))return!1;for(let t=0;t<n.length;t++){let i=!1;for(let s=0;s<e.length;s++)if(bt(n[t],e[s],r)){i=!0;break}if(!i)return!1}return!0;case\"$regex\":try{return(i=n,gt[i]||(gt[i]=new RegExp(i.replace(/([^\\\\])\\//g,\"$1\\\\/\"))),gt[i]).test(e)}catch(t){return!1}case\"$type\":return function(t){if(null===t)return\"null\";if(Array.isArray(t))return\"array\";const e=typeof t;return[\"string\",\"number\",\"boolean\",\"object\",\"undefined\"].includes(e)?e:\"unknown\"}(e)===n;default:return console.error(\"Unknown operator: \"+t),!1}var i}function _t(t,e,n){if(!e.length)return!0;for(let r=0;r<e.length;r++)if(mt(t,e[r],n))return!0;return!1}function xt(t,e,n){for(let r=0;r<e.length;r++)if(!mt(t,e[r],n))return!1;return!0}const $t=\"Feature Evaluated\",Ct=\"Experiment Viewed\";async function Et(t){try{await t()}catch(t){}}function Ot(t,e,n){if(t.user.trackedExperiments){const r=Pt(e,n);if(t.user.trackedExperiments.has(r))return[];t.user.trackedExperiments.add(r)}t.user.enableDevMode&&t.user.devLogs&&t.user.devLogs.push({experiment:e,result:n,timestamp:Date.now().toString(),logType:\"experiment\"});const r=[];if(t.global.trackingCallback){const i=t.global.trackingCallback;r.push(Et((()=>i(e,n,t.user))))}if(t.user.trackingCallback){const i=t.user.trackingCallback;r.push(Et((()=>i(e,n))))}if(t.global.eventLogger){const i=t.global.eventLogger;r.push(Et((()=>i(Ct,{experimentId:e.key,variationId:n.key,hashAttribute:n.hashAttribute,hashValue:n.hashValue},t.user))))}return r}function Tt(t,e){if(e.stack.evaluatedFeatures.has(t))return Dt(e,t,null,\"cyclicPrerequisite\");e.stack.evaluatedFeatures.add(t),e.stack.id=t;const n=function(t){const e=new Map;return t.global.forcedFeatureValues&&t.global.forcedFeatureValues.forEach(((t,n)=>e.set(n,t))),t.user.forcedFeatureValues&&t.user.forcedFeatureValues.forEach(((t,n)=>e.set(n,t))),e}(e);if(n.has(t))return Dt(e,t,n.get(t),\"override\");if(!e.global.features||!e.global.features[t])return Dt(e,t,null,\"unknownFeature\");const r=e.global.features[t];if(r.rules){const n=new Set(e.stack.evaluatedFeatures);t:for(const i of r.rules){if(i.parentConditions)for(const r of i.parentConditions){e.stack.evaluatedFeatures=new Set(n);const i=Tt(r.id,e);if(\"cyclicPrerequisite\"===i.source)return Dt(e,t,null,\"cyclicPrerequisite\");if(!mt({value:i.value},r.condition||{})){if(r.gate)return Dt(e,t,null,\"prerequisite\");continue t}}if(i.filters&&Rt(i.filters,e))continue;if(\"force\"in i){if(i.condition&&!Mt(i.condition,e))continue;if(!Bt(e,i.seed||t,i.hashAttribute,e.user.saveStickyBucketAssignmentDoc&&!i.disableStickyBucketing?i.fallbackAttribute:void 0,i.range,i.coverage,i.hashVersion))continue;return i.tracks&&i.tracks.forEach((t=>{!Ot(e,t.experiment,t.result).length&&e.global.saveDeferredTrack&&e.global.saveDeferredTrack({experiment:t.experiment,result:t.result})})),Dt(e,t,i.force,\"force\",i.id)}if(!i.variations)continue;const r={variations:i.variations,key:i.key||t};\"coverage\"in i&&(r.coverage=i.coverage),i.weights&&(r.weights=i.weights),i.hashAttribute&&(r.hashAttribute=i.hashAttribute),i.fallbackAttribute&&(r.fallbackAttribute=i.fallbackAttribute),i.disableStickyBucketing&&(r.disableStickyBucketing=i.disableStickyBucketing),void 0!==i.bucketVersion&&(r.bucketVersion=i.bucketVersion),void 0!==i.minBucketVersion&&(r.minBucketVersion=i.minBucketVersion),i.namespace&&(r.namespace=i.namespace),i.meta&&(r.meta=i.meta),i.ranges&&(r.ranges=i.ranges),i.name&&(r.name=i.name),i.phase&&(r.phase=i.phase),i.seed&&(r.seed=i.seed),i.hashVersion&&(r.hashVersion=i.hashVersion),i.filters&&(r.filters=i.filters),i.condition&&(r.condition=i.condition);const{result:s}=Nt(r,t,e);if(e.global.onExperimentEval&&e.global.onExperimentEval(r,s),s.inExperiment&&!s.passthrough)return Dt(e,t,s.value,\"experiment\",i.id,r,s)}}return Dt(e,t,void 0===r.defaultValue?null:r.defaultValue,\"defaultValue\")}function Nt(t,e,n){const r=t.key,i=t.variations.length;if(i<2)return{result:It(n,t,-1,!1,e)};if(!1===n.global.enabled||!1===n.user.enabled)return{result:It(n,t,-1,!1,e)};if(t=function(t,e){const n=t.key,r=e.global.overrides;return r&&r[n]&&\"string\"==typeof(t=Object.assign({},t,r[n])).url&&(t.url=U(t.url)),t}(t,n),t.urlPatterns&&!V(n.user.url||\"\",t.urlPatterns))return{result:It(n,t,-1,!1,e)};const s=function(t,e,n){if(!e)return null;const r=e.split(\"?\")[1];if(!r)return null;const i=r.replace(/#.*/,\"\").split(\"&\").map((t=>t.split(\"=\",2))).filter((e=>{let[n]=e;return n===t})).map((t=>{let[,e]=t;return parseInt(e)}));return i.length>0&&i[0]>=0&&i[0]<n?i[0]:null}(r,n.user.url||\"\",i);if(null!==s)return{result:It(n,t,s,!1,e)};const o=function(t){return t.global.forcedVariations&&t.user.forcedVariations?{...t.global.forcedVariations,...t.user.forcedVariations}:t.global.forcedVariations?t.global.forcedVariations:t.user.forcedVariations?t.user.forcedVariations:{}}(n);if(r in o)return{result:It(n,t,o[r],!1,e)};if(\"draft\"===t.status||!1===t.active)return{result:It(n,t,-1,!1,e)};const{hashAttribute:u,hashValue:c}=Ut(n,t.hashAttribute,n.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing?t.fallbackAttribute:void 0);if(!c)return{result:It(n,t,-1,!1,e)};let a=-1,l=!1,h=!1;if(n.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing){const{variation:e,versionIsBlocked:r}=function(t){let{ctx:e,expKey:n,expBucketVersion:r,expHashAttribute:i,expFallbackAttribute:s,expMinBucketVersion:o,expMeta:u}=t;r=r||0,o=o||0,i=i||\"id\",u=u||[];const c=Vt(n,r),a=function(t,e,n){if(!t.user.stickyBucketAssignmentDocs)return{};const{hashAttribute:r,hashValue:i}=Ut(t,e),s=jt(r,L(i)),{hashAttribute:o,hashValue:u}=Ut(t,n),c=u?jt(o,L(u)):null,a={};return c&&t.user.stickyBucketAssignmentDocs[c]&&Object.assign(a,t.user.stickyBucketAssignmentDocs[c].assignments||{}),t.user.stickyBucketAssignmentDocs[s]&&Object.assign(a,t.user.stickyBucketAssignmentDocs[s].assignments||{}),a}(e,i,s);if(o>0)for(let t=0;t<=o;t++)if(void 0!==a[Vt(n,t)])return{variation:-1,versionIsBlocked:!0};const l=a[c];if(void 0===l)return{variation:-1};const h=u.findIndex((t=>t.key===l));return h<0?{variation:-1}:{variation:h}}({ctx:n,expKey:t.key,expBucketVersion:t.bucketVersion,expHashAttribute:t.hashAttribute,expFallbackAttribute:t.fallbackAttribute,expMinBucketVersion:t.minBucketVersion,expMeta:t.meta});l=e>=0,a=e,h=!!r}if(!l){if(t.filters){if(Rt(t.filters,n))return{result:It(n,t,-1,!1,e)}}else if(t.namespace&&!function(t,e){const n=B(\"__\"+e[0],t,1);return null!==n&&n>=e[1]&&n<e[2]}(c,t.namespace))return{result:It(n,t,-1,!1,e)};if(t.include&&!function(t){try{return t()}catch(t){return console.error(t),!1}}(t.include))return{result:It(n,t,-1,!1,e)};if(t.condition&&!Mt(t.condition,n))return{result:It(n,t,-1,!1,e)};if(t.parentConditions){const r=new Set(n.stack.evaluatedFeatures);for(const i of t.parentConditions){n.stack.evaluatedFeatures=new Set(r);const s=Tt(i.id,n);if(\"cyclicPrerequisite\"===s.source)return{result:It(n,t,-1,!1,e)};if(!mt({value:s.value},i.condition||{}))return{result:It(n,t,-1,!1,e)}}}if(t.groups&&!function(t,e){const n=e.global.groups||{};for(let e=0;e<t.length;e++)if(n[t[e]])return!0;return!1}(t.groups,n))return{result:It(n,t,-1,!1,e)}}if(t.url&&!function(t,e){const n=e.user.url;if(!n)return!1;const r=n.replace(/^https?:\\/\\//,\"\").replace(/^[^/]*\\//,\"/\");return!!t.test(n)||!!t.test(r)}(t.url,n))return{result:It(n,t,-1,!1,e)};const f=B(t.seed||r,c,t.hashVersion||1);if(null===f)return{result:It(n,t,-1,!1,e)};if(l||(a=function(t,e){for(let n=0;n<e.length;n++)if(I(t,e[n]))return n;return-1}(f,t.ranges||function(t,e,n){(e=void 0===e?1:e)<0?e=0:e>1&&(e=1);const r=(i=t)<=0?[]:new Array(i).fill(1/i);var i;(n=n||r).length!==t&&(n=r);const s=n.reduce(((t,e)=>e+t),0);(s<.99||s>1.01)&&(n=r);let o=0;return n.map((t=>{const n=o;return o+=t,[n,n+e*t]}))}(i,void 0===t.coverage?1:t.coverage,t.weights))),h)return{result:It(n,t,-1,!1,e,void 0,!0)};if(a<0)return{result:It(n,t,-1,!1,e)};if(\"force\"in t)return{result:It(n,t,void 0===t.force?-1:t.force,!1,e)};if(n.global.qaMode||n.user.qaMode)return{result:It(n,t,-1,!1,e)};if(\"stopped\"===t.status)return{result:It(n,t,-1,!1,e)};const d=It(n,t,a,!0,e,f,l);if(n.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing){const{changed:e,key:r,doc:i}=function(t,e,n,r){const i=jt(e,n),s=t.user.stickyBucketAssignmentDocs&&t.user.stickyBucketAssignmentDocs[i]&&t.user.stickyBucketAssignmentDocs[i].assignments||{},o={...s,...r};return{key:i,doc:{attributeName:e,attributeValue:n,assignments:o},changed:JSON.stringify(s)!==JSON.stringify(o)}}(n,u,L(c),{[Vt(t.key,t.bucketVersion)]:d.key});e&&(n.user.stickyBucketAssignmentDocs=n.user.stickyBucketAssignmentDocs||{},n.user.stickyBucketAssignmentDocs[r]=i,n.user.saveStickyBucketAssignmentDoc(i))}const w=Ot(n,t,d);0===w.length&&n.global.saveDeferredTrack&&n.global.saveDeferredTrack({experiment:t,result:d});const p=w.length?1===w.length?w[0]:Promise.all(w).then((()=>{})):void 0;return\"changeId\"in t&&t.changeId&&n.global.recordChangeId&&n.global.recordChangeId(t.changeId),{result:d,trackingCall:p}}function Dt(t,e,n,r,i,s,o){const u={value:n,on:!!n,off:!n,source:r,ruleId:i||\"\"};return s&&(u.experiment=s),o&&(u.experimentResult=o),\"override\"!==r&&function(t,e,n){if(t.user.trackedFeatureUsage){const r=JSON.stringify(n.value);if(t.user.trackedFeatureUsage[e]===r)return;t.user.trackedFeatureUsage[e]=r,t.user.enableDevMode&&t.user.devLogs&&t.user.devLogs.push({featureKey:e,result:n,timestamp:Date.now().toString(),logType:\"feature\"})}if(t.global.onFeatureUsage){const r=t.global.onFeatureUsage;Et((()=>r(e,n,t.user)))}if(t.user.onFeatureUsage){const r=t.user.onFeatureUsage;Et((()=>r(e,n)))}if(t.global.eventLogger){const r=t.global.eventLogger;Et((()=>r($t,{feature:e,source:n.source,value:n.value,ruleId:\"defaultValue\"===n.source?\"$default\":n.ruleId||\"\",variationId:n.experimentResult?n.experimentResult.key:\"\"},t.user)))}}(t,e,u),u}function Ft(t){return{...t.user.attributes,...t.user.attributeOverrides}}function Mt(t,e){return mt(Ft(e),t,e.global.savedGroups||{})}function Rt(t,e){return t.some((t=>{const{hashValue:n}=Ut(e,t.attribute);if(!n)return!0;const r=B(t.seed,n,t.hashVersion||2);return null===r||!t.ranges.some((t=>I(r,t)))}))}function Bt(t,e,n,r,i,s,o){if(!i&&void 0===s)return!0;if(!i&&0===s)return!1;const{hashValue:u}=Ut(t,n,r);if(!u)return!1;const c=B(e,u,o||1);return null!==c&&(i?I(c,i):void 0===s||c<=s)}function It(t,e,n,r,i,s,o){let u=!0;(n<0||n>=e.variations.length)&&(n=0,u=!1);const{hashAttribute:c,hashValue:a}=Ut(t,e.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0),l=e.meta?e.meta[n]:{},h={key:l.key||\"\"+n,featureId:i,inExperiment:u,hashUsed:r,variationId:n,value:e.variations[n],hashAttribute:c,hashValue:a,stickyBucketUsed:!!o};return l.name&&(h.name=l.name),void 0!==s&&(h.bucket=s),l.passthrough&&(h.passthrough=l.passthrough),h}function Ut(t,e,n){let r=e||\"id\",i=\"\";const s=Ft(t);return s[r]&&(i=s[r]),!i&&n&&(s[n]&&(i=s[n]),i&&(r=n)),{hashAttribute:r,hashValue:i}}function Vt(t,e){return`${t}__${e=e||0}`}function jt(t,e){return`${t}||${e}`}function Jt(t,e){const n={},r=function(t,e){const n=new Set,r=e&&e.features?e.features:t.global.features||{},i=e&&e.experiments?e.experiments:t.global.experiments||[];return Object.keys(r).forEach((t=>{const e=r[t];if(e.rules)for(const t of e.rules)t.variations&&(n.add(t.hashAttribute||\"id\"),t.fallbackAttribute&&n.add(t.fallbackAttribute))})),i.map((t=>{n.add(t.hashAttribute||\"id\"),t.fallbackAttribute&&n.add(t.fallbackAttribute)})),Array.from(n)}(t,e);return r.forEach((e=>{const{hashValue:r}=Ut(t,e);n[e]=L(r)})),n}function Pt(t,e){return e.hashAttribute+e.hashValue+t.key+e.variationId}const Lt=\"undefined\"!=typeof window&&\"undefined\"!=typeof document,Kt=H();class Ht{constructor(t){this.prefix=(t=t||{}).prefix||\"\"}async getAllAssignments(t){const e={};return(await Promise.all(Object.entries(t).map((t=>{let[e,n]=t;return this.getAssignments(e,n)})))).forEach((t=>{if(t){const n=jt(t.attributeName,t.attributeValue);e[n]=t}})),e}getKey(t,e){return`${this.prefix}${t}||${e}`}}class qt extends Ht{async getAssignments(t,e){return this.getAssignmentsSync(t,e)}async saveAssignments(t){this.saveAssignmentsSync(t)}getAllAssignmentsSync(t){const e={};return Object.entries(t).map((t=>{let[e,n]=t;return this.getAssignmentsSync(e,n)})).forEach((t=>{if(t){const n=jt(t.attributeName,t.attributeValue);e[n]=t}})),e}}function Gt(t){return{browser:t.match(/Edg/)?\"edge\":t.match(/Chrome/)?\"chrome\":t.match(/Firefox/)?\"firefox\":t.match(/Safari/)?\"safari\":\"unknown\",deviceType:t.match(/Mobi/)?\"mobile\":\"desktop\"}}function zt(t){return t?{url:t.href,path:t.pathname,host:t.host,query:t.search}:{}}function Zt(t,e){const n=new Date;n.setTime(n.getTime()+3456e7),document.cookie=t+\"=\"+e+\";path=/;expires=\"+n.toUTCString()}function Qt(t){const e=(\"; \"+document.cookie).split(`; ${t}=`);return 2===e.length?e[1].split(\";\")[0]:\"\"}function Wt(t){return t&&t.randomUUID?t.randomUUID():\"10000000-1000-4000-8000-100000000000\".replace(/[018]/g,(e=>(e^(t&&t.getRandomValues?t.getRandomValues(new Uint8Array(1))[0]:Math.floor(256*Math.random()))&15>>e/4).toString(16)))}function Xt(t){let e={};try{const t=sessionStorage.getItem(\"utm_params\");t&&(e=JSON.parse(t))}catch(t){}if(t&&t.search){const n=new URLSearchParams(t.search);let r=!1;if([\"source\",\"medium\",\"campaign\",\"term\",\"content\"].forEach((t=>{const i=`utm_${t}`,s=\"utm\"+t[0].toUpperCase()+t.slice(1);n.has(i)&&(e[s]=n.get(i)||\"\",r=!0)})),r)try{sessionStorage.setItem(\"utm_params\",JSON.stringify(e))}catch(t){}}return e}function Yt(){if(\"undefined\"==typeof window||!window.dataLayer||!window.dataLayer.forEach)return{};const t={};return window.dataLayer.forEach((e=>{e&&\"object\"==typeof e&&!(\"length\"in e)&&(\"event\"in e||Object.keys(e).forEach((n=>{if(\"string\"!=typeof n||n.match(/^(gtm)/))return;const r=e[n];[\"string\",\"number\",\"boolean\"].includes(typeof r)&&(t[n]=r)})))})),t}const te=H();function ee(t){return\"string\"==typeof t?t:null}function ne(t){let{eventName:e,properties:n,attributes:r,url:i}=t;const{nested:s,topLevel:o}=function(t){const{user_id:e,device_id:n,anonymous_id:r,id:i,page_id:s,session_id:o,utmCampaign:u,utmContent:c,utmMedium:a,utmSource:l,utmTerm:h,pageTitle:f,...d}=t;return{nested:d,topLevel:{user_id:ee(e),device_id:ee(n||r||i),page_id:ee(s),session_id:ee(o),utm_campaign:ee(u)||void 0,utm_content:ee(c)||void 0,utm_medium:ee(a)||void 0,utm_source:ee(l)||void 0,utm_term:ee(h)||void 0,page_title:ee(f)||void 0}}}(r||{});return{event_name:e,properties_json:n||{},...o,sdk_language:\"js\",sdk_version:te,url:i,context_json:s}}async function re(t){let{clientKey:e,ingestorHost:n,events:r}=t;if(!r.length)return;const i=`${n||\"https://us1.gb-ingest.com\"}/track?client_key=${e}`,s=JSON.stringify(r);try{await fetch(i,{method:\"POST\",body:s,headers:{Accept:\"application/json\",\"Content-Type\":\"text/plain\"},credentials:\"omit\"})}catch(t){console.error(\"Failed to track event\",t)}}window.dataLayer=window.dataLayer||[];const ie=document.currentScript,se=ie?ie.dataset:{},oe=window.growthbook_config||{};let ue,ce;function ae(){window.clearTimeout(ue);let t=oe.antiFlickerTimeout??(se.antiFlickerTimeout?parseInt(se.antiFlickerTimeout):null)??3500;isFinite(t)||(t=3500);try{if(!document.getElementById(\"gb-anti-flicker-style\")){const t=document.createElement(\"style\");t.setAttribute(\"id\",\"gb-anti-flicker-style\"),t.innerHTML=\".gb-anti-flicker { opacity: 0 !important; pointer-events: none; }\",document.head.appendChild(t)}document.documentElement.classList.add(\"gb-anti-flicker\"),ue=window.setTimeout(le,t)}catch(t){console.error(t)}}function le(){window.clearTimeout(ue);try{document.documentElement.classList.remove(\"gb-anti-flicker\")}catch(t){console.error(t)}}(oe.antiFlicker||se.antiFlicker)&&ae(),\"cookie\"===oe.useStickyBucketService||\"cookie\"===se.useStickyBucketService?ce=new class extends qt{constructor(t){let{prefix:e=\"gbStickyBuckets__\",jsCookie:n,cookieAttributes:r={expires:180}}=t;super(),this.prefix=e,this.jsCookie=n,this.cookieAttributes=r}getAssignmentsSync(t,e){const n=this.getKey(t,e);let r=null;if(!this.jsCookie)return r;try{const t=this.jsCookie.get(n),e=JSON.parse(t||\"{}\");e.attributeName&&e.attributeValue&&e.assignments&&(r=e)}catch(t){}return r}async saveAssignmentsSync(t){const e=this.getKey(t.attributeName,t.attributeValue);if(!this.jsCookie)return;const n=JSON.stringify(t);this.jsCookie.set(e,n,this.cookieAttributes)}}({prefix:oe.stickyBucketPrefix||se.stickyBucketPrefix||void 0,jsCookie:e}):\"localStorage\"!==oe.useStickyBucketService&&\"localStorage\"!==se.useStickyBucketService||(ce=new class extends Ht{constructor(t){t=t||{},super(),this.prefix=t.prefix||\"gbStickyBuckets__\";try{this.localStorage=t.localStorage||globalThis.localStorage}catch(t){}}async getAssignments(t,e){const n=this.getKey(t,e);let r=null;if(!this.localStorage)return r;try{const t=await this.localStorage.getItem(n)||\"{}\",e=JSON.parse(t);e.attributeName&&e.attributeValue&&e.assignments&&(r=e)}catch(t){}return r}async saveAssignments(t){const e=this.getKey(t.attributeName,t.attributeValue);if(this.localStorage)try{await this.localStorage.setItem(e,JSON.stringify(t))}catch(t){}}}({prefix:oe.stickyBucketPrefix||se.stickyBucketPrefix||void 0}));const he=se.uuid||oe.uuid,fe=[function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(\"undefined\"==typeof window)throw new Error(\"autoAttributesPlugin only works in the browser\");const e=t.uuidCookieName||\"gbuuid\",n=t.uuidKey||\"id\";let r=t.uuid||\"\";function i(){Zt(e,r)}function s(){return r||(r=Qt(e),r||(r=Wt(window.crypto),r))}function o(t){const e=navigator.userAgent,r=s();(t.uuidAutoPersist??!t.uuid)&&i();const o=location;return{...Yt(),[n]:r,...zt(o),pageTitle:document.title,...Gt(e),...Xt(o)}}return document.addEventListener(\"growthbookpersist\",(()=>{i()})),e=>{if(\"createScopedInstance\"in e)return;const n=o(t);n.url&&e.setURL(n.url),e.updateAttributes(n);let r=n.url;const i=setInterval((()=>{location.href!==r&&(r=location.href,e.setURL(r),e.updateAttributes(o(t)))}),500),s=()=>{location.href!==r&&(r=location.href,e.setURL(r)),e.updateAttributes(o(t))};document.addEventListener(\"growthbookrefresh\",s),\"onDestroy\"in e&&e.onDestroy((()=>{clearInterval(i),document.removeEventListener(\"growthbookrefresh\",s)}))}}({uuid:he,uuidCookieName:oe.uuidCookieName||se.uuidCookieName,uuidKey:oe.uuidKey||se.uuidKey,uuidAutoPersist:!he&&null==se.noAutoCookies})],de=se.tracking||\"gtag,gtm,segment\";if(\"none\"!==de){const t=de.toLowerCase().split(\",\").map((t=>t.trim()));t.includes(\"growthbook\")&&fe.push(function(){let{queueFlushInterval:t=100,ingestorHost:e,enable:n=!0,debug:r,dedupeCacheSize:i=1e3,dedupeKeyAttributes:s=[],eventFilter:o}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return u=>{const c=u.getClientKey();if(!c)throw new Error(\"clientKey must be specified to use event logging\");const a=new Set;if(\"setEventLogger\"in u){let l=[],h=null;const f=async()=>{const t=l;l=[],h&&clearTimeout(h),h=null,t.length&&await re({clientKey:c,events:t,ingestorHost:e})};let d=null;u.setEventLogger((async(e,u,c)=>{const w={eventName:e,properties:u,attributes:c.attributes||{},url:c.url||\"\"};if(o&&!o(w))return;if(e===$t||e===Ct){const t={eventName:e,properties:u};for(const e of s)t[\"attr:\"+e]=w.attributes[e];const n=JSON.stringify(t);if(a.has(n))return a.delete(n),void a.add(n);if(a.add(n),a.size>i){const t=a.values().next().value;t&&a.delete(t)}}const p=ne(w);r&&console.log(\"Logging event to GrowthBook\",JSON.parse(JSON.stringify(p))),n&&(l.push(p),d||(d=new Promise(((e,n)=>{h=setTimeout((()=>{f().then(e).catch(n),d=null}),t)}))),await d)})),\"undefined\"!=typeof document&&document.visibilityState&&document.addEventListener(\"visibilitychange\",(()=>{\"hidden\"===document.visibilityState&&f().catch(console.error)})),\"onDestroy\"in u&&u.onDestroy((()=>{f().catch(console.error)}))}if(\"undefined\"!=typeof window&&!(\"createScopedInstance\"in u)){const t=Array.isArray(window.gbEvents)?window.gbEvents:[];window.gbEvents={push:t=>{\"isDestroyed\"in u&&u.isDestroyed()?window.gbEvents=[t]:\"string\"==typeof t?u.logEvent(t):t&&u.logEvent(t.eventName,t.properties)}};for(const e of t)window.gbEvents.push(e)}}}({ingestorHost:se.eventIngestorHost})),oe.trackingCallback||fe.push(function(){let{additionalCallback:t,trackers:e=[\"gtag\",\"gtm\",\"segment\"]}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(\"undefined\"==typeof window)throw new Error(\"thirdPartyTrackingPlugin only works in the browser\");return n=>{n.setTrackingCallback((async(n,r)=>{const i=[],s={experiment_id:n.key,variation_id:r.key};if(t&&i.push(Promise.resolve(t(n,r))),e.includes(\"gtag\")&&window.gtag){let t;const e=new Promise((e=>{t=e}));i.push(e),window.gtag(\"event\",\"experiment_viewed\",{...s,event_callback:t})}if(e.includes(\"gtm\")&&window.dataLayer){let t;const e=new Promise((e=>{t=e}));i.push(e),window.dataLayer.push({event:\"experiment_viewed\",...s,eventCallback:t})}if(e.includes(\"segment\")&&window.analytics&&window.analytics.track){window.analytics.track(\"Experiment Viewed\",s);const t=new Promise((t=>window.setTimeout(t,300)));i.push(t)}await Promise.all(i)}))}}({additionalCallback:oe.additionalTrackingCallback,trackers:t}))}const we=new class{constructor(t){if(t=t||{},this.version=Kt,this.i=this.context=t,this.o=t.renderer||null,this.u=new Set,this.l=new Set,this.h={},this.debug=!!t.debug,this.p=new Set,this.ready=!1,this.g=new Map,this.m=new Map,this.v=new Set,this.k=!1,this.S=\"\",this.A=new Map,this._=!t.disableExperimentsOnLoad,this.$=[],this.logs=[],this.log=this.log.bind(this),this.C=this.C.bind(this),this.O=this.O.bind(this),this.T=this.T.bind(this),t.remoteEval){if(t.decryptionKey)throw new Error(\"Encryption is not available for remoteEval\");if(!t.clientKey)throw new Error(\"Missing clientKey\");let e=!1;try{e=!!new URL(t.apiHost||\"\").hostname.match(/growthbook\\.io$/i)}catch(t){}if(e)throw new Error(\"Cannot use remoteEval on GrowthBook Cloud\")}else if(t.cacheKeyAttributes)throw new Error(\"cacheKeyAttributes are only used for remoteEval\");if(t.stickyBucketService){const e=t.stickyBucketService;this.N=t=>e.saveAssignments(t)}if(t.plugins)for(const e of t.plugins)e(this);if(t.features&&(this.ready=!0),Lt&&t.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event(\"gbloaded\"))),t.experiments&&(this.ready=!0,this.D()),this.i.stickyBucketService&&this.i.stickyBucketAssignmentDocs)for(const t in this.i.stickyBucketAssignmentDocs){const e=this.i.stickyBucketAssignmentDocs[t];e&&this.i.stickyBucketService.saveAssignments(e).catch((()=>{}))}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(t){this.F=t;const e=await async function(t,e,n){if((t={...t}).encryptedFeatures){try{t.features=JSON.parse(await P(t.encryptedFeatures,e,n))}catch(t){console.error(t)}delete t.encryptedFeatures}if(t.encryptedExperiments){try{t.experiments=JSON.parse(await P(t.encryptedExperiments,e,n))}catch(t){console.error(t)}delete t.encryptedExperiments}if(t.encryptedSavedGroups){try{t.savedGroups=JSON.parse(await P(t.encryptedSavedGroups,e,n))}catch(t){console.error(t)}delete t.encryptedSavedGroups}return t}(t,this.i.decryptionKey);this.M=e,await this.refreshStickyBuckets(e),e.features&&(this.i.features=e.features),e.savedGroups&&(this.i.savedGroups=e.savedGroups),e.experiments&&(this.i.experiments=e.experiments,this.D()),this.ready=!0,this.R()}initSync(t){this.k=!0;const e=t.payload;if(e.encryptedExperiments||e.encryptedFeatures)throw new Error(\"initSync does not support encrypted payloads\");return this.i.stickyBucketService&&!this.i.stickyBucketAssignmentDocs&&(this.i.stickyBucketAssignmentDocs=this.generateStickyBucketAssignmentDocsSync(this.i.stickyBucketService,e)),this.F=e,this.M=e,e.features&&(this.i.features=e.features),e.experiments&&(this.i.experiments=e.experiments,this.D()),this.ready=!0,yt(this,t),this}async init(t){if(this.k=!0,(t=t||{}).cacheSettings&&(Object.assign(Z,t.cacheSettings),Z.backgroundSync||(rt.clear(),nt.forEach(pt),X.clear(),W.stopIdleListener())),t.payload)return await this.setPayload(t.payload),yt(this,t),{success:!0,source:\"init\"};{const{data:e,...n}=await this.B({...t,allowStale:!0});return yt(this,t),await this.setPayload(e||{}),n}}async loadFeatures(t){t=t||{},await this.init({skipCache:t.skipCache,timeout:t.timeout,streaming:(this.i.backgroundSync??!0)&&(t.autoRefresh||this.i.subscribeToChanges)})}async refreshFeatures(t){const e=await this.B({...t||{},allowStale:!1});e.data&&await this.setPayload(e.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return function(t){const e=t.apiHost||\"https://cdn.growthbook.io\";return{apiHost:e.replace(/\\/*$/,\"\"),streamingHost:(t.streamingHost||e).replace(/\\/*$/,\"\"),apiRequestHeaders:t.apiHostRequestHeaders,streamingHostRequestHeaders:t.streamingHostRequestHeaders}}(this.i)}getClientKey(){return this.i.clientKey||\"\"}getPayload(){return this.F||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this.M||this.getPayload()}isRemoteEval(){return this.i.remoteEval||!1}getCacheKeyAttributes(){return this.i.cacheKeyAttributes}async B(t){let{timeout:e,skipCache:n,allowStale:r,streaming:i}=t;if(!this.i.clientKey)throw new Error(\"Missing clientKey\");return async function(t){let{instance:e,timeout:n,skipCache:r,allowStale:i,backgroundSync:s}=t;return s||(Z.backgroundSync=!1),async function(t){let{instance:e,allowStale:n,timeout:r,skipCache:i}=t;const s=ot(e),o=ut(e),u=new Date,c=new Date(u.getTime()-Z.maxAge+Z.staleTTL);await async function(){if(!Y){Y=!0;try{if(Q.localStorage){const t=await Q.localStorage.getItem(Z.cacheKey);if(!Z.disableCache&&t){const e=JSON.parse(t);e&&Array.isArray(e)&&e.forEach((t=>{let[e,n]=t;tt.set(e,{...n,staleAt:new Date(n.staleAt)})})),ct()}}}catch(t){}if(!Z.disableIdleStreams){const t=W.startIdleListener();t&&(W.stopIdleListener=t)}}}();const a=Z.disableCache||i?void 0:tt.get(o);return a&&(n||a.staleAt>u)&&a.staleAt>c?(a.sse&&rt.add(s),a.staleAt<u?lt(e):ht(e),{data:a.data,success:!0,source:\"cache\"}):await z(lt(e),r)||{data:null,success:!1,source:\"timeout\",error:new Error(\"Timeout\")}}({instance:e,allowStale:i,timeout:n,skipCache:r})}({instance:this,timeout:e,skipCache:n||this.i.disableCache,allowStale:r,backgroundSync:i??this.i.backgroundSync??!0})}R(){if(this.o)try{this.o()}catch(t){console.error(\"Failed to render\",t)}}setFeatures(t){this.i.features=t,this.ready=!0,this.R()}async setEncryptedFeatures(t,e,n){const r=await P(t,e||this.i.decryptionKey,n);this.setFeatures(JSON.parse(r))}setExperiments(t){this.i.experiments=t,this.ready=!0,this.D()}async setEncryptedExperiments(t,e,n){const r=await P(t,e||this.i.decryptionKey,n);this.setExperiments(JSON.parse(r))}async setAttributes(t){this.i.attributes=t,this.i.stickyBucketService&&await this.refreshStickyBuckets(),this.i.remoteEval?await this.I():(this.R(),this.D())}async updateAttributes(t){return this.setAttributes({...this.i.attributes,...t})}async setAttributeOverrides(t){this.i.attributeOverrides=t,this.i.stickyBucketService&&await this.refreshStickyBuckets(),this.i.remoteEval?await this.I():(this.R(),this.D())}async setForcedVariations(t){this.i.forcedVariations=t||{},this.i.remoteEval?await this.I():(this.R(),this.D())}setForcedFeatures(t){this.i.forcedFeatureValues=t,this.R()}async setURL(t){if(t!==this.i.url){if(this.i.url=t,this.S=\"\",this.i.remoteEval)return await this.I(),void this.D(!0);this.D(!0)}}getAttributes(){return{...this.i.attributes,...this.i.attributeOverrides}}getForcedVariations(){return this.i.forcedVariations||{}}getForcedFeatures(){return this.i.forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this.i.stickyBucketAssignmentDocs||{}}getUrl(){return this.i.url||\"\"}getFeatures(){return this.i.features||{}}getExperiments(){return this.i.experiments||[]}getCompletedChangeIds(){return Array.from(this.l)}subscribe(t){return this.p.add(t),()=>{this.p.delete(t)}}async I(){if(!this.i.remoteEval)return;if(!this.k)return;const t=await this.B({allowStale:!1});t.data&&await this.setPayload(t.data)}getAllResults(){return new Map(this.g)}onDestroy(t){this.$.push(t)}isDestroyed(){return!!this.U}destroy(){var t;this.U=!0,this.$.forEach((t=>{try{t()}catch(t){console.error(t)}})),this.p.clear(),this.g.clear(),this.u.clear(),this.l.clear(),this.A.clear(),this.h={},this.$=[],this.F=void 0,this.N=void 0,t=this,X.forEach((e=>e.delete(t))),this.logs=[],Lt&&window._growthbook===this&&delete window._growthbook,this.m.forEach((t=>{t.undo()})),this.m.clear(),this.v.clear()}setRenderer(t){this.o=t}forceVariation(t,e){this.i.forcedVariations=this.i.forcedVariations||{},this.i.forcedVariations[t]=e,this.i.remoteEval?this.I():(this.D(),this.R())}run(t){const{result:e}=Nt(t,null,this.V());return this.O(t,e),e}triggerExperiment(t){return this.v.add(t),this.i.experiments?this.i.experiments.filter((e=>e.key===t)).map((t=>this.j(t))).filter((t=>null!==t)):null}triggerAutoExperiments(){this._=!0,this.D(!0)}V(){return{user:this.J(),global:this.P(),stack:{evaluatedFeatures:new Set}}}J(){return{attributes:this.i.user?{...this.i.user,...this.i.attributes}:this.i.attributes,enableDevMode:this.i.enableDevMode,blockedChangeIds:this.i.blockedChangeIds,stickyBucketAssignmentDocs:this.i.stickyBucketAssignmentDocs,url:this.L(),forcedVariations:this.i.forcedVariations,forcedFeatureValues:this.i.forcedFeatureValues,attributeOverrides:this.i.attributeOverrides,saveStickyBucketAssignmentDoc:this.N,trackingCallback:this.i.trackingCallback,onFeatureUsage:this.i.onFeatureUsage,devLogs:this.logs,trackedExperiments:this.u,trackedFeatureUsage:this.h}}P(){return{features:this.i.features,experiments:this.i.experiments,log:this.log,enabled:this.i.enabled,qaMode:this.i.qaMode,savedGroups:this.i.savedGroups,groups:this.i.groups,overrides:this.i.overrides,onExperimentEval:this.p.size>0?this.O:void 0,recordChangeId:this.T,saveDeferredTrack:this.C,eventLogger:this.i.eventLogger}}j(t,e){const n=this.m.get(t);if(t.manual&&!this.v.has(t.key)&&!n)return null;let r,i;this.K(t)?r=It(this.V(),t,-1,!1,\"\"):(({result:r,trackingCall:i}=Nt(t,null,this.V())),this.O(t,r));const s=JSON.stringify(r.value);if(!e&&r.inExperiment&&n&&n.valueHash===s)return r;if(n&&this.H(t),r.inExperiment){const e=G(t);if(\"redirect\"===e&&r.value.urlRedirect&&t.urlPatterns){const e=t.persistQueryString?function(t,e){let n,r;try{n=new URL(t),r=new URL(e)}catch(t){return console.error(`Unable to merge query strings: ${t}`),e}return n.searchParams.forEach(((t,e)=>{r.searchParams.has(e)||r.searchParams.set(e,t)})),r.toString()}(this.L(),r.value.urlRedirect):r.value.urlRedirect;if(V(e,t.urlPatterns))return this.log(\"Skipping redirect because original URL matches redirect URL\",{id:t.key}),r;this.S=e;const{navigate:n,delay:s}=this.q();if(n)if(Lt)Promise.all([...i?[z(i,this.i.maxNavigateDelay??1e3)]:[],new Promise((t=>window.setTimeout(t,this.i.navigateDelay??s)))]).then((()=>{try{n(e)}catch(t){console.error(t)}}));else try{n(e)}catch(t){console.error(t)}}else if(\"visual\"===e){const e=this.i.applyDomChangesCallback?this.i.applyDomChangesCallback(r.value):this.G(r.value);e&&this.m.set(t,{undo:e,valueHash:s})}}return r}H(t){const e=this.m.get(t);e&&(e.undo(),this.m.delete(t))}D(t){if(!this._)return;const e=this.i.experiments||[],n=new Set(e);this.m.forEach(((t,e)=>{n.has(e)||(t.undo(),this.m.delete(e))}));for(const n of e){const e=this.j(n,t);if(null!=e&&e.inExperiment&&\"redirect\"===G(n))break}}O(t,e){const n=t.key,r=this.g.get(n);r&&r.result.inExperiment===e.inExperiment&&r.result.variationId===e.variationId||(this.g.set(n,{experiment:t,result:e}),this.p.forEach((n=>{try{n(t,e)}catch(t){console.error(t)}})))}T(t){this.l.add(t)}isOn(t){return this.evalFeature(t).on}isOff(t){return this.evalFeature(t).off}getFeatureValue(t,e){const n=this.evalFeature(t).value;return null===n?e:n}feature(t){return this.evalFeature(t)}evalFeature(t){return Tt(t,this.V())}log(t,e){this.debug&&(this.i.log?this.i.log(t,e):console.log(t,e))}getDeferredTrackingCalls(){return Array.from(this.A.values())}setDeferredTrackingCalls(t){this.A=new Map(t.filter((t=>t&&t.experiment&&t.result)).map((t=>[Pt(t.experiment,t.result),t])))}async fireDeferredTrackingCalls(){if(!this.i.trackingCallback)return;const t=[];this.A.forEach((e=>{e&&e.experiment&&e.result?t.push(this.i.trackingCallback(e.experiment,e.result)):console.error(\"Invalid deferred tracking call\",{call:e})})),this.A.clear(),await Promise.all(t)}setTrackingCallback(t){this.i.trackingCallback=t,this.fireDeferredTrackingCalls()}setEventLogger(t){this.i.eventLogger=t}async logEvent(t,e){if(this.U)console.error(\"Cannot log event to destroyed GrowthBook instance\");else if(this.i.enableDevMode&&this.logs.push({eventName:t,properties:e,timestamp:Date.now().toString(),logType:\"event\"}),this.i.eventLogger)try{await this.i.eventLogger(t,e||{},this.J())}catch(t){console.error(t)}else console.error(\"No event logger configured\")}C(t){this.A.set(Pt(t.experiment,t.result),t)}L(){return this.i.url||(Lt?window.location.href:\"\")}K(t){const e=G(t);if(\"visual\"===e){if(this.i.disableVisualExperiments)return!0;if(this.i.disableJsInjection&&t.variations.some((t=>t.js)))return!0}else{if(\"redirect\"!==e)return!0;if(this.i.disableUrlRedirectExperiments)return!0;try{const e=new URL(this.L());for(const n of t.variations){if(!n||!n.urlRedirect)continue;const t=new URL(n.urlRedirect);if(this.i.disableCrossOriginUrlRedirectExperiments){if(t.protocol!==e.protocol)return!0;if(t.host!==e.host)return!0}}}catch(e){return this.log(\"Error parsing current or redirect URL\",{id:t.key,error:e}),!0}}return!(!t.changeId||!(this.i.blockedChangeIds||[]).includes(t.changeId))}getRedirectUrl(){return this.S}q(){return this.i.navigate?{navigate:this.i.navigate,delay:0}:Lt?{navigate:t=>{window.location.replace(t)},delay:100}:{navigate:null,delay:0}}G(t){if(!Lt)return;const e=[];if(t.css){const n=document.createElement(\"style\");n.innerHTML=t.css,document.head.appendChild(n),e.push((()=>n.remove()))}if(t.js){const n=document.createElement(\"script\");n.innerHTML=t.js,this.i.jsInjectionNonce&&(n.nonce=this.i.jsInjectionNonce),document.head.appendChild(n),e.push((()=>n.remove()))}return t.domMutations&&t.domMutations.forEach((t=>{e.push(function(t){var e=t.selector,n=t.action,i=t.value,s=t.attribute,o=t.parentSelector,u=t.insertBeforeSelector;if(\"html\"===s){if(\"append\"===n)return N(e,(function(t){return t+(null!=i?i:\"\")}));if(\"set\"===n)return N(e,(function(){return null!=i?i:\"\"}))}else if(\"class\"===s){if(\"append\"===n)return D(e,(function(t){i&&t.add(i)}));if(\"remove\"===n)return D(e,(function(t){i&&t.delete(i)}));if(\"set\"===n)return D(e,(function(t){t.clear(),i&&t.add(i)}))}else if(\"position\"===s){if(\"set\"===n&&o)return function(t,e){return T({kind:\"position\",elements:new Set,mutate:function(){return{insertBeforeSelector:u,parentSelector:o}},selector:t})}(e)}else{if(\"append\"===n)return F(e,s,(function(t){return null!==t?t+(null!=i?i:\"\"):null!=i?i:\"\"}));if(\"set\"===n)return F(e,s,(function(){return null!=i?i:\"\"}));if(\"remove\"===n)return F(e,s,(function(){return null}))}return r}(t).revert)})),()=>{e.forEach((t=>t()))}}async refreshStickyBuckets(t){if(this.i.stickyBucketService){const e=this.V(),n=await async function(t,e,n){const r=Jt(t,n);return e.getAllAssignments(r)}(e,this.i.stickyBucketService,t);this.i.stickyBucketAssignmentDocs=n}}generateStickyBucketAssignmentDocsSync(t,e){if(!(\"getAllAssignmentsSync\"in t))return void console.error(\"generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync\");const n=Jt(this.V(),e);return t.getAllAssignmentsSync(n)}inDevMode(){return!!this.i.enableDevMode}}({enableDevMode:!0,...se,remoteEval:!!se.remoteEval,...oe,plugins:fe,stickyBucketService:ce});we.setRenderer((()=>{document.dispatchEvent(new CustomEvent(\"growthbookdata\"))})),we.init({payload:oe.payload,streaming:!(oe.noStreaming||se.noStreaming||!1===oe.backgroundSync),cacheSettings:oe.cacheSettings}).then((()=>{(oe.antiFlicker||se.antiFlicker)&&(we.getRedirectUrl()?ae():le())}));const pe=t=>{try{t&&t(we)}catch(t){console.error(\"Uncaught growthbook_queue error\",t)}};return window.growthbook_queue&&Array.isArray(window.growthbook_queue)&&window.growthbook_queue.forEach((t=>{pe(t)})),window.growthbook_queue={push:t=>{pe(t)}},we}();\n//# sourceMappingURL=auto.min.js.map\n";
|
|
2
|
+
export const sdkWrapper = "var _growthbook=function(){\"use strict\";function t(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)t[r]=n[r]}return t}var e=function e(n,r){function i(e,i,s){if(\"undefined\"!=typeof document){\"number\"==typeof(s=t({},r,s)).expires&&(s.expires=new Date(Date.now()+864e5*s.expires)),s.expires&&(s.expires=s.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o=\"\";for(var u in s)s[u]&&(o+=\"; \"+u,!0!==s[u]&&(o+=\"=\"+s[u].split(\";\")[0]));return document.cookie=e+\"=\"+n.write(i,e)+o}}return Object.create({set:i,get:function(t){if(\"undefined\"!=typeof document&&(!arguments.length||t)){for(var e=document.cookie?document.cookie.split(\"; \"):[],r={},i=0;i<e.length;i++){var s=e[i].split(\"=\"),o=s.slice(1).join(\"=\");try{var u=decodeURIComponent(s[0]);if(r[u]=n.read(o,u),t===u)break}catch(t){}}return t?r[t]:r}},remove:function(e,n){i(e,\"\",t({},n,{expires:-1}))},withAttributes:function(n){return e(this.converter,t({},this.attributes,n))},withConverter:function(n){return e(t({},this.converter,n),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(n)}})}({read:function(t){return\'\"\'===t[0]&&(t=t.slice(1,-1)),t.replace(/(%[\\dA-F]{2})+/gi,decodeURIComponent)},write:function(t){return encodeURIComponent(t).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}},{path:\"/\"}),n=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,r={revert:function(){}},i=new Map,s=new Set;function o(t){var e=i.get(t);return e||i.set(t,e={element:t,attributes:{}}),e}function u(t,e,n,r,i){var s=n(t),o={isDirty:!1,originalValue:s,virtualValue:s,mutations:[],el:t,t:null,observer:new MutationObserver((function(){if(\"position\"!==e||!o.t){\"position\"===e&&(o.t=setTimeout((function(){o.t=null}),1e3));var r=n(t);\"position\"===e&&r.parentNode===o.virtualValue.parentNode&&r.insertBeforeNode===o.virtualValue.insertBeforeNode||r!==o.virtualValue&&(o.originalValue=r,i(o))}})),mutationRunner:i,setValue:r,getCurrentValue:n};return\"position\"===e&&t.parentNode?o.observer.observe(t.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):o.observer.observe(t,function(t){return\"html\"===t?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[t]}}(e)),o}function c(t,e){var n=e.getCurrentValue(e.el);e.virtualValue=t,t&&\"string\"!=typeof t?n&&t.parentNode===n.parentNode&&t.insertBeforeNode===n.insertBeforeNode||(e.isDirty=!0,C()):t!==n&&(e.isDirty=!0,C())}function a(t){var e=t.originalValue;t.mutations.forEach((function(t){return e=t.mutate(e)})),c(function(t){return v||(v=document.createElement(\"div\")),v.innerHTML=t,v.innerHTML}(e),t)}function l(t){var e=new Set(t.originalValue.split(/\\s+/).filter(Boolean));t.mutations.forEach((function(t){return t.mutate(e)})),c(Array.from(e).filter(Boolean).join(\" \"),t)}function h(t){var e=t.originalValue;t.mutations.forEach((function(t){return e=t.mutate(e)})),c(e,t)}function f(t){var e=t.originalValue;t.mutations.forEach((function(t){var n=function(t){var e=t.insertBeforeSelector,n=document.querySelector(t.parentSelector);if(!n)return null;var r=e?document.querySelector(e):null;return e&&!r?null:{parentNode:n,insertBeforeNode:r}}(t.mutate());e=n||e})),c(e,t)}var d=function(t){return t.innerHTML},w=function(t,e){return t.innerHTML=e};function y(t){var e=o(t);return e.html||(e.html=u(t,\"html\",d,w,a)),e.html}var p=function(t){return{parentNode:t.parentElement,insertBeforeNode:t.nextElementSibling}},g=function(t,e){e.insertBeforeNode&&!e.parentNode.contains(e.insertBeforeNode)||e.parentNode.insertBefore(t,e.insertBeforeNode)};function m(t){var e=o(t);return e.position||(e.position=u(t,\"position\",p,g,f)),e.position}var v,b,k=function(t,e){return e?t.className=e:t.removeAttribute(\"class\")},S=function(t){return t.className};function A(t){var e=o(t);return e.classes||(e.classes=u(t,\"class\",S,k,l)),e.classes}function _(t,e){var n,r=o(t);return r.attributes[e]||(r.attributes[e]=u(t,e,(n=e,function(t){var e;return null!=(e=t.getAttribute(n))?e:null}),function(t){return function(e,n){return null!==n?e.setAttribute(t,n):e.removeAttribute(t)}}(e),h)),r.attributes[e]}function $(t,e,n){if(n.isDirty){n.isDirty=!1;var r=n.virtualValue;n.mutations.length||function(t,e){var n,r,s=i.get(t);if(s)if(\"html\"===e)null==(n=s.html)||null==(r=n.observer)||r.disconnect(),delete s.html;else if(\"class\"===e){var o,u;null==(o=s.classes)||null==(u=o.observer)||u.disconnect(),delete s.classes}else if(\"position\"===e){var c,a;null==(c=s.position)||null==(a=c.observer)||a.disconnect(),delete s.position}else{var l,h,f;null==(l=s.attributes)||null==(h=l[e])||null==(f=h.observer)||f.disconnect(),delete s.attributes[e]}}(t,e),n.setValue(t,r)}}function x(t,e){t.html&&$(e,\"html\",t.html),t.classes&&$(e,\"class\",t.classes),t.position&&$(e,\"position\",t.position),Object.keys(t.attributes).forEach((function(n){$(e,n,t.attributes[n])}))}function C(){i.forEach(x)}function E(t){if(\"position\"!==t.kind||1!==t.elements.size){var e=new Set(t.elements);document.querySelectorAll(t.selector).forEach((function(n){e.has(n)||(t.elements.add(n),function(t,e){var n=null;\"html\"===t.kind?n=y(e):\"class\"===t.kind?n=A(e):\"attribute\"===t.kind?n=_(e,t.attribute):\"position\"===t.kind&&(n=m(e)),n&&(n.mutations.push(t),n.mutationRunner(n))}(t,n))}))}}function O(){s.forEach(E)}function T(t){return\"undefined\"==typeof document?r:(s.add(t),E(t),{revert:function(){var e;(e=t).elements.forEach((function(t){return function(t,e){var n=null;if(\"html\"===t.kind?n=y(e):\"class\"===t.kind?n=A(e):\"attribute\"===t.kind?n=_(e,t.attribute):\"position\"===t.kind&&(n=m(e)),n){var r=n.mutations.indexOf(t);-1!==r&&n.mutations.splice(r,1),n.mutationRunner(n)}}(e,t)})),e.elements.clear(),s.delete(e)}})}function N(t,e){return T({kind:\"html\",elements:new Set,mutate:e,selector:t})}function D(t,e){return T({kind:\"class\",elements:new Set,mutate:e,selector:t})}function F(t,e,i){return n.test(e)?\"class\"===e||\"className\"===e?D(t,(function(t){var e=i(Array.from(t).join(\" \"));t.clear(),e&&e.split(/\\s+/g).filter(Boolean).forEach((function(e){return t.add(e)}))})):T({kind:\"attribute\",attribute:e,elements:new Set,mutate:i,selector:t}):r}\"undefined\"!=typeof document&&(b||(b=new MutationObserver((function(){O()}))),O(),b.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}));const M={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function R(t){let e=2166136261;const n=t.length;for(let r=0;r<n;r++)e^=t.charCodeAt(r),e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24);return e>>>0}function B(t,e,n){return 2===n?R(R(t+e)+\"\")%1e4/1e4:1===n?R(e+t)%1e3/1e3:null}function I(t,e){return t>=e[0]&&t<e[1]}function U(t){try{const e=t.replace(/([^\\\\])\\//g,\"$1\\\\/\");return new RegExp(e)}catch(t){return void console.error(t)}}function V(t,e){if(!e.length)return!1;let n=!1,r=!1;for(let i=0;i<e.length;i++){const s=j(t,e[i].type,e[i].pattern);if(!1===e[i].include){if(s)return!1}else n=!0,s&&(r=!0)}return r||!n}function j(t,e,n){try{const r=new URL(t,\"https://_\");if(\"regex\"===e){const t=U(n);return!!t&&(t.test(r.href)||t.test(r.href.substring(r.origin.length)))}return\"simple\"===e&&function(t,e){try{const n=new URL(e.replace(/^([^:/?]*)\\./i,\"https://$1.\").replace(/\\*/g,\"_____\"),\"https://_____\"),r=[[t.host,n.host,!1],[t.pathname,n.pathname,!0]];return n.hash&&r.push([t.hash,n.hash,!1]),n.searchParams.forEach(((e,n)=>{r.push([t.searchParams.get(n)||\"\",e,!1])})),!r.some((t=>!function(t,e,n){try{let r=e.replace(/[*.+?^${}()|[\\]\\\\]/g,\"\\\\$&\").replace(/_____/g,\".*\");return n&&(r=\"\\\\/?\"+r.replace(/(^\\/|\\/$)/g,\"\")+\"\\\\/?\"),new RegExp(\"^\"+r+\"$\",\"i\").test(t)}catch(t){return!1}}(t[0],t[1],t[2])))}catch(t){return!1}}(r,n)}catch(t){return!1}}const J=t=>Uint8Array.from(atob(t),(t=>t.charCodeAt(0)));async function P(t,e,n){if(e=e||\"\",!(n=n||globalThis.crypto&&globalThis.crypto.subtle||M.SubtleCrypto))throw new Error(\"No SubtleCrypto implementation found\");try{const r=await n.importKey(\"raw\",J(e),{name:\"AES-CBC\",length:128},!0,[\"encrypt\",\"decrypt\"]),[i,s]=t.split(\".\"),o=await n.decrypt({name:\"AES-CBC\",iv:J(i)},r,J(s));return(new TextDecoder).decode(o)}catch(t){throw new Error(\"Failed to decrypt\")}}function L(t){return\"string\"==typeof t?t:JSON.stringify(t)}function K(t){\"number\"==typeof t&&(t+=\"\"),t&&\"string\"==typeof t||(t=\"0\");const e=t.replace(/(^v|\\+.*$)/g,\"\").split(/[-.]/);return 3===e.length&&e.push(\"~\"),e.map((t=>t.match(/^[0-9]+$/)?t.padStart(5,\" \"):t)).join(\"-\")}function H(){let t;try{t=\"1.6.4\"}catch(e){t=\"\"}return t}function q(t){return\"object\"==typeof t&&null!==t}function G(t){return t.urlPatterns&&t.variations.some((t=>q(t)&&\"urlRedirect\"in t))?\"redirect\":t.variations.some((t=>q(t)&&(t.domMutations||\"js\"in t||\"css\"in t)))?\"visual\":\"unknown\"}async function z(t,e){return new Promise((n=>{let r,i=!1;const s=t=>{i||(i=!0,r&&clearTimeout(r),n(t||null))};e&&(r=setTimeout((()=>s()),e)),t.then((t=>s(t))).catch((()=>s()))}))}const Z={staleTTL:6e4,maxAge:144e5,cacheKey:\"gbFeaturesCache\",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},Q=M,W={fetchFeaturesCall:({host:t,clientKey:e,headers:n})=>Q.fetch(`${t}/api/features/${e}`,{headers:n}),fetchRemoteEvalCall:({host:t,clientKey:e,payload:n,headers:r})=>{const i={method:\"POST\",headers:{\"Content-Type\":\"application/json\",...r},body:JSON.stringify(n)};return Q.fetch(`${t}/api/eval/${e}`,i)},eventSourceCall:({host:t,clientKey:e,headers:n})=>n?new Q.EventSource(`${t}/sub/${e}`,{headers:n}):new Q.EventSource(`${t}/sub/${e}`),startIdleListener:()=>{let t;if(\"undefined\"==typeof window||\"undefined\"==typeof document)return;const e=()=>{\"visible\"===document.visibilityState?(window.clearTimeout(t),nt.forEach((t=>{t&&\"idle\"===t.state&&wt(t)}))):\"hidden\"===document.visibilityState&&(t=window.setTimeout(it,Z.idleStreamInterval))};return document.addEventListener(\"visibilitychange\",e),()=>document.removeEventListener(\"visibilitychange\",e)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(Q.localStorage=globalThis.localStorage)}catch(t){}const X=new Map;let Y=!1;const tt=new Map,et=new Map,nt=new Map,rt=new Set;function it(){nt.forEach((t=>{t&&(t.state=\"idle\",dt(t))}))}async function st(){try{if(!Q.localStorage)return;await Q.localStorage.setItem(Z.cacheKey,JSON.stringify(Array.from(tt.entries())))}catch(t){}}function ot(t){const[e,n]=t.getApiInfo();return`${e}||${n}`}function ut(t){const e=ot(t);if(!(\"isRemoteEval\"in t)||!t.isRemoteEval())return e;const n=t.getAttributes(),r=t.getCacheKeyAttributes()||Object.keys(t.getAttributes()),i={};r.forEach((t=>{i[t]=n[t]}));const s=t.getForcedVariations(),o=t.getUrl();return`${e}||${JSON.stringify({ca:i,fv:s,url:o})}`}function ct(){const t=Array.from(tt.entries()).map((([t,e])=>({key:t,staleAt:e.staleAt.getTime()}))).sort(((t,e)=>t.staleAt-e.staleAt)),e=Math.min(Math.max(0,tt.size-Z.maxEntries),tt.size);for(let n=0;n<e;n++)tt.delete(t[n].key)}function at(t,e,n){const r=n.dateUpdated||\"\",i=new Date(Date.now()+Z.staleTTL),s=Z.disableCache?void 0:tt.get(e);if(s&&r&&s.version===r)return s.staleAt=i,void st();Z.disableCache||(tt.set(e,{data:n,version:r,staleAt:i,sse:rt.has(t)}),ct()),st();const o=X.get(t);o&&o.forEach((t=>async function(t,e){await t.setPayload(e||t.getPayload())}(t,n)))}async function lt(t){const{apiHost:e,apiRequestHeaders:n}=t.getApiHosts(),r=t.getClientKey(),i=\"isRemoteEval\"in t&&t.isRemoteEval(),s=ot(t),o=ut(t);let u=et.get(o);return u||(u=(i?W.fetchRemoteEvalCall({host:e,clientKey:r,payload:{attributes:t.getAttributes(),forcedVariations:t.getForcedVariations(),forcedFeatures:Array.from(t.getForcedFeatures().entries()),url:t.getUrl()},headers:n}):W.fetchFeaturesCall({host:e,clientKey:r,headers:n})).then((t=>{if(!t.ok)throw new Error(`HTTP error: ${t.status}`);return\"enabled\"===t.headers.get(\"x-sse-support\")&&rt.add(s),t.json()})).then((e=>(at(s,o,e),ht(t),et.delete(o),{data:e,success:!0,source:\"network\"}))).catch((t=>(et.delete(o),{data:null,source:\"error\",success:!1,error:t}))),et.set(o,u)),u}function ht(t,e=!1){const n=ot(t),r=ut(t),{streamingHost:i,streamingHostRequestHeaders:s}=t.getApiHosts(),o=t.getClientKey();if(e&&rt.add(n),Z.backgroundSync&&rt.has(n)&&Q.EventSource){if(nt.has(n))return;const t={src:null,host:i,clientKey:o,headers:s,cb:e=>{try{if(\"features-updated\"===e.type){const t=X.get(n);t&&t.forEach((t=>{lt(t)}))}else if(\"features\"===e.type){const t=JSON.parse(e.data);at(n,r,t)}t.errors=0}catch(e){ft(t)}},errors:0,state:\"active\"};nt.set(n,t),wt(t)}}function ft(t){if(\"idle\"!==t.state&&(t.errors++,t.errors>3||t.src&&2===t.src.readyState)){const e=Math.pow(3,t.errors-3)*(1e3+1e3*Math.random());dt(t),setTimeout((()=>{[\"idle\",\"active\"].includes(t.state)||wt(t)}),Math.min(e,3e5))}}function dt(t){t.src&&(t.src.onopen=null,t.src.onerror=null,t.src.close(),t.src=null,\"active\"===t.state&&(t.state=\"disabled\"))}function wt(t){t.src=W.eventSourceCall({host:t.host,clientKey:t.clientKey,headers:t.headers}),t.state=\"active\",t.src.addEventListener(\"features\",t.cb),t.src.addEventListener(\"features-updated\",t.cb),t.src.onerror=()=>ft(t),t.src.onopen=()=>{t.errors=0}}function yt(t,e){dt(t),nt.delete(e)}function pt(){rt.clear(),nt.forEach(yt),X.clear(),W.stopIdleListener()}function gt(t,e){if(e.streaming){if(!t.getClientKey())throw new Error(\"Must specify clientKey to enable streaming\");e.payload&&ht(t,!0),function(t){const e=ot(t),n=X.get(e)||new Set;n.add(t),X.set(e,n)}(t)}}const mt={};function vt(t,e,n){n=n||{};for(const[r,i]of Object.entries(e))switch(r){case\"$or\":if(!Ct(t,i,n))return!1;break;case\"$nor\":if(Ct(t,i,n))return!1;break;case\"$and\":if(!Et(t,i,n))return!1;break;case\"$not\":if(vt(t,i,n))return!1;break;default:if(!St(i,bt(t,r),n))return!1}return!0}function bt(t,e){const n=e.split(\".\");let r=t;for(let t=0;t<n.length;t++){if(!r||\"object\"!=typeof r||!(n[t]in r))return null;r=r[n[t]]}return r}function kt(t,e=!1){const n=`${t}${e?\"/i\":\"\"}`;return mt[n]||(mt[n]=new RegExp(t.replace(/([^\\\\])\\//g,\"$1\\\\/\"),e?\"i\":void 0)),mt[n]}function St(t,e,n,r=!1){if(\"string\"==typeof t)return r?String(e).toLowerCase()===t.toLowerCase():e+\"\"===t;if(\"number\"==typeof t)return 1*e===t;if(\"boolean\"==typeof t)return null!==e&&!!e===t;if(null===t)return null===e;if(Array.isArray(t)||!At(t))return JSON.stringify(e)===JSON.stringify(t);for(const r in t)if(!xt(r,e,t[r],n))return!1;return!0}function At(t){const e=Object.keys(t);return e.length>0&&e.filter((t=>\"$\"===t[0])).length===e.length}function _t(t,e,n=!1){if(n){const n=t=>\"string\"==typeof t?t.toLowerCase():t;return Array.isArray(t)?t.some((t=>e.some((e=>n(t)===n(e))))):e.some((e=>n(t)===n(e)))}return Array.isArray(t)?t.some((t=>e.includes(t))):e.includes(t)}function $t(t,e,n,r=!1){if(!Array.isArray(t))return!1;for(let i=0;i<e.length;i++){let s=!1;for(let o=0;o<t.length;o++)if(St(e[i],t[o],n,r)){s=!0;break}if(!s)return!1}return!0}function xt(t,e,n,r){switch(t){case\"$veq\":return K(e)===K(n);case\"$vne\":return K(e)!==K(n);case\"$vgt\":return K(e)>K(n);case\"$vgte\":return K(e)>=K(n);case\"$vlt\":return K(e)<K(n);case\"$vlte\":return K(e)<=K(n);case\"$eq\":return e===n;case\"$ne\":return e!==n;case\"$lt\":return e<n;case\"$lte\":return e<=n;case\"$gt\":return e>n;case\"$gte\":return e>=n;case\"$exists\":return n?null!=e:null==e;case\"$in\":return!!Array.isArray(n)&&_t(e,n);case\"$ini\":return!!Array.isArray(n)&&_t(e,n,!0);case\"$inGroup\":return _t(e,r[n]||[]);case\"$notInGroup\":return!_t(e,r[n]||[]);case\"$nin\":return!!Array.isArray(n)&&!_t(e,n);case\"$nini\":return!!Array.isArray(n)&&!_t(e,n,!0);case\"$not\":return!St(n,e,r);case\"$size\":return!!Array.isArray(e)&&St(n,e.length,r);case\"$elemMatch\":return function(t,e,n){if(!Array.isArray(t))return!1;const r=At(e)?t=>St(e,t,n):t=>vt(t,e,n);for(let e=0;e<t.length;e++)if(t[e]&&r(t[e]))return!0;return!1}(e,n,r);case\"$all\":return!!Array.isArray(n)&&$t(e,n,r);case\"$alli\":return!!Array.isArray(n)&&$t(e,n,r,!0);case\"$regex\":try{return kt(n).test(e)}catch(t){return!1}case\"$regexi\":try{return kt(n,!0).test(e)}catch(t){return!1}case\"$type\":return function(t){if(null===t)return\"null\";if(Array.isArray(t))return\"array\";const e=typeof t;return[\"string\",\"number\",\"boolean\",\"object\",\"undefined\"].includes(e)?e:\"unknown\"}(e)===n;default:return console.error(\"Unknown operator: \"+t),!1}}function Ct(t,e,n){if(!e.length)return!0;for(let r=0;r<e.length;r++)if(vt(t,e[r],n))return!0;return!1}function Et(t,e,n){for(let r=0;r<e.length;r++)if(!vt(t,e[r],n))return!1;return!0}const Ot=\"Feature Evaluated\",Tt=\"Experiment Viewed\";async function Nt(t){try{await t()}catch(t){}}function Dt(t,e,n){if(t.user.trackedExperiments){const r=Ht(e,n);if(t.user.trackedExperiments.has(r))return[];t.user.trackedExperiments.add(r)}t.user.enableDevMode&&t.user.devLogs&&t.user.devLogs.push({experiment:e,result:n,timestamp:Date.now().toString(),logType:\"experiment\"});const r=[];if(t.global.trackingCallback){const i=t.global.trackingCallback;r.push(Nt((()=>i(e,n,t.user))))}if(t.user.trackingCallback){const i=t.user.trackingCallback;r.push(Nt((()=>i(e,n))))}if(t.global.eventLogger){const i=t.global.eventLogger;r.push(Nt((()=>i(Tt,{experimentId:e.key,variationId:n.key,hashAttribute:n.hashAttribute,hashValue:n.hashValue},t.user))))}return r}function Ft(t,e){if(e.stack.evaluatedFeatures.has(t))return Rt(e,t,null,\"cyclicPrerequisite\");e.stack.evaluatedFeatures.add(t),e.stack.id=t;const n=function(t){const e=new Map;return t.global.forcedFeatureValues&&t.global.forcedFeatureValues.forEach(((t,n)=>e.set(n,t))),t.user.forcedFeatureValues&&t.user.forcedFeatureValues.forEach(((t,n)=>e.set(n,t))),e}(e);if(n.has(t))return Rt(e,t,n.get(t),\"override\");if(!e.global.features||!e.global.features[t])return Rt(e,t,null,\"unknownFeature\");const r=e.global.features[t];if(r.rules){const n=new Set(e.stack.evaluatedFeatures);t:for(const i of r.rules){if(i.parentConditions)for(const r of i.parentConditions){e.stack.evaluatedFeatures=new Set(n);const i=Ft(r.id,e);if(\"cyclicPrerequisite\"===i.source)return Rt(e,t,null,\"cyclicPrerequisite\");if(!vt({value:i.value},r.condition||{})){if(r.gate)return Rt(e,t,null,\"prerequisite\");continue t}}if(i.filters&&Ut(i.filters,e))continue;if(\"force\"in i){if(i.condition&&!It(i.condition,e))continue;if(!Vt(e,i.seed||t,i.hashAttribute,e.user.saveStickyBucketAssignmentDoc&&!i.disableStickyBucketing?i.fallbackAttribute:void 0,i.range,i.coverage,i.hashVersion))continue;return i.tracks&&i.tracks.forEach((t=>{!Dt(e,t.experiment,t.result).length&&e.global.saveDeferredTrack&&e.global.saveDeferredTrack({experiment:t.experiment,result:t.result})})),Rt(e,t,i.force,\"force\",i.id)}if(!i.variations)continue;const r={variations:i.variations,key:i.key||t};\"coverage\"in i&&(r.coverage=i.coverage),i.weights&&(r.weights=i.weights),i.hashAttribute&&(r.hashAttribute=i.hashAttribute),i.fallbackAttribute&&(r.fallbackAttribute=i.fallbackAttribute),i.disableStickyBucketing&&(r.disableStickyBucketing=i.disableStickyBucketing),void 0!==i.bucketVersion&&(r.bucketVersion=i.bucketVersion),void 0!==i.minBucketVersion&&(r.minBucketVersion=i.minBucketVersion),i.namespace&&(r.namespace=i.namespace),i.meta&&(r.meta=i.meta),i.ranges&&(r.ranges=i.ranges),i.name&&(r.name=i.name),i.phase&&(r.phase=i.phase),i.seed&&(r.seed=i.seed),i.hashVersion&&(r.hashVersion=i.hashVersion),i.filters&&(r.filters=i.filters),i.condition&&(r.condition=i.condition);const{result:s}=Mt(r,t,e);if(e.global.onExperimentEval&&e.global.onExperimentEval(r,s),s.inExperiment&&!s.passthrough)return Rt(e,t,s.value,\"experiment\",i.id,r,s)}}return Rt(e,t,void 0===r.defaultValue?null:r.defaultValue,\"defaultValue\")}function Mt(t,e,n){const r=t.key,i=t.variations.length;if(i<2)return{result:jt(n,t,-1,!1,e)};if(!1===n.global.enabled||!1===n.user.enabled)return{result:jt(n,t,-1,!1,e)};if(t=function(t,e){const n=t.key,r=e.global.overrides;return r&&r[n]&&\"string\"==typeof(t=Object.assign({},t,r[n])).url&&(t.url=U(t.url)),t}(t,n),t.urlPatterns&&!V(n.user.url||\"\",t.urlPatterns))return{result:jt(n,t,-1,!1,e)};const s=function(t,e,n){if(!e)return null;const r=e.split(\"?\")[1];if(!r)return null;const i=r.replace(/#.*/,\"\").split(\"&\").map((t=>t.split(\"=\",2))).filter((([e])=>e===t)).map((([,t])=>parseInt(t)));return i.length>0&&i[0]>=0&&i[0]<n?i[0]:null}(r,n.user.url||\"\",i);if(null!==s)return{result:jt(n,t,s,!1,e)};const o=function(t){return t.global.forcedVariations&&t.user.forcedVariations?{...t.global.forcedVariations,...t.user.forcedVariations}:t.global.forcedVariations?t.global.forcedVariations:t.user.forcedVariations?t.user.forcedVariations:{}}(n);if(r in o)return{result:jt(n,t,o[r],!1,e)};if(\"draft\"===t.status||!1===t.active)return{result:jt(n,t,-1,!1,e)};const{hashAttribute:u,hashValue:c}=Jt(n,t.hashAttribute,n.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing?t.fallbackAttribute:void 0);if(!c)return{result:jt(n,t,-1,!1,e)};let a=-1,l=!1,h=!1;if(n.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing){const{variation:e,versionIsBlocked:r}=function({ctx:t,expKey:e,expBucketVersion:n,expHashAttribute:r,expFallbackAttribute:i,expMinBucketVersion:s,expMeta:o}){s=s||0,r=r||\"id\",o=o||[];const u=Pt(e,n=n||0),c=function(t,e,n){if(!t.user.stickyBucketAssignmentDocs)return{};const{hashAttribute:r,hashValue:i}=Jt(t,e),s=Lt(r,L(i)),{hashAttribute:o,hashValue:u}=Jt(t,n),c=u?Lt(o,L(u)):null,a={};return c&&t.user.stickyBucketAssignmentDocs[c]&&Object.assign(a,t.user.stickyBucketAssignmentDocs[c].assignments||{}),t.user.stickyBucketAssignmentDocs[s]&&Object.assign(a,t.user.stickyBucketAssignmentDocs[s].assignments||{}),a}(t,r,i);if(s>0)for(let t=0;t<s;t++)if(void 0!==c[Pt(e,t)])return{variation:-1,versionIsBlocked:!0};const a=c[u];if(void 0===a)return{variation:-1};const l=o.findIndex((t=>t.key===a));return l<0?{variation:-1}:{variation:l}}({ctx:n,expKey:t.key,expBucketVersion:t.bucketVersion,expHashAttribute:t.hashAttribute,expFallbackAttribute:t.fallbackAttribute,expMinBucketVersion:t.minBucketVersion,expMeta:t.meta});l=e>=0,a=e,h=!!r}if(!l){if(t.filters){if(Ut(t.filters,n))return{result:jt(n,t,-1,!1,e)}}else if(t.namespace&&!function(t,e){const n=B(\"__\"+e[0],t,1);return null!==n&&n>=e[1]&&n<e[2]}(c,t.namespace))return{result:jt(n,t,-1,!1,e)};if(t.include&&!function(t){try{return t()}catch(t){return console.error(t),!1}}(t.include))return{result:jt(n,t,-1,!1,e)};if(t.condition&&!It(t.condition,n))return{result:jt(n,t,-1,!1,e)};if(t.parentConditions){const r=new Set(n.stack.evaluatedFeatures);for(const i of t.parentConditions){n.stack.evaluatedFeatures=new Set(r);const s=Ft(i.id,n);if(\"cyclicPrerequisite\"===s.source)return{result:jt(n,t,-1,!1,e)};if(!vt({value:s.value},i.condition||{}))return{result:jt(n,t,-1,!1,e)}}}if(t.groups&&!function(t,e){const n=e.global.groups||{};for(let e=0;e<t.length;e++)if(n[t[e]])return!0;return!1}(t.groups,n))return{result:jt(n,t,-1,!1,e)}}if(t.url&&!function(t,e){const n=e.user.url;if(!n)return!1;const r=n.replace(/^https?:\\/\\//,\"\").replace(/^[^/]*\\//,\"/\");return!!t.test(n)||!!t.test(r)}(t.url,n))return{result:jt(n,t,-1,!1,e)};const f=B(t.seed||r,c,t.hashVersion||1);if(null===f)return{result:jt(n,t,-1,!1,e)};if(l||(a=function(t,e){for(let n=0;n<e.length;n++)if(I(t,e[n]))return n;return-1}(f,t.ranges||function(t,e,n){(e=void 0===e?1:e)<0?e=0:e>1&&(e=1);const r=(i=t)<=0?[]:new Array(i).fill(1/i);var i;(n=n||r).length!==t&&(n=r);const s=n.reduce(((t,e)=>e+t),0);(s<.99||s>1.01)&&(n=r);let o=0;return n.map((t=>{const n=o;return o+=t,[n,n+e*t]}))}(i,void 0===t.coverage?1:t.coverage,t.weights))),h)return{result:jt(n,t,-1,!1,e,void 0,!0)};if(a<0)return{result:jt(n,t,-1,!1,e)};if(\"force\"in t)return{result:jt(n,t,void 0===t.force?-1:t.force,!1,e)};if(n.global.qaMode||n.user.qaMode)return{result:jt(n,t,-1,!1,e)};if(\"stopped\"===t.status)return{result:jt(n,t,-1,!1,e)};const d=jt(n,t,a,!0,e,f,l);if(n.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing){const{changed:e,key:r,doc:i}=function(t,e,n,r){const i=Lt(e,n),s=t.user.stickyBucketAssignmentDocs&&t.user.stickyBucketAssignmentDocs[i]&&t.user.stickyBucketAssignmentDocs[i].assignments||{},o={...s,...r};return{key:i,doc:{attributeName:e,attributeValue:n,assignments:o},changed:JSON.stringify(s)!==JSON.stringify(o)}}(n,u,L(c),{[Pt(t.key,t.bucketVersion)]:d.key});e&&(n.user.stickyBucketAssignmentDocs=n.user.stickyBucketAssignmentDocs||{},n.user.stickyBucketAssignmentDocs[r]=i,n.user.saveStickyBucketAssignmentDoc(i))}const w=Dt(n,t,d);0===w.length&&n.global.saveDeferredTrack&&n.global.saveDeferredTrack({experiment:t,result:d});const y=w.length?1===w.length?w[0]:Promise.all(w).then((()=>{})):void 0;return\"changeId\"in t&&t.changeId&&n.global.recordChangeId&&n.global.recordChangeId(t.changeId),{result:d,trackingCall:y}}function Rt(t,e,n,r,i,s,o){const u={value:n,on:!!n,off:!n,source:r,ruleId:i||\"\"};return s&&(u.experiment=s),o&&(u.experimentResult=o),\"override\"!==r&&function(t,e,n){if(t.user.trackedFeatureUsage){const r=JSON.stringify(n.value);if(t.user.trackedFeatureUsage[e]===r)return;t.user.trackedFeatureUsage[e]=r,t.user.enableDevMode&&t.user.devLogs&&t.user.devLogs.push({featureKey:e,result:n,timestamp:Date.now().toString(),logType:\"feature\"})}if(t.global.onFeatureUsage){const r=t.global.onFeatureUsage;Nt((()=>r(e,n,t.user)))}if(t.user.onFeatureUsage){const r=t.user.onFeatureUsage;Nt((()=>r(e,n)))}if(t.global.eventLogger){const r=t.global.eventLogger;Nt((()=>r(Ot,{feature:e,source:n.source,value:n.value,ruleId:\"defaultValue\"===n.source?\"$default\":n.ruleId||\"\",variationId:n.experimentResult?n.experimentResult.key:\"\"},t.user)))}}(t,e,u),u}function Bt(t){return{...t.user.attributes,...t.user.attributeOverrides}}function It(t,e){return vt(Bt(e),t,e.global.savedGroups||{})}function Ut(t,e){return t.some((t=>{const{hashValue:n}=Jt(e,t.attribute);if(!n)return!0;const r=B(t.seed,n,t.hashVersion||2);return null===r||!t.ranges.some((t=>I(r,t)))}))}function Vt(t,e,n,r,i,s,o){if(!i&&void 0===s)return!0;if(!i&&0===s)return!1;const{hashValue:u}=Jt(t,n,r);if(!u)return!1;const c=B(e,u,o||1);return null!==c&&(i?I(c,i):void 0===s||c<=s)}function jt(t,e,n,r,i,s,o){let u=!0;(n<0||n>=e.variations.length)&&(n=0,u=!1);const{hashAttribute:c,hashValue:a}=Jt(t,e.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0),l=e.meta?e.meta[n]:{},h={key:l.key||\"\"+n,featureId:i,inExperiment:u,hashUsed:r,variationId:n,value:e.variations[n],hashAttribute:c,hashValue:a,stickyBucketUsed:!!o};return l.name&&(h.name=l.name),void 0!==s&&(h.bucket=s),l.passthrough&&(h.passthrough=l.passthrough),h}function Jt(t,e,n){let r=e||\"id\",i=\"\";const s=Bt(t);return s[r]&&(i=s[r]),!i&&n&&(s[n]&&(i=s[n]),i&&(r=n)),{hashAttribute:r,hashValue:i}}function Pt(t,e){return`${t}__${e=e||0}`}function Lt(t,e){return`${t}||${e}`}function Kt(t,e){const n={},r=function(t,e){const n=new Set,r=e&&e.features?e.features:t.global.features||{},i=e&&e.experiments?e.experiments:t.global.experiments||[];return Object.keys(r).forEach((t=>{const e=r[t];if(e.rules)for(const t of e.rules)t.variations&&(n.add(t.hashAttribute||\"id\"),t.fallbackAttribute&&n.add(t.fallbackAttribute))})),i.map((t=>{n.add(t.hashAttribute||\"id\"),t.fallbackAttribute&&n.add(t.fallbackAttribute)})),Array.from(n)}(t,e);return r.forEach((e=>{const{hashValue:r}=Jt(t,e);n[e]=L(r)})),n}function Ht(t,e){return e.hashAttribute+e.hashValue+t.key+e.variationId}const qt=\"undefined\"!=typeof window&&\"undefined\"!=typeof document,Gt=H();class zt{constructor(t){this.prefix=(t=t||{}).prefix||\"\"}async getAllAssignments(t){const e={};return(await Promise.all(Object.entries(t).map((([t,e])=>this.getAssignments(t,e))))).forEach((t=>{if(t){const n=Lt(t.attributeName,t.attributeValue);e[n]=t}})),e}getKey(t,e){return`${this.prefix}${t}||${e}`}}class Zt extends zt{async getAssignments(t,e){return this.getAssignmentsSync(t,e)}async saveAssignments(t){this.saveAssignmentsSync(t)}getAllAssignmentsSync(t){const e={};return Object.entries(t).map((([t,e])=>this.getAssignmentsSync(t,e))).forEach((t=>{if(t){const n=Lt(t.attributeName,t.attributeValue);e[n]=t}})),e}}function Qt(t){return{browser:t.match(/Edg/)?\"edge\":t.match(/Chrome/)?\"chrome\":t.match(/Firefox/)?\"firefox\":t.match(/Safari/)?\"safari\":\"unknown\",deviceType:t.match(/Mobi/)?\"mobile\":\"desktop\"}}function Wt(t){return t?{url:t.href,path:t.pathname,host:t.host,query:t.search}:{}}function Xt(t){let e={};try{const t=sessionStorage.getItem(\"utm_params\");t&&(e=JSON.parse(t))}catch(t){}if(t&&t.search){const n=new URLSearchParams(t.search);let r=!1;if([\"source\",\"medium\",\"campaign\",\"term\",\"content\"].forEach((t=>{const i=`utm_${t}`,s=\"utm\"+t[0].toUpperCase()+t.slice(1);n.has(i)&&(e[s]=n.get(i)||\"\",r=!0)})),r)try{sessionStorage.setItem(\"utm_params\",JSON.stringify(e))}catch(t){}}return e}function Yt(){if(\"undefined\"==typeof window||!window.dataLayer||!window.dataLayer.forEach)return{};const t={};return window.dataLayer.forEach((e=>{e&&\"object\"==typeof e&&!(\"length\"in e)&&(\"event\"in e||Object.keys(e).forEach((n=>{if(\"string\"!=typeof n||n.match(/^(gtm)/))return;const r=e[n];[\"string\",\"number\",\"boolean\"].includes(typeof r)&&(t[n]=r)})))})),t}const te=H();function ee(t){return\"string\"==typeof t?t:null}window.dataLayer=window.dataLayer||[];const ne=document.currentScript,re=ne?ne.dataset:{},ie=window.growthbook_config||{};let se,oe;function ue(){window.clearTimeout(se);let t=ie.antiFlickerTimeout??(re.antiFlickerTimeout?parseInt(re.antiFlickerTimeout):null)??3500;isFinite(t)||(t=3500);try{if(!document.getElementById(\"gb-anti-flicker-style\")){const t=document.createElement(\"style\");t.setAttribute(\"id\",\"gb-anti-flicker-style\"),t.innerHTML=\".gb-anti-flicker { opacity: 0 !important; pointer-events: none; }\",document.head.appendChild(t)}document.documentElement.classList.add(\"gb-anti-flicker\"),se=window.setTimeout(ce,t)}catch(t){console.error(t)}}function ce(){window.clearTimeout(se);try{document.documentElement.classList.remove(\"gb-anti-flicker\")}catch(t){console.error(t)}}(ie.antiFlicker||re.antiFlicker)&&ue(),\"cookie\"===ie.useStickyBucketService||\"cookie\"===re.useStickyBucketService?oe=new class extends Zt{constructor({prefix:t=\"gbStickyBuckets__\",jsCookie:e,cookieAttributes:n={expires:180}}){super(),this.prefix=t,this.jsCookie=e,this.cookieAttributes=n}getAssignmentsSync(t,e){const n=this.getKey(t,e);let r=null;if(!this.jsCookie)return r;try{const t=this.jsCookie.get(n),e=JSON.parse(t||\"{}\");e.attributeName&&e.attributeValue&&e.assignments&&(r=e)}catch(t){}return r}async saveAssignmentsSync(t){const e=this.getKey(t.attributeName,t.attributeValue);if(!this.jsCookie)return;const n=JSON.stringify(t);this.jsCookie.set(e,n,this.cookieAttributes)}}({prefix:ie.stickyBucketPrefix||re.stickyBucketPrefix||void 0,jsCookie:e}):\"localStorage\"!==ie.useStickyBucketService&&\"localStorage\"!==re.useStickyBucketService||(oe=new class extends zt{constructor(t){t=t||{},super(),this.prefix=t.prefix||\"gbStickyBuckets__\";try{this.localStorage=t.localStorage||globalThis.localStorage}catch(t){}}async getAssignments(t,e){const n=this.getKey(t,e);let r=null;if(!this.localStorage)return r;try{const t=await this.localStorage.getItem(n)||\"{}\",e=JSON.parse(t);e.attributeName&&e.attributeValue&&e.assignments&&(r=e)}catch(t){}return r}async saveAssignments(t){const e=this.getKey(t.attributeName,t.attributeValue);if(this.localStorage)try{await this.localStorage.setItem(e,JSON.stringify(t))}catch(t){}}}({prefix:ie.stickyBucketPrefix||re.stickyBucketPrefix||void 0}));const ae=re.uuid||ie.uuid,le=[function(t={}){if(\"undefined\"==typeof window)throw new Error(\"autoAttributesPlugin only works in the browser\");const e=t.uuidCookieName||\"gbuuid\",n=t.uuidKey||\"id\";let r=t.uuid||\"\";function i(){!function(t,e){const n=new Date;n.setTime(n.getTime()+3456e7),document.cookie=t+\"=\"+e+\";path=/;expires=\"+n.toUTCString()}(e,r)}function s(t){const s=navigator.userAgent,o=r||(r=function(t){const e=(\"; \"+document.cookie).split(`; ${t}=`);return 2===e.length?e[1].split(\";\")[0]:\"\"}(e),r||(u=window.crypto,r=u&&u.randomUUID?u.randomUUID():\"10000000-1000-4000-8000-100000000000\".replace(/[018]/g,(t=>(t^(u&&u.getRandomValues?u.getRandomValues(new Uint8Array(1))[0]:Math.floor(256*Math.random()))&15>>t/4).toString(16))),r));var u;(t.uuidAutoPersist??!t.uuid)&&i();const c=location;return{...Yt(),[n]:o,...Wt(c),pageTitle:document.title,...Qt(s),...Xt(c)}}return document.addEventListener(\"growthbookpersist\",(()=>{i()})),e=>{if(\"createScopedInstance\"in e)return;const n=s(t);n.url&&e.setURL(n.url),e.updateAttributes(n);let r=n.url;const i=setInterval((()=>{location.href!==r&&(r=location.href,e.setURL(r),e.updateAttributes(s(t)))}),500),o=()=>{location.href!==r&&(r=location.href,e.setURL(r)),e.updateAttributes(s(t))};document.addEventListener(\"growthbookrefresh\",o),\"onDestroy\"in e&&e.onDestroy((()=>{clearInterval(i),document.removeEventListener(\"growthbookrefresh\",o)}))}}({uuid:ae,uuidCookieName:ie.uuidCookieName||re.uuidCookieName,uuidKey:ie.uuidKey||re.uuidKey,uuidAutoPersist:!ae&&null==re.noAutoCookies})],he=re.tracking||\"gtag,gtm,segment\";if(\"none\"!==he){const t=he.toLowerCase().split(\",\").map((t=>t.trim()));t.includes(\"growthbook\")&&le.push(function({queueFlushInterval:t=100,ingestorHost:e,enable:n=!0,debug:r,dedupeCacheSize:i=1e3,dedupeKeyAttributes:s=[],eventFilter:o}={}){return u=>{const c=u.getClientKey();if(!c)throw new Error(\"clientKey must be specified to use event logging\");const a=new Set;if(\"setEventLogger\"in u){let l=[],h=null;const f=async()=>{const t=l;l=[],h&&clearTimeout(h),h=null,t.length&&await async function({clientKey:t,ingestorHost:e,events:n}){if(!n.length)return;const r=`${e||\"https://us1.gb-ingest.com\"}/track?client_key=${t}`,i=JSON.stringify(n);try{await fetch(r,{method:\"POST\",body:i,headers:{Accept:\"application/json\",\"Content-Type\":\"text/plain\"},credentials:\"omit\"})}catch(t){console.error(\"Failed to track event\",t)}}({clientKey:c,events:t,ingestorHost:e})};let d=null;u.setEventLogger((async(e,u,c)=>{const w={eventName:e,properties:u,attributes:c.attributes||{},url:c.url||\"\"};if(o&&!o(w))return;if(e===Ot||e===Tt){const t={eventName:e,properties:u};for(const e of s)t[\"attr:\"+e]=w.attributes[e];const n=JSON.stringify(t);if(a.has(n))return a.delete(n),void a.add(n);if(a.add(n),a.size>i){const t=a.values().next().value;t&&a.delete(t)}}const y=function({eventName:t,properties:e,attributes:n,url:r}){const{nested:i,topLevel:s}=function(t){const{user_id:e,device_id:n,anonymous_id:r,id:i,page_id:s,session_id:o,utmCampaign:u,utmContent:c,utmMedium:a,utmSource:l,utmTerm:h,pageTitle:f,...d}=t;return{nested:d,topLevel:{user_id:ee(e),device_id:ee(n||r||i),page_id:ee(s),session_id:ee(o),utm_campaign:ee(u)||void 0,utm_content:ee(c)||void 0,utm_medium:ee(a)||void 0,utm_source:ee(l)||void 0,utm_term:ee(h)||void 0,page_title:ee(f)||void 0}}}(n||{});return{event_name:t,properties_json:e||{},...s,sdk_language:\"js\",sdk_version:te,url:r,context_json:i}}(w);r&&console.log(\"Logging event to GrowthBook\",JSON.parse(JSON.stringify(y))),n&&(l.push(y),d||(d=new Promise(((e,n)=>{h=setTimeout((()=>{f().then(e).catch(n),d=null}),t)}))),await d)})),\"undefined\"!=typeof document&&document.visibilityState&&document.addEventListener(\"visibilitychange\",(()=>{\"hidden\"===document.visibilityState&&f().catch(console.error)})),\"onDestroy\"in u&&u.onDestroy((()=>{f().catch(console.error)}))}if(\"undefined\"!=typeof window&&!(\"createScopedInstance\"in u)){const t=Array.isArray(window.gbEvents)?window.gbEvents:[];window.gbEvents={push:t=>{\"isDestroyed\"in u&&u.isDestroyed()?window.gbEvents=[t]:\"string\"==typeof t?u.logEvent(t):t&&u.logEvent(t.eventName,t.properties)}};for(const e of t)window.gbEvents.push(e)}}}({ingestorHost:re.eventIngestorHost})),ie.trackingCallback||le.push(function({additionalCallback:t,trackers:e=[\"gtag\",\"gtm\",\"segment\"]}={}){if(\"undefined\"==typeof window)throw new Error(\"thirdPartyTrackingPlugin only works in the browser\");return n=>{n.setTrackingCallback((async(n,r)=>{const i=[],s={experiment_id:n.key,variation_id:r.key};if(t&&i.push(Promise.resolve(t(n,r))),e.includes(\"gtag\")&&window.gtag){let t;const e=new Promise((e=>{t=e}));i.push(e),window.gtag(\"event\",\"experiment_viewed\",{...s,event_callback:t})}if(e.includes(\"gtm\")&&window.dataLayer){let t;const e=new Promise((e=>{t=e}));i.push(e),window.dataLayer.push({event:\"experiment_viewed\",...s,eventCallback:t})}if(e.includes(\"segment\")&&window.analytics&&window.analytics.track){window.analytics.track(\"Experiment Viewed\",s);const t=new Promise((t=>window.setTimeout(t,300)));i.push(t)}await Promise.all(i)}))}}({additionalCallback:ie.additionalTrackingCallback,trackers:t}))}const fe=new class{constructor(t){if(t=t||{},this.version=Gt,this.i=this.context=t,this.o=t.renderer||null,this.u=new Set,this.l=new Set,this.h={},this.debug=!!t.debug,this.p=new Set,this.ready=!1,this.g=new Map,this.m=new Map,this.v=new Set,this.k=!1,this.S=\"\",this.A=new Map,this._=!t.disableExperimentsOnLoad,this.$=[],this.logs=[],this.log=this.log.bind(this),this.C=this.C.bind(this),this.O=this.O.bind(this),this.T=this.T.bind(this),this.N=this.N.bind(this),t.remoteEval){if(t.decryptionKey)throw new Error(\"Encryption is not available for remoteEval\");if(!t.clientKey)throw new Error(\"Missing clientKey\");let e=!1;try{e=!!new URL(t.apiHost||\"\").hostname.match(/growthbook\\.io$/i)}catch(t){}if(e)throw new Error(\"Cannot use remoteEval on GrowthBook Cloud\")}else if(t.cacheKeyAttributes)throw new Error(\"cacheKeyAttributes are only used for remoteEval\");if(t.stickyBucketService){const e=t.stickyBucketService;this.D=t=>e.saveAssignments(t)}if(t.plugins)for(const e of t.plugins)e(this);if(t.features&&(this.ready=!0),qt&&t.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event(\"gbloaded\"))),t.experiments&&(this.ready=!0,this.F()),this.i.stickyBucketService&&this.i.stickyBucketAssignmentDocs)for(const t in this.i.stickyBucketAssignmentDocs){const e=this.i.stickyBucketAssignmentDocs[t];e&&this.i.stickyBucketService.saveAssignments(e).catch((()=>{}))}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(t){this.M=t;const e=await async function(t,e,n){if((t={...t}).encryptedFeatures){try{t.features=JSON.parse(await P(t.encryptedFeatures,e,n))}catch(t){console.error(t)}delete t.encryptedFeatures}if(t.encryptedExperiments){try{t.experiments=JSON.parse(await P(t.encryptedExperiments,e,n))}catch(t){console.error(t)}delete t.encryptedExperiments}if(t.encryptedSavedGroups){try{t.savedGroups=JSON.parse(await P(t.encryptedSavedGroups,e,n))}catch(t){console.error(t)}delete t.encryptedSavedGroups}return t}(t,this.i.decryptionKey);this.R=e,await this.refreshStickyBuckets(e),e.features&&(this.i.features=e.features),e.savedGroups&&(this.i.savedGroups=e.savedGroups),e.experiments&&(this.i.experiments=e.experiments,this.F()),this.ready=!0,this.B()}initSync(t){this.k=!0;const e=t.payload;if(e.encryptedExperiments||e.encryptedFeatures)throw new Error(\"initSync does not support encrypted payloads\");return this.i.stickyBucketService&&!this.i.stickyBucketAssignmentDocs&&(this.i.stickyBucketAssignmentDocs=this.generateStickyBucketAssignmentDocsSync(this.i.stickyBucketService,e)),this.M=e,this.R=e,e.features&&(this.i.features=e.features),e.experiments&&(this.i.experiments=e.experiments,this.F()),this.ready=!0,gt(this,t),this}async init(t){if(this.k=!0,(t=t||{}).cacheSettings&&(Object.assign(Z,t.cacheSettings),Z.backgroundSync||pt()),t.payload)return await this.setPayload(t.payload),gt(this,t),{success:!0,source:\"init\"};{const{data:e,...n}=await this.I({...t,allowStale:!0});return gt(this,t),await this.setPayload(e||{}),n}}async loadFeatures(t){t=t||{},await this.init({skipCache:t.skipCache,timeout:t.timeout,streaming:(this.i.backgroundSync??!0)&&(t.autoRefresh||this.i.subscribeToChanges)})}async refreshFeatures(t){const e=await this.I({...t||{},allowStale:!1});e.data&&await this.setPayload(e.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return function(t){const e=t.apiHost||\"https://cdn.growthbook.io\";return{apiHost:e.replace(/\\/*$/,\"\"),streamingHost:(t.streamingHost||e).replace(/\\/*$/,\"\"),apiRequestHeaders:t.apiHostRequestHeaders,streamingHostRequestHeaders:t.streamingHostRequestHeaders}}(this.i)}getClientKey(){return this.i.clientKey||\"\"}getPayload(){return this.M||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this.R||this.getPayload()}isRemoteEval(){return this.i.remoteEval||!1}getCacheKeyAttributes(){return this.i.cacheKeyAttributes}async I({timeout:t,skipCache:e,allowStale:n,streaming:r}){if(!this.i.clientKey)throw new Error(\"Missing clientKey\");return async function({instance:t,timeout:e,skipCache:n,allowStale:r,backgroundSync:i}){return i||(Z.backgroundSync=!1),async function({instance:t,allowStale:e,timeout:n,skipCache:r}){const i=ot(t),s=ut(t),o=new Date,u=new Date(o.getTime()-Z.maxAge+Z.staleTTL);await async function(){if(!Y){Y=!0;try{if(Q.localStorage){const t=await Q.localStorage.getItem(Z.cacheKey);if(!Z.disableCache&&t){const e=JSON.parse(t);e&&Array.isArray(e)&&e.forEach((([t,e])=>{tt.set(t,{...e,staleAt:new Date(e.staleAt)})})),ct()}}}catch(t){}if(!Z.disableIdleStreams){const t=W.startIdleListener();t&&(W.stopIdleListener=t)}}}();const c=Z.disableCache||r?void 0:tt.get(s);return c&&(e||c.staleAt>o)&&c.staleAt>u?(c.sse&&rt.add(i),c.staleAt<o?lt(t):ht(t),{data:c.data,success:!0,source:\"cache\"}):await z(lt(t),n)||{data:null,success:!1,source:\"timeout\",error:new Error(\"Timeout\")}}({instance:t,allowStale:r,timeout:e,skipCache:n})}({instance:this,timeout:t,skipCache:e||this.i.disableCache,allowStale:n,backgroundSync:r??this.i.backgroundSync??!0})}B(){if(this.o)try{this.o()}catch(t){console.error(\"Failed to render\",t)}}setFeatures(t){this.i.features=t,this.ready=!0,this.B()}async setEncryptedFeatures(t,e,n){const r=await P(t,e||this.i.decryptionKey,n);this.setFeatures(JSON.parse(r))}setExperiments(t){this.i.experiments=t,this.ready=!0,this.F()}async setEncryptedExperiments(t,e,n){const r=await P(t,e||this.i.decryptionKey,n);this.setExperiments(JSON.parse(r))}async setAttributes(t){this.i.attributes=t,this.i.stickyBucketService&&await this.refreshStickyBuckets(),this.i.remoteEval?await this.U():(this.B(),this.F())}async updateAttributes(t){return this.setAttributes({...this.i.attributes,...t})}async setAttributeOverrides(t){this.i.attributeOverrides=t,this.i.stickyBucketService&&await this.refreshStickyBuckets(),this.i.remoteEval?await this.U():(this.B(),this.F())}async setForcedVariations(t){this.i.forcedVariations=t||{},this.i.remoteEval?await this.U():(this.B(),this.F())}setForcedFeatures(t){this.i.forcedFeatureValues=t,this.B()}async setURL(t){if(t!==this.i.url){if(this.i.url=t,this.S=\"\",this.i.remoteEval)return await this.U(),void this.F(!0);this.F(!0)}}getAttributes(){return{...this.i.attributes,...this.i.attributeOverrides}}getForcedVariations(){return this.i.forcedVariations||{}}getForcedFeatures(){return this.i.forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this.i.stickyBucketAssignmentDocs||{}}getUrl(){return this.i.url||\"\"}getFeatures(){return this.i.features||{}}getExperiments(){return this.i.experiments||[]}getCompletedChangeIds(){return Array.from(this.l)}subscribe(t){return this.p.add(t),()=>{this.p.delete(t)}}async U(){if(!this.i.remoteEval)return;if(!this.k)return;const t=await this.I({allowStale:!1});t.data&&await this.setPayload(t.data)}getAllResults(){return new Map(this.g)}onDestroy(t){this.$.push(t)}isDestroyed(){return!!this.V}destroy(t){var e;t=t||{},this.V=!0,this.$.forEach((t=>{try{t()}catch(t){console.error(t)}})),this.p.clear(),this.g.clear(),this.u.clear(),this.l.clear(),this.A.clear(),this.h={},this.$=[],this.M=void 0,this.D=void 0,e=this,X.forEach((t=>t.delete(e))),t.destroyAllStreams&&pt(),this.logs=[],qt&&window._growthbook===this&&delete window._growthbook,this.m.forEach((t=>{t.undo()})),this.m.clear(),this.v.clear()}setRenderer(t){this.o=t}forceVariation(t,e){this.i.forcedVariations=this.i.forcedVariations||{},this.i.forcedVariations[t]=e,this.i.remoteEval?this.U():(this.F(),this.B())}run(t){const{result:e}=Mt(t,null,this.j());return this.O(t,e),e}triggerExperiment(t){return this.v.add(t),this.i.experiments?this.i.experiments.filter((e=>e.key===t)).map((t=>this.J(t))).filter((t=>null!==t)):null}triggerAutoExperiments(){this._=!0,this.F(!0)}j(){return{user:this.P(),global:this.L(),stack:{evaluatedFeatures:new Set}}}P(){return{attributes:this.i.user?{...this.i.user,...this.i.attributes}:this.i.attributes,enableDevMode:this.i.enableDevMode,blockedChangeIds:this.i.blockedChangeIds,stickyBucketAssignmentDocs:this.i.stickyBucketAssignmentDocs,url:this.K(),forcedVariations:this.i.forcedVariations,forcedFeatureValues:this.i.forcedFeatureValues,attributeOverrides:this.i.attributeOverrides,saveStickyBucketAssignmentDoc:this.D,trackingCallback:this.i.trackingCallback,onFeatureUsage:this.i.onFeatureUsage,devLogs:this.logs,trackedExperiments:this.u,trackedFeatureUsage:this.h}}L(){return{features:this.i.features,experiments:this.i.experiments,log:this.log,enabled:this.i.enabled,qaMode:this.i.qaMode,savedGroups:this.i.savedGroups,groups:this.i.groups,overrides:this.i.overrides,onExperimentEval:this.O,recordChangeId:this.N,saveDeferredTrack:this.C,eventLogger:this.i.eventLogger}}J(t,e){const n=this.m.get(t);if(t.manual&&!this.v.has(t.key)&&!n)return null;let r,i;this.H(t)?r=jt(this.j(),t,-1,!1,\"\"):(({result:r,trackingCall:i}=Mt(t,null,this.j())),this.O(t,r));const s=JSON.stringify(r.value);if(!e&&r.inExperiment&&n&&n.valueHash===s)return r;if(n&&this.q(t),r.inExperiment){const e=G(t);if(\"redirect\"===e&&r.value.urlRedirect&&t.urlPatterns){const e=t.persistQueryString?function(t,e){let n,r;try{n=new URL(t),r=new URL(e)}catch(t){return console.error(`Unable to merge query strings: ${t}`),e}return n.searchParams.forEach(((t,e)=>{r.searchParams.has(e)||r.searchParams.set(e,t)})),r.toString()}(this.K(),r.value.urlRedirect):r.value.urlRedirect;if(V(e,t.urlPatterns))return this.log(\"Skipping redirect because original URL matches redirect URL\",{id:t.key}),r;this.S=e;const{navigate:n,delay:s}=this.G();if(n)if(qt)Promise.all([...i?[z(i,this.i.maxNavigateDelay??1e3)]:[],new Promise((t=>window.setTimeout(t,this.i.navigateDelay??s)))]).then((()=>{try{n(e)}catch(t){console.error(t)}}));else try{n(e)}catch(t){console.error(t)}}else if(\"visual\"===e){const e=this.i.applyDomChangesCallback?this.i.applyDomChangesCallback(r.value):this.Z(r.value);e&&this.m.set(t,{undo:e,valueHash:s})}}return r}q(t){const e=this.m.get(t);e&&(e.undo(),this.m.delete(t))}F(t){if(!this._)return;const e=this.i.experiments||[],n=new Set(e);this.m.forEach(((t,e)=>{n.has(e)||(t.undo(),this.m.delete(e))}));for(const n of e){const e=this.J(n,t);if(e&&e.inExperiment&&\"redirect\"===G(n))break}}O(t,e){const n=this.g.get(t.key);this.g.set(t.key,{experiment:t,result:e}),this.p.size>0&&this.T(t,e,n)}T(t,e,n){n&&n.result.inExperiment===e.inExperiment&&n.result.variationId===e.variationId||this.p.forEach((n=>{try{n(t,e)}catch(t){console.error(t)}}))}N(t){this.l.add(t)}isOn(t){return this.evalFeature(t).on}isOff(t){return this.evalFeature(t).off}getFeatureValue(t,e){const n=this.evalFeature(t).value;return null===n?e:n}feature(t){return this.evalFeature(t)}evalFeature(t){return Ft(t,this.j())}log(t,e){this.debug&&(this.i.log?this.i.log(t,e):console.log(t,e))}getDeferredTrackingCalls(){return Array.from(this.A.values())}setDeferredTrackingCalls(t){this.A=new Map(t.filter((t=>t&&t.experiment&&t.result)).map((t=>[Ht(t.experiment,t.result),t])))}async fireDeferredTrackingCalls(){if(!this.i.trackingCallback)return;const t=[];this.A.forEach((e=>{e&&e.experiment&&e.result?t.push(this.i.trackingCallback(e.experiment,e.result)):console.error(\"Invalid deferred tracking call\",{call:e})})),this.A.clear(),await Promise.all(t)}setTrackingCallback(t){this.i.trackingCallback=t,this.fireDeferredTrackingCalls()}setEventLogger(t){this.i.eventLogger=t}async logEvent(t,e){if(this.V)console.error(\"Cannot log event to destroyed GrowthBook instance\");else if(this.i.enableDevMode&&this.logs.push({eventName:t,properties:e,timestamp:Date.now().toString(),logType:\"event\"}),this.i.eventLogger)try{await this.i.eventLogger(t,e||{},this.P())}catch(t){console.error(t)}else console.error(\"No event logger configured\")}C(t){this.A.set(Ht(t.experiment,t.result),t)}K(){return this.i.url||(qt?window.location.href:\"\")}H(t){const e=G(t);if(\"visual\"===e){if(this.i.disableVisualExperiments)return!0;if(this.i.disableJsInjection&&t.variations.some((t=>t.js)))return!0}else{if(\"redirect\"!==e)return!0;if(this.i.disableUrlRedirectExperiments)return!0;try{const e=new URL(this.K());for(const n of t.variations){if(!n||!n.urlRedirect)continue;const t=new URL(n.urlRedirect);if(this.i.disableCrossOriginUrlRedirectExperiments){if(t.protocol!==e.protocol)return!0;if(t.host!==e.host)return!0}}}catch(e){return this.log(\"Error parsing current or redirect URL\",{id:t.key,error:e}),!0}}return!(!t.changeId||!(this.i.blockedChangeIds||[]).includes(t.changeId))}getRedirectUrl(){return this.S}G(){return this.i.navigate?{navigate:this.i.navigate,delay:0}:qt?{navigate:t=>{window.location.replace(t)},delay:100}:{navigate:null,delay:0}}Z(t){if(!qt)return;const e=[];if(t.css){const n=document.createElement(\"style\");n.innerHTML=t.css,document.head.appendChild(n),e.push((()=>n.remove()))}if(t.js){const n=document.createElement(\"script\");n.innerHTML=t.js,this.i.jsInjectionNonce&&(n.nonce=this.i.jsInjectionNonce),document.head.appendChild(n),e.push((()=>n.remove()))}return t.domMutations&&t.domMutations.forEach((t=>{e.push(function(t){var e=t.selector,n=t.action,i=t.value,s=t.attribute,o=t.parentSelector,u=t.insertBeforeSelector;if(\"html\"===s){if(\"append\"===n)return N(e,(function(t){return t+(null!=i?i:\"\")}));if(\"set\"===n)return N(e,(function(){return null!=i?i:\"\"}))}else if(\"class\"===s){if(\"append\"===n)return D(e,(function(t){i&&t.add(i)}));if(\"remove\"===n)return D(e,(function(t){i&&t.delete(i)}));if(\"set\"===n)return D(e,(function(t){t.clear(),i&&t.add(i)}))}else if(\"position\"===s){if(\"set\"===n&&o)return function(t,e){return T({kind:\"position\",elements:new Set,mutate:function(){return{insertBeforeSelector:u,parentSelector:o}},selector:t})}(e)}else{if(\"append\"===n)return F(e,s,(function(t){return null!==t?t+(null!=i?i:\"\"):null!=i?i:\"\"}));if(\"set\"===n)return F(e,s,(function(){return null!=i?i:\"\"}));if(\"remove\"===n)return F(e,s,(function(){return null}))}return r}(t).revert)})),()=>{e.forEach((t=>t()))}}async refreshStickyBuckets(t){if(this.i.stickyBucketService){const e=this.j(),n=await async function(t,e,n){const r=Kt(t,n);return e.getAllAssignments(r)}(e,this.i.stickyBucketService,t);this.i.stickyBucketAssignmentDocs=n}}generateStickyBucketAssignmentDocsSync(t,e){if(!(\"getAllAssignmentsSync\"in t))return void console.error(\"generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync\");const n=Kt(this.j(),e);return t.getAllAssignmentsSync(n)}inDevMode(){return!!this.i.enableDevMode}}({enableDevMode:!0,...re,remoteEval:!!re.remoteEval,...ie,plugins:le,stickyBucketService:oe});fe.setRenderer((()=>{document.dispatchEvent(new CustomEvent(\"growthbookdata\"))})),fe.init({payload:ie.payload,streaming:!(ie.noStreaming||re.noStreaming||!1===ie.backgroundSync),cacheSettings:ie.cacheSettings}).then((()=>{(ie.antiFlicker||re.antiFlicker)&&(fe.getRedirectUrl()?ue():ce())}));const de=t=>{try{t&&t(fe)}catch(t){console.error(\"Uncaught growthbook_queue error\",t)}};return window.growthbook_queue&&Array.isArray(window.growthbook_queue)&&window.growthbook_queue.forEach((t=>{de(t)})),window.growthbook_queue={push:t=>{de(t)}},fe}();\n//# sourceMappingURL=auto.min.js.map\n";
|