1import{r as Y}from"./redux-DOY1rMCd.js";const it={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function Vt(){return it}function me(e){let t=2166136261;const r=e.length;for(let n=0;n<r;n++)t^=e.charCodeAt(n),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return t>>>0}function le(e,t,r){return r===2?me(me(e+t)+"")%1e4/1e4:r===1?me(t+e)%1e3/1e3:null}function Tt(e){return e<=0?[]:new Array(e).fill(1/e)}function Re(e,t){return e>=t[0]&&e<t[1]}function Bt(e,t){const r=le("__"+t[0],e,1);return r===null?!1:r>=t[1]&&r<t[2]}function Lt(e,t){for(let r=0;r<t.length;r++)if(Re(e,t[r]))return r;return-1}function ot(e){try{const t=e.replace(/([^\\])\//g,"$1\\/");return new RegExp(t)}catch(t){console.error(t);return}}function at(e,t){if(!t.length)return!1;let r=!1,n=!1;for(let s=0;s<t.length;s++){const i=Ft(e,t[s].type,t[s].pattern);if(t[s].include===!1){if(i)return!1}else r=!0,i&&(n=!0)}return n||!r}function Pt(e,t,r){try{let n=t.replace(/[*.+?^${}()|[\]\\]/g,"\\$&").replace(/_____/g,".*");return r&&(n="\\/?"+n.replace(/(^\/|\/$)/g,"")+"\\/?"),new RegExp("^"+n+"$","i").test(e)}catch{return!1}}function Rt(e,t){try{const r=new URL(t.replace(/^([^:/?]*)\./i,"https://$1.").replace(/\*/g,"_____"),"https://_____"),n=[[e.host,r.host,!1],[e.pathname,r.pathname,!0]];return r.hash&&n.push([e.hash,r.hash,!1]),r.searchParams.forEach((s,i)=>{n.push([e.searchParams.get(i)||"",s,!1])}),!n.some(s=>!Pt(s[0],s[1],s[2]))}catch{return!1}}function Ft(e,t,r){try{const n=new URL(e,"https://_");if(t==="regex"){const s=ot(r);return s?s.test(n.href)||s.test(n.href.substring(n.origin.length)):!1}else if(t==="simple")return Rt(n,r);return!1}catch{return!1}}function Ut(e,t,r){t=t===void 0?1:t,t<0?t=0:t>1&&(t=1);const n=Tt(e);r=r||n,r.length!==e&&(r=n);const s=r.reduce((o,l)=>l+o,0);(s<.99||s>1.01)&&(r=n);let i=0;return r.map(o=>{const l=i;return i+=o,[l,l+t*o]})}function It(e,t,r){if(!t)return null;const n=t.split("?")[1];if(!n)return null;const s=n.replace(/#.*/,"").split("&").map(i=>i.split("=",2)).filter(([i])=>i===e).map(([,i])=>parseInt(i));return s.length>0&&s[0]>=0&&s[0]<r?s[0]:null}function Nt(e){try{return e()}catch(t){return console.error(t),!1}}const _e=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0));async function W(e,t,r){if(t=t||"",r=r||globalThis.crypto&&globalThis.crypto.subtle||it.SubtleCrypto,!r)throw new Error("No SubtleCrypto implementation found");try{const n=await r.importKey("raw",_e(t),{name:"AES-CBC",length:128},!0,["encrypt","decrypt"]),[s,i]=e.split("."),o=await r.decrypt({
1name:"AES-CBC",iv:_e(s)},n,_e(i));return new TextDecoder().decode(o)}catch{throw new Error("Failed to decrypt")}}function ae(e){return typeof e=="string"?e:JSON.stringify(e)}function S(e){typeof e=="number"&&(e=e+""),(!e||typeof e!="string")&&(e="0");const t=e.replace(/(^v|\+.*$)/g,"").split(/[-.]/);return t.length===3&&t.push("~"),t.map(r=>r.match(/^[0-9]+$/)?r.padStart(5," "):r).join("-")}function jt(){let e;try{e="1.6.5"}catch{e=""}return e}function Kt(e,t){let r,n;try{r=new URL(e),n=new URL(t)}catch(s){return console.error(`Unable to merge query strings: ${s}`),t}return r.searchParams.forEach((s,i)=>{n.searchParams.has(i)||n.searchParams.set(i,s)}),n.toString()}function qe(e){return typeof e=="object"&&e!==null}function ke(e){return e.urlPatterns&&e.variations.some(t=>qe(t)&&"urlRedirect"in t)?"redirect":e.variations.some(t=>qe(t)&&(t.domMutations||"js"in t||"css"in t))?"visual":"unknown"}async function ut(e,t){return new Promise(r=>{let n=!1,s;const i=o=>{n||(n=!0,s&&clearTimeout(s),r(o||null))};t&&(s=setTimeout(()=>i(),t)),e.then(o=>i(o)).catch(()=>i())})}const k={staleTTL:1e3*60,maxAge:1e3*60*60*4,cacheKey:"gbFeaturesCache",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},D=Vt(),$={fetchFeaturesCall:({host:e,clientKey:t,headers:r})=>D.fetch(`${e}/api/features/${t}`,{headers:r}),fetchRemoteEvalCall:({host:e,clientKey:t,payload:r,headers:n})=>{const s={method:"POST",headers:{"Content-Type":"application/json",...n},body:JSON.stringify(r)};return D.fetch(`${e}/api/eval/${t}`,s)},eventSourceCall:({host:e,clientKey:t,headers:r})=>r?new D.EventSource(`${e}/sub/${t}`,{headers:r}):new D.EventSource(`${e}/sub/${t}`),startIdleListener:()=>{let e;if(!(typeof window<"u"&&typeof document<"u"))return;const r=()=>{document.visibilityState==="visible"?(window.clearTimeout(e),Jt()):document.visibilityState==="hidden"&&(e=window.setTimeout(Gt,k.idleStreamInterval))};return document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)},stopIdleListener:()=>{}};try{globalThis.localStorage&&(D.localStorage=globalThis.localStorage)}catch{}const q=new Map;let Ge=!1;const T=new Map,ne=new Map,G=new Map,J=new Set;function Mt(e){Object.assign(k,e),k.backgroundSync||ht()}async function Ht({instance:e,timeout:t,skipCache:r,allowStale:n,backgroundSync:s}){return s||(k.backgroundSync=!1),zt({instance:e,allowStale:n,timeout:t,skipCache:r})}function $t(e){const t=ee(e),r=q.get(t)||new Set;r.add(e),q.set(t,r)}function qt(e){q.forEach(t=>t.delete(e))}function Gt(){G.forEach(e=>{e&&(e.state="idle",Ie(e))})}function Jt(){G.forEach(e=>{e&&e.state==="idle"&&Ne(e)})}async function Je(){try{if(!D.localStorage)return;await D.localStorage.setItem(k.cacheKey,JSON.stringify(Array.from(T.entries())))}catch{}}async function zt({instance:e,allowStale:t,timeout:r,skipCache:n}){const s=ee(e),i=Fe(e),o=new Date,l=new Date(o.getTime()-k.maxAge+k.staleTTL);await Yt();const h=!k.disableCache&&!n?T.get(i):void 0;return h&&(t||h.staleAt>o)&&h.staleAt>l?(h.sse&&J.add(s),h.staleAt<o?Ce(e):Ue(e),{data:h.data,success:!0,source:"cache"}):await ut(Ce(e),r)||{data:null,success:!1,source:"timeout",error:new Error("Timeout")}}function ee(e){const[t,r]=e.getApiInfo();return`${t}||${r}`}function Fe(e){const t=ee(e);if(!("isRemoteEval"in e)||!e.isRemoteEval())return t;const r=e.getAttributes(),n=e.getCacheKeyAttributes()||Object.keys(e.getAttributes()),s={};n.forEach(l=>{s[l]=r[l]});const i=e.getForcedVariations(),o=e.getUrl();return`${t}||${JSON.stringify({ca:s,fv:i,url:o})}`}async function Yt(){if(!Ge){Ge=!0;try{if(D.localStorage){const e=await D.localStorage.getItem(k.cacheKey);if(!k.disableCache&&e){const t=JSON.parse(e);t&&Array.isArray(t)&&t.forEach(([r,n])=>{T.set(r,{...n,staleAt:new Date(n.staleAt)})}),lt()}}}catch{}if(!k.disableIdleStreams){const e=$.startIdleListener();e&&($.stopIdleListener=e)}}}function lt(){const e=Array.from(T.entries()).map(([r,n])=>({key:r,staleAt:n.staleAt.getTime()})).sort((r,n)=>r.staleAt-n.staleAt),t=Math.min(Math.max(0,T.size-k.maxEntries),T.size);for(let r=0;r<t;r++)T.delete(e[r].key)}function ct(e,t,r){const n=r.dateUpdated||"",s=new Date(Date.now()+k.staleTTL),i=k.disableCache?void 0:T.get(t);
1if(i&&n&&i.version===n){i.staleAt=s,Je();return}k.disableCache||(T.set(t,{data:r,version:n,staleAt:s,sse:J.has(e)}),lt()),Je();const o=q.get(e);o&&o.forEach(l=>Wt(l,r))}async function Wt(e,t){await e.setPayload(t||e.getPayload())}async function Ce(e){const{apiHost:t,apiRequestHeaders:r}=e.getApiHosts(),n=e.getClientKey(),s="isRemoteEval"in e&&e.isRemoteEval(),i=ee(e),o=Fe(e);let l=ne.get(o);return l||(l=(s?$.fetchRemoteEvalCall({host:t,clientKey:n,payload:{attributes:e.getAttributes(),forcedVariations:e.getForcedVariations(),forcedFeatures:Array.from(e.getForcedFeatures().entries()),url:e.getUrl()},headers:r}):$.fetchFeaturesCall({host:t,clientKey:n,headers:r})).then(f=>{if(!f.ok)throw new Error(`HTTP error: ${f.status}`);return f.headers.get("x-sse-support")==="enabled"&&J.add(i),f.json()}).then(f=>(ct(i,o,f),Ue(e),ne.delete(o),{data:f,success:!0,source:"network"})).catch(f=>(ne.delete(o),{data:null,source:"error",success:!1,error:f})),ne.set(o,l)),l}function Ue(e,t=!1){const r=ee(e),n=Fe(e),{streamingHost:s,streamingHostRequestHeaders:i}=e.getApiHosts(),o=e.getClientKey();if(t&&J.add(r),k.backgroundSync&&J.has(r)&&D.EventSource){if(G.has(r))return;const l={src:null,host:s,clientKey:o,headers:i,cb:h=>{try{if(h.type==="features-updated"){const f=q.get(r);f&&f.forEach(p=>{Ce(p)})}else if(h.type==="features"){const f=JSON.parse(h.data);ct(r,n,f)}l.errors=0}catch{ft(l)}},errors:0,state:"active"};G.set(r,l),Ne(l)}}function ft(e){if(e.state!=="idle"&&(e.errors++,e.errors>3||e.src&&e.src.readyState===2)){const t=Math.pow(3,e.errors-3)*(1e3+Math.random()*1e3);Ie(e),setTimeout(()=>{["idle","active"].includes(e.state)||Ne(e)},Math.min(t,3e5))}}function Ie(e){e.src&&(e.src.onopen=null,e.src.onerror=null,e.src.close(),e.src=null,e.state==="active"&&(e.state="disabled"))}function Ne(e){e.src=$.eventSourceCall({host:e.host,clientKey:e.clientKey,headers:e.headers}),e.state="active",e.src.addEventListener("features",e.cb),e.src.addEventListener("features-updated",e.cb),e.src.onerror=()=>ft(e),e.src.onopen=()=>{e.errors=0}}function Qt(e,t){Ie(e),G.delete(t)}function ht(){J.clear(),G.forEach(Qt),q.clear(),$.stopIdleListener()}function Ee(e,t){if(t.streaming){if(!e.getClientKey())throw new Error("Mu
1st specify clientKey to enable streaming");t.payload&&Ue(e,!0),$t(e)}}var Xt=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,je={revert:function(){}},ue=new Map,Ke=new Set;function Zt(e){return e==="html"?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[e]}}function ce(e){var t=ue.get(e);return t||(t={element:e,attributes:{}},ue.set(e,t)),t}function fe(e,t,r,n,s){var i=r(e),o={isDirty:!1,originalValue:i,virtualValue:i,mutations:[],el:e,_positionTimeout:null,observer:new MutationObserver(function(){if(!(t==="position"&&o._positionTimeout)){t==="position"&&(o._positionTimeout=setTimeout(function(){o._positionTimeout=null},1e3));var l=r(e);t==="position"&&l.parentNode===o.virtualValue.parentNode&&l.insertBeforeNode===o.virtualValue.insertBeforeNode||l!==o.virtualValue&&(o.originalValue=l,s(o))}}),mutationRunner:s,setValue:n,getCurrentValue:r};return t==="position"&&e.parentNode?o.observer.observe(e.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):o.observer.observe(e,Zt(t)),o}function he(e,t){var r=t.getCurrentValue(t.el);t.virtualValue=e,e&&typeof e!="string"?(!r||e.parentNode!==r.parentNode||e.insertBeforeNode!==r.insertBeforeNode)&&(t.isDirty=!0,ze()):e!==r&&(t.isDirty=!0,ze())}function xt(e){var t=e.originalValue;e.mutations.forEach(function(r){return t=r.mutate(t)}),he(dr(t),e)}function er(e){var t=new Set(e.originalValue.split(/\s+/).filter(Boolean));e.mutations.forEach(function(r){return r.mutate(t)}),he(Array.from(t).filter(Boolean).join(" "),e)}function tr(e){var t=e.originalValue;e.mutations.forEach(function(r){return t=r.mutate(t)}),he(t,e)}function rr(e){var t=e.parentSelector,r=e.insertBeforeSelector,n=document.querySelector(t);if(!n)return null;var s=r?document.querySelector(r):null;return r&&!s?null:{parentNode:n,insertBeforeNode:s}}function nr(e){var t=e.originalValue;e.mutations.forEach(function(r){var n=r.mutate(),s=rr(n);t=s||t}),he(t,e)}var sr=function(t){return t.innerHTML},ir=function(t,r){return t.innerHTML=r};function dt(e){var t=ce(e);return t.html||(t.html=fe(e,"html",sr,ir,xt)),t.html}var or=function(t){return{parentNode:t.parentElement,insertBeforeNode:t.nextElementSibling}},ar=function(t,r){r.insertBeforeNode&&!r.parentNode.contains(r.insertBeforeNode)||r.parentNode.insertBefore(t,r.insertBeforeNode)};function gt(e){var t=ce(e);return t.position||(t.position=fe(e,"position",or,ar,nr)),t.position}var ur=function(t,r){return r?t.className=r:t.removeAttribute("class")},lr=function(t){return t.className};function yt(e){var t=ce(e);return t.classes||(t.classes=fe(e,"class",lr,ur,er)),t.classes}var cr=function(t){return function(r){var n;return(n=r.getAttribute(t))!=null?n:null}},fr=function(t){return function(r,n){return n!==null?r.setAttribute(t,n):r.removeAttribute(t)}};function pt(e,t){var r=ce(e);return r.attributes[t]||(r.attributes[t]=fe(e,t,cr(t),fr(t),tr)),r.attributes[t]}function hr(e,t){var r=ue.get(e);if(r)if(t==="html"){var n,s;(n=r.html)==null||(s=n.observer)==null||s.disconnect(),delete r.html}else if(t==="class"){var i,o;(i=r.classes)==null||(o=i.observer)==null||o.disconnect(),delete r.classes}else if(t==="position"){var l,h;(l=r.position)==null||(h=l.observer)==null||h.disconnect(),delete r.position}else{var f,p,v;(f=r.attributes)==null||(p=f[t])==null||(v=p.observer)==null||v.disconnect(),delete r.attributes[t]}}var se;function dr(e){return se||(se=document.createElement("div")),se.innerHTML=e,se.innerHTML}function ie(e,t,r){if(r.isDirty){r.isDirty=!1;var n=r.virtualValue;r.mutations.length||hr(e,t),r.setValue(e,n)}}function gr(e,t){e.html&&ie(t,"html",e.html),e.classes&&ie(t,"class",e.classes),e.position&&ie(t,"position",e.position),Object.keys(e.attributes).forEach(function(r){ie(t,r,e.attributes[r])})}function ze(){ue.forEach(gr)}function yr(e,t){var r=null;e.kind==="html"?r=dt(t):e.kind==="class"?r=yt(t):e.kind==="attribute"?r=pt(t,e.attribute):e.kind==="position"&&(r=gt(t)),r&&(r.mutations.push(e),r.mutationRunner(r))}function pr(e,t){var r=null;if(e.kind==="html"?r=dt(t):e.kind==="class"?r=yt(t):e.kind==="attribute"?r=pt(t,e.attribute):e.kind==="position"&&(r=gt(t)),!!r){var n=r.mutations.indexOf(e);n!==-1&&r.mutations.splice(n,1),r.mutationRunner(r)}}function vt(e){if(!(e.kind==="position"&&e.elements.size===1)){var t=new Set(e.elements),r=document.querySelectorAll(e.selector);r.forEach(function(n){t.has(n)||(e.elements.add(n),yr(e,n))})}}
1function vr(e){e.elements.forEach(function(t){return pr(e,t)}),e.elements.clear(),Ke.delete(e)}function Ye(){Ke.forEach(vt)}var Ae;function br(){typeof document>"u"||(Ae||(Ae=new MutationObserver(function(){Ye()})),Ye(),Ae.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}br();function de(e){return typeof document>"u"?je:(Ke.add(e),vt(e),{revert:function(){vr(e)}})}function Oe(e,t){return de({kind:"html",elements:new Set,mutate:t,selector:e})}function bt(e,t){return de({kind:"position",elements:new Set,mutate:t,selector:e})}function Q(e,t){return de({kind:"class",elements:new Set,mutate:t,selector:e})}function oe(e,t,r){return Xt.test(t)?t==="class"||t==="className"?Q(e,function(n){var s=r(Array.from(n).join(" "));n.clear(),s&&s.split(/\s+/g).filter(Boolean).forEach(function(i){return n.add(i)})}):de({kind:"attribute",attribute:t,elements:new Set,mutate:r,selector:e}):je}function mr(e){var t=e.selector,r=e.action,n=e.value,s=e.attribute,i=e.parentSelector,o=e.insertBeforeSelector;if(s==="html"){if(r==="append")return Oe(t,function(l){return l+(n??"")});if(r==="set")return Oe(t,function(){return n??""})}else if(s==="class"){if(r==="append")return Q(t,function(l){n&&l.add(n)});if(r==="remove")return Q(t,function(l){n&&l.delete(n)});if(r==="set")return Q(t,function(l){l.clear(),n&&l.add(n)})}else if(s==="position"){if(r==="set"&&i)return bt(t,function(){return{insertBeforeSelector:o,parentSelector:i}})}else{if(r==="append")return oe(t,s,function(l){return l!==null?l+(n??""):n??""});if(r==="set")return oe(t,s,function(){return n??""});if(r==="remove")return oe(t,s,function(){return null})}return je}var _r={html:Oe,classes:Q,attribute:oe,position:bt,declarative:mr};const we={};function F(e,t,r){r=r||{};for(const[n,s]of Object.entries(t))switch(n){case"$or":if(!Xe(e,s,r))return!1;break;case"$nor":if(Xe(e,s,r))return!1;break;case"$and":if(!Sr(e,s,r))return!1;break;case"$not":if(F(e,s,r))return!1;break;default:if(!X(s,kr(e,n),r))return!1}return!0}function kr(e,t){const r=t.split(".");let n=e;for(let s=0;s<r.length;s++)if(n&&typeof n=="object"&&r[s]in n)n=n[r[s]];else return null;return n}function We(e,t=!1){const r=`${e}${t?"/i":""}`;return we[r]||(we[r]=new RegExp(e.replace(/([^\\])\//g,"$1\\/"),t?"i":void 0)),we[r]}function X(e,t,r,n=!1){if(typeof e=="string")return n?String(t).toLowerCase()===e.toLowerCase():t+""===e;if(typeof e=="number")return t*1===e;if(typeof e=="boolean")return t!==null&&!!t===e;if(e===null)return t===null;if(Array.isArray(e)||!mt(e))return JSON.stringify(t)===JSON.stringify(e);for(const s in e)if(!wr(s,t,e[s],r))return!1;return!0}function mt(e){const t=Object.keys(e);return t.length>0&&t.filter(r=>r[0]==="$").length===t.length}function Er(e){if(e===null)return"null";if(Array.isArray(e))return"array";const t=typeof e;return["string","number","boolean","object","undefined"].includes(t)?t:"unknown"}function Ar(e,t,r){if(!Array.isArray(e))return!1;const n=mt(t)?s=>X(t,s,r):s=>F(s,t,r);for(let s=0;s<e.length;s++)if(e[s]&&n(e[s]))return!0;return!1}function K(e,t,r=!1){if(r){const n=s=>typeof s=="string"?s.toLowerCase():s;return Array.isArray(e)?e.some(s=>t.some(i=>n(s)===n(i))):t.some(s=>n(e)===n(s))}return Array.isArray(e)?e.some(n=>t.includes(n)):t.includes(e)}function Qe(e,t,r,n=!1){if(!Array.isArray(e))return!1;for(let s=0;s<t.length;s++){let i=!1;for(let o=0;o<e.length;o++)if(X(t[s],e[o],r,n)){i=!0;break}if(!i)return!1}return!0}function wr(e,t,r,n){switch(e){case"$veq":return S(t)===S(r);case"$vne":return S(t)!==S(r);case"$vgt":return S(t)>S(r);case"$vgte":return S(t)>=S(r);case"$vlt":return S(t)<S(r);case"$vlte":return S(t)<=S(r);case"$eq":return t===r;case"$ne":return t!==r;case"$lt":return t<r;
1case"$lte":return t<=r;case"$gt":return t>r;case"$gte":return t>=r;case"$exists":return r?t!=null:t==null;case"$in":return Array.isArray(r)?K(t,r):!1;case"$ini":return Array.isArray(r)?K(t,r,!0):!1;case"$inGroup":return K(t,n[r]||[]);case"$notInGroup":return!K(t,n[r]||[]);case"$nin":return Array.isArray(r)?!K(t,r):!1;case"$nini":return Array.isArray(r)?!K(t,r,!0):!1;case"$not":return!X(r,t,n);case"$size":return Array.isArray(t)?X(r,t.length,n):!1;case"$elemMatch":return Ar(t,r,n);case"$all":return Array.isArray(r)?Qe(t,r,n):!1;case"$alli":return Array.isArray(r)?Qe(t,r,n,!0):!1;case"$regex":try{return We(r).test(t)}catch{return!1}case"$regexi":try{return We(r,!0).test(t)}catch{return!1}case"$type":return Er(t)===r;default:return console.error("Unknown operator: "+e),!1}}function Xe(e,t,r){if(!t.length)return!0;for(let n=0;n<t.length;n++)if(F(e,t[n],r))return!0;return!1}function Sr(e,t,r){for(let n=0;n<t.length;n++)if(!F(e,t[n],r))return!1;return!0}const Cr="Feature Evaluated",Or="Experiment Viewed";function Dr(e){const t=new Map;return e.global.forcedFeatureValues&&e.global.forcedFeatureValues.forEach((r,n)=>t.set(n,r)),e.user.forcedFeatureValues&&e.user.forcedFeatureValues.forEach((r,n)=>t.set(n,r)),t}function Vr(e){return e.global.forcedVariations&&e.user.forcedVariations?{...e.global.forcedVariations,...e.user.forcedVariations}:e.global.forcedVariations?e.global.forcedVariations:e.user.forcedVariations?e.user.forcedVariations:{}}async function H(e){try{await e()}catch{}}function _t(e,t,r){if(e.user.trackedExperiments){const s=Te(t,r);if(e.user.trackedExperiments.has(s))return[];e.user.trackedExperiments.add(s)}e.user.enableDevMode&&e.user.devLogs&&e.user.devLogs.push({experiment:t,result:r,timestamp:Date.now().toString(),logType:"experiment"});const n=[];if(e.global.trackingCallback){const s=e.global.trackingCallback;n.push(H(()=>s(t,r,e.user)))}if(e.user.trackingCallback){const s=e.user.trackingCallback;n.push(H(()=>s(t,r)))}if(e.global.eventLogger){const s=e.global.eventLogger;n.push(H(()=>s(Or,{experimentId:t.key,variationId:r.key,hashAttribute:r.hashAttribute,hashValue:r.hashValue},e.user)))}return n}function Tr(e,t,r){if(e.user.trackedFeatureUsage){const n=JSON.stringify(r.value);if(e.user.trackedFeatureUsage[t]===n)return;e.user.trackedFeatureUsage[t]=n,e.user.enableDevMode&&e.user.devLogs&&e.user.devLogs.push({featureKey:t,result:r,timestamp:Date.now().toString(),logType:"feature"})}if(e.global.onFeatureUsage){const n=e.global.onFeatureUsage;H(()=>n(t,r,e.user))}if(e.user.onFeatureUsage){const n=e.user.onFeatureUsage;H(()=>n(t,r))}if(e.global.eventLogger){const n=e.global.eventLogger;H(()=>n(Cr,{feature:t,source:r.source,value:r.value,ruleId:r.source==="defaultValue"?"$default":r.ruleId||"",variationId:r.experimentResult?r.experimentResult.key:""},e.user))}}function Me(e,t){if(t.stack.evaluatedFeatures.has(e))return L(t,e,null,"cyclicPrerequisite");t.stack.evaluatedFeatures.add(e),t.stack.id=e;const r=Dr(t);if(r.has(e))return L(t,e,r.get(e),"override");if(!t.global.features||!t.global.features[e])return L(t,e,null,"unknownFeature");const n=t.global.features[e];if(n.rules){const s=new Set(t.stack.evaluatedFeatures);e:for(const i of n.rules){if(i.parentConditions)for(const h of i.parentConditions){t.stack.evaluatedFeatures=new Set(s);const f=Me(h.id,t);if(f.source==="cyclicPrerequisite")return L(t,e,null,"cyclicPrerequisite");const p={value:f.value};if(!F(p,h.condition||{})){if(h.gate)return L(t,e,null,"prerequisite");continue e}}if(i.filters&&At(i.filters,t))continue;if("force"in i){if(i.condition&&!Et(i.condition,t)||!Br(t,i.seed||e,i.hashAttribute,t.user.saveStickyBucketAssignmentDoc&&!i.disableStickyBucketing?i.fallbackAttribute:void 0,i.range,i.coverage,i.hashVersion))continue;return i.tracks&&i.tracks.forEach(h=>{!_t(t,h.experiment,h.result).length&&t.global.saveDeferredTrack&&t.global.saveDeferredTrack({experiment:h.experiment,result:h.result})}),L(t,e,i.force,"force",i.id)}if(!i.variations)continue;const o={variations:i.variations,key:i.key||e};"coverage"in i&&(o.coverage=i.coverage),i.weights&&(o.weights=i.weights),i.hashAttribute&&(o.hashAttribute=i.hashAttribute),i.fallbackAttribute&&(o.fallbackAttribute=i.fallbackAttribute),i.disableStickyBucketing&&(o.disableStickyBucketing=i.disableStickyBucketing),i.bucketVersion!==void 0&&(o.bucketVersion=i.bucketVersion),i.minBucketVersion!==void 0&&(o.minBucketVersion=i.minBucketVersion),i.namespace&&(o.namespace=i.namespace),i.meta&&(o.meta=i.meta),i.ranges&&(o.ranges=i.ranges),i.name&&(o.name=i.name),i.phase&&(o.phase=i.phase),i.seed&&(o.seed=i.seed),i.hashVersion&&(o.hashVersion=i.hashVersion),i.filters&&(o.filters=i.filters),i.condition&&(o.condition=i.condition);const{result:l}=De(o,e,t);if(t.global.onExperimentEval&&t.global.onExperimentEval(o,l),l.inExperiment&&!l.passthrough)return L(t,e,l.value,"experiment",i.id,o,l)}}return L(t,e,n.defaultValue===void 0?null:n.defaultValue,"defaultValue")}function De(e,t,r){const n=e.key,s=e.variations.length;if(s<2)return{result:b(r,e,-1,!1,t)};if(r.global.enabled===!1||r.user.enabled===!1)return{result:b(r,e,-1,!1,t)};if(e=Lr(e,r),e.urlPatterns&&!at(r.user.url||"",e.urlPatterns))return{result:b(r,e,-1,!1,t)};const i=It(n,r.user.url||"",s);if(i!==null)return{result:b(r,e,i,!1,t)};const o=Vr(r);if(n in o){const m=o[n];return{result:b(r,e,m,!1,t)}}if(e.status==="draft"||e.active===!1)return{result:b(r,e,-1,!1,t)};const{hashAttribute:l,hashValue:h}=R(r,e.hashAttribute,r.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing?e.fallbackAttribute:void 0);if(!h)return{result:b(r,e,-1,!1,t)};let f=-1,p=!1,v=!1;if(r.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){const{variation:m,versionIsBlocked:C}=Fr({ctx:r,expKey:e.key,expBucketVersion:e.bucketVersion,expHashAttribute:e.hashAttribute,expFallbackAttribute:e.fallbackAttribute,expMinBucketVersion:e.minBucketVersion,expMeta:e.meta});p=m>=0,f=m,v=!!C}if(!p){if(e.filters){if(At(e.filters,r))return{result:b(r,e,-1,!1,t)}}else if(e.namespace&&!Bt(h,e.namespace))return{result:b(r,e,-1,!1,t)};if(e.include&&!Nt(e.include))return{result:b(r,e,-1,!1,t)};if(e.condition&&!Et(e.condition,r))return{result:b(r,e,-1,!1,t)};if(e.parentConditions){const m=new Set(r.stack.evaluatedFeatures);for(const C of e.parentConditions){r.stack.evaluatedFeatures=new Set(m);const O=Me(C.id,r);if(O.source==="cyclicPrerequisite")return{result:b(r,e,-1,!1,t)};const V={value:O.value};if(!F(V,C.condition||{}))return{result:b(r,e,-1,!1,t)}}}if(e.groups&&!Rr(e.groups,r))return{result:b(r,e,-1,!1,t)}}if(e.url&&!Pr(e.url,r))return{result:b(r,e,-1,!1,t)};const E=le(e.seed||n,h,e.hashVersion||1);if(E===null)return{result:b(r,e,-1,!1,t)};if(!p){const m=e.ranges||Ut(s,e.coverage===void 0?1:e.coverage,e.weights);f=Lt(E,m)}if(v)return{result:b(r,e,-1,!1,t,void 0,!0)};if(f<0)return{result:b(r,e,-1,!1,t)};if("force"in e)return{result:b(r,e,e.force===void 0?-1:e.force,!1,t)};if(r.global.qaMode||r.user.qaMode)return{result:b(r,e,-1,!1,t)};if(e.status==="stopped")return{result:b(r,e,-1,!1,t)};const U=b(r,e,f,!0,t,E,p);if(r.user.saveStickyBucketAssignmentDoc&&!e.disableStickyBucketing){const{changed:m,key:C,doc:O}=Ir(r,l,ae(h),{[Ve(e.key,e.bucketVersion)]:U.key});m&&(r.user.stickyBucketAssignmentDocs=r.user.stickyBucketAssignmentDocs||{},r.user.stickyBucketAssignmentDocs[C]=O,r.user.saveStickyBucketAssignmentDoc(O))}const B=_t(r,e,U);B.length===0&&r.global.saveDeferredTrack&&r.global.saveDeferredTrack({experiment:e,result:U});const I=B.length?B.length===1?B[0]:Promise.all(B).then(()=>{}):void 0;return"changeId"in e&&e.changeId&&r.global.recordChangeId&&r.global.recordChangeId(e.changeId),{result:U,trackingCall:I}}function L(e,t,r,n,s,i,o){const l={value:r,on:!!r,off:!r,source:n,ruleId:s||""};return i&&(l.experiment=i),o&&(l.experimentResult=o),n!=="override"&&Tr(e,t,l),l}function kt(e){return{...e.user.attributes,...e.user.attributeOverrides}}function Et(e,t){return F(kt(t),e,t.global.savedGroups||{})}function At(e,t){return e.some(r=>{const{hashValue:n}=R(t,r.attribute);if(!n)return!0;const s=le(r.seed,n,r.hashVersion||2);return s===null?!0:!r.ranges.some(i=>Re(s,i))})}function Br(e,t,r,n,s,i,o){if(!s&&i===void 0)return!0;
1if(!s&&i===0)return!1;const{hashValue:l}=R(e,r,n);if(!l)return!1;const h=le(t,l,o||1);return h===null?!1:s?Re(h,s):i!==void 0?h<=i:!0}function b(e,t,r,n,s,i,o){let l=!0;(r<0||r>=t.variations.length)&&(r=0,l=!1);const{hashAttribute:h,hashValue:f}=R(e,t.hashAttribute,e.user.saveStickyBucketAssignmentDoc&&!t.disableStickyBucketing?t.fallbackAttribute:void 0),p=t.meta?t.meta[r]:{},v={key:p.key||""+r,featureId:s,inExperiment:l,hashUsed:n,variationId:r,value:t.variations[r],hashAttribute:h,hashValue:f,stickyBucketUsed:!!o};return p.name&&(v.name=p.name),i!==void 0&&(v.bucket=i),p.passthrough&&(v.passthrough=p.passthrough),v}function Lr(e,t){const r=e.key,n=t.global.overrides;return n&&n[r]&&(e=Object.assign({},e,n[r]),typeof e.url=="string"&&(e.url=ot(e.url))),e}function R(e,t,r){let n=t||"id",s="";const i=kt(e);return i[n]&&(s=i[n]),!s&&r&&(i[r]&&(s=i[r]),s&&(n=r)),{hashAttribute:n,hashValue:s}}function Pr(e,t){const r=t.user.url;if(!r)return!1;const n=r.replace(/^https?:\/\//,"").replace(/^[^/]*\//,"/");return!!(e.test(r)||e.test(n))}function Rr(e,t){const r=t.global.groups||{};for(let n=0;n<e.length;n++)if(r[e[n]])return!0;return!1}function Fr({ctx:e,expKey:t,expBucketVersion:r,expHashAttribute:n,expFallbackAttribute:s,expMinBucketVersion:i,expMeta:o}){r=r||0,i=i||0,n=n||"id",o=o||[];const l=Ve(t,r),h=Ur(e,n,s);if(i>0)for(let v=0;v<i;v++){const E=Ve(t,v);if(h[E]!==void 0)return{variation:-1,versionIsBlocked:!0}}const f=h[l];if(f===void 0)return{variation:-1};const p=o.findIndex(v=>v.key===f);return p<0?{variation:-1}:{variation:p}}function Ve(e,t){return t=t||0,`${e}__${t}`}function Z(e,t){return`${e}||${t}`}function Ur(e,t,r){if(!e.user.stickyBucketAssignmentDocs)return{};const{hashAttribute:n,hashValue:s}=R(e,t),i=Z(n,ae(s)),{hashAttribute:o,hashValue:l}=R(e,r),h=l?Z(o,ae(l)):null,f={};return h&&e.user.stickyBucketAssignmentDocs[h]&&Object.assign(f,e.user.stickyBucketAssignmentDocs[h].assignments||{}),e.user.stickyBucketAssignmentDocs[i]&&Object.assign(f,e.user.stickyBucketAssignmentDocs[i].assignments||{}),f}function Ir(e,t,r,n){const s=Z(t,r),i=e.user.stickyBucketAssignmentDocs&&e.user.stickyBucketAssignmentDocs[s]?e.user.stickyBucketAssignmentDocs[s].assignments||{}:{},o={...i,...n},l=JSON.stringify(i)!==JSON.stringify(o);return{key:s,doc:{attributeName:t,attributeValue:r,assignments:o},changed:l}}function Nr(e,t){const r=new Set,n=t&&t.features?t.features:e.global.features||{},s=t&&t.experiments?t.experiments:e.global.experiments||[];return Object.keys(n).forEach(i=>{const o=n[i];if(o.rules)for(const l of o.rules)l.variations&&(r.add(l.hashAttribute||"id"),l.fallbackAttribute&&r.add(l.fallbackAttribute))}),s.map(i=>{r.add(i.hashAttribute||"id"),i.fallbackAttribute&&r.add(i.fallbackAttribute)}),Array.from(r)}async function jr(e,t,r){const n=wt(e,r);return t.getAllAssignments(n)}function wt(e,t){const r={};return Nr(e,t).forEach(s=>{const{hashValue:i}=R(e,s);r[s]=ae(i)}),r}async function Kr(e,t,r){if(e={...e},e.encryptedFeatures){try{e.features=JSON.parse(await W(e.encryptedFeatures,t,r))}catch(n){console.error(n)}delete e.encryptedFeatures}if(e.encryptedExperiments){try{e.experiments=JSON.parse(await W(e.encryptedExperiments,t,r))}catch(n){console.error(n)}delete e.encryptedExperiments}if(e.encryptedSavedGroups){try{e.savedGroups=JSON.parse(await W(e.encryptedSavedGroups,t,r))}catch(n){console.error(n)}delete e.encryptedSavedGroups}return e}function Mr(e){const t=e.apiHost||"https://cdn.growthbook.io";return{apiHost:t.replace(/\/*$/,""),streamingHost:(e.streamingHost||t).replace(/\/*$/,""),apiRequestHeaders:e.apiHostRequestHeaders,streamingHostRequestHeaders:e.streamingHostRequestHeaders}}function Te(e,t){return t.hashAttribute+t.hashValue+e.key+t.variationId}const M=typeof window<"u"&&typeof document<"u",Hr=jt();class dn{constructor(t){if(t=t||{},this.version=Hr,this._options=this.context=t,this._renderer=t.renderer||null,this._trackedExperiments=new Set,this._completedChangeIds=new Set,this._trackedFeatures={},this.debug=!!t.debug,this._subscriptions=new Set,this.ready=!1,this._assigned=new Map,this._activeAutoExperiments=new Map,this._triggeredExpKeys=new Set,this._initialized=!1,this._redirectedUrl="",this._deferredTrackingCalls=new Map,this._autoExperimentsAllowed=!t.disableExperimentsOnLoad,this._destroyCallbacks=[],this.logs=[],this.log=this.log.bind(this),this._saveDeferredTrack=this._saveDeferredTrack.bind(this),this._onExperimentEval=this._onExperimentEval.bind(this),this._fireSubscriptions=this._fireSubscriptions.bind(this),this._recordChangedId=this._recordChangedId.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 r=!1;try{r=!!new URL(t.apiHost||"").hostname.match(/growthbook\.io$/i)}catch{}if(r)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 r=t.stickyBucketService;this._saveStickyBucketAssignmentDoc=n=>r.saveAssignments(n)}if(t.plugins)for(const r of t.plugins)r(this);if(t.features&&(this.ready=!0),M&&t.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event("gbloaded"))),t.experiments&&(this.ready=!0,this._updateAllAutoExperiments()),this._options.stickyBucketService&&this._options.stickyBucketAssignmentDocs)for(const r in this._options.stickyBucketAssignmentDocs){const n=this._options.stickyBucketAssignmentDocs[r];n&&this._options.stickyBucketService.saveAssignments(n).catch(()=>{})}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(t){this._payload=t;const r=await Kr(t,this._options.decryptionKey);this._decryptedPayload=r,await this.refreshStickyBuckets(r),r.features&&(this._options.features=r.features),r.savedGroups&&(this._options.savedGroups=r.savedGroups),r.experiments&&(this._options.experiments=r.experiments,this._updateAllAutoExperiments()),this.ready=!0,this._render()}initSync(t){this._initialized=!0;const r=t.payload;if(r.encryptedExperiments||r.encryptedFeatures)throw new Error("initSync does not support encrypted payloads");return this._options.stickyBucketService&&!this._options.stickyBucketAssignmentDocs&&(this._options.stickyBucketAssignmentDocs=this.generateStickyBucketAssignmentDocsSync(this._options.stickyBucketService,r)),this._payload=r,this._decryptedPayload=r,r.features&&(this._options.features=r.features),r.experiments&&(this._options.experiments=r.experiments,this._updateAllAutoExperiments()),this.ready=!0,Ee(this,t),this}async init(t){if(this._initialized=!0,t=t||{},t.cacheSettings&&Mt(t.cacheSettings),t.payload)return await this.setPayload(t.payload),Ee(this,t),{success:!0,source:"init"};{const{data:r,...n}=await this._refresh({...t,allowStale:!0});return Ee(this,t),await this.setPayload(r||{}),n}}async loadFeatures(t){t=t||{},await this.init({skipCache:t.skipCache,timeout:t.timeout,streaming:(this._options.backgroundSync??!0)&&(t.autoRefresh||this._options.subscribeToChanges)})}async refreshFeatures(t){const r=await this._refresh({...t||{},allowStale:!1});r.data&&await this.setPayload(r.data)}
1getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){return Mr(this._options)}getClientKey(){return this._options.clientKey||""}getPayload(){return this._payload||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this._decryptedPayload||this.getPayload()}isRemoteEval(){return this._options.remoteEval||!1}getCacheKeyAttributes(){return this._options.cacheKeyAttributes}async _refresh({timeout:t,skipCache:r,allowStale:n,streaming:s}){if(!this._options.clientKey)throw new Error("Missing clientKey");return Ht({instance:this,timeout:t,skipCache:r||this._options.disableCache,allowStale:n,backgroundSync:s??this._options.backgroundSync??!0})}_render(){if(this._renderer)try{this._renderer()}catch(t){console.error("Failed to render",t)}}setFeatures(t){this._options.features=t,this.ready=!0,this._render()}async setEncryptedFeatures(t,r,n){const s=await W(t,r||this._options.decryptionKey,n);this.setFeatures(JSON.parse(s))}setExperiments(t){this._options.experiments=t,this.ready=!0,this._updateAllAutoExperiments()}async setEncryptedExperiments(t,r,n){const s=await W(t,r||this._options.decryptionKey,n);this.setExperiments(JSON.parse(s))}async setAttributes(t){if(this._options.attributes=t,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}async updateAttributes(t){return this.setAttributes({...this._options.attributes,...t})}async setAttributeOverrides(t){if(this._options.attributeOverrides=t,this._options.stickyBucketService&&await this.refreshStickyBuckets(),this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}async setForcedVariations(t){if(this._options.forcedVariations=t||{},this._options.remoteEval){await this._refreshForRemoteEval();return}this._render(),this._updateAllAutoExperiments()}setForcedFeatures(t){this._options.forcedFeatureValues=t,this._render()}async setURL(t){if(t!==this._options.url){if(this._options.url=t,this._redirectedUrl="",this._options.remoteEval){await this._refreshForRemoteEval(),this._updateAllAutoExperiments(!0);return}this._updateAllAutoExperiments(!0)}}getAttributes(){return{...this._options.attributes,...this._options.attributeOverrides}}getForcedVariations(){return this._options.forcedVariations||{}}getForcedFeatures(){return this._options.forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this._options.stickyBucketAssignmentDocs||{}}getUrl(){return this._options.url||""}getFeatures(){return this._options.features||{}}getExperiments(){return this._options.experiments||[]}getCompletedChangeIds(){return Array.from(this._completedChangeIds)}subscribe(t){return this._subscriptions.add(t),()=>{this._subscriptions.delete(t)}}async _refreshForRemoteEval(){if(!this._options.remoteEval||!this._initialized)return;const t=await this._refresh({allowStale:!1});t.data&&await this.setPayload(t.data)}getAllResults(){return new Map(this._assigned)}onDestroy(t){this._destroyCallbacks.push(t)}isDestroyed(){return!!this._destroyed}destroy(t){t=t||{},this._destroyed=!0,this._destroyCallbacks.forEach(r=>{try{r()}catch(n){console.error(n)}}),this._subscriptions.clear(),this._assigned.clear(),this._trackedExperiments.clear(),this._completedChangeIds.clear(),this._deferredTrackingCalls.clear(),this._trackedFeatures={},this._destroyCallbacks=[],this._payload=void 0,this._saveStickyBucketAssignmentDoc=void 0,qt(this),t.destroyAllStreams&&ht(),this.logs=[],M&&window._growthbook===this&&delete window._growthbook,this._activeAutoExperiments.forEach(r=>{r.undo()}),this._activeAutoExperiments.clear(),this._triggeredExpKeys.clear()}setRenderer(t){this._renderer=t}forceVariation(t,r){if(this._options.forcedVariations=this._options.forcedVariations||{},this._options.forcedVariations[t]=r,this._options.remoteEval){this._refreshForRemoteEval();return}this._updateAllAutoExperiments(),this._render()}run(t){const{result:r}=De(t,null,this._getEvalContext());return this._onExperimentEval(t,r),r}triggerExperiment(t){return this._triggeredExpKeys.add(t),this._options.experiments?this._options.experiments.filter(n=>n.key===t).map(n=>this._runAutoExperiment(n)).filter(n=>n!==null):null}triggerAutoExperiments(){this._autoExperimentsAllowed=!0,this._updateAllAutoExperiments(!0)}_getEvalContext(){return{user:this._getUserContext(),global:this._getGlobalContext(),stack:{evaluatedFeatures:new Set}}}_getUserContext(){return{attributes:this._options.user?{...this._options.user,...this._options.attributes}:this._options.attributes,enableDevMode:this._options.enableDevMode,blockedCh
1angeIds:this._options.blockedChangeIds,stickyBucketAssignmentDocs:this._options.stickyBucketAssignmentDocs,url:this._getContextUrl(),forcedVariations:this._options.forcedVariations,forcedFeatureValues:this._options.forcedFeatureValues,attributeOverrides:this._options.attributeOverrides,saveStickyBucketAssignmentDoc:this._saveStickyBucketAssignmentDoc,trackingCallback:this._options.trackingCallback,onFeatureUsage:this._options.onFeatureUsage,devLogs:this.logs,trackedExperiments:this._trackedExperiments,trackedFeatureUsage:this._trackedFeatures}}_getGlobalContext(){return{features:this._options.features,experiments:this._options.experiments,log:this.log,enabled:this._options.enabled,qaMode:this._options.qaMode,savedGroups:this._options.savedGroups,groups:this._options.groups,overrides:this._options.overrides,onExperimentEval:this._onExperimentEval,recordChangeId:this._recordChangedId,saveDeferredTrack:this._saveDeferredTrack,eventLogger:this._options.eventLogger}}_runAutoExperiment(t,r){const n=this._activeAutoExperiments.get(t);if(t.manual&&!this._triggeredExpKeys.has(t.key)&&!n)return null;const s=this._isAutoExperimentBlockedByContext(t);let i,o;s?i=b(this._getEvalContext(),t,-1,!1,""):({result:i,trackingCall:o}=De(t,null,this._getEvalContext()),this._onExperimentEval(t,i));const l=JSON.stringify(i.value);if(!r&&i.inExperiment&&n&&n.valueHash===l)return i;if(n&&this._undoActiveAutoExperiment(t),i.inExperiment){const h=ke(t);if(h==="redirect"&&i.value.urlRedirect&&t.urlPatterns){const f=t.persistQueryString?Kt(this._getContextUrl(),i.value.urlRedirect):i.value.urlRedirect;if(at(f,t.urlPatterns))return this.log("Skipping redirect because original URL matches redirect URL",{id:t.key}),i;this._redirectedUrl=f;const{navigate:p,delay:v}=this._getNavigateFunction();if(p)if(M)Promise.all([...o?[ut(o,this._options.maxNavigateDelay??1e3)]:[],new Promise(E=>window.setTimeout(E,this._options.navigateDelay??v))]).then(()=>{try{p(f)}catch(E){console.error(E)}});else try{p(f)}catch(E){console.error(E)}}else if(h==="visual"){const f=this._options.applyDomChangesCallback?this._options.applyDomChangesCallback(i.value):this._applyDOMChanges(i.value);f&&this._activeAutoExperiments.set(t,{undo:f,valueHash:l})}}return i}_undoActiveAutoExperiment(t){const r=this._activeAutoExperiments.get(t);r&&(r.undo(),this._activeAutoExperiments.delete(t))}_updateAllAutoExperiments(t){if(!this._autoExperimentsAllowed)return;const r=this._options.experiments||[],n=new Set(r);this._activeAutoExperiments.forEach((s,i)=>{n.has(i)||(s.undo(),this._activeAutoExperiments.delete(i))});for(const s of r){const i=this._runAutoExperiment(s,t);if(i&&i.inExperiment&&ke(s)==="redirect")break}}_onExperimentEval(t,r){const n=this._assigned.get(t.key);this._assigned.set(t.key,{experiment:t,result:r}),this._subscriptions.size>0&&this._fireSubscriptions(t,r,n)}_fireSubscriptions(t,r,n){(!n||n.result.inExperiment!==r.inExperiment||n.result.variationId!==r.variationId)&&this._subscriptions.forEach(s=>{try{s(t,r)}catch(i){console.error(i)}})}_recordChangedId(t){this._completedChangeIds.add(t)}isOn(t){return this.evalFeature(t).on}isOff(t){return this.evalFeature(t).off}getFeatureValue(t,r){const n=this.evalFeature(t).value;return n===null?r:n}feature(t){return this.evalFeature(t)}evalFeature(t){return Me(t,this._getEvalContext())}log(t,r){this.debug&&(this._options.log?this._options.log(t,r):console.log(t,r))}getDeferredTrackingCalls(){return Array.from(this._deferredTrackingCalls.values())}setDeferredTrackingCalls(t){this._deferredTrackingCalls=new Map(t.filter(r=>r&&r.experiment&&r.result).map(r=>[Te(r.experiment,r.result),r]))}async fireDeferredTrackingCalls(){if(!this._options.trackingCallback)return;const t=[];this._deferredTrackingCalls.forEach(r=>{!r||!r.experiment||!r.result?console.error("Invalid deferred tracking call",{call:r}):t.push(this._options.trackingCallback(r.experiment,r.result))}),this._deferredTrackingCalls.clear(),await Promise.all(t)}setTrackingCallback(t){this._options.trackingCallback=t,this.fireDeferredTrackingCalls()}setFeatureUsageCallback(t){this._options.onFeatureUsage=t}
1setEventLogger(t){this._options.eventLogger=t}async logEvent(t,r){if(this._destroyed){console.error("Cannot log event to destroyed GrowthBook instance");return}if(this._options.enableDevMode&&this.logs.push({eventName:t,properties:r,timestamp:Date.now().toString(),logType:"event"}),this._options.eventLogger)try{await this._options.eventLogger(t,r||{},this._getUserContext())}catch(n){console.error(n)}else console.error("No event logger configured")}_saveDeferredTrack(t){this._deferredTrackingCalls.set(Te(t.experiment,t.result),t)}_getContextUrl(){return this._options.url||(M?window.location.href:"")}_isAutoExperimentBlockedByContext(t){const r=ke(t);if(r==="visual"){if(this._options.disableVisualExperiments||this._options.disableJsInjection&&t.variations.some(n=>n.js))return!0}else if(r==="redirect"){if(this._options.disableUrlRedirectExperiments)return!0;try{const n=new URL(this._getContextUrl());for(const s of t.variations){if(!s||!s.urlRedirect)continue;const i=new URL(s.urlRedirect);if(this._options.disableCrossOriginUrlRedirectExperiments&&(i.protocol!==n.protocol||i.host!==n.host))return!0}}catch(n){return this.log("Error parsing current or redirect URL",{id:t.key,error:n}),!0}}else return!0;return!!(t.changeId&&(this._options.blockedChangeIds||[]).includes(t.changeId))}getRedirectUrl(){return this._redirectedUrl}_getNavigateFunction(){return this._options.navigate?{navigate:this._options.navigate,delay:0}:M?{navigate:t=>{window.location.replace(t)},delay:100}:{navigate:null,delay:0}}_applyDOMChanges(t){if(!M)return;const r=[];if(t.css){const n=document.createElement("style");n.innerHTML=t.css,document.head.appendChild(n),r.push(()=>n.remove())}if(t.js){const n=document.createElement("script");n.innerHTML=t.js,this._options.jsInjectionNonce&&(n.nonce=this._options.jsInjectionNonce),document.head.appendChild(n),r.push(()=>n.remove())}return t.domMutations&&t.domMutations.forEach(n=>{r.push(_r.declarative(n).revert)}),()=>{r.forEach(n=>n())}}async refreshStickyBuckets(t){if(this._options.stickyBucketService){const r=this._getEvalContext(),n=await jr(r,this._options.stickyBucketService,t);this._options.stickyBucketAssignmentDocs=n}}generateStickyBucketAssignmentDocsSync(t,r){if(!("getAllAssignmentsSync"in t)){console.error("generating StickyBucketAssignmentDocs docs requires StickyBucketServiceSync");return}const n=this._getEvalContext(),s=wt(n,r);return t.getAllAssignmentsSync(s)}inDevMode(){return!!this._options.enableDevMode}}class $r{constructor(t){t=t||{},this.prefix=t.prefix||""}async getAllAssignments(t){const r={};return(await Promise.all(Object.entries(t).map(([n,s])=>this.getAssignments(n,s)))).forEach(n=>{if(n){const s=Z(n.attributeName,n.attributeValue);r[s]=n}}),r}getKey(t,r){return`${this.prefix}${t}||${r}`}}class qr extends $r{async getAssignments(t,r){return this.getAssignmentsSync(t,r)}async saveAssignments(t){this.saveAssignmentsSync(t)}getAllAssignmentsSync(t){const r={};return Object.entries(t).map(([n,s])=>this.getAssignmentsSync(n,s)).forEach(n=>{if(n){const s=Z(n.attributeName,n.attributeValue);r[s]=n}}),r}}class gn extends qr{constructor({prefix:t="gbStickyBuckets__",jsCookie:r,cookieAttributes:n={expires:180}}){super(),this.prefix=t,this.jsCookie=r,this.cookieAttributes=n}getAssignmentsSync(t,r){const n=this.getKey(t,r);let s=null;if(!this.jsCookie)return s;try{const i=this.jsCookie.get(n),o=JSON.parse(i||"{}");o.attributeName&&o.attributeValue&&o.assignments&&(s=o)}catch{}return s}async saveAssignmentsSync(t){const r=this.getKey(t.attributeName,t.attributeValue);if(!this.jsCookie)return;const n=JSON.stringify(t);this.jsCookie.set(r,n,this.cookieAttributes)}}const St=Y.createContext({});function yn(e,t){return Gr().getFeatureValue(e,t)}function Gr(){const{growthbook:e}=Y.useContext(St);if(!e)throw new Error("Missing or invalid GrowthBookProvider");return e}const pn=({children:e,growthbook:t})=>{const[r,n]=Y.useState(0);return Y.useEffect(()=>{if(!(!t||!t.setRenderer))return t.setRenderer(()=>{n(s=>s+1)}),()=>{t.setRenderer(()=>{})}},[t]),Y.createElement(St.Provider,{value:{growthbook:t}},e)};function Ze(e,t,r,n,s,i,o){try{var l=e[i](o),h=l.value}catch(f){return void r(f)}l.done?t(h):Promise.resolve(h).then(n,s)}function Jr(e){return function(){var t=this,r=arguments;return new Promise(function(n,s){var i=e.apply(t,r);function o(h){Ze(i,n,s,o,l,"next",h)}function l(h){Ze(i,n,s,o,l,"throw",h)}o(void 0)})}}function zr(e,t,r){return(t=Qr(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Be(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};
1t%2?xe(Object(r),!0).forEach(function(n){zr(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xe(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ct(e,t){if(e==null)return{};var r,n,s=Yr(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.includes(r)||{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function Yr(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.includes(n))continue;r[n]=e[n]}return r}function Le(){Le=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,s=Object.defineProperty||function(u,a,c){u[a]=c.value},i=typeof Symbol=="function"?Symbol:{},o=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",h=i.toStringTag||"@@toStringTag";function f(u,a,c){return Object.defineProperty(u,a,{value:c,enumerable:!0,configurable:!0,writable:!0}),u[a]}try{f({},"")}catch{f=function(a,c,g){return a[c]=g}}function p(u,a,c,g){var d=a&&a.prototype instanceof C?a:C,y=Object.create(d.prototype),_=new ve(g||[]);return s(y,"_invoke",{value:Ot(u,c,_)}),y}function v(u,a,c){try{return{type:"normal",arg:u.call(a,c)}}catch(g){return{type:"throw",arg:g}}}t.wrap=p;var E="suspendedStart",U="suspendedYield",B="executing",I="completed",m={};function C(){}function O(){}function V(){}var ge={};f(ge,o,function(){return this});var ye=Object.getPrototypeOf,te=ye&&ye(ye(be([])));te&&te!==r&&n.call(te,o)&&(ge=te);var N=V.prototype=C.prototype=Object.create(ge);function He(u){["next","throw","return"].forEach(function(a){f(u,a,function(c){return this._invoke(a,c)})})}function re(u,a){function c(d,y,_,A){var w=v(u[d],u,y);if(w.type!=="throw"){var j=w.arg,z=j.value;return z&&typeof z=="object"&&n.call(z,"__await")?a.resolve(z.__await).then(function(P){c("next",P,_,A)},function(P){c("throw",P,_,A)}):a.resolve(z).then(function(P){j.value=P,_(j)},function(P){return c("throw",P,_,A)})}A(w.arg)}var g;s(this,"_invoke",{value:function(d,y){function _(){return new a(function(A,w){c(d,y,A,w)})}return g=g?g.then(_,_):_()}})}function Ot(u,a,c){var g=E;return function(d,y){if(g===B)throw Error("Generator is already running");if(g===I){if(d==="throw")throw y;return{value:e,done:!0}}for(c.method=d,c.arg=y;;){var _=c.delegate;if(_){var A=$e(_,c);if(A){if(A===m)continue;return A}}if(c.method==="next")c.sent=c._sent=c.arg;else if(c.method==="throw"){if(g===E)throw g=I,c.arg;c.dispatchException(c.arg)}else c.method==="return"&&c.abrupt("return",c.arg);g=B;var w=v(u,a,c);if(w.type==="normal"){if(g=c.done?I:U,w.arg===m)continue;return{value:w.arg,done:c.done}}w.type==="throw"&&(g=I,c.method="throw",c.arg=w.arg)}}}function $e(u,a){var c=a.method,g=u.iterator[c];if(g===e)return a.delegate=null,c==="throw"&&u.iterator.return&&(a.method="return",a.arg=e,$e(u,a),a.method==="throw")||c!=="return"&&(a.method="throw",a.arg=new TypeError("The iterator does not provide a '"+c+"' method")),m;var d=v(g,u.iterator,a.arg);if(d.type==="throw")return a.method="throw",a.arg=d.arg,a.delegate=null,m;var y=d.arg;return y?y.done?(a[u.resultName]=y.value,a.next=u.nextLoc,a.method!=="return"&&(a.method="next",a.arg=e),a.delegate=null,m):y:(a.method="throw",a.arg=new TypeError("iterator result is not an object"),a.delegate=null,m)}function Dt(u){var a={tryLoc:u[0]};1 in u&&(a.catchLoc=u[1]),2 in u&&(a.finallyLoc=u[2],a.afterLoc=u[3]),this.tryEntries.push(a)}function pe(u){var a=u.completion||{};a.type="normal",delete a.arg,u.completion=a}function ve(u){this.tryEntries=[{tryLoc:"root"}],u.forEach(Dt,this),this.reset(!0)}function be(u){if(u||u===""){var a=u[o];if(a)return a.call(u);if(typeof u.next=="function")return u;if(!isNaN(u.length)){var c=-1,g=function d(){for(;++c<u.length;)if(n.call(u,c))return d.value=u[c],d.done=!1,d;return d.value=e,d.done=!0,d};return g.next=g}}throw new TypeError(typeof u+" is not iterable")}return O.prototype=V,s(N,"constructor",{value:V,configurable:!0}),s(V,"constructor",{value:O,configurable:!0}),O.displayName=f(V,h,"GeneratorFunction"),t.isGeneratorFunction=function(u){var a=typeof u=="function"&&u.constructor;return!!a&&(a===O||(a.displayName||a.name)==="GeneratorFunction")},t.mark=function(u){return Object.setPrototypeOf?Object.setPrototypeOf(u,V):(u.__proto__=V,f(u,h,"GeneratorFunction")),u.prototype=Object.create(N),u},t.awrap=function(u){return{__await:u}},He(re.prototype),f(re.prototype,l,function(){return this}),t.AsyncIterator=re,t.async=function(u,a,c,g,d){d===void 0&&(d=Promise);var y=new re(p(u,a,c,g),d);return t.isGeneratorFunction(a)?y:y.next().then(function(_){return _.done?_.value:y.next()})},He(N),f(N,h,"Generator"),f(N,o,function(){return this}),f(N,"toString",function(){return"[object Generator]"}),t.keys=function(u){var a=Object(u),c=[];for(var g in a)c.push(g);return c.reverse(),function d(){for(;c.length;){var y=c.pop();if(y in a)return d.value=y,d.done=!1,d}return d.done=!0,d}},t.values=be,ve.prototype={constructor:ve,reset:function(u){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEac
1h(pe),!u)for(var a in this)a.charAt(0)==="t"&&n.call(this,a)&&!isNaN(+a.slice(1))&&(this[a]=e)},stop:function(){this.done=!0;var u=this.tryEntries[0].completion;if(u.type==="throw")throw u.arg;return this.rval},dispatchException:function(u){if(this.done)throw u;var a=this;function c(w,j){return y.type="throw",y.arg=u,a.next=w,j&&(a.method="next",a.arg=e),!!j}for(var g=this.tryEntries.length-1;g>=0;--g){var d=this.tryEntries[g],y=d.completion;if(d.tryLoc==="root")return c("end");if(d.tryLoc<=this.prev){var _=n.call(d,"catchLoc"),A=n.call(d,"finallyLoc");if(_&&A){if(this.prev<d.catchLoc)return c(d.catchLoc,!0);if(this.prev<d.finallyLoc)return c(d.finallyLoc)}else if(_){if(this.prev<d.catchLoc)return c(d.catchLoc,!0)}else{if(!A)throw Error("try statement without catch or finally");if(this.prev<d.finallyLoc)return c(d.finallyLoc)}}}},abrupt:function(u,a){for(var c=this.tryEntries.length-1;c>=0;--c){var g=this.tryEntries[c];if(g.tryLoc<=this.prev&&n.call(g,"finallyLoc")&&this.prev<g.finallyLoc){var d=g;break}}d&&(u==="break"||u==="continue")&&d.tryLoc<=a&&a<=d.finallyLoc&&(d=null);var y=d?d.completion:{};return y.type=u,y.arg=a,d?(this.method="next",this.next=d.finallyLoc,m):this.complete(y)},complete:function(u,a){if(u.type==="throw")throw u.arg;return u.type==="break"||u.type==="continue"?this.next=u.arg:u.type==="return"?(this.rval=this.arg=u.arg,this.method="return",this.next="end"):u.type==="normal"&&a&&(this.next=a),m},finish:function(u){for(var a=this.tryEntries.length-1;a>=0;--a){var c=this.tryEntries[a];if(c.finallyLoc===u)return this.complete(c.completion,c.afterLoc),pe(c),m}},catch:function(u){for(var a=this.tryEntries.length-1;a>=0;--a){var c=this.tryEntries[a];if(c.tryLoc===u){var g=c.completion;if(g.type==="throw"){var d=g.arg;pe(c)}return d}}throw Error("illegal catch attempt")},delegateYield:function(u,a,c){return this.delegate={iterator:be(u),resultName:a,nextLoc:c},this.method==="next"&&(this.arg=e),m}},t}function Wr(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qr(e){var t=Wr(e,"string");return typeof t=="symbol"?t:t+""}var x={CLASSIC:"classic",V1:"v1"},Xr=x.V1,Zr="https://cdn.paddle.com/paddle/paddle.js",xr="https://cdn.paddle.com/paddle/v2/paddle.js",en={url:Zr},tn={url:xr};function rn(e){return document.querySelector('script[src="'.concat(e,'"]'))||void 0}function nn(e){var t=document.createElement("script");t.src=e;var r=document.head||document.body;if(!r)throw new Error("Cannot inject Paddle.js. It needs a <head> or <body> element.");return r.appendChild(t),t}var Se={classic:void 0,v1:void 0},sn={classic:"PaddleClassic",v1:"PaddleBillingV1"};function on(e){var t,r=(t=an(e))===null||t===void 0?void 0:t.url;if(r){var n=Se[e],s=sn[e];return n!==void 0?n:(Se[e]=new Promise(function(i,o){if(typeof window>"u"){i(void 0);return}if(window[s]){i(window[s]);return}try{var l=rn(r);l||(l=nn(r)),l.addEventListener("load",function(){window[s]?i(window[s]):o(new Error("Paddle.js not available"))}),l.addEventListener("error",function(){o(new Error("Failed to load Paddle.js - ".concat(e)))})}catch(h){o(h);return}}),Se[e])}}function an(e){if(e===x.CLASSIC)return en;if(e===x.V1)return tn;console.error("[Paddle] Unknown Paddle Version")}var un=["environment","version"],ln=["environment","version"];function cn(e,t){var r=e.environment;e.version;var n=Ct(e,un);try{r&&t.Environment.set(r),t.Initialized?t.Update(Be({},n)):t.Initialize(Be({},n))}catch(s){console.warn("[Paddle] Paddle Initialization failed. Please check the inputs",s)}}function fn(e,t){var r=e.environment;e.version;var n=Ct(e,ln);try{r&&t.Environment.set(r),t.Setup(Be({},n))}catch(s){console.warn("[Paddle] Paddle Initialization failed. Please check the inputs",s)}}var et;(function(e){e.CHECKOUT_LOADED="checkout.loaded",e.CHECKOUT_CLOSED="checkout.closed",e.CHECKOUT_UPDATED="checkout.updated",e.CHECKOUT_COMPLETED="checkout.completed",e.CHECKOUT_ERROR="checkout.error",e.CHECKOUT_FAILED="checkout.failed",e.CHECKOUT_ITEMS_UPDATED="checkout.items.updated",e.CHECKOUT_ITEMS_REMOVED="checkout.items.removed",e.CHECKOUT_CUSTOMER_CREATED="checkout.customer.created",e.CHECKOUT_CUSTOMER_UPDATED="checkout.customer.updated",e.CHECKOUT_CUSTOMER_REMOVED="checkout.customer.removed",e.CHECKOUT_PAYMENT_SELECTED="checkout.payment.selected",e.CHECKOUT_PAYMENT_INITIATED="checkout.payment.initiated",e.CHECKOUT_PAYMENT_FAILED="checkout.payment.failed",e.CHECKOUT_PAYMENT_ERROR="checkout.payment.error",e.CHECKOUT_DISCOUNT_APPLIED="checkout.discount.applied",e.CHECKOUT_DISCOUNT_REMOVED="checkout.discount.removed",e.CHECKOUT_UPSELL_CANCELED="checkout.upsell.canceled"})(et||(et={}));var tt;(function(e){e.DAY="day",e.WEEK="week",e.MONTH="month",e.YEAR="year"})(tt||(tt={}));var rt;(function(e){e.ALIPAY="alipay",e.APPLE_PAY="apple-pay",e.CARD="card",e.GOOGLE_PAY="google-pay",e.IDEAL="ideal",e.PAYPAL="paypal",e.WECHAT_PAY="wechat-pay",e.WIRE_TRANSFER="wire-transfer",e.NONE="none"})(rt||(rt={}));var nt;(function(e){e.AMERICAN_EXPRESS="american_express",e.DINERS_CLUB="diners_club",e.DISCOVER="discover",e.JCB="jcb",e.MADA="mada",e.MAESTRO="maestro",e.MASTER_CARD="mastercard",e.UNION_PAY="union_pay",e.VISA="visa",e.UNKNOWN="unknown"})(nt||(nt={}));var st;(function(e){e.DRAFT="draft",e.READY="ready",e.COMPLETED="completed",e.BILLED="billed",e.canceled="canceled",e.PAST_DUE="past_due"})(st||(st={}));function vn(e){return Pe.apply(this,arguments)}function Pe(){return Pe=Jr(Le().mark(function e(t){var r,n;return Le().wrap(function(i){for(;;)switch(i.prev=i.next){case 0:return r=t?.version||Xr,i.next=3,on(r);case 3:if(n=i.sent,!n){i.next=9;break}return t&&(r===x.V1?cn(t,n):r===x.CLASSIC&&fn(t,n)),i.abrupt("return",n);case 9:return console.error("[Paddle] Error Loading Paddle"),i.abrupt("return");case 11:case"end":return i.stop()}},e)})),Pe.apply(this,arguments)}export{gn as B,tt as C,dn as G,et as a,pn as b,vn as i,yn as u}; 2//# sourceMappingURL=growth-payment-B1wQ8toD.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.