@launchdarkly/browser 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ You tried to parse Less with the standard CSS parser; try again with the postcss
19
19
  `?(n=1,r+=1):n+=1}return i}function zv(t){return t.map(e=>(e.nodes&&(e.nodes=zv(e.nodes)),delete e.source,e))}function Bv(t){if(t[Yv]=!1,t.proxyOf.nodes)for(let e of t.proxyOf.nodes)Bv(e)}function aM(t){return Buffer?Buffer.from(t,"base64").toString():window.atob(t)}function Ii(t,e){if(Array.isArray(t))return t.map(o=>Ii(o));let n=t,{inputs:r}=n,i=or(n,["inputs"]);if(r){e=[];for(let o of r){let s=Yt(z({},o),{__proto__:gM.prototype});s.map&&(s.map=Yt(z({},s.map),{__proto__:bM.prototype})),e.push(s)}}if(i.nodes&&(i.nodes=t.nodes.map(o=>Ii(o,e))),i.source){let o=i.source,{inputId:s}=o,a=or(o,["inputId"]);i.source=a,s!=null&&(i.source.input=e[s])}if(i.type==="root")return new vM(i);if(i.type==="decl")return new yM(i);if(i.type==="rule")return new SM(i);if(i.type==="comment")return new mM(i);if(i.type==="atrule")return new fM(i);throw new Error("Unknown node type: "+t.type)}function DM(t){for(let e=t.length-1;e>=0;e--){let n=t[e],r=n[3]||n[2];if(r)return r}}function ta(t,e){let n=new HM(t,e),r=new zM(n);try{r.parse()}catch(i){throw process.env.NODE_ENV!=="production"&&i.name==="CssSyntaxError"&&e&&e.from&&(/\.scss$/i.test(e.from)?i.message+=`
20
20
  You tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser`:/\.sass/i.test(e.from)?i.message+=`
21
21
  You tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser`:/\.less$/i.test(e.from)&&(i.message+=`
22
- You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),i}return r.root}function ii(t){return typeof t=="object"&&typeof t.then=="function"}function d0(t){let e=!1,n=iP[t.type];return t.type==="decl"?e=t.prop.toLowerCase():t.type==="atrule"&&(e=t.name.toLowerCase()),e&&t.append?[n,n+"-"+e,hr,n+"Exit",n+"Exit-"+e]:e?[n,n+"-"+e,n+"Exit",n+"Exit-"+e]:t.append?[n,hr,n+"Exit"]:[n,n+"Exit"]}function jg(t){let e;return t.type==="document"?e=["Document",hr,"DocumentExit"]:t.type==="root"?e=["Root",hr,"RootExit"]:e=d0(t),{eventIndex:0,events:e,iterator:0,node:t,visitorIndex:0,visitors:[]}}function Du(t){return t[we]=!1,t.nodes&&t.nodes.forEach(e=>Du(e)),t}function pt(...t){return t.length===1&&Array.isArray(t[0])&&(t=t[0]),new Nh(t)}function Oh(t){if(vs[t])return vs[t];let e=globalThis[t],n=e.prototype,r=t in Qg?Qg[t]:void 0,i=!!(r&&r.every(a=>{var c,l;return!!((l=(c=Object.getOwnPropertyDescriptor(n,a))==null?void 0:c.get)!=null&&l.toString().includes("[native code]"))})),o=t in $g?$g[t]:void 0,s=!!(o&&o.every(a=>{var c;return typeof n[a]=="function"&&((c=n[a])==null?void 0:c.toString().includes("[native code]"))}));if(i&&s&&!VP())return vs[t]=e.prototype,e.prototype;try{let a=document.createElement("iframe");document.body.appendChild(a);let c=a.contentWindow;if(!c)return e.prototype;let l=c[t].prototype;return document.body.removeChild(a),l?vs[t]=l:n}catch(a){return n}}function je(t,e,n){var r;let i=`${t}.${String(n)}`;if(Hc[i])return Hc[i].call(e);let o=Oh(t),s=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return s?(Hc[i]=s,s.call(e)):e[n]}function I0(t,e,n){let r=`${t}.${String(n)}`;if(zc[r])return zc[r].bind(e);let i=Oh(t)[n];return typeof i!="function"?e[n]:(zc[r]=i,i.bind(e))}function xP(t){return je("Node",t,"childNodes")}function NP(t){return je("Node",t,"parentNode")}function OP(t){return je("Node",t,"parentElement")}function GP(t){return je("Node",t,"textContent")}function LP(t,e){return I0("Node",t,"contains")(e)}function XP(t){return I0("Node",t,"getRootNode")()}function WP(t){return!t||!("host"in t)?null:je("ShadowRoot",t,"host")}function UP(t){return t.styleSheets}function MP(t){return!t||!("shadowRoot"in t)?null:je("Element",t,"shadowRoot")}function PP(t,e){return je("Element",t,"querySelector")(e)}function FP(t,e){return je("Element",t,"querySelectorAll")(e)}function T0(){return Oh("MutationObserver").constructor}function Zn(t,e,n){try{if(!(e in t))return()=>{};let r=t[e],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),t[e]=i,()=>{t[e]=r}}catch(r){return()=>{}}}function Pt(t,e,n=document){let r={capture:!0};return n.addEventListener(t,e,r),()=>n.removeEventListener(t,e,r)}function Ei(t,e,n={}){let r=null,i=0;return function(...o){let s=Date.now();!i&&n.leading===!1&&(i=s);let a=e-(s-i),c=this;a<=0||a>e?(r&&(clearTimeout(r),r=null),i=s,t.apply(c,o)):!r&&n.trailing!==!1&&(r=setTimeout(()=>{i=n.leading===!1?0:Date.now(),r=null,t.apply(c,o)},a))}}function va(t,e,n,r,i=window){let o=i.Object.getOwnPropertyDescriptor(t,e);return i.Object.defineProperty(t,e,r?n:{set(s){setTimeout(()=>{n.set.call(this,s)},0),o&&o.set&&o.set.call(this,s)}}),()=>va(t,e,o||{},!0)}function E0(t){var e,n,r,i;let o=t.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:t.pageXOffset!==void 0?t.pageXOffset:o.documentElement.scrollLeft||(o==null?void 0:o.body)&&((e=q.parentElement(o.body))==null?void 0:e.scrollLeft)||((n=o==null?void 0:o.body)==null?void 0:n.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:t.pageYOffset!==void 0?t.pageYOffset:(o==null?void 0:o.documentElement.scrollTop)||(o==null?void 0:o.body)&&((r=q.parentElement(o.body))==null?void 0:r.scrollTop)||((i=o==null?void 0:o.body)==null?void 0:i.scrollTop)||0}}function R0(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function C0(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Z0(t){return t?t.nodeType===t.ELEMENT_NODE?t:q.parentElement(t):null}function Nt(t,e,n,r){if(!t)return!1;let i=Z0(t);if(!i)return!1;try{if(typeof e=="string"){if(i.classList.contains(e)||r&&i.closest("."+e)!==null)return!0}else if(_s(i,e,r))return!0}catch(o){}return!!(n&&(i.matches(n)||r&&i.closest(n)!==null))}function JP(t,e){return e.getId(t)!==-1}function Bc(t,e,n){return t.tagName==="TITLE"&&n.headTitleMutations?!0:e.getId(t)===mi}function k0(t,e){if(ci(t))return!1;let n=e.getId(t);if(!e.has(n))return!0;let r=q.parentNode(t);return r&&r.nodeType===t.DOCUMENT_NODE?!1:r?k0(r,e):!0}function Hu(t){return!!t.changedTouches}function DP(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function V0(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function x0(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function zu(t){return t?t instanceof _u&&"shadowRoot"in t?!!t.shadowRoot:!!q.shadowRoot(t):!1}function N0(t){var e;let n=null;return"getRootNode"in t&&((e=q.getRootNode(t))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&q.host(q.getRootNode(t))&&(n=q.host(q.getRootNode(t))),n}function YP(t){let e=t,n;for(;n=N0(e);)e=n;return e}function KP(t){let e=t.ownerDocument;if(!e)return!1;let n=YP(t);return q.contains(e,n)}function O0(t){let e=t.ownerDocument;return e?q.contains(e,t)||KP(t):!1}function tb(t){return"__ln"in t}function $u(t,e){t.delete(e),q.childNodes(e).forEach(n=>$u(t,n))}function _P(t,e){let n=[t];for(;n.length;){let r=n.pop();e.has(r)||(e.add(r),q.childNodes(r).forEach(i=>n.push(i)))}}function nb(t,e,n){return t.size===0?!1:HP(t,e)}function HP(t,e,n){let r=q.parentNode(e);return r?t.has(r):!1}function rb(t,e){return t.size===0?!1:L0(t,e)}function L0(t,e){let n=q.parentNode(e);return n?t.has(n)?!0:L0(t,n):!1}function zP(t){hi=t}function BP(){hi=void 0}function Ni(t){try{if("composedPath"in t){let e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch(e){}return t&&t.target}function X0(t,e){let n=new Qu;Tn.push(n),n.init(t);let r=new(T0())(nt(n.processMutations.bind(n)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function jP({mousemoveCb:t,sampling:e,doc:n,mirror:r}){if(e.mousemove===!1)return()=>{};let i=typeof e.mousemove=="number"?e.mousemove:50,o=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,s=[],a,c=Ei(nt(h=>{let p=Date.now()-a;t(s.map(f=>(f.timeOffset-=p,f)),h),s=[],a=null}),o),l=nt(Ei(nt(h=>{let p=Ni(h),{clientX:f,clientY:m}=Hu(h)?h.changedTouches[0]:h;a||(a=ea()),s.push({x:f,y:m,id:r.getId(p),timeOffset:ea()-a}),c(typeof DragEvent<"u"&&h instanceof DragEvent?et.Drag:h instanceof MouseEvent?et.MouseMove:et.TouchMove)}),i,{trailing:!1})),u=[Pt("mousemove",l,n),Pt("touchmove",l,n),Pt("drag",l,n)];return nt(()=>{u.forEach(h=>h())})}function QP({mouseInteractionCb:t,doc:e,mirror:n,blockClass:r,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let s=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,a=[],c=null,l=u=>h=>{let p=Ni(h);if(Nt(p,r,i,!0)||AP(p))return;let f=null,m=u;if("pointerType"in h){switch(h.pointerType){case"mouse":f=_e.Mouse;break;case"touch":f=_e.Touch;break;case"pen":f=_e.Pen;break}f===_e.Touch&&(Jt[u]===Jt.MouseDown?m="TouchStart":Jt[u]===Jt.MouseUp&&(m="TouchEnd"))}else Hu(h)&&(f=_e.Touch);f!==null?(c=f,(m.startsWith("Touch")&&f===_e.Touch||m.startsWith("Mouse")&&f===_e.Mouse)&&(f=null)):Jt[u]===Jt.Click&&(f=c,c=null);let d=Hu(h)?h.changedTouches[0]:h;if(!d)return;let b=n.getId(p),{clientX:v,clientY:I}=d;nt(t)(z({type:Jt[m],id:b,x:v,y:I},f!==null&&{pointerType:f}))};return Object.keys(Jt).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&s[u]!==!1).forEach(u=>{let h=sr(u),p=l(u);if(window.PointerEvent)switch(Jt[u]){case Jt.MouseDown:case Jt.MouseUp:h=h.replace("mouse","pointer");break;case Jt.TouchStart:case Jt.TouchEnd:return}a.push(Pt(h,p,e))}),nt(()=>{a.forEach(u=>u())})}function W0({scrollCb:t,doc:e,mirror:n,blockClass:r,blockSelector:i,sampling:o}){let s=nt(Ei(nt(a=>{let c=Ni(a);if(!c||Nt(c,r,i,!0))return;let l=n.getId(c);if(c===e&&e.defaultView){let u=E0(e.defaultView);t({id:l,x:u.left,y:u.top})}else t({id:l,x:c.scrollLeft,y:c.scrollTop})}),o.scroll||100));return Pt("scroll",s,e)}function $P({viewportResizeCb:t},{win:e}){let n=-1,r=-1,i=nt(Ei(nt(()=>{let o=R0(),s=C0();(n!==o||r!==s)&&(t({width:Number(s),height:Number(o)}),n=o,r=s)}),200));return Pt("resize",i,e)}function tF({inputCb:t,doc:e,mirror:n,blockClass:r,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:c,sampling:l,userTriggeredOnInput:u}){function h(v){let I=Ni(v),R=v.isTrusted,E=I&&I.tagName;if(I&&E==="OPTION"&&(I=q.parentElement(I)),!I||!E||qP.indexOf(E)<0||Nt(I,r,i,!0)||I.classList.contains(o)||s&&I.matches(s))return;let T=I.value,V=!1,N=Ds(I)||"",U=I.getAttribute("data-hl-record");N==="radio"||N==="checkbox"?V=I.checked:Qb({maskInputOptions:a,type:N,tagName:E,overwriteRecord:U})&&(T=Js({element:I,maskInputOptions:a,tagName:E,type:N,value:T,overwriteRecord:U,maskInputFn:c})),p(I,u?{text:T,isChecked:V,userTriggered:R}:{text:T,isChecked:V});let C=I.name;N==="radio"&&C&&V&&e.querySelectorAll(`input[type="radio"][name="${C}"]`).forEach(x=>{if(x!==I){let M=x.value;p(x,u?{text:M,isChecked:!V,userTriggered:!1}:{text:M,isChecked:!V})}})}function p(v,I){let R=ib.get(v);if(!R||R.text!==I.text||R.isChecked!==I.isChecked){ib.set(v,I);let E=n.getId(v);nt(t)(Yt(z({},I),{id:E}))}}let f=(l.input==="last"?["change"]:["input","change"]).map(v=>Pt(v,nt(h),e)),m=e.defaultView;if(!m)return()=>{f.forEach(v=>v())};let d=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),b=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return d&&d.set&&f.push(...b.map(v=>va(v[0],v[1],{set(){nt(h)({target:this,isTrusted:!1})}},!1,m))),nt(()=>{f.forEach(v=>v())})}function na(t){let e=[];function n(r,i){if(Ss("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Ss("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Ss("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Ss("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){let o=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(o)}else if(r.parentStyleSheet){let o=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(o)}return i}return n(t,e)}function He(t,e,n){let r,i;return t?(t.ownerNode?r=e.getId(t.ownerNode):i=n.getId(t),{styleId:i,id:r}):{}}function eF({styleSheetRuleCb:t,mirror:e,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:nt((u,h,p)=>{let[f,m]=p,{id:d,styleId:b}=He(h,e,n.styleMirror);return(d&&d!==-1||b&&b!==-1)&&t({id:d,styleId:b,adds:[{rule:f,index:m}]}),u.apply(h,p)})}),r.CSSStyleSheet.prototype.addRule=function(u,h,p=this.cssRules.length){let f=`${u} { ${h} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[f,p])};let o=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:nt((u,h,p)=>{let[f]=p,{id:m,styleId:d}=He(h,e,n.styleMirror);return(m&&m!==-1||d&&d!==-1)&&t({id:m,styleId:d,removes:[{index:f}]}),u.apply(h,p)})}),r.CSSStyleSheet.prototype.removeRule=function(u){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let s;r.CSSStyleSheet.prototype.replace&&(s=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:nt((u,h,p)=>{let[f]=p,{id:m,styleId:d}=He(h,e,n.styleMirror);return(m&&m!==-1||d&&d!==-1)&&t({id:m,styleId:d,replace:f}),u.apply(h,p)})}));let a;r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:nt((u,h,p)=>{let[f]=p,{id:m,styleId:d}=He(h,e,n.styleMirror);return(m&&m!==-1||d&&d!==-1)&&t({id:m,styleId:d,replaceSync:f}),u.apply(h,p)})}));let c={};ws("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(ws("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),ws("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),ws("CSSSupportsRule")&&(c.CSSSupportsRule=r.CSSSupportsRule));let l={};return Object.entries(c).forEach(([u,h])=>{l[u]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(l[u].insertRule,{apply:nt((p,f,m)=>{let[d,b]=m,{id:v,styleId:I}=He(f.parentStyleSheet,e,n.styleMirror);return(v&&v!==-1||I&&I!==-1)&&t({id:v,styleId:I,adds:[{rule:d,index:[...na(f),b||0]}]}),p.apply(f,m)})}),h.prototype.deleteRule=new Proxy(l[u].deleteRule,{apply:nt((p,f,m)=>{let[d]=m,{id:b,styleId:v}=He(f.parentStyleSheet,e,n.styleMirror);return(b&&b!==-1||v&&v!==-1)&&t({id:b,styleId:v,removes:[{index:[...na(f),d]}]}),p.apply(f,m)})})}),nt(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=o,s&&(r.CSSStyleSheet.prototype.replace=s),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach(([u,h])=>{h.prototype.insertRule=l[u].insertRule,h.prototype.deleteRule=l[u].deleteRule})})}function U0({mirror:t,stylesheetManager:e},n){var r,i,o;let s=null;n.nodeName==="#document"?s=t.getId(n):s=t.getId(q.host(n));let a=n.nodeName==="#document"?(r=n.defaultView)==null?void 0:r.Document:(o=(i=n.ownerDocument)==null?void 0:i.defaultView)==null?void 0:o.ShadowRoot,c=a!=null&&a.prototype?Object.getOwnPropertyDescriptor(a==null?void 0:a.prototype,"adoptedStyleSheets"):void 0;return s===null||s===-1||!a||!c?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var l;return(l=c.get)==null?void 0:l.call(this)},set(l){var u;let h=(u=c.set)==null?void 0:u.call(this,l);if(s!==null&&s!==-1)try{e.adoptStyleSheets(l,s)}catch(p){}return h}}),nt(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))}function nF({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){let o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:nt((a,c,l)=>{var u;let[h,p,f]=l;if(n.has(h))return o.apply(c,[h,p,f]);let{id:m,styleId:d}=He((u=c.parentRule)==null?void 0:u.parentStyleSheet,e,r.styleMirror);return(m&&m!==-1||d&&d!==-1)&&t({id:m,styleId:d,set:{property:h,value:p,priority:f},index:na(c.parentRule)}),a.apply(c,l)})});let s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:nt((a,c,l)=>{var u;let[h]=l;if(n.has(h))return s.apply(c,[h]);let{id:p,styleId:f}=He((u=c.parentRule)==null?void 0:u.parentStyleSheet,e,r.styleMirror);return(p&&p!==-1||f&&f!==-1)&&t({id:p,styleId:f,remove:{property:h},index:na(c.parentRule)}),a.apply(c,l)})}),nt(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}function rF({mediaInteractionCb:t,blockClass:e,blockSelector:n,mirror:r,sampling:i,doc:o}){let s=nt(c=>Ei(nt(l=>{let u=Ni(l);if(!u||Nt(u,e,n,!0))return;let{currentTime:h,volume:p,muted:f,playbackRate:m,loop:d}=u;t({type:c,id:r.getId(u),currentTime:h,volume:p,muted:f,playbackRate:m,loop:d})}),i.media||500)),a=[Pt("play",s(qn.Play),o),Pt("pause",s(qn.Pause),o),Pt("seeked",s(qn.Seeked),o),Pt("volumechange",s(qn.VolumeChange),o),Pt("ratechange",s(qn.RateChange),o)];return nt(()=>{a.forEach(c=>c())})}function iF({fontCb:t,doc:e}){let n=e.defaultView;if(!n)return()=>{};let r=[],i=new WeakMap,o=n.FontFace;n.FontFace=function(a,c,l){let u=new o(a,c,l);return i.set(u,{family:a,buffer:typeof c!="string",descriptors:l,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),u};let s=Zn(e.fonts,"add",function(a){return function(c){return setTimeout(nt(()=>{let l=i.get(c);l&&(t(l),i.delete(c))}),0),a.apply(this,[c])}});return r.push(()=>{n.FontFace=o}),r.push(s),nt(()=>{r.forEach(a=>a())})}function oF(t){let{doc:e,mirror:n,blockClass:r,blockSelector:i,selectionCb:o}=t,s=!0,a=nt(()=>{let c=e.getSelection();if(!c||s&&c!=null&&c.isCollapsed)return;s=c.isCollapsed||!1;let l=[],u=c.rangeCount||0;for(let h=0;h<u;h++){let p=c.getRangeAt(h),{startContainer:f,startOffset:m,endContainer:d,endOffset:b}=p;Nt(f,r,i,!0)||Nt(d,r,i,!0)||l.push({start:n.getId(f),startOffset:m,end:n.getId(d),endOffset:b})}o({ranges:l})});return a(),Pt("selectionchange",a)}function sF({doc:t,customElementCb:e}){let n=t.defaultView;return!n||!n.customElements?()=>{}:Zn(n.customElements,"define",function(r){return function(i,o,s){try{e({define:{name:i}})}catch(a){console.warn(`Custom element callback failed for ${i}`)}return r.apply(this,[i,o,s])}})}function aF(t,e){let{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:u,canvasMutationCb:h,fontCb:p,selectionCb:f,customElementCb:m}=t;t.mutationCb=(...d)=>{e.mutation&&e.mutation(...d),n(...d)},t.mousemoveCb=(...d)=>{e.mousemove&&e.mousemove(...d),r(...d)},t.mouseInteractionCb=(...d)=>{e.mouseInteraction&&e.mouseInteraction(...d),i(...d)},t.scrollCb=(...d)=>{e.scroll&&e.scroll(...d),o(...d)},t.viewportResizeCb=(...d)=>{e.viewportResize&&e.viewportResize(...d),s(...d)},t.inputCb=(...d)=>{e.input&&e.input(...d),a(...d)},t.mediaInteractionCb=(...d)=>{e.mediaInteaction&&e.mediaInteaction(...d),c(...d)},t.styleSheetRuleCb=(...d)=>{e.styleSheetRule&&e.styleSheetRule(...d),l(...d)},t.styleDeclarationCb=(...d)=>{e.styleDeclaration&&e.styleDeclaration(...d),u(...d)},t.canvasMutationCb=(...d)=>{e.canvasMutation&&e.canvasMutation(...d),h(...d)},t.fontCb=(...d)=>{e.font&&e.font(...d),p(...d)},t.selectionCb=(...d)=>{e.selection&&e.selection(...d),f(...d)},t.customElementCb=(...d)=>{e.customElement&&e.customElement(...d),m(...d)}}function lF(t,e={}){let n=t.doc.defaultView;if(!n)return()=>{};aF(t,e);let r;t.recordDOM&&(r=X0(t,t.doc));let i=jP(t),o=QP(t),s=W0(t),a=$P(t,{win:n}),c=tF(t),l=rF(t),u=()=>{},h=()=>{},p=()=>{},f=()=>{};t.recordDOM&&(u=eF(t,{win:n}),h=U0(t,t.doc),p=nF(t,{win:n}),t.collectFonts&&(f=iF(t)));let m=oF(t),d=sF(t),b=[];for(let v of t.plugins)b.push(v.observer(v.callback,n,v.options));return nt(()=>{Tn.forEach(v=>v.reset()),r==null||r.disconnect(),i(),o(),s(),a(),c(),l(),u(),h(),p(),f(),m(),d(),b.forEach(v=>v())})}function Ss(t){return typeof window[t]<"u"}function ws(t){return!!(typeof window[t]<"u"&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}function hF(t,e){let n=ob.get(t);return n||(n=new Map,ob.set(t,n)),n.has(e)||n.set(e,[]),n.get(e)}function Os(t,e,n){if(t instanceof Array)return t.map(r=>Os(r,e,n));if(t===null)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer){let r=t.constructor.name,i=uF(t);return{rr_type:r,base64:i}}else{if(t instanceof DataView)return{rr_type:t.constructor.name,args:[Os(t.buffer,e,n),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){let r=t.constructor.name,{src:i}=t;return{rr_type:r,src:i}}else if(t instanceof HTMLCanvasElement){let r="HTMLImageElement",i=t.toDataURL();return{rr_type:r,src:i}}else{if(t instanceof ImageData)return{rr_type:t.constructor.name,args:[Os(t.data,e,n),t.width,t.height]};if(F0(t,e)||typeof t=="object"){let r=t.constructor.name,i=M0(t,e,n);return{rr_type:r,index:i}}}}return t}function pF(t,e,n,r){let i=[],o=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let s of o)try{if(typeof e.CanvasRenderingContext2D.prototype[s]!="function")continue;let a=Zn(e.CanvasRenderingContext2D.prototype,s,function(c){return function(...l){return Nt(this.canvas,n,r,!0)||setTimeout(()=>{let u=P0(l,e,this);t(this.canvas,{type:dr["2D"],property:s,args:u})},0),c.apply(this,l)}});i.push(a)}catch(a){let c=va(e.CanvasRenderingContext2D.prototype,s,{set(l){t(this.canvas,{type:dr["2D"],property:s,args:[l],setter:!0})}});i.push(c)}return()=>{i.forEach(s=>s())}}function dF(t){return t==="experimental-webgl"?"webgl":t}function sb(t,e,n,r){let i=[];try{let o=Zn(t.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...c){if(!Nt(this,e,n,!0)){let l=dF(a);if("__context"in this||(this.__context=l),r&&["webgl","webgl2"].includes(l))if(c[0]&&typeof c[0]=="object"){let u=c[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else c.splice(0,1,{preserveDrawingBuffer:!0})}return s.apply(this,[a,...c])}});i.push(o)}catch(o){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(o=>o())}}function ab(t,e,n,r,i,o){let s=[],a=Object.getOwnPropertyNames(t);for(let c of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(c))try{if(typeof t[c]!="function")continue;let l=Zn(t,c,function(u){return function(...h){let p=u.apply(this,h);if(M0(p,o,this),"tagName"in this.canvas&&!Nt(this.canvas,r,i,!0)){let f=P0(h,o,this),m={type:e,property:c,args:f};n(this.canvas,m)}return p}});s.push(l)}catch(l){let u=va(t,c,{set(h){n(this.canvas,{type:e,property:c,args:[h],setter:!0})}});s.push(u)}return s}function fF(t,e,n,r){let i=[];return i.push(...ab(e.WebGLRenderingContext.prototype,dr.WebGL,t,n,r,e)),typeof e.WebGL2RenderingContext<"u"&&i.push(...ab(e.WebGL2RenderingContext.prototype,dr.WebGL2,t,n,r,e)),()=>{i.forEach(o=>o())}}function yF(t){let e;try{if(e=lb&&(self.URL||self.webkitURL).createObjectURL(lb),!e)throw"";let n=new Worker(e,{name:t==null?void 0:t.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),n}catch(n){return new Worker("data:text/javascript;base64,"+A0,{name:t==null?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}function Ge(t={}){var e,n,r,i,o,s,a,c;let{emit:l,checkoutEveryNms:u,checkoutEveryNth:h,blockClass:p="highlight-block",blockSelector:f=null,ignoreClass:m="highlight-ignore",ignoreSelector:d=null,maskTextClass:b="highlight-mask",maskTextSelector:v=null,inlineStylesheet:I=!0,maskAllInputs:R,maskInputOptions:E,slimDOMOptions:T,maskInputFn:V,maskTextFn:N=uh,hooks:U,packFn:C,sampling:x={},mousemoveWait:M,recordDOM:ot=!0,recordCanvas:lt=!1,recordCrossOriginIframes:y=!1,recordAfter:g=t.recordAfter==="DOMContentLoaded"?t.recordAfter:"load",userTriggeredOnInput:Z=!1,collectFonts:D=!1,inlineImages:P=!1,inlineVideos:O=!1,plugins:it,keepIframeSrcFn:ct=()=>!1,privacySetting:Ot="default",ignoreCSSAttributes:We=new Set([]),errorHandler:Y0,logger:K0}=t,Oi=z(z({},t.dataURLOptions),(n=(e=t.sampling)==null?void 0:e.canvas)==null?void 0:n.dataURLOptions);zP(Y0);let Gi=y?window.parent===window:!0,mr=!1;if(!Gi)try{window.parent.document&&(mr=!1)}catch(st){mr=!0}if(Gi&&!l)throw new Error("emit function is required");if(!Gi&&!mr)return()=>{};M!==void 0&&x.mousemove===void 0&&(x.mousemove=M),ce.reset();let Sa=R===!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}:E!==void 0?E:{password:!0},wa=T===!0||T==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:T==="all",headMetaDescKeywords:T==="all",headTitleMutations:T==="all"}:T||{};DP();let Gh,Ia=0,Lh=st=>{for(let oe of it||[])oe.eventProcessor&&(st=oe.eventProcessor(st));return C&&!mr&&(st=C(st)),st};vt=(st,oe)=>{var gt;let bt=st;if(bt.timestamp=ea(),(gt=Tn[0])!=null&&gt.isFrozen()&&bt.type!==rt.FullSnapshot&&!(bt.type===rt.IncrementalSnapshot&&bt.data.source===et.Mutation)&&Tn.forEach(pe=>pe.unfreeze()),Gi)l==null||l(Lh(bt),oe);else if(mr){let pe={type:"rrweb",event:Lh(bt),origin:window.location.origin,isCheckout:oe};window.parent.postMessage(pe,"*")}if(bt.type===rt.FullSnapshot)Gh=bt,Ia=0;else if(bt.type===rt.IncrementalSnapshot){if(bt.data.source===et.Mutation&&bt.data.isAttachIframe)return;Ia++;let pe=h&&Ia>=h,dt=u&&bt.timestamp-Gh.timestamp>u;(pe||dt)&&Gs(!0)}};let Li=st=>{vt({type:rt.IncrementalSnapshot,data:z({source:et.Mutation},st)})},Xh=st=>vt({type:rt.IncrementalSnapshot,data:z({source:et.Scroll},st)}),Wh=st=>vt({type:rt.IncrementalSnapshot,data:z({source:et.CanvasMutation},st)}),_0=st=>vt({type:rt.IncrementalSnapshot,data:z({source:et.AdoptedStyleSheet},st)}),Qe=new nh({mutationCb:Li,adoptedStyleSheetCb:_0}),$e=new qu({mirror:ce,mutationCb:Li,stylesheetManager:Qe,recordCrossOriginIframes:y,wrappedEmit:vt});for(let st of it||[])st.getMirror&&st.getMirror({nodeMirror:ce,crossOriginIframeMirror:$e.crossOriginIframeMirror,crossOriginIframeStyleMirror:$e.crossOriginIframeStyleMirror});let Ta=new rh;pi=new eh({recordCanvas:lt,recordLocalVideos:P,recordRemoteVideos:O,mutationCb:Wh,win:window,blockClass:p,blockSelector:f,mirror:ce,sampling:(r=x==null?void 0:x.canvas)==null?void 0:r.fps,samplingManual:(i=x==null?void 0:x.canvas)==null?void 0:i.fpsManual,clearWebGLBuffer:(o=x==null?void 0:x.canvas)==null?void 0:o.clearWebGLBuffer,initialSnapshotDelay:(s=x==null?void 0:x.canvas)==null?void 0:s.initialSnapshotDelay,dataURLOptions:Oi,resizeFactor:(a=x==null?void 0:x.canvas)==null?void 0:a.resizeFactor,maxSnapshotDimension:(c=x==null?void 0:x.canvas)==null?void 0:c.maxSnapshotDimension,logger:K0});let Xi=new th({mutationCb:Li,scrollCb:Xh,bypassOptions:{blockClass:p,blockSelector:f,maskTextClass:b,maskTextSelector:v,inlineStylesheet:I,maskInputOptions:Sa,dataURLOptions:Oi,maskTextFn:N,maskInputFn:V,recordCanvas:lt,inlineImages:P,inlineVideos:O,privacySetting:Ot,sampling:x,slimDOMOptions:wa,iframeManager:$e,stylesheetManager:Qe,canvasManager:pi,keepIframeSrcFn:ct,processedNodeManager:Ta},mirror:ce});Gs=(st=!1)=>{if(!ot)return;vt({type:rt.Meta,data:{href:window.location.href,width:C0(),height:R0()}},st),Qe.reset(),Xi.init(),Tn.forEach(gt=>gt.lock());let oe=jW(document,{mirror:ce,blockClass:p,blockSelector:f,maskTextClass:b,maskTextSelector:v,inlineStylesheet:I,maskAllInputs:Sa,maskTextFn:N,maskInputFn:V,slimDOM:wa,dataURLOptions:Oi,recordCanvas:lt,inlineImages:P,inlineVideos:O,privacySetting:Ot,onSerialize:gt=>{V0(gt,ce)&&$e.addIframe(gt),x0(gt,ce)&&Qe.trackLinkElement(gt),zu(gt)&&Xi.addShadowRoot(q.shadowRoot(gt),document)},onIframeLoad:(gt,bt)=>{$e.attachIframe(gt,bt),Xi.observeAttachShadow(gt)},onStylesheetLoad:(gt,bt)=>{Qe.attachLinkElement(gt,bt)},keepIframeSrcFn:ct});if(!oe)return console.warn("Failed to snapshot the document");vt({type:rt.FullSnapshot,data:{node:oe,initialOffset:E0(window)}},st),Tn.forEach(gt=>gt.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Qe.adoptStyleSheets(document.adoptedStyleSheets,ce.getId(document))};try{let st=[],oe=bt=>{var pe;return nt(lF)({mutationCb:Li,mousemoveCb:(dt,Ea)=>vt({type:rt.IncrementalSnapshot,data:{source:Ea,positions:dt}}),mouseInteractionCb:dt=>vt({type:rt.IncrementalSnapshot,data:z({source:et.MouseInteraction},dt)}),scrollCb:Xh,viewportResizeCb:dt=>vt({type:rt.IncrementalSnapshot,data:z({source:et.ViewportResize},dt)}),inputCb:dt=>vt({type:rt.IncrementalSnapshot,data:z({source:et.Input},dt)}),mediaInteractionCb:dt=>vt({type:rt.IncrementalSnapshot,data:z({source:et.MediaInteraction},dt)}),styleSheetRuleCb:dt=>vt({type:rt.IncrementalSnapshot,data:z({source:et.StyleSheetRule},dt)}),styleDeclarationCb:dt=>vt({type:rt.IncrementalSnapshot,data:z({source:et.StyleDeclaration},dt)}),canvasMutationCb:Wh,fontCb:dt=>vt({type:rt.IncrementalSnapshot,data:z({source:et.Font},dt)}),selectionCb:dt=>{vt({type:rt.IncrementalSnapshot,data:z({source:et.Selection},dt)})},customElementCb:dt=>{vt({type:rt.IncrementalSnapshot,data:z({source:et.CustomElement},dt)})},blockClass:p,ignoreClass:m,ignoreSelector:d,maskTextClass:b,maskTextSelector:v,maskInputOptions:Sa,inlineStylesheet:I,sampling:x,recordDOM:ot,recordCanvas:lt,inlineImages:P,inlineVideos:O,userTriggeredOnInput:Z,collectFonts:D,doc:bt,maskInputFn:V,maskTextFn:N,keepIframeSrcFn:ct,blockSelector:f,slimDOMOptions:wa,dataURLOptions:Oi,mirror:ce,iframeManager:$e,stylesheetManager:Qe,shadowDomManager:Xi,processedNodeManager:Ta,canvasManager:pi,ignoreCSSAttributes:We,privacySetting:Ot,plugins:((pe=it==null?void 0:it.filter(dt=>dt.observer))==null?void 0:pe.map(dt=>({observer:dt.observer,options:dt.options,callback:Ea=>vt({type:rt.Plugin,data:{plugin:dt.name,payload:Ea}})})))||[]},U)};$e.addLoadListener(bt=>{try{st.push(oe(bt.contentDocument))}catch(pe){console.warn(pe)}});let gt=()=>{Gs(),st.push(oe(document)),ia=!0};return document.readyState==="interactive"||document.readyState==="complete"?gt():(st.push(Pt("DOMContentLoaded",()=>{vt({type:rt.DomContentLoaded,data:{}}),g==="DOMContentLoaded"&&gt()})),st.push(Pt("load",()=>{vt({type:rt.Load,data:{}}),g==="load"&&gt()},window))),()=>{st.forEach(bt=>bt()),Ta.destroy(),ia=!1,BP()}}catch(st){console.warn(st)}}function RF(t){typeof t!="string"&&(t=""),t=t.replace(/\s/g,"");let e=t.split(","),n=e.lastIndexOf("");for(;n>=0;)e[n-1]+=",",e.splice(n,1),n=e.lastIndexOf("");return e}function kF(t,e){let n=e.slice(0,e.length-1);for(let r=0;r<n.length;r++)n[r]=t[n[r].toLowerCase()];return n}function VF(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&t.attachEvent(`on${e}`,()=>{n(window.event)})}function xF(t,e,n){let r;if(e.scope===n||e.scope==="all"){r=e.mods.length>0;for(let i in Mt)Object.prototype.hasOwnProperty.call(Mt,i)&&(!Mt[i]&&e.mods.indexOf(+i)>-1||Mt[i]&&e.mods.indexOf(+i)===-1)&&(r=!1);(e.mods.length===0&&!Mt[16]&&!Mt[18]&&!Mt[17]&&!Mt[91]||r||e.shortcut==="*")&&e.method(t,e)===!1&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0))}}function NF(t){let e=Ie["*"],n=t.keyCode||t.which||t.charCode;if((n===93||n===224)&&(n=91),Ut.indexOf(n)===-1&&n!==229&&Ut.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach(r=>{let i=pb[r];t[r]&&Ut.indexOf(i)===-1?Ut.push(i):!t[r]&&Ut.indexOf(i)>-1?Ut.splice(Ut.indexOf(i),1):r==="metaKey"&&t[r]&&Ut.length===3&&(t.ctrlKey||t.shiftKey||t.altKey||(Ut=Ut.slice(Ut.indexOf(i))))}),!(n in Mt&&(Mt[n]=!0,!e))){for(let r in Mt)Object.prototype.hasOwnProperty.call(Mt,r)&&(Mt[r]=t[pb[r]]);if(t.getModifierState&&!(t.altKey&&!t.ctrlKey)&&t.getModifierState("AltGraph")&&(Ut.indexOf(17)===-1&&Ut.push(17),Ut.indexOf(18)===-1&&Ut.push(18),Mt[17]=!0,Mt[18]=!0),n in Ie){for(let r=0;r<Ie[n].length;r++)if((t.type==="keydown"&&Ie[n][r].keydown||t.type==="keyup"&&Ie[n][r].keyup)&&Ie[n][r].key){let i=Ie[n][r];xF(t,i,"all")}}}}function WF(t){let e;try{if(e=mb&&(self.URL||self.webkitURL).createObjectURL(mb),!e)throw"";let n=new Worker(e,{name:t==null?void 0:t.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),n}catch(n){return new Worker("data:text/javascript;base64,"+D0,{name:t==null?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}var UG,MG,Oe,PG,zt,FG,yb,Bn,AG,JG,DG,Ls,gb,bb,$c,$,rr,ai,di,ir,HG,tu,jG,Sb,wb,QG,tr,eu,A,w,nL,dL,Cb,vL,Zb,wL,TL,RL,CL,VL,xL,sh,NL,OL,GL,LL,XL,eg,Gc,Nb,WL,ru,Xs,Rs,UL,jn,ng,ML,PL,FL,Lc,AL,JL,Xc,iu,DL,YL,Ws,Cs,ou,Gb,Us,jr,Xb,Wb,qL,tX,eX,nX,rX,iX,oX,sX,aX,Ub,rg,hX,pX,Mb,ig,dX,og,fX,mX,yX,gX,bX,Wc,au,ah,lu,vX,cu,aa,Ms,lh,SX,sg,ie,ze,uu,wX,Ht,la,IX,TX,Pb,li,EX,Zs,wn,RX,Fb,CX,ZX,kX,VX,xX,NX,OX,GX,ag,LX,XX,MX,hu,FX,lg,AX,pu,JX,DX,Ps,In,YX,KX,_X,Fs,Yb,Kb,du,z,Yt,or,Y,Dt,HX,zX,BX,jX,QX,k,cg,$X,qX,ug,Et,hg,pg,es,tW,Uc,Mc,xt,As,dg,IW,TW,EW,RW,kW,VW,xW,NW,OW,GW,LW,XW,Qb,WW,UW,mi,Qn,fg,PW,FW,mg,ph,_,nv,$W,qW,t2,ue,gg,bg,yu,dh,vg,gu,iv,n2,ca,Zi,r2,i2,o2,Qr,s2,Su,ua,a2,wu,ha,l2,Iu,pa,ov,sv,c2,av,lv,fh,cv,uv,mh,Le,Rn,fv,Hs,yh,u2,mv,yv,yi,gh,h2,p2,d2,f2,m2,Pc,y2,Sg,wg,Tu,gv,b2,Eu,Ru,v2,S2,Ig,rs,Tg,w2,Fc,Ac,I2,Eg,zs,da,bv,vv,Sv,ar,ki,gi,wv,Iv,T2,Bs,bh,E2,R2,C2,Z2,k2,V2,x2,N2,ks,Tv,Ev,Rv,Cv,Vs,Rg,O2,G2,L2,X2,Zv,Jc,Cg,is,Zg,os,qr,ss,as,ls,W2,U2,M2,P2,F2,A2,J2,D2,Y2,K2,cs,us,_2,kg,H2,z2,B2,j2,Q2,Vg,$2,xg,tU,eU,nU,rU,iU,vh,Cu,kv,oU,Zu,Sh,Ng,Vv,sU,aU,lU,cU,Og,uU,hU,Se,pU,dU,fU,mU,yU,lr,Vu,cr,Ov,gU,bU,vU,SU,wU,xu,IU,TU,EU,RU,CU,vi,ZU,Gv,Lv,kU,VU,Xv,Wv,xU,NU,OU,GU,LU,XU,wh,WU,Uv,Mv,UU,MU,PU,FU,re,Ih,H,Pv,JU,DU,YU,he,Lg,Xg,Nu,Th,Wg,Ou,Av,_U,fa,Vi,HU,zU,BU,ei,jU,Xu,ma,QU,Wu,ya,$U,Uu,ga,Jv,Dv,qU,Yv,Kv,Eh,_v,Hv,Rh,Xe,Cn,Qv,Qs,Ch,tM,$v,qv,Si,Zh,eM,nM,rM,iM,oM,Dc,sM,Ug,Mg,Mu,t0,lM,Pu,Fu,cM,uM,Pg,hs,Fg,hM,Yc,Kc,pM,Ag,$s,ba,e0,n0,r0,ur,xi,wi,i0,o0,dM,qs,kh,fM,mM,yM,gM,bM,vM,SM,wM,xs,s0,a0,l0,c0,Ns,Jg,IM,TM,EM,RM,u0,_c,Dg,ps,Yg,ds,ri,fs,ms,ys,CM,ZM,kM,VM,xM,NM,OM,GM,LM,XM,gs,bs,WM,Kg,UM,MM,PM,FM,AM,_g,JM,Hg,YM,KM,_M,HM,zM,Vh,Au,h0,BM,Ju,xh,zg,p0,jM,QM,$M,qM,Bg,tP,eP,we,nP,rP,iP,oP,sP,hr,Yu,pr,m0,aP,lP,cP,uP,hP,Ku,pP,dP,fP,mP,yP,Ti,gP,y0,g0,bP,vP,b0,v0,SP,wP,IP,TP,EP,RP,Nh,CP,S0,w0,ZP,kP,_u,Qg,$g,vs,VP,Hc,zc,q,$n,qg,ea,AP,Bu,rt,et,Jt,_e,dr,qn,G0,ju,eb,Qu,hi,nt,Tn,qP,ib,ra,qu,th,nr,cF,oi,uF,ob,M0,P0,F0,A0,mF,lb,eh,nh,rh,vt,Gs,pi,ia,ce,cb,ub,gF,bF,vF,SF,wF,IF,hb,jc,TF,EF,Ut,Ie,Qc,CF,pb,Mt,J0,ZF,db,fb,Ri,OF,GF,LF,D0,XF,mb,Ne,UF,MF,PF,FF,ih,Ci,Nc=Jh(()=>{"use strict";UG=Object.defineProperty,MG=(t,e,n)=>e in t?UG(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Oe=(t,e,n)=>MG(t,typeof e!="symbol"?e+"":e,n),PG=(t,e,n)=>new Promise((r,i)=>{var o=c=>{try{a(n.next(c))}catch(l){i(l)}},s=c=>{try{a(n.throw(c))}catch(l){i(l)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(o,s);a((n=n.apply(t,e)).next())}),zt=(t,e,...n)=>{let r=`[@launchdarkly plugins]: (${t}): `;console[e].apply(console,[r,...n]),FG(r,...n)},FG=(t,...e)=>PG(void 0,null,function*(){try{let{LDObserve:n}=yield Promise.resolve().then(()=>(By(),zy));n.recordLog(`${t}${e}`,"warn")}catch(n){}}),yb=class{constructor(t,e){Oe(this,"debug"),Oe(this,"name"),this.debug=t,this.name=e}log(...t){if(this.debug){let e=`[${Date.now()}]`;this.name&&(e+=` - ${this.name}`),console.log.apply(console,[e,...t])}}warn(...t){let e=`[${Date.now()}]`;this.name&&(e+=` - ${this.name}`),console.warn.apply(console,[e,...t])}},Bn=class{constructor(){Oe(this,"_sdk"),Oe(this,"_isLoaded",!1),Oe(this,"_callBuffer",[]),Oe(this,"_capacity",1e5),Oe(this,"_droppedEvents",0),Oe(this,"_exceededCapacity",!1),Oe(this,"_logger",new yb)}h(e,n){if(this.Ln)try{return this.qn[e](...n)}catch(r){zt(`Error executing buffered call to ${e}:`,"error",r)}else{this.Jr({method:e,args:n});return}}Jr(e){this.En.length<this.Ys?(this.En.push(e),this.tr=!1):(this.tr||(this.tr=!0,zt("Exceeded event queue capacity. Increase capacity to avoid dropping events.","warn")),this.Ks+=1)}load(e){this.qn=e,this.Ln=!0;for(let{method:n,args:r}of this.En)try{this.qn[n](...r)}catch(i){zt(`Error executing buffered call to ${n}:`,"error",i)}this.En=[]}},AG=Object.defineProperty,JG=Object.defineProperties,DG=Object.getOwnPropertyDescriptors,Ls=Object.getOwnPropertySymbols,gb=Object.prototype.hasOwnProperty,bb=Object.prototype.propertyIsEnumerable,$c=(t,e,n)=>e in t?AG(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$=(t,e)=>{for(var n in e||(e={}))gb.call(e,n)&&$c(t,n,e[n]);if(Ls)for(var n of Ls(e))bb.call(e,n)&&$c(t,n,e[n]);return t},rr=(t,e)=>JG(t,DG(e)),ai=(t,e)=>{var n={};for(var r in t)gb.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Ls)for(var r of Ls(t))e.indexOf(r)<0&&bb.call(t,r)&&(n[r]=t[r]);return n},di=(t,e,n)=>$c(t,typeof e!="symbol"?e+"":e,n),ir=(t,e,n)=>new Promise((r,i)=>{var o=c=>{try{a(n.next(c))}catch(l){i(l)}},s=c=>{try{a(n.throw(c))}catch(l){i(l)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(o,s);a((n=n.apply(t,e)).next())});HG=/\r\n|[\n\r]/g;tu=class t extends Error{constructor(e,...n){var r,i,o;let{nodes:s,source:a,positions:c,path:l,originalError:u,extensions:h}=BG(n);super(e),this.name="GraphQLError",this.path=l!=null?l:void 0,this.originalError=u!=null?u:void 0,this.nodes=Qy(Array.isArray(s)?s:s?[s]:void 0);let p=Qy((r=this.nodes)===null||r===void 0?void 0:r.map(m=>m.loc).filter(m=>m!=null));this.source=a!=null?a:p==null||(i=p[0])===null||i===void 0?void 0:i.source,this.positions=c!=null?c:p==null?void 0:p.map(m=>m.start),this.locations=c&&a?c.map(m=>qc(a,m)):p==null?void 0:p.map(m=>qc(m.source,m.start));let f=KG(u==null?void 0:u.extensions)?u==null?void 0:u.extensions:void 0;this.extensions=(o=h!=null?h:f)!==null&&o!==void 0?o:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),u!=null&&u.stack?Object.defineProperty(this,"stack",{value:u.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(let n of this.nodes)n.loc&&(e+=`
22
+ You tried to parse Less with the standard CSS parser; try again with the postcss-less parser`)),i}return r.root}function ii(t){return typeof t=="object"&&typeof t.then=="function"}function d0(t){let e=!1,n=iP[t.type];return t.type==="decl"?e=t.prop.toLowerCase():t.type==="atrule"&&(e=t.name.toLowerCase()),e&&t.append?[n,n+"-"+e,hr,n+"Exit",n+"Exit-"+e]:e?[n,n+"-"+e,n+"Exit",n+"Exit-"+e]:t.append?[n,hr,n+"Exit"]:[n,n+"Exit"]}function jg(t){let e;return t.type==="document"?e=["Document",hr,"DocumentExit"]:t.type==="root"?e=["Root",hr,"RootExit"]:e=d0(t),{eventIndex:0,events:e,iterator:0,node:t,visitorIndex:0,visitors:[]}}function Du(t){return t[we]=!1,t.nodes&&t.nodes.forEach(e=>Du(e)),t}function pt(...t){return t.length===1&&Array.isArray(t[0])&&(t=t[0]),new Nh(t)}function Oh(t){if(vs[t])return vs[t];let e=globalThis[t],n=e.prototype,r=t in Qg?Qg[t]:void 0,i=!!(r&&r.every(a=>{var c,l;return!!((l=(c=Object.getOwnPropertyDescriptor(n,a))==null?void 0:c.get)!=null&&l.toString().includes("[native code]"))})),o=t in $g?$g[t]:void 0,s=!!(o&&o.every(a=>{var c;return typeof n[a]=="function"&&((c=n[a])==null?void 0:c.toString().includes("[native code]"))}));if(i&&s&&!VP())return vs[t]=e.prototype,e.prototype;try{let a=document.createElement("iframe");document.body.appendChild(a);let c=a.contentWindow;if(!c)return e.prototype;let l=c[t].prototype;return document.body.removeChild(a),l?vs[t]=l:n}catch(a){return n}}function je(t,e,n){var r;let i=`${t}.${String(n)}`;if(Hc[i])return Hc[i].call(e);let o=Oh(t),s=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return s?(Hc[i]=s,s.call(e)):e[n]}function I0(t,e,n){let r=`${t}.${String(n)}`;if(zc[r])return zc[r].bind(e);let i=Oh(t)[n];return typeof i!="function"?e[n]:(zc[r]=i,i.bind(e))}function xP(t){return je("Node",t,"childNodes")}function NP(t){return je("Node",t,"parentNode")}function OP(t){return je("Node",t,"parentElement")}function GP(t){return je("Node",t,"textContent")}function LP(t,e){return I0("Node",t,"contains")(e)}function XP(t){return I0("Node",t,"getRootNode")()}function WP(t){return!t||!("host"in t)?null:je("ShadowRoot",t,"host")}function UP(t){return t.styleSheets}function MP(t){return!t||!("shadowRoot"in t)?null:je("Element",t,"shadowRoot")}function PP(t,e){return je("Element",t,"querySelector")(e)}function FP(t,e){return je("Element",t,"querySelectorAll")(e)}function T0(){return Oh("MutationObserver").constructor}function Zn(t,e,n){try{if(!(e in t))return()=>{};let r=t[e],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),t[e]=i,()=>{t[e]=r}}catch(r){return()=>{}}}function Pt(t,e,n=document){let r={capture:!0};return n.addEventListener(t,e,r),()=>n.removeEventListener(t,e,r)}function Ei(t,e,n={}){let r=null,i=0;return function(...o){let s=Date.now();!i&&n.leading===!1&&(i=s);let a=e-(s-i),c=this;a<=0||a>e?(r&&(clearTimeout(r),r=null),i=s,t.apply(c,o)):!r&&n.trailing!==!1&&(r=setTimeout(()=>{i=n.leading===!1?0:Date.now(),r=null,t.apply(c,o)},a))}}function va(t,e,n,r,i=window){let o=i.Object.getOwnPropertyDescriptor(t,e);return i.Object.defineProperty(t,e,r?n:{set(s){setTimeout(()=>{n.set.call(this,s)},0),o&&o.set&&o.set.call(this,s)}}),()=>va(t,e,o||{},!0)}function E0(t){var e,n,r,i;let o=t.document;return{left:o.scrollingElement?o.scrollingElement.scrollLeft:t.pageXOffset!==void 0?t.pageXOffset:o.documentElement.scrollLeft||(o==null?void 0:o.body)&&((e=q.parentElement(o.body))==null?void 0:e.scrollLeft)||((n=o==null?void 0:o.body)==null?void 0:n.scrollLeft)||0,top:o.scrollingElement?o.scrollingElement.scrollTop:t.pageYOffset!==void 0?t.pageYOffset:(o==null?void 0:o.documentElement.scrollTop)||(o==null?void 0:o.body)&&((r=q.parentElement(o.body))==null?void 0:r.scrollTop)||((i=o==null?void 0:o.body)==null?void 0:i.scrollTop)||0}}function R0(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function C0(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Z0(t){return t?t.nodeType===t.ELEMENT_NODE?t:q.parentElement(t):null}function Nt(t,e,n,r){if(!t)return!1;let i=Z0(t);if(!i)return!1;try{if(typeof e=="string"){if(i.classList.contains(e)||r&&i.closest("."+e)!==null)return!0}else if(_s(i,e,r))return!0}catch(o){}return!!(n&&(i.matches(n)||r&&i.closest(n)!==null))}function JP(t,e){return e.getId(t)!==-1}function Bc(t,e,n){return t.tagName==="TITLE"&&n.headTitleMutations?!0:e.getId(t)===mi}function k0(t,e){if(ci(t))return!1;let n=e.getId(t);if(!e.has(n))return!0;let r=q.parentNode(t);return r&&r.nodeType===t.DOCUMENT_NODE?!1:r?k0(r,e):!0}function Hu(t){return!!t.changedTouches}function DP(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function V0(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function x0(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function zu(t){return t?t instanceof _u&&"shadowRoot"in t?!!t.shadowRoot:!!q.shadowRoot(t):!1}function N0(t){var e;let n=null;return"getRootNode"in t&&((e=q.getRootNode(t))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&q.host(q.getRootNode(t))&&(n=q.host(q.getRootNode(t))),n}function YP(t){let e=t,n;for(;n=N0(e);)e=n;return e}function KP(t){let e=t.ownerDocument;if(!e)return!1;let n=YP(t);return q.contains(e,n)}function O0(t){let e=t.ownerDocument;return e?q.contains(e,t)||KP(t):!1}function tb(t){return"__ln"in t}function $u(t,e){t.delete(e),q.childNodes(e).forEach(n=>$u(t,n))}function _P(t,e){let n=[t];for(;n.length;){let r=n.pop();e.has(r)||(e.add(r),q.childNodes(r).forEach(i=>n.push(i)))}}function nb(t,e,n){return t.size===0?!1:HP(t,e)}function HP(t,e,n){let r=q.parentNode(e);return r?t.has(r):!1}function rb(t,e){return t.size===0?!1:L0(t,e)}function L0(t,e){let n=q.parentNode(e);return n?t.has(n)?!0:L0(t,n):!1}function zP(t){hi=t}function BP(){hi=void 0}function Ni(t){try{if("composedPath"in t){let e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch(e){}return t&&t.target}function X0(t,e){let n=new Qu;Tn.push(n),n.init(t);let r=new(T0())(nt(n.processMutations.bind(n)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function jP({mousemoveCb:t,sampling:e,doc:n,mirror:r}){if(e.mousemove===!1)return()=>{};let i=typeof e.mousemove=="number"?e.mousemove:50,o=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500,s=[],a,c=Ei(nt(h=>{let p=Date.now()-a;t(s.map(f=>(f.timeOffset-=p,f)),h),s=[],a=null}),o),l=nt(Ei(nt(h=>{let p=Ni(h),{clientX:f,clientY:m}=Hu(h)?h.changedTouches[0]:h;a||(a=ea()),s.push({x:f,y:m,id:r.getId(p),timeOffset:ea()-a}),c(typeof DragEvent<"u"&&h instanceof DragEvent?et.Drag:h instanceof MouseEvent?et.MouseMove:et.TouchMove)}),i,{trailing:!1})),u=[Pt("mousemove",l,n),Pt("touchmove",l,n),Pt("drag",l,n)];return nt(()=>{u.forEach(h=>h())})}function QP({mouseInteractionCb:t,doc:e,mirror:n,blockClass:r,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};let s=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,a=[],c=null,l=u=>h=>{let p=Ni(h);if(Nt(p,r,i,!0)||AP(p))return;let f=null,m=u;if("pointerType"in h){switch(h.pointerType){case"mouse":f=_e.Mouse;break;case"touch":f=_e.Touch;break;case"pen":f=_e.Pen;break}f===_e.Touch&&(Jt[u]===Jt.MouseDown?m="TouchStart":Jt[u]===Jt.MouseUp&&(m="TouchEnd"))}else Hu(h)&&(f=_e.Touch);f!==null?(c=f,(m.startsWith("Touch")&&f===_e.Touch||m.startsWith("Mouse")&&f===_e.Mouse)&&(f=null)):Jt[u]===Jt.Click&&(f=c,c=null);let d=Hu(h)?h.changedTouches[0]:h;if(!d)return;let b=n.getId(p),{clientX:v,clientY:I}=d;nt(t)(z({type:Jt[m],id:b,x:v,y:I},f!==null&&{pointerType:f}))};return Object.keys(Jt).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&s[u]!==!1).forEach(u=>{let h=sr(u),p=l(u);if(window.PointerEvent)switch(Jt[u]){case Jt.MouseDown:case Jt.MouseUp:h=h.replace("mouse","pointer");break;case Jt.TouchStart:case Jt.TouchEnd:return}a.push(Pt(h,p,e))}),nt(()=>{a.forEach(u=>u())})}function W0({scrollCb:t,doc:e,mirror:n,blockClass:r,blockSelector:i,sampling:o}){let s=nt(Ei(nt(a=>{let c=Ni(a);if(!c||Nt(c,r,i,!0))return;let l=n.getId(c);if(c===e&&e.defaultView){let u=E0(e.defaultView);t({id:l,x:u.left,y:u.top})}else t({id:l,x:c.scrollLeft,y:c.scrollTop})}),o.scroll||100));return Pt("scroll",s,e)}function $P({viewportResizeCb:t},{win:e}){let n=-1,r=-1,i=nt(Ei(nt(()=>{let o=R0(),s=C0();(n!==o||r!==s)&&(t({width:Number(s),height:Number(o)}),n=o,r=s)}),200));return Pt("resize",i,e)}function tF({inputCb:t,doc:e,mirror:n,blockClass:r,blockSelector:i,ignoreClass:o,ignoreSelector:s,maskInputOptions:a,maskInputFn:c,sampling:l,userTriggeredOnInput:u}){function h(v){let I=Ni(v),R=v.isTrusted,E=I&&I.tagName;if(I&&E==="OPTION"&&(I=q.parentElement(I)),!I||!E||qP.indexOf(E)<0||Nt(I,r,i,!0)||I.classList.contains(o)||s&&I.matches(s))return;let T=I.value,V=!1,N=Ds(I)||"",U=I.getAttribute("data-hl-record");N==="radio"||N==="checkbox"?V=I.checked:Qb({maskInputOptions:a,type:N,tagName:E,overwriteRecord:U})&&(T=Js({element:I,maskInputOptions:a,tagName:E,type:N,value:T,overwriteRecord:U,maskInputFn:c})),p(I,u?{text:T,isChecked:V,userTriggered:R}:{text:T,isChecked:V});let C=I.name;N==="radio"&&C&&V&&e.querySelectorAll(`input[type="radio"][name="${C}"]`).forEach(x=>{if(x!==I){let M=x.value;p(x,u?{text:M,isChecked:!V,userTriggered:!1}:{text:M,isChecked:!V})}})}function p(v,I){let R=ib.get(v);if(!R||R.text!==I.text||R.isChecked!==I.isChecked){ib.set(v,I);let E=n.getId(v);nt(t)(Yt(z({},I),{id:E}))}}let f=(l.input==="last"?["change"]:["input","change"]).map(v=>Pt(v,nt(h),e)),m=e.defaultView;if(!m)return()=>{f.forEach(v=>v())};let d=m.Object.getOwnPropertyDescriptor(m.HTMLInputElement.prototype,"value"),b=[[m.HTMLInputElement.prototype,"value"],[m.HTMLInputElement.prototype,"checked"],[m.HTMLSelectElement.prototype,"value"],[m.HTMLTextAreaElement.prototype,"value"],[m.HTMLSelectElement.prototype,"selectedIndex"],[m.HTMLOptionElement.prototype,"selected"]];return d&&d.set&&f.push(...b.map(v=>va(v[0],v[1],{set(){nt(h)({target:this,isTrusted:!1})}},!1,m))),nt(()=>{f.forEach(v=>v())})}function na(t){let e=[];function n(r,i){if(Ss("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Ss("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Ss("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Ss("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){let o=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(o)}else if(r.parentStyleSheet){let o=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(o)}return i}return n(t,e)}function He(t,e,n){let r,i;return t?(t.ownerNode?r=e.getId(t.ownerNode):i=n.getId(t),{styleId:i,id:r}):{}}function eF({styleSheetRuleCb:t,mirror:e,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};let i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=new Proxy(i,{apply:nt((u,h,p)=>{let[f,m]=p,{id:d,styleId:b}=He(h,e,n.styleMirror);return(d&&d!==-1||b&&b!==-1)&&t({id:d,styleId:b,adds:[{rule:f,index:m}]}),u.apply(h,p)})}),r.CSSStyleSheet.prototype.addRule=function(u,h,p=this.cssRules.length){let f=`${u} { ${h} }`;return r.CSSStyleSheet.prototype.insertRule.apply(this,[f,p])};let o=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=new Proxy(o,{apply:nt((u,h,p)=>{let[f]=p,{id:m,styleId:d}=He(h,e,n.styleMirror);return(m&&m!==-1||d&&d!==-1)&&t({id:m,styleId:d,removes:[{index:f}]}),u.apply(h,p)})}),r.CSSStyleSheet.prototype.removeRule=function(u){return r.CSSStyleSheet.prototype.deleteRule.apply(this,[u])};let s;r.CSSStyleSheet.prototype.replace&&(s=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=new Proxy(s,{apply:nt((u,h,p)=>{let[f]=p,{id:m,styleId:d}=He(h,e,n.styleMirror);return(m&&m!==-1||d&&d!==-1)&&t({id:m,styleId:d,replace:f}),u.apply(h,p)})}));let a;r.CSSStyleSheet.prototype.replaceSync&&(a=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=new Proxy(a,{apply:nt((u,h,p)=>{let[f]=p,{id:m,styleId:d}=He(h,e,n.styleMirror);return(m&&m!==-1||d&&d!==-1)&&t({id:m,styleId:d,replaceSync:f}),u.apply(h,p)})}));let c={};ws("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(ws("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),ws("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),ws("CSSSupportsRule")&&(c.CSSSupportsRule=r.CSSSupportsRule));let l={};return Object.entries(c).forEach(([u,h])=>{l[u]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(l[u].insertRule,{apply:nt((p,f,m)=>{let[d,b]=m,{id:v,styleId:I}=He(f.parentStyleSheet,e,n.styleMirror);return(v&&v!==-1||I&&I!==-1)&&t({id:v,styleId:I,adds:[{rule:d,index:[...na(f),b||0]}]}),p.apply(f,m)})}),h.prototype.deleteRule=new Proxy(l[u].deleteRule,{apply:nt((p,f,m)=>{let[d]=m,{id:b,styleId:v}=He(f.parentStyleSheet,e,n.styleMirror);return(b&&b!==-1||v&&v!==-1)&&t({id:b,styleId:v,removes:[{index:[...na(f),d]}]}),p.apply(f,m)})})}),nt(()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=o,s&&(r.CSSStyleSheet.prototype.replace=s),a&&(r.CSSStyleSheet.prototype.replaceSync=a),Object.entries(c).forEach(([u,h])=>{h.prototype.insertRule=l[u].insertRule,h.prototype.deleteRule=l[u].deleteRule})})}function U0({mirror:t,stylesheetManager:e},n){var r,i,o;let s=null;n.nodeName==="#document"?s=t.getId(n):s=t.getId(q.host(n));let a=n.nodeName==="#document"?(r=n.defaultView)==null?void 0:r.Document:(o=(i=n.ownerDocument)==null?void 0:i.defaultView)==null?void 0:o.ShadowRoot,c=a!=null&&a.prototype?Object.getOwnPropertyDescriptor(a==null?void 0:a.prototype,"adoptedStyleSheets"):void 0;return s===null||s===-1||!a||!c?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get(){var l;return(l=c.get)==null?void 0:l.call(this)},set(l){var u;let h=(u=c.set)==null?void 0:u.call(this,l);if(s!==null&&s!==-1)try{e.adoptStyleSheets(l,s)}catch(p){}return h}}),nt(()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:c.configurable,enumerable:c.enumerable,get:c.get,set:c.set})}))}function nF({styleDeclarationCb:t,mirror:e,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){let o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=new Proxy(o,{apply:nt((a,c,l)=>{var u;let[h,p,f]=l;if(n.has(h))return o.apply(c,[h,p,f]);let{id:m,styleId:d}=He((u=c.parentRule)==null?void 0:u.parentStyleSheet,e,r.styleMirror);return(m&&m!==-1||d&&d!==-1)&&t({id:m,styleId:d,set:{property:h,value:p,priority:f},index:na(c.parentRule)}),a.apply(c,l)})});let s=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=new Proxy(s,{apply:nt((a,c,l)=>{var u;let[h]=l;if(n.has(h))return s.apply(c,[h]);let{id:p,styleId:f}=He((u=c.parentRule)==null?void 0:u.parentStyleSheet,e,r.styleMirror);return(p&&p!==-1||f&&f!==-1)&&t({id:p,styleId:f,remove:{property:h},index:na(c.parentRule)}),a.apply(c,l)})}),nt(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}function rF({mediaInteractionCb:t,blockClass:e,blockSelector:n,mirror:r,sampling:i,doc:o}){let s=nt(c=>Ei(nt(l=>{let u=Ni(l);if(!u||Nt(u,e,n,!0))return;let{currentTime:h,volume:p,muted:f,playbackRate:m,loop:d}=u;t({type:c,id:r.getId(u),currentTime:h,volume:p,muted:f,playbackRate:m,loop:d})}),i.media||500)),a=[Pt("play",s(qn.Play),o),Pt("pause",s(qn.Pause),o),Pt("seeked",s(qn.Seeked),o),Pt("volumechange",s(qn.VolumeChange),o),Pt("ratechange",s(qn.RateChange),o)];return nt(()=>{a.forEach(c=>c())})}function iF({fontCb:t,doc:e}){let n=e.defaultView;if(!n)return()=>{};let r=[],i=new WeakMap,o=n.FontFace;n.FontFace=function(a,c,l){let u=new o(a,c,l);return i.set(u,{family:a,buffer:typeof c!="string",descriptors:l,fontSource:typeof c=="string"?c:JSON.stringify(Array.from(new Uint8Array(c)))}),u};let s=Zn(e.fonts,"add",function(a){return function(c){return setTimeout(nt(()=>{let l=i.get(c);l&&(t(l),i.delete(c))}),0),a.apply(this,[c])}});return r.push(()=>{n.FontFace=o}),r.push(s),nt(()=>{r.forEach(a=>a())})}function oF(t){let{doc:e,mirror:n,blockClass:r,blockSelector:i,selectionCb:o}=t,s=!0,a=nt(()=>{let c=e.getSelection();if(!c||s&&c!=null&&c.isCollapsed)return;s=c.isCollapsed||!1;let l=[],u=c.rangeCount||0;for(let h=0;h<u;h++){let p=c.getRangeAt(h),{startContainer:f,startOffset:m,endContainer:d,endOffset:b}=p;Nt(f,r,i,!0)||Nt(d,r,i,!0)||l.push({start:n.getId(f),startOffset:m,end:n.getId(d),endOffset:b})}o({ranges:l})});return a(),Pt("selectionchange",a)}function sF({doc:t,customElementCb:e}){let n=t.defaultView;return!n||!n.customElements?()=>{}:Zn(n.customElements,"define",function(r){return function(i,o,s){try{e({define:{name:i}})}catch(a){console.warn(`Custom element callback failed for ${i}`)}return r.apply(this,[i,o,s])}})}function aF(t,e){let{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:s,inputCb:a,mediaInteractionCb:c,styleSheetRuleCb:l,styleDeclarationCb:u,canvasMutationCb:h,fontCb:p,selectionCb:f,customElementCb:m}=t;t.mutationCb=(...d)=>{e.mutation&&e.mutation(...d),n(...d)},t.mousemoveCb=(...d)=>{e.mousemove&&e.mousemove(...d),r(...d)},t.mouseInteractionCb=(...d)=>{e.mouseInteraction&&e.mouseInteraction(...d),i(...d)},t.scrollCb=(...d)=>{e.scroll&&e.scroll(...d),o(...d)},t.viewportResizeCb=(...d)=>{e.viewportResize&&e.viewportResize(...d),s(...d)},t.inputCb=(...d)=>{e.input&&e.input(...d),a(...d)},t.mediaInteractionCb=(...d)=>{e.mediaInteaction&&e.mediaInteaction(...d),c(...d)},t.styleSheetRuleCb=(...d)=>{e.styleSheetRule&&e.styleSheetRule(...d),l(...d)},t.styleDeclarationCb=(...d)=>{e.styleDeclaration&&e.styleDeclaration(...d),u(...d)},t.canvasMutationCb=(...d)=>{e.canvasMutation&&e.canvasMutation(...d),h(...d)},t.fontCb=(...d)=>{e.font&&e.font(...d),p(...d)},t.selectionCb=(...d)=>{e.selection&&e.selection(...d),f(...d)},t.customElementCb=(...d)=>{e.customElement&&e.customElement(...d),m(...d)}}function lF(t,e={}){let n=t.doc.defaultView;if(!n)return()=>{};aF(t,e);let r;t.recordDOM&&(r=X0(t,t.doc));let i=jP(t),o=QP(t),s=W0(t),a=$P(t,{win:n}),c=tF(t),l=rF(t),u=()=>{},h=()=>{},p=()=>{},f=()=>{};t.recordDOM&&(u=eF(t,{win:n}),h=U0(t,t.doc),p=nF(t,{win:n}),t.collectFonts&&(f=iF(t)));let m=oF(t),d=sF(t),b=[];for(let v of t.plugins)b.push(v.observer(v.callback,n,v.options));return nt(()=>{Tn.forEach(v=>v.reset()),r==null||r.disconnect(),i(),o(),s(),a(),c(),l(),u(),h(),p(),f(),m(),d(),b.forEach(v=>v())})}function Ss(t){return typeof window[t]<"u"}function ws(t){return!!(typeof window[t]<"u"&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}function hF(t,e){let n=ob.get(t);return n||(n=new Map,ob.set(t,n)),n.has(e)||n.set(e,[]),n.get(e)}function Os(t,e,n){if(t instanceof Array)return t.map(r=>Os(r,e,n));if(t===null)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer){let r=t.constructor.name,i=uF(t);return{rr_type:r,base64:i}}else{if(t instanceof DataView)return{rr_type:t.constructor.name,args:[Os(t.buffer,e,n),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){let r=t.constructor.name,{src:i}=t;return{rr_type:r,src:i}}else if(t instanceof HTMLCanvasElement){let r="HTMLImageElement",i=t.toDataURL();return{rr_type:r,src:i}}else{if(t instanceof ImageData)return{rr_type:t.constructor.name,args:[Os(t.data,e,n),t.width,t.height]};if(F0(t,e)||typeof t=="object"){let r=t.constructor.name,i=M0(t,e,n);return{rr_type:r,index:i}}}}return t}function pF(t,e,n,r){let i=[],o=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(let s of o)try{if(typeof e.CanvasRenderingContext2D.prototype[s]!="function")continue;let a=Zn(e.CanvasRenderingContext2D.prototype,s,function(c){return function(...l){return Nt(this.canvas,n,r,!0)||setTimeout(()=>{let u=P0(l,e,this);t(this.canvas,{type:dr["2D"],property:s,args:u})},0),c.apply(this,l)}});i.push(a)}catch(a){let c=va(e.CanvasRenderingContext2D.prototype,s,{set(l){t(this.canvas,{type:dr["2D"],property:s,args:[l],setter:!0})}});i.push(c)}return()=>{i.forEach(s=>s())}}function dF(t){return t==="experimental-webgl"?"webgl":t}function sb(t,e,n,r){let i=[];try{let o=Zn(t.HTMLCanvasElement.prototype,"getContext",function(s){return function(a,...c){if(!Nt(this,e,n,!0)){let l=dF(a);if("__context"in this||(this.__context=l),r&&["webgl","webgl2"].includes(l))if(c[0]&&typeof c[0]=="object"){let u=c[0];u.preserveDrawingBuffer||(u.preserveDrawingBuffer=!0)}else c.splice(0,1,{preserveDrawingBuffer:!0})}return s.apply(this,[a,...c])}});i.push(o)}catch(o){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{i.forEach(o=>o())}}function ab(t,e,n,r,i,o){let s=[],a=Object.getOwnPropertyNames(t);for(let c of a)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(c))try{if(typeof t[c]!="function")continue;let l=Zn(t,c,function(u){return function(...h){let p=u.apply(this,h);if(M0(p,o,this),"tagName"in this.canvas&&!Nt(this.canvas,r,i,!0)){let f=P0(h,o,this),m={type:e,property:c,args:f};n(this.canvas,m)}return p}});s.push(l)}catch(l){let u=va(t,c,{set(h){n(this.canvas,{type:e,property:c,args:[h],setter:!0})}});s.push(u)}return s}function fF(t,e,n,r){let i=[];return i.push(...ab(e.WebGLRenderingContext.prototype,dr.WebGL,t,n,r,e)),typeof e.WebGL2RenderingContext<"u"&&i.push(...ab(e.WebGL2RenderingContext.prototype,dr.WebGL2,t,n,r,e)),()=>{i.forEach(o=>o())}}function yF(t){let e;try{if(e=lb&&(self.URL||self.webkitURL).createObjectURL(lb),!e)throw"";let n=new Worker(e,{name:t==null?void 0:t.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),n}catch(n){return new Worker("data:text/javascript;base64,"+A0,{name:t==null?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}function Ge(t={}){var e,n,r,i,o,s,a,c;let{emit:l,checkoutEveryNms:u,checkoutEveryNth:h,blockClass:p="highlight-block",blockSelector:f=null,ignoreClass:m="highlight-ignore",ignoreSelector:d=null,maskTextClass:b="highlight-mask",maskTextSelector:v=null,inlineStylesheet:I=!0,maskAllInputs:R,maskInputOptions:E,slimDOMOptions:T,maskInputFn:V,maskTextFn:N=uh,hooks:U,packFn:C,sampling:x={},mousemoveWait:M,recordDOM:ot=!0,recordCanvas:lt=!1,recordCrossOriginIframes:y=!1,recordAfter:g=t.recordAfter==="DOMContentLoaded"?t.recordAfter:"load",userTriggeredOnInput:Z=!1,collectFonts:D=!1,inlineImages:P=!1,inlineVideos:O=!1,plugins:it,keepIframeSrcFn:ct=()=>!1,privacySetting:Ot="default",ignoreCSSAttributes:We=new Set([]),errorHandler:Y0,logger:K0}=t,Oi=z(z({},t.dataURLOptions),(n=(e=t.sampling)==null?void 0:e.canvas)==null?void 0:n.dataURLOptions);zP(Y0);let Gi=y?window.parent===window:!0,mr=!1;if(!Gi)try{window.parent.document&&(mr=!1)}catch(at){mr=!0}if(Gi&&!l)throw new Error("emit function is required");if(!Gi&&!mr)return()=>{};M!==void 0&&x.mousemove===void 0&&(x.mousemove=M),ce.reset();let Sa=R===!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}:E!==void 0?E:{password:!0},wa=T===!0||T==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:T==="all",headMetaDescKeywords:T==="all",headTitleMutations:T==="all"}:T||{};DP();let Gh,Ia=0,Lh=at=>{for(let oe of it||[])oe.eventProcessor&&(at=oe.eventProcessor(at));return C&&!mr&&(at=C(at)),at};vt=(at,oe)=>{var gt;let bt=at;if(bt.timestamp=ea(),(gt=Tn[0])!=null&&gt.isFrozen()&&bt.type!==rt.FullSnapshot&&!(bt.type===rt.IncrementalSnapshot&&bt.data.source===et.Mutation)&&Tn.forEach(pe=>pe.unfreeze()),Gi)l==null||l(Lh(bt),oe);else if(mr){let pe={type:"rrweb",event:Lh(bt),origin:window.location.origin,isCheckout:oe};window.parent.postMessage(pe,"*")}if(bt.type===rt.FullSnapshot)Gh=bt,Ia=0;else if(bt.type===rt.IncrementalSnapshot){if(bt.data.source===et.Mutation&&bt.data.isAttachIframe)return;Ia++;let pe=h&&Ia>=h,dt=u&&bt.timestamp-Gh.timestamp>u;(pe||dt)&&Gs(!0)}};let Li=at=>{vt({type:rt.IncrementalSnapshot,data:z({source:et.Mutation},at)})},Xh=at=>vt({type:rt.IncrementalSnapshot,data:z({source:et.Scroll},at)}),Wh=at=>vt({type:rt.IncrementalSnapshot,data:z({source:et.CanvasMutation},at)}),_0=at=>vt({type:rt.IncrementalSnapshot,data:z({source:et.AdoptedStyleSheet},at)}),Qe=new nh({mutationCb:Li,adoptedStyleSheetCb:_0}),$e=new qu({mirror:ce,mutationCb:Li,stylesheetManager:Qe,recordCrossOriginIframes:y,wrappedEmit:vt});for(let at of it||[])at.getMirror&&at.getMirror({nodeMirror:ce,crossOriginIframeMirror:$e.crossOriginIframeMirror,crossOriginIframeStyleMirror:$e.crossOriginIframeStyleMirror});let Ta=new rh;pi=new eh({recordCanvas:lt,recordLocalVideos:P,recordRemoteVideos:O,mutationCb:Wh,win:window,blockClass:p,blockSelector:f,mirror:ce,sampling:(r=x==null?void 0:x.canvas)==null?void 0:r.fps,samplingManual:(i=x==null?void 0:x.canvas)==null?void 0:i.fpsManual,clearWebGLBuffer:(o=x==null?void 0:x.canvas)==null?void 0:o.clearWebGLBuffer,initialSnapshotDelay:(s=x==null?void 0:x.canvas)==null?void 0:s.initialSnapshotDelay,dataURLOptions:Oi,resizeFactor:(a=x==null?void 0:x.canvas)==null?void 0:a.resizeFactor,maxSnapshotDimension:(c=x==null?void 0:x.canvas)==null?void 0:c.maxSnapshotDimension,logger:K0});let Xi=new th({mutationCb:Li,scrollCb:Xh,bypassOptions:{blockClass:p,blockSelector:f,maskTextClass:b,maskTextSelector:v,inlineStylesheet:I,maskInputOptions:Sa,dataURLOptions:Oi,maskTextFn:N,maskInputFn:V,recordCanvas:lt,inlineImages:P,inlineVideos:O,privacySetting:Ot,sampling:x,slimDOMOptions:wa,iframeManager:$e,stylesheetManager:Qe,canvasManager:pi,keepIframeSrcFn:ct,processedNodeManager:Ta},mirror:ce});Gs=(at=!1)=>{if(!ot)return;vt({type:rt.Meta,data:{href:window.location.href,width:C0(),height:R0()}},at),Qe.reset(),Xi.init(),Tn.forEach(gt=>gt.lock());let oe=jW(document,{mirror:ce,blockClass:p,blockSelector:f,maskTextClass:b,maskTextSelector:v,inlineStylesheet:I,maskAllInputs:Sa,maskTextFn:N,maskInputFn:V,slimDOM:wa,dataURLOptions:Oi,recordCanvas:lt,inlineImages:P,inlineVideos:O,privacySetting:Ot,onSerialize:gt=>{V0(gt,ce)&&$e.addIframe(gt),x0(gt,ce)&&Qe.trackLinkElement(gt),zu(gt)&&Xi.addShadowRoot(q.shadowRoot(gt),document)},onIframeLoad:(gt,bt)=>{$e.attachIframe(gt,bt),Xi.observeAttachShadow(gt)},onStylesheetLoad:(gt,bt)=>{Qe.attachLinkElement(gt,bt)},keepIframeSrcFn:ct});if(!oe)return console.warn("Failed to snapshot the document");vt({type:rt.FullSnapshot,data:{node:oe,initialOffset:E0(window)}},at),Tn.forEach(gt=>gt.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Qe.adoptStyleSheets(document.adoptedStyleSheets,ce.getId(document))};try{let at=[],oe=bt=>{var pe;return nt(lF)({mutationCb:Li,mousemoveCb:(dt,Ea)=>vt({type:rt.IncrementalSnapshot,data:{source:Ea,positions:dt}}),mouseInteractionCb:dt=>vt({type:rt.IncrementalSnapshot,data:z({source:et.MouseInteraction},dt)}),scrollCb:Xh,viewportResizeCb:dt=>vt({type:rt.IncrementalSnapshot,data:z({source:et.ViewportResize},dt)}),inputCb:dt=>vt({type:rt.IncrementalSnapshot,data:z({source:et.Input},dt)}),mediaInteractionCb:dt=>vt({type:rt.IncrementalSnapshot,data:z({source:et.MediaInteraction},dt)}),styleSheetRuleCb:dt=>vt({type:rt.IncrementalSnapshot,data:z({source:et.StyleSheetRule},dt)}),styleDeclarationCb:dt=>vt({type:rt.IncrementalSnapshot,data:z({source:et.StyleDeclaration},dt)}),canvasMutationCb:Wh,fontCb:dt=>vt({type:rt.IncrementalSnapshot,data:z({source:et.Font},dt)}),selectionCb:dt=>{vt({type:rt.IncrementalSnapshot,data:z({source:et.Selection},dt)})},customElementCb:dt=>{vt({type:rt.IncrementalSnapshot,data:z({source:et.CustomElement},dt)})},blockClass:p,ignoreClass:m,ignoreSelector:d,maskTextClass:b,maskTextSelector:v,maskInputOptions:Sa,inlineStylesheet:I,sampling:x,recordDOM:ot,recordCanvas:lt,inlineImages:P,inlineVideos:O,userTriggeredOnInput:Z,collectFonts:D,doc:bt,maskInputFn:V,maskTextFn:N,keepIframeSrcFn:ct,blockSelector:f,slimDOMOptions:wa,dataURLOptions:Oi,mirror:ce,iframeManager:$e,stylesheetManager:Qe,shadowDomManager:Xi,processedNodeManager:Ta,canvasManager:pi,ignoreCSSAttributes:We,privacySetting:Ot,plugins:((pe=it==null?void 0:it.filter(dt=>dt.observer))==null?void 0:pe.map(dt=>({observer:dt.observer,options:dt.options,callback:Ea=>vt({type:rt.Plugin,data:{plugin:dt.name,payload:Ea}})})))||[]},U)};$e.addLoadListener(bt=>{try{at.push(oe(bt.contentDocument))}catch(pe){console.warn(pe)}});let gt=()=>{Gs(),at.push(oe(document)),ia=!0};return document.readyState==="interactive"||document.readyState==="complete"?gt():(at.push(Pt("DOMContentLoaded",()=>{vt({type:rt.DomContentLoaded,data:{}}),g==="DOMContentLoaded"&&gt()})),at.push(Pt("load",()=>{vt({type:rt.Load,data:{}}),g==="load"&&gt()},window))),()=>{at.forEach(bt=>bt()),Ta.destroy(),ia=!1,BP()}}catch(at){console.warn(at)}}function RF(t){typeof t!="string"&&(t=""),t=t.replace(/\s/g,"");let e=t.split(","),n=e.lastIndexOf("");for(;n>=0;)e[n-1]+=",",e.splice(n,1),n=e.lastIndexOf("");return e}function kF(t,e){let n=e.slice(0,e.length-1);for(let r=0;r<n.length;r++)n[r]=t[n[r].toLowerCase()];return n}function VF(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&t.attachEvent(`on${e}`,()=>{n(window.event)})}function xF(t,e,n){let r;if(e.scope===n||e.scope==="all"){r=e.mods.length>0;for(let i in Mt)Object.prototype.hasOwnProperty.call(Mt,i)&&(!Mt[i]&&e.mods.indexOf(+i)>-1||Mt[i]&&e.mods.indexOf(+i)===-1)&&(r=!1);(e.mods.length===0&&!Mt[16]&&!Mt[18]&&!Mt[17]&&!Mt[91]||r||e.shortcut==="*")&&e.method(t,e)===!1&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0))}}function NF(t){let e=Ie["*"],n=t.keyCode||t.which||t.charCode;if((n===93||n===224)&&(n=91),Ut.indexOf(n)===-1&&n!==229&&Ut.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach(r=>{let i=pb[r];t[r]&&Ut.indexOf(i)===-1?Ut.push(i):!t[r]&&Ut.indexOf(i)>-1?Ut.splice(Ut.indexOf(i),1):r==="metaKey"&&t[r]&&Ut.length===3&&(t.ctrlKey||t.shiftKey||t.altKey||(Ut=Ut.slice(Ut.indexOf(i))))}),!(n in Mt&&(Mt[n]=!0,!e))){for(let r in Mt)Object.prototype.hasOwnProperty.call(Mt,r)&&(Mt[r]=t[pb[r]]);if(t.getModifierState&&!(t.altKey&&!t.ctrlKey)&&t.getModifierState("AltGraph")&&(Ut.indexOf(17)===-1&&Ut.push(17),Ut.indexOf(18)===-1&&Ut.push(18),Mt[17]=!0,Mt[18]=!0),n in Ie){for(let r=0;r<Ie[n].length;r++)if((t.type==="keydown"&&Ie[n][r].keydown||t.type==="keyup"&&Ie[n][r].keyup)&&Ie[n][r].key){let i=Ie[n][r];xF(t,i,"all")}}}}function WF(t){let e;try{if(e=mb&&(self.URL||self.webkitURL).createObjectURL(mb),!e)throw"";let n=new Worker(e,{name:t==null?void 0:t.name});return n.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(e)}),n}catch(n){return new Worker("data:text/javascript;base64,"+D0,{name:t==null?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}var UG,MG,Oe,PG,zt,FG,yb,Bn,AG,JG,DG,Ls,gb,bb,$c,$,rr,ai,di,ir,HG,tu,jG,Sb,wb,QG,tr,eu,A,w,nL,dL,Cb,vL,Zb,wL,TL,RL,CL,VL,xL,sh,NL,OL,GL,LL,XL,eg,Gc,Nb,WL,ru,Xs,Rs,UL,jn,ng,ML,PL,FL,Lc,AL,JL,Xc,iu,DL,YL,Ws,Cs,ou,Gb,Us,jr,Xb,Wb,qL,tX,eX,nX,rX,iX,oX,sX,aX,Ub,rg,hX,pX,Mb,ig,dX,og,fX,mX,yX,gX,bX,Wc,au,ah,lu,vX,cu,aa,Ms,lh,SX,sg,ie,ze,uu,wX,Ht,la,IX,TX,Pb,li,EX,Zs,wn,RX,Fb,CX,ZX,kX,VX,xX,NX,OX,GX,ag,LX,XX,MX,hu,FX,lg,AX,pu,JX,DX,Ps,In,YX,KX,_X,Fs,Yb,Kb,du,z,Yt,or,Y,Dt,HX,zX,BX,jX,QX,k,cg,$X,qX,ug,Et,hg,pg,es,tW,Uc,Mc,xt,As,dg,IW,TW,EW,RW,kW,VW,xW,NW,OW,GW,LW,XW,Qb,WW,UW,mi,Qn,fg,PW,FW,mg,ph,_,nv,$W,qW,t2,ue,gg,bg,yu,dh,vg,gu,iv,n2,ca,Zi,r2,i2,o2,Qr,s2,Su,ua,a2,wu,ha,l2,Iu,pa,ov,sv,c2,av,lv,fh,cv,uv,mh,Le,Rn,fv,Hs,yh,u2,mv,yv,yi,gh,h2,p2,d2,f2,m2,Pc,y2,Sg,wg,Tu,gv,b2,Eu,Ru,v2,S2,Ig,rs,Tg,w2,Fc,Ac,I2,Eg,zs,da,bv,vv,Sv,ar,ki,gi,wv,Iv,T2,Bs,bh,E2,R2,C2,Z2,k2,V2,x2,N2,ks,Tv,Ev,Rv,Cv,Vs,Rg,O2,G2,L2,X2,Zv,Jc,Cg,is,Zg,os,qr,ss,as,ls,W2,U2,M2,P2,F2,A2,J2,D2,Y2,K2,cs,us,_2,kg,H2,z2,B2,j2,Q2,Vg,$2,xg,tU,eU,nU,rU,iU,vh,Cu,kv,oU,Zu,Sh,Ng,Vv,sU,aU,lU,cU,Og,uU,hU,Se,pU,dU,fU,mU,yU,lr,Vu,cr,Ov,gU,bU,vU,SU,wU,xu,IU,TU,EU,RU,CU,vi,ZU,Gv,Lv,kU,VU,Xv,Wv,xU,NU,OU,GU,LU,XU,wh,WU,Uv,Mv,UU,MU,PU,FU,re,Ih,H,Pv,JU,DU,YU,he,Lg,Xg,Nu,Th,Wg,Ou,Av,_U,fa,Vi,HU,zU,BU,ei,jU,Xu,ma,QU,Wu,ya,$U,Uu,ga,Jv,Dv,qU,Yv,Kv,Eh,_v,Hv,Rh,Xe,Cn,Qv,Qs,Ch,tM,$v,qv,Si,Zh,eM,nM,rM,iM,oM,Dc,sM,Ug,Mg,Mu,t0,lM,Pu,Fu,cM,uM,Pg,hs,Fg,hM,Yc,Kc,pM,Ag,$s,ba,e0,n0,r0,ur,xi,wi,i0,o0,dM,qs,kh,fM,mM,yM,gM,bM,vM,SM,wM,xs,s0,a0,l0,c0,Ns,Jg,IM,TM,EM,RM,u0,_c,Dg,ps,Yg,ds,ri,fs,ms,ys,CM,ZM,kM,VM,xM,NM,OM,GM,LM,XM,gs,bs,WM,Kg,UM,MM,PM,FM,AM,_g,JM,Hg,YM,KM,_M,HM,zM,Vh,Au,h0,BM,Ju,xh,zg,p0,jM,QM,$M,qM,Bg,tP,eP,we,nP,rP,iP,oP,sP,hr,Yu,pr,m0,aP,lP,cP,uP,hP,Ku,pP,dP,fP,mP,yP,Ti,gP,y0,g0,bP,vP,b0,v0,SP,wP,IP,TP,EP,RP,Nh,CP,S0,w0,ZP,kP,_u,Qg,$g,vs,VP,Hc,zc,q,$n,qg,ea,AP,Bu,rt,et,Jt,_e,dr,qn,G0,ju,eb,Qu,hi,nt,Tn,qP,ib,ra,qu,th,nr,cF,oi,uF,ob,M0,P0,F0,A0,mF,lb,eh,nh,rh,vt,Gs,pi,ia,ce,cb,ub,gF,bF,vF,SF,wF,IF,hb,jc,TF,EF,Ut,Ie,Qc,CF,pb,Mt,J0,ZF,db,fb,Ri,OF,GF,LF,D0,XF,mb,Ne,UF,MF,PF,FF,ih,Ci,Nc=Jh(()=>{"use strict";UG=Object.defineProperty,MG=(t,e,n)=>e in t?UG(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Oe=(t,e,n)=>MG(t,typeof e!="symbol"?e+"":e,n),PG=(t,e,n)=>new Promise((r,i)=>{var o=c=>{try{a(n.next(c))}catch(l){i(l)}},s=c=>{try{a(n.throw(c))}catch(l){i(l)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(o,s);a((n=n.apply(t,e)).next())}),zt=(t,e,...n)=>{let r=`[@launchdarkly plugins]: (${t}): `;console[e].apply(console,[r,...n]),FG(r,...n)},FG=(t,...e)=>PG(void 0,null,function*(){try{let{LDObserve:n}=yield Promise.resolve().then(()=>(By(),zy));n.recordLog(`${t}${e}`,"warn")}catch(n){}}),yb=class{constructor(t,e){Oe(this,"debug"),Oe(this,"name"),this.debug=t,this.name=e}log(...t){if(this.debug){let e=`[${Date.now()}]`;this.name&&(e+=` - ${this.name}`),console.log.apply(console,[e,...t])}}warn(...t){let e=`[${Date.now()}]`;this.name&&(e+=` - ${this.name}`),console.warn.apply(console,[e,...t])}},Bn=class{constructor(){Oe(this,"_sdk"),Oe(this,"_isLoaded",!1),Oe(this,"_callBuffer",[]),Oe(this,"_capacity",1e5),Oe(this,"_droppedEvents",0),Oe(this,"_exceededCapacity",!1),Oe(this,"_logger",new yb)}h(e,n){if(this.Ln)try{return this.qn[e](...n)}catch(r){zt(`Error executing buffered call to ${e}:`,"error",r)}else{this.Jr({method:e,args:n});return}}Jr(e){this.En.length<this.Ys?(this.En.push(e),this.tr=!1):(this.tr||(this.tr=!0,zt("Exceeded event queue capacity. Increase capacity to avoid dropping events.","warn")),this.Ks+=1)}load(e){this.qn=e,this.Ln=!0;for(let{method:n,args:r}of this.En)try{this.qn[n](...r)}catch(i){zt(`Error executing buffered call to ${n}:`,"error",i)}this.En=[]}},AG=Object.defineProperty,JG=Object.defineProperties,DG=Object.getOwnPropertyDescriptors,Ls=Object.getOwnPropertySymbols,gb=Object.prototype.hasOwnProperty,bb=Object.prototype.propertyIsEnumerable,$c=(t,e,n)=>e in t?AG(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$=(t,e)=>{for(var n in e||(e={}))gb.call(e,n)&&$c(t,n,e[n]);if(Ls)for(var n of Ls(e))bb.call(e,n)&&$c(t,n,e[n]);return t},rr=(t,e)=>JG(t,DG(e)),ai=(t,e)=>{var n={};for(var r in t)gb.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Ls)for(var r of Ls(t))e.indexOf(r)<0&&bb.call(t,r)&&(n[r]=t[r]);return n},di=(t,e,n)=>$c(t,typeof e!="symbol"?e+"":e,n),ir=(t,e,n)=>new Promise((r,i)=>{var o=c=>{try{a(n.next(c))}catch(l){i(l)}},s=c=>{try{a(n.throw(c))}catch(l){i(l)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(o,s);a((n=n.apply(t,e)).next())});HG=/\r\n|[\n\r]/g;tu=class t extends Error{constructor(e,...n){var r,i,o;let{nodes:s,source:a,positions:c,path:l,originalError:u,extensions:h}=BG(n);super(e),this.name="GraphQLError",this.path=l!=null?l:void 0,this.originalError=u!=null?u:void 0,this.nodes=Qy(Array.isArray(s)?s:s?[s]:void 0);let p=Qy((r=this.nodes)===null||r===void 0?void 0:r.map(m=>m.loc).filter(m=>m!=null));this.source=a!=null?a:p==null||(i=p[0])===null||i===void 0?void 0:i.source,this.positions=c!=null?c:p==null?void 0:p.map(m=>m.start),this.locations=c&&a?c.map(m=>qc(a,m)):p==null?void 0:p.map(m=>qc(m.source,m.start));let f=KG(u==null?void 0:u.extensions)?u==null?void 0:u.extensions:void 0;this.extensions=(o=h!=null?h:f)!==null&&o!==void 0?o:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),u!=null&&u.stack?Object.defineProperty(this,"stack",{value:u.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(let n of this.nodes)n.loc&&(e+=`
23
23
 
24
24
  `+zG(n.loc));else if(this.source&&this.locations)for(let n of this.locations)e+=`
25
25
 
@@ -345,7 +345,7 @@ Project ID: ${this.sessionData.projectID}
345
345
  SessionSecureID: ${this.sessionData.sessionSecureID}`),this.options.sessionSecureID=this.sessionData.sessionSecureID,this.Qn.postMessage({message:{type:Ne.Initialize,sessionSecureID:this.sessionData.sessionSecureID,backend:this.mn,debug:!!this.debugOptions.clientInteractions,recordingStartTime:this.$n}});for(let v of this.Gn)v.init(this.sessionData.sessionSecureID);if(this.sessionData.userIdentifier&&this.identify(this.sessionData.userIdentifier,this.sessionData.userObject),this.pushPayloadTimerId&&(clearTimeout(this.pushPayloadTimerId),this.pushPayloadTimerId=void 0),this.ko||(this.pushPayloadTimerId=setTimeout(()=>{this.As()},rg)),this.options.disableSessionRecording){this.logger.log("Highlight is NOT RECORDING a session replay per H.init setting."),this.ready=!0,this.state="Recording",this.manualStopped=!1;return}let f=(v,I)=>{I&&this.logger.log("received isCheckout emit",{event:v}),this.events.push(v)};f.bind(this);let m=!!this.Tn;this.Tn&&(this.Tn(),this.Tn=void 0);let[d,b]=bF(this.privacySetting);this.Tn=Ge({ignoreClass:"highlight-ignore",blockClass:"highlight-block",emit:f,recordCrossOriginIframes:this.options.recordCrossOriginIframe,privacySetting:this.privacySetting,maskAllInputs:d,maskInputOptions:b,recordCanvas:this.enableCanvasRecording,sampling:{canvas:{fps:this.samplingStrategy.canvas,fpsManual:this.samplingStrategy.canvasManualSnapshot,resizeFactor:this.samplingStrategy.canvasFactor,clearWebGLBuffer:this.samplingStrategy.canvasClearWebGLBuffer,initialSnapshotDelay:this.samplingStrategy.canvasInitialSnapshotDelay,dataURLOptions:this.samplingStrategy.dataUrlOptions,maxSnapshotDimension:this.samplingStrategy.canvasMaxSnapshotDimension}},keepIframeSrcFn:v=>!this.options.recordCrossOriginIframe,inlineImages:this.inlineImages,inlineVideos:this.inlineVideos,collectFonts:this.inlineImages,inlineStylesheet:this.inlineStylesheet,plugins:[BX()],logger:typeof this.options.debug=="boolean"&&this.options.debug||typeof this.options.debug=="object"&&this.options.debug.domRecording?{debug:this.logger.log,warn:zt.bind("RecordSDK","warn")}:void 0}),m||this.options.recordCrossOriginIframe&&this.Tl(),document.referrer&&(window&&document.referrer.includes(window.location.origin)||(this.addCustomEvent("Referrer",document.referrer),this.addProperties({referrer:document.referrer},{type:"session"}))),this.El(),this.ready=!0,this.state="Recording",this.manualStopped=!1}catch(u){zt("initializeSession _setupWindowListeners","warn",u)}})}Js(e){return Dt(this,null,function*(){if(this.manualStopped){this.logger.log("Ignoring visibility event due to manual stop.");return}new Date().getTime()-this.Fs<dX||(this.Fs=new Date().getTime(),this.logger.log(`Detected window ${e?"hidden":"visible"}.`),e?(this.addCustomEvent("TabHidden",!0),this.options.disableBackgroundRecording&&this.stop()):(this.options.disableBackgroundRecording&&(yield this.start()),this.addCustomEvent("TabHidden",!1)))})}Il(){return Dt(this,null,function*(){this.logger.log("highlight in cross-origin iframe is waiting "),yield new Promise(e=>{let n=r=>{if(r.data.highlight===db){let i=r.data;this.logger.log("highlight got window message ",i),this.sessionData.projectID=i.projectID,this.sessionData.sessionSecureID=i.sessionSecureID,window.parent.postMessage({highlight:fb},"*"),window.removeEventListener("message",n),e()}};window.addEventListener("message",n)})})}Tl(){this.logger.log("highlight setting up cross origin iframe parent notification"),setInterval(()=>{window.document.querySelectorAll("iframe").forEach(e=>{var n;(n=e.contentWindow)==null||n.postMessage({highlight:db,projectID:this.sessionData.projectID,sessionSecureID:this.sessionData.sessionSecureID},"*")})},rg),window.addEventListener("message",e=>{e.data.highlight===fb&&this.logger.log("highlight got response from initialized iframe")})}El(){var e;try{let r=this;this.enableSegmentIntegration&&this.listeners.push(IF(o=>{if(o.type==="track"){let s={};s["segment-event"]=o.event,r.addProperties(s,{type:"track",source:"segment"})}else if(o.type==="identify"){let s=o.userId.replace(/^"(.*)"$/,"$1");r.identify(s,o.traits,"segment")}})),this.listeners.push(gF(o=>{this.reloaded?(this.addCustomEvent("Reload",o),this.reloaded=!1,r.addProperties({reload:!0},{type:"session"})):this.addCustomEvent("Navigate",o)})),this.listeners.push(AX(o=>{this.addCustomEvent("Viewport",o)})),this.listeners.push(vF((o,s)=>{let a=null,c=null;if(s&&s.target){let l=s.target;a=PX(l),c=l.textContent,c&&c.length>2e3&&(c=c.substring(0,2e3))}this.addCustomEvent("Click",{clickTarget:o,clickTextContent:c,clickSelector:a})})),this.listeners.push(SF(o=>{o&&this.addCustomEvent("Focus",o)})),this.sessionShortcut&&EF(this.sessionShortcut,()=>{window.open(this.getCurrentSessionURLWithTimestamp(),"_blank")}),this.Ms||((e=window.electron)!=null&&e.ipcRenderer?(window.electron.ipcRenderer.on("highlight.run",({visible:o})=>{this.Js(!o)}),this.logger.log("Set up Electron highlight.run events.")):(wF(o=>this.Js(o)),this.logger.log("Set up document visibility listener.")),this.Ms=!0);let i=()=>{this.hasSessionUnloaded=!0,this.pushPayloadTimerId&&(clearTimeout(this.pushPayloadTimerId),this.pushPayloadTimerId=void 0)};window.addEventListener("beforeunload",i),this.listeners.push(()=>window.removeEventListener("beforeunload",i))}catch(r){zt("initializeSession _setupWindowListeners","warn",r)}let n=()=>{this.addCustomEvent("Page Unload",""),li(this.sessionData.sessionSecureID),wn(this.sessionData)};if(window.addEventListener("beforeunload",n),this.listeners.push(()=>window.removeEventListener("beforeunload",n)),navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/iPhone/i)){let r=()=>{this.addCustomEvent("Page Unload",""),li(this.sessionData.sessionSecureID),wn(this.sessionData)};window.addEventListener("pagehide",r),this.listeners.push(()=>window.removeEventListener("beforeunload",r))}}stop(e){this.manualStopped=!!e,this.manualStopped&&this.addCustomEvent("Stop","H.stop() was called which stops Highlight from recording."),this.state="NotRecording",e&&this.Tn&&(this.Tn(),this.Tn=void 0),this.listeners.forEach(n=>n()),this.listeners=[]}getCurrentSessionURLWithTimestamp(){let e=new Date().getTime(),{projectID:n,sessionSecureID:r}=this.sessionData,i=(e-this.$n)/1e3;return`https://${og}/${n}/sessions/${r}?ts=${i}`}getCurrentSessionURL(){let e=this.sessionData.projectID,n=this.sessionData.sessionSecureID;return e&&n?`https://${og}/${e}/sessions/${n}`:null}snapshot(e){return Dt(this,null,function*(){yield Ge.snapshotCanvas(e)})}addSessionFeedback({timestamp:e,verbatim:n,user_email:r,user_name:i}){var o;this.Qn.postMessage({message:{type:Ne.Feedback,verbatim:n,timestamp:e,userName:i||this.sessionData.userIdentifier,userEmail:r||((o=this.sessionData.userObject)==null?void 0:o.name)}})}As(){return Dt(this,null,function*(){var e;try{this.state==="Recording"&&this.listeners&&this.sessionData.sessionStartTime&&Date.now()-this.sessionData.sessionStartTime>pX&&(this.logger.log("Resetting session",{start:this.sessionData.sessionStartTime}),yield this.Ps({}));let n;((e=this.options)==null?void 0:e.sendMode)==="local"&&(n=r=>Dt(this,null,function*(){let i=new Blob([JSON.stringify({query:xb(Wb),variables:r})],{type:"application/json"});return yield window.fetch(`${this.mn}`,{method:"POST",body:i}),0})),yield this.Rl({sendFn:n}),this.hasPushedData=!0,this.sessionData.lastPushTime=Date.now(),wn(this.sessionData)}catch(n){zt("_save","warn",n)}this.state==="Recording"&&(this.pushPayloadTimerId&&(clearTimeout(this.pushPayloadTimerId),this.pushPayloadTimerId=void 0),this.pushPayloadTimerId=setTimeout(()=>{this.As()},hX))})}addCustomEvent(e,n){if(this.state==="NotRecording"){let r,i=()=>{clearInterval(r),this.state==="Recording"&&this.events.length>0?ub(e,n):r=setTimeout(i,500)};r=setTimeout(i,500)}else this.state==="Recording"&&(this.events.length>0||this.hasPushedData)&&ub(e,n)}Rl(e){return Dt(this,arguments,function*({sendFn:n}){let r=[...this.events],{bytes:i,time:o}=this.enableCanvasRecording?ig.canvas:ig.normal;this.wr>=i&&new Date().getTime()-this.xo>=o&&this.takeFullSnapshot(),this.logger.log(`Sending: ${r.length} events,
346
346
  To: ${this.mn}
347
347
  Org: ${this.organizationID}
348
- SessionSecureID: ${this.sessionData.sessionSecureID}`);let s=GF();n?yield n({session_secure_id:this.sessionData.sessionSecureID,payload_id:(this.sessionData.payloadID++).toString(),events:{events:r},messages:YL({messages:[]}),resources:JSON.stringify({resources:[]}),web_socket_events:JSON.stringify({webSocketEvents:[]}),errors:[],is_beacon:!1,has_session_unloaded:this.hasSessionUnloaded,highlight_logs:s||void 0}):this.Qn.postMessage({message:{type:Ne.AsyncEvents,id:this.sessionData.payloadID++,events:r,messages:[],errors:[],resourcesString:JSON.stringify({resources:[]}),webSocketEventsString:JSON.stringify({webSocketEvents:[]}),hasSessionUnloaded:this.hasSessionUnloaded,highlightLogs:s}}),wn(this.sessionData),this.events=this.events.slice(r.length),LF(s)})}takeFullSnapshot(){if(!this.Tn){this.logger.log("skipping full snapshot as rrweb is not running");return}this.logger.log("taking full snapshot",{bytesSinceSnapshot:this.wr,lastSnapshotTime:this.xo}),Ge.takeFullSnapshot(),this.wr=0,this.xo=new Date().getTime()}register(e,n){this.Gn.push(new hu(e,n))}getHooks(e){return this.Gn.flatMap(n=>{var r,i;return(i=(r=n.getHooks)==null?void 0:r.call(n,e))!=null?i:[]})}getRecordingState(){var e;return(e=this==null?void 0:this.state)!=null?e:"NotRecording"}getSession(){let e=this.sessionData.sessionSecureID,n=Zs(e);if(!n)return null;let r=`${this.getFrontendUrl()}/sessions/${e}`;if(!r||!(n!=null&&n.sessionStartTime))return null;let i=new Date().getTime(),o=new URL(r),s=new URL(r),a=(i-this.$n)/1e3;return s.searchParams.set("ts",a.toString()),{url:o.toString(),urlWithTimestamp:s.toString(),sessionSecureID:e}}getFrontendUrl(){var e,n;let r=this.mn.match(gX);if(r&&(e=r==null?void 0:r.groups)!=null&&e.domain){let i=(n=r.groups.domain)!=null?n:"";return`https://${mX[i]}${yX}`}return fX}},Ci=class extends JX{constructor(e,n){var r=(...f)=>(super(...f),Y(this,"record"),this),i,o,s,a,c,l,u,h,p;try{if(r(n),typeof window>"u"||typeof document>"u"){console.warn("@launchdarkly/session-replay is not initializing because it is not supported in this environment.");return}if(typeof Worker>"u"){console.warn("@launchdarkly/session-replay is not initializing because Worker is not supported.");return}if(!e){console.warn("@launchdarkly/session-replay is not initializing because projectID was passed undefined.");return}let f=Yt(z({},n),{organizationID:e,firstloadVersion:FF,environment:(n==null?void 0:n.environment)||"production",appVersion:n==null?void 0:n.version,sessionSecureID:this.sessionSecureID,privacySetting:(i=n==null?void 0:n.privacySetting)!=null?i:"strict"});this.record=new ih(f),n!=null&&n.manualStart||this.record.start(),In.load(this.record),!((s=(o=n==null?void 0:n.integrations)==null?void 0:o.mixpanel)!=null&&s.disabled)&&(c=(a=n==null?void 0:n.integrations)==null?void 0:a.mixpanel)!=null&&c.projectToken&&MF(n.integrations.mixpanel),!((u=(l=n==null?void 0:n.integrations)==null?void 0:l.amplitude)!=null&&u.disabled)&&(p=(h=n==null?void 0:n.integrations)==null?void 0:h.amplitude)!=null&&p.apiKey&&UF(n.integrations.amplitude)}catch(f){zt("Error initializing @launchdarkly/session-replay SDK","error",f)}}getMetadata(){return{name:"@launchdarkly/session-replay"}}register(e,n){var r;(r=this.record)==null||r.register(e,n)}getHooks(e){return[{getMetadata:()=>({name:"@launchdarkly/session-replay/hooks"}),afterIdentify:(n,r,i)=>{var o,s,a,c,l,u,h;for(let p of(a=(s=(o=this.record)==null?void 0:o.getHooks)==null?void 0:s.call(o,e))!=null?a:[])(c=p.afterIdentify)==null||c.call(p,n,r,i);if(i.status==="completed"){let p=WX(n.context),f=UX(n.context);(h=this.record)==null||h.identify(typeof f=="string"?f:(u=(l=f.user)==null?void 0:l.toString())!=null?u:p,Yt(z({key:p},typeof f=="object"?f:{}),{timeout:n.timeout}),"LaunchDarkly")}return r},afterEvaluation:(n,r,i)=>{var o,s,a,c;for(let l of(a=(s=(o=this.record)==null?void 0:o.getHooks)==null?void 0:s.call(o,e))!=null?a:[])(c=l.afterEvaluation)==null||c.call(l,n,r,i);return r},afterTrack:n=>{var r,i,o,s,a;for(let c of(o=(i=(r=this.record)==null?void 0:r.getHooks)==null?void 0:i.call(r,e))!=null?o:[])(s=c.afterTrack)==null||s.call(c,n);(a=this.record)==null||a.track(n.key,{data:n.data,value:n.metricValue})}}]}}});var $0=Object.defineProperty,q0=Object.defineProperties,tS=Object.getOwnPropertyDescriptors,Mi=Object.getOwnPropertySymbols,pp=Object.prototype.hasOwnProperty,dp=Object.prototype.propertyIsEnumerable,Dh=(t,e,n)=>e in t?$0(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,at=(t,e)=>{for(var n in e||(e={}))pp.call(e,n)&&Dh(t,n,e[n]);if(Mi)for(var n of Mi(e))dp.call(e,n)&&Dh(t,n,e[n]);return t},me=(t,e)=>q0(t,tS(e)),fp=(t,e)=>{var n={};for(var r in t)pp.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Mi)for(var r of Mi(t))e.indexOf(r)<0&&dp.call(t,r)&&(n[r]=t[r]);return n};function eS(t){return`/${t.replace(/~/g,"~0").replace(/\//g,"~1")}`}function mp(t){return t.indexOf("~")?t.replace(/~1/g,"/").replace(/~0/g,"~"):t}function nS(t){return(t.startsWith("/")?t.substring(1):t).split("/").map(e=>mp(e))}function rS(t){return!t.startsWith("/")}function iS(t){return!t.match(/\/\/|(^\/.*~[^0|^1])|~$/)}var Nn=class{constructor(t,e=!1){if(e){let n=t;this.p=[n],this.isValid=n!=="",this.redactionName=n.startsWith("/")?eS(n):n}else{if(this.redactionName=t,t===""||t==="/"||!iS(t)){this.isValid=!1,this.p=[];return}rS(t)?this.p=[t]:t.indexOf("/",1)<0?this.p=[mp(t.slice(1))]:this.p=nS(t),this.p[0]==="_meta"?this.isValid=!1:this.isValid=!0}}get(t){let{p:e,isValid:n}=this;if(!n)return;let r=t;for(let i=0;i<e.length;i+=1){let o=e[i];if(r!=null&&Object.prototype.hasOwnProperty.call(r,o)&&typeof r=="object"&&!Array.isArray(r))r=r[o];else return}return r}getComponent(t){return this.p[t]}get depth(){return this.p.length}get isKind(){return this.p.length===1&&this.p[0]==="kind"}compare(t){return this.depth===t.depth&&this.p.every((e,n)=>e===t.getComponent(n))}get components(){return[...this.p]}};Nn.InvalidReference=new Nn("");var oS=class{is(t){if(Array.isArray(t))return!1;let e=typeof t;return e==="function"||e==="object"}getType(){return"factory method or object"}},Ln=class{constructor(t,e){this.wt=t,this.typeOf=typeof e}is(t){return Array.isArray(t)?!1:typeof t===this.typeOf}getType(){return this.wt}},yp=class{constructor(t,e){this.wt=t,this.typeOf=typeof e}is(t){return Array.isArray(t)?t.length>0?t.every(e=>typeof e===this.typeOf):!0:!1}getType(){return this.wt}},gp=class extends Ln{constructor(t){super(`number with minimum value of ${t}`,0),this.min=t}is(t){return typeof t===this.typeOf&&t>=this.min}},bp=class extends Ln{constructor(t){super(`string matching ${t}`,""),this.expression=t}is(t){return typeof t=="string"&&!!t.match(this.expression)}},sS=class{is(t){return typeof t=="function"}getType(){return"function"}},aS=class{is(t){return typeof t=="boolean"||typeof t=="undefined"||t===null}getType(){return"boolean | undefined | null"}},lS=/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d\d*)?(Z|[-+]\d\d(:\d\d)?)/,cS=class{is(t){return typeof t=="number"||typeof t=="string"&&lS.test(t)}getType(){return"date"}},uS=class extends bp{constructor(){super(/^(\w|\.|-)+$/)}is(t){return super.is(t)&&t!=="kind"}},G=class{static createTypeArray(t,e){return new yp(t,e)}static numberWithMin(t){return new gp(t)}static stringMatchingRegex(t){return new bp(t)}};G.String=new Ln("string","");G.Number=new Ln("number",0);G.ObjectOrFactory=new oS;G.Object=new Ln("object",{});G.StringArray=new yp("string[]","");G.Boolean=new Ln("boolean",!0);G.Function=new sS;G.Date=new cS;G.Kind=new uS;G.NullableBoolean=new aS;function vp(t){return"kind"in t?G.String.is(t.kind)&&t.kind!=="multi":!1}function Sp(t){return"kind"in t?G.String.is(t.kind)&&t.kind==="multi":!1}function wp(t){return!("kind"in t)||t.kind===null||t.kind===void 0}function Pi(t,e=[]){if(t===null||typeof t!="object")return JSON.stringify(t);if(e.includes(t))throw new Error("Cycle detected");return Array.isArray(t)?`[${t.map(n=>Pi(n,[...e,t])).map(n=>n===void 0?"null":n).join(",")}]`:`{${Object.keys(t).sort().map(n=>{let r=Pi(t[n],[...e,t]);if(r!==void 0)return`${JSON.stringify(n)}:${r}`}).filter(n=>n!==void 0).join(",")}}`}var La="user";function Yh(t){return t.includes("%")||t.includes(":")?t.replace(/%/g,"%25").replace(/:/g,"%3A"):t}function hS(t){return t&&G.Object.is(t)}function Kh(t){return G.Kind.is(t)}function _h(t){return G.String.is(t)&&t!==""}function Ra(t,e=!1){return t?t.map(n=>new Nn(n,e)):[]}function pS(t){return t!=null}function dS(t){let e=me(at({},t.custom||[]),{kind:"user",key:String(t.key)});if(pS(t.anonymous)){let n=!!t.anonymous;delete e.anonymous,e.anonymous=n}return t.name!==null&&t.name!==void 0&&(e.name=t.name),t.ip!==null&&t.ip!==void 0&&(e.ip=t.ip),t.firstName!==null&&t.firstName!==void 0&&(e.firstName=t.firstName),t.lastName!==null&&t.lastName!==void 0&&(e.lastName=t.lastName),t.email!==null&&t.email!==void 0&&(e.email=t.email),t.avatar!==null&&t.avatar!==void 0&&(e.avatar=t.avatar),t.country!==null&&t.country!==void 0&&(e.country=t.country),t.privateAttributeNames!==null&&t.privateAttributeNames!==void 0&&(e._meta={privateAttributes:t.privateAttributeNames}),e}var xn=class wt{constructor(e,n,r){this.I=!1,this.it=!1,this.ie=!1,this.R={},this.kind=n,this.valid=e,this.message=r}static k(e,n){return new wt(!1,e,n)}static je(e,n){if(!(!n||!e.isValid))return e.depth===1&&e.getComponent(0)==="anonymous"?!!(n!=null&&n.anonymous):e.get(n)}se(e){if(this.I)return this.R[e];if(this.kind===e)return this.y}static He(e){let n=Object.keys(e).filter(c=>c!=="kind"),r=n.every(Kh);if(!n.length)return wt.k("multi","A multi-kind context must contain at least one kind");if(!r)return wt.k("multi","Context contains invalid kinds");let i={},o=!0,s=n.reduce((c,l)=>{var u;let h=e[l];return hS(h)?(c[l]=h,i[l]=Ra((u=h._meta)==null?void 0:u.privateAttributes)):o=!1,c},{});if(!o)return wt.k("multi","Context contained contexts that were not objects");if(!Object.values(s).every(c=>_h(c.key)))return wt.k("multi","Context contained invalid keys");if(n.length===1){let c=n[0],l=new wt(!0,c);return l.y=me(at({},s[c]),{kind:c}),l.st=i,l.it=c==="user",l}let a=new wt(!0,e.kind);return a.R=s,a.st=i,a.I=!0,a}static ze(e){var n;let{key:r,kind:i}=e,o=Kh(i),s=_h(r);if(!o)return wt.k(i!=null?i:"unknown","The kind was not valid for the context");if(!s)return wt.k(i,"The key for the context was not valid");let a=Ra((n=e._meta)==null?void 0:n.privateAttributes),c=new wt(!0,i);return c.it=i==="user",c.y=e,c.st={[i]:a},c}static Be(e){if(!(e.key!==void 0&&e.key!==null))return wt.k("user","The key for the context was not valid");let n=new wt(!0,"user");return n.it=!0,n.ie=!0,n.y=dS(e),n.st={user:Ra(e.privateAttributeNames,!0)},n}static fromLDContext(e){return e?vp(e)?wt.ze(e):Sp(e)?wt.He(e):wp(e)?wt.Be(e):wt.k("unknown","Context was not of a valid kind"):wt.k("unknown","No context specified. Returning default value")}static toLDContext(e){if(!e.valid)return;let n=e.getContexts();if(!e.I)return n[0][1];let r={kind:"multi"};return n.forEach(i=>{let o=i[0],s=i[1];r[o]=s}),r}valueForKind(e,n=La){return e.isKind?this.kinds:wt.je(e,this.se(n))}key(e=La){var n;return(n=this.se(e))==null?void 0:n.key}get isMultiKind(){return this.I}get canonicalKey(){return this.it?this.y.key:this.I?Object.keys(this.R).sort().map(e=>`${e}:${Yh(this.R[e].key)}`).join(":"):`${this.kind}:${Yh(this.y.key)}`}get kinds(){return this.I?Object.keys(this.R):[this.kind]}get kindsAndKeys(){return this.I?Object.entries(this.R).reduce((e,[n,r])=>(e[n]=r.key,e),{}):{[this.kind]:this.y.key}}privateAttributes(e){var n;return((n=this.st)==null?void 0:n[e])||[]}getContexts(){return this.I?Object.entries(this.R):[[this.kind,this.y]]}get legacy(){return this.ie}canonicalUnfilteredJson(){if(this.valid){if(this.Et)return this.Et;try{this.Et=Pi(wt.toLDContext(this))}catch(e){}return this.Et}}};xn.UserKind=La;var fS=["key","kind","_meta","anonymous"].map(t=>new Nn(t,!0)),mS=["name","ip","firstName","lastName","email","avatar","country"];function yS(t,e){return t.depth===e.length&&e.every((n,r)=>n===t.getComponent(r))}function gS(t,e){let n=[],r={},i=[];for(n.push(...Object.keys(t).map(o=>({key:o,ptr:[o],source:t,parent:r,visited:[t]})));n.length;){let o=n.pop(),s=e.find(a=>yS(a,o.ptr));if(s)i.push(s.redactionName);else{let a=o.source[o.key];a===null?o.parent[o.key]=a:Array.isArray(a)?o.parent[o.key]=[...a]:typeof a=="object"?o.visited.includes(a)||(o.parent[o.key]={},n.push(...Object.keys(a).map(c=>({key:c,ptr:[...o.ptr,c],source:a,parent:o.parent[o.key],visited:[...o.visited,a]})))):o.parent[o.key]=a}}return{cloned:r,excluded:i.sort()}}var bS=class{constructor(t,e){this.Ke=t,this.Ge=e}filter(t,e=!1){let n=t.getContexts();if(n.length===1)return this.ne(t,n[0][1],n[0][0],e);let r={kind:"multi"};return n.forEach(([i,o])=>{r[i]=this.ne(t,o,i,e)}),r}We(t,e,n,r){return(r?Object.keys(e).map(i=>new Nn(i,!0)):[...this.Ge,...t.privateAttributes(n)]).filter(i=>!fS.some(o=>o.compare(i)))}ne(t,e,n,r){let i=this.Ke||r&&e.anonymous===!0,{cloned:o,excluded:s}=gS(e,this.We(t,e,n,i));return t.legacy&&mS.forEach(a=>{a in o&&(o[a]=String(o[a]))}),s.length&&(o._meta||(o._meta={}),o._meta.redactedAttributes=s),o._meta&&(delete o._meta.privateAttributes,Object.keys(o._meta).length===0&&delete o._meta),o}},Hh=30*1e3,vS=.5,SS=class{constructor(t,e,n=Math.random){this.Ds=e,this.Je=n,this.Dt=0,this.re=Math.max(1,t),this.qe=Math.ceil(Math.log2(Hh/this.re))}A(){let t=Math.min(this.Dt,this.qe),e=this.re*2**t;return Math.min(e,Hh)}Ye(t){return t-Math.trunc(this.Je()*vS*t)}success(t=Date.now()){this.bt=t}fail(t=Date.now()){this.bt!==void 0&&t-this.bt>this.Ds&&(this.Dt=0),this.bt=void 0;let e=this.Ye(this.A());return this.Dt+=1,e}},zh;(function(t){t[t.Valid=0]="Valid",t[t.Initializing=1]="Initializing",t[t.Interrupted=2]="Interrupted",t[t.Closed=3]="Closed"})(zh||(zh={}));var Fi=class extends Error{constructor(t,e,n,r=!0){super(e),this.kind=t,this.status=n,this.name="LaunchDarklyPollingError",this.recoverable=r}},Xa=class extends Error{constructor(t,e,n,r=!0){super(e),this.kind=t,this.code=n,this.name="LaunchDarklyStreamingError",this.recoverable=r}},JF=120*1e3,DF=300*1e3,_t;(function(t){t.Unknown="UNKNOWN",t.NetworkError="NETWORK_ERROR",t.ErrorResponse="ERROR_RESPONSE",t.InvalidData="INVALID_DATA"})(_t||(_t={}));var Ai;(function(t){t[t.Disabled=0]="Disabled",t[t.Enabled=1]="Enabled"})(Ai||(Ai={}));var On;(function(t){t[t.AnalyticsEvents=0]="AnalyticsEvents",t[t.DiagnosticEvent=1]="DiagnosticEvent"})(On||(On={}));var qe;(function(t){t[t.Succeeded=0]="Succeeded",t[t.Failed=1]="Failed",t[t.FailedAndMustShutDown=2]="FailedAndMustShutDown"})(qe||(qe={}));function Vn(t){if(typeof t=="string")return t;if(t===void 0)return"undefined";if(t===null)return"null";if(Object.prototype.hasOwnProperty.call(t,"toString"))try{return t.toString()}catch(e){}if(typeof t=="bigint")return`${t}n`;try{return JSON.stringify(t)}catch(e){return e instanceof TypeError&&e.message.indexOf("circular")>=0?"[Circular]":"[Not Stringifiable]"}}function wS(t){return typeof t=="symbol"?"NaN":typeof t=="bigint"?`${t}n`:String(Number(t))}function IS(t){return typeof t=="symbol"?"NaN":typeof t=="bigint"?`${t}n`:String(parseInt(t,10))}function TS(t){return typeof t=="symbol"?"NaN":String(parseFloat(t))}var Ca={s:t=>Vn(t),d:t=>wS(t),i:t=>IS(t),f:t=>TS(t),j:t=>Vn(t),o:t=>Vn(t),O:t=>Vn(t),c:()=>""};function Wa(...t){var e;let n=t.shift();if(G.String.is(n)){let r="",i=0;for(;i<n.length;){let o=n.charAt(i);if(o==="%"){if(i+1<n.length){let s=n.charAt(i+1);if(s in Ca&&t.length){let a=t.shift();r+=(e=Ca[s])==null?void 0:e.call(Ca,a)}else s==="%"?r+="%":r+=`%${s}`;i+=2}}else r+=o,i+=1}return t.length&&(r.length&&(r+=" "),r+=t.map(Vn).join(" ")),r}return t.map(Vn).join(" ")}var Vt;(function(t){t[t.debug=0]="debug",t[t.info=1]="info",t[t.warn=2]="warn",t[t.error=3]="error",t[t.none=4]="none"})(Vt||(Vt={}));var ES=["debug","info","warn","error","none"],Pa=class Ip{static get(){return new Ip({})}constructor(e){var n,r,i;if(this.ni=(r=Vt[(n=e.level)!=null?n:"info"])!=null?r:Vt.info,this.ri=(i=e.name)!=null?i:"LaunchDarkly",this.ue=e.formatter,typeof e.destination=="object")this.he={[Vt.debug]:e.destination.debug,[Vt.info]:e.destination.info,[Vt.warn]:e.destination.warn,[Vt.error]:e.destination.error};else if(typeof e.destination=="function"){let{destination:o}=e;this.he={[Vt.debug]:o,[Vt.info]:o,[Vt.warn]:o,[Vt.error]:o}}}ai(...e){var n;try{return this.ue?(n=this.ue)==null?void 0:n.call(this,...e):Wa(...e)}catch(r){return Wa(...e)}}oi(e,n){try{e(n)}catch(r){console.error(n)}}x(e,n){var r;if(e>=this.ni){let i=`${ES[e]}: [${this.ri}]`;try{let o=(r=this.he)==null?void 0:r[e];o?this.oi(o,`${i} ${this.ai(...n)}`):console.error(...n)}catch(o){console.error(...n)}}}error(...e){this.x(Vt.error,e)}warn(...e){this.x(Vt.warn,e)}info(...e){this.x(Vt.info,e)}debug(...e){this.x(Vt.debug,e)}},RS={error:G.Function,warn:G.Function,info:G.Function,debug:G.Function},Tp=class{constructor(t,e){Object.entries(RS).forEach(([n,r])=>{if(!r.is(t[n]))throw new Error(`Provided logger instance must support logger.${n}(...) method`)}),this.t=t,this.ci=e}x(t,e){try{this.t[t](...e)}catch(n){this.ci[t](...e)}}error(...t){this.x("error",t)}warn(...t){this.x("warn",t)}info(...t){this.x("info",t)}debug(...t){this.x("debug",t)}},Ep=t=>{let e=new Pa({level:"info",destination:console.error,formatter:Wa});return t?new Tp(t,e):e},Ue=class{static deprecated(t,e){return`"${t}" is deprecated, please use "${e}"`}static optionBelowMinimum(t,e,n){return`Config option "${t}" had invalid value of ${e}, using minimum of ${n} instead`}static unknownOption(t){return`Ignoring unknown config option "${t}"`}static wrongOptionType(t,e,n){return`Config option "${t}" should be of type ${e}, got ${n}, using default value`}static wrongOptionTypeBoolean(t,e){return`Config option "${t}" should be a boolean, got ${e}, converting to boolean`}static invalidTagValue(t){return`Config option "${t}" must only contain letters, numbers, ., _ or -.`}static tagValueTooLong(t){return`Value of "${t}" was longer than 64 characters and was discarded.`}static partialEndpoint(t){return`You have set custom uris without specifying the ${t} URI; connections may not work properly`}},CS=/^(\w|\.|-)+$/,ZS=G.stringMatchingRegex(CS),kS={is:(t,e)=>ZS.is(t)?t.length>64?{valid:!1,message:Ue.tagValueTooLong(e)}:{valid:!0}:{valid:!1,message:Ue.invalidTagValue(e)}},VS=class{constructor(t){let e={},n=t==null?void 0:t.application,r=t==null?void 0:t.logger;n&&Object.entries(n).forEach(([o,s])=>{if(s!=null){let{valid:a,message:c}=kS.is(s,`application.${o}`);a?o==="versionName"?e["application-version-name"]=[s]:e[`application-${o}`]=[s]:r==null||r.warn(c)}});let i=Object.keys(e);i.length&&(this.value=i.sort().flatMap(o=>e[o].sort().map(s=>`${o}/${s}`)).join(" "))}},xS=class{constructor(t,e,n){this.platform=n,this.basicConfiguration={tags:e.tags,logger:e.logger,offline:e.offline,serviceEndpoints:e.serviceEndpoints,sdkKey:t}}};function Za(t){return t.replace(/\/+$/,"")}function Fa(t){return t.replace(/^\/+/,"").replace(/\?$/,"")}var Ji=class Rp{constructor(e,n,r=Rp.DEFAULT_EVENTS,i="/bulk",o="/diagnostic",s=!0,a){this.streaming=Za(e),this.polling=Za(n),this.events=Za(r),this.analyticsEventPath=i,this.diagnosticEventPath=o,this.includeAuthorizationHeader=s,this.payloadFilterKey=a}};Ji.DEFAULT_EVENTS="https://events.launchdarkly.com";function Aa(t,e=[]){if(e.length===0)return t;let n=e.map(({key:r,value:i})=>`${r}=${i}`);return`${t}?${n.join("&")}`}function NS(t,e,n){let r=Fa(e),i=[...n];return t.payloadFilterKey&&i.push({key:"filter",value:t.payloadFilterKey}),Aa(`${t.streaming}/${r}`,i)}function OS(t,e,n=[]){let r=Fa(e),i=[...n];return t.payloadFilterKey&&i.push({key:"filter",value:t.payloadFilterKey}),Aa(`${t.polling}/${r}`,i)}function Bh(t,e,n=[]){let r=Fa(e);return Aa(`${t.events}/${r}`,n)}var Cp=class extends Error{constructor(t){super(t),this.name="LaunchDarklyUnexpectedResponseError"}},GS=class extends Error{constructor(t){super(t),this.name="LaunchDarklyClientError"}},Zp=class extends Error{constructor(t){super(t),this.name="LaunchDarklyTimeoutError"}};function Ki(t){return t>=400&&t<500?t===400||t===408||t===429:!0}function LS(t){return t===413?!0:Ki(t)}function XS(t,e){let n,r;return{promise:new Promise((i,o)=>{r=i,n=setTimeout(()=>{let s=`${e} timed out after ${t} seconds.`;o(new Zp(s))},t*1e3)}),cancel:()=>{r(),clearTimeout(n)}}}function kp(t){return t==null?t:JSON.parse(JSON.stringify(t))}function ka(t){return Math.trunc(t*1e3)}var WS=t=>JSON.stringify(t)==="{}",Ja=(t,e)=>t&&Object.entries(t).reduce((n,[r,i])=>(i&&!WS(i)&&!(e!=null&&e.includes(r))&&(n[r]=typeof i=="object"?Ja(i,e):i),n),{});function Wi(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,r,i;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!Wi(t[r],e[r]))return!1;return!0}if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(r of t.entries())if(!e.has(r[0]))return!1;for(r of t.entries())if(!Wi(r[1],e.get(r[0])))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(r of t.entries())if(!e.has(r[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(t[r]!==e[r])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){var o=i[r];if(!Wi(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function US(t,e,n,r=!0,i="user-agent"){let{userAgentBase:o,version:s,wrapperName:a,wrapperVersion:c}=e.sdkData(),l={[i]:`${o!=null?o:"NodeJSClient"}/${s}`};return r&&(l.authorization=t),a&&(l["x-launchdarkly-wrapper"]=c?`${a}/${c}`:a),n!=null&&n.value&&(l["x-launchdarkly-tags"]=n.value),l}function Gn(t,e,n){let r;t.status?r=`error ${t.status}${t.status===401?" (invalid SDK key)":""}`:r=`I/O error (${t.message||"unknown error"})`;let i=n!=null?n:"giving up permanently";return`Received ${r} for ${e} - ${i}`}function Vp({status:t}){return t?Ki(t):!0}var jh=(t,e)=>e.btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),xp=async(t=1e3)=>new Promise(e=>{setTimeout(e,t)}),MS=class{constructor(t,e,n){this.g=e,this.li=n,this.St=[],this.de=Date.now(),this.fe=this.de,this.ge={diagnosticId:e.crypto.randomUUID(),sdkKeySuffix:t.length>6?t.substring(t.length-6):t}}createInitEvent(){var t,e,n;let r=this.g.info.sdkData(),i=this.g.info.platformData();return{kind:"diagnostic-init",id:this.ge,creationDate:this.de,sdk:r,configuration:this.li,platform:at({name:i.name,osArch:(t=i.os)==null?void 0:t.arch,osName:(e=i.os)==null?void 0:e.name,osVersion:(n=i.os)==null?void 0:n.version},i.additional||{})}}recordStreamInit(t,e,n){let r={timestamp:t,failed:e,durationMillis:n};this.St.push(r)}createStatsEventAndReset(t,e,n){let r=Date.now(),i={kind:"diagnostic",id:this.ge,creationDate:r,dataSinceDate:this.fe,droppedEvents:t,deduplicatedUsers:e,eventsInLastBatch:n,streamInits:this.St};return this.St=[],this.fe=r,i}},Ua;(function(t){t.MalformedFlag="MALFORMED_FLAG",t.UserNotSpecified="USER_NOT_SPECIFIED",t.FlagNotFound="FLAG_NOT_FOUND",t.ClientNotReady="CLIENT_NOT_READY",t.WrongType="WRONG_TYPE"})(Ua||(Ua={}));var PS=Ua,Np=class{static invalidMetricValue(t){return`The track function was called with a non-numeric "metricValue" (${t}), only numeric metric values are supported.`}};Np.MissingContextKeyNoEvent="Context was unspecified or had no key; event will not be sent";var FS=class{constructor(t,e){let{basicConfiguration:n,platform:r}=t,{serviceEndpoints:{analyticsEventPath:i,diagnosticEventPath:o}}=n,{crypto:s,requests:a}=r;this.ui=at({},e),this.pe=Bh(n.serviceEndpoints,i,[]),this.hi=Bh(n.serviceEndpoints,o,[]),this.T=a,this.di=s}async nt(t,e,n,r){let i={status:qe.Succeeded},o=me(at({},this.ui),{"content-type":"application/json"});n&&(o["x-launchdarkly-payload-id"]=n,o["x-launchDarkly-event-schema"]="4");let s;try{let{status:a,headers:c}=await this.T.fetch(e,{headers:o,body:JSON.stringify(t),compressBodyIfPossible:!0,method:"POST",keepalive:!0}),l=Date.parse(c.get("date")||"");if(l&&(i.serverTime=l),a<=204)return i;if(s=new Cp(Gn({status:a,message:"some events were dropped"},"event posting")),!Ki(a))return LS(a)?i.status=qe.Failed:i.status=qe.FailedAndMustShutDown,i.error=s,i}catch(a){s=a}return s&&!r?(i.status=qe.Failed,i.error=s,i):(await xp(),this.nt(t,this.pe,n,!1))}async sendEventData(t,e){let n=t===On.AnalyticsEvents?this.di.randomUUID():void 0,r=t===On.AnalyticsEvents?this.pe:this.hi;return this.nt(e,r,n,!0)}};function Di(t){return t.kind==="feature"}function AS(t){return t.kind==="identify"}function JS(t){return t.kind==="migration_op"}var DS=class{constructor(t,e,n,r,i,o){this.count=t,this.key=e,this.value=n,this.version=i,this.variation=o,this.default=r}increment(){this.count+=1}};function YS(t){return`${t.key}:${t.variation!==null&&t.variation!==void 0?t.variation:""}:${t.version!==null&&t.version!==void 0?t.version:""}`}var Op=class{constructor(t=!1,e){this.fi=t,this.S=e,this.Y=0,this.rt=0,this.at={},this.ot={}}summarizeEvent(t){if(Di(t)&&!t.excludeFromSummaries){this.y||(this.y=t.context);let e=YS(t),n=this.at[e],r=this.ot[t.key];r||(r=new Set,this.ot[t.key]=r),t.context.kinds.forEach(i=>r.add(i)),n?n.increment():this.at[e]=new DS(1,t.key,t.value,t.default,t.version,t.variation),(this.Y===0||t.creationDate<this.Y)&&(this.Y=t.creationDate),t.creationDate>this.rt&&(this.rt=t.creationDate)}}getSummary(){var t;let e=Object.values(this.at).reduce((r,i)=>{let o=r[i.key];o||(o={default:i.default,counters:[],contextKinds:[...this.ot[i.key]]},r[i.key]=o);let s={value:i.value,count:i.count};return i.variation!==void 0&&i.variation!==null&&(s.variation=i.variation),i.version!==void 0&&i.version!==null?s.version=i.version:s.unknown=!0,o.counters.push(s),r},{}),n={startDate:this.Y,endDate:this.rt,features:e,kind:"summary",context:this.y!==void 0&&this.fi?(t=this.S)==null?void 0:t.filter(this.y):void 0};return this.gi(),n}gi(){this.Y=0,this.rt=0,this.at={},this.ot={}}},KS=class extends Error{constructor(t){super(t),this.name="LaunchDarklyInvalidSDKKeyError"}},_S=class{constructor(t,e){this.S=t,this.t=e,this.Z={}}summarizeEvent(t){var e;if(Di(t)){let n=t.context.canonicalUnfilteredJson();if(!n){t.context.valid&&((e=this.t)==null||e.error("Unable to serialize context, likely the context contains a cycle."));return}let r=this.Z[n];r||(this.Z[n]=new Op(!0,this.S),r=this.Z[n]),r.summarizeEvent(t)}}getSummaries(){let t=this.Z;return this.Z={},Object.values(t).map(e=>e.getSummary())}};function Ui(t){let e=Math.trunc(t);return e===1?!0:e===0?!1:Math.floor(Math.random()*e)===0}function HS(t){return t.getSummaries!==void 0}var zS=class{constructor(t,e,n,r,i,o=!0,s=!1){this.e=t,this.ct=r,this.L=i,this.lt=[],this.me=0,this.Lt=0,this.Ct=0,this.It=!1,this.ye=0,this.At=!1,this.Pt=null,this.pi=t.eventsCapacity,this.t=e.basicConfiguration.logger,this.ve=new FS(e,n),this.S=new bS(t.allAttributesPrivate,t.privateAttributes.map(a=>new Nn(a))),s?this.X=new _S(this.S,this.t):this.X=new Op,o&&this.start()}start(){var t,e;if(((t=this.ct)==null?void 0:t.flushInterval)!==void 0&&(this.Pt=setInterval(()=>{var n;(n=this.ct)==null||n.flush()},this.ct.flushInterval*1e3)),this.mi=setInterval(async()=>{var n;try{await this.flush()}catch(r){(n=this.t)==null||n.debug(`Flush failed: ${r}`)}},this.e.flushInterval*1e3),this.L){let n=this.L.createInitEvent();this.we(n),this.Ee=setInterval(()=>{let r=this.L.createStatsEventAndReset(this.Lt,this.Ct,this.ye);this.Lt=0,this.Ct=0,this.we(r)},this.e.diagnosticRecordingInterval*1e3)}(e=this.t)==null||e.debug("Started EventProcessor.")}we(t){this.ve.sendEventData(On.DiagnosticEvent,t)}close(){clearInterval(this.mi),this.Pt&&clearInterval(this.Pt),this.Ee&&clearInterval(this.Ee)}async flush(){var t;if(this.At)throw new KS("Events cannot be posted because a permanent error has been encountered. This is most likely an invalid SDK key. The specific error information is logged independently.");let e=this.lt;if(this.lt=[],HS(this.X))this.X.getSummaries().forEach(n=>{Object.keys(n.features).length&&e.push(n)});else{let n=this.X.getSummary();Object.keys(n.features).length&&e.push(n)}e.length&&(this.ye=e.length,(t=this.t)==null||t.debug("Flushing %d events",e.length),await this.nt(e))}sendEvent(t){var e;if(this.At)return;if(JS(t)){if(Ui(t.samplingRatio)){let a=me(at({},t),{context:t.context?this.S.filter(t.context):void 0});a.samplingRatio===1&&delete a.samplingRatio,this.ut(a)}return}this.X.summarizeEvent(t);let n=Di(t),r=n&&t.trackEvents||!n,i=this.yi(t),o=AS(t),s=(e=this.ct)==null?void 0:e.processContext(t.context);s||o||(this.Ct+=1),s&&!o&&this.ut(this.Ot({kind:"index",creationDate:t.creationDate,context:t.context,samplingRatio:1},!1)),r&&Ui(t.samplingRatio)&&this.ut(this.Ot(t,!1)),i&&Ui(t.samplingRatio)&&this.ut(this.Ot(t,!0))}Ot(t,e){switch(t.kind){case"feature":{let n={kind:e?"debug":"feature",creationDate:t.creationDate,context:this.S.filter(t.context,!e),key:t.key,value:t.value,default:t.default};return t.samplingRatio!==1&&(n.samplingRatio=t.samplingRatio),t.prereqOf&&(n.prereqOf=t.prereqOf),t.variation!==void 0&&(n.variation=t.variation),t.version!==void 0&&(n.version=t.version),t.reason&&(n.reason=t.reason),n}case"index":case"identify":{let n={kind:t.kind,creationDate:t.creationDate,context:this.S.filter(t.context)};return t.samplingRatio!==1&&(n.samplingRatio=t.samplingRatio),n}case"custom":{let n={kind:"custom",creationDate:t.creationDate,key:t.key,context:this.S.filter(t.context)};return t.samplingRatio!==1&&(n.samplingRatio=t.samplingRatio),t.data!==void 0&&(n.data=t.data),t.metricValue!==void 0&&(n.metricValue=t.metricValue),t.url!==void 0&&(n.url=t.url),n}case"click":return{kind:"click",creationDate:t.creationDate,contextKeys:t.context.kindsAndKeys,key:t.key,url:t.url,selector:t.selector};case"pageview":return{kind:"pageview",creationDate:t.creationDate,contextKeys:t.context.kindsAndKeys,key:t.key,url:t.url};default:return t}}ut(t){var e;this.lt.length<this.pi?(this.lt.push(t),this.It=!1):(this.It||(this.It=!0,(e=this.t)==null||e.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")),this.Lt+=1)}yi(t){return Di(t)&&t.debugEventsUntilDate&&t.debugEventsUntilDate>this.me&&t.debugEventsUntilDate>Date.now()}async nt(t){let e=await this.ve.sendEventData(On.AnalyticsEvents,t);if(e.status===qe.FailedAndMustShutDown&&(this.At=!0),e.serverTime&&(this.me=e.serverTime),e.error)throw e.error}},Gp=class{constructor(t,e,n,r,i=1,o){this.context=t,this.key=e,this.data=n,this.metricValue=r,this.samplingRatio=i,this.url=o,this.kind="custom",this.creationDate=Date.now(),this.context=t}},Ma=class{constructor(t,e,n,r,i,o,s,a,c,l,u,h,p=1){this.withReasons=t,this.context=e,this.key=n,this.samplingRatio=p,this.kind="feature",this.creationDate=Date.now(),this.value=r,this.default=i,o!==void 0&&(this.version=o),s!==void 0&&(this.variation=s),a!==void 0&&(this.trackEvents=a),c!==void 0&&(this.prereqOf=c),l!==void 0&&(this.reason=l),u!==void 0&&(this.debugEventsUntilDate=u),h!==void 0&&(this.excludeFromSummaries=h)}},Lp=class{constructor(t,e=1){this.context=t,this.samplingRatio=e,this.kind="identify",this.creationDate=Date.now()}},BS=class{close(){}async flush(){}sendEvent(){}},jS=class{constructor(t){this.Tt=t}evalEvent(t){var e;return new Ma(this.Tt,t.context,t.flagKey,t.value,t.defaultVal,t.version,(e=t.variation)!=null?e:void 0,t.trackEvents||t.addExperimentData,t.prereqOfFlagKey,this.Tt||t.addExperimentData?t.reason:void 0,t.debugEventsUntilDate,t.excludeFromSummaries,t.samplingRatio)}unknownFlagEvent(t,e,n){return new Ma(this.Tt,n,t,e,e,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0)}identifyEvent(t){return new Lp(t,1)}customEvent(t,e,n,r,i=1){return new Gp(e,t,n!=null?n:void 0,r!=null?r:void 0,i)}},Qh="FDv1Fallback";function QS(t){return{vi:t,De:"",useSelector(e){return this.De=e,this},processFullTransfer(e){let n=[{event:"server-intent",data:{payloads:[{id:Qh,target:1,intentCode:"xfer-full",reason:"payload-missing"}]}}];Object.entries((e==null?void 0:e.flags)||[]).forEach(([r,i])=>{n.push({event:"put-object",data:{kind:"flag",key:r,version:i.version||1,object:i}})}),Object.entries((e==null?void 0:e.segments)||[]).forEach(([r,i])=>{n.push({event:"put-object",data:{kind:"segment",key:r,version:i.version||1,object:i}})}),n.push({event:"payload-transferred",data:{state:this.De,version:1,id:Qh}}),this.vi.processEvents(n)}}}var Xp=class{constructor(t,e,n){this.wi=t,this.m=e,this.t=n,this.n=[],this.M=void 0,this.z=!1,this.B=[],this.Ei=r=>{var i;if(this.$t(),!r.payloads.length)return;let o=r.payloads[0];switch(o==null?void 0:o.intentCode){case"xfer-full":this.z=!0;break;case"xfer-changes":this.z=!1;break;case"none":this.z=!1,this.Di(o);break;default:(i=this.t)==null||i.warn(`Unable to process intent code '${o==null?void 0:o.intentCode}'.`);return}this.M=o==null?void 0:o.id},this.bi=r=>{var i;if(!this.M||!r.kind||!r.key||!r.version||!r.object)return;let o=this.ki(r.kind,r.object);if(!o){(i=this.t)==null||i.warn(`Unable to process object for kind: '${r.kind}'`);return}this.B.push({kind:r.kind,key:r.key,version:r.version,object:o})},this.xi=r=>{!this.M||!r.kind||!r.key||!r.version||this.B.push({kind:r.kind,key:r.key,version:r.version,deleted:!0})},this.Di=r=>{if(!r.id||!r.target)return;let i={id:r.id,version:r.target,basis:!1,updates:[]};this.n.forEach(o=>o(i)),this.be()},this.Si=r=>{if(!this.M||r.state===null||r.state===void 0||!r.version){this.$t();return}let i={id:this.M,version:r.version,state:r.state,basis:this.z,updates:this.B};this.n.forEach(o=>o(i)),this.be()},this.Li=r=>{var i;(i=this.t)==null||i.info(`Goodbye was received from the LaunchDarkly connection with reason: ${r.reason}.`),this.$t()},this.Ci=r=>{var i;(i=this.t)==null||i.info(`An issue was encountered receiving updates for payload ${this.M} with reason: ${r.reason}.`),this.Ii()}}addPayloadListener(t){this.n.push(t)}removePayloadListener(t){let e=this.n.indexOf(t,0);e>-1&&this.n.splice(e,1)}processEvents(t){t.forEach(e=>{switch(e.event){case"server-intent":{this.Ei(e.data);break}case"put-object":{this.bi(e.data);break}case"delete-object":{this.xi(e.data);break}case"payload-transferred":{this.Si(e.data);break}case"goodbye":{this.Li(e.data);break}case"error":{this.Ci(e.data);break}}})}ki(t,e){var n,r;return(r=(n=this.wi)[t])==null?void 0:r.call(n,e)}be(){this.z=!1,this.B=[]}Ii(){this.B=[]}$t(){this.M=void 0,this.z=!1,this.B=[]}},$S=class{constructor(t,e,n,r){this.m=n,this.t=r,this.K(t,"server-intent"),this.K(t,"put-object"),this.K(t,"delete-object"),this.K(t,"payload-transferred"),this.K(t,"goodbye"),this.K(t,"error"),this.Nt=new Xp(e,n,r)}addPayloadListener(t){this.Nt.addPayloadListener(t)}removePayloadListener(t){this.Nt.removePayloadListener(t)}K(t,e){t.addEventListener(e,async n=>{var r,i,o,s,a;if(n!=null&&n.data){(r=this.t)==null||r.debug(`Received ${e} event. Data is ${n.data}`);try{this.Nt.processEvents([{event:e,data:JSON.parse(n.data)}])}catch(c){(i=this.t)==null||i.error(`Stream received data that was unable to be processed in "${e}" message`),(o=this.t)==null||o.debug(`Data follows: ${n.data}`),(s=this.m)==null||s.call(this,_t.InvalidData,"Malformed data in EventStream.")}}else(a=this.m)==null||a.call(this,_t.Unknown,"Event from EventStream missing data.")})}};function qS(t){if(t){let e=Object.keys(t).find(n=>n.toLowerCase()==="x-ld-envid");if(e)return{environmentId:t[e]}}}var $h="unknown plugin";function Yi(t,e){try{return e.getMetadata().name||$h}catch(n){return t.error("Exception thrown getting metadata for plugin. Unable to get plugin name."),$h}}function tw(t,e,n){let r=[];return n.forEach(i=>{var o;try{let s=(o=i.getHooks)==null?void 0:o.call(i,e);s===void 0?t.error(`Plugin ${Yi(t,i)} returned undefined from getHooks.`):s&&s.length>0&&r.push(...s)}catch(s){t.error(`Exception thrown getting hooks for plugin ${Yi(t,i)}. Unable to get hooks.`)}}),r}function ew(t,e,n,r){r.forEach(i=>{try{i.register(n,e)}catch(o){t.error(`Exception thrown registering plugin ${Yi(t,i)}.`)}})}var de=Object.freeze({__proto__:null,ClientMessages:Np,DiagnosticsManager:MS,ErrorKinds:PS,EventFactoryBase:jS,EventProcessor:zS,FDv1PayloadAdaptor:QS,InputCustomEvent:Gp,InputEvalEvent:Ma,InputIdentifyEvent:Lp,NullEventProcessor:BS,PayloadProcessor:Xp,PayloadStreamReader:$S,canonicalize:Pi,initMetadataFromHeaders:qS,isLegacyUser:wp,isMultiKind:Sp,isSingleKind:vp,safeGetHooks:tw,safeGetName:Yi,safeRegisterPlugins:ew,shouldSample:Ui}),Kt;(function(t){t.Initializing="INITIALIZING",t.Valid="VALID",t.Interrupted="INTERRUPTED",t.SetOffline="SET_OFFLINE",t.Closed="CLOSED"})(Kt||(Kt={}));function nw(t){return t>=200&&t<=299}var qh=class extends Error{constructor(t,e){super(t),this.status=e,this.name="LaunchDarklyRequestError"}},rw=class{constructor(t,e,n,r,i){this.T=t,this.Ai=e,this.ht=n,this.Pi=r,this.Oi=i}async requestPayload(){let t;try{let e=await this.T.fetch(this.Ai,{method:this.Pi,headers:this.ht,body:this.Oi});if(nw(e.status))return await e.text();t=e.status}catch(e){throw new qh(e==null?void 0:e.message)}throw new qh(`Unexpected status code: ${t}`,t)}};function tp(t,e,n,r,i,o,s,a,c,l){let u,h="GET",p=at({},o);c&&(h="REPORT",p["content-type"]="application/json",u=t);let f=c?n.pathReport(i,t):n.pathGet(i,t),m=[...s!=null?s:[]];a&&m.push({key:"withReasons",value:"true"}),l&&m.push({key:"h",value:l});let d=OS(e,f,m);return new rw(r,d,p,h,u)}var ep=new Error("Task has already been executed or shed. This is likely an implementation error. The task will not be executed again.");function iw(t,e,n=!1){let r,i=new Promise(a=>{r=(c,l)=>{var u;try{(u=t.after)==null||u.call(t,c,l)}catch(h){e==null||e.error(`Error in after callback: ${h}`)}a(c)}}),o=t.before?t.before():Promise.resolve(void 0),s=!1;return{execute:()=>{s&&(e==null||e.error(ep)),s=!0,o.then(a=>{t.execute(a).then(c=>r({status:"complete",result:c},a)).catch(c=>r({status:"error",error:c},a))}).catch(a=>{e==null||e.error(a),r({status:"error",error:a},void 0)})},shed:()=>{s&&(e==null||e.error(ep)),s=!0,o.then(a=>{r({status:"shed"},a)})},promise:i,sheddable:n}}function ow(t){let e,n=[];function r(){if(!e&&n.length>0){let i=n.shift();e=i.promise.finally(()=>{e=void 0,r()}),i.execute()}}return{execute(i,o=!1){var s,a;let c=iw(i,t,o);return e?((s=n[n.length-1])!=null&&s.sheddable&&((a=n.pop())==null||a.shed()),n.push(c)):(e=c.promise.finally(()=>{e=void 0,r()}),c.execute()),c.promise},pendingCount(){return n.length}}}var sw={logger:G.Object,maxCachedContexts:G.numberWithMin(0),baseUri:G.String,streamUri:G.String,eventsUri:G.String,capacity:G.numberWithMin(1),diagnosticRecordingInterval:G.numberWithMin(2),flushInterval:G.numberWithMin(2),streamInitialReconnectDelay:G.numberWithMin(0),allAttributesPrivate:G.Boolean,debug:G.Boolean,diagnosticOptOut:G.Boolean,withReasons:G.Boolean,sendEvents:G.Boolean,pollInterval:G.numberWithMin(30),useReport:G.Boolean,privateAttributes:G.StringArray,applicationInfo:G.Object,wrapperName:G.String,wrapperVersion:G.String,payloadFilterKey:G.stringMatchingRegex(/^[a-zA-Z0-9](\w|\.|-)*$/),hooks:G.createTypeArray("Hook[]",{}),inspectors:G.createTypeArray("LDInspection",{}),cleanOldPersistentData:G.Boolean},aw=300,Wp="https://clientsdk.launchdarkly.com",Up="https://clientstream.launchdarkly.com";function lw(t){return t instanceof Tp?t:Ep(t)}var cw=class{constructor(t={},e={getImplementationHooks:()=>[],credentialType:"mobileKey"}){var n,r,i;this.logger=Ep(),this.baseUri=Wp,this.eventsUri=Ji.DEFAULT_EVENTS,this.streamUri=Up,this.maxCachedContexts=5,this.capacity=100,this.diagnosticRecordingInterval=900,this.flushInterval=30,this.streamInitialReconnectDelay=1,this.allAttributesPrivate=!1,this.debug=!1,this.diagnosticOptOut=!1,this.sendEvents=!0,this.sendLDHeaders=!0,this.useReport=!1,this.withReasons=!1,this.privateAttributes=[],this.pollInterval=aw,this.hooks=[],this.inspectors=[],this.logger=lw(t.logger),this.Ti(t).forEach(o=>this.logger.warn(o)),this.serviceEndpoints=new Ji(this.streamUri,this.baseUri,this.eventsUri,e.analyticsEventPath,e.diagnosticEventPath,e.includeAuthorizationHeader,t.payloadFilterKey),this.useReport=(n=t.useReport)!=null?n:!1,this.tags=new VS({application:this.applicationInfo,logger:this.logger}),this.userAgentHeaderName=(r=e.userAgentHeaderName)!=null?r:"user-agent",this.trackEventModifier=(i=e.trackEventModifier)!=null?i:(o=>o),this.credentialType=e.credentialType,this.getImplementationHooks=e.getImplementationHooks}Ti(t){let e=[];return Object.entries(t).forEach(([n,r])=>{let i=sw[n];if(i)if(i.is(r))n==="logger"||(this[n]=r!=null?r:void 0);else{let o=i.getType();if(o==="boolean")e.push(Ue.wrongOptionTypeBoolean(n,typeof r)),this[n]=!!r;else if(o==="boolean | undefined | null")e.push(Ue.wrongOptionTypeBoolean(n,typeof r)),typeof r!="boolean"&&typeof r!="undefined"&&r!==null&&(this[n]=!!r);else if(i instanceof gp&&G.Number.is(r)){let{min:s}=i;e.push(Ue.optionBelowMinimum(n,r,s)),this[n]=s}else e.push(Ue.wrongOptionType(n,i.getType(),typeof r))}else e.push(Ue.unknownOption(n))}),e}};async function Mp(t,e){if(t.digest)return t.digest(e);if(t.asyncDigest)return t.asyncDigest(e);throw new Error("Platform must implement digest or asyncDigest")}var Pp=async(t,{crypto:e,storage:n})=>{let r=await(n==null?void 0:n.get(t));return r||(r=e.randomUUID(),await(n==null?void 0:n.set(t,r))),r};function Fp(t){return async e=>Mp(t.createHash("sha256").update(e),"base64")}var fe=async t=>t;async function gr(t){return(await Promise.all(t.map(e=>e.transform(e.value)))).join("_")}async function uw(t,e){return gr([{value:"LaunchDarkly",transform:fe},{value:e,transform:Fp(t)}])}async function hw(t){return gr([{value:"LaunchDarkly",transform:fe},{value:"AnonymousKeys",transform:fe},{value:t,transform:fe}])}async function pw(t){return gr([{value:"LaunchDarkly",transform:fe},{value:"ContextKeys",transform:fe},{value:t,transform:fe}])}async function dw(t){return gr([{value:t,transform:fe},{value:"ContextIndex",transform:fe}])}async function np(t,e,n){return gr([{value:e,transform:fe},{value:n.canonicalKey,transform:Fp(t)}])}var{isLegacyUser:fw,isSingleKind:Va,isMultiKind:rp}=de,Ap="1.0",mw=t=>{let e=t,{kind:n}=e,r=fp(e,["kind"]);return{kind:"multi",[n]:r}},yw=async({crypto:t,info:e},{applicationInfo:n})=>{var r;let{ld_application:i}=e.platformData(),o=(r=Ja(i))!=null?r:{},s=(n==null?void 0:n.id)||(o==null?void 0:o.id);if(s){let a=(n==null?void 0:n.version)||(o==null?void 0:o.version),c=(n==null?void 0:n.name)||(o==null?void 0:o.name),l=(n==null?void 0:n.versionName)||(o==null?void 0:o.versionName);return o=at(at(at(me(at({},o),{id:s}),a?{version:a}:{}),c?{name:c}:{}),l?{versionName:l}:{}),o.key=await Mp(t.createHash("sha256").update(s),"base64"),o.envAttributesVersion=o.envAttributesVersion||Ap,o}},gw=async t=>{var e,n,r,i;let{ld_device:o,os:s}=t.info.platformData(),a=(e=Ja(o))!=null?e:{},c=(s==null?void 0:s.name)||((n=a.os)==null?void 0:n.name),l=(s==null?void 0:s.version)||((r=a.os)==null?void 0:r.version),u=(i=a.os)==null?void 0:i.family;if((c||l||u)&&(a.os=at(at(at({},c?{name:c}:{}),l?{version:l}:{}),u?{family:u}:{})),Object.keys(a).filter(h=>h!=="key"&&h!=="envAttributesVersion").length){let h=await pw("ld_device");return a.key=await Pp(h,t),a.envAttributesVersion=a.envAttributesVersion||Ap,a}},bw=async(t,e,n)=>{if(fw(t))return t;let r,i;if(Va(t)&&t.kind!=="ld_application"||rp(t)&&!t.ld_application?r=await yw(e,n):n.logger.warn("Not adding ld_application environment attributes because it already exists."),Va(t)&&t.kind!=="ld_device"||rp(t)&&!t.ld_device?i=await gw(e):n.logger.warn("Not adding ld_device environment attributes because it already exists."),r||i){let o=Va(t)?mw(t):t;return at(at(at({},o),r?{ld_application:r}:{}),i?{ld_device:i}:{})}return t};function vw(){let t,e;return{set(n,r){t=n,e=r},getContext(){return e},getUnwrappedContext(){return t},newIdentificationPromise(){let n,r;return{identifyPromise:new Promise((i,o)=>{n=i,r=o}),identifyResolve:n,identifyReject:r}},hasContext(){return e!==void 0},hasValidContext(){return this.hasContext()&&e.valid}}}var{isLegacyUser:Sw,isMultiKind:ww,isSingleKind:Iw}=de,Da=async(t,e,n)=>{let{anonymous:r,key:i}=e;if(r&&!i){let o=await hw(t);e.key=await Pp(o,n)}},Tw=async(t,e)=>{await Da(t.kind,t,e)},Ew=async(t,e)=>{let n=t,{kind:r}=n,i=fp(n,["kind"]);return Promise.all(Object.entries(i).map(([o,s])=>Da(o,s,e)))},Rw=async(t,e)=>{await Da("user",t,e)},Cw=async(t,e)=>{let n=kp(t);return Iw(n)&&await Tw(n,e),ww(n)&&await Ew(n,e),Sw(n)&&await Rw(n,e),n},Zw=t=>({customBaseURI:t.serviceEndpoints.polling!==Wp,customStreamURI:t.serviceEndpoints.streaming!==Up,customEventsURI:t.serviceEndpoints.events!==Ji.DEFAULT_EVENTS,eventsCapacity:t.capacity,eventsFlushIntervalMillis:ka(t.flushInterval),reconnectTimeMillis:ka(t.streamInitialReconnectDelay),diagnosticRecordingIntervalMillis:ka(t.diagnosticRecordingInterval),allAttributesPrivate:t.allAttributesPrivate,usingSecureMode:!1,bootstrapMode:!1}),kw=(t,e,n)=>{if(e.sendEvents&&!e.diagnosticOptOut)return new de.DiagnosticsManager(t,n,Zw(e))};function ip(t,e){return{value:e!=null?e:null,variationIndex:null,reason:{kind:"ERROR",errorKind:t}}}function op(t,e,n){return{value:t,variationIndex:e!=null?e:null,reason:n!=null?n:null}}var Vw=(t,e,n,r,i)=>{if(e.sendEvents)return new de.EventProcessor(me(at({},e),{eventsCapacity:e.capacity}),new xS(t,e,n),r,void 0,i,!1,!0)},sp=class extends de.EventFactoryBase{evalEventClient(t,e,n,r,i,o){let{trackEvents:s,debugEventsUntilDate:a,trackReason:c,flagVersion:l,version:u,variation:h}=r;return super.evalEvent({addExperimentData:c,context:i,debugEventsUntilDate:a,defaultVal:n,flagKey:t,reason:o,trackEvents:!!s,value:e,variation:h,version:l!=null?l:u})}},xa=class Jp{constructor(){this.container={index:new Array}}static fromJson(e){let n=new Jp;try{n.container=JSON.parse(e)}catch(r){}return n}toJson(){return JSON.stringify(this.container)}notice(e,n){let r=this.container.index.find(i=>i.id===e);r===void 0?this.container.index.push({id:e,timestamp:n}):r.timestamp=n}prune(e){let n=Math.max(e,0);return this.container.index.length>n?(this.container.index.sort((r,i)=>r.timestamp-i.timestamp),this.container.index.splice(0,this.container.index.length-n)):[]}},xw=class{constructor(t,e,n,r,i,o,s=()=>Date.now()){this.g=t,this.Rt=e,this.$i=n,this.$=r,this.w=i,this.t=o,this.dt=s,this.ke=dw(this.Rt)}async init(t,e){this.w.init(t,e),await this.xe(t)}async upsert(t,e,n){return this.w.upsert(t,e,n)?(await this.xe(t),!0):!1}async loadCached(t){var e,n,r,i;let o=await np(this.g.crypto,this.Rt,t),s=await((e=this.g.storage)==null?void 0:e.get(o));if(s==null){if(s=await((n=this.g.storage)==null?void 0:n.get(t.canonicalKey)),s==null)return!1;await((r=this.g.storage)==null?void 0:r.set(o,s)),await((i=this.g.storage)==null?void 0:i.clear(t.canonicalKey))}try{let a=JSON.parse(s),c=Object.entries(a).reduce((l,[u,h])=>(l[u]={version:h.version,flag:h},l),{});return this.w.initCached(t,c),this.t.debug("Loaded cached flag evaluations from persistent storage"),!0}catch(a){return this.t.warn(`Could not load cached flag evaluations from persistent storage: ${a.message}`),!1}}async Ni(){var t;if(this.G!==void 0)return this.G;let e=await((t=this.g.storage)==null?void 0:t.get(await this.ke));if(!e)return this.G=new xa,this.G;try{this.G=xa.fromJson(e),this.t.debug("Loaded context index from persistent storage")}catch(n){this.t.warn(`Could not load index from persistent storage: ${n.message}`),this.G=new xa}return this.G}async xe(t){var e,n;let r=await this.Ni(),i=await np(this.g.crypto,this.Rt,t);r.notice(i,this.dt());let o=r.prune(this.$i);await Promise.all(o.map(async l=>{var u;return(u=this.g.storage)==null?void 0:u.clear(l.id)})),await((e=this.g.storage)==null?void 0:e.set(await this.ke,r.toJson()));let s=this.$.getAll(),a=Object.entries(s).reduce((l,[u,h])=>(h.flag!==null&&h.flag!==void 0&&(l[u]=h.flag),l),{}),c=JSON.stringify(a);await((n=this.g.storage)==null?void 0:n.set(i,c))}};function Nw(){let t={};return{init(e){t=Object.entries(e).reduce((n,[r,i])=>(n[r]=i,n),{})},insertOrUpdate(e,n){t[e]=n},get(e){if(Object.prototype.hasOwnProperty.call(t,e))return t[e]},getAll(){return t}}}function Ow(t,e){let n=[];return Object.entries(t).forEach(([r,i])=>{let o=e[r];(!o||!Wi(i,o))&&n.push(r)}),Object.keys(e).forEach(r=>{t[r]||n.push(r)}),n}function Gw(t,e){let n=t,r=e,i,o=new Array;return{handleFlagChanges(s,a){i?o.forEach(c=>{try{c(i,s,a)}catch(l){}}):r.warn("Received a change event without an active context. Changes will not be propagated.")},init(s,a){i=s;let c=n.getAll();n.init(a);let l=Ow(c,a);l.length>0&&this.handleFlagChanges(l,"init")},initCached(s,a){(i==null?void 0:i.canonicalKey)!==s.canonicalKey&&this.init(s,a)},upsert(s,a,c){if((i==null?void 0:i.canonicalKey)!==s.canonicalKey)return r.warn("Received an update for an inactive context."),!1;let l=n.get(a);return l!==void 0&&l.version>=c.version?!1:(n.insertOrUpdate(a,c),this.handleFlagChanges([a],"patch"),!0)},on(s){o.push(s)},off(s){let a=o.indexOf(s);a>-1&&o.splice(a,1)}}}var Lw=class{constructor(t,e,n,r,i=()=>Date.now()){this.$=Nw(),this.w=Gw(this.$,r),this.Mt=this.Ri(t,e,n,r,i)}async Ri(t,e,n,r,i=()=>Date.now()){let o=await uw(t.crypto,e);return new xw(t,o,n,this.$,this.w,r,i)}get(t){return this.r&&Object.prototype.hasOwnProperty.call(this.r,t)?this.Ft(this.r[t]):this.$.get(t)}getAll(){return this.r?at(at({},this.$.getAll()),Object.entries(this.r).reduce((t,[e,n])=>(t[e]=this.Ft(n),t),{})):this.$.getAll()}presetFlags(t){this.$.init(t)}setBootstrap(t,e){this.w.init(t,e)}async init(t,e){return(await this.Mt).init(t,e)}async upsert(t,e,n){return(await this.Mt).upsert(t,e,n)}async loadCached(t){return(await this.Mt).loadCached(t)}on(t){this.w.on(t)}off(t){this.w.off(t)}Ft(t){return{flag:{value:t,version:0},version:0}}setOverride(t,e){this.r||(this.r={}),this.r[t]=e,this.w.handleFlagChanges([t],"override")}removeOverride(t){!this.r||!Object.prototype.hasOwnProperty.call(this.r,t)||(delete this.r[t],Object.keys(this.r).length===0&&(this.r=void 0),this.w.handleFlagChanges([t],"override"))}clearAllOverrides(){if(this.r){let t=at({},this.r);this.r=void 0,this.w.handleFlagChanges(Object.keys(t),"override")}}getAllOverrides(){if(!this.r)return{};let t={};return Object.entries(this.r).forEach(([e,n])=>{t[e]=this.Ft(n)}),t}getDebugOverride(){return{setOverride:this.setOverride.bind(this),removeOverride:this.removeOverride.bind(this),clearAllOverrides:this.clearAllOverrides.bind(this),getAllOverrides:this.getAllOverrides.bind(this)}}},ap="unknown hook",Dp="beforeEvaluation",Yp="afterEvaluation",Xw="afterTrack";function br(t,e,n,r,i){try{return r()}catch(o){return t==null||t.error(`An error was encountered in "${e}" of the "${n}" hook: ${o}`),i}}function vr(t,e){try{return e.getMetadata().name||ap}catch(n){return t.error("Exception thrown getting metadata for hook. Unable to get hook name."),ap}}function Ww(t,e,n){return e.map(r=>br(t,Dp,vr(t,r),()=>{var i,o;return(o=(i=r==null?void 0:r.beforeEvaluation)==null?void 0:i.call(r,n,{}))!=null?o:{}},{}))}function Uw(t,e,n,r,i){for(let o=e.length-1;o>=0;o-=1){let s=e[o],a=r[o];br(t,Yp,vr(t,s),()=>{var c,l;return(l=(c=s==null?void 0:s.afterEvaluation)==null?void 0:c.call(s,n,a,i))!=null?l:{}},{})}}function Mw(t,e,n){return e.map(r=>br(t,Dp,vr(t,r),()=>{var i,o;return(o=(i=r==null?void 0:r.beforeIdentify)==null?void 0:i.call(r,n,{}))!=null?o:{}},{}))}function Pw(t,e,n,r,i){for(let o=e.length-1;o>=0;o-=1){let s=e[o],a=r[o];br(t,Yp,vr(t,s),()=>{var c,l;return(l=(c=s==null?void 0:s.afterIdentify)==null?void 0:c.call(s,n,a,i))!=null?l:{}},{})}}function Fw(t,e,n){for(let r=e.length-1;r>=0;r-=1){let i=e[r];br(t,Xw,vr(t,i),()=>{var o;return(o=i==null?void 0:i.afterTrack)==null?void 0:o.call(i,n)},void 0)}}var Aw=class{constructor(t,e){this.t=t,this.F=[],this.F.push(...e)}withEvaluation(t,e,n,r){if(this.F.length===0)return r();let i=[...this.F],o={flagKey:t,context:e,defaultValue:n},s=Ww(this.t,i,o),a=r();return Uw(this.t,i,o,s,a),a}identify(t,e){let n=[...this.F],r={context:t,timeout:e},i=Mw(this.t,n,r);return o=>{Pw(this.t,n,r,i,o)}}addHook(t){this.F.push(t)}afterTrack(t){if(this.F.length===0)return;let e=[...this.F];Fw(this.t,e,t)}};function Jw(t){return{getMetadata(){return{name:"LaunchDarkly-Inspector-Adapter"}},afterEvaluation:(e,n,r)=>(t.onFlagUsed(e.flagKey,r,e.context),n),afterIdentify(e,n,r){return t.onIdentityChanged(e.context),n}}}function Dw(t,e){return`an inspector: "${e}" of an invalid type (${t}) was configured`}function Yw(t,e){return`an inspector: "${e}" of type: "${t}" generated an exception`}function Kw(t,e){let n=!1,r={method:(...i)=>{try{t.method(...i)}catch(o){n||(n=!0,e.warn(Yw(r.type,r.name)))}},type:t.type,name:t.name,synchronous:t.synchronous};return r}var Kp="flag-used",_p="flag-details-changed",Hp="flag-detail-changed",zp="client-identity-changed",_w=[Kp,_p,Hp,zp];function Hw(t,e){let n=_w.includes(t.type)&&t.method&&typeof t.method=="function";return n||e.warn(Dw(t.type,t.name)),n}var zw=class{constructor(t,e){this.W=[];let n=t.filter(r=>Hw(r,e));this.W=n.map(r=>Kw(r,e))}hasInspectors(){return this.W.length!==0}onFlagUsed(t,e,n){this.W.forEach(r=>{r.type===Kp&&r.method(t,e,n)})}onFlagsChanged(t){this.W.forEach(e=>{e.type===_p&&e.method(t)})}onFlagChanged(t,e){this.W.forEach(n=>{n.type===Hp&&n.method(t,e)})}onIdentityChanged(t){this.W.forEach(e=>{e.type===zp&&e.method(t)})}},Bw=class{constructor(t){this.t=t,this.n=new Map}on(t,e){var n;this.n.has(t)?(n=this.n.get(t))==null||n.push(e):this.n.set(t,[e])}off(t,e){let n=this.n.get(t);if(n){if(e){let r=n.filter(i=>i!==e);r.length===0?this.n.delete(t):this.n.set(t,r);return}this.n.delete(t)}}Mi(t,e,...n){var r;try{t(...n)}catch(i){(r=this.t)==null||r.error(`Encountered error invoking handler for "${e}", detail: "${i}"`)}}emit(t,...e){let n=this.n.get(t);n==null||n.forEach(r=>this.Mi(r,t,...e))}eventNames(){return[...this.n.keys()]}listenerCount(t){var e,n;return(n=(e=this.n.get(t))==null?void 0:e.length)!=null?n:0}};function jw(t,e,n){let r=e.info.sdkData(),i;n.applicationInfo&&(n.applicationInfo.id&&(i=i!=null?i:{},i.id=n.applicationInfo.id),n.applicationInfo.version&&(i=i!=null?i:{},i.version=n.applicationInfo.version),n.applicationInfo.name&&(i=i!=null?i:{},i.name=n.applicationInfo.name),n.applicationInfo.versionName&&(i=i!=null?i:{},i.versionName=n.applicationInfo.versionName));let o={name:r.userAgentBase,version:r.version};r.wrapperName&&(o.wrapperName=r.wrapperName),r.wrapperVersion&&(o.wrapperVersion=r.wrapperVersion);let s={sdk:o,[n.credentialType]:t};return i&&(s.application=i),s}var{ClientMessages:lp,ErrorKinds:cp}=de,Qw=5,$w=class{constructor(t,e,n,r,i,o){if(this.sdkKey=t,this.autoEnvAttributes=e,this.platform=n,this.a=vw(),this.Ut=15,this.N=new sp(!1),this.ft=new sp(!0),this.Vt=!1,this.Fi=ow(),!t)throw new Error("You must configure the client with a client-side SDK key");if(!n.encoding)throw new Error("Platform must implement Encoding because btoa is required.");this.e=new cw(r,o),this.logger=this.e.logger,this.Se=US(this.sdkKey,this.platform.info,this.e.tags,this.e.serviceEndpoints.includeAuthorizationHeader,this.e.userAgentHeaderName),this.E=new Lw(this.platform,t,this.e.maxCachedContexts,this.e.logger),this.L=kw(t,this.e,n),this.D=Vw(t,this.e,n,this.Se,this.L),this.emitter=new Bw,this.emitter.on("error",(a,c)=>{this.logger.error(`error: ${c}, context: ${JSON.stringify(a)}`)}),this.E.on((a,c,l)=>{this.Ui(c,l);let u=xn.toLDContext(a);this.emitter.emit("change",u,c),c.forEach(h=>{this.emitter.emit(`change:${h}`,u)})}),this.dataManager=i(this.E,this.e,this.Se,this.emitter,this.L);let s=[...this.e.hooks];if(this.environmentMetadata=jw(this.sdkKey,this.platform,this.e),this.e.getImplementationHooks(this.environmentMetadata).forEach(a=>{s.push(a)}),this.U=new Aw(this.logger,s),this.Q=new zw(this.e.inspectors,this.logger),this.Q.hasInspectors()&&this.U.addHook(Jw(this.Q)),r.cleanOldPersistentData&&o!=null&&o.getLegacyStorageKeys&&this.platform.storage)try{this.logger.debug("Cleaning old persistent data."),Promise.all(o.getLegacyStorageKeys().map(a=>{var c;return(c=this.platform.storage)==null?void 0:c.clear(a)})).catch(a=>{this.logger.error(`Error cleaning old persistent data: ${a}`)}).finally(()=>{this.logger.debug("Cleaned old persistent data.")})}catch(a){this.logger.error(`Error cleaning old persistent data: ${a}`)}}allFlags(){return Object.entries(this.E.getAll()).reduce((t,[e,n])=>(n.flag!==null&&n.flag!==void 0&&!n.flag.deleted&&(t[e]=n.flag.value),t),{})}async close(){var t;await this.flush(),(t=this.D)==null||t.close(),this.dataManager.close(),this.logger.debug("Closed event processor and data source.")}async flush(){var t;try{await((t=this.D)==null?void 0:t.flush()),this.logger.debug("Successfully flushed event processor.")}catch(e){return this.logger.error(`Error flushing event processor: ${e}.`),{error:e,result:!1}}return{result:!0}}getContext(){return this.a.hasContext()?kp(this.a.getUnwrappedContext()):void 0}getInternalContext(){return this.a.getContext()}presetFlags(t){this.E.presetFlags(t)}async identify(t,e){let n=await this.identifyResult(t,e);if(n.status==="error")throw n.error;if(n.status==="timeout"){let r=new Zp(`identify timed out after ${n.timeout} seconds.`);throw this.logger.error(r.message),r}}async identifyResult(t,e){var n,r;let i=(n=e==null?void 0:e.timeout)!=null?n:Qw,o=(e==null?void 0:e.timeout)===void 0&&(e==null?void 0:e.noTimeout)===!0;i>this.Ut&&this.logger.warn(`The identify function was called with a timeout greater than ${this.Ut} seconds. We recommend a timeout of less than ${this.Ut} seconds.`);let s=this.Fi.execute({before:async()=>{let c=await Cw(t,this.platform);this.autoEnvAttributes===Ai.Enabled&&(c=await bw(c,this.platform,this.e));let l=xn.fromLDContext(c);if(l.valid){let u=this.U.identify(c,e==null?void 0:e.timeout);return{context:c,checkedContext:l,afterIdentify:u}}return{context:c,checkedContext:l}},execute:async c=>{var l;let{context:u,checkedContext:h}=c;if(!h.valid){let d=new Error("Context was unspecified or had no key");return this.emitter.emit("error",u,d),Promise.reject(d)}this.a.set(u,h),(l=this.D)==null||l.sendEvent(this.N.identifyEvent(h));let{identifyPromise:p,identifyResolve:f,identifyReject:m}=this.a.newIdentificationPromise();return this.logger.debug(`Identifying ${JSON.stringify(h)}`),await this.dataManager.identify(f,m,h,e),p},after:async(c,l)=>{var u,h,p;c.status==="complete"?(u=l==null?void 0:l.afterIdentify)==null||u.call(l,{status:"completed"}):c.status==="shed"?(h=l==null?void 0:l.afterIdentify)==null||h.call(l,{status:"shed"}):c.status==="error"&&((p=l==null?void 0:l.afterIdentify)==null||p.call(l,{status:"error"}))}},(r=e==null?void 0:e.sheddable)!=null?r:!1).then(c=>{if(c.status==="error"){let u={status:"error",error:c.error};return this.maybeSetInitializationResult({status:"failed",error:c.error}),u}if(c.status==="shed")return{status:"shed"};let l={status:"completed"};return this.maybeSetInitializationResult({status:"complete"}),l});if(o)return s;let a=new Promise(c=>{setTimeout(()=>{c({status:"timeout",timeout:i})},i*1e3)});return Promise.race([s,a])}maybeSetInitializationResult(t){this.initializeResult===void 0&&(this.initializeResult=t,this.emitter.emit("ready"),t.status==="complete"&&this.emitter.emit("initialized"),this.initResolve&&(this.initResolve(t),this.initResolve=void 0))}waitForInitialization(t){var e;let n=(e=t==null?void 0:t.timeout)!=null?e:5;return this.initializeResult?Promise.resolve(this.initializeResult):this.initializedPromise?this.promiseWithTimeout(this.initializedPromise,n):(this.initializedPromise||(this.initializedPromise=new Promise(r=>{this.initResolve=r})),this.promiseWithTimeout(this.initializedPromise,n))}promiseWithTimeout(t,e){let n=XS(e,"waitForInitialization");return Promise.race([t.then(r=>(n.cancel(),r)),n.promise.then(()=>({status:"complete"})).catch(()=>({status:"timeout"}))]).catch(r=>{var i;return(i=this.logger)==null||i.error(r.message),{status:"failed",error:r}})}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}track(t,e,n){var r,i;if(!this.a.hasValidContext()){this.logger.warn(lp.MissingContextKeyNoEvent);return}n!==void 0&&!G.Number.is(n)&&((r=this.logger)==null||r.warn(lp.invalidMetricValue(typeof n))),(i=this.D)==null||i.sendEvent(this.e.trackEventModifier(this.N.customEvent(t,this.a.getContext(),e,n))),this.U.afterTrack({key:t,context:this.a.getUnwrappedContext(),data:e,metricValue:n})}gt(t,e,n,r){var i,o,s,a,c;let l=this.a.hasContext();l||(i=this.logger)==null||i.warn("Flag evaluation called before client is fully initialized, data from this evaulation could be stale.");let u=this.a.getContext(),h=this.E.get(t);if(h===void 0||h.flag.deleted){let v=e!=null?e:null;return(o=this.logger)==null||o.warn(`Unknown feature flag "${t}"; returning default value ${v}.`),l&&((s=this.D)==null||s.sendEvent(this.N.unknownFlagEvent(t,v,u))),ip(cp.FlagNotFound,e)}let{reason:p,value:f,variation:m,prerequisites:d}=h.flag;if(r){let[v,I]=r(f);if(!v){l&&((a=this.D)==null||a.sendEvent(n.evalEventClient(t,e,e,h.flag,u,p)));let R=new GS(`Wrong type "${I}" for feature flag "${t}"; returning default value`);return this.emitter.emit("error",this.a.getUnwrappedContext(),R),ip(cp.WrongType,e)}}let b=op(f,m,p);return f==null&&(this.logger.debug("Result value is null. Providing default value."),b.value=e),d==null||d.forEach(v=>{this.gt(v,void 0,this.N)}),l&&((c=this.D)==null||c.sendEvent(n.evalEventClient(t,f,e,h.flag,u,p))),b}variation(t,e){let{value:n}=this.U.withEvaluation(t,this.a.getUnwrappedContext(),e,()=>this.gt(t,e,this.N));return n}variationDetail(t,e){return this.U.withEvaluation(t,this.a.getUnwrappedContext(),e,()=>this.gt(t,e,this.ft))}_(t,e,n,r){return this.U.withEvaluation(t,this.a.getUnwrappedContext(),e,()=>this.gt(t,e,n,r))}boolVariation(t,e){return this._(t,e,this.N,n=>[G.Boolean.is(n),G.Boolean.getType()]).value}jsonVariation(t,e){return this.variation(t,e)}numberVariation(t,e){return this._(t,e,this.N,n=>[G.Number.is(n),G.Number.getType()]).value}stringVariation(t,e){return this._(t,e,this.N,n=>[G.String.is(n),G.String.getType()]).value}boolVariationDetail(t,e){return this._(t,e,this.ft,n=>[G.Boolean.is(n),G.Boolean.getType()])}numberVariationDetail(t,e){return this._(t,e,this.ft,n=>[G.Number.is(n),G.Number.getType()])}stringVariationDetail(t,e){return this._(t,e,this.ft,n=>[G.String.is(n),G.String.getType()])}jsonVariationDetail(t,e){return this.variationDetail(t,e)}addHook(t){this.U.addHook(t)}setEventSendingEnabled(t,e){var n,r,i,o;this.Vt!==t&&(this.Vt=t,t?(this.logger.debug("Starting event processor"),(n=this.D)==null||n.start()):e?((r=this.logger)==null||r.debug("Flushing event processor before disabling."),this.flush().then(()=>{var s,a;this.Vt||((s=this.logger)==null||s.debug("Stopping event processor."),(a=this.D)==null||a.close())})):((i=this.logger)==null||i.debug("Stopping event processor."),(o=this.D)==null||o.close()))}sendEvent(t){var e;(e=this.D)==null||e.sendEvent(t)}getDebugOverrides(){var t,e;return(e=(t=this.E).getDebugOverride)==null?void 0:e.call(t)}Ui(t,e){if(!this.Q.hasInspectors())return;let n={};t.forEach(r=>{let i=this.E.get(r);if(i!=null&&i.flag&&!i.flag.deleted){let{reason:o,value:s,variation:a}=i.flag;n[r]=op(s,a,o)}else n[r]={value:void 0,reason:null,variationIndex:null}}),e==="init"?this.Q.onFlagsChanged(n):e==="patch"&&Object.entries(n).forEach(([r,i])=>{this.Q.onFlagChanged(r,i)})}};function qw(t,e,n){n.forEach(r=>{var i;try{(i=r.registerDebug)==null||i.call(r,e)}catch(o){t.error(`Exception thrown registering plugin ${de.safeGetName(t,r)}.`)}})}var tI=class{constructor(t,e,n){this.E=t,this.jt=e,this.t=n}async handlePut(t,e){this.t.debug(`Got PUT: ${Object.keys(e)}`);let n=Object.entries(e).reduce((r,[i,o])=>(r[i]={version:o.version,flag:o},r),{});await this.E.init(t,n),this.jt.requestStateUpdate(Kt.Valid)}async handlePatch(t,e){this.t.debug(`Got PATCH ${JSON.stringify(e,null,2)}`),this.E.upsert(t,e.key,{version:e.version,flag:e})}async handleDelete(t,e){this.t.debug(`Got DELETE ${JSON.stringify(e,null,2)}`),this.E.upsert(t,e.key,{version:e.version,flag:me(at({},e),{deleted:!0,flagVersion:0,value:void 0,variation:0,trackEvents:!1})})}handleStreamingError(t){this.jt.reportError(t.kind,t.message,t.code,t.recoverable)}handlePollingError(t){this.jt.reportError(t.kind,t.message,t.status,t.recoverable)}},eI=class{constructor(t,e=()=>Date.now()){this.Vi=t,this.pt=Kt.Closed,this.Le=e(),this.dt=e}get status(){return{state:this.pt,stateSince:this.Le,lastError:this.ji}}Ce(t,e=!1){let n=t===Kt.Interrupted&&this.pt===Kt.Initializing?Kt.Initializing:t,r=this.pt!==n;r&&(this.pt=n,this.Le=this.dt()),(r||e)&&this.Vi.emit("dataSourceStatus",this.status)}requestStateUpdate(t){this.Ce(t)}reportError(t,e,n,r=!1){let i={kind:t,message:e,statusCode:n,time:this.dt()};this.ji=i,this.Ce(r?Kt.Interrupted:Kt.Closed,!0)}};function up(t){t==null||t.debug("Poll completed after the processor was closed. Skipping processing.")}var nI=class{constructor(t,e,n,r,i){this.Hi=t,this.zi=e,this.Bi=n,this.m=r,this.t=i,this.u=!1}async Ie(){var t,e,n,r,i,o,s;if(this.u)return;let a=h=>{var p,f,m;(p=this.t)==null||p.error("Polling received invalid data"),(f=this.t)==null||f.debug(`Invalid JSON follows: ${h}`),(m=this.m)==null||m.call(this,new Fi(_t.InvalidData,"Malformed JSON data in polling response"))};(t=this.t)==null||t.debug("Polling LaunchDarkly for feature flag updates");let c=Date.now();try{let h=await this.Hi.requestPayload();try{if(this.u){up(this.t);return}let p=JSON.parse(h);try{(e=this.Bi)==null||e.call(this,p)}catch(f){(n=this.t)==null||n.error(`Exception from data handler: ${f}`)}}catch(p){a(h)}}catch(h){if(this.u){up(this.t);return}let p=h;if(p.status!==void 0&&!Ki(p.status)){(r=this.t)==null||r.error(Gn(h,"polling request")),(i=this.m)==null||i.call(this,new Fi(_t.ErrorResponse,p.message,p.status));return}(o=this.t)==null||o.error(Gn(h,"polling request","will retry"))}let l=Date.now()-c,u=Math.max(this.zi*1e3-l,0);(s=this.t)==null||s.debug("Elapsed: %d ms, sleeping for %d ms",l,u),this.Ht=setTimeout(()=>{this.Ie()},u)}start(){this.Ie()}stop(){this.Ht&&(clearTimeout(this.Ht),this.Ht=void 0),this.u=!0}close(){this.stop()}},rI=(t,e,n,r)=>{n==null||n.error(`Stream received invalid data in "${t}" message`),n==null||n.debug(`Invalid JSON follows: ${e}`),r==null||r(new Xa(_t.InvalidData,"Malformed JSON data in event stream"))};function iI(t,e){e==null||e.debug(`Received ${t} event after processor was closed. Skipping processing.`)}function hp(t){t==null||t.debug("Ping completed after processor was closed. Skipping processing.")}var oI=class{constructor(t,e,n,r,i,o,s,a,c){var l;this.Ki=t,this.zt=e,this.n=n,this.T=r,this.Gi=o,this.L=s,this.m=a,this.t=c,this.u=!1;let u;e.useReport&&!r.getEventSourceCapabilities().customMethod?u=e.paths.pathPing(i,t):u=e.useReport?e.paths.pathReport(i,t):e.paths.pathGet(i,t);let h=[...(l=e.queryParameters)!=null?l:[]];this.zt.withReasons&&h.push({key:"withReasons",value:"true"}),this.T=r,this.ht=at({},e.baseHeaders),this.t=c,this.Wi=NS(e.serviceEndpoints,u,h)}Ae(){this.mt=Date.now()}Bt(t){this.mt&&this.L&&this.L.recordStreamInit(this.mt,!t,Date.now()-this.mt),this.mt=void 0}Ar(t){var e,n,r;return Vp(t)?((r=this.t)==null||r.warn(Gn(t,"streaming request","will retry")),this.Bt(!1),this.Ae(),!0):(this.Bt(!1),(e=this.m)==null||e.call(this,new Xa(_t.ErrorResponse,t.message,t.status,!1)),(n=this.t)==null||n.error(Gn(t,"streaming request")),!1)}start(){this.Ae();let t;this.zt.useReport?(this.ht["content-type"]="application/json",t={method:"REPORT",body:this.Ki}):t={};let e=this.T.createEventSource(this.Wi,me(at({headers:this.ht},t),{errorFilter:n=>this.Ar(n),initialRetryDelayMillis:this.zt.initialRetryDelayMillis,readTimeoutMillis:300*1e3,retryResetIntervalMillis:60*1e3}));this.Pe=e,e.onclose=()=>{var n;(n=this.t)==null||n.info("Closed LaunchDarkly stream connection")},e.onerror=()=>{},e.onopen=()=>{var n;(n=this.t)==null||n.info("Opened LaunchDarkly stream connection")},e.onretrying=n=>{var r;(r=this.t)==null||r.info(`Will retry stream connection in ${n.delayMillis} milliseconds`)},this.n.forEach(({deserializeData:n,processJson:r},i)=>{e.addEventListener(i,o=>{var s,a;if(this.u){iI(i,this.t);return}if((s=this.t)==null||s.debug(`Received ${i} event`),o!=null&&o.data){this.Bt(!0);let{data:c}=o,l=n(c);if(!l){rI(i,c,this.t,this.m);return}r(l)}else(a=this.m)==null||a.call(this,new Xa(_t.InvalidData,"Unexpected payload from event stream"))})}),e.addEventListener("ping",async()=>{var n,r,i,o,s,a,c;(n=this.t)==null||n.debug("Got PING, going to poll LaunchDarkly for feature flag updates");try{let l=await this.Gi.requestPayload();try{if(this.u){hp(this.t);return}let u=JSON.parse(l);try{(r=this.n.get("put"))==null||r.processJson(u)}catch(h){(i=this.t)==null||i.error(`Exception from data handler: ${h}`)}}catch(u){(o=this.t)==null||o.error("Polling after ping received invalid data"),(s=this.t)==null||s.debug(`Invalid JSON follows: ${l}`),(a=this.m)==null||a.call(this,new Fi(_t.InvalidData,"Malformed JSON data in ping polling response"))}}catch(l){if(this.u){hp(this.t);return}let u=l;(c=this.m)==null||c.call(this,new Fi(_t.ErrorResponse,u.message,u.status))}})}stop(){var t;(t=this.Pe)==null||t.close(),this.Pe=void 0,this.u=!0}close(){this.stop()}},sI=class{constructor(t,e,n,r,i,o,s,a,c){this.platform=t,this.flagManager=e,this.credential=n,this.config=r,this.getPollingPaths=i,this.getStreamingPaths=o,this.baseHeaders=s,this.emitter=a,this.diagnosticsManager=c,this.closed=!1,this.logger=r.logger,this.dataSourceStatusManager=new eI(a),this.J=new tI(e,this.dataSourceStatusManager,this.config.logger)}setConnectionParams(t){this.Ji=t}createPollingProcessor(t,e,n,r,i){let o=new nI(n,this.config.pollInterval,async s=>{await this.J.handlePut(e,s),r==null||r()},s=>{this.emitter.emit("error",t,s),this.J.handlePollingError(s),i==null||i(s)},this.logger);this.updateProcessor=this.Oe(o,this.dataSourceStatusManager)}createStreamingProcessor(t,e,n,r,i){var o;let s=new oI(JSON.stringify(t),{credential:this.credential,serviceEndpoints:this.config.serviceEndpoints,paths:this.getStreamingPaths(),baseHeaders:this.baseHeaders,initialRetryDelayMillis:this.config.streamInitialReconnectDelay*1e3,withReasons:this.config.withReasons,useReport:this.config.useReport,queryParameters:(o=this.Ji)==null?void 0:o.queryParameters},this.createStreamListeners(e,r),this.platform.requests,this.platform.encoding,n,this.diagnosticsManager,a=>{this.emitter.emit("error",t,a),this.J.handleStreamingError(a),i==null||i(a)},this.logger);this.updateProcessor=this.Oe(s,this.dataSourceStatusManager)}createStreamListeners(t,e){let n=new Map;return n.set("put",{deserializeData:JSON.parse,processJson:async r=>{await this.J.handlePut(t,r),e==null||e()}}),n.set("patch",{deserializeData:JSON.parse,processJson:async r=>{this.J.handlePatch(t,r)}}),n.set("delete",{deserializeData:JSON.parse,processJson:async r=>{this.J.handleDelete(t,r)}}),n}Oe(t,e){return{start:()=>{e.requestStateUpdate(Kt.Initializing),t.start()},stop:()=>{t.stop(),e.requestStateUpdate(Kt.Closed)},close:()=>{t.close(),e.requestStateUpdate(Kt.Closed)}}}close(){var t;(t=this.updateProcessor)==null||t.close(),this.closed=!0}};function Bp(t,e){let n=Object.keys(e),r="$flagsState",i="$valid",o=e[r];!o&&n.length&&t.warn("LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."),e[i]===!1&&t.warn("LaunchDarkly bootstrap data is not available because the back end could not read the flags.");let s={};return n.forEach(a=>{if(a!==r&&a!==i){let c;o&&o[a]?c=at({value:e[a]},o[a]):c={value:e[a],version:0},s[a]={version:c.version,flag:c}}}),s}function _i(){return typeof document!==void 0}function Ya(){return typeof window!==void 0}function jp(t,e,n){return _i()?(document.addEventListener(t,e,n),()=>{document.removeEventListener(t,e,n)}):()=>{}}function Qp(t,e,n){return _i()?(window.addEventListener(t,e,n),()=>{window.removeEventListener(t,e,n)}):()=>{}}function yr(){return Ya()?window.location.href:""}function aI(){return Ya()?window.location.search:""}function lI(){return Ya()?window.location.hash:""}function cI(){if(typeof crypto!==void 0)return crypto;throw Error("Access to a web crypto API is required")}function uI(){return _i()?document.visibilityState:"visibile"}function hI(t){if(_i())return document.querySelectorAll(t)}var pI="[BrowserDataManager]",dI=class extends sI{constructor(t,e,n,r,i,o,s,a,c,l){super(t,e,n,r,o,s,a,c,l),this.ls=i,this.tt=void 0,this.Kt=!1,this.tt=i.streaming}C(t,...e){this.logger.debug(`${pI} ${t}`,...e)}async identify(t,e,n,r){if(this.closed){this.C("Identify called after data manager was closed.");return}this.context=n;let i=r;i!=null&&i.hash?this.setConnectionParams({queryParameters:[{key:"h",value:i.hash}]}):this.setConnectionParams(),this.Gt=i==null?void 0:i.hash,i!=null&&i.bootstrap?this.qi(n,i.bootstrap,t):(await this.flagManager.loadCached(n)&&this.C("Identify - Flags loaded from cache. Continuing to initialize via a poll."),await this.Yi(n,t,e)),this.Wt()}async Zi(t){let e=JSON.stringify(xn.toLDContext(t)),n=tp(e,this.config.serviceEndpoints,this.getPollingPaths(),this.platform.requests,this.platform.encoding,this.baseHeaders,[],this.config.withReasons,this.config.useReport,this.Gt),r=3,i;for(let o=0;o<=r;o+=1)try{return await n.requestPayload()}catch(s){if(!Vp(s))throw s;i=s,o<r&&(this.C(Gn(s,"initial poll request","will retry")),await xp(1e3))}throw i}async Yi(t,e,n){var r,i;try{this.dataSourceStatusManager.requestStateUpdate(Kt.Initializing);let o=await this.Zi(t);try{let s=this.createStreamListeners(t,e).get("put");s.processJson(s.deserializeData(o))}catch(s){this.dataSourceStatusManager.reportError(_t.InvalidData,(r=s.message)!=null?r:"Could not parse poll response")}}catch(o){this.dataSourceStatusManager.reportError(_t.NetworkError,(i=o.message)!=null?i:"unexpected network error",o.status),n(o)}}qi(t,e,n){this.flagManager.setBootstrap(t,Bp(this.logger,e)),this.C("Identify - Initialization completed from bootstrap"),n()}setForcedStreaming(t){this.tt=t,this.Wt()}setAutomaticStreamingState(t){this.Kt=t,this.Wt()}Wt(){let t=this.tt||this.Kt&&this.tt===void 0;this.C(`Updating streaming state. forced(${this.tt}) automatic(${this.Kt})`),t?this.Xi():this.Qi()}Qi(){var t;this.updateProcessor&&this.C("Stopping update processor."),(t=this.updateProcessor)==null||t.close(),this.updateProcessor=void 0}Xi(){if(this.updateProcessor){this.C("Update processor already active. Not changing state.");return}if(!this.context){this.C("Context not set, not starting update processor.");return}this.C("Starting update processor."),this.ts(this.context)}ts(t,e,n){var r;let i=xn.toLDContext(t);(r=this.updateProcessor)==null||r.close();let o=JSON.stringify(xn.toLDContext(t)),s=tp(o,this.config.serviceEndpoints,this.getPollingPaths(),this.platform.requests,this.platform.encoding,this.baseHeaders,[],this.config.withReasons,this.config.useReport,this.Gt);this.createStreamingProcessor(i,t,s,e,n),this.updateProcessor.start()}};function fI(t){let e=jp("visibilitychange",()=>{uI()==="hidden"&&t()}),n=Qp("pagehide",t);return()=>{e(),n()}}function Na(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function mI(t,e,n,r){let i=((t.kind==="substring"||t.kind==="regex")&&r.includes("/")?e:e.replace(r,"")).replace(n,"");switch(t.kind){case"exact":return new RegExp(`^${Na(t.url)}/?$`).test(e);case"canonical":return new RegExp(`^${Na(t.url)}/?$`).test(i);case"substring":return new RegExp(`.*${Na(t.substring)}.*$`).test(i);case"regex":return new RegExp(t.pattern).test(i);default:return!1}}function yI(t,e){let n=[];return e.forEach(r=>{let i=t.target,{selector:o}=r,s=hI(o);for(;i&&s!=null&&s.length;){for(let a=0;a<s.length;a+=1)if(i===s[a]){n.push(r);break}i=i.parentNode}}),n}var gI=class{constructor(t,e){let n=t.filter(o=>{var s;return(s=o.urls)==null?void 0:s.some(a=>mI(a,yr(),aI(),lI()))}),r=n.filter(o=>o.kind==="pageview"),i=n.filter(o=>o.kind==="click");if(r.forEach(o=>e(o)),i.length){let o=s=>{yI(s,i).forEach(a=>{e(a)})};this.Te=jp("click",o)}}close(){var t;(t=this.Te)==null||t.call(this)}},bI=300,vI=class{constructor(t){this.No=yr();let e=()=>{let r=yr();r!==this.No&&(this.No=r,t())};this.Jt=setInterval(e,bI);let n=Qp("popstate",e);this.$e=()=>{n()}}close(){var t;this.Jt&&clearInterval(this.Jt),(t=this.$e)==null||t.call(this)}},SI=class{constructor(t,e,n,r,i,o=s=>new vI(s)){this.T=e,this.ns=r,this.ss=i,this.yt=[],this.Re=!1,this.vt=`${n}/sdk/goals/${t}`,this.Ne=o(()=>{this.Yt()})}async initialize(){await this.es(),this.Yt()}startTracking(){this.Re=!0,this.Yt()}Yt(){var t;this.Re&&((t=this.qt)==null||t.close(),this.yt&&this.yt.length&&(this.qt=new gI(this.yt,e=>{this.ss(yr(),e)})))}async es(){try{let t=await this.T.fetch(this.vt);this.yt=await t.json()}catch(t){this.ns(new Cp(`Encountered error fetching goals: ${t}`))}}close(){var t,e;(t=this.Ne)==null||t.close(),(e=this.qt)==null||e.close()}};function wI(t){return t.kind==="click"}var II=2,$p={fetchGoals:!0,eventUrlTransformer:t=>t,streaming:void 0,plugins:[]},TI={fetchGoals:G.Boolean,eventUrlTransformer:G.Function,streaming:G.Boolean,plugins:G.createTypeArray("LDPlugin",{})};function EI(t){var e;let n=at({},t);return(e=n.flushInterval)!=null||(n.flushInterval=II),n}function RI(t){let e=EI(t);return Object.keys($p).forEach(n=>{delete e[n]}),e}function CI(t,e){let n=at({},$p);return Object.entries(TI).forEach(r=>{let[i,o]=r,s=t[i];s!==void 0&&(o.is(s)?n[i]=s:e.warn(Ue.wrongOptionType(i,o.getType(),typeof s)))}),n}var ZI=class{constructor(t,e){switch(this.rs=t,this.Me=[],e){case"sha1":this.Zt="SHA-1";break;case"sha256":this.Zt="SHA-256";break;default:throw new Error(`Algorithm is not supported ${e}`)}}async asyncDigest(t){let e=this.Me.join(""),n=new TextEncoder().encode(e),r=await this.rs.subtle.digest(this.Zt,n);switch(t){case"base64":return btoa(String.fromCharCode(...new Uint8Array(r)));case"hex":return[...new Uint8Array(r)].map(i=>i.toString(16).padStart(2,"0")).join("");default:throw new Error(`Encoding is not supported ${t}`)}}update(t){return this.Me.push(t),this}},kI={start:0,end:3},VI={start:4,end:5},Oa={start:6,end:7},Ga={start:8,end:8},xI={start:9,end:9},NI={start:10,end:15};function OI(){if(crypto&&crypto.getRandomValues){let e=new Uint8Array(16);return crypto.getRandomValues(e),[...e.values()]}let t=[];for(let e=0;e<16;e+=1)t.push(Math.floor(Math.random()*256));return t}function kn(t,e){let n="";for(let r=e.start;r<=e.end;r+=1)n+=t[r].toString(16).padStart(2,"0");return n}function GI(t){return t[Ga.start]=(t[Ga.start]|128)&191,t[Oa.start]=t[Oa.start]&15|64,`${kn(t,kI)}-${kn(t,VI)}-${kn(t,Oa)}-${kn(t,Ga)}${kn(t,xI)}-${kn(t,NI)}`}function LI(){let t=OI();return GI(t)}function XI(){return typeof crypto!==void 0&&typeof crypto.randomUUID=="function"?crypto.randomUUID():LI()}var WI=class{createHash(t){return new ZI(cI(),t)}randomUUID(){return XI()}};function UI(t){let e=Array.from(t,n=>String.fromCodePoint(n)).join("");return btoa(e)}var MI=class{btoa(t){return UI(new TextEncoder().encode(t))}},PI=class{constructor(t){this.e=t}platformData(){return{name:"JS"}}sdkData(){let t={name:"@launchdarkly/js-client-sdk",version:"0.12.1",userAgentBase:"JSClient"};return this.e.wrapperName&&(t.wrapperName=this.e.wrapperName),this.e.wrapperVersion&&(t.wrapperVersion=this.e.wrapperVersion),t}},FI=class{constructor(t,e){this.vt=t,this.n={},this.A=new SS(e.initialRetryDelayMillis,e.retryResetIntervalMillis),this.Fe=e.errorFilter,this.Ue()}Ue(){this.q=new EventSource(this.vt),this.q.onopen=()=>{var t;this.A.success(),(t=this.onopen)==null||t.call(this)},this.q.onerror=t=>{var e;this.as(t),(e=this.onerror)==null||e.call(this,t)},Object.entries(this.n).forEach(([t,e])=>{e.forEach(n=>{var r;(r=this.q)==null||r.addEventListener(t,n)})})}addEventListener(t,e){var n,r,i;(r=(n=this.n)[t])!=null||(n[t]=[]),this.n[t].push(e),(i=this.q)==null||i.addEventListener(t,e)}close(){var t,e;clearTimeout(this.Xt),this.Xt=void 0,(t=this.q)==null||t.close(),(e=this.onclose)==null||e.call(this)}cs(t){var e;(e=this.onretrying)==null||e.call(this,{delayMillis:t}),this.Xt=setTimeout(()=>{this.Ue()},t)}as(t){this.close(),!(t.status&&typeof t.status=="number"&&!this.Fe(t))&&this.cs(this.A.fail())}},AI=class{fetch(t,e){return fetch(t,e)}createEventSource(t,e){return new FI(t,e)}getEventSourceCapabilities(){return{customMethod:!1,readTimeout:!1,headers:!1}}};function qp(){return typeof localStorage!="undefined"}function JI(){if(!qp())return[];let t=[];for(let e=0;e<localStorage.length;e+=1){let n=localStorage.key(e);n&&t.push(n)}return t}var DI=class{constructor(t){this.t=t}async clear(t){var e;try{localStorage.removeItem(t)}catch(n){(e=this.t)==null||e.error(`Error clearing key from localStorage: ${t}, reason: ${n}`)}}async get(t){var e;try{let n=localStorage.getItem(t);return n!=null?n:null}catch(n){return(e=this.t)==null||e.error(`Error getting key from localStorage: ${t}, reason: ${n}`),null}}async set(t,e){var n;try{localStorage.setItem(t,e)}catch(r){(n=this.t)==null||n.error(`Error setting key in localStorage: ${t}, reason: ${r}`)}}},YI=class{constructor(t,e){this.encoding=new MI,this.crypto=new WI,this.requests=new AI,qp()&&(this.storage=new DI(t)),this.info=new PI(e)}},KI=class extends $w{constructor(t,e,n={},r){var i;let{logger:o,debug:s}=n,a=o!=null?o:new Pa({destination:{debug:console.debug,info:console.info,warn:console.warn,error:console.error},level:s?"debug":"info"}),c=(i=n.baseUri)!=null?i:"https://clientsdk.launchdarkly.com",l=r!=null?r:new YI(a,n),u=CI(n,a),h=RI(me(at({},n),{logger:a})),{eventUrlTransformer:p}=u;super(t,e,l,h,(f,m,d,b,v)=>new dI(l,f,t,m,u,()=>({pathGet(I,R){return`/sdk/evalx/${t}/contexts/${jh(R,I)}`},pathReport(I,R){return`/sdk/evalx/${t}/context`},pathPing(I,R){throw new Error("Ping for polling unsupported.")}}),()=>({pathGet(I,R){return`/eval/${t}/${jh(R,I)}`},pathReport(I,R){return`/eval/${t}`},pathPing(I,R){return`/ping/${t}`}}),d,b,v),{getLegacyStorageKeys:()=>JI().filter(f=>f.startsWith(`ld:${t}:`)),analyticsEventPath:`/events/bulk/${t}`,diagnosticEventPath:`/events/diagnostic/${t}`,includeAuthorizationHeader:!1,highTimeoutThreshold:5,userAgentHeaderName:"x-launchdarkly-user-agent",trackEventModifier:f=>new de.InputCustomEvent(f.context,f.key,f.data,f.metricValue,f.samplingRatio,p(yr())),getImplementationHooks:f=>de.safeGetHooks(a,f,u.plugins),credentialType:"clientSideId"}),this.setEventSendingEnabled(!0,!1),this.te=u.plugins,u.fetchGoals&&(this.Qt=new SI(t,l.requests,c,f=>{a.error(f.message)},(f,m)=>{let d=this.getInternalContext();if(!d)return;let b=p(f);wI(m)?this.sendEvent({kind:"click",url:b,samplingRatio:1,key:m.key,creationDate:Date.now(),context:d,selector:m.selector}):this.sendEvent({kind:"pageview",url:b,samplingRatio:1,key:m.key,creationDate:Date.now(),context:d})}),this.Qt.initialize(),u.automaticBackgroundHandling&&fI(()=>this.flush()))}registerPlugins(t){de.safeRegisterPlugins(this.logger,this.environmentMetadata,t,this.te||[]);let e=this.getDebugOverrides();e&&qw(this.logger,e,this.te||[])}setInitialContext(t){this.ee=t}async identify(t,e){return super.identify(t,e)}async identifyResult(t,e){var n;if(!this.et)return this.logger.error("Client must be started before it can identify a context, did you forget to call start()?"),{status:"error",error:new Error("Identify called before start")};let r=at({},e);(e==null?void 0:e.sheddable)===void 0&&(r.sheddable=!0);let i=await super.identifyResult(t,r);return(n=this.Qt)==null||n.startTracking(),i}start(t){var e,n;if(this.initializeResult)return Promise.resolve(this.initializeResult);if(this.et)return this.et;if(!this.ee)return this.logger.error("Initial context not set"),Promise.resolve({status:"failed",error:new Error("Initial context not set")});let r=me(at({},(e=t==null?void 0:t.identifyOptions)!=null?e:{}),{sheddable:!1});if(t!=null&&t.bootstrap&&!r.bootstrap&&(r.bootstrap=t.bootstrap),r!=null&&r.bootstrap)try{let i=Bp(this.logger,r.bootstrap);this.presetFlags(i)}catch(i){this.logger.error("Failed to bootstrap data",i)}return this.initializedPromise||(this.initializedPromise=new Promise(i=>{this.initResolve=i})),this.et=this.promiseWithTimeout(this.initializedPromise,(n=t==null?void 0:t.timeout)!=null?n:5),this.identifyResult(this.ee,r),this.et}setStreaming(t){this.dataManager.setForcedStreaming(t)}Ve(){this.dataManager.setAutomaticStreamingState(!!this.emitter.listenerCount("change"))}on(t,e){super.on(t,e),this.Ve()}off(t,e){super.off(t,e),this.Ve()}};function _I(t,e,n,r={},i){let o=new KI(t,n,r,i);o.setInitialContext(e);let s={variation:(a,c)=>o.variation(a,c),variationDetail:(a,c)=>o.variationDetail(a,c),boolVariation:(a,c)=>o.boolVariation(a,c),boolVariationDetail:(a,c)=>o.boolVariationDetail(a,c),numberVariation:(a,c)=>o.numberVariation(a,c),numberVariationDetail:(a,c)=>o.numberVariationDetail(a,c),stringVariation:(a,c)=>o.stringVariation(a,c),stringVariationDetail:(a,c)=>o.stringVariationDetail(a,c),jsonVariation:(a,c)=>o.jsonVariation(a,c),jsonVariationDetail:(a,c)=>o.jsonVariationDetail(a,c),track:(a,c,l)=>o.track(a,c,l),on:(a,c)=>o.on(a,c),off:(a,c)=>o.off(a,c),flush:()=>o.flush(),setStreaming:a=>o.setStreaming(a),identify:(a,c)=>o.identifyResult(a,c),getContext:()=>o.getContext(),close:()=>o.close(),allFlags:()=>o.allFlags(),addHook:a=>o.addHook(a),waitForInitialization:a=>o.waitForInitialization(a),logger:o.logger,start:a=>o.start(a)};return o.registerPlugins(s),s}function YF(t){return new Pa(t)}function td(t,e,n){return _I(t,e,Ai.Disabled,n)}var HI=Object.defineProperty,zI=(t,e,n)=>e in t?HI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Te=(t,e,n)=>zI(t,typeof e!="symbol"?e+"":e,n),BI=(t,e,n)=>new Promise((r,i)=>{var o=c=>{try{a(n.next(c))}catch(l){i(l)}},s=c=>{try{a(n.throw(c))}catch(l){i(l)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(o,s);a((n=n.apply(t,e)).next())}),ke=(t,e,...n)=>{let r=`[@launchdarkly plugins]: (${t}): `;console[e].apply(console,[r,...n]),jI(r,...n)},jI=(t,...e)=>BI(void 0,null,function*(){try{let{LDObserve:n}=yield Promise.resolve().then(()=>eR);n.recordLog(`${t}${e}`,"warn")}catch(n){}}),QI=class{constructor(t,e){Te(this,"debug"),Te(this,"name"),this.debug=t,this.name=e}log(...t){if(this.debug){let e=`[${Date.now()}]`;this.name&&(e+=` - ${this.name}`),console.log.apply(console,[e,...t])}}warn(...t){let e=`[${Date.now()}]`;this.name&&(e+=` - ${this.name}`),console.warn.apply(console,[e,...t])}},vo=class{constructor(){Te(this,"_sdk"),Te(this,"_isLoaded",!1),Te(this,"_callBuffer",[]),Te(this,"_capacity",1e5),Te(this,"_droppedEvents",0),Te(this,"_exceededCapacity",!1),Te(this,"_logger",new QI)}h(e,n){if(this.Ln)try{return this.qn[e](...n)}catch(r){ke(`Error executing buffered call to ${e}:`,"error",r)}else{this.Jr({method:e,args:n});return}}Jr(e){this.En.length<this.Ys?(this.En.push(e),this.tr=!1):(this.tr||(this.tr=!0,ke("Exceeded event queue capacity. Increase capacity to avoid dropping events.","warn")),this.Ks+=1)}load(e){this.qn=e,this.Ln=!0;for(let{method:n,args:r}of this.En)try{this.qn[n](...r)}catch(i){ke(`Error executing buffered call to ${n}:`,"error",i)}this.En=[]}},$I=Object.defineProperty,qI=Object.defineProperties,tT=Object.getOwnPropertyDescriptors,So=Object.getOwnPropertySymbols,Mf=Object.prototype.hasOwnProperty,Pf=Object.prototype.propertyIsEnumerable,Zl=(t,e,n)=>e in t?$I(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,j=(t,e)=>{for(var n in e||(e={}))Mf.call(e,n)&&Zl(t,n,e[n]);if(So)for(var n of So(e))Pf.call(e,n)&&Zl(t,n,e[n]);return t},An=(t,e)=>qI(t,tT(e)),xr=(t,e)=>{var n={};for(var r in t)Mf.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&So)for(var r of So(t))e.indexOf(r)<0&&Pf.call(t,r)&&(n[r]=t[r]);return n},Wr=(t,e,n)=>Zl(t,typeof e!="symbol"?e+"":e,n),Dn=(t,e,n)=>new Promise((r,i)=>{var o=c=>{try{a(n.next(c))}catch(l){i(l)}},s=c=>{try{a(n.throw(c))}catch(l){i(l)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(o,s);a((n=n.apply(t,e)).next())});function eT(t,e){for(var n=0;n<e.length;n++){let r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(let i in r)if(i!=="default"&&!(i in t)){let o=Object.getOwnPropertyDescriptor(r,i);o&&Object.defineProperty(t,i,o.get?o:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function lo(t,e){throw new Error(e)}function nT(t){return typeof t=="object"&&t!==null}function rT(t,e){throw new Error("Unexpected invariant triggered.")}var iT=/\r\n|[\n\r]/g;function kl(t,e){let n=0,r=1;for(let i of t.body.matchAll(iT)){if(typeof i.index=="number"||rT(),i.index>=e)break;n=i.index+i[0].length,r+=1}return{line:r,column:e+1-n}}function oT(t){return Ff(t.source,kl(t.source,t.start))}function Ff(t,e){let n=t.locationOffset.column-1,r="".padStart(n)+t.body,i=e.line-1,o=t.locationOffset.line-1,s=e.line+o,a=e.line===1?n:0,c=e.column+a,l=`${t.name}:${s}:${c}
348
+ SessionSecureID: ${this.sessionData.sessionSecureID}`);let s=GF();n?yield n({session_secure_id:this.sessionData.sessionSecureID,payload_id:(this.sessionData.payloadID++).toString(),events:{events:r},messages:YL({messages:[]}),resources:JSON.stringify({resources:[]}),web_socket_events:JSON.stringify({webSocketEvents:[]}),errors:[],is_beacon:!1,has_session_unloaded:this.hasSessionUnloaded,highlight_logs:s||void 0}):this.Qn.postMessage({message:{type:Ne.AsyncEvents,id:this.sessionData.payloadID++,events:r,messages:[],errors:[],resourcesString:JSON.stringify({resources:[]}),webSocketEventsString:JSON.stringify({webSocketEvents:[]}),hasSessionUnloaded:this.hasSessionUnloaded,highlightLogs:s}}),wn(this.sessionData),this.events=this.events.slice(r.length),LF(s)})}takeFullSnapshot(){if(!this.Tn){this.logger.log("skipping full snapshot as rrweb is not running");return}this.logger.log("taking full snapshot",{bytesSinceSnapshot:this.wr,lastSnapshotTime:this.xo}),Ge.takeFullSnapshot(),this.wr=0,this.xo=new Date().getTime()}register(e,n){this.Gn.push(new hu(e,n))}getHooks(e){return this.Gn.flatMap(n=>{var r,i;return(i=(r=n.getHooks)==null?void 0:r.call(n,e))!=null?i:[]})}getRecordingState(){var e;return(e=this==null?void 0:this.state)!=null?e:"NotRecording"}getSession(){let e=this.sessionData.sessionSecureID,n=Zs(e);if(!n)return null;let r=`${this.getFrontendUrl()}/sessions/${e}`;if(!r||!(n!=null&&n.sessionStartTime))return null;let i=new Date().getTime(),o=new URL(r),s=new URL(r),a=(i-this.$n)/1e3;return s.searchParams.set("ts",a.toString()),{url:o.toString(),urlWithTimestamp:s.toString(),sessionSecureID:e}}getFrontendUrl(){var e,n;let r=this.mn.match(gX);if(r&&(e=r==null?void 0:r.groups)!=null&&e.domain){let i=(n=r.groups.domain)!=null?n:"";return`https://${mX[i]}${yX}`}return fX}},Ci=class extends JX{constructor(e,n){var r=(...f)=>(super(...f),Y(this,"record"),this),i,o,s,a,c,l,u,h,p;try{if(r(n),typeof window>"u"||typeof document>"u"){console.warn("@launchdarkly/session-replay is not initializing because it is not supported in this environment.");return}if(typeof Worker>"u"){console.warn("@launchdarkly/session-replay is not initializing because Worker is not supported.");return}if(!e){console.warn("@launchdarkly/session-replay is not initializing because projectID was passed undefined.");return}let f=Yt(z({},n),{organizationID:e,firstloadVersion:FF,environment:(n==null?void 0:n.environment)||"production",appVersion:n==null?void 0:n.version,sessionSecureID:this.sessionSecureID,privacySetting:(i=n==null?void 0:n.privacySetting)!=null?i:"strict"});this.record=new ih(f),n!=null&&n.manualStart||this.record.start(),In.load(this.record),!((s=(o=n==null?void 0:n.integrations)==null?void 0:o.mixpanel)!=null&&s.disabled)&&(c=(a=n==null?void 0:n.integrations)==null?void 0:a.mixpanel)!=null&&c.projectToken&&MF(n.integrations.mixpanel),!((u=(l=n==null?void 0:n.integrations)==null?void 0:l.amplitude)!=null&&u.disabled)&&(p=(h=n==null?void 0:n.integrations)==null?void 0:h.amplitude)!=null&&p.apiKey&&UF(n.integrations.amplitude)}catch(f){zt("Error initializing @launchdarkly/session-replay SDK","error",f)}}getMetadata(){return{name:"@launchdarkly/session-replay"}}register(e,n){var r;(r=this.record)==null||r.register(e,n)}getHooks(e){return[{getMetadata:()=>({name:"@launchdarkly/session-replay/hooks"}),afterIdentify:(n,r,i)=>{var o,s,a,c,l,u,h;for(let p of(a=(s=(o=this.record)==null?void 0:o.getHooks)==null?void 0:s.call(o,e))!=null?a:[])(c=p.afterIdentify)==null||c.call(p,n,r,i);if(i.status==="completed"){let p=WX(n.context),f=UX(n.context);(h=this.record)==null||h.identify(typeof f=="string"?f:(u=(l=f.user)==null?void 0:l.toString())!=null?u:p,Yt(z({key:p},typeof f=="object"?f:{}),{timeout:n.timeout}),"LaunchDarkly")}return r},afterEvaluation:(n,r,i)=>{var o,s,a,c;for(let l of(a=(s=(o=this.record)==null?void 0:o.getHooks)==null?void 0:s.call(o,e))!=null?a:[])(c=l.afterEvaluation)==null||c.call(l,n,r,i);return r},afterTrack:n=>{var r,i,o,s,a;for(let c of(o=(i=(r=this.record)==null?void 0:r.getHooks)==null?void 0:i.call(r,e))!=null?o:[])(s=c.afterTrack)==null||s.call(c,n);(a=this.record)==null||a.track(n.key,{data:n.data,value:n.metricValue})}}]}}});var $0=Object.defineProperty,q0=Object.defineProperties,tS=Object.getOwnPropertyDescriptors,Mi=Object.getOwnPropertySymbols,pp=Object.prototype.hasOwnProperty,dp=Object.prototype.propertyIsEnumerable,Dh=(t,e,n)=>e in t?$0(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,st=(t,e)=>{for(var n in e||(e={}))pp.call(e,n)&&Dh(t,n,e[n]);if(Mi)for(var n of Mi(e))dp.call(e,n)&&Dh(t,n,e[n]);return t},me=(t,e)=>q0(t,tS(e)),fp=(t,e)=>{var n={};for(var r in t)pp.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Mi)for(var r of Mi(t))e.indexOf(r)<0&&dp.call(t,r)&&(n[r]=t[r]);return n};function eS(t){return`/${t.replace(/~/g,"~0").replace(/\//g,"~1")}`}function mp(t){return t.indexOf("~")?t.replace(/~1/g,"/").replace(/~0/g,"~"):t}function nS(t){return(t.startsWith("/")?t.substring(1):t).split("/").map(e=>mp(e))}function rS(t){return!t.startsWith("/")}function iS(t){return!t.match(/\/\/|(^\/.*~[^0|^1])|~$/)}var Nn=class{constructor(t,e=!1){if(e){let n=t;this.g=[n],this.isValid=n!=="",this.redactionName=n.startsWith("/")?eS(n):n}else{if(this.redactionName=t,t===""||t==="/"||!iS(t)){this.isValid=!1,this.g=[];return}rS(t)?this.g=[t]:t.indexOf("/",1)<0?this.g=[mp(t.slice(1))]:this.g=nS(t),this.g[0]==="_meta"?this.isValid=!1:this.isValid=!0}}get(t){let{g:e,isValid:n}=this;if(!n)return;let r=t;for(let i=0;i<e.length;i+=1){let o=e[i];if(r!=null&&Object.prototype.hasOwnProperty.call(r,o)&&typeof r=="object"&&!Array.isArray(r))r=r[o];else return}return r}getComponent(t){return this.g[t]}get depth(){return this.g.length}get isKind(){return this.g.length===1&&this.g[0]==="kind"}compare(t){return this.depth===t.depth&&this.g.every((e,n)=>e===t.getComponent(n))}get components(){return[...this.g]}};Nn.InvalidReference=new Nn("");var oS=class{is(t){if(Array.isArray(t))return!1;let e=typeof t;return e==="function"||e==="object"}getType(){return"factory method or object"}},Ln=class{constructor(t,e){this.wt=t,this.typeOf=typeof e}is(t){return Array.isArray(t)?!1:typeof t===this.typeOf}getType(){return this.wt}},yp=class{constructor(t,e){this.wt=t,this.typeOf=typeof e}is(t){return Array.isArray(t)?t.length>0?t.every(e=>typeof e===this.typeOf):!0:!1}getType(){return this.wt}},gp=class extends Ln{constructor(t){super(`number with minimum value of ${t}`,0),this.min=t}is(t){return typeof t===this.typeOf&&t>=this.min}},bp=class extends Ln{constructor(t){super(`string matching ${t}`,""),this.expression=t}is(t){return typeof t=="string"&&!!t.match(this.expression)}},sS=class{is(t){return typeof t=="function"}getType(){return"function"}},aS=class{is(t){return typeof t=="boolean"||typeof t=="undefined"||t===null}getType(){return"boolean | undefined | null"}},lS=/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d\d*)?(Z|[-+]\d\d(:\d\d)?)/,cS=class{is(t){return typeof t=="number"||typeof t=="string"&&lS.test(t)}getType(){return"date"}},uS=class extends bp{constructor(){super(/^(\w|\.|-)+$/)}is(t){return super.is(t)&&t!=="kind"}},G=class{static createTypeArray(t,e){return new yp(t,e)}static numberWithMin(t){return new gp(t)}static stringMatchingRegex(t){return new bp(t)}};G.String=new Ln("string","");G.Number=new Ln("number",0);G.ObjectOrFactory=new oS;G.Object=new Ln("object",{});G.StringArray=new yp("string[]","");G.Boolean=new Ln("boolean",!0);G.Function=new sS;G.Date=new cS;G.Kind=new uS;G.NullableBoolean=new aS;function vp(t){return"kind"in t?G.String.is(t.kind)&&t.kind!=="multi":!1}function Sp(t){return"kind"in t?G.String.is(t.kind)&&t.kind==="multi":!1}function wp(t){return!("kind"in t)||t.kind===null||t.kind===void 0}function Pi(t,e=[]){if(t===null||typeof t!="object")return JSON.stringify(t);if(e.includes(t))throw new Error("Cycle detected");return Array.isArray(t)?`[${t.map(n=>Pi(n,[...e,t])).map(n=>n===void 0?"null":n).join(",")}]`:`{${Object.keys(t).sort().map(n=>{let r=Pi(t[n],[...e,t]);if(r!==void 0)return`${JSON.stringify(n)}:${r}`}).filter(n=>n!==void 0).join(",")}}`}var La="user";function Yh(t){return t.includes("%")||t.includes(":")?t.replace(/%/g,"%25").replace(/:/g,"%3A"):t}function hS(t){return t&&G.Object.is(t)}function Kh(t){return G.Kind.is(t)}function _h(t){return G.String.is(t)&&t!==""}function Ra(t,e=!1){return t?t.map(n=>new Nn(n,e)):[]}function pS(t){return t!=null}function dS(t){let e=me(st({},t.custom||[]),{kind:"user",key:String(t.key)});if(pS(t.anonymous)){let n=!!t.anonymous;delete e.anonymous,e.anonymous=n}return t.name!==null&&t.name!==void 0&&(e.name=t.name),t.ip!==null&&t.ip!==void 0&&(e.ip=t.ip),t.firstName!==null&&t.firstName!==void 0&&(e.firstName=t.firstName),t.lastName!==null&&t.lastName!==void 0&&(e.lastName=t.lastName),t.email!==null&&t.email!==void 0&&(e.email=t.email),t.avatar!==null&&t.avatar!==void 0&&(e.avatar=t.avatar),t.country!==null&&t.country!==void 0&&(e.country=t.country),t.privateAttributeNames!==null&&t.privateAttributeNames!==void 0&&(e._meta={privateAttributes:t.privateAttributeNames}),e}var xn=class wt{constructor(e,n,r){this.I=!1,this.it=!1,this.ie=!1,this.R={},this.kind=n,this.valid=e,this.message=r}static k(e,n){return new wt(!1,e,n)}static je(e,n){if(!(!n||!e.isValid))return e.depth===1&&e.getComponent(0)==="anonymous"?!!(n!=null&&n.anonymous):e.get(n)}se(e){if(this.I)return this.R[e];if(this.kind===e)return this.y}static He(e){let n=Object.keys(e).filter(c=>c!=="kind"),r=n.every(Kh);if(!n.length)return wt.k("multi","A multi-kind context must contain at least one kind");if(!r)return wt.k("multi","Context contains invalid kinds");let i={},o=!0,s=n.reduce((c,l)=>{var u;let h=e[l];return hS(h)?(c[l]=h,i[l]=Ra((u=h._meta)==null?void 0:u.privateAttributes)):o=!1,c},{});if(!o)return wt.k("multi","Context contained contexts that were not objects");if(!Object.values(s).every(c=>_h(c.key)))return wt.k("multi","Context contained invalid keys");if(n.length===1){let c=n[0],l=new wt(!0,c);return l.y=me(st({},s[c]),{kind:c}),l.st=i,l.it=c==="user",l}let a=new wt(!0,e.kind);return a.R=s,a.st=i,a.I=!0,a}static ze(e){var n;let{key:r,kind:i}=e,o=Kh(i),s=_h(r);if(!o)return wt.k(i!=null?i:"unknown","The kind was not valid for the context");if(!s)return wt.k(i,"The key for the context was not valid");let a=Ra((n=e._meta)==null?void 0:n.privateAttributes),c=new wt(!0,i);return c.it=i==="user",c.y=e,c.st={[i]:a},c}static Be(e){if(!(e.key!==void 0&&e.key!==null))return wt.k("user","The key for the context was not valid");let n=new wt(!0,"user");return n.it=!0,n.ie=!0,n.y=dS(e),n.st={user:Ra(e.privateAttributeNames,!0)},n}static fromLDContext(e){return e?vp(e)?wt.ze(e):Sp(e)?wt.He(e):wp(e)?wt.Be(e):wt.k("unknown","Context was not of a valid kind"):wt.k("unknown","No context specified. Returning default value")}static toLDContext(e){if(!e.valid)return;let n=e.getContexts();if(!e.I)return n[0][1];let r={kind:"multi"};return n.forEach(i=>{let o=i[0],s=i[1];r[o]=s}),r}valueForKind(e,n=La){return e.isKind?this.kinds:wt.je(e,this.se(n))}key(e=La){var n;return(n=this.se(e))==null?void 0:n.key}get isMultiKind(){return this.I}get canonicalKey(){return this.it?this.y.key:this.I?Object.keys(this.R).sort().map(e=>`${e}:${Yh(this.R[e].key)}`).join(":"):`${this.kind}:${Yh(this.y.key)}`}get kinds(){return this.I?Object.keys(this.R):[this.kind]}get kindsAndKeys(){return this.I?Object.entries(this.R).reduce((e,[n,r])=>(e[n]=r.key,e),{}):{[this.kind]:this.y.key}}privateAttributes(e){var n;return((n=this.st)==null?void 0:n[e])||[]}getContexts(){return this.I?Object.entries(this.R):[[this.kind,this.y]]}get legacy(){return this.ie}canonicalUnfilteredJson(){if(this.valid){if(this.Et)return this.Et;try{this.Et=Pi(wt.toLDContext(this))}catch(e){}return this.Et}}};xn.UserKind=La;var fS=["key","kind","_meta","anonymous"].map(t=>new Nn(t,!0)),mS=["name","ip","firstName","lastName","email","avatar","country"];function yS(t,e){return t.depth===e.length&&e.every((n,r)=>n===t.getComponent(r))}function gS(t,e){let n=[],r={},i=[];for(n.push(...Object.keys(t).map(o=>({key:o,ptr:[o],source:t,parent:r,visited:[t]})));n.length;){let o=n.pop(),s=e.find(a=>yS(a,o.ptr));if(s)i.push(s.redactionName);else{let a=o.source[o.key];a===null?o.parent[o.key]=a:Array.isArray(a)?o.parent[o.key]=[...a]:typeof a=="object"?o.visited.includes(a)||(o.parent[o.key]={},n.push(...Object.keys(a).map(c=>({key:c,ptr:[...o.ptr,c],source:a,parent:o.parent[o.key],visited:[...o.visited,a]})))):o.parent[o.key]=a}}return{cloned:r,excluded:i.sort()}}var bS=class{constructor(t,e){this.Ke=t,this.Ge=e}filter(t,e=!1){let n=t.getContexts();if(n.length===1)return this.ne(t,n[0][1],n[0][0],e);let r={kind:"multi"};return n.forEach(([i,o])=>{r[i]=this.ne(t,o,i,e)}),r}We(t,e,n,r){return(r?Object.keys(e).map(i=>new Nn(i,!0)):[...this.Ge,...t.privateAttributes(n)]).filter(i=>!fS.some(o=>o.compare(i)))}ne(t,e,n,r){let i=this.Ke||r&&e.anonymous===!0,{cloned:o,excluded:s}=gS(e,this.We(t,e,n,i));return t.legacy&&mS.forEach(a=>{a in o&&(o[a]=String(o[a]))}),s.length&&(o._meta||(o._meta={}),o._meta.redactedAttributes=s),o._meta&&(delete o._meta.privateAttributes,Object.keys(o._meta).length===0&&delete o._meta),o}},Hh=30*1e3,vS=.5,SS=class{constructor(t,e,n=Math.random){this.Ds=e,this.Je=n,this.Dt=0,this.re=Math.max(1,t),this.qe=Math.ceil(Math.log2(Hh/this.re))}A(){let t=Math.min(this.Dt,this.qe),e=this.re*2**t;return Math.min(e,Hh)}Ye(t){return t-Math.trunc(this.Je()*vS*t)}success(t=Date.now()){this.bt=t}fail(t=Date.now()){this.bt!==void 0&&t-this.bt>this.Ds&&(this.Dt=0),this.bt=void 0;let e=this.Ye(this.A());return this.Dt+=1,e}},zh;(function(t){t[t.Valid=0]="Valid",t[t.Initializing=1]="Initializing",t[t.Interrupted=2]="Interrupted",t[t.Closed=3]="Closed"})(zh||(zh={}));var Fi=class extends Error{constructor(t,e,n,r=!0){super(e),this.kind=t,this.status=n,this.name="LaunchDarklyPollingError",this.recoverable=r}},Xa=class extends Error{constructor(t,e,n,r=!0){super(e),this.kind=t,this.code=n,this.name="LaunchDarklyStreamingError",this.recoverable=r}},JF=120*1e3,DF=300*1e3,_t;(function(t){t.Unknown="UNKNOWN",t.NetworkError="NETWORK_ERROR",t.ErrorResponse="ERROR_RESPONSE",t.InvalidData="INVALID_DATA"})(_t||(_t={}));var Ai;(function(t){t[t.Disabled=0]="Disabled",t[t.Enabled=1]="Enabled"})(Ai||(Ai={}));var On;(function(t){t[t.AnalyticsEvents=0]="AnalyticsEvents",t[t.DiagnosticEvent=1]="DiagnosticEvent"})(On||(On={}));var qe;(function(t){t[t.Succeeded=0]="Succeeded",t[t.Failed=1]="Failed",t[t.FailedAndMustShutDown=2]="FailedAndMustShutDown"})(qe||(qe={}));function Vn(t){if(typeof t=="string")return t;if(t===void 0)return"undefined";if(t===null)return"null";if(Object.prototype.hasOwnProperty.call(t,"toString"))try{return t.toString()}catch(e){}if(typeof t=="bigint")return`${t}n`;try{return JSON.stringify(t)}catch(e){return e instanceof TypeError&&e.message.indexOf("circular")>=0?"[Circular]":"[Not Stringifiable]"}}function wS(t){return typeof t=="symbol"?"NaN":typeof t=="bigint"?`${t}n`:String(Number(t))}function IS(t){return typeof t=="symbol"?"NaN":typeof t=="bigint"?`${t}n`:String(parseInt(t,10))}function TS(t){return typeof t=="symbol"?"NaN":String(parseFloat(t))}var Ca={s:t=>Vn(t),d:t=>wS(t),i:t=>IS(t),f:t=>TS(t),j:t=>Vn(t),o:t=>Vn(t),O:t=>Vn(t),c:()=>""};function Wa(...t){var e;let n=t.shift();if(G.String.is(n)){let r="",i=0;for(;i<n.length;){let o=n.charAt(i);if(o==="%"){if(i+1<n.length){let s=n.charAt(i+1);if(s in Ca&&t.length){let a=t.shift();r+=(e=Ca[s])==null?void 0:e.call(Ca,a)}else s==="%"?r+="%":r+=`%${s}`;i+=2}}else r+=o,i+=1}return t.length&&(r.length&&(r+=" "),r+=t.map(Vn).join(" ")),r}return t.map(Vn).join(" ")}var Vt;(function(t){t[t.debug=0]="debug",t[t.info=1]="info",t[t.warn=2]="warn",t[t.error=3]="error",t[t.none=4]="none"})(Vt||(Vt={}));var ES=["debug","info","warn","error","none"],Pa=class Ip{static get(){return new Ip({})}constructor(e){var n,r,i;if(this.ni=(r=Vt[(n=e.level)!=null?n:"info"])!=null?r:Vt.info,this.ri=(i=e.name)!=null?i:"LaunchDarkly",this.ue=e.formatter,typeof e.destination=="object")this.he={[Vt.debug]:e.destination.debug,[Vt.info]:e.destination.info,[Vt.warn]:e.destination.warn,[Vt.error]:e.destination.error};else if(typeof e.destination=="function"){let{destination:o}=e;this.he={[Vt.debug]:o,[Vt.info]:o,[Vt.warn]:o,[Vt.error]:o}}}ai(...e){var n;try{return this.ue?(n=this.ue)==null?void 0:n.call(this,...e):Wa(...e)}catch(r){return Wa(...e)}}oi(e,n){try{e(n)}catch(r){console.error(n)}}x(e,n){var r;if(e>=this.ni){let i=`${ES[e]}: [${this.ri}]`;try{let o=(r=this.he)==null?void 0:r[e];o?this.oi(o,`${i} ${this.ai(...n)}`):console.error(...n)}catch(o){console.error(...n)}}}error(...e){this.x(Vt.error,e)}warn(...e){this.x(Vt.warn,e)}info(...e){this.x(Vt.info,e)}debug(...e){this.x(Vt.debug,e)}},RS={error:G.Function,warn:G.Function,info:G.Function,debug:G.Function},Tp=class{constructor(t,e){Object.entries(RS).forEach(([n,r])=>{if(!r.is(t[n]))throw new Error(`Provided logger instance must support logger.${n}(...) method`)}),this.t=t,this.ci=e}x(t,e){try{this.t[t](...e)}catch(n){this.ci[t](...e)}}error(...t){this.x("error",t)}warn(...t){this.x("warn",t)}info(...t){this.x("info",t)}debug(...t){this.x("debug",t)}},Ep=t=>{let e=new Pa({level:"info",destination:console.error,formatter:Wa});return t?new Tp(t,e):e},Ue=class{static deprecated(t,e){return`"${t}" is deprecated, please use "${e}"`}static optionBelowMinimum(t,e,n){return`Config option "${t}" had invalid value of ${e}, using minimum of ${n} instead`}static unknownOption(t){return`Ignoring unknown config option "${t}"`}static wrongOptionType(t,e,n){return`Config option "${t}" should be of type ${e}, got ${n}, using default value`}static wrongOptionTypeBoolean(t,e){return`Config option "${t}" should be a boolean, got ${e}, converting to boolean`}static invalidTagValue(t){return`Config option "${t}" must only contain letters, numbers, ., _ or -.`}static tagValueTooLong(t){return`Value of "${t}" was longer than 64 characters and was discarded.`}static partialEndpoint(t){return`You have set custom uris without specifying the ${t} URI; connections may not work properly`}},CS=/^(\w|\.|-)+$/,ZS=G.stringMatchingRegex(CS),kS={is:(t,e)=>ZS.is(t)?t.length>64?{valid:!1,message:Ue.tagValueTooLong(e)}:{valid:!0}:{valid:!1,message:Ue.invalidTagValue(e)}},VS=class{constructor(t){let e={},n=t==null?void 0:t.application,r=t==null?void 0:t.logger;n&&Object.entries(n).forEach(([o,s])=>{if(s!=null){let{valid:a,message:c}=kS.is(s,`application.${o}`);a?o==="versionName"?e["application-version-name"]=[s]:e[`application-${o}`]=[s]:r==null||r.warn(c)}});let i=Object.keys(e);i.length&&(this.value=i.sort().flatMap(o=>e[o].sort().map(s=>`${o}/${s}`)).join(" "))}},xS=class{constructor(t,e,n){this.platform=n,this.basicConfiguration={tags:e.tags,logger:e.logger,offline:e.offline,serviceEndpoints:e.serviceEndpoints,sdkKey:t}}};function Za(t){return t.replace(/\/+$/,"")}function Fa(t){return t.replace(/^\/+/,"").replace(/\?$/,"")}var Ji=class Rp{constructor(e,n,r=Rp.DEFAULT_EVENTS,i="/bulk",o="/diagnostic",s=!0,a){this.streaming=Za(e),this.polling=Za(n),this.events=Za(r),this.analyticsEventPath=i,this.diagnosticEventPath=o,this.includeAuthorizationHeader=s,this.payloadFilterKey=a}};Ji.DEFAULT_EVENTS="https://events.launchdarkly.com";function Aa(t,e=[]){if(e.length===0)return t;let n=e.map(({key:r,value:i})=>`${r}=${i}`);return`${t}?${n.join("&")}`}function NS(t,e,n){let r=Fa(e),i=[...n];return t.payloadFilterKey&&i.push({key:"filter",value:t.payloadFilterKey}),Aa(`${t.streaming}/${r}`,i)}function OS(t,e,n=[]){let r=Fa(e),i=[...n];return t.payloadFilterKey&&i.push({key:"filter",value:t.payloadFilterKey}),Aa(`${t.polling}/${r}`,i)}function Bh(t,e,n=[]){let r=Fa(e);return Aa(`${t.events}/${r}`,n)}var Cp=class extends Error{constructor(t){super(t),this.name="LaunchDarklyUnexpectedResponseError"}},GS=class extends Error{constructor(t){super(t),this.name="LaunchDarklyClientError"}},Zp=class extends Error{constructor(t){super(t),this.name="LaunchDarklyTimeoutError"}};function Ki(t){return t>=400&&t<500?t===400||t===408||t===429:!0}function LS(t){return t===413?!0:Ki(t)}function XS(t,e){let n,r;return{promise:new Promise((i,o)=>{r=i,n=setTimeout(()=>{let s=`${e} timed out after ${t} seconds.`;o(new Zp(s))},t*1e3)}),cancel:()=>{r(),clearTimeout(n)}}}function kp(t){return t==null?t:JSON.parse(JSON.stringify(t))}function ka(t){return Math.trunc(t*1e3)}var WS=t=>JSON.stringify(t)==="{}",Ja=(t,e)=>t&&Object.entries(t).reduce((n,[r,i])=>(i&&!WS(i)&&!(e!=null&&e.includes(r))&&(n[r]=typeof i=="object"?Ja(i,e):i),n),{});function Wi(t,e){if(t===e)return!0;if(t&&e&&typeof t=="object"&&typeof e=="object"){if(t.constructor!==e.constructor)return!1;var n,r,i;if(Array.isArray(t)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(!Wi(t[r],e[r]))return!1;return!0}if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(r of t.entries())if(!e.has(r[0]))return!1;for(r of t.entries())if(!Wi(r[1],e.get(r[0])))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(r of t.entries())if(!e.has(r[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(e)){if(n=t.length,n!=e.length)return!1;for(r=n;r--!==0;)if(t[r]!==e[r])return!1;return!0}if(t.constructor===RegExp)return t.source===e.source&&t.flags===e.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===e.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===e.toString();if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){var o=i[r];if(!Wi(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function US(t,e,n,r=!0,i="user-agent"){let{userAgentBase:o,version:s,wrapperName:a,wrapperVersion:c}=e.sdkData(),l={[i]:`${o!=null?o:"NodeJSClient"}/${s}`};return r&&(l.authorization=t),a&&(l["x-launchdarkly-wrapper"]=c?`${a}/${c}`:a),n!=null&&n.value&&(l["x-launchdarkly-tags"]=n.value),l}function Gn(t,e,n){let r;t.status?r=`error ${t.status}${t.status===401?" (invalid SDK key)":""}`:r=`I/O error (${t.message||"unknown error"})`;let i=n!=null?n:"giving up permanently";return`Received ${r} for ${e} - ${i}`}function Vp({status:t}){return t?Ki(t):!0}var jh=(t,e)=>e.btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),xp=async(t=1e3)=>new Promise(e=>{setTimeout(e,t)}),MS=class{constructor(t,e,n){this.p=e,this.li=n,this.St=[],this.de=Date.now(),this.fe=this.de,this.pe={diagnosticId:e.crypto.randomUUID(),sdkKeySuffix:t.length>6?t.substring(t.length-6):t}}createInitEvent(){var t,e,n;let r=this.p.info.sdkData(),i=this.p.info.platformData();return{kind:"diagnostic-init",id:this.pe,creationDate:this.de,sdk:r,configuration:this.li,platform:st({name:i.name,osArch:(t=i.os)==null?void 0:t.arch,osName:(e=i.os)==null?void 0:e.name,osVersion:(n=i.os)==null?void 0:n.version},i.additional||{})}}recordStreamInit(t,e,n){let r={timestamp:t,failed:e,durationMillis:n};this.St.push(r)}createStatsEventAndReset(t,e,n){let r=Date.now(),i={kind:"diagnostic",id:this.pe,creationDate:r,dataSinceDate:this.fe,droppedEvents:t,deduplicatedUsers:e,eventsInLastBatch:n,streamInits:this.St};return this.St=[],this.fe=r,i}},Ua;(function(t){t.MalformedFlag="MALFORMED_FLAG",t.UserNotSpecified="USER_NOT_SPECIFIED",t.FlagNotFound="FLAG_NOT_FOUND",t.ClientNotReady="CLIENT_NOT_READY",t.WrongType="WRONG_TYPE"})(Ua||(Ua={}));var PS=Ua,Np=class{static invalidMetricValue(t){return`The track function was called with a non-numeric "metricValue" (${t}), only numeric metric values are supported.`}};Np.MissingContextKeyNoEvent="Context was unspecified or had no key; event will not be sent";var FS=class{constructor(t,e){let{basicConfiguration:n,platform:r}=t,{serviceEndpoints:{analyticsEventPath:i,diagnosticEventPath:o}}=n,{crypto:s,requests:a}=r;this.ui=st({},e),this.ge=Bh(n.serviceEndpoints,i,[]),this.hi=Bh(n.serviceEndpoints,o,[]),this.T=a,this.di=s}async nt(t,e,n,r){let i={status:qe.Succeeded},o=me(st({},this.ui),{"content-type":"application/json"});n&&(o["x-launchdarkly-payload-id"]=n,o["x-launchDarkly-event-schema"]="4");let s;try{let{status:a,headers:c}=await this.T.fetch(e,{headers:o,body:JSON.stringify(t),compressBodyIfPossible:!0,method:"POST",keepalive:!0}),l=Date.parse(c.get("date")||"");if(l&&(i.serverTime=l),a<=204)return i;if(s=new Cp(Gn({status:a,message:"some events were dropped"},"event posting")),!Ki(a))return LS(a)?i.status=qe.Failed:i.status=qe.FailedAndMustShutDown,i.error=s,i}catch(a){s=a}return s&&!r?(i.status=qe.Failed,i.error=s,i):(await xp(),this.nt(t,this.ge,n,!1))}async sendEventData(t,e){let n=t===On.AnalyticsEvents?this.di.randomUUID():void 0,r=t===On.AnalyticsEvents?this.ge:this.hi;return this.nt(e,r,n,!0)}};function Di(t){return t.kind==="feature"}function AS(t){return t.kind==="identify"}function JS(t){return t.kind==="migration_op"}var DS=class{constructor(t,e,n,r,i,o){this.count=t,this.key=e,this.value=n,this.version=i,this.variation=o,this.default=r}increment(){this.count+=1}};function YS(t){return`${t.key}:${t.variation!==null&&t.variation!==void 0?t.variation:""}:${t.version!==null&&t.version!==void 0?t.version:""}`}var Op=class{constructor(t=!1,e){this.fi=t,this.S=e,this.Y=0,this.rt=0,this.at={},this.ot={}}summarizeEvent(t){if(Di(t)&&!t.excludeFromSummaries){this.y||(this.y=t.context);let e=YS(t),n=this.at[e],r=this.ot[t.key];r||(r=new Set,this.ot[t.key]=r),t.context.kinds.forEach(i=>r.add(i)),n?n.increment():this.at[e]=new DS(1,t.key,t.value,t.default,t.version,t.variation),(this.Y===0||t.creationDate<this.Y)&&(this.Y=t.creationDate),t.creationDate>this.rt&&(this.rt=t.creationDate)}}getSummary(){var t;let e=Object.values(this.at).reduce((r,i)=>{let o=r[i.key];o||(o={default:i.default,counters:[],contextKinds:[...this.ot[i.key]]},r[i.key]=o);let s={value:i.value,count:i.count};return i.variation!==void 0&&i.variation!==null&&(s.variation=i.variation),i.version!==void 0&&i.version!==null?s.version=i.version:s.unknown=!0,o.counters.push(s),r},{}),n={startDate:this.Y,endDate:this.rt,features:e,kind:"summary",context:this.y!==void 0&&this.fi?(t=this.S)==null?void 0:t.filter(this.y):void 0};return this.pi(),n}pi(){this.Y=0,this.rt=0,this.at={},this.ot={}}},KS=class extends Error{constructor(t){super(t),this.name="LaunchDarklyInvalidSDKKeyError"}},_S=class{constructor(t,e){this.S=t,this.t=e,this.Z={}}summarizeEvent(t){var e;if(Di(t)){let n=t.context.canonicalUnfilteredJson();if(!n){t.context.valid&&((e=this.t)==null||e.error("Unable to serialize context, likely the context contains a cycle."));return}let r=this.Z[n];r||(this.Z[n]=new Op(!0,this.S),r=this.Z[n]),r.summarizeEvent(t)}}getSummaries(){let t=this.Z;return this.Z={},Object.values(t).map(e=>e.getSummary())}};function Ui(t){let e=Math.trunc(t);return e===1?!0:e===0?!1:Math.floor(Math.random()*e)===0}function HS(t){return t.getSummaries!==void 0}var zS=class{constructor(t,e,n,r,i,o=!0,s=!1){this.e=t,this.ct=r,this.L=i,this.lt=[],this.me=0,this.Lt=0,this.Ct=0,this.It=!1,this.ye=0,this.At=!1,this.Pt=null,this.gi=t.eventsCapacity,this.t=e.basicConfiguration.logger,this.ve=new FS(e,n),this.S=new bS(t.allAttributesPrivate,t.privateAttributes.map(a=>new Nn(a))),s?this.X=new _S(this.S,this.t):this.X=new Op,o&&this.start()}start(){var t,e;if(((t=this.ct)==null?void 0:t.flushInterval)!==void 0&&(this.Pt=setInterval(()=>{var n;(n=this.ct)==null||n.flush()},this.ct.flushInterval*1e3)),this.mi=setInterval(async()=>{var n;try{await this.flush()}catch(r){(n=this.t)==null||n.debug(`Flush failed: ${r}`)}},this.e.flushInterval*1e3),this.L){let n=this.L.createInitEvent();this.we(n),this.Ee=setInterval(()=>{let r=this.L.createStatsEventAndReset(this.Lt,this.Ct,this.ye);this.Lt=0,this.Ct=0,this.we(r)},this.e.diagnosticRecordingInterval*1e3)}(e=this.t)==null||e.debug("Started EventProcessor.")}we(t){this.ve.sendEventData(On.DiagnosticEvent,t)}close(){clearInterval(this.mi),this.Pt&&clearInterval(this.Pt),this.Ee&&clearInterval(this.Ee)}async flush(){var t;if(this.At)throw new KS("Events cannot be posted because a permanent error has been encountered. This is most likely an invalid SDK key. The specific error information is logged independently.");let e=this.lt;if(this.lt=[],HS(this.X))this.X.getSummaries().forEach(n=>{Object.keys(n.features).length&&e.push(n)});else{let n=this.X.getSummary();Object.keys(n.features).length&&e.push(n)}e.length&&(this.ye=e.length,(t=this.t)==null||t.debug("Flushing %d events",e.length),await this.nt(e))}sendEvent(t){var e;if(this.At)return;if(JS(t)){if(Ui(t.samplingRatio)){let a=me(st({},t),{context:t.context?this.S.filter(t.context):void 0});a.samplingRatio===1&&delete a.samplingRatio,this.ut(a)}return}this.X.summarizeEvent(t);let n=Di(t),r=n&&t.trackEvents||!n,i=this.yi(t),o=AS(t),s=(e=this.ct)==null?void 0:e.processContext(t.context);s||o||(this.Ct+=1),s&&!o&&this.ut(this.Ot({kind:"index",creationDate:t.creationDate,context:t.context,samplingRatio:1},!1)),r&&Ui(t.samplingRatio)&&this.ut(this.Ot(t,!1)),i&&Ui(t.samplingRatio)&&this.ut(this.Ot(t,!0))}Ot(t,e){switch(t.kind){case"feature":{let n={kind:e?"debug":"feature",creationDate:t.creationDate,context:this.S.filter(t.context,!e),key:t.key,value:t.value,default:t.default};return t.samplingRatio!==1&&(n.samplingRatio=t.samplingRatio),t.prereqOf&&(n.prereqOf=t.prereqOf),t.variation!==void 0&&(n.variation=t.variation),t.version!==void 0&&(n.version=t.version),t.reason&&(n.reason=t.reason),n}case"index":case"identify":{let n={kind:t.kind,creationDate:t.creationDate,context:this.S.filter(t.context)};return t.samplingRatio!==1&&(n.samplingRatio=t.samplingRatio),n}case"custom":{let n={kind:"custom",creationDate:t.creationDate,key:t.key,context:this.S.filter(t.context)};return t.samplingRatio!==1&&(n.samplingRatio=t.samplingRatio),t.data!==void 0&&(n.data=t.data),t.metricValue!==void 0&&(n.metricValue=t.metricValue),t.url!==void 0&&(n.url=t.url),n}case"click":return{kind:"click",creationDate:t.creationDate,contextKeys:t.context.kindsAndKeys,key:t.key,url:t.url,selector:t.selector};case"pageview":return{kind:"pageview",creationDate:t.creationDate,contextKeys:t.context.kindsAndKeys,key:t.key,url:t.url};default:return t}}ut(t){var e;this.lt.length<this.gi?(this.lt.push(t),this.It=!1):(this.It||(this.It=!0,(e=this.t)==null||e.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")),this.Lt+=1)}yi(t){return Di(t)&&t.debugEventsUntilDate&&t.debugEventsUntilDate>this.me&&t.debugEventsUntilDate>Date.now()}async nt(t){let e=await this.ve.sendEventData(On.AnalyticsEvents,t);if(e.status===qe.FailedAndMustShutDown&&(this.At=!0),e.serverTime&&(this.me=e.serverTime),e.error)throw e.error}},Gp=class{constructor(t,e,n,r,i=1,o){this.context=t,this.key=e,this.data=n,this.metricValue=r,this.samplingRatio=i,this.url=o,this.kind="custom",this.creationDate=Date.now(),this.context=t}},Ma=class{constructor(t,e,n,r,i,o,s,a,c,l,u,h,p=1){this.withReasons=t,this.context=e,this.key=n,this.samplingRatio=p,this.kind="feature",this.creationDate=Date.now(),this.value=r,this.default=i,o!==void 0&&(this.version=o),s!==void 0&&(this.variation=s),a!==void 0&&(this.trackEvents=a),c!==void 0&&(this.prereqOf=c),l!==void 0&&(this.reason=l),u!==void 0&&(this.debugEventsUntilDate=u),h!==void 0&&(this.excludeFromSummaries=h)}},Lp=class{constructor(t,e=1){this.context=t,this.samplingRatio=e,this.kind="identify",this.creationDate=Date.now()}},BS=class{close(){}async flush(){}sendEvent(){}},jS=class{constructor(t){this.Tt=t}evalEvent(t){var e;return new Ma(this.Tt,t.context,t.flagKey,t.value,t.defaultVal,t.version,(e=t.variation)!=null?e:void 0,t.trackEvents||t.addExperimentData,t.prereqOfFlagKey,this.Tt||t.addExperimentData?t.reason:void 0,t.debugEventsUntilDate,t.excludeFromSummaries,t.samplingRatio)}unknownFlagEvent(t,e,n){return new Ma(this.Tt,n,t,e,e,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0)}identifyEvent(t){return new Lp(t,1)}customEvent(t,e,n,r,i=1){return new Gp(e,t,n!=null?n:void 0,r!=null?r:void 0,i)}},Qh="FDv1Fallback";function QS(t){return{vi:t,De:"",useSelector(e){return this.De=e,this},processFullTransfer(e){let n=[{event:"server-intent",data:{payloads:[{id:Qh,target:1,intentCode:"xfer-full",reason:"payload-missing"}]}}];Object.entries((e==null?void 0:e.flags)||[]).forEach(([r,i])=>{n.push({event:"put-object",data:{kind:"flag",key:r,version:i.version||1,object:i}})}),Object.entries((e==null?void 0:e.segments)||[]).forEach(([r,i])=>{n.push({event:"put-object",data:{kind:"segment",key:r,version:i.version||1,object:i}})}),n.push({event:"payload-transferred",data:{state:this.De,version:1,id:Qh}}),this.vi.processEvents(n)}}}var Xp=class{constructor(t,e,n){this.wi=t,this.m=e,this.t=n,this.n=[],this.M=void 0,this.z=!1,this.B=[],this.Ei=r=>{var i;if(this.$t(),!r.payloads.length)return;let o=r.payloads[0];switch(o==null?void 0:o.intentCode){case"xfer-full":this.z=!0;break;case"xfer-changes":this.z=!1;break;case"none":this.z=!1,this.Di(o);break;default:(i=this.t)==null||i.warn(`Unable to process intent code '${o==null?void 0:o.intentCode}'.`);return}this.M=o==null?void 0:o.id},this.bi=r=>{var i;if(!this.M||!r.kind||!r.key||!r.version||!r.object)return;let o=this.ki(r.kind,r.object);if(!o){(i=this.t)==null||i.warn(`Unable to process object for kind: '${r.kind}'`);return}this.B.push({kind:r.kind,key:r.key,version:r.version,object:o})},this.xi=r=>{!this.M||!r.kind||!r.key||!r.version||this.B.push({kind:r.kind,key:r.key,version:r.version,deleted:!0})},this.Di=r=>{if(!r.id||!r.target)return;let i={id:r.id,version:r.target,basis:!1,updates:[]};this.n.forEach(o=>o(i)),this.be()},this.Si=r=>{if(!this.M||r.state===null||r.state===void 0||!r.version){this.$t();return}let i={id:this.M,version:r.version,state:r.state,basis:this.z,updates:this.B};this.n.forEach(o=>o(i)),this.be()},this.Li=r=>{var i;(i=this.t)==null||i.info(`Goodbye was received from the LaunchDarkly connection with reason: ${r.reason}.`),this.$t()},this.Ci=r=>{var i;(i=this.t)==null||i.info(`An issue was encountered receiving updates for payload ${this.M} with reason: ${r.reason}.`),this.Ii()}}addPayloadListener(t){this.n.push(t)}removePayloadListener(t){let e=this.n.indexOf(t,0);e>-1&&this.n.splice(e,1)}processEvents(t){t.forEach(e=>{switch(e.event){case"server-intent":{this.Ei(e.data);break}case"put-object":{this.bi(e.data);break}case"delete-object":{this.xi(e.data);break}case"payload-transferred":{this.Si(e.data);break}case"goodbye":{this.Li(e.data);break}case"error":{this.Ci(e.data);break}}})}ki(t,e){var n,r;return(r=(n=this.wi)[t])==null?void 0:r.call(n,e)}be(){this.z=!1,this.B=[]}Ii(){this.B=[]}$t(){this.M=void 0,this.z=!1,this.B=[]}},$S=class{constructor(t,e,n,r){this.m=n,this.t=r,this.K(t,"server-intent"),this.K(t,"put-object"),this.K(t,"delete-object"),this.K(t,"payload-transferred"),this.K(t,"goodbye"),this.K(t,"error"),this.Nt=new Xp(e,n,r)}addPayloadListener(t){this.Nt.addPayloadListener(t)}removePayloadListener(t){this.Nt.removePayloadListener(t)}K(t,e){t.addEventListener(e,async n=>{var r,i,o,s,a;if(n!=null&&n.data){(r=this.t)==null||r.debug(`Received ${e} event. Data is ${n.data}`);try{this.Nt.processEvents([{event:e,data:JSON.parse(n.data)}])}catch(c){(i=this.t)==null||i.error(`Stream received data that was unable to be processed in "${e}" message`),(o=this.t)==null||o.debug(`Data follows: ${n.data}`),(s=this.m)==null||s.call(this,_t.InvalidData,"Malformed data in EventStream.")}}else(a=this.m)==null||a.call(this,_t.Unknown,"Event from EventStream missing data.")})}};function qS(t){if(t){let e=Object.keys(t).find(n=>n.toLowerCase()==="x-ld-envid");if(e)return{environmentId:t[e]}}}var $h="unknown plugin";function Yi(t,e){try{return e.getMetadata().name||$h}catch(n){return t.error("Exception thrown getting metadata for plugin. Unable to get plugin name."),$h}}function tw(t,e,n){let r=[];return n.forEach(i=>{var o;try{let s=(o=i.getHooks)==null?void 0:o.call(i,e);s===void 0?t.error(`Plugin ${Yi(t,i)} returned undefined from getHooks.`):s&&s.length>0&&r.push(...s)}catch(s){t.error(`Exception thrown getting hooks for plugin ${Yi(t,i)}. Unable to get hooks.`)}}),r}function ew(t,e,n,r){r.forEach(i=>{try{i.register(n,e)}catch(o){t.error(`Exception thrown registering plugin ${Yi(t,i)}.`)}})}var de=Object.freeze({__proto__:null,ClientMessages:Np,DiagnosticsManager:MS,ErrorKinds:PS,EventFactoryBase:jS,EventProcessor:zS,FDv1PayloadAdaptor:QS,InputCustomEvent:Gp,InputEvalEvent:Ma,InputIdentifyEvent:Lp,NullEventProcessor:BS,PayloadProcessor:Xp,PayloadStreamReader:$S,canonicalize:Pi,initMetadataFromHeaders:qS,isLegacyUser:wp,isMultiKind:Sp,isSingleKind:vp,safeGetHooks:tw,safeGetName:Yi,safeRegisterPlugins:ew,shouldSample:Ui}),Kt;(function(t){t.Initializing="INITIALIZING",t.Valid="VALID",t.Interrupted="INTERRUPTED",t.SetOffline="SET_OFFLINE",t.Closed="CLOSED"})(Kt||(Kt={}));function nw(t){return t>=200&&t<=299}var qh=class extends Error{constructor(t,e){super(t),this.status=e,this.name="LaunchDarklyRequestError"}},rw=class{constructor(t,e,n,r,i){this.T=t,this.Ai=e,this.ht=n,this.Pi=r,this.Oi=i}async requestPayload(){let t;try{let e=await this.T.fetch(this.Ai,{method:this.Pi,headers:this.ht,body:this.Oi});if(nw(e.status))return await e.text();t=e.status}catch(e){throw new qh(e==null?void 0:e.message)}throw new qh(`Unexpected status code: ${t}`,t)}};function tp(t,e,n,r,i,o,s,a,c,l){let u,h="GET",p=st({},o);c&&(h="REPORT",p["content-type"]="application/json",u=t);let f=c?n.pathReport(i,t):n.pathGet(i,t),m=[...s!=null?s:[]];a&&m.push({key:"withReasons",value:"true"}),l&&m.push({key:"h",value:l});let d=OS(e,f,m);return new rw(r,d,p,h,u)}var ep=new Error("Task has already been executed or shed. This is likely an implementation error. The task will not be executed again.");function iw(t,e,n=!1){let r,i=new Promise(a=>{r=(c,l)=>{var u;try{(u=t.after)==null||u.call(t,c,l)}catch(h){e==null||e.error(`Error in after callback: ${h}`)}a(c)}}),o=t.before?t.before():Promise.resolve(void 0),s=!1;return{execute:()=>{s&&(e==null||e.error(ep)),s=!0,o.then(a=>{t.execute(a).then(c=>r({status:"complete",result:c},a)).catch(c=>r({status:"error",error:c},a))}).catch(a=>{e==null||e.error(a),r({status:"error",error:a},void 0)})},shed:()=>{s&&(e==null||e.error(ep)),s=!0,o.then(a=>{r({status:"shed"},a)})},promise:i,sheddable:n}}function ow(t){let e,n=[];function r(){if(!e&&n.length>0){let i=n.shift();e=i.promise.finally(()=>{e=void 0,r()}),i.execute()}}return{execute(i,o=!1){var s,a;let c=iw(i,t,o);return e?((s=n[n.length-1])!=null&&s.sheddable&&((a=n.pop())==null||a.shed()),n.push(c)):(e=c.promise.finally(()=>{e=void 0,r()}),c.execute()),c.promise},pendingCount(){return n.length}}}var sw={logger:G.Object,maxCachedContexts:G.numberWithMin(0),baseUri:G.String,streamUri:G.String,eventsUri:G.String,capacity:G.numberWithMin(1),diagnosticRecordingInterval:G.numberWithMin(2),flushInterval:G.numberWithMin(2),streamInitialReconnectDelay:G.numberWithMin(0),allAttributesPrivate:G.Boolean,debug:G.Boolean,diagnosticOptOut:G.Boolean,withReasons:G.Boolean,sendEvents:G.Boolean,pollInterval:G.numberWithMin(30),useReport:G.Boolean,privateAttributes:G.StringArray,applicationInfo:G.Object,wrapperName:G.String,wrapperVersion:G.String,payloadFilterKey:G.stringMatchingRegex(/^[a-zA-Z0-9](\w|\.|-)*$/),hooks:G.createTypeArray("Hook[]",{}),inspectors:G.createTypeArray("LDInspection",{}),cleanOldPersistentData:G.Boolean},aw=300,Wp="https://clientsdk.launchdarkly.com",Up="https://clientstream.launchdarkly.com";function lw(t){return t instanceof Tp?t:Ep(t)}var cw=class{constructor(t={},e={getImplementationHooks:()=>[],credentialType:"mobileKey"}){var n,r,i;this.logger=Ep(),this.baseUri=Wp,this.eventsUri=Ji.DEFAULT_EVENTS,this.streamUri=Up,this.maxCachedContexts=5,this.capacity=100,this.diagnosticRecordingInterval=900,this.flushInterval=30,this.streamInitialReconnectDelay=1,this.allAttributesPrivate=!1,this.debug=!1,this.diagnosticOptOut=!1,this.sendEvents=!0,this.sendLDHeaders=!0,this.useReport=!1,this.withReasons=!1,this.privateAttributes=[],this.pollInterval=aw,this.hooks=[],this.inspectors=[],this.logger=lw(t.logger),this.Ti(t).forEach(o=>this.logger.warn(o)),this.serviceEndpoints=new Ji(this.streamUri,this.baseUri,this.eventsUri,e.analyticsEventPath,e.diagnosticEventPath,e.includeAuthorizationHeader,t.payloadFilterKey),this.useReport=(n=t.useReport)!=null?n:!1,this.tags=new VS({application:this.applicationInfo,logger:this.logger}),this.userAgentHeaderName=(r=e.userAgentHeaderName)!=null?r:"user-agent",this.trackEventModifier=(i=e.trackEventModifier)!=null?i:(o=>o),this.credentialType=e.credentialType,this.getImplementationHooks=e.getImplementationHooks}Ti(t){let e=[];return Object.entries(t).forEach(([n,r])=>{let i=sw[n];if(i)if(i.is(r))n==="logger"||(this[n]=r!=null?r:void 0);else{let o=i.getType();if(o==="boolean")e.push(Ue.wrongOptionTypeBoolean(n,typeof r)),this[n]=!!r;else if(o==="boolean | undefined | null")e.push(Ue.wrongOptionTypeBoolean(n,typeof r)),typeof r!="boolean"&&typeof r!="undefined"&&r!==null&&(this[n]=!!r);else if(i instanceof gp&&G.Number.is(r)){let{min:s}=i;e.push(Ue.optionBelowMinimum(n,r,s)),this[n]=s}else e.push(Ue.wrongOptionType(n,i.getType(),typeof r))}else e.push(Ue.unknownOption(n))}),e}};async function Mp(t,e){if(t.digest)return t.digest(e);if(t.asyncDigest)return t.asyncDigest(e);throw new Error("Platform must implement digest or asyncDigest")}var Pp=async(t,{crypto:e,storage:n})=>{let r=await(n==null?void 0:n.get(t));return r||(r=e.randomUUID(),await(n==null?void 0:n.set(t,r))),r};function Fp(t){return async e=>Mp(t.createHash("sha256").update(e),"base64")}var fe=async t=>t;async function gr(t){return(await Promise.all(t.map(e=>e.transform(e.value)))).join("_")}async function uw(t,e){return gr([{value:"LaunchDarkly",transform:fe},{value:e,transform:Fp(t)}])}async function hw(t){return gr([{value:"LaunchDarkly",transform:fe},{value:"AnonymousKeys",transform:fe},{value:t,transform:fe}])}async function pw(t){return gr([{value:"LaunchDarkly",transform:fe},{value:"ContextKeys",transform:fe},{value:t,transform:fe}])}async function dw(t){return gr([{value:t,transform:fe},{value:"ContextIndex",transform:fe}])}async function np(t,e,n){return gr([{value:e,transform:fe},{value:n.canonicalKey,transform:Fp(t)}])}var{isLegacyUser:fw,isSingleKind:Va,isMultiKind:rp}=de,Ap="1.0",mw=t=>{let e=t,{kind:n}=e,r=fp(e,["kind"]);return{kind:"multi",[n]:r}},yw=async({crypto:t,info:e},{applicationInfo:n})=>{var r;let{ld_application:i}=e.platformData(),o=(r=Ja(i))!=null?r:{},s=(n==null?void 0:n.id)||(o==null?void 0:o.id);if(s){let a=(n==null?void 0:n.version)||(o==null?void 0:o.version),c=(n==null?void 0:n.name)||(o==null?void 0:o.name),l=(n==null?void 0:n.versionName)||(o==null?void 0:o.versionName);return o=st(st(st(me(st({},o),{id:s}),a?{version:a}:{}),c?{name:c}:{}),l?{versionName:l}:{}),o.key=await Mp(t.createHash("sha256").update(s),"base64"),o.envAttributesVersion=o.envAttributesVersion||Ap,o}},gw=async t=>{var e,n,r,i;let{ld_device:o,os:s}=t.info.platformData(),a=(e=Ja(o))!=null?e:{},c=(s==null?void 0:s.name)||((n=a.os)==null?void 0:n.name),l=(s==null?void 0:s.version)||((r=a.os)==null?void 0:r.version),u=(i=a.os)==null?void 0:i.family;if((c||l||u)&&(a.os=st(st(st({},c?{name:c}:{}),l?{version:l}:{}),u?{family:u}:{})),Object.keys(a).filter(h=>h!=="key"&&h!=="envAttributesVersion").length){let h=await pw("ld_device");return a.key=await Pp(h,t),a.envAttributesVersion=a.envAttributesVersion||Ap,a}},bw=async(t,e,n)=>{if(fw(t))return t;let r,i;if(Va(t)&&t.kind!=="ld_application"||rp(t)&&!t.ld_application?r=await yw(e,n):n.logger.warn("Not adding ld_application environment attributes because it already exists."),Va(t)&&t.kind!=="ld_device"||rp(t)&&!t.ld_device?i=await gw(e):n.logger.warn("Not adding ld_device environment attributes because it already exists."),r||i){let o=Va(t)?mw(t):t;return st(st(st({},o),r?{ld_application:r}:{}),i?{ld_device:i}:{})}return t};function vw(){let t,e;return{set(n,r){t=n,e=r},getContext(){return e},getUnwrappedContext(){return t},newIdentificationPromise(){let n,r;return{identifyPromise:new Promise((i,o)=>{n=i,r=o}),identifyResolve:n,identifyReject:r}},hasContext(){return e!==void 0},hasValidContext(){return this.hasContext()&&e.valid}}}var{isLegacyUser:Sw,isMultiKind:ww,isSingleKind:Iw}=de,Da=async(t,e,n)=>{let{anonymous:r,key:i}=e;if(r&&!i){let o=await hw(t);e.key=await Pp(o,n)}},Tw=async(t,e)=>{await Da(t.kind,t,e)},Ew=async(t,e)=>{let n=t,{kind:r}=n,i=fp(n,["kind"]);return Promise.all(Object.entries(i).map(([o,s])=>Da(o,s,e)))},Rw=async(t,e)=>{await Da("user",t,e)},Cw=async(t,e)=>{let n=kp(t);return Iw(n)&&await Tw(n,e),ww(n)&&await Ew(n,e),Sw(n)&&await Rw(n,e),n},Zw=t=>({customBaseURI:t.serviceEndpoints.polling!==Wp,customStreamURI:t.serviceEndpoints.streaming!==Up,customEventsURI:t.serviceEndpoints.events!==Ji.DEFAULT_EVENTS,eventsCapacity:t.capacity,eventsFlushIntervalMillis:ka(t.flushInterval),reconnectTimeMillis:ka(t.streamInitialReconnectDelay),diagnosticRecordingIntervalMillis:ka(t.diagnosticRecordingInterval),allAttributesPrivate:t.allAttributesPrivate,usingSecureMode:!1,bootstrapMode:!1}),kw=(t,e,n)=>{if(e.sendEvents&&!e.diagnosticOptOut)return new de.DiagnosticsManager(t,n,Zw(e))};function ip(t,e){return{value:e!=null?e:null,variationIndex:null,reason:{kind:"ERROR",errorKind:t}}}function op(t,e,n){return st({value:t,variationIndex:e!=null?e:null},n!==void 0&&{reason:n})}var Vw=(t,e,n,r,i)=>{if(e.sendEvents)return new de.EventProcessor(me(st({},e),{eventsCapacity:e.capacity}),new xS(t,e,n),r,void 0,i,!1,!0)},sp=class extends de.EventFactoryBase{evalEventClient(t,e,n,r,i,o){let{trackEvents:s,debugEventsUntilDate:a,trackReason:c,flagVersion:l,version:u,variation:h}=r;return super.evalEvent({addExperimentData:c,context:i,debugEventsUntilDate:a,defaultVal:n,flagKey:t,reason:o,trackEvents:!!s,value:e,variation:h,version:l!=null?l:u})}},xa=class Jp{constructor(){this.container={index:new Array}}static fromJson(e){let n=new Jp;try{n.container=JSON.parse(e)}catch(r){}return n}toJson(){return JSON.stringify(this.container)}notice(e,n){let r=this.container.index.find(i=>i.id===e);r===void 0?this.container.index.push({id:e,timestamp:n}):r.timestamp=n}prune(e){let n=Math.max(e,0);return this.container.index.length>n?(this.container.index.sort((r,i)=>r.timestamp-i.timestamp),this.container.index.splice(0,this.container.index.length-n)):[]}},xw=class{constructor(t,e,n,r,i,o,s=()=>Date.now()){this.p=t,this.Rt=e,this.$i=n,this.$=r,this.w=i,this.t=o,this.dt=s,this.ke=dw(this.Rt)}async init(t,e){this.w.init(t,e),await this.xe(t)}async upsert(t,e,n){return this.w.upsert(t,e,n)?(await this.xe(t),!0):!1}async loadCached(t){var e,n,r,i;let o=await np(this.p.crypto,this.Rt,t),s=await((e=this.p.storage)==null?void 0:e.get(o));if(s==null){if(s=await((n=this.p.storage)==null?void 0:n.get(t.canonicalKey)),s==null)return!1;await((r=this.p.storage)==null?void 0:r.set(o,s)),await((i=this.p.storage)==null?void 0:i.clear(t.canonicalKey))}try{let a=JSON.parse(s),c=Object.entries(a).reduce((l,[u,h])=>(l[u]={version:h.version,flag:h},l),{});return this.w.initCached(t,c),this.t.debug("Loaded cached flag evaluations from persistent storage"),!0}catch(a){return this.t.warn(`Could not load cached flag evaluations from persistent storage: ${a.message}`),!1}}async Ni(){var t;if(this.G!==void 0)return this.G;let e=await((t=this.p.storage)==null?void 0:t.get(await this.ke));if(!e)return this.G=new xa,this.G;try{this.G=xa.fromJson(e),this.t.debug("Loaded context index from persistent storage")}catch(n){this.t.warn(`Could not load index from persistent storage: ${n.message}`),this.G=new xa}return this.G}async xe(t){var e,n;let r=await this.Ni(),i=await np(this.p.crypto,this.Rt,t);r.notice(i,this.dt());let o=r.prune(this.$i);await Promise.all(o.map(async l=>{var u;return(u=this.p.storage)==null?void 0:u.clear(l.id)})),await((e=this.p.storage)==null?void 0:e.set(await this.ke,r.toJson()));let s=this.$.getAll(),a=Object.entries(s).reduce((l,[u,h])=>(h.flag!==null&&h.flag!==void 0&&(l[u]=h.flag),l),{}),c=JSON.stringify(a);await((n=this.p.storage)==null?void 0:n.set(i,c))}};function Nw(){let t={};return{init(e){t=Object.entries(e).reduce((n,[r,i])=>(n[r]=i,n),{})},insertOrUpdate(e,n){t[e]=n},get(e){if(Object.prototype.hasOwnProperty.call(t,e))return t[e]},getAll(){return t}}}function Ow(t,e){let n=[];return Object.entries(t).forEach(([r,i])=>{let o=e[r];(!o||!Wi(i,o))&&n.push(r)}),Object.keys(e).forEach(r=>{t[r]||n.push(r)}),n}function Gw(t,e){let n=t,r=e,i,o=new Array;return{handleFlagChanges(s,a){i?o.forEach(c=>{try{c(i,s,a)}catch(l){}}):r.warn("Received a change event without an active context. Changes will not be propagated.")},init(s,a){i=s;let c=n.getAll();n.init(a);let l=Ow(c,a);l.length>0&&this.handleFlagChanges(l,"init")},initCached(s,a){(i==null?void 0:i.canonicalKey)!==s.canonicalKey&&this.init(s,a)},upsert(s,a,c){if((i==null?void 0:i.canonicalKey)!==s.canonicalKey)return r.warn("Received an update for an inactive context."),!1;let l=n.get(a);return l!==void 0&&l.version>=c.version?!1:(n.insertOrUpdate(a,c),this.handleFlagChanges([a],"patch"),!0)},on(s){o.push(s)},off(s){let a=o.indexOf(s);a>-1&&o.splice(a,1)}}}var Lw=class{constructor(t,e,n,r,i=()=>Date.now()){this.$=Nw(),this.w=Gw(this.$,r),this.Mt=this.Ri(t,e,n,r,i)}async Ri(t,e,n,r,i=()=>Date.now()){let o=await uw(t.crypto,e);return new xw(t,o,n,this.$,this.w,r,i)}get(t){return this.r&&Object.prototype.hasOwnProperty.call(this.r,t)?this.Ft(this.r[t]):this.$.get(t)}getAll(){return this.r?st(st({},this.$.getAll()),Object.entries(this.r).reduce((t,[e,n])=>(t[e]=this.Ft(n),t),{})):this.$.getAll()}presetFlags(t){this.$.init(t)}setBootstrap(t,e){this.w.init(t,e)}async init(t,e){return(await this.Mt).init(t,e)}async upsert(t,e,n){return(await this.Mt).upsert(t,e,n)}async loadCached(t){return(await this.Mt).loadCached(t)}on(t){this.w.on(t)}off(t){this.w.off(t)}Ft(t){return{flag:{value:t,version:0},version:0}}setOverride(t,e){this.r||(this.r={}),this.r[t]=e,this.w.handleFlagChanges([t],"override")}removeOverride(t){!this.r||!Object.prototype.hasOwnProperty.call(this.r,t)||(delete this.r[t],Object.keys(this.r).length===0&&(this.r=void 0),this.w.handleFlagChanges([t],"override"))}clearAllOverrides(){if(this.r){let t=st({},this.r);this.r=void 0,this.w.handleFlagChanges(Object.keys(t),"override")}}getAllOverrides(){if(!this.r)return{};let t={};return Object.entries(this.r).forEach(([e,n])=>{t[e]=this.Ft(n)}),t}getDebugOverride(){return{setOverride:this.setOverride.bind(this),removeOverride:this.removeOverride.bind(this),clearAllOverrides:this.clearAllOverrides.bind(this),getAllOverrides:this.getAllOverrides.bind(this)}}},ap="unknown hook",Dp="beforeEvaluation",Yp="afterEvaluation",Xw="afterTrack";function br(t,e,n,r,i){try{return r()}catch(o){return t==null||t.error(`An error was encountered in "${e}" of the "${n}" hook: ${o}`),i}}function vr(t,e){try{return e.getMetadata().name||ap}catch(n){return t.error("Exception thrown getting metadata for hook. Unable to get hook name."),ap}}function Ww(t,e,n){return e.map(r=>br(t,Dp,vr(t,r),()=>{var i,o;return(o=(i=r==null?void 0:r.beforeEvaluation)==null?void 0:i.call(r,n,{}))!=null?o:{}},{}))}function Uw(t,e,n,r,i){for(let o=e.length-1;o>=0;o-=1){let s=e[o],a=r[o];br(t,Yp,vr(t,s),()=>{var c,l;return(l=(c=s==null?void 0:s.afterEvaluation)==null?void 0:c.call(s,n,a,i))!=null?l:{}},{})}}function Mw(t,e,n){return e.map(r=>br(t,Dp,vr(t,r),()=>{var i,o;return(o=(i=r==null?void 0:r.beforeIdentify)==null?void 0:i.call(r,n,{}))!=null?o:{}},{}))}function Pw(t,e,n,r,i){for(let o=e.length-1;o>=0;o-=1){let s=e[o],a=r[o];br(t,Yp,vr(t,s),()=>{var c,l;return(l=(c=s==null?void 0:s.afterIdentify)==null?void 0:c.call(s,n,a,i))!=null?l:{}},{})}}function Fw(t,e,n){for(let r=e.length-1;r>=0;r-=1){let i=e[r];br(t,Xw,vr(t,i),()=>{var o;return(o=i==null?void 0:i.afterTrack)==null?void 0:o.call(i,n)},void 0)}}var Aw=class{constructor(t,e){this.t=t,this.F=[],this.F.push(...e)}withEvaluation(t,e,n,r){if(this.F.length===0)return r();let i=[...this.F],o={flagKey:t,context:e,defaultValue:n},s=Ww(this.t,i,o),a=r();return Uw(this.t,i,o,s,a),a}identify(t,e){let n=[...this.F],r={context:t,timeout:e},i=Mw(this.t,n,r);return o=>{Pw(this.t,n,r,i,o)}}addHook(t){this.F.push(t)}afterTrack(t){if(this.F.length===0)return;let e=[...this.F];Fw(this.t,e,t)}};function Jw(t){return{getMetadata(){return{name:"LaunchDarkly-Inspector-Adapter"}},afterEvaluation:(e,n,r)=>(t.onFlagUsed(e.flagKey,r,e.context),n),afterIdentify(e,n,r){return t.onIdentityChanged(e.context),n}}}function Dw(t,e){return`an inspector: "${e}" of an invalid type (${t}) was configured`}function Yw(t,e){return`an inspector: "${e}" of type: "${t}" generated an exception`}function Kw(t,e){let n=!1,r={method:(...i)=>{try{t.method(...i)}catch(o){n||(n=!0,e.warn(Yw(r.type,r.name)))}},type:t.type,name:t.name,synchronous:t.synchronous};return r}var Kp="flag-used",_p="flag-details-changed",Hp="flag-detail-changed",zp="client-identity-changed",_w=[Kp,_p,Hp,zp];function Hw(t,e){let n=_w.includes(t.type)&&t.method&&typeof t.method=="function";return n||e.warn(Dw(t.type,t.name)),n}var zw=class{constructor(t,e){this.W=[];let n=t.filter(r=>Hw(r,e));this.W=n.map(r=>Kw(r,e))}hasInspectors(){return this.W.length!==0}onFlagUsed(t,e,n){this.W.forEach(r=>{r.type===Kp&&r.method(t,e,n)})}onFlagsChanged(t){this.W.forEach(e=>{e.type===_p&&e.method(t)})}onFlagChanged(t,e){this.W.forEach(n=>{n.type===Hp&&n.method(t,e)})}onIdentityChanged(t){this.W.forEach(e=>{e.type===zp&&e.method(t)})}},Bw=class{constructor(t){this.t=t,this.n=new Map}on(t,e){var n;this.n.has(t)?(n=this.n.get(t))==null||n.push(e):this.n.set(t,[e])}off(t,e){let n=this.n.get(t);if(n){if(e){let r=n.filter(i=>i!==e);r.length===0?this.n.delete(t):this.n.set(t,r);return}this.n.delete(t)}}Mi(t,e,...n){var r;try{t(...n)}catch(i){(r=this.t)==null||r.error(`Encountered error invoking handler for "${e}", detail: "${i}"`)}}emit(t,...e){let n=this.n.get(t);n==null||n.forEach(r=>this.Mi(r,t,...e))}eventNames(){return[...this.n.keys()]}listenerCount(t){var e,n;return(n=(e=this.n.get(t))==null?void 0:e.length)!=null?n:0}};function jw(t,e,n){let r=e.info.sdkData(),i;n.applicationInfo&&(n.applicationInfo.id&&(i=i!=null?i:{},i.id=n.applicationInfo.id),n.applicationInfo.version&&(i=i!=null?i:{},i.version=n.applicationInfo.version),n.applicationInfo.name&&(i=i!=null?i:{},i.name=n.applicationInfo.name),n.applicationInfo.versionName&&(i=i!=null?i:{},i.versionName=n.applicationInfo.versionName));let o={name:r.userAgentBase,version:r.version};r.wrapperName&&(o.wrapperName=r.wrapperName),r.wrapperVersion&&(o.wrapperVersion=r.wrapperVersion);let s={sdk:o,[n.credentialType]:t};return i&&(s.application=i),s}var{ClientMessages:lp,ErrorKinds:cp}=de,Qw=5,$w=class{constructor(t,e,n,r,i,o){if(this.sdkKey=t,this.autoEnvAttributes=e,this.platform=n,this.a=vw(),this.Ut=15,this.N=new sp(!1),this.ft=new sp(!0),this.Vt=!1,this.Fi=ow(),!t)throw new Error("You must configure the client with a client-side SDK key");if(!n.encoding)throw new Error("Platform must implement Encoding because btoa is required.");this.e=new cw(r,o),this.logger=this.e.logger,this.Se=US(this.sdkKey,this.platform.info,this.e.tags,this.e.serviceEndpoints.includeAuthorizationHeader,this.e.userAgentHeaderName),this.E=new Lw(this.platform,t,this.e.maxCachedContexts,this.e.logger),this.L=kw(t,this.e,n),this.D=Vw(t,this.e,n,this.Se,this.L),this.emitter=new Bw,this.emitter.on("error",(a,c)=>{this.logger.error(`error: ${c}, context: ${JSON.stringify(a)}`)}),this.E.on((a,c,l)=>{this.Ui(c,l);let u=xn.toLDContext(a);this.emitter.emit("change",u,c),c.forEach(h=>{this.emitter.emit(`change:${h}`,u)})}),this.dataManager=i(this.E,this.e,this.Se,this.emitter,this.L);let s=[...this.e.hooks];if(this.environmentMetadata=jw(this.sdkKey,this.platform,this.e),this.e.getImplementationHooks(this.environmentMetadata).forEach(a=>{s.push(a)}),this.U=new Aw(this.logger,s),this.Q=new zw(this.e.inspectors,this.logger),this.Q.hasInspectors()&&this.U.addHook(Jw(this.Q)),r.cleanOldPersistentData&&o!=null&&o.getLegacyStorageKeys&&this.platform.storage)try{this.logger.debug("Cleaning old persistent data."),Promise.all(o.getLegacyStorageKeys().map(a=>{var c;return(c=this.platform.storage)==null?void 0:c.clear(a)})).catch(a=>{this.logger.error(`Error cleaning old persistent data: ${a}`)}).finally(()=>{this.logger.debug("Cleaned old persistent data.")})}catch(a){this.logger.error(`Error cleaning old persistent data: ${a}`)}}allFlags(){return Object.entries(this.E.getAll()).reduce((t,[e,n])=>(n.flag!==null&&n.flag!==void 0&&!n.flag.deleted&&(t[e]=n.flag.value),t),{})}async close(){var t;await this.flush(),(t=this.D)==null||t.close(),this.dataManager.close(),this.logger.debug("Closed event processor and data source.")}async flush(){var t;try{await((t=this.D)==null?void 0:t.flush()),this.logger.debug("Successfully flushed event processor.")}catch(e){return this.logger.error(`Error flushing event processor: ${e}.`),{error:e,result:!1}}return{result:!0}}getContext(){return this.a.hasContext()?kp(this.a.getUnwrappedContext()):void 0}getInternalContext(){return this.a.getContext()}presetFlags(t){this.E.presetFlags(t)}async identify(t,e){let n=await this.identifyResult(t,e);if(n.status==="error")throw n.error;if(n.status==="timeout"){let r=new Zp(`identify timed out after ${n.timeout} seconds.`);throw this.logger.error(r.message),r}}async identifyResult(t,e){var n,r;let i=(n=e==null?void 0:e.timeout)!=null?n:Qw,o=(e==null?void 0:e.timeout)===void 0&&(e==null?void 0:e.noTimeout)===!0;i>this.Ut&&this.logger.warn(`The identify function was called with a timeout greater than ${this.Ut} seconds. We recommend a timeout of less than ${this.Ut} seconds.`);let s=this.Fi.execute({before:async()=>{let c=await Cw(t,this.platform);this.autoEnvAttributes===Ai.Enabled&&(c=await bw(c,this.platform,this.e));let l=xn.fromLDContext(c);if(l.valid){let u=this.U.identify(c,e==null?void 0:e.timeout);return{context:c,checkedContext:l,afterIdentify:u}}return{context:c,checkedContext:l}},execute:async c=>{var l;let{context:u,checkedContext:h}=c;if(!h.valid){let d=new Error("Context was unspecified or had no key");return this.emitter.emit("error",u,d),Promise.reject(d)}this.a.set(u,h),(l=this.D)==null||l.sendEvent(this.N.identifyEvent(h));let{identifyPromise:p,identifyResolve:f,identifyReject:m}=this.a.newIdentificationPromise();return this.logger.debug(`Identifying ${JSON.stringify(h)}`),await this.dataManager.identify(f,m,h,e),p},after:async(c,l)=>{var u,h,p;c.status==="complete"?(u=l==null?void 0:l.afterIdentify)==null||u.call(l,{status:"completed"}):c.status==="shed"?(h=l==null?void 0:l.afterIdentify)==null||h.call(l,{status:"shed"}):c.status==="error"&&((p=l==null?void 0:l.afterIdentify)==null||p.call(l,{status:"error"}))}},(r=e==null?void 0:e.sheddable)!=null?r:!1).then(c=>{if(c.status==="error"){let u={status:"error",error:c.error};return this.maybeSetInitializationResult({status:"failed",error:c.error}),u}if(c.status==="shed")return{status:"shed"};let l={status:"completed"};return this.maybeSetInitializationResult({status:"complete"}),l});if(o)return s;let a=new Promise(c=>{setTimeout(()=>{c({status:"timeout",timeout:i})},i*1e3)});return Promise.race([s,a])}maybeSetInitializationResult(t){this.initializeResult===void 0&&(this.initializeResult=t,this.emitter.emit("ready"),t.status==="complete"&&this.emitter.emit("initialized"),this.initResolve&&(this.initResolve(t),this.initResolve=void 0))}waitForInitialization(t){var e;let n=(e=t==null?void 0:t.timeout)!=null?e:5;return this.initializeResult?Promise.resolve(this.initializeResult):this.initializedPromise?this.promiseWithTimeout(this.initializedPromise,n):(this.initializedPromise||(this.initializedPromise=new Promise(r=>{this.initResolve=r})),this.promiseWithTimeout(this.initializedPromise,n))}promiseWithTimeout(t,e){let n=XS(e,"waitForInitialization");return Promise.race([t.then(r=>(n.cancel(),r)),n.promise.then(()=>({status:"complete"})).catch(()=>({status:"timeout"}))]).catch(r=>{var i;return(i=this.logger)==null||i.error(r.message),{status:"failed",error:r}})}on(t,e){this.emitter.on(t,e)}off(t,e){this.emitter.off(t,e)}track(t,e,n){var r,i;if(!this.a.hasValidContext()){this.logger.warn(lp.MissingContextKeyNoEvent);return}n!==void 0&&!G.Number.is(n)&&((r=this.logger)==null||r.warn(lp.invalidMetricValue(typeof n))),(i=this.D)==null||i.sendEvent(this.e.trackEventModifier(this.N.customEvent(t,this.a.getContext(),e,n))),this.U.afterTrack({key:t,context:this.a.getUnwrappedContext(),data:e,metricValue:n})}pt(t,e,n,r){var i,o,s,a,c;let l=this.a.hasContext();l||(i=this.logger)==null||i.warn("Flag evaluation called before client is fully initialized, data from this evaulation could be stale.");let u=this.a.getContext(),h=this.E.get(t);if(h===void 0||h.flag.deleted){let v=e!=null?e:null;return(o=this.logger)==null||o.warn(`Unknown feature flag "${t}"; returning default value ${v}.`),l&&((s=this.D)==null||s.sendEvent(this.N.unknownFlagEvent(t,v,u))),ip(cp.FlagNotFound,e)}let{reason:p,value:f,variation:m,prerequisites:d}=h.flag;if(r){let[v,I]=r(f);if(!v){l&&((a=this.D)==null||a.sendEvent(n.evalEventClient(t,e,e,h.flag,u,p)));let R=new GS(`Wrong type "${I}" for feature flag "${t}"; returning default value`);return this.emitter.emit("error",this.a.getUnwrappedContext(),R),ip(cp.WrongType,e)}}let b=op(f,m,p);return f==null&&(this.logger.debug("Result value is null. Providing default value."),b.value=e),d==null||d.forEach(v=>{this.pt(v,void 0,this.N)}),l&&((c=this.D)==null||c.sendEvent(n.evalEventClient(t,f,e,h.flag,u,p))),b}variation(t,e){let{value:n}=this.U.withEvaluation(t,this.a.getUnwrappedContext(),e,()=>this.pt(t,e,this.N));return n}variationDetail(t,e){return this.U.withEvaluation(t,this.a.getUnwrappedContext(),e,()=>this.pt(t,e,this.ft))}_(t,e,n,r){return this.U.withEvaluation(t,this.a.getUnwrappedContext(),e,()=>this.pt(t,e,n,r))}boolVariation(t,e){return this._(t,e,this.N,n=>[G.Boolean.is(n),G.Boolean.getType()]).value}jsonVariation(t,e){return this.variation(t,e)}numberVariation(t,e){return this._(t,e,this.N,n=>[G.Number.is(n),G.Number.getType()]).value}stringVariation(t,e){return this._(t,e,this.N,n=>[G.String.is(n),G.String.getType()]).value}boolVariationDetail(t,e){return this._(t,e,this.ft,n=>[G.Boolean.is(n),G.Boolean.getType()])}numberVariationDetail(t,e){return this._(t,e,this.ft,n=>[G.Number.is(n),G.Number.getType()])}stringVariationDetail(t,e){return this._(t,e,this.ft,n=>[G.String.is(n),G.String.getType()])}jsonVariationDetail(t,e){return this.variationDetail(t,e)}addHook(t){this.U.addHook(t)}setEventSendingEnabled(t,e){var n,r,i,o;this.Vt!==t&&(this.Vt=t,t?(this.logger.debug("Starting event processor"),(n=this.D)==null||n.start()):e?((r=this.logger)==null||r.debug("Flushing event processor before disabling."),this.flush().then(()=>{var s,a;this.Vt||((s=this.logger)==null||s.debug("Stopping event processor."),(a=this.D)==null||a.close())})):((i=this.logger)==null||i.debug("Stopping event processor."),(o=this.D)==null||o.close()))}sendEvent(t){var e;(e=this.D)==null||e.sendEvent(t)}getDebugOverrides(){var t,e;return(e=(t=this.E).getDebugOverride)==null?void 0:e.call(t)}Ui(t,e){if(!this.Q.hasInspectors())return;let n={};t.forEach(r=>{let i=this.E.get(r);if(i!=null&&i.flag&&!i.flag.deleted){let{reason:o,value:s,variation:a}=i.flag;n[r]=op(s,a,o)}else n[r]={value:void 0,variationIndex:null}}),e==="init"?this.Q.onFlagsChanged(n):e==="patch"&&Object.entries(n).forEach(([r,i])=>{this.Q.onFlagChanged(r,i)})}};function qw(t,e,n){n.forEach(r=>{var i;try{(i=r.registerDebug)==null||i.call(r,e)}catch(o){t.error(`Exception thrown registering plugin ${de.safeGetName(t,r)}.`)}})}var tI=class{constructor(t,e,n){this.E=t,this.jt=e,this.t=n}async handlePut(t,e){this.t.debug(`Got PUT: ${Object.keys(e)}`);let n=Object.entries(e).reduce((r,[i,o])=>(r[i]={version:o.version,flag:o},r),{});await this.E.init(t,n),this.jt.requestStateUpdate(Kt.Valid)}async handlePatch(t,e){this.t.debug(`Got PATCH ${JSON.stringify(e,null,2)}`),this.E.upsert(t,e.key,{version:e.version,flag:e})}async handleDelete(t,e){this.t.debug(`Got DELETE ${JSON.stringify(e,null,2)}`),this.E.upsert(t,e.key,{version:e.version,flag:me(st({},e),{deleted:!0,flagVersion:0,value:void 0,variation:0,trackEvents:!1})})}handleStreamingError(t){this.jt.reportError(t.kind,t.message,t.code,t.recoverable)}handlePollingError(t){this.jt.reportError(t.kind,t.message,t.status,t.recoverable)}},eI=class{constructor(t,e=()=>Date.now()){this.Vi=t,this.gt=Kt.Closed,this.Le=e(),this.dt=e}get status(){return{state:this.gt,stateSince:this.Le,lastError:this.ji}}Ce(t,e=!1){let n=t===Kt.Interrupted&&this.gt===Kt.Initializing?Kt.Initializing:t,r=this.gt!==n;r&&(this.gt=n,this.Le=this.dt()),(r||e)&&this.Vi.emit("dataSourceStatus",this.status)}requestStateUpdate(t){this.Ce(t)}reportError(t,e,n,r=!1){let i={kind:t,message:e,statusCode:n,time:this.dt()};this.ji=i,this.Ce(r?Kt.Interrupted:Kt.Closed,!0)}};function up(t){t==null||t.debug("Poll completed after the processor was closed. Skipping processing.")}var nI=class{constructor(t,e,n,r,i){this.Hi=t,this.zi=e,this.Bi=n,this.m=r,this.t=i,this.u=!1}async Ie(){var t,e,n,r,i,o,s;if(this.u)return;let a=h=>{var p,f,m;(p=this.t)==null||p.error("Polling received invalid data"),(f=this.t)==null||f.debug(`Invalid JSON follows: ${h}`),(m=this.m)==null||m.call(this,new Fi(_t.InvalidData,"Malformed JSON data in polling response"))};(t=this.t)==null||t.debug("Polling LaunchDarkly for feature flag updates");let c=Date.now();try{let h=await this.Hi.requestPayload();try{if(this.u){up(this.t);return}let p=JSON.parse(h);try{(e=this.Bi)==null||e.call(this,p)}catch(f){(n=this.t)==null||n.error(`Exception from data handler: ${f}`)}}catch(p){a(h)}}catch(h){if(this.u){up(this.t);return}let p=h;if(p.status!==void 0&&!Ki(p.status)){(r=this.t)==null||r.error(Gn(h,"polling request")),(i=this.m)==null||i.call(this,new Fi(_t.ErrorResponse,p.message,p.status));return}(o=this.t)==null||o.error(Gn(h,"polling request","will retry"))}let l=Date.now()-c,u=Math.max(this.zi*1e3-l,0);(s=this.t)==null||s.debug("Elapsed: %d ms, sleeping for %d ms",l,u),this.Ht=setTimeout(()=>{this.Ie()},u)}start(){this.Ie()}stop(){this.Ht&&(clearTimeout(this.Ht),this.Ht=void 0),this.u=!0}close(){this.stop()}},rI=(t,e,n,r)=>{n==null||n.error(`Stream received invalid data in "${t}" message`),n==null||n.debug(`Invalid JSON follows: ${e}`),r==null||r(new Xa(_t.InvalidData,"Malformed JSON data in event stream"))};function iI(t,e){e==null||e.debug(`Received ${t} event after processor was closed. Skipping processing.`)}function hp(t){t==null||t.debug("Ping completed after processor was closed. Skipping processing.")}var oI=class{constructor(t,e,n,r,i,o,s,a,c){var l;this.Ki=t,this.zt=e,this.n=n,this.T=r,this.Gi=o,this.L=s,this.m=a,this.t=c,this.u=!1;let u;e.useReport&&!r.getEventSourceCapabilities().customMethod?u=e.paths.pathPing(i,t):u=e.useReport?e.paths.pathReport(i,t):e.paths.pathGet(i,t);let h=[...(l=e.queryParameters)!=null?l:[]];this.zt.withReasons&&h.push({key:"withReasons",value:"true"}),this.T=r,this.ht=st({},e.baseHeaders),this.t=c,this.Wi=NS(e.serviceEndpoints,u,h)}Ae(){this.mt=Date.now()}Bt(t){this.mt&&this.L&&this.L.recordStreamInit(this.mt,!t,Date.now()-this.mt),this.mt=void 0}Ar(t){var e,n,r;return Vp(t)?((r=this.t)==null||r.warn(Gn(t,"streaming request","will retry")),this.Bt(!1),this.Ae(),!0):(this.Bt(!1),(e=this.m)==null||e.call(this,new Xa(_t.ErrorResponse,t.message,t.status,!1)),(n=this.t)==null||n.error(Gn(t,"streaming request")),!1)}start(){this.Ae();let t;this.zt.useReport?(this.ht["content-type"]="application/json",t={method:"REPORT",body:this.Ki}):t={};let e=this.T.createEventSource(this.Wi,me(st({headers:this.ht},t),{errorFilter:n=>this.Ar(n),initialRetryDelayMillis:this.zt.initialRetryDelayMillis,readTimeoutMillis:300*1e3,retryResetIntervalMillis:60*1e3}));this.Pe=e,e.onclose=()=>{var n;(n=this.t)==null||n.info("Closed LaunchDarkly stream connection")},e.onerror=()=>{},e.onopen=()=>{var n;(n=this.t)==null||n.info("Opened LaunchDarkly stream connection")},e.onretrying=n=>{var r;(r=this.t)==null||r.info(`Will retry stream connection in ${n.delayMillis} milliseconds`)},this.n.forEach(({deserializeData:n,processJson:r},i)=>{e.addEventListener(i,o=>{var s,a;if(this.u){iI(i,this.t);return}if((s=this.t)==null||s.debug(`Received ${i} event`),o!=null&&o.data){this.Bt(!0);let{data:c}=o,l=n(c);if(!l){rI(i,c,this.t,this.m);return}r(l)}else(a=this.m)==null||a.call(this,new Xa(_t.InvalidData,"Unexpected payload from event stream"))})}),e.addEventListener("ping",async()=>{var n,r,i,o,s,a,c;(n=this.t)==null||n.debug("Got PING, going to poll LaunchDarkly for feature flag updates");try{let l=await this.Gi.requestPayload();try{if(this.u){hp(this.t);return}let u=JSON.parse(l);try{(r=this.n.get("put"))==null||r.processJson(u)}catch(h){(i=this.t)==null||i.error(`Exception from data handler: ${h}`)}}catch(u){(o=this.t)==null||o.error("Polling after ping received invalid data"),(s=this.t)==null||s.debug(`Invalid JSON follows: ${l}`),(a=this.m)==null||a.call(this,new Fi(_t.InvalidData,"Malformed JSON data in ping polling response"))}}catch(l){if(this.u){hp(this.t);return}let u=l;(c=this.m)==null||c.call(this,new Fi(_t.ErrorResponse,u.message,u.status))}})}stop(){var t;(t=this.Pe)==null||t.close(),this.Pe=void 0,this.u=!0}close(){this.stop()}},sI=class{constructor(t,e,n,r,i,o,s,a,c){this.platform=t,this.flagManager=e,this.credential=n,this.config=r,this.getPollingPaths=i,this.getStreamingPaths=o,this.baseHeaders=s,this.emitter=a,this.diagnosticsManager=c,this.closed=!1,this.logger=r.logger,this.dataSourceStatusManager=new eI(a),this.J=new tI(e,this.dataSourceStatusManager,this.config.logger)}setConnectionParams(t){this.Ji=t}createPollingProcessor(t,e,n,r,i){let o=new nI(n,this.config.pollInterval,async s=>{await this.J.handlePut(e,s),r==null||r()},s=>{this.emitter.emit("error",t,s),this.J.handlePollingError(s),i==null||i(s)},this.logger);this.updateProcessor=this.Oe(o,this.dataSourceStatusManager)}createStreamingProcessor(t,e,n,r,i){var o;let s=new oI(JSON.stringify(t),{credential:this.credential,serviceEndpoints:this.config.serviceEndpoints,paths:this.getStreamingPaths(),baseHeaders:this.baseHeaders,initialRetryDelayMillis:this.config.streamInitialReconnectDelay*1e3,withReasons:this.config.withReasons,useReport:this.config.useReport,queryParameters:(o=this.Ji)==null?void 0:o.queryParameters},this.createStreamListeners(e,r),this.platform.requests,this.platform.encoding,n,this.diagnosticsManager,a=>{this.emitter.emit("error",t,a),this.J.handleStreamingError(a),i==null||i(a)},this.logger);this.updateProcessor=this.Oe(s,this.dataSourceStatusManager)}createStreamListeners(t,e){let n=new Map;return n.set("put",{deserializeData:JSON.parse,processJson:async r=>{await this.J.handlePut(t,r),e==null||e()}}),n.set("patch",{deserializeData:JSON.parse,processJson:async r=>{this.J.handlePatch(t,r)}}),n.set("delete",{deserializeData:JSON.parse,processJson:async r=>{this.J.handleDelete(t,r)}}),n}Oe(t,e){return{start:()=>{e.requestStateUpdate(Kt.Initializing),t.start()},stop:()=>{t.stop(),e.requestStateUpdate(Kt.Closed)},close:()=>{t.close(),e.requestStateUpdate(Kt.Closed)}}}close(){var t;(t=this.updateProcessor)==null||t.close(),this.closed=!0}};function Bp(t,e){let n=Object.keys(e),r="$flagsState",i="$valid",o=e[r];!o&&n.length&&t.warn("LaunchDarkly client was initialized with bootstrap data that did not include flag metadata. Events may not be sent correctly."),e[i]===!1&&t.warn("LaunchDarkly bootstrap data is not available because the back end could not read the flags.");let s={};return n.forEach(a=>{if(a!==r&&a!==i){let c;o&&o[a]?c=st({value:e[a]},o[a]):c={value:e[a],version:0},s[a]={version:c.version,flag:c}}}),s}function _i(){return typeof document!==void 0}function Ya(){return typeof window!==void 0}function jp(t,e,n){return _i()?(document.addEventListener(t,e,n),()=>{document.removeEventListener(t,e,n)}):()=>{}}function Qp(t,e,n){return _i()?(window.addEventListener(t,e,n),()=>{window.removeEventListener(t,e,n)}):()=>{}}function yr(){return Ya()?window.location.href:""}function aI(){return Ya()?window.location.search:""}function lI(){return Ya()?window.location.hash:""}function cI(){if(typeof crypto!==void 0)return crypto;throw Error("Access to a web crypto API is required")}function uI(){return _i()?document.visibilityState:"visibile"}function hI(t){if(_i())return document.querySelectorAll(t)}var pI="[BrowserDataManager]",dI=class extends sI{constructor(t,e,n,r,i,o,s,a,c,l){super(t,e,n,r,o,s,a,c,l),this.ls=i,this.tt=void 0,this.Kt=!1,this.tt=i.streaming}C(t,...e){this.logger.debug(`${pI} ${t}`,...e)}async identify(t,e,n,r){if(this.closed){this.C("Identify called after data manager was closed.");return}this.context=n;let i=r;i!=null&&i.hash?this.setConnectionParams({queryParameters:[{key:"h",value:i.hash}]}):this.setConnectionParams(),this.Gt=i==null?void 0:i.hash,i!=null&&i.bootstrap?this.qi(n,i.bootstrap,t):(await this.flagManager.loadCached(n)&&this.C("Identify - Flags loaded from cache. Continuing to initialize via a poll."),await this.Yi(n,t,e)),this.Wt()}async Zi(t){let e=JSON.stringify(xn.toLDContext(t)),n=tp(e,this.config.serviceEndpoints,this.getPollingPaths(),this.platform.requests,this.platform.encoding,this.baseHeaders,[],this.config.withReasons,this.config.useReport,this.Gt),r=3,i;for(let o=0;o<=r;o+=1)try{return await n.requestPayload()}catch(s){if(!Vp(s))throw s;i=s,o<r&&(this.C(Gn(s,"initial poll request","will retry")),await xp(1e3))}throw i}async Yi(t,e,n){var r,i;try{this.dataSourceStatusManager.requestStateUpdate(Kt.Initializing);let o=await this.Zi(t);try{let s=this.createStreamListeners(t,e).get("put");s.processJson(s.deserializeData(o))}catch(s){this.dataSourceStatusManager.reportError(_t.InvalidData,(r=s.message)!=null?r:"Could not parse poll response")}}catch(o){this.dataSourceStatusManager.reportError(_t.NetworkError,(i=o.message)!=null?i:"unexpected network error",o.status),n(o)}}qi(t,e,n){this.flagManager.setBootstrap(t,Bp(this.logger,e)),this.C("Identify - Initialization completed from bootstrap"),n()}setForcedStreaming(t){this.tt=t,this.Wt()}setAutomaticStreamingState(t){this.Kt=t,this.Wt()}Wt(){let t=this.tt||this.Kt&&this.tt===void 0;this.C(`Updating streaming state. forced(${this.tt}) automatic(${this.Kt})`),t?this.Xi():this.Qi()}Qi(){var t;this.updateProcessor&&this.C("Stopping update processor."),(t=this.updateProcessor)==null||t.close(),this.updateProcessor=void 0}Xi(){if(this.updateProcessor){this.C("Update processor already active. Not changing state.");return}if(!this.context){this.C("Context not set, not starting update processor.");return}this.C("Starting update processor."),this.ts(this.context)}ts(t,e,n){var r;let i=xn.toLDContext(t);(r=this.updateProcessor)==null||r.close();let o=JSON.stringify(xn.toLDContext(t)),s=tp(o,this.config.serviceEndpoints,this.getPollingPaths(),this.platform.requests,this.platform.encoding,this.baseHeaders,[],this.config.withReasons,this.config.useReport,this.Gt);this.createStreamingProcessor(i,t,s,e,n),this.updateProcessor.start()}};function fI(t){let e=jp("visibilitychange",()=>{uI()==="hidden"&&t()}),n=Qp("pagehide",t);return()=>{e(),n()}}function Na(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function mI(t,e,n,r){let i=((t.kind==="substring"||t.kind==="regex")&&r.includes("/")?e:e.replace(r,"")).replace(n,"");switch(t.kind){case"exact":return new RegExp(`^${Na(t.url)}/?$`).test(e);case"canonical":return new RegExp(`^${Na(t.url)}/?$`).test(i);case"substring":return new RegExp(`.*${Na(t.substring)}.*$`).test(i);case"regex":return new RegExp(t.pattern).test(i);default:return!1}}function yI(t,e){let n=[];return e.forEach(r=>{let i=t.target,{selector:o}=r,s=hI(o);for(;i&&s!=null&&s.length;){for(let a=0;a<s.length;a+=1)if(i===s[a]){n.push(r);break}i=i.parentNode}}),n}var gI=class{constructor(t,e){let n=t.filter(o=>{var s;return(s=o.urls)==null?void 0:s.some(a=>mI(a,yr(),aI(),lI()))}),r=n.filter(o=>o.kind==="pageview"),i=n.filter(o=>o.kind==="click");if(r.forEach(o=>e(o)),i.length){let o=s=>{yI(s,i).forEach(a=>{e(a)})};this.Te=jp("click",o)}}close(){var t;(t=this.Te)==null||t.call(this)}},bI=300,vI=class{constructor(t){this.No=yr();let e=()=>{let r=yr();r!==this.No&&(this.No=r,t())};this.Jt=setInterval(e,bI);let n=Qp("popstate",e);this.$e=()=>{n()}}close(){var t;this.Jt&&clearInterval(this.Jt),(t=this.$e)==null||t.call(this)}},SI=class{constructor(t,e,n,r,i,o=s=>new vI(s)){this.T=e,this.ns=r,this.ss=i,this.yt=[],this.Re=!1,this.vt=`${n}/sdk/goals/${t}`,this.Ne=o(()=>{this.Yt()})}async initialize(){await this.es(),this.Yt()}startTracking(){this.Re=!0,this.Yt()}Yt(){var t;this.Re&&((t=this.qt)==null||t.close(),this.yt&&this.yt.length&&(this.qt=new gI(this.yt,e=>{this.ss(yr(),e)})))}async es(){try{let t=await this.T.fetch(this.vt);this.yt=await t.json()}catch(t){this.ns(new Cp(`Encountered error fetching goals: ${t}`))}}close(){var t,e;(t=this.Ne)==null||t.close(),(e=this.qt)==null||e.close()}};function wI(t){return t.kind==="click"}var II=2,$p={fetchGoals:!0,eventUrlTransformer:t=>t,streaming:void 0,plugins:[]},TI={fetchGoals:G.Boolean,eventUrlTransformer:G.Function,streaming:G.Boolean,plugins:G.createTypeArray("LDPlugin",{})};function EI(t){var e;let n=st({},t);return(e=n.flushInterval)!=null||(n.flushInterval=II),n}function RI(t){let e=EI(t);return Object.keys($p).forEach(n=>{delete e[n]}),e}function CI(t,e){let n=st({},$p);return Object.entries(TI).forEach(r=>{let[i,o]=r,s=t[i];s!==void 0&&(o.is(s)?n[i]=s:e.warn(Ue.wrongOptionType(i,o.getType(),typeof s)))}),n}var ZI=class{constructor(t,e){switch(this.rs=t,this.Me=[],e){case"sha1":this.Zt="SHA-1";break;case"sha256":this.Zt="SHA-256";break;default:throw new Error(`Algorithm is not supported ${e}`)}}async asyncDigest(t){let e=this.Me.join(""),n=new TextEncoder().encode(e),r=await this.rs.subtle.digest(this.Zt,n);switch(t){case"base64":return btoa(String.fromCharCode(...new Uint8Array(r)));case"hex":return[...new Uint8Array(r)].map(i=>i.toString(16).padStart(2,"0")).join("");default:throw new Error(`Encoding is not supported ${t}`)}}update(t){return this.Me.push(t),this}},kI={start:0,end:3},VI={start:4,end:5},Oa={start:6,end:7},Ga={start:8,end:8},xI={start:9,end:9},NI={start:10,end:15};function OI(){if(crypto&&crypto.getRandomValues){let e=new Uint8Array(16);return crypto.getRandomValues(e),[...e.values()]}let t=[];for(let e=0;e<16;e+=1)t.push(Math.floor(Math.random()*256));return t}function kn(t,e){let n="";for(let r=e.start;r<=e.end;r+=1)n+=t[r].toString(16).padStart(2,"0");return n}function GI(t){return t[Ga.start]=(t[Ga.start]|128)&191,t[Oa.start]=t[Oa.start]&15|64,`${kn(t,kI)}-${kn(t,VI)}-${kn(t,Oa)}-${kn(t,Ga)}${kn(t,xI)}-${kn(t,NI)}`}function LI(){let t=OI();return GI(t)}function XI(){return typeof crypto!==void 0&&typeof crypto.randomUUID=="function"?crypto.randomUUID():LI()}var WI=class{createHash(t){return new ZI(cI(),t)}randomUUID(){return XI()}};function UI(t){let e=Array.from(t,n=>String.fromCodePoint(n)).join("");return btoa(e)}var MI=class{btoa(t){return UI(new TextEncoder().encode(t))}},PI=class{constructor(t){this.e=t}platformData(){return{name:"JS"}}sdkData(){let t={name:"@launchdarkly/js-client-sdk",version:"0.13.0",userAgentBase:"JSClient"};return this.e.wrapperName&&(t.wrapperName=this.e.wrapperName),this.e.wrapperVersion&&(t.wrapperVersion=this.e.wrapperVersion),t}},FI=class{constructor(t,e){this.vt=t,this.n={},this.A=new SS(e.initialRetryDelayMillis,e.retryResetIntervalMillis),this.Fe=e.errorFilter,this.Ue()}Ue(){this.q=new EventSource(this.vt),this.q.onopen=()=>{var t;this.A.success(),(t=this.onopen)==null||t.call(this)},this.q.onerror=t=>{var e;this.as(t),(e=this.onerror)==null||e.call(this,t)},Object.entries(this.n).forEach(([t,e])=>{e.forEach(n=>{var r;(r=this.q)==null||r.addEventListener(t,n)})})}addEventListener(t,e){var n,r,i;(r=(n=this.n)[t])!=null||(n[t]=[]),this.n[t].push(e),(i=this.q)==null||i.addEventListener(t,e)}close(){var t,e;clearTimeout(this.Xt),this.Xt=void 0,(t=this.q)==null||t.close(),(e=this.onclose)==null||e.call(this)}cs(t){var e;(e=this.onretrying)==null||e.call(this,{delayMillis:t}),this.Xt=setTimeout(()=>{this.Ue()},t)}as(t){this.close(),!(t.status&&typeof t.status=="number"&&!this.Fe(t))&&this.cs(this.A.fail())}},AI=class{fetch(t,e){return fetch(t,e)}createEventSource(t,e){return new FI(t,e)}getEventSourceCapabilities(){return{customMethod:!1,readTimeout:!1,headers:!1}}};function qp(){return typeof localStorage!="undefined"}function JI(){if(!qp())return[];let t=[];for(let e=0;e<localStorage.length;e+=1){let n=localStorage.key(e);n&&t.push(n)}return t}var DI=class{constructor(t){this.t=t}async clear(t){var e;try{localStorage.removeItem(t)}catch(n){(e=this.t)==null||e.error(`Error clearing key from localStorage: ${t}, reason: ${n}`)}}async get(t){var e;try{let n=localStorage.getItem(t);return n!=null?n:null}catch(n){return(e=this.t)==null||e.error(`Error getting key from localStorage: ${t}, reason: ${n}`),null}}async set(t,e){var n;try{localStorage.setItem(t,e)}catch(r){(n=this.t)==null||n.error(`Error setting key in localStorage: ${t}, reason: ${r}`)}}},YI=class{constructor(t,e){this.encoding=new MI,this.crypto=new WI,this.requests=new AI,qp()&&(this.storage=new DI(t)),this.info=new PI(e)}},KI=class extends $w{constructor(t,e,n={},r){var i;let{logger:o,debug:s}=n,a=o!=null?o:new Pa({destination:{debug:console.debug,info:console.info,warn:console.warn,error:console.error},level:s?"debug":"info"}),c=(i=n.baseUri)!=null?i:"https://clientsdk.launchdarkly.com",l=r!=null?r:new YI(a,n),u=CI(n,a),h=RI(me(st({},n),{logger:a})),{eventUrlTransformer:p}=u;super(t,e,l,h,(f,m,d,b,v)=>new dI(l,f,t,m,u,()=>({pathGet(I,R){return`/sdk/evalx/${t}/contexts/${jh(R,I)}`},pathReport(I,R){return`/sdk/evalx/${t}/context`},pathPing(I,R){throw new Error("Ping for polling unsupported.")}}),()=>({pathGet(I,R){return`/eval/${t}/${jh(R,I)}`},pathReport(I,R){return`/eval/${t}`},pathPing(I,R){return`/ping/${t}`}}),d,b,v),{getLegacyStorageKeys:()=>JI().filter(f=>f.startsWith(`ld:${t}:`)),analyticsEventPath:`/events/bulk/${t}`,diagnosticEventPath:`/events/diagnostic/${t}`,includeAuthorizationHeader:!1,highTimeoutThreshold:5,userAgentHeaderName:"x-launchdarkly-user-agent",trackEventModifier:f=>new de.InputCustomEvent(f.context,f.key,f.data,f.metricValue,f.samplingRatio,p(yr())),getImplementationHooks:f=>de.safeGetHooks(a,f,u.plugins),credentialType:"clientSideId"}),this.setEventSendingEnabled(!0,!1),this.te=u.plugins,u.fetchGoals&&(this.Qt=new SI(t,l.requests,c,f=>{a.error(f.message)},(f,m)=>{let d=this.getInternalContext();if(!d)return;let b=p(f);wI(m)?this.sendEvent({kind:"click",url:b,samplingRatio:1,key:m.key,creationDate:Date.now(),context:d,selector:m.selector}):this.sendEvent({kind:"pageview",url:b,samplingRatio:1,key:m.key,creationDate:Date.now(),context:d})}),this.Qt.initialize(),u.automaticBackgroundHandling&&fI(()=>this.flush()))}registerPlugins(t){de.safeRegisterPlugins(this.logger,this.environmentMetadata,t,this.te||[]);let e=this.getDebugOverrides();e&&qw(this.logger,e,this.te||[])}setInitialContext(t){this.ee=t}async identify(t,e){return super.identify(t,e)}async identifyResult(t,e){var n;if(!this.et)return this.logger.error("Client must be started before it can identify a context, did you forget to call start()?"),{status:"error",error:new Error("Identify called before start")};let r=st({},e);(e==null?void 0:e.sheddable)===void 0&&(r.sheddable=!0);let i=await super.identifyResult(t,r);return(n=this.Qt)==null||n.startTracking(),i}start(t){var e,n;if(this.initializeResult)return Promise.resolve(this.initializeResult);if(this.et)return this.et;if(!this.ee)return this.logger.error("Initial context not set"),Promise.resolve({status:"failed",error:new Error("Initial context not set")});let r=me(st({},(e=t==null?void 0:t.identifyOptions)!=null?e:{}),{sheddable:!1});if(t!=null&&t.bootstrap&&!r.bootstrap&&(r.bootstrap=t.bootstrap),r!=null&&r.bootstrap)try{let i=Bp(this.logger,r.bootstrap);this.presetFlags(i)}catch(i){this.logger.error("Failed to bootstrap data",i)}return this.initializedPromise||(this.initializedPromise=new Promise(i=>{this.initResolve=i})),this.et=this.promiseWithTimeout(this.initializedPromise,(n=t==null?void 0:t.timeout)!=null?n:5),this.identifyResult(this.ee,r),this.et}setStreaming(t){this.dataManager.setForcedStreaming(t)}Ve(){this.dataManager.setAutomaticStreamingState(!!this.emitter.listenerCount("change"))}on(t,e){super.on(t,e),this.Ve()}off(t,e){super.off(t,e),this.Ve()}};function _I(t,e,n,r={},i){let o=new KI(t,n,r,i);o.setInitialContext(e);let s={variation:(a,c)=>o.variation(a,c),variationDetail:(a,c)=>o.variationDetail(a,c),boolVariation:(a,c)=>o.boolVariation(a,c),boolVariationDetail:(a,c)=>o.boolVariationDetail(a,c),numberVariation:(a,c)=>o.numberVariation(a,c),numberVariationDetail:(a,c)=>o.numberVariationDetail(a,c),stringVariation:(a,c)=>o.stringVariation(a,c),stringVariationDetail:(a,c)=>o.stringVariationDetail(a,c),jsonVariation:(a,c)=>o.jsonVariation(a,c),jsonVariationDetail:(a,c)=>o.jsonVariationDetail(a,c),track:(a,c,l)=>o.track(a,c,l),on:(a,c)=>o.on(a,c),off:(a,c)=>o.off(a,c),flush:()=>o.flush(),setStreaming:a=>o.setStreaming(a),identify:(a,c)=>o.identifyResult(a,c),getContext:()=>o.getContext(),close:()=>o.close(),allFlags:()=>o.allFlags(),addHook:a=>o.addHook(a),waitForInitialization:a=>o.waitForInitialization(a),logger:o.logger,start:a=>o.start(a)};return o.registerPlugins(s),s}function YF(t){return new Pa(t)}function td(t,e,n){return _I(t,e,Ai.Disabled,n)}var HI=Object.defineProperty,zI=(t,e,n)=>e in t?HI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Te=(t,e,n)=>zI(t,typeof e!="symbol"?e+"":e,n),BI=(t,e,n)=>new Promise((r,i)=>{var o=c=>{try{a(n.next(c))}catch(l){i(l)}},s=c=>{try{a(n.throw(c))}catch(l){i(l)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(o,s);a((n=n.apply(t,e)).next())}),ke=(t,e,...n)=>{let r=`[@launchdarkly plugins]: (${t}): `;console[e].apply(console,[r,...n]),jI(r,...n)},jI=(t,...e)=>BI(void 0,null,function*(){try{let{LDObserve:n}=yield Promise.resolve().then(()=>eR);n.recordLog(`${t}${e}`,"warn")}catch(n){}}),QI=class{constructor(t,e){Te(this,"debug"),Te(this,"name"),this.debug=t,this.name=e}log(...t){if(this.debug){let e=`[${Date.now()}]`;this.name&&(e+=` - ${this.name}`),console.log.apply(console,[e,...t])}}warn(...t){let e=`[${Date.now()}]`;this.name&&(e+=` - ${this.name}`),console.warn.apply(console,[e,...t])}},vo=class{constructor(){Te(this,"_sdk"),Te(this,"_isLoaded",!1),Te(this,"_callBuffer",[]),Te(this,"_capacity",1e5),Te(this,"_droppedEvents",0),Te(this,"_exceededCapacity",!1),Te(this,"_logger",new QI)}h(e,n){if(this.Ln)try{return this.qn[e](...n)}catch(r){ke(`Error executing buffered call to ${e}:`,"error",r)}else{this.Jr({method:e,args:n});return}}Jr(e){this.En.length<this.Ys?(this.En.push(e),this.tr=!1):(this.tr||(this.tr=!0,ke("Exceeded event queue capacity. Increase capacity to avoid dropping events.","warn")),this.Ks+=1)}load(e){this.qn=e,this.Ln=!0;for(let{method:n,args:r}of this.En)try{this.qn[n](...r)}catch(i){ke(`Error executing buffered call to ${n}:`,"error",i)}this.En=[]}},$I=Object.defineProperty,qI=Object.defineProperties,tT=Object.getOwnPropertyDescriptors,So=Object.getOwnPropertySymbols,Mf=Object.prototype.hasOwnProperty,Pf=Object.prototype.propertyIsEnumerable,Zl=(t,e,n)=>e in t?$I(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,j=(t,e)=>{for(var n in e||(e={}))Mf.call(e,n)&&Zl(t,n,e[n]);if(So)for(var n of So(e))Pf.call(e,n)&&Zl(t,n,e[n]);return t},An=(t,e)=>qI(t,tT(e)),xr=(t,e)=>{var n={};for(var r in t)Mf.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&So)for(var r of So(t))e.indexOf(r)<0&&Pf.call(t,r)&&(n[r]=t[r]);return n},Wr=(t,e,n)=>Zl(t,typeof e!="symbol"?e+"":e,n),Dn=(t,e,n)=>new Promise((r,i)=>{var o=c=>{try{a(n.next(c))}catch(l){i(l)}},s=c=>{try{a(n.throw(c))}catch(l){i(l)}},a=c=>c.done?r(c.value):Promise.resolve(c.value).then(o,s);a((n=n.apply(t,e)).next())});function eT(t,e){for(var n=0;n<e.length;n++){let r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(let i in r)if(i!=="default"&&!(i in t)){let o=Object.getOwnPropertyDescriptor(r,i);o&&Object.defineProperty(t,i,o.get?o:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function lo(t,e){throw new Error(e)}function nT(t){return typeof t=="object"&&t!==null}function rT(t,e){throw new Error("Unexpected invariant triggered.")}var iT=/\r\n|[\n\r]/g;function kl(t,e){let n=0,r=1;for(let i of t.body.matchAll(iT)){if(typeof i.index=="number"||rT(),i.index>=e)break;n=i.index+i[0].length,r+=1}return{line:r,column:e+1-n}}function oT(t){return Ff(t.source,kl(t.source,t.start))}function Ff(t,e){let n=t.locationOffset.column-1,r="".padStart(n)+t.body,i=e.line-1,o=t.locationOffset.line-1,s=e.line+o,a=e.line===1?n:0,c=e.column+a,l=`${t.name}:${s}:${c}
349
349
  `,u=r.split(/\r\n|[\n\r]/g),h=u[i];if(h.length>120){let p=Math.floor(c/80),f=c%80,m=[];for(let d=0;d<h.length;d+=80)m.push(h.slice(d,d+80));return l+ed([[`${s} |`,m[0]],...m.slice(1,p+1).map(d=>["|",d]),["|","^".padStart(f)],["|",m[p+1]]])}return l+ed([[`${s-1} |`,u[i-1]],[`${s} |`,h],["|","^".padStart(c)],[`${s+1} |`,u[i+1]]])}function ed(t){let e=t.filter(([r,i])=>i!==void 0),n=Math.max(...e.map(([r])=>r.length));return e.map(([r,i])=>r.padStart(n)+(i?" "+i:"")).join(`
350
350
  `)}function sT(t){let e=t[0];return e==null||"kind"in e||"length"in e?{nodes:e,source:t[1],positions:t[2],path:t[3],originalError:t[4],extensions:t[5]}:e}var aT=class Af extends Error{constructor(e,...n){var r,i,o;let{nodes:s,source:a,positions:c,path:l,originalError:u,extensions:h}=sT(n);super(e),this.name="GraphQLError",this.path=l!=null?l:void 0,this.originalError=u!=null?u:void 0,this.nodes=nd(Array.isArray(s)?s:s?[s]:void 0);let p=nd((r=this.nodes)===null||r===void 0?void 0:r.map(m=>m.loc).filter(m=>m!=null));this.source=a!=null?a:p==null||(i=p[0])===null||i===void 0?void 0:i.source,this.positions=c!=null?c:p==null?void 0:p.map(m=>m.start),this.locations=c&&a?c.map(m=>kl(a,m)):p==null?void 0:p.map(m=>kl(m.source,m.start));let f=nT(u==null?void 0:u.extensions)?u==null?void 0:u.extensions:void 0;this.extensions=(o=h!=null?h:f)!==null&&o!==void 0?o:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),u!=null&&u.stack?Object.defineProperty(this,"stack",{value:u.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,Af):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let e=this.message;if(this.nodes)for(let n of this.nodes)n.loc&&(e+=`
351
351