posthog-js 1.372.4 → 1.372.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.js CHANGED
@@ -1,2 +1,2 @@
1
- var t="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:t;"undefined"==typeof self&&(e.self=e),"undefined"==typeof File&&(e.File=function(){});var i=null==e?void 0:e.navigator,r=null==e?void 0:e.document,s=null==e?void 0:e.location,n=null==e?void 0:e.fetch,o=null!=e&&e.XMLHttpRequest&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,l=null==e?void 0:e.CompressionStream,u=null==i?void 0:i.userAgent,h=null!=t?t:{},d="1.372.4",v={DEBUG:!1,LIB_VERSION:d,LIB_NAME:"web",JS_SDK_VERSION:d};function c(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(r,s)}function p(t){return function(){var e=this,i=arguments;return new Promise((function(r,s){var n=t.apply(e,i);function o(t){c(n,r,s,o,a,"next",t)}function a(t){c(n,r,s,o,a,"throw",t)}o(void 0)}))}}function f(){return f=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},f.apply(null,arguments)}function _(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}function g(){return g=p((function*(t,e,i){void 0===e&&(e=!0);try{var r=new CompressionStream("gzip"),s=r.writable.getWriter(),n=s.write((new TextEncoder).encode(t)).then((()=>s.close())).catch(function(){var t=p((function*(t){try{yield s.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),o=new Response(r.readable).blob(),[a]=yield Promise.all([o,n]);return a}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),g.apply(this,arguments)}var m=["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"],b=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return m.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))},y=["$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"];function w(t,e){return-1!==t.indexOf(e)}var x=function(t){return t.trim()},E=function(t){return t.replace(/^\$/,"")},S=Object.prototype,T=S.hasOwnProperty,k=S.toString,R=Array.isArray||function(t){return"[object Array]"===k.call(t)},P=t=>"function"==typeof t,O=t=>t===Object(t)&&!R(t),I=t=>{if(O(t)){for(var e in t)if(T.call(t,e))return!1;return!0}return!1},C=t=>void 0===t,F=t=>"[object String]"==k.call(t),A=t=>F(t)&&0===t.trim().length,M=t=>null===t,D=t=>C(t)||M(t),L=t=>"[object Number]"==k.call(t)&&t==t,U=t=>L(t)&&t>0,N=t=>"[object Boolean]"===k.call(t),j=t=>t instanceof FormData,z=t=>w(y,t);function B(t){return null===t||"object"!=typeof t}function H(t,e){return{}.toString.call(t)==="[object "+e+"]"}function q(t){return"undefined"!=typeof Event&&function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Event)}var V=[!0,"true",1,"1","yes"],W=t=>w(V,t),G=[!1,"false",0,"0","no"];function Y(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),L(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),Y(s||i,e,i,r))}class J{constructor(t){this.$t={},this.zt=t.zt,this.Ut=Y(t.bucketSize,0,100,t.Gt),this.Wt=Y(t.refillRate,0,this.Ut,t.Gt),this.Xt=Y(t.refillInterval,0,864e5,t.Gt)}Jt(t,e){var i=Math.floor((e-t.lastAccess)/this.Xt);i>0&&(t.tokens=Math.min(t.tokens+i*this.Wt,this.Ut),t.lastAccess=t.lastAccess+i*this.Xt)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.$t[r];return s?this.Jt(s,i):this.$t[r]=s={tokens:this.Ut,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.zt)||e.call(this,t)),0===s.tokens)}stop(){this.$t={}}}var K,X,Q,Z="Mobile",tt="iOS",et="Android",it="Tablet",rt=et+" "+it,st="iPad",nt="Apple",ot=nt+" Watch",at="Safari",lt="BlackBerry",ut="Samsung",ht=ut+"Browser",dt=ut+" Internet",vt="Chrome",ct=vt+" OS",pt=vt+" "+tt,ft="Internet Explorer",_t=ft+" "+Z,gt="Opera",mt=gt+" Mini",bt="Edge",yt="Microsoft "+bt,wt="Firefox",xt=wt+" "+tt,Et="Nintendo",St="PlayStation",$t="Xbox",Tt=et+" "+Z,kt=Z+" "+at,Rt="Windows",Pt=Rt+" Phone",Ot="Nokia",It="Ouya",Ct="Generic",Ft=Ct+" "+Z.toLowerCase(),At=Ct+" "+it.toLowerCase(),Mt="Konqueror",Dt="(\\d+(\\.\\d+)?)",Lt=new RegExp("Version/"+Dt),Ut=new RegExp($t,"i"),Nt=new RegExp(St+" \\w+","i"),jt=new RegExp(Et+" \\w+","i"),zt=new RegExp(lt+"|PlayBook|BB10","i"),Bt={"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"},Ht=function(t,e){return e=e||"",w(t," OPR/")&&w(t,"Mini")?mt:w(t," OPR/")?gt:zt.test(t)?lt:w(t,"IE"+Z)||w(t,"WPDesktop")?_t:w(t,ht)?dt:w(t,bt)||w(t,"Edg/")?yt:w(t,"FBIOS")?"Facebook "+Z:w(t,"UCWEB")||w(t,"UCBrowser")?"UC Browser":w(t,"CriOS")?pt:w(t,"CrMo")||w(t,vt)?vt:w(t,et)&&w(t,at)?Tt:w(t,"FxiOS")?xt:w(t.toLowerCase(),Mt.toLowerCase())?Mt:((t,e)=>e&&w(e,nt)||function(t){return w(t,at)&&!w(t,vt)&&!w(t,et)}(t))(t,e)?w(t,Z)?kt:at:w(t,wt)?wt:w(t,"MSIE")||w(t,"Trident/")?ft:w(t,"Gecko")?wt:""},qt={[_t]:[new RegExp("rv:"+Dt)],[yt]:[new RegExp(bt+"?\\/"+Dt)],[vt]:[new RegExp("("+vt+"|CrMo)\\/"+Dt)],[pt]:[new RegExp("CriOS\\/"+Dt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Dt)],[at]:[Lt],[kt]:[Lt],[gt]:[new RegExp("(Opera|OPR)\\/"+Dt)],[wt]:[new RegExp(wt+"\\/"+Dt)],[xt]:[new RegExp("FxiOS\\/"+Dt)],[Mt]:[new RegExp("Konqueror[:/]?"+Dt,"i")],[lt]:[new RegExp(lt+" "+Dt),Lt],[Tt]:[new RegExp("android\\s"+Dt,"i")],[dt]:[new RegExp(ht+"\\/"+Dt)],[ft]:[new RegExp("(rv:|MSIE )"+Dt)],Mozilla:[new RegExp("rv:"+Dt)]},Vt=function(t,e){var i=Ht(t,e),r=qt[i];if(C(r))return null;for(var s=0;r.length>s;s++){var n=t.match(r[s]);if(n)return parseFloat(n[n.length-2])}return null},Wt=[[new RegExp($t+"; "+$t+" (.*?)[);]","i"),t=>[$t,t&&t[1]||""]],[new RegExp(Et,"i"),[Et,""]],[new RegExp(St,"i"),[St,""]],[zt,[lt,""]],[new RegExp(Rt,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Pt,""];if(new RegExp(Z).test(e)&&!/IEMobile\b/.test(e))return[Rt+" "+Z,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Bt[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[Rt,r]}return[Rt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[tt,[t[3],t[4],t[5]||"0"].join(".")]:[tt,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=C(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+et+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+et+")","i"),t=>t&&t[2]?[et,[t[2],t[3],t[4]||"0"].join(".")]:[et,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ct,""]],[/Linux|debian/i,["Linux",""]]],Gt=function(t){return jt.test(t)?Et:Nt.test(t)?St:Ut.test(t)?$t:new RegExp(It,"i").test(t)?It:new RegExp("("+Pt+"|WPDesktop)","i").test(t)?Pt:/iPad/.test(t)?st:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ot:zt.test(t)?lt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Ot,"i").test(t)?Ot:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Z).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?et:rt:new RegExp("(pda|"+Z+")","i").test(t)?Ft:new RegExp(it,"i").test(t)&&!new RegExp(it+" pc","i").test(t)?At:""},Yt=t=>t instanceof Error,Jt={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}},Kt=Jt.info;function Xt(t){if(N(t))return{boolValue:t};if("number"==typeof t)return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if("string"==typeof t)return{stringValue:t};if(R(t))return{arrayValue:{values:t.map((t=>Xt(t)))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}function Qt(t){var e=[];for(var i in t){var r=t[i];M(r)||C(r)||e.push({key:i,value:Xt(r)})}return e}function Zt(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return Q&&i.length===X||(X=i.length,Q=i.reduce(((i,r)=>{K||(K={});var s=K[r];if(s)i[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=e[r];if(l&&u){i[l]=u,K[r]=[l,u];break}}return i}),{})),Q}}class te{constructor(t,e,i){void 0===i&&(i=[]),this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e){void 0===e&&(e={});var i=e&&e.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(t){var e=this;return p((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&R(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t}))()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null==(e=t.syntheticException)?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var i,r;return null!=t.cause&&(i=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),f({},t,{cause:i,stack:r})}applyChunkIds(t,e){return t.map((t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t)))}applyCoercers(t,e){for(var i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var e=this;return p((function*(){var i=t;for(var r of e.modifiers)i=yield r(i);return i}))()}convertToExceptionList(t,e){var i,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(i=e.type)&&void 0!==i?i:"generic",handled:null===(r=e.handled)||void 0===r||r,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});var o=[n];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,f({},e,{handled:!0}))),o}buildParsingContext(t){var e;return{chunkIdMap:Zt(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,i){void 0===i&&(i=0);var r=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(t,e,r);return this.applyCoercers(i,s)}};return f({},e,{syntheticException:0==i?e.syntheticException:void 0,mechanism:t,apply:t=>r(t,i),next:t=>r(t,i+1)})}}var ee="?";function ie(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?ee:i,in_app:!0};return C(r)||(n.lineno=r),C(s)||(n.colno=s),n}var re=(t,e)=>{var i=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return i||r?[-1!==t.indexOf("@")?t.split("@")[0]:ee,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},se=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ne=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,oe=/\((\S*)(?::(\d+))(?::(\d+))\)/,ae=(t,e)=>{var i=se.exec(t);if(i){var[,r,s,n]=i;return ie(e,r,ee,+s,+n)}var o=ne.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=oe.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=re(o[1]||ee,o[2]);return ie(e,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},le=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ue=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,he=(t,e)=>{var i=le.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=ue.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||ee;return[n,s]=re(n,s),ie(e,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},de=/\(error: (.*)\)/;class ve{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=F(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?e+": "+t.message:e}isDOMException(t){return H(t,"DOMException")}isDOMError(t){return H(t,"DOMError")}}class ce{match(t){return(t=>t instanceof Error)(t)}coerce(t,e){return{type:this.getType(t),value:this.getMessage(t,e),stack:this.getStack(t),cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,e){var i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}}class pe{constructor(){}match(t){return H(t,"ErrorEvent")&&null!=t.error}coerce(t,e){var i;return e.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}var fe=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class _e{match(t){return"string"==typeof t}coerce(t,e){var i,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(t){var e="Error",i=t,r=t.match(fe);return r&&(e=r[1],i=r[2]),[e,i]}}var ge=["fatal","error","warning","log","info","debug"];function me(t,e){void 0===e&&(e=40);var i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(e>=s.length)return r===i.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class be{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,r=this.getErrorPropertyFromObject(t);return r?e.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(i=e.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return q(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var e="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(e+=" with message: '"+t.message+"'"),e}if("message"in t&&"string"==typeof t.message)return t.message;var i=this.getObjectClassName(t);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+me(t)}isSeverityLevel(t){return F(t)&&!A(t)&&ge.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(Yt(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class ye{match(t){return q(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+me(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class we{match(t){return B(t)}coerce(t,e){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class xe{match(t){return H(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!q(t))return!1;try{var e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i,r=this.getUnhandledRejectionReason(t);return B(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}:e.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var Ee="$message",Se="$timestamp",$e=new Set([Ee,Se]),Te={enabled:!0,max_bytes:32768};function ke(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:Te.enabled,max_bytes:Pe(t.max_bytes,Te.max_bytes)}:f({},Te)}class Re{constructor(t){this.Kt=[],this.Qt=0,this.Bt=ke(t)}setConfig(t){this.Bt=ke(t),this.er()}add(t){var e=function(t){var e=function(t){var e=new WeakSet;try{return JSON.stringify(t,((t,i)=>{if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Date)return i.toISOString();if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){if(e.has(i))return"[Circular]";e.add(i)}return i}}))}catch(t){return}}(t);if(e)try{var i=JSON.parse(e);if(!O(i))return;var r=i,s=r[Ee],n=r[Se];if(!F(s)||0===s.trim().length)return;if(!F(n)&&!L(n))return;return{step:r,json:e}}catch(t){return}}(t);if(e){var i=function(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var e=encodeURIComponent(t),i=0,r=0;e.length>r;r++)"%"===e[r]?(i+=1,r+=2):i+=1;return i}(e.json);i>this.Bt.max_bytes||(this.Kt.push({step:e.step,bytes:i}),this.Qt+=i,this.er())}}getAttachable(){return this.Kt.map((t=>t.step))}clear(){this.Kt=[],this.Qt=0}size(){return this.Kt.length}er(){for(;this.Qt>this.Bt.max_bytes&&this.Kt.length>0;){var t=this.Kt.shift();t&&(this.Qt-=t.bytes)}}}function Pe(t,e){if(!L(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var Oe=function(e,i){var{debugEnabled:r}=void 0===i?{}:i,s={C(i){if(t&&(v.DEBUG||h.POSTHOG_DEBUG||r)&&!C(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[i]?t.console[i].__rrweb_original__:t.console[i]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(e,...o)}},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.C("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.C("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.C("error",...e)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,i)=>Oe(e+" "+t,i)};return s},Ie=Oe("[PostHog.js]"),Ce=Ie.createLogger,Fe=Ce("[ExternalScriptsLoader]"),Ae=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return Fe.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=null==r?void 0:r.querySelectorAll("script");if(s)for(var n,o=function(){if(s[a].src===e){var t=s[a];return t.__posthog_loading_callback_fired?{v:i()}:(t.addEventListener("load",(e=>{t.__posthog_loading_callback_fired=!0,i(void 0,e)})),t.onerror=t=>i(t),{v:void 0})}},a=0;s.length>a;a++)if(n=o())return n.v;var l=()=>{if(!r)return i("document not found");var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>i(t),t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?l():null==r||r.addEventListener("DOMContentLoaded",l)};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r;if(t.config.__preview_external_dependency_versioned_paths)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var s="/static/"+e+".js?v="+t.version;if("toolbar"===e){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}r=t.requestRouter.endpointFor("assets",s)}Ae(t,r,i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Ae(t,o,i)}},h.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);Ae(t,r,i)};var Me="$people_distinct_id",De="$device_id",Le="__alias",Ue="__timers",Ne="$autocapture_disabled_server_side",je="$heatmaps_enabled_server_side",ze="$exception_capture_enabled_server_side",Be="$error_tracking_suppression_rules",He="$error_tracking_capture_extension_exceptions",qe="$web_vitals_enabled_server_side",Ve="$dead_clicks_enabled_server_side",We="$product_tours_enabled_server_side",Ge="$web_vitals_allowed_metrics",Ye="$session_recording_remote_config",Je="$replay_override_sampling",Ke="$replay_override_linked_flag",Xe="$replay_override_url_trigger",Qe="$replay_override_event_trigger",Ze="$sesid",ti="$session_is_sampled",ei="$enabled_feature_flags",ii="$active_feature_flags",ri="$early_access_features",si="$feature_flag_details",ni="$feature_flag_payloads",oi="$feature_flag_request_id",ai="$override_feature_flags",li="$override_feature_flag_payloads",ui="$stored_person_properties",hi="$stored_group_properties",di="$surveys",vi="$surveys_activated",ci="ph_product_tours",pi="$flag_call_reported",fi="$flag_call_reported_session_id",_i="$feature_flag_errors",gi="$feature_flag_evaluated_at",mi="$user_state",bi="$client_session_props",yi="$capture_rate_limit",wi="$initial_campaign_params",xi="$initial_referrer_info",Ei="$initial_person_info",Si="$epp",$i="__POSTHOG_TOOLBAR__",Ti="$posthog_cookieless",ki="$sdk_debug_extensions_init_method",Ri="$sdk_debug_extensions_init_time_ms",Pi="$sdk_debug_recording_script_not_loaded",Oi="PostHog loadExternalDependency extension not found.",Ii="on_reject",Ci="always",Fi="anonymous",Ai="identified",Mi="identified_only",Di="visibilitychange",Li="beforeunload",Ui="$pageview",Ni="$pageleave",ji="$identify",zi="$groupidentify";function Bi(t,e){R(t)&&t.forEach(e)}function Hi(t,e){if(!D(t))if(R(t))t.forEach(e);else if(j(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)T.call(t,i)&&e(t[i],i)}var qi=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function Vi(t){for(var e=Object.keys(t),i=e.length,r=new Array(i);i--;)r[i]=[e[i],t[e[i]]];return r}var Wi=function(t){try{return t()}catch(t){return}},Gi=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){Ie.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ie.critical(t)}}},Yi=function(t){var e={};return Hi(t,(function(t,i){(F(t)&&t.length>0||L(t))&&(e[i]=t)})),e};var Ji=["herokuapp.com","vercel.app","netlify.app"];function Ki(t){var e=null==t?void 0:t.hostname;if(!F(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of Ji)if(i===r)return!1;return!0}function Xi(t,e,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(e,i,{capture:s,passive:n})}function Qi(t){return"ph_toolbar_internal"===t.name}Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return L(t)&&isFinite(t)&&Math.floor(t)===t});class Zi{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|e>>>8,s[7]=e,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new Zi(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Zi(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class tr{constructor(){this.I=0,this.S=0,this.k=new rr}generate(){var t=this.generateOrAbort();if(C(t)){this.I=0;var e=this.generateOrAbort();if(C(e))throw new Error("Could not generate UUID after timestamp reset");return e}return t}generateOrAbort(){var t=Date.now();if(t>this.I)this.I=t,this.A();else{if(this.I>=t+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return Zi.fromFieldsV7(this.I,Math.trunc(this.S/Math.pow(2,30)),this.S&Math.pow(2,30)-1,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}}var er,ir=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!C(t.crypto)&&crypto.getRandomValues&&(ir=t=>crypto.getRandomValues(t));class rr{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(ir(this.T),this.N=0),this.T[this.N++]}}var sr=()=>nr().toString(),nr=()=>(er||(er=new tr)).generate(),or="",ar=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var lr={R:()=>!!r,B(t){Ie.error("cookieStore error: "+t)},O(t){if(r){try{for(var e=t+"=",i=r.cookie.split(";").filter((t=>t.length)),s=0;i.length>s;s++){for(var n=i[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}},Z(t){var e;try{e=JSON.parse(lr.O(t))||{}}catch(t){}return e},M(t,e,i,s,n){if(r)try{var o="",a="",l=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=r),or)return or;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),s=Math.min(i.length,8),n="dmn_chk_"+sr();!or&&s--;){var o=i.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";e.cookie=a+";max-age=3",e.cookie.includes(n)&&(e.cookie=a+";max-age=0",or=o)}return or}(t);if(!i){var s=(t=>{var e=t.match(ar);return e?e[0]:""})(t);s!==i&&Ie.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(r.location.hostname,s);if(i){var u=new Date;u.setTime(u.getTime()+864e5*i),o="; expires="+u.toUTCString()}n&&(a="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+l+a;return h.length>3686.4&&Ie.warn("cookieStore warning: large cookie, len="+h.length),r.cookie=h,h}catch(t){return}},F(t,e){if(null!=r&&r.cookie)try{lr.M(t,"",-1,e)}catch(t){return}}},ur=null,hr={R(){if(!M(ur))return ur;var e=!0;if(C(t))e=!1;else try{var i="__mplssupport__";hr.M(i,"xyz"),'"xyz"'!==hr.O(i)&&(e=!1),hr.F(i)}catch(t){e=!1}return e||Ie.error("localStorage unsupported; falling back to cookie store"),ur=e,e},B(t){Ie.error("localStorage error: "+t)},O(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){hr.B(t)}return null},Z(t){try{return JSON.parse(hr.O(t))||{}}catch(t){}return null},M(e,i){try{null==t||t.localStorage.setItem(e,JSON.stringify(i))}catch(t){hr.B(t)}},F(e){try{null==t||t.localStorage.removeItem(e)}catch(t){hr.B(t)}}},dr=[De,"distinct_id",Ze,ti,Si,Ei,mi],vr={},cr={R:()=>!0,B(t){Ie.error("memoryStorage error: "+t)},O:t=>vr[t]||null,Z:t=>vr[t]||null,M(t,e){vr[t]=e},F(t){delete vr[t]}},pr=null,fr={R(){if(!M(pr))return pr;if(pr=!0,C(t))pr=!1;else try{var e="__support__";fr.M(e,"xyz"),'"xyz"'!==fr.O(e)&&(pr=!1),fr.F(e)}catch(t){pr=!1}return pr},B(t){Ie.error("sessionStorage error: ",t)},O(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){fr.B(t)}return null},Z(t){try{return JSON.parse(fr.O(t))||null}catch(t){}return null},M(e,i){try{null==t||t.sessionStorage.setItem(e,JSON.stringify(i))}catch(t){fr.B(t)}},F(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){fr.B(t)}}};class _r{constructor(t){this._instance=t}get Bt(){return this._instance.config}get consent(){return this.rr()?0:this.ir}isOptedOut(){return this.Bt.cookieless_mode===Ci||this.isRejected()||-1===this.consent&&this.Bt.cookieless_mode===Ii}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Bt.opt_out_capturing_by_default}optInOut(t){this.nr.M(this.sr,t?1:0,this.Bt.cookie_expiration,this.Bt.cross_subdomain_cookie,this.Bt.secure_cookie)}reset(){this.nr.F(this.sr,this.Bt.cross_subdomain_cookie)}get sr(){var{token:t,opt_out_capturing_cookie_prefix:e,consent_persistence_name:i}=this._instance.config;return i||(e?e+t:"__ph_opt_in_out_"+t)}get ir(){var t=this.nr.O(this.sr);return W(t)?1:w(G,t)?0:-1}get nr(){var t=this.Bt.opt_out_capturing_persistence_type,e="localStorage"===t?hr:lr;if(!this.ar||this.ar!==e){this.ar=e;var i="localStorage"===t?lr:hr;i.O(this.sr)&&(this.ar.O(this.sr)||this.optInOut(W(i.O(this.sr))),i.F(this.sr,this.Bt.cross_subdomain_cookie))}return this.ar}rr(){return!!this.Bt.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,h.doNotTrack].some((t=>W(t)))}}var gr=Ce("[Dead Clicks]"),mr=()=>!0,br=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(Ve)),r=t.instance.config.capture_dead_clicks;return N(r)?r:!!O(r)||i};class yr{get lazyLoadedDeadClicksAutocapture(){return this.lr}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Ve]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.ur((()=>{this.hr()})):this.stop()}ur(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.initDeadClicksAutocapture&&t(),null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?gr.error("failed to load script",e):t()}))}hr(){var t;if(r){if(!this.lr&&null!=(t=h.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=O(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};e.__onCapture=this.onCapture,this.lr=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.lr.start(r),gr.info("starting...")}}else gr.error("`document` not found. Cannot start.")}stop(){this.lr&&(this.lr.stop(),this.lr=void 0,gr.info("stopping..."))}}var wr=Ce("[SegmentIntegration]");var xr="posthog-js";function Er(t,e){var{organization:i,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===e?{}:e;return e=>{var a,l,u,h,d;if("*"!==n&&!n.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,p=(null==(a=e.exception)?void 0:a.values)||[],_=p.map((t=>f({},t,{stacktrace:t.stacktrace?f({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>f({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(l=p[0])?void 0:l.value)||e.message,$exception_type:null==(u=p[0])?void 0:u.type,$exception_level:e.level,$exception_list:_,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(h=p[0])?void 0:h.value)||e.message,$sentry_exception_type:null==(d=p[0])?void 0:d.type,$sentry_tags:e.tags};return i&&r&&(g.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+e.event_id),o&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),e}}class Sr{constructor(t,e,i,r,s,n){this.name=xr,this.setupOnce=function(o){o(Er(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class $r{constructor(t){this.cr=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(Ie.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.dr=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.vr()}vr(){var t;this.pr=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.cr)}destroy(){var t;null==(t=this.pr)||t.call(this),this.pr=void 0}doPageView(e,i){var r,s=this.gr(e,i);return this.dr={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.gr(t,null==(e=this.dr)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.dr)?void 0:t.pageViewId}}gr(t,e){var i=this.dr;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:h}=s;if(!(C(n)||C(o)||C(a)||C(l)||C(u)||C(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var d=n>1?Y(o/n,0,1,Ie):1,v=n>1?Y(a/n,0,1,Ie):1,c=l>1?Y(u/l,0,1,Ie):1,p=l>1?Y(h/l,0,1,Ie):1;r=qi(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var Tr={[Me]:{exposure:"hidden"},[Le]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Ue]:{exposure:"hidden"},[Ne]:{exposure:"event"},[je]:{exposure:"hidden"},[ze]:{exposure:"event"},[Be]:{exposure:"hidden"},[He]:{exposure:"event"},[qe]:{exposure:"event"},[Ve]:{exposure:"event"},[We]:{exposure:"hidden"},[Ge]:{exposure:"event"},[Ye]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Ze]:{exposure:"hidden"},[ti]:{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"},[ei]:{exposure:"derived",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!O(t))return{};for(var e={},i=Object.keys(t),r=0;i.length>r;r++)e["$feature/"+i[r]]=t[i[r]];return e}},[ii]:{exposure:"event"},[ri]:{exposure:"hidden"},[si]:{exposure:"hidden"},[ni]:{exposure:"event"},[oi]:{exposure:"event"},[ai]:{exposure:"event"},[li]:{exposure:"hidden"},[ui]:{exposure:"hidden"},[hi]:{exposure:"hidden"},[di]:{exposure:"hidden"},[vi]:{exposure:"event"},[ci]:{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"},[pi]:{exposure:"hidden"},[fi]:{exposure:"hidden"},[_i]:{exposure:"hidden"},[gi]:{exposure:"hidden"},[mi]:{exposure:"hidden"},[bi]:{exposure:"hidden"},[yi]:{exposure:"hidden"},[wi]:{exposure:"hidden"},[xi]:{exposure:"hidden"},[Ei]:{exposure:"hidden"},[Si]:{exposure:"hidden"},[Je]:{exposure:"event"},[Ke]:{exposure:"event"},[Xe]:{exposure:"event"},[Qe]:{exposure:"event"},[ki]:{exposure:"event"},[Ri]:{exposure:"event"},[Pi]:{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"}},kr=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Rr=t=>{var e=null==r?void 0:r.createElement("a");return C(e)?null:(e.href=t,e)},Pr=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!R(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){Ie.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Or=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],h=0;l.length>h;h++){var d=l[h].split("=");R(d)&&(e.includes(d[0])?u.push(d[0]+"="+i):u.push(l[h]))}var v=a;return null!=o&&(v+="?"+u.join("&")),null!=s&&(v+="#"+s),v},Ir=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},Cr="https?://(.*)",Fr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ar=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Fr],Mr="<masked>",Dr=["li_fat_id"];function Lr(t,e,i){if(!r)return{};var s,n=e?[...Fr,...i||[]]:[],o=Ur(Or(r.URL,n,Mr),t),a=(s={},Hi(Dr,(function(t){var e=lr.O(t);s[t]=e||null})),s);return qi(a,o)}function Ur(t,e){var i=Ar.concat(e||[]),r={};return Hi(i,(function(e){var i=Pr(t,e);r[e]=i||null})),r}function Nr(t){var e=function(t){return t?0===t.search(Cr+"google.([^/?]*)")?"google":0===t.search(Cr+"bing.com")?"bing":0===t.search(Cr+"yahoo.com")?"yahoo":0===t.search(Cr+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!M(e)){s.$search_engine=e;var n=r?Pr(r.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function jr(){return navigator.language||navigator.userLanguage}var zr="$direct";function Br(){return(null==r?void 0:r.referrer)||zr}function Hr(t,e){var i=t?[...Fr,...e||[]]:[],r=null==s?void 0:s.href.substring(0,1e3);return{r:Br().substring(0,1e3),u:r?Or(r,i,Mr):void 0}}function qr(t){var e,{r:i,u:r}=t,s={$referrer:i,$referring_domain:null==i?void 0:i==zr?zr:null==(e=Rr(i))?void 0:e.host};if(r){s.$current_url=r;var n=Rr(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=Ur(r);qi(s,o)}if(i){var a=Nr(i);qi(s,a)}return s}function Vr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function Wr(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var Gr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Yr{constructor(t,e){this.Bt=t,this.props={},this.mr=!1,this.yr=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(t),this.nr=this.br(t),this.load(),t.debug&&Ie.info("Persistence loaded",t.persistence,f({},this.props)),this.update_config(t,t,e),this.save()}isDisabled(){return!!this._r}br(e){-1===Gr.indexOf(e.persistence.toLowerCase())&&(Ie.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var i=function(e){void 0===e&&(e=[]);var i=[...dr,...e];return f({},hr,{Z(t){try{var e={};try{e=lr.Z(t)||{}}catch(t){}var i=qi(e,JSON.parse(hr.O(t)||"{}"));return hr.M(t,i),i}catch(t){}return null},M(t,e,r,s,n,o){try{hr.M(t,e,void 0,void 0,o);var a={};i.forEach((t=>{e[t]&&(a[t]=e[t])})),Object.keys(a).length&&lr.M(t,a,r,s,n,o)}catch(t){hr.B(t)}},F(e,i){try{null==t||t.localStorage.removeItem(e),lr.F(e,i)}catch(t){hr.B(t)}}})}(e.cookie_persisted_properties||[]),r=e.persistence.toLowerCase();return"localstorage"===r&&hr.R()?hr:"localstorage+cookie"===r&&i.R()?i:"sessionstorage"===r&&fr.R()?fr:"memory"===r?cr:"cookie"===r?lr:i.R()?i:lr}wr(t){var e=null!=t?t:this.Bt.feature_flag_cache_ttl_ms;if(!e||0>=e)return!1;var i=this.props[gi];return!i||"number"!=typeof i||Date.now()-i>e}properties(){var t={};return Hi(this.props,((e,i)=>{var r=(t=>{var e=Tr[t];if(e)return e;for(var[i,r]of kr)if(0===t.indexOf(i))return r})(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,i===ei?()=>this.wr():()=>!1))return;r.transformToEventProperties&&qi(t,r.transformToEventProperties(e))}else r&&"event"!==r.exposure||(t[i]=e)})),t}load(){if(!this._r){var t=this.nr.Z(this.yr);t&&(this.props=qi({},t))}}save(){this._r||this.nr.M(this.yr,this.props,this.Ir,this.Cr,this.Sr,this.Bt.debug)}remove(){this.nr.F(this.yr,!1),this.nr.F(this.yr,!0)}clear(){this.remove(),this.props={}}register_once(t,e,i){if(O(t)){C(e)&&(e="None"),this.Ir=C(i)?this.kr:i;var r=!1;if(Hi(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Tr(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(O(t)){this.Ir=C(e)?this.kr:e;var i=!1;if(Hi(t,((e,r)=>{t.hasOwnProperty(r)&&this.props[r]!==e&&(this.Tr(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Ar(t),this.save())}update_campaign_params(){if(!this.mr){var t=Lr(this.Bt.custom_campaign_params,this.Bt.mask_personal_data_properties,this.Bt.custom_personal_data_properties);I(Yi(t))||this.register(t),this.mr=!0}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?Nr(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Br(),$referring_domain:null!=r&&r.referrer&&(null==(t=Rr(r.referrer))?void 0:t.host)||zr},void 0)}set_initial_person_info(){this.props[wi]||this.props[xi]||this.register_once({[Ei]:Hr(this.Bt.mask_personal_data_properties,this.Bt.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Hi([xi,wi],(e=>{var i=this.props[e];i&&Hi(i,(function(e,i){t["$initial_"+E(i)]=e}))}));var e,i,r=this.props[Ei];if(r){var s=(e=qr(r),i={},Hi(e,(function(t,e){i["$initial_"+E(e)]=t})),i);qi(t,s)}return t}safe_merge(t){return Hi(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){if(this.kr=this.Ir=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==e.persistence||!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[])){var r=this.br(t),s=this.props;this.clear(),this.nr=r,this.props=s,this.save()}}set_disabled(t){this._r=t,this._r?this.remove():this.save()}set_cross_subdomain(t){t!==this.Cr&&(this.Cr=t,this.remove(),this.save())}set_secure(t){t!==this.Sr&&(this.Sr=t,this.remove(),this.save())}set_event_timer(t,e){var i=this.props[Ue]||{};i[t]=e,this.Tr(Ue,i),this.save()}remove_event_timer(t){var e=this.props[Ue]||{},i=e[t];return C(i)||(delete e[t],this.Tr(Ue,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Tr(t,e),this.save()}Tr(t,e){this.props[t]=e}Ar(t){delete this.props[t]}}var Jr={Activation:"events",Cancellation:"cancelEvents"},Kr={Button:"button",Tab:"tab",Selector:"selector"},Xr={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},Qr={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Zr={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},ts={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},es={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},is={Once:"once",Recurring:"recurring",Always:"always"},rs={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},ss={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},ns={Popover:"popover",Inline:"inline"},os={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},as={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},ls={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},us=Ce("[RateLimiter]");class hs{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach((t=>{us.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void us.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(yi))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;return l||t||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(yi,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var ds=Ce("[RemoteConfig]");class vs{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=h._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Er(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Rr(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(e){t(e.json)}})}load(){try{if(this.remoteConfig)return ds.info("Using preloaded remote config",this.remoteConfig),this.Nr(this.remoteConfig),void this.Mr();if(this._instance.Fr())return void ds.warn("Remote config is disabled. Falling back to local config.");this.Er((t=>{if(!t)return ds.info("No config found after loading remote JS config. Falling back to JSON."),void this.Rr((t=>{this.Nr(t),this.Mr()}));this.Nr(t),this.Mr()}))}catch(t){ds.error("Error loading remote config",t)}}stop(){this.Or&&(clearInterval(this.Or),this.Or=void 0)}refresh(){this._instance.Fr()||"hidden"===(null==r?void 0:r.visibilityState)||this._instance.reloadFeatureFlags()}Mr(){var t;if(!this.Or){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.Or=setInterval((()=>{this.refresh()}),e))}}Nr(t){var e;t||ds.error("Failed to fetch remote config from PostHog."),this._instance.Nr(null!=t?t:{}),!1!==(null==t?void 0:t.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded())}}var cs=["fatal","error","warning","log","info","debug"],ps={GZipJS:"gzip-js",Base64:"base64"},fs=Uint8Array,_s=Uint16Array,gs=Uint32Array,ms=new fs([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]),bs=new fs([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]),ys=new fs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ws=function(t,e){for(var i=new _s(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new gs(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},xs=ws(ms,2),Es=xs[1];xs[0][28]=258,Es[258]=28;for(var Ss=ws(bs,0)[1],$s=new _s(32768),Ts=0;32768>Ts;++Ts){var ks=(43690&Ts)>>>1|(21845&Ts)<<1;$s[Ts]=((65280&(ks=(61680&(ks=(52428&ks)>>>2|(13107&ks)<<2))>>>4|(3855&ks)<<4))>>>8|(255&ks)<<8)>>>1}var Rs=function(t,e,i){for(var r=t.length,s=0,n=new _s(e);r>s;++s)++n[t[s]-1];var o,a=new _s(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new _s(1<<e);var l=15-e;for(s=0;r>s;++s)if(t[s])for(var u=s<<4|t[s],h=e-t[s],d=a[t[s]-1]++<<h,v=d|(1<<h)-1;v>=d;++d)o[$s[d]>>>l]=u}else for(o=new _s(r),s=0;r>s;++s)o[s]=$s[a[t[s]-1]++]>>>15-t[s];return o},Ps=new fs(288);for(Ts=0;144>Ts;++Ts)Ps[Ts]=8;for(Ts=144;256>Ts;++Ts)Ps[Ts]=9;for(Ts=256;280>Ts;++Ts)Ps[Ts]=7;for(Ts=280;288>Ts;++Ts)Ps[Ts]=8;var Os=new fs(32);for(Ts=0;32>Ts;++Ts)Os[Ts]=5;var Is=Rs(Ps,9,0),Cs=Rs(Os,5,0),Fs=function(t){return(t/8>>0)+(7&t&&1)},As=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof _s?_s:t instanceof gs?gs:fs)(i-e);return r.set(t.subarray(e,i)),r},Ms=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},Ds=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},Ls=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new fs(0),0];if(1==s){var o=new fs(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,h=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=s-1;)a=i[i[d].f>i[u].f?u++:d++],l=i[u!=h&&i[d].f>i[u].f?u++:d++],i[h++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new _s(v+1),p=Us(i[h-1],c,0);if(p>e){r=0;var f=0,_=p-e,g=1<<_;for(n.sort((function(t,e){return c[e.s]-c[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=c[m])break;f+=g-(1<<p-c[m]),c[m]=e}for(f>>>=_;f>0;){var b=n[r].s;e>c[b]?f-=1<<e-c[b]++-1:++r}for(;r>=0&&f;--r){var y=n[r].s;c[y]==e&&(--c[y],++f)}p=e}return[new fs(c),p]},Us=function(t,e,i){return-1==t.s?Math.max(Us(t.l,e,i+1),Us(t.r,e,i+1)):e[t.s]=i},Ns=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new _s(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[i.subarray(0,r),e]},js=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},zs=function(t,e,i){var r=i.length,s=Fs(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},Bs=function(t,e,i,r,s,n,o,a,l,u,h){Ms(e,h++,i),++s[256];for(var d=Ls(s,15),v=d[0],c=d[1],p=Ls(n,15),f=p[0],_=p[1],g=Ns(v),m=g[0],b=g[1],y=Ns(f),w=y[0],x=y[1],E=new _s(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;w.length>S;++S)E[31&w[S]]++;for(var T=Ls(E,7),k=T[0],R=T[1],P=19;P>4&&!k[ys[P-1]];--P);var O,I,C,F,A=u+5<<3,M=js(s,Ps)+js(n,Os)+o,D=js(s,v)+js(n,f)+o+14+3*P+js(E,k)+(2*E[16]+3*E[17]+7*E[18]);if(M>=A&&D>=A)return zs(e,h,t.subarray(l,l+u));if(Ms(e,h,1+(M>D)),h+=2,M>D){O=Rs(v,c,0),I=v,C=Rs(f,_,0),F=f;var L=Rs(k,R,0);for(Ms(e,h,b-257),Ms(e,h+5,x-1),Ms(e,h+10,P-4),h+=14,S=0;P>S;++S)Ms(e,h+3*S,k[ys[S]]);h+=3*P;for(var U=[m,w],N=0;2>N;++N){var j=U[N];for(S=0;j.length>S;++S)Ms(e,h,L[z=31&j[S]]),h+=k[z],z>15&&(Ms(e,h,j[S]>>>5&127),h+=j[S]>>>12)}}else O=Is,I=Ps,C=Cs,F=Os;for(S=0;a>S;++S)if(r[S]>255){var z;Ds(e,h,O[257+(z=r[S]>>>18&31)]),h+=I[z+257],z>7&&(Ms(e,h,r[S]>>>23&31),h+=ms[z]);var B=31&r[S];Ds(e,h,C[B]),h+=F[B],B>3&&(Ds(e,h,r[S]>>>5&8191),h+=bs[B])}else Ds(e,h,O[r[S]]),h+=I[r[S]];return Ds(e,h,O[256]),h+I[256]},Hs=new gs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qs=function(){for(var t=new gs(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),Vs=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Ws(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=qs[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,l,u=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,function(t,e,i,r,s,n){var o=t.length,a=new fs(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var d=h+65535;o>d?u=zs(l,u,t.subarray(h,d)):(l[h]=!0,u=zs(l,u,t.subarray(h,o)))}else{for(var v=Hs[e-1],c=v>>>13,p=8191&v,f=(1<<i)-1,_=new _s(32768),g=new _s(f+1),m=Math.ceil(i/3),b=2*m,y=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<b)&f},w=new gs(25e3),x=new _s(288),E=new _s(32),S=0,T=0,k=(h=0,0),R=0,P=0;o>h;++h){var O=y(h),I=32767&h,C=g[O];if(_[I]=C,g[O]=I,h>=R){var F=o-h;if((S>7e3||k>24576)&&F>423){u=Bs(t,l,0,w,x,E,T,k,P,h-P,u),k=S=T=0,P=h;for(var A=0;286>A;++A)x[A]=0;for(A=0;30>A;++A)E[A]=0}var M=2,D=0,L=p,U=I-C&32767;if(F>2&&O==y(h-U))for(var N=Math.min(c,F)-1,j=Math.min(32767,h),z=Math.min(258,F);j>=U&&--L&&I!=C;){if(t[h+M]==t[h+M-U]){for(var B=0;z>B&&t[h+B]==t[h+B-U];++B);if(B>M){if(M=B,D=U,B>N)break;var H=Math.min(U,B-2),q=0;for(A=0;H>A;++A){var V=h-U+A+32768&32767,W=V-_[V]+32768&32767;W>q&&(q=W,C=V)}}}U+=(I=C)-(C=_[I])+32768&32767}if(D){w[k++]=268435456|Es[M]<<18|Ss[D];var G=31&Es[M],Y=31&Ss[D];T+=ms[G]+bs[Y],++x[257+G],++E[Y],R=h+M,++S}else w[k++]=t[h],++x[t[h]]}}u=Bs(t,l,!0,w,x,E,T,k,P,h-P,u)}return As(a,0,r+Fs(u)+s)}(n=t,null==(o=e).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),h=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&Vs(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(u,e),Vs(u,h-8,i.d()),Vs(u,h-4,r),u}var Gs=!!o||!!n,Ys="text/plain",Js=!1,Ks=function(t,e,i){var r;void 0===i&&(i=!0);var[s,n]=t.split("?"),o=f({},e),a=null!==(r=null==n?void 0:n.split("&").map((t=>{var e,[r,s]=t.split("="),n=i&&null!==(e=o[r])&&void 0!==e?e:s;return delete o[r],r+"="+n})))&&void 0!==r?r:[],l=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return Hi(t,(function(t,e){C(t)||C(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(o);return l&&a.push(l),s+"?"+a.join("&")},Xs=(t,e)=>JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e),Qs=t=>{if(t.tr)return t.tr;var{data:e,compression:i}=t;if(e){if(i===ps.GZipJS){var r=Ws(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new fs(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new fs(s+8+(i-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return As(r,0,s)}(Xs(e)),{mtime:0});return{contentType:Ys,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===ps.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(Xs(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:Xs(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Xs(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Zs=function(){var t=p((function*(t){var e=Xs(t.data),i=yield function(t,e,i){return g.apply(this,arguments)}(e,v.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return f({},t,{tr:{contentType:Ys,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),tn=(t,e)=>Ks(t,{_:(new Date).getTime().toString(),ver:v.JS_SDK_VERSION,compression:e}),en=[];n&&en.push({transport:"fetch",method(t){var e,i,{contentType:r,body:s,estimatedSize:o}=null!==(e=Qs(t))&&void 0!==e?e:{},l=new Headers;Hi(t.headers,(function(t,e){l.append(e,t)})),r&&l.append("Content-Type",r);var u=t.url,h=null;if(a){var d=new a;h={signal:d.signal,timeout:setTimeout((()=>d.abort()),t.timeout)}}n(u,f({method:(null==t?void 0:t.method)||"GET",headers:l,keepalive:"POST"===t.method&&52428.8>(o||0),body:s,signal:null==(i=h)?void 0:i.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){Ie.error(t)}null==t.callback||t.callback(r)})))).catch((e=>{Ie.error(e),null==t.callback||t.callback({statusCode:0,error:e})})).finally((()=>h?clearTimeout(h.timeout):null))}}),o&&en.push({transport:"XHR",method(t){var e,i=new o;i.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(e=Qs(t))&&void 0!==e?e:{};Hi(t.headers,(function(t,e){i.setRequestHeader(e,t)})),r&&i.setRequestHeader("Content-Type",r),t.timeout&&(i.timeout=t.timeout),t.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(s)}}),null!=i&&i.sendBeacon&&en.push({transport:"sendBeacon",method(t){var e=Ks(t.url,{beacon:"1"});try{var r,{contentType:s,body:n}=null!==(r=Qs(t))&&void 0!==r?r:{};if(!n)return;var o=n instanceof Blob?n:new Blob([n],{type:s});i.sendBeacon(e,o)}catch(t){}}});var rn=3e3;class sn{constructor(t,e){this.Pr=!0,this.Lr=[],this.Dr=Y((null==e?void 0:e.flush_interval_ms)||rn,250,5e3,Ie.createLogger("flush interval"),rn),this.Br=t}enqueue(t){this.Lr.push(t),this.jr||this.$r()}unload(){this.qr();var t=this.Lr.length>0?this.Zr():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Br(f({},t,{transport:"sendBeacon"}))}))}enable(){this.Pr=!1,this.$r()}$r(){var t=this;this.Pr||(this.jr=setTimeout((()=>{if(this.qr(),this.Lr.length>0){var e=this.Zr(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&R(i.data)&&Hi(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Br(i)};for(var r in e)i()}}),this.Dr))}qr(){clearTimeout(this.jr),this.jr=void 0}Zr(){var t={};return Hi(this.Lr,(e=>{var i,r=e,s=(r?r.batchKey:null)||r.url;C(t[s])&&(t[s]=f({},r,{data:[]})),null==(i=t[s].data)||i.push(r.data)})),this.Lr=[],t}}var nn=["retriesPerformedSoFar"];class on{constructor(e){this.Vr=!1,this.Hr=3e3,this.Lr=[],this._instance=e,this.Lr=[],this.zr=!0,!C(t)&&"onLine"in t.navigator&&(this.zr=t.navigator.onLine,this.Ur=()=>{this.zr=!0,this.Yr()},this.Gr=()=>{this.zr=!1},Xi(t,"online",this.Ur),Xi(t,"offline",this.Gr))}get length(){return this.Lr.length}retriableRequest(t){var{retriesPerformedSoFar:e}=t,i=_(t,nn);U(e)&&(i.url=Ks(i.url,{retry_count:e})),this._instance._send_request(f({},i,{callback:t=>{200===t.statusCode||t.statusCode>=400&&500>t.statusCode||(null!=e?e:0)>=10?null==i.callback||i.callback(t):this.Wr(f({retriesPerformedSoFar:e},i))}}))}Wr(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this.Lr.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),Ie.warn(s),this.Vr||(this.Vr=!0,this.Xr())}Xr(){if(this.Jr&&clearTimeout(this.Jr),0===this.Lr.length)return this.Vr=!1,void(this.Jr=void 0);this.Jr=setTimeout((()=>{this.zr&&this.Lr.length>0&&this.Yr(),this.Xr()}),this.Hr)}Yr(){var t=Date.now(),e=[],i=this.Lr.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.Lr=e,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Jr&&(clearTimeout(this.Jr),this.Jr=void 0),this.Vr=!1,C(t)||(this.Ur&&(t.removeEventListener("online",this.Ur),this.Ur=void 0),this.Gr&&(t.removeEventListener("offline",this.Gr),this.Gr=void 0)),this.Lr))try{this._instance._send_request(f({},e,{transport:"sendBeacon"}))}catch(t){Ie.error(t)}this.Lr=[]}}class an{constructor(t){this.Kr=()=>{var t,e,i,r;this.Qr||(this.Qr={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Qr.lastScrollY=Math.ceil(n),this.Qr.maxScrollY=Math.max(n,null!==(t=this.Qr.maxScrollY)&&void 0!==t?t:0),this.Qr.maxScrollHeight=Math.max(o,null!==(e=this.Qr.maxScrollHeight)&&void 0!==e?e:0),this.Qr.lastContentY=a,this.Qr.maxContentY=Math.max(a,null!==(i=this.Qr.maxContentY)&&void 0!==i?i:0),this.Qr.maxContentHeight=Math.max(l,null!==(r=this.Qr.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get ei(){return this._instance.config.scroll_root_selector}getContext(){return this.Qr}resetContext(){var t=this.Qr;return setTimeout(this.Kr,0),t}startMeasuringScrollPosition(){Xi(t,"scroll",this.Kr,{capture:!0}),Xi(t,"scrollend",this.Kr,{capture:!0}),Xi(t,"resize",this.Kr)}scrollElement(){if(!this.ei)return null==t?void 0:t.document.documentElement;var e=R(this.ei)?this.ei:[this.ei];for(var i of e){var r=null==t?void 0:t.document.querySelector(i);if(r)return r}}scrollY(){if(this.ei){var e=this.scrollElement();return e&&e.scrollTop||0}return t&&(t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop)||0}scrollX(){if(this.ei){var e=this.scrollElement();return e&&e.scrollLeft||0}return t&&(t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft)||0}}var ln=t=>Hr(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class un{constructor(t,e,i,r){this.ti=t=>{var e=this.ri();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.ii(this._instance)};this.ni.register({[bi]:i})}},this._instance=t,this.si=e,this.ni=i,this.ii=r||ln,this.si.onSessionId(this.ti)}ri(){return this.ni.props[bi]}getSetOnceProps(){var t,e=null==(t=this.ri())?void 0:t.props;return e?"r"in e?qr(e):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return Hi(Yi(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+E(i)]=e})),t}}class hn{constructor(){this.oi={}}on(t,e){return this.oi[t]||(this.oi[t]=[]),this.oi[t].push(e),()=>{this.oi[t]=this.oi[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.oi[t]||[])i(e);for(var r of this.oi["*"]||[])r(t,e)}}var dn=Ce("[SessionId]");class vn{on(t,e){return this.ai.on(t,e)}constructor(t,e,i){var r;if(this.li=[],this.ui=void 0,this.ai=new hn,this.hi=(t,e)=>!(!U(t)||!U(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===Ci)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Bt=t.config,this.ni=t.persistence,this.ci=void 0,this.di=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.vi=e||sr,this.fi=i||sr;var s=this.Bt.persistence_name||this.Bt.token;if(this._sessionTimeoutMs=1e3*Y(this.Bt.session_idle_timeout_seconds||1800,60,36e3,dn.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.pi(),this.gi="ph_"+s+"_window_id",this.mi="ph_"+s+"_primary_window_exists",this.yi()){var n=fr.Z(this.gi),o=fr.Z(this.mi);n&&!o?this.ci=n:fr.F(this.gi),fr.M(this.mi,!0)}if(null!=(r=this.Bt.bootstrap)&&r.sessionID)try{var a=(t=>{var e=this.Bt.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.bi(this.Bt.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){dn.error("Invalid sessionID in bootstrap",t)}this.wi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return C(this.li)&&(this.li=[]),this.li.push(t),this.di&&t(this.di,this.ci),()=>{this.li=this.li.filter((e=>e!==t))}}yi(){return"memory"!==this.Bt.persistence&&!this.ni._r&&fr.R()}Ii(t){t!==this.ci&&(this.ci=t,this.yi()&&fr.M(this.gi,t))}Ci(){return this.ci?this.ci:this.yi()?fr.Z(this.gi):null}bi(t,e,i){t===this.di&&e===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.di=t,this.ni.register({[Ze]:[e,t,i]}))}Si(){var t=this.ni.props[Ze];return R(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.bi(null,null,null)}destroy(){clearTimeout(this.xi),this.xi=void 0,this.ui&&t&&(t.removeEventListener(Li,this.ui,{capture:!1}),this.ui=void 0),this.li=[]}wi(){this.ui=()=>{this.yi()&&fr.F(this.mi)},Xi(t,Li,this.ui,{capture:!1})}checkAndGetSessionAndWindowId(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=null),this.Bt.cookieless_mode===Ci)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=e||(new Date).getTime(),[r,s,n]=this.Si(),o=this.Ci(),a=U(n)&&Math.abs(i-n)>864e5,l=!1,u=!s,h=!u&&!t&&this.hi(i,r);u||h||a?(s=this.vi(),o=this.fi(),dn.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this.fi(),l=!0);var d=U(r)&&t&&!a?r:i,v=U(n)?n:(new Date).getTime();return this.Ii(o),this.bi(s,d,v),t||this.pi(),l&&this.li.forEach((t=>t(s,o,l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:v,changeReason:l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}pi(){clearTimeout(this.xi),this.xi=setTimeout((()=>{var[t]=this.Si();if(this.hi((new Date).getTime(),t)){var e=this.di;this.resetSessionId(),this.ai.emit("forcedIdleReset",{idleSessionId:e})}}),1.1*this.sessionTimeoutMs)}}var cn=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&b(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>b(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver},pn=function(t,e){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}};function fn(t,e,i){return Xs({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var _n={exact:(t,e)=>e.some((e=>t.some((t=>e===t)))),is_not:(t,e)=>e.every((e=>t.every((t=>e!==t)))),regex:(t,e)=>e.some((e=>t.some((t=>pn(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!pn(e,t))))),icontains:(t,e)=>e.map(gn).some((e=>t.map(gn).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(gn).every((e=>t.map(gn).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i<parseFloat(t)))}))},gn=t=>t.toLowerCase();function mn(t,e){return!t||Object.entries(t).every((t=>{var[i,r]=t,s=null==e?void 0:e[i];if(C(s)||M(s))return!1;var n=[String(s)],o=_n[r.operator];return!!o&&o(r.values,n)}))}var bn="custom",yn="i.posthog.com",wn=/^\/static\//;class xn{constructor(t){this.ki={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+yn,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.ki[this.apiHost]||(this.ki[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":bn),this.ki[this.apiHost]}Ti(t){var e=this.instance.config.__preview_external_dependency_versioned_paths;if("string"==typeof e&&wn.test(t))return e.trim().replace(/\/$/,"")||void 0}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.uiHost+e;if("flags"===t)return this.flagsApiHost+e;if("assets"===t){var i=this.Ti(e);if(i)return""+i+e}if(this.region===bn)return this.apiHost+e;var r=yn+e;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var En=Ce("[Surveys]"),Sn="seenSurvey_",$n=[Zr.Popover,Zr.Widget,Zr.API],Tn={ignoreConditions:!1,ignoreDelay:!1,displayType:ns.Popover},kn=Ce("[PostHog ExternalIntegrations]"),Rn={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Pn{constructor(t){this._instance=t}ur(t,e){var i;null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return kn.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(e){var i,s,n;!r||null!=(i=h.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]||t.ur(Rn[e],(()=>{var i;null==(i=h.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[e])||i.start(t._instance)})),!r&&null!=(s=h.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[e]&&(null==(n=h.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[e])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;e(i)}}}var On,In={},Cn=0,Fn=()=>{},An='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Mn="Surveys module not available",Dn="sanitize_properties is deprecated. Use before_send instead",Ln="Invalid value for property_denylist config: ",Un="posthog",Nn=!Gs&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla")),jn=e=>{var i;return f({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Ki(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Fn,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,debug:s&&F(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!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:"https:"===(null==t||null==(i=t.location)?void 0:i.protocol),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){Ie.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:Mi,before_send:void 0,request_queue_config:{flush_interval_ms:rn},error_tracking:{},_onCapture:Fn,__preview_eager_load_replay:!1},(t=>({rageclick:!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}))(e))},zn=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],Bn=t=>{var e={};for(var[i,r]of zn)C(t[i])||(e[r]=t[i]);var s=qi({},e,t);return R(t.property_blacklist)&&(C(t.property_denylist)?s.property_denylist=t.property_blacklist:R(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:Ie.error(Ln+t.property_denylist)),s};class Hn{constructor(){this.__forceAllowLocalhost=!1}get Ai(){return this.__forceAllowLocalhost}set Ai(t){Ie.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class qn{Ei(t,e){if(t){var i=this.Ri.indexOf(t);-1!==i&&this.Ri.splice(i,1)}return this.Ri.push(e),null==e.initialize||e.initialize(),e}Ni(){return this.config.cookieless_mode===Ci||this.config.cookieless_mode===Ii&&this.consent.isRejected()}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new Hn,this.Mi=!1,this.version=v.LIB_VERSION,this.Fi=new hn,this.Ri=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=jn(),this.SentryIntegration=Sr,this.sentryIntegration=t=>function(t,e){var i=Er(t,e);return{name:xr,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Oi=!1,this.Pi=null,this.Li=null,this.Di=null,this.scrollManager=new an(this),this.pageViewManager=new $r(this),this.rateLimiter=new hs(this),this.requestRouter=new xn(this),this.consent=new _r(this),this.externalIntegrations=new Pn(this);var e=null!==(t=qn.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=F(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=F(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>Ie.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==Un){var r,s=null!==(r=In[i])&&void 0!==r?r:new qn;return s._init(t,e,i),In[i]=s,In[Un][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n;if(void 0===i&&(i={}),C(e)||A(e))return Ie.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={},i.debug=this.Bi(i.debug),this.ji=i,this.$i=[],i.person_profiles?this.Li=i.person_profiles:i.process_person&&(this.Li=i.process_person),this.set_config(qi({},jn(i.defaults),Bn(i),{name:r,token:e})),this.config.on_xhr_error&&Ie.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:ps.GZipJS;var o=this.qi();this.persistence=new Yr(this.config,o),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Yr(f({},this.config,{persistence:"sessionStorage"}),o);var a=f({},this.persistence.props),l=f({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Zi=new sn((t=>this.Vi(t)),this.config.request_queue_config),this.Hi=new on(this),this.__request_queue=[];var u=this.Ni();if(u||(this.sessionManager=new vn(this),this.sessionPropsManager=new un(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Ie.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.zi(u)}),0)):(Ie.info("Initializing extensions synchronously"),this.zi(u)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&Ie.info("Starting in debug mode",{this:this,config:i,thisC:f({},this.config),p:a,s:l}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=f({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=i.bootstrap)?void 0:n.distinctID)){var h=i.bootstrap.distinctID,d=this.get_distinct_id(),c=this.persistence.get_property(mi);if(i.bootstrap.isIdentifiedID&&null!=d&&d!==h&&c===Fi)this.identify(h);else if(i.bootstrap.isIdentifiedID&&null!=d&&d!==h&&c===Ai)Ie.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var p=this.config.get_device_id(sr()),_=i.bootstrap.isIdentifiedID?p:h;this.persistence.set_property(mi,i.bootstrap.isIdentifiedID?Ai:Fi),this.register({distinct_id:h,$device_id:_})}}if(u)this.register_once({distinct_id:Ti,$device_id:null},"");else if(!this.get_distinct_id()){var g=this.config.get_device_id(sr());this.register_once({distinct_id:g,$device_id:g},""),this.persistence.set_property(mi,Fi)}return Xi(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||sr();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(mi,Ai)),e()},s=i.user();"then"in s&&P(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{Promise&&Promise.resolve||wr.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,i)=>{if(!i)return e;e.event.userId||e.event.anonymousId===t.get_distinct_id()||(wr.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(wr.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var r=t.calculateEventProperties(i,e.event.properties);return e.event.properties=Object.assign({},r,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>e(t,t.event.event),page:t=>e(t,Ui),identify:t=>e(t,ji),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.Ui())):this.Ui(),P(this.config._onCapture)&&this.config._onCapture!==Fn&&(Ie.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Ie.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}zi(t){var e,i,r,s,n,o,a,l=performance.now(),u=f({},qn.__defaultExtensionClasses,this.config.__extensionClasses),h=[];u.featureFlags&&this.Ri.push(this.featureFlags=null!==(e=this.featureFlags)&&void 0!==e?e:new u.featureFlags(this)),u.exceptions&&this.Ri.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new u.exceptions(this)),u.historyAutocapture&&this.Ri.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.Ri.push(new u.tracingHeaders(this)),u.siteApps&&this.Ri.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.Ri.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.Ri.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.Ri.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this)),u.logs&&this.Ri.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new u.logs(this)),u.conversations&&this.Ri.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new u.conversations(this)),u.productTours&&this.Ri.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.Ri.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.Ri.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.Ri.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.Ri.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,br)),u.toolbar&&this.Ri.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new u.toolbar(this)),u.experiments&&this.Ri.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new u.experiments(this)),this.Ri.forEach((t=>{t.initialize&&h.push((()=>{null==t.initialize||t.initialize()}))})),h.push((()=>{if(this.Yi){var t=this.Yi;this.Yi=void 0,this.Nr(t)}})),this.Gi(h,l)}Gi(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.Gi(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){Ie.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[ki]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ri]:r}),this.config.__preview_deferred_init_extensions&&Ie.info("PostHog extensions initialized ("+r+"ms)")}Nr(t){var e;if(!r||!r.body)return Ie.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Nr(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Yi=t),this.Wi=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=w(t.supportedCompression,ps.GZipJS)?ps.GZipJS:w(t.supportedCompression,ps.Base64)?ps.Base64:void 0),null!=(e=t.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Li?this.Li:Mi}),this.Ri.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}Ui(){try{this.config.loaded(this)}catch(t){Ie.critical("`loaded` function failed",t)}if(this.Xi(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ni())&&this.Ji()}),1),this.Ki=new vs(this),this.Ki.load()}Xi(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Zi)||t.enable())}_dom_loaded(){this.is_capturing()&&Bi(this.__request_queue,(t=>this.Vi(t))),this.__request_queue=[],this.Xi()}_handle_unload(){var t,e,i,r;null==(t=this.surveys)||t.handlePageUnload(),this.config.request_batching?(this.Qi()&&this.capture(Ni),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(i=this.Zi)||i.unload(),null==(r=this.Hi)||r.unload()):this.Qi()&&this.capture(Ni,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(Nn?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=Ks(t.url,{ip:this.config.ip?1:0}),t.headers=f({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,i,r,s=f({},t);s.timeout=s.timeout||6e4,s.url=tn(s.url,s.compression);var n=null!==(e=s.transport)&&void 0!==e?e:"fetch",o=en.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),a=null!==(i=null==(r=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===n)return t[i]}(o))?void 0:r.method)&&void 0!==i?i:o[0].method;if(!a)throw new Error("No available transport method");"sendBeacon"!==n&&s.data&&s.compression===ps.GZipJS&&l&&!Js?Zs(s).then((t=>{a(t)})).catch((e=>{if((t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""))(e))return Js=!0,void a(f({},s,{compression:void 0,url:tn(t.url,void 0)}));a(s)})):a(s)})(f({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))))}Vi(t){this.Hi?this.Hi.retriableRequest(t):this._send_request(t)}_execute_array(t){Cn++;try{var e,i=[],r=[],s=[];Bi(t,(t=>{t&&(R(e=t[0])?s.push(t):P(t)?t.call(this):R(t)&&"alias"===e?i.push(t):R(t)&&-1!==e.indexOf("capture")&&P(this[e])?s.push(t):r.push(t))}));var n=function(t,e){Bi(t,(function(t){if(R(t[0])){var i=e;Hi(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}))};n(i,this),n(r,this),n(s,this)}finally{Cn--}}push(t){if(Cn>0&&R(t)&&F(t[0])){var e=qn.prototype[t[0]];P(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,i){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Zi){if(this.is_capturing())if(!C(t)&&F(t)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=e&&e.$current_url&&!F(null==e?void 0:e.$current_url)&&(Ie.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=i&&i.en||Ie.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=(null==i?void 0:i.timestamp)||h,v=sr(),c={uuid:v,event:t,properties:this.calculateEventProperties(t,e||{},d,v)};t===Ui&&this.config.__preview_capture_bot_pageviews&&l&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),u&&(c.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==i?void 0:i.$set)&&(c.$set=null==i?void 0:i.$set);var p,_,g,m=this.tn(null==i?void 0:i.$set_once,t!==zi,t===ji);if(m&&(c.$set_once=m),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,n=c,o=t=>F(t)?t.slice(0,s):t,a=new Set,c=function t(e,i){return e!==Object(e)?o?o(e):e:a.has(e)?void 0:(a.add(e),R(e)?(r=[],Bi(e,(e=>{r.push(t(e))}))):(r={},Hi(e,((e,i)=>{a.has(e)||(r[i]=t(e,i))}))),r);var r}(n)),c.timestamp=d,C(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=h),t===rs.DISMISSED||t===rs.SENT){var b=null==e?void 0:e[ss.SURVEY_ID],y=null==e?void 0:e[ss.SURVEY_ITERATION];(t=>{try{var e=(t=>((t,e)=>{var i=""+Sn+e.id;return e.current_iteration&&e.current_iteration>0&&(i=""+Sn+e.id+"_"+e.current_iteration),i})(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){En.error("Failed to persist survey seen state",t)}})({id:b,current_iteration:y}),c.$set=f({},c.$set,{[(p={id:b,current_iteration:y},_=t===rs.SENT?"responded":"dismissed",g="$survey_"+_+"/"+p.id,p.current_iteration&&p.current_iteration>0&&(g="$survey_"+_+"/"+p.id+"/"+p.current_iteration),g)]:!0})}else t===rs.SHOWN&&(c.$set=f({},c.$set,{[ss.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===as.SHOWN){var w=null==e?void 0:e[ls.TOUR_TYPE];w&&(c.$set=f({},c.$set,{[ls.TOUR_LAST_SEEN_DATE+"/"+w]:(new Date).toISOString()}))}var x=f({},c.properties.$set,c.$set);if(I(x)||this.setPersonPropertiesForFlags(x),!D(this.config.before_send)){var E=this.rn(c);if(!E)return;c=E}this.Fi.emit("eventCaptured",c);var S={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:null==i?void 0:i._batchKey};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.Vi(S):this.Zi.enqueue(S),c}Ie.critical("This capture call is ignored due to client rate limiting.")}}else Ie.error("No event name provided to posthog.capture")}else Ie.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;var l=a?void 0:this.persistence.remove_event_timer(e),h=f({},i);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.Ni()&&(h.$cookieless_mode=!0),"$snapshot"===e){var d=f({},this.persistence.properties(),this.sessionPersistence.properties());return h.distinct_id=d.distinct_id,(!F(h.distinct_id)&&!L(h.distinct_id)||A(h.distinct_id))&&Ie.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}var c,p=function(e,i){var r,n,o,a;if(!u)return{};var l,h,d,c,p,f,_,g,m=e?[...Fr,...i||[]]:[],[b,y]=function(t){for(var e=0;Wt.length>e;e++){var[i,r]=Wt[e],s=i.exec(t),n=s&&(P(r)?r(s,t):r);if(n)return n}return["",""]}(u);return qi(Yi({$os:b,$os_version:y,$browser:Ht(u,navigator.vendor),$device:Gt(u),$device_type:(h=u,d={userAgentDataPlatform:null==(r=navigator)||null==(r=r.userAgentData)?void 0:r.platform,maxTouchPoints:null==(n=navigator)?void 0:n.maxTouchPoints,screenWidth:null==t||null==(o=t.screen)?void 0:o.width,screenHeight:null==t||null==(a=t.screen)?void 0:a.height,devicePixelRatio:null==t?void 0:t.devicePixelRatio},g=Gt(h),g===st||g===rt||"Kobo"===g||"Kindle Fire"===g||g===At?it:g===Et||g===$t||g===St||g===It?"Console":g===ot?"Wearable":g?Z:"Android"===(null==d?void 0:d.userAgentDataPlatform)&&(null!==(c=null==d?void 0:d.maxTouchPoints)&&void 0!==c?c:0)>0?600>Math.min(null!==(p=null==d?void 0:d.screenWidth)&&void 0!==p?p:0,null!==(f=null==d?void 0:d.screenHeight)&&void 0!==f?f:0)/(null!==(_=null==d?void 0:d.devicePixelRatio)&&void 0!==_?_:1)?Z:it:"Desktop"),$timezone:Vr(),$timezone_offset:Wr()}),{$current_url:Or(null==s?void 0:s.href,m,Mr),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:Vt(u,navigator.vendor),$browser_language:jr(),$browser_language_prefix:(l=jr(),"string"==typeof l?l.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:_,windowId:g}=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime());h.$session_id=_,h.$window_id=g}this.sessionPropsManager&&qi(h,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&qi(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null==(m=this.Hi)?void 0:m.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===bn&&(h.$lib_custom_api_host=this.config.api_host),c=e!==Ui||a?e!==Ni||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),h=qi(h,c),e===Ui&&r&&(h.title=r.title),!C(l)){var b=n.getTime()-l;h.$duration=parseFloat((b/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser"),(h=qi({},p,this.persistence.properties(),this.sessionPersistence.properties(),h)).$is_identified=this._isIdentified(),R(this.config.property_denylist)?Hi(this.config.property_denylist,(function(t){delete h[t]})):Ie.error(Ln+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var y=this.config.sanitize_properties;y&&(Ie.error(Dn),h=y(h,e));var w=this.nn();return h.$process_person_profile=w,w&&!a&&this.sn("_calculate_event_properties"),h}tn(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.nn())return t;if(this.Mi&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=qi({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Ie.error(Dn),o=a(o,"$set_once")),e&&(this.Mi=!0),I(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e;null==(e=this.sessionPersistence)||e.register(t)}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t)}an(t,e){this.register({[t]:e})}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}isFeatureEnabled(t,e){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(t,e)}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.Fi.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Mn}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:Mn})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:Mn})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=Tn),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:Mn}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Mn})}ln(t){return!t||A(t)?(Ie.critical("Unique user id has not been set in posthog.identify"),!1):t===Ti?(Ie.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(Ie.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return Ie.uninitializedWarning("posthog.identify");if(L(t)&&(t=t.toString(),Ie.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.ln(t)&&this.sn("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:t}),this.get_property(De)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),t!==r&&t!==this.get_property(Le)&&(this.unregister(Le),this.register({distinct_id:t}));var s,n=(this.persistence.get_property(mi)||Fi)===Fi;t!==r&&n?(this.persistence.set_property(mi,Ai),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.capture(ji,{distinct_id:t,$anon_distinct_id:r},{$set:e||{},$set_once:i||{}}),this.Di=fn(t,e,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(e||i)&&this.setPersonProperties(e,i),t!==r&&(this.reloadFeatureFlags(),this.unregister(pi))}}setPersonProperties(t,e){if((t||e)&&this.sn("posthog.setPersonProperties")){var i=fn(this.get_distinct_id(),t,e);this.Di!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Di=i):Ie.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,e,i){if(t&&e){var r=this.getGroups(),s=r[t]!==e;if(s&&this.resetGroupPropertiesForFlags(t),this.register({$groups:f({},r,{[t]:e})}),s||i){var n={$group_type:t,$group_key:e};i&&(n.$group_set=i),this.capture(zi,n)}i&&this.setGroupPropertiesForFlags({[t]:i}),s&&!i&&this.reloadFeatureFlags()}else Ie.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(){var t;null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.sn("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e,i,r,s,n,o,a,l;if(Ie.info("reset"),!this.__loaded)return Ie.uninitializedWarning("posthog.reset");var u=this.get_property(De);if(this.consent.reset(),null==(e=this.persistence)||e.clear(),null==(i=this.sessionPersistence)||i.clear(),null==(r=this.surveys)||r.reset(),null==(s=this.Ki)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(mi,Fi),null==(l=this.sessionManager)||l.resetSessionId(),this.Di=null,this.config.cookieless_mode===Ci)this.register_once({distinct_id:Ti,$device_id:null},"");else{var h=this.config.get_device_id(sr());this.register_once({distinct_id:h,$device_id:t?h:u},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(t,e){var i;this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i.un()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.hn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:e,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property(Me)?(Ie.critical("Attempting to create alias for existing People user - aborting."),-2):this.sn("posthog.alias")?(C(e)&&(e=this.get_distinct_id()),t!==e?(this.an(Le,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Ie.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=f({},this.config);if(O(t)){var i,r,s,n,o,a,l,u,h,d;qi(this.config,Bn(t));var c=this.qi();null==(i=this.persistence)||i.update_config(this.config,e,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Yr(f({},this.config,{persistence:"sessionStorage"}),c);var p=this.Bi(this.config.debug);N(p)&&(this.config.debug=p),N(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,hr.R()&&hr.M("ph_debug",!0),Ie.info("set_config",{config:t,oldConfig:e,newConfig:f({},this.config)})):(v.DEBUG=!1,hr.R()&&hr.F("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(s=this.exceptions)||s.onConfigChange(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),null==(o=this.autocapture)||o.startIfEnabled(),null==(a=this.heatmaps)||a.startIfEnabled(),null==(l=this.exceptionObserver)||l.startIfEnabledOrStop(),null==(u=this.deadClicksAutocapture)||u.startIfEnabledOrStop(),null==(h=this.surveys)||h.loadIfEnabled(),this.cn(),null==(d=this.externalIntegrations)||d.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){v.LIB_NAME=t,v.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(f({},r,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:qn.dn}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:Un;return e!==Un&&(e=Un+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(mi))===Ai||(null==(e=this.sessionPersistence)?void 0:e.get_property(mi))===Ai}nn(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===Mi&&!this._isIdentified()&&I(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Le])&&(null==(e=this.persistence)||null==(e=e.props)||!e[Si]))}Qi(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.nn()||this.sn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.sn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}sn(t){return"never"===this.config.person_profiles?(Ie.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.an(Si,!0),!0)}qi(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Ii)}cn(){var t,e,i,r,s=this.qi();return(null==(t=this.persistence)?void 0:t._r)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e._r)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==Ci){if(this.Ni()){var i,r,s,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new vn(this),this.pageViewManager=new $r(this),this.persistence&&(this.sessionPropsManager=new un(this,this.sessionManager,this.persistence));var a,l=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=qn.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.Ei(this.sessionRecording,new l(this)),this.Wi&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Wi)))}var u,h;this.consent.optInOut(!0),this.cn(),this.Xi(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==Ii&&(null==(u=this.surveys)||u.loadIfEnabled()),(C(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(h=null==t?void 0:t.captureEventName)&&void 0!==h?h:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Ji()}else Ie.warn(An)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==Ci?(this.config.cookieless_mode===Ii&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.cn(),this.config.cookieless_mode===Ii&&(this.register({distinct_id:Ti,$device_id:null}),null==(t=this.sessionManager)||t.destroy(),null==(e=this.pageViewManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(i=this.sessionRecording)||i.stopRecording(),this.sessionRecording=void 0,this.Ji())):Ie.warn(An)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Ci||(this.config.cookieless_mode===Ii?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.cn()}_is_bot(){return i?cn(i,this.config.custom_blocked_useragents):void 0}Ji(){r&&("visible"===r.visibilityState?this.Oi||(this.Oi=!0,this.capture(Ui,{title:r.title},{send_instantly:!0}),this.Pi&&(r.removeEventListener(Di,this.Pi),this.Pi=null)):this.Pi||(this.Pi=this.Ji.bind(this),Xi(r,Di,this.Pi)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.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}))}Fr(){var t,e,i,r,s,n,o=this.ji||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Ie.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):(i="advanced_disable_decide",!1,r=Ie,s=(e="advanced_disable_flags")in(t=o)&&!D(t[e]),n=i in t&&!D(t[i]),s?t[e]:!!n&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i]))}rn(t){if(D(this.config.before_send))return t;var e=R(this.config.before_send)?this.config.before_send:[this.config.before_send],i=t;for(var r of e){if(i=r(i),D(i)){var s="Event '"+t.event+"' was rejected in beforeSend function";return z(t.event)?Ie.warn(s+". This can cause unexpected behavior."):Ie.info(s),null}i.properties&&!I(i.properties)||Ie.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var t;return null==(t=this.pageViewManager.dr)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Bi(t){var e=N(t)&&!t,i=hr.R()&&"true"===hr.O("ph_debug");return!e&&(!!i||t)}}qn.__defaultExtensionClasses={},qn.dn={trace:On=()=>{},debug:On,info:On,warn:On,error:On,fatal:On},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=Gi(t.prototype[e[i]])}(qn,["identify"]);var Vn=1,Wn=3,Gn=11;function Yn(t){return t instanceof Element&&(t.id===$i||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Jn(t){return!!t&&t.nodeType===Vn}function Kn(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Xn(t){return!!t&&t.nodeType===Wn}function Qn(t){return!!t&&t.nodeType===Gn&&Jn(t.host)}function Zn(t){return t?x(t).split(/\s+/):[]}function to(e){var i=null==t?void 0:t.location.href;return!!(i&&e&&e.some((t=>i.match(t))))}function eo(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return Zn(e)}function io(t){return D(t)?null:x(t).split(/(\s+)/).filter((t=>wo(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ro(t){var e="";return co(t)&&!po(t)&&t.childNodes&&t.childNodes.length&&Hi(t.childNodes,(function(t){var i;Xn(t)&&t.textContent&&(e+=null!==(i=io(t.textContent))&&void 0!==i?i:"")})),x(e)}function so(t){return C(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var no=["a","button","form","input","select","textarea","label"];function oo(t,e){if(C(e))return!0;var i,r=function(t){if(e.some((e=>t.matches(e))))return{v:!0}};for(var s of t)if(i=r(s))return i.v;return!1}function ao(t){var e=t.parentNode;return!(!e||!Jn(e))&&e}var lo=["next","previous","prev",">","<"],uo=[".ph-no-rageclick",".ph-no-capture"];var ho=t=>!t||Kn(t,"html")||!Jn(t),vo=(e,i)=>{if(!t||ho(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[e],n=e;n.parentNode&&!Kn(n,"body");)if(Qn(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=ao(n);if(!o)break;if(i||no.indexOf(o.tagName.toLowerCase())>-1)r=!0;else{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}s.push(o),n=o}return{parentIsUsefulElement:r,targetElementList:s}};function co(t){for(var e=t;e.parentNode&&!Kn(e,"body");e=e.parentNode){var i=eo(e);if(w(i,"ph-sensitive")||w(i,"ph-no-capture"))return!1}if(w(eo(t),"ph-include"))return!0;var r=t.type||"";if(F(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!F(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function po(t){return!!(Kn(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Kn(t,"select")||Kn(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var fo="(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})",_o=new RegExp("^(?:"+fo+")$"),go=new RegExp(fo),mo="\\d{3}-?\\d{2}-?\\d{4}",bo=new RegExp("^("+mo+")$"),yo=new RegExp("("+mo+")");function wo(t,e){if(void 0===e&&(e=!0),D(t))return!1;if(F(t)){if(t=x(t),(e?_o:go).test((t||"").replace(/[- ]/g,"")))return!1;if((e?bo:yo).test(t))return!1}return!0}function xo(t){var e=ro(t);return wo(e=(e+" "+Eo(t)).trim())?e:""}function Eo(t){var e="";return t&&t.childNodes&&t.childNodes.length&&Hi(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=ro(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Eo(t)).trim())}catch(t){Ie.error("[AutoCapture]",t)}})),e}function So(t){return t.replace(/"|\\"/g,'\\"')}function $o(t){var e=t.attr__class;return e?R(e)?e:Zn(e):void 0}class To{constructor(t){this.disabled=!1===t;var e=O(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(e-r.y)<this.thresholdPx&&this.timeoutMs>i-r.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}}var ko="$copy_autocapture",Ro=Ce("[AutoCapture]");function Po(t,e){return e.length>t?e.slice(0,t)+"...":e}function Oo(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!Jn(e));return e}function Io(e,i){var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=i;if(!Jn(e))return{props:{}};for(var h=[e],d=e;d.parentNode&&!Kn(d,"body");)if(Qn(d.parentNode))h.push(d.parentNode.host),d=d.parentNode.host;else{if(!Jn(d.parentNode))break;h.push(d.parentNode),d=d.parentNode}var v,c,p=[],_={},g=!1,m=!1;if(Hi(h,(t=>{var e=co(t);if(Kn(t,"a")){var i=t.getAttribute("href");g=e&&!!i&&wo(i)&&i}w(eo(t),"ph-no-capture")&&(m=!0),p.push(function(t,e,i,r){var s=t.tagName.toLowerCase(),n={tag_name:s};no.indexOf(s)>-1&&!i&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?Po(1024,xo(t)):Po(1024,ro(t)));var o=eo(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),Hi(t.attributes,(function(i){var s;if((!po(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&wo(i.value)&&(!F(s=i.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=i.value;"class"===i.name&&(o=Zn(o).join(" ")),n["attr__"+i.name]=Po(1024,o)}}));for(var a=1,l=1,u=t;u=Oo(u);)a++,u.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(t,o,a,l));var r=function(t){if(!co(t))return{};var e={};return Hi(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var i=t.name.replace("data-ph-capture-attribute-",""),r=t.value;i&&r&&wo(r)&&(e[i]=r)}})),e}(t);qi(_,r)})),m)return{props:{},explicitNoCapture:m};if(a||(p[0].$el_text=Kn(e,"a")||Kn(e,"button")?xo(e):ro(e)),g){var b,y;p[0].attr__href=g;var x=null==(b=Rr(g))?void 0:b.host,E=null==t||null==(y=t.location)?void 0:y.host;x&&E&&x!==E&&(v=g)}return{props:qi({$event_type:n.type,$ce_version:1},u?{}:{$elements:p},{$elements_chain:(c=p,function(t){return t.map((t=>{var e,i,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var s of(t.attr_class.sort(),t.attr_class))r+="."+s.replace(/"/g,"");var n=f({},t.text?{text:t.text}:{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(i=t.nth_of_type)&&void 0!==i?i:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return Vi(n).sort(((t,e)=>{var[i]=t,[r]=e;return i.localeCompare(r)})).forEach((t=>{var[e,i]=t;return o[So(e.toString())]=So(i.toString())})),(r+=":")+Vi(o).map((t=>{var[e,i]=t;return e+'="'+i+'"'})).join("")})).join(";")}(function(t){return t.map((t=>{var e,i,r={text:null==(e=t.$el_text)?void 0:e.slice(0,400),tag_name:t.tag_name,href:null==(i=t.attr__href)?void 0:i.slice(0,2048),attr_class:$o(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Vi(t).filter((t=>{var[e]=t;return 0===e.indexOf("attr__")})).forEach((t=>{var[e,i]=t;return r.attributes[e]=i})),r}))}(c)))},null!=(r=p[0])&&r.$el_text?{$el_text:null==(s=p[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},_)}}var Co=Ce("[ExceptionAutocapture]");function Fo(t,e,i){try{if(!(e in t))return()=>{};var r=t[e],s=i(r);return P(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=s,()=>{t[e]=r}}catch(t){return()=>{}}}var Ao=Ce("[TracingHeaders]"),Mo=Ce("[Web Vitals]"),Do=9e5,Lo="disabled",Uo="lazy_loading",No="awaiting_config",jo="missing_config";Ce("[SessionRecording]"),Ce("[SessionRecording]");var zo="[SessionRecording]",Bo=Ce(zo),Ho=Ce("[Heatmaps]");function qo(t){return O(t)&&"clientX"in t&&"clientY"in t&&L(t.clientX)&&L(t.clientY)}var Vo=Ce("[Product Tours]"),Wo=["$set_once","$set"],Go=Ce("[SiteApps]"),Yo="Error while initializing PostHog app with config id ";function Jo(t,e,i){if(D(t))return!1;switch(i){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch(t){return!1}default:return!1}}class Ko{constructor(t){this.vn=new hn,this.fn=(t,e)=>this.pn(t,e)&&this.gn(t,e)&&this.mn(t,e)&&this.yn(t,e),this.pn=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t,this.bn=new Set,this._n=new Set}init(){var t,e;C(null==(t=this._instance)?void 0:t._addCaptureHook)||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.on(t,e)})))}register(t){var e,i;if(!C(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e,i;null==(e=this._n)||e.add(t),null==(i=t.steps)||i.forEach((t=>{var e;null==(e=this.bn)||e.add((null==t?void 0:t.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var r,s=new Set;t.forEach((t=>{var e;null==(e=t.steps)||e.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,e){var i;null!=e&&0!=t.length&&(this.bn.has(t)||this.bn.has(null==e?void 0:e.event))&&this._n&&(null==(i=this._n)?void 0:i.size)>0&&this._n.forEach((t=>{this.wn(e,t)&&this.vn.emit("actionCaptured",t.name)}))}In(t){this.onAction("actionCaptured",(e=>t(e)))}wn(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.fn(t,i))return!0;return!1}onAction(t,e){return this.vn.on(t,e)}gn(t,e){if(null!=e&&e.url){var i,r=null==t||null==(i=t.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Jo(r,e.url,e.url_matching||"contains"))return!1}return!0}mn(t,e){return!!this.Cn(t,e)&&!!this.Sn(t,e)&&!!this.xn(t,e)}Cn(t,e){var i;if(null==e||!e.href)return!0;var r=this.kn(t);if(r.length>0)return r.some((t=>Jo(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Jo((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}Sn(t,e){var i;if(null==e||!e.text)return!0;var r=this.kn(t);if(r.length>0)return r.some((t=>Jo(t.text,e.text,e.text_matching||"exact")||Jo(t.$el_text,e.text,e.text_matching||"exact")));var s,n,o,a=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!a&&(s=function(t){for(var e,i=[],r=/(?::|")text="(.*?)"/g;!D(e=r.exec(t));)i.includes(e[1])||i.push(e[1]);return i}(a),n=e.text,o=e.text_matching||"exact",s.some((t=>Jo(t,n,o))))}xn(t,e){var i,r;if(null==e||!e.selector)return!0;var s=null==t||null==(i=t.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(e.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(e.selector_regex&&n)try{return new RegExp(e.selector_regex).test(n)}catch(t){return!1}return!1}kn(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}yn(t,e){return null==e||!e.properties||0===e.properties.length||mn(e.properties.reduce(((t,e)=>{var i=R(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class Xo{constructor(t){this._instance=t,this.Tn=new Map,this.An=new Map,this.En=new Map}Rn(t,e){return!!t&&mn(t.propertyFilters,null==e?void 0:e.properties)}Nn(t,e){var i=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[e])||null==(r=r.values)||r.forEach((e=>{if(null!=e&&e.name){var r=i.get(e.name)||[];r.push(t.id),i.set(e.name,r)}}))})),i}Mn(t,e,i){var r=(i===Jr.Activation?this.Tn:this.An).get(t),s=[];return this.Fn((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[i])||null==(s=s.values)?void 0:s.find((e=>e.name===t));return this.Rn(n,e)}))}register(t){var e;C(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.On(t),this.Pn(t))}Pn(t){var e=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.actions)&&(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0}));0!==e.length&&(null==this.Ln&&(this.Ln=new Ko(this._instance),this.Ln.init(),this.Ln.In((t=>{this.onAction(t)}))),e.forEach((t=>{var e,i,r,s,n;t.conditions&&null!=(e=t.conditions)&&e.actions&&null!=(i=t.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.Ln)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((e=>{if(e&&e.name){var i=this.En.get(e.name);i&&i.push(t.id),this.En.set(e.name,i||[t.id])}})))})))}On(t){var e,i=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.events)&&(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0})),r=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.cancelEvents)&&(null==(i=t.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0}));0===i.length&&0===r.length||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.onEvent(t,e)})),this.Tn=this.Nn(t,Jr.Activation),this.An=this.Nn(t,Jr.Cancellation))}onEvent(t,e){var i,r=this.le(),s=this.Dn(),n=this.Bn(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[s])||[];if(n===t&&e&&o.length>0){var a,l;r.info("event matched, removing item from activated items",{event:t,eventPayload:e,existingActivatedItems:o});var u=(null==e||null==(a=e.properties)?void 0:a.$survey_id)||(null==e||null==(l=e.properties)?void 0:l.$product_tour_id);if(u){var h=o.indexOf(u);0>h||(o.splice(h,1),this.jn(o))}}else{if(this.An.has(t)){var d=this.Mn(t,e,Jr.Cancellation);d.length>0&&(r.info("cancel event matched, cancelling items",{event:t,itemsToCancel:d.map((t=>t.id))}),d.forEach((t=>{var e=o.indexOf(t.id);0>e||o.splice(e,1),this.$n(t.id)})),this.jn(o))}if(this.Tn.has(t)){r.info("event name matched",{event:t,eventPayload:e,items:this.Tn.get(t)});var v=this.Mn(t,e,Jr.Activation);this.jn(o.concat(v.map((t=>t.id))||[]))}}}onAction(t){var e,i=this.Dn(),r=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[i])||[];this.En.has(t)&&this.jn(r.concat(this.En.get(t)||[]))}jn(t){var e=this.le(),i=[...new Set(t)].filter((t=>!this.qn(t)));e.info("updating activated items",{activatedItems:i}),this.Zn(i)}getActivatedIds(){var t,e=this.Dn();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}getEventToItemsMap(){return this.Tn}Vn(){return this.Ln}}class Qo extends Xo{constructor(t){super(t)}Dn(){return vi}Bn(){return rs.SHOWN}Fn(t){var e;null==(e=this._instance)||e.getSurveys(t)}$n(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}le(){return En}Zn(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[vi]:t})}qn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Zo="SDK is not enabled or survey functionality is not yet loaded",ta="Disabled. Not loading surveys.",ea=null!=t&&t.location?Ir(t.location.hash,"__posthog")||Ir(location.hash,"state"):null,ia="_postHogToolbarParams",ra=Ce("[Toolbar]"),sa=Ce("[FeatureFlags]"),na=Ce("[FeatureFlags]",{debugEnabled:!0}),oa="\" failed. Feature flags didn't load in time.",aa=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},la=t=>{var e={};for(var[i,r]of Vi(t||{}))r&&(e[i]=r);return e},ua=Ce("[Error tracking]"),ha="Refusing to render web experiment since the viewer is a likely bot",da={icontains:(e,i)=>!!t&&i.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,i)=>!!t&&-1===i.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,i)=>!!t&&pn(i.href,e),not_regex:(e,i)=>!!t&&!pn(i.href,e),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class va{get Bt(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{va.Hn("retrieved web experiments from the server"),e.zn=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.zn&&(va.Hn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.zn)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);F(r)&&t.variants[r]&&e.Un(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];va.Yn(n)&&e.Un(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())va.Hn(ha);else if(!this.Bt.disable_web_experiments){if(D(this.zn))return this.zn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();va.Hn("applying feature flags",t),t.forEach((t=>{var e;if(this.zn&&null!=(e=this.zn)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.zn)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.Un(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=va.getWindowLocation();if(null!=t&&t.search){var e=Pr(null==t?void 0:t.search,"__experiment_id"),i=Pr(null==t?void 0:t.search,"__experiment_variant");e&&i&&(va.Hn("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.Gn(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.Bt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Bt.disable_web_experiments&&!i)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Bt.token),method:"GET",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Gn(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(va.Hn("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.Un(r[0].name,e,r[0].variants[e].transforms))}static Yn(t){return!D(t.conditions)&&va.Wn(t)&&va.Xn(t)}static Wn(t){var e;if(D(t.conditions)||D(null==(e=t.conditions)?void 0:e.url))return!0;var i,r,s,n=va.getWindowLocation();return!!n&&(null==(i=t.conditions)||!i.url||da[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==t?void 0:t.location}static Xn(t){var e;if(D(t.conditions)||D(null==(e=t.conditions)?void 0:e.utm))return!0;var i=Lr();if(i.utm_source){var r,s,n,o,a,l,u,h,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==i.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,p=null==(u=t.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=t.conditions)||null==(h=h.utm)?void 0:h.utm_term)==i.utm_term;return d&&c&&p&&v}return!1}static Hn(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];Ie.info("[WebExperiments] "+t,i)}Un(t,e,i){this._is_bot()?va.Hn(ha):"control"!==e?i.forEach((i=>{if(i.selector){var r;va.Hn("applying transform of variant "+e+" for experiment "+t+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((t=>{var e=t;i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)}))}})):va.Hn("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?cn(i,this.Bt.custom_blocked_useragents):void 0}}var ca=Ce("[Conversations]"),pa="Conversations not available yet.",fa={featureFlags:class{constructor(t){this.Jn=!1,this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this.ss=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Bt(){return this._instance.config}get ni(){return this._instance.persistence}os(t){return this._instance.get_property(t)}ls(){var t,e;return null!==(t=null==(e=this.ni)?void 0:e.wr(this.Bt.feature_flag_cache_ttl_ms))&&void 0!==t&&t}us(){return!!this.ls()&&(this.ss||this.Qn||(this.ss=!0,sa.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}hs(){var t,e=null!==(t=this.Bt.evaluation_contexts)&&void 0!==t?t:this.Bt.evaluation_environments;return!this.Bt.evaluation_environments||this.Bt.evaluation_contexts||this.ns||(sa.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ns=!0),null!=e&&e.length?e.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||sa.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}cs(){return this.hs().length>0}initialize(){var t,e,{config:i}=this._instance,r=null!==(t=null==(e=i.bootstrap)?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,e)=>(t[e]=r[e]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,e)=>(o[e]&&(t[e]=o[e]),t)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,e,i){var r=null!=i&&i.merge?this.getFlagVariants():{},s=null!=i&&i.merge?this.getFlagPayloads():{},n=f({},r,t),o=f({},s,e),a={};for(var[l,u]of Object.entries(n)){var h="string"==typeof u;a[l]={key:l,enabled:!!h||Boolean(u),variant:h?u:void 0,reason:void 0,metadata:C(null==o?void 0:o[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.Kn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.os(si),e=this.os(ai),i=this.os(li);if(!i&&!e)return t||{};var r=qi({},t||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(e||{})])];for(var n of s){var o,a,l=r[n],u=null==e?void 0:e[n],h=C(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,d=C(u)?l.variant:"string"==typeof u?u:void 0,v=null==i?void 0:i[n],c=f({},l,{enabled:h,variant:h?null!=d?d:null==l?void 0:l.variant:void 0});h!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v&&(c.metadata=f({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=c}return this.Jn||(sa.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:r}),this.Jn=!0),r}getFlagVariants(){var t=this.os(ei),e=this.os(ai);if(!e)return t||{};for(var i=qi({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Jn||(sa.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Jn=!0),i}getFlagPayloads(){var t=this.os(ni),e=this.os(li);if(!e)return t||{};for(var i=qi({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Jn||(sa.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Jn=!0),i}reloadFeatureFlags(){this.es||this.Bt.advanced_disable_feature_flags||this.ds||(this._instance.Fi.emit("featureFlagsReloading",!0),this.ds=setTimeout((()=>{this.vs()}),5))}fs(){clearTimeout(this.ds),this.ds=void 0}ensureFlagsLoaded(){this.Kn||this.Qn||this.ds||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.es=t}vs(t){var e;if(this.fs(),!this._instance.Fr())if(this.Qn)this.ts=!0;else{var i=this.Bt.token,r=this.os(De),s={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:f({},(null==(e=this.ni)?void 0:e.get_initial_props())||{},this.os(ui)||{}),group_properties:this.os(hi),timezone:Vr()};M(r)||C(r)||(s.$device_id=r),(null!=t&&t.disableFlags||this.Bt.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.cs()&&(s.evaluation_contexts=this.hs());var n=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Bt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Qn=!0,this._instance._send_request({method:"POST",url:n,data:s,compression:this.Bt.disable_compression?void 0:ps.Base64,timeout:this.Bt.feature_flag_request_timeout_ms,callback:t=>{var e,i,r,n=!0;if(200===t.statusCode&&(this.ts||(this.$anon_distinct_id=void 0),n=!1),this.Qn=!1,!s.disable_flags||this.ts){this.rs=!n;var o=[];t.error?t.error instanceof Error?o.push("AbortError"===t.error.name?"timeout":"connection_error"):o.push("unknown_error"):200!==t.statusCode&&o.push("api_error_"+t.statusCode),null!=(e=t.json)&&e.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var a,l=!(null==(i=t.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(l&&o.push("quota_limited"),null==(r=this.ni)||r.register({[_i]:o}),l)sa.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.");else s.disable_flags||this.receivedFeatureFlags(null!==(a=t.json)&&void 0!==a?a:{},n,{partialResponse:!!this.Bt.advanced_only_evaluate_survey_feature_flags}),this.ts&&(this.ts=!1,this.vs())}}})}}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.rs)if(this.Kn||this.getFlags()&&this.getFlags().length>0){if(!this.us()){var r=this.getFeatureFlagResult(t,e);return null!==(i=null==r?void 0:r.variant)&&void 0!==i?i:null==r?void 0:r.enabled}}else sa.warn('getFeatureFlag for key "'+t+oa)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e){if(void 0===e&&(e={}),!e.fresh||this.rs)if(this.Kn||this.getFlags()&&this.getFlags().length>0){if(!this.us()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],o=String(s),a=this.os(oi)||void 0,l=this.os(gi)||void 0,u=this.os(pi)||{};if(this.Bt.advanced_feature_flags_dedup_per_session){var h,d=this._instance.get_session_id(),v=this.os(fi);d&&d!==v&&(u={},null==(h=this.ni)||h.register({[pi]:u,[fi]:d}))}if((e.send_event||!("send_event"in e))&&(!(t in u)||!u[t].includes(o))){var c,p,f,_,g,m,b,y,w,x;R(u[t])?u[t].push(o):u[t]=[o],null==(c=this.ni)||c.register({[pi]:u});var E=this.getFeatureFlagDetails(t),S=[...null!==(p=this.os(_i))&&void 0!==p?p:[]];C(s)&&S.push("flag_missing");var T={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(f=this.Bt.bootstrap)||null==(f=f.featureFlags)?void 0:f[t])||null,$feature_flag_bootstrapped_payload:(null==(_=this.Bt.bootstrap)||null==(_=_.featureFlagPayloads)?void 0:_[t])||null,$used_bootstrap_value:!this.rs};C(null==E||null==(g=E.metadata)?void 0:g.version)||(T.$feature_flag_version=E.metadata.version);var k,P=null!==(m=null==E||null==(b=E.reason)?void 0:b.description)&&void 0!==m?m:null==E||null==(y=E.reason)?void 0:y.code;P&&(T.$feature_flag_reason=P),null!=E&&null!=(w=E.metadata)&&w.id&&(T.$feature_flag_id=E.metadata.id),C(null==E?void 0:E.original_variant)&&C(null==E?void 0:E.original_enabled)||(T.$feature_flag_original_response=C(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(x=E.metadata)&&x.original_payload&&(T.$feature_flag_original_payload=null==E||null==(k=E.metadata)?void 0:k.original_payload),S.length&&(T.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",T)}if(r){var O=n;if(!C(n))try{O=JSON.parse(n)}catch(t){}return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:O}}}}else sa.warn('getFeatureFlagResult for key "'+t+oa)}getRemoteConfigPayload(t,e){var i=this.Bt.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.cs()&&(r.evaluation_contexts=this.hs()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Bt.disable_compression?void 0:ps.Base64,timeout:this.Bt.feature_flag_request_timeout_ms,callback(i){var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;e((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,e){if(void 0===e&&(e={}),!e.fresh||this.rs){if(this.Kn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(t,e);return C(i)?void 0:!!i}sa.warn('isFeatureEnabled for key "'+t+oa)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,i){if(this.ni){this.Kn=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(t,e,i,r,s,n){void 0===i&&(i={}),void 0===r&&(r={}),void 0===s&&(s={});var o=(t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return null==(i=e[t].metadata)?void 0:i.payload})).map((t=>{var i;return[t,null==(i=e[t].metadata)?void 0:i.payload]})))):sa.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(l){var h=t.requestId,d=t.evaluatedAt;if(R(l)){sa.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(l)for(var c=0;l.length>c;c++)v[l[c]]=!0;e&&e.register({[ii]:l,[ei]:v})}else{var p=l,_=u,g=a;if(null!=n&&n.partialResponse)p=f({},i,p),_=f({},r,_),g=f({},s,g);else if(t.errorsWhileComputingFlags)if(a){var m=new Set(Object.keys(a).filter((t=>{var e;return!(null!=(e=a[t])&&e.failed)})));p=f({},i,Object.fromEntries(Object.entries(p).filter((t=>{var[e]=t;return m.has(e)})))),_=f({},r,Object.fromEntries(Object.entries(_||{}).filter((t=>{var[e]=t;return m.has(e)})))),g=f({},s,Object.fromEntries(Object.entries(g||{}).filter((t=>{var[e]=t;return m.has(e)}))))}else p=f({},i,p),_=f({},r,_),g=f({},s,g);e&&e.register(f({[ii]:Object.keys(la(p)),[ei]:p||{},[ni]:_||{},[si]:g||{}},h?{[oi]:h}:{},d?{[gi]:d}:{}))}}}(t,this.ni,r,s,n,i),e||(this.ss=!1),this.ps(e)}}override(t,e){void 0===e&&(e=!1),sa.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.ni)return sa.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.ni.unregister(ai),this.ni.unregister(li),this.ps(),na.info("All overrides cleared");if(R(t)){var e=aa(t);return this.ni.register({[ai]:e}),this.ps(),na.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,r=t;if(this.Jn=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.ni.unregister(ai),na.info("Flag overrides cleared");else if(r.flags){if(R(r.flags)){var s=aa(r.flags);this.ni.register({[ai]:s})}else this.ni.register({[ai]:r.flags});na.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.ni.unregister(li),na.info("Payload overrides cleared")):r.payloads&&(this.ni.register({[li]:r.payloads}),na.info("Payload overrides set",{payloads:r.payloads}))),void this.ps()}if(t&&"object"==typeof t)return this.ni.register({[ai]:t}),this.ps(),na.info("Flag overrides set",{flags:t});sa.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Kn){var{flags:e,flagVariants:i}=this.gs();t(e,i)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,i){var r,s=(this.os(ri)||[]).find((e=>e.flagKey===t)),n={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:n};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=f({},this.getFlagVariants(),{[t]:e});null==(r=this.ni)||r.register({[ii]:Object.keys(la(a)),[ei]:a}),this.ps()}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.os(ri),s=i?"&"+i.map((t=>"stage="+t)).join("&"):"";if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Bt.token+s),method:"GET",callback:e=>{var i,r;if(e.json){var s=e.json.earlyAccessFeatures;return null==(i=this.ni)||i.unregister(ri),null==(r=this.ni)||r.register({[ri]:s}),t(s)}}})}gs(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,i)=>(t[i]=e[i],t)),{})}}ps(t){var{flags:e,flagVariants:i}=this.gs();this.featureFlagEventHandlers.forEach((r=>r(e,i,{errorsLoading:t})))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var i=this.os(ui)||{},r=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),s=null==t?void 0:t.$set_once,n={};if(s)for(var o in s)({}).hasOwnProperty.call(s,o)&&(o in i||(n[o]=s[o]));this._instance.register({[ui]:f({},i,n,r)}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ui)}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var i=this.os(hi)||{};0!==Object.keys(i).length&&Object.keys(i).forEach((e=>{i[e]=f({},i[e],t[e]),delete t[e]})),this._instance.register({[hi]:f({},i,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.os(hi)||{};this._instance.register({[hi]:f({},e,{[t]:{}})})}else this._instance.unregister(hi)}reset(){this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.$anon_distinct_id=void 0,this.fs(),this.Jn=!1}}},_a={sessionRecording:class{get Bt(){return this._instance.config}get ni(){return this._instance.persistence}get started(){var t;return!(null==(t=this.ys)||!t.isStarted)}get status(){var t,e;return this.bs===No||this.bs===jo?this.bs:null!==(t=null==(e=this.ys)?void 0:e.status)&&void 0!==t?t:this.bs}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.bs=Lo,this._s=void 0,this._instance=t,!this._instance.sessionManager)throw Bo.error("started without valid sessionManager"),new Error(zo+" started without valid sessionManager. This is a bug.");if(this.Bt.cookieless_mode===Ci)throw new Error(zo+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get ws(){var e,i=!(null==(e=this._instance.get_property(Ye))||!e.enabled),r=!this.Bt.disable_session_recording,s=this.Bt.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&r&&!s}startIfEnabledOrStop(t){var e;if(!this.ws||null==(e=this.ys)||!e.isStarted){var i=!C(Object.assign)&&!C(Array.from);this.ws&&i?(this.Is(t),Bo.info("starting")):(this.bs=Lo,this.stopRecording())}}Is(t){var e,i,r;this.ws&&(this.bs!==No&&this.bs!==jo&&(this.bs=Uo),null!=h&&null!=(e=h.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=h.__PosthogExtensions__)&&i.initSessionRecording?this.Cs(t):null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Ss,(e=>{if(e)return Bo.error("could not load recorder",e);this.Cs(t)})))}stopRecording(){var t,e;null==(t=this._s)||t.call(this),this._s=void 0,null==(e=this.ys)||e.stop()}xs(){var t,e;null==(t=this._s)||t.call(this),this._s=void 0,null==(e=this.ys)||e.discard()}ks(){var t;null==(t=this.ni)||t.unregister(ti)}Ts(t,e){if(D(t))return null;var i,r=L(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(Bo.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}As(t){if(this.ni){var e,i,r=this.ni,s=()=>{var e,i=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.Ts(null==(e=this.Bt.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),n=this.Ts(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:n;D(o)&&this.ks();var a=null==i?void 0:i.minimumDurationMilliseconds;r.register({[Ye]:f({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:f({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:C(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};s(),null==(e=this._s)||e.call(this),this._s=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.As(t),void this.xs()):(this.As(t),void this.startIfEnabledOrStop()):(this.bs===No&&(this.bs=jo,Bo.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var i;void 0===e&&(e="log"),null!=(i=this.ys)&&i.log?this.ys.log(t,e):Bo.warn("log called before recorder was ready")}get Ss(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(Ye);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}Es(){var t,e=this._instance.get_property(Ye);if(!e)return!1;var i=null!==(t=("object"==typeof e?e:JSON.parse(e)).cache_timestamp)&&void 0!==t?t:Date.now();return 36e5>=Date.now()-i}Cs(t){var e,i;if(null==(e=h.__PosthogExtensions__)||!e.initSessionRecording)return Bo.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Pi]:!0});if(this.ys||(this.ys=null==(i=h.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.ys._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Es()){if(this.bs===jo||this.bs===No)return;return this.bs=No,Bo.info("persisted remote config is stale, requesting fresh config before starting"),void new vs(this._instance).load()}this.bs=Uo,this.ys.start(t)}onRRwebEmit(t){var e;null==(e=this.ys)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.ys||null==(e=this.ni)||e.register({[Ke]:!0}),null==(t=this.ys)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.ys||null==(e=this.ni)||e.register({[Je]:!0}),null==(t=this.ys)||t.overrideSampling()}overrideTrigger(t){var e,i;this.ys||null==(i=this.ni)||i.register({["url"===t?Xe:Qe]:!0}),null==(e=this.ys)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.ys)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.ys)||!i.tryAddCustomEvent(t,e))}}},ga={autocapture:class{constructor(t){this.Rs=!1,this.Ns=null,this.Ms=!1,this.instance=t,this.rageclicks=new To(t.config.rageclick),this.Fs=null}initialize(){this.startIfEnabled()}get Bt(){var t,e,i=O(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(t=i.url_allowlist)?void 0:t.map((t=>new RegExp(t))),i.url_ignorelist=null==(e=i.url_ignorelist)?void 0:e.map((t=>new RegExp(t))),i}Os(){if(this.isBrowserSupported()){if(t&&r){var e=e=>{e=e||(null==t?void 0:t.event);try{this.Ps(e)}catch(t){Ro.error("Failed to capture event",t)}};if(Xi(r,"submit",e,{capture:!0}),Xi(r,"change",e,{capture:!0}),Xi(r,"click",e,{capture:!0}),this.Bt.capture_copied_text){var i=e=>{e=e||(null==t?void 0:t.event);try{this.Ps(e,ko)}catch(t){Ro.error("Failed to capture copy/cut event",t)}};Xi(r,"copy",i,{capture:!0}),Xi(r,"cut",i,{capture:!0})}}}else Ro.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Rs&&(this.Os(),this.Rs=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Ms=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Ne]:!!t.autocapture_opt_out}),this.Ns=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Fs=t}getElementSelectors(t){var e,i=[];return null==(e=this.Fs)||e.forEach((e=>{var s=null==r?void 0:r.querySelectorAll(e);null==s||s.forEach((r=>{t===r&&i.push(e)}))})),i}get isEnabled(){var t,e,i=null==(t=this.instance.persistence)?void 0:t.props[Ne];if(M(this.Ns)&&!N(i)&&!this.instance.Fr())return!1;var r=null!==(e=this.Ns)&&void 0!==e?e:!!i;return!!this.instance.config.autocapture&&!r}Ps(e,i){if(void 0===i&&(i="$autocapture"),this.isEnabled){var r,s=so(e);Xn(s)&&(s=s.parentNode||null),"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&function(e,i){if(!t||ho(e))return!1;var r,s,n;if(N(i)?(r=!!i&&uo,s=void 0):(r=null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:uo,s=null==i?void 0:i.content_ignorelist),!1===r)return!1;var{targetElementList:o}=vo(e,!1);return!function(t,e){if(!1===t||C(t))return!1;var i;if(!0===t)i=lo;else{if(!R(t))return!1;if(t.length>10)return Ie.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=t.map((t=>t.toLowerCase()))}return e.some((t=>{var{safeText:e,ariaLabel:r}=t;return i.some((t=>e.includes(t)||r.includes(t)))}))}(s,o.map((t=>{var e;return{safeText:ro(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!oo(o,r)}(s,this.instance.config.rageclick)&&this.Ps(e,"$rageclick");var n=i===ko;if(s&&function(e,i,r,s,n){var o,a,l,u;if(void 0===r&&(r=void 0),!t||ho(e))return!1;if(null!=(o=r)&&o.url_allowlist&&!to(r.url_allowlist))return!1;if(null!=(a=r)&&a.url_ignorelist&&to(r.url_ignorelist))return!1;if(null!=(l=r)&&l.dom_event_allowlist){var h=r.dom_event_allowlist;if(h&&!h.some((t=>i.type===t)))return!1}var{parentIsUsefulElement:d,targetElementList:v}=vo(e,s);if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(C(i))return!0;var r,s=function(t){if(i.some((e=>t.tagName.toLowerCase()===e)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(v,r))return!1;if(!oo(v,null==(u=r)?void 0:u.css_selector_allowlist))return!1;var c=t.getComputedStyle(e);if(c&&"pointer"===c.getPropertyValue("cursor")&&"click"===i.type)return!0;var p=e.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(n||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(i.type)>=0;default:return d?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(no.indexOf(p)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,this.Bt,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=Io(s,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Bt.element_attribute_ignorelist,elementsChainAsString:this.Ms});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),i===ko){var u,h=io(null==t||null==(u=t.getSelection())?void 0:u.toString()),d=e.type||"clipboard";if(!h)return!1;o.$selected_content=h,o.$copy_type=d}return this.instance.capture(i,o),!0}}}isBrowserSupported(){return P(null==r?void 0:r.querySelectorAll)}},historyAutocapture:class{constructor(e){var i;this._instance=e,this.Ls=(null==t||null==(i=t.location)?void 0:i.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Ie.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ds&&this.Ds(),this.Ds=void 0,Ie.info("History API monitoring stopped")}monitorHistoryChanges(){var e,i;if(t&&t.history){var r=this;null!=(e=t.history.pushState)&&e.__posthog_wrapped__||Fo(t.history,"pushState",(t=>function(e,i,s){t.call(this,e,i,s),r.Bs("pushState")})),null!=(i=t.history.replaceState)&&i.__posthog_wrapped__||Fo(t.history,"replaceState",(t=>function(e,i,s){t.call(this,e,i,s),r.Bs("replaceState")})),this.js()}}Bs(e){try{var i,r=null==t||null==(i=t.location)?void 0:i.pathname;if(!r)return;r!==this.Ls&&this.isEnabled&&this._instance.capture(Ui,{navigation_type:e}),this.Ls=r}catch(t){Ie.error("Error capturing "+e+" pageview",t)}}js(){if(!this.Ds){var e=()=>{this.Bs("popstate")};Xi(t,"popstate",e),this.Ds=()=>{t&&t.removeEventListener("popstate",e)}}}},heatmaps:class{get Bt(){return this.instance.config}constructor(t){var e;this.$s=!1,this.Rs=!1,this.qs=null,this.instance=t,this.$s=!(null==(e=this.instance.persistence)||!e.props[je]),this.rageclicks=new To(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return O(this.Bt.capture_heatmaps)&&this.Bt.capture_heatmaps.flush_interval_milliseconds&&(t=this.Bt.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return D(this.Bt.capture_heatmaps)?D(this.Bt.enable_heatmaps)?this.$s:this.Bt.enable_heatmaps:!1!==this.Bt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Rs)return;Ho.info("starting..."),this.Zs(),this.Ft()}else{var t;clearInterval(null!==(t=this.qs)&&void 0!==t?t:void 0),this.Vs(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[je]:e}),this.$s=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.T;return this.T=void 0,t}Hs(t){this.Tt(t.originalEvent,"deadclick")}Ft(){this.qs&&clearInterval(this.qs),this.qs="visible"===(null==r?void 0:r.visibilityState)?setInterval(this.Yr.bind(this),this.flushIntervalMilliseconds):null}Zs(){t&&r&&(this.zs=this.Yr.bind(this),Xi(t,Li,this.zs),this.Us=e=>this.Tt(e||(null==t?void 0:t.event)),Xi(r,"click",this.Us,{capture:!0}),this.Ys=e=>this.Gs(e||(null==t?void 0:t.event)),Xi(r,"mousemove",this.Ys,{capture:!0}),this.Ws=new yr(this.instance,mr,this.Hs.bind(this)),this.Ws.startIfEnabledOrStop(),this.Xs=this.Ft.bind(this),Xi(r,Di,this.Xs),this.Rs=!0)}Vs(){var e;t&&r&&(this.zs&&t.removeEventListener(Li,this.zs),this.Us&&r.removeEventListener("click",this.Us,{capture:!0}),this.Ys&&r.removeEventListener("mousemove",this.Ys,{capture:!0}),this.Xs&&r.removeEventListener(Di,this.Xs),clearTimeout(this.Js),null==(e=this.Ws)||e.stop(),this.Rs=!1)}Ks(e,i){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(e,i,r){for(var s=e;s&&Jn(s)&&!Kn(s,"body");){if(s===r)return!1;if(w(i,null==t?void 0:t.getComputedStyle(s).position))return!0;s=ao(s)}return!1}(so(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:r),target_fixed:o,type:i}}Tt(t,e){var i;if(void 0===e&&(e="click"),!Yn(t.target)&&qo(t)){var r=this.Ks(t,e);null!=(i=this.rageclicks)&&i.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.Qs(f({},r,{type:"rageclick"})),this.Qs(r)}}Gs(t){!Yn(t.target)&&qo(t)&&(clearTimeout(this.Js),this.Js=setTimeout((()=>{this.Qs(this.Ks(t,"mousemove"))}),500))}Qs(e){if(t){var i=t.location.href,r=this.Bt.custom_personal_data_properties,s=this.Bt.mask_personal_data_properties?[...Fr,...r||[]]:[],n=Or(i,s,Mr);this.T=this.T||{},this.T[n]||(this.T[n]=[]),this.T[n].push(e)}}Yr(){this.T&&!I(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:yr,webVitalsAutocapture:class{constructor(t){var e;this.$s=!1,this.Rs=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.eo=()=>{clearTimeout(this.ro),0!==this.T.metrics.length&&(this._instance.capture("$web_vitals",this.T.metrics.reduce(((t,e)=>f({},t,{["$web_vitals_"+e.name+"_event"]:f({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ht=t=>{var e,i=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);if(C(i))Mo.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.io();C(r)||(D(null==t?void 0:t.name)||D(null==t?void 0:t.value)?Mo.error("Invalid metric received",t):!this.no||this.no>t.value?(this.T.url!==r&&(this.eo(),this.ro=setTimeout(this.eo,this.flushToCaptureTimeoutMs)),C(this.T.url)&&(this.T.url=r),this.T.firstMetricTimestamp=C(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.T.metrics.push(f({},t,{$current_url:r,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.eo()):Mo.error("Ignoring metric with value >= "+this.no,t))}},this.so=()=>{if(!this.Rs){var t,e,i,r,s=h.__PosthogExtensions__;C(s)||C(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:e,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),t&&e&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.ht.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&e(this.ht.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.ht.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.ht.bind(this)),this.Rs=!0):Mo.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.$s=!(null==(e=this._instance.persistence)||!e.props[qe]),this.startIfEnabled()}get oo(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=O(this.oo)?null==(t=this.oo)?void 0:t.web_vitals_allowed_metrics:void 0;return D(i)?(null==(e=this._instance.persistence)?void 0:e.props[Ge])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(O(this.oo)?this.oo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=O(this.oo)?this.oo.web_vitals_attribution:void 0;return null!=t&&t}get no(){var t=O(this.oo)&&L(this.oo.__web_vitals_max_value)?this.oo.__web_vitals_max_value:Do;return t>0&&6e4>=t?Do:t}get isEnabled(){var t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return Mo.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=O(this.oo)?this.oo.web_vitals:N(this.oo)?this.oo:void 0;return N(e)?e:this.$s}startIfEnabled(){this.isEnabled&&!this.Rs&&(Mo.info("enabled, starting..."),this.ur(this.so))}onRemoteConfig(t){if("capturePerformance"in t){var e=O(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=O(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[qe]:e}),this._instance.persistence.register({[Ge]:i})),this.$s=e,this.startIfEnabled()}}ur(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.postHogWebVitalsCallbacks?t():null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(e=>{e?Mo.error("failed to load script",e):t()}))}io(){var e=t?t.location.href:void 0;if(e){var i=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Fr,...i||[]]:[];return Or(e,r,Mr)}Mo.error("Could not determine current URL")}}},ma={exceptionObserver:class{constructor(e){var i,r,s;this.so=()=>{var e;if(t&&this.isEnabled&&null!=(e=h.__PosthogExtensions__)&&e.errorWrappingFunctions){var i=h.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=h.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=h.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ao&&this.Bt.capture_unhandled_errors&&(this.ao=i(this.captureException.bind(this))),!this.lo&&this.Bt.capture_unhandled_rejections&&(this.lo=r(this.captureException.bind(this))),!this.uo&&this.Bt.capture_console_errors&&(this.uo=s(this.captureException.bind(this)))}catch(t){Co.error("failed to start",t),this.ho()}}},this._instance=e,this.co=!(null==(i=this._instance.persistence)||!i.props[ze]),this.do=new J({refillRate:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==r?r:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,Gt:Co}),this.Bt=this.vo(),this.startIfEnabledOrStop()}vo(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return O(t)?e=f({},e,t):(C(t)?this.co:t)&&(e=f({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Bt.capture_console_errors||this.Bt.capture_unhandled_errors||this.Bt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Co.info("enabled"),this.ho(),this.ur(this.so)):this.ho()}ur(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.errorWrappingFunctions&&t(),null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return Co.error("failed to load script",e);t()}))}ho(){var t,e,i;null==(t=this.ao)||t.call(this),this.ao=void 0,null==(e=this.lo)||e.call(this),this.lo=void 0,null==(i=this.uo)||i.call(this),this.uo=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.co=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[ze]:this.co}),this.Bt=this.vo(),this.startIfEnabledOrStop())}onConfigChange(){this.Bt=this.vo()}captureException(t){var e,i,r,s=null!==(e=null==t||null==(i=t.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==e?e:"Exception";this.do.consumeRateLimit(s)?Co.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,i;this.fo=[],this.po=new te([new ve,new xe,new pe,new ce,new ye,new be,new _e,new we],function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];return function(e,r){void 0===r&&(r=0);for(var s=[],n=e.split("\n"),o=r;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=de.test(a)?a.replace(de,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of i){var h=u(l,t);if(h){s.push(h);break}}if(s.length>=50)break}}}return function(t){if(!t.length)return[];var e=Array.from(t);return e.reverse(),e.slice(0,50).map((t=>{return f({},t,{filename:t.filename||(i=e,i[i.length-1]||{}).filename,function:t.function||ee});var i}))}(s)}}("web:javascript",ae,he)),this._instance=t,this.fo=null!==(e=null==(i=this._instance.persistence)?void 0:i.get_property(Be))&&void 0!==e?e:[],this.mo=ke(this.yo()),this.bo=new Re(this.mo)}onConfigChange(){this.mo=ke(this.yo()),this.bo.setConfig(this.mo)}onRemoteConfig(t){var e,i,r;if("errorTracking"in t){var s=null!==(e=null==(i=t.errorTracking)?void 0:i.suppressionRules)&&void 0!==e?e:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.fo=s,this._instance.persistence&&this._instance.persistence.register({[Be]:this.fo,[He]:n})}}get _o(){var t,e=!!this._instance.get_property(He),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.po.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.mo.enabled)try{if(!F(t)||0===t.trim().length)return void ua.warn("Ignoring exception step because message must be a non-empty string");var i=this.wo(e),{sanitizedProperties:r,droppedKeys:s}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>$e.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(i);s.length>0&&ua.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.bo.add(f({[Ee]:t,[Se]:(new Date).toISOString()},r))}catch(t){ua.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.Io(e)){if(this.Co(e))return this.So("Exception dropped: matched a suppression rule"),void ua.info("Skipping exception capture because a suppression rule matched");if(!this._o&&this.xo(e))return this.So("Exception dropped: thrown by a browser extension"),void ua.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ko(e))return this.So("Exception dropped: thrown by the PostHog SDK"),void ua.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.mo.enabled&&D(t.$exception_steps)?this.To(t):t;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",en:!0});return r&&this.bo.clear(),r}catch(t){return ua.error("Failed to capture exception event. Dropping this exception.",t),void this.bo.clear()}}catch(t){return void ua.error("Failed to process exception event. Ignoring this exception.",t)}}To(t){try{var e=this.bo.getAttachable();return 0===e.length?t:f({},t,{$exception_steps:e})}catch(e){return ua.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}So(t){this.mo.enabled&&this.bo.add({[Ee]:t,[Se]:(new Date).toISOString()})}wo(t){return O(t)?f({},t):{}}yo(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}Co(t){if(0===t.length)return!1;var e=t.reduce(((t,e)=>{var{type:i,value:r}=e;return F(i)&&i.length>0&&t.$exception_types.push(i),F(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.fo.some((t=>{var i=t.values.map((t=>{var i,r=_n[t.operator],s=R(t.value)?t.value:[t.value],n=null!==(i=e[t.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)}));return"OR"===t.type?i.some(Boolean):i.every(Boolean)}))}xo(t){return t.flatMap((t=>{var e,i;return null!==(e=null==(i=t.stacktrace)?void 0:i.frames)&&void 0!==e?e:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ko(t){if(t.length>0){var e,i,r,s,n=null!==(e=null==(i=t[0].stacktrace)?void 0:i.frames)&&void 0!==e?e:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Io(t){return!D(t)&&R(t)}}},ba=f({productTours:class{get ni(){return this._instance.persistence}constructor(t){this.Ao=null,this.Eo=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this.ni&&this.ni.register({[We]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,e;this.Ao||(t=this._instance).config.disable_product_tours||null==(e=t.persistence)||!e.get_property(We)||this.ur((()=>this.Ro()))}ur(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?Vo.error("Could not load product tours script",e):t()}))}Ro(){var t;!this.Ao&&null!=(t=h.__PosthogExtensions__)&&t.generateProductTours&&(this.Ao=h.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!R(this.Eo)||e){var i=this.ni;if(i){var r=i.props[ci];if(R(r)&&!e)return this.Eo=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:e=>{var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return Vo.error(s),void t([],{isLoaded:!1,error:s})}var n=R(e.json.product_tours)?e.json.product_tours:[];this.Eo=n,i&&i.register({[ci]:n}),t(n,{isLoaded:!0})}})}else t(this.Eo,{isLoaded:!0})}getActiveProductTours(t){D(this.Ao)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ao.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.Ao)||e.showTourById(t)}previewTour(t){this.Ao?this.Ao.previewTour(t):this.ur((()=>{var e;this.Ro(),null==(e=this.Ao)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Ao)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Ao)||t.nextStep()}previousStep(){var t;null==(t=this.Ao)||t.previousStep()}clearCache(){var t;this.Eo=null,null==(t=this.ni)||t.unregister(ci)}resetTour(t){var e;null==(e=this.Ao)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.Ao)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.Ao)||e.cancelPendingTour(t)}}},fa),ya={siteApps:class{constructor(t){this._instance=t,this.No=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Mo(t,e){if(e){var i=this.globalsForEvent(e);this.No.push(i),this.No.length>1e3&&(this.No=this.No.slice(10))}}get siteAppLoaders(){var t;return null==(t=h._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Mo.bind(this));this.Fo=()=>{t(),this.No=[],this.Fo=void 0}}}globalsForEvent(t){var e,i,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[d,v]of Object.entries(h))l[d]={id:u[d],type:d,properties:v};var{$set_once:c,$set:p}=t;return{event:f({},_(t,Wo),{properties:f({},t.properties,p?{$set:f({},null!==(e=null==(i=t.properties)?void 0:i.$set)&&void 0!==e?e:{},p)}:{},c?{$set_once:f({},null!==(r=null==(s=t.properties)?void 0:s.$set_once)&&void 0!==r?r:{},c)}:{}),elements_chain:null!==(n=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=t.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(t){var e=this.apps[t.id],i=()=>{var i;!e.errored&&this.No.length&&(Go.info("Processing "+this.No.length+" events for site app with id "+t.id),this.No.forEach((t=>null==e.processEvent?void 0:e.processEvent(t))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this.Fo)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,Go.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=t.init({posthog:this._instance,callback(t){s(t)}});n&&(e.processEvent=n),r=!0}catch(e){Go.error(Yo+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){Go.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}Oo(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of t)this.setupSiteApp(i)}Po(t){if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(e)}catch(e){Go.error("Error while processing event "+t.event+" for site app "+i.id,e)}}}onRemoteConfig(t){var e,i,r,s=this;if(null!=(e=this.siteAppLoaders)&&e.length)return this.isEnabled?(this.Oo(),void this._instance.on("eventCaptured",(t=>this.Po(t)))):void Go.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Fo)||i.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var e;h["__$$ph_site_app_"+t]=s._instance,null==(e=h.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(s._instance,a,(e=>{if(e)return Go.error(Yo+t,e)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else Go.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},wa={tracingHeaders:class{constructor(t){this.Lo=void 0,this.Do=void 0,this.so=()=>{var t,e,i=this.Bo()||[];C(this.Lo)&&(null==(t=h.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(i,this._instance.get_distinct_id(),this._instance.sessionManager)),C(this.Do)&&(null==(e=h.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchFetch(i,this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}initialize(){this.startIfEnabledOrStop()}ur(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.tracingHeadersPatchFns&&t(),null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return Ao.error("failed to load script",e);t()}))}Bo(){var t;return null!==(t=this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}startIfEnabledOrStop(){var t,e;this.Bo()?this.ur(this.so):(null==(t=this.Lo)||t.call(this),null==(e=this.Do)||e.call(this),this.Lo=void 0,this.Do=void 0)}}},xa=f({surveys:class{get Bt(){return this._instance.config}constructor(t){this.jo=void 0,this._surveyManager=null,this.$o=!1,this.qo=[],this.Zo=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Bt.disable_surveys){var e=t.surveys;if(D(e))return En.warn("Flags not loaded yet. Not loading surveys.");var i=R(e);this.jo=i?e.length>0:e,En.info("flags response received, isSurveysEnabled: "+this.jo),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],e=0;e<localStorage.length;e++){var i=localStorage.key(e);(null!=i&&i.startsWith(Sn)||null!=i&&i.startsWith("inProgressSurvey_"))&&t.push(i)}t.forEach((t=>localStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.$o)En.info("Already initializing surveys, skipping...");else if(this.Bt.disable_surveys)En.info(ta);else if(this.Bt.cookieless_mode&&this._instance.consent.isOptedOut())En.info("Not loading surveys in cookieless mode without consent.");else{var t=null==h?void 0:h.__PosthogExtensions__;if(t){if(!C(this.jo)||this.Bt.advanced_enable_surveys){var e=this.jo||this.Bt.advanced_enable_surveys;this.$o=!0;try{var i=t.generateSurveys;if(i)return void this.Vo(i,e);var r=t.loadExternalDependency;if(!r)return void this.Ho(Oi);r(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.Ho("Could not load surveys script",i):this.Vo(t.generateSurveys,e)}))}catch(t){throw this.Ho("Error initializing surveys",t),t}finally{this.$o=!1}}}else En.error("PostHog Extensions not found.")}}Vo(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new Qo(this._instance),En.info("Surveys loaded successfully"),this.zo({isLoaded:!0})}Ho(t,e){En.error(t,e),this.zo({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.qo.push(t),this._surveyManager&&this.zo({isLoaded:!0}),()=>{this.qo=this.qo.filter((e=>e!==t))}}getSurveys(t,e){if(void 0===e&&(e=!1),this.Bt.disable_surveys)return En.info(ta),t([]);var i,r=this._instance.get_property(di);if(r&&!e)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.Zo?this.Zo.then((e=>{var{surveys:i,context:r}=e;return t(i,r)})):("undefined"!=typeof Promise&&(this.Zo=new Promise((t=>{i=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Bt.token),method:"GET",timeout:this.Bt.surveys_request_timeout_ms,callback:e=>{var r;this.Zo=null;var s=e.statusCode;if(200!==s||!e.json){var n="Surveys API could not be loaded, status: "+s;En.error(n);var o={isLoaded:!1,error:n};return t([],o),void(null==i||i({surveys:[],context:o}))}var a,l=e.json.surveys||[],u=l.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var e;return!(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}(t)||function(t){var e;return!(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)||!e.length)}(t))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(r=this._instance.persistence)||r.register({[di]:l});var h={isLoaded:!0};t(l,h),null==i||i({surveys:l,context:h})}}))}zo(t){for(var e of this.qo)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){En.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!D(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);En.warn("init was not called")}Uo(t){var e=null;return this.getSurveys((i=>{var r;e=null!==(r=i.find((e=>e.id===t)))&&void 0!==r?r:null})),e}Yo(t){if(D(this._surveyManager))return{eligible:!1,reason:Zo};var e="string"==typeof t?this.Uo(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(D(this._surveyManager))return En.warn("init was not called"),{visible:!1,disabledReason:Zo};var e=this.Yo(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return D(this._surveyManager)?(En.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Zo})):new Promise((i=>{this.getSurveys((e=>{var r,s=null!==(r=e.find((e=>e.id===t)))&&void 0!==r?r:null;if(s){var n=this.Yo(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var s;if(D(this._surveyManager))En.warn("init was not called");else{var n="string"==typeof t?this.Uo(t):t;if(null!=n&&n.id)if($n.includes(n.type)){var o=null==r?void 0:r.querySelector(e);if(o)return null!=(s=n.appearance)&&s.surveyPopupDelaySeconds?(En.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,e;En.info("Rendering survey "+n.id+" with delay of "+(null==(t=n.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(e=this._surveyManager)||e.renderSurvey(n,o,i),En.info("Survey "+n.id+" rendered")}),1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,o,i);En.warn("Survey element not found")}else En.warn("Surveys of type "+n.type+" cannot be rendered in the app");else En.warn("Survey not found")}}displaySurvey(t,e){var i;if(D(this._surveyManager))En.warn("init was not called");else{var r=this.Uo(t);if(r){var s=r;if(null!=(i=r.appearance)&&i.surveyPopupDelaySeconds&&e.ignoreDelay&&(s=f({},r,{appearance:f({},r.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==ns.Popover&&e.initialResponses&&En.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void En.warn("Survey is not eligible to be displayed: ",n.disabledReason)}e.displayType!==ns.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}else En.warn("Survey not found")}}cancelPendingSurvey(t){D(this._surveyManager)?En.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},fa),Ea={toolbar:class{constructor(t){this.instance=t}Go(t){h.ph_toolbar_state=t}Wo(){var t;return null!==(t=h.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,i,s){if(void 0===e&&(e=void 0),void 0===i&&(i=void 0),void 0===s&&(s=void 0),Qi(this.instance.config))return!1;if(!t||!r)return!1;e=null!=e?e:t.location,s=null!=s?s:t.history;try{if(!i){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}i=null==t?void 0:t.localStorage}var n,o=ea||Ir(e.hash,"__posthog")||Ir(e.hash,"state"),a=o?Wi((()=>JSON.parse(atob(decodeURIComponent(o)))))||Wi((()=>JSON.parse(decodeURIComponent(o)))):null;return a&&"ph_authorize"===a.action?((n=a).source="url",n&&Object.keys(n).length>0&&(a.desiredHash?e.hash=a.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):((n=JSON.parse(i.getItem(ia)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(t){return!1}}Xo(t){var e=h.ph_load_toolbar||h.ph_load_editor;!D(e)&&P(e)?e(t,this.instance):ra.warn("No toolbar load function found")}loadToolbar(e){var i=!(null==r||!r.getElementById($i));if(!t||i)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=f({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(ia,JSON.stringify(f({},n,{source:void 0}))),2===this.Wo())this.Xo(n);else if(0===this.Wo()){var o;this.Go(1),null==(o=h.__PosthogExtensions__)||null==o.loadExternalDependency||o.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return ra.error("[Toolbar] Failed to load",t),void this.Go(0);this.Go(2),this.Xo(n)})),Xi(t,"turbolinks:load",(()=>{this.Go(0),this.loadToolbar(n)}))}return!0}Jo(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,i){return void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(t,e,i)}}},Sa=f({experiments:va},fa),$a={conversations:class{constructor(t){this.Ko=void 0,this._conversationsManager=null,this.Qo=!1,this.ea=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;D(e)||(N(e)?this.Ko=e:(this.Ko=e.enabled,this.ea=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Ko=void 0,this.ea=null}loadIfEnabled(){if(!(this._conversationsManager||this.Qo||this._instance.config.disable_conversations||Qi(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==h?void 0:h.__PosthogExtensions__;if(t&&!C(this.Ko)&&this.Ko)if(this.ea&&this.ea.token){this.Qo=!0;try{var e=t.initConversations;if(e)return this.ta(e),void(this.Qo=!1);var i=t.loadExternalDependency;if(!i)return void this.ra(Oi);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.ra("Could not load conversations script",e):this.ta(t.initConversations),this.Qo=!1}))}catch(t){this.ra("Error initializing conversations",t),this.Qo=!1}}else ca.error("Conversations enabled but missing token in remote config.")}}ta(t){if(this.ea)try{this._conversationsManager=t(this.ea,this._instance),ca.info("Conversations loaded successfully")}catch(t){this.ra("Error completing conversations initialization",t)}else ca.error("Cannot complete initialization: remote config is null")}ra(t,e){ca.error(t,e),this._conversationsManager=null,this.Qo=!1}show(){this._conversationsManager?this._conversationsManager.show():ca.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Ko&&!M(this._conversationsManager)}isVisible(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,e,i){var r=this;return p((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,e,i):(ca.warn(pa),null)}))()}getMessages(t,e){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(ca.warn(pa),null)}))()}markAsRead(t){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(ca.warn(pa),null)}))()}getTickets(t){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(ca.warn(pa),null)}))()}requestRestoreLink(t){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(ca.warn(pa),null)}))()}restoreFromToken(t){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(ca.warn(pa),null)}))()}restoreFromUrlToken(){var t=this;return p((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(ca.warn(pa),null)}))()}getCurrentTicketId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}un(){var t;null==(t=this._conversationsManager)||t.setIdentity()}hn(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},Ta={logs:class{constructor(t){var e;this.ia=!1,this.na=!1,this.Gt=Ce("[logs]"),this.sa=[],this.oa=0,this.aa=0,this.la=!1,this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.ia=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,i=null==(e=t.logs)?void 0:e.captureConsoleLogs;!D(i)&&i&&(this.ia=!0,this.loadIfEnabled())}reset(){this.sa=[],this.jr&&(clearTimeout(this.jr),this.jr=void 0),this.oa=0,this.aa=0,this.la=!1}loadIfEnabled(){if(this.ia&&!this.na){var t=null==h?void 0:h.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(e=>{var i;e||null==(i=t.logs)||!i.initializeLogs?this.Gt.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.na=!0)})):this.Gt.error(Oi)}else this.Gt.error("PostHog Extensions not found.")}}captureLog(t){var e,i,r,s,n,o;if(this._instance.is_capturing())if(t&&t.body){var a=null!==(e=null==(i=this._instance.config.logs)?void 0:i.flushIntervalMs)&&void 0!==e?e:3e3,l=null!==(r=null==(s=this._instance.config.logs)?void 0:s.maxLogsPerInterval)&&void 0!==r?r:1e3,u=Date.now();if(a>u-this.aa||(this.aa=u,this.oa=0,this.la=!1),l>this.oa){this.oa++;var h=function(t,e){var i=t.level||"info",{text:r,number:s}=Jt[i]||Kt,n=String(Date.now())+"000000",o={};e.distinctId&&(o.posthogDistinctId=e.distinctId),e.sessionId&&(o.sessionId=e.sessionId),e.currentUrl&&(o["url.full"]=e.currentUrl),e.screenName&&(o["screen.name"]=e.screenName),e.appState&&(o["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(o.feature_flags=e.activeFeatureFlags);var a=f({},o,t.attributes||{}),l={timeUnixNano:n,observedTimeUnixNano:n,severityNumber:s,severityText:r,body:{stringValue:t.body},attributes:Qt(a)};return t.trace_id&&(l.traceId=t.trace_id),t.span_id&&(l.spanId=t.span_id),C(t.trace_flags)||(l.flags=t.trace_flags),l}(t,this.ua());this.sa.push({record:h}),(null!==(n=null==(o=this._instance.config.logs)?void 0:o.maxBufferSize)&&void 0!==n?n:100)>this.sa.length?this.ha():this.flushLogs()}else this.la||(this.Gt.warn("captureLog dropping logs: exceeded "+l+" logs per "+a+"ms"),this.la=!0)}else this.Gt.warn("captureLog requires a body")}get logger(){return this.ca||(this.ca={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.ca}flushLogs(t){if(this.jr&&(clearTimeout(this.jr),this.jr=void 0),0!==this.sa.length){var e=this.sa;this.sa=[];var i=this._instance.config.logs,r=f({"service.name":(null==i?void 0:i.serviceName)||"unknown_service"},(null==i?void 0:i.environment)&&{"deployment.environment":i.environment},(null==i?void 0:i.serviceVersion)&&{"service.version":i.serviceVersion},null==i?void 0:i.resourceAttributes),s=function(t,e,i,r){return{resourceLogs:[{resource:{attributes:Qt(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}(e.map((t=>t.record)),r,v.LIB_NAME,v.LIB_VERSION),n=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Vi({method:"POST",url:n,data:s,compression:"best-available",batchKey:"logs",transport:t})}}ha(){var t,e;this.jr||(this.jr=setTimeout((()=>{this.jr=void 0,this.flushLogs()}),null!==(t=null==(e=this._instance.config.logs)?void 0:e.flushIntervalMs)&&void 0!==t?t:3e3))}ua(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=i}if(null!=h&&null!=(t=h.location)&&t.href&&(e.currentUrl=h.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(e.activeFeatureFlags=r)}return e}}},ka=f({},fa,_a,ga,ma,ba,ya,xa,wa,Ea,Sa,$a,Ta);qn.__defaultExtensionClasses=f({},ka);var Ra,Pa=(Ra=In[Un]=new qn,function(){function e(){e.done||(e.done=!0,Nn=!1,Hi(In,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?e():Xi(r,"DOMContentLoaded",e,{capture:!1}):t&&Ie.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),Ra);export{ps as Compression,os as DEFAULT_PRODUCT_TOUR_APPEARANCE,ns as DisplaySurveyType,qn as PostHog,as as ProductTourEventName,ls as ProductTourEventProperties,rs as SurveyEventName,ss as SurveyEventProperties,Jr as SurveyEventType,Xr as SurveyPosition,es as SurveyQuestionBranchingType,ts as SurveyQuestionType,is as SurveySchedule,Qr as SurveyTabPosition,Zr as SurveyType,Kr as SurveyWidgetType,Pa as default,Pa as posthog,cs as severityLevels};
1
+ var t="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:t;"undefined"==typeof self&&(e.self=e),"undefined"==typeof File&&(e.File=function(){});var i=null==e?void 0:e.navigator,r=null==e?void 0:e.document,s=null==e?void 0:e.location,n=null==e?void 0:e.fetch,o=null!=e&&e.XMLHttpRequest&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,l=null==e?void 0:e.CompressionStream,u=null==i?void 0:i.userAgent,h=null!=t?t:{},d="1.372.5",v={DEBUG:!1,LIB_VERSION:d,LIB_NAME:"web",JS_SDK_VERSION:d};function c(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(r,s)}function p(t){return function(){var e=this,i=arguments;return new Promise((function(r,s){var n=t.apply(e,i);function o(t){c(n,r,s,o,a,"next",t)}function a(t){c(n,r,s,o,a,"throw",t)}o(void 0)}))}}function f(){return f=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},f.apply(null,arguments)}function _(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}function g(){return g=p((function*(t,e,i){void 0===e&&(e=!0);try{var r=new CompressionStream("gzip"),s=r.writable.getWriter(),n=s.write((new TextEncoder).encode(t)).then((()=>s.close())).catch(function(){var t=p((function*(t){try{yield s.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),o=new Response(r.readable).blob(),[a]=yield Promise.all([o,n]);return a}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),g.apply(this,arguments)}var m=["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"],b=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return m.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))},y=["$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"];function w(t,e){return-1!==t.indexOf(e)}var x=function(t){return t.trim()},E=function(t){return t.replace(/^\$/,"")},S=Object.prototype,T=S.hasOwnProperty,k=S.toString,R=Array.isArray||function(t){return"[object Array]"===k.call(t)},P=t=>"function"==typeof t,O=t=>t===Object(t)&&!R(t),I=t=>{if(O(t)){for(var e in t)if(T.call(t,e))return!1;return!0}return!1},C=t=>void 0===t,F=t=>"[object String]"==k.call(t),A=t=>F(t)&&0===t.trim().length,M=t=>null===t,D=t=>C(t)||M(t),L=t=>"[object Number]"==k.call(t)&&t==t,U=t=>L(t)&&t>0,N=t=>"[object Boolean]"===k.call(t),j=t=>t instanceof FormData,z=t=>w(y,t);function B(t){return null===t||"object"!=typeof t}function H(t,e){return{}.toString.call(t)==="[object "+e+"]"}function q(t){return"undefined"!=typeof Event&&function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Event)}var V=[!0,"true",1,"1","yes"],W=t=>w(V,t),G=[!1,"false",0,"0","no"];function Y(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),L(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),Y(s||i,e,i,r))}class J{constructor(t){this.$t={},this.zt=t.zt,this.Ut=Y(t.bucketSize,0,100,t.Gt),this.Wt=Y(t.refillRate,0,this.Ut,t.Gt),this.Xt=Y(t.refillInterval,0,864e5,t.Gt)}Jt(t,e){var i=Math.floor((e-t.lastAccess)/this.Xt);i>0&&(t.tokens=Math.min(t.tokens+i*this.Wt,this.Ut),t.lastAccess=t.lastAccess+i*this.Xt)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.$t[r];return s?this.Jt(s,i):this.$t[r]=s={tokens:this.Ut,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.zt)||e.call(this,t)),0===s.tokens)}stop(){this.$t={}}}var K,X,Q,Z="Mobile",tt="iOS",et="Android",it="Tablet",rt=et+" "+it,st="iPad",nt="Apple",ot=nt+" Watch",at="Safari",lt="BlackBerry",ut="Samsung",ht=ut+"Browser",dt=ut+" Internet",vt="Chrome",ct=vt+" OS",pt=vt+" "+tt,ft="Internet Explorer",_t=ft+" "+Z,gt="Opera",mt=gt+" Mini",bt="Edge",yt="Microsoft "+bt,wt="Firefox",xt=wt+" "+tt,Et="Nintendo",St="PlayStation",$t="Xbox",Tt=et+" "+Z,kt=Z+" "+at,Rt="Windows",Pt=Rt+" Phone",Ot="Nokia",It="Ouya",Ct="Generic",Ft=Ct+" "+Z.toLowerCase(),At=Ct+" "+it.toLowerCase(),Mt="Konqueror",Dt="(\\d+(\\.\\d+)?)",Lt=new RegExp("Version/"+Dt),Ut=new RegExp($t,"i"),Nt=new RegExp(St+" \\w+","i"),jt=new RegExp(Et+" \\w+","i"),zt=new RegExp(lt+"|PlayBook|BB10","i"),Bt={"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"},Ht=function(t,e){return e=e||"",w(t," OPR/")&&w(t,"Mini")?mt:w(t," OPR/")?gt:zt.test(t)?lt:w(t,"IE"+Z)||w(t,"WPDesktop")?_t:w(t,ht)?dt:w(t,bt)||w(t,"Edg/")?yt:w(t,"FBIOS")?"Facebook "+Z:w(t,"UCWEB")||w(t,"UCBrowser")?"UC Browser":w(t,"CriOS")?pt:w(t,"CrMo")||w(t,vt)?vt:w(t,et)&&w(t,at)?Tt:w(t,"FxiOS")?xt:w(t.toLowerCase(),Mt.toLowerCase())?Mt:((t,e)=>e&&w(e,nt)||function(t){return w(t,at)&&!w(t,vt)&&!w(t,et)}(t))(t,e)?w(t,Z)?kt:at:w(t,wt)?wt:w(t,"MSIE")||w(t,"Trident/")?ft:w(t,"Gecko")?wt:""},qt={[_t]:[new RegExp("rv:"+Dt)],[yt]:[new RegExp(bt+"?\\/"+Dt)],[vt]:[new RegExp("("+vt+"|CrMo)\\/"+Dt)],[pt]:[new RegExp("CriOS\\/"+Dt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Dt)],[at]:[Lt],[kt]:[Lt],[gt]:[new RegExp("(Opera|OPR)\\/"+Dt)],[wt]:[new RegExp(wt+"\\/"+Dt)],[xt]:[new RegExp("FxiOS\\/"+Dt)],[Mt]:[new RegExp("Konqueror[:/]?"+Dt,"i")],[lt]:[new RegExp(lt+" "+Dt),Lt],[Tt]:[new RegExp("android\\s"+Dt,"i")],[dt]:[new RegExp(ht+"\\/"+Dt)],[ft]:[new RegExp("(rv:|MSIE )"+Dt)],Mozilla:[new RegExp("rv:"+Dt)]},Vt=function(t,e){var i=Ht(t,e),r=qt[i];if(C(r))return null;for(var s=0;r.length>s;s++){var n=t.match(r[s]);if(n)return parseFloat(n[n.length-2])}return null},Wt=[[new RegExp($t+"; "+$t+" (.*?)[);]","i"),t=>[$t,t&&t[1]||""]],[new RegExp(Et,"i"),[Et,""]],[new RegExp(St,"i"),[St,""]],[zt,[lt,""]],[new RegExp(Rt,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Pt,""];if(new RegExp(Z).test(e)&&!/IEMobile\b/.test(e))return[Rt+" "+Z,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Bt[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[Rt,r]}return[Rt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[tt,[t[3],t[4],t[5]||"0"].join(".")]:[tt,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=C(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+et+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+et+")","i"),t=>t&&t[2]?[et,[t[2],t[3],t[4]||"0"].join(".")]:[et,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ct,""]],[/Linux|debian/i,["Linux",""]]],Gt=function(t){return jt.test(t)?Et:Nt.test(t)?St:Ut.test(t)?$t:new RegExp(It,"i").test(t)?It:new RegExp("("+Pt+"|WPDesktop)","i").test(t)?Pt:/iPad/.test(t)?st:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ot:zt.test(t)?lt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Ot,"i").test(t)?Ot:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(Z).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?et:rt:new RegExp("(pda|"+Z+")","i").test(t)?Ft:new RegExp(it,"i").test(t)&&!new RegExp(it+" pc","i").test(t)?At:""},Yt=t=>t instanceof Error,Jt={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}},Kt=Jt.info;function Xt(t){if(N(t))return{boolValue:t};if("number"==typeof t)return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if("string"==typeof t)return{stringValue:t};if(R(t))return{arrayValue:{values:t.map((t=>Xt(t)))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}function Qt(t){var e=[];for(var i in t){var r=t[i];M(r)||C(r)||e.push({key:i,value:Xt(r)})}return e}function Zt(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return Q&&i.length===X||(X=i.length,Q=i.reduce(((i,r)=>{K||(K={});var s=K[r];if(s)i[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=e[r];if(l&&u){i[l]=u,K[r]=[l,u];break}}return i}),{})),Q}}class te{constructor(t,e,i){void 0===i&&(i=[]),this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e){void 0===e&&(e={});var i=e&&e.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(t){var e=this;return p((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&R(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t}))()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null==(e=t.syntheticException)?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var i,r;return null!=t.cause&&(i=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),f({},t,{cause:i,stack:r})}applyChunkIds(t,e){return t.map((t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t)))}applyCoercers(t,e){for(var i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var e=this;return p((function*(){var i=t;for(var r of e.modifiers)i=yield r(i);return i}))()}convertToExceptionList(t,e){var i,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(i=e.type)&&void 0!==i?i:"generic",handled:null===(r=e.handled)||void 0===r||r,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});var o=[n];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,f({},e,{handled:!0}))),o}buildParsingContext(t){var e;return{chunkIdMap:Zt(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,i){void 0===i&&(i=0);var r=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(t,e,r);return this.applyCoercers(i,s)}};return f({},e,{syntheticException:0==i?e.syntheticException:void 0,mechanism:t,apply:t=>r(t,i),next:t=>r(t,i+1)})}}var ee="?";function ie(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?ee:i,in_app:!0};return C(r)||(n.lineno=r),C(s)||(n.colno=s),n}var re=(t,e)=>{var i=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return i||r?[-1!==t.indexOf("@")?t.split("@")[0]:ee,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},se=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ne=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,oe=/\((\S*)(?::(\d+))(?::(\d+))\)/,ae=(t,e)=>{var i=se.exec(t);if(i){var[,r,s,n]=i;return ie(e,r,ee,+s,+n)}var o=ne.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=oe.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=re(o[1]||ee,o[2]);return ie(e,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},le=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ue=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,he=(t,e)=>{var i=le.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=ue.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||ee;return[n,s]=re(n,s),ie(e,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},de=/\(error: (.*)\)/;class ve{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=F(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?e+": "+t.message:e}isDOMException(t){return H(t,"DOMException")}isDOMError(t){return H(t,"DOMError")}}class ce{match(t){return(t=>t instanceof Error)(t)}coerce(t,e){return{type:this.getType(t),value:this.getMessage(t,e),stack:this.getStack(t),cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,e){var i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}}class pe{constructor(){}match(t){return H(t,"ErrorEvent")&&null!=t.error}coerce(t,e){var i;return e.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}var fe=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class _e{match(t){return"string"==typeof t}coerce(t,e){var i,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(t){var e="Error",i=t,r=t.match(fe);return r&&(e=r[1],i=r[2]),[e,i]}}var ge=["fatal","error","warning","log","info","debug"];function me(t,e){void 0===e&&(e=40);var i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(e>=s.length)return r===i.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class be{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,r=this.getErrorPropertyFromObject(t);return r?e.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(i=e.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return q(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var e="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(e+=" with message: '"+t.message+"'"),e}if("message"in t&&"string"==typeof t.message)return t.message;var i=this.getObjectClassName(t);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+me(t)}isSeverityLevel(t){return F(t)&&!A(t)&&ge.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(Yt(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class ye{match(t){return q(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+me(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class we{match(t){return B(t)}coerce(t,e){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class xe{match(t){return H(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!q(t))return!1;try{var e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i,r=this.getUnhandledRejectionReason(t);return B(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}:e.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var Ee="$message",Se="$timestamp",$e=new Set([Ee,Se]),Te={enabled:!0,max_bytes:32768};function ke(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:Te.enabled,max_bytes:Pe(t.max_bytes,Te.max_bytes)}:f({},Te)}class Re{constructor(t){this.Kt=[],this.Qt=0,this.Bt=ke(t)}setConfig(t){this.Bt=ke(t),this.er()}add(t){var e=function(t){var e=function(t){var e=new WeakSet;try{return JSON.stringify(t,((t,i)=>{if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Date)return i.toISOString();if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){if(e.has(i))return"[Circular]";e.add(i)}return i}}))}catch(t){return}}(t);if(e)try{var i=JSON.parse(e);if(!O(i))return;var r=i,s=r[Ee],n=r[Se];if(!F(s)||0===s.trim().length)return;if(!F(n)&&!L(n))return;return{step:r,json:e}}catch(t){return}}(t);if(e){var i=function(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var e=encodeURIComponent(t),i=0,r=0;e.length>r;r++)"%"===e[r]?(i+=1,r+=2):i+=1;return i}(e.json);i>this.Bt.max_bytes||(this.Kt.push({step:e.step,bytes:i}),this.Qt+=i,this.er())}}getAttachable(){return this.Kt.map((t=>t.step))}clear(){this.Kt=[],this.Qt=0}size(){return this.Kt.length}er(){for(;this.Qt>this.Bt.max_bytes&&this.Kt.length>0;){var t=this.Kt.shift();t&&(this.Qt-=t.bytes)}}}function Pe(t,e){if(!L(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var Oe=function(e,i){var{debugEnabled:r}=void 0===i?{}:i,s={C(i){if(t&&(v.DEBUG||h.POSTHOG_DEBUG||r)&&!C(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[i]?t.console[i].__rrweb_original__:t.console[i]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(e,...o)}},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.C("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.C("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.C("error",...e)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,i)=>Oe(e+" "+t,i)};return s},Ie=Oe("[PostHog.js]"),Ce=Ie.createLogger,Fe=Ce("[ExternalScriptsLoader]"),Ae=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return Fe.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=null==r?void 0:r.querySelectorAll("script");if(s)for(var n,o=function(){if(s[a].src===e){var t=s[a];return t.__posthog_loading_callback_fired?{v:i()}:(t.addEventListener("load",(e=>{t.__posthog_loading_callback_fired=!0,i(void 0,e)})),t.onerror=t=>i(t),{v:void 0})}},a=0;s.length>a;a++)if(n=o())return n.v;var l=()=>{if(!r)return i("document not found");var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>i(t),t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?l():null==r||r.addEventListener("DOMContentLoaded",l)};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r;if(t.config.__preview_external_dependency_versioned_paths)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var s="/static/"+e+".js?v="+t.version;if("toolbar"===e){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}r=t.requestRouter.endpointFor("assets",s)}Ae(t,r,i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Ae(t,o,i)}},h.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);Ae(t,r,i)};var Me="$people_distinct_id",De="$device_id",Le="__alias",Ue="__timers",Ne="$autocapture_disabled_server_side",je="$heatmaps_enabled_server_side",ze="$exception_capture_enabled_server_side",Be="$error_tracking_suppression_rules",He="$error_tracking_capture_extension_exceptions",qe="$web_vitals_enabled_server_side",Ve="$dead_clicks_enabled_server_side",We="$product_tours_enabled_server_side",Ge="$web_vitals_allowed_metrics",Ye="$session_recording_remote_config",Je="$replay_override_sampling",Ke="$replay_override_linked_flag",Xe="$replay_override_url_trigger",Qe="$replay_override_event_trigger",Ze="$sesid",ti="$session_is_sampled",ei="$enabled_feature_flags",ii="$active_feature_flags",ri="$early_access_features",si="$feature_flag_details",ni="$feature_flag_payloads",oi="$feature_flag_request_id",ai="$override_feature_flags",li="$override_feature_flag_payloads",ui="$stored_person_properties",hi="$stored_group_properties",di="$surveys",vi="$surveys_activated",ci="ph_product_tours",pi="$flag_call_reported",fi="$flag_call_reported_session_id",_i="$feature_flag_errors",gi="$feature_flag_evaluated_at",mi="$user_state",bi="$client_session_props",yi="$capture_rate_limit",wi="$initial_campaign_params",xi="$initial_referrer_info",Ei="$initial_person_info",Si="$epp",$i="__POSTHOG_TOOLBAR__",Ti="$posthog_cookieless",ki="$sdk_debug_extensions_init_method",Ri="$sdk_debug_extensions_init_time_ms",Pi="$sdk_debug_recording_script_not_loaded",Oi="PostHog loadExternalDependency extension not found.",Ii="on_reject",Ci="always",Fi="anonymous",Ai="identified",Mi="identified_only",Di="visibilitychange",Li="beforeunload",Ui="$pageview",Ni="$pageleave",ji="$identify",zi="$groupidentify";function Bi(t,e){R(t)&&t.forEach(e)}function Hi(t,e){if(!D(t))if(R(t))t.forEach(e);else if(j(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)T.call(t,i)&&e(t[i],i)}var qi=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function Vi(t){for(var e=Object.keys(t),i=e.length,r=new Array(i);i--;)r[i]=[e[i],t[e[i]]];return r}var Wi=function(t){try{return t()}catch(t){return}},Gi=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){Ie.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ie.critical(t)}}},Yi=function(t){var e={};return Hi(t,(function(t,i){(F(t)&&t.length>0||L(t))&&(e[i]=t)})),e};var Ji=["herokuapp.com","vercel.app","netlify.app"];function Ki(t){var e=null==t?void 0:t.hostname;if(!F(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of Ji)if(i===r)return!1;return!0}function Xi(t,e,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(e,i,{capture:s,passive:n})}function Qi(t){return"ph_toolbar_internal"===t.name}Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return L(t)&&isFinite(t)&&Math.floor(t)===t});class Zi{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|e>>>8,s[7]=e,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new Zi(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Zi(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class tr{constructor(){this.I=0,this.S=0,this.k=new rr}generate(){var t=this.generateOrAbort();if(C(t)){this.I=0;var e=this.generateOrAbort();if(C(e))throw new Error("Could not generate UUID after timestamp reset");return e}return t}generateOrAbort(){var t=Date.now();if(t>this.I)this.I=t,this.A();else{if(this.I>=t+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return Zi.fromFieldsV7(this.I,Math.trunc(this.S/Math.pow(2,30)),this.S&Math.pow(2,30)-1,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}}var er,ir=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!C(t.crypto)&&crypto.getRandomValues&&(ir=t=>crypto.getRandomValues(t));class rr{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(ir(this.T),this.N=0),this.T[this.N++]}}var sr=()=>nr().toString(),nr=()=>(er||(er=new tr)).generate(),or="",ar=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var lr={R:()=>!!r,B(t){Ie.error("cookieStore error: "+t)},O(t){if(r){try{for(var e=t+"=",i=r.cookie.split(";").filter((t=>t.length)),s=0;i.length>s;s++){for(var n=i[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}},Z(t){var e;try{e=JSON.parse(lr.O(t))||{}}catch(t){}return e},M(t,e,i,s,n){if(r)try{var o="",a="",l=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=r),or)return or;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),s=Math.min(i.length,8),n="dmn_chk_"+sr();!or&&s--;){var o=i.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";e.cookie=a+";max-age=3",e.cookie.includes(n)&&(e.cookie=a+";max-age=0",or=o)}return or}(t);if(!i){var s=(t=>{var e=t.match(ar);return e?e[0]:""})(t);s!==i&&Ie.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(r.location.hostname,s);if(i){var u=new Date;u.setTime(u.getTime()+864e5*i),o="; expires="+u.toUTCString()}n&&(a="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+l+a;return h.length>3686.4&&Ie.warn("cookieStore warning: large cookie, len="+h.length),r.cookie=h,h}catch(t){return}},F(t,e){if(null!=r&&r.cookie)try{lr.M(t,"",-1,e)}catch(t){return}}},ur=null,hr={R(){if(!M(ur))return ur;var e=!0;if(C(t))e=!1;else try{var i="__mplssupport__";hr.M(i,"xyz"),'"xyz"'!==hr.O(i)&&(e=!1),hr.F(i)}catch(t){e=!1}return e||Ie.error("localStorage unsupported; falling back to cookie store"),ur=e,e},B(t){Ie.error("localStorage error: "+t)},O(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){hr.B(t)}return null},Z(t){try{return JSON.parse(hr.O(t))||{}}catch(t){}return null},M(e,i){try{null==t||t.localStorage.setItem(e,JSON.stringify(i))}catch(t){hr.B(t)}},F(e){try{null==t||t.localStorage.removeItem(e)}catch(t){hr.B(t)}}},dr=[De,"distinct_id",Ze,ti,Si,Ei,mi],vr={},cr={R:()=>!0,B(t){Ie.error("memoryStorage error: "+t)},O:t=>vr[t]||null,Z:t=>vr[t]||null,M(t,e){vr[t]=e},F(t){delete vr[t]}},pr=null,fr={R(){if(!M(pr))return pr;if(pr=!0,C(t))pr=!1;else try{var e="__support__";fr.M(e,"xyz"),'"xyz"'!==fr.O(e)&&(pr=!1),fr.F(e)}catch(t){pr=!1}return pr},B(t){Ie.error("sessionStorage error: ",t)},O(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){fr.B(t)}return null},Z(t){try{return JSON.parse(fr.O(t))||null}catch(t){}return null},M(e,i){try{null==t||t.sessionStorage.setItem(e,JSON.stringify(i))}catch(t){fr.B(t)}},F(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){fr.B(t)}}};class _r{constructor(t){this._instance=t}get Bt(){return this._instance.config}get consent(){return this.rr()?0:this.ir}isOptedOut(){return this.Bt.cookieless_mode===Ci||this.isRejected()||-1===this.consent&&this.Bt.cookieless_mode===Ii}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Bt.opt_out_capturing_by_default}optInOut(t){this.nr.M(this.sr,t?1:0,this.Bt.cookie_expiration,this.Bt.cross_subdomain_cookie,this.Bt.secure_cookie)}reset(){this.nr.F(this.sr,this.Bt.cross_subdomain_cookie)}get sr(){var{token:t,opt_out_capturing_cookie_prefix:e,consent_persistence_name:i}=this._instance.config;return i||(e?e+t:"__ph_opt_in_out_"+t)}get ir(){var t=this.nr.O(this.sr);return W(t)?1:w(G,t)?0:-1}get nr(){var t=this.Bt.opt_out_capturing_persistence_type,e="localStorage"===t?hr:lr;if(!this.ar||this.ar!==e){this.ar=e;var i="localStorage"===t?lr:hr;i.O(this.sr)&&(this.ar.O(this.sr)||this.optInOut(W(i.O(this.sr))),i.F(this.sr,this.Bt.cross_subdomain_cookie))}return this.ar}rr(){return!!this.Bt.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,h.doNotTrack].some((t=>W(t)))}}var gr=Ce("[Dead Clicks]"),mr=()=>!0,br=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(Ve)),r=t.instance.config.capture_dead_clicks;return N(r)?r:!!O(r)||i};class yr{get lazyLoadedDeadClicksAutocapture(){return this.lr}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Ve]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.ur((()=>{this.hr()})):this.stop()}ur(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.initDeadClicksAutocapture&&t(),null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?gr.error("failed to load script",e):t()}))}hr(){var t;if(r){if(!this.lr&&null!=(t=h.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=O(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};e.__onCapture=this.onCapture,this.lr=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.lr.start(r),gr.info("starting...")}}else gr.error("`document` not found. Cannot start.")}stop(){this.lr&&(this.lr.stop(),this.lr=void 0,gr.info("stopping..."))}}var wr=Ce("[SegmentIntegration]");var xr="posthog-js";function Er(t,e){var{organization:i,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===e?{}:e;return e=>{var a,l,u,h,d;if("*"!==n&&!n.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,p=(null==(a=e.exception)?void 0:a.values)||[],_=p.map((t=>f({},t,{stacktrace:t.stacktrace?f({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>f({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(l=p[0])?void 0:l.value)||e.message,$exception_type:null==(u=p[0])?void 0:u.type,$exception_level:e.level,$exception_list:_,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(h=p[0])?void 0:h.value)||e.message,$sentry_exception_type:null==(d=p[0])?void 0:d.type,$sentry_tags:e.tags};return i&&r&&(g.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+e.event_id),o&&(null==(c=t.exceptions)||c.sendExceptionEvent(g)),e}}class Sr{constructor(t,e,i,r,s,n){this.name=xr,this.setupOnce=function(o){o(Er(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class $r{constructor(t){this.cr=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(Ie.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.dr=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.vr()}vr(){var t;this.pr=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.cr)}destroy(){var t;null==(t=this.pr)||t.call(this),this.pr=void 0}doPageView(e,i){var r,s=this.gr(e,i);return this.dr={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.gr(t,null==(e=this.dr)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.dr)?void 0:t.pageViewId}}gr(t,e){var i=this.dr;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:h}=s;if(!(C(n)||C(o)||C(a)||C(l)||C(u)||C(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var d=n>1?Y(o/n,0,1,Ie):1,v=n>1?Y(a/n,0,1,Ie):1,c=l>1?Y(u/l,0,1,Ie):1,p=l>1?Y(h/l,0,1,Ie):1;r=qi(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var Tr={[Me]:{exposure:"hidden"},[Le]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[Ue]:{exposure:"hidden"},[Ne]:{exposure:"event"},[je]:{exposure:"hidden"},[ze]:{exposure:"event"},[Be]:{exposure:"hidden"},[He]:{exposure:"event"},[qe]:{exposure:"event"},[Ve]:{exposure:"event"},[We]:{exposure:"hidden"},[Ge]:{exposure:"event"},[Ye]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Ze]:{exposure:"hidden"},[ti]:{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"},[ei]:{exposure:"derived",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!O(t))return{};for(var e={},i=Object.keys(t),r=0;i.length>r;r++)e["$feature/"+i[r]]=t[i[r]];return e}},[ii]:{exposure:"event"},[ri]:{exposure:"hidden"},[si]:{exposure:"hidden"},[ni]:{exposure:"event"},[oi]:{exposure:"event"},[ai]:{exposure:"event"},[li]:{exposure:"hidden"},[ui]:{exposure:"hidden"},[hi]:{exposure:"hidden"},[di]:{exposure:"hidden"},[vi]:{exposure:"event"},[ci]:{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"},[pi]:{exposure:"hidden"},[fi]:{exposure:"hidden"},[_i]:{exposure:"hidden"},[gi]:{exposure:"hidden"},[mi]:{exposure:"hidden"},[bi]:{exposure:"hidden"},[yi]:{exposure:"hidden"},[wi]:{exposure:"hidden"},[xi]:{exposure:"hidden"},[Ei]:{exposure:"hidden"},[Si]:{exposure:"hidden"},[Je]:{exposure:"event"},[Ke]:{exposure:"event"},[Xe]:{exposure:"event"},[Qe]:{exposure:"event"},[ki]:{exposure:"event"},[Ri]:{exposure:"event"},[Pi]:{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"}},kr=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Rr=t=>{var e=null==r?void 0:r.createElement("a");return C(e)?null:(e.href=t,e)},Pr=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!R(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){Ie.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Or=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],h=0;l.length>h;h++){var d=l[h].split("=");R(d)&&(e.includes(d[0])?u.push(d[0]+"="+i):u.push(l[h]))}var v=a;return null!=o&&(v+="?"+u.join("&")),null!=s&&(v+="#"+s),v},Ir=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},Cr="https?://(.*)",Fr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ar=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Fr],Mr="<masked>",Dr=["li_fat_id"];function Lr(t,e,i){if(!r)return{};var s,n=e?[...Fr,...i||[]]:[],o=Ur(Or(r.URL,n,Mr),t),a=(s={},Hi(Dr,(function(t){var e=lr.O(t);s[t]=e||null})),s);return qi(a,o)}function Ur(t,e){var i=Ar.concat(e||[]),r={};return Hi(i,(function(e){var i=Pr(t,e);r[e]=i||null})),r}function Nr(t){var e=function(t){return t?0===t.search(Cr+"google.([^/?]*)")?"google":0===t.search(Cr+"bing.com")?"bing":0===t.search(Cr+"yahoo.com")?"yahoo":0===t.search(Cr+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!M(e)){s.$search_engine=e;var n=r?Pr(r.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function jr(){return navigator.language||navigator.userLanguage}var zr="$direct";function Br(){return(null==r?void 0:r.referrer)||zr}function Hr(t,e){var i=t?[...Fr,...e||[]]:[],r=null==s?void 0:s.href.substring(0,1e3);return{r:Br().substring(0,1e3),u:r?Or(r,i,Mr):void 0}}function qr(t){var e,{r:i,u:r}=t,s={$referrer:i,$referring_domain:null==i?void 0:i==zr?zr:null==(e=Rr(i))?void 0:e.host};if(r){s.$current_url=r;var n=Rr(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=Ur(r);qi(s,o)}if(i){var a=Nr(i);qi(s,a)}return s}function Vr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function Wr(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var Gr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Yr{constructor(t,e){this.Bt=t,this.props={},this.mr=!1,this.yr=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(t),this.nr=this.br(t),this.load(),t.debug&&Ie.info("Persistence loaded",t.persistence,f({},this.props)),this.update_config(t,t,e),this.save()}isDisabled(){return!!this._r}br(e){-1===Gr.indexOf(e.persistence.toLowerCase())&&(Ie.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var i=function(e){void 0===e&&(e=[]);var i=[...dr,...e];return f({},hr,{Z(t){try{var e={};try{e=lr.Z(t)||{}}catch(t){}var i=qi(e,JSON.parse(hr.O(t)||"{}"));return hr.M(t,i),i}catch(t){}return null},M(t,e,r,s,n,o){try{hr.M(t,e,void 0,void 0,o);var a={};i.forEach((t=>{e[t]&&(a[t]=e[t])})),Object.keys(a).length&&lr.M(t,a,r,s,n,o)}catch(t){hr.B(t)}},F(e,i){try{null==t||t.localStorage.removeItem(e),lr.F(e,i)}catch(t){hr.B(t)}}})}(e.cookie_persisted_properties||[]),r=e.persistence.toLowerCase();return"localstorage"===r&&hr.R()?hr:"localstorage+cookie"===r&&i.R()?i:"sessionstorage"===r&&fr.R()?fr:"memory"===r?cr:"cookie"===r?lr:i.R()?i:lr}wr(t){var e=null!=t?t:this.Bt.feature_flag_cache_ttl_ms;if(!e||0>=e)return!1;var i=this.props[gi];return!i||"number"!=typeof i||Date.now()-i>e}properties(){var t={};return Hi(this.props,((e,i)=>{var r=(t=>{var e=Tr[t];if(e)return e;for(var[i,r]of kr)if(0===t.indexOf(i))return r})(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,i===ei?()=>this.wr():()=>!1))return;r.transformToEventProperties&&qi(t,r.transformToEventProperties(e))}else r&&"event"!==r.exposure||(t[i]=e)})),t}load(){if(!this._r){var t=this.nr.Z(this.yr);t&&(this.props=qi({},t))}}save(){this._r||this.nr.M(this.yr,this.props,this.Ir,this.Cr,this.Sr,this.Bt.debug)}remove(){this.nr.F(this.yr,!1),this.nr.F(this.yr,!0)}clear(){this.remove(),this.props={}}register_once(t,e,i){if(O(t)){C(e)&&(e="None"),this.Ir=C(i)?this.kr:i;var r=!1;if(Hi(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Tr(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(O(t)){this.Ir=C(e)?this.kr:e;var i=!1;if(Hi(t,((e,r)=>{t.hasOwnProperty(r)&&this.props[r]!==e&&(this.Tr(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Ar(t),this.save())}update_campaign_params(){if(!this.mr){var t=Lr(this.Bt.custom_campaign_params,this.Bt.mask_personal_data_properties,this.Bt.custom_personal_data_properties);I(Yi(t))||this.register(t),this.mr=!0}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?Nr(t):{})}update_referrer_info(){var t;this.register_once({$referrer:Br(),$referring_domain:null!=r&&r.referrer&&(null==(t=Rr(r.referrer))?void 0:t.host)||zr},void 0)}set_initial_person_info(){this.props[wi]||this.props[xi]||this.register_once({[Ei]:Hr(this.Bt.mask_personal_data_properties,this.Bt.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};Hi([xi,wi],(e=>{var i=this.props[e];i&&Hi(i,(function(e,i){t["$initial_"+E(i)]=e}))}));var e,i,r=this.props[Ei];if(r){var s=(e=qr(r),i={},Hi(e,(function(t,e){i["$initial_"+E(e)]=t})),i);qi(t,s)}return t}safe_merge(t){return Hi(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){if(this.kr=this.Ir=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==e.persistence||!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[])){var r=this.br(t),s=this.props;this.clear(),this.nr=r,this.props=s,this.save()}}set_disabled(t){this._r=t,this._r?this.remove():this.save()}set_cross_subdomain(t){t!==this.Cr&&(this.Cr=t,this.remove(),this.save())}set_secure(t){t!==this.Sr&&(this.Sr=t,this.remove(),this.save())}set_event_timer(t,e){var i=this.props[Ue]||{};i[t]=e,this.Tr(Ue,i),this.save()}remove_event_timer(t){var e=this.props[Ue]||{},i=e[t];return C(i)||(delete e[t],this.Tr(Ue,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Tr(t,e),this.save()}Tr(t,e){this.props[t]=e}Ar(t){delete this.props[t]}}var Jr={Activation:"events",Cancellation:"cancelEvents"},Kr={Button:"button",Tab:"tab",Selector:"selector"},Xr={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},Qr={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},Zr={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},ts={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},es={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},is={Once:"once",Recurring:"recurring",Always:"always"},rs={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},ss={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},ns={Popover:"popover",Inline:"inline"},os={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},as={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},ls={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},us=Ce("[RateLimiter]");class hs{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach((t=>{us.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void us.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(yi))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;return l||t||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(yi,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var ds=Ce("[RemoteConfig]");class vs{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=h._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Er(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Rr(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(e){t(e.json)}})}load(){try{if(this.remoteConfig)return ds.info("Using preloaded remote config",this.remoteConfig),this.Nr(this.remoteConfig),void this.Mr();if(this._instance.Fr())return void ds.warn("Remote config is disabled. Falling back to local config.");this.Er((t=>{if(!t)return ds.info("No config found after loading remote JS config. Falling back to JSON."),void this.Rr((t=>{this.Nr(t),this.Mr()}));this.Nr(t),this.Mr()}))}catch(t){ds.error("Error loading remote config",t)}}stop(){this.Or&&(clearInterval(this.Or),this.Or=void 0)}refresh(){this._instance.Fr()||"hidden"===(null==r?void 0:r.visibilityState)||this._instance.reloadFeatureFlags()}Mr(){var t;if(!this.Or){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.Or=setInterval((()=>{this.refresh()}),e))}}Nr(t){var e;t||ds.error("Failed to fetch remote config from PostHog."),this._instance.Nr(null!=t?t:{}),!1!==(null==t?void 0:t.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded())}}var cs=["fatal","error","warning","log","info","debug"],ps={GZipJS:"gzip-js",Base64:"base64"},fs=Uint8Array,_s=Uint16Array,gs=Uint32Array,ms=new fs([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]),bs=new fs([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]),ys=new fs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ws=function(t,e){for(var i=new _s(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new gs(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},xs=ws(ms,2),Es=xs[1];xs[0][28]=258,Es[258]=28;for(var Ss=ws(bs,0)[1],$s=new _s(32768),Ts=0;32768>Ts;++Ts){var ks=(43690&Ts)>>>1|(21845&Ts)<<1;$s[Ts]=((65280&(ks=(61680&(ks=(52428&ks)>>>2|(13107&ks)<<2))>>>4|(3855&ks)<<4))>>>8|(255&ks)<<8)>>>1}var Rs=function(t,e,i){for(var r=t.length,s=0,n=new _s(e);r>s;++s)++n[t[s]-1];var o,a=new _s(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new _s(1<<e);var l=15-e;for(s=0;r>s;++s)if(t[s])for(var u=s<<4|t[s],h=e-t[s],d=a[t[s]-1]++<<h,v=d|(1<<h)-1;v>=d;++d)o[$s[d]>>>l]=u}else for(o=new _s(r),s=0;r>s;++s)o[s]=$s[a[t[s]-1]++]>>>15-t[s];return o},Ps=new fs(288);for(Ts=0;144>Ts;++Ts)Ps[Ts]=8;for(Ts=144;256>Ts;++Ts)Ps[Ts]=9;for(Ts=256;280>Ts;++Ts)Ps[Ts]=7;for(Ts=280;288>Ts;++Ts)Ps[Ts]=8;var Os=new fs(32);for(Ts=0;32>Ts;++Ts)Os[Ts]=5;var Is=Rs(Ps,9,0),Cs=Rs(Os,5,0),Fs=function(t){return(t/8>>0)+(7&t&&1)},As=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof _s?_s:t instanceof gs?gs:fs)(i-e);return r.set(t.subarray(e,i)),r},Ms=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},Ds=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},Ls=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new fs(0),0];if(1==s){var o=new fs(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,h=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=s-1;)a=i[i[d].f>i[u].f?u++:d++],l=i[u!=h&&i[d].f>i[u].f?u++:d++],i[h++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new _s(v+1),p=Us(i[h-1],c,0);if(p>e){r=0;var f=0,_=p-e,g=1<<_;for(n.sort((function(t,e){return c[e.s]-c[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=c[m])break;f+=g-(1<<p-c[m]),c[m]=e}for(f>>>=_;f>0;){var b=n[r].s;e>c[b]?f-=1<<e-c[b]++-1:++r}for(;r>=0&&f;--r){var y=n[r].s;c[y]==e&&(--c[y],++f)}p=e}return[new fs(c),p]},Us=function(t,e,i){return-1==t.s?Math.max(Us(t.l,e,i+1),Us(t.r,e,i+1)):e[t.s]=i},Ns=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new _s(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[i.subarray(0,r),e]},js=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},zs=function(t,e,i){var r=i.length,s=Fs(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},Bs=function(t,e,i,r,s,n,o,a,l,u,h){Ms(e,h++,i),++s[256];for(var d=Ls(s,15),v=d[0],c=d[1],p=Ls(n,15),f=p[0],_=p[1],g=Ns(v),m=g[0],b=g[1],y=Ns(f),w=y[0],x=y[1],E=new _s(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;w.length>S;++S)E[31&w[S]]++;for(var T=Ls(E,7),k=T[0],R=T[1],P=19;P>4&&!k[ys[P-1]];--P);var O,I,C,F,A=u+5<<3,M=js(s,Ps)+js(n,Os)+o,D=js(s,v)+js(n,f)+o+14+3*P+js(E,k)+(2*E[16]+3*E[17]+7*E[18]);if(M>=A&&D>=A)return zs(e,h,t.subarray(l,l+u));if(Ms(e,h,1+(M>D)),h+=2,M>D){O=Rs(v,c,0),I=v,C=Rs(f,_,0),F=f;var L=Rs(k,R,0);for(Ms(e,h,b-257),Ms(e,h+5,x-1),Ms(e,h+10,P-4),h+=14,S=0;P>S;++S)Ms(e,h+3*S,k[ys[S]]);h+=3*P;for(var U=[m,w],N=0;2>N;++N){var j=U[N];for(S=0;j.length>S;++S)Ms(e,h,L[z=31&j[S]]),h+=k[z],z>15&&(Ms(e,h,j[S]>>>5&127),h+=j[S]>>>12)}}else O=Is,I=Ps,C=Cs,F=Os;for(S=0;a>S;++S)if(r[S]>255){var z;Ds(e,h,O[257+(z=r[S]>>>18&31)]),h+=I[z+257],z>7&&(Ms(e,h,r[S]>>>23&31),h+=ms[z]);var B=31&r[S];Ds(e,h,C[B]),h+=F[B],B>3&&(Ds(e,h,r[S]>>>5&8191),h+=bs[B])}else Ds(e,h,O[r[S]]),h+=I[r[S]];return Ds(e,h,O[256]),h+I[256]},Hs=new gs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qs=function(){for(var t=new gs(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),Vs=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Ws(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=qs[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,l,u=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,function(t,e,i,r,s,n){var o=t.length,a=new fs(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var d=h+65535;o>d?u=zs(l,u,t.subarray(h,d)):(l[h]=!0,u=zs(l,u,t.subarray(h,o)))}else{for(var v=Hs[e-1],c=v>>>13,p=8191&v,f=(1<<i)-1,_=new _s(32768),g=new _s(f+1),m=Math.ceil(i/3),b=2*m,y=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<b)&f},w=new gs(25e3),x=new _s(288),E=new _s(32),S=0,T=0,k=(h=0,0),R=0,P=0;o>h;++h){var O=y(h),I=32767&h,C=g[O];if(_[I]=C,g[O]=I,h>=R){var F=o-h;if((S>7e3||k>24576)&&F>423){u=Bs(t,l,0,w,x,E,T,k,P,h-P,u),k=S=T=0,P=h;for(var A=0;286>A;++A)x[A]=0;for(A=0;30>A;++A)E[A]=0}var M=2,D=0,L=p,U=I-C&32767;if(F>2&&O==y(h-U))for(var N=Math.min(c,F)-1,j=Math.min(32767,h),z=Math.min(258,F);j>=U&&--L&&I!=C;){if(t[h+M]==t[h+M-U]){for(var B=0;z>B&&t[h+B]==t[h+B-U];++B);if(B>M){if(M=B,D=U,B>N)break;var H=Math.min(U,B-2),q=0;for(A=0;H>A;++A){var V=h-U+A+32768&32767,W=V-_[V]+32768&32767;W>q&&(q=W,C=V)}}}U+=(I=C)-(C=_[I])+32768&32767}if(D){w[k++]=268435456|Es[M]<<18|Ss[D];var G=31&Es[M],Y=31&Ss[D];T+=ms[G]+bs[Y],++x[257+G],++E[Y],R=h+M,++S}else w[k++]=t[h],++x[t[h]]}}u=Bs(t,l,!0,w,x,E,T,k,P,h-P,u)}return As(a,0,r+Fs(u)+s)}(n=t,null==(o=e).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),h=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&Vs(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(u,e),Vs(u,h-8,i.d()),Vs(u,h-4,r),u}var Gs=!!o||!!n,Ys="text/plain",Js=!1,Ks=function(t,e,i){var r;void 0===i&&(i=!0);var[s,n]=t.split("?"),o=f({},e),a=null!==(r=null==n?void 0:n.split("&").map((t=>{var e,[r,s]=t.split("="),n=i&&null!==(e=o[r])&&void 0!==e?e:s;return delete o[r],r+"="+n})))&&void 0!==r?r:[],l=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return Hi(t,(function(t,e){C(t)||C(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(o);return l&&a.push(l),s+"?"+a.join("&")},Xs=(t,e)=>JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e),Qs=t=>{if(t.tr)return t.tr;var{data:e,compression:i}=t;if(e){if(i===ps.GZipJS){var r=Ws(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new fs(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new fs(s+8+(i-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return As(r,0,s)}(Xs(e)),{mtime:0});return{contentType:Ys,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===ps.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(Xs(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:Xs(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=Xs(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Zs=function(){var t=p((function*(t){var e=Xs(t.data),i=yield function(t,e,i){return g.apply(this,arguments)}(e,v.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return f({},t,{tr:{contentType:Ys,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),tn=(t,e)=>Ks(t,{_:(new Date).getTime().toString(),ver:v.JS_SDK_VERSION,compression:e}),en=[];n&&en.push({transport:"fetch",method(t){var e,i,{contentType:r,body:s,estimatedSize:o}=null!==(e=Qs(t))&&void 0!==e?e:{},l=new Headers;Hi(t.headers,(function(t,e){l.append(e,t)})),r&&l.append("Content-Type",r);var u=t.url,h=null;if(a){var d=new a;h={signal:d.signal,timeout:setTimeout((()=>d.abort()),t.timeout)}}n(u,f({method:(null==t?void 0:t.method)||"GET",headers:l,keepalive:"POST"===t.method&&52428.8>(o||0),body:s,signal:null==(i=h)?void 0:i.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){Ie.error(t)}null==t.callback||t.callback(r)})))).catch((e=>{Ie.error(e),null==t.callback||t.callback({statusCode:0,error:e})})).finally((()=>h?clearTimeout(h.timeout):null))}}),o&&en.push({transport:"XHR",method(t){var e,i=new o;i.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(e=Qs(t))&&void 0!==e?e:{};Hi(t.headers,(function(t,e){i.setRequestHeader(e,t)})),r&&i.setRequestHeader("Content-Type",r),t.timeout&&(i.timeout=t.timeout),t.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(s)}}),null!=i&&i.sendBeacon&&en.push({transport:"sendBeacon",method(t){var e=Ks(t.url,{beacon:"1"});try{var r,{contentType:s,body:n}=null!==(r=Qs(t))&&void 0!==r?r:{};if(!n)return;var o=n instanceof Blob?n:new Blob([n],{type:s});i.sendBeacon(e,o)}catch(t){}}});var rn=3e3;class sn{constructor(t,e){this.Pr=!0,this.Lr=[],this.Dr=Y((null==e?void 0:e.flush_interval_ms)||rn,250,5e3,Ie.createLogger("flush interval"),rn),this.Br=t}enqueue(t){this.Lr.push(t),this.jr||this.$r()}unload(){this.qr();var t=this.Lr.length>0?this.Zr():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Br(f({},t,{transport:"sendBeacon"}))}))}enable(){this.Pr=!1,this.$r()}$r(){var t=this;this.Pr||(this.jr=setTimeout((()=>{if(this.qr(),this.Lr.length>0){var e=this.Zr(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&R(i.data)&&Hi(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Br(i)};for(var r in e)i()}}),this.Dr))}qr(){clearTimeout(this.jr),this.jr=void 0}Zr(){var t={};return Hi(this.Lr,(e=>{var i,r=e,s=(r?r.batchKey:null)||r.url;C(t[s])&&(t[s]=f({},r,{data:[]})),null==(i=t[s].data)||i.push(r.data)})),this.Lr=[],t}}var nn=["retriesPerformedSoFar"];class on{constructor(e){this.Vr=!1,this.Hr=3e3,this.Lr=[],this._instance=e,this.Lr=[],this.zr=!0,!C(t)&&"onLine"in t.navigator&&(this.zr=t.navigator.onLine,this.Ur=()=>{this.zr=!0,this.Yr()},this.Gr=()=>{this.zr=!1},Xi(t,"online",this.Ur),Xi(t,"offline",this.Gr))}get length(){return this.Lr.length}retriableRequest(t){var{retriesPerformedSoFar:e}=t,i=_(t,nn);U(e)&&(i.url=Ks(i.url,{retry_count:e})),this._instance._send_request(f({},i,{callback:t=>{200===t.statusCode||t.statusCode>=400&&500>t.statusCode||(null!=e?e:0)>=10?null==i.callback||i.callback(t):this.Wr(f({retriesPerformedSoFar:e},i))}}))}Wr(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this.Lr.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),Ie.warn(s),this.Vr||(this.Vr=!0,this.Xr())}Xr(){if(this.Jr&&clearTimeout(this.Jr),0===this.Lr.length)return this.Vr=!1,void(this.Jr=void 0);this.Jr=setTimeout((()=>{this.zr&&this.Lr.length>0&&this.Yr(),this.Xr()}),this.Hr)}Yr(){var t=Date.now(),e=[],i=this.Lr.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.Lr=e,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Jr&&(clearTimeout(this.Jr),this.Jr=void 0),this.Vr=!1,C(t)||(this.Ur&&(t.removeEventListener("online",this.Ur),this.Ur=void 0),this.Gr&&(t.removeEventListener("offline",this.Gr),this.Gr=void 0)),this.Lr))try{this._instance._send_request(f({},e,{transport:"sendBeacon"}))}catch(t){Ie.error(t)}this.Lr=[]}}class an{constructor(t){this.Kr=()=>{var t,e,i,r;this.Qr||(this.Qr={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.Qr.lastScrollY=Math.ceil(n),this.Qr.maxScrollY=Math.max(n,null!==(t=this.Qr.maxScrollY)&&void 0!==t?t:0),this.Qr.maxScrollHeight=Math.max(o,null!==(e=this.Qr.maxScrollHeight)&&void 0!==e?e:0),this.Qr.lastContentY=a,this.Qr.maxContentY=Math.max(a,null!==(i=this.Qr.maxContentY)&&void 0!==i?i:0),this.Qr.maxContentHeight=Math.max(l,null!==(r=this.Qr.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get ei(){return this._instance.config.scroll_root_selector}getContext(){return this.Qr}resetContext(){var t=this.Qr;return setTimeout(this.Kr,0),t}startMeasuringScrollPosition(){Xi(t,"scroll",this.Kr,{capture:!0}),Xi(t,"scrollend",this.Kr,{capture:!0}),Xi(t,"resize",this.Kr)}scrollElement(){if(!this.ei)return null==t?void 0:t.document.documentElement;var e=R(this.ei)?this.ei:[this.ei];for(var i of e){var r=null==t?void 0:t.document.querySelector(i);if(r)return r}}scrollY(){if(this.ei){var e=this.scrollElement();return e&&e.scrollTop||0}return t&&(t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop)||0}scrollX(){if(this.ei){var e=this.scrollElement();return e&&e.scrollLeft||0}return t&&(t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft)||0}}var ln=t=>Hr(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class un{constructor(t,e,i,r){this.ti=t=>{var e=this.ri();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.ii(this._instance)};this.ni.register({[bi]:i})}},this._instance=t,this.si=e,this.ni=i,this.ii=r||ln,this.si.onSessionId(this.ti)}ri(){return this.ni.props[bi]}getSetOnceProps(){var t,e=null==(t=this.ri())?void 0:t.props;return e?"r"in e?qr(e):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return Hi(Yi(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+E(i)]=e})),t}}class hn{constructor(){this.oi={}}on(t,e){return this.oi[t]||(this.oi[t]=[]),this.oi[t].push(e),()=>{this.oi[t]=this.oi[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.oi[t]||[])i(e);for(var r of this.oi["*"]||[])r(t,e)}}var dn=Ce("[SessionId]");class vn{on(t,e){return this.ai.on(t,e)}constructor(t,e,i){var r;if(this.li=[],this.ui=void 0,this.ai=new hn,this.hi=(t,e)=>!(!U(t)||!U(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===Ci)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Bt=t.config,this.ni=t.persistence,this.ci=void 0,this.di=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.vi=e||sr,this.fi=i||sr;var s=this.Bt.persistence_name||this.Bt.token;if(this._sessionTimeoutMs=1e3*Y(this.Bt.session_idle_timeout_seconds||1800,60,36e3,dn.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.pi(),this.gi="ph_"+s+"_window_id",this.mi="ph_"+s+"_primary_window_exists",this.yi()){var n=fr.Z(this.gi),o=fr.Z(this.mi);n&&!o?this.ci=n:fr.F(this.gi),fr.M(this.mi,!0)}if(null!=(r=this.Bt.bootstrap)&&r.sessionID)try{var a=(t=>{var e=this.Bt.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.bi(this.Bt.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){dn.error("Invalid sessionID in bootstrap",t)}this.wi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return C(this.li)&&(this.li=[]),this.li.push(t),this.di&&t(this.di,this.ci),()=>{this.li=this.li.filter((e=>e!==t))}}yi(){return"memory"!==this.Bt.persistence&&!this.ni._r&&fr.R()}Ii(t){t!==this.ci&&(this.ci=t,this.yi()&&fr.M(this.gi,t))}Ci(){return this.ci?this.ci:this.yi()?fr.Z(this.gi):null}bi(t,e,i){t===this.di&&e===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.di=t,this.ni.register({[Ze]:[e,t,i]}))}Si(){var t=this.ni.props[Ze];return R(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.bi(null,null,null)}destroy(){clearTimeout(this.xi),this.xi=void 0,this.ui&&t&&(t.removeEventListener(Li,this.ui,{capture:!1}),this.ui=void 0),this.li=[]}wi(){this.ui=()=>{this.yi()&&fr.F(this.mi)},Xi(t,Li,this.ui,{capture:!1})}checkAndGetSessionAndWindowId(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=null),this.Bt.cookieless_mode===Ci)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=e||(new Date).getTime(),[r,s,n]=this.Si(),o=this.Ci(),a=U(n)&&Math.abs(i-n)>864e5,l=!1,u=!s,h=!u&&!t&&this.hi(i,r);u||h||a?(s=this.vi(),o=this.fi(),dn.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this.fi(),l=!0);var d=U(r)&&t&&!a?r:i,v=U(n)?n:(new Date).getTime();return this.Ii(o),this.bi(s,d,v),t||this.pi(),l&&this.li.forEach((t=>t(s,o,l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:v,changeReason:l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}pi(){clearTimeout(this.xi),this.xi=setTimeout((()=>{var[t]=this.Si();if(this.hi((new Date).getTime(),t)){var e=this.di;this.resetSessionId(),this.ai.emit("forcedIdleReset",{idleSessionId:e})}}),1.1*this.sessionTimeoutMs)}}var cn=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&b(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>b(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver},pn=function(t,e){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}};function fn(t,e,i){return Xs({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var _n={exact:(t,e)=>e.some((e=>t.some((t=>e===t)))),is_not:(t,e)=>e.every((e=>t.every((t=>e!==t)))),regex:(t,e)=>e.some((e=>t.some((t=>pn(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!pn(e,t))))),icontains:(t,e)=>e.map(gn).some((e=>t.map(gn).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(gn).every((e=>t.map(gn).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i<parseFloat(t)))}))},gn=t=>t.toLowerCase();function mn(t,e){return!t||Object.entries(t).every((t=>{var[i,r]=t,s=null==e?void 0:e[i];if(C(s)||M(s))return!1;var n=[String(s)],o=_n[r.operator];return!!o&&o(r.values,n)}))}var bn="custom",yn="i.posthog.com",wn=/^\/static\//;class xn{constructor(t){this.ki={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+yn,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.ki[this.apiHost]||(this.ki[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":bn),this.ki[this.apiHost]}Ti(t){var e=this.instance.config.__preview_external_dependency_versioned_paths;if("string"==typeof e&&wn.test(t))return e.trim().replace(/\/$/,"")||void 0}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.uiHost+e;if("flags"===t)return this.flagsApiHost+e;if("assets"===t){var i=this.Ti(e);if(i)return""+i+e}if(this.region===bn)return this.apiHost+e;var r=yn+e;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var En=Ce("[Surveys]"),Sn="seenSurvey_",$n=[Zr.Popover,Zr.Widget,Zr.API],Tn={ignoreConditions:!1,ignoreDelay:!1,displayType:ns.Popover},kn=Ce("[PostHog ExternalIntegrations]"),Rn={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Pn{constructor(t){this._instance=t}ur(t,e){var i;null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return kn.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(e){var i,s,n;!r||null!=(i=h.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]||t.ur(Rn[e],(()=>{var i;null==(i=h.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[e])||i.start(t._instance)})),!r&&null!=(s=h.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[e]&&(null==(n=h.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[e])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;e(i)}}}var On,In={},Cn=0,Fn=()=>{},An='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Mn="Surveys module not available",Dn="sanitize_properties is deprecated. Use before_send instead",Ln="Invalid value for property_denylist config: ",Un="posthog",Nn=!Gs&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla")),jn=e=>{var i;return f({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Ki(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Fn,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,debug:s&&F(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!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:"https:"===(null==t||null==(i=t.location)?void 0:i.protocol),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){Ie.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:Mi,before_send:void 0,request_queue_config:{flush_interval_ms:rn},error_tracking:{},_onCapture:Fn,__preview_eager_load_replay:!1},(t=>({rageclick:!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}))(e))},zn=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],Bn=t=>{var e={};for(var[i,r]of zn)C(t[i])||(e[r]=t[i]);var s=qi({},e,t);return R(t.property_blacklist)&&(C(t.property_denylist)?s.property_denylist=t.property_blacklist:R(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:Ie.error(Ln+t.property_denylist)),s};class Hn{constructor(){this.__forceAllowLocalhost=!1}get Ai(){return this.__forceAllowLocalhost}set Ai(t){Ie.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class qn{Ei(t,e){if(t){var i=this.Ri.indexOf(t);-1!==i&&this.Ri.splice(i,1)}return this.Ri.push(e),null==e.initialize||e.initialize(),e}Ni(){return this.config.cookieless_mode===Ci||this.config.cookieless_mode===Ii&&this.consent.isRejected()}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new Hn,this.Mi=!1,this.version=v.LIB_VERSION,this.Fi=new hn,this.Ri=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=jn(),this.SentryIntegration=Sr,this.sentryIntegration=t=>function(t,e){var i=Er(t,e);return{name:xr,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Oi=!1,this.Pi=null,this.Li=null,this.Di=null,this.scrollManager=new an(this),this.pageViewManager=new $r(this),this.rateLimiter=new hs(this),this.requestRouter=new xn(this),this.consent=new _r(this),this.externalIntegrations=new Pn(this);var e=null!==(t=qn.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=F(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=F(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>Ie.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==Un){var r,s=null!==(r=In[i])&&void 0!==r?r:new qn;return s._init(t,e,i),In[i]=s,In[Un][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n;if(void 0===i&&(i={}),C(e)||A(e))return Ie.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={},i.debug=this.Bi(i.debug),this.ji=i,this.$i=[],i.person_profiles?this.Li=i.person_profiles:i.process_person&&(this.Li=i.process_person),this.set_config(qi({},jn(i.defaults),Bn(i),{name:r,token:e})),this.config.on_xhr_error&&Ie.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:ps.GZipJS;var o=this.qi();this.persistence=new Yr(this.config,o),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Yr(f({},this.config,{persistence:"sessionStorage"}),o);var a=f({},this.persistence.props),l=f({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Zi=new sn((t=>this.Vi(t)),this.config.request_queue_config),this.Hi=new on(this),this.__request_queue=[];var u=this.Ni();if(u||(this.sessionManager=new vn(this),this.sessionPropsManager=new un(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Ie.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.zi(u)}),0)):(Ie.info("Initializing extensions synchronously"),this.zi(u)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&Ie.info("Starting in debug mode",{this:this,config:i,thisC:f({},this.config),p:a,s:l}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=f({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=i.bootstrap)?void 0:n.distinctID)){var h=i.bootstrap.distinctID,d=this.get_distinct_id(),c=this.persistence.get_property(mi);if(i.bootstrap.isIdentifiedID&&null!=d&&d!==h&&c===Fi)this.identify(h);else if(i.bootstrap.isIdentifiedID&&null!=d&&d!==h&&c===Ai)Ie.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var p=this.config.get_device_id(sr()),_=i.bootstrap.isIdentifiedID?p:h;this.persistence.set_property(mi,i.bootstrap.isIdentifiedID?Ai:Fi),this.register({distinct_id:h,$device_id:_})}}if(u)this.register_once({distinct_id:Ti,$device_id:null},"");else if(!this.get_distinct_id()){var g=this.config.get_device_id(sr());this.register_once({distinct_id:g,$device_id:g},""),this.persistence.set_property(mi,Fi)}return Xi(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||sr();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(mi,Ai)),e()},s=i.user();"then"in s&&P(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{Promise&&Promise.resolve||wr.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,i)=>{if(!i)return e;e.event.userId||e.event.anonymousId===t.get_distinct_id()||(wr.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(wr.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var r=t.calculateEventProperties(i,e.event.properties);return e.event.properties=Object.assign({},r,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>e(t,t.event.event),page:t=>e(t,Ui),identify:t=>e(t,ji),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.Ui())):this.Ui(),P(this.config._onCapture)&&this.config._onCapture!==Fn&&(Ie.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Ie.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}zi(t){var e,i,r,s,n,o,a,l=performance.now(),u=f({},qn.__defaultExtensionClasses,this.config.__extensionClasses),h=[];u.featureFlags&&this.Ri.push(this.featureFlags=null!==(e=this.featureFlags)&&void 0!==e?e:new u.featureFlags(this)),u.exceptions&&this.Ri.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new u.exceptions(this)),u.historyAutocapture&&this.Ri.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.Ri.push(new u.tracingHeaders(this)),u.siteApps&&this.Ri.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.Ri.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.Ri.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.Ri.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this)),u.logs&&this.Ri.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new u.logs(this)),u.conversations&&this.Ri.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new u.conversations(this)),u.productTours&&this.Ri.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.Ri.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.Ri.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.Ri.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.Ri.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,br)),u.toolbar&&this.Ri.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new u.toolbar(this)),u.experiments&&this.Ri.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new u.experiments(this)),this.Ri.forEach((t=>{t.initialize&&h.push((()=>{null==t.initialize||t.initialize()}))})),h.push((()=>{if(this.Yi){var t=this.Yi;this.Yi=void 0,this.Nr(t)}})),this.Gi(h,l)}Gi(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.Gi(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){Ie.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[ki]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Ri]:r}),this.config.__preview_deferred_init_extensions&&Ie.info("PostHog extensions initialized ("+r+"ms)")}Nr(t){var e;if(!r||!r.body)return Ie.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Nr(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Yi=t),this.Wi=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=w(t.supportedCompression,ps.GZipJS)?ps.GZipJS:w(t.supportedCompression,ps.Base64)?ps.Base64:void 0),null!=(e=t.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Li?this.Li:Mi}),this.Ri.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}Ui(){try{this.config.loaded(this)}catch(t){Ie.critical("`loaded` function failed",t)}if(this.Xi(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ni())&&this.Ji()}),1),this.Ki=new vs(this),this.Ki.load()}Xi(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Zi)||t.enable())}_dom_loaded(){this.is_capturing()&&Bi(this.__request_queue,(t=>this.Vi(t))),this.__request_queue=[],this.Xi()}_handle_unload(){var t,e,i,r;null==(t=this.surveys)||t.handlePageUnload(),this.config.request_batching?(this.Qi()&&this.capture(Ni),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(i=this.Zi)||i.unload(),null==(r=this.Hi)||r.unload()):this.Qi()&&this.capture(Ni,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(Nn?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=Ks(t.url,{ip:this.config.ip?1:0}),t.headers=f({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,i,r,s=f({},t);s.timeout=s.timeout||6e4,s.url=tn(s.url,s.compression);var n=null!==(e=s.transport)&&void 0!==e?e:"fetch",o=en.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),a=null!==(i=null==(r=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===n)return t[i]}(o))?void 0:r.method)&&void 0!==i?i:o[0].method;if(!a)throw new Error("No available transport method");"sendBeacon"!==n&&s.data&&s.compression===ps.GZipJS&&l&&!Js?Zs(s).then((t=>{a(t)})).catch((e=>{if((t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""))(e))return Js=!0,void a(f({},s,{compression:void 0,url:tn(t.url,void 0)}));a(s)})):a(s)})(f({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))))}Vi(t){this.Hi?this.Hi.retriableRequest(t):this._send_request(t)}_execute_array(t){Cn++;try{var e,i=[],r=[],s=[];Bi(t,(t=>{t&&(R(e=t[0])?s.push(t):P(t)?t.call(this):R(t)&&"alias"===e?i.push(t):R(t)&&-1!==e.indexOf("capture")&&P(this[e])?s.push(t):r.push(t))}));var n=function(t,e){Bi(t,(function(t){if(R(t[0])){var i=e;Hi(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}))};n(i,this),n(r,this),n(s,this)}finally{Cn--}}push(t){if(Cn>0&&R(t)&&F(t[0])){var e=qn.prototype[t[0]];P(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,i){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Zi){if(this.is_capturing())if(!C(t)&&F(t)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=e&&e.$current_url&&!F(null==e?void 0:e.$current_url)&&(Ie.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=i&&i.en||Ie.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=(null==i?void 0:i.timestamp)||h,v=sr(),c={uuid:v,event:t,properties:this.calculateEventProperties(t,e||{},d,v)};t===Ui&&this.config.__preview_capture_bot_pageviews&&l&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),u&&(c.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==i?void 0:i.$set)&&(c.$set=null==i?void 0:i.$set);var p,_,g,m=this.tn(null==i?void 0:i.$set_once,t!==zi,t===ji);if(m&&(c.$set_once=m),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,n=c,o=t=>F(t)?t.slice(0,s):t,a=new Set,c=function t(e,i){return e!==Object(e)?o?o(e):e:a.has(e)?void 0:(a.add(e),R(e)?(r=[],Bi(e,(e=>{r.push(t(e))}))):(r={},Hi(e,((e,i)=>{a.has(e)||(r[i]=t(e,i))}))),r);var r}(n)),c.timestamp=d,C(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=h),t===rs.DISMISSED||t===rs.SENT){var b=null==e?void 0:e[ss.SURVEY_ID],y=null==e?void 0:e[ss.SURVEY_ITERATION];(t=>{try{var e=(t=>((t,e)=>{var i=""+Sn+e.id;return e.current_iteration&&e.current_iteration>0&&(i=""+Sn+e.id+"_"+e.current_iteration),i})(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){En.error("Failed to persist survey seen state",t)}})({id:b,current_iteration:y}),c.$set=f({},c.$set,{[(p={id:b,current_iteration:y},_=t===rs.SENT?"responded":"dismissed",g="$survey_"+_+"/"+p.id,p.current_iteration&&p.current_iteration>0&&(g="$survey_"+_+"/"+p.id+"/"+p.current_iteration),g)]:!0})}else t===rs.SHOWN&&(c.$set=f({},c.$set,{[ss.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===as.SHOWN){var w=null==e?void 0:e[ls.TOUR_TYPE];w&&(c.$set=f({},c.$set,{[ls.TOUR_LAST_SEEN_DATE+"/"+w]:(new Date).toISOString()}))}var x=f({},c.properties.$set,c.$set);if(I(x)||this.setPersonPropertiesForFlags(x),!D(this.config.before_send)){var E=this.rn(c);if(!E)return;c=E}this.Fi.emit("eventCaptured",c);var S={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:null==i?void 0:i._batchKey};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.Vi(S):this.Zi.enqueue(S),c}Ie.critical("This capture call is ignored due to client rate limiting.")}}else Ie.error("No event name provided to posthog.capture")}else Ie.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;var l=a?void 0:this.persistence.remove_event_timer(e),h=f({},i);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.Ni()&&(h.$cookieless_mode=!0),"$snapshot"===e){var d=f({},this.persistence.properties(),this.sessionPersistence.properties());return h.distinct_id=d.distinct_id,(!F(h.distinct_id)&&!L(h.distinct_id)||A(h.distinct_id))&&Ie.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}var c,p=function(e,i){var r,n,o,a;if(!u)return{};var l,h,d,c,p,f,_,g,m=e?[...Fr,...i||[]]:[],[b,y]=function(t){for(var e=0;Wt.length>e;e++){var[i,r]=Wt[e],s=i.exec(t),n=s&&(P(r)?r(s,t):r);if(n)return n}return["",""]}(u);return qi(Yi({$os:b,$os_version:y,$browser:Ht(u,navigator.vendor),$device:Gt(u),$device_type:(h=u,d={userAgentDataPlatform:null==(r=navigator)||null==(r=r.userAgentData)?void 0:r.platform,maxTouchPoints:null==(n=navigator)?void 0:n.maxTouchPoints,screenWidth:null==t||null==(o=t.screen)?void 0:o.width,screenHeight:null==t||null==(a=t.screen)?void 0:a.height,devicePixelRatio:null==t?void 0:t.devicePixelRatio},g=Gt(h),g===st||g===rt||"Kobo"===g||"Kindle Fire"===g||g===At?it:g===Et||g===$t||g===St||g===It?"Console":g===ot?"Wearable":g?Z:"Android"===(null==d?void 0:d.userAgentDataPlatform)&&(null!==(c=null==d?void 0:d.maxTouchPoints)&&void 0!==c?c:0)>0?600>Math.min(null!==(p=null==d?void 0:d.screenWidth)&&void 0!==p?p:0,null!==(f=null==d?void 0:d.screenHeight)&&void 0!==f?f:0)/(null!==(_=null==d?void 0:d.devicePixelRatio)&&void 0!==_?_:1)?Z:it:"Desktop"),$timezone:Vr(),$timezone_offset:Wr()}),{$current_url:Or(null==s?void 0:s.href,m,Mr),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:Vt(u,navigator.vendor),$browser_language:jr(),$browser_language_prefix:(l=jr(),"string"==typeof l?l.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:_,windowId:g}=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime());h.$session_id=_,h.$window_id=g}this.sessionPropsManager&&qi(h,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&qi(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null==(m=this.Hi)?void 0:m.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===bn&&(h.$lib_custom_api_host=this.config.api_host),c=e!==Ui||a?e!==Ni||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),h=qi(h,c),e===Ui&&r&&(h.title=r.title),!C(l)){var b=n.getTime()-l;h.$duration=parseFloat((b/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser"),(h=qi({},p,this.persistence.properties(),this.sessionPersistence.properties(),h)).$is_identified=this._isIdentified(),R(this.config.property_denylist)?Hi(this.config.property_denylist,(function(t){delete h[t]})):Ie.error(Ln+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var y=this.config.sanitize_properties;y&&(Ie.error(Dn),h=y(h,e));var w=this.nn();return h.$process_person_profile=w,w&&!a&&this.sn("_calculate_event_properties"),h}tn(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.nn())return t;if(this.Mi&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=qi({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Ie.error(Dn),o=a(o,"$set_once")),e&&(this.Mi=!0),I(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e;null==(e=this.sessionPersistence)||e.register(t)}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t)}an(t,e){this.register({[t]:e})}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}isFeatureEnabled(t,e){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(t,e)}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.Fi.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Mn}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:Mn})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:Mn})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=Tn),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:Mn}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:Mn})}ln(t){return!t||A(t)?(Ie.critical("Unique user id has not been set in posthog.identify"),!1):t===Ti?(Ie.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(Ie.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return Ie.uninitializedWarning("posthog.identify");if(L(t)&&(t=t.toString(),Ie.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.ln(t)&&this.sn("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:t}),this.get_property(De)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),t!==r&&t!==this.get_property(Le)&&(this.unregister(Le),this.register({distinct_id:t}));var s,n=(this.persistence.get_property(mi)||Fi)===Fi;t!==r&&n?(this.persistence.set_property(mi,Ai),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.capture(ji,{distinct_id:t,$anon_distinct_id:r},{$set:e||{},$set_once:i||{}}),this.Di=fn(t,e,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(e||i)&&this.setPersonProperties(e,i),t!==r&&(this.reloadFeatureFlags(),this.unregister(pi))}}setPersonProperties(t,e){if((t||e)&&this.sn("posthog.setPersonProperties")){var i=fn(this.get_distinct_id(),t,e);this.Di!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Di=i):Ie.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,e,i){if(t&&e){var r=this.getGroups(),s=r[t]!==e;if(s&&this.resetGroupPropertiesForFlags(t),this.register({$groups:f({},r,{[t]:e})}),s||i){var n={$group_type:t,$group_key:e};i&&(n.$group_set=i),this.capture(zi,n)}i&&this.setGroupPropertiesForFlags({[t]:i}),s&&!i&&this.reloadFeatureFlags()}else Ie.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(){var t;null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.sn("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e,i,r,s,n,o,a,l;if(Ie.info("reset"),!this.__loaded)return Ie.uninitializedWarning("posthog.reset");var u=this.get_property(De);if(this.consent.reset(),null==(e=this.persistence)||e.clear(),null==(i=this.sessionPersistence)||i.clear(),null==(r=this.surveys)||r.reset(),null==(s=this.Ki)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.persistence)||a.set_property(mi,Fi),null==(l=this.sessionManager)||l.resetSessionId(),this.Di=null,this.config.cookieless_mode===Ci)this.register_once({distinct_id:Ti,$device_id:null},"");else{var h=this.config.get_device_id(sr());this.register_once({distinct_id:h,$device_id:t?h:u},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(t,e){var i;this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i.un()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.hn()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:e,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property(Me)?(Ie.critical("Attempting to create alias for existing People user - aborting."),-2):this.sn("posthog.alias")?(C(e)&&(e=this.get_distinct_id()),t!==e?(this.an(Le,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Ie.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=f({},this.config);if(O(t)){var i,r,s,n,o,a,l,u,h,d;qi(this.config,Bn(t));var c=this.qi();null==(i=this.persistence)||i.update_config(this.config,e,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Yr(f({},this.config,{persistence:"sessionStorage"}),c);var p=this.Bi(this.config.debug);N(p)&&(this.config.debug=p),N(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,hr.R()&&hr.M("ph_debug",!0),Ie.info("set_config",{config:t,oldConfig:e,newConfig:f({},this.config)})):(v.DEBUG=!1,hr.R()&&hr.F("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(s=this.exceptions)||s.onConfigChange(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),null==(o=this.autocapture)||o.startIfEnabled(),null==(a=this.heatmaps)||a.startIfEnabled(),null==(l=this.exceptionObserver)||l.startIfEnabledOrStop(),null==(u=this.deadClicksAutocapture)||u.startIfEnabledOrStop(),null==(h=this.surveys)||h.loadIfEnabled(),this.cn(),null==(d=this.externalIntegrations)||d.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){v.LIB_NAME=t,v.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(f({},r,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:qn.dn}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:Un;return e!==Un&&(e=Un+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(mi))===Ai||(null==(e=this.sessionPersistence)?void 0:e.get_property(mi))===Ai}nn(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===Mi&&!this._isIdentified()&&I(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Le])&&(null==(e=this.persistence)||null==(e=e.props)||!e[Si]))}Qi(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.nn()||this.sn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.sn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}sn(t){return"never"===this.config.person_profiles?(Ie.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.an(Si,!0),!0)}qi(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==Ii)}cn(){var t,e,i,r,s=this.qi();return(null==(t=this.persistence)?void 0:t._r)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e._r)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==Ci){if(this.Ni()){var i,r,s,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new vn(this),this.pageViewManager=new $r(this),this.persistence&&(this.sessionPropsManager=new un(this,this.sessionManager,this.persistence));var a,l=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=qn.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.Ei(this.sessionRecording,new l(this)),this.Wi&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Wi)))}var u,h;this.consent.optInOut(!0),this.cn(),this.Xi(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==Ii&&(null==(u=this.surveys)||u.loadIfEnabled()),(C(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(h=null==t?void 0:t.captureEventName)&&void 0!==h?h:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Ji()}else Ie.warn(An)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==Ci?(this.config.cookieless_mode===Ii&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.cn(),this.config.cookieless_mode===Ii&&(this.register({distinct_id:Ti,$device_id:null}),null==(t=this.sessionManager)||t.destroy(),null==(e=this.pageViewManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(i=this.sessionRecording)||i.stopRecording(),this.sessionRecording=void 0,this.Ji())):Ie.warn(An)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var t=this.consent.consent;return 1===t?"granted":0===t?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===Ci||(this.config.cookieless_mode===Ii?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.cn()}_is_bot(){return i?cn(i,this.config.custom_blocked_useragents):void 0}Ji(){r&&("visible"===r.visibilityState?this.Oi||(this.Oi=!0,this.capture(Ui,{title:r.title},{send_instantly:!0}),this.Pi&&(r.removeEventListener(Di,this.Pi),this.Pi=null)):this.Pi||(this.Pi=this.Ji.bind(this),Xi(r,Di,this.Pi)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.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}))}Fr(){var t,e,i,r,s,n,o=this.ji||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Ie.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):(i="advanced_disable_decide",!1,r=Ie,s=(e="advanced_disable_flags")in(t=o)&&!D(t[e]),n=i in t&&!D(t[i]),s?t[e]:!!n&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i]))}rn(t){if(D(this.config.before_send))return t;var e=R(this.config.before_send)?this.config.before_send:[this.config.before_send],i=t;for(var r of e){if(i=r(i),D(i)){var s="Event '"+t.event+"' was rejected in beforeSend function";return z(t.event)?Ie.warn(s+". This can cause unexpected behavior."):Ie.info(s),null}i.properties&&!I(i.properties)||Ie.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var t;return null==(t=this.pageViewManager.dr)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Bi(t){var e=N(t)&&!t,i=hr.R()&&"true"===hr.O("ph_debug");return!e&&(!!i||t)}}qn.__defaultExtensionClasses={},qn.dn={trace:On=()=>{},debug:On,info:On,warn:On,error:On,fatal:On},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=Gi(t.prototype[e[i]])}(qn,["identify"]);var Vn=1,Wn=3,Gn=11;function Yn(t){return t instanceof Element&&(t.id===$i||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Jn(t){return!!t&&t.nodeType===Vn}function Kn(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Xn(t){return!!t&&t.nodeType===Wn}function Qn(t){return!!t&&t.nodeType===Gn&&Jn(t.host)}function Zn(t){return t?x(t).split(/\s+/):[]}function to(e){var i=null==t?void 0:t.location.href;return!!(i&&e&&e.some((t=>i.match(t))))}function eo(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return Zn(e)}function io(t){return D(t)?null:x(t).split(/(\s+)/).filter((t=>wo(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ro(t){var e="";return co(t)&&!po(t)&&t.childNodes&&t.childNodes.length&&Hi(t.childNodes,(function(t){var i;Xn(t)&&t.textContent&&(e+=null!==(i=io(t.textContent))&&void 0!==i?i:"")})),x(e)}function so(t){return C(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var no=["a","button","form","input","select","textarea","label"];function oo(t,e){if(C(e))return!0;var i,r=function(t){if(e.some((e=>t.matches(e))))return{v:!0}};for(var s of t)if(i=r(s))return i.v;return!1}function ao(t){var e=t.parentNode;return!(!e||!Jn(e))&&e}var lo=["next","previous","prev",">","<"],uo=[".ph-no-rageclick",".ph-no-capture"];var ho=t=>!t||Kn(t,"html")||!Jn(t),vo=(e,i)=>{if(!t||ho(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[e],n=e;n.parentNode&&!Kn(n,"body");)if(Qn(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=ao(n);if(!o)break;if(i||no.indexOf(o.tagName.toLowerCase())>-1)r=!0;else{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}s.push(o),n=o}return{parentIsUsefulElement:r,targetElementList:s}};function co(t){for(var e=t;e.parentNode&&!Kn(e,"body");e=e.parentNode){var i=eo(e);if(w(i,"ph-sensitive")||w(i,"ph-no-capture"))return!1}if(w(eo(t),"ph-include"))return!0;var r=t.type||"";if(F(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!F(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function po(t){return!!(Kn(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Kn(t,"select")||Kn(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var fo="(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})",_o=new RegExp("^(?:"+fo+")$"),go=new RegExp(fo),mo="\\d{3}-?\\d{2}-?\\d{4}",bo=new RegExp("^("+mo+")$"),yo=new RegExp("("+mo+")");function wo(t,e){if(void 0===e&&(e=!0),D(t))return!1;if(F(t)){if(t=x(t),(e?_o:go).test((t||"").replace(/[- ]/g,"")))return!1;if((e?bo:yo).test(t))return!1}return!0}function xo(t){var e=ro(t);return wo(e=(e+" "+Eo(t)).trim())?e:""}function Eo(t){var e="";return t&&t.childNodes&&t.childNodes.length&&Hi(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=ro(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Eo(t)).trim())}catch(t){Ie.error("[AutoCapture]",t)}})),e}function So(t){return t.replace(/"|\\"/g,'\\"')}function $o(t){var e=t.attr__class;return e?R(e)?e:Zn(e):void 0}class To{constructor(t){this.disabled=!1===t;var e=O(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(e-r.y)<this.thresholdPx&&this.timeoutMs>i-r.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}}var ko="$copy_autocapture",Ro=Ce("[AutoCapture]");function Po(t,e){return e.length>t?e.slice(0,t)+"...":e}function Oo(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!Jn(e));return e}function Io(e,i){var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=i;if(!Jn(e))return{props:{}};for(var h=[e],d=e;d.parentNode&&!Kn(d,"body");)if(Qn(d.parentNode))h.push(d.parentNode.host),d=d.parentNode.host;else{if(!Jn(d.parentNode))break;h.push(d.parentNode),d=d.parentNode}var v,c,p=[],_={},g=!1,m=!1;if(Hi(h,(t=>{var e=co(t);if(Kn(t,"a")){var i=t.getAttribute("href");g=e&&!!i&&wo(i)&&i}w(eo(t),"ph-no-capture")&&(m=!0),p.push(function(t,e,i,r){var s=t.tagName.toLowerCase(),n={tag_name:s};no.indexOf(s)>-1&&!i&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?Po(1024,xo(t)):Po(1024,ro(t)));var o=eo(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),Hi(t.attributes,(function(i){var s;if((!po(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&wo(i.value)&&(!F(s=i.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=i.value;"class"===i.name&&(o=Zn(o).join(" ")),n["attr__"+i.name]=Po(1024,o)}}));for(var a=1,l=1,u=t;u=Oo(u);)a++,u.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(t,o,a,l));var r=function(t){if(!co(t))return{};var e={};return Hi(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var i=t.name.replace("data-ph-capture-attribute-",""),r=t.value;i&&r&&wo(r)&&(e[i]=r)}})),e}(t);qi(_,r)})),m)return{props:{},explicitNoCapture:m};if(a||(p[0].$el_text=Kn(e,"a")||Kn(e,"button")?xo(e):ro(e)),g){var b,y;p[0].attr__href=g;var x=null==(b=Rr(g))?void 0:b.host,E=null==t||null==(y=t.location)?void 0:y.host;x&&E&&x!==E&&(v=g)}return{props:qi({$event_type:n.type,$ce_version:1},u?{}:{$elements:p},{$elements_chain:(c=p,function(t){return t.map((t=>{var e,i,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var s of(t.attr_class.sort(),t.attr_class))r+="."+s.replace(/"/g,"");var n=f({},t.text?{text:t.text}:{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(i=t.nth_of_type)&&void 0!==i?i:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return Vi(n).sort(((t,e)=>{var[i]=t,[r]=e;return i.localeCompare(r)})).forEach((t=>{var[e,i]=t;return o[So(e.toString())]=So(i.toString())})),(r+=":")+Vi(o).map((t=>{var[e,i]=t;return e+'="'+i+'"'})).join("")})).join(";")}(function(t){return t.map((t=>{var e,i,r={text:null==(e=t.$el_text)?void 0:e.slice(0,400),tag_name:t.tag_name,href:null==(i=t.attr__href)?void 0:i.slice(0,2048),attr_class:$o(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Vi(t).filter((t=>{var[e]=t;return 0===e.indexOf("attr__")})).forEach((t=>{var[e,i]=t;return r.attributes[e]=i})),r}))}(c)))},null!=(r=p[0])&&r.$el_text?{$el_text:null==(s=p[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},_)}}var Co=Ce("[ExceptionAutocapture]");function Fo(t,e,i){try{if(!(e in t))return()=>{};var r=t[e],s=i(r);return P(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=s,()=>{t[e]=r}}catch(t){return()=>{}}}var Ao=Ce("[TracingHeaders]"),Mo=Ce("[Web Vitals]"),Do=9e5,Lo="disabled",Uo="lazy_loading",No="awaiting_config",jo="missing_config";Ce("[SessionRecording]"),Ce("[SessionRecording]");var zo="[SessionRecording]",Bo=Ce(zo),Ho=Ce("[Heatmaps]");function qo(t){return O(t)&&"clientX"in t&&"clientY"in t&&L(t.clientX)&&L(t.clientY)}var Vo=Ce("[Product Tours]"),Wo=["$set_once","$set"],Go=Ce("[SiteApps]"),Yo="Error while initializing PostHog app with config id ";function Jo(t,e,i){if(D(t))return!1;switch(i){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch(t){return!1}default:return!1}}class Ko{constructor(t){this.vn=new hn,this.fn=(t,e)=>this.pn(t,e)&&this.gn(t,e)&&this.mn(t,e)&&this.yn(t,e),this.pn=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t,this.bn=new Set,this._n=new Set}init(){var t,e;C(null==(t=this._instance)?void 0:t._addCaptureHook)||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.on(t,e)})))}register(t){var e,i;if(!C(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e,i;null==(e=this._n)||e.add(t),null==(i=t.steps)||i.forEach((t=>{var e;null==(e=this.bn)||e.add((null==t?void 0:t.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var r,s=new Set;t.forEach((t=>{var e;null==(e=t.steps)||e.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,e){var i;null!=e&&0!=t.length&&(this.bn.has(t)||this.bn.has(null==e?void 0:e.event))&&this._n&&(null==(i=this._n)?void 0:i.size)>0&&this._n.forEach((t=>{this.wn(e,t)&&this.vn.emit("actionCaptured",t.name)}))}In(t){this.onAction("actionCaptured",(e=>t(e)))}wn(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.fn(t,i))return!0;return!1}onAction(t,e){return this.vn.on(t,e)}gn(t,e){if(null!=e&&e.url){var i,r=null==t||null==(i=t.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Jo(r,e.url,e.url_matching||"contains"))return!1}return!0}mn(t,e){return!!this.Cn(t,e)&&!!this.Sn(t,e)&&!!this.xn(t,e)}Cn(t,e){var i;if(null==e||!e.href)return!0;var r=this.kn(t);if(r.length>0)return r.some((t=>Jo(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Jo((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}Sn(t,e){var i;if(null==e||!e.text)return!0;var r=this.kn(t);if(r.length>0)return r.some((t=>Jo(t.text,e.text,e.text_matching||"exact")||Jo(t.$el_text,e.text,e.text_matching||"exact")));var s,n,o,a=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!a&&(s=function(t){for(var e,i=[],r=/(?::|")text="(.*?)"/g;!D(e=r.exec(t));)i.includes(e[1])||i.push(e[1]);return i}(a),n=e.text,o=e.text_matching||"exact",s.some((t=>Jo(t,n,o))))}xn(t,e){var i,r;if(null==e||!e.selector)return!0;var s=null==t||null==(i=t.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(e.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(e.selector_regex&&n)try{return new RegExp(e.selector_regex).test(n)}catch(t){return!1}return!1}kn(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}yn(t,e){return null==e||!e.properties||0===e.properties.length||mn(e.properties.reduce(((t,e)=>{var i=R(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class Xo{constructor(t){this._instance=t,this.Tn=new Map,this.An=new Map,this.En=new Map}Rn(t,e){return!!t&&mn(t.propertyFilters,null==e?void 0:e.properties)}Nn(t,e){var i=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[e])||null==(r=r.values)||r.forEach((e=>{if(null!=e&&e.name){var r=i.get(e.name)||[];r.push(t.id),i.set(e.name,r)}}))})),i}Mn(t,e,i){var r=(i===Jr.Activation?this.Tn:this.An).get(t),s=[];return this.Fn((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[i])||null==(s=s.values)?void 0:s.find((e=>e.name===t));return this.Rn(n,e)}))}register(t){var e;C(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.On(t),this.Pn(t))}Pn(t){var e=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.actions)&&(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0}));0!==e.length&&(null==this.Ln&&(this.Ln=new Ko(this._instance),this.Ln.init(),this.Ln.In((t=>{this.onAction(t)}))),e.forEach((t=>{var e,i,r,s,n;t.conditions&&null!=(e=t.conditions)&&e.actions&&null!=(i=t.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.Ln)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((e=>{if(e&&e.name){var i=this.En.get(e.name);i&&i.push(t.id),this.En.set(e.name,i||[t.id])}})))})))}On(t){var e,i=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.events)&&(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0})),r=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.cancelEvents)&&(null==(i=t.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0}));0===i.length&&0===r.length||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.onEvent(t,e)})),this.Tn=this.Nn(t,Jr.Activation),this.An=this.Nn(t,Jr.Cancellation))}onEvent(t,e){var i,r=this.le(),s=this.Dn(),n=this.Bn(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[s])||[];if(n===t&&e&&o.length>0){var a,l;r.info("event matched, removing item from activated items",{event:t,eventPayload:e,existingActivatedItems:o});var u=(null==e||null==(a=e.properties)?void 0:a.$survey_id)||(null==e||null==(l=e.properties)?void 0:l.$product_tour_id);if(u){var h=o.indexOf(u);0>h||(o.splice(h,1),this.jn(o))}}else{if(this.An.has(t)){var d=this.Mn(t,e,Jr.Cancellation);d.length>0&&(r.info("cancel event matched, cancelling items",{event:t,itemsToCancel:d.map((t=>t.id))}),d.forEach((t=>{var e=o.indexOf(t.id);0>e||o.splice(e,1),this.$n(t.id)})),this.jn(o))}if(this.Tn.has(t)){r.info("event name matched",{event:t,eventPayload:e,items:this.Tn.get(t)});var v=this.Mn(t,e,Jr.Activation);this.jn(o.concat(v.map((t=>t.id))||[]))}}}onAction(t){var e,i=this.Dn(),r=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[i])||[];this.En.has(t)&&this.jn(r.concat(this.En.get(t)||[]))}jn(t){var e=this.le(),i=[...new Set(t)].filter((t=>!this.qn(t)));e.info("updating activated items",{activatedItems:i}),this.Zn(i)}getActivatedIds(){var t,e=this.Dn();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}getEventToItemsMap(){return this.Tn}Vn(){return this.Ln}}class Qo extends Xo{constructor(t){super(t)}Dn(){return vi}Bn(){return rs.SHOWN}Fn(t){var e;null==(e=this._instance)||e.getSurveys(t)}$n(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}le(){return En}Zn(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[vi]:t})}qn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Zo="SDK is not enabled or survey functionality is not yet loaded",ta="Disabled. Not loading surveys.",ea=null!=t&&t.location?Ir(t.location.hash,"__posthog")||Ir(location.hash,"state"):null,ia="_postHogToolbarParams",ra=Ce("[Toolbar]"),sa=Ce("[FeatureFlags]"),na=Ce("[FeatureFlags]",{debugEnabled:!0}),oa="\" failed. Feature flags didn't load in time.",aa=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},la=t=>{var e={};for(var[i,r]of Vi(t||{}))r&&(e[i]=r);return e},ua=Ce("[Error tracking]"),ha="Refusing to render web experiment since the viewer is a likely bot",da={icontains:(e,i)=>!!t&&i.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,i)=>!!t&&-1===i.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,i)=>!!t&&pn(i.href,e),not_regex:(e,i)=>!!t&&!pn(i.href,e),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class va{get Bt(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{va.Hn("retrieved web experiments from the server"),e.zn=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.zn&&(va.Hn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.zn)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);F(r)&&t.variants[r]&&e.Un(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];va.Yn(n)&&e.Un(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())va.Hn(ha);else if(!this.Bt.disable_web_experiments){if(D(this.zn))return this.zn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();va.Hn("applying feature flags",t),t.forEach((t=>{var e;if(this.zn&&null!=(e=this.zn)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.zn)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.Un(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=va.getWindowLocation();if(null!=t&&t.search){var e=Pr(null==t?void 0:t.search,"__experiment_id"),i=Pr(null==t?void 0:t.search,"__experiment_variant");e&&i&&(va.Hn("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.Gn(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.Bt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Bt.disable_web_experiments&&!i)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Bt.token),method:"GET",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Gn(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(va.Hn("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.Un(r[0].name,e,r[0].variants[e].transforms))}static Yn(t){return!D(t.conditions)&&va.Wn(t)&&va.Xn(t)}static Wn(t){var e;if(D(t.conditions)||D(null==(e=t.conditions)?void 0:e.url))return!0;var i,r,s,n=va.getWindowLocation();return!!n&&(null==(i=t.conditions)||!i.url||da[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==t?void 0:t.location}static Xn(t){var e;if(D(t.conditions)||D(null==(e=t.conditions)?void 0:e.utm))return!0;var i=Lr();if(i.utm_source){var r,s,n,o,a,l,u,h,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==i.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,p=null==(u=t.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=t.conditions)||null==(h=h.utm)?void 0:h.utm_term)==i.utm_term;return d&&c&&p&&v}return!1}static Hn(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];Ie.info("[WebExperiments] "+t,i)}Un(t,e,i){this._is_bot()?va.Hn(ha):"control"!==e?i.forEach((i=>{if(i.selector){var r;va.Hn("applying transform of variant "+e+" for experiment "+t+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((t=>{var e=t;i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)}))}})):va.Hn("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?cn(i,this.Bt.custom_blocked_useragents):void 0}}var ca=Ce("[Conversations]"),pa="Conversations not available yet.",fa={featureFlags:class{constructor(t){this.Jn=!1,this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this.ss=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Bt(){return this._instance.config}get ni(){return this._instance.persistence}os(t){return this._instance.get_property(t)}ls(){var t,e;return null!==(t=null==(e=this.ni)?void 0:e.wr(this.Bt.feature_flag_cache_ttl_ms))&&void 0!==t&&t}us(){return!!this.ls()&&(this.ss||this.Qn||(this.ss=!0,sa.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}hs(){var t,e=null!==(t=this.Bt.evaluation_contexts)&&void 0!==t?t:this.Bt.evaluation_environments;return!this.Bt.evaluation_environments||this.Bt.evaluation_contexts||this.ns||(sa.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ns=!0),null!=e&&e.length?e.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||sa.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}cs(){return this.hs().length>0}initialize(){var t,e,{config:i}=this._instance,r=null!==(t=null==(e=i.bootstrap)?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,e)=>(t[e]=r[e]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,e)=>(o[e]&&(t[e]=o[e]),t)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,e,i){var r=null!=i&&i.merge?this.getFlagVariants():{},s=null!=i&&i.merge?this.getFlagPayloads():{},n=f({},r,t),o=f({},s,e),a={};for(var[l,u]of Object.entries(n)){var h="string"==typeof u;a[l]={key:l,enabled:!!h||Boolean(u),variant:h?u:void 0,reason:void 0,metadata:C(null==o?void 0:o[l])?void 0:{id:0,version:void 0,description:void 0,payload:o[l]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.Kn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.os(si),e=this.os(ai),i=this.os(li);if(!i&&!e)return t||{};var r=qi({},t||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(e||{})])];for(var n of s){var o,a,l=r[n],u=null==e?void 0:e[n],h=C(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,d=C(u)?l.variant:"string"==typeof u?u:void 0,v=null==i?void 0:i[n],c=f({},l,{enabled:h,variant:h?null!=d?d:null==l?void 0:l.variant:void 0});h!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v&&(c.metadata=f({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=c}return this.Jn||(sa.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:r}),this.Jn=!0),r}getFlagVariants(){var t=this.os(ei),e=this.os(ai);if(!e)return t||{};for(var i=qi({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Jn||(sa.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Jn=!0),i}getFlagPayloads(){var t=this.os(ni),e=this.os(li);if(!e)return t||{};for(var i=qi({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Jn||(sa.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Jn=!0),i}reloadFeatureFlags(){this.es||this.Bt.advanced_disable_feature_flags||this.ds||(this._instance.Fi.emit("featureFlagsReloading",!0),this.ds=setTimeout((()=>{this.vs()}),5))}fs(){clearTimeout(this.ds),this.ds=void 0}ensureFlagsLoaded(){this.Kn||this.Qn||this.ds||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.es=t}vs(t){var e;if(this.fs(),!this._instance.Fr())if(this.Qn)this.ts=!0;else{var i=this.Bt.token,r=this.os(De),s={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:f({},(null==(e=this.ni)?void 0:e.get_initial_props())||{},this.os(ui)||{}),group_properties:this.os(hi),timezone:Vr()};M(r)||C(r)||(s.$device_id=r),(null!=t&&t.disableFlags||this.Bt.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.cs()&&(s.evaluation_contexts=this.hs());var n=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Bt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Qn=!0,this._instance._send_request({method:"POST",url:n,data:s,compression:this.Bt.disable_compression?void 0:ps.Base64,timeout:this.Bt.feature_flag_request_timeout_ms,callback:t=>{var e,i,r,n=!0;if(200===t.statusCode&&(this.ts||(this.$anon_distinct_id=void 0),n=!1),this.Qn=!1,!s.disable_flags||this.ts){this.rs=!n;var o=[];t.error?t.error instanceof Error?o.push("AbortError"===t.error.name?"timeout":"connection_error"):o.push("unknown_error"):200!==t.statusCode&&o.push("api_error_"+t.statusCode),null!=(e=t.json)&&e.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var a,l=!(null==(i=t.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(l&&o.push("quota_limited"),null==(r=this.ni)||r.register({[_i]:o}),l)sa.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.");else s.disable_flags||this.receivedFeatureFlags(null!==(a=t.json)&&void 0!==a?a:{},n,{partialResponse:!!this.Bt.advanced_only_evaluate_survey_feature_flags}),this.ts&&(this.ts=!1,this.vs())}}})}}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.rs)if(this.Kn||this.getFlags()&&this.getFlags().length>0){if(!this.us()){var r=this.getFeatureFlagResult(t,e);return null!==(i=null==r?void 0:r.variant)&&void 0!==i?i:null==r?void 0:r.enabled}}else sa.warn('getFeatureFlag for key "'+t+oa)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e){if(void 0===e&&(e={}),!e.fresh||this.rs)if(this.Kn||this.getFlags()&&this.getFlags().length>0){if(!this.us()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],o=String(s),a=this.os(oi)||void 0,l=this.os(gi)||void 0,u=this.os(pi)||{};if(this.Bt.advanced_feature_flags_dedup_per_session){var h,d=this._instance.get_session_id(),v=this.os(fi);d&&d!==v&&(u={},null==(h=this.ni)||h.register({[pi]:u,[fi]:d}))}if((e.send_event||!("send_event"in e))&&(!(t in u)||!u[t].includes(o))){var c,p,f,_,g,m,b,y,w,x;R(u[t])?u[t].push(o):u[t]=[o],null==(c=this.ni)||c.register({[pi]:u});var E=this.getFeatureFlagDetails(t),S=[...null!==(p=this.os(_i))&&void 0!==p?p:[]];C(s)&&S.push("flag_missing");var T={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(f=this.Bt.bootstrap)||null==(f=f.featureFlags)?void 0:f[t])||null,$feature_flag_bootstrapped_payload:(null==(_=this.Bt.bootstrap)||null==(_=_.featureFlagPayloads)?void 0:_[t])||null,$used_bootstrap_value:!this.rs};C(null==E||null==(g=E.metadata)?void 0:g.version)||(T.$feature_flag_version=E.metadata.version);var k,P=null!==(m=null==E||null==(b=E.reason)?void 0:b.description)&&void 0!==m?m:null==E||null==(y=E.reason)?void 0:y.code;P&&(T.$feature_flag_reason=P),null!=E&&null!=(w=E.metadata)&&w.id&&(T.$feature_flag_id=E.metadata.id),C(null==E?void 0:E.original_variant)&&C(null==E?void 0:E.original_enabled)||(T.$feature_flag_original_response=C(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(x=E.metadata)&&x.original_payload&&(T.$feature_flag_original_payload=null==E||null==(k=E.metadata)?void 0:k.original_payload),S.length&&(T.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",T)}if(r){var O=n;if(!C(n))try{O=JSON.parse(n)}catch(t){}return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:O}}}}else sa.warn('getFeatureFlagResult for key "'+t+oa)}getRemoteConfigPayload(t,e){var i=this.Bt.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.cs()&&(r.evaluation_contexts=this.hs()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Bt.disable_compression?void 0:ps.Base64,timeout:this.Bt.feature_flag_request_timeout_ms,callback(i){var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;e((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,e){if(void 0===e&&(e={}),!e.fresh||this.rs){if(this.Kn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(t,e);return C(i)?void 0:!!i}sa.warn('isFeatureEnabled for key "'+t+oa)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,i){if(this.ni){this.Kn=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(t,e,i,r,s,n){void 0===i&&(i={}),void 0===r&&(r={}),void 0===s&&(s={});var o=(t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return null==(i=e[t].metadata)?void 0:i.payload})).map((t=>{var i;return[t,null==(i=e[t].metadata)?void 0:i.payload]})))):sa.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(l){var h=t.requestId,d=t.evaluatedAt;if(R(l)){sa.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(l)for(var c=0;l.length>c;c++)v[l[c]]=!0;e&&e.register({[ii]:l,[ei]:v})}else{var p=l,_=u,g=a;if(null!=n&&n.partialResponse)p=f({},i,p),_=f({},r,_),g=f({},s,g);else if(t.errorsWhileComputingFlags)if(a){var m=new Set(Object.keys(a).filter((t=>{var e;return!(null!=(e=a[t])&&e.failed)})));p=f({},i,Object.fromEntries(Object.entries(p).filter((t=>{var[e]=t;return m.has(e)})))),_=f({},r,Object.fromEntries(Object.entries(_||{}).filter((t=>{var[e]=t;return m.has(e)})))),g=f({},s,Object.fromEntries(Object.entries(g||{}).filter((t=>{var[e]=t;return m.has(e)}))))}else p=f({},i,p),_=f({},r,_),g=f({},s,g);e&&e.register(f({[ii]:Object.keys(la(p)),[ei]:p||{},[ni]:_||{},[si]:g||{}},h?{[oi]:h}:{},d?{[gi]:d}:{}))}}}(t,this.ni,r,s,n,i),e||(this.ss=!1),this.ps(e)}}override(t,e){void 0===e&&(e=!1),sa.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.ni)return sa.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.ni.unregister(ai),this.ni.unregister(li),this.ps(),na.info("All overrides cleared");if(R(t)){var e=aa(t);return this.ni.register({[ai]:e}),this.ps(),na.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,r=t;if(this.Jn=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.ni.unregister(ai),na.info("Flag overrides cleared");else if(r.flags){if(R(r.flags)){var s=aa(r.flags);this.ni.register({[ai]:s})}else this.ni.register({[ai]:r.flags});na.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.ni.unregister(li),na.info("Payload overrides cleared")):r.payloads&&(this.ni.register({[li]:r.payloads}),na.info("Payload overrides set",{payloads:r.payloads}))),void this.ps()}if(t&&"object"==typeof t)return this.ni.register({[ai]:t}),this.ps(),na.info("Flag overrides set",{flags:t});sa.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Kn){var{flags:e,flagVariants:i}=this.gs();t(e,i)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,i){var r,s=(this.os(ri)||[]).find((e=>e.flagKey===t)),n={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:n};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=f({},this.getFlagVariants(),{[t]:e});null==(r=this.ni)||r.register({[ii]:Object.keys(la(a)),[ei]:a}),this.ps()}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.os(ri),s=i?"&"+i.map((t=>"stage="+t)).join("&"):"";if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Bt.token+s),method:"GET",callback:e=>{var i,r;if(e.json){var s=e.json.earlyAccessFeatures;return null==(i=this.ni)||i.unregister(ri),null==(r=this.ni)||r.register({[ri]:s}),t(s)}}})}gs(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,i)=>(t[i]=e[i],t)),{})}}ps(t){var{flags:e,flagVariants:i}=this.gs();this.featureFlagEventHandlers.forEach((r=>r(e,i,{errorsLoading:t})))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var i=this.os(ui)||{},r=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),s=null==t?void 0:t.$set_once,n={};if(s)for(var o in s)({}).hasOwnProperty.call(s,o)&&(o in i||(n[o]=s[o]));this._instance.register({[ui]:f({},i,n,r)}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ui)}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var i=this.os(hi)||{};0!==Object.keys(i).length&&Object.keys(i).forEach((e=>{i[e]=f({},i[e],t[e]),delete t[e]})),this._instance.register({[hi]:f({},i,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.os(hi)||{};this._instance.register({[hi]:f({},e,{[t]:{}})})}else this._instance.unregister(hi)}reset(){this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.$anon_distinct_id=void 0,this.fs(),this.Jn=!1}}},_a={sessionRecording:class{get Bt(){return this._instance.config}get ni(){return this._instance.persistence}get started(){var t;return!(null==(t=this.ys)||!t.isStarted)}get status(){var t,e;return this.bs===No||this.bs===jo?this.bs:null!==(t=null==(e=this.ys)?void 0:e.status)&&void 0!==t?t:this.bs}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.bs=Lo,this._s=void 0,this._instance=t,!this._instance.sessionManager)throw Bo.error("started without valid sessionManager"),new Error(zo+" started without valid sessionManager. This is a bug.");if(this.Bt.cookieless_mode===Ci)throw new Error(zo+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get ws(){var e,i=!(null==(e=this._instance.get_property(Ye))||!e.enabled),r=!this.Bt.disable_session_recording,s=this.Bt.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&r&&!s}startIfEnabledOrStop(t){var e;if(!this.ws||null==(e=this.ys)||!e.isStarted){var i=!C(Object.assign)&&!C(Array.from);this.ws&&i?(this.Is(t),Bo.info("starting")):(this.bs=Lo,this.stopRecording())}}Is(t){var e,i,r;this.ws&&(this.bs!==No&&this.bs!==jo&&(this.bs=Uo),null!=h&&null!=(e=h.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=h.__PosthogExtensions__)&&i.initSessionRecording?this.Cs(t):null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Ss,(e=>{if(e)return Bo.error("could not load recorder",e);this.Cs(t)})))}stopRecording(){var t,e;null==(t=this._s)||t.call(this),this._s=void 0,null==(e=this.ys)||e.stop()}xs(){var t,e;null==(t=this._s)||t.call(this),this._s=void 0,null==(e=this.ys)||e.discard()}ks(){var t;null==(t=this.ni)||t.unregister(ti)}Ts(t,e){if(D(t))return null;var i,r=L(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(Bo.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}As(t){if(this.ni){var e,i,r=this.ni,s=()=>{var e,i=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.Ts(null==(e=this.Bt.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),n=this.Ts(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:n;D(o)&&this.ks();var a=null==i?void 0:i.minimumDurationMilliseconds;r.register({[Ye]:f({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:f({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:C(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};s(),null==(e=this._s)||e.call(this),this._s=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.As(t),void this.xs()):(this.As(t),void this.startIfEnabledOrStop()):(this.bs===No&&(this.bs=jo,Bo.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var i;void 0===e&&(e="log"),null!=(i=this.ys)&&i.log?this.ys.log(t,e):Bo.warn("log called before recorder was ready")}get Ss(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(Ye);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}Es(){var t,e=this._instance.get_property(Ye);if(!e)return!1;var i=null!==(t=("object"==typeof e?e:JSON.parse(e)).cache_timestamp)&&void 0!==t?t:Date.now();return 36e5>=Date.now()-i}Cs(t){var e,i;if(null==(e=h.__PosthogExtensions__)||!e.initSessionRecording)return Bo.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Pi]:!0});if(this.ys||(this.ys=null==(i=h.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.ys._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Es()){if(this.bs===jo||this.bs===No)return;return this.bs=No,Bo.info("persisted remote config is stale, requesting fresh config before starting"),void new vs(this._instance).load()}this.bs=Uo,this.ys.start(t)}onRRwebEmit(t){var e;null==(e=this.ys)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.ys||null==(e=this.ni)||e.register({[Ke]:!0}),null==(t=this.ys)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.ys||null==(e=this.ni)||e.register({[Je]:!0}),null==(t=this.ys)||t.overrideSampling()}overrideTrigger(t){var e,i;this.ys||null==(i=this.ni)||i.register({["url"===t?Xe:Qe]:!0}),null==(e=this.ys)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.ys)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.ys)||!i.tryAddCustomEvent(t,e))}}},ga={autocapture:class{constructor(t){this.Rs=!1,this.Ns=null,this.Ms=!1,this.instance=t,this.rageclicks=new To(t.config.rageclick),this.Fs=null}initialize(){this.startIfEnabled()}get Bt(){var t,e,i=O(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(t=i.url_allowlist)?void 0:t.map((t=>new RegExp(t))),i.url_ignorelist=null==(e=i.url_ignorelist)?void 0:e.map((t=>new RegExp(t))),i}Os(){if(this.isBrowserSupported()){if(t&&r){var e=e=>{e=e||(null==t?void 0:t.event);try{this.Ps(e)}catch(t){Ro.error("Failed to capture event",t)}};if(Xi(r,"submit",e,{capture:!0}),Xi(r,"change",e,{capture:!0}),Xi(r,"click",e,{capture:!0}),this.Bt.capture_copied_text){var i=e=>{e=e||(null==t?void 0:t.event);try{this.Ps(e,ko)}catch(t){Ro.error("Failed to capture copy/cut event",t)}};Xi(r,"copy",i,{capture:!0}),Xi(r,"cut",i,{capture:!0})}}}else Ro.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Rs&&(this.Os(),this.Rs=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Ms=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Ne]:!!t.autocapture_opt_out}),this.Ns=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Fs=t}getElementSelectors(t){var e,i=[];return null==(e=this.Fs)||e.forEach((e=>{var s=null==r?void 0:r.querySelectorAll(e);null==s||s.forEach((r=>{t===r&&i.push(e)}))})),i}get isEnabled(){var t,e,i=null==(t=this.instance.persistence)?void 0:t.props[Ne];if(M(this.Ns)&&!N(i)&&!this.instance.Fr())return!1;var r=null!==(e=this.Ns)&&void 0!==e?e:!!i;return!!this.instance.config.autocapture&&!r}Ps(e,i){if(void 0===i&&(i="$autocapture"),this.isEnabled){var r,s=so(e);Xn(s)&&(s=s.parentNode||null),"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&function(e,i){if(!t||ho(e))return!1;var r,s,n;if(N(i)?(r=!!i&&uo,s=void 0):(r=null!==(n=null==i?void 0:i.css_selector_ignorelist)&&void 0!==n?n:uo,s=null==i?void 0:i.content_ignorelist),!1===r)return!1;var{targetElementList:o}=vo(e,!1);return!function(t,e){if(!1===t||C(t))return!1;var i;if(!0===t)i=lo;else{if(!R(t))return!1;if(t.length>10)return Ie.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=t.map((t=>t.toLowerCase()))}return e.some((t=>{var{safeText:e,ariaLabel:r}=t;return i.some((t=>e.includes(t)||r.includes(t)))}))}(s,o.map((t=>{var e;return{safeText:ro(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!oo(o,r)}(s,this.instance.config.rageclick)&&this.Ps(e,"$rageclick");var n=i===ko;if(s&&function(e,i,r,s,n){var o,a,l,u;if(void 0===r&&(r=void 0),!t||ho(e))return!1;if(null!=(o=r)&&o.url_allowlist&&!to(r.url_allowlist))return!1;if(null!=(a=r)&&a.url_ignorelist&&to(r.url_ignorelist))return!1;if(null!=(l=r)&&l.dom_event_allowlist){var h=r.dom_event_allowlist;if(h&&!h.some((t=>i.type===t)))return!1}var{parentIsUsefulElement:d,targetElementList:v}=vo(e,s);if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(C(i))return!0;var r,s=function(t){if(i.some((e=>t.tagName.toLowerCase()===e)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(v,r))return!1;if(!oo(v,null==(u=r)?void 0:u.css_selector_allowlist))return!1;var c=t.getComputedStyle(e);if(c&&"pointer"===c.getPropertyValue("cursor")&&"click"===i.type)return!0;var p=e.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(n||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(i.type)>=0;default:return d?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(no.indexOf(p)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,this.Bt,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=Io(s,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Bt.element_attribute_ignorelist,elementsChainAsString:this.Ms});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),i===ko){var u,h=io(null==t||null==(u=t.getSelection())?void 0:u.toString()),d=e.type||"clipboard";if(!h)return!1;o.$selected_content=h,o.$copy_type=d}return this.instance.capture(i,o),!0}}}isBrowserSupported(){return P(null==r?void 0:r.querySelectorAll)}},historyAutocapture:class{constructor(e){var i;this._instance=e,this.Ls=(null==t||null==(i=t.location)?void 0:i.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Ie.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ds&&this.Ds(),this.Ds=void 0,Ie.info("History API monitoring stopped")}monitorHistoryChanges(){var e,i;if(t&&t.history){var r=this;null!=(e=t.history.pushState)&&e.__posthog_wrapped__||Fo(t.history,"pushState",(t=>function(e,i,s){t.call(this,e,i,s),r.Bs("pushState")})),null!=(i=t.history.replaceState)&&i.__posthog_wrapped__||Fo(t.history,"replaceState",(t=>function(e,i,s){t.call(this,e,i,s),r.Bs("replaceState")})),this.js()}}Bs(e){try{var i,r=null==t||null==(i=t.location)?void 0:i.pathname;if(!r)return;r!==this.Ls&&this.isEnabled&&this._instance.capture(Ui,{navigation_type:e}),this.Ls=r}catch(t){Ie.error("Error capturing "+e+" pageview",t)}}js(){if(!this.Ds){var e=()=>{this.Bs("popstate")};Xi(t,"popstate",e),this.Ds=()=>{t&&t.removeEventListener("popstate",e)}}}},heatmaps:class{get Bt(){return this.instance.config}constructor(t){var e;this.$s=!1,this.Rs=!1,this.qs=null,this.instance=t,this.$s=!(null==(e=this.instance.persistence)||!e.props[je]),this.rageclicks=new To(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return O(this.Bt.capture_heatmaps)&&this.Bt.capture_heatmaps.flush_interval_milliseconds&&(t=this.Bt.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return D(this.Bt.capture_heatmaps)?D(this.Bt.enable_heatmaps)?this.$s:this.Bt.enable_heatmaps:!1!==this.Bt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Rs)return;Ho.info("starting..."),this.Zs(),this.Ft()}else{var t;clearInterval(null!==(t=this.qs)&&void 0!==t?t:void 0),this.Vs(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[je]:e}),this.$s=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.T;return this.T=void 0,t}Hs(t){this.Tt(t.originalEvent,"deadclick")}Ft(){this.qs&&clearInterval(this.qs),this.qs="visible"===(null==r?void 0:r.visibilityState)?setInterval(this.Yr.bind(this),this.flushIntervalMilliseconds):null}Zs(){t&&r&&(this.zs=this.Yr.bind(this),Xi(t,Li,this.zs),this.Us=e=>this.Tt(e||(null==t?void 0:t.event)),Xi(r,"click",this.Us,{capture:!0}),this.Ys=e=>this.Gs(e||(null==t?void 0:t.event)),Xi(r,"mousemove",this.Ys,{capture:!0}),this.Ws=new yr(this.instance,mr,this.Hs.bind(this)),this.Ws.startIfEnabledOrStop(),this.Xs=this.Ft.bind(this),Xi(r,Di,this.Xs),this.Rs=!0)}Vs(){var e;t&&r&&(this.zs&&t.removeEventListener(Li,this.zs),this.Us&&r.removeEventListener("click",this.Us,{capture:!0}),this.Ys&&r.removeEventListener("mousemove",this.Ys,{capture:!0}),this.Xs&&r.removeEventListener(Di,this.Xs),clearTimeout(this.Js),null==(e=this.Ws)||e.stop(),this.Rs=!1)}Ks(e,i){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(e,i,r){for(var s=e;s&&Jn(s)&&!Kn(s,"body");){if(s===r)return!1;if(w(i,null==t?void 0:t.getComputedStyle(s).position))return!0;s=ao(s)}return!1}(so(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:r),target_fixed:o,type:i}}Tt(t,e){var i;if(void 0===e&&(e="click"),!Yn(t.target)&&qo(t)){var r=this.Ks(t,e);null!=(i=this.rageclicks)&&i.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.Qs(f({},r,{type:"rageclick"})),this.Qs(r)}}Gs(t){!Yn(t.target)&&qo(t)&&(clearTimeout(this.Js),this.Js=setTimeout((()=>{this.Qs(this.Ks(t,"mousemove"))}),500))}Qs(e){if(t){var i=t.location.href,r=this.Bt.custom_personal_data_properties,s=this.Bt.mask_personal_data_properties?[...Fr,...r||[]]:[],n=Or(i,s,Mr);this.T=this.T||{},this.T[n]||(this.T[n]=[]),this.T[n].push(e)}}Yr(){this.T&&!I(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:yr,webVitalsAutocapture:class{constructor(t){var e;this.$s=!1,this.Rs=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.eo=()=>{clearTimeout(this.ro),0!==this.T.metrics.length&&(this._instance.capture("$web_vitals",this.T.metrics.reduce(((t,e)=>f({},t,{["$web_vitals_"+e.name+"_event"]:f({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ht=t=>{var e,i=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);if(C(i))Mo.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.io();C(r)||(D(null==t?void 0:t.name)||D(null==t?void 0:t.value)?Mo.error("Invalid metric received",t):!this.no||this.no>t.value?(this.T.url!==r&&(this.eo(),this.ro=setTimeout(this.eo,this.flushToCaptureTimeoutMs)),C(this.T.url)&&(this.T.url=r),this.T.firstMetricTimestamp=C(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.T.metrics.push(f({},t,{$current_url:r,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.eo()):Mo.error("Ignoring metric with value >= "+this.no,t))}},this.so=()=>{if(!this.Rs){var t,e,i,r,s=h.__PosthogExtensions__;C(s)||C(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:e,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),t&&e&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.ht.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&e(this.ht.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.ht.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.ht.bind(this)),this.Rs=!0):Mo.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.$s=!(null==(e=this._instance.persistence)||!e.props[qe]),this.startIfEnabled()}get oo(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=O(this.oo)?null==(t=this.oo)?void 0:t.web_vitals_allowed_metrics:void 0;return D(i)?(null==(e=this._instance.persistence)?void 0:e.props[Ge])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(O(this.oo)?this.oo.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=O(this.oo)?this.oo.web_vitals_attribution:void 0;return null!=t&&t}get no(){var t=O(this.oo)&&L(this.oo.__web_vitals_max_value)?this.oo.__web_vitals_max_value:Do;return t>0&&6e4>=t?Do:t}get isEnabled(){var t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return Mo.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=O(this.oo)?this.oo.web_vitals:N(this.oo)?this.oo:void 0;return N(e)?e:this.$s}startIfEnabled(){this.isEnabled&&!this.Rs&&(Mo.info("enabled, starting..."),this.ur(this.so))}onRemoteConfig(t){if("capturePerformance"in t){var e=O(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=O(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[qe]:e}),this._instance.persistence.register({[Ge]:i})),this.$s=e,this.startIfEnabled()}}ur(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.postHogWebVitalsCallbacks?t():null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(e=>{e?Mo.error("failed to load script",e):t()}))}io(){var e=t?t.location.href:void 0;if(e){var i=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Fr,...i||[]]:[];return Or(e,r,Mr)}Mo.error("Could not determine current URL")}}},ma={exceptionObserver:class{constructor(e){var i,r,s;this.so=()=>{var e;if(t&&this.isEnabled&&null!=(e=h.__PosthogExtensions__)&&e.errorWrappingFunctions){var i=h.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=h.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=h.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ao&&this.Bt.capture_unhandled_errors&&(this.ao=i(this.captureException.bind(this))),!this.lo&&this.Bt.capture_unhandled_rejections&&(this.lo=r(this.captureException.bind(this))),!this.uo&&this.Bt.capture_console_errors&&(this.uo=s(this.captureException.bind(this)))}catch(t){Co.error("failed to start",t),this.ho()}}},this._instance=e,this.co=!(null==(i=this._instance.persistence)||!i.props[ze]),this.do=new J({refillRate:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==r?r:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,Gt:Co}),this.Bt=this.vo(),this.startIfEnabledOrStop()}vo(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return O(t)?e=f({},e,t):(C(t)?this.co:t)&&(e=f({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Bt.capture_console_errors||this.Bt.capture_unhandled_errors||this.Bt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Co.info("enabled"),this.ho(),this.ur(this.so)):this.ho()}ur(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.errorWrappingFunctions&&t(),null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return Co.error("failed to load script",e);t()}))}ho(){var t,e,i;null==(t=this.ao)||t.call(this),this.ao=void 0,null==(e=this.lo)||e.call(this),this.lo=void 0,null==(i=this.uo)||i.call(this),this.uo=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.co=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[ze]:this.co}),this.Bt=this.vo(),this.startIfEnabledOrStop())}onConfigChange(){this.Bt=this.vo()}captureException(t){var e,i,r,s=null!==(e=null==t||null==(i=t.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==e?e:"Exception";this.do.consumeRateLimit(s)?Co.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,i;this.fo=[],this.po=new te([new ve,new xe,new pe,new ce,new ye,new be,new _e,new we],function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];return function(e,r){void 0===r&&(r=0);for(var s=[],n=e.split("\n"),o=r;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=de.test(a)?a.replace(de,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of i){var h=u(l,t);if(h){s.push(h);break}}if(s.length>=50)break}}}return function(t){if(!t.length)return[];var e=Array.from(t);return e.reverse(),e.slice(0,50).map((t=>{return f({},t,{filename:t.filename||(i=e,i[i.length-1]||{}).filename,function:t.function||ee});var i}))}(s)}}("web:javascript",ae,he)),this._instance=t,this.fo=null!==(e=null==(i=this._instance.persistence)?void 0:i.get_property(Be))&&void 0!==e?e:[],this.mo=ke(this.yo()),this.bo=new Re(this.mo)}onConfigChange(){this.mo=ke(this.yo()),this.bo.setConfig(this.mo)}onRemoteConfig(t){var e,i,r;if("errorTracking"in t){var s=null!==(e=null==(i=t.errorTracking)?void 0:i.suppressionRules)&&void 0!==e?e:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.fo=s,this._instance.persistence&&this._instance.persistence.register({[Be]:this.fo,[He]:n})}}get _o(){var t,e=!!this._instance.get_property(He),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.po.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.mo.enabled)try{if(!F(t)||0===t.trim().length)return void ua.warn("Ignoring exception step because message must be a non-empty string");var i=this.wo(e),{sanitizedProperties:r,droppedKeys:s}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>$e.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(i);s.length>0&&ua.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.bo.add(f({[Ee]:t,[Se]:(new Date).toISOString()},r))}catch(t){ua.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.Io(e)){if(this.Co(e))return this.So("Exception dropped: matched a suppression rule"),void ua.info("Skipping exception capture because a suppression rule matched");if(!this._o&&this.xo(e))return this.So("Exception dropped: thrown by a browser extension"),void ua.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ko(e))return this.So("Exception dropped: thrown by the PostHog SDK"),void ua.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.mo.enabled&&D(t.$exception_steps)?this.To(t):t;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",en:!0});return r&&this.bo.clear(),r}catch(t){return ua.error("Failed to capture exception event. Dropping this exception.",t),void this.bo.clear()}}catch(t){return void ua.error("Failed to process exception event. Ignoring this exception.",t)}}To(t){try{var e=this.bo.getAttachable();return 0===e.length?t:f({},t,{$exception_steps:e})}catch(e){return ua.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}So(t){this.mo.enabled&&this.bo.add({[Ee]:t,[Se]:(new Date).toISOString()})}wo(t){return O(t)?f({},t):{}}yo(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}Co(t){if(0===t.length)return!1;var e=t.reduce(((t,e)=>{var{type:i,value:r}=e;return F(i)&&i.length>0&&t.$exception_types.push(i),F(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.fo.some((t=>{var i=t.values.map((t=>{var i,r=_n[t.operator],s=R(t.value)?t.value:[t.value],n=null!==(i=e[t.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)}));return"OR"===t.type?i.some(Boolean):i.every(Boolean)}))}xo(t){return t.flatMap((t=>{var e,i;return null!==(e=null==(i=t.stacktrace)?void 0:i.frames)&&void 0!==e?e:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}ko(t){if(t.length>0){var e,i,r,s,n=null!==(e=null==(i=t[0].stacktrace)?void 0:i.frames)&&void 0!==e?e:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Io(t){return!D(t)&&R(t)}}},ba=f({productTours:class{get ni(){return this._instance.persistence}constructor(t){this.Ao=null,this.Eo=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this.ni&&this.ni.register({[We]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,e;this.Ao||(t=this._instance).config.disable_product_tours||null==(e=t.persistence)||!e.get_property(We)||this.ur((()=>this.Ro()))}ur(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?Vo.error("Could not load product tours script",e):t()}))}Ro(){var t;!this.Ao&&null!=(t=h.__PosthogExtensions__)&&t.generateProductTours&&(this.Ao=h.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!R(this.Eo)||e){var i=this.ni;if(i){var r=i.props[ci];if(R(r)&&!e)return this.Eo=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:e=>{var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return Vo.error(s),void t([],{isLoaded:!1,error:s})}var n=R(e.json.product_tours)?e.json.product_tours:[];this.Eo=n,i&&i.register({[ci]:n}),t(n,{isLoaded:!0})}})}else t(this.Eo,{isLoaded:!0})}getActiveProductTours(t){D(this.Ao)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ao.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.Ao)||e.showTourById(t)}previewTour(t){this.Ao?this.Ao.previewTour(t):this.ur((()=>{var e;this.Ro(),null==(e=this.Ao)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Ao)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Ao)||t.nextStep()}previousStep(){var t;null==(t=this.Ao)||t.previousStep()}clearCache(){var t;this.Eo=null,null==(t=this.ni)||t.unregister(ci)}resetTour(t){var e;null==(e=this.Ao)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.Ao)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.Ao)||e.cancelPendingTour(t)}}},fa),ya={siteApps:class{constructor(t){this._instance=t,this.No=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Mo(t,e){if(e){var i=this.globalsForEvent(e);this.No.push(i),this.No.length>1e3&&(this.No=this.No.slice(10))}}get siteAppLoaders(){var t;return null==(t=h._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Mo.bind(this));this.Fo=()=>{t(),this.No=[],this.Fo=void 0}}}globalsForEvent(t){var e,i,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[d,v]of Object.entries(h))l[d]={id:u[d],type:d,properties:v};var{$set_once:c,$set:p}=t;return{event:f({},_(t,Wo),{properties:f({},t.properties,p?{$set:f({},null!==(e=null==(i=t.properties)?void 0:i.$set)&&void 0!==e?e:{},p)}:{},c?{$set_once:f({},null!==(r=null==(s=t.properties)?void 0:s.$set_once)&&void 0!==r?r:{},c)}:{}),elements_chain:null!==(n=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=t.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(t){var e=this.apps[t.id],i=()=>{var i;!e.errored&&this.No.length&&(Go.info("Processing "+this.No.length+" events for site app with id "+t.id),this.No.forEach((t=>null==e.processEvent?void 0:e.processEvent(t))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this.Fo)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,Go.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=t.init({posthog:this._instance,callback(t){s(t)}});n&&(e.processEvent=n),r=!0}catch(e){Go.error(Yo+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){Go.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}Oo(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of t)this.setupSiteApp(i)}Po(t){if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(e)}catch(e){Go.error("Error while processing event "+t.event+" for site app "+i.id,e)}}}onRemoteConfig(t){var e,i,r,s=this;if(null!=(e=this.siteAppLoaders)&&e.length)return this.isEnabled?(this.Oo(),void this._instance.on("eventCaptured",(t=>this.Po(t)))):void Go.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Fo)||i.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var e;h["__$$ph_site_app_"+t]=s._instance,null==(e=h.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(s._instance,a,(e=>{if(e)return Go.error(Yo+t,e)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else Go.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},wa={tracingHeaders:class{constructor(t){this.Lo=void 0,this.Do=void 0,this.so=()=>{var t,e,i=this.Bo()||[];C(this.Lo)&&(null==(t=h.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(i,this._instance.get_distinct_id(),this._instance.sessionManager)),C(this.Do)&&(null==(e=h.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchFetch(i,this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}initialize(){this.startIfEnabledOrStop()}ur(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.tracingHeadersPatchFns&&t(),null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return Ao.error("failed to load script",e);t()}))}Bo(){var t;return null!==(t=this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}startIfEnabledOrStop(){var t,e;this.Bo()?this.ur(this.so):(null==(t=this.Lo)||t.call(this),null==(e=this.Do)||e.call(this),this.Lo=void 0,this.Do=void 0)}}},xa=f({surveys:class{get Bt(){return this._instance.config}constructor(t){this.jo=void 0,this._surveyManager=null,this.$o=!1,this.qo=[],this.Zo=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Bt.disable_surveys){var e=t.surveys;if(D(e))return En.warn("Flags not loaded yet. Not loading surveys.");var i=R(e);this.jo=i?e.length>0:e,En.info("flags response received, isSurveysEnabled: "+this.jo),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],e=0;e<localStorage.length;e++){var i=localStorage.key(e);(null!=i&&i.startsWith(Sn)||null!=i&&i.startsWith("inProgressSurvey_"))&&t.push(i)}t.forEach((t=>localStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.$o)En.info("Already initializing surveys, skipping...");else if(this.Bt.disable_surveys)En.info(ta);else if(this.Bt.cookieless_mode&&this._instance.consent.isOptedOut())En.info("Not loading surveys in cookieless mode without consent.");else{var t=null==h?void 0:h.__PosthogExtensions__;if(t){if(!C(this.jo)||this.Bt.advanced_enable_surveys){var e=this.jo||this.Bt.advanced_enable_surveys;this.$o=!0;try{var i=t.generateSurveys;if(i)return void this.Vo(i,e);var r=t.loadExternalDependency;if(!r)return void this.Ho(Oi);r(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.Ho("Could not load surveys script",i):this.Vo(t.generateSurveys,e)}))}catch(t){throw this.Ho("Error initializing surveys",t),t}finally{this.$o=!1}}}else En.error("PostHog Extensions not found.")}}Vo(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new Qo(this._instance),En.info("Surveys loaded successfully"),this.zo({isLoaded:!0})}Ho(t,e){En.error(t,e),this.zo({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.qo.push(t),this._surveyManager&&this.zo({isLoaded:!0}),()=>{this.qo=this.qo.filter((e=>e!==t))}}getSurveys(t,e){if(void 0===e&&(e=!1),this.Bt.disable_surveys)return En.info(ta),t([]);var i,r=this._instance.get_property(di);if(r&&!e)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.Zo?this.Zo.then((e=>{var{surveys:i,context:r}=e;return t(i,r)})):("undefined"!=typeof Promise&&(this.Zo=new Promise((t=>{i=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Bt.token),method:"GET",timeout:this.Bt.surveys_request_timeout_ms,callback:e=>{var r;this.Zo=null;var s=e.statusCode;if(200!==s||!e.json){var n="Surveys API could not be loaded, status: "+s;En.error(n);var o={isLoaded:!1,error:n};return t([],o),void(null==i||i({surveys:[],context:o}))}var a,l=e.json.surveys||[],u=l.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var e;return!(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}(t)||function(t){var e;return!(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)||!e.length)}(t))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(r=this._instance.persistence)||r.register({[di]:l});var h={isLoaded:!0};t(l,h),null==i||i({surveys:l,context:h})}}))}zo(t){for(var e of this.qo)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){En.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!D(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);En.warn("init was not called")}Uo(t){var e=null;return this.getSurveys((i=>{var r;e=null!==(r=i.find((e=>e.id===t)))&&void 0!==r?r:null})),e}Yo(t){if(D(this._surveyManager))return{eligible:!1,reason:Zo};var e="string"==typeof t?this.Uo(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(D(this._surveyManager))return En.warn("init was not called"),{visible:!1,disabledReason:Zo};var e=this.Yo(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return D(this._surveyManager)?(En.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Zo})):new Promise((i=>{this.getSurveys((e=>{var r,s=null!==(r=e.find((e=>e.id===t)))&&void 0!==r?r:null;if(s){var n=this.Yo(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var s;if(D(this._surveyManager))En.warn("init was not called");else{var n="string"==typeof t?this.Uo(t):t;if(null!=n&&n.id)if($n.includes(n.type)){var o=null==r?void 0:r.querySelector(e);if(o)return null!=(s=n.appearance)&&s.surveyPopupDelaySeconds?(En.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,e;En.info("Rendering survey "+n.id+" with delay of "+(null==(t=n.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(e=this._surveyManager)||e.renderSurvey(n,o,i),En.info("Survey "+n.id+" rendered")}),1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,o,i);En.warn("Survey element not found")}else En.warn("Surveys of type "+n.type+" cannot be rendered in the app");else En.warn("Survey not found")}}displaySurvey(t,e){var i;if(D(this._surveyManager))En.warn("init was not called");else{var r=this.Uo(t);if(r){var s=r;if(null!=(i=r.appearance)&&i.surveyPopupDelaySeconds&&e.ignoreDelay&&(s=f({},r,{appearance:f({},r.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==ns.Popover&&e.initialResponses&&En.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void En.warn("Survey is not eligible to be displayed: ",n.disabledReason)}e.displayType!==ns.Inline?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}else En.warn("Survey not found")}}cancelPendingSurvey(t){D(this._surveyManager)?En.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},fa),Ea={toolbar:class{constructor(t){this.instance=t}Go(t){h.ph_toolbar_state=t}Wo(){var t;return null!==(t=h.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,i,s){if(void 0===e&&(e=void 0),void 0===i&&(i=void 0),void 0===s&&(s=void 0),Qi(this.instance.config))return!1;if(!t||!r)return!1;e=null!=e?e:t.location,s=null!=s?s:t.history;try{if(!i){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}i=null==t?void 0:t.localStorage}var n,o=ea||Ir(e.hash,"__posthog")||Ir(e.hash,"state"),a=o?Wi((()=>JSON.parse(atob(decodeURIComponent(o)))))||Wi((()=>JSON.parse(decodeURIComponent(o)))):null;return a&&"ph_authorize"===a.action?((n=a).source="url",n&&Object.keys(n).length>0&&(a.desiredHash?e.hash=a.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):((n=JSON.parse(i.getItem(ia)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(t){return!1}}Xo(t){var e=h.ph_load_toolbar||h.ph_load_editor;!D(e)&&P(e)?e(t,this.instance):ra.warn("No toolbar load function found")}loadToolbar(e){var i=!(null==r||!r.getElementById($i));if(!t||i)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=f({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(ia,JSON.stringify(f({},n,{source:void 0}))),2===this.Wo())this.Xo(n);else if(0===this.Wo()){var o;this.Go(1),null==(o=h.__PosthogExtensions__)||null==o.loadExternalDependency||o.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return ra.error("[Toolbar] Failed to load",t),void this.Go(0);this.Go(2),this.Xo(n)})),Xi(t,"turbolinks:load",(()=>{this.Go(0),this.loadToolbar(n)}))}return!0}Jo(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,i){return void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(t,e,i)}}},Sa=f({experiments:va},fa),$a={conversations:class{constructor(t){this.Ko=void 0,this._conversationsManager=null,this.Qo=!1,this.ea=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;D(e)||(N(e)?this.Ko=e:(this.Ko=e.enabled,this.ea=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Ko=void 0,this.ea=null}loadIfEnabled(){if(!(this._conversationsManager||this.Qo||this._instance.config.disable_conversations||Qi(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==h?void 0:h.__PosthogExtensions__;if(t&&!C(this.Ko)&&this.Ko)if(this.ea&&this.ea.token){this.Qo=!0;try{var e=t.initConversations;if(e)return this.ta(e),void(this.Qo=!1);var i=t.loadExternalDependency;if(!i)return void this.ra(Oi);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.ra("Could not load conversations script",e):this.ta(t.initConversations),this.Qo=!1}))}catch(t){this.ra("Error initializing conversations",t),this.Qo=!1}}else ca.error("Conversations enabled but missing token in remote config.")}}ta(t){if(this.ea)try{this._conversationsManager=t(this.ea,this._instance),ca.info("Conversations loaded successfully")}catch(t){this.ra("Error completing conversations initialization",t)}else ca.error("Cannot complete initialization: remote config is null")}ra(t,e){ca.error(t,e),this._conversationsManager=null,this.Qo=!1}show(){this._conversationsManager?this._conversationsManager.show():ca.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Ko&&!M(this._conversationsManager)}isVisible(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,e,i){var r=this;return p((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,e,i):(ca.warn(pa),null)}))()}getMessages(t,e){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(ca.warn(pa),null)}))()}markAsRead(t){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(ca.warn(pa),null)}))()}getTickets(t){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(ca.warn(pa),null)}))()}requestRestoreLink(t){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(ca.warn(pa),null)}))()}restoreFromToken(t){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(ca.warn(pa),null)}))()}restoreFromUrlToken(){var t=this;return p((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(ca.warn(pa),null)}))()}getCurrentTicketId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}un(){var t;null==(t=this._conversationsManager)||t.setIdentity()}hn(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},Ta={logs:class{constructor(t){var e;this.ia=!1,this.na=!1,this.Gt=Ce("[logs]"),this.sa=[],this.oa=0,this.aa=0,this.la=!1,this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.ia=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,i=null==(e=t.logs)?void 0:e.captureConsoleLogs;!D(i)&&i&&(this.ia=!0,this.loadIfEnabled())}reset(){this.sa=[],this.jr&&(clearTimeout(this.jr),this.jr=void 0),this.oa=0,this.aa=0,this.la=!1}loadIfEnabled(){if(this.ia&&!this.na){var t=null==h?void 0:h.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(e=>{var i;e||null==(i=t.logs)||!i.initializeLogs?this.Gt.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.na=!0)})):this.Gt.error(Oi)}else this.Gt.error("PostHog Extensions not found.")}}captureLog(t){var e,i,r,s,n,o;if(this._instance.is_capturing())if(t&&t.body){var a=null!==(e=null==(i=this._instance.config.logs)?void 0:i.flushIntervalMs)&&void 0!==e?e:3e3,l=null!==(r=null==(s=this._instance.config.logs)?void 0:s.maxLogsPerInterval)&&void 0!==r?r:1e3,u=Date.now();if(a>u-this.aa||(this.aa=u,this.oa=0,this.la=!1),l>this.oa){this.oa++;var h=function(t,e){var i=t.level||"info",{text:r,number:s}=Jt[i]||Kt,n=String(Date.now())+"000000",o={};e.distinctId&&(o.posthogDistinctId=e.distinctId),e.sessionId&&(o.sessionId=e.sessionId),e.currentUrl&&(o["url.full"]=e.currentUrl),e.screenName&&(o["screen.name"]=e.screenName),e.appState&&(o["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(o.feature_flags=e.activeFeatureFlags);var a=f({},o,t.attributes||{}),l={timeUnixNano:n,observedTimeUnixNano:n,severityNumber:s,severityText:r,body:{stringValue:t.body},attributes:Qt(a)};return t.trace_id&&(l.traceId=t.trace_id),t.span_id&&(l.spanId=t.span_id),C(t.trace_flags)||(l.flags=t.trace_flags),l}(t,this.ua());this.sa.push({record:h}),(null!==(n=null==(o=this._instance.config.logs)?void 0:o.maxBufferSize)&&void 0!==n?n:100)>this.sa.length?this.ha():this.flushLogs()}else this.la||(this.Gt.warn("captureLog dropping logs: exceeded "+l+" logs per "+a+"ms"),this.la=!0)}else this.Gt.warn("captureLog requires a body")}get logger(){return this.ca||(this.ca={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.ca}flushLogs(t){if(this.jr&&(clearTimeout(this.jr),this.jr=void 0),0!==this.sa.length){var e=this.sa;this.sa=[];var i=this._instance.config.logs,r=f({"service.name":(null==i?void 0:i.serviceName)||"unknown_service"},(null==i?void 0:i.environment)&&{"deployment.environment":i.environment},(null==i?void 0:i.serviceVersion)&&{"service.version":i.serviceVersion},null==i?void 0:i.resourceAttributes),s=function(t,e,i,r){return{resourceLogs:[{resource:{attributes:Qt(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}(e.map((t=>t.record)),r,v.LIB_NAME,v.LIB_VERSION),n=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Vi({method:"POST",url:n,data:s,compression:"best-available",batchKey:"logs",transport:t})}}ha(){var t,e;this.jr||(this.jr=setTimeout((()=>{this.jr=void 0,this.flushLogs()}),null!==(t=null==(e=this._instance.config.logs)?void 0:e.flushIntervalMs)&&void 0!==t?t:3e3))}ua(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=i}if(null!=h&&null!=(t=h.location)&&t.href&&(e.currentUrl=h.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(e.activeFeatureFlags=r)}return e}}},ka=f({},fa,_a,ga,ma,ba,ya,xa,wa,Ea,Sa,$a,Ta);qn.__defaultExtensionClasses=f({},ka);var Ra,Pa=(Ra=In[Un]=new qn,function(){function e(){e.done||(e.done=!0,Nn=!1,Hi(In,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?e():Xi(r,"DOMContentLoaded",e,{capture:!1}):t&&Ie.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),Ra);export{ps as Compression,os as DEFAULT_PRODUCT_TOUR_APPEARANCE,ns as DisplaySurveyType,qn as PostHog,as as ProductTourEventName,ls as ProductTourEventProperties,rs as SurveyEventName,ss as SurveyEventProperties,Jr as SurveyEventType,Xr as SurveyPosition,es as SurveyQuestionBranchingType,ts as SurveyQuestionType,is as SurveySchedule,Qr as SurveyTabPosition,Zr as SurveyType,Kr as SurveyWidgetType,Pa as default,Pa as posthog,cs as severityLevels};
2
2
  //# sourceMappingURL=module.js.map