@statsig/js-client 0.0.1-beta.33 → 0.0.1-beta.35

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.
@@ -5,4 +5,4 @@ or you can use record.mirror to access the mirror instance during recording.`;le
5
5
  `;return r&&o.push("//# sourceMappingURL="+r+`
6
6
  `),o}function an(e,t){var r=sn(e,t),n=new Blob(r,{type:"application/javascript"});return URL.createObjectURL(n)}function ln(e,t){var r;return function(o){return r=r||an(e,t),new Worker(r,o)}}var cn=ln(function(){(function(){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=typeof Uint8Array>"u"?[]:new Uint8Array(256),r=0;r<e.length;r++)t[e.charCodeAt(r)]=r;var n=function(s){var c=new Uint8Array(s),d,p=c.length,h="";for(d=0;d<p;d+=3)h+=e[c[d]>>2],h+=e[(c[d]&3)<<4|c[d+1]>>4],h+=e[(c[d+1]&15)<<2|c[d+2]>>6],h+=e[c[d+2]&63];return p%3===2?h=h.substring(0,h.length-1)+"=":p%3===1&&(h=h.substring(0,h.length-2)+"=="),h};const o=new Map,a=new Map;async function l(s,c,d){const p=`${s}-${c}`;if("OffscreenCanvas"in globalThis){if(a.has(p))return a.get(p);const h=new OffscreenCanvas(s,c);h.getContext("2d");const m=await(await h.convertToBlob(d)).arrayBuffer(),f=n(m);return a.set(p,f),f}else return""}const i=self;i.onmessage=async function(s){if("OffscreenCanvas"in globalThis){const{id:c,bitmap:d,width:p,height:h,dataURLOptions:m}=s.data,f=l(p,h,m),u=new OffscreenCanvas(p,h);u.getContext("2d").drawImage(d,0,0),d.close();const y=await u.convertToBlob(m),S=y.type,b=await y.arrayBuffer(),g=n(b);if(!o.has(c)&&await f===g)return o.set(c,g),i.postMessage({id:c});if(o.get(c)===g)return i.postMessage({id:c});i.postMessage({id:c,type:S,base64:g,width:p,height:h}),o.set(c,g)}else return i.postMessage({id:s.data.id})}})()},null),Ft=Object.getOwnPropertySymbols,dn=Object.prototype.hasOwnProperty,un=Object.prototype.propertyIsEnumerable,pn=(e,t)=>{var r={};for(var n in e)dn.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ft)for(var n of Ft(e))t.indexOf(n)<0&&un.call(e,n)&&(r[n]=e[n]);return r},hn=(e,t,r)=>new Promise((n,o)=>{var a=s=>{try{i(r.next(s))}catch(c){o(c)}},l=s=>{try{i(r.throw(s))}catch(c){o(c)}},i=s=>s.done?n(s.value):Promise.resolve(s.value).then(a,l);i((r=r.apply(e,t)).next())});class mn{constructor(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(s,c)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(s)||this.pendingCanvasMutations.set(s,[]),this.pendingCanvasMutations.get(s).push(c)};const{sampling:r="all",win:n,blockClass:o,blockSelector:a,recordCanvas:l,dataURLOptions:i}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,l&&r==="all"&&this.initCanvasMutationObserver(n,o,a),l&&typeof r=="number"&&this.initCanvasFPSObserver(r,n,o,a,{dataURLOptions:i})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,r,n,o,a){const l=Dt(r,n,o,!0),i=new Map,s=new cn;s.onmessage=f=>{const{id:u}=f.data;if(i.set(u,!1),!("base64"in f.data))return;const{base64:y,type:S,width:b,height:g}=f.data;this.mutationCb({id:u,type:ae["2D"],commands:[{property:"clearRect",args:[0,0,b,g]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:y}],type:S}]},0,0]}]})};const c=1e3/t;let d=0,p;const h=()=>{const f=[];return r.document.querySelectorAll("canvas").forEach(u=>{F(u,n,o,!0)||f.push(u)}),f},m=f=>{if(d&&f-d<c){p=requestAnimationFrame(m);return}d=f,h().forEach(u=>hn(this,null,function*(){var y;const S=this.mirror.getId(u);if(i.get(S))return;if(i.set(S,!0),["webgl","webgl2"].includes(u.__context)){const g=u.getContext(u.__context);((y=g?.getContextAttributes())==null?void 0:y.preserveDrawingBuffer)===!1&&g.clear(g.COLOR_BUFFER_BIT)}const b=yield createImageBitmap(u);s.postMessage({id:S,bitmap:b,width:u.width,height:u.height,dataURLOptions:a.dataURLOptions},[b])})),p=requestAnimationFrame(m)};p=requestAnimationFrame(m),this.resetObservers=()=>{l(),cancelAnimationFrame(p)}}initCanvasMutationObserver(t,r,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const o=Dt(t,r,n,!1),a=rn(this.processMutation.bind(this),t,r,n),l=on(this.processMutation.bind(this),t,r,n,this.mirror);this.resetObservers=()=>{o(),a(),l()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=r=>{this.rafStamps.latestId=r,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,r)=>{const n=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,n)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,r){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(t);if(!n||r===-1)return;const o=n.map(l=>pn(l,["type"])),{type:a}=n[0];this.mutationCb({id:r,type:a,commands:o}),this.pendingCanvasMutations.delete(t)}}class fn{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new br,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,r){if(t.length===0)return;const n={id:r,styleIds:[]},o=[];for(const a of t){let l;this.styleMirror.has(a)?l=this.styleMirror.getId(a):(l=this.styleMirror.add(a),o.push({styleId:l,rules:Array.from(a.rules||CSSRule,(i,s)=>({rule:Ge(i),index:s}))})),n.styleIds.push(l)}o.length>0&&(n.styles=o),this.adoptedStyleSheetCb(n)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}class yn{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.loop&&this.periodicallyClear()})}inOtherBuffer(t,r){const n=this.nodeMap.get(t);return n&&Array.from(n).some(o=>o!==r)}add(t,r){this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(r))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}var gn=Object.defineProperty,Sn=Object.defineProperties,bn=Object.getOwnPropertyDescriptors,_t=Object.getOwnPropertySymbols,vn=Object.prototype.hasOwnProperty,In=Object.prototype.propertyIsEnumerable,Pt=(e,t,r)=>t in e?gn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$=(e,t)=>{for(var r in t||(t={}))vn.call(t,r)&&Pt(e,r,t[r]);if(_t)for(var r of _t(t))In.call(t,r)&&Pt(e,r,t[r]);return e},Mn=(e,t)=>Sn(e,bn(t));function N(e){return Mn($({},e),{timestamp:Me()})}let E,Ee,Ue,Re=!1;const j=Xt();function ye(e={}){const{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:o="rr-block",blockSelector:a=null,ignoreClass:l="rr-ignore",ignoreSelector:i=null,maskTextClass:s="rr-mask",maskTextSelector:c=null,inlineStylesheet:d=!0,maskAllInputs:p,maskInputOptions:h,slimDOMOptions:m,maskInputFn:f,maskTextFn:u,hooks:y,packFn:S,sampling:b={},dataURLOptions:g={},mousemoveWait:v,recordDOM:R=!0,recordCanvas:D=!1,recordCrossOriginIframes:V=!1,recordAfter:U=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:z=!1,collectFonts:B=!1,inlineImages:X=!1,plugins:k,keepIframeSrcFn:Z=()=>!1,ignoreCSSAttributes:W=new Set([]),errorHandler:J}=e;kr(J);const G=V?window.parent===window:!0;let xe=!1;if(!G)try{window.parent.document&&(xe=!1)}catch{xe=!0}if(G&&!t)throw new Error("emit function is required");v!==void 0&&b.mousemove===void 0&&(b.mousemove=v),j.reset();const je=p===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:h!==void 0?h:{password:!0},ze=m===!0||m==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:m==="all",headMetaDescKeywords:m==="all"}:m||{};Sr();let $t,Be=0;const Wt=I=>{for(const H of k||[])H.eventProcessor&&(I=H.eventProcessor(I));return S&&!xe&&(I=S(I)),I};E=(I,H)=>{var x;if(((x=Q[0])==null?void 0:x.isFrozen())&&I.type!==C.FullSnapshot&&!(I.type===C.IncrementalSnapshot&&I.data.source===M.Mutation)&&Q.forEach(_=>_.unfreeze()),G)t?.(Wt(I),H);else if(xe){const _={type:"rrweb",event:Wt(I),origin:window.location.origin,isCheckout:H};window.parent.postMessage(_,"*")}if(I.type===C.FullSnapshot)$t=I,Be=0;else if(I.type===C.IncrementalSnapshot){if(I.data.source===M.Mutation&&I.data.isAttachIframe)return;Be++;const _=n&&Be>=n,ce=r&&I.timestamp-$t.timestamp>r;(_||ce)&&Ee(!0)}};const Le=I=>{E(N({type:C.IncrementalSnapshot,data:$({source:M.Mutation},I)}))},Ut=I=>E(N({type:C.IncrementalSnapshot,data:$({source:M.Scroll},I)})),jt=I=>E(N({type:C.IncrementalSnapshot,data:$({source:M.CanvasMutation},I)})),wn=I=>E(N({type:C.IncrementalSnapshot,data:$({source:M.AdoptedStyleSheet},I)})),ee=new fn({mutationCb:Le,adoptedStyleSheetCb:wn}),te=new Gr({mirror:j,mutationCb:Le,stylesheetManager:ee,recordCrossOriginIframes:V,wrappedEmit:E});for(const I of k||[])I.getMirror&&I.getMirror({nodeMirror:j,crossOriginIframeMirror:te.crossOriginIframeMirror,crossOriginIframeStyleMirror:te.crossOriginIframeStyleMirror});const He=new yn;Ue=new mn({recordCanvas:D,mutationCb:jt,win:window,blockClass:o,blockSelector:a,mirror:j,sampling:b.canvas,dataURLOptions:g});const Ne=new Qr({mutationCb:Le,scrollCb:Ut,bypassOptions:{blockClass:o,blockSelector:a,maskTextClass:s,maskTextSelector:c,inlineStylesheet:d,maskInputOptions:je,dataURLOptions:g,maskTextFn:u,maskInputFn:f,recordCanvas:D,inlineImages:X,sampling:b,slimDOMOptions:ze,iframeManager:te,stylesheetManager:ee,canvasManager:Ue,keepIframeSrcFn:Z,processedNodeManager:He},mirror:j});Ee=(I=!1)=>{if(!R)return;E(N({type:C.Meta,data:{href:window.location.href,width:ot(),height:nt()}}),I),ee.reset(),Ne.init(),Q.forEach(x=>x.lock());const H=yr(document,{mirror:j,blockClass:o,blockSelector:a,maskTextClass:s,maskTextSelector:c,inlineStylesheet:d,maskAllInputs:je,maskTextFn:u,slimDOM:ze,dataURLOptions:g,recordCanvas:D,inlineImages:X,onSerialize:x=>{it(x,j)&&te.addIframe(x),lt(x,j)&&ee.trackLinkElement(x),$e(x)&&Ne.addShadowRoot(x.shadowRoot,document)},onIframeLoad:(x,_)=>{te.attachIframe(x,_),Ne.observeAttachShadow(x)},onStylesheetLoad:(x,_)=>{ee.attachLinkElement(x,_)},keepIframeSrcFn:Z});if(!H)return console.warn("Failed to snapshot the document");E(N({type:C.FullSnapshot,data:{node:H,initialOffset:rt(window)}}),I),Q.forEach(x=>x.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ee.adoptStyleSheets(document.adoptedStyleSheets,j.getId(document))};try{const I=[],H=_=>{var ce;return w(Vr)({mutationCb:Le,mousemoveCb:(T,Ve)=>E(N({type:C.IncrementalSnapshot,data:{source:Ve,positions:T}})),mouseInteractionCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.MouseInteraction},T)})),scrollCb:Ut,viewportResizeCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.ViewportResize},T)})),inputCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.Input},T)})),mediaInteractionCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.MediaInteraction},T)})),styleSheetRuleCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.StyleSheetRule},T)})),styleDeclarationCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.StyleDeclaration},T)})),canvasMutationCb:jt,fontCb:T=>E(N({type:C.IncrementalSnapshot,data:$({source:M.Font},T)})),selectionCb:T=>{E(N({type:C.IncrementalSnapshot,data:$({source:M.Selection},T)}))},customElementCb:T=>{E(N({type:C.IncrementalSnapshot,data:$({source:M.CustomElement},T)}))},blockClass:o,ignoreClass:l,ignoreSelector:i,maskTextClass:s,maskTextSelector:c,maskInputOptions:je,inlineStylesheet:d,sampling:b,recordDOM:R,recordCanvas:D,inlineImages:X,userTriggeredOnInput:z,collectFonts:B,doc:_,maskInputFn:f,maskTextFn:u,keepIframeSrcFn:Z,blockSelector:a,slimDOMOptions:ze,dataURLOptions:g,mirror:j,iframeManager:te,stylesheetManager:ee,shadowDomManager:Ne,processedNodeManager:He,canvasManager:Ue,ignoreCSSAttributes:W,plugins:((ce=k?.filter(T=>T.observer))==null?void 0:ce.map(T=>({observer:T.observer,options:T.options,callback:Ve=>E(N({type:C.Plugin,data:{plugin:T.name,payload:Ve}}))})))||[]},y)};te.addLoadListener(_=>{try{I.push(H(_.contentDocument))}catch(ce){console.warn(ce)}});const x=()=>{Ee(),I.push(H(document)),Re=!0};return document.readyState==="interactive"||document.readyState==="complete"?x():(I.push(A("DOMContentLoaded",()=>{E(N({type:C.DomContentLoaded,data:{}})),U==="DOMContentLoaded"&&x()})),I.push(A("load",()=>{E(N({type:C.Load,data:{}})),U==="load"&&x()},window))),()=>{I.forEach(_=>_()),He.destroy(),Re=!1,Or()}}catch(I){console.warn(I)}}return ye.addCustomEvent=(e,t)=>{if(!Re)throw new Error("please add custom event after start recording");E(N({type:C.Custom,data:{tag:e,payload:t}}))},ye.freezePage=()=>{Q.forEach(e=>e.freeze())},ye.takeFullSnapshot=e=>{if(!Re)throw new Error("please take full snapshot after start recording");Ee(e)},ye.mirror=j,ye}();
7
7
 
