hanzi-browse 2.3.2 → 2.3.3
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/README.md +4 -2
- package/dist/agent/domain-skills.json +27 -1
- package/dist/agent/system-prompt.js +6 -2
- package/dist/cli/setup.d.ts +6 -0
- package/dist/cli/setup.js +211 -29
- package/dist/cli.js +17 -3
- package/dist/dashboard/assets/{index-dnFOSpJs.js → index-AKm32GEX.js} +15 -15
- package/dist/dashboard/index.html +1 -1
- package/dist/mcp/tools.js +39 -32
- package/dist/telemetry.js +7 -3
- package/package.json +1 -1
- package/skills/a11y-auditor/SKILL.md +1 -0
- package/skills/apartment-finder/SKILL.md +211 -0
- package/skills/competitor-monitor/SKILL.md +1 -0
- package/skills/competitor-researcher/SKILL.md +434 -0
- package/skills/data-extractor/SKILL.md +1 -0
- package/skills/e2e-tester/SKILL.md +1 -0
- package/skills/hanzi-browse/SKILL.md +120 -112
- package/skills/job-applier/SKILL.md +1 -0
- package/skills/linkedin-prospector/SKILL.md +1 -0
- package/skills/seo-checker/SKILL.md +14 -1
- package/skills/social-poster/SKILL.md +1 -0
- package/skills/x-marketer/SKILL.md +1 -0
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var zr,re,Ll,dt,go,jl,Ul,Hl,Ai,Ls,js,gr={},vr=[],nd=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Wr=Array.isArray;function Je(t,e){for(var n in e)t[n]=e[n];return t}function Fi(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function h(t,e,n){var r,s,i,o={};for(i in e)i=="key"?r=e[i]:i=="ref"?s=e[i]:o[i]=e[i];if(arguments.length>2&&(o.children=arguments.length>3?zr.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(i in t.defaultProps)o[i]===void 0&&(o[i]=t.defaultProps[i]);return ir(t,o,r,s,null)}function ir(t,e,n,r,s){var i={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++Ll,__i:-1,__u:0};return s==null&&re.vnode!=null&&re.vnode(i),i}function Tt(t){return t.children}function or(t,e){this.props=t,this.context=e}function Vt(t,e){if(e==null)return t.__?Vt(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?Vt(t):null}function rd(t){if(t.__P&&t.__d){var e=t.__v,n=e.__e,r=[],s=[],i=Je({},e);i.__v=e.__v+1,re.vnode&&re.vnode(i),Ni(t.__P,i,e,t.__n,t.__P.namespaceURI,32&e.__u?[n]:null,r,n??Vt(e),!!(32&e.__u),s),i.__v=e.__v,i.__.__k[i.__i]=i,ql(r,i,s),e.__e=e.__=null,i.__e!=n&&Bl(i)}}function Bl(t){if((t=t.__)!=null&&t.__c!=null)return t.__e=t.__c.base=null,t.__k.some(function(e){if(e!=null&&e.__e!=null)return t.__e=t.__c.base=e.__e}),Bl(t)}function vo(t){(!t.__d&&(t.__d=!0)&&dt.push(t)&&!mr.__r++||go!=re.debounceRendering)&&((go=re.debounceRendering)||jl)(mr)}function mr(){try{for(var t,e=1;dt.length;)dt.length>e&&dt.sort(Ul),t=dt.shift(),e=dt.length,rd(t)}finally{dt.length=mr.__r=0}}function zl(t,e,n,r,s,i,o,a,l,c,u){var d,p,f,g,_,P,m,b=r&&r.__k||vr,C=e.length;for(l=sd(n,e,b,l,C),d=0;d<C;d++)(f=n.__k[d])!=null&&(p=f.__i!=-1&&b[f.__i]||gr,f.__i=d,P=Ni(t,f,p,s,i,o,a,l,c,u),g=f.__e,f.ref&&p.ref!=f.ref&&(p.ref&&Mi(p.ref,null,f),u.push(f.ref,f.__c||g,f)),_==null&&g!=null&&(_=g),(m=!!(4&f.__u))||p.__k===f.__k?l=Wl(f,l,t,m):typeof f.type=="function"&&P!==void 0?l=P:g&&(l=g.nextSibling),f.__u&=-7);return n.__e=_,l}function sd(t,e,n,r,s){var i,o,a,l,c,u=n.length,d=u,p=0;for(t.__k=new Array(s),i=0;i<s;i++)(o=e[i])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=t.__k[i]=ir(null,o,null,null,null):Wr(o)?o=t.__k[i]=ir(Tt,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=t.__k[i]=ir(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):t.__k[i]=o,l=i+p,o.__=t,o.__b=t.__b+1,a=null,(c=o.__i=id(o,n,l,d))!=-1&&(d--,(a=n[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(s>u?p--:s<u&&p++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?p--:c==l+1?p++:(c>l?p--:p++,o.__u|=4))):t.__k[i]=null;if(d)for(i=0;i<u;i++)(a=n[i])!=null&&!(2&a.__u)&&(a.__e==r&&(r=Vt(a)),Vl(a,a));return r}function Wl(t,e,n,r){var s,i;if(typeof t.type=="function"){for(s=t.__k,i=0;s&&i<s.length;i++)s[i]&&(s[i].__=t,e=Wl(s[i],e,n,r));return e}t.__e!=e&&(r&&(e&&t.type&&!e.parentNode&&(e=Vt(t)),n.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function id(t,e,n,r){var s,i,o,a=t.key,l=t.type,c=e[n],u=c!=null&&(2&c.__u)==0;if(c===null&&a==null||u&&a==c.key&&l==c.type)return n;if(r>(u?1:0)){for(s=n-1,i=n+1;s>=0||i<e.length;)if((c=e[o=s>=0?s--:i++])!=null&&!(2&c.__u)&&a==c.key&&l==c.type)return o}return-1}function mo(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||nd.test(e)?n:n+"px"}function Gn(t,e,n,r,s){var i,o;e:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||mo(t.style,e,"");if(n)for(e in n)r&&n[e]==r[e]||mo(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")i=e!=(e=e.replace(Hl,"$1")),o=e.toLowerCase(),e=o in t||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+i]=n,n?r?n.u=r.u:(n.u=Ai,t.addEventListener(e,i?js:Ls,i)):t.removeEventListener(e,i?js:Ls,i);else{if(s=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function yo(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e.t==null)e.t=Ai++;else if(e.t<n.u)return;return n(re.event?re.event(e):e)}}}function Ni(t,e,n,r,s,i,o,a,l,c){var u,d,p,f,g,_,P,m,b,C,x,S,k,w,E,I=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),i=[a=e.__e=n.__e]),(u=re.__b)&&u(e);e:if(typeof I=="function")try{if(m=e.props,b=I.prototype&&I.prototype.render,C=(u=I.contextType)&&r[u.__c],x=u?C?C.props.value:u.__:r,n.__c?P=(d=e.__c=n.__c).__=d.__E:(b?e.__c=d=new I(m,x):(e.__c=d=new or(m,x),d.constructor=I,d.render=ad),C&&C.sub(d),d.state||(d.state={}),d.__n=r,p=d.__d=!0,d.__h=[],d._sb=[]),b&&d.__s==null&&(d.__s=d.state),b&&I.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Je({},d.__s)),Je(d.__s,I.getDerivedStateFromProps(m,d.__s))),f=d.props,g=d.state,d.__v=e,p)b&&I.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),b&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(b&&I.getDerivedStateFromProps==null&&m!==f&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(m,x),e.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(m,d.__s,x)===!1){e.__v!=n.__v&&(d.props=m,d.state=d.__s,d.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(A){A&&(A.__=e)}),vr.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(m,d.__s,x),b&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(f,g,_)})}if(d.context=x,d.props=m,d.__P=t,d.__e=!1,S=re.__r,k=0,b)d.state=d.__s,d.__d=!1,S&&S(e),u=d.render(d.props,d.state,d.context),vr.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,S&&S(e),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++k<25);d.state=d.__s,d.getChildContext!=null&&(r=Je(Je({},r),d.getChildContext())),b&&!p&&d.getSnapshotBeforeUpdate!=null&&(_=d.getSnapshotBeforeUpdate(f,g)),w=u!=null&&u.type===Tt&&u.key==null?Gl(u.props.children):u,a=zl(t,Wr(w)?w:[w],e,n,r,s,i,o,a,l,c),d.base=e.__e,e.__u&=-161,d.__h.length&&o.push(d),P&&(d.__E=d.__=null)}catch(A){if(e.__v=null,l||i!=null)if(A.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;i[i.indexOf(a)]=null,e.__e=a}else{for(E=i.length;E--;)Fi(i[E]);Us(e)}else e.__e=n.__e,e.__k=n.__k,A.then||Us(e);re.__e(A,e,n)}else i==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):a=e.__e=od(n.__e,e,n,r,s,i,o,l,c);return(u=re.diffed)&&u(e),128&e.__u?void 0:a}function Us(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(Us))}function ql(t,e,n){for(var r=0;r<n.length;r++)Mi(n[r],n[++r],n[++r]);re.__c&&re.__c(e,t),t.some(function(s){try{t=s.__h,s.__h=[],t.some(function(i){i.call(s)})}catch(i){re.__e(i,s.__v)}})}function Gl(t){return typeof t!="object"||t==null||t.__b>0?t:Wr(t)?t.map(Gl):Je({},t)}function od(t,e,n,r,s,i,o,a,l){var c,u,d,p,f,g,_,P=n.props||gr,m=e.props,b=e.type;if(b=="svg"?s="http://www.w3.org/2000/svg":b=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c<i.length;c++)if((f=i[c])&&"setAttribute"in f==!!b&&(b?f.localName==b:f.nodeType==3)){t=f,i[c]=null;break}}if(t==null){if(b==null)return document.createTextNode(m);t=document.createElementNS(s,b,m.is&&m),a&&(re.__m&&re.__m(e,i),a=!1),i=null}if(b==null)P===m||a&&t.data==m||(t.data=m);else{if(i=i&&zr.call(t.childNodes),!a&&i!=null)for(P={},c=0;c<t.attributes.length;c++)P[(f=t.attributes[c]).name]=f.value;for(c in P)f=P[c],c=="dangerouslySetInnerHTML"?d=f:c=="children"||c in m||c=="value"&&"defaultValue"in m||c=="checked"&&"defaultChecked"in m||Gn(t,c,null,f,s);for(c in m)f=m[c],c=="children"?p=f:c=="dangerouslySetInnerHTML"?u=f:c=="value"?g=f:c=="checked"?_=f:a&&typeof f!="function"||P[c]===f||Gn(t,c,f,P[c],s);if(u)a||d&&(u.__html==d.__html||u.__html==t.innerHTML)||(t.innerHTML=u.__html),e.__k=[];else if(d&&(t.innerHTML=""),zl(e.type=="template"?t.content:t,Wr(p)?p:[p],e,n,r,b=="foreignObject"?"http://www.w3.org/1999/xhtml":s,i,o,i?i[0]:n.__k&&Vt(n,0),a,l),i!=null)for(c=i.length;c--;)Fi(i[c]);a||(c="value",b=="progress"&&g==null?t.removeAttribute("value"):g!=null&&(g!==t[c]||b=="progress"&&!g||b=="option"&&g!=P[c])&&Gn(t,c,g,P[c],s),c="checked",_!=null&&_!=t[c]&&Gn(t,c,_,P[c],s))}return t}function Mi(t,e,n){try{if(typeof t=="function"){var r=typeof t.__u=="function";r&&t.__u(),r&&e==null||(t.__u=t(e))}else t.current=e}catch(s){re.__e(s,n)}}function Vl(t,e,n){var r,s;if(re.unmount&&re.unmount(t),(r=t.ref)&&(r.current&&r.current!=t.__e||Mi(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){re.__e(i,e)}r.base=r.__P=null}if(r=t.__k)for(s=0;s<r.length;s++)r[s]&&Vl(r[s],e,n||typeof t.type!="function");n||Fi(t.__e),t.__c=t.__=t.__e=void 0}function ad(t,e,n){return this.constructor(t,n)}function ld(t,e,n){var r,s,i,o;e==document&&(e=document.documentElement),re.__&&re.__(t,e),s=(r=!1)?null:e.__k,i=[],o=[],Ni(e,t=e.__k=h(Tt,null,[t]),s||gr,gr,e.namespaceURI,s?null:e.firstChild?zr.call(e.childNodes):null,i,s?s.__e:e.firstChild,r,o),ql(i,t,o)}zr=vr.slice,re={__e:function(t,e,n,r){for(var s,i,o;e=e.__;)if((s=e.__c)&&!s.__)try{if((i=s.constructor)&&i.getDerivedStateFromError!=null&&(s.setState(i.getDerivedStateFromError(t)),o=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(t,r||{}),o=s.__d),o)return s.__E=s}catch(a){t=a}throw t}},Ll=0,or.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Je({},this.state),typeof t=="function"&&(t=t(Je({},n),this.props)),t&&Je(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),vo(this))},or.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),vo(this))},or.prototype.render=Tt,dt=[],jl=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ul=function(t,e){return t.__v.__b-e.__v.__b},mr.__r=0,Hl=/(PointerCapture)$|Capture$/i,Ai=0,Ls=yo(!1),js=yo(!0);const U=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,J=globalThis,xt="10.46.0";function qr(){return Gr(J),J}function Gr(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||xt,e[xt]=e[xt]||{}}function sn(t,e,n=J){const r=n.__SENTRY__=n.__SENTRY__||{},s=r[xt]=r[xt]||{};return s[t]||(s[t]=e())}const cd=["debug","info","warn","error","log","assert","trace"],ud="Sentry Logger ",yr={};function on(t){if(!("console"in J))return t();const e=J.console,n={},r=Object.keys(yr);r.forEach(s=>{const i=yr[s];n[s]=e[s],e[s]=i});try{return t()}finally{r.forEach(s=>{e[s]=n[s]})}}function dd(){Li().enabled=!0}function hd(){Li().enabled=!1}function Yl(){return Li().enabled}function pd(...t){Di("log",...t)}function fd(...t){Di("warn",...t)}function _d(...t){Di("error",...t)}function Di(t,...e){U&&Yl()&&on(()=>{J.console[t](`${ud}[${t}]:`,...e)})}function Li(){return U?sn("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const L={enable:dd,disable:hd,isEnabled:Yl,log:pd,warn:fd,error:_d},Kl=50,Pt="?",bo=/\(error: (.*)\)/,Eo=/captureMessage|captureException/;function Jl(...t){const e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,s=0)=>{const i=[],o=n.split(`
|
|
2
|
-
`);for(let a=r;a<o.length;a++){let l=o[a];l.length>1024&&(l=l.slice(0,1024));const c=bo.test(l)?l.replace(bo,"$1"):l;if(!c.match(/\S*Error: /)){for(const u of e){const d=u(c);if(d){i.push(d);break}}if(i.length>=
|
|
1
|
+
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var zr,re,Dl,dt,go,Ll,jl,Ul,Ai,Ls,js,gr={},vr=[],td=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Wr=Array.isArray;function Je(t,e){for(var n in e)t[n]=e[n];return t}function Fi(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function h(t,e,n){var r,s,i,o={};for(i in e)i=="key"?r=e[i]:i=="ref"?s=e[i]:o[i]=e[i];if(arguments.length>2&&(o.children=arguments.length>3?zr.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(i in t.defaultProps)o[i]===void 0&&(o[i]=t.defaultProps[i]);return ir(t,o,r,s,null)}function ir(t,e,n,r,s){var i={type:t,props:e,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++Dl,__i:-1,__u:0};return s==null&&re.vnode!=null&&re.vnode(i),i}function Tt(t){return t.children}function or(t,e){this.props=t,this.context=e}function Vt(t,e){if(e==null)return t.__?Vt(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?Vt(t):null}function nd(t){if(t.__P&&t.__d){var e=t.__v,n=e.__e,r=[],s=[],i=Je({},e);i.__v=e.__v+1,re.vnode&&re.vnode(i),Ni(t.__P,i,e,t.__n,t.__P.namespaceURI,32&e.__u?[n]:null,r,n??Vt(e),!!(32&e.__u),s),i.__v=e.__v,i.__.__k[i.__i]=i,Wl(r,i,s),e.__e=e.__=null,i.__e!=n&&Hl(i)}}function Hl(t){if((t=t.__)!=null&&t.__c!=null)return t.__e=t.__c.base=null,t.__k.some(function(e){if(e!=null&&e.__e!=null)return t.__e=t.__c.base=e.__e}),Hl(t)}function vo(t){(!t.__d&&(t.__d=!0)&&dt.push(t)&&!mr.__r++||go!=re.debounceRendering)&&((go=re.debounceRendering)||Ll)(mr)}function mr(){try{for(var t,e=1;dt.length;)dt.length>e&&dt.sort(jl),t=dt.shift(),e=dt.length,nd(t)}finally{dt.length=mr.__r=0}}function Bl(t,e,n,r,s,i,o,a,l,c,u){var d,p,f,g,_,P,m,b=r&&r.__k||vr,C=e.length;for(l=rd(n,e,b,l,C),d=0;d<C;d++)(f=n.__k[d])!=null&&(p=f.__i!=-1&&b[f.__i]||gr,f.__i=d,P=Ni(t,f,p,s,i,o,a,l,c,u),g=f.__e,f.ref&&p.ref!=f.ref&&(p.ref&&Mi(p.ref,null,f),u.push(f.ref,f.__c||g,f)),_==null&&g!=null&&(_=g),(m=!!(4&f.__u))||p.__k===f.__k?l=zl(f,l,t,m):typeof f.type=="function"&&P!==void 0?l=P:g&&(l=g.nextSibling),f.__u&=-7);return n.__e=_,l}function rd(t,e,n,r,s){var i,o,a,l,c,u=n.length,d=u,p=0;for(t.__k=new Array(s),i=0;i<s;i++)(o=e[i])!=null&&typeof o!="boolean"&&typeof o!="function"?(typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?o=t.__k[i]=ir(null,o,null,null,null):Wr(o)?o=t.__k[i]=ir(Tt,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=t.__k[i]=ir(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):t.__k[i]=o,l=i+p,o.__=t,o.__b=t.__b+1,a=null,(c=o.__i=sd(o,n,l,d))!=-1&&(d--,(a=n[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(s>u?p--:s<u&&p++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?p--:c==l+1?p++:(c>l?p--:p++,o.__u|=4))):t.__k[i]=null;if(d)for(i=0;i<u;i++)(a=n[i])!=null&&!(2&a.__u)&&(a.__e==r&&(r=Vt(a)),Gl(a,a));return r}function zl(t,e,n,r){var s,i;if(typeof t.type=="function"){for(s=t.__k,i=0;s&&i<s.length;i++)s[i]&&(s[i].__=t,e=zl(s[i],e,n,r));return e}t.__e!=e&&(r&&(e&&t.type&&!e.parentNode&&(e=Vt(t)),n.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function sd(t,e,n,r){var s,i,o,a=t.key,l=t.type,c=e[n],u=c!=null&&(2&c.__u)==0;if(c===null&&a==null||u&&a==c.key&&l==c.type)return n;if(r>(u?1:0)){for(s=n-1,i=n+1;s>=0||i<e.length;)if((c=e[o=s>=0?s--:i++])!=null&&!(2&c.__u)&&a==c.key&&l==c.type)return o}return-1}function mo(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||td.test(e)?n:n+"px"}function Gn(t,e,n,r,s){var i,o;e:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof r=="string"&&(t.style.cssText=r=""),r)for(e in r)n&&e in n||mo(t.style,e,"");if(n)for(e in n)r&&n[e]==r[e]||mo(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")i=e!=(e=e.replace(Ul,"$1")),o=e.toLowerCase(),e=o in t||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+i]=n,n?r?n.u=r.u:(n.u=Ai,t.addEventListener(e,i?js:Ls,i)):t.removeEventListener(e,i?js:Ls,i);else{if(s=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function yo(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e.t==null)e.t=Ai++;else if(e.t<n.u)return;return n(re.event?re.event(e):e)}}}function Ni(t,e,n,r,s,i,o,a,l,c){var u,d,p,f,g,_,P,m,b,C,x,S,k,w,E,I=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),i=[a=e.__e=n.__e]),(u=re.__b)&&u(e);e:if(typeof I=="function")try{if(m=e.props,b=I.prototype&&I.prototype.render,C=(u=I.contextType)&&r[u.__c],x=u?C?C.props.value:u.__:r,n.__c?P=(d=e.__c=n.__c).__=d.__E:(b?e.__c=d=new I(m,x):(e.__c=d=new or(m,x),d.constructor=I,d.render=od),C&&C.sub(d),d.state||(d.state={}),d.__n=r,p=d.__d=!0,d.__h=[],d._sb=[]),b&&d.__s==null&&(d.__s=d.state),b&&I.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Je({},d.__s)),Je(d.__s,I.getDerivedStateFromProps(m,d.__s))),f=d.props,g=d.state,d.__v=e,p)b&&I.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),b&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(b&&I.getDerivedStateFromProps==null&&m!==f&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(m,x),e.__v==n.__v||!d.__e&&d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(m,d.__s,x)===!1){e.__v!=n.__v&&(d.props=m,d.state=d.__s,d.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(A){A&&(A.__=e)}),vr.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&o.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(m,d.__s,x),b&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(f,g,_)})}if(d.context=x,d.props=m,d.__P=t,d.__e=!1,S=re.__r,k=0,b)d.state=d.__s,d.__d=!1,S&&S(e),u=d.render(d.props,d.state,d.context),vr.push.apply(d.__h,d._sb),d._sb=[];else do d.__d=!1,S&&S(e),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++k<25);d.state=d.__s,d.getChildContext!=null&&(r=Je(Je({},r),d.getChildContext())),b&&!p&&d.getSnapshotBeforeUpdate!=null&&(_=d.getSnapshotBeforeUpdate(f,g)),w=u!=null&&u.type===Tt&&u.key==null?ql(u.props.children):u,a=Bl(t,Wr(w)?w:[w],e,n,r,s,i,o,a,l,c),d.base=e.__e,e.__u&=-161,d.__h.length&&o.push(d),P&&(d.__E=d.__=null)}catch(A){if(e.__v=null,l||i!=null)if(A.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;i[i.indexOf(a)]=null,e.__e=a}else{for(E=i.length;E--;)Fi(i[E]);Us(e)}else e.__e=n.__e,e.__k=n.__k,A.then||Us(e);re.__e(A,e,n)}else i==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):a=e.__e=id(n.__e,e,n,r,s,i,o,l,c);return(u=re.diffed)&&u(e),128&e.__u?void 0:a}function Us(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(Us))}function Wl(t,e,n){for(var r=0;r<n.length;r++)Mi(n[r],n[++r],n[++r]);re.__c&&re.__c(e,t),t.some(function(s){try{t=s.__h,s.__h=[],t.some(function(i){i.call(s)})}catch(i){re.__e(i,s.__v)}})}function ql(t){return typeof t!="object"||t==null||t.__b>0?t:Wr(t)?t.map(ql):Je({},t)}function id(t,e,n,r,s,i,o,a,l){var c,u,d,p,f,g,_,P=n.props||gr,m=e.props,b=e.type;if(b=="svg"?s="http://www.w3.org/2000/svg":b=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c<i.length;c++)if((f=i[c])&&"setAttribute"in f==!!b&&(b?f.localName==b:f.nodeType==3)){t=f,i[c]=null;break}}if(t==null){if(b==null)return document.createTextNode(m);t=document.createElementNS(s,b,m.is&&m),a&&(re.__m&&re.__m(e,i),a=!1),i=null}if(b==null)P===m||a&&t.data==m||(t.data=m);else{if(i=i&&zr.call(t.childNodes),!a&&i!=null)for(P={},c=0;c<t.attributes.length;c++)P[(f=t.attributes[c]).name]=f.value;for(c in P)f=P[c],c=="dangerouslySetInnerHTML"?d=f:c=="children"||c in m||c=="value"&&"defaultValue"in m||c=="checked"&&"defaultChecked"in m||Gn(t,c,null,f,s);for(c in m)f=m[c],c=="children"?p=f:c=="dangerouslySetInnerHTML"?u=f:c=="value"?g=f:c=="checked"?_=f:a&&typeof f!="function"||P[c]===f||Gn(t,c,f,P[c],s);if(u)a||d&&(u.__html==d.__html||u.__html==t.innerHTML)||(t.innerHTML=u.__html),e.__k=[];else if(d&&(t.innerHTML=""),Bl(e.type=="template"?t.content:t,Wr(p)?p:[p],e,n,r,b=="foreignObject"?"http://www.w3.org/1999/xhtml":s,i,o,i?i[0]:n.__k&&Vt(n,0),a,l),i!=null)for(c=i.length;c--;)Fi(i[c]);a||(c="value",b=="progress"&&g==null?t.removeAttribute("value"):g!=null&&(g!==t[c]||b=="progress"&&!g||b=="option"&&g!=P[c])&&Gn(t,c,g,P[c],s),c="checked",_!=null&&_!=t[c]&&Gn(t,c,_,P[c],s))}return t}function Mi(t,e,n){try{if(typeof t=="function"){var r=typeof t.__u=="function";r&&t.__u(),r&&e==null||(t.__u=t(e))}else t.current=e}catch(s){re.__e(s,n)}}function Gl(t,e,n){var r,s;if(re.unmount&&re.unmount(t),(r=t.ref)&&(r.current&&r.current!=t.__e||Mi(r,null,e)),(r=t.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){re.__e(i,e)}r.base=r.__P=null}if(r=t.__k)for(s=0;s<r.length;s++)r[s]&&Gl(r[s],e,n||typeof t.type!="function");n||Fi(t.__e),t.__c=t.__=t.__e=void 0}function od(t,e,n){return this.constructor(t,n)}function ad(t,e,n){var r,s,i,o;e==document&&(e=document.documentElement),re.__&&re.__(t,e),s=(r=!1)?null:e.__k,i=[],o=[],Ni(e,t=e.__k=h(Tt,null,[t]),s||gr,gr,e.namespaceURI,s?null:e.firstChild?zr.call(e.childNodes):null,i,s?s.__e:e.firstChild,r,o),Wl(i,t,o)}zr=vr.slice,re={__e:function(t,e,n,r){for(var s,i,o;e=e.__;)if((s=e.__c)&&!s.__)try{if((i=s.constructor)&&i.getDerivedStateFromError!=null&&(s.setState(i.getDerivedStateFromError(t)),o=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(t,r||{}),o=s.__d),o)return s.__E=s}catch(a){t=a}throw t}},Dl=0,or.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Je({},this.state),typeof t=="function"&&(t=t(Je({},n),this.props)),t&&Je(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),vo(this))},or.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),vo(this))},or.prototype.render=Tt,dt=[],Ll=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,jl=function(t,e){return t.__v.__b-e.__v.__b},mr.__r=0,Ul=/(PointerCapture)$|Capture$/i,Ai=0,Ls=yo(!1),js=yo(!0);const U=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,J=globalThis,kt="10.46.0";function qr(){return Gr(J),J}function Gr(t){const e=t.__SENTRY__=t.__SENTRY__||{};return e.version=e.version||kt,e[kt]=e[kt]||{}}function sn(t,e,n=J){const r=n.__SENTRY__=n.__SENTRY__||{},s=r[kt]=r[kt]||{};return s[t]||(s[t]=e())}const ld=["debug","info","warn","error","log","assert","trace"],cd="Sentry Logger ",yr={};function on(t){if(!("console"in J))return t();const e=J.console,n={},r=Object.keys(yr);r.forEach(s=>{const i=yr[s];n[s]=e[s],e[s]=i});try{return t()}finally{r.forEach(s=>{e[s]=n[s]})}}function ud(){Li().enabled=!0}function dd(){Li().enabled=!1}function Vl(){return Li().enabled}function hd(...t){Di("log",...t)}function pd(...t){Di("warn",...t)}function fd(...t){Di("error",...t)}function Di(t,...e){U&&Vl()&&on(()=>{J.console[t](`${cd}[${t}]:`,...e)})}function Li(){return U?sn("loggerSettings",()=>({enabled:!1})):{enabled:!1}}const L={enable:ud,disable:dd,isEnabled:Vl,log:hd,warn:pd,error:fd},Yl=50,Pt="?",bo=/\(error: (.*)\)/,Eo=/captureMessage|captureException/;function Kl(...t){const e=t.sort((n,r)=>n[0]-r[0]).map(n=>n[1]);return(n,r=0,s=0)=>{const i=[],o=n.split(`
|
|
2
|
+
`);for(let a=r;a<o.length;a++){let l=o[a];l.length>1024&&(l=l.slice(0,1024));const c=bo.test(l)?l.replace(bo,"$1"):l;if(!c.match(/\S*Error: /)){for(const u of e){const d=u(c);if(d){i.push(d);break}}if(i.length>=Yl+s)break}}return gd(i.slice(s))}}function _d(t){return Array.isArray(t)?Kl(...t):t}function gd(t){if(!t.length)return[];const e=Array.from(t);return/sentryWrapped/.test(Vn(e).function||"")&&e.pop(),e.reverse(),Eo.test(Vn(e).function||"")&&(e.pop(),Eo.test(Vn(e).function||"")&&e.pop()),e.slice(0,Yl).map(n=>({...n,filename:n.filename||Vn(e).filename,function:n.function||Pt}))}function Vn(t){return t[t.length-1]||{}}const os="<anonymous>";function _t(t){try{return!t||typeof t!="function"?os:t.name||os}catch{return os}}function wo(t){const e=t.exception;if(e){const n=[];try{return e.values.forEach(r=>{r.stacktrace.frames&&n.push(...r.stacktrace.frames)}),n}catch{return}}}function Jl(t){return"__v_isVNode"in t&&t.__v_isVNode?"[VueVNode]":"[VueViewModel]"}const ar={},So={};function Rt(t,e){ar[t]=ar[t]||[],ar[t].push(e)}function Ot(t,e){if(!So[t]){So[t]=!0;try{e()}catch(n){U&&L.error(`Error while instrumenting ${t}`,n)}}}function je(t,e){const n=t&&ar[t];if(n)for(const r of n)try{r(e)}catch(s){U&&L.error(`Error while triggering instrumentation handler.
|
|
3
3
|
Type: ${t}
|
|
4
|
-
Name: ${
|
|
5
|
-
Error:`,s)}}let as=null;function md(t){const e="error";Rt(e,t),Ot(e,yd)}function yd(){as=J.onerror,J.onerror=function(t,e,n,r,s){return je("error",{column:r,error:s,line:n,msg:t,url:e}),as?as.apply(this,arguments):!1},J.onerror.__SENTRY_INSTRUMENTED__=!0}let ls=null;function bd(t){const e="unhandledrejection";Rt(e,t),Ot(e,Ed)}function Ed(){ls=J.onunhandledrejection,J.onunhandledrejection=function(t){return je("unhandledrejection",t),ls?ls.apply(this,arguments):!0},J.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const Zl=Object.prototype.toString;function Vr(t){switch(Zl.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return vt(t,Error)}}function an(t,e){return Zl.call(t)===`[object ${e}]`}function Ql(t){return an(t,"ErrorEvent")}function ko(t){return an(t,"DOMError")}function wd(t){return an(t,"DOMException")}function Qe(t){return an(t,"String")}function ji(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function Yr(t){return t===null||ji(t)||typeof t!="object"&&typeof t!="function"}function Rn(t){return an(t,"Object")}function Kr(t){return typeof Event<"u"&&vt(t,Event)}function Sd(t){return typeof Element<"u"&&vt(t,Element)}function kd(t){return an(t,"RegExp")}function Un(t){return!!(t!=null&&t.then&&typeof t.then=="function")}function xd(t){return Rn(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function vt(t,e){try{return t instanceof e}catch{return!1}}function ec(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue||t.__v_isVNode))}function tc(t){return typeof Request<"u"&&vt(t,Request)}const Ui=J,Id=80;function nc(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,s=[];let i=0,o=0;const a=" > ",l=a.length;let c;const u=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||Id;for(;n&&i++<r&&(c=Td(n,u),!(c==="html"||i>1&&o+s.length*l+c.length>=d));)s.push(c),o+=c.length,n=n.parentNode;return s.reverse().join(a)}catch{return"<unknown>"}}function Td(t,e){const n=t,r=[];if(!(n!=null&&n.tagName))return"";if(Ui.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const s=e!=null&&e.length?e.filter(i=>n.getAttribute(i)).map(i=>[i,n.getAttribute(i)]):null;if(s!=null&&s.length)s.forEach(i=>{r.push(`[${i[0]}="${i[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const i=n.className;if(i&&Qe(i)){const o=i.split(/\s+/);for(const a of o)r.push(`.${a}`)}}for(const i of["aria-label","type","name","title","alt"]){const o=n.getAttribute(i);o&&r.push(`[${i}="${o}"]`)}return r.join("")}function Hi(){try{return Ui.document.location.href}catch{return""}}function Pd(t){if(!Ui.HTMLElement)return null;let e=t;const n=5;for(let r=0;r<n;r++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}function $e(t,e,n){if(!(e in t))return;const r=t[e];if(typeof r!="function")return;const s=n(r);typeof s=="function"&&rc(s,r);try{t[e]=s}catch{U&&L.log(`Failed to replace method "${e}" in object`,t)}}function mt(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{U&&L.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function rc(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,mt(t,"__sentry_original__",e)}catch{}}function Bi(t){return t.__sentry_original__}function sc(t){if(Vr(t))return{message:t.message,name:t.name,stack:t.stack,...Io(t)};if(Kr(t)){const e={type:t.type,target:xo(t.target),currentTarget:xo(t.currentTarget),...Io(t)};return typeof CustomEvent<"u"&&vt(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function xo(t){try{return Sd(t)?nc(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function Io(t){return typeof t=="object"&&t!==null?Object.fromEntries(Object.entries(t)):{}}function Cd(t){const e=Object.keys(sc(t));return e.sort(),e[0]?e.join(", "):"[object has no keys]"}let Ft;function Jr(t){if(Ft!==void 0)return Ft?Ft(t):t();const e=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=J;return e in n&&typeof n[e]=="function"?(Ft=n[e],Ft(t)):(Ft=null,t())}function br(){return Jr(()=>Math.random())}function Xr(){return Jr(()=>Date.now())}function Hs(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function To(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const s=t[r];try{ec(s)?n.push(Xl(s)):n.push(String(s))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function lr(t,e,n=!1){return Qe(t)?kd(e)?e.test(t):Qe(e)?n?t===e:t.includes(e):!1:!1}function Zr(t,e=[],n=!1){return e.some(r=>lr(t,r,n))}function $d(){const t=J;return t.crypto||t.msCrypto}let cs;function Rd(){return br()*16}function Fe(t=$d()){try{if(t!=null&&t.randomUUID)return Jr(()=>t.randomUUID()).replace(/-/g,"")}catch{}return cs||(cs="10000000100040008000"+1e11),cs.replace(/[018]/g,e=>(e^(Rd()&15)>>e/4).toString(16))}function ic(t){var e,n;return(n=(e=t.exception)==null?void 0:e.values)==null?void 0:n[0]}function kt(t){const{message:e,event_id:n}=t;if(e)return e;const r=ic(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Bs(t,e,n){const r=t.exception=t.exception||{},s=r.values=r.values||[],i=s[0]=s[0]||{};i.value||(i.value=e||""),i.type||(i.type="Error")}function Yt(t,e){const n=ic(t);if(!n)return;const r={type:"generic",handled:!0},s=n.mechanism;if(n.mechanism={...r,...s,...e},e&&"data"in e){const i={...s==null?void 0:s.data,...e.data};n.mechanism.data=i}}function Po(t){if(Od(t))return!0;try{mt(t,"__sentry_captured__",!0)}catch{}return!1}function Od(t){try{return t.__sentry_captured__}catch{}}const oc=1e3;function Hn(){return Xr()/oc}function Ad(){const{performance:t}=J;if(!(t!=null&&t.now)||!t.timeOrigin)return Hn;const e=t.timeOrigin;return()=>(e+Jr(()=>t.now()))/oc}let Co;function et(){return(Co??(Co=Ad()))()}function Fd(t){const e=et(),n={sid:Fe(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>Md(n)};return t&&Kt(n,t),n}function Kt(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||et(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:Fe()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function Nd(t,e){let n={};t.status==="ok"&&(n={status:"exited"}),Kt(t,n)}function Md(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function Bn(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&Object.keys(e).length===0)return t;const r={...t};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=Bn(r[s],e[s],n-1));return r}function $o(){return Fe()}function ac(){return Fe().substring(16)}const zs="_sentrySpan";function Ro(t,e){e?mt(t,zs,e):delete t[zs]}function Oo(t){return t[zs]}const Dd=100;class tt{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:$o(),sampleRand:br()}}clone(){const e=new tt;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._attributes={...this._attributes},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,e._conversationId=this._conversationId,Ro(e,Oo(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Kt(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this.setTags({[e]:n})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,n){return this.setAttributes({[e]:n})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e,r=n instanceof tt?n.getScopeData():Rn(n)?e:void 0,{tags:s,attributes:i,extra:o,user:a,contexts:l,level:c,fingerprint:u=[],propagationContext:d,conversationId:p}=r||{};return this._tags={...this._tags,...s},this._attributes={...this._attributes,...i},this._extra={...this._extra,...o},this._contexts={...this._contexts,...l},a&&Object.keys(a).length&&(this._user=a),c&&(this._level=c),u.length&&(this._fingerprint=u),d&&(this._propagationContext=d),p&&(this._conversationId=p),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,Ro(this,void 0),this._attachments=[],this.setPropagationContext({traceId:$o(),sampleRand:br()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){var i;const r=typeof n=="number"?n:Dd;if(r<=0)return this;const s={timestamp:Hn(),...e,message:e.message?Hs(e.message,2048):e.message};return this._breadcrumbs.push(s),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),(i=this._client)==null||i.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Oo(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Bn(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=(n==null?void 0:n.event_id)||Fe();if(!this._client)return U&&L.warn("No client configured on scope - will not capture exception!"),r;const s=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:s,...n,event_id:r},this),r}captureMessage(e,n,r){const s=(r==null?void 0:r.event_id)||Fe();if(!this._client)return U&&L.warn("No client configured on scope - will not capture message!"),s;const i=(r==null?void 0:r.syntheticException)??new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:i,...r,event_id:s},this),s}captureEvent(e,n){const r=e.event_id||(n==null?void 0:n.event_id)||Fe();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(U&&L.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function Ld(){return sn("defaultCurrentScope",()=>new tt)}function jd(){return sn("defaultIsolationScope",()=>new tt)}const Ao=t=>t instanceof Promise&&!t[lc],lc=Symbol("chained PromiseLike"),Ud=(t,e,n)=>{const r=t.then(s=>(e(s),s),s=>{throw n(s),s});return Ao(r)&&Ao(t)?r:Hd(t,r)},Hd=(t,e)=>{let n=!1;for(const r in t){if(r in e)continue;n=!0;const s=t[r];typeof s=="function"?Object.defineProperty(e,r,{value:(...i)=>s.apply(t,i),enumerable:!0,configurable:!0,writable:!0}):e[r]=s}return n&&Object.assign(e,{[lc]:!0}),e};class Bd{constructor(e,n){let r;e?r=e:r=new tt;let s;n?s=n:s=new tt,this._stack=[{scope:r}],this._isolationScope=s}withScope(e){const n=this._pushScope();let r;try{r=e(n)}catch(s){throw this._popScope(),s}return Un(r)?Ud(r,()=>this._popScope(),()=>this._popScope()):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function Jt(){const t=qr(),e=Gr(t);return e.stack=e.stack||new Bd(Ld(),jd())}function zd(t){return Jt().withScope(t)}function Wd(t,e){const n=Jt();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function Fo(t){return Jt().withScope(()=>t(Jt().getIsolationScope()))}function qd(){return{withIsolationScope:Fo,withScope:zd,withSetScope:Wd,withSetIsolationScope:(t,e)=>Fo(e),getCurrentScope:()=>Jt().getScope(),getIsolationScope:()=>Jt().getIsolationScope()}}function zi(t){const e=Gr(t);return e.acs?e.acs:qd()}function nt(){const t=qr();return zi(t).getCurrentScope()}function At(){const t=qr();return zi(t).getIsolationScope()}function Gd(){return sn("globalScope",()=>new tt)}function Vd(...t){const e=qr(),n=zi(e);if(t.length===2){const[r,s]=t;return r?n.withSetScope(r,s):n.withScope(s)}return n.withScope(t[0])}function Ee(){return nt().getClient()}function Yd(t){const e=t.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:s}=e,i={trace_id:n,span_id:s||ac()};return r&&(i.parent_span_id=r),i}const Kd="sentry.source",Jd="sentry.sample_rate",Xd="sentry.previous_trace_sample_rate",Zd="sentry.op",Qd="sentry.origin",cc="sentry.profile_id",uc="sentry.exclusive_time",eh="gen_ai.conversation.id",th=0,nh=1,rh="_sentryScope",sh="_sentryIsolationScope";function ih(t){if(t){if(typeof t=="object"&&"deref"in t&&typeof t.deref=="function")try{return t.deref()}catch{return}return t}}function dc(t){const e=t;return{scope:e[rh],isolationScope:ih(e[sh])}}const No="sentry-";function oh(t){const e=ah(t);if(!e)return;const n=Object.entries(e).reduce((r,[s,i])=>{if(s.startsWith(No)){const o=s.slice(No.length);r[o]=i}return r},{});if(Object.keys(n).length>0)return n}function ah(t){if(!(!t||!Qe(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{const r=Mo(n);return Object.entries(r).forEach(([s,i])=>{e[s]=i}),e},{}):Mo(t)}function Mo(t){return t.split(",").map(e=>{const n=e.indexOf("=");if(n===-1)return[];const r=e.slice(0,n),s=e.slice(n+1);return[r,s].map(i=>{try{return decodeURIComponent(i.trim())}catch{return}})}).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}const lh=/^o(\d+)\./,ch=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function uh(t){return t==="http"||t==="https"}function zn(t,e=!1){const{host:n,path:r,pass:s,port:i,projectId:o,protocol:a,publicKey:l}=t;return`${a}://${l}${e&&s?`:${s}`:""}@${n}${i?`:${i}`:""}/${r&&`${r}/`}${o}`}function dh(t){const e=ch.exec(t);if(!e){on(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}const[n,r,s="",i="",o="",a=""]=e.slice(1);let l="",c=a;const u=c.split("/");if(u.length>1&&(l=u.slice(0,-1).join("/"),c=u.pop()),c){const d=c.match(/^\d+/);d&&(c=d[0])}return hc({host:i,pass:s,path:l,projectId:c,port:o,protocol:n,publicKey:r})}function hc(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function hh(t){if(!U)return!0;const{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(o=>t[o]?!1:(L.error(`Invalid Sentry Dsn: ${o} missing`),!0))?!1:n.match(/^\d+$/)?uh(r)?e&&isNaN(parseInt(e,10))?(L.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(L.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(L.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function ph(t){const e=t.match(lh);return e==null?void 0:e[1]}function fh(t){const e=t.getOptions(),{host:n}=t.getDsn()||{};let r;return e.orgId?r=String(e.orgId):n&&(r=ph(n)),r}function _h(t){const e=typeof t=="string"?dh(t):hc(t);if(!(!e||!hh(e)))return e}function gh(t){if(typeof t=="boolean")return Number(t);const e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}const pc=1;let Do=!1;function vh(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext(),s=r?e:Wi(t).parent_span_id,i=dc(t).scope,o=r?(i==null?void 0:i.getPropagationContext().propagationSpanId)||ac():e;return{parent_span_id:s,span_id:o,trace_id:n}}function mh(t){if(t&&t.length>0)return t.map(({context:{spanId:e,traceId:n,traceFlags:r,...s},attributes:i})=>({span_id:e,trace_id:n,sampled:r===pc,attributes:i,...s}))}function Lo(t){return typeof t=="number"?jo(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?jo(t.getTime()):et()}function jo(t){return t>9999999999?t/1e3:t}function Wi(t){var r;if(bh(t))return t.getSpanJSON();const{spanId:e,traceId:n}=t.spanContext();if(yh(t)){const{attributes:s,startTime:i,name:o,endTime:a,status:l,links:c}=t,u="parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?(r=t.parentSpanContext)==null?void 0:r.spanId:void 0;return{span_id:e,trace_id:n,data:s,description:o,parent_span_id:u,start_timestamp:Lo(i),timestamp:Lo(a)||void 0,status:wh(l),op:s[Zd],origin:s[Qd],links:mh(c)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function yh(t){const e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function bh(t){return typeof t.getSpanJSON=="function"}function Eh(t){const{traceFlags:e}=t.spanContext();return e===pc}function wh(t){if(!(!t||t.code===th))return t.code===nh?"ok":t.message||"internal_error"}const Sh="_sentryRootSpan";function fc(t){return t[Sh]||t}function Uo(){Do||(on(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),Do=!0)}function kh(t){var n;if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=(n=Ee())==null?void 0:n.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}function Ho(t){L.log(`Ignoring span ${t.op} - ${t.description} because it matches \`ignoreSpans\`.`)}function Bo(t,e){if(!(e!=null&&e.length)||!t.description)return!1;for(const n of e){if(Ih(n)){if(lr(t.description,n))return U&&Ho(t),!0;continue}if(!n.name&&!n.op)continue;const r=n.name?lr(t.description,n.name):!0,s=n.op?t.op&&lr(t.op,n.op):!0;if(r&&s)return U&&Ho(t),!0}return!1}function xh(t,e){const n=e.parent_span_id,r=e.span_id;if(n)for(const s of t)s.parent_span_id===r&&(s.parent_span_id=n)}function Ih(t){return typeof t=="string"||t instanceof RegExp}const qi="production",Th="_frozenDsc";function _c(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},s={environment:n.environment||qi,release:n.release,public_key:r,trace_id:t,org_id:fh(e)};return e.emit("createDsc",s),s}function Ph(t,e){const n=e.getPropagationContext();return n.dsc||_c(n.traceId,t)}function Ch(t){var g;const e=Ee();if(!e)return{};const n=fc(t),r=Wi(n),s=r.data,i=n.spanContext().traceState,o=(i==null?void 0:i.get("sentry.sample_rate"))??s[Jd]??s[Xd];function a(_){return(typeof o=="number"||typeof o=="string")&&(_.sample_rate=`${o}`),_}const l=n[Th];if(l)return a(l);const c=i==null?void 0:i.get("sentry.dsc"),u=c&&oh(c);if(u)return a(u);const d=_c(t.spanContext().traceId,e),p=s[Kd],f=r.description;return p!=="url"&&f&&(d.transaction=f),kh()&&(d.sampled=String(Eh(n)),d.sample_rand=(i==null?void 0:i.get("sentry.sample_rand"))??((g=dc(n).scope)==null?void 0:g.getPropagationContext().sampleRand.toString())),a(d),e.emit("createDsc",d,n),d}function Ye(t,e=100,n=1/0){try{return Ws("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function gc(t,e=3,n=100*1024){const r=Ye(t,e);return Ah(r)>n?gc(t,e-1,n):r}function Ws(t,e,n=1/0,r=1/0,s=Fh()){const[i,o]=s;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const a=$h(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;const l=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(l===0)return a.replace("object ","");if(i(e))return"[Circular ~]";const c=e;if(c&&typeof c.toJSON=="function")try{const f=c.toJSON();return Ws("",f,l-1,r,s)}catch{}const u=Array.isArray(e)?[]:{};let d=0;const p=sc(e);for(const f in p){if(!Object.prototype.hasOwnProperty.call(p,f))continue;if(d>=r){u[f]="[MaxProperties ~]";break}const g=p[f];u[f]=Ws(f,g,l-1,r,s),d++}return o(e),u}function $h(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(ec(e))return Xl(e);if(xd(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${gt(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const n=Rh(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function Rh(t){const e=Object.getPrototypeOf(t);return e!=null&&e.constructor?e.constructor.name:"null prototype"}function Oh(t){return~-encodeURI(t).split(/%..|./).length}function Ah(t){return Oh(JSON.stringify(t))}function Fh(){const t=new WeakSet;function e(r){return t.has(r)?!0:(t.add(r),!1)}function n(r){t.delete(r)}return[e,n]}function ln(t,e=[]){return[t,e]}function Nh(t,e){const[n,r]=t;return[n,[...r,e]]}function qs(t,e){const n=t[1];for(const r of n){const s=r[0].type;if(e(r,s))return!0}return!1}function Mh(t,e){return qs(t,(n,r)=>e.includes(r))}function Gs(t){const e=Gr(J);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function Dh(t){const[e,n]=t;let r=JSON.stringify(e);function s(i){typeof r=="string"?r=typeof i=="string"?r+i:[Gs(r),i]:r.push(typeof i=="string"?Gs(i):i)}for(const i of n){const[o,a]=i;if(s(`
|
|
4
|
+
Name: ${_t(r)}
|
|
5
|
+
Error:`,s)}}let as=null;function vd(t){const e="error";Rt(e,t),Ot(e,md)}function md(){as=J.onerror,J.onerror=function(t,e,n,r,s){return je("error",{column:r,error:s,line:n,msg:t,url:e}),as?as.apply(this,arguments):!1},J.onerror.__SENTRY_INSTRUMENTED__=!0}let ls=null;function yd(t){const e="unhandledrejection";Rt(e,t),Ot(e,bd)}function bd(){ls=J.onunhandledrejection,J.onunhandledrejection=function(t){return je("unhandledrejection",t),ls?ls.apply(this,arguments):!0},J.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}const Xl=Object.prototype.toString;function Vr(t){switch(Xl.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return gt(t,Error)}}function an(t,e){return Xl.call(t)===`[object ${e}]`}function Zl(t){return an(t,"ErrorEvent")}function ko(t){return an(t,"DOMError")}function Ed(t){return an(t,"DOMException")}function Qe(t){return an(t,"String")}function ji(t){return typeof t=="object"&&t!==null&&"__sentry_template_string__"in t&&"__sentry_template_values__"in t}function Yr(t){return t===null||ji(t)||typeof t!="object"&&typeof t!="function"}function Rn(t){return an(t,"Object")}function Kr(t){return typeof Event<"u"&>(t,Event)}function wd(t){return typeof Element<"u"&>(t,Element)}function Sd(t){return an(t,"RegExp")}function Un(t){return!!(t!=null&&t.then&&typeof t.then=="function")}function kd(t){return Rn(t)&&"nativeEvent"in t&&"preventDefault"in t&&"stopPropagation"in t}function gt(t,e){try{return t instanceof e}catch{return!1}}function Ql(t){return!!(typeof t=="object"&&t!==null&&(t.__isVue||t._isVue||t.__v_isVNode))}function ec(t){return typeof Request<"u"&>(t,Request)}const Ui=J,xd=80;function tc(t,e={}){if(!t)return"<unknown>";try{let n=t;const r=5,s=[];let i=0,o=0;const a=" > ",l=a.length;let c;const u=Array.isArray(e)?e:e.keyAttrs,d=!Array.isArray(e)&&e.maxStringLength||xd;for(;n&&i++<r&&(c=Id(n,u),!(c==="html"||i>1&&o+s.length*l+c.length>=d));)s.push(c),o+=c.length,n=n.parentNode;return s.reverse().join(a)}catch{return"<unknown>"}}function Id(t,e){const n=t,r=[];if(!(n!=null&&n.tagName))return"";if(Ui.HTMLElement&&n instanceof HTMLElement&&n.dataset){if(n.dataset.sentryComponent)return n.dataset.sentryComponent;if(n.dataset.sentryElement)return n.dataset.sentryElement}r.push(n.tagName.toLowerCase());const s=e!=null&&e.length?e.filter(i=>n.getAttribute(i)).map(i=>[i,n.getAttribute(i)]):null;if(s!=null&&s.length)s.forEach(i=>{r.push(`[${i[0]}="${i[1]}"]`)});else{n.id&&r.push(`#${n.id}`);const i=n.className;if(i&&Qe(i)){const o=i.split(/\s+/);for(const a of o)r.push(`.${a}`)}}for(const i of["aria-label","type","name","title","alt"]){const o=n.getAttribute(i);o&&r.push(`[${i}="${o}"]`)}return r.join("")}function Hi(){try{return Ui.document.location.href}catch{return""}}function Td(t){if(!Ui.HTMLElement)return null;let e=t;const n=5;for(let r=0;r<n;r++){if(!e)return null;if(e instanceof HTMLElement){if(e.dataset.sentryComponent)return e.dataset.sentryComponent;if(e.dataset.sentryElement)return e.dataset.sentryElement}e=e.parentNode}return null}function $e(t,e,n){if(!(e in t))return;const r=t[e];if(typeof r!="function")return;const s=n(r);typeof s=="function"&&nc(s,r);try{t[e]=s}catch{U&&L.log(`Failed to replace method "${e}" in object`,t)}}function vt(t,e,n){try{Object.defineProperty(t,e,{value:n,writable:!0,configurable:!0})}catch{U&&L.log(`Failed to add non-enumerable property "${e}" to object`,t)}}function nc(t,e){try{const n=e.prototype||{};t.prototype=e.prototype=n,vt(t,"__sentry_original__",e)}catch{}}function Bi(t){return t.__sentry_original__}function rc(t){if(Vr(t))return{message:t.message,name:t.name,stack:t.stack,...Io(t)};if(Kr(t)){const e={type:t.type,target:xo(t.target),currentTarget:xo(t.currentTarget),...Io(t)};return typeof CustomEvent<"u"&>(t,CustomEvent)&&(e.detail=t.detail),e}else return t}function xo(t){try{return wd(t)?tc(t):Object.prototype.toString.call(t)}catch{return"<unknown>"}}function Io(t){return typeof t=="object"&&t!==null?Object.fromEntries(Object.entries(t)):{}}function Pd(t){const e=Object.keys(rc(t));return e.sort(),e[0]?e.join(", "):"[object has no keys]"}let Ft;function Jr(t){if(Ft!==void 0)return Ft?Ft(t):t();const e=Symbol.for("__SENTRY_SAFE_RANDOM_ID_WRAPPER__"),n=J;return e in n&&typeof n[e]=="function"?(Ft=n[e],Ft(t)):(Ft=null,t())}function br(){return Jr(()=>Math.random())}function Xr(){return Jr(()=>Date.now())}function Hs(t,e=0){return typeof t!="string"||e===0||t.length<=e?t:`${t.slice(0,e)}...`}function To(t,e){if(!Array.isArray(t))return"";const n=[];for(let r=0;r<t.length;r++){const s=t[r];try{Ql(s)?n.push(Jl(s)):n.push(String(s))}catch{n.push("[value cannot be serialized]")}}return n.join(e)}function lr(t,e,n=!1){return Qe(t)?Sd(e)?e.test(t):Qe(e)?n?t===e:t.includes(e):!1:!1}function Zr(t,e=[],n=!1){return e.some(r=>lr(t,r,n))}function Cd(){const t=J;return t.crypto||t.msCrypto}let cs;function $d(){return br()*16}function Fe(t=Cd()){try{if(t!=null&&t.randomUUID)return Jr(()=>t.randomUUID()).replace(/-/g,"")}catch{}return cs||(cs="10000000100040008000"+1e11),cs.replace(/[018]/g,e=>(e^($d()&15)>>e/4).toString(16))}function sc(t){var e,n;return(n=(e=t.exception)==null?void 0:e.values)==null?void 0:n[0]}function St(t){const{message:e,event_id:n}=t;if(e)return e;const r=sc(t);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||"<unknown>":n||"<unknown>"}function Bs(t,e,n){const r=t.exception=t.exception||{},s=r.values=r.values||[],i=s[0]=s[0]||{};i.value||(i.value=e||""),i.type||(i.type="Error")}function Yt(t,e){const n=sc(t);if(!n)return;const r={type:"generic",handled:!0},s=n.mechanism;if(n.mechanism={...r,...s,...e},e&&"data"in e){const i={...s==null?void 0:s.data,...e.data};n.mechanism.data=i}}function Po(t){if(Rd(t))return!0;try{vt(t,"__sentry_captured__",!0)}catch{}return!1}function Rd(t){try{return t.__sentry_captured__}catch{}}const ic=1e3;function Hn(){return Xr()/ic}function Od(){const{performance:t}=J;if(!(t!=null&&t.now)||!t.timeOrigin)return Hn;const e=t.timeOrigin;return()=>(e+Jr(()=>t.now()))/ic}let Co;function et(){return(Co??(Co=Od()))()}function Ad(t){const e=et(),n={sid:Fe(),init:!0,timestamp:e,started:e,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>Nd(n)};return t&&Kt(n,t),n}function Kt(t,e={}){if(e.user&&(!t.ipAddress&&e.user.ip_address&&(t.ipAddress=e.user.ip_address),!t.did&&!e.did&&(t.did=e.user.id||e.user.email||e.user.username)),t.timestamp=e.timestamp||et(),e.abnormal_mechanism&&(t.abnormal_mechanism=e.abnormal_mechanism),e.ignoreDuration&&(t.ignoreDuration=e.ignoreDuration),e.sid&&(t.sid=e.sid.length===32?e.sid:Fe()),e.init!==void 0&&(t.init=e.init),!t.did&&e.did&&(t.did=`${e.did}`),typeof e.started=="number"&&(t.started=e.started),t.ignoreDuration)t.duration=void 0;else if(typeof e.duration=="number")t.duration=e.duration;else{const n=t.timestamp-t.started;t.duration=n>=0?n:0}e.release&&(t.release=e.release),e.environment&&(t.environment=e.environment),!t.ipAddress&&e.ipAddress&&(t.ipAddress=e.ipAddress),!t.userAgent&&e.userAgent&&(t.userAgent=e.userAgent),typeof e.errors=="number"&&(t.errors=e.errors),e.status&&(t.status=e.status)}function Fd(t,e){let n={};t.status==="ok"&&(n={status:"exited"}),Kt(t,n)}function Nd(t){return{sid:`${t.sid}`,init:t.init,started:new Date(t.started*1e3).toISOString(),timestamp:new Date(t.timestamp*1e3).toISOString(),status:t.status,errors:t.errors,did:typeof t.did=="number"||typeof t.did=="string"?`${t.did}`:void 0,duration:t.duration,abnormal_mechanism:t.abnormal_mechanism,attrs:{release:t.release,environment:t.environment,ip_address:t.ipAddress,user_agent:t.userAgent}}}function Bn(t,e,n=2){if(!e||typeof e!="object"||n<=0)return e;if(t&&Object.keys(e).length===0)return t;const r={...t};for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=Bn(r[s],e[s],n-1));return r}function $o(){return Fe()}function oc(){return Fe().substring(16)}const zs="_sentrySpan";function Ro(t,e){e?vt(t,zs,e):delete t[zs]}function Oo(t){return t[zs]}const Md=100;class tt{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._attributes={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:$o(),sampleRand:br()}}clone(){const e=new tt;return e._breadcrumbs=[...this._breadcrumbs],e._tags={...this._tags},e._attributes={...this._attributes},e._extra={...this._extra},e._contexts={...this._contexts},this._contexts.flags&&(e._contexts.flags={values:[...this._contexts.flags.values]}),e._user=this._user,e._level=this._level,e._session=this._session,e._transactionName=this._transactionName,e._fingerprint=this._fingerprint,e._eventProcessors=[...this._eventProcessors],e._attachments=[...this._attachments],e._sdkProcessingMetadata={...this._sdkProcessingMetadata},e._propagationContext={...this._propagationContext},e._client=this._client,e._lastEventId=this._lastEventId,e._conversationId=this._conversationId,Ro(e,Oo(this)),e}setClient(e){this._client=e}setLastEventId(e){this._lastEventId=e}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&Kt(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}setConversationId(e){return this._conversationId=e||void 0,this._notifyScopeListeners(),this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,n){return this.setTags({[e]:n})}setAttributes(e){return this._attributes={...this._attributes,...e},this._notifyScopeListeners(),this}setAttribute(e,n){return this.setAttributes({[e]:n})}removeAttribute(e){return e in this._attributes&&(delete this._attributes[e],this._notifyScopeListeners()),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,n){return this._extra={...this._extra,[e]:n},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,n){return n===null?delete this._contexts[e]:this._contexts[e]=n,this._notifyScopeListeners(),this}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(e){if(!e)return this;const n=typeof e=="function"?e(this):e,r=n instanceof tt?n.getScopeData():Rn(n)?e:void 0,{tags:s,attributes:i,extra:o,user:a,contexts:l,level:c,fingerprint:u=[],propagationContext:d,conversationId:p}=r||{};return this._tags={...this._tags,...s},this._attributes={...this._attributes,...i},this._extra={...this._extra,...o},this._contexts={...this._contexts,...l},a&&Object.keys(a).length&&(this._user=a),c&&(this._level=c),u.length&&(this._fingerprint=u),d&&(this._propagationContext=d),p&&(this._conversationId=p),this}clear(){return this._breadcrumbs=[],this._tags={},this._attributes={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._session=void 0,this._conversationId=void 0,Ro(this,void 0),this._attachments=[],this.setPropagationContext({traceId:$o(),sampleRand:br()}),this._notifyScopeListeners(),this}addBreadcrumb(e,n){var i;const r=typeof n=="number"?n:Md;if(r<=0)return this;const s={timestamp:Hn(),...e,message:e.message?Hs(e.message,2048):e.message};return this._breadcrumbs.push(s),this._breadcrumbs.length>r&&(this._breadcrumbs=this._breadcrumbs.slice(-r),(i=this._client)==null||i.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,attributes:this._attributes,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Oo(this),conversationId:this._conversationId}}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata=Bn(this._sdkProcessingMetadata,e,2),this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,n){const r=(n==null?void 0:n.event_id)||Fe();if(!this._client)return U&&L.warn("No client configured on scope - will not capture exception!"),r;const s=new Error("Sentry syntheticException");return this._client.captureException(e,{originalException:e,syntheticException:s,...n,event_id:r},this),r}captureMessage(e,n,r){const s=(r==null?void 0:r.event_id)||Fe();if(!this._client)return U&&L.warn("No client configured on scope - will not capture message!"),s;const i=(r==null?void 0:r.syntheticException)??new Error(e);return this._client.captureMessage(e,n,{originalException:e,syntheticException:i,...r,event_id:s},this),s}captureEvent(e,n){const r=e.event_id||(n==null?void 0:n.event_id)||Fe();return this._client?(this._client.captureEvent(e,{...n,event_id:r},this),r):(U&&L.warn("No client configured on scope - will not capture event!"),r)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),this._notifyingListeners=!1)}}function Dd(){return sn("defaultCurrentScope",()=>new tt)}function Ld(){return sn("defaultIsolationScope",()=>new tt)}const Ao=t=>t instanceof Promise&&!t[ac],ac=Symbol("chained PromiseLike"),jd=(t,e,n)=>{const r=t.then(s=>(e(s),s),s=>{throw n(s),s});return Ao(r)&&Ao(t)?r:Ud(t,r)},Ud=(t,e)=>{let n=!1;for(const r in t){if(r in e)continue;n=!0;const s=t[r];typeof s=="function"?Object.defineProperty(e,r,{value:(...i)=>s.apply(t,i),enumerable:!0,configurable:!0,writable:!0}):e[r]=s}return n&&Object.assign(e,{[ac]:!0}),e};class Hd{constructor(e,n){let r;e?r=e:r=new tt;let s;n?s=n:s=new tt,this._stack=[{scope:r}],this._isolationScope=s}withScope(e){const n=this._pushScope();let r;try{r=e(n)}catch(s){throw this._popScope(),s}return Un(r)?jd(r,()=>this._popScope(),()=>this._popScope()):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}}function Jt(){const t=qr(),e=Gr(t);return e.stack=e.stack||new Hd(Dd(),Ld())}function Bd(t){return Jt().withScope(t)}function zd(t,e){const n=Jt();return n.withScope(()=>(n.getStackTop().scope=t,e(t)))}function Fo(t){return Jt().withScope(()=>t(Jt().getIsolationScope()))}function Wd(){return{withIsolationScope:Fo,withScope:Bd,withSetScope:zd,withSetIsolationScope:(t,e)=>Fo(e),getCurrentScope:()=>Jt().getScope(),getIsolationScope:()=>Jt().getIsolationScope()}}function zi(t){const e=Gr(t);return e.acs?e.acs:Wd()}function nt(){const t=qr();return zi(t).getCurrentScope()}function At(){const t=qr();return zi(t).getIsolationScope()}function qd(){return sn("globalScope",()=>new tt)}function Gd(...t){const e=qr(),n=zi(e);if(t.length===2){const[r,s]=t;return r?n.withSetScope(r,s):n.withScope(s)}return n.withScope(t[0])}function Ee(){return nt().getClient()}function Vd(t){const e=t.getPropagationContext(),{traceId:n,parentSpanId:r,propagationSpanId:s}=e,i={trace_id:n,span_id:s||oc()};return r&&(i.parent_span_id=r),i}const Yd="sentry.source",Kd="sentry.sample_rate",Jd="sentry.previous_trace_sample_rate",Xd="sentry.op",Zd="sentry.origin",lc="sentry.profile_id",cc="sentry.exclusive_time",Qd="gen_ai.conversation.id",eh=0,th=1,nh="_sentryScope",rh="_sentryIsolationScope";function sh(t){if(t){if(typeof t=="object"&&"deref"in t&&typeof t.deref=="function")try{return t.deref()}catch{return}return t}}function uc(t){const e=t;return{scope:e[nh],isolationScope:sh(e[rh])}}const No="sentry-";function ih(t){const e=oh(t);if(!e)return;const n=Object.entries(e).reduce((r,[s,i])=>{if(s.startsWith(No)){const o=s.slice(No.length);r[o]=i}return r},{});if(Object.keys(n).length>0)return n}function oh(t){if(!(!t||!Qe(t)&&!Array.isArray(t)))return Array.isArray(t)?t.reduce((e,n)=>{const r=Mo(n);return Object.entries(r).forEach(([s,i])=>{e[s]=i}),e},{}):Mo(t)}function Mo(t){return t.split(",").map(e=>{const n=e.indexOf("=");if(n===-1)return[];const r=e.slice(0,n),s=e.slice(n+1);return[r,s].map(i=>{try{return decodeURIComponent(i.trim())}catch{return}})}).reduce((e,[n,r])=>(n&&r&&(e[n]=r),e),{})}const ah=/^o(\d+)\./,lh=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[:.%\w]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;function ch(t){return t==="http"||t==="https"}function zn(t,e=!1){const{host:n,path:r,pass:s,port:i,projectId:o,protocol:a,publicKey:l}=t;return`${a}://${l}${e&&s?`:${s}`:""}@${n}${i?`:${i}`:""}/${r&&`${r}/`}${o}`}function uh(t){const e=lh.exec(t);if(!e){on(()=>{console.error(`Invalid Sentry Dsn: ${t}`)});return}const[n,r,s="",i="",o="",a=""]=e.slice(1);let l="",c=a;const u=c.split("/");if(u.length>1&&(l=u.slice(0,-1).join("/"),c=u.pop()),c){const d=c.match(/^\d+/);d&&(c=d[0])}return dc({host:i,pass:s,path:l,projectId:c,port:o,protocol:n,publicKey:r})}function dc(t){return{protocol:t.protocol,publicKey:t.publicKey||"",pass:t.pass||"",host:t.host,port:t.port||"",path:t.path||"",projectId:t.projectId}}function dh(t){if(!U)return!0;const{port:e,projectId:n,protocol:r}=t;return["protocol","publicKey","host","projectId"].find(o=>t[o]?!1:(L.error(`Invalid Sentry Dsn: ${o} missing`),!0))?!1:n.match(/^\d+$/)?ch(r)?e&&isNaN(parseInt(e,10))?(L.error(`Invalid Sentry Dsn: Invalid port ${e}`),!1):!0:(L.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(L.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function hh(t){const e=t.match(ah);return e==null?void 0:e[1]}function ph(t){const e=t.getOptions(),{host:n}=t.getDsn()||{};let r;return e.orgId?r=String(e.orgId):n&&(r=hh(n)),r}function fh(t){const e=typeof t=="string"?uh(t):dc(t);if(!(!e||!dh(e)))return e}function _h(t){if(typeof t=="boolean")return Number(t);const e=typeof t=="string"?parseFloat(t):t;if(!(typeof e!="number"||isNaN(e)||e<0||e>1))return e}const hc=1;let Do=!1;function gh(t){const{spanId:e,traceId:n,isRemote:r}=t.spanContext(),s=r?e:Wi(t).parent_span_id,i=uc(t).scope,o=r?(i==null?void 0:i.getPropagationContext().propagationSpanId)||oc():e;return{parent_span_id:s,span_id:o,trace_id:n}}function vh(t){if(t&&t.length>0)return t.map(({context:{spanId:e,traceId:n,traceFlags:r,...s},attributes:i})=>({span_id:e,trace_id:n,sampled:r===hc,attributes:i,...s}))}function Lo(t){return typeof t=="number"?jo(t):Array.isArray(t)?t[0]+t[1]/1e9:t instanceof Date?jo(t.getTime()):et()}function jo(t){return t>9999999999?t/1e3:t}function Wi(t){var r;if(yh(t))return t.getSpanJSON();const{spanId:e,traceId:n}=t.spanContext();if(mh(t)){const{attributes:s,startTime:i,name:o,endTime:a,status:l,links:c}=t,u="parentSpanId"in t?t.parentSpanId:"parentSpanContext"in t?(r=t.parentSpanContext)==null?void 0:r.spanId:void 0;return{span_id:e,trace_id:n,data:s,description:o,parent_span_id:u,start_timestamp:Lo(i),timestamp:Lo(a)||void 0,status:Eh(l),op:s[Xd],origin:s[Zd],links:vh(c)}}return{span_id:e,trace_id:n,start_timestamp:0,data:{}}}function mh(t){const e=t;return!!e.attributes&&!!e.startTime&&!!e.name&&!!e.endTime&&!!e.status}function yh(t){return typeof t.getSpanJSON=="function"}function bh(t){const{traceFlags:e}=t.spanContext();return e===hc}function Eh(t){if(!(!t||t.code===eh))return t.code===th?"ok":t.message||"internal_error"}const wh="_sentryRootSpan";function pc(t){return t[wh]||t}function Uo(){Do||(on(()=>{console.warn("[Sentry] Returning null from `beforeSendSpan` is disallowed. To drop certain spans, configure the respective integrations directly or use `ignoreSpans`.")}),Do=!0)}function Sh(t){var n;if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const e=(n=Ee())==null?void 0:n.getOptions();return!!e&&(e.tracesSampleRate!=null||!!e.tracesSampler)}function Ho(t){L.log(`Ignoring span ${t.op} - ${t.description} because it matches \`ignoreSpans\`.`)}function Bo(t,e){if(!(e!=null&&e.length)||!t.description)return!1;for(const n of e){if(xh(n)){if(lr(t.description,n))return U&&Ho(t),!0;continue}if(!n.name&&!n.op)continue;const r=n.name?lr(t.description,n.name):!0,s=n.op?t.op&&lr(t.op,n.op):!0;if(r&&s)return U&&Ho(t),!0}return!1}function kh(t,e){const n=e.parent_span_id,r=e.span_id;if(n)for(const s of t)s.parent_span_id===r&&(s.parent_span_id=n)}function xh(t){return typeof t=="string"||t instanceof RegExp}const qi="production",Ih="_frozenDsc";function fc(t,e){const n=e.getOptions(),{publicKey:r}=e.getDsn()||{},s={environment:n.environment||qi,release:n.release,public_key:r,trace_id:t,org_id:ph(e)};return e.emit("createDsc",s),s}function Th(t,e){const n=e.getPropagationContext();return n.dsc||fc(n.traceId,t)}function Ph(t){var g;const e=Ee();if(!e)return{};const n=pc(t),r=Wi(n),s=r.data,i=n.spanContext().traceState,o=(i==null?void 0:i.get("sentry.sample_rate"))??s[Kd]??s[Jd];function a(_){return(typeof o=="number"||typeof o=="string")&&(_.sample_rate=`${o}`),_}const l=n[Ih];if(l)return a(l);const c=i==null?void 0:i.get("sentry.dsc"),u=c&&ih(c);if(u)return a(u);const d=fc(t.spanContext().traceId,e),p=s[Yd],f=r.description;return p!=="url"&&f&&(d.transaction=f),Sh()&&(d.sampled=String(bh(n)),d.sample_rand=(i==null?void 0:i.get("sentry.sample_rand"))??((g=uc(n).scope)==null?void 0:g.getPropagationContext().sampleRand.toString())),a(d),e.emit("createDsc",d,n),d}function Ye(t,e=100,n=1/0){try{return Ws("",t,e,n)}catch(r){return{ERROR:`**non-serializable** (${r})`}}}function _c(t,e=3,n=100*1024){const r=Ye(t,e);return Oh(r)>n?_c(t,e-1,n):r}function Ws(t,e,n=1/0,r=1/0,s=Ah()){const[i,o]=s;if(e==null||["boolean","string"].includes(typeof e)||typeof e=="number"&&Number.isFinite(e))return e;const a=Ch(t,e);if(!a.startsWith("[object "))return a;if(e.__sentry_skip_normalization__)return e;const l=typeof e.__sentry_override_normalization_depth__=="number"?e.__sentry_override_normalization_depth__:n;if(l===0)return a.replace("object ","");if(i(e))return"[Circular ~]";const c=e;if(c&&typeof c.toJSON=="function")try{const f=c.toJSON();return Ws("",f,l-1,r,s)}catch{}const u=Array.isArray(e)?[]:{};let d=0;const p=rc(e);for(const f in p){if(!Object.prototype.hasOwnProperty.call(p,f))continue;if(d>=r){u[f]="[MaxProperties ~]";break}const g=p[f];u[f]=Ws(f,g,l-1,r,s),d++}return o(e),u}function Ch(t,e){try{if(t==="domain"&&e&&typeof e=="object"&&e._events)return"[Domain]";if(t==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&e===global)return"[Global]";if(typeof window<"u"&&e===window)return"[Window]";if(typeof document<"u"&&e===document)return"[Document]";if(Ql(e))return Jl(e);if(kd(e))return"[SyntheticEvent]";if(typeof e=="number"&&!Number.isFinite(e))return`[${e}]`;if(typeof e=="function")return`[Function: ${_t(e)}]`;if(typeof e=="symbol")return`[${String(e)}]`;if(typeof e=="bigint")return`[BigInt: ${String(e)}]`;const n=$h(e);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(n){return`**non-serializable** (${n})`}}function $h(t){const e=Object.getPrototypeOf(t);return e!=null&&e.constructor?e.constructor.name:"null prototype"}function Rh(t){return~-encodeURI(t).split(/%..|./).length}function Oh(t){return Rh(JSON.stringify(t))}function Ah(){const t=new WeakSet;function e(r){return t.has(r)?!0:(t.add(r),!1)}function n(r){t.delete(r)}return[e,n]}function ln(t,e=[]){return[t,e]}function Fh(t,e){const[n,r]=t;return[n,[...r,e]]}function qs(t,e){const n=t[1];for(const r of n){const s=r[0].type;if(e(r,s))return!0}return!1}function Nh(t,e){return qs(t,(n,r)=>e.includes(r))}function Gs(t){const e=Gr(J);return e.encodePolyfill?e.encodePolyfill(t):new TextEncoder().encode(t)}function Mh(t){const[e,n]=t;let r=JSON.stringify(e);function s(i){typeof r=="string"?r=typeof i=="string"?r+i:[Gs(r),i]:r.push(typeof i=="string"?Gs(i):i)}for(const i of n){const[o,a]=i;if(s(`
|
|
6
6
|
${JSON.stringify(o)}
|
|
7
|
-
`),typeof a=="string"||a instanceof Uint8Array)s(a);else{let l;try{l=JSON.stringify(a)}catch{l=JSON.stringify(Ye(a))}s(l)}}return typeof r=="string"?r:Lh(r)}function Lh(t){const e=t.reduce((s,i)=>s+i.length,0),n=new Uint8Array(e);let r=0;for(const s of t)n.set(s,r),r+=s.length;return n}function jh(t){const e=typeof t.data=="string"?Gs(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}const vc={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function Uh(t){return t in vc}function zo(t){return Uh(t)?vc[t]:t}function mc(t){if(!(t!=null&&t.sdk))return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function Hh(t,e,n,r){var i;const s=(i=t.sdkProcessingMetadata)==null?void 0:i.dynamicSamplingContext;return{event_id:t.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:zn(r)},...s&&{trace:s}}}function Bh(t,e){var r,s,i,o;if(!e)return t;const n=t.sdk||{};return t.sdk={...n,name:n.name||e.name,version:n.version||e.version,integrations:[...((r=t.sdk)==null?void 0:r.integrations)||[],...e.integrations||[]],packages:[...((s=t.sdk)==null?void 0:s.packages)||[],...e.packages||[]],settings:(i=t.sdk)!=null&&i.settings||e.settings?{...(o=t.sdk)==null?void 0:o.settings,...e.settings}:void 0},t}function zh(t,e,n,r){const s=mc(n),i={sent_at:new Date().toISOString(),...s&&{sdk:s},...!!r&&e&&{dsn:zn(e)}},o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return ln(i,[o])}function Wh(t,e,n,r){const s=mc(n),i=t.type&&t.type!=="replay_event"?t.type:"event";Bh(t,n==null?void 0:n.sdk);const o=Hh(t,s,r,e);return delete t.sdkProcessingMetadata,ln(o,[[{type:i},t]])}const us=0,Wo=1,qo=2;function Wn(t){return new On(e=>{e(t)})}function Gi(t){return new On((e,n)=>{n(t)})}class On{constructor(e){this._state=us,this._handlers=[],this._runExecutor(e)}then(e,n){return new On((r,s)=>{this._handlers.push([!1,i=>{if(!e)r(i);else try{r(e(i))}catch(o){s(o)}},i=>{if(!n)s(i);else try{r(n(i))}catch(o){s(o)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new On((n,r)=>{let s,i;return this.then(o=>{i=!1,s=o,e&&e()},o=>{i=!0,s=o,e&&e()}).then(()=>{if(i){r(s);return}n(s)})})}_executeHandlers(){if(this._state===us)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===Wo&&n[1](this._value),this._state===qo&&n[2](this._value),n[0]=!0)})}_runExecutor(e){const n=(i,o)=>{if(this._state===us){if(Un(o)){o.then(r,s);return}this._state=i,this._value=o,this._executeHandlers()}},r=i=>{n(Wo,i)},s=i=>{n(qo,i)};try{e(r,s)}catch(i){s(i)}}}function qh(t,e,n,r=0){try{const s=Vs(e,n,t,r);return Un(s)?s:Wn(s)}catch(s){return Gi(s)}}function Vs(t,e,n,r){const s=n[r];if(!t||!s)return t;const i=s({...t},e);return U&&i===null&&L.log(`Event processor "${s.id||"?"}" dropped event`),Un(i)?i.then(o=>Vs(o,e,n,r+1)):Vs(i,e,n,r+1)}let qe,Go,Vo,ot;function Gh(t){const e=J._sentryDebugIds,n=J._debugIds;if(!e&&!n)return{};const r=e?Object.keys(e):[],s=n?Object.keys(n):[];if(ot&&r.length===Go&&s.length===Vo)return ot;Go=r.length,Vo=s.length,ot={},qe||(qe={});const i=(o,a)=>{for(const l of o){const c=a[l],u=qe==null?void 0:qe[l];if(u&&ot&&c)ot[u[0]]=c,qe&&(qe[l]=[u[0],c]);else if(c){const d=t(l);for(let p=d.length-1;p>=0;p--){const f=d[p],g=f==null?void 0:f.filename;if(g&&ot&&qe){ot[g]=c,qe[l]=[g,c];break}}}}};return e&&i(r,e),n&&i(s,n),ot}function Vh(t,e){const{fingerprint:n,span:r,breadcrumbs:s,sdkProcessingMetadata:i}=e;Yh(t,e),r&&Xh(t,r),Zh(t,n),Kh(t,s),Jh(t,i)}function Yo(t,e){const{extra:n,tags:r,attributes:s,user:i,contexts:o,level:a,sdkProcessingMetadata:l,breadcrumbs:c,fingerprint:u,eventProcessors:d,attachments:p,propagationContext:f,transactionName:g,span:_}=e;cn(t,"extra",n),cn(t,"tags",r),cn(t,"attributes",s),cn(t,"user",i),cn(t,"contexts",o),t.sdkProcessingMetadata=Bn(t.sdkProcessingMetadata,l,2),a&&(t.level=a),g&&(t.transactionName=g),_&&(t.span=_),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),u.length&&(t.fingerprint=[...t.fingerprint,...u]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),p.length&&(t.attachments=[...t.attachments,...p]),t.propagationContext={...t.propagationContext,...f}}function cn(t,e,n){t[e]=Bn(t[e],n,1)}function yc(t,e){const n=Gd().getScopeData();return t&&Yo(n,t.getScopeData()),e&&Yo(n,e.getScopeData()),n}function Yh(t,e){const{extra:n,tags:r,user:s,contexts:i,level:o,transactionName:a}=e;Object.keys(n).length&&(t.extra={...n,...t.extra}),Object.keys(r).length&&(t.tags={...r,...t.tags}),Object.keys(s).length&&(t.user={...s,...t.user}),Object.keys(i).length&&(t.contexts={...i,...t.contexts}),o&&(t.level=o),a&&t.type!=="transaction"&&(t.transaction=a)}function Kh(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function Jh(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function Xh(t,e){t.contexts={trace:vh(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Ch(e),...t.sdkProcessingMetadata};const n=fc(e),r=Wi(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function Zh(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}function Qh(t,e,n,r,s,i){const{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=t,l={...e,event_id:e.event_id||n.event_id||Fe(),timestamp:e.timestamp||Hn()},c=n.integrations||t.integrations.map(m=>m.name);ep(l,t),rp(l,c),s&&s.emit("applyFrameMetadata",e),e.type===void 0&&tp(l,t.stackParser);const u=ip(r,n.captureContext);n.mechanism&&Yt(l,n.mechanism);const d=s?s.getEventProcessors():[],p=yc(i,u),f=[...n.attachments||[],...p.attachments];f.length&&(n.attachments=f),Vh(l,p);const g=[...d,...p.eventProcessors];return(n.data&&n.data.__sentry__===!0?Wn(l):qh(g,l,n)).then(m=>(m&&np(m),typeof o=="number"&&o>0?sp(m,o,a):m))}function ep(t,e){var a,l;const{environment:n,release:r,dist:s,maxValueLength:i}=e;t.environment=t.environment||n||qi,!t.release&&r&&(t.release=r),!t.dist&&s&&(t.dist=s);const o=t.request;o!=null&&o.url&&i&&(o.url=Hs(o.url,i)),i&&((l=(a=t.exception)==null?void 0:a.values)==null||l.forEach(c=>{c.value&&(c.value=Hs(c.value,i))}))}function tp(t,e){var r,s;const n=Gh(e);(s=(r=t.exception)==null?void 0:r.values)==null||s.forEach(i=>{var o,a;(a=(o=i.stacktrace)==null?void 0:o.frames)==null||a.forEach(l=>{l.filename&&(l.debug_id=n[l.filename])})})}function np(t){var r,s;const e={};if((s=(r=t.exception)==null?void 0:r.values)==null||s.forEach(i=>{var o,a;(a=(o=i.stacktrace)==null?void 0:o.frames)==null||a.forEach(l=>{l.debug_id&&(l.abs_path?e[l.abs_path]=l.debug_id:l.filename&&(e[l.filename]=l.debug_id),delete l.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach(([i,o])=>{n.push({type:"sourcemap",code_file:i,debug_id:o})})}function rp(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function sp(t,e,n){var s,i;if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(o=>({...o,...o.data&&{data:Ye(o.data,e,n)}}))},...t.user&&{user:Ye(t.user,e,n)},...t.contexts&&{contexts:Ye(t.contexts,e,n)},...t.extra&&{extra:Ye(t.extra,e,n)}};return(s=t.contexts)!=null&&s.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Ye(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(o=>({...o,...o.data&&{data:Ye(o.data,e,n)}}))),(i=t.contexts)!=null&&i.flags&&r.contexts&&(r.contexts.flags=Ye(t.contexts.flags,3,n)),r}function ip(t,e){if(!e)return t;const n=t?t.clone():new tt;return n.update(e),n}function op(t,e){return nt().captureException(t,void 0)}function bc(t,e){return nt().captureEvent(t,e)}function Ko(t){const e=At(),{user:n}=yc(e,nt()),{userAgent:r}=J.navigator||{},s=Fd({user:n,...r&&{userAgent:r},...t}),i=e.getSession();return(i==null?void 0:i.status)==="ok"&&Kt(i,{status:"exited"}),Ec(),e.setSession(s),s}function Ec(){const t=At(),n=nt().getSession()||t.getSession();n&&Nd(n),wc(),t.setSession()}function wc(){const t=At(),e=Ee(),n=t.getSession();n&&e&&e.captureSession(n)}function ds(t=!1){if(t){Ec();return}wc()}const ap="7";function lp(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function cp(t){return`${lp(t)}${t.projectId}/envelope/`}function up(t,e){const n={sentry_version:ap};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}function dp(t,e,n){return e||`${cp(t)}?${up(t,n)}`}const Jo=[];function hp(t){const e={};return t.forEach(n=>{const{name:r}=n,s=e[r];s&&!s.isDefaultInstance&&n.isDefaultInstance||(e[r]=n)}),Object.values(e)}function pp(t){const e=t.defaultIntegrations||[],n=t.integrations;e.forEach(s=>{s.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...e,...n];else if(typeof n=="function"){const s=n(e);r=Array.isArray(s)?s:[s]}else r=e;return hp(r)}function fp(t,e){const n={};return e.forEach(r=>{r&&Sc(t,r,n)}),n}function Xo(t,e){for(const n of e)n!=null&&n.afterAllSetup&&n.afterAllSetup(t)}function Sc(t,e,n){if(n[e.name]){U&&L.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,!Jo.includes(e.name)&&typeof e.setupOnce=="function"&&(e.setupOnce(),Jo.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){const r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(s,i)=>r(s,i,t))}if(typeof e.processEvent=="function"){const r=e.processEvent.bind(e),s=Object.assign((i,o)=>r(i,o,t),{id:e.name});t.addEventProcessor(s)}U&&L.log(`Integration installed: ${e.name}`)}function _p(t){return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{items:t}]}function gp(t,e,n,r){const s={};return e!=null&&e.sdk&&(s.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(s.dsn=zn(r)),ln(s,[_p(t)])}function Ys(t,e){const n=e??vp(t)??[];if(n.length===0)return;const r=t.getOptions(),s=gp(n,r._metadata,r.tunnel,t.getDsn());kc().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(s)}function vp(t){return kc().get(t)}function kc(){return sn("clientToLogBufferMap",()=>new WeakMap)}function mp(t){return[{type:"trace_metric",item_count:t.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:t}]}function yp(t,e,n,r){const s={};return e!=null&&e.sdk&&(s.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(s.dsn=zn(r)),ln(s,[mp(t)])}function xc(t,e){const n=e??bp(t)??[];if(n.length===0)return;const r=t.getOptions(),s=yp(n,r._metadata,r.tunnel,t.getDsn());Ic().set(t,[]),t.emit("flushMetrics"),t.sendEnvelope(s)}function bp(t){return Ic().get(t)}function Ic(){return sn("clientToMetricBufferMap",()=>new WeakMap)}function Tc(t){return typeof t=="object"&&typeof t.unref=="function"&&t.unref(),t}const Vi=Symbol.for("SentryBufferFullError");function Yi(t=100){const e=new Set;function n(){return e.size<t}function r(o){e.delete(o)}function s(o){if(!n())return Gi(Vi);const a=o();return e.add(a),a.then(()=>r(a),()=>r(a)),a}function i(o){if(!e.size)return Wn(!0);const a=Promise.allSettled(Array.from(e)).then(()=>!0);if(!o)return a;const l=[a,new Promise(c=>Tc(setTimeout(()=>c(!1),o)))];return Promise.race(l)}return{get $(){return Array.from(e)},add:s,drain:i}}const Ep=60*1e3;function wp(t,e=Xr()){const n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;const r=Date.parse(`${t}`);return isNaN(r)?Ep:r-e}function Sp(t,e){return t[e]||t.all||0}function kp(t,e,n=Xr()){return Sp(t,e)>n}function xp(t,{statusCode:e,headers:n},r=Xr()){const s={...t},i=n==null?void 0:n["x-sentry-rate-limits"],o=n==null?void 0:n["retry-after"];if(i)for(const a of i.trim().split(",")){const[l,c,,,u]=a.split(":",5),d=parseInt(l,10),p=(isNaN(d)?60:d)*1e3;if(!c)s.all=r+p;else for(const f of c.split(";"))f==="metric_bucket"?(!u||u.split(";").includes("custom"))&&(s[f]=r+p):s[f]=r+p}else o?s.all=r+wp(o,r):e===429&&(s.all=r+60*1e3);return s}const Pc=64;function Ip(t,e,n=Yi(t.bufferSize||Pc)){let r={};const s=o=>n.drain(o);function i(o){const a=[];if(qs(o,(d,p)=>{const f=zo(p);kp(r,f)?t.recordDroppedEvent("ratelimit_backoff",f):a.push(d)}),a.length===0)return Promise.resolve({});const l=ln(o[0],a),c=d=>{if(Mh(l,["client_report"])){U&&L.warn(`Dropping client report. Will not send outcomes (reason: ${d}).`);return}qs(l,(p,f)=>{t.recordDroppedEvent(d,zo(f))})},u=()=>e({body:Dh(l)}).then(d=>d.statusCode===413?(U&&L.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),c("send_error"),d):(U&&d.statusCode!==void 0&&(d.statusCode<200||d.statusCode>=300)&&L.warn(`Sentry responded with status code ${d.statusCode} to sent event.`),r=xp(r,d),d),d=>{throw c("network_error"),U&&L.error("Encountered error running transport request:",d),d});return n.add(u).then(d=>d,d=>{if(d===Vi)return U&&L.error("Skipped sending event because buffer is full."),c("queue_overflow"),Promise.resolve({});throw d})}return{send:i,flush:s}}function Tp(t,e,n){const r=[{type:"client_report"},{timestamp:Hn(),discarded_events:t}];return ln(e?{dsn:e}:{},[r])}function Cc(t){const e=[];t.message&&e.push(t.message);try{const n=t.exception.values[t.exception.values.length-1];n!=null&&n.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`))}catch{}return e}function Pp(t){var l;const{trace_id:e,parent_span_id:n,span_id:r,status:s,origin:i,data:o,op:a}=((l=t.contexts)==null?void 0:l.trace)??{};return{data:o??{},description:t.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:t.start_timestamp??0,status:s,timestamp:t.timestamp,trace_id:e??"",origin:i,profile_id:o==null?void 0:o[cc],exclusive_time:o==null?void 0:o[uc],measurements:t.measurements,is_segment:!0}}function Cp(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:{...t.data,...t.profile_id&&{[cc]:t.profile_id},...t.exclusive_time&&{[uc]:t.exclusive_time}}}},measurements:t.measurements}}const Zo="Not capturing exception because it's already been captured.",Qo="Discarded session because of missing or non-string release",$c=Symbol.for("SentryInternalError"),Rc=Symbol.for("SentryDoNotSendEventError"),$p=5e3;function cr(t){return{message:t,[$c]:!0}}function hs(t){return{message:t,[Rc]:!0}}function ea(t){return!!t&&typeof t=="object"&&$c in t}function ta(t){return!!t&&typeof t=="object"&&Rc in t}function na(t,e,n,r,s){let i=0,o,a=!1;t.on(n,()=>{i=0,clearTimeout(o),a=!1}),t.on(e,l=>{i+=r(l),i>=8e5?s(t):a||(a=!0,o=Tc(setTimeout(()=>{s(t)},$p)))}),t.on("flush",()=>{s(t)})}class Rp{constructor(e){var r,s,i;if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Yi(((r=e.transportOptions)==null?void 0:r.bufferSize)??Pc),e.dsn?this._dsn=_h(e.dsn):U&&L.warn("No DSN provided, client will not send events."),this._dsn){const o=dp(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:o})}this._options.enableLogs=this._options.enableLogs??((s=this._options._experiments)==null?void 0:s.enableLogs),this._options.enableLogs&&na(this,"afterCaptureLog","flushLogs",Np,Ys),(this._options.enableMetrics??((i=this._options._experiments)==null?void 0:i.enableMetrics)??!0)&&na(this,"afterCaptureMetric","flushMetrics",Fp,xc)}captureException(e,n,r){const s=Fe();if(Po(e))return U&&L.log(Zo),s;const i={event_id:s,...n};return this._process(()=>this.eventFromException(e,i).then(o=>this._captureEvent(o,i,r)).then(o=>o),"error"),i.event_id}captureMessage(e,n,r,s){const i={event_id:Fe(),...r},o=ji(e)?e:String(e),a=Yr(e),l=a?this.eventFromMessage(o,n,i):this.eventFromException(e,i);return this._process(()=>l.then(c=>this._captureEvent(c,i,s)),a?"unknown":"error"),i.event_id}captureEvent(e,n,r){const s=Fe();if(n!=null&&n.originalException&&Po(n.originalException))return U&&L.log(Zo),s;const i={event_id:s,...n},o=e.sdkProcessingMetadata||{},a=o.capturedSpanScope,l=o.capturedSpanIsolationScope,c=ra(e.type);return this._process(()=>this._captureEvent(e,i,a||r,l),c),i.event_id}captureSession(e){this.sendSession(e),Kt(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){const n=this._transport;if(!n)return!0;this.emit("flush");const r=await this._isClientDoneProcessing(e),s=await n.flush(e);return r&&s}async close(e){Ys(this);const n=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),n}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const n=this._integrations[e.name];Sc(this,e,this._integrations),n||Xo(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=Wh(e,this._dsn,this._options._metadata,this._options.tunnel);for(const s of n.attachments||[])r=Nh(r,jh(s));this.sendEnvelope(r).then(s=>this.emit("afterSendEvent",e,s))}sendSession(e){const{release:n,environment:r=qi}=this._options;if("aggregates"in e){const i=e.attrs||{};if(!i.release&&!n){U&&L.warn(Qo);return}i.release=i.release||n,i.environment=i.environment||r,e.attrs=i}else{if(!e.release&&!n){U&&L.warn(Qo);return}e.release=e.release||n,e.environment=e.environment||r}this.emit("beforeSendSession",e);const s=zh(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(s)}recordDroppedEvent(e,n,r=1){if(this._options.sendClientReports){const s=`${e}:${n}`;U&&L.log(`Recording outcome: "${s}"${r>1?` (${r} times)`:""}`),this._outcomes[s]=(this._outcomes[s]||0)+r}}on(e,n){const r=this._hooks[e]=this._hooks[e]||new Set,s=(...i)=>n(...i);return r.add(s),()=>{r.delete(s)}}emit(e,...n){const r=this._hooks[e];r&&r.forEach(s=>s(...n))}async sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(n){return U&&L.error("Error while sending envelope:",n),{}}return U&&L.error("Transport disabled"),{}}dispose(){}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=fp(this,e),Xo(this,e)}_updateSessionFromEvent(e,n){var l,c;let r=n.level==="fatal",s=!1;const i=(l=n.exception)==null?void 0:l.values;if(i){s=!0,r=!1;for(const u of i)if(((c=u.mechanism)==null?void 0:c.handled)===!1){r=!0;break}}const o=e.status==="ok";(o&&e.errors===0||o&&r)&&(Kt(e,{...r&&{status:"crashed"},errors:e.errors||Number(s||r)}),this.captureSession(e))}async _isClientDoneProcessing(e){let n=0;for(;!e||n<e;){if(await new Promise(r=>setTimeout(r,1)),!this._numProcessing)return!0;n++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r,s){const i=this.getOptions(),o=Object.keys(this._integrations);return!n.integrations&&(o!=null&&o.length)&&(n.integrations=o),this.emit("preprocessEvent",e,n),e.type||s.setLastEventId(e.event_id||n.event_id),Qh(i,e,n,r,this,s).then(a=>{var c;if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts={trace:{...(c=a.contexts)==null?void 0:c.trace,...Yd(r)},...a.contexts};const l=Ph(this,r);return a.sdkProcessingMetadata={dynamicSamplingContext:l,...a.sdkProcessingMetadata},a})}_captureEvent(e,n={},r=nt(),s=At()){return U&&Ks(e)&&L.log(`Captured error event \`${Cc(e)[0]||"<unknown>"}\``),this._processEvent(e,n,r,s).then(i=>i.event_id,i=>{U&&(ta(i)?L.log(i.message):ea(i)?L.warn(i.message):L.warn(i))})}_processEvent(e,n,r,s){const i=this.getOptions(),{sampleRate:o}=i,a=Oc(e),l=Ks(e),u=`before send for type \`${e.type||"error"}\``,d=typeof o>"u"?void 0:gh(o);if(l&&typeof d=="number"&&br()>d)return this.recordDroppedEvent("sample_rate","error"),Gi(hs(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const p=ra(e.type);return this._prepareEvent(e,n,r,s).then(f=>{var P;if(f===null)throw this.recordDroppedEvent("event_processor",p),hs("An event processor returned `null`, will not send event.");if(((P=n.data)==null?void 0:P.__sentry__)===!0)return f;const _=Ap(this,i,f,n);return Op(_,u)}).then(f=>{var P;if(f===null){if(this.recordDroppedEvent("before_send",p),a){const b=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",b)}throw hs(`${u} returned \`null\`, will not send event.`)}const g=r.getSession()||s.getSession();if(l&&g&&this._updateSessionFromEvent(g,f),a){const m=((P=f.sdkProcessingMetadata)==null?void 0:P.spanCountBeforeProcessing)||0,b=f.spans?f.spans.length:0,C=m-b;C>0&&this.recordDroppedEvent("before_send","span",C)}const _=f.transaction_info;if(a&&_&&f.transaction!==e.transaction){const m="custom";f.transaction_info={..._,source:m}}return this.sendEvent(f,n),f}).then(null,f=>{throw ta(f)||ea(f)?f:(this.captureException(f,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:f}),cr(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
8
|
-
Reason: ${f}`))})}_process(e,n){this._numProcessing++,this._promiseBuffer.add(e).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===Vi&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{const[s,i]=n.split(":");return{reason:s,category:i,quantity:r}})}_flushOutcomes(){U&&L.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0){U&&L.log("No outcomes to send");return}if(!this._dsn){U&&L.log("No dsn provided, will not send outcomes");return}U&&L.log("Sending outcomes:",e);const n=
|
|
9
|
-
Event: ${
|
|
10
|
-
Event: ${
|
|
11
|
-
Event: ${
|
|
12
|
-
Event: ${
|
|
13
|
-
Url: ${Er(t)}`),!0;if(!
|
|
14
|
-
Event: ${
|
|
15
|
-
Url: ${Er(t)}`),!0}return!1}function Xp(t,e){return e!=null&&e.length?Cc(t).some(n=>Zr(n,e)):!1}function Zp(t,e){if(!(e!=null&&e.length))return!1;const n=t.transaction;return n?Zr(n,e):!1}function Qp(t,e){if(!(e!=null&&e.length))return!1;const n=Er(t);return n?Zr(n,e):!1}function ef(t,e){if(!(e!=null&&e.length))return!0;const n=Er(t);return n?Zr(n,e):!0}function tf(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function Er(t){var e,n;try{const r=[...((e=t.exception)==null?void 0:e.values)??[]].reverse().find(i=>{var o,a,l;return((o=i.mechanism)==null?void 0:o.parent_id)===void 0&&((l=(a=i.stacktrace)==null?void 0:a.frames)==null?void 0:l.length)}),s=(n=r==null?void 0:r.stacktrace)==null?void 0:n.frames;return s?tf(s):null}catch{return U&&L.error(`Cannot extract url for event ${kt(t)}`),null}}function nf(t){var e,n;return(n=(e=t.exception)==null?void 0:e.values)!=null&&n.length?!t.message&&!t.exception.values.some(r=>r.stacktrace||r.type&&r.type!=="Error"||r.value):!1}function rf(t,e,n,r,s,i){var a;if(!((a=s.exception)!=null&&a.values)||!i||!vt(i.originalException,Error))return;const o=s.exception.values.length>0?s.exception.values[s.exception.values.length-1]:void 0;o&&(s.exception.values=Js(t,e,r,i.originalException,n,s.exception.values,o,0))}function Js(t,e,n,r,s,i,o,a){if(i.length>=n+1)return i;let l=[...i];if(vt(r[s],Error)){ca(o,a,r);const c=t(e,r[s]),u=l.length;ua(c,s,u,a),l=Js(t,e,n,r[s],s,[c,...l],c,u)}return Fc(r)&&r.errors.forEach((c,u)=>{if(vt(c,Error)){ca(o,a,r);const d=t(e,c),p=l.length;ua(d,`errors[${u}]`,p,a),l=Js(t,e,n,c,s,[d,...l],d,p)}}),l}function Fc(t){return Array.isArray(t.errors)}function ca(t,e,n){t.mechanism={handled:!0,type:"auto.core.linked_errors",...Fc(n)&&{is_exception_group:!0},...t.mechanism,exception_id:e}}function ua(t,e,n,r){t.mechanism={handled:!0,...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}function sf(t){const e="console";Rt(e,t),Ot(e,of)}function of(){"console"in J&&cd.forEach(function(t){t in J.console&&$e(J.console,t,function(e){return yr[t]=e,function(...n){je("console",{args:n,level:t});const s=yr[t];s==null||s.apply(J.console,n)}})})}function af(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}const lf="Dedupe",cf=()=>{let t;return{name:lf,processEvent(e){if(e.type)return e;try{if(df(e,t))return U&&L.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},uf=cf;function df(t,e){return e?!!(hf(t,e)||pf(t,e)):!1}function hf(t,e){const n=t.message,r=e.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!Mc(t,e)||!Nc(t,e))}function pf(t,e){const n=da(e),r=da(t);return!(!n||!r||n.type!==r.type||n.value!==r.value||!Mc(t,e)||!Nc(t,e))}function Nc(t,e){let n=wo(t),r=wo(e);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let s=0;s<r.length;s++){const i=r[s],o=n[s];if(i.filename!==o.filename||i.lineno!==o.lineno||i.colno!==o.colno||i.function!==o.function)return!1}return!0}function Mc(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join("")===r.join("")}catch{return!1}}function da(t){var e,n;return(n=(e=t.exception)==null?void 0:e.values)==null?void 0:n[0]}const ff="ConversationId",_f=()=>({name:ff,setup(t){t.on("spanStart",e=>{const n=nt().getScopeData(),r=At().getScopeData(),s=n.conversationId||r.conversationId;s&&e.setAttribute(eh,s)})}}),gf=_f;function Dc(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}const An=J;function vf(){return"history"in An&&!!An.history}function mf(){if(!("fetch"in An))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}function Xs(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function yf(){var n;if(typeof EdgeRuntime=="string")return!0;if(!mf())return!1;if(Xs(An.fetch))return!0;let t=!1;const e=An.document;if(e&&typeof e.createElement=="function")try{const r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r),(n=r.contentWindow)!=null&&n.fetch&&(t=Xs(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){U&&L.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}function bf(t,e){const n="fetch";Rt(n,t),Ot(n,()=>Ef(void 0,e))}function Ef(t,e=!1){e&&!yf()||$e(J,"fetch",function(n){return function(...r){const s=new Error,{method:i,url:o}=wf(r),a={args:r,fetchData:{method:i,url:o},startTimestamp:et()*1e3,virtualError:s,headers:Sf(r)};return je("fetch",{...a}),n.apply(J,r).then(async l=>(je("fetch",{...a,endTimestamp:et()*1e3,response:l}),l),l=>{je("fetch",{...a,endTimestamp:et()*1e3,error:l}),Vr(l)&&l.stack===void 0&&(l.stack=s.stack,mt(l,"framesToPop",1));const c=Ee(),u=(c==null?void 0:c.getOptions().enhanceFetchErrorMessages)??"always";if(u!==!1&&l instanceof TypeError&&(l.message==="Failed to fetch"||l.message==="Load failed"||l.message==="NetworkError when attempting to fetch resource."))try{const f=new URL(a.fetchData.url).host;u==="always"?l.message=`${l.message} (${f})`:mt(l,"__sentry_fetch_url_host__",f)}catch{}throw l})}})}function ur(t,e){return!!t&&typeof t=="object"&&!!t[e]}function ha(t){return typeof t=="string"?t:t?ur(t,"url")?t.url:t.toString?t.toString():"":""}function wf(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){const[n,r]=t;return{url:ha(n),method:ur(r,"method")?String(r.method).toUpperCase():tc(n)&&ur(n,"method")?String(n.method).toUpperCase():"GET"}}const e=t[0];return{url:ha(e),method:ur(e,"method")?String(e.method).toUpperCase():"GET"}}function Sf(t){const[e,n]=t;try{if(typeof n=="object"&&n!==null&&"headers"in n&&n.headers)return new Headers(n.headers);if(tc(e))return new Headers(e.headers)}catch{}}function kf(){return"npm"}const ae=J;let Zs=0;function Lc(){return Zs>0}function xf(){Zs++,setTimeout(()=>{Zs--})}function Xt(t,e={}){function n(s){return typeof s=="function"}if(!n(t))return t;try{const s=t.__sentry_wrapped__;if(s)return typeof s=="function"?s:t;if(Bi(t))return t}catch{return t}const r=function(...s){try{const i=s.map(o=>Xt(o,e));return t.apply(this,i)}catch(i){throw xf(),Vd(o=>{o.addEventProcessor(a=>(e.mechanism&&(Bs(a,void 0),Yt(a,e.mechanism)),a.extra={...a.extra,arguments:s},a)),op(i)}),i}};try{for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}catch{}rc(r,t),mt(t,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return t.name}})}catch{}return r}function If(){const t=Hi(),{referrer:e}=ae.document||{},{userAgent:n}=ae.navigator||{},r={...e&&{Referer:e},...n&&{"User-Agent":n}};return{url:t,headers:r}}function Ki(t,e){const n=Ji(t,e),r={type:Rf(e),value:Of(e)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function Tf(t,e,n,r){const s=Ee(),i=s==null?void 0:s.getOptions().normalizeDepth,o=Df(e),a={__serialized__:gc(e,i)};if(o)return{exception:{values:[Ki(t,o)]},extra:a};const l={exception:{values:[{type:Kr(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:Nf(e,{isUnhandledRejection:r})}]},extra:a};if(n){const c=Ji(t,n);c.length&&(l.exception.values[0].stacktrace={frames:c})}return l}function fs(t,e){return{exception:{values:[Ki(t,e)]}}}function Ji(t,e){const n=e.stacktrace||e.stack||"",r=Cf(e),s=$f(e);try{return t(n,r,s)}catch{}return[]}const Pf=/Minified React error #\d+;/i;function Cf(t){return t&&Pf.test(t.message)?1:0}function $f(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function jc(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function Rf(t){const e=t==null?void 0:t.name;return!e&&jc(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function Of(t){const e=t==null?void 0:t.message;return jc(t)?Array.isArray(t.message)&&t.message.length==2?t.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?ia(e.error):ia(t):"No error message"}function Af(t,e,n,r){const s=(n==null?void 0:n.syntheticException)||void 0,i=Xi(t,e,s,r);return Yt(i),i.level="error",n!=null&&n.event_id&&(i.event_id=n.event_id),Wn(i)}function Ff(t,e,n="info",r,s){const i=(r==null?void 0:r.syntheticException)||void 0,o=Qs(t,e,i,s);return o.level=n,r!=null&&r.event_id&&(o.event_id=r.event_id),Wn(o)}function Xi(t,e,n,r,s){let i;if(Ql(e)&&e.error)return fs(t,e.error);if(ko(e)||wd(e)){const o=e;if("stack"in e)i=fs(t,e);else{const a=o.name||(ko(o)?"DOMError":"DOMException"),l=o.message?`${a}: ${o.message}`:a;i=Qs(t,l,n,r),Bs(i,l)}return"code"in o&&(i.tags={...i.tags,"DOMException.code":`${o.code}`}),i}return Vr(e)?fs(t,e):Rn(e)||Kr(e)?(i=Tf(t,e,n,s),Yt(i,{synthetic:!0}),i):(i=Qs(t,e,n,r),Bs(i,`${e}`),Yt(i,{synthetic:!0}),i)}function Qs(t,e,n,r){const s={};if(r&&n){const i=Ji(t,n);i.length&&(s.exception={values:[{value:e,stacktrace:{frames:i}}]}),Yt(s,{synthetic:!0})}if(ji(e)){const{__sentry_template_string__:i,__sentry_template_values__:o}=e;return s.logentry={message:i,params:o},s}return s.message=e,s}function Nf(t,{isUnhandledRejection:e}){const n=Cd(t),r=e?"promise rejection":"exception";return Ql(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:Kr(t)?`Event \`${Mf(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function Mf(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function Df(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];if(n instanceof Error)return n}}class Lf extends Rp{constructor(e){var u;const n=jf(e),r=ae.SENTRY_SDK_SOURCE||kf();Hp(n,"browser",["browser"],r),(u=n._metadata)!=null&&u.sdk&&(n._metadata.sdk.settings={infer_ip:n.sendDefaultPii?"auto":"never",...n._metadata.sdk.settings}),super(n);const{sendDefaultPii:s,sendClientReports:i,enableLogs:o,_experiments:a,enableMetrics:l}=this._options,c=l??(a==null?void 0:a.enableMetrics)??!0;ae.document&&(i||o||c)&&ae.document.addEventListener("visibilitychange",()=>{ae.document.visibilityState==="hidden"&&(i&&this._flushOutcomes(),o&&Ys(this),c&&xc(this))}),s&&this.on("beforeSendSession",Up)}eventFromException(e,n){return Af(this._options.stackParser,e,n,this._options.attachStacktrace)}eventFromMessage(e,n="info",r){return Ff(this._options.stackParser,e,n,r,this._options.attachStacktrace)}_prepareEvent(e,n,r,s){return e.platform=e.platform||"javascript",super._prepareEvent(e,n,r,s)}}function jf(t){var e;return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:(e=ae.SENTRY_RELEASE)==null?void 0:e.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...t}}const Uf=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,ke=J,Hf=1e3;let pa,ei,ti;function Bf(t){const e="dom";Rt(e,t),Ot(e,zf)}function zf(){if(!ke.document)return;const t=je.bind(null,"dom"),e=fa(t,!0);ke.document.addEventListener("click",e,!1),ke.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(n=>{var i,o;const s=(i=ke[n])==null?void 0:i.prototype;(o=s==null?void 0:s.hasOwnProperty)!=null&&o.call(s,"addEventListener")&&($e(s,"addEventListener",function(a){return function(l,c,u){if(l==="click"||l=="keypress")try{const d=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},p=d[l]=d[l]||{refCount:0};if(!p.handler){const f=fa(t);p.handler=f,a.call(this,l,f,u)}p.refCount++}catch{}return a.call(this,l,c,u)}}),$e(s,"removeEventListener",function(a){return function(l,c,u){if(l==="click"||l=="keypress")try{const d=this.__sentry_instrumentation_handlers__||{},p=d[l];p&&(p.refCount--,p.refCount<=0&&(a.call(this,l,p.handler,u),p.handler=void 0,delete d[l]),Object.keys(d).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return a.call(this,l,c,u)}}))})}function Wf(t){if(t.type!==ei)return!1;try{if(!t.target||t.target._sentryId!==ti)return!1}catch{}return!0}function qf(t,e){return t!=="keypress"?!1:e!=null&&e.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function fa(t,e=!1){return n=>{if(!n||n._sentryCaptured)return;const r=Gf(n);if(qf(n.type,r))return;mt(n,"_sentryCaptured",!0),r&&!r._sentryId&&mt(r,"_sentryId",Fe());const s=n.type==="keypress"?"input":n.type;Wf(n)||(t({event:n,name:s,global:e}),ei=n.type,ti=r?r._sentryId:void 0),clearTimeout(pa),pa=ke.setTimeout(()=>{ti=void 0,ei=void 0},Hf)}}function Gf(t){try{return t.target}catch{return null}}let Yn;function Uc(t){const e="history";Rt(e,t),Ot(e,Vf)}function Vf(){if(ke.addEventListener("popstate",()=>{const e=ke.location.href,n=Yn;if(Yn=e,n===e)return;je("history",{from:n,to:e})}),!vf())return;function t(e){return function(...n){const r=n.length>2?n[2]:void 0;if(r){const s=Yn,i=Yf(String(r));if(Yn=i,s===i)return e.apply(this,n);je("history",{from:s,to:i})}return e.apply(this,n)}}$e(ke.history,"pushState",t),$e(ke.history,"replaceState",t)}function Yf(t){try{return new URL(t,ke.location.origin).toString()}catch{return t}}const dr={};function Kf(t){const e=dr[t];if(e)return e;let n=ke[t];if(Xs(n))return dr[t]=n.bind(ke);const r=ke.document;if(r&&typeof r.createElement=="function")try{const s=r.createElement("iframe");s.hidden=!0,r.head.appendChild(s);const i=s.contentWindow;i!=null&&i[t]&&(n=i[t]),r.head.removeChild(s)}catch(s){Uf&&L.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,s)}return n&&(dr[t]=n.bind(ke))}function Jf(t){dr[t]=void 0}const yn="__sentry_xhr_v3__";function Xf(t){const e="xhr";Rt(e,t),Ot(e,Zf)}function Zf(){if(!ke.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,n,r){const s=new Error,i=et()*1e3,o=Qe(r[0])?r[0].toUpperCase():void 0,a=Qf(r[1]);if(!o||!a)return e.apply(n,r);n[yn]={method:o,url:a,request_headers:{}},o==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const l=()=>{const c=n[yn];if(c&&n.readyState===4){try{c.status_code=n.status}catch{}const u={endTimestamp:et()*1e3,startTimestamp:i,xhr:n,virtualError:s};je("xhr",u)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(c,u,d){return l(),c.apply(u,d)}}):n.addEventListener("readystatechange",l),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(c,u,d){const[p,f]=d,g=u[yn];return g&&Qe(p)&&Qe(f)&&(g.request_headers[p.toLowerCase()]=f),c.apply(u,d)}}),e.apply(n,r)}}),t.send=new Proxy(t.send,{apply(e,n,r){const s=n[yn];if(!s)return e.apply(n,r);r[0]!==void 0&&(s.body=r[0]);const i={startTimestamp:et()*1e3,xhr:n};return je("xhr",i),e.apply(n,r)}})}function Qf(t){if(Qe(t))return t;try{return t.toString()}catch{}}const e_=40;function t_(t,e=Kf("fetch")){let n=0,r=0;async function s(i){const o=i.body.length;n+=o,r++;const a={body:i.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};try{const l=await e(t.url,a);return{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}}catch(l){throw Jf("fetch"),l}finally{n-=o,r--}}return Ip(t,s,Yi(t.bufferSize||e_))}const Qr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,n_=30,r_=50;function ni(t,e,n,r){const s={filename:t,function:e==="<anonymous>"?Pt:e,in_app:!0};return n!==void 0&&(s.lineno=n),r!==void 0&&(s.colno=r),s}const s_=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,i_=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,o_=/\((\S*)(?::(\d+))(?::(\d+))\)/,a_=/at (.+?) ?\(data:(.+?),/,l_=t=>{var s;const e=t.match(a_);if(e)return{filename:`<data:${e[2]}>`,function:e[1]};const n=s_.exec(t);if(n){const[,i,o,a]=n;return ni(i,Pt,+o,+a)}const r=i_.exec(t);if(r){if(((s=r[2])==null?void 0:s.indexOf("eval"))===0){const l=o_.exec(r[2]);l&&(r[2]=l[1],r[3]=l[2],r[4]=l[3])}const[o,a]=Hc(r[1]||Pt,r[2]);return ni(a,o,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},c_=[n_,l_],u_=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,d_=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,h_=t=>{const e=u_.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const i=d_.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let r=e[3],s=e[1]||Pt;return[s,r]=Hc(s,r),ni(r,s,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},p_=[r_,h_],f_=[c_,p_],__=Jl(...f_),Hc=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:Pt,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Kn=1024,g_="Breadcrumbs",v_=(t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:g_,setup(n){e.console&&sf(E_(n)),e.dom&&Bf(b_(n,e.dom)),e.xhr&&Xf(w_(n)),e.fetch&&bf(S_(n)),e.history&&Uc(k_(n)),e.sentry&&n.on("beforeSendEvent",y_(n))}}},m_=v_;function y_(t){return function(n){Ee()===t&&Ct({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:kt(n)},{event:n})}}function b_(t,e){return function(r){if(Ee()!==t)return;let s,i,o=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>Kn&&(Qr&&L.warn(`\`dom.maxStringLength\` cannot exceed ${Kn}, but a value of ${a} was configured. Sentry will use ${Kn} instead.`),a=Kn),typeof o=="string"&&(o=[o]);try{const c=r.event,u=x_(c)?c.target:c;s=nc(u,{keyAttrs:o,maxStringLength:a}),i=Pd(u)}catch{s="<unknown>"}if(s.length===0)return;const l={category:`ui.${r.name}`,message:s};i&&(l.data={"ui.component_name":i}),Ct(l,{event:r.event,name:r.name,global:r.global})}}function E_(t){return function(n){if(Ee()!==t)return;const r={category:"console",data:{arguments:n.args,logger:"console"},level:af(n.level),message:To(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)r.message=`Assertion failed: ${To(n.args.slice(1)," ")||"console.assert"}`,r.data.arguments=n.args.slice(1);else return;Ct(r,{input:n.args,level:n.level})}}function w_(t){return function(n){if(Ee()!==t)return;const{startTimestamp:r,endTimestamp:s}=n,i=n.xhr[yn];if(!r||!s||!i)return;const{method:o,url:a,status_code:l,body:c}=i,u={method:o,url:a,status_code:l},d={xhr:n.xhr,input:c,startTimestamp:r,endTimestamp:s},p={category:"xhr",data:u,type:"http",level:Dc(l)};t.emit("beforeOutgoingRequestBreadcrumb",p,d),Ct(p,d)}}function S_(t){return function(n){if(Ee()!==t)return;const{startTimestamp:r,endTimestamp:s}=n;if(s&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.fetchData.method,n.fetchData.url,n.error){const i=n.fetchData,o={data:n.error,input:n.args,startTimestamp:r,endTimestamp:s},a={category:"fetch",data:i,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",a,o),Ct(a,o)}else{const i=n.response,o={...n.fetchData,status_code:i==null?void 0:i.status};n.fetchData.request_body_size,n.fetchData.response_body_size,i==null||i.status;const a={input:n.args,response:i,startTimestamp:r,endTimestamp:s},l={category:"fetch",data:o,type:"http",level:Dc(o.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",l,a),Ct(l,a)}}}function k_(t){return function(n){if(Ee()!==t)return;let r=n.from,s=n.to;const i=ps(ae.location.href);let o=r?ps(r):void 0;const a=ps(s);o!=null&&o.path||(o=i),i.protocol===a.protocol&&i.host===a.host&&(s=a.relative),i.protocol===o.protocol&&i.host===o.host&&(r=o.relative),Ct({category:"navigation",data:{from:r,to:s}})}}function x_(t){return!!t&&!!t.target}const I_=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],T_="BrowserApiErrors",P_=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...t};return{name:T_,setupOnce(){e.setTimeout&&$e(ae,"setTimeout",_a),e.setInterval&&$e(ae,"setInterval",_a),e.requestAnimationFrame&&$e(ae,"requestAnimationFrame",$_),e.XMLHttpRequest&&"XMLHttpRequest"in ae&&$e(XMLHttpRequest.prototype,"send",R_);const n=e.eventTarget;n&&(Array.isArray(n)?n:I_).forEach(s=>O_(s,e))}}},C_=P_;function _a(t){return function(...e){const n=e[0];return e[0]=Xt(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${gt(t)}`}}),t.apply(this,e)}}function $_(t){return function(e){return t.apply(this,[Xt(e,{mechanism:{data:{handler:gt(t)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function R_(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(s=>{s in n&&typeof n[s]=="function"&&$e(n,s,function(i){const o={mechanism:{data:{handler:gt(i)},handled:!1,type:`auto.browser.browserapierrors.xhr.${s}`}},a=Bi(i);return a&&(o.mechanism.data.handler=gt(a)),Xt(i,o)})}),t.apply(this,e)}}function O_(t,e){var s,i;const r=(s=ae[t])==null?void 0:s.prototype;(i=r==null?void 0:r.hasOwnProperty)!=null&&i.call(r,"addEventListener")&&($e(r,"addEventListener",function(o){return function(a,l,c){try{A_(l)&&(l.handleEvent=Xt(l.handleEvent,{mechanism:{data:{handler:gt(l),target:t},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return e.unregisterOriginalCallbacks&&F_(this,a,l),o.apply(this,[a,Xt(l,{mechanism:{data:{handler:gt(l),target:t},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),c])}}),$e(r,"removeEventListener",function(o){return function(a,l,c){try{const u=l.__sentry_wrapped__;u&&o.call(this,a,u,c)}catch{}return o.call(this,a,l,c)}}))}function A_(t){return typeof t.handleEvent=="function"}function F_(t,e,n){t&&typeof t=="object"&&"removeEventListener"in t&&typeof t.removeEventListener=="function"&&t.removeEventListener(e,n)}const N_=(t={})=>{const e=t.lifecycle??"route";return{name:"BrowserSession",setupOnce(){if(typeof ae.document>"u"){Qr&&L.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Ko({ignoreDuration:!0}),ds();const n=At();let r=n.getUser();n.addScopeListener(s=>{const i=s.getUser();((r==null?void 0:r.id)!==(i==null?void 0:i.id)||(r==null?void 0:r.ip_address)!==(i==null?void 0:i.ip_address))&&(ds(),r=i)}),e==="route"&&Uc(({from:s,to:i})=>{s!==i&&(Ko({ignoreDuration:!0}),ds())})}}},M_="CultureContext",D_=()=>({name:M_,preprocessEvent(t){var n;const e=j_();e&&(t.contexts={...t.contexts,culture:{...e,...(n=t.contexts)==null?void 0:n.culture}})}}),L_=D_;function j_(){try{const t=ae.Intl;if(!t)return;const e=t.DateTimeFormat().resolvedOptions();return{locale:e.locale,timezone:e.timeZone,calendar:e.calendar}}catch{return}}const U_="GlobalHandlers",H_=(t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:U_,setupOnce(){Error.stackTraceLimit=50},setup(n){e.onerror&&(z_(n),ga("onerror")),e.onunhandledrejection&&(W_(n),ga("onunhandledrejection"))}}},B_=H_;function z_(t){md(e=>{const{stackParser:n,attachStacktrace:r}=Bc();if(Ee()!==t||Lc())return;const{msg:s,url:i,line:o,column:a,error:l}=e,c=V_(Xi(n,l||s,void 0,r,!1),i,o,a);c.level="error",bc(c,{originalException:l,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})})}function W_(t){bd(e=>{const{stackParser:n,attachStacktrace:r}=Bc();if(Ee()!==t||Lc())return;const s=q_(e),i=Yr(s)?G_(s):Xi(n,s,void 0,r,!0);i.level="error",bc(i,{originalException:s,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})})}function q_(t){if(Yr(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function G_(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function V_(t,e,n,r){const s=t.exception=t.exception||{},i=s.values=s.values||[],o=i[0]=i[0]||{},a=o.stacktrace=o.stacktrace||{},l=a.frames=a.frames||[],c=r,u=n,d=Y_(e)??Hi();return l.length===0&&l.push({colno:c,filename:d,function:Pt,in_app:!0,lineno:u}),t}function ga(t){Qr&&L.log(`Global Handler attached: ${t}`)}function Bc(){const t=Ee();return(t==null?void 0:t.getOptions())||{stackParser:()=>[],attachStacktrace:!1}}function Y_(t){if(!(!Qe(t)||t.length===0))return t.startsWith("data:")?`<${jp(t,!1)}>`:t}const K_=()=>({name:"HttpContext",preprocessEvent(t){var r;if(!ae.navigator&&!ae.location&&!ae.document)return;const e=If(),n={...e.headers,...(r=t.request)==null?void 0:r.headers};t.request={...e,...t.request,headers:n}}}),J_="cause",X_=5,Z_="LinkedErrors",Q_=(t={})=>{const e=t.limit||X_,n=t.key||J_;return{name:Z_,preprocessEvent(r,s,i){const o=i.getOptions();rf(Ki,o.stackParser,n,e,r,s)}}},eg=Q_;function tg(){return ng()?(Qr&&on(()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")}),!0):!1}function ng(){var i;if(typeof ae.window>"u")return!1;const t=ae;if(t.nw)return!1;const e=t.chrome||t.browser;if(!((i=e==null?void 0:e.runtime)!=null&&i.id))return!1;const n=Hi(),r=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(ae===ae.top&&r.some(o=>n.startsWith(`${o}://`)))}function rg(t){return[Kp(),qp(),gf(),C_(),m_(),B_(),eg(),uf(),K_(),L_(),N_()]}function sg(t={}){const e=!t.skipBrowserExtensionCheck&&tg();let n=t.defaultIntegrations==null?rg():t.defaultIntegrations;const r={...t,enabled:e?!1:t.enabled,stackParser:gd(t.stackParser||__),integrations:pp({integrations:t.integrations,defaultIntegrations:n}),transport:t.transport||t_};return Dp(Lf,r)}var v=typeof window<"u"?window:void 0,ge=typeof globalThis<"u"?globalThis:v;typeof self>"u"&&(ge.self=ge),typeof File>"u"&&(ge.File=function(){});var Re=ge==null?void 0:ge.navigator,$=ge==null?void 0:ge.document,ve=ge==null?void 0:ge.location,ri=ge==null?void 0:ge.fetch,si=ge!=null&&ge.XMLHttpRequest&&"withCredentials"in new ge.XMLHttpRequest?ge.XMLHttpRequest:void 0,va=ge==null?void 0:ge.AbortController,ig=ge==null?void 0:ge.CompressionStream,Ie=Re==null?void 0:Re.userAgent,M=v??{},ma="1.364.1",Ce={DEBUG:!1,LIB_VERSION:ma,LIB_NAME:"web",JS_SDK_VERSION:ma};function ya(t,e,n,r,s,i,o){try{var a=t[i](o),l=a.value}catch(c){return void n(c)}a.done?e(l):Promise.resolve(l).then(r,s)}function De(t){return function(){var e=this,n=arguments;return new Promise(function(r,s){var i=t.apply(e,n);function o(l){ya(i,r,s,o,a,"next",l)}function a(l){ya(i,r,s,o,a,"throw",l)}o(void 0)})}}function T(){return T=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},T.apply(null,arguments)}function zc(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Wc(){return(Wc=De(function*(t,e){e===void 0&&(e=!0);try{var n=new Blob([t],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return yield new Response(n).blob()}catch(r){return e&&console.error("Failed to gzip compress data",r),null}})).apply(this,arguments)}var og=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],ag=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],ba=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var n=t.toLowerCase();return ag.concat(e).some(r=>{var s=r.toLowerCase();return n.indexOf(s)!==-1})};function q(t,e){return t.indexOf(e)!==-1}var es=function(t){return t.trim()},ii=function(t){return t.replace(/^\$/,"")},qc=Object.prototype,Gc=qc.hasOwnProperty,ts=qc.toString,Y=Array.isArray||function(t){return ts.call(t)==="[object Array]"},Ke=t=>typeof t=="function",_e=t=>t===Object(t)&&!Y(t),Bt=t=>{if(_e(t)){for(var e in t)if(Gc.call(t,e))return!1;return!0}return!1},O=t=>t===void 0,fe=t=>ts.call(t)=="[object String]",hr=t=>fe(t)&&t.trim().length===0,rt=t=>t===null,G=t=>O(t)||rt(t),We=t=>ts.call(t)=="[object Number]"&&t==t,jt=t=>We(t)&&t>0,Xe=t=>ts.call(t)==="[object Boolean]",lg=t=>t instanceof FormData,cg=t=>q(og,t);function Vc(t){return t===null||typeof t!="object"}function wr(t,e){return{}.toString.call(t)==="[object "+e+"]"}function Zi(t){return!O(Event)&&function(e,n){try{return e instanceof n}catch{return!1}}(t,Event)}var ug=[!0,"true",1,"1","yes"],_s=t=>q(ug,t),dg=[!1,"false",0,"0","no"];function ze(t,e,n,r,s){return e>n&&(r.warn("min cannot be greater than max."),e=n),We(t)?t>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+s),ze(s||n,e,n,r))}class hg{constructor(e){this.t={},this.i=e.i,this.o=ze(e.bucketSize,0,100,e.h),this.m=ze(e.refillRate,0,this.o,e.h),this.S=ze(e.refillInterval,0,864e5,e.h)}T(e,n){var r=Math.floor((n-e.lastAccess)/this.S);r>0&&(e.tokens=Math.min(e.tokens+r*this.m,this.o),e.lastAccess=e.lastAccess+r*this.S)}consumeRateLimit(e){var n,r=Date.now(),s=String(e),i=this.t[s];return i?this.T(i,r):this.t[s]=i={tokens:this.o,lastAccess:r},i.tokens===0||(i.tokens--,i.tokens===0&&((n=this.i)==null||n.call(this,e)),i.tokens===0)}stop(){this.t={}}}var Jn,Ea,gs,Oe="Mobile",Sr="iOS",Ze="Android",Zt="Tablet",Yc=Ze+" "+Zt,Kc="iPad",Jc="Apple",Xc=Jc+" Watch",In="Safari",Qt="BlackBerry",Zc="Samsung",Qc=Zc+"Browser",eu=Zc+" Internet",It="Chrome",pg=It+" OS",tu=It+" "+Sr,Qi="Internet Explorer",nu=Qi+" "+Oe,eo="Opera",fg=eo+" Mini",to="Edge",ru="Microsoft "+to,qt="Firefox",su=qt+" "+Sr,Fn="Nintendo",Nn="PlayStation",Gt="Xbox",iu=Ze+" "+Oe,ou=Oe+" "+In,bn="Windows",oi=bn+" Phone",wa="Nokia",ai="Ouya",au="Generic",_g=au+" "+Oe.toLowerCase(),lu=au+" "+Zt.toLowerCase(),li="Konqueror",Se="(\\d+(\\.\\d+)?)",vs=new RegExp("Version/"+Se),gg=new RegExp(Gt,"i"),vg=new RegExp(Nn+" \\w+","i"),mg=new RegExp(Fn+" \\w+","i"),no=new RegExp(Qt+"|PlayBook|BB10","i"),yg={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},cu=function(t,e){return e=e||"",q(t," OPR/")&&q(t,"Mini")?fg:q(t," OPR/")?eo:no.test(t)?Qt:q(t,"IE"+Oe)||q(t,"WPDesktop")?nu:q(t,Qc)?eu:q(t,to)||q(t,"Edg/")?ru:q(t,"FBIOS")?"Facebook "+Oe:q(t,"UCWEB")||q(t,"UCBrowser")?"UC Browser":q(t,"CriOS")?tu:q(t,"CrMo")||q(t,It)?It:q(t,Ze)&&q(t,In)?iu:q(t,"FxiOS")?su:q(t.toLowerCase(),li.toLowerCase())?li:((n,r)=>r&&q(r,Jc)||function(s){return q(s,In)&&!q(s,It)&&!q(s,Ze)}(n))(t,e)?q(t,Oe)?ou:In:q(t,qt)?qt:q(t,"MSIE")||q(t,"Trident/")?Qi:q(t,"Gecko")?qt:""},bg={[nu]:[new RegExp("rv:"+Se)],[ru]:[new RegExp(to+"?\\/"+Se)],[It]:[new RegExp("("+It+"|CrMo)\\/"+Se)],[tu]:[new RegExp("CriOS\\/"+Se)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Se)],[In]:[vs],[ou]:[vs],[eo]:[new RegExp("(Opera|OPR)\\/"+Se)],[qt]:[new RegExp(qt+"\\/"+Se)],[su]:[new RegExp("FxiOS\\/"+Se)],[li]:[new RegExp("Konqueror[:/]?"+Se,"i")],[Qt]:[new RegExp(Qt+" "+Se),vs],[iu]:[new RegExp("android\\s"+Se,"i")],[eu]:[new RegExp(Qc+"\\/"+Se)],[Qi]:[new RegExp("(rv:|MSIE )"+Se)],Mozilla:[new RegExp("rv:"+Se)]},Eg=function(t,e){var n=cu(t,e),r=bg[n];if(O(r))return null;for(var s=0;r.length>s;s++){var i=t.match(r[s]);if(i)return parseFloat(i[i.length-2])}return null},Sa=[[new RegExp(Gt+"; "+Gt+" (.*?)[);]","i"),t=>[Gt,t&&t[1]||""]],[new RegExp(Fn,"i"),[Fn,""]],[new RegExp(Nn,"i"),[Nn,""]],[no,[Qt,""]],[new RegExp(bn,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[oi,""];if(new RegExp(Oe).test(e)&&!/IEMobile\b/.test(e))return[bn+" "+Oe,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var r=yg[n[1]]||"";return/arm/i.test(e)&&(r="RT"),[bn,r]}return[bn,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[Sr,[t[3],t[4],t[5]||"0"].join(".")]:[Sr,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=O(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Ze+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ze+")","i"),t=>t&&t[2]?[Ze,[t[2],t[3],t[4]||"0"].join(".")]:[Ze,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[pg,""]],[/Linux|debian/i,["Linux",""]]],ka=function(t){return mg.test(t)?Fn:vg.test(t)?Nn:gg.test(t)?Gt:new RegExp(ai,"i").test(t)?ai:new RegExp("("+oi+"|WPDesktop)","i").test(t)?oi:/iPad/.test(t)?Kc:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Xc:no.test(t)?Qt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(wa,"i").test(t)?wa:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Oe).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Ze:Yc:new RegExp("(pda|"+Oe+")","i").test(t)?_g:new RegExp(Zt,"i").test(t)&&!new RegExp(Zt+" pc","i").test(t)?lu:""},wg=t=>t instanceof Error;function Sg(t){var e=globalThis._posthogChunkIds;if(e){var n=Object.keys(e);return gs&&n.length===Ea||(Ea=n.length,gs=n.reduce((r,s)=>{Jn||(Jn={});var i=Jn[s];if(i)r[i[0]]=i[1];else for(var o=t(s),a=o.length-1;a>=0;a--){var l=o[a],c=l==null?void 0:l.filename,u=e[s];if(c&&u){r[c]=u,Jn[s]=[c,u];break}}return r},{})),gs}}class kg{constructor(e,n,r){r===void 0&&(r=[]),this.coercers=e,this.stackParser=n,this.modifiers=r}buildFromUnknown(e,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(r,n,0).apply(e),i=this.buildParsingContext(n),o=this.parseStacktrace(s,i);return{$exception_list:this.convertToExceptionList(o,r),$exception_level:"error"}}modifyFrames(e){var n=this;return De(function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&Y(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.stacktrace.frames));return e})()}coerceFallback(e){var n;return{type:"Error",value:"Unknown error",stack:(n=e.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(e,n){var r,s;return e.cause!=null&&(r=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?n.skipFirstLines:0),n.chunkIdMap)),T({},e,{cause:r,stack:s})}applyChunkIds(e,n){return e.map(r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r))}applyCoercers(e,n){for(var r of this.coercers)if(r.match(e))return r.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return De(function*(){var r=e;for(var s of n.modifiers)r=yield s(r);return r})()}convertToExceptionList(e,n){var r,s,i,o={type:e.type,value:e.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(s=n.handled)===null||s===void 0||s,synthetic:(i=e.synthetic)!==null&&i!==void 0&&i}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,T({},n,{handled:!0}))),a}buildParsingContext(e){var n;return{chunkIdMap:Sg(this.stackParser),skipFirstLines:(n=e.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(e,n,r){r===void 0&&(r=0);var s=(i,o)=>{if(4>=o){var a=this.buildCoercingContext(e,n,o);return this.applyCoercers(i,a)}};return T({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:e,apply:i=>s(i,r),next:i=>s(i,r+1)})}}var en="?";function ci(t,e,n,r,s){var i={platform:t,filename:e,function:n==="<anonymous>"?en:n,in_app:!0};return O(r)||(i.lineno=r),O(s)||(i.colno=s),i}var uu=(t,e)=>{var n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:en,n?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},xg=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ig=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Tg=/\((\S*)(?::(\d+))(?::(\d+))\)/,Pg=(t,e)=>{var n=xg.exec(t);if(n){var[,r,s,i]=n;return ci(e,r,en,+s,+i)}var o=Ig.exec(t);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=Tg.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=uu(o[1]||en,o[2]);return ci(e,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Cg=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,$g=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Rg=(t,e)=>{var n=Cg.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=$g.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var s=n[3],i=n[1]||en;return[i,s]=uu(i,s),ci(e,s,i,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},xa=/\(error: (.*)\)/;class Og{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){var r=fe(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var n=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?n+": "+e.message:n}isDOMException(e){return wr(e,"DOMException")}isDOMError(e){return wr(e,"DOMError")}}class Ag{match(e){return(n=>n instanceof Error)(e)}coerce(e,n){return{type:this.getType(e),value:this.getMessage(e,n),stack:this.getStack(e),cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,n){var r=e.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}}class Fg{constructor(){}match(e){return wr(e,"ErrorEvent")&&e.error!=null}coerce(e,n){var r;return n.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}var Ng=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Mg{match(e){return typeof e=="string"}coerce(e,n){var r,[s,i]=this.getInfos(e);return{type:s??"Error",value:i??e,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(e){var n="Error",r=e,s=e.match(Ng);return s&&(n=s[1],r=s[2]),[n,r]}}var Dg=["fatal","error","warning","log","info","debug"];function du(t,e){e===void 0&&(e=40);var n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var s=n.slice(0,r).join(", ");if(e>=s.length)return r===n.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class Lg{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var r,s=this.getErrorPropertyFromObject(e);return s?n.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(r=n.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Zi(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var n="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(n+=" with message: '"+e.message+"'"),n}if("message"in e&&typeof e.message=="string")return e.message;var r=this.getObjectClassName(e);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+du(e)}isSeverityLevel(e){return fe(e)&&!hr(e)&&Dg.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var n in e)if({}.hasOwnProperty.call(e,n)){var r=e[n];if(wg(r))return r}}getObjectClassName(e){try{var n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}}class jg{match(e){return Zi(e)}coerce(e,n){var r,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+du(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class Ug{match(e){return Vc(e)}coerce(e,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class Hg{match(e){return wr(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Zi(e))return!1;try{var n=e.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(e,n){var r,s=this.getUnhandledRejectionReason(e);return Vc(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var hu=function(t,e){var{debugEnabled:n}=e===void 0?{}:e,r={$(s){if(v&&(Ce.DEBUG||M.POSTHOG_DEBUG||n)&&!O(v.console)&&v.console){for(var i=("__rrweb_original__"in v.console[s])?v.console[s].__rrweb_original__:v.console[s],o=arguments.length,a=new Array(o>1?o-1:0),l=1;o>l;l++)a[l-1]=arguments[l];i(t,...a)}},info(){for(var s=arguments.length,i=new Array(s),o=0;s>o;o++)i[o]=arguments[o];r.$("log",...i)},warn(){for(var s=arguments.length,i=new Array(s),o=0;s>o;o++)i[o]=arguments[o];r.$("warn",...i)},error(){for(var s=arguments.length,i=new Array(s),o=0;s>o;o++)i[o]=arguments[o];r.$("error",...i)},critical(){for(var s=arguments.length,i=new Array(s),o=0;s>o;o++)i[o]=arguments[o];console.error(t,...i)},uninitializedWarning(s){r.error("You must initialize PostHog before calling "+s)},createLogger:(s,i)=>hu(t+" "+s,i)};return r},R=hu("[PostHog.js]"),oe=R.createLogger,Bg=oe("[ExternalScriptsLoader]"),Ia=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return Bg.warn(e+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=$==null?void 0:$.querySelectorAll("script");if(r){for(var s,i=function(){if(r[o].src===e){var l=r[o];return l.__posthog_loading_callback_fired?{v:n()}:(l.addEventListener("load",c=>{l.__posthog_loading_callback_fired=!0,n(void 0,c)}),l.onerror=c=>n(c),{v:void 0})}},o=0;r.length>o;o++)if(s=i())return s.v}var a=()=>{if(!$)return n("document not found");var l=$.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=d=>{l.__posthog_loading_callback_fired=!0,n(void 0,d)},l.onerror=d=>n(d),t.config.prepare_external_dependency_script&&(l=t.config.prepare_external_dependency_script(l)),!l)return n("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")$.head.appendChild(l);else{var c,u=$.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):$.body.appendChild(l)}};$!=null&&$.body?a():$==null||$.addEventListener("DOMContentLoaded",a)};M.__PosthogExtensions__=M.__PosthogExtensions__||{},M.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{var r="/static/"+e+".js?v="+t.version;if(e==="remote-config"&&(r="/array/"+t.config.token+"/config.js"),e==="toolbar"){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var i=t.requestRouter.endpointFor("assets",r);Ia(t,i,n)},M.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{var r=t.requestRouter.endpointFor("api",e);Ia(t,r,n)};var pu="$people_distinct_id",kr="$device_id",En="__alias",wn="__timers",Ta="$autocapture_disabled_server_side",ui="$heatmaps_enabled_server_side",Pa="$exception_capture_enabled_server_side",di="$error_tracking_suppression_rules",Ca="$error_tracking_capture_extension_exceptions",$a="$web_vitals_enabled_server_side",fu="$dead_clicks_enabled_server_side",Ra="$product_tours_enabled_server_side",Oa="$web_vitals_allowed_metrics",Xn="$session_recording_remote_config",xr="$sesid",_u="$session_is_sampled",zt="$enabled_feature_flags",Sn="$early_access_features",hi="$feature_flag_details",kn="$stored_person_properties",St="$stored_group_properties",pi="$surveys",Tn="$flag_call_reported",fi="$flag_call_reported_session_id",_i="$feature_flag_errors",Ir="$feature_flag_evaluated_at",Me="$user_state",gi="$client_session_props",vi="$capture_rate_limit",mi="$initial_campaign_params",yi="$initial_referrer_info",Tr="$initial_person_info",Pr="$epp",gu="__POSTHOG_TOOLBAR__",Zn="$posthog_cookieless",zg=[pu,En,"__cmpns",wn,"$session_recording_enabled_server_side",ui,xr,zt,di,Me,Sn,hi,St,kn,pi,Tn,fi,_i,Ir,gi,vi,mi,yi,Pr,Tr],ro="PostHog loadExternalDependency extension not found.",Ve="on_reject",Le="always",Nt="anonymous",Mt="identified",bi="identified_only",Cr="visibilitychange",$r="beforeunload",Ut="$pageview",ms="$pageleave",ys="$identify",Aa="$groupidentify";function Qn(t,e){Y(t)&&t.forEach(e)}function te(t,e){if(!G(t))if(Y(t))t.forEach(e);else if(lg(t))t.forEach((r,s)=>e(r,s));else for(var n in t)Gc.call(t,n)&&e(t[n],n)}var ce=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;e>r;r++)n[r-1]=arguments[r];for(var s of n)for(var i in s)s[i]!==void 0&&(t[i]=s[i]);return t};function pr(t){for(var e=Object.keys(t),n=e.length,r=new Array(n);n--;)r[n]=[e[n],t[e[n]]];return r}var Fa=function(t){try{return t()}catch{return}},Wg=function(t){return function(){try{for(var e=arguments.length,n=new Array(e),r=0;e>r;r++)n[r]=arguments[r];return t.apply(this,n)}catch(s){R.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),R.critical(s)}}},so=function(t){var e={};return te(t,function(n,r){(fe(n)&&n.length>0||We(n))&&(e[r]=n)}),e},qg=["herokuapp.com","vercel.app","netlify.app"];function Gg(t){var e=t==null?void 0:t.hostname;if(!fe(e))return!1;var n=e.split(".").slice(-2).join(".");for(var r of qg)if(n===r)return!1;return!0}function he(t,e,n,r){var{capture:s=!1,passive:i=!0}=r??{};t==null||t.addEventListener(e,n,{capture:s,passive:i})}function vu(t){return t.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return We(t)&&isFinite(t)&&Math.floor(t)===t});class Rr{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,r,s){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(s)||0>e||0>n||0>r||0>s||e>0xffffffffffff||n>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=e/Math.pow(2,40),i[1]=e/Math.pow(2,32),i[2]=e/Math.pow(2,24),i[3]=e/Math.pow(2,16),i[4]=e/Math.pow(2,8),i[5]=e,i[6]=112|n>>>8,i[7]=n,i[8]=128|r>>>24,i[9]=r>>>16,i[10]=r>>>8,i[11]=r,i[12]=s>>>24,i[13]=s>>>16,i[14]=s>>>8,i[15]=s,new Rr(i)}toString(){for(var e="",n=0;this.bytes.length>n;n++)e=e+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Rr(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var n=0;16>n;n++){var r=this.bytes[n]-e.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class Vg{constructor(){this.k=0,this.R=0,this.P=new Yg}generate(){var e=this.generateOrAbort();if(O(e)){this.k=0;var n=this.generateOrAbort();if(O(n))throw new Error("Could not generate UUID after timestamp reset");return n}return e}generateOrAbort(){var e=Date.now();if(e>this.k)this.k=e,this.O();else{if(this.k>=e+1e4)return;this.R++,this.R>4398046511103&&(this.k++,this.O())}return Rr.fromFieldsV7(this.k,Math.trunc(this.R/Math.pow(2,30)),this.R&Math.pow(2,30)-1,this.P.nextUint32())}O(){this.R=1024*this.P.nextUint32()+(1023&this.P.nextUint32())}}var Na,mu=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};v&&!O(v.crypto)&&crypto.getRandomValues&&(mu=t=>crypto.getRandomValues(t));class Yg{constructor(){this.I=new Uint32Array(8),this.C=1/0}nextUint32(){return this.I.length>this.C||(mu(this.I),this.C=0),this.I[this.C++]}}var ht=()=>Kg().toString(),Kg=()=>(Na||(Na=new Vg)).generate(),un="",Jg=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,He={F:()=>!!$,A(t){R.error("cookieStore error: "+t)},M(t){if($){try{for(var e=t+"=",n=$.cookie.split(";").filter(i=>i.length),r=0;n.length>r;r++){for(var s=n[r];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}},D(t){var e;try{e=JSON.parse(He.M(t))||{}}catch{}return e},L(t,e,n,r,s){if($)try{var i="",o="",a=function(u,d){if(d){var p=function(g,_){if(_===void 0&&(_=$),un)return un;if(!_||["localhost","127.0.0.1"].includes(g))return"";for(var P=g.split("."),m=Math.min(P.length,8),b="dmn_chk_"+ht();!un&&m--;){var C=P.slice(m).join("."),x=b+"=1;domain=."+C+";path=/";_.cookie=x+";max-age=3",_.cookie.includes(b)&&(_.cookie=x+";max-age=0",un=C)}return un}(u);if(!p){var f=(g=>{var _=g.match(Jg);return _?_[0]:""})(u);f!==p&&R.info("Warning: cookie subdomain discovery mismatch",f,p),p=f}return p?"; domain=."+p:""}return""}($.location.hostname,r);if(n){var l=new Date;l.setTime(l.getTime()+864e5*n),i="; expires="+l.toUTCString()}s&&(o="; secure");var c=t+"="+encodeURIComponent(JSON.stringify(e))+i+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&R.warn("cookieStore warning: large cookie, len="+c.length),$.cookie=c,c}catch{return}},U(t,e){if($!=null&&$.cookie)try{He.L(t,"",-1,e)}catch{return}}},bs=null,se={F(){if(!rt(bs))return bs;var t=!0;if(O(v))t=!1;else try{var e="__mplssupport__";se.L(e,"xyz"),se.M(e)!=='"xyz"'&&(t=!1),se.U(e)}catch{t=!1}return t||R.error("localStorage unsupported; falling back to cookie store"),bs=t,t},A(t){R.error("localStorage error: "+t)},M(t){try{return v==null?void 0:v.localStorage.getItem(t)}catch(e){se.A(e)}return null},D(t){try{return JSON.parse(se.M(t))||{}}catch{}return null},L(t,e){try{v==null||v.localStorage.setItem(t,JSON.stringify(e))}catch(n){se.A(n)}},U(t){try{v==null||v.localStorage.removeItem(t)}catch(e){se.A(e)}}},Xg=[kr,"distinct_id",xr,_u,Pr,Tr,Me],er={},Zg={F:()=>!0,A(t){R.error("memoryStorage error: "+t)},M:t=>er[t]||null,D:t=>er[t]||null,L(t,e){er[t]=e},U(t){delete er[t]}},bt=null,me={F(){if(!rt(bt))return bt;if(bt=!0,O(v))bt=!1;else try{var t="__support__";me.L(t,"xyz"),me.M(t)!=='"xyz"'&&(bt=!1),me.U(t)}catch{bt=!1}return bt},A(t){R.error("sessionStorage error: ",t)},M(t){try{return v==null?void 0:v.sessionStorage.getItem(t)}catch(e){me.A(e)}return null},D(t){try{return JSON.parse(me.M(t))||null}catch{}return null},L(t,e){try{v==null||v.sessionStorage.setItem(t,JSON.stringify(e))}catch(n){me.A(n)}},U(t){try{v==null||v.sessionStorage.removeItem(t)}catch(e){me.A(e)}}};class Qg{constructor(e){this._instance=e}get N(){return this._instance.config}get consent(){return this.j()?0:this.B}isOptedOut(){return this.N.cookieless_mode===Le||this.consent===0||this.consent===-1&&(this.N.opt_out_capturing_by_default||this.N.cookieless_mode===Ve)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}optInOut(e){this.H.L(this.q,e?1:0,this.N.cookie_expiration,this.N.cross_subdomain_cookie,this.N.secure_cookie)}reset(){this.H.U(this.q,this.N.cross_subdomain_cookie)}get q(){var{token:e,opt_out_capturing_cookie_prefix:n,consent_persistence_name:r}=this._instance.config;return r||(n?n+e:"__ph_opt_in_out_"+e)}get B(){var e=this.H.M(this.q);return _s(e)?1:q(dg,e)?0:-1}get H(){if(!this.W){var e=this.N.opt_out_capturing_persistence_type;this.W=e==="localStorage"?se:He;var n=e==="localStorage"?He:se;n.M(this.q)&&(this.W.M(this.q)||this.optInOut(_s(n.M(this.q))),n.U(this.q,this.N.cross_subdomain_cookie))}return this.W}j(){return!!this.N.respect_dnt&&[Re==null?void 0:Re.doNotTrack,Re==null?void 0:Re.msDoNotTrack,M.doNotTrack].some(e=>_s(e))}}var tr=oe("[Dead Clicks]"),ev=()=>!0,tv=t=>{var e,n=!((e=t.instance.persistence)==null||!e.get_property(fu)),r=t.instance.config.capture_dead_clicks;return Xe(r)?r:!!_e(r)||n};class Ma{get lazyLoadedDeadClicksAutocapture(){return this.V}constructor(e,n,r){this.instance=e,this.isEnabled=n,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[fu]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Y(()=>{this.G()}):this.stop()}Y(e){var n,r;(n=M.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture&&e(),(r=M.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",s=>{s?tr.error("failed to load script",s):e()})}G(){var e;if($){if(!this.V&&(e=M.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var n=_e(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.V=M.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.V.start($),tr.info("starting...")}}else tr.error("`document` not found. Cannot start.")}stop(){this.V&&(this.V.stop(),this.V=void 0,tr.info("stopping..."))}}var Es=oe("[SegmentIntegration]"),yu="posthog-js";function bu(t,e){var{organization:n,projectId:r,prefix:s,severityAllowList:i=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var l,c,u,d,p;if(i!=="*"&&!i.includes(a.level)||!t.__loaded)return a;a.tags||(a.tags={});var f=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());a.tags["PostHog Person URL"]=f,t.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var g,_=((l=a.exception)==null?void 0:l.values)||[],P=_.map(b=>T({},b,{stacktrace:b.stacktrace?T({},b.stacktrace,{type:"raw",frames:(b.stacktrace.frames||[]).map(C=>T({},C,{platform:"web:javascript"}))}):void 0})),m={$exception_message:((c=_[0])==null?void 0:c.value)||a.message,$exception_type:(u=_[0])==null?void 0:u.type,$exception_level:a.level,$exception_list:P,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((d=_[0])==null?void 0:d.value)||a.message,$sentry_exception_type:(p=_[0])==null?void 0:p.type,$sentry_tags:a.tags};return n&&r&&(m.$sentry_url=(s||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+a.event_id),o&&((g=t.exceptions)==null||g.sendExceptionEvent(m)),a}}class nv{constructor(e,n,r,s,i,o){this.name=yu,this.setupOnce=function(a){a(bu(e,{organization:n,projectId:r,prefix:s,severityAllowList:i,sendExceptionsToPostHog:o==null||o}))}}}class Da{constructor(e){this.J=(n,r,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength)&&(R.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:s}),this.K=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.X()}X(){var e;this.Z=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.J)}destroy(){var e;(e=this.Z)==null||e.call(this),this.Z=void 0}doPageView(e,n){var r,s=this.tt(e,n);return this.K={pathname:(r=v==null?void 0:v.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var n;return this.tt(e,(n=this.K)==null?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.K)==null?void 0:e.pageViewId}}tt(e,n){var r=this.K;if(!r)return{$pageview_id:n};var s={$pageview_id:n,$prev_pageview_id:r.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:l,maxContentHeight:c,lastContentY:u,maxContentY:d}=i;if(!(O(o)||O(a)||O(l)||O(c)||O(u)||O(d))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),d=Math.ceil(d);var p=o>1?ze(a/o,0,1,R):1,f=o>1?ze(l/o,0,1,R):1,g=c>1?ze(u/c,0,1,R):1,_=c>1?ze(d/c,0,1,R):1;s=ce(s,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:g,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:_})}}return r.pathname&&(s.$prev_pageview_pathname=r.pathname),r.timestamp&&(s.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),s}}var Or=t=>{var e=$==null?void 0:$.createElement("a");return O(e)?null:(e.href=t,e)},Ar=function(t,e){for(var n,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var i=r[s].split("=");if(i[0]===e){n=i;break}}if(!Y(n)||2>n.length)return"";var o=n[1];try{o=decodeURIComponent(o)}catch{R.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Mn=function(t,e,n){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],i=(r[0]||"").split("?"),o=i[1],a=i[0],l=(o||"").split("&"),c=[],u=0;l.length>u;u++){var d=l[u].split("=");Y(d)&&(e.includes(d[0])?c.push(d[0]+"="+n):c.push(l[u]))}var p=a;return o!=null&&(p+="?"+c.join("&")),s!=null&&(p+="#"+s),p},Fr=function(t,e){var n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},nr="https?://(.*)",tn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],rv=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...tn],Dn="<masked>",sv=["li_fat_id"];function Eu(t,e,n){if(!$)return{};var r,s=e?[...tn,...n||[]]:[],i=wu(Mn($.URL,s,Dn),t),o=(r={},te(sv,function(a){var l=He.M(a);r[a]=l||null}),r);return ce(o,i)}function wu(t,e){var n=rv.concat(e||[]),r={};return te(n,function(s){var i=Ar(t,s);r[s]=i||null}),r}function Su(t){var e=function(i){return i?i.search(nr+"google.([^/?]*)")===0?"google":i.search(nr+"bing.com")===0?"bing":i.search(nr+"yahoo.com")===0?"yahoo":i.search(nr+"duckduckgo.com")===0?"duckduckgo":null:null}(t),n=e!="yahoo"?"q":"p",r={};if(!rt(e)){r.$search_engine=e;var s=$?Ar($.referrer,n):"";s.length&&(r.ph_keyword=s)}return r}function La(){return navigator.language||navigator.userLanguage}var Nr="$direct";function ku(){return($==null?void 0:$.referrer)||Nr}function xu(t,e){var n=t?[...tn,...e||[]]:[],r=ve==null?void 0:ve.href.substring(0,1e3);return{r:ku().substring(0,1e3),u:r?Mn(r,n,Dn):void 0}}function Iu(t){var e,{r:n,u:r}=t,s={$referrer:n,$referring_domain:n==null?void 0:n==Nr?Nr:(e=Or(n))==null?void 0:e.host};if(r){s.$current_url=r;var i=Or(r);s.$host=i==null?void 0:i.host,s.$pathname=i==null?void 0:i.pathname;var o=wu(r);ce(s,o)}if(n){var a=Su(n);ce(s,a)}return s}function Tu(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function iv(){try{return new Date().getTimezoneOffset()}catch{return}}var ov=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class ws{constructor(e,n){this.N=e,this.props={},this.it=!1,this.et=(r=>{var s="";return r.token&&(s=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+s+"_posthog"})(e),this.H=this.rt(e),this.load(),e.debug&&R.info("Persistence loaded",e.persistence,T({},this.props)),this.update_config(e,e,n),this.save()}isDisabled(){return!!this.st}rt(e){ov.indexOf(e.persistence.toLowerCase())===-1&&(R.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n=function(s){s===void 0&&(s=[]);var i=[...Xg,...s];return T({},se,{D(o){try{var a={};try{a=He.D(o)||{}}catch{}var l=ce(a,JSON.parse(se.M(o)||"{}"));return se.L(o,l),l}catch{}return null},L(o,a,l,c,u,d){try{se.L(o,a,void 0,void 0,d);var p={};i.forEach(f=>{a[f]&&(p[f]=a[f])}),Object.keys(p).length&&He.L(o,p,l,c,u,d)}catch(f){se.A(f)}},U(o,a){try{v==null||v.localStorage.removeItem(o),He.U(o,a)}catch(l){se.A(l)}}})}(e.cookie_persisted_properties||[]),r=e.persistence.toLowerCase();return r==="localstorage"&&se.F()?se:r==="localstorage+cookie"&&n.F()?n:r==="sessionstorage"&&me.F()?me:r==="memory"?Zg:r==="cookie"?He:n.F()?n:He}nt(e){var n=e??this.N.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var r=this.props[Ir];return!r||typeof r!="number"||Date.now()-r>n}properties(){var e={};return te(this.props,(n,r)=>{if(r===zt&&_e(n)){if(!this.nt())for(var s=Object.keys(n),i=0;s.length>i;i++)e["$feature/"+s[i]]=n[s[i]]}else zg.indexOf(r)===-1&&(e[r]=n)}),e}load(){if(!this.st){var e=this.H.D(this.et);e&&(this.props=ce({},e))}}save(){this.st||this.H.L(this.et,this.props,this.ot,this.ut,this.ht,this.N.debug)}remove(){this.H.U(this.et,!1),this.H.U(this.et,!0)}clear(){this.remove(),this.props={}}register_once(e,n,r){if(_e(e)){O(n)&&(n="None"),this.ot=O(r)?this.dt:r;var s=!1;if(te(e,(i,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==n||(this.props[o]=i,s=!0)}),s)return this.save(),!0}return!1}register(e,n){if(_e(e)){this.ot=O(n)?this.dt:n;var r=!1;if(te(e,(s,i)=>{e.hasOwnProperty(i)&&this.props[i]!==s&&(this.props[i]=s,r=!0)}),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.it){var e=Eu(this.N.custom_campaign_params,this.N.mask_personal_data_properties,this.N.custom_personal_data_properties);Bt(so(e))||this.register(e),this.it=!0}}update_search_keyword(){var e;this.register((e=$==null?void 0:$.referrer)?Su(e):{})}update_referrer_info(){var e;this.register_once({$referrer:ku(),$referring_domain:$!=null&&$.referrer&&((e=Or($.referrer))==null?void 0:e.host)||Nr},void 0)}set_initial_person_info(){this.props[mi]||this.props[yi]||this.register_once({[Tr]:xu(this.N.mask_personal_data_properties,this.N.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};te([yi,mi],o=>{var a=this.props[o];a&&te(a,function(l,c){e["$initial_"+ii(c)]=l})});var n,r,s=this.props[Tr];if(s){var i=(n=Iu(s),r={},te(n,function(o,a){r["$initial_"+ii(a)]=o}),r);ce(e,i)}return e}safe_merge(e){return te(this.props,function(n,r){r in e||(e[r]=n)}),e}update_config(e,n,r){if(this.dt=this.ot=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==n.persistence||!((o,a)=>{if(o.length!==a.length)return!1;var l=[...o].sort(),c=[...a].sort();return l.every((u,d)=>u===c[d])})(e.cookie_persisted_properties||[],n.cookie_persisted_properties||[])){var s=this.rt(e),i=this.props;this.clear(),this.H=s,this.props=i,this.save()}}set_disabled(e){this.st=e,this.st?this.remove():this.save()}set_cross_subdomain(e){e!==this.ut&&(this.ut=e,this.remove(),this.save())}set_secure(e){e!==this.ht&&(this.ht=e,this.remove(),this.save())}set_event_timer(e,n){var r=this.props[wn]||{};r[e]=n,this.props[wn]=r,this.save()}remove_event_timer(e){var n=(this.props[wn]||{})[e];return O(n)||(delete this.props[wn][e],this.save()),n}get_property(e){return this.props[e]}set_property(e,n){this.props[e]=n,this.save()}}var dn={Activation:"events",Cancellation:"cancelEvents"},Ss={Popover:"popover",API:"api",Widget:"widget"},xn={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},ks={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Ei={Popover:"popover",Inline:"inline"},av={SHOWN:"product tour shown"},ja={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Ua=oe("[RateLimiter]");class lv{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var r=n.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach(s=>{Ua.info((s||"events")+" is quota limited."),this.serverLimits[s]=new Date().getTime()+6e4})}catch(s){return void Ua.warn('could not rate limit - continuing. Error: "'+(s==null?void 0:s.message)+'"',{text:r})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var n,r,s;e===void 0&&(e=!1);var{captureEventsBurstLimit:i,captureEventsPerSecond:o}=this,a=new Date().getTime(),l=(n=(r=this.instance.persistence)==null?void 0:r.get_property(vi))!==null&&n!==void 0?n:{tokens:i,last:a};l.tokens+=(a-l.last)/1e3*o,l.last=a,l.tokens>i&&(l.tokens=i);var c=1>l.tokens;return c||e||(l.tokens=Math.max(0,l.tokens-1)),!c||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+o+" events per second and "+i+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=c,(s=this.instance.persistence)==null||s.set_property(vi,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var hn=oe("[RemoteConfig]");class Pu{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=M._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}vt(e){var n,r;(n=M.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=M.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}ct(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){e(n.json)}})}load(){try{if(this.remoteConfig)return hn.info("Using preloaded remote config",this.remoteConfig),this.ft(this.remoteConfig),void this._t();if(this._instance.bt())return void hn.warn("Remote config is disabled. Falling back to local config.");this.vt(e=>{if(!e)return hn.info("No config found after loading remote JS config. Falling back to JSON."),void this.ct(n=>{this.ft(n),this._t()});this.ft(e),this._t()})}catch(e){hn.error("Error loading remote config",e)}}stop(){this.yt&&(clearInterval(this.yt),this.yt=void 0)}refresh(){this._instance.bt()||($==null?void 0:$.visibilityState)==="hidden"||this._instance.reloadFeatureFlags()}_t(){var e;if(!this.yt){var n=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;n!==0&&(this.yt=setInterval(()=>{this.refresh()},n))}}ft(e){var n;e||hn.error("Failed to fetch remote config from PostHog."),this._instance.ft(e??{}),(e==null?void 0:e.hasFeatureFlags)!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded())}}var Ue={GZipJS:"gzip-js",Base64:"base64"},Ne=Uint8Array,Te=Uint16Array,nn=Uint32Array,io=new Ne([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),oo=new Ne([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ha=new Ne([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Cu=function(t,e){for(var n=new Te(31),r=0;31>r;++r)n[r]=e+=1<<t[r-1];var s=new nn(n[30]);for(r=1;30>r;++r)for(var i=n[r];n[r+1]>i;++i)s[i]=i-n[r]<<5|r;return[n,s]},$u=Cu(io,2),wi=$u[1];$u[0][28]=258,wi[258]=28;for(var Ba=Cu(oo,0)[1],Ru=new Te(32768),ne=0;32768>ne;++ne){var Dt=(43690&ne)>>>1|(21845&ne)<<1;Ru[ne]=((65280&(Dt=(61680&(Dt=(52428&Dt)>>>2|(13107&Dt)<<2))>>>4|(3855&Dt)<<4))>>>8|(255&Dt)<<8)>>>1}var Pn=function(t,e,n){for(var r=t.length,s=0,i=new Te(e);r>s;++s)++i[t[s]-1];var o,a=new Te(e);for(s=0;e>s;++s)a[s]=a[s-1]+i[s-1]<<1;for(o=new Te(r),s=0;r>s;++s)o[s]=Ru[a[t[s]-1]++]>>>15-t[s];return o},$t=new Ne(288);for(ne=0;144>ne;++ne)$t[ne]=8;for(ne=144;256>ne;++ne)$t[ne]=9;for(ne=256;280>ne;++ne)$t[ne]=7;for(ne=280;288>ne;++ne)$t[ne]=8;var Mr=new Ne(32);for(ne=0;32>ne;++ne)Mr[ne]=5;var cv=Pn($t,9),uv=Pn(Mr,5),Ou=function(t){return(t/8>>0)+(7&t&&1)},Au=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var r=new(t instanceof Te?Te:t instanceof nn?nn:Ne)(n-e);return r.set(t.subarray(e,n)),r},Ge=function(t,e,n){var r=e/8>>0;t[r]|=n<<=7&e,t[r+1]|=n>>>8},pn=function(t,e,n){var r=e/8>>0;t[r]|=n<<=7&e,t[r+1]|=n>>>8,t[r+2]|=n>>>16},xs=function(t,e){for(var n=[],r=0;t.length>r;++r)t[r]&&n.push({s:r,f:t[r]});var s=n.length,i=n.slice();if(!s)return[new Ne(0),0];if(s==1){var o=new Ne(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(S,k){return S.f-k.f}),n.push({s:-1,f:25001});var a=n[0],l=n[1],c=0,u=1,d=2;for(n[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=n[n[d].f>n[c].f?c++:d++],l=n[c!=u&&n[d].f>n[c].f?c++:d++],n[u++]={s:-1,f:a.f+l.f,l:a,r:l};var p=i[0].s;for(r=1;s>r;++r)i[r].s>p&&(p=i[r].s);var f=new Te(p+1),g=Si(n[u-1],f,0);if(g>e){r=0;var _=0,P=g-e,m=1<<P;for(i.sort(function(S,k){return f[k.s]-f[S.s]||S.f-k.f});s>r;++r){var b=i[r].s;if(e>=f[b])break;_+=m-(1<<g-f[b]),f[b]=e}for(_>>>=P;_>0;){var C=i[r].s;e>f[C]?_-=1<<e-f[C]++-1:++r}for(;r>=0&&_;--r){var x=i[r].s;f[x]==e&&(--f[x],++_)}g=e}return[new Ne(f),g]},Si=function(t,e,n){return t.s==-1?Math.max(Si(t.l,e,n+1),Si(t.r,e,n+1)):e[t.s]=n},za=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new Te(++e),r=0,s=t[0],i=1,o=function(l){n[r++]=l},a=1;e>=a;++a)if(t[a]==s&&a!=e)++i;else{if(!s&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(s),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(s);i=1,s=t[a]}return[n.subarray(0,r),e]},fn=function(t,e){for(var n=0,r=0;e.length>r;++r)n+=t[r]*e[r];return n},ki=function(t,e,n){var r=n.length,s=Ou(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var i=0;r>i;++i)t[s+i+4]=n[i];return 8*(s+4+r)},Wa=function(t,e,n,r,s,i,o,a,l,c,u){Ge(e,u++,n),++s[256];for(var d=xs(s,15),p=d[0],f=d[1],g=xs(i,15),_=g[0],P=g[1],m=za(p),b=m[0],C=m[1],x=za(_),S=x[0],k=x[1],w=new Te(19),E=0;b.length>E;++E)w[31&b[E]]++;for(E=0;S.length>E;++E)w[31&S[E]]++;for(var I=xs(w,7),A=I[0],j=I[1],F=19;F>4&&!A[Ha[F-1]];--F);var H,B,K,Z,N=c+5<<3,z=fn(s,$t)+fn(i,Mr)+o,ee=fn(s,p)+fn(i,_)+o+14+3*F+fn(w,A)+(2*w[16]+3*w[17]+7*w[18]);if(z>=N&&ee>=N)return ki(e,u,t.subarray(l,l+c));if(Ge(e,u,1+(z>ee)),u+=2,z>ee){H=Pn(p,f),B=p,K=Pn(_,P),Z=_;var V=Pn(A,j);for(Ge(e,u,C-257),Ge(e,u+5,k-1),Ge(e,u+10,F-4),u+=14,E=0;F>E;++E)Ge(e,u+3*E,A[Ha[E]]);u+=3*F;for(var le=[b,S],D=0;2>D;++D){var y=le[D];for(E=0;y.length>E;++E)Ge(e,u,V[X=31&y[E]]),u+=A[X],X>15&&(Ge(e,u,y[E]>>>5&127),u+=y[E]>>>12)}}else H=cv,B=$t,K=uv,Z=Mr;for(E=0;a>E;++E)if(r[E]>255){var X;pn(e,u,H[257+(X=r[E]>>>18&31)]),u+=B[X+257],X>7&&(Ge(e,u,r[E]>>>23&31),u+=io[X]);var de=31&r[E];pn(e,u,K[de]),u+=Z[de],de>3&&(pn(e,u,r[E]>>>5&8191),u+=oo[de])}else pn(e,u,H[r[E]]),u+=B[r[E]];return pn(e,u,H[256]),u+B[256]},dv=new nn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),hv=function(){for(var t=new nn(256),e=0;256>e;++e){for(var n=e,r=9;--r;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),Is=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function pv(t,e){e===void 0&&(e={});var n=function(){var d=4294967295;return{p(p){for(var f=d,g=0;p.length>g;++g)f=hv[255&f^p[g]]^f>>>8;d=f},d(){return 4294967295^d}}}(),r=t.length;n.p(t);var s,i,o,a,l,c=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,function(d,p,f,g,_,P){var m=d.length,b=new Ne(g+m+5*(1+Math.floor(m/7e3))+_),C=b.subarray(g,b.length-_),x=0;if(!p||8>m)for(var S=0;m>=S;S+=65535){var k=S+65535;m>k?x=ki(C,x,d.subarray(S,k)):(C[S]=!0,x=ki(C,x,d.subarray(S,m)))}else{for(var w=dv[p-1],E=w>>>13,I=8191&w,A=(1<<f)-1,j=new Te(32768),F=new Te(A+1),H=Math.ceil(f/3),B=2*H,K=function(is){return(d[is]^d[is+1]<<H^d[is+2]<<B)&A},Z=new nn(25e3),N=new Te(288),z=new Te(32),ee=0,V=0,le=(S=0,0),D=0,y=0;m>S;++S){var X=K(S),de=32767&S,ye=F[X];if(j[de]=ye,F[X]=de,S>=D){var xe=m-S;if((ee>7e3||le>24576)&&xe>423){x=Wa(d,C,0,Z,N,z,V,le,y,S-y,x),le=ee=V=0,y=S;for(var Pe=0;286>Pe;++Pe)N[Pe]=0;for(Pe=0;30>Pe;++Pe)z[Pe]=0}var yt=2,qn=0,Xu=I,st=de-ye&32767;if(xe>2&&X==K(S-st))for(var Zu=Math.min(E,xe)-1,Qu=Math.min(32767,S),ed=Math.min(258,xe);Qu>=st&&--Xu&&de!=ye;){if(d[S+yt]==d[S+yt-st]){for(var it=0;ed>it&&d[S+it]==d[S+it-st];++it);if(it>yt){if(yt=it,qn=st,it>Zu)break;var td=Math.min(st,it-2),ho=0;for(Pe=0;td>Pe;++Pe){var ss=S-st+Pe+32768&32767,po=ss-j[ss]+32768&32767;po>ho&&(ho=po,ye=ss)}}}st+=(de=ye)-(ye=j[de])+32768&32767}if(qn){Z[le++]=268435456|wi[yt]<<18|Ba[qn];var fo=31&wi[yt],_o=31&Ba[qn];V+=io[fo]+oo[_o],++N[257+fo],++z[_o],D=S+yt,++ee}else Z[le++]=d[S],++N[d[S]]}}x=Wa(d,C,!0,Z,N,z,V,le,y,S-y,x)}return Au(b,0,g+Ou(x)+_)}(i=t,(o=e).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):12+o.mem,a,l)),u=c.length;return function(d,p){var f=p.filename;if(d[0]=31,d[1]=139,d[2]=8,d[8]=2>p.level?4:p.level==9?2:0,d[9]=3,p.mtime!=0&&Is(d,4,Math.floor(new Date(p.mtime||Date.now())/1e3)),f){d[3]=8;for(var g=0;f.length>=g;++g)d[g+10]=f.charCodeAt(g)}}(c,e),Is(c,u-8,n.d()),Is(c,u-4,r),c}var fv=!!si||!!ri,Fu="text/plain",Dr=function(t,e,n){var r;n===void 0&&(n=!0);var[s,i]=t.split("?"),o=T({},e),a=(r=i==null?void 0:i.split("&").map(c=>{var u,[d,p]=c.split("="),f=n&&(u=o[d])!==null&&u!==void 0?u:p;return delete o[d],d+"="+f}))!==null&&r!==void 0?r:[],l=function(c,u){var d,p;u===void 0&&(u="&");var f=[];return te(c,function(g,_){O(g)||O(_)||_==="undefined"||(d=encodeURIComponent((P=>P instanceof File)(g)?g.name:g.toString()),p=encodeURIComponent(_),f[f.length]=p+"="+d)}),f.join(u)}(o);return l&&a.push(l),s+"?"+a.join("&")},Wt=(t,e)=>JSON.stringify(t,(n,r)=>typeof r=="bigint"?r.toString():r,e),Ts=t=>{if(t.wt)return t.wt;var{data:e,compression:n}=t;if(e){if(n===Ue.GZipJS){var r=pv(function(a,l){var c=a.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(a);for(var u=new Ne(a.length+(a.length>>>1)),d=0,p=function(P){u[d++]=P},f=0;c>f;++f){if(d+5>u.length){var g=new Ne(d+8+(c-f<<1));g.set(u),u=g}var _=a.charCodeAt(f);128>_?p(_):2048>_?(p(192|_>>>6),p(128|63&_)):_>55295&&57344>_?(p(240|(_=65536+(1047552&_)|1023&a.charCodeAt(++f))>>>18),p(128|_>>>12&63),p(128|_>>>6&63),p(128|63&_)):(p(224|_>>>12),p(128|_>>>6&63),p(128|63&_))}return Au(u,0,d)}(Wt(e)),{mtime:0});return{contentType:Fu,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===Ue.Base64){var s=function(a){return a&&btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,(l,c)=>String.fromCharCode(parseInt(c,16))))}(Wt(e)),i=(a=>"data="+encodeURIComponent(typeof a=="string"?a:Wt(a)))(s);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}var o=Wt(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},_v=function(){var t=De(function*(e){var n=Wt(e.data),r=yield function(i,o){return Wc.apply(this,arguments)}(n,Ce.DEBUG);if(!r)return e;var s=yield r.arrayBuffer();return T({},e,{wt:{contentType:Fu,body:s,estimatedSize:s.byteLength}})});return function(e){return t.apply(this,arguments)}}(),fr=[];ri&&fr.push({transport:"fetch",method(t){var e,n,{contentType:r,body:s,estimatedSize:i}=(e=Ts(t))!==null&&e!==void 0?e:{},o=new Headers;te(t.headers,function(u,d){o.append(d,u)}),r&&o.append("Content-Type",r);var a=t.url,l=null;if(va){var c=new va;l={signal:c.signal,timeout:setTimeout(()=>c.abort(),t.timeout)}}ri(a,T({method:(t==null?void 0:t.method)||"GET",headers:o,keepalive:t.method==="POST"&&52428.8>(i||0),body:s,signal:(n=l)==null?void 0:n.signal},t.fetchOptions)).then(u=>u.text().then(d=>{var p={statusCode:u.status,text:d};if(u.status===200)try{p.json=JSON.parse(d)}catch(f){R.error(f)}t.callback==null||t.callback(p)})).catch(u=>{R.error(u),t.callback==null||t.callback({statusCode:0,error:u})}).finally(()=>l?clearTimeout(l.timeout):null)}}),si&&fr.push({transport:"XHR",method(t){var e,n=new si;n.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=(e=Ts(t))!==null&&e!==void 0?e:{};te(t.headers,function(i,o){n.setRequestHeader(o,i)}),r&&n.setRequestHeader("Content-Type",r),t.timeout&&(n.timeout=t.timeout),t.disableXHRCredentials||(n.withCredentials=!0),n.onreadystatechange=()=>{if(n.readyState===4){var i={statusCode:n.status,text:n.responseText};if(n.status===200)try{i.json=JSON.parse(n.responseText)}catch{}t.callback==null||t.callback(i)}},n.send(s)}}),Re!=null&&Re.sendBeacon&&fr.push({transport:"sendBeacon",method(t){var e=Dr(t.url,{beacon:"1"});try{var n,{contentType:r,body:s}=(n=Ts(t))!==null&&n!==void 0?n:{},i=typeof s=="string"?new Blob([s],{type:r}):s;Re.sendBeacon(e,i)}catch{}}});var xi=3e3;class gv{constructor(e,n){this.Et=!0,this.St=[],this.xt=ze((n==null?void 0:n.flush_interval_ms)||xi,250,5e3,R.createLogger("flush interval"),xi),this.Tt=e}enqueue(e){this.St.push(e),this.$t||this.kt()}unload(){this.Rt();var e=this.St.length>0?this.Pt():{},n=Object.values(e);[...n.filter(r=>r.url.indexOf("/e")===0),...n.filter(r=>r.url.indexOf("/e")!==0)].map(r=>{this.Tt(T({},r,{transport:"sendBeacon"}))})}enable(){this.Et=!1,this.kt()}kt(){var e=this;this.Et||(this.$t=setTimeout(()=>{if(this.Rt(),this.St.length>0){var n=this.Pt(),r=function(){var i=n[s],o=new Date().getTime();i.data&&Y(i.data)&&te(i.data,a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp}),e.Tt(i)};for(var s in n)r()}},this.xt))}Rt(){clearTimeout(this.$t),this.$t=void 0}Pt(){var e={};return te(this.St,n=>{var r,s=n,i=(s?s.batchKey:null)||s.url;O(e[i])&&(e[i]=T({},s,{data:[]})),(r=e[i].data)==null||r.push(s.data)}),this.St=[],e}}var vv=["retriesPerformedSoFar"];class mv{constructor(e){this.Ot=!1,this.It=3e3,this.St=[],this._instance=e,this.St=[],this.Ct=!0,!O(v)&&"onLine"in v.navigator&&(this.Ct=v.navigator.onLine,this.Ft=()=>{this.Ct=!0,this.At()},this.Mt=()=>{this.Ct=!1},he(v,"online",this.Ft),he(v,"offline",this.Mt))}get length(){return this.St.length}retriableRequest(e){var{retriesPerformedSoFar:n}=e,r=zc(e,vv);jt(n)&&(r.url=Dr(r.url,{retry_count:n})),this._instance._send_request(T({},r,{callback:s=>{s.statusCode===200||s.statusCode>=400&&500>s.statusCode||(n??0)>=10?r.callback==null||r.callback(s):this.Dt(T({retriesPerformedSoFar:n},r))}}))}Dt(e){var n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var r=function(o){var a=3e3*Math.pow(2,o),l=a/2,c=Math.min(18e5,a),u=Math.random()-.5;return Math.ceil(c+u*(c-l))}(n),s=Date.now()+r;this.St.push({retryAt:s,requestOptions:e});var i="Enqueued failed request for retry in "+r;navigator.onLine||(i+=" (Browser is offline)"),R.warn(i),this.Ot||(this.Ot=!0,this.Lt())}Lt(){if(this.Ut&&clearTimeout(this.Ut),this.St.length===0)return this.Ot=!1,void(this.Ut=void 0);this.Ut=setTimeout(()=>{this.Ct&&this.St.length>0&&this.At(),this.Lt()},this.It)}At(){var e=Date.now(),n=[],r=this.St.filter(i=>e>i.retryAt||(n.push(i),!1));if(this.St=n,r.length>0)for(var{requestOptions:s}of r)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.Ut&&(clearTimeout(this.Ut),this.Ut=void 0),this.Ot=!1,O(v)||(this.Ft&&(v.removeEventListener("online",this.Ft),this.Ft=void 0),this.Mt&&(v.removeEventListener("offline",this.Mt),this.Mt=void 0)),this.St))try{this._instance._send_request(T({},e,{transport:"sendBeacon"}))}catch(n){R.error(n)}this.St=[]}}class yv{constructor(e){this.Nt=()=>{var n,r,s,i;this.jt||(this.jt={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,c=a+((o==null?void 0:o.clientHeight)||0),u=(o==null?void 0:o.scrollHeight)||0;this.jt.lastScrollY=Math.ceil(a),this.jt.maxScrollY=Math.max(a,(n=this.jt.maxScrollY)!==null&&n!==void 0?n:0),this.jt.maxScrollHeight=Math.max(l,(r=this.jt.maxScrollHeight)!==null&&r!==void 0?r:0),this.jt.lastContentY=c,this.jt.maxContentY=Math.max(c,(s=this.jt.maxContentY)!==null&&s!==void 0?s:0),this.jt.maxContentHeight=Math.max(u,(i=this.jt.maxContentHeight)!==null&&i!==void 0?i:0)},this._instance=e}get zt(){return this._instance.config.scroll_root_selector}getContext(){return this.jt}resetContext(){var e=this.jt;return setTimeout(this.Nt,0),e}startMeasuringScrollPosition(){he(v,"scroll",this.Nt,{capture:!0}),he(v,"scrollend",this.Nt,{capture:!0}),he(v,"resize",this.Nt)}scrollElement(){if(!this.zt)return v==null?void 0:v.document.documentElement;var e=Y(this.zt)?this.zt:[this.zt];for(var n of e){var r=v==null?void 0:v.document.querySelector(n);if(r)return r}}scrollY(){if(this.zt){var e=this.scrollElement();return e&&e.scrollTop||0}return v&&(v.scrollY||v.pageYOffset||v.document.documentElement.scrollTop)||0}scrollX(){if(this.zt){var e=this.scrollElement();return e&&e.scrollLeft||0}return v&&(v.scrollX||v.pageXOffset||v.document.documentElement.scrollLeft)||0}}var bv=t=>xu(t==null?void 0:t.config.mask_personal_data_properties,t==null?void 0:t.config.custom_personal_data_properties);class qa{constructor(e,n,r,s){this.Bt=i=>{var o=this.Ht();if(!o||o.sessionId!==i){var a={sessionId:i,props:this.qt(this._instance)};this.Wt.register({[gi]:a})}},this._instance=e,this.Vt=n,this.Wt=r,this.qt=s||bv,this.Vt.onSessionId(this.Bt)}Ht(){return this.Wt.props[gi]}getSetOnceProps(){var e,n=(e=this.Ht())==null?void 0:e.props;return n?"r"in n?Iu(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var e={};return te(so(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+ii(r)]=n}),e}}class ao{constructor(){this.Yt={}}on(e,n){return this.Yt[e]||(this.Yt[e]=[]),this.Yt[e].push(n),()=>{this.Yt[e]=this.Yt[e].filter(r=>r!==n)}}emit(e,n){for(var r of this.Yt[e]||[])r(n);for(var s of this.Yt["*"]||[])s(e,n)}}var Ps=oe("[SessionId]");class Ga{on(e,n){return this.Gt.on(e,n)}constructor(e,n,r){var s;if(this.Jt=[],this.Kt=void 0,this.Gt=new ao,this.Xt=(c,u)=>!(!jt(c)||!jt(u))&&Math.abs(c-u)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===Le)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.N=e.config,this.Wt=e.persistence,this.Qt=void 0,this.Zt=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ti=n||ht,this.ii=r||ht;var i=this.N.persistence_name||this.N.token;if(this._sessionTimeoutMs=1e3*ze(this.N.session_idle_timeout_seconds||1800,60,36e3,Ps.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ei(),this.ri="ph_"+i+"_window_id",this.si="ph_"+i+"_primary_window_exists",this.ni()){var o=me.D(this.ri),a=me.D(this.si);o&&!a?this.Qt=o:me.U(this.ri),me.L(this.si,!0)}if((s=this.N.bootstrap)!=null&&s.sessionID)try{var l=(c=>{var u=this.N.bootstrap.sessionID.replace(/-/g,"");if(u.length!==32)throw new Error("Not a valid UUID");if(u[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(u.substring(0,12),16)})();this.oi(this.N.bootstrap.sessionID,new Date().getTime(),l)}catch(c){Ps.error("Invalid sessionID in bootstrap",c)}this.ai()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return O(this.Jt)&&(this.Jt=[]),this.Jt.push(e),this.Zt&&e(this.Zt,this.Qt),()=>{this.Jt=this.Jt.filter(n=>n!==e)}}ni(){return this.N.persistence!=="memory"&&!this.Wt.st&&me.F()}li(e){e!==this.Qt&&(this.Qt=e,this.ni()&&me.L(this.ri,e))}ui(){return this.Qt?this.Qt:this.ni()?me.D(this.ri):null}oi(e,n,r){e===this.Zt&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Zt=e,this.Wt.register({[xr]:[n,e,r]}))}hi(){var e=this.Wt.props[xr];return Y(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.oi(null,null,null)}destroy(){clearTimeout(this.di),this.di=void 0,this.Kt&&v&&(v.removeEventListener($r,this.Kt,{capture:!1}),this.Kt=void 0),this.Jt=[]}ai(){this.Kt=()=>{this.ni()&&me.U(this.si)},he(v,$r,this.Kt,{capture:!1})}checkAndGetSessionAndWindowId(e,n){if(e===void 0&&(e=!1),n===void 0&&(n=null),this.N.cookieless_mode===Le)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),[s,i,o]=this.hi(),a=this.ui(),l=jt(o)&&Math.abs(r-o)>864e5,c=!1,u=!i,d=!u&&!e&&this.Xt(r,s);u||d||l?(i=this.ti(),a=this.ii(),Ps.info("new session ID generated",{sessionId:i,windowId:a,changeReason:{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}}),o=r,c=!0):a||(a=this.ii(),c=!0);var p=jt(s)&&e&&!l?s:r,f=jt(o)?o:new Date().getTime();return this.li(a),this.oi(i,p,f),e||this.ei(),c&&this.Jt.forEach(g=>g(i,a,c?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}:void 0)),{sessionId:i,windowId:a,sessionStartTimestamp:f,changeReason:c?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:s}}ei(){clearTimeout(this.di),this.di=setTimeout(()=>{var[e]=this.hi();if(this.Xt(new Date().getTime(),e)){var n=this.Zt;this.resetSessionId(),this.Gt.emit("forcedIdleReset",{idleSessionId:n})}},1.1*this.sessionTimeoutMs)}}var Nu=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&ba(n,e))return!0;try{var r=t==null?void 0:t.userAgentData;if(r!=null&&r.brands&&r.brands.some(s=>ba(s==null?void 0:s.brand,e)))return!0}catch{}return!!t.webdriver},Lr=function(t,e){if(!function(n){try{new RegExp(n)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function Va(t,e,n){return Wt({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var Mu={exact:(t,e)=>e.some(n=>t.some(r=>n===r)),is_not:(t,e)=>e.every(n=>t.every(r=>n!==r)),regex:(t,e)=>e.some(n=>t.some(r=>Lr(n,r))),not_regex:(t,e)=>e.every(n=>t.every(r=>!Lr(n,r))),icontains:(t,e)=>e.map(rr).some(n=>t.map(rr).some(r=>n.includes(r))),not_icontains:(t,e)=>e.map(rr).every(n=>t.map(rr).every(r=>!n.includes(r))),gt:(t,e)=>e.some(n=>{var r=parseFloat(n);return!isNaN(r)&&t.some(s=>r>parseFloat(s))}),lt:(t,e)=>e.some(n=>{var r=parseFloat(n);return!isNaN(r)&&t.some(s=>r<parseFloat(s))})},rr=t=>t.toLowerCase();function Du(t,e){return!t||Object.entries(t).every(n=>{var[r,s]=n,i=e==null?void 0:e[r];if(O(i)||rt(i))return!1;var o=[String(i)],a=Mu[s.operator];return!!a&&a(s.values,o)})}var Ii="custom",Ya="i.posthog.com";class Ev{constructor(e){this.vi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,n=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+Ya,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.vi[this.apiHost]||(this.vi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":Ii),this.vi[this.apiHost]}endpointFor(e,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),e==="ui")return this.uiHost+n;if(e==="flags")return this.flagsApiHost+n;if(this.region===Ii)return this.apiHost+n;var r=Ya+n;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var Q=oe("[Surveys]"),Ti="seenSurvey_",wv=(t,e)=>{var n="$survey_"+e+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(n="$survey_"+e+"/"+t.id+"/"+t.current_iteration),n},Ka=t=>((e,n)=>{var r=""+Ti+n.id;return n.current_iteration&&n.current_iteration>0&&(r=""+Ti+n.id+"_"+n.current_iteration),r})(0,t),Sv=[Ss.Popover,Ss.Widget,Ss.API],kv={ignoreConditions:!1,ignoreDelay:!1,displayType:Ei.Popover},xv=oe("[PostHog ExternalIntegrations]"),Iv={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Tv{constructor(e){this._instance=e}Y(e,n){var r;(r=M.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,s=>{if(s)return xv.error("failed to load script",s);n()})}startIfEnabledOrStop(){var e=this,n=function(o){var a,l,c;!s||(a=M.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.Y(Iv[o],()=>{var u;(u=M.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.start(e._instance)}),!s&&(l=M.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((c=M.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.stop())};for(var[r,s]of Object.entries((i=this._instance.config.integrations)!==null&&i!==void 0?i:{})){var i;n(r)}}}var Cn={},Cs=0,Pi=()=>{},Ja='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',_n="Surveys module not available",Xa="sanitize_properties is deprecated. Use before_send instead",Lu="Invalid value for property_denylist config: ",Ht="posthog",ju=!fv&&(Ie==null?void 0:Ie.indexOf("MSIE"))===-1&&(Ie==null?void 0:Ie.indexOf("Mozilla"))===-1,Za=t=>{var e;return T({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Gg($==null?void 0:$.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Pi,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,debug:ve&&fe(ve==null?void 0:ve.search)&&ve.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(v==null||(e=v.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(n){R.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:bi,before_send:void 0,request_queue_config:{flush_interval_ms:xi},error_tracking:{},_onCapture:Pi,__preview_eager_load_replay:!1},(n=>({rageclick:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(t))},Pv=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],Qa=t=>{var e={};for(var[n,r]of Pv)O(t[n])||(e[r]=t[n]);var s=ce({},e,t);return Y(t.property_blacklist)&&(O(t.property_denylist)?s.property_denylist=t.property_blacklist:Y(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:R.error(Lu+t.property_denylist)),s};class Cv{constructor(){this.__forceAllowLocalhost=!1}get ci(){return this.__forceAllowLocalhost}set ci(e){R.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Be{fi(e,n){if(e){var r=this.pi.indexOf(e);r!==-1&&this.pi.splice(r,1)}return this.pi.push(n),n.initialize==null||n.initialize(),n}get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new Cv,this.gi=!1,this.version=Ce.LIB_VERSION,this.mi=new ao,this.pi=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Za(),this.SentryIntegration=nv,this.sentryIntegration=r=>function(s,i){var o=bu(s,i);return{name:yu,processEvent:a=>o(a)}}(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.bi=!1,this.yi=null,this.wi=null,this.Ei=null,this.scrollManager=new yv(this),this.pageViewManager=new Da(this),this.rateLimiter=new lv(this),this.requestRouter=new Ev(this),this.consent=new Qg(this),this.externalIntegrations=new Tv(this);var n=(e=Be.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(r,s,i)=>{var o=fe(r)?{[r]:s}:r;this.setPersonProperties(o),i==null||i({})},set_once:(r,s,i)=>{var o=fe(r)?{[r]:s}:r;this.setPersonProperties(void 0,o),i==null||i({})}},this.on("eventCaptured",r=>R.info('send "'+(r==null?void 0:r.event)+'"',r))}init(e,n,r){if(r&&r!==Ht){var s,i=(s=Cn[r])!==null&&s!==void 0?s:new Be;return i._init(e,n,r),Cn[r]=i,Cn[Ht][r]=i,i}return this._init(e,n,r)}_init(e,n,r){var s;if(n===void 0&&(n={}),O(e)||hr(e))return R.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.Si(n.debug),this.xi=n,this.Ti=[],n.person_profiles?this.wi=n.person_profiles:n.process_person&&(this.wi=n.process_person),this.set_config(ce({},Za(n.defaults),Qa(n),{name:r,token:e})),this.config.on_xhr_error&&R.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Ue.GZipJS;var i=this.$i();this.persistence=new ws(this.config,i),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ws(T({},this.config,{persistence:"sessionStorage"}),i);var o=T({},this.persistence.props),a=T({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.ki=new gv(_=>this.Ri(_),this.config.request_queue_config),this.Pi=new mv(this),this.__request_queue=[];var l=this.config.cookieless_mode===Le||this.config.cookieless_mode===Ve&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new Ga(this),this.sessionPropsManager=new qa(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(R.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Oi(l)},0)):(R.info("Initializing extensions synchronously"),this.Oi(l)),Ce.DEBUG=Ce.DEBUG||this.config.debug,Ce.DEBUG&&R.info("Starting in debug mode",{this:this,config:n,thisC:T({},this.config),p:o,s:a}),((s=n.bootstrap)==null?void 0:s.distinctID)!==void 0){var c=n.bootstrap.distinctID,u=this.get_distinct_id(),d=this.persistence.get_property(Me);if(n.bootstrap.isIdentifiedID&&u!=null&&u!==c&&d===Nt)this.identify(c);else if(n.bootstrap.isIdentifiedID&&u!=null&&u!==c&&d===Mt)R.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var p=this.config.get_device_id(ht()),f=n.bootstrap.isIdentifiedID?p:c;this.persistence.set_property(Me,n.bootstrap.isIdentifiedID?Mt:Nt),this.register({distinct_id:c,$device_id:f})}}if(l)this.register_once({distinct_id:Zn,$device_id:null},"");else if(!this.get_distinct_id()){var g=this.config.get_device_id(ht());this.register_once({distinct_id:g,$device_id:g},""),this.persistence.set_property(Me,Nt)}return he(v,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?function(_,P){var m=_.config.segment;if(!m)return P();(function(b,C){var x=b.config.segment;if(!x)return C();var S=w=>{var E=()=>w.anonymousId()||ht();b.config.get_device_id=E,w.id()&&(b.register({distinct_id:w.id(),$device_id:E()}),b.persistence.set_property(Me,Mt)),C()},k=x.user();"then"in k&&Ke(k.then)?k.then(S):S(k)})(_,()=>{m.register((b=>{Promise&&Promise.resolve||Es.warn("This browser does not have Promise support, and can not use the segment integration");var C=(x,S)=>{if(!S)return x;x.event.userId||x.event.anonymousId===b.get_distinct_id()||(Es.info("No userId set, resetting PostHog"),b.reset()),x.event.userId&&x.event.userId!==b.get_distinct_id()&&(Es.info("UserId set, identifying with PostHog"),b.identify(x.event.userId));var k=b.calculateEventProperties(S,x.event.properties);return x.event.properties=Object.assign({},k,x.event.properties),x};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:x=>C(x,x.event.event),page:x=>C(x,Ut),identify:x=>C(x,ys),screen:x=>C(x,"$screen")}})(_)).then(()=>{P()})})}(this,()=>this.Ii()):this.Ii(),Ke(this.config._onCapture)&&this.config._onCapture!==Pi&&(R.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",_=>this.config._onCapture(_.event,_))),this.config.ip&&R.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Oi(e){var n,r,s,i,o,a,l,c=performance.now(),u=T({},Be.__defaultExtensionClasses,this.config.__extensionClasses),d=[];u.featureFlags&&this.pi.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new u.featureFlags(this)),u.exceptions&&this.pi.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new u.exceptions(this)),u.historyAutocapture&&this.pi.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.pi.push(new u.tracingHeaders(this)),u.siteApps&&this.pi.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this.pi.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||d.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),u.autocapture&&this.pi.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.pi.push(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new u.surveys(this)),u.logs&&this.pi.push(this.logs=(i=this.logs)!==null&&i!==void 0?i:new u.logs(this)),u.conversations&&this.pi.push(this.conversations=(o=this.conversations)!==null&&o!==void 0?o:new u.conversations(this)),u.productTours&&this.pi.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.pi.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.pi.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.pi.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.pi.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,tv)),u.toolbar&&this.pi.push(this.toolbar=(a=this.toolbar)!==null&&a!==void 0?a:new u.toolbar(this)),u.experiments&&this.pi.push(this.experiments=(l=this.experiments)!==null&&l!==void 0?l:new u.experiments(this)),this.pi.forEach(p=>{p.initialize&&d.push(()=>{p.initialize==null||p.initialize()})}),d.push(()=>{if(this.Ci){var p=this.Ci;this.Ci=void 0,this.ft(p)}}),this.Fi(d,c)}Fi(e,n){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&e.length>0)return void setTimeout(()=>{this.Fi(e,n)},0);var r=e.shift();if(r)try{r()}catch(i){R.error("Error initializing extension:",i)}}var s=Math.round(performance.now()-n);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:s}),this.config.__preview_deferred_init_extensions&&R.info("PostHog extensions initialized ("+s+"ms)")}ft(e){var n;if(!$||!$.body)return R.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.ft(e)},500);this.config.__preview_deferred_init_extensions&&(this.Ci=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=q(e.supportedCompression,Ue.GZipJS)?Ue.GZipJS:q(e.supportedCompression,Ue.Base64)?Ue.Base64:void 0),(n=e.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.wi?this.wi:bi}),this.pi.forEach(r=>r.onRemoteConfig==null?void 0:r.onRemoteConfig(e))}Ii(){try{this.config.loaded(this)}catch(r){R.critical("`loaded` function failed",r)}if(this.Ai(),this.config.internal_or_test_user_hostname&&ve!=null&&ve.hostname){var e=ve.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?e===n:n.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.config.cookieless_mode===Le)&&this.Mi()},1),this.Di=new Pu(this),this.Di.load()}Ai(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.ki)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Qn(this.__request_queue,e=>this.Ri(e)),this.__request_queue=[],this.Ai()}_handle_unload(){var e,n,r;(e=this.surveys)==null||e.handlePageUnload(),this.config.request_batching?(this.Li()&&this.capture(ms),(n=this.ki)==null||n.unload(),(r=this.Pi)==null||r.unload()):this.Li()&&this.capture(ms,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(ju?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Dr(e.url,{ip:this.config.ip?1:0}),e.headers=T({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(n=>{var r,s,i,o=T({},n);o.timeout=o.timeout||6e4,o.url=Dr(o.url,{_:new Date().getTime().toString(),ver:Ce.JS_SDK_VERSION,compression:o.compression});var a=(r=o.transport)!==null&&r!==void 0?r:"fetch",l=fr.filter(u=>!o.disableTransport||!u.transport||!o.disableTransport.includes(u.transport)),c=(s=(i=function(u,d){for(var p=0;u.length>p;p++)if(u[p].transport===a)return u[p]}(l))==null?void 0:i.method)!==null&&s!==void 0?s:l[0].method;if(!c)throw new Error("No available transport method");a!=="sendBeacon"&&o.data&&o.compression===Ue.GZipJS&&ig?_v(o).then(u=>{c(u)}).catch(()=>{c(o)}):c(o)})(T({},e,{callback:n=>{var r,s;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(r=(s=this.config).on_request_error)==null||r.call(s,n),e.callback==null||e.callback(n)}}))))}Ri(e){this.Pi?this.Pi.retriableRequest(e):this._send_request(e)}_execute_array(e){Cs++;try{var n,r=[],s=[],i=[];Qn(e,a=>{a&&(Y(n=a[0])?i.push(a):Ke(a)?a.call(this):Y(a)&&n==="alias"?r.push(a):Y(a)&&n.indexOf("capture")!==-1&&Ke(this[n])?i.push(a):s.push(a))});var o=function(a,l){Qn(a,function(c){if(Y(c[0])){var u=l;te(c,function(d){u=u[d[0]].apply(u,d.slice(1))})}else l[c[0]].apply(l,c.slice(1))})};o(r,this),o(s,this),o(i,this)}finally{Cs--}}push(e){if(Cs>0&&Y(e)&&fe(e[0])){var n=Be.prototype[e[0]];Ke(n)&&n.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,n,r){var s,i,o,a,l,c;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.ki){if(this.is_capturing())if(!O(e)&&fe(e)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var d=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(d==null||!d.isRateLimited){n!=null&&n.$current_url&&!fe(n==null?void 0:n.$current_url)&&(R.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),e!=="$exception"||r!=null&&r.Ui||R.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var p=new Date,f=(r==null?void 0:r.timestamp)||p,g=ht(),_={uuid:g,event:e,properties:this.calculateEventProperties(e,n||{},f,g)};e===Ut&&this.config.__preview_capture_bot_pageviews&&u&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),d&&(_.properties.$lib_rate_limit_remaining_tokens=d.remainingTokens),r!=null&&r.$set&&(_.$set=r==null?void 0:r.$set);var P,m=this.Ni(r==null?void 0:r.$set_once,e!==Aa,e===ys);if(m&&(_.$set_once=m),(i=_,o=r!=null&&r._noTruncate?null:this.config.properties_string_max_length,a=i,l=E=>fe(E)&&!rt(o)?E.slice(0,o):E,c=new Set,_=function E(I,A){return I!==Object(I)?l?l(I):I:c.has(I)?void 0:(c.add(I),Y(I)?(j=[],Qn(I,F=>{j.push(E(F))})):(j={},te(I,(F,H)=>{c.has(F)||(j[H]=E(F))})),j);var j}(a)).timestamp=f,O(r==null?void 0:r.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=p),e===xn.DISMISSED||e===xn.SENT){var b=n==null?void 0:n[ks.SURVEY_ID],C=n==null?void 0:n[ks.SURVEY_ITERATION];P={id:b,current_iteration:C},localStorage.getItem(Ka(P))||localStorage.setItem(Ka(P),"true"),_.$set=T({},_.$set,{[wv({id:b,current_iteration:C},e===xn.SENT?"responded":"dismissed")]:!0})}else e===xn.SHOWN&&(_.$set=T({},_.$set,{[ks.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===av.SHOWN){var x=n==null?void 0:n[ja.TOUR_TYPE];x&&(_.$set=T({},_.$set,{[ja.TOUR_LAST_SEEN_DATE+"/"+x]:new Date().toISOString()}))}var S=T({},_.properties.$set,_.$set);if(Bt(S)||this.setPersonPropertiesForFlags(S),!G(this.config.before_send)){var k=this.ji(_);if(!k)return;_=k}this.mi.emit("eventCaptured",_);var w={method:"POST",url:(s=r==null?void 0:r._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:_,compression:"best-available",batchKey:r==null?void 0:r._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Ri(w):this.ki.enqueue(w),_}R.critical("This capture call is ignored due to client rate limiting.")}}else R.error("No event name provided to posthog.capture")}else R.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",n=>e(n.event,n))}calculateEventProperties(e,n,r,s,i){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var o=i?void 0:this.persistence.remove_event_timer(e),a=T({},n);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,(this.config.cookieless_mode==Le||this.config.cookieless_mode==Ve&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),e==="$snapshot"){var l=T({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!fe(a.distinct_id)&&!We(a.distinct_id)||hr(a.distinct_id))&&R.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=function(m,b){var C,x,S,k;if(!Ie)return{};var w,E,I,A,j,F,H,B,K=m?[...tn,...b||[]]:[],[Z,N]=function(z){for(var ee=0;Sa.length>ee;ee++){var[V,le]=Sa[ee],D=V.exec(z),y=D&&(Ke(le)?le(D,z):le);if(y)return y}return["",""]}(Ie);return ce(so({$os:Z,$os_version:N,$browser:cu(Ie,navigator.vendor),$device:ka(Ie),$device_type:(E=Ie,I={userAgentDataPlatform:(C=navigator)==null||(C=C.userAgentData)==null?void 0:C.platform,maxTouchPoints:(x=navigator)==null?void 0:x.maxTouchPoints,screenWidth:v==null||(S=v.screen)==null?void 0:S.width,screenHeight:v==null||(k=v.screen)==null?void 0:k.height,devicePixelRatio:v==null?void 0:v.devicePixelRatio},B=ka(E),B===Kc||B===Yc||B==="Kobo"||B==="Kindle Fire"||B===lu?Zt:B===Fn||B===Gt||B===Nn||B===ai?"Console":B===Xc?"Wearable":B?Oe:(I==null?void 0:I.userAgentDataPlatform)==="Android"&&((A=I==null?void 0:I.maxTouchPoints)!==null&&A!==void 0?A:0)>0?600>Math.min((j=I==null?void 0:I.screenWidth)!==null&&j!==void 0?j:0,(F=I==null?void 0:I.screenHeight)!==null&&F!==void 0?F:0)/((H=I==null?void 0:I.devicePixelRatio)!==null&&H!==void 0?H:1)?Oe:Zt:"Desktop"),$timezone:Tu(),$timezone_offset:iv()}),{$current_url:Mn(ve==null?void 0:ve.href,K,Dn),$host:ve==null?void 0:ve.host,$pathname:ve==null?void 0:ve.pathname,$raw_user_agent:Ie.length>1e3?Ie.substring(0,997)+"...":Ie,$browser_version:Eg(Ie,navigator.vendor),$browser_language:La(),$browser_language_prefix:(w=La(),typeof w=="string"?w.split("-")[0]:void 0),$screen_height:v==null?void 0:v.screen.height,$screen_width:v==null?void 0:v.screen.width,$viewport_height:v==null?void 0:v.innerHeight,$viewport_width:v==null?void 0:v.innerWidth,$lib:Ce.LIB_NAME,$lib_version:Ce.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:d,windowId:p}=this.sessionManager.checkAndGetSessionAndWindowId(i,r.getTime());a.$session_id=d,a.$window_id=p}this.sessionPropsManager&&ce(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&ce(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this.Pi)==null?void 0:f.length}catch(m){a.$sdk_debug_error_capturing_properties=String(m)}if(this.requestRouter.region===Ii&&(a.$lib_custom_api_host=this.config.api_host),c=e!==Ut||i?e!==ms||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),a=ce(a,c),e===Ut&&$&&(a.title=$.title),!O(o)){var g=r.getTime()-o;a.$duration=parseFloat((g/1e3).toFixed(3))}Ie&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=ce({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),Y(this.config.property_denylist)?te(this.config.property_denylist,function(m){delete a[m]}):R.error(Lu+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(R.error(Xa),a=_(a,e));var P=this.zi();return a.$process_person_profile=P,P&&!i&&this.Bi("_calculate_event_properties"),a}Ni(e,n,r){var s;if(n===void 0&&(n=!0),r===void 0&&(r=!1),!this.persistence||!this.zi()||this.gi&&!r)return e;var i=this.persistence.get_initial_props(),o=(s=this.sessionPropsManager)==null?void 0:s.getSetOnceProps(),a=ce({},i,o||{},e||{}),l=this.config.sanitize_properties;return l&&(R.error(Xa),a=l(a,"$set_once")),n&&(this.gi=!0),Bt(a)?void 0:a}register(e,n){var r;(r=this.persistence)==null||r.register(e,n)}register_once(e,n,r){var s;(s=this.persistence)==null||s.register_once(e,n,r)}register_for_session(e){var n;(n=this.sessionPersistence)==null||n.register(e)}unregister(e){var n;(n=this.persistence)==null||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)==null||n.unregister(e)}Hi(e,n){this.register({[e]:n})}getFeatureFlag(e,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(e,n)}isFeatureEnabled(e,n){var r;return(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(e,n)}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,n,r){var s;(s=this.featureFlags)==null||s.updateFlags(e,n,r)}updateEarlyAccessFeatureEnrollment(e,n,r){var s;(s=this.featureFlags)==null||s.updateEarlyAccessFeatureEnrollment(e,n,r)}getEarlyAccessFeatures(e,n,r){var s;return n===void 0&&(n=!1),(s=this.featureFlags)==null?void 0:s.getEarlyAccessFeatures(e,n,r)}on(e,n){return this.mi.on(e,n)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:_n}),()=>{})}onSessionId(e){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(e,n):e([],{isLoaded:!1,error:_n})}getActiveMatchingSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:_n})}renderSurvey(e,n){var r;(r=this.surveys)==null||r.renderSurvey(e,n)}displaySurvey(e,n){var r;n===void 0&&(n=kv),(r=this.surveys)==null||r.displaySurvey(e,n)}cancelPendingSurvey(e){var n;(n=this.surveys)==null||n.cancelPendingSurvey(e)}canRenderSurvey(e){var n,r;return(n=(r=this.surveys)==null?void 0:r.canRenderSurvey(e))!==null&&n!==void 0?n:{visible:!1,disabledReason:_n}}canRenderSurveyAsync(e,n){var r,s;return n===void 0&&(n=!1),(r=(s=this.surveys)==null?void 0:s.canRenderSurveyAsync(e,n))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:_n})}qi(e){return!e||hr(e)?(R.critical("Unique user id has not been set in posthog.identify"),!1):e===Zn?(R.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(R.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,n,r){if(!this.__loaded||!this.persistence)return R.uninitializedWarning("posthog.identify");if(We(e)&&(e=e.toString(),R.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.qi(e)&&this.Bi("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(kr)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(En)&&(this.unregister(En),this.register({distinct_id:e}));var i,o=(this.persistence.get_property(Me)||Nt)===Nt;e!==s&&o?(this.persistence.set_property(Me,Mt),this.setPersonPropertiesForFlags(T({},r||{},n||{}),!1),this.capture(ys,{distinct_id:e,$anon_distinct_id:s},{$set:n||{},$set_once:r||{}}),this.Ei=Va(e,n,r),(i=this.featureFlags)==null||i.setAnonymousDistinctId(s)):(n||r)&&this.setPersonProperties(n,r),e!==s&&(this.reloadFeatureFlags(),this.unregister(Tn))}}setPersonProperties(e,n){if((e||n)&&this.Bi("posthog.setPersonProperties")){var r=Va(this.get_distinct_id(),e,n);this.Ei!==r?(this.setPersonPropertiesForFlags(T({},n||{},e||{})),this.capture("$set",{$set:e||{},$set_once:n||{}}),this.Ei=r):R.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,n,r){if(e&&n){var s=this.getGroups();s[e]!==n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:T({},s,{[e]:n})}),r&&(this.capture(Aa,{$group_type:e,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags({[e]:r})),s[e]===n||r||this.reloadFeatureFlags()}else R.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n){var r;n===void 0&&(n=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(){var e;(e=this.featureFlags)==null||e.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,n){var r;n===void 0&&(n=!0),this.Bi("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(e,n))}resetGroupPropertiesForFlags(e){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(e)}reset(e){var n,r,s,i,o,a,l;if(R.info("reset"),!this.__loaded)return R.uninitializedWarning("posthog.reset");var c=this.get_property(kr);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),(s=this.surveys)==null||s.reset(),(i=this.Di)==null||i.stop(),(o=this.featureFlags)==null||o.reset(),(a=this.persistence)==null||a.set_property(Me,Nt),(l=this.sessionManager)==null||l.resetSessionId(),this.Ei=null,this.config.cookieless_mode===Le)this.register_once({distinct_id:Zn,$device_id:null},"");else{var u=this.config.get_device_id(ht());this.register_once({distinct_id:u,$device_id:e?u:c},"")}this.register({$last_posthog_reset:new Date().toISOString()},1),this.reloadFeatureFlags()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,n;return(e=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(e!=null&&e.withTimestamp&&r){var i,o=(i=e.timestampLookBack)!==null&&i!==void 0?i:10;if(!r)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}return s}alias(e,n){return e===this.get_property(pu)?(R.critical("Attempting to create alias for existing People user - aborting."),-2):this.Bi("posthog.alias")?(O(n)&&(n=this.get_distinct_id()),e!==n?(this.Hi(En,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(R.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=T({},this.config);if(_e(e)){var r,s,i,o,a,l,c,u,d;ce(this.config,Qa(e));var p=this.$i();(r=this.persistence)==null||r.update_config(this.config,n,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ws(T({},this.config,{persistence:"sessionStorage"}),p);var f=this.Si(this.config.debug);Xe(f)&&(this.config.debug=f),Xe(this.config.debug)&&(this.config.debug?(Ce.DEBUG=!0,se.F()&&se.L("ph_debug",!0),R.info("set_config",{config:e,oldConfig:n,newConfig:T({},this.config)})):(Ce.DEBUG=!1,se.F()&&se.U("ph_debug"))),(s=this.exceptionObserver)==null||s.onConfigChange(),(i=this.sessionRecording)==null||i.startIfEnabledOrStop(),(o=this.autocapture)==null||o.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),(l=this.exceptionObserver)==null||l.startIfEnabledOrStop(),(c=this.deadClicksAutocapture)==null||c.startIfEnabledOrStop(),(u=this.surveys)==null||u.loadIfEnabled(),this.Wi(),(d=this.externalIntegrations)==null||d.startIfEnabledOrStop()}}_overrideSDKInfo(e,n){Ce.LIB_NAME=e,Ce.LIB_VERSION=n}startSessionRecording(e){var n,r,s,i,o,a=e===!0,l={sampling:a||!(e==null||!e.sampling),linked_flag:a||!(e==null||!e.linked_flag),url_trigger:a||!(e==null||!e.url_trigger),event_trigger:a||!(e==null||!e.event_trigger)};Object.values(l).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),l.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),l.linked_flag&&((s=this.sessionRecording)==null||s.overrideLinkedFlag()),l.url_trigger&&((i=this.sessionRecording)==null||i.overrideTrigger("url")),l.event_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,n){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(T({},s,n))}}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var n,r;return(n=(r=this.toolbar)==null?void 0:r.loadToolbar(e))!==null&&n!==void 0&&n}get_property(e){var n;return(n=this.persistence)==null?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)==null?void 0:n.props[e]}toString(){var e,n=(e=this.config.name)!==null&&e!==void 0?e:Ht;return n!==Ht&&(n=Ht+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(Me))===Mt||((n=this.sessionPersistence)==null?void 0:n.get_property(Me))===Mt}zi(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===bi&&!this._isIdentified()&&Bt(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[En])&&((n=this.persistence)==null||(n=n.props)==null||!n[Pr]))}Li(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.zi()||this.Bi("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Bi("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Bi(e){return this.config.person_profiles==="never"?(R.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Hi(Pr,!0),!0)}$i(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Ve)}Wi(){var e,n,r,s,i=this.$i();return((e=this.persistence)==null?void 0:e.st)!==i&&((r=this.persistence)==null||r.set_disabled(i)),((n=this.sessionPersistence)==null?void 0:n.st)!==i&&((s=this.sessionPersistence)==null||s.set_disabled(i)),i}opt_in_capturing(e){var n;if(this.config.cookieless_mode!==Le){if(this.config.cookieless_mode===Ve&&this.consent.isExplicitlyOptedOut()){var r,s,i,o,a;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=new Ga(this),this.pageViewManager=new Da(this),this.persistence&&(this.sessionPropsManager=new qa(this,this.sessionManager,this.persistence));var l=(i=(o=this.config.__extensionClasses)==null?void 0:o.sessionRecording)!==null&&i!==void 0?i:(a=Be.__defaultExtensionClasses)==null?void 0:a.sessionRecording;l&&(this.sessionRecording=this.fi(this.sessionRecording,new l(this)))}var c,u;this.consent.optInOut(!0),this.Wi(),this.Ai(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==Ve&&((c=this.surveys)==null||c.loadIfEnabled()),(O(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((u=e==null?void 0:e.captureEventName)!==null&&u!==void 0?u:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Mi()}else R.warn(Ja)}opt_out_capturing(){var e,n,r;this.config.cookieless_mode!==Le?(this.config.cookieless_mode===Ve&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Wi(),this.config.cookieless_mode===Ve&&(this.register({distinct_id:Zn,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(r=this.sessionRecording)==null||r.stopRecording(),this.sessionRecording=void 0,this.Mi())):R.warn(Ja)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Le||(this.config.cookieless_mode===Ve?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Wi()}_is_bot(){return Re?Nu(Re,this.config.custom_blocked_useragents):void 0}Mi(){$&&($.visibilityState==="visible"?this.bi||(this.bi=!0,this.capture(Ut,{title:$.title},{send_instantly:!0}),this.yi&&($.removeEventListener(Cr,this.yi),this.yi=null)):this.yi||(this.yi=this.Mi.bind(this),he($,Cr,this.yi)))}debug(e){e===!1?(v==null||v.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(v==null||v.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}bt(){var e,n,r,s,i,o,a=this.xi||{};return"advanced_disable_flags"in a?!!a.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(R.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(r="advanced_disable_decide",s=R,i=(n="advanced_disable_flags")in(e=a)&&!G(e[n]),o=r in e&&!G(e[r]),i?e[n]:!!o&&(s&&s.warn("Config field '"+r+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),e[r]))}ji(e){if(G(this.config.before_send))return e;var n=Y(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var s of n){if(r=s(r),G(r)){var i="Event '"+e.event+"' was rejected in beforeSend function";return cg(e.event)?R.warn(i+". This can cause unexpected behavior."):R.info(i),null}r.properties&&!Bt(r.properties)||R.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var e;return(e=this.pageViewManager.K)==null?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(r)})}Si(e){var n=Xe(e)&&!e,r=se.F()&&se.M("ph_debug")==="true";return!n&&(!!r||e)}}function el(t){return t instanceof Element&&(t.id===gu||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function ns(t){return!!t&&t.nodeType===1}function ft(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Uu(t){return!!t&&t.nodeType===3}function Hu(t){return!!t&&t.nodeType===11}function lo(t){return t?es(t).split(/\s+/):[]}function tl(t){var e=v==null?void 0:v.location.href;return!!(e&&t&&t.some(n=>e.match(n)))}function jr(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return lo(e)}function Bu(t){return G(t)?null:es(t).split(/(\s+)/).filter(e=>$n(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ln(t){var e="";return $i(t)&&!Wu(t)&&t.childNodes&&t.childNodes.length&&te(t.childNodes,function(n){var r;Uu(n)&&n.textContent&&(e+=(r=Bu(n.textContent))!==null&&r!==void 0?r:"")}),es(e)}function nl(t){return O(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}Be.__defaultExtensionClasses={},function(t,e){for(var n=0;e.length>n;n++)t.prototype[e[n]]=Wg(t.prototype[e[n]])}(Be,["identify"]);var co=["a","button","form","input","select","textarea","label"];function rl(t,e){if(O(e))return!0;var n,r=function(i){if(e.some(o=>i.matches(o)))return{v:!0}};for(var s of t)if(n=r(s))return n.v;return!1}function zu(t){var e=t.parentNode;return!(!e||!ns(e))&&e}var $v=["next","previous","prev",">","<"],sl=[".ph-no-rageclick",".ph-no-capture"],Ci=t=>!t||ft(t,"html")||!ns(t),il=(t,e)=>{if(!v||Ci(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[t],s=t;s.parentNode&&!ft(s,"body");)if(Hu(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var i=zu(s);if(!i)break;if(e||co.indexOf(i.tagName.toLowerCase())>-1)n=!0;else{var o=v.getComputedStyle(i);o&&o.getPropertyValue("cursor")==="pointer"&&(n=!0)}r.push(i),s=i}return{parentIsUsefulElement:n,targetElementList:r}};function $i(t){for(var e=t;e.parentNode&&!ft(e,"body");e=e.parentNode){var n=jr(e);if(q(n,"ph-sensitive")||q(n,"ph-no-capture"))return!1}if(q(jr(t),"ph-include"))return!0;var r=t.type||"";if(fe(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!fe(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function Wu(t){return!!(ft(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||ft(t,"select")||ft(t,"textarea")||t.getAttribute("contenteditable")==="true")}var qu="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",Rv=new RegExp("^(?:"+qu+")$"),Ov=new RegExp(qu),Gu="\\d{3}-?\\d{2}-?\\d{4}",Av=new RegExp("^("+Gu+")$"),Fv=new RegExp("("+Gu+")");function $n(t,e){return e===void 0&&(e=!0),!(G(t)||fe(t)&&(t=es(t),(e?Rv:Ov).test((t||"").replace(/[- ]/g,""))||(e?Av:Fv).test(t)))}function ol(t){var e=Ln(t);return $n(e=(e+" "+Vu(t)).trim())?e:""}function Vu(t){var e="";return t&&t.childNodes&&t.childNodes.length&&te(t.childNodes,function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var s=Ln(n);e=(e+" "+s).trim(),n.childNodes&&n.childNodes.length&&(e=(e+" "+Vu(n)).trim())}catch(i){R.error("[AutoCapture]",i)}}),e}function al(t){return t.replace(/"|\\"/g,'\\"')}function Nv(t){var e=t.attr__class;return e?Y(e)?e:lo(e):void 0}class ll{constructor(e){this.disabled=e===!1;var n=_e(e)?e:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(e,n,r){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(n-s.y)<this.thresholdPx&&this.timeoutMs>r-s.timestamp){if(this.clicks.push({x:e,y:n,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:n,timestamp:r}];return!1}}var $s="$copy_autocapture",cl=oe("[AutoCapture]");function Rs(t,e){return e.length>t?e.slice(0,t)+"...":e}function Mv(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!ns(e));return e}function Dv(t,e){for(var n,r,{e:s,maskAllElementAttributes:i,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,c=[t],u=t;u.parentNode&&!ft(u,"body");)Hu(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);var d,p,f=[],g={},_=!1,P=!1;if(te(c,S=>{var k=$i(S);S.tagName.toLowerCase()==="a"&&(_=S.getAttribute("href"),_=k&&_&&$n(_)&&_),q(jr(S),"ph-no-capture")&&(P=!0),f.push(function(E,I,A,j){var F=E.tagName.toLowerCase(),H={tag_name:F};co.indexOf(F)>-1&&!A&&(H.$el_text=F.toLowerCase()==="a"||F.toLowerCase()==="button"?Rs(1024,ol(E)):Rs(1024,Ln(E)));var B=jr(E);B.length>0&&(H.classes=B.filter(function(z){return z!==""})),te(E.attributes,function(z){var ee;if((!Wu(E)||["name","id","class","aria-label"].indexOf(z.name)!==-1)&&(j==null||!j.includes(z.name))&&!I&&$n(z.value)&&(!fe(ee=z.name)||ee.substring(0,10)!=="_ngcontent"&&ee.substring(0,7)!=="_nghost")){var V=z.value;z.name==="class"&&(V=lo(V).join(" ")),H["attr__"+z.name]=Rs(1024,V)}});for(var K=1,Z=1,N=E;N=Mv(N);)K++,N.tagName===E.tagName&&Z++;return H.nth_child=K,H.nth_of_type=Z,H}(S,i,o,a));var w=function(E){if(!$i(E))return{};var I={};return te(E.attributes,function(A){if(A.name&&A.name.indexOf("data-ph-capture-attribute")===0){var j=A.name.replace("data-ph-capture-attribute-",""),F=A.value;j&&F&&$n(F)&&(I[j]=F)}}),I}(S);ce(g,w)}),P)return{props:{},explicitNoCapture:P};if(o||(f[0].$el_text=t.tagName.toLowerCase()==="a"||t.tagName.toLowerCase()==="button"?ol(t):Ln(t)),_){var m,b;f[0].attr__href=_;var C=(m=Or(_))==null?void 0:m.host,x=v==null||(b=v.location)==null?void 0:b.host;C&&x&&C!==x&&(d=_)}return{props:ce({$event_type:s.type,$ce_version:1},l?{}:{$elements:f},{$elements_chain:(p=f,function(S){return S.map(k=>{var w,E,I="";if(k.tag_name&&(I+=k.tag_name),k.attr_class)for(var A of(k.attr_class.sort(),k.attr_class))I+="."+A.replace(/"/g,"");var j=T({},k.text?{text:k.text}:{},{"nth-child":(w=k.nth_child)!==null&&w!==void 0?w:0,"nth-of-type":(E=k.nth_of_type)!==null&&E!==void 0?E:0},k.href?{href:k.href}:{},k.attr_id?{attr_id:k.attr_id}:{},k.attributes),F={};return pr(j).sort((H,B)=>{var[K]=H,[Z]=B;return K.localeCompare(Z)}).forEach(H=>{var[B,K]=H;return F[al(B.toString())]=al(K.toString())}),(I+=":")+pr(F).map(H=>{var[B,K]=H;return B+'="'+K+'"'}).join("")}).join(";")}(function(S){return S.map(k=>{var w,E,I={text:(w=k.$el_text)==null?void 0:w.slice(0,400),tag_name:k.tag_name,href:(E=k.attr__href)==null?void 0:E.slice(0,2048),attr_class:Nv(k),attr_id:k.attr__id,nth_child:k.nth_child,nth_of_type:k.nth_of_type,attributes:{}};return pr(k).filter(A=>{var[j]=A;return j.indexOf("attr__")===0}).forEach(A=>{var[j,F]=A;return I.attributes[j]=F}),I})}(p)))},(n=f[0])!=null&&n.$el_text?{$el_text:(r=f[0])==null?void 0:r.$el_text}:{},d&&s.type==="click"?{$external_click_url:d}:{},g)}}var gn=oe("[ExceptionAutocapture]");function ul(t,e,n){try{if(!(e in t))return()=>{};var r=t[e],s=n(r);return Ke(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=s,()=>{t[e]=r}}catch{return()=>{}}}var Lv=oe("[TracingHeaders]"),at=oe("[Web Vitals]"),dl=9e5,hl="disabled",pl="lazy_loading",vn="awaiting_config",sr="missing_config";oe("[SessionRecording]");var Ri="[SessionRecording]",lt=oe(Ri),jv=oe("[Heatmaps]");function fl(t){return _e(t)&&"clientX"in t&&"clientY"in t&&We(t.clientX)&&We(t.clientY)}var _l=oe("[Product Tours]"),Os="ph_product_tours",Uv=["$set_once","$set"],ct=oe("[SiteApps]"),gl="Error while initializing PostHog app with config id ";function Lt(t,e,n){if(G(t))return!1;switch(n){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}class Hv{constructor(e){this.Vi=new ao,this.Yi=(n,r)=>this.Gi(n,r)&&this.Ji(n,r)&&this.Ki(n,r)&&this.Xi(n,r),this.Gi=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=e,this.Qi=new Set,this.Zi=new Set}init(){var e,n;O((e=this._instance)==null?void 0:e._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook((r,s)=>{this.on(r,s)})}register(e){var n,r;if(!O((n=this._instance)==null?void 0:n._addCaptureHook)&&(e.forEach(o=>{var a,l;(a=this.Zi)==null||a.add(o),(l=o.steps)==null||l.forEach(c=>{var u;(u=this.Qi)==null||u.add((c==null?void 0:c.event)||"")})}),(r=this._instance)!=null&&r.autocapture)){var s,i=new Set;e.forEach(o=>{var a;(a=o.steps)==null||a.forEach(l=>{l!=null&&l.selector&&i.add(l==null?void 0:l.selector)})}),(s=this._instance)==null||s.autocapture.setElementSelectors(i)}}on(e,n){var r;n!=null&&e.length!=0&&(this.Qi.has(e)||this.Qi.has(n==null?void 0:n.event))&&this.Zi&&((r=this.Zi)==null?void 0:r.size)>0&&this.Zi.forEach(s=>{this.te(n,s)&&this.Vi.emit("actionCaptured",s.name)})}ie(e){this.onAction("actionCaptured",n=>e(n))}te(e,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.Yi(e,r))return!0;return!1}onAction(e,n){return this.Vi.on(e,n)}Ji(e,n){if(n!=null&&n.url){var r,s=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!s||typeof s!="string"||!Lt(s,n.url,n.url_matching||"contains"))return!1}return!0}Ki(e,n){return!!this.ee(e,n)&&!!this.re(e,n)&&!!this.se(e,n)}ee(e,n){var r;if(n==null||!n.href)return!0;var s=this.ne(e);if(s.length>0)return s.some(a=>Lt(a.href,n.href,n.href_matching||"exact"));var i,o=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!o&&Lt((i=o.match(/(?::|")href="(.*?)"/))?i[1]:"",n.href,n.href_matching||"exact")}re(e,n){var r;if(n==null||!n.text)return!0;var s=this.ne(e);if(s.length>0)return s.some(c=>Lt(c.text,n.text,n.text_matching||"exact")||Lt(c.$el_text,n.text,n.text_matching||"exact"));var i,o,a,l=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!l&&(i=function(c){for(var u,d=[],p=/(?::|")text="(.*?)"/g;!G(u=p.exec(c));)d.includes(u[1])||d.push(u[1]);return d}(l),o=n.text,a=n.text_matching||"exact",i.some(c=>Lt(c,o,a)))}se(e,n){var r,s;if(n==null||!n.selector)return!0;var i=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(i!=null&&i.includes(n.selector))return!0;var o=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";if(n.selector_regex&&o)try{return new RegExp(n.selector_regex).test(o)}catch{return!1}return!1}ne(e){var n;return(e==null||(n=e.properties)==null?void 0:n.$elements)==null?[]:e==null?void 0:e.properties.$elements}Xi(e,n){return n==null||!n.properties||n.properties.length===0||Du(n.properties.reduce((r,s)=>{var i=Y(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return r[s.key]={values:i,operator:s.operator||"exact"},r},{}),e==null?void 0:e.properties)}}class Bv{constructor(e){this._instance=e,this.oe=new Map,this.ae=new Map,this.le=new Map}ue(e,n){return!!e&&Du(e.propertyFilters,n==null?void 0:n.properties)}he(e,n){var r=new Map;return e.forEach(s=>{var i;(i=s.conditions)==null||(i=i[n])==null||(i=i.values)==null||i.forEach(o=>{if(o!=null&&o.name){var a=r.get(o.name)||[];a.push(s.id),r.set(o.name,a)}})}),r}de(e,n,r){var s=(r===dn.Activation?this.oe:this.ae).get(e),i=[];return this.ve(o=>{i=o.filter(a=>s==null?void 0:s.includes(a.id))}),i.filter(o=>{var a,l=(a=o.conditions)==null||(a=a[r])==null||(a=a.values)==null?void 0:a.find(c=>c.name===e);return this.ue(l,n)})}register(e){var n;O((n=this._instance)==null?void 0:n._addCaptureHook)||(this.ce(e),this.fe(e))}fe(e){var n=e.filter(r=>{var s,i;return((s=r.conditions)==null?void 0:s.actions)&&((i=r.conditions)==null||(i=i.actions)==null||(i=i.values)==null?void 0:i.length)>0});n.length!==0&&(this.pe==null&&(this.pe=new Hv(this._instance),this.pe.init(),this.pe.ie(r=>{this.onAction(r)})),n.forEach(r=>{var s,i,o,a,l;r.conditions&&(s=r.conditions)!=null&&s.actions&&(i=r.conditions)!=null&&(i=i.actions)!=null&&i.values&&((o=r.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.pe)==null||a.register(r.conditions.actions.values),(l=r.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach(c=>{if(c&&c.name){var u=this.le.get(c.name);u&&u.push(r.id),this.le.set(c.name,u||[r.id])}}))}))}ce(e){var n,r=e.filter(i=>{var o,a;return((o=i.conditions)==null?void 0:o.events)&&((a=i.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0}),s=e.filter(i=>{var o,a;return((o=i.conditions)==null?void 0:o.cancelEvents)&&((a=i.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0});r.length===0&&s.length===0||((n=this._instance)==null||n._addCaptureHook((i,o)=>{this.onEvent(i,o)}),this.oe=this.he(e,dn.Activation),this.ae=this.he(e,dn.Cancellation))}onEvent(e,n){var r,s=this._e(),i=this.ge(),o=this.me(),a=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[i])||[];if(o===e&&n&&a.length>0){var l,c;s.info("event matched, removing item from activated items",{event:e,eventPayload:n,existingActivatedItems:a});var u=(n==null||(l=n.properties)==null?void 0:l.$survey_id)||(n==null||(c=n.properties)==null?void 0:c.$product_tour_id);if(u){var d=a.indexOf(u);0>d||(a.splice(d,1),this.be(a))}}else{if(this.ae.has(e)){var p=this.de(e,n,dn.Cancellation);p.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:p.map(g=>g.id)}),p.forEach(g=>{var _=a.indexOf(g.id);0>_||a.splice(_,1),this.ye(g.id)}),this.be(a))}if(this.oe.has(e)){s.info("event name matched",{event:e,eventPayload:n,items:this.oe.get(e)});var f=this.de(e,n,dn.Activation);this.be(a.concat(f.map(g=>g.id)||[]))}}}onAction(e){var n,r=this.ge(),s=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[r])||[];this.le.has(e)&&this.be(s.concat(this.le.get(e)||[]))}be(e){var n,r=this._e(),s=this.ge(),i=[...new Set(e)].filter(o=>!this.we(o));r.info("updating activated items",{activatedItems:i}),(n=this._instance)==null||(n=n.persistence)==null||n.register({[s]:i})}getActivatedIds(){var e,n=this.ge();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[n])||[]}getEventToItemsMap(){return this.oe}Ee(){return this.pe}}class zv extends Bv{constructor(e){super(e)}ge(){return"$surveys_activated"}me(){return xn.SHOWN}ve(e){var n;(n=this._instance)==null||n.getSurveys(e)}ye(e){var n;(n=this._instance)==null||n.cancelPendingSurvey(e)}_e(){return Q}we(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var As="SDK is not enabled or survey functionality is not yet loaded",vl="Disabled. Not loading surveys.",Wv=v!=null&&v.location?Fr(v.location.hash,"__posthog")||Fr(location.hash,"state"):null,ml="_postHogToolbarParams",yl=oe("[Toolbar]"),we=oe("[FeatureFlags]"),Et=oe("[FeatureFlags]",{debugEnabled:!0}),Fs=`" failed. Feature flags didn't load in time.`,Ns="$active_feature_flags",ut="$override_feature_flags",bl="$feature_flag_payloads",mn="$override_feature_flag_payloads",El="$feature_flag_request_id",wl=t=>{for(var e={},n=0;t.length>n;n++)e[t[n]]=!0;return e},Sl=t=>{var e={};for(var[n,r]of pr(t||{}))r&&(e[n]=r);return e},Ms=oe("[Error tracking]"),kl="Refusing to render web experiment since the viewer is a likely bot",qv={icontains:(t,e)=>!!v&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!v&&e.href.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>!!v&&Lr(e.href,t),not_regex:(t,e)=>!!v&&!Lr(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class be{get N(){return this._instance.config}constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments(s=>{be.Se("retrieved web experiments from the server"),n.xe=new Map,s.forEach(i=>{if(i.feature_flag_key){var o;n.xe&&(be.Se("setting flag key ",i.feature_flag_key," to web experiment ",i),(o=n.xe)==null||o.set(i.feature_flag_key,i));var a=n._instance.getFeatureFlag(i.feature_flag_key);fe(a)&&i.variants[a]&&n.Te(i.name,a,i.variants[a].transforms)}else if(i.variants)for(var l in i.variants){var c=i.variants[l];be.$e(c)&&n.Te(i.name,l,c.transforms)}})},r)},this._instance=e,this._instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}initialize(){}onFeatureFlags(e){if(this._is_bot())be.Se(kl);else if(!this.N.disable_web_experiments){if(G(this.xe))return this.xe=new Map,this.loadIfEnabled(),void this.previewWebExperiment();be.Se("applying feature flags",e),e.forEach(n=>{var r;if(this.xe&&(r=this.xe)!=null&&r.has(n)){var s,i=this._instance.getFeatureFlag(n),o=(s=this.xe)==null?void 0:s.get(n);i&&o!=null&&o.variants[i]&&this.Te(o.name,i,o.variants[i].transforms)}})}}previewWebExperiment(){var e=be.getWindowLocation();if(e!=null&&e.search){var n=Ar(e==null?void 0:e.search,"__experiment_id"),r=Ar(e==null?void 0:e.search,"__experiment_variant");n&&r&&(be.Se("previewing web experiments "+n+" && "+r),this.getWebExperiments(s=>{this.ke(parseInt(n),r,s)},!1,!0))}}loadIfEnabled(){this.N.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,r){if(this.N.disable_web_experiments&&!r)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!n)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.N.token),method:"GET",callback:i=>e(i.statusCode===200&&i.json&&i.json.experiments||[])})}ke(e,n,r){var s=r.filter(i=>i.id===e);s&&s.length>0&&(be.Se("Previewing web experiment ["+s[0].name+"] with variant ["+n+"]"),this.Te(s[0].name,n,s[0].variants[n].transforms))}static $e(e){return!G(e.conditions)&&be.Re(e)&&be.Pe(e)}static Re(e){var n;if(G(e.conditions)||G((n=e.conditions)==null?void 0:n.url))return!0;var r,s,i,o=be.getWindowLocation();return!!o&&((r=e.conditions)==null||!r.url||qv[(s=(i=e.conditions)==null?void 0:i.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,o))}static getWindowLocation(){return v==null?void 0:v.location}static Pe(e){var n;if(G(e.conditions)||G((n=e.conditions)==null?void 0:n.utm))return!0;var r=Eu();if(r.utm_source){var s,i,o,a,l,c,u,d,p=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((i=e.conditions)==null||(i=i.utm)==null?void 0:i.utm_campaign)==r.utm_campaign,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==r.utm_source,g=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==r.utm_medium,_=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((d=e.conditions)==null||(d=d.utm)==null?void 0:d.utm_term)==r.utm_term;return p&&g&&_&&f}return!1}static Se(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;n>s;s++)r[s-1]=arguments[s];R.info("[WebExperiments] "+e,r)}Te(e,n,r){this._is_bot()?be.Se(kl):n!=="control"?r.forEach(s=>{if(s.selector){var i;be.Se("applying transform of variant "+n+" for experiment "+e+" ",s);var o=(i=document)==null?void 0:i.querySelectorAll(s.selector);o==null||o.forEach(a=>{var l=a;s.html&&(l.innerHTML=s.html),s.css&&l.setAttribute("style",s.css)})}}):be.Se("Control variants leave the page unmodified.")}_is_bot(){return Re&&this._instance?Nu(Re,this.N.custom_blocked_useragents):void 0}}var Ae=oe("[Conversations]"),wt="Conversations not available yet.",rs={featureFlags:class{constructor(t){this.Oe=!1,this.Ie=!1,this.Ce=!1,this.Fe=!1,this.Ae=!1,this.Me=!1,this.De=!1,this.Le=!1,this._instance=t,this.featureFlagEventHandlers=[]}get N(){return this._instance.config}get Wt(){return this._instance.persistence}Ue(t){return this._instance.get_property(t)}Ne(){var t,e;return(t=(e=this.Wt)==null?void 0:e.nt(this.N.feature_flag_cache_ttl_ms))!==null&&t!==void 0&&t}je(){return!!this.Ne()&&(this.Le||this.Ce||(this.Le=!0,we.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}ze(){var t,e=(t=this.N.evaluation_contexts)!==null&&t!==void 0?t:this.N.evaluation_environments;return!this.N.evaluation_environments||this.N.evaluation_contexts||this.De||(we.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.De=!0),e!=null&&e.length?e.filter(n=>{var r=n&&typeof n=="string"&&n.trim().length>0;return r||we.error("Invalid evaluation context found:",n,"Expected non-empty string"),r}):[]}Be(){return this.ze().length>0}initialize(){var t,e,{config:n}=this._instance,r=(t=(e=n.bootstrap)==null?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(r).length){var s,i,o=(s=(i=n.bootstrap)==null?void 0:i.featureFlagPayloads)!==null&&s!==void 0?s:{},a=Object.keys(r).filter(c=>!!r[c]).reduce((c,u)=>(c[u]=r[u]||!1,c),{}),l=Object.keys(o).filter(c=>a[c]).reduce((c,u)=>(o[u]&&(c[u]=o[u]),c),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,e,n){var r=n!=null&&n.merge?this.getFlagVariants():{},s=n!=null&&n.merge?this.getFlagPayloads():{},i=T({},r,t),o=T({},s,e),a={};for(var[l,c]of Object.entries(i)){var u=typeof c=="string";a[l]={key:l,enabled:!!u||!!c,variant:u?c:void 0,reason:void 0,metadata:O(o==null?void 0:o[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.Ie}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Ue(hi),e=this.Ue(ut),n=this.Ue(mn);if(!n&&!e)return t||{};var r=ce({},t||{}),s=[...new Set([...Object.keys(n||{}),...Object.keys(e||{})])];for(var i of s){var o,a,l=r[i],c=e==null?void 0:e[i],u=O(c)?(o=l==null?void 0:l.enabled)!==null&&o!==void 0&&o:!!c,d=O(c)?l.variant:typeof c=="string"?c:void 0,p=n==null?void 0:n[i],f=T({},l,{enabled:u,variant:u?d??(l==null?void 0:l.variant):void 0});u!==(l==null?void 0:l.enabled)&&(f.original_enabled=l==null?void 0:l.enabled),d!==(l==null?void 0:l.variant)&&(f.original_variant=l==null?void 0:l.variant),p&&(f.metadata=T({},l==null?void 0:l.metadata,{payload:p,original_payload:l==null||(a=l.metadata)==null?void 0:a.payload})),r[i]=f}return this.Oe||(we.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:n,finalDetails:r}),this.Oe=!0),r}getFlagVariants(){var t=this.Ue(zt),e=this.Ue(ut);if(!e)return t||{};for(var n=ce({},t),r=Object.keys(e),s=0;r.length>s;s++)n[r[s]]=e[r[s]];return this.Oe||(we.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:n}),this.Oe=!0),n}getFlagPayloads(){var t=this.Ue(bl),e=this.Ue(mn);if(!e)return t||{};for(var n=ce({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)n[r[s]]=e[r[s]];return this.Oe||(we.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:n}),this.Oe=!0),n}reloadFeatureFlags(){this.Fe||this.N.advanced_disable_feature_flags||this.He||(this._instance.mi.emit("featureFlagsReloading",!0),this.He=setTimeout(()=>{this.qe()},5))}We(){clearTimeout(this.He),this.He=void 0}ensureFlagsLoaded(){this.Ie||this.Ce||this.He||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Fe=t}qe(t){var e;if(this.We(),!this._instance.bt())if(this.Ce)this.Ae=!0;else{var n=this.N.token,r=this.Ue(kr),s={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:T({},((e=this.Wt)==null?void 0:e.get_initial_props())||{},this.Ue(kn)||{}),group_properties:this.Ue(St),timezone:Tu()};rt(r)||O(r)||(s.$device_id=r),(t!=null&&t.disableFlags||this.N.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.Be()&&(s.evaluation_contexts=this.ze());var i=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.N.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Ce=!0,this._instance._send_request({method:"POST",url:i,data:s,compression:this.N.disable_compression?void 0:Ue.Base64,timeout:this.N.feature_flag_request_timeout_ms,callback:o=>{var a,l,c,u=!0;if(o.statusCode===200&&(this.Ae||(this.$anon_distinct_id=void 0),u=!1),this.Ce=!1,!s.disable_flags||this.Ae){this.Me=!u;var d=[];o.error?o.error instanceof Error?d.push(o.error.name==="AbortError"?"timeout":"connection_error"):d.push("unknown_error"):o.statusCode!==200&&d.push("api_error_"+o.statusCode),(a=o.json)!=null&&a.errorsWhileComputingFlags&&d.push("errors_while_computing_flags");var p,f=!((l=o.json)==null||(l=l.quotaLimited)==null||!l.includes("feature_flags"));f&&d.push("quota_limited"),(c=this.Wt)==null||c.register({[_i]:d}),f?we.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(s.disable_flags||this.receivedFeatureFlags((p=o.json)!==null&&p!==void 0?p:{},u),this.Ae&&(this.Ae=!1,this.qe()))}}})}}getFeatureFlag(t,e){var n;if(e===void 0&&(e={}),!e.fresh||this.Me)if(this.Ie||this.getFlags()&&this.getFlags().length>0){if(!this.je()){var r=this.getFeatureFlagResult(t,e);return(n=r==null?void 0:r.variant)!==null&&n!==void 0?n:r==null?void 0:r.enabled}}else we.warn('getFeatureFlag for key "'+t+Fs)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return e==null?void 0:e.payload}getFeatureFlagResult(t,e){if(e===void 0&&(e={}),!e.fresh||this.Me)if(this.Ie||this.getFlags()&&this.getFlags().length>0){if(!this.je()){var n=this.getFlagVariants(),r=t in n,s=n[t],i=this.getFlagPayloads()[t],o=String(s),a=this.Ue(El)||void 0,l=this.Ue(Ir)||void 0,c=this.Ue(Tn)||{};if(this.N.advanced_feature_flags_dedup_per_session){var u,d=this._instance.get_session_id(),p=this.Ue(fi);d&&d!==p&&(c={},(u=this.Wt)==null||u.register({[Tn]:c,[fi]:d}))}if((e.send_event||!("send_event"in e))&&(!(t in c)||!c[t].includes(o))){var f,g,_,P,m,b,C,x,S,k;Y(c[t])?c[t].push(o):c[t]=[o],(f=this.Wt)==null||f.register({[Tn]:c});var w=this.getFeatureFlagDetails(t),E=[...(g=this.Ue(_i))!==null&&g!==void 0?g:[]];O(s)&&E.push("flag_missing");var I={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:i||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:((_=this.N.bootstrap)==null||(_=_.featureFlags)==null?void 0:_[t])||null,$feature_flag_bootstrapped_payload:((P=this.N.bootstrap)==null||(P=P.featureFlagPayloads)==null?void 0:P[t])||null,$used_bootstrap_value:!this.Me};O(w==null||(m=w.metadata)==null?void 0:m.version)||(I.$feature_flag_version=w.metadata.version);var A,j=(b=w==null||(C=w.reason)==null?void 0:C.description)!==null&&b!==void 0?b:w==null||(x=w.reason)==null?void 0:x.code;j&&(I.$feature_flag_reason=j),w!=null&&(S=w.metadata)!=null&&S.id&&(I.$feature_flag_id=w.metadata.id),O(w==null?void 0:w.original_variant)&&O(w==null?void 0:w.original_enabled)||(I.$feature_flag_original_response=O(w.original_variant)?w.original_enabled:w.original_variant),w!=null&&(k=w.metadata)!=null&&k.original_payload&&(I.$feature_flag_original_payload=w==null||(A=w.metadata)==null?void 0:A.original_payload),E.length&&(I.$feature_flag_error=E.join(",")),this._instance.capture("$feature_flag_called",I)}if(r){var F=i;if(!O(i))try{F=JSON.parse(i)}catch{}return{key:t,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:F}}}}else we.warn('getFeatureFlagResult for key "'+t+Fs)}getRemoteConfigPayload(t,e){var n=this.N.token,r={distinct_id:this._instance.get_distinct_id(),token:n};this.Be()&&(r.evaluation_contexts=this.ze()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.N.disable_compression?void 0:Ue.Base64,timeout:this.N.feature_flag_request_timeout_ms,callback(s){var i,o=(i=s.json)==null?void 0:i.featureFlagPayloads;e((o==null?void 0:o[t])||void 0)}})}isFeatureEnabled(t,e){if(e===void 0&&(e={}),!e.fresh||this.Me){if(this.Ie||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(t,e);return O(n)?void 0:!!n}we.warn('isFeatureEnabled for key "'+t+Fs)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==t)}receivedFeatureFlags(t,e){if(this.Wt){this.Ie=!0;var n=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(i,o,a,l,c){a===void 0&&(a={}),l===void 0&&(l={}),c===void 0&&(c={});var u=(k=>{var w=k.flags;return w?(k.featureFlags=Object.fromEntries(Object.keys(w).map(E=>{var I;return[E,(I=w[E].variant)!==null&&I!==void 0?I:w[E].enabled]})),k.featureFlagPayloads=Object.fromEntries(Object.keys(w).filter(E=>w[E].enabled).filter(E=>{var I;return(I=w[E].metadata)==null?void 0:I.payload}).map(E=>{var I;return[E,(I=w[E].metadata)==null?void 0:I.payload]}))):we.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),k})(i),d=u.flags,p=u.featureFlags,f=u.featureFlagPayloads;if(p){var g=i.requestId,_=i.evaluatedAt;if(Y(p)){we.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var P={};if(p)for(var m=0;p.length>m;m++)P[p[m]]=!0;o&&o.register({[Ns]:p,[zt]:P})}else{var b=p,C=f,x=d;if(i.errorsWhileComputingFlags)if(d){var S=new Set(Object.keys(d).filter(k=>{var w;return!((w=d[k])!=null&&w.failed)}));b=T({},a,Object.fromEntries(Object.entries(b).filter(k=>{var[w]=k;return S.has(w)}))),C=T({},l,Object.fromEntries(Object.entries(C||{}).filter(k=>{var[w]=k;return S.has(w)}))),x=T({},c,Object.fromEntries(Object.entries(x||{}).filter(k=>{var[w]=k;return S.has(w)})))}else b=T({},a,b),C=T({},l,C),x=T({},c,x);o&&o.register(T({[Ns]:Object.keys(Sl(b)),[zt]:b||{},[bl]:C||{},[hi]:x||{}},g?{[El]:g}:{},_?{[Ir]:_}:{}))}}})(t,this.Wt,n,r,s),e||(this.Le=!1),this.Ve(e)}}override(t,e){e===void 0&&(e=!1),we.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.Wt)return we.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.Wt.unregister(ut),this.Wt.unregister(mn),this.Ve(),Et.info("All overrides cleared");if(Y(t)){var e=wl(t);return this.Wt.register({[ut]:e}),this.Ve(),Et.info("Flag overrides set",{flags:t})}if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var n,r=t;if(this.Oe=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this.Wt.unregister(ut),Et.info("Flag overrides cleared");else if(r.flags){if(Y(r.flags)){var s=wl(r.flags);this.Wt.register({[ut]:s})}else this.Wt.register({[ut]:r.flags});Et.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this.Wt.unregister(mn),Et.info("Payload overrides cleared")):r.payloads&&(this.Wt.register({[mn]:r.payloads}),Et.info("Payload overrides set",{payloads:r.payloads}))),void this.Ve()}if(t&&typeof t=="object")return this.Wt.register({[ut]:t}),this.Ve(),Et.info("Flag overrides set",{flags:t});we.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Ie){var{flags:e,flagVariants:n}=this.Ye();t(e,n)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,n){var r,s=(this.Ue(Sn)||[]).find(l=>l.flagKey===t),i={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:i};s&&(o.$early_access_feature_name=s.name),n&&(o.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(i,!1);var a=T({},this.getFlagVariants(),{[t]:e});(r=this.Wt)==null||r.register({[Ns]:Object.keys(Sl(a)),[zt]:a}),this.Ve()}getEarlyAccessFeatures(t,e,n){e===void 0&&(e=!1);var r=this.Ue(Sn),s=n?"&"+n.map(i=>"stage="+i).join("&"):"";if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.N.token+s),method:"GET",callback:i=>{var o,a;if(i.json){var l=i.json.earlyAccessFeatures;return(o=this.Wt)==null||o.unregister(Sn),(a=this.Wt)==null||a.register({[Sn]:l}),t(l)}}})}Ye(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(n=>e[n]),flagVariants:Object.keys(e).filter(n=>e[n]).reduce((n,r)=>(n[r]=e[r],n),{})}}Ve(t){var{flags:e,flagVariants:n}=this.Ye();this.featureFlagEventHandlers.forEach(r=>r(e,n,{errorsLoading:t}))}setPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.Ue(kn)||{};this._instance.register({[kn]:T({},n,t)}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(kn)}setGroupPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.Ue(St)||{};Object.keys(n).length!==0&&Object.keys(n).forEach(r=>{n[r]=T({},n[r],t[r]),delete t[r]}),this._instance.register({[St]:T({},n,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.Ue(St)||{};this._instance.register({[St]:T({},e,{[t]:{}})})}else this._instance.unregister(St)}reset(){this.Ie=!1,this.Ce=!1,this.Fe=!1,this.Ae=!1,this.Me=!1,this.$anon_distinct_id=void 0,this.We(),this.Oe=!1}}},Gv={sessionRecording:class{get N(){return this._instance.config}get Wt(){return this._instance.persistence}get started(){var t;return!((t=this.Ge)==null||!t.isStarted)}get status(){var t,e;return this.Je===vn||this.Je===sr?this.Je:(t=(e=this.Ge)==null?void 0:e.status)!==null&&t!==void 0?t:this.Je}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.Je=hl,this.Ke=void 0,this._instance=t,!this._instance.sessionManager)throw lt.error("started without valid sessionManager"),new Error(Ri+" started without valid sessionManager. This is a bug.");if(this.N.cookieless_mode===Le)throw new Error(Ri+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Xe(){var t,e=!((t=this._instance.get_property(Xn))==null||!t.enabled),n=!this.N.disable_session_recording,r=this.N.disable_session_recording||this._instance.consent.isOptedOut();return v&&e&&n&&!r}startIfEnabledOrStop(t){var e;if(!this.Xe||(e=this.Ge)==null||!e.isStarted){var n=!O(Object.assign)&&!O(Array.from);this.Xe&&n?(this.Qe(t),lt.info("starting")):(this.Je=hl,this.stopRecording())}}Qe(t){var e,n,r;this.Xe&&(this.Je!==vn&&this.Je!==sr&&(this.Je=pl),M!=null&&(e=M.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(n=M.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Ze(t):(r=M.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.tr,s=>{if(s)return lt.error("could not load recorder",s);this.Ze(t)}))}stopRecording(){var t,e;(t=this.Ke)==null||t.call(this),this.Ke=void 0,(e=this.Ge)==null||e.stop()}ir(){var t,e;(t=this.Ke)==null||t.call(this),this.Ke=void 0,(e=this.Ge)==null||e.discard()}er(){var t;(t=this.Wt)==null||t.unregister(_u)}rr(t,e){if(G(t))return null;var n,r=We(t)?t:parseFloat(t);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(lt.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}sr(t){if(this.Wt){var e,n,r=this.Wt,s=()=>{var i,o=t.sessionRecording===!1?void 0:t.sessionRecording,a=this.rr((i=this.N.session_recording)==null?void 0:i.sampleRate,"session_recording.sampleRate"),l=this.rr(o==null?void 0:o.sampleRate,"remote config sampleRate"),c=a??l;G(c)&&this.er();var u=o==null?void 0:o.minimumDurationMilliseconds;r.register({[Xn]:T({cache_timestamp:Date.now(),enabled:!!o},o,{networkPayloadCapture:T({capturePerformance:t.capturePerformance},o==null?void 0:o.networkPayloadCapture),canvasRecording:{enabled:o==null?void 0:o.recordCanvas,fps:o==null?void 0:o.canvasFps,quality:o==null?void 0:o.canvasQuality},sampleRate:c,minimumDurationMilliseconds:O(u)?null:u,endpoint:o==null?void 0:o.endpoint,triggerMatchType:o==null?void 0:o.triggerMatchType,masking:o==null?void 0:o.masking,urlTriggers:o==null?void 0:o.urlTriggers})})};s(),(e=this.Ke)==null||e.call(this),this.Ke=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(s)}}onRemoteConfig(t){return"sessionRecording"in t?t.sessionRecording===!1?(this.sr(t),void this.ir()):(this.sr(t),void this.startIfEnabledOrStop()):(this.Je===vn&&(this.Je=sr,lt.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var n;e===void 0&&(e="log"),(n=this.Ge)!=null&&n.log?this.Ge.log(t,e):lt.warn("log called before recorder was ready")}get tr(){var t,e,n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(Xn);return(n==null||(e=n.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}nr(){var t,e=this._instance.get_property(Xn);if(!e)return!1;var n=(t=(typeof e=="object"?e:JSON.parse(e)).cache_timestamp)!==null&&t!==void 0?t:Date.now();return 36e5>=Date.now()-n}Ze(t){var e,n;if((e=M.__PosthogExtensions__)==null||!e.initSessionRecording)return lt.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0});if(this.Ge||(this.Ge=(n=M.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.Ge._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.nr())return this.Je===sr||this.Je===vn?void 0:(this.Je=vn,lt.info("persisted remote config is stale, requesting fresh config before starting"),void new Pu(this._instance).load());this.Je=pl,this.Ge.start(t)}onRRwebEmit(t){var e;(e=this.Ge)==null||e.onRRwebEmit==null||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.Ge||(e=this.Wt)==null||e.register({$replay_override_linked_flag:!0}),(t=this.Ge)==null||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Ge||(e=this.Wt)==null||e.register({$replay_override_sampling:!0}),(t=this.Ge)==null||t.overrideSampling()}overrideTrigger(t){var e,n;this.Ge||(n=this.Wt)==null||n.register({[t==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(e=this.Ge)==null||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.Ge)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var n;return!((n=this.Ge)==null||!n.tryAddCustomEvent(t,e))}}},Vv={autocapture:class{constructor(t){this.ar=!1,this.lr=null,this.ur=!1,this.instance=t,this.rageclicks=new ll(t.config.rageclick),this.hr=null}initialize(){this.startIfEnabled()}get N(){var t,e,n=_e(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(t=n.url_allowlist)==null?void 0:t.map(r=>new RegExp(r)),n.url_ignorelist=(e=n.url_ignorelist)==null?void 0:e.map(r=>new RegExp(r)),n}dr(){if(this.isBrowserSupported()){if(v&&$){var t=n=>{n=n||(v==null?void 0:v.event);try{this.vr(n)}catch(r){cl.error("Failed to capture event",r)}};if(he($,"submit",t,{capture:!0}),he($,"change",t,{capture:!0}),he($,"click",t,{capture:!0}),this.N.capture_copied_text){var e=n=>{this.vr(n=n||(v==null?void 0:v.event),$s)};he($,"copy",e,{capture:!0}),he($,"cut",e,{capture:!0})}}}else cl.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.ar&&(this.dr(),this.ar=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.ur=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Ta]:!!t.autocapture_opt_out}),this.lr=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.hr=t}getElementSelectors(t){var e,n=[];return(e=this.hr)==null||e.forEach(r=>{var s=$==null?void 0:$.querySelectorAll(r);s==null||s.forEach(i=>{t===i&&n.push(r)})}),n}get isEnabled(){var t,e,n=(t=this.instance.persistence)==null?void 0:t.props[Ta];if(rt(this.lr)&&!Xe(n)&&!this.instance.bt())return!1;var r=(e=this.lr)!==null&&e!==void 0?e:!!n;return!!this.instance.config.autocapture&&!r}vr(t,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var n,r=nl(t);Uu(r)&&(r=r.parentNode||null),e==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&function(d,p){if(!v||Ci(d))return!1;var f,g,_;if(Xe(p)?(f=!!p&&sl,g=void 0):(f=(_=p==null?void 0:p.css_selector_ignorelist)!==null&&_!==void 0?_:sl,g=p==null?void 0:p.content_ignorelist),f===!1)return!1;var{targetElementList:P}=il(d,!1);return!function(m,b){if(m===!1||O(m))return!1;var C;if(m===!0)C=$v;else{if(!Y(m))return!1;if(m.length>10)return R.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;C=m.map(x=>x.toLowerCase())}return b.some(x=>{var{safeText:S,ariaLabel:k}=x;return C.some(w=>S.includes(w)||k.includes(w))})}(g,P.map(m=>{var b;return{safeText:Ln(m).toLowerCase(),ariaLabel:((b=m.getAttribute("aria-label"))==null?void 0:b.toLowerCase().trim())||""}}))&&!rl(P,f)}(r,this.instance.config.rageclick)&&this.vr(t,"$rageclick");var s=e===$s;if(r&&function(d,p,f,g,_){var P,m,b,C;if(f===void 0&&(f=void 0),!v||Ci(d)||(P=f)!=null&&P.url_allowlist&&!tl(f.url_allowlist)||(m=f)!=null&&m.url_ignorelist&&tl(f.url_ignorelist))return!1;if((b=f)!=null&&b.dom_event_allowlist){var x=f.dom_event_allowlist;if(x&&!x.some(I=>p.type===I))return!1}var{parentIsUsefulElement:S,targetElementList:k}=il(d,g);if(!function(I,A){var j=A==null?void 0:A.element_allowlist;if(O(j))return!0;var F,H=function(K){if(j.some(Z=>K.tagName.toLowerCase()===Z))return{v:!0}};for(var B of I)if(F=H(B))return F.v;return!1}(k,f)||!rl(k,(C=f)==null?void 0:C.css_selector_allowlist))return!1;var w=v.getComputedStyle(d);if(w&&w.getPropertyValue("cursor")==="pointer"&&p.type==="click")return!0;var E=d.tagName.toLowerCase();switch(E){case"html":return!1;case"form":return(_||["submit"]).indexOf(p.type)>=0;case"input":case"select":case"textarea":return(_||["change","click"]).indexOf(p.type)>=0;default:return S?(_||["click"]).indexOf(p.type)>=0:(_||["click"]).indexOf(p.type)>=0&&(co.indexOf(E)>-1||d.getAttribute("contenteditable")==="true")}}(r,t,this.N,s,s?["copy","cut"]:void 0)){var{props:i,explicitNoCapture:o}=Dv(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.N.element_attribute_ignorelist,elementsChainAsString:this.ur});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(i.$element_selectors=a),e===$s){var l,c=Bu(v==null||(l=v.getSelection())==null?void 0:l.toString()),u=t.type||"clipboard";if(!c)return!1;i.$selected_content=c,i.$copy_type=u}return this.instance.capture(e,i),!0}}}isBrowserSupported(){return Ke($==null?void 0:$.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.cr=(v==null||(e=v.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(R.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.pr&&this.pr(),this.pr=void 0,R.info("History API monitoring stopped")}monitorHistoryChanges(){var t,e;if(v&&v.history){var n=this;(t=v.history.pushState)!=null&&t.__posthog_wrapped__||ul(v.history,"pushState",r=>function(s,i,o){r.call(this,s,i,o),n._r("pushState")}),(e=v.history.replaceState)!=null&&e.__posthog_wrapped__||ul(v.history,"replaceState",r=>function(s,i,o){r.call(this,s,i,o),n._r("replaceState")}),this.gr()}}_r(t){try{var e,n=v==null||(e=v.location)==null?void 0:e.pathname;if(!n)return;n!==this.cr&&this.isEnabled&&this._instance.capture(Ut,{navigation_type:t}),this.cr=n}catch(r){R.error("Error capturing "+t+" pageview",r)}}gr(){if(!this.pr){var t=()=>{this._r("popstate")};he(v,"popstate",t),this.pr=()=>{v&&v.removeEventListener("popstate",t)}}}},heatmaps:class{get N(){return this.instance.config}constructor(t){var e;this.mr=!1,this.ar=!1,this.br=null,this.instance=t,this.mr=!((e=this.instance.persistence)==null||!e.props[ui]),this.rageclicks=new ll(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return _e(this.N.capture_heatmaps)&&this.N.capture_heatmaps.flush_interval_milliseconds&&(t=this.N.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return G(this.N.capture_heatmaps)?G(this.N.enable_heatmaps)?this.mr:this.N.enable_heatmaps:this.N.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.ar)return;jv.info("starting..."),this.yr(),this.wr()}else{var t;clearInterval((t=this.br)!==null&&t!==void 0?t:void 0),this.Er(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[ui]:e}),this.mr=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.I;return this.I=void 0,t}Sr(t){this.Tr(t.originalEvent,"deadclick")}wr(){this.br&&clearInterval(this.br),this.br=($==null?void 0:$.visibilityState)==="visible"?setInterval(this.At.bind(this),this.flushIntervalMilliseconds):null}yr(){v&&$&&(this.$r=this.At.bind(this),he(v,$r,this.$r),this.kr=t=>this.Tr(t||(v==null?void 0:v.event)),he($,"click",this.kr,{capture:!0}),this.Rr=t=>this.Pr(t||(v==null?void 0:v.event)),he($,"mousemove",this.Rr,{capture:!0}),this.Or=new Ma(this.instance,ev,this.Sr.bind(this)),this.Or.startIfEnabledOrStop(),this.Ir=this.wr.bind(this),he($,Cr,this.Ir),this.ar=!0)}Er(){var t;v&&$&&(this.$r&&v.removeEventListener($r,this.$r),this.kr&&$.removeEventListener("click",this.kr,{capture:!0}),this.Rr&&$.removeEventListener("mousemove",this.Rr,{capture:!0}),this.Ir&&$.removeEventListener(Cr,this.Ir),clearTimeout(this.Cr),(t=this.Or)==null||t.stop(),this.ar=!1)}Fr(t,e){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),i=function(o,a,l){for(var c=o;c&&ns(c)&&!ft(c,"body");){if(c===l)return!1;if(q(a,v==null?void 0:v.getComputedStyle(c).position))return!0;c=zu(c)}return!1}(nl(t),["fixed","sticky"],s);return{x:t.clientX+(i?0:r),y:t.clientY+(i?0:n),target_fixed:i,type:e}}Tr(t,e){var n;if(e===void 0&&(e="click"),!el(t.target)&&fl(t)){var r=this.Fr(t,e);(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this.Ar(T({},r,{type:"rageclick"})),this.Ar(r)}}Pr(t){!el(t.target)&&fl(t)&&(clearTimeout(this.Cr),this.Cr=setTimeout(()=>{this.Ar(this.Fr(t,"mousemove"))},500))}Ar(t){if(v){var e=v.location.href,n=this.N.custom_personal_data_properties,r=this.N.mask_personal_data_properties?[...tn,...n||[]]:[],s=Mn(e,r,Dn);this.I=this.I||{},this.I[s]||(this.I[s]=[]),this.I[s].push(t)}}At(){this.I&&!Bt(this.I)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ma,webVitalsAutocapture:class{constructor(t){var e;this.mr=!1,this.ar=!1,this.I={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Mr=()=>{clearTimeout(this.Dr),this.I.metrics.length!==0&&(this._instance.capture("$web_vitals",this.I.metrics.reduce((n,r)=>T({},n,{["$web_vitals_"+r.name+"_event"]:T({},r),["$web_vitals_"+r.name+"_value"]:r.value}),{})),this.I={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Lr=n=>{var r,s=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0);if(O(s))at.error("Could not read session ID. Dropping metrics!");else{this.I=this.I||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var i=this.Ur();O(i)||(G(n==null?void 0:n.name)||G(n==null?void 0:n.value)?at.error("Invalid metric received",n):!this.Nr||this.Nr>n.value?(this.I.url!==i&&(this.Mr(),this.Dr=setTimeout(this.Mr,this.flushToCaptureTimeoutMs)),O(this.I.url)&&(this.I.url=i),this.I.firstMetricTimestamp=O(this.I.firstMetricTimestamp)?Date.now():this.I.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.I.metrics.push(T({},n,{$current_url:i,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.I.metrics.length===this.allowedMetrics.length&&this.Mr()):at.error("Ignoring metric with value >= "+this.Nr,n))}},this.jr=()=>{if(!this.ar){var n,r,s,i,o=M.__PosthogExtensions__;O(o)||O(o.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:r,onFCP:s,onINP:i}=o.postHogWebVitalsCallbacks),n&&r&&s&&i?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.Lr.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.Lr.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this.Lr.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&i(this.Lr.bind(this)),this.ar=!0):at.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.mr=!((e=this._instance.persistence)==null||!e.props[$a]),this.startIfEnabled()}get zr(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,n=_e(this.zr)?(t=this.zr)==null?void 0:t.web_vitals_allowed_metrics:void 0;return G(n)?((e=this._instance.persistence)==null?void 0:e.props[Oa])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(_e(this.zr)?this.zr.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=_e(this.zr)?this.zr.web_vitals_attribution:void 0;return t!=null&&t}get Nr(){var t=_e(this.zr)&&We(this.zr.__web_vitals_max_value)?this.zr.__web_vitals_max_value:dl;return t>0&&6e4>=t?dl:t}get isEnabled(){var t=ve==null?void 0:ve.protocol;if(t!=="http:"&&t!=="https:")return at.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=_e(this.zr)?this.zr.web_vitals:Xe(this.zr)?this.zr:void 0;return Xe(e)?e:this.mr}startIfEnabled(){this.isEnabled&&!this.ar&&(at.info("enabled, starting..."),this.Y(this.jr))}onRemoteConfig(t){if("capturePerformance"in t){var e=_e(t.capturePerformance)&&!!t.capturePerformance.web_vitals,n=_e(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[$a]:e}),this._instance.persistence.register({[Oa]:n})),this.mr=e,this.startIfEnabled()}}Y(t){var e,n;(e=M.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?t():(n=M.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",r=>{r?at.error("failed to load script",r):t()})}Ur(){var t=v?v.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...tn,...e||[]]:[];return Mn(t,n,Dn)}at.error("Could not determine current URL")}}},Yv={exceptionObserver:class{constructor(t){var e,n,r;this.jr=()=>{var s;if(v&&this.isEnabled&&(s=M.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var i=M.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=M.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=M.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Br&&this.N.capture_unhandled_errors&&(this.Br=i(this.captureException.bind(this))),!this.Hr&&this.N.capture_unhandled_rejections&&(this.Hr=o(this.captureException.bind(this))),!this.qr&&this.N.capture_console_errors&&(this.qr=a(this.captureException.bind(this)))}catch(l){gn.error("failed to start",l),this.Wr()}}},this._instance=t,this.Vr=!((e=this._instance.persistence)==null||!e.props[Pa]),this.Yr=new hg({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10,refillInterval:1e4,h:gn}),this.N=this.Gr(),this.startIfEnabledOrStop()}Gr(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return _e(t)?e=T({},e,t):(O(t)?this.Vr:t)&&(e=T({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.N.capture_console_errors||this.N.capture_unhandled_errors||this.N.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(gn.info("enabled"),this.Wr(),this.Y(this.jr)):this.Wr()}Y(t){var e,n;(e=M.__PosthogExtensions__)!=null&&e.errorWrappingFunctions&&t(),(n=M.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",r=>{if(r)return gn.error("failed to load script",r);t()})}Wr(){var t,e,n;(t=this.Br)==null||t.call(this),this.Br=void 0,(e=this.Hr)==null||e.call(this),this.Hr=void 0,(n=this.qr)==null||n.call(this),this.qr=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.Vr=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Pa]:this.Vr}),this.N=this.Gr(),this.startIfEnabledOrStop())}onConfigChange(){this.N=this.Gr()}captureException(t){var e,n,r,s=(e=t==null||(n=t.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&e!==void 0?e:"Exception";this.Yr.consumeRateLimit(s)?gn.info("Skipping exception capture because of client rate limiting.",{exception:s}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,n;this.Jr=[],this.Kr=new kg([new Og,new Hg,new Fg,new Ag,new jg,new Lg,new Mg,new Ug],function(r){for(var s=arguments.length,i=new Array(s>1?s-1:0),o=1;s>o;o++)i[o-1]=arguments[o];return function(a,l){l===void 0&&(l=0);for(var c=[],u=a.split(`
|
|
16
|
-
`),d=l;u.length>d;d++){var p=u[d];if(1024>=p.length){var f=xa.test(p)?p.replace(xa,"$1"):p;if(!f.match(/\S*Error: /)){for(var g of i){var _=g(f,r);if(_){c.push(_);break}}if(c.length>=50)break}}}return function(P){if(!P.length)return[];var m=Array.from(P);return m.reverse(),m.slice(0,50).map(b=>{return T({},b,{filename:b.filename||(C=m,C[C.length-1]||{}).filename,function:b.function||en});var C})}(c)}}("web:javascript",Pg,Rg)),this._instance=t,this.Jr=(e=(n=this._instance.persistence)==null?void 0:n.get_property(di))!==null&&e!==void 0?e:[]}onRemoteConfig(t){var e,n,r;if("errorTracking"in t){var s=(e=(n=t.errorTracking)==null?void 0:n.suppressionRules)!==null&&e!==void 0?e:[],i=(r=t.errorTracking)==null?void 0:r.captureExtensionExceptions;this.Jr=s,this._instance.persistence&&this._instance.persistence.register({[di]:this.Jr,[Ca]:i})}}get Xr(){var t,e=!!this._instance.get_property(Ca),n=this._instance.config.error_tracking.captureExtensionExceptions;return(t=n??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.Kr.buildFromUnknown(t,{syntheticException:e==null?void 0:e.syntheticException,mechanism:{handled:e==null?void 0:e.handled}})}sendExceptionEvent(t){var e=t.$exception_list;if(this.Qr(e)){if(this.Zr(e))return void Ms.info("Skipping exception capture because a suppression rule matched");if(!this.Xr&&this.ts(e))return void Ms.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.es(e))return void Ms.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",Ui:!0})}Zr(t){if(t.length===0)return!1;var e=t.reduce((n,r)=>{var{type:s,value:i}=r;return fe(s)&&s.length>0&&n.$exception_types.push(s),fe(i)&&i.length>0&&n.$exception_values.push(i),n},{$exception_types:[],$exception_values:[]});return this.Jr.some(n=>{var r=n.values.map(s=>{var i,o=Mu[s.operator],a=Y(s.value)?s.value:[s.value],l=(i=e[s.key])!==null&&i!==void 0?i:[];return a.length>0&&o(a,l)});return n.type==="OR"?r.some(Boolean):r.every(Boolean)})}ts(t){return t.flatMap(e=>{var n,r;return(n=(r=e.stacktrace)==null?void 0:r.frames)!==null&&n!==void 0?n:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}es(t){if(t.length>0){var e,n,r,s,i=(e=(n=t[0].stacktrace)==null?void 0:n.frames)!==null&&e!==void 0?e:[],o=i[i.length-1];return(r=o==null||(s=o.filename)==null?void 0:s.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}Qr(t){return!G(t)&&Y(t)}}},Kv=T({productTours:class{get Wt(){return this._instance.persistence}constructor(t){this.rs=null,this.ss=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this.Wt&&this.Wt.register({[Ra]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,e;this.rs||(t=this._instance).config.disable_product_tours||(e=t.persistence)==null||!e.get_property(Ra)||this.Y(()=>this.ns())}Y(t){var e,n;(e=M.__PosthogExtensions__)!=null&&e.generateProductTours?t():(n=M.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",r=>{r?_l.error("Could not load product tours script",r):t()})}ns(){var t;!this.rs&&(t=M.__PosthogExtensions__)!=null&&t.generateProductTours&&(this.rs=M.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(e===void 0&&(e=!1),!Y(this.ss)||e){var n=this.Wt;if(n){var r=n.props[Os];if(Y(r)&&!e)return this.ss=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:s=>{var i=s.statusCode;if(i!==200||!s.json){var o="Product Tours API could not be loaded, status: "+i;return _l.error(o),void t([],{isLoaded:!1,error:o})}var a=Y(s.json.product_tours)?s.json.product_tours:[];this.ss=a,n&&n.register({[Os]:a}),t(a,{isLoaded:!0})}})}else t(this.ss,{isLoaded:!0})}getActiveProductTours(t){G(this.rs)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.rs.getActiveProductTours(t)}showProductTour(t){var e;(e=this.rs)==null||e.showTourById(t)}previewTour(t){this.rs?this.rs.previewTour(t):this.Y(()=>{var e;this.ns(),(e=this.rs)==null||e.previewTour(t)})}dismissProductTour(){var t;(t=this.rs)==null||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.rs)==null||t.nextStep()}previousStep(){var t;(t=this.rs)==null||t.previousStep()}clearCache(){var t;this.ss=null,(t=this.Wt)==null||t.unregister(Os)}resetTour(t){var e;(e=this.rs)==null||e.resetTour(t)}resetAllTours(){var t;(t=this.rs)==null||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.rs)==null||e.cancelPendingTour(t)}}},rs),Jv={siteApps:class{constructor(t){this._instance=t,this.os=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ls(t,e){if(e){var n=this.globalsForEvent(e);this.os.push(n),this.os.length>1e3&&(this.os=this.os.slice(10))}}get siteAppLoaders(){var t;return(t=M._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.ls.bind(this));this.us=()=>{t(),this.os=[],this.us=void 0}}}globalsForEvent(t){var e,n,r,s,i,o,a;if(!t)throw new Error("Event payload is required");var l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var[d,p]of Object.entries(u))l[d]={id:c[d],type:d,properties:p};var{$set_once:f,$set:g}=t;return{event:T({},zc(t,Uv),{properties:T({},t.properties,g?{$set:T({},(e=(n=t.properties)==null?void 0:n.$set)!==null&&e!==void 0?e:{},g)}:{},f?{$set_once:T({},(r=(s=t.properties)==null?void 0:s.$set_once)!==null&&r!==void 0?r:{},f)}:{}),elements_chain:(i=(o=t.properties)==null?void 0:o.$elements_chain)!==null&&i!==void 0?i:"",distinct_id:(a=t.properties)==null?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(t){var e=this.apps[t.id],n=()=>{var o;!e.errored&&this.os.length&&(ct.info("Processing "+this.os.length+" events for site app with id "+t.id),this.os.forEach(a=>e.processEvent==null?void 0:e.processEvent(a)),e.processedBuffer=!0),Object.values(this.apps).every(a=>a.processedBuffer||a.errored)&&((o=this.us)==null||o.call(this))},r=!1,s=o=>{e.errored=!o,e.loaded=!0,ct.info("Site app with id "+t.id+" "+(o?"loaded":"errored")),r&&n()};try{var{processEvent:i}=t.init({posthog:this._instance,callback(o){s(o)}});i&&(e.processEvent=i),r=!0}catch(o){ct.error(gl+t.id,o),s(!1)}if(r&&e.loaded)try{n()}catch(o){ct.error("Error while processing buffered events PostHog app with config id "+t.id,o),e.errored=!0}}hs(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of t)this.setupSiteApp(n)}ds(t){if(Object.keys(this.apps).length!==0){var e=this.globalsForEvent(t);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(e)}catch(r){ct.error("Error while processing event "+t.event+" for site app "+n.id,r)}}}onRemoteConfig(t){var e,n,r,s=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.hs(),void this._instance.on("eventCaptured",l=>this.ds(l))):void ct.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.us)==null||n.call(this),(r=t.siteApps)!=null&&r.length)if(this.isEnabled){var i=function(l){var c;M["__$$ph_site_app_"+l]=s._instance,(c=M.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(s._instance,a,u=>{if(u)return ct.error(gl+l,u)})};for(var{id:o,url:a}of t.siteApps)i(o)}else ct.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Xv={tracingHeaders:class{constructor(t){this.vs=void 0,this.cs=void 0,this.jr=()=>{var e,n;O(this.vs)&&((e=M.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),O(this.cs)&&((n=M.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}initialize(){this.startIfEnabledOrStop()}Y(t){var e,n;(e=M.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns&&t(),(n=M.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",r=>{if(r)return Lv.error("failed to load script",r);t()})}startIfEnabledOrStop(){var t,e;this._instance.config.__add_tracing_headers?this.Y(this.jr):((t=this.vs)==null||t.call(this),(e=this.cs)==null||e.call(this),this.vs=void 0,this.cs=void 0)}}},Zv=T({surveys:class{get N(){return this._instance.config}constructor(t){this.fs=void 0,this._surveyManager=null,this.ps=!1,this._s=[],this.gs=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.N.disable_surveys){var e=t.surveys;if(G(e))return Q.warn("Flags not loaded yet. Not loading surveys.");var n=Y(e);this.fs=n?e.length>0:e,Q.info("flags response received, isSurveysEnabled: "+this.fs),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],e=0;e<localStorage.length;e++){var n=localStorage.key(e);(n!=null&&n.startsWith(Ti)||n!=null&&n.startsWith("inProgressSurvey_"))&&t.push(n)}t.forEach(r=>localStorage.removeItem(r))}loadIfEnabled(){if(!this._surveyManager)if(this.ps)Q.info("Already initializing surveys, skipping...");else if(this.N.disable_surveys)Q.info(vl);else if(this.N.cookieless_mode&&this._instance.consent.isOptedOut())Q.info("Not loading surveys in cookieless mode without consent.");else{var t=M==null?void 0:M.__PosthogExtensions__;if(t){if(!O(this.fs)||this.N.advanced_enable_surveys){var e=this.fs||this.N.advanced_enable_surveys;this.ps=!0;try{var n=t.generateSurveys;if(n)return void this.bs(n,e);var r=t.loadExternalDependency;if(!r)return void this.ys(ro);r(this._instance,"surveys",s=>{s||!t.generateSurveys?this.ys("Could not load surveys script",s):this.bs(t.generateSurveys,e)})}catch(s){throw this.ys("Error initializing surveys",s),s}finally{this.ps=!1}}}else Q.error("PostHog Extensions not found.")}}bs(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new zv(this._instance),Q.info("Surveys loaded successfully"),this.ws({isLoaded:!0})}ys(t,e){Q.error(t,e),this.ws({isLoaded:!1,error:t})}onSurveysLoaded(t){return this._s.push(t),this._surveyManager&&this.ws({isLoaded:!0}),()=>{this._s=this._s.filter(e=>e!==t)}}getSurveys(t,e){if(e===void 0&&(e=!1),this.N.disable_surveys)return Q.info(vl),t([]);var n,r=this._instance.get_property(pi);if(r&&!e)return t(r,{isLoaded:!0});typeof Promise<"u"&&this.gs?this.gs.then(s=>{var{surveys:i,context:o}=s;return t(i,o)}):(typeof Promise<"u"&&(this.gs=new Promise(s=>{n=s})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.N.token),method:"GET",timeout:this.N.surveys_request_timeout_ms,callback:s=>{var i;this.gs=null;var o=s.statusCode;if(o!==200||!s.json){var a="Surveys API could not be loaded, status: "+o;Q.error(a);var l={isLoaded:!1,error:a};return t([],l),void(n==null||n({surveys:[],context:l}))}var c,u=s.json.surveys||[],d=u.filter(f=>function(g){return!(!g.start_date||g.end_date)}(f)&&(function(g){var _;return!((_=g.conditions)==null||(_=_.events)==null||(_=_.values)==null||!_.length)}(f)||function(g){var _;return!((_=g.conditions)==null||(_=_.actions)==null||(_=_.values)==null||!_.length)}(f)));d.length>0&&((c=this._surveyEventReceiver)==null||c.register(d)),(i=this._instance.persistence)==null||i.register({[pi]:u});var p={isLoaded:!0};t(u,p),n==null||n({surveys:u,context:p})}}))}ws(t){for(var e of this._s)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(n){Q.error("Error in survey callback",n)}}getActiveMatchingSurveys(t,e){if(e===void 0&&(e=!1),!G(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Q.warn("init was not called")}Es(t){var e=null;return this.getSurveys(n=>{var r;e=(r=n.find(s=>s.id===t))!==null&&r!==void 0?r:null}),e}Ss(t){if(G(this._surveyManager))return{eligible:!1,reason:As};var e=typeof t=="string"?this.Es(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(G(this._surveyManager))return Q.warn("init was not called"),{visible:!1,disabledReason:As};var e=this.Ss(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return G(this._surveyManager)?(Q.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:As})):new Promise(n=>{this.getSurveys(r=>{var s,i=(s=r.find(a=>a.id===t))!==null&&s!==void 0?s:null;if(i){var o=this.Ss(i);n({visible:o.eligible,disabledReason:o.reason})}else n({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(t,e,n){var r;if(G(this._surveyManager))Q.warn("init was not called");else{var s=typeof t=="string"?this.Es(t):t;if(s!=null&&s.id)if(Sv.includes(s.type)){var i=$==null?void 0:$.querySelector(e);if(i)return(r=s.appearance)!=null&&r.surveyPopupDelaySeconds?(Q.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var o,a;Q.info("Rendering survey "+s.id+" with delay of "+((o=s.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(s,i,n),Q.info("Survey "+s.id+" rendered")},1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,i,n);Q.warn("Survey element not found")}else Q.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Q.warn("Survey not found")}}displaySurvey(t,e){var n;if(G(this._surveyManager))Q.warn("init was not called");else{var r=this.Es(t);if(r){var s=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&e.ignoreDelay&&(s=T({},r,{appearance:T({},r.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==Ei.Popover&&e.initialResponses&&Q.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var i=this.canRenderSurvey(r);if(!i.visible)return void Q.warn("Survey is not eligible to be displayed: ",i.disabledReason)}e.displayType!==Ei.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}else Q.warn("Survey not found")}}cancelPendingSurvey(t){G(this._surveyManager)?Q.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;(t=this._surveyManager)==null||t.handlePageUnload()}}},rs),Qv={toolbar:class{constructor(t){this.instance=t}xs(t){M.ph_toolbar_state=t}Ts(){var t;return(t=M.ph_toolbar_state)!==null&&t!==void 0?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,n){if(t===void 0&&(t=void 0),e===void 0&&(e=void 0),n===void 0&&(n=void 0),vu(this.instance.config)||!v||!$)return!1;t=t??v.location,n=n??v.history;try{if(!e){try{v.localStorage.setItem("test","test"),v.localStorage.removeItem("test")}catch{return!1}e=v==null?void 0:v.localStorage}var r,s=Wv||Fr(t.hash,"__posthog")||Fr(t.hash,"state"),i=s?Fa(()=>JSON.parse(atob(decodeURIComponent(s))))||Fa(()=>JSON.parse(decodeURIComponent(s))):null;return i&&i.action==="ph_authorize"?((r=i).source="url",r&&Object.keys(r).length>0&&(i.desiredHash?t.hash=i.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(e.getItem(ml)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}$s(t){var e=M.ph_load_toolbar||M.ph_load_editor;!G(e)&&Ke(e)?e(t,this.instance):yl.warn("No toolbar load function found")}loadToolbar(t){var e=!($==null||!$.getElementById(gu));if(!v||e)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=T({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(v.localStorage.setItem(ml,JSON.stringify(T({},r,{source:void 0}))),this.Ts()===2)this.$s(r);else if(this.Ts()===0){var s;this.xs(1),(s=M.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",i=>{if(i)return yl.error("[Toolbar] Failed to load",i),void this.xs(0);this.xs(2),this.$s(r)}),he(v,"turbolinks:load",()=>{this.xs(0),this.loadToolbar(r)})}return!0}ks(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,n){return t===void 0&&(t=void 0),e===void 0&&(e=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(t,e,n)}}},em=T({experiments:be},rs),tm={conversations:class{constructor(t){this.Rs=void 0,this._conversationsManager=null,this.Ps=!1,this.Os=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;G(e)||(Xe(e)?this.Rs=e:(this.Rs=e.enabled,this.Os=e),this.loadIfEnabled())}}reset(){var t;(t=this._conversationsManager)==null||t.reset(),this._conversationsManager=null,this.Rs=void 0,this.Os=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ps||this._instance.config.disable_conversations||vu(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=M==null?void 0:M.__PosthogExtensions__;if(t&&!O(this.Rs)&&this.Rs)if(this.Os&&this.Os.token){this.Ps=!0;try{var e=t.initConversations;if(e)return this.Is(e),void(this.Ps=!1);var n=t.loadExternalDependency;if(!n)return void this.Cs(ro);n(this._instance,"conversations",r=>{r||!t.initConversations?this.Cs("Could not load conversations script",r):this.Is(t.initConversations),this.Ps=!1})}catch(r){this.Cs("Error initializing conversations",r),this.Ps=!1}}else Ae.error("Conversations enabled but missing token in remote config.")}}Is(t){if(this.Os)try{this._conversationsManager=t(this.Os,this._instance),Ae.info("Conversations loaded successfully")}catch(e){this.Cs("Error completing conversations initialization",e)}else Ae.error("Cannot complete initialization: remote config is null")}Cs(t,e){Ae.error(t,e),this._conversationsManager=null,this.Ps=!1}show(){this._conversationsManager?this._conversationsManager.show():Ae.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Rs===!0&&!rt(this._conversationsManager)}isVisible(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&t!==void 0&&t}sendMessage(t,e,n){var r=this;return De(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,e,n):(Ae.warn(wt),null)})()}getMessages(t,e){var n=this;return De(function*(){return n._conversationsManager?n._conversationsManager.getMessages(t,e):(Ae.warn(wt),null)})()}markAsRead(t){var e=this;return De(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Ae.warn(wt),null)})()}getTickets(t){var e=this;return De(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Ae.warn(wt),null)})()}requestRestoreLink(t){var e=this;return De(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Ae.warn(wt),null)})()}restoreFromToken(t){var e=this;return De(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Ae.warn(wt),null)})()}restoreFromUrlToken(){var t=this;return De(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Ae.warn(wt),null)})()}getCurrentTicketId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&t!==void 0?t:null}getWidgetSessionId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&t!==void 0?t:null}}},nm={logs:class{constructor(t){var e;this.Fs=!1,this.As=!1,this._instance=t,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.Fs=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,n=(e=t.logs)==null?void 0:e.captureConsoleLogs;!G(n)&&n&&(this.Fs=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.Fs&&!this.As){var t=oe("[logs]"),e=M==null?void 0:M.__PosthogExtensions__;if(e){var n=e.loadExternalDependency;n?n(this._instance,"logs",r=>{var s;r||(s=e.logs)==null||!s.initializeLogs?t.error("Could not load logs script",r):(e.logs.initializeLogs(this._instance),this.As=!0)}):t.error(ro)}else t.error("PostHog Extensions not found.")}}}},rm=T({},rs,Gv,Vv,Yv,Kv,Jv,Zv,Xv,Qv,em,tm,nm);Be.__defaultExtensionClasses=T({},rm);var xl,_t=(xl=Cn[Ht]=new Be,function(){function t(){t.done||(t.done=!0,ju=!1,te(Cn,function(e){e._dom_loaded()}))}$!=null&&$.addEventListener?$.readyState==="complete"?t():he($,"DOMContentLoaded",t,{capture:!1}):v&&R.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),xl),jn,ue,Ds,Il,Ur=0,Yu=[],pe=re,Tl=pe.__b,Pl=pe.__r,Cl=pe.diffed,$l=pe.__c,Rl=pe.unmount,Ol=pe.__;function uo(t,e){pe.__h&&pe.__h(ue,t,Ur||e),Ur=0;var n=ue.__H||(ue.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function W(t){return Ur=1,sm(Ju,t)}function sm(t,e,n){var r=uo(jn++,2);if(r.t=t,!r.__c&&(r.__=[Ju(void 0,e),function(a){var l=r.__N?r.__N[0]:r.__[0],c=r.t(l,a);l!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=ue,!ue.__f)){var s=function(a,l,c){if(!r.__c.__H)return!0;var u=r.__c.__H.__.filter(function(p){return p.__c});if(u.every(function(p){return!p.__N}))return!i||i.call(this,a,l,c);var d=r.__c.props!==a;return u.some(function(p){if(p.__N){var f=p.__[0];p.__=p.__N,p.__N=void 0,f!==p.__[0]&&(d=!0)}}),i&&i.call(this,a,l,c)||d};ue.__f=!0;var i=ue.shouldComponentUpdate,o=ue.componentWillUpdate;ue.componentWillUpdate=function(a,l,c){if(this.__e){var u=i;i=void 0,s(a,l,c),i=u}o&&o.call(this,a,l,c)},ue.shouldComponentUpdate=s}return r.__N||r.__}function rn(t,e){var n=uo(jn++,3);!pe.__s&&Ku(n.__H,e)&&(n.__=t,n.u=e,ue.__H.__h.push(n))}function im(t,e){var n=uo(jn++,7);return Ku(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function pt(t,e){return Ur=8,im(function(){return t},e)}function om(){for(var t;t=Yu.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(_r),e.__h.some(Oi),e.__h=[]}catch(n){e.__h=[],pe.__e(n,t.__v)}}}pe.__b=function(t){ue=null,Tl&&Tl(t)},pe.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Ol&&Ol(t,e)},pe.__r=function(t){Pl&&Pl(t),jn=0;var e=(ue=t.__c).__H;e&&(Ds===ue?(e.__h=[],ue.__h=[],e.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.some(_r),e.__h.some(Oi),e.__h=[],jn=0)),Ds=ue},pe.diffed=function(t){Cl&&Cl(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Yu.push(e)!==1&&Il===pe.requestAnimationFrame||((Il=pe.requestAnimationFrame)||am)(om)),e.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),Ds=ue=null},pe.__c=function(t,e){e.some(function(n){try{n.__h.some(_r),n.__h=n.__h.filter(function(r){return!r.__||Oi(r)})}catch(r){e.some(function(s){s.__h&&(s.__h=[])}),e=[],pe.__e(r,n.__v)}}),$l&&$l(t,e)},pe.unmount=function(t){Rl&&Rl(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.some(function(r){try{_r(r)}catch(s){e=s}}),n.__H=void 0,e&&pe.__e(e,n.__v))};var Al=typeof requestAnimationFrame=="function";function am(t){var e,n=function(){clearTimeout(r),Al&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,35);Al&&(e=requestAnimationFrame(n))}function _r(t){var e=ue,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),ue=e}function Oi(t){var e=ue;t.__c=t.__(),ue=e}function Ku(t,e){return!t||t.length!==e.length||e.some(function(n,r){return n!==t[r]})}function Ju(t,e){return typeof e=="function"?e(t):e}const lm="";async function ie(t,e,n){const r={method:t,headers:{"Content-Type":"application/json"},credentials:"include"};n&&(r.body=JSON.stringify(n));const s=await fetch(lm+e,r);if(s.status===401)return{status:401,data:null,unauthorized:!0};const i=await s.json().catch(()=>null);return{status:s.status,data:i}}async function cm(){try{const e=await(await fetch("/api/auth/sign-in/social",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({provider:"google",callbackURL:"/dashboard"})})).json().catch(()=>null);if(e!=null&&e.url){window.location.href=e.url;return}}catch{}window.location.href="/api/auth/sign-in/social?provider=google&callbackURL=/dashboard"}function Hr({text:t,label:e="Copy"}){const[n,r]=W(!1);return h("button",{class:"btn-copy",onClick:()=>{navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)}},n?"✓ Copied!":e)}function Br(t){if(!t)return"never";const e=Math.floor((Date.now()-t)/1e3);return e<60?`${e}s ago`:e<3600?`${Math.floor(e/60)}m ago`:e<86400?`${Math.floor(e/3600)}h ago`:`${Math.floor(e/86400)}d ago`}function um(){var z,ee,V,le;const[t,e]=W(!0),[n,r]=W(null),[s,i]=W([]),[o,a]=W([]),[l,c]=W(null),[u,d]=W(null),[p,f]=W(null),[g,_]=W("start"),[P,m]=W(!1),[b,C]=W(!1),[x,S]=W(!1),[k,w]=W(!1),E=pt(async()=>{var y;const D=await ie("GET","/v1/me");if(D!=null&&D.unauthorized){w(!0);return}D!=null&&D.data&&(r(D.data),(y=D.data.user)!=null&&y.email&&(_t.identify(D.data.user.id||D.data.user.email,{email:D.data.user.email,name:D.data.user.name}),_t.capture("dashboard_sign_in")))},[]),I=pt(async()=>{var y;const D=await ie("GET","/v1/api-keys");D&&i(((y=D.data)==null?void 0:y.api_keys)||[])},[]),A=pt(async()=>{var y;const D=await ie("GET","/v1/browser-sessions");D&&a(((y=D.data)==null?void 0:y.sessions)||[])},[]),j=pt(async()=>{const D=await ie("GET","/v1/usage");D&&c(D.data)},[]),F=pt(async()=>{const D=await ie("GET","/v1/billing/credits");D&&d(D.data)},[]);if(rn(()=>{Promise.all([E(),I(),A(),j(),F()]).then(()=>e(!1));const D=setInterval(A,5e3);return()=>clearInterval(D)},[]),rn(()=>{const D=y=>{var X,de;((X=y.data)==null?void 0:X.type)==="HANZI_EXTENSION_READY"&&m(!0),((de=y.data)==null?void 0:de.type)==="HANZI_PAIR_RESULT"&&(C(!1),y.data.success?(S(!0),A()):f("Pairing failed: "+(y.data.error||"unknown")))};return window.addEventListener("message",D),window.postMessage({type:"HANZI_PING"},"*"),()=>window.removeEventListener("message",D)},[]),t)return h(Nl,null);if(k)return cm(),h(Nl,null);const H=((ee=(z=n==null?void 0:n.user)==null?void 0:z.name)==null?void 0:ee.split(" ")[0])||"there",B=(V=n==null?void 0:n.user)!=null&&V.name?`${n.user.name}'s workspace`:"Your workspace",K=s.length>0,Z=o.find(D=>D.status==="connected"),N=!!Z||x;return h("div",{class:"page"},h("div",{class:"header"},h("div",null,h("h1",null,B),h("div",{class:"subtitle"},"Hi, ",H)),h("div",{style:{display:"flex",alignItems:"center",gap:12}},u&&h("div",{style:{textAlign:"right",fontSize:13,color:"var(--muted)"}},h("div",null,h("strong",{style:{color:"var(--ink)",fontSize:16}},(u.free_remaining||0)+(u.credit_balance||0))," tasks left"),h("div",null,u.free_remaining||0," free + ",u.credit_balance||0," credits")),h("button",{class:"signout",onClick:vm},"Sign out"))),h("div",{class:"tabs"},h("button",{class:`tab ${g==="start"?"active":""}`,onClick:()=>_("start")},"Getting Started"),h("button",{class:`tab ${g==="sessions"?"active":""}`,onClick:()=>_("sessions")},"Sessions",o.length>0&&h("span",{class:"tab-count"},o.filter(D=>D.status==="connected").length)),h("button",{class:`tab ${g==="settings"?"active":""}`,onClick:()=>_("settings")},"Settings")),g==="start"&&h(dm,{keys:s,loadKeys:I,setError:f,extensionReady:P,pairing:b,paired:x,setPairing:C,setPaired:S,hasKeys:K,hasConnected:N,connectedSession:Z,sessions:o,loadSessions:A,loadUsage:j,setTab:_}),g==="sessions"&&h(pm,{sessions:o,onRefresh:A,usage:l}),g==="settings"&&h(fm,{keys:s,loadKeys:I,setError:f,profile:n,credits:u,loadCredits:F}),g==="automations"&&h(gm,{sessions:o,workspaceId:(le=n==null?void 0:n.workspace)==null?void 0:le.id,setError:f}),p&&h("div",{class:"error-toast",onClick:()=>f(null)},p))}function dm({keys:t,loadKeys:e,setError:n,extensionReady:r,pairing:s,paired:i,setPairing:o,setPaired:a,hasKeys:l,hasConnected:c,connectedSession:u,sessions:d,loadSessions:p,loadUsage:f,setTab:g}){var Z;const[_,P]=W(""),[m,b]=W(null),[C,x]=W("Go to example.com and tell me the page title"),[S,k]=W(null),[w,E]=W(""),[I,A]=W(0),j=S==="complete",F=async()=>{var z;if(!_.trim())return;const N=await ie("POST","/v1/api-keys",{name:_.trim()});(N==null?void 0:N.status)===201?(b(N.data.key),P(""),await e()):n(((z=N==null?void 0:N.data)==null?void 0:z.error)||"Failed")},H=async()=>{var z;o(!0),_t.capture("connect_browser_clicked");const N=await ie("POST","/v1/browser-sessions/pair",{label:"Developer testing"});if(!N||N.status!==201){o(!1),n(((z=N==null?void 0:N.data)==null?void 0:z.error)||"Failed");return}window.postMessage({type:"HANZI_PAIR",token:N.data.pairing_token,apiUrl:location.origin},"*"),setTimeout(()=>o(ee=>ee&&(n("Extension did not respond."),!1)),5e3)},B=async()=>{var le,D,y,X,de,ye;const N=(u==null?void 0:u.id)||((le=d.find(xe=>xe.status==="connected"))==null?void 0:le.id);if(!C.trim())return;if(!N){k("error"),E("No connected browser session found. Try refreshing the page.");return}k("running"),E(""),A(0),_t.capture("test_task_run");const z=await ie("POST","/v1/tasks",{task:C.trim(),browser_session_id:N});if(!z||z.status!==201){k("error"),E(((D=z==null?void 0:z.data)==null?void 0:D.error)||"Failed");return}const ee=z.data.id,V=Date.now()+3*60*1e3;for(;Date.now()<V;){await new Promise(Pe=>setTimeout(Pe,2e3));const xe=await ie("GET",`/v1/tasks/${ee}`);if(!xe)break;if(A(((y=xe.data)==null?void 0:y.steps)||0),((X=xe.data)==null?void 0:X.status)!=="running"){k(((de=xe.data)==null?void 0:de.status)||"error"),E(((ye=xe.data)==null?void 0:ye.answer)||"No answer."),f();return}}k("error"),E("Timed out after 3 minutes.")},K=`Add browser automation to this project using the Hanzi API. Read the codebase first, then ask me:
|
|
7
|
+
`),typeof a=="string"||a instanceof Uint8Array)s(a);else{let l;try{l=JSON.stringify(a)}catch{l=JSON.stringify(Ye(a))}s(l)}}return typeof r=="string"?r:Dh(r)}function Dh(t){const e=t.reduce((s,i)=>s+i.length,0),n=new Uint8Array(e);let r=0;for(const s of t)n.set(s,r),r+=s.length;return n}function Lh(t){const e=typeof t.data=="string"?Gs(t.data):t.data;return[{type:"attachment",length:e.length,filename:t.filename,content_type:t.contentType,attachment_type:t.attachmentType},e]}const gc={sessions:"session",event:"error",client_report:"internal",user_report:"default",profile_chunk:"profile",replay_event:"replay",replay_recording:"replay",check_in:"monitor",raw_security:"security",log:"log_item",trace_metric:"metric"};function jh(t){return t in gc}function zo(t){return jh(t)?gc[t]:t}function vc(t){if(!(t!=null&&t.sdk))return;const{name:e,version:n}=t.sdk;return{name:e,version:n}}function Uh(t,e,n,r){var i;const s=(i=t.sdkProcessingMetadata)==null?void 0:i.dynamicSamplingContext;return{event_id:t.event_id,sent_at:new Date().toISOString(),...e&&{sdk:e},...!!n&&r&&{dsn:zn(r)},...s&&{trace:s}}}function Hh(t,e){var r,s,i,o;if(!e)return t;const n=t.sdk||{};return t.sdk={...n,name:n.name||e.name,version:n.version||e.version,integrations:[...((r=t.sdk)==null?void 0:r.integrations)||[],...e.integrations||[]],packages:[...((s=t.sdk)==null?void 0:s.packages)||[],...e.packages||[]],settings:(i=t.sdk)!=null&&i.settings||e.settings?{...(o=t.sdk)==null?void 0:o.settings,...e.settings}:void 0},t}function Bh(t,e,n,r){const s=vc(n),i={sent_at:new Date().toISOString(),...s&&{sdk:s},...!!r&&e&&{dsn:zn(e)}},o="aggregates"in t?[{type:"sessions"},t]:[{type:"session"},t.toJSON()];return ln(i,[o])}function zh(t,e,n,r){const s=vc(n),i=t.type&&t.type!=="replay_event"?t.type:"event";Hh(t,n==null?void 0:n.sdk);const o=Uh(t,s,r,e);return delete t.sdkProcessingMetadata,ln(o,[[{type:i},t]])}const us=0,Wo=1,qo=2;function Wn(t){return new On(e=>{e(t)})}function Gi(t){return new On((e,n)=>{n(t)})}class On{constructor(e){this._state=us,this._handlers=[],this._runExecutor(e)}then(e,n){return new On((r,s)=>{this._handlers.push([!1,i=>{if(!e)r(i);else try{r(e(i))}catch(o){s(o)}},i=>{if(!n)s(i);else try{r(n(i))}catch(o){s(o)}}]),this._executeHandlers()})}catch(e){return this.then(n=>n,e)}finally(e){return new On((n,r)=>{let s,i;return this.then(o=>{i=!1,s=o,e&&e()},o=>{i=!0,s=o,e&&e()}).then(()=>{if(i){r(s);return}n(s)})})}_executeHandlers(){if(this._state===us)return;const e=this._handlers.slice();this._handlers=[],e.forEach(n=>{n[0]||(this._state===Wo&&n[1](this._value),this._state===qo&&n[2](this._value),n[0]=!0)})}_runExecutor(e){const n=(i,o)=>{if(this._state===us){if(Un(o)){o.then(r,s);return}this._state=i,this._value=o,this._executeHandlers()}},r=i=>{n(Wo,i)},s=i=>{n(qo,i)};try{e(r,s)}catch(i){s(i)}}}function Wh(t,e,n,r=0){try{const s=Vs(e,n,t,r);return Un(s)?s:Wn(s)}catch(s){return Gi(s)}}function Vs(t,e,n,r){const s=n[r];if(!t||!s)return t;const i=s({...t},e);return U&&i===null&&L.log(`Event processor "${s.id||"?"}" dropped event`),Un(i)?i.then(o=>Vs(o,e,n,r+1)):Vs(i,e,n,r+1)}let qe,Go,Vo,ot;function qh(t){const e=J._sentryDebugIds,n=J._debugIds;if(!e&&!n)return{};const r=e?Object.keys(e):[],s=n?Object.keys(n):[];if(ot&&r.length===Go&&s.length===Vo)return ot;Go=r.length,Vo=s.length,ot={},qe||(qe={});const i=(o,a)=>{for(const l of o){const c=a[l],u=qe==null?void 0:qe[l];if(u&&ot&&c)ot[u[0]]=c,qe&&(qe[l]=[u[0],c]);else if(c){const d=t(l);for(let p=d.length-1;p>=0;p--){const f=d[p],g=f==null?void 0:f.filename;if(g&&ot&&qe){ot[g]=c,qe[l]=[g,c];break}}}}};return e&&i(r,e),n&&i(s,n),ot}function Gh(t,e){const{fingerprint:n,span:r,breadcrumbs:s,sdkProcessingMetadata:i}=e;Vh(t,e),r&&Jh(t,r),Xh(t,n),Yh(t,s),Kh(t,i)}function Yo(t,e){const{extra:n,tags:r,attributes:s,user:i,contexts:o,level:a,sdkProcessingMetadata:l,breadcrumbs:c,fingerprint:u,eventProcessors:d,attachments:p,propagationContext:f,transactionName:g,span:_}=e;cn(t,"extra",n),cn(t,"tags",r),cn(t,"attributes",s),cn(t,"user",i),cn(t,"contexts",o),t.sdkProcessingMetadata=Bn(t.sdkProcessingMetadata,l,2),a&&(t.level=a),g&&(t.transactionName=g),_&&(t.span=_),c.length&&(t.breadcrumbs=[...t.breadcrumbs,...c]),u.length&&(t.fingerprint=[...t.fingerprint,...u]),d.length&&(t.eventProcessors=[...t.eventProcessors,...d]),p.length&&(t.attachments=[...t.attachments,...p]),t.propagationContext={...t.propagationContext,...f}}function cn(t,e,n){t[e]=Bn(t[e],n,1)}function mc(t,e){const n=qd().getScopeData();return t&&Yo(n,t.getScopeData()),e&&Yo(n,e.getScopeData()),n}function Vh(t,e){const{extra:n,tags:r,user:s,contexts:i,level:o,transactionName:a}=e;Object.keys(n).length&&(t.extra={...n,...t.extra}),Object.keys(r).length&&(t.tags={...r,...t.tags}),Object.keys(s).length&&(t.user={...s,...t.user}),Object.keys(i).length&&(t.contexts={...i,...t.contexts}),o&&(t.level=o),a&&t.type!=="transaction"&&(t.transaction=a)}function Yh(t,e){const n=[...t.breadcrumbs||[],...e];t.breadcrumbs=n.length?n:void 0}function Kh(t,e){t.sdkProcessingMetadata={...t.sdkProcessingMetadata,...e}}function Jh(t,e){t.contexts={trace:gh(e),...t.contexts},t.sdkProcessingMetadata={dynamicSamplingContext:Ph(e),...t.sdkProcessingMetadata};const n=pc(e),r=Wi(n).description;r&&!t.transaction&&t.type==="transaction"&&(t.transaction=r)}function Xh(t,e){t.fingerprint=t.fingerprint?Array.isArray(t.fingerprint)?t.fingerprint:[t.fingerprint]:[],e&&(t.fingerprint=t.fingerprint.concat(e)),t.fingerprint.length||delete t.fingerprint}function Zh(t,e,n,r,s,i){const{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=t,l={...e,event_id:e.event_id||n.event_id||Fe(),timestamp:e.timestamp||Hn()},c=n.integrations||t.integrations.map(m=>m.name);Qh(l,t),np(l,c),s&&s.emit("applyFrameMetadata",e),e.type===void 0&&ep(l,t.stackParser);const u=sp(r,n.captureContext);n.mechanism&&Yt(l,n.mechanism);const d=s?s.getEventProcessors():[],p=mc(i,u),f=[...n.attachments||[],...p.attachments];f.length&&(n.attachments=f),Gh(l,p);const g=[...d,...p.eventProcessors];return(n.data&&n.data.__sentry__===!0?Wn(l):Wh(g,l,n)).then(m=>(m&&tp(m),typeof o=="number"&&o>0?rp(m,o,a):m))}function Qh(t,e){var a,l;const{environment:n,release:r,dist:s,maxValueLength:i}=e;t.environment=t.environment||n||qi,!t.release&&r&&(t.release=r),!t.dist&&s&&(t.dist=s);const o=t.request;o!=null&&o.url&&i&&(o.url=Hs(o.url,i)),i&&((l=(a=t.exception)==null?void 0:a.values)==null||l.forEach(c=>{c.value&&(c.value=Hs(c.value,i))}))}function ep(t,e){var r,s;const n=qh(e);(s=(r=t.exception)==null?void 0:r.values)==null||s.forEach(i=>{var o,a;(a=(o=i.stacktrace)==null?void 0:o.frames)==null||a.forEach(l=>{l.filename&&(l.debug_id=n[l.filename])})})}function tp(t){var r,s;const e={};if((s=(r=t.exception)==null?void 0:r.values)==null||s.forEach(i=>{var o,a;(a=(o=i.stacktrace)==null?void 0:o.frames)==null||a.forEach(l=>{l.debug_id&&(l.abs_path?e[l.abs_path]=l.debug_id:l.filename&&(e[l.filename]=l.debug_id),delete l.debug_id)})}),Object.keys(e).length===0)return;t.debug_meta=t.debug_meta||{},t.debug_meta.images=t.debug_meta.images||[];const n=t.debug_meta.images;Object.entries(e).forEach(([i,o])=>{n.push({type:"sourcemap",code_file:i,debug_id:o})})}function np(t,e){e.length>0&&(t.sdk=t.sdk||{},t.sdk.integrations=[...t.sdk.integrations||[],...e])}function rp(t,e,n){var s,i;if(!t)return null;const r={...t,...t.breadcrumbs&&{breadcrumbs:t.breadcrumbs.map(o=>({...o,...o.data&&{data:Ye(o.data,e,n)}}))},...t.user&&{user:Ye(t.user,e,n)},...t.contexts&&{contexts:Ye(t.contexts,e,n)},...t.extra&&{extra:Ye(t.extra,e,n)}};return(s=t.contexts)!=null&&s.trace&&r.contexts&&(r.contexts.trace=t.contexts.trace,t.contexts.trace.data&&(r.contexts.trace.data=Ye(t.contexts.trace.data,e,n))),t.spans&&(r.spans=t.spans.map(o=>({...o,...o.data&&{data:Ye(o.data,e,n)}}))),(i=t.contexts)!=null&&i.flags&&r.contexts&&(r.contexts.flags=Ye(t.contexts.flags,3,n)),r}function sp(t,e){if(!e)return t;const n=t?t.clone():new tt;return n.update(e),n}function ip(t,e){return nt().captureException(t,void 0)}function yc(t,e){return nt().captureEvent(t,e)}function Ko(t){const e=At(),{user:n}=mc(e,nt()),{userAgent:r}=J.navigator||{},s=Ad({user:n,...r&&{userAgent:r},...t}),i=e.getSession();return(i==null?void 0:i.status)==="ok"&&Kt(i,{status:"exited"}),bc(),e.setSession(s),s}function bc(){const t=At(),n=nt().getSession()||t.getSession();n&&Fd(n),Ec(),t.setSession()}function Ec(){const t=At(),e=Ee(),n=t.getSession();n&&e&&e.captureSession(n)}function ds(t=!1){if(t){bc();return}Ec()}const op="7";function ap(t){const e=t.protocol?`${t.protocol}:`:"",n=t.port?`:${t.port}`:"";return`${e}//${t.host}${n}${t.path?`/${t.path}`:""}/api/`}function lp(t){return`${ap(t)}${t.projectId}/envelope/`}function cp(t,e){const n={sentry_version:op};return t.publicKey&&(n.sentry_key=t.publicKey),e&&(n.sentry_client=`${e.name}/${e.version}`),new URLSearchParams(n).toString()}function up(t,e,n){return e||`${lp(t)}?${cp(t,n)}`}const Jo=[];function dp(t){const e={};return t.forEach(n=>{const{name:r}=n,s=e[r];s&&!s.isDefaultInstance&&n.isDefaultInstance||(e[r]=n)}),Object.values(e)}function hp(t){const e=t.defaultIntegrations||[],n=t.integrations;e.forEach(s=>{s.isDefaultInstance=!0});let r;if(Array.isArray(n))r=[...e,...n];else if(typeof n=="function"){const s=n(e);r=Array.isArray(s)?s:[s]}else r=e;return dp(r)}function pp(t,e){const n={};return e.forEach(r=>{r&&wc(t,r,n)}),n}function Xo(t,e){for(const n of e)n!=null&&n.afterAllSetup&&n.afterAllSetup(t)}function wc(t,e,n){if(n[e.name]){U&&L.log(`Integration skipped because it was already installed: ${e.name}`);return}if(n[e.name]=e,!Jo.includes(e.name)&&typeof e.setupOnce=="function"&&(e.setupOnce(),Jo.push(e.name)),e.setup&&typeof e.setup=="function"&&e.setup(t),typeof e.preprocessEvent=="function"){const r=e.preprocessEvent.bind(e);t.on("preprocessEvent",(s,i)=>r(s,i,t))}if(typeof e.processEvent=="function"){const r=e.processEvent.bind(e),s=Object.assign((i,o)=>r(i,o,t),{id:e.name});t.addEventProcessor(s)}U&&L.log(`Integration installed: ${e.name}`)}function fp(t){return[{type:"log",item_count:t.length,content_type:"application/vnd.sentry.items.log+json"},{items:t}]}function _p(t,e,n,r){const s={};return e!=null&&e.sdk&&(s.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(s.dsn=zn(r)),ln(s,[fp(t)])}function Ys(t,e){const n=e??gp(t)??[];if(n.length===0)return;const r=t.getOptions(),s=_p(n,r._metadata,r.tunnel,t.getDsn());Sc().set(t,[]),t.emit("flushLogs"),t.sendEnvelope(s)}function gp(t){return Sc().get(t)}function Sc(){return sn("clientToLogBufferMap",()=>new WeakMap)}function vp(t){return[{type:"trace_metric",item_count:t.length,content_type:"application/vnd.sentry.items.trace-metric+json"},{items:t}]}function mp(t,e,n,r){const s={};return e!=null&&e.sdk&&(s.sdk={name:e.sdk.name,version:e.sdk.version}),n&&r&&(s.dsn=zn(r)),ln(s,[vp(t)])}function kc(t,e){const n=e??yp(t)??[];if(n.length===0)return;const r=t.getOptions(),s=mp(n,r._metadata,r.tunnel,t.getDsn());xc().set(t,[]),t.emit("flushMetrics"),t.sendEnvelope(s)}function yp(t){return xc().get(t)}function xc(){return sn("clientToMetricBufferMap",()=>new WeakMap)}function Ic(t){return typeof t=="object"&&typeof t.unref=="function"&&t.unref(),t}const Vi=Symbol.for("SentryBufferFullError");function Yi(t=100){const e=new Set;function n(){return e.size<t}function r(o){e.delete(o)}function s(o){if(!n())return Gi(Vi);const a=o();return e.add(a),a.then(()=>r(a),()=>r(a)),a}function i(o){if(!e.size)return Wn(!0);const a=Promise.allSettled(Array.from(e)).then(()=>!0);if(!o)return a;const l=[a,new Promise(c=>Ic(setTimeout(()=>c(!1),o)))];return Promise.race(l)}return{get $(){return Array.from(e)},add:s,drain:i}}const bp=60*1e3;function Ep(t,e=Xr()){const n=parseInt(`${t}`,10);if(!isNaN(n))return n*1e3;const r=Date.parse(`${t}`);return isNaN(r)?bp:r-e}function wp(t,e){return t[e]||t.all||0}function Sp(t,e,n=Xr()){return wp(t,e)>n}function kp(t,{statusCode:e,headers:n},r=Xr()){const s={...t},i=n==null?void 0:n["x-sentry-rate-limits"],o=n==null?void 0:n["retry-after"];if(i)for(const a of i.trim().split(",")){const[l,c,,,u]=a.split(":",5),d=parseInt(l,10),p=(isNaN(d)?60:d)*1e3;if(!c)s.all=r+p;else for(const f of c.split(";"))f==="metric_bucket"?(!u||u.split(";").includes("custom"))&&(s[f]=r+p):s[f]=r+p}else o?s.all=r+Ep(o,r):e===429&&(s.all=r+60*1e3);return s}const Tc=64;function xp(t,e,n=Yi(t.bufferSize||Tc)){let r={};const s=o=>n.drain(o);function i(o){const a=[];if(qs(o,(d,p)=>{const f=zo(p);Sp(r,f)?t.recordDroppedEvent("ratelimit_backoff",f):a.push(d)}),a.length===0)return Promise.resolve({});const l=ln(o[0],a),c=d=>{if(Nh(l,["client_report"])){U&&L.warn(`Dropping client report. Will not send outcomes (reason: ${d}).`);return}qs(l,(p,f)=>{t.recordDroppedEvent(d,zo(f))})},u=()=>e({body:Mh(l)}).then(d=>d.statusCode===413?(U&&L.error("Sentry responded with status code 413. Envelope was discarded due to exceeding size limits."),c("send_error"),d):(U&&d.statusCode!==void 0&&(d.statusCode<200||d.statusCode>=300)&&L.warn(`Sentry responded with status code ${d.statusCode} to sent event.`),r=kp(r,d),d),d=>{throw c("network_error"),U&&L.error("Encountered error running transport request:",d),d});return n.add(u).then(d=>d,d=>{if(d===Vi)return U&&L.error("Skipped sending event because buffer is full."),c("queue_overflow"),Promise.resolve({});throw d})}return{send:i,flush:s}}function Ip(t,e,n){const r=[{type:"client_report"},{timestamp:Hn(),discarded_events:t}];return ln(e?{dsn:e}:{},[r])}function Pc(t){const e=[];t.message&&e.push(t.message);try{const n=t.exception.values[t.exception.values.length-1];n!=null&&n.value&&(e.push(n.value),n.type&&e.push(`${n.type}: ${n.value}`))}catch{}return e}function Tp(t){var l;const{trace_id:e,parent_span_id:n,span_id:r,status:s,origin:i,data:o,op:a}=((l=t.contexts)==null?void 0:l.trace)??{};return{data:o??{},description:t.transaction,op:a,parent_span_id:n,span_id:r??"",start_timestamp:t.start_timestamp??0,status:s,timestamp:t.timestamp,trace_id:e??"",origin:i,profile_id:o==null?void 0:o[lc],exclusive_time:o==null?void 0:o[cc],measurements:t.measurements,is_segment:!0}}function Pp(t){return{type:"transaction",timestamp:t.timestamp,start_timestamp:t.start_timestamp,transaction:t.description,contexts:{trace:{trace_id:t.trace_id,span_id:t.span_id,parent_span_id:t.parent_span_id,op:t.op,status:t.status,origin:t.origin,data:{...t.data,...t.profile_id&&{[lc]:t.profile_id},...t.exclusive_time&&{[cc]:t.exclusive_time}}}},measurements:t.measurements}}const Zo="Not capturing exception because it's already been captured.",Qo="Discarded session because of missing or non-string release",Cc=Symbol.for("SentryInternalError"),$c=Symbol.for("SentryDoNotSendEventError"),Cp=5e3;function cr(t){return{message:t,[Cc]:!0}}function hs(t){return{message:t,[$c]:!0}}function ea(t){return!!t&&typeof t=="object"&&Cc in t}function ta(t){return!!t&&typeof t=="object"&&$c in t}function na(t,e,n,r,s){let i=0,o,a=!1;t.on(n,()=>{i=0,clearTimeout(o),a=!1}),t.on(e,l=>{i+=r(l),i>=8e5?s(t):a||(a=!0,o=Ic(setTimeout(()=>{s(t)},Cp)))}),t.on("flush",()=>{s(t)})}class $p{constructor(e){var r,s,i;if(this._options=e,this._integrations={},this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],this._promiseBuffer=Yi(((r=e.transportOptions)==null?void 0:r.bufferSize)??Tc),e.dsn?this._dsn=fh(e.dsn):U&&L.warn("No DSN provided, client will not send events."),this._dsn){const o=up(this._dsn,e.tunnel,e._metadata?e._metadata.sdk:void 0);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:o})}this._options.enableLogs=this._options.enableLogs??((s=this._options._experiments)==null?void 0:s.enableLogs),this._options.enableLogs&&na(this,"afterCaptureLog","flushLogs",Fp,Ys),(this._options.enableMetrics??((i=this._options._experiments)==null?void 0:i.enableMetrics)??!0)&&na(this,"afterCaptureMetric","flushMetrics",Ap,kc)}captureException(e,n,r){const s=Fe();if(Po(e))return U&&L.log(Zo),s;const i={event_id:s,...n};return this._process(()=>this.eventFromException(e,i).then(o=>this._captureEvent(o,i,r)).then(o=>o),"error"),i.event_id}captureMessage(e,n,r,s){const i={event_id:Fe(),...r},o=ji(e)?e:String(e),a=Yr(e),l=a?this.eventFromMessage(o,n,i):this.eventFromException(e,i);return this._process(()=>l.then(c=>this._captureEvent(c,i,s)),a?"unknown":"error"),i.event_id}captureEvent(e,n,r){const s=Fe();if(n!=null&&n.originalException&&Po(n.originalException))return U&&L.log(Zo),s;const i={event_id:s,...n},o=e.sdkProcessingMetadata||{},a=o.capturedSpanScope,l=o.capturedSpanIsolationScope,c=ra(e.type);return this._process(()=>this._captureEvent(e,i,a||r,l),c),i.event_id}captureSession(e){this.sendSession(e),Kt(e,{init:!1})}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}async flush(e){const n=this._transport;if(!n)return!0;this.emit("flush");const r=await this._isClientDoneProcessing(e),s=await n.flush(e);return r&&s}async close(e){Ys(this);const n=await this.flush(e);return this.getOptions().enabled=!1,this.emit("close"),n}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}init(){(this._isEnabled()||this._options.integrations.some(({name:e})=>e.startsWith("Spotlight")))&&this._setupIntegrations()}getIntegrationByName(e){return this._integrations[e]}addIntegration(e){const n=this._integrations[e.name];wc(this,e,this._integrations),n||Xo(this,[e])}sendEvent(e,n={}){this.emit("beforeSendEvent",e,n);let r=zh(e,this._dsn,this._options._metadata,this._options.tunnel);for(const s of n.attachments||[])r=Fh(r,Lh(s));this.sendEnvelope(r).then(s=>this.emit("afterSendEvent",e,s))}sendSession(e){const{release:n,environment:r=qi}=this._options;if("aggregates"in e){const i=e.attrs||{};if(!i.release&&!n){U&&L.warn(Qo);return}i.release=i.release||n,i.environment=i.environment||r,e.attrs=i}else{if(!e.release&&!n){U&&L.warn(Qo);return}e.release=e.release||n,e.environment=e.environment||r}this.emit("beforeSendSession",e);const s=Bh(e,this._dsn,this._options._metadata,this._options.tunnel);this.sendEnvelope(s)}recordDroppedEvent(e,n,r=1){if(this._options.sendClientReports){const s=`${e}:${n}`;U&&L.log(`Recording outcome: "${s}"${r>1?` (${r} times)`:""}`),this._outcomes[s]=(this._outcomes[s]||0)+r}}on(e,n){const r=this._hooks[e]=this._hooks[e]||new Set,s=(...i)=>n(...i);return r.add(s),()=>{r.delete(s)}}emit(e,...n){const r=this._hooks[e];r&&r.forEach(s=>s(...n))}async sendEnvelope(e){if(this.emit("beforeEnvelope",e),this._isEnabled()&&this._transport)try{return await this._transport.send(e)}catch(n){return U&&L.error("Error while sending envelope:",n),{}}return U&&L.error("Transport disabled"),{}}dispose(){}_setupIntegrations(){const{integrations:e}=this._options;this._integrations=pp(this,e),Xo(this,e)}_updateSessionFromEvent(e,n){var l,c;let r=n.level==="fatal",s=!1;const i=(l=n.exception)==null?void 0:l.values;if(i){s=!0,r=!1;for(const u of i)if(((c=u.mechanism)==null?void 0:c.handled)===!1){r=!0;break}}const o=e.status==="ok";(o&&e.errors===0||o&&r)&&(Kt(e,{...r&&{status:"crashed"},errors:e.errors||Number(s||r)}),this.captureSession(e))}async _isClientDoneProcessing(e){let n=0;for(;!e||n<e;){if(await new Promise(r=>setTimeout(r,1)),!this._numProcessing)return!0;n++}return!1}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,n,r,s){const i=this.getOptions(),o=Object.keys(this._integrations);return!n.integrations&&(o!=null&&o.length)&&(n.integrations=o),this.emit("preprocessEvent",e,n),e.type||s.setLastEventId(e.event_id||n.event_id),Zh(i,e,n,r,this,s).then(a=>{var c;if(a===null)return a;this.emit("postprocessEvent",a,n),a.contexts={trace:{...(c=a.contexts)==null?void 0:c.trace,...Vd(r)},...a.contexts};const l=Th(this,r);return a.sdkProcessingMetadata={dynamicSamplingContext:l,...a.sdkProcessingMetadata},a})}_captureEvent(e,n={},r=nt(),s=At()){return U&&Ks(e)&&L.log(`Captured error event \`${Pc(e)[0]||"<unknown>"}\``),this._processEvent(e,n,r,s).then(i=>i.event_id,i=>{U&&(ta(i)?L.log(i.message):ea(i)?L.warn(i.message):L.warn(i))})}_processEvent(e,n,r,s){const i=this.getOptions(),{sampleRate:o}=i,a=Rc(e),l=Ks(e),u=`before send for type \`${e.type||"error"}\``,d=typeof o>"u"?void 0:_h(o);if(l&&typeof d=="number"&&br()>d)return this.recordDroppedEvent("sample_rate","error"),Gi(hs(`Discarding event because it's not included in the random sample (sampling rate = ${o})`));const p=ra(e.type);return this._prepareEvent(e,n,r,s).then(f=>{var P;if(f===null)throw this.recordDroppedEvent("event_processor",p),hs("An event processor returned `null`, will not send event.");if(((P=n.data)==null?void 0:P.__sentry__)===!0)return f;const _=Op(this,i,f,n);return Rp(_,u)}).then(f=>{var P;if(f===null){if(this.recordDroppedEvent("before_send",p),a){const b=1+(e.spans||[]).length;this.recordDroppedEvent("before_send","span",b)}throw hs(`${u} returned \`null\`, will not send event.`)}const g=r.getSession()||s.getSession();if(l&&g&&this._updateSessionFromEvent(g,f),a){const m=((P=f.sdkProcessingMetadata)==null?void 0:P.spanCountBeforeProcessing)||0,b=f.spans?f.spans.length:0,C=m-b;C>0&&this.recordDroppedEvent("before_send","span",C)}const _=f.transaction_info;if(a&&_&&f.transaction!==e.transaction){const m="custom";f.transaction_info={..._,source:m}}return this.sendEvent(f,n),f}).then(null,f=>{throw ta(f)||ea(f)?f:(this.captureException(f,{mechanism:{handled:!1,type:"internal"},data:{__sentry__:!0},originalException:f}),cr(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
8
|
+
Reason: ${f}`))})}_process(e,n){this._numProcessing++,this._promiseBuffer.add(e).then(r=>(this._numProcessing--,r),r=>(this._numProcessing--,r===Vi&&this.recordDroppedEvent("queue_overflow",n),r))}_clearOutcomes(){const e=this._outcomes;return this._outcomes={},Object.entries(e).map(([n,r])=>{const[s,i]=n.split(":");return{reason:s,category:i,quantity:r}})}_flushOutcomes(){U&&L.log("Flushing outcomes...");const e=this._clearOutcomes();if(e.length===0){U&&L.log("No outcomes to send");return}if(!this._dsn){U&&L.log("No dsn provided, will not send outcomes");return}U&&L.log("Sending outcomes:",e);const n=Ip(e,this._options.tunnel&&zn(this._dsn));this.sendEnvelope(n)}}function ra(t){return t==="replay_event"?"replay":t||"error"}function Rp(t,e){const n=`${e} must return \`null\` or a valid event.`;if(Un(t))return t.then(r=>{if(!Rn(r)&&r!==null)throw cr(n);return r},r=>{throw cr(`${e} rejected with ${r}`)});if(!Rn(t)&&t!==null)throw cr(n);return t}function Op(t,e,n,r){const{beforeSend:s,beforeSendTransaction:i,beforeSendSpan:o,ignoreSpans:a}=e;let l=n;if(Ks(l)&&s)return s(l,r);if(Rc(l)){if(o||a){const c=Tp(l);if(a!=null&&a.length&&Bo(c,a))return null;if(o){const u=o(c);u?l=Bn(n,Pp(u)):Uo()}if(l.spans){const u=[],d=l.spans;for(const f of d){if(a!=null&&a.length&&Bo(f,a)){kh(d,f);continue}if(o){const g=o(f);g?u.push(g):(Uo(),u.push(f))}else u.push(f)}const p=l.spans.length-u.length;p&&t.recordDroppedEvent("before_send","span",p),l.spans=u}}if(i){if(l.spans){const c=l.spans.length;l.sdkProcessingMetadata={...n.sdkProcessingMetadata,spanCountBeforeProcessing:c}}return i(l,r)}}return l}function Ks(t){return t.type===void 0}function Rc(t){return t.type==="transaction"}function Ap(t){let e=0;return t.name&&(e+=t.name.length*2),e+=8,e+Oc(t.attributes)}function Fp(t){let e=0;return t.message&&(e+=t.message.length*2),e+Oc(t.attributes)}function Oc(t){if(!t)return 0;let e=0;return Object.values(t).forEach(n=>{Array.isArray(n)?e+=n.length*sa(n[0]):Yr(n)?e+=sa(n):e+=100}),e}function sa(t){return typeof t=="string"?t.length*2:typeof t=="number"?8:typeof t=="boolean"?4:0}function Np(t){return Vr(t)&&"__sentry_fetch_url_host__"in t&&typeof t.__sentry_fetch_url_host__=="string"}function ia(t){return Np(t)?`${t.message} (${t.__sentry_fetch_url_host__})`:t.message}function Mp(t,e){e.debug===!0&&(U?L.enable():on(()=>{console.warn("[Sentry] Cannot initialize SDK with `debug` option using a non-debug bundle.")})),nt().update(e.initialScope);const r=new t(e);return Dp(r),r.init(),r}function Dp(t){nt().setClient(t)}function ps(t){if(!t)return{};const e=t.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)return{};const n=e[6]||"",r=e[8]||"";return{host:e[4],path:e[5],protocol:e[2],search:n,hash:r,relative:e[5]+n+r}}function Lp(t,e=!0){if(t.startsWith("data:")){const n=t.match(/^data:([^;,]+)/),r=n?n[1]:"text/plain",s=t.includes(";base64,"),i=t.indexOf(",");let o="";if(e&&i!==-1){const a=t.slice(i+1);o=a.length>10?`${a.slice(0,10)}... [truncated]`:a}return`data:${r}${s?",base64":""}${o?`,${o}`:""}`}return t}function jp(t){var e;"aggregates"in t?((e=t.attrs)==null?void 0:e.ip_address)===void 0&&(t.attrs={...t.attrs,ip_address:"{{auto}}"}):t.ipAddress===void 0&&(t.ipAddress="{{auto}}")}function Up(t,e,n=[e],r="npm"){const s=(t._metadata=t._metadata||{}).sdk=t._metadata.sdk||{};s.name||(s.name=`sentry.javascript.${e}`,s.packages=n.map(i=>({name:`${r}:@sentry/${i}`,version:kt})),s.version=kt)}const Hp=100;function Ct(t,e){const n=Ee(),r=At();if(!n)return;const{beforeBreadcrumb:s=null,maxBreadcrumbs:i=Hp}=n.getOptions();if(i<=0)return;const a={timestamp:Hn(),...t},l=s?on(()=>s(a,e)):a;l!==null&&(n.emit&&n.emit("beforeAddBreadcrumb",l,e),r.addBreadcrumb(l,i))}let oa;const Bp="FunctionToString",aa=new WeakMap,zp=()=>({name:Bp,setupOnce(){oa=Function.prototype.toString;try{Function.prototype.toString=function(...t){const e=Bi(this),n=aa.has(Ee())&&e!==void 0?e:this;return oa.apply(n,t)}}catch{}},setup(t){aa.set(t,!0)}}),Wp=zp,qp=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/,/^Can't find variable: gmo$/,/^undefined is not an object \(evaluating 'a\.[A-Z]'\)$/,/can't redefine non-configurable property "solana"/,/vv\(\)\.getRestrictions is not a function/,/Can't find variable: _AutofillCallbackHandler/,/Object Not Found Matching Id:\d+, MethodName:simulateEvent/,/^Java exception was raised during method invocation$/],Gp="EventFilters",Vp=(t={})=>{let e;return{name:Gp,setup(n){const r=n.getOptions();e=la(t,r)},processEvent(n,r,s){if(!e){const i=s.getOptions();e=la(t,i)}return Kp(n,e)?null:n}}},Yp=(t={})=>({...Vp(t),name:"InboundFilters"});function la(t={},e={}){return{allowUrls:[...t.allowUrls||[],...e.allowUrls||[]],denyUrls:[...t.denyUrls||[],...e.denyUrls||[]],ignoreErrors:[...t.ignoreErrors||[],...e.ignoreErrors||[],...t.disableErrorDefaults?[]:qp],ignoreTransactions:[...t.ignoreTransactions||[],...e.ignoreTransactions||[]]}}function Kp(t,e){if(t.type){if(t.type==="transaction"&&Xp(t,e.ignoreTransactions))return U&&L.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
9
|
+
Event: ${St(t)}`),!0}else{if(Jp(t,e.ignoreErrors))return U&&L.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
10
|
+
Event: ${St(t)}`),!0;if(tf(t))return U&&L.warn(`Event dropped due to not having an error message, error type or stacktrace.
|
|
11
|
+
Event: ${St(t)}`),!0;if(Zp(t,e.denyUrls))return U&&L.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
12
|
+
Event: ${St(t)}.
|
|
13
|
+
Url: ${Er(t)}`),!0;if(!Qp(t,e.allowUrls))return U&&L.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
14
|
+
Event: ${St(t)}.
|
|
15
|
+
Url: ${Er(t)}`),!0}return!1}function Jp(t,e){return e!=null&&e.length?Pc(t).some(n=>Zr(n,e)):!1}function Xp(t,e){if(!(e!=null&&e.length))return!1;const n=t.transaction;return n?Zr(n,e):!1}function Zp(t,e){if(!(e!=null&&e.length))return!1;const n=Er(t);return n?Zr(n,e):!1}function Qp(t,e){if(!(e!=null&&e.length))return!0;const n=Er(t);return n?Zr(n,e):!0}function ef(t=[]){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n&&n.filename!=="<anonymous>"&&n.filename!=="[native code]")return n.filename||null}return null}function Er(t){var e,n;try{const r=[...((e=t.exception)==null?void 0:e.values)??[]].reverse().find(i=>{var o,a,l;return((o=i.mechanism)==null?void 0:o.parent_id)===void 0&&((l=(a=i.stacktrace)==null?void 0:a.frames)==null?void 0:l.length)}),s=(n=r==null?void 0:r.stacktrace)==null?void 0:n.frames;return s?ef(s):null}catch{return U&&L.error(`Cannot extract url for event ${St(t)}`),null}}function tf(t){var e,n;return(n=(e=t.exception)==null?void 0:e.values)!=null&&n.length?!t.message&&!t.exception.values.some(r=>r.stacktrace||r.type&&r.type!=="Error"||r.value):!1}function nf(t,e,n,r,s,i){var a;if(!((a=s.exception)!=null&&a.values)||!i||!gt(i.originalException,Error))return;const o=s.exception.values.length>0?s.exception.values[s.exception.values.length-1]:void 0;o&&(s.exception.values=Js(t,e,r,i.originalException,n,s.exception.values,o,0))}function Js(t,e,n,r,s,i,o,a){if(i.length>=n+1)return i;let l=[...i];if(gt(r[s],Error)){ca(o,a,r);const c=t(e,r[s]),u=l.length;ua(c,s,u,a),l=Js(t,e,n,r[s],s,[c,...l],c,u)}return Ac(r)&&r.errors.forEach((c,u)=>{if(gt(c,Error)){ca(o,a,r);const d=t(e,c),p=l.length;ua(d,`errors[${u}]`,p,a),l=Js(t,e,n,c,s,[d,...l],d,p)}}),l}function Ac(t){return Array.isArray(t.errors)}function ca(t,e,n){t.mechanism={handled:!0,type:"auto.core.linked_errors",...Ac(n)&&{is_exception_group:!0},...t.mechanism,exception_id:e}}function ua(t,e,n,r){t.mechanism={handled:!0,...t.mechanism,type:"chained",source:e,exception_id:n,parent_id:r}}function rf(t){const e="console";Rt(e,t),Ot(e,sf)}function sf(){"console"in J&&ld.forEach(function(t){t in J.console&&$e(J.console,t,function(e){return yr[t]=e,function(...n){je("console",{args:n,level:t});const s=yr[t];s==null||s.apply(J.console,n)}})})}function of(t){return t==="warn"?"warning":["fatal","error","warning","log","info","debug"].includes(t)?t:"log"}const af="Dedupe",lf=()=>{let t;return{name:af,processEvent(e){if(e.type)return e;try{if(uf(e,t))return U&&L.warn("Event dropped due to being a duplicate of previously captured event."),null}catch{}return t=e}}},cf=lf;function uf(t,e){return e?!!(df(t,e)||hf(t,e)):!1}function df(t,e){const n=t.message,r=e.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!Nc(t,e)||!Fc(t,e))}function hf(t,e){const n=da(e),r=da(t);return!(!n||!r||n.type!==r.type||n.value!==r.value||!Nc(t,e)||!Fc(t,e))}function Fc(t,e){let n=wo(t),r=wo(e);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let s=0;s<r.length;s++){const i=r[s],o=n[s];if(i.filename!==o.filename||i.lineno!==o.lineno||i.colno!==o.colno||i.function!==o.function)return!1}return!0}function Nc(t,e){let n=t.fingerprint,r=e.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join("")===r.join("")}catch{return!1}}function da(t){var e,n;return(n=(e=t.exception)==null?void 0:e.values)==null?void 0:n[0]}const pf="ConversationId",ff=()=>({name:pf,setup(t){t.on("spanStart",e=>{const n=nt().getScopeData(),r=At().getScopeData(),s=n.conversationId||r.conversationId;s&&e.setAttribute(Qd,s)})}}),_f=ff;function Mc(t){if(t!==void 0)return t>=400&&t<500?"warning":t>=500?"error":void 0}const An=J;function gf(){return"history"in An&&!!An.history}function vf(){if(!("fetch"in An))return!1;try{return new Headers,new Request("data:,"),new Response,!0}catch{return!1}}function Xs(t){return t&&/^function\s+\w+\(\)\s+\{\s+\[native code\]\s+\}$/.test(t.toString())}function mf(){var n;if(typeof EdgeRuntime=="string")return!0;if(!vf())return!1;if(Xs(An.fetch))return!0;let t=!1;const e=An.document;if(e&&typeof e.createElement=="function")try{const r=e.createElement("iframe");r.hidden=!0,e.head.appendChild(r),(n=r.contentWindow)!=null&&n.fetch&&(t=Xs(r.contentWindow.fetch)),e.head.removeChild(r)}catch(r){U&&L.warn("Could not create sandbox iframe for pure fetch check, bailing to window.fetch: ",r)}return t}function yf(t,e){const n="fetch";Rt(n,t),Ot(n,()=>bf(void 0,e))}function bf(t,e=!1){e&&!mf()||$e(J,"fetch",function(n){return function(...r){const s=new Error,{method:i,url:o}=Ef(r),a={args:r,fetchData:{method:i,url:o},startTimestamp:et()*1e3,virtualError:s,headers:wf(r)};return je("fetch",{...a}),n.apply(J,r).then(async l=>(je("fetch",{...a,endTimestamp:et()*1e3,response:l}),l),l=>{je("fetch",{...a,endTimestamp:et()*1e3,error:l}),Vr(l)&&l.stack===void 0&&(l.stack=s.stack,vt(l,"framesToPop",1));const c=Ee(),u=(c==null?void 0:c.getOptions().enhanceFetchErrorMessages)??"always";if(u!==!1&&l instanceof TypeError&&(l.message==="Failed to fetch"||l.message==="Load failed"||l.message==="NetworkError when attempting to fetch resource."))try{const f=new URL(a.fetchData.url).host;u==="always"?l.message=`${l.message} (${f})`:vt(l,"__sentry_fetch_url_host__",f)}catch{}throw l})}})}function ur(t,e){return!!t&&typeof t=="object"&&!!t[e]}function ha(t){return typeof t=="string"?t:t?ur(t,"url")?t.url:t.toString?t.toString():"":""}function Ef(t){if(t.length===0)return{method:"GET",url:""};if(t.length===2){const[n,r]=t;return{url:ha(n),method:ur(r,"method")?String(r.method).toUpperCase():ec(n)&&ur(n,"method")?String(n.method).toUpperCase():"GET"}}const e=t[0];return{url:ha(e),method:ur(e,"method")?String(e.method).toUpperCase():"GET"}}function wf(t){const[e,n]=t;try{if(typeof n=="object"&&n!==null&&"headers"in n&&n.headers)return new Headers(n.headers);if(ec(e))return new Headers(e.headers)}catch{}}function Sf(){return"npm"}const ae=J;let Zs=0;function Dc(){return Zs>0}function kf(){Zs++,setTimeout(()=>{Zs--})}function Xt(t,e={}){function n(s){return typeof s=="function"}if(!n(t))return t;try{const s=t.__sentry_wrapped__;if(s)return typeof s=="function"?s:t;if(Bi(t))return t}catch{return t}const r=function(...s){try{const i=s.map(o=>Xt(o,e));return t.apply(this,i)}catch(i){throw kf(),Gd(o=>{o.addEventProcessor(a=>(e.mechanism&&(Bs(a,void 0),Yt(a,e.mechanism)),a.extra={...a.extra,arguments:s},a)),ip(i)}),i}};try{for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=t[s])}catch{}nc(r,t),vt(t,"__sentry_wrapped__",r);try{Object.getOwnPropertyDescriptor(r,"name").configurable&&Object.defineProperty(r,"name",{get(){return t.name}})}catch{}return r}function xf(){const t=Hi(),{referrer:e}=ae.document||{},{userAgent:n}=ae.navigator||{},r={...e&&{Referer:e},...n&&{"User-Agent":n}};return{url:t,headers:r}}function Ki(t,e){const n=Ji(t,e),r={type:$f(e),value:Rf(e)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===""&&(r.value="Unrecoverable error caught"),r}function If(t,e,n,r){const s=Ee(),i=s==null?void 0:s.getOptions().normalizeDepth,o=Mf(e),a={__serialized__:_c(e,i)};if(o)return{exception:{values:[Ki(t,o)]},extra:a};const l={exception:{values:[{type:Kr(e)?e.constructor.name:r?"UnhandledRejection":"Error",value:Ff(e,{isUnhandledRejection:r})}]},extra:a};if(n){const c=Ji(t,n);c.length&&(l.exception.values[0].stacktrace={frames:c})}return l}function fs(t,e){return{exception:{values:[Ki(t,e)]}}}function Ji(t,e){const n=e.stacktrace||e.stack||"",r=Pf(e),s=Cf(e);try{return t(n,r,s)}catch{}return[]}const Tf=/Minified React error #\d+;/i;function Pf(t){return t&&Tf.test(t.message)?1:0}function Cf(t){return typeof t.framesToPop=="number"?t.framesToPop:0}function Lc(t){return typeof WebAssembly<"u"&&typeof WebAssembly.Exception<"u"?t instanceof WebAssembly.Exception:!1}function $f(t){const e=t==null?void 0:t.name;return!e&&Lc(t)?t.message&&Array.isArray(t.message)&&t.message.length==2?t.message[0]:"WebAssembly.Exception":e}function Rf(t){const e=t==null?void 0:t.message;return Lc(t)?Array.isArray(t.message)&&t.message.length==2?t.message[1]:"wasm exception":e?e.error&&typeof e.error.message=="string"?ia(e.error):ia(t):"No error message"}function Of(t,e,n,r){const s=(n==null?void 0:n.syntheticException)||void 0,i=Xi(t,e,s,r);return Yt(i),i.level="error",n!=null&&n.event_id&&(i.event_id=n.event_id),Wn(i)}function Af(t,e,n="info",r,s){const i=(r==null?void 0:r.syntheticException)||void 0,o=Qs(t,e,i,s);return o.level=n,r!=null&&r.event_id&&(o.event_id=r.event_id),Wn(o)}function Xi(t,e,n,r,s){let i;if(Zl(e)&&e.error)return fs(t,e.error);if(ko(e)||Ed(e)){const o=e;if("stack"in e)i=fs(t,e);else{const a=o.name||(ko(o)?"DOMError":"DOMException"),l=o.message?`${a}: ${o.message}`:a;i=Qs(t,l,n,r),Bs(i,l)}return"code"in o&&(i.tags={...i.tags,"DOMException.code":`${o.code}`}),i}return Vr(e)?fs(t,e):Rn(e)||Kr(e)?(i=If(t,e,n,s),Yt(i,{synthetic:!0}),i):(i=Qs(t,e,n,r),Bs(i,`${e}`),Yt(i,{synthetic:!0}),i)}function Qs(t,e,n,r){const s={};if(r&&n){const i=Ji(t,n);i.length&&(s.exception={values:[{value:e,stacktrace:{frames:i}}]}),Yt(s,{synthetic:!0})}if(ji(e)){const{__sentry_template_string__:i,__sentry_template_values__:o}=e;return s.logentry={message:i,params:o},s}return s.message=e,s}function Ff(t,{isUnhandledRejection:e}){const n=Pd(t),r=e?"promise rejection":"exception";return Zl(t)?`Event \`ErrorEvent\` captured as ${r} with message \`${t.message}\``:Kr(t)?`Event \`${Nf(t)}\` (type=${t.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function Nf(t){try{const e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch{}}function Mf(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const n=t[e];if(n instanceof Error)return n}}class Df extends $p{constructor(e){var u;const n=Lf(e),r=ae.SENTRY_SDK_SOURCE||Sf();Up(n,"browser",["browser"],r),(u=n._metadata)!=null&&u.sdk&&(n._metadata.sdk.settings={infer_ip:n.sendDefaultPii?"auto":"never",...n._metadata.sdk.settings}),super(n);const{sendDefaultPii:s,sendClientReports:i,enableLogs:o,_experiments:a,enableMetrics:l}=this._options,c=l??(a==null?void 0:a.enableMetrics)??!0;ae.document&&(i||o||c)&&ae.document.addEventListener("visibilitychange",()=>{ae.document.visibilityState==="hidden"&&(i&&this._flushOutcomes(),o&&Ys(this),c&&kc(this))}),s&&this.on("beforeSendSession",jp)}eventFromException(e,n){return Of(this._options.stackParser,e,n,this._options.attachStacktrace)}eventFromMessage(e,n="info",r){return Af(this._options.stackParser,e,n,r,this._options.attachStacktrace)}_prepareEvent(e,n,r,s){return e.platform=e.platform||"javascript",super._prepareEvent(e,n,r,s)}}function Lf(t){var e;return{release:typeof __SENTRY_RELEASE__=="string"?__SENTRY_RELEASE__:(e=ae.SENTRY_RELEASE)==null?void 0:e.id,sendClientReports:!0,parentSpanIsAlwaysRootSpan:!0,...t}}const jf=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,ke=J,Uf=1e3;let pa,ei,ti;function Hf(t){const e="dom";Rt(e,t),Ot(e,Bf)}function Bf(){if(!ke.document)return;const t=je.bind(null,"dom"),e=fa(t,!0);ke.document.addEventListener("click",e,!1),ke.document.addEventListener("keypress",e,!1),["EventTarget","Node"].forEach(n=>{var i,o;const s=(i=ke[n])==null?void 0:i.prototype;(o=s==null?void 0:s.hasOwnProperty)!=null&&o.call(s,"addEventListener")&&($e(s,"addEventListener",function(a){return function(l,c,u){if(l==="click"||l=="keypress")try{const d=this.__sentry_instrumentation_handlers__=this.__sentry_instrumentation_handlers__||{},p=d[l]=d[l]||{refCount:0};if(!p.handler){const f=fa(t);p.handler=f,a.call(this,l,f,u)}p.refCount++}catch{}return a.call(this,l,c,u)}}),$e(s,"removeEventListener",function(a){return function(l,c,u){if(l==="click"||l=="keypress")try{const d=this.__sentry_instrumentation_handlers__||{},p=d[l];p&&(p.refCount--,p.refCount<=0&&(a.call(this,l,p.handler,u),p.handler=void 0,delete d[l]),Object.keys(d).length===0&&delete this.__sentry_instrumentation_handlers__)}catch{}return a.call(this,l,c,u)}}))})}function zf(t){if(t.type!==ei)return!1;try{if(!t.target||t.target._sentryId!==ti)return!1}catch{}return!0}function Wf(t,e){return t!=="keypress"?!1:e!=null&&e.tagName?!(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable):!0}function fa(t,e=!1){return n=>{if(!n||n._sentryCaptured)return;const r=qf(n);if(Wf(n.type,r))return;vt(n,"_sentryCaptured",!0),r&&!r._sentryId&&vt(r,"_sentryId",Fe());const s=n.type==="keypress"?"input":n.type;zf(n)||(t({event:n,name:s,global:e}),ei=n.type,ti=r?r._sentryId:void 0),clearTimeout(pa),pa=ke.setTimeout(()=>{ti=void 0,ei=void 0},Uf)}}function qf(t){try{return t.target}catch{return null}}let Yn;function jc(t){const e="history";Rt(e,t),Ot(e,Gf)}function Gf(){if(ke.addEventListener("popstate",()=>{const e=ke.location.href,n=Yn;if(Yn=e,n===e)return;je("history",{from:n,to:e})}),!gf())return;function t(e){return function(...n){const r=n.length>2?n[2]:void 0;if(r){const s=Yn,i=Vf(String(r));if(Yn=i,s===i)return e.apply(this,n);je("history",{from:s,to:i})}return e.apply(this,n)}}$e(ke.history,"pushState",t),$e(ke.history,"replaceState",t)}function Vf(t){try{return new URL(t,ke.location.origin).toString()}catch{return t}}const dr={};function Yf(t){const e=dr[t];if(e)return e;let n=ke[t];if(Xs(n))return dr[t]=n.bind(ke);const r=ke.document;if(r&&typeof r.createElement=="function")try{const s=r.createElement("iframe");s.hidden=!0,r.head.appendChild(s);const i=s.contentWindow;i!=null&&i[t]&&(n=i[t]),r.head.removeChild(s)}catch(s){jf&&L.warn(`Could not create sandbox iframe for ${t} check, bailing to window.${t}: `,s)}return n&&(dr[t]=n.bind(ke))}function Kf(t){dr[t]=void 0}const yn="__sentry_xhr_v3__";function Jf(t){const e="xhr";Rt(e,t),Ot(e,Xf)}function Xf(){if(!ke.XMLHttpRequest)return;const t=XMLHttpRequest.prototype;t.open=new Proxy(t.open,{apply(e,n,r){const s=new Error,i=et()*1e3,o=Qe(r[0])?r[0].toUpperCase():void 0,a=Zf(r[1]);if(!o||!a)return e.apply(n,r);n[yn]={method:o,url:a,request_headers:{}},o==="POST"&&a.match(/sentry_key/)&&(n.__sentry_own_request__=!0);const l=()=>{const c=n[yn];if(c&&n.readyState===4){try{c.status_code=n.status}catch{}const u={endTimestamp:et()*1e3,startTimestamp:i,xhr:n,virtualError:s};je("xhr",u)}};return"onreadystatechange"in n&&typeof n.onreadystatechange=="function"?n.onreadystatechange=new Proxy(n.onreadystatechange,{apply(c,u,d){return l(),c.apply(u,d)}}):n.addEventListener("readystatechange",l),n.setRequestHeader=new Proxy(n.setRequestHeader,{apply(c,u,d){const[p,f]=d,g=u[yn];return g&&Qe(p)&&Qe(f)&&(g.request_headers[p.toLowerCase()]=f),c.apply(u,d)}}),e.apply(n,r)}}),t.send=new Proxy(t.send,{apply(e,n,r){const s=n[yn];if(!s)return e.apply(n,r);r[0]!==void 0&&(s.body=r[0]);const i={startTimestamp:et()*1e3,xhr:n};return je("xhr",i),e.apply(n,r)}})}function Zf(t){if(Qe(t))return t;try{return t.toString()}catch{}}const Qf=40;function e_(t,e=Yf("fetch")){let n=0,r=0;async function s(i){const o=i.body.length;n+=o,r++;const a={body:i.body,method:"POST",referrerPolicy:"strict-origin",headers:t.headers,keepalive:n<=6e4&&r<15,...t.fetchOptions};try{const l=await e(t.url,a);return{statusCode:l.status,headers:{"x-sentry-rate-limits":l.headers.get("X-Sentry-Rate-Limits"),"retry-after":l.headers.get("Retry-After")}}}catch(l){throw Kf("fetch"),l}finally{n-=o,r--}}return xp(t,s,Yi(t.bufferSize||Qf))}const Qr=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,t_=30,n_=50;function ni(t,e,n,r){const s={filename:t,function:e==="<anonymous>"?Pt:e,in_app:!0};return n!==void 0&&(s.lineno=n),r!==void 0&&(s.colno=r),s}const r_=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,s_=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,i_=/\((\S*)(?::(\d+))(?::(\d+))\)/,o_=/at (.+?) ?\(data:(.+?),/,a_=t=>{var s;const e=t.match(o_);if(e)return{filename:`<data:${e[2]}>`,function:e[1]};const n=r_.exec(t);if(n){const[,i,o,a]=n;return ni(i,Pt,+o,+a)}const r=s_.exec(t);if(r){if(((s=r[2])==null?void 0:s.indexOf("eval"))===0){const l=i_.exec(r[2]);l&&(r[2]=l[1],r[3]=l[2],r[4]=l[3])}const[o,a]=Uc(r[1]||Pt,r[2]);return ni(a,o,r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},l_=[t_,a_],c_=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,u_=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,d_=t=>{const e=c_.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){const i=u_.exec(e[3]);i&&(e[1]=e[1]||"eval",e[3]=i[1],e[4]=i[2],e[5]="")}let r=e[3],s=e[1]||Pt;return[s,r]=Uc(s,r),ni(r,s,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},h_=[n_,d_],p_=[l_,h_],f_=Kl(...p_),Uc=(t,e)=>{const n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:Pt,n?`safari-extension:${e}`:`safari-web-extension:${e}`]:[t,e]},Kn=1024,__="Breadcrumbs",g_=(t={})=>{const e={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...t};return{name:__,setup(n){e.console&&rf(b_(n)),e.dom&&Hf(y_(n,e.dom)),e.xhr&&Jf(E_(n)),e.fetch&&yf(w_(n)),e.history&&jc(S_(n)),e.sentry&&n.on("beforeSendEvent",m_(n))}}},v_=g_;function m_(t){return function(n){Ee()===t&&Ct({category:`sentry.${n.type==="transaction"?"transaction":"event"}`,event_id:n.event_id,level:n.level,message:St(n)},{event:n})}}function y_(t,e){return function(r){if(Ee()!==t)return;let s,i,o=typeof e=="object"?e.serializeAttribute:void 0,a=typeof e=="object"&&typeof e.maxStringLength=="number"?e.maxStringLength:void 0;a&&a>Kn&&(Qr&&L.warn(`\`dom.maxStringLength\` cannot exceed ${Kn}, but a value of ${a} was configured. Sentry will use ${Kn} instead.`),a=Kn),typeof o=="string"&&(o=[o]);try{const c=r.event,u=k_(c)?c.target:c;s=tc(u,{keyAttrs:o,maxStringLength:a}),i=Td(u)}catch{s="<unknown>"}if(s.length===0)return;const l={category:`ui.${r.name}`,message:s};i&&(l.data={"ui.component_name":i}),Ct(l,{event:r.event,name:r.name,global:r.global})}}function b_(t){return function(n){if(Ee()!==t)return;const r={category:"console",data:{arguments:n.args,logger:"console"},level:of(n.level),message:To(n.args," ")};if(n.level==="assert")if(n.args[0]===!1)r.message=`Assertion failed: ${To(n.args.slice(1)," ")||"console.assert"}`,r.data.arguments=n.args.slice(1);else return;Ct(r,{input:n.args,level:n.level})}}function E_(t){return function(n){if(Ee()!==t)return;const{startTimestamp:r,endTimestamp:s}=n,i=n.xhr[yn];if(!r||!s||!i)return;const{method:o,url:a,status_code:l,body:c}=i,u={method:o,url:a,status_code:l},d={xhr:n.xhr,input:c,startTimestamp:r,endTimestamp:s},p={category:"xhr",data:u,type:"http",level:Mc(l)};t.emit("beforeOutgoingRequestBreadcrumb",p,d),Ct(p,d)}}function w_(t){return function(n){if(Ee()!==t)return;const{startTimestamp:r,endTimestamp:s}=n;if(s&&!(n.fetchData.url.match(/sentry_key/)&&n.fetchData.method==="POST"))if(n.fetchData.method,n.fetchData.url,n.error){const i=n.fetchData,o={data:n.error,input:n.args,startTimestamp:r,endTimestamp:s},a={category:"fetch",data:i,level:"error",type:"http"};t.emit("beforeOutgoingRequestBreadcrumb",a,o),Ct(a,o)}else{const i=n.response,o={...n.fetchData,status_code:i==null?void 0:i.status};n.fetchData.request_body_size,n.fetchData.response_body_size,i==null||i.status;const a={input:n.args,response:i,startTimestamp:r,endTimestamp:s},l={category:"fetch",data:o,type:"http",level:Mc(o.status_code)};t.emit("beforeOutgoingRequestBreadcrumb",l,a),Ct(l,a)}}}function S_(t){return function(n){if(Ee()!==t)return;let r=n.from,s=n.to;const i=ps(ae.location.href);let o=r?ps(r):void 0;const a=ps(s);o!=null&&o.path||(o=i),i.protocol===a.protocol&&i.host===a.host&&(s=a.relative),i.protocol===o.protocol&&i.host===o.host&&(r=o.relative),Ct({category:"navigation",data:{from:r,to:s}})}}function k_(t){return!!t&&!!t.target}const x_=["EventTarget","Window","Node","ApplicationCache","AudioTrackList","BroadcastChannel","ChannelMergerNode","CryptoOperation","EventSource","FileReader","HTMLUnknownElement","IDBDatabase","IDBRequest","IDBTransaction","KeyOperation","MediaController","MessagePort","ModalWindow","Notification","SVGElementInstance","Screen","SharedWorker","TextTrack","TextTrackCue","TextTrackList","WebSocket","WebSocketWorker","Worker","XMLHttpRequest","XMLHttpRequestEventTarget","XMLHttpRequestUpload"],I_="BrowserApiErrors",T_=(t={})=>{const e={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,unregisterOriginalCallbacks:!1,...t};return{name:I_,setupOnce(){e.setTimeout&&$e(ae,"setTimeout",_a),e.setInterval&&$e(ae,"setInterval",_a),e.requestAnimationFrame&&$e(ae,"requestAnimationFrame",C_),e.XMLHttpRequest&&"XMLHttpRequest"in ae&&$e(XMLHttpRequest.prototype,"send",$_);const n=e.eventTarget;n&&(Array.isArray(n)?n:x_).forEach(s=>R_(s,e))}}},P_=T_;function _a(t){return function(...e){const n=e[0];return e[0]=Xt(n,{mechanism:{handled:!1,type:`auto.browser.browserapierrors.${_t(t)}`}}),t.apply(this,e)}}function C_(t){return function(e){return t.apply(this,[Xt(e,{mechanism:{data:{handler:_t(t)},handled:!1,type:"auto.browser.browserapierrors.requestAnimationFrame"}})])}}function $_(t){return function(...e){const n=this;return["onload","onerror","onprogress","onreadystatechange"].forEach(s=>{s in n&&typeof n[s]=="function"&&$e(n,s,function(i){const o={mechanism:{data:{handler:_t(i)},handled:!1,type:`auto.browser.browserapierrors.xhr.${s}`}},a=Bi(i);return a&&(o.mechanism.data.handler=_t(a)),Xt(i,o)})}),t.apply(this,e)}}function R_(t,e){var s,i;const r=(s=ae[t])==null?void 0:s.prototype;(i=r==null?void 0:r.hasOwnProperty)!=null&&i.call(r,"addEventListener")&&($e(r,"addEventListener",function(o){return function(a,l,c){try{O_(l)&&(l.handleEvent=Xt(l.handleEvent,{mechanism:{data:{handler:_t(l),target:t},handled:!1,type:"auto.browser.browserapierrors.handleEvent"}}))}catch{}return e.unregisterOriginalCallbacks&&A_(this,a,l),o.apply(this,[a,Xt(l,{mechanism:{data:{handler:_t(l),target:t},handled:!1,type:"auto.browser.browserapierrors.addEventListener"}}),c])}}),$e(r,"removeEventListener",function(o){return function(a,l,c){try{const u=l.__sentry_wrapped__;u&&o.call(this,a,u,c)}catch{}return o.call(this,a,l,c)}}))}function O_(t){return typeof t.handleEvent=="function"}function A_(t,e,n){t&&typeof t=="object"&&"removeEventListener"in t&&typeof t.removeEventListener=="function"&&t.removeEventListener(e,n)}const F_=(t={})=>{const e=t.lifecycle??"route";return{name:"BrowserSession",setupOnce(){if(typeof ae.document>"u"){Qr&&L.warn("Using the `browserSessionIntegration` in non-browser environments is not supported.");return}Ko({ignoreDuration:!0}),ds();const n=At();let r=n.getUser();n.addScopeListener(s=>{const i=s.getUser();((r==null?void 0:r.id)!==(i==null?void 0:i.id)||(r==null?void 0:r.ip_address)!==(i==null?void 0:i.ip_address))&&(ds(),r=i)}),e==="route"&&jc(({from:s,to:i})=>{s!==i&&(Ko({ignoreDuration:!0}),ds())})}}},N_="CultureContext",M_=()=>({name:N_,preprocessEvent(t){var n;const e=L_();e&&(t.contexts={...t.contexts,culture:{...e,...(n=t.contexts)==null?void 0:n.culture}})}}),D_=M_;function L_(){try{const t=ae.Intl;if(!t)return;const e=t.DateTimeFormat().resolvedOptions();return{locale:e.locale,timezone:e.timeZone,calendar:e.calendar}}catch{return}}const j_="GlobalHandlers",U_=(t={})=>{const e={onerror:!0,onunhandledrejection:!0,...t};return{name:j_,setupOnce(){Error.stackTraceLimit=50},setup(n){e.onerror&&(B_(n),ga("onerror")),e.onunhandledrejection&&(z_(n),ga("onunhandledrejection"))}}},H_=U_;function B_(t){vd(e=>{const{stackParser:n,attachStacktrace:r}=Hc();if(Ee()!==t||Dc())return;const{msg:s,url:i,line:o,column:a,error:l}=e,c=G_(Xi(n,l||s,void 0,r,!1),i,o,a);c.level="error",yc(c,{originalException:l,mechanism:{handled:!1,type:"auto.browser.global_handlers.onerror"}})})}function z_(t){yd(e=>{const{stackParser:n,attachStacktrace:r}=Hc();if(Ee()!==t||Dc())return;const s=W_(e),i=Yr(s)?q_(s):Xi(n,s,void 0,r,!0);i.level="error",yc(i,{originalException:s,mechanism:{handled:!1,type:"auto.browser.global_handlers.onunhandledrejection"}})})}function W_(t){if(Yr(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}function q_(t){return{exception:{values:[{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(t)}`}]}}}function G_(t,e,n,r){const s=t.exception=t.exception||{},i=s.values=s.values||[],o=i[0]=i[0]||{},a=o.stacktrace=o.stacktrace||{},l=a.frames=a.frames||[],c=r,u=n,d=V_(e)??Hi();return l.length===0&&l.push({colno:c,filename:d,function:Pt,in_app:!0,lineno:u}),t}function ga(t){Qr&&L.log(`Global Handler attached: ${t}`)}function Hc(){const t=Ee();return(t==null?void 0:t.getOptions())||{stackParser:()=>[],attachStacktrace:!1}}function V_(t){if(!(!Qe(t)||t.length===0))return t.startsWith("data:")?`<${Lp(t,!1)}>`:t}const Y_=()=>({name:"HttpContext",preprocessEvent(t){var r;if(!ae.navigator&&!ae.location&&!ae.document)return;const e=xf(),n={...e.headers,...(r=t.request)==null?void 0:r.headers};t.request={...e,...t.request,headers:n}}}),K_="cause",J_=5,X_="LinkedErrors",Z_=(t={})=>{const e=t.limit||J_,n=t.key||K_;return{name:X_,preprocessEvent(r,s,i){const o=i.getOptions();nf(Ki,o.stackParser,n,e,r,s)}}},Q_=Z_;function eg(){return tg()?(Qr&&on(()=>{console.error("[Sentry] You cannot use Sentry.init() in a browser extension, see: https://docs.sentry.io/platforms/javascript/best-practices/browser-extensions/")}),!0):!1}function tg(){var i;if(typeof ae.window>"u")return!1;const t=ae;if(t.nw)return!1;const e=t.chrome||t.browser;if(!((i=e==null?void 0:e.runtime)!=null&&i.id))return!1;const n=Hi(),r=["chrome-extension","moz-extension","ms-browser-extension","safari-web-extension"];return!(ae===ae.top&&r.some(o=>n.startsWith(`${o}://`)))}function ng(t){return[Yp(),Wp(),_f(),P_(),v_(),H_(),Q_(),cf(),Y_(),D_(),F_()]}function rg(t={}){const e=!t.skipBrowserExtensionCheck&&eg();let n=t.defaultIntegrations==null?ng():t.defaultIntegrations;const r={...t,enabled:e?!1:t.enabled,stackParser:_d(t.stackParser||f_),integrations:hp({integrations:t.integrations,defaultIntegrations:n}),transport:t.transport||e_};return Mp(Df,r)}var v=typeof window<"u"?window:void 0,ge=typeof globalThis<"u"?globalThis:v;typeof self>"u"&&(ge.self=ge),typeof File>"u"&&(ge.File=function(){});var Re=ge==null?void 0:ge.navigator,$=ge==null?void 0:ge.document,ve=ge==null?void 0:ge.location,ri=ge==null?void 0:ge.fetch,si=ge!=null&&ge.XMLHttpRequest&&"withCredentials"in new ge.XMLHttpRequest?ge.XMLHttpRequest:void 0,va=ge==null?void 0:ge.AbortController,sg=ge==null?void 0:ge.CompressionStream,Ie=Re==null?void 0:Re.userAgent,M=v??{},ma="1.364.1",Ce={DEBUG:!1,LIB_VERSION:ma,LIB_NAME:"web",JS_SDK_VERSION:ma};function ya(t,e,n,r,s,i,o){try{var a=t[i](o),l=a.value}catch(c){return void n(c)}a.done?e(l):Promise.resolve(l).then(r,s)}function De(t){return function(){var e=this,n=arguments;return new Promise(function(r,s){var i=t.apply(e,n);function o(l){ya(i,r,s,o,a,"next",l)}function a(l){ya(i,r,s,o,a,"throw",l)}o(void 0)})}}function T(){return T=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},T.apply(null,arguments)}function Bc(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function zc(){return(zc=De(function*(t,e){e===void 0&&(e=!0);try{var n=new Blob([t],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return yield new Response(n).blob()}catch(r){return e&&console.error("Failed to gzip compress data",r),null}})).apply(this,arguments)}var ig=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],og=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],ba=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var n=t.toLowerCase();return og.concat(e).some(r=>{var s=r.toLowerCase();return n.indexOf(s)!==-1})};function q(t,e){return t.indexOf(e)!==-1}var es=function(t){return t.trim()},ii=function(t){return t.replace(/^\$/,"")},Wc=Object.prototype,qc=Wc.hasOwnProperty,ts=Wc.toString,Y=Array.isArray||function(t){return ts.call(t)==="[object Array]"},Ke=t=>typeof t=="function",_e=t=>t===Object(t)&&!Y(t),Bt=t=>{if(_e(t)){for(var e in t)if(qc.call(t,e))return!1;return!0}return!1},O=t=>t===void 0,fe=t=>ts.call(t)=="[object String]",hr=t=>fe(t)&&t.trim().length===0,rt=t=>t===null,G=t=>O(t)||rt(t),We=t=>ts.call(t)=="[object Number]"&&t==t,jt=t=>We(t)&&t>0,Xe=t=>ts.call(t)==="[object Boolean]",ag=t=>t instanceof FormData,lg=t=>q(ig,t);function Gc(t){return t===null||typeof t!="object"}function wr(t,e){return{}.toString.call(t)==="[object "+e+"]"}function Zi(t){return!O(Event)&&function(e,n){try{return e instanceof n}catch{return!1}}(t,Event)}var cg=[!0,"true",1,"1","yes"],_s=t=>q(cg,t),ug=[!1,"false",0,"0","no"];function ze(t,e,n,r,s){return e>n&&(r.warn("min cannot be greater than max."),e=n),We(t)?t>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+s),ze(s||n,e,n,r))}class dg{constructor(e){this.t={},this.i=e.i,this.o=ze(e.bucketSize,0,100,e.h),this.m=ze(e.refillRate,0,this.o,e.h),this.S=ze(e.refillInterval,0,864e5,e.h)}T(e,n){var r=Math.floor((n-e.lastAccess)/this.S);r>0&&(e.tokens=Math.min(e.tokens+r*this.m,this.o),e.lastAccess=e.lastAccess+r*this.S)}consumeRateLimit(e){var n,r=Date.now(),s=String(e),i=this.t[s];return i?this.T(i,r):this.t[s]=i={tokens:this.o,lastAccess:r},i.tokens===0||(i.tokens--,i.tokens===0&&((n=this.i)==null||n.call(this,e)),i.tokens===0)}stop(){this.t={}}}var Jn,Ea,gs,Oe="Mobile",Sr="iOS",Ze="Android",Zt="Tablet",Vc=Ze+" "+Zt,Yc="iPad",Kc="Apple",Jc=Kc+" Watch",In="Safari",Qt="BlackBerry",Xc="Samsung",Zc=Xc+"Browser",Qc=Xc+" Internet",xt="Chrome",hg=xt+" OS",eu=xt+" "+Sr,Qi="Internet Explorer",tu=Qi+" "+Oe,eo="Opera",pg=eo+" Mini",to="Edge",nu="Microsoft "+to,qt="Firefox",ru=qt+" "+Sr,Fn="Nintendo",Nn="PlayStation",Gt="Xbox",su=Ze+" "+Oe,iu=Oe+" "+In,bn="Windows",oi=bn+" Phone",wa="Nokia",ai="Ouya",ou="Generic",fg=ou+" "+Oe.toLowerCase(),au=ou+" "+Zt.toLowerCase(),li="Konqueror",Se="(\\d+(\\.\\d+)?)",vs=new RegExp("Version/"+Se),_g=new RegExp(Gt,"i"),gg=new RegExp(Nn+" \\w+","i"),vg=new RegExp(Fn+" \\w+","i"),no=new RegExp(Qt+"|PlayBook|BB10","i"),mg={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},lu=function(t,e){return e=e||"",q(t," OPR/")&&q(t,"Mini")?pg:q(t," OPR/")?eo:no.test(t)?Qt:q(t,"IE"+Oe)||q(t,"WPDesktop")?tu:q(t,Zc)?Qc:q(t,to)||q(t,"Edg/")?nu:q(t,"FBIOS")?"Facebook "+Oe:q(t,"UCWEB")||q(t,"UCBrowser")?"UC Browser":q(t,"CriOS")?eu:q(t,"CrMo")||q(t,xt)?xt:q(t,Ze)&&q(t,In)?su:q(t,"FxiOS")?ru:q(t.toLowerCase(),li.toLowerCase())?li:((n,r)=>r&&q(r,Kc)||function(s){return q(s,In)&&!q(s,xt)&&!q(s,Ze)}(n))(t,e)?q(t,Oe)?iu:In:q(t,qt)?qt:q(t,"MSIE")||q(t,"Trident/")?Qi:q(t,"Gecko")?qt:""},yg={[tu]:[new RegExp("rv:"+Se)],[nu]:[new RegExp(to+"?\\/"+Se)],[xt]:[new RegExp("("+xt+"|CrMo)\\/"+Se)],[eu]:[new RegExp("CriOS\\/"+Se)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Se)],[In]:[vs],[iu]:[vs],[eo]:[new RegExp("(Opera|OPR)\\/"+Se)],[qt]:[new RegExp(qt+"\\/"+Se)],[ru]:[new RegExp("FxiOS\\/"+Se)],[li]:[new RegExp("Konqueror[:/]?"+Se,"i")],[Qt]:[new RegExp(Qt+" "+Se),vs],[su]:[new RegExp("android\\s"+Se,"i")],[Qc]:[new RegExp(Zc+"\\/"+Se)],[Qi]:[new RegExp("(rv:|MSIE )"+Se)],Mozilla:[new RegExp("rv:"+Se)]},bg=function(t,e){var n=lu(t,e),r=yg[n];if(O(r))return null;for(var s=0;r.length>s;s++){var i=t.match(r[s]);if(i)return parseFloat(i[i.length-2])}return null},Sa=[[new RegExp(Gt+"; "+Gt+" (.*?)[);]","i"),t=>[Gt,t&&t[1]||""]],[new RegExp(Fn,"i"),[Fn,""]],[new RegExp(Nn,"i"),[Nn,""]],[no,[Qt,""]],[new RegExp(bn,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[oi,""];if(new RegExp(Oe).test(e)&&!/IEMobile\b/.test(e))return[bn+" "+Oe,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var r=mg[n[1]]||"";return/arm/i.test(e)&&(r="RT"),[bn,r]}return[bn,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[Sr,[t[3],t[4],t[5]||"0"].join(".")]:[Sr,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=O(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Ze+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ze+")","i"),t=>t&&t[2]?[Ze,[t[2],t[3],t[4]||"0"].join(".")]:[Ze,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[hg,""]],[/Linux|debian/i,["Linux",""]]],ka=function(t){return vg.test(t)?Fn:gg.test(t)?Nn:_g.test(t)?Gt:new RegExp(ai,"i").test(t)?ai:new RegExp("("+oi+"|WPDesktop)","i").test(t)?oi:/iPad/.test(t)?Yc:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Jc:no.test(t)?Qt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(wa,"i").test(t)?wa:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Oe).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Ze:Vc:new RegExp("(pda|"+Oe+")","i").test(t)?fg:new RegExp(Zt,"i").test(t)&&!new RegExp(Zt+" pc","i").test(t)?au:""},Eg=t=>t instanceof Error;function wg(t){var e=globalThis._posthogChunkIds;if(e){var n=Object.keys(e);return gs&&n.length===Ea||(Ea=n.length,gs=n.reduce((r,s)=>{Jn||(Jn={});var i=Jn[s];if(i)r[i[0]]=i[1];else for(var o=t(s),a=o.length-1;a>=0;a--){var l=o[a],c=l==null?void 0:l.filename,u=e[s];if(c&&u){r[c]=u,Jn[s]=[c,u];break}}return r},{})),gs}}class Sg{constructor(e,n,r){r===void 0&&(r=[]),this.coercers=e,this.stackParser=n,this.modifiers=r}buildFromUnknown(e,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(r,n,0).apply(e),i=this.buildParsingContext(n),o=this.parseStacktrace(s,i);return{$exception_list:this.convertToExceptionList(o,r),$exception_level:"error"}}modifyFrames(e){var n=this;return De(function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&Y(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.stacktrace.frames));return e})()}coerceFallback(e){var n;return{type:"Error",value:"Unknown error",stack:(n=e.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(e,n){var r,s;return e.cause!=null&&(r=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?n.skipFirstLines:0),n.chunkIdMap)),T({},e,{cause:r,stack:s})}applyChunkIds(e,n){return e.map(r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r))}applyCoercers(e,n){for(var r of this.coercers)if(r.match(e))return r.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return De(function*(){var r=e;for(var s of n.modifiers)r=yield s(r);return r})()}convertToExceptionList(e,n){var r,s,i,o={type:e.type,value:e.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(s=n.handled)===null||s===void 0||s,synthetic:(i=e.synthetic)!==null&&i!==void 0&&i}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,T({},n,{handled:!0}))),a}buildParsingContext(e){var n;return{chunkIdMap:wg(this.stackParser),skipFirstLines:(n=e.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(e,n,r){r===void 0&&(r=0);var s=(i,o)=>{if(4>=o){var a=this.buildCoercingContext(e,n,o);return this.applyCoercers(i,a)}};return T({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:e,apply:i=>s(i,r),next:i=>s(i,r+1)})}}var en="?";function ci(t,e,n,r,s){var i={platform:t,filename:e,function:n==="<anonymous>"?en:n,in_app:!0};return O(r)||(i.lineno=r),O(s)||(i.colno=s),i}var cu=(t,e)=>{var n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:en,n?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},kg=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,xg=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Ig=/\((\S*)(?::(\d+))(?::(\d+))\)/,Tg=(t,e)=>{var n=kg.exec(t);if(n){var[,r,s,i]=n;return ci(e,r,en,+s,+i)}var o=xg.exec(t);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=Ig.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,c]=cu(o[1]||en,o[2]);return ci(e,c,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Pg=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Cg=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,$g=(t,e)=>{var n=Pg.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=Cg.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var s=n[3],i=n[1]||en;return[i,s]=cu(i,s),ci(e,s,i,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},xa=/\(error: (.*)\)/;class Rg{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){var r=fe(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var n=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?n+": "+e.message:n}isDOMException(e){return wr(e,"DOMException")}isDOMError(e){return wr(e,"DOMError")}}class Og{match(e){return(n=>n instanceof Error)(e)}coerce(e,n){return{type:this.getType(e),value:this.getMessage(e,n),stack:this.getStack(e),cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,n){var r=e.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}}class Ag{constructor(){}match(e){return wr(e,"ErrorEvent")&&e.error!=null}coerce(e,n){var r;return n.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}var Fg=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Ng{match(e){return typeof e=="string"}coerce(e,n){var r,[s,i]=this.getInfos(e);return{type:s??"Error",value:i??e,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(e){var n="Error",r=e,s=e.match(Fg);return s&&(n=s[1],r=s[2]),[n,r]}}var Mg=["fatal","error","warning","log","info","debug"];function uu(t,e){e===void 0&&(e=40);var n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var s=n.slice(0,r).join(", ");if(e>=s.length)return r===n.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class Dg{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var r,s=this.getErrorPropertyFromObject(e);return s?n.apply(s):{type:this.getType(e),value:this.getValue(e),stack:(r=n.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Zi(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var n="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(n+=" with message: '"+e.message+"'"),n}if("message"in e&&typeof e.message=="string")return e.message;var r=this.getObjectClassName(e);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+uu(e)}isSeverityLevel(e){return fe(e)&&!hr(e)&&Mg.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var n in e)if({}.hasOwnProperty.call(e,n)){var r=e[n];if(Eg(r))return r}}getObjectClassName(e){try{var n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}}class Lg{match(e){return Zi(e)}coerce(e,n){var r,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+uu(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class jg{match(e){return Gc(e)}coerce(e,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class Ug{match(e){return wr(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Zi(e))return!1;try{var n=e.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(e,n){var r,s=this.getUnhandledRejectionReason(e);return Gc(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var du=function(t,e){var{debugEnabled:n}=e===void 0?{}:e,r={$(s){if(v&&(Ce.DEBUG||M.POSTHOG_DEBUG||n)&&!O(v.console)&&v.console){for(var i=("__rrweb_original__"in v.console[s])?v.console[s].__rrweb_original__:v.console[s],o=arguments.length,a=new Array(o>1?o-1:0),l=1;o>l;l++)a[l-1]=arguments[l];i(t,...a)}},info(){for(var s=arguments.length,i=new Array(s),o=0;s>o;o++)i[o]=arguments[o];r.$("log",...i)},warn(){for(var s=arguments.length,i=new Array(s),o=0;s>o;o++)i[o]=arguments[o];r.$("warn",...i)},error(){for(var s=arguments.length,i=new Array(s),o=0;s>o;o++)i[o]=arguments[o];r.$("error",...i)},critical(){for(var s=arguments.length,i=new Array(s),o=0;s>o;o++)i[o]=arguments[o];console.error(t,...i)},uninitializedWarning(s){r.error("You must initialize PostHog before calling "+s)},createLogger:(s,i)=>du(t+" "+s,i)};return r},R=du("[PostHog.js]"),oe=R.createLogger,Hg=oe("[ExternalScriptsLoader]"),Ia=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return Hg.warn(e+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=$==null?void 0:$.querySelectorAll("script");if(r){for(var s,i=function(){if(r[o].src===e){var l=r[o];return l.__posthog_loading_callback_fired?{v:n()}:(l.addEventListener("load",c=>{l.__posthog_loading_callback_fired=!0,n(void 0,c)}),l.onerror=c=>n(c),{v:void 0})}},o=0;r.length>o;o++)if(s=i())return s.v}var a=()=>{if(!$)return n("document not found");var l=$.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=d=>{l.__posthog_loading_callback_fired=!0,n(void 0,d)},l.onerror=d=>n(d),t.config.prepare_external_dependency_script&&(l=t.config.prepare_external_dependency_script(l)),!l)return n("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")$.head.appendChild(l);else{var c,u=$.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):$.body.appendChild(l)}};$!=null&&$.body?a():$==null||$.addEventListener("DOMContentLoaded",a)};M.__PosthogExtensions__=M.__PosthogExtensions__||{},M.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{var r="/static/"+e+".js?v="+t.version;if(e==="remote-config"&&(r="/array/"+t.config.token+"/config.js"),e==="toolbar"){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var i=t.requestRouter.endpointFor("assets",r);Ia(t,i,n)},M.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{var r=t.requestRouter.endpointFor("api",e);Ia(t,r,n)};var hu="$people_distinct_id",kr="$device_id",En="__alias",wn="__timers",Ta="$autocapture_disabled_server_side",ui="$heatmaps_enabled_server_side",Pa="$exception_capture_enabled_server_side",di="$error_tracking_suppression_rules",Ca="$error_tracking_capture_extension_exceptions",$a="$web_vitals_enabled_server_side",pu="$dead_clicks_enabled_server_side",Ra="$product_tours_enabled_server_side",Oa="$web_vitals_allowed_metrics",Xn="$session_recording_remote_config",xr="$sesid",fu="$session_is_sampled",zt="$enabled_feature_flags",Sn="$early_access_features",hi="$feature_flag_details",kn="$stored_person_properties",wt="$stored_group_properties",pi="$surveys",Tn="$flag_call_reported",fi="$flag_call_reported_session_id",_i="$feature_flag_errors",Ir="$feature_flag_evaluated_at",Me="$user_state",gi="$client_session_props",vi="$capture_rate_limit",mi="$initial_campaign_params",yi="$initial_referrer_info",Tr="$initial_person_info",Pr="$epp",_u="__POSTHOG_TOOLBAR__",Zn="$posthog_cookieless",Bg=[hu,En,"__cmpns",wn,"$session_recording_enabled_server_side",ui,xr,zt,di,Me,Sn,hi,wt,kn,pi,Tn,fi,_i,Ir,gi,vi,mi,yi,Pr,Tr],ro="PostHog loadExternalDependency extension not found.",Ve="on_reject",Le="always",Nt="anonymous",Mt="identified",bi="identified_only",Cr="visibilitychange",$r="beforeunload",Ut="$pageview",ms="$pageleave",ys="$identify",Aa="$groupidentify";function Qn(t,e){Y(t)&&t.forEach(e)}function te(t,e){if(!G(t))if(Y(t))t.forEach(e);else if(ag(t))t.forEach((r,s)=>e(r,s));else for(var n in t)qc.call(t,n)&&e(t[n],n)}var ce=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;e>r;r++)n[r-1]=arguments[r];for(var s of n)for(var i in s)s[i]!==void 0&&(t[i]=s[i]);return t};function pr(t){for(var e=Object.keys(t),n=e.length,r=new Array(n);n--;)r[n]=[e[n],t[e[n]]];return r}var Fa=function(t){try{return t()}catch{return}},zg=function(t){return function(){try{for(var e=arguments.length,n=new Array(e),r=0;e>r;r++)n[r]=arguments[r];return t.apply(this,n)}catch(s){R.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),R.critical(s)}}},so=function(t){var e={};return te(t,function(n,r){(fe(n)&&n.length>0||We(n))&&(e[r]=n)}),e},Wg=["herokuapp.com","vercel.app","netlify.app"];function qg(t){var e=t==null?void 0:t.hostname;if(!fe(e))return!1;var n=e.split(".").slice(-2).join(".");for(var r of Wg)if(n===r)return!1;return!0}function he(t,e,n,r){var{capture:s=!1,passive:i=!0}=r??{};t==null||t.addEventListener(e,n,{capture:s,passive:i})}function gu(t){return t.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return We(t)&&isFinite(t)&&Math.floor(t)===t});class Rr{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,r,s){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(s)||0>e||0>n||0>r||0>s||e>0xffffffffffff||n>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=e/Math.pow(2,40),i[1]=e/Math.pow(2,32),i[2]=e/Math.pow(2,24),i[3]=e/Math.pow(2,16),i[4]=e/Math.pow(2,8),i[5]=e,i[6]=112|n>>>8,i[7]=n,i[8]=128|r>>>24,i[9]=r>>>16,i[10]=r>>>8,i[11]=r,i[12]=s>>>24,i[13]=s>>>16,i[14]=s>>>8,i[15]=s,new Rr(i)}toString(){for(var e="",n=0;this.bytes.length>n;n++)e=e+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Rr(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var n=0;16>n;n++){var r=this.bytes[n]-e.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class Gg{constructor(){this.k=0,this.R=0,this.P=new Vg}generate(){var e=this.generateOrAbort();if(O(e)){this.k=0;var n=this.generateOrAbort();if(O(n))throw new Error("Could not generate UUID after timestamp reset");return n}return e}generateOrAbort(){var e=Date.now();if(e>this.k)this.k=e,this.O();else{if(this.k>=e+1e4)return;this.R++,this.R>4398046511103&&(this.k++,this.O())}return Rr.fromFieldsV7(this.k,Math.trunc(this.R/Math.pow(2,30)),this.R&Math.pow(2,30)-1,this.P.nextUint32())}O(){this.R=1024*this.P.nextUint32()+(1023&this.P.nextUint32())}}var Na,vu=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};v&&!O(v.crypto)&&crypto.getRandomValues&&(vu=t=>crypto.getRandomValues(t));class Vg{constructor(){this.I=new Uint32Array(8),this.C=1/0}nextUint32(){return this.I.length>this.C||(vu(this.I),this.C=0),this.I[this.C++]}}var ht=()=>Yg().toString(),Yg=()=>(Na||(Na=new Gg)).generate(),un="",Kg=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,He={F:()=>!!$,A(t){R.error("cookieStore error: "+t)},M(t){if($){try{for(var e=t+"=",n=$.cookie.split(";").filter(i=>i.length),r=0;n.length>r;r++){for(var s=n[r];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}},D(t){var e;try{e=JSON.parse(He.M(t))||{}}catch{}return e},L(t,e,n,r,s){if($)try{var i="",o="",a=function(u,d){if(d){var p=function(g,_){if(_===void 0&&(_=$),un)return un;if(!_||["localhost","127.0.0.1"].includes(g))return"";for(var P=g.split("."),m=Math.min(P.length,8),b="dmn_chk_"+ht();!un&&m--;){var C=P.slice(m).join("."),x=b+"=1;domain=."+C+";path=/";_.cookie=x+";max-age=3",_.cookie.includes(b)&&(_.cookie=x+";max-age=0",un=C)}return un}(u);if(!p){var f=(g=>{var _=g.match(Kg);return _?_[0]:""})(u);f!==p&&R.info("Warning: cookie subdomain discovery mismatch",f,p),p=f}return p?"; domain=."+p:""}return""}($.location.hostname,r);if(n){var l=new Date;l.setTime(l.getTime()+864e5*n),i="; expires="+l.toUTCString()}s&&(o="; secure");var c=t+"="+encodeURIComponent(JSON.stringify(e))+i+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&R.warn("cookieStore warning: large cookie, len="+c.length),$.cookie=c,c}catch{return}},U(t,e){if($!=null&&$.cookie)try{He.L(t,"",-1,e)}catch{return}}},bs=null,se={F(){if(!rt(bs))return bs;var t=!0;if(O(v))t=!1;else try{var e="__mplssupport__";se.L(e,"xyz"),se.M(e)!=='"xyz"'&&(t=!1),se.U(e)}catch{t=!1}return t||R.error("localStorage unsupported; falling back to cookie store"),bs=t,t},A(t){R.error("localStorage error: "+t)},M(t){try{return v==null?void 0:v.localStorage.getItem(t)}catch(e){se.A(e)}return null},D(t){try{return JSON.parse(se.M(t))||{}}catch{}return null},L(t,e){try{v==null||v.localStorage.setItem(t,JSON.stringify(e))}catch(n){se.A(n)}},U(t){try{v==null||v.localStorage.removeItem(t)}catch(e){se.A(e)}}},Jg=[kr,"distinct_id",xr,fu,Pr,Tr,Me],er={},Xg={F:()=>!0,A(t){R.error("memoryStorage error: "+t)},M:t=>er[t]||null,D:t=>er[t]||null,L(t,e){er[t]=e},U(t){delete er[t]}},yt=null,me={F(){if(!rt(yt))return yt;if(yt=!0,O(v))yt=!1;else try{var t="__support__";me.L(t,"xyz"),me.M(t)!=='"xyz"'&&(yt=!1),me.U(t)}catch{yt=!1}return yt},A(t){R.error("sessionStorage error: ",t)},M(t){try{return v==null?void 0:v.sessionStorage.getItem(t)}catch(e){me.A(e)}return null},D(t){try{return JSON.parse(me.M(t))||null}catch{}return null},L(t,e){try{v==null||v.sessionStorage.setItem(t,JSON.stringify(e))}catch(n){me.A(n)}},U(t){try{v==null||v.sessionStorage.removeItem(t)}catch(e){me.A(e)}}};class Zg{constructor(e){this._instance=e}get N(){return this._instance.config}get consent(){return this.j()?0:this.B}isOptedOut(){return this.N.cookieless_mode===Le||this.consent===0||this.consent===-1&&(this.N.opt_out_capturing_by_default||this.N.cookieless_mode===Ve)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}optInOut(e){this.H.L(this.q,e?1:0,this.N.cookie_expiration,this.N.cross_subdomain_cookie,this.N.secure_cookie)}reset(){this.H.U(this.q,this.N.cross_subdomain_cookie)}get q(){var{token:e,opt_out_capturing_cookie_prefix:n,consent_persistence_name:r}=this._instance.config;return r||(n?n+e:"__ph_opt_in_out_"+e)}get B(){var e=this.H.M(this.q);return _s(e)?1:q(ug,e)?0:-1}get H(){if(!this.W){var e=this.N.opt_out_capturing_persistence_type;this.W=e==="localStorage"?se:He;var n=e==="localStorage"?He:se;n.M(this.q)&&(this.W.M(this.q)||this.optInOut(_s(n.M(this.q))),n.U(this.q,this.N.cross_subdomain_cookie))}return this.W}j(){return!!this.N.respect_dnt&&[Re==null?void 0:Re.doNotTrack,Re==null?void 0:Re.msDoNotTrack,M.doNotTrack].some(e=>_s(e))}}var tr=oe("[Dead Clicks]"),Qg=()=>!0,ev=t=>{var e,n=!((e=t.instance.persistence)==null||!e.get_property(pu)),r=t.instance.config.capture_dead_clicks;return Xe(r)?r:!!_e(r)||n};class Ma{get lazyLoadedDeadClicksAutocapture(){return this.V}constructor(e,n,r){this.instance=e,this.isEnabled=n,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[pu]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Y(()=>{this.G()}):this.stop()}Y(e){var n,r;(n=M.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture&&e(),(r=M.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",s=>{s?tr.error("failed to load script",s):e()})}G(){var e;if($){if(!this.V&&(e=M.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var n=_e(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.V=M.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.V.start($),tr.info("starting...")}}else tr.error("`document` not found. Cannot start.")}stop(){this.V&&(this.V.stop(),this.V=void 0,tr.info("stopping..."))}}var Es=oe("[SegmentIntegration]"),mu="posthog-js";function yu(t,e){var{organization:n,projectId:r,prefix:s,severityAllowList:i=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var l,c,u,d,p;if(i!=="*"&&!i.includes(a.level)||!t.__loaded)return a;a.tags||(a.tags={});var f=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());a.tags["PostHog Person URL"]=f,t.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var g,_=((l=a.exception)==null?void 0:l.values)||[],P=_.map(b=>T({},b,{stacktrace:b.stacktrace?T({},b.stacktrace,{type:"raw",frames:(b.stacktrace.frames||[]).map(C=>T({},C,{platform:"web:javascript"}))}):void 0})),m={$exception_message:((c=_[0])==null?void 0:c.value)||a.message,$exception_type:(u=_[0])==null?void 0:u.type,$exception_level:a.level,$exception_list:P,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((d=_[0])==null?void 0:d.value)||a.message,$sentry_exception_type:(p=_[0])==null?void 0:p.type,$sentry_tags:a.tags};return n&&r&&(m.$sentry_url=(s||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+a.event_id),o&&((g=t.exceptions)==null||g.sendExceptionEvent(m)),a}}class tv{constructor(e,n,r,s,i,o){this.name=mu,this.setupOnce=function(a){a(yu(e,{organization:n,projectId:r,prefix:s,severityAllowList:i,sendExceptionsToPostHog:o==null||o}))}}}class Da{constructor(e){this.J=(n,r,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength)&&(R.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:s}),this.K=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.X()}X(){var e;this.Z=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.J)}destroy(){var e;(e=this.Z)==null||e.call(this),this.Z=void 0}doPageView(e,n){var r,s=this.tt(e,n);return this.K={pathname:(r=v==null?void 0:v.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var n;return this.tt(e,(n=this.K)==null?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.K)==null?void 0:e.pageViewId}}tt(e,n){var r=this.K;if(!r)return{$pageview_id:n};var s={$pageview_id:n,$prev_pageview_id:r.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:l,maxContentHeight:c,lastContentY:u,maxContentY:d}=i;if(!(O(o)||O(a)||O(l)||O(c)||O(u)||O(d))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),d=Math.ceil(d);var p=o>1?ze(a/o,0,1,R):1,f=o>1?ze(l/o,0,1,R):1,g=c>1?ze(u/c,0,1,R):1,_=c>1?ze(d/c,0,1,R):1;s=ce(s,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:g,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:_})}}return r.pathname&&(s.$prev_pageview_pathname=r.pathname),r.timestamp&&(s.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),s}}var Or=t=>{var e=$==null?void 0:$.createElement("a");return O(e)?null:(e.href=t,e)},Ar=function(t,e){for(var n,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var i=r[s].split("=");if(i[0]===e){n=i;break}}if(!Y(n)||2>n.length)return"";var o=n[1];try{o=decodeURIComponent(o)}catch{R.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Mn=function(t,e,n){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],i=(r[0]||"").split("?"),o=i[1],a=i[0],l=(o||"").split("&"),c=[],u=0;l.length>u;u++){var d=l[u].split("=");Y(d)&&(e.includes(d[0])?c.push(d[0]+"="+n):c.push(l[u]))}var p=a;return o!=null&&(p+="?"+c.join("&")),s!=null&&(p+="#"+s),p},Fr=function(t,e){var n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},nr="https?://(.*)",tn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],nv=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...tn],Dn="<masked>",rv=["li_fat_id"];function bu(t,e,n){if(!$)return{};var r,s=e?[...tn,...n||[]]:[],i=Eu(Mn($.URL,s,Dn),t),o=(r={},te(rv,function(a){var l=He.M(a);r[a]=l||null}),r);return ce(o,i)}function Eu(t,e){var n=nv.concat(e||[]),r={};return te(n,function(s){var i=Ar(t,s);r[s]=i||null}),r}function wu(t){var e=function(i){return i?i.search(nr+"google.([^/?]*)")===0?"google":i.search(nr+"bing.com")===0?"bing":i.search(nr+"yahoo.com")===0?"yahoo":i.search(nr+"duckduckgo.com")===0?"duckduckgo":null:null}(t),n=e!="yahoo"?"q":"p",r={};if(!rt(e)){r.$search_engine=e;var s=$?Ar($.referrer,n):"";s.length&&(r.ph_keyword=s)}return r}function La(){return navigator.language||navigator.userLanguage}var Nr="$direct";function Su(){return($==null?void 0:$.referrer)||Nr}function ku(t,e){var n=t?[...tn,...e||[]]:[],r=ve==null?void 0:ve.href.substring(0,1e3);return{r:Su().substring(0,1e3),u:r?Mn(r,n,Dn):void 0}}function xu(t){var e,{r:n,u:r}=t,s={$referrer:n,$referring_domain:n==null?void 0:n==Nr?Nr:(e=Or(n))==null?void 0:e.host};if(r){s.$current_url=r;var i=Or(r);s.$host=i==null?void 0:i.host,s.$pathname=i==null?void 0:i.pathname;var o=Eu(r);ce(s,o)}if(n){var a=wu(n);ce(s,a)}return s}function Iu(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function sv(){try{return new Date().getTimezoneOffset()}catch{return}}var iv=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class ws{constructor(e,n){this.N=e,this.props={},this.it=!1,this.et=(r=>{var s="";return r.token&&(s=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+s+"_posthog"})(e),this.H=this.rt(e),this.load(),e.debug&&R.info("Persistence loaded",e.persistence,T({},this.props)),this.update_config(e,e,n),this.save()}isDisabled(){return!!this.st}rt(e){iv.indexOf(e.persistence.toLowerCase())===-1&&(R.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n=function(s){s===void 0&&(s=[]);var i=[...Jg,...s];return T({},se,{D(o){try{var a={};try{a=He.D(o)||{}}catch{}var l=ce(a,JSON.parse(se.M(o)||"{}"));return se.L(o,l),l}catch{}return null},L(o,a,l,c,u,d){try{se.L(o,a,void 0,void 0,d);var p={};i.forEach(f=>{a[f]&&(p[f]=a[f])}),Object.keys(p).length&&He.L(o,p,l,c,u,d)}catch(f){se.A(f)}},U(o,a){try{v==null||v.localStorage.removeItem(o),He.U(o,a)}catch(l){se.A(l)}}})}(e.cookie_persisted_properties||[]),r=e.persistence.toLowerCase();return r==="localstorage"&&se.F()?se:r==="localstorage+cookie"&&n.F()?n:r==="sessionstorage"&&me.F()?me:r==="memory"?Xg:r==="cookie"?He:n.F()?n:He}nt(e){var n=e??this.N.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var r=this.props[Ir];return!r||typeof r!="number"||Date.now()-r>n}properties(){var e={};return te(this.props,(n,r)=>{if(r===zt&&_e(n)){if(!this.nt())for(var s=Object.keys(n),i=0;s.length>i;i++)e["$feature/"+s[i]]=n[s[i]]}else Bg.indexOf(r)===-1&&(e[r]=n)}),e}load(){if(!this.st){var e=this.H.D(this.et);e&&(this.props=ce({},e))}}save(){this.st||this.H.L(this.et,this.props,this.ot,this.ut,this.ht,this.N.debug)}remove(){this.H.U(this.et,!1),this.H.U(this.et,!0)}clear(){this.remove(),this.props={}}register_once(e,n,r){if(_e(e)){O(n)&&(n="None"),this.ot=O(r)?this.dt:r;var s=!1;if(te(e,(i,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==n||(this.props[o]=i,s=!0)}),s)return this.save(),!0}return!1}register(e,n){if(_e(e)){this.ot=O(n)?this.dt:n;var r=!1;if(te(e,(s,i)=>{e.hasOwnProperty(i)&&this.props[i]!==s&&(this.props[i]=s,r=!0)}),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.it){var e=bu(this.N.custom_campaign_params,this.N.mask_personal_data_properties,this.N.custom_personal_data_properties);Bt(so(e))||this.register(e),this.it=!0}}update_search_keyword(){var e;this.register((e=$==null?void 0:$.referrer)?wu(e):{})}update_referrer_info(){var e;this.register_once({$referrer:Su(),$referring_domain:$!=null&&$.referrer&&((e=Or($.referrer))==null?void 0:e.host)||Nr},void 0)}set_initial_person_info(){this.props[mi]||this.props[yi]||this.register_once({[Tr]:ku(this.N.mask_personal_data_properties,this.N.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};te([yi,mi],o=>{var a=this.props[o];a&&te(a,function(l,c){e["$initial_"+ii(c)]=l})});var n,r,s=this.props[Tr];if(s){var i=(n=xu(s),r={},te(n,function(o,a){r["$initial_"+ii(a)]=o}),r);ce(e,i)}return e}safe_merge(e){return te(this.props,function(n,r){r in e||(e[r]=n)}),e}update_config(e,n,r){if(this.dt=this.ot=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==n.persistence||!((o,a)=>{if(o.length!==a.length)return!1;var l=[...o].sort(),c=[...a].sort();return l.every((u,d)=>u===c[d])})(e.cookie_persisted_properties||[],n.cookie_persisted_properties||[])){var s=this.rt(e),i=this.props;this.clear(),this.H=s,this.props=i,this.save()}}set_disabled(e){this.st=e,this.st?this.remove():this.save()}set_cross_subdomain(e){e!==this.ut&&(this.ut=e,this.remove(),this.save())}set_secure(e){e!==this.ht&&(this.ht=e,this.remove(),this.save())}set_event_timer(e,n){var r=this.props[wn]||{};r[e]=n,this.props[wn]=r,this.save()}remove_event_timer(e){var n=(this.props[wn]||{})[e];return O(n)||(delete this.props[wn][e],this.save()),n}get_property(e){return this.props[e]}set_property(e,n){this.props[e]=n,this.save()}}var dn={Activation:"events",Cancellation:"cancelEvents"},Ss={Popover:"popover",API:"api",Widget:"widget"},xn={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},ks={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Ei={Popover:"popover",Inline:"inline"},ov={SHOWN:"product tour shown"},ja={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Ua=oe("[RateLimiter]");class av{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var r=n.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach(s=>{Ua.info((s||"events")+" is quota limited."),this.serverLimits[s]=new Date().getTime()+6e4})}catch(s){return void Ua.warn('could not rate limit - continuing. Error: "'+(s==null?void 0:s.message)+'"',{text:r})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var n,r,s;e===void 0&&(e=!1);var{captureEventsBurstLimit:i,captureEventsPerSecond:o}=this,a=new Date().getTime(),l=(n=(r=this.instance.persistence)==null?void 0:r.get_property(vi))!==null&&n!==void 0?n:{tokens:i,last:a};l.tokens+=(a-l.last)/1e3*o,l.last=a,l.tokens>i&&(l.tokens=i);var c=1>l.tokens;return c||e||(l.tokens=Math.max(0,l.tokens-1)),!c||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+o+" events per second and "+i+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=c,(s=this.instance.persistence)==null||s.set_property(vi,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var hn=oe("[RemoteConfig]");class Tu{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=M._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}vt(e){var n,r;(n=M.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=M.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}ct(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){e(n.json)}})}load(){try{if(this.remoteConfig)return hn.info("Using preloaded remote config",this.remoteConfig),this.ft(this.remoteConfig),void this._t();if(this._instance.bt())return void hn.warn("Remote config is disabled. Falling back to local config.");this.vt(e=>{if(!e)return hn.info("No config found after loading remote JS config. Falling back to JSON."),void this.ct(n=>{this.ft(n),this._t()});this.ft(e),this._t()})}catch(e){hn.error("Error loading remote config",e)}}stop(){this.yt&&(clearInterval(this.yt),this.yt=void 0)}refresh(){this._instance.bt()||($==null?void 0:$.visibilityState)==="hidden"||this._instance.reloadFeatureFlags()}_t(){var e;if(!this.yt){var n=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;n!==0&&(this.yt=setInterval(()=>{this.refresh()},n))}}ft(e){var n;e||hn.error("Failed to fetch remote config from PostHog."),this._instance.ft(e??{}),(e==null?void 0:e.hasFeatureFlags)!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded())}}var Ue={GZipJS:"gzip-js",Base64:"base64"},Ne=Uint8Array,Te=Uint16Array,nn=Uint32Array,io=new Ne([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),oo=new Ne([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ha=new Ne([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Pu=function(t,e){for(var n=new Te(31),r=0;31>r;++r)n[r]=e+=1<<t[r-1];var s=new nn(n[30]);for(r=1;30>r;++r)for(var i=n[r];n[r+1]>i;++i)s[i]=i-n[r]<<5|r;return[n,s]},Cu=Pu(io,2),wi=Cu[1];Cu[0][28]=258,wi[258]=28;for(var Ba=Pu(oo,0)[1],$u=new Te(32768),ne=0;32768>ne;++ne){var Dt=(43690&ne)>>>1|(21845&ne)<<1;$u[ne]=((65280&(Dt=(61680&(Dt=(52428&Dt)>>>2|(13107&Dt)<<2))>>>4|(3855&Dt)<<4))>>>8|(255&Dt)<<8)>>>1}var Pn=function(t,e,n){for(var r=t.length,s=0,i=new Te(e);r>s;++s)++i[t[s]-1];var o,a=new Te(e);for(s=0;e>s;++s)a[s]=a[s-1]+i[s-1]<<1;for(o=new Te(r),s=0;r>s;++s)o[s]=$u[a[t[s]-1]++]>>>15-t[s];return o},$t=new Ne(288);for(ne=0;144>ne;++ne)$t[ne]=8;for(ne=144;256>ne;++ne)$t[ne]=9;for(ne=256;280>ne;++ne)$t[ne]=7;for(ne=280;288>ne;++ne)$t[ne]=8;var Mr=new Ne(32);for(ne=0;32>ne;++ne)Mr[ne]=5;var lv=Pn($t,9),cv=Pn(Mr,5),Ru=function(t){return(t/8>>0)+(7&t&&1)},Ou=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var r=new(t instanceof Te?Te:t instanceof nn?nn:Ne)(n-e);return r.set(t.subarray(e,n)),r},Ge=function(t,e,n){var r=e/8>>0;t[r]|=n<<=7&e,t[r+1]|=n>>>8},pn=function(t,e,n){var r=e/8>>0;t[r]|=n<<=7&e,t[r+1]|=n>>>8,t[r+2]|=n>>>16},xs=function(t,e){for(var n=[],r=0;t.length>r;++r)t[r]&&n.push({s:r,f:t[r]});var s=n.length,i=n.slice();if(!s)return[new Ne(0),0];if(s==1){var o=new Ne(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(S,k){return S.f-k.f}),n.push({s:-1,f:25001});var a=n[0],l=n[1],c=0,u=1,d=2;for(n[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=n[n[d].f>n[c].f?c++:d++],l=n[c!=u&&n[d].f>n[c].f?c++:d++],n[u++]={s:-1,f:a.f+l.f,l:a,r:l};var p=i[0].s;for(r=1;s>r;++r)i[r].s>p&&(p=i[r].s);var f=new Te(p+1),g=Si(n[u-1],f,0);if(g>e){r=0;var _=0,P=g-e,m=1<<P;for(i.sort(function(S,k){return f[k.s]-f[S.s]||S.f-k.f});s>r;++r){var b=i[r].s;if(e>=f[b])break;_+=m-(1<<g-f[b]),f[b]=e}for(_>>>=P;_>0;){var C=i[r].s;e>f[C]?_-=1<<e-f[C]++-1:++r}for(;r>=0&&_;--r){var x=i[r].s;f[x]==e&&(--f[x],++_)}g=e}return[new Ne(f),g]},Si=function(t,e,n){return t.s==-1?Math.max(Si(t.l,e,n+1),Si(t.r,e,n+1)):e[t.s]=n},za=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new Te(++e),r=0,s=t[0],i=1,o=function(l){n[r++]=l},a=1;e>=a;++a)if(t[a]==s&&a!=e)++i;else{if(!s&&i>2){for(;i>138;i-=138)o(32754);i>2&&(o(i>10?i-11<<5|28690:i-3<<5|12305),i=0)}else if(i>3){for(o(s),--i;i>6;i-=6)o(8304);i>2&&(o(i-3<<5|8208),i=0)}for(;i--;)o(s);i=1,s=t[a]}return[n.subarray(0,r),e]},fn=function(t,e){for(var n=0,r=0;e.length>r;++r)n+=t[r]*e[r];return n},ki=function(t,e,n){var r=n.length,s=Ru(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var i=0;r>i;++i)t[s+i+4]=n[i];return 8*(s+4+r)},Wa=function(t,e,n,r,s,i,o,a,l,c,u){Ge(e,u++,n),++s[256];for(var d=xs(s,15),p=d[0],f=d[1],g=xs(i,15),_=g[0],P=g[1],m=za(p),b=m[0],C=m[1],x=za(_),S=x[0],k=x[1],w=new Te(19),E=0;b.length>E;++E)w[31&b[E]]++;for(E=0;S.length>E;++E)w[31&S[E]]++;for(var I=xs(w,7),A=I[0],j=I[1],F=19;F>4&&!A[Ha[F-1]];--F);var H,B,K,Z,N=c+5<<3,z=fn(s,$t)+fn(i,Mr)+o,ee=fn(s,p)+fn(i,_)+o+14+3*F+fn(w,A)+(2*w[16]+3*w[17]+7*w[18]);if(z>=N&&ee>=N)return ki(e,u,t.subarray(l,l+c));if(Ge(e,u,1+(z>ee)),u+=2,z>ee){H=Pn(p,f),B=p,K=Pn(_,P),Z=_;var V=Pn(A,j);for(Ge(e,u,C-257),Ge(e,u+5,k-1),Ge(e,u+10,F-4),u+=14,E=0;F>E;++E)Ge(e,u+3*E,A[Ha[E]]);u+=3*F;for(var le=[b,S],D=0;2>D;++D){var y=le[D];for(E=0;y.length>E;++E)Ge(e,u,V[X=31&y[E]]),u+=A[X],X>15&&(Ge(e,u,y[E]>>>5&127),u+=y[E]>>>12)}}else H=lv,B=$t,K=cv,Z=Mr;for(E=0;a>E;++E)if(r[E]>255){var X;pn(e,u,H[257+(X=r[E]>>>18&31)]),u+=B[X+257],X>7&&(Ge(e,u,r[E]>>>23&31),u+=io[X]);var de=31&r[E];pn(e,u,K[de]),u+=Z[de],de>3&&(pn(e,u,r[E]>>>5&8191),u+=oo[de])}else pn(e,u,H[r[E]]),u+=B[r[E]];return pn(e,u,H[256]),u+B[256]},uv=new nn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),dv=function(){for(var t=new nn(256),e=0;256>e;++e){for(var n=e,r=9;--r;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),Is=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function hv(t,e){e===void 0&&(e={});var n=function(){var d=4294967295;return{p(p){for(var f=d,g=0;p.length>g;++g)f=dv[255&f^p[g]]^f>>>8;d=f},d(){return 4294967295^d}}}(),r=t.length;n.p(t);var s,i,o,a,l,c=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,function(d,p,f,g,_,P){var m=d.length,b=new Ne(g+m+5*(1+Math.floor(m/7e3))+_),C=b.subarray(g,b.length-_),x=0;if(!p||8>m)for(var S=0;m>=S;S+=65535){var k=S+65535;m>k?x=ki(C,x,d.subarray(S,k)):(C[S]=!0,x=ki(C,x,d.subarray(S,m)))}else{for(var w=uv[p-1],E=w>>>13,I=8191&w,A=(1<<f)-1,j=new Te(32768),F=new Te(A+1),H=Math.ceil(f/3),B=2*H,K=function(is){return(d[is]^d[is+1]<<H^d[is+2]<<B)&A},Z=new nn(25e3),N=new Te(288),z=new Te(32),ee=0,V=0,le=(S=0,0),D=0,y=0;m>S;++S){var X=K(S),de=32767&S,ye=F[X];if(j[de]=ye,F[X]=de,S>=D){var xe=m-S;if((ee>7e3||le>24576)&&xe>423){x=Wa(d,C,0,Z,N,z,V,le,y,S-y,x),le=ee=V=0,y=S;for(var Pe=0;286>Pe;++Pe)N[Pe]=0;for(Pe=0;30>Pe;++Pe)z[Pe]=0}var mt=2,qn=0,Ju=I,st=de-ye&32767;if(xe>2&&X==K(S-st))for(var Xu=Math.min(E,xe)-1,Zu=Math.min(32767,S),Qu=Math.min(258,xe);Zu>=st&&--Ju&&de!=ye;){if(d[S+mt]==d[S+mt-st]){for(var it=0;Qu>it&&d[S+it]==d[S+it-st];++it);if(it>mt){if(mt=it,qn=st,it>Xu)break;var ed=Math.min(st,it-2),ho=0;for(Pe=0;ed>Pe;++Pe){var ss=S-st+Pe+32768&32767,po=ss-j[ss]+32768&32767;po>ho&&(ho=po,ye=ss)}}}st+=(de=ye)-(ye=j[de])+32768&32767}if(qn){Z[le++]=268435456|wi[mt]<<18|Ba[qn];var fo=31&wi[mt],_o=31&Ba[qn];V+=io[fo]+oo[_o],++N[257+fo],++z[_o],D=S+mt,++ee}else Z[le++]=d[S],++N[d[S]]}}x=Wa(d,C,!0,Z,N,z,V,le,y,S-y,x)}return Ou(b,0,g+Ru(x)+_)}(i=t,(o=e).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):12+o.mem,a,l)),u=c.length;return function(d,p){var f=p.filename;if(d[0]=31,d[1]=139,d[2]=8,d[8]=2>p.level?4:p.level==9?2:0,d[9]=3,p.mtime!=0&&Is(d,4,Math.floor(new Date(p.mtime||Date.now())/1e3)),f){d[3]=8;for(var g=0;f.length>=g;++g)d[g+10]=f.charCodeAt(g)}}(c,e),Is(c,u-8,n.d()),Is(c,u-4,r),c}var pv=!!si||!!ri,Au="text/plain",Dr=function(t,e,n){var r;n===void 0&&(n=!0);var[s,i]=t.split("?"),o=T({},e),a=(r=i==null?void 0:i.split("&").map(c=>{var u,[d,p]=c.split("="),f=n&&(u=o[d])!==null&&u!==void 0?u:p;return delete o[d],d+"="+f}))!==null&&r!==void 0?r:[],l=function(c,u){var d,p;u===void 0&&(u="&");var f=[];return te(c,function(g,_){O(g)||O(_)||_==="undefined"||(d=encodeURIComponent((P=>P instanceof File)(g)?g.name:g.toString()),p=encodeURIComponent(_),f[f.length]=p+"="+d)}),f.join(u)}(o);return l&&a.push(l),s+"?"+a.join("&")},Wt=(t,e)=>JSON.stringify(t,(n,r)=>typeof r=="bigint"?r.toString():r,e),Ts=t=>{if(t.wt)return t.wt;var{data:e,compression:n}=t;if(e){if(n===Ue.GZipJS){var r=hv(function(a,l){var c=a.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(a);for(var u=new Ne(a.length+(a.length>>>1)),d=0,p=function(P){u[d++]=P},f=0;c>f;++f){if(d+5>u.length){var g=new Ne(d+8+(c-f<<1));g.set(u),u=g}var _=a.charCodeAt(f);128>_?p(_):2048>_?(p(192|_>>>6),p(128|63&_)):_>55295&&57344>_?(p(240|(_=65536+(1047552&_)|1023&a.charCodeAt(++f))>>>18),p(128|_>>>12&63),p(128|_>>>6&63),p(128|63&_)):(p(224|_>>>12),p(128|_>>>6&63),p(128|63&_))}return Ou(u,0,d)}(Wt(e)),{mtime:0});return{contentType:Au,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===Ue.Base64){var s=function(a){return a&&btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,(l,c)=>String.fromCharCode(parseInt(c,16))))}(Wt(e)),i=(a=>"data="+encodeURIComponent(typeof a=="string"?a:Wt(a)))(s);return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}var o=Wt(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},fv=function(){var t=De(function*(e){var n=Wt(e.data),r=yield function(i,o){return zc.apply(this,arguments)}(n,Ce.DEBUG);if(!r)return e;var s=yield r.arrayBuffer();return T({},e,{wt:{contentType:Au,body:s,estimatedSize:s.byteLength}})});return function(e){return t.apply(this,arguments)}}(),fr=[];ri&&fr.push({transport:"fetch",method(t){var e,n,{contentType:r,body:s,estimatedSize:i}=(e=Ts(t))!==null&&e!==void 0?e:{},o=new Headers;te(t.headers,function(u,d){o.append(d,u)}),r&&o.append("Content-Type",r);var a=t.url,l=null;if(va){var c=new va;l={signal:c.signal,timeout:setTimeout(()=>c.abort(),t.timeout)}}ri(a,T({method:(t==null?void 0:t.method)||"GET",headers:o,keepalive:t.method==="POST"&&52428.8>(i||0),body:s,signal:(n=l)==null?void 0:n.signal},t.fetchOptions)).then(u=>u.text().then(d=>{var p={statusCode:u.status,text:d};if(u.status===200)try{p.json=JSON.parse(d)}catch(f){R.error(f)}t.callback==null||t.callback(p)})).catch(u=>{R.error(u),t.callback==null||t.callback({statusCode:0,error:u})}).finally(()=>l?clearTimeout(l.timeout):null)}}),si&&fr.push({transport:"XHR",method(t){var e,n=new si;n.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=(e=Ts(t))!==null&&e!==void 0?e:{};te(t.headers,function(i,o){n.setRequestHeader(o,i)}),r&&n.setRequestHeader("Content-Type",r),t.timeout&&(n.timeout=t.timeout),t.disableXHRCredentials||(n.withCredentials=!0),n.onreadystatechange=()=>{if(n.readyState===4){var i={statusCode:n.status,text:n.responseText};if(n.status===200)try{i.json=JSON.parse(n.responseText)}catch{}t.callback==null||t.callback(i)}},n.send(s)}}),Re!=null&&Re.sendBeacon&&fr.push({transport:"sendBeacon",method(t){var e=Dr(t.url,{beacon:"1"});try{var n,{contentType:r,body:s}=(n=Ts(t))!==null&&n!==void 0?n:{},i=typeof s=="string"?new Blob([s],{type:r}):s;Re.sendBeacon(e,i)}catch{}}});var xi=3e3;class _v{constructor(e,n){this.Et=!0,this.St=[],this.xt=ze((n==null?void 0:n.flush_interval_ms)||xi,250,5e3,R.createLogger("flush interval"),xi),this.Tt=e}enqueue(e){this.St.push(e),this.$t||this.kt()}unload(){this.Rt();var e=this.St.length>0?this.Pt():{},n=Object.values(e);[...n.filter(r=>r.url.indexOf("/e")===0),...n.filter(r=>r.url.indexOf("/e")!==0)].map(r=>{this.Tt(T({},r,{transport:"sendBeacon"}))})}enable(){this.Et=!1,this.kt()}kt(){var e=this;this.Et||(this.$t=setTimeout(()=>{if(this.Rt(),this.St.length>0){var n=this.Pt(),r=function(){var i=n[s],o=new Date().getTime();i.data&&Y(i.data)&&te(i.data,a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp}),e.Tt(i)};for(var s in n)r()}},this.xt))}Rt(){clearTimeout(this.$t),this.$t=void 0}Pt(){var e={};return te(this.St,n=>{var r,s=n,i=(s?s.batchKey:null)||s.url;O(e[i])&&(e[i]=T({},s,{data:[]})),(r=e[i].data)==null||r.push(s.data)}),this.St=[],e}}var gv=["retriesPerformedSoFar"];class vv{constructor(e){this.Ot=!1,this.It=3e3,this.St=[],this._instance=e,this.St=[],this.Ct=!0,!O(v)&&"onLine"in v.navigator&&(this.Ct=v.navigator.onLine,this.Ft=()=>{this.Ct=!0,this.At()},this.Mt=()=>{this.Ct=!1},he(v,"online",this.Ft),he(v,"offline",this.Mt))}get length(){return this.St.length}retriableRequest(e){var{retriesPerformedSoFar:n}=e,r=Bc(e,gv);jt(n)&&(r.url=Dr(r.url,{retry_count:n})),this._instance._send_request(T({},r,{callback:s=>{s.statusCode===200||s.statusCode>=400&&500>s.statusCode||(n??0)>=10?r.callback==null||r.callback(s):this.Dt(T({retriesPerformedSoFar:n},r))}}))}Dt(e){var n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var r=function(o){var a=3e3*Math.pow(2,o),l=a/2,c=Math.min(18e5,a),u=Math.random()-.5;return Math.ceil(c+u*(c-l))}(n),s=Date.now()+r;this.St.push({retryAt:s,requestOptions:e});var i="Enqueued failed request for retry in "+r;navigator.onLine||(i+=" (Browser is offline)"),R.warn(i),this.Ot||(this.Ot=!0,this.Lt())}Lt(){if(this.Ut&&clearTimeout(this.Ut),this.St.length===0)return this.Ot=!1,void(this.Ut=void 0);this.Ut=setTimeout(()=>{this.Ct&&this.St.length>0&&this.At(),this.Lt()},this.It)}At(){var e=Date.now(),n=[],r=this.St.filter(i=>e>i.retryAt||(n.push(i),!1));if(this.St=n,r.length>0)for(var{requestOptions:s}of r)this.retriableRequest(s)}unload(){for(var{requestOptions:e}of(this.Ut&&(clearTimeout(this.Ut),this.Ut=void 0),this.Ot=!1,O(v)||(this.Ft&&(v.removeEventListener("online",this.Ft),this.Ft=void 0),this.Mt&&(v.removeEventListener("offline",this.Mt),this.Mt=void 0)),this.St))try{this._instance._send_request(T({},e,{transport:"sendBeacon"}))}catch(n){R.error(n)}this.St=[]}}class mv{constructor(e){this.Nt=()=>{var n,r,s,i;this.jt||(this.jt={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,c=a+((o==null?void 0:o.clientHeight)||0),u=(o==null?void 0:o.scrollHeight)||0;this.jt.lastScrollY=Math.ceil(a),this.jt.maxScrollY=Math.max(a,(n=this.jt.maxScrollY)!==null&&n!==void 0?n:0),this.jt.maxScrollHeight=Math.max(l,(r=this.jt.maxScrollHeight)!==null&&r!==void 0?r:0),this.jt.lastContentY=c,this.jt.maxContentY=Math.max(c,(s=this.jt.maxContentY)!==null&&s!==void 0?s:0),this.jt.maxContentHeight=Math.max(u,(i=this.jt.maxContentHeight)!==null&&i!==void 0?i:0)},this._instance=e}get zt(){return this._instance.config.scroll_root_selector}getContext(){return this.jt}resetContext(){var e=this.jt;return setTimeout(this.Nt,0),e}startMeasuringScrollPosition(){he(v,"scroll",this.Nt,{capture:!0}),he(v,"scrollend",this.Nt,{capture:!0}),he(v,"resize",this.Nt)}scrollElement(){if(!this.zt)return v==null?void 0:v.document.documentElement;var e=Y(this.zt)?this.zt:[this.zt];for(var n of e){var r=v==null?void 0:v.document.querySelector(n);if(r)return r}}scrollY(){if(this.zt){var e=this.scrollElement();return e&&e.scrollTop||0}return v&&(v.scrollY||v.pageYOffset||v.document.documentElement.scrollTop)||0}scrollX(){if(this.zt){var e=this.scrollElement();return e&&e.scrollLeft||0}return v&&(v.scrollX||v.pageXOffset||v.document.documentElement.scrollLeft)||0}}var yv=t=>ku(t==null?void 0:t.config.mask_personal_data_properties,t==null?void 0:t.config.custom_personal_data_properties);class qa{constructor(e,n,r,s){this.Bt=i=>{var o=this.Ht();if(!o||o.sessionId!==i){var a={sessionId:i,props:this.qt(this._instance)};this.Wt.register({[gi]:a})}},this._instance=e,this.Vt=n,this.Wt=r,this.qt=s||yv,this.Vt.onSessionId(this.Bt)}Ht(){return this.Wt.props[gi]}getSetOnceProps(){var e,n=(e=this.Ht())==null?void 0:e.props;return n?"r"in n?xu(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var e={};return te(so(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+ii(r)]=n}),e}}class ao{constructor(){this.Yt={}}on(e,n){return this.Yt[e]||(this.Yt[e]=[]),this.Yt[e].push(n),()=>{this.Yt[e]=this.Yt[e].filter(r=>r!==n)}}emit(e,n){for(var r of this.Yt[e]||[])r(n);for(var s of this.Yt["*"]||[])s(e,n)}}var Ps=oe("[SessionId]");class Ga{on(e,n){return this.Gt.on(e,n)}constructor(e,n,r){var s;if(this.Jt=[],this.Kt=void 0,this.Gt=new ao,this.Xt=(c,u)=>!(!jt(c)||!jt(u))&&Math.abs(c-u)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===Le)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.N=e.config,this.Wt=e.persistence,this.Qt=void 0,this.Zt=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ti=n||ht,this.ii=r||ht;var i=this.N.persistence_name||this.N.token;if(this._sessionTimeoutMs=1e3*ze(this.N.session_idle_timeout_seconds||1800,60,36e3,Ps.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ei(),this.ri="ph_"+i+"_window_id",this.si="ph_"+i+"_primary_window_exists",this.ni()){var o=me.D(this.ri),a=me.D(this.si);o&&!a?this.Qt=o:me.U(this.ri),me.L(this.si,!0)}if((s=this.N.bootstrap)!=null&&s.sessionID)try{var l=(c=>{var u=this.N.bootstrap.sessionID.replace(/-/g,"");if(u.length!==32)throw new Error("Not a valid UUID");if(u[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(u.substring(0,12),16)})();this.oi(this.N.bootstrap.sessionID,new Date().getTime(),l)}catch(c){Ps.error("Invalid sessionID in bootstrap",c)}this.ai()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return O(this.Jt)&&(this.Jt=[]),this.Jt.push(e),this.Zt&&e(this.Zt,this.Qt),()=>{this.Jt=this.Jt.filter(n=>n!==e)}}ni(){return this.N.persistence!=="memory"&&!this.Wt.st&&me.F()}li(e){e!==this.Qt&&(this.Qt=e,this.ni()&&me.L(this.ri,e))}ui(){return this.Qt?this.Qt:this.ni()?me.D(this.ri):null}oi(e,n,r){e===this.Zt&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Zt=e,this.Wt.register({[xr]:[n,e,r]}))}hi(){var e=this.Wt.props[xr];return Y(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.oi(null,null,null)}destroy(){clearTimeout(this.di),this.di=void 0,this.Kt&&v&&(v.removeEventListener($r,this.Kt,{capture:!1}),this.Kt=void 0),this.Jt=[]}ai(){this.Kt=()=>{this.ni()&&me.U(this.si)},he(v,$r,this.Kt,{capture:!1})}checkAndGetSessionAndWindowId(e,n){if(e===void 0&&(e=!1),n===void 0&&(n=null),this.N.cookieless_mode===Le)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),[s,i,o]=this.hi(),a=this.ui(),l=jt(o)&&Math.abs(r-o)>864e5,c=!1,u=!i,d=!u&&!e&&this.Xt(r,s);u||d||l?(i=this.ti(),a=this.ii(),Ps.info("new session ID generated",{sessionId:i,windowId:a,changeReason:{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}}),o=r,c=!0):a||(a=this.ii(),c=!0);var p=jt(s)&&e&&!l?s:r,f=jt(o)?o:new Date().getTime();return this.li(a),this.oi(i,p,f),e||this.ei(),c&&this.Jt.forEach(g=>g(i,a,c?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}:void 0)),{sessionId:i,windowId:a,sessionStartTimestamp:f,changeReason:c?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:s}}ei(){clearTimeout(this.di),this.di=setTimeout(()=>{var[e]=this.hi();if(this.Xt(new Date().getTime(),e)){var n=this.Zt;this.resetSessionId(),this.Gt.emit("forcedIdleReset",{idleSessionId:n})}},1.1*this.sessionTimeoutMs)}}var Fu=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&ba(n,e))return!0;try{var r=t==null?void 0:t.userAgentData;if(r!=null&&r.brands&&r.brands.some(s=>ba(s==null?void 0:s.brand,e)))return!0}catch{}return!!t.webdriver},Lr=function(t,e){if(!function(n){try{new RegExp(n)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function Va(t,e,n){return Wt({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var Nu={exact:(t,e)=>e.some(n=>t.some(r=>n===r)),is_not:(t,e)=>e.every(n=>t.every(r=>n!==r)),regex:(t,e)=>e.some(n=>t.some(r=>Lr(n,r))),not_regex:(t,e)=>e.every(n=>t.every(r=>!Lr(n,r))),icontains:(t,e)=>e.map(rr).some(n=>t.map(rr).some(r=>n.includes(r))),not_icontains:(t,e)=>e.map(rr).every(n=>t.map(rr).every(r=>!n.includes(r))),gt:(t,e)=>e.some(n=>{var r=parseFloat(n);return!isNaN(r)&&t.some(s=>r>parseFloat(s))}),lt:(t,e)=>e.some(n=>{var r=parseFloat(n);return!isNaN(r)&&t.some(s=>r<parseFloat(s))})},rr=t=>t.toLowerCase();function Mu(t,e){return!t||Object.entries(t).every(n=>{var[r,s]=n,i=e==null?void 0:e[r];if(O(i)||rt(i))return!1;var o=[String(i)],a=Nu[s.operator];return!!a&&a(s.values,o)})}var Ii="custom",Ya="i.posthog.com";class bv{constructor(e){this.vi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,n=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+Ya,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.vi[this.apiHost]||(this.vi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":Ii),this.vi[this.apiHost]}endpointFor(e,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),e==="ui")return this.uiHost+n;if(e==="flags")return this.flagsApiHost+n;if(this.region===Ii)return this.apiHost+n;var r=Ya+n;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var Q=oe("[Surveys]"),Ti="seenSurvey_",Ev=(t,e)=>{var n="$survey_"+e+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(n="$survey_"+e+"/"+t.id+"/"+t.current_iteration),n},Ka=t=>((e,n)=>{var r=""+Ti+n.id;return n.current_iteration&&n.current_iteration>0&&(r=""+Ti+n.id+"_"+n.current_iteration),r})(0,t),wv=[Ss.Popover,Ss.Widget,Ss.API],Sv={ignoreConditions:!1,ignoreDelay:!1,displayType:Ei.Popover},kv=oe("[PostHog ExternalIntegrations]"),xv={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Iv{constructor(e){this._instance=e}Y(e,n){var r;(r=M.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,s=>{if(s)return kv.error("failed to load script",s);n()})}startIfEnabledOrStop(){var e=this,n=function(o){var a,l,c;!s||(a=M.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.Y(xv[o],()=>{var u;(u=M.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.start(e._instance)}),!s&&(l=M.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((c=M.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.stop())};for(var[r,s]of Object.entries((i=this._instance.config.integrations)!==null&&i!==void 0?i:{})){var i;n(r)}}}var Cn={},Cs=0,Pi=()=>{},Ja='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',_n="Surveys module not available",Xa="sanitize_properties is deprecated. Use before_send instead",Du="Invalid value for property_denylist config: ",Ht="posthog",Lu=!pv&&(Ie==null?void 0:Ie.indexOf("MSIE"))===-1&&(Ie==null?void 0:Ie.indexOf("Mozilla"))===-1,Za=t=>{var e;return T({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:qg($==null?void 0:$.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Pi,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,debug:ve&&fe(ve==null?void 0:ve.search)&&ve.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(v==null||(e=v.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(n){R.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:bi,before_send:void 0,request_queue_config:{flush_interval_ms:xi},error_tracking:{},_onCapture:Pi,__preview_eager_load_replay:!1},(n=>({rageclick:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(t))},Tv=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],Qa=t=>{var e={};for(var[n,r]of Tv)O(t[n])||(e[r]=t[n]);var s=ce({},e,t);return Y(t.property_blacklist)&&(O(t.property_denylist)?s.property_denylist=t.property_blacklist:Y(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:R.error(Du+t.property_denylist)),s};class Pv{constructor(){this.__forceAllowLocalhost=!1}get ci(){return this.__forceAllowLocalhost}set ci(e){R.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Be{fi(e,n){if(e){var r=this.pi.indexOf(e);r!==-1&&this.pi.splice(r,1)}return this.pi.push(n),n.initialize==null||n.initialize(),n}get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new Pv,this.gi=!1,this.version=Ce.LIB_VERSION,this.mi=new ao,this.pi=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Za(),this.SentryIntegration=tv,this.sentryIntegration=r=>function(s,i){var o=yu(s,i);return{name:mu,processEvent:a=>o(a)}}(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.bi=!1,this.yi=null,this.wi=null,this.Ei=null,this.scrollManager=new mv(this),this.pageViewManager=new Da(this),this.rateLimiter=new av(this),this.requestRouter=new bv(this),this.consent=new Zg(this),this.externalIntegrations=new Iv(this);var n=(e=Be.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(r,s,i)=>{var o=fe(r)?{[r]:s}:r;this.setPersonProperties(o),i==null||i({})},set_once:(r,s,i)=>{var o=fe(r)?{[r]:s}:r;this.setPersonProperties(void 0,o),i==null||i({})}},this.on("eventCaptured",r=>R.info('send "'+(r==null?void 0:r.event)+'"',r))}init(e,n,r){if(r&&r!==Ht){var s,i=(s=Cn[r])!==null&&s!==void 0?s:new Be;return i._init(e,n,r),Cn[r]=i,Cn[Ht][r]=i,i}return this._init(e,n,r)}_init(e,n,r){var s;if(n===void 0&&(n={}),O(e)||hr(e))return R.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.Si(n.debug),this.xi=n,this.Ti=[],n.person_profiles?this.wi=n.person_profiles:n.process_person&&(this.wi=n.process_person),this.set_config(ce({},Za(n.defaults),Qa(n),{name:r,token:e})),this.config.on_xhr_error&&R.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:Ue.GZipJS;var i=this.$i();this.persistence=new ws(this.config,i),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ws(T({},this.config,{persistence:"sessionStorage"}),i);var o=T({},this.persistence.props),a=T({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.ki=new _v(_=>this.Ri(_),this.config.request_queue_config),this.Pi=new vv(this),this.__request_queue=[];var l=this.config.cookieless_mode===Le||this.config.cookieless_mode===Ve&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new Ga(this),this.sessionPropsManager=new qa(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(R.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Oi(l)},0)):(R.info("Initializing extensions synchronously"),this.Oi(l)),Ce.DEBUG=Ce.DEBUG||this.config.debug,Ce.DEBUG&&R.info("Starting in debug mode",{this:this,config:n,thisC:T({},this.config),p:o,s:a}),((s=n.bootstrap)==null?void 0:s.distinctID)!==void 0){var c=n.bootstrap.distinctID,u=this.get_distinct_id(),d=this.persistence.get_property(Me);if(n.bootstrap.isIdentifiedID&&u!=null&&u!==c&&d===Nt)this.identify(c);else if(n.bootstrap.isIdentifiedID&&u!=null&&u!==c&&d===Mt)R.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var p=this.config.get_device_id(ht()),f=n.bootstrap.isIdentifiedID?p:c;this.persistence.set_property(Me,n.bootstrap.isIdentifiedID?Mt:Nt),this.register({distinct_id:c,$device_id:f})}}if(l)this.register_once({distinct_id:Zn,$device_id:null},"");else if(!this.get_distinct_id()){var g=this.config.get_device_id(ht());this.register_once({distinct_id:g,$device_id:g},""),this.persistence.set_property(Me,Nt)}return he(v,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?function(_,P){var m=_.config.segment;if(!m)return P();(function(b,C){var x=b.config.segment;if(!x)return C();var S=w=>{var E=()=>w.anonymousId()||ht();b.config.get_device_id=E,w.id()&&(b.register({distinct_id:w.id(),$device_id:E()}),b.persistence.set_property(Me,Mt)),C()},k=x.user();"then"in k&&Ke(k.then)?k.then(S):S(k)})(_,()=>{m.register((b=>{Promise&&Promise.resolve||Es.warn("This browser does not have Promise support, and can not use the segment integration");var C=(x,S)=>{if(!S)return x;x.event.userId||x.event.anonymousId===b.get_distinct_id()||(Es.info("No userId set, resetting PostHog"),b.reset()),x.event.userId&&x.event.userId!==b.get_distinct_id()&&(Es.info("UserId set, identifying with PostHog"),b.identify(x.event.userId));var k=b.calculateEventProperties(S,x.event.properties);return x.event.properties=Object.assign({},k,x.event.properties),x};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:x=>C(x,x.event.event),page:x=>C(x,Ut),identify:x=>C(x,ys),screen:x=>C(x,"$screen")}})(_)).then(()=>{P()})})}(this,()=>this.Ii()):this.Ii(),Ke(this.config._onCapture)&&this.config._onCapture!==Pi&&(R.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",_=>this.config._onCapture(_.event,_))),this.config.ip&&R.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Oi(e){var n,r,s,i,o,a,l,c=performance.now(),u=T({},Be.__defaultExtensionClasses,this.config.__extensionClasses),d=[];u.featureFlags&&this.pi.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new u.featureFlags(this)),u.exceptions&&this.pi.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new u.exceptions(this)),u.historyAutocapture&&this.pi.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.pi.push(new u.tracingHeaders(this)),u.siteApps&&this.pi.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this.pi.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||d.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),u.autocapture&&this.pi.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.pi.push(this.surveys=(s=this.surveys)!==null&&s!==void 0?s:new u.surveys(this)),u.logs&&this.pi.push(this.logs=(i=this.logs)!==null&&i!==void 0?i:new u.logs(this)),u.conversations&&this.pi.push(this.conversations=(o=this.conversations)!==null&&o!==void 0?o:new u.conversations(this)),u.productTours&&this.pi.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.pi.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.pi.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.pi.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.pi.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,ev)),u.toolbar&&this.pi.push(this.toolbar=(a=this.toolbar)!==null&&a!==void 0?a:new u.toolbar(this)),u.experiments&&this.pi.push(this.experiments=(l=this.experiments)!==null&&l!==void 0?l:new u.experiments(this)),this.pi.forEach(p=>{p.initialize&&d.push(()=>{p.initialize==null||p.initialize()})}),d.push(()=>{if(this.Ci){var p=this.Ci;this.Ci=void 0,this.ft(p)}}),this.Fi(d,c)}Fi(e,n){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&e.length>0)return void setTimeout(()=>{this.Fi(e,n)},0);var r=e.shift();if(r)try{r()}catch(i){R.error("Error initializing extension:",i)}}var s=Math.round(performance.now()-n);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:s}),this.config.__preview_deferred_init_extensions&&R.info("PostHog extensions initialized ("+s+"ms)")}ft(e){var n;if(!$||!$.body)return R.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.ft(e)},500);this.config.__preview_deferred_init_extensions&&(this.Ci=e),this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=q(e.supportedCompression,Ue.GZipJS)?Ue.GZipJS:q(e.supportedCompression,Ue.Base64)?Ue.Base64:void 0),(n=e.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.wi?this.wi:bi}),this.pi.forEach(r=>r.onRemoteConfig==null?void 0:r.onRemoteConfig(e))}Ii(){try{this.config.loaded(this)}catch(r){R.critical("`loaded` function failed",r)}if(this.Ai(),this.config.internal_or_test_user_hostname&&ve!=null&&ve.hostname){var e=ve.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?e===n:n.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.config.cookieless_mode===Le)&&this.Mi()},1),this.Di=new Tu(this),this.Di.load()}Ai(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.ki)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Qn(this.__request_queue,e=>this.Ri(e)),this.__request_queue=[],this.Ai()}_handle_unload(){var e,n,r;(e=this.surveys)==null||e.handlePageUnload(),this.config.request_batching?(this.Li()&&this.capture(ms),(n=this.ki)==null||n.unload(),(r=this.Pi)==null||r.unload()):this.Li()&&this.capture(ms,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Lu?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Dr(e.url,{ip:this.config.ip?1:0}),e.headers=T({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(n=>{var r,s,i,o=T({},n);o.timeout=o.timeout||6e4,o.url=Dr(o.url,{_:new Date().getTime().toString(),ver:Ce.JS_SDK_VERSION,compression:o.compression});var a=(r=o.transport)!==null&&r!==void 0?r:"fetch",l=fr.filter(u=>!o.disableTransport||!u.transport||!o.disableTransport.includes(u.transport)),c=(s=(i=function(u,d){for(var p=0;u.length>p;p++)if(u[p].transport===a)return u[p]}(l))==null?void 0:i.method)!==null&&s!==void 0?s:l[0].method;if(!c)throw new Error("No available transport method");a!=="sendBeacon"&&o.data&&o.compression===Ue.GZipJS&&sg?fv(o).then(u=>{c(u)}).catch(()=>{c(o)}):c(o)})(T({},e,{callback:n=>{var r,s;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(r=(s=this.config).on_request_error)==null||r.call(s,n),e.callback==null||e.callback(n)}}))))}Ri(e){this.Pi?this.Pi.retriableRequest(e):this._send_request(e)}_execute_array(e){Cs++;try{var n,r=[],s=[],i=[];Qn(e,a=>{a&&(Y(n=a[0])?i.push(a):Ke(a)?a.call(this):Y(a)&&n==="alias"?r.push(a):Y(a)&&n.indexOf("capture")!==-1&&Ke(this[n])?i.push(a):s.push(a))});var o=function(a,l){Qn(a,function(c){if(Y(c[0])){var u=l;te(c,function(d){u=u[d[0]].apply(u,d.slice(1))})}else l[c[0]].apply(l,c.slice(1))})};o(r,this),o(s,this),o(i,this)}finally{Cs--}}push(e){if(Cs>0&&Y(e)&&fe(e[0])){var n=Be.prototype[e[0]];Ke(n)&&n.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,n,r){var s,i,o,a,l,c;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.ki){if(this.is_capturing())if(!O(e)&&fe(e)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var d=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(d==null||!d.isRateLimited){n!=null&&n.$current_url&&!fe(n==null?void 0:n.$current_url)&&(R.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),e!=="$exception"||r!=null&&r.Ui||R.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var p=new Date,f=(r==null?void 0:r.timestamp)||p,g=ht(),_={uuid:g,event:e,properties:this.calculateEventProperties(e,n||{},f,g)};e===Ut&&this.config.__preview_capture_bot_pageviews&&u&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),d&&(_.properties.$lib_rate_limit_remaining_tokens=d.remainingTokens),r!=null&&r.$set&&(_.$set=r==null?void 0:r.$set);var P,m=this.Ni(r==null?void 0:r.$set_once,e!==Aa,e===ys);if(m&&(_.$set_once=m),(i=_,o=r!=null&&r._noTruncate?null:this.config.properties_string_max_length,a=i,l=E=>fe(E)&&!rt(o)?E.slice(0,o):E,c=new Set,_=function E(I,A){return I!==Object(I)?l?l(I):I:c.has(I)?void 0:(c.add(I),Y(I)?(j=[],Qn(I,F=>{j.push(E(F))})):(j={},te(I,(F,H)=>{c.has(F)||(j[H]=E(F))})),j);var j}(a)).timestamp=f,O(r==null?void 0:r.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=p),e===xn.DISMISSED||e===xn.SENT){var b=n==null?void 0:n[ks.SURVEY_ID],C=n==null?void 0:n[ks.SURVEY_ITERATION];P={id:b,current_iteration:C},localStorage.getItem(Ka(P))||localStorage.setItem(Ka(P),"true"),_.$set=T({},_.$set,{[Ev({id:b,current_iteration:C},e===xn.SENT?"responded":"dismissed")]:!0})}else e===xn.SHOWN&&(_.$set=T({},_.$set,{[ks.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===ov.SHOWN){var x=n==null?void 0:n[ja.TOUR_TYPE];x&&(_.$set=T({},_.$set,{[ja.TOUR_LAST_SEEN_DATE+"/"+x]:new Date().toISOString()}))}var S=T({},_.properties.$set,_.$set);if(Bt(S)||this.setPersonPropertiesForFlags(S),!G(this.config.before_send)){var k=this.ji(_);if(!k)return;_=k}this.mi.emit("eventCaptured",_);var w={method:"POST",url:(s=r==null?void 0:r._url)!==null&&s!==void 0?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:_,compression:"best-available",batchKey:r==null?void 0:r._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Ri(w):this.ki.enqueue(w),_}R.critical("This capture call is ignored due to client rate limiting.")}}else R.error("No event name provided to posthog.capture")}else R.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",n=>e(n.event,n))}calculateEventProperties(e,n,r,s,i){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var o=i?void 0:this.persistence.remove_event_timer(e),a=T({},n);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,(this.config.cookieless_mode==Le||this.config.cookieless_mode==Ve&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),e==="$snapshot"){var l=T({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!fe(a.distinct_id)&&!We(a.distinct_id)||hr(a.distinct_id))&&R.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=function(m,b){var C,x,S,k;if(!Ie)return{};var w,E,I,A,j,F,H,B,K=m?[...tn,...b||[]]:[],[Z,N]=function(z){for(var ee=0;Sa.length>ee;ee++){var[V,le]=Sa[ee],D=V.exec(z),y=D&&(Ke(le)?le(D,z):le);if(y)return y}return["",""]}(Ie);return ce(so({$os:Z,$os_version:N,$browser:lu(Ie,navigator.vendor),$device:ka(Ie),$device_type:(E=Ie,I={userAgentDataPlatform:(C=navigator)==null||(C=C.userAgentData)==null?void 0:C.platform,maxTouchPoints:(x=navigator)==null?void 0:x.maxTouchPoints,screenWidth:v==null||(S=v.screen)==null?void 0:S.width,screenHeight:v==null||(k=v.screen)==null?void 0:k.height,devicePixelRatio:v==null?void 0:v.devicePixelRatio},B=ka(E),B===Yc||B===Vc||B==="Kobo"||B==="Kindle Fire"||B===au?Zt:B===Fn||B===Gt||B===Nn||B===ai?"Console":B===Jc?"Wearable":B?Oe:(I==null?void 0:I.userAgentDataPlatform)==="Android"&&((A=I==null?void 0:I.maxTouchPoints)!==null&&A!==void 0?A:0)>0?600>Math.min((j=I==null?void 0:I.screenWidth)!==null&&j!==void 0?j:0,(F=I==null?void 0:I.screenHeight)!==null&&F!==void 0?F:0)/((H=I==null?void 0:I.devicePixelRatio)!==null&&H!==void 0?H:1)?Oe:Zt:"Desktop"),$timezone:Iu(),$timezone_offset:sv()}),{$current_url:Mn(ve==null?void 0:ve.href,K,Dn),$host:ve==null?void 0:ve.host,$pathname:ve==null?void 0:ve.pathname,$raw_user_agent:Ie.length>1e3?Ie.substring(0,997)+"...":Ie,$browser_version:bg(Ie,navigator.vendor),$browser_language:La(),$browser_language_prefix:(w=La(),typeof w=="string"?w.split("-")[0]:void 0),$screen_height:v==null?void 0:v.screen.height,$screen_width:v==null?void 0:v.screen.width,$viewport_height:v==null?void 0:v.innerHeight,$viewport_width:v==null?void 0:v.innerWidth,$lib:Ce.LIB_NAME,$lib_version:Ce.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:d,windowId:p}=this.sessionManager.checkAndGetSessionAndWindowId(i,r.getTime());a.$session_id=d,a.$window_id=p}this.sessionPropsManager&&ce(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&ce(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this.Pi)==null?void 0:f.length}catch(m){a.$sdk_debug_error_capturing_properties=String(m)}if(this.requestRouter.region===Ii&&(a.$lib_custom_api_host=this.config.api_host),c=e!==Ut||i?e!==ms||i?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),a=ce(a,c),e===Ut&&$&&(a.title=$.title),!O(o)){var g=r.getTime()-o;a.$duration=parseFloat((g/1e3).toFixed(3))}Ie&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=ce({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),Y(this.config.property_denylist)?te(this.config.property_denylist,function(m){delete a[m]}):R.error(Du+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(R.error(Xa),a=_(a,e));var P=this.zi();return a.$process_person_profile=P,P&&!i&&this.Bi("_calculate_event_properties"),a}Ni(e,n,r){var s;if(n===void 0&&(n=!0),r===void 0&&(r=!1),!this.persistence||!this.zi()||this.gi&&!r)return e;var i=this.persistence.get_initial_props(),o=(s=this.sessionPropsManager)==null?void 0:s.getSetOnceProps(),a=ce({},i,o||{},e||{}),l=this.config.sanitize_properties;return l&&(R.error(Xa),a=l(a,"$set_once")),n&&(this.gi=!0),Bt(a)?void 0:a}register(e,n){var r;(r=this.persistence)==null||r.register(e,n)}register_once(e,n,r){var s;(s=this.persistence)==null||s.register_once(e,n,r)}register_for_session(e){var n;(n=this.sessionPersistence)==null||n.register(e)}unregister(e){var n;(n=this.persistence)==null||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)==null||n.unregister(e)}Hi(e,n){this.register({[e]:n})}getFeatureFlag(e,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(e,n)}isFeatureEnabled(e,n){var r;return(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(e,n)}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,n,r){var s;(s=this.featureFlags)==null||s.updateFlags(e,n,r)}updateEarlyAccessFeatureEnrollment(e,n,r){var s;(s=this.featureFlags)==null||s.updateEarlyAccessFeatureEnrollment(e,n,r)}getEarlyAccessFeatures(e,n,r){var s;return n===void 0&&(n=!1),(s=this.featureFlags)==null?void 0:s.getEarlyAccessFeatures(e,n,r)}on(e,n){return this.mi.on(e,n)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:_n}),()=>{})}onSessionId(e){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(e,n):e([],{isLoaded:!1,error:_n})}getActiveMatchingSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:_n})}renderSurvey(e,n){var r;(r=this.surveys)==null||r.renderSurvey(e,n)}displaySurvey(e,n){var r;n===void 0&&(n=Sv),(r=this.surveys)==null||r.displaySurvey(e,n)}cancelPendingSurvey(e){var n;(n=this.surveys)==null||n.cancelPendingSurvey(e)}canRenderSurvey(e){var n,r;return(n=(r=this.surveys)==null?void 0:r.canRenderSurvey(e))!==null&&n!==void 0?n:{visible:!1,disabledReason:_n}}canRenderSurveyAsync(e,n){var r,s;return n===void 0&&(n=!1),(r=(s=this.surveys)==null?void 0:s.canRenderSurveyAsync(e,n))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:_n})}qi(e){return!e||hr(e)?(R.critical("Unique user id has not been set in posthog.identify"),!1):e===Zn?(R.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(R.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,n,r){if(!this.__loaded||!this.persistence)return R.uninitializedWarning("posthog.identify");if(We(e)&&(e=e.toString(),R.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.qi(e)&&this.Bi("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(kr)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(En)&&(this.unregister(En),this.register({distinct_id:e}));var i,o=(this.persistence.get_property(Me)||Nt)===Nt;e!==s&&o?(this.persistence.set_property(Me,Mt),this.setPersonPropertiesForFlags(T({},r||{},n||{}),!1),this.capture(ys,{distinct_id:e,$anon_distinct_id:s},{$set:n||{},$set_once:r||{}}),this.Ei=Va(e,n,r),(i=this.featureFlags)==null||i.setAnonymousDistinctId(s)):(n||r)&&this.setPersonProperties(n,r),e!==s&&(this.reloadFeatureFlags(),this.unregister(Tn))}}setPersonProperties(e,n){if((e||n)&&this.Bi("posthog.setPersonProperties")){var r=Va(this.get_distinct_id(),e,n);this.Ei!==r?(this.setPersonPropertiesForFlags(T({},n||{},e||{})),this.capture("$set",{$set:e||{},$set_once:n||{}}),this.Ei=r):R.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,n,r){if(e&&n){var s=this.getGroups();s[e]!==n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:T({},s,{[e]:n})}),r&&(this.capture(Aa,{$group_type:e,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags({[e]:r})),s[e]===n||r||this.reloadFeatureFlags()}else R.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n){var r;n===void 0&&(n=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(){var e;(e=this.featureFlags)==null||e.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,n){var r;n===void 0&&(n=!0),this.Bi("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(e,n))}resetGroupPropertiesForFlags(e){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(e)}reset(e){var n,r,s,i,o,a,l;if(R.info("reset"),!this.__loaded)return R.uninitializedWarning("posthog.reset");var c=this.get_property(kr);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),(s=this.surveys)==null||s.reset(),(i=this.Di)==null||i.stop(),(o=this.featureFlags)==null||o.reset(),(a=this.persistence)==null||a.set_property(Me,Nt),(l=this.sessionManager)==null||l.resetSessionId(),this.Ei=null,this.config.cookieless_mode===Le)this.register_once({distinct_id:Zn,$device_id:null},"");else{var u=this.config.get_device_id(ht());this.register_once({distinct_id:u,$device_id:e?u:c},"")}this.register({$last_posthog_reset:new Date().toISOString()},1),this.reloadFeatureFlags()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,n;return(e=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(e!=null&&e.withTimestamp&&r){var i,o=(i=e.timestampLookBack)!==null&&i!==void 0?i:10;if(!r)return s;s+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}return s}alias(e,n){return e===this.get_property(hu)?(R.critical("Attempting to create alias for existing People user - aborting."),-2):this.Bi("posthog.alias")?(O(n)&&(n=this.get_distinct_id()),e!==n?(this.Hi(En,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(R.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=T({},this.config);if(_e(e)){var r,s,i,o,a,l,c,u,d;ce(this.config,Qa(e));var p=this.$i();(r=this.persistence)==null||r.update_config(this.config,n,p),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ws(T({},this.config,{persistence:"sessionStorage"}),p);var f=this.Si(this.config.debug);Xe(f)&&(this.config.debug=f),Xe(this.config.debug)&&(this.config.debug?(Ce.DEBUG=!0,se.F()&&se.L("ph_debug",!0),R.info("set_config",{config:e,oldConfig:n,newConfig:T({},this.config)})):(Ce.DEBUG=!1,se.F()&&se.U("ph_debug"))),(s=this.exceptionObserver)==null||s.onConfigChange(),(i=this.sessionRecording)==null||i.startIfEnabledOrStop(),(o=this.autocapture)==null||o.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),(l=this.exceptionObserver)==null||l.startIfEnabledOrStop(),(c=this.deadClicksAutocapture)==null||c.startIfEnabledOrStop(),(u=this.surveys)==null||u.loadIfEnabled(),this.Wi(),(d=this.externalIntegrations)==null||d.startIfEnabledOrStop()}}_overrideSDKInfo(e,n){Ce.LIB_NAME=e,Ce.LIB_VERSION=n}startSessionRecording(e){var n,r,s,i,o,a=e===!0,l={sampling:a||!(e==null||!e.sampling),linked_flag:a||!(e==null||!e.linked_flag),url_trigger:a||!(e==null||!e.url_trigger),event_trigger:a||!(e==null||!e.event_trigger)};Object.values(l).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),l.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),l.linked_flag&&((s=this.sessionRecording)==null||s.overrideLinkedFlag()),l.url_trigger&&((i=this.sessionRecording)==null||i.overrideTrigger("url")),l.event_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,n){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(T({},s,n))}}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var n,r;return(n=(r=this.toolbar)==null?void 0:r.loadToolbar(e))!==null&&n!==void 0&&n}get_property(e){var n;return(n=this.persistence)==null?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)==null?void 0:n.props[e]}toString(){var e,n=(e=this.config.name)!==null&&e!==void 0?e:Ht;return n!==Ht&&(n=Ht+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(Me))===Mt||((n=this.sessionPersistence)==null?void 0:n.get_property(Me))===Mt}zi(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===bi&&!this._isIdentified()&&Bt(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[En])&&((n=this.persistence)==null||(n=n.props)==null||!n[Pr]))}Li(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.zi()||this.Bi("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Bi("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Bi(e){return this.config.person_profiles==="never"?(R.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Hi(Pr,!0),!0)}$i(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Ve)}Wi(){var e,n,r,s,i=this.$i();return((e=this.persistence)==null?void 0:e.st)!==i&&((r=this.persistence)==null||r.set_disabled(i)),((n=this.sessionPersistence)==null?void 0:n.st)!==i&&((s=this.sessionPersistence)==null||s.set_disabled(i)),i}opt_in_capturing(e){var n;if(this.config.cookieless_mode!==Le){if(this.config.cookieless_mode===Ve&&this.consent.isExplicitlyOptedOut()){var r,s,i,o,a;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=new Ga(this),this.pageViewManager=new Da(this),this.persistence&&(this.sessionPropsManager=new qa(this,this.sessionManager,this.persistence));var l=(i=(o=this.config.__extensionClasses)==null?void 0:o.sessionRecording)!==null&&i!==void 0?i:(a=Be.__defaultExtensionClasses)==null?void 0:a.sessionRecording;l&&(this.sessionRecording=this.fi(this.sessionRecording,new l(this)))}var c,u;this.consent.optInOut(!0),this.Wi(),this.Ai(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==Ve&&((c=this.surveys)==null||c.loadIfEnabled()),(O(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((u=e==null?void 0:e.captureEventName)!==null&&u!==void 0?u:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Mi()}else R.warn(Ja)}opt_out_capturing(){var e,n,r;this.config.cookieless_mode!==Le?(this.config.cookieless_mode===Ve&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Wi(),this.config.cookieless_mode===Ve&&(this.register({distinct_id:Zn,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(r=this.sessionRecording)==null||r.stopRecording(),this.sessionRecording=void 0,this.Mi())):R.warn(Ja)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Le||(this.config.cookieless_mode===Ve?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Wi()}_is_bot(){return Re?Fu(Re,this.config.custom_blocked_useragents):void 0}Mi(){$&&($.visibilityState==="visible"?this.bi||(this.bi=!0,this.capture(Ut,{title:$.title},{send_instantly:!0}),this.yi&&($.removeEventListener(Cr,this.yi),this.yi=null)):this.yi||(this.yi=this.Mi.bind(this),he($,Cr,this.yi)))}debug(e){e===!1?(v==null||v.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(v==null||v.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}bt(){var e,n,r,s,i,o,a=this.xi||{};return"advanced_disable_flags"in a?!!a.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(R.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(r="advanced_disable_decide",s=R,i=(n="advanced_disable_flags")in(e=a)&&!G(e[n]),o=r in e&&!G(e[r]),i?e[n]:!!o&&(s&&s.warn("Config field '"+r+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),e[r]))}ji(e){if(G(this.config.before_send))return e;var n=Y(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var s of n){if(r=s(r),G(r)){var i="Event '"+e.event+"' was rejected in beforeSend function";return lg(e.event)?R.warn(i+". This can cause unexpected behavior."):R.info(i),null}r.properties&&!Bt(r.properties)||R.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var e;return(e=this.pageViewManager.K)==null?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(r)})}Si(e){var n=Xe(e)&&!e,r=se.F()&&se.M("ph_debug")==="true";return!n&&(!!r||e)}}function el(t){return t instanceof Element&&(t.id===_u||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function ns(t){return!!t&&t.nodeType===1}function ft(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function ju(t){return!!t&&t.nodeType===3}function Uu(t){return!!t&&t.nodeType===11}function lo(t){return t?es(t).split(/\s+/):[]}function tl(t){var e=v==null?void 0:v.location.href;return!!(e&&t&&t.some(n=>e.match(n)))}function jr(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return lo(e)}function Hu(t){return G(t)?null:es(t).split(/(\s+)/).filter(e=>$n(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ln(t){var e="";return $i(t)&&!zu(t)&&t.childNodes&&t.childNodes.length&&te(t.childNodes,function(n){var r;ju(n)&&n.textContent&&(e+=(r=Hu(n.textContent))!==null&&r!==void 0?r:"")}),es(e)}function nl(t){return O(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}Be.__defaultExtensionClasses={},function(t,e){for(var n=0;e.length>n;n++)t.prototype[e[n]]=zg(t.prototype[e[n]])}(Be,["identify"]);var co=["a","button","form","input","select","textarea","label"];function rl(t,e){if(O(e))return!0;var n,r=function(i){if(e.some(o=>i.matches(o)))return{v:!0}};for(var s of t)if(n=r(s))return n.v;return!1}function Bu(t){var e=t.parentNode;return!(!e||!ns(e))&&e}var Cv=["next","previous","prev",">","<"],sl=[".ph-no-rageclick",".ph-no-capture"],Ci=t=>!t||ft(t,"html")||!ns(t),il=(t,e)=>{if(!v||Ci(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[t],s=t;s.parentNode&&!ft(s,"body");)if(Uu(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var i=Bu(s);if(!i)break;if(e||co.indexOf(i.tagName.toLowerCase())>-1)n=!0;else{var o=v.getComputedStyle(i);o&&o.getPropertyValue("cursor")==="pointer"&&(n=!0)}r.push(i),s=i}return{parentIsUsefulElement:n,targetElementList:r}};function $i(t){for(var e=t;e.parentNode&&!ft(e,"body");e=e.parentNode){var n=jr(e);if(q(n,"ph-sensitive")||q(n,"ph-no-capture"))return!1}if(q(jr(t),"ph-include"))return!0;var r=t.type||"";if(fe(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!fe(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function zu(t){return!!(ft(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||ft(t,"select")||ft(t,"textarea")||t.getAttribute("contenteditable")==="true")}var Wu="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",$v=new RegExp("^(?:"+Wu+")$"),Rv=new RegExp(Wu),qu="\\d{3}-?\\d{2}-?\\d{4}",Ov=new RegExp("^("+qu+")$"),Av=new RegExp("("+qu+")");function $n(t,e){return e===void 0&&(e=!0),!(G(t)||fe(t)&&(t=es(t),(e?$v:Rv).test((t||"").replace(/[- ]/g,""))||(e?Ov:Av).test(t)))}function ol(t){var e=Ln(t);return $n(e=(e+" "+Gu(t)).trim())?e:""}function Gu(t){var e="";return t&&t.childNodes&&t.childNodes.length&&te(t.childNodes,function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var s=Ln(n);e=(e+" "+s).trim(),n.childNodes&&n.childNodes.length&&(e=(e+" "+Gu(n)).trim())}catch(i){R.error("[AutoCapture]",i)}}),e}function al(t){return t.replace(/"|\\"/g,'\\"')}function Fv(t){var e=t.attr__class;return e?Y(e)?e:lo(e):void 0}class ll{constructor(e){this.disabled=e===!1;var n=_e(e)?e:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(e,n,r){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(n-s.y)<this.thresholdPx&&this.timeoutMs>r-s.timestamp){if(this.clicks.push({x:e,y:n,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:n,timestamp:r}];return!1}}var $s="$copy_autocapture",cl=oe("[AutoCapture]");function Rs(t,e){return e.length>t?e.slice(0,t)+"...":e}function Nv(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!ns(e));return e}function Mv(t,e){for(var n,r,{e:s,maskAllElementAttributes:i,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,c=[t],u=t;u.parentNode&&!ft(u,"body");)Uu(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);var d,p,f=[],g={},_=!1,P=!1;if(te(c,S=>{var k=$i(S);S.tagName.toLowerCase()==="a"&&(_=S.getAttribute("href"),_=k&&_&&$n(_)&&_),q(jr(S),"ph-no-capture")&&(P=!0),f.push(function(E,I,A,j){var F=E.tagName.toLowerCase(),H={tag_name:F};co.indexOf(F)>-1&&!A&&(H.$el_text=F.toLowerCase()==="a"||F.toLowerCase()==="button"?Rs(1024,ol(E)):Rs(1024,Ln(E)));var B=jr(E);B.length>0&&(H.classes=B.filter(function(z){return z!==""})),te(E.attributes,function(z){var ee;if((!zu(E)||["name","id","class","aria-label"].indexOf(z.name)!==-1)&&(j==null||!j.includes(z.name))&&!I&&$n(z.value)&&(!fe(ee=z.name)||ee.substring(0,10)!=="_ngcontent"&&ee.substring(0,7)!=="_nghost")){var V=z.value;z.name==="class"&&(V=lo(V).join(" ")),H["attr__"+z.name]=Rs(1024,V)}});for(var K=1,Z=1,N=E;N=Nv(N);)K++,N.tagName===E.tagName&&Z++;return H.nth_child=K,H.nth_of_type=Z,H}(S,i,o,a));var w=function(E){if(!$i(E))return{};var I={};return te(E.attributes,function(A){if(A.name&&A.name.indexOf("data-ph-capture-attribute")===0){var j=A.name.replace("data-ph-capture-attribute-",""),F=A.value;j&&F&&$n(F)&&(I[j]=F)}}),I}(S);ce(g,w)}),P)return{props:{},explicitNoCapture:P};if(o||(f[0].$el_text=t.tagName.toLowerCase()==="a"||t.tagName.toLowerCase()==="button"?ol(t):Ln(t)),_){var m,b;f[0].attr__href=_;var C=(m=Or(_))==null?void 0:m.host,x=v==null||(b=v.location)==null?void 0:b.host;C&&x&&C!==x&&(d=_)}return{props:ce({$event_type:s.type,$ce_version:1},l?{}:{$elements:f},{$elements_chain:(p=f,function(S){return S.map(k=>{var w,E,I="";if(k.tag_name&&(I+=k.tag_name),k.attr_class)for(var A of(k.attr_class.sort(),k.attr_class))I+="."+A.replace(/"/g,"");var j=T({},k.text?{text:k.text}:{},{"nth-child":(w=k.nth_child)!==null&&w!==void 0?w:0,"nth-of-type":(E=k.nth_of_type)!==null&&E!==void 0?E:0},k.href?{href:k.href}:{},k.attr_id?{attr_id:k.attr_id}:{},k.attributes),F={};return pr(j).sort((H,B)=>{var[K]=H,[Z]=B;return K.localeCompare(Z)}).forEach(H=>{var[B,K]=H;return F[al(B.toString())]=al(K.toString())}),(I+=":")+pr(F).map(H=>{var[B,K]=H;return B+'="'+K+'"'}).join("")}).join(";")}(function(S){return S.map(k=>{var w,E,I={text:(w=k.$el_text)==null?void 0:w.slice(0,400),tag_name:k.tag_name,href:(E=k.attr__href)==null?void 0:E.slice(0,2048),attr_class:Fv(k),attr_id:k.attr__id,nth_child:k.nth_child,nth_of_type:k.nth_of_type,attributes:{}};return pr(k).filter(A=>{var[j]=A;return j.indexOf("attr__")===0}).forEach(A=>{var[j,F]=A;return I.attributes[j]=F}),I})}(p)))},(n=f[0])!=null&&n.$el_text?{$el_text:(r=f[0])==null?void 0:r.$el_text}:{},d&&s.type==="click"?{$external_click_url:d}:{},g)}}var gn=oe("[ExceptionAutocapture]");function ul(t,e,n){try{if(!(e in t))return()=>{};var r=t[e],s=n(r);return Ke(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=s,()=>{t[e]=r}}catch{return()=>{}}}var Dv=oe("[TracingHeaders]"),at=oe("[Web Vitals]"),dl=9e5,hl="disabled",pl="lazy_loading",vn="awaiting_config",sr="missing_config";oe("[SessionRecording]");var Ri="[SessionRecording]",lt=oe(Ri),Lv=oe("[Heatmaps]");function fl(t){return _e(t)&&"clientX"in t&&"clientY"in t&&We(t.clientX)&&We(t.clientY)}var _l=oe("[Product Tours]"),Os="ph_product_tours",jv=["$set_once","$set"],ct=oe("[SiteApps]"),gl="Error while initializing PostHog app with config id ";function Lt(t,e,n){if(G(t))return!1;switch(n){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}class Uv{constructor(e){this.Vi=new ao,this.Yi=(n,r)=>this.Gi(n,r)&&this.Ji(n,r)&&this.Ki(n,r)&&this.Xi(n,r),this.Gi=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=e,this.Qi=new Set,this.Zi=new Set}init(){var e,n;O((e=this._instance)==null?void 0:e._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook((r,s)=>{this.on(r,s)})}register(e){var n,r;if(!O((n=this._instance)==null?void 0:n._addCaptureHook)&&(e.forEach(o=>{var a,l;(a=this.Zi)==null||a.add(o),(l=o.steps)==null||l.forEach(c=>{var u;(u=this.Qi)==null||u.add((c==null?void 0:c.event)||"")})}),(r=this._instance)!=null&&r.autocapture)){var s,i=new Set;e.forEach(o=>{var a;(a=o.steps)==null||a.forEach(l=>{l!=null&&l.selector&&i.add(l==null?void 0:l.selector)})}),(s=this._instance)==null||s.autocapture.setElementSelectors(i)}}on(e,n){var r;n!=null&&e.length!=0&&(this.Qi.has(e)||this.Qi.has(n==null?void 0:n.event))&&this.Zi&&((r=this.Zi)==null?void 0:r.size)>0&&this.Zi.forEach(s=>{this.te(n,s)&&this.Vi.emit("actionCaptured",s.name)})}ie(e){this.onAction("actionCaptured",n=>e(n))}te(e,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.Yi(e,r))return!0;return!1}onAction(e,n){return this.Vi.on(e,n)}Ji(e,n){if(n!=null&&n.url){var r,s=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!s||typeof s!="string"||!Lt(s,n.url,n.url_matching||"contains"))return!1}return!0}Ki(e,n){return!!this.ee(e,n)&&!!this.re(e,n)&&!!this.se(e,n)}ee(e,n){var r;if(n==null||!n.href)return!0;var s=this.ne(e);if(s.length>0)return s.some(a=>Lt(a.href,n.href,n.href_matching||"exact"));var i,o=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!o&&Lt((i=o.match(/(?::|")href="(.*?)"/))?i[1]:"",n.href,n.href_matching||"exact")}re(e,n){var r;if(n==null||!n.text)return!0;var s=this.ne(e);if(s.length>0)return s.some(c=>Lt(c.text,n.text,n.text_matching||"exact")||Lt(c.$el_text,n.text,n.text_matching||"exact"));var i,o,a,l=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!l&&(i=function(c){for(var u,d=[],p=/(?::|")text="(.*?)"/g;!G(u=p.exec(c));)d.includes(u[1])||d.push(u[1]);return d}(l),o=n.text,a=n.text_matching||"exact",i.some(c=>Lt(c,o,a)))}se(e,n){var r,s;if(n==null||!n.selector)return!0;var i=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(i!=null&&i.includes(n.selector))return!0;var o=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";if(n.selector_regex&&o)try{return new RegExp(n.selector_regex).test(o)}catch{return!1}return!1}ne(e){var n;return(e==null||(n=e.properties)==null?void 0:n.$elements)==null?[]:e==null?void 0:e.properties.$elements}Xi(e,n){return n==null||!n.properties||n.properties.length===0||Mu(n.properties.reduce((r,s)=>{var i=Y(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return r[s.key]={values:i,operator:s.operator||"exact"},r},{}),e==null?void 0:e.properties)}}class Hv{constructor(e){this._instance=e,this.oe=new Map,this.ae=new Map,this.le=new Map}ue(e,n){return!!e&&Mu(e.propertyFilters,n==null?void 0:n.properties)}he(e,n){var r=new Map;return e.forEach(s=>{var i;(i=s.conditions)==null||(i=i[n])==null||(i=i.values)==null||i.forEach(o=>{if(o!=null&&o.name){var a=r.get(o.name)||[];a.push(s.id),r.set(o.name,a)}})}),r}de(e,n,r){var s=(r===dn.Activation?this.oe:this.ae).get(e),i=[];return this.ve(o=>{i=o.filter(a=>s==null?void 0:s.includes(a.id))}),i.filter(o=>{var a,l=(a=o.conditions)==null||(a=a[r])==null||(a=a.values)==null?void 0:a.find(c=>c.name===e);return this.ue(l,n)})}register(e){var n;O((n=this._instance)==null?void 0:n._addCaptureHook)||(this.ce(e),this.fe(e))}fe(e){var n=e.filter(r=>{var s,i;return((s=r.conditions)==null?void 0:s.actions)&&((i=r.conditions)==null||(i=i.actions)==null||(i=i.values)==null?void 0:i.length)>0});n.length!==0&&(this.pe==null&&(this.pe=new Uv(this._instance),this.pe.init(),this.pe.ie(r=>{this.onAction(r)})),n.forEach(r=>{var s,i,o,a,l;r.conditions&&(s=r.conditions)!=null&&s.actions&&(i=r.conditions)!=null&&(i=i.actions)!=null&&i.values&&((o=r.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.pe)==null||a.register(r.conditions.actions.values),(l=r.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach(c=>{if(c&&c.name){var u=this.le.get(c.name);u&&u.push(r.id),this.le.set(c.name,u||[r.id])}}))}))}ce(e){var n,r=e.filter(i=>{var o,a;return((o=i.conditions)==null?void 0:o.events)&&((a=i.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0}),s=e.filter(i=>{var o,a;return((o=i.conditions)==null?void 0:o.cancelEvents)&&((a=i.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0});r.length===0&&s.length===0||((n=this._instance)==null||n._addCaptureHook((i,o)=>{this.onEvent(i,o)}),this.oe=this.he(e,dn.Activation),this.ae=this.he(e,dn.Cancellation))}onEvent(e,n){var r,s=this._e(),i=this.ge(),o=this.me(),a=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[i])||[];if(o===e&&n&&a.length>0){var l,c;s.info("event matched, removing item from activated items",{event:e,eventPayload:n,existingActivatedItems:a});var u=(n==null||(l=n.properties)==null?void 0:l.$survey_id)||(n==null||(c=n.properties)==null?void 0:c.$product_tour_id);if(u){var d=a.indexOf(u);0>d||(a.splice(d,1),this.be(a))}}else{if(this.ae.has(e)){var p=this.de(e,n,dn.Cancellation);p.length>0&&(s.info("cancel event matched, cancelling items",{event:e,itemsToCancel:p.map(g=>g.id)}),p.forEach(g=>{var _=a.indexOf(g.id);0>_||a.splice(_,1),this.ye(g.id)}),this.be(a))}if(this.oe.has(e)){s.info("event name matched",{event:e,eventPayload:n,items:this.oe.get(e)});var f=this.de(e,n,dn.Activation);this.be(a.concat(f.map(g=>g.id)||[]))}}}onAction(e){var n,r=this.ge(),s=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[r])||[];this.le.has(e)&&this.be(s.concat(this.le.get(e)||[]))}be(e){var n,r=this._e(),s=this.ge(),i=[...new Set(e)].filter(o=>!this.we(o));r.info("updating activated items",{activatedItems:i}),(n=this._instance)==null||(n=n.persistence)==null||n.register({[s]:i})}getActivatedIds(){var e,n=this.ge();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[n])||[]}getEventToItemsMap(){return this.oe}Ee(){return this.pe}}class Bv extends Hv{constructor(e){super(e)}ge(){return"$surveys_activated"}me(){return xn.SHOWN}ve(e){var n;(n=this._instance)==null||n.getSurveys(e)}ye(e){var n;(n=this._instance)==null||n.cancelPendingSurvey(e)}_e(){return Q}we(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var As="SDK is not enabled or survey functionality is not yet loaded",vl="Disabled. Not loading surveys.",zv=v!=null&&v.location?Fr(v.location.hash,"__posthog")||Fr(location.hash,"state"):null,ml="_postHogToolbarParams",yl=oe("[Toolbar]"),we=oe("[FeatureFlags]"),bt=oe("[FeatureFlags]",{debugEnabled:!0}),Fs=`" failed. Feature flags didn't load in time.`,Ns="$active_feature_flags",ut="$override_feature_flags",bl="$feature_flag_payloads",mn="$override_feature_flag_payloads",El="$feature_flag_request_id",wl=t=>{for(var e={},n=0;t.length>n;n++)e[t[n]]=!0;return e},Sl=t=>{var e={};for(var[n,r]of pr(t||{}))r&&(e[n]=r);return e},Ms=oe("[Error tracking]"),kl="Refusing to render web experiment since the viewer is a likely bot",Wv={icontains:(t,e)=>!!v&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!v&&e.href.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>!!v&&Lr(e.href,t),not_regex:(t,e)=>!!v&&!Lr(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class be{get N(){return this._instance.config}constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments(s=>{be.Se("retrieved web experiments from the server"),n.xe=new Map,s.forEach(i=>{if(i.feature_flag_key){var o;n.xe&&(be.Se("setting flag key ",i.feature_flag_key," to web experiment ",i),(o=n.xe)==null||o.set(i.feature_flag_key,i));var a=n._instance.getFeatureFlag(i.feature_flag_key);fe(a)&&i.variants[a]&&n.Te(i.name,a,i.variants[a].transforms)}else if(i.variants)for(var l in i.variants){var c=i.variants[l];be.$e(c)&&n.Te(i.name,l,c.transforms)}})},r)},this._instance=e,this._instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}initialize(){}onFeatureFlags(e){if(this._is_bot())be.Se(kl);else if(!this.N.disable_web_experiments){if(G(this.xe))return this.xe=new Map,this.loadIfEnabled(),void this.previewWebExperiment();be.Se("applying feature flags",e),e.forEach(n=>{var r;if(this.xe&&(r=this.xe)!=null&&r.has(n)){var s,i=this._instance.getFeatureFlag(n),o=(s=this.xe)==null?void 0:s.get(n);i&&o!=null&&o.variants[i]&&this.Te(o.name,i,o.variants[i].transforms)}})}}previewWebExperiment(){var e=be.getWindowLocation();if(e!=null&&e.search){var n=Ar(e==null?void 0:e.search,"__experiment_id"),r=Ar(e==null?void 0:e.search,"__experiment_variant");n&&r&&(be.Se("previewing web experiments "+n+" && "+r),this.getWebExperiments(s=>{this.ke(parseInt(n),r,s)},!1,!0))}}loadIfEnabled(){this.N.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,r){if(this.N.disable_web_experiments&&!r)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!n)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.N.token),method:"GET",callback:i=>e(i.statusCode===200&&i.json&&i.json.experiments||[])})}ke(e,n,r){var s=r.filter(i=>i.id===e);s&&s.length>0&&(be.Se("Previewing web experiment ["+s[0].name+"] with variant ["+n+"]"),this.Te(s[0].name,n,s[0].variants[n].transforms))}static $e(e){return!G(e.conditions)&&be.Re(e)&&be.Pe(e)}static Re(e){var n;if(G(e.conditions)||G((n=e.conditions)==null?void 0:n.url))return!0;var r,s,i,o=be.getWindowLocation();return!!o&&((r=e.conditions)==null||!r.url||Wv[(s=(i=e.conditions)==null?void 0:i.urlMatchType)!==null&&s!==void 0?s:"icontains"](e.conditions.url,o))}static getWindowLocation(){return v==null?void 0:v.location}static Pe(e){var n;if(G(e.conditions)||G((n=e.conditions)==null?void 0:n.utm))return!0;var r=bu();if(r.utm_source){var s,i,o,a,l,c,u,d,p=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_campaign||((i=e.conditions)==null||(i=i.utm)==null?void 0:i.utm_campaign)==r.utm_campaign,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==r.utm_source,g=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==r.utm_medium,_=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((d=e.conditions)==null||(d=d.utm)==null?void 0:d.utm_term)==r.utm_term;return p&&g&&_&&f}return!1}static Se(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;n>s;s++)r[s-1]=arguments[s];R.info("[WebExperiments] "+e,r)}Te(e,n,r){this._is_bot()?be.Se(kl):n!=="control"?r.forEach(s=>{if(s.selector){var i;be.Se("applying transform of variant "+n+" for experiment "+e+" ",s);var o=(i=document)==null?void 0:i.querySelectorAll(s.selector);o==null||o.forEach(a=>{var l=a;s.html&&(l.innerHTML=s.html),s.css&&l.setAttribute("style",s.css)})}}):be.Se("Control variants leave the page unmodified.")}_is_bot(){return Re&&this._instance?Fu(Re,this.N.custom_blocked_useragents):void 0}}var Ae=oe("[Conversations]"),Et="Conversations not available yet.",rs={featureFlags:class{constructor(t){this.Oe=!1,this.Ie=!1,this.Ce=!1,this.Fe=!1,this.Ae=!1,this.Me=!1,this.De=!1,this.Le=!1,this._instance=t,this.featureFlagEventHandlers=[]}get N(){return this._instance.config}get Wt(){return this._instance.persistence}Ue(t){return this._instance.get_property(t)}Ne(){var t,e;return(t=(e=this.Wt)==null?void 0:e.nt(this.N.feature_flag_cache_ttl_ms))!==null&&t!==void 0&&t}je(){return!!this.Ne()&&(this.Le||this.Ce||(this.Le=!0,we.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}ze(){var t,e=(t=this.N.evaluation_contexts)!==null&&t!==void 0?t:this.N.evaluation_environments;return!this.N.evaluation_environments||this.N.evaluation_contexts||this.De||(we.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.De=!0),e!=null&&e.length?e.filter(n=>{var r=n&&typeof n=="string"&&n.trim().length>0;return r||we.error("Invalid evaluation context found:",n,"Expected non-empty string"),r}):[]}Be(){return this.ze().length>0}initialize(){var t,e,{config:n}=this._instance,r=(t=(e=n.bootstrap)==null?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(r).length){var s,i,o=(s=(i=n.bootstrap)==null?void 0:i.featureFlagPayloads)!==null&&s!==void 0?s:{},a=Object.keys(r).filter(c=>!!r[c]).reduce((c,u)=>(c[u]=r[u]||!1,c),{}),l=Object.keys(o).filter(c=>a[c]).reduce((c,u)=>(o[u]&&(c[u]=o[u]),c),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,e,n){var r=n!=null&&n.merge?this.getFlagVariants():{},s=n!=null&&n.merge?this.getFlagPayloads():{},i=T({},r,t),o=T({},s,e),a={};for(var[l,c]of Object.entries(i)){var u=typeof c=="string";a[l]={key:l,enabled:!!u||!!c,variant:u?c:void 0,reason:void 0,metadata:O(o==null?void 0:o[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.Ie}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Ue(hi),e=this.Ue(ut),n=this.Ue(mn);if(!n&&!e)return t||{};var r=ce({},t||{}),s=[...new Set([...Object.keys(n||{}),...Object.keys(e||{})])];for(var i of s){var o,a,l=r[i],c=e==null?void 0:e[i],u=O(c)?(o=l==null?void 0:l.enabled)!==null&&o!==void 0&&o:!!c,d=O(c)?l.variant:typeof c=="string"?c:void 0,p=n==null?void 0:n[i],f=T({},l,{enabled:u,variant:u?d??(l==null?void 0:l.variant):void 0});u!==(l==null?void 0:l.enabled)&&(f.original_enabled=l==null?void 0:l.enabled),d!==(l==null?void 0:l.variant)&&(f.original_variant=l==null?void 0:l.variant),p&&(f.metadata=T({},l==null?void 0:l.metadata,{payload:p,original_payload:l==null||(a=l.metadata)==null?void 0:a.payload})),r[i]=f}return this.Oe||(we.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:n,finalDetails:r}),this.Oe=!0),r}getFlagVariants(){var t=this.Ue(zt),e=this.Ue(ut);if(!e)return t||{};for(var n=ce({},t),r=Object.keys(e),s=0;r.length>s;s++)n[r[s]]=e[r[s]];return this.Oe||(we.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:n}),this.Oe=!0),n}getFlagPayloads(){var t=this.Ue(bl),e=this.Ue(mn);if(!e)return t||{};for(var n=ce({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)n[r[s]]=e[r[s]];return this.Oe||(we.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:n}),this.Oe=!0),n}reloadFeatureFlags(){this.Fe||this.N.advanced_disable_feature_flags||this.He||(this._instance.mi.emit("featureFlagsReloading",!0),this.He=setTimeout(()=>{this.qe()},5))}We(){clearTimeout(this.He),this.He=void 0}ensureFlagsLoaded(){this.Ie||this.Ce||this.He||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Fe=t}qe(t){var e;if(this.We(),!this._instance.bt())if(this.Ce)this.Ae=!0;else{var n=this.N.token,r=this.Ue(kr),s={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:T({},((e=this.Wt)==null?void 0:e.get_initial_props())||{},this.Ue(kn)||{}),group_properties:this.Ue(wt),timezone:Iu()};rt(r)||O(r)||(s.$device_id=r),(t!=null&&t.disableFlags||this.N.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.Be()&&(s.evaluation_contexts=this.ze());var i=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.N.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Ce=!0,this._instance._send_request({method:"POST",url:i,data:s,compression:this.N.disable_compression?void 0:Ue.Base64,timeout:this.N.feature_flag_request_timeout_ms,callback:o=>{var a,l,c,u=!0;if(o.statusCode===200&&(this.Ae||(this.$anon_distinct_id=void 0),u=!1),this.Ce=!1,!s.disable_flags||this.Ae){this.Me=!u;var d=[];o.error?o.error instanceof Error?d.push(o.error.name==="AbortError"?"timeout":"connection_error"):d.push("unknown_error"):o.statusCode!==200&&d.push("api_error_"+o.statusCode),(a=o.json)!=null&&a.errorsWhileComputingFlags&&d.push("errors_while_computing_flags");var p,f=!((l=o.json)==null||(l=l.quotaLimited)==null||!l.includes("feature_flags"));f&&d.push("quota_limited"),(c=this.Wt)==null||c.register({[_i]:d}),f?we.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(s.disable_flags||this.receivedFeatureFlags((p=o.json)!==null&&p!==void 0?p:{},u),this.Ae&&(this.Ae=!1,this.qe()))}}})}}getFeatureFlag(t,e){var n;if(e===void 0&&(e={}),!e.fresh||this.Me)if(this.Ie||this.getFlags()&&this.getFlags().length>0){if(!this.je()){var r=this.getFeatureFlagResult(t,e);return(n=r==null?void 0:r.variant)!==null&&n!==void 0?n:r==null?void 0:r.enabled}}else we.warn('getFeatureFlag for key "'+t+Fs)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return e==null?void 0:e.payload}getFeatureFlagResult(t,e){if(e===void 0&&(e={}),!e.fresh||this.Me)if(this.Ie||this.getFlags()&&this.getFlags().length>0){if(!this.je()){var n=this.getFlagVariants(),r=t in n,s=n[t],i=this.getFlagPayloads()[t],o=String(s),a=this.Ue(El)||void 0,l=this.Ue(Ir)||void 0,c=this.Ue(Tn)||{};if(this.N.advanced_feature_flags_dedup_per_session){var u,d=this._instance.get_session_id(),p=this.Ue(fi);d&&d!==p&&(c={},(u=this.Wt)==null||u.register({[Tn]:c,[fi]:d}))}if((e.send_event||!("send_event"in e))&&(!(t in c)||!c[t].includes(o))){var f,g,_,P,m,b,C,x,S,k;Y(c[t])?c[t].push(o):c[t]=[o],(f=this.Wt)==null||f.register({[Tn]:c});var w=this.getFeatureFlagDetails(t),E=[...(g=this.Ue(_i))!==null&&g!==void 0?g:[]];O(s)&&E.push("flag_missing");var I={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:i||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:((_=this.N.bootstrap)==null||(_=_.featureFlags)==null?void 0:_[t])||null,$feature_flag_bootstrapped_payload:((P=this.N.bootstrap)==null||(P=P.featureFlagPayloads)==null?void 0:P[t])||null,$used_bootstrap_value:!this.Me};O(w==null||(m=w.metadata)==null?void 0:m.version)||(I.$feature_flag_version=w.metadata.version);var A,j=(b=w==null||(C=w.reason)==null?void 0:C.description)!==null&&b!==void 0?b:w==null||(x=w.reason)==null?void 0:x.code;j&&(I.$feature_flag_reason=j),w!=null&&(S=w.metadata)!=null&&S.id&&(I.$feature_flag_id=w.metadata.id),O(w==null?void 0:w.original_variant)&&O(w==null?void 0:w.original_enabled)||(I.$feature_flag_original_response=O(w.original_variant)?w.original_enabled:w.original_variant),w!=null&&(k=w.metadata)!=null&&k.original_payload&&(I.$feature_flag_original_payload=w==null||(A=w.metadata)==null?void 0:A.original_payload),E.length&&(I.$feature_flag_error=E.join(",")),this._instance.capture("$feature_flag_called",I)}if(r){var F=i;if(!O(i))try{F=JSON.parse(i)}catch{}return{key:t,enabled:!!s,variant:typeof s=="string"?s:void 0,payload:F}}}}else we.warn('getFeatureFlagResult for key "'+t+Fs)}getRemoteConfigPayload(t,e){var n=this.N.token,r={distinct_id:this._instance.get_distinct_id(),token:n};this.Be()&&(r.evaluation_contexts=this.ze()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.N.disable_compression?void 0:Ue.Base64,timeout:this.N.feature_flag_request_timeout_ms,callback(s){var i,o=(i=s.json)==null?void 0:i.featureFlagPayloads;e((o==null?void 0:o[t])||void 0)}})}isFeatureEnabled(t,e){if(e===void 0&&(e={}),!e.fresh||this.Me){if(this.Ie||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(t,e);return O(n)?void 0:!!n}we.warn('isFeatureEnabled for key "'+t+Fs)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==t)}receivedFeatureFlags(t,e){if(this.Wt){this.Ie=!0;var n=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(i,o,a,l,c){a===void 0&&(a={}),l===void 0&&(l={}),c===void 0&&(c={});var u=(k=>{var w=k.flags;return w?(k.featureFlags=Object.fromEntries(Object.keys(w).map(E=>{var I;return[E,(I=w[E].variant)!==null&&I!==void 0?I:w[E].enabled]})),k.featureFlagPayloads=Object.fromEntries(Object.keys(w).filter(E=>w[E].enabled).filter(E=>{var I;return(I=w[E].metadata)==null?void 0:I.payload}).map(E=>{var I;return[E,(I=w[E].metadata)==null?void 0:I.payload]}))):we.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),k})(i),d=u.flags,p=u.featureFlags,f=u.featureFlagPayloads;if(p){var g=i.requestId,_=i.evaluatedAt;if(Y(p)){we.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var P={};if(p)for(var m=0;p.length>m;m++)P[p[m]]=!0;o&&o.register({[Ns]:p,[zt]:P})}else{var b=p,C=f,x=d;if(i.errorsWhileComputingFlags)if(d){var S=new Set(Object.keys(d).filter(k=>{var w;return!((w=d[k])!=null&&w.failed)}));b=T({},a,Object.fromEntries(Object.entries(b).filter(k=>{var[w]=k;return S.has(w)}))),C=T({},l,Object.fromEntries(Object.entries(C||{}).filter(k=>{var[w]=k;return S.has(w)}))),x=T({},c,Object.fromEntries(Object.entries(x||{}).filter(k=>{var[w]=k;return S.has(w)})))}else b=T({},a,b),C=T({},l,C),x=T({},c,x);o&&o.register(T({[Ns]:Object.keys(Sl(b)),[zt]:b||{},[bl]:C||{},[hi]:x||{}},g?{[El]:g}:{},_?{[Ir]:_}:{}))}}})(t,this.Wt,n,r,s),e||(this.Le=!1),this.Ve(e)}}override(t,e){e===void 0&&(e=!1),we.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.Wt)return we.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.Wt.unregister(ut),this.Wt.unregister(mn),this.Ve(),bt.info("All overrides cleared");if(Y(t)){var e=wl(t);return this.Wt.register({[ut]:e}),this.Ve(),bt.info("Flag overrides set",{flags:t})}if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var n,r=t;if(this.Oe=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this.Wt.unregister(ut),bt.info("Flag overrides cleared");else if(r.flags){if(Y(r.flags)){var s=wl(r.flags);this.Wt.register({[ut]:s})}else this.Wt.register({[ut]:r.flags});bt.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this.Wt.unregister(mn),bt.info("Payload overrides cleared")):r.payloads&&(this.Wt.register({[mn]:r.payloads}),bt.info("Payload overrides set",{payloads:r.payloads}))),void this.Ve()}if(t&&typeof t=="object")return this.Wt.register({[ut]:t}),this.Ve(),bt.info("Flag overrides set",{flags:t});we.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Ie){var{flags:e,flagVariants:n}=this.Ye();t(e,n)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,n){var r,s=(this.Ue(Sn)||[]).find(l=>l.flagKey===t),i={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:i};s&&(o.$early_access_feature_name=s.name),n&&(o.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(i,!1);var a=T({},this.getFlagVariants(),{[t]:e});(r=this.Wt)==null||r.register({[Ns]:Object.keys(Sl(a)),[zt]:a}),this.Ve()}getEarlyAccessFeatures(t,e,n){e===void 0&&(e=!1);var r=this.Ue(Sn),s=n?"&"+n.map(i=>"stage="+i).join("&"):"";if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.N.token+s),method:"GET",callback:i=>{var o,a;if(i.json){var l=i.json.earlyAccessFeatures;return(o=this.Wt)==null||o.unregister(Sn),(a=this.Wt)==null||a.register({[Sn]:l}),t(l)}}})}Ye(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(n=>e[n]),flagVariants:Object.keys(e).filter(n=>e[n]).reduce((n,r)=>(n[r]=e[r],n),{})}}Ve(t){var{flags:e,flagVariants:n}=this.Ye();this.featureFlagEventHandlers.forEach(r=>r(e,n,{errorsLoading:t}))}setPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.Ue(kn)||{};this._instance.register({[kn]:T({},n,t)}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(kn)}setGroupPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.Ue(wt)||{};Object.keys(n).length!==0&&Object.keys(n).forEach(r=>{n[r]=T({},n[r],t[r]),delete t[r]}),this._instance.register({[wt]:T({},n,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.Ue(wt)||{};this._instance.register({[wt]:T({},e,{[t]:{}})})}else this._instance.unregister(wt)}reset(){this.Ie=!1,this.Ce=!1,this.Fe=!1,this.Ae=!1,this.Me=!1,this.$anon_distinct_id=void 0,this.We(),this.Oe=!1}}},qv={sessionRecording:class{get N(){return this._instance.config}get Wt(){return this._instance.persistence}get started(){var t;return!((t=this.Ge)==null||!t.isStarted)}get status(){var t,e;return this.Je===vn||this.Je===sr?this.Je:(t=(e=this.Ge)==null?void 0:e.status)!==null&&t!==void 0?t:this.Je}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.Je=hl,this.Ke=void 0,this._instance=t,!this._instance.sessionManager)throw lt.error("started without valid sessionManager"),new Error(Ri+" started without valid sessionManager. This is a bug.");if(this.N.cookieless_mode===Le)throw new Error(Ri+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Xe(){var t,e=!((t=this._instance.get_property(Xn))==null||!t.enabled),n=!this.N.disable_session_recording,r=this.N.disable_session_recording||this._instance.consent.isOptedOut();return v&&e&&n&&!r}startIfEnabledOrStop(t){var e;if(!this.Xe||(e=this.Ge)==null||!e.isStarted){var n=!O(Object.assign)&&!O(Array.from);this.Xe&&n?(this.Qe(t),lt.info("starting")):(this.Je=hl,this.stopRecording())}}Qe(t){var e,n,r;this.Xe&&(this.Je!==vn&&this.Je!==sr&&(this.Je=pl),M!=null&&(e=M.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(n=M.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Ze(t):(r=M.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.tr,s=>{if(s)return lt.error("could not load recorder",s);this.Ze(t)}))}stopRecording(){var t,e;(t=this.Ke)==null||t.call(this),this.Ke=void 0,(e=this.Ge)==null||e.stop()}ir(){var t,e;(t=this.Ke)==null||t.call(this),this.Ke=void 0,(e=this.Ge)==null||e.discard()}er(){var t;(t=this.Wt)==null||t.unregister(fu)}rr(t,e){if(G(t))return null;var n,r=We(t)?t:parseFloat(t);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(lt.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}sr(t){if(this.Wt){var e,n,r=this.Wt,s=()=>{var i,o=t.sessionRecording===!1?void 0:t.sessionRecording,a=this.rr((i=this.N.session_recording)==null?void 0:i.sampleRate,"session_recording.sampleRate"),l=this.rr(o==null?void 0:o.sampleRate,"remote config sampleRate"),c=a??l;G(c)&&this.er();var u=o==null?void 0:o.minimumDurationMilliseconds;r.register({[Xn]:T({cache_timestamp:Date.now(),enabled:!!o},o,{networkPayloadCapture:T({capturePerformance:t.capturePerformance},o==null?void 0:o.networkPayloadCapture),canvasRecording:{enabled:o==null?void 0:o.recordCanvas,fps:o==null?void 0:o.canvasFps,quality:o==null?void 0:o.canvasQuality},sampleRate:c,minimumDurationMilliseconds:O(u)?null:u,endpoint:o==null?void 0:o.endpoint,triggerMatchType:o==null?void 0:o.triggerMatchType,masking:o==null?void 0:o.masking,urlTriggers:o==null?void 0:o.urlTriggers})})};s(),(e=this.Ke)==null||e.call(this),this.Ke=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(s)}}onRemoteConfig(t){return"sessionRecording"in t?t.sessionRecording===!1?(this.sr(t),void this.ir()):(this.sr(t),void this.startIfEnabledOrStop()):(this.Je===vn&&(this.Je=sr,lt.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var n;e===void 0&&(e="log"),(n=this.Ge)!=null&&n.log?this.Ge.log(t,e):lt.warn("log called before recorder was ready")}get tr(){var t,e,n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(Xn);return(n==null||(e=n.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}nr(){var t,e=this._instance.get_property(Xn);if(!e)return!1;var n=(t=(typeof e=="object"?e:JSON.parse(e)).cache_timestamp)!==null&&t!==void 0?t:Date.now();return 36e5>=Date.now()-n}Ze(t){var e,n;if((e=M.__PosthogExtensions__)==null||!e.initSessionRecording)return lt.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0});if(this.Ge||(this.Ge=(n=M.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.Ge._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.nr())return this.Je===sr||this.Je===vn?void 0:(this.Je=vn,lt.info("persisted remote config is stale, requesting fresh config before starting"),void new Tu(this._instance).load());this.Je=pl,this.Ge.start(t)}onRRwebEmit(t){var e;(e=this.Ge)==null||e.onRRwebEmit==null||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.Ge||(e=this.Wt)==null||e.register({$replay_override_linked_flag:!0}),(t=this.Ge)==null||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Ge||(e=this.Wt)==null||e.register({$replay_override_sampling:!0}),(t=this.Ge)==null||t.overrideSampling()}overrideTrigger(t){var e,n;this.Ge||(n=this.Wt)==null||n.register({[t==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(e=this.Ge)==null||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.Ge)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var n;return!((n=this.Ge)==null||!n.tryAddCustomEvent(t,e))}}},Gv={autocapture:class{constructor(t){this.ar=!1,this.lr=null,this.ur=!1,this.instance=t,this.rageclicks=new ll(t.config.rageclick),this.hr=null}initialize(){this.startIfEnabled()}get N(){var t,e,n=_e(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(t=n.url_allowlist)==null?void 0:t.map(r=>new RegExp(r)),n.url_ignorelist=(e=n.url_ignorelist)==null?void 0:e.map(r=>new RegExp(r)),n}dr(){if(this.isBrowserSupported()){if(v&&$){var t=n=>{n=n||(v==null?void 0:v.event);try{this.vr(n)}catch(r){cl.error("Failed to capture event",r)}};if(he($,"submit",t,{capture:!0}),he($,"change",t,{capture:!0}),he($,"click",t,{capture:!0}),this.N.capture_copied_text){var e=n=>{this.vr(n=n||(v==null?void 0:v.event),$s)};he($,"copy",e,{capture:!0}),he($,"cut",e,{capture:!0})}}}else cl.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.ar&&(this.dr(),this.ar=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.ur=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Ta]:!!t.autocapture_opt_out}),this.lr=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.hr=t}getElementSelectors(t){var e,n=[];return(e=this.hr)==null||e.forEach(r=>{var s=$==null?void 0:$.querySelectorAll(r);s==null||s.forEach(i=>{t===i&&n.push(r)})}),n}get isEnabled(){var t,e,n=(t=this.instance.persistence)==null?void 0:t.props[Ta];if(rt(this.lr)&&!Xe(n)&&!this.instance.bt())return!1;var r=(e=this.lr)!==null&&e!==void 0?e:!!n;return!!this.instance.config.autocapture&&!r}vr(t,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var n,r=nl(t);ju(r)&&(r=r.parentNode||null),e==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&function(d,p){if(!v||Ci(d))return!1;var f,g,_;if(Xe(p)?(f=!!p&&sl,g=void 0):(f=(_=p==null?void 0:p.css_selector_ignorelist)!==null&&_!==void 0?_:sl,g=p==null?void 0:p.content_ignorelist),f===!1)return!1;var{targetElementList:P}=il(d,!1);return!function(m,b){if(m===!1||O(m))return!1;var C;if(m===!0)C=Cv;else{if(!Y(m))return!1;if(m.length>10)return R.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;C=m.map(x=>x.toLowerCase())}return b.some(x=>{var{safeText:S,ariaLabel:k}=x;return C.some(w=>S.includes(w)||k.includes(w))})}(g,P.map(m=>{var b;return{safeText:Ln(m).toLowerCase(),ariaLabel:((b=m.getAttribute("aria-label"))==null?void 0:b.toLowerCase().trim())||""}}))&&!rl(P,f)}(r,this.instance.config.rageclick)&&this.vr(t,"$rageclick");var s=e===$s;if(r&&function(d,p,f,g,_){var P,m,b,C;if(f===void 0&&(f=void 0),!v||Ci(d)||(P=f)!=null&&P.url_allowlist&&!tl(f.url_allowlist)||(m=f)!=null&&m.url_ignorelist&&tl(f.url_ignorelist))return!1;if((b=f)!=null&&b.dom_event_allowlist){var x=f.dom_event_allowlist;if(x&&!x.some(I=>p.type===I))return!1}var{parentIsUsefulElement:S,targetElementList:k}=il(d,g);if(!function(I,A){var j=A==null?void 0:A.element_allowlist;if(O(j))return!0;var F,H=function(K){if(j.some(Z=>K.tagName.toLowerCase()===Z))return{v:!0}};for(var B of I)if(F=H(B))return F.v;return!1}(k,f)||!rl(k,(C=f)==null?void 0:C.css_selector_allowlist))return!1;var w=v.getComputedStyle(d);if(w&&w.getPropertyValue("cursor")==="pointer"&&p.type==="click")return!0;var E=d.tagName.toLowerCase();switch(E){case"html":return!1;case"form":return(_||["submit"]).indexOf(p.type)>=0;case"input":case"select":case"textarea":return(_||["change","click"]).indexOf(p.type)>=0;default:return S?(_||["click"]).indexOf(p.type)>=0:(_||["click"]).indexOf(p.type)>=0&&(co.indexOf(E)>-1||d.getAttribute("contenteditable")==="true")}}(r,t,this.N,s,s?["copy","cut"]:void 0)){var{props:i,explicitNoCapture:o}=Mv(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.N.element_attribute_ignorelist,elementsChainAsString:this.ur});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(i.$element_selectors=a),e===$s){var l,c=Hu(v==null||(l=v.getSelection())==null?void 0:l.toString()),u=t.type||"clipboard";if(!c)return!1;i.$selected_content=c,i.$copy_type=u}return this.instance.capture(e,i),!0}}}isBrowserSupported(){return Ke($==null?void 0:$.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.cr=(v==null||(e=v.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(R.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.pr&&this.pr(),this.pr=void 0,R.info("History API monitoring stopped")}monitorHistoryChanges(){var t,e;if(v&&v.history){var n=this;(t=v.history.pushState)!=null&&t.__posthog_wrapped__||ul(v.history,"pushState",r=>function(s,i,o){r.call(this,s,i,o),n._r("pushState")}),(e=v.history.replaceState)!=null&&e.__posthog_wrapped__||ul(v.history,"replaceState",r=>function(s,i,o){r.call(this,s,i,o),n._r("replaceState")}),this.gr()}}_r(t){try{var e,n=v==null||(e=v.location)==null?void 0:e.pathname;if(!n)return;n!==this.cr&&this.isEnabled&&this._instance.capture(Ut,{navigation_type:t}),this.cr=n}catch(r){R.error("Error capturing "+t+" pageview",r)}}gr(){if(!this.pr){var t=()=>{this._r("popstate")};he(v,"popstate",t),this.pr=()=>{v&&v.removeEventListener("popstate",t)}}}},heatmaps:class{get N(){return this.instance.config}constructor(t){var e;this.mr=!1,this.ar=!1,this.br=null,this.instance=t,this.mr=!((e=this.instance.persistence)==null||!e.props[ui]),this.rageclicks=new ll(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return _e(this.N.capture_heatmaps)&&this.N.capture_heatmaps.flush_interval_milliseconds&&(t=this.N.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return G(this.N.capture_heatmaps)?G(this.N.enable_heatmaps)?this.mr:this.N.enable_heatmaps:this.N.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.ar)return;Lv.info("starting..."),this.yr(),this.wr()}else{var t;clearInterval((t=this.br)!==null&&t!==void 0?t:void 0),this.Er(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[ui]:e}),this.mr=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.I;return this.I=void 0,t}Sr(t){this.Tr(t.originalEvent,"deadclick")}wr(){this.br&&clearInterval(this.br),this.br=($==null?void 0:$.visibilityState)==="visible"?setInterval(this.At.bind(this),this.flushIntervalMilliseconds):null}yr(){v&&$&&(this.$r=this.At.bind(this),he(v,$r,this.$r),this.kr=t=>this.Tr(t||(v==null?void 0:v.event)),he($,"click",this.kr,{capture:!0}),this.Rr=t=>this.Pr(t||(v==null?void 0:v.event)),he($,"mousemove",this.Rr,{capture:!0}),this.Or=new Ma(this.instance,Qg,this.Sr.bind(this)),this.Or.startIfEnabledOrStop(),this.Ir=this.wr.bind(this),he($,Cr,this.Ir),this.ar=!0)}Er(){var t;v&&$&&(this.$r&&v.removeEventListener($r,this.$r),this.kr&&$.removeEventListener("click",this.kr,{capture:!0}),this.Rr&&$.removeEventListener("mousemove",this.Rr,{capture:!0}),this.Ir&&$.removeEventListener(Cr,this.Ir),clearTimeout(this.Cr),(t=this.Or)==null||t.stop(),this.ar=!1)}Fr(t,e){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),i=function(o,a,l){for(var c=o;c&&ns(c)&&!ft(c,"body");){if(c===l)return!1;if(q(a,v==null?void 0:v.getComputedStyle(c).position))return!0;c=Bu(c)}return!1}(nl(t),["fixed","sticky"],s);return{x:t.clientX+(i?0:r),y:t.clientY+(i?0:n),target_fixed:i,type:e}}Tr(t,e){var n;if(e===void 0&&(e="click"),!el(t.target)&&fl(t)){var r=this.Fr(t,e);(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this.Ar(T({},r,{type:"rageclick"})),this.Ar(r)}}Pr(t){!el(t.target)&&fl(t)&&(clearTimeout(this.Cr),this.Cr=setTimeout(()=>{this.Ar(this.Fr(t,"mousemove"))},500))}Ar(t){if(v){var e=v.location.href,n=this.N.custom_personal_data_properties,r=this.N.mask_personal_data_properties?[...tn,...n||[]]:[],s=Mn(e,r,Dn);this.I=this.I||{},this.I[s]||(this.I[s]=[]),this.I[s].push(t)}}At(){this.I&&!Bt(this.I)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ma,webVitalsAutocapture:class{constructor(t){var e;this.mr=!1,this.ar=!1,this.I={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Mr=()=>{clearTimeout(this.Dr),this.I.metrics.length!==0&&(this._instance.capture("$web_vitals",this.I.metrics.reduce((n,r)=>T({},n,{["$web_vitals_"+r.name+"_event"]:T({},r),["$web_vitals_"+r.name+"_value"]:r.value}),{})),this.I={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Lr=n=>{var r,s=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0);if(O(s))at.error("Could not read session ID. Dropping metrics!");else{this.I=this.I||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var i=this.Ur();O(i)||(G(n==null?void 0:n.name)||G(n==null?void 0:n.value)?at.error("Invalid metric received",n):!this.Nr||this.Nr>n.value?(this.I.url!==i&&(this.Mr(),this.Dr=setTimeout(this.Mr,this.flushToCaptureTimeoutMs)),O(this.I.url)&&(this.I.url=i),this.I.firstMetricTimestamp=O(this.I.firstMetricTimestamp)?Date.now():this.I.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.I.metrics.push(T({},n,{$current_url:i,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.I.metrics.length===this.allowedMetrics.length&&this.Mr()):at.error("Ignoring metric with value >= "+this.Nr,n))}},this.jr=()=>{if(!this.ar){var n,r,s,i,o=M.__PosthogExtensions__;O(o)||O(o.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:r,onFCP:s,onINP:i}=o.postHogWebVitalsCallbacks),n&&r&&s&&i?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.Lr.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.Lr.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this.Lr.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&i(this.Lr.bind(this)),this.ar=!0):at.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.mr=!((e=this._instance.persistence)==null||!e.props[$a]),this.startIfEnabled()}get zr(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,n=_e(this.zr)?(t=this.zr)==null?void 0:t.web_vitals_allowed_metrics:void 0;return G(n)?((e=this._instance.persistence)==null?void 0:e.props[Oa])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(_e(this.zr)?this.zr.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=_e(this.zr)?this.zr.web_vitals_attribution:void 0;return t!=null&&t}get Nr(){var t=_e(this.zr)&&We(this.zr.__web_vitals_max_value)?this.zr.__web_vitals_max_value:dl;return t>0&&6e4>=t?dl:t}get isEnabled(){var t=ve==null?void 0:ve.protocol;if(t!=="http:"&&t!=="https:")return at.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=_e(this.zr)?this.zr.web_vitals:Xe(this.zr)?this.zr:void 0;return Xe(e)?e:this.mr}startIfEnabled(){this.isEnabled&&!this.ar&&(at.info("enabled, starting..."),this.Y(this.jr))}onRemoteConfig(t){if("capturePerformance"in t){var e=_e(t.capturePerformance)&&!!t.capturePerformance.web_vitals,n=_e(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[$a]:e}),this._instance.persistence.register({[Oa]:n})),this.mr=e,this.startIfEnabled()}}Y(t){var e,n;(e=M.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?t():(n=M.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",r=>{r?at.error("failed to load script",r):t()})}Ur(){var t=v?v.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...tn,...e||[]]:[];return Mn(t,n,Dn)}at.error("Could not determine current URL")}}},Vv={exceptionObserver:class{constructor(t){var e,n,r;this.jr=()=>{var s;if(v&&this.isEnabled&&(s=M.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var i=M.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=M.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=M.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Br&&this.N.capture_unhandled_errors&&(this.Br=i(this.captureException.bind(this))),!this.Hr&&this.N.capture_unhandled_rejections&&(this.Hr=o(this.captureException.bind(this))),!this.qr&&this.N.capture_console_errors&&(this.qr=a(this.captureException.bind(this)))}catch(l){gn.error("failed to start",l),this.Wr()}}},this._instance=t,this.Vr=!((e=this._instance.persistence)==null||!e.props[Pa]),this.Yr=new dg({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10,refillInterval:1e4,h:gn}),this.N=this.Gr(),this.startIfEnabledOrStop()}Gr(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return _e(t)?e=T({},e,t):(O(t)?this.Vr:t)&&(e=T({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.N.capture_console_errors||this.N.capture_unhandled_errors||this.N.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(gn.info("enabled"),this.Wr(),this.Y(this.jr)):this.Wr()}Y(t){var e,n;(e=M.__PosthogExtensions__)!=null&&e.errorWrappingFunctions&&t(),(n=M.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",r=>{if(r)return gn.error("failed to load script",r);t()})}Wr(){var t,e,n;(t=this.Br)==null||t.call(this),this.Br=void 0,(e=this.Hr)==null||e.call(this),this.Hr=void 0,(n=this.qr)==null||n.call(this),this.qr=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.Vr=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[Pa]:this.Vr}),this.N=this.Gr(),this.startIfEnabledOrStop())}onConfigChange(){this.N=this.Gr()}captureException(t){var e,n,r,s=(e=t==null||(n=t.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&e!==void 0?e:"Exception";this.Yr.consumeRateLimit(s)?gn.info("Skipping exception capture because of client rate limiting.",{exception:s}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,n;this.Jr=[],this.Kr=new Sg([new Rg,new Ug,new Ag,new Og,new Lg,new Dg,new Ng,new jg],function(r){for(var s=arguments.length,i=new Array(s>1?s-1:0),o=1;s>o;o++)i[o-1]=arguments[o];return function(a,l){l===void 0&&(l=0);for(var c=[],u=a.split(`
|
|
16
|
+
`),d=l;u.length>d;d++){var p=u[d];if(1024>=p.length){var f=xa.test(p)?p.replace(xa,"$1"):p;if(!f.match(/\S*Error: /)){for(var g of i){var _=g(f,r);if(_){c.push(_);break}}if(c.length>=50)break}}}return function(P){if(!P.length)return[];var m=Array.from(P);return m.reverse(),m.slice(0,50).map(b=>{return T({},b,{filename:b.filename||(C=m,C[C.length-1]||{}).filename,function:b.function||en});var C})}(c)}}("web:javascript",Tg,$g)),this._instance=t,this.Jr=(e=(n=this._instance.persistence)==null?void 0:n.get_property(di))!==null&&e!==void 0?e:[]}onRemoteConfig(t){var e,n,r;if("errorTracking"in t){var s=(e=(n=t.errorTracking)==null?void 0:n.suppressionRules)!==null&&e!==void 0?e:[],i=(r=t.errorTracking)==null?void 0:r.captureExtensionExceptions;this.Jr=s,this._instance.persistence&&this._instance.persistence.register({[di]:this.Jr,[Ca]:i})}}get Xr(){var t,e=!!this._instance.get_property(Ca),n=this._instance.config.error_tracking.captureExtensionExceptions;return(t=n??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.Kr.buildFromUnknown(t,{syntheticException:e==null?void 0:e.syntheticException,mechanism:{handled:e==null?void 0:e.handled}})}sendExceptionEvent(t){var e=t.$exception_list;if(this.Qr(e)){if(this.Zr(e))return void Ms.info("Skipping exception capture because a suppression rule matched");if(!this.Xr&&this.ts(e))return void Ms.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.es(e))return void Ms.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",Ui:!0})}Zr(t){if(t.length===0)return!1;var e=t.reduce((n,r)=>{var{type:s,value:i}=r;return fe(s)&&s.length>0&&n.$exception_types.push(s),fe(i)&&i.length>0&&n.$exception_values.push(i),n},{$exception_types:[],$exception_values:[]});return this.Jr.some(n=>{var r=n.values.map(s=>{var i,o=Nu[s.operator],a=Y(s.value)?s.value:[s.value],l=(i=e[s.key])!==null&&i!==void 0?i:[];return a.length>0&&o(a,l)});return n.type==="OR"?r.some(Boolean):r.every(Boolean)})}ts(t){return t.flatMap(e=>{var n,r;return(n=(r=e.stacktrace)==null?void 0:r.frames)!==null&&n!==void 0?n:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}es(t){if(t.length>0){var e,n,r,s,i=(e=(n=t[0].stacktrace)==null?void 0:n.frames)!==null&&e!==void 0?e:[],o=i[i.length-1];return(r=o==null||(s=o.filename)==null?void 0:s.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}Qr(t){return!G(t)&&Y(t)}}},Yv=T({productTours:class{get Wt(){return this._instance.persistence}constructor(t){this.rs=null,this.ss=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this.Wt&&this.Wt.register({[Ra]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,e;this.rs||(t=this._instance).config.disable_product_tours||(e=t.persistence)==null||!e.get_property(Ra)||this.Y(()=>this.ns())}Y(t){var e,n;(e=M.__PosthogExtensions__)!=null&&e.generateProductTours?t():(n=M.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",r=>{r?_l.error("Could not load product tours script",r):t()})}ns(){var t;!this.rs&&(t=M.__PosthogExtensions__)!=null&&t.generateProductTours&&(this.rs=M.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(e===void 0&&(e=!1),!Y(this.ss)||e){var n=this.Wt;if(n){var r=n.props[Os];if(Y(r)&&!e)return this.ss=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:s=>{var i=s.statusCode;if(i!==200||!s.json){var o="Product Tours API could not be loaded, status: "+i;return _l.error(o),void t([],{isLoaded:!1,error:o})}var a=Y(s.json.product_tours)?s.json.product_tours:[];this.ss=a,n&&n.register({[Os]:a}),t(a,{isLoaded:!0})}})}else t(this.ss,{isLoaded:!0})}getActiveProductTours(t){G(this.rs)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.rs.getActiveProductTours(t)}showProductTour(t){var e;(e=this.rs)==null||e.showTourById(t)}previewTour(t){this.rs?this.rs.previewTour(t):this.Y(()=>{var e;this.ns(),(e=this.rs)==null||e.previewTour(t)})}dismissProductTour(){var t;(t=this.rs)==null||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.rs)==null||t.nextStep()}previousStep(){var t;(t=this.rs)==null||t.previousStep()}clearCache(){var t;this.ss=null,(t=this.Wt)==null||t.unregister(Os)}resetTour(t){var e;(e=this.rs)==null||e.resetTour(t)}resetAllTours(){var t;(t=this.rs)==null||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.rs)==null||e.cancelPendingTour(t)}}},rs),Kv={siteApps:class{constructor(t){this._instance=t,this.os=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ls(t,e){if(e){var n=this.globalsForEvent(e);this.os.push(n),this.os.length>1e3&&(this.os=this.os.slice(10))}}get siteAppLoaders(){var t;return(t=M._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.ls.bind(this));this.us=()=>{t(),this.os=[],this.us=void 0}}}globalsForEvent(t){var e,n,r,s,i,o,a;if(!t)throw new Error("Event payload is required");var l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var[d,p]of Object.entries(u))l[d]={id:c[d],type:d,properties:p};var{$set_once:f,$set:g}=t;return{event:T({},Bc(t,jv),{properties:T({},t.properties,g?{$set:T({},(e=(n=t.properties)==null?void 0:n.$set)!==null&&e!==void 0?e:{},g)}:{},f?{$set_once:T({},(r=(s=t.properties)==null?void 0:s.$set_once)!==null&&r!==void 0?r:{},f)}:{}),elements_chain:(i=(o=t.properties)==null?void 0:o.$elements_chain)!==null&&i!==void 0?i:"",distinct_id:(a=t.properties)==null?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(t){var e=this.apps[t.id],n=()=>{var o;!e.errored&&this.os.length&&(ct.info("Processing "+this.os.length+" events for site app with id "+t.id),this.os.forEach(a=>e.processEvent==null?void 0:e.processEvent(a)),e.processedBuffer=!0),Object.values(this.apps).every(a=>a.processedBuffer||a.errored)&&((o=this.us)==null||o.call(this))},r=!1,s=o=>{e.errored=!o,e.loaded=!0,ct.info("Site app with id "+t.id+" "+(o?"loaded":"errored")),r&&n()};try{var{processEvent:i}=t.init({posthog:this._instance,callback(o){s(o)}});i&&(e.processEvent=i),r=!0}catch(o){ct.error(gl+t.id,o),s(!1)}if(r&&e.loaded)try{n()}catch(o){ct.error("Error while processing buffered events PostHog app with config id "+t.id,o),e.errored=!0}}hs(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of t)this.setupSiteApp(n)}ds(t){if(Object.keys(this.apps).length!==0){var e=this.globalsForEvent(t);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(e)}catch(r){ct.error("Error while processing event "+t.event+" for site app "+n.id,r)}}}onRemoteConfig(t){var e,n,r,s=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.hs(),void this._instance.on("eventCaptured",l=>this.ds(l))):void ct.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.us)==null||n.call(this),(r=t.siteApps)!=null&&r.length)if(this.isEnabled){var i=function(l){var c;M["__$$ph_site_app_"+l]=s._instance,(c=M.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(s._instance,a,u=>{if(u)return ct.error(gl+l,u)})};for(var{id:o,url:a}of t.siteApps)i(o)}else ct.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Jv={tracingHeaders:class{constructor(t){this.vs=void 0,this.cs=void 0,this.jr=()=>{var e,n;O(this.vs)&&((e=M.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),O(this.cs)&&((n=M.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}initialize(){this.startIfEnabledOrStop()}Y(t){var e,n;(e=M.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns&&t(),(n=M.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",r=>{if(r)return Dv.error("failed to load script",r);t()})}startIfEnabledOrStop(){var t,e;this._instance.config.__add_tracing_headers?this.Y(this.jr):((t=this.vs)==null||t.call(this),(e=this.cs)==null||e.call(this),this.vs=void 0,this.cs=void 0)}}},Xv=T({surveys:class{get N(){return this._instance.config}constructor(t){this.fs=void 0,this._surveyManager=null,this.ps=!1,this._s=[],this.gs=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.N.disable_surveys){var e=t.surveys;if(G(e))return Q.warn("Flags not loaded yet. Not loading surveys.");var n=Y(e);this.fs=n?e.length>0:e,Q.info("flags response received, isSurveysEnabled: "+this.fs),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],e=0;e<localStorage.length;e++){var n=localStorage.key(e);(n!=null&&n.startsWith(Ti)||n!=null&&n.startsWith("inProgressSurvey_"))&&t.push(n)}t.forEach(r=>localStorage.removeItem(r))}loadIfEnabled(){if(!this._surveyManager)if(this.ps)Q.info("Already initializing surveys, skipping...");else if(this.N.disable_surveys)Q.info(vl);else if(this.N.cookieless_mode&&this._instance.consent.isOptedOut())Q.info("Not loading surveys in cookieless mode without consent.");else{var t=M==null?void 0:M.__PosthogExtensions__;if(t){if(!O(this.fs)||this.N.advanced_enable_surveys){var e=this.fs||this.N.advanced_enable_surveys;this.ps=!0;try{var n=t.generateSurveys;if(n)return void this.bs(n,e);var r=t.loadExternalDependency;if(!r)return void this.ys(ro);r(this._instance,"surveys",s=>{s||!t.generateSurveys?this.ys("Could not load surveys script",s):this.bs(t.generateSurveys,e)})}catch(s){throw this.ys("Error initializing surveys",s),s}finally{this.ps=!1}}}else Q.error("PostHog Extensions not found.")}}bs(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new Bv(this._instance),Q.info("Surveys loaded successfully"),this.ws({isLoaded:!0})}ys(t,e){Q.error(t,e),this.ws({isLoaded:!1,error:t})}onSurveysLoaded(t){return this._s.push(t),this._surveyManager&&this.ws({isLoaded:!0}),()=>{this._s=this._s.filter(e=>e!==t)}}getSurveys(t,e){if(e===void 0&&(e=!1),this.N.disable_surveys)return Q.info(vl),t([]);var n,r=this._instance.get_property(pi);if(r&&!e)return t(r,{isLoaded:!0});typeof Promise<"u"&&this.gs?this.gs.then(s=>{var{surveys:i,context:o}=s;return t(i,o)}):(typeof Promise<"u"&&(this.gs=new Promise(s=>{n=s})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.N.token),method:"GET",timeout:this.N.surveys_request_timeout_ms,callback:s=>{var i;this.gs=null;var o=s.statusCode;if(o!==200||!s.json){var a="Surveys API could not be loaded, status: "+o;Q.error(a);var l={isLoaded:!1,error:a};return t([],l),void(n==null||n({surveys:[],context:l}))}var c,u=s.json.surveys||[],d=u.filter(f=>function(g){return!(!g.start_date||g.end_date)}(f)&&(function(g){var _;return!((_=g.conditions)==null||(_=_.events)==null||(_=_.values)==null||!_.length)}(f)||function(g){var _;return!((_=g.conditions)==null||(_=_.actions)==null||(_=_.values)==null||!_.length)}(f)));d.length>0&&((c=this._surveyEventReceiver)==null||c.register(d)),(i=this._instance.persistence)==null||i.register({[pi]:u});var p={isLoaded:!0};t(u,p),n==null||n({surveys:u,context:p})}}))}ws(t){for(var e of this._s)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(n){Q.error("Error in survey callback",n)}}getActiveMatchingSurveys(t,e){if(e===void 0&&(e=!1),!G(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Q.warn("init was not called")}Es(t){var e=null;return this.getSurveys(n=>{var r;e=(r=n.find(s=>s.id===t))!==null&&r!==void 0?r:null}),e}Ss(t){if(G(this._surveyManager))return{eligible:!1,reason:As};var e=typeof t=="string"?this.Es(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(G(this._surveyManager))return Q.warn("init was not called"),{visible:!1,disabledReason:As};var e=this.Ss(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return G(this._surveyManager)?(Q.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:As})):new Promise(n=>{this.getSurveys(r=>{var s,i=(s=r.find(a=>a.id===t))!==null&&s!==void 0?s:null;if(i){var o=this.Ss(i);n({visible:o.eligible,disabledReason:o.reason})}else n({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(t,e,n){var r;if(G(this._surveyManager))Q.warn("init was not called");else{var s=typeof t=="string"?this.Es(t):t;if(s!=null&&s.id)if(wv.includes(s.type)){var i=$==null?void 0:$.querySelector(e);if(i)return(r=s.appearance)!=null&&r.surveyPopupDelaySeconds?(Q.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var o,a;Q.info("Rendering survey "+s.id+" with delay of "+((o=s.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(s,i,n),Q.info("Survey "+s.id+" rendered")},1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,i,n);Q.warn("Survey element not found")}else Q.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Q.warn("Survey not found")}}displaySurvey(t,e){var n;if(G(this._surveyManager))Q.warn("init was not called");else{var r=this.Es(t);if(r){var s=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&e.ignoreDelay&&(s=T({},r,{appearance:T({},r.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==Ei.Popover&&e.initialResponses&&Q.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var i=this.canRenderSurvey(r);if(!i.visible)return void Q.warn("Survey is not eligible to be displayed: ",i.disabledReason)}e.displayType!==Ei.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}else Q.warn("Survey not found")}}cancelPendingSurvey(t){G(this._surveyManager)?Q.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;(t=this._surveyManager)==null||t.handlePageUnload()}}},rs),Zv={toolbar:class{constructor(t){this.instance=t}xs(t){M.ph_toolbar_state=t}Ts(){var t;return(t=M.ph_toolbar_state)!==null&&t!==void 0?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,n){if(t===void 0&&(t=void 0),e===void 0&&(e=void 0),n===void 0&&(n=void 0),gu(this.instance.config)||!v||!$)return!1;t=t??v.location,n=n??v.history;try{if(!e){try{v.localStorage.setItem("test","test"),v.localStorage.removeItem("test")}catch{return!1}e=v==null?void 0:v.localStorage}var r,s=zv||Fr(t.hash,"__posthog")||Fr(t.hash,"state"),i=s?Fa(()=>JSON.parse(atob(decodeURIComponent(s))))||Fa(()=>JSON.parse(decodeURIComponent(s))):null;return i&&i.action==="ph_authorize"?((r=i).source="url",r&&Object.keys(r).length>0&&(i.desiredHash?t.hash=i.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(e.getItem(ml)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}$s(t){var e=M.ph_load_toolbar||M.ph_load_editor;!G(e)&&Ke(e)?e(t,this.instance):yl.warn("No toolbar load function found")}loadToolbar(t){var e=!($==null||!$.getElementById(_u));if(!v||e)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=T({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(v.localStorage.setItem(ml,JSON.stringify(T({},r,{source:void 0}))),this.Ts()===2)this.$s(r);else if(this.Ts()===0){var s;this.xs(1),(s=M.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",i=>{if(i)return yl.error("[Toolbar] Failed to load",i),void this.xs(0);this.xs(2),this.$s(r)}),he(v,"turbolinks:load",()=>{this.xs(0),this.loadToolbar(r)})}return!0}ks(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,n){return t===void 0&&(t=void 0),e===void 0&&(e=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(t,e,n)}}},Qv=T({experiments:be},rs),em={conversations:class{constructor(t){this.Rs=void 0,this._conversationsManager=null,this.Ps=!1,this.Os=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;G(e)||(Xe(e)?this.Rs=e:(this.Rs=e.enabled,this.Os=e),this.loadIfEnabled())}}reset(){var t;(t=this._conversationsManager)==null||t.reset(),this._conversationsManager=null,this.Rs=void 0,this.Os=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ps||this._instance.config.disable_conversations||gu(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=M==null?void 0:M.__PosthogExtensions__;if(t&&!O(this.Rs)&&this.Rs)if(this.Os&&this.Os.token){this.Ps=!0;try{var e=t.initConversations;if(e)return this.Is(e),void(this.Ps=!1);var n=t.loadExternalDependency;if(!n)return void this.Cs(ro);n(this._instance,"conversations",r=>{r||!t.initConversations?this.Cs("Could not load conversations script",r):this.Is(t.initConversations),this.Ps=!1})}catch(r){this.Cs("Error initializing conversations",r),this.Ps=!1}}else Ae.error("Conversations enabled but missing token in remote config.")}}Is(t){if(this.Os)try{this._conversationsManager=t(this.Os,this._instance),Ae.info("Conversations loaded successfully")}catch(e){this.Cs("Error completing conversations initialization",e)}else Ae.error("Cannot complete initialization: remote config is null")}Cs(t,e){Ae.error(t,e),this._conversationsManager=null,this.Ps=!1}show(){this._conversationsManager?this._conversationsManager.show():Ae.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Rs===!0&&!rt(this._conversationsManager)}isVisible(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&t!==void 0&&t}sendMessage(t,e,n){var r=this;return De(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,e,n):(Ae.warn(Et),null)})()}getMessages(t,e){var n=this;return De(function*(){return n._conversationsManager?n._conversationsManager.getMessages(t,e):(Ae.warn(Et),null)})()}markAsRead(t){var e=this;return De(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Ae.warn(Et),null)})()}getTickets(t){var e=this;return De(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Ae.warn(Et),null)})()}requestRestoreLink(t){var e=this;return De(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Ae.warn(Et),null)})()}restoreFromToken(t){var e=this;return De(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Ae.warn(Et),null)})()}restoreFromUrlToken(){var t=this;return De(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Ae.warn(Et),null)})()}getCurrentTicketId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&t!==void 0?t:null}getWidgetSessionId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&t!==void 0?t:null}}},tm={logs:class{constructor(t){var e;this.Fs=!1,this.As=!1,this._instance=t,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.Fs=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,n=(e=t.logs)==null?void 0:e.captureConsoleLogs;!G(n)&&n&&(this.Fs=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.Fs&&!this.As){var t=oe("[logs]"),e=M==null?void 0:M.__PosthogExtensions__;if(e){var n=e.loadExternalDependency;n?n(this._instance,"logs",r=>{var s;r||(s=e.logs)==null||!s.initializeLogs?t.error("Could not load logs script",r):(e.logs.initializeLogs(this._instance),this.As=!0)}):t.error(ro)}else t.error("PostHog Extensions not found.")}}}},nm=T({},rs,qv,Gv,Vv,Yv,Kv,Xv,Jv,Zv,Qv,em,tm);Be.__defaultExtensionClasses=T({},nm);var xl,It=(xl=Cn[Ht]=new Be,function(){function t(){t.done||(t.done=!0,Lu=!1,te(Cn,function(e){e._dom_loaded()}))}$!=null&&$.addEventListener?$.readyState==="complete"?t():he($,"DOMContentLoaded",t,{capture:!1}):v&&R.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),xl),jn,ue,Ds,Il,Ur=0,Vu=[],pe=re,Tl=pe.__b,Pl=pe.__r,Cl=pe.diffed,$l=pe.__c,Rl=pe.unmount,Ol=pe.__;function uo(t,e){pe.__h&&pe.__h(ue,t,Ur||e),Ur=0;var n=ue.__H||(ue.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function W(t){return Ur=1,rm(Ku,t)}function rm(t,e,n){var r=uo(jn++,2);if(r.t=t,!r.__c&&(r.__=[Ku(void 0,e),function(a){var l=r.__N?r.__N[0]:r.__[0],c=r.t(l,a);l!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=ue,!ue.__f)){var s=function(a,l,c){if(!r.__c.__H)return!0;var u=r.__c.__H.__.filter(function(p){return p.__c});if(u.every(function(p){return!p.__N}))return!i||i.call(this,a,l,c);var d=r.__c.props!==a;return u.some(function(p){if(p.__N){var f=p.__[0];p.__=p.__N,p.__N=void 0,f!==p.__[0]&&(d=!0)}}),i&&i.call(this,a,l,c)||d};ue.__f=!0;var i=ue.shouldComponentUpdate,o=ue.componentWillUpdate;ue.componentWillUpdate=function(a,l,c){if(this.__e){var u=i;i=void 0,s(a,l,c),i=u}o&&o.call(this,a,l,c)},ue.shouldComponentUpdate=s}return r.__N||r.__}function rn(t,e){var n=uo(jn++,3);!pe.__s&&Yu(n.__H,e)&&(n.__=t,n.u=e,ue.__H.__h.push(n))}function sm(t,e){var n=uo(jn++,7);return Yu(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function pt(t,e){return Ur=8,sm(function(){return t},e)}function im(){for(var t;t=Vu.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(_r),e.__h.some(Oi),e.__h=[]}catch(n){e.__h=[],pe.__e(n,t.__v)}}}pe.__b=function(t){ue=null,Tl&&Tl(t)},pe.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Ol&&Ol(t,e)},pe.__r=function(t){Pl&&Pl(t),jn=0;var e=(ue=t.__c).__H;e&&(Ds===ue?(e.__h=[],ue.__h=[],e.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.some(_r),e.__h.some(Oi),e.__h=[],jn=0)),Ds=ue},pe.diffed=function(t){Cl&&Cl(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Vu.push(e)!==1&&Il===pe.requestAnimationFrame||((Il=pe.requestAnimationFrame)||om)(im)),e.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),Ds=ue=null},pe.__c=function(t,e){e.some(function(n){try{n.__h.some(_r),n.__h=n.__h.filter(function(r){return!r.__||Oi(r)})}catch(r){e.some(function(s){s.__h&&(s.__h=[])}),e=[],pe.__e(r,n.__v)}}),$l&&$l(t,e)},pe.unmount=function(t){Rl&&Rl(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.some(function(r){try{_r(r)}catch(s){e=s}}),n.__H=void 0,e&&pe.__e(e,n.__v))};var Al=typeof requestAnimationFrame=="function";function om(t){var e,n=function(){clearTimeout(r),Al&&cancelAnimationFrame(e),setTimeout(t)},r=setTimeout(n,35);Al&&(e=requestAnimationFrame(n))}function _r(t){var e=ue,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),ue=e}function Oi(t){var e=ue;t.__c=t.__(),ue=e}function Yu(t,e){return!t||t.length!==e.length||e.some(function(n,r){return n!==t[r]})}function Ku(t,e){return typeof e=="function"?e(t):e}const am="";async function ie(t,e,n){const r={method:t,headers:{"Content-Type":"application/json"},credentials:"include"};n&&(r.body=JSON.stringify(n));const s=await fetch(am+e,r);if(s.status===401)return{status:401,data:null,unauthorized:!0};const i=await s.json().catch(()=>null);return{status:s.status,data:i}}async function lm(){try{const e=await(await fetch("/api/auth/sign-in/social",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({provider:"google",callbackURL:"/dashboard"})})).json().catch(()=>null);if(e!=null&&e.url){window.location.href=e.url;return}}catch{}window.location.href="/api/auth/sign-in/social?provider=google&callbackURL=/dashboard"}function Hr({text:t,label:e="Copy"}){const[n,r]=W(!1);return h("button",{class:"btn-copy",onClick:()=>{navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),2e3)}},n?"✓ Copied!":e)}function Br(t){if(!t)return"never";const e=Math.floor((Date.now()-t)/1e3);return e<60?`${e}s ago`:e<3600?`${Math.floor(e/60)}m ago`:e<86400?`${Math.floor(e/3600)}h ago`:`${Math.floor(e/86400)}d ago`}function cm(){var z,ee,V,le;const[t,e]=W(!0),[n,r]=W(null),[s,i]=W([]),[o,a]=W([]),[l,c]=W(null),[u,d]=W(null),[p,f]=W(null),[g,_]=W("start"),[P,m]=W(!1),[b,C]=W(!1),[x,S]=W(!1),[k,w]=W(!1),E=pt(async()=>{var y;const D=await ie("GET","/v1/me");if(D!=null&&D.unauthorized){w(!0);return}D!=null&&D.data&&(r(D.data),(y=D.data.user)!=null&&y.email&&(It.identify(D.data.user.id||D.data.user.email,{email:D.data.user.email,name:D.data.user.name}),It.capture("dashboard_sign_in")))},[]),I=pt(async()=>{var y;const D=await ie("GET","/v1/api-keys");D&&i(((y=D.data)==null?void 0:y.api_keys)||[])},[]),A=pt(async()=>{var y;const D=await ie("GET","/v1/browser-sessions");D&&a(((y=D.data)==null?void 0:y.sessions)||[])},[]),j=pt(async()=>{const D=await ie("GET","/v1/usage");D&&c(D.data)},[]),F=pt(async()=>{const D=await ie("GET","/v1/billing/credits");D&&d(D.data)},[]);if(rn(()=>{Promise.all([E(),I(),A(),j(),F()]).then(()=>e(!1));const D=setInterval(A,5e3);return()=>clearInterval(D)},[]),rn(()=>{const D=y=>{var X,de;((X=y.data)==null?void 0:X.type)==="HANZI_EXTENSION_READY"&&m(!0),((de=y.data)==null?void 0:de.type)==="HANZI_PAIR_RESULT"&&(C(!1),y.data.success?(S(!0),A()):f("Pairing failed: "+(y.data.error||"unknown")))};return window.addEventListener("message",D),window.postMessage({type:"HANZI_PING"},"*"),()=>window.removeEventListener("message",D)},[]),t)return h(Nl,null);if(k)return lm(),h(Nl,null);const H=((ee=(z=n==null?void 0:n.user)==null?void 0:z.name)==null?void 0:ee.split(" ")[0])||"there",B=(V=n==null?void 0:n.user)!=null&&V.name?`${n.user.name}'s workspace`:"Your workspace",K=s.length>0,Z=o.find(D=>D.status==="connected"),N=!!Z||x;return h("div",{class:"page"},h("div",{class:"header"},h("div",null,h("h1",null,B),h("div",{class:"subtitle"},"Hi, ",H)),h("div",{style:{display:"flex",alignItems:"center",gap:12}},u&&h("div",{style:{textAlign:"right",fontSize:13,color:"var(--muted)"}},h("div",null,h("strong",{style:{color:"var(--ink)",fontSize:16}},(u.free_remaining||0)+(u.credit_balance||0))," tasks left"),h("div",null,u.free_remaining||0," free + ",u.credit_balance||0," credits")),h("button",{class:"signout",onClick:gm},"Sign out"))),h("div",{class:"tabs"},h("button",{class:`tab ${g==="start"?"active":""}`,onClick:()=>_("start")},"Getting Started"),h("button",{class:`tab ${g==="sessions"?"active":""}`,onClick:()=>_("sessions")},"Sessions",o.length>0&&h("span",{class:"tab-count"},o.filter(D=>D.status==="connected").length)),h("button",{class:`tab ${g==="settings"?"active":""}`,onClick:()=>_("settings")},"Settings")),g==="start"&&h(um,{keys:s,loadKeys:I,setError:f,extensionReady:P,pairing:b,paired:x,setPairing:C,setPaired:S,hasKeys:K,hasConnected:N,connectedSession:Z,sessions:o,loadSessions:A,loadUsage:j,setTab:_}),g==="sessions"&&h(hm,{sessions:o,onRefresh:A,usage:l}),g==="settings"&&h(pm,{keys:s,loadKeys:I,setError:f,profile:n,credits:u,loadCredits:F}),g==="automations"&&h(_m,{sessions:o,workspaceId:(le=n==null?void 0:n.workspace)==null?void 0:le.id,setError:f}),p&&h("div",{class:"error-toast",onClick:()=>f(null)},p))}function um({keys:t,loadKeys:e,setError:n,extensionReady:r,pairing:s,paired:i,setPairing:o,setPaired:a,hasKeys:l,hasConnected:c,connectedSession:u,sessions:d,loadSessions:p,loadUsage:f,setTab:g}){var Z;const[_,P]=W(""),[m,b]=W(null),[C,x]=W("Go to example.com and tell me the page title"),[S,k]=W(null),[w,E]=W(""),[I,A]=W(0),j=S==="complete",F=async()=>{var z;if(!_.trim())return;const N=await ie("POST","/v1/api-keys",{name:_.trim()});(N==null?void 0:N.status)===201?(b(N.data.key),P(""),await e()):n(((z=N==null?void 0:N.data)==null?void 0:z.error)||"Failed")},H=async()=>{var z;o(!0),It.capture("connect_browser_clicked");const N=await ie("POST","/v1/browser-sessions/pair",{label:"Developer testing"});if(!N||N.status!==201){o(!1),n(((z=N==null?void 0:N.data)==null?void 0:z.error)||"Failed");return}window.postMessage({type:"HANZI_PAIR",token:N.data.pairing_token,apiUrl:location.origin},"*"),setTimeout(()=>o(ee=>ee&&(n("Extension did not respond."),!1)),5e3)},B=async()=>{var le,D,y,X,de,ye;const N=(u==null?void 0:u.id)||((le=d.find(xe=>xe.status==="connected"))==null?void 0:le.id);if(!C.trim())return;if(!N){k("error"),E("No connected browser session found. Try refreshing the page.");return}k("running"),E(""),A(0),It.capture("test_task_run");const z=await ie("POST","/v1/tasks",{task:C.trim(),browser_session_id:N});if(!z||z.status!==201){k("error"),E(((D=z==null?void 0:z.data)==null?void 0:D.error)||"Failed");return}const ee=z.data.id,V=Date.now()+3*60*1e3;for(;Date.now()<V;){await new Promise(Pe=>setTimeout(Pe,2e3));const xe=await ie("GET",`/v1/tasks/${ee}`);if(!xe)break;if(A(((y=xe.data)==null?void 0:y.steps)||0),((X=xe.data)==null?void 0:X.status)!=="running"){k(((de=xe.data)==null?void 0:de.status)||"error"),E(((ye=xe.data)==null?void 0:ye.answer)||"No answer."),f();return}}k("error"),E("Timed out after 3 minutes.")},K=`Add browser automation to this project using the Hanzi API. Read the codebase first, then ask me:
|
|
17
17
|
|
|
18
18
|
1. What browser task should Hanzi automate? (e.g. "read patient chart", "fill out a form", "extract data from a web portal")
|
|
19
19
|
2. Where in the UI should the browser pairing flow go? (e.g. settings page, onboarding, a dedicated page)
|
|
@@ -58,4 +58,4 @@ GET /v1/tasks/:id/steps
|
|
|
58
58
|
- User needs the Hanzi Chrome extension: https://chromewebstore.google.com/detail/iklpkemlmbhemkiojndpbhoakgikpmcd
|
|
59
59
|
- Sample app: https://github.com/hanzili/hanzi-browse/tree/main/examples/partner-quickstart
|
|
60
60
|
|
|
61
|
-
Read the codebase to understand the stack and project structure, then ask me the 3 questions above. After I answer, build the full integration.`;return h("div",null,!l&&h("div",{class:"card"},h("h3",null,"Create your API key"),h("p",{class:"step-explain"},"You need this to call the Hanzi API from your backend."),h("div",{class:"inline-form"},h("input",{value:_,onInput:N=>P(N.target.value),placeholder:"Key name (e.g. dev)",maxLength:100,onKeyDown:N=>N.key==="Enter"&&F()}),h("button",{class:"btn-primary",onClick:F,disabled:!_.trim()},"Create key"))),m&&h("div",{class:"card"},h("h3",null,"Your API key"),h("div",{class:"key-created"},h("div",{class:"mono-with-copy"},h("div",{class:"mono"},m),h(Hr,{text:m,label:"Copy key"})),h("div",{class:"warning"},"Save this key — it won't be shown again.")),h("p",{class:"step-explain",style:{marginTop:12}},"Verify it works:"),h("div",{class:"mono-with-copy",style:{marginTop:4}},h("div",{class:"mono",style:{fontSize:11}},`curl ${location.origin}/v1/billing/credits -H "Authorization: Bearer ${m}"`),h(Hr,{text:`curl ${location.origin}/v1/billing/credits -H "Authorization: Bearer ${m}"`,label:"Copy"}))),l&&h("div",{class:"card",style:{background:"#f5f1e8"}},h("h3",null,"Build the integration"),h("p",{class:"step-explain"},"Copy this prompt into Claude Code, Cursor, or any AI coding agent. It has the full API reference and will ask you 3 questions before building."),h("div",{style:{display:"flex",gap:8,marginTop:10}},h("button",{class:"btn-primary",onClick:()=>{navigator.clipboard.writeText(K)},style:{fontSize:13},ref:N=>{N&&(N.onclick=()=>{navigator.clipboard.writeText(K),_t.capture("integration_prompt_copied"),N.textContent="Copied!",setTimeout(()=>N.textContent="Copy integration prompt",1500)})}},"Copy integration prompt"),h("a",{href:"/docs.html#build-with-hanzi",class:"btn-secondary",style:{textDecoration:"none",padding:"6px 14px",borderRadius:8,fontSize:13}},"Read the docs"))),l&&h(hm,{sessions:d,loadSessions:p,extensionReady:r,pairing:s,paired:i,pairBrowser:H,hasConnected:c,connectedSession:u,taskInput:C,setTaskInput:x,taskStatus:S,taskSteps:I,taskAnswer:w,testComplete:j,runTask:B,setTaskStatus:k,setTaskAnswer:E,setTab:g}))}function hm({sessions:t,loadSessions:e,extensionReady:n,pairing:r,paired:s,pairBrowser:i,hasConnected:o,connectedSession:a,taskInput:l,setTaskInput:c,taskStatus:u,taskSteps:d,taskAnswer:p,testComplete:f,runTask:g,setTaskStatus:_,setTaskAnswer:P,setTab:m}){const[b,C]=W(null),[x,S]=W(!1),[k,w]=W(null),[E,I]=W(null),[A,j]=W(!1),[F,H]=W(null),B=async()=>{S(!0),j(!1);const N=await ie("POST","/v1/browser-sessions/pair",{label:"User pairing link"});S(!1),(N==null?void 0:N.status)===201&&(C(`${location.origin}/pair/${N.data.pairing_token}`),w(Date.now()),I(t.length),H(300),_t.capture("pairing_link_generated"))};rn(()=>{if(F===null||F<=0)return;const N=setTimeout(()=>H(z=>z-1),1e3);return()=>clearTimeout(N)},[F]),rn(()=>{k&&E!==null&&t.length>E&&!A&&j(!0)},[t,k,E,A]);const K=F!==null&&F<=0&&!A,Z=N=>`${Math.floor(N/60)}:${String(N%60).padStart(2,"0")}`;return h(Tt,null,h("div",{class:"section-label",style:{marginTop:28}},"Try it out"),h("p",{class:"section-desc"},"Pair a browser, then run a task to see it work."),h("div",{class:"card"},h("div",{class:"step-row"},h("span",{class:`step-badge ${o||A?"done":"active"}`},o||A?"✓":"1"),h("div",{class:"step-content"},h("h3",null,o||A?"Browser paired":"Pair a browser"),o||A?h("p",{class:"step-explain"},A?"A user paired via your link.":"Your Chrome is connected for testing."," ",h("button",{class:"btn-secondary",onClick:()=>m("sessions"),style:{fontSize:11,padding:"2px 8px"}},"View sessions")):b?h("div",null,h("div",{class:"pairing-tracker"},h("div",{class:"pairing-step done"},h("div",{class:"pairing-dot done"}),h("span",null,"Generated")),h("div",{class:"pairing-line"}),h("div",{class:`pairing-step ${A?"done":"waiting"}`},h("div",{class:`pairing-dot ${A?"done":"waiting"}`}),h("span",null,A?"Paired":"Waiting for click..."))),h("div",{class:"mono-with-copy",style:{marginTop:12}},h("div",{class:"mono",style:{fontSize:12}},b),h(Hr,{text:b,label:"Copy link"})),h("div",{style:{display:"flex",gap:8,marginTop:8,alignItems:"center"}},h("a",{href:b,target:"_blank",rel:"noreferrer",class:"btn-primary",style:{display:"inline-block",textDecoration:"none",color:"white",padding:"6px 14px",borderRadius:8,fontSize:13}},"Open it"),h("button",{class:"btn-secondary",onClick:()=>{C(null),w(null),I(null),H(null),j(!1)},style:{fontSize:12}},"New link"),!K&&F>0&&h("span",{style:{fontSize:12,color:F<60?"var(--red)":"var(--muted)"}},"Expires in ",Z(F)),K&&h("span",{style:{fontSize:12,color:"var(--red)",fontWeight:600}},"Expired")),h("p",{class:"step-explain",style:{marginTop:8}},"User needs the ",h("a",{href:"https://chromewebstore.google.com/detail/hanzi-browse/iklpkemlmbhemkiojndpbhoakgikpmcd",target:"_blank"},"Hanzi extension")," installed.",n&&!A&&h(Tt,null," ","Or ",h("button",{style:{background:"none",border:"none",color:"var(--accent)",textDecoration:"underline",cursor:"pointer",padding:0,font:"inherit",fontSize:"inherit"},onClick:i,disabled:r},r?"connecting...":"connect this browser")," instead."))):h("div",null,h("p",{class:"step-explain"},"Generate a pairing link to share, or connect this browser directly."),h("div",{style:{display:"flex",gap:8,marginTop:4}},h("button",{class:"btn-primary",onClick:B,disabled:x},x?"Generating...":"Generate a link"),n&&h("button",{class:"btn-secondary",onClick:i,disabled:r},r?"Connecting...":"Connect this browser")),!n&&h("p",{class:"step-explain",style:{marginTop:8}},"To connect this browser directly, ",h("a",{href:"https://chromewebstore.google.com/detail/hanzi-browse/iklpkemlmbhemkiojndpbhoakgikpmcd",target:"_blank"},"install the extension")," first."),h("p",{class:"step-explain",style:{marginTop:8,fontSize:12,color:"#999"}},"In production, your backend calls ",h("code",null,"POST /v1/browser-sessions/pair")," to generate links programmatically."))))),(o||A)&&h("div",{class:"card"},h("div",{class:"step-row"},h("span",{class:`step-badge ${f?"done":"active"}`},f?"✓":"2"),h("div",{class:"step-content"},h("h3",null,"Run a test task"),h("p",{class:"step-explain"},"Tell Hanzi what to do in the paired browser."),u?u==="running"?h("div",{class:"task-running"},h("div",{class:"task-spinner"}),h("span",null,"Running... (",d," step",d!==1?"s":"",")")):h("div",{class:"task-result"},h("div",{class:`task-status-label ${u}`},u==="complete"?"✓ Complete":"✗ "+u,d>0&&` · ${d} steps`),h("div",{class:"task-answer"},p),h("button",{class:"btn-secondary",onClick:()=>{_(null),P("")},style:{marginTop:8}},"Run another")):h("div",{class:"inline-form"},h("input",{value:l,onInput:N=>c(N.target.value),placeholder:"What should Hanzi do?",onKeyDown:N=>N.key==="Enter"&&g()}),h("button",{class:"btn-primary",onClick:g,disabled:!l.trim()},"Run"))))))}function pm({sessions:t,onRefresh:e,usage:n}){const r=t.filter(l=>l.status==="connected"),s=t.filter(l=>l.status==="disconnected"),i=async l=>{await ie("DELETE",`/v1/browser-sessions/${l}`),e()},o=async()=>{for(const l of s)await ie("DELETE",`/v1/browser-sessions/${l.id}`);e()},a=l=>l>999999?(l/1e6).toFixed(1)+"M":l>999?(l/1e3).toFixed(1)+"K":String(l||0);return h("div",null,h("div",{class:"summary-bar"},h("span",{class:"summary-stat"},h("strong",null,r.length)," connected"),h("span",{class:"summary-stat"},h("strong",null,s.length)," disconnected"),h("span",{class:"summary-stat"},h("strong",null,(n==null?void 0:n.taskCount)||0)," tasks run")),r.length>0&&h("div",{class:"card"},h("h3",{style:{color:"var(--green)"}},"Connected"),r.map(l=>h(Fl,{key:l.id,session:l}))),s.length>0&&h("div",{class:"card"},h("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},h("h3",{style:{color:"var(--muted)"}},"Disconnected"),h("button",{class:"btn-secondary",onClick:o,style:{fontSize:11,padding:"3px 10px"}},"Remove all")),s.map(l=>h(Fl,{key:l.id,session:l,onRemove:()=>i(l.id)})),h("p",{class:"step-explain",style:{marginTop:6}},"Sessions reconnect automatically when the browser reopens.")),t.length===0&&h("div",{class:"card"},h("p",{class:"step-explain"},"No sessions yet. Go to Getting Started to pair a browser.")),h("div",{class:"card"},h("h3",null,"Usage"),h("div",{class:"usage-grid"},h("div",{class:"usage-stat"},h("div",{class:"num"},(n==null?void 0:n.taskCount)||0),h("div",{class:"label"},"Tasks")),h("div",{class:"usage-stat"},h("div",{class:"num"},a(n==null?void 0:n.totalApiCalls)),h("div",{class:"label"},"API calls")),h("div",{class:"usage-stat"},h("div",{class:"num"},a(((n==null?void 0:n.totalInputTokens)||0)+((n==null?void 0:n.totalOutputTokens)||0))),h("div",{class:"label"},"Tokens")))),h("button",{class:"btn-secondary",onClick:e,style:{marginTop:8,fontSize:12}},"Refresh"))}function Fl({session:t,onRemove:e}){const n=t.label||t.external_user_id||"Unnamed";return h("div",{class:"session-row"},h("span",{class:"session-info"},h("span",{class:`status-dot ${t.status}`}),h("span",{class:"session-label"},n),t.external_user_id&&t.label&&h("span",{class:"session-meta"},t.external_user_id)),h("span",{class:"session-id-group"},h("span",{class:"session-time"},Br(t.last_heartbeat)),h("code",null,t.id.slice(0,8),"..."),e&&h("button",{class:"btn-danger",onClick:e,style:{padding:"2px 8px",fontSize:11}},"Remove")))}function fm({keys:t,loadKeys:e,setError:n,profile:r,credits:s,loadCredits:i}){const[o,a]=W(""),[l,c]=W(null),u=async()=>{var f;if(!o.trim())return;const p=await ie("POST","/v1/api-keys",{name:o.trim()});(p==null?void 0:p.status)===201?(c(p.data.key),a(""),await e()):n(((f=p==null?void 0:p.data)==null?void 0:f.error)||"Failed")},d=async p=>{confirm("Delete this API key?")&&(await ie("DELETE",`/v1/api-keys/${p}`),c(null),await e())};return h("div",null,h("div",{class:"card"},h("h3",null,"API Keys"),t.map(p=>h("div",{class:"key-row",key:p.id},h("span",null,h("strong",null,p.name)," ",h("code",{class:"key-prefix"},p.key_prefix),p.last_used_at&&h("span",{class:"session-meta"}," · used ",Br(p.last_used_at))),h("button",{class:"btn-danger",onClick:()=>d(p.id)},"Delete"))),l&&h("div",{class:"key-created"},h("div",{class:"mono-with-copy"},h("div",{class:"mono"},l),h(Hr,{text:l,label:"Copy key"})),h("div",{class:"warning"},"Save this key — it won't be shown again.")),h("div",{class:"inline-form",style:{marginTop:8}},h("input",{value:o,onInput:p=>a(p.target.value),placeholder:"Key name",maxLength:100,onKeyDown:p=>p.key==="Enter"&&u()}),h("button",{class:"btn-primary",onClick:u,disabled:!o.trim()},"Create key"))),h("div",{class:"card"},h("h3",null,"Credits & Usage"),s?h("div",null,h("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12,margin:"8px 0 12px"}},h("div",{style:{padding:12,background:"#f5f1e8",borderRadius:8,textAlign:"center"}},h("div",{style:{fontSize:28,fontWeight:700}},s.free_remaining||0),h("div",{style:{fontSize:12,color:"var(--muted)"}},"free tasks left"),h("div",{style:{fontSize:11,color:"var(--muted)"}},"of ",s.free_tasks_per_month,"/month")),h("div",{style:{padding:12,background:"#f5f1e8",borderRadius:8,textAlign:"center"}},h("div",{style:{fontSize:28,fontWeight:700}},s.credit_balance||0),h("div",{style:{fontSize:12,color:"var(--muted)"}},"purchased credits"),h("div",{style:{fontSize:11,color:"var(--muted)"}},"$0.05/task"))),h("p",{class:"step-explain"},"You only pay for completed tasks. Errors and timeouts are free."),h(_m,{loadCredits:i,setError:n})):h("p",{class:"step-explain"},"Loading...")),h("div",{class:"card",style:{background:"#f5f1e8"}},h("h3",null,"Building a product with Hanzi?"),h("p",{class:"step-explain"},"Need volume pricing, custom SLAs, or dedicated support? We offer wholesale rates starting at $0.02/task for partners."),h("a",{href:"mailto:hanzili0217@gmail.com?subject=Partner%20pricing&body=Hi%20Hanzi%20team%2C%0A%0AI%27m%20building%20a%20product%20that%20uses%20browser%20automation.%0A%0AExpected%20volume%3A%20%0AUse%20case%3A%20%0A",class:"btn-primary",style:{display:"inline-block",textDecoration:"none",color:"white",padding:"8px 16px",borderRadius:8,fontSize:13,marginTop:8}},"Contact us for partner pricing")),h("div",{class:"card"},h("h3",null,"Resources"),h("div",{style:{display:"flex",flexDirection:"column",gap:6}},h("a",{href:"/docs.html#build-with-hanzi"},"API Documentation"),h("a",{href:"https://github.com/hanzili/hanzi-browse/tree/main/examples/partner-quickstart",target:"_blank"},"Sample App (GitHub)"),h("a",{href:"https://github.com/hanzili/hanzi-browse/tree/main/sdk",target:"_blank"},"SDK Source"),h("a",{href:"https://discord.gg/hahgu5hcA5",target:"_blank"},"Discord Community"))))}function _m({loadCredits:t,setError:e}){const[n,r]=W(!1),s=async i=>{var a,l;r(!0);const o=await ie("POST","/v1/billing/checkout",{credits:i,success_url:location.origin+"/dashboard?checkout=success",cancel_url:location.origin+"/dashboard"});r(!1),(a=o==null?void 0:o.data)!=null&&a.url?window.location.href=o.data.url:e(((l=o==null?void 0:o.data)==null?void 0:l.error)||"Billing not available yet")};return rn(()=>{location.search.includes("checkout=success")&&(t(),history.replaceState(null,"","/dashboard"))},[]),h("div",{style:{display:"flex",gap:8,marginTop:8}},h("button",{class:"btn-primary",onClick:()=>s(100),disabled:n,style:{fontSize:13}},"100 credits — $5"),h("button",{class:"btn-secondary",onClick:()=>s(500),disabled:n,style:{fontSize:13}},"500 — $20"),h("button",{class:"btn-secondary",onClick:()=>s(1500),disabled:n,style:{fontSize:13}},"1500 — $50"))}function gm({sessions:t,workspaceId:e,setError:n}){var D;const[r,s]=W([]),[i,o]=W([]),[a,l]=W([]),[c,u]=W("drafts"),[d,p]=W(!1),[f,g]=W({}),[_,P]=W(""),[m,b]=W(""),[C,x]=W(""),[S,k]=W(""),[w,E]=W("0 9 * * 1,3,5"),[I,A]=W(""),j=pt(async()=>{const y=await ie("GET","/v1/automations");y!=null&&y.data&&s(Array.isArray(y.data)?y.data:[])},[]),F=pt(async()=>{const y=await ie("GET","/v1/automations/drafts?status=pending");y!=null&&y.data&&o(Array.isArray(y.data)?y.data:[])},[]),H=pt(async()=>{const y=await ie("GET","/v1/automations/engagements?limit=20");y!=null&&y.data&&l(Array.isArray(y.data)?y.data:[])},[]);rn(()=>{j(),F(),H()},[]);const B=t.filter(y=>y.status==="connected");async function K(y){var X,de;y.preventDefault(),p(!0);try{const ye=await ie("POST","/v1/automations",{browser_session_id:I,config:{product_name:_,product_url:m,product_description:C,keywords:S.split(",").map(xe=>xe.trim()).filter(Boolean),schedule_cron:w,max_drafts:8,reply_mix:{a:40,b:40,c:20}}});(X=ye==null?void 0:ye.data)!=null&&X.id?(await j(),u("drafts")):n(((de=ye==null?void 0:ye.data)==null?void 0:de.error)||"Failed to create automation")}finally{p(!1)}}async function Z(y){await ie("PATCH",`/v1/automations/drafts/${y}`,{status:"approved"}),await F()}async function N(y){await ie("PATCH",`/v1/automations/drafts/${y}`,{status:"skipped"}),await F()}async function z(y){g(X=>({...X,[y]:!0}));try{await ie("POST",`/v1/automations/drafts/${y}/post`),setTimeout(async()=>{await F(),await H(),g(X=>({...X,[y]:!1}))},5e3)}catch{g(X=>({...X,[y]:!1}))}}async function ee(y){const X=y.status==="active"?"paused":"active";await ie("PATCH",`/v1/automations/${y.id}`,{status:X}),await j()}if(r.length===0||c==="setup")return h("div",{class:"card"},h("h2",null,"Set up X Marketing Automation"),h("p",{style:{color:"var(--muted)",marginBottom:16,fontSize:14}},"Automatically find relevant X conversations and draft replies. You review and approve before anything gets posted."),h("form",{onSubmit:K},h("div",{class:"form-group"},h("label",null,"Product name"),h("input",{value:_,onInput:y=>P(y.target.value),placeholder:"Hanzi Browse",required:!0})),h("div",{class:"form-group"},h("label",null,"Product URL"),h("input",{value:m,onInput:y=>b(y.target.value),placeholder:"https://browse.hanzilla.co"})),h("div",{class:"form-group"},h("label",null,"Description"),h("input",{value:C,onInput:y=>x(y.target.value),placeholder:"Browser automation for AI agents"})),h("div",{class:"form-group"},h("label",null,"Keywords (comma-separated)"),h("input",{value:S,onInput:y=>k(y.target.value),placeholder:"browser automation, MCP server, AI agent browser",required:!0})),h("div",{class:"form-group"},h("label",null,"Schedule"),h("select",{value:w,onChange:y=>E(y.target.value)},h("option",{value:"0 9 * * 1,3,5"},"3x per week (Mon, Wed, Fri 9am)"),h("option",{value:"0 9 * * *"},"Daily (9am)"),h("option",{value:"0 9,17 * * *"},"2x per day (9am, 5pm)"))),h("div",{class:"form-group"},h("label",null,"Browser session"),B.length===0?h("p",{style:{color:"var(--accent)",fontSize:13}},"No browser connected. Pair one first in the Sessions tab."):h("select",{value:I,onChange:y=>A(y.target.value),required:!0},h("option",{value:""},"Select a session..."),B.map(y=>h("option",{key:y.id,value:y.id},y.label||y.id.slice(0,8)," — connected")))),h("button",{class:"btn-primary",type:"submit",disabled:d||B.length===0},d?"Creating...":"Create Automation")));const V=r[0],le=i.length;return h("div",null,h("div",{class:"card",style:{marginBottom:16}},h("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},h("div",null,h("strong",null,((D=V.config)==null?void 0:D.product_name)||"X Marketing"),h("span",{style:{marginLeft:8,padding:"2px 8px",borderRadius:4,fontSize:12,background:V.status==="active"?"#eef5f0":V.status==="error"?"#fef0ef":"#f5f3ef",color:V.status==="active"?"#2f4a3d":V.status==="error"?"#9a2e2e":"#6d6256"}},V.status)),h("div",{style:{display:"flex",gap:8}},h("button",{class:"btn-secondary",onClick:()=>ee(V),style:{fontSize:12}},V.status==="active"?"Pause":"Resume"),h("button",{class:"btn-secondary",onClick:()=>u("setup"),style:{fontSize:12}},"Edit"))),V.errorMessage&&h("p",{style:{color:"#9a2e2e",fontSize:13,marginTop:8}},V.errorMessage),h("div",{style:{fontSize:12,color:"var(--muted)",marginTop:8}},"Last run: ",V.lastRunAt?Br(V.lastRunAt):"never"," · Next: ",V.nextRunAt?new Date(V.nextRunAt).toLocaleString():"not scheduled")),h("div",{style:{display:"flex",gap:8,marginBottom:16}},h("button",{class:`tab ${c==="drafts"?"active":""}`,onClick:()=>{u("drafts"),F()}},"Drafts ",le>0&&h("span",{class:"tab-count"},le)),h("button",{class:`tab ${c==="history"?"active":""}`,onClick:()=>{u("history"),H()}},"History")),c==="drafts"&&h("div",null,i.length===0?h("div",{class:"card",style:{textAlign:"center",color:"var(--muted)"}},h("p",null,"No pending drafts. The next scout will run ",V.nextRunAt?new Date(V.nextRunAt).toLocaleString():"when scheduled",".")):i.map(y=>h("div",{key:y.id,class:"card",style:{marginBottom:12}},h("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:8}},h("div",null,h("strong",{style:{fontSize:14}},y.tweetAuthorName||"Unknown"),h("span",{style:{color:"var(--muted)",marginLeft:6,fontSize:13}},y.tweetAuthorHandle),y.tweetAuthorFollowers&&h("span",{style:{color:"var(--muted)",marginLeft:6,fontSize:12}},"(",y.tweetAuthorFollowers.toLocaleString()," followers)")),h("span",{style:{padding:"2px 6px",borderRadius:4,fontSize:11,fontWeight:600,background:y.replyType==="A"?"#eef5f0":y.replyType==="C"?"#fef5ee":"#f0eef5",color:y.replyType==="A"?"#2f4a3d":y.replyType==="C"?"#8a5a2e":"#4a3d6b"}},"Type ",y.replyType||"?")),h("div",{style:{background:"#f7f3ea",padding:"10px 12px",borderRadius:8,fontSize:13,marginBottom:10,color:"var(--ink)"}},y.tweetText||"Tweet not available"),h("div",{style:{background:"#f0f7f2",padding:"10px 12px",borderRadius:8,fontSize:13,marginBottom:10,color:"#1f1711",borderLeft:"3px solid #2f4a3d"}},y.replyText),y.replyReasoning&&h("div",{style:{fontSize:12,color:"var(--muted)",marginBottom:8}},y.replyReasoning),h("div",{style:{display:"flex",gap:8}},y.status==="pending"&&h(Tt,null,h("button",{class:"btn-primary",onClick:()=>Z(y.id),style:{fontSize:12}},"Approve"),h("button",{class:"btn-secondary",onClick:()=>N(y.id),style:{fontSize:12}},"Skip")),y.status==="approved"&&h("button",{class:"btn-primary",onClick:()=>z(y.id),disabled:f[y.id],style:{fontSize:12}},f[y.id]?"Posting...":"Post"))))),c==="history"&&h("div",{class:"card"},a.length===0?h("p",{style:{color:"var(--muted)",textAlign:"center"}},"No engagements yet."):h("table",{style:{width:"100%",fontSize:13}},h("thead",null,h("tr",{style:{textAlign:"left",color:"var(--muted)"}},h("th",null,"Handle"),h("th",null,"Type"),h("th",null,"Reply"),h("th",null,"When"))),h("tbody",null,a.map(y=>h("tr",{key:y.id},h("td",null,h("a",{href:y.tweetUrl,target:"_blank",rel:"noopener"},y.authorHandle)),h("td",null,y.replyType||"-"),h("td",{style:{maxWidth:300,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},y.replySummary||"-"),h("td",null,Br(y.postedAt))))))))}function Nl(){return h("div",{class:"page"},h("div",{class:"skeleton skeleton-header"}),h("div",{class:"skeleton skeleton-subtitle"}),h("div",{class:"skeleton skeleton-card"}),h("div",{class:"skeleton skeleton-card"}))}async function vm(){_t.reset(),await fetch("/api/auth/sign-out",{method:"POST",credentials:"include"}),window.location.href="https://browse.hanzilla.co"}const Ml="https://35cbd9c4c23a9e941f292b2ec68adf3b@o4511120870932480.ingest.us.sentry.io/4511120907960320",Dl="phc_SNXFKD8YOBPvBNWWZnuCe7stDsJJNJ5WS8MujKhajIF";Ml.startsWith("__")||sg({dsn:Ml,environment:location.hostname==="localhost"?"development":"production"});Dl.startsWith("__")||_t.init(Dl,{api_host:"https://us.i.posthog.com",autocapture:!0,capture_pageview:!0,persistence:"localStorage",loaded:t=>{location.hostname==="localhost"&&t.opt_out_capturing()}});ld(h(um,null),document.getElementById("app"));
|
|
61
|
+
Read the codebase to understand the stack and project structure, then ask me the 3 questions above. After I answer, build the full integration.`;return h("div",null,!l&&h("div",{class:"card"},h("h3",null,"Create your API key"),h("p",{class:"step-explain"},"You need this to call the Hanzi API from your backend."),h("div",{class:"inline-form"},h("input",{value:_,onInput:N=>P(N.target.value),placeholder:"Key name (e.g. dev)",maxLength:100,onKeyDown:N=>N.key==="Enter"&&F()}),h("button",{class:"btn-primary",onClick:F,disabled:!_.trim()},"Create key"))),m&&h("div",{class:"card"},h("h3",null,"Your API key"),h("div",{class:"key-created"},h("div",{class:"mono-with-copy"},h("div",{class:"mono"},m),h(Hr,{text:m,label:"Copy key"})),h("div",{class:"warning"},"Save this key — it won't be shown again.")),h("p",{class:"step-explain",style:{marginTop:12}},"Verify it works:"),h("div",{class:"mono-with-copy",style:{marginTop:4}},h("div",{class:"mono",style:{fontSize:11}},`curl ${location.origin}/v1/billing/credits -H "Authorization: Bearer ${m}"`),h(Hr,{text:`curl ${location.origin}/v1/billing/credits -H "Authorization: Bearer ${m}"`,label:"Copy"}))),l&&h("div",{class:"card",style:{background:"#f5f1e8"}},h("h3",null,"Build the integration"),h("p",{class:"step-explain"},"Copy this prompt into Claude Code, Cursor, or any AI coding agent. It has the full API reference and will ask you 3 questions before building."),h("div",{style:{display:"flex",gap:8,marginTop:10}},h("button",{class:"btn-primary",onClick:()=>{navigator.clipboard.writeText(K)},style:{fontSize:13},ref:N=>{N&&(N.onclick=()=>{navigator.clipboard.writeText(K),It.capture("integration_prompt_copied"),N.textContent="Copied!",setTimeout(()=>N.textContent="Copy integration prompt",1500)})}},"Copy integration prompt"),h("a",{href:"/docs.html#build-with-hanzi",class:"btn-secondary",style:{textDecoration:"none",padding:"6px 14px",borderRadius:8,fontSize:13}},"Read the docs"))),l&&h(dm,{sessions:d,loadSessions:p,extensionReady:r,pairing:s,paired:i,pairBrowser:H,hasConnected:c,connectedSession:u,taskInput:C,setTaskInput:x,taskStatus:S,taskSteps:I,taskAnswer:w,testComplete:j,runTask:B,setTaskStatus:k,setTaskAnswer:E,setTab:g}))}function dm({sessions:t,loadSessions:e,extensionReady:n,pairing:r,paired:s,pairBrowser:i,hasConnected:o,connectedSession:a,taskInput:l,setTaskInput:c,taskStatus:u,taskSteps:d,taskAnswer:p,testComplete:f,runTask:g,setTaskStatus:_,setTaskAnswer:P,setTab:m}){const[b,C]=W(null),[x,S]=W(!1),[k,w]=W(null),[E,I]=W(null),[A,j]=W(!1),[F,H]=W(null),B=async()=>{S(!0),j(!1);const N=await ie("POST","/v1/browser-sessions/pair",{label:"User pairing link"});S(!1),(N==null?void 0:N.status)===201&&(C(`${location.origin}/pair/${N.data.pairing_token}`),w(Date.now()),I(t.length),H(300),It.capture("pairing_link_generated"))};rn(()=>{if(F===null||F<=0)return;const N=setTimeout(()=>H(z=>z-1),1e3);return()=>clearTimeout(N)},[F]),rn(()=>{k&&E!==null&&t.length>E&&!A&&j(!0)},[t,k,E,A]);const K=F!==null&&F<=0&&!A,Z=N=>`${Math.floor(N/60)}:${String(N%60).padStart(2,"0")}`;return h(Tt,null,h("div",{class:"section-label",style:{marginTop:28}},"Try it out"),h("p",{class:"section-desc"},"Pair a browser, then run a task to see it work."),h("div",{class:"card"},h("div",{class:"step-row"},h("span",{class:`step-badge ${o||A?"done":"active"}`},o||A?"✓":"1"),h("div",{class:"step-content"},h("h3",null,o||A?"Browser paired":"Pair a browser"),o||A?h("p",{class:"step-explain"},A?"A user paired via your link.":"Your Chrome is connected for testing."," ",h("button",{class:"btn-secondary",onClick:()=>m("sessions"),style:{fontSize:11,padding:"2px 8px"}},"View sessions")):b?h("div",null,h("div",{class:"pairing-tracker"},h("div",{class:"pairing-step done"},h("div",{class:"pairing-dot done"}),h("span",null,"Generated")),h("div",{class:"pairing-line"}),h("div",{class:`pairing-step ${A?"done":"waiting"}`},h("div",{class:`pairing-dot ${A?"done":"waiting"}`}),h("span",null,A?"Paired":"Waiting for click..."))),h("div",{class:"mono-with-copy",style:{marginTop:12}},h("div",{class:"mono",style:{fontSize:12}},b),h(Hr,{text:b,label:"Copy link"})),h("div",{style:{display:"flex",gap:8,marginTop:8,alignItems:"center"}},h("a",{href:b,target:"_blank",rel:"noreferrer",class:"btn-primary",style:{display:"inline-block",textDecoration:"none",color:"white",padding:"6px 14px",borderRadius:8,fontSize:13}},"Open it"),h("button",{class:"btn-secondary",onClick:()=>{C(null),w(null),I(null),H(null),j(!1)},style:{fontSize:12}},"New link"),!K&&F>0&&h("span",{style:{fontSize:12,color:F<60?"var(--red)":"var(--muted)"}},"Expires in ",Z(F)),K&&h("span",{style:{fontSize:12,color:"var(--red)",fontWeight:600}},"Expired")),h("p",{class:"step-explain",style:{marginTop:8}},"User needs the ",h("a",{href:"https://chromewebstore.google.com/detail/hanzi-browse/iklpkemlmbhemkiojndpbhoakgikpmcd",target:"_blank"},"Hanzi extension")," installed.",n&&!A&&h(Tt,null," ","Or ",h("button",{style:{background:"none",border:"none",color:"var(--accent)",textDecoration:"underline",cursor:"pointer",padding:0,font:"inherit",fontSize:"inherit"},onClick:i,disabled:r},r?"connecting...":"connect this browser")," instead."))):h("div",null,h("p",{class:"step-explain"},"Generate a pairing link to share, or connect this browser directly."),h("div",{style:{display:"flex",gap:8,marginTop:4}},h("button",{class:"btn-primary",onClick:B,disabled:x},x?"Generating...":"Generate a link"),n&&h("button",{class:"btn-secondary",onClick:i,disabled:r},r?"Connecting...":"Connect this browser")),!n&&h("p",{class:"step-explain",style:{marginTop:8}},"To connect this browser directly, ",h("a",{href:"https://chromewebstore.google.com/detail/hanzi-browse/iklpkemlmbhemkiojndpbhoakgikpmcd",target:"_blank"},"install the extension")," first."),h("p",{class:"step-explain",style:{marginTop:8,fontSize:12,color:"#999"}},"In production, your backend calls ",h("code",null,"POST /v1/browser-sessions/pair")," to generate links programmatically."))))),(o||A)&&h("div",{class:"card"},h("div",{class:"step-row"},h("span",{class:`step-badge ${f?"done":"active"}`},f?"✓":"2"),h("div",{class:"step-content"},h("h3",null,"Run a test task"),h("p",{class:"step-explain"},"Tell Hanzi what to do in the paired browser."),u?u==="running"?h("div",{class:"task-running"},h("div",{class:"task-spinner"}),h("span",null,"Running... (",d," step",d!==1?"s":"",")")):h("div",{class:"task-result"},h("div",{class:`task-status-label ${u}`},u==="complete"?"✓ Complete":"✗ "+u,d>0&&` · ${d} steps`),h("div",{class:"task-answer"},p),h("button",{class:"btn-secondary",onClick:()=>{_(null),P("")},style:{marginTop:8}},"Run another")):h("div",{class:"inline-form"},h("input",{value:l,onInput:N=>c(N.target.value),placeholder:"What should Hanzi do?",onKeyDown:N=>N.key==="Enter"&&g()}),h("button",{class:"btn-primary",onClick:g,disabled:!l.trim()},"Run"))))))}function hm({sessions:t,onRefresh:e,usage:n}){const r=t.filter(l=>l.status==="connected"),s=t.filter(l=>l.status==="disconnected"),i=async l=>{await ie("DELETE",`/v1/browser-sessions/${l}`),e()},o=async()=>{for(const l of s)await ie("DELETE",`/v1/browser-sessions/${l.id}`);e()},a=l=>l>999999?(l/1e6).toFixed(1)+"M":l>999?(l/1e3).toFixed(1)+"K":String(l||0);return h("div",null,h("div",{class:"summary-bar"},h("span",{class:"summary-stat"},h("strong",null,r.length)," connected"),h("span",{class:"summary-stat"},h("strong",null,s.length)," disconnected"),h("span",{class:"summary-stat"},h("strong",null,(n==null?void 0:n.taskCount)||0)," tasks run")),r.length>0&&h("div",{class:"card"},h("h3",{style:{color:"var(--green)"}},"Connected"),r.map(l=>h(Fl,{key:l.id,session:l}))),s.length>0&&h("div",{class:"card"},h("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},h("h3",{style:{color:"var(--muted)"}},"Disconnected"),h("button",{class:"btn-secondary",onClick:o,style:{fontSize:11,padding:"3px 10px"}},"Remove all")),s.map(l=>h(Fl,{key:l.id,session:l,onRemove:()=>i(l.id)})),h("p",{class:"step-explain",style:{marginTop:6}},"Sessions reconnect automatically when the browser reopens.")),t.length===0&&h("div",{class:"card"},h("p",{class:"step-explain"},"No sessions yet. Go to Getting Started to pair a browser.")),h("div",{class:"card"},h("h3",null,"Usage"),h("div",{class:"usage-grid"},h("div",{class:"usage-stat"},h("div",{class:"num"},(n==null?void 0:n.taskCount)||0),h("div",{class:"label"},"Tasks")),h("div",{class:"usage-stat"},h("div",{class:"num"},a(n==null?void 0:n.totalApiCalls)),h("div",{class:"label"},"API calls")),h("div",{class:"usage-stat"},h("div",{class:"num"},a(((n==null?void 0:n.totalInputTokens)||0)+((n==null?void 0:n.totalOutputTokens)||0))),h("div",{class:"label"},"Tokens")))),h("button",{class:"btn-secondary",onClick:e,style:{marginTop:8,fontSize:12}},"Refresh"))}function Fl({session:t,onRemove:e}){const n=t.label||t.external_user_id||"Unnamed";return h("div",{class:"session-row"},h("span",{class:"session-info"},h("span",{class:`status-dot ${t.status}`}),h("span",{class:"session-label"},n),t.external_user_id&&t.label&&h("span",{class:"session-meta"},t.external_user_id)),h("span",{class:"session-id-group"},h("span",{class:"session-time"},Br(t.last_heartbeat)),h("code",null,t.id.slice(0,8),"..."),e&&h("button",{class:"btn-danger",onClick:e,style:{padding:"2px 8px",fontSize:11}},"Remove")))}function pm({keys:t,loadKeys:e,setError:n,profile:r,credits:s,loadCredits:i}){const[o,a]=W(""),[l,c]=W(null),u=async()=>{var f;if(!o.trim())return;const p=await ie("POST","/v1/api-keys",{name:o.trim()});(p==null?void 0:p.status)===201?(c(p.data.key),a(""),await e()):n(((f=p==null?void 0:p.data)==null?void 0:f.error)||"Failed")},d=async p=>{confirm("Delete this API key?")&&(await ie("DELETE",`/v1/api-keys/${p}`),c(null),await e())};return h("div",null,h("div",{class:"card"},h("h3",null,"API Keys"),t.map(p=>h("div",{class:"key-row",key:p.id},h("span",null,h("strong",null,p.name)," ",h("code",{class:"key-prefix"},p.key_prefix),p.last_used_at&&h("span",{class:"session-meta"}," · used ",Br(p.last_used_at))),h("button",{class:"btn-danger",onClick:()=>d(p.id)},"Delete"))),l&&h("div",{class:"key-created"},h("div",{class:"mono-with-copy"},h("div",{class:"mono"},l),h(Hr,{text:l,label:"Copy key"})),h("div",{class:"warning"},"Save this key — it won't be shown again.")),h("div",{class:"inline-form",style:{marginTop:8}},h("input",{value:o,onInput:p=>a(p.target.value),placeholder:"Key name",maxLength:100,onKeyDown:p=>p.key==="Enter"&&u()}),h("button",{class:"btn-primary",onClick:u,disabled:!o.trim()},"Create key"))),h("div",{class:"card"},h("h3",null,"Credits & Usage"),s?h("div",null,h("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12,margin:"8px 0 12px"}},h("div",{style:{padding:12,background:"#f5f1e8",borderRadius:8,textAlign:"center"}},h("div",{style:{fontSize:28,fontWeight:700}},s.free_remaining||0),h("div",{style:{fontSize:12,color:"var(--muted)"}},"free tasks left"),h("div",{style:{fontSize:11,color:"var(--muted)"}},"of ",s.free_tasks_per_month,"/month")),h("div",{style:{padding:12,background:"#f5f1e8",borderRadius:8,textAlign:"center"}},h("div",{style:{fontSize:28,fontWeight:700}},s.credit_balance||0),h("div",{style:{fontSize:12,color:"var(--muted)"}},"purchased credits"),h("div",{style:{fontSize:11,color:"var(--muted)"}},"$0.05/task"))),h("p",{class:"step-explain"},"You only pay for completed tasks. Errors and timeouts are free."),h(fm,{loadCredits:i,setError:n})):h("p",{class:"step-explain"},"Loading...")),h("div",{class:"card",style:{background:"#f5f1e8"}},h("h3",null,"Building a product with Hanzi?"),h("p",{class:"step-explain"},"Need volume pricing, custom SLAs, or dedicated support? We offer wholesale rates starting at $0.02/task for partners."),h("a",{href:"mailto:hanzili0217@gmail.com?subject=Partner%20pricing&body=Hi%20Hanzi%20team%2C%0A%0AI%27m%20building%20a%20product%20that%20uses%20browser%20automation.%0A%0AExpected%20volume%3A%20%0AUse%20case%3A%20%0A",class:"btn-primary",style:{display:"inline-block",textDecoration:"none",color:"white",padding:"8px 16px",borderRadius:8,fontSize:13,marginTop:8}},"Contact us for partner pricing")),h("div",{class:"card"},h("h3",null,"Resources"),h("div",{style:{display:"flex",flexDirection:"column",gap:6}},h("a",{href:"/docs.html#build-with-hanzi"},"API Documentation"),h("a",{href:"https://github.com/hanzili/hanzi-browse/tree/main/examples/partner-quickstart",target:"_blank"},"Sample App (GitHub)"),h("a",{href:"https://github.com/hanzili/hanzi-browse/tree/main/sdk",target:"_blank"},"SDK Source"),h("a",{href:"https://discord.gg/hahgu5hcA5",target:"_blank"},"Discord Community"))))}function fm({loadCredits:t,setError:e}){const[n,r]=W(!1),s=async i=>{var a,l;r(!0);const o=await ie("POST","/v1/billing/checkout",{credits:i,success_url:location.origin+"/dashboard?checkout=success",cancel_url:location.origin+"/dashboard"});r(!1),(a=o==null?void 0:o.data)!=null&&a.url?window.location.href=o.data.url:e(((l=o==null?void 0:o.data)==null?void 0:l.error)||"Billing not available yet")};return rn(()=>{location.search.includes("checkout=success")&&(t(),history.replaceState(null,"","/dashboard"))},[]),h("div",{style:{display:"flex",gap:8,marginTop:8}},h("button",{class:"btn-primary",onClick:()=>s(100),disabled:n,style:{fontSize:13}},"100 credits — $5"),h("button",{class:"btn-secondary",onClick:()=>s(500),disabled:n,style:{fontSize:13}},"500 — $20"),h("button",{class:"btn-secondary",onClick:()=>s(1500),disabled:n,style:{fontSize:13}},"1500 — $50"))}function _m({sessions:t,workspaceId:e,setError:n}){var D;const[r,s]=W([]),[i,o]=W([]),[a,l]=W([]),[c,u]=W("drafts"),[d,p]=W(!1),[f,g]=W({}),[_,P]=W(""),[m,b]=W(""),[C,x]=W(""),[S,k]=W(""),[w,E]=W("0 9 * * 1,3,5"),[I,A]=W(""),j=pt(async()=>{const y=await ie("GET","/v1/automations");y!=null&&y.data&&s(Array.isArray(y.data)?y.data:[])},[]),F=pt(async()=>{const y=await ie("GET","/v1/automations/drafts?status=pending");y!=null&&y.data&&o(Array.isArray(y.data)?y.data:[])},[]),H=pt(async()=>{const y=await ie("GET","/v1/automations/engagements?limit=20");y!=null&&y.data&&l(Array.isArray(y.data)?y.data:[])},[]);rn(()=>{j(),F(),H()},[]);const B=t.filter(y=>y.status==="connected");async function K(y){var X,de;y.preventDefault(),p(!0);try{const ye=await ie("POST","/v1/automations",{browser_session_id:I,config:{product_name:_,product_url:m,product_description:C,keywords:S.split(",").map(xe=>xe.trim()).filter(Boolean),schedule_cron:w,max_drafts:8,reply_mix:{a:40,b:40,c:20}}});(X=ye==null?void 0:ye.data)!=null&&X.id?(await j(),u("drafts")):n(((de=ye==null?void 0:ye.data)==null?void 0:de.error)||"Failed to create automation")}finally{p(!1)}}async function Z(y){await ie("PATCH",`/v1/automations/drafts/${y}`,{status:"approved"}),await F()}async function N(y){await ie("PATCH",`/v1/automations/drafts/${y}`,{status:"skipped"}),await F()}async function z(y){g(X=>({...X,[y]:!0}));try{await ie("POST",`/v1/automations/drafts/${y}/post`),setTimeout(async()=>{await F(),await H(),g(X=>({...X,[y]:!1}))},5e3)}catch{g(X=>({...X,[y]:!1}))}}async function ee(y){const X=y.status==="active"?"paused":"active";await ie("PATCH",`/v1/automations/${y.id}`,{status:X}),await j()}if(r.length===0||c==="setup")return h("div",{class:"card"},h("h2",null,"Set up X Marketing Automation"),h("p",{style:{color:"var(--muted)",marginBottom:16,fontSize:14}},"Automatically find relevant X conversations and draft replies. You review and approve before anything gets posted."),h("form",{onSubmit:K},h("div",{class:"form-group"},h("label",null,"Product name"),h("input",{value:_,onInput:y=>P(y.target.value),placeholder:"Hanzi Browse",required:!0})),h("div",{class:"form-group"},h("label",null,"Product URL"),h("input",{value:m,onInput:y=>b(y.target.value),placeholder:"https://browse.hanzilla.co"})),h("div",{class:"form-group"},h("label",null,"Description"),h("input",{value:C,onInput:y=>x(y.target.value),placeholder:"Browser automation for AI agents"})),h("div",{class:"form-group"},h("label",null,"Keywords (comma-separated)"),h("input",{value:S,onInput:y=>k(y.target.value),placeholder:"browser automation, MCP server, AI agent browser",required:!0})),h("div",{class:"form-group"},h("label",null,"Schedule"),h("select",{value:w,onChange:y=>E(y.target.value)},h("option",{value:"0 9 * * 1,3,5"},"3x per week (Mon, Wed, Fri 9am)"),h("option",{value:"0 9 * * *"},"Daily (9am)"),h("option",{value:"0 9,17 * * *"},"2x per day (9am, 5pm)"))),h("div",{class:"form-group"},h("label",null,"Browser session"),B.length===0?h("p",{style:{color:"var(--accent)",fontSize:13}},"No browser connected. Pair one first in the Sessions tab."):h("select",{value:I,onChange:y=>A(y.target.value),required:!0},h("option",{value:""},"Select a session..."),B.map(y=>h("option",{key:y.id,value:y.id},y.label||y.id.slice(0,8)," — connected")))),h("button",{class:"btn-primary",type:"submit",disabled:d||B.length===0},d?"Creating...":"Create Automation")));const V=r[0],le=i.length;return h("div",null,h("div",{class:"card",style:{marginBottom:16}},h("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"}},h("div",null,h("strong",null,((D=V.config)==null?void 0:D.product_name)||"X Marketing"),h("span",{style:{marginLeft:8,padding:"2px 8px",borderRadius:4,fontSize:12,background:V.status==="active"?"#eef5f0":V.status==="error"?"#fef0ef":"#f5f3ef",color:V.status==="active"?"#2f4a3d":V.status==="error"?"#9a2e2e":"#6d6256"}},V.status)),h("div",{style:{display:"flex",gap:8}},h("button",{class:"btn-secondary",onClick:()=>ee(V),style:{fontSize:12}},V.status==="active"?"Pause":"Resume"),h("button",{class:"btn-secondary",onClick:()=>u("setup"),style:{fontSize:12}},"Edit"))),V.errorMessage&&h("p",{style:{color:"#9a2e2e",fontSize:13,marginTop:8}},V.errorMessage),h("div",{style:{fontSize:12,color:"var(--muted)",marginTop:8}},"Last run: ",V.lastRunAt?Br(V.lastRunAt):"never"," · Next: ",V.nextRunAt?new Date(V.nextRunAt).toLocaleString():"not scheduled")),h("div",{style:{display:"flex",gap:8,marginBottom:16}},h("button",{class:`tab ${c==="drafts"?"active":""}`,onClick:()=>{u("drafts"),F()}},"Drafts ",le>0&&h("span",{class:"tab-count"},le)),h("button",{class:`tab ${c==="history"?"active":""}`,onClick:()=>{u("history"),H()}},"History")),c==="drafts"&&h("div",null,i.length===0?h("div",{class:"card",style:{textAlign:"center",color:"var(--muted)"}},h("p",null,"No pending drafts. The next scout will run ",V.nextRunAt?new Date(V.nextRunAt).toLocaleString():"when scheduled",".")):i.map(y=>h("div",{key:y.id,class:"card",style:{marginBottom:12}},h("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start",marginBottom:8}},h("div",null,h("strong",{style:{fontSize:14}},y.tweetAuthorName||"Unknown"),h("span",{style:{color:"var(--muted)",marginLeft:6,fontSize:13}},y.tweetAuthorHandle),y.tweetAuthorFollowers&&h("span",{style:{color:"var(--muted)",marginLeft:6,fontSize:12}},"(",y.tweetAuthorFollowers.toLocaleString()," followers)")),h("span",{style:{padding:"2px 6px",borderRadius:4,fontSize:11,fontWeight:600,background:y.replyType==="A"?"#eef5f0":y.replyType==="C"?"#fef5ee":"#f0eef5",color:y.replyType==="A"?"#2f4a3d":y.replyType==="C"?"#8a5a2e":"#4a3d6b"}},"Type ",y.replyType||"?")),h("div",{style:{background:"#f7f3ea",padding:"10px 12px",borderRadius:8,fontSize:13,marginBottom:10,color:"var(--ink)"}},y.tweetText||"Tweet not available"),h("div",{style:{background:"#f0f7f2",padding:"10px 12px",borderRadius:8,fontSize:13,marginBottom:10,color:"#1f1711",borderLeft:"3px solid #2f4a3d"}},y.replyText),y.replyReasoning&&h("div",{style:{fontSize:12,color:"var(--muted)",marginBottom:8}},y.replyReasoning),h("div",{style:{display:"flex",gap:8}},y.status==="pending"&&h(Tt,null,h("button",{class:"btn-primary",onClick:()=>Z(y.id),style:{fontSize:12}},"Approve"),h("button",{class:"btn-secondary",onClick:()=>N(y.id),style:{fontSize:12}},"Skip")),y.status==="approved"&&h("button",{class:"btn-primary",onClick:()=>z(y.id),disabled:f[y.id],style:{fontSize:12}},f[y.id]?"Posting...":"Post"))))),c==="history"&&h("div",{class:"card"},a.length===0?h("p",{style:{color:"var(--muted)",textAlign:"center"}},"No engagements yet."):h("table",{style:{width:"100%",fontSize:13}},h("thead",null,h("tr",{style:{textAlign:"left",color:"var(--muted)"}},h("th",null,"Handle"),h("th",null,"Type"),h("th",null,"Reply"),h("th",null,"When"))),h("tbody",null,a.map(y=>h("tr",{key:y.id},h("td",null,h("a",{href:y.tweetUrl,target:"_blank",rel:"noopener"},y.authorHandle)),h("td",null,y.replyType||"-"),h("td",{style:{maxWidth:300,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},y.replySummary||"-"),h("td",null,Br(y.postedAt))))))))}function Nl(){return h("div",{class:"page"},h("div",{class:"skeleton skeleton-header"}),h("div",{class:"skeleton skeleton-subtitle"}),h("div",{class:"skeleton skeleton-card"}),h("div",{class:"skeleton skeleton-card"}))}async function gm(){It.reset(),await fetch("/api/auth/sign-out",{method:"POST",credentials:"include"}),window.location.href="https://browse.hanzilla.co"}const Ml="https://35cbd9c4c23a9e941f292b2ec68adf3b@o4511120870932480.ingest.us.sentry.io/4511120907960320";Ml.startsWith("__")||rg({dsn:Ml,environment:location.hostname==="localhost"?"development":"production"});ad(h(cm,null),document.getElementById("app"));
|