@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/CHANGELOG.md +9 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/package.json +2 -2
package/dist/index.cjs
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 jv(t){return t.map(e=>(e.nodes&&(e.nodes=jv(e.nodes)),delete e.source,e))}function Qv(t){if(t[_v]=!1,t.proxyOf.nodes)for(let e of t.proxyOf.nodes)Qv(e)}function pM(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__:IM.prototype});s.map&&(s.map=Yt(z({},s.map),{__proto__:TM.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 EM(i);if(i.type==="decl")return new wM(i);if(i.type==="rule")return new RM(i);if(i.type==="comment")return new SM(i);if(i.type==="atrule")return new vM(i);throw new Error("Unknown node type: "+t.type)}function zM(t){for(let e=t.length-1;e>=0;e--){let n=t[e],r=n[3]||n[2];if(r)return r}}function ea(t,e){let n=new $M(t,e),r=new qM(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 m0(t){let e=!1,n=cP[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 $g(t){let e;return t.type==="document"?e=["Document",hr,"DocumentExit"]:t.type==="root"?e=["Root",hr,"RootExit"]:e=m0(t),{eventIndex:0,events:e,iterator:0,node:t,visitorIndex:0,visitors:[]}}function Yu(t){return t[we]=!1,t.nodes&&t.nodes.forEach(e=>Yu(e)),t}function pt(...t){return t.length===1&&Array.isArray(t[0])&&(t=t[0]),new Oh(t)}function Gh(t){if(Ss[t])return Ss[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 tb?tb[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&&!LP())return Ss[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?Ss[t]=l:n}catch(a){return n}}function $e(t,e,n){var r;let i=`${t}.${String(n)}`;if(zc[i])return zc[i].call(e);let o=Gh(t),s=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return s?(zc[i]=s,s.call(e)):e[n]}function E0(t,e,n){let r=`${t}.${String(n)}`;if(Bc[r])return Bc[r].bind(e);let i=Gh(t)[n];return typeof i!="function"?e[n]:(Bc[r]=i,i.bind(e))}function XP(t){return $e("Node",t,"childNodes")}function WP(t){return $e("Node",t,"parentNode")}function UP(t){return $e("Node",t,"parentElement")}function MP(t){return $e("Node",t,"textContent")}function PP(t,e){return E0("Node",t,"contains")(e)}function FP(t){return E0("Node",t,"getRootNode")()}function AP(t){return!t||!("host"in t)?null:$e("ShadowRoot",t,"host")}function JP(t){return t.styleSheets}function DP(t){return!t||!("shadowRoot"in t)?null:$e("Element",t,"shadowRoot")}function YP(t,e){return $e("Element",t,"querySelector")(e)}function KP(t,e){return $e("Element",t,"querySelectorAll")(e)}function R0(){return Gh("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 Sa(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)}}),()=>Sa(t,e,o||{},!0)}function C0(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 Z0(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function k0(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function V0(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=V0(t);if(!i)return!1;try{if(typeof e=="string"){if(i.classList.contains(e)||r&&i.closest("."+e)!==null)return!0}else if(Hs(i,e,r))return!0}catch(o){}return!!(n&&(i.matches(n)||r&&i.closest(n)!==null))}function HP(t,e){return e.getId(t)!==-1}function jc(t,e,n){return t.tagName==="TITLE"&&n.headTitleMutations?!0:e.getId(t)===mi}function x0(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?x0(r,e):!0}function zu(t){return!!t.changedTouches}function zP(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 N0(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function O0(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function Bu(t){return t?t instanceof Hu&&"shadowRoot"in t?!!t.shadowRoot:!!q.shadowRoot(t):!1}function G0(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 BP(t){let e=t,n;for(;n=G0(e);)e=n;return e}function jP(t){let e=t.ownerDocument;if(!e)return!1;let n=BP(t);return q.contains(e,n)}function L0(t){let e=t.ownerDocument;return e?q.contains(e,t)||jP(t):!1}function nb(t){return"__ln"in t}function qu(t,e){t.delete(e),q.childNodes(e).forEach(n=>qu(t,n))}function QP(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 ib(t,e,n){return t.size===0?!1:$P(t,e)}function $P(t,e,n){let r=q.parentNode(e);return r?t.has(r):!1}function ob(t,e){return t.size===0?!1:W0(t,e)}function W0(t,e){let n=q.parentNode(e);return n?t.has(n)?!0:W0(t,n):!1}function qP(t){hi=t}function tF(){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 U0(t,e){let n=new $u;Tn.push(n),n.init(t);let r=new(R0())(nt(n.processMutations.bind(n)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function eF({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}=zu(h)?h.changedTouches[0]:h;a||(a=na()),s.push({x:f,y:m,id:r.getId(p),timeOffset:na()-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 nF({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)||_P(p))return;let f=null,m=u;if("pointerType"in h){switch(h.pointerType){case"mouse":f=He.Mouse;break;case"touch":f=He.Touch;break;case"pen":f=He.Pen;break}f===He.Touch&&(Jt[u]===Jt.MouseDown?m="TouchStart":Jt[u]===Jt.MouseUp&&(m="TouchEnd"))}else zu(h)&&(f=He.Touch);f!==null?(c=f,(m.startsWith("Touch")&&f===He.Touch||m.startsWith("Mouse")&&f===He.Mouse)&&(f=null)):Jt[u]===Jt.Click&&(f=c,c=null);let d=zu(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 M0({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=C0(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 rF({viewportResizeCb:t},{win:e}){let n=-1,r=-1,i=nt(Ei(nt(()=>{let o=Z0(),s=k0();(n!==o||r!==s)&&(t({width:Number(s),height:Number(o)}),n=o,r=s)}),200));return Pt("resize",i,e)}function oF({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||iF.indexOf(E)<0||Nt(I,r,i,!0)||I.classList.contains(o)||s&&I.matches(s))return;let T=I.value,V=!1,N=Ys(I)||"",U=I.getAttribute("data-hl-record");N==="radio"||N==="checkbox"?V=I.checked:qb({maskInputOptions:a,type:N,tagName:E,overwriteRecord:U})&&(T=Ds({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=sb.get(v);if(!R||R.text!==I.text||R.isChecked!==I.isChecked){sb.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=>Sa(v[0],v[1],{set(){nt(h)({target:this,isTrusted:!1})}},!1,m))),nt(()=>{f.forEach(v=>v())})}function ra(t){let e=[];function n(r,i){if(ws("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||ws("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||ws("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||ws("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 ze(t,e,n){let r,i;return t?(t.ownerNode?r=e.getId(t.ownerNode):i=n.getId(t),{styleId:i,id:r}):{}}function sF({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}=ze(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}=ze(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}=ze(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}=ze(h,e,n.styleMirror);return(m&&m!==-1||d&&d!==-1)&&t({id:m,styleId:d,replaceSync:f}),u.apply(h,p)})}));let c={};Is("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(Is("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),Is("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),Is("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}=ze(f.parentStyleSheet,e,n.styleMirror);return(v&&v!==-1||I&&I!==-1)&&t({id:v,styleId:I,adds:[{rule:d,index:[...ra(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}=ze(f.parentStyleSheet,e,n.styleMirror);return(b&&b!==-1||v&&v!==-1)&&t({id:b,styleId:v,removes:[{index:[...ra(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 P0({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 aF({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}=ze((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:ra(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}=ze((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:ra(c.parentRule)}),a.apply(c,l)})}),nt(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}function lF({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 cF({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 uF(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 hF({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 pF(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 dF(t,e={}){let n=t.doc.defaultView;if(!n)return()=>{};pF(t,e);let r;t.recordDOM&&(r=U0(t,t.doc));let i=eF(t),o=nF(t),s=M0(t),a=rF(t,{win:n}),c=oF(t),l=lF(t),u=()=>{},h=()=>{},p=()=>{},f=()=>{};t.recordDOM&&(u=sF(t,{win:n}),h=P0(t,t.doc),p=aF(t,{win:n}),t.collectFonts&&(f=cF(t)));let m=uF(t),d=hF(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 ws(t){return typeof window[t]<"u"}function Is(t){return!!(typeof window[t]<"u"&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}function yF(t,e){let n=ab.get(t);return n||(n=new Map,ab.set(t,n)),n.has(e)||n.set(e,[]),n.get(e)}function Gs(t,e,n){if(t instanceof Array)return t.map(r=>Gs(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=mF(t);return{rr_type:r,base64:i}}else{if(t instanceof DataView)return{rr_type:t.constructor.name,args:[Gs(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:[Gs(t.data,e,n),t.width,t.height]};if(J0(t,e)||typeof t=="object"){let r=t.constructor.name,i=F0(t,e,n);return{rr_type:r,index:i}}}}return t}function gF(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=A0(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=Sa(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 bF(t){return t==="experimental-webgl"?"webgl":t}function lb(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=bF(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 cb(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(F0(p,o,this),"tagName"in this.canvas&&!Nt(this.canvas,r,i,!0)){let f=A0(h,o,this),m={type:e,property:c,args:f};n(this.canvas,m)}return p}});s.push(l)}catch(l){let u=Sa(t,c,{set(h){n(this.canvas,{type:e,property:c,args:[h],setter:!0})}});s.push(u)}return s}function vF(t,e,n,r){let i=[];return i.push(...cb(e.WebGLRenderingContext.prototype,dr.WebGL,t,n,r,e)),typeof e.WebGL2RenderingContext<"u"&&i.push(...cb(e.WebGL2RenderingContext.prototype,dr.WebGL2,t,n,r,e)),()=>{i.forEach(o=>o())}}function wF(t){let e;try{if(e=ub&&(self.URL||self.webkitURL).createObjectURL(ub),!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)}}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=hh,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:_0,logger:H0}=t,Oi=z(z({},t.dataURLOptions),(n=(e=t.sampling)==null?void 0:e.canvas)==null?void 0:n.dataURLOptions);qP(_0);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 wa=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},Ia=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||{};zP();let Lh,Ta=0,Xh=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=na(),(gt=Tn[0])!=null&>.isFrozen()&&bt.type!==rt.FullSnapshot&&!(bt.type===rt.IncrementalSnapshot&&bt.data.source===et.Mutation)&&Tn.forEach(pe=>pe.unfreeze()),Gi)l==null||l(Xh(bt),oe);else if(mr){let pe={type:"rrweb",event:Xh(bt),origin:window.location.origin,isCheckout:oe};window.parent.postMessage(pe,"*")}if(bt.type===rt.FullSnapshot)Lh=bt,Ta=0;else if(bt.type===rt.IncrementalSnapshot){if(bt.data.source===et.Mutation&&bt.data.isAttachIframe)return;Ta++;let pe=h&&Ta>=h,dt=u&&bt.timestamp-Lh.timestamp>u;(pe||dt)&&Ls(!0)}};let Li=st=>{vt({type:rt.IncrementalSnapshot,data:z({source:et.Mutation},st)})},Wh=st=>vt({type:rt.IncrementalSnapshot,data:z({source:et.Scroll},st)}),Uh=st=>vt({type:rt.IncrementalSnapshot,data:z({source:et.CanvasMutation},st)}),z0=st=>vt({type:rt.IncrementalSnapshot,data:z({source:et.AdoptedStyleSheet},st)}),qe=new rh({mutationCb:Li,adoptedStyleSheetCb:z0}),tn=new th({mirror:ce,mutationCb:Li,stylesheetManager:qe,recordCrossOriginIframes:y,wrappedEmit:vt});for(let st of it||[])st.getMirror&&st.getMirror({nodeMirror:ce,crossOriginIframeMirror:tn.crossOriginIframeMirror,crossOriginIframeStyleMirror:tn.crossOriginIframeStyleMirror});let Ea=new ih;pi=new nh({recordCanvas:lt,recordLocalVideos:P,recordRemoteVideos:O,mutationCb:Uh,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:H0});let Xi=new eh({mutationCb:Li,scrollCb:Wh,bypassOptions:{blockClass:p,blockSelector:f,maskTextClass:b,maskTextSelector:v,inlineStylesheet:I,maskInputOptions:wa,dataURLOptions:Oi,maskTextFn:N,maskInputFn:V,recordCanvas:lt,inlineImages:P,inlineVideos:O,privacySetting:Ot,sampling:x,slimDOMOptions:Ia,iframeManager:tn,stylesheetManager:qe,canvasManager:pi,keepIframeSrcFn:ct,processedNodeManager:Ea},mirror:ce});Ls=(st=!1)=>{if(!ot)return;vt({type:rt.Meta,data:{href:window.location.href,width:k0(),height:Z0()}},st),qe.reset(),Xi.init(),Tn.forEach(gt=>gt.lock());let oe=e2(document,{mirror:ce,blockClass:p,blockSelector:f,maskTextClass:b,maskTextSelector:v,inlineStylesheet:I,maskAllInputs:wa,maskTextFn:N,maskInputFn:V,slimDOM:Ia,dataURLOptions:Oi,recordCanvas:lt,inlineImages:P,inlineVideos:O,privacySetting:Ot,onSerialize:gt=>{N0(gt,ce)&&tn.addIframe(gt),O0(gt,ce)&&qe.trackLinkElement(gt),Bu(gt)&&Xi.addShadowRoot(q.shadowRoot(gt),document)},onIframeLoad:(gt,bt)=>{tn.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:C0(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(dF)({mutationCb:Li,mousemoveCb:(dt,Ra)=>vt({type:rt.IncrementalSnapshot,data:{source:Ra,positions:dt}}),mouseInteractionCb:dt=>vt({type:rt.IncrementalSnapshot,data:z({source:et.MouseInteraction},dt)}),scrollCb:Wh,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:Uh,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:wa,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:Ia,dataURLOptions:Oi,mirror:ce,iframeManager:tn,stylesheetManager:qe,shadowDomManager:Xi,processedNodeManager:Ea,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:Ra=>vt({type:rt.Plugin,data:{plugin:dt.name,payload:Ra}})})))||[]},U)};tn.addLoadListener(bt=>{try{st.push(oe(bt.contentDocument))}catch(pe){console.warn(pe)}});let gt=()=>{Ls(),st.push(oe(document)),oa=!0};return document.readyState==="interactive"||document.readyState==="complete"?gt():(st.push(Pt("DOMContentLoaded",()=>{vt({type:rt.DomContentLoaded,data:{}}),g==="DOMContentLoaded"&>()})),st.push(Pt("load",()=>{vt({type:rt.Load,data:{}}),g==="load"&>()},window))),()=>{st.forEach(bt=>bt()),Ea.destroy(),oa=!1,tF()}}catch(st){console.warn(st)}}function xF(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 GF(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 LF(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 WF(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=fb[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[fb[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 AF(t){let e;try{if(e=gb&&(self.URL||self.webkitURL).createObjectURL(gb),!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,"+K0,{name:t==null?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}var JG,DG,Oe,YG,zt,KG,bb,Bn,_G,HG,zG,Xs,vb,Sb,qc,$,rr,ai,di,ir,$G,eu,eL,Ib,Tb,nL,tr,nu,A,w,aL,bL,kb,EL,Vb,CL,kL,xL,NL,LL,XL,ah,WL,UL,ML,PL,FL,rg,Lc,Gb,AL,iu,Ws,Cs,JL,jn,ig,DL,YL,KL,Xc,_L,HL,Wc,ou,zL,BL,Us,Zs,su,Xb,Ms,jr,Ub,Mb,iX,oX,sX,aX,lX,cX,uX,hX,pX,Pb,og,yX,gX,Fb,sg,bX,ag,vX,SX,wX,IX,TX,Uc,lu,lh,cu,EX,uu,la,Ps,ch,RX,lg,ie,je,hu,CX,Ht,ca,ZX,kX,Ab,li,VX,ks,In,xX,Jb,NX,OX,GX,LX,XX,WX,UX,MX,cg,PX,FX,DX,pu,KX,ug,_X,du,HX,zX,Fs,Be,BX,jX,QX,As,_b,Hb,fu,z,Yt,or,Y,Dt,$X,qX,tW,eW,nW,k,hg,rW,iW,pg,Et,dg,fg,ns,oW,Mc,Pc,xt,Js,mg,ZW,kW,VW,xW,GW,LW,XW,WW,UW,MW,PW,FW,qb,AW,JW,mi,Qn,yg,YW,KW,gg,dh,_,iv,r2,i2,o2,ue,vg,Sg,gu,fh,wg,bu,sv,a2,ua,Zi,l2,c2,u2,Qr,h2,wu,ha,p2,Iu,pa,d2,Tu,da,av,lv,f2,cv,uv,mh,hv,pv,yh,Le,Rn,yv,zs,gh,m2,gv,bv,yi,bh,y2,g2,b2,v2,S2,Fc,w2,Ig,Tg,Eu,vv,T2,Ru,Cu,E2,R2,Eg,is,Rg,C2,Ac,Jc,Z2,Cg,Bs,fa,Sv,wv,Iv,ar,ki,gi,Tv,Ev,k2,js,vh,V2,x2,N2,O2,G2,L2,X2,W2,Vs,Rv,Cv,Zv,kv,xs,Zg,U2,M2,P2,F2,Vv,Dc,kg,os,Vg,ss,qr,as,ls,cs,A2,J2,D2,Y2,K2,_2,H2,z2,B2,j2,us,hs,Q2,xg,$2,q2,tU,eU,nU,Ng,rU,Og,oU,sU,aU,lU,cU,Sh,Zu,xv,uU,ku,wh,Gg,Nv,hU,pU,dU,fU,Lg,mU,yU,Se,gU,bU,vU,SU,wU,lr,xu,cr,Lv,IU,TU,EU,RU,CU,Nu,ZU,kU,VU,xU,NU,vi,OU,Xv,Wv,GU,LU,Uv,Mv,XU,WU,UU,MU,PU,FU,Ih,AU,Pv,Fv,JU,DU,YU,KU,re,Th,H,Av,HU,zU,BU,he,Wg,Ug,Ou,Eh,Mg,Gu,Dv,QU,ma,Vi,$U,qU,tM,ei,eM,Wu,ya,nM,Uu,ga,rM,Mu,ba,Yv,Kv,iM,_v,Hv,Rh,zv,Bv,Ch,Xe,Cn,qv,$s,Zh,oM,t0,e0,Si,kh,sM,aM,lM,cM,uM,Yc,hM,Pg,Fg,Pu,n0,dM,Fu,Au,fM,mM,Ag,ps,Jg,yM,Kc,_c,gM,Dg,qs,va,r0,i0,o0,ur,xi,wi,s0,a0,bM,ta,Vh,vM,SM,wM,IM,TM,EM,RM,CM,Ns,l0,c0,u0,h0,Os,Yg,ZM,kM,VM,xM,p0,Hc,Kg,ds,_g,fs,ri,ms,ys,gs,NM,OM,GM,LM,XM,WM,UM,MM,PM,FM,bs,vs,AM,Hg,JM,DM,YM,KM,_M,zg,HM,Bg,BM,jM,QM,$M,qM,xh,Ju,d0,tP,Du,Nh,jg,f0,eP,nP,rP,iP,Qg,oP,sP,we,aP,lP,cP,uP,hP,hr,Ku,pr,g0,pP,dP,fP,mP,yP,_u,gP,bP,vP,SP,wP,Ti,IP,b0,v0,TP,EP,S0,w0,RP,CP,ZP,kP,VP,xP,Oh,NP,I0,T0,OP,GP,Hu,qg,tb,Ss,LP,zc,Bc,q,$n,eb,na,_P,ju,rt,et,Jt,He,dr,qn,X0,Qu,rb,$u,hi,nt,Tn,iF,sb,ia,th,eh,nr,fF,oi,mF,ab,F0,A0,J0,D0,SF,ub,nh,rh,ih,vt,Ls,pi,oa,ce,hb,pb,IF,TF,EF,RF,CF,ZF,db,Qc,kF,VF,Ut,Ie,$c,NF,fb,Mt,Y0,OF,mb,yb,Ri,UF,MF,PF,K0,FF,gb,Ne,JF,DF,YF,KF,oh,Ci,Oc=Dh(()=>{"use strict";JG=Object.defineProperty,DG=(t,e,n)=>e in t?JG(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Oe=(t,e,n)=>DG(t,typeof e!="symbol"?e+"":e,n),YG=(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]),KG(r,...n)},KG=(t,...e)=>YG(void 0,null,function*(){try{let{LDObserve:n}=yield Promise.resolve().then(()=>(Qy(),jy));n.recordLog(`${t}${e}`,"warn")}catch(n){}}),bb=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 bb)}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=[]}},_G=Object.defineProperty,HG=Object.defineProperties,zG=Object.getOwnPropertyDescriptors,Xs=Object.getOwnPropertySymbols,vb=Object.prototype.hasOwnProperty,Sb=Object.prototype.propertyIsEnumerable,qc=(t,e,n)=>e in t?_G(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$=(t,e)=>{for(var n in e||(e={}))vb.call(e,n)&&qc(t,n,e[n]);if(Xs)for(var n of Xs(e))Sb.call(e,n)&&qc(t,n,e[n]);return t},rr=(t,e)=>HG(t,zG(e)),ai=(t,e)=>{var n={};for(var r in t)vb.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Xs)for(var r of Xs(t))e.indexOf(r)<0&&Sb.call(t,r)&&(n[r]=t[r]);return n},di=(t,e,n)=>qc(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())});$G=/\r\n|[\n\r]/g;eu=class t extends Error{constructor(e,...n){var r,i,o;let{nodes:s,source:a,positions:c,path:l,originalError:u,extensions:h}=tL(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=>tu(a,m)):p==null?void 0:p.map(m=>tu(m.source,m.start));let f=jG(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 m0(t){let e=!1,n=cP[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 $g(t){let e;return t.type==="document"?e=["Document",hr,"DocumentExit"]:t.type==="root"?e=["Root",hr,"RootExit"]:e=m0(t),{eventIndex:0,events:e,iterator:0,node:t,visitorIndex:0,visitors:[]}}function Yu(t){return t[we]=!1,t.nodes&&t.nodes.forEach(e=>Yu(e)),t}function pt(...t){return t.length===1&&Array.isArray(t[0])&&(t=t[0]),new Oh(t)}function Gh(t){if(Ss[t])return Ss[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 tb?tb[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&&!LP())return Ss[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?Ss[t]=l:n}catch(a){return n}}function $e(t,e,n){var r;let i=`${t}.${String(n)}`;if(zc[i])return zc[i].call(e);let o=Gh(t),s=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return s?(zc[i]=s,s.call(e)):e[n]}function E0(t,e,n){let r=`${t}.${String(n)}`;if(Bc[r])return Bc[r].bind(e);let i=Gh(t)[n];return typeof i!="function"?e[n]:(Bc[r]=i,i.bind(e))}function XP(t){return $e("Node",t,"childNodes")}function WP(t){return $e("Node",t,"parentNode")}function UP(t){return $e("Node",t,"parentElement")}function MP(t){return $e("Node",t,"textContent")}function PP(t,e){return E0("Node",t,"contains")(e)}function FP(t){return E0("Node",t,"getRootNode")()}function AP(t){return!t||!("host"in t)?null:$e("ShadowRoot",t,"host")}function JP(t){return t.styleSheets}function DP(t){return!t||!("shadowRoot"in t)?null:$e("Element",t,"shadowRoot")}function YP(t,e){return $e("Element",t,"querySelector")(e)}function KP(t,e){return $e("Element",t,"querySelectorAll")(e)}function R0(){return Gh("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 Sa(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)}}),()=>Sa(t,e,o||{},!0)}function C0(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 Z0(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function k0(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function V0(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=V0(t);if(!i)return!1;try{if(typeof e=="string"){if(i.classList.contains(e)||r&&i.closest("."+e)!==null)return!0}else if(Hs(i,e,r))return!0}catch(o){}return!!(n&&(i.matches(n)||r&&i.closest(n)!==null))}function HP(t,e){return e.getId(t)!==-1}function jc(t,e,n){return t.tagName==="TITLE"&&n.headTitleMutations?!0:e.getId(t)===mi}function x0(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?x0(r,e):!0}function zu(t){return!!t.changedTouches}function zP(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 N0(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function O0(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function Bu(t){return t?t instanceof Hu&&"shadowRoot"in t?!!t.shadowRoot:!!q.shadowRoot(t):!1}function G0(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 BP(t){let e=t,n;for(;n=G0(e);)e=n;return e}function jP(t){let e=t.ownerDocument;if(!e)return!1;let n=BP(t);return q.contains(e,n)}function L0(t){let e=t.ownerDocument;return e?q.contains(e,t)||jP(t):!1}function nb(t){return"__ln"in t}function qu(t,e){t.delete(e),q.childNodes(e).forEach(n=>qu(t,n))}function QP(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 ib(t,e,n){return t.size===0?!1:$P(t,e)}function $P(t,e,n){let r=q.parentNode(e);return r?t.has(r):!1}function ob(t,e){return t.size===0?!1:W0(t,e)}function W0(t,e){let n=q.parentNode(e);return n?t.has(n)?!0:W0(t,n):!1}function qP(t){hi=t}function tF(){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 U0(t,e){let n=new $u;Tn.push(n),n.init(t);let r=new(R0())(nt(n.processMutations.bind(n)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function eF({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}=zu(h)?h.changedTouches[0]:h;a||(a=na()),s.push({x:f,y:m,id:r.getId(p),timeOffset:na()-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 nF({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)||_P(p))return;let f=null,m=u;if("pointerType"in h){switch(h.pointerType){case"mouse":f=He.Mouse;break;case"touch":f=He.Touch;break;case"pen":f=He.Pen;break}f===He.Touch&&(Jt[u]===Jt.MouseDown?m="TouchStart":Jt[u]===Jt.MouseUp&&(m="TouchEnd"))}else zu(h)&&(f=He.Touch);f!==null?(c=f,(m.startsWith("Touch")&&f===He.Touch||m.startsWith("Mouse")&&f===He.Mouse)&&(f=null)):Jt[u]===Jt.Click&&(f=c,c=null);let d=zu(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 M0({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=C0(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 rF({viewportResizeCb:t},{win:e}){let n=-1,r=-1,i=nt(Ei(nt(()=>{let o=Z0(),s=k0();(n!==o||r!==s)&&(t({width:Number(s),height:Number(o)}),n=o,r=s)}),200));return Pt("resize",i,e)}function oF({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||iF.indexOf(E)<0||Nt(I,r,i,!0)||I.classList.contains(o)||s&&I.matches(s))return;let T=I.value,V=!1,N=Ys(I)||"",U=I.getAttribute("data-hl-record");N==="radio"||N==="checkbox"?V=I.checked:qb({maskInputOptions:a,type:N,tagName:E,overwriteRecord:U})&&(T=Ds({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=sb.get(v);if(!R||R.text!==I.text||R.isChecked!==I.isChecked){sb.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=>Sa(v[0],v[1],{set(){nt(h)({target:this,isTrusted:!1})}},!1,m))),nt(()=>{f.forEach(v=>v())})}function ra(t){let e=[];function n(r,i){if(ws("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||ws("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||ws("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||ws("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 ze(t,e,n){let r,i;return t?(t.ownerNode?r=e.getId(t.ownerNode):i=n.getId(t),{styleId:i,id:r}):{}}function sF({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}=ze(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}=ze(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}=ze(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}=ze(h,e,n.styleMirror);return(m&&m!==-1||d&&d!==-1)&&t({id:m,styleId:d,replaceSync:f}),u.apply(h,p)})}));let c={};Is("CSSGroupingRule")?c.CSSGroupingRule=r.CSSGroupingRule:(Is("CSSMediaRule")&&(c.CSSMediaRule=r.CSSMediaRule),Is("CSSConditionRule")&&(c.CSSConditionRule=r.CSSConditionRule),Is("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}=ze(f.parentStyleSheet,e,n.styleMirror);return(v&&v!==-1||I&&I!==-1)&&t({id:v,styleId:I,adds:[{rule:d,index:[...ra(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}=ze(f.parentStyleSheet,e,n.styleMirror);return(b&&b!==-1||v&&v!==-1)&&t({id:b,styleId:v,removes:[{index:[...ra(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 P0({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 aF({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}=ze((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:ra(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}=ze((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:ra(c.parentRule)}),a.apply(c,l)})}),nt(()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=s})}function lF({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 cF({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 uF(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 hF({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 pF(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 dF(t,e={}){let n=t.doc.defaultView;if(!n)return()=>{};pF(t,e);let r;t.recordDOM&&(r=U0(t,t.doc));let i=eF(t),o=nF(t),s=M0(t),a=rF(t,{win:n}),c=oF(t),l=lF(t),u=()=>{},h=()=>{},p=()=>{},f=()=>{};t.recordDOM&&(u=sF(t,{win:n}),h=P0(t,t.doc),p=aF(t,{win:n}),t.collectFonts&&(f=cF(t)));let m=uF(t),d=hF(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 ws(t){return typeof window[t]<"u"}function Is(t){return!!(typeof window[t]<"u"&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}function yF(t,e){let n=ab.get(t);return n||(n=new Map,ab.set(t,n)),n.has(e)||n.set(e,[]),n.get(e)}function Gs(t,e,n){if(t instanceof Array)return t.map(r=>Gs(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=mF(t);return{rr_type:r,base64:i}}else{if(t instanceof DataView)return{rr_type:t.constructor.name,args:[Gs(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:[Gs(t.data,e,n),t.width,t.height]};if(J0(t,e)||typeof t=="object"){let r=t.constructor.name,i=F0(t,e,n);return{rr_type:r,index:i}}}}return t}function gF(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=A0(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=Sa(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 bF(t){return t==="experimental-webgl"?"webgl":t}function lb(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=bF(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 cb(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(F0(p,o,this),"tagName"in this.canvas&&!Nt(this.canvas,r,i,!0)){let f=A0(h,o,this),m={type:e,property:c,args:f};n(this.canvas,m)}return p}});s.push(l)}catch(l){let u=Sa(t,c,{set(h){n(this.canvas,{type:e,property:c,args:[h],setter:!0})}});s.push(u)}return s}function vF(t,e,n,r){let i=[];return i.push(...cb(e.WebGLRenderingContext.prototype,dr.WebGL,t,n,r,e)),typeof e.WebGL2RenderingContext<"u"&&i.push(...cb(e.WebGL2RenderingContext.prototype,dr.WebGL2,t,n,r,e)),()=>{i.forEach(o=>o())}}function wF(t){let e;try{if(e=ub&&(self.URL||self.webkitURL).createObjectURL(ub),!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)}}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=hh,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:_0,logger:H0}=t,Oi=z(z({},t.dataURLOptions),(n=(e=t.sampling)==null?void 0:e.canvas)==null?void 0:n.dataURLOptions);qP(_0);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 wa=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},Ia=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||{};zP();let Lh,Ta=0,Xh=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=na(),(gt=Tn[0])!=null&>.isFrozen()&&bt.type!==rt.FullSnapshot&&!(bt.type===rt.IncrementalSnapshot&&bt.data.source===et.Mutation)&&Tn.forEach(pe=>pe.unfreeze()),Gi)l==null||l(Xh(bt),oe);else if(mr){let pe={type:"rrweb",event:Xh(bt),origin:window.location.origin,isCheckout:oe};window.parent.postMessage(pe,"*")}if(bt.type===rt.FullSnapshot)Lh=bt,Ta=0;else if(bt.type===rt.IncrementalSnapshot){if(bt.data.source===et.Mutation&&bt.data.isAttachIframe)return;Ta++;let pe=h&&Ta>=h,dt=u&&bt.timestamp-Lh.timestamp>u;(pe||dt)&&Ls(!0)}};let Li=at=>{vt({type:rt.IncrementalSnapshot,data:z({source:et.Mutation},at)})},Wh=at=>vt({type:rt.IncrementalSnapshot,data:z({source:et.Scroll},at)}),Uh=at=>vt({type:rt.IncrementalSnapshot,data:z({source:et.CanvasMutation},at)}),z0=at=>vt({type:rt.IncrementalSnapshot,data:z({source:et.AdoptedStyleSheet},at)}),qe=new rh({mutationCb:Li,adoptedStyleSheetCb:z0}),tn=new th({mirror:ce,mutationCb:Li,stylesheetManager:qe,recordCrossOriginIframes:y,wrappedEmit:vt});for(let at of it||[])at.getMirror&&at.getMirror({nodeMirror:ce,crossOriginIframeMirror:tn.crossOriginIframeMirror,crossOriginIframeStyleMirror:tn.crossOriginIframeStyleMirror});let Ea=new ih;pi=new nh({recordCanvas:lt,recordLocalVideos:P,recordRemoteVideos:O,mutationCb:Uh,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:H0});let Xi=new eh({mutationCb:Li,scrollCb:Wh,bypassOptions:{blockClass:p,blockSelector:f,maskTextClass:b,maskTextSelector:v,inlineStylesheet:I,maskInputOptions:wa,dataURLOptions:Oi,maskTextFn:N,maskInputFn:V,recordCanvas:lt,inlineImages:P,inlineVideos:O,privacySetting:Ot,sampling:x,slimDOMOptions:Ia,iframeManager:tn,stylesheetManager:qe,canvasManager:pi,keepIframeSrcFn:ct,processedNodeManager:Ea},mirror:ce});Ls=(at=!1)=>{if(!ot)return;vt({type:rt.Meta,data:{href:window.location.href,width:k0(),height:Z0()}},at),qe.reset(),Xi.init(),Tn.forEach(gt=>gt.lock());let oe=e2(document,{mirror:ce,blockClass:p,blockSelector:f,maskTextClass:b,maskTextSelector:v,inlineStylesheet:I,maskAllInputs:wa,maskTextFn:N,maskInputFn:V,slimDOM:Ia,dataURLOptions:Oi,recordCanvas:lt,inlineImages:P,inlineVideos:O,privacySetting:Ot,onSerialize:gt=>{N0(gt,ce)&&tn.addIframe(gt),O0(gt,ce)&&qe.trackLinkElement(gt),Bu(gt)&&Xi.addShadowRoot(q.shadowRoot(gt),document)},onIframeLoad:(gt,bt)=>{tn.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:C0(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(dF)({mutationCb:Li,mousemoveCb:(dt,Ra)=>vt({type:rt.IncrementalSnapshot,data:{source:Ra,positions:dt}}),mouseInteractionCb:dt=>vt({type:rt.IncrementalSnapshot,data:z({source:et.MouseInteraction},dt)}),scrollCb:Wh,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:Uh,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:wa,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:Ia,dataURLOptions:Oi,mirror:ce,iframeManager:tn,stylesheetManager:qe,shadowDomManager:Xi,processedNodeManager:Ea,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:Ra=>vt({type:rt.Plugin,data:{plugin:dt.name,payload:Ra}})})))||[]},U)};tn.addLoadListener(bt=>{try{at.push(oe(bt.contentDocument))}catch(pe){console.warn(pe)}});let gt=()=>{Ls(),at.push(oe(document)),oa=!0};return document.readyState==="interactive"||document.readyState==="complete"?gt():(at.push(Pt("DOMContentLoaded",()=>{vt({type:rt.DomContentLoaded,data:{}}),g==="DOMContentLoaded"&>()})),at.push(Pt("load",()=>{vt({type:rt.Load,data:{}}),g==="load"&>()},window))),()=>{at.forEach(bt=>bt()),Ea.destroy(),oa=!1,tF()}}catch(at){console.warn(at)}}function xF(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 GF(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 LF(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 WF(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=fb[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[fb[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 AF(t){let e;try{if(e=gb&&(self.URL||self.webkitURL).createObjectURL(gb),!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,"+K0,{name:t==null?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}var JG,DG,Oe,YG,zt,KG,bb,Bn,_G,HG,zG,Xs,vb,Sb,qc,$,rr,ai,di,ir,$G,eu,eL,Ib,Tb,nL,tr,nu,A,w,aL,bL,kb,EL,Vb,CL,kL,xL,NL,LL,XL,ah,WL,UL,ML,PL,FL,rg,Lc,Gb,AL,iu,Ws,Cs,JL,jn,ig,DL,YL,KL,Xc,_L,HL,Wc,ou,zL,BL,Us,Zs,su,Xb,Ms,jr,Ub,Mb,iX,oX,sX,aX,lX,cX,uX,hX,pX,Pb,og,yX,gX,Fb,sg,bX,ag,vX,SX,wX,IX,TX,Uc,lu,lh,cu,EX,uu,la,Ps,ch,RX,lg,ie,je,hu,CX,Ht,ca,ZX,kX,Ab,li,VX,ks,In,xX,Jb,NX,OX,GX,LX,XX,WX,UX,MX,cg,PX,FX,DX,pu,KX,ug,_X,du,HX,zX,Fs,Be,BX,jX,QX,As,_b,Hb,fu,z,Yt,or,Y,Dt,$X,qX,tW,eW,nW,k,hg,rW,iW,pg,Et,dg,fg,ns,oW,Mc,Pc,xt,Js,mg,ZW,kW,VW,xW,GW,LW,XW,WW,UW,MW,PW,FW,qb,AW,JW,mi,Qn,yg,YW,KW,gg,dh,_,iv,r2,i2,o2,ue,vg,Sg,gu,fh,wg,bu,sv,a2,ua,Zi,l2,c2,u2,Qr,h2,wu,ha,p2,Iu,pa,d2,Tu,da,av,lv,f2,cv,uv,mh,hv,pv,yh,Le,Rn,yv,zs,gh,m2,gv,bv,yi,bh,y2,g2,b2,v2,S2,Fc,w2,Ig,Tg,Eu,vv,T2,Ru,Cu,E2,R2,Eg,is,Rg,C2,Ac,Jc,Z2,Cg,Bs,fa,Sv,wv,Iv,ar,ki,gi,Tv,Ev,k2,js,vh,V2,x2,N2,O2,G2,L2,X2,W2,Vs,Rv,Cv,Zv,kv,xs,Zg,U2,M2,P2,F2,Vv,Dc,kg,os,Vg,ss,qr,as,ls,cs,A2,J2,D2,Y2,K2,_2,H2,z2,B2,j2,us,hs,Q2,xg,$2,q2,tU,eU,nU,Ng,rU,Og,oU,sU,aU,lU,cU,Sh,Zu,xv,uU,ku,wh,Gg,Nv,hU,pU,dU,fU,Lg,mU,yU,Se,gU,bU,vU,SU,wU,lr,xu,cr,Lv,IU,TU,EU,RU,CU,Nu,ZU,kU,VU,xU,NU,vi,OU,Xv,Wv,GU,LU,Uv,Mv,XU,WU,UU,MU,PU,FU,Ih,AU,Pv,Fv,JU,DU,YU,KU,re,Th,H,Av,HU,zU,BU,he,Wg,Ug,Ou,Eh,Mg,Gu,Dv,QU,ma,Vi,$U,qU,tM,ei,eM,Wu,ya,nM,Uu,ga,rM,Mu,ba,Yv,Kv,iM,_v,Hv,Rh,zv,Bv,Ch,Xe,Cn,qv,$s,Zh,oM,t0,e0,Si,kh,sM,aM,lM,cM,uM,Yc,hM,Pg,Fg,Pu,n0,dM,Fu,Au,fM,mM,Ag,ps,Jg,yM,Kc,_c,gM,Dg,qs,va,r0,i0,o0,ur,xi,wi,s0,a0,bM,ta,Vh,vM,SM,wM,IM,TM,EM,RM,CM,Ns,l0,c0,u0,h0,Os,Yg,ZM,kM,VM,xM,p0,Hc,Kg,ds,_g,fs,ri,ms,ys,gs,NM,OM,GM,LM,XM,WM,UM,MM,PM,FM,bs,vs,AM,Hg,JM,DM,YM,KM,_M,zg,HM,Bg,BM,jM,QM,$M,qM,xh,Ju,d0,tP,Du,Nh,jg,f0,eP,nP,rP,iP,Qg,oP,sP,we,aP,lP,cP,uP,hP,hr,Ku,pr,g0,pP,dP,fP,mP,yP,_u,gP,bP,vP,SP,wP,Ti,IP,b0,v0,TP,EP,S0,w0,RP,CP,ZP,kP,VP,xP,Oh,NP,I0,T0,OP,GP,Hu,qg,tb,Ss,LP,zc,Bc,q,$n,eb,na,_P,ju,rt,et,Jt,He,dr,qn,X0,Qu,rb,$u,hi,nt,Tn,iF,sb,ia,th,eh,nr,fF,oi,mF,ab,F0,A0,J0,D0,SF,ub,nh,rh,ih,vt,Ls,pi,oa,ce,hb,pb,IF,TF,EF,RF,CF,ZF,db,Qc,kF,VF,Ut,Ie,$c,NF,fb,Mt,Y0,OF,mb,yb,Ri,UF,MF,PF,K0,FF,gb,Ne,JF,DF,YF,KF,oh,Ci,Oc=Dh(()=>{"use strict";JG=Object.defineProperty,DG=(t,e,n)=>e in t?JG(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Oe=(t,e,n)=>DG(t,typeof e!="symbol"?e+"":e,n),YG=(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]),KG(r,...n)},KG=(t,...e)=>YG(void 0,null,function*(){try{let{LDObserve:n}=yield Promise.resolve().then(()=>(Qy(),jy));n.recordLog(`${t}${e}`,"warn")}catch(n){}}),bb=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 bb)}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=[]}},_G=Object.defineProperty,HG=Object.defineProperties,zG=Object.getOwnPropertyDescriptors,Xs=Object.getOwnPropertySymbols,vb=Object.prototype.hasOwnProperty,Sb=Object.prototype.propertyIsEnumerable,qc=(t,e,n)=>e in t?_G(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,$=(t,e)=>{for(var n in e||(e={}))vb.call(e,n)&&qc(t,n,e[n]);if(Xs)for(var n of Xs(e))Sb.call(e,n)&&qc(t,n,e[n]);return t},rr=(t,e)=>HG(t,zG(e)),ai=(t,e)=>{var n={};for(var r in t)vb.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Xs)for(var r of Xs(t))e.indexOf(r)<0&&Sb.call(t,r)&&(n[r]=t[r]);return n},di=(t,e,n)=>qc(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())});$G=/\r\n|[\n\r]/g;eu=class t extends Error{constructor(e,...n){var r,i,o;let{nodes:s,source:a,positions:c,path:l,originalError:u,extensions:h}=tL(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=>tu(a,m)):p==null?void 0:p.map(m=>tu(m.source,m.start));let f=jG(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
|
`+qG(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()},og)),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]=TF(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:[tW()],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<bX||(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===mb){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:yb},"*"),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:mb,projectID:this.sessionData.projectID,sessionSecureID:this.sessionData.sessionSecureID},"*")})},og),window.addEventListener("message",e=>{e.data.highlight===yb&&this.logger.log("highlight got response from initialized iframe")})}El(){var e;try{let r=this;this.enableSegmentIntegration&&this.listeners.push(ZF(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(IF(o=>{this.reloaded?(this.addCustomEvent("Reload",o),this.reloaded=!1,r.addProperties({reload:!0},{type:"session"})):this.addCustomEvent("Navigate",o)})),this.listeners.push(_X(o=>{this.addCustomEvent("Viewport",o)})),this.listeners.push(EF((o,s)=>{let a=null,c=null;if(s&&s.target){let l=s.target;a=YX(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(RF(o=>{o&&this.addCustomEvent("Focus",o)})),this.sessionShortcut&&VF(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.")):(CF(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),In(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),In(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://${ag}/${n}/sessions/${r}?ts=${i}`}getCurrentSessionURL(){let e=this.sessionData.projectID,n=this.sessionData.sessionSecureID;return e&&n?`https://${ag}/${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>gX&&(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:Ob(Mb),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(),In(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()},yX))})}addCustomEvent(e,n){if(this.state==="NotRecording"){let r,i=()=>{clearInterval(r),this.state==="Recording"&&this.events.length>0?pb(e,n):r=setTimeout(i,500)};r=setTimeout(i,500)}else this.state==="Recording"&&(this.events.length>0||this.hasPushedData)&&pb(e,n)}Rl(e){return Dt(this,arguments,function*({sendFn:n}){let r=[...this.events],{bytes:i,time:o}=this.enableCanvasRecording?sg.canvas:sg.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=MF();n?yield n({session_secure_id:this.sessionData.sessionSecureID,payload_id:(this.sessionData.payloadID++).toString(),events:{events:r},messages:BL({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}}),In(this.sessionData),this.events=this.events.slice(r.length),PF(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 pu(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=ks(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(IX);if(r&&(e=r==null?void 0:r.groups)!=null&&e.domain){let i=(n=r.groups.domain)!=null?n:"";return`https://${SX[i]}${wX}`}return vX}},Ci=class extends HX{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:KF,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 oh(f),n!=null&&n.manualStart||this.record.start(),Be.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&&DF(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&&JF(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=AX(n.context),f=JX(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 HF={};Yh(HF,{LDObserve:()=>De,LDRecord:()=>Be,basicLogger:()=>QI,createClient:()=>_F});module.exports=eS(HF);var nS=Object.defineProperty,rS=Object.defineProperties,iS=Object.getOwnPropertyDescriptors,Pi=Object.getOwnPropertySymbols,fp=Object.prototype.hasOwnProperty,mp=Object.prototype.propertyIsEnumerable,Kh=(t,e,n)=>e in t?nS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,at=(t,e)=>{for(var n in e||(e={}))fp.call(e,n)&&Kh(t,n,e[n]);if(Pi)for(var n of Pi(e))mp.call(e,n)&&Kh(t,n,e[n]);return t},me=(t,e)=>rS(t,iS(e)),yp=(t,e)=>{var n={};for(var r in t)fp.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Pi)for(var r of Pi(t))e.indexOf(r)<0&&mp.call(t,r)&&(n[r]=t[r]);return n};function oS(t){return`/${t.replace(/~/g,"~0").replace(/\//g,"~1")}`}function gp(t){return t.indexOf("~")?t.replace(/~1/g,"/").replace(/~0/g,"~"):t}function sS(t){return(t.startsWith("/")?t.substring(1):t).split("/").map(e=>gp(e))}function aS(t){return!t.startsWith("/")}function lS(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("/")?oS(n):n}else{if(this.redactionName=t,t===""||t==="/"||!lS(t)){this.isValid=!1,this.p=[];return}aS(t)?this.p=[t]:t.indexOf("/",1)<0?this.p=[gp(t.slice(1))]:this.p=sS(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 cS=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}},bp=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}},vp=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}},Sp=class extends Ln{constructor(t){super(`string matching ${t}`,""),this.expression=t}is(t){return typeof t=="string"&&!!t.match(this.expression)}},uS=class{is(t){return typeof t=="function"}getType(){return"function"}},hS=class{is(t){return typeof t=="boolean"||typeof t=="undefined"||t===null}getType(){return"boolean | undefined | null"}},pS=/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d\d*)?(Z|[-+]\d\d(:\d\d)?)/,dS=class{is(t){return typeof t=="number"||typeof t=="string"&&pS.test(t)}getType(){return"date"}},fS=class extends Sp{constructor(){super(/^(\w|\.|-)+$/)}is(t){return super.is(t)&&t!=="kind"}},G=class{static createTypeArray(t,e){return new bp(t,e)}static numberWithMin(t){return new vp(t)}static stringMatchingRegex(t){return new Sp(t)}};G.String=new Ln("string","");G.Number=new Ln("number",0);G.ObjectOrFactory=new cS;G.Object=new Ln("object",{});G.StringArray=new bp("string[]","");G.Boolean=new Ln("boolean",!0);G.Function=new uS;G.Date=new dS;G.Kind=new fS;G.NullableBoolean=new hS;function wp(t){return"kind"in t?G.String.is(t.kind)&&t.kind!=="multi":!1}function Ip(t){return"kind"in t?G.String.is(t.kind)&&t.kind==="multi":!1}function Tp(t){return!("kind"in t)||t.kind===null||t.kind===void 0}function Fi(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=>Fi(n,[...e,t])).map(n=>n===void 0?"null":n).join(",")}]`:`{${Object.keys(t).sort().map(n=>{let r=Fi(t[n],[...e,t]);if(r!==void 0)return`${JSON.stringify(n)}:${r}`}).filter(n=>n!==void 0).join(",")}}`}var Xa="user";function _h(t){return t.includes("%")||t.includes(":")?t.replace(/%/g,"%25").replace(/:/g,"%3A"):t}function mS(t){return t&&G.Object.is(t)}function Hh(t){return G.Kind.is(t)}function zh(t){return G.String.is(t)&&t!==""}function Ca(t,e=!1){return t?t.map(n=>new Nn(n,e)):[]}function yS(t){return t!=null}function gS(t){let e=me(at({},t.custom||[]),{kind:"user",key:String(t.key)});if(yS(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(Hh);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 mS(h)?(c[l]=h,i[l]=Ca((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=>zh(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=Hh(i),s=zh(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=Ca((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=gS(e),n.st={user:Ca(e.privateAttributeNames,!0)},n}static fromLDContext(e){return e?wp(e)?wt.ze(e):Ip(e)?wt.He(e):Tp(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=Xa){return e.isKind?this.kinds:wt.je(e,this.se(n))}key(e=Xa){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}:${_h(this.R[e].key)}`).join(":"):`${this.kind}:${_h(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=Fi(wt.toLDContext(this))}catch(e){}return this.Et}}};xn.UserKind=Xa;var bS=["key","kind","_meta","anonymous"].map(t=>new Nn(t,!0)),vS=["name","ip","firstName","lastName","email","avatar","country"];function SS(t,e){return t.depth===e.length&&e.every((n,r)=>n===t.getComponent(r))}function wS(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=>SS(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 IS=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=>!bS.some(o=>o.compare(i)))}ne(t,e,n,r){let i=this.Ke||r&&e.anonymous===!0,{cloned:o,excluded:s}=wS(e,this.We(t,e,n,i));return t.legacy&&vS.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}},Bh=30*1e3,TS=.5,ES=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(Bh/this.re))}A(){let t=Math.min(this.Dt,this.qe),e=this.re*2**t;return Math.min(e,Bh)}Ye(t){return t-Math.trunc(this.Je()*TS*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}},jh;(function(t){t[t.Valid=0]="Valid",t[t.Initializing=1]="Initializing",t[t.Interrupted=2]="Interrupted",t[t.Closed=3]="Closed"})(jh||(jh={}));var Ai=class extends Error{constructor(t,e,n,r=!0){super(e),this.kind=t,this.status=n,this.name="LaunchDarklyPollingError",this.recoverable=r}},Wa=class extends Error{constructor(t,e,n,r=!0){super(e),this.kind=t,this.code=n,this.name="LaunchDarklyStreamingError",this.recoverable=r}},BF=120*1e3,jF=300*1e3,_t;(function(t){t.Unknown="UNKNOWN",t.NetworkError="NETWORK_ERROR",t.ErrorResponse="ERROR_RESPONSE",t.InvalidData="INVALID_DATA"})(_t||(_t={}));var Ji;(function(t){t[t.Disabled=0]="Disabled",t[t.Enabled=1]="Enabled"})(Ji||(Ji={}));var On;(function(t){t[t.AnalyticsEvents=0]="AnalyticsEvents",t[t.DiagnosticEvent=1]="DiagnosticEvent"})(On||(On={}));var en;(function(t){t[t.Succeeded=0]="Succeeded",t[t.Failed=1]="Failed",t[t.FailedAndMustShutDown=2]="FailedAndMustShutDown"})(en||(en={}));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 RS(t){return typeof t=="symbol"?"NaN":typeof t=="bigint"?`${t}n`:String(Number(t))}function CS(t){return typeof t=="symbol"?"NaN":typeof t=="bigint"?`${t}n`:String(parseInt(t,10))}function ZS(t){return typeof t=="symbol"?"NaN":String(parseFloat(t))}var Za={s:t=>Vn(t),d:t=>RS(t),i:t=>CS(t),f:t=>ZS(t),j:t=>Vn(t),o:t=>Vn(t),O:t=>Vn(t),c:()=>""};function Ua(...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 Za&&t.length){let a=t.shift();r+=(e=Za[s])==null?void 0:e.call(Za,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 kS=["debug","info","warn","error","none"],Fa=class Ep{static get(){return new Ep({})}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):Ua(...e)}catch(r){return Ua(...e)}}oi(e,n){try{e(n)}catch(r){console.error(n)}}x(e,n){var r;if(e>=this.ni){let i=`${kS[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)}},VS={error:G.Function,warn:G.Function,info:G.Function,debug:G.Function},Rp=class{constructor(t,e){Object.entries(VS).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)}},Cp=t=>{let e=new Fa({level:"info",destination:console.error,formatter:Ua});return t?new Rp(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`}},xS=/^(\w|\.|-)+$/,NS=G.stringMatchingRegex(xS),OS={is:(t,e)=>NS.is(t)?t.length>64?{valid:!1,message:Ue.tagValueTooLong(e)}:{valid:!0}:{valid:!1,message:Ue.invalidTagValue(e)}},GS=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}=OS.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(" "))}},LS=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 ka(t){return t.replace(/\/+$/,"")}function Aa(t){return t.replace(/^\/+/,"").replace(/\?$/,"")}var Di=class Zp{constructor(e,n,r=Zp.DEFAULT_EVENTS,i="/bulk",o="/diagnostic",s=!0,a){this.streaming=ka(e),this.polling=ka(n),this.events=ka(r),this.analyticsEventPath=i,this.diagnosticEventPath=o,this.includeAuthorizationHeader=s,this.payloadFilterKey=a}};Di.DEFAULT_EVENTS="https://events.launchdarkly.com";function Ja(t,e=[]){if(e.length===0)return t;let n=e.map(({key:r,value:i})=>`${r}=${i}`);return`${t}?${n.join("&")}`}function XS(t,e,n){let r=Aa(e),i=[...n];return t.payloadFilterKey&&i.push({key:"filter",value:t.payloadFilterKey}),Ja(`${t.streaming}/${r}`,i)}function WS(t,e,n=[]){let r=Aa(e),i=[...n];return t.payloadFilterKey&&i.push({key:"filter",value:t.payloadFilterKey}),Ja(`${t.polling}/${r}`,i)}function Qh(t,e,n=[]){let r=Aa(e);return Ja(`${t.events}/${r}`,n)}var kp=class extends Error{constructor(t){super(t),this.name="LaunchDarklyUnexpectedResponseError"}},US=class extends Error{constructor(t){super(t),this.name="LaunchDarklyClientError"}},Vp=class extends Error{constructor(t){super(t),this.name="LaunchDarklyTimeoutError"}};function _i(t){return t>=400&&t<500?t===400||t===408||t===429:!0}function MS(t){return t===413?!0:_i(t)}function PS(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 Vp(s))},t*1e3)}),cancel:()=>{r(),clearTimeout(n)}}}function xp(t){return t==null?t:JSON.parse(JSON.stringify(t))}function Va(t){return Math.trunc(t*1e3)}var FS=t=>JSON.stringify(t)==="{}",Da=(t,e)=>t&&Object.entries(t).reduce((n,[r,i])=>(i&&!FS(i)&&!(e!=null&&e.includes(r))&&(n[r]=typeof i=="object"?Da(i,e):i),n),{});function Ui(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(!Ui(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(!Ui(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(!Ui(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function AS(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 Np({status:t}){return t?_i(t):!0}var $h=(t,e)=>e.btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),Op=async(t=1e3)=>new Promise(e=>{setTimeout(e,t)}),JS=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}},Ma;(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"})(Ma||(Ma={}));var DS=Ma,Gp=class{static invalidMetricValue(t){return`The track function was called with a non-numeric "metricValue" (${t}), only numeric metric values are supported.`}};Gp.MissingContextKeyNoEvent="Context was unspecified or had no key; event will not be sent";var YS=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=Qh(n.serviceEndpoints,i,[]),this.hi=Qh(n.serviceEndpoints,o,[]),this.T=a,this.di=s}async nt(t,e,n,r){let i={status:en.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 kp(Gn({status:a,message:"some events were dropped"},"event posting")),!_i(a))return MS(a)?i.status=en.Failed:i.status=en.FailedAndMustShutDown,i.error=s,i}catch(a){s=a}return s&&!r?(i.status=en.Failed,i.error=s,i):(await Op(),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 Yi(t){return t.kind==="feature"}function KS(t){return t.kind==="identify"}function _S(t){return t.kind==="migration_op"}var HS=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 zS(t){return`${t.key}:${t.variation!==null&&t.variation!==void 0?t.variation:""}:${t.version!==null&&t.version!==void 0?t.version:""}`}var Lp=class{constructor(t=!1,e){this.fi=t,this.S=e,this.Y=0,this.rt=0,this.at={},this.ot={}}summarizeEvent(t){if(Yi(t)&&!t.excludeFromSummaries){this.y||(this.y=t.context);let e=zS(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 HS(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={}}},BS=class extends Error{constructor(t){super(t),this.name="LaunchDarklyInvalidSDKKeyError"}},jS=class{constructor(t,e){this.S=t,this.t=e,this.Z={}}summarizeEvent(t){var e;if(Yi(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 Lp(!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 Mi(t){let e=Math.trunc(t);return e===1?!0:e===0?!1:Math.floor(Math.random()*e)===0}function QS(t){return t.getSummaries!==void 0}var $S=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 YS(e,n),this.S=new IS(t.allAttributesPrivate,t.privateAttributes.map(a=>new Nn(a))),s?this.X=new jS(this.S,this.t):this.X=new Lp,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 BS("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=[],QS(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(_S(t)){if(Mi(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=Yi(t),r=n&&t.trackEvents||!n,i=this.yi(t),o=KS(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&&Mi(t.samplingRatio)&&this.ut(this.Ot(t,!1)),i&&Mi(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 Yi(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===en.FailedAndMustShutDown&&(this.At=!0),e.serverTime&&(this.me=e.serverTime),e.error)throw e.error}},Xp=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}},Pa=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)}},Wp=class{constructor(t,e=1){this.context=t,this.samplingRatio=e,this.kind="identify",this.creationDate=Date.now()}},qS=class{close(){}async flush(){}sendEvent(){}},tw=class{constructor(t){this.Tt=t}evalEvent(t){var e;return new Pa(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 Pa(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 Wp(t,1)}customEvent(t,e,n,r,i=1){return new Xp(e,t,n!=null?n:void 0,r!=null?r:void 0,i)}},qh="FDv1Fallback";function ew(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 Up=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=[]}},nw=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 Up(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 rw(t){if(t){let e=Object.keys(t).find(n=>n.toLowerCase()==="x-ld-envid");if(e)return{environmentId:t[e]}}}var tp="unknown plugin";function Ki(t,e){try{return e.getMetadata().name||tp}catch(n){return t.error("Exception thrown getting metadata for plugin. Unable to get plugin name."),tp}}function iw(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 ${Ki(t,i)} returned undefined from getHooks.`):s&&s.length>0&&r.push(...s)}catch(s){t.error(`Exception thrown getting hooks for plugin ${Ki(t,i)}. Unable to get hooks.`)}}),r}function ow(t,e,n,r){r.forEach(i=>{try{i.register(n,e)}catch(o){t.error(`Exception thrown registering plugin ${Ki(t,i)}.`)}})}var de=Object.freeze({__proto__:null,ClientMessages:Gp,DiagnosticsManager:JS,ErrorKinds:DS,EventFactoryBase:tw,EventProcessor:$S,FDv1PayloadAdaptor:ew,InputCustomEvent:Xp,InputEvalEvent:Pa,InputIdentifyEvent:Wp,NullEventProcessor:qS,PayloadProcessor:Up,PayloadStreamReader:nw,canonicalize:Fi,initMetadataFromHeaders:rw,isLegacyUser:Tp,isMultiKind:Ip,isSingleKind:wp,safeGetHooks:iw,safeGetName:Ki,safeRegisterPlugins:ow,shouldSample:Mi}),Kt;(function(t){t.Initializing="INITIALIZING",t.Valid="VALID",t.Interrupted="INTERRUPTED",t.SetOffline="SET_OFFLINE",t.Closed="CLOSED"})(Kt||(Kt={}));function sw(t){return t>=200&&t<=299}var ep=class extends Error{constructor(t,e){super(t),this.status=e,this.name="LaunchDarklyRequestError"}},aw=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(sw(e.status))return await e.text();t=e.status}catch(e){throw new ep(e==null?void 0:e.message)}throw new ep(`Unexpected status code: ${t}`,t)}};function np(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=WS(e,f,m);return new aw(r,d,p,h,u)}var rp=new Error("Task has already been executed or shed. This is likely an implementation error. The task will not be executed again.");function lw(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(rp)),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(rp)),s=!0,o.then(a=>{r({status:"shed"},a)})},promise:i,sheddable:n}}function cw(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=lw(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 uw={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},hw=300,Mp="https://clientsdk.launchdarkly.com",Pp="https://clientstream.launchdarkly.com";function pw(t){return t instanceof Rp?t:Cp(t)}var dw=class{constructor(t={},e={getImplementationHooks:()=>[],credentialType:"mobileKey"}){var n,r,i;this.logger=Cp(),this.baseUri=Mp,this.eventsUri=Di.DEFAULT_EVENTS,this.streamUri=Pp,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=hw,this.hooks=[],this.inspectors=[],this.logger=pw(t.logger),this.Ti(t).forEach(o=>this.logger.warn(o)),this.serviceEndpoints=new Di(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 GS({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=uw[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 vp&&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 Fp(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 Ap=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 Jp(t){return async e=>Fp(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 fw(t,e){return gr([{value:"LaunchDarkly",transform:fe},{value:e,transform:Jp(t)}])}async function mw(t){return gr([{value:"LaunchDarkly",transform:fe},{value:"AnonymousKeys",transform:fe},{value:t,transform:fe}])}async function yw(t){return gr([{value:"LaunchDarkly",transform:fe},{value:"ContextKeys",transform:fe},{value:t,transform:fe}])}async function gw(t){return gr([{value:t,transform:fe},{value:"ContextIndex",transform:fe}])}async function ip(t,e,n){return gr([{value:e,transform:fe},{value:n.canonicalKey,transform:Jp(t)}])}var{isLegacyUser:bw,isSingleKind:xa,isMultiKind:op}=de,Dp="1.0",vw=t=>{let e=t,{kind:n}=e,r=yp(e,["kind"]);return{kind:"multi",[n]:r}},Sw=async({crypto:t,info:e},{applicationInfo:n})=>{var r;let{ld_application:i}=e.platformData(),o=(r=Da(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 Fp(t.createHash("sha256").update(s),"base64"),o.envAttributesVersion=o.envAttributesVersion||Dp,o}},ww=async t=>{var e,n,r,i;let{ld_device:o,os:s}=t.info.platformData(),a=(e=Da(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 yw("ld_device");return a.key=await Ap(h,t),a.envAttributesVersion=a.envAttributesVersion||Dp,a}},Iw=async(t,e,n)=>{if(bw(t))return t;let r,i;if(xa(t)&&t.kind!=="ld_application"||op(t)&&!t.ld_application?r=await Sw(e,n):n.logger.warn("Not adding ld_application environment attributes because it already exists."),xa(t)&&t.kind!=="ld_device"||op(t)&&!t.ld_device?i=await ww(e):n.logger.warn("Not adding ld_device environment attributes because it already exists."),r||i){let o=xa(t)?vw(t):t;return at(at(at({},o),r?{ld_application:r}:{}),i?{ld_device:i}:{})}return t};function Tw(){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:Ew,isMultiKind:Rw,isSingleKind:Cw}=de,Ya=async(t,e,n)=>{let{anonymous:r,key:i}=e;if(r&&!i){let o=await mw(t);e.key=await Ap(o,n)}},Zw=async(t,e)=>{await Ya(t.kind,t,e)},kw=async(t,e)=>{let n=t,{kind:r}=n,i=yp(n,["kind"]);return Promise.all(Object.entries(i).map(([o,s])=>Ya(o,s,e)))},Vw=async(t,e)=>{await Ya("user",t,e)},xw=async(t,e)=>{let n=xp(t);return Cw(n)&&await Zw(n,e),Rw(n)&&await kw(n,e),Ew(n)&&await Vw(n,e),n},Nw=t=>({customBaseURI:t.serviceEndpoints.polling!==Mp,customStreamURI:t.serviceEndpoints.streaming!==Pp,customEventsURI:t.serviceEndpoints.events!==Di.DEFAULT_EVENTS,eventsCapacity:t.capacity,eventsFlushIntervalMillis:Va(t.flushInterval),reconnectTimeMillis:Va(t.streamInitialReconnectDelay),diagnosticRecordingIntervalMillis:Va(t.diagnosticRecordingInterval),allAttributesPrivate:t.allAttributesPrivate,usingSecureMode:!1,bootstrapMode:!1}),Ow=(t,e,n)=>{if(e.sendEvents&&!e.diagnosticOptOut)return new de.DiagnosticsManager(t,n,Nw(e))};function sp(t,e){return{value:e!=null?e:null,variationIndex:null,reason:{kind:"ERROR",errorKind:t}}}function ap(t,e,n){return{value:t,variationIndex:e!=null?e:null,reason:n!=null?n:null}}var Gw=(t,e,n,r,i)=>{if(e.sendEvents)return new de.EventProcessor(me(at({},e),{eventsCapacity:e.capacity}),new LS(t,e,n),r,void 0,i,!1,!0)},lp=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})}},Na=class Yp{constructor(){this.container={index:new Array}}static fromJson(e){let n=new Yp;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)):[]}},Lw=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=gw(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 ip(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 Na,this.G;try{this.G=Na.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 Na}return this.G}async xe(t){var e,n;let r=await this.Ni(),i=await ip(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 Xw(){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 Ww(t,e){let n=[];return Object.entries(t).forEach(([r,i])=>{let o=e[r];(!o||!Ui(i,o))&&n.push(r)}),Object.keys(e).forEach(r=>{t[r]||n.push(r)}),n}function Uw(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=Ww(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 Mw=class{constructor(t,e,n,r,i=()=>Date.now()){this.$=Xw(),this.w=Uw(this.$,r),this.Mt=this.Ri(t,e,n,r,i)}async Ri(t,e,n,r,i=()=>Date.now()){let o=await fw(t.crypto,e);return new Lw(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)}}},cp="unknown hook",Kp="beforeEvaluation",_p="afterEvaluation",Pw="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||cp}catch(n){return t.error("Exception thrown getting metadata for hook. Unable to get hook name."),cp}}function Fw(t,e,n){return e.map(r=>br(t,Kp,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 Aw(t,e,n,r,i){for(let o=e.length-1;o>=0;o-=1){let s=e[o],a=r[o];br(t,_p,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 Jw(t,e,n){return e.map(r=>br(t,Kp,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 Dw(t,e,n,r,i){for(let o=e.length-1;o>=0;o-=1){let s=e[o],a=r[o];br(t,_p,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 Yw(t,e,n){for(let r=e.length-1;r>=0;r-=1){let i=e[r];br(t,Pw,vr(t,i),()=>{var o;return(o=i==null?void 0:i.afterTrack)==null?void 0:o.call(i,n)},void 0)}}var Kw=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=Fw(this.t,i,o),a=r();return Aw(this.t,i,o,s,a),a}identify(t,e){let n=[...this.F],r={context:t,timeout:e},i=Jw(this.t,n,r);return o=>{Dw(this.t,n,r,i,o)}}addHook(t){this.F.push(t)}afterTrack(t){if(this.F.length===0)return;let e=[...this.F];Yw(this.t,e,t)}};function _w(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 Hw(t,e){return`an inspector: "${e}" of an invalid type (${t}) was configured`}function zw(t,e){return`an inspector: "${e}" of type: "${t}" generated an exception`}function Bw(t,e){let n=!1,r={method:(...i)=>{try{t.method(...i)}catch(o){n||(n=!0,e.warn(zw(r.type,r.name)))}},type:t.type,name:t.name,synchronous:t.synchronous};return r}var Hp="flag-used",zp="flag-details-changed",Bp="flag-detail-changed",jp="client-identity-changed",jw=[Hp,zp,Bp,jp];function Qw(t,e){let n=jw.includes(t.type)&&t.method&&typeof t.method=="function";return n||e.warn(Hw(t.type,t.name)),n}var $w=class{constructor(t,e){this.W=[];let n=t.filter(r=>Qw(r,e));this.W=n.map(r=>Bw(r,e))}hasInspectors(){return this.W.length!==0}onFlagUsed(t,e,n){this.W.forEach(r=>{r.type===Hp&&r.method(t,e,n)})}onFlagsChanged(t){this.W.forEach(e=>{e.type===zp&&e.method(t)})}onFlagChanged(t,e){this.W.forEach(n=>{n.type===Bp&&n.method(t,e)})}onIdentityChanged(t){this.W.forEach(e=>{e.type===jp&&e.method(t)})}},qw=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 tI(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:up,ErrorKinds:hp}=de,eI=5,nI=class{constructor(t,e,n,r,i,o){if(this.sdkKey=t,this.autoEnvAttributes=e,this.platform=n,this.a=Tw(),this.Ut=15,this.N=new lp(!1),this.ft=new lp(!0),this.Vt=!1,this.Fi=cw(),!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 dw(r,o),this.logger=this.e.logger,this.Se=AS(this.sdkKey,this.platform.info,this.e.tags,this.e.serviceEndpoints.includeAuthorizationHeader,this.e.userAgentHeaderName),this.E=new Mw(this.platform,t,this.e.maxCachedContexts,this.e.logger),this.L=Ow(t,this.e,n),this.D=Gw(t,this.e,n,this.Se,this.L),this.emitter=new qw,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=tI(this.sdkKey,this.platform,this.e),this.e.getImplementationHooks(this.environmentMetadata).forEach(a=>{s.push(a)}),this.U=new Kw(this.logger,s),this.Q=new $w(this.e.inspectors,this.logger),this.Q.hasInspectors()&&this.U.addHook(_w(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()?xp(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 Vp(`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:eI,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 xw(t,this.platform);this.autoEnvAttributes===Ji.Enabled&&(c=await Iw(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=PS(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(up.MissingContextKeyNoEvent);return}n!==void 0&&!G.Number.is(n)&&((r=this.logger)==null||r.warn(up.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))),sp(hp.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 US(`Wrong type "${I}" for feature flag "${t}"; returning default value`);return this.emitter.emit("error",this.a.getUnwrappedContext(),R),sp(hp.WrongType,e)}}let b=ap(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]=ap(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 rI(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 iI=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)}},oI=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 pp(t){t==null||t.debug("Poll completed after the processor was closed. Skipping processing.")}var sI=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 Ai(_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){pp(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){pp(this.t);return}let p=h;if(p.status!==void 0&&!_i(p.status)){(r=this.t)==null||r.error(Gn(h,"polling request")),(i=this.m)==null||i.call(this,new Ai(_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()}},aI=(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 Wa(_t.InvalidData,"Malformed JSON data in event stream"))};function lI(t,e){e==null||e.debug(`Received ${t} event after processor was closed. Skipping processing.`)}function dp(t){t==null||t.debug("Ping completed after processor was closed. Skipping processing.")}var cI=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=XS(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 Np(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 Wa(_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){lI(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){aI(i,c,this.t,this.m);return}r(l)}else(a=this.m)==null||a.call(this,new Wa(_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){dp(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 Ai(_t.InvalidData,"Malformed JSON data in ping polling response"))}}catch(l){if(this.u){dp(this.t);return}let u=l;(c=this.m)==null||c.call(this,new Ai(_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()}},uI=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 oI(a),this.J=new iI(e,this.dataSourceStatusManager,this.config.logger)}setConnectionParams(t){this.Ji=t}createPollingProcessor(t,e,n,r,i){let o=new sI(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 cI(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 Qp(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 Hi(){return typeof document!==void 0}function Ka(){return typeof window!==void 0}function $p(t,e,n){return Hi()?(document.addEventListener(t,e,n),()=>{document.removeEventListener(t,e,n)}):()=>{}}function qp(t,e,n){return Hi()?(window.addEventListener(t,e,n),()=>{window.removeEventListener(t,e,n)}):()=>{}}function yr(){return Ka()?window.location.href:""}function hI(){return Ka()?window.location.search:""}function pI(){return Ka()?window.location.hash:""}function dI(){if(typeof crypto!==void 0)return crypto;throw Error("Access to a web crypto API is required")}function fI(){return Hi()?document.visibilityState:"visibile"}function mI(t){if(Hi())return document.querySelectorAll(t)}var yI="[BrowserDataManager]",gI=class extends uI{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(`${yI} ${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=np(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(!Np(s))throw s;i=s,o<r&&(this.C(Gn(s,"initial poll request","will retry")),await Op(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,Qp(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=np(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 bI(t){let e=$p("visibilitychange",()=>{fI()==="hidden"&&t()}),n=qp("pagehide",t);return()=>{e(),n()}}function Oa(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function vI(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(`^${Oa(t.url)}/?$`).test(e);case"canonical":return new RegExp(`^${Oa(t.url)}/?$`).test(i);case"substring":return new RegExp(`.*${Oa(t.substring)}.*$`).test(i);case"regex":return new RegExp(t.pattern).test(i);default:return!1}}function SI(t,e){let n=[];return e.forEach(r=>{let i=t.target,{selector:o}=r,s=mI(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 wI=class{constructor(t,e){let n=t.filter(o=>{var s;return(s=o.urls)==null?void 0:s.some(a=>vI(a,yr(),hI(),pI()))}),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=>{SI(s,i).forEach(a=>{e(a)})};this.Te=$p("click",o)}}close(){var t;(t=this.Te)==null||t.call(this)}},II=300,TI=class{constructor(t){this.No=yr();let e=()=>{let r=yr();r!==this.No&&(this.No=r,t())};this.Jt=setInterval(e,II);let n=qp("popstate",e);this.$e=()=>{n()}}close(){var t;this.Jt&&clearInterval(this.Jt),(t=this.$e)==null||t.call(this)}},EI=class{constructor(t,e,n,r,i,o=s=>new TI(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 wI(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 kp(`Encountered error fetching goals: ${t}`))}}close(){var t,e;(t=this.Ne)==null||t.close(),(e=this.qt)==null||e.close()}};function RI(t){return t.kind==="click"}var CI=2,td={fetchGoals:!0,eventUrlTransformer:t=>t,streaming:void 0,plugins:[]},ZI={fetchGoals:G.Boolean,eventUrlTransformer:G.Function,streaming:G.Boolean,plugins:G.createTypeArray("LDPlugin",{})};function kI(t){var e;let n=at({},t);return(e=n.flushInterval)!=null||(n.flushInterval=CI),n}function VI(t){let e=kI(t);return Object.keys(td).forEach(n=>{delete e[n]}),e}function xI(t,e){let n=at({},td);return Object.entries(ZI).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 NI=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}},OI={start:0,end:3},GI={start:4,end:5},Ga={start:6,end:7},La={start:8,end:8},LI={start:9,end:9},XI={start:10,end:15};function WI(){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 UI(t){return t[La.start]=(t[La.start]|128)&191,t[Ga.start]=t[Ga.start]&15|64,`${kn(t,OI)}-${kn(t,GI)}-${kn(t,Ga)}-${kn(t,La)}${kn(t,LI)}-${kn(t,XI)}`}function MI(){let t=WI();return UI(t)}function PI(){return typeof crypto!==void 0&&typeof crypto.randomUUID=="function"?crypto.randomUUID():MI()}var FI=class{createHash(t){return new NI(dI(),t)}randomUUID(){return PI()}};function AI(t){let e=Array.from(t,n=>String.fromCodePoint(n)).join("");return btoa(e)}var JI=class{btoa(t){return AI(new TextEncoder().encode(t))}},DI=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}},YI=class{constructor(t,e){this.vt=t,this.n={},this.A=new ES(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())}},KI=class{fetch(t,e){return fetch(t,e)}createEventSource(t,e){return new YI(t,e)}getEventSourceCapabilities(){return{customMethod:!1,readTimeout:!1,headers:!1}}};function ed(){return typeof localStorage!="undefined"}function _I(){if(!ed())return[];let t=[];for(let e=0;e<localStorage.length;e+=1){let n=localStorage.key(e);n&&t.push(n)}return t}var HI=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}`)}}},zI=class{constructor(t,e){this.encoding=new JI,this.crypto=new FI,this.requests=new KI,ed()&&(this.storage=new HI(t)),this.info=new DI(e)}},BI=class extends nI{constructor(t,e,n={},r){var i;let{logger:o,debug:s}=n,a=o!=null?o:new Fa({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 zI(a,n),u=xI(n,a),h=VI(me(at({},n),{logger:a})),{eventUrlTransformer:p}=u;super(t,e,l,h,(f,m,d,b,v)=>new gI(l,f,t,m,u,()=>({pathGet(I,R){return`/sdk/evalx/${t}/contexts/${$h(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}/${$h(R,I)}`},pathReport(I,R){return`/eval/${t}`},pathPing(I,R){return`/ping/${t}`}}),d,b,v),{getLegacyStorageKeys:()=>_I().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 EI(t,l.requests,c,f=>{a.error(f.message)},(f,m)=>{let d=this.getInternalContext();if(!d)return;let b=p(f);RI(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&&bI(()=>this.flush()))}registerPlugins(t){de.safeRegisterPlugins(this.logger,this.environmentMetadata,t,this.te||[]);let e=this.getDebugOverrides();e&&rI(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=Qp(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 jI(t,e,n,r={},i){let o=new BI(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 QI(t){return new Fa(t)}function nd(t,e,n){return jI(t,e,Ji.Disabled,n)}var $I=Object.defineProperty,qI=(t,e,n)=>e in t?$I(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Te=(t,e,n)=>qI(t,typeof e!="symbol"?e+"":e,n),tT=(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]),eT(r,...n)},eT=(t,...e)=>tT(void 0,null,function*(){try{let{LDObserve:n}=yield Promise.resolve().then(()=>sR);n.recordLog(`${t}${e}`,"warn")}catch(n){}}),nT=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])}},So=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 nT)}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=[]}},rT=Object.defineProperty,iT=Object.defineProperties,oT=Object.getOwnPropertyDescriptors,wo=Object.getOwnPropertySymbols,Ff=Object.prototype.hasOwnProperty,Af=Object.prototype.propertyIsEnumerable,kl=(t,e,n)=>e in t?rT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,j=(t,e)=>{for(var n in e||(e={}))Ff.call(e,n)&&kl(t,n,e[n]);if(wo)for(var n of wo(e))Af.call(e,n)&&kl(t,n,e[n]);return t},An=(t,e)=>iT(t,oT(e)),xr=(t,e)=>{var n={};for(var r in t)Ff.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&wo)for(var r of wo(t))e.indexOf(r)<0&&Af.call(t,r)&&(n[r]=t[r]);return n},Wr=(t,e,n)=>kl(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 sT(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 co(t,e){throw new Error(e)}function aT(t){return typeof t=="object"&&t!==null}function lT(t,e){throw new Error("Unexpected invariant triggered.")}var cT=/\r\n|[\n\r]/g;function Vl(t,e){let n=0,r=1;for(let i of t.body.matchAll(cT)){if(typeof i.index=="number"||lT(),i.index>=e)break;n=i.index+i[0].length,r+=1}return{line:r,column:e+1-n}}function uT(t){return Jf(t.source,Vl(t.source,t.start))}function Jf(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=MF();n?yield n({session_secure_id:this.sessionData.sessionSecureID,payload_id:(this.sessionData.payloadID++).toString(),events:{events:r},messages:BL({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}}),In(this.sessionData),this.events=this.events.slice(r.length),PF(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 pu(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=ks(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(IX);if(r&&(e=r==null?void 0:r.groups)!=null&&e.domain){let i=(n=r.groups.domain)!=null?n:"";return`https://${SX[i]}${wX}`}return vX}},Ci=class extends HX{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:KF,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 oh(f),n!=null&&n.manualStart||this.record.start(),Be.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&&DF(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&&JF(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=AX(n.context),f=JX(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 HF={};Yh(HF,{LDObserve:()=>De,LDRecord:()=>Be,basicLogger:()=>QI,createClient:()=>_F});module.exports=eS(HF);var nS=Object.defineProperty,rS=Object.defineProperties,iS=Object.getOwnPropertyDescriptors,Pi=Object.getOwnPropertySymbols,fp=Object.prototype.hasOwnProperty,mp=Object.prototype.propertyIsEnumerable,Kh=(t,e,n)=>e in t?nS(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,st=(t,e)=>{for(var n in e||(e={}))fp.call(e,n)&&Kh(t,n,e[n]);if(Pi)for(var n of Pi(e))mp.call(e,n)&&Kh(t,n,e[n]);return t},me=(t,e)=>rS(t,iS(e)),yp=(t,e)=>{var n={};for(var r in t)fp.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&Pi)for(var r of Pi(t))e.indexOf(r)<0&&mp.call(t,r)&&(n[r]=t[r]);return n};function oS(t){return`/${t.replace(/~/g,"~0").replace(/\//g,"~1")}`}function gp(t){return t.indexOf("~")?t.replace(/~1/g,"/").replace(/~0/g,"~"):t}function sS(t){return(t.startsWith("/")?t.substring(1):t).split("/").map(e=>gp(e))}function aS(t){return!t.startsWith("/")}function lS(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("/")?oS(n):n}else{if(this.redactionName=t,t===""||t==="/"||!lS(t)){this.isValid=!1,this.g=[];return}aS(t)?this.g=[t]:t.indexOf("/",1)<0?this.g=[gp(t.slice(1))]:this.g=sS(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 cS=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}},bp=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}},vp=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}},Sp=class extends Ln{constructor(t){super(`string matching ${t}`,""),this.expression=t}is(t){return typeof t=="string"&&!!t.match(this.expression)}},uS=class{is(t){return typeof t=="function"}getType(){return"function"}},hS=class{is(t){return typeof t=="boolean"||typeof t=="undefined"||t===null}getType(){return"boolean | undefined | null"}},pS=/^\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d\d*)?(Z|[-+]\d\d(:\d\d)?)/,dS=class{is(t){return typeof t=="number"||typeof t=="string"&&pS.test(t)}getType(){return"date"}},fS=class extends Sp{constructor(){super(/^(\w|\.|-)+$/)}is(t){return super.is(t)&&t!=="kind"}},G=class{static createTypeArray(t,e){return new bp(t,e)}static numberWithMin(t){return new vp(t)}static stringMatchingRegex(t){return new Sp(t)}};G.String=new Ln("string","");G.Number=new Ln("number",0);G.ObjectOrFactory=new cS;G.Object=new Ln("object",{});G.StringArray=new bp("string[]","");G.Boolean=new Ln("boolean",!0);G.Function=new uS;G.Date=new dS;G.Kind=new fS;G.NullableBoolean=new hS;function wp(t){return"kind"in t?G.String.is(t.kind)&&t.kind!=="multi":!1}function Ip(t){return"kind"in t?G.String.is(t.kind)&&t.kind==="multi":!1}function Tp(t){return!("kind"in t)||t.kind===null||t.kind===void 0}function Fi(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=>Fi(n,[...e,t])).map(n=>n===void 0?"null":n).join(",")}]`:`{${Object.keys(t).sort().map(n=>{let r=Fi(t[n],[...e,t]);if(r!==void 0)return`${JSON.stringify(n)}:${r}`}).filter(n=>n!==void 0).join(",")}}`}var Xa="user";function _h(t){return t.includes("%")||t.includes(":")?t.replace(/%/g,"%25").replace(/:/g,"%3A"):t}function mS(t){return t&&G.Object.is(t)}function Hh(t){return G.Kind.is(t)}function zh(t){return G.String.is(t)&&t!==""}function Ca(t,e=!1){return t?t.map(n=>new Nn(n,e)):[]}function yS(t){return t!=null}function gS(t){let e=me(st({},t.custom||[]),{kind:"user",key:String(t.key)});if(yS(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(Hh);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 mS(h)?(c[l]=h,i[l]=Ca((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=>zh(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=Hh(i),s=zh(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=Ca((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=gS(e),n.st={user:Ca(e.privateAttributeNames,!0)},n}static fromLDContext(e){return e?wp(e)?wt.ze(e):Ip(e)?wt.He(e):Tp(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=Xa){return e.isKind?this.kinds:wt.je(e,this.se(n))}key(e=Xa){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}:${_h(this.R[e].key)}`).join(":"):`${this.kind}:${_h(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=Fi(wt.toLDContext(this))}catch(e){}return this.Et}}};xn.UserKind=Xa;var bS=["key","kind","_meta","anonymous"].map(t=>new Nn(t,!0)),vS=["name","ip","firstName","lastName","email","avatar","country"];function SS(t,e){return t.depth===e.length&&e.every((n,r)=>n===t.getComponent(r))}function wS(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=>SS(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 IS=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=>!bS.some(o=>o.compare(i)))}ne(t,e,n,r){let i=this.Ke||r&&e.anonymous===!0,{cloned:o,excluded:s}=wS(e,this.We(t,e,n,i));return t.legacy&&vS.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}},Bh=30*1e3,TS=.5,ES=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(Bh/this.re))}A(){let t=Math.min(this.Dt,this.qe),e=this.re*2**t;return Math.min(e,Bh)}Ye(t){return t-Math.trunc(this.Je()*TS*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}},jh;(function(t){t[t.Valid=0]="Valid",t[t.Initializing=1]="Initializing",t[t.Interrupted=2]="Interrupted",t[t.Closed=3]="Closed"})(jh||(jh={}));var Ai=class extends Error{constructor(t,e,n,r=!0){super(e),this.kind=t,this.status=n,this.name="LaunchDarklyPollingError",this.recoverable=r}},Wa=class extends Error{constructor(t,e,n,r=!0){super(e),this.kind=t,this.code=n,this.name="LaunchDarklyStreamingError",this.recoverable=r}},BF=120*1e3,jF=300*1e3,_t;(function(t){t.Unknown="UNKNOWN",t.NetworkError="NETWORK_ERROR",t.ErrorResponse="ERROR_RESPONSE",t.InvalidData="INVALID_DATA"})(_t||(_t={}));var Ji;(function(t){t[t.Disabled=0]="Disabled",t[t.Enabled=1]="Enabled"})(Ji||(Ji={}));var On;(function(t){t[t.AnalyticsEvents=0]="AnalyticsEvents",t[t.DiagnosticEvent=1]="DiagnosticEvent"})(On||(On={}));var en;(function(t){t[t.Succeeded=0]="Succeeded",t[t.Failed=1]="Failed",t[t.FailedAndMustShutDown=2]="FailedAndMustShutDown"})(en||(en={}));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 RS(t){return typeof t=="symbol"?"NaN":typeof t=="bigint"?`${t}n`:String(Number(t))}function CS(t){return typeof t=="symbol"?"NaN":typeof t=="bigint"?`${t}n`:String(parseInt(t,10))}function ZS(t){return typeof t=="symbol"?"NaN":String(parseFloat(t))}var Za={s:t=>Vn(t),d:t=>RS(t),i:t=>CS(t),f:t=>ZS(t),j:t=>Vn(t),o:t=>Vn(t),O:t=>Vn(t),c:()=>""};function Ua(...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 Za&&t.length){let a=t.shift();r+=(e=Za[s])==null?void 0:e.call(Za,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 kS=["debug","info","warn","error","none"],Fa=class Ep{static get(){return new Ep({})}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):Ua(...e)}catch(r){return Ua(...e)}}oi(e,n){try{e(n)}catch(r){console.error(n)}}x(e,n){var r;if(e>=this.ni){let i=`${kS[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)}},VS={error:G.Function,warn:G.Function,info:G.Function,debug:G.Function},Rp=class{constructor(t,e){Object.entries(VS).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)}},Cp=t=>{let e=new Fa({level:"info",destination:console.error,formatter:Ua});return t?new Rp(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`}},xS=/^(\w|\.|-)+$/,NS=G.stringMatchingRegex(xS),OS={is:(t,e)=>NS.is(t)?t.length>64?{valid:!1,message:Ue.tagValueTooLong(e)}:{valid:!0}:{valid:!1,message:Ue.invalidTagValue(e)}},GS=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}=OS.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(" "))}},LS=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 ka(t){return t.replace(/\/+$/,"")}function Aa(t){return t.replace(/^\/+/,"").replace(/\?$/,"")}var Di=class Zp{constructor(e,n,r=Zp.DEFAULT_EVENTS,i="/bulk",o="/diagnostic",s=!0,a){this.streaming=ka(e),this.polling=ka(n),this.events=ka(r),this.analyticsEventPath=i,this.diagnosticEventPath=o,this.includeAuthorizationHeader=s,this.payloadFilterKey=a}};Di.DEFAULT_EVENTS="https://events.launchdarkly.com";function Ja(t,e=[]){if(e.length===0)return t;let n=e.map(({key:r,value:i})=>`${r}=${i}`);return`${t}?${n.join("&")}`}function XS(t,e,n){let r=Aa(e),i=[...n];return t.payloadFilterKey&&i.push({key:"filter",value:t.payloadFilterKey}),Ja(`${t.streaming}/${r}`,i)}function WS(t,e,n=[]){let r=Aa(e),i=[...n];return t.payloadFilterKey&&i.push({key:"filter",value:t.payloadFilterKey}),Ja(`${t.polling}/${r}`,i)}function Qh(t,e,n=[]){let r=Aa(e);return Ja(`${t.events}/${r}`,n)}var kp=class extends Error{constructor(t){super(t),this.name="LaunchDarklyUnexpectedResponseError"}},US=class extends Error{constructor(t){super(t),this.name="LaunchDarklyClientError"}},Vp=class extends Error{constructor(t){super(t),this.name="LaunchDarklyTimeoutError"}};function _i(t){return t>=400&&t<500?t===400||t===408||t===429:!0}function MS(t){return t===413?!0:_i(t)}function PS(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 Vp(s))},t*1e3)}),cancel:()=>{r(),clearTimeout(n)}}}function xp(t){return t==null?t:JSON.parse(JSON.stringify(t))}function Va(t){return Math.trunc(t*1e3)}var FS=t=>JSON.stringify(t)==="{}",Da=(t,e)=>t&&Object.entries(t).reduce((n,[r,i])=>(i&&!FS(i)&&!(e!=null&&e.includes(r))&&(n[r]=typeof i=="object"?Da(i,e):i),n),{});function Ui(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(!Ui(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(!Ui(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(!Ui(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function AS(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 Np({status:t}){return t?_i(t):!0}var $h=(t,e)=>e.btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),Op=async(t=1e3)=>new Promise(e=>{setTimeout(e,t)}),JS=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}},Ma;(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"})(Ma||(Ma={}));var DS=Ma,Gp=class{static invalidMetricValue(t){return`The track function was called with a non-numeric "metricValue" (${t}), only numeric metric values are supported.`}};Gp.MissingContextKeyNoEvent="Context was unspecified or had no key; event will not be sent";var YS=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=Qh(n.serviceEndpoints,i,[]),this.hi=Qh(n.serviceEndpoints,o,[]),this.T=a,this.di=s}async nt(t,e,n,r){let i={status:en.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 kp(Gn({status:a,message:"some events were dropped"},"event posting")),!_i(a))return MS(a)?i.status=en.Failed:i.status=en.FailedAndMustShutDown,i.error=s,i}catch(a){s=a}return s&&!r?(i.status=en.Failed,i.error=s,i):(await Op(),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 Yi(t){return t.kind==="feature"}function KS(t){return t.kind==="identify"}function _S(t){return t.kind==="migration_op"}var HS=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 zS(t){return`${t.key}:${t.variation!==null&&t.variation!==void 0?t.variation:""}:${t.version!==null&&t.version!==void 0?t.version:""}`}var Lp=class{constructor(t=!1,e){this.fi=t,this.S=e,this.Y=0,this.rt=0,this.at={},this.ot={}}summarizeEvent(t){if(Yi(t)&&!t.excludeFromSummaries){this.y||(this.y=t.context);let e=zS(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 HS(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={}}},BS=class extends Error{constructor(t){super(t),this.name="LaunchDarklyInvalidSDKKeyError"}},jS=class{constructor(t,e){this.S=t,this.t=e,this.Z={}}summarizeEvent(t){var e;if(Yi(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 Lp(!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 Mi(t){let e=Math.trunc(t);return e===1?!0:e===0?!1:Math.floor(Math.random()*e)===0}function QS(t){return t.getSummaries!==void 0}var $S=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 YS(e,n),this.S=new IS(t.allAttributesPrivate,t.privateAttributes.map(a=>new Nn(a))),s?this.X=new jS(this.S,this.t):this.X=new Lp,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 BS("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=[],QS(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(_S(t)){if(Mi(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=Yi(t),r=n&&t.trackEvents||!n,i=this.yi(t),o=KS(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&&Mi(t.samplingRatio)&&this.ut(this.Ot(t,!1)),i&&Mi(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 Yi(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===en.FailedAndMustShutDown&&(this.At=!0),e.serverTime&&(this.me=e.serverTime),e.error)throw e.error}},Xp=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}},Pa=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)}},Wp=class{constructor(t,e=1){this.context=t,this.samplingRatio=e,this.kind="identify",this.creationDate=Date.now()}},qS=class{close(){}async flush(){}sendEvent(){}},tw=class{constructor(t){this.Tt=t}evalEvent(t){var e;return new Pa(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 Pa(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 Wp(t,1)}customEvent(t,e,n,r,i=1){return new Xp(e,t,n!=null?n:void 0,r!=null?r:void 0,i)}},qh="FDv1Fallback";function ew(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 Up=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=[]}},nw=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 Up(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 rw(t){if(t){let e=Object.keys(t).find(n=>n.toLowerCase()==="x-ld-envid");if(e)return{environmentId:t[e]}}}var tp="unknown plugin";function Ki(t,e){try{return e.getMetadata().name||tp}catch(n){return t.error("Exception thrown getting metadata for plugin. Unable to get plugin name."),tp}}function iw(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 ${Ki(t,i)} returned undefined from getHooks.`):s&&s.length>0&&r.push(...s)}catch(s){t.error(`Exception thrown getting hooks for plugin ${Ki(t,i)}. Unable to get hooks.`)}}),r}function ow(t,e,n,r){r.forEach(i=>{try{i.register(n,e)}catch(o){t.error(`Exception thrown registering plugin ${Ki(t,i)}.`)}})}var de=Object.freeze({__proto__:null,ClientMessages:Gp,DiagnosticsManager:JS,ErrorKinds:DS,EventFactoryBase:tw,EventProcessor:$S,FDv1PayloadAdaptor:ew,InputCustomEvent:Xp,InputEvalEvent:Pa,InputIdentifyEvent:Wp,NullEventProcessor:qS,PayloadProcessor:Up,PayloadStreamReader:nw,canonicalize:Fi,initMetadataFromHeaders:rw,isLegacyUser:Tp,isMultiKind:Ip,isSingleKind:wp,safeGetHooks:iw,safeGetName:Ki,safeRegisterPlugins:ow,shouldSample:Mi}),Kt;(function(t){t.Initializing="INITIALIZING",t.Valid="VALID",t.Interrupted="INTERRUPTED",t.SetOffline="SET_OFFLINE",t.Closed="CLOSED"})(Kt||(Kt={}));function sw(t){return t>=200&&t<=299}var ep=class extends Error{constructor(t,e){super(t),this.status=e,this.name="LaunchDarklyRequestError"}},aw=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(sw(e.status))return await e.text();t=e.status}catch(e){throw new ep(e==null?void 0:e.message)}throw new ep(`Unexpected status code: ${t}`,t)}};function np(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=WS(e,f,m);return new aw(r,d,p,h,u)}var rp=new Error("Task has already been executed or shed. This is likely an implementation error. The task will not be executed again.");function lw(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(rp)),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(rp)),s=!0,o.then(a=>{r({status:"shed"},a)})},promise:i,sheddable:n}}function cw(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=lw(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 uw={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},hw=300,Mp="https://clientsdk.launchdarkly.com",Pp="https://clientstream.launchdarkly.com";function pw(t){return t instanceof Rp?t:Cp(t)}var dw=class{constructor(t={},e={getImplementationHooks:()=>[],credentialType:"mobileKey"}){var n,r,i;this.logger=Cp(),this.baseUri=Mp,this.eventsUri=Di.DEFAULT_EVENTS,this.streamUri=Pp,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=hw,this.hooks=[],this.inspectors=[],this.logger=pw(t.logger),this.Ti(t).forEach(o=>this.logger.warn(o)),this.serviceEndpoints=new Di(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 GS({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=uw[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 vp&&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 Fp(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 Ap=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 Jp(t){return async e=>Fp(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 fw(t,e){return gr([{value:"LaunchDarkly",transform:fe},{value:e,transform:Jp(t)}])}async function mw(t){return gr([{value:"LaunchDarkly",transform:fe},{value:"AnonymousKeys",transform:fe},{value:t,transform:fe}])}async function yw(t){return gr([{value:"LaunchDarkly",transform:fe},{value:"ContextKeys",transform:fe},{value:t,transform:fe}])}async function gw(t){return gr([{value:t,transform:fe},{value:"ContextIndex",transform:fe}])}async function ip(t,e,n){return gr([{value:e,transform:fe},{value:n.canonicalKey,transform:Jp(t)}])}var{isLegacyUser:bw,isSingleKind:xa,isMultiKind:op}=de,Dp="1.0",vw=t=>{let e=t,{kind:n}=e,r=yp(e,["kind"]);return{kind:"multi",[n]:r}},Sw=async({crypto:t,info:e},{applicationInfo:n})=>{var r;let{ld_application:i}=e.platformData(),o=(r=Da(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 Fp(t.createHash("sha256").update(s),"base64"),o.envAttributesVersion=o.envAttributesVersion||Dp,o}},ww=async t=>{var e,n,r,i;let{ld_device:o,os:s}=t.info.platformData(),a=(e=Da(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 yw("ld_device");return a.key=await Ap(h,t),a.envAttributesVersion=a.envAttributesVersion||Dp,a}},Iw=async(t,e,n)=>{if(bw(t))return t;let r,i;if(xa(t)&&t.kind!=="ld_application"||op(t)&&!t.ld_application?r=await Sw(e,n):n.logger.warn("Not adding ld_application environment attributes because it already exists."),xa(t)&&t.kind!=="ld_device"||op(t)&&!t.ld_device?i=await ww(e):n.logger.warn("Not adding ld_device environment attributes because it already exists."),r||i){let o=xa(t)?vw(t):t;return st(st(st({},o),r?{ld_application:r}:{}),i?{ld_device:i}:{})}return t};function Tw(){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:Ew,isMultiKind:Rw,isSingleKind:Cw}=de,Ya=async(t,e,n)=>{let{anonymous:r,key:i}=e;if(r&&!i){let o=await mw(t);e.key=await Ap(o,n)}},Zw=async(t,e)=>{await Ya(t.kind,t,e)},kw=async(t,e)=>{let n=t,{kind:r}=n,i=yp(n,["kind"]);return Promise.all(Object.entries(i).map(([o,s])=>Ya(o,s,e)))},Vw=async(t,e)=>{await Ya("user",t,e)},xw=async(t,e)=>{let n=xp(t);return Cw(n)&&await Zw(n,e),Rw(n)&&await kw(n,e),Ew(n)&&await Vw(n,e),n},Nw=t=>({customBaseURI:t.serviceEndpoints.polling!==Mp,customStreamURI:t.serviceEndpoints.streaming!==Pp,customEventsURI:t.serviceEndpoints.events!==Di.DEFAULT_EVENTS,eventsCapacity:t.capacity,eventsFlushIntervalMillis:Va(t.flushInterval),reconnectTimeMillis:Va(t.streamInitialReconnectDelay),diagnosticRecordingIntervalMillis:Va(t.diagnosticRecordingInterval),allAttributesPrivate:t.allAttributesPrivate,usingSecureMode:!1,bootstrapMode:!1}),Ow=(t,e,n)=>{if(e.sendEvents&&!e.diagnosticOptOut)return new de.DiagnosticsManager(t,n,Nw(e))};function sp(t,e){return{value:e!=null?e:null,variationIndex:null,reason:{kind:"ERROR",errorKind:t}}}function ap(t,e,n){return st({value:t,variationIndex:e!=null?e:null},n!==void 0&&{reason:n})}var Gw=(t,e,n,r,i)=>{if(e.sendEvents)return new de.EventProcessor(me(st({},e),{eventsCapacity:e.capacity}),new LS(t,e,n),r,void 0,i,!1,!0)},lp=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})}},Na=class Yp{constructor(){this.container={index:new Array}}static fromJson(e){let n=new Yp;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)):[]}},Lw=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=gw(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 ip(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 Na,this.G;try{this.G=Na.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 Na}return this.G}async xe(t){var e,n;let r=await this.Ni(),i=await ip(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 Xw(){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 Ww(t,e){let n=[];return Object.entries(t).forEach(([r,i])=>{let o=e[r];(!o||!Ui(i,o))&&n.push(r)}),Object.keys(e).forEach(r=>{t[r]||n.push(r)}),n}function Uw(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=Ww(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 Mw=class{constructor(t,e,n,r,i=()=>Date.now()){this.$=Xw(),this.w=Uw(this.$,r),this.Mt=this.Ri(t,e,n,r,i)}async Ri(t,e,n,r,i=()=>Date.now()){let o=await fw(t.crypto,e);return new Lw(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)}}},cp="unknown hook",Kp="beforeEvaluation",_p="afterEvaluation",Pw="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||cp}catch(n){return t.error("Exception thrown getting metadata for hook. Unable to get hook name."),cp}}function Fw(t,e,n){return e.map(r=>br(t,Kp,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 Aw(t,e,n,r,i){for(let o=e.length-1;o>=0;o-=1){let s=e[o],a=r[o];br(t,_p,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 Jw(t,e,n){return e.map(r=>br(t,Kp,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 Dw(t,e,n,r,i){for(let o=e.length-1;o>=0;o-=1){let s=e[o],a=r[o];br(t,_p,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 Yw(t,e,n){for(let r=e.length-1;r>=0;r-=1){let i=e[r];br(t,Pw,vr(t,i),()=>{var o;return(o=i==null?void 0:i.afterTrack)==null?void 0:o.call(i,n)},void 0)}}var Kw=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=Fw(this.t,i,o),a=r();return Aw(this.t,i,o,s,a),a}identify(t,e){let n=[...this.F],r={context:t,timeout:e},i=Jw(this.t,n,r);return o=>{Dw(this.t,n,r,i,o)}}addHook(t){this.F.push(t)}afterTrack(t){if(this.F.length===0)return;let e=[...this.F];Yw(this.t,e,t)}};function _w(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 Hw(t,e){return`an inspector: "${e}" of an invalid type (${t}) was configured`}function zw(t,e){return`an inspector: "${e}" of type: "${t}" generated an exception`}function Bw(t,e){let n=!1,r={method:(...i)=>{try{t.method(...i)}catch(o){n||(n=!0,e.warn(zw(r.type,r.name)))}},type:t.type,name:t.name,synchronous:t.synchronous};return r}var Hp="flag-used",zp="flag-details-changed",Bp="flag-detail-changed",jp="client-identity-changed",jw=[Hp,zp,Bp,jp];function Qw(t,e){let n=jw.includes(t.type)&&t.method&&typeof t.method=="function";return n||e.warn(Hw(t.type,t.name)),n}var $w=class{constructor(t,e){this.W=[];let n=t.filter(r=>Qw(r,e));this.W=n.map(r=>Bw(r,e))}hasInspectors(){return this.W.length!==0}onFlagUsed(t,e,n){this.W.forEach(r=>{r.type===Hp&&r.method(t,e,n)})}onFlagsChanged(t){this.W.forEach(e=>{e.type===zp&&e.method(t)})}onFlagChanged(t,e){this.W.forEach(n=>{n.type===Bp&&n.method(t,e)})}onIdentityChanged(t){this.W.forEach(e=>{e.type===jp&&e.method(t)})}},qw=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 tI(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:up,ErrorKinds:hp}=de,eI=5,nI=class{constructor(t,e,n,r,i,o){if(this.sdkKey=t,this.autoEnvAttributes=e,this.platform=n,this.a=Tw(),this.Ut=15,this.N=new lp(!1),this.ft=new lp(!0),this.Vt=!1,this.Fi=cw(),!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 dw(r,o),this.logger=this.e.logger,this.Se=AS(this.sdkKey,this.platform.info,this.e.tags,this.e.serviceEndpoints.includeAuthorizationHeader,this.e.userAgentHeaderName),this.E=new Mw(this.platform,t,this.e.maxCachedContexts,this.e.logger),this.L=Ow(t,this.e,n),this.D=Gw(t,this.e,n,this.Se,this.L),this.emitter=new qw,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=tI(this.sdkKey,this.platform,this.e),this.e.getImplementationHooks(this.environmentMetadata).forEach(a=>{s.push(a)}),this.U=new Kw(this.logger,s),this.Q=new $w(this.e.inspectors,this.logger),this.Q.hasInspectors()&&this.U.addHook(_w(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()?xp(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 Vp(`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:eI,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 xw(t,this.platform);this.autoEnvAttributes===Ji.Enabled&&(c=await Iw(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=PS(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(up.MissingContextKeyNoEvent);return}n!==void 0&&!G.Number.is(n)&&((r=this.logger)==null||r.warn(up.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))),sp(hp.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 US(`Wrong type "${I}" for feature flag "${t}"; returning default value`);return this.emitter.emit("error",this.a.getUnwrappedContext(),R),sp(hp.WrongType,e)}}let b=ap(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]=ap(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 rI(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 iI=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)}},oI=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 pp(t){t==null||t.debug("Poll completed after the processor was closed. Skipping processing.")}var sI=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 Ai(_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){pp(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){pp(this.t);return}let p=h;if(p.status!==void 0&&!_i(p.status)){(r=this.t)==null||r.error(Gn(h,"polling request")),(i=this.m)==null||i.call(this,new Ai(_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()}},aI=(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 Wa(_t.InvalidData,"Malformed JSON data in event stream"))};function lI(t,e){e==null||e.debug(`Received ${t} event after processor was closed. Skipping processing.`)}function dp(t){t==null||t.debug("Ping completed after processor was closed. Skipping processing.")}var cI=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=XS(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 Np(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 Wa(_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){lI(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){aI(i,c,this.t,this.m);return}r(l)}else(a=this.m)==null||a.call(this,new Wa(_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){dp(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 Ai(_t.InvalidData,"Malformed JSON data in ping polling response"))}}catch(l){if(this.u){dp(this.t);return}let u=l;(c=this.m)==null||c.call(this,new Ai(_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()}},uI=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 oI(a),this.J=new iI(e,this.dataSourceStatusManager,this.config.logger)}setConnectionParams(t){this.Ji=t}createPollingProcessor(t,e,n,r,i){let o=new sI(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 cI(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 Qp(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 Hi(){return typeof document!==void 0}function Ka(){return typeof window!==void 0}function $p(t,e,n){return Hi()?(document.addEventListener(t,e,n),()=>{document.removeEventListener(t,e,n)}):()=>{}}function qp(t,e,n){return Hi()?(window.addEventListener(t,e,n),()=>{window.removeEventListener(t,e,n)}):()=>{}}function yr(){return Ka()?window.location.href:""}function hI(){return Ka()?window.location.search:""}function pI(){return Ka()?window.location.hash:""}function dI(){if(typeof crypto!==void 0)return crypto;throw Error("Access to a web crypto API is required")}function fI(){return Hi()?document.visibilityState:"visibile"}function mI(t){if(Hi())return document.querySelectorAll(t)}var yI="[BrowserDataManager]",gI=class extends uI{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(`${yI} ${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=np(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(!Np(s))throw s;i=s,o<r&&(this.C(Gn(s,"initial poll request","will retry")),await Op(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,Qp(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=np(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 bI(t){let e=$p("visibilitychange",()=>{fI()==="hidden"&&t()}),n=qp("pagehide",t);return()=>{e(),n()}}function Oa(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function vI(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(`^${Oa(t.url)}/?$`).test(e);case"canonical":return new RegExp(`^${Oa(t.url)}/?$`).test(i);case"substring":return new RegExp(`.*${Oa(t.substring)}.*$`).test(i);case"regex":return new RegExp(t.pattern).test(i);default:return!1}}function SI(t,e){let n=[];return e.forEach(r=>{let i=t.target,{selector:o}=r,s=mI(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 wI=class{constructor(t,e){let n=t.filter(o=>{var s;return(s=o.urls)==null?void 0:s.some(a=>vI(a,yr(),hI(),pI()))}),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=>{SI(s,i).forEach(a=>{e(a)})};this.Te=$p("click",o)}}close(){var t;(t=this.Te)==null||t.call(this)}},II=300,TI=class{constructor(t){this.No=yr();let e=()=>{let r=yr();r!==this.No&&(this.No=r,t())};this.Jt=setInterval(e,II);let n=qp("popstate",e);this.$e=()=>{n()}}close(){var t;this.Jt&&clearInterval(this.Jt),(t=this.$e)==null||t.call(this)}},EI=class{constructor(t,e,n,r,i,o=s=>new TI(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 wI(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 kp(`Encountered error fetching goals: ${t}`))}}close(){var t,e;(t=this.Ne)==null||t.close(),(e=this.qt)==null||e.close()}};function RI(t){return t.kind==="click"}var CI=2,td={fetchGoals:!0,eventUrlTransformer:t=>t,streaming:void 0,plugins:[]},ZI={fetchGoals:G.Boolean,eventUrlTransformer:G.Function,streaming:G.Boolean,plugins:G.createTypeArray("LDPlugin",{})};function kI(t){var e;let n=st({},t);return(e=n.flushInterval)!=null||(n.flushInterval=CI),n}function VI(t){let e=kI(t);return Object.keys(td).forEach(n=>{delete e[n]}),e}function xI(t,e){let n=st({},td);return Object.entries(ZI).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 NI=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}},OI={start:0,end:3},GI={start:4,end:5},Ga={start:6,end:7},La={start:8,end:8},LI={start:9,end:9},XI={start:10,end:15};function WI(){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 UI(t){return t[La.start]=(t[La.start]|128)&191,t[Ga.start]=t[Ga.start]&15|64,`${kn(t,OI)}-${kn(t,GI)}-${kn(t,Ga)}-${kn(t,La)}${kn(t,LI)}-${kn(t,XI)}`}function MI(){let t=WI();return UI(t)}function PI(){return typeof crypto!==void 0&&typeof crypto.randomUUID=="function"?crypto.randomUUID():MI()}var FI=class{createHash(t){return new NI(dI(),t)}randomUUID(){return PI()}};function AI(t){let e=Array.from(t,n=>String.fromCodePoint(n)).join("");return btoa(e)}var JI=class{btoa(t){return AI(new TextEncoder().encode(t))}},DI=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}},YI=class{constructor(t,e){this.vt=t,this.n={},this.A=new ES(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())}},KI=class{fetch(t,e){return fetch(t,e)}createEventSource(t,e){return new YI(t,e)}getEventSourceCapabilities(){return{customMethod:!1,readTimeout:!1,headers:!1}}};function ed(){return typeof localStorage!="undefined"}function _I(){if(!ed())return[];let t=[];for(let e=0;e<localStorage.length;e+=1){let n=localStorage.key(e);n&&t.push(n)}return t}var HI=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}`)}}},zI=class{constructor(t,e){this.encoding=new JI,this.crypto=new FI,this.requests=new KI,ed()&&(this.storage=new HI(t)),this.info=new DI(e)}},BI=class extends nI{constructor(t,e,n={},r){var i;let{logger:o,debug:s}=n,a=o!=null?o:new Fa({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 zI(a,n),u=xI(n,a),h=VI(me(st({},n),{logger:a})),{eventUrlTransformer:p}=u;super(t,e,l,h,(f,m,d,b,v)=>new gI(l,f,t,m,u,()=>({pathGet(I,R){return`/sdk/evalx/${t}/contexts/${$h(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}/${$h(R,I)}`},pathReport(I,R){return`/eval/${t}`},pathPing(I,R){return`/ping/${t}`}}),d,b,v),{getLegacyStorageKeys:()=>_I().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 EI(t,l.requests,c,f=>{a.error(f.message)},(f,m)=>{let d=this.getInternalContext();if(!d)return;let b=p(f);RI(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&&bI(()=>this.flush()))}registerPlugins(t){de.safeRegisterPlugins(this.logger,this.environmentMetadata,t,this.te||[]);let e=this.getDebugOverrides();e&&rI(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=Qp(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 jI(t,e,n,r={},i){let o=new BI(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 QI(t){return new Fa(t)}function nd(t,e,n){return jI(t,e,Ji.Disabled,n)}var $I=Object.defineProperty,qI=(t,e,n)=>e in t?$I(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Te=(t,e,n)=>qI(t,typeof e!="symbol"?e+"":e,n),tT=(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]),eT(r,...n)},eT=(t,...e)=>tT(void 0,null,function*(){try{let{LDObserve:n}=yield Promise.resolve().then(()=>sR);n.recordLog(`${t}${e}`,"warn")}catch(n){}}),nT=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])}},So=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 nT)}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=[]}},rT=Object.defineProperty,iT=Object.defineProperties,oT=Object.getOwnPropertyDescriptors,wo=Object.getOwnPropertySymbols,Ff=Object.prototype.hasOwnProperty,Af=Object.prototype.propertyIsEnumerable,kl=(t,e,n)=>e in t?rT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,j=(t,e)=>{for(var n in e||(e={}))Ff.call(e,n)&&kl(t,n,e[n]);if(wo)for(var n of wo(e))Af.call(e,n)&&kl(t,n,e[n]);return t},An=(t,e)=>iT(t,oT(e)),xr=(t,e)=>{var n={};for(var r in t)Ff.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&wo)for(var r of wo(t))e.indexOf(r)<0&&Af.call(t,r)&&(n[r]=t[r]);return n},Wr=(t,e,n)=>kl(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 sT(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 co(t,e){throw new Error(e)}function aT(t){return typeof t=="object"&&t!==null}function lT(t,e){throw new Error("Unexpected invariant triggered.")}var cT=/\r\n|[\n\r]/g;function Vl(t,e){let n=0,r=1;for(let i of t.body.matchAll(cT)){if(typeof i.index=="number"||lT(),i.index>=e)break;n=i.index+i[0].length,r+=1}return{line:r,column:e+1-n}}function uT(t){return Jf(t.source,Vl(t.source,t.start))}function Jf(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+rd([[`${s} |`,m[0]],...m.slice(1,p+1).map(d=>["|",d]),["|","^".padStart(f)],["|",m[p+1]]])}return l+rd([[`${s-1} |`,u[i-1]],[`${s} |`,h],["|","^".padStart(c)],[`${s+1} |`,u[i+1]]])}function rd(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 hT(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 pT=class Df extends Error{constructor(e,...n){var r,i,o;let{nodes:s,source:a,positions:c,path:l,originalError:u,extensions:h}=hT(n);super(e),this.name="GraphQLError",this.path=l!=null?l:void 0,this.originalError=u!=null?u:void 0,this.nodes=id(Array.isArray(s)?s:s?[s]:void 0);let p=id((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=>Vl(a,m)):p==null?void 0:p.map(m=>Vl(m.source,m.start));let f=aT(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,Df):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
|
|