1try{let e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="2155952a-10d7-434f-a001-149aaac1b2ea",e._sentryDebugIdIdentifier="sentry-dbid-2155952a-10d7-434f-a001-149aaac1b2ea")}catch{}function to(e,t,i,s,r){for(t=t.split?t.split("."):t,s=0;s<t.length;s++)e=e?e[t[s]]:r;return e===r?i:e}var Lc="function",Dc="string",Be="undefined",Nc="boolean",ws="object",jc="array",qc="number",Bc="symbol",Hc="null",Ya="any",Za="*",At="__",Vc="form",Uc="input",zc="button",Wc="select",$s=typeof process!==Be?process:{};$s.env&&$s.env.NODE_ENV;var He=typeof document!==Be;$s.versions!=null&&$s.versions.node!=null;typeof Deno!==Be&&Deno.core;He&&window.name==="nodejs"||typeof navigator!==Be&&typeof navigator.userAgent!==Be&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));function Qa(e,t){return t.charAt(0)[e]()+t.slice(1)}var Gc=Qa.bind(null,"toUpperCase"),Jc=Qa.bind(null,"toLowerCase");function Kc(e){return el(e)?Gc(Hc):typeof e===ws?ed(e):Object.prototype.toString.call(e).slice(8,-1)}function xs(e,t){t===void 0&&(t=!0);var i=Kc(e);return t?Jc(i):i}function Yi(e,t){return typeof t===e}var We=Yi.bind(null,Lc),Yt=Yi.bind(null,Dc),zt=Yi.bind(null,Be),Xc=Yi.bind(null,Nc);Yi.bind(null,Bc);function el(e){return e===null}function Yc(e){return xs(e)===qc&&!isNaN(e)}function Zc(e){return xs(e)===jc}function Oe(e){if(!Qc(e))return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Qc(e){return e&&(typeof e===ws||e!==null)}function ed(e){return We(e.constructor)?e.constructor.name:null}function td(e){return e instanceof Error||Yt(e.message)&&e.constructor&&Yc(e.constructor.stackTraceLimit)}function tl(e,t){if(typeof t!="object"||el(t))return!1;if(t instanceof e)return!0;var i=xs(new e(""));if(td(t))for(;t;){if(xs(t)===i)return!0;t=Object.getPrototypeOf(t)}return!1}tl.bind(null,TypeError);tl.bind(null,SyntaxError);function Us(e,t){var i=e instanceof Element||e instanceof HTMLDocument;return i&&t?id(e,t):i}function id(e,t){return t===void 0&&(t=""),e&&e.nodeName===t.toUpperCase()}function zs(e){var t=[].slice.call(arguments,1);return function(){return e.apply(void 0,[].slice.call(arguments).concat(t))}}zs(Us,Vc);zs(Us,zc);zs(Us,Uc);zs(Us,Wc);function io(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return null}}
1function sd(){if(He){var e=navigator,t=e.languages;return e.userLanguage||(t&&t.length?t[0]:e.language)}}function rd(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{}}function nd(e){return(function(t){for(var i,s=Object.create(null),r=/([^&=]+)=?([^&]*)/g;i=r.exec(t);){var n=io(i[1]),o=io(i[2]);if(n)if(n.substring(n.length-2)==="[]"){var a=s[n=n.substring(0,n.length-2)]||(s[n]=[]);s[n]=Array.isArray(a)?a:[],s[n].push(o)}else s[n]=o===""||o}for(var l in s){var u=l.split("[");u.length>1&&(od(s,u.map(function(d){return d.replace(/[?[\]\\ ]/g,"")}),s[l]),delete s[l])}return s})((function(t){return He&&window.location.search.substring(1)})())}function od(e,t,i){for(var s=t.length-1,r=0;r<s;++r){var n=t[r];if(n==="__proto__"||n==="constructor")break;n in e||(e[n]={}),e=e[n]}e[t[s]]=i}function Ws(){for(var e="",t=0,i=4294967295*Math.random()|0;t++<36;){var s="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[t-1],r=15&i;e+=s=="-"||s=="4"?s:(s=="x"?r:3&r|8).toString(16),i=t%8==0?4294967295*Math.random()|0:i>>4}return e}var Pt="global",ri=At+Pt+At,ni=typeof self===ws&&self.self===self&&self||typeof global===ws&&global[Pt]===global&&global||void 0;function Tt(e){return ni[ri][e]}function Rt(e,t){return ni[ri][e]=t}function hi(e){delete ni[ri][e]}function fi(e,t,i){var s;try{if(kn(e)){var r=window[e];s=r[t].bind(r)}}catch{}return s||i}ni[ri]||(ni[ri]={});var es={};function kn(e){if(typeof es[e]!==Be)return es[e];try{var t=window[e];t.setItem(Be,Be),t.removeItem(Be)}catch{return es[e]=!1}return es[e]=!0}function J(){return J=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e},J.apply(null,arguments)}var dt="function",it="undefined",Oi="reducer",il="@@redux/",Vr=il+"INIT",ad=il+Math.random().toString(36),so=(function(){return typeof Symbol===dt&&Symbol.observable||"@@observable"})(),ts=" != "+dt;function sl(e,t,i){var s;if(typeof t===dt&&typeof i===it&&(i=t,t=void 0),typeof i!==it){if(typeof i!==dt)throw new Error("enhancer"+ts);return i(sl)(e,t)}if(typeof e!==dt)throw new Error(Oi+ts);var r=e,n=t,o=[],a=o,l=!1;function u(){a===o&&(a=o.slice())}function d(){return n}function c(f){if(typeof f!==dt)throw new Error("Listener"+ts);var _=!0;return u(),a.push(f),function(){if(_){_=!1,u();var m=a.indexOf(f);a.splice(m,1)}}}function h(f){if(!Oe(f))throw new Error("Act != obj");if(typeof f.type===it)throw new Error("ActType "+it);if(l)throw new Error("Dispatch in "+Oi);try{l=!0,n=r(n,f)}finally{l=!1}for(var _=o=a,m=0;m<_.length;m++)(0,_[m])();return f}return h({type:Vr}),(s={dispatch:h,subscribe:c,getState:d,replaceReducer:function(f){if(typeof f!==dt)throw new Error("next "+Oi+ts);r=f,h({type:Vr})}})[so]=function(){var f,_=c;return(f={subscribe:function(m){if(typeof m!="object")throw new TypeError("Observer != obj");function v(){m.next&&m.next(d())}return v(),{unsubscribe:_(v)}}})[so]=function(){return this},f},s}function ld(e,t){var i=t&&t.type;return"action "+(i&&i.toString()||"?")+Oi+" "+e+" returns "+it}function oi(){var e=[].slice.call(arguments);return e.length===0?function(t){return t}:e.length===1?e[0]:e.reduce(function(t,i){return function(){return t(i.apply(void 0,[].slice.call(arguments)))}})}function ud(){var e=arguments;return function(t){return function(i,s,r){var n,o=t(i,s,r),a=o.dispatch,l={getState:o.getState,dispatch:function(u){return a(u)}};return n=[].slice.call(e).map(function(u){return u(l)}),J({},o,{dispatch:a=oi.apply(void 0,n)(o.dispatch)})}}}var gt=At+"anon_id",Ot=At+"user_id",Zt=At+"user_traits",Ur="analytics",ct="userId",Wt="anonymousId",fs=["bootstrap","params","campaign","initializeStart","initialize","initializeEnd","ready","resetStart","reset","resetEnd","pageStart","page","pageEnd","pageAborted","trackStart","track","trackEnd","trackAborted","identifyStart","identify","identifyEnd","identifyAborted","userIdChanged","registerPlugins","enablePlugin","disablePlugin","online","offline","setItemStart","setItem","setItemEnd","setItemAborted","removeItemStart","removeItem","removeItemEnd","removeItemAborted"],zr=["name","EVENTS","config","loaded"],G=fs.reduce(function(e,t){return e[t]=t,e},{registerPluginType:function(e){return"registerPlugin:"+e},pluginReadyType:function(e){return"ready:"+e}}),ro=/^utm_/,no=/^an_prop_/,oo=/^an_trait_/;function cd(e){var t=e.storage.setItem;return function(i){return function(s){return function(r){if(r.type===G.bootstrap){var n=r.params,o=r.user,a=r.persistedUser,l=r.initialUser,u=a.userId===o.userId;a.anonymousId!==o.anonymousId&&t(gt,o.anonymousId),u||t(Ot,o.userId),l.traits&&t(Zt,J({},u&&a.traits?a.traits:{},l.traits));var d=Object.keys(r.params);if(d.length){var c=n.an_uid,h=n.an_event,f=d.reduce(function(_,m){if(m.match(ro)||m.match(/^(d|g)clid/)){var v=m.replace(ro,"");_.campaign[v==="campaign"?"name":v]=n[m]}return m.match(no)&&(_.props[m.replace(no,"")]=n[m]),m.match(oo)&&(_.traits[m.replace(oo,"")]=n[m]),_},{campaign:{},props:{},traits:{}});i.dispatch(J({type:G.params,raw:n},f,c?{userId:c}:{})),c&&setTimeout(function(){return e.identify(c,f.traits)},0),h&&setTimeout(function(){return e.track(h,f.props)},0),Object.keys(f.campaign).length&&i.dispatch({type:G.campaign,campaign:f.campaign})}}return s(r)}}}}function dd(e){return function(t,i){if(t===void 0&&(t={}),i===void 0&&(i={}
1),i.type===G.setItemEnd){if(i.key===gt)return J({},t,{anonymousId:i.value});if(i.key===Ot)return J({},t,{userId:i.value})}switch(i.type){case G.identify:return Object.assign({},t,{userId:i.userId,traits:J({},t.traits,i.traits)});case G.reset:return[Ot,gt,Zt].forEach(function(s){e.removeItem(s)}),Object.assign({},t,{userId:null,anonymousId:null,traits:{}});default:return t}}}function ao(e){return{userId:e.getItem(Ot),anonymousId:e.getItem(gt),traits:e.getItem(Zt)}}var Wr=function(e){return At+"TEMP"+At+e};function hd(e){var t=e.storage,i=t.setItem,s=t.removeItem,r=t.getItem;return function(n){return function(o){return function(a){var l=a.userId,u=a.traits,d=a.options;if(a.type===G.reset&&([Ot,Zt,gt].forEach(function(f){s(f)}),[ct,Wt,"traits"].forEach(function(f){hi(Wr(f))})),a.type===G.identify){r(gt)||i(gt,Ws());var c=r(Ot),h=r(Zt)||{};c&&c!==l&&n.dispatch({type:G.userIdChanged,old:{userId:c,traits:h},new:{userId:l,traits:u},options:d}),l&&i(Ot,l),u&&i(Zt,J({},h,u))}return o(a)}}}}var Si={};function lo(e,t){Si[e]&&We(Si[e])&&(Si[e](t),delete Si[e])}function rl(e,t,i){return new Promise(function(s,r){return t()?s(e):i<1?r(J({},e,{queue:!0})):new Promise(function(n){return setTimeout(n,10)}).then(function(n){return rl(e,t,i-10).then(s,r)})})}function fd(e){return{abort:e}}function nl(e,t,i){var s={},r=t(),n=e.getState(),o=n.plugins,a=n.queue,l=n.user;if(!n.context.offline&&a&&a.actions&&a.actions.length){var u=a.actions.reduce(function(c,h,f){return o[h.plugin].loaded?(c.process.push(h),c.processIndex.push(f)):(c.requeue.push(h),c.requeueIndex.push(f)),c},{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(u.processIndex&&u.processIndex.length){u.processIndex.forEach(function(c){var h=a.actions[c],f=h.plugin,_=h.payload.type,m=r[f][_];if(m&&We(m)){var v,g=(function(S,b){return S===void 0&&(S={}),b===void 0&&(b={}),[ct,Wt].reduce(function(O,C){return S.hasOwnProperty(C)&&b[C]&&b[C]!==S[C]&&(O[C]=b[C]),O},S)})(h.payload,l),y=s[g.meta.rid];if(!y&&(v=m({payload:g,config:o[f].config,instance:i,abort:fd}))&&Oe(v)&&v.abort)return void(s[g.meta.rid]=!0);if(!y){var x=_+":"+f;e.dispatch(J({},g,{type:x,_:{called:x,from:"queueDrain"}}))}}});var d=a.actions.filter(function(c,h){return!~u.processIndex.indexOf(h)});a.actions=d}}}var sr=function(e){var t=e.data,i=e.action,s=e.instance,r=e.state,n=e.allPlugins,o=e.allMatches,a=e.store,l=e.EVENTS;try{var u=r.plugins,d=r.context,c=i.type,h=c.match(Qt),f=t.exact.map(function(v){return v.pluginName});h&&(f=o.during.map(function(v){return v.pluginName}));var _=(function(v,g){return function(y,x,S){var b=x.config,O=x.name,C=O+"."+y.type;S&&(C=S.event);var P=y.type.match(Qt)?(function(M,D,U,B,K){return function(T,A){var N=B?B.name:M,Z=A&&Bi(A)?A:U;if(B&&(!(Z=A&&Bi(A)?A:[M]).includes(M)||Z.length!==1))throw new Error("Method "+D+" can only abort "+M+" plugin. "+JSON.stringify(Z)+" input valid");return J({},K,{abort:{reason:T,plugins:Z,caller:D,_:N}})}})(O,C,g,S,y):(function(M,D){return function(){throw new Error(M.type+" action not cancellable. Remove abort in "+D)}})(y,C);return{payload:pd(y),instance:v,config:b||{},abort:P}}})(s,f),m=t.exact.reduce(function(v,g){var y=g.pluginName,x=g.methodName,S=!1;return x.match(/^initialize/)||x.match(/^reset/)||(S=!u[y].loaded),d.offline&&x.match(/^(page|track|identify)/)&&(S=!0),v[""+y]=S,v},{});return Promise.resolve(t.exact.reduce(function(v,g,y){var x=g.pluginName;return Promise.resolve(v).then(function(S){function b(){return Promise.resolve(S)}var O=(function(){if(t.namespaced&&t.namespaced[x])return Promise.resolve(t.namespaced[x].reduce(function(C,P,M){return Promise.resolve(C).then(function(D){return P.method&&We(P.method)?((function(T,A){var N=go(T);if(N&&N.name===A){var Z=go(N.method);throw new Error([A+" plugin is calling method "+T,"Plugins cant call self","Use "+N.method+" "+(Z?"or "+Z.method:"")+" in "+A+" plugin insteadof "+T].join(` 2`))}})(P.methodName,P.pluginName),Promise.resolve(P.method({payload:D,instance:s,abort:(U=D,B=x,K=P.pluginName,function(T,A){return J({},U,{abort:{reason:T,plugins:A||[B],caller:c,from:K||B}})}),config:ho(P.pluginName,u,n),plugins:u})).then(function(T){var A=Oe(T)?T:{};return Promise.resolve(J({},D,A))})):D;var U,B,K})},Promise.resolve(i))).then(function(C){S[x]=C});S[x]=i})();return O&&O.then?O.then(b):b()})},Promise.resolve({}))).then(function(v){return Promise.resolve(t.exact.reduce(function(g,y,x){try{var S=t.exact.length===x+1,b=y.pluginName,O=n[b];return Promise.resolve(g).then(function(C){var P=v[b]?v[b]:{};if(h&&(P=C),nr(P,b))return rr({data:P,method:c,instance:s,pluginName:b,store:a}),Promise.resolve(C);if(nr(C,b))return S&&rr({data:C,method:c,instance:s,store:a}),Promise.resolve(C);if(m.hasOwnProperty(b)&&m[b]===!0)return a.dispatch({type:"queue",plugin:b,payload:P,_:{called:"queue",from:"queueMechanism"}}),Promise.resolve(C);var M=_(v[b],n[b]);return Promise.resolve(O[c]({abort:M.abort,payload:P,instance:s,config:ho(b,u,n),plugins:u})).then(function(D){var U=Oe(D)?D:{},B=J({},C,U),K=v[b];if(nr(K,b))rr({data:K,method:c,instance:s,pluginName:b,store:a});else{var T=c+":"+b;(T.match(/:/g)||[]).length<2&&!c.match(uo)&&!c.match(co)&&s.dispatch(J({},h?B:P,{type:T,_:{called:T,from:"submethod"}}))}return Promise.resolve(B)})})}catch(C){return Promise.reject(C)}},Promise.resolve(i))).then(function(g){if(!(c.match(Qt)||c.match(/^registerPlugin/)||c.match(co)||c.match(uo)||c.match(/^params/)||c.match(/^userIdChanged/))){if(l.plugins.includes(c),g._&&g._.originalAction===c)return g;var y=J({},g,{_:{originalAction:g.type,called:g.type,from:"engineEnd"}});ol(g,t.exact.length)&&!c.match(/End$/)&&(y=J({},y,{type:g.type+"Aborted"})),a.dispatch(y)}return g})})}catch(v){return Promise.reject(v)}},Qt=/Start$/,uo=/^bootstrap/,co=/^ready/;function rr(e){var t=e.pluginName,i=e.method+"Aborted"+(t?":"+t:"");e.store.dispatch(J({},e.data,{type:i,_:{called:i,from:"abort"}}))}function ho(e,t,i){var s=t[e]||i[e];return s&&s.config?s.config:{}}function fo(e,t){return t.reduce(function(i,s){return s[e]?i.concat({methodName:e,pluginName:s.name,method:s[e]}):i},[])}function po(e,t){var i=e.replace(Qt,""),s=t?":"+t:"";return[""+e+s,""+i+s,i+"End"+s]}function nr(e,t){var i=e.abort;return!!i&&(i===!0||vo(i,t)||i&&vo(i.plugins,t))}function ol(e,t){var i=e.abort;if(!i)return!1;if(i===!0||Yt(i))return!0;var s=i.plugins;return Bi(i)&&i.length===t||Bi(s)&&s.length===t}function Bi(e){return Array.isArray(e)}function vo(e,t){return!(!e||!Bi(e))&&e.includes(t)}function go(e){var t=e.match(/(.*):(.*)/);return!!t&&{method:t[1],name:t[2]}}function pd(e){return Object.keys(e).reduce(function(t,i){return i==="type"||(t[i]=Oe(e[i])?Object.assign({},e[i]):e[i]),t},{})}function vd(e,t,i){var s={};return function(r){return function(n){return function(o){try{var a,l=function(S){return a?S:n(c)},u=o.type,d=o.plugins,c=o;if(o.abort)return Promise.resolve(n(o));if(u===G.enablePlugin&&r.dispatch({type:G.initializeStart,plugins:d,disabled:[],fromEnable:!0,meta:o.meta}),u===G.disablePlugin&&setTimeout(function(){return lo(o.meta.rid,{payload:o})}
2,0),u===G.initializeEnd){var h=t(),f=Object.keys(h),_=f.filter(function(S){return d.includes(S)}).map(function(S){return h[S]}),m=[],v=[],g=o.disabled,y=_.map(function(S){var b=S.loaded,O=S.name,C=S.config;return rl(S,function(){return b({config:C})},1e4).then(function(P){return s[O]||(r.dispatch({type:G.pluginReadyType(O),name:O,events:Object.keys(S).filter(function(M){return!zr.includes(M)})}),s[O]=!0),m=m.concat(O),S}).catch(function(P){if(P instanceof Error)throw new Error(P);return v=v.concat(P.name),P})});Promise.all(y).then(function(S){var b={plugins:m,failed:v,disabled:g};setTimeout(function(){f.length===y.length+g.length&&r.dispatch(J({},{type:G.ready},b))},0)})}var x=(function(){if(u!==G.bootstrap)return/^ready:([^:]*)$/.test(u)&&setTimeout(function(){return nl(r,t,e)},0),Promise.resolve((function(S,b,O,C,P){try{var M=We(b)?b():b,D=S.type,U=D.replace(Qt,"");if(S._&&S._.called)return Promise.resolve(S);var B=O.getState(),K=(N=M,(Z=B.plugins)===void 0&&(Z={}),(ee=S.options)===void 0&&(ee={}),Object.keys(N).filter(function($){var k=ee.plugins||{};return Xc(k[$])?k[$]:k.all!==!1&&(!Z[$]||Z[$].enabled!==!1)}).map(function($){return N[$]}));D===G.initializeStart&&S.fromEnable&&(K=Object.keys(B.plugins).filter(function($){var k=B.plugins[$];return S.plugins.includes($)&&!k.initialized}).map(function($){return M[$]}));var T=K.map(function($){return $.name}),A=(function($,k){var R=po($).map(function(H){return fo(H,k)});return k.reduce(function(H,W){var V=W.name,oe=po($,V).map(function(_e){return fo(_e,k)}),ie=oe[0],ce=oe[1],X=oe[2];return ie.length&&(H.beforeNS[V]=ie),ce.length&&(H.duringNS[V]=ce),X.length&&(H.afterNS[V]=X),H},{before:R[0],beforeNS:{},during:R[1],duringNS:{},after:R[2],afterNS:{}})})(D,K);return Promise.resolve(sr({action:S,data:{exact:A.before,namespaced:A.beforeNS},state:B,allPlugins:M,allMatches:A,instance:O,store:C,EVENTS:P})).then(function($){function k(){var W=(function(){if(D.match(Qt))return Promise.resolve(sr({action:J({},R,{type:U+"End"}),data:{exact:A.after,namespaced:A.afterNS},state:B,allPlugins:M,allMatches:A,instance:O,store:C,EVENTS:P})).then(function(V){V.meta&&V.meta.hasCallback&&lo(V.meta.rid,{payload:V})})})();return W&&W.then?W.then(function(){return $}):$}if(ol($,T.length))return $;var R,H=(function(){if(D!==U)return Promise.resolve(sr({action:J({},$,{type:U}),data:{exact:A.during,namespaced:A.duringNS},state:B,allPlugins:M,allMatches:A,instance:O,store:C,EVENTS:P})).then(function(W){R=W});R=$})();return H&&H.then?H.then(k):k()})}catch($){return Promise.reject($)}var N,Z,ee})(o,t,e,r,i)).then(function(S){var b=n(S);return a=1,b})})();return Promise.resolve(x&&x.then?x.then(l):l(x))}catch(S){return Promise.reject(S)}}}}}function gd(e){return function(t){return function(i){return function(s){var r=s.type,n=s.key,o=s.value,a=s.options;if(r===G.setItem||r===G.removeItem){if(s.abort)return i(s);r===G.setItem?e.setItem(n,o,a):e.removeItem(n,a)}return i(s)}}}}var _d=function(){var e=this;this.before=[],this.after=[],this.addMiddleware=function(t,i){e[i]=e[i].concat(t)},this.removeMiddleware=function(t,i){var s=e[i].findIndex(function(r){return r===t});s!==-1&&(e[i]=[].concat(e[i].slice(0,s),e[i].slice(s+1)))},this.dynamicMiddlewares=function(t){return function(i){return function(s){return function(r){var n={getState:i.getState,dispatch:function(a){return i.dispatch(a)}},o=e[t].map(function(a){return a(n)});return oi.apply(void 0,o)(s)(r)}}}}};function md(e){return function(t,i){t===void 0&&(t={});var s={};if(i.type==="initialize:aborted")return t;if(/^registerPlugin:([^:]*)$/.test(i.type)){var r=_o(i.type,"registerPlugin"),n=e()[r];if(!n||!r)return t;var o=i.enabled,a=n.config;return s[r]={enabled:o,initialized:!!o&&!n.initialize,loaded:!!o&&!!n.loaded({config:a}),config:a},J({},t,s)}if(/^initialize:([^:]*)$/.test(i.type)){var l=_o(i.type,G.initialize),u=e()[l];return u&&l?(s[l]=J({},t[l],{initialized:!0,loaded:!!u.loaded({config:u.config})}),J({},t,s)):t}if(/^ready:([^:]*)$/.test(i.type))return s[i.name]=J({},t[i.name],{loaded:!0}),J({},t,s);switch(i.type){case G.disablePlugin:return J({},t,mo(i.plugins,!1,t));case G.enablePlugin:return J({},t,mo(i.plugins,!0,t));default:return t}}}function _o(e,t){return e.substring(t.length+1,e.length)}function mo(e,t,i){return e.reduce(function(s,r){return s[r]=J({},i[r],{enabled:t}),s},i)}function al(e){try{return JSON.parse(JSON.stringify(e))}catch{}return e}var yd={last:{},history:[]};function bd(e,t){e===void 0&&(e=yd);
2var i=t.options,s=t.meta;if(t.type===G.track){var r=al(J({event:t.event,properties:t.properties},Object.keys(i).length&&{options:i},{meta:s}));return J({},e,{last:r,history:e.history.concat(r)})}return e}var wd={actions:[]};function $d(e,t){e===void 0&&(e=wd);var i=t.payload;switch(t.type){case"queue":var s;return s=i&&i.type&&i.type===G.identify?[t].concat(e.actions):e.actions.concat(t),J({},e,{actions:s});case"dequeue":return[];default:return e}}var ll=/#.*$/;function xd(e){var t=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e);return"/"+(t&&t[3]?t[3].split("?")[0].replace(ll,""):"")}var ul,cl,dl,hl,Ed=function(e){if(e===void 0&&(e={}),!He)return e;var t=document,i=t.title,s=t.referrer,r=window,n=r.location,o=r.innerWidth,a=r.innerHeight,l=n.hash,u=n.search,d=(function(h){var f=(function(){if(He){for(var _,m=document.getElementsByTagName("link"),v=0;_=m[v];v++)if(_.getAttribute("rel")==="canonical")return _.getAttribute("href")}})();return f?f.match(/\?/)?f:f+h:window.location.href.replace(ll,"")})(u),c={title:i,url:d,path:xd(d),hash:l,search:u,width:o,height:a};return s&&s!==""&&(c.referrer=s),J({},c,e)},kd={last:{},history:[]};function Sd(e,t){e===void 0&&(e=kd);var i=t.options;if(t.type===G.page){var s=al(J({properties:t.properties,meta:t.meta},Object.keys(i).length&&{options:i}));return J({},e,{last:s,history:e.history.concat(s)})}return e}ul=(function(){if(!He)return!1;var e=navigator.appVersion;return~e.indexOf("Win")?"Windows":~e.indexOf("Mac")?"MacOS":~e.indexOf("X11")?"UNIX":~e.indexOf("Linux")?"Linux":"Unknown OS"})(),cl=He?document.referrer:null,dl=sd(),hl=rd();var yo={initialized:!1,sessionId:Ws(),app:null,version:null,debug:!1,offline:!!He&&!navigator.onLine,os:{name:ul},userAgent:He?navigator.userAgent:"node",library:{name:Ur,version:"0.13.1"},timezone:hl,locale:dl,campaign:{},referrer:cl};function Id(e,t){e===void 0&&(e=yo);var i=e.initialized,s=t.campaign;switch(t.type){case G.campaign:return J({},e,{campaign:s});case G.offline:return J({},e,{offline:!0});case G.online:return J({},e,{offline:!1});default:return i?e:J({},yo,e,{initialized:!0})}}var Pd=["plugins","reducers","storage"];function Od(e,t,i){if(He){var s=window[(i?"add":"remove")+"EventListener"];e.split(" ").forEach(function(r){s(r,t)})}}function Cd(e){var t=Od.bind(null,"online offline",function(i){return Promise.resolve(!navigator.onLine).then(e)});return t(!0),function(i){return t(!1)}}function fl(){return Rt(Ur,[]),function(e){return function(t,i,s){var r=e(t,i,s),n=r.dispatch;return Object.assign(r,{dispatch:function(o){return ni[ri][Ur].push(o.action||o),n(o)}})}}}function bo(e){return function(){return oi(oi.apply(null,arguments),fl())}}function or(e){return e?Zc(e)?e:[e]:[]}function wo(e,t,i){e===void 0&&(e={});var s,r,n=Ws();return t&&(Si[n]=(s=t,r=(function(o){for(var a,l=o||Array.prototype.slice.call(arguments),u=0;u<l.length;u++)if(We(l[u])){a=l[u];break}return a})(i),function(o){r&&r(o),s(o)})),J({},e,{rid:n,ts:new Date().getTime()},t?{hasCallback:!0}:{})}function Fd(e){e===void 0&&(e={});var t=e.reducers||{},i=e.initialUser||{},s=(e.plugins||[]).reduce(function($,k){if(We(k))return $.middlewares=$.middlewares.concat(k),$;if(k.NAMESPACE&&(k.name=k.NAMESPACE),!k.name)throw new Error("https://lytics.dev/errors/1");
2k.config||(k.config={});var R=k.EVENTS?Object.keys(k.EVENTS).map(function(V){return k.EVENTS[V]}):[];$.pluginEnabled[k.name]=!(k.enabled===!1||k.config.enabled===!1),delete k.enabled,k.methods&&($.methods[k.name]=Object.keys(k.methods).reduce(function(V,oe){var ie;return V[oe]=(ie=k.methods[oe],function(){for(var ce=Array.prototype.slice.call(arguments),X=new Array(ie.length),_e=0;_e<ce.length;_e++)X[_e]=ce[_e];return X[X.length]=b,ie.apply({instance:b},X)}),V},{}),delete k.methods);var H=Object.keys(k).concat(R),W=new Set($.events.concat(H));if($.events=Array.from(W),$.pluginsArray=$.pluginsArray.concat(k),$.plugins[k.name])throw new Error(k.name+"AlreadyLoaded");return $.plugins[k.name]=k,$.plugins[k.name].loaded||($.plugins[k.name].loaded=function(){return!0}),$},{plugins:{},pluginEnabled:{},methods:{},pluginsArray:[],middlewares:[],events:[]}),r=e.storage?e.storage:{getItem:Tt,setItem:Rt,removeItem:hi},n=(function($){return function(k,R,H){return R.getState("user")[k]||(H&&Oe(H)&&H[k]?H[k]:ao($)[k]||Tt(Wr(k))||null)}})(r),o=s.plugins,a=s.events.filter(function($){return!zr.includes($)}).sort(),l=new Set(a.concat(fs).filter(function($){return!zr.includes($)})),u=Array.from(l).sort(),d=function(){return o},c=new _d,h=c.addMiddleware,f=c.removeMiddleware,_=c.dynamicMiddlewares,m=function(){throw new Error("Abort disabled inListener")},v=nd(),g=ao(r),y=J({},g,i,v.an_uid?{userId:v.an_uid}:{},v.an_aid?{anonymousId:v.an_aid}:{});y.anonymousId||(y.anonymousId=Ws());var x=J({enable:function($,k){return new Promise(function(R){A.dispatch({type:G.enablePlugin,plugins:or($),_:{originalAction:G.enablePlugin}},R,[k])})},disable:function($,k){return new Promise(function(R){A.dispatch({type:G.disablePlugin,plugins:or($),_:{originalAction:G.disablePlugin}},R,[k])})}},s.methods),S=!1,b={identify:function($,k,R,H){try{var W=Yt($)?$:null,V=Oe($)?$:k,oe=R||{},ie=b.user();Rt(Wr(ct),W);var ce=W||V.userId||n(ct,b,V);return Promise.resolve(new Promise(function(X){A.dispatch(J({type:G.identifyStart,userId:ce,traits:V||{},options:oe,anonymousId:ie.anonymousId},ie.id&&ie.id!==W&&{previousId:ie.id}),X,[k,R,H])}))}catch(X){return Promise.reject(X)}},track:function($,k,R,H){try{var W=Oe($)?$.event:$;if(!W||!Yt(W))throw new Error("EventMissing");var V=Oe($)?$:k||{},oe=Oe(R)?R:{};return Promise.resolve(new Promise(function(ie){A.dispatch({type:G.trackStart,event:W,properties:V,options:oe,userId:n(ct,b,k),anonymousId:n(Wt,b,k)},ie,[k,R,H])}))}catch(ie){return Promise.reject(ie)}},page:function($,k,R){try{var H=Oe($)?$:{},W=Oe(k)?k:{};return Promise.resolve(new Promise(function(V){A.dispatch({type:G.pageStart,properties:Ed(H),options:W,userId:n(ct,b,H),anonymousId:n(Wt,b,H)},V,[$,k,R])}))}catch(V){return Promise.reject(V)}},user:function($){if($===ct||$==="id")return n(ct,b);if($===Wt||$==="anonId")return n(Wt,b);var k=b.getState("user");return $?to(k,$):k},reset:function($){return new Promise(function(k){A.dispatch({type:G.resetStart},k,$)})},ready:function($){return S&&$({plugins:x,instance:b}),b.on(G.ready,function(k){$&&$(k),S=!0})},on:function($,k){if(!$||!We(k))return!1;if($===G.bootstrap)throw new Error(".on disabled for "+$);var R=/Start$|Start:/;if($==="*"){var H=function(ie){return function(ce){return function(X){return X.type.match(R)&&k({payload:X,instance:b,plugins:o}),ce(X)}}},W=function(ie){return function(ce){return function(X){return X.type.match(R)||k({payload:X,instance:b,plugins:o}),ce(X)}}};return h(H,is),h(W,ss),function(){f(H,is),f(W,ss)}}var V=$.match(R)?is:ss,oe=function(ie){return function(ce){return function(X){return X.type===$&&k({payload:X,instance:b,plugins:o,abort:m}),ce(X)}}};return h(oe,V),function(){return f(oe,V)}},once:function($,k){if(!$||!We(k))return!1;if($===G.bootstrap)throw new Error(".once disabled for "+$);var R=b.on($,function(H){k({payload:H.payload,instance:b,plugins:o,abort:m}),R()});return R},getState:function($){var k=A.getState();return $?to(k,$):Object.assign({},k)},dispatch:function($){var k=Yt($)?{type:$}:$;if(fs.includes(k.type))throw new Error("reserved action "+k.type);var R=J({},k,{_:J({originalAction:k.type},$._||{})});A.dispatch(R)},enablePlugin:x.enable,disablePlugin:x.disable,plugins:x,storage:{getItem:r.getItem,setItem:function($,k,R){A.dispatch({type:G.setItemStart,key:$,value:k,options:R})},removeItem:function($,k){A.dispatch({type:G.removeItemStart,key:$,options:k})}},setAnonymousId:function($,k){b.storage.setItem(gt,$,k)},events:{core:fs,plugins:a}},O=s.middlewares.concat([function($){return function(k){return function(R){return R.meta||(R.meta=wo()),k(R)}}},_(is),vd(b,d,{all:u,plugins:a}),gd(r),cd(b),hd(b),_(ss)]),C={context:Id,user:dd(r),page:Sd,track:bd,plugins:md(d),queue:$d},P=oi,M=oi;if(He&&e.debug){var D=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;D&&(P=D({trace:!0,traceLimit:25}
2)),M=function(){return arguments.length===0?fl():Oe(typeof arguments[0])?bo():bo().apply(null,arguments)}}var U,B=(function($){return Object.keys($).reduce(function(k,R){return Pd.includes(R)||(k[R]=$[R]),k},{})})(e),K=s.pluginsArray.reduce(function($,k){var R=k.name,H=k.config,W=k.loaded,V=s.pluginEnabled[R];return $[R]={enabled:V,initialized:!!V&&!k.initialize,loaded:!!W({config:H}),config:H},$},{}),T={context:B,user:y,plugins:K},A=sl((function($){for(var k=Object.keys($),R={},H=0;H<k.length;H++){var W=k[H];typeof $[W]===dt&&(R[W]=$[W])}var V,oe=Object.keys(R);try{(function(ie){Object.keys(ie).forEach(function(ce){var X=ie[ce];if(typeof X(void 0,{type:Vr})===it||typeof X(void 0,{type:ad})===it)throw new Error(Oi+" "+ce+" "+it)})})(R)}catch(ie){V=ie}return function(ie,ce){if(ie===void 0&&(ie={}),V)throw V;for(var X=!1,_e={},Re=0;Re<oe.length;Re++){var Dt=oe[Re],Le=ie[Dt],vi=(0,R[Dt])(Le,ce);if(typeof vi===it){var er=ld(Dt,ce);throw new Error(er)}_e[Dt]=vi,X=X||vi!==Le}return X?_e:ie}})(J({},C,t)),T,M(P(ud.apply(void 0,O))));A.dispatch=(U=A.dispatch,function($,k,R){var H=J({},$,{meta:wo($.meta,k,or(R))});return U.apply(null,[H])});var N=Object.keys(o);A.dispatch({type:G.bootstrap,plugins:N,config:B,params:v,user:y,initialUser:i,persistedUser:g});var Z=N.filter(function($){return s.pluginEnabled[$]}),ee=N.filter(function($){return!s.pluginEnabled[$]});return A.dispatch({type:G.registerPlugins,plugins:N,enabled:s.pluginEnabled}),s.pluginsArray.map(function($,k){var R=$.bootstrap,H=$.config,W=$.name;R&&We(R)&&R({instance:b,config:H,payload:$}),A.dispatch({type:G.registerPluginType(W),name:W,enabled:s.pluginEnabled[W],plugin:$}),s.pluginsArray.length===k+1&&A.dispatch({type:G.initializeStart,plugins:Z,disabled:ee})}),Cd(function($){A.dispatch({type:$?G.offline:G.online})}),(function($,k,R){setInterval(function(){return nl($,k,R)},3e3)})(A,d,b),b}var is="before",ss="after",Ct="cookie",It=gl(),pl=Gs,Md=Gs;function vl(e){return It?Gs(e,"",-1):hi(e)}function gl(){if(It!==void 0)return It;var e=Ct+Ct;try{Gs(e,e),It=document.cookie.indexOf(e)!==-1,vl(e)}catch{It=!1}return It}function Gs(e,t,i,s,r,n){if(typeof window<"u"){var o=arguments.length>1;return It===!1&&(o?Rt(e,t):Tt(e)),o?document.cookie=e+"="+encodeURIComponent(t)+(i?"; expires="+new Date(+new Date+1e3*i).toUTCString()+(s?"; path="+s:"")+(r?"; domain="+r:"")+(n?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}var rt="localStorage",Ad=kn.bind(null,rt);fi(rt,"getItem",Tt);fi(rt,"setItem",Rt);fi(rt,"removeItem",hi);var nt="sessionStorage",Td=kn.bind(null,nt);fi(nt,"getItem",Tt);fi(nt,"setItem",Rt);fi(nt,"removeItem",hi);function ei(e){var t=e;try{if((t=JSON.parse(e))==="true")return!0;if(t==="false")return!1;if(Oe(t))return t;parseFloat(t)===t&&(t=parseFloat(t))}catch{}if(t!==null&&t!=="")return t}var Rd=Ad(),Ld=Td(),Dd=gl();function _l(e,t){if(e){var i=Sn(t),s=!Cn(i),r=In(i)?ei(localStorage.getItem(e)):void 0;if(s&&!zt(r))return r;var n=Pn(i)?ei(pl(e)):void 0;if(s&&n)return n;var o=On(i)?ei(sessionStorage.getItem(e)):void 0;if(s&&o)return o;var a=Tt(e);return s?a:{localStorage:r,sessionStorage:o,cookie:n,global:a}}}function Nd(e,t,i){if(e&&!zt(t)){var s={},r=Sn(i),n=JSON.stringify(t),o=!Cn(r);return In(r)&&(s[rt]=rs(rt,t,ei(localStorage.getItem(e))),localStorage.setItem(e,n),o)?s[rt]:Pn(r)&&(s[Ct]=rs(Ct,t,ei(pl(e))),Md(e,n),o)?s[Ct]:On(r)&&(s[nt]=rs(nt,t,ei(sessionStorage.getItem(e))),sessionStorage.setItem(e,n),o)?s[nt]:(s[Pt]=rs(Pt,t,Tt(e)),Rt(e,t),o?s[Pt]:s)}}function jd(e,t){if(e){var i=Sn(t),s=_l(e,Za),r={};return!zt(s.localStorage)&&In(i)&&(localStorage.removeItem(e),r[rt]=s.localStorage),!zt(s.cookie)&&Pn(i)&&(vl(e),r[Ct]=s.cookie),!zt(s.sessionStorage)&&On(i)&&(sessionStorage.removeItem(e),r[nt]=s.sessionStorage),!zt(s.global)&&Js(i,Pt)&&(hi(e),r[Pt]=s.global),r}}function Sn(e){return e?Yt(e)?e:e.storage:Ya}function In(e){return Rd&&Js(e,rt)}function Pn(e){return Dd&&Js(e,Ct)}function On(e){return Ld&&Js(e,nt)}function Cn(e){return e===Za||e==="all"}function Js(e,t){return e===Ya||e===t||Cn(e)}function rs(e,t,i){return{location:e,current:t,previous:i}}var qd={setItem:Nd,getItem:_l,removeItem:jd};function Bd(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function $o(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),i.push.apply(i,s)}return i}function xo(e){for(var t=1;t<arguments.length;t++){var i=arguments[t]!=null?arguments[t]:{};
2t%2?$o(Object(i),!0).forEach(function(s){Bd(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):$o(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}function pv(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t={storage:qd};return Fd(xo(xo({},t),e))}const w="u">typeof window?window:void 0,Ee="u">typeof globalThis?globalThis:w,we=Ee?.navigator,I=Ee?.document,he=Ee?.location,Hi=Ee?.fetch,Fn=Ee?.XMLHttpRequest&&"withCredentials"in new Ee.XMLHttpRequest?Ee.XMLHttpRequest:void 0,Eo=Ee?.AbortController,Hd=Ee?.CompressionStream,Se=we?.userAgent;function ml(){return!(!w||w.navigator.onLine===!1)}const gi=typeof globalThis<"u"?globalThis:w;gi&&typeof self>"u"&&(gi.self=gi),gi&&typeof File>"u"&&(gi.File=function(){});const L=w??{},Vd="0.9.0",st={DEBUG:!1,LIB_VERSION:Vd,LIB_NAME:"browser-common"};var ze=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),Gr=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({});const Ud=["$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"],zd=["token"];function q(e,t){return e.indexOf(t)!==-1}const Ks=function(e){return e.trim()},Jr=function(e){return e.replace(/^\$/,"")};function yl(e){var t;const i=[];return(t=JSON.stringify(e,function(s,r){if(typeof r=="bigint")return r.toString();if(typeof r!="function"&&typeof r!="symbol"){if(r instanceof Error)return{name:r.name,message:r.message,stack:r.stack};if(r&&typeof r=="object"){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(r))return"[Circular]";i.push(r)}return r}}))!==null&&t!==void 0?t:"null"}const bl=Object.prototype,Mn=bl.hasOwnProperty,Xs=bl.toString,j=Array.isArray||function(e){return Xs.call(e)==="[object Array]"},be=e=>typeof e=="function",Q=e=>e===Object(e)&&!j(e),Ce=e=>{if(Q(e)){for(const t in e)if(Mn.call(e,t))return!1;return!0}return!1},E=e=>e===void 0,Y=e=>Xs.call(e)=="[object String]",Ci=e=>Y(e)&&e.trim().length===0,ve=e=>e===null,z=e=>E(e)||ve(e),ge=e=>Xs.call(e)=="[object Number]"&&e==e,Ye=e=>ge(e)&&e>0,Pe=e=>Xs.call(e)==="[object Boolean]",Wd=e=>q(Ud,e),Gd=e=>q(zd,e);function wl(e){return e===null||typeof e!="object"}function Es(e,t){return{}.toString.call(e)===`[object ${t}]`}function pi(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return $l(e,Error)}}function An(e){return"u">typeof Event&&$l(e,Event)}function $l(e,t){try{return e instanceof t}catch{return!1}}const Jd=[!0,"true",1,"1","yes"],ar=e=>q(Jd,e),Kd=[!1,"false",0,"0","no"];function ko(e,t,i,s,r,n,o){try{var a=e[n](o),l=a.value}catch(u){return void i(u)}a.done?t(l):Promise.resolve(l).then(s,r)}function ue(e){return function(){var t=this,i=arguments;return new Promise(function(s,r){var n=e.apply(t,i);function o(l){ko(n,s,r,o,a,"next",l)}
vendor: 6,787 bytes, line 2
2function a(l){ko(n,s,r,o,a,"throw",l)}o(void 0)})}}const Xd=["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","pinterestbot","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"],So=function(e,t=[]){if(!e)return!1;const i=e.toLowerCase();return Xd.concat(t).some(s=>{const r=s.toLowerCase();return i.indexOf(r)!==-1})};function Ge(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),ge(e)?e>i?(s.warn(" cannot be greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),Ge(r??i,t,i,s))}var Yd=class{constructor(e){this.C={},this.I=e.I,this.R=Ge(e.bucketSize,0,100,e.$),this.A=Ge(e.refillRate,0,this.R,e.$),this.O=Ge(e.refillInterval,0,864e5,e.$)}F(e,t){const i=Math.floor((t-e.lastAccess)/this.O);i>0&&(e.tokens=Math.min(e.tokens+i*this.A,this.R),e.lastAccess=e.lastAccess+i*this.O)}consumeRateLimit(e){var t;const i=Date.now(),s=String(e);let r=this.C[s];return r?this.F(r,i):(r={tokens:this.R,lastAccess:i},this.C[s]=r),r.tokens===0||(r.tokens--,r.tokens===0&&((t=this.I)===null||t===void 0||t.call(this,e)),r.tokens===0)}stop(){this.C={}}};const ai="Mobile",Vi="Android",ks="Tablet",xl="Android Tablet",El="iPad",kl="Apple Watch",ps="Safari",Ys="BlackBerry",Sl="Samsung Internet",vs="Chrome",Il="Chrome iOS",Pl="Internet Explorer",Ol="Internet Explorer Mobile",Cl="Opera",Fl="Microsoft Edge",gs="Firefox",Ml="Firefox iOS",Ss="Nintendo",Is="PlayStation",Zs="Xbox",Al="Android Mobile",Tl="Mobile Safari",lr="Windows",Rl="Windows Phone",Io="Nokia",Kr="Ouya",Zd="Generic "+ai.toLowerCase(),Ll="Generic "+ks.toLowerCase(),Xr="Konqueror",Dl="Oculus Browser",Nl="Vivaldi",jl="Yandex",ql="Whale",Bl="DuckDuckGo",Hl="Pale Moon",Vl="Waterfox",Yr="Brave",Ul="Claude",zl="Codex",Wl="ChatGPT",Gl="Google Search App",ur=new RegExp("Version/(\\d+(\\.\\d+)?)"),cr=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),Qd=new RegExp(Zs,"i"),eh=new RegExp("PlayStation \\w+","i"),th=new RegExp("Nintendo \\w+","i"),Tn=new RegExp("BlackBerry|PlayBook|BB10","i"),ih={"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"},Jl=function(e,t,i,s){return t=t||"",(function(n){return n?.brave?Yr:null})(i)||(s?.detectGoogleSearchApp&&q(e,"GSA/")?Gl:q(e," OPR/")&&q(e,"Mini")?"Opera Mini":q(e," OPR/")?Cl:Tn.test(e)?Ys:q(e,"IEMobile")||q(e,"WPDesktop")?Ol:q(e,"OculusBrowser")?Dl:q(e,"SamsungBrowser")?Sl:q(e,"Edge")||q(e,"Edg/")?Fl:q(e,"Vivaldi/")?Nl:q(e,"YaBrowser/")?jl:q(e,"Whale/")?ql:q(e,"DuckDuckGo/")||q(e,"Ddg/")?Bl:q(e,"Claude/")?Ul:q(e,"Codex/")?zl:q(e,"ChatGPT/")?Wl:q(e,"FBIOS")?"Facebook Mobile":q(e,"UCWEB")||q(e,"UCBrowser")?"UC Browser":q(e,"CriOS")?Il:q(e,"CrMo")||q(e,vs)?vs:q(e,Vi)&&q(e,ps)?Al:q(e,"FxiOS")?Ml:q(e.toLowerCase(),Xr.toLowerCase())?Xr:q(e,"Brave/")?Yr:((n,o)=>o&&q(o,"Apple")||(function(a){return q(a,ps)&&!q(a,vs)&&!q(a,Vi)})(n))(e,t)?q(e,ai)?Tl:ps:q(e,"PaleMoon/")?Hl:q(e,"Waterfox/")?Vl:q(e,gs)?gs:q(e,"MSIE")||q(e,"Trident/")?Pl:q(e,"Gecko")?gs:"")},sh={[Ol]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Fl]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[vs]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Il]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[ps]:[ur],[Tl]:[ur],[Cl]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[gs]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[Ml]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Xr]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[Ys]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),ur],[Al]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[Sl]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Dl]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[Nl]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[jl]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[ql]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Yr]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ul]:[cr],[zl]:[cr],[Wl]:[cr],[Bl]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Hl]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[Vl]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[Gl]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Pl]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},rh=function(e,t,i,s){const r=Jl(e,t,i,s),n=sh[r];if(E(n))return null;for(let o=0;n.length>o;o++){const a=e.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},Po=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[Zs,e&&e[1]||""]],[new RegExp(Ss,"i"),[Ss,""]],[new RegExp(Is,"i"),[Is,""]],[Tn,[Ys,""]],[new RegExp(lr,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Rl,""];if(new RegExp(ai).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){let s=ih[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[lr,s]}return[lr,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=E(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[Vi,[e[2],e[3],e[4]||"0"].join(".")]:[Vi,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Kl=function(e){for(let t=0;Po.length>t;t++){const[i,s]=Po[t],r=i.exec(e),n=r&&(be(s)?s(r,e):s);if(n)return n}return["",""]},Xl=function(e){return th.test(e)?Ss:eh.test(e)?Is:Qd.test(e)?Zs:new RegExp(Kr,"i").test(e)?Kr:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?Rl:
2/iPad/.test(e)?El:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?kl:Tn.test(e)?Ys:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Io,"i").test(e)?Io:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(ai).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Vi:xl:new RegExp("(pda|Mobile)","i").test(e)?Zd:new RegExp(ks,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?Ll:""},nh=function(e,t){var i;const s=Xl(e);return s===El||s===xl||s==="Kobo"||s==="Kindle Fire"||s===Ll?ks:s===Ss||s===Zs||s===Is||s===Kr?"Console":s===kl?"Wearable":s?ai:t?.userAgentDataPlatform==="Android"&&((i=t?.maxTouchPoints)!==null&&i!==void 0?i:0)>0?600>Math.min((r=t?.screenWidth)!==null&&r!==void 0?r:0,(n=t?.screenHeight)!==null&&n!==void 0?n:0)/((o=t?.devicePixelRatio)!==null&&o!==void 0?o:1)?ai:ks:"Desktop";var r,n,o},dr=/\bFBAV\/(\d+(?:\.\d+)*)/i,Oo=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",dr],[/\bFBAN\/EMA\b/i,"Facebook Lite",dr],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",dr],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],Zr="[Truncated]",Zi="[Unserializable]";function ti(e){let t="";for(let i=0;e.length>i;i++){const s=e.charCodeAt(i);if(55296>s||s>56319)t+=56320>s||s>57343?e[i]:"�";else{const r=e.charCodeAt(i+1);56320>r||r>57343?t+="�":(t+=e[i]+e[i+1],i++)}}return t}function Yl(e,t){if(!t)return e;let i=[];try{i=Object.keys(t)}catch{i=[]}for(const s of i){let r;try{r=t[s]}catch{r=Zi}Object.defineProperty(e,s,{value:r,enumerable:!0,writable:!0,configurable:!0})}return e}const _s=3e5;var Zl=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;const t=this.isOpen(),i=Date.now(),s=Math.min(e.retryAfterMs,_s);if(!t)return this.ts=i,void(this.es=i+s);this.es=Math.max(this.es,Math.min(i+s,this.ts+_s))}remainingMs(){const e=Date.now();if(this.ts-5e3>e)return this.reset(),0;const t=Math.min(_s,Math.max(0,this.es-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}};const oh=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Co(e,t){return typeof(i=e)=="string"&&oh.test(i)?e:t();var i}function Ql(e,t){const i=new Error(t);try{Object.defineProperty(i,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return i}function mt(e){return e&&e.split("#")[0]}function Fo(e){try{return e()}catch{return}}function eu(e,t){const i=setTimeout(e,t);return i!=null&&i.unref&&i?.unref(),i}function Mo(e,t,i){return tu.apply(this,arguments)}function tu(){return(tu=ue(function*(e,t,i){let s;try{return yield Promise.race([e,new Promise((r,n)=>{s=eu(()=>{try{i?.(),r()}catch(o){n(o)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}let ns,Ao,hr;function ah(e){const t=globalThis._posthogChunkIds;if(!t)return;const i=Object.keys(t);return hr&&i.length===Ao||(Ao=i.length,hr=i.reduce((s,r)=>{ns||(ns={});const n=ns[r];if(n)s[n[0]]=n[1];else{const o=e(r);for(let a=o.length-1;a>=0;a--){const l=o[a],u=l?.filename,d=t[r];if(u&&d){s[u]=d,ns[r]=[u,d];break}}}return s},{})),hr}function Fi(e){return Fi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fi(e)}function lh(e,t,i){return(t=(function(s){var r=(function(n){if(Fi(n)!="object"||!n)return n;var o=n[Symbol.toPrimitive];if(o!==void 0){var a=o.call(n,"string");if(Fi(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)})(s);return Fi(r)=="symbol"?r:r+""})(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function To(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),i.push.apply(i,s)}return i}function p(e){for(var t=1;arguments.length>t;t++){var i=arguments[t]!=null?arguments[t]:{};
2t%2?To(Object(i),!0).forEach(function(s){lh(e,s,i[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):To(Object(i)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(i,s))})}return e}var uh=class{constructor(e,t,i=[]){this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t={}){const i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(s,r);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return ue(function*(){for(const i of e)i.stacktrace&&i.stacktrace.frames&&j(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)===null||t===void 0?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i;let s,r;if(e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null)try{r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)}catch{}return p(p({},e),{},{cause:s,stack:r,errors:(i=e.errors)===null||i===void 0?void 0:i.map(n=>this.parseStacktrace(n,t))})}applyChunkIds(e,t){return e.map(i=>(i.filename&&t&&(i.chunk_id=t[i.filename]),i))}applyCoercers(e,t){for(const i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return ue(function*(){let i=e;for(const s of t.modifiers)i=yield s(i);return i})()}convertToExceptionList(e,t){const i=[],s=(r,n,o)=>{var a;const l=i.length,u=n===void 0?p(p({type:typeof t.type=="string"&&t.type.length>0?t.type:"generic"},typeof t.handled=="boolean"?{handled:t.handled}:t.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof t.synthetic=="boolean"?t.synthetic:r.synthetic,exception_id:l}):{type:"chained",source:o,synthetic:r.synthetic,exception_id:l,parent_id:n},d={type:r.type,value:r.value,mechanism:u};r.stack&&(d.stacktrace={type:"raw",frames:r.stack}),i.push(d),r.cause&&s(r.cause,l,"cause");for(const c of(a=r.errors)!==null&&a!==void 0?a:[])s(c,l,"member")};return s(e),i}buildParsingContext(e){var t;return{chunkIdMap:ah(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}getAggregateErrors(e){try{if(pi(e)){let i=Object.getPrototypeOf(e);for(let s=0;i&&100>s;s++){var t;const r=(t=Object.getOwnPropertyDescriptor(i,"constructor"))===null||t===void 0?void 0:t.value;if(typeof r=="function"&&r.name==="AggregateError"){const n=e.errors;return j(n)?n:void 0}i=Object.getPrototypeOf(i)}}}catch{}}buildCoercingContext(e,t,i=0){let s=0,r=0,n=!1;const o=new Set,a=[],l={},u=(h,f,_=0)=>{const m=d(f,_),v=m.apply;if(m.apply=O=>{a.push(h);try{return v(O)}finally{a.pop()}},_>4||_>0&&a.indexOf(h)!==-1)return this.coerceFallback(m);const g=typeof h=="object"&&h!==null||typeof h=="function";if(_===0&&s>=50||g&&o.has(h))return;g&&o.add(h),_===0&&s++;const y=this.getAggregateErrors(h);let x,S;n||(n=!!y);try{if(x=this.applyCoercers(h,m),!x)throw l}catch(O){if(O===l)return void(_===0&&s--);if(!n)throw O;x=this.coerceFallback(m)}if(!y||s>=50)return x;try{S=y.length}catch{return x}if(!Number.isInteger(S)||0>S||S>4294967295)return x;const b=[];for(let O=0;50>s&&1e3>r&&S>O;O++){let C;r++;try{C=m.next(y[O])}catch{s++,C=this.coerceFallback(d(f+1))}C&&b.push(C)}return p(p({},x),{},{errors:b})},d=(h,f=0)=>p(p({},t),{},{syntheticException:h==0?t.syntheticException:void 0,mechanism:h==0?e:{},apply(_){const m=u(_,h,f+1);if(!m)throw l;return m},next:_=>u(_,h+1)}),c=d(i);return p(p({},c),{},{apply:h=>{var f;return(f=u(h,i))!==null&&f!==void 0?f:this.coerceFallback(c)}})}};const ch=/^([a-z][a-z0-9.+-]+):/i,dh=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function hh(e){if(!e||e==="<anonymous>")return!1;const t=ch.exec(e);return!t||dh.includes(t[1].toLowerCase())}function Qr(e,t,i,s,r){const n={platform:e,filename:t,function:i==="<anonymous>"?"?":i,in_app:hh(t)};return E(s)||(n.lineno=s),E(r)||(n.colno=r),n}const iu=(e,t)=>{const i=e.indexOf("safari-extension")!==-1,s=e.indexOf("safari-web-extension")!==-1;return i||s?[e.indexOf("@")!==-1?e.split("@")[0]:"?",i?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},fh=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ph=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,vh=/\((\S*)(?::(\d+))(?::(\d+))\)/,gh=(e,t)=>{const i=fh.exec(e);if(i){const[,r,n,o]=i;return Qr(t,r,"?",+n,+o)}const s=ph.exec(e);if(s){if(s[2]&&s[2].indexOf("eval")===0){const o=vh.exec(s[2]);o&&(s[2]=o[1],s[3]=o[2],s[4]=o[3])}const[r,n]=iu(s[1]||"?",s[2]);return Qr(t,n,r,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},_h=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,mh=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,yh=(e,t)=>{const i=_h.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){const n=mh.exec(i[3]);n&&(i[1]=i[1]||"eval",i[3]=n[1],i[4]=n[2],i[5]="")}let s=i[3],r=i[1]||"?";return[r,s]=iu(r,s),Qr(t,s,r,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Ro=/\(error: (.*)\)/;function Rn(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function bh(e){for(let t=1;10>=t;t++){const i=e.length-2*t;if(0>i)break;let s=!0;for(let r=0;t>r;r++)if(!Rn(e[i+r],e[i+t+r])){s=!1;break}if(s){for(let r=0;t>r;r++)e[i+r]=e[i+t+r];return e.length=i+t,{start:i,length:t}}}}function wh(e,t){const i=t.start+t.length,s=ru(e,t);
2s&&e.splice(i+s===e.length?i:t.start,s)}function su(e,t){let i=t.start;for(;i>0&&Rn(e[i-1],e[i-1+t.length]);)i--;return t.start-i}function ru(e,t){const i=t.start+t.length;let s=i;for(;e.length>s&&Rn(e[s],e[s-t.length]);)s++;return s-i}function $h(e,t){const i=t[0];let s=e.length-(i?su(e,i):0);for(const r of t)s-=ru(e,r);return s}function xh(e,t,i){for(let s=0;e.length>s;s++){const r=e[(t+s)%e.length],n=e[(i+s)%e.length];if(r!==n)return n>r}return!1}var Eh=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const i=Y(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){const t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return Es(e,"DOMException")}isDOMError(e){return Es(e,"DOMError")}},kh=class{match(e){return pi(e)}coerce(e,t){var i;const s=this.getStack(e),r=s===void 0?(i=t.syntheticException)===null||i===void 0?void 0:i.stack:void 0,n=!!r;return{type:this.getType(e),value:this.getMessage(e,t),stack:s??r,cause:e.cause?t.next(e.cause):void 0,synthetic:n}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const i=e.message;return String(i.error&&typeof i.error.message=="string"?i.error.message:i)}getStack(e){try{const t=e.stacktrace;if(typeof t=="string"&&t.length>0)return t;const i=e.stack;return typeof i=="string"&&i.length>0?i:void 0}catch{return}}},Sh=class{match(e){return!!Es(e,"ErrorEvent")&&(e.error!=null||this.ur(e))}coerce(e,t){var i;if(e.error!=null)return t.apply(e.error);const s=t.apply(e.message);return p(p({},s),{},{stack:(i=this.cr(e))!==null&&i!==void 0?i:s.stack,synthetic:!0})}ur(e){return Y(e.message)&&e.message.length>0}cr(e){var t,i;const s=e,r=(t=s.lineno)!==null&&t!==void 0?t:0,n=(i=s.colno)!==null&&i!==void 0?i:0;if(Y(s.filename)&&s.filename.length!==0&&r!==0)return`Error 3 at ${s.filename}:${r}:${n}`}};const Ih=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;var Ph=class{match(e){return typeof e=="string"}coerce(e,t){var i;const[s,r]=this.getInfos(e);return{type:s??"Error",value:r??e,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}getInfos(e){let t="Error",i=e;const s=e.match(Ih);return s&&(t=s[1],i=s[2]),[t,i]}};const Oh=["fatal","error","warning","log","info","debug"];function nu(e,t=40){const i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(let s=i.length;s>0;s--){const r=i.slice(0,s).join(", ");if(t>=r.length)return s===i.length?r:r.length>t?`${r.slice(0,t)}...`:r}return""}var Ch=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var i,s;const r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(i=this.getStack(e))!==null&&i!==void 0?i:(s=t.syntheticException)===null||s===void 0?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(An(e))return e.constructor.name;const t="name"in e?e.name:void 0;return Y(t)&&!Ci(t)?t:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let i=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(i+=` with message: '${e.message}'`),i}if("message"in e&&typeof e.message=="string")return e.message;const t=this.getObjectClassName(e);return`${t&&t!=="Object"?`'${t}'`:"Object"} captured as exception with keys: ${nu(e)}`}isSeverityLevel(e){return Y(e)&&!Ci(e)&&Oh.indexOf(e)>=0}getStack(e){try{return Y(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:Y(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const i=e[t];if(pi(i))return i}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},Fh=class{match(e){return An(e)}coerce(e,t){var i;const s=e.constructor.name;return{type:s,value:`${s} captured as exception with keys: ${nu(e)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}},Mh=class{match(e){return wl(e)}coerce(e,t){var i;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}}},Ah=class{match(e){return Es(e,"PromiseRejectionEvent")||this.isCu
3stomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!An(e))return!1;try{const t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var i;const s=this.getUnhandledRejectionReason(e);return wl(s)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(s)}`,stack:(i=t.syntheticException)===null||i===void 0?void 0:i.stack,synthetic:!0}:t.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}};const Ps="$message",Os="$timestamp",Th=new Set([Ps,Os]),fr={enabled:!0,max_bytes:32768};function Cs(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:fr.enabled,max_bytes:Lh(e.max_bytes,fr.max_bytes)}:p({},fr)}var Rh=class{constructor(e){this.ns=[],this.ss=0,this.Ir=Cs(e)}setConfig(e){this.Ir=Cs(e),this.rs()}add(e){const t=(function(s){let r;try{r=yl(s)}catch{return}try{const n=JSON.parse(r);if(!Q(n))return;const o=n,a=o[Ps],l=o[Os];return!Y(a)||a.trim().length===0||!Y(l)&&!ge(l)?void 0:{step:o,json:r}}catch{return}})(e);if(!t)return;const i=(function(s){if("u">typeof TextEncoder)return new TextEncoder().encode(s).length;const r=encodeURIComponent(s);let n=0;for(let o=0;r.length>o;o++)r[o]==="%"?(n+=1,o+=2):n+=1;return n})(t.json);i>this.Ir.max_bytes||(this.ns.push({step:t.step,bytes:i}),this.ss+=i,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Ir.max_bytes&&this.ns.length>0;){const e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function Lh(e,t){if(!ge(e)||e===1/0||e===-1/0)return t;const i=Math.floor(e);return 0>i?t:i}const Lo=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function Do(e){return typeof e=="string"||e}function No(e){return typeof e=="string"?e:void 0}const Dh=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],ou="NativeGzipValidationError",en=e=>e.length>=2&&e[0]===31&&e[1]===139,jo=(e,t)=>e===Gr.GZipJS||t===Gr.GZipJS||t==="gzip",qo=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError";let _i;const os=e=>{throw Ql(ou,`Native gzip produced invalid output: ${e}`)},Nh=(Bo=ue(function*(e,t){18>e.size&&os("too-short");const i=new Uint8Array(yield e.slice(0,10).arrayBuffer());en(i)&&i[2]===8||os("invalid-header");const s=new DataView(yield e.slice(e.size-8).arrayBuffer());s.getUint32(0,!0)!==(n=>{const o=(()=>{if(_i)return _i;_i=[];for(let l=0;256>l;l++){let u=l;for(let d=0;8>d;d++)u=1&u?3988292384^u>>>1:u>>>1;_i[l]=u>>>0}return _i})();let a=4294967295;for(let l=0;n.length>l;l++)a=o[255&(a^n[l])]^a>>>8;return(4294967295^a)>>>0})(t)&&os("invalid-crc");const r=t.length>>>0;s.getUint32(4,!0)!==r&&os("invalid-size")}),function(e,t){return Bo.apply(this,arguments)});var Bo;function tn(){return tn=ue(function*(e,t=!0,i){try{const r=new TextEncoder().encode(e),n=new globalThis.CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(r).then(()=>o.close()).catch((s=ue(function*(d){try{yield o.abort(d)}catch{}throw d}),function(d){return s.apply(this,arguments)})),l=new Response(n.readable).blob(),[u]=yield Promise.all([l,a]);return yield Nh(u,r),u}catch(r){if(i?.rethrow)throw r;return t&&console.error("Failed to gzip compress data",r),null}var s}),tn.apply(this,arguments)}function au(e,t){if(e==null)return{};var i,s,r=(function(o,a){if(o==null)return{};var l={};for(var u in o)if({}.hasOwnProperty.call(o,u)){if(a.includes(u))continue;l[u]=o[u]}return l})(e,t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);for(s=0;n.length>s;s++)t.includes(i=n[s])||{}.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}const jh={}.propertyIsEnumerable;function Fs(e,t){try{return lu(e,t,{ancestors:new WeakSet,remainingNodes:1e4}
3,0)}catch{return[]}}function Ln(e,t,i,s){if(0>=i.remainingNodes)return{stringValue:Zr};if(i.remainingNodes--,Pe(e))return{boolValue:e};if(typeof e=="bigint")return(function(r,n){const o=r.toString(),a=BigInt("9223372036854775808");return r>=a||-a>r?(n?.debug(`Attribute ${o} is outside the int64 range; encoding it as a string`),{stringValue:o}):{intValue:o}})(e,t);if(typeof e=="number"){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};const r=BigInt(e).toString();return e>=9223372036854776e3||-9223372036854776e3>e?(t?.debug(`Attribute ${r} is outside the int64 range; encoding it as a string`),{stringValue:r}):{intValue:r}}return{doubleValue:e}}if(typeof e=="string")return{stringValue:ti(e)};if(typeof e=="function")return{stringValue:"[Function]"};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(i.ancestors.has(e))return{stringValue:"[Circular]"};if(s>=20)return{stringValue:Zr};if(e instanceof Date){const r=e.getTime(),n=Number.isFinite(r)?e.toISOString():String(e);return{stringValue:typeof n=="string"?ti(n):String(n)}}i.ancestors.add(e);try{try{const r=e.toJSON;if(typeof r=="function")return Ln(r.call(e),t,i,s+1)}catch{}return j(e)?{arrayValue:{values:qh(e,t,i,s+1)}}:{kvlistValue:{values:lu(e,t,i,s+1)}}}finally{i.ancestors.delete(e)}}return{stringValue:ti(String(e))}}function qh(e,t,i,s){const r=[],n=Math.min(e.length,1e3);let o=0;for(;n>o&&i.remainingNodes>0;o++)try{const a=o in e?e[o]:void 0;if(z(a))continue;r.push(Ln(a,t,i,s))}catch{r.push({stringValue:Zi})}return e.length>o&&r.push({stringValue:Zr}),r}function lu(e,t,i,s){const r=[];for(const n in e)if(jh.call(e,n)){if(!n){t?.debug("Dropping an attribute with an empty key");continue}if(r.length>=1e3||0>=i.remainingNodes){t?.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=e[n];if(ve(o)||E(o))continue;r.push({key:ti(n),value:Ln(o,t,i,s)})}catch{r.push({key:ti(n),value:{stringValue:Zi}})}}return r}function uu(e,t,i){return p(p(p(p({},Yl({},e.resourceAttributes)),{},{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment}),e.serviceVersion&&{"service.version":e.serviceVersion}),{},{"telemetry.sdk.name":t,"telemetry.sdk.version":i})}const Bh=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function cu(e,t){const i=Yl({},e),s={};for(const r of Bh)({}).hasOwnProperty.call(i,r)&&(s[r]=i[r],delete i[r]);return[...Fs(i,t),...Fs(s,t)]}const Ho={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"},du={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},Hh=du.info;function Vh(e){try{return ti(String(e))}catch{return Zi}}function Uh(e,t,i,s){const r=e.level||"info",{text:n,number:o}=du[r]||Hh,a=(function(h=Date.now()){return String(h)+"000000"})(ge(s)?s:void 0),l={};t.distinctId&&(l.posthogDistinctId=t.distinctId),t.sessionId&&(l.sessionId=t.sessionId),t.windowId&&(l["window.id"]=t.windowId),z(t.sessionStartTimestamp)||(l.sessionStartTimestamp=String(t.sessionStartTimestamp)),z(t.lastActivityTimestamp)||(l.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(l["url.full"]=t.currentUrl),t.screenName&&(l["screen.name"]=t.screenName),t.appState&&(l["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(l.feature_flags=t.activeFeatureFlags);const u=p({},l),d=e.attributes;if(d){let h=[];try{h=Object.keys(d)}catch{h=[]}for(const f of h){let _;try{_=d[f]}catch{_=Zi}Object.defineProperty(u,f,{value:_,enumerable:!0,writable:!0,configurable:!0})}}const c={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:n,body:{stringValue:Vh(e.body)},attributes:Fs(u,i)};return e.trace_id&&(c.traceId=e.trace_id),e.span_id&&(c.spanId=e.span_id),E(e.trace_flags)||(c.flags=e.trace_flags),c}function hu(e,t,i){return uu(e,t,i)}function fu(e,t,i,s){return{resourceLogs:[{resource:{attributes:cu(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}var pu=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.hs}arm(e){this.clear(),this.us=Date.now()+e,this.hs=eu(()=>{this.hs=void 0,this.ls()},e)}armNoEarlierThan(e){this.hs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function vu(){return .75+.5*Math.random()}function gu(e,t,i,s){const r=Math.min(Math.max(0,t-1),6),n=e*Math.pow(2,r);return Math.round(Math.min(n,Math.max(s,e))*i)}var zh=class{constructor(e,t,i,s,r,n=()=>Promise.resolve(),o){var a;this._instance=e,this.Ir=t,this.$=i,this.cs=s,this.ds=r,this.vs=n,this.fs=o,this.ps=new pu(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new Zl,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Is=t.maxBufferSize,this.Ts=Math.max((a=t.maxQueueSize)!==null&&a!==void 0?a:t.maxBufferSize,t.maxBufferSize),this.Ms=t.flushIntervalMs,this.Es=t.maxBatchRecordsPerPost,this.Ps=t.rateCapWindowMs,this.Rs=t.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(ze.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Ir.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,t){var i;if(this._instance.isDisabled||this._instance.optedOut||!e?.body)return;const s=this.Os(e);if(s===null)return;if(!s.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const r={record:Uh(s,(i=t?.context)!==null&&i!==void 0?i:this.cs(),this.$,t?.occurredAtMs)};this.ds(()=>this.Ls(r))}Os(e){const t=this.Ir.beforeSend;if(!t)return e;const i=j(t)?t:[t];let s=e;for(const r of i)try{const n=r(s);if(!n)return this.$.info("Log was rejected in beforeSend function"),null;s=n}catch(n){return this.$.error("Error in beforeSend function for log:",n),null}return s}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var e=this;return ue(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return ue(function*(){var t;e.ps.clear();let i=(t=e._instance.getPersistedProperty(ze.LogsQueue))!==null&&t!==void 0?t:[];if(i.length===0)return;const s=i.length;let r=0;for(;i.length>0&&s>r;){var n,o;const a=e._s;e.bs=0;const l=Math.min(i.length,e.Es),u=i.slice(0,l),d=fu(u.map(h=>h.record),e.qs(),(n=e.fs)!==null&&n!==void 0?n:e._instance.getLibraryId(),e._instance.getLibraryVersion()),c=yield e._instance.js(d);if(e._s!==a)return;if(c.kind==="too-large"&&u.length>1)e.Es=Math.max(1,Math.floor(u.length/2)),e.$.warn(`Logs batch of size ${u.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(c),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),c.
3kind==="retry-later"||(c.kind==="too-large"?e.$.warn("Dropping a single log record with batch size 1 â the record is larger than the server cap and cannot be split further."):c.kind==="ok"&&e.Ir.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Ir.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(u.length),i=(o=e._instance.getPersistedProperty(ze.LogsQueue))!==null&&o!==void 0?o:[],r+=u.length,c.kind==="fatal"))throw c.error}})()}Bs(e){var t=this;return ue(function*(){var i;const s=Math.max(0,e-t.bs),r=(i=t._instance.getPersistedProperty(ze.LogsQueue))!==null&&i!==void 0?i:[];t._instance.setPersistedProperty(ze.LogsQueue,r.slice(s)),yield t.vs()})()}qs(){return hu(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;const i=(t=this._instance.getPersistedProperty(ze.LogsQueue))!==null&&t!==void 0?t:[];this.Ts>i.length||(i.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(ze.LogsQueue,i),this.Is>i.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(gu(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(ze.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return ue(function*(){t.ps.clear();const i=t.flush().catch(()=>{});e!==void 0?yield Mo(i,e):yield i})()}flushWithTimeout(e){var t=this;return ue(function*(){const i=t.flush();yield Mo(i,e,()=>{i.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=vu(),this.$.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}};const pr=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Vo(e){return String(e)+"000000"}function Uo(e,t,i,s){let r="";return s&&(r=Object.keys(s).sort().map(n=>`${JSON.stringify(n)}:${JSON.stringify(s[n])}`).join(",")),`${e}\0${t}\0${i??""}\0${r}`}var Wh=class{constructor(e,t,i){this._instance=e,this.Ir=t,this.$=i,this.zs=new Map,this.ps=new pu(()=>this.flush().catch(s=>{this.$.error("Metrics flush failed:",s)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new Zl,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,i){this.Zs({name:e,type:"count",value:t,unit:i?.unit,attributes:i?.attributes})}gauge(e,t,i){this.Zs({name:e,type:"gauge",value:t,unit:i?.unit,attributes:i?.attributes})}histogram(e,t,i){this.Zs({name:e,type:"histogram",value:t,unit:i?.unit,attributes:i?.attributes})}flush(){var e=this;const t=this.ys,i=(function(){var s=ue(function*(){t&&(yield t.catch(()=>{})),yield e.Qs()});return function(){return s.apply(this,arguments)}})()().finally(()=>{this.ys===i&&(this.ys=null)});return this.ys=i,i}drainWindow(){if(this.zs.size===0)return null;const e=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(e){if(this._instance.isDisabled||this._instance.optedOut)return;const t=this.Os(e);if(t===null)return;if(!t.name||typeof t.name!="string")return void this.$.warn("Dropping metric with empty name");if(typeof t.value!="number"||!Number.isFinite(t.value))return void this.$.warn(`Dropping metric '${t.name}': value must be a finite number`);if(t.type==="count"&&0>t.value)return void this.$.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let i,s;try{i=t.attributes?p({},t.attributes):void 0,s=Uo(t.type,t.name,t.unit,i)}catch(o){return void this.$.warn(`Dropping metric '${t.name}': attributes could not be serialized`,o)}let r=this.zs.get(s);if(!r){if(!this.Ks())return;r={name:t.name,type:t.type,unit:t.unit,attributes:i,windowStartMs:Date.now()},this.zs.set(s,r)}const n=this.Ws.get(t.name);n===void 0?this.Ws.set(t.name,t.type):n===t.type||this.Vs.has(t.name)||(this.Vs.add(t.name),this.$.warn(`Metric name '${t.name}' is already used as a ${n}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(r,t.value),this.Fs()}Ks(){return this.Ir.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Ir.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(e,t){switch(e.type){case"count":var i;e.total=((i=e.total)!==null&&i!==void 0?i:0)+t;break;case"gauge":e.last=t;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(pr.length+1).fill(0)});const s=e.hist;s.count+=1,s.sum+=t,s.min=Math.min(s.min,t),s.max=Math.max(s.max,t),s.bucketCounts[(function(r,n){for(let o=0;n.length>o;o++)if(n[o]>=r)return o;return n.length})(t,pr)]+=1;break}}}Os(e){const t=this.Ir.beforeSend;if(!t)return e;const i=j(t)?t:[t];let s=e;for(const r of i)try{const n=r(s);if(!n)return this.$.info("Metric was rejected in beforeSend function"),null;s=n}catch(n){return this.$.error("Error in beforeSend function for metric:",n),null}return s}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(gu(this.Ir.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return ue(function*(){if(e.ps.clear(),e.zs.size===0)return;const t=e.zs;e.zs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;const i=e.Gs,s=yield e._instance.Ys(e.Js(t));if(i===e.Gs)switch(e.ws.record(s),s.kind==="retry-later"?(e.ks++,e.Ss=vu()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),s.kind){case"ok":return;case"retry-later":return e.lo(t),void e.ps.armNoEarlierThan(e.Hs());case"too-large":return void e.$.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.$.error("Failed to send metrics batch:",s.error)}})()}Js(e){return t=this.uo(e),i=(function(n,o,a){return uu(n,o,a)})(this.Ir,this._instance.getLibraryId(),this._instance.getLibraryVersion()),s=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:cu(i)},scopeMetrics:[{scope:{name:s,version:r},metrics:t}]}]};var t,i,s,r}uo(e){const t=Vo(Date.now()),i=new Map;for(const o of e.values()){var s;const a=Uo(o.type,o.name,o.unit,void 0);let l=i.get(a);l||(l=p({name:o.name},o.unit&&{unit:o.unit}),o.type==="count"?l.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:o.type==="gauge"?l.gauge={dataPoints:[]}:l.histogram={aggregationTemporality:1,dataPoints:[]},i.set(a,l));const u=Fs((s=o.attributes)!==null&&s!==void 0?s:{},this.$),d=Vo(o.windowStartMs);if(o.type==="count"){var r;const c={attributes:u,startTimeUnixNano:d,timeUnixNano:t,asDouble:(r=o.total)!==null&&r!==void 0?r:0};l.sum.dataPoints.push(c)}else if(o.type==="gauge"){var n;const c={attributes:u,timeUnixNano:t,asDouble:(n=o.last)!==null&&n!==void 0?n:0};l.gauge.dataPoints.push(c)}else o.hist&&l.histogram.dataPoints.push({attributes:u,startTimeUnixNano:d,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:pr})}return Array.from(i.values())}lo(e){for(const[s,r]of e){const n=this.zs.get(s);if(n)switch(n.windowStartMs=Math.min(n.windowStartMs,r.windowStartMs),n.type){case"count":var t,i;n.total=((t=n.total)!==null&&t!==void 0?t:0)+((i=r.total)!==null&&i!==void 0?i:0);break;case"gauge":break;case"histogram":if(r.hist)if(n.hist){n.hist.count+=r.hist.count,n.hist.sum+=r.hist.sum,n.hist.min=Math.min(n.hist.min,r.hist.min),n.hist.max=Math.max(n.hist.max,r.hist.max);for(let o=0;n.hist.bucketCounts.length>o;o++)n.hist.bucketCounts[o]+=r.hist.bucketCounts[o]}else n.hist=r.hist}else this.Ks()&&this.zs.set(s,r)}}};const _u=(e,{debugEnabled:t}={})=>
3{const i={N(s,...r){w&&(st.DEBUG||w.POSTHOG_DEBUG||t)&&!E(w.console)&&w.console&&("__rrweb_original__"in w.console[s]?w.console[s].__rrweb_original__:w.console[s])(e,...r)},debug(...s){i.N("debug",...s)},info(...s){i.N("log",...s)},warn(...s){i.N("warn",...s)},error(...s){i.N("error",...s)},critical(...s){console.error(e,...s)},uninitializedWarning(s){i.error(`You must initialize PostHog before calling ${s}`)},createLogger:(s,r)=>_u(`${e} ${s}`,r)};return i},F=_u("[PostHog.js]"),pe=F.createLogger,Gh=pe("[ExternalScriptsLoader]"),Ms=e=>{const t=I?.querySelectorAll("script");if(t){for(let i=0;t.length>i;i++)if(t[i].src===e||t[i].getAttribute("src")===e)return t[i]}},Et=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return Gh.warn(`${t} was requested but loading of external scripts is disabled.`),i("Loading of external scripts is disabled");const s=Ms(t);if(s){if(s.__posthog_loading_callback_fired)return i();const n=s.__posthog_loading_error;return n?i(n):(s.addEventListener("load",o=>{s.__posthog_loading_callback_fired=!0,i(void 0,o)}),void s.addEventListener("error",o=>{s.__posthog_loading_error=o,i(o)}))}const r=()=>{if(!I)return i("document not found");if(Ms(t))return Et(e,t,i);let n=I.createElement("script");if(n.type="text/javascript",n.crossOrigin="anonymous",n.src=t,n.onload=a=>{n.__posthog_loading_callback_fired=!0,i(void 0,a)},n.onerror=a=>{n.__posthog_loading_error=a,i(a)},e.config.prepare_external_dependency_script&&(n=e.config.prepare_external_dependency_script(n)),!n)return i("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")I.head.appendChild(n);else{const a=I.querySelectorAll("body > script");var o;a.length>0?(o=a[0].parentNode)===null||o===void 0||o.insertBefore(n,a[0]):I.body.appendChild(n)}};I?.body?r():I?.addEventListener("DOMContentLoaded",r)},vr={},zo=(e,t)=>{let i=`/static/${t}.js?v=${e.version}`;return t==="toolbar"&&(i=`${i}&t=${Math.floor(Date.now()/3e5)*3e5}`),e.requestRouter.endpointFor("assets",i)};L.__PosthogExtensions__=L.__PosthogExtensions__||{},L.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if(t==="remote-config"){const r=e.requestRouter.endpointFor("assets",`/array/${e.config.token}/config.js`);return void Et(e,r,i)}const s=e.config.strict_script_versioning;if(s){const r=e.requestRouter.endpointFor("assets",`/static/${e.version}/${t}.js`),n=vr[r];if(s==="fallback"&&n){if(Ms(n))return void Et(e,n,i);delete vr[r]}return void Et(e,r,s==="fallback"?(o,a)=>{if(o)if(typeof o=="string")i(o);else{var l;const u=zo(e,t);vr[r]=u;const d=Ms(r);d==null||(l=d.parentNode)===null||l===void 0||l.removeChild(d),Et(e,u,i)}else i(void 0,a)}:i)}Et(e,zo(e,t),i)},L.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{const s=e.requestRouter.endpointFor("api",t);Et(e,s,i)},st.DEBUG=!1,st.LIB_VERSION="1.433.7",st.LIB_NAME="web";var ye=st;const Jh="$people_distinct_id",Ne="distinct_id",Dn="$device_id",gr="$device_model",As="__alias",Kh="__cmpns",Wo="$fbc",ii="$fbc_persistence",Go="$fbp",Mi="$fbp_persistence",sn="__timers",mu="$autocapture_disabled_server_side",rn="$heatmaps_enabled_server_side",nn="$exception_capture_enabled_server_side",yu="$error_tracking_suppression_rules",on="$error_tracking_capture_extension_exceptions",an="$web_vitals_enabled_server_side",Nn="$dead_clicks_enabled_server_side",jn="$product_tours_enabled_server_side",bu="$logs_capture_enabled_server_side",wu="$web_vitals_allowed_metrics",Ai="$session_recording_remote_config",Xh="$session_recording_enabled_server_side",Yh="$replay_sample_rate",Zh="$replay_override_sampling",Qh="$replay_override_linked_flag",ef="$replay_override_url_trigger",tf="$replay_override_event_trigger",Gt="$sesid",$u="$session_is_sampled",sf="$session_past_minimum_duration",rf="$session_recording_url_trigger_activated_session",nf="$session_recording_event_trigger_activated_session",of="$debug_first_full_snapshot_timestamp",af="$sess_rec_flush_size",je="$enabled_feature_flags",Qe="$active_feature_flags",ln="$early_access_features",Ft="$feature_flag_details",ht="$feature_flag_payloads",Mt="$feature_flag_request_id",Ti="$minimal_flag_called_events",Ue="$override_feature_flags",kt="$override_feature_flag_payloads",ft="$stored_person_properties",pt="$stored_group_properties",xu="$groups",un="$surveys",Ts="$surveys_loaded_at",Eu="$surveys_activated",ku="$surveys_activated_session",Su="$surveys_activated_timestamps",cn="ph_product_tours",lf="$product_tours_activated",uf="$product_tours_activated_session",cf="$conversations_widget_session_id",df="$conversations_ticket_id",hf="$conversations_widget_state",ff="$conversations_user_traits",vt="$flag_call_reported",Ii="$flag_call_reported_session_id",Ui="$feature_flag_errors",_t="$feature_flag_evaluated_at",Ie="$user_state",dn="$client_session_props",pf="$capture_rate_limit",Iu="$initial_campaign_params",Pu="$initial_referrer_info",Jt="$initial_person_info",qn="$epp",_r="$posthog_cookieless",Ou="$cookieless_mode",Cu="$sdk_debug_extensions_init_method",Fu="$sdk_debug_extensions_init_time_ms",Mu="$sdk_debug_recording_script_not_loaded",vf="$sdk_debug_replay_event_trigger_status",gf="$sdk_debug_replay_linked_flag_trigger_status",_f="$sdk_debug_replay_matched_recording_trigger_groups",mf="$sdk_debug_replay_pen
3ding_trigger_conditions",yf="$sdk_debug_replay_remote_trigger_matching_config",bf="$sdk_debug_replay_trigger_groups_count",wf="$sdk_debug_replay_url_trigger_status",$f="$session_recording_start_reason",Bn="PostHog loadExternalDependency extension not found.",et="anonymous",ms="identified",Au="identified_only",zi="visibilitychange",Rs="beforeunload",Hn="$pageview",Jo="$pageleave",Tu="$identify",Ko="$groupidentify";function Kt(e,t){j(e)&&e.forEach(t)}function ne(e,t){if(!z(e))if(j(e))e.forEach(t);else if((i=>i instanceof FormData)(e))e.forEach((i,s)=>t(i,s));else for(const i in e)Mn.call(e,i)&&t(e[i],i)}const le=function(e,...t){for(const i of t)for(const s in i)i[s]!==void 0&&(e[s]=i[s]);return e};function ys(e){const t=Object.keys(e);let i=t.length;const s=new Array(i);for(;i--;)s[i]=[t[i],e[t[i]]];return s}const xf=function(e){return function(...t){try{return e.apply(this,t)}catch(i){F.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),F.critical(i)}}},Vn=function(e){const t={};return ne(e,function(i,s){(Y(i)&&i.length>0||ge(i))&&(t[s]=i)}),t};function Ru(e){const t=p({},e);for(const i of["name","message","stack","cause","errors"])try{i in e&&(t[i]=e[i])}catch{}return t}const Ef=["herokuapp.com","vercel.app","netlify.app"];function kf(e){const t=e?.hostname;if(!Y(t))return!1;const i=t.split(".").slice(-2).join(".");for(const s of Ef)if(i===s)return!1;return!0}function se(e,t,i,s){const{capture:r=!1,passive:n=!0}=s??{};e?.addEventListener(t,i,{capture:r,passive:n})}function hn(e){return e.name==="ph_toolbar_internal"}const Ls=e=>{if(I){try{const t=e+"=",i=I.cookie.split(";").filter(s=>s.length);for(let s=0;i.length>s;s++){let r=i[s];for(;r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(t)===0)return decodeURIComponent(r.substring(t.length,r.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return ge(e)&&isFinite(e)&&Math.floor(e)===e});var Sf=class fn{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,s,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||!Number.isInteger(r)||0>t||0>i||0>s||0>r||t>0xffffffffffff||i>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");const n=new Uint8Array(16);return n[0]=t/Math.pow(2,40),n[1]=t/Math.pow(2,32),n[2]=t/Math.pow(2,24),n[3]=t/Math.pow(2,16),n[4]=t/256,n[5]=t,n[6]=112|i>>>8,n[7]=i,n[8]=128|s>>>24,n[9]=s>
3>>16,n[10]=s>>>8,n[11]=s,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new fn(n)}toString(){let t="";for(let i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),i!==3&&i!==5&&i!==7&&i!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new fn(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let i=0;16>i;i++){const s=this.bytes[i]-t.bytes[i];if(s!==0)return Math.sign(s)}return 0}},If=class{generate(){const e=this.generateOrAbort();if(!E(e))return e;{this.Ct=0;const t=this.generateOrAbort();if(E(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const e=(()=>{const t=Date.now();return ge(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return Sf.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new Pf}};let Lu=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};w&&!E(w.crypto)&&crypto.getRandomValues&&(Lu=e=>crypto.getRandomValues(e));var Pf=class{nextUint32(){return this.Rt.length>this.$t||(Lu(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}};let Xo;const qe=()=>Of().toString(),Of=()=>(Xo||(Xo=new If)).generate();let mi="";const Cf=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;let Nt=null;const de={Et(){if(!ve(Nt))return Nt;if(Nt=!1,I)try{const e=`__ph_cookie_support_${qe()}`;de.At(e,"xyz"),Nt=Ls(e)==='"xyz"',de.Lt(e)}catch{Nt=!1}return Nt},Pt(e){F.error("cookieStore error: "+e)},Ot:Ls,Dt(e){let t;try{t=JSON.parse(de.Ot(e))||{}}catch{}return t},At(e,t,i,s,r){if(!I)return!1;try{let n="",o="";const a=(function(u,d){if(d){let c=(function(h,f=I){if(mi)return mi;if(!f||["localhost","127.0.0.1"].includes(h))return"";const _=h.split(".");let m=Math.min(_.length,8);const v="dmn_chk_"+qe();for(;!mi&&m--;){const g=_.slice(m).join("."),y=v+"=1;domain=."+g+";path=/";f.cookie=y+";max-age=3",f.cookie.includes(v)&&(f.cookie=y+";max-age=0",mi=g)}return mi})(u);if(!c){const h=(f=>{const _=f.match(Cf);return _?_[0]:""})(u);h!==c&&F.info("Warning: cookie subdomain discovery mismatch",h,c),c=h}return c?"; domain=."+c:""}return""})(I.location.hostname,s);if(i){const u=new Date;u.setTime(u.getTime()+864e5*i),n="; expires="+u.toUTCString()}r&&(o="; secure");const l=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&F.warn("cookieStore warning: large cookie, len="+l.length),I.cookie=l,!0}catch{return!1}},Lt(e,t){if(I?.cookie)try{de.At(e,"",-1,t)}catch{return}}};let mr=null;const te={Et(){if(!ve(mr))return mr;let e=!0;if(E(w))e=!1;else try{const t="__mplssupport__";te.At(t,"xyz"),te.Ot(t)!=='"xyz"'&&(e=!1),te.Lt(t)}catch{e=!1}return e||F.error("localStorage unsupported; falling back to cookie store"),mr=e,e},Pt(e){F.error("localStorage error: "+e)},Ot(e){try{return w?.localStorage.getItem(e)}catch(t){te.Pt(t)}return null},Dt(e){try{return JSON.parse(te.Ot(e))||{}}catch{}return null},At(e,t){try{return w?.localStorage.setItem(e,JSON.stringify(t)),!0}catch(i){te.Pt(i)}return!1},Lt(e){try{w?.localStorage.removeItem(e)}catch(t){te.Pt(t)}}},yr=[ft,Qe,je,Ft,ht,Mt,_t,Ui,vt],St=[Dn,Ne,Gt,$u,qn,Jt,ii,Ie],Ds=e=>e+"_cpm",Ff=["__proto__","constructor","prototype"],br=e=>{if(!Q(e))return{};const t={};return Object.keys(e).forEach(i=>{Ff.indexOf(i)===-1&&(t[i]=e[i])}),t},wr=(e,t=[])=>{const i={};return[...St,...t].forEach(s=>{const r=e[s];E(r)||ve(r)||r===""||(i[s]=r)}),i},Du=e=>{let t=5381,i=2166136261;for(let s=0;e.length>s;s++){const r=e.charCodeAt(s);t=33*t^r,i=Math.imul(i^r,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(i>>>0).toString(36)},Yo=(e,t)=>({p:t,f:Du(JSON.stringify(e))}),Zo=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const i=de.Dt(Ds(e)),s=i?.f===Du(t)&&j(i.p);return{properties:s?i.p:[],isValid:s}}catch{return{properties:[],isValid:!1}}},$r=(e,t)=>t+"|"+(de.Ot(Ds(e))||""),jt={},pn={Et:()=>!0,Pt(e){F.error("memoryStorage error: "+e)},Ot:e=>e in jt?jt[e]:null,Dt:e=>e in jt?jt[e]:null,At:(e,t)=>(jt[e]=t,!0),Lt(e){delete jt[e]}};let bt=null;const ae={Et(){if(!ve(bt))return bt;if(bt=!0,E(w))bt=!1;else try{const e="__support__";ae.At(e,"xyz"),ae.Ot(e)!=='"xyz"'&&(bt=!1),ae.Lt(e)}catch{bt=!1}return bt},Pt(e){F.error("sessionStorage error: ",e)},Ot(e){try{return w?.sessionStorage.getItem(e)}catch(t){ae.Pt(t)}return null},Dt(e){try{return JSON.parse(ae.Ot(e))||null}catch{}return null},At(e,t){try{return w?.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(i){ae.Pt(i)}return!1},Lt(e){try{w?.sessionStorage.removeItem(e)}catch(t){ae.Pt(t)}}};var Mf=class{constructor(e){this._instance=e}get Ir(){return this._instance.config}get consent(){return this.Ao()?0:this.Fo}isOptedOut(){return this.Ir.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Ir.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Ir.opt_out_capturing_by_default}optInOut(e){this.Oo.At(this.Do,e?1:0,this.Ir.cookie_expiration,this.Ir.cross_subdomain_cookie,this.Ir.secure_cookie)}reset(){this.Oo.Lt(this.Do,this.Ir.cross_subdomain_cookie)}get Do(){const{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;
3return i||(t?t+e:"__ph_opt_in_out_"+e)}get Fo(){const e=this.Oo.Ot(this.Do);return ar(e)?1:q(Kd,e)?0:-1}get Oo(){const e=this.Ir.opt_out_capturing_persistence_type,t=e==="localStorage"?te:de,i=t.Et()?t:pn;if(!this.Lo||this.Lo!==i){this.Lo=i;const s=e==="localStorage"?de:te;s.Ot(this.Do)&&(this.Lo.Ot(this.Do)||this.optInOut(ar(s.Ot(this.Do))),s.Lt(this.Do,this.Ir.cross_subdomain_cookie))}return this.Lo}Ao(){return!!this.Ir.respect_dnt&&[we?.doNotTrack,we?.msDoNotTrack,L.doNotTrack,we?.globalPrivacyControl].some(e=>ar(e))}};function Nu(e,t){var i;const s=e==null||(i=e.config)===null||i===void 0?void 0:i.get_current_url;if(!be(s))return t;try{const r=s(t);return Y(r)&&r?r:t}catch(r){return F.error("Error in get_current_url, falling back to window.location.href",r),t}}function Qo(e){var t;return e instanceof Element&&(e.id==="__POSTHOG_TOOLBAR__"||!!(!((t=e.closest)===null||t===void 0)&&t.call(e,".toolbar-global-fade-container")))}function Je(e){return!!e&&e.nodeType===1}function xe(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function ju(e){return!!e&&e.nodeType===3}function Un(e){return!!e&&e.nodeType===11&&Je(e.host)}function zn(e){return e?Ks(e).split(/\s+/):[]}function ea(e,t){const i=(function(s){var r;const n=w==null||(r=w.location)===null||r===void 0?void 0:r.href;return E(n)?void 0:Nu(s,n)})(t);return!!(i&&e&&e.some(s=>i.match(s)))}function li(e){let t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return zn(t)}function qu(e){return z(e)?null:Ks(e).split(/(\s+)/).filter(t=>Li(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Wi(e){let t="";return si(e)&&!Gi(e)&&e.childNodes&&e.childNodes.length&&ne(e.childNodes,function(i){var s;ju(i)&&i.textContent&&(t+=(s=qu(i.textContent))!==null&&s!==void 0?s:"")}),Ks(t)}function Ri(e){var t;return E(e.target)?e.srcElement||null:!((t=e.target)===null||t===void 0)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}const Wn=["a","button","form","input","select","textarea","label"];function vn(e,t){const i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!i&&i.call(e,t)}catch{return!1}}function gn(e,t){if(E(t))return!0;for(const i of e)if(t.some(s=>vn(i,s)))return!0;return!1}function Bu(e){const t=e.parentNode;return!(!t||!Je(t))&&t}const xr=[".ph-no-autocapture","[data-ph-no-autocapture]"],Hu=["next","previous","prev",">","<"],Af=[...Hu,"+","-","â","â"],ta=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,ia=[".ph-no-rageclick",".ph-no-capture"],Tf=["","text","search","email","password","url","tel","number"];function Vu(e,t){if(!w||Gn(e))return!1;let i,s,r;var n,o;if(Pe(t)?(i=!!t&&ia,s=void 0,r=!1):(i=(n=t?.css_selector_ignorelist)!==null&&n!==void 0?n:ia,s=t?.content_ignorelist,r=(o=t?.ignore_text_selection)!==null&&o!==void 0&&o),i===!1||r&&(function(l){return!(!l||!Je(l))&&(!!xe(l,"textarea")||(xe(l,"input")?q(Tf,(l.getAttribute("type")||"").toLowerCase()):(function(u){var d;if(u.isContentEditable)return!0;const c=(d=u.getAttribute)===null||d===void 0?void 0:d.call(u,"contenteditable");return c==="true"||c===""})(l)))})(e))return!1;const{targetElementList:a}=Uu(e,!1);return!(function(l,u){if(l===!1||E(l))return!1;let d;if(l===!0)d=Hu;else{if(!j(l))return!1;if(l.length>10)return F.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;d=l.map(c=>c.toLowerCase())}return u.some(({safeText:c,ariaLabel:h})=>d.some(f=>ta(c,f)||ta(h,f)))})(s,a.map(l=>{var u;return{safeText:Wi(l).toLowerCase(),ariaLabel:((u=l.getAttribute("aria-label"))===null||u===void 0?void 0:u.toLowerCase().trim())||""}}))&&!gn(a,i)}const Gn=e=>!e||xe(e,"html")||!Je(e),Uu=(e,t)=>{if(!w||Gn(e))return{parentIsUsefulElement:!1,targetElementList:[]};let i=!1;const s=[e];let r=e;for(;r.parentNode&&!xe(r,"body");){if(Un(r.parentNode)){s.push(r.parentNode.host),r=r.parentNode.host;continue}const n=Bu(r);if(!n)break;if(t||Wn.indexOf(n.tagName.toLowerCase())>-1)i=!0;else try{const o=w.getComputedStyle(n);o&&o.getPropertyValue("cursor")==="pointer"&&(i=!0)}catch{}s.push(n),r=n}return{parentIsUsefulElement:i,targetElementList:s}};function si(e){const t=new Set;let i=0;for(let n=e;n.parentNode&&!xe(n,"body");n=n.parentNode){if(i++>=1e3||t.has(n))return!1;t.add(n);const o=li(n);if(q(o,"ph-sensitive")||q(o,"ph-no-capture"))return!1}if(q(li(e),"ph-include"))return!0;const s=e.type||"";if(Y(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}
3const r=e.name||e.id||"";return!Y(r)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,""))}function Gi(e){return!!(xe(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||xe(e,"select")||xe(e,"textarea")||e.getAttribute("contenteditable")==="true")}const sa=new RegExp("^(?:(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}))$"),ra=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,Rf=[16,15,14,13],Lf=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),na=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),oa=/[0-9A-Za-z_]/;function Df(e){let t=0,i=!1;for(let s=e.length-1;s>=0;s--){let r=e.charCodeAt(s)-48;i&&(r*=2,r>9&&(r-=9)),t+=r,i=!i}return t%10==0}function Li(e,t=!0){return!(z(e)||Y(e)&&(e=Ks(e),(t?sa.test((e||"").replace(/[- ]/g,"")):(function(i){let s;for(ra.lastIndex=0;s=ra.exec(i);){const r=s[2];if(!r)continue;const n=r.replace(/[- ]/g,"");for(let o=0;n.length>o;o++)for(const a of Rf){const l=o+a;if(n.length>=l){const u=n.slice(o,l);if(sa.test(u)&&Df(u))return!0}}}return!1})(e))||(t?Lf.test(e):(function(i){let s;for(na.lastIndex=0;s=na.exec(i);){const r=s[1],n=s[3];if(!(r&&n&&oa.test(r)&&oa.test(n)))return!0}return!1})(e))))}function aa(e){let t=Wi(e);return t=`${t} ${zu(e)}`.trim(),Li(t)?t:""}function zu(e){let t="";return e&&e.childNodes&&e.childNodes.length&&ne(e.childNodes,function(i){var s;if(i&&((s=i.tagName)===null||s===void 0?void 0:s.toLowerCase())==="span")try{const r=Wi(i);t=`${t} ${r}`.trim(),i.childNodes&&i.childNodes.length&&(t=`${t} ${zu(i)}`.trim())}catch(r){F.error("[AutoCapture]",r)}}),t}function la(e){return e.replace(/"|\\"/g,'\\"')}function Nf(e){const t=e.attr__class;if(t)return j(t)?t:zn(t)}const as=pe("[Dead Clicks]"),jf=()=>!0,qf=e=>{var t;const i=!!(!((t=e.instance.persistence)===null||t===void 0)&&t.get_property(Nn)),s=e.instance.config.capture_dead_clicks;return Pe(s)?s:!!Q(s)||i};var ua=class{get lazyLoadedDeadClicksAutocapture(){return this.No}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Nn]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.qo(()=>{this.jo()}):this.stop()}qo(e){var t,i,s;!((t=L.__PosthogExtensions__)===null||t===void 0)&&t.initDeadClicksAutocapture?e():(i=L.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this.instance,"dead-clicks-autocapture",r=>{r?as.error("failed to load script",r):e()})}jo(){var e;if(I){if(!this.No&&(!((e=L.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const t=Q(this.instance.config.capture_dead_clicks)?p({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.No=L.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.No.start(I),as.info("starting...")}}else as.error("`document` not found. Cannot start.")}stop(){this.No&&(this.No.stop(),this.No=void 0,as.info("stopping..."))}};const yi=pe("[SegmentIntegration]");function ca(e,t,i=!0){const s=e.config.segment;if(!s)return t();const{analytics:r,filterProperties:n}=(a=>be(a.register))(o=s)?{analytics:o}:o;var o;(function(a,l,u,d){const c=f=>{const _=()=>f.anonymousId()||qe();a.config.get_device_id=_,d&&f.id()&&(a.register({distinct_id:f.id(),$device_id:_()}),a.persistence.set_property(Ie,ms)),u(d?void 0:f.anonymousId()||void 0)},h=l.user();"then"in h&&be(h.then)?h.then(c):c(h)})(e,r,a=>{r.register(((l,u,{filterProperties:d}={})=>{typeof Promise<"u"&&Promise.resolve||yi.warn("This browser does not have Promise support, and can not use the segment integration");const c=(h,f)=>{if(!f)return h;const _=!!u&&h.event.anonymousId===u&&!h.event.userId;_||h.event.userId||h.event.anonymousId===l.get_distinct_id()||(yi.info("No userId set, resetting PostHog"),l.reset()),_||(u=void 0),h.event.userId&&h.event.userId!==l.get_distinct_id()&&(yi.info("UserId set, identifying with PostHog"),l.identify(h.event.userId)
3);let m=l.calculateEventProperties(f,h.event.properties);if(!z(d)){const v=h.event.properties||{},g={};for(const x of Object.keys(m))Mn.call(v,x)||(g[x]=m[x]);const y=((x,S)=>{const b=j(x)?x:[x];let O=p({},S);for(const C of b)try{if(O=C(O),z(O))return null}catch(P){return yi.error("Error in Segment filterProperties:",P),null}return O})(d,g);if(z(y))return h;m=y}return h.event.properties=Object.assign({},m,h.event.properties),h};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(h){return c(h,h.event.event)},page(h){return c(h,Hn)},identify(h){return c(h,Tu)},screen(h){return c(h,"$screen")}}})(e,a,{filterProperties:n})).then(()=>{t()},l=>{yi.error("Failed to register the Segment integration",l),t()})},i)}const Wu="posthog-js";function Gu(e,{organization:t,projectId:i,prefix:s,severityAllowList:r=["error"],sendExceptionsToPostHog:n=!0}={}){return o=>{var a,l,u,d,c;if(r!=="*"&&!r.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});const h=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const f=((a=o.exception)===null||a===void 0?void 0:a.values)||[],_=f.map(g=>p(p({},g),{},{stacktrace:g.stacktrace?p(p({},g.stacktrace),{},{type:"raw",frames:(g.stacktrace.frames||[]).map(y=>p(p({},y),{},{platform:"web:javascript"}))}):void 0})),m={$exception_message:((l=f[0])===null||l===void 0?void 0:l.value)||o.message,$exception_type:(u=f[0])===null||u===void 0?void 0:u.type,$exception_level:o.level,$exception_list:_,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((d=f[0])===null||d===void 0?void 0:d.value)||o.message,$sentry_exception_type:(c=f[0])===null||c===void 0?void 0:c.type,$sentry_tags:o.tags};var v;return t&&i&&(m.$sentry_url=(s||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+o.event_id),n&&((v=e.exceptions)===null||v===void 0||v.sendExceptionEvent(m)),o}}var Bf=class{constructor(e,t,i,s,r,n){this.name=Wu,this.setupOnce=function(o){o(Gu(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:n==null||n}))}}},da=class{constructor(e){this.Bo=(t,i,s)=>{s&&(s.noSessionId||s.activityTimeout||s.sessionPastMaximumLength||s.crossTabAdoption)&&(F.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:s}),this.Ho=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.zo()}zo(){var e;this.Uo=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Bo)}destroy(){var e;(e=this.Uo)===null||e===void 0||e.call(this),this.Uo=void 0}doPageView(e,t){var i;const s=this.Wo(e,t);return this.Ho={pathname:(i=w?.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.Wo(e,(t=this.Ho)===null||t===void 0?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Ho)===null||e===void 0?void 0:e.pageViewId}}Wo(e,t){const i=this.Ho;if(!i)return{$pageview_id:t};let s={$pageview_id:t,$prev_pageview_id:i.pageViewId};const r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:d}=r;if(!(E(n)||E(o)||E(a)||E(l)||E(u)||E(d))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),d=Math.ceil(d);const c=n>1?Ge(o/n,0,1,F):1,h=n>1?Ge(a/n,0,1,F):1,f=l>1?Ge(u/l,0,1,F):1,_=l>1?Ge(d/l,0,1,F):1;s=le(s,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:c,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:f,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:_})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}};const bi=["flags","surveys"],Hf={[Jh]:{exposure:"hidden"}
3,[As]:{exposure:"hidden"},[Kh]:{exposure:"hidden"},[sn]:{exposure:"hidden"},[ii]:{exposure:"hidden"},[Mi]:{exposure:"hidden"},[mu]:{exposure:"event"},[rn]:{exposure:"hidden"},[bu]:{exposure:"hidden"},[nn]:{exposure:"event"},[yu]:{exposure:"hidden"},[on]:{exposure:"event"},[an]:{exposure:"event"},[Nn]:{exposure:"event"},[jn]:{exposure:"hidden"},[wu]:{exposure:"event"},[Ai]:{exposure:"hidden"},[Xh]:{exposure:"hidden"},[Gt]:{exposure:"hidden"},[$u]:{exposure:"event"},[Yh]:{exposure:"event",shouldSkipFromEventProperties:e=>ve(e)},[sf]:{exposure:"event"},[rf]:{exposure:"event"},[nf]:{exposure:"event"},[of]:{exposure:"event"},[af]:{exposure:"hidden"},[je]:{exposure:"hidden",storageGroup:"flags"},[Qe]:{exposure:"hidden",storageGroup:"flags"},[ln]:{exposure:"hidden"},[Ft]:{exposure:"hidden",storageGroup:"flags"},[ht]:{exposure:"hidden",storageGroup:"flags"},[Mt]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ti]:{exposure:"hidden",storageGroup:"flags"},[Ue]:{exposure:"hidden"},[kt]:{exposure:"hidden"},[ft]:{exposure:"hidden"},[pt]:{exposure:"hidden"},[un]:{exposure:"hidden",storageGroup:"surveys"},[Ts]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[Eu]:{exposure:"event"},[ku]:{exposure:"hidden"},[Su]:{exposure:"hidden"},[cn]:{exposure:"hidden"},[lf]:{exposure:"hidden"},[uf]:{exposure:"hidden"},[cf]:{exposure:"event"},[df]:{exposure:"event"},[hf]:{exposure:"event"},[ff]:{exposure:"event"},[vt]:{exposure:"hidden"},[Ii]:{exposure:"hidden"},[xu]:{exposure:"event"},[Ui]:{exposure:"hidden"},[_t]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Ie]:{exposure:"hidden"},[dn]:{exposure:"hidden"},[pf]:{exposure:"hidden"},[Iu]:{exposure:"hidden"},[Pu]:{exposure:"hidden"},[Jt]:{exposure:"hidden"},[qn]:{exposure:"hidden"},[Zh]:{exposure:"event"},[Qh]:{exposure:"event"},[ef]:{exposure:"event"},[tf]:{exposure:"event"},[Cu]:{exposure:"event"},[Fu]:{exposure:"event"},[Mu]:{exposure:"event"},[vf]:{exposure:"event"},[gf]:{exposure:"event"},[_f]:{exposure:"event"},[mf]:{exposure:"event"},[yf]:{exposure:"event"},[bf]:{exposure:"event"},[wf]:{exposure:"event"},[$f]:{exposure:"event"}},Vf=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],$e=e=>{const t=Hf[e];if(t)return t;for(const[i,s]of Vf)if(e.indexOf(i)===0)return s},Xt=(e,t)=>{try{let i;return JSON.stringify(e,(s,r)=>{var n;return pi(r)?((n=i)!==null&&n!==void 0||(i=new WeakMap),i.has(r)||i.set(r,Ru(r)),i.get(r)):typeof r=="bigint"?r.toString():r},t)}catch{return yl(e)}},yt=e=>{const t=I?.createElement("a");return E(t)?null:(t.href=e,t)},ui=function(e,t){const i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let s;for(let r=0;i.length>r;r++){const n=i[r].split("=");if(n[0]===t){s=n;break}}if(!j(s)||2>s.length)return"";{let r=s[1];try{r=decodeURIComponent(r)}catch{F.error("Skipping decoding for malformed query param: "+r)}return r.replace(/\+/g," ")}},Ji=function(e,t,i){if(!e||!t||!t.length)return e;const s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[];for(let c=0;l.length>c;c++){const h=l[c].split("=");j(h)&&(t.includes(h[0])?u.push(h[0]+"="+i):u.push(l[c]))}let d=a;return o!=null&&(d+="?"+u.join("&")),r!=null&&(d+="#"+r),d},Ns=function(e,t){const i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},Ju=(e,t)=>e>=t&&ml(),Ku=(e,t,i,s)=>{if(e===0){if(ml()){const r=t+1;return r===i&&s(),r}return t}return 0},ci=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Uf=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...ci],Ki="<masked>",zf=["li_fat_id"];function Xu(e,t,i){if(!I)return{};const s=t?[...ci,...i||[]]:[],r=Yu(Ji(I.URL,s,Ki),e),n=(function(){const o={};return ne(zf,function(a){const l=Ls(a);o[a]=l||null}),o})();return le(n,r)}function Yu(e,t){const i=Uf.concat(t||[]),s={};return ne(i,function(r){const n=ui(e,r);s[r]=n||null}),s}function Zu(e){const t=(function(r){return r?r.search("https?://(.*)google.([^/?]*)")===0?"google":r.search("https?://(.*)bing.com")===0?"bing":r.search("https?://(.*)yahoo.com")===0?"yahoo":r.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(e),i=t!="yahoo"?"q":"p",s={};if(!ve(t)){s.$search_engine=t;const r=I?ui(I.referrer,i):"";r.length&&(s.ph_keyword=r)}return s}function Qu(){return navigator.language||navigator.userLanguage}function Wf(){const e=Qu();return typeof e=="string"?e.split("-")[0]:void 0}const js="$direct";function ec(){return I?.referrer||js}function tc(e,t,i=!1){const s=e?[...ci,...t||[]]:[],r=i?mt(he?.href):he?.href,n=r?.substring(0,1e3);return{r:ec().substring(0,1e3),u:n?Ji(n,s,Ki):void 0}}function ic(e,t=!1){var i;const{r:s,u:r}=e,n=t?mt(r):r,o={$referrer:s,$referring_domain:s==null?void 0:s==js?js:(i=yt(s))===null||i===void 0?void 0:i.host};
3if(n){o.$current_url=n;const a=yt(n);o.$host=a?.host,o.$pathname=a?.pathname;const l=Yu(n);le(o,l)}if(s){const a=Zu(s);le(o,a)}return o}function sc(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Gf(){try{return new Date().getTimezoneOffset()}catch{return}}const Jf={flags:_t,surveys:Ts},Kf=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],ls=e=>`${e}_cookie_identity_change_pending`,us=e=>{let t="",i=0;for(const s of e){const r=encodeURIComponent(JSON.stringify(s).slice(1,-1)).length;if(i+r>1e3)break;t+=s,i+=r}return t},me="main",Ze=[je,Qe,Ft,ht,Mt,_t,Ti,ft],Er=e=>Ze.indexOf(e)!==-1,rc=[ii,Mi],ha=e=>rc.indexOf(e)!==-1,at=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},qt=e=>{if(!e)return{};const t=JSON.parse(e);return Q(t)?t:{}},fa=(e,t)=>{ne(e,(i,s)=>{const r=$e(s);r&&r.exposure!=="event"||{}.hasOwnProperty.call(t,s)||delete e[s]})};var kr=class{constructor(e,t,i=!0){if(this.Vo={},this.Go=!1,this.Zo=!1,this.Qo=!1,this.Jo=!1,this.Ko=!1,this.Xo=new Map,this.Yo=!1,this.tl=!1,this.el=!1,this.il=new Set,this.nl=new Set,this.Ir=e,this.sl=i,this.props={},this.rl=void 0,this.ol=(s=>{let r="";return s.token&&(r=s.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),s.persistence_name?"ph_"+s.persistence_name:"ph_"+r+"_posthog"})(e),this.Oo=this.ll(e),this.Qo=this.al(e),this.load(),this.ul(),e.debug&&F.info("Persistence loaded",e.persistence,p({},this.props)),this.update_config(e,e,t),this.save(),w){const s=()=>this.flush();se(w,"beforeunload",s,{capture:!1}),se(w,"pagehide",s,{capture:!1}),this.hl=r=>{if(this.Go&&(!r.storageArea||r.storageArea===w?.localStorage)&&r.key)if(r.key!==this.ol){if(this.Qo){const n=bi.find(o=>r.key===this.cl(o));n&&this.dl(r.key,n)}}else this.dl(r.key,me)},se(w,"storage",this.hl)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,i])=>{const s=this.Xo.get(t);if(!Er(t)||s===!0)return;if(i===!0)return void this.vl(t,!0);const r=new Set(s||[]);i.forEach(n=>r.add(n)),r.size&&this.vl(t,r)})}onCrossTabFeatureFlagChange(e){return this.nl.add(e),()=>this.nl.delete(e)}destroy(){this.hl&&w&&(w.removeEventListener("storage",this.hl),this.hl=void 0),this.nl.clear()}dl(e,t,i=!0){if(this.mi)return!1;let s,r;try{if(r=te.Ot(e),ve(r)){const a=this.fl(t);return a.storageValue=null,t!==me&&(a.persisted=!1),!1}s=qt(r)}catch{return!1}const n=t===me?s:te.Dt(this.ol);if(n&&this.pl(n))return!1;const o=this.gl(s,t,i);return t===me&&this.Qo&&!at(this.ml().main,s)||this.yl(s,t,!0,r),o}pl(e){const t=this.props[Ne],i=e[Ne];return!E(t)&&!E(i)&&t!==i}yl(e,t,i,s){const r=this.fl(t);r.storageValue=s,t!==me&&(r.persisted=i);try{r.fingerprint=this.bl(e,t)}catch{r.fingerprint=void 0}}gl(e,t,i){let s=!1;return Ze.forEach(r=>{var n;const o=(n=$e(r))===null||n===void 0?void 0:n.storageGroup;if(t===me&&this.Qo&&o||t!==me&&o!==t)return;const a=r in e,l=this._l(r,a?e[r]:void 0),u=this.Xo.has(r)?r in this.props:a;u===r in this.props&&at(l,this.props[r])||(u?this.wl(r,l,!1):this.kl(r,!1),s=!0)}),s&&i&&this.nl.forEach(r=>r()),s}Sl(){if(!this.Go)return!1;try{this.el=!1;const e=te.Ot(this.ol),t=this.fl(me);let i,s=!1,r=!1;if(e!==t.storageValue)if(ve(e))t.storageValue=null;else{if(i=qt(e),this.el=!this.tl&&this.pl(i),this.el)return!1;r=this.gl(i,me,!1),!this.Qo||at(this.ml().main,i)?this.yl(i,me,!0,e):t.storageValue=e,s=!0}return this.Qo&&bi.forEach(n=>{const o=te.Ot(this.cl(n)),a=this.fl(n),l=i||{},u=s&&Ze.some(c=>{var h;return((h=$e(c))===null||h===void 0?void 0:h.storageGroup)===n&&c in l});if(o===a.storageValue&&!u)return;if(ve(o))return a.storageValue=null,a.persisted=!1,void(u&&(r=this.gl(l,n,!1)||r));const d=qt(o);r=this.gl(d,n,!1)||r,this.yl(d,n,!0,o)}),r}catch{return!1}}vl(e,t){this.Xo.set(e,t);const i=$e(e);i?.volatile||(this.fl((this.Qo?i?.storageGroup:void 0)||me).fingerprint=void 0,this.xl(e))}Cl(){Ze.forEach(e=>this.Xo.set(e,!0))}ul(){if(this.Go)try{const e=te.Ot(this.ol),t=qt(e);this.fl(me).storageValue=e,Ze.forEach(i=>{var s;const r=this.Qo?(s=$e(i))===null||s===void 0?void 0:s.storageGroup:void 0,n=r?te.Ot(this.cl(r)):null;if(r){const a=this.fl(r);a.storageValue=n,a.persisted=!ve(n)}const o=r&&!ve(n)?qt(n):t;i in this.props?this.$l(i,o[i],this.props[i]):i in o&&this.vl(i,!0)})}catch{}}_l(e,t){const i=this.Xo.get(e);if(!i)return t;if(i===!0)return this.props[e];if(e==="$active_feature_flags"){const n=new Set(j(t)?t:[]),o=new Set(j(this.props[e])?this.props[e]:[]);
3return i.forEach(a=>o.has(a)?n.add(a):n.delete(a)),Array.from(n)}const s=Q(t)?p({},t):{},r=Q(this.props[e])?this.props[e]:{};return i.forEach(n=>{n in r?s[n]=r[n]:delete s[n]}),s}$l(e,t,i){if(!Er(e))return;const s=this.Xo.get(e);if(s===!0)return;let r=t;if(this.Go)try{var n;const a=this.Qo?(n=$e(e))===null||n===void 0?void 0:n.storageGroup:void 0,l=a?this.cl(a):this.ol;r=qt(te.Ot(l))[e]}catch{}const o=new Set(s||[]);if(e==="$active_feature_flags"){if(!E(t)&&!j(t)||!E(r)&&!j(r)||!j(i))return void this.vl(e,!0);const a=new Set(t||[]),l=new Set(r||[]),u=new Set(i);new Set([...a,...u]).forEach(d=>{a.has(d)!==u.has(d)&&o.add(d)}),o.forEach(d=>{l.has(d)===u.has(d)&&o.delete(d)})}else{if(!Q(i))return void(at(r,i)?this.Xo.delete(e):this.vl(e,!0));{if(!E(t)&&!Q(t)||E(t)&&Ce(i)&&E(r))return void this.vl(e,!0);const a=Q(t)?t:{},l=Q(r)?r:{};new Set([...Object.keys(a),...Object.keys(i)]).forEach(u=>{u in a==u in i&&at(a[u],i[u])||o.add(u)}),o.forEach(u=>{u in l==u in i&&at(l[u],i[u])&&o.delete(u)})}}o.size?this.vl(e,o):this.Xo.delete(e)}Il(){var e;const t=(e=this.Ir)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return ge(t)&&t>0?t:0}Tl(e){if(this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const t=wr(e,this.Ir.cookie_persisted_properties||[]),i=Yo(t,this.Ir.cookie_persisted_properties||[]),s=JSON.stringify(t)+"|"+JSON.stringify(i),r=de.Ot(this.ol)||void 0;r&&$r(this.ol,r)===s&&(this.Ml=s,this.El=r)}catch{}else try{const t=de.Ot(this.ol)||void 0;this.Ml=t?$r(this.ol,t):void 0,this.El=t}catch{}}syncCookieProperties(){return this.Pl(this.Ir)}Pl(e,t=!1){if(this.mi&&!t||this.Ko||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let i;try{i=de.Ot(this.ol)||void 0}catch{}if(!i||i===this.El)return!1;const s=$r(this.ol,i);let r;try{r=br(JSON.parse(i))}catch{return!1}if((de.Ot(this.ol)||void 0)!==i)return!1;this.Ml=s,this.El=i;const n=Zo(this.ol,i),o=[...St,...n.properties],a={};if(Object.keys(r).forEach(m=>{const v=r[m];(E(v)||ve(v)||v===""||m==="$user_state"&&v!=="anonymous"&&v!=="identified")&&(a[m]=!0,delete r[m])}),Ce(r))return!1;const l="distinct_id"in r||r.$user_state==="anonymous"||r.$user_state==="identified",u=this.props,d=u[Ne],c=u[Ie],h=le({},u);[...St,...e.cookie_persisted_properties||[]].forEach(m=>{if(o.indexOf(m)!==-1&&!(m in r)&&!a[m]&&(l||m!=="distinct_id"&&m!=="$user_state")){const v=h[m];(n.isValid||St.indexOf(m)===-1||v!==!1&&v!==0)&&delete h[m]}}),this.props=le(h,r),Ze.forEach(m=>{const v=m in this.props;m in u===v&&at(u[m],this.props[m])||(v?this.$l(m,u[m],this.props[m]):this.vl(m,!0))}),!l||"$user_state"in r||"$user_state"in this.props||this.wl(Ie,et);const f=this.props[Ne],_=this.props[Ie];return!l||f===d&&_===c||(this.tl=!0,this.Jo=!0,ae.At(ls(this.ol),!0),this.kl(ft),this.kl(Qe),this.kl(je),this.kl(Ft),this.kl(ht),this.kl(Mt),this.kl(_t),this.kl(Ui),this.kl(vt),_!=="anonymous"||c!=="identified"&&r.$user_state!=="anonymous"&&(E(d)||f===d)||(fa(this.props,r),this.kl(pt)),_==="identified"?this.props.$user_id=f:delete this.props.$user_id,this.kl(As
3)),!0}consumeCookieIdentityChange(){const e=ls(this.ol),t=this.Jo||!!ae.Ot(e);return this.Jo=!1,t&&ae.Lt(e),t}Rl(e=!1){return!(this.Ko||this.mi&&!e||!this.Ir.cookieWinsOnConflict||this.Ir.persistence.toLowerCase()!=="localstorage+cookie"||(this.Ko=!0,0))}Al(){this.Ko&&(E(this.Fl)||(clearTimeout(this.Fl),this.Fl=void 0),delete this.Vo[me],this.Ol(!0))}Dl(e=!0){if(this.Ko)try{e?this.Al():E(this.Fl)||(clearTimeout(this.Fl),this.Fl=void 0)}finally{this.Ko=!1}}isDisabled(){return!!this.mi}ll(e){Kf.indexOf(e.persistence.toLowerCase())===-1&&(F.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const t=((o=[],a=!1)=>{const l=[...St,...o];return p(p({},te),{},{Dt(u){try{let c,h={};try{c=de.Ot(u)||void 0,h=c?br(JSON.parse(c)):{}}catch{}const f=JSON.parse(te.Ot(u)||"{}");let _;if(a){const m=Zo(u,c),v=[...St,...m.properties],g={};Object.keys(h).forEach(x=>{const S=h[x];ve(S)||S===""||x==="$user_state"&&S!=="anonymous"&&S!=="identified"||(g[x]=S)});const y="distinct_id"in g||g.$user_state==="anonymous"||g.$user_state==="identified";if(Object.keys(g).length>0){var d;const x=f[Ne],S=(d=f.$user_state)!==null&&d!==void 0?d:et;l.forEach(b=>{if(v.indexOf(b)!==-1&&!(b in h)&&(y||b!=="distinct_id"&&b!=="$user_state")){const O=f[b];(m.isValid||St.indexOf(b)===-1||O!==!1&&O!==0)&&delete f[b]}}),!y||"$user_state"in h||"$user_state"in f||(f[Ie]=et),!y||("distinct_id"in g?g[Ne]:f[Ne])===x&&("$user_state"in g?g[Ie]:f[Ie])===S||(yr.forEach(b=>delete f[b]),g.$user_state==="identified"&&"distinct_id"in g?f.$user_id=g[Ne]:delete f.$user_id,g.$user_state!=="identified"&&(delete f[xu],delete f[pt]),delete f.__alias)}_=le(f,g)}else _=le(h,f);return te.At(u,_),_}catch{}return null},At(u,d,c,h,f,_){const m=te.At(u,d,void 0,void 0,_);try{const v=wr(d,o);if(Object.keys(v).length){if(a){const g=Ds(u),y=Yo(v,o);if(de.At(g,y,c,h,f,_),de.Ot(g)!==JSON.stringify(y)){de.Lt(g,h);const x=wr(d);return de.At(u,x,c,h,f,_),m}}de.At(u,v,c,h,f,_)}}catch(v){te.Pt(v)}return m},Lt(u,d){try{w?.localStorage.removeItem(u),de.Lt(u,d),de.Lt(Ds(u),d)}catch(c){te.Pt(c)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let i,s=!1,r=!1;const n=e.persistence.toLowerCase();return n==="localstorage"&&te.Et()?(i=te,r=!0):n==="localstorage+cookie"&&t.Et()?(i=t,r=!0,s=!0):n==="sessionstorage"&&ae.Et()?i=ae:n==="memory"?i=pn:n==="cookie"&&de.Et()?(i=de,s=!0):t.Et()?(i=t,r=!0,s=!0):de.Et()?(i=de,s=!0):i=pn,this.Go=r,this.Zo=s,i}cl(e){return`${this.ol}__${e}`}al(e){return this.Go&&!!e.split_storage}properties(){const e={};return ne(this.props,(t,i)=>{const s=$e(i);if(!s||s.exposure==="event"){var r;if(!(s==null||(r=s.shouldSkipFromEventProperties)===null||r===void 0)&&r.call(s,t))return;e[i]=t}}),e}load(e=!1){if(this.mi&&!e)return;const t=this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie",i=t?te.Dt(this.ol):null;let s={};if(t)try{s=br(de.Dt(this.ol)),ne(s,(a,l)=>{(E(a)||ve(a)||a==="")&&delete s[l]})}catch{}const r=this.Oo.Dt(this.ol);if(r&&(this.props=le({},r)),this.Qo&&this.Ll(),t&&r){var n,o;const a=i?.[Ne],l=(n=i?.$user_state)!==null&&n!==void 0?n:et,u=r[Ne],d=(o=r.$user_state)!==null&&o!==void 0?o:et;if(u!==a||d!==l){this.Jo=!0,ae.At(ls(this.ol),!0);const c=le({},this.props);yr.forEach(f=>delete c[f]),d!=="anonymous"||l!=="identified"&&s.$user_state!=="anonymous"&&(E(a)||u===a)||(fa(c,s),delete c[pt]),this.props=c;const h=new Set;yr.forEach(f=>{var _;const m=(_=$e(f))===null||_===void 0?void 0:_.storageGroup;m&&h.add(m)}),h.forEach(f=>{const _={};ne(this.props,(m,v)=>{var g;((g=$e(v))===null||g===void 0?void 0:g.storageGroup)===f&&(_[v]=m)}),Ce(_)?(te.Lt(this.cl(f)),this.Vo[f]={}):te.At(this.cl(f),_)&&(this.Vo[f]={persisted:!0,fingerprint:this.bl(_,f)})})}}ae.Ot(ls(this.ol))&&(this.Jo=!0)}Ll(){for(const e of bi){const t=te.Dt(this.cl(e));if(t&&!Ce(t)){const i=this.fl(e);i.persisted=!0,this.Nl(e)||(i.fingerprint=this.bl(t,e)),this.ql(e,t)||le(this.props,t)}}}Nl(e){return Object.keys(this.props).some(t=>{var i;return((i=$e(t))===null||i===void 0?void 0:i.storageGroup)===e})}ql(e,t){const i=Jf[e];
3if(!i)return!1;const s=t[i],r=this.props[i];return ge(s)&&ge(r)&&r>s}refreshKey(e){var t;if(this.mi||this.il.has(e))return;const i=this.Qo?(t=$e(e))===null||t===void 0?void 0:t.storageGroup:void 0,s=i?te.Dt(this.cl(i)):this.Oo.Dt(this.ol);if(s&&e in s)this.wl(e,s[e],!1);else{if(i){const r=this.Oo.Dt(this.ol);if(r&&e in r)return void this.wl(e,r[e],!1)}this.kl(e,!1)}}save(){if(this.mi)return;const e=this.Il();e>0?E(this.Fl)&&(this.Fl=setTimeout(()=>{this.Fl=void 0,this.Ol()},e)):this.Ol()}flush(){E(this.Fl)||(clearTimeout(this.Fl),this.Fl=void 0,this.Ol())}Ol(e=!1){if(this.mi||this.Ko&&!e)return;e||(this.syncCookieProperties(),this.Ir.cookieWinsOnConflict&&this.Ir.persistence.toLowerCase()==="localstorage+cookie"||rc.forEach(r=>this.refreshKey(r)));const t=!e&&!this.Yo;t||(this.el=!1);const i=!!t&&this.Sl();if(this.el)return void(this.Ir.debug&&F.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Qo)return this.jl(),void(i&&this.nl.forEach(r=>r()));const s=this.Bl(this.Oo,this.ol,this.props,me);s==="written"&&this.Tl(this.props),s!=="failed"&&(this.Xo.clear(),this.tl=!1,this.il.clear()),i&&this.nl.forEach(r=>r())}jl(){const{main:e,groups:t}=this.ml(),i=this.Bl(this.Oo,this.ol,e,me);i==="written"&&this.Tl(e),i!=="failed"&&(this.tl=!1,this.il.clear(),Ze.forEach(r=>{var n;!((n=$e(r))===null||n===void 0)&&n.storageGroup||this.Xo.delete(r)}));for(const r of bi){var s;const n=t[r];if(Ce(n)&&!(!((s=this.Vo[r])===null||s===void 0)&&s.persisted)){Ze.forEach(a=>{var l;((l=$e(a))===null||l===void 0?void 0:l.storageGroup)===r&&this.Xo.delete(a)});continue}const o=this.Bl(te,this.cl(r),n,r);o!=="failed"&&Ze.forEach(a=>{const l=$e(a);l?.storageGroup!==r||o!=="written"&&l.volatile||this.Xo.delete(a)})}}ml(){const e={},t={flags:{},surveys:{}};return ne(this.props,(i,s)=>{var r;const n=(r=$e(s))===null||r===void 0?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i}),{main:e,groups:t}}bl(e,t){if(t===me)return JSON.stringify(e)+"|"+this.Hl+"|"+this.zl+"|"+this.Ul;const i={};return ne(e,(s,r)=>{var n;i[r]=!((n=$e(r))===null||n===void 0)&&n.volatile?"__volatile__":s}),JSON.stringify(i)}Bl(e,t,i,s){const r=this.fl(s);if(s!==me&&!r.dirty&&!E(r.fingerprint))return"skipped";let n;try{if(n=this.bl(i,s),n===r.fingerprint)return r.dirty=!1,"skipped"}catch{n=void 0}return e.At(t,i,this.Hl,this.zl,this.Ul,this.Ir.debug)?(r.dirty=!1,s!==me&&(r.persisted=!0),E(n)||(r.fingerprint=n),this.Go&&(r.storageValue=te.Ot(t)),"written"):(this.Ir.debug&&F.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Cl(),E(this.Fl)||(clearTimeout(this.Fl),this.Fl=void 0),this.Oo.Lt(this.ol,!1),this.Oo.Lt(this.ol,!0),!e&&this.sl)for(const t of bi)te.Lt(this.cl(t));e?delete this.Vo[me]:this.Vo={},this.Ml=void 0,this.El=void 0}clear(){this.remove(),this.props={}}register_once(e,t,i){if(Q(e)){this.syncCookieProperties(),E(t)&&(t="None"),this.Hl=E(i)?this.Wl:i;let s=!1;if(ne(e,(r,n)=>{this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.wl(n,r),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(Q(e)){this.syncCookieProperties(),this.Hl=E(t)?this.Wl:t;let i=!1;if(ne(e,(s,r)=>{e.hasOwnProperty(r)&&(this.props[r]!==s||Q(s)||j(s))&&(this.wl(r,s),i=!0)}),i)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const t=typeof e=="string"?[e]:e;let i=!1;for(const s of t)s in this.props&&(this.kl(s),i=!0);i&&this.save()}update_campaign_params(){const e=I?.URL;if(e===this.rl)return;const t=Xu(this.Ir.custom_campaign_params,this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties),i=!Ce(Vn(t));return i&&this.register(t),this.rl=e,i?t:void 0}update_search_keyword(){this.register((function(){const e=I?.referrer;return e?Zu(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:ec(),$referring_domain:I?.referrer&&((e=yt(I.referrer))===null||e===void 0?void 0:e.host)||js},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=tc(this.Ir.mask_personal_data_properties,this.Ir.custom_personal_data_properties,this.Ir.disable_capture_url_hashes
3);this.register_once({[Jt]:this.Zo?{r:us(e.r),u:e.u?us(e.u):void 0}:e},void 0)}get_initial_props(){const e={};ne([Pu,Iu],i=>{const s=this.props[i];s&&ne(s,function(r,n){e["$initial_"+Jr(n)]=r})});const t=this.props[Jt];if(t){const i=(function(s,r=!1){const n=ic(s,r),o={};return ne(n,function(a,l){o[`$initial_${Jr(l)}`]=a}),o})(t,this.Ir.disable_capture_url_hashes);le(e,i)}return e}safe_merge(e){return ne(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){const s=e.persistence!==t.persistence,r=!((f,_)=>{if(f.length!==_.length)return!1;const m=[...f].sort(),v=[..._].sort();return m.every((g,y)=>g===v[y])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),n=s||r,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!i,l=!!this.mi&&!a;a||this.Pl(t,l),this.Ir=e,!a&&(s||r||o)&&(this.Ml=void 0,this.El=void 0,this.Pl(p(p({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),l));const u=n||o?this.ll(e):this.Oo;this.Vl();const d=this.al(e),c=n||d!==this.Qo,h=!a&&(c||e.cross_subdomain_cookie!==this.zl||e.secure_cookie!==this.Ul)&&this.Rl(l);this.Yo=c;try{if(this.Wl=this.Hl=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),c){const f=this.props;this.clear(),this.Oo=u,this.Qo=d,this.props=f,this.save()}else o&&(this.Oo=u,a||(delete this.Vo[me],this.Ol()))}finally{this.Yo=!1,h&&this.Dl()}}Vl(){const e=this.props[Jt];if(!this.Zo||!Q(e)||typeof e.r!="string")return;const t=us(e.r),i=typeof e.u=="string"?us(e.u):e.u;t===e.r&&i===e.u||this.wl(Jt,p(p({},e),{},{r:t,u:i}))}set_disabled(e){this.mi=e,this.mi?this.remove():this.save()}set_cross_subdomain(e){e!==this.zl&&(this.zl=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Ul&&(this.Ul=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){const i=this.props.__timers||{};i[e]=t,this.wl(sn,i),this.save()}remove_event_timer(e){const t=this.props.__timers||{},i=t[e];return E(i)||(delete t[e],this.wl(sn,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this.wl(e,t),this.save()}wl(e,t,i=!0){var s;const r=this.props[e];this.props[e]=t,i&&(e!=="distinct_id"&&e!=="$user_state"||r===t||(this.tl=!0),ha(e)&&!at(r,t)&&this.il.add(e),this.$l(e,r,t),!((s=$e(e))===null||s===void 0)&&s.volatile||this.xl(e))}kl(e,t=!0){delete this.props[e],t&&(Er(e)&&this.vl(e,!0),ha(e)&&this.il.add(e),this.xl(e))}xl(e){var t;const i=(t=$e(e))===null||t===void 0?void 0:t.storageGroup;i&&(this.fl(i).dirty=!0)}fl(e){return this.Vo[e]||(this.Vo[e]={})}};const Me={GZipJS:"gzip-js",Base64:"base64"},wi={Activation:"events",Cancellation:"cancelEvents"},Sr={Popover:"popover",API:"api",Widget:"widget"},tt={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Ir={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},_n={Popover:"popover",Inline:"inline"};function cs(e){let t=!0;return{dispose(){if(t){t=!1;const i=e();i&&be(i.then)&&i.then(void 0,()=>{})}}}}const Xf={SHOWN:"product tour shown"},pa={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},va=pe("[RateLimiter]");var Yf=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach(s=>{va.info(`${s||"events"} is quota limited.`),this.serverLimits[s]=new Date().getTime()+6e4})}catch(s){return void va.warn(`could not rate limit - continuing. Error: "${s?.message}"`,{text:i})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,i,s;const{captureEventsBurstLimit:r,captureEventsPerSecond:n}=this,o=new Date().getTime(),a=(t=(i=this.instance.persistence)===null||i===void 0?void 0:i.get_property("$capture_rate_limit"))!==null&&t!==void 0?t:{tokens:r,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>r&&(a.tokens=r);const l=1>a.tokens;
3if(l||e||(a.tokens=Math.max(0,a.tokens-1)),l&&!e){const u=(ge(a.dropped)?a.dropped:0)+1;a.dropped=u,!this.lastEventRateLimited&&this.Gl(u)&&(a.dropped=0)}return this.lastEventRateLimited=l,(s=this.instance.persistence)===null||s===void 0||s.set_property("$capture_rate_limit",a),{isRateLimited:l,remainingTokens:a.tokens}}Zl(e){const t=this.instance.config.property_denylist;return!j(t)||!t.includes(e)}Ql(){var e;if(this.Zl("$current_url")&&this.Zl("$pathname")&&he?.pathname)return`${(e=he.origin)!==null&&e!==void 0?e:""}${he.pathname}`}Gl(e){var t,i;const{captureEventsBurstLimit:s,captureEventsPerSecond:r}=this,n=this.Ql(),o=this.Zl("$session_id")?(t=(i=this.instance).get_session_id)===null||t===void 0?void 0:t.call(i):void 0,a=[`${e} event(s) dropped since the last warning`,n?`triggered on ${n}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${a}. Config is set to ${r} events per second and ${s} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}};const lt=pe("[RemoteConfig]");var nc=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=L._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}Jl(e){var t,i,s;!((t=L.__PosthogExtensions__)===null||t===void 0)&&t.loadExternalDependency?(i=L.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Kl(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return lt.info("Using preloaded remote config",this.remoteConfig),void this.Xl(this.remoteConfig);if(this._instance.Yl())return void lt.warn("Remote config is disabled. Falling back to local config.");this.Jl(e=>{if(!e)return lt.info("No config found after loading remote JS config. Falling back to JSON."),void this.Kl(t=>{this.Xl(t.json,t)});this.Xl(e)})}catch(e){lt.error("Error loading remote config",e),this.Xl()}}Xl(e,t){!e&&t&&(t.statusCode===0?t.error||lt.warn("Failed to fetch remote config from PostHog."):lt.error("Failed to fetch remote config from PostHog."));try{this._instance.Xl(e?{ok:!0,config:e}:{ok:!1})}catch(s){lt.error("Error applying remote config",s)}if(e?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var i;(i=this._instance.featureFlags)===null||i===void 0||i.ensureFlagsLoaded()}catch(s){lt.error("Error loading feature flags",s)}}},Te=Uint8Array,Fe=Uint16Array,di=Uint32Array,Jn=new Te([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]),Kn=new Te([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]),ga=new Te([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),oc=function(e,t){for(var i=new Fe(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new di(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},ac=oc(Jn,2),mn=ac[1];ac[0][28]=258,mn[258]=28;for(var _a=oc(Kn,0)[1],lc=new Fe(32768),fe=0;32768>fe;++fe){var Bt=(43690&fe)>>>1|(21845&fe)<<1;lc[fe]=((65280&(Bt=(61680&(Bt=(52428&Bt)>>>2|(13107&Bt)<<2))>>>4|(3855&Bt)<<4))>>>8|(255&Bt)<<8)>>>1}var Di=function(e,t,i){for(var s=e.length,r=0,n=new Fe(t);s>r;++r)++n[e[r]-1];var o,a=new Fe(t);for(r=0;t>r;++r)a[r]=a[r-1]+n[r-1]<<1;for(o=new Fe(s),r=0;s>r;++r)o[r]=lc[a[e[r]-1]++]>>>15-e[r];return o},Lt=new Te(288);for(fe=0;144>fe;++fe)Lt[fe]=8;for(fe=144;256>fe;++fe)Lt[fe]=9;for(fe=256;280>fe;++fe)Lt[fe]=7;for(fe=280;288>fe;++fe)Lt[fe]=8;var qs=new Te(32);for(fe=0;32>fe;++fe)qs[fe]=5;var Zf=Di(Lt,9),Qf=Di(qs,5),uc=function(e){return(e/8|0)+(7&e&&1)},cc=function(e,t,i){(i==null||i>e.length)&&(i=e.length);var s=new(e instanceof Fe?Fe:e instanceof di?di:Te)(i-t);return s.set(e.subarray(t,i)),s},Ke=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},$i=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},Pr=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new Te(0),0];if(r==1){var o=new Te(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(b,O){return b.f-O.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,d=1,c=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};d!=r-1;)a=i[i[c].f>i[u].f?u++:c++],l=i[u!=d&&i[c].f>i[u].f?u++:c++],i[d++]={s:-1,f:a.f+l.f,l:a,r:l};var h=n[0].s;for(s=1;r>s;++s)n[s].s>h&&(h=n[s].s);var f=new Fe(h+1),_=yn(i[d-1],f,0);if(_>t){s=0;var m=0,v=_-t,g=1<<v;for(n.sort(function(b,O){return f[O.s]-f[b.s]||b.f-O.f});r>s;++s){var y=n[s].s;if(t>=f[y])break;m+=g-(1<<_-f[y]),f[y]=t}for(m>>>=v;m>0;){var x=n[s].s;t>f[x]?m-=1<<t-f[x]++-1:++s}for(;s>=0&&m;--s){var S=n[s].s;f[S]==t&&(--f[S],++m)}_=t}return[new Te(f),_]},yn=function(e,t,i){return e.s==-1?Math.max(yn(e.l,t,i+1),yn(e.r,t,i+1)):t[e.s]=i},ma=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new Fe(++t),s=0,r=e[0],n=1,o=function(l){i[s++]=l},a=1;t>=a;++a)if(e[a]==r&&a!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(r),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(r);n=1,r=e[a]}return[i.subarray(0,s),t]},xi=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},bn=function(e,t,i){var s=i.length,r=uc(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},ya=function(e,t,i,s,r,n,o,a,l,u,d){Ke(t,d++,i),++r[256];for(var c=Pr(r,15),h=c[0],f=c[1],_=Pr(n,15),m=_[0],v=_[1],g=ma(h),y=g[0],x=g[1],S=ma(m),b=S[0],O=S[1],C=new Fe(19),P=0;y.length>P;++P)C[31&y[P]]++;for(P=0;b.length>P;++P)C[31&b[P]]++;for(var M=Pr(C,7),D=M[0],U=M[1],B=19;B>4&&!D[ga[B-1]];--B);var K,T,A,N,Z=u+5<<3,ee=xi(r,Lt)+xi(n,qs)+o,$=xi(r,h)+xi(n,m)+o+14+3*B+xi(C,D)+(2*C[16]+3*C[17]+7*C[18]);if(ee>=Z&&$>=Z)return bn(t,d,e.subarray(l,l+u));if(Ke(t,d,1+(ee>$)),d+=2,ee>$){K=Di(h,f),T=h,A=Di(m,v),N=m;var k=Di(D,U);for(Ke(t,d,x-257),Ke(t,d+5,O-1),Ke(t,d+10,B-4),d+=14,P=0;B>P;++P)Ke(t,d+3*P,D[ga[P]]);d+=3*B;for(var R=[y,b],H=0;2>H;++H){var W=R[H];for(P=0;W.length>P;++P)Ke(t,d,k[V=31&W[P]]),d+=D[V],V>15&&(Ke(t,d,W[P]>>>5&127),d+=W[P]>>>12)}}else K=Zf,T=Lt,A=Qf,N=qs;for(P=0;a>P;++P)if(s[P]>255){var V;$i(t,d,K[257+(V=s[P]>>>18&31)]),d+=T[V+257],V>7&&(Ke(t,d,s[P]>>>23&31),d+=Jn[V]);var oe=31&s[P];$i(t,d,A[oe]),d+=N[oe],oe>3&&($i(t,d,s[P]>>>5&8191),d+=Kn[oe])}else $i(t,d,K[s[P]]),d+=T[s[P]];return $i(t,d,K[256]),d+T[256]},ep=new di([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),tp=(function(){for(var e=new di(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e})(),Or=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};
3function ip(e,t){t===void 0&&(t={});var i=(function(){var c=4294967295;return{p(h){for(var f=c,_=0;h.length>_;++_)f=tp[255&f^h[_]]^f>>>8;c=f},d(){return 4294967295^c}}})(),s=e.length;i.p(e);var r,n,o,a,l,u=(a=10+((r=t).filename&&r.filename.length+1||0),l=8,(function(c,h,f,_,m,v){var g=c.length,y=new Te(_+g+5*(1+Math.floor(g/7e3))+m),x=y.subarray(_,y.length-m),S=0;if(!h||8>g)for(var b=0;g>=b;b+=65535){var O=b+65535;g>O?S=bn(x,S,c.subarray(b,O)):(x[b]=v,S=bn(x,S,c.subarray(b,g)))}else{for(var C=ep[h-1],P=C>>>13,M=8191&C,D=(1<<f)-1,U=new Fe(32768),B=new Fe(D+1),K=Math.ceil(f/3),T=2*K,A=function(ir){return(c[ir]^c[ir+1]<<K^c[ir+2]<<T)&D},N=new di(25e3),Z=new Fe(288),ee=new Fe(32),$=0,k=0,R=(b=0,0),H=0,W=0;g>b;++b){var V=A(b),oe=32767&b,ie=B[V];if(U[oe]=ie,B[V]=oe,b>=H){var ce=g-b;if(($>7e3||R>24576)&&ce>423){S=ya(c,x,0,N,Z,ee,k,R,W,b-W,S),R=$=k=0,W=b;for(var X=0;286>X;++X)Z[X]=0;for(X=0;30>X;++X)ee[X]=0}var _e=2,Re=0,Dt=M,Le=oe-ie&32767;if(ce>2&&V==A(b-Le))for(var vi=Math.min(P,ce)-1,er=Math.min(32767,b),Tc=Math.min(258,ce);er>=Le&&--Dt&&oe!=ie;){if(c[b+_e]==c[b+_e-Le]){for(var ot=0;Tc>ot&&c[b+ot]==c[b+ot-Le];++ot);if(ot>_e){if(_e=ot,Re=Le,ot>vi)break;var Rc=Math.min(Le,ot-2),Yn=0;for(X=0;Rc>X;++X){var tr=b-Le+X+32768&32767,Zn=tr-U[tr]+32768&32767;Zn>Yn&&(Yn=Zn,ie=tr)}}}Le+=(oe=ie)-(ie=U[oe])+32768&32767}if(Re){N[R++]=268435456|mn[_e]<<18|_a[Re];var Qn=31&mn[_e],eo=31&_a[Re];k+=Jn[Qn]+Kn[eo],++Z[257+Qn],++ee[eo],H=b+_e,++$}else N[R++]=c[b],++Z[c[b]]}}S=ya(c,x,v,N,Z,ee,k,R,W,b-W,S)}return cc(y,0,_+uc(S)+m)})(n=e,(o=t).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l,!0)),d=u.length;return(function(c,h){var f=h.filename;if(c[0]=31,c[1]=139,c[2]=8,c[8]=2>h.level?4:h.level==9?2:0,c[9]=3,h.mtime!=0&&Or(c,4,Math.floor(new Date(h.mtime||Date.now())/1e3)),f){c[3]=8;for(var _=0;f.length>=_;++_)c[_+10]=f.charCodeAt(_)}})(u,t),Or(u,d-8,i.d()),Or(u,d-4,s),u}const sp=!!Fn||!!Hi,dc=new WeakMap,hc="text/plain";let Cr=0,bs=!1;const fc=(e,t)=>{const[i,s]=e.split("#"),[r,n]=i.split("?");if(!n)return e;const o=n.split("&").filter(a=>a.split("=")[0]!==t).join("&");return`${r}${o?`?${o}`:""}${s?`#${s}`:""}`},Qi=(e,t,i=!0)=>{var s;const[r,n]=e.split("?"),o=p({},t),a=(s=n?.split("&").map(u=>{var d;const[c,h]=u.split("="),f=i&&(d=o[c])!==null&&d!==void 0?d:h;return delete o[c],`${c}=${f}`}))!==null&&s!==void 0?s:[],l=(function(u,d="&"){let c,h;const f=[];return ne(u,function(_,m){E(_)||E(m)||m==="undefined"||(c=encodeURIComponent((v=>v instanceof File)(_)?_.name:_.toString()),h=encodeURIComponent(m),f[f.length]=h+"="+c)}),f.join(d)})(o);return l&&a.push(l),a.length>0?`${r}?${a.join("&")}`:r},Fr=e=>{if(e.ta)return e.ta;const{data:t,compression:i}=e;if(!t)return;if(i===Me.GZipJS){const r=ip((function(n){var o=n.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(n);for(var a=new Te(n.length+(n.length>>>1)),l=0,u=function(f){a[l++]=f},d=0;o>d;++d){if(l+5>a.length){var c=new Te(l+8+(o-d<<1));c.set(a),a=c}var h=n.charCodeAt(d);128>h?u(h):2048>h?(u(192|h>>>6),u(128|63&h)):h>55295&&57344>h?(u(240|(h=65536+(1047552&h)|1023&n.charCodeAt(++d))>>>18),u(128|h>>>12&63),u(128|h>>>6&63),u(128|63&h)):(u(224|h>>>12),u(128|h>>>6&63),u(128|63&h))}return cc(a,0,l)})(Xt(t)),{mtime:0});return{contentType:hc,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Me.Base64){const r=(function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,(a,l)=>String.fromCharCode(parseInt(l,16))))})(Xt(t)),n=(o=>"data="+encodeURIComponent(typeof o=="string"?o:Xt(o)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}const s=Xt(t);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}},pc=e=>{const t=()=>e.transport==="sendBeacon"?{url:Qi(e.url,{compression:Me.Base64}),encodedBody:Fr(p(p({},e),{},{compression:Me.Base64,ta:void 0}))}:{url:fc(e.url,"compression"),encodedBody:Fr(p(p({},e),{},{compression:void 0,ta:void 0}))};let i;try{i=Fr(e)}catch(r){if(jo(e.compression,ui(e.url,"compression")))return F.error("Failed to gzip request body, sending uncompressed payload",r),t();throw r}return i&&jo(e.compression,ui(e.url,"compression"))&&!((s=i.body)instanceof ArrayBuffer?en(new Uint8Array(s)):ArrayBuffer.isView(s)&&en(new Uint8Array(s.buffer,s.byteOffset,s.byteLength)))?(bs=!0,t()):{url:e.url,encodedBody:i};var s},vc=e=>{try{return pc(e)}catch(i){var t;return F.error(i),void((t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:i}))}},rp=(function(){var e=ue(function*(t){const i=yield(function(r){return tn.apply(this,arguments)})(Xt(t.data),ye.DEBUG,{rethrow:!0});if(!i)return t;const s=yield i.arrayBuffer();return p(p({},t),{},{ta:{contentType:hc,body:s,estimatedSize:s.byteLength}})});return function(t){return e.apply(this,arguments)}})(),np=/Failed to fetch|NetworkError|Load failed/i,gc=e=>e?.name==="TypeError"&&np.test(e?.message||""),_c=e=>
3{try{const t=(function(i,s=Date.now()){if(typeof i!="string"||!i)return;const r=i.trim(),n=/^\d+\s*,/.test(r)?r.slice(0,r.indexOf(",")).trim():r;if(/^\d+$/.test(n)){const l=1e3*Math.min(Number(n),300);return l>0?l:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(n))return;const o=/^\w{3} \w{3} /.test(n)?n+" GMT":n,a=Date.parse(o)-s;return Number.isFinite(a)&&a>0?Math.min(a,_s):void 0})(e());return E(t)?void 0:Math.min(t,3e4)}catch{return}},mc=e=>{const t=vc(e);if(!t)return;const i=new Fn;dc.set(i,!0);const{url:s,encodedBody:r}=t;i.open(e.method||"GET",s,!0);const{contentType:n,body:o}=r??{};ne(e.headers,function(a,l){i.setRequestHeader(l,a)}),n&&i.setRequestHeader("Content-Type",n),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(i.readyState===4){var a;const l={statusCode:i.status,text:i.responseText};if(i.status===200)try{l.json=JSON.parse(i.responseText)}catch{}(a=e.callback)===null||a===void 0||a.call(e,l,_c(()=>i.getResponseHeader("Retry-After")))}},i.send(o)},yc=e=>{const t=vc(e);if(!t)return;const{url:i,encodedBody:s}=t,{contentType:r,body:n,estimatedSize:o}=s??{},a=new Headers;ne(e.headers,function(_,m){a.append(m,_)}),r&&a.append("Content-Type",r);let l=null,u=!1;if(Eo){const _=new Eo;l={signal:_.signal,timeout:setTimeout(()=>{u=!0;try{_.abort(Ql("AbortError","PostHog request timed out"+((m=e.timeout)?` after ${m}ms`:"")))}catch(v){c(v)}var m},e.timeout)}}let d=!1;const c=_=>{var m;d||(d=!0,u&&_?.name==="AbortError"||gc(_)?F.warn(_):F.error(_),(m=e.callback)===null||m===void 0||m.call(e,{statusCode:0,error:_}))};let h=0;const f=()=>{Cr-=h,h=0,l&&clearTimeout(l.timeout)};try{const _=p({method:e?.method||"GET",headers:a,referrerPolicy:"strict-origin",body:n,signal:l?.signal},e.fetchOptions),m=o??(E(n)?0:void 0);_.keepalive=_.method==="POST"&&!e.ea&&_.keepalive!==!1&&_.body===n&&!E(m)&&m>=0&&52428.8>Cr+m,_.keepalive&&(h=m,Cr+=h),Hi(i,_).then(v=>v.text().then(g=>{var y;if(d)return;const x={statusCode:v.status,text:g};if(v.status===200)try{x.json=JSON.parse(g)}catch(S){F.error(S)}d=!0,f(),(y=e.callback)===null||y===void 0||y.call(e,x,_c(()=>v.headers.get("Retry-After")))})).catch(v=>{f(),c(v)}).finally(f)}catch(_){f(),c(_)}},wn=e=>{try{var t;const{url:i,encodedBody:s}=pc(e),{contentType:r,body:n,estimatedSize:o}=s??{};if(!n)return;const a=n instanceof Blob?n:new Blob([n],{type:r});if(we.sendBeacon(i,a))return;const l=j(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(j(l)&&l.length>1&&(o??0)>16384){const u=Math.ceil(l.length/2),d=c=>j(e.data)?c:p(p({},e.data),{},{batch:c});return wn(p(p({},e),{},{data:d(l.slice(0,u))})),void wn(p(p({},e),{},{data:d(l.slice(u))}))}F.warn(`Beacon of ~${o??0} bytes was rejected by the browser, falling back to ${Hi?"fetch":"XHR"}`),Hi?yc(p(p({},e),{},{ea:!0})):mc(e)}catch(i){F.warn("Beacon send failed",i)}},ba=(e,t,i,s)=>{const r=s==="query"?t==="POST"?"sent_at":"_":void 0;return Qi(i===Me.GZipJS?fc(e,"compression"):e,p(p({},r?{[r]:Date.now().toString()}:{}),i===Me.GZipJS?{}:{compression:i}))},op=(()=>{const e=[];return Hi&&e.push({transport:"fetch",method:yc}),Fn&&e.push({transport:"XHR",method:mc}),we?.sendBeacon&&e.push({transport:"sendBeacon",method:wn}),e})();let bc=!sp&&Se?.indexOf("MSIE")===-1&&Se?.indexOf("Mozilla")===-1;function wc(e,t,i){var s,r,n;i&&(t=p(p({},t),{},{callback:o=>i(o)})),e.__loaded?bc?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&((r=t.callback)===null||r===void 0||r.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=p(p({},e.config.request_headers),t.headers),t.compression=t.compression==="best-available"?(s=e.compression)!==null&&s!==void 0?s:t.compressionFallback:t.compression,(E(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,((o,a)=>{var l,u,d;const c=p(p({},o),{},{callback:a??(v=>{var g;return(g=o.callback)===null||g===void 0?void 0:g.call(o,v)})});c.timeout=c.timeout||6e4;const h=(l=c.transport)!==null&&l!==void 0?l:"fetch";h==="sendBeacon"&&E(c.compression)&&c.data&&(c.compression=Me.Base64),c.method==="POST"&&c.data&&(c.timestampMode==="capture-body"?c.data=(v=>{var g,y;const x=(j(v)?v:[v]).map(b=>p(p({},b),b.timestamp instanceof Date&&!isNaN(b.timestamp.getTime())?{timestamp:b.timestamp.toISOString()}:{})),S=x[0];return{api_key:(g=S==null||(y=S.properties)===null||y===void 0?void 0:y.token)!==null&&g!==void 0?g:S?.token,batch:x,sent_at:new Date().toISOString()}})(c.data):c.timestampMode==="body"&&(c.data=((v,g=new Date().toISOString())=>j(v)?v.map(y=>p(p({},y),{},{sent_at:g})):p(p({},v),{},{sent_at:g}))(c.data))),c.url=ba(c.url,c.method,c.compression,c.timestampMode);const f=op.filter(v=>!c.disableTransport||!v.transport||!c.disableTransport.includes(v.transport)),_=(u=(d=(function(v,g){for(let y=0;v.length>y;y++)if(g(v[y]))return v[y]})(f,v=>v.transport===h))===null||d===void 0?void 0:d.method)!==null&&u!==void 0?u:f[0].method;if(!_)throw new Error("No available transport method");const m=v=>{try{_(v)}catch(y){var g;gc(y)?F.warn(y):F.error(y),(g=c.callback)===null||g===void 0||g.call(c,{statusCode:0,error:y})}};h!=="sendBeacon"&&c.data&&c.compression===Me.GZipJS&&Hd&&typeof Promise<"u"&&!bs?rp(c).then(v=>{m(v)}).catch(v=>{if(qo(v))return bs=!0,void m(p(p({},c),{},{compression:void 0,url:ba(o.url,o.method,void 0,o.timestampMode)}));(g=>{if(!g||typeof g!="object")return!1;const y="name"in g?String(g.name):"";return qo(g)||y===ou})(v)&&(bs=!0),m(c)}):_(c)})(t,(o,a)=>{var l,u,d;e.rateLimiter.checkForLimiting(o),400>o.statusCode||(l=(u=e.config).on_request_error)===null||l===void 0||l.call(u,o),i?i(o,a):(d=t.callback)===null||d===void 0||d.call(t,o)})):t.fireCallbackOnDrop&&((n=t.callback)===null||n===void 0||n.call(t,{statusCode:0}))}var ap=class{constructor(e,t){this.ia=!0,this.na=[],this.sa=Ge(t?.flush_interval_ms||3e3,250,5e3,F.createLogger("flush interval"),3e3),this.ra=e}enqueue(e){this.na.push(e),this.oa||this.la()}unload(){this.aa();const e=this.na.length>0?this.ua():{},t=Object.values(e);[...t.filter(i=>i.url.indexOf("/e")===0),...t.filter(i=>i.url.indexOf("/e")!==0)].map(i=>{this.ha(i,"sendBeacon")})}enable(){this.ia=!1,this.la()}la(){this.ia||(this.oa=setTimeout(()=>{if(this.aa(),this.na.length>0){const e=this.ua();for(const t in e)this.ha(e[t])}},this.sa))}ha(e,t){try{this.ra(e,t)}catch(i){F.error(i)}}aa(){clearTimeout(this.oa),this.oa=void 0}ua(){const e={};return ne(this.na,t=>{var i;const s=t,r=((s?s.batchKey:null)||s.url)+(s.batchGroup?`:${s.batchGroup}`:"");E(e[r])&&(e[r]=p(p({},s),{},{data:[]})),(i=e[r].data)===null||i===void 0||i.push(s.data)}),this.na=[],e}};const lp=["retriesPerformedSoFar"];var up=class{constructor(e){this._instance=e,this.ca=!1,this.da=3e3,this.na=[],this.na=[],this.va=!0,this.resume()}resume(){if(!E(w)&&"onLine"in w.navigator){if(this.va=w.navigator.onLine,this.fa)return;this.fa=()=>{this.va=!0,this.pa()},this.ga=()=>{this.va=!1},se(w,"online",this.fa),se(w,"offline",this.ga)}}get length(){return this.na.length}retriableRequest(e,t){let{retriesPerformedSoFar:i}=e,s=au(e,lp);Ye(i)&&(s.url=Qi(s.url,{retry_count:i})),wc(this._instance,t?p(p({},s),{},{transport:t}):s,(r,n)=>{var o;if(r.statusCode!==200&&(400>
3r.statusCode||r.statusCode>=500)){if((r.statusCode===0?3:10)>(i??0))return void this.Ls(p({retriesPerformedSoFar:i},s),n);r.statusCode===0&&F.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${i??0} retries.`)}(o=s.callback)===null||o===void 0||o.call(s,r)})}Ls(e,t){const i=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=i+1;const s=Math.max((function(o){const a=3e3*Math.pow(2,o),l=a/2,u=Math.min(18e5,a),d=(Math.random()-.5)*(u-l);return Math.ceil(u+d)})(i),t??0),r=Date.now()+s;this.na.push({retryAt:r,requestOptions:e});let n=`Enqueued failed request for retry in ${s}`;navigator.onLine||(n+=" (Browser is offline)"),F.warn(n),this.ca||(this.ca=!0,this.ma())}ma(){if(this.ya&&clearTimeout(this.ya),this.na.length===0)return this.ca=!1,void(this.ya=void 0);this.ya=setTimeout(()=>{this.va&&this.na.length>0&&this.pa(),this.ma()},this.da)}pa(){const e=Date.now(),t=[],i=this.na.filter(s=>e>s.retryAt||(t.push(s),!1));if(this.na=t,i.length>0)for(const{requestOptions:s}of i)this.retriableRequest(s)}unload(){this.ya&&(clearTimeout(this.ya),this.ya=void 0),this.ca=!1,E(w)||(this.fa&&(w.removeEventListener("online",this.fa),this.fa=void 0),this.ga&&(w.removeEventListener("offline",this.ga),this.ga=void 0));for(const{requestOptions:e}of this.na)try{this._instance._send_request(p(p({},e),{},{transport:"sendBeacon"}))}catch(t){F.error(t)}this.na=[]}},cp=class{constructor(e){this._instance=e,this.ba=()=>{var t,i,s,r;this._a||(this._a={});const n=this.scrollElement(),o=this.scrollY(),a=n?Math.max(0,n.scrollHeight-n.clientHeight):0,l=o+(n?.clientHeight||0),u=n?.scrollHeight||0;this._a.lastScrollY=Math.ceil(o),this._a.maxScrollY=Math.max(o,(t=this._a.maxScrollY)!==null&&t!==void 0?t:0),this._a.maxScrollHeight=Math.max(a,(i=this._a.maxScrollHeight)!==null&&i!==void 0?i:0),this._a.lastContentY=l,this._a.maxContentY=Math.max(l,(s=this._a.maxContentY)!==null&&s!==void 0?s:0),this._a.maxContentHeight=Math.max(u,(r=this._a.maxContentHeight)!==null&&r!==void 0?r:0)}}get wa(){return this._instance.config.scroll_root_selector}getContext(){return this._a}resetContext(){const e=this._a;return this._a=void 0,setTimeout(this.ba,0),e}startMeasuringScrollPosition(){se(w,"scroll",this.ba,{capture:!0}),se(w,"scrollend",this.ba,{capture:!0}),se(w,"resize",this.ba)}scrollElement(){if(this.wa){const i=j(this.wa)?this.wa:[this.wa];for(const s of i){var e;const r=w==null||(e=w.document)===null||e===void 0?void 0:e.querySelector(s);if(r)return r}return}var t;return w==null||(t=w.document)===null||t===void 0?void 0:t.documentElement}ka(e){var t,i;const s=e==="y"?"scrollTop":"scrollLeft";if(this.wa){const r=this.scrollElement();return r&&r[s]||0}return w?e==="y"?w.scrollY||w.pageYOffset||((t=w.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.scrollTop)||0:w.scrollX||w.pageXOffset||((i=w.document)===null||i===void 0||(i=i.documentElement)===null||i===void 0?void 0:i.scrollLeft)||0:0}scrollY(){return this.ka("y")}scrollX(){return this.ka("x")}};const dp=e=>tc(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties,e?.config.disable_capture_url_hashes);var wa=class{constructor(e,t,i,s){this.Be=r=>{const n=this.Sa();if(n&&n.sessionId===r)return;const o={sessionId:r,props:this.xa(this._instance)};this.Ca.register({[dn]:o})},this._instance=e,this.$a=t,this.Ca=i,this.xa=s||dp,this.$a.onSessionId(this.Be)}Sa(){return this.Ca.props[dn]}getSetOnceProps(){var e;const t=(e=this.Sa())===null||e===void 0?void 0:e.props;return t?"r"in t?ic(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){const e={};return ne(Vn(this.getSetOnceProps()),(t,i)=>{i==="$current_url"&&(i="url"),e[`$session_entry_${Jr(i)}`]=t}),e}},Bs=class{on(e,t){return this.Ia[e]||(this.Ia[e]=[]),this.Ia[e].push(t),()=>{this.Ia[e]=this.Ia[e].filter(i=>i!==t)}}emit(e,t){for(const i of this.Ia[e]||[])i(t);for(const i of this.Ia["*"]||[])i(e,t)}constructor(){this.Ia={}}
3};const Ht=pe("[SessionId]"),$a=864e5;var xa=class{on(e,t){return this.Ta.on(e,t)}constructor(e,t,i){var s;if(this.Ma=null,this.Ea=null,this.Pa=[],this.Ra=void 0,this.Aa=!1,this.Ta=new Bs,this.Fa=(n,o)=>!(!Ye(n)||!Ye(o))&&Math.abs(n-o)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Ir=e.config,this.Ca=e.persistence,this.He=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.Oa=void 0,this._sessionActivityTimestamp=null,this.Da=t||qe,this.La=i||qe;const r=this.Ir.persistence_name||this.Ir.token;if(this._sessionTimeoutMs=1e3*Ge(this.Ir.session_idle_timeout_seconds||1800,60,36e3,Ht.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Na(),this.qa="ph_"+r+"_window_id",this.ja="ph_"+r+"_primary_window_exists",this.Ba()){const n=ae.Dt(this.qa),o=ae.Dt(this.ja);n&&!o?this.He=n:ae.Lt(this.qa),ae.At(this.ja,!0)}!((s=this.Ir.bootstrap)===null||s===void 0)&&s.sessionID&&this.setBootstrapSessionId(this.Ir.bootstrap.sessionID),this.Ha()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return E(this.Pa)&&(this.Pa=[]),this.Pa.push(e),this.Xt&&e(this.Xt,this.He),()=>{this.Pa=this.Pa.filter(t=>t!==e)}}Ba(){return this.Ir.persistence!=="memory"&&!this.Ca.mi&&ae.Et()}za(e){e!==this.He&&(this.He=e,this.Ba()&&ae.At(this.qa,e))}Ua(){return this.He?this.He:this.Ba()?ae.Dt(this.qa):null}Wa(e){const t=this.Ma;return!ve(t)&&!ve(e)&&5e3>Math.abs(e-t)}Va(e,t,i){const s=t!==this._sessionActivityTimestamp,r=!(e!==this.Xt||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Xt=e,r&&!s||r&&this.Wa(t)||(this.Ma=t,this.Ca.register({[Gt]:[t,e,i]}))}Ga(){var e;const t=(e=this.Ir)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return Ye(t)&&t>0}Za(){this.Ga()?this.Ca.refreshKey(Gt):(this.Ca.flush(),this.Ca.load())}Qa(){var e;if(ve(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Ma)return;this.Za();const[,t,i]=this.Ja();t===this.Xt&&i===this._sessionStartTimestamp&&(this.Ma=this._sessionActivityTimestamp,this.Ca.register({[Gt]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Ca.flush())}Ka(){const[e]=this.Ja(),t=Ye(e)?e:0,i=Ye(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,i)}Xa(e){return this.Za(),this.Fa(e,this.Ka())}Ja(){const e=this.Ca.props[Gt];return j(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ma=null,this.Oa=void 0,clearTimeout(this.Ya),this.Ya=void 0,this.Va(null,null,null)}setBootstrapSessionId(e,t=!1){const i=((s,r=new Date().getTime())=>{try{const n=(o=>{const a=o.replace(/-/g,"");if(a.length!==32)throw new Error("Not a valid UUID");if(a[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(a.substring(0,12),16)})(s);return n>r+6e4?void Ht.error("Bootstrap sessionID cannot be in the future"):n}catch(n){return void Ht.error("Invalid sessionID in bootstrap",n)}})(e);return!E(i)&&(t?this.Oa={sessionId:e,sessionStartTimestamp:i}:this.Va(e,new Date().getTime(),i),!0)}destroy(){this.Aa=!0,this.Qa(),clearTimeout(this.Ya),this.Ya=void 0,this.Ra&&w&&(w.removeEventListener(Rs,this.Ra,{capture:!1}),this.Ra=void 0),this.Pa=[]}Ha(){this.Ra=()=>{this.Qa(),this.Ba()&&ae.Lt(this.ja)},se(w,Rs,this.Ra,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,i=!1){if(this.Ir.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const s=t||new Date().getTime(),r=this.Xt;if(i)this.Ea=s;else if(ve(this.Ea)||this.Ea>s||s-this.Ea>=1e3){var n,o;(n=(o=this.Ca).syncCookieProperties)===null||n===void 0||n.call(o),this.Ea=s}let[,a,l]=this.Ja();const u=!E(r)&&a!==r,d=this.Ka();let c=this.Ua();const h=this.Oa,f=!!h&&(h.sessionStartTimestamp>s+6e4||s-h.sessionStartTimestamp>$a),_=h?f:Ye(l)&&Math.abs(s-l)>$a;let m=!1,v=u;const g=!a||!!h,y=a;let x=!g&&!e&&this.Fa(s,d);if(x&&(x=this.Xa(s),x||Ht.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,l]=this.Ja()),g||x||_){v=!1;const C=h&&!f;a=C?h.sessionId:this.Da(),c=this.La(),Ht.info("new session ID assigned",{sessionId:a,windowId:c,bootstrapped:!!C,changeReason:{noSessionId:g,activityTimeout:x,sessionPastMaximumLength:_}}),l=C?h.sessionStartTimestamp:s,this.Oa=void 0,m=!0}else c||(c=this.La(),m=!0),v=v||a!==y,v&&(Ht.info("adopted cross-tab session id",{sessionId:a,windowId:c}),m=!0);const S=Ye(d)&&e&&!_?d:s,b=Ye(l)?l:new Date().getTime();this.za(c),this.Va(a,S,b),e||this.Na();
3const O={noSessionId:g,activityTimeout:x,sessionPastMaximumLength:_,crossTabAdoption:v};return m&&this.Pa.forEach(C=>C(a,c,O)),{sessionId:a,windowId:c,sessionStartTimestamp:b,changeReason:m?O:void 0,lastActivityTimestamp:d}}Na(){this.Aa||(clearTimeout(this.Ya),this.Ya=setTimeout(()=>{if(!this.Aa)if(this.Xa(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Ta.emit("forcedIdleReset",{idleSessionId:e})}else this.Na()},1.1*this.sessionTimeoutMs))}};const $c=function(e,t){if(!e)return!1;const i=e.userAgent;if(i&&So(i,t))return!0;try{const s=e?.userAgentData;if(s?.brands&&s.brands.some(r=>So(r?.brand,t)))return!0}catch{}return!!e.webdriver};function xc(){return(xc=ue(function*(){const e=we?.userAgentData;if(e?.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),i=t?.model;return Y(i)&&i.length>0?i:void 0}catch(t){return void F.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}})).apply(this,arguments)}function hp(e,t){let i=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(i=`$survey_${t}/${e.id}/${e.current_iteration}`),i}function Ec(e){var t;return!!(!((t=e.conditions)===null||t===void 0||(t=t.events)===null||t===void 0||(t=t.values)===null||t===void 0)&&t.length)}const Hs=(e,t)=>{if(!(i=>{try{new RegExp(i)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},ds=e=>e.toLowerCase(),kc={exact:(e,t)=>t.some(i=>e.some(s=>i===s)),is_not:(e,t)=>t.every(i=>e.every(s=>i!==s)),regex:(e,t)=>t.some(i=>e.some(s=>Hs(i,s))),not_regex:(e,t)=>t.every(i=>e.every(s=>!Hs(i,s))),icontains:(e,t)=>t.map(ds).some(i=>e.map(ds).some(s=>i.includes(s))),not_icontains:(e,t)=>t.map(ds).every(i=>e.map(ds).every(s=>!i.includes(s))),gt:(e,t)=>t.some(i=>{const s=parseFloat(i);return!isNaN(s)&&e.some(r=>s>parseFloat(r))}),lt:(e,t)=>t.some(i=>{const s=parseFloat(i);return!isNaN(s)&&e.some(r=>s<parseFloat(r))})};function Sc(e,t){return!e||Object.entries(e).every(([i,s])=>{const r=t?.[i];if(r==null)return!1;const n=kc[s.operator];return!!n&&n(s.values,[String(r)])})}function Mr(e,t,i){return Xt({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}const $n="custom",Ea="i.posthog.com",fp=/^\/static\//,pp=["/s/","/e/","/i/"];var vp=class{constructor(e){this.tu={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${Ea}`,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.tu[this.apiHost]||(this.tu[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":$n),this.tu[this.apiHost]}eu(e){if(!fp.test(e))return;const t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}iu(e){const t=yt(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}nu(e,t,i){if(e==="ui")return i;let s=i;const r=this.instance.config.rewriteRequestPath;if(r){var n;const o=((n=yt(i))===null||n===void 0?void 0:n.href)||i;s=r(new URL(o)).toString()}if(r&&e==="api"&&pp.some(o=>t.indexOf(o)===0)){const o=this.iu(s);if(o){const a=this.apiHost;let l=this.su;l?.apiHost===a&&l.rewriteRequestPath===r||(l={apiHost:a,rewriteRequestPath:r,urls:new Set},this.su=l),l.urls.add(o)}}return s}isIngestionEndpoint(e){const t=this.su,i=this.iu(e);return t?.apiHost===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!i&&t.urls.has(i)}endpointFor(e,t=""){if(t&&(t=t[0]==="/"?t:`/${t}`),e==="ui")return this.nu(e,t,this.uiHost+t);if(e==="flags")return this.nu(e,t,this.flagsApiHost+t);if(e==="assets"){const s=this.eu(t);if(s)return this.nu(e,t,`${s}${t}`)}if(this.region===$n)return this.nu(e,t,this.apiHost+t);const i=Ea+t;switch(e){case"assets":return this.nu(e,t,`https://${this.region}-assets.${i}`);case"api":return this.nu(e,t,`https://${this.region}.${i}`)}}};const re=pe("[Surveys]"),Ic=e=>{try{const t=(i=>((s,r)=>`seenSurvey_${(function(n){return n.current_iteration&&n.current_iteration>0?`${n.id}_${n.current_iteration}`:n.id})(r)}`)(0,i))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(t){re.error("Failed to persist survey seen state",t)}},gp=[Sr.Popover,Sr.Widget,Sr.API],_p={ignoreConditions:!1,ignoreDelay:!1,displayType:_n.Popover}
3,mp=pe("[PostHog ExternalIntegrations]"),yp={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};var bp=class{constructor(e){this._instance=e}qo(e,t){var i,s;(i=L.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,e,r=>{if(r)return mp.error("failed to load script",r);t()})}startIfEnabledOrStop(){var e;for(const[r,n]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var t,i,s;n&&!(!((t=L.__PosthogExtensions__)===null||t===void 0||(t=t.integrations)===null||t===void 0)&&t[r])&&this.qo(yp[r],()=>{var o;(o=L.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0||(o=o[r])===null||o===void 0||o.start(this._instance)}),!n&&(!((i=L.__PosthogExtensions__)===null||i===void 0||(i=i.integrations)===null||i===void 0)&&i[r])&&((s=L.__PosthogExtensions__)===null||s===void 0||(s=s.integrations)===null||s===void 0||(s=s[r])===null||s===void 0||s.stop())}}},wp=class{constructor(e,t){this.$=e,this.mo=t,this.ru=new Map,this.xo=!1}add(e){var t=this;return ue(function*(){if(t.xo)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.ru.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);t.ru.set(e.name,e);try{const i=e.setup(t.mo);i&&(yield i)}catch(i){const s=t.ru.get(e.name)===e;s&&t.ru.delete(e.name),t.$.error(`Failed to set up browser extension "${e.name}"`,i),s&&t.ou(e)}})()}getExtension(e){return this.ru.get(e)}dispose(){if(this.xo)return;this.xo=!0;const e=Array.from(this.ru.values()).reverse();this.ru.clear();for(const t of e)this.ou(t)}ou(e){try{var t;const i=(t=e.dispose)===null||t===void 0?void 0:t.call(e);i&&be(i.then)&&i.then(void 0,s=>{this.$.error(`Failed to dispose browser extension "${e.name}"`,s)})}catch(i){this.$.error(`Failed to dispose browser extension "${e.name}"`,i)}}},$p=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if(typeof e=="string")return t?.get_property(e);const i={};for(const s of e){const r=t?.get_property(s);E(r)||(i[s]=r)}return i}set(e,t){var i;(i=this._instance.persistence)===null||i===void 0||i.register(typeof e=="string"?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)===null||t===void 0||t.unregister(e)}};const ka="extensionsRemoteConfig";var xp=class{constructor(e){this.instance=e,this.xo=!1,this.$=F,this.lu=e.au,this.kv=new $p(e),this.onEvent=t=>cs(this.instance.on("eventCaptured",i=>{try{t({event:i.event,properties:i.properties})}catch(s){this.$.error("Browser extension event listener failed",s)}})),this.onRemoteConfig=t=>{if(this.xo)return cs(()=>{});const i=r=>{try{t(r)}catch(n){this.$.error("Browser extension remote config listener failed",n)}},s=this.instance.uu.on(ka,i);return this.lu&&i(this.lu),cs(s)},this.hu=new wp(F.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){const e=this.instance.get_property(Dn);return typeof e=="string"?e:void 0}get library(){return{name:ye.LIB_NAME,version:ye.LIB_VERSION}}get initialPersonProperties(){var e,t;return(e=(t=this.instance.persistence)===null||t===void 0?void 0:t.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s;const r=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=r?.sessionId)!==null&&t!==void 0?t:"",windowId:(i=r?.windowId)!==null&&i!==void 0?i:"",sessionStartTimestamp:(s=r?.sessionStartTimestamp)!==null&&s!==void 0?s:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.hu.add(e)}getExtension(e){return this.hu.getExtension(e)}capture(e,t,i){i?this.instance.capture(e,t,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):this.instance.capture(e,t)}registerDynamicEventProperties(e){return cs(this.instance.cu(e))}handleRemoteConfig(e){this.xo||(this.lu=e,this.instance.uu.emit(ka,e))}sendRequest(e){var t=this;return ue(function*(i,s={}){var r;const n=t.instance.requestRouter.endpointFor((r=s.target)!==null&&r!==void 0?r:"api",i),o={method:s.method,url:s.query?Qi(n,s.query):n,data:s.body,headers:s.headers,timeout:s.timeoutMs,fireCallbackOnDrop:!0,transport:s.transport,compression:s.compression,compressionFallback:s.target==="flags"&&s.compression==="best-available"?Gr.Base64:void 0,timestampMode:s.sentAt};return s.transport==="sendBeacon"?(t.instance._send_request(o),{statusCode:202}):new Promise(a=>{o.callback=a,t.instance._send_request(o)})}).apply(this,arguments)}dispose(){this.xo||(this.xo=!0,this.hu.dispose())}};const Ni={};let Ar=0;const ji=()=>{}
3,Sa='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Ei="Surveys module not available",Ia="sanitize_properties is deprecated. Use before_send instead",Pc="Invalid value for property_denylist config: ",Ep=/^[A-Za-z0-9_-]{1,400}$/,Pa=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,Oa=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,kp=["token","distinct_id",Ou],Pi="posthog",Sp=e=>{const t={};return e&&e!=="unset"&&("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0)),t},Tr=e=>{var t;return p({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:kf(I?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ji,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:he&&Y(he?.search)&&he.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,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(w==null||(t=w.location)===null||t===void 0?void 0:t.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(i){F.error("Bad HTTP status: "+i.statusCode+" "+i.text)},get_device_id:i=>i,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Au,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:ji},(i=>({rageclick:i&&i>="2026-05-30"?{content_ignorelist:Af,ignore_text_selection:!0}
3:!i||"2025-11-30">i||{content_ignorelist:!0},capture_pageview:!i||"2025-05-24">i||"history_change",session_recording:Sp(i),external_scripts_inject_target:i&&i>="2026-01-30"?"head":"body",internal_or_test_user_hostname:i&&i>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:i&&i>="2026-05-30"?250:0,split_storage:!(!i||"2026-05-30">i),detect_google_search_app:!(!i||"2026-05-30">i),disable_capture_url_hashes:!(!i||"2026-06-25">i),cookieWinsOnConflict:!(!i||i==="unset"||"2026-08-29">i)}))(e))},Ip=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],Ca=e=>{const t={};for(const[r,n]of Ip)E(e[r])||(t[n]=e[r]);const i=le({},t,e),s=e.__preview_external_dependency_versioned_paths;return E(s)||(E(e.strict_script_versioning)&&(i.strict_script_versioning=!!s),Y(s)&&E(e.asset_host)&&(i.asset_host=s)),j(e.property_blacklist)&&(E(e.property_denylist)?i.property_denylist=e.property_blacklist:j(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:F.error(Pc+e.property_denylist)),i};var Pp=class{constructor(){this.__forceAllowLocalhost=!1}get du(){return this.__forceAllowLocalhost}set du(e){F.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},qi=class ut{vu(t){if(!t)return;const i=this.ru.indexOf(t);i!==-1&&this.ru.splice(i,1)}fu(t,i){var s;return this.vu(t),this.ru.push(i),(s=i.initialize)===null||s===void 0||s.call(i),i}pu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}gu(){if(this.mu||this.config.reuseAnonymousId||this.config.segment||this.pu())return;const t=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!t&&!this.config.disable_persistence||this.yu)return;let i,s,r;t?(i=`persistence is set to '${this.config.persistence}'`,s=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",r="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(i="persistence is disabled (disable_persistence is true)",s="on every page load",r="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.mu=!0,console.warn("[PostHog.js]",`${i} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${s}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${r}`)}bu(){if(this.pu()||this.get_distinct_id()!=="$posthog_cookieless")return;const t=this.persistence;if(!t)return;this._u()||t.load(!0);const i=this.get_distinct_id();if(!i||i==="$posthog_cookieless"){const s=this.config.get_device_id(qe());this.register({distinct_id:s,$device_id:s}),t.set_property(Ie,et)}this.wu()}get decideEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.ku=!1,this.Su=!1,this.webPerformance=new Pp,this.xu=!1,this.version=ye.LIB_VERSION,this.Cu=new Set,this.$u="",this.uu=new Bs,this.ru=[],this.Iu=[],this.yu=!1,this.mu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Tr(),this.SentryIntegration=Bf,this.sentryIntegration=s=>(function(r,n){const o=Gu(r,n);return{name:Wu,processEvent:a=>o(a)}})(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Tu=!1,this.Mu=null,this.Eu=null,this.Pu=null,this.scrollManager=new cp(this),this.pageViewM
3anager=new da(this),this.rateLimiter=new Yf(this),this.requestRouter=new vp(this),this.consent=new Mf(this),this.externalIntegrations=new bp(this);const i=(t=ut.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(s,r,n)=>{const o=Y(s)?{[s]:r}:s;this.setPersonProperties(o),n?.({})},set_once:(s,r,n)=>{const o=Y(s)?{[s]:r}:s;this.setPersonProperties(void 0,o),n?.({})}},this.on("eventCaptured",s=>F.info(`send "${s?.event}"`,s))}init(t,i,s){if(s&&s!==Pi){var r;const n=(r=Ni[s])!==null&&r!==void 0?r:new ut;return n._init(t,i,s),Ni[s]=n,Ni[Pi][s]=n,n}return this._init(t,i,s)}_init(t,i={},s){var r,n,o;const a=Y(t)?t.trim():"";if(!a)return F.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var l;if(this.__loaded)return a!==((l=this.config)===null||l===void 0?void 0:l.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=Tr(i.defaults),i.debug=this.Ru(i.debug),this.Au=i,this.Fu=[],i.person_profiles?this.Eu=i.person_profiles:i.process_person&&(this.Eu=i.process_person);const u=Tr(i.defaults),d=Ca(i),c=le({},u,d,{name:s,token:a});Q(u.rageclick)&&Q(d.rageclick)&&(c.rageclick=le({},u.rageclick,d.rageclick)),Q(u.session_recording)&&Q(d.session_recording)&&(c.session_recording=le({},u.session_recording,d.session_recording)),this.set_config(c),this.config.on_xhr_error&&F.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Me.GZipJS;const h=this._u();if(this.persistence=new kr(this.config,h),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new kr(p(p({},this.config),{},{persistence:"sessionStorage"}),h,!1),this.$u="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!h&&ae.Et()){const g=ae.Dt(this.$u);j(g)&&g.forEach(y=>{Y(y)&&this.Cu.add(y)})}else ae.Lt(this.$u);const f=p({},this.persistence.props),_=p({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Ou=new ap((g,y)=>this.Du(g,y),this.config.request_queue_config),this.Lu=new up(this),this.__request_queue=[];const m=this.pu();m||(this.sessionManager=new xa(this),this.sessionPropsManager=new wa(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((g,y,x)=>{(x?.activityTimeout||x?.sessionPastMaximumLength||x?.crossTabAdoption)&&this.Nu()})),this.qu(),this.config.__preview_deferred_init_extensions?(F.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.ju(m)},0)):(F.info("Initializing extensions synchronously"),this.ju(m)),ye.DEBUG=ye.DEBUG||this.config.debug,ye.DEBUG&&F.info("Starting in debug mode",{this:this,config:i,thisC:p({},this.config),p:f,s:_}),this.config.identity_distinct_id&&!(!((r=i.bootstrap)===null||r===void 0)&&r.distinctID)&&(i.bootstrap=p(p({},i.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const v=(n=i.bootstrap)===null||n===void 0?void 0:n.distinctID;if(this.yu=!!v&&!Ci(v),(o=i.bootstrap)===null||o===void 0?void 0:o.distinctID){const g=i.bootstrap.distinctID,y=this.get_distinct_id(),x=this.persistence.get_property(Ie);if(i.bootstrap.isIdentifiedID&&y!=null&&y!==g&&x==="anonymous")this.identify(g);else if(i.bootstrap.isIdentifiedID&&y!=null&&y!==g&&x==="identified")F.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{const S=this.config.get_device_id(qe()),b=i.bootstrap.isIdentifiedID?S:g;this.persistence.set_property(Ie,i.bootstrap.isIdentifiedID?ms:et),this.register({distinct_id:g,$device_id:b})}}if(m)this.register_once({distinct_id:_r,$device_id:null},"");else if(!this.get_distinct_id()){const g=this.config.get_device_id(qe());this.register_once({distinct_id:g,$device_id:g},""),this.persistence.set_property(Ie,et)}return se(w,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),se(w,"pageshow",()=>{var g;this.ku=!1,this.Su||(g=this.Lu)===null||g===void 0||g.resume()}),i.segment?ca(this,()=>this.Bu()):this.Bu(),be(this.config._onCapture)&&this.config._onCapture!==ji&&(F.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",g=>this.config._onCapture(g.event,g))),this.config.ip&&F.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.config.disableDeviceModel||(function(){return xc.apply(this,arguments)})().then(g=>{g&&this.register({[gr]:g})}).catch(ji),this}Hu(t){const i=t;return Y(i.name)&&be(i.setup)}zu(t,i){this.Hu(t)?i.push(()=>
3{this.Uu().add(t).catch(()=>{var s;return(s=t.dispose)===null||s===void 0?void 0:s.call(t)}).catch(s=>{F.error(`Failed to dispose browser extension "${t.name}"`,s)})}):this.ru.push(t)}qu(){var t,i,s;const r=(t=(i=this.config.__extensionClasses)===null||i===void 0?void 0:i.featureFlags)!==null&&t!==void 0?t:(s=ut.__defaultExtensionClasses)===null||s===void 0?void 0:s.featureFlags;var n,o,a;r&&(this.featureFlags&&this.featureFlags instanceof r||((n=this.Wu)===null||n===void 0||n.call(this),this.Wu=void 0,this.featureFlags=new r(this)),be(this.featureFlags.onReloading)&&be(this.featureFlags.setup)?this.Wu||(this.Wu=this.featureFlags.onReloading(()=>{this.uu.emit("featureFlagsReloading",!0)}),this.Uu().add(this.featureFlags)):(o=(a=this.featureFlags).initialize)===null||o===void 0||o.call(a))}ju(t){const i=performance.now(),s=p(p({},ut.__defaultExtensionClasses),this.config.__extensionClasses),r=[];var n,o,a,l,u,d,c;s.exceptions&&this.ru.push(this.exceptions=(n=this.exceptions)!==null&&n!==void 0?n:new s.exceptions(this)),s.historyAutocapture&&this.ru.push(this.historyAutocapture=new s.historyAutocapture(this)),s.tracingHeaders&&this.ru.push(this.tracingHeaders=new s.tracingHeaders(this)),s.siteApps&&this.ru.push(this.siteApps=new s.siteApps(this)),s.sessionRecording&&!t&&this.ru.push(this.sessionRecording=new s.sessionRecording(this)),this.config.disable_scroll_properties||r.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),s.autocapture&&this.zu(this.autocapture=new s.autocapture(this),r),s.surveys&&this.zu(this.surveys=(o=this.surveys)!==null&&o!==void 0?o:new s.surveys(this),r),s.logs&&this.zu(this.logs=(a=this.logs)!==null&&a!==void 0?a:new s.logs(this),r),s.metrics&&this.ru.push(this.metrics=(l=this.metrics)!==null&&l!==void 0?l:new s.metrics(this)),s.conversations&&this.ru.push(this.conversations=(u=this.conversations)!==null&&u!==void 0?u:new s.conversations(this)),s.productTours&&this.ru.push(this.productTours=new s.productTours(this)),s.heatmaps&&this.ru.push(this.heatmaps=new s.heatmaps(this)),s.webVitalsAutocapture&&this.ru.push(this.webVitalsAutocapture=new s.webVitalsAutocapture(this)),s.exceptionObserver&&this.ru.push(this.exceptionObserver=new s.exceptionObserver(this)),s.deadClicksAutocapture&&this.ru.push(this.deadClicksAutocapture=new s.deadClicksAutocapture(this,qf)),s.toolbar&&this.ru.push(this.toolbar=(d=this.toolbar)!==null&&d!==void 0?d:new s.toolbar(this)),s.experiments&&this.ru.push(this.experiments=(c=this.experiments)!==null&&c!==void 0?c:new s.experiments(this)),this.ru.forEach(h=>{h.initialize&&r.push(()=>{var f;(f=h.initialize)===null||f===void 0||f.call(h)})}),r.push(()=>{if(this.Vu){const h=this.Vu;this.Vu=void 0,this.ru.forEach(f=>{var _;return(_=f.onRemoteConfig)===null||_===void 0?void 0:_.call(f,h)})}}),this.Gu(r,i)}Gu(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout(()=>{this.Gu(t,i)},0);const r=t.shift();if(r)try{r()}catch(n){F.error("Error initializing extension:",n)}}const s=Math.round(performance.now()-i);this.register_for_session({[Cu]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Fu]:s}),this.config.__preview_deferred_init_extensions&&F.info(`PostHog extensions initialized (${s}ms)`)}Xl(t){var i;if(!I||!I.body)return F.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Xl(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Vu=t),this.au=t,this.compression=void 0,t.ok){var s;const r=t.config;r.supportedCompression&&!this.config.disable_compression&&(this.compression=q(r.supportedCompression,Me.GZipJS)?Me.GZipJS:q(r.supportedCompression,Me.Base64)?Me.Base64:void 0),!((s=r.analytics)===null||s===void 0)&&s.endpoint&&(this.analyticsDefaultEndpoint=r.analytics.endpoint)}this.set_config({person_profiles:this.Eu?this.Eu:Au}),(i=this.Zu)===null||i===void 0||i.handleRemoteConfig(t),this.ru.forEach(r=>{var n;return(n=r.onRemoteConfig)===null||n===void 0?void 0:n.call(r,t)})}Bu(){try{this.config.loaded(this)}catch(t){F.critical("`loaded` function failed",t)}if(this.Qu(),this.config.internal_or_test_user_hostname&&he?.hostname){const t=he.hostname,i=this.config.internal_or_test_user_hostname;(typeof i=="string"?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.pu())&&this.Ju()},1),this.Ku=new nc(this),this.Ku.load()}Qu(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.Ou)===null||t===void 0||t.enable())}_dom_loaded(){this.is_capturing()&&Kt(this.__request_queue,t=>this.Du(t)),this.__request_queue=[],this.Qu()}_handle_unload(){var t,i,s,r,n,o;this.ku=!0,(t=this.surveys)===null||t===void 0||(i=t.handlePageUnload)===null||i===void 0||i.call(t),(s=this.metrics)===null||s===void 0||s.flush("sendBeacon"),this.config.request_batching?(this.Xu()&&this.capture(Jo),(r=this.logs)===null||r===void 0||r.flushLogs("sendBeacon"),(n=this.Ou)===null||n===void 0||n.unload(),(o=this.Lu)===null||o===void 0||o.unload()):this.Xu()&&this.capture(Jo,null,{transport:"sendBeacon"})}_send_request(t){wc(this,t)}Du(t,i){this.Lu?this.Lu.retriableRequest(t,i):this._send_request(i?p(p({},t),{},{transport:i}):t)}_execute_array(t){Ar++;try{let i;const s=[],r=[],n=[];Kt(t,a=>{if(a)if(i=a[0],j(i))n.push(a);else if(be(a))try{a.call(this)}catch(l){F.error("Error executing queued PostHog call",a,l)}else j(a)&&i==="alias"?s.push(a):j(a)&&i.indexOf("capture")!==-1&&be(this[i])?n.push(a):r.push(a)});const o=function(a,l){Kt(a,function(u){try{if(j(u[0])){let d=l;
3ne(u,function(c){d=d[c[0]].apply(d,c.slice(1))})}else l[u[0]].apply(l,u.slice(1))}catch(d){F.error("Error executing queued PostHog call",u,d)}})};o(s,this),o(r,this),o(n,this)}finally{Ar--}}push(t){if(Ar>0&&j(t)&&Y(t[0])){const i=ut.prototype[t[0]];return void(be(i)&&i.apply(this,t.slice(1)))}this._execute_array([t])}get Yu(){return{property:Wo,persistenceKey:ii,cookieName:"_fbc",pattern:Pa,register:(t,i)=>{var s;return(s=this.persistence)===null||s===void 0?void 0:s.register({[ii]:{value:t,delivered:i}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(ii)}}}get th(){return{property:Go,persistenceKey:Mi,cookieName:"_fbp",pattern:Oa,register:(t,i)=>{var s;return(s=this.persistence)===null||s===void 0?void 0:s.register({[Mi]:{value:t,delivered:i}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(Mi)}}}eh(t){var i;const s=(i=this.persistence)===null||i===void 0?void 0:i.get_property(t.persistenceKey);return Y(s)&&t.pattern.test(s)?{value:s,delivered:!1}:Q(s)&&Y(s.value)&&t.pattern.test(s.value)?{value:s.value,delivered:s.delivered===!0}:void 0}ih(t,i,s){return i===s?.value?{value:i,pending:!s.delivered}:(t.register(i,!1),{value:i,pending:!0})}nh(t){if(!this.config.save_campaign_params||this.pu())return;const i=Ls(t.cookieName);return Y(i)&&t.pattern.test(i)?i:void 0}sh(t,i,s,r){if(!this.persistence)return;const n=this.Yu;this.persistence.refreshKey(n.persistenceKey);const o=this.eh(n);if(r)return void n.unregister();if(s)return Y(i)&&Pa.test(i)?this.ih(n,i,o):void n.unregister();const a=Y(t)&&Ep.test(t)?t:void 0,l=this.nh(n);return l&&((u,d,c)=>{const h=u.split(".");if(d)return h[3]===d;if(!c)return!0;const f=c.value.split(".");return h[3]===f[3]||Number(h[2])>Number(f[2])})(l,a,o)?this.ih(n,l,o):a?o?.value.split(".")[3]===a?{value:o.value,pending:!o.delivered}:this.ih(n,`fb.1.${Date.now()}.${a}`,o):o?{value:o.value,pending:!o.delivered}:void 0}rh(t,i,s){if(!this.persistence)return;const r=this.th;this.persistence.refreshKey(r.persistenceKey);const n=this.eh(r);if(s)return void r.unregister();if(i)return Y(t)&&Oa.test(t)?this.ih(r,t,n):void r.unregister();const o=this.nh(r);return o?this.ih(r,o,n):n?{value:n.value,pending:!n.delivered}:void 0}oh(t,i){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);const s=this.eh(t);s?.value!==i||s.delivered||t.register(i,!0)}capture(t,i,s){var r,n;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ou))return void F.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(E(t)||!Y(t))return void F.error("No event name provided to posthog.capture");this.bu();const o=!this.config.opt_out_useragent_filter&&this._is_bot();if(o&&!this.config.__preview_capture_bot_pageviews)return;const a=s?.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a?.isRateLimited)return void F.critical("This capture call is ignored due to client rate limiting.");let l;i?.$current_url&&!Y(i?.$current_url)&&(F.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),i==null||delete i.$current_url),t!=="$exception"||s?.ah||F.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&&(l=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();const u=new Date,d=s?.timestamp||u,c=Co(s?.uuid,qe);let h={uuid:c,event:t,properties:this.calculateEventProperties(t,i||{},d,c)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&o&&(h.event="$bot_pageview",h.properties.$browser_type="bot"),a&&(h.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens);const f=t==="$feature_flag_called"&&h.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;s?.$set&&!f&&(h.$set=s?.$set);const _=Q(i?.$set)?i.$set:void 0,m=j(i?.$unset)?i.$unset:[],v=s?.$unset||[],g=T=>{var A;const N=!!s?.$set&&T in s.$set;return{hasProvided:N||!!_&&T in _,provided:N?s==null||(A=s.$set)===null||A===void 0?void 0:A[T]:_?.[T],unset:m.indexOf(T)!==-1||v.indexOf(T)!==-1}},y=g(Wo),x=g(Go),S=[{channel:this.Yu,hasProvided:y.hasProvided,update:this.sh(l?.fbclid,y.provided,y.hasProvided,y.unset)},{channel:this.th,hasProvided:x.hasProvided,update:this.rh(x.provided,x.hasProvided,x.unset)}];for(const{channel:T,hasProvided:A,update:N}
3of S)N&&h.properties.$process_person_profile===!0&&N.pending&&!A&&!f&&(h.$set=p({[T.property]:N.value},h.$set));const b=s?.$unset;b&&(h.$unset=b);const O=f?void 0:this.uh(s?.$set_once,t!==Ko,t===Tu);if(O&&(h.$set_once=O),s?._noTruncate||(C=this.config.properties_string_max_length,h=(function(T,A){const N=new Set;return(function Z(ee,$){if(ee!==Object(ee))return A?A(ee):ee;if(N.has(ee))return;let k;if(N.add(ee),j(ee))k=[],Kt(ee,R=>{k.push(Z(R))});else{const R={};ne(pi(ee)?Ru(ee):ee,(H,W)=>{N.has(H)||(R[W]=Z(H))}),k=R}return k})(T)})(h,T=>Y(T)?T.slice(0,C):T)),h.timestamp=d,E(s?.timestamp)||(h.properties.$event_time_override_provided=!0,h.properties.$event_time_override_system_time=u),f&&(h.properties=((T,A=[])=>{const N={},Z=ee=>{T[ee]!==void 0&&(N[ee]=T[ee])};return Dh.forEach(Z),A.forEach(Z),N})(h.properties,kp)),t===tt.DISMISSED||t===tt.SENT){const T=i?.[Ir.SURVEY_ID],A=i?.[Ir.SURVEY_ITERATION];Ic({id:T,current_iteration:A}),h.$set=p(p({},h.$set),{},{[hp({id:T,current_iteration:A},t===tt.SENT?"responded":"dismissed")]:!0})}else t===tt.SHOWN&&(h.$set=p(p({},h.$set),{},{[Ir.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var C;if(t===Xf.SHOWN){const T=i?.[pa.TOUR_TYPE];T&&(h.$set=p(p({},h.$set),{},{[`${pa.TOUR_LAST_SEEN_DATE}/${T}`]:new Date().toISOString()}))}const P=p(p({},h.properties.$set),h.$set);if(Ce(P)||this.setPersonPropertiesForFlags(P),!z(this.config.before_send)){const T=this.Os(h);if(!T)return;h=T,h.uuid=Co(h.uuid,qe)}const M=S.filter(({channel:T,update:A})=>{var N,Z,ee;const $=(N=(Z=h.$set)===null||Z===void 0?void 0:Z[T.property])!==null&&N!==void 0?N:Q((ee=h.properties)===null||ee===void 0?void 0:ee.$set)?h.properties.$set[T.property]:void 0;return A?.pending&&$===A.value});this.uu.emit("eventCaptured",h);const D=(r=s?._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),U=s?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(D),B=p(p(p({method:"POST",url:D,data:h,compression:"best-available",timestampMode:U?"body":"capture-body",batchKey:s?._batchKey},U&&(!((n=h.properties)===null||n===void 0)&&n.$session_id)?{batchGroup:h.properties.$session_id+(h.properties.$window_id?`-${h.properties.$window_id}`:"")}:{}),s?.transport?{transport:s.transport}:{}),M.length?{fireCallbackOnDrop:!0,callback:T=>{if(T.statusCode>=200&&300>T.statusCode)for(const{channel:A,update:N}of M)this.oh(A,N.value)}}:{});if(!this.config.request_batching||s&&!s?._batchKey||s?.send_instantly||M.length){var K;let T;!B.transport&&!B.callback&&Ce((K=this.config.request_headers)!==null&&K!==void 0?K:{})&&this.ku&&(T="sendBeacon"),this.Du(B,T)}else this.Ou.enqueue(B);return h}_addCaptureHook(t){return this.on("eventCaptured",i=>t(i.event,i))}getExtension(t){var i;return(i=this.Zu)===null||i===void 0?void 0:i.getExtension(t)}Uu(){var t;return(t=this.Zu)!==null&&t!==void 0?t:this.Zu=new xp(this)}cu(t){this.Iu.push(t);let i=!0;return()=>{if(!i)return;i=!1;const s=this.Iu.indexOf(t);s!==-1&&this.Iu.splice(s,1)}}hh(t=!0){var i,s,r;
3return!!(!((i=this.persistence)===null||i===void 0)&&i.consumeCookieIdentityChange())&&(this.Pu=null,this.persistence.get_property("$user_state")==="anonymous"&&((r=this.sessionPersistence)===null||r===void 0||r.clear(),this.Cu.clear(),this.dh()),(s=this.featureFlags)===null||s===void 0||s.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,i,s,r,n){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return i;this.persistence.syncCookieProperties(),this.hh();const o=n?void 0:this.persistence.remove_event_timer(t);let a=p({},i);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.pu()&&(a[Ou]=!0),t==="$snapshot"){const y=p(p({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=y.distinct_id,(!Y(a.distinct_id)&&!ge(a.distinct_id)||Ci(a.distinct_id))&&F.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}const l=(function(y,x,S,b=!1){var O,C,P,M;if(!Se)return{};const D=y?[...ci,...x||[]]:[],[U,B]=Kl(Se),[K,T]=(function(V){for(let oe=0;Oo.length>oe;oe++){const[ie,ce,X]=Oo[oe],_e=V.match(ie);if(_e){const Re=X&&V.match(X)||_e;return[ce,Re?.[1]||""]}}return["",""]})(Se),A=(function(){const V="u">typeof navigator?navigator:void 0;return V?.brave?{brave:!0}:{}})(),N={};E(S)||(N.detectGoogleSearchApp=S);const Z={},ee=(O=navigator)===null||O===void 0||(O=O.userAgentData)===null||O===void 0?void 0:O.platform,$=(C=navigator)===null||C===void 0?void 0:C.maxTouchPoints,k=w==null||(P=w.screen)===null||P===void 0?void 0:P.width,R=w==null||(M=w.screen)===null||M===void 0?void 0:M.height,H=w?.devicePixelRatio;E(ee)||(Z.userAgentDataPlatform=ee),E($)||(Z.maxTouchPoints=$),E(k)||(Z.screenWidth=k),E(R)||(Z.screenHeight=R),E(H)||(Z.devicePixelRatio=H);const W=le(Vn({$os:U,$os_version:B,$browser:Jl(Se,navigator.vendor,A,N),$webview_app:K,$webview_app_version:T,$device:Xl(Se),$device_type:nh(Se,Z),$timezone:sc(),$timezone_offset:Gf()}),{$current_url:Ji(b?mt(he?.href):he?.href,D,Ki),$host:he?.host,$pathname:he?.pathname,$raw_user_agent:Se.length>1e3?Se.substring(0,997)+"...":Se,$browser_version:rh(Se,navigator.vendor,A,N),$browser_language:Qu(),$browser_language_prefix:Wf(),$screen_height:w?.screen.height,$screen_width:w?.screen.width,$viewport_height:w?.innerHeight,$viewport_width:w?.innerWidth,$lib:st.LIB_NAME,$lib_version:st.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return st.SDK_DIST_CHANNEL&&(W.$sdk_dist_channel=st.SDK_DIST_CHANNEL),W})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:y,windowId:x}=this.sessionManager.checkAndGetSessionAndWindowId(n,s.getTime(),!0);a.$session_id=y,a.$window_id=x}this.sessionPropsManager&&le(a,this.sessionPropsManager.getSessionProps());try{var u;this.sessionRecording&&le(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(u=this.Lu)===null||u===void 0?void 0:u.length}catch(y){a.$sdk_debug_error_capturing_properties=String(y)}let d;if(this.requestRouter.region===$n&&(a.$lib_custom_api_host=this.config.api_host),d=t!=="$pageview"||n?t!=="$pageleave"||n?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),a=le(a,d),t==="$pageview"&&I&&(a.title=I.title),!E(o)){const y=s.getTime()-o;a.$duration=parseFloat((y/1e3).toFixed(3))}Se&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");const c=this.persistence.properties(),h=this.sessionPersistence.properties(),f=a.$groups,_=c.$groups;Q(f)&&!Ce(f)&&(a.$groups=p(p({},Q(_)?_:{}),f)),ne(["$referrer","$referring_domain"],y=>{y in c&&delete h[y]});const m={};if(this.Iu.length>0)for(const y of this.Iu.slice())try{le(m,y())}catch(x){F.error("Failed to produce browser extension event properties",x)}a=le({},l,c,h,p(p({},m),a)),a.$is_identified=this._isIdentified(),j(this.config.property_denylist)?ne(this.config.property_denylist,function(y){delete a[y]}):F.error(Pc+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const v=this.config.sanitize_properties;v&&(F.error(Ia),a=v(a,t));const g=this.fh();return a.$process_person_profile=g,g&&!n&&this.ph("_calculate_event_properties"),a}uh(t,i=!0,s=!1){var r;if(!this.persistence||!this.fh()||this.xu&&!s)return t;const n=this.persistence.get_initial_props(),o=(r=this.sessionPropsManager)===null||r===void 0?void 0:r.getSetOnceProps();let a=le({},n,o||{},t||{});const l=this.config.sanitize_properties;return l&&(F.error(Ia),a=l(a,"$set_once")),i&&(this.xu=!0),Ce(a)?void 0:a}register(t,i){var s;(s=this.persistence)===null||s===void 0||s.register(t,i)}register_once(t,i,s){var r;(r=this.persistence)===null||r===void 0||r.register_once(t,i,s)}register_for_session(t){var i,s;(i=this.persistence)===null||i===void 0||i.syncCookieProperties(),this.hh(),(s=this.sessionPersistence)===null||s===void 0||s.register(t),Object.keys(t).forEach(r=>this.Cu.add(r)),this.dh()}unregister(t){var i;(i=this.persistence)===null||i===void 0||i.unregister(t)}unregister_for_session(t){var i;(i=this.sessionPersistence)===null||i===void 0||i.unregister(t),this.Cu.delete(t),this.dh()}gh(t,i){this.register({[t]:i})}Nu(){this.Cu.forEach(t=>{var i;(i=this.sessionPersistence)===null||i===void 0||i.unregister(t)}),this.Cu.clear(),this.dh()}dh(){var t;if(!this.$u)return;if(this.config.persistence==="memory"||!((t=this.sessionPersistence)===null||t===void 0)&&t.mi||!ae.Et())return void ae.Lt(this.$u);const i=[];this.Cu.forEach(s=>i.push(s)),i.length>0?ae.At(this.$u,i):ae.Lt(this.$u)}getFeatureFlag(t,i){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var s;return(s=this.featureFlags)===null||s===void 0?void 0:s.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return(t=(i=this.featureFlags)===null||i===void 0?void 0:i.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,i){var s,r;return(s=(r=this.featureFlags)===null||r===void 0?void 0:r.isFeatureEnabled(t,i))!==null&&s!==void 0?s:i?.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)===null||t===void 0||t.reloadFeatureFlags()}updateFlags(t,i,s){var r;(r=this.featureFlags)===null||r===void 0||r.updateFlags(t,i,s)}updateEarlyAccessFeatureEnrollment(t,i,s){var r;(r=this.featureFlags)===null||r===void 0||r.updateEarlyAccessFeatureEnrollment(t,i,s)}getEarlyAccessFeatures(t,i=!1,s){var r;return(r=this.featureFlags)===null||r===void 0?void 0:r.getEarlyAccessFeatures(t,i,s)}on(t,i){return this.uu.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Ei}),()=>{})}onSessionId(t){var i,s;return(i=(s=this.sessionManager)===null||s===void 0?void 0:s.onSessionId(t))!==null&&i!==void 0?i:()=>{}}getSurveys(t,i=!1){this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:Ei})}getActiveMatchingSurveys(t,i=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Ei})}renderSurvey(t,i){var s;(s=this.surveys)===null||s===void 0||s.renderSurvey(t,i)}displaySurvey(t,i=_p){var s;(s=this.surveys)===null||s===void 0||s.displaySurvey(t,i)}cancelPendingSurvey(t){var i;(i=this.surveys)===null||i===void 0||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,s;return(i=(s=this.surveys)===null||s===void 0?void 0:s.canRenderSurvey(t))!==null&&i!==void 0?i:{visible:!1,disabledReason:Ei}}canRenderSurveyAsync(t,i=!1){var s,r;return(s=(r=this.surveys)===null||r===void 0?void 0:r.canRenderSurveyAsync(t,i))!==null&&s!==void 0?s:Promise.resolve({visible:!1,disabledReason:Ei})}mh(t){return!t||Ci(t)?(F.critical("Unique user id has not been set in posthog.identify"),!1):t==="$posthog_cookieless"?(F.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(F.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID should be unique to the user and n
3ot a hardcoded string.`),!1)}identify(t,i,s){if(!this.__loaded||!this.persistence)return F.uninitializedWarning("posthog.identify");if(ge(t)&&(t=t.toString(),F.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.mh(t)||!this.ph("posthog.identify"))return;this.bu();const r=this.get_distinct_id(),n=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,o=this.hh(!1),a=this.persistence.Rl();let l=!1;try{const d=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:d},""),t!==d&&t!==this.get_property("__alias")&&(this.unregister(As),this.register({distinct_id:t}));const c=(this.persistence.get_property("$user_state")||"anonymous")===et,h=t!==d,f=!h&&c;if(h&&c){var u;const _=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:d};this.persistence.set_property(Ie,ms),this.setPersonPropertiesForFlags({$set:i||{},$set_once:s||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Al(),this.capture("$identify",_,{$set:i||{},$set_once:s||{}})&&(this.Pu=Mr(t,i,s)),(u=this.featureFlags)===null||u===void 0||u.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:d)}else if(f){this.persistence.set_property(Ie,ms);const _=i||{},m=s||{};this.setPersonPropertiesForFlags({$set:_,$set_once:m},!1),this.config.cookieWinsOnConflict&&this.persistence.Al(),this.capture("$set",{$set:_,$set_once:m})&&(this.Pu=Mr(t,i,s))}else(i||s)&&this.setPersonProperties(i,s);h||n||o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(vt)):f&&(i||s)&&this.reloadFeatureFlags(),l=!0}finally{a&&this.persistence.Dl(l)}}setPersonProperties(t,i){if(!t&&!i||!this.ph("posthog.setPersonProperties"))return;const s=Mr(this.get_distinct_id(),t,i);this.Pu!==s?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}})&&(this.Pu=s)):F.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var i;const s=(j(t)?t:[t]).filter(r=>Y(r)&&r.length>0);s.length!==0&&this.ph("posthog.unsetPersonProperties")&&((i=this.featureFlags)===null||i===void 0||i.unsetPersonPropertiesForFlags(s,!0),this.capture("$set",{$unset:s}),this.Pu=null)}group(t,i,s){var r;if(!t||!i)return void F.error("posthog.group requires a group type and group key");(r=this.persistence)===null||r===void 0||r.syncCookieProperties(),this.hh();const n=this.getGroups(),o=n[t]!==i;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p(p({},n),{},{[t]:i})}),(o||s)&&this.fh()){const a={$group_type:t,$group_key:i};s&&(a.$group_set=s),this.capture(Ko,a)}s&&this.setGroupPropertiesForFlags({[t]:s}),o&&!s&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i=!0){var s;(s=this.featureFlags)===null||s===void 0||s.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t=!0){var i;(i=this.featureFlags)===null||i===void 0||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i=!0){var s;this.ph("posthog.setGroupPropertiesForFlags")&&((s=this.featureFlags)===null||s===void 0||s.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;(i=this.featureFlags)===null||i===void 0||i.resetGroupPropertiesForFlags(t)}reset(t){const i=Pe(t)?t:t?.resetDeviceID,s=Pe(t)||t==null?void 0:t.bootstrap;this.yh(i,!1,s)}yh(t,i=!1,s){var r,n,o,a,l,u;if(F.info("reset"),!this.__loaded)return F.uninitializedWarning("posthog.reset");const d=s?.sessionID;this.config.bootstrap=s||((r=this.Au)===null||r===void 0?void 0:r.bootstrap)||{},(n=this.featureFlags)===null||n===void 0||(o=n.updateConfig)===null||o===void 0||o.call(n,this.config,this.Yl());const c=this.get_property(Dn),h=this.get_property(gr),f=this.get_property(Ai);(a=this.sessionRecording)===null||a===void 0||a.flushBeforeIdentityReset();const _=this.is_capturing();this.consent.reset(),i||!_||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const m=(l=this.persistence)===null||l===void 0||(u=l.Rl)===null||u===void 0?void 0:u.call(l);let v=!1;try{var g,y,x,S,b,O,C,P,M,D,U,B,K;if((g=this.persistence)===null||g===void 0||g.clear(),(y=this.sessionPersistence)===null||y===void 0||y.clear(),this.Cu.clear(),this.dh(),E(f)||(D=this.persistence)===null||D===void 0||D.register({$session_recording_remote_config:f}),(x=this.surveys)===null||x===void 0||x.reset(),(S=this.featureFlags)===null||S===void 0||S.reset(),(b=this.conversations)===null||b===void 0||b.reset(),(O=this.logs)===null||O===void 0||O.reset(),(C=this.metrics)===null||C===void 0||C.reset(),(P=this.persistence)===null||P===void 0||P.set_property("$user_state","anonymous"),(M=this.sessionManager)===null||M===void 0||M.resetSessionId(),this.Pu=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:_r,$device_id:null},"");else{const N=this.config.get_device_id(qe());this.register_once({distinct_id:N,$device_id:t?N:c},""),t||E(h)||this.register({[gr]:h})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),s&&(s.distinctID&&!this.pu()&&((K=this.persistence)===null||K===void 0||K.set_property("$user_state",s.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:s.distinctID})),(U=this.featureFlags)===null||U===void 0||U.initialize(),!z(d)&&!(!((B=this.sessionManager)===null||B===void 0)&&B.setBootstrapSessionId(d,!0)))){const N=p({},s);delete N.sessionID,this.config.bootstrap=N}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,v=!0}finally{var T,A;m&&((T=this.persistence)===null||T===void 0||(A=T.Dl)===null||A===void 0||A.call(T,v))}this.reloadFeatureFlags()}shutdown(t){var i=this;return ue(function*(){var s,r,n,o,a,l,u,d;if(i.__loaded){i.Su=!0,i.Uu().dispose(),(s=i.sessionRecording)===null||s===void 0||s.dispose(),(r=i.logs)===null||r===void 0||r.flushLogs("sendBeacon"),(n=i.metrics)===null||n===void 0||n.flush("sendBeacon"),(o=i.metrics)===null||o===void 0||o.dispose(),(a=i.Ou)===null||a===void 0||a.unload(),(l=i.Lu)===null||l===void 0||l.unload();try{var c;(c=i.featureFlags)===null||c===void 0||c.destroy()}catch(h){F.error("Error while destroying feature flags",h)}(u=i.persistence)===null||u===void 0||u.destroy(),(d=i.sessionPersistence)===null||d===void 0||d.destroy()}else F.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,i){var s;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),(s=this.conversations)===null||s===void 0||s.bh()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(t=this.conversations)===null||t===void 0||t._h()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return(t=(i=this.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:i,sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let r=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${i}`);if(t?.withTimestamp&&s){var n;const o=(n=t.timestampLookBack)!==null&&n!==void 0?n:10;if(!s)return r;r+=`?t=${Math.max(Math.floor((new Date().getTime()-s)/1e3)-o,0)}`}return r}alias(t,i){return t===this.get_property("$people_distinct_id")?(F.critical("Attempting to create alias for existing People user - aborting."),-2):this.ph("posthog.alias")?(E(i)&&(i=this.get_distinct_id()),t!==i?(this.gh(As,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(F.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const i=p({},this.config);if(Q(t)){var s,r,n,o,a,l,u,d,c,h,f,_,m,v;le(this.config,Ca(t));const y=this._u();(s=this.persistence)===null||s===void 0||s.update_config(this.config,i,y),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new kr(p(p({},this.config),{},{persistence:"sessionStorage"}),y,!1);const x=this.Ru(this.config.debug);var g;Pe(x)&&(this.config.debug=x),Pe(this.config.debug)&&(this.config.debug?(ye.DEBUG=!0,te.Et()&&te.At("ph_debug",!0),F.info("set_config",{config:t,oldConfig:i,newConfig:p({},this.config)})):(ye.DEBUG=!1,te.Et()&&te.Lt("ph_debug"))),(r=this.featureFlags)===null||r===void 0||(n=r.updateConfig)===null||n===void 0||n.call(r,this.config,this.Yl()),(o=this.exceptionObserver)===null||o===void 0||o.onConfigChange(),(a=this.exceptions)===null||a===void 0||a.onConfigChange(),(l=this.metrics)===null||l===void 0||l.onConfigChange(),(u=this.sessionRecording)===null||u===void 0||u.startIfEnabledOrStop(),(d=this.tracingHeaders)===null||d===void 0||d.startIfEnabledOrStop(),(c=this.autocapture)===null||c===void 0||c.startIfEnabled(),(h=this.heatmaps)===null||h===void 0||h.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((g=this.historyAutocapture)===null||g===void 0||g.startIfEnabledOrStop()),(f=this.exceptionObserver)===null||f===void 0||f.startIfEnabledOrStop(),(_=this.deadClicksAutocapture)===null||_===void 0||_.startIfEnabledOrStop(),(m=this.surveys)===null||m===void 0||m.loadIfEnabled(),this.wu(),(v=this.externalIntegrations)===null||v===void 0||v.startIfEnabledOrStop(),!i.segment&&this.config.segment&&this.persistence&&c
3a(this,ji,!1)}}_overrideSDKInfo(t,i){ye.LIB_NAME=t,ye.LIB_VERSION=i}startSessionRecording(t){const i=t===!0,s={sampling:i||!!t?.sampling,linked_flag:i||!!t?.linked_flag,url_trigger:i||!!t?.url_trigger,event_trigger:i||!!t?.event_trigger};var r,n,o,a,l;Object.values(s).some(Boolean)&&((r=this.sessionManager)===null||r===void 0||r.checkAndGetSessionAndWindowId(),s.sampling&&((n=this.sessionRecording)===null||n===void 0||n.overrideSampling()),s.linked_flag&&((o=this.sessionRecording)===null||o===void 0||o.overrideLinkedFlag()),s.url_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("url")),s.event_trigger&&((l=this.sessionRecording)===null||l===void 0||l.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!!(!((t=this.sessionRecording)===null||t===void 0)&&t.started)}captureException(t,i){try{if(!this.exceptions)return;const s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(p(p({},s),i))}catch{return}}addExceptionStep(t,i){var s;(s=this.exceptions)===null||s===void 0||s.addExceptionStep(t,i)}captureLog(t){var i;(i=this.logs)===null||i===void 0||i.captureLog(t)}get logger(){var t,i;return(t=(i=this.logs)===null||i===void 0?void 0:i.logger)!==null&&t!==void 0?t:ut.wh}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,s;return(i=(s=this.toolbar)===null||s===void 0?void 0:s.loadToolbar(t))!==null&&i!==void 0&&i}get_property(t){var i;return(i=this.persistence)===null||i===void 0?void 0:i.props[t]}getSessionProperty(t){var i;return(i=this.sessionPersistence)===null||i===void 0?void 0:i.props[t]}toString(){var t;let i=(t=this.config.name)!==null&&t!==void 0?t:Pi;return i!==Pi&&(i="posthog."+i),i}_isIdentified(){var t,i;return((t=this.persistence)===null||t===void 0?void 0:t.get_property("$user_state"))==="identified"||((i=this.sessionPersistence)===null||i===void 0?void 0:i.get_property("$user_state"))==="identified"}fh(){var t,i;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Ce(this.getGroups())&&!(!((t=this.persistence)===null||t===void 0||(t=t.props)===null||t===void 0)&&t.__alias)&&!(!((i=this.persistence)===null||i===void 0||(i=i.props)===null||i===void 0)&&i.$epp))}Xu(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.fh()||this.ph("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.ph("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}ph(t){return this.config.person_profiles==="never"?(F.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.gu(),this.gh(qn,!0),!0)}_u(){if(this.config.cookieless_mode==="always")return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}wu(){var t,i;const s=this._u();var r,n,o;return this.is_capturing()||(r=this.logs)===null||r===void 0||r.kh(),((t=this.persistence)===null||t===void 0?void 0:t.mi)!==s&&((n=this.persistence)===null||n===void 0||n.set_disabled(s)),((i=this.sessionPersistence)===null||i===void 0?void 0:i.mi)!==s&&((o=this.sessionPersistence)===null||o===void 0||o.set_disabled(s)),s&&(this.Cu.clear(),this.dh()),s}opt_in_capturing(t){var i;if(this.config.cookieless_mode!=="always"){if(this.pu()){var s,r,n,o,a,l;(s=this.sessionRecording)===null||s===void 0||s.dispose({discardBufferedEvents:!0}),this.yh(!0,!0),(r=this.sessionManager)===null||r===void 0||r.destroy(),(n=this.pageViewManager)===null||n===void 0||n.destroy(),this.sessionManager=new xa(this),this.pageViewManager=new da(this),this.persistence&&(this.sessionPropsManager=new wa(this,this.sessionManager,this.persistence));const f=(o=(a=this.config.__extensionClasses)===null||a===void 0?void 0:a.sessionRecording)!==null&&o!==void 0?o:(l=ut.__defaultExtensionClasses)===null||l===void 0?void 0:l.sessionRecording;var u,d;f&&(this.sessionRecording=this.fu(this.sessionRecording,new f(this)),this.au&&((u=this.sessionRecording)===null||u===void 0||(d=u.onRemoteConfig)===null||d===void 0||d.call(u,this.au)))}var c,h;this.consent.optInOut(!0),this.wu(),this.Qu(),(i=this.sessionRecording)===null||i===void 0||i.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((c=this.surveys)===null||c===void 0||c.loadIfEnabled()),(E(t?.captureEventName)||t?.captureEventName)&&this.capture((h=t?.captureEventName)!==null&&h!==void 0?h:"$opt_in",t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Ju()}else F.warn(Sa)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void F.warn(Sa);const t=this.config.cookieless_mode==="on_reject"?this.sessionRecording:void 0;var i,s;t?.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.yh(!0,!0),this.consent.optInOut(!1),this.wu(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:_r,$device_id:null}),this.vu(t),this.sessionRecording=void 0,(i=this.sessionManager)===null||i===void 0||i.destroy(),(s=this.pageViewM
3anager)===null||s===void 0||s.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Ju(),this.Qu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.wu()}_is_bot(){return we?$c(we,this.config.custom_blocked_useragents):void 0}Ju(){I&&(I.visibilityState==="visible"?this.Tu||(this.Tu=!0,this.capture(Hn,{title:I.title},{send_instantly:!0}),this.Mu&&(I.removeEventListener(zi,this.Mu),this.Mu=null)):this.Mu||(this.Mu=this.Ju.bind(this),se(I,zi,this.Mu)))}debug(t){t===!1?(w?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(w?.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}))}Yl(){const t=this.Au||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(F.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):(function(i,s,r,n,o){const a=s in i&&!z(i[s]),l=r in i&&!z(i[r]);return a?i[s]:!!l&&(o&&o.warn(`Config field '${r}' is deprecated. Please use '${s}' instead. The old field will be removed in a future major version.`),i[r])})(t,"advanced_disable_flags","advanced_disable_decide",0,F)}Os(t){var i;if(z(this.config.before_send))return t;const s=Object.keys((i=t.properties)!==null&&i!==void 0?i:{}).filter(Gd),r=j(this.config.before_send)?this.config.before_send:[this.config.before_send];let n=t;for(const o of r)try{if(n=o(n),z(n)){const a=`Event '${t.event}' was rejected in beforeSend function`;return Wd(t.event)?F.warn(`${a}. This can cause unexpected behavior.`):F.info(a),null}n.properties&&!Ce(n.properties)||F.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(a){return F.error(`Error in beforeSend function for event '${t.event}':`,a),null}for(const o of s)if(n.properties&&z(n.properties[o]))return F.warn(`Event '${t.event}' had its '${o}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return n}getPageViewId(){var t;return(t=this.pageViewManager.Ho)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,s){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(s)})}Ru(t){const i=Pe(t)&&!t,s=te.Et()&&te.Ot("ph_debug")==="true";return!i&&(!!s||t)}};qi.__defaultExtensionClasses={},qi.wh=(()=>{const e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(let i=0;t.length>i;i++)e.prototype[t[i]]=xf(e.prototype[t[i]])})(qi,["identify"]);var Oc=class{constructor(e){this.disabled=e===!1;const t=Q(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;const s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}};const Rr="$copy_autocapture",Lr=pe("[AutoCapture]");function Dr(e,t){return t.length>e?t.slice(0,e)+"...":t}function Op(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!Je(t));return t}function Cp(e,{e:t,maskAllElementAttributes:i,maskAllText:s,elementAttributeIgnoreList:r,elementsC
3hainAsString:n,disableCaptureUrlHashes:o}){var a,l;if(!Je(e))return{props:{}};const u=[e],d=new Set([e]);let c=e;for(;c.parentNode&&!xe(c,"body")&&1e3>u.length;){if(Un(c.parentNode)){const O=c.parentNode.host;if(d.has(O))break;d.add(O),u.push(O),c=O;continue}if(!Je(c.parentNode)||d.has(c.parentNode))break;d.add(c.parentNode),u.push(c.parentNode),c=c.parentNode}const h=t.type==="click"&&e.namespaceURI==="http://www.w3.org/2000/svg"?u.findIndex(O=>xe(O,"button")||xe(O,"a")):-1;h>0&&(s=s||u.slice(0,h+1).some(O=>!si(O)||Gi(O)));const f=[],_={};let m,v=!1,g=!1;if(ne(u,O=>{const C=si(O);if(xe(O,"a")&&!i&&!r?.includes("href")){const P=O.getAttribute("href");v=!!(C&&P&&Li(P))&&(o?mt(P):P)}q(li(O),"ph-no-capture")&&(g=!0),f.push((function(P,M,D,U,B=!1){const K=P.tagName.toLowerCase(),T={tag_name:K};Wn.indexOf(K)>-1&&!D&&(T.$el_text=K.toLowerCase()==="a"||K.toLowerCase()==="button"?Dr(1024,aa(P)):Dr(1024,Wi(P)));const A=li(P);M||U?.includes("class")||0>=A.length||(T.classes=A.filter(function($){return $!==""})),ne(P.attributes,function($){var k;if((!Gi(P)||["name","id","class","aria-label"].indexOf($.name)!==-1)&&!U?.includes($.name)&&!M&&Li($.value)&&(!Y(k=$.name)||k.substring(0,10)!=="_ngcontent"&&k.substring(0,7)!=="_nghost")){let R=$.value;$.name==="class"&&(R=zn(R).join(" ")),T["attr__"+$.name]=Dr(1024,$.name==="href"&&B?mt(R):R)}});let N=1,Z=1,ee=P;for(;ee=Op(ee);)N++,ee.tagName===P.tagName&&Z++;return T.nth_child=N,T.nth_of_type=Z,T})(O,i,s,r,o)),ne((function(P){if(!si(P))return{};const M={};return ne(P.attributes,function(D){if(D.name&&D.name.indexOf("data-ph-capture-attribute")===0){const U=D.name.replace("data-ph-capture-attribute-",""),B=D.value;U&&B&&Li(B)&&(M[U]=B)}}),M})(O),(P,M)=>{({}).hasOwnProperty.call(_,M)||(_[M]=P)})}),g)return{props:{},explicitNoCapture:g};if(h>0&&(e=u[h],f.splice(0,h)),s||(f[0].$el_text=xe(e,"a")||xe(e,"button")?aa(e):Wi(e)),v){var y,x;f[0].attr__href=v;const O=(y=yt(v))===null||y===void 0?void 0:y.host,C=w==null||(x=w.location)===null||x===void 0?void 0:x.host;O&&C&&O!==C&&(m=v)}return{props:le((b=t.type,{$event_type:b,$ce_version:1}),n?{}:{$elements:f},{$elements_chain:(S=f,j(S)?(function(O){return O.map(C=>{var P,M;let D="";if(C.tag_name&&(D+=C.tag_name),C.attr_class){C.attr_class.sort();for(const K of C.attr_class)D+=`.${K.replace(/"/g,"")}`}const U=p(p(p(p({},C.text?{text:C.text}:{}),{},{"nth-child":(P=C.nth_child)!==null&&P!==void 0?P:0,"nth-of-type":(M=C.nth_of_type)!==null&&M!==void 0?M:0},C.href?{href:C.href}:{}),C.attr_id?{attr_id:C.attr_id}:{}),C.attributes),B={};return ys(U).sort(([K],[T])=>(function(A,N){return N>A?-1:A>N?1:0})(K,T)).forEach(([K,T])=>B[la(K.toString())]=la(T.toString())),D+=":",D+=ys(B).map(([K,T])=>`${K}="${T}"`).join(""),D}).join(";")})((function(O){return O.map(C=>{var P,M;const D={text:(P=C.$el_text)===null||P===void 0?void 0:P.slice(0,400),tag_name:C.tag_name,href:(M=C.attr__href)===null||M===void 0?void 0:M.slice(0,2048),attr_class:Nf(C),attr_id:C.attr__id,nth_child:C.nth_child,nth_of_type:C.nth_of_type,attributes:{}};return ys(C).filter(([U])=>U.indexOf("attr__")===0).forEach(([U,B])=>D.attributes[U]=B),D})})(S)):"")},!((a=f[0])===null||a===void 0)&&a.$el_text?{$el_text:(l=f[0])===null||l===void 0?void 0:l.$el_text}:{},m&&t.type==="click"?{$external_click_url:m}:{},_),target:e};var S,b}var Fp=class{ho(){this.co=void 0,clearTimeout(this.do),this.do=void 0}vo(e){var t;if(!si(e))return!0;const i=(t=this.fo().css_selector_ignorelist)!==null&&t!==void 0?t:xr,s=new Set;let r=e;for(;r;){if(s.size>=1e3||s.has(r))return!0;s.add(r);const n=r,o=li(n);if(q(o,"ph-no-capture")||q(o,"ph-sensitive")||Gi(n)||i.some(l=>vn(n,l)))return!0;const a=r.parentNode;r=Un(a)?a.host:a&&Je(a)?a:null}return!1}po(e){if(!this.isEnabled||e.type==="pointercancel")return void this.ho();if(e.type==="pointerdown"){this.ho();const s=Ri(e);var t;return void(e.isPrimary&&e.button===0&&!e.ctrlKey&&s&&Je(s)&&(this.co={target:s,excluded:this.vo(s),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(t=this.mo)===null||t===void 0?void 0:t.distinctId}))}const i=this.co;i&&(e.pointerId!==i.id||Math.abs(e.clientX-i.x)>5||Math.abs(e.clientY-i.y)>5?this.ho():e.type==="pointerup"&&(i.released=!0,this.do=setTimeout(()=>this.ho(),0)))}yo(e){var t;const i=this.co;this.ho();const s=Ri(e);if(i?.released&&i.target.isConnected&&i.distinctId===((t=this.mo)===null||t===void 0?void 0:t.distinctId)&&e.pointerId===i.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-i.x)&&5>=Math.abs(e.clientY-i.y)&&s&&(xe(s,"html")||xe(s,"body"))){var r;if(i.excluded)return null;const n=(r=this.fo().css_selector_ignorelist)!==null&&r!==void 0?r:xr;return[s,I?.documentElement,I?.body].some(o=>{if(!o)return!1;const a=li(o);return q(a,"ph-no-capture")||q(a,"ph-sensitive")||!si(o)||Gi(o)||n.some(l=>vn(o,l))})?null:i.target}}constructor(e){this.bo=e,this.name="autocapture",this._o=!1,this.wo=null,this.ko=!1,this.So=!1,this.Ir={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.xo=!1,this.bo.refresh(this.Ir),this.rageclicks=new Oc(this.Ir.rageclick),this.Co=null}setup(e){this.$o(),this.mo=e;const t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.xo?t.dispose():(this.Io=t,this.startIfEnabled())}dispose(){var e;this.xo||(this.xo=!0,this.mo=void 0,(e=this.Io)===null||e===void 0||e.dispose(),this.Io=void 0,this.To())}fo(){return this.bo.refresh(this.Ir),this.Ir}$o(){var e,t;return this.fo(),this.Ir.url_allowlist=(e=this.Ir.url_allowlist)===null||e===void 0?void 0:e.map(i=>new RegExp(i)),this.Ir.url_ignorelist=(t=this.Ir.url_ignorelist)===null||t===void 0?void 0:t.map(i=>new RegExp(i)),this.Ir}Mo(){if(!this.isBrowserSupported())return void Lr.info("Disabling Automatic Event Collection because this browser is not supported");if(!w||!I)return;const e=this.Eo=t=>{t=t||w?.event;try{if(t.type==="blur")return void this.ho();if(t.type.indexOf("pointer")===0)return void this.po(t);const i=t.type==="click"?this.yo(t):void 0;if(ve(i))return;this.Po(t,"$autocapture",i)}catch(i){Lr.error("Failed to capture event",i)}};if(se(w,"blur",e),se(I,"submit",e,{capture:!0}),se(I,"change",e,{capture:!0}),se(I,"click",e,{capture:!0}),ne(["pointerdown","pointermove","pointerup","pointercancel"],t=>{se(I,t,e,{capture:!0})}),this.fo().capture_copied_text){const t=this.Ro=i=>{i=i||w?.event;try{this.Po(i,Rr)}catch(s){Lr.error("Failed to capture clipboard event",s)}};se(I,"copy",t,{capture:!0}),se(I,"cut",t,{capture:!0}),se(I,"paste",t,{capture:!0})}}To(){this.ho(),this.Eo&&(w?.removeEventListener("blur",this.Eo),ne(["pointerdown","pointermove","pointerup","pointercancel"],e=>{I?.removeEventListener(e,this.Eo,!0)}),I?.removeEventListener("submit",this.Eo,!0),I?.removeEventListener("change",this.Eo,!0),I?.removeEventListener("click",this.Eo,!0),this.Eo=void 0),this.Ro&&(I?.removeEventListener("copy",this.Ro,!0),I?.removeEventListener("cut",this.Ro,!0),I?.removeEventListener("paste",this.Ro,!0),this.Ro=void 0),this._o=!1}startIfEnabled(){this.isEnabled||this.ho(),!this.xo&&this.mo&&this.isEnabled&&!this._o&&(this.Mo(),this._o=!0)}onRemoteConfig(e){if(this.xo)return;if(this.ko=!0,!e.ok)return void this.startIfEnabled();const t=e.config;
3t.elementsChainAsString&&(this.So=t.elementsChainAsString);const i=t.autocapture_opt_out;var s;Pe(i)&&((s=this.mo)===null||s===void 0||s.kv.set("$autocapture_disabled_server_side",i),this.wo=i),this.startIfEnabled()}setElementSelectors(e){this.Co=e}getElementSelectors(e,t){var i;const s=[];return(i=this.Co)===null||i===void 0||i.forEach(r=>{const n=I?.querySelectorAll(r);n?.forEach(o=>{e!==o&&t!==o||q(s,r)||s.push(r)})}),s}get isEnabled(){var e,t;if(this.xo)return!1;const i=(e=this.mo)===null||e===void 0?void 0:e.kv.get(mu),s=this.wo,r=this.fo();if(!r.remoteRequestsDisabled&&!this.ko)return!1;const n=r.remoteRequestsDisabled&&!this.ko;if(ve(s)&&!Pe(i)&&!n)return!1;const o=(t=this.wo)!==null&&t!==void 0?t:!!i;return!!r.enabled&&!o}Po(e,t="$autocapture",i){if(!this.isEnabled)return void this.ho();let s=i||Ri(e);ju(s)&&(s=s.parentNode||null);const r=this.$o();var n;t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&r.rageclick&&(!((n=this.rageclicks)===null||n===void 0)&&n.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime()))&&Vu(s,r.rageclick)&&this.Po(e,"$rageclick",i);const o=t===Rr,a=o?p(p({},r),{},{dom_event_allowlist:void 0}):r;if(s&&(function(c,h,f,_,m,v){var g;if(!w||Gn(c)||f?.url_allowlist&&!ea(f.url_allowlist,v)||f?.url_ignorelist&&ea(f.url_ignorelist,v))return!1;if(f?.dom_event_allowlist){const b=f.dom_event_allowlist;if(b&&!b.some(O=>h.type===O))return!1}const{parentIsUsefulElement:y,targetElementList:x}=Uu(c,_);if(!(function(b,O){const C=O?.element_allowlist;if(E(C))return!0;for(const P of b)if(C.some(M=>P.tagName.toLowerCase()===M))return!0;return!1})(x,f)||!gn(x,f?.css_selector_allowlist)||gn(x,(g=f?.css_selector_ignorelist)!==null&&g!==void 0?g:xr))return!1;try{const b=w.getComputedStyle(c);if(b&&b.getPropertyValue("cursor")==="pointer"&&h.type==="click")return!0}catch{}const S=c.tagName.toLowerCase();switch(S){case"html":return!1;case"form":return(m||["submit"]).indexOf(h.type)>=0;case"input":case"select":case"textarea":return(m||["change","click"]).indexOf(h.type)>=0;default:return y?(m||["click"]).indexOf(h.type)>=0:(m||["click"]).indexOf(h.type)>=0&&(Wn.indexOf(S)>-1||c.getAttribute("contenteditable")==="true")}})(s,e,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:r.getCurrentUrl}})){var l;const{props:c,explicitNoCapture:h,target:f}=Cp(s,{e,maskAllElementAttributes:r.maskAllElementAttributes,maskAllText:r.maskAllText,elementAttributeIgnoreList:r.element_attribute_ignorelist,elementsChainAsString:this.So,disableCaptureUrlHashes:r.disableCaptureUrlHashes});if(h)return!1;const _=this.getElementSelectors(s,f);if(_&&_.length>0&&(c.$element_selectors=_),t===Rr){const m=e.type||"clipboard";if(m!=="paste"){var u,d;const v=w==null||(u=w.getSelection())===null||u===void 0?void 0:u.toString(),g=qu(v);if(!g)return!1;c.$selected_content=g,c.$clipboard_text_length=(d=v?.length)!==null&&d!==void 0?d:0}c.$copy_type=m}return(l=this.mo)===null||l===void 0||l.capture(t,c),!0}}isBrowserSupported(){return be(I?.querySelectorAll)}},Mp=class{constructor(e){this._instance=e}refresh(e){const t=this._instance.config,i=Q(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance.Yl(),e.url_allowlist=i?.url_allowlist,e.url_ignorelist=i?.url_ignorelist,e.dom_event_allowlist=i?.dom_event_allowlist,e.element_allowlist=i?.element_allowlist,e.css_selector_allowlist=i?.css_selector_allowlist,e.css_selector_ignorelist=i?.css_selector_ignorelist,e.element_attribute_ignorelist=i?.element_attribute_ignorelist,e.capture_copied_text=i?.capture_copied_text}};const ki=pe("[ExceptionAutocapture]"),Fa=()=>{},Ma=e=>{var t;if(be(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function Xi(e,t,i){try{if(!(t in e))return Fa;const s={next:e[t]},r=i(function(...n){return s.next.apply(this,n)});return be(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),e[t]=r,()=>{if(e[t]===r)return void(e[t]=s.next);let n=e[t],o=Ma(n);for(;o;){if(o.next===r)return void(o.next=s.next);n=o.next,o=Ma(n)}}}catch{return Fa}}const Ap=pe("[TracingHeaders]"),wt=pe("[Web Vitals]"),Aa=9e5,Ta=["CLS","FCP","INP","LCP"],Tp=["INP","LCP"],Rp=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Nr="disabled",Ra="lazy_loading",Xe=pe("[SessionRecording]"),Lp=pe("[Heatmaps]");function jr(e){return Q(e)&&"clientX"in e&&"clientY"in e&&ge(e.clientX)&&ge(e.clientY)}const hs=pe("[Product Tours]"),qr=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property(jn))}
3,Dp=["$set_once","$set"],Ve=pe("[SiteApps]"),La="Error while initializing PostHog app with config id ",Cc=(e,t)=>e?.then?e.then(t):t(e),Vt="SDK is not enabled or survey functionality is not yet loaded",Da="Disabled. Not loading surveys.";var Np=class{constructor(e,t){this.bo=e,this.Sh=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.xh=!1,this.Ch=[],this.$h=null,this.Ih=null,this.xo=!1,this.Th=new Set,this.onRemoteConfig=i=>{if(this.xo||this.Ir.disableSurveys)return;if(!i.ok)return re.warn("Remote config unavailable. Not loading surveys.");const s=i.config.surveys;if(z(s))return re.warn("Flags not loaded yet. Not loading surveys.");this.Mh=Pe(s)?s:s.length>0,re.info(`flags response received, isSurveysEnabled: ${this.Mh}`),this.loadIfEnabled()}}setup(e){if(!this.xo)return this.Eh=e,Cc(e.kv.initialize(),()=>{if(this.Eh!==e||this.xo)return;this.Eh=void 0,this.mo=e;const t=e.onRemoteConfig(this.onRemoteConfig);this.xo?t.dispose():(this.Io=t,this.loadIfEnabled())})}dispose(){var e,t,i,s;this.xo||(this.xo=!0,this.Eh=void 0,this.mo=void 0,(e=this.Io)===null||e===void 0||e.dispose(),this.Io=void 0,(t=this._surveyEventReceiver)===null||t===void 0||t.dispose(),this._surveyEventReceiver=null,(i=this._surveyManager)===null||i===void 0||(s=i.dispose)===null||s===void 0||s.call(i),this._surveyManager=null,this.Ch=[],this.$h=null,this.Th.forEach(r=>clearTimeout(r)),this.Th.clear())}get Ir(){return this.bo.get()}initialize(){this.loadIfEnabled()}reset(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.clearInMemoryInProgressSurveyState)===null||t===void 0||t.call(e);try{var i;(i=this._surveyEventReceiver)===null||i===void 0||i.reset(),localStorage.removeItem("lastSeenSurveyDate");const s=[];for(let r=0;r<localStorage.length;r++){const n=localStorage.key(r);(n?.startsWith("seenSurvey_")||n?.startsWith("inProgressSurvey_"))&&s.push(n)}s.forEach(r=>localStorage.removeItem(r))}catch{}}loadIfEnabled(){if(this.xo||!this.mo)return;const e=this.Ir;if(this._surveyManager)return;if(this.xh)return void re.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void re.info(Da);if(e.cookielessMode&&this.bo.isOptedOut())return void re.info("Not loading surveys in cookieless mode without consent.");const t=this.bo.getExtensions();if(!t)return void re.error("PostHog Extensions not found.");if(E(this.Mh)&&!e.advancedEnableSurveys)return;const i=this.Mh||e.advancedEnableSurveys;this.xh=!0;try{const s=t.generateSurveys;if(s)return this.Ph(s,i),void(this.xh=!1);const r=t.loadExternalDependency;if(!r)return this.Rh(Bn),void(this.xh=!1);r(n=>{try{if(this.xo)return;const o=this.bo.getExtensions();n||!o?.generateSurveys?this.Rh("Could not load surveys script",n):this.Ph(o.generateSurveys,i)}finally{this.xh=!1}})}catch(s){throw this.xh=!1,this.Rh("Error initializing surveys",s),s}}Ph(e,t){this.xo||(this._surveyManager=e(t),this._surveyEventReceiver=this.bo.createEventReceiver(),re.info("Surveys loaded successfully"),this.Ah({isLoaded:!0}))}Rh(e,t){re.error(e,t),this.Ah({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Ch.push(e),this._surveyManager&&this.Ah({isLoaded:!0}),()=>{this.Ch=this.Ch.filter(t=>t!==e)}}getSurveys(e,t=!1){var i;const s=(i=this.mo)!==null&&i!==void 0?i:this.Sh;if(!s||this.xo)return;if(this.Ir.disableSurveys)return re.info(Da),e([]);const r=s.kv.get(un);if(r&&!t)return e(r,{isLoaded:!0}),void(this.Fh()&&this.getSurveys(()=>{},!0));if(this.$h)return void this.$h.then(({surveys:a,context:l})=>{this.xo||e(a,l)}).catch(a=>re.error("Error in survey callback",a));const n=this.Oh("/api/surveys/",{method:"GET",query:{token:s.projectToken},sentAt:"query",timeoutMs:this.Ir.requestTimeoutMs}).then(a=>{try{return this.Dh(s,a)}catch(l){return re.error("Error processing surveys response",l),this.Dh(s,{statusCode:0,error:l})}},a=>this.Dh(s,{statusCode:0,error:a}));this.$h=n;const o=()=>{this.$h===n&&(this.$h=null)};n.then(a=>{o(),this.xo||e(a.surveys,a.context)},o).catch(a=>re.error("Error in survey callback",a))}Oh(e,t){const i=this.mo;return i?i.sendRequest(e,t):new Promise(s=>s({statusCode:0,error:new Error(Vt)}))}Dh(e,t){if(this.xo)return{surveys:[],context:{isLoaded:!1,error:Vt}};const i=t.statusCode;if(i!==200||!t.json){const o=`Surveys API could not be loaded, status: ${i}`;return i!==0?re.error(o):t.error||re.warn(o),this.Ih=Date.now(),{surveys:[],context:{isLoaded:!1,error:o}}}this.Ih=null;const s=t.json.surveys||[],r=s.filter(o=>(function(a){return!(!a.start_date||a.end_date)})(o)&&(Ec(o)||(function(a){var l;return!!(!((l=a.conditions)===null||l===void 0||(l=l.actions)===null||l===void 0||(l=l.values)===null||l===void 0)&&l.length)})(o)));var n;return r.length>0&&((n=this._surveyEventReceiver)===null||n===void 0||n.register(r)),e.kv.set({[un]:s,[Ts]:Date.now()}),{surveys:s,context:{isLoaded:!0}}}Fh(){return this.Lh()&&!this.$h&&!this.Nh()}Lh(){var e,t;const i=(e=(t=this.mo)!==null&&t!==void 0?t:this.Sh)===null||e===void 0?void 0:e.kv.get(Ts);return ge(i)&&Date.now()-i>3e5}Nh(){return ge(this.Ih)&&3e5>Date.now()-this.Ih}markSurveyAsSeen(e,t){var i;
3const s={id:e,current_iteration:(i=t?.iteration)!==null&&i!==void 0?i:null};Ic(s);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Ah(e){for(const t of this.Ch)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){re.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t=!1){if(!z(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);re.warn("init was not called")}qh(e){let t=null;return this.getSurveys(i=>{var s;t=(s=i.find(r=>r.id===e))!==null&&s!==void 0?s:null}),t}jh(e){if(z(this._surveyManager))return{eligible:!1,reason:Vt};const t=typeof e=="string"?this.qh(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Bh(e){if(!this.bo.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(z(this._surveyManager))return{eligible:!1,reason:Vt};const t=typeof e=="string"?this.qh(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(z(this._surveyManager))return re.warn("init was not called"),{visible:!1,disabledReason:Vt};const t=this.Bh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return z(this._surveyManager)?(re.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Vt})):new Promise(i=>{this.getSurveys(s=>{var r;const n=(r=s.find(o=>o.id===e))!==null&&r!==void 0?r:null;if(n){const o=this.Bh(n);i({visible:o.eligible,disabledReason:o.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(!this.bo.isCapturing())return;if(z(this._surveyManager))return void re.warn("init was not called");const r=typeof e=="string"?this.qh(e):e;if(!r?.id)return void re.warn("Survey not found");if(!gp.includes(r.type))return void re.warn(`Surveys of type ${r.type} cannot be rendered in the app`);const n=I?.querySelector(t);if(n){if(!((s=r.appearance)===null||s===void 0)&&s.surveyPopupDelaySeconds){re.info(`Rendering survey ${r.id} with delay of ${r.appearance.surveyPopupDelaySeconds} seconds`);const o=setTimeout(()=>{var a,l;this.Th.delete(o),!this.xo&&this.bo.isCapturing()&&(re.info(`Rendering survey ${r.id} with delay of ${(a=r.appearance)===null||a===void 0?void 0:a.surveyPopupDelaySeconds} seconds`),(l=this._surveyManager)===null||l===void 0||l.renderSurvey(r,n,i),re.info(`Survey ${r.id} rendered`))},1e3*r.appearance.surveyPopupDelaySeconds);return void this.Th.add(o)}this._surveyManager.renderSurvey(r,n,i)}else re.warn("Survey element not found")}displaySurvey(e,t){var i;if(!this.bo.isCapturing())return;if(z(this._surveyManager))return void re.warn("init was not called");const s=this.qh(e);if(!s)return void re.warn("Survey not found");let r=s;if(!((i=s.appearance)===null||i===void 0)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=p(p({},s),{},{appearance:p(p({},s.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==_n.Popover&&t.initialResponses&&re.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){const n=this.jh(s);if(!n.eligible)return void re.warn("Survey is not eligible to be displayed: ",n.reason)}t.displayType!==_n.Inline?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}cancelPendingSurvey(e){z(this._surveyManager)?re.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.handlePageUnload)===null||t===void 0||t.call(e)}};function Ut(e,t,i){if(z(e))return!1;switch(i){case"exact":return e===t;case"contains":{const s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var jp=class{constructor(e){this._instance=e,this.Hh=new Set,this.zh=new Set,this.Uh=new Bs,this.Wh=(t,i)=>this.Vh(t,i)&&this.Gh(t,i)&&this.Zh(t,i)&&this.Qh(t,i),this.Vh=(t,i)=>!i?.event||t?.event===i?.event}init(){var e,t;E((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.Jh=(t=this._instance)===null||t===void 0?void 0:t._addCaptureHook((i,s)=>{this.on(i,s)}))}dispose(){var e;(e=this.Jh)===null||e===void 0||e.call(this),this.Jh=void 0,this.Uh=new Bs}register(e){var t,i;if(!E((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(s=>{var r;this.Hh.add(s),(r=s.steps)===null||r===void 0||r.forEach(n=>{this.zh.add(n?.event||"")})}),(i=this._instance)===null||i===void 0?void 0:i.autocapture)){const s=new Set;
3this.Hh.forEach(r=>{var n;(n=r.steps)===null||n===void 0||n.forEach(o=>{o?.selector&&s.add(o.selector)})}),this._instance.autocapture.setElementSelectors(s)}}replace(e){this.Hh.clear(),this.zh.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.zh.has(e)||this.zh.has(t.event))&&this.Hh.forEach(i=>{this.Kh(t,i)&&this.Uh.emit("actionCaptured",i.name)})}Xh(e){this.onAction("actionCaptured",t=>e(t))}Kh(e,t){if(t?.steps==null)return!1;for(const i of t.steps)if(this.Wh(e,i))return!0;return!1}onAction(e,t){return this.Uh.on(e,t)}Gh(e,t){if(t?.url){var i;const s=e==null||(i=e.properties)===null||i===void 0?void 0:i.$current_url;if(!s||typeof s!="string"||!Ut(s,t.url,t.url_matching||"contains"))return!1}return!0}Zh(e,t){return!!this.Yh(e,t)&&!!this.tc(e,t)&&!!this.ec(e,t)}Yh(e,t){var i;if(!t?.href)return!0;const s=this.nc(e);if(s.length>0)return s.some(n=>Ut(n.href,t.href,t.href_matching||"exact"));const r=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";return!!r&&Ut((function(n){const o=n.match(/(?::|")href="(.*?)"/);return o?o[1]:""})(r),t.href,t.href_matching||"exact")}tc(e,t){var i;if(!t?.text)return!0;const s=this.nc(e);if(s.length>0)return s.some(l=>Ut(l.text,t.text,t.text_matching||"exact")||Ut(l.$el_text,t.text,t.text_matching||"exact"));const r=(e==null||(i=e.properties)===null||i===void 0?void 0:i.$elements_chain)||"";return!!r&&(n=(function(l){const u=[],d=/(?::|")text="(.*?)"/g;let c;for(;!z(c=d.exec(l));)u.includes(c[1])||u.push(c[1]);return u})(r),o=t.text,a=t.text_matching||"exact",n.some(l=>Ut(l,o,a)));var n,o,a}ec(e,t){var i,s;if(!t?.selector)return!0;const r=e==null||(i=e.properties)===null||i===void 0?void 0:i.$element_selectors;if(r?.includes(t.selector))return!0;const n=(e==null||(s=e.properties)===null||s===void 0?void 0:s.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch{return!1}return!1}nc(e){var t;return(e==null||(t=e.properties)===null||t===void 0?void 0:t.$elements)==null?[]:e?.properties.$elements}Qh(e,t){return!t?.properties||t.properties.length===0||Sc(t.properties.reduce((i,s)=>{const r=j(s.value)?s.value.map(String):s.value!=null?[String(s.value)]:[];return i[s.key]={values:r,operator:s.operator||"exact"},i},{}),e?.properties)}},qp=class{constructor(e){var t,i;this.sc=[],this._instance=e,this.rc=new Map,this.oc=new Map,this.lc=new Map,this.ac=(t=this._instance)===null||t===void 0||(i=t.onSessionId)===null||i===void 0?void 0:i.call(t,s=>this.uc(s))}hc(e){return!1}cc(){return null}dc(e){}vc(){}fc(e,t){return!!e&&Sc(e.propertyFilters,t?.properties)}gc(e,t){const i=new Map;return e.forEach(s=>{var r;(r=s.conditions)===null||r===void 0||(r=r[t])===null||r===void 0||(r=r.values)===null||r===void 0||r.forEach(n=>{if(n?.name){const o=i.get(n.name)||[];o.push(s.id),i.set(n.name,o)}})}),i}mc(e,t,i){const s=(i===wi.Activation?this.rc:this.oc).get(e);let r=[];return this.yc(n=>{r=n.filter(o=>s?.includes(o.id))}),r.filter(n=>{var o;const a=(o=n.conditions)===null||o===void 0||(o=o[i])===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.find(l=>l.name===e);return this.fc(a,t)})}register(e){this.bc(e,!1)}replace(e){this.bc(e,!0)}bc(e,t){var i;E((i=this._instance)===null||i===void 0?void 0:i._addCaptureHook)||(this._c(e,t),this.wc(e,t))}wc(e,t){const i=e.filter(n=>{var o;return(o=n.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.length});var s;if(t&&this.lc.clear(),i.length===0)return void(t&&((s=this.kc)===null||s===void 0||s.replace([])));this.kc||(this.kc=new jp(this._instance),this.kc.init(),this.kc.Xh(n=>this.onAction(n)));const r=[];i.forEach(n=>{var o;(o=n.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||o.values.forEach(a=>{if(r.push(a),a.name){var l;const u=(l=this.lc.get(a.name))!==null&&l!==void 0?l:[];u.includes(n.id)||u.push(n.id),this.lc.set(a.name,u)}})}),t?this.kc.replace(r):this.kc.register(r)}Sc(e,t){t.forEach((i,s)=>{var r;const n=(r=e.get(s))!==null&&r!==void 0?r:[];i.forEach(o=>{n.includes(o)||n.push(o)}),e.set(s,n)})}_c(e,t){var i,s;const r=e.filter(l=>{var u,d;return((u=l.conditions)===null||u===void 0?void 0:u.events)&&((d=l.conditions)===null||d===void 0||(d=d.events)===null||d===void 0||(d=d.values)===null||d===void 0?void 0:d.length)>0}),n=e.filter(l=>{var u,d;return((u=l.conditions)===null||u===void 0?void 0:u.cancelEvents)&&((d=l.conditions)===null||d===void 0||(d=d.cancelEvents)===null||d===void 0||(d=d.values)===null||d===void 0?void 0:d.length)>0}),o=this.gc(e,wi.Activation),a=this.gc(e,wi.Cancellation);t?(this.rc=o,this.oc=a):(this.Sc(this.rc,o),this.Sc(this.oc,a)),(r.length!==0||n.length!==0)&&((i=this.Jh)!==null&&i!==void 0||(this.Jh=(s=this._instance)===null||s===void 0?void 0:s._addCaptureHook((l,u)=>{this.onEvent(l,u)})))}onEvent(e,t){var i,s;const r=this.xc(),n=(t==null||(i=t.properties)===null||i===void 0?void 0:i.$survey_id)||(t==null||(s=t.properties)===null||s===void 0?void 0:s.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){const a=this.Cc(e,n);if(a==="consume")return r.info("event consumed activated item, remov
3ing it",{event:e,itemId:n}),void this.$c([n]);if(a==="persist")return r.info("shown item promoted to persisted activation",{event:e,itemId:n}),this.Ic(n),void this.Tc([n])}if(this.oc.has(e)){const a=this.mc(e,t,wi.Cancellation);a.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:a.map(l=>l.id)}),this.$c(a.map(l=>l.id)),a.forEach(l=>this.Mc(l.id)))}if(!this.rc.has(e))return;r.info("event name matched",{event:e,eventPayload:t,items:this.rc.get(e)});const o=this.mc(e,t,wi.Activation);this.Ec(o.map(a=>a.id))}onAction(e){this.lc.has(e)&&this.Ec(this.lc.get(e)||[])}Ec(e){var t,i;if(e.length===0)return;const s=!!(!((t=this._instance)===null||t===void 0||(i=t.get_session_id)===null||i===void 0)&&i.call(t)),r=[];for(const n of e)s&&this.hc(n)?this.Ic(n)&&this.Pc(n):r.push(n);r.length>0&&(this.sc=[...new Set([...this.sc,...r])]),this.xc().info("updating activated items",{activatedItems:this.getActivatedIds()})}Ic(e){this.sc=this.sc.filter(i=>i!==e);const t=this.Rc();return!t.includes(e)&&(this.Ac([...t,e]),this.Fc(),!0)}$c(e){const t=new Set(e);this.sc=this.sc.filter(r=>!t.has(r));const i=this.Oc(),s=i.filter(r=>!t.has(r));s.length!==i.length&&(this.Ac(s),s.length===0&&this.Dc()),this.Tc(e)}Lc(){var e;const t=this.cc();if(!t)return{};const i=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t];return i&&typeof i=="object"?i:{}}Pc(e){if(!this.cc())return;const t=this.Lc();this.dc(p(p({},t),{},{[e]:Date.now()}))}Tc(e){if(!this.cc())return;const t=this.Lc(),i={};let s=!1;for(const[r,n]of Object.entries(t))e.includes(r)?s=!0:i[r]=n;s&&(Ce(i)?this.vc():this.dc(i))}Nc(){this.cc()&&this.vc()}getActivationTimestamp(e){if(!this.Rc().includes(e))return;const t=this.Lc()[e];return ge(t)?t:void 0}Oc(){var e;const t=this.qc();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t])||[]}Rc(){var e,t,i;const s=this.Oc();if(s.length===0)return[];const r=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.jc()],n=(t=this._instance)===null||t===void 0||(i=t.get_session_id)===null||i===void 0?void 0:i.call(t);return n&&r===n?s:[]}Fc(){var e,t;const i=(e=this._instance)===null||e===void 0||(t=e.get_session_id)===null||t===void 0?void 0:t.call(e);i&&this.Bc(i)}Dc(){this.Hc()}uc(e){var t;const i=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[this.jc()];if(i&&i!==e){const s=this.Oc(),r=this.Lc();s.length>0&&(this.Ac([]),s.filter(n=>ge(r[n])).forEach(n=>this.Mc(n))),this.Dc(),this.Nc()}}getActivatedIds(){return[...new Set([...this.Rc(),...this.sc])].filter(e=>!this.zc(e))}dispose(){var e,t,i;(e=this.ac)===null||e===void 0||e.call(this),this.ac=void 0,(t=this.Jh)===null||t===void 0||t.call(this),this.Jh=void 0,(i=this.kc)===null||i===void 0||i.dispose(),this.kc=void 0}reset(){this.sc=[],this.Oc().length>0&&this.Ac([]),this.Dc(),this.Nc()}getEventToItemsMap(){return this.rc}Uc(){return this.kc}},Bp=class extends qp{constructor(e){super(e)}qc(){return Eu}jc(){return ku}cc(){return Su}dc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_timestamps:e})}vc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}hc(e){var t;let i;this.yc(r=>{i=r.find(n=>n.id===e)});const s=i==null||(t=i.appearance)===null||t===void 0?void 0:t.surveyPopupDelaySeconds;return ge(s)&&s>0}Wc(){return tt.SHOWN}yc(e){var t;(t=this._instance)===null||t===void 0||t.getSurveys(e)}Mc(e){var t;(t=this._instance)===null||t===void 0||t.cancelPendingSurvey(e)}xc(){return re}Ac(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated:e})}Bc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_session:e})}Hc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}zc(){return!1}Cc(e,t){let i;return this.yc(s=>{i=s.find(r=>r.id===t)}),!i||(function(s){var r;return Ec(s)&&!!(!((r=s.conditions)===null||r===void 0||(r=r.events)===null||r===void 0)&&r.repeatedActivation)||s.schedule==="always"})(i)?e===tt.SHOWN?"consume":"ignore":e===tt.SHOWN?"persist":e===tt.DISMISSED||e===tt.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}
3getEventToSurveys(){return this.getEventToItemsMap()}},Hp=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);const t={};for(const i of e){const s=this._instance.get_property(i);E(s)||(t[i]=s)}return t}set(e,t){this._instance.register(typeof e=="string"?{[e]:t}:e)}remove(e){typeof e!="string"?e.forEach(t=>this._instance.unregister(t)):this._instance.unregister(e)}},Vp=class{constructor(e){this._instance=e}get(){const e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const e=L?.__PosthogExtensions__;if(!e)return;const{generateSurveys:t,loadExternalDependency:i}=e;return{generateSurveys:t?s=>t(this._instance,s):void 0,loadExternalDependency:i?s=>i(this._instance,"surveys",s):void 0}}createEventReceiver(){return new Bp(this._instance)}};const Up=w?.location?Ns(w.location.hash,"__posthog")||Ns(location.hash,"state"):null,Na="_postHogToolbarParams",ja=pe("[Toolbar]"),qa=pe("[FeatureFlags]");var zp=class{constructor(e,t=!1){this.Vc=!1,this.update(e,t)}update(e,t){this.Gc=((i,s)=>{var r,n,o,a,l,u,d;return{bootstrap:{featureFlags:(r=(n=i.bootstrap)===null||n===void 0?void 0:n.featureFlags)!==null&&r!==void 0?r:void 0,featureFlagPayloads:(o=(a=i.bootstrap)===null||a===void 0?void 0:a.featureFlagPayloads)!==null&&o!==void 0?o:void 0},remoteRequestsDisabled:s,featureFlagsDisabled:!!i.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!i.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!i.advanced_feature_flags_dedup_per_session,cacheTtlMs:i.feature_flag_cache_ttl_ms,refreshIntervalMs:(l=i.remote_config_refresh_interval_ms)!==null&&l!==void 0?l:3e5,idleRefreshBackoff:E(i.remote_config_refresh_interval_ms),requestTimeoutMs:i.feature_flag_request_timeout_ms,compression:i.disable_compression?void 0:"best-available",evaluationContexts:(u=(d=i.evaluation_contexts)!==null&&d!==void 0?d:i.evaluation_environments)!==null&&u!==void 0?u:[],flagKeys:j(i.flag_keys)?i.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.Vc||(qa.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Vc=!0),E(e.flag_keys)||j(e.flag_keys)||qa.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Gc}};const Ba=pe("[FeatureFlags]"),$t=pe("[FeatureFlags]",{debugEnabled:!0}),Br=`" failed. Feature flags didn't load in time.`,Ha=["click","keydown","wheel","touchstart","pointerdown"],Va="connection_error",Ua=e=>{const t={};for(let i=0;e.length>i;i++)t[e[i]]=!0;return t},za=e=>{const t={};for(const[i,s]of ys(e||{}))s&&(t[i]=s);return t},Wa=e=>pi(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),De=pe("[Error tracking]"),xn="webkit-masked-url:",Wp=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],Gp=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",xn],Jp=["__firefox__","__gCrWeb"],Ga="Refusing to render web experiment since the viewer is a likely bot",Kp={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>Hs(t,e),not_regex:(e,t)=>!Hs(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},Ae=pe("[Conversations]"),xt="Conversations not available yet.";function Ja(e,t){var i,s,r,n,o,a,l;const u=(i=e?.flushIntervalMs)!==null&&i!==void 0?i:3e3,d=(s=e?.maxBufferSize)!==null&&s!==void 0?s:100,c=t?.consoleCapture?void 0:(r=e?.maxLogsPerInterval)!==null&&r!==void 0?r:1e3,h=E(c)?Math.max(d,2048):Math.max(d,c),f=p(p({},(function(){let _="",m="";try{const v=we?.userAgent;v&&([_,m]=Kl(v))}catch{}return(function(v,g){const y=(function(x){if(x)return{}.hasOwnProperty.call(Ho,x)?Ho[x]:x})(v);return p(p({},y?{"os.name":y}:{}),g?{"os.version":g}:{})})(_,m)})()),e?.resourceAttributes);return{serviceName:(n=(o=f?.["service.name"])!==null&&o!==void 0?o:e?.serviceName)!==null&&n!==void 0?n:t?.serviceNameDefault,serviceVersion:(a=f?.["service.version"])!==null&&a!==void 0?a:e?.serviceVersion,environment:(l=f?.["deployment.environment"])!==null&&l!==void 0?l:e?.environment,resourceAttributes:f,beforeSend:e?.beforeSend,flushIntervalMs:u,maxBufferSize:d,maxQueueSize:h,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:c,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}
3const Xp=["debug","log","warn","error","info"],Yp=e=>{for(;e?.__rrweb_original__;)e=e.__rrweb_original__;return e},Ka="console",Fc="__posthogHandledLogsRequestError",Hr=(e,t)=>{const i=e instanceof Error?e:new Error(t);return i[Fc]=!0,i},Xa=e=>!!e&&typeof e=="object"&&e[Fc]===!0,Vs=pe("[NetworkMetrics]"),Xn=()=>{var e;return!(w==null||(e=w.performance)===null||e===void 0)&&e.now?w.performance.now():Date.now()},Zp=e=>e?`${Math.floor(e/100)}xx`:"missing",Mc=(e,t)=>{var i;const s=String(t);return{method:String(e).toUpperCase(),url:((i=yt(s))===null||i===void 0?void 0:i.href)||s}},En=(e,t,i,s,r)=>{try{var n,o,a;const u=r();if(!u)return;const d=i||void 0,c=Xn()-s,h=yt(t.url);if(h&&h.protocol!=="http:"&&h.protocol!=="https:")return;const f={url:h?.href||t.url,method:t.method},_=be(u.name)?u.name(f):Y(u.name)?u.name:"http.client.request.duration";if(!_)return;const m=p({method:f.method,host:(n=h?.hostname)!==null&&n!==void 0?n:"",path:h?(l=h.pathname,l.split("/").map(v=>(g=>/^\d+$/.test(g)||g.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(g))(v)?":id":v).join("/")):"",status_class:Zp(d)},(o=u.attributes)===null||o===void 0?void 0:o.call(u,f,{status:d,durationMs:c}));(a=e.metrics)===null||a===void 0||a.histogram(_,c,{unit:"ms",attributes:m})}catch(u){Vs.error("Failed to record network metric",u)}var l},Ac=()=>{},Qp=(e,t)=>be(w?.fetch)?Xi(w,"fetch",i=>function(...s){const r=Xn(),n=i.apply(this,s);if(!t())return n;try{var o,a,l;const[u,d]=s,c=Mc((o=(a=d?.method)!==null&&a!==void 0?a:u?.method)!==null&&o!==void 0?o:"GET",(l=u?.url)!==null&&l!==void 0?l:u);return n.then(h=>(En(e,c,h?.status,r,t),h),h=>{throw En(e,c,void 0,r,t),h})}catch(u){return Vs.error("Failed to observe fetch",u),n}}):Ac,ev=(e,t)=>{var i;const s=w==null||(i=w.XMLHttpRequest)===null||i===void 0?void 0:i.prototype;if(!s)return Ac;const r=new WeakMap,n=Xi(s,"open",a=>function(...l){try{dc.has(this)||r.set(this,Mc(l[0],l[1]))}catch(u){Vs.error("Failed to observe XHR open",u)}return a.apply(this,l)}),o=Xi(s,"send",a=>function(...l){let u;try{const d=r.get(this);if(d&&t()){const c=Xn();u=()=>{this.removeEventListener("loadend",u),En(e,d,this.status,c,t)},se(this,"loadend",u)}}catch(d){Vs.error("Failed to observe XHR send",d)}try{return a.apply(this,l)}catch(d){throw u&&this.removeEventListener("loadend",u),d}});return()=>{n(),o()}},Qs={featureFlags:class{constructor(e){this.name="featureFlags",this.Zc=!1,this.featureFlagEventHandlers=[],this.$=Ba,this.Qc={},this.Jc={},this.Kc=[],this.Xc=!1,this.Yc=!1,this.td=0,this.ed=!1,this.nd=!1,this.sd=!1,this.rd=!1,this.od=0,this.ld=!1,this.an=()=>{const t=this.ad();this.od=0,t&&this.reloadFeatureFlags()},this.ud=()=>{var t,i;const s=this.hd,r=(t=this.dd)!==null&&t!==void 0?t:s;E(s)||E(r)||this.Ir.remoteRequestsDisabled||!I||I.visibilityState==="hidden"||Date.now()-((i=this.vd)!==null&&i!==void 0?i:0)<r||(this.dd=this.ld||!this.Ir.idleRefreshBackoff?s:Math.min(2*r,36e5),this.ld=!1,this.reloadFeatureFlags(),this.fd())},this.pd=()=>{this.ld&&this.dd===this.hd||this.gd()},this.ln=()=>{I?.visibilityState==="visible"&&this.gd()},"get"in e?this.bo=e:(this._instance=e,this.md=new zp(e.config,e.Yl()),this.bo=this.md)}updateConfig(e,t){var i;(i=this.md)===null||i===void 0||i.update(e,t),this.mo&&this.yd()}setup(e){return this.Eh=e,this.$=e.logger.createLogger("[FeatureFlags]"),Cc(e.kv.initialize(),()=>{this.Eh===e&&(this.Eh=void 0,this.mo=e,this.bd(e))})}bd(e){var t;if(this.mo===e)return w&&se(w,"online",this.an),this.yd(),this._d=e.registerDynamicEventProperties(()=>this.wd()?this.Qc:this.Jc),this.kd=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.onCrossTabFeatureFlagChange(()=>{this.Sd(),this.xd(),this.Cd()}),this.xd(),this.initialize()}gd(){this.ld=!0,this.dd=this.hd,this.ud()}yd(){const e=this.Ir.refreshIntervalMs,t=!this.Ir.remoteRequestsDisabled&&I&&!E(e)&&e>0?e:void 0;this.Ir.idleRefreshBackoff||(this.dd=t),t!==this.hd&&(this.$d(),E(t)||(this.hd=t,this.dd=t,this.fd(),I?.addEventListener&&(se(I,zi,this.ln),Kt(Ha,i=>{se(I,i,this.pd,{capture:!0})}))))}fd(){E(this.hd)||(E(this.Id)||clearInterval(this.Id),this.vd=Date.now(),this.Id=setInterval(this.ud,this.hd))}$d(){var e;E(this.Id)||(clearInterval(this.Id),this.Id=void 0,I==null||(e=I.removeEventListener)===null||e===void 0||e.call(I,"visibilitychange",this.ln),Kt(Ha,t=>{var i;I==null||(i=I.removeEventListener)===null||i===void 0||i.call(I,t,this.pd,{capture:!0})}
3)),this.hd=void 0,this.dd=void 0,this.ld=!1,this.vd=void 0}destroy(){this.Td()}dispose(){this.Td()}Td(){var e,t;this.$d(),this.td++,this.nd=!1,this.Eh=void 0,this.mo&&(this.Md(),(e=this._d)===null||e===void 0||e.dispose(),this._d=void 0,(t=this.kd)===null||t===void 0||t.call(this),this.kd=void 0,this.Kc=[],w?.removeEventListener("online",this.an),this.mo=void 0)}get Ir(){return this.bo.get()}Ed(e){var t;return this.Pd&&e in this.Pd?this.Pd[e]:(t=this.mo)===null||t===void 0?void 0:t.kv.get(e)}Sd(){return!!this.Pd&&(this.Pd=void 0,!0)}Rd(){var e;return!E((e=this.mo)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.Sd()}At(e){this.Ad(()=>{var t;return(t=this.mo)===null||t===void 0?void 0:t.kv.set(e)})}Fd(e,t,i){var s;if(!(!((s=this._instance)===null||s===void 0)&&s.persistence)||!e.$enabled_feature_flags)return;const r=this.Ed("$enabled_feature_flags")||{},n=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter(([,g])=>!g?.failed).map(([g])=>g):[],l=!!t.errorsWhileComputingFlags&&!!t.flags,u=l?a:i&&!j(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(r),...Object.keys(n)])),d=this.Ed("$feature_flag_payloads")||{},c=e.$feature_flag_payloads||{},h=l||i?u:Array.from(new Set([...Object.keys(d),...Object.keys(c)])),f=!l&&!i,_=!!f||u,m=!!f||h,v={[Qe]:_,[je]:_,[ht]:m};e.$feature_flag_details&&(v[Ft]=_);for(const g of[Mt,_t,Ti])E(e[g])||(v[g]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(v)}Lt(e){this.Ad(()=>{var t;return(t=this.mo)===null||t===void 0?void 0:t.kv.remove(e)})}Ad(e){try{e()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}xd(){const e={};for(const s of[Qe,ht,Mt,Ue]){const r=this.Ed(s);E(r)||(e[s]=r)}this.Qc=e;const t=p({},e),i=this.Ed(je);if(i)for(const[s,r]of Object.entries(i))t[`$feature/${s}`]=r;this.Jc=t}wd(){const e=this.Ir.cacheTtlMs;if(!e||0>=e)return!1;const t=this.Ed(_t);return typeof t!="number"||Date.now()-t>e}Od(){return!!this.wd()&&(this.rd||this.Yc||(this.rd=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Dd(){const e=this.Ir.evaluationContexts;return e?.length?e.filter(t=>{const i=t&&typeof t=="string"&&t.trim().length>0;return i||this.$.error("Invalid evaluation context found:",t,"Expected non-empty string"),i}):[]}Ld(){const e=this.Ir.flagKeys;if(!E(e))return e.filter(t=>{const i=t&&typeof t=="string"&&t.trim().length>0;return i||this.$.error("Invalid flag key found:",t,"Expected non-empty string"),i})}initialize(){var e,t;const i=this.Ir,s=(e=(t=i.bootstrap)===null||t===void 0?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(s).length){var r,n;const o=(r=(n=i.bootstrap)===null||n===void 0?void 0:n.featureFlagPayloads)!==null&&r!==void 0?r:{},a=Object.keys(s).filter(u=>!E(s[u])).reduce((u,d)=>(u[d]=s[d],u),{}),l=Object.keys(o).filter(u=>a[u]).reduce((u,d)=>(u[d]=o[d],u),{});return this.Nd({featureFlags:a,featureFlagPayloads:l},void 0,{persist:!1})}}updateFlags(e,t,i){var s,r;const n=i?.merge&&(s=this.Ed("$enabled_feature_flags"))!==null&&s!==void 0?s:{},o=i?.merge&&(r=this.Ed("$feature_flag_payloads"))!==null&&r!==void 0?r:{},a=p(p({},n),e),l=p(p({},o),t),u={};for(const[d,c]of Object.entries(a))u[d]={key:d,enabled:Do(c),variant:No(c),reason:void 0,metadata:E(l?.[d])?void 0:{id:0,version:void 0,description:void 0,payload:l[d]}};this.Nd({flags:u})}get hasLoadedFlags(){return this.Xc}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this.Ed(Ft),t=this.Ed(Ue),i=this.Ed(kt);if(!i&&!t)return e||{};const s=le({},e||{}),r=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(const a of r){var n;const l=s[a],u=t?.[a],d=E(u)?(n=l?.enabled)!==null&&n!==void 0&&n:!!u,c=E(u)?l?.variant:typeof u=="string"?u:void 0,h=i?.[a],f=p(p({},l),{},{enabled:d,variant:d?c??l?.variant:void 0});var o;d!==l?.enabled&&(f.original_enabled=l?.enabled),c!==l?.variant&&(f.original_variant=l?.variant),h&&(f.metadata=p(p({},l?.metadata),{},{payload:h,original_payload:l==null||(o=l.metadata)===null||o===void 0?void 0:o.payload})),s[a]=f}return this.Zc||(this.$.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.Zc=!0),s}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{const s=e[i];return{key:i,enabled:Do(s),variant:No(s),payload:Lo(t[i])}})}getFlagVariants(){const e=this.Ed(je),t=this.Ed(Ue);if(!t)return e||{};const i=le({},e||{}),s=Object.keys(t);for(let r=0;
3s.length>r;r++)i[s[r]]=t[s[r]];return this.Zc||(this.$.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.Zc=!0),i}getFlagPayloads(){const e=this.Ed(ht),t=this.Ed(kt);if(!t)return e||{};const i=le({},e||{}),s=Object.keys(t);for(let r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.Zc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.Zc=!0),i}reloadFeatureFlags(){this.ed||this.Ir.featureFlagsDisabled||this.ad()||(this.Yc&&(this.nd=!0),this.qd||(this.Kc.slice().forEach(e=>{try{e()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.qd=setTimeout(()=>{this.jd()},5)))}Md(){clearTimeout(this.qd),this.qd=void 0}onReloading(e){return this.Kc.push(e),()=>{this.Kc=this.Kc.filter(t=>t!==e)}}ensureFlagsLoaded(){this.Xc||this.Yc||this.qd||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.ed=e}resetFlagCallReported(){this.Lt(vt)}jd(e){this.Md();const t=this.mo;if(!t||this.Ir.remoteRequestsDisabled||this.ad())return;if(this.Yc)return void(this.nd=!0);const i={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:p(p(p({},t.initialPersonProperties),this.Ed("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.Ed(pt),timezone:sc()};E(t.deviceId)||(i.$device_id=t.deviceId),(e?.disableFlags||this.Ir.featureFlagsDisabled)&&(i.disable_flags=!0);const s=this.Dd();s.length&&(i.evaluation_contexts=s);const r=this.Ld();E(r)||(i.flag_keys=r);const n=this.Ir.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(n?"&only_evaluate_survey_feature_flags=true":""),a=this.td;this.Yc=!0;const l=()=>{this.nd&&(this.nd=!1,this.jd())},u=c=>{var h,f;const _=(h=c.json)!==null&&h!==void 0?h:{},m=c.statusCode!==200;if(this.Yc=!1,a!==this.td)return void l();if(this.Bd(c.statusCode),m||this.nd||(this.$anon_distinct_id=void 0),i.disable_flags&&!this.nd)return;this.sd=!m;const v=[];c.error?v.push(c.error instanceof Error&&c.error.name==="AbortError"?"timeout":c.error instanceof Error?Va:"unknown_error"):c.statusCode!==200&&v.push(`api_error_${c.statusCode}`),_.errorsWhileComputingFlags&&v.push("errors_while_computing_flags");const g=!!(!((f=_.quotaLimited)===null||f===void 0)&&f.includes("feature_flags"));g&&v.push("quota_limited"),this.At({[Ui]:v}),g?this.$.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."):i.disable_flags||this.Nd(_,m,{partialResponse:n}),l()},d=c=>{this.Yc=!1,a===this.td&&(this.At({[Ui]:[Va]}),this.$.error("Feature flag request failed",c),this.Rd()&&this.Cd(!0)),l()};try{t.sendRequest(o,{target:"flags",method:"POST",body:i,compression:this.Ir.compression,sentAt:"body",timeoutMs:this.Ir.requestTimeoutMs}).then(u).catch(d)}catch(c){d(c)}}ad(){return Ju(this.od,3)}Bd(e){this.od=Ku(e,this.od,3,()=>this.$.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,t={}){var i;if(t.fresh&&!this.sd)return;if(!(this.Xc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+e+Br);if(this.Od())return;const s=this.getFeatureFlagResult(e,t);return(i=s?.variant)!==null&&i!==void 0?i:s?.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this.sd)return;if(!(this.Xc||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+e+Br);if(this.Od())return;const i=this.getFlagVariants(),s=e in i,r=i[e],n=this.getFlagPayloads()[e],o=String(r),a=this.Ed("$feature_flag_request_id")||void 0,l=this.Ed("$feature_flag_evaluated_at")||void 0;let u,d=this.Ed("$flag_call_reported")||{};if(this.Ir.deduplicateCallsPerSession){var c;const M=(c=this.mo)===null||c===void 0?void 0:c.session.sessionId,D=this.Ed(Ii);M&&M!==D&&(d={},u=M)}if(t.send_event||!("send_event"in t))if(e in d&&d[e].includes(o))u&&this.At({[vt]:d,[Ii]:u});else{var h,f,_,m,v,g,y,x,S,b,O,C;j(d[e])?d[e].push(o):d[e]=[o],this.At(p({[vt]:d},u?{[Ii]:u}:{}));const M=this.getFeatureFlagDetails(e),D=[...(h=this.Ed("$feature_flag_errors"))!==null&&h!==void 0?h:[]];E(r)&&D.push("flag_missing");const U={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:n??null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(f=(_=this.Ir.bootstrap)===null||_===void 0||(_=_.featureFlags)===null||_===void 0?void 0:_[e])!==null&&f!==void 0?f:null,$feature_flag_bootstrapped_payload:(m=(v=this.Ir.bootstrap)===null||v===void 0||(v=v.featureFlagPayloads)===null||v===void 0?void 0:v[e])!==null&&m!==void 0?m:null,$used_bootstrap_value:!this.sd};E(M==null||(g=M.metadata)===null||g===void 0?void 0:g.has_experiment)||(U.$feature_flag_has_experiment=M.metadata.has_experiment),E(M==null||(y=M.metadata)===null||y===void 0?void 0:y.version)||(U.$feature_flag_version=M.metadata.version);const B=(x=M==null||(S=M.reason)===null||S===void 0?void 0:S.description)!==null&&x!==void 0?x:M==null||(b=M.reason)===null||b===void 0?void 0:b.code;var P;B&&(U.$feature_flag_reason=B),!(M==null||(O=M.metadata)===null||O===void 0)&&O.id&&
3(U.$feature_flag_id=M.metadata.id),E(M?.original_variant)&&E(M?.original_enabled)||(U.$feature_flag_original_response=E(M.original_variant)?M.original_enabled:M.original_variant),!(M==null||(C=M.metadata)===null||C===void 0)&&C.original_payload&&(U.$feature_flag_original_payload=M==null||(P=M.metadata)===null||P===void 0?void 0:P.original_payload),D.length&&(U.$feature_flag_error=D.join(",")),this.Hd(U)}else u&&this.At({[vt]:d,[Ii]:u});return s?{key:e,enabled:!!r,variant:typeof r=="string"?r:void 0,payload:Lo(n)}:void 0}Hd(e){try{var t;(t=this.mo)===null||t===void 0||t.capture("$feature_flag_called",e)}catch(i){this.$.error("Failed to capture feature flag call",i)}}getRemoteConfigPayload(e,t){this.zd(e,t)}zd(e,t){var i=this;return ue(function*(){const s=i.mo;if(!s)return;const r={distinct_id:s.distinctId,token:s.projectToken,person_properties:{$lib:s.library.name,$lib_version:s.library.version}},n=i.Dd();n.length&&(r.evaluation_contexts=n);const o=i.Ld();let a;E(o)||(r.flag_keys=o);try{var l;const u=(l=(yield s.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:r,compression:i.Ir.compression,sentAt:"body",timeoutMs:i.Ir.requestTimeoutMs})).json)===null||l===void 0?void 0:l.featureFlagPayloads;a=u?.[e]||void 0}catch(u){return void i.$.error("Remote config feature flag request failed",u)}try{t(a)}catch(u){i.$.error("Remote config feature flag callback failed",u)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this.sd)return t.defaultValue;if(!(this.Xc||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+e+Br),t.defaultValue;const i=this.getFeatureFlag(e,t);return E(i)?t.defaultValue:!!i}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){this.Nd(e,t,i)}Nd(e,t,i){if(!this.mo)return;this.Xc=!0;const s=((r,n={},o={},a={},l,u=Ba)=>{const d=((x,S)=>{const b=x.flags;if(b){const O=Object.fromEntries(Object.keys(b).map(P=>{var M;return[P,(M=b[P].variant)!==null&&M!==void 0?M:b[P].enabled]})),C=Object.fromEntries(Object.keys(b).filter(P=>b[P].enabled).filter(P=>{var M;return!E((M=b[P].metadata)===null||M===void 0?void 0:M.payload)}).map(P=>{var M;return[P,(M=b[P].metadata)===null||M===void 0?void 0:M.payload]}));return p(p({},x),{},{featureFlags:O,featureFlagPayloads:C})}return x.featureFlags&&S.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),x})(r,u),c=d.flags,h=d.featureFlags,f=d.featureFlagPayloads;if(!h)return;const _=r.requestId,m=r.evaluatedAt;if(j(h)){u.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const x={};if(h)for(let S=0;h.length>S;S++)x[h[S]]=!0;return{[Qe]:h,[je]:x,[Ti]:!1}}let v=h,g=f,y=c;if(l?.partialResponse){const x=Object.keys(v),S=g||{};v=p(p({},n),v),g=p(p({},o),S),x.forEach(b=>{b in S||g==null||delete g[b]}),y=p(p({},a),y)}else if(r.errorsWhileComputingFlags)if(c){const x=new Set(Object.keys(c).filter(b=>{var O;return!(!((O=c[b])===null||O===void 0)&&O.failed)}));v=p(p({},n),Object.fromEntries(Object.entries(v).filter(([b])=>x.has(b))));const S=Object.fromEntries(Object.entries(g||{}).filter(([b])=>x.has(b)));g=p(p({},o),S),x.forEach(b=>{b in S||g==null||delete g[b]}),y=p(p({},a),Object.fromEntries(Object.entries(y||{}).filter(([b])=>x.has(b))))}else v=p(p({},n),v),g=p(p({},o),g),y=p(p({},a),y);return p(p({[Qe]:Object.keys(za(v)),[je]:v||{},[ht]:g||{},[Ft]:y||{},[Ti]:r.minimalFlagCalledEvents===!0},_?{[Mt]:_}:{}),m?{[_t]:m}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),i,this.$);if(s)if(i?.persist===!1){const r=!E(this.mo.kv.get(je));this.Pd=s,r||this.At(s)}else this.Sd(),this.Fd(s,e,!!i?.partialResponse),this.At(s);else t&&this.Rd();t||(this.rd=!1),this.Cd(t)}override(e,t=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.Ud(e)}Ud(e){if(this.mo){if(e===!1)return this.Lt([Ue,kt]),this.Cd(),void $t.info("All overrides cleared");if(j(e))return this.At({[Ue]:Ua(e)}),this.Cd(),void $t.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t;const i=e;this.Zc=!!((t=i.suppressWarning)!==null&&t!==void 0&&t);const s={},r=i.flags,n=i.payloads;
3return r&&(s[Ue]=j(r)?Ua(r):r),n&&(s[kt]=n),Object.keys(s).length&&this.At(s),r===!1&&n===!1?this.Lt([Ue,kt]):r===!1?this.Lt(Ue):n===!1&&this.Lt(kt),this.Cd(),r===!1?$t.info("Flag overrides cleared"):r&&$t.info("Flag overrides set",{flags:r}),void(n===!1?$t.info("Payload overrides cleared"):n&&$t.info("Payload overrides set",{payloads:n}))}if(e&&typeof e=="object")return this.At({[Ue]:e}),this.Cd(),void $t.info("Flag overrides set",{flags:e});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Xc){const{flags:t,flagVariants:i}=this.Wd();try{e(t,i)}catch(s){this.$.error("Error while running feature flags callback",s)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;const r=(this.Ed("$early_access_features")||[]).find(u=>u.flagKey===e),n={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};r&&(o.$early_access_feature_name=r.name),i&&(o.$feature_enrollment_stage=i);const a=p(p({},this.getFlagVariants()),{},{[e]:t});(s=this._instance)===null||s===void 0||(s=s.persistence)===null||s===void 0||s.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(n)}),this.At({[Qe]:Object.keys(za(a)),[je]:a,[ft]:p(p({},this.Ed("$stored_person_properties")||{}),n)}),this.Cd();try{var l;(l=this.mo)===null||l===void 0||l.capture("$feature_enrollment_update",o)}catch(u){this.$.error("Failed to capture early access feature enrollment",u)}}getEarlyAccessFeatures(e,t=!1,i){const s=this.Ed(ln);!s||t?this.Vd(e,i):e(s)}Vd(e,t){var i=this;return ue(function*(){const s=i.mo;if(!s)return;const r=t?`&${t.map(o=>`stage=${o}`).join("&")}`:"";let n;try{const o=yield s.sendRequest(`/api/early_access_features/?token=${s.projectToken}${r}`,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;n=o.json.earlyAccessFeatures,i.At({[ln]:n})}catch(o){return void i.$.error("Early access feature request failed",o)}try{e(n)}catch(o){i.$.error("Early access feature callback failed",o)}})()}Wd(){const e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(i=>t[i]),flagVariants:Object.keys(t).filter(i=>t[i]).reduce((i,s)=>(i[s]=t[s],i),{})}}Cd(e){this.xd();const{flags:t,flagVariants:i}=this.Wd();this.featureFlagEventHandlers.forEach(s=>{try{s(t,i,{errorsLoading:e})}catch(r){this.$.error("Error while running feature flags callback",r)}})}setPersonPropertiesForFlags(e,t=!0){this.Gd(e,t)}Gd(e,t=!0){const i=this.Ed("$stored_person_properties")||{},s=e?.$set||(e?.$set_once?{}:e),r=e?.$set_once,n={};if(r)for(const o in r)({}).hasOwnProperty.call(r,o)&&(o in i||(n[o]=r[o]));this.At({[ft]:p(p(p({},i),n),s)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const i=p({},this.Ed("$stored_person_properties")||{});e.forEach(s=>{delete i[s]}),this.At({[ft]:i}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(ft),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const i=this.Ed("$stored_group_properties")||{},s=p({},i);for(const r of Object.keys(e))s[r]=p(p({},i[r]),e[r]);this.At({[pt]:s}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this.Ed("$stored_group_properties")||{};this.At({[pt]:p(p({},t),{},{[e]:{}})})}else this.Lt(pt)}reset(){this.td++,this.nd=!1,this.Qc={},this.Jc={},this.Pd=void 0,this.Xc=!1,this.ed=!1,this.sd=!1,this.$anon_distinct_id=void 0,this.Md(),this.Zc=!1,this.od=0}}},tv={sessionRecording:class{get Ir(){return this._instance.config}get Ca(){return this._instance.persistence}get started(){var e;return!!(!((e=this.Zd)===null||e===void 0)&&e.isStarted)}get status(){var e,t;return this.Qd==="awaiting_config"||this.Qd==="missing_config"?this.Qd:(e=(t=this.Zd)===null||t===void 0?void 0:t.status)!==null&&e!==void 0?e:this.Qd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.Qd=Nr,this.Jd=void 0,this.Kd=!1,this.Xe=(()=>{var t,i;if(!I?.visibilityState||I.visibilityState==="visible")return!0;const s=w==null||(t=w.performance)===null||t===void 0||(i=t.getEntriesByType)===null||i===void 0?void 0:i.call(t,"visibility-state");return!s?.length||s.some(r=>r.name==="visible")})(),this.ln=()=>{var t,i;I?.visibilityState==="visible"&&(this.Xe=!0,(t=this.Zd)===null||t===void 0||(i=t.setDocumentWasEverVisible)===null||i===void 0||i.call(t,!0))},!this._instance.sessionManager)throw Xe.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Ir.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');I?.addEventListener&&se(I,"visibilitychange",this.ln)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.Kd=!0,I==null||(t=I.removeEventListener)===null||t===void 0||t.call(I,"visibilitychange",this.ln),e?this.Xd(!0):this.stopRecording()}get Yd(){var e;const t=!!(!((e=this._instance.get_property("$session_recording_remote_config"))===null||e===void 0)&&e.enabled),i=!this.Ir.disable_session_recording,s=this.Ir.disable_session_recording||this._instance.consent.isOptedOut();return w&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(this.Kd||this.Yd&&(!((t=this.Zd)===null||t===void 0)&&t.isStarted))return;const i=!E(Object.assign)&&!E(Array.from);this.Yd&&i?(this.tv(e),Xe.info("starting")):(this.Qd=Nr,this.stopRecording())}tv(e){var t,i;if(this.Yd)if(this.Qd!=="awaiting_config"&&this.Qd!=="missing_config"&&(this.Qd=Ra),(L==null||(t=L.__PosthogExtensions__)===null||t===void 0||(t=t.rrweb)===null||t===void 0?void 0:t.record)&&((i=L.__PosthogExtensions__)===null||i===void 0?void 0:i.initSessionRecording))this.ev(e);else{var s,r;const n=this._instance.sessionManager;(s=L.__PosthogExtensions__)===null||s===void 0||(r=s.loadExternalDependency)===null||r===void 0||r.call(s,this._instance,this.iv,o=>{if(!this.Kd&&this.Yd&&this._instance.sessionManager===n)return o?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Xe.error("could not load recorder",o)):void this.ev(e);this.Qd="disabled"})}}stopRecording(){var e,t;(e=this.Jd)===null||e===void 0||e.call(this),this.Jd=void 0,(t=this.Zd)===null||t===void 0||t.stop()}Xd(e=!1){var t,i;(t=this.Jd)===null||t===void 0||t.call(this),this.Jd=void 0,(i=this.Zd)===null||i===void 0||i.discard({discardProducerEvents:e})}nv(){var e,t;(e=this.Ca)===null||e===void 0||e.unregister("$session_is_sampled"),(t=this.Ca)===null||t===void 0||t.unregister("$replay_sample_rate")}sv(e,t){if(z(e))return null;const i=ge(e)?e:parseFloat(e);return typeof(s=i)!="number"||!Number.isFinite(s)||0>s||s>1?(Xe.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):i;var s}rv(e){if(this.Ca){var t,i;const s=this.Ca,r=()=>{var n;const o=e.sessionRecording===!1?void 0:e.sessionRecording,a=this.sv((n=this.Ir.session_recording)===null||n===void 0?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.sv(o?.sampleRate,"remote config sampleRate"),u=a??l;z(u)&&this.nv();const d=o?.minimumDurationMilliseconds;s.register({[Ai]:p(p({cache_timestamp:Date.now(),enabled:!!o},o),{},{networkPayloadCapture:p({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:u,minimumDurationMilliseconds:E(d)?null:d,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers,version:o?.version,triggerGroups:o?.triggerGroups})})};r(),(t=this.Jd)===null||t===void 0||t.call(this),this.Jd=(i=this._instance.sessionManager)===null||i===void 0?void 0:i.onSessionId(r)}}onRemoteConfig(e){const t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?t.sessionRecording===!1?(this.rv(t),void this.Xd()):(this.rv(t),void this.startIfEnabledOrStop()):(this.Qd==="awaiting_config"&&(this.Qd="missing_config",Xe.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t="log"){var i;!((i=this.Zd)===null||i===void 0)&&i.log?this.Zd.log(e,t):Xe.warn("log called before recorder was ready")}get iv(){var e,t;const i=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.get_property(Ai);return(i==null||(t=i.scriptConfig)===null||t===void 0?void 0:t.script)||"lazy-recorder"}ov(){const e=this._instance.get_property(Ai);if(!e)return!1;let t;try{t=typeof e=="object"?e:JSON.parse(e)}catch(i){return Xe.warn("persisted remote config for session recording is invali
3d and will be ignored",i),!1}return!z(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}ev(e){var t,i,s;if(!this.Kd&&this.Yd&&this._instance.sessionManager){if(!(!((t=L.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return Xe.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Mu]:!0});var r;if(this.Zd||(this.Zd=(r=L.__PosthogExtensions__)===null||r===void 0?void 0:r.initSessionRecording(this._instance,this.Xe),this.Zd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.ov())return this.Qd==="missing_config"||this.Qd==="awaiting_config"?void 0:(this.Qd="awaiting_config",Xe.info("persisted remote config is stale, requesting fresh config before starting"),void new nc(this._instance).load());this.Qd=Ra,(i=(s=this.Zd).setDocumentWasEverVisible)===null||i===void 0||i.call(s,this.Xe),this.Zd.start(e)}else this.Qd=Nr}onRRwebEmit(e){var t,i;(t=this.Zd)===null||t===void 0||(i=t.onRRwebEmit)===null||i===void 0||i.call(t,e)}overrideLinkedFlag(){var e,t;this.Zd||(t=this.Ca)===null||t===void 0||t.register({$replay_override_linked_flag:!0}),(e=this.Zd)===null||e===void 0||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Zd||(t=this.Ca)===null||t===void 0||t.register({$replay_override_sampling:!0}),(e=this.Zd)===null||e===void 0||e.overrideSampling()}overrideTrigger(e){var t,i;this.Zd||(i=this.Ca)===null||i===void 0||i.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.Zd)===null||t===void 0||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Zd)===null||e===void 0?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!!(!((i=this.Zd)===null||i===void 0)&&i.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;(e=this.Zd)===null||e===void 0||(t=e.flushBeforeIdentityReset)===null||t===void 0||t.call(e)}}},iv={autocapture:class extends Fp{constructor(e){super(new Mp(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.lv=this.av()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this.uv();return!!(e.path||e.search||this.hv(e))}startIfEnabled(){this.isEnabled&&(F.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.lv=this.av(),this.startIfEnabled()}stop(){this.dv&&this.dv(),this.dv=void 0,this.vv&&this.vv(),this.vv=void 0,F.info("History API monitoring stopped")}monitorHistoryChanges(){w&&w.history&&(this.fv("pushState"),this.fv("replaceState"),this.pv(),this.hv()&&this.gv())}fv(e){var t;if(!w||!((t=w.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;const i=this;Xi(w.history,e,s=>function(r,n,o){s.call(this,r,n,o),i.mv(e)})}av(){const e=w?.location;if(e?.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}uv(){const e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:Q(e)?e:{}}hv(e=this.uv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}yv(e){const t=this.uv(),i=this.lv;return!(!i||!(t.path&&e.pathname!==i.pathname||t.search&&e.search!==i.search||this.hv(t)&&e.hash!==i.hash))}mv(e){try{const t=this.av();if(!t)return;this.yv(t)&&this._instance.capture(Hn,{navigation_type:e}),this.lv=t}catch(t){F.error(`Error capturing ${e} pageview`,t)}}pv(){if(this.dv)return;const e=()=>{this.mv("popstate")};se(w,"popstate",e),this.dv=()=>{w&&w.removeEventListener("popstate",e)}}gv(){if(this.vv)return;const e=()=>{this.mv("hashchange")};se(w,"hashchange",e),this.vv=()=>{w&&w.removeEventListener("hashchange",e)}}},heatmaps:class{get Ir(){return this.instance.config}constructor(e){var t;this.bv=!1,this._o=!1,this._v=null,this.instance=e,this.bv=!!(!((t=this.instance.persistence)===null||t===void 0)&&t.props[rn]),this.rageclicks=new Oc(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return Q(this.Ir.capture_heatmaps)&&this.Ir.capture_heatmaps.flush_interval_milliseconds&&(e=this.Ir.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return z(this.Ir.capture_heatmaps)?z(this.Ir.enable_heatmaps)?this.bv:this.Ir.enable_heatmaps:this.Ir.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this._o)return;Lp.info("starting..."),this.wv(),this.ln()}else{var e;clearInterval((e=this._v)!==null&&e!==void 0?e:void 0),this.Sv(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("heatmaps"in t))return;const i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[rn]:i}),this.bv=i,this.startIfEnabled()}getAndClearBuffer(){const e=this.Rt;return this.Rt=void 0,e}xv(e){jr(e.originalEvent)&&this.Mr(e.originalEvent,"deadclick")}ln(){this._v&&clearInterval(this._v),this._v=I?.visibilityState==="visible"?setInterval(this.pa.bind(this),this.flushIntervalMilliseconds):null}wv(){w&&I&&(this.Cv=this.pa.bind(this),se(w,Rs,this.Cv),this.$v=e=>this.Mr(e||w?.event),se(I,"click",this.$v,{capture:!0}),this.Iv=e=>this.Tv(e||w?.event),se(I,"mousemove",this.Iv,{capture:!0}
3),this.Mv=new ua(this.instance,jf,this.xv.bind(this)),this.Mv.startIfEnabledOrStop(),this.Ev=this.ln.bind(this),se(I,zi,this.Ev),this._o=!0)}Sv(){var e;w&&I&&(this.Cv&&w.removeEventListener(Rs,this.Cv),this.$v&&I.removeEventListener("click",this.$v,{capture:!0}),this.Iv&&I.removeEventListener("mousemove",this.Iv,{capture:!0}),this.Ev&&I.removeEventListener(zi,this.Ev),clearTimeout(this.Pv),(e=this.Mv)===null||e===void 0||e.stop(),this._o=!1)}Rv(e,t){const i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=(function(o,a,l){let u=o;for(;u&&Je(u)&&!xe(u,"body");){if(u===l)return!1;let f;try{var d,c,h;f=(d=(c=(h=u.ownerDocument)===null||h===void 0?void 0:h.defaultView)!==null&&c!==void 0?c:w)===null||d===void 0?void 0:d.getComputedStyle(u).position}catch{return!1}if(q(a,f))return!0;u=Bu(u)}return!1})(Ri(e),["fixed","sticky"],r);return{x:e.clientX+(n?0:s),y:e.clientY+(n?0:i),target_fixed:n,type:t}}Mr(e,t="click"){var i;if(Qo(e.target)||!jr(e))return;const s=this.Rv(e,t);!((i=this.rageclicks)===null||i===void 0)&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&Vu(Ri(e),this.instance.config.rageclick)&&this.Zs(p(p({},s),{},{type:"rageclick"})),this.Zs(s)}Tv(e){!Qo(e.target)&&jr(e)&&(clearTimeout(this.Pv),this.Pv=setTimeout(()=>{this.Zs(this.Rv(e,"mousemove"))},500))}Zs(e){if(!w)return;const t=this.Ir.disable_capture_url_hashes?mt(w.location.href):w.location.href,i=this.Ir.custom_personal_data_properties,s=this.Ir.mask_personal_data_properties?[...ci,...i||[]]:[],r=Ji(t,s,Ki);this.Rt=this.Rt||{},this.Rt[r]||(this.Rt[r]=[]),this.Rt[r].push(e)}pa(){this.Rt&&!Ce(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:ua,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.bv=!1,this._o=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Av=()=>{clearTimeout(this.Fv),this.Fv=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",p({$current_url:this.Rt.url},this.Rt.metrics.reduce((i,s)=>p(p({},i),{},{[`$web_vitals_${s.name}_event`]:p({},s),[`$web_vitals_${s.name}_value`]:s.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Ov=i=>{var s;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},z(i?.name)||z(i?.value))return void wt.error("Invalid metric received",i);const r=typeof i.navigationURL=="string"?i.navigationURL:void 0,n=this.Dv(r);if(E(n))return;const o=ge(i.navigationId)||typeof i.navigationId=="string"?`navigation:${i.navigationId}`:`url:${n}`;if(this.Lv&&i.value>=this.Lv)return void wt.error("Ignoring metric with value >= "+this.Lv,i);this.Rt.navigationKey!==o&&(this.Av(),this.Fv=setTimeout(this.Av,this.flushToCaptureTimeoutMs)),E(this.Rt.navigationKey)&&(this.Rt.navigationKey=o,this.Rt.url=n),this.Rt.firstMetricTimestamp=E(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const a=(s=this._instance.sessionManager)===null||s===void 0?void 0:s.checkAndGetSessionAndWindowId(!0),l=p(p(p({},i),r?{navigationURL:n}:{}),{},{$current_url:n,timestamp:Date.now()});if(delete l.entries,Q(i.attribution)&&this.attributionMetrics.indexOf(i.name)>-1){const u={};for(const d of Rp){const c=d==="url"&&typeof i.attribution[d]=="string"?this.Dv(i.attribution[d]):i.attribution[d];E(c)||(u[d]=c)}l.attribution=u}else delete l.attribution;E(a)||(l.$session_id=a.sessionId,l.$window_id=a.windowId),this.Rt.metrics.push(l),this.Rt.metrics.length===this.allowedMetrics.length&&this.Av()},this.Nv=()=>{if(this._o)return;let i,s,r,n,o=!1;const a=L.__PosthogExtensions__,l=a?.postHogWebVitalsCallbacksByFlavor,u=l?.[this.qv]||(this.qv==="web-vitals"&&E(l)?a?.postHogWebVitalsCallbacks:void 0);if(!E(u)){const h=u.withoutAttribution,f=this.attributionMetrics;o=!E(h),i=f.indexOf("LCP")>-1?u.onLCP:h?.onLCP||u.onLCP,s=f.indexOf("CLS")>-1?u.onCLS:h?.onCLS||u.onCLS,r=f.indexOf("FCP")>-1?u.onFCP:h?.onFCP||u.onFCP,n=f.indexOf("INP")>-1?u.onINP:h?.onINP||u.onINP}if(!(i&&s&&r&&n))return void wt.error("web vitals callbacks not loaded - not starting");const d={reportSoftNavs:this.useSoftNavs},c=o&&this.attributionMetrics.indexOf("INP")>-1?p(p({},d),{},{includeProcessedEventEntries:!1}):d;this.allowedMetrics.indexOf("LCP")>-1&&i(this.Ov.bind(this),d),this.allowedMetrics.indexOf("CLS")>-1&&s(this.Ov.bind(this),d),this.allowedMetrics.indexOf("FCP")>-1&&r(this.Ov.bind(this),d),this.allowedMetrics.indexOf("INP")>-1&&n(this.Ov.bind(this),c),this._o=!0},this.bv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[an]),this.startIfEnabled()}get jv(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const i=Q(this.jv)?(e=this.jv)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return z(i)?((t=this._instance.persistence)===null||t===void 0?void 0:t.props.$web_vitals_allowed_metrics)||Ta:i}get flushToCaptureTimeoutMs(){return(Q(this.jv)?this.jv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=Q(this.jv)?this.jv.web_vitals_attribution:void 0;return Pe(e)?e?Ta:[]:j(e)?e:Tp}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=Q(this.jv)?this.jv.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get Lv(){const e=Q(this.jv)&&ge(this.jv.__web_vitals_max_value)?this.jv.__web_vitals_max_value:Aa;return e>0&&6e4>=e?Aa:e}get isEnabled(){const e=he?.protocol;if(e!=="http:"&&e!=="https:")return wt.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=Q(this.jv)?this.jv.web_vitals:Pe(this.jv)?this.jv:void 0;return Pe(t)?t:this.bv}startIfEnabled(){this.isEnabled&&!this._o&&(wt.info("enabled, starting..."),this.qo(this.Nv))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const i=Q(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=Q(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[an]:i}),this._instance.persistence.register({[wu]:s})),this.bv=i,this.startIfEnabled()}get qv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}qo(e){var t;const i=L.__PosthogExtensions__,s=this.qv,r=i?.postHogWebVitalsCallbacksByFlavor;r?.[s]||s==="web-vitals"&&E(r)&&i?.postHogWebVitalsCallbacks?e():i==null||(t=i.loadExternalDependency)===null||t===void 0||t.call(i,this._instance,s,n=>{n?wt.error("failed to load script",n):e()})}Dv(e){const t=e||w?.location.href;if(!t)return void wt.error("Could not determine current URL");const i=this._instance.config.disable_capture_url_hashes?mt(t):t,s=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...ci,...s||[]]:[];return Ji(i,r,Ki)}}},sv={exceptionObserver:class{constructor(e){var t;this.Nv=()=>{var i;if(!w||!this.isEnabled||!(!((i=L.__PosthogExtensions__)===null||i===void 0)&&i.errorWrappingFunctions))return;const s=L.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=L.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=L.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Bv&&this.Ir.capture_unhandled_errors&&(this.Bv=s(this.captureException.bind(this))),!this.Hv&&this.Ir.capture_unhandled_rejections&&(this.Hv=r(this.captureException.bind(this))),!this.zv&&this.Ir.capture_console_errors&&(this.zv=n(this.captureException.bind(this)))}catch(o){ki.error("failed to start",o),this.Uv()}},this._instance=e,this.Wv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[nn]),this.wt=new Yd(p(p({},(function(i={}){var s,r,n,o;return{refillRate:(s=(r=i.exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:i.__exceptionRateLimiterRefillRate)!==null&&s!==void 0?s:1,bucketSize:(n=(o=i.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:i.__exceptionRateLimiterBucketSize)!==null&&n!==void 0?n:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:ki})),this.Ir=this.Vv(),this.startIfEnabledOrStop()}Vv(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Q(e)?t=p(p({},t),e):(E(e)?this.Wv:e)&&(t=p(p({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Ir.capture_console_errors||this.Ir.capture_unhandled_errors||this.Ir.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ki.info("enabled"),this.Uv(),this.qo(this.Nv)):this.Uv()}qo(e){var t,i,s;!((t=L.__PosthogExtensions__)===null||t===void 0)&&t.errorWrappingFunctions?e():(i=L.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"exception-autocapture",r=>{if(r)return ki.error("failed to load script",r);e()})}Uv(){var e,t,i;(e=this.Bv)===null||e===void 0||e.call(this),this.Bv=void 0,(t=this.Hv)===null||t===void 0||t.call(this),this.Hv=void 0,(i=this.zv)===null||i===void 0||i.call(this),this.zv=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this.Wv=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[nn]:this.Wv}),this.Ir=this.Vv(),this.startIfEnabledOrStop())}onConfigChange(){this.Ir=this.Vv()}captureException(e){try{var t,i,s;const r=(t=e==null||(i=e.$exception_list)===null||i===void 0||(i=i[0])===null||i===void 0?void 0:i.type)!==null&&t!==void 0?t:"Exception";if(this.wt.consumeRateLimit(r))return void ki.info("Skipping exception capture because of client rate limiting.",{exception:r});(s=this._instance.exceptions)===null||s===void 0||s.sendExceptionEvent(e)}catch{}}},exceptions:class{constructor(e){var t,i;this.Gv=[],this.Zv=new uh([new Eh,new Ah,new Sh,new kh,new Fh,new Ch,new Ph,new Mh],(function(s,...r){return(n,o=0)=>{const a=[],l=n.split(` 4`),u=Math.min(l.length,o+1e3),d=[];for(let f=o;u>f;f++){const _=l[f];if(_.length>1024)continue;
4const m=Ro.test(_)?_.replace(Ro,"$1"):_;if(!m.match(/\S*Error: /)){for(const v of r){const g=v(m,s);if(g){a.push(g);const y=bh(a);if(y){for(let x=d.length-1;x>=0;x--){const S=d[x];if(y.start>=S.start+S.length)break;d.pop()}d.push(y)}break}}if($h(a,d)>=50)break}}const c=[...d].sort((f,_)=>_.start-f.start),h=c[c.length-1];if(h){const f=su(a,h);a.splice(h.start-f,f);for(const _ of c)_.start-=f}for(const f of c)wh(a,f);return d.some(f=>f.start===0&&a.length===f.length)&&(function(f){const _=f.map(v=>`${v.function}|${v.filename}|${v.lineno}|${v.colno}|${v.module}`);let m=0;for(let v=1;_.length>v;v++)xh(_,v,m)&&(m=v);f.push(...f.splice(0,m))})(a),(function(f){if(!f.length)return[];const _=Array.from(f);return _.reverse(),_.slice(0,50).map(m=>{return p(p({},m),{},{filename:m.filename||(v=_,v[v.length-1]||{}).filename,function:m.function||"?"});var v})})(a)}})("web:javascript",gh,yh)),this._instance=e,this.Gv=(t=(i=this._instance.persistence)===null||i===void 0?void 0:i.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this.Qv=Cs(this.Jv()),this.Kv=new Rh(this.Qv)}onConfigChange(){this.Qv=Cs(this.Jv()),this.Kv.setConfig(this.Qv)}onRemoteConfig(e){var t,i,s;if(!e.ok)return;const r=e.config;if(!("errorTracking"in r))return;const n=(t=(i=r.errorTracking)===null||i===void 0?void 0:i.suppressionRules)!==null&&t!==void 0?t:[],o=(s=r.errorTracking)===null||s===void 0?void 0:s.captureExtensionExceptions;this.Gv=n,this._instance.persistence&&this._instance.persistence.register({[yu]:this.Gv,[on]:o})}get Xv(){var e;const t=!!this._instance.get_property(on),i=this._instance.config.error_tracking.captureExtensionExceptions;return(e=i??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.Zv.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}addExceptionStep(e,t){if(this.Qv.enabled)try{if(!Y(e)||e.trim().length===0)return void De.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:i,droppedKeys:s}=(function(r){if(!r)return{sanitizedProperties:{},droppedKeys:[]};const n=[];return{sanitizedProperties:Object.keys(r).reduce((o,a)=>Th.has(a)?(n.push(a),o):(o[a]=r[a],o),{}),droppedKeys:n}})(this.Yv(t));s.length>0&&De.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.Kv.add(p({[Ps]:e,[Os]:new Date().toISOString()},i))}catch(i){De.error("Failed to add exception step. Ignoring breadcrumb.",i)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this.tf(t)){if(this.ef(t))return this.if("Exception dropped: matched a suppression rule"),void De.info("Skipping exception capture because a suppression rule matched");if(!this.Xv&&this.nf(t))return this.if("Exception dropped: thrown by a browser extension"),void De.info("Skipping exception capture because it was thrown by an extension");if(!this.Xv&&this.sf(t))return this.if("Exception dropped: thrown by an injected browser script"),void De.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.rf(t))return this.if("Exception dropped: thrown by the PostHog SDK"),void De.info("Skipping exception capture because it was thrown by the PostHog SDK")}const i=this.Qv.enabled&&z(e.$exception_steps)?this.lf(e):e,s=(function(){const r=globalThis._posthogReleaseId;return typeof r=="string"&&r.length>0?r:void 0})();s&&(i.$release_id=s);try{const r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",ah:!0});return r&&this.Kv.clear(),r}catch(r){return Wa(r)||De.error("Failed to capture exception event. Dropping this exception.",r),void this.Kv.clear()}}catch(t){return void(Wa(t)||De.error("Failed to process exception event. Ignoring this exception.",t))}}lf(e){try{const t=this.Kv.getAttachable();return t.length===0?e:p(p({},e),{},{$exception_steps:t})}catch(t){return De.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}if(e){this.Qv.enabled&&this.Kv.add({[Ps]:e,[Os]:new Date().toISOString()})}Yv(e){return Q(e)?p({},e):{}}Jv(){var e,t;return(e=(t=this._instance.config.error_tracking)===null||t===void 0?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}ef(e){if(e.length===0)return!1;try{const t=e.reduce((i,{type:s,value:r})=>(Y(s)&&s.length>0&&i.$exception_types.push(s),Y(r)&&r.length>0&&i.$exception_values.push(r),i),{$exception_types:[],$exception_values:[]});return this.Gv.some(i=>{const s=i.values.map(r=>{const n=kc[r.operator],o=t[r.key];if(!n||!o)return!1;const a=j(r.value)?r.value:[r.value];return a.length>0&&n(a,o)});return i.type==="OR"?s.some(Boolean):s.every(Boolean)})}catch(t){return De.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}nf(e){const t=e.flatMap(s=>{var r,n;return(r=(n=s.stacktrace)===null||n===void 0?void 0:n.frames)!==null&&r!==void 0?r:[]}),i=t.filter(({filename:s})=>!!s&&Gp.some(r=>s.startsWith(r)));return i.length!==0&&(!i.every(({filename:s})=>!!s&&s.startsWith(xn))||e.some(({type:s,value:r})=>s==="NoResponse"||Y(r)&&Wp.some(({value:n,exact:o})=>o?r===n:r.includes(n)))&&!t.some(({in_app:s,filename:r})=>s&&!r?.startsWith(xn)))}sf(e){return e.some(({value:t})=>Y(t)&&Jp.some(i=>t.includes(i)))}rf(e){if(e.length>0){var t,i,s,r;const n=(t=(i=e[0].stacktrace)===null||i===void 0?void 0:i.frames)!==null&&t!==void 0?t:[],o=n[n.length-1];return(s=o==null||(r=o.filename)===null||r===void 0?void 0:r.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}tf(e){return!z(e)&&j(e)}}},rv=p({productTours:class{get Ca(){return this._instance.persistence}constructor(e){this.af=null,this.uf=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if("productTours"in t){var i,s;if(this.Ca&&this.Ca.register({[jn]:!!t.productTours}),!qr(this._instance))return!this.af&&z((i=this.Ca)===null||i===void 0?void 0:i.props.ph_product_tours)||hs.info("product tours disabled; stopping and clearing cached tours"),(s=this.af)===null||s===void 0||s.stop(),this.af=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.af&&qr(this._instance)&&this.qo(()=>this.hf())}qo(e){var t,i,s;!((t=L.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours?e():(i=L.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"product-tours",r=>{r?hs.error("Could not load product tours script",r):e()})}hf(){var e;!this.af&&(!((e=L.__PosthogExtensions__)===null||e===void 0)&&e.generateProductTours)&&(this.af=L.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(j(this.uf)&&!t)return void e(this.uf,{isLoaded:!0});const i=this.Ca;if(i){const s=i.props[cn];if(j(s)&&!t)return this.uf=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:s=>{if(!qr(this._instance))return void e([],{isLoaded:!0});const r=s.statusCode;if(r!==200||!s.json){const o=`Product Tours API could not be loaded, status: ${r}`;return r===0?s.error||hs.warn(o):hs.error(o),void e([],{isLoaded:!1,error:o})}const n=j(s.json.product_tours)?s.json.product_tours:[];this.uf=n,i&&i.register({[cn]:n}),e(n,{isLoaded:!0})}})}getActiveProductTours(e){z(this.af)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.af.getActiveProductTours(e)}showProductTour(e){var t;(t=this.af)===null||t===void 0||t.showTourById(e)}previewTour(e){this.af?this.af.previewTour(e):this.qo(()=>{var t;this.hf(),(t=this.af)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this.af)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.af)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this.af)===null||e===void 0||e.previousStep()}clearCache(){var e;this.uf=null,(e=this.Ca)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this.af)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this.af)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.af)===null||t===void 0||t.cancelPendingTour(e)}}},Qs),nv={siteApps:class{constructor(e){this._instance=e,this.cf=0,this.df=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}vf(e,t){if(!t)return;const i=this.globalsForEvent(t);this.df.push(i),this.df.length>1e3&&(this.df=this.df.slice(10))}get siteAppLoaders(){var e;return(e=L._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.siteApps}initialize(){if(this.isEnabled){const e=this._instance._addCaptureHook(this.vf.bind(this));this.ff=()=>{e(),this.df=[],this.ff=void 0}}}globalsForEvent(e){var t,i,s,r,n,o,a;if(!e)throw new Error("Event payload is required");const l={},u=this._instance.get_property("$groups")||[],d=this._instance.get_property("$stored_group_properties")||{};for(const[f,_]of Object.entries(d))l[f]={id:u[f],type:f,properties:_};const{$set_once:c,$set:h}=e;return{event:p(p({},au(e,Dp)),{},{properties:p(p(p({},e.properties),h?{$set:p(p({},(t=(i=e.properties)===null||i===void 0?void 0:i.$set)!==null&&t!==void 0?t:{}),h)}:{}),c?{$set_once:p(p({},(s=(r=e.properties)===null||r===void 0?void 0:r.$set_once)!==null&&s!==void 0?s:{}),c)}:{}),elements_chain:(n=(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(a=e.properties)===null||a===void 0?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}pf(e){var t;const i=(t=e.tagName)===null||t===void 0?void 0:t.toLowerCase();return i==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(Ve.error("prepare_external_dependency_stylesheet returned null"),null):i==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(Ve.error("prepare_external_dependency_script returned null"),null):e}gf(){var e,t,i,s,r,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const l=I?.defaultView,u=l==null||(e=l.Node)===null||e===void 0?void 0:e.prototype;if(!l||!u)return()=>{};if(this.cf++,this.mf)return this.yf();const d=[],c=this,h=new WeakSet,f=(v,g,y)=>{if(!v?.[g])return;const x=v[g];v[g]=y(x),d.push(()=>{v[g]=x})},_=v=>{if(h.has(v))return v;const g=c.pf(v);return g&&h.add(g),g},m=v=>v.map(g=>typeof g=="string"?g:_(g)).filter(g=>!ve(g));return f(u,"appendChild",v=>function(g){const y=_(g);return y?v.call(this,y):g}),f(u,"insertBefore",v=>function(g,y){const x=_(g);return x?v.call(this,x,y):g}),f(u,"replaceChild",v=>function(g,y){const x=_(g);return x?v.call(this,x,y):y}),[(t=l.Element)===null||t===void 0?void 0:t.prototype,(i=l.Document)===null||i===void 0?void 0:i.prototype,(s=l.DocumentFragment)===null||s===void 0?void 0:s.prototype].forEach(v=>{f(v,"append",g=>function(...y){return g.apply(this,m(y))}),f(v,"prepend",g=>function(...y){return g.apply(this,m(y))})}),[(r=l.Element)===null||r===void 0?void 0:r.prototype,(n=l.CharacterData)===null||n===void 0?void 0:n.prototype,(o=l.DocumentType)===null||o===void 0?void 0:o.prototype].forEach(v=>{f(v,"before",g=>function(...y){return g.apply(this,m(y))}),f(v,"after",g=>function(...y){return g.apply(this,m(y))}),f(v,"replaceWith",g=>function(...y){const x=m(y);return y.length&&!x.length?void 0:g.apply(this,x)})}),f((a=l.Element)===null||a===void 0?void 0:a.prototype,"insertAdjacentElement",v=>function(g,y){const x=_(y);return x?v.call(this,g,x):null}),this.mf=()=>{d.forEach(v=>v()),this.mf=void 0},this.yf()}yf(){let e=!1;return()=>{var t;e||(e=!0,this.cf--,this.cf===0&&((t=this.mf)===null||t===void 0||t.call(this)))}}bf(e,t=!0){const i=this.gf();try{const s=e(i);return t&&i(),s}catch(s){throw i(),s}}setupSiteApp(e){const t=this.apps[e.id],i=()=>{var n;!t.errored&&this.df.length&&(Ve.info(`Processing ${this.df.length} events for site app with id ${e.id}`),this.df.forEach(o=>this.bf(()=>{var a;return(a=t.processEvent)===null||a===void 0?void 0:a.call(t,o)})),t.processedBuffer=!0),Object.values(this.apps).every(o=>o.processedBuffer||o.errored)&&((n=this.ff)===null||n===void 0||n.call(this))};let s=!1;const r=n=>{t.errored=!n,t.loaded=!0,Ve.info(`Site app with id ${e.id} ${n?"loaded":"errored"}`),s&&i()};try{const{processEvent:n}=this.bf(o=>e.init({posthog:this._instance,callback(a){o(),r(a)}}),!1);n&&(t.processEvent=n),s=!0}catch(n){Ve.error(La+e.id,n),r(!1)}if(s&&t.loaded)try{i()}catch(n){Ve.error(`Error while processing buffered events PostHog app with config id ${e.id}`,n),t.errored=!0}}_f(){const e=this.siteAppLoaders||[];for(const t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(const t of e)this.setupSiteApp(t)}wf(e){if(Object.keys(this.apps).length===0)return;const t=this.globalsForEvent(e);for(const i of Object.values(this.apps))try{this.bf(()=>{var s;return(s=i.processEvent)===null||s===void 0?void 0:s.call(i,t)})}catch(s){Ve.error(`Error while processing event ${e.event} for site app ${i.id}`,s)}}onRemoteConfig(e){var t,i,s;if(!((t=this.siteAppLoaders)===null||t===void 0)&&t.length)return this.isEnabled?(this._f(),void this._instance.on("eventCaptured",a=>this.wf(a))):void Ve.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.ff)===null||i===void 0||i.call(this),!e.ok)return;const r=e.config;if(!((s=r.siteApps)===null||s===void 0)&&s.length)if(this.isEnabled)for(const{id:a,url:l}of r.siteApps){var n,o;L[`__$$ph_site_app_${a}`]=this._instance,(n=L.__PosthogExtensions__)===null||n===void 0||(o=n.loadSiteApp)===null||o===void 0||o.call(n,this._instance,l,u=>{if(u)return Ve.error(La+a,u)})}else Ve.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},ov={tracingHeaders:class{constructor(e){this._instance=e,this.kf=void 0,this.Sf=void 0,this.xf=void 0,this.Nv=()=>{const t=this.Cf();var i,s;t?(E(this.kf)&&(this.kf=(i=L.__PosthogExtensions__)===null||i===void 0||(i=i.tracingHeadersPatchFns)===null||i===void 0?void 0:i._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),E(this.Sf)&&(this.Sf=(s=L.__PosthogExtensions__)===null||s===void 0||(s=s.tracingHeadersPatchFns)===null||s===void 0?void 0:s._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Uv()}}initialize(){this.startIfEnabledOrStop()}qo(e){var t,i,s;!((t=L.__PosthogExtensions__)===null||t===void 0)&&t.tracingHeadersPatchFns?e():(i=L.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this._instance,"tracing-headers",r=>{if(r)return Ap.error("failed to load script",r);e()})}$f(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}Cf(){const e=this.$f();return j(e)?(j(this.xf)?this.xf.splice(0,this.xf.length,...e):this.xf=[...e],e.length>0?this.xf:void 0):(j(this.xf)&&this.xf.splice(0),this.xf=e||void 0,this.xf)}Uv(){var e,t;(e=this.kf)===null||e===void 0||e.call(this),(t=this.Sf)===null||t===void 0||t.call(this),this.kf=void 0,this.Sf=void 0}startIfEnabledOrStop(){this.Cf()?this.qo(this.Nv):this.Uv()}}},av=p({surveys:class extends Np{constructor(e){var t;super(new Vp(e),(t=e,{get projectToken(){return t.config.token},kv:new Hp(t)})),this._instance=e}Oh(e,t){const i=t.query?Qi(e,t.query):e;return new Promise(s=>{var r;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor((r=t.target)!==null&&r!==void 0?r:"api",i),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:s})})}}},Qs),lv={toolbar:class{constructor(e){this.instance=e}If(e){L.ph_toolbar_state=e}Tf(){var e;return(e=L.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,i=void 0){var s,r;if(hn(this.instance.config)||!w||!I)return!1;e=(s=e)!==null&&s!==void 0?s:w.location,i=(r=i)!==null&&r!==void 0?r:w.history;try{if(!t){try{w.
4localStorage.setItem("test","test"),w.localStorage.removeItem("test")}catch{return!1}t=w?.localStorage}const n=Up||Ns(e.hash,"__posthog")||Ns(e.hash,"state");let o;const a=n?Fo(()=>JSON.parse(atob(decodeURIComponent(n))))||Fo(()=>JSON.parse(decodeURIComponent(n))):null;return a&&a.action==="ph_authorize"?(o=a,o.source="url",o&&Object.keys(o).length>0&&(a.desiredHash?e.hash=a.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):(o=JSON.parse(t.getItem(Na)||"{}"),o.source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token||(this.loadToolbar(o),0))}catch{return!1}}Mf(e){const t=L.ph_load_toolbar||L.ph_load_editor;!z(t)&&be(t)?t(e,this.instance):ja.warn("No toolbar load function found")}loadToolbar(e){const t=!!I?.getElementById("__POSTHOG_TOOLBAR__");if(!w||t)return!1;const i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=p(p({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(w.localStorage.setItem(Na,JSON.stringify(p(p({},s),{},{source:void 0}))),this.Tf()===2)this.Mf(s);else if(this.Tf()===0){var r,n;this.If(1),(r=L.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this.instance,"toolbar",o=>{if(o)return ja.error("[Toolbar] Failed to load",o),void this.If(0);this.If(2),this.Mf(s)}),se(w,"turbolinks:load",()=>{this.If(0),this.loadToolbar(s)})}return!0}Ef(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,i=void 0){return this.maybeLoadToolbar(e,t,i)}}},uv=p({experiments:class ke{get Ir(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(i=!1)=>{this.getWebExperiments(s=>{ke.Pf("retrieved web experiments from the server"),this.Rf=new Map,s.forEac
4h(r=>{if(r.feature_flag_key){var n;this.Rf&&(ke.Pf("setting flag key ",r.feature_flag_key," to web experiment ",r),(n=this.Rf)===null||n===void 0||n.set(r.feature_flag_key,r));const o=this._instance.getFeatureFlag(r.feature_flag_key);Y(o)&&r.variants[o]&&this.Af(r.name,o,r.variants[o].transforms)}else if(r.variants)for(const o in r.variants){const a=r.variants[o];ke.Ff(a,this._instance)&&this.Af(r.name,o,a.transforms)}})},i)},this._instance.onFeatureFlags(i=>{this.onFeatureFlags(i)})}initialize(){}onFeatureFlags(t){if(this._is_bot())ke.Pf(Ga);else if(!this.Ir.disable_web_experiments){if(z(this.Rf))return this.Rf=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ke.Pf("applying feature flags",t),t.forEach(i=>{var s;if(this.Rf&&(!((s=this.Rf)===null||s===void 0)&&s.has(i))){var r;const n=this._instance.getFeatureFlag(i),o=(r=this.Rf)===null||r===void 0?void 0:r.get(i);n&&o?.variants[n]&&this.Af(o.name,n,o.variants[n].transforms)}})}}previewWebExperiment(){const t=ke.getWindowLocation();if(t?.search){const i=ui(t?.search,"__experiment_id"),s=ui(t?.search,"__experiment_variant");i&&s&&(ke.Pf(`previewing web experiments ${i} && ${s}`),this.getWebExperiments(r=>{this.Of(parseInt(i),s,r)},!1,!0))}}loadIfEnabled(){this.Ir.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,s){if(this.Ir.disable_web_experiments&&!s)return t([]);const r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Ir.token}`),method:"GET",timestampMode:"query",callback:n=>t(n.statusCode===200&&n.json&&n.json.experiments||[])})}Of(t,i,s){const r=s.filter(n=>n.id===t);r&&r.length>0&&(ke.Pf(`Previewing web experiment [${r[0].name}] with variant [${i}]`),this.Af(r[0].name,i,r[0].variants[i].transforms))}static Ff(t,i){return!z(t.conditions)&&ke.Df(t,i)&&ke.Lf(t)}static Df(t,i){var s;if(z(t.conditions)||z((s=t.conditions)===null||s===void 0?void 0:s.url))return!0;const r=ke.getWindowLocation();if(r){var n,o,a;const l=Nu(i,r.href);return!(!((n=t.conditions)===null||n===void 0)&&n.url)||Kp[(o=(a=t.conditions)===null||a===void 0?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](t.conditions.url,l)}return!1}
4static getWindowLocation(){return w?.location}static Lf(t){var i;if(z(t.conditions)||z((i=t.conditions)===null||i===void 0?void 0:i.utm))return!0;const s=Xu();if(s.utm_source){var r,n,o,a,l,u,d,c;const h=!(!((r=t.conditions)===null||r===void 0||(r=r.utm)===null||r===void 0)&&r.utm_campaign)||((n=t.conditions)===null||n===void 0||(n=n.utm)===null||n===void 0?void 0:n.utm_campaign)==s.utm_campaign,f=!(!((o=t.conditions)===null||o===void 0||(o=o.utm)===null||o===void 0)&&o.utm_source)||((a=t.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0?void 0:a.utm_source)==s.utm_source,_=!(!((l=t.conditions)===null||l===void 0||(l=l.utm)===null||l===void 0)&&l.utm_medium)||((u=t.conditions)===null||u===void 0||(u=u.utm)===null||u===void 0?void 0:u.utm_medium)==s.utm_medium,m=!(!((d=t.conditions)===null||d===void 0||(d=d.utm)===null||d===void 0)&&d.utm_term)||((c=t.conditions)===null||c===void 0||(c=c.utm)===null||c===void 0?void 0:c.utm_term)==s.utm_term;return h&&_&&m&&f}return!1}static Pf(t,...i){F.info(`[WebExperiments] ${t}`,i)}Af(t,i,s){this._is_bot()?ke.Pf(Ga):i!=="control"?s.forEach(r=>{if(r.selector){var n;ke.Pf(`applying transform of variant ${i} for experiment ${t} `,r);const o=(n=document)===null||n===void 0?void 0:n.querySelectorAll(r.selector);o?.forEach(a=>{const l=a;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)})}}):ke.Pf("Control variants leave the page unmodified.")}_is_bot(){return we&&this._instance?$c(we,this.Ir.custom_blocked_useragents):void 0}}},Qs),cv={conversations:class{constructor(e){this._instance=e,this.Nf=void 0,this._conversationsManager=null,this.qf=!1,this.ne=null,this.jf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.Bf=e.ok,!e.ok))return;const t=e.config.conversations;z(t)||(Pe(t)?this.Nf=t:(this.Nf=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this.Nf=void 0,this.ne=null,this.Bf=void 0,this.jf=!1}loadIfEnabled(){if(this._conversationsManager||this.qf||this._instance.config.disable_conversations||hn(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=L?.__PosthogExtensions__;if(e&&!E(this.Nf)&&this.Nf)if(this.ne&&this.ne.token){this.qf=!0;try{const t=e.initConversations;if(t)return this.Hf(t),void(this.qf=!1);const i=e.loadExternalDependency;if(!i)return void this.zf(Bn);i(this._instance,"conversations",s=>{s||!e.initConversations?this.zf("Could not load conversations script",s):this.Hf(e.initConversations),this.qf=!1})}catch(t){this.zf("Error initializing conversations",t),this.qf=!1}}else Ae.error("Conversations enabled but missing token in remote config.")}Hf(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.jf=!1,Ae.info("Conversations loaded successfully")}catch(t){this.zf("Error completing conversations initialization",t)}else Ae.error("Cannot complete initialization: remote config is null")}zf(e,t){Ae.error(e,t),this._conversationsManager=null,this.qf=!1,this.jf=!0}show(){this._conversationsManager?this._conversationsManager.show():Ae.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Nf===!0&&!ve(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":hn(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Bf===!1?"remote_config_failed":E(this.Nf)?this.Bf?"disabled_in_project":"remote_config_pending":this.Nf?z(this.ne)||!this.ne.token?"missing_token":L?.__PosthogExtensions__?this.qf?"initializing":this.jf?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,i){var s=this;return ue(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(Ae.warn(xt),null)})()}getMessages(e,t){var i=this;return ue(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(Ae.warn(xt),null)})()}markAsRead(e){var t=this;return ue(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(Ae.warn(xt),null)})()}getTickets(e){var t=this;return ue(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(Ae.warn(xt),null)})()}requestRestoreLink(e){var t=this;return ue(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(Ae.warn(xt),null)})()}restoreFromToken(e){var t=this;return ue(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(Ae.warn(xt),null)})()}restoreFromUrlToken(){var e=this;return ue(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(Ae.warn(xt),null)})()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}bh(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}_h(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},dv={logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.Uf=!1,this.Wf=!1,this.Vf=!1,this.$=pe("[logs]"),this.Gf=p(p({},this.$),{},{error:(...i)=>{i.some(Xa)||this.$.error(...i)}}),this.na=[],this.Zf=[],this.od=0,this.xo=!1,this.Qf=[],this.Jf=[],this.Kf=!1,this.Xf=!1,this.Yf=()=>{var i,s;this.xo||(this.od=0,(i=this.tp)===null||i===void 0||i.onReconnect(),(s=this.ep)===null||s===void 0||s.onReconnect())},this._instance&&(!((t=this._instance.config.logs)===null||t===void 0)&&t.captureConsoleLogs)&&(this.Uf=!0),w&&se(w,"online",this.Yf)}np(e,t,i,s){var r;const n=Ja((r=this._instance)===null||r===void 0||(r=r.config)===null||r===void 0?void 0:r.logs,i);return[new zh(this.sp(e,t),n,this.Gf,()=>this.rp(),o=>o(),void 0,s),n]}op(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var i;return this.tp&&this.lp===t||((i=this.tp)===null||i===void 0||i.reset(),this.lp=t,[this.tp,this.ap]=this.np(()=>this.na,s=>{this.na=s})),this.tp}up(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var i;return this.ep&&this.hp===t||((i=this.ep)===null||i===void 0||i.reset(),this.hp=t,[this.ep,this.cp]=this.np(()=>this.Zf,s=>{this.Zf=s},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Ka)),this.ep}setup(e){var t;if(this.xo)return;this.mo=e,!((t=this._instance)===null||t===void 0||(t=t.config)===null||t===void 0||(t=t.logs)===null||t===void 0)&&t.captureConsoleLogs&&(this.Uf=!0),(this.Uf||this.dp()&&this.vp())&&this.fp();let i=!1;const s=e.onRemoteConfig(r=>{var n;i=r.ok&&((n=r.config.logs)===null||n===void 0?void 0:n.captureConsoleLogs)===!0,this.onRemoteConfig(r)});this.xo?s.dispose():(this.Io=s,i||this.loadIfEnabled())}dispose(){var e,t,i,s;this.xo||(this.xo=!0,this.pp(),(e=this.Io)===null||e===void 0||e.dispose(),this.Io=void 0,this.mo=void 0,this.Vf=!1,w?.removeEventListener("online",this.Yf),(t=this.gp)===null||t===void 0||t.call(this),this.gp=void 0,(i=this.tp)===null||i===void 0||i.reset(),(s=this.ep)===null||s===void 0||s.reset())}onRemoteConfig(e){var t,i;if(this.xo)return;const s=e.ok?(t=e.config.logs)===null||t===void 0?void 0:t.captureConsoleLogs:void 0;z(s)?this.mp():((i=this._instance)===null||i===void 0||(i=i.persistence)===null||i===void 0||i.register({$logs_capture_enabled_server_side:!!s}),s?(this.Uf=!0,this.Wf||this.fp(),this.loadIfEnabled()):this.mp())}reset(){var e,t,i,s;this.pp(),(e=this.tp)===null||e===void 0||e.clearQueue(),this.na=[],(t=this.tp)===null||t===void 0||t.reset(),(i=this.ep)===null||i===void 0||i.clearQueue(),this.Zf=[],(s=this.ep)===null||s===void 0||s.reset(),this.od=0}captureLog(e){this.xo||this.op().captureLog(e)}captureConsoleLog(e){this.xo||this.up().captureLog(e)}captureBufferedConsoleLog(e,t,i){this.xo||this.up().captureLog(e,{context:t,occurredAtMs:i})}vp(){var e;return!!(!((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e[bu])}dp(){var e,t,i;return!(!((e=this._instance)===null||e===void 0||(t=e.Yl)===null||t===void 0)&&t.call(e))||!!(!((i=L._POSTHOG_REMOTE_CONFIG)===null||i===void 0||(i=i[this._instance.config.token])===null||i===void 0)&&i.c
4onfig)}kh(){var e;this.pp(),(e=this.ep)===null||e===void 0||e.clearQueue(),this.Zf=[]}mp(){this.Uf||this.pp()}fp(){var e;if(this.Kf||!L?.console)return;const t=Ja((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs).maxBufferSize;let i=!0;this.Jf.push(()=>{i=!1});for(const s of Xp){let r;try{r=Yp(L.console[s])}catch{continue}r&&this.Jf.push(Xi(L.console,s,n=>{const o=(...a)=>{try{i&&this.yp(s,a,t)}catch{}return n.apply(L.console,a)};return o.__rrweb_original__=r,o}))}this.Kf=!0,this.bp=setTimeout(()=>{this.pp()},3e4)}yp(e,t,i){var s;if(this.Kf&&!this.Xf&&t.length!==0)if(!((s=this._instance)===null||s===void 0)&&s.is_capturing()){if(i>this.Qf.length){this.Xf=!0;try{this.Qf.push({level:e,args:t,occurredAtMs:Date.now(),context:this.rp()})}finally{this.Xf=!1}}}else this.pp()}pp(){if(this.Qf=[],this.Kf){this.Kf=!1,this.bp&&(clearTimeout(this.bp),this.bp=void 0);for(const e of this.Jf)e();this.Jf=[]}}_p(){const e=this.Qf;return this.pp(),e}get logger(){return this.wp||(this.wp={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.wp}flushLogs(e){e?this.kp(e):(this.tp&&this.tp.flush().catch(t=>this.Sp(t)),this.ep&&this.ep.flush().catch(t=>this.Sp(t)))}Sp(e){Xa(e)||this.$.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.xo||!this.Uf||this.Wf||this.Vf)return;const e=L?.__PosthogExtensions__;if(!e)return this.$.error("PostHog Extensions not found."),void this.pp();const t=e.loadExternalDependency;if(!t)return this.$.error(Bn),void this.pp();this.Vf=!0;try{t(this._instance,"logs",i=>{if(this.Vf=!1,this.xo||!this.Uf)return;const s=e.logs;if(i||!s?.initializeLogs)this.$.error("Could not load logs script",i),this.pp();else{var r;const a=this._p();var n,o;this.gp=s.initializeLogs((r=this.mo)!==null&&r!==void 0?r:this._instance),this.Wf=!0,a.length>0&&((n=s.replayConsoleBuffer)===null||n===void 0||n.call(s,(o=this.mo)!==null&&o!==void 0?o:this._instance,a))}})}catch(i){throw this.Vf=!1,i}}sp(e,t){const i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:s=>s===ze.LogsQueue?e():void 0,setPersistedProperty(s,r){var n;s===ze.LogsQueue&&t((n=r)!==null&&n!==void 0?n:[])},js:s=>this.js(s),getLibraryId:()=>ye.LIB_NAME,getLibraryVersion:()=>ye.LIB_VERSION}}js(e){return new Promise(t=>{if(Ju(this.od,3))return void t({kind:"fatal",error:Hr(void 0,"logs endpoint is unreachable, dropping batch")});let i=!1;const s=n=>{i||(i=!0,clearTimeout(r),t(n))},r=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),s({kind:"retry-later",error:Hr(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.xp(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:n=>{const o=n.statusCode;if(this.Cp(o),o>=200&&300>o)s({kind:"ok"});else if(o===413)s({kind:"too-large"});else if(o!==0&&o!==408&&o!==429&&500>o)s({kind:"fatal",error:new Error(`logs request failed with status ${o}`)});else{var a;o===0?(n.error||this.$.warn("Logs request failed before receiving an HTTP response"),s({kind:"retry-later",error:Hr(n.error,"logs request failed before receiving an HTTP response")})):s({kind:"retry-later",error:(a=n.error)!==null&&a!==void 0?a:new Error(`logs request failed with status ${o}`)})}}})})}Cp(e){(e!==0||this._instance.__loaded)&&(this.od=Ku(e,this.od,3,()=>this.$.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}kp(e){this.na.length>0&&this.$p(e,this.na,this.ap,ye.LIB_NAME,t=>{this.na=t}),this.Zf.length>0&&this.$p(e,this.Zf,this.cp,Ka,t=>{this.Zf=t})}$p(e,t,i,s,r){if(t.length===0)return;const n=t.map(a=>a.record);r([]);const o=fu(n,hu(i,ye.LIB_NAME,ye.LIB_VERSION),s,ye.LIB_VERSION);this._instance._send_request({method:"POST",url:this.xp(),data:o,compression:"best-available",batchKey:"logs",transport:e})}xp(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}rp(){var e;const t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:i,windowId:s,sessionStartTimestamp:r,lastActivityTimestamp:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=i,t.windowId=s,z(r)||(t.sessionStartTimestamp=r),z(n)||(t.lastActivityTimestamp=n)}if(!(L==null||(e=L.location)===null||e===void 0)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?mt(L.location.href):L.location.href),this._instance.featureFlags){const i=this._instance.featureFlags.getFlags();i&&i.length>0&&(t.activeFeatureFlags=i)}return t}}},hv={metrics:class{constructor(e){this._instance=e,this.$=pe("[metrics]"),this.xo=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this.xo)return;const t=!!(!((e=this._instance.config.metrics)===null||e===void 0)&&e.network);t&&!this.Ip?this.Ip=(i=>{let s=!0;const r=()=>s?(a=>{var l;const u=(l=a.config.metrics)===null||l===void 0?void 0:l.network;return u===!0?{}:u||void 0})(i):void 0,n=Qp(i,r),o=ev(i,r);return()=>{s=!1,n(),o()}})(this._instance):!t&&this.Ip&&(this.Ip(),this.Ip=void 0)}op(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.metrics;var i;return this.tp&&this.lp===t||((i=this.tp)===null||i===void 0||i.reset(),this.lp=t,this.tp=new Wh(this.sp(),(function(s){var r,n,o,a,l;const u=s?.resourceAttributes;return{serviceName:(r=u?.["service.name"])!==null&&r!==void 0?r:s?.serviceName,serviceVersion:(n=u?.["service.version"])!==null&&n!==void 0?n:s?.serviceVersion,environment:(o=u?.["deployment.environment"])!==null&&o!==void 0?o:s?.environment,resourceAttributes:u,beforeSend:s?.beforeSend,flushIntervalMs:(a=s?.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(l=s?.maxSeriesPerFlush)!==null&&l!==void 0?l:1e3}})(t),this.$)),this.tp}count(e,t=1,i){this.op().count(e,t,i)}
4gauge(e,t,i){this.op().gauge(e,t,i)}histogram(e,t,i){this.op().histogram(e,t,i)}flush(e){if(!this.tp)return Promise.resolve();if(e){const t=this.tp.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.tp.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this.tp)===null||e===void 0||e.reset()}dispose(){var e,t;this.xo=!0,(e=this.Ip)===null||e===void 0||e.call(this),this.Ip=void 0,(t=this.tp)===null||t===void 0||t.reset()}sp(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ys:i=>t.Ys(i),getLibraryId:()=>ye.LIB_NAME,getLibraryVersion:()=>ye.LIB_VERSION}}Ys(e,t){return new Promise(i=>{let s=!1;const r=o=>{s||(s=!0,clearTimeout(n),i(o))},n=setTimeout(()=>r({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(p(p({method:"POST",url:this.Tp(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(o){const a=o.statusCode;if(a>=200&&300>a)r({kind:"ok"});else if(a===413)r({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)r({kind:"fatal",error:new Error(`metrics request failed with status ${a}`)});else{var l;r({kind:"retry-later",error:(l=o.error)!==null&&l!==void 0?l:new Error(`metrics request failed with status ${a}`)})}}}))})}Tp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};qi.__defaultExtensionClasses=p({},p(p(p(p(p(p(p(p(p(p(p(p(p({},Qs),tv),iv),sv),rv),nv),av),ov),lv),uv),cv),dv),hv));const fv=(function(){ye.SDK_DIST_CHANNEL="npm";const e=Ni[Pi]=new qi;return(function(){function t(){t.done||(t.done=!0,bc=!1,ne(Ni,function(i){i._dom_loaded()}))}I?.addEventListener?I.readyState==="complete"?t():se(I,"DOMContentLoaded",t,{capture:!1}):w&&F.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})();var vv=fv;export{pv as a,rt as b,Md as c,vv as d,Rt as e,Tt as f,gl as g,hi as i,Ad as m,Pt as n,pl as r,Ct as t,vl as u}; 5//# sourceMappingURL=https://staging.thenile.com.au/build/assets/module-Chzvur6p.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.