PageSourceSearch

https://styka.ai/assets/module-CxTotNkB.js

js styka.ai collected 2026-10-05 13:25:45 UTC 195,488 bytes, 2 lines download raw bytes

1var v=typeof window<"u"?window:void 0,Z=typeof globalThis<"u"?globalThis:v;typeof self>"u"&&(Z.self=Z),typeof File>"u"&&(Z.File=function(){});var ge=Z?.navigator,w=Z?.document,ie=Z?.location,os=Z?.fetch,ls=Z!=null&&Z.XMLHttpRequest&&"withCredentials"in new Z.XMLHttpRequest?Z.XMLHttpRequest:void 0,vr=Z?.AbortController,Na=Z?.CompressionStream,ce=ge?.userAgent,$=v??{},gr="1.383.1",Q={DEBUG:!1,LIB_VERSION:gr,LIB_NAME:"web",JS_SDK_VERSION:gr};function fr(i,e,t,s,r,n,a){try{var o=i[n](a),l=o.value}catch(c){return void t(c)}o.done?e(l):Promise.resolve(l).then(s,r)}function ve(i){return function(){var e=this,t=arguments;return new Promise((function(s,r){var n=i.apply(e,t);function a(l){fr(n,s,r,a,o,"next",l)}function o(l){fr(n,s,r,a,o,"throw",l)}a(void 0)}))}}function _(){return _=Object.assign?Object.assign.bind():function(i){for(var e=1;arguments.length>e;e++){var t=arguments[e];for(var s in t)({}).hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},_.apply(null,arguments)}function fn(i,e){if(i==null)return{};var t={};for(var s in i)if({}.hasOwnProperty.call(i,s)){if(e.indexOf(s)!==-1)continue;t[s]=i[s]}return t}var bt,_r=(function(i){return i.GZipJS="gzip-js",i.Base64="base64",i})({}),ja=["$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"],_n="NativeGzipValidationError",us=i=>i.length>=2&&i[0]===31&&i[1]===139,mr=i=>!(!i||typeof i!="object")&&("name"in i?String(i.name):"")==="NotReadableError",Kt=i=>{var e=new Error("Native gzip produced invalid output: "+i);throw e.name=_n,e},Ha=(function(){var i=ve((function*(e,t){18>e.size&&Kt("too-short");var s=new Uint8Array(yield e.slice(0,10).arrayBuffer());us(s)&&s[2]===8||Kt("invalid-header");var r=new DataView(yield e.slice(e.size-8).arrayBuffer());r.getUint32(0,!0)!==(a=>{for(var o=(()=>{if(bt)return bt;bt=[];for(var u=0;256>u;u++){for(var h=u,d=0;8>d;d++)h=1&h?3988292384^h>>>1:h>>>1;bt[u]=h>>>0}return bt})(),l=4294967295,c=0;a.length>c;c++)l=o[255&(l^a[c])]^l>>>8;return(4294967295^l)>>>0})(t)&&Kt("invalid-crc");var n=t.length>>>0;r.getUint32(4,!0)!==n&&Kt("invalid-size")}));return function(e,t){return i.apply(this,arguments)}})();function cs(){return cs=ve((function*(i,e,t){e===void 0&&(e=!0);try{var s=new TextEncoder().encode(i),r=new CompressionStream("gzip"),n=r.writable.getWriter(),a=n.write(s).then((()=>n.close())).catch((function(){var c=ve((function*(u){try{yield n.abort(u)}catch{}throw u}));return function(u){return c.apply(this,arguments)}})()),o=new Response(r.readable).blob(),[l]=yield Promise.all([o,a]);return yield Ha(l,s),l}catch(c){if(t!=null&&t.rethrow)throw c;return e&&console.error("Failed to gzip compress data",c),null}})),cs.apply(this,arguments)}var Ua=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],yr=function(i,e){if(e===void 0&&(e=[]),!i)return!1;var t=i.toLowerCase();return Ua.concat(e).some((s=>{var r=s.toLowerCase();return t.indexOf(r)!==-1}))};function O(i,e){return i.indexOf(e)!==-1}var Ci=function(i){return i.trim()},hs=function(i){return i.replace(/^\$/,"")},mn=Object.prototype,yn=mn.hasOwnProperty,Oi=mn.toString,q=Array.isArray||function(i){return Oi.call(i)==="[object Array]"},Le=i=>typeof i=="function",X=i=>i===Object(i)&&!q(i),Be=i=>{if(X(i)){for(var e in i)if(yn.call(i,e))return!1;return!0}return!1},y=i=>i===void 0,V=i=>Oi.call(i)=="[object String]",ds=i=>
1V(i)&&i.trim().length===0,_e=i=>i===null,D=i=>y(i)||_e(i),oe=i=>Oi.call(i)=="[object Number]"&&i==i,Re=i=>oe(i)&&i>0,Te=i=>Oi.call(i)==="[object Boolean]",Ba=i=>i instanceof FormData,za=i=>O(ja,i);function bn(i){return i===null||typeof i!="object"}function di(i,e){return{}.toString.call(i)==="[object "+e+"]"}function Ys(i){return typeof Event<"u"&&(function(e,t){try{return e instanceof t}catch{return!1}})(i,Event)}var Ga=[!0,"true",1,"1","yes"],Di=i=>O(Ga,i),Va=[!1,"false",0,"0","no"];function $e(i,e,t,s,r){return e>t&&(s.warn("min cannot be greater than max."),e=t),oe(i)?i>t?(s.warn(" cannot be  greater than max: "+t+". Using max value instead."),t):e>i?(s.warn(" cannot be less than min: "+e+". Using min value instead."),e):i:(s.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+r),$e(r||t,e,t,s))}class Wa{constructor(e){this.$t={},this.zt=e.zt,this.Zt=$e(e.bucketSize,0,100,e.Gt),this.Qt=$e(e.refillRate,0,this.Zt,e.Gt),this.Jt=$e(e.refillInterval,0,864e5,e.Gt)}Kt(e,t){var s=Math.floor((t-e.lastAccess)/this.Jt);s>0&&(e.tokens=Math.min(e.tokens+s*this.Qt,this.Zt),e.lastAccess=e.lastAccess+s*this.Jt)}consumeRateLimit(e){var t,s=Date.now(),r=String(e),n=this.$t[r];return n?this.Kt(n,s):this.$t[r]=n={tokens:this.Zt,lastAccess:s},n.tokens===0||(n.tokens--,n.tokens===0&&((t=this.zt)==null||t.call(this,e)),n.tokens===0)}stop(){this.$t={}}}var Zt,br,Ni,me="Mobile",pi="iOS",De="Android",gt="Tablet",wn=De+" "+gt,xn="iPad",En="Apple",kn=En+" Watch",Lt="Safari",ft="BlackBerry",Sn="Samsung",Pn=Sn+"Browser",Fn=Sn+" Internet",Qe="Chrome",Ya=Qe+" OS",$n=Qe+" "+pi,Xs="Internet Explorer",Tn=Xs+" "+me,Js="Opera",Xa=Js+" Mini",Ks="Edge",In="Microsoft "+Ks,pt="Firefox",Mn=pt+" "+pi,Ut="Nintendo",Bt="PlayStation",vt="Xbox",Cn=De+" "+me,On=me+" "+Lt,It="Windows",ps=It+" Phone",wr="Nokia",vs="Ouya",Rn="Generic",Ja=Rn+" "+me.toLowerCase(),An=Rn+" "+gt.toLowerCase(),gs="Konqueror",Ln="Oculus Browser",vi="Vivaldi",qn="Yandex",gi="Whale",fs="DuckDuckGo",Dn="Pale Moon",fi="Waterfox",qt="Brave",Y="(\\d+(\\.\\d+)?)",ji=new RegExp("Version/"+Y),Ka=new RegExp(vt,"i"),Za=new RegExp(Bt+" \\w+","i"),Qa=new RegExp(Ut+" \\w+","i"),Zs=new RegExp(ft+"|PlayBook|BB10","i"),eo={"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"},Nn=function(i,e,t){e=e||"";var s=(function(r){return r!=null&&r.brave?qt:null})(t);return s||(O(i," OPR/")&&O(i,"Mini")?Xa:O(i," OPR/")?Js:Zs.test(i)?ft:O(i,"IE"+me)||O(i,"WPDesktop")?Tn:O(i,"OculusBrowser")?Ln:O(i,Pn)?Fn:O(i,Ks)||O(i,"Edg/")?In:O(i,vi+"/")?vi:O(i,"YaBrowser/")?qn:O(i,gi+"/")?gi:O(i,fs+"/")||O(i,"Ddg/")?fs:O(i,"FBIOS")?"Facebook "+me:O(i,"UCWEB")||O(i,"UCBrowser")?"UC Browser":O(i,"CriOS")?$n:O(i,"CrMo")||O(i,Qe)?Qe:O(i,De)&&O(i,Lt)?Cn:O(i,"FxiOS")?Mn:O(i.toLowerCase(),gs.toLowerCase())?gs:O(i,qt+"/")?qt:((r,n)=>n&&O(n,En)||(function(a){return O(a,Lt)&&!O(a,Qe)&&!O(a,De)})(r))(i,e)?O(i,me)?On:Lt:O(i,"PaleMoon/")?Dn:O(i,fi+"/")?fi:O(i,pt)?pt:O(i,"MSIE")||O(i,"Trident/")?Xs:O(i,"Gecko")?pt:"")},to={[Tn]:[new RegExp("rv:"+Y)],[In]:[new RegExp(Ks+"?\\/"+Y)],[Qe]:[new RegExp("("+Qe+"|CrMo)\\/"+Y)],[$n]:[new RegExp("CriOS\\/"+Y)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Y)],[Lt]:[ji],[On]:[ji],[Js]:[new RegExp("(Opera|OPR)\\/"+Y)],[pt]:[new RegExp(pt+"\\/"+Y)],[Mn]:[new RegExp("FxiOS\\/"+Y)],[gs]:[new RegExp("Konqueror[:/]?"+Y,"i")],[ft]:[new RegExp(ft+" "+Y),ji],[Cn]:[new RegExp("android\\s"+Y,"i")],[Fn]:[new RegExp(Pn+"\\/"+Y)],[Ln]:[new RegExp("OculusBrowser\\/"+Y)],[vi]:[new RegExp(vi+"\\/"+Y)],[qn]:[new RegExp("YaBrowser\\/"+Y)],[gi]:[new RegExp(gi+"\\/"+Y)],[qt]:[new RegExp(qt+"\\/"+Y)],[fs]:[new RegExp("(DuckDuckGo|Ddg)\\/"+Y)],[Dn]:[new RegExp("PaleMoon\\/"+Y)],[fi]:[new RegExp(fi+"\\/"+Y)],[Xs]:[new RegExp("(rv:|MSIE )"+Y)],Mozilla:[new RegExp("rv:"+Y)]},io=function(i,e,t){var s=Nn(i,e,t),r=to[s];if(y(r))return null;for(var n=0;r.length>n;n++){var a=i.match(r[n]);if(a)return parseFloat(a[a.length-2])}return null},xr=[[new RegExp(vt+"; "+vt+" (.*?)[);]","i"),i=>[vt,i&&i[1]||""]],[new RegExp(Ut,"i"),[Ut,""]],[new RegExp(Bt,"i"),[Bt,""]],[Zs,[ft,""]],[new RegExp(It,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[ps,""];if(new RegExp(me).test(e)&&!/IEMobile\b/.test(e))return[It+" "+me,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var s=eo[t[1]]||"";return/arm/i.test(e)&&(s="RT"),[It,s]}return[It,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>i&&i[3]?[pi,[i[3],i[4],i[5]||"0"].join(".")]:[pi,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=y(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+De+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+De+")","i"),i=>i&&i[2]?[De,[i[2],i[3],i[4]||"0"].join(".")]:[De,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,i=>{var e=["Mac OS X",""];return i&&i[1]&&(e[1]=[i[1],i[2],i[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Ya,""]],[/Linux|debian/i,["Linux",""]]],Er=function(i){return Qa.test(i)?Ut:Za.test(i)?Bt:Ka.test(i)?vt:new RegExp(vs,"i").test(i)?vs:new RegExp("("+ps+"|WPDesktop)","i").test(i)?ps:/iPad/.test(i)?xn:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?kn:Zs.test(i)?ft:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(wr,"i").test(i)?wr:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?new RegExp(me).test(i)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)||/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?De:wn:new RegExp("(pda|"+me+")","i").test(i)?Ja:new RegExp(gt,"i").test(i)&&!new RegExp(gt+" pc","i").test(i)?An:""},so=i=>i instanceof Error,jn={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}},ro=jn.info;function Hn(i){if(Te(i))return{boolValue:i};if(typeof i=="number")return Number.isFinite(i)?Number.isInteger(i)?{intValue:i}:{doubleValue:i}:{stringValue:String(i)};if(typeof i=="string")return{stringValue:i};if(q(i))return{arrayValue:{values:i.map((e=>Hn(e)))}};try{return{stringValue:JSON.stringify(i)}}catch{return{stringValue:String(i)}}}function kr(i){var e=[];
1for(var t in i){var s=i[t];_e(s)||y(s)||e.push({key:t,value:Hn(s)})}return e}function no(i){var e=globalThis._posthogChunkIds;if(e){var t=Object.keys(e);return Ni&&t.length===br||(br=t.length,Ni=t.reduce(((s,r)=>{Zt||(Zt={});var n=Zt[r];if(n)s[n[0]]=n[1];else for(var a=i(r),o=a.length-1;o>=0;o--){var l=a[o],c=l?.filename,u=e[r];if(c&&u){s[c]=u,Zt[r]=[c,u];break}}return s}),{})),Ni}}class ao{constructor(e,t,s){s===void 0&&(s=[]),this.coercers=e,this.stackParser=t,this.modifiers=s}buildFromUnknown(e,t){t===void 0&&(t={});var s=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(s,t,0).apply(e),n=this.buildParsingContext(t),a=this.parseStacktrace(r,n);return{$exception_list:this.convertToExceptionList(a,s),$exception_level:"error"}}modifyFrames(e){var t=this;return ve((function*(){for(var s of e)s.stacktrace&&s.stacktrace.frames&&q(s.stacktrace.frames)&&(s.stacktrace.frames=yield t.applyModifiers(s.stacktrace.frames));return e}))()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)==null?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var s,r;return e.cause!=null&&(s=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),_({},e,{cause:s,stack:r})}applyChunkIds(e,t){return e.map((s=>(s.filename&&t&&(s.chunk_id=t[s.filename]),s)))}applyCoercers(e,t){for(var s of this.coercers)if(s.match(e))return s.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return ve((function*(){var s=e;for(var r of t.modifiers)s=yield r(s);return s}))()}convertToExceptionList(e,t){var s,r,n,a={type:e.type,value:e.value,mechanism:{type:(s=t.type)!==null&&s!==void 0?s:"generic",handled:(r=t.handled)===null||r===void 0||r,synthetic:(n=e.synthetic)!==null&&n!==void 0&&n}};e.stack&&(a.stacktrace={type:"raw",frames:e.stack});var o=[a];return e.cause!=null&&o.push(...this.convertToExceptionList(e.cause,_({},t,{handled:!0}))),o}buildParsingContext(e){var t;return{chunkIdMap:no(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}buildCoercingContext(e,t,s){s===void 0&&(s=0);var r=(n,a)=>{if(4>=a){var o=this.buildCoercingContext(e,t,a);return this.applyCoercers(n,o)}};return _({},t,{syntheticException:s==0?t.syntheticException:void 0,mechanism:e,apply:n=>r(n,s),next:n=>r(n,s+1)})}}var _t="?";function _s(i,e,t,s,r){var n={platform:i,filename:e,function:t==="<anonymous>"?_t:t,in_app:!0};return y(s)||(n.lineno=s),y(r)||(n.colno=r),n}var Un=(i,e)=>{var t=i.indexOf("safari-extension")!==-1,s=i.indexOf("safari-web-extension")!==-1;return t||s?[i.indexOf("@")!==-1?i.split("@")[0]:_t,t?"safari-extension:"+e:"safari-web-extension:"+e]:[i,e]},oo=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,lo=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,uo=/\((\S*)(?::(\d+))(?::(\d+))\)/,co=(i,e)=>{var t=oo.exec(i);if(t){var[,s,r,n]=t;return _s(e,s,_t,+r,+n)}var a=lo.exec(i);if(a){if(a[2]&&a[2].indexOf("eval")===0){var o=uo.exec(a[2]);o&&(a[2]=o[1],a[3]=o[2],a[4]=o[3])}var[l,c]=Un(a[1]||_t,a[2]);return _s(e,c,l,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},ho=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,po=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,vo=(i,e)=>{var t=ho.exec(i);if(t){if(t[3]&&t[3].indexOf(" > eval")>
1-1){var s=po.exec(t[3]);s&&(t[1]=t[1]||"eval",t[3]=s[1],t[4]=s[2],t[5]="")}var r=t[3],n=t[1]||_t;return[n,r]=Un(n,r),_s(e,r,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},Sr=/\(error: (.*)\)/;class go{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var s=V(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:s?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){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return di(e,"DOMException")}isDOMError(e){return di(e,"DOMError")}}class fo{match(e){return(t=>t instanceof Error)(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var s=e.message;return String(s.error&&typeof s.error.message=="string"?s.error.message:s)}getStack(e){return e.stacktrace||e.stack||void 0}}class _o{constructor(){}match(e){return di(e,"ErrorEvent")&&e.error!=null}coerce(e,t){var s;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}}var mo=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class yo{match(e){return typeof e=="string"}coerce(e,t){var s,[r,n]=this.getInfos(e);return{type:r??"Error",value:n??e,stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}getInfos(e){var t="Error",s=e,r=e.match(mo);return r&&(t=r[1],s=r[2]),[t,s]}}var bo=["fatal","error","warning","log","info","debug"];function Bn(i,e){e===void 0&&(e=40);var t=Object.keys(i);if(t.sort(),!t.length)return"[object has no keys]";for(var s=t.length;s>0;s--){var r=t.slice(0,s).join(", ");if(e>=r.length)return s===t.length?r:r.length>e?r.slice(0,e)+"...":r}return""}class wo{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var s,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:(s=t.syntheticException)==null?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Ys(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var t="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&typeof e.message=="string")return e.message;var s=this.getObjectClassName(e);return(s&&s!=="Object"?"'"+s+"'":"Object")+" captured as exception with keys: "+Bn(e)}isSeverityLevel(e){return V(e)&&!ds(e)&&bo.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if({}.hasOwnProperty.call(e,t)){var s=e[t];if(so(s))return s}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}}class xo{match(e){return Ys(e)}coerce(e,t){var s,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Bn(e),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class Eo{match(e){return bn(e)}coerce(e,t){var s;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}}}class ko{match(e){return di(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Ys(e))return!1;try{var t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var s,r=this.getUnhandledRejectionReason(e);return bn(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:(s=t.syntheticException)==null?void 0:s.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var _i="$message",mi="$timestamp",So=new Set([_i,mi]),Hi={enabled:!0,max_bytes:32768};function yi(i){var e;return i?{enabled:(e=i.enabled)!==null&&e!==void 0?e:Hi.enabled,max_bytes:Fo(i.max_bytes,Hi.max_bytes)}:_({},Hi)}class Po{constructor(e){this.Yt=[],this.Xt=0,this.qt=yi(e)}setConfig(e){this.qt=yi(e),this.er()}add(e){var t=(function(r){var n=(function(u){var h=new WeakSet;try{return JSON.stringify(u,((d,p)=>{if(typeof p=="bigint")return p.toString();if(typeof p!="function"&&typeof p!="symbol"){if(p instanceof Date)return p.toISOString();if(p instanceof Error)return{name:p.name,message:p.message,stack:p.stack};
1if(p&&typeof p=="object"){if(h.has(p))return"[Circular]";h.add(p)}return p}}))}catch{return}})(r);if(n)try{var a=JSON.parse(n);if(!X(a))return;var o=a,l=o[_i],c=o[mi];return!V(l)||l.trim().length===0||!V(c)&&!oe(c)?void 0:{step:o,json:n}}catch{return}})(e);if(t){var s=(function(r){if(typeof TextEncoder<"u")return new TextEncoder().encode(r).length;for(var n=encodeURIComponent(r),a=0,o=0;n.length>o;o++)n[o]==="%"?(a+=1,o+=2):a+=1;return a})(t.json);s>this.qt.max_bytes||(this.Yt.push({step:t.step,bytes:s}),this.Xt+=s,this.er())}}getAttachable(){return this.Yt.map((e=>e.step))}clear(){this.Yt=[],this.Xt=0}size(){return this.Yt.length}er(){for(;this.Xt>this.qt.max_bytes&&this.Yt.length>0;){var e=this.Yt.shift();e&&(this.Xt-=e.bytes)}}}function Fo(i,e){if(!oe(i)||i===1/0||i===-1/0)return e;var t=Math.floor(i);return 0>t?e:t}var zn=function(i,e){var{debugEnabled:t}=e===void 0?{}:e,s={k(r){if(v&&(Q.DEBUG||$.POSTHOG_DEBUG||t)&&!y(v.console)&&v.console){for(var n=("__rrweb_original__"in v.console[r])?v.console[r].__rrweb_original__:v.console[r],a=arguments.length,o=new Array(a>1?a-1:0),l=1;a>l;l++)o[l-1]=arguments[l];n(i,...o)}},debug(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("debug",...n)},info(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("log",...n)},warn(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("warn",...n)},error(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];s.k("error",...n)},critical(){for(var r=arguments.length,n=new Array(r),a=0;r>a;a++)n[a]=arguments[a];console.error(i,...n)},uninitializedWarning(r){s.error("You must initialize PostHog before calling "+r)},createLogger:(r,n)=>zn(i+" "+r,n)};return s},b=zn("[PostHog.js]"),W=b.createLogger,$o=W("[ExternalScriptsLoader]"),Ui=(i,e,t)=>{if(i.config.disable_external_dependency_loading)return $o.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var s=w?.querySelectorAll("script");if(s){for(var r,n=function(){if(s[a].src===e){var l=s[a];return l.__posthog_loading_callback_fired?{v:t()}:(l.addEventListener("load",(c=>{l.__posthog_loading_callback_fired=!0,t(void 0,c)})),l.onerror=c=>t(c),{v:void 0})}},a=0;s.length>a;a++)if(r=n())return r.v}var o=()=>{if(!w)return t("document not found");var l=w.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=h=>{l.__posthog_loading_callback_fired=!0,t(void 0,h)},l.onerror=h=>t(h),i.config.prepare_external_dependency_script&&(l=i.config.prepare_external_dependency_script(l)),!l)return t("prepare_external_dependency_script returned null");if(i.config.external_scripts_inject_target==="head")w.head.appendChild(l);else{var c,u=w.querySelectorAll("body > script");u.length>0?(c=u[0].parentNode)==null||c.insertBefore(l,u[0]):w.body.appendChild(l)}};w!=null&&w.body?o():w?.addEventListener("DOMContentLoaded",o)};$.__PosthogExtensions__=$.__PosthogExtensions__||{},$.__PosthogExtensions__.loadExternalDependency=(i,e,t)=>{if(e!=="remote-config"){var s;if(i.config.__preview_external_dependency_versioned_paths)s=i.requestRouter.endpointFor("assets","/static/"+i.version+"/"+e+".js");else{var r="/static/"+e+".js?v="+i.version;if(e==="toolbar"){var n=3e5;r=r+"&t="+Math.floor(Date.now()/n)*n}s=i.requestRouter.endpointFor("assets",r)}Ui(i,s,t)}else{var a=i.requestRouter.endpointFor("assets","/array/"+i.config.token+"/config.js");Ui(i,a,t)}},$.__PosthogExtensions__.loadSiteApp=(i,e,t)=>{var s=i.requestRouter.endpointFor("api",e);Ui(i,s,t)};var Gn="$people_distinct_id",bi="$device_id",Mt="__alias",Ct="__timers",ms="$autocapture_disabled_server_side",ys="$heatmaps_enabled_server_side",bs="$exception_capture_enabled_server_side",ws="$error_tracking_suppression_rules",xs="$error_tracking_capture_extension_exceptions",Es="$web_vitals_enabled_server_side",Qs="$dead_clicks_enabled_server_side",ks="$product_tours_enabled_server_side",Ss="$web_vitals_allowed_metrics",Ze="$session_recording_remote_config",Vn="$replay_override_sampling",Wn="$replay_override_linked_flag",Yn="$replay_override_url_trigger",Xn="$replay_override_event_trigger",ct="$sesid",er="$session_is_sampled",ht="$enabled_feature_flags",oi="$active_feature_flags",Ot="$early_access_features",Ps="$feature_flag_details",Fs="$feature_flag_payloads",$s="$feature_flag_request_id",Ae="$override_feature_flags",ot="$override_feature_flag_payloads",Rt="$stored_person_properties",Je="$stored_group_properties",Ts="$surveys",tr="$surveys_loaded_at",Is="$surveys_activated",li="ph_product_tours",Dt="$flag_call_reported",Ms="$flag_call_reported_session_id",Cs="$feature_flag_errors",zt="$feature_flag_evaluated_at",ke="$user_state",Os="$client_session_props",Rs="$capture_rate_limit",As="$initial_campaign_params",Ls="$initial_referrer_info",wi="$initial_person_info",xi="$epp",Jn="__POSTHOG_TOOLBAR__",Qt="$posthog_cookieless",Kn="$sdk_debug_extensions_init_method",Zn="$sdk_debug_extensions_init_time_ms",Qn="$sdk_debug_recording_script_not_loaded",ir="PostHog loadExternalDependency extension not found.",Ke="on_reject",qe="always",tt="anonymous",it="identified",qs="identified_only",Ei="visibilitychange",ki="beforeunload",lt="$pageview",Bi="$pageleave",zi="$identify",Pr="$groupidentify";
1function ei(i,e){q(i)&&i.forEach(e)}function B(i,e){if(!D(i))if(q(i))i.forEach(e);else if(Ba(i))i.forEach(((s,r)=>e(s,r)));else for(var t in i)yn.call(i,t)&&e(i[t],t)}var z=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),s=1;e>s;s++)t[s-1]=arguments[s];for(var r of t)for(var n in r)r[n]!==void 0&&(i[n]=r[n]);return i};function ui(i){for(var e=Object.keys(i),t=e.length,s=new Array(t);t--;)s[t]=[e[t],i[e[t]]];return s}var Fr=function(i){try{return i()}catch{return}},To=function(i){return function(){try{for(var e=arguments.length,t=new Array(e),s=0;e>s;s++)t[s]=arguments[s];return i.apply(this,t)}catch(r){b.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),b.critical(r)}}},sr=function(i){var e={};return B(i,(function(t,s){(V(t)&&t.length>0||oe(t))&&(e[s]=t)})),e},Io=["herokuapp.com","vercel.app","netlify.app"];function Mo(i){var e=i?.hostname;if(!V(e))return!1;var t=e.split(".").slice(-2).join(".");for(var s of Io)if(t===s)return!1;return!0}function J(i,e,t,s){var{capture:r=!1,passive:n=!0}=s??{};i?.addEventListener(e,t,{capture:r,passive:n})}function ea(i){return i.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(i){return 0>i?Math.ceil(i):Math.floor(i)}),Number.isInteger||(Number.isInteger=function(i){return oe(i)&&isFinite(i)&&Math.floor(i)===i});class Si{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,s,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(s)||!Number.isInteger(r)||0>e||0>t||0>s||0>r||e>0xffffffffffff||t>4095||s>1073741823||r>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/Math.pow(2,8),n[5]=e,n[6]=112|t>>>8,n[7]=t,n[8]=128|s>>>24,n[9]=s>
1>>16,n[10]=s>>>8,n[11]=s,n[12]=r>>>24,n[13]=r>>>16,n[14]=r>>>8,n[15]=r,new Si(n)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new Si(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;16>t;t++){var s=this.bytes[t]-e.bytes[t];if(s!==0)return Math.sign(s)}return 0}}class Co{constructor(){this.S=0,this.C=0,this.I=new Oo}generate(){var e=this.generateOrAbort();if(y(e)){this.S=0;var t=this.generateOrAbort();if(y(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.T();else{if(this.S>=e+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.T())}return Si.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}T(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var $r,ta=i=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;i.length>e;e++)i[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return i};v&&!y(v.crypto)&&crypto.getRandomValues&&(ta=i=>crypto.getRandomValues(i));class Oo{constructor(){this.M=new Uint32Array(8),this.R=1/0}nextUint32(){return this.M.length>this.R||(ta(this.M),this.R=0),this.M[this.R++]}}var Ue=()=>Ro().toString(),Ro=()=>($r||($r=new Co)).generate(),wt="",Ao=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Fe={O:()=>!!w,D(i){b.error("cookieStore error: "+i)},A(i){if(w){try{for(var e=i+"=",t=w.cookie.split(";").filter((n=>n.length)),s=0;t.length>s;s++){for(var r=t[s];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return decodeURIComponent(r.substring(e.length,r.length))}}catch{}return null}},F(i){var e;try{e=JSON.parse(Fe.A(i))||{}}catch{}return e},N(i,e,t,s,r){if(!w)return!1;try{var n="",a="",o=(function(u,h){if(h){var d=(function(g,f){if(f===void 0&&(f=w),wt)return wt;if(!f||["localhost","127.0.0.1"].includes(g))return"";for(var T=g.split("."),P=Math.min(T.length,8),R="dmn_chk_"+Ue();!wt&&P--;){var C=T.slice(P).join("."),I=R+"=1;domain=."+C+";path=/";f.cookie=I+";max-age=3",f.cookie.includes(R)&&(f.cookie=I+";max-age=0",wt=C)}return wt})(u);if(!d){var p=(g=>{var f=g.match(Ao);return f?f[0]:""})(u);p!==d&&b.info("Warning: cookie subdomain discovery mismatch",p,d),d=p}return d?"; domain=."+d:""}return""})(w.location.hostname,s);if(t){var l=new Date;l.setTime(l.getTime()+864e5*t),n="; expires="+l.toUTCString()}r&&(a="; secure");var c=i+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+o+a;return c.length>3686.4&&b.warn("cookieStore warning: large cookie, len="+c.length),w.cookie=c,!0}catch{return!1}},q(i,e){if(w!=null&&w.cookie)try{Fe.N(i,"",-1,e)}catch{return}}},Gi=null,U={O(){if(!_e(Gi))return Gi;var i=!0;if(y(v))i=!1;else try{var e="__mplssupport__";U.N(e,"xyz"),U.A(e)!=='"xyz"'&&(i=!1),U.q(e)}catch{i=!1}return i||b.error("localStorage unsupported; falling back to cookie store"),Gi=i,i},D(i){b.error("localStorage error: "+i)},A(i){try{return v?.localStorage.getItem(i)}catch(e){U.D(e)}return null},F(i){try{return JSON.parse(U.A(i))||{}}catch{}return null},N(i,e){try{return v?.localStorage.setItem(i,JSON.stringify(e)),!0}catch(t){U.D(t)}return!1},q(i){try{v?.localStorage.removeItem(i)}catch(e){U.D(e)}}},Lo=[bi,"distinct_id",ct,er,xi,wi,ke],ti={},qo={O:()=>!0,D(i){b.error("memoryStorage error: "+i)},A:i=>ti[i]||null,F:i=>ti[i]||null,N:(i,e)=>(ti[i]=e,!0),q(i){delete ti[i]}},Ve=null,se={O(){if(!_e(Ve))return Ve;if(Ve=!0,y(v))Ve=!1;else try{var i="__support__";se.N(i,"xyz"),se.A(i)!=='"xyz"'&&(Ve=!1),se.q(i)}catch{Ve=!1}return Ve},D(i){b.error("sessionStorage error: ",i)},A(i){try{return v?.sessionStorage.getItem(i)}catch(e){se.D(e)}return null},F(i){try{return JSON.parse(se.A(i))||null}catch{}return null},N(i,e){try{return v?.sessionStorage.setItem(i,JSON.stringify(e)),!0}catch(t){se.D(t)}return!1},q(i){try{v?.sessionStorage.removeItem(i)}catch(e){se.D(e)}}};class Do{constructor(e){this._instance=e}get qt(){return this._instance.config}get consent(){return this.rr()?0:this.ir}isOptedOut(){return this.qt.cookieless_mode===qe||this.isRejected()||this.consent===-1&&this.qt.cookieless_mode===Ke}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.qt.opt_out_capturing_by_default}optInOut(e){this.nr.N(this.sr,e?1:0,this.qt.cookie_expiration,this.qt.cross_subdomain_cookie,this.qt.secure_cookie)}reset(){this.nr.q(this.sr,this.qt.cross_subdomain_cookie)}get sr(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:s}=this._instance.config;return s||(t?t+e:"__ph_opt_in_out_"+e)}get ir(){var e=this.nr.A(this.sr);return Di(e)?1:O(Va,e)?0:-1}get nr(){var e=this.qt.opt_out_capturing_persistence_type,t=e==="localStorage"?U:Fe;if(!this.ar||this.ar!==t){this.ar=t;var s=e==="localStorage"?Fe:U;s.A(this.sr)&&(this.ar.A(this.sr)||this.optInOut(Di(s.A(this.sr))),s.q(this.sr,this.qt.cross_subdomain_cookie))}return this.ar}rr(){return!!this.qt.respect_dnt&&[ge?.doNotTrack,ge?.msDoNotTrack,$.doNotTrack].some((e=>Di(e)))}}var No=1,jo=3,Ho=11;function Tr(i){return i instanceof Element&&(i.id===Jn||!(i.closest==null||!i.closest(".toolbar-global-fade-container")))}function ze(i){return!!i&&i.nodeType===No}function fe(i,e){return!!i&&!!i.tagName&&i.tagName.toLowerCase()===e.toLowerCase()}function ia(i){return!!i&&i.nodeType===jo}function sa(i){return!!i&&i.nodeType===Ho&&ze(i.host)}function rr(i){return i?Ci(i).split(/\s+/):[]}function Ir(i){var e=v?.location.href;return!!(e&&i&&i.some((t=>e.match(t))))}function Pi(i){var e="";switch(typeof i.className){case"string":e=i.className;break;case"object":e=(i.className&&"baseVal"in i.className?i.className.baseVal:null)||i.getAttribute("class")||"";break;default:e=""}return rr(e)}function ra(i){return D(i)?null:Ci(i).split(/(\s+)/).filter((e=>Nt(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Gt(i){var e="";return Ds(i)&&!ua(i)&&i.childNodes&&i.childNodes.length&&B(i.childNodes,(function(t){var s;ia(t)&&t.textContent&&(e+=(s=ra(t.textContent))!==null&&s!==void 0?s:"")})),Ci(e)}function Vi(i){return y(i.target)?i.srcElement||null:(e=i.target)!=null&&e.shadowRoot?i.composedPath()[0]||null:i.target||null;var e}var nr=["a","button","form","input","select","textarea","label"];function na(i,e){if(y(e))return!0;var t,s=function(n){if(e.some((a=>n.matches(a))))return{v:!0}};for(var r of i)if(t=s(r))return t.v;return!1}function aa(i){var e=i.parentNode;return!(!e||!ze(e))&&e}var oa=["next","previous","prev",">","<"],Uo=[...oa,"+","-","−","–"],Mr=(i,e)=>/[a-z0-9]/i.test(e)?i.includes(e):i===e,Cr=[".ph-no-rageclick",".ph-no-capture"],Bo=["","text","search","email","password","url","tel","number"];function Or(i,e){if(!v||ar(i))return!1;var t,s,r,n,a;if(Te(e)?(t=!!e&&Cr,s=void 0,r=!1):(t=(n=e?.css_selector_ignorelist)!==null&&n!==void 0?n:Cr,s=e?.content_ignorelist,r=(a=e?.ignore_text_selection)!==null&&a!==void 0&&a),t===!1||r&&(function(l){return!(!l||!ze(l))&&(!!fe(l,"textarea")||(fe(l,"
1input")?O(Bo,(l.getAttribute("type")||"").toLowerCase()):(function(c){if(c.isContentEditable)return!0;var u=c.getAttribute==null?void 0:c.getAttribute("contenteditable");return u==="true"||u===""})(l)))})(i))return!1;var{targetElementList:o}=la(i,!1);return!(function(l,c){if(l===!1||y(l))return!1;var u;if(l===!0)u=oa;else{if(!q(l))return!1;if(l.length>10)return b.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;u=l.map((h=>h.toLowerCase()))}return c.some((h=>{var{safeText:d,ariaLabel:p}=h;return u.some((g=>Mr(d,g)||Mr(p,g)))}))})(s,o.map((l=>{var c;return{safeText:Gt(l).toLowerCase(),ariaLabel:((c=l.getAttribute("aria-label"))==null?void 0:c.toLowerCase().trim())||""}})))&&!na(o,t)}var ar=i=>!i||fe(i,"html")||!ze(i),la=(i,e)=>{if(!v||ar(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var t=!1,s=[i],r=i;r.parentNode&&!fe(r,"body");)if(sa(r.parentNode))s.push(r.parentNode.host),r=r.parentNode.host;else{var n=aa(r);if(!n)break;if(e||nr.indexOf(n.tagName.toLowerCase())>-1)t=!0;else{var a=v.getComputedStyle(n);a&&a.getPropertyValue("cursor")==="pointer"&&(t=!0)}s.push(n),r=n}return{parentIsUsefulElement:t,targetElementList:s}};function Ds(i){for(var e=i;e.parentNode&&!fe(e,"body");e=e.parentNode){var t=Pi(e);if(O(t,"ph-sensitive")||O(t,"ph-no-capture"))return!1}if(O(Pi(i),"ph-include"))return!0;var s=i.type||"";if(V(s))switch(s.toLowerCase()){case"hidden":case"password":return!1}var r=i.name||i.id||"";return!V(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 ua(i){return!!(fe(i,"input")&&!["button","checkbox","submit","reset"].includes(i.type)||fe(i,"select")||fe(i,"textarea")||i.getAttribute("contenteditable")==="true")}var ca="(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})",zo=new RegExp("^(?:"+ca+")$"),Go=new RegExp(ca),ha="\\d{3}-?\\d{2}-?\\d{4}",Vo=new RegExp("^("+ha+")$"),Wo=new RegExp("("+ha+")");function Nt(i,e){return e===void 0&&(e=!0),!(D(i)||V(i)&&(i=Ci(i),(e?zo:Go).test((i||"").replace(/[- ]/g,""))||(e?Vo:Wo).test(i)))}function Rr(i){var e=Gt(i);return Nt(e=(e+" "+da(i)).trim())?e:""}function da(i){var e="";return i&&i.childNodes&&i.childNodes.length&&B(i.childNodes,(function(t){var s;if(t&&((s=t.tagName)==null?void 0:s.toLowerCase())==="span")try{var r=Gt(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+da(t)).trim())}catch(n){b.error("[AutoCapture]",n)}})),e}function Ar(i){return i.replace(/"|\\"/g,'\\"')}function Yo(i){var e=i.attr__class;return e?q(e)?e:rr(e):void 0}var ii=W("[Dead Clicks]"),Xo=()=>!0,Jo=i=>{var e,t=!((e=i.instance.persistence)==null||!e.get_property(Qs)),s=i.instance.config.capture_dead_clicks;return Te(s)?s:!!X(s)||t};class Lr{get lazyLoadedDeadClicksAutocapture(){return this.ur}constructor(e,t,s){this.instance=e,this.isEnabled=t,this.onCapture=s,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[Qs]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.lr((()=>{this.hr()})):this.stop()}lr(e){var t,s;(t=$.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"dead-clicks-autocapture",(r=>{r?ii.error("failed to load script",r):e()}))}hr(){var e;if(w){if(!this.ur&&(e=$.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=X(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.ur=$.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.ur.start(w),ii.info("starting...")}}else ii.error("`document` not found. Cannot start.")}stop(){this.ur&&(this.ur.stop(),this.ur=void 0,ii.info("stopping..."))}}var Wi=W("[SegmentIntegration]"),pa="posthog-js";function va(i,e){var{organization:t,projectId:s,prefix:r,severityAllowList:n=["error"],sendExceptionsToPostHog:a=!0}=e===void 0?{}:e;return o=>{var l,c,u,h,d;if(n!=="*"&&!n.includes(o.level)||!i.__loaded)return o;o.tags||(o.tags={});var p=i.requestRouter.endpointFor("ui","/project/"+i.config.token+"/pers
1on/"+i.get_distinct_id());o.tags["PostHog Person URL"]=p,i.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=i.get_session_replay_url({withTimestamp:!0}));var g,f=((l=o.exception)==null?void 0:l.values)||[],T=f.map((R=>_({},R,{stacktrace:R.stacktrace?_({},R.stacktrace,{type:"raw",frames:(R.stacktrace.frames||[]).map((C=>_({},C,{platform:"web:javascript"})))}):void 0}))),P={$exception_message:((c=f[0])==null?void 0:c.value)||o.message,$exception_type:(u=f[0])==null?void 0:u.type,$exception_level:o.level,$exception_list:T,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((h=f[0])==null?void 0:h.value)||o.message,$sentry_exception_type:(d=f[0])==null?void 0:d.type,$sentry_tags:o.tags};return t&&s&&(P.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+s+"&query="+o.event_id),a&&((g=i.exceptions)==null||g.sendExceptionEvent(P)),o}}class Ko{constructor(e,t,s,r,n,a){this.name=pa,this.setupOnce=function(o){o(va(e,{organization:t,projectId:s,prefix:r,severityAllowList:n,sendExceptionsToPostHog:a==null||a}))}}}class qr{constructor(e){this.cr=(t,s,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength)&&(b.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:r}),this.dr=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.vr()}vr(){var e;this.pr=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.cr)}destroy(){var e;(e=this.pr)==null||e.call(this),this.pr=void 0}doPageView(e,t){var s,r=this.gr(e,t);return this.dr={pathname:(s=v?.location.pathname)!==null&&s!==void 0?s:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.gr(e,(t=this.dr)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.dr)==null?void 0:e.pageViewId}}gr(e,t){var s=this.dr;if(!s)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:s.pageViewId},n=this._instance.scrollManager.getContext();if(n&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:o,maxScrollY:l,maxContentHeight:c,lastContentY:u,maxContentY:h}=n;if(!(y(a)||y(o)||y(l)||y(c)||y(u)||y(h))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),h=Math.ceil(h);var d=a>1?$e(o/a,0,1,b):1,p=a>1?$e(l/a,0,1,b):1,g=c>1?$e(u/c,0,1,b):1,f=c>1?$e(h/c,0,1,b):1;r=z(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:p,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:g,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:f})}}return s.pathname&&(r.$prev_pageview_pathname=s.pathname),s.timestamp&&(r.$prev_pageview_duration=(e.getTime()-s.timestamp.getTime())/1e3),r}}var si=["flags","surveys"],Zo={[Gn]:{exposure:"hidden"},[Mt]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Ct]:{exposure:"hidden"},[ms]:{exposure:"event"},[ys]:{exposure:"hidden"},[bs]:{exposure:"event"},[ws]:{exposure:"hidden"},[xs]:{exposure:"event"},[Es]:{exposure:"event"},[Qs]:{exposure:"event"},[ks]:{exposure:"hidden"},[Ss]:{exposure:"event"},[Ze]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[ct]:{exposure:"hidden"},[er]:{exposure:"event"},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},[ht]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(i,e)=>e(),transformToEventProperties(i){if(!X(i))return{};for(var e={},t=Object.keys(i),s=0;t.length>s;s++)e["$feature/"+t[s]]=i[t[s]];return e}},[oi]:{exposure:"event",storageGroup:"flags"},[Ot]:{exposure:"hidden"},[Ps]:{exposure:"hidden",storageGroup:"flags"},[Fs]:{exposure:"event",storageGroup:"flags"},[$s]:{exposure:"event",storageGroup:"flags"},[Ae]:{exposure:"event"},[ot]:{exposure:"hidden"},[Rt]:{exposure:"hidden"},[Je]:{exposure:"hidden"},[Ts]:{exposure:"hidden",storageGroup:"surveys"},[tr]:{exposure:"hidden",storageGroup:"surveys"},[Is]:{exposure:"event"}
1,[li]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Dt]:{exposure:"hidden"},[Ms]:{exposure:"hidden"},[Cs]:{exposure:"hidden"},[zt]:{exposure:"hidden",storageGroup:"flags"},[ke]:{exposure:"hidden"},[Os]:{exposure:"hidden"},[Rs]:{exposure:"hidden"},[As]:{exposure:"hidden"},[Ls]:{exposure:"hidden"},[wi]:{exposure:"hidden"},[xi]:{exposure:"hidden"},[Vn]:{exposure:"event"},[Wn]:{exposure:"event"},[Yn]:{exposure:"event"},[Xn]:{exposure:"event"},[Kn]:{exposure:"event"},[Zn]:{exposure:"event"},[Qn]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Qo=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],xt=i=>{var e=Zo[i];if(e)return e;for(var[t,s]of Qo)if(i.indexOf(t)===0)return s},Fi=i=>{var e=w?.createElement("a");return y(e)?null:(e.href=i,e)},Vt=function(i,e){for(var t,s=((i.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===e){t=n;break}}if(!q(t)||2>t.length)return"";var a=t[1];try{a=decodeURIComponent(a)}catch{b.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},Wt=function(i,e,t){if(!i||!e||!e.length)return i;for(var s=i.split("#"),r=s[1],n=(s[0]||"").split("?"),a=n[1],o=n[0],l=(a||"").split("&"),c=[],u=0;l.length>u;u++){var h=l[u].split("=");q(h)&&(e.includes(h[0])?c.push(h[0]+"="+t):c.push(l[u]))}var d=o;return a!=null&&(d+="?"+c.join("&")),r!=null&&(d+="#"+r),d},$i=function(i,e){var t=i.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},ri="https?://(.*)",mt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],el=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...mt],Yt="<masked>",tl=["li_fat_id"];function ga(i,e,t){if(!w)return{};var s,r=e?[...mt,...t||[]]:[],n=fa(Wt(w.URL,r,Yt),i),a=(s={},B(tl,(function(o){var l=Fe.A(o);s[o]=l||null})),s);return z(a,n)}function fa(i,e){var t=el.concat(e||[]),s={};return B(t,(function(r){var n=Vt(i,r);s[r]=n||null})),s}function _a(i){var e=(function(n){return n?n.search(ri+"google.([^/?]*)")===0?"google":n.search(ri+"bing.com")===0?"bing":n.search(ri+"yahoo.com")===0?"yahoo":n.search(ri+"duckduckgo.com")===0?"duckduckgo":null:null})(i),t=e!="yahoo"?"q":"p",s={};if(!_e(e)){s.$search_engine=e;var r=w?Vt(w.referrer,t):"";r.length&&(s.ph_keyword=r)}return s}function Dr(){return navigator.language||navigator.userLanguage}var Ti="$direct";function ma(){return w?.referrer||Ti}function ya(i,e){var t=i?[...mt,...e||[]]:[],s=ie?.href.substring(0,1e3);return{r:ma().substring(0,1e3),u:s?Wt(s,t,Yt):void 0}}function ba(i){var e,{r:t,u:s}=i,r={$referrer:t,$referring_domain:t==null?void 0:t==Ti?Ti:(e=Fi(t))==null?void 0:e.host};if(s){r.$current_url=s;var n=Fi(s);r.$host=n?.host,r.$pathname=n?.pathname;var a=fa(s);z(r,a)}if(t){var o=_a(t);z(r,o)}return r}function wa(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function il(){try{return new Date().getTimezoneOffset()}catch{return}}var sl={flags:zt,surveys:tr},rl=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],st="main";class Yi{constructor(e,t,s){if(s===void 0&&(s=!0),this.mr={},this.yr=!1,this.br=!1,this.qt=e,this._r=s,this.props={},this.wr=!1,this.Sr=(n=>{var a="";return n.token&&(a=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+a+"_posthog"})(e),this.nr=this.kr(e),this.br=this.Cr(e),this.load(),e.debug&&b.info("Persistence loaded",e.persistence,_({},this.props)),this.update_config(e,e,t),this.save(),v){var r=()=>this.flush();J(v,"beforeunload",r,{capture:!1}),J(v,"pagehide",r,{capture:!1})}}Ir(){var e,t=(e=this.qt)==null?void 0:e.persistence_save_debounce_ms;return oe(t)&&t>0?t:0}isDisabled(){return!!this.Tr}kr(e){rl.indexOf(e.persistence.toLowerCase())===-1&&(b.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,s=(function(a,o){a===void 0&&(a=[]),o===void 0&&(o=!1);var l=[...Lo,...a];return _({},U,{F(c){try{var u={};try{u=Fe.F(c)||{}}catch{}var h,d=JSON.parse(U.A(c)||"{}");if(o){var p={};for(var g in u){var f=u[g];_e(f)||f===""||(p[g]=f)}h=z(d,p)}else h=z(u,d);return U.N(c,h),h}catch{}return null},N(c,u,h,d,p,g){var f=U.N(c,u,void 0,void 0,g);try{var T={};l.forEach((P=>{u[P]&&(T[P]=u[P])})),Object.keys(T).length&&Fe.N(c,T,h,d,p,g)}catch(P){U.D(P)}return f},q(c,u){try{v?.localStorage.removeItem(c),Fe.q(c,u)}catch(h){U.D(h)}}})})(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),r=!1,n=e.persistence.toLowerCase();return n==="localstorage"&&U.O()?(t=U,r=!0):n==="localstorage+cookie"&&s.O()?(t=s,r=!0):n==="sessionstorage"&&se.O()?t=se:n==="memory"?t=qo:n==="cookie"?t=Fe:s.O()?(t=s,r=!0):t=Fe,this.yr=r,t}Er(e){return this.Sr+"__"+e}Cr(e){return this.yr&&!!e.split_storage}Mr(e){var t=e??this.qt.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var s=this.props[zt];return!s||typeof s!="number"||Date.now()-s>t}properties(){var e={};return B(this.props,((t,s)=>{var r=xt(s);if(r?.exposure==="derived"){if(r.shouldSkipFromEventProperties!=null&&r.shouldSkipFromEventProperties(t,s===ht?()=>this.Mr():()=>!1))return;r.transformToEventProperties&&z(e,r.transformToEventProperties(t))}else r&&r.exposure!=="event"||(e[s]=t)})),e}load(){if(!this.Tr){var e=this.nr.F(this.Sr);e&&(this.props=z({},e)),this.br&&this.Rr()}}Rr(){for(var e of si){var t=U.F(this.Er(e));if(t&&!Be(t)){var s=this.Pr(e);s.persisted=!0,this.Or(e)||(s.fingerprint=this.Lr(t,e)),this.Fr(e,t)||z(this.props,t)}}}Or(e){return Object.keys(this.props).some((t=>{var s;return((s=xt(t))==null?void 0:s.storageGroup)===e}))}Fr(e,t){var s=sl[e];
1if(!s)return!1;var r=t[s],n=this.props[s];return oe(r)&&oe(n)&&n>r}refreshKey(e){var t;if(!this.Tr){var s=this.br?(t=xt(e))==null?void 0:t.storageGroup:void 0,r=s?U.F(this.Er(s)):this.nr.F(this.Sr);if(r&&e in r)this.Ar(e,r[e]);else{if(s){var n=this.nr.F(this.Sr);if(n&&e in n)return void this.Ar(e,n[e])}this.Nr(e)}}}save(){if(!this.Tr){var e=this.Ir();e>0?y(this.Dr)&&(this.Dr=setTimeout((()=>{this.Dr=void 0,this.$r()}),e)):this.$r()}}flush(){y(this.Dr)||(clearTimeout(this.Dr),this.Dr=void 0,this.$r())}$r(){this.Tr||(this.br?this.qr():this.jr(this.nr,this.Sr,this.props,st))}qr(){var{main:e,groups:t}=this.Hr();for(var s of(this.jr(this.nr,this.Sr,e,st),si)){var r,n=t[s];(!Be(n)||(r=this.mr[s])!=null&&r.persisted)&&this.jr(U,this.Er(s),n,s)}}Hr(){var e={},t={};for(var s of si)t[s]={};return B(this.props,((r,n)=>{var a,o=(a=xt(n))==null?void 0:a.storageGroup;o?t[o][n]=r:e[n]=r})),{main:e,groups:t}}Lr(e,t){var s=JSON.stringify(e);return t===st?s+"|"+this.Ur+"|"+this.Br+"|"+this.zr:s}jr(e,t,s,r){var n=this.Pr(r);if(r===st||n.dirty||y(n.fingerprint)){var a;try{if((a=this.Lr(s,r))===n.fingerprint)return void(n.dirty=!1)}catch{a=void 0}e.N(t,s,this.Ur,this.Br,this.zr,this.qt.debug)?(n.dirty=!1,r!==st&&(n.persisted=!0),y(a)||(n.fingerprint=a)):this.qt.debug&&b.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var{keepGroupEntries:t=!1}=e===void 0?{}:e;if(y(this.Dr)||(clearTimeout(this.Dr),this.Dr=void 0),this.nr.q(this.Sr,!1),this.nr.q(this.Sr,!0),!t&&this._r)for(var s of si)U.q(this.Er(s));t?delete this.mr[st]:this.mr={}}clear(){this.remove(),this.props={}}register_once(e,t,s){if(X(e)){y(t)&&(t="None"),this.Ur=y(s)?this.Vr:s;var r=!1;if(B(e,((n,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==t||(this.Ar(a,n),r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(X(e)){this.Ur=y(t)?this.Vr:t;var s=!1;if(B(e,((r,n)=>{e.hasOwnProperty(n)&&this.props[n]!==r&&(this.Ar(n,r),s=!0)})),s)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Nr(e),this.save())}update_campaign_params(){if(!this.wr){var e=ga(this.qt.custom_campaign_params,this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties);Be(sr(e))||this.register(e),this.wr=!0}}update_search_keyword(){var e;this.register((e=w?.referrer)?_a(e):{})}update_referrer_info(){var e;this.register_once({$referrer:ma(),$referring_domain:w!=null&&w.referrer&&((e=Fi(w.referrer))==null?void 0:e.host)||Ti},void 0)}set_initial_person_info(){this.props[As]||this.props[Ls]||this.register_once({[wi]:ya(this.qt.mask_personal_data_properties,this.qt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};B([Ls,As],(a=>{var o=this.props[a];o&&B(o,(function(l,c){e["$initial_"+hs(c)]=l}))}));var t,s,r=this.props[wi];if(r){var n=(t=ba(r),s={},B(t,(function(a,o){s["$initial_"+hs(o)]=a})),s);z(e,n)}return e}safe_merge(e){return B(this.props,(function(t,s){s in e||(e[s]=t)})),e}update_config(e,t,s){this.Vr=this.Ur=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!s),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var r=e.persistence!==t.persistence||!((l,c)=>{if(l.length!==c.length)return!1;var u=[...l].sort(),h=[...c].sort();return u.every(((d,p)=>d===h[p]))})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),n=r?this.kr(e):this.nr,a=this.Cr(e);if(r||a!==this.br){var o=this.props;this.clear(),this.nr=n,this.br=a,this.props=o,this.save()}}set_disabled(e){this.Tr=e,this.Tr?this.remove():this.save()}set_cross_subdomain(e){e!==this.Br&&(this.Br=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.zr&&(this.zr=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var s=this.props[Ct]||{};s[e]=t,this.Ar(Ct,s),this.save()}remove_event_timer(e){var t=this.props[Ct]||{},s=t[e];return y(s)||(delete t[e],this.Ar(Ct,t),this.save()),s}get_property(e){return this.props[e]}set_property(e,t){this.Ar(e,t),this.save()}Ar(e,t){this.props[e]=t,this.Wr(e)}Nr(e){delete this.props[e],this.Wr(e)}Wr(e){var t,s=(t=xt(e))==null?void 0:t.storageGroup;s&&(this.Pr(s).dirty=!0)}Pr(e){return this.mr[e]||(this.mr[e]={})}}var Et={Activation:"events",Cancellation:"cancelEvents"},Xi={Popover:"popover",API:"api",Widget:"widget"},At={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},Ji={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Ns={Popover:"popover",Inline:"inline"},nl={SHOWN:"product tour shown"},Nr={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},jr=W("[RateLimiter]");class al{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var s=t.text;
1if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach((r=>{jr.info((r||"events")+" is quota limited."),this.serverLimits[r]=new Date().getTime()+6e4}))}catch(r){return void jr.warn('could not rate limit - continuing. Error: "'+r?.message+'"',{text:s})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var t,s,r;e===void 0&&(e=!1);var{captureEventsBurstLimit:n,captureEventsPerSecond:a}=this,o=new Date().getTime(),l=(t=(s=this.instance.persistence)==null?void 0:s.get_property(Rs))!==null&&t!==void 0?t:{tokens:n,last:o};l.tokens+=(o-l.last)/1e3*a,l.last=o,l.tokens>n&&(l.tokens=n);var c=1>l.tokens;return c||e||(l.tokens=Math.max(0,l.tokens-1)),!c||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+a+" events per second and "+n+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=c,(r=this.instance.persistence)==null||r.set_property(Rs,l),{isRateLimited:c,remainingTokens:l.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var kt=W("[RemoteConfig]");class xa{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=$._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Zr(e){var t,s;(t=$.__PosthogExtensions__)!=null&&t.loadExternalDependency?(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):e()}Gr(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return kt.info("Using preloaded remote config",this.remoteConfig),this.Qr(this.remoteConfig),void this.Jr();if(this._instance.Kr())return void kt.warn("Remote config is disabled. Falling back to local config.");this.Zr((e=>{if(!e)return kt.info("No config found after loading remote JS config. Falling back to JSON."),void this.Gr((t=>{this.Qr(t),this.Jr()}));this.Qr(e),this.Jr()}))}catch(e){kt.error("Error loading remote config",e)}}stop(){this.Yr&&(clearInterval(this.Yr),this.Yr=void 0)}refresh(){!this._instance.Kr()&&w&&w.visibilityState!=="hidden"&&this._instance.reloadFeatureFlags()}Jr(){var e;if(!this.Yr){var t=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;t!==0&&(this.Yr=setInterval((()=>{this.refresh()}),t))}}Qr(e){var t;e||kt.error("Failed to fetch remote config from PostHog."),this._instance.Qr(e??{}),e?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(t=this._instance.featureFlags)==null||t.ensureFlagsLoaded())}}var Pe={GZipJS:"gzip-js",Base64:"base64"},xe=Uint8Array,he=Uint16Array,yt=Uint32Array,or=new xe([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]),lr=new xe([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]),Hr=new xe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ea=function(i,e){for(var t=new he(31),s=0;31>s;++s)t[s]=e+=1<<i[s-1];var r=new yt(t[30]);for(s=1;30>s;++s)for(var n=t[s];t[s+1]>n;++n)r[n]=n-t[s]<<5|s;return[t,r]},ka=Ea(or,2),js=ka[1];ka[0][28]=258,js[258]=28;for(var Ur=Ea(lr,0)[1],Sa=new he(32768),G=0;32768>G;++G){var rt=(43690&G)>>>1|(21845&G)<<1;Sa[G]=((65280&(rt=(61680&(rt=(52428&rt)>>>2|(13107&rt)<<2))>>>4|(3855&rt)<<4))>>>8|(255&rt)<<8)>>>1}var jt=function(i,e,t){for(var s=i.length,r=0,n=new he(e);s>r;++r)++n[i[r]-1];var a,o=new he(e);for(r=0;e>r;++r)o[r]=o[r-1]+n[r-1]<<1;for(a=new he(s),r=0;s>r;++r)a[r]=Sa[o[i[r]-1]++]>>>15-i[r];return a},et=new xe(288);for(G=0;144>G;++G)et[G]=8;for(G=144;256>G;++G)et[G]=9;for(G=256;280>G;++G)et[G]=7;for(G=280;288>G;++G)et[G]=8;var Ii=new xe(32);for(G=0;32>G;++G)Ii[G]=5;var ol=jt(et,9),ll=jt(Ii,5),Pa=function(i){return(i/8>>0)+(7&i&&1)},Fa=function(i,e,t){(t==null||t>i.length)&&(t=i.length);var s=new(i instanceof he?he:i instanceof yt?yt:xe)(t-e);return s.set(i.subarray(e,t)),s},Me=function(i,e,t){var s=e/8>>0;i[s]|=t<<=7&e,i[s+1]|=t>>>8},St=function(i,e,t){var s=e/8>>0;i[s]|=t<<=7&e,i[s+1]|=t>>>8,i[s+2]|=t>>>16},Ki=function(i,e){for(var t=[],s=0;i.length>s;++s)i[s]&&t.push({s,f:i[s]});var r=t.length,n=t.slice();if(!r)return[new xe(0),0];if(r==1){var a=new xe(t[0].s+1);return a[t[0].s]=1,[a,1]}t.sort((function(E,F){return E.f-F.f})),t.push({s:-1,f:25001});var o=t[0],l=t[1],c=0,u=1,h=2;for(t[0]={s:-1,f:o.f+l.f,l:o,r:l};u!=r-1;)o=t[t[h].f>t[c].f?c++:h++],l=t[c!=u&&t[h].f>t[c].f?c++:h++],t[u++]={s:-1,f:o.f+l.f,l:o,r:l};var d=n[0].s;for(s=1;r>s;++s)n[s].s>d&&(d=n[s].s);var p=new he(d+1),g=Hs(t[u-1],p,0);if(g>e){s=0;var f=0,T=g-e,P=1<<T;for(n.sort((function(E,F){return p[F.s]-p[E.s]||E.f-F.f}));r>s;++s){var R=n[s].s;if(e>=p[R])break;f+=P-(1<<g-p[R]),p[R]=e}for(f>>>=T;f>0;
1){var C=n[s].s;e>p[C]?f-=1<<e-p[C]++-1:++s}for(;s>=0&&f;--s){var I=n[s].s;p[I]==e&&(--p[I],++f)}g=e}return[new xe(p),g]},Hs=function(i,e,t){return i.s==-1?Math.max(Hs(i.l,e,t+1),Hs(i.r,e,t+1)):e[i.s]=t},Br=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new he(++e),s=0,r=i[0],n=1,a=function(l){t[s++]=l},o=1;e>=o;++o)if(i[o]==r&&o!=e)++n;else{if(!r&&n>2){for(;n>138;n-=138)a(32754);n>2&&(a(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(a(r),--n;n>6;n-=6)a(8304);n>2&&(a(n-3<<5|8208),n=0)}for(;n--;)a(r);n=1,r=i[o]}return[t.subarray(0,s),e]},Pt=function(i,e){for(var t=0,s=0;e.length>s;++s)t+=i[s]*e[s];return t},Us=function(i,e,t){var s=t.length,r=Pa(e+2);i[r]=255&s,i[r+1]=s>>>8,i[r+2]=255^i[r],i[r+3]=255^i[r+1];for(var n=0;s>n;++n)i[r+n+4]=t[n];return 8*(r+4+s)},zr=function(i,e,t,s,r,n,a,o,l,c,u){Me(e,u++,t),++r[256];for(var h=Ki(r,15),d=h[0],p=h[1],g=Ki(n,15),f=g[0],T=g[1],P=Br(d),R=P[0],C=P[1],I=Br(f),E=I[0],F=I[1],k=new he(19),x=0;R.length>x;++x)k[31&R[x]]++;for(x=0;E.length>x;++x)k[31&E[x]]++;for(var m=Ki(k,7),S=m[0],M=m[1],L=19;L>4&&!S[Hr[L-1]];--L);var A,N,j,ee,de=c+5<<3,le=Pt(r,et)+Pt(n,Ii)+a,K=Pt(r,d)+Pt(n,f)+a+14+3*L+Pt(k,S)+(2*k[16]+3*k[17]+7*k[18]);if(le>=de&&K>=de)return Us(e,u,i.subarray(l,l+c));if(Me(e,u,1+(le>K)),u+=2,le>K){A=jt(d,p),N=d,j=jt(f,T),ee=f;var pe=jt(S,M);for(Me(e,u,C-257),Me(e,u+5,F-1),Me(e,u+10,L-4),u+=14,x=0;L>x;++x)Me(e,u+3*x,S[Hr[x]]);u+=3*L;for(var ne=[R,E],Se=0;2>Se;++Se){var ye=ne[Se];for(x=0;ye.length>x;++x)Me(e,u,pe[ae=31&ye[x]]),u+=S[ae],ae>15&&(Me(e,u,ye[x]>>>5&127),u+=ye[x]>>>12)}}else A=ol,N=et,j=ll,ee=Ii;for(x=0;o>x;++x)if(s[x]>255){var ae;St(e,u,A[257+(ae=s[x]>>>18&31)]),u+=N[ae+257],ae>7&&(Me(e,u,s[x]>>>23&31),u+=or[ae]);var ue=31&s[x];St(e,u,j[ue]),u+=ee[ue],ue>3&&(St(e,u,s[x]>>>5&8191),u+=lr[ue])}else St(e,u,A[s[x]]),u+=N[s[x]];return St(e,u,A[256]),u+N[256]},ul=new yt([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),cl=(function(){for(var i=new yt(256),e=0;256>e;++e){for(var t=e,s=9;--s;)t=(1&t&&3988292384)^t>>>1;i[e]=t}return i})(),Zi=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8};function hl(i,e){e===void 0&&(e={});var t=(function(){var h=4294967295;return{p(d){for(var p=h,g=0;d.length>g;++g)p=cl[255&p^d[g]]^p>>>8;h=p},d(){return 4294967295^h}}})(),s=i.length;t.p(i);var r,n,a,o,l,c=(o=10+((r=e).filename&&r.filename.length+1||0),l=8,(function(h,d,p,g,f,T){var P=h.length,R=new xe(g+P+5*(1+Math.floor(P/7e3))+f),C=R.subarray(g,R.length-f),I=0;if(!d||8>P)for(var E=0;P>=E;E+=65535){var F=E+65535;P>F?I=Us(C,I,h.subarray(E,F)):(C[E]=!0,I=Us(C,I,h.subarray(E,P)))}else{for(var k=ul[d-1],x=k>>>13,m=8191&k,S=(1<<p)-1,M=new he(32768),L=new he(S+1),A=Math.ceil(p/3),N=2*A,j=function(qi){return(h[qi]^h[qi+1]<<A^h[qi+2]<<N)&S},ee=new yt(25e3),de=new he(288),le=new he(32),K=0,pe=0,ne=(E=0,0),Se=0,ye=0;P>E;++E){var ae=j(E),ue=32767&E,Ie=L[ae];if(M[ue]=Ie,L[ae]=ue,E>=Se){var Xt=P-E;if((K>7e3||ne>24576)&&Xt>423){I=zr(h,C,0,ee,de,le,pe,ne,ye,E-ye,I),ne=K=pe=0,ye=E;for(var Ee=0;286>Ee;++Ee)de[Ee]=0;for(Ee=0;30>Ee;++Ee)le[Ee]=0}var Ge=2,Jt=0,Ra=m,Ne=ue-Ie&32767;if(Xt>2&&ae==j(E-Ne))for(var Aa=Math.min(x,Xt)-1,La=Math.min(32767,E),qa=Math.min(258,Xt);La>=Ne&&--Ra&&ue!=Ie;){if(h[E+Ge]==h[E+Ge-Ne]){for(var je=0;qa>je&&h[E+je]==h[E+je-Ne];++je);if(je>Ge){if(Ge=je,Jt=Ne,je>Aa)break;var Da=Math.min(Ne,je-2),cr=0;for(Ee=0;Da>Ee;++Ee){var Li=E-Ne+Ee+32768&32767,hr=Li-M[Li]+32768&32767;hr>cr&&(cr=hr,Ie=Li)}}}Ne+=(ue=Ie)-(Ie=M[ue])+32768&32767}if(Jt){ee[ne++]=268435456|js[Ge]<<18|Ur[Jt];var dr=31&js[Ge],pr=31&Ur[Jt];pe+=or[dr]+lr[pr],++de[257+dr],++le[pr],Se=E+Ge,++K}else ee[ne++]=h[E],++de[h[E]]}}I=zr(h,C,!0,ee,de,le,pe,ne,ye,E-ye,I)}return Fa(R,0,g+Pa(I)+f)})(n=i,(a=e).level==null?6:a.level,a.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+a.mem,o,l)),u=c.length;return(function(h,d){var p=d.filename;if(h[0]=31,h[1]=139,h[2]=8,h[8]=2>d.level?4:d.level==9?2:0,h[9]=3,d.mtime!=0&&Zi(h,4,Math.floor(new Date(d.mtime||Date.now())/1e3)),p){h[3]=8;for(var g=0;p.length>=g;++g)h[g+10]=p.charCodeAt(g)}})(c,e),Zi(c,u-8,t.d()),Zi(c,u-4,s),c}var dl=!!ls||!!os,$a="text/plain",ci=!1,pl=(i,e)=>{var[t,s]=i.split("#"),[r,n]=t.split("?");if(!n)return i;var a=n.split("&").filter((o=>o.split("=")[0]!==e)).join("&");return r+(a?"?"+a:"")+(s?"#"+s:"")},Ri=function(i,e,t){var s;
1t===void 0&&(t=!0);var[r,n]=i.split("?"),a=_({},e),o=(s=n?.split("&").map((c=>{var u,[h,d]=c.split("="),p=t&&(u=a[h])!==null&&u!==void 0?u:d;return delete a[h],h+"="+p})))!==null&&s!==void 0?s:[],l=(function(c,u){var h,d;u===void 0&&(u="&");var p=[];return B(c,(function(g,f){y(g)||y(f)||f==="undefined"||(h=encodeURIComponent((T=>T instanceof File)(g)?g.name:g.toString()),d=encodeURIComponent(f),p[p.length]=d+"="+h)})),p.join(u)})(a);return l&&o.push(l),r+"?"+o.join("&")},dt=(i,e)=>JSON.stringify(i,((t,s)=>typeof s=="bigint"?s.toString():s),e),Gr=i=>{if(i.tr)return i.tr;var{data:e,compression:t}=i;if(e){if(t===Pe.GZipJS){var s=hl((function(o,l){var c=o.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(o);for(var u=new xe(o.length+(o.length>>>1)),h=0,d=function(T){u[h++]=T},p=0;c>p;++p){if(h+5>u.length){var g=new xe(h+8+(c-p<<1));g.set(u),u=g}var f=o.charCodeAt(p);128>f?d(f):2048>f?(d(192|f>>>6),d(128|63&f)):f>55295&&57344>f?(d(240|(f=65536+(1047552&f)|1023&o.charCodeAt(++p))>>>18),d(128|f>>>12&63),d(128|f>>>6&63),d(128|63&f)):(d(224|f>>>12),d(128|f>>>6&63),d(128|63&f))}return Fa(u,0,h)})(dt(e)),{mtime:0});return{contentType:$a,body:s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength),estimatedSize:s.byteLength}}if(t===Pe.Base64){var r=(function(o){return o&&btoa(encodeURIComponent(o).replace(/%([0-9A-F]{2})/g,((l,c)=>String.fromCharCode(parseInt(c,16)))))})(dt(e)),n=(o=>"data="+encodeURIComponent(typeof o=="string"?o:dt(o)))(r);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var a=dt(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Qi=i=>{var e,t,s,r=Gr(i);return!r||(t=i.compression,s=Vt(i.url,"compression"),t!==_r.GZipJS&&s!==_r.GZipJS&&s!=="gzip")||((e=r.body)instanceof ArrayBuffer?us(new Uint8Array(e)):ArrayBuffer.isView(e)&&us(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?{url:i.url,encodedBody:r}:(ci=!0,{url:pl(i.url,"compression"),encodedBody:Gr(_({},i,{compression:void 0,tr:void 0}))})},vl=(function(){var i=ve((function*(e){var t=dt(e.data),s=yield(function(n,a,o){return cs.apply(this,arguments)})(t,Q.DEBUG,{rethrow:!0});if(!s)return e;var r=yield s.arrayBuffer();return _({},e,{tr:{contentType:$a,body:r,estimatedSize:r.byteLength}})}));return function(e){return i.apply(this,arguments)}})(),Vr=(i,e)=>Ri(i,{_:new Date().getTime().toString(),ver:Q.JS_SDK_VERSION,compression:e}),hi=[];os&&hi.push({transport:"fetch",method(i){var e,{url:t,encodedBody:s}=Qi(i),{contentType:r,body:n,estimatedSize:a}=s??{},o=new Headers;B(i.headers,(function(u,h){o.append(h,u)})),r&&o.append("Content-Type",r);var l=null;if(vr){var c=new vr;l={signal:c.signal,timeout:setTimeout((()=>c.abort()),i.timeout)}}os(t,_({method:i?.method||"GET",headers:o,keepalive:i.method==="POST"&&52428.8>(a||0),body:n,signal:(e=l)==null?void 0:e.signal},i.fetchOptions)).then((u=>u.text().then((h=>{var d={statusCode:u.status,text:h};if(u.status===200)try{d.json=JSON.parse(h)}catch(p){b.error(p)}i.callback==null||i.callback(d)})))).catch((u=>{b.error(u),i.callback==null||i.callback({statusCode:0,error:u})})).finally((()=>l?clearTimeout(l.timeout):null))}}),ls&&hi.push({transport:"XHR",method(i){var e=new ls,{url:t,encodedBody:s}=Qi(i);e.open(i.method||"GET",t,!0);var{contentType:r,body:n}=s??{};B(i.headers,(function(a,o){e.setRequestHeader(o,a)})),r&&e.setRequestHeader("Content-Type",r),i.timeout&&(e.timeout=i.timeout),i.disableXHRCredentials||(e.withCredentials=!0),e.onreadystatechange=()=>{if(e.readyState===4){var a={statusCode:e.status,text:e.responseText};if(e.status===200)try{a.json=JSON.parse(e.responseText)}catch{}i.callback==null||i.callback(a)}},e.send(n)}}),ge!=null&&ge.sendBeacon&&hi.push({transport:"sendBeacon",method(i){try{var{url:e,encodedBody:t}=Qi(i),s=Ri(e,{beacon:"1"}),{contentType:r,body:n}=t??{};if(!n)return;var a=n instanceof Blob?n:new Blob([n],{type:r});ge.sendBeacon(s,a)}catch{}}});var Bs=3e3;class gl{constructor(e,t){this.Xr=!0,this.ei=[],this.ti=$e(t?.flush_interval_ms||Bs,250,5e3,b.createLogger("flush interval"),Bs),this.ri=e}enqueue(e){this.ei.push(e),this.ii||this.ni()}unload(){this.si();var e=this.ei.length>0?this.oi():{},t=Object.values(e);[...t.filter((s=>s.url.indexOf("/e")===0)),...t.filter((s=>s.url.indexOf("/e")!==0))].map((s=>{this.ri(_({},s,{transport:"sendBeacon"}))}))}enable(){this.Xr=!1,this.ni()}ni(){var e=this;this.Xr||(this.ii=setTimeout((()=>
1{if(this.si(),this.ei.length>0){var t=this.oi(),s=function(){var n=t[r],a=new Date().getTime();n.data&&q(n.data)&&B(n.data,(o=>{o.offset=Math.abs(o.timestamp-a),delete o.timestamp})),e.ri(n)};for(var r in t)s()}}),this.ti))}si(){clearTimeout(this.ii),this.ii=void 0}oi(){var e={};return B(this.ei,(t=>{var s,r=t,n=(r?r.batchKey:null)||r.url;y(e[n])&&(e[n]=_({},r,{data:[]})),(s=e[n].data)==null||s.push(r.data)})),this.ei=[],e}}var fl=["retriesPerformedSoFar"];class _l{constructor(e){this.ai=!1,this.ui=3e3,this.ei=[],this._instance=e,this.ei=[],this.li=!0,!y(v)&&"onLine"in v.navigator&&(this.li=v.navigator.onLine,this.hi=()=>{this.li=!0,this.ci()},this.di=()=>{this.li=!1},J(v,"online",this.hi),J(v,"offline",this.di))}get length(){return this.ei.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,s=fn(e,fl);Re(t)&&(s.url=Ri(s.url,{retry_count:t})),this._instance._send_request(_({},s,{callback:r=>{r.statusCode===200||r.statusCode>=400&&500>r.statusCode||(t??0)>=10?s.callback==null||s.callback(r):this.vi(_({retriesPerformedSoFar:t},s))}}))}vi(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var s=(function(a){var o=3e3*Math.pow(2,a),l=o/2,c=Math.min(18e5,o),u=Math.random()-.5;return Math.ceil(c+u*(c-l))})(t),r=Date.now()+s;this.ei.push({retryAt:r,requestOptions:e});var n="Enqueued failed request for retry in "+s;navigator.onLine||(n+=" (Browser is offline)"),b.warn(n),this.ai||(this.ai=!0,this.fi())}fi(){if(this.pi&&clearTimeout(this.pi),this.ei.length===0)return this.ai=!1,void(this.pi=void 0);this.pi=setTimeout((()=>{this.li&&this.ei.length>0&&this.ci(),this.fi()}),this.ui)}ci(){var e=Date.now(),t=[],s=this.ei.filter((n=>e>n.retryAt||(t.push(n),!1)));if(this.ei=t,s.length>0)for(var{requestOptions:r}of s)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.pi&&(clearTimeout(this.pi),this.pi=void 0),this.ai=!1,y(v)||(this.hi&&(v.removeEventListener("online",this.hi),this.hi=void 0),this.di&&(v.removeEventListener("offline",this.di),this.di=void 0)),this.ei))try{this._instance._send_request(_({},e,{transport:"sendBeacon"}))}catch(t){b.error(t)}this.ei=[]}}class ml{constructor(e){this.gi=()=>{var t,s,r,n;this.mi||(this.mi={});var a=this.scrollElement(),o=this.scrollY(),l=a?Math.max(0,a.scrollHeight-a.clientHeight):0,c=o+(a?.clientHeight||0),u=a?.scrollHeight||0;this.mi.lastScrollY=Math.ceil(o),this.mi.maxScrollY=Math.max(o,(t=this.mi.maxScrollY)!==null&&t!==void 0?t:0),this.mi.maxScrollHeight=Math.max(l,(s=this.mi.maxScrollHeight)!==null&&s!==void 0?s:0),this.mi.lastContentY=c,this.mi.maxContentY=Math.max(c,(r=this.mi.maxContentY)!==null&&r!==void 0?r:0),this.mi.maxContentHeight=Math.max(u,(n=this.mi.maxContentHeight)!==null&&n!==void 0?n:0)},this._instance=e}get yi(){return this._instance.config.scroll_root_selector}getContext(){return this.mi}resetContext(){var e=this.mi;return setTimeout(this.gi,0),e}startMeasuringScrollPosition(){J(v,"scroll",this.gi,{capture:!0}),J(v,"scrollend",this.gi,{capture:!0}),J(v,"resize",this.gi)}scrollElement(){if(!this.yi)return v?.document.documentElement;var e=q(this.yi)?this.yi:[this.yi];for(var t of e){var s=v?.document.querySelector(t);if(s)return s}}scrollY(){if(this.yi){var e=this.scrollElement();return e&&e.scrollTop||0}return v&&(v.scrollY||v.pageYOffset||v.document.documentElement.scrollTop)||0}scrollX(){if(this.yi){var e=this.scrollElement();return e&&e.scrollLeft||0}return v&&(v.scrollX||v.pageXOffset||v.document.documentElement.scrollLeft)||0}}var yl=i=>ya(i?.config.mask_personal_data_properties,i?.config.custom_personal_data_properties);class Wr{constructor(e,t,s,r){this.bi=n=>{var a=this.wi();if(!a||a.sessionId!==n){var o={sessionId:n,props:this.xi(this._instance)};this.Si.register({[Os]:o})}},this._instance=e,this.ki=t,this.Si=s,this.xi=r||yl,this.ki.onSessionId(this.bi)}wi(){return this.Si.props[Os]}getSetOnceProps(){var e,t=(e=this.wi())==null?void 0:e.props;return t?"r"in t?ba(t):{$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(){var e={};return B(sr(this.getSetOnceProps()),((t,s)=>{s==="$current_url"&&(s="url"),e["$session_entry_"+hs(s)]=t})),e}}class ur{constructor(){this.Ci={}}on(e,t){return this.Ci[e]||(this.Ci[e]=[]),this.Ci[e].push(t),()=>{this.Ci[e]=this.Ci[e].filter((s=>s!==t))}}emit(e,t){for(var s of this.Ci[e]||[])s(t);for(var r of this.Ci["*"]||[])r(e,t)}}var es=W("[SessionId]");class Yr{on(e,t){return this.Ii.on(e,t)}constructor(e,t,s){var r;if(this.Ti=null,this.Ei=[],this.Mi=void 0,this.Ii=new ur,this.Ri=(c,u)=>
1!(!Re(c)||!Re(u))&&Math.abs(c-u)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===qe)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qt=e.config,this.Si=e.persistence,this.Pi=void 0,this.Oi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Li=t||Ue,this.Fi=s||Ue;var n=this.qt.persistence_name||this.qt.token;if(this._sessionTimeoutMs=1e3*$e(this.qt.session_idle_timeout_seconds||1800,60,36e3,es.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Ai(),this.Ni="ph_"+n+"_window_id",this.Di="ph_"+n+"_primary_window_exists",this.$i()){var a=se.F(this.Ni),o=se.F(this.Di);a&&!o?this.Pi=a:se.q(this.Ni),se.N(this.Di,!0)}if((r=this.qt.bootstrap)!=null&&r.sessionID)try{var l=(c=>{var u=this.qt.bootstrap.sessionID.replace(/-/g,"");if(u.length!==32)throw new Error("Not a valid UUID");if(u[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(u.substring(0,12),16)})();this.qi(this.qt.bootstrap.sessionID,new Date().getTime(),l)}catch(c){es.error("Invalid sessionID in bootstrap",c)}this.ji()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return y(this.Ei)&&(this.Ei=[]),this.Ei.push(e),this.Oi&&e(this.Oi,this.Pi),()=>{this.Ei=this.Ei.filter((t=>t!==e))}}$i(){return this.qt.persistence!=="memory"&&!this.Si.Tr&&se.O()}Hi(e){e!==this.Pi&&(this.Pi=e,this.$i()&&se.N(this.Ni,e))}Ui(){return this.Pi?this.Pi:this.$i()?se.F(this.Ni):null}Bi(e){var t=this.Ti;return!_e(t)&&!_e(e)&&5e3>Math.abs(e-t)}qi(e,t,s){var r=t!==this._sessionActivityTimestamp,n=!(e!==this.Oi||s!==this._sessionStartTimestamp);this._sessionStartTimestamp=s,this._sessionActivityTimestamp=t,this.Oi=e,n&&!r||n&&this.Bi(t)||(this.Ti=t,this.Si.register({[ct]:[t,e,s]}))}zi(){var e,t=(e=this.qt)==null?void 0:e.persistence_save_debounce_ms;return Re(t)&&t>0}Vi(){var e;if(!_e(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Ti){this.zi()?this.Si.refreshKey(ct):(this.Si.flush(),this.Si.load());var[,t,s]=this.Wi();t===this.Oi&&s===this._sessionStartTimestamp&&(this.Ti=this._sessionActivityTimestamp,this.Si.register({[ct]:[this._sessionActivityTimestamp,(e=this.Oi)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Si.flush())}}Zi(){var[e]=this.Wi(),t=Re(e)?e:0,s=Re(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,s)}Wi(){var e=this.Si.props[ct];return q(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ti=null,clearTimeout(this.Gi),this.Gi=void 0,this.qi(null,null,null)}destroy(){this.Vi(),clearTimeout(this.Gi),this.Gi=void 0,this.Mi&&v&&(v.removeEventListener(ki,this.Mi,{capture:!1}),this.Mi=void 0),this.Ei=[]}ji(){this.Mi=()=>{this.Vi(),this.$i()&&se.q(this.Di)},J(v,ki,this.Mi,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.qt.cookieless_mode===qe)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var s=t||new Date().getTime(),[,r,n]=this.Wi(),a=this.Zi(),o=this.Ui(),l=Re(n)&&Math.abs(s-n)>864e5,c=!1,u=!r,h=!u&&!e&&this.Ri(s,a);u||h||l?(r=this.Li(),o=this.Fi(),es.info("new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:l}}),n=s,c=!0):o||(o=this.Fi(),c=!0);var d=Re(a)&&e&&!l?a:s,p=Re(n)?n:new Date().getTime();return this.Hi(o),this.qi(r,d,p),e||this.Ai(),c&&this.Ei.forEach((g=>g(r,o,c?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:l}:void 0))),{sessionId:r,windowId:o,sessionStartTimestamp:p,changeReason:c?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:a}}Ai(){clearTimeout(this.Gi),this.Gi=setTimeout((()=>{var e=this.Zi();if(this.Ri(new Date().getTime(),e)){var t=this.Oi;this.resetSessionId(),this.Ii.emit("forcedIdleReset",{idleSessionId:t})}}),1.1*this.sessionTimeoutMs)}}var Ta=function(i,e){if(!i)return!1;var t=i.userAgent;if(t&&yr(t,e))return!0;try{var s=i?.userAgentData;if(s!=null&&s.brands&&s.brands.some((r=>yr(r?.brand,e))))return!0}catch{}return!!i.webdriver},Mi=function(i,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(i)}catch{return!1}};function Xr(i,e,t){return dt({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var Ia={exact:(i,e)=>e.some((t=>i.some((s=>t===s)))),is_not:(i,e)=>e.every((t=>i.every((s=>t!==s)))),regex:(i,e)=>e.some((t=>i.some((s=>Mi(t,s))))),not_regex:(i,e)=>e.every((t=>i.every((s=>!Mi(t,s))))),icontains:(i,e)=>e.map(ni).some((t=>i.map(ni).some((s=>t.includes(s))))),not_icontains:(i,e)=>e.map(ni).every((t=>i.map(ni).every((s=>!t.includes(s))))),gt:(i,e)=>e.some((t=>{var s=parseFloat(t);return!isNaN(s)&&i.some((r=>s>parseFloat(r)))})),lt:(i,e)=>e.some((t=>{var s=parseFloat(t);return!isNaN(s)&&i.some((r=>s<parseFloat(r)))}))},ni=i=>i.toLowerCase();function Ma(i,e){return!i||Object.entries(i).every((t=>{var[s,r]=t,n=e?.[s];if(y(n)||_e(n))return!1;var a=[String(n)],o=Ia[r.operator];return!!o&&o(r.values,a)}))}var zs="custom",Jr="i.posthog.com",bl=/^\/static\//;class wl{constructor(e){this.Qi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Jr,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.Qi[this.apiHost]||(this.Qi[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":zs),this.Qi[this.apiHost]}Ji(e){var t=this.instance.config.__preview_external_dependency_versioned_paths;if(typeof t=="string"&&bl.test(e))return t.trim().replace(/\/$/,"")||void 0}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(e==="flags")return this.flagsApiHost+t;if(e==="assets"){var s=this.Ji(t);if(s)return""+s+t}if(this.region===zs)return this.apiHost+t;var r=Jr+t;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var H=W("[Surveys]"),Gs="seenSurvey_",xl=[Xi.Popover,Xi.Widget,Xi.API],El={ignoreConditions:!1,ignoreDelay:!1,displayType:Ns.Popover}
1,kl=W("[PostHog ExternalIntegrations]"),Sl={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Pl{constructor(e){this._instance=e}lr(e,t){var s;(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,e,(r=>{if(r)return kl.error("failed to load script",r);t()}))}startIfEnabledOrStop(){var e=this,t=function(a){var o,l,c;!r||(o=$.__PosthogExtensions__)!=null&&(o=o.integrations)!=null&&o[a]||e.lr(Sl[a],(()=>{var u;(u=$.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[a])==null||u.start(e._instance)})),!r&&(l=$.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[a]&&((c=$.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[a])==null||c.stop())};for(var[s,r]of Object.entries((n=this._instance.config.integrations)!==null&&n!==void 0?n:{})){var n;t(s)}}}var nt,Ht={},ts=0,Vs=()=>{},Kr='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Ft="Surveys module not available",Zr="sanitize_properties is deprecated. Use before_send instead",Ca="Invalid value for property_denylist config: ",ut="posthog",Oa=!dl&&ce?.indexOf("MSIE")===-1&&ce?.indexOf("Mozilla")===-1,Qr=i=>{var e;return _({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Mo(w?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Vs,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:i??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:ie&&V(ie?.search)&&ie.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(v==null||(e=v.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){b.error("Bad HTTP status: "+t.statusCode+" "+t.text)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:qs,before_send:void 0,request_queue_config:{flush_interval_ms:Bs},error_tracking:{},_onCapture:Vs,__preview_eager_load_replay:!1},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:Uo,ignore_text_selection:!0}
1:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t)}))(i))},Fl=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],en=i=>{var e={};for(var[t,s]of Fl)y(i[t])||(e[s]=i[t]);var r=z({},e,i);return q(i.property_blacklist)&&(y(i.property_denylist)?r.property_denylist=i.property_blacklist:q(i.property_denylist)?r.property_denylist=[...i.property_blacklist,...i.property_denylist]:b.error(Ca+i.property_denylist)),r};class $l{constructor(){this.__forceAllowLocalhost=!1}get Ki(){return this.__forceAllowLocalhost}set Ki(e){b.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class we{Yi(e,t){if(e){var s=this.Xi.indexOf(e);s!==-1&&this.Xi.splice(s,1)}return this.Xi.push(t),t.initialize==null||t.initialize(),t}en(){return this.config.cookieless_mode===qe||this.config.cookieless_mode===Ke&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new $l,this.tn=!1,this.version=Q.LIB_VERSION,this.rn=new ur,this.Xi=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Qr(),this.SentryIntegration=Ko,this.sentryIntegration=s=>(function(r,n){var a=va(r,n);return{name:pa,processEvent:o=>a(o)}})(this,s),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.nn=!1,this.sn=null,this.an=null,this.un=null,this.scrollManager=new ml(this),this.pageViewManager=new qr(this),this.rateLimiter=new al(this),this.requestRouter=new wl(this),this.consent=new Do(this),this.externalIntegrations=new Pl(this);var t=(e=we.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(s,r,n)=>{var a=V(s)?{[s]:r}:s;this.setPersonProperties(a),n?.({})},set_once:(s,r,n)=>{var a=V(s)?{[s]:r}:s;this.setPersonProperties(void 0,a),n?.({})}},this.on("eventCaptured",(s=>b.info('send "'+s?.event+'"',s)))}init(e,t,s){if(s&&s!==ut){var r,n=(r=Ht[s])!==null&&r!==void 0?r:new we;return n._init(e,t,s),Ht[s]=n,Ht[ut][s]=n,n}return this._init(e,t,s)}_init(e,t,s){var r,n;t===void 0&&(t={});var a=V(e)?e.trim():"";if(!a)return b.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.ln(t.debug),this.hn=t,this.cn=[],t.person_profiles?this.an=t.person_profiles:t.process_person&&(this.an=t.process_person);var o=Qr(t.defaults),l=en(t),c=z({},o,l,{name:s,token:a});X(o.rageclick)&&X(l.rageclick)&&(c.rageclick=z({},o.rageclick,l.rageclick)),this.set_config(c),this.config.on_xhr_error&&b.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:Pe.GZipJS;var u=this.dn();this.persistence=new Yi(this.config,u),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Yi(_({},this.config,{persistence:"sessionStorage"}),u,!1);var h=_({},this.persistence.props),d=_({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.vn=new gl((I=>this.fn(I)),this.config.request_queue_config),this.pn=new _l(this),this.__request_queue=[];var p=this.en();if(p||(this.sessionManager=new Yr(this),this.sessionPropsManager=new Wr(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(b.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.gn(p)}),0)):(b.info("Initializing extensions synchronously"),this.gn(p)),Q.DEBUG=Q.DEBUG||this.config.debug,Q.DEBUG&&b.info("Starting in debug mode",{this:this,config:t,thisC:_({},this.config),p:h,s:d}),!this.config.identity_distinct_id||(r=t.bootstrap)!=null&&r.distinctID||(t.bootstrap=_({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((n=t.bootstrap)==null?void 0:n.distinctID)!==void 0){var g=t.bootstrap.distinctID,f=this.get_distinct_id(),T=this.persistence.get_property(ke);if(t.bootstrap.isIdentifiedID&&f!=null&&f!==g&&T===tt)this.identify(g);else if(t.bootstrap.isIdentifiedID&&f!=null&&f!==g&&T===it)b.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");
1else{var P=this.config.get_device_id(Ue()),R=t.bootstrap.isIdentifiedID?P:g;this.persistence.set_property(ke,t.bootstrap.isIdentifiedID?it:tt),this.register({distinct_id:g,$device_id:R})}}if(p)this.register_once({distinct_id:Qt,$device_id:null},"");else if(!this.get_distinct_id()){var C=this.config.get_device_id(Ue());this.register_once({distinct_id:C,$device_id:C},""),this.persistence.set_property(ke,tt)}return J(v,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?(function(I,E){var F=I.config.segment;if(!F)return E();(function(k,x){var m=k.config.segment;if(!m)return x();var S=L=>{var A=()=>L.anonymousId()||Ue();k.config.get_device_id=A,L.id()&&(k.register({distinct_id:L.id(),$device_id:A()}),k.persistence.set_property(ke,it)),x()},M=m.user();"then"in M&&Le(M.then)?M.then(S):S(M)})(I,(()=>{F.register((k=>{Promise&&Promise.resolve||Wi.warn("This browser does not have Promise support, and can not use the segment integration");var x=(m,S)=>{if(!S)return m;m.event.userId||m.event.anonymousId===k.get_distinct_id()||(Wi.info("No userId set, resetting PostHog"),k.reset()),m.event.userId&&m.event.userId!==k.get_distinct_id()&&(Wi.info("UserId set, identifying with PostHog"),k.identify(m.event.userId));var M=k.calculateEventProperties(S,m.event.properties);return m.event.properties=Object.assign({},M,m.event.properties),m};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:m=>x(m,m.event.event),page:m=>x(m,lt),identify:m=>x(m,zi),screen:m=>x(m,"$screen")}})(I)).then((()=>{E()}))}))})(this,(()=>this.mn())):this.mn(),Le(this.config._onCapture)&&this.config._onCapture!==Vs&&(b.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(I=>this.config._onCapture(I.event,I)))),this.config.ip&&b.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}gn(e){var t,s,r,n,a,o,l,c=performance.now(),u=_({},we.__defaultExtensionClasses,this.config.__extensionClasses),h=[];u.featureFlags&&this.Xi.push(this.featureFlags=(t=this.featureFlags)!==null&&t!==void 0?t:new u.featureFlags(this)),u.exceptions&&this.Xi.push(this.exceptions=(s=this.exceptions)!==null&&s!==void 0?s:new u.exceptions(this)),u.historyAutocapture&&this.Xi.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.Xi.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.Xi.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this.Xi.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.Xi.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.Xi.push(this.surveys=(r=this.surveys)!==null&&r!==void 0?r:new u.surveys(this)),u.logs&&this.Xi.push(this.logs=(n=this.logs)!==null&&n!==void 0?n:new u.logs(this)),u.conversations&&this.Xi.push(this.conversations=(a=this.conversations)!==null&&a!==void 0?a:new u.conversations(this)),u.productTours&&this.Xi.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.Xi.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.Xi.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.Xi.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.Xi.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Jo)),u.toolbar&&this.Xi.push(this.toolbar=(o=this.toolbar)!==null&&o!==void 0?o:new u.toolbar(this)),u.experiments&&this.Xi.push(this.experiments=(l=this.experiments)!==null&&l!==void 0?l:new u.experiments(this)),this.Xi.forEach((d=>{d.initialize&&h.push((()=>{d.initialize==null||d.initialize()}))})),h.push((()=>{if(this.yn){var d=this.yn;this.yn=void 0,this.Qr(d)}})),this.bn(h,c)}bn(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout((()=>{this.bn(e,t)}),0);var s=e.shift();if(s)try{s()}catch(n){b.error("Error initializing extension:",n)}}
1var r=Math.round(performance.now()-t);this.register_for_session({[Kn]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Zn]:r}),this.config.__preview_deferred_init_extensions&&b.info("PostHog extensions initialized ("+r+"ms)")}Qr(e){var t;if(!w||!w.body)return b.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Qr(e)}),500);this.config.__preview_deferred_init_extensions&&(this.yn=e),this._n=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=O(e.supportedCompression,Pe.GZipJS)?Pe.GZipJS:O(e.supportedCompression,Pe.Base64)?Pe.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.an?this.an:qs}),this.Xi.forEach((s=>s.onRemoteConfig==null?void 0:s.onRemoteConfig(e)))}mn(){try{this.config.loaded(this)}catch(s){b.critical("`loaded` function failed",s)}if(this.wn(),this.config.internal_or_test_user_hostname&&ie!=null&&ie.hostname){var e=ie.hostname,t=this.config.internal_or_test_user_hostname;(typeof t=="string"?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.en())&&this.xn()}),1),this.Sn=new xa(this),this.Sn.load()}wn(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.vn)==null||e.enable())}_dom_loaded(){this.is_capturing()&&ei(this.__request_queue,(e=>this.fn(e))),this.__request_queue=[],this.wn()}_handle_unload(){var e,t,s,r;(e=this.surveys)==null||e.handlePageUnload(),this.config.request_batching?(this.kn()&&this.capture(Bi),(t=this.logs)==null||t.flushLogs("sendBeacon"),(s=this.vn)==null||s.unload(),(r=this.pn)==null||r.unload()):this.kn()&&this.capture(Bi,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Oa?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Ri(e.url,{ip:this.config.ip?1:0}),e.headers=_({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var s,r,n,a=_({},t);a.timeout=a.timeout||6e4,a.url=Vr(a.url,a.compression);var o=(s=a.transport)!==null&&s!==void 0?s:"fetch",l=hi.filter((u=>!a.disableTransport||!u.transport||!a.disableTransport.includes(u.transport))),c=(r=(n=(function(u,h){for(var d=0;u.length>d;d++)if(u[d].transport===o)return u[d]})(l))==null?void 0:n.method)!==null&&r!==void 0?r:l[0].method;if(!c)throw new Error("No available transport method");o!=="sendBeacon"&&a.data&&a.compression===Pe.GZipJS&&Na&&!ci?vl(a).then((u=>{c(u)})).catch((u=>{if(mr(u))return ci=!0,void c(_({},a,{compression:void 0,url:Vr(t.url,void 0)}));(h=>{if(!h||typeof h!="object")return!1;var d="name"in h?String(h.name):"";return mr(h)||d===_n})(u)&&(ci=!0),c(a)})):c(a)})(_({},e,{callback:t=>{var s,r;this.rateLimiter.checkForLimiting(t),400>t.statusCode||(s=(r=this.config).on_request_error)==null||s.call(r,t),e.callback==null||e.callback(t)}}))))}fn(e){this.pn?this.pn.retriableRequest(e):this._send_request(e)}_execute_array(e){ts++;try{var t,s=[],r=[],n=[];ei(e,(o=>{if(o)if(q(t=o[0]))n.push(o);else if(Le(o))try{o.call(this)}catch(l){b.error("Error executing queued PostHog call",o,l)}else q(o)&&t==="alias"?s.push(o):q(o)&&t.indexOf("capture")!==-1&&Le(this[t])?n.push(o):r.push(o)}));var a=function(o,l){ei(o,(function(c){try{if(q(c[0])){var u=l;B(c,(function(h){u=u[h[0]].apply(u,h.slice(1))}))}else l[c[0]].apply(l,c.slice(1))}catch(h){b.error("Error executing queued PostHog call",c,h)}}))};a(s,this),a(r,this),a(n,this)}finally{ts--}}push(e){if(ts>0&&q(e)&&V(e[0])){var t=we.prototype[e[0]];Le(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,s){var r,n,a,o,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.vn){if(this.is_capturing())if(!y(e)&&V(e)){var c=!this.config.opt_out_useragent_filter&&this._is_bot();if(!c||this.config.__preview_capture_bot_pageviews){var u=s!=null&&s.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(u==null||!u.isRateLimited){t!=null&&t.$current_url&&!V(t?.$current_url)&&(b.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),e!=="$exception"||s!=null&&s.Cn||b.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var h=new Date,d=s?.timestamp||h,p=s?.uuid||Ue(),g={uuid:p,event:e,properties:this.calculateEventProperties(e,t||{},d,p)};e===lt&&this.config.__preview_capture_bot_pageviews&&c&&(g.event="$bot_pageview",g.properties.$browser_type="bot"),u&&(g.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),s?.$set&&(g.$set=s?.$set);var f,T,P,R=this.In(s?.$set_once,e!==Pr,e===zi);if(R&&(g.$set_once=R),s!=null&&s._noTruncate||(n=this.config.properties_string_max_length,a=g,o=m=>V(m)?m.slice(0,n):m,l=new Set,g=(function m(S,M){return S!==Object(S)?o?o(S):S:l.has(S)?void 0:(l.add(S),q(S)?(L=[],ei(S,(A=>{L.push(m(A))}))):(L={},B(S,((A,N)=>{l.has(A)||(L[N]=m(A))}))),L);var L})(a)),g.timestamp=d,y(s?.timestamp)||(g.properties.$event_time_override_provided=!0,g.properties.$event_time_override_system_time=h),e===At.DISMISSED||e===At.SENT){var 
1C=t?.[Ji.SURVEY_ID],I=t?.[Ji.SURVEY_ITERATION];(m=>{try{var S=(M=>((L,A)=>{var N=""+Gs+A.id;return A.current_iteration&&A.current_iteration>0&&(N=""+Gs+A.id+"_"+A.current_iteration),N})(0,M))(m);if(localStorage.getItem(S))return;localStorage.setItem(S,"true")}catch(M){H.error("Failed to persist survey seen state",M)}})({id:C,current_iteration:I}),g.$set=_({},g.$set,{[(f={id:C,current_iteration:I},T=e===At.SENT?"responded":"dismissed",P="$survey_"+T+"/"+f.id,f.current_iteration&&f.current_iteration>0&&(P="$survey_"+T+"/"+f.id+"/"+f.current_iteration),P)]:!0})}else e===At.SHOWN&&(g.$set=_({},g.$set,{[Ji.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===nl.SHOWN){var E=t?.[Nr.TOUR_TYPE];E&&(g.$set=_({},g.$set,{[Nr.TOUR_LAST_SEEN_DATE+"/"+E]:new Date().toISOString()}))}var F=_({},g.properties.$set,g.$set);if(Be(F)||this.setPersonPropertiesForFlags(F),!D(this.config.before_send)){var k=this.Tn(g);if(!k)return;g=k}this.rn.emit("eventCaptured",g);var x={method:"POST",url:(r=s?._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:g,compression:"best-available",batchKey:s?._batchKey,transport:s?.transport};return!this.config.request_batching||s&&(s==null||!s._batchKey)||s!=null&&s.send_instantly?this.fn(x):this.vn.enqueue(x),g}b.critical("This capture call is ignored due to client rate limiting.")}}else b.error("No event name provided to posthog.capture")}else b.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,s,r,n){if(s=s||new Date,!this.persistence||!this.sessionPersistence)return t;var a=n?void 0:this.persistence.remove_event_timer(e),o=_({},t);if(o.token=this.config.token,o.$config_defaults=this.config.defaults,this.en()&&(o.$cookieless_mode=!0),e==="$snapshot"){var l=_({},this.persistence.properties(),this.sessionPersistence.properties());return o.distinct_id=l.distinct_id,(!V(o.distinct_id)&&!oe(o.distinct_id)||ds(o.distinct_id))&&b.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),o}var c,u=(function(P,R){var C,I,E,F;if(!ce)return{};var k,x,m,S,M,L,A,N,j,ee=P?[...mt,...R||[]]:[],[de,le]=(function(ne){for(var Se=0;xr.length>Se;Se++){var[ye,ae]=xr[Se],ue=ye.exec(ne),Ie=ue&&(Le(ae)?ae(ue,ne):ae);if(Ie)return Ie}return["",""]})(ce),K=(k=typeof navigator<"u"?navigator:void 0)!=null&&k.brave?{brave:!0}:{},pe=z(sr({$os:de,$os_version:le,$browser:Nn(ce,navigator.vendor,K),$device:Er(ce),$device_type:(m=ce,S={userAgentDataPlatform:(C=navigator)==null||(C=C.userAgentData)==null?void 0:C.platform,maxTouchPoints:(I=navigator)==null?void 0:I.maxTouchPoints,screenWidth:v==null||(E=v.screen)==null?void 0:E.width,screenHeight:v==null||(F=v.screen)==null?void 0:F.height,devicePixelRatio:v?.devicePixelRatio},j=Er(m),j===xn||j===wn||j==="Kobo"||j==="Kindle Fire"||j===An?gt:j===Ut||j===vt||j===Bt||j===vs?"Console":j===kn?"Wearable":j?me:S?.userAgentDataPlatform==="Android"&&((M=S?.maxTouchPoints)!==null&&M!==void 0?M:0)>0?600>Math.min((L=S?.screenWidth)!==null&&L!==void 0?L:0,(A=S?.screenHeight)!==null&&A!==void 0?A:0)/((N=S?.devicePixelRatio)!==null&&N!==void 0?N:1)?me:gt:"Desktop"),$timezone:wa(),$timezone_offset:il()}),{$current_url:Wt(ie?.href,ee,Yt),$host:ie?.host,$pathname:ie?.pathname,$raw_user_agent:ce.length>1e3?ce.substring(0,997)+"...":ce,$browser_version:io(ce,navigator.vendor,K),$browser_language:Dr(),$browser_language_prefix:(x=Dr(),typeof x=="string"?x.split("-")[0]:void 0),$screen_height:v?.screen.height,$screen_width:v?.screen.width,$viewport_height:v?.innerHeight,$viewport_width:v?.innerWidth,$lib:Q.LIB_NAME,$lib_version:Q.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return Q.SDK_DIST_CHANNEL&&(pe.$sdk_dist_channel=Q.SDK_DIST_CHANNEL),pe})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId(n,s.getTime());o.$session_id=h,o.$window_id=d}this.sessionPropsManager&&z(o,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&z(o,this.sessionRecording.sdkDebugProperties),o.$sdk_debug_retry_queue_size=(p=this.pn)==null?void 0:p.length}catch(P){o.$sdk_debug_error_capturing_properties=String(P)}if(this.requestRouter.region===zs&&(o.$lib_custom_api_host=this.config.api_host),c=e!==lt||n?e!==Bi||n?this.pageViewM
1anager.doEvent():this.pageViewManager.doPageLeave(s):this.pageViewManager.doPageView(s,r),o=z(o,c),e===lt&&w&&(o.title=w.title),!y(a)){var g=s.getTime()-a;o.$duration=parseFloat((g/1e3).toFixed(3))}ce&&this.config.opt_out_useragent_filter&&(o.$browser_type=this._is_bot()?"bot":"browser"),(o=z({},u,this.persistence.properties(),this.sessionPersistence.properties(),o)).$is_identified=this._isIdentified(),q(this.config.property_denylist)?B(this.config.property_denylist,(function(P){delete o[P]})):b.error(Ca+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var f=this.config.sanitize_properties;f&&(b.error(Zr),o=f(o,e));var T=this.En();return o.$process_person_profile=T,T&&!n&&this.Mn("_calculate_event_properties"),o}In(e,t,s){var r;if(t===void 0&&(t=!0),s===void 0&&(s=!1),!this.persistence||!this.En()||this.tn&&!s)return e;var n=this.persistence.get_initial_props(),a=(r=this.sessionPropsManager)==null?void 0:r.getSetOnceProps(),o=z({},n,a||{},e||{}),l=this.config.sanitize_properties;return l&&(b.error(Zr),o=l(o,"$set_once")),t&&(this.tn=!0),Be(o)?void 0:o}register(e,t){var s;(s=this.persistence)==null||s.register(e,t)}register_once(e,t,s){var r;(r=this.persistence)==null||r.register_once(e,t,s)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}Rn(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return(t=this.featureFlags)==null?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var s;return(s=this.featureFlags)==null?void 0:s.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){var s;return(s=this.featureFlags)==null?void 0:s.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,t,s){var r;(r=this.featureFlags)==null||r.updateFlags(e,t,s)}updateEarlyAccessFeatureEnrollment(e,t,s){var r;(r=this.featureFlags)==null||r.updateEarlyAccessFeatureEnrollment(e,t,s)}getEarlyAccessFeatures(e,t,s){var r;return t===void 0&&(t=!1),(r=this.featureFlags)==null?void 0:r.getEarlyAccessFeatures(e,t,s)}on(e,t){return this.rn.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:Ft}),()=>{})}onSessionId(e){var t,s;return(t=(s=this.sessionManager)==null?void 0:s.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:Ft})}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:Ft})}renderSurvey(e,t){var s;(s=this.surveys)==null||s.renderSurvey(e,t)}displaySurvey(e,t){var s;t===void 0&&(t=El),(s=this.surveys)==null||s.displaySurvey(e,t)}cancelPendingSurvey(e){var t;(t=this.surveys)==null||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,s;return(t=(s=this.surveys)==null?void 0:s.canRenderSurvey(e))!==null&&t!==void 0?t:{visible:!1,disabledReason:Ft}}canRenderSurveyAsync(e,t){var s,r;return t===void 0&&(t=!1),(s=(r=this.surveys)==null?void 0:r.canRenderSurveyAsync(e,t))!==null&&s!==void 0?s:Promise.resolve({visible:!1,disabledReason:Ft})}Pn(e){return!e||ds(e)?(b.critical("Unique user id has not been set in posthog.identify"),!1):e===Qt?(b.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(b.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,t,s){if(!this.__loaded||!this.persistence)return b.uninitializedWarning("posthog.identify");if(oe(e)&&(e=e.toString(),b.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Pn(e)&&this.Mn("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:e}),this.get_property(bi)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),e!==r&&e!==this.get_property(Mt)&&(this.unregister(Mt),this.register({distinct_id:e}));var n,a=(this.persistence.get_property(ke)||tt)===tt;e!==r&&a?(this.persistence.set_property(ke,it),this.setPersonPropertiesForFlags({$set:t||{},$set_once:s||{}},!1),this.capture(zi,{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:s||{}}),this.un=Xr(e,t,s),(n=this.featureFlags)==null||n.setAnonymousDistinctId(r)):(t||s)&&this.setPersonProperties(t,s),e!==r&&(this.reloadFeatureFlags(),this.unregister(Dt))}}setPersonProperties(e,t){if((e||t)&&this.Mn("posthog.setPersonProperties")){var s=Xr(this.get_distinct_id(),e,t);this.un!==s?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.un=s):b.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,s){if(e&&t){var r=this.getGroups(),n=r[e]!==t;if(n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:_({},r,{[e]:t})}),n||s){var a={$group_type:e,$group_key:t};s&&(a.$group_set=s),this.capture(Pr,a)}s&&this.setGroupPropertiesForFlags({[e]:s}),n&&!s&&this.reloadFeatureFlags()}else b.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var s;
1t===void 0&&(t=!0),(s=this.featureFlags)==null||s.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){var e;(e=this.featureFlags)==null||e.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){var s;t===void 0&&(t=!0),this.Mn("posthog.setGroupPropertiesForFlags")&&((s=this.featureFlags)==null||s.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;(t=this.featureFlags)==null||t.resetGroupPropertiesForFlags(e)}reset(e){var t,s,r,n,a,o,l,c;if(b.info("reset"),!this.__loaded)return b.uninitializedWarning("posthog.reset");var u,h=this.get_property(bi),d=this.get_property(Ze);if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(s=this.sessionPersistence)==null||s.clear(),y(d)||(u=this.persistence)==null||u.register({[Ze]:d}),(r=this.surveys)==null||r.reset(),(n=this.Sn)==null||n.stop(),(a=this.featureFlags)==null||a.reset(),(o=this.conversations)==null||o.reset(),(l=this.persistence)==null||l.set_property(ke,tt),(c=this.sessionManager)==null||c.resetSessionId(),this.un=null,this.config.cookieless_mode===qe)this.register_once({distinct_id:Qt,$device_id:null},"");else{var p=this.config.get_device_id(Ue());this.register_once({distinct_id:p,$device_id:e?p:h},"")}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var s;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),(s=this.conversations)==null||s.On()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.Ln()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:s}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&s){var n,a=(n=e.timestampLookBack)!==null&&n!==void 0?n:10;if(!s)return r;r+="?t="+Math.max(Math.floor((new Date().getTime()-s)/1e3)-a,0)}return r}alias(e,t){return e===this.get_property(Gn)?(b.critical("Attempting to create alias for existing People user - aborting."),-2):this.Mn("posthog.alias")?(y(t)&&(t=this.get_distinct_id()),e!==t?(this.Rn(Mt,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(b.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=_({},this.config);if(X(e)){var s,r,n,a,o,l,c,u,h,d,p;z(this.config,en(e));var g=this.dn();(s=this.persistence)==null||s.update_config(this.config,t,g),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Yi(_({},this.config,{persistence:"sessionStorage"}),g,!1);var f=this.ln(this.config.debug);Te(f)&&(this.config.debug=f),Te(this.config.debug)&&(this.config.debug?(Q.DEBUG=!0,U.O()&&U.N("ph_debug",!0),b.info("set_config",{config:e,oldConfig:t,newConfig:_({},this.config)})):(Q.DEBUG=!1,U.O()&&U.q("ph_debug"))),(r=this.exceptionObserver)==null||r.onConfigChange(),(n=this.exceptions)==null||n.onConfigChange(),(a=this.sessionRecording)==null||a.startIfEnabledOrStop(),(o=this.tracingHeaders)==null||o.startIfEnabledOrStop(),(l=this.autocapture)==null||l.startIfEnabled(),(c=this.heatmaps)==null||c.startIfEnabled(),(u=this.exceptionObserver)==null||u.startIfEnabledOrStop(),(h=this.deadClicksAutocapture)==null||h.startIfEnabledOrStop(),(d=this.surveys)==null||d.loadIfEnabled(),this.Fn(),(p=this.externalIntegrations)==null||p.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){Q.LIB_NAME=e,Q.LIB_VERSION=t}startSessionRecording(e){var t,s,r,n,a,o=e===!0,l={sampling:o||!(e==null||!e.sampling),linked_flag:o||!(e==null||!e.linked_flag),url_trigger:o||!(e==null||!e.url_trigger),event_trigger:o||!(e==null||!e.event_trigger)};Object.values(l).some(Boolean)&&((t=this.sessionManager)==null||t.checkAndGetSessionAndWindowId(),l.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),l.linked_flag&&((r=this.sessionRecording)==null||r.overrideLinkedFlag()),l.url_trigger&&((n=this.sessionRecording)==null||n.overrideTrigger("url")),l.event_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){if(this.exceptions){var s=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:s});return this.exceptions.sendExceptionEvent(_({},r,t))}}addExceptionStep(e,t){var s;(s=this.exceptions)==null||s.addExceptionStep(e,t)}captureLog(e){var t;(t=this.logs)==null||t.captureLog(e)}get logger(){var e,t;return(e=(t=this.logs)==null?void 0:t.logger)!==null&&e!==void 0?e:we.An}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,s;return(t=(s=this.toolbar)==null?void 0:s.loadToolbar(e))!==null&&t!==void 0&&t}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:ut;return t!==ut&&(t=ut+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(ke))===it||((t=this.sessionPersistence)==null?void 0:t.get_property(ke))===it}En(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles===qs&&!this._isIdentified()&&Be(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Mt])&&((t=this.persistence)==null||(t=t.props)==null||!t[xi]))}kn(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.En()||this.Mn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Mn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Mn(e){return this.config.person_profiles==="never"?(b.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Rn(xi,!0),!0)}dn(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Ke)}Fn(){var e,t,s,r,n=this.dn();return((e=this.persistence)==null?void 0:e.Tr)!==n&&((s=this.persistence)==null||s.set_disabled(n)),((t=this.sessionPersistence)==null?void 0:t.Tr)!==n&&((r=this.sessionPersistence)==null||r.set_disabled(n)),n}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==qe){if(this.en()){var s,r,n,a,o;this.reset(!0),(s=this.sessionManager)==null||s.destroy(),(r=this.pageViewM
1anager)==null||r.destroy(),this.sessionManager=new Yr(this),this.pageViewManager=new qr(this),this.persistence&&(this.sessionPropsManager=new Wr(this,this.sessionManager,this.persistence));var l,c=(n=(a=this.config.__extensionClasses)==null?void 0:a.sessionRecording)!==null&&n!==void 0?n:(o=we.__defaultExtensionClasses)==null?void 0:o.sessionRecording;c&&(this.sessionRecording=this.Yi(this.sessionRecording,new c(this)),this._n&&((l=this.sessionRecording)==null||l.onRemoteConfig==null||l.onRemoteConfig(this._n)))}var u,h;this.consent.optInOut(!0),this.Fn(),this.wn(),(t=this.sessionRecording)==null||t.startIfEnabledOrStop(),this.config.cookieless_mode==Ke&&((u=this.surveys)==null||u.loadIfEnabled()),(y(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((h=e?.captureEventName)!==null&&h!==void 0?h:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.xn()}else b.warn(Kr)}opt_out_capturing(){var e,t,s;this.config.cookieless_mode!==qe?(this.config.cookieless_mode===Ke&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Fn(),this.config.cookieless_mode===Ke&&(this.register({distinct_id:Qt,$device_id:null}),(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,(t=this.sessionManager)==null||t.destroy(),(s=this.pageViewManager)==null||s.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.xn(),this.wn())):b.warn(Kr)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===qe||(this.config.cookieless_mode===Ke?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Fn()}_is_bot(){return ge?Ta(ge,this.config.custom_blocked_useragents):void 0}xn(){w&&(w.visibilityState==="visible"?this.nn||(this.nn=!0,this.capture(lt,{title:w.title},{send_instantly:!0}),this.sn&&(w.removeEventListener(Ei,this.sn),this.sn=null)):this.sn||(this.sn=this.xn.bind(this),J(w,Ei,this.sn)))}debug(e){e===!1?(v?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(v?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Kr(){var e,t,s,r,n,a,o=this.hn||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(b.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):(s="advanced_disable_decide",r=b,n=(t="advanced_disable_flags")in(e=o)&&!D(e[t]),a=s in e&&!D(e[s]),n?e[t]:!!a&&(r&&r.warn("Config field '"+s+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[s]))}Tn(e){if(D(this.config.before_send))return e;var t=q(this.config.before_send)?this.config.before_send:[this.config.before_send],s=e;for(var r of t){if(s=r(s),D(s)){var n="Event '"+e.event+"' was rejected in beforeSend function";return za(e.event)?b.warn(n+". This can cause unexpected behavior."):b.info(n),null}s.properties&&!Be(s.properties)||b.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return s}getPageViewId(){var e;return(e=this.pageViewManager.dr)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,s){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(s)})}ln(e){var t=Te(e)&&!e,s=U.O()&&U.A("ph_debug")==="true";return!t&&(!!s||e)}}we.__defaultExtensionClasses={},we.An={trace:nt=()=>{},debug:nt,info:nt,warn:nt,error:nt,fatal:nt},(function(i,e){for(var t=0;e.length>t;t++)i.prototype[e[t]]=To(i.prototype[e[t]])})(we,["identify"]);class tn{constructor(e){this.disabled=e===!1;var t=X(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,s){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<this.thresholdPx&&this.timeoutMs>s-r.timestamp){if(this.clicks.push({x:e,y:t,timestamp:s}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:s}];return!1}}var is="$copy_autocapture",ss=W("[AutoCapture]");function rs(i,e){return e.length>i?e.slice(0,i)+"...":e}function Tl(i){if(i.previousElementSibling)return i.previousElementSibling;var e=i;do e=e.previousSibling;while(e&&!ze(e));return e}function Il(i,e){var t,s,{e:r,maskAllElementAttributes:n,maskAllText:a,elementAttributeIgnoreList:o,elementsC
1hainAsString:l}=e;if(!ze(i))return{props:{}};for(var c=[i],u=i;u.parentNode&&!fe(u,"body");)if(sa(u.parentNode))c.push(u.parentNode.host),u=u.parentNode.host;else{if(!ze(u.parentNode))break;c.push(u.parentNode),u=u.parentNode}var h,d,p=[],g={},f=!1,T=!1;if(B(c,(E=>{var F=Ds(E);if(fe(E,"a")){var k=E.getAttribute("href");f=F&&!!k&&Nt(k)&&k}O(Pi(E),"ph-no-capture")&&(T=!0),p.push((function(m,S,M,L){var A=m.tagName.toLowerCase(),N={tag_name:A};nr.indexOf(A)>-1&&!M&&(N.$el_text=A.toLowerCase()==="a"||A.toLowerCase()==="button"?rs(1024,Rr(m)):rs(1024,Gt(m)));var j=Pi(m);j.length>0&&(N.classes=j.filter((function(K){return K!==""}))),B(m.attributes,(function(K){var pe;if((!ua(m)||["name","id","class","aria-label"].indexOf(K.name)!==-1)&&(L==null||!L.includes(K.name))&&!S&&Nt(K.value)&&(!V(pe=K.name)||pe.substring(0,10)!=="_ngcontent"&&pe.substring(0,7)!=="_nghost")){var ne=K.value;K.name==="class"&&(ne=rr(ne).join(" ")),N["attr__"+K.name]=rs(1024,ne)}}));for(var ee=1,de=1,le=m;le=Tl(le);)ee++,le.tagName===m.tagName&&de++;return N.nth_child=ee,N.nth_of_type=de,N})(E,n,a,o));var x=(function(m){if(!Ds(m))return{};var S={};return B(m.attributes,(function(M){if(M.name&&M.name.indexOf("data-ph-capture-attribute")===0){var L=M.name.replace("data-ph-capture-attribute-",""),A=M.value;L&&A&&Nt(A)&&(S[L]=A)}})),S})(E);z(g,x)})),T)return{props:{},explicitNoCapture:T};if(a||(p[0].$el_text=fe(i,"a")||fe(i,"button")?Rr(i):Gt(i)),f){var P,R;p[0].attr__href=f;var C=(P=Fi(f))==null?void 0:P.host,I=v==null||(R=v.location)==null?void 0:R.host;C&&I&&C!==I&&(h=f)}return{props:z({$event_type:r.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:(d=p,(function(E){return E.map((F=>{var k,x,m="";if(F.tag_name&&(m+=F.tag_name),F.attr_class)for(var S of(F.attr_class.sort(),F.attr_class))m+="."+S.replace(/"/g,"");var M=_({},F.text?{text:F.text}:{},{"nth-child":(k=F.nth_child)!==null&&k!==void 0?k:0,"nth-of-type":(x=F.nth_of_type)!==null&&x!==void 0?x:0},F.href?{href:F.href}:{},F.attr_id?{attr_id:F.attr_id}:{},F.attributes),L={};return ui(M).sort(((A,N)=>{var[j]=A,[ee]=N;return j.localeCompare(ee)})).forEach((A=>{var[N,j]=A;return L[Ar(N.toString())]=Ar(j.toString())})),(m+=":")+ui(L).map((A=>{var[N,j]=A;return N+'="'+j+'"'})).join("")})).join(";")})((function(E){return E.map((F=>{var k,x,m={text:(k=F.$el_text)==null?void 0:k.slice(0,400),tag_name:F.tag_name,href:(x=F.attr__href)==null?void 0:x.slice(0,2048),attr_class:Yo(F),attr_id:F.attr__id,nth_child:F.nth_child,nth_of_type:F.nth_of_type,attributes:{}};return ui(F).filter((S=>{var[M]=S;return M.indexOf("attr__")===0})).forEach((S=>{var[M,L]=S;return m.attributes[M]=L})),m}))})(d)))},(t=p[0])!=null&&t.$el_text?{$el_text:(s=p[0])==null?void 0:s.$el_text}:{},h&&r.type==="click"?{$external_click_url:h}:{},g)}}var $t=W("[ExceptionAutocapture]");function sn(i,e,t){try{if(!(e in i))return()=>{};var s=i[e],r=t(s);return Le(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),i[e]=r,()=>{i[e]===r&&(i[e]=s)}}catch{return()=>{}}}var Ml=W("[TracingHeaders]"),We=W("[Web Vitals]"),rn=9e5,nn="disabled",an="lazy_loading",Tt="awaiting_config",ai="missing_config";W("[SessionRecording]"),W("[SessionRecording]");var Ws="[SessionRecording]",Ce=W(Ws),Cl=W("[Heatmaps]");function on(i){return X(i)&&"clientX"in i&&"clientY"in i&&oe(i.clientX)&&oe(i.clientY)}var ln=W("[Product Tours]"),Ol=["$set_once","$set"],He=W("[SiteApps]"),un="Error while initializing PostHog app with config id ";function at(i,e,t){if(D(i))return!1;switch(t){case"exact":return i===e;case"contains":var s=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(s,"i").test(i);case"regex":try{return new RegExp(e).test(i)}catch{return!1}default:return!1}}class Rl{constructor(e){this.Nn=new ur,this.Dn=(t,s)=>this.$n(t,s)&&this.qn(t,s)&&this.jn(t,s)&&this.Hn(t,s),this.$n=(t,s)=>s==null||!s.event||t?.event===s?.event,this._instance=e,this.Un=new Set,this.Bn=new Set}init(){var e,t;y((e=this._instance)==null?void 0:e._addCaptureHook)||(t=this._instance)==null||t._addCaptureHook(((s,r)=>{this.on(s,r)}))}register(e){var t,s;if(!y((t=this._instance)==null?void 0:t._addCaptureHook)&&(e.forEach((a=>{var o,l;(o=this.Bn)==null||o.add(a),(l=a.steps)==null||l.forEach((c=>{var u;(u=this.Un)==null||u.add(c?.event||"")}))})),(s=this._instance)!=null&&s.autocapture)){var r,n=new Set;e.forEach((a=>{var o;(o=a.steps)==null||o.forEach((l=>{l!=null&&l.selector&&n.add(l?.selector)}))}
1)),(r=this._instance)==null||r.autocapture.setElementSelectors(n)}}on(e,t){var s;t!=null&&e.length!=0&&(this.Un.has(e)||this.Un.has(t?.event))&&this.Bn&&((s=this.Bn)==null?void 0:s.size)>0&&this.Bn.forEach((r=>{this.zn(t,r)&&this.Nn.emit("actionCaptured",r.name)}))}Vn(e){this.onAction("actionCaptured",(t=>e(t)))}zn(e,t){if(t?.steps==null)return!1;for(var s of t.steps)if(this.Dn(e,s))return!0;return!1}onAction(e,t){return this.Nn.on(e,t)}qn(e,t){if(t!=null&&t.url){var s,r=e==null||(s=e.properties)==null?void 0:s.$current_url;if(!r||typeof r!="string"||!at(r,t.url,t.url_matching||"contains"))return!1}return!0}jn(e,t){return!!this.Wn(e,t)&&!!this.Zn(e,t)&&!!this.Gn(e,t)}Wn(e,t){var s;if(t==null||!t.href)return!0;var r=this.Qn(e);if(r.length>0)return r.some((o=>at(o.href,t.href,t.href_matching||"exact")));var n,a=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!a&&at((n=a.match(/(?::|")href="(.*?)"/))?n[1]:"",t.href,t.href_matching||"exact")}Zn(e,t){var s;if(t==null||!t.text)return!0;var r=this.Qn(e);if(r.length>0)return r.some((c=>at(c.text,t.text,t.text_matching||"exact")||at(c.$el_text,t.text,t.text_matching||"exact")));var n,a,o,l=(e==null||(s=e.properties)==null?void 0:s.$elements_chain)||"";return!!l&&(n=(function(c){for(var u,h=[],d=/(?::|")text="(.*?)"/g;!D(u=d.exec(c));)h.includes(u[1])||h.push(u[1]);return h})(l),a=t.text,o=t.text_matching||"exact",n.some((c=>at(c,a,o))))}Gn(e,t){var s,r;if(t==null||!t.selector)return!0;var n=e==null||(s=e.properties)==null?void 0:s.$element_selectors;if(n!=null&&n.includes(t.selector))return!0;var a=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";if(t.selector_regex&&a)try{return new RegExp(t.selector_regex).test(a)}catch{return!1}return!1}Qn(e){var t;return(e==null||(t=e.properties)==null?void 0:t.$elements)==null?[]:e?.properties.$elements}Hn(e,t){return t==null||!t.properties||t.properties.length===0||Ma(t.properties.reduce(((s,r)=>{var n=q(r.value)?r.value.map(String):r.value!=null?[String(r.value)]:[];return s[r.key]={values:n,operator:r.operator||"exact"},s}),{}),e?.properties)}}class Al{constructor(e){this._instance=e,this.Jn=new Map,this.Kn=new Map,this.Yn=new Map}Xn(e,t){return!!e&&Ma(e.propertyFilters,t?.properties)}es(e,t){var s=new Map;return e.forEach((r=>{var n;(n=r.conditions)==null||(n=n[t])==null||(n=n.values)==null||n.forEach((a=>{if(a!=null&&a.name){var o=s.get(a.name)||[];o.push(r.id),s.set(a.name,o)}}))})),s}ts(e,t,s){var r=(s===Et.Activation?this.Jn:this.Kn).get(e),n=[];return this.rs((a=>{n=a.filter((o=>r?.includes(o.id)))})),n.filter((a=>{var o,l=(o=a.conditions)==null||(o=o[s])==null||(o=o.values)==null?void 0:o.find((c=>c.name===e));return this.Xn(l,t)}))}register(e){var t;y((t=this._instance)==null?void 0:t._addCaptureHook)||(this.ns(e),this.ss(e))}ss(e){var t=e.filter((s=>{var r,n;return((r=s.conditions)==null?void 0:r.actions)&&((n=s.conditions)==null||(n=n.actions)==null||(n=n.values)==null?void 0:n.length)>0}));t.length!==0&&(this.os==null&&(this.os=new Rl(this._instance),this.os.init(),this.os.Vn((s=>{this.onAction(s)}))),t.forEach((s=>{var r,n,a,o,l;s.conditions&&(r=s.conditions)!=null&&r.actions&&(n=s.conditions)!=null&&(n=n.actions)!=null&&n.values&&((a=s.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0&&((o=this.os)==null||o.register(s.conditions.actions.values),(l=s.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach((c=>{if(c&&c.name){var u=this.Yn.get(c.name);u&&u.push(s.id),this.Yn.set(c.name,u||[s.id])}})))})))}ns(e){var t,s=e.filter((n=>{var a,o;return((a=n.conditions)==null?void 0:a.events)&&((o=n.conditions)==null||(o=o.events)==null||(o=o.values)==null?void 0:o.length)>0})),r=e.filter((n=>{var a,o;return((a=n.conditions)==null?void 0:a.cancelEvents)&&((o=n.conditions)==null||(o=o.cancelEvents)==null||(o=o.values)==null?void 0:o.length)>0}));s.length===0&&r.length===0||((t=this._instance)==null||t._addCaptureHook(((n,a)=>{this.onEvent(n,a)})),this.Jn=this.es(e,Et.Activation),this.Kn=this.es(e,Et.Cancellation))}onEvent(e,t){var s,r=this.le(),n=this.us(),a=this.ls(),o=((s=this._instance)==null||(s=s.persistence)==null?void 0:s.props[n])||[];if(a===e&&t&&o.length>0){var l,c;r.info("event matched, removing item from activated items",{event:e,eventPayload:t,existingActivatedItems:o});var u=(t==null||(l=t.properties)==null?void 0:l.$survey_id)||(t==null||(c=t.properties)==null?void 0:c.$product_tour_id);if(u){var h=o.indexOf(u);0>h||(o.splice(h,1),this.hs(o))}}else{if(this.Kn.has(e)){var d=this.ts(e,t,Et.Cancellation);d.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:d.map((g=>g.id))}),d.forEach((g=>{var f=o.indexOf(g.id);0>f||o.splice(f,1),this.cs(g.id)})),this.hs(o))}if(this.Jn.has(e)){r.info("event name matched",{event:e,eventPayload:t,items:this.Jn.get(e)});var p=this.ts(e,t,Et.Activation);this.hs(o.concat(p.map((g=>g.id))||[]))}}}onAction(e){var t,s=this.us(),r=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[s])||[];this.Yn.has(e)&&this.hs(r.concat(this.Yn.get(e)||[]))}hs(e){var t=this.le(),s=[...new Set(e)].filter((r=>!this.ds(r)));t.info("updating activated items",{activatedItems:s}),this.vs(s)}getActivatedIds(){var e,t=this.us();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[t])||[]}
1getEventToItemsMap(){return this.Jn}fs(){return this.os}}class Ll extends Al{constructor(e){super(e)}us(){return Is}ls(){return At.SHOWN}rs(e){var t;(t=this._instance)==null||t.getSurveys(e)}cs(e){var t;(t=this._instance)==null||t.cancelPendingSurvey(e)}le(){return H}vs(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[Is]:e})}ds(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var ns="SDK is not enabled or survey functionality is not yet loaded",cn="Disabled. Not loading surveys.",ql=v!=null&&v.location?$i(v.location.hash,"__posthog")||$i(location.hash,"state"):null,hn="_postHogToolbarParams",dn=W("[Toolbar]"),te=W("[FeatureFlags]"),Ye=W("[FeatureFlags]",{debugEnabled:!0}),as=`" failed. Feature flags didn't load in time.`,pn=i=>{for(var e={},t=0;i.length>t;t++)e[i[t]]=!0;return e},vn=i=>{var e={};for(var[t,s]of ui(i||{}))s&&(e[t]=s);return e},Oe=W("[Error tracking]"),gn="Refusing to render web experiment since the viewer is a likely bot",Dl={icontains:(i,e)=>!!v&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!v&&e.href.toLowerCase().indexOf(i.toLowerCase())===-1,regex:(i,e)=>!!v&&Mi(e.href,i),not_regex:(i,e)=>!!v&&!Mi(e.href,i),exact:(i,e)=>e.href===i,is_not:(i,e)=>e.href!==i};class re{get qt(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(s){s===void 0&&(s=!1),t.getWebExperiments((r=>{re.ps("retrieved web experiments from the server"),t.gs=new Map,r.forEach((n=>{if(n.feature_flag_key){var a;t.gs&&(re.ps("setting flag key ",n.feature_flag_key," to web experiment ",n),(a=t.gs)==null||a.set(n.feature_flag_key,n));var o=t._instance.getFeatureFlag(n.feature_flag_key);V(o)&&n.variants[o]&&t.ys(n.name,o,n.variants[o].transforms)}else if(n.variants)for(var l in n.variants){var c=n.variants[l];re.bs(c)&&t.ys(n.name,l,c.transforms)}}))}),s)},this._instance=e,this._instance.onFeatureFlags((s=>{this.onFeatureFlags(s)}))}initialize(){}onFeatureFlags(e){if(this._is_bot())re.ps(gn);else if(!this.qt.disable_web_experiments){if(D(this.gs))return this.gs=new Map,this.loadIfEnabled(),void this.previewWebExperiment();re.ps("applying feature flags",e),e.forEach((t=>{var s;if(this.gs&&(s=this.gs)!=null&&s.has(t)){var r,n=this._instance.getFeatureFlag(t),a=(r=this.gs)==null?void 0:r.get(t);n&&a!=null&&a.variants[n]&&this.ys(a.name,n,a.variants[n].transforms)}}))}}previewWebExperiment(){var e=re.getWindowLocation();if(e!=null&&e.search){var t=Vt(e?.search,"__experiment_id"),s=Vt(e?.search,"__experiment_variant");t&&s&&(re.ps("previewing web experiments "+t+" && "+s),this.getWebExperiments((r=>{this._s(parseInt(t),s,r)}),!1,!0))}}loadIfEnabled(){this.qt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,s){if(this.qt.disable_web_experiments&&!s)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.qt.token),method:"GET",callback:n=>e(n.statusCode===200&&n.json&&n.json.experiments||[])})}_s(e,t,s){var r=s.filter((n=>n.id===e));r&&r.length>0&&(re.ps("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.ys(r[0].name,t,r[0].variants[t].transforms))}static bs(e){return!D(e.conditions)&&re.ws(e)&&re.xs(e)}static ws(e){var t;if(D(e.conditions)||D((t=e.conditions)==null?void 0:t.url))return!0;var s,r,n,a=re.getWindowLocation();return!!a&&((s=e.conditions)==null||!s.url||Dl[(r=(n=e.conditions)==null?void 0:n.urlMatchType)!==null&&r!==void 0?r:"icontains"](e.conditions.url,a))}
1static getWindowLocation(){return v?.location}static xs(e){var t;if(D(e.conditions)||D((t=e.conditions)==null?void 0:t.utm))return!0;var s=ga();if(s.utm_source){var r,n,a,o,l,c,u,h,d=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((n=e.conditions)==null||(n=n.utm)==null?void 0:n.utm_campaign)==s.utm_campaign,p=(a=e.conditions)==null||(a=a.utm)==null||!a.utm_source||((o=e.conditions)==null||(o=o.utm)==null?void 0:o.utm_source)==s.utm_source,g=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((c=e.conditions)==null||(c=c.utm)==null?void 0:c.utm_medium)==s.utm_medium,f=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((h=e.conditions)==null||(h=h.utm)==null?void 0:h.utm_term)==s.utm_term;return d&&g&&f&&p}return!1}static ps(e){for(var t=arguments.length,s=new Array(t>1?t-1:0),r=1;t>r;r++)s[r-1]=arguments[r];b.info("[WebExperiments] "+e,s)}ys(e,t,s){this._is_bot()?re.ps(gn):t!=="control"?s.forEach((r=>{if(r.selector){var n;re.ps("applying transform of variant "+t+" for experiment "+e+" ",r);var a=(n=document)==null?void 0:n.querySelectorAll(r.selector);a?.forEach((o=>{var l=o;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)}))}})):re.ps("Control variants leave the page unmodified.")}_is_bot(){return ge&&this._instance?Ta(ge,this.qt.custom_blocked_useragents):void 0}}var be=W("[Conversations]"),Xe="Conversations not available yet.",Ai={featureFlags:class{constructor(i){this.Ss=!1,this.ks=!1,this.Cs=!1,this.Is=!1,this.Ts=!1,this.Es=!1,this.Ms=!1,this.Rs=!1,this._instance=i,this.featureFlagEventHandlers=[]}get qt(){return this._instance.config}get Si(){return this._instance.persistence}Ps(i){return this._instance.get_property(i)}Os(){var i,e;return(i=(e=this.Si)==null?void 0:e.Mr(this.qt.feature_flag_cache_ttl_ms))!==null&&i!==void 0&&i}Ls(){return!!this.Os()&&(this.Rs||this.Cs||(this.Rs=!0,te.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Fs(){var i,e=(i=this.qt.evaluation_contexts)!==null&&i!==void 0?i:this.qt.evaluation_environments;return!this.qt.evaluation_environments||this.qt.evaluation_contexts||this.Ms||(te.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Ms=!0),e!=null&&e.length?e.filter((t=>{var s=t&&typeof t=="string"&&t.trim().length>0;return s||te.error("Invalid evaluation context found:",t,"Expected non-empty string"),s})):[]}As(){return this.Fs().length>0}Ns(){var i=this.qt.flag_keys;if(!y(i)){if(q(i))return i.filter((e=>{var t=e&&typeof e=="string"&&e.trim().length>0;return t||te.error("Invalid flag key found:",e,"Expected non-empty string"),t}));te.error("Invalid flag_keys found:",i,"Expected array of non-empty strings")}}initialize(){var i,e,{config:t}=this._instance,s=(i=(e=t.bootstrap)==null?void 0:e.featureFlags)!==null&&i!==void 0?i:{};if(Object.keys(s).length){var r,n,a=(r=(n=t.bootstrap)==null?void 0:n.featureFlagPayloads)!==null&&r!==void 0?r:{},o=Object.keys(s).filter((c=>!!s[c])).reduce(((c,u)=>(c[u]=s[u]||!1,c)),{}),l=Object.keys(a).filter((c=>o[c])).reduce(((c,u)=>(a[u]&&(c[u]=a[u]),c)),{});this.receivedFeatureFlags({featureFlags:o,featureFlagPayloads:l})}}updateFlags(i,e,t){var s=t!=null&&t.merge?this.getFlagVariants():{},r=t!=null&&t.merge?this.getFlagPayloads():{},n=_({},s,i),a=_({},r,e),o={};for(var[l,c]of Object.entries(n)){var u=typeof c=="string";o[l]={key:l,enabled:!!u||!!c,variant:u?c:void 0,reason:void 0,metadata:y(a?.[l])?void 0:{id:0,version:void 0,description:void 0,payload:a[l]}}}this.receivedFeatureFlags({flags:o})}get hasLoadedFlags(){return this.ks}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var i=this.Ps(Ps),e=this.Ps(Ae),t=this.Ps(ot);if(!t&&!e)return i||{};var s=z({},i||{}),r=[...new Set([...Object.keys(t||{}),...Object.keys(e||{})])];for(var n of r){var a,o,l=s[n],c=e?.[n],u=y(c)?(a=l?.enabled)!==null&&a!==void 0&&a:!!c,h=y(c)?l.variant:typeof c=="string"?c:void 0,d=t?.[n],p=_({},l,{enabled:u,variant:u?h??l?.variant:void 0});u!==l?.enabled&&(p.original_enabled=l?.enabled),h!==l?.variant&&(p.original_variant=l?.variant),d&&(p.metadata=_({},l?.metadata,{payload:d,original_payload:l==null||(o=l.metadata)==null?void 0:o.payload})),s[n]=p}return this.Ss||(te.warn(" Overriding feature flag details!",{flagDetails:i,overriddenPayloads:t,finalDetails:s}),this.Ss=!0),s}getFlagVariants(){var i=this.Ps(ht),e=this.Ps(Ae);if(!e)return i||{};for(var t=z({},i),s=Object.keys(e),r=0;s.length>r;r++)t[s[r]]=e[s[r]];return this.Ss||(te.warn(" Overriding feature flags!",{enabledFlags:i,overriddenFlags:e,finalFlags:t}),this.Ss=!0),t}getFlagPayloads(){var i=this.Ps(Fs),e=this.Ps(ot);if(!e)return i||{};for(var t=z({},i||{}),s=Object.keys(e),r=0;s.length>r;r++)t[s[r]]=e[s[r]];return this.Ss||(te.warn(" Overriding feature flag payloads!",{flagPayloads:i,overriddenPayloads:e,finalPayloads:t}),this.Ss=!0),t}reloadFeatureFlags(){this.Is||this.qt.advanced_disable_feature_flags||this.Ds||(this._instance.rn.emit("featureFlagsReloading",!0),this.Ds=setTimeout((()=>{this.$s()}),5))}qs(){clearTimeout(this.Ds),this.Ds=void 0}ensureFlagsLoaded(){this.ks||this.Cs||this.Ds||this.reloadFeatureFlags()}setAnonymousDistinctId(i){this.$anon_distinct_id=i}setReloadingPaused(i){this.Is=i}$s(i){var e;if(this.qs(),!this._instance.Kr())if(this.Cs)this.Ts=!0;else{var t=this.qt.token,s=this.Ps(bi),r={token:t,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:_({},((e=this.Si)==null?void 0:e.get_initial_props())||{},this.Ps(Rt)||{}),group_properties:this.Ps(Je),timezone:wa()};_e(s)||y(s)||(r.$device_id=s),(i!=null&&i.disableFlags||this.qt.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.As()&&(r.evaluation_contexts=this.Fs());var n=this.Ns();y(n)||(r.flag_keys=n);var a=!!this.qt.advanced_only_evaluate_survey_feature_flags,o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.qt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Cs=!0,this._instance._send_request({method:"POST",url:o,data:r,compression:this.qt.disable_compression?void 0:Pe.Base64,timeout:this.qt.feature_flag_request_timeout_ms,callback:l=>{var c,u,h,d=!0;if(l.statusCode===200&&(this.Ts||(this.$anon_distinct_id=void 0),d=!1),this.Cs=!1,!r.disable_flags||this.Ts){this.Es=!d;var p=[];l.error?l.error instanceof Error?p.push(l.error.name==="AbortError"?"timeout":"connection_error"):p.push("unknown_error"):l.statusCode!==200&&p.push("api_error_"+l.statusCode),(c=l.json)!=null&&c.errorsWhileComputingFlags&&p.push("errors_while_computing_flags");var g,f=!((u=l.json)==null||(u=u.quotaLimited)==null||!u.includes("feature_flags"));f&&p.push("quota_limited"),(h=this.Si)==null||h.register({[Cs]:p}),f?te.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."):(r.disable_flags||this.receivedFeatureFlags((g=l.json)!==null&&g!==void 0?g:{},d,{partialResponse:a}),this.Ts&&(this.Ts=!1,this.$s()))}}})}}getFeatureFlag(i,e){var t;if(e===void 0&&(e={}),!e.fresh||this.Es)if(this.ks||this.getFlags()&&this.getFlags().length>0){if(!this.Ls()){var s=this.getFeatureFlagResult(i,e);return(t=s?.variant)!==null&&t!==void 0?t:s?.enabled}}else te.warn('getFeatureFlag for key "'+i+as)}getFeatureFlagDetails(i){return this.getFlagsWithDetails()[i]}getFeatureFlagPayload(i){var e=this.getFeatureFlagResult(i,{send_event:!1});return e?.payload}getFeatureFlagResult(i,e){if(e===void 0&&(e={}),!e.fresh||this.Es)if(this.ks||this.getFlags()&&this.getFlags().length>0){if(!this.Ls()){var t=this.getFlagVariants(),s=i in t,r=t[i],n=this.getFlagPayloads()[i],a=String(r),o=this.Ps($s)||void 0,l=this.Ps(zt)||void 0,c=this.Ps(Dt)||{};if(this.qt.advanced_feature_flags_dedup_per_session){var u,h=this._instance.get_session_id(),d=this.Ps(Ms);h&&h!==d&&(c={},(u=this.Si)==null||u.register({[Dt]:c,[Ms]:h}))}if((e.send_event||!("send_event"in e))&&(!(i in c)||!c[i].includes(a))){var p,g,f,T,P,R,C,I,E,F;q(c[i])?c[i].push(a):c[i]=[a],(p=this.Si)==null||p.register({[Dt]:c});var k=this.getFeatureFlagDetails(i),x=[...(g=this.Ps(Cs))!==null&&g!==void 0?g:[]];y(r)&&x.push("flag_missing");var m={$feature_flag:i,$feature_flag_response:r,$feature_flag_payload:n||null,$feature_flag_request_id:o,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:((f=this.qt.bootstrap)==null||(f=f.featureFlags)==null?void 0:f[i])||null,$feature_flag_bootstrapped_payload:((T=this.qt.bootstrap)==null||(T=T.featureFlagPayloads)==null?void 0:T[i])||null,$used_bootstrap_value:!this.Es};y(k==null||(P=k.metadata)==null?void 0:P.version)||(m.$feature_flag_version=k.metadata.version);var S,M=(R=k==null||(C=k.reason)==null?void 0:C.description)!==null&&R!==void 0?R:k==null||(I=k.reason)==null?void 0:I.code;M&&(m.$feature_flag_reason=M),k!=null&&(E=k.metadata)!=null&&E.id&&(m.$feature_flag_id=k.metadata.id),y(k?.original_variant)&&y(k?.original_enabled)||(m.$feature_flag_original_response=y(k.original_variant)?k.original_enabled:k.original_variant),k!=null&&(F=k.metadata)!=null&&F.original_payload&&(m.$feature_flag_original_payload=k==null||(S=k.metadata)==null?void 0:S.original_payload),x.length&&(m.$feature_flag_error=x.join(",")),this._instance.capture("$feature_flag_called",m)}if(s){var L=n;
1if(!y(n))try{L=JSON.parse(n)}catch{}return{key:i,enabled:!!r,variant:typeof r=="string"?r:void 0,payload:L}}}}else te.warn('getFeatureFlagResult for key "'+i+as)}getRemoteConfigPayload(i,e){var t=this.qt.token,s={distinct_id:this._instance.get_distinct_id(),token:t};this.As()&&(s.evaluation_contexts=this.Fs());var r=this.Ns();y(r)||(s.flag_keys=r),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this.qt.disable_compression?void 0:Pe.Base64,timeout:this.qt.feature_flag_request_timeout_ms,callback(n){var a,o=(a=n.json)==null?void 0:a.featureFlagPayloads;e(o?.[i]||void 0)}})}isFeatureEnabled(i,e){if(e===void 0&&(e={}),!e.fresh||this.Es){if(this.ks||this.getFlags()&&this.getFlags().length>0){var t=this.getFeatureFlag(i,e);return y(t)?void 0:!!t}te.warn('isFeatureEnabled for key "'+i+as)}}addFeatureFlagsHandler(i){this.featureFlagEventHandlers.push(i)}removeFeatureFlagsHandler(i){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==i))}receivedFeatureFlags(i,e,t){if(this.Si){this.ks=!0;var s=this.getFlagVariants(),r=this.getFlagPayloads(),n=this.getFlagsWithDetails();(function(a,o,l,c,u,h){l===void 0&&(l={}),c===void 0&&(c={}),u===void 0&&(u={});var d=(x=>{var m=x.flags;return m?(x.featureFlags=Object.fromEntries(Object.keys(m).map((S=>{var M;return[S,(M=m[S].variant)!==null&&M!==void 0?M:m[S].enabled]}))),x.featureFlagPayloads=Object.fromEntries(Object.keys(m).filter((S=>m[S].enabled)).filter((S=>{var M;return(M=m[S].metadata)==null?void 0:M.payload})).map((S=>{var M;return[S,(M=m[S].metadata)==null?void 0:M.payload]})))):te.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),x})(a),p=d.flags,g=d.featureFlags,f=d.featureFlagPayloads;if(g){var T=a.requestId,P=a.evaluatedAt;if(q(g)){te.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var R={};if(g)for(var C=0;g.length>C;C++)R[g[C]]=!0;o&&o.register({[oi]:g,[ht]:R})}else{var I=g,E=f,F=p;if(h!=null&&h.partialResponse)I=_({},l,I),E=_({},c,E),F=_({},u,F);else if(a.errorsWhileComputingFlags)if(p){var k=new Set(Object.keys(p).filter((x=>{var m;return!((m=p[x])!=null&&m.failed)})));I=_({},l,Object.fromEntries(Object.entries(I).filter((x=>{var[m]=x;return k.has(m)})))),E=_({},c,Object.fromEntries(Object.entries(E||{}).filter((x=>{var[m]=x;return k.has(m)})))),F=_({},u,Object.fromEntries(Object.entries(F||{}).filter((x=>{var[m]=x;return k.has(m)}))))}else I=_({},l,I),E=_({},c,E),F=_({},u,F);o&&o.register(_({[oi]:Object.keys(vn(I)),[ht]:I||{},[Fs]:E||{},[Ps]:F||{}},T?{[$s]:T}:{},P?{[zt]:P}:{}))}}})(i,this.Si,s,r,n,t),e||(this.Rs=!1),this.js(e)}}override(i,e){e===void 0&&(e=!1),te.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:i,suppressWarning:e})}
1overrideFeatureFlags(i){if(!this._instance.__loaded||!this.Si)return te.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(i===!1)return this.Si.unregister(Ae),this.Si.unregister(ot),this.js(),Ye.info("All overrides cleared");if(q(i)){var e=pn(i);return this.Si.register({[Ae]:e}),this.js(),Ye.info("Flag overrides set",{flags:i})}if(i&&typeof i=="object"&&("flags"in i||"payloads"in i)){var t,s=i;if(this.Ss=!!((t=s.suppressWarning)!==null&&t!==void 0&&t),"flags"in s){if(s.flags===!1)this.Si.unregister(Ae),Ye.info("Flag overrides cleared");else if(s.flags){if(q(s.flags)){var r=pn(s.flags);this.Si.register({[Ae]:r})}else this.Si.register({[Ae]:s.flags});Ye.info("Flag overrides set",{flags:s.flags})}}return"payloads"in s&&(s.payloads===!1?(this.Si.unregister(ot),Ye.info("Payload overrides cleared")):s.payloads&&(this.Si.register({[ot]:s.payloads}),Ye.info("Payload overrides set",{payloads:s.payloads}))),void this.js()}if(i&&typeof i=="object")return this.Si.register({[Ae]:i}),this.js(),Ye.info("Flag overrides set",{flags:i});te.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:i})}
1onFeatureFlags(i){if(this.addFeatureFlagsHandler(i),this.ks){var{flags:e,flagVariants:t}=this.Hs();i(e,t)}return()=>this.removeFeatureFlagsHandler(i)}updateEarlyAccessFeatureEnrollment(i,e,t){var s,r=(this.Ps(Ot)||[]).find((l=>l.flagKey===i)),n={["$feature_enrollment/"+i]:e},a={$feature_flag:i,$feature_enrollment:e,$set:n};r&&(a.$early_access_feature_name=r.name),t&&(a.$feature_enrollment_stage=t),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(n,!1);var o=_({},this.getFlagVariants(),{[i]:e});(s=this.Si)==null||s.register({[oi]:Object.keys(vn(o)),[ht]:o}),this.js()}getEarlyAccessFeatures(i,e,t){e===void 0&&(e=!1);var s=this.Ps(Ot),r=t?"&"+t.map((n=>"stage="+n)).join("&"):"";if(s&&!e)return i(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.qt.token+r),method:"GET",callback:n=>{var a,o;if(n.json){var l=n.json.earlyAccessFeatures;return(a=this.Si)==null||a.unregister(Ot),(o=this.Si)==null||o.register({[Ot]:l}),i(l)}}})}Hs(){var i=this.getFlags(),e=this.getFlagVariants();return{flags:i.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,s)=>(t[s]=e[s],t)),{})}}js(i){var{flags:e,flagVariants:t}=this.Hs();this.featureFlagEventHandlers.forEach((s=>s(e,t,{errorsLoading:i})))}setPersonPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this.Ps(Rt)||{},s=i?.$set||(i!=null&&i.$set_once?{}:i),r=i?.$set_once,n={};if(r)for(var a in r)({}).hasOwnProperty.call(r,a)&&(a in t||(n[a]=r[a]));this._instance.register({[Rt]:_({},t,n,s)}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Rt)}setGroupPropertiesForFlags(i,e){e===void 0&&(e=!0);var t=this.Ps(Je)||{};Object.keys(t).length!==0&&Object.keys(t).forEach((s=>{t[s]=_({},t[s],i[s]),delete i[s]})),this._instance.register({[Je]:_({},t,i)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(i){if(i){var e=this.Ps(Je)||{};this._instance.register({[Je]:_({},e,{[i]:{}})})}else this._instance.unregister(Je)}reset(){this.ks=!1,this.Cs=!1,this.Is=!1,this.Ts=!1,this.Es=!1,this.$anon_distinct_id=void 0,this.qs(),this.Ss=!1}}},Nl={sessionRecording:class{get qt(){return this._instance.config}get Si(){return this._instance.persistence}get started(){var i;return!((i=this.Us)==null||!i.isStarted)}get status(){var i,e;return this.Bs===Tt||this.Bs===ai?this.Bs:(i=(e=this.Us)==null?void 0:e.status)!==null&&i!==void 0?i:this.Bs}constructor(i){if(this._forceAllowLocalhostNetworkCapture=!1,this.Bs=nn,this.zs=void 0,this._instance=i,!this._instance.sessionManager)throw Ce.error("started without valid sessionManager"),new Error(Ws+" started without valid sessionManager. This is a bug.");if(this.qt.cookieless_mode===qe)throw new Error(Ws+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Vs(){var i,e=!((i=this._instance.get_property(Ze))==null||!i.enabled),t=!this.qt.disable_session_recording,s=this.qt.disable_session_recording||this._instance.consent.isOptedOut();return v&&e&&t&&!s}startIfEnabledOrStop(i){var e;if(!this.Vs||(e=this.Us)==null||!e.isStarted){var t=!y(Object.assign)&&!y(Array.from);this.Vs&&t?(this.Ws(i),Ce.info("starting")):(this.Bs=nn,this.stopRecording())}}Ws(i){var e,t,s;this.Vs&&(this.Bs!==Tt&&this.Bs!==ai&&(this.Bs=an),$!=null&&(e=$.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(t=$.__PosthogExtensions__)!=null&&t.initSessionRecording?this.Zs(i):(s=$.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this._instance,this.Gs,(r=>{if(r)return Ce.error("could not load recorder",r);this.Zs(i)})))}stopRecording(){var i,e;(i=this.zs)==null||i.call(this),this.zs=void 0,(e=this.Us)==null||e.stop()}Qs(){var i,e;(i=this.zs)==null||i.call(this),this.zs=void 0,(e=this.Us)==null||e.discard()}Js(){var i;(i=this.Si)==null||i.unregister(er)}Ks(i,e){if(D(i))return null;var t,s=oe(i)?i:parseFloat(i);return typeof(t=s)!="number"||!Number.isFinite(t)||0>t||t>1?(Ce.warn(e+" must be between 0 and 1. Ignoring invalid value:",i),null):s}Ys(i){if(this.Si){var e,t,s=this.Si,r=()=>{var n,a=i.sessionRecording===!1?void 0:i.sessionRecording,o=this.Ks((n=this.qt.session_recording)==null?void 0:n.sampleRate,"session_recording.sampleRate"),l=this.Ks(a?.sampleRate,"remote config sampleRate"),c=o??l;D(c)&&this.Js();var u=a?.minimumDurationMilliseconds;s.register({[Ze]:_({cache_timestamp:Date.now(),enabled:!!a},a,{networkPayloadCapture:_({capturePerformance:i.capturePerformance},a?.networkPayloadCapture),canvasRecording:{enabled:a?.recordCanvas,fps:a?.canvasFps,quality:a?.canvasQuality},sampleRate:c,minimumDurationMilliseconds:y(u)?null:u,endpoint:a?.endpoint,triggerMatchType:a?.triggerMatchType,masking:a?.masking,urlTriggers:a?.urlTriggers,version:a?.version,triggerGroups:a?.triggerGroups})})};r(),(e=this.zs)==null||e.call(this),this.zs=(t=this._instance.sessionManager)==null?void 0:t.onSessionId(r)}}onRemoteConfig(i){return"sessionRecording"in i?i.sessionRecording===!1?(this.Ys(i),void this.Qs()):(this.Ys(i),void this.startIfEnabledOrStop()):(this.Bs===Tt&&(this.Bs=ai,Ce.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(i,e){var t;e===void 0&&(e="log"),(t=this.Us)!=null&&t.log?this.Us.log(i,e):Ce.warn("log called before recorder was ready")}get Gs(){var i,e,t=(i=this._instance)==null||(i=i.persistence)==null?void 0:i.get_property(Ze);return(t==null||(e=t.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}Xs(){var i,e,t=this._instance.get_property(Ze);
1if(!t)return!1;try{e=typeof t=="object"?t:JSON.parse(t)}catch(r){return Ce.warn("persisted remote config for session recording is invalid and will be ignored",r),!1}var s=(i=e.cache_timestamp)!==null&&i!==void 0?i:Date.now();return 36e5>=Date.now()-s}Zs(i){var e,t;if((e=$.__PosthogExtensions__)==null||!e.initSessionRecording)return Ce.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Qn]:!0});if(this.Us||(this.Us=(t=$.__PosthogExtensions__)==null?void 0:t.initSessionRecording(this._instance),this.Us._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Xs())return this.Bs===ai||this.Bs===Tt?void 0:(this.Bs=Tt,Ce.info("persisted remote config is stale, requesting fresh config before starting"),void new xa(this._instance).load());this.Bs=an,this.Us.start(i)}onRRwebEmit(i){var e;(e=this.Us)==null||e.onRRwebEmit==null||e.onRRwebEmit(i)}overrideLinkedFlag(){var i,e;this.Us||(e=this.Si)==null||e.register({[Wn]:!0}),(i=this.Us)==null||i.overrideLinkedFlag()}overrideSampling(){var i,e;this.Us||(e=this.Si)==null||e.register({[Vn]:!0}),(i=this.Us)==null||i.overrideSampling()}overrideTrigger(i){var e,t;this.Us||(t=this.Si)==null||t.register({[i==="url"?Yn:Xn]:!0}),(e=this.Us)==null||e.overrideTrigger(i)}get sdkDebugProperties(){var i;return((i=this.Us)==null?void 0:i.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(i,e){var t;return!((t=this.Us)==null||!t.tryAddCustomEvent(i,e))}}},jl={autocapture:class{constructor(i){this.eo=!1,this.ro=null,this.io=!1,this.instance=i,this.rageclicks=new tn(i.config.rageclick),this.no=null}initialize(){this.startIfEnabled()}get qt(){var i,e,t=X(this.instance.config.autocapture)?this.instance.config.autocapture:{};return t.url_allowlist=(i=t.url_allowlist)==null?void 0:i.map((s=>new RegExp(s))),t.url_ignorelist=(e=t.url_ignorelist)==null?void 0:e.map((s=>new RegExp(s))),t}so(){if(this.isBrowserSupported()){if(v&&w){var i=t=>{t=t||v?.event;try{this.oo(t)}catch(s){ss.error("Failed to capture event",s)}};if(J(w,"submit",i,{capture:!0}),J(w,"change",i,{capture:!0}),J(w,"click",i,{capture:!0}),this.qt.capture_copied_text){var e=t=>{t=t||v?.event;try{this.oo(t,is)}catch(s){ss.error("Failed to capture copy/cut event",s)}};J(w,"copy",e,{capture:!0}),J(w,"cut",e,{capture:!0})}}}else ss.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.eo&&(this.so(),this.eo=!0)}onRemoteConfig(i){i.elementsChainAsString&&(this.io=i.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[ms]:!!i.autocapture_opt_out}),this.ro=!!i.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(i){this.no=i}getElementSelectors(i){var e,t=[];return(e=this.no)==null||e.forEach((s=>{var r=w?.querySelectorAll(s);r?.forEach((n=>{i===n&&t.push(s)}))})),t}get isEnabled(){var i,e,t=(i=this.instance.persistence)==null?void 0:i.props[ms];if(_e(this.ro)&&!Te(t)&&!this.instance.Kr())return!1;var s=(e=this.ro)!==null&&e!==void 0?e:!!t;return!!this.instance.config.autocapture&&!s}oo(i,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var t,s=Vi(i);ia(s)&&(s=s.parentNode||null),e==="$autocapture"&&i.type==="click"&&i instanceof MouseEvent&&this.instance.config.rageclick&&(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,i.timeStamp||new Date().getTime())&&Or(s,this.instance.config.rageclick)&&this.oo(i,"$rageclick");var r=e===is;if(s&&(function(h,d,p,g,f){var T,P,R,C;if(p===void 0&&(p=void 0),!v||ar(h)||(T=p)!=null&&T.url_allowlist&&!Ir(p.url_allowlist)||(P=p)!=null&&P.url_ignorelist&&Ir(p.url_ignorelist))return!1;if((R=p)!=null&&R.dom_event_allowlist){var I=p.dom_event_allowlist;if(I&&!I.some((m=>d.type===m)))return!1}var{parentIsUsefulElement:E,targetElementList:F}=la(h,g);if(!(function(m,S){var M=S?.element_allowlist;if(y(M))return!0;var L,A=function(j){if(M.some((ee=>j.tagName.toLowerCase()===ee)))return{v:!0}};for(var N of m)if(L=A(N))return L.v;return!1})(F,p)||!na(F,(C=p)==null?void 0:C.css_selector_allowlist))return!1;var k=v.getComputedStyle(h);if(k&&k.getPropertyValue("cursor")==="pointer"&&d.type==="click")return!0;var x=h.tagName.toLowerCase();switch(x){case"html":return!1;case"form":return(f||["submit"]).indexOf(d.type)>=0;case"input":case"select":case"textarea":return(f||["change","click"]).indexOf(d.type)>=0;default:return E?(f||["click"]).indexOf(d.type)>=0:(f||["click"]).indexOf(d.type)>=0&&(nr.indexOf(x)>-1||h.getAttribute("contenteditable")==="true")}})(s,i,this.qt,r,r?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:a}=Il(s,{e:i,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.qt.element_attribute_ignorelist,elementsC
1hainAsString:this.io});if(a)return!1;var o=this.getElementSelectors(s);if(o&&o.length>0&&(n.$element_selectors=o),e===is){var l,c=ra(v==null||(l=v.getSelection())==null?void 0:l.toString()),u=i.type||"clipboard";if(!c)return!1;n.$selected_content=c,n.$copy_type=u}return this.instance.capture(e,n),!0}}}isBrowserSupported(){return Le(w?.querySelectorAll)}},historyAutocapture:class{constructor(i){var e;this._instance=i,this.ao=(v==null||(e=v.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(b.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.uo&&this.uo(),this.uo=void 0,b.info("History API monitoring stopped")}monitorHistoryChanges(){var i,e;if(v&&v.history){var t=this;(i=v.history.pushState)!=null&&i.__posthog_wrapped__||sn(v.history,"pushState",(s=>function(r,n,a){s.call(this,r,n,a),t.lo("pushState")})),(e=v.history.replaceState)!=null&&e.__posthog_wrapped__||sn(v.history,"replaceState",(s=>function(r,n,a){s.call(this,r,n,a),t.lo("replaceState")})),this.ho()}}lo(i){try{var e,t=v==null||(e=v.location)==null?void 0:e.pathname;if(!t)return;t!==this.ao&&this.isEnabled&&this._instance.capture(lt,{navigation_type:i}),this.ao=t}catch(s){b.error("Error capturing "+i+" pageview",s)}}ho(){if(!this.uo){var i=()=>{this.lo("popstate")};J(v,"popstate",i),this.uo=()=>{v&&v.removeEventListener("popstate",i)}}}},heatmaps:class{get qt(){return this.instance.config}constructor(i){var e;this.co=!1,this.eo=!1,this.do=null,this.instance=i,this.co=!((e=this.instance.persistence)==null||!e.props[ys]),this.rageclicks=new tn(i.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var i=5e3;return X(this.qt.capture_heatmaps)&&this.qt.capture_heatmaps.flush_interval_milliseconds&&(i=this.qt.capture_heatmaps.flush_interval_milliseconds),i}get isEnabled(){return D(this.qt.capture_heatmaps)?D(this.qt.enable_heatmaps)?this.co:this.qt.enable_heatmaps:this.qt.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.eo)return;Cl.info("starting..."),this.vo(),this.At()}else{var i;clearInterval((i=this.do)!==null&&i!==void 0?i:void 0),this.fo(),this.getAndClearBuffer()}}onRemoteConfig(i){if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[ys]:e}),this.co=e,this.startIfEnabled()}}getAndClearBuffer(){var i=this.M;return this.M=void 0,i}po(i){this.Mt(i.originalEvent,"deadclick")}At(){this.do&&clearInterval(this.do),this.do=w?.visibilityState==="visible"?setInterval(this.ci.bind(this),this.flushIntervalMilliseconds):null}vo(){v&&w&&(this.mo=this.ci.bind(this),J(v,ki,this.mo),this.yo=i=>this.Mt(i||v?.event),J(w,"click",this.yo,{capture:!0}),this.bo=i=>this._o(i||v?.event),J(w,"mousemove",this.bo,{capture:!0}),this.wo=new Lr(this.instance,Xo,this.po.bind(this)),this.wo.startIfEnabledOrStop(),this.xo=this.At.bind(this),J(w,Ei,this.xo),this.eo=!0)}fo(){var i;v&&w&&(this.mo&&v.removeEventListener(ki,this.mo),this.yo&&w.removeEventListener("click",this.yo,{capture:!0}),this.bo&&w.removeEventListener("mousemove",this.bo,{capture:!0}),this.xo&&w.removeEventListener(Ei,this.xo),clearTimeout(this.So),(i=this.wo)==null||i.stop(),this.eo=!1)}ko(i,e){var t=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=(function(a,o,l){for(var c=a;c&&ze(c)&&!fe(c,"body");){if(c===l)return!1;if(O(o,v?.getComputedStyle(c).position))return!0;c=aa(c)}return!1})(Vi(i),["fixed","sticky"],r);return{x:i.clientX+(n?0:s),y:i.clientY+(n?0:t),target_fixed:n,type:e}}Mt(i,e){var t;if(e===void 0&&(e="click"),!Tr(i.target)&&on(i)){var s=this.ko(i,e);(t=this.rageclicks)!=null&&t.isRageClick(i.clientX,i.clientY,new Date().getTime())&&Or(Vi(i),this.instance.config.rageclick)&&this.Co(_({},s,{type:"rageclick"})),this.Co(s)}}_o(i){!Tr(i.target)&&on(i)&&(clearTimeout(this.So),this.So=setTimeout((()=>{this.Co(this.ko(i,"mousemove"))}),500))}Co(i){if(v){var e=v.location.href,t=this.qt.custom_personal_data_properties,s=this.qt.mask_personal_data_properties?[...mt,...t||[]]:[],r=Wt(e,s,Yt);this.M=this.M||{},this.M[r]||(this.M[r]=[]),this.M[r].push(i)}}ci(){this.M&&!Be(this.M)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Lr,webVitalsAutocapture:class{constructor(i){var e;this.co=!1,this.eo=!1,this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Io=()=>{clearTimeout(this.To),this.M.metrics.length!==0&&(this._instance.capture("$web_vitals",this.M.metrics.reduce(((t,s)=>_({},t,{["$web_vitals_"+s.name+"_event"]:_({},s),["$web_vitals_"+s.name+"_value"]:s.value})),{})),this.M={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.dt=t=>{var s;this.M=this.M||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.Eo();if(!y(r))if(D(t?.name)||D(t?.value))We.error("Invalid metric received",t);else if(!this.Mo||this.Mo>t.value){this.M.url!==r&&(this.Io(),this.To=setTimeout(this.Io,this.flushToCaptureTimeoutMs)),y(this.M.url)&&(this.M.url=r),this.M.firstMetricTimestamp=y(this.M.firstMetricTimestamp)?Date.now():this.M.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0);var n=(s=this._instance.sessionManager)==null?void 0:s.checkAndGetSessionAndWindowId(!0),a=_({},t,{$current_url:r,timestamp:Date.now()});y(n)||(a.$session_id=n.sessionId,a.$window_id=n.windowId),this.M.metrics.push(a),this.M.metrics.length===this.allowedMetrics.length&&this.Io()}else We.error("Ignoring metric with value >= "+this.Mo,t)},this.Ro=()=>
1{if(!this.eo){var t,s,r,n,a=$.__PosthogExtensions__;y(a)||y(a.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:s,onFCP:r,onINP:n}=a.postHogWebVitalsCallbacks),t&&s&&r&&n?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.dt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&s(this.dt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&r(this.dt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&n(this.dt.bind(this)),this.eo=!0):We.error("web vitals callbacks not loaded - not starting")}},this._instance=i,this.co=!((e=this._instance.persistence)==null||!e.props[Es]),this.startIfEnabled()}get Po(){return this._instance.config.capture_performance}get allowedMetrics(){var i,e,t=X(this.Po)?(i=this.Po)==null?void 0:i.web_vitals_allowed_metrics:void 0;return D(t)?((e=this._instance.persistence)==null?void 0:e.props[Ss])||["CLS","FCP","INP","LCP"]:t}get flushToCaptureTimeoutMs(){return(X(this.Po)?this.Po.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var i=X(this.Po)?this.Po.web_vitals_attribution:void 0;return i!=null&&i}get Mo(){var i=X(this.Po)&&oe(this.Po.__web_vitals_max_value)?this.Po.__web_vitals_max_value:rn;return i>0&&6e4>=i?rn:i}get isEnabled(){var i=ie?.protocol;if(i!=="http:"&&i!=="https:")return We.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=X(this.Po)?this.Po.web_vitals:Te(this.Po)?this.Po:void 0;return Te(e)?e:this.co}startIfEnabled(){this.isEnabled&&!this.eo&&(We.info("enabled, starting..."),this.lr(this.Ro))}onRemoteConfig(i){if("capturePerformance"in i){var e=X(i.capturePerformance)&&!!i.capturePerformance.web_vitals,t=X(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Es]:e}),this._instance.persistence.register({[Ss]:t})),this.co=e,this.startIfEnabled()}}lr(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?i():(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(s=>{s?We.error("failed to load script",s):i()}))}Eo(){var i=v?v.location.href:void 0;if(i){var e=this._instance.config.custom_personal_data_properties,t=this._instance.config.mask_personal_data_properties?[...mt,...e||[]]:[];return Wt(i,t,Yt)}We.error("Could not determine current URL")}}},Hl={exceptionObserver:class{constructor(i){var e,t,s;this.Ro=()=>{var r;if(v&&this.isEnabled&&(r=$.__PosthogExtensions__)!=null&&r.errorWrappingFunctions){var n=$.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=$.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,o=$.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Oo&&this.qt.capture_unhandled_errors&&(this.Oo=n(this.captureException.bind(this))),!this.Lo&&this.qt.capture_unhandled_rejections&&(this.Lo=a(this.captureException.bind(this))),!this.Fo&&this.qt.capture_console_errors&&(this.Fo=o(this.captureException.bind(this)))}catch(l){$t.error("failed to start",l),this.Ao()}}},this._instance=i,this.No=!((e=this._instance.persistence)==null||!e.props[bs]),this.Do=new Wa({refillRate:(t=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&t!==void 0?t:1,bucketSize:(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10,refillInterval:1e4,Gt:$t}),this.qt=this.$o(),this.startIfEnabledOrStop()}$o(){var i=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return X(i)?e=_({},e,i):(y(i)?this.No:i)&&(e=_({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.qt.capture_console_errors||this.qt.capture_unhandled_errors||this.qt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?($t.info("enabled"),this.Ao(),this.lr(this.Ro)):this.Ao()}lr(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.errorWrappingFunctions&&i(),(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"exception-autocapture",(s=>{if(s)return $t.error("failed to load script",s);i()}))}Ao(){var i,e,t;(i=this.Oo)==null||i.call(this),this.Oo=void 0,(e=this.Lo)==null||e.call(this),this.Lo=void 0,(t=this.Fo)==null||t.call(this),this.Fo=void 0}onRemoteConfig(i){"autocaptureExceptions"in i&&(this.No=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[bs]:this.No}),this.qt=this.$o(),this.startIfEnabledOrStop())}onConfigChange(){this.qt=this.$o()}
1captureException(i){var e,t,s,r=(e=i==null||(t=i.$exception_list)==null||(t=t[0])==null?void 0:t.type)!==null&&e!==void 0?e:"Exception";this.Do.consumeRateLimit(r)?$t.info("Skipping exception capture because of client rate limiting.",{exception:r}):(s=this._instance.exceptions)==null||s.sendExceptionEvent(i)}},exceptions:class{constructor(i){var e,t;this.qo=[],this.jo=new ao([new go,new ko,new _o,new fo,new xo,new wo,new yo,new Eo],(function(s){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;r>a;a++)n[a-1]=arguments[a];return function(o,l){l===void 0&&(l=0);for(var c=[],u=o.split(`
2`),h=l;u.length>h;h++){var d=u[h];if(1024>=d.length){var p=Sr.test(d)?d.replace(Sr,"$1"):d;if(!p.match(/\S*Error: /)){for(var g of n){var f=g(p,s);if(f){c.push(f);break}}if(c.length>=50)break}}}return(function(T){if(!T.length)return[];var P=Array.from(T);return P.reverse(),P.slice(0,50).map((R=>{return _({},R,{filename:R.filename||(C=P,C[C.length-1]||{}).filename,function:R.function||_t});var C}))})(c)}})("web:javascript",co,vo)),this._instance=i,this.qo=(e=(t=this._instance.persistence)==null?void 0:t.get_property(ws))!==null&&e!==void 0?e:[],this.Ho=yi(this.Uo()),this.Bo=new Po(this.Ho)}onConfigChange(){this.Ho=yi(this.Uo()),this.Bo.setConfig(this.Ho)}onRemoteConfig(i){var e,t,s;if("errorTracking"in i){var r=(e=(t=i.errorTracking)==null?void 0:t.suppressionRules)!==null&&e!==void 0?e:[],n=(s=i.errorTracking)==null?void 0:s.captureExtensionExceptions;this.qo=r,this._instance.persistence&&this._instance.persistence.register({[ws]:this.qo,[xs]:n})}}get zo(){var i,e=!!this._instance.get_property(xs),t=this._instance.config.error_tracking.captureExtensionExceptions;return(i=t??e)!==null&&i!==void 0&&i}buildProperties(i,e){return this.jo.buildFromUnknown(i,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(i,e){if(this.Ho.enabled)try{if(!V(i)||i.trim().length===0)return void Oe.warn("Ignoring exception step because message must be a non-empty string");var t=this.Vo(e),{sanitizedProperties:s,droppedKeys:r}=(function(n){if(!n)return{sanitizedProperties:{},droppedKeys:[]};var a=[];return{sanitizedProperties:Object.keys(n).reduce(((o,l)=>So.has(l)?(a.push(l),o):(o[l]=n[l],o)),{}),droppedKeys:a}})(t);r.length>0&&Oe.warn("Ignoring reserved exception step fields",{droppedKeys:r}),this.Bo.add(_({[_i]:i,[mi]:new Date().toISOString()},s))}catch(n){Oe.error("Failed to add exception step. Ignoring breadcrumb.",n)}}sendExceptionEvent(i){try{var e=i.$exception_list;if(this.Wo(e)){if(this.Zo(e))return this.Go("Exception dropped: matched a suppression rule"),void Oe.info("Skipping exception capture because a suppression rule matched");if(!this.zo&&this.Qo(e))return this.Go("Exception dropped: thrown by a browser extension"),void Oe.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Jo(e))return this.Go("Exception dropped: thrown by the PostHog SDK"),void Oe.info("Skipping exception capture because it was thrown by the PostHog SDK")}var t=this.Ho.enabled&&D(i.$exception_steps)?this.Ko(i):i;try{var s=this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",Cn:!0});return s&&this.Bo.clear(),s}catch(r){return Oe.error("Failed to capture exception event. Dropping this exception.",r),void this.Bo.clear()}}catch(r){return void Oe.error("Failed to process exception event. Ignoring this exception.",r)}}Ko(i){try{var e=this.Bo.getAttachable();return e.length===0?i:_({},i,{$exception_steps:e})}catch(t){return Oe.error("Failed to read buffered exception steps. Capturing exception without steps.",t),i}}Go(i){this.Ho.enabled&&this.Bo.add({[_i]:i,[mi]:new Date().toISOString()})}Vo(i){return X(i)?_({},i):{}}Uo(){var i,e;return(i=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&i!==void 0?i:{}}Zo(i){if(i.length===0)return!1;var e=i.reduce(((t,s)=>{var{type:r,value:n}=s;return V(r)&&r.length>0&&t.$exception_types.push(r),V(n)&&n.length>0&&t.$exception_values.push(n),t}),{$exception_types:[],$exception_values:[]});return this.qo.some((t=>{var s=t.values.map((r=>{var n,a=Ia[r.operator],o=q(r.value)?r.value:[r.value],l=(n=e[r.key])!==null&&n!==void 0?n:[];return o.length>0&&a(o,l)}));return t.type==="OR"?s.some(Boolean):s.every(Boolean)}))}Qo(i){return i.flatMap((e=>{var t,s;return(t=(s=e.stacktrace)==null?void 0:s.frames)!==null&&t!==void 0?t:[]})).some((e=>e.filename&&e.filename.startsWith("chrome-extension://")))}Jo(i){if(i.length>0){var e,t,s,r,n=(e=(t=i[0].stacktrace)==null?void 0:t.frames)!==null&&e!==void 0?e:[],a=n[n.length-1];return(s=a==null||(r=a.filename)==null?void 0:r.includes("posthog.com/static"))!==null&&s!==void 0&&s}return!1}Wo(i){return!D(i)&&q(i)}}},Ul=_({productTours:class{get Si(){return this._instance.persistence}constructor(i){this.Yo=null,this.Xo=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){"productTours"in i&&(this.Si&&this.Si.register({[ks]:!!i.productTours}),this.loadIfEnabled())}loadIfEnabled(){var i,e;this.Yo||(i=this._instance).config.disable_product_tours||(e=i.persistence)==null||!e.get_property(ks)||this.lr((()=>this.ea()))}lr(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.generateProductTours?i():(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"product-tours",(s=>{s?ln.error("Could not load product tours script",s):i()}))}ea(){var i;!this.Yo&&(i=$.__PosthogExtensions__)!=null&&i.generateProductTours&&(this.Yo=$.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(i,e){if(e===void 0&&(e=!1),!q(this.Xo)||e){var t=this.Si;if(t){var s=t.props[li];if(q(s)&&!e)return this.Xo=s,void i(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:r=>{var n=r.statusCode;if(n!==200||!r.json){var a="Product Tours API could not be loaded, status: "+n;return ln.error(a),void i([],{isLoaded:!1,error:a})}var o=q(r.json.product_tours)?r.json.product_tours:[];this.Xo=o,t&&t.register({[li]:o}),i(o,{isLoaded:!0})}})}else i(this.Xo,{isLoaded:!0})}getActiveProductTours(i){D(this.Yo)?i([],{isLoaded:!1,error:"Product tours not loaded"}):this.Yo.getActiveProductTours(i)}showProductTour(i){var e;(e=this.Yo)==null||e.showTourById(i)}previewTour(i){this.Yo?this.Yo.previewTour(i):this.lr((()=>{var e;this.ea(),(e=this.Yo)==null||e.previewTour(i)}))}dismissProductTour(){var i;(i=this.Yo)==null||i.dismissTour("user_clicked_skip")}nextStep(){var i;(i=this.Yo)==null||i.nextStep()}previousStep(){var i;(i=this.Yo)==null||i.previousStep()}clearCache(){var i;this.Xo=null,(i=this.Si)==null||i.unregister(li)}resetTour(i){var e;(e=this.Yo)==null||e.resetTour(i)}resetAllTours(){var i;(i=this.Yo)==null||i.resetAllTours()}cancelPendingTour(i){var e;(e=this.Yo)==null||e.cancelPendingTour(i)}}},Ai),Bl={siteApps:class{constructor(i){this._instance=i,this.ta=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ra(i,e){if(e){var t=this.globalsForEvent(e);this.ta.push(t),this.ta.length>1e3&&(this.ta=this.ta.slice(10))}}get siteAppLoaders(){var i;return(i=$._POSTHOG_REMOTE_CONFIG)==null||(i=i[this._instance.config.token])==null?void 0:i.siteApps}initialize(){if(this.isEnabled){var i=this._instance._addCaptureHook(this.ra.bind(this));this.ia=()=>{i(),this.ta=[],this.ia=void 0}}}globalsForEvent(i){var e,t,s,r,n,a,o;if(!i)throw new Error("Event payload is required");var l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var[h,d]of Object.entries(u))l[h]={id:c[h],type:h,properties:d};var{$set_once:p,$set:g}=i;return{event:_({},fn(i,Ol),{properties:_({},i.properties,g?{$set:_({},(e=(t=i.properties)==null?void 0:t.$set)!==null&&e!==void 0?e:{},g)}:{},p?{$set_once:_({},(s=(r=i.properties)==null?void 0:r.$set_once)!==null&&s!==void 0?s:{},p)}:{}),elements_chain:(n=(a=i.properties)==null?void 0:a.$elements_chain)!==null&&n!==void 0?n:"",distinct_id:(o=i.properties)==null?void 0:o.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(i){var e=this.apps[i.id],t=()=>{var a;!e.errored&&this.ta.length&&(He.info("Processing "+this.ta.length+" events for site app with id "+i.id),this.ta.forEach((o=>e.processEvent==null?void 0:e.processEvent(o))),e.processedBuffer=!0),Object.values(this.apps).every((o=>o.processedBuffer||o.errored))&&((a=this.ia)==null||a.call(this))},s=!1,r=a=>{e.errored=!a,e.loaded=!0,He.info("Site app with id "+i.id+" "+(a?"loaded":"errored")),s&&t()};try{var{processEvent:n}=i.init({posthog:this._instance,callback(a){r(a)}});n&&(e.processEvent=n),s=!0}catch(a){He.error(un+i.id,a),r(!1)}if(s&&e.loaded)try{t()}catch(a){He.error("Error while processing buffered events PostHog app with config id "+i.id,a),e.errored=!0}}na(){var i=this.siteAppLoaders||[];for(var e of i)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var t of i)this.setupSiteApp(t)}sa(i){if(Object.keys(this.apps).length!==0){var e=this.globalsForEvent(i);for(var t of Object.values(this.apps))try{t.processEvent==null||t.processEvent(e)}catch(s){He.error("Error while processing event "+i.event+" for site app "+t.id,s)}}}onRemoteConfig(i){var e,t,s,r=this;
2if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.na(),void this._instance.on("eventCaptured",(l=>this.sa(l)))):void He.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((t=this.ia)==null||t.call(this),(s=i.siteApps)!=null&&s.length)if(this.isEnabled){var n=function(l){var c;$["__$$ph_site_app_"+l]=r._instance,(c=$.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(r._instance,o,(u=>{if(u)return He.error(un+l,u)}))};for(var{id:a,url:o}of i.siteApps)n(a)}else He.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},zl={tracingHeaders:class{constructor(i){this.oa=void 0,this.aa=void 0,this.ua=void 0,this.Ro=()=>{var e,t,s=this.la();s?(y(this.oa)&&(this.oa=(e=$.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null?void 0:e._patchXHR(s,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),y(this.aa)&&(this.aa=(t=$.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null?void 0:t._patchFetch(s,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Ao()},this._instance=i}initialize(){this.startIfEnabledOrStop()}lr(i){var e,t;(e=$.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns?i():(t=$.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,"tracing-headers",(s=>{if(s)return Ml.error("failed to load script",s);i()}))}ha(){var i,e;return(i=(e=this._instance.config.tracing_headers)!==null&&e!==void 0?e:this._instance.config.addTracingHeaders)!==null&&i!==void 0?i:this._instance.config.__add_tracing_headers}la(){var i=this.ha();return q(i)?(q(this.ua)?this.ua.splice(0,this.ua.length,...i):this.ua=[...i],i.length>0?this.ua:void 0):(q(this.ua)&&this.ua.splice(0),this.ua=i||void 0,this.ua)}Ao(){var i,e;(i=this.oa)==null||i.call(this),(e=this.aa)==null||e.call(this),this.oa=void 0,this.aa=void 0}startIfEnabledOrStop(){this.la()?this.lr(this.Ro):this.Ao()}}},Gl=_({surveys:class{get qt(){return this._instance.config}constructor(i){this.ca=void 0,this._surveyManager=null,this.da=!1,this.va=[],this.fa=null,this._instance=i,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this.qt.disable_surveys){var e=i.surveys;if(D(e))return H.warn("Flags not loaded yet. Not loading surveys.");var t=q(e);this.ca=t?e.length>0:e,H.info("flags response received, isSurveysEnabled: "+this.ca),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var i=[],e=0;e<localStorage.length;e++){var t=localStorage.key(e);(t!=null&&t.startsWith(Gs)||t!=null&&t.startsWith("inProgressSurvey_"))&&i.push(t)}i.forEach((s=>localStorage.removeItem(s)))}loadIfEnabled(){if(!this._surveyManager)if(this.da)H.info("Already initializing surveys, skipping...");else if(this.qt.disable_surveys)H.info(cn);else if(this.qt.cookieless_mode&&this._instance.consent.isOptedOut())H.info("Not loading surveys in cookieless mode without consent.");else{var i=$?.__PosthogExtensions__;if(i){if(!y(this.ca)||this.qt.advanced_enable_surveys){var e=this.ca||this.qt.advanced_enable_surveys;this.da=!0;try{var t=i.generateSurveys;if(t)return void this.pa(t,e);var s=i.loadExternalDependency;if(!s)return void this.ga(ir);s(this._instance,"surveys",(r=>{r||!i.generateSurveys?this.ga("Could not load surveys script",r):this.pa(i.generateSurveys,e)}))}catch(r){throw this.ga("Error initializing surveys",r),r}finally{this.da=!1}}}else H.error("PostHog Extensions not found.")}}pa(i,e){this._surveyManager=i(this._instance,e),this._surveyEventReceiver=new Ll(this._instance),H.info("Surveys loaded successfully"),this.ma({isLoaded:!0})}ga(i,e){H.error(i,e),this.ma({isLoaded:!1,error:i})}onSurveysLoaded(i){return this.va.push(i),this._surveyManager&&this.ma({isLoaded:!0}),()=>{this.va=this.va.filter((e=>e!==i))}}getSurveys(i,e){if(e===void 0&&(e=!1),this.qt.disable_surveys)return H.info(cn),i([]);var t,s=this._instance.get_property(Ts);if(s&&!e)return i(s,{isLoaded:!0});typeof Promise<"u"&&this.fa?this.fa.then((r=>{var{surveys:n,context:a}=r;return i(n,a)})):(typeof Promise<"u"&&(this.fa=new Promise((r=>{t=r}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.qt.token),method:"GET",timeout:this.qt.surveys_request_timeout_ms,callback:r=>{var n;this.fa=null;var a=r.statusCode;if(a!==200||!r.json){var o="Surveys API could not be loaded, status: "+a;H.error(o);var l={isLoaded:!1,error:o};return i([],l),void(t==null||t({surveys:[],context:l}))}var c,u=r.json.surveys||[],h=u.filter((p=>(function(g){return!(!g.start_date||g.end_date)}
2)(p)&&((function(g){var f;return!((f=g.conditions)==null||(f=f.events)==null||(f=f.values)==null||!f.length)})(p)||(function(g){var f;return!((f=g.conditions)==null||(f=f.actions)==null||(f=f.values)==null||!f.length)})(p))));h.length>0&&((c=this._surveyEventReceiver)==null||c.register(h)),(n=this._instance.persistence)==null||n.register({[Ts]:u,[tr]:Date.now()});var d={isLoaded:!0};i(u,d),t?.({surveys:u,context:d})}}))}ma(i){for(var e of this.va)try{if(!i.isLoaded)return e([],i);this.getSurveys(e)}catch(t){H.error("Error in survey callback",t)}}getActiveMatchingSurveys(i,e){if(e===void 0&&(e=!1),!D(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(i,e);H.warn("init was not called")}ya(i){var e=null;return this.getSurveys((t=>{var s;e=(s=t.find((r=>r.id===i)))!==null&&s!==void 0?s:null})),e}ba(i){if(D(this._surveyManager))return{eligible:!1,reason:ns};var e=typeof i=="string"?this.ya(i):i;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(i){if(D(this._surveyManager))return H.warn("init was not called"),{visible:!1,disabledReason:ns};var e=this.ba(i);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(i,e){return D(this._surveyManager)?(H.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:ns})):new Promise((t=>{this.getSurveys((s=>{var r,n=(r=s.find((o=>o.id===i)))!==null&&r!==void 0?r:null;if(n){var a=this.ba(n);t({visible:a.eligible,disabledReason:a.reason})}else t({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(i,e,t){var s;if(D(this._surveyManager))H.warn("init was not called");else{var r=typeof i=="string"?this.ya(i):i;if(r!=null&&r.id)if(xl.includes(r.type)){var n=w?.querySelector(e);if(n)return(s=r.appearance)!=null&&s.surveyPopupDelaySeconds?(H.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var a,o;H.info("Rendering survey "+r.id+" with delay of "+((a=r.appearance)==null?void 0:a.surveyPopupDelaySeconds)+" seconds"),(o=this._surveyManager)==null||o.renderSurvey(r,n,t),H.info("Survey "+r.id+" rendered")}),1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,t);H.warn("Survey element not found")}else H.warn("Surveys of type "+r.type+" cannot be rendered in the app");else H.warn("Survey not found")}}displaySurvey(i,e){var t;if(D(this._surveyManager))H.warn("init was not called");else{var s=this.ya(i);if(s){var r=s;if((t=s.appearance)!=null&&t.surveyPopupDelaySeconds&&e.ignoreDelay&&(r=_({},s,{appearance:_({},s.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==Ns.Popover&&e.initialResponses&&H.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var n=this.canRenderSurvey(s);if(!n.visible)return void H.warn("Survey is not eligible to be displayed: ",n.disabledReason)}e.displayType!==Ns.Inline?this._surveyManager.handlePopoverSurvey(r,e):this.renderSurvey(r,e.selector,e.properties)}else H.warn("Survey not found")}}cancelPendingSurvey(i){D(this._surveyManager)?H.warn("init was not called"):this._surveyManager.cancelSurvey(i)}handlePageUnload(){var i;(i=this._surveyManager)==null||i.handlePageUnload()}}},Ai),Vl={toolbar:class{constructor(i){this.instance=i}_a(i){$.ph_toolbar_state=i}wa(){var i;return(i=$.ph_toolbar_state)!==null&&i!==void 0?i:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i,e,t){if(i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),ea(this.instance.config)||!v||!w)return!1;i=i??v.location,t=t??v.history;try{if(!e){try{v.localStorage.setItem("test","test"),v.localStorage.removeItem("test")}catch{return!1}e=v?.localStorage}var s,r=ql||$i(i.hash,"__posthog")||$i(i.hash,"state"),n=r?Fr((()=>JSON.parse(atob(decodeURIComponent(r)))))||Fr((()=>JSON.parse(decodeURIComponent(r)))):null;return n&&n.action==="ph_authorize"?((s=n).source="url",s&&Object.keys(s).length>0&&(n.desiredHash?i.hash=n.desiredHash:t?t.replaceState(t.state,"",i.pathname+i.search):i.hash="")):((s=JSON.parse(e.getItem(hn)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch{return!1}}xa(i){var e=$.ph_load_toolbar||$.ph_load_editor;!D(e)&&Le(e)?e(i,this.instance):dn.warn("No toolbar load function found")}loadToolbar(i){var e=!(w==null||!w.getElementById(Jn));if(!v||e)return!1;var t=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,s=_({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},t?{instrument:!1}:{});if(v.localStorage.setItem(hn,JSON.stringify(_({},s,{source:void 0}))),this.wa()===2)this.xa(s);else if(this.wa()===0){var r;this._a(1),(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"toolbar",(n=>{if(n)return dn.error("[Toolbar] Failed to load",n),void this._a(0);this._a(2),this.xa(s)})),J(v,"turbolinks:load",(()=>{this._a(0),this.loadToolbar(s)}))}return!0}Sa(i){return this.loadToolbar(i)}maybeLoadEditor(i,e,t){return i===void 0&&(i=void 0),e===void 0&&(e=void 0),t===void 0&&(t=void 0),this.maybeLoadToolbar(i,e,t)}}},Wl=_({experiments:re},Ai),Yl={conversations:class{constructor(i){this.ka=void 0,this._conversationsManager=null,this.Ca=!1,this.Ia=null,this._instance=i}initialize(){this.loadIfEnabled()}onRemoteConfig(i){if(!this._instance.config.disable_conversations){var e=i.conversations;D(e)||(Te(e)?this.ka=e:(this.ka=e.enabled,this.Ia=e),this.loadIfEnabled())}}reset(){var i;(i=this._conversationsManager)==null||i.reset(),this._conversationsManager=null,this.ka=void 0,this.Ia=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ca||this._instance.config.disable_conversations||ea(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var i=$?.__PosthogExtensions__;if(i&&!y(this.ka)&&this.ka)if(this.Ia&&this.Ia.token){this.Ca=!0;try{var e=i.initConversations;if(e)return this.Ta(e),void(this.Ca=!1);var t=i.loadExternalDependency;if(!t)return void this.Ea(ir);t(this._instance,"conversations",(s=>{s||!i.initConversations?this.Ea("Could not load conversations script",s):this.Ta(i.initConversations),this.Ca=!1}))}catch(s){this.Ea("Error initializing conversations",s),this.Ca=!1}}else be.error("Conversations enabled but missing token in remote config.")}}Ta(i){if(this.Ia)try{this._conversationsManager=i(this.Ia,this._instance),be.info("Conversations loaded successfully")}catch(e){this.Ea("Error completing conversations initialization",e)}else be.error("Cannot complete initialization: remote config is null")}Ea(i,e){be.error(i,e),this._conversationsManager=null,this.Ca=!1}show(){this._conversationsManager?this._conversationsManager.show():be.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.ka===!0&&!_e(this._conversationsManager)}isVisible(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&i!==void 0&&i}sendMessage(i,e,t){var s=this;return ve((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(i,e,t):(be.warn(Xe),null)}))()}getMessages(i,e){var t=this;return ve((function*(){return t._conversationsManager?t._conversationsManager.getMessages(i,e):(be.warn(Xe),null)}))()}markAsRead(i){var e=this;return ve((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(i):(be.warn(Xe),null)}))()}getTickets(i){var e=this;return ve((function*(){return e._conversationsManager?e._conversationsManager.getTickets(i):(be.warn(Xe),null)}))()}requestRestoreLink(i){var e=this;return ve((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(i):(be.warn(Xe),null)}))()}restoreFromToken(i){var e=this;return ve((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(i):(be.warn(Xe),null)}))()}restoreFromUrlToken(){var i=this;return ve((function*(){return i._conversationsManager?i._conversationsManager.restoreFromUrlToken():(be.warn(Xe),null)}))()}getCurrentTicketId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&i!==void 0?i:null}getWidgetSessionId(){var i,e;return(i=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&i!==void 0?i:null}On(){var i;(i=this._conversationsManager)==null||i.setIdentity()}Ln(){var i;(i=this._conversationsManager)==null||i.clearIdentity()}}},Xl={logs:class{constructor(i){var e;this.Ma=!1,this.Ra=!1,this.Gt=W("[logs]"),this.Pa=[],this.Oa=0,this.La=0,this.Fa=!1,this._instance=i,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.Ma=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(i){var e,t=(e=i.logs)==null?void 0:e.captureConsoleLogs;!D(t)&&t&&(this.Ma=!0,this.loadIfEnabled())}reset(){this.Pa=[],this.ii&&(clearTimeout(this.ii),this.ii=void 0),this.Oa=0,this.La=0,this.Fa=!1}loadIfEnabled(){if(this.Ma&&!this.Ra){var i=$?.__PosthogExtensions__;if(i){var e=i.loadExternalDependency;e?e(this._instance,"logs",(t=>{var s;t||(s=i.logs)==null||!s.initializeLogs?this.Gt.error("Could not load logs script",t):(i.logs.initializeLogs(this._instance),this.Ra=!0)})):this.Gt.error(ir)}else this.Gt.error("PostHog Extensions not found.")}}captureLog(i){var e,t,s,r,n,a;if(this._instance.is_capturing())if(i&&i.body){var o=(e=(t=this._instance.config.logs)==null?void 0:t.flushIntervalMs)!==null&&e!==void 0?e:3e3,l=(s=(r=this._instance.config.logs)==null?void 0:r.maxLogsPerInterval)!==null&&s!==void 0?s:1e3,c=Date.now();if(o>
2c-this.La||(this.La=c,this.Oa=0,this.Fa=!1),l>this.Oa){this.Oa++;var u=(function(h,d){var p=h.level||"info",{text:g,number:f}=jn[p]||ro,T=String(Date.now())+"000000",P={};d.distinctId&&(P.posthogDistinctId=d.distinctId),d.sessionId&&(P.sessionId=d.sessionId),d.currentUrl&&(P["url.full"]=d.currentUrl),d.screenName&&(P["screen.name"]=d.screenName),d.appState&&(P["app.state"]=d.appState),d.activeFeatureFlags&&d.activeFeatureFlags.length>0&&(P.feature_flags=d.activeFeatureFlags);var R=_({},P,h.attributes||{}),C={timeUnixNano:T,observedTimeUnixNano:T,severityNumber:f,severityText:g,body:{stringValue:h.body},attributes:kr(R)};return h.trace_id&&(C.traceId=h.trace_id),h.span_id&&(C.spanId=h.span_id),y(h.trace_flags)||(C.flags=h.trace_flags),C})(i,this.Aa());this.Pa.push({record:u}),((n=(a=this._instance.config.logs)==null?void 0:a.maxBufferSize)!==null&&n!==void 0?n:100)>this.Pa.length?this.Na():this.flushLogs()}else this.Fa||(this.Gt.warn("captureLog dropping logs: exceeded "+l+" logs per "+o+"ms"),this.Fa=!0)}else this.Gt.warn("captureLog requires a body")}get logger(){return this.Da||(this.Da={trace:(i,e)=>this.captureLog({body:i,level:"trace",attributes:e}),debug:(i,e)=>this.captureLog({body:i,level:"debug",attributes:e}),info:(i,e)=>this.captureLog({body:i,level:"info",attributes:e}),warn:(i,e)=>this.captureLog({body:i,level:"warn",attributes:e}),error:(i,e)=>this.captureLog({body:i,level:"error",attributes:e}),fatal:(i,e)=>this.captureLog({body:i,level:"fatal",attributes:e})}),this.Da}flushLogs(i){if(this.ii&&(clearTimeout(this.ii),this.ii=void 0),this.Pa.length!==0){var e=this.Pa;this.Pa=[];var t=this._instance.config.logs,s=_({"service.name":t?.serviceName||"unknown_service"},t?.environment&&{"deployment.environment":t.environment},t?.serviceVersion&&{"service.version":t.serviceVersion},t?.resourceAttributes),r=(function(a,o,l,c){return{resourceLogs:[{resource:{attributes:kr(o)},scopeLogs:[{scope:{name:l,version:c},logRecords:a}]}]}})(e.map((a=>a.record)),s,Q.LIB_NAME,Q.LIB_VERSION),n=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.fn({method:"POST",url:n,data:r,compression:"best-available",batchKey:"logs",transport:i})}}Na(){var i,e;this.ii||(this.ii=setTimeout((()=>{this.ii=void 0,this.flushLogs()}),(i=(e=this._instance.config.logs)==null?void 0:e.flushIntervalMs)!==null&&i!==void 0?i:3e3))}Aa(){var i,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:t}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=t}if($!=null&&(i=$.location)!=null&&i.href&&(e.currentUrl=$.location.href),this._instance.featureFlags){var s=this._instance.featureFlags.getFlags();s&&s.length>0&&(e.activeFeatureFlags=s)}return e}}},Jl=_({},Ai,Nl,jl,Hl,Ul,Bl,Gl,zl,Vl,Wl,Yl,Xl);we.__defaultExtensionClasses=_({},Jl);var Kl=(function(){Q.SDK_DIST_CHANNEL="npm";var i=Ht[ut]=new we;return(function(){function e(){e.done||(e.done=!0,Oa=!1,B(Ht,(function(t){t._dom_loaded()})))}w!=null&&w.addEventListener?w.readyState==="complete"?e():J(w,"DOMContentLoaded",e,{capture:!1}):v&&b.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),i})();export{Pe as Compression,Ns as DisplaySurveyType,we as PostHog,nl as ProductTourEventName,Nr as ProductTourEventProperties,At as SurveyEventName,Ji as SurveyEventProperties,Et as SurveyEventType,Xi as SurveyType,Kl as default,Kl as posthog};

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.