8
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("rrwebRecord")):"function"==typeof define&&define.amd?define(["rrwebRecord"],e):"object"==typeof exports?exports.Statsig=e(require("rrwebRecord")):t.Statsig=e(t.rrwebRecord)}(this,l=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $P = (a,b) => Object.assign(a,b);var i={8352:t=>{t.exports=l},5496:(t,e,i)=>{$Q(e),e.t=e.i=void 0,e.i=()=>null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:u;e.t=t=>{var e;return t?null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:e[t]:null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.lastInstance};var n,s="__STATSIG__",o="undefined"!=typeof window?window:{},i=void 0!==i.g?i.g:{},r="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=o[s])?n:i[s])?n:r[s])?n:{instance:e.t};o[s]=u,i[s]=u,r[s]=u},5856:(t,e)=>{$Q(e)},2320:function(t,e,i){var o=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.DataAdapterCore=void 0;const n=i(8512),r=i(6780),s=i(6283),u=i(6296),l=i(3444),a=i(2412);e.DataAdapterCore=class{constructor(t,e){this.o=t,this.l=e,this.u=null,this.h=null,this.v={},this._="statsig.last_modified_time."+e}attach(t,e){this.h=t,this.u=new n.ErrorBoundary(t)}getDataSync(t){var t=this.m(t),e=this.v[t];return e||((e=this.p(t))?(this.S(t,e),this.v[t]):null)}setData(t,e){e=this.m(e);this.S(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.v=$P($P({},this.v),t)}O(e,i,n){var s;return o(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(i),t=[this.j(null!=(s=null==t?void 0:t.data)?s:null,i)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(r.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}T(i,n){return o(this,void 0,void 0,function*(){var t=this.m(i),e=yield this.O(null,i,n);e&&this.S(t,$P($P({},e),{source:"Prefetch"}))})}j(n,s){return o(this,void 0,void 0,function*(){var t=yield this.I(n,s);if(!t)return r.Log.debug("No response returned for latest value"),null;var e=(0,a.typedJsonParse)(t,"has_updates","Failure while attempting to persist latest value");let i=null;return!0===(null==e?void 0:e.has_updates)?i={source:"Network",data:t,receivedAt:Date.now()}:n&&!1===(null==e?void 0:e.has_updates)&&(i={source:"NetworkNotModified",data:n,receivedAt:Date.now()}),i?(t=this.m(s),this.S(t,i),yield this.A(t,i),i):null})}M(){return null!=this.h?this.h:(r.Log.error(this.o+" is not attached to a Client"),"")}m(t){t=(0,u.getUserStorageKey)(this.M(),t);return`${s.DataAdapterCachePrefix}.${this.l}.`+t}S(t,e){var i=Object.entries(this.v);i.length<10||([i]=i.reduce((t,e)=>e[1]<t[1]?e:t),delete this.v[i]),this.v[t]=e}p(t){var e=null==(e=l.Storage.D)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,a.typedJsonParse)(e,"source","Failed to parse cached result"))?$P($P({},t),{source:"Cache"}):null}A(t,e){return o(this,void 0,void 0,function*(){yield l.Storage.k(t,JSON.stringify(e)),yield this.N(t)})}N(i){var n;return o(this,void 0,void 0,function*(){var t=null!=(n=yield(0,l.P)(this._))?n:{},e=(t[i]=Date.now(),Object.entries(t));e.length<=10||(delete t[(e=e.reduce((t,e)=>e[1]<t[1]?e:t))[0]],yield l.Storage.C(e[0])),yield(0,l.G)(this._,t)})}}},4280:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},184:(t,e)=>{$Q(e)},8512:function(t,u,e){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};Object.defineProperty(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const n=e(6780),l=e(7360),a=e(6972);u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";u.ErrorBoundary=class{constructor(t,e){this.h=t,this.U=e,this.R=new Set}wrap(n){try{const t=n;!function(t){const e=new Set;let i=Object.getPrototypeOf(t);for(;i&&i!==Object.prototype;)Object.getOwnPropertyNames(i).filter(t=>"function"==typeof(null===i||void 0===i?void 0:i[t])).forEach(t=>e.add(t)),i=Object.getPrototypeOf(i);return Array.from(e)}(t).forEach(e=>{const i=t[e];"$EB"in i||(t[e]=(...t)=>this.capture(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.F("eb:wrap",t)}}capture(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.F(e,t)):i}catch(t){return this.F(e,t),null}}logError(t,e){this.F(t,e)}F(o,r){try{n.Log.warn("Caught error in "+o,{error:r});i(this,void 0,void 0,function*(){var t,e,i=null!=r?r:Error("[Statsig] Error was empty"),n=i instanceof Error,s=n?i.name:"No Name";this.R.has(s)||(this.R.add(s),t=l.SDKType.L(this.h),e=a.StatsigMetadataProvider.get(),n=n?i.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(i),i=JSON.stringify($P({tag:o,exception:s,info:n},$P($P({},e),{sdkType:t}))),yield fetch(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.h,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:i}),null!=(s=this.U)&&s.call(this,{name:"error",error:r}))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},6788:(t,e)=>{$Q(e)},6728:function(t,e,i){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.EventLogger=void 0;const s=i(7832),o=i(6780),r=i(5256),u=i(3452),l=i(6048),a=i(1876),c=i(3444),d=i(2412),h=i(84),v=i(100);e.EventLogger=class{constructor(t,e,i,n){this.h=t,this.U=e,this.K=i,this.J=n,this.q=[],this.V={},this.B={},this.$=!1,this.H=Date.now(),this.W=!0===(null==n?void 0:n.disableLogging),this.Y=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;i=null!=(e=null==n?void 0:n.loggingIntervalMs)?e:1e4,this.X=setInterval(()=>this.Z(),i),t=null==n?void 0:n.networkConfig;this.tt=(0,h.et)(null==t?void 0:t.logEventUrl,null==t?void 0:t.api,"/rgstr",r.NetworkDefault.eventsApi),this.nt=(0,h.et)(null==t?void 0:t.logEventBeaconUrl,null==t?void 0:t.api,"/log_event_beacon",r.NetworkDefault.eventsApi),(0,v.it)(this.st.bind(this)),this.ot()}setLoggingDisabled(t){this.W=t}enqueue(t){this.rt(t)&&(this.lt(t),this.ut(),this.q.length>this.Y)&&this.Z()}incrementNonExposureCount(t){var e=null!=(e=this.B[t])?e:0;this.B[t]=e+1}reset(){this.V={}}shutdown(){return n(this,void 0,void 0,function*(){this.X&&(clearInterval(this.X),this.X=null),yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;this.ct(),0!==this.q.length&&(t=this.q,this.q=[],yield this.dt(t))})}st(t){"background"===t&&this.Z()}ut(){this.$||(this.$=!0,200<Date.now()-this.H)||setTimeout(()=>this.Z(),200)}rt(t){if((0,a.ht)(t)){var t=[t.eventName,null==(e=t.user)?void 0:e.userID,null==(e=t.metadata)?void 0:e.gate,null==(e=t.metadata)?void 0:e.config,null==(e=t.metadata)?void 0:e.ruleID].join("|"),e=this.V[t],i=Date.now();if(e&&i-e<6e4)return!1;1e3<Object.keys(this.V).length&&(this.V={}),this.V[t]=i}return!0}Z(){this.flush().catch(()=>{})}dt(t){return n(this,void 0,void 0,function*(){if(this.W)this.vt(t);else try{(!(0,v._t)()&&this.K.isBeaconSupported()?yield this.ft(t):yield this.gt(t)).success?this.U({name:"logs_flushed",events:t}):this.vt(t)}catch(t){o.Log.warn("Failed to flush events.")}})}gt(e){return n(this,void 0,void 0,function*(){var t=yield this.K.post({sdkKey:this.h,data:{events:e},url:this.tt,retries:3,params:{[u.NetworkParam.EventCount]:String(e.length)}}),t=null!=t&&t.body?(0,d.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}ft(t){return n(this,void 0,void 0,function*(){return{success:yield this.K.beacon({sdkKey:this.h,data:{events:t},url:this.nt})}})}vt(t){for(;500<t.length;)t.shift();var e=this.bt();(0,c.G)(e,t).catch(()=>{o.Log.warn("Unable to save failed logs to storage")})}ot(){const e=this.bt();n(this,void 0,void 0,function*(){var t=yield(0,c.P)(e);t&&(yield c.Storage.C(e),yield this.dt(t))}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}bt(){return"statsig.failed_logs."+(0,s.DJB2)(this.h)}lt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.yt();i&&(e.statsigMetadata={currentPage:i}),this.q.push($P($P({},t),e))}ct(){0!==Object.keys(this.B).length&&(this.lt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.B)}}),this.B={})}yt(){var t;if(!1!==(null==(t=this.J)?void 0:t.includeCurrentPageUrlWithEvents))return(0,l.ln)()}}},7832:(t,e)=>{$Q(e),e.DJB2Object=e.DJB2=void 0;e.DJB2=e=>{let i=0;for(let t=0;t<e.length;t++){var n=e.charCodeAt(t);i=(i<<5)-i+n,i&=i}return String(i>>>0)};e.DJB2Object=t=>(0,e.DJB2)(JSON.stringify(s(t)));const s=i=>{if(null==i)return null;var t=Object.keys(i).sort();const n={};return t.forEach(t=>{let e=i[t];e instanceof Object&&(e=s(e)),n[t]=e}),n}},9664:(t,e)=>{$Q(e)},6780:(t,e)=>{function i(t){return t.unshift("[Statsig]"),t}var n,s;$Q(e),e.Log=e.LogLevel=void 0,(s=n||(e.LogLevel=n={}))[s.None=0]="None",s[s.Error=1]="Error",s[s.Warn=2]="Warn",s[s.Info=3]="Info",s[s.Debug=4]="Debug";class o{static info(...t){this.level>=n.Info&&console.info(...i(t))}static debug(...t){this.level>=n.Debug&&console.debug(...i(t))}static warn(...t){this.level>=n.Warn&&console.warn(...i(t))}static error(...t){this.level>=n.Error&&console.error(...i(t))}}(e.Log=o).level=n.Error},3188:function(t,e,i){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.NetworkCore=void 0,i(5496);const h=i(4280),v=i(6780),s=i(3452),o=i(7360),r=i(8612),u=i(1604),l=i(6972);e.NetworkCore=class{constructor(t,e){this.J=t,this.U=e,this.Ot=null!=(t=null==(e=null==t?void 0:t.networkConfig)?void 0:e.networkTimeoutMs)?t:1e4}post(e){return n(this,void 0,void 0,function*(){var t=yield this.jt(e);return this.Tt($P({method:"POST",body:this.wt(e,t)},e))})}get(t){return this.Tt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(i){return n(this,void 0,void 0,function*(){var t,e;return!!_(i)&&(t=yield this.It(i),e=yield this.jt(i),navigator.sendBeacon(t,e))})}Tt(c){var d;return n(this,void 0,void 0,function*(){if(!_(c))return null;var{method:e,body:i,retries:n}=c;const s=new AbortController;var t=setTimeout(()=>s.abort(`Timeout of ${this.Ot}ms expired.`),this.Ot),o=yield this.It(c),r=null;try{var u,l,a,r=yield fetch(o,{method:e,body:i,headers:$P({},c.headers),signal:s.signal});if(clearTimeout(t),r.ok)return a=yield r.text(),h.Diagnostics.mark(),{body:a,code:r.status};throw u=yield r.text().catch(()=>"No Text"),(l=new Error(`Failed to fetch: ${o} `+u)).name="NetworkError",l}catch(t){i=function(t,e){if(t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return null}(s,t);return h.Diagnostics.mark(),!n||n<=0?(null!=(d=this.U)&&d.call(this,{name:"error",error:t}),v.Log.error(`A networking error occured during ${e} request to ${o}.`,i,t),null):this.Tt($P($P({},c),{retries:n-1}))}})}It(e){return n(this,void 0,void 0,function*(){var t=$P({[s.NetworkParam.SdkKey]:e.sdkKey,[s.NetworkParam.SdkType]:o.SDKType.L(e.sdkKey),[s.NetworkParam.SdkVersion]:l.SDK_VERSION,[s.NetworkParam.Time]:String(Date.now()),[s.NetworkParam.SessionID]:yield r.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}jt(s){return n(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=s,i=yield u.StableID.get(e),n=yield r.SessionID.get(e),e=o.SDKType.L(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},l.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:e})}))})}wt(t,e){var i;return!(null!=(null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__["no-encode"])||null!=(i=this.J)&&i.disableStatsigEncoding)&&t.isStatsigEncodable&&"undefined"!=typeof window&&window.btoa&&(t.params=$P($P({},null!=(i=t.params)?i:{}),{[s.NetworkParam.StatsigEncoded]:"1"}),null!=(t=window.btoa(e).split("").reverse().join("")))?t:e}};const _=t=>!!t.sdkKey||(v.Log.warn("Unable to make request without an SDK key"),!1)},5256:(t,e)=>{$Q(e),e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://events.statsigapi.net/v1",initializeApi:"https://featuregates.org/v1",specsApi:"https://api.statsigcdn.com/v1"}},3452:(t,e)=>{$Q(e),e.NetworkParam=void 0,e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se"}},4264:(t,e)=>{$Q(e)},7360:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={L:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},At(t,e){i[t]=e},Mt(t){n&&"-react"!==n||(n="-"+t)}}},6048:(t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ln=n.xt=n.Dt=n.an=n.Et=n.kt=void 0;n.kt=()=>"undefined"!=typeof window?window:null,n.Et=()=>{var t=(0,n.kt)();return null!=(t=null==t?void 0:t.document)?t:null},n.an=()=>null!=(0,n.Et)(),n.Dt=(t,e)=>{var i=(0,n.kt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.xt=(t,e)=>{var i=(0,n.Et)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.ln=()=>{var t;try{return null==(t=(0,n.kt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},8612:function(t,r,e){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};Object.defineProperty(r,"__esModule",{value:!0}),r.SessionID=void 0;const n=e(7832),u=e(6780),l=e(3444),a=e(3556),c={},d={},h={};function v(t){return"statsig.session_id."+(0,n.DJB2)(t)}r.SessionID={get:t=>null!=h[t]?h[t]:h[t]=r.SessionID.Nt(t),Nt:o=>i(void 0,void 0,void 0,function*(){let e=c[o];var i=Date.now();if(null==e){let t=yield function(t){t=v(t);return(0,l.P)(t)}(o);null==t&&(t={sessionID:(0,a.getUUID)(),startTime:i,lastUpdate:i}),e=t,c[o]=e}var t=null!=(t=d[o])?t:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:()=>{}},n=((144e5<i-e.startTime||18e5<i-e.lastUpdate)&&(e.sessionID=(0,a.getUUID)(),e.startTime=i),e.lastUpdate=i,e),s=o;return s=v(o),(0,l.G)(s,n).catch(()=>{u.Log.warn("Failed to save SessionID")}),t.idleTimeoutID=r.SessionID.Pt(t,t.idleTimeoutID,18e5),t.ageTimeoutID=r.SessionID.Pt(t,t.ageTimeoutID,144e5-(i-e.startTime)),c[o]=e,d[o]=t,h[o]=null,e.sessionID}),Ct:(t,e)=>{var i=null!=(i=d[e])?i:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:t};i.emitFunction=t,d[e]=i},Pt:(t,e,i)=>(clearTimeout(null!=e?e:void 0),setTimeout(t.emitFunction,i))}},1604:function(t,e,i){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.StableID=void 0;const s=i(7832),o=i(6780),r=i(3444),u=i(3556),l={};function a(t){return"statsig.stable_id."+(0,s.DJB2)(t)}function c(t,e){e=a(e);(0,r.G)(e,t).catch(()=>{o.Log.warn("Failed to save StableID")})}e.StableID={get:e=>n(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,r.P)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},7688:function(t,e,i){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.StatsigClientBase=void 0,i(5496);const l=i(5496),a=i(8512),c=i(6728),d=i(6780),h=i(6048),v=i(8612),_=i(1604),f=i(3444);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.Gt={};var s,o=this.St.bind(this),r=(0,l.i)(),u=null!=(u=r.instances)?u:{};null!=n&&n.logLevel&&(d.Log.level=null==n?void 0:n.logLevel),null!=n&&n.disableStorage&&f.Storage.Rt(!0),null!=n&&n.overrideStableID&&_.StableID.setOverride(n.overrideStableID,t),this.u=new a.ErrorBoundary(t,o),this.u.wrap(this),this.u.wrap(i),this.u.wrap(e),this.h=t,this.J=null!=n?n:{},this.Ft=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Lt=new c.EventLogger(t,o,i,n),v.SessionID.Ct(()=>{this.St({name:"session_expired"})},t),null!=u[t]&&(0,h.an)()&&d.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),u[t]=this,r.lastInstance=this,r.instances=u,__STATSIG__=r,this.dataAdapter=e,this.dataAdapter.attach(t,n)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.J.disableLogging=t.disableLogging,this.Lt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.J.disableStorage=t.disableStorage,f.Storage.Rt(t.disableStorage))}flush(){return this.Lt.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.St({name:"pre_shutdown"}),yield this.Lt.shutdown()})}on(t,e){this.Gt[t]||(this.Gt[t]=[]),this.Gt[t].push(e)}off(t,e){this.Gt[t]&&-1!==(e=this.Gt[t].indexOf(e))&&this.Gt[t].splice(e,1)}__on(t,e){e.__isInternal=!0,this.on(t,e)}St(i){var t;const e=e=>{try{e(i)}catch(t){!0===e.__isInternal?this.u.logError("_emit:"+i.name,t):d.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Gt[i.name]&&this.Gt[i.name].forEach(t=>e(t)),null!=(t=this.Gt["*"])&&t.forEach(e)}Ut(t,e){this.loadingStatus=t,this.St({name:"values_updated",status:t,values:e})}Kt(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.Lt.incrementNonExposureCount(t):this.Lt.enqueue(e)}}},5808:(t,e)=>{$Q(e)},6283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1876:(t,e)=>{$Q(e),e.Jt=e.qt=e.Vt=e.ht=void 0;const i="statsig::config_exposure",n="statsig::gate_exposure",l=(t,e,i,n,s)=>({eventName:t,user:e,value:null,metadata:o(i,n),secondaryExposures:s,time:Date.now()});e.ht=({eventName:t})=>t===n||t===i,e.Vt=(t,e)=>{return l(n,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.qt=(t,e)=>{return l(i,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Jt=(t,e,i)=>{var n,s=e.__evaluation,o=!0===(null==(o=null==s?void 0:s.explicit_parameters)?void 0:o.includes(i));let r="",u=null!=(n=null==s?void 0:s.undelegated_secondary_exposures)?n:[];return o&&(r=null!=(n=s.allocated_experiment_name)?n:"",u=s.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(o)},u)};const o=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},6972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="0.0.1-beta.33";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},3384:(t,e)=>{$Q(e)},6396:(t,e)=>{$Q(e),e.zt=e.Bt=e.$t=e.Ht=void 0;const s="default";function o(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:s,__evaluation:i,value:n}}function r(o,r){return(t,e)=>{var i,n,s=null!=(s=null==o?void 0:o[t])?s:null;return null==s||null!=e&&(i=e,(n=t=>Array.isArray(t)?"array":typeof t)(s)!==n(i))?null!=e?e:null:(null!=r&&r(t),s)}}e.Ht=function(t,e,i){return o(t,e,i,!0===(null==i?void 0:i.value))},e.$t=function(t,e,i){return $P($P({},o(t,e,i,null!=(t=null==i?void 0:i.value)?t:{})),{groupName:null,get:r(null==i?void 0:i.value)})},e.Bt=function(t,e,i,n){return $P($P({},o(t,e,i,void 0)),{get:r(null==i?void 0:i.value,n),groupName:null!=(t=null==i?void 0:i.group_name)?t:null,__value:null!=(e=null==i?void 0:i.value)?e:{}})},e.zt=function(t,e,i,n){return $P($P($P({},t),e),{get:r(i,n)})}},9136:(t,e)=>{$Q(e)},6296:(t,e,i)=>{$Q(e),e.getUnitIDFromUser=e.getUserStorageKey=e.normalizeUser=void 0;const n=i(7832);e.normalizeUser=function(t,e){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&(i.statsigEnvironment=e),i}catch(t){throw new Error("User object must be convertable to JSON string.")}},e.getUserStorageKey=function(t,e){return(0,n.DJB2Object)({sdkKey:t,user:e})},e.getUnitIDFromUser=function(t,e){var i;return"string"==typeof e&&"userid"!==e.toLowerCase()?null!=(i=null==(i=t.customIDs)?void 0:i[e])?i:null==(i=null==t?void 0:t.customIDs)?void 0:i[e.toLowerCase()]:t.userID}},3444:function(t,e,i){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})},i=($Q(e),e.G=e.P=e.Storage=void 0,i(6780));const s={},o={Wt:()=>"InMemory",D(t){return null!=(t=s[t])?t:null},Yt(t){return Promise.resolve(null!=(t=s[t])?t:null)},k(t,e){return s[t]=e,Promise.resolve()},C(t){return delete s[t],Promise.resolve()},Qt(){return Promise.resolve(Object.keys(s))}};let r=null;try{"undefined"!=typeof window&&"localStorage"in window&&(r={Wt:()=>"LocalStorage",D(t){return localStorage.getItem(t)},Yt(t){return Promise.resolve(localStorage.getItem(t))},k(t,e){return localStorage.setItem(t,e),Promise.resolve()},C(t){return localStorage.removeItem(t),Promise.resolve()},Qt(){var t=Object.keys(localStorage);return Promise.resolve(t)}})}catch(t){i.Log.warn("Failed to setup localStorageProvider.")}let u=null!==r&&void 0!==r?r:o,l=u;e.Storage={Wt:()=>l.Wt(),Yt:t=>l.Yt(t),k:(t,e)=>l.k(t,e),C:t=>l.C(t),Qt:()=>l.Qt(),D:t=>{var e;return null!=(e=null==(e=l.D)?void 0:e.call(l,t))?e:null},Xt:t=>{u=t,l=t},Rt:t=>{l=t?o:u}},e.P=function(e){return n(this,void 0,void 0,function*(){var t=yield l.Yt(e);return JSON.parse(null!=t?t:"null")})},e.G=function(t,e){return n(this,void 0,void 0,function*(){yield l.k(t,JSON.stringify(e))})}},2412:(t,e,i)=>{$Q(e),e.typedJsonParse=void 0;const s=i(6780);e.typedJsonParse=function(t,e,i){try{var n=JSON.parse(t);return"object"==typeof n&&0 in n,n}catch(t){}return s.Log.error(i),null}},3556:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let i=(new Date).getTime(),n="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<i?(e=(i+e)%16|0,i=Math.floor(i/16)):(e=(n+e)%16|0,n=Math.floor(n/16)),("x"===t?e:7&e|8).toString(16)})}},84:(t,e)=>{$Q(e),e.et=void 0,e.et=function(t,e,i,n){return t||(e?""+e+i:""+n+i)}},1539:(t,e)=>{$Q(e)},100:(t,e,i)=>{$Q(e),e.Zt=e.it=e._t=void 0;i=i(6048);const n="foreground",s="background",o=[];let r=n;e._t=()=>r===n,e.it=t=>{o.unshift(t)};e.Zt=e=>{e!==r&&(r=e,o.forEach(t=>t(e)))},(0,i.Dt)("focus",()=>(0,e.Zt)(n)),(0,i.Dt)("blur",()=>(0,e.Zt)(s)),(0,i.Dt)("beforeunload",()=>(0,e.Zt)(s)),(0,i.xt)("visibilitychange",()=>{(0,e.Zt)("visible"===document.visibilityState?n:s)})},4464:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};$Q(e),e.Log=e.Storage=e.EventLogger=void 0,i(5496);const o=i(6728),r=(Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(6780));Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return r.Log}});var u=i(6972);const l=i(3444);Object.defineProperty(e,"Storage",{enumerable:!0,get:function(){return l.Storage}});var a=i(3556);s(i(5496),e),s(i(5856),e),s(i(2320),e),s(i(184),e),s(i(8512),e),s(i(500),e),s(i(6788),e),s(i(7832),e),s(i(9664),e),s(i(6780),e),s(i(3452),e),s(i(3188),e),s(i(5256),e),s(i(4264),e),s(i(6048),e),s(i(7360),e),s(i(8612),e),s(i(1604),e),s(i(7688),e),s(i(5808),e),s(i(6283),e),s(i(1876),e),s(i(6972),e),s(i(3384),e),s(i(6396),e),s(i(9136),e),s(i(6296),e),s(i(3444),e),s(i(2412),e),s(i(84),e),s(i(1539),e),s(i(3556),e),s(i(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:o.EventLogger,Log:r.Log,getUUID:a.getUUID,Storage:l.Storage,SDK_VERSION:u.SDK_VERSION})},9920:(t,e,i)=>{$Q(e),e.AutoInit=void 0;const d=i(4464),h=i(5208);e.AutoInit=class{static attempt(e){var t,i,n;try{var s=(0,d.kt)(),o=(0,d.Et)();if(s&&o&&o.currentScript){var r=o.currentScript.getAttribute("src"),u=null==(t=s.location)?void 0:t.href;if(r&&u){var l,a=new URL(r,u).searchParams;if(l=null!=(i=a.get("sdkkey"))?i:a.get("sdkKey")){var c=null==(n=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:n[l];let t=null;(t=c instanceof h.StatsigClient?c:t)||(t=new h.StatsigClient(l,{})).initializeAsync().catch(t=>{d.Log.error(t)}),e({sdkKey:l,client:t})}}}}catch(t){d.Log.error("AutoInit failed",t)}}}},3096:(t,e,i)=>{$Q(e),e.resolveDeltasResponse=void 0;const n=i(4464);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.resolveDeltasResponse=function(t,e){var i;return(e=(0,n.typedJsonParse)(e,"checksum","Failed to parse DeltasEvaluationResponse"))?(t=t,i=e,t=$P($P($P({},t),i),{feature_gates:$P($P({},t.feature_gates),i.feature_gates),layer_configs:$P($P({},t.layer_configs),i.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),i.dynamic_configs)}),s((t=i=t).deleted_gates,t.feature_gates),delete t.deleted_gates,s(i.deleted_configs,t.dynamic_configs),delete t.deleted_configs,s(i.deleted_layers,t.layer_configs),delete t.deleted_layers,i=t,(t=(0,n.DJB2Object)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs}))===e.checksum?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},1536:(t,e,i)=>{$Q(e);const n=i(4464);e.default=class{constructor(){this.te=null,this.ee=null,this.ne="Uninitialized",this.ie=0,this.se=0}getValues(){return this.te?(0,n.typedJsonParse)(this.te,"has_updates","Failed to parse EvaluationStoreValues"):null}reset(){this.ee=null,this.te=null,this.ne="Loading",this.ie=0,this.se=0}finalize(){this.ee||(this.ne="NoValues")}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=(0,n.typedJsonParse)(t.data,"has_updates","Failed to parse EvaluationResponse"))?void 0:e.has_updates)&&(this.te=t.data,this.ie=e.time,this.se=t.receivedAt,this.ne=t.source,this.ee=e)}getGate(t){var e,t=null!=(e=null==(e=this.ee)?void 0:e.feature_gates[t])?e:null;return this.oe(t)}getConfig(t){var e,t=null!=(e=null==(e=this.ee)?void 0:e.dynamic_configs[t])?e:null;return this.oe(t)}getLayer(t){var e,t=null!=(e=null==(e=this.ee)?void 0:e.layer_configs[t])?e:null;return this.oe(t)}oe(t){return{evaluation:t,details:this.re(null==t)}}re(t){return"Uninitialized"===this.ne||"NoValues"===this.ne?{reason:this.ne}:{reason:this.ne+":"+(t?"Unrecognized":"Recognized"),lcut:this.ie,receivedAt:this.se}}}},9400:function(t,e,i){var o=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e);const r=i(4464),u=i(3096);class n extends r.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.le=(0,r.et)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",r.NetworkDefault.initializeApi)}fetchEvaluations(i,n,s){return o(this,void 0,void 0,function*(){var t=n?(0,r.typedJsonParse)(n,"has_updates","Failed to parse cached EvaluationResponse"):null;let e={user:s,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.ue(i,t,e)})}ue(e,i,n){var s;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.le,data:n,retries:2,isStatsigEncodable:!0});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(s=null==t?void 0:t.body)?s:null:!0!==(null==i?void 0:i.has_updates)||!0!==(null==(s=t.body)?void 0:s.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,u.resolveDeltasResponse)(i,t.body))?t:this.ue(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}))})}}e.default=n},4520:function(t,e,i){var s=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e);const r=i(4464),o=i(1536),u=i(9400),l=i(5364);class n extends r.StatsigClientBase{static instance(t){var e=(0,r.i)().instance(t);return e instanceof n?e:(r.Log.warn("Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){r.SDKType.At(t,"javascript-client");var n=new u.default(i,t=>{this.St(t)});super(t,null!=(t=null==i?void 0:i.dataAdapter)?t:new l.StatsigEvaluationsDataAdapter,n,i),this.ae=new o.default,this.ce=e}initializeSync(){this.updateUserSync(this.ce)}initializeAsync(t){return this.updateUserAsync(this.ce,t)}updateUserSync(t){this.de(t);t=this.dataAdapter.getDataSync(this.ce);this.ae.setValuesFromDataAdapter(t),this.ae.finalize(),this.Ut("Ready",t),this.he(null!=t?t:null,this.ce)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.de(i);var t=this.ce,e=this.dataAdapter.getDataSync(t);this.Ut("Loading",e),this.ae.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.ce&&this.ae.setValuesFromDataAdapter(e),this.ae.finalize(),this.Ut("Ready",e)})}getContext(){return{sdkKey:this.h,options:this.J,values:this.ae.getValues(),user:JSON.parse(JSON.stringify(this.ce)),errorBoundary:this.u}}getAsyncContext(){return s(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{sessionID:yield r.SessionID.get(this.h),stableID:yield r.StableID.get(this.h)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var i=(0,r.DJB2)(t),{evaluation:i,details:n}=this.ae.getGate(i),n=(0,r.Ht)(t,n,i),s=null==(s=null==(i=this.Ft)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.ce,e),i=null!=s?s:n;return this.Kt(t,(0,r.Vt)(this.ce,i),e),this.St({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){t=this.ve("dynamic_config",t,e);return this.St({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.ve("experiment",t,e);return this.St({name:"experiment_evaluation",experiment:t}),t}getLayer(e,i){var t=(0,r.DJB2)(e),{evaluation:t,details:n}=this.ae.getLayer(t),n=(0,r.Bt)(e,n,t),s=null==(s=null==(t=this.Ft)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.ce,i);const o=(0,r.zt)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Kt(e,(0,r.Jt)(this.ce,o,t),i)});return this.St({name:"layer_evaluation",layer:o}),o}logEvent(t,e,i){this.Lt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.ce,time:Date.now()}))}he(t,e){this.dataAdapter.getDataAsync(t,e).catch(t=>{r.Log.error("An error occurred after update.",t)})}de(t){this.Lt.reset(),this.ae.reset(),this.ce=(0,r.normalizeUser)(t,this.J.environment)}ve(t,e,i){var n=(0,r.DJB2)(e),{evaluation:n,details:s}=this.ae.getConfig(n),s=(0,r.$t)(e,s,n),n="experiment"===t?null==(t=null==(n=this.Ft)?void 0:n.getExperimentOverride)?void 0:t.call(n,s,this.ce,i):null==(n=null==(t=this.Ft)?void 0:t.getDynamicConfigOverride)?void 0:n.call(t,s,this.ce,i),t=null!=n?n:s;return this.Kt(e,(0,r.qt)(this.ce,t),i),t}}e.default=n},5364:function(t,e,i){var s=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})},n=($Q(e),e.StatsigEvaluationsDataAdapter=void 0,i(4464));const o=i(9400);class r extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.K=null}attach(t,e){super.attach(t,e),this.K=new o.default(null!=e?e:{})}getDataAsync(t,e,i){return this.O(t,e,i)}prefetchData(t,e){return this.T(t,e)}I(e,i){var n;return s(this,void 0,void 0,function*(){var t=yield null==(n=this.K)?void 0:n.fetchEvaluations(this.M(),e,i);return null!=t?t:null})}}e.StatsigEvaluationsDataAdapter=r},5208:(t,e,i)=>{$Q(e),e.StatsigClient=e.StatsigEvaluationsDataAdapter=void 0;var n=i(4520);e.StatsigClient=n.default;const s=i(5364);Object.defineProperty(e,"StatsigEvaluationsDataAdapter",{enumerable:!0,get:function(){return s.StatsigEvaluationsDataAdapter}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigEvaluationsDataAdapter:s.StatsigEvaluationsDataAdapter,StatsigClient:n.default}),e.default=__STATSIG__},2152:function(t,e,i){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.SessionReplay=e.runStatsigSessionReplay=void 0;const s=i(4464),o=i(8264);e.runStatsigSessionReplay=function(t){new r(t)};class r{constructor(t){this._e=t,this.fe=null,this.ge=[];var{sdkKey:e,errorBoundary:i}=t.getContext();this.u=i,this.u.wrap(this),(0,s.an)()&&((i=(0,s.i)()).srInstances=$P($P({},i.srInstances),{[e]:this})),this.dn=this.cn(),this.me=new o.SessionReplayClient,this._e.__on("pre_shutdown",()=>this.ye()),this._e.__on("values_updated",()=>this.pe()),t.on("session_expired",()=>{this.me.stop(),s.StatsigMetadataProvider.add({isRecordingSession:"false"}),this.hn(),this.dn=this.cn()}),(0,s.it)(this.st.bind(this)),this.pe()}st(t){"background"===t&&(this.hn(),this._e.flush().catch(t=>{this.u.logError("SR::visibility",t)}))}Oe(t,e){this.fe=e,this.ge.push(t),2048<JSON.stringify(this.ge).length&&((0,s._t)()?this.vn():this.hn())}pe(){var t=this._e.getContext().values;!0!==(null==t?void 0:t.can_record_session)?this.ye():this.me.isRecording()||(s.StatsigMetadataProvider.add({isRecordingSession:"true"}),this.me.record((t,e)=>this.Oe(t,e)))}ye(){this.me.stop(),s.StatsigMetadataProvider.add({isRecordingSession:"false"}),0!==this.ge.length&&null!=this.fe&&this.vn()}hn(){0!==this.ge.length&&null!=this.fe&&this.dn.then(t=>this._n(t)).catch(t=>{this.u.logError("SR::flush",t)})}_n(t){var e,i=this.fe;null!==i&&0!==this.ge.length&&(e=JSON.stringify(this.ge),this._e.logEvent({eventName:"statsig::session_recording",value:t,metadata:{session_start_ts:String(i.startTime),session_end_ts:String(i.endTime),clicks_captured_cumulative:String(i.clickCount),rrweb_events:e,session_replay_sdk_version:s.SDK_VERSION}}),this.ge=[])}vn(){this.dn=this.cn(),this.hn()}cn(){return n(this,void 0,void 0,function*(){return(yield this._e.getAsyncContext()).sessionID})}}e.SessionReplay=r},8264:(t,e,i)=>{$Q(e),e.SessionReplayClient=void 0;const n=i(8352),s=i(4464);e.SessionReplayClient=class{constructor(){this.we=null,this.Ie=null,this.Ae=0}record(i,t){null==(0,s.Et)()||(this.we=null,this.Ie=null,this.Ae=0,this.Me=t,this.xe)||(this.xe=(t=t=>{var e;null==this.we&&(this.we=t.timestamp),this.Ie=t.timestamp,3!==(e=t).type||2!==e.data.source||2!==e.data.type&&4!==e.data.type||this.Ae++,i(t,{startTime:this.we,endTime:this.Ie,clickCount:this.Ae}),144e5<this.Ie-this.we&&(null!=(e=this.xe)&&e.call(this),this.Me)&&this.Me()},("function"==typeof n?n:n.record)({emit:t})))}stop(){this.xe&&(this.xe(),this.xe=void 0)}isRecording(){return null!=this.xe}}},8392:(t,e,i)=>{$Q(e),e.runStatsigSessionReplay=e.SessionReplay=e.SessionReplayClient=void 0;const n=i(2152),s=(Object.defineProperty(e,"SessionReplay",{enumerable:!0,get:function(){return n.SessionReplay}}),Object.defineProperty(e,"runStatsigSessionReplay",{enumerable:!0,get:function(){return n.runStatsigSessionReplay}}),i(8264));Object.defineProperty(e,"SessionReplayClient",{enumerable:!0,get:function(){return s.SessionReplayClient}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{SessionReplayClient:s.SessionReplayClient,SessionReplay:n.SessionReplay,runStatsigSessionReplay:n.runStatsigSessionReplay})},5536:function(t,e,i){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.AutoCapture=e.runStatsigAutoCapture=void 0;const s=i(4464),o=i(3076);e.runStatsigAutoCapture=function(t){new r(t)};class r{constructor(t){this._e=t,this.De=Date.now(),this.Ee=0;var e,{sdkKey:t,errorBoundary:i}=t.getContext(),i=(this.u=i,this.u.wrap(this),(0,s.Et)());(0,s.an)()&&((e=null!=(e=(__STATSIG__=(0,s.i)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==i?void 0:i.readyState)?i.addEventListener("DOMContentLoaded",()=>this.ke()):this.ke()}Ne(){const e=(0,s.kt)();var t,i=(0,s.Et)();e&&i&&(t=t=>{this.Pe(t||e.event)},(0,o.Ce)(i,"click",t),(0,o.Ce)(i,"submit",t),(0,o.Ce)(e,"error",t),(0,o.Ce)(e,"beforeunload",()=>this.Ge()),(0,o.Ce)(e,"scroll",()=>this.Re()))}Pe(t){var e;let i=null==(e=t.type)?void 0:e.toLowerCase();"error"===i&&t instanceof ErrorEvent?this.Fe(t):(e=(0,o.Le)(t))&&(0,o.rt)(t,e)&&("submit"===i&&(i="form_submit"),{value:t,metadata:e}=(0,o.Ue)(e),this.Ke(i,t,e))}ke(){this.Ne(),this.Je(),this.qe()}Fe(t){var e=(null==t?void 0:t.error)||{};let i=e;if("object"==typeof e)try{i=JSON.stringify(e)}catch(t){i="function"==typeof(null==e?void 0:e.toString)?e.toString():"Unknown Error"}this.Ke("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:i})}Je(){setTimeout(()=>{var t,e=(0,o.Ve)();this.ze("page_view",(0,o.Be)(),{title:null==(t=(0,s.Et)())?void 0:t.title,queryParams:Object.fromEntries(e.searchParams)})},1)}qe(){const i=(0,s.kt)();void 0!==(null===i||void 0===i?void 0:i.performance)&&"function"==typeof i.performance.getEntriesByType&&"function"==typeof i.performance.getEntriesByName&&setTimeout(()=>{var t={},e=i.performance.getEntriesByType("navigation"),e=(e&&0<e.length&&e[0]instanceof PerformanceNavigationTiming&&(e=e[0],t.load_time_ms=e.duration,t.dom_interactive_time_ms=e.domInteractive-e.startTime,t.redirect_count=e.redirectCount,t.transfer_bytes=e.transferSize),i.performance.getEntriesByName("first-contentful-paint"));e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),this.Ke("performance",(0,o.Be)(),t)},1)}Ge(){this.ze("page_view_end",(0,o.Be)(),{scrollDepth:this.Ee,pageViewLength:Date.now()-this.De})}Ke(e,i,n){this.cn().then(t=>{t={eventName:"auto_capture::"+e,value:i,metadata:$P({sessionID:t,page_url:null!=(t=null==(t=null==(t=(0,s.kt)())?void 0:t.location)?void 0:t.href)?t:""},n)};this._e.logEvent(t)}).catch(t=>{this.u.logError("AC::enqueue",t)})}ze(t,e,i){this.Ke(t,e,i),this._e.flush().catch(t=>{s.Log.error(t)})}Re(){var t=null!=(t=null==(t=(0,s.Et)())?void 0:t.body.scrollHeight)?t:1,e=(0,s.kt)(),i=null!=(i=null==e?void 0:e.scrollY)?i:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.Ee=Math.max(this.Ee,Math.min(100,Math.round((i+e)/t*100)))}cn(){return n(this,void 0,void 0,function*(){return(yield this._e.getAsyncContext()).sessionID})}}e.AutoCapture=r},3076:(t,e,i)=>{$Q(e),e.Ce=e.Be=e.Ve=e.rt=e.Le=e.Ue=void 0;const n=i(4464);function o(e){if(e){let t=e;for(;t;){var i=t.tagName.toLowerCase();if(["body","document"].includes(i))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.Ue=function(t){var e=t.tagName.toLowerCase(),i={},n=e,s=("form"===e&&(i.action=t.getAttribute("action"),i.method=null!=(s=t.getAttribute("method"))?s:"GET",i.formName=t.getAttribute("name"),i.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(i.content=t.value,i.inputName=t.getAttribute("name")),"button"===e&&(i.content=(t.textContent||"").trim()),o(t));return s&&(i.href=s.getAttribute("href")),{value:n,metadata:i}},e.Le=function(t){if(!t)return null;let e=t.target||t.srcElement;return e&&e instanceof Element?e=3===e.nodeType?e.parentNode||null:e:null},e.rt=function(t,e){if(!t||!e||1!==e.nodeType)return!1;var i=e.tagName.toLowerCase(),n=t.type.toLowerCase();switch(i){case"html":return!1;case"form":return"submit"===n;case"input":case"select":case"textarea":return["change"].includes(n);default:if("click"===n){if("button"===i)return!0;if(o(e))return!0}return!1}},e.Ve=function(){var t=null!=(t=null==(t=null==(t=(0,n.kt)())?void 0:t.location)?void 0:t.href)?t:"";let e;try{e=new URL(t)}catch(t){e=new URL("error:")}return e},e.Be=function(){return(0,n.ln)()||""},e.Ce=function(t,e,i){t&&t.addEventListener&&t.addEventListener(e,i,!0)}},6824:(t,e,i)=>{$Q(e),e.runStatsigAutoCapture=e.AutoCapture=void 0;const n=i(5536);Object.defineProperty(e,"AutoCapture",{enumerable:!0,get:function(){return n.AutoCapture}}),Object.defineProperty(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return n.runStatsigAutoCapture}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:n.AutoCapture,runStatsigAutoCapture:n.runStatsigAutoCapture}),e.default=__STATSIG__}},n={};function s(t){var e=n[t];return void 0!==e||(e=n[t]={exports:{}},i[t].call(e.exports,e,e.exports,s)),e.exports}s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var t={};{var e=t;const r=s(8392),u=s(6824);var o=s(9920);e.default=__STATSIG__,o.AutoInit.attempt(({client:t})=>{new r.SessionReplay(t),new u.AutoCapture(t)})}return t.default})());
8
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("rrwebRecord")):"function"==typeof define&&define.amd?define(["rrwebRecord"],e):"object"==typeof exports?exports.Statsig=e(require("rrwebRecord")):t.Statsig=e(t.rrwebRecord)}(this,l=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $P = (a,b) => Object.assign(a,b);var i={8352:t=>{t.exports=l},5496:(t,e,i)=>{$Q(e),e.t=e.i=void 0,e.i=()=>null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:u;e.t=t=>{var e;return t?null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:e[t]:null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.lastInstance};var n,s="__STATSIG__",o="undefined"!=typeof window?window:{},i=void 0!==i.g?i.g:{},r="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=o[s])?n:i[s])?n:r[s])?n:{instance:e.t};o[s]=u,i[s]=u,r[s]=u},5856:(t,e)=>{$Q(e)},2320:function(t,e,i){var o=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.DataAdapterCore=void 0;const n=i(8512),r=i(6780),s=i(6283),u=i(6296),l=i(3444),a=i(2412);e.DataAdapterCore=class{constructor(t,e){this.o=t,this.u=e,this.l=null,this.h=null,this.v={},this._="statsig.last_modified_time."+e}attach(t,e){this.h=t,this.l=new n.ErrorBoundary(t)}getDataSync(t){var t=this.m(t),e=this.v[t];return e||((e=this.p(t))?(this.S(t,e),this.v[t]):null)}setData(t,e){e=this.m(e);this.S(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.v=$P($P({},this.v),t)}O(e,i,n){var s;return o(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(i),t=[this.j(null!=(s=null==t?void 0:t.data)?s:null,i)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(r.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}T(i,n){return o(this,void 0,void 0,function*(){var t=this.m(i),e=yield this.O(null,i,n);e&&this.S(t,$P($P({},e),{source:"Prefetch"}))})}j(n,s){return o(this,void 0,void 0,function*(){var t=yield this.I(n,s);if(!t)return r.Log.debug("No response returned for latest value"),null;var e=(0,a.typedJsonParse)(t,"has_updates","Failure while attempting to persist latest value");let i=null;return!0===(null==e?void 0:e.has_updates)?i={source:"Network",data:t,receivedAt:Date.now()}:n&&!1===(null==e?void 0:e.has_updates)&&(i={source:"NetworkNotModified",data:n,receivedAt:Date.now()}),i?(t=this.m(s),this.S(t,i),yield this.A(t,i),i):null})}M(){return null!=this.h?this.h:(r.Log.error(this.o+" is not attached to a Client"),"")}m(t){t=(0,u.getUserStorageKey)(this.M(),t);return`${s.DataAdapterCachePrefix}.${this.u}.`+t}S(t,e){var i=Object.entries(this.v);i.length<10||([i]=i.reduce((t,e)=>e[1]<t[1]?e:t),delete this.v[i]),this.v[t]=e}p(t){var e=null==(e=l.Storage.D)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,a.typedJsonParse)(e,"source","Failed to parse cached result"))?$P($P({},t),{source:"Cache"}):null}A(t,e){return o(this,void 0,void 0,function*(){yield l.Storage.P(t,JSON.stringify(e)),yield this.k(t)})}k(i){var n;return o(this,void 0,void 0,function*(){var t=null!=(n=yield(0,l.N)(this._))?n:{},e=(t[i]=Date.now(),Object.entries(t));e.length<=10||(delete t[(e=e.reduce((t,e)=>e[1]<t[1]?e:t))[0]],yield l.Storage.C(e[0])),yield(0,l.G)(this._,t)})}}},4280:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},184:(t,e)=>{$Q(e)},8512:function(t,u,e){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};Object.defineProperty(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const n=e(6780),l=e(7360),a=e(6972);u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";u.ErrorBoundary=class{constructor(t,e){this.h=t,this.F=e,this.R=new Set}wrap(n){try{const t=n;!function(t){const e=new Set;let i=Object.getPrototypeOf(t);for(;i&&i!==Object.prototype;)Object.getOwnPropertyNames(i).filter(t=>"function"==typeof(null===i||void 0===i?void 0:i[t])).forEach(t=>e.add(t)),i=Object.getPrototypeOf(i);return Array.from(e)}(t).forEach(e=>{const i=t[e];"$EB"in i||(t[e]=(...t)=>this.capture(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.U("eb:wrap",t)}}capture(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.U(e,t)):i}catch(t){return this.U(e,t),null}}logError(t,e){this.U(t,e)}U(o,r){try{n.Log.warn("Caught error in "+o,{error:r});i(this,void 0,void 0,function*(){var t,e,i=null!=r?r:Error("[Statsig] Error was empty"),n=i instanceof Error,s=n?i.name:"No Name";this.R.has(s)||(this.R.add(s),t=l.SDKType.K(this.h),e=a.StatsigMetadataProvider.get(),n=n?i.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(i),i=JSON.stringify($P({tag:o,exception:s,info:n},$P($P({},e),{sdkType:t}))),yield fetch(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.h,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:i}),null!=(s=this.F)&&s.call(this,{name:"error",error:r}))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},6788:(t,e)=>{$Q(e)},6728:function(t,e,i){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.EventLogger=void 0;const s=i(7832),o=i(6780),r=i(5256),u=i(3452),l=i(6048),a=i(1876),c=i(3444),d=i(2412),h=i(84),v=i(100),_={},f=t=>{null!=(t=_[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,i,n){this.h=e,this.F=t,this.L=i,this.J=n,this.V=[],this.q={},this.B={},this.$=!1,this.H=Date.now(),(_[e]=this).Y=!0===(null==n?void 0:n.disableLogging),this.W=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;t=null!=(i=null==n?void 0:n.loggingIntervalMs)?i:1e4;const s=setInterval(()=>{_[e]?f(e):clearInterval(s)},t);this.X=s;i=null==n?void 0:n.networkConfig;this.tt=(0,h.et)(null==i?void 0:i.logEventUrl,null==i?void 0:i.api,"/rgstr",r.NetworkDefault.eventsApi),this.nt=(0,h.et)(null==i?void 0:i.logEventBeaconUrl,null==i?void 0:i.api,"/log_event_beacon",r.NetworkDefault.eventsApi),(0,v.it)(t=>{"background"===t&&f(e)}),this.st()}setLoggingDisabled(t){this.Y=t}enqueue(t){this.rt(t)&&(this.ut(t),this.lt(),this.V.length>this.W)&&f(this.h)}incrementNonExposureCount(t){var e=null!=(e=this.B[t])?e:0;this.B[t]=e+1}reset(){this.q={}}shutdown(){return n(this,void 0,void 0,function*(){this.X&&(clearInterval(this.X),this.X=null),yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;this.ct(),0!==this.V.length&&(t=this.V,this.V=[],yield this.dt(t))})}lt(){this.$||(this.$=!0,200<Date.now()-this.H)||setTimeout(()=>f(this.h),200)}rt(t){if((0,a.ht)(t)){var t=[t.eventName,null==(e=t.user)?void 0:e.userID,null==(e=t.metadata)?void 0:e.gate,null==(e=t.metadata)?void 0:e.config,null==(e=t.metadata)?void 0:e.ruleID].join("|"),e=this.q[t],i=Date.now();if(e&&i-e<6e4)return!1;1e3<Object.keys(this.q).length&&(this.q={}),this.q[t]=i}return!0}dt(t){return n(this,void 0,void 0,function*(){if(this.Y)this.vt(t);else try{(!(0,v._t)()&&this.L.isBeaconSupported()?yield this.ft(t):yield this.gt(t)).success?this.F({name:"logs_flushed",events:t}):this.vt(t)}catch(t){o.Log.warn("Failed to flush events.")}})}gt(e){return n(this,void 0,void 0,function*(){var t=yield this.L.post({sdkKey:this.h,data:{events:e},url:this.tt,retries:3,params:{[u.NetworkParam.EventCount]:String(e.length)}}),t=null!=t&&t.body?(0,d.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}ft(t){return n(this,void 0,void 0,function*(){return{success:yield this.L.beacon({sdkKey:this.h,data:{events:t},url:this.nt})}})}vt(t){for(;500<t.length;)t.shift();var e=this.bt();(0,c.G)(e,t).catch(()=>{o.Log.warn("Unable to save failed logs to storage")})}st(){const e=this.bt();n(this,void 0,void 0,function*(){var t=yield(0,c.N)(e);t&&(yield c.Storage.C(e),yield this.dt(t))}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}bt(){return"statsig.failed_logs."+(0,s.DJB2)(this.h)}ut(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.yt();i&&(e.statsigMetadata={currentPage:i}),this.V.push($P($P({},t),e))}ct(){0!==Object.keys(this.B).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.B)}}),this.B={})}yt(){var t;if(!1!==(null==(t=this.J)?void 0:t.includeCurrentPageUrlWithEvents))return(0,l.St)()}}},7832:(t,e)=>{$Q(e),e.DJB2Object=e.DJB2=void 0;e.DJB2=e=>{let i=0;for(let t=0;t<e.length;t++){var n=e.charCodeAt(t);i=(i<<5)-i+n,i&=i}return String(i>>>0)};e.DJB2Object=t=>(0,e.DJB2)(JSON.stringify(s(t)));const s=i=>{if(null==i)return null;var t=Object.keys(i).sort();const n={};return t.forEach(t=>{let e=i[t];e instanceof Object&&(e=s(e)),n[t]=e}),n}},9664:(t,e)=>{$Q(e)},6780:(t,e)=>{function i(t){return t.unshift("[Statsig]"),t}var n,s;$Q(e),e.Log=e.LogLevel=void 0,(s=n||(e.LogLevel=n={}))[s.None=0]="None",s[s.Error=1]="Error",s[s.Warn=2]="Warn",s[s.Info=3]="Info",s[s.Debug=4]="Debug";class o{static info(...t){this.level>=n.Info&&console.info(...i(t))}static debug(...t){this.level>=n.Debug&&console.debug(...i(t))}static warn(...t){this.level>=n.Warn&&console.warn(...i(t))}static error(...t){this.level>=n.Error&&console.error(...i(t))}}(e.Log=o).level=n.Error},3188:function(t,e,i){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.NetworkCore=void 0,i(5496);const h=i(4280),v=i(6780),s=i(3452),o=i(7360),r=i(8612),u=i(1604),l=i(6972);e.NetworkCore=class{constructor(t,e){this.J=t,this.F=e,this.Ot=null!=(t=null==(e=null==t?void 0:t.networkConfig)?void 0:e.networkTimeoutMs)?t:1e4}post(e){return n(this,void 0,void 0,function*(){var t=yield this.jt(e);return this.Tt($P({method:"POST",body:this.wt(e,t)},e))})}get(t){return this.Tt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(i){return n(this,void 0,void 0,function*(){var t,e;return!!_(i)&&(t=yield this.It(i),e=yield this.jt(i),navigator.sendBeacon(t,e))})}Tt(c){var d;return n(this,void 0,void 0,function*(){if(!_(c))return null;var{method:e,body:i,retries:n}=c;const s=new AbortController;var t=setTimeout(()=>s.abort(`Timeout of ${this.Ot}ms expired.`),this.Ot),o=yield this.It(c),r=null;try{var u,l,a,r=yield fetch(o,{method:e,body:i,headers:$P({},c.headers),signal:s.signal});if(clearTimeout(t),r.ok)return a=yield r.text(),h.Diagnostics.mark(),{body:a,code:r.status};throw u=yield r.text().catch(()=>"No Text"),(l=new Error(`Failed to fetch: ${o} `+u)).name="NetworkError",l}catch(t){i=function(t,e){if(t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return null}(s,t);return h.Diagnostics.mark(),!n||n<=0?(null!=(d=this.F)&&d.call(this,{name:"error",error:t}),v.Log.error(`A networking error occured during ${e} request to ${o}.`,i,t),null):this.Tt($P($P({},c),{retries:n-1}))}})}It(e){return n(this,void 0,void 0,function*(){var t=$P({[s.NetworkParam.SdkKey]:e.sdkKey,[s.NetworkParam.SdkType]:o.SDKType.K(e.sdkKey),[s.NetworkParam.SdkVersion]:l.SDK_VERSION,[s.NetworkParam.Time]:String(Date.now()),[s.NetworkParam.SessionID]:yield r.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}jt(s){return n(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=s,i=yield u.StableID.get(e),n=yield r.SessionID.get(e),e=o.SDKType.K(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},l.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:e})}))})}wt(t,e){var i;return!(null!=(null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__["no-encode"])||null!=(i=this.J)&&i.disableStatsigEncoding)&&t.isStatsigEncodable&&"undefined"!=typeof window&&window.btoa&&(t.params=$P($P({},null!=(i=t.params)?i:{}),{[s.NetworkParam.StatsigEncoded]:"1"}),null!=(t=window.btoa(e).split("").reverse().join("")))?t:e}};const _=t=>!!t.sdkKey||(v.Log.warn("Unable to make request without an SDK key"),!1)},5256:(t,e)=>{$Q(e),e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://events.statsigapi.net/v1",initializeApi:"https://featuregates.org/v1",specsApi:"https://api.statsigcdn.com/v1"}},3452:(t,e)=>{$Q(e),e.NetworkParam=void 0,e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se"}},4264:(t,e)=>{$Q(e)},7360:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={K:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},At(t,e){i[t]=e},xt(t){n&&"-react"!==n||(n="-"+t)}}},6048:(t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.St=n.Mt=n.Dt=n.Et=n.Pt=n.kt=void 0;n.kt=()=>"undefined"!=typeof window?window:null,n.Pt=()=>{var t=(0,n.kt)();return null!=(t=null==t?void 0:t.document)?t:null},n.Et=()=>null!=(0,n.Pt)(),n.Dt=(t,e)=>{var i=(0,n.kt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.Mt=(t,e)=>{var i=(0,n.Pt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.St=()=>{var t;try{return null==(t=(0,n.kt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},8612:function(t,r,e){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};Object.defineProperty(r,"__esModule",{value:!0}),r.SessionID=void 0;const n=e(7832),u=e(6780),l=e(3444),a=e(3556),c={},d={},h={};function v(t){return"statsig.session_id."+(0,n.DJB2)(t)}r.SessionID={get:t=>null!=h[t]?h[t]:h[t]=r.SessionID.Nt(t),Nt:o=>i(void 0,void 0,void 0,function*(){let e=c[o];var i=Date.now();if(null==e){let t=yield function(t){t=v(t);return(0,l.N)(t)}(o);null==t&&(t={sessionID:(0,a.getUUID)(),startTime:i,lastUpdate:i}),e=t,c[o]=e}var t=null!=(t=d[o])?t:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:()=>{}},n=((144e5<i-e.startTime||18e5<i-e.lastUpdate)&&(e.sessionID=(0,a.getUUID)(),e.startTime=i),e.lastUpdate=i,e),s=o;return s=v(o),(0,l.G)(s,n).catch(()=>{u.Log.warn("Failed to save SessionID")}),t.idleTimeoutID=r.SessionID.Ct(t,t.idleTimeoutID,18e5),t.ageTimeoutID=r.SessionID.Ct(t,t.ageTimeoutID,144e5-(i-e.startTime)),c[o]=e,d[o]=t,h[o]=null,e.sessionID}),Gt:(t,e)=>{var i=null!=(i=d[e])?i:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:t};i.emitFunction=t,d[e]=i},Ct:(t,e,i)=>(clearTimeout(null!=e?e:void 0),setTimeout(t.emitFunction,i))}},1604:function(t,e,i){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.StableID=void 0;const s=i(7832),o=i(6780),r=i(3444),u=i(3556),l={};function a(t){return"statsig.stable_id."+(0,s.DJB2)(t)}function c(t,e){e=a(e);(0,r.G)(e,t).catch(()=>{o.Log.warn("Failed to save StableID")})}e.StableID={get:e=>n(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,r.N)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},7688:function(t,e,i){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.StatsigClientBase=void 0,i(5496);const l=i(5496),a=i(8512),c=i(6728),d=i(6780),h=i(6048),v=i(8612),_=i(1604),f=i(3444);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.Ft={};var s,o=this.Rt.bind(this),r=(0,l.i)(),u=null!=(u=r.instances)?u:{};null!=n&&n.logLevel&&(d.Log.level=null==n?void 0:n.logLevel),null!=n&&n.disableStorage&&f.Storage.Ut(!0),null!=n&&n.overrideStableID&&_.StableID.setOverride(n.overrideStableID,t),this.l=new a.ErrorBoundary(t,o),this.l.wrap(this),this.l.wrap(i),this.l.wrap(e),this.h=t,this.J=null!=n?n:{},this.Kt=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Lt=new c.EventLogger(t,o,i,n),v.SessionID.Gt(()=>{this.Rt({name:"session_expired"})},t),null!=u[t]&&(0,h.Et)()&&d.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),u[t]=this,r.lastInstance=this,r.instances=u,__STATSIG__=r,this.dataAdapter=e,this.dataAdapter.attach(t,n)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.J.disableLogging=t.disableLogging,this.Lt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.J.disableStorage=t.disableStorage,f.Storage.Ut(t.disableStorage))}flush(){return this.Lt.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.Rt({name:"pre_shutdown"}),yield this.Lt.shutdown()})}on(t,e){this.Ft[t]||(this.Ft[t]=[]),this.Ft[t].push(e)}off(t,e){this.Ft[t]&&-1!==(e=this.Ft[t].indexOf(e))&&this.Ft[t].splice(e,1)}__on(t,e){e.__isInternal=!0,this.on(t,e)}Rt(i){var t;const e=e=>{try{e(i)}catch(t){!0===e.__isInternal?this.l.logError("_emit:"+i.name,t):d.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Ft[i.name]&&this.Ft[i.name].forEach(t=>e(t)),null!=(t=this.Ft["*"])&&t.forEach(e)}Jt(t,e){this.loadingStatus=t,this.Rt({name:"values_updated",status:t,values:e})}Vt(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.Lt.incrementNonExposureCount(t):this.Lt.enqueue(e)}}},5808:(t,e)=>{$Q(e)},6283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},1876:(t,e)=>{$Q(e),e.qt=e.zt=e.Bt=e.ht=void 0;const i="statsig::config_exposure",n="statsig::gate_exposure",l=(t,e,i,n,s)=>({eventName:t,user:e,value:null,metadata:o(i,n),secondaryExposures:s,time:Date.now()});e.ht=({eventName:t})=>t===n||t===i,e.Bt=(t,e)=>{return l(n,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.zt=(t,e)=>{return l(i,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.qt=(t,e,i)=>{var n,s=e.__evaluation,o=!0===(null==(o=null==s?void 0:s.explicit_parameters)?void 0:o.includes(i));let r="",u=null!=(n=null==s?void 0:s.undelegated_secondary_exposures)?n:[];return o&&(r=null!=(n=s.allocated_experiment_name)?n:"",u=s.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(o)},u)};const o=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},6972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="0.0.1-beta.35";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},3384:(t,e)=>{$Q(e)},6396:(t,e)=>{$Q(e),e.$t=e.Ht=e.Yt=e.Wt=void 0;const s="default";function o(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:s,__evaluation:i,value:n}}function r(o,r){return(t,e)=>{var i,n,s=null!=(s=null==o?void 0:o[t])?s:null;return null==s||null!=e&&(i=e,(n=t=>Array.isArray(t)?"array":typeof t)(s)!==n(i))?null!=e?e:null:(null!=r&&r(t),s)}}e.Wt=function(t,e,i){return o(t,e,i,!0===(null==i?void 0:i.value))},e.Yt=function(t,e,i){return $P($P({},o(t,e,i,null!=(t=null==i?void 0:i.value)?t:{})),{groupName:null,get:r(null==i?void 0:i.value)})},e.Ht=function(t,e,i,n){return $P($P({},o(t,e,i,void 0)),{get:r(null==i?void 0:i.value,n),groupName:null!=(t=null==i?void 0:i.group_name)?t:null,__value:null!=(e=null==i?void 0:i.value)?e:{}})},e.$t=function(t,e,i,n){return $P($P($P({},t),e),{get:r(i,n)})}},9136:(t,e)=>{$Q(e)},6296:(t,e,i)=>{$Q(e),e.getUnitIDFromUser=e.getUserStorageKey=e.normalizeUser=void 0;const n=i(7832);e.normalizeUser=function(t,e){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&(i.statsigEnvironment=e),i}catch(t){throw new Error("User object must be convertable to JSON string.")}},e.getUserStorageKey=function(t,e){return(0,n.DJB2Object)({sdkKey:t,user:e})},e.getUnitIDFromUser=function(t,e){var i;return"string"==typeof e&&"userid"!==e.toLowerCase()?null!=(i=null==(i=t.customIDs)?void 0:i[e])?i:null==(i=null==t?void 0:t.customIDs)?void 0:i[e.toLowerCase()]:t.userID}},3444:function(t,e,i){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})},i=($Q(e),e.G=e.N=e.Storage=void 0,i(6780));const s={},o={Qt:()=>"InMemory",D(t){return null!=(t=s[t])?t:null},Xt(t){return Promise.resolve(null!=(t=s[t])?t:null)},P(t,e){return s[t]=e,Promise.resolve()},C(t){return delete s[t],Promise.resolve()},Zt(){return Promise.resolve(Object.keys(s))}};let r=null;try{"undefined"!=typeof window&&"localStorage"in window&&(r={Qt:()=>"LocalStorage",D(t){return localStorage.getItem(t)},Xt(t){return Promise.resolve(localStorage.getItem(t))},P(t,e){return localStorage.setItem(t,e),Promise.resolve()},C(t){return localStorage.removeItem(t),Promise.resolve()},Zt(){var t=Object.keys(localStorage);return Promise.resolve(t)}})}catch(t){i.Log.warn("Failed to setup localStorageProvider.")}let u=null!==r&&void 0!==r?r:o,l=u;e.Storage={Qt:()=>l.Qt(),Xt:t=>l.Xt(t),P:(t,e)=>l.P(t,e),C:t=>l.C(t),Zt:()=>l.Zt(),D:t=>{var e;return null!=(e=null==(e=l.D)?void 0:e.call(l,t))?e:null},te:t=>{u=t,l=t},Ut:t=>{l=t?o:u}},e.N=function(e){return n(this,void 0,void 0,function*(){var t=yield l.Xt(e);return JSON.parse(null!=t?t:"null")})},e.G=function(t,e){return n(this,void 0,void 0,function*(){yield l.P(t,JSON.stringify(e))})}},2412:(t,e,i)=>{$Q(e),e.typedJsonParse=void 0;const s=i(6780);e.typedJsonParse=function(t,e,i){try{var n=JSON.parse(t);return"object"==typeof n&&0 in n,n}catch(t){}return s.Log.error(i),null}},3556:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let i=(new Date).getTime(),n="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<i?(e=(i+e)%16|0,i=Math.floor(i/16)):(e=(n+e)%16|0,n=Math.floor(n/16)),("x"===t?e:7&e|8).toString(16)})}},84:(t,e)=>{$Q(e),e.et=void 0,e.et=function(t,e,i,n){return t||(e?""+e+i:""+n+i)}},1539:(t,e)=>{$Q(e)},100:(t,e,i)=>{$Q(e),e.ee=e.it=e._t=void 0;i=i(6048);const n="foreground",s="background",o=[];let r=n;e._t=()=>r===n,e.it=t=>{o.unshift(t)};e.ee=e=>{e!==r&&(r=e,o.forEach(t=>t(e)))},(0,i.Dt)("focus",()=>(0,e.ee)(n)),(0,i.Dt)("blur",()=>(0,e.ee)(s)),(0,i.Dt)("beforeunload",()=>(0,e.ee)(s)),(0,i.Mt)("visibilitychange",()=>{(0,e.ee)("visible"===document.visibilityState?n:s)})},4464:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};$Q(e),e.Log=e.Storage=e.EventLogger=void 0,i(5496);const o=i(6728),r=(Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(6780));Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return r.Log}});var u=i(6972);const l=i(3444);Object.defineProperty(e,"Storage",{enumerable:!0,get:function(){return l.Storage}});var a=i(3556);s(i(5496),e),s(i(5856),e),s(i(2320),e),s(i(184),e),s(i(8512),e),s(i(500),e),s(i(6788),e),s(i(7832),e),s(i(9664),e),s(i(6780),e),s(i(3452),e),s(i(3188),e),s(i(5256),e),s(i(4264),e),s(i(6048),e),s(i(7360),e),s(i(8612),e),s(i(1604),e),s(i(7688),e),s(i(5808),e),s(i(6283),e),s(i(1876),e),s(i(6972),e),s(i(3384),e),s(i(6396),e),s(i(9136),e),s(i(6296),e),s(i(3444),e),s(i(2412),e),s(i(84),e),s(i(1539),e),s(i(3556),e),s(i(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:o.EventLogger,Log:r.Log,getUUID:a.getUUID,Storage:l.Storage,SDK_VERSION:u.SDK_VERSION})},9920:(t,e,i)=>{$Q(e),e.AutoInit=void 0;const d=i(4464),h=i(5208);function v(t,e){var i;return null!=(i=e.get(t))?i:e.get(t.toLowerCase())}e.AutoInit=class{static attempt(e){var t,i,n;try{var s=(0,d.kt)(),o=(0,d.Pt)();if(s&&o&&o.currentScript){var r=o.currentScript.getAttribute("src"),u=null==(t=s.location)?void 0:t.href;if(r&&u){var l=new URL(r,u).searchParams,a=null!=(i=v("sdkKey",l))?i:v("apiKey",l);if(a){var c=null==(n=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:n[a];let t=null;(t=c instanceof h.StatsigClient?c:t)||(t=new h.StatsigClient(a,{})).initializeAsync().catch(t=>{d.Log.error(t)}),e({sdkKey:a,client:t})}}}}catch(t){d.Log.error("AutoInit failed",t)}}}},3096:(t,e,i)=>{$Q(e),e.resolveDeltasResponse=void 0;const n=i(4464);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.resolveDeltasResponse=function(t,e){var i;return(e=(0,n.typedJsonParse)(e,"checksum","Failed to parse DeltasEvaluationResponse"))?(t=t,i=e,t=$P($P($P({},t),i),{feature_gates:$P($P({},t.feature_gates),i.feature_gates),layer_configs:$P($P({},t.layer_configs),i.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),i.dynamic_configs)}),s((t=i=t).deleted_gates,t.feature_gates),delete t.deleted_gates,s(i.deleted_configs,t.dynamic_configs),delete t.deleted_configs,s(i.deleted_layers,t.layer_configs),delete t.deleted_layers,i=t,(t=(0,n.DJB2Object)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs}))===e.checksum?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},1536:(t,e,i)=>{$Q(e);const n=i(4464);e.default=class{constructor(){this.ne=null,this.ie=null,this.oe="Uninitialized",this.se=0,this.re=0}getValues(){return this.ne?(0,n.typedJsonParse)(this.ne,"has_updates","Failed to parse EvaluationStoreValues"):null}reset(){this.ie=null,this.ne=null,this.oe="Loading",this.se=0,this.re=0}finalize(){this.ie||(this.oe="NoValues")}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=(0,n.typedJsonParse)(t.data,"has_updates","Failed to parse EvaluationResponse"))?void 0:e.has_updates)&&(this.ne=t.data,this.se=e.time,this.re=t.receivedAt,this.oe=t.source,this.ie=e)}getGate(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.feature_gates[t])?e:null;return this.ue(t)}getConfig(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.dynamic_configs[t])?e:null;return this.ue(t)}getLayer(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.layer_configs[t])?e:null;return this.ue(t)}ue(t){return{evaluation:t,details:this.le(null==t)}}le(t){return"Uninitialized"===this.oe||"NoValues"===this.oe?{reason:this.oe}:{reason:this.oe+":"+(t?"Unrecognized":"Recognized"),lcut:this.se,receivedAt:this.re}}}},9400:function(t,e,i){var o=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e);const r=i(4464),u=i(3096);class n extends r.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.ae=(0,r.et)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",r.NetworkDefault.initializeApi)}fetchEvaluations(i,n,s){return o(this,void 0,void 0,function*(){var t=n?(0,r.typedJsonParse)(n,"has_updates","Failed to parse cached EvaluationResponse"):null;let e={user:s,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.ce(i,t,e)})}ce(e,i,n){var s;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.ae,data:n,retries:2,isStatsigEncodable:!0});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(s=null==t?void 0:t.body)?s:null:!0!==(null==i?void 0:i.has_updates)||!0!==(null==(s=t.body)?void 0:s.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,u.resolveDeltasResponse)(i,t.body))?t:this.ce(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}))})}}e.default=n},4520:function(t,e,i){var s=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e);const r=i(4464),o=i(1536),u=i(9400),l=i(5364);class n extends r.StatsigClientBase{static instance(t){var e=(0,r.i)().instance(t);return e instanceof n?e:(r.Log.warn("Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){r.SDKType.At(t,"javascript-client");var n=new u.default(i,t=>{this.Rt(t)});super(t,null!=(t=null==i?void 0:i.dataAdapter)?t:new l.StatsigEvaluationsDataAdapter,n,i),this.de=new o.default,this.he=e}initializeSync(){this.updateUserSync(this.he)}initializeAsync(t){return this.updateUserAsync(this.he,t)}updateUserSync(t){this.ve(t);t=this.dataAdapter.getDataSync(this.he);this.de.setValuesFromDataAdapter(t),this.de.finalize(),this.Jt("Ready",t),this._e(null!=t?t:null,this.he)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.ve(i);var t=this.he,e=this.dataAdapter.getDataSync(t);this.Jt("Loading",e),this.de.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.he&&this.de.setValuesFromDataAdapter(e),this.de.finalize(),this.Jt("Ready",e)})}getContext(){return{sdkKey:this.h,options:this.J,values:this.de.getValues(),user:JSON.parse(JSON.stringify(this.he)),errorBoundary:this.l}}getAsyncContext(){return s(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{sessionID:yield r.SessionID.get(this.h),stableID:yield r.StableID.get(this.h)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var i=(0,r.DJB2)(t),{evaluation:i,details:n}=this.de.getGate(i),n=(0,r.Wt)(t,n,i),s=null==(s=null==(i=this.Kt)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.he,e),i=null!=s?s:n;return this.Vt(t,(0,r.Bt)(this.he,i),e),this.Rt({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){t=this.fe("dynamic_config",t,e);return this.Rt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.fe("experiment",t,e);return this.Rt({name:"experiment_evaluation",experiment:t}),t}getLayer(e,i){var t=(0,r.DJB2)(e),{evaluation:t,details:n}=this.de.getLayer(t),n=(0,r.Ht)(e,n,t),s=null==(s=null==(t=this.Kt)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.he,i);const o=(0,r.$t)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Vt(e,(0,r.qt)(this.he,o,t),i)});return this.Rt({name:"layer_evaluation",layer:o}),o}logEvent(t,e,i){this.Lt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.he,time:Date.now()}))}_e(t,e){this.dataAdapter.getDataAsync(t,e).catch(t=>{r.Log.error("An error occurred after update.",t)})}ve(t){this.Lt.reset(),this.de.reset(),this.he=(0,r.normalizeUser)(t,this.J.environment)}fe(t,e,i){var n=(0,r.DJB2)(e),{evaluation:n,details:s}=this.de.getConfig(n),s=(0,r.Yt)(e,s,n),n="experiment"===t?null==(t=null==(n=this.Kt)?void 0:n.getExperimentOverride)?void 0:t.call(n,s,this.he,i):null==(n=null==(t=this.Kt)?void 0:t.getDynamicConfigOverride)?void 0:n.call(t,s,this.he,i),t=null!=n?n:s;return this.Vt(e,(0,r.zt)(this.he,t),i),t}}e.default=n},5364:function(t,e,i){var s=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})},n=($Q(e),e.StatsigEvaluationsDataAdapter=void 0,i(4464));const o=i(9400);class r extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.L=null}attach(t,e){super.attach(t,e),this.L=new o.default(null!=e?e:{})}getDataAsync(t,e,i){return this.O(t,e,i)}prefetchData(t,e){return this.T(t,e)}I(e,i){var n;return s(this,void 0,void 0,function*(){var t=yield null==(n=this.L)?void 0:n.fetchEvaluations(this.M(),e,i);return null!=t?t:null})}}e.StatsigEvaluationsDataAdapter=r},5208:(t,e,i)=>{$Q(e),e.StatsigClient=e.StatsigEvaluationsDataAdapter=void 0;var n=i(4520);e.StatsigClient=n.default;const s=i(5364);Object.defineProperty(e,"StatsigEvaluationsDataAdapter",{enumerable:!0,get:function(){return s.StatsigEvaluationsDataAdapter}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigEvaluationsDataAdapter:s.StatsigEvaluationsDataAdapter,StatsigClient:n.default}),e.default=__STATSIG__},2152:function(t,e,i){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.SessionReplay=e.runStatsigSessionReplay=void 0;const s=i(4464),o=i(8264);e.runStatsigSessionReplay=function(t){new r(t)};class r{constructor(t){this.ge=t,this.$e=null,this.He=[];var{sdkKey:t,errorBoundary:e}=t.getContext();this.l=e,this.l.wrap(this),(0,s.Et)()&&((e=(0,s.i)()).srInstances=$P($P({},e.srInstances),{[t]:this})),this.We=this.Ne(),this.Ye=new o.SessionReplayClient,this.ge.__on("pre_shutdown",()=>this.Qe()),this.ge.__on("values_updated",()=>this.Xe()),this.ge.on("session_expired",()=>{this.Ye.stop(),s.StatsigMetadataProvider.add({isRecordingSession:"false"}),this.Ze(),this.We=this.Ne()}),this.li(),this.Xe()}li(){const i=this.ge.getContext()["sdkKey"];(0,s.it)(t=>{var e=null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.srInstances)?void 0:e[i];e instanceof r&&e.ot(t)})}ot(t){"background"===t&&(this.Ze(),this.ge.flush().catch(t=>{this.l.logError("SR::visibility",t)}))}ti(t,e){this.$e=e,this.He.push(t),2048<JSON.stringify(this.He).length&&((0,s._t)()?this.ei():this.Ze())}Xe(){var t=this.ge.getContext().values;!0!==(null==t?void 0:t.can_record_session)?this.Qe():this.Ye.isRecording()||(s.StatsigMetadataProvider.add({isRecordingSession:"true"}),this.Ye.record((t,e)=>this.ti(t,e)))}Qe(){this.Ye.stop(),s.StatsigMetadataProvider.add({isRecordingSession:"false"}),0!==this.He.length&&null!=this.$e&&this.ei()}Ze(){0!==this.He.length&&null!=this.$e&&this.We.then(t=>this.ii(t)).catch(t=>{this.l.logError("SR::flush",t)})}ii(t){var e,i=this.$e;null!==i&&0!==this.He.length&&(e=JSON.stringify(this.He),this.ge.logEvent({eventName:"statsig::session_recording",value:t,metadata:{session_start_ts:String(i.startTime),session_end_ts:String(i.endTime),clicks_captured_cumulative:String(i.clickCount),rrweb_events:e,session_replay_sdk_version:s.SDK_VERSION}}),this.He=[])}ei(){this.We=this.Ne(),this.Ze()}Ne(){return n(this,void 0,void 0,function*(){return(yield this.ge.getAsyncContext()).sessionID})}}e.SessionReplay=r},8264:(t,e,i)=>{$Q(e),e.SessionReplayClient=void 0;const n=i(8352),s=i(4464);e.SessionReplayClient=class{constructor(){this.ni=null,this.si=null,this.oi=0}record(i,t){null==(0,s.Pt)()||(this.ni=null,this.si=null,this.oi=0,this.ri=t,this.ui)||(this.ui=(t=t=>{var e;null==this.ni&&(this.ni=t.timestamp),this.si=t.timestamp,3!==(e=t).type||2!==e.data.source||2!==e.data.type&&4!==e.data.type||this.oi++,i(t,{startTime:this.ni,endTime:this.si,clickCount:this.oi}),144e5<this.si-this.ni&&(null!=(e=this.ui)&&e.call(this),this.ri)&&this.ri()},("function"==typeof n?n:n.record)({emit:t})))}stop(){this.ui&&(this.ui(),this.ui=void 0)}isRecording(){return null!=this.ui}}},8392:(t,e,i)=>{$Q(e),e.runStatsigSessionReplay=e.SessionReplay=e.SessionReplayClient=void 0;const n=i(2152),s=(Object.defineProperty(e,"SessionReplay",{enumerable:!0,get:function(){return n.SessionReplay}}),Object.defineProperty(e,"runStatsigSessionReplay",{enumerable:!0,get:function(){return n.runStatsigSessionReplay}}),i(8264));Object.defineProperty(e,"SessionReplayClient",{enumerable:!0,get:function(){return s.SessionReplayClient}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{SessionReplayClient:s.SessionReplayClient,SessionReplay:n.SessionReplay,runStatsigSessionReplay:n.runStatsigSessionReplay})},5536:function(t,e,i){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.AutoCapture=e.runStatsigAutoCapture=void 0;const s=i(4464),o=i(3076);e.runStatsigAutoCapture=function(t){new r(t)};class r{constructor(t){this.ge=t,this.be=Date.now(),this.me=0;var e,{sdkKey:t,errorBoundary:i}=t.getContext(),i=(this.l=i,this.l.wrap(this),(0,s.Pt)());(0,s.Et)()&&((e=null!=(e=(__STATSIG__=(0,s.i)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==i?void 0:i.readyState)?i.addEventListener("DOMContentLoaded",()=>this.ye()):this.ye()}pe(){const e=(0,s.kt)();var t,i=(0,s.Pt)();e&&i&&(t=t=>{this.Se(t||e.event)},(0,o.Oe)(i,"click",t),(0,o.Oe)(i,"submit",t),(0,o.Oe)(e,"error",t),(0,o.Oe)(e,"beforeunload",()=>this.je()),(0,o.Oe)(e,"scroll",()=>this.Te()))}Se(t){var e;let i=null==(e=t.type)?void 0:e.toLowerCase();"error"===i&&t instanceof ErrorEvent?this.we(t):(e=(0,o.Ie)(t))&&(0,o.rt)(t,e)&&("submit"===i&&(i="form_submit"),{value:t,metadata:e}=(0,o.Ae)(e),this.xe(i,t,e))}ye(){this.pe(),this.Me(),this.De()}we(t){var e=(null==t?void 0:t.error)||{};let i=e;if("object"==typeof e)try{i=JSON.stringify(e)}catch(t){i="function"==typeof(null==e?void 0:e.toString)?e.toString():"Unknown Error"}this.xe("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:i})}Me(){setTimeout(()=>{var t,e=(0,o.Ee)();this.Pe("page_view",(0,o.ke)(),{title:null==(t=(0,s.Pt)())?void 0:t.title,queryParams:Object.fromEntries(e.searchParams)})},1)}De(){const i=(0,s.kt)();void 0!==(null===i||void 0===i?void 0:i.performance)&&"function"==typeof i.performance.getEntriesByType&&"function"==typeof i.performance.getEntriesByName&&setTimeout(()=>{var t={},e=i.performance.getEntriesByType("navigation"),e=(e&&0<e.length&&e[0]instanceof PerformanceNavigationTiming&&(e=e[0],t.load_time_ms=e.duration,t.dom_interactive_time_ms=e.domInteractive-e.startTime,t.redirect_count=e.redirectCount,t.transfer_bytes=e.transferSize),i.performance.getEntriesByName("first-contentful-paint"));e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),this.xe("performance",(0,o.ke)(),t)},1)}je(){this.Pe("page_view_end",(0,o.ke)(),{scrollDepth:this.me,pageViewLength:Date.now()-this.be})}xe(e,i,n){this.Ne().then(t=>{t={eventName:"auto_capture::"+e,value:i,metadata:$P({sessionID:t,page_url:null!=(t=null==(t=null==(t=(0,s.kt)())?void 0:t.location)?void 0:t.href)?t:""},n)};this.ge.logEvent(t)}).catch(t=>{this.l.logError("AC::enqueue",t)})}Pe(t,e,i){this.xe(t,e,i),this.ge.flush().catch(t=>{s.Log.error(t)})}Te(){var t=null!=(t=null==(t=(0,s.Pt)())?void 0:t.body.scrollHeight)?t:1,e=(0,s.kt)(),i=null!=(i=null==e?void 0:e.scrollY)?i:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.me=Math.max(this.me,Math.min(100,Math.round((i+e)/t*100)))}Ne(){return n(this,void 0,void 0,function*(){return(yield this.ge.getAsyncContext()).sessionID})}}e.AutoCapture=r},3076:(t,e,i)=>{$Q(e),e.Oe=e.ke=e.Ee=e.rt=e.Ie=e.Ae=void 0;const n=i(4464);function o(e){if(e){let t=e;for(;t;){var i=t.tagName.toLowerCase();if(["body","document"].includes(i))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.Ae=function(t){var e=t.tagName.toLowerCase(),i={},n=e,s=("form"===e&&(i.action=t.getAttribute("action"),i.method=null!=(s=t.getAttribute("method"))?s:"GET",i.formName=t.getAttribute("name"),i.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(i.content=t.value,i.inputName=t.getAttribute("name")),"button"===e&&(i.content=(t.textContent||"").trim()),o(t));return s&&(i.href=s.getAttribute("href")),{value:n,metadata:i}},e.Ie=function(t){if(!t)return null;let e=t.target||t.srcElement;return e&&e instanceof Element?e=3===e.nodeType?e.parentNode||null:e:null},e.rt=function(t,e){if(!t||!e||1!==e.nodeType)return!1;var i=e.tagName.toLowerCase(),n=t.type.toLowerCase();switch(i){case"html":return!1;case"form":return"submit"===n;case"input":case"select":case"textarea":return["change"].includes(n);default:if("click"===n){if("button"===i)return!0;if(o(e))return!0}return!1}},e.Ee=function(){var t=null!=(t=null==(t=null==(t=(0,n.kt)())?void 0:t.location)?void 0:t.href)?t:"";let e;try{e=new URL(t)}catch(t){e=new URL("error:")}return e},e.ke=function(){return(0,n.St)()||""},e.Oe=function(t,e,i){t&&t.addEventListener&&t.addEventListener(e,i,!0)}},6824:(t,e,i)=>{$Q(e),e.runStatsigAutoCapture=e.AutoCapture=void 0;const n=i(5536);Object.defineProperty(e,"AutoCapture",{enumerable:!0,get:function(){return n.AutoCapture}}),Object.defineProperty(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return n.runStatsigAutoCapture}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:n.AutoCapture,runStatsigAutoCapture:n.runStatsigAutoCapture}),e.default=__STATSIG__}},n={};function s(t){var e=n[t];return void 0!==e||(e=n[t]={exports:{}},i[t].call(e.exports,e,e.exports,s)),e.exports}s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var t={};{var e=t;const r=s(8392),u=s(6824);var o=s(9920);e.default=__STATSIG__,o.AutoInit.attempt(({client:t})=>{new r.SessionReplay(t),new u.AutoCapture(t)})}return t.default})());
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $P = (a,b) => Object.assign(a,b);var n={496:(t,e,n)=>{$Q(e),e.t=e.i=void 0,e.i=()=>null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:u;e.t=t=>{var e;return t?null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:e[t]:null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.lastInstance};var i,o="__STATSIG__",s="undefined"!=typeof window?window:{},n=void 0!==n.g?n.g:{},r="undefined"!=typeof globalThis?globalThis:{};const u=null!=(i=null!=(i=null!=(i=s[o])?i:n[o])?i:r[o])?i:{instance:e.t};s[o]=u,n[o]=u,r[o]=u},856:(t,e)=>{$Q(e)},320:function(t,e,n){var s=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};$Q(e),e.DataAdapterCore=void 0;const i=n(512),r=n(780),o=n(283),u=n(296),l=n(444),a=n(412);e.DataAdapterCore=class{constructor(t,e){this.o=t,this.l=e,this.u=null,this.h=null,this.v={},this._="statsig.last_modified_time."+e}attach(t,e){this.h=t,this.u=new i.ErrorBoundary(t)}getDataSync(t){var t=this.m(t),e=this.v[t];return e||((e=this.p(t))?(this.S(t,e),this.v[t]):null)}setData(t,e){e=this.m(e);this.S(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.v=$P($P({},this.v),t)}O(e,n,i){var o;return s(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.j(null!=(o=null==t?void 0:t.data)?o:null,n)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(r.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}T(n,i){return s(this,void 0,void 0,function*(){var t=this.m(n),e=yield this.O(null,n,i);e&&this.S(t,$P($P({},e),{source:"Prefetch"}))})}j(i,o){return s(this,void 0,void 0,function*(){var t=yield this.I(i,o);if(!t)return r.Log.debug("No response returned for latest value"),null;var e=(0,a.typedJsonParse)(t,"has_updates","Failure while attempting to persist latest value");let n=null;return!0===(null==e?void 0:e.has_updates)?n={source:"Network",data:t,receivedAt:Date.now()}:i&&!1===(null==e?void 0:e.has_updates)&&(n={source:"NetworkNotModified",data:i,receivedAt:Date.now()}),n?(t=this.m(o),this.S(t,n),yield this.A(t,n),n):null})}M(){return null!=this.h?this.h:(r.Log.error(this.o+" is not attached to a Client"),"")}m(t){t=(0,u.getUserStorageKey)(this.M(),t);return`${o.DataAdapterCachePrefix}.${this.l}.`+t}S(t,e){var n=Object.entries(this.v);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.v[n]),this.v[t]=e}p(t){var e=null==(e=l.Storage.D)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,a.typedJsonParse)(e,"source","Failed to parse cached result"))?$P($P({},t),{source:"Cache"}):null}A(t,e){return s(this,void 0,void 0,function*(){yield l.Storage.k(t,JSON.stringify(e)),yield this.N(t)})}N(n){var i;return s(this,void 0,void 0,function*(){var t=null!=(i=yield(0,l.P)(this._))?i:{},e=(t[n]=Date.now(),Object.entries(t));e.length<=10||(delete t[(e=e.reduce((t,e)=>e[1]<t[1]?e:t))[0]],yield l.Storage.C(e[0])),yield(0,l.G)(this._,t)})}}},280:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},184:(t,e)=>{$Q(e)},512:function(t,u,e){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};Object.defineProperty(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(780),l=e(360),a=e(972);u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";u.ErrorBoundary=class{constructor(t,e){this.h=t,this.U=e,this.R=new Set}wrap(i){try{const t=i;!function(t){const e=new Set;let n=Object.getPrototypeOf(t);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(t=>"function"==typeof(null===n||void 0===n?void 0:n[t])).forEach(t=>e.add(t)),n=Object.getPrototypeOf(n);return Array.from(e)}(t).forEach(e=>{const n=t[e];"$EB"in n||(t[e]=(...t)=>this.capture(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.F("eb:wrap",t)}}capture(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.F(e,t)):n}catch(t){return this.F(e,t),null}}logError(t,e){this.F(t,e)}F(s,r){try{i.Log.warn("Caught error in "+s,{error:r});n(this,void 0,void 0,function*(){var t,e,n=null!=r?r:Error("[Statsig] Error was empty"),i=n instanceof Error,o=i?n.name:"No Name";this.R.has(o)||(this.R.add(o),t=l.SDKType.L(this.h),e=a.StatsigMetadataProvider.get(),i=i?n.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(n),n=JSON.stringify($P({tag:s,exception:o,info:i},$P($P({},e),{sdkType:t}))),yield fetch(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.h,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(o=this.U)&&o.call(this,{name:"error",error:r}))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},788:(t,e)=>{$Q(e)},728:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};$Q(e),e.EventLogger=void 0;const o=n(832),s=n(780),r=n(256),u=n(452),l=n(48),a=n(876),c=n(444),d=n(412),h=n(84),v=n(100);e.EventLogger=class{constructor(t,e,n,i){this.h=t,this.U=e,this.K=n,this.J=i,this.q=[],this.V={},this.B={},this.$=!1,this.H=Date.now(),this.W=!0===(null==i?void 0:i.disableLogging),this.Y=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;n=null!=(e=null==i?void 0:i.loggingIntervalMs)?e:1e4,this.X=setInterval(()=>this.Z(),n),t=null==i?void 0:i.networkConfig;this.tt=(0,h.et)(null==t?void 0:t.logEventUrl,null==t?void 0:t.api,"/rgstr",r.NetworkDefault.eventsApi),this.nt=(0,h.et)(null==t?void 0:t.logEventBeaconUrl,null==t?void 0:t.api,"/log_event_beacon",r.NetworkDefault.eventsApi),(0,v.it)(this.st.bind(this)),this.ot()}setLoggingDisabled(t){this.W=t}enqueue(t){this.rt(t)&&(this.lt(t),this.ut(),this.q.length>this.Y)&&this.Z()}incrementNonExposureCount(t){var e=null!=(e=this.B[t])?e:0;this.B[t]=e+1}reset(){this.V={}}shutdown(){return i(this,void 0,void 0,function*(){this.X&&(clearInterval(this.X),this.X=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.ct(),0!==this.q.length&&(t=this.q,this.q=[],yield this.dt(t))})}st(t){"background"===t&&this.Z()}ut(){this.$||(this.$=!0,200<Date.now()-this.H)||setTimeout(()=>this.Z(),200)}rt(t){if((0,a.ht)(t)){var t=[t.eventName,null==(e=t.user)?void 0:e.userID,null==(e=t.metadata)?void 0:e.gate,null==(e=t.metadata)?void 0:e.config,null==(e=t.metadata)?void 0:e.ruleID].join("|"),e=this.V[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.V).length&&(this.V={}),this.V[t]=n}return!0}Z(){this.flush().catch(()=>{})}dt(t){return i(this,void 0,void 0,function*(){if(this.W)this.vt(t);else try{(!(0,v._t)()&&this.K.isBeaconSupported()?yield this.ft(t):yield this.gt(t)).success?this.U({name:"logs_flushed",events:t}):this.vt(t)}catch(t){s.Log.warn("Failed to flush events.")}})}gt(e){return i(this,void 0,void 0,function*(){var t=yield this.K.post({sdkKey:this.h,data:{events:e},url:this.tt,retries:3,params:{[u.NetworkParam.EventCount]:String(e.length)}}),t=null!=t&&t.body?(0,d.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}ft(t){return i(this,void 0,void 0,function*(){return{success:yield this.K.beacon({sdkKey:this.h,data:{events:t},url:this.nt})}})}vt(t){for(;500<t.length;)t.shift();var e=this.bt();(0,c.G)(e,t).catch(()=>{s.Log.warn("Unable to save failed logs to storage")})}ot(){const e=this.bt();i(this,void 0,void 0,function*(){var t=yield(0,c.P)(e);t&&(yield c.Storage.C(e),yield this.dt(t))}).catch(()=>{s.Log.warn("Failed to flush stored logs")})}bt(){return"statsig.failed_logs."+(0,o.DJB2)(this.h)}lt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.yt();n&&(e.statsigMetadata={currentPage:n}),this.q.push($P($P({},t),e))}ct(){0!==Object.keys(this.B).length&&(this.lt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.B)}}),this.B={})}yt(){var t;if(!1!==(null==(t=this.J)?void 0:t.includeCurrentPageUrlWithEvents))return(0,l.ln)()}}},832:(t,e)=>{$Q(e),e.DJB2Object=e.DJB2=void 0;e.DJB2=e=>{let n=0;for(let t=0;t<e.length;t++){var i=e.charCodeAt(t);n=(n<<5)-n+i,n&=n}return String(n>>>0)};e.DJB2Object=t=>(0,e.DJB2)(JSON.stringify(o(t)));const o=n=>{if(null==n)return null;var t=Object.keys(n).sort();const i={};return t.forEach(t=>{let e=n[t];e instanceof Object&&(e=o(e)),i[t]=e}),i}},664:(t,e)=>{$Q(e)},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,o;$Q(e),e.Log=e.LogLevel=void 0,(o=i||(e.LogLevel=i={}))[o.None=0]="None",o[o.Error=1]="Error",o[o.Warn=2]="Warn",o[o.Info=3]="Info",o[o.Debug=4]="Debug";class s{static info(...t){this.level>=i.Info&&console.info(...n(t))}static debug(...t){this.level>=i.Debug&&console.debug(...n(t))}static warn(...t){this.level>=i.Warn&&console.warn(...n(t))}static error(...t){this.level>=i.Error&&console.error(...n(t))}}(e.Log=s).level=i.Error},188:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};$Q(e),e.NetworkCore=void 0,n(496);const h=n(280),v=n(780),o=n(452),s=n(360),r=n(612),u=n(604),l=n(972);e.NetworkCore=class{constructor(t,e){this.J=t,this.U=e,this.Ot=null!=(t=null==(e=null==t?void 0:t.networkConfig)?void 0:e.networkTimeoutMs)?t:1e4}post(e){return i(this,void 0,void 0,function*(){var t=yield this.jt(e);return this.Tt($P({method:"POST",body:this.wt(e,t)},e))})}get(t){return this.Tt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(n){return i(this,void 0,void 0,function*(){var t,e;return!!_(n)&&(t=yield this.It(n),e=yield this.jt(n),navigator.sendBeacon(t,e))})}Tt(c){var d;return i(this,void 0,void 0,function*(){if(!_(c))return null;var{method:e,body:n,retries:i}=c;const o=new AbortController;var t=setTimeout(()=>o.abort(`Timeout of ${this.Ot}ms expired.`),this.Ot),s=yield this.It(c),r=null;try{var u,l,a,r=yield fetch(s,{method:e,body:n,headers:$P({},c.headers),signal:o.signal});if(clearTimeout(t),r.ok)return a=yield r.text(),h.Diagnostics.mark(),{body:a,code:r.status};throw u=yield r.text().catch(()=>"No Text"),(l=new Error(`Failed to fetch: ${s} `+u)).name="NetworkError",l}catch(t){n=function(t,e){if(t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return null}(o,t);return h.Diagnostics.mark(),!i||i<=0?(null!=(d=this.U)&&d.call(this,{name:"error",error:t}),v.Log.error(`A networking error occured during ${e} request to ${s}.`,n,t),null):this.Tt($P($P({},c),{retries:i-1}))}})}It(e){return i(this,void 0,void 0,function*(){var t=$P({[o.NetworkParam.SdkKey]:e.sdkKey,[o.NetworkParam.SdkType]:s.SDKType.L(e.sdkKey),[o.NetworkParam.SdkVersion]:l.SDK_VERSION,[o.NetworkParam.Time]:String(Date.now()),[o.NetworkParam.SessionID]:yield r.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}jt(o){return i(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=o,n=yield u.StableID.get(e),i=yield r.SessionID.get(e),e=s.SDKType.L(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},l.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}wt(t,e){var n;return!(null!=(null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__["no-encode"])||null!=(n=this.J)&&n.disableStatsigEncoding)&&t.isStatsigEncodable&&"undefined"!=typeof window&&window.btoa&&(t.params=$P($P({},null!=(n=t.params)?n:{}),{[o.NetworkParam.StatsigEncoded]:"1"}),null!=(t=window.btoa(e).split("").reverse().join("")))?t:e}};const _=t=>!!t.sdkKey||(v.Log.warn("Unable to make request without an SDK key"),!1)},256:(t,e)=>{$Q(e),e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://events.statsigapi.net/v1",initializeApi:"https://featuregates.org/v1",specsApi:"https://api.statsigcdn.com/v1"}},452:(t,e)=>{$Q(e),e.NetworkParam=void 0,e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se"}},264:(t,e)=>{$Q(e)},360:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={L:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},At(t,e){n[t]=e},Mt(t){i&&"-react"!==i||(i="-"+t)}}},48:(t,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.ln=i.xt=i.Dt=i.an=i.Et=i.kt=void 0;i.kt=()=>"undefined"!=typeof window?window:null,i.Et=()=>{var t=(0,i.kt)();return null!=(t=null==t?void 0:t.document)?t:null},i.an=()=>null!=(0,i.Et)(),i.Dt=(t,e)=>{var n=(0,i.kt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.xt=(t,e)=>{var n=(0,i.Et)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.ln=()=>{var t;try{return null==(t=(0,i.kt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},612:function(t,r,e){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};Object.defineProperty(r,"__esModule",{value:!0}),r.SessionID=void 0;const i=e(832),u=e(780),l=e(444),a=e(556),c={},d={},h={};function v(t){return"statsig.session_id."+(0,i.DJB2)(t)}r.SessionID={get:t=>null!=h[t]?h[t]:h[t]=r.SessionID.Nt(t),Nt:s=>n(void 0,void 0,void 0,function*(){let e=c[s];var n=Date.now();if(null==e){let t=yield function(t){t=v(t);return(0,l.P)(t)}(s);null==t&&(t={sessionID:(0,a.getUUID)(),startTime:n,lastUpdate:n}),e=t,c[s]=e}var t=null!=(t=d[s])?t:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:()=>{}},i=((144e5<n-e.startTime||18e5<n-e.lastUpdate)&&(e.sessionID=(0,a.getUUID)(),e.startTime=n),e.lastUpdate=n,e),o=s;return o=v(s),(0,l.G)(o,i).catch(()=>{u.Log.warn("Failed to save SessionID")}),t.idleTimeoutID=r.SessionID.Pt(t,t.idleTimeoutID,18e5),t.ageTimeoutID=r.SessionID.Pt(t,t.ageTimeoutID,144e5-(n-e.startTime)),c[s]=e,d[s]=t,h[s]=null,e.sessionID}),Ct:(t,e)=>{var n=null!=(n=d[e])?n:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:t};n.emitFunction=t,d[e]=n},Pt:(t,e,n)=>(clearTimeout(null!=e?e:void 0),setTimeout(t.emitFunction,n))}},604:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};$Q(e),e.StableID=void 0;const o=n(832),s=n(780),r=n(444),u=n(556),l={};function a(t){return"statsig.stable_id."+(0,o.DJB2)(t)}function c(t,e){e=a(e);(0,r.G)(e,t).catch(()=>{s.Log.warn("Failed to save StableID")})}e.StableID={get:e=>i(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,r.P)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},688:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};$Q(e),e.StatsigClientBase=void 0,n(496);const l=n(496),a=n(512),c=n(728),d=n(780),h=n(48),v=n(612),_=n(604),f=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Gt={};var o,s=this.St.bind(this),r=(0,l.i)(),u=null!=(u=r.instances)?u:{};null!=i&&i.logLevel&&(d.Log.level=null==i?void 0:i.logLevel),null!=i&&i.disableStorage&&f.Storage.Rt(!0),null!=i&&i.overrideStableID&&_.StableID.setOverride(i.overrideStableID,t),this.u=new a.ErrorBoundary(t,s),this.u.wrap(this),this.u.wrap(n),this.u.wrap(e),this.h=t,this.J=null!=i?i:{},this.Ft=null!=(o=null==i?void 0:i.overrideAdapter)?o:null,this.Lt=new c.EventLogger(t,s,n,i),v.SessionID.Ct(()=>{this.St({name:"session_expired"})},t),null!=u[t]&&(0,h.an)()&&d.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),u[t]=this,r.lastInstance=this,r.instances=u,__STATSIG__=r,this.dataAdapter=e,this.dataAdapter.attach(t,i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.J.disableLogging=t.disableLogging,this.Lt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.J.disableStorage=t.disableStorage,f.Storage.Rt(t.disableStorage))}flush(){return this.Lt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.St({name:"pre_shutdown"}),yield this.Lt.shutdown()})}on(t,e){this.Gt[t]||(this.Gt[t]=[]),this.Gt[t].push(e)}off(t,e){this.Gt[t]&&-1!==(e=this.Gt[t].indexOf(e))&&this.Gt[t].splice(e,1)}__on(t,e){e.__isInternal=!0,this.on(t,e)}St(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.u.logError("_emit:"+n.name,t):d.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Gt[n.name]&&this.Gt[n.name].forEach(t=>e(t)),null!=(t=this.Gt["*"])&&t.forEach(e)}Ut(t,e){this.loadingStatus=t,this.St({name:"values_updated",status:t,values:e})}Kt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Lt.incrementNonExposureCount(t):this.Lt.enqueue(e)}}},808:(t,e)=>{$Q(e)},283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{$Q(e),e.Jt=e.qt=e.Vt=e.ht=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",l=(t,e,n,i,o)=>({eventName:t,user:e,value:null,metadata:s(n,i),secondaryExposures:o,time:Date.now()});e.ht=({eventName:t})=>t===i||t===n,e.Vt=(t,e)=>{return l(i,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.qt=(t,e)=>{return l(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Jt=(t,e,n)=>{var i,o=e.__evaluation,s=!0===(null==(s=null==o?void 0:o.explicit_parameters)?void 0:s.includes(n));let r="",u=null!=(i=null==o?void 0:o.undelegated_secondary_exposures)?i:[];return s&&(r=null!=(i=o.allocated_experiment_name)?i:"",u=o.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(s)},u)};const s=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="0.0.1-beta.33";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},384:(t,e)=>{$Q(e)},396:(t,e)=>{$Q(e),e.zt=e.Bt=e.$t=e.Ht=void 0;const o="default";function s(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:o,__evaluation:n,value:i}}function r(s,r){return(t,e)=>{var n,i,o=null!=(o=null==s?void 0:s[t])?o:null;return null==o||null!=e&&(n=e,(i=t=>Array.isArray(t)?"array":typeof t)(o)!==i(n))?null!=e?e:null:(null!=r&&r(t),o)}}e.Ht=function(t,e,n){return s(t,e,n,!0===(null==n?void 0:n.value))},e.$t=function(t,e,n){return $P($P({},s(t,e,n,null!=(t=null==n?void 0:n.value)?t:{})),{groupName:null,get:r(null==n?void 0:n.value)})},e.Bt=function(t,e,n,i){return $P($P({},s(t,e,n,void 0)),{get:r(null==n?void 0:n.value,i),groupName:null!=(t=null==n?void 0:n.group_name)?t:null,__value:null!=(e=null==n?void 0:n.value)?e:{}})},e.zt=function(t,e,n,i){return $P($P($P({},t),e),{get:r(n,i)})}},136:(t,e)=>{$Q(e)},296:(t,e,n)=>{$Q(e),e.getUnitIDFromUser=e.getUserStorageKey=e.normalizeUser=void 0;const i=n(832);e.normalizeUser=function(t,e){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&(n.statsigEnvironment=e),n}catch(t){throw new Error("User object must be convertable to JSON string.")}},e.getUserStorageKey=function(t,e){return(0,i.DJB2Object)({sdkKey:t,user:e})},e.getUnitIDFromUser=function(t,e){var n;return"string"==typeof e&&"userid"!==e.toLowerCase()?null!=(n=null==(n=t.customIDs)?void 0:n[e])?n:null==(n=null==t?void 0:t.customIDs)?void 0:n[e.toLowerCase()]:t.userID}},444:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})},n=($Q(e),e.G=e.P=e.Storage=void 0,n(780));const o={},s={Wt:()=>"InMemory",D(t){return null!=(t=o[t])?t:null},Yt(t){return Promise.resolve(null!=(t=o[t])?t:null)},k(t,e){return o[t]=e,Promise.resolve()},C(t){return delete o[t],Promise.resolve()},Qt(){return Promise.resolve(Object.keys(o))}};let r=null;try{"undefined"!=typeof window&&"localStorage"in window&&(r={Wt:()=>"LocalStorage",D(t){return localStorage.getItem(t)},Yt(t){return Promise.resolve(localStorage.getItem(t))},k(t,e){return localStorage.setItem(t,e),Promise.resolve()},C(t){return localStorage.removeItem(t),Promise.resolve()},Qt(){var t=Object.keys(localStorage);return Promise.resolve(t)}})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let u=null!==r&&void 0!==r?r:s,l=u;e.Storage={Wt:()=>l.Wt(),Yt:t=>l.Yt(t),k:(t,e)=>l.k(t,e),C:t=>l.C(t),Qt:()=>l.Qt(),D:t=>{var e;return null!=(e=null==(e=l.D)?void 0:e.call(l,t))?e:null},Xt:t=>{u=t,l=t},Rt:t=>{l=t?s:u}},e.P=function(e){return i(this,void 0,void 0,function*(){var t=yield l.Yt(e);return JSON.parse(null!=t?t:"null")})},e.G=function(t,e){return i(this,void 0,void 0,function*(){yield l.k(t,JSON.stringify(e))})}},412:(t,e,n)=>{$Q(e),e.typedJsonParse=void 0;const o=n(780);e.typedJsonParse=function(t,e,n){try{var i=JSON.parse(t);return"object"==typeof i&&0 in i,i}catch(t){}return o.Log.error(n),null}},556:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let n=(new Date).getTime(),i="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<n?(e=(n+e)%16|0,n=Math.floor(n/16)):(e=(i+e)%16|0,i=Math.floor(i/16)),("x"===t?e:7&e|8).toString(16)})}},84:(t,e)=>{$Q(e),e.et=void 0,e.et=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{$Q(e)},100:(t,e,n)=>{$Q(e),e.Zt=e.it=e._t=void 0;n=n(48);const i="foreground",o="background",s=[];let r=i;e._t=()=>r===i,e.it=t=>{s.unshift(t)};e.Zt=e=>{e!==r&&(r=e,s.forEach(t=>t(e)))},(0,n.Dt)("focus",()=>(0,e.Zt)(i)),(0,n.Dt)("blur",()=>(0,e.Zt)(o)),(0,n.Dt)("beforeunload",()=>(0,e.Zt)(o)),(0,n.xt)("visibilitychange",()=>{(0,e.Zt)("visible"===document.visibilityState?i:o)})},464:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(e,n);o&&("get"in o?e.__esModule:!o.writable&&!o.configurable)||(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,o)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),o=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),e.Log=e.Storage=e.EventLogger=void 0,n(496);const s=n(728),r=(Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return s.EventLogger}}),n(780));Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return r.Log}});var u=n(972);const l=n(444);Object.defineProperty(e,"Storage",{enumerable:!0,get:function(){return l.Storage}});var a=n(556);o(n(496),e),o(n(856),e),o(n(320),e),o(n(184),e),o(n(512),e),o(n(500),e),o(n(788),e),o(n(832),e),o(n(664),e),o(n(780),e),o(n(452),e),o(n(188),e),o(n(256),e),o(n(264),e),o(n(48),e),o(n(360),e),o(n(612),e),o(n(604),e),o(n(688),e),o(n(808),e),o(n(283),e),o(n(876),e),o(n(972),e),o(n(384),e),o(n(396),e),o(n(136),e),o(n(296),e),o(n(444),e),o(n(412),e),o(n(84),e),o(n(539),e),o(n(556),e),o(n(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:s.EventLogger,Log:r.Log,getUUID:a.getUUID,Storage:l.Storage,SDK_VERSION:u.SDK_VERSION})},920:(t,e,n)=>{$Q(e),e.AutoInit=void 0;const d=n(464),h=n(208);e.AutoInit=class{static attempt(e){var t,n,i;try{var o=(0,d.kt)(),s=(0,d.Et)();if(o&&s&&s.currentScript){var r=s.currentScript.getAttribute("src"),u=null==(t=o.location)?void 0:t.href;if(r&&u){var l,a=new URL(r,u).searchParams;if(l=null!=(n=a.get("sdkkey"))?n:a.get("sdkKey")){var c=null==(i=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:i[l];let t=null;(t=c instanceof h.StatsigClient?c:t)||(t=new h.StatsigClient(l,{})).initializeAsync().catch(t=>{d.Log.error(t)}),e({sdkKey:l,client:t})}}}}catch(t){d.Log.error("AutoInit failed",t)}}}},96:(t,e,n)=>{$Q(e),e.resolveDeltasResponse=void 0;const i=n(464);function o(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.resolveDeltasResponse=function(t,e){var n;return(e=(0,i.typedJsonParse)(e,"checksum","Failed to parse DeltasEvaluationResponse"))?(t=t,n=e,t=$P($P($P({},t),n),{feature_gates:$P($P({},t.feature_gates),n.feature_gates),layer_configs:$P($P({},t.layer_configs),n.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),n.dynamic_configs)}),o((t=n=t).deleted_gates,t.feature_gates),delete t.deleted_gates,o(n.deleted_configs,t.dynamic_configs),delete t.deleted_configs,o(n.deleted_layers,t.layer_configs),delete t.deleted_layers,n=t,(t=(0,i.DJB2Object)({feature_gates:n.feature_gates,dynamic_configs:n.dynamic_configs,layer_configs:n.layer_configs}))===e.checksum?JSON.stringify(n):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:n,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},156:(t,e,n)=>{$Q(e);const i=n(464);e.default=class{constructor(){this.te=null,this.ee=null,this.ne="Uninitialized",this.ie=0,this.se=0}getValues(){return this.te?(0,i.typedJsonParse)(this.te,"has_updates","Failed to parse EvaluationStoreValues"):null}reset(){this.ee=null,this.te=null,this.ne="Loading",this.ie=0,this.se=0}finalize(){this.ee||(this.ne="NoValues")}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=(0,i.typedJsonParse)(t.data,"has_updates","Failed to parse EvaluationResponse"))?void 0:e.has_updates)&&(this.te=t.data,this.ie=e.time,this.se=t.receivedAt,this.ne=t.source,this.ee=e)}getGate(t){var e,t=null!=(e=null==(e=this.ee)?void 0:e.feature_gates[t])?e:null;return this.oe(t)}getConfig(t){var e,t=null!=(e=null==(e=this.ee)?void 0:e.dynamic_configs[t])?e:null;return this.oe(t)}getLayer(t){var e,t=null!=(e=null==(e=this.ee)?void 0:e.layer_configs[t])?e:null;return this.oe(t)}oe(t){return{evaluation:t,details:this.re(null==t)}}re(t){return"Uninitialized"===this.ne||"NoValues"===this.ne?{reason:this.ne}:{reason:this.ne+":"+(t?"Unrecognized":"Recognized"),lcut:this.ie,receivedAt:this.se}}}},400:function(t,e,n){var s=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};$Q(e);const r=n(464),u=n(96);class i extends r.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.le=(0,r.et)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",r.NetworkDefault.initializeApi)}fetchEvaluations(n,i,o){return s(this,void 0,void 0,function*(){var t=i?(0,r.typedJsonParse)(i,"has_updates","Failed to parse cached EvaluationResponse"):null;let e={user:o,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.ue(n,t,e)})}ue(e,n,i){var o;return s(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.le,data:i,retries:2,isStatsigEncodable:!0});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(o=null==t?void 0:t.body)?o:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(o=t.body)?void 0:o.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,u.resolveDeltasResponse)(n,t.body))?t:this.ue(e,n,$P($P($P({},i),t),{deltasResponseRequested:!1}))})}}e.default=i},520:function(t,e,n){var o=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};$Q(e);const r=n(464),s=n(156),u=n(400),l=n(364);class i extends r.StatsigClientBase{static instance(t){var e=(0,r.i)().instance(t);return e instanceof i?e:(r.Log.warn("Unable to find StatsigClient instance"),new i(null!=t?t:"",{}))}constructor(t,e,n=null){r.SDKType.At(t,"javascript-client");var i=new u.default(n,t=>{this.St(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new l.StatsigEvaluationsDataAdapter,i,n),this.ae=new s.default,this.ce=e}initializeSync(){this.updateUserSync(this.ce)}initializeAsync(t){return this.updateUserAsync(this.ce,t)}updateUserSync(t){this.de(t);t=this.dataAdapter.getDataSync(this.ce);this.ae.setValuesFromDataAdapter(t),this.ae.finalize(),this.Ut("Ready",t),this.he(null!=t?t:null,this.ce)}updateUserAsync(n,i){return o(this,void 0,void 0,function*(){this.de(n);var t=this.ce,e=this.dataAdapter.getDataSync(t);this.Ut("Loading",e),this.ae.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.ce&&this.ae.setValuesFromDataAdapter(e),this.ae.finalize(),this.Ut("Ready",e)})}getContext(){return{sdkKey:this.h,options:this.J,values:this.ae.getValues(),user:JSON.parse(JSON.stringify(this.ce)),errorBoundary:this.u}}getAsyncContext(){return o(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{sessionID:yield r.SessionID.get(this.h),stableID:yield r.StableID.get(this.h)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var n=(0,r.DJB2)(t),{evaluation:n,details:i}=this.ae.getGate(n),i=(0,r.Ht)(t,i,n),o=null==(o=null==(n=this.Ft)?void 0:n.getGateOverride)?void 0:o.call(n,i,this.ce,e),n=null!=o?o:i;return this.Kt(t,(0,r.Vt)(this.ce,n),e),this.St({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.ve("dynamic_config",t,e);return this.St({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.ve("experiment",t,e);return this.St({name:"experiment_evaluation",experiment:t}),t}getLayer(e,n){var t=(0,r.DJB2)(e),{evaluation:t,details:i}=this.ae.getLayer(t),i=(0,r.Bt)(e,i,t),o=null==(o=null==(t=this.Ft)?void 0:t.getLayerOverride)?void 0:o.call(t,i,this.ce,n);const s=(0,r.zt)(i,o,null!=(t=null==o?void 0:o.__value)?t:i.__value,t=>{this.Kt(e,(0,r.Jt)(this.ce,s,t),n)});return this.St({name:"layer_evaluation",layer:s}),s}logEvent(t,e,n){this.Lt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.ce,time:Date.now()}))}he(t,e){this.dataAdapter.getDataAsync(t,e).catch(t=>{r.Log.error("An error occurred after update.",t)})}de(t){this.Lt.reset(),this.ae.reset(),this.ce=(0,r.normalizeUser)(t,this.J.environment)}ve(t,e,n){var i=(0,r.DJB2)(e),{evaluation:i,details:o}=this.ae.getConfig(i),o=(0,r.$t)(e,o,i),i="experiment"===t?null==(t=null==(i=this.Ft)?void 0:i.getExperimentOverride)?void 0:t.call(i,o,this.ce,n):null==(i=null==(t=this.Ft)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,o,this.ce,n),t=null!=i?i:o;return this.Kt(e,(0,r.qt)(this.ce,t),n),t}}e.default=i},364:function(t,e,n){var o=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})},i=($Q(e),e.StatsigEvaluationsDataAdapter=void 0,n(464));const s=n(400);class r extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.K=null}attach(t,e){super.attach(t,e),this.K=new s.default(null!=e?e:{})}getDataAsync(t,e,n){return this.O(t,e,n)}prefetchData(t,e){return this.T(t,e)}I(e,n){var i;return o(this,void 0,void 0,function*(){var t=yield null==(i=this.K)?void 0:i.fetchEvaluations(this.M(),e,n);return null!=t?t:null})}}e.StatsigEvaluationsDataAdapter=r},208:(t,e,n)=>{$Q(e),e.StatsigClient=e.StatsigEvaluationsDataAdapter=void 0;var i=n(520);e.StatsigClient=i.default;const o=n(364);Object.defineProperty(e,"StatsigEvaluationsDataAdapter",{enumerable:!0,get:function(){return o.StatsigEvaluationsDataAdapter}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigEvaluationsDataAdapter:o.StatsigEvaluationsDataAdapter,StatsigClient:i.default}),e.default=__STATSIG__},536:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};$Q(e),e.AutoCapture=e.runStatsigAutoCapture=void 0;const o=n(464),s=n(76);e.runStatsigAutoCapture=function(t){new r(t)};class r{constructor(t){this._e=t,this.De=Date.now(),this.Ee=0;var e,{sdkKey:t,errorBoundary:n}=t.getContext(),n=(this.u=n,this.u.wrap(this),(0,o.Et)());(0,o.an)()&&((e=null!=(e=(__STATSIG__=(0,o.i)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==n?void 0:n.readyState)?n.addEventListener("DOMContentLoaded",()=>this.ke()):this.ke()}Ne(){const e=(0,o.kt)();var t,n=(0,o.Et)();e&&n&&(t=t=>{this.Pe(t||e.event)},(0,s.Ce)(n,"click",t),(0,s.Ce)(n,"submit",t),(0,s.Ce)(e,"error",t),(0,s.Ce)(e,"beforeunload",()=>this.Ge()),(0,s.Ce)(e,"scroll",()=>this.Re()))}Pe(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.Fe(t):(e=(0,s.Le)(t))&&(0,s.rt)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,s.Ue)(e),this.Ke(n,t,e))}ke(){this.Ne(),this.Je(),this.qe()}Fe(t){var e=(null==t?void 0:t.error)||{};let n=e;if("object"==typeof e)try{n=JSON.stringify(e)}catch(t){n="function"==typeof(null==e?void 0:e.toString)?e.toString():"Unknown Error"}this.Ke("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}Je(){setTimeout(()=>{var t,e=(0,s.Ve)();this.ze("page_view",(0,s.Be)(),{title:null==(t=(0,o.Et)())?void 0:t.title,queryParams:Object.fromEntries(e.searchParams)})},1)}qe(){const n=(0,o.kt)();void 0!==(null===n||void 0===n?void 0:n.performance)&&"function"==typeof n.performance.getEntriesByType&&"function"==typeof n.performance.getEntriesByName&&setTimeout(()=>{var t={},e=n.performance.getEntriesByType("navigation"),e=(e&&0<e.length&&e[0]instanceof PerformanceNavigationTiming&&(e=e[0],t.load_time_ms=e.duration,t.dom_interactive_time_ms=e.domInteractive-e.startTime,t.redirect_count=e.redirectCount,t.transfer_bytes=e.transferSize),n.performance.getEntriesByName("first-contentful-paint"));e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),this.Ke("performance",(0,s.Be)(),t)},1)}Ge(){this.ze("page_view_end",(0,s.Be)(),{scrollDepth:this.Ee,pageViewLength:Date.now()-this.De})}Ke(e,n,i){this.cn().then(t=>{t={eventName:"auto_capture::"+e,value:n,metadata:$P({sessionID:t,page_url:null!=(t=null==(t=null==(t=(0,o.kt)())?void 0:t.location)?void 0:t.href)?t:""},i)};this._e.logEvent(t)}).catch(t=>{this.u.logError("AC::enqueue",t)})}ze(t,e,n){this.Ke(t,e,n),this._e.flush().catch(t=>{o.Log.error(t)})}Re(){var t=null!=(t=null==(t=(0,o.Et)())?void 0:t.body.scrollHeight)?t:1,e=(0,o.kt)(),n=null!=(n=null==e?void 0:e.scrollY)?n:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.Ee=Math.max(this.Ee,Math.min(100,Math.round((n+e)/t*100)))}cn(){return i(this,void 0,void 0,function*(){return(yield this._e.getAsyncContext()).sessionID})}}e.AutoCapture=r},76:(t,e,n)=>{$Q(e),e.Ce=e.Be=e.Ve=e.rt=e.Le=e.Ue=void 0;const i=n(464);function s(e){if(e){let t=e;for(;t;){var n=t.tagName.toLowerCase();if(["body","document"].includes(n))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.Ue=function(t){var e=t.tagName.toLowerCase(),n={},i=e,o=("form"===e&&(n.action=t.getAttribute("action"),n.method=null!=(o=t.getAttribute("method"))?o:"GET",n.formName=t.getAttribute("name"),n.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(n.content=t.value,n.inputName=t.getAttribute("name")),"button"===e&&(n.content=(t.textContent||"").trim()),s(t));return o&&(n.href=o.getAttribute("href")),{value:i,metadata:n}},e.Le=function(t){if(!t)return null;let e=t.target||t.srcElement;return e&&e instanceof Element?e=3===e.nodeType?e.parentNode||null:e:null},e.rt=function(t,e){if(!t||!e||1!==e.nodeType)return!1;var n=e.tagName.toLowerCase(),i=t.type.toLowerCase();switch(n){case"html":return!1;case"form":return"submit"===i;case"input":case"select":case"textarea":return["change"].includes(i);default:if("click"===i){if("button"===n)return!0;if(s(e))return!0}return!1}},e.Ve=function(){var t=null!=(t=null==(t=null==(t=(0,i.kt)())?void 0:t.location)?void 0:t.href)?t:"";let e;try{e=new URL(t)}catch(t){e=new URL("error:")}return e},e.Be=function(){return(0,i.ln)()||""},e.Ce=function(t,e,n){t&&t.addEventListener&&t.addEventListener(e,n,!0)}},824:(t,e,n)=>{$Q(e),e.runStatsigAutoCapture=e.AutoCapture=void 0;const i=n(536);Object.defineProperty(e,"AutoCapture",{enumerable:!0,get:function(){return i.AutoCapture}}),Object.defineProperty(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return i.runStatsigAutoCapture}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:i.AutoCapture,runStatsigAutoCapture:i.runStatsigAutoCapture}),e.default=__STATSIG__}},i={};function o(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,o)),e.exports}o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var t={};{var e=t;const r=o(824);var s=o(920);e.default=__STATSIG__,s.AutoInit.attempt(({client:t})=>{new r.AutoCapture(t)})}return t.default})());
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $P = (a,b) => Object.assign(a,b);var n={496:(t,e,n)=>{$Q(e),e.t=e.i=void 0,e.i=()=>null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:u;e.t=t=>{var e;return t?null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:e[t]:null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.lastInstance};var i,o="__STATSIG__",s="undefined"!=typeof window?window:{},n=void 0!==n.g?n.g:{},r="undefined"!=typeof globalThis?globalThis:{};const u=null!=(i=null!=(i=null!=(i=s[o])?i:n[o])?i:r[o])?i:{instance:e.t};s[o]=u,n[o]=u,r[o]=u},856:(t,e)=>{$Q(e)},320:function(t,e,n){var s=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};$Q(e),e.DataAdapterCore=void 0;const i=n(512),r=n(780),o=n(283),u=n(296),l=n(444),a=n(412);e.DataAdapterCore=class{constructor(t,e){this.o=t,this.u=e,this.l=null,this.h=null,this.v={},this._="statsig.last_modified_time."+e}attach(t,e){this.h=t,this.l=new i.ErrorBoundary(t)}getDataSync(t){var t=this.m(t),e=this.v[t];return e||((e=this.p(t))?(this.S(t,e),this.v[t]):null)}setData(t,e){e=this.m(e);this.S(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.v=$P($P({},this.v),t)}O(e,n,i){var o;return s(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.j(null!=(o=null==t?void 0:t.data)?o:null,n)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(r.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}T(n,i){return s(this,void 0,void 0,function*(){var t=this.m(n),e=yield this.O(null,n,i);e&&this.S(t,$P($P({},e),{source:"Prefetch"}))})}j(i,o){return s(this,void 0,void 0,function*(){var t=yield this.I(i,o);if(!t)return r.Log.debug("No response returned for latest value"),null;var e=(0,a.typedJsonParse)(t,"has_updates","Failure while attempting to persist latest value");let n=null;return!0===(null==e?void 0:e.has_updates)?n={source:"Network",data:t,receivedAt:Date.now()}:i&&!1===(null==e?void 0:e.has_updates)&&(n={source:"NetworkNotModified",data:i,receivedAt:Date.now()}),n?(t=this.m(o),this.S(t,n),yield this.A(t,n),n):null})}M(){return null!=this.h?this.h:(r.Log.error(this.o+" is not attached to a Client"),"")}m(t){t=(0,u.getUserStorageKey)(this.M(),t);return`${o.DataAdapterCachePrefix}.${this.u}.`+t}S(t,e){var n=Object.entries(this.v);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.v[n]),this.v[t]=e}p(t){var e=null==(e=l.Storage.D)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,a.typedJsonParse)(e,"source","Failed to parse cached result"))?$P($P({},t),{source:"Cache"}):null}A(t,e){return s(this,void 0,void 0,function*(){yield l.Storage.P(t,JSON.stringify(e)),yield this.k(t)})}k(n){var i;return s(this,void 0,void 0,function*(){var t=null!=(i=yield(0,l.N)(this._))?i:{},e=(t[n]=Date.now(),Object.entries(t));e.length<=10||(delete t[(e=e.reduce((t,e)=>e[1]<t[1]?e:t))[0]],yield l.Storage.C(e[0])),yield(0,l.G)(this._,t)})}}},280:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},184:(t,e)=>{$Q(e)},512:function(t,u,e){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};Object.defineProperty(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(780),l=e(360),a=e(972);u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";u.ErrorBoundary=class{constructor(t,e){this.h=t,this.F=e,this.R=new Set}wrap(i){try{const t=i;!function(t){const e=new Set;let n=Object.getPrototypeOf(t);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(t=>"function"==typeof(null===n||void 0===n?void 0:n[t])).forEach(t=>e.add(t)),n=Object.getPrototypeOf(n);return Array.from(e)}(t).forEach(e=>{const n=t[e];"$EB"in n||(t[e]=(...t)=>this.capture(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.U("eb:wrap",t)}}capture(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.U(e,t)):n}catch(t){return this.U(e,t),null}}logError(t,e){this.U(t,e)}U(s,r){try{i.Log.warn("Caught error in "+s,{error:r});n(this,void 0,void 0,function*(){var t,e,n=null!=r?r:Error("[Statsig] Error was empty"),i=n instanceof Error,o=i?n.name:"No Name";this.R.has(o)||(this.R.add(o),t=l.SDKType.K(this.h),e=a.StatsigMetadataProvider.get(),i=i?n.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(n),n=JSON.stringify($P({tag:s,exception:o,info:i},$P($P({},e),{sdkType:t}))),yield fetch(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.h,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(o=this.F)&&o.call(this,{name:"error",error:r}))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},788:(t,e)=>{$Q(e)},728:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};$Q(e),e.EventLogger=void 0;const o=n(832),s=n(780),r=n(256),u=n(452),l=n(48),a=n(876),c=n(444),d=n(412),h=n(84),v=n(100),_={},f=t=>{null!=(t=_[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,n,i){this.h=e,this.F=t,this.L=n,this.J=i,this.V=[],this.q={},this.B={},this.$=!1,this.H=Date.now(),(_[e]=this).Y=!0===(null==i?void 0:i.disableLogging),this.W=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;t=null!=(n=null==i?void 0:i.loggingIntervalMs)?n:1e4;const o=setInterval(()=>{_[e]?f(e):clearInterval(o)},t);this.X=o;n=null==i?void 0:i.networkConfig;this.tt=(0,h.et)(null==n?void 0:n.logEventUrl,null==n?void 0:n.api,"/rgstr",r.NetworkDefault.eventsApi),this.nt=(0,h.et)(null==n?void 0:n.logEventBeaconUrl,null==n?void 0:n.api,"/log_event_beacon",r.NetworkDefault.eventsApi),(0,v.it)(t=>{"background"===t&&f(e)}),this.st()}setLoggingDisabled(t){this.Y=t}enqueue(t){this.rt(t)&&(this.ut(t),this.lt(),this.V.length>this.W)&&f(this.h)}incrementNonExposureCount(t){var e=null!=(e=this.B[t])?e:0;this.B[t]=e+1}reset(){this.q={}}shutdown(){return i(this,void 0,void 0,function*(){this.X&&(clearInterval(this.X),this.X=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.ct(),0!==this.V.length&&(t=this.V,this.V=[],yield this.dt(t))})}lt(){this.$||(this.$=!0,200<Date.now()-this.H)||setTimeout(()=>f(this.h),200)}rt(t){if((0,a.ht)(t)){var t=[t.eventName,null==(e=t.user)?void 0:e.userID,null==(e=t.metadata)?void 0:e.gate,null==(e=t.metadata)?void 0:e.config,null==(e=t.metadata)?void 0:e.ruleID].join("|"),e=this.q[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.q).length&&(this.q={}),this.q[t]=n}return!0}dt(t){return i(this,void 0,void 0,function*(){if(this.Y)this.vt(t);else try{(!(0,v._t)()&&this.L.isBeaconSupported()?yield this.ft(t):yield this.gt(t)).success?this.F({name:"logs_flushed",events:t}):this.vt(t)}catch(t){s.Log.warn("Failed to flush events.")}})}gt(e){return i(this,void 0,void 0,function*(){var t=yield this.L.post({sdkKey:this.h,data:{events:e},url:this.tt,retries:3,params:{[u.NetworkParam.EventCount]:String(e.length)}}),t=null!=t&&t.body?(0,d.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}ft(t){return i(this,void 0,void 0,function*(){return{success:yield this.L.beacon({sdkKey:this.h,data:{events:t},url:this.nt})}})}vt(t){for(;500<t.length;)t.shift();var e=this.bt();(0,c.G)(e,t).catch(()=>{s.Log.warn("Unable to save failed logs to storage")})}st(){const e=this.bt();i(this,void 0,void 0,function*(){var t=yield(0,c.N)(e);t&&(yield c.Storage.C(e),yield this.dt(t))}).catch(()=>{s.Log.warn("Failed to flush stored logs")})}bt(){return"statsig.failed_logs."+(0,o.DJB2)(this.h)}ut(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.yt();n&&(e.statsigMetadata={currentPage:n}),this.V.push($P($P({},t),e))}ct(){0!==Object.keys(this.B).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.B)}}),this.B={})}yt(){var t;if(!1!==(null==(t=this.J)?void 0:t.includeCurrentPageUrlWithEvents))return(0,l.St)()}}},832:(t,e)=>{$Q(e),e.DJB2Object=e.DJB2=void 0;e.DJB2=e=>{let n=0;for(let t=0;t<e.length;t++){var i=e.charCodeAt(t);n=(n<<5)-n+i,n&=n}return String(n>>>0)};e.DJB2Object=t=>(0,e.DJB2)(JSON.stringify(o(t)));const o=n=>{if(null==n)return null;var t=Object.keys(n).sort();const i={};return t.forEach(t=>{let e=n[t];e instanceof Object&&(e=o(e)),i[t]=e}),i}},664:(t,e)=>{$Q(e)},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,o;$Q(e),e.Log=e.LogLevel=void 0,(o=i||(e.LogLevel=i={}))[o.None=0]="None",o[o.Error=1]="Error",o[o.Warn=2]="Warn",o[o.Info=3]="Info",o[o.Debug=4]="Debug";class s{static info(...t){this.level>=i.Info&&console.info(...n(t))}static debug(...t){this.level>=i.Debug&&console.debug(...n(t))}static warn(...t){this.level>=i.Warn&&console.warn(...n(t))}static error(...t){this.level>=i.Error&&console.error(...n(t))}}(e.Log=s).level=i.Error},188:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};$Q(e),e.NetworkCore=void 0,n(496);const h=n(280),v=n(780),o=n(452),s=n(360),r=n(612),u=n(604),l=n(972);e.NetworkCore=class{constructor(t,e){this.J=t,this.F=e,this.Ot=null!=(t=null==(e=null==t?void 0:t.networkConfig)?void 0:e.networkTimeoutMs)?t:1e4}post(e){return i(this,void 0,void 0,function*(){var t=yield this.jt(e);return this.Tt($P({method:"POST",body:this.wt(e,t)},e))})}get(t){return this.Tt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(n){return i(this,void 0,void 0,function*(){var t,e;return!!_(n)&&(t=yield this.It(n),e=yield this.jt(n),navigator.sendBeacon(t,e))})}Tt(c){var d;return i(this,void 0,void 0,function*(){if(!_(c))return null;var{method:e,body:n,retries:i}=c;const o=new AbortController;var t=setTimeout(()=>o.abort(`Timeout of ${this.Ot}ms expired.`),this.Ot),s=yield this.It(c),r=null;try{var u,l,a,r=yield fetch(s,{method:e,body:n,headers:$P({},c.headers),signal:o.signal});if(clearTimeout(t),r.ok)return a=yield r.text(),h.Diagnostics.mark(),{body:a,code:r.status};throw u=yield r.text().catch(()=>"No Text"),(l=new Error(`Failed to fetch: ${s} `+u)).name="NetworkError",l}catch(t){n=function(t,e){if(t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return null}(o,t);return h.Diagnostics.mark(),!i||i<=0?(null!=(d=this.F)&&d.call(this,{name:"error",error:t}),v.Log.error(`A networking error occured during ${e} request to ${s}.`,n,t),null):this.Tt($P($P({},c),{retries:i-1}))}})}It(e){return i(this,void 0,void 0,function*(){var t=$P({[o.NetworkParam.SdkKey]:e.sdkKey,[o.NetworkParam.SdkType]:s.SDKType.K(e.sdkKey),[o.NetworkParam.SdkVersion]:l.SDK_VERSION,[o.NetworkParam.Time]:String(Date.now()),[o.NetworkParam.SessionID]:yield r.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}jt(o){return i(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=o,n=yield u.StableID.get(e),i=yield r.SessionID.get(e),e=s.SDKType.K(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},l.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}wt(t,e){var n;return!(null!=(null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__["no-encode"])||null!=(n=this.J)&&n.disableStatsigEncoding)&&t.isStatsigEncodable&&"undefined"!=typeof window&&window.btoa&&(t.params=$P($P({},null!=(n=t.params)?n:{}),{[o.NetworkParam.StatsigEncoded]:"1"}),null!=(t=window.btoa(e).split("").reverse().join("")))?t:e}};const _=t=>!!t.sdkKey||(v.Log.warn("Unable to make request without an SDK key"),!1)},256:(t,e)=>{$Q(e),e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://events.statsigapi.net/v1",initializeApi:"https://featuregates.org/v1",specsApi:"https://api.statsigcdn.com/v1"}},452:(t,e)=>{$Q(e),e.NetworkParam=void 0,e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se"}},264:(t,e)=>{$Q(e)},360:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={K:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},At(t,e){n[t]=e},xt(t){i&&"-react"!==i||(i="-"+t)}}},48:(t,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.St=i.Mt=i.Dt=i.Et=i.Pt=i.kt=void 0;i.kt=()=>"undefined"!=typeof window?window:null,i.Pt=()=>{var t=(0,i.kt)();return null!=(t=null==t?void 0:t.document)?t:null},i.Et=()=>null!=(0,i.Pt)(),i.Dt=(t,e)=>{var n=(0,i.kt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.Mt=(t,e)=>{var n=(0,i.Pt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.St=()=>{var t;try{return null==(t=(0,i.kt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},612:function(t,r,e){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};Object.defineProperty(r,"__esModule",{value:!0}),r.SessionID=void 0;const i=e(832),u=e(780),l=e(444),a=e(556),c={},d={},h={};function v(t){return"statsig.session_id."+(0,i.DJB2)(t)}r.SessionID={get:t=>null!=h[t]?h[t]:h[t]=r.SessionID.Nt(t),Nt:s=>n(void 0,void 0,void 0,function*(){let e=c[s];var n=Date.now();if(null==e){let t=yield function(t){t=v(t);return(0,l.N)(t)}(s);null==t&&(t={sessionID:(0,a.getUUID)(),startTime:n,lastUpdate:n}),e=t,c[s]=e}var t=null!=(t=d[s])?t:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:()=>{}},i=((144e5<n-e.startTime||18e5<n-e.lastUpdate)&&(e.sessionID=(0,a.getUUID)(),e.startTime=n),e.lastUpdate=n,e),o=s;return o=v(s),(0,l.G)(o,i).catch(()=>{u.Log.warn("Failed to save SessionID")}),t.idleTimeoutID=r.SessionID.Ct(t,t.idleTimeoutID,18e5),t.ageTimeoutID=r.SessionID.Ct(t,t.ageTimeoutID,144e5-(n-e.startTime)),c[s]=e,d[s]=t,h[s]=null,e.sessionID}),Gt:(t,e)=>{var n=null!=(n=d[e])?n:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:t};n.emitFunction=t,d[e]=n},Ct:(t,e,n)=>(clearTimeout(null!=e?e:void 0),setTimeout(t.emitFunction,n))}},604:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};$Q(e),e.StableID=void 0;const o=n(832),s=n(780),r=n(444),u=n(556),l={};function a(t){return"statsig.stable_id."+(0,o.DJB2)(t)}function c(t,e){e=a(e);(0,r.G)(e,t).catch(()=>{s.Log.warn("Failed to save StableID")})}e.StableID={get:e=>i(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,r.N)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},688:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};$Q(e),e.StatsigClientBase=void 0,n(496);const l=n(496),a=n(512),c=n(728),d=n(780),h=n(48),v=n(612),_=n(604),f=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Ft={};var o,s=this.Rt.bind(this),r=(0,l.i)(),u=null!=(u=r.instances)?u:{};null!=i&&i.logLevel&&(d.Log.level=null==i?void 0:i.logLevel),null!=i&&i.disableStorage&&f.Storage.Ut(!0),null!=i&&i.overrideStableID&&_.StableID.setOverride(i.overrideStableID,t),this.l=new a.ErrorBoundary(t,s),this.l.wrap(this),this.l.wrap(n),this.l.wrap(e),this.h=t,this.J=null!=i?i:{},this.Kt=null!=(o=null==i?void 0:i.overrideAdapter)?o:null,this.Lt=new c.EventLogger(t,s,n,i),v.SessionID.Gt(()=>{this.Rt({name:"session_expired"})},t),null!=u[t]&&(0,h.Et)()&&d.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),u[t]=this,r.lastInstance=this,r.instances=u,__STATSIG__=r,this.dataAdapter=e,this.dataAdapter.attach(t,i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.J.disableLogging=t.disableLogging,this.Lt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.J.disableStorage=t.disableStorage,f.Storage.Ut(t.disableStorage))}flush(){return this.Lt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.Rt({name:"pre_shutdown"}),yield this.Lt.shutdown()})}on(t,e){this.Ft[t]||(this.Ft[t]=[]),this.Ft[t].push(e)}off(t,e){this.Ft[t]&&-1!==(e=this.Ft[t].indexOf(e))&&this.Ft[t].splice(e,1)}__on(t,e){e.__isInternal=!0,this.on(t,e)}Rt(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.l.logError("_emit:"+n.name,t):d.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Ft[n.name]&&this.Ft[n.name].forEach(t=>e(t)),null!=(t=this.Ft["*"])&&t.forEach(e)}Jt(t,e){this.loadingStatus=t,this.Rt({name:"values_updated",status:t,values:e})}Vt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Lt.incrementNonExposureCount(t):this.Lt.enqueue(e)}}},808:(t,e)=>{$Q(e)},283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{$Q(e),e.qt=e.zt=e.Bt=e.ht=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",l=(t,e,n,i,o)=>({eventName:t,user:e,value:null,metadata:s(n,i),secondaryExposures:o,time:Date.now()});e.ht=({eventName:t})=>t===i||t===n,e.Bt=(t,e)=>{return l(i,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.zt=(t,e)=>{return l(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.qt=(t,e,n)=>{var i,o=e.__evaluation,s=!0===(null==(s=null==o?void 0:o.explicit_parameters)?void 0:s.includes(n));let r="",u=null!=(i=null==o?void 0:o.undelegated_secondary_exposures)?i:[];return s&&(r=null!=(i=o.allocated_experiment_name)?i:"",u=o.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(s)},u)};const s=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="0.0.1-beta.35";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},384:(t,e)=>{$Q(e)},396:(t,e)=>{$Q(e),e.$t=e.Ht=e.Yt=e.Wt=void 0;const o="default";function s(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:o,__evaluation:n,value:i}}function r(s,r){return(t,e)=>{var n,i,o=null!=(o=null==s?void 0:s[t])?o:null;return null==o||null!=e&&(n=e,(i=t=>Array.isArray(t)?"array":typeof t)(o)!==i(n))?null!=e?e:null:(null!=r&&r(t),o)}}e.Wt=function(t,e,n){return s(t,e,n,!0===(null==n?void 0:n.value))},e.Yt=function(t,e,n){return $P($P({},s(t,e,n,null!=(t=null==n?void 0:n.value)?t:{})),{groupName:null,get:r(null==n?void 0:n.value)})},e.Ht=function(t,e,n,i){return $P($P({},s(t,e,n,void 0)),{get:r(null==n?void 0:n.value,i),groupName:null!=(t=null==n?void 0:n.group_name)?t:null,__value:null!=(e=null==n?void 0:n.value)?e:{}})},e.$t=function(t,e,n,i){return $P($P($P({},t),e),{get:r(n,i)})}},136:(t,e)=>{$Q(e)},296:(t,e,n)=>{$Q(e),e.getUnitIDFromUser=e.getUserStorageKey=e.normalizeUser=void 0;const i=n(832);e.normalizeUser=function(t,e){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&(n.statsigEnvironment=e),n}catch(t){throw new Error("User object must be convertable to JSON string.")}},e.getUserStorageKey=function(t,e){return(0,i.DJB2Object)({sdkKey:t,user:e})},e.getUnitIDFromUser=function(t,e){var n;return"string"==typeof e&&"userid"!==e.toLowerCase()?null!=(n=null==(n=t.customIDs)?void 0:n[e])?n:null==(n=null==t?void 0:t.customIDs)?void 0:n[e.toLowerCase()]:t.userID}},444:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})},n=($Q(e),e.G=e.N=e.Storage=void 0,n(780));const o={},s={Qt:()=>"InMemory",D(t){return null!=(t=o[t])?t:null},Xt(t){return Promise.resolve(null!=(t=o[t])?t:null)},P(t,e){return o[t]=e,Promise.resolve()},C(t){return delete o[t],Promise.resolve()},Zt(){return Promise.resolve(Object.keys(o))}};let r=null;try{"undefined"!=typeof window&&"localStorage"in window&&(r={Qt:()=>"LocalStorage",D(t){return localStorage.getItem(t)},Xt(t){return Promise.resolve(localStorage.getItem(t))},P(t,e){return localStorage.setItem(t,e),Promise.resolve()},C(t){return localStorage.removeItem(t),Promise.resolve()},Zt(){var t=Object.keys(localStorage);return Promise.resolve(t)}})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let u=null!==r&&void 0!==r?r:s,l=u;e.Storage={Qt:()=>l.Qt(),Xt:t=>l.Xt(t),P:(t,e)=>l.P(t,e),C:t=>l.C(t),Zt:()=>l.Zt(),D:t=>{var e;return null!=(e=null==(e=l.D)?void 0:e.call(l,t))?e:null},te:t=>{u=t,l=t},Ut:t=>{l=t?s:u}},e.N=function(e){return i(this,void 0,void 0,function*(){var t=yield l.Xt(e);return JSON.parse(null!=t?t:"null")})},e.G=function(t,e){return i(this,void 0,void 0,function*(){yield l.P(t,JSON.stringify(e))})}},412:(t,e,n)=>{$Q(e),e.typedJsonParse=void 0;const o=n(780);e.typedJsonParse=function(t,e,n){try{var i=JSON.parse(t);return"object"==typeof i&&0 in i,i}catch(t){}return o.Log.error(n),null}},556:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let n=(new Date).getTime(),i="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<n?(e=(n+e)%16|0,n=Math.floor(n/16)):(e=(i+e)%16|0,i=Math.floor(i/16)),("x"===t?e:7&e|8).toString(16)})}},84:(t,e)=>{$Q(e),e.et=void 0,e.et=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{$Q(e)},100:(t,e,n)=>{$Q(e),e.ee=e.it=e._t=void 0;n=n(48);const i="foreground",o="background",s=[];let r=i;e._t=()=>r===i,e.it=t=>{s.unshift(t)};e.ee=e=>{e!==r&&(r=e,s.forEach(t=>t(e)))},(0,n.Dt)("focus",()=>(0,e.ee)(i)),(0,n.Dt)("blur",()=>(0,e.ee)(o)),(0,n.Dt)("beforeunload",()=>(0,e.ee)(o)),(0,n.Mt)("visibilitychange",()=>{(0,e.ee)("visible"===document.visibilityState?i:o)})},464:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var o=Object.getOwnPropertyDescriptor(e,n);o&&("get"in o?e.__esModule:!o.writable&&!o.configurable)||(o={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,o)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),o=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),e.Log=e.Storage=e.EventLogger=void 0,n(496);const s=n(728),r=(Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return s.EventLogger}}),n(780));Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return r.Log}});var u=n(972);const l=n(444);Object.defineProperty(e,"Storage",{enumerable:!0,get:function(){return l.Storage}});var a=n(556);o(n(496),e),o(n(856),e),o(n(320),e),o(n(184),e),o(n(512),e),o(n(500),e),o(n(788),e),o(n(832),e),o(n(664),e),o(n(780),e),o(n(452),e),o(n(188),e),o(n(256),e),o(n(264),e),o(n(48),e),o(n(360),e),o(n(612),e),o(n(604),e),o(n(688),e),o(n(808),e),o(n(283),e),o(n(876),e),o(n(972),e),o(n(384),e),o(n(396),e),o(n(136),e),o(n(296),e),o(n(444),e),o(n(412),e),o(n(84),e),o(n(539),e),o(n(556),e),o(n(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:s.EventLogger,Log:r.Log,getUUID:a.getUUID,Storage:l.Storage,SDK_VERSION:u.SDK_VERSION})},920:(t,e,n)=>{$Q(e),e.AutoInit=void 0;const d=n(464),h=n(208);function v(t,e){var n;return null!=(n=e.get(t))?n:e.get(t.toLowerCase())}e.AutoInit=class{static attempt(e){var t,n,i;try{var o=(0,d.kt)(),s=(0,d.Pt)();if(o&&s&&s.currentScript){var r=s.currentScript.getAttribute("src"),u=null==(t=o.location)?void 0:t.href;if(r&&u){var l=new URL(r,u).searchParams,a=null!=(n=v("sdkKey",l))?n:v("apiKey",l);if(a){var c=null==(i=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:i[a];let t=null;(t=c instanceof h.StatsigClient?c:t)||(t=new h.StatsigClient(a,{})).initializeAsync().catch(t=>{d.Log.error(t)}),e({sdkKey:a,client:t})}}}}catch(t){d.Log.error("AutoInit failed",t)}}}},96:(t,e,n)=>{$Q(e),e.resolveDeltasResponse=void 0;const i=n(464);function o(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.resolveDeltasResponse=function(t,e){var n;return(e=(0,i.typedJsonParse)(e,"checksum","Failed to parse DeltasEvaluationResponse"))?(t=t,n=e,t=$P($P($P({},t),n),{feature_gates:$P($P({},t.feature_gates),n.feature_gates),layer_configs:$P($P({},t.layer_configs),n.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),n.dynamic_configs)}),o((t=n=t).deleted_gates,t.feature_gates),delete t.deleted_gates,o(n.deleted_configs,t.dynamic_configs),delete t.deleted_configs,o(n.deleted_layers,t.layer_configs),delete t.deleted_layers,n=t,(t=(0,i.DJB2Object)({feature_gates:n.feature_gates,dynamic_configs:n.dynamic_configs,layer_configs:n.layer_configs}))===e.checksum?JSON.stringify(n):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:n,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},156:(t,e,n)=>{$Q(e);const i=n(464);e.default=class{constructor(){this.ne=null,this.ie=null,this.oe="Uninitialized",this.se=0,this.re=0}getValues(){return this.ne?(0,i.typedJsonParse)(this.ne,"has_updates","Failed to parse EvaluationStoreValues"):null}reset(){this.ie=null,this.ne=null,this.oe="Loading",this.se=0,this.re=0}finalize(){this.ie||(this.oe="NoValues")}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=(0,i.typedJsonParse)(t.data,"has_updates","Failed to parse EvaluationResponse"))?void 0:e.has_updates)&&(this.ne=t.data,this.se=e.time,this.re=t.receivedAt,this.oe=t.source,this.ie=e)}getGate(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.feature_gates[t])?e:null;return this.ue(t)}getConfig(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.dynamic_configs[t])?e:null;return this.ue(t)}getLayer(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.layer_configs[t])?e:null;return this.ue(t)}ue(t){return{evaluation:t,details:this.le(null==t)}}le(t){return"Uninitialized"===this.oe||"NoValues"===this.oe?{reason:this.oe}:{reason:this.oe+":"+(t?"Unrecognized":"Recognized"),lcut:this.se,receivedAt:this.re}}}},400:function(t,e,n){var s=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};$Q(e);const r=n(464),u=n(96);class i extends r.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.ae=(0,r.et)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",r.NetworkDefault.initializeApi)}fetchEvaluations(n,i,o){return s(this,void 0,void 0,function*(){var t=i?(0,r.typedJsonParse)(i,"has_updates","Failed to parse cached EvaluationResponse"):null;let e={user:o,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.ce(n,t,e)})}ce(e,n,i){var o;return s(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.ae,data:i,retries:2,isStatsigEncodable:!0});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(o=null==t?void 0:t.body)?o:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(o=t.body)?void 0:o.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,u.resolveDeltasResponse)(n,t.body))?t:this.ce(e,n,$P($P($P({},i),t),{deltasResponseRequested:!1}))})}}e.default=i},520:function(t,e,n){var o=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};$Q(e);const r=n(464),s=n(156),u=n(400),l=n(364);class i extends r.StatsigClientBase{static instance(t){var e=(0,r.i)().instance(t);return e instanceof i?e:(r.Log.warn("Unable to find StatsigClient instance"),new i(null!=t?t:"",{}))}constructor(t,e,n=null){r.SDKType.At(t,"javascript-client");var i=new u.default(n,t=>{this.Rt(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new l.StatsigEvaluationsDataAdapter,i,n),this.de=new s.default,this.he=e}initializeSync(){this.updateUserSync(this.he)}initializeAsync(t){return this.updateUserAsync(this.he,t)}updateUserSync(t){this.ve(t);t=this.dataAdapter.getDataSync(this.he);this.de.setValuesFromDataAdapter(t),this.de.finalize(),this.Jt("Ready",t),this._e(null!=t?t:null,this.he)}updateUserAsync(n,i){return o(this,void 0,void 0,function*(){this.ve(n);var t=this.he,e=this.dataAdapter.getDataSync(t);this.Jt("Loading",e),this.de.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.he&&this.de.setValuesFromDataAdapter(e),this.de.finalize(),this.Jt("Ready",e)})}getContext(){return{sdkKey:this.h,options:this.J,values:this.de.getValues(),user:JSON.parse(JSON.stringify(this.he)),errorBoundary:this.l}}getAsyncContext(){return o(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{sessionID:yield r.SessionID.get(this.h),stableID:yield r.StableID.get(this.h)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var n=(0,r.DJB2)(t),{evaluation:n,details:i}=this.de.getGate(n),i=(0,r.Wt)(t,i,n),o=null==(o=null==(n=this.Kt)?void 0:n.getGateOverride)?void 0:o.call(n,i,this.he,e),n=null!=o?o:i;return this.Vt(t,(0,r.Bt)(this.he,n),e),this.Rt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.fe("dynamic_config",t,e);return this.Rt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.fe("experiment",t,e);return this.Rt({name:"experiment_evaluation",experiment:t}),t}getLayer(e,n){var t=(0,r.DJB2)(e),{evaluation:t,details:i}=this.de.getLayer(t),i=(0,r.Ht)(e,i,t),o=null==(o=null==(t=this.Kt)?void 0:t.getLayerOverride)?void 0:o.call(t,i,this.he,n);const s=(0,r.$t)(i,o,null!=(t=null==o?void 0:o.__value)?t:i.__value,t=>{this.Vt(e,(0,r.qt)(this.he,s,t),n)});return this.Rt({name:"layer_evaluation",layer:s}),s}logEvent(t,e,n){this.Lt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.he,time:Date.now()}))}_e(t,e){this.dataAdapter.getDataAsync(t,e).catch(t=>{r.Log.error("An error occurred after update.",t)})}ve(t){this.Lt.reset(),this.de.reset(),this.he=(0,r.normalizeUser)(t,this.J.environment)}fe(t,e,n){var i=(0,r.DJB2)(e),{evaluation:i,details:o}=this.de.getConfig(i),o=(0,r.Yt)(e,o,i),i="experiment"===t?null==(t=null==(i=this.Kt)?void 0:i.getExperimentOverride)?void 0:t.call(i,o,this.he,n):null==(i=null==(t=this.Kt)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,o,this.he,n),t=null!=i?i:o;return this.Vt(e,(0,r.zt)(this.he,t),n),t}}e.default=i},364:function(t,e,n){var o=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})},i=($Q(e),e.StatsigEvaluationsDataAdapter=void 0,n(464));const s=n(400);class r extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.L=null}attach(t,e){super.attach(t,e),this.L=new s.default(null!=e?e:{})}getDataAsync(t,e,n){return this.O(t,e,n)}prefetchData(t,e){return this.T(t,e)}I(e,n){var i;return o(this,void 0,void 0,function*(){var t=yield null==(i=this.L)?void 0:i.fetchEvaluations(this.M(),e,n);return null!=t?t:null})}}e.StatsigEvaluationsDataAdapter=r},208:(t,e,n)=>{$Q(e),e.StatsigClient=e.StatsigEvaluationsDataAdapter=void 0;var i=n(520);e.StatsigClient=i.default;const o=n(364);Object.defineProperty(e,"StatsigEvaluationsDataAdapter",{enumerable:!0,get:function(){return o.StatsigEvaluationsDataAdapter}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigEvaluationsDataAdapter:o.StatsigEvaluationsDataAdapter,StatsigClient:i.default}),e.default=__STATSIG__},536:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{s(l.next(t))}catch(t){e(t)}}function o(t){try{s(l.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}s((l=l.apply(t,r||[])).next())})};$Q(e),e.AutoCapture=e.runStatsigAutoCapture=void 0;const o=n(464),s=n(76);e.runStatsigAutoCapture=function(t){new r(t)};class r{constructor(t){this.ge=t,this.be=Date.now(),this.me=0;var e,{sdkKey:t,errorBoundary:n}=t.getContext(),n=(this.l=n,this.l.wrap(this),(0,o.Pt)());(0,o.Et)()&&((e=null!=(e=(__STATSIG__=(0,o.i)()).acInstances)?e:{})[t]=this,__STATSIG__.acInstances=e),"loading"===(null==n?void 0:n.readyState)?n.addEventListener("DOMContentLoaded",()=>this.ye()):this.ye()}pe(){const e=(0,o.kt)();var t,n=(0,o.Pt)();e&&n&&(t=t=>{this.Se(t||e.event)},(0,s.Oe)(n,"click",t),(0,s.Oe)(n,"submit",t),(0,s.Oe)(e,"error",t),(0,s.Oe)(e,"beforeunload",()=>this.je()),(0,s.Oe)(e,"scroll",()=>this.Te()))}Se(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.we(t):(e=(0,s.Ie)(t))&&(0,s.rt)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,s.Ae)(e),this.xe(n,t,e))}ye(){this.pe(),this.Me(),this.De()}we(t){var e=(null==t?void 0:t.error)||{};let n=e;if("object"==typeof e)try{n=JSON.stringify(e)}catch(t){n="function"==typeof(null==e?void 0:e.toString)?e.toString():"Unknown Error"}this.xe("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}Me(){setTimeout(()=>{var t,e=(0,s.Ee)();this.Pe("page_view",(0,s.ke)(),{title:null==(t=(0,o.Pt)())?void 0:t.title,queryParams:Object.fromEntries(e.searchParams)})},1)}De(){const n=(0,o.kt)();void 0!==(null===n||void 0===n?void 0:n.performance)&&"function"==typeof n.performance.getEntriesByType&&"function"==typeof n.performance.getEntriesByName&&setTimeout(()=>{var t={},e=n.performance.getEntriesByType("navigation"),e=(e&&0<e.length&&e[0]instanceof PerformanceNavigationTiming&&(e=e[0],t.load_time_ms=e.duration,t.dom_interactive_time_ms=e.domInteractive-e.startTime,t.redirect_count=e.redirectCount,t.transfer_bytes=e.transferSize),n.performance.getEntriesByName("first-contentful-paint"));e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),this.xe("performance",(0,s.ke)(),t)},1)}je(){this.Pe("page_view_end",(0,s.ke)(),{scrollDepth:this.me,pageViewLength:Date.now()-this.be})}xe(e,n,i){this.Ne().then(t=>{t={eventName:"auto_capture::"+e,value:n,metadata:$P({sessionID:t,page_url:null!=(t=null==(t=null==(t=(0,o.kt)())?void 0:t.location)?void 0:t.href)?t:""},i)};this.ge.logEvent(t)}).catch(t=>{this.l.logError("AC::enqueue",t)})}Pe(t,e,n){this.xe(t,e,n),this.ge.flush().catch(t=>{o.Log.error(t)})}Te(){var t=null!=(t=null==(t=(0,o.Pt)())?void 0:t.body.scrollHeight)?t:1,e=(0,o.kt)(),n=null!=(n=null==e?void 0:e.scrollY)?n:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.me=Math.max(this.me,Math.min(100,Math.round((n+e)/t*100)))}Ne(){return i(this,void 0,void 0,function*(){return(yield this.ge.getAsyncContext()).sessionID})}}e.AutoCapture=r},76:(t,e,n)=>{$Q(e),e.Oe=e.ke=e.Ee=e.rt=e.Ie=e.Ae=void 0;const i=n(464);function s(e){if(e){let t=e;for(;t;){var n=t.tagName.toLowerCase();if(["body","document"].includes(n))return null;if("a"===t.tagName.toLowerCase())return t;t=t.parentElement}}return null}e.Ae=function(t){var e=t.tagName.toLowerCase(),n={},i=e,o=("form"===e&&(n.action=t.getAttribute("action"),n.method=null!=(o=t.getAttribute("method"))?o:"GET",n.formName=t.getAttribute("name"),n.formId=t.getAttribute("id")),["input","select","textarea"].includes(e)&&"password"!==t.getAttribute("type")&&(n.content=t.value,n.inputName=t.getAttribute("name")),"button"===e&&(n.content=(t.textContent||"").trim()),s(t));return o&&(n.href=o.getAttribute("href")),{value:i,metadata:n}},e.Ie=function(t){if(!t)return null;let e=t.target||t.srcElement;return e&&e instanceof Element?e=3===e.nodeType?e.parentNode||null:e:null},e.rt=function(t,e){if(!t||!e||1!==e.nodeType)return!1;var n=e.tagName.toLowerCase(),i=t.type.toLowerCase();switch(n){case"html":return!1;case"form":return"submit"===i;case"input":case"select":case"textarea":return["change"].includes(i);default:if("click"===i){if("button"===n)return!0;if(s(e))return!0}return!1}},e.Ee=function(){var t=null!=(t=null==(t=null==(t=(0,i.kt)())?void 0:t.location)?void 0:t.href)?t:"";let e;try{e=new URL(t)}catch(t){e=new URL("error:")}return e},e.ke=function(){return(0,i.St)()||""},e.Oe=function(t,e,n){t&&t.addEventListener&&t.addEventListener(e,n,!0)}},824:(t,e,n)=>{$Q(e),e.runStatsigAutoCapture=e.AutoCapture=void 0;const i=n(536);Object.defineProperty(e,"AutoCapture",{enumerable:!0,get:function(){return i.AutoCapture}}),Object.defineProperty(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return i.runStatsigAutoCapture}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:i.AutoCapture,runStatsigAutoCapture:i.runStatsigAutoCapture}),e.default=__STATSIG__}},i={};function o(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,o)),e.exports}o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}();var t={};{var e=t;const r=o(824);var s=o(920);e.default=__STATSIG__,s.AutoInit.attempt(({client:t})=>{new r.AutoCapture(t)})}return t.default})());
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $P = (a,b) => Object.assign(a,b);var i={496:(t,e,i)=>{$Q(e),e.t=e.i=void 0,e.i=()=>null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:u;e.t=t=>{var e;return t?null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:e[t]:null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.lastInstance};var n,s="__STATSIG__",o="undefined"!=typeof window?window:{},i=void 0!==i.g?i.g:{},r="undefined"!=typeof globalThis?globalThis:{};const u=null!=(n=null!=(n=null!=(n=o[s])?n:i[s])?n:r[s])?n:{instance:e.t};o[s]=u,i[s]=u,r[s]=u},856:(t,e)=>{$Q(e)},320:function(t,e,i){var o=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.DataAdapterCore=void 0;const n=i(512),r=i(780),s=i(283),u=i(296),l=i(444),a=i(412);e.DataAdapterCore=class{constructor(t,e){this.o=t,this.l=e,this.u=null,this.h=null,this.v={},this._="statsig.last_modified_time."+e}attach(t,e){this.h=t,this.u=new n.ErrorBoundary(t)}getDataSync(t){var t=this.m(t),e=this.v[t];return e||((e=this.p(t))?(this.S(t,e),this.v[t]):null)}setData(t,e){e=this.m(e);this.S(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.v=$P($P({},this.v),t)}O(e,i,n){var s;return o(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(i),t=[this.j(null!=(s=null==t?void 0:t.data)?s:null,i)];return null!=n&&n.timeoutMs&&t.push(new Promise(t=>setTimeout(t,n.timeoutMs)).then(()=>(r.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}T(i,n){return o(this,void 0,void 0,function*(){var t=this.m(i),e=yield this.O(null,i,n);e&&this.S(t,$P($P({},e),{source:"Prefetch"}))})}j(n,s){return o(this,void 0,void 0,function*(){var t=yield this.I(n,s);if(!t)return r.Log.debug("No response returned for latest value"),null;var e=(0,a.typedJsonParse)(t,"has_updates","Failure while attempting to persist latest value");let i=null;return!0===(null==e?void 0:e.has_updates)?i={source:"Network",data:t,receivedAt:Date.now()}:n&&!1===(null==e?void 0:e.has_updates)&&(i={source:"NetworkNotModified",data:n,receivedAt:Date.now()}),i?(t=this.m(s),this.S(t,i),yield this.A(t,i),i):null})}M(){return null!=this.h?this.h:(r.Log.error(this.o+" is not attached to a Client"),"")}m(t){t=(0,u.getUserStorageKey)(this.M(),t);return`${s.DataAdapterCachePrefix}.${this.l}.`+t}S(t,e){var i=Object.entries(this.v);i.length<10||([i]=i.reduce((t,e)=>e[1]<t[1]?e:t),delete this.v[i]),this.v[t]=e}p(t){var e=null==(e=l.Storage.D)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,a.typedJsonParse)(e,"source","Failed to parse cached result"))?$P($P({},t),{source:"Cache"}):null}A(t,e){return o(this,void 0,void 0,function*(){yield l.Storage.k(t,JSON.stringify(e)),yield this.N(t)})}N(i){var n;return o(this,void 0,void 0,function*(){var t=null!=(n=yield(0,l.P)(this._))?n:{},e=(t[i]=Date.now(),Object.entries(t));e.length<=10||(delete t[(e=e.reduce((t,e)=>e[1]<t[1]?e:t))[0]],yield l.Storage.C(e[0])),yield(0,l.G)(this._,t)})}}},280:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},184:(t,e)=>{$Q(e)},512:function(t,u,e){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};Object.defineProperty(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const n=e(780),l=e(360),a=e(972);u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";u.ErrorBoundary=class{constructor(t,e){this.h=t,this.U=e,this.R=new Set}wrap(n){try{const t=n;!function(t){const e=new Set;let i=Object.getPrototypeOf(t);for(;i&&i!==Object.prototype;)Object.getOwnPropertyNames(i).filter(t=>"function"==typeof(null===i||void 0===i?void 0:i[t])).forEach(t=>e.add(t)),i=Object.getPrototypeOf(i);return Array.from(e)}(t).forEach(e=>{const i=t[e];"$EB"in i||(t[e]=(...t)=>this.capture(e,()=>i.apply(n,t)),t[e].$EB=!0)})}catch(t){this.F("eb:wrap",t)}}capture(e,t){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.F(e,t)):i}catch(t){return this.F(e,t),null}}logError(t,e){this.F(t,e)}F(o,r){try{n.Log.warn("Caught error in "+o,{error:r});i(this,void 0,void 0,function*(){var t,e,i=null!=r?r:Error("[Statsig] Error was empty"),n=i instanceof Error,s=n?i.name:"No Name";this.R.has(s)||(this.R.add(s),t=l.SDKType.L(this.h),e=a.StatsigMetadataProvider.get(),n=n?i.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(i),i=JSON.stringify($P({tag:o,exception:s,info:n},$P($P({},e),{sdkType:t}))),yield fetch(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.h,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:i}),null!=(s=this.U)&&s.call(this,{name:"error",error:r}))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},788:(t,e)=>{$Q(e)},728:function(t,e,i){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.EventLogger=void 0;const s=i(832),o=i(780),r=i(256),u=i(452),l=i(48),a=i(876),c=i(444),d=i(412),h=i(84),v=i(100);e.EventLogger=class{constructor(t,e,i,n){this.h=t,this.U=e,this.K=i,this.J=n,this.q=[],this.V={},this.B={},this.$=!1,this.H=Date.now(),this.W=!0===(null==n?void 0:n.disableLogging),this.Y=null!=(t=null==n?void 0:n.loggingBufferMaxSize)?t:50;i=null!=(e=null==n?void 0:n.loggingIntervalMs)?e:1e4,this.X=setInterval(()=>this.Z(),i),t=null==n?void 0:n.networkConfig;this.tt=(0,h.et)(null==t?void 0:t.logEventUrl,null==t?void 0:t.api,"/rgstr",r.NetworkDefault.eventsApi),this.nt=(0,h.et)(null==t?void 0:t.logEventBeaconUrl,null==t?void 0:t.api,"/log_event_beacon",r.NetworkDefault.eventsApi),(0,v.it)(this.st.bind(this)),this.ot()}setLoggingDisabled(t){this.W=t}enqueue(t){this.rt(t)&&(this.lt(t),this.ut(),this.q.length>this.Y)&&this.Z()}incrementNonExposureCount(t){var e=null!=(e=this.B[t])?e:0;this.B[t]=e+1}reset(){this.V={}}shutdown(){return n(this,void 0,void 0,function*(){this.X&&(clearInterval(this.X),this.X=null),yield this.flush()})}flush(){return n(this,void 0,void 0,function*(){var t;this.ct(),0!==this.q.length&&(t=this.q,this.q=[],yield this.dt(t))})}st(t){"background"===t&&this.Z()}ut(){this.$||(this.$=!0,200<Date.now()-this.H)||setTimeout(()=>this.Z(),200)}rt(t){if((0,a.ht)(t)){var t=[t.eventName,null==(e=t.user)?void 0:e.userID,null==(e=t.metadata)?void 0:e.gate,null==(e=t.metadata)?void 0:e.config,null==(e=t.metadata)?void 0:e.ruleID].join("|"),e=this.V[t],i=Date.now();if(e&&i-e<6e4)return!1;1e3<Object.keys(this.V).length&&(this.V={}),this.V[t]=i}return!0}Z(){this.flush().catch(()=>{})}dt(t){return n(this,void 0,void 0,function*(){if(this.W)this.vt(t);else try{(!(0,v._t)()&&this.K.isBeaconSupported()?yield this.ft(t):yield this.gt(t)).success?this.U({name:"logs_flushed",events:t}):this.vt(t)}catch(t){o.Log.warn("Failed to flush events.")}})}gt(e){return n(this,void 0,void 0,function*(){var t=yield this.K.post({sdkKey:this.h,data:{events:e},url:this.tt,retries:3,params:{[u.NetworkParam.EventCount]:String(e.length)}}),t=null!=t&&t.body?(0,d.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}ft(t){return n(this,void 0,void 0,function*(){return{success:yield this.K.beacon({sdkKey:this.h,data:{events:t},url:this.nt})}})}vt(t){for(;500<t.length;)t.shift();var e=this.bt();(0,c.G)(e,t).catch(()=>{o.Log.warn("Unable to save failed logs to storage")})}ot(){const e=this.bt();n(this,void 0,void 0,function*(){var t=yield(0,c.P)(e);t&&(yield c.Storage.C(e),yield this.dt(t))}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}bt(){return"statsig.failed_logs."+(0,s.DJB2)(this.h)}lt(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},i=this.yt();i&&(e.statsigMetadata={currentPage:i}),this.q.push($P($P({},t),e))}ct(){0!==Object.keys(this.B).length&&(this.lt({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.B)}}),this.B={})}yt(){var t;if(!1!==(null==(t=this.J)?void 0:t.includeCurrentPageUrlWithEvents))return(0,l.ln)()}}},832:(t,e)=>{$Q(e),e.DJB2Object=e.DJB2=void 0;e.DJB2=e=>{let i=0;for(let t=0;t<e.length;t++){var n=e.charCodeAt(t);i=(i<<5)-i+n,i&=i}return String(i>>>0)};e.DJB2Object=t=>(0,e.DJB2)(JSON.stringify(s(t)));const s=i=>{if(null==i)return null;var t=Object.keys(i).sort();const n={};return t.forEach(t=>{let e=i[t];e instanceof Object&&(e=s(e)),n[t]=e}),n}},664:(t,e)=>{$Q(e)},780:(t,e)=>{function i(t){return t.unshift("[Statsig]"),t}var n,s;$Q(e),e.Log=e.LogLevel=void 0,(s=n||(e.LogLevel=n={}))[s.None=0]="None",s[s.Error=1]="Error",s[s.Warn=2]="Warn",s[s.Info=3]="Info",s[s.Debug=4]="Debug";class o{static info(...t){this.level>=n.Info&&console.info(...i(t))}static debug(...t){this.level>=n.Debug&&console.debug(...i(t))}static warn(...t){this.level>=n.Warn&&console.warn(...i(t))}static error(...t){this.level>=n.Error&&console.error(...i(t))}}(e.Log=o).level=n.Error},188:function(t,e,i){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.NetworkCore=void 0,i(496);const h=i(280),v=i(780),s=i(452),o=i(360),r=i(612),u=i(604),l=i(972);e.NetworkCore=class{constructor(t,e){this.J=t,this.U=e,this.Ot=null!=(t=null==(e=null==t?void 0:t.networkConfig)?void 0:e.networkTimeoutMs)?t:1e4}post(e){return n(this,void 0,void 0,function*(){var t=yield this.jt(e);return this.Tt($P({method:"POST",body:this.wt(e,t)},e))})}get(t){return this.Tt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(i){return n(this,void 0,void 0,function*(){var t,e;return!!_(i)&&(t=yield this.It(i),e=yield this.jt(i),navigator.sendBeacon(t,e))})}Tt(c){var d;return n(this,void 0,void 0,function*(){if(!_(c))return null;var{method:e,body:i,retries:n}=c;const s=new AbortController;var t=setTimeout(()=>s.abort(`Timeout of ${this.Ot}ms expired.`),this.Ot),o=yield this.It(c),r=null;try{var u,l,a,r=yield fetch(o,{method:e,body:i,headers:$P({},c.headers),signal:s.signal});if(clearTimeout(t),r.ok)return a=yield r.text(),h.Diagnostics.mark(),{body:a,code:r.status};throw u=yield r.text().catch(()=>"No Text"),(l=new Error(`Failed to fetch: ${o} `+u)).name="NetworkError",l}catch(t){i=function(t,e){if(t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return null}(s,t);return h.Diagnostics.mark(),!n||n<=0?(null!=(d=this.U)&&d.call(this,{name:"error",error:t}),v.Log.error(`A networking error occured during ${e} request to ${o}.`,i,t),null):this.Tt($P($P({},c),{retries:n-1}))}})}It(e){return n(this,void 0,void 0,function*(){var t=$P({[s.NetworkParam.SdkKey]:e.sdkKey,[s.NetworkParam.SdkType]:o.SDKType.L(e.sdkKey),[s.NetworkParam.SdkVersion]:l.SDK_VERSION,[s.NetworkParam.Time]:String(Date.now()),[s.NetworkParam.SessionID]:yield r.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}jt(s){return n(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=s,i=yield u.StableID.get(e),n=yield r.SessionID.get(e),e=o.SDKType.L(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},l.StatsigMetadataProvider.get()),{stableID:i,sessionID:n,sdkType:e})}))})}wt(t,e){var i;return!(null!=(null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__["no-encode"])||null!=(i=this.J)&&i.disableStatsigEncoding)&&t.isStatsigEncodable&&"undefined"!=typeof window&&window.btoa&&(t.params=$P($P({},null!=(i=t.params)?i:{}),{[s.NetworkParam.StatsigEncoded]:"1"}),null!=(t=window.btoa(e).split("").reverse().join("")))?t:e}};const _=t=>!!t.sdkKey||(v.Log.warn("Unable to make request without an SDK key"),!1)},256:(t,e)=>{$Q(e),e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://events.statsigapi.net/v1",initializeApi:"https://featuregates.org/v1",specsApi:"https://api.statsigcdn.com/v1"}},452:(t,e)=>{$Q(e),e.NetworkParam=void 0,e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se"}},264:(t,e)=>{$Q(e)},360:(t,e)=>{$Q(e),e.SDKType=void 0;const i={};let n;e.SDKType={L:t=>{return(null!=(t=i[t])?t:"js-mono")+(null!==n&&void 0!==n?n:"")},At(t,e){i[t]=e},Mt(t){n&&"-react"!==n||(n="-"+t)}}},48:(t,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.ln=n.xt=n.Dt=n.an=n.Et=n.kt=void 0;n.kt=()=>"undefined"!=typeof window?window:null,n.Et=()=>{var t=(0,n.kt)();return null!=(t=null==t?void 0:t.document)?t:null},n.an=()=>null!=(0,n.Et)(),n.Dt=(t,e)=>{var i=(0,n.kt)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)},n.xt=(t,e)=>{var i=(0,n.Et)();"function"==typeof(null==i?void 0:i.addEventListener)&&i.addEventListener(t,e)};n.ln=()=>{var t;try{return null==(t=(0,n.kt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},612:function(t,r,e){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};Object.defineProperty(r,"__esModule",{value:!0}),r.SessionID=void 0;const n=e(832),u=e(780),l=e(444),a=e(556),c={},d={},h={};function v(t){return"statsig.session_id."+(0,n.DJB2)(t)}r.SessionID={get:t=>null!=h[t]?h[t]:h[t]=r.SessionID.Nt(t),Nt:o=>i(void 0,void 0,void 0,function*(){let e=c[o];var i=Date.now();if(null==e){let t=yield function(t){t=v(t);return(0,l.P)(t)}(o);null==t&&(t={sessionID:(0,a.getUUID)(),startTime:i,lastUpdate:i}),e=t,c[o]=e}var t=null!=(t=d[o])?t:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:()=>{}},n=((144e5<i-e.startTime||18e5<i-e.lastUpdate)&&(e.sessionID=(0,a.getUUID)(),e.startTime=i),e.lastUpdate=i,e),s=o;return s=v(o),(0,l.G)(s,n).catch(()=>{u.Log.warn("Failed to save SessionID")}),t.idleTimeoutID=r.SessionID.Pt(t,t.idleTimeoutID,18e5),t.ageTimeoutID=r.SessionID.Pt(t,t.ageTimeoutID,144e5-(i-e.startTime)),c[o]=e,d[o]=t,h[o]=null,e.sessionID}),Ct:(t,e)=>{var i=null!=(i=d[e])?i:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:t};i.emitFunction=t,d[e]=i},Pt:(t,e,i)=>(clearTimeout(null!=e?e:void 0),setTimeout(t.emitFunction,i))}},604:function(t,e,i){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.StableID=void 0;const s=i(832),o=i(780),r=i(444),u=i(556),l={};function a(t){return"statsig.stable_id."+(0,s.DJB2)(t)}function c(t,e){e=a(e);(0,r.G)(e,t).catch(()=>{o.Log.warn("Failed to save StableID")})}e.StableID={get:e=>n(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,r.P)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},688:function(t,e,i){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.StatsigClientBase=void 0,i(496);const l=i(496),a=i(512),c=i(728),d=i(780),h=i(48),v=i(612),_=i(604),f=i(444);e.StatsigClientBase=class{constructor(t,e,i,n){this.loadingStatus="Uninitialized",this.Gt={};var s,o=this.St.bind(this),r=(0,l.i)(),u=null!=(u=r.instances)?u:{};null!=n&&n.logLevel&&(d.Log.level=null==n?void 0:n.logLevel),null!=n&&n.disableStorage&&f.Storage.Rt(!0),null!=n&&n.overrideStableID&&_.StableID.setOverride(n.overrideStableID,t),this.u=new a.ErrorBoundary(t,o),this.u.wrap(this),this.u.wrap(i),this.u.wrap(e),this.h=t,this.J=null!=n?n:{},this.Ft=null!=(s=null==n?void 0:n.overrideAdapter)?s:null,this.Lt=new c.EventLogger(t,o,i,n),v.SessionID.Ct(()=>{this.St({name:"session_expired"})},t),null!=u[t]&&(0,h.an)()&&d.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),u[t]=this,r.lastInstance=this,r.instances=u,__STATSIG__=r,this.dataAdapter=e,this.dataAdapter.attach(t,n)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.J.disableLogging=t.disableLogging,this.Lt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.J.disableStorage=t.disableStorage,f.Storage.Rt(t.disableStorage))}flush(){return this.Lt.flush()}shutdown(){return n(this,void 0,void 0,function*(){this.St({name:"pre_shutdown"}),yield this.Lt.shutdown()})}on(t,e){this.Gt[t]||(this.Gt[t]=[]),this.Gt[t].push(e)}off(t,e){this.Gt[t]&&-1!==(e=this.Gt[t].indexOf(e))&&this.Gt[t].splice(e,1)}__on(t,e){e.__isInternal=!0,this.on(t,e)}St(i){var t;const e=e=>{try{e(i)}catch(t){!0===e.__isInternal?this.u.logError("_emit:"+i.name,t):d.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",i)}};this.Gt[i.name]&&this.Gt[i.name].forEach(t=>e(t)),null!=(t=this.Gt["*"])&&t.forEach(e)}Ut(t,e){this.loadingStatus=t,this.St({name:"values_updated",status:t,values:e})}Kt(t,e,i){!0===(null==i?void 0:i.disableExposureLog)?this.Lt.incrementNonExposureCount(t):this.Lt.enqueue(e)}}},808:(t,e)=>{$Q(e)},283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{$Q(e),e.Jt=e.qt=e.Vt=e.ht=void 0;const i="statsig::config_exposure",n="statsig::gate_exposure",l=(t,e,i,n,s)=>({eventName:t,user:e,value:null,metadata:o(i,n),secondaryExposures:s,time:Date.now()});e.ht=({eventName:t})=>t===n||t===i,e.Vt=(t,e)=>{return l(n,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.qt=(t,e)=>{return l(i,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.Jt=(t,e,i)=>{var n,s=e.__evaluation,o=!0===(null==(o=null==s?void 0:s.explicit_parameters)?void 0:o.includes(i));let r="",u=null!=(n=null==s?void 0:s.undelegated_secondary_exposures)?n:[];return o&&(r=null!=(n=s.allocated_experiment_name)?n:"",u=s.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:i,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(o)},u)};const o=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="0.0.1-beta.33";let i={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>i,add:t=>{i=$P($P({},i),t)}}},384:(t,e)=>{$Q(e)},396:(t,e)=>{$Q(e),e.zt=e.Bt=e.$t=e.Ht=void 0;const s="default";function o(t,e,i,n){return{name:t,details:e,ruleID:null!=(t=null==i?void 0:i.rule_id)?t:s,__evaluation:i,value:n}}function r(o,r){return(t,e)=>{var i,n,s=null!=(s=null==o?void 0:o[t])?s:null;return null==s||null!=e&&(i=e,(n=t=>Array.isArray(t)?"array":typeof t)(s)!==n(i))?null!=e?e:null:(null!=r&&r(t),s)}}e.Ht=function(t,e,i){return o(t,e,i,!0===(null==i?void 0:i.value))},e.$t=function(t,e,i){return $P($P({},o(t,e,i,null!=(t=null==i?void 0:i.value)?t:{})),{groupName:null,get:r(null==i?void 0:i.value)})},e.Bt=function(t,e,i,n){return $P($P({},o(t,e,i,void 0)),{get:r(null==i?void 0:i.value,n),groupName:null!=(t=null==i?void 0:i.group_name)?t:null,__value:null!=(e=null==i?void 0:i.value)?e:{}})},e.zt=function(t,e,i,n){return $P($P($P({},t),e),{get:r(i,n)})}},136:(t,e)=>{$Q(e)},296:(t,e,i)=>{$Q(e),e.getUnitIDFromUser=e.getUserStorageKey=e.normalizeUser=void 0;const n=i(832);e.normalizeUser=function(t,e){try{var i=JSON.parse(JSON.stringify(t));return null!=e&&(i.statsigEnvironment=e),i}catch(t){throw new Error("User object must be convertable to JSON string.")}},e.getUserStorageKey=function(t,e){return(0,n.DJB2Object)({sdkKey:t,user:e})},e.getUnitIDFromUser=function(t,e){var i;return"string"==typeof e&&"userid"!==e.toLowerCase()?null!=(i=null==(i=t.customIDs)?void 0:i[e])?i:null==(i=null==t?void 0:t.customIDs)?void 0:i[e.toLowerCase()]:t.userID}},444:function(t,e,i){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})},i=($Q(e),e.G=e.P=e.Storage=void 0,i(780));const s={},o={Wt:()=>"InMemory",D(t){return null!=(t=s[t])?t:null},Yt(t){return Promise.resolve(null!=(t=s[t])?t:null)},k(t,e){return s[t]=e,Promise.resolve()},C(t){return delete s[t],Promise.resolve()},Qt(){return Promise.resolve(Object.keys(s))}};let r=null;try{"undefined"!=typeof window&&"localStorage"in window&&(r={Wt:()=>"LocalStorage",D(t){return localStorage.getItem(t)},Yt(t){return Promise.resolve(localStorage.getItem(t))},k(t,e){return localStorage.setItem(t,e),Promise.resolve()},C(t){return localStorage.removeItem(t),Promise.resolve()},Qt(){var t=Object.keys(localStorage);return Promise.resolve(t)}})}catch(t){i.Log.warn("Failed to setup localStorageProvider.")}let u=null!==r&&void 0!==r?r:o,l=u;e.Storage={Wt:()=>l.Wt(),Yt:t=>l.Yt(t),k:(t,e)=>l.k(t,e),C:t=>l.C(t),Qt:()=>l.Qt(),D:t=>{var e;return null!=(e=null==(e=l.D)?void 0:e.call(l,t))?e:null},Xt:t=>{u=t,l=t},Rt:t=>{l=t?o:u}},e.P=function(e){return n(this,void 0,void 0,function*(){var t=yield l.Yt(e);return JSON.parse(null!=t?t:"null")})},e.G=function(t,e){return n(this,void 0,void 0,function*(){yield l.k(t,JSON.stringify(e))})}},412:(t,e,i)=>{$Q(e),e.typedJsonParse=void 0;const s=i(780);e.typedJsonParse=function(t,e,i){try{var n=JSON.parse(t);return"object"==typeof n&&0 in n,n}catch(t){}return s.Log.error(i),null}},556:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let i=(new Date).getTime(),n="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<i?(e=(i+e)%16|0,i=Math.floor(i/16)):(e=(n+e)%16|0,n=Math.floor(n/16)),("x"===t?e:7&e|8).toString(16)})}},84:(t,e)=>{$Q(e),e.et=void 0,e.et=function(t,e,i,n){return t||(e?""+e+i:""+n+i)}},539:(t,e)=>{$Q(e)},100:(t,e,i)=>{$Q(e),e.Zt=e.it=e._t=void 0;i=i(48);const n="foreground",s="background",o=[];let r=n;e._t=()=>r===n,e.it=t=>{o.unshift(t)};e.Zt=e=>{e!==r&&(r=e,o.forEach(t=>t(e)))},(0,i.Dt)("focus",()=>(0,e.Zt)(n)),(0,i.Dt)("blur",()=>(0,e.Zt)(s)),(0,i.Dt)("beforeunload",()=>(0,e.Zt)(s)),(0,i.xt)("visibilitychange",()=>{(0,e.Zt)("visible"===document.visibilityState?n:s)})},464:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};$Q(e),e.Log=e.Storage=e.EventLogger=void 0,i(496);const o=i(728),r=(Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),i(780));Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return r.Log}});var u=i(972);const l=i(444);Object.defineProperty(e,"Storage",{enumerable:!0,get:function(){return l.Storage}});var a=i(556);s(i(496),e),s(i(856),e),s(i(320),e),s(i(184),e),s(i(512),e),s(i(500),e),s(i(788),e),s(i(832),e),s(i(664),e),s(i(780),e),s(i(452),e),s(i(188),e),s(i(256),e),s(i(264),e),s(i(48),e),s(i(360),e),s(i(612),e),s(i(604),e),s(i(688),e),s(i(808),e),s(i(283),e),s(i(876),e),s(i(972),e),s(i(384),e),s(i(396),e),s(i(136),e),s(i(296),e),s(i(444),e),s(i(412),e),s(i(84),e),s(i(539),e),s(i(556),e),s(i(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:o.EventLogger,Log:r.Log,getUUID:a.getUUID,Storage:l.Storage,SDK_VERSION:u.SDK_VERSION})},696:function(t,e,i){var n=this&&this.__createBinding||(Object.create?function(t,e,i,n){void 0===n&&(n=i);var s=Object.getOwnPropertyDescriptor(e,i);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[i]}}),Object.defineProperty(t,n,s)}:function(t,e,i,n){t[n=void 0===n?i:n]=e[i]}),s=this&&this.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||n(e,t,i)};$Q(e),s(i(208),e),e.default=__STATSIG__},96:(t,e,i)=>{$Q(e),e.resolveDeltasResponse=void 0;const n=i(464);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.resolveDeltasResponse=function(t,e){var i;return(e=(0,n.typedJsonParse)(e,"checksum","Failed to parse DeltasEvaluationResponse"))?(t=t,i=e,t=$P($P($P({},t),i),{feature_gates:$P($P({},t.feature_gates),i.feature_gates),layer_configs:$P($P({},t.layer_configs),i.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),i.dynamic_configs)}),s((t=i=t).deleted_gates,t.feature_gates),delete t.deleted_gates,s(i.deleted_configs,t.dynamic_configs),delete t.deleted_configs,s(i.deleted_layers,t.layer_configs),delete t.deleted_layers,i=t,(t=(0,n.DJB2Object)({feature_gates:i.feature_gates,dynamic_configs:i.dynamic_configs,layer_configs:i.layer_configs}))===e.checksum?JSON.stringify(i):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:i,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},536:(t,e,i)=>{$Q(e);const n=i(464);e.default=class{constructor(){this.te=null,this.ee=null,this.ne="Uninitialized",this.ie=0,this.se=0}getValues(){return this.te?(0,n.typedJsonParse)(this.te,"has_updates","Failed to parse EvaluationStoreValues"):null}reset(){this.ee=null,this.te=null,this.ne="Loading",this.ie=0,this.se=0}finalize(){this.ee||(this.ne="NoValues")}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=(0,n.typedJsonParse)(t.data,"has_updates","Failed to parse EvaluationResponse"))?void 0:e.has_updates)&&(this.te=t.data,this.ie=e.time,this.se=t.receivedAt,this.ne=t.source,this.ee=e)}getGate(t){var e,t=null!=(e=null==(e=this.ee)?void 0:e.feature_gates[t])?e:null;return this.oe(t)}getConfig(t){var e,t=null!=(e=null==(e=this.ee)?void 0:e.dynamic_configs[t])?e:null;return this.oe(t)}getLayer(t){var e,t=null!=(e=null==(e=this.ee)?void 0:e.layer_configs[t])?e:null;return this.oe(t)}oe(t){return{evaluation:t,details:this.re(null==t)}}re(t){return"Uninitialized"===this.ne||"NoValues"===this.ne?{reason:this.ne}:{reason:this.ne+":"+(t?"Unrecognized":"Recognized"),lcut:this.ie,receivedAt:this.se}}}},400:function(t,e,i){var o=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e);const r=i(464),u=i(96);class n extends r.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.le=(0,r.et)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",r.NetworkDefault.initializeApi)}fetchEvaluations(i,n,s){return o(this,void 0,void 0,function*(){var t=n?(0,r.typedJsonParse)(n,"has_updates","Failed to parse cached EvaluationResponse"):null;let e={user:s,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.ue(i,t,e)})}ue(e,i,n){var s;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.le,data:n,retries:2,isStatsigEncodable:!0});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(s=null==t?void 0:t.body)?s:null:!0!==(null==i?void 0:i.has_updates)||!0!==(null==(s=t.body)?void 0:s.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,u.resolveDeltasResponse)(i,t.body))?t:this.ue(e,i,$P($P($P({},n),t),{deltasResponseRequested:!1}))})}}e.default=n},520:function(t,e,i){var s=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})};$Q(e);const r=i(464),o=i(536),u=i(400),l=i(364);class n extends r.StatsigClientBase{static instance(t){var e=(0,r.i)().instance(t);return e instanceof n?e:(r.Log.warn("Unable to find StatsigClient instance"),new n(null!=t?t:"",{}))}constructor(t,e,i=null){r.SDKType.At(t,"javascript-client");var n=new u.default(i,t=>{this.St(t)});super(t,null!=(t=null==i?void 0:i.dataAdapter)?t:new l.StatsigEvaluationsDataAdapter,n,i),this.ae=new o.default,this.ce=e}initializeSync(){this.updateUserSync(this.ce)}initializeAsync(t){return this.updateUserAsync(this.ce,t)}updateUserSync(t){this.de(t);t=this.dataAdapter.getDataSync(this.ce);this.ae.setValuesFromDataAdapter(t),this.ae.finalize(),this.Ut("Ready",t),this.he(null!=t?t:null,this.ce)}updateUserAsync(i,n){return s(this,void 0,void 0,function*(){this.de(i);var t=this.ce,e=this.dataAdapter.getDataSync(t);this.Ut("Loading",e),this.ae.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,t,n),t===this.ce&&this.ae.setValuesFromDataAdapter(e),this.ae.finalize(),this.Ut("Ready",e)})}getContext(){return{sdkKey:this.h,options:this.J,values:this.ae.getValues(),user:JSON.parse(JSON.stringify(this.ce)),errorBoundary:this.u}}getAsyncContext(){return s(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{sessionID:yield r.SessionID.get(this.h),stableID:yield r.StableID.get(this.h)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var i=(0,r.DJB2)(t),{evaluation:i,details:n}=this.ae.getGate(i),n=(0,r.Ht)(t,n,i),s=null==(s=null==(i=this.Ft)?void 0:i.getGateOverride)?void 0:s.call(i,n,this.ce,e),i=null!=s?s:n;return this.Kt(t,(0,r.Vt)(this.ce,i),e),this.St({name:"gate_evaluation",gate:i}),i}getDynamicConfig(t,e){t=this.ve("dynamic_config",t,e);return this.St({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.ve("experiment",t,e);return this.St({name:"experiment_evaluation",experiment:t}),t}getLayer(e,i){var t=(0,r.DJB2)(e),{evaluation:t,details:n}=this.ae.getLayer(t),n=(0,r.Bt)(e,n,t),s=null==(s=null==(t=this.Ft)?void 0:t.getLayerOverride)?void 0:s.call(t,n,this.ce,i);const o=(0,r.zt)(n,s,null!=(t=null==s?void 0:s.__value)?t:n.__value,t=>{this.Kt(e,(0,r.Jt)(this.ce,o,t),i)});return this.St({name:"layer_evaluation",layer:o}),o}logEvent(t,e,i){this.Lt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:i}:t),{user:this.ce,time:Date.now()}))}he(t,e){this.dataAdapter.getDataAsync(t,e).catch(t=>{r.Log.error("An error occurred after update.",t)})}de(t){this.Lt.reset(),this.ae.reset(),this.ce=(0,r.normalizeUser)(t,this.J.environment)}ve(t,e,i){var n=(0,r.DJB2)(e),{evaluation:n,details:s}=this.ae.getConfig(n),s=(0,r.$t)(e,s,n),n="experiment"===t?null==(t=null==(n=this.Ft)?void 0:n.getExperimentOverride)?void 0:t.call(n,s,this.ce,i):null==(n=null==(t=this.Ft)?void 0:t.getDynamicConfigOverride)?void 0:n.call(t,s,this.ce,i),t=null!=n?n:s;return this.Kt(e,(0,r.qt)(this.ce,t),i),t}}e.default=n},364:function(t,e,i){var s=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(i,e){function n(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?i(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(n,s)}o((l=l.apply(t,r||[])).next())})},n=($Q(e),e.StatsigEvaluationsDataAdapter=void 0,i(464));const o=i(400);class r extends n.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.K=null}attach(t,e){super.attach(t,e),this.K=new o.default(null!=e?e:{})}getDataAsync(t,e,i){return this.O(t,e,i)}prefetchData(t,e){return this.T(t,e)}I(e,i){var n;return s(this,void 0,void 0,function*(){var t=yield null==(n=this.K)?void 0:n.fetchEvaluations(this.M(),e,i);return null!=t?t:null})}}e.StatsigEvaluationsDataAdapter=r},208:(t,e,i)=>{$Q(e),e.StatsigClient=e.StatsigEvaluationsDataAdapter=void 0;var n=i(520);e.StatsigClient=n.default;const s=i(364);Object.defineProperty(e,"StatsigEvaluationsDataAdapter",{enumerable:!0,get:function(){return s.StatsigEvaluationsDataAdapter}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigEvaluationsDataAdapter:s.StatsigEvaluationsDataAdapter,StatsigClient:n.default}),e.default=__STATSIG__}},n={};function s(t){var e=n[t];return void 0!==e||(e=n[t]={exports:{}},i[t].call(e.exports,e,e.exports,s)),e.exports}return s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s(696).default})());
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Statsig=e():t.Statsig=e()}(this,()=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $P = (a,b) => Object.assign(a,b);var n={496:(t,e,n)=>{$Q(e),e.t=e.i=void 0,e.i=()=>null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:u;e.t=t=>{var e;return t?null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:e[t]:null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.lastInstance};var i,s="__STATSIG__",o="undefined"!=typeof window?window:{},n=void 0!==n.g?n.g:{},r="undefined"!=typeof globalThis?globalThis:{};const u=null!=(i=null!=(i=null!=(i=o[s])?i:n[s])?i:r[s])?i:{instance:e.t};o[s]=u,n[s]=u,r[s]=u},856:(t,e)=>{$Q(e)},320:function(t,e,n){var o=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.DataAdapterCore=void 0;const i=n(512),r=n(780),s=n(283),u=n(296),l=n(444),a=n(412);e.DataAdapterCore=class{constructor(t,e){this.o=t,this.u=e,this.l=null,this.h=null,this.v={},this._="statsig.last_modified_time."+e}attach(t,e){this.h=t,this.l=new i.ErrorBoundary(t)}getDataSync(t){var t=this.m(t),e=this.v[t];return e||((e=this.p(t))?(this.S(t,e),this.v[t]):null)}setData(t,e){e=this.m(e);this.S(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.v=$P($P({},this.v),t)}O(e,n,i){var s;return o(this,void 0,void 0,function*(){var t=null!=e?e:this.getDataSync(n),t=[this.j(null!=(s=null==t?void 0:t.data)?s:null,n)];return null!=i&&i.timeoutMs&&t.push(new Promise(t=>setTimeout(t,i.timeoutMs)).then(()=>(r.Log.debug("Fetching latest value timed out"),null))),yield Promise.race(t)})}T(n,i){return o(this,void 0,void 0,function*(){var t=this.m(n),e=yield this.O(null,n,i);e&&this.S(t,$P($P({},e),{source:"Prefetch"}))})}j(i,s){return o(this,void 0,void 0,function*(){var t=yield this.I(i,s);if(!t)return r.Log.debug("No response returned for latest value"),null;var e=(0,a.typedJsonParse)(t,"has_updates","Failure while attempting to persist latest value");let n=null;return!0===(null==e?void 0:e.has_updates)?n={source:"Network",data:t,receivedAt:Date.now()}:i&&!1===(null==e?void 0:e.has_updates)&&(n={source:"NetworkNotModified",data:i,receivedAt:Date.now()}),n?(t=this.m(s),this.S(t,n),yield this.A(t,n),n):null})}M(){return null!=this.h?this.h:(r.Log.error(this.o+" is not attached to a Client"),"")}m(t){t=(0,u.getUserStorageKey)(this.M(),t);return`${s.DataAdapterCachePrefix}.${this.u}.`+t}S(t,e){var n=Object.entries(this.v);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.v[n]),this.v[t]=e}p(t){var e=null==(e=l.Storage.D)?void 0:e.call(l.Storage,t);return null!=e&&(t=(0,a.typedJsonParse)(e,"source","Failed to parse cached result"))?$P($P({},t),{source:"Cache"}):null}A(t,e){return o(this,void 0,void 0,function*(){yield l.Storage.P(t,JSON.stringify(e)),yield this.k(t)})}k(n){var i;return o(this,void 0,void 0,function*(){var t=null!=(i=yield(0,l.N)(this._))?i:{},e=(t[n]=Date.now(),Object.entries(t));e.length<=10||(delete t[(e=e.reduce((t,e)=>e[1]<t[1]?e:t))[0]],yield l.Storage.C(e[0])),yield(0,l.G)(this._,t)})}}},280:(t,e)=>{$Q(e),e.Diagnostics=void 0;e.Diagnostics=class{static mark(){}}},184:(t,e)=>{$Q(e)},512:function(t,u,e){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})};Object.defineProperty(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(780),l=e(360),a=e(972);u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";u.ErrorBoundary=class{constructor(t,e){this.h=t,this.F=e,this.R=new Set}wrap(i){try{const t=i;!function(t){const e=new Set;let n=Object.getPrototypeOf(t);for(;n&&n!==Object.prototype;)Object.getOwnPropertyNames(n).filter(t=>"function"==typeof(null===n||void 0===n?void 0:n[t])).forEach(t=>e.add(t)),n=Object.getPrototypeOf(n);return Array.from(e)}(t).forEach(e=>{const n=t[e];"$EB"in n||(t[e]=(...t)=>this.capture(e,()=>n.apply(i,t)),t[e].$EB=!0)})}catch(t){this.U("eb:wrap",t)}}capture(e,t){try{var n=t();return n&&n instanceof Promise?n.catch(t=>this.U(e,t)):n}catch(t){return this.U(e,t),null}}logError(t,e){this.U(t,e)}U(o,r){try{i.Log.warn("Caught error in "+o,{error:r});n(this,void 0,void 0,function*(){var t,e,n=null!=r?r:Error("[Statsig] Error was empty"),i=n instanceof Error,s=i?n.name:"No Name";this.R.has(s)||(this.R.add(s),t=l.SDKType.K(this.h),e=a.StatsigMetadataProvider.get(),i=i?n.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(n),n=JSON.stringify($P({tag:o,exception:s,info:i},$P($P({},e),{sdkType:t}))),yield fetch(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.h,"STATSIG-SDK-TYPE":String(t),"STATSIG-SDK-VERSION":String(e.sdkVersion),"Content-Type":"application/json"},body:n}),null!=(s=this.F)&&s.call(this,{name:"error",error:r}))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},788:(t,e)=>{$Q(e)},728:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.EventLogger=void 0;const s=n(832),o=n(780),r=n(256),u=n(452),l=n(48),a=n(876),c=n(444),d=n(412),h=n(84),v=n(100),_={},f=t=>{null!=(t=_[t])&&t.flush().catch(()=>{})};e.EventLogger=class{constructor(e,t,n,i){this.h=e,this.F=t,this.L=n,this.J=i,this.V=[],this.q={},this.B={},this.$=!1,this.H=Date.now(),(_[e]=this).Y=!0===(null==i?void 0:i.disableLogging),this.W=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;t=null!=(n=null==i?void 0:i.loggingIntervalMs)?n:1e4;const s=setInterval(()=>{_[e]?f(e):clearInterval(s)},t);this.X=s;n=null==i?void 0:i.networkConfig;this.tt=(0,h.et)(null==n?void 0:n.logEventUrl,null==n?void 0:n.api,"/rgstr",r.NetworkDefault.eventsApi),this.nt=(0,h.et)(null==n?void 0:n.logEventBeaconUrl,null==n?void 0:n.api,"/log_event_beacon",r.NetworkDefault.eventsApi),(0,v.it)(t=>{"background"===t&&f(e)}),this.st()}setLoggingDisabled(t){this.Y=t}enqueue(t){this.rt(t)&&(this.ut(t),this.lt(),this.V.length>this.W)&&f(this.h)}incrementNonExposureCount(t){var e=null!=(e=this.B[t])?e:0;this.B[t]=e+1}reset(){this.q={}}shutdown(){return i(this,void 0,void 0,function*(){this.X&&(clearInterval(this.X),this.X=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.ct(),0!==this.V.length&&(t=this.V,this.V=[],yield this.dt(t))})}lt(){this.$||(this.$=!0,200<Date.now()-this.H)||setTimeout(()=>f(this.h),200)}rt(t){if((0,a.ht)(t)){var t=[t.eventName,null==(e=t.user)?void 0:e.userID,null==(e=t.metadata)?void 0:e.gate,null==(e=t.metadata)?void 0:e.config,null==(e=t.metadata)?void 0:e.ruleID].join("|"),e=this.q[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.q).length&&(this.q={}),this.q[t]=n}return!0}dt(t){return i(this,void 0,void 0,function*(){if(this.Y)this.vt(t);else try{(!(0,v._t)()&&this.L.isBeaconSupported()?yield this.ft(t):yield this.gt(t)).success?this.F({name:"logs_flushed",events:t}):this.vt(t)}catch(t){o.Log.warn("Failed to flush events.")}})}gt(e){return i(this,void 0,void 0,function*(){var t=yield this.L.post({sdkKey:this.h,data:{events:e},url:this.tt,retries:3,params:{[u.NetworkParam.EventCount]:String(e.length)}}),t=null!=t&&t.body?(0,d.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}ft(t){return i(this,void 0,void 0,function*(){return{success:yield this.L.beacon({sdkKey:this.h,data:{events:t},url:this.nt})}})}vt(t){for(;500<t.length;)t.shift();var e=this.bt();(0,c.G)(e,t).catch(()=>{o.Log.warn("Unable to save failed logs to storage")})}st(){const e=this.bt();i(this,void 0,void 0,function*(){var t=yield(0,c.N)(e);t&&(yield c.Storage.C(e),yield this.dt(t))}).catch(()=>{o.Log.warn("Failed to flush stored logs")})}bt(){return"statsig.failed_logs."+(0,s.DJB2)(this.h)}ut(t){t.user&&(t.user=$P({},t.user),delete t.user.privateAttributes);var e={},n=this.yt();n&&(e.statsigMetadata={currentPage:n}),this.V.push($P($P({},t),e))}ct(){0!==Object.keys(this.B).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.B)}}),this.B={})}yt(){var t;if(!1!==(null==(t=this.J)?void 0:t.includeCurrentPageUrlWithEvents))return(0,l.St)()}}},832:(t,e)=>{$Q(e),e.DJB2Object=e.DJB2=void 0;e.DJB2=e=>{let n=0;for(let t=0;t<e.length;t++){var i=e.charCodeAt(t);n=(n<<5)-n+i,n&=n}return String(n>>>0)};e.DJB2Object=t=>(0,e.DJB2)(JSON.stringify(s(t)));const s=n=>{if(null==n)return null;var t=Object.keys(n).sort();const i={};return t.forEach(t=>{let e=n[t];e instanceof Object&&(e=s(e)),i[t]=e}),i}},664:(t,e)=>{$Q(e)},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,s;$Q(e),e.Log=e.LogLevel=void 0,(s=i||(e.LogLevel=i={}))[s.None=0]="None",s[s.Error=1]="Error",s[s.Warn=2]="Warn",s[s.Info=3]="Info",s[s.Debug=4]="Debug";class o{static info(...t){this.level>=i.Info&&console.info(...n(t))}static debug(...t){this.level>=i.Debug&&console.debug(...n(t))}static warn(...t){this.level>=i.Warn&&console.warn(...n(t))}static error(...t){this.level>=i.Error&&console.error(...n(t))}}(e.Log=o).level=i.Error},188:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.NetworkCore=void 0,n(496);const h=n(280),v=n(780),s=n(452),o=n(360),r=n(612),u=n(604),l=n(972);e.NetworkCore=class{constructor(t,e){this.J=t,this.F=e,this.Ot=null!=(t=null==(e=null==t?void 0:t.networkConfig)?void 0:e.networkTimeoutMs)?t:1e4}post(e){return i(this,void 0,void 0,function*(){var t=yield this.jt(e);return this.Tt($P({method:"POST",body:this.wt(e,t)},e))})}get(t){return this.Tt($P({method:"GET"},t))}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(n){return i(this,void 0,void 0,function*(){var t,e;return!!_(n)&&(t=yield this.It(n),e=yield this.jt(n),navigator.sendBeacon(t,e))})}Tt(c){var d;return i(this,void 0,void 0,function*(){if(!_(c))return null;var{method:e,body:n,retries:i}=c;const s=new AbortController;var t=setTimeout(()=>s.abort(`Timeout of ${this.Ot}ms expired.`),this.Ot),o=yield this.It(c),r=null;try{var u,l,a,r=yield fetch(o,{method:e,body:n,headers:$P({},c.headers),signal:s.signal});if(clearTimeout(t),r.ok)return a=yield r.text(),h.Diagnostics.mark(),{body:a,code:r.status};throw u=yield r.text().catch(()=>"No Text"),(l=new Error(`Failed to fetch: ${o} `+u)).name="NetworkError",l}catch(t){n=function(t,e){if(t.signal.aborted&&"string"==typeof t.signal.reason)return t.signal.reason;if("string"==typeof e)return e;if(e instanceof Error)return e.name+": "+e.message;return null}(s,t);return h.Diagnostics.mark(),!i||i<=0?(null!=(d=this.F)&&d.call(this,{name:"error",error:t}),v.Log.error(`A networking error occured during ${e} request to ${o}.`,n,t),null):this.Tt($P($P({},c),{retries:i-1}))}})}It(e){return i(this,void 0,void 0,function*(){var t=$P({[s.NetworkParam.SdkKey]:e.sdkKey,[s.NetworkParam.SdkType]:o.SDKType.K(e.sdkKey),[s.NetworkParam.SdkVersion]:l.SDK_VERSION,[s.NetworkParam.Time]:String(Date.now()),[s.NetworkParam.SessionID]:yield r.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}jt(s){return i(this,void 0,void 0,function*(){var{data:t,sdkKey:e}=s,n=yield u.StableID.get(e),i=yield r.SessionID.get(e),e=o.SDKType.K(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},l.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}wt(t,e){var n;return!(null!=(null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__["no-encode"])||null!=(n=this.J)&&n.disableStatsigEncoding)&&t.isStatsigEncodable&&"undefined"!=typeof window&&window.btoa&&(t.params=$P($P({},null!=(n=t.params)?n:{}),{[s.NetworkParam.StatsigEncoded]:"1"}),null!=(t=window.btoa(e).split("").reverse().join("")))?t:e}};const _=t=>!!t.sdkKey||(v.Log.warn("Unable to make request without an SDK key"),!1)},256:(t,e)=>{$Q(e),e.NetworkDefault=void 0,e.NetworkDefault={eventsApi:"https://events.statsigapi.net/v1",initializeApi:"https://featuregates.org/v1",specsApi:"https://api.statsigcdn.com/v1"}},452:(t,e)=>{$Q(e),e.NetworkParam=void 0,e.NetworkParam={EventCount:"ec",SdkKey:"k",SdkType:"st",SdkVersion:"sv",Time:"t",SessionID:"sid",StatsigEncoded:"se"}},264:(t,e)=>{$Q(e)},360:(t,e)=>{$Q(e),e.SDKType=void 0;const n={};let i;e.SDKType={K:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},At(t,e){n[t]=e},xt(t){i&&"-react"!==i||(i="-"+t)}}},48:(t,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.St=i.Mt=i.Dt=i.Et=i.Pt=i.kt=void 0;i.kt=()=>"undefined"!=typeof window?window:null,i.Pt=()=>{var t=(0,i.kt)();return null!=(t=null==t?void 0:t.document)?t:null},i.Et=()=>null!=(0,i.Pt)(),i.Dt=(t,e)=>{var n=(0,i.kt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)},i.Mt=(t,e)=>{var n=(0,i.Pt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.St=()=>{var t;try{return null==(t=(0,i.kt)())?void 0:t.location.href.split(/[?#]/)[0]}catch(t){}}},612:function(t,r,e){var n=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})};Object.defineProperty(r,"__esModule",{value:!0}),r.SessionID=void 0;const i=e(832),u=e(780),l=e(444),a=e(556),c={},d={},h={};function v(t){return"statsig.session_id."+(0,i.DJB2)(t)}r.SessionID={get:t=>null!=h[t]?h[t]:h[t]=r.SessionID.Nt(t),Nt:o=>n(void 0,void 0,void 0,function*(){let e=c[o];var n=Date.now();if(null==e){let t=yield function(t){t=v(t);return(0,l.N)(t)}(o);null==t&&(t={sessionID:(0,a.getUUID)(),startTime:n,lastUpdate:n}),e=t,c[o]=e}var t=null!=(t=d[o])?t:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:()=>{}},i=((144e5<n-e.startTime||18e5<n-e.lastUpdate)&&(e.sessionID=(0,a.getUUID)(),e.startTime=n),e.lastUpdate=n,e),s=o;return s=v(o),(0,l.G)(s,i).catch(()=>{u.Log.warn("Failed to save SessionID")}),t.idleTimeoutID=r.SessionID.Ct(t,t.idleTimeoutID,18e5),t.ageTimeoutID=r.SessionID.Ct(t,t.ageTimeoutID,144e5-(n-e.startTime)),c[o]=e,d[o]=t,h[o]=null,e.sessionID}),Gt:(t,e)=>{var n=null!=(n=d[e])?n:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:t};n.emitFunction=t,d[e]=n},Ct:(t,e,n)=>(clearTimeout(null!=e?e:void 0),setTimeout(t.emitFunction,n))}},604:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.StableID=void 0;const s=n(832),o=n(780),r=n(444),u=n(556),l={};function a(t){return"statsig.stable_id."+(0,s.DJB2)(t)}function c(t,e){e=a(e);(0,r.G)(e,t).catch(()=>{o.Log.warn("Failed to save StableID")})}e.StableID={get:e=>i(void 0,void 0,void 0,function*(){return null==l[e]&&(l[e]=function(t){t=a(t);return(0,r.N)(t)}(e).then(t=>{return null!=t||c(t=(0,u.getUUID)(),e),t})),l[e]}),setOverride:(t,e)=>{l[e]=Promise.resolve(t),c(t,e)}}},688:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})};$Q(e),e.StatsigClientBase=void 0,n(496);const l=n(496),a=n(512),c=n(728),d=n(780),h=n(48),v=n(612),_=n(604),f=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Ft={};var s,o=this.Rt.bind(this),r=(0,l.i)(),u=null!=(u=r.instances)?u:{};null!=i&&i.logLevel&&(d.Log.level=null==i?void 0:i.logLevel),null!=i&&i.disableStorage&&f.Storage.Ut(!0),null!=i&&i.overrideStableID&&_.StableID.setOverride(i.overrideStableID,t),this.l=new a.ErrorBoundary(t,o),this.l.wrap(this),this.l.wrap(n),this.l.wrap(e),this.h=t,this.J=null!=i?i:{},this.Kt=null!=(s=null==i?void 0:i.overrideAdapter)?s:null,this.Lt=new c.EventLogger(t,o,n,i),v.SessionID.Gt(()=>{this.Rt({name:"session_expired"})},t),null!=u[t]&&(0,h.Et)()&&d.Log.warn("Creating multiple Statsig clients with the same SDK key can lead to unexpected behavior. Multi-instance support requires different SDK keys."),u[t]=this,r.lastInstance=this,r.instances=u,__STATSIG__=r,this.dataAdapter=e,this.dataAdapter.attach(t,i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.J.disableLogging=t.disableLogging,this.Lt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.J.disableStorage=t.disableStorage,f.Storage.Ut(t.disableStorage))}flush(){return this.Lt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.Rt({name:"pre_shutdown"}),yield this.Lt.shutdown()})}on(t,e){this.Ft[t]||(this.Ft[t]=[]),this.Ft[t].push(e)}off(t,e){this.Ft[t]&&-1!==(e=this.Ft[t].indexOf(e))&&this.Ft[t].splice(e,1)}__on(t,e){e.__isInternal=!0,this.on(t,e)}Rt(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.l.logError("_emit:"+n.name,t):d.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Ft[n.name]&&this.Ft[n.name].forEach(t=>e(t)),null!=(t=this.Ft["*"])&&t.forEach(e)}Jt(t,e){this.loadingStatus=t,this.Rt({name:"values_updated",status:t,values:e})}Vt(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Lt.incrementNonExposureCount(t):this.Lt.enqueue(e)}}},808:(t,e)=>{$Q(e)},283:(t,e)=>{$Q(e),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{$Q(e),e.qt=e.zt=e.Bt=e.ht=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure",l=(t,e,n,i,s)=>({eventName:t,user:e,value:null,metadata:o(n,i),secondaryExposures:s,time:Date.now()});e.ht=({eventName:t})=>t===i||t===n,e.Bt=(t,e)=>{return l(i,t,e.details,{gate:e.name,gateValue:String(e.value),ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])},e.zt=(t,e)=>{return l(n,t,e.details,{config:e.name,ruleID:e.ruleID},null!=(e=null==(t=e.__evaluation)?void 0:t.secondary_exposures)?e:[])};e.qt=(t,e,n)=>{var i,s=e.__evaluation,o=!0===(null==(o=null==s?void 0:s.explicit_parameters)?void 0:o.includes(n));let r="",u=null!=(i=null==s?void 0:s.undelegated_secondary_exposures)?i:[];return o&&(r=null!=(i=s.allocated_experiment_name)?i:"",u=s.secondary_exposures),l("statsig::layer_exposure",t,e.details,{config:e.name,parameterName:n,ruleID:e.ruleID,allocatedExperiment:r,isExplicitParameter:String(o)},u)};const o=(t,e)=>(e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut)),t.receivedAt&&(e.receivedAt=String(t.receivedAt)),e)},972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="0.0.1-beta.35";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},384:(t,e)=>{$Q(e)},396:(t,e)=>{$Q(e),e.$t=e.Ht=e.Yt=e.Wt=void 0;const s="default";function o(t,e,n,i){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:s,__evaluation:n,value:i}}function r(o,r){return(t,e)=>{var n,i,s=null!=(s=null==o?void 0:o[t])?s:null;return null==s||null!=e&&(n=e,(i=t=>Array.isArray(t)?"array":typeof t)(s)!==i(n))?null!=e?e:null:(null!=r&&r(t),s)}}e.Wt=function(t,e,n){return o(t,e,n,!0===(null==n?void 0:n.value))},e.Yt=function(t,e,n){return $P($P({},o(t,e,n,null!=(t=null==n?void 0:n.value)?t:{})),{groupName:null,get:r(null==n?void 0:n.value)})},e.Ht=function(t,e,n,i){return $P($P({},o(t,e,n,void 0)),{get:r(null==n?void 0:n.value,i),groupName:null!=(t=null==n?void 0:n.group_name)?t:null,__value:null!=(e=null==n?void 0:n.value)?e:{}})},e.$t=function(t,e,n,i){return $P($P($P({},t),e),{get:r(n,i)})}},136:(t,e)=>{$Q(e)},296:(t,e,n)=>{$Q(e),e.getUnitIDFromUser=e.getUserStorageKey=e.normalizeUser=void 0;const i=n(832);e.normalizeUser=function(t,e){try{var n=JSON.parse(JSON.stringify(t));return null!=e&&(n.statsigEnvironment=e),n}catch(t){throw new Error("User object must be convertable to JSON string.")}},e.getUserStorageKey=function(t,e){return(0,i.DJB2Object)({sdkKey:t,user:e})},e.getUnitIDFromUser=function(t,e){var n;return"string"==typeof e&&"userid"!==e.toLowerCase()?null!=(n=null==(n=t.customIDs)?void 0:n[e])?n:null==(n=null==t?void 0:t.customIDs)?void 0:n[e.toLowerCase()]:t.userID}},444:function(t,e,n){var i=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})},n=($Q(e),e.G=e.N=e.Storage=void 0,n(780));const s={},o={Qt:()=>"InMemory",D(t){return null!=(t=s[t])?t:null},Xt(t){return Promise.resolve(null!=(t=s[t])?t:null)},P(t,e){return s[t]=e,Promise.resolve()},C(t){return delete s[t],Promise.resolve()},Zt(){return Promise.resolve(Object.keys(s))}};let r=null;try{"undefined"!=typeof window&&"localStorage"in window&&(r={Qt:()=>"LocalStorage",D(t){return localStorage.getItem(t)},Xt(t){return Promise.resolve(localStorage.getItem(t))},P(t,e){return localStorage.setItem(t,e),Promise.resolve()},C(t){return localStorage.removeItem(t),Promise.resolve()},Zt(){var t=Object.keys(localStorage);return Promise.resolve(t)}})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let u=null!==r&&void 0!==r?r:o,l=u;e.Storage={Qt:()=>l.Qt(),Xt:t=>l.Xt(t),P:(t,e)=>l.P(t,e),C:t=>l.C(t),Zt:()=>l.Zt(),D:t=>{var e;return null!=(e=null==(e=l.D)?void 0:e.call(l,t))?e:null},te:t=>{u=t,l=t},Ut:t=>{l=t?o:u}},e.N=function(e){return i(this,void 0,void 0,function*(){var t=yield l.Xt(e);return JSON.parse(null!=t?t:"null")})},e.G=function(t,e){return i(this,void 0,void 0,function*(){yield l.P(t,JSON.stringify(e))})}},412:(t,e,n)=>{$Q(e),e.typedJsonParse=void 0;const s=n(780);e.typedJsonParse=function(t,e,n){try{var i=JSON.parse(t);return"object"==typeof i&&0 in i,i}catch(t){}return s.Log.error(n),null}},556:(t,e)=>{$Q(e),e.getUUID=void 0,e.getUUID=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID)return crypto.randomUUID();let n=(new Date).getTime(),i="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return`xxxxxxxx-xxxx-4xxx-${"89ab"[Math.floor(4*Math.random())]}xxx-xxxxxxxxxxxx`.replace(/[xy]/g,t=>{let e=16*Math.random();return 0<n?(e=(n+e)%16|0,n=Math.floor(n/16)):(e=(i+e)%16|0,i=Math.floor(i/16)),("x"===t?e:7&e|8).toString(16)})}},84:(t,e)=>{$Q(e),e.et=void 0,e.et=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{$Q(e)},100:(t,e,n)=>{$Q(e),e.ee=e.it=e._t=void 0;n=n(48);const i="foreground",s="background",o=[];let r=i;e._t=()=>r===i,e.it=t=>{o.unshift(t)};e.ee=e=>{e!==r&&(r=e,o.forEach(t=>t(e)))},(0,n.Dt)("focus",()=>(0,e.ee)(i)),(0,n.Dt)("blur",()=>(0,e.ee)(s)),(0,n.Dt)("beforeunload",()=>(0,e.ee)(s)),(0,n.Mt)("visibilitychange",()=>{(0,e.ee)("visible"===document.visibilityState?i:s)})},464:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),s=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),e.Log=e.Storage=e.EventLogger=void 0,n(496);const o=n(728),r=(Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),n(780));Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return r.Log}});var u=n(972);const l=n(444);Object.defineProperty(e,"Storage",{enumerable:!0,get:function(){return l.Storage}});var a=n(556);s(n(496),e),s(n(856),e),s(n(320),e),s(n(184),e),s(n(512),e),s(n(500),e),s(n(788),e),s(n(832),e),s(n(664),e),s(n(780),e),s(n(452),e),s(n(188),e),s(n(256),e),s(n(264),e),s(n(48),e),s(n(360),e),s(n(612),e),s(n(604),e),s(n(688),e),s(n(808),e),s(n(283),e),s(n(876),e),s(n(972),e),s(n(384),e),s(n(396),e),s(n(136),e),s(n(296),e),s(n(444),e),s(n(412),e),s(n(84),e),s(n(539),e),s(n(556),e),s(n(100),e),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:o.EventLogger,Log:r.Log,getUUID:a.getUUID,Storage:l.Storage,SDK_VERSION:u.SDK_VERSION})},696:function(t,e,n){var i=this&&this.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n);var s=Object.getOwnPropertyDescriptor(e,n);s&&("get"in s?e.__esModule:!s.writable&&!s.configurable)||(s={enumerable:!0,get:function(){return e[n]}}),Object.defineProperty(t,i,s)}:function(t,e,n,i){t[i=void 0===i?n:i]=e[n]}),s=this&&this.__exportStar||function(t,e){for(var n in t)"default"===n||Object.prototype.hasOwnProperty.call(e,n)||i(e,t,n)};$Q(e),s(n(208),e),e.default=__STATSIG__},96:(t,e,n)=>{$Q(e),e.resolveDeltasResponse=void 0;const i=n(464);function s(t,e){null!=t&&t.forEach(t=>{delete e[t]})}e.resolveDeltasResponse=function(t,e){var n;return(e=(0,i.typedJsonParse)(e,"checksum","Failed to parse DeltasEvaluationResponse"))?(t=t,n=e,t=$P($P($P({},t),n),{feature_gates:$P($P({},t.feature_gates),n.feature_gates),layer_configs:$P($P({},t.layer_configs),n.layer_configs),dynamic_configs:$P($P({},t.dynamic_configs),n.dynamic_configs)}),s((t=n=t).deleted_gates,t.feature_gates),delete t.deleted_gates,s(n.deleted_configs,t.dynamic_configs),delete t.deleted_configs,s(n.deleted_layers,t.layer_configs),delete t.deleted_layers,n=t,(t=(0,i.DJB2Object)({feature_gates:n.feature_gates,dynamic_configs:n.dynamic_configs,layer_configs:n.layer_configs}))===e.checksum?JSON.stringify(n):{hadBadDeltaChecksum:!0,badChecksum:t,badMergedConfigs:n,badFullResponse:e.deltas_full_response}):{hadBadDeltaChecksum:!0}}},536:(t,e,n)=>{$Q(e);const i=n(464);e.default=class{constructor(){this.ne=null,this.ie=null,this.oe="Uninitialized",this.se=0,this.re=0}getValues(){return this.ne?(0,i.typedJsonParse)(this.ne,"has_updates","Failed to parse EvaluationStoreValues"):null}reset(){this.ie=null,this.ne=null,this.oe="Loading",this.se=0,this.re=0}finalize(){this.ie||(this.oe="NoValues")}setValuesFromDataAdapter(t){var e;t&&!0===(null==(e=(0,i.typedJsonParse)(t.data,"has_updates","Failed to parse EvaluationResponse"))?void 0:e.has_updates)&&(this.ne=t.data,this.se=e.time,this.re=t.receivedAt,this.oe=t.source,this.ie=e)}getGate(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.feature_gates[t])?e:null;return this.ue(t)}getConfig(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.dynamic_configs[t])?e:null;return this.ue(t)}getLayer(t){var e,t=null!=(e=null==(e=this.ie)?void 0:e.layer_configs[t])?e:null;return this.ue(t)}ue(t){return{evaluation:t,details:this.le(null==t)}}le(t){return"Uninitialized"===this.oe||"NoValues"===this.oe?{reason:this.oe}:{reason:this.oe+":"+(t?"Unrecognized":"Recognized"),lcut:this.se,receivedAt:this.re}}}},400:function(t,e,n){var o=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})};$Q(e);const r=n(464),u=n(96);class i extends r.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.ae=(0,r.et)(null==e?void 0:e.initializeUrl,null==e?void 0:e.api,"/initialize",r.NetworkDefault.initializeApi)}fetchEvaluations(n,i,s){return o(this,void 0,void 0,function*(){var t=i?(0,r.typedJsonParse)(i,"has_updates","Failed to parse cached EvaluationResponse"):null;let e={user:s,hash:"djb2",deltasResponseRequested:!1};return null!=t&&t.has_updates&&(e=$P($P({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.ce(n,t,e)})}ce(e,n,i){var s;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.ae,data:i,retries:2,isStatsigEncodable:!0});return 204===(null==t?void 0:t.code)?'{"has_updates": false}':200!==(null==t?void 0:t.code)?null!=(s=null==t?void 0:t.body)?s:null:!0!==(null==n?void 0:n.has_updates)||!0!==(null==(s=t.body)?void 0:s.includes('"is_delta":true'))?t.body:"string"==typeof(t=(0,u.resolveDeltasResponse)(n,t.body))?t:this.ce(e,n,$P($P($P({},i),t),{deltasResponseRequested:!1}))})}}e.default=i},520:function(t,e,n){var s=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})};$Q(e);const r=n(464),o=n(536),u=n(400),l=n(364);class i extends r.StatsigClientBase{static instance(t){var e=(0,r.i)().instance(t);return e instanceof i?e:(r.Log.warn("Unable to find StatsigClient instance"),new i(null!=t?t:"",{}))}constructor(t,e,n=null){r.SDKType.At(t,"javascript-client");var i=new u.default(n,t=>{this.Rt(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new l.StatsigEvaluationsDataAdapter,i,n),this.de=new o.default,this.he=e}initializeSync(){this.updateUserSync(this.he)}initializeAsync(t){return this.updateUserAsync(this.he,t)}updateUserSync(t){this.ve(t);t=this.dataAdapter.getDataSync(this.he);this.de.setValuesFromDataAdapter(t),this.de.finalize(),this.Jt("Ready",t),this._e(null!=t?t:null,this.he)}updateUserAsync(n,i){return s(this,void 0,void 0,function*(){this.ve(n);var t=this.he,e=this.dataAdapter.getDataSync(t);this.Jt("Loading",e),this.de.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,t,i),t===this.he&&this.de.setValuesFromDataAdapter(e),this.de.finalize(),this.Jt("Ready",e)})}getContext(){return{sdkKey:this.h,options:this.J,values:this.de.getValues(),user:JSON.parse(JSON.stringify(this.he)),errorBoundary:this.l}}getAsyncContext(){return s(this,void 0,void 0,function*(){return $P($P({},this.getContext()),{sessionID:yield r.SessionID.get(this.h),stableID:yield r.StableID.get(this.h)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var n=(0,r.DJB2)(t),{evaluation:n,details:i}=this.de.getGate(n),i=(0,r.Wt)(t,i,n),s=null==(s=null==(n=this.Kt)?void 0:n.getGateOverride)?void 0:s.call(n,i,this.he,e),n=null!=s?s:i;return this.Vt(t,(0,r.Bt)(this.he,n),e),this.Rt({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.fe("dynamic_config",t,e);return this.Rt({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.fe("experiment",t,e);return this.Rt({name:"experiment_evaluation",experiment:t}),t}getLayer(e,n){var t=(0,r.DJB2)(e),{evaluation:t,details:i}=this.de.getLayer(t),i=(0,r.Ht)(e,i,t),s=null==(s=null==(t=this.Kt)?void 0:t.getLayerOverride)?void 0:s.call(t,i,this.he,n);const o=(0,r.$t)(i,s,null!=(t=null==s?void 0:s.__value)?t:i.__value,t=>{this.Vt(e,(0,r.qt)(this.he,o,t),n)});return this.Rt({name:"layer_evaluation",layer:o}),o}logEvent(t,e,n){this.Lt.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.he,time:Date.now()}))}_e(t,e){this.dataAdapter.getDataAsync(t,e).catch(t=>{r.Log.error("An error occurred after update.",t)})}ve(t){this.Lt.reset(),this.de.reset(),this.he=(0,r.normalizeUser)(t,this.J.environment)}fe(t,e,n){var i=(0,r.DJB2)(e),{evaluation:i,details:s}=this.de.getConfig(i),s=(0,r.Yt)(e,s,i),i="experiment"===t?null==(t=null==(i=this.Kt)?void 0:i.getExperimentOverride)?void 0:t.call(i,s,this.he,n):null==(i=null==(t=this.Kt)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,s,this.he,n),t=null!=i?i:s;return this.Vt(e,(0,r.zt)(this.he,t),n),t}}e.default=i},364:function(t,e,n){var s=this&&this.__awaiter||function(t,r,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{o(l.next(t))}catch(t){e(t)}}function s(t){try{o(l.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,s)}o((l=l.apply(t,r||[])).next())})},i=($Q(e),e.StatsigEvaluationsDataAdapter=void 0,n(464));const o=n(400);class r extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.L=null}attach(t,e){super.attach(t,e),this.L=new o.default(null!=e?e:{})}getDataAsync(t,e,n){return this.O(t,e,n)}prefetchData(t,e){return this.T(t,e)}I(e,n){var i;return s(this,void 0,void 0,function*(){var t=yield null==(i=this.L)?void 0:i.fetchEvaluations(this.M(),e,n);return null!=t?t:null})}}e.StatsigEvaluationsDataAdapter=r},208:(t,e,n)=>{$Q(e),e.StatsigClient=e.StatsigEvaluationsDataAdapter=void 0;var i=n(520);e.StatsigClient=i.default;const s=n(364);Object.defineProperty(e,"StatsigEvaluationsDataAdapter",{enumerable:!0,get:function(){return s.StatsigEvaluationsDataAdapter}}),__STATSIG__=$P($P({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigEvaluationsDataAdapter:s.StatsigEvaluationsDataAdapter,StatsigClient:i.default}),e.default=__STATSIG__}},i={};function s(t){var e=i[t];return void 0!==e||(e=i[t]={exports:{}},n[t].call(e.exports,e,e.exports,s)),e.exports}return s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s(696).default})());
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@statsig/js-client",
3
- "version": "0.0.1-beta.33",
3
+ "version": "0.0.1-beta.35",
4
4
  "dependencies": {
5
- "@statsig/client-core": "0.0.1-beta.33"
5
+ "@statsig/client-core": "0.0.1-beta.35"
6
6
  },
7
7
  "jsdelivr": "./build/statsig-js-client.min.js",
8
8
  "type": "commonjs",