@statsig/js-client 0.0.1-beta.28 → 0.0.1-beta.30

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,c=>(()=>{"use strict";var n={352:t=>{t.exports=c},496:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});var e="undefined"!=typeof window?window:{},n=void 0!==n.g?n.g:{},i="undefined"!=typeof globalThis?globalThis:{},o=null!=(o=null!=(o=null!=(o=e.__STATSIG__)?o:n.__STATSIG__)?o:i.__STATSIG__)?o:{};e.__STATSIG__=o,n.__STATSIG__=o,i.__STATSIG__=o},856:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},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())})};Object.defineProperty(e,"__esModule",{value:!0}),e.DataAdapterCore=void 0;const i=n(512),o=n(780),r=n(104),u=n(283),l=n(296),a=n(444),c=n(412);e.DataAdapterCore=class{constructor(t,e){this.i=t,this.o=e,this.u=null,this.l=null,this.h={},this.v="statsig.last_modified_time."+e}attach(t,e){this.l=t,this.u=new i.ErrorBoundary(t),(0,r.monitorClass)(this.u,this)}getDataSync(t){var t=this._(t),e=this.h[t];return e||((e=this.m(t))?(this.p(t,e),this.h[t]):null)}getDataAsync(n,i){var o;return s(this,void 0,void 0,function*(){var t=null!=n?n:this.getDataSync(i),t=yield this.S(null!=(o=null==t?void 0:t.data)?o:null,i),e=this._(i);return t&&this.p(e,t),"Network"!==(null==t?void 0:t.source)&&"NetworkNotModified"!==(null==t?void 0:t.source)||(yield this.O(e,t)),t})}prefetchData(n){return s(this,void 0,void 0,function*(){var t=this._(n),e=yield this.getDataAsync(null,n);e&&this.p(t,Object.assign(Object.assign({},e),{source:"Prefetch"}))})}setData(t,e){e=this._(e);this.p(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.h=Object.assign(Object.assign({},this.h),t)}S(n,i){return s(this,void 0,void 0,function*(){var t,e=yield this.j(n,i);return e?(t=(0,c.typedJsonParse)(e,"has_updates","Failure while attempting to persist latest value"),n&&!1===(null==t?void 0:t.has_updates)?{source:"NetworkNotModified",data:n,receivedAt:Date.now()}:!0!==(null==t?void 0:t.has_updates)?null:{source:"Network",data:e,receivedAt:Date.now()}):(o.Log.debug("No response returned for latest value"),null)})}T(){return null!=this.l?this.l:(o.Log.error(this.i+" is not attached to a Client"),"")}_(t){t=(0,l.getUserStorageKey)(this.T(),t);return`${u.DataAdapterCachePrefix}.${this.o}.`+t}p(t,e){var n=Object.entries(this.h);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.h[n]),this.h[t]=e}m(t){var e=null==(e=a.Storage.getItemSync)?void 0:e.call(a.Storage,t);return null!=e&&(t=(0,c.typedJsonParse)(e,"source","Failed to parse cached result"))?Object.assign(Object.assign({},t),{source:"Cache"}):null}O(t,e){return s(this,void 0,void 0,function*(){yield a.Storage.setItem(t,JSON.stringify(e)),yield this.I(t)})}I(n){var i;return s(this,void 0,void 0,function*(){var t=null!=(i=yield(0,a.getObjectFromStorage)(this.v))?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 a.Storage.removeItem(e[0])),yield(0,a.setObjectInStorage)(this.v,t)})}}},280:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Diagnostics=e.captureDiagnostics=void 0;const i=n(780),o="undefined"!=typeof performance&&void 0!==performance.mark;let s=[];e.captureDiagnostics=function(t,e){r.mark(t+":start"),e=e();const n=()=>{r.mark(t+":end"),(t+":end").startsWith("initialize:")&&r.flush()};return e&&e instanceof Promise?e.finally(()=>n()):(n(),e)};class r{static mark(t,e){o&&(t=performance.mark(t,{detail:e}),s.push(t))}static flush(){var t=performance.getEntriesByType("resource").filter(t=>t.name.startsWith("https://api.statsig.com")),t={markers:s,resources:t};i.Log.debug("Diagnostics",t,JSON.stringify(t)),s=[]}}e.Diagnostics=r},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(972);u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";u.ErrorBoundary=class{constructor(t){this.l=t,this.A=new Set}capture(e,t,n){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.D(e,t,n)):i}catch(t){return this.D(e,t,n),null}}logError(t,e){this.D(t,e)}D(o,s,r){try{i.Log.warn("Caught error in "+o,{error:s});n(this,void 0,void 0,function*(){var t,e=null!=s?s:Error("[Statsig] Error was empty"),n=e instanceof Error,i=n?e.name:"No Name";this.A.has(i)||(this.A.add(i),t=l.StatsigMetadataProvider.get(),n=n?e.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(e),e=JSON.stringify(Object.assign({tag:o,exception:i,info:n},t)),yield fetch(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.l,"STATSIG-SDK-TYPE":String(t.sdkType),"STATSIG-SDK-VERSION":String(t.sdkVersion),"Content-Type":"application/json"},body:e}),null!=r&&r({name:"error",error:s}))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},788:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},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())})};Object.defineProperty(e,"__esModule",{value:!0}),e.EventLogger=void 0;const o=n(832),s=n(780),r=n(876),u=n(444),l=n(412),a=n(84),c=n(408),d="https://api.statsig.com/v1";e.EventLogger=class{constructor(t,e,n,i){this.l=t,this.M=e,this.N=n,this.P=i,this.G=[],this.C={},this.F={},this.R=!1,this.L=Date.now(),this.U=!0===(null==i?void 0:i.disableLogging),this.J=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;n=null!=(e=null==i?void 0:i.loggingIntervalMs)?e:1e4;this.K=setInterval(()=>this.V(),n),this.q=(0,a.$)(null==i?void 0:i.logEventUrl,null==i?void 0:i.api,"/rgstr",d),this.B=(0,a.$)(null==i?void 0:i.logEventBeaconUrl,null==i?void 0:i.api,"/log_event_beacon",d),c.VisibilityChangeObserver.add(this),this.H()}setLoggingDisabled(t){this.U=t}enqueue(t){this.W(t)&&(this.Y(t),this.X(),this.G.length>this.J)&&this.V()}incrementNonExposureCount(t){var e=null!=(e=this.F[t])?e:0;this.F[t]=e+1}reset(){this.C={}}onVisibilityChanged(t){"background"===t&&this.V()}shutdown(){return i(this,void 0,void 0,function*(){this.K&&(clearInterval(this.K),this.K=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.Z(),0!==this.G.length&&(t=this.G,this.G=[],yield this.tt(t))})}X(){this.R||(this.R=!0,200<Date.now()-this.L)||setTimeout(()=>this.V(),200)}W(t){if((0,r.isExposureEvent)(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.C[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.C).length&&(this.C={}),this.C[t]=n}return!0}V(){this.flush().catch(()=>{})}tt(t){return i(this,void 0,void 0,function*(){if(this.U)this.et(t);else try{(!c.VisibilityChangeObserver.isCurrentlyVisible()&&this.N.isBeaconSupported()?yield this.nt(t):yield this.it(t)).success?this.M({name:"logs_flushed",events:t}):this.et(t)}catch(t){s.Log.warn("Failed to flush events.")}})}it(e){return i(this,void 0,void 0,function*(){var t=yield this.N.post({sdkKey:this.l,data:{events:e},url:this.q,retries:3,params:{ec:String(e.length)}}),t=null!=t&&t.body?(0,l.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}nt(t){return i(this,void 0,void 0,function*(){return{success:yield this.N.beacon({sdkKey:this.l,data:{events:t},url:this.B})}})}et(t){for(;500<t.length;)t.shift();var e=this.ot();(0,u.setObjectInStorage)(e,t).catch(()=>{s.Log.warn("Unable to save failed logs to storage")})}H(){const e=this.ot();i(this,void 0,void 0,function*(){var t=yield(0,u.getObjectFromStorage)(e);t&&(yield u.Storage.removeItem(e),yield this.tt(t))}).catch(()=>{s.Log.warn("Failed to flush stored logs")})}ot(){return"statsig.failed_logs."+(0,o.DJB2)(this.l)}Y(t){t.user&&(t.user=Object.assign({},t.user),delete t.user.privateAttributes);var e={},n=this.rt();n&&(e.statsigMetadata={currentPage:n}),this.G.push(Object.assign(Object.assign({},t),e))}Z(){0!==Object.keys(this.F).length&&(this.Y({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:Object.assign({},this.F)}}),this.F={})}rt(){var t;if(!1!==(null==(t=this.P)?void 0:t.includeCurrentPageUrlWithEvents)&&"undefined"!=typeof window&&"object"==typeof window.location)try{return window.location.href.split(/[?#]/)[0]}catch(t){}}}},832:(t,e)=>{function n(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)}Object.defineProperty(e,"__esModule",{value:!0}),e.DJB2Object=e.DJB2=void 0,e.DJB2=n,e.DJB2Object=function(t){return n(JSON.stringify(function n(i){if(null==i)return null;const t=Object.keys(i).sort();const o={};t.forEach(t=>{let e=i[t];e instanceof Object&&(e=n(e)),o[t]=e});return o}(t)))}},284:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,o;Object.defineProperty(e,"__esModule",{value:!0}),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},104:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.monitorClass=void 0;const s=n(280),r=n(688);function c(t,e,n,i){var o=i instanceof r.StatsigClientBase?i.ut.bind(i):void 0;return t.capture(e,()=>(0,s.captureDiagnostics)(e,()=>n.apply(i)),o)}function d(t){return"object"==typeof t&&(t=Object.getPrototypeOf(t))&&"object"==typeof t?t:null}e.monitorClass=function(e,t){try{{var n=e;var i=t;var o;const s=i;for(const r of function(t){const e=new Set;let n=d(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)}(s))if("constructor"!==r){const u=s[r];s[r]=function(...t){return c(n,r,()=>u.apply(this,t),i)}}for(const l of function(t){const e=new Set,n=d(t);return Object.getOwnPropertyNames((null===n||void 0===n?void 0:n.constructor)||{}).filter(t=>{var e;return"caller"!==t&&"arguments"!==t&&"callee"!==t&&"function"==typeof(null==(e=null===n||void 0===n?void 0:n.constructor)?void 0:e[t])}).forEach(t=>e.add(t)),Array.from(e)}(s)){const a=null==(o=null===s||void 0===s?void 0:s.constructor)?void 0:o[l];(null===s||void 0===s?void 0:s.constructor)[l]=function(...t){return c(n,s.constructor.name+"."+l,()=>a.apply(s.constructor,t),i)}}return}}catch(t){e.logError("monitorClass",t)}}},188: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())})};Object.defineProperty(e,"__esModule",{value:!0}),e.NetworkCore=void 0;const h=n(280),v=n(780),s=n(612),r=n(604),u=n(972);e.NetworkCore=class{constructor(t,e){this.P=t,this.M=e,this.lt=null!=(e=null==t?void 0:t.networkTimeoutMs)?e:1e4}post(e){return o(this,void 0,void 0,function*(){var t=yield this.ct(e);return this.dt(Object.assign({method:"POST",body:t},e))})}get(t){return o(this,void 0,void 0,function*(){return this.dt(Object.assign({method:"GET"},t))})}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(n){return o(this,void 0,void 0,function*(){var t=yield this.ht(n),e=yield this.ct(n);return navigator.sendBeacon(t,e)})}dt(c){var d;return o(this,void 0,void 0,function*(){var{method:e,body:n,retries:i}=c;const o=new AbortController;var t,s,r,u=setTimeout(()=>o.abort(`Timeout of ${this.lt}ms expired.`),this.lt),l=yield this.ht(c);let a=null;try{if(a=yield fetch(l,{method:e,body:n,headers:Object.assign({},c.headers),signal:o.signal}),clearTimeout(u),a.ok)return r=yield a.text(),h.Diagnostics.mark("_sendRequest:response-received",{status:a.status,contentLength:a.headers.get("content-length")}),{body:r,code:a.status};throw t=yield a.text().catch(()=>"No Text"),(s=new Error(`Failed to fetch: ${l} `+t)).name="NetworkError",s}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("_sendRequest:error",{error:n,status:null===a||void 0===a?void 0:a.status,contentLength:null===a||void 0===a?void 0:a.headers.get("content-length")}),!i||i<=0?(null!=(d=this.M)&&d.call(this,{name:"error",error:t}),v.Log.error(`A networking error occured during ${e} request to ${l}.`,n,t),null):this.dt(Object.assign(Object.assign({},c),{retries:i-1}))}})}ht(e){return o(this,void 0,void 0,function*(){var t=u.StatsigMetadataProvider.get(),t=Object.assign({k:e.sdkKey,st:t.sdkType,sv:t.sdkVersion,t:String(Date.now()),sid:yield s.SessionID.get(e.sdkKey)},e.params),t=Object.entries(t).map(([t,e])=>encodeURIComponent(t)+"="+encodeURIComponent(e)).join("&");return e.url+(t?"?"+t:"")})}ct(i){return o(this,void 0,void 0,function*(){var t=i["data"],e=yield r.StableID.get(i.sdkKey),n=yield s.SessionID.get(i.sdkKey);return JSON.stringify(Object.assign(Object.assign({},t),{statsigMetadata:Object.assign(Object.assign({},u.StatsigMetadataProvider.get()),{stableID:e,sessionID:n})}))})}}},264:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CombinationOverrideAdapter=void 0;e.CombinationOverrideAdapter=class{constructor(t){this.providers=t}getGateOverride(n,i){return this.vt(t=>{var e;return null!=(e=null==(e=t.getGateOverride)?void 0:e.call(t,n,i))?e:null})}getDynamicConfigOverride(n,i){return this.vt(t=>{var e;return null!=(e=null==(e=t.getDynamicConfigOverride)?void 0:e.call(t,n,i))?e:null})}vt(t){for(const n of this.providers){var e=t(n);if(e)return e}return null}}},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=>n(void 0,void 0,void 0,function*(){return null!=h[t]?h[t]:h[t]=r.SessionID.ft(t)}),ft: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.getObjectFromStorage)(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.setObjectInStorage)(o,i).catch(()=>{u.Log.warn("Failed to save SessionID")}),t.idleTimeoutID=r.SessionID._t(t,t.idleTimeoutID,18e5),t.ageTimeoutID=r.SessionID._t(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},_t:(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())})};Object.defineProperty(e,"__esModule",{value:!0}),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.setObjectInStorage)(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.getObjectFromStorage)(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())})};Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigClientBase=void 0,n(496);const s=n(512),r=n(728),u=n(780),l=n(612),a=n(604),c=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.yt={},this.l=t,this.P=null!=i?i:{},null!=i&&i.disableStorage&&c.Storage.setDisabled(!0),null!=i&&i.overrideStableID&&a.StableID.setOverride(i.overrideStableID,t),u.Log.level=null!=(o=null==i?void 0:i.logLevel)?o:u.LogLevel.Warn,this.bt=null!=(o=null==i?void 0:i.overrideAdapter)?o:null,this.wt=new r.EventLogger(t,this.ut.bind(this),n,i),l.SessionID.gt(()=>{this.ut({name:"session_expired"})},t),this.u=new s.ErrorBoundary(t);var o,n=null!=(o=(__STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}).instances)?o:{};n[t]=this,__STATSIG__.instances=n,(__STATSIG__.lastInstance=this).dataAdapter=e,this.dataAdapter.attach(t,i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.P.disableLogging=t.disableLogging,this.wt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.P.disableStorage=t.disableStorage,c.Storage.setDisabled(t.disableStorage))}flush(){return this.wt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.ut({name:"pre_shutdown"}),yield this.wt.shutdown()})}on(t,e){this.yt[t]||(this.yt[t]=[]),this.yt[t].push(e)}off(t,e){this.yt[t]&&-1!==(e=this.yt[t].indexOf(e))&&this.yt[t].splice(e,1)}__on(t,e){e.__isInternal=!0,this.on(t,e)}ut(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.u.logError("_emit:"+n.name,t):u.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.yt[n.name]&&this.yt[n.name].forEach(t=>e(t)),null!=(t=this.yt["*"])&&t.forEach(e)}St(t,e){this.loadingStatus=t,this.ut({name:"values_updated",status:t,values:e})}Ot(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.wt.incrementNonExposureCount(t):this.wt.enqueue(e)}}},808:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},283:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createLayerParameterExposure=e.createConfigExposure=e.createGateExposure=e.isExposureEvent=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure";function l(t,e,n,i,o){return{eventName:t,user:e,value:null,metadata:function(t,e){e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut));t.receivedAt&&(e.receivedAt=String(t.receivedAt));return e}(n,i),secondaryExposures:o,time:Date.now()}}e.isExposureEvent=function({eventName:t}){return t===i||t===n},e.createGateExposure=function(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.createConfigExposure=function(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.createLayerParameterExposure=function(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)}},972:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="0.0.1-beta.28";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=Object.assign(Object.assign({},n),t)}}},384:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},396:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.jt=e.Tt=e.It=e.At=void 0;const o="default";function s(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.At=function(t,e,n){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:o,value:!0===(null==n?void 0:n.value),__evaluation:n}},e.It=function(t,e,n){return{name:t,details:e,value:null!=(t=null==n?void 0:n.value)?t:{},ruleID:null!=(e=null==n?void 0:n.rule_id)?e:o,groupName:null,get:s(null==n?void 0:n.value),__evaluation:n}},e.Tt=function(t,e,n,i){return{name:t,details:e,get:s(null==n?void 0:n.value,i),ruleID:null!=(t=null==n?void 0:n.rule_id)?t:o,groupName:null!=(e=null==n?void 0:n.group_name)?e:null,__value:null!=(i=null==n?void 0:n.value)?i:{},__evaluation:n}},e.jt=function(t,e,n,i){return Object.assign(Object.assign(Object.assign({},t),e),{get:s(n,i)})}},136:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},296:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),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=(Object.defineProperty(e,"__esModule",{value:!0}),e.setObjectInStorage=e.getObjectFromStorage=e.Storage=void 0,n(780));const o={},s={getProviderName:()=>"InMemory",getItemSync(t){return null!=(t=o[t])?t:null},getItem(t){return Promise.resolve(null!=(t=o[t])?t:null)},setItem(t,e){return o[t]=e,Promise.resolve()},removeItem(t){return delete o[t],Promise.resolve()},getAllKeys(){return Promise.resolve(Object.keys(o))}};let r=null;try{"undefined"!=typeof window&&"localStorage"in window&&(r={getProviderName:()=>"LocalStorage",getItemSync(t){return localStorage.getItem(t)},getItem(t){return Promise.resolve(localStorage.getItem(t))},setItem(t,e){return localStorage.setItem(t,e),Promise.resolve()},removeItem(t){return localStorage.removeItem(t),Promise.resolve()},getAllKeys(){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={getProviderName:()=>l.getProviderName(),getItem:t=>l.getItem(t),setItem:(t,e)=>l.setItem(t,e),removeItem:t=>l.removeItem(t),getAllKeys:()=>l.getAllKeys(),getItemSync:t=>{var e;return null!=(e=null==(e=l.getItemSync)?void 0:e.call(l,t))?e:null},setProvider:t=>{u=t,l=t},setDisabled:t=>{l=t?s:u}},e.getObjectFromStorage=function(e){return i(this,void 0,void 0,function*(){var t=yield l.getItem(e);return JSON.parse(null!=t?t:"null")})},e.setObjectInStorage=function(t,e){return i(this,void 0,void 0,function*(){yield l.setItem(t,JSON.stringify(e))})}},412:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),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)=>{Object.defineProperty(e,"__esModule",{value:!0}),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)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.$=void 0,e.$=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},408:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VisibilityChangeObserver=void 0;class n{static isCurrentlyVisible(){return"foreground"===this.xt}static add(t){this.yt.unshift(t)}static remove(t){t=this.yt.indexOf(t);-1!==t&&this.yt.splice(t,1)}static notify(e){e!==this.xt&&(this.xt=e,this.yt.forEach(t=>t.onVisibilityChanged(e)))}}(e.VisibilityChangeObserver=n).yt=[],n.xt="foreground","undefined"!=typeof window&&"function"==typeof window.addEventListener&&(window.addEventListener("focus",()=>n.notify("foreground")),window.addEventListener("blur",()=>n.notify("background")),window.addEventListener("beforeunload",()=>n.notify("background"))),"undefined"!=typeof document&&"function"==typeof document.addEventListener&&document.addEventListener("visibilitychange",()=>{n.notify("visible"===document.visibilityState?"foreground":"background")})},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)};Object.defineProperty(e,"__esModule",{value:!0}),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(512),e),o(n(500),e),o(n(788),e),o(n(832),e),o(n(284),e),o(n(780),e),o(n(104),e),o(n(188),e),o(n(264),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(408),e),__STATSIG__=Object.assign(Object.assign({},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)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AutoInit=void 0;const r=n(464);e.AutoInit=class{static attempt(e){var n;if("undefined"!=typeof window&&"undefined"!=typeof document&&document.currentScript){var i=document.currentScript.getAttribute("src"),o=null==(o=null===window||void 0===window?void 0:window.location)?void 0:o.href;if(i&&o){let t=null;try{var s=new URL(i,o).searchParams;t=null!=(n=s.get("sdkkey"))?n:s.get("sdkKey")}catch(t){r.Log.error("Invalid source URL")}t&&e({sdkKey:t})}}}}},96:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),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=Object.assign(Object.assign(Object.assign({},t),n),{feature_gates:Object.assign(Object.assign({},t.feature_gates),n.feature_gates),layer_configs:Object.assign(Object.assign({},t.layer_configs),n.layer_configs),dynamic_configs:Object.assign(Object.assign({},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}}},536:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(464);e.default=class{constructor(){this.Dt=null,this.Mt=null,this.Et="Uninitialized",this.Nt=0,this.Pt=0}getValues(){return this.Dt?(0,i.typedJsonParse)(this.Dt,"has_updates","Failed to parse EvaluationStoreValues"):null}reset(){this.Mt=null,this.Dt=null,this.Et="Loading",this.Nt=0,this.Pt=0}finalize(){this.Mt||(this.Et="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.Dt=t.data,this.Nt=e.time,this.Pt=t.receivedAt,this.Et=t.source,this.Mt=e)}getGate(t){var e,t=null!=(e=null==(e=this.Mt)?void 0:e.feature_gates[t])?e:null;return this.Gt(t)}getConfig(t){var e,t=null!=(e=null==(e=this.Mt)?void 0:e.dynamic_configs[t])?e:null;return this.Gt(t)}getLayer(t){var e,t=null!=(e=null==(e=this.Mt)?void 0:e.layer_configs[t])?e:null;return this.Gt(t)}Gt(t){return{evaluation:t,details:this.kt(null==t)}}kt(t){return"Uninitialized"===this.Et||"NoValues"===this.Et?{reason:this.Et}:{reason:this.Et+":"+(t?"Unrecognized":"Recognized"),lcut:this.Nt,receivedAt:this.Pt}}}},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())})};Object.defineProperty(e,"__esModule",{value:!0});const r=n(464),u=n(96);class i extends r.NetworkCore{constructor(t,e){super(t,e),this.Ct=(0,r.$)(null==t?void 0:t.initializeUrl,null==t?void 0:t.api,"/initialize","https://api.statsig.com/v1")}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=Object.assign(Object.assign({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.Ft(n,t,e)})}Ft(e,n,i){var o;return s(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Ct,data:i,retries:2});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.Ft(e,n,Object.assign(Object.assign(Object.assign({},i),t),{deltasResponseRequested:!1}))})}}e.default=i},520: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())})};Object.defineProperty(e,"__esModule",{value:!0});const r=n(464),o=n(536),s=n(400),u=n(364);n(807);class l extends r.StatsigClientBase{constructor(t,e,n=null){var i=new s.default(n,t=>{this.ut(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new u.StatsigEvaluationsDataAdapter,i,n),(0,r.monitorClass)(this.u,this),(0,r.monitorClass)(this.u,i),this.Rt=new o.default,this.Lt=e}static instance(t){var e;return __STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{},null==t?__STATSIG__.lastInstance:null==(e=__STATSIG__.instances)?void 0:e[t]}initializeSync(){this.updateUserSync(this.Lt)}initializeAsync(){return this.updateUserAsync(this.Lt)}updateUserSync(t){this.Ut(t);t=this.dataAdapter.getDataSync(this.Lt);this.Rt.setValuesFromDataAdapter(t),this.Rt.finalize(),this.St("Ready",t),this.Jt(null!=t?t:null,this.Lt)}updateUserAsync(n){return i(this,void 0,void 0,function*(){this.Ut(n);var t=this.Lt,e=this.dataAdapter.getDataSync(t);this.St("Loading",e),this.Rt.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,t),t===this.Lt&&this.Rt.setValuesFromDataAdapter(e),this.Rt.finalize(),this.St("Ready",e)})}getContext(){return{sdkKey:this.l,options:this.P,values:this.Rt.getValues(),user:JSON.parse(JSON.stringify(this.Lt))}}getAsyncContext(){return i(this,void 0,void 0,function*(){return Object.assign(Object.assign({},this.getContext()),{sessionID:yield r.SessionID.get(this.l),stableID:yield r.StableID.get(this.l)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var n=(0,r.DJB2)(t),{evaluation:n,details:i}=this.Rt.getGate(n),i=(0,r.At)(t,i,n),o=null==(o=null==(n=this.bt)?void 0:n.getGateOverride)?void 0:o.call(n,i,this.Lt,e),n=null!=o?o:i;return this.Ot(t,(0,r.createGateExposure)(this.Lt,n),e),this.ut({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.Kt("dynamic_config",t,e);return this.ut({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.Kt("experiment",t,e);return this.ut({name:"experiment_evaluation",experiment:t}),t}getLayer(e,n){var t=(0,r.DJB2)(e),{evaluation:t,details:i}=this.Rt.getLayer(t),i=(0,r.Tt)(e,i,t),o=null==(o=null==(t=this.bt)?void 0:t.getLayerOverride)?void 0:o.call(t,i,this.Lt,n);const s=(0,r.jt)(i,o,null!=(t=null==o?void 0:o.__value)?t:i.__value,t=>{this.Ot(e,(0,r.createLayerParameterExposure)(this.Lt,s,t),n)});return this.ut({name:"layer_evaluation",layer:s}),s}logEvent(t,e,n){this.wt.enqueue(Object.assign(Object.assign({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.Lt,time:Date.now()}))}Jt(t,e){this.dataAdapter.getDataAsync(t,e).catch(t=>{r.Log.error("An error occurred after update.",t)})}Ut(t){this.wt.reset(),this.Rt.reset(),this.Lt=(0,r.normalizeUser)(t,this.P.environment)}Kt(t,e,n){var i=(0,r.DJB2)(e),{evaluation:i,details:o}=this.Rt.getConfig(i),o=(0,r.It)(e,o,i),i="experiment"===t?null==(t=null==(i=this.bt)?void 0:i.getExperimentOverride)?void 0:t.call(i,o,this.Lt,n):null==(i=null==(t=this.bt)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,o,this.Lt,n),t=null!=i?i:o;return this.Ot(e,(0,r.createConfigExposure)(this.Lt,t),n),t}}e.default=l},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=(Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigEvaluationsDataAdapter=void 0,n(464));const s=n(400);class r extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.N=null}attach(t,e){super.attach(t,e),this.N=new s.default(null!=e?e:{})}j(e,n){var i;return o(this,void 0,void 0,function*(){var t=yield null==(i=this.N)?void 0:i.fetchEvaluations(this.T(),e,n);return null!=t?t:null})}}e.StatsigEvaluationsDataAdapter=r},807:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SDK_TYPE=void 0;n=n(464);e.SDK_TYPE="javascript-client",n.StatsigMetadataProvider.add({sdkType:e.SDK_TYPE})},208:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),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}}),n(807),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigEvaluationsDataAdapter:o.StatsigEvaluationsDataAdapter,StatsigClient:i.default,instance:i.default.instance}),e.default=__STATSIG__},152:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SessionReplay=e.runStatsigSessionReplay=void 0;const o=n(464),i=n(884);e.runStatsigSessionReplay=function(t){new s(t)};class s{constructor(t){var t=(this.Vt=t,this.fe=null,this._e=[],this.ge="",t.getContext())["sdkKey"],e=null!=(e=(__STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}).srInstances)?e:{};e[t]=this,__STATSIG__.srInstances=e,this.me=new i.SessionReplayClient,this.Vt.__on("pre_shutdown",()=>this.be()),this.Vt.__on("values_updated",()=>this.ye()),this.Vt.__on("session_expired",()=>{this.me.stop(),o.StatsigMetadataProvider.add({isRecordingSession:"false"}),this.pe(this.ge),this.Vt.getAsyncContext().then(t=>{this.ge=t.sessionID}).catch(t=>{o.Log.error(t)})}),o.VisibilityChangeObserver.add(this),this.Vt.getAsyncContext().then(t=>{this.ge=t.sessionID,this.ye()}).catch(t=>{o.Log.error(t)})}onVisibilityChanged(t){"background"===t&&(this.pe(this.ge),this.Vt.flush().catch(t=>{o.Log.error(t)}))}Se(t,e){this.fe=e,this._e.push(t),2048<JSON.stringify(this._e).length&&this.De()}ye(){var t=this.Vt.getContext().values;!0!==(null==t?void 0:t.can_record_session)?this.be():this.me.isRecording()||(o.StatsigMetadataProvider.add({isRecordingSession:"true"}),this.me.record((t,e)=>this.Se(t,e)))}be(){this.me.stop(),o.StatsigMetadataProvider.add({isRecordingSession:"false"}),0!==this._e.length&&null!=this.fe&&this.De()}pe(t){0!==this._e.length&&null!=this.fe&&this.Oe(t)}Oe(t){var e,n=o.StatsigMetadataProvider.get()["sdkVersion"],i=this.fe;null!==i&&0!==this._e.length&&(e=JSON.stringify(this._e),this.Vt.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:n}}),this._e=[])}De(){this.Vt.getAsyncContext().then(t=>{this.Oe(t.sessionID)}).catch(t=>{o.Log.error(t)})}}e.SessionReplay=s},884:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SessionReplayClient=void 0;const i=n(80),o=n(352);e.SessionReplayClient=class{constructor(){this.je=null,this.Te=null,this.Ie=0}record(n,t){"undefined"==typeof window||(this.je=null,this.Te=null,this.Ie=0,this.Ae=t,this.Me)||(this.Me=(t=t=>{var e;null==this.je&&(this.je=t.timestamp),this.Te=t.timestamp,(e=t).type===i.EventType.IncrementalSnapshot&&e.data.source===i.IncrementalSource.MouseInteraction&&e.data.type===i.MouseInteractions.Click&&this.Ie++,n(t,{startTime:this.je,endTime:this.Te,clickCount:this.Ie}),144e5<this.Te-this.je&&(null!=(e=this.Me)&&e.call(this),this.Ae)&&this.Ae()},("function"==typeof o?o:o.record)({emit:t})))}stop(){this.Me&&(this.Me(),this.Me=void 0)}isRecording(){return null!=this.Me}}},392:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.runStatsigSessionReplay=e.SessionReplay=e.SessionReplayClient=void 0;const i=n(152),o=(Object.defineProperty(e,"SessionReplay",{enumerable:!0,get:function(){return i.SessionReplay}}),Object.defineProperty(e,"runStatsigSessionReplay",{enumerable:!0,get:function(){return i.runStatsigSessionReplay}}),n(884));Object.defineProperty(e,"SessionReplayClient",{enumerable:!0,get:function(){return o.SessionReplayClient}}),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{SessionReplayClient:o.SessionReplayClient,SessionReplay:i.SessionReplay,runStatsigSessionReplay:i.runStatsigSessionReplay})},156:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AutoCapture=e.runStatsigAutoCapture=void 0;const i=n(464),o=n(76);e.runStatsigAutoCapture=function(t){new s(t)};class s{constructor(t){var t=(this.Vt=t,this.qt=Date.now(),this.zt=0,t.getContext())["sdkKey"],e=null!=(e=(__STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}).acInstances)?e:{};e[t]=this,__STATSIG__.acInstances=e,"undefined"!=typeof document&&"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>this.$t()):this.$t()}Bt(){var t;"undefined"!=typeof window&&"undefined"!=typeof document&&(t=t=>{this.Ht(t||window.event)},(0,o.registerEventHandler)(document,"click",t),(0,o.registerEventHandler)(document,"submit",t),(0,o.registerEventHandler)(window,"error",t),(0,o.registerEventHandler)(window,"beforeunload",()=>this.Wt()),(0,o.registerEventHandler)(window,"scroll",()=>this.Yt()))}Ht(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.Qt(t):(e=(0,o.getTargetNode)(t))&&(0,o.shouldLogEvent)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,o.gatherEventData)(e),this.Xt(n,t,e))}$t(){this.Bt(),this.Zt(),this.te()}Qt(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.Xt("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}Zt(){setTimeout(()=>{var t=(0,o.getSafeUrl)();this.ee("page_view",(0,o.getSanitizedPageUrl)(),{title:null===document||void 0===document?void 0:document.title,queryParams:Object.fromEntries(t.searchParams)})},1)}te(){"undefined"!=typeof window&&void 0!==window.performance&&"function"==typeof window.performance.getEntriesByType&&"function"==typeof window.performance.getEntriesByName&&setTimeout(()=>{var t={},e=window.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),window.performance.getEntriesByName("first-contentful-paint"));e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),this.Xt("performance",(0,o.getSanitizedPageUrl)(),t)},1)}Wt(){this.ee("page_view_end",(0,o.getSanitizedPageUrl)(),{scrollDepth:this.zt,pageViewLength:Date.now()-this.qt})}Xt(t,e,n){e={eventName:"auto_capture::"+t,value:e,metadata:Object.assign({sessionId:(0,o.getWebSessionId)(this.Vt.getContext().sdkKey),page_url:(null==(t=null===window||void 0===window?void 0:window.location)?void 0:t.href)||""},n)};this.Vt.logEvent(e),i.Log.debug("Enqueued Event",e)}ee(t,e,n){this.Xt(t,e,n),this.Vt.flush().catch(t=>{i.Log.error(t)})}Yt(){var t=document.body.scrollHeight||1;this.zt=Math.max(this.zt,Math.min(100,Math.round((window.scrollY+window.innerHeight)/t*100)))}}e.AutoCapture=s},76:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.registerEventHandler=e.getSanitizedPageUrl=e.getWebSessionId=e.getSafeUrl=e.shouldLogEvent=e.getTargetNode=e.gatherEventData=void 0;const o=n(464),s={};function r(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.gatherEventData=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()),r(t));return o&&(n.href=o.getAttribute("href")),{value:i,metadata:n}},e.getTargetNode=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.shouldLogEvent=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(r(e))return!0}return!1}},e.getSafeUrl=function(){var t=(null==(t=null===window||void 0===window?void 0:window.location)?void 0:t.href)||"";let e;try{e=new URL(t)}catch(t){e=new URL("error:")}return e},e.getWebSessionId=function(t){var e=function(t){if(window&&window.localStorage)return window.localStorage.getItem(t);return s[t]}(t="statsig.web_analytics.session."+(0,o.DJB2)(t)),n=Date.now();let i=e?(0,o.typedJsonParse)(e,"lastAccessedTime","Failed to parse WebSession"):null;return(i=!i||144e5<n-i.startTime||6e5<n-i.lastAccessedTime?(e=Date.now(),{id:(0,o.getUUID)(),startTime:e,lastAccessedTime:e}):i).lastAccessedTime=n,e=t,n=JSON.stringify(i),window&&window.localStorage?window.localStorage.setItem(e,n):(s[e]=n,o.Log.error("Statsig Web AutoCapture: No window.localStorage")),i.id},e.getSanitizedPageUrl=function(){var t;return(null==(t=null==(t=null===window||void 0===window?void 0:window.location)?void 0:t.href)?void 0:t.split(/[?#]/)[0])||""},e.registerEventHandler=function(t,e,n){t&&t.addEventListener&&t.addEventListener(e,n,!0)}},824:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.runStatsigAutoCapture=e.AutoCapture=void 0;const i=n(156);Object.defineProperty(e,"AutoCapture",{enumerable:!0,get:function(){return i.AutoCapture}}),Object.defineProperty(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return i.runStatsigAutoCapture}}),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{AutoCapture:i.AutoCapture,runStatsigAutoCapture:i.runStatsigAutoCapture}),e.default=__STATSIG__},80:(t,e,n)=>{n.r(e),n.d(e,{CanvasContext:()=>u,EventType:()=>i,IncrementalSource:()=>o,MediaInteractions:()=>l,MouseInteractions:()=>s,PointerTypes:()=>r,ReplayerEvents:()=>a});var i=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(i||{}),o=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t))(o||{}),s=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(s||{}),r=(t=>(t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t))(r||{}),u=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(u||{}),l=(t=>(t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t))(l||{}),a=(t=>(t.Start="start",t.Pause="pause",t.Resume="resume",t.Resize="resize",t.Finish="finish",t.FullsnapshotRebuilded="fullsnapshot-rebuilded",t.LoadStylesheetStart="load-stylesheet-start",t.LoadStylesheetEnd="load-stylesheet-end",t.SkipStart="skip-start",t.SkipEnd="skip-end",t.MouseInteraction="mouse-interaction",t.EventCast="event-cast",t.CustomEvent="custom-event",t.Flush="flush",t.StateChange="state-change",t.PlayBack="play-back",t.Destroy="destroy",t))(a||{})}},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.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var t={};{var e=t;const r=o(464),u=o(208),l=o(392),a=o(824);var s=o(920);e.default=__STATSIG__,s.AutoInit.attempt(({sdkKey:t})=>{var e=null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:e[t];let n=null;n=(n=e instanceof u.StatsigClient?e:n)||new u.StatsigClient(t,{userID:""}),new l.SessionReplay(n),new a.AutoCapture(n),n.initializeAsync().catch(t=>{r.Log.error(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,c=>(()=>{"use strict";var $Q=(e)=>Object.defineProperty(e,"__esModule",{value:!0});var $P = (a,b) => Object.assign(a,b);var n={8352:t=>{t.exports=c},5496:(t,e,n)=>{$Q(e),e.i=void 0;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:{};o[s]=u,n[s]=u,r[s]=u;e.i=()=>null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:u},5856:(t,e)=>{$Q(e)},2320: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(8512),s=n(6780),r=n(7104),u=n(6283),l=n(6296),a=n(3444),c=n(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 i.ErrorBoundary(t),(0,r.monitorClass)(this.l,this)}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)}getDataAsync(n,i){var s;return o(this,void 0,void 0,function*(){var t=null!=n?n:this.getDataSync(i),t=yield this.O(null!=(s=null==t?void 0:t.data)?s:null,i),e=this.m(i);return t&&this.S(e,t),"Network"!==(null==t?void 0:t.source)&&"NetworkNotModified"!==(null==t?void 0:t.source)||(yield this.j(e,t)),t})}prefetchData(n){return o(this,void 0,void 0,function*(){var t=this.m(n),e=yield this.getDataAsync(null,n);e&&this.S(t,$P($P({},e),{source:"Prefetch"}))})}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(n,i){return o(this,void 0,void 0,function*(){var t,e=yield this.T(n,i);return e?(t=(0,c.typedJsonParse)(e,"has_updates","Failure while attempting to persist latest value"),n&&!1===(null==t?void 0:t.has_updates)?{source:"NetworkNotModified",data:n,receivedAt:Date.now()}:!0!==(null==t?void 0:t.has_updates)?null:{source:"Network",data:e,receivedAt:Date.now()}):(s.Log.debug("No response returned for latest value"),null)})}I(){return null!=this.h?this.h:(s.Log.error(this.o+" is not attached to a Client"),"")}m(t){t=(0,l.getUserStorageKey)(this.I(),t);return`${u.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=a.Storage.A)?void 0:e.call(a.Storage,t);return null!=e&&(t=(0,c.typedJsonParse)(e,"source","Failed to parse cached result"))?$P($P({},t),{source:"Cache"}):null}j(t,e){return o(this,void 0,void 0,function*(){yield a.Storage.M(t,JSON.stringify(e)),yield this.D(t)})}D(n){var i;return o(this,void 0,void 0,function*(){var t=null!=(i=yield(0,a.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 a.Storage.P(e[0])),yield(0,a.R)(this._,t)})}}},4280:(t,e,n)=>{$Q(e),e.Diagnostics=e.captureDiagnostics=void 0;const i=n(6780),s=n(5256),o="undefined"!=typeof performance&&void 0!==performance.mark;let r=[];e.captureDiagnostics=function(t,e){u.mark(t+":start"),e=e();const n=()=>{u.mark(t+":end"),(t+":end").startsWith("initialize:")&&u.flush()};return e&&e instanceof Promise?e.finally(()=>n()):(n(),e)};class u{static mark(t,e){o&&(t=performance.mark(t,{detail:e}),r.push(t))}static flush(){var t=performance.getEntriesByType("resource").filter(t=>t.name.startsWith(s.NetworkDefault.initializeApi)||t.name.startsWith(s.NetworkDefault.specsApi)||t.name.startsWith(s.NetworkDefault.eventsApi)),t={markers:r,resources:t};i.Log.debug("Diagnostics",t,JSON.stringify(t)),r=[]}}e.Diagnostics=u},184:(t,e)=>{$Q(e)},8512:function(t,l,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(l,"__esModule",{value:!0}),l.ErrorBoundary=l.EXCEPTION_ENDPOINT=void 0;const i=e(6780),a=e(7360),c=e(6972);l.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";l.ErrorBoundary=class{constructor(t){this.h=t,this.C=new Set}capture(e,t,n){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.G(e,t,n)):i}catch(t){return this.G(e,t,n),null}}logError(t,e){this.G(t,e)}G(o,r,u){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.C.has(s)||(this.C.add(s),t=a.SDKType.F(this.h),e=c.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(l.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!=u&&u({name:"error",error:r}))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{$Q(e)},6788:(t,e)=>{$Q(e)},6728: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(7832),o=n(6780),r=n(5256),u=n(3452),l=n(1876),a=n(3444),c=n(2412),d=n(84),h=n(100);e.EventLogger=class{constructor(t,e,n,i){this.h=t,this.L=e,this.U=n,this.J=i,this.K=[],this.q={},this.V={},this.B=!1,this.$=Date.now(),this.H=!0===(null==i?void 0:i.disableLogging),this.W=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;n=null!=(e=null==i?void 0:i.loggingIntervalMs)?e:1e4,this.Y=setInterval(()=>this.X(),n),t=null==i?void 0:i.networkConfig;this.Z=(0,d.tt)(null==t?void 0:t.logEventUrl,null==t?void 0:t.api,"/rgstr",r.NetworkDefault.eventsApi),this.et=(0,d.tt)(null==t?void 0:t.logEventBeaconUrl,null==t?void 0:t.api,"/log_event_beacon",r.NetworkDefault.eventsApi),(0,h.nt)(this.it.bind(this)),this.ot()}setLoggingDisabled(t){this.H=t}enqueue(t){this.rt(t)&&(this.ut(t),this.lt(),this.K.length>this.W)&&this.X()}incrementNonExposureCount(t){var e=null!=(e=this.V[t])?e:0;this.V[t]=e+1}reset(){this.q={}}shutdown(){return i(this,void 0,void 0,function*(){this.Y&&(clearInterval(this.Y),this.Y=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.ct(),0!==this.K.length&&(t=this.K,this.K=[],yield this.dt(t))})}it(t){"background"===t&&this.X()}lt(){this.B||(this.B=!0,200<Date.now()-this.$)||setTimeout(()=>this.X(),200)}rt(t){if((0,l.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}X(){this.flush().catch(()=>{})}dt(t){return i(this,void 0,void 0,function*(){if(this.H)this.vt(t);else try{(!(0,h._t)()&&this.U.isBeaconSupported()?yield this.ft(t):yield this.gt(t)).success?this.L({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.U.post({sdkKey:this.h,data:{events:e},url:this.Z,retries:3,params:{[u.NetworkParam.EventCount]:String(e.length)}}),t=null!=t&&t.body?(0,c.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.U.beacon({sdkKey:this.h,data:{events:t},url:this.et})}})}vt(t){for(;500<t.length;)t.shift();var e=this.bt();(0,a.R)(e,t).catch(()=>{o.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,a.N)(e);t&&(yield a.Storage.P(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.K.push($P($P({},t),e))}ct(){0!==Object.keys(this.V).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.V)}}),this.V={})}yt(){var t;if(!1!==(null==(t=this.J)?void 0:t.includeCurrentPageUrlWithEvents)&&"undefined"!=typeof window&&"object"==typeof window.location)try{return window.location.href.split(/[?#]/)[0]}catch(t){}}}},7832:(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}},9664:(t,e)=>{$Q(e)},6780:(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},7104:(t,e,n)=>{$Q(e),e.monitorClass=void 0;const o=n(4280),r=n(7688);function c(t,e,n,i){var s=i instanceof r.StatsigClientBase?i.St.bind(i):void 0;return t.capture(e,()=>(0,o.captureDiagnostics)(e,()=>n.apply(i)),s)}function d(t){return"object"==typeof t&&(t=Object.getPrototypeOf(t))&&"object"==typeof t?t:null}e.monitorClass=function(e,t){try{{var n=e;var i=t;var s;const o=i;for(const r of function(t){const e=new Set;let n=d(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)}(o))if("constructor"!==r){const u=o[r];o[r]=function(...t){return c(n,r,()=>u.apply(this,t),i)}}for(const l of function(t){const e=new Set,n=d(t);return Object.getOwnPropertyNames((null===n||void 0===n?void 0:n.constructor)||{}).filter(t=>{var e;return"caller"!==t&&"arguments"!==t&&"callee"!==t&&"function"==typeof(null==(e=null===n||void 0===n?void 0:n.constructor)?void 0:e[t])}).forEach(t=>e.add(t)),Array.from(e)}(o)){const a=null==(s=null===o||void 0===o?void 0:o.constructor)?void 0:s[l];(null===o||void 0===o?void 0:o.constructor)[l]=function(...t){return c(n,o.constructor.name+"."+l,()=>a.apply(o.constructor,t),i)}}return}}catch(t){e.logError("monitorClass",t)}}},3188: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(5496);const h=n(4280),v=n(6780),s=n(3452),o=n(7360),r=n(8612),u=n(1604),l=n(6972);e.NetworkCore=class{constructor(t,e){this.J=t,this.L=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.t(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=yield this.wt(n),e=yield this.jt(n);return navigator.sendBeacon(t,e)})}Tt(c){var d;return i(this,void 0,void 0,function*(){var{method:e,body:n,retries:i}=c;const s=new AbortController;var t,o,r,u=setTimeout(()=>s.abort(`Timeout of ${this.Ot}ms expired.`),this.Ot),l=yield this.wt(c);let a=null;try{if(a=yield fetch(l,{method:e,body:n,headers:$P({},c.headers),signal:s.signal}),clearTimeout(u),a.ok)return r=yield a.text(),h.Diagnostics.mark("_sendRequest:response-received",{status:a.status,contentLength:a.headers.get("content-length")}),{body:r,code:a.status};throw t=yield a.text().catch(()=>"No Text"),(o=new Error(`Failed to fetch: ${l} `+t)).name="NetworkError",o}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("_sendRequest:error",{error:n,status:null===a||void 0===a?void 0:a.status,contentLength:null===a||void 0===a?void 0:a.headers.get("content-length")}),!i||i<=0?(null!=(d=this.L)&&d.call(this,{name:"error",error:t}),v.Log.error(`A networking error occured during ${e} request to ${l}.`,n,t),null):this.Tt($P($P({},c),{retries:i-1}))}})}wt(e){return i(this,void 0,void 0,function*(){var t=$P({[s.NetworkParam.SdkKey]:e.sdkKey,[s.NetworkParam.SdkType]:o.SDKType.F(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.F(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},l.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}t(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}}},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 n={};let i;e.SDKType={F:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},It(t,e){n[t]=e},At(t){i&&"-react"!==i||(i="-"+t)}}},6048:(t,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.xt=i.Mt=i.Dt=i.Et=void 0;i.Et=()=>"undefined"!=typeof window?window:null,i.Dt=()=>{var t=(0,i.Et)();return null!=(t=null==t?void 0:t.document)?t:null},i.Mt=(t,e)=>{var n=(0,i.Et)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.xt=(t,e)=>{var n=(0,i.Dt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)}},8612: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(7832),u=e(6780),l=e(3444),a=e(3556),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.R)(s,i).catch(()=>{u.Log.warn("Failed to save SessionID")}),t.idleTimeoutID=r.SessionID.kt(t,t.idleTimeoutID,18e5),t.ageTimeoutID=r.SessionID.kt(t,t.ageTimeoutID,144e5-(n-e.startTime)),c[o]=e,d[o]=t,h[o]=null,e.sessionID}),Pt:(t,e)=>{var n=null!=(n=d[e])?n:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:t};n.emitFunction=t,d[e]=n},kt:(t,e,n)=>(clearTimeout(null!=e?e:void 0),setTimeout(t.emitFunction,n))}},1604: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(7832),o=n(6780),r=n(3444),u=n(3556),l={};function a(t){return"statsig.stable_id."+(0,s.DJB2)(t)}function c(t,e){e=a(e);(0,r.R)(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)}}},7688: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(5496);const o=n(8512),r=n(6728),u=n(6780),l=n(8612),a=n(1604),c=n(3444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Rt={},this.h=t,this.J=null!=i?i:{},null!=i&&i.disableStorage&&c.Storage.Ct(!0),null!=i&&i.overrideStableID&&a.StableID.setOverride(i.overrideStableID,t),u.Log.level=null!=(s=null==i?void 0:i.logLevel)?s:u.LogLevel.Warn,this.Gt=null!=(s=null==i?void 0:i.overrideAdapter)?s:null,this.Ft=new r.EventLogger(t,this.St.bind(this),n,i),l.SessionID.Pt(()=>{this.St({name:"session_expired"})},t),this.l=new o.ErrorBoundary(t);var s=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{},n=null!=(n=s.instances)?n:{};n[t]=this,s.lastInstance=this,s.instances=n,__STATSIG__=s,this.dataAdapter=e,this.dataAdapter.attach(t,i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.J.disableLogging=t.disableLogging,this.Ft.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.J.disableStorage=t.disableStorage,c.Storage.Ct(t.disableStorage))}flush(){return this.Ft.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.St({name:"pre_shutdown"}),yield this.Ft.shutdown()})}on(t,e){this.Rt[t]||(this.Rt[t]=[]),this.Rt[t].push(e)}off(t,e){this.Rt[t]&&-1!==(e=this.Rt[t].indexOf(e))&&this.Rt[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.l.logError("_emit:"+n.name,t):u.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Rt[n.name]&&this.Rt[n.name].forEach(t=>e(t)),null!=(t=this.Rt["*"])&&t.forEach(e)}Lt(t,e){this.loadingStatus=t,this.St({name:"values_updated",status:t,values:e})}Ut(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Ft.incrementNonExposureCount(t):this.Ft.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.Kt=e.qt=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.qt=(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.Kt=(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,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)},6972:(t,e)=>{$Q(e),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="0.0.1-beta.30";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=$P($P({},n),t)}}},3384:(t,e)=>{$Q(e)},6396:(t,e)=>{$Q(e),e.Vt=e.zt=e.Bt=e.$t=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.$t=function(t,e,n){return o(t,e,n,!0===(null==n?void 0:n.value))},e.Bt=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.zt=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.Vt=function(t,e,n,i){return $P($P($P({},t),e),{get:r(n,i)})}},9136:(t,e)=>{$Q(e)},6296:(t,e,n)=>{$Q(e),e.getUnitIDFromUser=e.getUserStorageKey=e.normalizeUser=void 0;const i=n(7832);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}},3444: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.R=e.N=e.Storage=void 0,n(6780));const s={},o={Ht:()=>"InMemory",A(t){return null!=(t=s[t])?t:null},Wt(t){return Promise.resolve(null!=(t=s[t])?t:null)},M(t,e){return s[t]=e,Promise.resolve()},P(t){return delete s[t],Promise.resolve()},Yt(){return Promise.resolve(Object.keys(s))}};let r=null;try{"undefined"!=typeof window&&"localStorage"in window&&(r={Ht:()=>"LocalStorage",A(t){return localStorage.getItem(t)},Wt(t){return Promise.resolve(localStorage.getItem(t))},M(t,e){return localStorage.setItem(t,e),Promise.resolve()},P(t){return localStorage.removeItem(t),Promise.resolve()},Yt(){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={Ht:()=>l.Ht(),Wt:t=>l.Wt(t),M:(t,e)=>l.M(t,e),P:t=>l.P(t),Yt:()=>l.Yt(),A:t=>{var e;return null!=(e=null==(e=l.A)?void 0:e.call(l,t))?e:null},Qt:t=>{u=t,l=t},Ct:t=>{l=t?o:u}},e.N=function(e){return i(this,void 0,void 0,function*(){var t=yield l.Wt(e);return JSON.parse(null!=t?t:"null")})},e.R=function(t,e){return i(this,void 0,void 0,function*(){yield l.M(t,JSON.stringify(e))})}},2412:(t,e,n)=>{$Q(e),e.typedJsonParse=void 0;const s=n(6780);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}},3556:(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.tt=void 0,e.tt=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},1539:(t,e)=>{$Q(e)},100:(t,e,n)=>{$Q(e),e.Xt=e.nt=e._t=void 0;n=n(6048);const i="foreground",s="background",o=[];let r=i;e._t=()=>r===i,e.nt=t=>{o.unshift(t)};e.Xt=e=>{e!==r&&(r=e,o.forEach(t=>t(e)))},(0,n.Mt)("focus",()=>(0,e.Xt)(i)),(0,n.Mt)("blur",()=>(0,e.Xt)(s)),(0,n.Mt)("beforeunload",()=>(0,e.Xt)(s)),(0,n.xt)("visibilitychange",()=>{(0,e.Xt)("visible"===document.visibilityState?i:s)})},4464: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(5496);const o=n(6728),r=(Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return o.EventLogger}}),n(6780));Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return r.Log}});var u=n(6972);const l=n(3444);Object.defineProperty(e,"Storage",{enumerable:!0,get:function(){return l.Storage}});var a=n(3556);s(n(5496),e),s(n(5856),e),s(n(2320),e),s(n(184),e),s(n(8512),e),s(n(500),e),s(n(6788),e),s(n(7832),e),s(n(9664),e),s(n(6780),e),s(n(7104),e),s(n(3452),e),s(n(3188),e),s(n(5256),e),s(n(4264),e),s(n(6048),e),s(n(7360),e),s(n(8612),e),s(n(1604),e),s(n(7688),e),s(n(5808),e),s(n(6283),e),s(n(1876),e),s(n(6972),e),s(n(3384),e),s(n(6396),e),s(n(9136),e),s(n(6296),e),s(n(3444),e),s(n(2412),e),s(n(84),e),s(n(1539),e),s(n(3556),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})},9920:(t,e,n)=>{$Q(e),e.AutoInit=void 0;const r=n(4464);e.AutoInit=class{static attempt(e){var n;if("undefined"!=typeof window&&"undefined"!=typeof document&&document.currentScript){var i=document.currentScript.getAttribute("src"),s=null==(s=null===window||void 0===window?void 0:window.location)?void 0:s.href;if(i&&s){let t=null;try{var o=new URL(i,s).searchParams;t=null!=(n=o.get("sdkkey"))?n:o.get("sdkKey")}catch(t){r.Log.error("Invalid source URL")}t&&e({sdkKey:t})}}}}},3096:(t,e,n)=>{$Q(e),e.resolveDeltasResponse=void 0;const i=n(4464);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}}},1536:(t,e,n)=>{$Q(e);const i=n(4464);e.default=class{constructor(){this.Zt=null,this.te=null,this.ee="Uninitialized",this.ne=0,this.ie=0}getValues(){return this.Zt?(0,i.typedJsonParse)(this.Zt,"has_updates","Failed to parse EvaluationStoreValues"):null}reset(){this.te=null,this.Zt=null,this.ee="Loading",this.ne=0,this.ie=0}finalize(){this.te||(this.ee="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.Zt=t.data,this.ne=e.time,this.ie=t.receivedAt,this.ee=t.source,this.te=e)}getGate(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.feature_gates[t])?e:null;return this.se(t)}getConfig(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.dynamic_configs[t])?e:null;return this.se(t)}getLayer(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.layer_configs[t])?e:null;return this.se(t)}se(t){return{evaluation:t,details:this.oe(null==t)}}oe(t){return"Uninitialized"===this.ee||"NoValues"===this.ee?{reason:this.ee}:{reason:this.ee+":"+(t?"Unrecognized":"Recognized"),lcut:this.ne,receivedAt:this.ie}}}},9400: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(4464),u=n(3096);class i extends r.NetworkCore{constructor(t,e){super(t,e);e=null==t?void 0:t.networkConfig;this.re=(0,r.tt)(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.ue(n,t,e)})}ue(e,n,i){var s;return o(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.re,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.ue(e,n,$P($P($P({},i),t),{deltasResponseRequested:!1}))})}}e.default=i},4520: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);const r=n(4464),s=n(1536),o=n(9400),u=n(5364);class l extends r.StatsigClientBase{constructor(t,e,n=null){r.SDKType.It(t,"javascript-client");var i=new o.default(n,t=>{this.St(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new u.StatsigEvaluationsDataAdapter,i,n),(0,r.monitorClass)(this.l,this),(0,r.monitorClass)(this.l,i),this.le=new s.default,this.ae=e}static instance(t){var e,n=(0,r.i)();return t?null==(e=n.instances)?void 0:e[t]:n.lastInstance}initializeSync(){this.updateUserSync(this.ae)}initializeAsync(){return this.updateUserAsync(this.ae)}updateUserSync(t){this.ce(t);t=this.dataAdapter.getDataSync(this.ae);this.le.setValuesFromDataAdapter(t),this.le.finalize(),this.Lt("Ready",t),this.de(null!=t?t:null,this.ae)}updateUserAsync(n){return i(this,void 0,void 0,function*(){this.ce(n);var t=this.ae,e=this.dataAdapter.getDataSync(t);this.Lt("Loading",e),this.le.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,t),t===this.ae&&this.le.setValuesFromDataAdapter(e),this.le.finalize(),this.Lt("Ready",e)})}getContext(){return{sdkKey:this.h,options:this.J,values:this.le.getValues(),user:JSON.parse(JSON.stringify(this.ae))}}getAsyncContext(){return i(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.le.getGate(n),i=(0,r.$t)(t,i,n),s=null==(s=null==(n=this.Gt)?void 0:n.getGateOverride)?void 0:s.call(n,i,this.ae,e),n=null!=s?s:i;return this.Ut(t,(0,r.qt)(this.ae,n),e),this.St({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.he("dynamic_config",t,e);return this.St({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.he("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.le.getLayer(t),i=(0,r.zt)(e,i,t),s=null==(s=null==(t=this.Gt)?void 0:t.getLayerOverride)?void 0:s.call(t,i,this.ae,n);const o=(0,r.Vt)(i,s,null!=(t=null==s?void 0:s.__value)?t:i.__value,t=>{this.Ut(e,(0,r.Jt)(this.ae,o,t),n)});return this.St({name:"layer_evaluation",layer:o}),o}logEvent(t,e,n){this.Ft.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.ae,time:Date.now()}))}de(t,e){this.dataAdapter.getDataAsync(t,e).catch(t=>{r.Log.error("An error occurred after update.",t)})}ce(t){this.Ft.reset(),this.le.reset(),this.ae=(0,r.normalizeUser)(t,this.J.environment)}he(t,e,n){var i=(0,r.DJB2)(e),{evaluation:i,details:s}=this.le.getConfig(i),s=(0,r.Bt)(e,s,i),i="experiment"===t?null==(t=null==(i=this.Gt)?void 0:i.getExperimentOverride)?void 0:t.call(i,s,this.ae,n):null==(i=null==(t=this.Gt)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,s,this.ae,n),t=null!=i?i:s;return this.Ut(e,(0,r.Kt)(this.ae,t),n),t}}e.default=l},5364: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(4464));const o=n(9400);class r extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.U=null}attach(t,e){super.attach(t,e),this.U=new o.default(null!=e?e:{})}T(e,n){var i;return s(this,void 0,void 0,function*(){var t=yield null==(i=this.U)?void 0:i.fetchEvaluations(this.I(),e,n);return null!=t?t:null})}}e.StatsigEvaluationsDataAdapter=r},5208:(t,e,n)=>{$Q(e),e.StatsigClient=e.StatsigEvaluationsDataAdapter=void 0;var i=n(4520);e.StatsigClient=i.default;const s=n(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:i.default,instance:i.default.instance}),e.default=__STATSIG__},2152:(t,e,n)=>{$Q(e),e.SessionReplay=e.runStatsigSessionReplay=void 0;const i=n(4464),s=n(8264);e.runStatsigSessionReplay=function(t){new o(t)};class o{constructor(t){this.ve=t,this._e=null,this.fe=[],this.ge="";var t=t.getContext()["sdkKey"],e=(this.l=new i.ErrorBoundary(t),(0,i.monitorClass)(this.l,this),(0,i.i)());e.srInstances=$P($P({},e.srInstances),{[t]:this}),this.be=new s.SessionReplayClient,this.ve.__on("pre_shutdown",()=>this.me()),this.ve.__on("values_updated",()=>this.ye()),this.ve.__on("session_expired",()=>{this.be.stop(),i.StatsigMetadataProvider.add({isRecordingSession:"false"}),this.pe(this.ge),this.ve.getAsyncContext().then(t=>{this.ge=t.sessionID}).catch(t=>{i.Log.error(t)})}),(0,i.nt)(this.it.bind(this)),this.ve.getAsyncContext().then(t=>{this.ge=t.sessionID,this.ye()}).catch(t=>{i.Log.error(t)})}it(t){"background"===t&&(this.pe(this.ge),this.ve.flush().catch(t=>{i.Log.error(t)}))}Se(t,e){this._e=e,this.fe.push(t),2048<JSON.stringify(this.fe).length&&((0,i._t)()?this.Oe():this.pe(this.ge))}ye(){var t=this.ve.getContext().values;!0!==(null==t?void 0:t.can_record_session)?this.me():this.be.isRecording()||(i.StatsigMetadataProvider.add({isRecordingSession:"true"}),this.be.record((t,e)=>this.Se(t,e)))}me(){this.be.stop(),i.StatsigMetadataProvider.add({isRecordingSession:"false"}),0!==this.fe.length&&null!=this._e&&this.Oe()}pe(t){0!==this.fe.length&&null!=this._e&&this.je(t)}je(t){var e,n=this._e;null!==n&&0!==this.fe.length&&(e=JSON.stringify(this.fe),this.ve.logEvent({eventName:"statsig::session_recording",value:t,metadata:{session_start_ts:String(n.startTime),session_end_ts:String(n.endTime),clicks_captured_cumulative:String(n.clickCount),rrweb_events:e,session_replay_sdk_version:i.SDK_VERSION}}),this.fe=[])}Oe(){this.ve.getAsyncContext().then(t=>{this.je(t.sessionID)}).catch(t=>{i.Log.error(t)})}}e.SessionReplay=o},8264:(t,e,n)=>{$Q(e),e.SessionReplayClient=void 0;const i=n(8352);e.SessionReplayClient=class{constructor(){this.Te=null,this.we=null,this.Ie=0}record(n,t){"undefined"==typeof window||(this.Te=null,this.we=null,this.Ie=0,this.Ae=t,this.xe)||(this.xe=(t=t=>{var e;null==this.Te&&(this.Te=t.timestamp),this.we=t.timestamp,3!==(e=t).type||2!==e.data.source||2!==e.data.type&&4!==e.data.type||this.Ie++,n(t,{startTime:this.Te,endTime:this.we,clickCount:this.Ie}),144e5<this.we-this.Te&&(null!=(e=this.xe)&&e.call(this),this.Ae)&&this.Ae()},("function"==typeof i?i:i.record)({emit:t})))}stop(){this.xe&&(this.xe(),this.xe=void 0)}isRecording(){return null!=this.xe}}},8392:(t,e,n)=>{$Q(e),e.runStatsigSessionReplay=e.SessionReplay=e.SessionReplayClient=void 0;const i=n(2152),s=(Object.defineProperty(e,"SessionReplay",{enumerable:!0,get:function(){return i.SessionReplay}}),Object.defineProperty(e,"runStatsigSessionReplay",{enumerable:!0,get:function(){return i.runStatsigSessionReplay}}),n(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:i.SessionReplay,runStatsigSessionReplay:i.runStatsigSessionReplay})},5536:(t,e,n)=>{$Q(e),e.AutoCapture=e.runStatsigAutoCapture=void 0;const i=n(4464),s=n(3076);e.runStatsigAutoCapture=function(t){new o(t)};class o{constructor(t){var t=(this.ve=t,this.Me=Date.now(),this.De=0,t.getContext())["sdkKey"],e=(this.l=new i.ErrorBoundary(t),(0,i.monitorClass)(this.l,this),null!=(e=(__STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}).acInstances)?e:{}),t=(e[t]=this,__STATSIG__.acInstances=e,(0,i.Dt)());"loading"===(null==t?void 0:t.readyState)?t.addEventListener("DOMContentLoaded",()=>this.Ee()):this.Ee()}Ne(){const e=(0,i.Et)();var t,n=(0,i.Dt)();e&&n&&(t=t=>{this.ke(t||e.event)},(0,s.Pe)(n,"click",t),(0,s.Pe)(n,"submit",t),(0,s.Pe)(e,"error",t),(0,s.Pe)(e,"beforeunload",()=>this.Re()),(0,s.Pe)(e,"scroll",()=>this.Ce()))}ke(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.Ge(t):(e=(0,s.Fe)(t))&&(0,s.rt)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,s.Le)(e),this.Ue(n,t,e))}Ee(){this.Ne(),this.Je(),this.Ke()}Ge(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.Ue("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.qe)();this.Ve("page_view",(0,s.ze)(),{title:null==(t=(0,i.Dt)())?void 0:t.title,queryParams:Object.fromEntries(e.searchParams)})},1)}Ke(){const n=(0,i.Et)();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.Ue("performance",(0,s.ze)(),t)},1)}Re(){this.Ve("page_view_end",(0,s.ze)(),{scrollDepth:this.De,pageViewLength:Date.now()-this.Me})}Ue(t,e,n){e={eventName:"auto_capture::"+t,value:e,metadata:$P({sessionId:(0,s.Be)(this.ve.getContext().sdkKey),page_url:null!=(t=null==(e=null==(t=(0,i.Et)())?void 0:t.location)?void 0:e.href)?t:""},n)};this.ve.logEvent(e),i.Log.debug("Enqueued Event",e)}Ve(t,e,n){this.Ue(t,e,n),this.ve.flush().catch(t=>{i.Log.error(t)})}Ce(){var t=null!=(t=null==(t=(0,i.Dt)())?void 0:t.body.scrollHeight)?t:1,e=(0,i.Et)(),n=null!=(n=null==e?void 0:e.scrollY)?n:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.De=Math.max(this.De,Math.min(100,Math.round((n+e)/t*100)))}}e.AutoCapture=o},3076:(t,e,n)=>{$Q(e),e.Pe=e.ze=e.Be=e.qe=e.rt=e.Fe=e.Le=void 0;const s=n(4464),o={};function r(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.Le=function(t){var e=t.tagName.toLowerCase(),n={},i=e,s=("form"===e&&(n.action=t.getAttribute("action"),n.method=null!=(s=t.getAttribute("method"))?s:"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()),r(t));return s&&(n.href=s.getAttribute("href")),{value:i,metadata:n}},e.Fe=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(r(e))return!0}return!1}},e.qe=function(){var t=null!=(t=null==(t=null==(t=(0,s.Et)())?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(t){var e=function(t){var e=(0,s.Et)();if(e&&e.localStorage)return e.localStorage.getItem(t);return o[t]}(t="statsig.web_analytics.session."+(0,s.DJB2)(t)),n=Date.now();let i=e?(0,s.typedJsonParse)(e,"lastAccessedTime","Failed to parse WebSession"):null;return(i=!i||144e5<n-i.startTime||6e5<n-i.lastAccessedTime?(e=Date.now(),{id:(0,s.getUUID)(),startTime:e,lastAccessedTime:e}):i).lastAccessedTime=n,e=t,n=JSON.stringify(i),(t=(0,s.Et)())&&t.localStorage?t.localStorage.setItem(e,n):(o[e]=n,s.Log.error("AutoCapture: No window.localStorage")),i.id},e.ze=function(){var t;return(null==(t=null==(t=null==(t=(0,s.Et)())?void 0:t.location)?void 0:t.href)?void 0:t.split(/[?#]/)[0])||""},e.Pe=function(t,e,n){t&&t.addEventListener&&t.addEventListener(e,n,!0)}},6824:(t,e,n)=>{$Q(e),e.runStatsigAutoCapture=e.AutoCapture=void 0;const i=n(5536);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 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}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(4464),u=s(5208),l=s(8392),a=s(6824);var o=s(9920);e.default=__STATSIG__,o.AutoInit.attempt(({sdkKey:t})=>{var e=null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:e[t];let n=null;n=(n=e instanceof u.StatsigClient?e:n)||new u.StatsigClient(t,{userID:""}),new l.SessionReplay(n),new a.AutoCapture(n),n.initializeAsync().catch(t=>{r.Log.error(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 n={496:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});var e="undefined"!=typeof window?window:{},n=void 0!==n.g?n.g:{},i="undefined"!=typeof globalThis?globalThis:{},o=null!=(o=null!=(o=null!=(o=e.__STATSIG__)?o:n.__STATSIG__)?o:i.__STATSIG__)?o:{};e.__STATSIG__=o,n.__STATSIG__=o,i.__STATSIG__=o},856:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},320:function(t,e,n){var r=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.DataAdapterCore=void 0;const i=n(512),o=n(780),s=n(104),u=n(283),l=n(296),a=n(444),c=n(412);e.DataAdapterCore=class{constructor(t,e){this.i=t,this.o=e,this.u=null,this.l=null,this.h={},this.v="statsig.last_modified_time."+e}attach(t,e){this.l=t,this.u=new i.ErrorBoundary(t),(0,s.monitorClass)(this.u,this)}getDataSync(t){var t=this._(t),e=this.h[t];return e||((e=this.m(t))?(this.p(t,e),this.h[t]):null)}getDataAsync(n,i){var o;return r(this,void 0,void 0,function*(){var t=null!=n?n:this.getDataSync(i),t=yield this.S(null!=(o=null==t?void 0:t.data)?o:null,i),e=this._(i);return t&&this.p(e,t),"Network"!==(null==t?void 0:t.source)&&"NetworkNotModified"!==(null==t?void 0:t.source)||(yield this.O(e,t)),t})}prefetchData(n){return r(this,void 0,void 0,function*(){var t=this._(n),e=yield this.getDataAsync(null,n);e&&this.p(t,Object.assign(Object.assign({},e),{source:"Prefetch"}))})}setData(t,e){e=this._(e);this.p(e,{source:"Bootstrap",data:t,receivedAt:Date.now()})}__primeInMemoryCache(t){this.h=Object.assign(Object.assign({},this.h),t)}S(n,i){return r(this,void 0,void 0,function*(){var t,e=yield this.j(n,i);return e?(t=(0,c.typedJsonParse)(e,"has_updates","Failure while attempting to persist latest value"),n&&!1===(null==t?void 0:t.has_updates)?{source:"NetworkNotModified",data:n,receivedAt:Date.now()}:!0!==(null==t?void 0:t.has_updates)?null:{source:"Network",data:e,receivedAt:Date.now()}):(o.Log.debug("No response returned for latest value"),null)})}T(){return null!=this.l?this.l:(o.Log.error(this.i+" is not attached to a Client"),"")}_(t){t=(0,l.getUserStorageKey)(this.T(),t);return`${u.DataAdapterCachePrefix}.${this.o}.`+t}p(t,e){var n=Object.entries(this.h);n.length<10||([n]=n.reduce((t,e)=>e[1]<t[1]?e:t),delete this.h[n]),this.h[t]=e}m(t){var e=null==(e=a.Storage.getItemSync)?void 0:e.call(a.Storage,t);return null!=e&&(t=(0,c.typedJsonParse)(e,"source","Failed to parse cached result"))?Object.assign(Object.assign({},t),{source:"Cache"}):null}O(t,e){return r(this,void 0,void 0,function*(){yield a.Storage.setItem(t,JSON.stringify(e)),yield this.I(t)})}I(n){var i;return r(this,void 0,void 0,function*(){var t=null!=(i=yield(0,a.getObjectFromStorage)(this.v))?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 a.Storage.removeItem(e[0])),yield(0,a.setObjectInStorage)(this.v,t)})}}},280:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Diagnostics=e.captureDiagnostics=void 0;const i=n(780),o="undefined"!=typeof performance&&void 0!==performance.mark;let r=[];e.captureDiagnostics=function(t,e){s.mark(t+":start"),e=e();const n=()=>{s.mark(t+":end"),(t+":end").startsWith("initialize:")&&s.flush()};return e&&e instanceof Promise?e.finally(()=>n()):(n(),e)};class s{static mark(t,e){o&&(t=performance.mark(t,{detail:e}),r.push(t))}static flush(){var t=performance.getEntriesByType("resource").filter(t=>t.name.startsWith("https://api.statsig.com")),t={markers:r,resources:t};i.Log.debug("Diagnostics",t,JSON.stringify(t)),r=[]}}e.Diagnostics=s},512:function(t,u,e){var n=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};Object.defineProperty(u,"__esModule",{value:!0}),u.ErrorBoundary=u.EXCEPTION_ENDPOINT=void 0;const i=e(780),l=e(972);u.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";u.ErrorBoundary=class{constructor(t){this.l=t,this.A=new Set}capture(e,t,n){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.D(e,t,n)):i}catch(t){return this.D(e,t,n),null}}logError(t,e){this.D(t,e)}D(o,r,s){try{i.Log.warn("Caught error in "+o,{error:r});n(this,void 0,void 0,function*(){var t,e=null!=r?r:Error("[Statsig] Error was empty"),n=e instanceof Error,i=n?e.name:"No Name";this.A.has(i)||(this.A.add(i),t=l.StatsigMetadataProvider.get(),n=n?e.stack:function(t){try{return JSON.stringify(t)}catch(t){return"[Statsig] Failed to get string for error."}}(e),e=JSON.stringify(Object.assign({tag:o,exception:i,info:n},t)),yield fetch(u.EXCEPTION_ENDPOINT,{method:"POST",headers:{"STATSIG-API-KEY":this.l,"STATSIG-SDK-TYPE":String(t.sdkType),"STATSIG-SDK-VERSION":String(t.sdkVersion),"Content-Type":"application/json"},body:e}),null!=s&&s({name:"error",error:r}))}).then(()=>{}).catch(()=>{})}catch(t){}}}},500:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},788:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},728:function(t,e,n){var i=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.EventLogger=void 0;const o=n(832),r=n(780),s=n(876),u=n(444),l=n(412),a=n(84),c=n(408),d="https://api.statsig.com/v1";e.EventLogger=class{constructor(t,e,n,i){this.l=t,this.M=e,this.N=n,this.P=i,this.G=[],this.C={},this.F={},this.R=!1,this.L=Date.now(),this.U=!0===(null==i?void 0:i.disableLogging),this.J=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;n=null!=(e=null==i?void 0:i.loggingIntervalMs)?e:1e4;this.K=setInterval(()=>this.V(),n),this.q=(0,a.$)(null==i?void 0:i.logEventUrl,null==i?void 0:i.api,"/rgstr",d),this.B=(0,a.$)(null==i?void 0:i.logEventBeaconUrl,null==i?void 0:i.api,"/log_event_beacon",d),c.VisibilityChangeObserver.add(this),this.H()}setLoggingDisabled(t){this.U=t}enqueue(t){this.W(t)&&(this.Y(t),this.X(),this.G.length>this.J)&&this.V()}incrementNonExposureCount(t){var e=null!=(e=this.F[t])?e:0;this.F[t]=e+1}reset(){this.C={}}onVisibilityChanged(t){"background"===t&&this.V()}shutdown(){return i(this,void 0,void 0,function*(){this.K&&(clearInterval(this.K),this.K=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.Z(),0!==this.G.length&&(t=this.G,this.G=[],yield this.tt(t))})}X(){this.R||(this.R=!0,200<Date.now()-this.L)||setTimeout(()=>this.V(),200)}W(t){if((0,s.isExposureEvent)(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.C[t],n=Date.now();if(e&&n-e<6e4)return!1;1e3<Object.keys(this.C).length&&(this.C={}),this.C[t]=n}return!0}V(){this.flush().catch(()=>{})}tt(t){return i(this,void 0,void 0,function*(){if(this.U)this.et(t);else try{(!c.VisibilityChangeObserver.isCurrentlyVisible()&&this.N.isBeaconSupported()?yield this.nt(t):yield this.it(t)).success?this.M({name:"logs_flushed",events:t}):this.et(t)}catch(t){r.Log.warn("Failed to flush events.")}})}it(e){return i(this,void 0,void 0,function*(){var t=yield this.N.post({sdkKey:this.l,data:{events:e},url:this.q,retries:3,params:{ec:String(e.length)}}),t=null!=t&&t.body?(0,l.typedJsonParse)(t.body,"success","Failed to parse SendEventsResponse"):null;return{success:!0===(null==t?void 0:t.success)}})}nt(t){return i(this,void 0,void 0,function*(){return{success:yield this.N.beacon({sdkKey:this.l,data:{events:t},url:this.B})}})}et(t){for(;500<t.length;)t.shift();var e=this.ot();(0,u.setObjectInStorage)(e,t).catch(()=>{r.Log.warn("Unable to save failed logs to storage")})}H(){const e=this.ot();i(this,void 0,void 0,function*(){var t=yield(0,u.getObjectFromStorage)(e);t&&(yield u.Storage.removeItem(e),yield this.tt(t))}).catch(()=>{r.Log.warn("Failed to flush stored logs")})}ot(){return"statsig.failed_logs."+(0,o.DJB2)(this.l)}Y(t){t.user&&(t.user=Object.assign({},t.user),delete t.user.privateAttributes);var e={},n=this.rt();n&&(e.statsigMetadata={currentPage:n}),this.G.push(Object.assign(Object.assign({},t),e))}Z(){0!==Object.keys(this.F).length&&(this.Y({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:Object.assign({},this.F)}}),this.F={})}rt(){var t;if(!1!==(null==(t=this.P)?void 0:t.includeCurrentPageUrlWithEvents)&&"undefined"!=typeof window&&"object"==typeof window.location)try{return window.location.href.split(/[?#]/)[0]}catch(t){}}}},832:(t,e)=>{function n(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)}Object.defineProperty(e,"__esModule",{value:!0}),e.DJB2Object=e.DJB2=void 0,e.DJB2=n,e.DJB2Object=function(t){return n(JSON.stringify(function n(i){if(null==i)return null;const t=Object.keys(i).sort();const o={};t.forEach(t=>{let e=i[t];e instanceof Object&&(e=n(e)),o[t]=e});return o}(t)))}},664:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},780:(t,e)=>{function n(t){return t.unshift("[Statsig]"),t}var i,o;Object.defineProperty(e,"__esModule",{value:!0}),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 r{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=r).level=i.Error},104:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.monitorClass=void 0;const r=n(280),s=n(688);function c(t,e,n,i){var o=i instanceof s.StatsigClientBase?i.ut.bind(i):void 0;return t.capture(e,()=>(0,r.captureDiagnostics)(e,()=>n.apply(i)),o)}function d(t){return"object"==typeof t&&(t=Object.getPrototypeOf(t))&&"object"==typeof t?t:null}e.monitorClass=function(e,t){try{{var n=e;var i=t;var o;const r=i;for(const s of function(t){const e=new Set;let n=d(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)}(r))if("constructor"!==s){const u=r[s];r[s]=function(...t){return c(n,s,()=>u.apply(this,t),i)}}for(const l of function(t){const e=new Set,n=d(t);return Object.getOwnPropertyNames((null===n||void 0===n?void 0:n.constructor)||{}).filter(t=>{var e;return"caller"!==t&&"arguments"!==t&&"callee"!==t&&"function"==typeof(null==(e=null===n||void 0===n?void 0:n.constructor)?void 0:e[t])}).forEach(t=>e.add(t)),Array.from(e)}(r)){const a=null==(o=null===r||void 0===r?void 0:r.constructor)?void 0:o[l];(null===r||void 0===r?void 0:r.constructor)[l]=function(...t){return c(n,r.constructor.name+"."+l,()=>a.apply(r.constructor,t),i)}}return}}catch(t){e.logError("monitorClass",t)}}},188:function(t,e,n){var o=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.NetworkCore=void 0;const h=n(280),v=n(780),r=n(612),s=n(604),u=n(972);e.NetworkCore=class{constructor(t,e){this.P=t,this.M=e,this.lt=null!=(e=null==t?void 0:t.networkTimeoutMs)?e:1e4}post(e){return o(this,void 0,void 0,function*(){var t=yield this.ct(e);return this.dt(Object.assign({method:"POST",body:t},e))})}get(t){return o(this,void 0,void 0,function*(){return this.dt(Object.assign({method:"GET"},t))})}isBeaconSupported(){return"undefined"!=typeof navigator&&"function"==typeof(null===navigator||void 0===navigator?void 0:navigator.sendBeacon)}beacon(n){return o(this,void 0,void 0,function*(){var t=yield this.ht(n),e=yield this.ct(n);return navigator.sendBeacon(t,e)})}dt(c){var d;return o(this,void 0,void 0,function*(){var{method:e,body:n,retries:i}=c;const o=new AbortController;var t,r,s,u=setTimeout(()=>o.abort(`Timeout of ${this.lt}ms expired.`),this.lt),l=yield this.ht(c);let a=null;try{if(a=yield fetch(l,{method:e,body:n,headers:Object.assign({},c.headers),signal:o.signal}),clearTimeout(u),a.ok)return s=yield a.text(),h.Diagnostics.mark("_sendRequest:response-received",{status:a.status,contentLength:a.headers.get("content-length")}),{body:s,code:a.status};throw t=yield a.text().catch(()=>"No Text"),(r=new Error(`Failed to fetch: ${l} `+t)).name="NetworkError",r}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("_sendRequest:error",{error:n,status:null===a||void 0===a?void 0:a.status,contentLength:null===a||void 0===a?void 0:a.headers.get("content-length")}),!i||i<=0?(null!=(d=this.M)&&d.call(this,{name:"error",error:t}),v.Log.error(`A networking error occured during ${e} request to ${l}.`,n,t),null):this.dt(Object.assign(Object.assign({},c),{retries:i-1}))}})}ht(e){return o(this,void 0,void 0,function*(){var t=u.StatsigMetadataProvider.get(),t=Object.assign({k:e.sdkKey,st:t.sdkType,sv:t.sdkVersion,t:String(Date.now()),sid: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:"")})}ct(i){return o(this,void 0,void 0,function*(){var t=i["data"],e=yield s.StableID.get(i.sdkKey),n=yield r.SessionID.get(i.sdkKey);return JSON.stringify(Object.assign(Object.assign({},t),{statsigMetadata:Object.assign(Object.assign({},u.StatsigMetadataProvider.get()),{stableID:e,sessionID:n})}))})}}},264:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CombinationOverrideAdapter=void 0;e.CombinationOverrideAdapter=class{constructor(t){this.providers=t}getGateOverride(n,i){return this.vt(t=>{var e;return null!=(e=null==(e=t.getGateOverride)?void 0:e.call(t,n,i))?e:null})}getDynamicConfigOverride(n,i){return this.vt(t=>{var e;return null!=(e=null==(e=t.getDynamicConfigOverride)?void 0:e.call(t,n,i))?e:null})}vt(t){for(const n of this.providers){var e=t(n);if(e)return e}return null}}},612:function(t,s,e){var n=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};Object.defineProperty(s,"__esModule",{value:!0}),s.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)}s.SessionID={get:t=>n(void 0,void 0,void 0,function*(){return null!=h[t]?h[t]:h[t]=s.SessionID.ft(t)}),ft:r=>n(void 0,void 0,void 0,function*(){let e=c[r];var n=Date.now();if(null==e){let t=yield function(t){t=v(t);return(0,l.getObjectFromStorage)(t)}(r);null==t&&(t={sessionID:(0,a.getUUID)(),startTime:n,lastUpdate:n}),e=t,c[r]=e}var t=null!=(t=d[r])?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=r;return o=v(r),(0,l.setObjectInStorage)(o,i).catch(()=>{u.Log.warn("Failed to save SessionID")}),t.idleTimeoutID=s.SessionID._t(t,t.idleTimeoutID,18e5),t.ageTimeoutID=s.SessionID._t(t,t.ageTimeoutID,144e5-(n-e.startTime)),c[r]=e,d[r]=t,h[r]=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},_t:(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,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.StableID=void 0;const o=n(832),r=n(780),s=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,s.setObjectInStorage)(e,t).catch(()=>{r.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,s.getObjectFromStorage)(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,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigClientBase=void 0,n(496);const r=n(512),s=n(728),u=n(780),l=n(612),a=n(604),c=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.yt={},this.l=t,this.P=null!=i?i:{},null!=i&&i.disableStorage&&c.Storage.setDisabled(!0),null!=i&&i.overrideStableID&&a.StableID.setOverride(i.overrideStableID,t),u.Log.level=null!=(o=null==i?void 0:i.logLevel)?o:u.LogLevel.Warn,this.bt=null!=(o=null==i?void 0:i.overrideAdapter)?o:null,this.wt=new s.EventLogger(t,this.ut.bind(this),n,i),l.SessionID.gt(()=>{this.ut({name:"session_expired"})},t),this.u=new r.ErrorBoundary(t);var o,n=null!=(o=(__STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}).instances)?o:{};n[t]=this,__STATSIG__.instances=n,(__STATSIG__.lastInstance=this).dataAdapter=e,this.dataAdapter.attach(t,i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.P.disableLogging=t.disableLogging,this.wt.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.P.disableStorage=t.disableStorage,c.Storage.setDisabled(t.disableStorage))}flush(){return this.wt.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.ut({name:"pre_shutdown"}),yield this.wt.shutdown()})}on(t,e){this.yt[t]||(this.yt[t]=[]),this.yt[t].push(e)}off(t,e){this.yt[t]&&-1!==(e=this.yt[t].indexOf(e))&&this.yt[t].splice(e,1)}__on(t,e){e.__isInternal=!0,this.on(t,e)}ut(n){var t;const e=e=>{try{e(n)}catch(t){!0===e.__isInternal?this.u.logError("_emit:"+n.name,t):u.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.yt[n.name]&&this.yt[n.name].forEach(t=>e(t)),null!=(t=this.yt["*"])&&t.forEach(e)}St(t,e){this.loadingStatus=t,this.ut({name:"values_updated",status:t,values:e})}Ot(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.wt.incrementNonExposureCount(t):this.wt.enqueue(e)}}},808:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},283:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.DataAdapterCachePrefix=void 0,e.DataAdapterCachePrefix="statsig.cached"},876:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createLayerParameterExposure=e.createConfigExposure=e.createGateExposure=e.isExposureEvent=void 0;const n="statsig::config_exposure",i="statsig::gate_exposure";function l(t,e,n,i,o){return{eventName:t,user:e,value:null,metadata:function(t,e){e.reason=t.reason,t.lcut&&(e.lcut=String(t.lcut));t.receivedAt&&(e.receivedAt=String(t.receivedAt));return e}(n,i),secondaryExposures:o,time:Date.now()}}e.isExposureEvent=function({eventName:t}){return t===i||t===n},e.createGateExposure=function(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.createConfigExposure=function(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.createLayerParameterExposure=function(t,e,n){var i,o=e.__evaluation,r=!0===(null==(r=null==o?void 0:o.explicit_parameters)?void 0:r.includes(n));let s="",u=null!=(i=null==o?void 0:o.undelegated_secondary_exposures)?i:[];return r&&(s=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:s,isExplicitParameter:String(r)},u)}},972:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigMetadataProvider=e.SDK_VERSION=void 0,e.SDK_VERSION="0.0.1-beta.28";let n={sdkVersion:e.SDK_VERSION,sdkType:"js-mono"};e.StatsigMetadataProvider={get:()=>n,add:t=>{n=Object.assign(Object.assign({},n),t)}}},384:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},396:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.jt=e.Tt=e.It=e.At=void 0;const o="default";function r(r,s){return(t,e)=>{var n,i,o=null!=(o=null==r?void 0:r[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!=s&&s(t),o)}}e.At=function(t,e,n){return{name:t,details:e,ruleID:null!=(t=null==n?void 0:n.rule_id)?t:o,value:!0===(null==n?void 0:n.value),__evaluation:n}},e.It=function(t,e,n){return{name:t,details:e,value:null!=(t=null==n?void 0:n.value)?t:{},ruleID:null!=(e=null==n?void 0:n.rule_id)?e:o,groupName:null,get:r(null==n?void 0:n.value),__evaluation:n}},e.Tt=function(t,e,n,i){return{name:t,details:e,get:r(null==n?void 0:n.value,i),ruleID:null!=(t=null==n?void 0:n.rule_id)?t:o,groupName:null!=(e=null==n?void 0:n.group_name)?e:null,__value:null!=(i=null==n?void 0:n.value)?i:{},__evaluation:n}},e.jt=function(t,e,n,i){return Object.assign(Object.assign(Object.assign({},t),e),{get:r(n,i)})}},136:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},296:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),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,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})},n=(Object.defineProperty(e,"__esModule",{value:!0}),e.setObjectInStorage=e.getObjectFromStorage=e.Storage=void 0,n(780));const o={},r={getProviderName:()=>"InMemory",getItemSync(t){return null!=(t=o[t])?t:null},getItem(t){return Promise.resolve(null!=(t=o[t])?t:null)},setItem(t,e){return o[t]=e,Promise.resolve()},removeItem(t){return delete o[t],Promise.resolve()},getAllKeys(){return Promise.resolve(Object.keys(o))}};let s=null;try{"undefined"!=typeof window&&"localStorage"in window&&(s={getProviderName:()=>"LocalStorage",getItemSync(t){return localStorage.getItem(t)},getItem(t){return Promise.resolve(localStorage.getItem(t))},setItem(t,e){return localStorage.setItem(t,e),Promise.resolve()},removeItem(t){return localStorage.removeItem(t),Promise.resolve()},getAllKeys(){var t=Object.keys(localStorage);return Promise.resolve(t)}})}catch(t){n.Log.warn("Failed to setup localStorageProvider.")}let u=null!==s&&void 0!==s?s:r,l=u;e.Storage={getProviderName:()=>l.getProviderName(),getItem:t=>l.getItem(t),setItem:(t,e)=>l.setItem(t,e),removeItem:t=>l.removeItem(t),getAllKeys:()=>l.getAllKeys(),getItemSync:t=>{var e;return null!=(e=null==(e=l.getItemSync)?void 0:e.call(l,t))?e:null},setProvider:t=>{u=t,l=t},setDisabled:t=>{l=t?r:u}},e.getObjectFromStorage=function(e){return i(this,void 0,void 0,function*(){var t=yield l.getItem(e);return JSON.parse(null!=t?t:"null")})},e.setObjectInStorage=function(t,e){return i(this,void 0,void 0,function*(){yield l.setItem(t,JSON.stringify(e))})}},412:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),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)=>{Object.defineProperty(e,"__esModule",{value:!0}),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)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.$=void 0,e.$=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0})},408:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VisibilityChangeObserver=void 0;class n{static isCurrentlyVisible(){return"foreground"===this.xt}static add(t){this.yt.unshift(t)}static remove(t){t=this.yt.indexOf(t);-1!==t&&this.yt.splice(t,1)}static notify(e){e!==this.xt&&(this.xt=e,this.yt.forEach(t=>t.onVisibilityChanged(e)))}}(e.VisibilityChangeObserver=n).yt=[],n.xt="foreground","undefined"!=typeof window&&"function"==typeof window.addEventListener&&(window.addEventListener("focus",()=>n.notify("foreground")),window.addEventListener("blur",()=>n.notify("background")),window.addEventListener("beforeunload",()=>n.notify("background"))),"undefined"!=typeof document&&"function"==typeof document.addEventListener&&document.addEventListener("visibilitychange",()=>{n.notify("visible"===document.visibilityState?"foreground":"background")})},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)};Object.defineProperty(e,"__esModule",{value:!0}),e.Log=e.Storage=e.EventLogger=void 0,n(496);const r=n(728),s=(Object.defineProperty(e,"EventLogger",{enumerable:!0,get:function(){return r.EventLogger}}),n(780));Object.defineProperty(e,"Log",{enumerable:!0,get:function(){return s.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(512),e),o(n(500),e),o(n(788),e),o(n(832),e),o(n(664),e),o(n(780),e),o(n(104),e),o(n(188),e),o(n(264),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(408),e),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{EventLogger:r.EventLogger,Log:s.Log,getUUID:a.getUUID,Storage:l.Storage,SDK_VERSION:u.SDK_VERSION})},920:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AutoInit=void 0;const s=n(464);e.AutoInit=class{static attempt(e){var n;if("undefined"!=typeof window&&"undefined"!=typeof document&&document.currentScript){var i=document.currentScript.getAttribute("src"),o=null==(o=null===window||void 0===window?void 0:window.location)?void 0:o.href;if(i&&o){let t=null;try{var r=new URL(i,o).searchParams;t=null!=(n=r.get("sdkkey"))?n:r.get("sdkKey")}catch(t){s.Log.error("Invalid source URL")}t&&e({sdkKey:t})}}}}},96:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),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=Object.assign(Object.assign(Object.assign({},t),n),{feature_gates:Object.assign(Object.assign({},t.feature_gates),n.feature_gates),layer_configs:Object.assign(Object.assign({},t.layer_configs),n.layer_configs),dynamic_configs:Object.assign(Object.assign({},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}}},536:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});const i=n(464);e.default=class{constructor(){this.Dt=null,this.Mt=null,this.Et="Uninitialized",this.Nt=0,this.Pt=0}getValues(){return this.Dt?(0,i.typedJsonParse)(this.Dt,"has_updates","Failed to parse EvaluationStoreValues"):null}reset(){this.Mt=null,this.Dt=null,this.Et="Loading",this.Nt=0,this.Pt=0}finalize(){this.Mt||(this.Et="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.Dt=t.data,this.Nt=e.time,this.Pt=t.receivedAt,this.Et=t.source,this.Mt=e)}getGate(t){var e,t=null!=(e=null==(e=this.Mt)?void 0:e.feature_gates[t])?e:null;return this.Gt(t)}getConfig(t){var e,t=null!=(e=null==(e=this.Mt)?void 0:e.dynamic_configs[t])?e:null;return this.Gt(t)}getLayer(t){var e,t=null!=(e=null==(e=this.Mt)?void 0:e.layer_configs[t])?e:null;return this.Gt(t)}Gt(t){return{evaluation:t,details:this.kt(null==t)}}kt(t){return"Uninitialized"===this.Et||"NoValues"===this.Et?{reason:this.Et}:{reason:this.Et+":"+(t?"Unrecognized":"Recognized"),lcut:this.Nt,receivedAt:this.Pt}}}},400:function(t,e,n){var r=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const s=n(464),u=n(96);class i extends s.NetworkCore{constructor(t,e){super(t,e),this.Ct=(0,s.$)(null==t?void 0:t.initializeUrl,null==t?void 0:t.api,"/initialize","https://api.statsig.com/v1")}fetchEvaluations(n,i,o){return r(this,void 0,void 0,function*(){var t=i?(0,s.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=Object.assign(Object.assign({},e),{sinceTime:t.time,previousDerivedFields:"derived_fields"in t?t.derived_fields:{},deltasResponseRequested:!0})),this.Ft(n,t,e)})}Ft(e,n,i){var o;return r(this,void 0,void 0,function*(){var t=yield this.post({sdkKey:e,url:this.Ct,data:i,retries:2});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.Ft(e,n,Object.assign(Object.assign(Object.assign({},i),t),{deltasResponseRequested:!1}))})}}e.default=i},520:function(t,e,n){var i=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})};Object.defineProperty(e,"__esModule",{value:!0});const s=n(464),o=n(536),r=n(400),u=n(364);n(807);class l extends s.StatsigClientBase{constructor(t,e,n=null){var i=new r.default(n,t=>{this.ut(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new u.StatsigEvaluationsDataAdapter,i,n),(0,s.monitorClass)(this.u,this),(0,s.monitorClass)(this.u,i),this.Rt=new o.default,this.Lt=e}static instance(t){var e;return __STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{},null==t?__STATSIG__.lastInstance:null==(e=__STATSIG__.instances)?void 0:e[t]}initializeSync(){this.updateUserSync(this.Lt)}initializeAsync(){return this.updateUserAsync(this.Lt)}updateUserSync(t){this.Ut(t);t=this.dataAdapter.getDataSync(this.Lt);this.Rt.setValuesFromDataAdapter(t),this.Rt.finalize(),this.St("Ready",t),this.Jt(null!=t?t:null,this.Lt)}updateUserAsync(n){return i(this,void 0,void 0,function*(){this.Ut(n);var t=this.Lt,e=this.dataAdapter.getDataSync(t);this.St("Loading",e),this.Rt.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,t),t===this.Lt&&this.Rt.setValuesFromDataAdapter(e),this.Rt.finalize(),this.St("Ready",e)})}getContext(){return{sdkKey:this.l,options:this.P,values:this.Rt.getValues(),user:JSON.parse(JSON.stringify(this.Lt))}}getAsyncContext(){return i(this,void 0,void 0,function*(){return Object.assign(Object.assign({},this.getContext()),{sessionID:yield s.SessionID.get(this.l),stableID:yield s.StableID.get(this.l)})})}checkGate(t,e){return this.getFeatureGate(t,e).value}getFeatureGate(t,e){var n=(0,s.DJB2)(t),{evaluation:n,details:i}=this.Rt.getGate(n),i=(0,s.At)(t,i,n),o=null==(o=null==(n=this.bt)?void 0:n.getGateOverride)?void 0:o.call(n,i,this.Lt,e),n=null!=o?o:i;return this.Ot(t,(0,s.createGateExposure)(this.Lt,n),e),this.ut({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.Kt("dynamic_config",t,e);return this.ut({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.Kt("experiment",t,e);return this.ut({name:"experiment_evaluation",experiment:t}),t}getLayer(e,n){var t=(0,s.DJB2)(e),{evaluation:t,details:i}=this.Rt.getLayer(t),i=(0,s.Tt)(e,i,t),o=null==(o=null==(t=this.bt)?void 0:t.getLayerOverride)?void 0:o.call(t,i,this.Lt,n);const r=(0,s.jt)(i,o,null!=(t=null==o?void 0:o.__value)?t:i.__value,t=>{this.Ot(e,(0,s.createLayerParameterExposure)(this.Lt,r,t),n)});return this.ut({name:"layer_evaluation",layer:r}),r}logEvent(t,e,n){this.wt.enqueue(Object.assign(Object.assign({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.Lt,time:Date.now()}))}Jt(t,e){this.dataAdapter.getDataAsync(t,e).catch(t=>{s.Log.error("An error occurred after update.",t)})}Ut(t){this.wt.reset(),this.Rt.reset(),this.Lt=(0,s.normalizeUser)(t,this.P.environment)}Kt(t,e,n){var i=(0,s.DJB2)(e),{evaluation:i,details:o}=this.Rt.getConfig(i),o=(0,s.It)(e,o,i),i="experiment"===t?null==(t=null==(i=this.bt)?void 0:i.getExperimentOverride)?void 0:t.call(i,o,this.Lt,n):null==(i=null==(t=this.bt)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,o,this.Lt,n),t=null!=i?i:o;return this.Ot(e,(0,s.createConfigExposure)(this.Lt,t),n),t}}e.default=l},364:function(t,e,n){var o=this&&this.__awaiter||function(t,s,u,l){return new(u=u||Promise)(function(n,e){function i(t){try{r(l.next(t))}catch(t){e(t)}}function o(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof u?e:new u(function(t){t(e)})).then(i,o)}r((l=l.apply(t,s||[])).next())})},i=(Object.defineProperty(e,"__esModule",{value:!0}),e.StatsigEvaluationsDataAdapter=void 0,n(464));const r=n(400);class s extends i.DataAdapterCore{constructor(){super("EvaluationsDataAdapter","evaluations"),this.N=null}attach(t,e){super.attach(t,e),this.N=new r.default(null!=e?e:{})}j(e,n){var i;return o(this,void 0,void 0,function*(){var t=yield null==(i=this.N)?void 0:i.fetchEvaluations(this.T(),e,n);return null!=t?t:null})}}e.StatsigEvaluationsDataAdapter=s},807:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SDK_TYPE=void 0;n=n(464);e.SDK_TYPE="javascript-client",n.StatsigMetadataProvider.add({sdkType:e.SDK_TYPE})},208:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),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}}),n(807),__STATSIG__=Object.assign(Object.assign({},null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}),{StatsigEvaluationsDataAdapter:o.StatsigEvaluationsDataAdapter,StatsigClient:i.default,instance:i.default.instance}),e.default=__STATSIG__},156:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AutoCapture=e.runStatsigAutoCapture=void 0;const i=n(464),o=n(76);e.runStatsigAutoCapture=function(t){new r(t)};class r{constructor(t){var t=(this.Vt=t,this.qt=Date.now(),this.zt=0,t.getContext())["sdkKey"],e=null!=(e=(__STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}).acInstances)?e:{};e[t]=this,__STATSIG__.acInstances=e,"undefined"!=typeof document&&"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>this.$t()):this.$t()}Bt(){var t;"undefined"!=typeof window&&"undefined"!=typeof document&&(t=t=>{this.Ht(t||window.event)},(0,o.registerEventHandler)(document,"click",t),(0,o.registerEventHandler)(document,"submit",t),(0,o.registerEventHandler)(window,"error",t),(0,o.registerEventHandler)(window,"beforeunload",()=>this.Wt()),(0,o.registerEventHandler)(window,"scroll",()=>this.Yt()))}Ht(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.Qt(t):(e=(0,o.getTargetNode)(t))&&(0,o.shouldLogEvent)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,o.gatherEventData)(e),this.Xt(n,t,e))}$t(){this.Bt(),this.Zt(),this.te()}Qt(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.Xt("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}Zt(){setTimeout(()=>{var t=(0,o.getSafeUrl)();this.ee("page_view",(0,o.getSanitizedPageUrl)(),{title:null===document||void 0===document?void 0:document.title,queryParams:Object.fromEntries(t.searchParams)})},1)}te(){"undefined"!=typeof window&&void 0!==window.performance&&"function"==typeof window.performance.getEntriesByType&&"function"==typeof window.performance.getEntriesByName&&setTimeout(()=>{var t={},e=window.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),window.performance.getEntriesByName("first-contentful-paint"));e&&0<e.length&&e[0]instanceof PerformancePaintTiming&&(t.first_contentful_paint_time_ms=e[0].startTime),this.Xt("performance",(0,o.getSanitizedPageUrl)(),t)},1)}Wt(){this.ee("page_view_end",(0,o.getSanitizedPageUrl)(),{scrollDepth:this.zt,pageViewLength:Date.now()-this.qt})}Xt(t,e,n){e={eventName:"auto_capture::"+t,value:e,metadata:Object.assign({sessionId:(0,o.getWebSessionId)(this.Vt.getContext().sdkKey),page_url:(null==(t=null===window||void 0===window?void 0:window.location)?void 0:t.href)||""},n)};this.Vt.logEvent(e),i.Log.debug("Enqueued Event",e)}ee(t,e,n){this.Xt(t,e,n),this.Vt.flush().catch(t=>{i.Log.error(t)})}Yt(){var t=document.body.scrollHeight||1;this.zt=Math.max(this.zt,Math.min(100,Math.round((window.scrollY+window.innerHeight)/t*100)))}}e.AutoCapture=r},76:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.registerEventHandler=e.getSanitizedPageUrl=e.getWebSessionId=e.getSafeUrl=e.shouldLogEvent=e.getTargetNode=e.gatherEventData=void 0;const o=n(464),r={};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.gatherEventData=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.getTargetNode=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.shouldLogEvent=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.getSafeUrl=function(){var t=(null==(t=null===window||void 0===window?void 0:window.location)?void 0:t.href)||"";let e;try{e=new URL(t)}catch(t){e=new URL("error:")}return e},e.getWebSessionId=function(t){var e=function(t){if(window&&window.localStorage)return window.localStorage.getItem(t);return r[t]}(t="statsig.web_analytics.session."+(0,o.DJB2)(t)),n=Date.now();let i=e?(0,o.typedJsonParse)(e,"lastAccessedTime","Failed to parse WebSession"):null;return(i=!i||144e5<n-i.startTime||6e5<n-i.lastAccessedTime?(e=Date.now(),{id:(0,o.getUUID)(),startTime:e,lastAccessedTime:e}):i).lastAccessedTime=n,e=t,n=JSON.stringify(i),window&&window.localStorage?window.localStorage.setItem(e,n):(r[e]=n,o.Log.error("Statsig Web AutoCapture: No window.localStorage")),i.id},e.getSanitizedPageUrl=function(){var t;return(null==(t=null==(t=null===window||void 0===window?void 0:window.location)?void 0:t.href)?void 0:t.split(/[?#]/)[0])||""},e.registerEventHandler=function(t,e,n){t&&t.addEventListener&&t.addEventListener(e,n,!0)}},824:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.runStatsigAutoCapture=e.AutoCapture=void 0;const i=n(156);Object.defineProperty(e,"AutoCapture",{enumerable:!0,get:function(){return i.AutoCapture}}),Object.defineProperty(e,"runStatsigAutoCapture",{enumerable:!0,get:function(){return i.runStatsigAutoCapture}}),__STATSIG__=Object.assign(Object.assign({},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 s=o(464),u=o(208),l=o(824);var r=o(920);e.default=__STATSIG__,r.AutoInit.attempt(({sdkKey:t})=>{var e=null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:e[t];let n=null;n=(n=e instanceof u.StatsigClient?e:n)||new u.StatsigClient(t,{userID:""}),new l.AutoCapture(n),n.initializeAsync().catch(t=>{s.Log.error(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.i=void 0;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:{};s[o]=u,n[o]=u,r[o]=u;e.i=()=>null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__: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),o=n(780),r=n(104),u=n(283),l=n(296),a=n(444),c=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),(0,r.monitorClass)(this.l,this)}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)}getDataAsync(n,i){var o;return s(this,void 0,void 0,function*(){var t=null!=n?n:this.getDataSync(i),t=yield this.O(null!=(o=null==t?void 0:t.data)?o:null,i),e=this.m(i);return t&&this.S(e,t),"Network"!==(null==t?void 0:t.source)&&"NetworkNotModified"!==(null==t?void 0:t.source)||(yield this.j(e,t)),t})}prefetchData(n){return s(this,void 0,void 0,function*(){var t=this.m(n),e=yield this.getDataAsync(null,n);e&&this.S(t,$P($P({},e),{source:"Prefetch"}))})}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(n,i){return s(this,void 0,void 0,function*(){var t,e=yield this.T(n,i);return e?(t=(0,c.typedJsonParse)(e,"has_updates","Failure while attempting to persist latest value"),n&&!1===(null==t?void 0:t.has_updates)?{source:"NetworkNotModified",data:n,receivedAt:Date.now()}:!0!==(null==t?void 0:t.has_updates)?null:{source:"Network",data:e,receivedAt:Date.now()}):(o.Log.debug("No response returned for latest value"),null)})}I(){return null!=this.h?this.h:(o.Log.error(this.o+" is not attached to a Client"),"")}m(t){t=(0,l.getUserStorageKey)(this.I(),t);return`${u.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=a.Storage.A)?void 0:e.call(a.Storage,t);return null!=e&&(t=(0,c.typedJsonParse)(e,"source","Failed to parse cached result"))?$P($P({},t),{source:"Cache"}):null}j(t,e){return s(this,void 0,void 0,function*(){yield a.Storage.M(t,JSON.stringify(e)),yield this.D(t)})}D(n){var i;return s(this,void 0,void 0,function*(){var t=null!=(i=yield(0,a.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 a.Storage.P(e[0])),yield(0,a.R)(this._,t)})}}},280:(t,e,n)=>{$Q(e),e.Diagnostics=e.captureDiagnostics=void 0;const i=n(780),o=n(256),s="undefined"!=typeof performance&&void 0!==performance.mark;let r=[];e.captureDiagnostics=function(t,e){u.mark(t+":start"),e=e();const n=()=>{u.mark(t+":end"),(t+":end").startsWith("initialize:")&&u.flush()};return e&&e instanceof Promise?e.finally(()=>n()):(n(),e)};class u{static mark(t,e){s&&(t=performance.mark(t,{detail:e}),r.push(t))}static flush(){var t=performance.getEntriesByType("resource").filter(t=>t.name.startsWith(o.NetworkDefault.initializeApi)||t.name.startsWith(o.NetworkDefault.specsApi)||t.name.startsWith(o.NetworkDefault.eventsApi)),t={markers:r,resources:t};i.Log.debug("Diagnostics",t,JSON.stringify(t)),r=[]}}e.Diagnostics=u},184:(t,e)=>{$Q(e)},512:function(t,l,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(l,"__esModule",{value:!0}),l.ErrorBoundary=l.EXCEPTION_ENDPOINT=void 0;const i=e(780),a=e(360),c=e(972);l.EXCEPTION_ENDPOINT="https://statsigapi.net/v1/sdk_exception";l.ErrorBoundary=class{constructor(t){this.h=t,this.C=new Set}capture(e,t,n){try{var i=t();return i&&i instanceof Promise?i.catch(t=>this.G(e,t,n)):i}catch(t){return this.G(e,t,n),null}}logError(t,e){this.G(t,e)}G(s,r,u){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.C.has(o)||(this.C.add(o),t=a.SDKType.F(this.h),e=c.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(l.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!=u&&u({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(876),a=n(444),c=n(412),d=n(84),h=n(100);e.EventLogger=class{constructor(t,e,n,i){this.h=t,this.L=e,this.U=n,this.J=i,this.K=[],this.q={},this.V={},this.B=!1,this.$=Date.now(),this.H=!0===(null==i?void 0:i.disableLogging),this.W=null!=(t=null==i?void 0:i.loggingBufferMaxSize)?t:50;n=null!=(e=null==i?void 0:i.loggingIntervalMs)?e:1e4,this.Y=setInterval(()=>this.X(),n),t=null==i?void 0:i.networkConfig;this.Z=(0,d.tt)(null==t?void 0:t.logEventUrl,null==t?void 0:t.api,"/rgstr",r.NetworkDefault.eventsApi),this.et=(0,d.tt)(null==t?void 0:t.logEventBeaconUrl,null==t?void 0:t.api,"/log_event_beacon",r.NetworkDefault.eventsApi),(0,h.nt)(this.it.bind(this)),this.ot()}setLoggingDisabled(t){this.H=t}enqueue(t){this.rt(t)&&(this.ut(t),this.lt(),this.K.length>this.W)&&this.X()}incrementNonExposureCount(t){var e=null!=(e=this.V[t])?e:0;this.V[t]=e+1}reset(){this.q={}}shutdown(){return i(this,void 0,void 0,function*(){this.Y&&(clearInterval(this.Y),this.Y=null),yield this.flush()})}flush(){return i(this,void 0,void 0,function*(){var t;this.ct(),0!==this.K.length&&(t=this.K,this.K=[],yield this.dt(t))})}it(t){"background"===t&&this.X()}lt(){this.B||(this.B=!0,200<Date.now()-this.$)||setTimeout(()=>this.X(),200)}rt(t){if((0,l.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}X(){this.flush().catch(()=>{})}dt(t){return i(this,void 0,void 0,function*(){if(this.H)this.vt(t);else try{(!(0,h._t)()&&this.U.isBeaconSupported()?yield this.ft(t):yield this.gt(t)).success?this.L({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.U.post({sdkKey:this.h,data:{events:e},url:this.Z,retries:3,params:{[u.NetworkParam.EventCount]:String(e.length)}}),t=null!=t&&t.body?(0,c.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.U.beacon({sdkKey:this.h,data:{events:t},url:this.et})}})}vt(t){for(;500<t.length;)t.shift();var e=this.bt();(0,a.R)(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,a.N)(e);t&&(yield a.Storage.P(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.K.push($P($P({},t),e))}ct(){0!==Object.keys(this.V).length&&(this.ut({eventName:"statsig::non_exposed_checks",user:null,time:Date.now(),metadata:{checks:$P({},this.V)}}),this.V={})}yt(){var t;if(!1!==(null==(t=this.J)?void 0:t.includeCurrentPageUrlWithEvents)&&"undefined"!=typeof window&&"object"==typeof window.location)try{return window.location.href.split(/[?#]/)[0]}catch(t){}}}},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},104:(t,e,n)=>{$Q(e),e.monitorClass=void 0;const s=n(280),r=n(688);function c(t,e,n,i){var o=i instanceof r.StatsigClientBase?i.St.bind(i):void 0;return t.capture(e,()=>(0,s.captureDiagnostics)(e,()=>n.apply(i)),o)}function d(t){return"object"==typeof t&&(t=Object.getPrototypeOf(t))&&"object"==typeof t?t:null}e.monitorClass=function(e,t){try{{var n=e;var i=t;var o;const s=i;for(const r of function(t){const e=new Set;let n=d(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)}(s))if("constructor"!==r){const u=s[r];s[r]=function(...t){return c(n,r,()=>u.apply(this,t),i)}}for(const l of function(t){const e=new Set,n=d(t);return Object.getOwnPropertyNames((null===n||void 0===n?void 0:n.constructor)||{}).filter(t=>{var e;return"caller"!==t&&"arguments"!==t&&"callee"!==t&&"function"==typeof(null==(e=null===n||void 0===n?void 0:n.constructor)?void 0:e[t])}).forEach(t=>e.add(t)),Array.from(e)}(s)){const a=null==(o=null===s||void 0===s?void 0:s.constructor)?void 0:o[l];(null===s||void 0===s?void 0:s.constructor)[l]=function(...t){return c(n,s.constructor.name+"."+l,()=>a.apply(s.constructor,t),i)}}return}}catch(t){e.logError("monitorClass",t)}}},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.L=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.t(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=yield this.wt(n),e=yield this.jt(n);return navigator.sendBeacon(t,e)})}Tt(c){var d;return i(this,void 0,void 0,function*(){var{method:e,body:n,retries:i}=c;const o=new AbortController;var t,s,r,u=setTimeout(()=>o.abort(`Timeout of ${this.Ot}ms expired.`),this.Ot),l=yield this.wt(c);let a=null;try{if(a=yield fetch(l,{method:e,body:n,headers:$P({},c.headers),signal:o.signal}),clearTimeout(u),a.ok)return r=yield a.text(),h.Diagnostics.mark("_sendRequest:response-received",{status:a.status,contentLength:a.headers.get("content-length")}),{body:r,code:a.status};throw t=yield a.text().catch(()=>"No Text"),(s=new Error(`Failed to fetch: ${l} `+t)).name="NetworkError",s}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("_sendRequest:error",{error:n,status:null===a||void 0===a?void 0:a.status,contentLength:null===a||void 0===a?void 0:a.headers.get("content-length")}),!i||i<=0?(null!=(d=this.L)&&d.call(this,{name:"error",error:t}),v.Log.error(`A networking error occured during ${e} request to ${l}.`,n,t),null):this.Tt($P($P({},c),{retries:i-1}))}})}wt(e){return i(this,void 0,void 0,function*(){var t=$P({[o.NetworkParam.SdkKey]:e.sdkKey,[o.NetworkParam.SdkType]:s.SDKType.F(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.F(e);return JSON.stringify($P($P({},t),{statsigMetadata:$P($P({},l.StatsigMetadataProvider.get()),{stableID:n,sessionID:i,sdkType:e})}))})}t(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}}},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={F:t=>{return(null!=(t=n[t])?t:"js-mono")+(null!==i&&void 0!==i?i:"")},It(t,e){n[t]=e},At(t){i&&"-react"!==i||(i="-"+t)}}},48:(t,i)=>{Object.defineProperty(i,"__esModule",{value:!0}),i.xt=i.Mt=i.Dt=i.Et=void 0;i.Et=()=>"undefined"!=typeof window?window:null,i.Dt=()=>{var t=(0,i.Et)();return null!=(t=null==t?void 0:t.document)?t:null},i.Mt=(t,e)=>{var n=(0,i.Et)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)};i.xt=(t,e)=>{var n=(0,i.Dt)();"function"==typeof(null==n?void 0:n.addEventListener)&&n.addEventListener(t,e)}},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.R)(o,i).catch(()=>{u.Log.warn("Failed to save SessionID")}),t.idleTimeoutID=r.SessionID.kt(t,t.idleTimeoutID,18e5),t.ageTimeoutID=r.SessionID.kt(t,t.ageTimeoutID,144e5-(n-e.startTime)),c[s]=e,d[s]=t,h[s]=null,e.sessionID}),Pt:(t,e)=>{var n=null!=(n=d[e])?n:{ageTimeoutID:null,idleTimeoutID:null,emitFunction:t};n.emitFunction=t,d[e]=n},kt:(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.R)(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 s=n(512),r=n(728),u=n(780),l=n(612),a=n(604),c=n(444);e.StatsigClientBase=class{constructor(t,e,n,i){this.loadingStatus="Uninitialized",this.Rt={},this.h=t,this.J=null!=i?i:{},null!=i&&i.disableStorage&&c.Storage.Ct(!0),null!=i&&i.overrideStableID&&a.StableID.setOverride(i.overrideStableID,t),u.Log.level=null!=(o=null==i?void 0:i.logLevel)?o:u.LogLevel.Warn,this.Gt=null!=(o=null==i?void 0:i.overrideAdapter)?o:null,this.Ft=new r.EventLogger(t,this.St.bind(this),n,i),l.SessionID.Pt(()=>{this.St({name:"session_expired"})},t),this.l=new s.ErrorBoundary(t);var o=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{},n=null!=(n=o.instances)?n:{};n[t]=this,o.lastInstance=this,o.instances=n,__STATSIG__=o,this.dataAdapter=e,this.dataAdapter.attach(t,i)}updateRuntimeOptions(t){null!=t.disableLogging&&(this.J.disableLogging=t.disableLogging,this.Ft.setLoggingDisabled(t.disableLogging)),null!=t.disableStorage&&(this.J.disableStorage=t.disableStorage,c.Storage.Ct(t.disableStorage))}flush(){return this.Ft.flush()}shutdown(){return i(this,void 0,void 0,function*(){this.St({name:"pre_shutdown"}),yield this.Ft.shutdown()})}on(t,e){this.Rt[t]||(this.Rt[t]=[]),this.Rt[t].push(e)}off(t,e){this.Rt[t]&&-1!==(e=this.Rt[t].indexOf(e))&&this.Rt[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.l.logError("_emit:"+n.name,t):u.Log.error("An error occurred in a StatsigClientEvent listener. This is not an issue with Statsig.",n)}};this.Rt[n.name]&&this.Rt[n.name].forEach(t=>e(t)),null!=(t=this.Rt["*"])&&t.forEach(e)}Lt(t,e){this.loadingStatus=t,this.St({name:"values_updated",status:t,values:e})}Ut(t,e,n){!0===(null==n?void 0:n.disableExposureLog)?this.Ft.incrementNonExposureCount(t):this.Ft.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.Kt=e.qt=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.qt=(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.Kt=(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.30";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.Vt=e.zt=e.Bt=e.$t=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.$t=function(t,e,n){return s(t,e,n,!0===(null==n?void 0:n.value))},e.Bt=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.zt=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.Vt=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.R=e.N=e.Storage=void 0,n(780));const o={},s={Ht:()=>"InMemory",A(t){return null!=(t=o[t])?t:null},Wt(t){return Promise.resolve(null!=(t=o[t])?t:null)},M(t,e){return o[t]=e,Promise.resolve()},P(t){return delete o[t],Promise.resolve()},Yt(){return Promise.resolve(Object.keys(o))}};let r=null;try{"undefined"!=typeof window&&"localStorage"in window&&(r={Ht:()=>"LocalStorage",A(t){return localStorage.getItem(t)},Wt(t){return Promise.resolve(localStorage.getItem(t))},M(t,e){return localStorage.setItem(t,e),Promise.resolve()},P(t){return localStorage.removeItem(t),Promise.resolve()},Yt(){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={Ht:()=>l.Ht(),Wt:t=>l.Wt(t),M:(t,e)=>l.M(t,e),P:t=>l.P(t),Yt:()=>l.Yt(),A:t=>{var e;return null!=(e=null==(e=l.A)?void 0:e.call(l,t))?e:null},Qt:t=>{u=t,l=t},Ct:t=>{l=t?s:u}},e.N=function(e){return i(this,void 0,void 0,function*(){var t=yield l.Wt(e);return JSON.parse(null!=t?t:"null")})},e.R=function(t,e){return i(this,void 0,void 0,function*(){yield l.M(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.tt=void 0,e.tt=function(t,e,n,i){return t||(e?""+e+n:""+i+n)}},539:(t,e)=>{$Q(e)},100:(t,e,n)=>{$Q(e),e.Xt=e.nt=e._t=void 0;n=n(48);const i="foreground",o="background",s=[];let r=i;e._t=()=>r===i,e.nt=t=>{s.unshift(t)};e.Xt=e=>{e!==r&&(r=e,s.forEach(t=>t(e)))},(0,n.Mt)("focus",()=>(0,e.Xt)(i)),(0,n.Mt)("blur",()=>(0,e.Xt)(o)),(0,n.Mt)("beforeunload",()=>(0,e.Xt)(o)),(0,n.xt)("visibilitychange",()=>{(0,e.Xt)("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(104),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 r=n(464);e.AutoInit=class{static attempt(e){var n;if("undefined"!=typeof window&&"undefined"!=typeof document&&document.currentScript){var i=document.currentScript.getAttribute("src"),o=null==(o=null===window||void 0===window?void 0:window.location)?void 0:o.href;if(i&&o){let t=null;try{var s=new URL(i,o).searchParams;t=null!=(n=s.get("sdkkey"))?n:s.get("sdkKey")}catch(t){r.Log.error("Invalid source URL")}t&&e({sdkKey: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}}},536:(t,e,n)=>{$Q(e);const i=n(464);e.default=class{constructor(){this.Zt=null,this.te=null,this.ee="Uninitialized",this.ne=0,this.ie=0}getValues(){return this.Zt?(0,i.typedJsonParse)(this.Zt,"has_updates","Failed to parse EvaluationStoreValues"):null}reset(){this.te=null,this.Zt=null,this.ee="Loading",this.ne=0,this.ie=0}finalize(){this.te||(this.ee="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.Zt=t.data,this.ne=e.time,this.ie=t.receivedAt,this.ee=t.source,this.te=e)}getGate(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.feature_gates[t])?e:null;return this.se(t)}getConfig(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.dynamic_configs[t])?e:null;return this.se(t)}getLayer(t){var e,t=null!=(e=null==(e=this.te)?void 0:e.layer_configs[t])?e:null;return this.se(t)}se(t){return{evaluation:t,details:this.oe(null==t)}}oe(t){return"Uninitialized"===this.ee||"NoValues"===this.ee?{reason:this.ee}:{reason:this.ee+":"+(t?"Unrecognized":"Recognized"),lcut:this.ne,receivedAt:this.ie}}}},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.re=(0,r.tt)(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.re,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 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);const r=n(464),o=n(536),s=n(400),u=n(364);class l extends r.StatsigClientBase{constructor(t,e,n=null){r.SDKType.It(t,"javascript-client");var i=new s.default(n,t=>{this.St(t)});super(t,null!=(t=null==n?void 0:n.dataAdapter)?t:new u.StatsigEvaluationsDataAdapter,i,n),(0,r.monitorClass)(this.l,this),(0,r.monitorClass)(this.l,i),this.le=new o.default,this.ae=e}static instance(t){var e,n=(0,r.i)();return t?null==(e=n.instances)?void 0:e[t]:n.lastInstance}initializeSync(){this.updateUserSync(this.ae)}initializeAsync(){return this.updateUserAsync(this.ae)}updateUserSync(t){this.ce(t);t=this.dataAdapter.getDataSync(this.ae);this.le.setValuesFromDataAdapter(t),this.le.finalize(),this.Lt("Ready",t),this.de(null!=t?t:null,this.ae)}updateUserAsync(n){return i(this,void 0,void 0,function*(){this.ce(n);var t=this.ae,e=this.dataAdapter.getDataSync(t);this.Lt("Loading",e),this.le.setValuesFromDataAdapter(e),e=yield this.dataAdapter.getDataAsync(e,t),t===this.ae&&this.le.setValuesFromDataAdapter(e),this.le.finalize(),this.Lt("Ready",e)})}getContext(){return{sdkKey:this.h,options:this.J,values:this.le.getValues(),user:JSON.parse(JSON.stringify(this.ae))}}getAsyncContext(){return i(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.le.getGate(n),i=(0,r.$t)(t,i,n),o=null==(o=null==(n=this.Gt)?void 0:n.getGateOverride)?void 0:o.call(n,i,this.ae,e),n=null!=o?o:i;return this.Ut(t,(0,r.qt)(this.ae,n),e),this.St({name:"gate_evaluation",gate:n}),n}getDynamicConfig(t,e){t=this.he("dynamic_config",t,e);return this.St({name:"dynamic_config_evaluation",dynamicConfig:t}),t}getExperiment(t,e){t=this.he("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.le.getLayer(t),i=(0,r.zt)(e,i,t),o=null==(o=null==(t=this.Gt)?void 0:t.getLayerOverride)?void 0:o.call(t,i,this.ae,n);const s=(0,r.Vt)(i,o,null!=(t=null==o?void 0:o.__value)?t:i.__value,t=>{this.Ut(e,(0,r.Jt)(this.ae,s,t),n)});return this.St({name:"layer_evaluation",layer:s}),s}logEvent(t,e,n){this.Ft.enqueue($P($P({},"string"==typeof t?{eventName:t,value:e,metadata:n}:t),{user:this.ae,time:Date.now()}))}de(t,e){this.dataAdapter.getDataAsync(t,e).catch(t=>{r.Log.error("An error occurred after update.",t)})}ce(t){this.Ft.reset(),this.le.reset(),this.ae=(0,r.normalizeUser)(t,this.J.environment)}he(t,e,n){var i=(0,r.DJB2)(e),{evaluation:i,details:o}=this.le.getConfig(i),o=(0,r.Bt)(e,o,i),i="experiment"===t?null==(t=null==(i=this.Gt)?void 0:i.getExperimentOverride)?void 0:t.call(i,o,this.ae,n):null==(i=null==(t=this.Gt)?void 0:t.getDynamicConfigOverride)?void 0:i.call(t,o,this.ae,n),t=null!=i?i:o;return this.Ut(e,(0,r.Kt)(this.ae,t),n),t}}e.default=l},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.U=null}attach(t,e){super.attach(t,e),this.U=new s.default(null!=e?e:{})}T(e,n){var i;return o(this,void 0,void 0,function*(){var t=yield null==(i=this.U)?void 0:i.fetchEvaluations(this.I(),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,instance:i.default.instance}),e.default=__STATSIG__},156:(t,e,n)=>{$Q(e),e.AutoCapture=e.runStatsigAutoCapture=void 0;const i=n(464),o=n(76);e.runStatsigAutoCapture=function(t){new s(t)};class s{constructor(t){var t=(this.ve=t,this.Me=Date.now(),this.De=0,t.getContext())["sdkKey"],e=(this.l=new i.ErrorBoundary(t),(0,i.monitorClass)(this.l,this),null!=(e=(__STATSIG__=null!==__STATSIG__&&void 0!==__STATSIG__?__STATSIG__:{}).acInstances)?e:{}),t=(e[t]=this,__STATSIG__.acInstances=e,(0,i.Dt)());"loading"===(null==t?void 0:t.readyState)?t.addEventListener("DOMContentLoaded",()=>this.Ee()):this.Ee()}Ne(){const e=(0,i.Et)();var t,n=(0,i.Dt)();e&&n&&(t=t=>{this.ke(t||e.event)},(0,o.Pe)(n,"click",t),(0,o.Pe)(n,"submit",t),(0,o.Pe)(e,"error",t),(0,o.Pe)(e,"beforeunload",()=>this.Re()),(0,o.Pe)(e,"scroll",()=>this.Ce()))}ke(t){var e;let n=null==(e=t.type)?void 0:e.toLowerCase();"error"===n&&t instanceof ErrorEvent?this.Ge(t):(e=(0,o.Fe)(t))&&(0,o.rt)(t,e)&&("submit"===n&&(n="form_submit"),{value:t,metadata:e}=(0,o.Le)(e),this.Ue(n,t,e))}Ee(){this.Ne(),this.Je(),this.Ke()}Ge(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.Ue("error",t.message,{message:t.message,filename:t.filename,lineno:t.lineno,colno:t.colno,error_str:n})}Je(){setTimeout(()=>{var t,e=(0,o.qe)();this.Ve("page_view",(0,o.ze)(),{title:null==(t=(0,i.Dt)())?void 0:t.title,queryParams:Object.fromEntries(e.searchParams)})},1)}Ke(){const n=(0,i.Et)();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.Ue("performance",(0,o.ze)(),t)},1)}Re(){this.Ve("page_view_end",(0,o.ze)(),{scrollDepth:this.De,pageViewLength:Date.now()-this.Me})}Ue(t,e,n){e={eventName:"auto_capture::"+t,value:e,metadata:$P({sessionId:(0,o.Be)(this.ve.getContext().sdkKey),page_url:null!=(t=null==(e=null==(t=(0,i.Et)())?void 0:t.location)?void 0:e.href)?t:""},n)};this.ve.logEvent(e),i.Log.debug("Enqueued Event",e)}Ve(t,e,n){this.Ue(t,e,n),this.ve.flush().catch(t=>{i.Log.error(t)})}Ce(){var t=null!=(t=null==(t=(0,i.Dt)())?void 0:t.body.scrollHeight)?t:1,e=(0,i.Et)(),n=null!=(n=null==e?void 0:e.scrollY)?n:1,e=null!=(e=null==e?void 0:e.innerHeight)?e:1;this.De=Math.max(this.De,Math.min(100,Math.round((n+e)/t*100)))}}e.AutoCapture=s},76:(t,e,n)=>{$Q(e),e.Pe=e.ze=e.Be=e.qe=e.rt=e.Fe=e.Le=void 0;const o=n(464),s={};function r(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.Le=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()),r(t));return o&&(n.href=o.getAttribute("href")),{value:i,metadata:n}},e.Fe=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(r(e))return!0}return!1}},e.qe=function(){var t=null!=(t=null==(t=null==(t=(0,o.Et)())?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(t){var e=function(t){var e=(0,o.Et)();if(e&&e.localStorage)return e.localStorage.getItem(t);return s[t]}(t="statsig.web_analytics.session."+(0,o.DJB2)(t)),n=Date.now();let i=e?(0,o.typedJsonParse)(e,"lastAccessedTime","Failed to parse WebSession"):null;return(i=!i||144e5<n-i.startTime||6e5<n-i.lastAccessedTime?(e=Date.now(),{id:(0,o.getUUID)(),startTime:e,lastAccessedTime:e}):i).lastAccessedTime=n,e=t,n=JSON.stringify(i),(t=(0,o.Et)())&&t.localStorage?t.localStorage.setItem(e,n):(s[e]=n,o.Log.error("AutoCapture: No window.localStorage")),i.id},e.ze=function(){var t;return(null==(t=null==(t=null==(t=(0,o.Et)())?void 0:t.location)?void 0:t.href)?void 0:t.split(/[?#]/)[0])||""},e.Pe=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(156);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(464),u=o(208),l=o(824);var s=o(920);e.default=__STATSIG__,s.AutoInit.attempt(({sdkKey:t})=>{var e=null==(e=null===__STATSIG__||void 0===__STATSIG__?void 0:__STATSIG__.instances)?void 0:e[t];let n=null;n=(n=e instanceof u.StatsigClient?e:n)||new u.StatsigClient(t,{userID:""}),new l.AutoCapture(n),n.initializeAsync().catch(t=>{r.Log.error(t)})})}return t.default})());