posthog-js 1.366.1 → 1.366.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.es5.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/conversations.js +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/logs.js +1 -1
- package/dist/main.js +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/dist/product-tours.js +1 -1
- package/dist/surveys-preview.js +1 -1
- package/dist/surveys-preview.js.map +1 -1
- package/dist/surveys.js +1 -1
- package/dist/surveys.js.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +3 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(){"use strict";function t(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function i(i){return function(){var e=this,r=arguments;return new Promise((function(s,n){var o=i.apply(e,r);function a(i){t(o,s,n,a,l,"next",i)}function l(i){t(o,s,n,a,l,"throw",i)}a(void 0)}))}}function e(){return e=Object.assign?Object.assign.bind():function(t){for(var i=1;arguments.length>i;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},e.apply(null,arguments)}function r(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}var s="1.366.1",n={DEBUG:!1,LIB_VERSION:s,LIB_NAME:"web",JS_SDK_VERSION:s},o="$people_distinct_id",a="$device_id",l="__alias",h="__timers",u="$autocapture_disabled_server_side",d="$heatmaps_enabled_server_side",v="$exception_capture_enabled_server_side",c="$error_tracking_suppression_rules",f="$error_tracking_capture_extension_exceptions",p="$web_vitals_enabled_server_side",g="$dead_clicks_enabled_server_side",_="$product_tours_enabled_server_side",m="$web_vitals_allowed_metrics",b="$session_recording_remote_config",y="$sesid",w="$session_is_sampled",x="$enabled_feature_flags",S="$early_access_features",E="$feature_flag_details",k="$stored_person_properties",P="$stored_group_properties",I="$surveys",T="$flag_call_reported",R="$flag_call_reported_session_id",F="$feature_flag_errors",C="$feature_flag_evaluated_at",O="$user_state",M="$client_session_props",A="$capture_rate_limit",D="$initial_campaign_params",j="$initial_referrer_info",L="$initial_person_info",z="$epp",U="__POSTHOG_TOOLBAR__",N="$posthog_cookieless",H=[o,l,"__cmpns",h,"$session_recording_enabled_server_side",d,y,x,c,O,S,E,P,k,I,T,R,F,C,M,A,D,j,z,L],B="PostHog loadExternalDependency extension not found.",q="on_reject",W="always",V="anonymous",G="identified",J="identified_only",K="visibilitychange",Y="beforeunload",X="$pageview",Q="$pageleave",Z="$identify",tt="$groupidentify",it="undefined"!=typeof window?window:void 0,et="undefined"!=typeof globalThis?globalThis:it;"undefined"==typeof self&&(et.self=et),"undefined"==typeof File&&(et.File=function(){});var rt=null==et?void 0:et.navigator,st=null==et?void 0:et.document,nt=null==et?void 0:et.location,ot=null==et?void 0:et.fetch,at=null!=et&&et.XMLHttpRequest&&"withCredentials"in new et.XMLHttpRequest?et.XMLHttpRequest:void 0,lt=null==et?void 0:et.AbortController,ht=null==et?void 0:et.CompressionStream,ut=null==rt?void 0:rt.userAgent,dt=null!=it?it:{};function vt(){return(vt=i((function*(t,i){void 0===i&&(i=!0);try{var e=new Blob([t],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return yield new Response(e).blob()}catch(t){return i&&console.error("Failed to gzip compress data",t),null}}))).apply(this,arguments)}var ct=["$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"],ft=["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"],pt=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return ft.concat(i).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))};function gt(t,i){return-1!==t.indexOf(i)}var _t=function(t){return t.trim()},mt=function(t){return t.replace(/^\$/,"")},bt=Object.prototype,yt=bt.hasOwnProperty,wt=bt.toString,xt=Array.isArray||function(t){return"[object Array]"===wt.call(t)},St=t=>"function"==typeof t,Et=t=>t===Object(t)&&!xt(t),$t=t=>{if(Et(t)){for(var i in t)if(yt.call(t,i))return!1;return!0}return!1},kt=t=>void 0===t,Pt=t=>"[object String]"==wt.call(t),It=t=>Pt(t)&&0===t.trim().length,Tt=t=>null===t,Rt=t=>kt(t)||Tt(t),Ft=t=>"[object Number]"==wt.call(t)&&t==t,Ct=t=>Ft(t)&&t>0,Ot=t=>"[object Boolean]"===wt.call(t),Mt=t=>t instanceof FormData,At=t=>gt(ct,t);function Dt(t){return null===t||"object"!=typeof t}function jt(t,i){return{}.toString.call(t)==="[object "+i+"]"}function Lt(t){return"undefined"!=typeof Event&&function(t,i){try{return t instanceof i}catch(t){return!1}}(t,Event)}var zt=[!0,"true",1,"1","yes"],Ut=t=>gt(zt,t),Nt=[!1,"false",0,"0","no"];function Ht(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),Ft(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(r.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(r.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+s),Ht(s||e,i,e,r))}class Bt{constructor(t){this.Pt={},this.Dt=t.Dt,this.jt=Ht(t.bucketSize,0,100,t.qt),this.$t=Ht(t.refillRate,0,this.jt,t.qt),this.Ht=Ht(t.refillInterval,0,864e5,t.qt)}Vt(t,i){var e=Math.floor((i-t.lastAccess)/this.Ht);e>0&&(t.tokens=Math.min(t.tokens+e*this.$t,this.jt),t.lastAccess=t.lastAccess+e*this.Ht)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.Pt[r];return s?this.Vt(s,e):this.Pt[r]=s={tokens:this.jt,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.Dt)||i.call(this,t)),0===s.tokens)}stop(){this.Pt={}}}var qt,Wt,Vt,Gt="Mobile",Jt="iOS",Kt="Android",Yt="Tablet",Xt=Kt+" "+Yt,Qt="iPad",Zt="Apple",ti=Zt+" Watch",ii="Safari",ei="BlackBerry",ri="Samsung",si=ri+"Browser",ni=ri+" Internet",oi="Chrome",ai=oi+" OS",li=oi+" "+Jt,hi="Internet Explorer",ui=hi+" "+Gt,di="Opera",vi=di+" Mini",ci="Edge",fi="Microsoft "+ci,pi="Firefox",gi=pi+" "+Jt,_i="Nintendo",mi="PlayStation",bi="Xbox",yi=Kt+" "+Gt,wi=Gt+" "+ii,xi="Windows",Si=xi+" Phone",Ei="Nokia",$i="Ouya",ki="Generic",Pi=ki+" "+Gt.toLowerCase(),Ii=ki+" "+Yt.toLowerCase(),Ti="Konqueror",Ri="(\\d+(\\.\\d+)?)",Fi=new RegExp("Version/"+Ri),Ci=new RegExp(bi,"i"),Oi=new RegExp(mi+" \\w+","i"),Mi=new RegExp(_i+" \\w+","i"),Ai=new RegExp(ei+"|PlayBook|BB10","i"),Di={"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"},ji=function(t,i){return i=i||"",gt(t," OPR/")&>(t,"Mini")?vi:gt(t," OPR/")?di:Ai.test(t)?ei:gt(t,"IE"+Gt)||gt(t,"WPDesktop")?ui:gt(t,si)?ni:gt(t,ci)||gt(t,"Edg/")?fi:gt(t,"FBIOS")?"Facebook "+Gt:gt(t,"UCWEB")||gt(t,"UCBrowser")?"UC Browser":gt(t,"CriOS")?li:gt(t,"CrMo")||gt(t,oi)?oi:gt(t,Kt)&>(t,ii)?yi:gt(t,"FxiOS")?gi:gt(t.toLowerCase(),Ti.toLowerCase())?Ti:((t,i)=>i&>(i,Zt)||function(t){return gt(t,ii)&&!gt(t,oi)&&!gt(t,Kt)}(t))(t,i)?gt(t,Gt)?wi:ii:gt(t,pi)?pi:gt(t,"MSIE")||gt(t,"Trident/")?hi:gt(t,"Gecko")?pi:""},Li={[ui]:[new RegExp("rv:"+Ri)],[fi]:[new RegExp(ci+"?\\/"+Ri)],[oi]:[new RegExp("("+oi+"|CrMo)\\/"+Ri)],[li]:[new RegExp("CriOS\\/"+Ri)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ri)],[ii]:[Fi],[wi]:[Fi],[di]:[new RegExp("(Opera|OPR)\\/"+Ri)],[pi]:[new RegExp(pi+"\\/"+Ri)],[gi]:[new RegExp("FxiOS\\/"+Ri)],[Ti]:[new RegExp("Konqueror[:/]?"+Ri,"i")],[ei]:[new RegExp(ei+" "+Ri),Fi],[yi]:[new RegExp("android\\s"+Ri,"i")],[ni]:[new RegExp(si+"\\/"+Ri)],[hi]:[new RegExp("(rv:|MSIE )"+Ri)],Mozilla:[new RegExp("rv:"+Ri)]},zi=function(t,i){var e=ji(t,i),r=Li[e];if(kt(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},Ui=[[new RegExp(bi+"; "+bi+" (.*?)[);]","i"),t=>[bi,t&&t[1]||""]],[new RegExp(_i,"i"),[_i,""]],[new RegExp(mi,"i"),[mi,""]],[Ai,[ei,""]],[new RegExp(xi,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[Si,""];if(new RegExp(Gt).test(i)&&!/IEMobile\b/.test(i))return[xi+" "+Gt,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=Di[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[xi,r]}return[xi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[Jt,[t[3],t[4],t[5]||"0"].join(".")]:[Jt,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=kt(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+Kt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Kt+")","i"),t=>t&&t[2]?[Kt,[t[2],t[3],t[4]||"0"].join(".")]:[Kt,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ai,""]],[/Linux|debian/i,["Linux",""]]],Ni=function(t){return Mi.test(t)?_i:Oi.test(t)?mi:Ci.test(t)?bi:new RegExp($i,"i").test(t)?$i:new RegExp("("+Si+"|WPDesktop)","i").test(t)?Si:/iPad/.test(t)?Qt:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ti:Ai.test(t)?ei:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Ei,"i").test(t)?Ei:/(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(Gt).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)?Kt:Xt:new RegExp("(pda|"+Gt+")","i").test(t)?Pi:new RegExp(Yt,"i").test(t)&&!new RegExp(Yt+" pc","i").test(t)?Ii:""},Hi=t=>t instanceof Error;function Bi(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Vt&&e.length===Wt||(Wt=e.length,Vt=e.reduce(((e,r)=>{qt||(qt={});var s=qt[r];if(s)e[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,h=i[r];if(l&&h){e[l]=h,qt[r]=[l,h];break}}return e}),{})),Vt}}class qi{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var e=this;return i((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&xt(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t}))()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var r,s;return null!=t.cause&&(r=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),e({},t,{cause:r,stack:s})}applyChunkIds(t,i){return t.map((t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t)))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var e=this;return i((function*(){var i=t;for(var r of e.modifiers)i=yield r(i);return i}))()}convertToExceptionList(t,i){var r,s,n,o={type:t.type,value:t.value,mechanism:{type:null!==(r=i.type)&&void 0!==r?r:"generic",handled:null===(s=i.handled)||void 0===s||s,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(o.stacktrace={type:"raw",frames:t.stack});var a=[o];return null!=t.cause&&a.push(...this.convertToExceptionList(t.cause,e({},i,{handled:!0}))),a}buildParsingContext(t){var i;return{chunkIdMap:Bi(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,r){void 0===r&&(r=0);var s=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return e({},i,{syntheticException:0==r?i.syntheticException:void 0,mechanism:t,apply:t=>s(t,r),next:t=>s(t,r+1)})}}var Wi="?";function Vi(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?Wi:e,in_app:!0};return kt(r)||(n.lineno=r),kt(s)||(n.colno=s),n}var Gi=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:Wi,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},Ji=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ki=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Yi=/\((\S*)(?::(\d+))(?::(\d+))\)/,Xi=(t,i)=>{var e=Ji.exec(t);if(e){var[,r,s,n]=e;return Vi(i,r,Wi,+s,+n)}var o=Ki.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=Yi.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,h]=Gi(o[1]||Wi,o[2]);return Vi(i,h,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Qi=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Zi=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,te=(t,i)=>{var e=Qi.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=Zi.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||Wi;return[n,s]=Gi(n,s),Vi(i,s,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},ie=/\(error: (.*)\)/;class ee{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=Pt(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return jt(t,"DOMException")}isDOMError(t){return jt(t,"DOMError")}}class re{match(t){return(t=>t instanceof Error)(t)}coerce(t,i){return{type:this.getType(t),value:this.getMessage(t,i),stack:this.getStack(t),cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){return t.stacktrace||t.stack||void 0}}class se{constructor(){}match(t){return jt(t,"ErrorEvent")&&null!=t.error}coerce(t,i){var e;return i.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}var ne=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class oe{match(t){return"string"==typeof t}coerce(t,i){var e,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(ne);return r&&(i=r[1],e=r[2]),[i,e]}}var ae=["fatal","error","warning","log","info","debug"];function le(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(i>=s.length)return r===e.length?s:s.length>i?s.slice(0,i)+"...":s}return""}class he{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r=this.getErrorPropertyFromObject(t);return r?i.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(e=i.syntheticException)?void 0:e.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Lt(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+le(t)}isSeverityLevel(t){return Pt(t)&&!It(t)&&ae.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var i in t)if({}.hasOwnProperty.call(t,i)){var e=t[i];if(Hi(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class ue{match(t){return Lt(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+le(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class de{match(t){return Dt(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class ve{match(t){return jt(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Lt(t))return!1;try{var i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return Dt(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.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 ce=function(t,i){var{debugEnabled:e}=void 0===i?{}:i,r={C(i){if(it&&(n.DEBUG||dt.POSTHOG_DEBUG||e)&&!kt(it.console)&&it.console){for(var r=("__rrweb_original__"in it.console[i]?it.console[i].__rrweb_original__:it.console[i]),s=arguments.length,o=new Array(s>1?s-1:0),a=1;s>a;a++)o[a-1]=arguments[a];r(t,...o)}},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.C("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.C("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.C("error",...i)},critical(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];console.error(t,...e)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(i,e)=>ce(t+" "+i,e)};return r},fe=ce("[PostHog.js]"),pe=fe.createLogger;function ge(t,i){xt(t)&&t.forEach(i)}function _e(t,i){if(!Rt(t))if(xt(t))t.forEach(i);else if(Mt(t))t.forEach(((t,e)=>i(t,e)));else for(var e in t)yt.call(t,e)&&i(t[e],e)}var me=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];for(var s of e)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function be(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}var ye=function(t){try{return t()}catch(t){return}},we=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){fe.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),fe.critical(t)}}},xe=function(t){var i={};return _e(t,(function(t,e){(Pt(t)&&t.length>0||Ft(t))&&(i[e]=t)})),i};var Se=["herokuapp.com","vercel.app","netlify.app"];function Ee(t){var i=null==t?void 0:t.hostname;if(!Pt(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of Se)if(e===r)return!1;return!0}function $e(t,i,e,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(i,e,{capture:s,passive:n})}function ke(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 Ft(t)&&isFinite(t)&&Math.floor(t)===t});class Pe{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,e,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||0>t||0>i||0>e||0>r||t>0xffffffffffff||i>4095||e>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|i>>>8,s[7]=i,s[8]=128|e>>>24,s[9]=e>>>16,s[10]=e>>>8,s[11]=e,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new Pe(s)}toString(){for(var t="",i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Pe(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;16>i;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class Ie{constructor(){this.I=0,this.S=0,this.k=new Fe}generate(){var t=this.generateOrAbort();if(kt(t)){this.I=0;var i=this.generateOrAbort();if(kt(i))throw new Error("Could not generate UUID after timestamp reset");return i}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 Pe.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 Te,Re=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};it&&!kt(it.crypto)&&crypto.getRandomValues&&(Re=t=>crypto.getRandomValues(t));class Fe{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(Re(this.T),this.N=0),this.T[this.N++]}}var Ce=()=>Oe().toString(),Oe=()=>(Te||(Te=new Ie)).generate(),Me="",Ae=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var De={Yt:()=>!!st,Ut(t){fe.error("cookieStore error: "+t)},Wt(t){if(st){try{for(var i=t+"=",e=st.cookie.split(";").filter((t=>t.length)),r=0;e.length>r;r++){for(var s=e[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(i))return decodeURIComponent(s.substring(i.length,s.length))}}catch(t){}return null}},Gt(t){var i;try{i=JSON.parse(De.Wt(t))||{}}catch(t){}return i},Xt(t,i,e,r,s){if(st)try{var n="",o="",a=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=st),Me)return Me;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),r=Math.min(e.length,8),s="dmn_chk_"+Ce();!Me&&r--;){var n=e.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";i.cookie=o+";max-age=3",i.cookie.includes(s)&&(i.cookie=o+";max-age=0",Me=n)}return Me}(t);if(!e){var r=(t=>{var i=t.match(Ae);return i?i[0]:""})(t);r!==e&&fe.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}(st.location.hostname,r);if(e){var l=new Date;l.setTime(l.getTime()+864e5*e),n="; expires="+l.toUTCString()}s&&(o="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(i))+n+"; SameSite=Lax; path=/"+a+o;return h.length>3686.4&&fe.warn("cookieStore warning: large cookie, len="+h.length),st.cookie=h,h}catch(t){return}},Jt(t,i){if(null!=st&&st.cookie)try{De.Xt(t,"",-1,i)}catch(t){return}}},je=null,Le={Yt(){if(!Tt(je))return je;var t=!0;if(kt(it))t=!1;else try{var i="__mplssupport__";Le.Xt(i,"xyz"),'"xyz"'!==Le.Wt(i)&&(t=!1),Le.Jt(i)}catch(i){t=!1}return t||fe.error("localStorage unsupported; falling back to cookie store"),je=t,t},Ut(t){fe.error("localStorage error: "+t)},Wt(t){try{return null==it?void 0:it.localStorage.getItem(t)}catch(t){Le.Ut(t)}return null},Gt(t){try{return JSON.parse(Le.Wt(t))||{}}catch(t){}return null},Xt(t,i){try{null==it||it.localStorage.setItem(t,JSON.stringify(i))}catch(t){Le.Ut(t)}},Jt(t){try{null==it||it.localStorage.removeItem(t)}catch(t){Le.Ut(t)}}},ze=[a,"distinct_id",y,w,z,L,O],Ue={},Ne={Yt:()=>!0,Ut(t){fe.error("memoryStorage error: "+t)},Wt:t=>Ue[t]||null,Gt:t=>Ue[t]||null,Xt(t,i){Ue[t]=i},Jt(t){delete Ue[t]}},He=null,Be={Yt(){if(!Tt(He))return He;if(He=!0,kt(it))He=!1;else try{var t="__support__";Be.Xt(t,"xyz"),'"xyz"'!==Be.Wt(t)&&(He=!1),Be.Jt(t)}catch(t){He=!1}return He},Ut(t){fe.error("sessionStorage error: ",t)},Wt(t){try{return null==it?void 0:it.sessionStorage.getItem(t)}catch(t){Be.Ut(t)}return null},Gt(t){try{return JSON.parse(Be.Wt(t))||null}catch(t){}return null},Xt(t,i){try{null==it||it.sessionStorage.setItem(t,JSON.stringify(i))}catch(t){Be.Ut(t)}},Jt(t){try{null==it||it.sessionStorage.removeItem(t)}catch(t){Be.Ut(t)}}};class qe{constructor(t){this._instance=t}get Rt(){return this._instance.config}get consent(){return this.Kt()?0:this.Qt}isOptedOut(){return this.Rt.cookieless_mode===W||0===this.consent||-1===this.consent&&(this.Rt.opt_out_capturing_by_default||this.Rt.cookieless_mode===q)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}optInOut(t){this.ti.Xt(this.ei,t?1:0,this.Rt.cookie_expiration,this.Rt.cross_subdomain_cookie,this.Rt.secure_cookie)}reset(){this.ti.Jt(this.ei,this.Rt.cross_subdomain_cookie)}get ei(){var{token:t,opt_out_capturing_cookie_prefix:i,consent_persistence_name:e}=this._instance.config;return e||(i?i+t:"__ph_opt_in_out_"+t)}get Qt(){var t=this.ti.Wt(this.ei);return Ut(t)?1:gt(Nt,t)?0:-1}get ti(){var t=this.Rt.opt_out_capturing_persistence_type,i="localStorage"===t?Le:De;if(!this.ii||this.ii!==i){this.ii=i;var e="localStorage"===t?De:Le;e.Wt(this.ei)&&(this.ii.Wt(this.ei)||this.optInOut(Ut(e.Wt(this.ei))),e.Jt(this.ei,this.Rt.cross_subdomain_cookie))}return this.ii}Kt(){return!!this.Rt.respect_dnt&&[null==rt?void 0:rt.doNotTrack,null==rt?void 0:rt.msDoNotTrack,dt.doNotTrack].some((t=>Ut(t)))}}var We=pe("[Dead Clicks]"),Ve=()=>!0,Ge=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(g)),r=t.instance.config.capture_dead_clicks;return Ot(r)?r:!!Et(r)||e};class Je{get lazyLoadedDeadClicksAutocapture(){return this.ri}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[g]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.ni((()=>{this.si()})):this.stop()}ni(t){var i,e;null!=(i=dt.__PosthogExtensions__)&&i.initDeadClicksAutocapture&&t(),null==(e=dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?We.error("failed to load script",i):t()}))}si(){var t;if(st){if(!this.ri&&null!=(t=dt.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=Et(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};i.__onCapture=this.onCapture,this.ri=dt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.ri.start(st),We.info("starting...")}}else We.error("`document` not found. Cannot start.")}stop(){this.ri&&(this.ri.stop(),this.ri=void 0,We.info("stopping..."))}}var Ke=pe("[SegmentIntegration]");var Ye="posthog-js";function Xe(t,i){var{organization:r,projectId:s,prefix:n,severityAllowList:o=["error"],sendExceptionsToPostHog:a=!0}=void 0===i?{}:i;return i=>{var l,h,u,d,v;if("*"!==o&&!o.includes(i.level)||!t.__loaded)return i;i.tags||(i.tags={});var c=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=c,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var f,p=(null==(l=i.exception)?void 0:l.values)||[],g=p.map((t=>e({},t,{stacktrace:t.stacktrace?e({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>e({},t,{platform:"web:javascript"})))}):void 0}))),_={$exception_message:(null==(h=p[0])?void 0:h.value)||i.message,$exception_type:null==(u=p[0])?void 0:u.type,$exception_level:i.level,$exception_list:g,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||i.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:i.tags};return r&&s&&(_.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+i.event_id),a&&(null==(f=t.exceptions)||f.sendExceptionEvent(_)),i}}class Qe{constructor(t,i,e,r,s,n){this.name=Ye,this.setupOnce=function(o){o(Xe(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Ze{constructor(t){this.oi=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength)&&(fe.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.ai=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.li()}li(){var t;this.ui=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.oi)}destroy(){var t;null==(t=this.ui)||t.call(this),this.ui=void 0}doPageView(t,i){var e,r=this.hi(t,i);return this.ai={pathname:null!==(e=null==it?void 0:it.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var i;return this.hi(t,null==(i=this.ai)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.ai)?void 0:t.pageViewId}}hi(t,i){var e=this.ai;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:h,maxContentY:u}=s;if(!(kt(n)||kt(o)||kt(a)||kt(l)||kt(h)||kt(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?Ht(o/n,0,1,fe):1,v=n>1?Ht(a/n,0,1,fe):1,c=l>1?Ht(h/l,0,1,fe):1,f=l>1?Ht(u/l,0,1,fe):1;r=me(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:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}}var tr=t=>{var i=null==st?void 0:st.createElement("a");return kt(i)?null:(i.href=t,i)},ir=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!xt(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){fe.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},er=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");xt(d)&&(i.includes(d[0])?h.push(d[0]+"="+e):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},rr=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},sr="https?://(.*)",nr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],or=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...nr],ar="<masked>",lr=["li_fat_id"];function hr(t,i,e){if(!st)return{};var r,s=i?[...nr,...e||[]]:[],n=ur(er(st.URL,s,ar),t),o=(r={},_e(lr,(function(t){var i=De.Wt(t);r[t]=i||null})),r);return me(o,n)}function ur(t,i){var e=or.concat(i||[]),r={};return _e(e,(function(i){var e=ir(t,i);r[i]=e||null})),r}function dr(t){var i=function(t){return t?0===t.search(sr+"google.([^/?]*)")?"google":0===t.search(sr+"bing.com")?"bing":0===t.search(sr+"yahoo.com")?"yahoo":0===t.search(sr+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",r={};if(!Tt(i)){r.$search_engine=i;var s=st?ir(st.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function vr(){return navigator.language||navigator.userLanguage}var cr="$direct";function fr(){return(null==st?void 0:st.referrer)||cr}function pr(t,i){var e=t?[...nr,...i||[]]:[],r=null==nt?void 0:nt.href.substring(0,1e3);return{r:fr().substring(0,1e3),u:r?er(r,e,ar):void 0}}function gr(t){var i,{r:e,u:r}=t,s={$referrer:e,$referring_domain:null==e?void 0:e==cr?cr:null==(i=tr(e))?void 0:i.host};if(r){s.$current_url=r;var n=tr(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=ur(r);me(s,o)}if(e){var a=dr(e);me(s,a)}return s}function _r(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function mr(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var br=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class yr{constructor(t,i){this.Rt=t,this.props={},this.ci=!1,this.di=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.ti=this.vi(t),this.load(),t.debug&&fe.info("Persistence loaded",t.persistence,e({},this.props)),this.update_config(t,t,i),this.save()}isDisabled(){return!!this.fi}vi(t){-1===br.indexOf(t.persistence.toLowerCase())&&(fe.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var i=function(t){void 0===t&&(t=[]);var i=[...ze,...t];return e({},Le,{Gt(t){try{var i={};try{i=De.Gt(t)||{}}catch(t){}var e=me(i,JSON.parse(Le.Wt(t)||"{}"));return Le.Xt(t,e),e}catch(t){}return null},Xt(t,e,r,s,n,o){try{Le.Xt(t,e,void 0,void 0,o);var a={};i.forEach((t=>{e[t]&&(a[t]=e[t])})),Object.keys(a).length&&De.Xt(t,a,r,s,n,o)}catch(t){Le.Ut(t)}},Jt(t,i){try{null==it||it.localStorage.removeItem(t),De.Jt(t,i)}catch(t){Le.Ut(t)}}})}(t.cookie_persisted_properties||[]),r=t.persistence.toLowerCase();return"localstorage"===r&&Le.Yt()?Le:"localstorage+cookie"===r&&i.Yt()?i:"sessionstorage"===r&&Be.Yt()?Be:"memory"===r?Ne:"cookie"===r?De:i.Yt()?i:De}pi(t){var i=null!=t?t:this.Rt.feature_flag_cache_ttl_ms;if(!i||0>=i)return!1;var e=this.props[C];return!e||"number"!=typeof e||Date.now()-e>i}properties(){var t={};return _e(this.props,((i,e)=>{if(e===x&&Et(i)){if(!this.pi())for(var r=Object.keys(i),s=0;r.length>s;s++)t["$feature/"+r[s]]=i[r[s]]}else-1===H.indexOf(e)&&(t[e]=i)})),t}load(){if(!this.fi){var t=this.ti.Gt(this.di);t&&(this.props=me({},t))}}save(){this.fi||this.ti.Xt(this.di,this.props,this.gi,this.mi,this.yi,this.Rt.debug)}remove(){this.ti.Jt(this.di,!1),this.ti.Jt(this.di,!0)}clear(){this.remove(),this.props={}}register_once(t,i,e){if(Et(t)){kt(i)&&(i="None"),this.gi=kt(e)?this.bi:e;var r=!1;if(_e(t,((t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.props[e]=t,r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(Et(t)){this.gi=kt(i)?this.bi:i;var e=!1;if(_e(t,((i,r)=>{t.hasOwnProperty(r)&&this.props[r]!==i&&(this.props[r]=i,e=!0)})),e)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.ci){var t=hr(this.Rt.custom_campaign_params,this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties);$t(xe(t))||this.register(t),this.ci=!0}}update_search_keyword(){var t;this.register((t=null==st?void 0:st.referrer)?dr(t):{})}update_referrer_info(){var t;this.register_once({$referrer:fr(),$referring_domain:null!=st&&st.referrer&&(null==(t=tr(st.referrer))?void 0:t.host)||cr},void 0)}set_initial_person_info(){this.props[D]||this.props[j]||this.register_once({[L]:pr(this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};_e([j,D],(i=>{var e=this.props[i];e&&_e(e,(function(i,e){t["$initial_"+mt(e)]=i}))}));var i,e,r=this.props[L];if(r){var s=(i=gr(r),e={},_e(i,(function(t,i){e["$initial_"+mt(i)]=t})),e);me(t,s)}return t}safe_merge(t){return _e(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,e){if(this.bi=this.gi=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!e),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==i.persistence||!((t,i)=>{if(t.length!==i.length)return!1;var e=[...t].sort(),r=[...i].sort();return e.every(((t,i)=>t===r[i]))})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[])){var r=this.vi(t),s=this.props;this.clear(),this.ti=r,this.props=s,this.save()}}set_disabled(t){this.fi=t,this.fi?this.remove():this.save()}set_cross_subdomain(t){t!==this.mi&&(this.mi=t,this.remove(),this.save())}set_secure(t){t!==this.yi&&(this.yi=t,this.remove(),this.save())}set_event_timer(t,i){var e=this.props[h]||{};e[t]=i,this.props[h]=e,this.save()}remove_event_timer(t){var i=(this.props[h]||{})[t];return kt(i)||(delete this.props[h][t],this.save()),i}get_property(t){return this.props[t]}set_property(t,i){this.props[t]=i,this.save()}}var wr="events",xr="cancelEvents",Sr="survey shown",Er="survey sent",$r="popover",kr=pe("[RateLimiter]");class Pr{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{kr.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void kr.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},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 i,e,r;void 0===t&&(t=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(A))&&void 0!==i?i:{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(A,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}}var Ir=pe("[RemoteConfig]");class Tr{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=dt._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}wi(t){var i,e;null!=(i=dt.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Ii(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(i){t(i.json)}})}load(){try{if(this.remoteConfig)return Ir.info("Using preloaded remote config",this.remoteConfig),this.Ci(this.remoteConfig),void this.Si();if(this._instance.ki())return void Ir.warn("Remote config is disabled. Falling back to local config.");this.wi((t=>{if(!t)return Ir.info("No config found after loading remote JS config. Falling back to JSON."),void this.Ii((t=>{this.Ci(t),this.Si()}));this.Ci(t),this.Si()}))}catch(t){Ir.error("Error loading remote config",t)}}stop(){this.xi&&(clearInterval(this.xi),this.xi=void 0)}refresh(){this._instance.ki()||"hidden"===(null==st?void 0:st.visibilityState)||this._instance.reloadFeatureFlags()}Si(){var t;if(!this.xi){var i=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==i&&(this.xi=setInterval((()=>{this.refresh()}),i))}}Ci(t){var i;t||Ir.error("Failed to fetch remote config from PostHog."),this._instance.Ci(null!=t?t:{}),!1!==(null==t?void 0:t.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded())}}var Rr="gzip-js",Fr="base64",Cr=Uint8Array,Or=Uint16Array,Mr=Uint32Array,Ar=new Cr([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]),Dr=new Cr([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]),jr=new Cr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Lr=function(t,i){for(var e=new Or(31),r=0;31>r;++r)e[r]=i+=1<<t[r-1];var s=new Mr(e[30]);for(r=1;30>r;++r)for(var n=e[r];e[r+1]>n;++n)s[n]=n-e[r]<<5|r;return[e,s]},zr=Lr(Ar,2),Ur=zr[1];zr[0][28]=258,Ur[258]=28;for(var Nr=Lr(Dr,0)[1],Hr=new Or(32768),Br=0;32768>Br;++Br){var qr=(43690&Br)>>>1|(21845&Br)<<1;Hr[Br]=((65280&(qr=(61680&(qr=(52428&qr)>>>2|(13107&qr)<<2))>>>4|(3855&qr)<<4))>>>8|(255&qr)<<8)>>>1}var Wr=function(t,i,e){for(var r=t.length,s=0,n=new Or(i);r>s;++s)++n[t[s]-1];var o,a=new Or(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new Or(1<<i);var l=15-i;for(s=0;r>s;++s)if(t[s])for(var h=s<<4|t[s],u=i-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[Hr[d]>>>l]=h}else for(o=new Or(r),s=0;r>s;++s)o[s]=Hr[a[t[s]-1]++]>>>15-t[s];return o},Vr=new Cr(288);for(Br=0;144>Br;++Br)Vr[Br]=8;for(Br=144;256>Br;++Br)Vr[Br]=9;for(Br=256;280>Br;++Br)Vr[Br]=7;for(Br=280;288>Br;++Br)Vr[Br]=8;var Gr=new Cr(32);for(Br=0;32>Br;++Br)Gr[Br]=5;var Jr=Wr(Vr,9,0),Kr=Wr(Gr,5,0),Yr=function(t){return(t/8>>0)+(7&t&&1)},Xr=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof Or?Or:t instanceof Mr?Mr:Cr)(e-i);return r.set(t.subarray(i,e)),r},Qr=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},Zr=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8,t[r+2]|=e>>>16},ts=function(t,i){for(var e=[],r=0;t.length>r;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new Cr(0),0];if(1==s){var o=new Cr(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort((function(t,i){return t.f-i.f})),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,u=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=e[e[d].f>e[h].f?h++:d++],l=e[h!=u&&e[d].f>e[h].f?h++:d++],e[u++]={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 Or(v+1),f=is(e[u-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;for(n.sort((function(t,i){return c[i.s]-c[t.s]||t.f-i.f}));s>r;++r){var m=n[r].s;if(i>=c[m])break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>>=g;p>0;){var b=n[r].s;i>c[b]?p-=1<<i-c[b]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==i&&(--c[y],++p)}f=i}return[new Cr(c),f]},is=function(t,i,e){return-1==t.s?Math.max(is(t.l,i,e+1),is(t.r,i,e+1)):i[t.s]=e},es=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new Or(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;i>=a;++a)if(t[a]==s&&a!=i)++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[e.subarray(0,r),i]},rs=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},ss=function(t,i,e){var r=e.length,s=Yr(i+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]=e[n];return 8*(s+4+r)},ns=function(t,i,e,r,s,n,o,a,l,h,u){Qr(i,u++,e),++s[256];for(var d=ts(s,15),v=d[0],c=d[1],f=ts(n,15),p=f[0],g=f[1],_=es(v),m=_[0],b=_[1],y=es(p),w=y[0],x=y[1],S=new Or(19),E=0;m.length>E;++E)S[31&m[E]]++;for(E=0;w.length>E;++E)S[31&w[E]]++;for(var k=ts(S,7),P=k[0],I=k[1],T=19;T>4&&!P[jr[T-1]];--T);var R,F,C,O,M=h+5<<3,A=rs(s,Vr)+rs(n,Gr)+o,D=rs(s,v)+rs(n,p)+o+14+3*T+rs(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(A>=M&&D>=M)return ss(i,u,t.subarray(l,l+h));if(Qr(i,u,1+(A>D)),u+=2,A>D){R=Wr(v,c,0),F=v,C=Wr(p,g,0),O=p;var j=Wr(P,I,0);for(Qr(i,u,b-257),Qr(i,u+5,x-1),Qr(i,u+10,T-4),u+=14,E=0;T>E;++E)Qr(i,u+3*E,P[jr[E]]);u+=3*T;for(var L=[m,w],z=0;2>z;++z){var U=L[z];for(E=0;U.length>E;++E)Qr(i,u,j[N=31&U[E]]),u+=P[N],N>15&&(Qr(i,u,U[E]>>>5&127),u+=U[E]>>>12)}}else R=Jr,F=Vr,C=Kr,O=Gr;for(E=0;a>E;++E)if(r[E]>255){var N;Zr(i,u,R[257+(N=r[E]>>>18&31)]),u+=F[N+257],N>7&&(Qr(i,u,r[E]>>>23&31),u+=Ar[N]);var H=31&r[E];Zr(i,u,C[H]),u+=O[H],H>3&&(Zr(i,u,r[E]>>>5&8191),u+=Dr[H])}else Zr(i,u,R[r[E]]),u+=F[r[E]];return Zr(i,u,R[256]),u+F[256]},os=new Mr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),as=function(){for(var t=new Mr(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),ls=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function hs(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p(i){for(var e=t,r=0;i.length>r;++r)e=as[255&e^i[r]]^e>>>8;t=e},d(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n,o,a,l,h=(a=10+((s=i).filename&&s.filename.length+1||0),l=8,function(t,i,e,r,s,n){var o=t.length,a=new Cr(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!i||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=ss(l,h,t.subarray(u,d)):(l[u]=!0,h=ss(l,h,t.subarray(u,o)))}else{for(var v=os[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new Or(32768),_=new Or(p+1),m=Math.ceil(e/3),b=2*m,y=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<b)&p},w=new Mr(25e3),x=new Or(288),S=new Or(32),E=0,k=0,P=(u=0,0),I=0,T=0;o>u;++u){var R=y(u),F=32767&u,C=_[R];if(g[F]=C,_[R]=F,u>=I){var O=o-u;if((E>7e3||P>24576)&&O>423){h=ns(t,l,0,w,x,S,k,P,T,u-T,h),P=E=k=0,T=u;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)S[M]=0}var A=2,D=0,j=f,L=F-C&32767;if(O>2&&R==y(u-L))for(var z=Math.min(c,O)-1,U=Math.min(32767,u),N=Math.min(258,O);U>=L&&--j&&F!=C;){if(t[u+A]==t[u+A-L]){for(var H=0;N>H&&t[u+H]==t[u+H-L];++H);if(H>A){if(A=H,D=L,H>z)break;var B=Math.min(L,H-2),q=0;for(M=0;B>M;++M){var W=u-L+M+32768&32767,V=W-g[W]+32768&32767;V>q&&(q=V,C=W)}}}L+=(F=C)-(C=g[F])+32768&32767}if(D){w[P++]=268435456|Ur[A]<<18|Nr[D];var G=31&Ur[A],J=31&Nr[D];k+=Ar[G]+Dr[J],++x[257+G],++S[J],I=u+A,++E}else w[P++]=t[u],++x[t[u]]}}h=ns(t,l,!0,w,x,S,k,P,T,u-T,h)}return Xr(a,0,r+Yr(h)+s)}(n=t,null==(o=i).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)),u=h.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>i.level?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&ls(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;e.length>=r;++r)t[r+10]=e.charCodeAt(r)}}(h,i),ls(h,u-8,e.d()),ls(h,u-4,r),h}var us=!!at||!!ot,ds="text/plain",vs=function(t,i,r){var s;void 0===r&&(r=!0);var[n,o]=t.split("?"),a=e({},i),l=null!==(s=null==o?void 0:o.split("&").map((t=>{var i,[e,s]=t.split("="),n=r&&null!==(i=a[e])&&void 0!==i?i:s;return delete a[e],e+"="+n})))&&void 0!==s?s:[],h=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return _e(t,(function(t,i){kt(t)||kt(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)})),s.join(i)}(a);return h&&l.push(h),n+"?"+l.join("&")},cs=(t,i)=>JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i),fs=t=>{if(t.zt)return t.zt;var{data:i,compression:e}=t;if(i){if(e===Rr){var r=hs(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Cr(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;e>o;++o){if(s+5>r.length){var a=new Cr(s+8+(e-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 Xr(r,0,s)}(cs(i)),{mtime:0});return{contentType:ds,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===Fr){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,i)=>String.fromCharCode(parseInt(i,16))))):t}(cs(i)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:cs(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=cs(i);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},ps=function(){var t=i((function*(t){var i=cs(t.data),r=yield function(t,i){return vt.apply(this,arguments)}(i,n.DEBUG);if(!r)return t;var s=yield r.arrayBuffer();return e({},t,{zt:{contentType:ds,body:s,estimatedSize:s.byteLength}})}));return function(i){return t.apply(this,arguments)}}(),gs=[];ot&&gs.push({transport:"fetch",method(t){var i,r,{contentType:s,body:n,estimatedSize:o}=null!==(i=fs(t))&&void 0!==i?i:{},a=new Headers;_e(t.headers,(function(t,i){a.append(i,t)})),s&&a.append("Content-Type",s);var l=t.url,h=null;if(lt){var u=new lt;h={signal:u.signal,timeout:setTimeout((()=>u.abort()),t.timeout)}}ot(l,e({method:(null==t?void 0:t.method)||"GET",headers:a,keepalive:"POST"===t.method&&52428.8>(o||0),body:n,signal:null==(r=h)?void 0:r.signal},t.fetchOptions)).then((i=>i.text().then((e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){fe.error(t)}null==t.callback||t.callback(r)})))).catch((i=>{fe.error(i),null==t.callback||t.callback({statusCode:0,error:i})})).finally((()=>h?clearTimeout(h.timeout):null))}}),at&&gs.push({transport:"XHR",method(t){var i,e=new at;e.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(i=fs(t))&&void 0!==i?i:{};_e(t.headers,(function(t,i){e.setRequestHeader(i,t)})),r&&e.setRequestHeader("Content-Type",r),t.timeout&&(e.timeout=t.timeout),t.disableXHRCredentials||(e.withCredentials=!0),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(s)}}),null!=rt&&rt.sendBeacon&&gs.push({transport:"sendBeacon",method(t){var i=vs(t.url,{beacon:"1"});try{var e,{contentType:r,body:s}=null!==(e=fs(t))&&void 0!==e?e:{};if(!s)return;var n=s instanceof Blob?s:new Blob([s],{type:r});rt.sendBeacon(i,n)}catch(t){}}});var _s=3e3;class ms{constructor(t,i){this.Ti=!0,this.Ai=[],this.Ei=Ht((null==i?void 0:i.flush_interval_ms)||_s,250,5e3,fe.createLogger("flush interval"),_s),this.Ri=t}enqueue(t){this.Ai.push(t),this.Ni||this.Mi()}unload(){this.Fi();var t=this.Ai.length>0?this.Oi():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Ri(e({},t,{transport:"sendBeacon"}))}))}enable(){this.Ti=!1,this.Mi()}Mi(){var t=this;this.Ti||(this.Ni=setTimeout((()=>{if(this.Fi(),this.Ai.length>0){var i=this.Oi(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&xt(e.data)&&_e(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Ri(e)};for(var r in i)e()}}),this.Ei))}Fi(){clearTimeout(this.Ni),this.Ni=void 0}Oi(){var t={};return _e(this.Ai,(i=>{var r,s=i,n=(s?s.batchKey:null)||s.url;kt(t[n])&&(t[n]=e({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this.Ai=[],t}}var bs=["retriesPerformedSoFar"];class ys{constructor(t){this.Pi=!1,this.Li=3e3,this.Ai=[],this._instance=t,this.Ai=[],this.Di=!0,!kt(it)&&"onLine"in it.navigator&&(this.Di=it.navigator.onLine,this.Bi=()=>{this.Di=!0,this.ji()},this.qi=()=>{this.Di=!1},$e(it,"online",this.Bi),$e(it,"offline",this.qi))}get length(){return this.Ai.length}retriableRequest(t){var{retriesPerformedSoFar:i}=t,s=r(t,bs);Ct(i)&&(s.url=vs(s.url,{retry_count:i})),this._instance._send_request(e({},s,{callback:t=>{200===t.statusCode||t.statusCode>=400&&500>t.statusCode||(null!=i?i:0)>=10?null==s.callback||s.callback(t):this.Zi(e({retriesPerformedSoFar:i},s))}}))}Zi(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=Math.random()-.5;return Math.ceil(r+s*(r-e))}(i),r=Date.now()+e;this.Ai.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),fe.warn(s),this.Pi||(this.Pi=!0,this.$i())}$i(){if(this.Hi&&clearTimeout(this.Hi),0===this.Ai.length)return this.Pi=!1,void(this.Hi=void 0);this.Hi=setTimeout((()=>{this.Di&&this.Ai.length>0&&this.ji(),this.$i()}),this.Li)}ji(){var t=Date.now(),i=[],e=this.Ai.filter((e=>t>e.retryAt||(i.push(e),!1)));if(this.Ai=i,e.length>0)for(var{requestOptions:r}of e)this.retriableRequest(r)}unload(){for(var{requestOptions:t}of(this.Hi&&(clearTimeout(this.Hi),this.Hi=void 0),this.Pi=!1,kt(it)||(this.Bi&&(it.removeEventListener("online",this.Bi),this.Bi=void 0),this.qi&&(it.removeEventListener("offline",this.qi),this.qi=void 0)),this.Ai))try{this._instance._send_request(e({},t,{transport:"sendBeacon"}))}catch(t){fe.error(t)}this.Ai=[]}}class ws{constructor(t){this.Vi=()=>{var t,i,e,r;this.zi||(this.zi={});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.zi.lastScrollY=Math.ceil(n),this.zi.maxScrollY=Math.max(n,null!==(t=this.zi.maxScrollY)&&void 0!==t?t:0),this.zi.maxScrollHeight=Math.max(o,null!==(i=this.zi.maxScrollHeight)&&void 0!==i?i:0),this.zi.lastContentY=a,this.zi.maxContentY=Math.max(a,null!==(e=this.zi.maxContentY)&&void 0!==e?e:0),this.zi.maxContentHeight=Math.max(l,null!==(r=this.zi.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get Yi(){return this._instance.config.scroll_root_selector}getContext(){return this.zi}resetContext(){var t=this.zi;return setTimeout(this.Vi,0),t}startMeasuringScrollPosition(){$e(it,"scroll",this.Vi,{capture:!0}),$e(it,"scrollend",this.Vi,{capture:!0}),$e(it,"resize",this.Vi)}scrollElement(){if(!this.Yi)return null==it?void 0:it.document.documentElement;var t=xt(this.Yi)?this.Yi:[this.Yi];for(var i of t){var e=null==it?void 0:it.document.querySelector(i);if(e)return e}}scrollY(){if(this.Yi){var t=this.scrollElement();return t&&t.scrollTop||0}return it&&(it.scrollY||it.pageYOffset||it.document.documentElement.scrollTop)||0}scrollX(){if(this.Yi){var t=this.scrollElement();return t&&t.scrollLeft||0}return it&&(it.scrollX||it.pageXOffset||it.document.documentElement.scrollLeft)||0}}var xs=t=>pr(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class Ss{constructor(t,i,e,r){this.Ui=t=>{var i=this.Wi();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Gi(this._instance)};this.Xi.register({[M]:e})}},this._instance=t,this.Ji=i,this.Xi=e,this.Gi=r||xs,this.Ji.onSessionId(this.Ui)}Wi(){return this.Xi.props[M]}getSetOnceProps(){var t,i=null==(t=this.Wi())?void 0:t.props;return i?"r"in i?gr(i):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return _e(xe(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+mt(e)]=i})),t}}class Es{constructor(){this.Ki={}}on(t,i){return this.Ki[t]||(this.Ki[t]=[]),this.Ki[t].push(i),()=>{this.Ki[t]=this.Ki[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.Ki[t]||[])e(i);for(var r of this.Ki["*"]||[])r(t,i)}}var $s=pe("[SessionId]");class ks{on(t,i){return this.Qi.on(t,i)}constructor(t,i,e){var r;if(this.tr=[],this.er=void 0,this.Qi=new Es,this.ir=(t,i)=>!(!Ct(t)||!Ct(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===W)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rt=t.config,this.Xi=t.persistence,this.rr=void 0,this.nr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.sr=i||Ce,this.ar=e||Ce;var s=this.Rt.persistence_name||this.Rt.token;if(this._sessionTimeoutMs=1e3*Ht(this.Rt.session_idle_timeout_seconds||1800,60,36e3,$s.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.lr(),this.ur="ph_"+s+"_window_id",this.hr="ph_"+s+"_primary_window_exists",this.cr()){var n=Be.Gt(this.ur),o=Be.Gt(this.hr);n&&!o?this.rr=n:Be.Jt(this.ur),Be.Xt(this.hr,!0)}if(null!=(r=this.Rt.bootstrap)&&r.sessionID)try{var a=(t=>{var i=this.Rt.bootstrap.sessionID.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})();this.dr(this.Rt.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){$s.error("Invalid sessionID in bootstrap",t)}this.vr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return kt(this.tr)&&(this.tr=[]),this.tr.push(t),this.nr&&t(this.nr,this.rr),()=>{this.tr=this.tr.filter((i=>i!==t))}}cr(){return"memory"!==this.Rt.persistence&&!this.Xi.fi&&Be.Yt()}pr(t){t!==this.rr&&(this.rr=t,this.cr()&&Be.Xt(this.ur,t))}gr(){return this.rr?this.rr:this.cr()?Be.Gt(this.ur):null}dr(t,i,e){t===this.nr&&i===this._sessionActivityTimestamp&&e===this._sessionStartTimestamp||(this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.nr=t,this.Xi.register({[y]:[i,t,e]}))}mr(){var t=this.Xi.props[y];return xt(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.dr(null,null,null)}destroy(){clearTimeout(this.yr),this.yr=void 0,this.er&&it&&(it.removeEventListener(Y,this.er,{capture:!1}),this.er=void 0),this.tr=[]}vr(){this.er=()=>{this.cr()&&Be.Jt(this.hr)},$e(it,Y,this.er,{capture:!1})}checkAndGetSessionAndWindowId(t,i){if(void 0===t&&(t=!1),void 0===i&&(i=null),this.Rt.cookieless_mode===W)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var e=i||(new Date).getTime(),[r,s,n]=this.mr(),o=this.gr(),a=Ct(n)&&Math.abs(e-n)>864e5,l=!1,h=!s,u=!h&&!t&&this.ir(e,r);h||u||a?(s=this.sr(),o=this.ar(),$s.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:h,activityTimeout:u,sessionPastMaximumLength:a}}),n=e,l=!0):o||(o=this.ar(),l=!0);var d=Ct(r)&&t&&!a?r:e,v=Ct(n)?n:(new Date).getTime();return this.pr(o),this.dr(s,d,v),t||this.lr(),l&&this.tr.forEach((t=>t(s,o,l?{noSessionId:h,activityTimeout:u,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:v,changeReason:l?{noSessionId:h,activityTimeout:u,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}lr(){clearTimeout(this.yr),this.yr=setTimeout((()=>{var[t]=this.mr();if(this.ir((new Date).getTime(),t)){var i=this.nr;this.resetSessionId(),this.Qi.emit("forcedIdleReset",{idleSessionId:i})}}),1.1*this.sessionTimeoutMs)}}var Ps=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&pt(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>pt(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver},Is=function(t,i){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}};function Ts(t,i,e){return cs({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var Rs={exact:(t,i)=>i.some((i=>t.some((t=>i===t)))),is_not:(t,i)=>i.every((i=>t.every((t=>i!==t)))),regex:(t,i)=>i.some((i=>t.some((t=>Is(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!Is(i,t))))),icontains:(t,i)=>i.map(Fs).some((i=>t.map(Fs).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(Fs).every((i=>t.map(Fs).every((t=>!i.includes(t))))),gt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e>parseFloat(t)))})),lt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e<parseFloat(t)))}))},Fs=t=>t.toLowerCase();function Cs(t,i){return!t||Object.entries(t).every((t=>{var[e,r]=t,s=null==i?void 0:i[e];if(kt(s)||Tt(s))return!1;var n=[String(s)],o=Rs[r.operator];return!!o&&o(r.values,n)}))}var Os="custom",Ms="i.posthog.com";class As{constructor(t){this.br={},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,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+Ms,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.br[this.apiHost]||(this.br[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":Os),this.br[this.apiHost]}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.uiHost+i;if("flags"===t)return this.flagsApiHost+i;if(this.region===Os)return this.apiHost+i;var e=Ms+i;switch(t){case"assets":return"https://"+this.region+"-assets."+e;case"api":return"https://"+this.region+"."+e}}}var Ds=pe("[Surveys]"),js="seenSurvey_",Ls=(t,i)=>{var e="$survey_"+i+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(e="$survey_"+i+"/"+t.id+"/"+t.current_iteration),e},zs=t=>((t,i)=>{var e=""+t+i.id;return i.current_iteration&&i.current_iteration>0&&(e=""+t+i.id+"_"+i.current_iteration),e})(js,t),Us=["popover","widget","api"],Ns={ignoreConditions:!1,ignoreDelay:!1,displayType:$r},Hs=pe("[PostHog ExternalIntegrations]"),Bs={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class qs{constructor(t){this._instance=t}ni(t,i){var e;null==(e=dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return Hs.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(i){var e,s,n;!r||null!=(e=dt.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[i]||t.ni(Bs[i],(()=>{var e;null==(e=dt.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[i])||e.start(t._instance)})),!r&&null!=(s=dt.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[i]&&(null==(n=dt.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[i])||n.stop())};for(var[e,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;i(e)}}}var Ws={},Vs=0,Gs=()=>{},Js='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Ks="Surveys module not available",Ys="sanitize_properties is deprecated. Use before_send instead",Xs="Invalid value for property_denylist config: ",Qs="posthog",Zs=!us&&-1===(null==ut?void 0:ut.indexOf("MSIE"))&&-1===(null==ut?void 0:ut.indexOf("Mozilla")),tn=t=>{var i;return e({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Ee(null==st?void 0:st.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Gs,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,debug:nt&&Pt(null==nt?void 0:nt.search)&&-1!==nt.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==it||null==(i=it.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){fe.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:J,before_send:void 0,request_queue_config:{flush_interval_ms:_s},error_tracking:{},_onCapture:Gs,__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}))(t))},en=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],rn=t=>{var i={};for(var[e,r]of en)kt(t[e])||(i[r]=t[e]);var s=me({},i,t);return xt(t.property_blacklist)&&(kt(t.property_denylist)?s.property_denylist=t.property_blacklist:xt(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:fe.error(Xs+t.property_denylist)),s};class sn{constructor(){this.__forceAllowLocalhost=!1}get wr(){return this.__forceAllowLocalhost}set wr(t){fe.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class nn{_r(t,i){if(t){var e=this.Ir.indexOf(t);-1!==e&&this.Ir.splice(e,1)}return this.Ir.push(i),null==i.initialize||i.initialize(),i}get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new sn,this.Cr=!1,this.version=n.LIB_VERSION,this.Sr=new Es,this.Ir=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=tn(),this.SentryIntegration=Qe,this.sentryIntegration=t=>function(t,i){var e=Xe(t,i);return{name:Ye,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.kr=!1,this.Tr=null,this.Ar=null,this.Er=null,this.scrollManager=new ws(this),this.pageViewManager=new Ze(this),this.rateLimiter=new Pr(this),this.requestRouter=new As(this),this.consent=new qe(this),this.externalIntegrations=new qs(this);var i=null!==(t=nn.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,i,e)=>{var r=Pt(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=Pt(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>fe.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==Qs){var r,s=null!==(r=Ws[e])&&void 0!==r?r:new nn;return s._init(t,i,e),Ws[e]=s,Ws[Qs][e]=s,s}return this._init(t,i,e)}_init(t,i,r){var s,o;if(void 0===i&&(i={}),kt(t)||It(t))return fe.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.Rr(i.debug),this.Nr=i,this.Mr=[],i.person_profiles?this.Ar=i.person_profiles:i.process_person&&(this.Ar=i.process_person),this.set_config(me({},tn(i.defaults),rn(i),{name:r,token:t})),this.config.on_xhr_error&&fe.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Rr;var a=this.Fr();this.persistence=new yr(this.config,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new yr(e({},this.config,{persistence:"sessionStorage"}),a);var l=e({},this.persistence.props),h=e({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Or=new ms((t=>this.Pr(t)),this.config.request_queue_config),this.Lr=new ys(this),this.__request_queue=[];var u=this.config.cookieless_mode===W||this.config.cookieless_mode===q&&this.consent.isExplicitlyOptedOut();if(u||(this.sessionManager=new ks(this),this.sessionPropsManager=new Ss(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(fe.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Dr(u)}),0)):(fe.info("Initializing extensions synchronously"),this.Dr(u)),n.DEBUG=n.DEBUG||this.config.debug,n.DEBUG&&fe.info("Starting in debug mode",{this:this,config:i,thisC:e({},this.config),p:l,s:h}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=e({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=i.bootstrap)?void 0:o.distinctID)){var d=i.bootstrap.distinctID,v=this.get_distinct_id(),c=this.persistence.get_property(O);if(i.bootstrap.isIdentifiedID&&null!=v&&v!==d&&c===V)this.identify(d);else if(i.bootstrap.isIdentifiedID&&null!=v&&v!==d&&c===G)fe.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 f=this.config.get_device_id(Ce()),p=i.bootstrap.isIdentifiedID?f:d;this.persistence.set_property(O,i.bootstrap.isIdentifiedID?G:V),this.register({distinct_id:d,$device_id:p})}}if(u)this.register_once({distinct_id:N,$device_id:null},"");else if(!this.get_distinct_id()){var g=this.config.get_device_id(Ce());this.register_once({distinct_id:g,$device_id:g},""),this.persistence.set_property(O,V)}return $e(it,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?function(t,i){var e=t.config.segment;if(!e)return i();!function(t,i){var e=t.config.segment;if(!e)return i();var r=e=>{var r=()=>e.anonymousId()||Ce();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(O,G)),i()},s=e.user();"then"in s&&St(s.then)?s.then(r):r(s)}(t,(()=>{e.register((t=>{Promise&&Promise.resolve||Ke.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,e)=>{if(!e)return i;i.event.userId||i.event.anonymousId===t.get_distinct_id()||(Ke.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(Ke.info("UserId set, identifying with PostHog"),t.identify(i.event.userId));var r=t.calculateEventProperties(e,i.event.properties);return i.event.properties=Object.assign({},r,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>i(t,t.event.event),page:t=>i(t,X),identify:t=>i(t,Z),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}(this,(()=>this.Br())):this.Br(),St(this.config._onCapture)&&this.config._onCapture!==Gs&&(fe.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&fe.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}Dr(t){var i,r,s,n,o,a,l,h=performance.now(),u=e({},nn.__defaultExtensionClasses,this.config.__extensionClasses),d=[];u.featureFlags&&this.Ir.push(this.featureFlags=null!==(i=this.featureFlags)&&void 0!==i?i:new u.featureFlags(this)),u.exceptions&&this.Ir.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new u.exceptions(this)),u.historyAutocapture&&this.Ir.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.Ir.push(new u.tracingHeaders(this)),u.siteApps&&this.Ir.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.Ir.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.Ir.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.Ir.push(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new u.surveys(this)),u.logs&&this.Ir.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new u.logs(this)),u.conversations&&this.Ir.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new u.conversations(this)),u.productTours&&this.Ir.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.Ir.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.Ir.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.Ir.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.Ir.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Ge)),u.toolbar&&this.Ir.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new u.toolbar(this)),u.experiments&&this.Ir.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new u.experiments(this)),this.Ir.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.jr){var t=this.jr;this.jr=void 0,this.Ci(t)}})),this.qr(d,h)}qr(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.qr(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){fe.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:r}),this.config.__preview_deferred_init_extensions&&fe.info("PostHog extensions initialized ("+r+"ms)")}Ci(t){var i;if(!st||!st.body)return fe.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Ci(t)}),500);this.config.__preview_deferred_init_extensions&&(this.jr=t),this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=gt(t.supportedCompression,Rr)?Rr:gt(t.supportedCompression,Fr)?Fr:void 0),null!=(i=t.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Ar?this.Ar:J}),this.Ir.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}Br(){try{this.config.loaded(this)}catch(t){fe.critical("`loaded` function failed",t)}if(this.Zr(),this.config.internal_or_test_user_hostname&&null!=nt&&nt.hostname){var t=nt.hostname,i=this.config.internal_or_test_user_hostname;("string"==typeof i?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode===W)&&this.$r()}),1),this.Hr=new Tr(this),this.Hr.load()}Zr(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Or)||t.enable())}_dom_loaded(){this.is_capturing()&&ge(this.__request_queue,(t=>this.Pr(t))),this.__request_queue=[],this.Zr()}_handle_unload(){var t,i,e;null==(t=this.surveys)||t.handlePageUnload(),this.config.request_batching?(this.Vr()&&this.capture(Q),null==(i=this.Or)||i.unload(),null==(e=this.Lr)||e.unload()):this.Vr()&&this.capture(Q,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(Zs?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=vs(t.url,{ip:this.config.ip?1:0}),t.headers=e({},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 i,r,s,o=e({},t);o.timeout=o.timeout||6e4,o.url=vs(o.url,{_:(new Date).getTime().toString(),ver:n.JS_SDK_VERSION,compression:o.compression});var a=null!==(i=o.transport)&&void 0!==i?i:"fetch",l=gs.filter((t=>!o.disableTransport||!t.transport||!o.disableTransport.includes(t.transport))),h=null!==(r=null==(s=function(t,i){for(var e=0;t.length>e;e++)if(t[e].transport===a)return t[e]}(l))?void 0:s.method)&&void 0!==r?r:l[0].method;if(!h)throw new Error("No available transport method");"sendBeacon"!==a&&o.data&&o.compression===Rr&&ht?ps(o).then((t=>{h(t)})).catch((()=>{h(o)})):h(o)})(e({},t,{callback:i=>{var e,r;this.rateLimiter.checkForLimiting(i),400>i.statusCode||null==(e=(r=this.config).on_request_error)||e.call(r,i),null==t.callback||t.callback(i)}}))))}Pr(t){this.Lr?this.Lr.retriableRequest(t):this._send_request(t)}_execute_array(t){Vs++;try{var i,e=[],r=[],s=[];ge(t,(t=>{t&&(xt(i=t[0])?s.push(t):St(t)?t.call(this):xt(t)&&"alias"===i?e.push(t):xt(t)&&-1!==i.indexOf("capture")&&St(this[i])?s.push(t):r.push(t))}));var n=function(t,i){ge(t,(function(t){if(xt(t[0])){var e=i;_e(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else i[t[0]].apply(i,t.slice(1))}))};n(e,this),n(r,this),n(s,this)}finally{Vs--}}push(t){if(Vs>0&&xt(t)&&Pt(t[0])){var i=nn.prototype[t[0]];St(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,i,r){var s,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Or){if(this.is_capturing())if(!kt(t)&&Pt(t)){var h=!this.config.opt_out_useragent_filter&&this._is_bot();if(!h||this.config.__preview_capture_bot_pageviews){var u=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=i&&i.$current_url&&!Pt(null==i?void 0:i.$current_url)&&(fe.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||null!=r&&r.zr||fe.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 d=new Date,v=(null==r?void 0:r.timestamp)||d,c=Ce(),f={uuid:c,event:t,properties:this.calculateEventProperties(t,i||{},v,c)};t===X&&this.config.__preview_capture_bot_pageviews&&h&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),u&&(f.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==r?void 0:r.$set)&&(f.$set=null==r?void 0:r.$set);var p,g=this.Yr(null==r?void 0:r.$set_once,t!==tt,t===Z);if(g&&(f.$set_once=g),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,o=f,a=t=>Pt(t)?t.slice(0,n):t,l=new Set,f=function t(i,e){return i!==Object(i)?a?a(i):i:l.has(i)?void 0:(l.add(i),xt(i)?(r=[],ge(i,(i=>{r.push(t(i))}))):(r={},_e(i,((i,e)=>{l.has(i)||(r[e]=t(i,e))}))),r);var r}(o)),f.timestamp=v,kt(null==r?void 0:r.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=d),"survey dismissed"===t||t===Er){var _=null==i?void 0:i.$survey_id,m=null==i?void 0:i.$survey_iteration;p={id:_,current_iteration:m},localStorage.getItem(zs(p))||localStorage.setItem(zs(p),"true"),f.$set=e({},f.$set,{[Ls({id:_,current_iteration:m},t===Er?"responded":"dismissed")]:!0})}else t===Sr&&(f.$set=e({},f.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===t){var b=null==i?void 0:i.$product_tour_type;b&&(f.$set=e({},f.$set,{["$product_tour_last_seen_date/"+b]:(new Date).toISOString()}))}var y=e({},f.properties.$set,f.$set);if($t(y)||this.setPersonPropertiesForFlags(y),!Rt(this.config.before_send)){var w=this.Ur(f);if(!w)return;f=w}this.Sr.emit("eventCaptured",f);var x={method:"POST",url:null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:f,compression:"best-available",batchKey:null==r?void 0:r._batchKey};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this.Pr(x):this.Or.enqueue(x),f}fe.critical("This capture call is ignored due to client rate limiting.")}}else fe.error("No event name provided to posthog.capture")}else fe.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(i=>t(i.event,i)))}calculateEventProperties(t,i,r,s,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;var a=o?void 0:this.persistence.remove_event_timer(t),l=e({},i);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,(this.config.cookieless_mode==W||this.config.cookieless_mode==q&&this.consent.isExplicitlyOptedOut())&&(l.$cookieless_mode=!0),"$snapshot"===t){var h=e({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=h.distinct_id,(!Pt(l.distinct_id)&&!Ft(l.distinct_id)||It(l.distinct_id))&&fe.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,d=function(t,i){var e,r,s,o;if(!ut)return{};var a,l,h,u,d,v,c,f,p=t?[...nr,...i||[]]:[],[g,_]=function(t){for(var i=0;Ui.length>i;i++){var[e,r]=Ui[i],s=e.exec(t),n=s&&(St(r)?r(s,t):r);if(n)return n}return["",""]}(ut);return me(xe({$os:g,$os_version:_,$browser:ji(ut,navigator.vendor),$device:Ni(ut),$device_type:(l=ut,h={userAgentDataPlatform:null==(e=navigator)||null==(e=e.userAgentData)?void 0:e.platform,maxTouchPoints:null==(r=navigator)?void 0:r.maxTouchPoints,screenWidth:null==it||null==(s=it.screen)?void 0:s.width,screenHeight:null==it||null==(o=it.screen)?void 0:o.height,devicePixelRatio:null==it?void 0:it.devicePixelRatio},f=Ni(l),f===Qt||f===Xt||"Kobo"===f||"Kindle Fire"===f||f===Ii?Yt:f===_i||f===bi||f===mi||f===$i?"Console":f===ti?"Wearable":f?Gt:"Android"===(null==h?void 0:h.userAgentDataPlatform)&&(null!==(u=null==h?void 0:h.maxTouchPoints)&&void 0!==u?u:0)>0?600>Math.min(null!==(d=null==h?void 0:h.screenWidth)&&void 0!==d?d:0,null!==(v=null==h?void 0:h.screenHeight)&&void 0!==v?v:0)/(null!==(c=null==h?void 0:h.devicePixelRatio)&&void 0!==c?c:1)?Gt:Yt:"Desktop"),$timezone:_r(),$timezone_offset:mr()}),{$current_url:er(null==nt?void 0:nt.href,p,ar),$host:null==nt?void 0:nt.host,$pathname:null==nt?void 0:nt.pathname,$raw_user_agent:ut.length>1e3?ut.substring(0,997)+"...":ut,$browser_version:zi(ut,navigator.vendor),$browser_language:vr(),$browser_language_prefix:(a=vr(),"string"==typeof a?a.split("-")[0]:void 0),$screen_height:null==it?void 0:it.screen.height,$screen_width:null==it?void 0:it.screen.width,$viewport_height:null==it?void 0:it.innerHeight,$viewport_width:null==it?void 0:it.innerWidth,$lib:n.LIB_NAME,$lib_version:n.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:v,windowId:c}=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime());l.$session_id=v,l.$window_id=c}this.sessionPropsManager&&me(l,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&me(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(f=this.Lr)?void 0:f.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Os&&(l.$lib_custom_api_host=this.config.api_host),u=t!==X||o?t!==Q||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),l=me(l,u),t===X&&st&&(l.title=st.title),!kt(a)){var p=r.getTime()-a;l.$duration=parseFloat((p/1e3).toFixed(3))}ut&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=me({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),xt(this.config.property_denylist)?_e(this.config.property_denylist,(function(t){delete l[t]})):fe.error(Xs+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(fe.error(Ys),l=g(l,t));var _=this.Wr();return l.$process_person_profile=_,_&&!o&&this.Gr("_calculate_event_properties"),l}Yr(t,i,e){var r;if(void 0===i&&(i=!0),void 0===e&&(e=!1),!this.persistence||!this.Wr())return t;if(this.Cr&&!e)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=me({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(fe.error(Ys),o=a(o,"$set_once")),i&&(this.Cr=!0),$t(o)?void 0:o}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i;null==(i=this.sessionPersistence)||i.register(t)}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t)}Xr(t,i){this.register({[t]:i})}getFeatureFlag(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagResult(t,i)}isFeatureEnabled(t,i){var e;return null==(e=this.featureFlags)?void 0:e.isFeatureEnabled(t,i)}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,i,e){var r;null==(r=this.featureFlags)||r.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){var r;return void 0===i&&(i=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.Sr.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Ks}),()=>{})}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:Ks})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Ks})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=Ns),null==(e=this.surveys)||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null==(i=this.surveys)||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null==(e=this.surveys)?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:Ks}}canRenderSurveyAsync(t,i){var e,r;return void 0===i&&(i=!1),null!==(e=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:Ks})}Jr(t){return!t||It(t)?(fe.critical("Unique user id has not been set in posthog.identify"),!1):t===N?(fe.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())||(fe.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,i,e){if(!this.__loaded||!this.persistence)return fe.uninitializedWarning("posthog.identify");if(Ft(t)&&(t=t.toString(),fe.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Jr(t)&&this.Gr("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:t}),this.get_property(a)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),t!==r&&t!==this.get_property(l)&&(this.unregister(l),this.register({distinct_id:t}));var s,n=(this.persistence.get_property(O)||V)===V;t!==r&&n?(this.persistence.set_property(O,G),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.capture(Z,{distinct_id:t,$anon_distinct_id:r},{$set:i||{},$set_once:e||{}}),this.Er=Ts(t,i,e),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(i||e)&&this.setPersonProperties(i,e),t!==r&&(this.reloadFeatureFlags(),this.unregister(T))}}setPersonProperties(t,i){if((t||i)&&this.Gr("posthog.setPersonProperties")){var e=Ts(this.get_distinct_id(),t,i);this.Er!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Er=e):fe.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,i,r){if(t&&i){var s=this.getGroups(),n=s[t]!==i;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:e({},s,{[t]:i})}),n||r){var o={$group_type:t,$group_key:i};r&&(o.$group_set=r),this.capture(tt,o)}r&&this.setGroupPropertiesForFlags({[t]:r}),n&&!r&&this.reloadFeatureFlags()}else fe.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),null==(e=this.featureFlags)||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(){var t;null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),this.Gr("posthog.setGroupPropertiesForFlags")&&(null==(e=this.featureFlags)||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null==(i=this.featureFlags)||i.resetGroupPropertiesForFlags(t)}reset(t){var i,e,r,s,n,o,l,h;if(fe.info("reset"),!this.__loaded)return fe.uninitializedWarning("posthog.reset");var u=this.get_property(a);if(this.consent.reset(),null==(i=this.persistence)||i.clear(),null==(e=this.sessionPersistence)||e.clear(),null==(r=this.surveys)||r.reset(),null==(s=this.Hr)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(l=this.persistence)||l.set_property(O,V),null==(h=this.sessionManager)||h.resetSessionId(),this.Er=null,this.config.cookieless_mode===W)this.register_once({distinct_id:N,$device_id:null},"");else{var d=this.config.get_device_id(Ce());this.register_once({distinct_id:d,$device_id:t?d: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,i){var e;this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),null==(e=this.conversations)||e.Kr()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.Qr()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:i,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property(o)?(fe.critical("Attempting to create alias for existing People user - aborting."),-2):this.Gr("posthog.alias")?(kt(i)&&(i=this.get_distinct_id()),t!==i?(this.Xr(l,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(fe.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=e({},this.config);if(Et(t)){var r,s,o,a,l,h,u,d,v;me(this.config,rn(t));var c=this.Fr();null==(r=this.persistence)||r.update_config(this.config,i,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new yr(e({},this.config,{persistence:"sessionStorage"}),c);var f=this.Rr(this.config.debug);Ot(f)&&(this.config.debug=f),Ot(this.config.debug)&&(this.config.debug?(n.DEBUG=!0,Le.Yt()&&Le.Xt("ph_debug",!0),fe.info("set_config",{config:t,oldConfig:i,newConfig:e({},this.config)})):(n.DEBUG=!1,Le.Yt()&&Le.Jt("ph_debug"))),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.autocapture)||a.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),null==(h=this.exceptionObserver)||h.startIfEnabledOrStop(),null==(u=this.deadClicksAutocapture)||u.startIfEnabledOrStop(),null==(d=this.surveys)||d.loadIfEnabled(),this.tn(),null==(v=this.externalIntegrations)||v.startIfEnabledOrStop()}}_overrideSDKInfo(t,i){n.LIB_NAME=t,n.LIB_VERSION=i}startSessionRecording(t){var i,e,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==(i=this.sessionManager)||i.checkAndGetSessionAndWindowId(),a.sampling&&(null==(e=this.sessionRecording)||e.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,i){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(e({},s,i))}}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null==(e=this.toolbar)?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:Qs;return i!==Qs&&(i=Qs+"."+i),i}_isIdentified(){var t,i;return(null==(t=this.persistence)?void 0:t.get_property(O))===G||(null==(i=this.sessionPersistence)?void 0:i.get_property(O))===G}Wr(){var t,i;return!("never"===this.config.person_profiles||this.config.person_profiles===J&&!this._isIdentified()&&$t(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[l])&&(null==(i=this.persistence)||null==(i=i.props)||!i[z]))}Vr(){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.Wr()||this.Gr("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Gr("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Gr(t){return"never"===this.config.person_profiles?(fe.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Xr(z,!0),!0)}Fr(){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!==q)}tn(){var t,i,e,r,s=this.Fr();return(null==(t=this.persistence)?void 0:t.fi)!==s&&(null==(e=this.persistence)||e.set_disabled(s)),(null==(i=this.sessionPersistence)?void 0:i.fi)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==W){if(this.config.cookieless_mode===q&&this.consent.isExplicitlyOptedOut()){var e,r,s,n,o;this.reset(!0),null==(e=this.sessionManager)||e.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new ks(this),this.pageViewManager=new Ze(this),this.persistence&&(this.sessionPropsManager=new Ss(this,this.sessionManager,this.persistence));var a=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=nn.__defaultExtensionClasses)?void 0:o.sessionRecording;a&&(this.sessionRecording=this._r(this.sessionRecording,new a(this)))}var l,h;this.consent.optInOut(!0),this.tn(),this.Zr(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),this.config.cookieless_mode==q&&(null==(l=this.surveys)||l.loadIfEnabled()),(kt(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.$r()}else fe.warn(Js)}opt_out_capturing(){var t,i,e;this.config.cookieless_mode!==W?(this.config.cookieless_mode===q&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.tn(),this.config.cookieless_mode===q&&(this.register({distinct_id:N,$device_id:null}),null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,this.$r())):fe.warn(Js)}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===W||(this.config.cookieless_mode===q?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.tn()}_is_bot(){return rt?Ps(rt,this.config.custom_blocked_useragents):void 0}$r(){st&&("visible"===st.visibilityState?this.kr||(this.kr=!0,this.capture(X,{title:st.title},{send_instantly:!0}),this.Tr&&(st.removeEventListener(K,this.Tr),this.Tr=null)):this.Tr||(this.Tr=this.$r.bind(this),$e(st,K,this.Tr)))}debug(t){!1===t?(null==it||it.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==it||it.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}))}ki(){var t,i,e,r,s,n,o=this.Nr||{};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?(fe.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):(e="advanced_disable_decide",!1,r=fe,s=(i="advanced_disable_flags")in(t=o)&&!Rt(t[i]),n=e in t&&!Rt(t[e]),s?t[i]:!!n&&(r&&r.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e]))}Ur(t){if(Rt(this.config.before_send))return t;var i=xt(this.config.before_send)?this.config.before_send:[this.config.before_send],e=t;for(var r of i){if(e=r(e),Rt(e)){var s="Event '"+t.event+"' was rejected in beforeSend function";return At(t.event)?fe.warn(s+". This can cause unexpected behavior."):fe.info(s),null}e.properties&&!$t(e.properties)||fe.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return e}getPageViewId(){var t;return null==(t=this.pageViewManager.ai)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}Rr(t){var i=Ot(t)&&!t,e=Le.Yt()&&"true"===Le.Wt("ph_debug");return!i&&(!!e||t)}}function on(t){return t instanceof Element&&(t.id===U||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function an(t){return!!t&&1===t.nodeType}function ln(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function hn(t){return!!t&&3===t.nodeType}function un(t){return!!t&&11===t.nodeType}function dn(t){return t?_t(t).split(/\s+/):[]}function vn(t){var i=null==it?void 0:it.location.href;return!!(i&&t&&t.some((t=>i.match(t))))}function cn(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return dn(i)}function fn(t){return Rt(t)?null:_t(t).split(/(\s+)/).filter((t=>Cn(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function pn(t){var i="";return En(t)&&!$n(t)&&t.childNodes&&t.childNodes.length&&_e(t.childNodes,(function(t){var e;hn(t)&&t.textContent&&(i+=null!==(e=fn(t.textContent))&&void 0!==e?e:"")})),_t(i)}function gn(t){return kt(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null;var i}nn.__defaultExtensionClasses={},function(t,i){for(var e=0;i.length>e;e++)t.prototype[i[e]]=we(t.prototype[i[e]])}(nn,["identify"]);var _n=["a","button","form","input","select","textarea","label"];function mn(t,i){if(kt(i))return!0;var e,r=function(t){if(i.some((i=>t.matches(i))))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function bn(t){var i=t.parentNode;return!(!i||!an(i))&&i}var yn=["next","previous","prev",">","<"],wn=[".ph-no-rageclick",".ph-no-capture"];var xn=t=>!t||ln(t,"html")||!an(t),Sn=(t,i)=>{if(!it||xn(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var e=!1,r=[t],s=t;s.parentNode&&!ln(s,"body");)if(un(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=bn(s);if(!n)break;if(i||_n.indexOf(n.tagName.toLowerCase())>-1)e=!0;else{var o=it.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(e=!0)}r.push(n),s=n}return{parentIsUsefulElement:e,targetElementList:r}};function En(t){for(var i=t;i.parentNode&&!ln(i,"body");i=i.parentNode){var e=cn(i);if(gt(e,"ph-sensitive")||gt(e,"ph-no-capture"))return!1}if(gt(cn(t),"ph-include"))return!0;var r=t.type||"";if(Pt(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!Pt(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 $n(t){return!!(ln(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||ln(t,"select")||ln(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var kn="(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})",Pn=new RegExp("^(?:"+kn+")$"),In=new RegExp(kn),Tn="\\d{3}-?\\d{2}-?\\d{4}",Rn=new RegExp("^("+Tn+")$"),Fn=new RegExp("("+Tn+")");function Cn(t,i){if(void 0===i&&(i=!0),Rt(t))return!1;if(Pt(t)){if(t=_t(t),(i?Pn:In).test((t||"").replace(/[- ]/g,"")))return!1;if((i?Rn:Fn).test(t))return!1}return!0}function On(t){var i=pn(t);return Cn(i=(i+" "+Mn(t)).trim())?i:""}function Mn(t){var i="";return t&&t.childNodes&&t.childNodes.length&&_e(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=pn(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+Mn(t)).trim())}catch(t){fe.error("[AutoCapture]",t)}})),i}function An(t){return t.replace(/"|\\"/g,'\\"')}function Dn(t){var i=t.attr__class;return i?xt(i)?i:dn(i):void 0}class jn{constructor(t){this.disabled=!1===t;var i=Et(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<this.thresholdPx&&this.timeoutMs>e-r.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}}var Ln="$copy_autocapture",zn=pe("[AutoCapture]");function Un(t,i){return i.length>t?i.slice(0,t)+"...":i}function Nn(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!an(i));return i}function Hn(t,i){for(var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:h}=i,u=[t],d=t;d.parentNode&&!ln(d,"body");)un(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var v,c,f=[],p={},g=!1,_=!1;if(_e(u,(t=>{var i=En(t);"a"===t.tagName.toLowerCase()&&(g=t.getAttribute("href"),g=i&&g&&Cn(g)&&g),gt(cn(t),"ph-no-capture")&&(_=!0),f.push(function(t,i,e,r){var s=t.tagName.toLowerCase(),n={tag_name:s};_n.indexOf(s)>-1&&!e&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?Un(1024,On(t)):Un(1024,pn(t)));var o=cn(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),_e(t.attributes,(function(e){var s;if((!$n(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&Cn(e.value)&&(!Pt(s=e.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=e.value;"class"===e.name&&(o=dn(o).join(" ")),n["attr__"+e.name]=Un(1024,o)}}));for(var a=1,l=1,h=t;h=Nn(h);)a++,h.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(t,o,a,l));var e=function(t){if(!En(t))return{};var i={};return _e(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&Cn(r)&&(i[e]=r)}})),i}(t);me(p,e)})),_)return{props:{},explicitNoCapture:_};if(a||(f[0].$el_text="a"===t.tagName.toLowerCase()||"button"===t.tagName.toLowerCase()?On(t):pn(t)),g){var m,b;f[0].attr__href=g;var y=null==(m=tr(g))?void 0:m.host,w=null==it||null==(b=it.location)?void 0:b.host;y&&w&&y!==w&&(v=g)}return{props:me({$event_type:n.type,$ce_version:1},h?{}:{$elements:f},{$elements_chain:(c=f,function(t){return t.map((t=>{var i,r,s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))s+="."+n.replace(/"/g,"");var o=e({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(r=t.nth_of_type)&&void 0!==r?r:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),a={};return be(o).sort(((t,i)=>{var[e]=t,[r]=i;return e.localeCompare(r)})).forEach((t=>{var[i,e]=t;return a[An(i.toString())]=An(e.toString())})),(s+=":")+be(a).map((t=>{var[i,e]=t;return i+'="'+e+'"'})).join("")})).join(";")}(function(t){return t.map((t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:Dn(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return be(t).filter((t=>{var[i]=t;return 0===i.indexOf("attr__")})).forEach((t=>{var[i,e]=t;return r.attributes[i]=e})),r}))}(c)))},null!=(r=f[0])&&r.$el_text?{$el_text:null==(s=f[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},p)}}var Bn=pe("[ExceptionAutocapture]");function qn(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],s=e(r);return St(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[i]=s,()=>{t[i]=r}}catch(t){return()=>{}}}var Wn=pe("[TracingHeaders]"),Vn=pe("[Web Vitals]"),Gn=9e5,Jn="disabled",Kn="lazy_loading",Yn="awaiting_config",Xn="missing_config";pe("[SessionRecording]");var Qn="[SessionRecording]",Zn=pe(Qn),to=pe("[Heatmaps]");function io(t){return Et(t)&&"clientX"in t&&"clientY"in t&&Ft(t.clientX)&&Ft(t.clientY)}var eo=pe("[Product Tours]"),ro="ph_product_tours",so=["$set_once","$set"],no=pe("[SiteApps]"),oo="Error while initializing PostHog app with config id ";function ao(t,i,e){if(Rt(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}class lo{constructor(t){this.en=new Es,this.rn=(t,i)=>this.nn(t,i)&&this.sn(t,i)&&this.an(t,i)&&this.ln(t,i),this.nn=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t,this.un=new Set,this.hn=new Set}init(){var t,i;kt(null==(t=this._instance)?void 0:t._addCaptureHook)||(null==(i=this._instance)||i._addCaptureHook(((t,i)=>{this.on(t,i)})))}register(t){var i,e;if(!kt(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach((t=>{var i,e;null==(i=this.hn)||i.add(t),null==(e=t.steps)||e.forEach((t=>{var i;null==(i=this.un)||i.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r,s=new Set;t.forEach((t=>{var i;null==(i=t.steps)||i.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,i){var e;null!=i&&0!=t.length&&(this.un.has(t)||this.un.has(null==i?void 0:i.event))&&this.hn&&(null==(e=this.hn)?void 0:e.size)>0&&this.hn.forEach((t=>{this.cn(i,t)&&this.en.emit("actionCaptured",t.name)}))}dn(t){this.onAction("actionCaptured",(i=>t(i)))}cn(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.rn(t,e))return!0;return!1}onAction(t,i){return this.en.on(t,i)}sn(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!ao(r,i.url,i.url_matching||"contains"))return!1}return!0}an(t,i){return!!this.vn(t,i)&&!!this.fn(t,i)&&!!this.pn(t,i)}vn(t,i){var e;if(null==i||!i.href)return!0;var r=this.gn(t);if(r.length>0)return r.some((t=>ao(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&ao((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}fn(t,i){var e;if(null==i||!i.text)return!0;var r=this.gn(t);if(r.length>0)return r.some((t=>ao(t.text,i.text,i.text_matching||"exact")||ao(t.$el_text,i.text,i.text_matching||"exact")));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!Rt(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some((t=>ao(t,n,o))))}pn(t,i){var e,r;if(null==i||!i.selector)return!0;var s=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(null!=s&&s.includes(i.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&n)try{return new RegExp(i.selector_regex).test(n)}catch(t){return!1}return!1}gn(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}ln(t,i){return null==i||!i.properties||0===i.properties.length||Cs(i.properties.reduce(((t,i)=>{var e=xt(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class ho{constructor(t){this._instance=t,this.mn=new Map,this.yn=new Map,this.bn=new Map}wn(t,i){return!!t&&Cs(t.propertyFilters,null==i?void 0:i.properties)}_n(t,i){var e=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach((i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}}))})),e}In(t,i,e){var r=(e===wr?this.mn:this.yn).get(t),s=[];return this.Cn((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[e])||null==(s=s.values)?void 0:s.find((i=>i.name===t));return this.wn(n,i)}))}register(t){var i;kt(null==(i=this._instance)?void 0:i._addCaptureHook)||(this.Sn(t),this.kn(t))}kn(t){var i=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.actions)&&(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)?void 0:e.length)>0}));0!==i.length&&(null==this.xn&&(this.xn=new lo(this._instance),this.xn.init(),this.xn.dn((t=>{this.onAction(t)}))),i.forEach((t=>{var i,e,r,s,n;t.conditions&&null!=(i=t.conditions)&&i.actions&&null!=(e=t.conditions)&&null!=(e=e.actions)&&e.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.xn)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((i=>{if(i&&i.name){var e=this.bn.get(i.name);e&&e.push(t.id),this.bn.set(i.name,e||[t.id])}})))})))}Sn(t){var i,e=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0})),r=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0}));0===e.length&&0===r.length||(null==(i=this._instance)||i._addCaptureHook(((t,i)=>{this.onEvent(t,i)})),this.mn=this._n(t,wr),this.yn=this._n(t,xr))}onEvent(t,i){var e,r=this.re(),s=this.Tn(),n=this.An(),o=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[s])||[];if(n===t&&i&&o.length>0){var a,l;r.info("event matched, removing item from activated items",{event:t,eventPayload:i,existingActivatedItems:o});var h=(null==i||null==(a=i.properties)?void 0:a.$survey_id)||(null==i||null==(l=i.properties)?void 0:l.$product_tour_id);if(h){var u=o.indexOf(h);0>u||(o.splice(u,1),this.En(o))}}else{if(this.yn.has(t)){var d=this.In(t,i,xr);d.length>0&&(r.info("cancel event matched, cancelling items",{event:t,itemsToCancel:d.map((t=>t.id))}),d.forEach((t=>{var i=o.indexOf(t.id);0>i||o.splice(i,1),this.Rn(t.id)})),this.En(o))}if(this.mn.has(t)){r.info("event name matched",{event:t,eventPayload:i,items:this.mn.get(t)});var v=this.In(t,i,wr);this.En(o.concat(v.map((t=>t.id))||[]))}}}onAction(t){var i,e=this.Tn(),r=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[e])||[];this.bn.has(t)&&this.En(r.concat(this.bn.get(t)||[]))}En(t){var i,e=this.re(),r=this.Tn(),s=[...new Set(t)].filter((t=>!this.Nn(t)));e.info("updating activated items",{activatedItems:s}),null==(i=this._instance)||null==(i=i.persistence)||i.register({[r]:s})}getActivatedIds(){var t,i=this.Tn();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}getEventToItemsMap(){return this.mn}Mn(){return this.xn}}class uo extends ho{constructor(t){super(t)}Tn(){return"$surveys_activated"}An(){return Sr}Cn(t){var i;null==(i=this._instance)||i.getSurveys(t)}Rn(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}re(){return Ds}Nn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var vo="SDK is not enabled or survey functionality is not yet loaded",co="Disabled. Not loading surveys.",fo=null!=it&&it.location?rr(it.location.hash,"__posthog")||rr(location.hash,"state"):null,po="_postHogToolbarParams",go=pe("[Toolbar]"),_o=pe("[FeatureFlags]"),mo=pe("[FeatureFlags]",{debugEnabled:!0}),bo="\" failed. Feature flags didn't load in time.",yo="$active_feature_flags",wo="$override_feature_flags",xo="$feature_flag_payloads",So="$override_feature_flag_payloads",Eo="$feature_flag_request_id",$o=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},ko=t=>{var i={};for(var[e,r]of be(t||{}))r&&(i[e]=r);return i},Po=pe("[Error tracking]"),Io="Refusing to render web experiment since the viewer is a likely bot",To={icontains:(t,i)=>!!it&&i.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>!!it&&-1===i.href.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>!!it&&Is(i.href,t),not_regex:(t,i)=>!!it&&!Is(i.href,t),exact:(t,i)=>i.href===t,is_not:(t,i)=>i.href!==t};class Ro{get Rt(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{Ro.Fn("retrieved web experiments from the server"),i.On=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;i.On&&(Ro.Fn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.On)||e.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);Pt(r)&&t.variants[r]&&i.Pn(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Ro.Ln(n)&&i.Pn(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Ro.Fn(Io);else if(!this.Rt.disable_web_experiments){if(Rt(this.On))return this.On=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Ro.Fn("applying feature flags",t),t.forEach((t=>{var i;if(this.On&&null!=(i=this.On)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.On)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.Pn(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Ro.getWindowLocation();if(null!=t&&t.search){var i=ir(null==t?void 0:t.search,"__experiment_id"),e=ir(null==t?void 0:t.search,"__experiment_variant");i&&e&&(Ro.Fn("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.Dn(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this.Rt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.Rt.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Rt.token),method:"GET",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}Dn(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(Ro.Fn("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.Pn(r[0].name,i,r[0].variants[i].transforms))}static Ln(t){return!Rt(t.conditions)&&Ro.Bn(t)&&Ro.jn(t)}static Bn(t){var i;if(Rt(t.conditions)||Rt(null==(i=t.conditions)?void 0:i.url))return!0;var e,r,s,n=Ro.getWindowLocation();return!!n&&(null==(e=t.conditions)||!e.url||To[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==it?void 0:it.location}static jn(t){var i;if(Rt(t.conditions)||Rt(null==(i=t.conditions)?void 0:i.utm))return!0;var e=hr();if(e.utm_source){var r,s,n,o,a,l,h,u,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)==e.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)==e.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)==e.utm_medium,f=null==(h=t.conditions)||null==(h=h.utm)||!h.utm_term||(null==(u=t.conditions)||null==(u=u.utm)?void 0:u.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static Fn(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];fe.info("[WebExperiments] "+t,e)}Pn(t,i,e){this._is_bot()?Ro.Fn(Io):"control"!==i?e.forEach((e=>{if(e.selector){var r;Ro.Fn("applying transform of variant "+i+" for experiment "+t+" ",e);var s=null==(r=document)?void 0:r.querySelectorAll(e.selector);null==s||s.forEach((t=>{var i=t;e.html&&(i.innerHTML=e.html),e.css&&i.setAttribute("style",e.css)}))}})):Ro.Fn("Control variants leave the page unmodified.")}_is_bot(){return rt&&this._instance?Ps(rt,this.Rt.custom_blocked_useragents):void 0}}var Fo=pe("[Conversations]"),Co="Conversations not available yet.",Oo={featureFlags:class{constructor(t){this.qn=!1,this.Zn=!1,this.$n=!1,this.Hn=!1,this.Vn=!1,this.zn=!1,this.Yn=!1,this.Un=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Rt(){return this._instance.config}get Xi(){return this._instance.persistence}Wn(t){return this._instance.get_property(t)}Gn(){var t,i;return null!==(t=null==(i=this.Xi)?void 0:i.pi(this.Rt.feature_flag_cache_ttl_ms))&&void 0!==t&&t}Xn(){return!!this.Gn()&&(this.Un||this.$n||(this.Un=!0,_o.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Jn(){var t,i=null!==(t=this.Rt.evaluation_contexts)&&void 0!==t?t:this.Rt.evaluation_environments;return!this.Rt.evaluation_environments||this.Rt.evaluation_contexts||this.Yn||(_o.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Yn=!0),null!=i&&i.length?i.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||_o.error("Invalid evaluation context found:",t,"Expected non-empty string"),i})):[]}Kn(){return this.Jn().length>0}initialize(){var t,i,{config:e}=this._instance,r=null!==(t=null==(i=e.bootstrap)?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,i)=>(t[i]=r[i]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,i)=>(o[i]&&(t[i]=o[i]),t)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,i,r){var s=null!=r&&r.merge?this.getFlagVariants():{},n=null!=r&&r.merge?this.getFlagPayloads():{},o=e({},s,t),a=e({},n,i),l={};for(var[h,u]of Object.entries(o)){var d="string"==typeof u;l[h]={key:h,enabled:!!d||Boolean(u),variant:d?u:void 0,reason:void 0,metadata:kt(null==a?void 0:a[h])?void 0:{id:0,version:void 0,description:void 0,payload:a[h]}}}this.receivedFeatureFlags({flags:l})}get hasLoadedFlags(){return this.Zn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Wn(E),i=this.Wn(wo),r=this.Wn(So);if(!r&&!i)return t||{};var s=me({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(i||{})])];for(var o of n){var a,l,h=s[o],u=null==i?void 0:i[o],d=kt(u)?null!==(a=null==h?void 0:h.enabled)&&void 0!==a&&a:!!u,v=kt(u)?h.variant:"string"==typeof u?u:void 0,c=null==r?void 0:r[o],f=e({},h,{enabled:d,variant:d?null!=v?v:null==h?void 0:h.variant:void 0});d!==(null==h?void 0:h.enabled)&&(f.original_enabled=null==h?void 0:h.enabled),v!==(null==h?void 0:h.variant)&&(f.original_variant=null==h?void 0:h.variant),c&&(f.metadata=e({},null==h?void 0:h.metadata,{payload:c,original_payload:null==h||null==(l=h.metadata)?void 0:l.payload})),s[o]=f}return this.qn||(_o.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.qn=!0),s}getFlagVariants(){var t=this.Wn(x),i=this.Wn(wo);if(!i)return t||{};for(var e=me({},t),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.qn||(_o.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.qn=!0),e}getFlagPayloads(){var t=this.Wn(xo),i=this.Wn(So);if(!i)return t||{};for(var e=me({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.qn||(_o.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.qn=!0),e}reloadFeatureFlags(){this.Hn||this.Rt.advanced_disable_feature_flags||this.Qn||(this._instance.Sr.emit("featureFlagsReloading",!0),this.Qn=setTimeout((()=>{this.ts()}),5))}es(){clearTimeout(this.Qn),this.Qn=void 0}ensureFlagsLoaded(){this.Zn||this.$n||this.Qn||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Hn=t}ts(t){var i;if(this.es(),!this._instance.ki())if(this.$n)this.Vn=!0;else{var r=this.Rt.token,s=this.Wn(a),n={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:e({},(null==(i=this.Xi)?void 0:i.get_initial_props())||{},this.Wn(k)||{}),group_properties:this.Wn(P),timezone:_r()};Tt(s)||kt(s)||(n.$device_id=s),(null!=t&&t.disableFlags||this.Rt.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.Kn()&&(n.evaluation_contexts=this.Jn());var o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Rt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$n=!0,this._instance._send_request({method:"POST",url:o,data:n,compression:this.Rt.disable_compression?void 0:Fr,timeout:this.Rt.feature_flag_request_timeout_ms,callback:t=>{var i,e,r,s=!0;if(200===t.statusCode&&(this.Vn||(this.$anon_distinct_id=void 0),s=!1),this.$n=!1,!n.disable_flags||this.Vn){this.zn=!s;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!=(i=t.json)&&i.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var a,l=!(null==(e=t.json)||null==(e=e.quotaLimited)||!e.includes("feature_flags"));if(l&&o.push("quota_limited"),null==(r=this.Xi)||r.register({[F]:o}),l)_o.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 n.disable_flags||this.receivedFeatureFlags(null!==(a=t.json)&&void 0!==a?a:{},s),this.Vn&&(this.Vn=!1,this.ts())}}})}}getFeatureFlag(t,i){var e;if(void 0===i&&(i={}),!i.fresh||this.zn)if(this.Zn||this.getFlags()&&this.getFlags().length>0){if(!this.Xn()){var r=this.getFeatureFlagResult(t,i);return null!==(e=null==r?void 0:r.variant)&&void 0!==e?e:null==r?void 0:r.enabled}}else _o.warn('getFeatureFlag for key "'+t+bo)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i){if(void 0===i&&(i={}),!i.fresh||this.zn)if(this.Zn||this.getFlags()&&this.getFlags().length>0){if(!this.Xn()){var e=this.getFlagVariants(),r=t in e,s=e[t],n=this.getFlagPayloads()[t],o=String(s),a=this.Wn(Eo)||void 0,l=this.Wn(C)||void 0,h=this.Wn(T)||{};if(this.Rt.advanced_feature_flags_dedup_per_session){var u,d=this._instance.get_session_id(),v=this.Wn(R);d&&d!==v&&(h={},null==(u=this.Xi)||u.register({[T]:h,[R]:d}))}if((i.send_event||!("send_event"in i))&&(!(t in h)||!h[t].includes(o))){var c,f,p,g,_,m,b,y,w,x;xt(h[t])?h[t].push(o):h[t]=[o],null==(c=this.Xi)||c.register({[T]:h});var S=this.getFeatureFlagDetails(t),E=[...null!==(f=this.Wn(F))&&void 0!==f?f:[]];kt(s)&&E.push("flag_missing");var k={$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==(p=this.Rt.bootstrap)||null==(p=p.featureFlags)?void 0:p[t])||null,$feature_flag_bootstrapped_payload:(null==(g=this.Rt.bootstrap)||null==(g=g.featureFlagPayloads)?void 0:g[t])||null,$used_bootstrap_value:!this.zn};kt(null==S||null==(_=S.metadata)?void 0:_.version)||(k.$feature_flag_version=S.metadata.version);var P,I=null!==(m=null==S||null==(b=S.reason)?void 0:b.description)&&void 0!==m?m:null==S||null==(y=S.reason)?void 0:y.code;I&&(k.$feature_flag_reason=I),null!=S&&null!=(w=S.metadata)&&w.id&&(k.$feature_flag_id=S.metadata.id),kt(null==S?void 0:S.original_variant)&&kt(null==S?void 0:S.original_enabled)||(k.$feature_flag_original_response=kt(S.original_variant)?S.original_enabled:S.original_variant),null!=S&&null!=(x=S.metadata)&&x.original_payload&&(k.$feature_flag_original_payload=null==S||null==(P=S.metadata)?void 0:P.original_payload),E.length&&(k.$feature_flag_error=E.join(",")),this._instance.capture("$feature_flag_called",k)}if(r){var O=n;if(!kt(n))try{O=JSON.parse(n)}catch(t){}return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:O}}}}else _o.warn('getFeatureFlagResult for key "'+t+bo)}getRemoteConfigPayload(t,i){var e=this.Rt.token,r={distinct_id:this._instance.get_distinct_id(),token:e};this.Kn()&&(r.evaluation_contexts=this.Jn()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Rt.disable_compression?void 0:Fr,timeout:this.Rt.feature_flag_request_timeout_ms,callback(e){var r,s=null==(r=e.json)?void 0:r.featureFlagPayloads;i((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,i){if(void 0===i&&(i={}),!i.fresh||this.zn){if(this.Zn||this.getFlags()&&this.getFlags().length>0){var e=this.getFeatureFlag(t,i);return kt(e)?void 0:!!e}_o.warn('isFeatureEnabled for key "'+t+bo)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i){if(this.Xi){this.Zn=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(t,i,r,s,n){void 0===r&&(r={}),void 0===s&&(s={}),void 0===n&&(n={});var o=(t=>{var i=t.flags;return i?(t.featureFlags=Object.fromEntries(Object.keys(i).map((t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(i).filter((t=>i[t].enabled)).filter((t=>{var e;return null==(e=i[t].metadata)?void 0:e.payload})).map((t=>{var e;return[t,null==(e=i[t].metadata)?void 0:e.payload]})))):_o.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,h=o.featureFlagPayloads;if(l){var u=t.requestId,d=t.evaluatedAt;if(xt(l)){_o.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;i&&i.register({[yo]:l,[x]:v})}else{var f=l,p=h,g=a;if(t.errorsWhileComputingFlags)if(a){var _=new Set(Object.keys(a).filter((t=>{var i;return!(null!=(i=a[t])&&i.failed)})));f=e({},r,Object.fromEntries(Object.entries(f).filter((t=>{var[i]=t;return _.has(i)})))),p=e({},s,Object.fromEntries(Object.entries(p||{}).filter((t=>{var[i]=t;return _.has(i)})))),g=e({},n,Object.fromEntries(Object.entries(g||{}).filter((t=>{var[i]=t;return _.has(i)}))))}else f=e({},r,f),p=e({},s,p),g=e({},n,g);i&&i.register(e({[yo]:Object.keys(ko(f)),[x]:f||{},[xo]:p||{},[E]:g||{}},u?{[Eo]:u}:{},d?{[C]:d}:{}))}}}(t,this.Xi,r,s,n),i||(this.Un=!1),this.rs(i)}}override(t,i){void 0===i&&(i=!1),_o.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.Xi)return _o.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.Xi.unregister(wo),this.Xi.unregister(So),this.rs(),mo.info("All overrides cleared");if(xt(t)){var i=$o(t);return this.Xi.register({[wo]:i}),this.rs(),mo.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e,r=t;if(this.qn=Boolean(null!==(e=r.suppressWarning)&&void 0!==e&&e),"flags"in r)if(!1===r.flags)this.Xi.unregister(wo),mo.info("Flag overrides cleared");else if(r.flags){if(xt(r.flags)){var s=$o(r.flags);this.Xi.register({[wo]:s})}else this.Xi.register({[wo]:r.flags});mo.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.Xi.unregister(So),mo.info("Payload overrides cleared")):r.payloads&&(this.Xi.register({[So]:r.payloads}),mo.info("Payload overrides set",{payloads:r.payloads}))),void this.rs()}if(t&&"object"==typeof t)return this.Xi.register({[wo]:t}),this.rs(),mo.info("Flag overrides set",{flags:t});_o.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Zn){var{flags:i,flagVariants:e}=this.ns();t(i,e)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,r){var s,n=(this.Wn(S)||[]).find((i=>i.flagKey===t)),o={["$feature_enrollment/"+t]:i},a={$feature_flag:t,$feature_enrollment:i,$set:o};n&&(a.$early_access_feature_name=n.name),r&&(a.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=e({},this.getFlagVariants(),{[t]:i});null==(s=this.Xi)||s.register({[yo]:Object.keys(ko(l)),[x]:l}),this.rs()}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.Wn(S),s=e?"&"+e.map((t=>"stage="+t)).join("&"):"";if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Rt.token+s),method:"GET",callback:i=>{var e,r;if(i.json){var s=i.json.earlyAccessFeatures;return null==(e=this.Xi)||e.unregister(S),null==(r=this.Xi)||r.register({[S]:s}),t(s)}}})}ns(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter((t=>i[t])),flagVariants:Object.keys(i).filter((t=>i[t])).reduce(((t,e)=>(t[e]=i[e],t)),{})}}rs(t){var{flags:i,flagVariants:e}=this.ns();this.featureFlagEventHandlers.forEach((r=>r(i,e,{errorsLoading:t})))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=this.Wn(k)||{},s=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in r||(o[a]=n[a]));this._instance.register({[k]:e({},r,o,s)}),i&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(k)}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=this.Wn(P)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((i=>{r[i]=e({},r[i],t[i]),delete t[i]})),this._instance.register({[P]:e({},r,t)}),i&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.Wn(P)||{};this._instance.register({[P]:e({},i,{[t]:{}})})}else this._instance.unregister(P)}reset(){this.Zn=!1,this.$n=!1,this.Hn=!1,this.Vn=!1,this.zn=!1,this.$anon_distinct_id=void 0,this.es(),this.qn=!1}}},Mo={sessionRecording:class{get Rt(){return this._instance.config}get Xi(){return this._instance.persistence}get started(){var t;return!(null==(t=this.ss)||!t.isStarted)}get status(){var t,i;return this.os===Yn||this.os===Xn?this.os:null!==(t=null==(i=this.ss)?void 0:i.status)&&void 0!==t?t:this.os}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.os=Jn,this.ls=void 0,this._instance=t,!this._instance.sessionManager)throw Zn.error("started without valid sessionManager"),new Error(Qn+" started without valid sessionManager. This is a bug.");if(this.Rt.cookieless_mode===W)throw new Error(Qn+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get us(){var t,i=!(null==(t=this._instance.get_property(b))||!t.enabled),e=!this.Rt.disable_session_recording,r=this.Rt.disable_session_recording||this._instance.consent.isOptedOut();return it&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!this.us||null==(i=this.ss)||!i.isStarted){var e=!kt(Object.assign)&&!kt(Array.from);this.us&&e?(this.hs(t),Zn.info("starting")):(this.os=Jn,this.stopRecording())}}hs(t){var i,e,r;this.us&&(this.os!==Yn&&this.os!==Xn&&(this.os=Kn),null!=dt&&null!=(i=dt.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=dt.__PosthogExtensions__)&&e.initSessionRecording?this.cs(t):null==(r=dt.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.ds,(i=>{if(i)return Zn.error("could not load recorder",i);this.cs(t)})))}stopRecording(){var t,i;null==(t=this.ls)||t.call(this),this.ls=void 0,null==(i=this.ss)||i.stop()}vs(){var t,i;null==(t=this.ls)||t.call(this),this.ls=void 0,null==(i=this.ss)||i.discard()}fs(){var t;null==(t=this.Xi)||t.unregister(w)}ps(t,i){if(Rt(t))return null;var e,r=Ft(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(Zn.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}gs(t){if(this.Xi){var i,r,s=this.Xi,n=()=>{var i,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.ps(null==(i=this.Rt.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),o=this.ps(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;Rt(a)&&this.fs();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[b]:e({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:e({capturePerformance:t.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:a,minimumDurationMilliseconds:kt(l)?null:l,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers})})};n(),null==(i=this.ls)||i.call(this),this.ls=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.gs(t),void this.vs()):(this.gs(t),void this.startIfEnabledOrStop()):(this.os===Yn&&(this.os=Xn,Zn.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.ss)&&e.log?this.ss.log(t,i):Zn.warn("log called before recorder was ready")}get ds(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(b);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}ys(){var t,i=this._instance.get_property(b);if(!i)return!1;var e=null!==(t=("object"==typeof i?i:JSON.parse(i)).cache_timestamp)&&void 0!==t?t:Date.now();return 36e5>=Date.now()-e}cs(t){var i,e;if(null==(i=dt.__PosthogExtensions__)||!i.initSessionRecording)return Zn.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0});if(this.ss||(this.ss=null==(e=dt.__PosthogExtensions__)?void 0:e.initSessionRecording(this._instance),this.ss._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.ys()){if(this.os===Xn||this.os===Yn)return;return this.os=Yn,Zn.info("persisted remote config is stale, requesting fresh config before starting"),void new Tr(this._instance).load()}this.os=Kn,this.ss.start(t)}onRRwebEmit(t){var i;null==(i=this.ss)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.ss||null==(i=this.Xi)||i.register({$replay_override_linked_flag:!0}),null==(t=this.ss)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.ss||null==(i=this.Xi)||i.register({$replay_override_sampling:!0}),null==(t=this.ss)||t.overrideSampling()}overrideTrigger(t){var i,e;this.ss||null==(e=this.Xi)||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(i=this.ss)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.ss)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.ss)||!e.tryAddCustomEvent(t,i))}}},Ao={autocapture:class{constructor(t){this.bs=!1,this.ws=null,this._s=!1,this.instance=t,this.rageclicks=new jn(t.config.rageclick),this.Is=null}initialize(){this.startIfEnabled()}get Rt(){var t,i,e=Et(this.instance.config.autocapture)?this.instance.config.autocapture:{};return e.url_allowlist=null==(t=e.url_allowlist)?void 0:t.map((t=>new RegExp(t))),e.url_ignorelist=null==(i=e.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),e}Cs(){if(this.isBrowserSupported()){if(it&&st){var t=t=>{t=t||(null==it?void 0:it.event);try{this.Ss(t)}catch(t){zn.error("Failed to capture event",t)}};if($e(st,"submit",t,{capture:!0}),$e(st,"change",t,{capture:!0}),$e(st,"click",t,{capture:!0}),this.Rt.capture_copied_text){var i=t=>{this.Ss(t=t||(null==it?void 0:it.event),Ln)};$e(st,"copy",i,{capture:!0}),$e(st,"cut",i,{capture:!0})}}}else zn.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.bs&&(this.Cs(),this.bs=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this._s=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[u]:!!t.autocapture_opt_out}),this.ws=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Is=t}getElementSelectors(t){var i,e=[];return null==(i=this.Is)||i.forEach((i=>{var r=null==st?void 0:st.querySelectorAll(i);null==r||r.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i,e=null==(t=this.instance.persistence)?void 0:t.props[u];if(Tt(this.ws)&&!Ot(e)&&!this.instance.ki())return!1;var r=null!==(i=this.ws)&&void 0!==i?i:!!e;return!!this.instance.config.autocapture&&!r}Ss(t,i){if(void 0===i&&(i="$autocapture"),this.isEnabled){var e,r=gn(t);hn(r)&&(r=r.parentNode||null),"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&this.instance.config.rageclick&&null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&function(t,i){if(!it||xn(t))return!1;var e,r,s;if(Ot(i)?(e=!!i&&wn,r=void 0):(e=null!==(s=null==i?void 0:i.css_selector_ignorelist)&&void 0!==s?s:wn,r=null==i?void 0:i.content_ignorelist),!1===e)return!1;var{targetElementList:n}=Sn(t,!1);return!function(t,i){if(!1===t||kt(t))return!1;var e;if(!0===t)e=yn;else{if(!xt(t))return!1;if(t.length>10)return fe.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map((t=>t.toLowerCase()))}return i.some((t=>{var{safeText:i,ariaLabel:r}=t;return e.some((t=>i.includes(t)||r.includes(t)))}))}(r,n.map((t=>{var i;return{safeText:pn(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!mn(n,e)}(r,this.instance.config.rageclick)&&this.Ss(t,"$rageclick");var s=i===Ln;if(r&&function(t,i,e,r,s){var n,o,a,l;if(void 0===e&&(e=void 0),!it||xn(t))return!1;if(null!=(n=e)&&n.url_allowlist&&!vn(e.url_allowlist))return!1;if(null!=(o=e)&&o.url_ignorelist&&vn(e.url_ignorelist))return!1;if(null!=(a=e)&&a.dom_event_allowlist){var h=e.dom_event_allowlist;if(h&&!h.some((t=>i.type===t)))return!1}var{parentIsUsefulElement:u,targetElementList:d}=Sn(t,r);if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(kt(e))return!0;var r,s=function(t){if(e.some((i=>t.tagName.toLowerCase()===i)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(d,e))return!1;if(!mn(d,null==(l=e)?void 0:l.css_selector_allowlist))return!1;var v=it.getComputedStyle(t);if(v&&"pointer"===v.getPropertyValue("cursor")&&"click"===i.type)return!0;var c=t.tagName.toLowerCase();switch(c){case"html":return!1;case"form":return(s||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(i.type)>=0;default:return u?(s||["click"]).indexOf(i.type)>=0:(s||["click"]).indexOf(i.type)>=0&&(_n.indexOf(c)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,this.Rt,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=Hn(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Rt.element_attribute_ignorelist,elementsChainAsString:this._s});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(n.$element_selectors=a),i===Ln){var l,h=fn(null==it||null==(l=it.getSelection())?void 0:l.toString()),u=t.type||"clipboard";if(!h)return!1;n.$selected_content=h,n.$copy_type=u}return this.instance.capture(i,n),!0}}}isBrowserSupported(){return St(null==st?void 0:st.querySelectorAll)}},historyAutocapture:class{constructor(t){var i;this._instance=t,this.ks=(null==it||null==(i=it.location)?void 0:i.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(fe.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.xs&&this.xs(),this.xs=void 0,fe.info("History API monitoring stopped")}monitorHistoryChanges(){var t,i;if(it&&it.history){var e=this;null!=(t=it.history.pushState)&&t.__posthog_wrapped__||qn(it.history,"pushState",(t=>function(i,r,s){t.call(this,i,r,s),e.Ts("pushState")})),null!=(i=it.history.replaceState)&&i.__posthog_wrapped__||qn(it.history,"replaceState",(t=>function(i,r,s){t.call(this,i,r,s),e.Ts("replaceState")})),this.As()}}Ts(t){try{var i,e=null==it||null==(i=it.location)?void 0:i.pathname;if(!e)return;e!==this.ks&&this.isEnabled&&this._instance.capture(X,{navigation_type:t}),this.ks=e}catch(i){fe.error("Error capturing "+t+" pageview",i)}}As(){if(!this.xs){var t=()=>{this.Ts("popstate")};$e(it,"popstate",t),this.xs=()=>{it&&it.removeEventListener("popstate",t)}}}},heatmaps:class{get Rt(){return this.instance.config}constructor(t){var i;this.Es=!1,this.bs=!1,this.Rs=null,this.instance=t,this.Es=!(null==(i=this.instance.persistence)||!i.props[d]),this.rageclicks=new jn(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return Et(this.Rt.capture_heatmaps)&&this.Rt.capture_heatmaps.flush_interval_milliseconds&&(t=this.Rt.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Rt(this.Rt.capture_heatmaps)?Rt(this.Rt.enable_heatmaps)?this.Es:this.Rt.enable_heatmaps:!1!==this.Rt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.bs)return;to.info("starting..."),this.Ns(),this.Tt()}else{var t;clearInterval(null!==(t=this.Rs)&&void 0!==t?t:void 0),this.Ms(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[d]:i}),this.Es=i,this.startIfEnabled()}}getAndClearBuffer(){var t=this.T;return this.T=void 0,t}Fs(t){this.wt(t.originalEvent,"deadclick")}Tt(){this.Rs&&clearInterval(this.Rs),this.Rs=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(st)?setInterval(this.ji.bind(this),this.flushIntervalMilliseconds):null}Ns(){it&&st&&(this.Os=this.ji.bind(this),$e(it,Y,this.Os),this.Ps=t=>this.wt(t||(null==it?void 0:it.event)),$e(st,"click",this.Ps,{capture:!0}),this.Ls=t=>this.Ds(t||(null==it?void 0:it.event)),$e(st,"mousemove",this.Ls,{capture:!0}),this.Bs=new Je(this.instance,Ve,this.Fs.bind(this)),this.Bs.startIfEnabledOrStop(),this.js=this.Tt.bind(this),$e(st,K,this.js),this.bs=!0)}Ms(){var t;it&&st&&(this.Os&&it.removeEventListener(Y,this.Os),this.Ps&&st.removeEventListener("click",this.Ps,{capture:!0}),this.Ls&&st.removeEventListener("mousemove",this.Ls,{capture:!0}),this.js&&st.removeEventListener(K,this.js),clearTimeout(this.qs),null==(t=this.Bs)||t.stop(),this.bs=!1)}Zs(t,i){var e=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,i,e){for(var r=t;r&&an(r)&&!ln(r,"body");){if(r===e)return!1;if(gt(i,null==it?void 0:it.getComputedStyle(r).position))return!0;r=bn(r)}return!1}(gn(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:e),target_fixed:n,type:i}}wt(t,i){var r;if(void 0===i&&(i="click"),!on(t.target)&&io(t)){var s=this.Zs(t,i);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.$s(e({},s,{type:"rageclick"})),this.$s(s)}}Ds(t){!on(t.target)&&io(t)&&(clearTimeout(this.qs),this.qs=setTimeout((()=>{this.$s(this.Zs(t,"mousemove"))}),500))}$s(t){if(it){var i=it.location.href,e=this.Rt.custom_personal_data_properties,r=this.Rt.mask_personal_data_properties?[...nr,...e||[]]:[],s=er(i,r,ar);this.T=this.T||{},this.T[s]||(this.T[s]=[]),this.T[s].push(t)}}ji(){this.T&&!$t(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Je,webVitalsAutocapture:class{constructor(t){var i;this.Es=!1,this.bs=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Hs=()=>{clearTimeout(this.Vs),0!==this.T.metrics.length&&(this._instance.capture("$web_vitals",this.T.metrics.reduce(((t,i)=>e({},t,{["$web_vitals_"+i.name+"_event"]:e({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.nt=t=>{var i,r=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0);if(kt(r))Vn.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.zs();kt(s)||(Rt(null==t?void 0:t.name)||Rt(null==t?void 0:t.value)?Vn.error("Invalid metric received",t):!this.Ys||this.Ys>t.value?(this.T.url!==s&&(this.Hs(),this.Vs=setTimeout(this.Hs,this.flushToCaptureTimeoutMs)),kt(this.T.url)&&(this.T.url=s),this.T.firstMetricTimestamp=kt(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.T.metrics.push(e({},t,{$current_url:s,$session_id:r.sessionId,$window_id:r.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.Hs()):Vn.error("Ignoring metric with value >= "+this.Ys,t))}},this.Us=()=>{if(!this.bs){var t,i,e,r,s=dt.__PosthogExtensions__;kt(s)||kt(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:i,onFCP:e,onINP:r}=s.postHogWebVitalsCallbacks),t&&i&&e&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.nt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.nt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&e(this.nt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.nt.bind(this)),this.bs=!0):Vn.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Es=!(null==(i=this._instance.persistence)||!i.props[p]),this.startIfEnabled()}get Ws(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=Et(this.Ws)?null==(t=this.Ws)?void 0:t.web_vitals_allowed_metrics:void 0;return Rt(e)?(null==(i=this._instance.persistence)?void 0:i.props[m])||["CLS","FCP","INP","LCP"]:e}get flushToCaptureTimeoutMs(){return(Et(this.Ws)?this.Ws.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=Et(this.Ws)?this.Ws.web_vitals_attribution:void 0;return null!=t&&t}get Ys(){var t=Et(this.Ws)&&Ft(this.Ws.__web_vitals_max_value)?this.Ws.__web_vitals_max_value:Gn;return t>0&&6e4>=t?Gn:t}get isEnabled(){var t=null==nt?void 0:nt.protocol;if("http:"!==t&&"https:"!==t)return Vn.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=Et(this.Ws)?this.Ws.web_vitals:Ot(this.Ws)?this.Ws:void 0;return Ot(i)?i:this.Es}startIfEnabled(){this.isEnabled&&!this.bs&&(Vn.info("enabled, starting..."),this.ni(this.Us))}onRemoteConfig(t){if("capturePerformance"in t){var i=Et(t.capturePerformance)&&!!t.capturePerformance.web_vitals,e=Et(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[p]:i}),this._instance.persistence.register({[m]:e})),this.Es=i,this.startIfEnabled()}}ni(t){var i,e;null!=(i=dt.__PosthogExtensions__)&&i.postHogWebVitalsCallbacks?t():null==(e=dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(i=>{i?Vn.error("failed to load script",i):t()}))}zs(){var t=it?it.location.href:void 0;if(t){var i=this._instance.config.custom_personal_data_properties,e=this._instance.config.mask_personal_data_properties?[...nr,...i||[]]:[];return er(t,e,ar)}Vn.error("Could not determine current URL")}}},Do={exceptionObserver:class{constructor(t){var i,e,r;this.Us=()=>{var t;if(it&&this.isEnabled&&null!=(t=dt.__PosthogExtensions__)&&t.errorWrappingFunctions){var i=dt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=dt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=dt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Gs&&this.Rt.capture_unhandled_errors&&(this.Gs=i(this.captureException.bind(this))),!this.Xs&&this.Rt.capture_unhandled_rejections&&(this.Xs=e(this.captureException.bind(this))),!this.Js&&this.Rt.capture_console_errors&&(this.Js=r(this.captureException.bind(this)))}catch(t){Bn.error("failed to start",t),this.Ks()}}},this._instance=t,this.Qs=!(null==(i=this._instance.persistence)||!i.props[v]),this.eo=new Bt({refillRate:null!==(e=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==e?e:1,bucketSize:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10,refillInterval:1e4,qt:Bn}),this.Rt=this.io(),this.startIfEnabledOrStop()}io(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Et(t)?i=e({},i,t):(kt(t)?this.Qs:t)&&(i=e({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.Rt.capture_console_errors||this.Rt.capture_unhandled_errors||this.Rt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Bn.info("enabled"),this.Ks(),this.ni(this.Us)):this.Ks()}ni(t){var i,e;null!=(i=dt.__PosthogExtensions__)&&i.errorWrappingFunctions&&t(),null==(e=dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Bn.error("failed to load script",i);t()}))}Ks(){var t,i,e;null==(t=this.Gs)||t.call(this),this.Gs=void 0,null==(i=this.Xs)||i.call(this),this.Xs=void 0,null==(e=this.Js)||e.call(this),this.Js=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.Qs=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[v]:this.Qs}),this.Rt=this.io(),this.startIfEnabledOrStop())}onConfigChange(){this.Rt=this.io()}captureException(t){var i,e,r,s=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.eo.consumeRateLimit(s)?Bn.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var i,r;this.ro=[],this.no=new qi([new ee,new ve,new se,new re,new ue,new he,new oe,new de],function(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];return function(i,s){void 0===s&&(s=0);for(var n=[],o=i.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var h=ie.test(l)?l.replace(ie,"$1"):l;if(!h.match(/\S*Error: /)){for(var u of r){var d=u(h,t);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,50).map((t=>{return e({},t,{filename:t.filename||(r=i,r[r.length-1]||{}).filename,function:t.function||Wi});var r}))}(n)}}("web:javascript",Xi,te)),this._instance=t,this.ro=null!==(i=null==(r=this._instance.persistence)?void 0:r.get_property(c))&&void 0!==i?i:[]}onRemoteConfig(t){var i,e,r;if("errorTracking"in t){var s=null!==(i=null==(e=t.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.ro=s,this._instance.persistence&&this._instance.persistence.register({[c]:this.ro,[f]:n})}}get so(){var t,i=!!this._instance.get_property(f),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.no.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}sendExceptionEvent(t){var i=t.$exception_list;if(this.oo(i)){if(this.ao(i))return void Po.info("Skipping exception capture because a suppression rule matched");if(!this.so&&this.lo(i))return void Po.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.uo(i))return void Po.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",zr:!0})}ao(t){if(0===t.length)return!1;var i=t.reduce(((t,i)=>{var{type:e,value:r}=i;return Pt(e)&&e.length>0&&t.$exception_types.push(e),Pt(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.ro.some((t=>{var e=t.values.map((t=>{var e,r=Rs[t.operator],s=xt(t.value)?t.value:[t.value],n=null!==(e=i[t.key])&&void 0!==e?e:[];return s.length>0&&r(s,n)}));return"OR"===t.type?e.some(Boolean):e.every(Boolean)}))}lo(t){return t.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}uo(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[],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}oo(t){return!Rt(t)&&xt(t)}}},jo=e({productTours:class{get Xi(){return this._instance.persistence}constructor(t){this.ho=null,this.co=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this.Xi&&this.Xi.register({[_]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,i;this.ho||(t=this._instance).config.disable_product_tours||null==(i=t.persistence)||!i.get_property(_)||this.ni((()=>this.do()))}ni(t){var i,e;null!=(i=dt.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",(i=>{i?eo.error("Could not load product tours script",i):t()}))}do(){var t;!this.ho&&null!=(t=dt.__PosthogExtensions__)&&t.generateProductTours&&(this.ho=dt.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!xt(this.co)||i){var e=this.Xi;if(e){var r=e.props[ro];if(xt(r)&&!i)return this.co=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:i=>{var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return eo.error(s),void t([],{isLoaded:!1,error:s})}var n=xt(i.json.product_tours)?i.json.product_tours:[];this.co=n,e&&e.register({[ro]:n}),t(n,{isLoaded:!0})}})}else t(this.co,{isLoaded:!0})}getActiveProductTours(t){Rt(this.ho)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.ho.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.ho)||i.showTourById(t)}previewTour(t){this.ho?this.ho.previewTour(t):this.ni((()=>{var i;this.do(),null==(i=this.ho)||i.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.ho)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.ho)||t.nextStep()}previousStep(){var t;null==(t=this.ho)||t.previousStep()}clearCache(){var t;this.co=null,null==(t=this.Xi)||t.unregister(ro)}resetTour(t){var i;null==(i=this.ho)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.ho)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.ho)||i.cancelPendingTour(t)}}},Oo),Lo={siteApps:class{constructor(t){this._instance=t,this.vo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}fo(t,i){if(i){var e=this.globalsForEvent(i);this.vo.push(e),this.vo.length>1e3&&(this.vo=this.vo.slice(10))}}get siteAppLoaders(){var t;return null==(t=dt._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.fo.bind(this));this.po=()=>{t(),this.vo=[],this.po=void 0}}}globalsForEvent(t){var i,s,n,o,a,l,h;if(!t)throw new Error("Event payload is required");var u={},d=this._instance.get_property("$groups")||[],v=this._instance.get_property("$stored_group_properties")||{};for(var[c,f]of Object.entries(v))u[c]={id:d[c],type:c,properties:f};var{$set_once:p,$set:g}=t;return{event:e({},r(t,so),{properties:e({},t.properties,g?{$set:e({},null!==(i=null==(s=t.properties)?void 0:s.$set)&&void 0!==i?i:{},g)}:{},p?{$set_once:e({},null!==(n=null==(o=t.properties)?void 0:o.$set_once)&&void 0!==n?n:{},p)}:{}),elements_chain:null!==(a=null==(l=t.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(h=t.properties)?void 0:h.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;!i.errored&&this.vo.length&&(no.info("Processing "+this.vo.length+" events for site app with id "+t.id),this.vo.forEach((t=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(e=this.po)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,no.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var{processEvent:n}=t.init({posthog:this._instance,callback(t){s(t)}});n&&(i.processEvent=n),r=!0}catch(i){no.error(oo+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){no.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}mo(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}yo(t){if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t);for(var e of Object.values(this.apps))try{null==e.processEvent||e.processEvent(i)}catch(i){no.error("Error while processing event "+t.event+" for site app "+e.id,i)}}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.mo(),void this._instance.on("eventCaptured",(t=>this.yo(t)))):void no.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.po)||e.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var i;dt["__$$ph_site_app_"+t]=s._instance,null==(i=dt.__PosthogExtensions__)||null==i.loadSiteApp||i.loadSiteApp(s._instance,a,(i=>{if(i)return no.error(oo+t,i)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else no.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},zo={tracingHeaders:class{constructor(t){this.bo=void 0,this.wo=void 0,this.Us=()=>{var t,i;kt(this.bo)&&(null==(t=dt.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),kt(this.wo)&&(null==(i=dt.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}initialize(){this.startIfEnabledOrStop()}ni(t){var i,e;null!=(i=dt.__PosthogExtensions__)&&i.tracingHeadersPatchFns&&t(),null==(e=dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return Wn.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var t,i;this._instance.config.__add_tracing_headers?this.ni(this.Us):(null==(t=this.bo)||t.call(this),null==(i=this.wo)||i.call(this),this.bo=void 0,this.wo=void 0)}}},Uo=e({surveys:class{get Rt(){return this._instance.config}constructor(t){this._o=void 0,this._surveyManager=null,this.Io=!1,this.Co=[],this.So=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Rt.disable_surveys){var i=t.surveys;if(Rt(i))return Ds.warn("Flags not loaded yet. Not loading surveys.");var e=xt(i);this._o=e?i.length>0:i,Ds.info("flags response received, isSurveysEnabled: "+this._o),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],i=0;i<localStorage.length;i++){var e=localStorage.key(i);(null!=e&&e.startsWith(js)||null!=e&&e.startsWith("inProgressSurvey_"))&&t.push(e)}t.forEach((t=>localStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.Io)Ds.info("Already initializing surveys, skipping...");else if(this.Rt.disable_surveys)Ds.info(co);else if(this.Rt.cookieless_mode&&this._instance.consent.isOptedOut())Ds.info("Not loading surveys in cookieless mode without consent.");else{var t=null==dt?void 0:dt.__PosthogExtensions__;if(t){if(!kt(this._o)||this.Rt.advanced_enable_surveys){var i=this._o||this.Rt.advanced_enable_surveys;this.Io=!0;try{var e=t.generateSurveys;if(e)return void this.ko(e,i);var r=t.loadExternalDependency;if(!r)return void this.xo(B);r(this._instance,"surveys",(e=>{e||!t.generateSurveys?this.xo("Could not load surveys script",e):this.ko(t.generateSurveys,i)}))}catch(t){throw this.xo("Error initializing surveys",t),t}finally{this.Io=!1}}}else Ds.error("PostHog Extensions not found.")}}ko(t,i){this._surveyManager=t(this._instance,i),this._surveyEventReceiver=new uo(this._instance),Ds.info("Surveys loaded successfully"),this.To({isLoaded:!0})}xo(t,i){Ds.error(t,i),this.To({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Co.push(t),this._surveyManager&&this.To({isLoaded:!0}),()=>{this.Co=this.Co.filter((i=>i!==t))}}getSurveys(t,i){if(void 0===i&&(i=!1),this.Rt.disable_surveys)return Ds.info(co),t([]);var e,r=this._instance.get_property(I);if(r&&!i)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.So?this.So.then((i=>{var{surveys:e,context:r}=i;return t(e,r)})):("undefined"!=typeof Promise&&(this.So=new Promise((t=>{e=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Rt.token),method:"GET",timeout:this.Rt.surveys_request_timeout_ms,callback:i=>{var r;this.So=null;var s=i.statusCode;if(200!==s||!i.json){var n="Surveys API could not be loaded, status: "+s;Ds.error(n);var o={isLoaded:!1,error:n};return t([],o),void(null==e||e({surveys:[],context:o}))}var a,l=i.json.surveys||[],h=l.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t))));h.length>0&&(null==(a=this._surveyEventReceiver)||a.register(h)),null==(r=this._instance.persistence)||r.register({[I]:l});var u={isLoaded:!0};t(l,u),null==e||e({surveys:l,context:u})}}))}To(t){for(var i of this.Co)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){Ds.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!Rt(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Ds.warn("init was not called")}Ao(t){var i=null;return this.getSurveys((e=>{var r;i=null!==(r=e.find((i=>i.id===t)))&&void 0!==r?r:null})),i}Eo(t){if(Rt(this._surveyManager))return{eligible:!1,reason:vo};var i="string"==typeof t?this.Ao(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Rt(this._surveyManager))return Ds.warn("init was not called"),{visible:!1,disabledReason:vo};var i=this.Eo(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return Rt(this._surveyManager)?(Ds.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:vo})):new Promise((e=>{this.getSurveys((i=>{var r,s=null!==(r=i.find((i=>i.id===t)))&&void 0!==r?r:null;if(s){var n=this.Eo(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i,e){var r;if(Rt(this._surveyManager))Ds.warn("init was not called");else{var s="string"==typeof t?this.Ao(t):t;if(null!=s&&s.id)if(Us.includes(s.type)){var n=null==st?void 0:st.querySelector(i);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(Ds.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,i;Ds.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(s,n,e),Ds.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,e);Ds.warn("Survey element not found")}else Ds.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Ds.warn("Survey not found")}}displaySurvey(t,i){var r;if(Rt(this._surveyManager))Ds.warn("init was not called");else{var s=this.Ao(t);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&i.ignoreDelay&&(n=e({},s,{appearance:e({},s.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==$r&&i.initialResponses&&Ds.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var o=this.canRenderSurvey(s);if(!o.visible)return void Ds.warn("Survey is not eligible to be displayed: ",o.disabledReason)}"inline"!==i.displayType?this._surveyManager.handlePopoverSurvey(n,i):this.renderSurvey(n,i.selector,i.properties)}else Ds.warn("Survey not found")}}cancelPendingSurvey(t){Rt(this._surveyManager)?Ds.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},Oo),No={toolbar:class{constructor(t){this.instance=t}Ro(t){dt.ph_toolbar_state=t}No(){var t;return null!==(t=dt.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,i,e){if(void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),ke(this.instance.config))return!1;if(!it||!st)return!1;t=null!=t?t:it.location,e=null!=e?e:it.history;try{if(!i){try{it.localStorage.setItem("test","test"),it.localStorage.removeItem("test")}catch(t){return!1}i=null==it?void 0:it.localStorage}var r,s=fo||rr(t.hash,"__posthog")||rr(t.hash,"state"),n=s?ye((()=>JSON.parse(atob(decodeURIComponent(s)))))||ye((()=>JSON.parse(decodeURIComponent(s)))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?t.hash=n.desiredHash:e?e.replaceState(e.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(i.getItem(po)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Mo(t){var i=dt.ph_load_toolbar||dt.ph_load_editor;!Rt(i)&&St(i)?i(t,this.instance):go.warn("No toolbar load function found")}loadToolbar(t){var i=!(null==st||!st.getElementById(U));if(!it||i)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=e({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(it.localStorage.setItem(po,JSON.stringify(e({},s,{source:void 0}))),2===this.No())this.Mo(s);else if(0===this.No()){var n;this.Ro(1),null==(n=dt.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return go.error("[Toolbar] Failed to load",t),void this.Ro(0);this.Ro(2),this.Mo(s)})),$e(it,"turbolinks:load",(()=>{this.Ro(0),this.loadToolbar(s)}))}return!0}Fo(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}},Ho=e({experiments:Ro},Oo),Bo={conversations:class{constructor(t){this.Oo=void 0,this._conversationsManager=null,this.Po=!1,this.Lo=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var i=t.conversations;Rt(i)||(Ot(i)?this.Oo=i:(this.Oo=i.enabled,this.Lo=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Oo=void 0,this.Lo=null}loadIfEnabled(){if(!(this._conversationsManager||this.Po||this._instance.config.disable_conversations||ke(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==dt?void 0:dt.__PosthogExtensions__;if(t&&!kt(this.Oo)&&this.Oo)if(this.Lo&&this.Lo.token){this.Po=!0;try{var i=t.initConversations;if(i)return this.Do(i),void(this.Po=!1);var e=t.loadExternalDependency;if(!e)return void this.Bo(B);e(this._instance,"conversations",(i=>{i||!t.initConversations?this.Bo("Could not load conversations script",i):this.Do(t.initConversations),this.Po=!1}))}catch(t){this.Bo("Error initializing conversations",t),this.Po=!1}}else Fo.error("Conversations enabled but missing token in remote config.")}}Do(t){if(this.Lo)try{this._conversationsManager=t(this.Lo,this._instance),Fo.info("Conversations loaded successfully")}catch(t){this.Bo("Error completing conversations initialization",t)}else Fo.error("Cannot complete initialization: remote config is null")}Bo(t,i){Fo.error(t,i),this._conversationsManager=null,this.Po=!1}show(){this._conversationsManager?this._conversationsManager.show():Fo.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Oo&&!Tt(this._conversationsManager)}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,e,r){var s=this;return i((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,e,r):(Fo.warn(Co),null)}))()}getMessages(t,e){var r=this;return i((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,e):(Fo.warn(Co),null)}))()}markAsRead(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Fo.warn(Co),null)}))()}getTickets(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Fo.warn(Co),null)}))()}requestRestoreLink(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Fo.warn(Co),null)}))()}restoreFromToken(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Fo.warn(Co),null)}))()}restoreFromUrlToken(){var t=this;return i((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Fo.warn(Co),null)}))()}getCurrentTicketId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}Kr(){var t;null==(t=this._conversationsManager)||t.setIdentity()}Qr(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},qo={logs:class{constructor(t){var i;this.jo=!1,this.qo=!1,this._instance=t,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.jo=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var i,e=null==(i=t.logs)?void 0:i.captureConsoleLogs;!Rt(e)&&e&&(this.jo=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.jo&&!this.qo){var t=pe("[logs]"),i=null==dt?void 0:dt.__PosthogExtensions__;if(i){var e=i.loadExternalDependency;e?e(this._instance,"logs",(e=>{var r;e||null==(r=i.logs)||!r.initializeLogs?t.error("Could not load logs script",e):(i.logs.initializeLogs(this._instance),this.qo=!0)})):t.error(B)}else t.error("PostHog Extensions not found.")}}}},Wo=e({},Oo,Mo,Ao,Do,jo,Lo,Uo,zo,No,Ho,Bo,qo);nn.__defaultExtensionClasses=e({},Wo)}();
|
|
1
|
+
!function(){"use strict";function t(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function i(i){return function(){var e=this,r=arguments;return new Promise((function(s,n){var o=i.apply(e,r);function a(i){t(o,s,n,a,l,"next",i)}function l(i){t(o,s,n,a,l,"throw",i)}a(void 0)}))}}function e(){return e=Object.assign?Object.assign.bind():function(t){for(var i=1;arguments.length>i;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},e.apply(null,arguments)}function r(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}var s="1.366.2",n={DEBUG:!1,LIB_VERSION:s,LIB_NAME:"web",JS_SDK_VERSION:s},o="$people_distinct_id",a="$device_id",l="__alias",h="__timers",u="$autocapture_disabled_server_side",d="$heatmaps_enabled_server_side",v="$exception_capture_enabled_server_side",c="$error_tracking_suppression_rules",f="$error_tracking_capture_extension_exceptions",p="$web_vitals_enabled_server_side",g="$dead_clicks_enabled_server_side",_="$product_tours_enabled_server_side",m="$web_vitals_allowed_metrics",b="$session_recording_remote_config",y="$sesid",w="$session_is_sampled",x="$enabled_feature_flags",S="$early_access_features",E="$feature_flag_details",k="$stored_person_properties",P="$stored_group_properties",I="$surveys",T="$flag_call_reported",R="$flag_call_reported_session_id",F="$feature_flag_errors",C="$feature_flag_evaluated_at",O="$user_state",M="$client_session_props",A="$capture_rate_limit",D="$initial_campaign_params",j="$initial_referrer_info",L="$initial_person_info",z="$epp",U="__POSTHOG_TOOLBAR__",N="$posthog_cookieless",H=[o,l,"__cmpns",h,"$session_recording_enabled_server_side",d,y,x,c,O,S,E,P,k,I,T,R,F,C,M,A,D,j,z,L],B="PostHog loadExternalDependency extension not found.",q="on_reject",W="always",V="anonymous",G="identified",J="identified_only",K="visibilitychange",Y="beforeunload",X="$pageview",Q="$pageleave",Z="$identify",tt="$groupidentify",it="undefined"!=typeof window?window:void 0,et="undefined"!=typeof globalThis?globalThis:it;"undefined"==typeof self&&(et.self=et),"undefined"==typeof File&&(et.File=function(){});var rt=null==et?void 0:et.navigator,st=null==et?void 0:et.document,nt=null==et?void 0:et.location,ot=null==et?void 0:et.fetch,at=null!=et&&et.XMLHttpRequest&&"withCredentials"in new et.XMLHttpRequest?et.XMLHttpRequest:void 0,lt=null==et?void 0:et.AbortController,ht=null==et?void 0:et.CompressionStream,ut=null==rt?void 0:rt.userAgent,dt=null!=it?it:{};function vt(){return(vt=i((function*(t,i){void 0===i&&(i=!0);try{var e=new Blob([t],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return yield new Response(e).blob()}catch(t){return i&&console.error("Failed to gzip compress data",t),null}}))).apply(this,arguments)}var ct=["$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"],ft=["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"],pt=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return ft.concat(i).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))};function gt(t,i){return-1!==t.indexOf(i)}var _t=function(t){return t.trim()},mt=function(t){return t.replace(/^\$/,"")},bt=Object.prototype,yt=bt.hasOwnProperty,wt=bt.toString,xt=Array.isArray||function(t){return"[object Array]"===wt.call(t)},St=t=>"function"==typeof t,Et=t=>t===Object(t)&&!xt(t),$t=t=>{if(Et(t)){for(var i in t)if(yt.call(t,i))return!1;return!0}return!1},kt=t=>void 0===t,Pt=t=>"[object String]"==wt.call(t),It=t=>Pt(t)&&0===t.trim().length,Tt=t=>null===t,Rt=t=>kt(t)||Tt(t),Ft=t=>"[object Number]"==wt.call(t)&&t==t,Ct=t=>Ft(t)&&t>0,Ot=t=>"[object Boolean]"===wt.call(t),Mt=t=>t instanceof FormData,At=t=>gt(ct,t);function Dt(t){return null===t||"object"!=typeof t}function jt(t,i){return{}.toString.call(t)==="[object "+i+"]"}function Lt(t){return"undefined"!=typeof Event&&function(t,i){try{return t instanceof i}catch(t){return!1}}(t,Event)}var zt=[!0,"true",1,"1","yes"],Ut=t=>gt(zt,t),Nt=[!1,"false",0,"0","no"];function Ht(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),Ft(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(r.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(r.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+s),Ht(s||e,i,e,r))}class Bt{constructor(t){this.Pt={},this.Dt=t.Dt,this.jt=Ht(t.bucketSize,0,100,t.qt),this.$t=Ht(t.refillRate,0,this.jt,t.qt),this.Ht=Ht(t.refillInterval,0,864e5,t.qt)}Vt(t,i){var e=Math.floor((i-t.lastAccess)/this.Ht);e>0&&(t.tokens=Math.min(t.tokens+e*this.$t,this.jt),t.lastAccess=t.lastAccess+e*this.Ht)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.Pt[r];return s?this.Vt(s,e):this.Pt[r]=s={tokens:this.jt,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.Dt)||i.call(this,t)),0===s.tokens)}stop(){this.Pt={}}}var qt,Wt,Vt,Gt="Mobile",Jt="iOS",Kt="Android",Yt="Tablet",Xt=Kt+" "+Yt,Qt="iPad",Zt="Apple",ti=Zt+" Watch",ii="Safari",ei="BlackBerry",ri="Samsung",si=ri+"Browser",ni=ri+" Internet",oi="Chrome",ai=oi+" OS",li=oi+" "+Jt,hi="Internet Explorer",ui=hi+" "+Gt,di="Opera",vi=di+" Mini",ci="Edge",fi="Microsoft "+ci,pi="Firefox",gi=pi+" "+Jt,_i="Nintendo",mi="PlayStation",bi="Xbox",yi=Kt+" "+Gt,wi=Gt+" "+ii,xi="Windows",Si=xi+" Phone",Ei="Nokia",$i="Ouya",ki="Generic",Pi=ki+" "+Gt.toLowerCase(),Ii=ki+" "+Yt.toLowerCase(),Ti="Konqueror",Ri="(\\d+(\\.\\d+)?)",Fi=new RegExp("Version/"+Ri),Ci=new RegExp(bi,"i"),Oi=new RegExp(mi+" \\w+","i"),Mi=new RegExp(_i+" \\w+","i"),Ai=new RegExp(ei+"|PlayBook|BB10","i"),Di={"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"},ji=function(t,i){return i=i||"",gt(t," OPR/")&>(t,"Mini")?vi:gt(t," OPR/")?di:Ai.test(t)?ei:gt(t,"IE"+Gt)||gt(t,"WPDesktop")?ui:gt(t,si)?ni:gt(t,ci)||gt(t,"Edg/")?fi:gt(t,"FBIOS")?"Facebook "+Gt:gt(t,"UCWEB")||gt(t,"UCBrowser")?"UC Browser":gt(t,"CriOS")?li:gt(t,"CrMo")||gt(t,oi)?oi:gt(t,Kt)&>(t,ii)?yi:gt(t,"FxiOS")?gi:gt(t.toLowerCase(),Ti.toLowerCase())?Ti:((t,i)=>i&>(i,Zt)||function(t){return gt(t,ii)&&!gt(t,oi)&&!gt(t,Kt)}(t))(t,i)?gt(t,Gt)?wi:ii:gt(t,pi)?pi:gt(t,"MSIE")||gt(t,"Trident/")?hi:gt(t,"Gecko")?pi:""},Li={[ui]:[new RegExp("rv:"+Ri)],[fi]:[new RegExp(ci+"?\\/"+Ri)],[oi]:[new RegExp("("+oi+"|CrMo)\\/"+Ri)],[li]:[new RegExp("CriOS\\/"+Ri)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ri)],[ii]:[Fi],[wi]:[Fi],[di]:[new RegExp("(Opera|OPR)\\/"+Ri)],[pi]:[new RegExp(pi+"\\/"+Ri)],[gi]:[new RegExp("FxiOS\\/"+Ri)],[Ti]:[new RegExp("Konqueror[:/]?"+Ri,"i")],[ei]:[new RegExp(ei+" "+Ri),Fi],[yi]:[new RegExp("android\\s"+Ri,"i")],[ni]:[new RegExp(si+"\\/"+Ri)],[hi]:[new RegExp("(rv:|MSIE )"+Ri)],Mozilla:[new RegExp("rv:"+Ri)]},zi=function(t,i){var e=ji(t,i),r=Li[e];if(kt(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},Ui=[[new RegExp(bi+"; "+bi+" (.*?)[);]","i"),t=>[bi,t&&t[1]||""]],[new RegExp(_i,"i"),[_i,""]],[new RegExp(mi,"i"),[mi,""]],[Ai,[ei,""]],[new RegExp(xi,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[Si,""];if(new RegExp(Gt).test(i)&&!/IEMobile\b/.test(i))return[xi+" "+Gt,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=Di[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[xi,r]}return[xi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[Jt,[t[3],t[4],t[5]||"0"].join(".")]:[Jt,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=kt(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+Kt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Kt+")","i"),t=>t&&t[2]?[Kt,[t[2],t[3],t[4]||"0"].join(".")]:[Kt,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ai,""]],[/Linux|debian/i,["Linux",""]]],Ni=function(t){return Mi.test(t)?_i:Oi.test(t)?mi:Ci.test(t)?bi:new RegExp($i,"i").test(t)?$i:new RegExp("("+Si+"|WPDesktop)","i").test(t)?Si:/iPad/.test(t)?Qt:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ti:Ai.test(t)?ei:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Ei,"i").test(t)?Ei:/(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(Gt).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)?Kt:Xt:new RegExp("(pda|"+Gt+")","i").test(t)?Pi:new RegExp(Yt,"i").test(t)&&!new RegExp(Yt+" pc","i").test(t)?Ii:""},Hi=t=>t instanceof Error;function Bi(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Vt&&e.length===Wt||(Wt=e.length,Vt=e.reduce(((e,r)=>{qt||(qt={});var s=qt[r];if(s)e[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,h=i[r];if(l&&h){e[l]=h,qt[r]=[l,h];break}}return e}),{})),Vt}}class qi{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var e=this;return i((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&xt(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t}))()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var r,s;return null!=t.cause&&(r=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),e({},t,{cause:r,stack:s})}applyChunkIds(t,i){return t.map((t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t)))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var e=this;return i((function*(){var i=t;for(var r of e.modifiers)i=yield r(i);return i}))()}convertToExceptionList(t,i){var r,s,n,o={type:t.type,value:t.value,mechanism:{type:null!==(r=i.type)&&void 0!==r?r:"generic",handled:null===(s=i.handled)||void 0===s||s,synthetic:null!==(n=t.synthetic)&&void 0!==n&&n}};t.stack&&(o.stacktrace={type:"raw",frames:t.stack});var a=[o];return null!=t.cause&&a.push(...this.convertToExceptionList(t.cause,e({},i,{handled:!0}))),a}buildParsingContext(t){var i;return{chunkIdMap:Bi(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,r){void 0===r&&(r=0);var s=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return e({},i,{syntheticException:0==r?i.syntheticException:void 0,mechanism:t,apply:t=>s(t,r),next:t=>s(t,r+1)})}}var Wi="?";function Vi(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?Wi:e,in_app:!0};return kt(r)||(n.lineno=r),kt(s)||(n.colno=s),n}var Gi=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:Wi,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},Ji=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ki=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Yi=/\((\S*)(?::(\d+))(?::(\d+))\)/,Xi=(t,i)=>{var e=Ji.exec(t);if(e){var[,r,s,n]=e;return Vi(i,r,Wi,+s,+n)}var o=Ki.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=Yi.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,h]=Gi(o[1]||Wi,o[2]);return Vi(i,h,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Qi=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Zi=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,te=(t,i)=>{var e=Qi.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=Zi.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||Wi;return[n,s]=Gi(n,s),Vi(i,s,n,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},ie=/\(error: (.*)\)/;class ee{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=Pt(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return jt(t,"DOMException")}isDOMError(t){return jt(t,"DOMError")}}class re{match(t){return(t=>t instanceof Error)(t)}coerce(t,i){return{type:this.getType(t),value:this.getMessage(t,i),stack:this.getStack(t),cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){return t.stacktrace||t.stack||void 0}}class se{constructor(){}match(t){return jt(t,"ErrorEvent")&&null!=t.error}coerce(t,i){var e;return i.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}var ne=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class oe{match(t){return"string"==typeof t}coerce(t,i){var e,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(ne);return r&&(i=r[1],e=r[2]),[i,e]}}var ae=["fatal","error","warning","log","info","debug"];function le(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(i>=s.length)return r===e.length?s:s.length>i?s.slice(0,i)+"...":s}return""}class he{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r=this.getErrorPropertyFromObject(t);return r?i.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(e=i.syntheticException)?void 0:e.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Lt(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+le(t)}isSeverityLevel(t){return Pt(t)&&!It(t)&&ae.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var i in t)if({}.hasOwnProperty.call(t,i)){var e=t[i];if(Hi(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class ue{match(t){return Lt(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+le(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class de{match(t){return Dt(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class ve{match(t){return jt(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Lt(t))return!1;try{var i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return Dt(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.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 ce=function(t,i){var{debugEnabled:e}=void 0===i?{}:i,r={C(i){if(it&&(n.DEBUG||dt.POSTHOG_DEBUG||e)&&!kt(it.console)&&it.console){for(var r=("__rrweb_original__"in it.console[i]?it.console[i].__rrweb_original__:it.console[i]),s=arguments.length,o=new Array(s>1?s-1:0),a=1;s>a;a++)o[a-1]=arguments[a];r(t,...o)}},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.C("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.C("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];r.C("error",...i)},critical(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];console.error(t,...e)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(i,e)=>ce(t+" "+i,e)};return r},fe=ce("[PostHog.js]"),pe=fe.createLogger;function ge(t,i){xt(t)&&t.forEach(i)}function _e(t,i){if(!Rt(t))if(xt(t))t.forEach(i);else if(Mt(t))t.forEach(((t,e)=>i(t,e)));else for(var e in t)yt.call(t,e)&&i(t[e],e)}var me=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];for(var s of e)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function be(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}var ye=function(t){try{return t()}catch(t){return}},we=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){fe.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),fe.critical(t)}}},xe=function(t){var i={};return _e(t,(function(t,e){(Pt(t)&&t.length>0||Ft(t))&&(i[e]=t)})),i};var Se=["herokuapp.com","vercel.app","netlify.app"];function Ee(t){var i=null==t?void 0:t.hostname;if(!Pt(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of Se)if(e===r)return!1;return!0}function $e(t,i,e,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(i,e,{capture:s,passive:n})}function ke(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 Ft(t)&&isFinite(t)&&Math.floor(t)===t});class Pe{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,e,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||0>t||0>i||0>e||0>r||t>0xffffffffffff||i>4095||e>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|i>>>8,s[7]=i,s[8]=128|e>>>24,s[9]=e>>>16,s[10]=e>>>8,s[11]=e,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new Pe(s)}toString(){for(var t="",i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Pe(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;16>i;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class Ie{constructor(){this.I=0,this.S=0,this.k=new Fe}generate(){var t=this.generateOrAbort();if(kt(t)){this.I=0;var i=this.generateOrAbort();if(kt(i))throw new Error("Could not generate UUID after timestamp reset");return i}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 Pe.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 Te,Re=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};it&&!kt(it.crypto)&&crypto.getRandomValues&&(Re=t=>crypto.getRandomValues(t));class Fe{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(Re(this.T),this.N=0),this.T[this.N++]}}var Ce=()=>Oe().toString(),Oe=()=>(Te||(Te=new Ie)).generate(),Me="",Ae=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var De={Yt:()=>!!st,Ut(t){fe.error("cookieStore error: "+t)},Wt(t){if(st){try{for(var i=t+"=",e=st.cookie.split(";").filter((t=>t.length)),r=0;e.length>r;r++){for(var s=e[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(i))return decodeURIComponent(s.substring(i.length,s.length))}}catch(t){}return null}},Gt(t){var i;try{i=JSON.parse(De.Wt(t))||{}}catch(t){}return i},Xt(t,i,e,r,s){if(st)try{var n="",o="",a=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=st),Me)return Me;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),r=Math.min(e.length,8),s="dmn_chk_"+Ce();!Me&&r--;){var n=e.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";i.cookie=o+";max-age=3",i.cookie.includes(s)&&(i.cookie=o+";max-age=0",Me=n)}return Me}(t);if(!e){var r=(t=>{var i=t.match(Ae);return i?i[0]:""})(t);r!==e&&fe.info("Warning: cookie subdomain discovery mismatch",r,e),e=r}return e?"; domain=."+e:""}return""}(st.location.hostname,r);if(e){var l=new Date;l.setTime(l.getTime()+864e5*e),n="; expires="+l.toUTCString()}s&&(o="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(i))+n+"; SameSite=Lax; path=/"+a+o;return h.length>3686.4&&fe.warn("cookieStore warning: large cookie, len="+h.length),st.cookie=h,h}catch(t){return}},Jt(t,i){if(null!=st&&st.cookie)try{De.Xt(t,"",-1,i)}catch(t){return}}},je=null,Le={Yt(){if(!Tt(je))return je;var t=!0;if(kt(it))t=!1;else try{var i="__mplssupport__";Le.Xt(i,"xyz"),'"xyz"'!==Le.Wt(i)&&(t=!1),Le.Jt(i)}catch(i){t=!1}return t||fe.error("localStorage unsupported; falling back to cookie store"),je=t,t},Ut(t){fe.error("localStorage error: "+t)},Wt(t){try{return null==it?void 0:it.localStorage.getItem(t)}catch(t){Le.Ut(t)}return null},Gt(t){try{return JSON.parse(Le.Wt(t))||{}}catch(t){}return null},Xt(t,i){try{null==it||it.localStorage.setItem(t,JSON.stringify(i))}catch(t){Le.Ut(t)}},Jt(t){try{null==it||it.localStorage.removeItem(t)}catch(t){Le.Ut(t)}}},ze=[a,"distinct_id",y,w,z,L,O],Ue={},Ne={Yt:()=>!0,Ut(t){fe.error("memoryStorage error: "+t)},Wt:t=>Ue[t]||null,Gt:t=>Ue[t]||null,Xt(t,i){Ue[t]=i},Jt(t){delete Ue[t]}},He=null,Be={Yt(){if(!Tt(He))return He;if(He=!0,kt(it))He=!1;else try{var t="__support__";Be.Xt(t,"xyz"),'"xyz"'!==Be.Wt(t)&&(He=!1),Be.Jt(t)}catch(t){He=!1}return He},Ut(t){fe.error("sessionStorage error: ",t)},Wt(t){try{return null==it?void 0:it.sessionStorage.getItem(t)}catch(t){Be.Ut(t)}return null},Gt(t){try{return JSON.parse(Be.Wt(t))||null}catch(t){}return null},Xt(t,i){try{null==it||it.sessionStorage.setItem(t,JSON.stringify(i))}catch(t){Be.Ut(t)}},Jt(t){try{null==it||it.sessionStorage.removeItem(t)}catch(t){Be.Ut(t)}}};class qe{constructor(t){this._instance=t}get Rt(){return this._instance.config}get consent(){return this.Kt()?0:this.Qt}isOptedOut(){return this.Rt.cookieless_mode===W||0===this.consent||-1===this.consent&&(this.Rt.opt_out_capturing_by_default||this.Rt.cookieless_mode===q)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}optInOut(t){this.tr.Xt(this.er,t?1:0,this.Rt.cookie_expiration,this.Rt.cross_subdomain_cookie,this.Rt.secure_cookie)}reset(){this.tr.Jt(this.er,this.Rt.cross_subdomain_cookie)}get er(){var{token:t,opt_out_capturing_cookie_prefix:i,consent_persistence_name:e}=this._instance.config;return e||(i?i+t:"__ph_opt_in_out_"+t)}get Qt(){var t=this.tr.Wt(this.er);return Ut(t)?1:gt(Nt,t)?0:-1}get tr(){var t=this.Rt.opt_out_capturing_persistence_type,i="localStorage"===t?Le:De;if(!this.rr||this.rr!==i){this.rr=i;var e="localStorage"===t?De:Le;e.Wt(this.er)&&(this.rr.Wt(this.er)||this.optInOut(Ut(e.Wt(this.er))),e.Jt(this.er,this.Rt.cross_subdomain_cookie))}return this.rr}Kt(){return!!this.Rt.respect_dnt&&[null==rt?void 0:rt.doNotTrack,null==rt?void 0:rt.msDoNotTrack,dt.doNotTrack].some((t=>Ut(t)))}}var We=pe("[Dead Clicks]"),Ve=()=>!0,Ge=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(g)),r=t.instance.config.capture_dead_clicks;return Ot(r)?r:!!Et(r)||e};class Je{get lazyLoadedDeadClicksAutocapture(){return this.ir}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[g]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.nr((()=>{this.sr()})):this.stop()}nr(t){var i,e;null!=(i=dt.__PosthogExtensions__)&&i.initDeadClicksAutocapture&&t(),null==(e=dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?We.error("failed to load script",i):t()}))}sr(){var t;if(st){if(!this.ir&&null!=(t=dt.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=Et(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};i.__onCapture=this.onCapture,this.ir=dt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.ir.start(st),We.info("starting...")}}else We.error("`document` not found. Cannot start.")}stop(){this.ir&&(this.ir.stop(),this.ir=void 0,We.info("stopping..."))}}var Ke=pe("[SegmentIntegration]");var Ye="posthog-js";function Xe(t,i){var{organization:r,projectId:s,prefix:n,severityAllowList:o=["error"],sendExceptionsToPostHog:a=!0}=void 0===i?{}:i;return i=>{var l,h,u,d,v;if("*"!==o&&!o.includes(i.level)||!t.__loaded)return i;i.tags||(i.tags={});var c=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=c,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var f,p=(null==(l=i.exception)?void 0:l.values)||[],g=p.map((t=>e({},t,{stacktrace:t.stacktrace?e({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>e({},t,{platform:"web:javascript"})))}):void 0}))),_={$exception_message:(null==(h=p[0])?void 0:h.value)||i.message,$exception_type:null==(u=p[0])?void 0:u.type,$exception_level:i.level,$exception_list:g,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||i.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:i.tags};return r&&s&&(_.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+i.event_id),a&&(null==(f=t.exceptions)||f.sendExceptionEvent(_)),i}}class Qe{constructor(t,i,e,r,s,n){this.name=Ye,this.setupOnce=function(o){o(Xe(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Ze{constructor(t){this.ar=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength)&&(fe.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.lr=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.ur()}ur(){var t;this.hr=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.ar)}destroy(){var t;null==(t=this.hr)||t.call(this),this.hr=void 0}doPageView(t,i){var e,r=this.cr(t,i);return this.lr={pathname:null!==(e=null==it?void 0:it.location.pathname)&&void 0!==e?e:"",pageViewId:i,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var i;return this.cr(t,null==(i=this.lr)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.lr)?void 0:t.pageViewId}}cr(t,i){var e=this.lr;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:h,maxContentY:u}=s;if(!(kt(n)||kt(o)||kt(a)||kt(l)||kt(h)||kt(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?Ht(o/n,0,1,fe):1,v=n>1?Ht(a/n,0,1,fe):1,c=l>1?Ht(h/l,0,1,fe):1,f=l>1?Ht(u/l,0,1,fe):1;r=me(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:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}}var tr=t=>{var i=null==st?void 0:st.createElement("a");return kt(i)?null:(i.href=t,i)},ir=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!xt(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){fe.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},er=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");xt(d)&&(i.includes(d[0])?h.push(d[0]+"="+e):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},rr=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},sr="https?://(.*)",nr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],or=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...nr],ar="<masked>",lr=["li_fat_id"];function hr(t,i,e){if(!st)return{};var r,s=i?[...nr,...e||[]]:[],n=ur(er(st.URL,s,ar),t),o=(r={},_e(lr,(function(t){var i=De.Wt(t);r[t]=i||null})),r);return me(o,n)}function ur(t,i){var e=or.concat(i||[]),r={};return _e(e,(function(i){var e=ir(t,i);r[i]=e||null})),r}function dr(t){var i=function(t){return t?0===t.search(sr+"google.([^/?]*)")?"google":0===t.search(sr+"bing.com")?"bing":0===t.search(sr+"yahoo.com")?"yahoo":0===t.search(sr+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",r={};if(!Tt(i)){r.$search_engine=i;var s=st?ir(st.referrer,e):"";s.length&&(r.ph_keyword=s)}return r}function vr(){return navigator.language||navigator.userLanguage}var cr="$direct";function fr(){return(null==st?void 0:st.referrer)||cr}function pr(t,i){var e=t?[...nr,...i||[]]:[],r=null==nt?void 0:nt.href.substring(0,1e3);return{r:fr().substring(0,1e3),u:r?er(r,e,ar):void 0}}function gr(t){var i,{r:e,u:r}=t,s={$referrer:e,$referring_domain:null==e?void 0:e==cr?cr:null==(i=tr(e))?void 0:i.host};if(r){s.$current_url=r;var n=tr(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=ur(r);me(s,o)}if(e){var a=dr(e);me(s,a)}return s}function _r(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function mr(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var br=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class yr{constructor(t,i){this.Rt=t,this.props={},this.dr=!1,this.vr=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(t),this.tr=this.pr(t),this.load(),t.debug&&fe.info("Persistence loaded",t.persistence,e({},this.props)),this.update_config(t,t,i),this.save()}isDisabled(){return!!this.gr}pr(t){-1===br.indexOf(t.persistence.toLowerCase())&&(fe.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var i=function(t){void 0===t&&(t=[]);var i=[...ze,...t];return e({},Le,{Gt(t){try{var i={};try{i=De.Gt(t)||{}}catch(t){}var e=me(i,JSON.parse(Le.Wt(t)||"{}"));return Le.Xt(t,e),e}catch(t){}return null},Xt(t,e,r,s,n,o){try{Le.Xt(t,e,void 0,void 0,o);var a={};i.forEach((t=>{e[t]&&(a[t]=e[t])})),Object.keys(a).length&&De.Xt(t,a,r,s,n,o)}catch(t){Le.Ut(t)}},Jt(t,i){try{null==it||it.localStorage.removeItem(t),De.Jt(t,i)}catch(t){Le.Ut(t)}}})}(t.cookie_persisted_properties||[]),r=t.persistence.toLowerCase();return"localstorage"===r&&Le.Yt()?Le:"localstorage+cookie"===r&&i.Yt()?i:"sessionstorage"===r&&Be.Yt()?Be:"memory"===r?Ne:"cookie"===r?De:i.Yt()?i:De}mr(t){var i=null!=t?t:this.Rt.feature_flag_cache_ttl_ms;if(!i||0>=i)return!1;var e=this.props[C];return!e||"number"!=typeof e||Date.now()-e>i}properties(){var t={};return _e(this.props,((i,e)=>{if(e===x&&Et(i)){if(!this.mr())for(var r=Object.keys(i),s=0;r.length>s;s++)t["$feature/"+r[s]]=i[r[s]]}else-1===H.indexOf(e)&&(t[e]=i)})),t}load(){if(!this.gr){var t=this.tr.Gt(this.vr);t&&(this.props=me({},t))}}save(){this.gr||this.tr.Xt(this.vr,this.props,this.yr,this.br,this.wr,this.Rt.debug)}remove(){this.tr.Jt(this.vr,!1),this.tr.Jt(this.vr,!0)}clear(){this.remove(),this.props={}}register_once(t,i,e){if(Et(t)){kt(i)&&(i="None"),this.yr=kt(e)?this._r:e;var r=!1;if(_e(t,((t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.props[e]=t,r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(Et(t)){this.yr=kt(i)?this._r:i;var e=!1;if(_e(t,((i,r)=>{t.hasOwnProperty(r)&&this.props[r]!==i&&(this.props[r]=i,e=!0)})),e)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.dr){var t=hr(this.Rt.custom_campaign_params,this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties);$t(xe(t))||this.register(t),this.dr=!0}}update_search_keyword(){var t;this.register((t=null==st?void 0:st.referrer)?dr(t):{})}update_referrer_info(){var t;this.register_once({$referrer:fr(),$referring_domain:null!=st&&st.referrer&&(null==(t=tr(st.referrer))?void 0:t.host)||cr},void 0)}set_initial_person_info(){this.props[D]||this.props[j]||this.register_once({[L]:pr(this.Rt.mask_personal_data_properties,this.Rt.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};_e([j,D],(i=>{var e=this.props[i];e&&_e(e,(function(i,e){t["$initial_"+mt(e)]=i}))}));var i,e,r=this.props[L];if(r){var s=(i=gr(r),e={},_e(i,(function(t,i){e["$initial_"+mt(i)]=t})),e);me(t,s)}return t}safe_merge(t){return _e(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,e){if(this._r=this.yr=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!e),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==i.persistence||!((t,i)=>{if(t.length!==i.length)return!1;var e=[...t].sort(),r=[...i].sort();return e.every(((t,i)=>t===r[i]))})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[])){var r=this.pr(t),s=this.props;this.clear(),this.tr=r,this.props=s,this.save()}}set_disabled(t){this.gr=t,this.gr?this.remove():this.save()}set_cross_subdomain(t){t!==this.br&&(this.br=t,this.remove(),this.save())}set_secure(t){t!==this.wr&&(this.wr=t,this.remove(),this.save())}set_event_timer(t,i){var e=this.props[h]||{};e[t]=i,this.props[h]=e,this.save()}remove_event_timer(t){var i=(this.props[h]||{})[t];return kt(i)||(delete this.props[h][t],this.save()),i}get_property(t){return this.props[t]}set_property(t,i){this.props[t]=i,this.save()}}var wr="events",xr="cancelEvents",Sr="survey shown",Er="survey sent",$r="popover",kr=pe("[RateLimiter]");class Pr{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{kr.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void kr.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},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 i,e,r;void 0===t&&(t=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(A))&&void 0!==i?i:{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(A,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}}var Ir=pe("[RemoteConfig]");class Tr{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=dt._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Ir(t){var i,e;null!=(i=dt.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Cr(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(i){t(i.json)}})}load(){try{if(this.remoteConfig)return Ir.info("Using preloaded remote config",this.remoteConfig),this.Sr(this.remoteConfig),void this.kr();if(this._instance.Tr())return void Ir.warn("Remote config is disabled. Falling back to local config.");this.Ir((t=>{if(!t)return Ir.info("No config found after loading remote JS config. Falling back to JSON."),void this.Cr((t=>{this.Sr(t),this.kr()}));this.Sr(t),this.kr()}))}catch(t){Ir.error("Error loading remote config",t)}}stop(){this.Ar&&(clearInterval(this.Ar),this.Ar=void 0)}refresh(){this._instance.Tr()||"hidden"===(null==st?void 0:st.visibilityState)||this._instance.reloadFeatureFlags()}kr(){var t;if(!this.Ar){var i=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==i&&(this.Ar=setInterval((()=>{this.refresh()}),i))}}Sr(t){var i;t||Ir.error("Failed to fetch remote config from PostHog."),this._instance.Sr(null!=t?t:{}),!1!==(null==t?void 0:t.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(i=this._instance.featureFlags)||i.ensureFlagsLoaded())}}var Rr="gzip-js",Fr="base64",Cr=Uint8Array,Or=Uint16Array,Mr=Uint32Array,Ar=new Cr([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]),Dr=new Cr([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]),jr=new Cr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Lr=function(t,i){for(var e=new Or(31),r=0;31>r;++r)e[r]=i+=1<<t[r-1];var s=new Mr(e[30]);for(r=1;30>r;++r)for(var n=e[r];e[r+1]>n;++n)s[n]=n-e[r]<<5|r;return[e,s]},zr=Lr(Ar,2),Ur=zr[1];zr[0][28]=258,Ur[258]=28;for(var Nr=Lr(Dr,0)[1],Hr=new Or(32768),Br=0;32768>Br;++Br){var qr=(43690&Br)>>>1|(21845&Br)<<1;Hr[Br]=((65280&(qr=(61680&(qr=(52428&qr)>>>2|(13107&qr)<<2))>>>4|(3855&qr)<<4))>>>8|(255&qr)<<8)>>>1}var Wr=function(t,i,e){for(var r=t.length,s=0,n=new Or(i);r>s;++s)++n[t[s]-1];var o,a=new Or(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new Or(1<<i);var l=15-i;for(s=0;r>s;++s)if(t[s])for(var h=s<<4|t[s],u=i-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[Hr[d]>>>l]=h}else for(o=new Or(r),s=0;r>s;++s)o[s]=Hr[a[t[s]-1]++]>>>15-t[s];return o},Vr=new Cr(288);for(Br=0;144>Br;++Br)Vr[Br]=8;for(Br=144;256>Br;++Br)Vr[Br]=9;for(Br=256;280>Br;++Br)Vr[Br]=7;for(Br=280;288>Br;++Br)Vr[Br]=8;var Gr=new Cr(32);for(Br=0;32>Br;++Br)Gr[Br]=5;var Jr=Wr(Vr,9,0),Kr=Wr(Gr,5,0),Yr=function(t){return(t/8>>0)+(7&t&&1)},Xr=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof Or?Or:t instanceof Mr?Mr:Cr)(e-i);return r.set(t.subarray(i,e)),r},Qr=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},Zr=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8,t[r+2]|=e>>>16},ts=function(t,i){for(var e=[],r=0;t.length>r;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new Cr(0),0];if(1==s){var o=new Cr(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort((function(t,i){return t.f-i.f})),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,u=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=e[e[d].f>e[h].f?h++:d++],l=e[h!=u&&e[d].f>e[h].f?h++:d++],e[u++]={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 Or(v+1),f=is(e[u-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;for(n.sort((function(t,i){return c[i.s]-c[t.s]||t.f-i.f}));s>r;++r){var m=n[r].s;if(i>=c[m])break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>>=g;p>0;){var b=n[r].s;i>c[b]?p-=1<<i-c[b]++-1:++r}for(;r>=0&&p;--r){var y=n[r].s;c[y]==i&&(--c[y],++p)}f=i}return[new Cr(c),f]},is=function(t,i,e){return-1==t.s?Math.max(is(t.l,i,e+1),is(t.r,i,e+1)):i[t.s]=e},es=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new Or(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;i>=a;++a)if(t[a]==s&&a!=i)++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[e.subarray(0,r),i]},rs=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},ss=function(t,i,e){var r=e.length,s=Yr(i+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]=e[n];return 8*(s+4+r)},ns=function(t,i,e,r,s,n,o,a,l,h,u){Qr(i,u++,e),++s[256];for(var d=ts(s,15),v=d[0],c=d[1],f=ts(n,15),p=f[0],g=f[1],_=es(v),m=_[0],b=_[1],y=es(p),w=y[0],x=y[1],S=new Or(19),E=0;m.length>E;++E)S[31&m[E]]++;for(E=0;w.length>E;++E)S[31&w[E]]++;for(var k=ts(S,7),P=k[0],I=k[1],T=19;T>4&&!P[jr[T-1]];--T);var R,F,C,O,M=h+5<<3,A=rs(s,Vr)+rs(n,Gr)+o,D=rs(s,v)+rs(n,p)+o+14+3*T+rs(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(A>=M&&D>=M)return ss(i,u,t.subarray(l,l+h));if(Qr(i,u,1+(A>D)),u+=2,A>D){R=Wr(v,c,0),F=v,C=Wr(p,g,0),O=p;var j=Wr(P,I,0);for(Qr(i,u,b-257),Qr(i,u+5,x-1),Qr(i,u+10,T-4),u+=14,E=0;T>E;++E)Qr(i,u+3*E,P[jr[E]]);u+=3*T;for(var L=[m,w],z=0;2>z;++z){var U=L[z];for(E=0;U.length>E;++E)Qr(i,u,j[N=31&U[E]]),u+=P[N],N>15&&(Qr(i,u,U[E]>>>5&127),u+=U[E]>>>12)}}else R=Jr,F=Vr,C=Kr,O=Gr;for(E=0;a>E;++E)if(r[E]>255){var N;Zr(i,u,R[257+(N=r[E]>>>18&31)]),u+=F[N+257],N>7&&(Qr(i,u,r[E]>>>23&31),u+=Ar[N]);var H=31&r[E];Zr(i,u,C[H]),u+=O[H],H>3&&(Zr(i,u,r[E]>>>5&8191),u+=Dr[H])}else Zr(i,u,R[r[E]]),u+=F[r[E]];return Zr(i,u,R[256]),u+F[256]},os=new Mr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),as=function(){for(var t=new Mr(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),ls=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function hs(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p(i){for(var e=t,r=0;i.length>r;++r)e=as[255&e^i[r]]^e>>>8;t=e},d(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n,o,a,l,h=(a=10+((s=i).filename&&s.filename.length+1||0),l=8,function(t,i,e,r,s,n){var o=t.length,a=new Cr(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!i||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=ss(l,h,t.subarray(u,d)):(l[u]=!0,h=ss(l,h,t.subarray(u,o)))}else{for(var v=os[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new Or(32768),_=new Or(p+1),m=Math.ceil(e/3),b=2*m,y=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<b)&p},w=new Mr(25e3),x=new Or(288),S=new Or(32),E=0,k=0,P=(u=0,0),I=0,T=0;o>u;++u){var R=y(u),F=32767&u,C=_[R];if(g[F]=C,_[R]=F,u>=I){var O=o-u;if((E>7e3||P>24576)&&O>423){h=ns(t,l,0,w,x,S,k,P,T,u-T,h),P=E=k=0,T=u;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)S[M]=0}var A=2,D=0,j=f,L=F-C&32767;if(O>2&&R==y(u-L))for(var z=Math.min(c,O)-1,U=Math.min(32767,u),N=Math.min(258,O);U>=L&&--j&&F!=C;){if(t[u+A]==t[u+A-L]){for(var H=0;N>H&&t[u+H]==t[u+H-L];++H);if(H>A){if(A=H,D=L,H>z)break;var B=Math.min(L,H-2),q=0;for(M=0;B>M;++M){var W=u-L+M+32768&32767,V=W-g[W]+32768&32767;V>q&&(q=V,C=W)}}}L+=(F=C)-(C=g[F])+32768&32767}if(D){w[P++]=268435456|Ur[A]<<18|Nr[D];var G=31&Ur[A],J=31&Nr[D];k+=Ar[G]+Dr[J],++x[257+G],++S[J],I=u+A,++E}else w[P++]=t[u],++x[t[u]]}}h=ns(t,l,!0,w,x,S,k,P,T,u-T,h)}return Xr(a,0,r+Yr(h)+s)}(n=t,null==(o=i).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)),u=h.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>i.level?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&ls(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;e.length>=r;++r)t[r+10]=e.charCodeAt(r)}}(h,i),ls(h,u-8,e.d()),ls(h,u-4,r),h}var us=!!at||!!ot,ds="text/plain",vs=function(t,i,r){var s;void 0===r&&(r=!0);var[n,o]=t.split("?"),a=e({},i),l=null!==(s=null==o?void 0:o.split("&").map((t=>{var i,[e,s]=t.split("="),n=r&&null!==(i=a[e])&&void 0!==i?i:s;return delete a[e],e+"="+n})))&&void 0!==s?s:[],h=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return _e(t,(function(t,i){kt(t)||kt(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)})),s.join(i)}(a);return h&&l.push(h),n+"?"+l.join("&")},cs=(t,i)=>JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i),fs=t=>{if(t.zt)return t.zt;var{data:i,compression:e}=t;if(i){if(e===Rr){var r=hs(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Cr(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;e>o;++o){if(s+5>r.length){var a=new Cr(s+8+(e-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 Xr(r,0,s)}(cs(i)),{mtime:0});return{contentType:ds,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===Fr){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,i)=>String.fromCharCode(parseInt(i,16))))):t}(cs(i)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:cs(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=cs(i);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},ps=function(){var t=i((function*(t){var i=cs(t.data),r=yield function(t,i){return vt.apply(this,arguments)}(i,n.DEBUG);if(!r)return t;var s=yield r.arrayBuffer();return e({},t,{zt:{contentType:ds,body:s,estimatedSize:s.byteLength}})}));return function(i){return t.apply(this,arguments)}}(),gs=[];ot&&gs.push({transport:"fetch",method(t){var i,r,{contentType:s,body:n,estimatedSize:o}=null!==(i=fs(t))&&void 0!==i?i:{},a=new Headers;_e(t.headers,(function(t,i){a.append(i,t)})),s&&a.append("Content-Type",s);var l=t.url,h=null;if(lt){var u=new lt;h={signal:u.signal,timeout:setTimeout((()=>u.abort()),t.timeout)}}ot(l,e({method:(null==t?void 0:t.method)||"GET",headers:a,keepalive:"POST"===t.method&&52428.8>(o||0),body:n,signal:null==(r=h)?void 0:r.signal},t.fetchOptions)).then((i=>i.text().then((e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){fe.error(t)}null==t.callback||t.callback(r)})))).catch((i=>{fe.error(i),null==t.callback||t.callback({statusCode:0,error:i})})).finally((()=>h?clearTimeout(h.timeout):null))}}),at&&gs.push({transport:"XHR",method(t){var i,e=new at;e.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(i=fs(t))&&void 0!==i?i:{};_e(t.headers,(function(t,i){e.setRequestHeader(i,t)})),r&&e.setRequestHeader("Content-Type",r),t.timeout&&(e.timeout=t.timeout),t.disableXHRCredentials||(e.withCredentials=!0),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(s)}}),null!=rt&&rt.sendBeacon&&gs.push({transport:"sendBeacon",method(t){var i=vs(t.url,{beacon:"1"});try{var e,{contentType:r,body:s}=null!==(e=fs(t))&&void 0!==e?e:{};if(!s)return;var n=s instanceof Blob?s:new Blob([s],{type:r});rt.sendBeacon(i,n)}catch(t){}}});var _s=3e3;class ms{constructor(t,i){this.Er=!0,this.Rr=[],this.Nr=Ht((null==i?void 0:i.flush_interval_ms)||_s,250,5e3,fe.createLogger("flush interval"),_s),this.Mr=t}enqueue(t){this.Rr.push(t),this.Fr||this.Or()}unload(){this.Pr();var t=this.Rr.length>0?this.Lr():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Mr(e({},t,{transport:"sendBeacon"}))}))}enable(){this.Er=!1,this.Or()}Or(){var t=this;this.Er||(this.Fr=setTimeout((()=>{if(this.Pr(),this.Rr.length>0){var i=this.Lr(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&xt(e.data)&&_e(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Mr(e)};for(var r in i)e()}}),this.Nr))}Pr(){clearTimeout(this.Fr),this.Fr=void 0}Lr(){var t={};return _e(this.Rr,(i=>{var r,s=i,n=(s?s.batchKey:null)||s.url;kt(t[n])&&(t[n]=e({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this.Rr=[],t}}var bs=["retriesPerformedSoFar"];class ys{constructor(t){this.Dr=!1,this.Br=3e3,this.Rr=[],this._instance=t,this.Rr=[],this.jr=!0,!kt(it)&&"onLine"in it.navigator&&(this.jr=it.navigator.onLine,this.qr=()=>{this.jr=!0,this.Zr()},this.$r=()=>{this.jr=!1},$e(it,"online",this.qr),$e(it,"offline",this.$r))}get length(){return this.Rr.length}retriableRequest(t){var{retriesPerformedSoFar:i}=t,s=r(t,bs);Ct(i)&&(s.url=vs(s.url,{retry_count:i})),this._instance._send_request(e({},s,{callback:t=>{200===t.statusCode||t.statusCode>=400&&500>t.statusCode||(null!=i?i:0)>=10?null==s.callback||s.callback(t):this.Hr(e({retriesPerformedSoFar:i},s))}}))}Hr(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=Math.random()-.5;return Math.ceil(r+s*(r-e))}(i),r=Date.now()+e;this.Rr.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),fe.warn(s),this.Dr||(this.Dr=!0,this.Vr())}Vr(){if(this.zr&&clearTimeout(this.zr),0===this.Rr.length)return this.Dr=!1,void(this.zr=void 0);this.zr=setTimeout((()=>{this.jr&&this.Rr.length>0&&this.Zr(),this.Vr()}),this.Br)}Zr(){var t=Date.now(),i=[],e=this.Rr.filter((e=>t>e.retryAt||(i.push(e),!1)));if(this.Rr=i,e.length>0)for(var{requestOptions:r}of e)this.retriableRequest(r)}unload(){for(var{requestOptions:t}of(this.zr&&(clearTimeout(this.zr),this.zr=void 0),this.Dr=!1,kt(it)||(this.qr&&(it.removeEventListener("online",this.qr),this.qr=void 0),this.$r&&(it.removeEventListener("offline",this.$r),this.$r=void 0)),this.Rr))try{this._instance._send_request(e({},t,{transport:"sendBeacon"}))}catch(t){fe.error(t)}this.Rr=[]}}class ws{constructor(t){this.Yr=()=>{var t,i,e,r;this.Ur||(this.Ur={});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.Ur.lastScrollY=Math.ceil(n),this.Ur.maxScrollY=Math.max(n,null!==(t=this.Ur.maxScrollY)&&void 0!==t?t:0),this.Ur.maxScrollHeight=Math.max(o,null!==(i=this.Ur.maxScrollHeight)&&void 0!==i?i:0),this.Ur.lastContentY=a,this.Ur.maxContentY=Math.max(a,null!==(e=this.Ur.maxContentY)&&void 0!==e?e:0),this.Ur.maxContentHeight=Math.max(l,null!==(r=this.Ur.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get Wr(){return this._instance.config.scroll_root_selector}getContext(){return this.Ur}resetContext(){var t=this.Ur;return setTimeout(this.Yr,0),t}startMeasuringScrollPosition(){$e(it,"scroll",this.Yr,{capture:!0}),$e(it,"scrollend",this.Yr,{capture:!0}),$e(it,"resize",this.Yr)}scrollElement(){if(!this.Wr)return null==it?void 0:it.document.documentElement;var t=xt(this.Wr)?this.Wr:[this.Wr];for(var i of t){var e=null==it?void 0:it.document.querySelector(i);if(e)return e}}scrollY(){if(this.Wr){var t=this.scrollElement();return t&&t.scrollTop||0}return it&&(it.scrollY||it.pageYOffset||it.document.documentElement.scrollTop)||0}scrollX(){if(this.Wr){var t=this.scrollElement();return t&&t.scrollLeft||0}return it&&(it.scrollX||it.pageXOffset||it.document.documentElement.scrollLeft)||0}}var xs=t=>pr(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class Ss{constructor(t,i,e,r){this.Gr=t=>{var i=this.Xr();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Jr(this._instance)};this.Kr.register({[M]:e})}},this._instance=t,this.Qr=i,this.Kr=e,this.Jr=r||xs,this.Qr.onSessionId(this.Gr)}Xr(){return this.Kr.props[M]}getSetOnceProps(){var t,i=null==(t=this.Xr())?void 0:t.props;return i?"r"in i?gr(i):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return _e(xe(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+mt(e)]=i})),t}}class Es{constructor(){this.ti={}}on(t,i){return this.ti[t]||(this.ti[t]=[]),this.ti[t].push(i),()=>{this.ti[t]=this.ti[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.ti[t]||[])e(i);for(var r of this.ti["*"]||[])r(t,i)}}var $s=pe("[SessionId]");class ks{on(t,i){return this.ei.on(t,i)}constructor(t,i,e){var r;if(this.ri=[],this.ii=void 0,this.ei=new Es,this.ni=(t,i)=>!(!Ct(t)||!Ct(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===W)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rt=t.config,this.Kr=t.persistence,this.si=void 0,this.oi=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ai=i||Ce,this.li=e||Ce;var s=this.Rt.persistence_name||this.Rt.token;if(this._sessionTimeoutMs=1e3*Ht(this.Rt.session_idle_timeout_seconds||1800,60,36e3,$s.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ui(),this.hi="ph_"+s+"_window_id",this.ci="ph_"+s+"_primary_window_exists",this.di()){var n=Be.Gt(this.hi),o=Be.Gt(this.ci);n&&!o?this.si=n:Be.Jt(this.hi),Be.Xt(this.ci,!0)}if(null!=(r=this.Rt.bootstrap)&&r.sessionID)try{var a=(t=>{var i=this.Rt.bootstrap.sessionID.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})();this.vi(this.Rt.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){$s.error("Invalid sessionID in bootstrap",t)}this.fi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return kt(this.ri)&&(this.ri=[]),this.ri.push(t),this.oi&&t(this.oi,this.si),()=>{this.ri=this.ri.filter((i=>i!==t))}}di(){return"memory"!==this.Rt.persistence&&!this.Kr.gr&&Be.Yt()}pi(t){t!==this.si&&(this.si=t,this.di()&&Be.Xt(this.hi,t))}gi(){return this.si?this.si:this.di()?Be.Gt(this.hi):null}vi(t,i,e){t===this.oi&&i===this._sessionActivityTimestamp&&e===this._sessionStartTimestamp||(this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this.oi=t,this.Kr.register({[y]:[i,t,e]}))}mi(){var t=this.Kr.props[y];return xt(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.vi(null,null,null)}destroy(){clearTimeout(this.yi),this.yi=void 0,this.ii&&it&&(it.removeEventListener(Y,this.ii,{capture:!1}),this.ii=void 0),this.ri=[]}fi(){this.ii=()=>{this.di()&&Be.Jt(this.ci)},$e(it,Y,this.ii,{capture:!1})}checkAndGetSessionAndWindowId(t,i){if(void 0===t&&(t=!1),void 0===i&&(i=null),this.Rt.cookieless_mode===W)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var e=i||(new Date).getTime(),[r,s,n]=this.mi(),o=this.gi(),a=Ct(n)&&Math.abs(e-n)>864e5,l=!1,h=!s,u=!h&&!t&&this.ni(e,r);h||u||a?(s=this.ai(),o=this.li(),$s.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:h,activityTimeout:u,sessionPastMaximumLength:a}}),n=e,l=!0):o||(o=this.li(),l=!0);var d=Ct(r)&&t&&!a?r:e,v=Ct(n)?n:(new Date).getTime();return this.pi(o),this.vi(s,d,v),t||this.ui(),l&&this.ri.forEach((t=>t(s,o,l?{noSessionId:h,activityTimeout:u,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:v,changeReason:l?{noSessionId:h,activityTimeout:u,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}ui(){clearTimeout(this.yi),this.yi=setTimeout((()=>{var[t]=this.mi();if(this.ni((new Date).getTime(),t)){var i=this.oi;this.resetSessionId(),this.ei.emit("forcedIdleReset",{idleSessionId:i})}}),1.1*this.sessionTimeoutMs)}}var Ps=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&pt(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>pt(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver},Is=function(t,i){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}};function Ts(t,i,e){return cs({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var Rs={exact:(t,i)=>i.some((i=>t.some((t=>i===t)))),is_not:(t,i)=>i.every((i=>t.every((t=>i!==t)))),regex:(t,i)=>i.some((i=>t.some((t=>Is(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!Is(i,t))))),icontains:(t,i)=>i.map(Fs).some((i=>t.map(Fs).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(Fs).every((i=>t.map(Fs).every((t=>!i.includes(t))))),gt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e>parseFloat(t)))})),lt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e<parseFloat(t)))}))},Fs=t=>t.toLowerCase();function Cs(t,i){return!t||Object.entries(t).every((t=>{var[e,r]=t,s=null==i?void 0:i[e];if(kt(s)||Tt(s))return!1;var n=[String(s)],o=Rs[r.operator];return!!o&&o(r.values,n)}))}var Os="custom",Ms="i.posthog.com";class As{constructor(t){this.bi={},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,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+Ms,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.bi[this.apiHost]||(this.bi[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":Os),this.bi[this.apiHost]}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.uiHost+i;if("flags"===t)return this.flagsApiHost+i;if(this.region===Os)return this.apiHost+i;var e=Ms+i;switch(t){case"assets":return"https://"+this.region+"-assets."+e;case"api":return"https://"+this.region+"."+e}}}var Ds=pe("[Surveys]"),js="seenSurvey_",Ls=(t,i)=>{var e="$survey_"+i+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(e="$survey_"+i+"/"+t.id+"/"+t.current_iteration),e},zs=t=>((t,i)=>{var e=""+t+i.id;return i.current_iteration&&i.current_iteration>0&&(e=""+t+i.id+"_"+i.current_iteration),e})(js,t),Us=["popover","widget","api"],Ns={ignoreConditions:!1,ignoreDelay:!1,displayType:$r},Hs=pe("[PostHog ExternalIntegrations]"),Bs={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class qs{constructor(t){this._instance=t}nr(t,i){var e;null==(e=dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return Hs.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(i){var e,s,n;!r||null!=(e=dt.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[i]||t.nr(Bs[i],(()=>{var e;null==(e=dt.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[i])||e.start(t._instance)})),!r&&null!=(s=dt.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[i]&&(null==(n=dt.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[i])||n.stop())};for(var[e,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;i(e)}}}var Ws={},Vs=0,Gs=()=>{},Js='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Ks="Surveys module not available",Ys="sanitize_properties is deprecated. Use before_send instead",Xs="Invalid value for property_denylist config: ",Qs="posthog",Zs=!us&&-1===(null==ut?void 0:ut.indexOf("MSIE"))&&-1===(null==ut?void 0:ut.indexOf("Mozilla")),tn=t=>{var i;return e({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Ee(null==st?void 0:st.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Gs,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=t?t:"unset",__preview_deferred_init_extensions:!1,debug:nt&&Pt(null==nt?void 0:nt.search)&&-1!==nt.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==it||null==(i=it.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){fe.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:J,before_send:void 0,request_queue_config:{flush_interval_ms:_s},error_tracking:{},_onCapture:Gs,__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}))(t))},en=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],rn=t=>{var i={};for(var[e,r]of en)kt(t[e])||(i[r]=t[e]);var s=me({},i,t);return xt(t.property_blacklist)&&(kt(t.property_denylist)?s.property_denylist=t.property_blacklist:xt(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:fe.error(Xs+t.property_denylist)),s};class sn{constructor(){this.__forceAllowLocalhost=!1}get wi(){return this.__forceAllowLocalhost}set wi(t){fe.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class nn{Ii(t,i){if(t){var e=this.Ci.indexOf(t);-1!==e&&this.Ci.splice(e,1)}return this.Ci.push(i),null==i.initialize||i.initialize(),i}get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new sn,this.Si=!1,this.version=n.LIB_VERSION,this.ki=new Es,this.Ci=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=tn(),this.SentryIntegration=Qe,this.sentryIntegration=t=>function(t,i){var e=Xe(t,i);return{name:Ye,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.xi=!1,this.Ti=null,this.Ai=null,this.Ei=null,this.scrollManager=new ws(this),this.pageViewManager=new Ze(this),this.rateLimiter=new Pr(this),this.requestRouter=new As(this),this.consent=new qe(this),this.externalIntegrations=new qs(this);var i=null!==(t=nn.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,i,e)=>{var r=Pt(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=Pt(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>fe.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==Qs){var r,s=null!==(r=Ws[e])&&void 0!==r?r:new nn;return s._init(t,i,e),Ws[e]=s,Ws[Qs][e]=s,s}return this._init(t,i,e)}_init(t,i,r){var s,o;if(void 0===i&&(i={}),kt(t)||It(t))return fe.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.Ri(i.debug),this.Ni=i,this.Mi=[],i.person_profiles?this.Ai=i.person_profiles:i.process_person&&(this.Ai=i.process_person),this.set_config(me({},tn(i.defaults),rn(i),{name:r,token:t})),this.config.on_xhr_error&&fe.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Rr;var a=this.Fi();this.persistence=new yr(this.config,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new yr(e({},this.config,{persistence:"sessionStorage"}),a);var l=e({},this.persistence.props),h=e({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Oi=new ms((t=>this.Pi(t)),this.config.request_queue_config),this.Li=new ys(this),this.__request_queue=[];var u=this.config.cookieless_mode===W||this.config.cookieless_mode===q&&this.consent.isExplicitlyOptedOut();if(u||(this.sessionManager=new ks(this),this.sessionPropsManager=new Ss(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(fe.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Di(u)}),0)):(fe.info("Initializing extensions synchronously"),this.Di(u)),n.DEBUG=n.DEBUG||this.config.debug,n.DEBUG&&fe.info("Starting in debug mode",{this:this,config:i,thisC:e({},this.config),p:l,s:h}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=e({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=i.bootstrap)?void 0:o.distinctID)){var d=i.bootstrap.distinctID,v=this.get_distinct_id(),c=this.persistence.get_property(O);if(i.bootstrap.isIdentifiedID&&null!=v&&v!==d&&c===V)this.identify(d);else if(i.bootstrap.isIdentifiedID&&null!=v&&v!==d&&c===G)fe.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 f=this.config.get_device_id(Ce()),p=i.bootstrap.isIdentifiedID?f:d;this.persistence.set_property(O,i.bootstrap.isIdentifiedID?G:V),this.register({distinct_id:d,$device_id:p})}}if(u)this.register_once({distinct_id:N,$device_id:null},"");else if(!this.get_distinct_id()){var g=this.config.get_device_id(Ce());this.register_once({distinct_id:g,$device_id:g},""),this.persistence.set_property(O,V)}return $e(it,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?function(t,i){var e=t.config.segment;if(!e)return i();!function(t,i){var e=t.config.segment;if(!e)return i();var r=e=>{var r=()=>e.anonymousId()||Ce();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(O,G)),i()},s=e.user();"then"in s&&St(s.then)?s.then(r):r(s)}(t,(()=>{e.register((t=>{Promise&&Promise.resolve||Ke.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,e)=>{if(!e)return i;i.event.userId||i.event.anonymousId===t.get_distinct_id()||(Ke.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(Ke.info("UserId set, identifying with PostHog"),t.identify(i.event.userId));var r=t.calculateEventProperties(e,i.event.properties);return i.event.properties=Object.assign({},r,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>i(t,t.event.event),page:t=>i(t,X),identify:t=>i(t,Z),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}(this,(()=>this.Bi())):this.Bi(),St(this.config._onCapture)&&this.config._onCapture!==Gs&&(fe.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&fe.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}Di(t){var i,r,s,n,o,a,l,h=performance.now(),u=e({},nn.__defaultExtensionClasses,this.config.__extensionClasses),d=[];u.featureFlags&&this.Ci.push(this.featureFlags=null!==(i=this.featureFlags)&&void 0!==i?i:new u.featureFlags(this)),u.exceptions&&this.Ci.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new u.exceptions(this)),u.historyAutocapture&&this.Ci.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.Ci.push(new u.tracingHeaders(this)),u.siteApps&&this.Ci.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.Ci.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.Ci.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.Ci.push(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new u.surveys(this)),u.logs&&this.Ci.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new u.logs(this)),u.conversations&&this.Ci.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new u.conversations(this)),u.productTours&&this.Ci.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.Ci.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.Ci.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.Ci.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.Ci.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Ge)),u.toolbar&&this.Ci.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new u.toolbar(this)),u.experiments&&this.Ci.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new u.experiments(this)),this.Ci.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.ji){var t=this.ji;this.ji=void 0,this.Sr(t)}})),this.qi(d,h)}qi(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.qi(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){fe.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({$sdk_debug_extensions_init_method:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",$sdk_debug_extensions_init_time_ms:r}),this.config.__preview_deferred_init_extensions&&fe.info("PostHog extensions initialized ("+r+"ms)")}Sr(t){var i;if(!st||!st.body)return fe.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Sr(t)}),500);this.config.__preview_deferred_init_extensions&&(this.ji=t),this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=gt(t.supportedCompression,Rr)?Rr:gt(t.supportedCompression,Fr)?Fr:void 0),null!=(i=t.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Ai?this.Ai:J}),this.Ci.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}Bi(){try{this.config.loaded(this)}catch(t){fe.critical("`loaded` function failed",t)}if(this.Zi(),this.config.internal_or_test_user_hostname&&null!=nt&&nt.hostname){var t=nt.hostname,i=this.config.internal_or_test_user_hostname;("string"==typeof i?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode===W)&&this.$i()}),1),this.Hi=new Tr(this),this.Hi.load()}Zi(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Oi)||t.enable())}_dom_loaded(){this.is_capturing()&&ge(this.__request_queue,(t=>this.Pi(t))),this.__request_queue=[],this.Zi()}_handle_unload(){var t,i,e;null==(t=this.surveys)||t.handlePageUnload(),this.config.request_batching?(this.Vi()&&this.capture(Q),null==(i=this.Oi)||i.unload(),null==(e=this.Li)||e.unload()):this.Vi()&&this.capture(Q,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(Zs?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=vs(t.url,{ip:this.config.ip?1:0}),t.headers=e({},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 i,r,s,o=e({},t);o.timeout=o.timeout||6e4,o.url=vs(o.url,{_:(new Date).getTime().toString(),ver:n.JS_SDK_VERSION,compression:o.compression});var a=null!==(i=o.transport)&&void 0!==i?i:"fetch",l=gs.filter((t=>!o.disableTransport||!t.transport||!o.disableTransport.includes(t.transport))),h=null!==(r=null==(s=function(t,i){for(var e=0;t.length>e;e++)if(t[e].transport===a)return t[e]}(l))?void 0:s.method)&&void 0!==r?r:l[0].method;if(!h)throw new Error("No available transport method");"sendBeacon"!==a&&o.data&&o.compression===Rr&&ht?ps(o).then((t=>{h(t)})).catch((()=>{h(o)})):h(o)})(e({},t,{callback:i=>{var e,r;this.rateLimiter.checkForLimiting(i),400>i.statusCode||null==(e=(r=this.config).on_request_error)||e.call(r,i),null==t.callback||t.callback(i)}}))))}Pi(t){this.Li?this.Li.retriableRequest(t):this._send_request(t)}_execute_array(t){Vs++;try{var i,e=[],r=[],s=[];ge(t,(t=>{t&&(xt(i=t[0])?s.push(t):St(t)?t.call(this):xt(t)&&"alias"===i?e.push(t):xt(t)&&-1!==i.indexOf("capture")&&St(this[i])?s.push(t):r.push(t))}));var n=function(t,i){ge(t,(function(t){if(xt(t[0])){var e=i;_e(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else i[t[0]].apply(i,t.slice(1))}))};n(e,this),n(r,this),n(s,this)}finally{Vs--}}push(t){if(Vs>0&&xt(t)&&Pt(t[0])){var i=nn.prototype[t[0]];St(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,i,r){var s,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Oi){if(this.is_capturing())if(!kt(t)&&Pt(t)){var h=!this.config.opt_out_useragent_filter&&this._is_bot();if(!h||this.config.__preview_capture_bot_pageviews){var u=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=i&&i.$current_url&&!Pt(null==i?void 0:i.$current_url)&&(fe.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||null!=r&&r.zi||fe.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 d=new Date,v=(null==r?void 0:r.timestamp)||d,c=Ce(),f={uuid:c,event:t,properties:this.calculateEventProperties(t,i||{},v,c)};t===X&&this.config.__preview_capture_bot_pageviews&&h&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),u&&(f.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==r?void 0:r.$set)&&(f.$set=null==r?void 0:r.$set);var p,g=this.Yi(null==r?void 0:r.$set_once,t!==tt,t===Z);if(g&&(f.$set_once=g),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,o=f,a=t=>Pt(t)?t.slice(0,n):t,l=new Set,f=function t(i,e){return i!==Object(i)?a?a(i):i:l.has(i)?void 0:(l.add(i),xt(i)?(r=[],ge(i,(i=>{r.push(t(i))}))):(r={},_e(i,((i,e)=>{l.has(i)||(r[e]=t(i,e))}))),r);var r}(o)),f.timestamp=v,kt(null==r?void 0:r.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=d),"survey dismissed"===t||t===Er){var _=null==i?void 0:i.$survey_id,m=null==i?void 0:i.$survey_iteration;p={id:_,current_iteration:m},localStorage.getItem(zs(p))||localStorage.setItem(zs(p),"true"),f.$set=e({},f.$set,{[Ls({id:_,current_iteration:m},t===Er?"responded":"dismissed")]:!0})}else t===Sr&&(f.$set=e({},f.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===t){var b=null==i?void 0:i.$product_tour_type;b&&(f.$set=e({},f.$set,{["$product_tour_last_seen_date/"+b]:(new Date).toISOString()}))}var y=e({},f.properties.$set,f.$set);if($t(y)||this.setPersonPropertiesForFlags(y),!Rt(this.config.before_send)){var w=this.Ui(f);if(!w)return;f=w}this.ki.emit("eventCaptured",f);var x={method:"POST",url:null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:f,compression:"best-available",batchKey:null==r?void 0:r._batchKey};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this.Pi(x):this.Oi.enqueue(x),f}fe.critical("This capture call is ignored due to client rate limiting.")}}else fe.error("No event name provided to posthog.capture")}else fe.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(i=>t(i.event,i)))}calculateEventProperties(t,i,r,s,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return i;var a=o?void 0:this.persistence.remove_event_timer(t),l=e({},i);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,(this.config.cookieless_mode==W||this.config.cookieless_mode==q&&this.consent.isExplicitlyOptedOut())&&(l.$cookieless_mode=!0),"$snapshot"===t){var h=e({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=h.distinct_id,(!Pt(l.distinct_id)&&!Ft(l.distinct_id)||It(l.distinct_id))&&fe.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var u,d=function(t,i){var e,r,s,o;if(!ut)return{};var a,l,h,u,d,v,c,f,p=t?[...nr,...i||[]]:[],[g,_]=function(t){for(var i=0;Ui.length>i;i++){var[e,r]=Ui[i],s=e.exec(t),n=s&&(St(r)?r(s,t):r);if(n)return n}return["",""]}(ut);return me(xe({$os:g,$os_version:_,$browser:ji(ut,navigator.vendor),$device:Ni(ut),$device_type:(l=ut,h={userAgentDataPlatform:null==(e=navigator)||null==(e=e.userAgentData)?void 0:e.platform,maxTouchPoints:null==(r=navigator)?void 0:r.maxTouchPoints,screenWidth:null==it||null==(s=it.screen)?void 0:s.width,screenHeight:null==it||null==(o=it.screen)?void 0:o.height,devicePixelRatio:null==it?void 0:it.devicePixelRatio},f=Ni(l),f===Qt||f===Xt||"Kobo"===f||"Kindle Fire"===f||f===Ii?Yt:f===_i||f===bi||f===mi||f===$i?"Console":f===ti?"Wearable":f?Gt:"Android"===(null==h?void 0:h.userAgentDataPlatform)&&(null!==(u=null==h?void 0:h.maxTouchPoints)&&void 0!==u?u:0)>0?600>Math.min(null!==(d=null==h?void 0:h.screenWidth)&&void 0!==d?d:0,null!==(v=null==h?void 0:h.screenHeight)&&void 0!==v?v:0)/(null!==(c=null==h?void 0:h.devicePixelRatio)&&void 0!==c?c:1)?Gt:Yt:"Desktop"),$timezone:_r(),$timezone_offset:mr()}),{$current_url:er(null==nt?void 0:nt.href,p,ar),$host:null==nt?void 0:nt.host,$pathname:null==nt?void 0:nt.pathname,$raw_user_agent:ut.length>1e3?ut.substring(0,997)+"...":ut,$browser_version:zi(ut,navigator.vendor),$browser_language:vr(),$browser_language_prefix:(a=vr(),"string"==typeof a?a.split("-")[0]:void 0),$screen_height:null==it?void 0:it.screen.height,$screen_width:null==it?void 0:it.screen.width,$viewport_height:null==it?void 0:it.innerHeight,$viewport_width:null==it?void 0:it.innerWidth,$lib:n.LIB_NAME,$lib_version:n.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:v,windowId:c}=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime());l.$session_id=v,l.$window_id=c}this.sessionPropsManager&&me(l,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&me(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(f=this.Li)?void 0:f.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Os&&(l.$lib_custom_api_host=this.config.api_host),u=t!==X||o?t!==Q||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),l=me(l,u),t===X&&st&&(l.title=st.title),!kt(a)){var p=r.getTime()-a;l.$duration=parseFloat((p/1e3).toFixed(3))}ut&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=me({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),xt(this.config.property_denylist)?_e(this.config.property_denylist,(function(t){delete l[t]})):fe.error(Xs+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(fe.error(Ys),l=g(l,t));var _=this.Wi();return l.$process_person_profile=_,_&&!o&&this.Gi("_calculate_event_properties"),l}Yi(t,i,e){var r;if(void 0===i&&(i=!0),void 0===e&&(e=!1),!this.persistence||!this.Wi())return t;if(this.Si&&!e)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=me({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(fe.error(Ys),o=a(o,"$set_once")),i&&(this.Si=!0),$t(o)?void 0:o}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i;null==(i=this.sessionPersistence)||i.register(t)}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t)}Xi(t,i){this.register({[t]:i})}getFeatureFlag(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagResult(t,i)}isFeatureEnabled(t,i){var e;return null==(e=this.featureFlags)?void 0:e.isFeatureEnabled(t,i)}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,i,e){var r;null==(r=this.featureFlags)||r.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){var r;return void 0===i&&(i=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.ki.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Ks}),()=>{})}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:Ks})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:Ks})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=Ns),null==(e=this.surveys)||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null==(i=this.surveys)||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null==(e=this.surveys)?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:Ks}}canRenderSurveyAsync(t,i){var e,r;return void 0===i&&(i=!1),null!==(e=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:Ks})}Ji(t){return!t||It(t)?(fe.critical("Unique user id has not been set in posthog.identify"),!1):t===N?(fe.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())||(fe.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,i,e){if(!this.__loaded||!this.persistence)return fe.uninitializedWarning("posthog.identify");if(Ft(t)&&(t=t.toString(),fe.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Ji(t)&&this.Gi("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:t}),this.get_property(a)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),t!==r&&t!==this.get_property(l)&&(this.unregister(l),this.register({distinct_id:t}));var s,n=(this.persistence.get_property(O)||V)===V;t!==r&&n?(this.persistence.set_property(O,G),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.capture(Z,{distinct_id:t,$anon_distinct_id:r},{$set:i||{},$set_once:e||{}}),this.Ei=Ts(t,i,e),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(i||e)&&this.setPersonProperties(i,e),t!==r&&(this.reloadFeatureFlags(),this.unregister(T))}}setPersonProperties(t,i){if((t||i)&&this.Gi("posthog.setPersonProperties")){var e=Ts(this.get_distinct_id(),t,i);this.Ei!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Ei=e):fe.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,i,r){if(t&&i){var s=this.getGroups(),n=s[t]!==i;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:e({},s,{[t]:i})}),n||r){var o={$group_type:t,$group_key:i};r&&(o.$group_set=r),this.capture(tt,o)}r&&this.setGroupPropertiesForFlags({[t]:r}),n&&!r&&this.reloadFeatureFlags()}else fe.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),null==(e=this.featureFlags)||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(){var t;null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),this.Gi("posthog.setGroupPropertiesForFlags")&&(null==(e=this.featureFlags)||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null==(i=this.featureFlags)||i.resetGroupPropertiesForFlags(t)}reset(t){var i,e,r,s,n,o,l,h;if(fe.info("reset"),!this.__loaded)return fe.uninitializedWarning("posthog.reset");var u=this.get_property(a);if(this.consent.reset(),null==(i=this.persistence)||i.clear(),null==(e=this.sessionPersistence)||e.clear(),null==(r=this.surveys)||r.reset(),null==(s=this.Hi)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(l=this.persistence)||l.set_property(O,V),null==(h=this.sessionManager)||h.resetSessionId(),this.Ei=null,this.config.cookieless_mode===W)this.register_once({distinct_id:N,$device_id:null},"");else{var d=this.config.get_device_id(Ce());this.register_once({distinct_id:d,$device_id:t?d: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,i){var e;this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),null==(e=this.conversations)||e.Ki()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.Qi()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:i,sessionStartTimestamp:e}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property(o)?(fe.critical("Attempting to create alias for existing People user - aborting."),-2):this.Gi("posthog.alias")?(kt(i)&&(i=this.get_distinct_id()),t!==i?(this.Xi(l,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(fe.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=e({},this.config);if(Et(t)){var r,s,o,a,l,h,u,d,v;me(this.config,rn(t));var c=this.Fi();null==(r=this.persistence)||r.update_config(this.config,i,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new yr(e({},this.config,{persistence:"sessionStorage"}),c);var f=this.Ri(this.config.debug);Ot(f)&&(this.config.debug=f),Ot(this.config.debug)&&(this.config.debug?(n.DEBUG=!0,Le.Yt()&&Le.Xt("ph_debug",!0),fe.info("set_config",{config:t,oldConfig:i,newConfig:e({},this.config)})):(n.DEBUG=!1,Le.Yt()&&Le.Jt("ph_debug"))),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.autocapture)||a.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),null==(h=this.exceptionObserver)||h.startIfEnabledOrStop(),null==(u=this.deadClicksAutocapture)||u.startIfEnabledOrStop(),null==(d=this.surveys)||d.loadIfEnabled(),this.tn(),null==(v=this.externalIntegrations)||v.startIfEnabledOrStop()}}_overrideSDKInfo(t,i){n.LIB_NAME=t,n.LIB_VERSION=i}startSessionRecording(t){var i,e,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==(i=this.sessionManager)||i.checkAndGetSessionAndWindowId(),a.sampling&&(null==(e=this.sessionRecording)||e.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,i){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(e({},s,i))}}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null==(e=this.toolbar)?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:Qs;return i!==Qs&&(i=Qs+"."+i),i}_isIdentified(){var t,i;return(null==(t=this.persistence)?void 0:t.get_property(O))===G||(null==(i=this.sessionPersistence)?void 0:i.get_property(O))===G}Wi(){var t,i;return!("never"===this.config.person_profiles||this.config.person_profiles===J&&!this._isIdentified()&&$t(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[l])&&(null==(i=this.persistence)||null==(i=i.props)||!i[z]))}Vi(){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.Wi()||this.Gi("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Gi("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Gi(t){return"never"===this.config.person_profiles?(fe.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Xi(z,!0),!0)}Fi(){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!==q)}tn(){var t,i,e,r,s=this.Fi();return(null==(t=this.persistence)?void 0:t.gr)!==s&&(null==(e=this.persistence)||e.set_disabled(s)),(null==(i=this.sessionPersistence)?void 0:i.gr)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==W){if(this.config.cookieless_mode===q&&this.consent.isExplicitlyOptedOut()){var e,r,s,n,o;this.reset(!0),null==(e=this.sessionManager)||e.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new ks(this),this.pageViewManager=new Ze(this),this.persistence&&(this.sessionPropsManager=new Ss(this,this.sessionManager,this.persistence));var a=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=nn.__defaultExtensionClasses)?void 0:o.sessionRecording;a&&(this.sessionRecording=this.Ii(this.sessionRecording,new a(this)))}var l,h;this.consent.optInOut(!0),this.tn(),this.Zi(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),this.config.cookieless_mode==q&&(null==(l=this.surveys)||l.loadIfEnabled()),(kt(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.$i()}else fe.warn(Js)}opt_out_capturing(){var t,i,e;this.config.cookieless_mode!==W?(this.config.cookieless_mode===q&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.tn(),this.config.cookieless_mode===q&&(this.register({distinct_id:N,$device_id:null}),null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,this.$i())):fe.warn(Js)}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===W||(this.config.cookieless_mode===q?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.tn()}_is_bot(){return rt?Ps(rt,this.config.custom_blocked_useragents):void 0}$i(){st&&("visible"===st.visibilityState?this.xi||(this.xi=!0,this.capture(X,{title:st.title},{send_instantly:!0}),this.Ti&&(st.removeEventListener(K,this.Ti),this.Ti=null)):this.Ti||(this.Ti=this.$i.bind(this),$e(st,K,this.Ti)))}debug(t){!1===t?(null==it||it.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==it||it.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}))}Tr(){var t,i,e,r,s,n,o=this.Ni||{};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?(fe.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):(e="advanced_disable_decide",!1,r=fe,s=(i="advanced_disable_flags")in(t=o)&&!Rt(t[i]),n=e in t&&!Rt(t[e]),s?t[i]:!!n&&(r&&r.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e]))}Ui(t){if(Rt(this.config.before_send))return t;var i=xt(this.config.before_send)?this.config.before_send:[this.config.before_send],e=t;for(var r of i){if(e=r(e),Rt(e)){var s="Event '"+t.event+"' was rejected in beforeSend function";return At(t.event)?fe.warn(s+". This can cause unexpected behavior."):fe.info(s),null}e.properties&&!$t(e.properties)||fe.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return e}getPageViewId(){var t;return null==(t=this.pageViewManager.lr)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}Ri(t){var i=Ot(t)&&!t,e=Le.Yt()&&"true"===Le.Wt("ph_debug");return!i&&(!!e||t)}}function on(t){return t instanceof Element&&(t.id===U||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function an(t){return!!t&&1===t.nodeType}function ln(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function hn(t){return!!t&&3===t.nodeType}function un(t){return!!t&&11===t.nodeType}function dn(t){return t?_t(t).split(/\s+/):[]}function vn(t){var i=null==it?void 0:it.location.href;return!!(i&&t&&t.some((t=>i.match(t))))}function cn(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return dn(i)}function fn(t){return Rt(t)?null:_t(t).split(/(\s+)/).filter((t=>Cn(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function pn(t){var i="";return En(t)&&!$n(t)&&t.childNodes&&t.childNodes.length&&_e(t.childNodes,(function(t){var e;hn(t)&&t.textContent&&(i+=null!==(e=fn(t.textContent))&&void 0!==e?e:"")})),_t(i)}function gn(t){return kt(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null;var i}nn.__defaultExtensionClasses={},function(t,i){for(var e=0;i.length>e;e++)t.prototype[i[e]]=we(t.prototype[i[e]])}(nn,["identify"]);var _n=["a","button","form","input","select","textarea","label"];function mn(t,i){if(kt(i))return!0;var e,r=function(t){if(i.some((i=>t.matches(i))))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function bn(t){var i=t.parentNode;return!(!i||!an(i))&&i}var yn=["next","previous","prev",">","<"],wn=[".ph-no-rageclick",".ph-no-capture"];var xn=t=>!t||ln(t,"html")||!an(t),Sn=(t,i)=>{if(!it||xn(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var e=!1,r=[t],s=t;s.parentNode&&!ln(s,"body");)if(un(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=bn(s);if(!n)break;if(i||_n.indexOf(n.tagName.toLowerCase())>-1)e=!0;else{var o=it.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(e=!0)}r.push(n),s=n}return{parentIsUsefulElement:e,targetElementList:r}};function En(t){for(var i=t;i.parentNode&&!ln(i,"body");i=i.parentNode){var e=cn(i);if(gt(e,"ph-sensitive")||gt(e,"ph-no-capture"))return!1}if(gt(cn(t),"ph-include"))return!0;var r=t.type||"";if(Pt(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!Pt(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 $n(t){return!!(ln(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||ln(t,"select")||ln(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var kn="(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})",Pn=new RegExp("^(?:"+kn+")$"),In=new RegExp(kn),Tn="\\d{3}-?\\d{2}-?\\d{4}",Rn=new RegExp("^("+Tn+")$"),Fn=new RegExp("("+Tn+")");function Cn(t,i){if(void 0===i&&(i=!0),Rt(t))return!1;if(Pt(t)){if(t=_t(t),(i?Pn:In).test((t||"").replace(/[- ]/g,"")))return!1;if((i?Rn:Fn).test(t))return!1}return!0}function On(t){var i=pn(t);return Cn(i=(i+" "+Mn(t)).trim())?i:""}function Mn(t){var i="";return t&&t.childNodes&&t.childNodes.length&&_e(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=pn(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+Mn(t)).trim())}catch(t){fe.error("[AutoCapture]",t)}})),i}function An(t){return t.replace(/"|\\"/g,'\\"')}function Dn(t){var i=t.attr__class;return i?xt(i)?i:dn(i):void 0}class jn{constructor(t){this.disabled=!1===t;var i=Et(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<this.thresholdPx&&this.timeoutMs>e-r.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}}var Ln="$copy_autocapture",zn=pe("[AutoCapture]");function Un(t,i){return i.length>t?i.slice(0,t)+"...":i}function Nn(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!an(i));return i}function Hn(t,i){for(var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:h}=i,u=[t],d=t;d.parentNode&&!ln(d,"body");)un(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var v,c,f=[],p={},g=!1,_=!1;if(_e(u,(t=>{var i=En(t);"a"===t.tagName.toLowerCase()&&(g=t.getAttribute("href"),g=i&&g&&Cn(g)&&g),gt(cn(t),"ph-no-capture")&&(_=!0),f.push(function(t,i,e,r){var s=t.tagName.toLowerCase(),n={tag_name:s};_n.indexOf(s)>-1&&!e&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?Un(1024,On(t)):Un(1024,pn(t)));var o=cn(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),_e(t.attributes,(function(e){var s;if((!$n(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&Cn(e.value)&&(!Pt(s=e.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=e.value;"class"===e.name&&(o=dn(o).join(" ")),n["attr__"+e.name]=Un(1024,o)}}));for(var a=1,l=1,h=t;h=Nn(h);)a++,h.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(t,o,a,l));var e=function(t){if(!En(t))return{};var i={};return _e(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&Cn(r)&&(i[e]=r)}})),i}(t);me(p,e)})),_)return{props:{},explicitNoCapture:_};if(a||(f[0].$el_text="a"===t.tagName.toLowerCase()||"button"===t.tagName.toLowerCase()?On(t):pn(t)),g){var m,b;f[0].attr__href=g;var y=null==(m=tr(g))?void 0:m.host,w=null==it||null==(b=it.location)?void 0:b.host;y&&w&&y!==w&&(v=g)}return{props:me({$event_type:n.type,$ce_version:1},h?{}:{$elements:f},{$elements_chain:(c=f,function(t){return t.map((t=>{var i,r,s="";if(t.tag_name&&(s+=t.tag_name),t.attr_class)for(var n of(t.attr_class.sort(),t.attr_class))s+="."+n.replace(/"/g,"");var o=e({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(r=t.nth_of_type)&&void 0!==r?r:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),a={};return be(o).sort(((t,i)=>{var[e]=t,[r]=i;return e.localeCompare(r)})).forEach((t=>{var[i,e]=t;return a[An(i.toString())]=An(e.toString())})),(s+=":")+be(a).map((t=>{var[i,e]=t;return i+'="'+e+'"'})).join("")})).join(";")}(function(t){return t.map((t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:Dn(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return be(t).filter((t=>{var[i]=t;return 0===i.indexOf("attr__")})).forEach((t=>{var[i,e]=t;return r.attributes[i]=e})),r}))}(c)))},null!=(r=f[0])&&r.$el_text?{$el_text:null==(s=f[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},p)}}var Bn=pe("[ExceptionAutocapture]");function qn(t,i,e){try{if(!(i in t))return()=>{};var r=t[i],s=e(r);return St(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[i]=s,()=>{t[i]=r}}catch(t){return()=>{}}}var Wn=pe("[TracingHeaders]"),Vn=pe("[Web Vitals]"),Gn=9e5,Jn="disabled",Kn="lazy_loading",Yn="awaiting_config",Xn="missing_config";pe("[SessionRecording]");var Qn="[SessionRecording]",Zn=pe(Qn),to=pe("[Heatmaps]");function io(t){return Et(t)&&"clientX"in t&&"clientY"in t&&Ft(t.clientX)&&Ft(t.clientY)}var eo=pe("[Product Tours]"),ro="ph_product_tours",so=["$set_once","$set"],no=pe("[SiteApps]"),oo="Error while initializing PostHog app with config id ";function ao(t,i,e){if(Rt(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}class lo{constructor(t){this.en=new Es,this.rn=(t,i)=>this.nn(t,i)&&this.sn(t,i)&&this.an(t,i)&&this.ln(t,i),this.nn=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t,this.un=new Set,this.hn=new Set}init(){var t,i;kt(null==(t=this._instance)?void 0:t._addCaptureHook)||(null==(i=this._instance)||i._addCaptureHook(((t,i)=>{this.on(t,i)})))}register(t){var i,e;if(!kt(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach((t=>{var i,e;null==(i=this.hn)||i.add(t),null==(e=t.steps)||e.forEach((t=>{var i;null==(i=this.un)||i.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r,s=new Set;t.forEach((t=>{var i;null==(i=t.steps)||i.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,i){var e;null!=i&&0!=t.length&&(this.un.has(t)||this.un.has(null==i?void 0:i.event))&&this.hn&&(null==(e=this.hn)?void 0:e.size)>0&&this.hn.forEach((t=>{this.cn(i,t)&&this.en.emit("actionCaptured",t.name)}))}dn(t){this.onAction("actionCaptured",(i=>t(i)))}cn(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.rn(t,e))return!0;return!1}onAction(t,i){return this.en.on(t,i)}sn(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!ao(r,i.url,i.url_matching||"contains"))return!1}return!0}an(t,i){return!!this.vn(t,i)&&!!this.fn(t,i)&&!!this.pn(t,i)}vn(t,i){var e;if(null==i||!i.href)return!0;var r=this.gn(t);if(r.length>0)return r.some((t=>ao(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&ao((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}fn(t,i){var e;if(null==i||!i.text)return!0;var r=this.gn(t);if(r.length>0)return r.some((t=>ao(t.text,i.text,i.text_matching||"exact")||ao(t.$el_text,i.text,i.text_matching||"exact")));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!Rt(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some((t=>ao(t,n,o))))}pn(t,i){var e,r;if(null==i||!i.selector)return!0;var s=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(null!=s&&s.includes(i.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&n)try{return new RegExp(i.selector_regex).test(n)}catch(t){return!1}return!1}gn(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}ln(t,i){return null==i||!i.properties||0===i.properties.length||Cs(i.properties.reduce(((t,i)=>{var e=xt(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class ho{constructor(t){this._instance=t,this.mn=new Map,this.yn=new Map,this.bn=new Map}wn(t,i){return!!t&&Cs(t.propertyFilters,null==i?void 0:i.properties)}_n(t,i){var e=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach((i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}}))})),e}In(t,i,e){var r=(e===wr?this.mn:this.yn).get(t),s=[];return this.Cn((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[e])||null==(s=s.values)?void 0:s.find((i=>i.name===t));return this.wn(n,i)}))}register(t){var i;kt(null==(i=this._instance)?void 0:i._addCaptureHook)||(this.Sn(t),this.kn(t))}kn(t){var i=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.actions)&&(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)?void 0:e.length)>0}));0!==i.length&&(null==this.xn&&(this.xn=new lo(this._instance),this.xn.init(),this.xn.dn((t=>{this.onAction(t)}))),i.forEach((t=>{var i,e,r,s,n;t.conditions&&null!=(i=t.conditions)&&i.actions&&null!=(e=t.conditions)&&null!=(e=e.actions)&&e.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.xn)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((i=>{if(i&&i.name){var e=this.bn.get(i.name);e&&e.push(t.id),this.bn.set(i.name,e||[t.id])}})))})))}Sn(t){var i,e=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0})),r=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0}));0===e.length&&0===r.length||(null==(i=this._instance)||i._addCaptureHook(((t,i)=>{this.onEvent(t,i)})),this.mn=this._n(t,wr),this.yn=this._n(t,xr))}onEvent(t,i){var e,r=this.re(),s=this.Tn(),n=this.An(),o=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[s])||[];if(n===t&&i&&o.length>0){var a,l;r.info("event matched, removing item from activated items",{event:t,eventPayload:i,existingActivatedItems:o});var h=(null==i||null==(a=i.properties)?void 0:a.$survey_id)||(null==i||null==(l=i.properties)?void 0:l.$product_tour_id);if(h){var u=o.indexOf(h);0>u||(o.splice(u,1),this.En(o))}}else{if(this.yn.has(t)){var d=this.In(t,i,xr);d.length>0&&(r.info("cancel event matched, cancelling items",{event:t,itemsToCancel:d.map((t=>t.id))}),d.forEach((t=>{var i=o.indexOf(t.id);0>i||o.splice(i,1),this.Rn(t.id)})),this.En(o))}if(this.mn.has(t)){r.info("event name matched",{event:t,eventPayload:i,items:this.mn.get(t)});var v=this.In(t,i,wr);this.En(o.concat(v.map((t=>t.id))||[]))}}}onAction(t){var i,e=this.Tn(),r=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[e])||[];this.bn.has(t)&&this.En(r.concat(this.bn.get(t)||[]))}En(t){var i,e=this.re(),r=this.Tn(),s=[...new Set(t)].filter((t=>!this.Nn(t)));e.info("updating activated items",{activatedItems:s}),null==(i=this._instance)||null==(i=i.persistence)||i.register({[r]:s})}getActivatedIds(){var t,i=this.Tn();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}getEventToItemsMap(){return this.mn}Mn(){return this.xn}}class uo extends ho{constructor(t){super(t)}Tn(){return"$surveys_activated"}An(){return Sr}Cn(t){var i;null==(i=this._instance)||i.getSurveys(t)}Rn(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}re(){return Ds}Nn(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var vo="SDK is not enabled or survey functionality is not yet loaded",co="Disabled. Not loading surveys.",fo=null!=it&&it.location?rr(it.location.hash,"__posthog")||rr(location.hash,"state"):null,po="_postHogToolbarParams",go=pe("[Toolbar]"),_o=pe("[FeatureFlags]"),mo=pe("[FeatureFlags]",{debugEnabled:!0}),bo="\" failed. Feature flags didn't load in time.",yo="$active_feature_flags",wo="$override_feature_flags",xo="$feature_flag_payloads",So="$override_feature_flag_payloads",Eo="$feature_flag_request_id",$o=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},ko=t=>{var i={};for(var[e,r]of be(t||{}))r&&(i[e]=r);return i},Po=pe("[Error tracking]"),Io="Refusing to render web experiment since the viewer is a likely bot",To={icontains:(t,i)=>!!it&&i.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>!!it&&-1===i.href.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>!!it&&Is(i.href,t),not_regex:(t,i)=>!!it&&!Is(i.href,t),exact:(t,i)=>i.href===t,is_not:(t,i)=>i.href!==t};class Ro{get Rt(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{Ro.Fn("retrieved web experiments from the server"),i.On=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;i.On&&(Ro.Fn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.On)||e.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);Pt(r)&&t.variants[r]&&i.Pn(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Ro.Ln(n)&&i.Pn(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Ro.Fn(Io);else if(!this.Rt.disable_web_experiments){if(Rt(this.On))return this.On=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Ro.Fn("applying feature flags",t),t.forEach((t=>{var i;if(this.On&&null!=(i=this.On)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.On)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.Pn(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Ro.getWindowLocation();if(null!=t&&t.search){var i=ir(null==t?void 0:t.search,"__experiment_id"),e=ir(null==t?void 0:t.search,"__experiment_variant");i&&e&&(Ro.Fn("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.Dn(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this.Rt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.Rt.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Rt.token),method:"GET",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}Dn(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(Ro.Fn("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.Pn(r[0].name,i,r[0].variants[i].transforms))}static Ln(t){return!Rt(t.conditions)&&Ro.Bn(t)&&Ro.jn(t)}static Bn(t){var i;if(Rt(t.conditions)||Rt(null==(i=t.conditions)?void 0:i.url))return!0;var e,r,s,n=Ro.getWindowLocation();return!!n&&(null==(e=t.conditions)||!e.url||To[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==it?void 0:it.location}static jn(t){var i;if(Rt(t.conditions)||Rt(null==(i=t.conditions)?void 0:i.utm))return!0;var e=hr();if(e.utm_source){var r,s,n,o,a,l,h,u,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)==e.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)==e.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)==e.utm_medium,f=null==(h=t.conditions)||null==(h=h.utm)||!h.utm_term||(null==(u=t.conditions)||null==(u=u.utm)?void 0:u.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static Fn(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];fe.info("[WebExperiments] "+t,e)}Pn(t,i,e){this._is_bot()?Ro.Fn(Io):"control"!==i?e.forEach((e=>{if(e.selector){var r;Ro.Fn("applying transform of variant "+i+" for experiment "+t+" ",e);var s=null==(r=document)?void 0:r.querySelectorAll(e.selector);null==s||s.forEach((t=>{var i=t;e.html&&(i.innerHTML=e.html),e.css&&i.setAttribute("style",e.css)}))}})):Ro.Fn("Control variants leave the page unmodified.")}_is_bot(){return rt&&this._instance?Ps(rt,this.Rt.custom_blocked_useragents):void 0}}var Fo=pe("[Conversations]"),Co="Conversations not available yet.",Oo={featureFlags:class{constructor(t){this.qn=!1,this.Zn=!1,this.$n=!1,this.Hn=!1,this.Vn=!1,this.zn=!1,this.Yn=!1,this.Un=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Rt(){return this._instance.config}get Kr(){return this._instance.persistence}Wn(t){return this._instance.get_property(t)}Gn(){var t,i;return null!==(t=null==(i=this.Kr)?void 0:i.mr(this.Rt.feature_flag_cache_ttl_ms))&&void 0!==t&&t}Xn(){return!!this.Gn()&&(this.Un||this.$n||(this.Un=!0,_o.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Jn(){var t,i=null!==(t=this.Rt.evaluation_contexts)&&void 0!==t?t:this.Rt.evaluation_environments;return!this.Rt.evaluation_environments||this.Rt.evaluation_contexts||this.Yn||(_o.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Yn=!0),null!=i&&i.length?i.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||_o.error("Invalid evaluation context found:",t,"Expected non-empty string"),i})):[]}Kn(){return this.Jn().length>0}initialize(){var t,i,{config:e}=this._instance,r=null!==(t=null==(i=e.bootstrap)?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,i)=>(t[i]=r[i]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,i)=>(o[i]&&(t[i]=o[i]),t)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,i,r){var s=null!=r&&r.merge?this.getFlagVariants():{},n=null!=r&&r.merge?this.getFlagPayloads():{},o=e({},s,t),a=e({},n,i),l={};for(var[h,u]of Object.entries(o)){var d="string"==typeof u;l[h]={key:h,enabled:!!d||Boolean(u),variant:d?u:void 0,reason:void 0,metadata:kt(null==a?void 0:a[h])?void 0:{id:0,version:void 0,description:void 0,payload:a[h]}}}this.receivedFeatureFlags({flags:l})}get hasLoadedFlags(){return this.Zn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Wn(E),i=this.Wn(wo),r=this.Wn(So);if(!r&&!i)return t||{};var s=me({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(i||{})])];for(var o of n){var a,l,h=s[o],u=null==i?void 0:i[o],d=kt(u)?null!==(a=null==h?void 0:h.enabled)&&void 0!==a&&a:!!u,v=kt(u)?h.variant:"string"==typeof u?u:void 0,c=null==r?void 0:r[o],f=e({},h,{enabled:d,variant:d?null!=v?v:null==h?void 0:h.variant:void 0});d!==(null==h?void 0:h.enabled)&&(f.original_enabled=null==h?void 0:h.enabled),v!==(null==h?void 0:h.variant)&&(f.original_variant=null==h?void 0:h.variant),c&&(f.metadata=e({},null==h?void 0:h.metadata,{payload:c,original_payload:null==h||null==(l=h.metadata)?void 0:l.payload})),s[o]=f}return this.qn||(_o.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.qn=!0),s}getFlagVariants(){var t=this.Wn(x),i=this.Wn(wo);if(!i)return t||{};for(var e=me({},t),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.qn||(_o.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.qn=!0),e}getFlagPayloads(){var t=this.Wn(xo),i=this.Wn(So);if(!i)return t||{};for(var e=me({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.qn||(_o.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.qn=!0),e}reloadFeatureFlags(){this.Hn||this.Rt.advanced_disable_feature_flags||this.Qn||(this._instance.ki.emit("featureFlagsReloading",!0),this.Qn=setTimeout((()=>{this.ts()}),5))}es(){clearTimeout(this.Qn),this.Qn=void 0}ensureFlagsLoaded(){this.Zn||this.$n||this.Qn||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Hn=t}ts(t){var i;if(this.es(),!this._instance.Tr())if(this.$n)this.Vn=!0;else{var r=this.Rt.token,s=this.Wn(a),n={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:e({},(null==(i=this.Kr)?void 0:i.get_initial_props())||{},this.Wn(k)||{}),group_properties:this.Wn(P),timezone:_r()};Tt(s)||kt(s)||(n.$device_id=s),(null!=t&&t.disableFlags||this.Rt.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.Kn()&&(n.evaluation_contexts=this.Jn());var o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Rt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.$n=!0,this._instance._send_request({method:"POST",url:o,data:n,compression:this.Rt.disable_compression?void 0:Fr,timeout:this.Rt.feature_flag_request_timeout_ms,callback:t=>{var i,e,r,s=!0;if(200===t.statusCode&&(this.Vn||(this.$anon_distinct_id=void 0),s=!1),this.$n=!1,!n.disable_flags||this.Vn){this.zn=!s;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!=(i=t.json)&&i.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var a,l=!(null==(e=t.json)||null==(e=e.quotaLimited)||!e.includes("feature_flags"));if(l&&o.push("quota_limited"),null==(r=this.Kr)||r.register({[F]:o}),l)_o.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 n.disable_flags||this.receivedFeatureFlags(null!==(a=t.json)&&void 0!==a?a:{},s),this.Vn&&(this.Vn=!1,this.ts())}}})}}getFeatureFlag(t,i){var e;if(void 0===i&&(i={}),!i.fresh||this.zn)if(this.Zn||this.getFlags()&&this.getFlags().length>0){if(!this.Xn()){var r=this.getFeatureFlagResult(t,i);return null!==(e=null==r?void 0:r.variant)&&void 0!==e?e:null==r?void 0:r.enabled}}else _o.warn('getFeatureFlag for key "'+t+bo)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i){if(void 0===i&&(i={}),!i.fresh||this.zn)if(this.Zn||this.getFlags()&&this.getFlags().length>0){if(!this.Xn()){var e=this.getFlagVariants(),r=t in e,s=e[t],n=this.getFlagPayloads()[t],o=String(s),a=this.Wn(Eo)||void 0,l=this.Wn(C)||void 0,h=this.Wn(T)||{};if(this.Rt.advanced_feature_flags_dedup_per_session){var u,d=this._instance.get_session_id(),v=this.Wn(R);d&&d!==v&&(h={},null==(u=this.Kr)||u.register({[T]:h,[R]:d}))}if((i.send_event||!("send_event"in i))&&(!(t in h)||!h[t].includes(o))){var c,f,p,g,_,m,b,y,w,x;xt(h[t])?h[t].push(o):h[t]=[o],null==(c=this.Kr)||c.register({[T]:h});var S=this.getFeatureFlagDetails(t),E=[...null!==(f=this.Wn(F))&&void 0!==f?f:[]];kt(s)&&E.push("flag_missing");var k={$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==(p=this.Rt.bootstrap)||null==(p=p.featureFlags)?void 0:p[t])||null,$feature_flag_bootstrapped_payload:(null==(g=this.Rt.bootstrap)||null==(g=g.featureFlagPayloads)?void 0:g[t])||null,$used_bootstrap_value:!this.zn};kt(null==S||null==(_=S.metadata)?void 0:_.version)||(k.$feature_flag_version=S.metadata.version);var P,I=null!==(m=null==S||null==(b=S.reason)?void 0:b.description)&&void 0!==m?m:null==S||null==(y=S.reason)?void 0:y.code;I&&(k.$feature_flag_reason=I),null!=S&&null!=(w=S.metadata)&&w.id&&(k.$feature_flag_id=S.metadata.id),kt(null==S?void 0:S.original_variant)&&kt(null==S?void 0:S.original_enabled)||(k.$feature_flag_original_response=kt(S.original_variant)?S.original_enabled:S.original_variant),null!=S&&null!=(x=S.metadata)&&x.original_payload&&(k.$feature_flag_original_payload=null==S||null==(P=S.metadata)?void 0:P.original_payload),E.length&&(k.$feature_flag_error=E.join(",")),this._instance.capture("$feature_flag_called",k)}if(r){var O=n;if(!kt(n))try{O=JSON.parse(n)}catch(t){}return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:O}}}}else _o.warn('getFeatureFlagResult for key "'+t+bo)}getRemoteConfigPayload(t,i){var e=this.Rt.token,r={distinct_id:this._instance.get_distinct_id(),token:e};this.Kn()&&(r.evaluation_contexts=this.Jn()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Rt.disable_compression?void 0:Fr,timeout:this.Rt.feature_flag_request_timeout_ms,callback(e){var r,s=null==(r=e.json)?void 0:r.featureFlagPayloads;i((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,i){if(void 0===i&&(i={}),!i.fresh||this.zn){if(this.Zn||this.getFlags()&&this.getFlags().length>0){var e=this.getFeatureFlag(t,i);return kt(e)?void 0:!!e}_o.warn('isFeatureEnabled for key "'+t+bo)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i){if(this.Kr){this.Zn=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(t,i,r,s,n){void 0===r&&(r={}),void 0===s&&(s={}),void 0===n&&(n={});var o=(t=>{var i=t.flags;return i?(t.featureFlags=Object.fromEntries(Object.keys(i).map((t=>{var e;return[t,null!==(e=i[t].variant)&&void 0!==e?e:i[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(i).filter((t=>i[t].enabled)).filter((t=>{var e;return null==(e=i[t].metadata)?void 0:e.payload})).map((t=>{var e;return[t,null==(e=i[t].metadata)?void 0:e.payload]})))):_o.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,h=o.featureFlagPayloads;if(l){var u=t.requestId,d=t.evaluatedAt;if(xt(l)){_o.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;i&&i.register({[yo]:l,[x]:v})}else{var f=l,p=h,g=a;if(t.errorsWhileComputingFlags)if(a){var _=new Set(Object.keys(a).filter((t=>{var i;return!(null!=(i=a[t])&&i.failed)})));f=e({},r,Object.fromEntries(Object.entries(f).filter((t=>{var[i]=t;return _.has(i)})))),p=e({},s,Object.fromEntries(Object.entries(p||{}).filter((t=>{var[i]=t;return _.has(i)})))),g=e({},n,Object.fromEntries(Object.entries(g||{}).filter((t=>{var[i]=t;return _.has(i)}))))}else f=e({},r,f),p=e({},s,p),g=e({},n,g);i&&i.register(e({[yo]:Object.keys(ko(f)),[x]:f||{},[xo]:p||{},[E]:g||{}},u?{[Eo]:u}:{},d?{[C]:d}:{}))}}}(t,this.Kr,r,s,n),i||(this.Un=!1),this.rs(i)}}override(t,i){void 0===i&&(i=!1),_o.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.Kr)return _o.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.Kr.unregister(wo),this.Kr.unregister(So),this.rs(),mo.info("All overrides cleared");if(xt(t)){var i=$o(t);return this.Kr.register({[wo]:i}),this.rs(),mo.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var e,r=t;if(this.qn=Boolean(null!==(e=r.suppressWarning)&&void 0!==e&&e),"flags"in r)if(!1===r.flags)this.Kr.unregister(wo),mo.info("Flag overrides cleared");else if(r.flags){if(xt(r.flags)){var s=$o(r.flags);this.Kr.register({[wo]:s})}else this.Kr.register({[wo]:r.flags});mo.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.Kr.unregister(So),mo.info("Payload overrides cleared")):r.payloads&&(this.Kr.register({[So]:r.payloads}),mo.info("Payload overrides set",{payloads:r.payloads}))),void this.rs()}if(t&&"object"==typeof t)return this.Kr.register({[wo]:t}),this.rs(),mo.info("Flag overrides set",{flags:t});_o.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Zn){var{flags:i,flagVariants:e}=this.ns();t(i,e)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,r){var s,n=(this.Wn(S)||[]).find((i=>i.flagKey===t)),o={["$feature_enrollment/"+t]:i},a={$feature_flag:t,$feature_enrollment:i,$set:o};n&&(a.$early_access_feature_name=n.name),r&&(a.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=e({},this.getFlagVariants(),{[t]:i});null==(s=this.Kr)||s.register({[yo]:Object.keys(ko(l)),[x]:l}),this.rs()}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.Wn(S),s=e?"&"+e.map((t=>"stage="+t)).join("&"):"";if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Rt.token+s),method:"GET",callback:i=>{var e,r;if(i.json){var s=i.json.earlyAccessFeatures;return null==(e=this.Kr)||e.unregister(S),null==(r=this.Kr)||r.register({[S]:s}),t(s)}}})}ns(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter((t=>i[t])),flagVariants:Object.keys(i).filter((t=>i[t])).reduce(((t,e)=>(t[e]=i[e],t)),{})}}rs(t){var{flags:i,flagVariants:e}=this.ns();this.featureFlagEventHandlers.forEach((r=>r(i,e,{errorsLoading:t})))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=this.Wn(k)||{},s=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),n=null==t?void 0:t.$set_once,o={};if(n)for(var a in n)({}).hasOwnProperty.call(n,a)&&(a in r||(o[a]=n[a]));this._instance.register({[k]:e({},r,o,s)}),i&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(k)}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var r=this.Wn(P)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((i=>{r[i]=e({},r[i],t[i]),delete t[i]})),this._instance.register({[P]:e({},r,t)}),i&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.Wn(P)||{};this._instance.register({[P]:e({},i,{[t]:{}})})}else this._instance.unregister(P)}reset(){this.Zn=!1,this.$n=!1,this.Hn=!1,this.Vn=!1,this.zn=!1,this.$anon_distinct_id=void 0,this.es(),this.qn=!1}}},Mo={sessionRecording:class{get Rt(){return this._instance.config}get Kr(){return this._instance.persistence}get started(){var t;return!(null==(t=this.ss)||!t.isStarted)}get status(){var t,i;return this.os===Yn||this.os===Xn?this.os:null!==(t=null==(i=this.ss)?void 0:i.status)&&void 0!==t?t:this.os}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.os=Jn,this.ls=void 0,this._instance=t,!this._instance.sessionManager)throw Zn.error("started without valid sessionManager"),new Error(Qn+" started without valid sessionManager. This is a bug.");if(this.Rt.cookieless_mode===W)throw new Error(Qn+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get us(){var t,i=!(null==(t=this._instance.get_property(b))||!t.enabled),e=!this.Rt.disable_session_recording,r=this.Rt.disable_session_recording||this._instance.consent.isOptedOut();return it&&i&&e&&!r}startIfEnabledOrStop(t){var i;if(!this.us||null==(i=this.ss)||!i.isStarted){var e=!kt(Object.assign)&&!kt(Array.from);this.us&&e?(this.hs(t),Zn.info("starting")):(this.os=Jn,this.stopRecording())}}hs(t){var i,e,r;this.us&&(this.os!==Yn&&this.os!==Xn&&(this.os=Kn),null!=dt&&null!=(i=dt.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=dt.__PosthogExtensions__)&&e.initSessionRecording?this.cs(t):null==(r=dt.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.ds,(i=>{if(i)return Zn.error("could not load recorder",i);this.cs(t)})))}stopRecording(){var t,i;null==(t=this.ls)||t.call(this),this.ls=void 0,null==(i=this.ss)||i.stop()}vs(){var t,i;null==(t=this.ls)||t.call(this),this.ls=void 0,null==(i=this.ss)||i.discard()}fs(){var t;null==(t=this.Kr)||t.unregister(w)}ps(t,i){if(Rt(t))return null;var e,r=Ft(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(Zn.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}gs(t){if(this.Kr){var i,r,s=this.Kr,n=()=>{var i,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.ps(null==(i=this.Rt.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),o=this.ps(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;Rt(a)&&this.fs();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[b]:e({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:e({capturePerformance:t.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:a,minimumDurationMilliseconds:kt(l)?null:l,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers})})};n(),null==(i=this.ls)||i.call(this),this.ls=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.gs(t),void this.vs()):(this.gs(t),void this.startIfEnabledOrStop()):(this.os===Yn&&(this.os=Xn,Zn.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.ss)&&e.log?this.ss.log(t,i):Zn.warn("log called before recorder was ready")}get ds(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(b);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}ys(){var t,i=this._instance.get_property(b);if(!i)return!1;var e=null!==(t=("object"==typeof i?i:JSON.parse(i)).cache_timestamp)&&void 0!==t?t:Date.now();return 36e5>=Date.now()-e}cs(t){var i,e;if(null==(i=dt.__PosthogExtensions__)||!i.initSessionRecording)return Zn.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0});if(this.ss||(this.ss=null==(e=dt.__PosthogExtensions__)?void 0:e.initSessionRecording(this._instance),this.ss._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.ys()){if(this.os===Xn||this.os===Yn)return;return this.os=Yn,Zn.info("persisted remote config is stale, requesting fresh config before starting"),void new Tr(this._instance).load()}this.os=Kn,this.ss.start(t)}onRRwebEmit(t){var i;null==(i=this.ss)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.ss||null==(i=this.Kr)||i.register({$replay_override_linked_flag:!0}),null==(t=this.ss)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.ss||null==(i=this.Kr)||i.register({$replay_override_sampling:!0}),null==(t=this.ss)||t.overrideSampling()}overrideTrigger(t){var i,e;this.ss||null==(e=this.Kr)||e.register({["url"===t?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),null==(i=this.ss)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.ss)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.ss)||!e.tryAddCustomEvent(t,i))}}},Ao={autocapture:class{constructor(t){this.bs=!1,this.ws=null,this._s=!1,this.instance=t,this.rageclicks=new jn(t.config.rageclick),this.Is=null}initialize(){this.startIfEnabled()}get Rt(){var t,i,e=Et(this.instance.config.autocapture)?this.instance.config.autocapture:{};return e.url_allowlist=null==(t=e.url_allowlist)?void 0:t.map((t=>new RegExp(t))),e.url_ignorelist=null==(i=e.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),e}Cs(){if(this.isBrowserSupported()){if(it&&st){var t=t=>{t=t||(null==it?void 0:it.event);try{this.Ss(t)}catch(t){zn.error("Failed to capture event",t)}};if($e(st,"submit",t,{capture:!0}),$e(st,"change",t,{capture:!0}),$e(st,"click",t,{capture:!0}),this.Rt.capture_copied_text){var i=t=>{this.Ss(t=t||(null==it?void 0:it.event),Ln)};$e(st,"copy",i,{capture:!0}),$e(st,"cut",i,{capture:!0})}}}else zn.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.bs&&(this.Cs(),this.bs=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this._s=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[u]:!!t.autocapture_opt_out}),this.ws=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Is=t}getElementSelectors(t){var i,e=[];return null==(i=this.Is)||i.forEach((i=>{var r=null==st?void 0:st.querySelectorAll(i);null==r||r.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i,e=null==(t=this.instance.persistence)?void 0:t.props[u];if(Tt(this.ws)&&!Ot(e)&&!this.instance.Tr())return!1;var r=null!==(i=this.ws)&&void 0!==i?i:!!e;return!!this.instance.config.autocapture&&!r}Ss(t,i){if(void 0===i&&(i="$autocapture"),this.isEnabled){var e,r=gn(t);hn(r)&&(r=r.parentNode||null),"$autocapture"===i&&"click"===t.type&&t instanceof MouseEvent&&this.instance.config.rageclick&&null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&function(t,i){if(!it||xn(t))return!1;var e,r,s;if(Ot(i)?(e=!!i&&wn,r=void 0):(e=null!==(s=null==i?void 0:i.css_selector_ignorelist)&&void 0!==s?s:wn,r=null==i?void 0:i.content_ignorelist),!1===e)return!1;var{targetElementList:n}=Sn(t,!1);return!function(t,i){if(!1===t||kt(t))return!1;var e;if(!0===t)e=yn;else{if(!xt(t))return!1;if(t.length>10)return fe.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map((t=>t.toLowerCase()))}return i.some((t=>{var{safeText:i,ariaLabel:r}=t;return e.some((t=>i.includes(t)||r.includes(t)))}))}(r,n.map((t=>{var i;return{safeText:pn(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!mn(n,e)}(r,this.instance.config.rageclick)&&this.Ss(t,"$rageclick");var s=i===Ln;if(r&&function(t,i,e,r,s){var n,o,a,l;if(void 0===e&&(e=void 0),!it||xn(t))return!1;if(null!=(n=e)&&n.url_allowlist&&!vn(e.url_allowlist))return!1;if(null!=(o=e)&&o.url_ignorelist&&vn(e.url_ignorelist))return!1;if(null!=(a=e)&&a.dom_event_allowlist){var h=e.dom_event_allowlist;if(h&&!h.some((t=>i.type===t)))return!1}var{parentIsUsefulElement:u,targetElementList:d}=Sn(t,r);if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(kt(e))return!0;var r,s=function(t){if(e.some((i=>t.tagName.toLowerCase()===i)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(d,e))return!1;if(!mn(d,null==(l=e)?void 0:l.css_selector_allowlist))return!1;var v=it.getComputedStyle(t);if(v&&"pointer"===v.getPropertyValue("cursor")&&"click"===i.type)return!0;var c=t.tagName.toLowerCase();switch(c){case"html":return!1;case"form":return(s||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(i.type)>=0;default:return u?(s||["click"]).indexOf(i.type)>=0:(s||["click"]).indexOf(i.type)>=0&&(_n.indexOf(c)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,this.Rt,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=Hn(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Rt.element_attribute_ignorelist,elementsChainAsString:this._s});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(n.$element_selectors=a),i===Ln){var l,h=fn(null==it||null==(l=it.getSelection())?void 0:l.toString()),u=t.type||"clipboard";if(!h)return!1;n.$selected_content=h,n.$copy_type=u}return this.instance.capture(i,n),!0}}}isBrowserSupported(){return St(null==st?void 0:st.querySelectorAll)}},historyAutocapture:class{constructor(t){var i;this._instance=t,this.ks=(null==it||null==(i=it.location)?void 0:i.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(fe.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.xs&&this.xs(),this.xs=void 0,fe.info("History API monitoring stopped")}monitorHistoryChanges(){var t,i;if(it&&it.history){var e=this;null!=(t=it.history.pushState)&&t.__posthog_wrapped__||qn(it.history,"pushState",(t=>function(i,r,s){t.call(this,i,r,s),e.Ts("pushState")})),null!=(i=it.history.replaceState)&&i.__posthog_wrapped__||qn(it.history,"replaceState",(t=>function(i,r,s){t.call(this,i,r,s),e.Ts("replaceState")})),this.As()}}Ts(t){try{var i,e=null==it||null==(i=it.location)?void 0:i.pathname;if(!e)return;e!==this.ks&&this.isEnabled&&this._instance.capture(X,{navigation_type:t}),this.ks=e}catch(i){fe.error("Error capturing "+t+" pageview",i)}}As(){if(!this.xs){var t=()=>{this.Ts("popstate")};$e(it,"popstate",t),this.xs=()=>{it&&it.removeEventListener("popstate",t)}}}},heatmaps:class{get Rt(){return this.instance.config}constructor(t){var i;this.Es=!1,this.bs=!1,this.Rs=null,this.instance=t,this.Es=!(null==(i=this.instance.persistence)||!i.props[d]),this.rageclicks=new jn(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return Et(this.Rt.capture_heatmaps)&&this.Rt.capture_heatmaps.flush_interval_milliseconds&&(t=this.Rt.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Rt(this.Rt.capture_heatmaps)?Rt(this.Rt.enable_heatmaps)?this.Es:this.Rt.enable_heatmaps:!1!==this.Rt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.bs)return;to.info("starting..."),this.Ns(),this.Tt()}else{var t;clearInterval(null!==(t=this.Rs)&&void 0!==t?t:void 0),this.Ms(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[d]:i}),this.Es=i,this.startIfEnabled()}}getAndClearBuffer(){var t=this.T;return this.T=void 0,t}Fs(t){this.wt(t.originalEvent,"deadclick")}Tt(){this.Rs&&clearInterval(this.Rs),this.Rs=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(st)?setInterval(this.Zr.bind(this),this.flushIntervalMilliseconds):null}Ns(){it&&st&&(this.Os=this.Zr.bind(this),$e(it,Y,this.Os),this.Ps=t=>this.wt(t||(null==it?void 0:it.event)),$e(st,"click",this.Ps,{capture:!0}),this.Ls=t=>this.Ds(t||(null==it?void 0:it.event)),$e(st,"mousemove",this.Ls,{capture:!0}),this.Bs=new Je(this.instance,Ve,this.Fs.bind(this)),this.Bs.startIfEnabledOrStop(),this.js=this.Tt.bind(this),$e(st,K,this.js),this.bs=!0)}Ms(){var t;it&&st&&(this.Os&&it.removeEventListener(Y,this.Os),this.Ps&&st.removeEventListener("click",this.Ps,{capture:!0}),this.Ls&&st.removeEventListener("mousemove",this.Ls,{capture:!0}),this.js&&st.removeEventListener(K,this.js),clearTimeout(this.qs),null==(t=this.Bs)||t.stop(),this.bs=!1)}Zs(t,i){var e=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,i,e){for(var r=t;r&&an(r)&&!ln(r,"body");){if(r===e)return!1;if(gt(i,null==it?void 0:it.getComputedStyle(r).position))return!0;r=bn(r)}return!1}(gn(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:e),target_fixed:n,type:i}}wt(t,i){var r;if(void 0===i&&(i="click"),!on(t.target)&&io(t)){var s=this.Zs(t,i);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.$s(e({},s,{type:"rageclick"})),this.$s(s)}}Ds(t){!on(t.target)&&io(t)&&(clearTimeout(this.qs),this.qs=setTimeout((()=>{this.$s(this.Zs(t,"mousemove"))}),500))}$s(t){if(it){var i=it.location.href,e=this.Rt.custom_personal_data_properties,r=this.Rt.mask_personal_data_properties?[...nr,...e||[]]:[],s=er(i,r,ar);this.T=this.T||{},this.T[s]||(this.T[s]=[]),this.T[s].push(t)}}Zr(){this.T&&!$t(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Je,webVitalsAutocapture:class{constructor(t){var i;this.Es=!1,this.bs=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Hs=()=>{clearTimeout(this.Vs),0!==this.T.metrics.length&&(this._instance.capture("$web_vitals",this.T.metrics.reduce(((t,i)=>e({},t,{["$web_vitals_"+i.name+"_event"]:e({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.nt=t=>{var i,r=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0);if(kt(r))Vn.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.zs();kt(s)||(Rt(null==t?void 0:t.name)||Rt(null==t?void 0:t.value)?Vn.error("Invalid metric received",t):!this.Ys||this.Ys>t.value?(this.T.url!==s&&(this.Hs(),this.Vs=setTimeout(this.Hs,this.flushToCaptureTimeoutMs)),kt(this.T.url)&&(this.T.url=s),this.T.firstMetricTimestamp=kt(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.T.metrics.push(e({},t,{$current_url:s,$session_id:r.sessionId,$window_id:r.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.Hs()):Vn.error("Ignoring metric with value >= "+this.Ys,t))}},this.Us=()=>{if(!this.bs){var t,i,e,r,s=dt.__PosthogExtensions__;kt(s)||kt(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:i,onFCP:e,onINP:r}=s.postHogWebVitalsCallbacks),t&&i&&e&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.nt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.nt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&e(this.nt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.nt.bind(this)),this.bs=!0):Vn.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Es=!(null==(i=this._instance.persistence)||!i.props[p]),this.startIfEnabled()}get Ws(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=Et(this.Ws)?null==(t=this.Ws)?void 0:t.web_vitals_allowed_metrics:void 0;return Rt(e)?(null==(i=this._instance.persistence)?void 0:i.props[m])||["CLS","FCP","INP","LCP"]:e}get flushToCaptureTimeoutMs(){return(Et(this.Ws)?this.Ws.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=Et(this.Ws)?this.Ws.web_vitals_attribution:void 0;return null!=t&&t}get Ys(){var t=Et(this.Ws)&&Ft(this.Ws.__web_vitals_max_value)?this.Ws.__web_vitals_max_value:Gn;return t>0&&6e4>=t?Gn:t}get isEnabled(){var t=null==nt?void 0:nt.protocol;if("http:"!==t&&"https:"!==t)return Vn.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=Et(this.Ws)?this.Ws.web_vitals:Ot(this.Ws)?this.Ws:void 0;return Ot(i)?i:this.Es}startIfEnabled(){this.isEnabled&&!this.bs&&(Vn.info("enabled, starting..."),this.nr(this.Us))}onRemoteConfig(t){if("capturePerformance"in t){var i=Et(t.capturePerformance)&&!!t.capturePerformance.web_vitals,e=Et(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[p]:i}),this._instance.persistence.register({[m]:e})),this.Es=i,this.startIfEnabled()}}nr(t){var i,e;null!=(i=dt.__PosthogExtensions__)&&i.postHogWebVitalsCallbacks?t():null==(e=dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(i=>{i?Vn.error("failed to load script",i):t()}))}zs(){var t=it?it.location.href:void 0;if(t){var i=this._instance.config.custom_personal_data_properties,e=this._instance.config.mask_personal_data_properties?[...nr,...i||[]]:[];return er(t,e,ar)}Vn.error("Could not determine current URL")}}},Do={exceptionObserver:class{constructor(t){var i,e,r;this.Us=()=>{var t;if(it&&this.isEnabled&&null!=(t=dt.__PosthogExtensions__)&&t.errorWrappingFunctions){var i=dt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,e=dt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=dt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Gs&&this.Rt.capture_unhandled_errors&&(this.Gs=i(this.captureException.bind(this))),!this.Xs&&this.Rt.capture_unhandled_rejections&&(this.Xs=e(this.captureException.bind(this))),!this.Js&&this.Rt.capture_console_errors&&(this.Js=r(this.captureException.bind(this)))}catch(t){Bn.error("failed to start",t),this.Ks()}}},this._instance=t,this.Qs=!(null==(i=this._instance.persistence)||!i.props[v]),this.eo=new Bt({refillRate:null!==(e=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==e?e:1,bucketSize:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10,refillInterval:1e4,qt:Bn}),this.Rt=this.ro(),this.startIfEnabledOrStop()}ro(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Et(t)?i=e({},i,t):(kt(t)?this.Qs:t)&&(i=e({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.Rt.capture_console_errors||this.Rt.capture_unhandled_errors||this.Rt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Bn.info("enabled"),this.Ks(),this.nr(this.Us)):this.Ks()}nr(t){var i,e;null!=(i=dt.__PosthogExtensions__)&&i.errorWrappingFunctions&&t(),null==(e=dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Bn.error("failed to load script",i);t()}))}Ks(){var t,i,e;null==(t=this.Gs)||t.call(this),this.Gs=void 0,null==(i=this.Xs)||i.call(this),this.Xs=void 0,null==(e=this.Js)||e.call(this),this.Js=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.Qs=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[v]:this.Qs}),this.Rt=this.ro(),this.startIfEnabledOrStop())}onConfigChange(){this.Rt=this.ro()}captureException(t){var i,e,r,s=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.eo.consumeRateLimit(s)?Bn.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var i,r;this.io=[],this.no=new qi([new ee,new ve,new se,new re,new ue,new he,new oe,new de],function(t){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;i>s;s++)r[s-1]=arguments[s];return function(i,s){void 0===s&&(s=0);for(var n=[],o=i.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var h=ie.test(l)?l.replace(ie,"$1"):l;if(!h.match(/\S*Error: /)){for(var u of r){var d=u(h,t);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,50).map((t=>{return e({},t,{filename:t.filename||(r=i,r[r.length-1]||{}).filename,function:t.function||Wi});var r}))}(n)}}("web:javascript",Xi,te)),this._instance=t,this.io=null!==(i=null==(r=this._instance.persistence)?void 0:r.get_property(c))&&void 0!==i?i:[]}onRemoteConfig(t){var i,e,r;if("errorTracking"in t){var s=null!==(i=null==(e=t.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.io=s,this._instance.persistence&&this._instance.persistence.register({[c]:this.io,[f]:n})}}get so(){var t,i=!!this._instance.get_property(f),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.no.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}sendExceptionEvent(t){var i=t.$exception_list;if(this.oo(i)){if(this.ao(i))return void Po.info("Skipping exception capture because a suppression rule matched");if(!this.so&&this.lo(i))return void Po.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.uo(i))return void Po.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent",zi:!0})}ao(t){if(0===t.length)return!1;var i=t.reduce(((t,i)=>{var{type:e,value:r}=i;return Pt(e)&&e.length>0&&t.$exception_types.push(e),Pt(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.io.some((t=>{var e=t.values.map((t=>{var e,r=Rs[t.operator],s=xt(t.value)?t.value:[t.value],n=null!==(e=i[t.key])&&void 0!==e?e:[];return s.length>0&&r(s,n)}));return"OR"===t.type?e.some(Boolean):e.every(Boolean)}))}lo(t){return t.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}uo(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[],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}oo(t){return!Rt(t)&&xt(t)}}},jo=e({productTours:class{get Kr(){return this._instance.persistence}constructor(t){this.ho=null,this.co=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this.Kr&&this.Kr.register({[_]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,i;this.ho||(t=this._instance).config.disable_product_tours||null==(i=t.persistence)||!i.get_property(_)||this.nr((()=>this.do()))}nr(t){var i,e;null!=(i=dt.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",(i=>{i?eo.error("Could not load product tours script",i):t()}))}do(){var t;!this.ho&&null!=(t=dt.__PosthogExtensions__)&&t.generateProductTours&&(this.ho=dt.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!xt(this.co)||i){var e=this.Kr;if(e){var r=e.props[ro];if(xt(r)&&!i)return this.co=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:i=>{var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return eo.error(s),void t([],{isLoaded:!1,error:s})}var n=xt(i.json.product_tours)?i.json.product_tours:[];this.co=n,e&&e.register({[ro]:n}),t(n,{isLoaded:!0})}})}else t(this.co,{isLoaded:!0})}getActiveProductTours(t){Rt(this.ho)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.ho.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.ho)||i.showTourById(t)}previewTour(t){this.ho?this.ho.previewTour(t):this.nr((()=>{var i;this.do(),null==(i=this.ho)||i.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.ho)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.ho)||t.nextStep()}previousStep(){var t;null==(t=this.ho)||t.previousStep()}clearCache(){var t;this.co=null,null==(t=this.Kr)||t.unregister(ro)}resetTour(t){var i;null==(i=this.ho)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.ho)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.ho)||i.cancelPendingTour(t)}}},Oo),Lo={siteApps:class{constructor(t){this._instance=t,this.vo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}fo(t,i){if(i){var e=this.globalsForEvent(i);this.vo.push(e),this.vo.length>1e3&&(this.vo=this.vo.slice(10))}}get siteAppLoaders(){var t;return null==(t=dt._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.fo.bind(this));this.po=()=>{t(),this.vo=[],this.po=void 0}}}globalsForEvent(t){var i,s,n,o,a,l,h;if(!t)throw new Error("Event payload is required");var u={},d=this._instance.get_property("$groups")||[],v=this._instance.get_property("$stored_group_properties")||{};for(var[c,f]of Object.entries(v))u[c]={id:d[c],type:c,properties:f};var{$set_once:p,$set:g}=t;return{event:e({},r(t,so),{properties:e({},t.properties,g?{$set:e({},null!==(i=null==(s=t.properties)?void 0:s.$set)&&void 0!==i?i:{},g)}:{},p?{$set_once:e({},null!==(n=null==(o=t.properties)?void 0:o.$set_once)&&void 0!==n?n:{},p)}:{}),elements_chain:null!==(a=null==(l=t.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(h=t.properties)?void 0:h.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;!i.errored&&this.vo.length&&(no.info("Processing "+this.vo.length+" events for site app with id "+t.id),this.vo.forEach((t=>null==i.processEvent?void 0:i.processEvent(t))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(e=this.po)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,no.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var{processEvent:n}=t.init({posthog:this._instance,callback(t){s(t)}});n&&(i.processEvent=n),r=!0}catch(i){no.error(oo+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){no.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}mo(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}yo(t){if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t);for(var e of Object.values(this.apps))try{null==e.processEvent||e.processEvent(i)}catch(i){no.error("Error while processing event "+t.event+" for site app "+e.id,i)}}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.mo(),void this._instance.on("eventCaptured",(t=>this.yo(t)))):void no.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.po)||e.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var i;dt["__$$ph_site_app_"+t]=s._instance,null==(i=dt.__PosthogExtensions__)||null==i.loadSiteApp||i.loadSiteApp(s._instance,a,(i=>{if(i)return no.error(oo+t,i)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else no.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},zo={tracingHeaders:class{constructor(t){this.bo=void 0,this.wo=void 0,this.Us=()=>{var t,i;kt(this.bo)&&(null==(t=dt.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),kt(this.wo)&&(null==(i=dt.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}initialize(){this.startIfEnabledOrStop()}nr(t){var i,e;null!=(i=dt.__PosthogExtensions__)&&i.tracingHeadersPatchFns&&t(),null==(e=dt.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return Wn.error("failed to load script",i);t()}))}startIfEnabledOrStop(){var t,i;this._instance.config.__add_tracing_headers?this.nr(this.Us):(null==(t=this.bo)||t.call(this),null==(i=this.wo)||i.call(this),this.bo=void 0,this.wo=void 0)}}},Uo=e({surveys:class{get Rt(){return this._instance.config}constructor(t){this._o=void 0,this._surveyManager=null,this.Io=!1,this.Co=[],this.So=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Rt.disable_surveys){var i=t.surveys;if(Rt(i))return Ds.warn("Flags not loaded yet. Not loading surveys.");var e=xt(i);this._o=e?i.length>0:i,Ds.info("flags response received, isSurveysEnabled: "+this._o),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],i=0;i<localStorage.length;i++){var e=localStorage.key(i);(null!=e&&e.startsWith(js)||null!=e&&e.startsWith("inProgressSurvey_"))&&t.push(e)}t.forEach((t=>localStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.Io)Ds.info("Already initializing surveys, skipping...");else if(this.Rt.disable_surveys)Ds.info(co);else if(this.Rt.cookieless_mode&&this._instance.consent.isOptedOut())Ds.info("Not loading surveys in cookieless mode without consent.");else{var t=null==dt?void 0:dt.__PosthogExtensions__;if(t){if(!kt(this._o)||this.Rt.advanced_enable_surveys){var i=this._o||this.Rt.advanced_enable_surveys;this.Io=!0;try{var e=t.generateSurveys;if(e)return void this.ko(e,i);var r=t.loadExternalDependency;if(!r)return void this.xo(B);r(this._instance,"surveys",(e=>{e||!t.generateSurveys?this.xo("Could not load surveys script",e):this.ko(t.generateSurveys,i)}))}catch(t){throw this.xo("Error initializing surveys",t),t}finally{this.Io=!1}}}else Ds.error("PostHog Extensions not found.")}}ko(t,i){this._surveyManager=t(this._instance,i),this._surveyEventReceiver=new uo(this._instance),Ds.info("Surveys loaded successfully"),this.To({isLoaded:!0})}xo(t,i){Ds.error(t,i),this.To({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Co.push(t),this._surveyManager&&this.To({isLoaded:!0}),()=>{this.Co=this.Co.filter((i=>i!==t))}}getSurveys(t,i){if(void 0===i&&(i=!1),this.Rt.disable_surveys)return Ds.info(co),t([]);var e,r=this._instance.get_property(I);if(r&&!i)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.So?this.So.then((i=>{var{surveys:e,context:r}=i;return t(e,r)})):("undefined"!=typeof Promise&&(this.So=new Promise((t=>{e=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Rt.token),method:"GET",timeout:this.Rt.surveys_request_timeout_ms,callback:i=>{var r;this.So=null;var s=i.statusCode;if(200!==s||!i.json){var n="Surveys API could not be loaded, status: "+s;Ds.error(n);var o={isLoaded:!1,error:n};return t([],o),void(null==e||e({surveys:[],context:o}))}var a,l=i.json.surveys||[],h=l.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t))));h.length>0&&(null==(a=this._surveyEventReceiver)||a.register(h)),null==(r=this._instance.persistence)||r.register({[I]:l});var u={isLoaded:!0};t(l,u),null==e||e({surveys:l,context:u})}}))}To(t){for(var i of this.Co)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){Ds.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!Rt(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Ds.warn("init was not called")}Ao(t){var i=null;return this.getSurveys((e=>{var r;i=null!==(r=e.find((i=>i.id===t)))&&void 0!==r?r:null})),i}Eo(t){if(Rt(this._surveyManager))return{eligible:!1,reason:vo};var i="string"==typeof t?this.Ao(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Rt(this._surveyManager))return Ds.warn("init was not called"),{visible:!1,disabledReason:vo};var i=this.Eo(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return Rt(this._surveyManager)?(Ds.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:vo})):new Promise((e=>{this.getSurveys((i=>{var r,s=null!==(r=i.find((i=>i.id===t)))&&void 0!==r?r:null;if(s){var n=this.Eo(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i,e){var r;if(Rt(this._surveyManager))Ds.warn("init was not called");else{var s="string"==typeof t?this.Ao(t):t;if(null!=s&&s.id)if(Us.includes(s.type)){var n=null==st?void 0:st.querySelector(i);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(Ds.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,i;Ds.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(s,n,e),Ds.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,e);Ds.warn("Survey element not found")}else Ds.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Ds.warn("Survey not found")}}displaySurvey(t,i){var r;if(Rt(this._surveyManager))Ds.warn("init was not called");else{var s=this.Ao(t);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&i.ignoreDelay&&(n=e({},s,{appearance:e({},s.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==$r&&i.initialResponses&&Ds.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var o=this.canRenderSurvey(s);if(!o.visible)return void Ds.warn("Survey is not eligible to be displayed: ",o.disabledReason)}"inline"!==i.displayType?this._surveyManager.handlePopoverSurvey(n,i):this.renderSurvey(n,i.selector,i.properties)}else Ds.warn("Survey not found")}}cancelPendingSurvey(t){Rt(this._surveyManager)?Ds.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},Oo),No={toolbar:class{constructor(t){this.instance=t}Ro(t){dt.ph_toolbar_state=t}No(){var t;return null!==(t=dt.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,i,e){if(void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),ke(this.instance.config))return!1;if(!it||!st)return!1;t=null!=t?t:it.location,e=null!=e?e:it.history;try{if(!i){try{it.localStorage.setItem("test","test"),it.localStorage.removeItem("test")}catch(t){return!1}i=null==it?void 0:it.localStorage}var r,s=fo||rr(t.hash,"__posthog")||rr(t.hash,"state"),n=s?ye((()=>JSON.parse(atob(decodeURIComponent(s)))))||ye((()=>JSON.parse(decodeURIComponent(s)))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?t.hash=n.desiredHash:e?e.replaceState(e.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(i.getItem(po)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Mo(t){var i=dt.ph_load_toolbar||dt.ph_load_editor;!Rt(i)&&St(i)?i(t,this.instance):go.warn("No toolbar load function found")}loadToolbar(t){var i=!(null==st||!st.getElementById(U));if(!it||i)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=e({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(it.localStorage.setItem(po,JSON.stringify(e({},s,{source:void 0}))),2===this.No())this.Mo(s);else if(0===this.No()){var n;this.Ro(1),null==(n=dt.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return go.error("[Toolbar] Failed to load",t),void this.Ro(0);this.Ro(2),this.Mo(s)})),$e(it,"turbolinks:load",(()=>{this.Ro(0),this.loadToolbar(s)}))}return!0}Fo(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}},Ho=e({experiments:Ro},Oo),Bo={conversations:class{constructor(t){this.Oo=void 0,this._conversationsManager=null,this.Po=!1,this.Lo=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var i=t.conversations;Rt(i)||(Ot(i)?this.Oo=i:(this.Oo=i.enabled,this.Lo=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Oo=void 0,this.Lo=null}loadIfEnabled(){if(!(this._conversationsManager||this.Po||this._instance.config.disable_conversations||ke(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==dt?void 0:dt.__PosthogExtensions__;if(t&&!kt(this.Oo)&&this.Oo)if(this.Lo&&this.Lo.token){this.Po=!0;try{var i=t.initConversations;if(i)return this.Do(i),void(this.Po=!1);var e=t.loadExternalDependency;if(!e)return void this.Bo(B);e(this._instance,"conversations",(i=>{i||!t.initConversations?this.Bo("Could not load conversations script",i):this.Do(t.initConversations),this.Po=!1}))}catch(t){this.Bo("Error initializing conversations",t),this.Po=!1}}else Fo.error("Conversations enabled but missing token in remote config.")}}Do(t){if(this.Lo)try{this._conversationsManager=t(this.Lo,this._instance),Fo.info("Conversations loaded successfully")}catch(t){this.Bo("Error completing conversations initialization",t)}else Fo.error("Cannot complete initialization: remote config is null")}Bo(t,i){Fo.error(t,i),this._conversationsManager=null,this.Po=!1}show(){this._conversationsManager?this._conversationsManager.show():Fo.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Oo&&!Tt(this._conversationsManager)}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,e,r){var s=this;return i((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,e,r):(Fo.warn(Co),null)}))()}getMessages(t,e){var r=this;return i((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,e):(Fo.warn(Co),null)}))()}markAsRead(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Fo.warn(Co),null)}))()}getTickets(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Fo.warn(Co),null)}))()}requestRestoreLink(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Fo.warn(Co),null)}))()}restoreFromToken(t){var e=this;return i((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Fo.warn(Co),null)}))()}restoreFromUrlToken(){var t=this;return i((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Fo.warn(Co),null)}))()}getCurrentTicketId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}Ki(){var t;null==(t=this._conversationsManager)||t.setIdentity()}Qi(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},qo={logs:class{constructor(t){var i;this.jo=!1,this.qo=!1,this._instance=t,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.jo=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var i,e=null==(i=t.logs)?void 0:i.captureConsoleLogs;!Rt(e)&&e&&(this.jo=!0,this.loadIfEnabled())}reset(){}loadIfEnabled(){if(this.jo&&!this.qo){var t=pe("[logs]"),i=null==dt?void 0:dt.__PosthogExtensions__;if(i){var e=i.loadExternalDependency;e?e(this._instance,"logs",(e=>{var r;e||null==(r=i.logs)||!r.initializeLogs?t.error("Could not load logs script",e):(i.logs.initializeLogs(this._instance),this.qo=!0)})):t.error(B)}else t.error("PostHog Extensions not found.")}}}},Wo=e({},Oo,Mo,Ao,Do,jo,Lo,Uo,zo,No,Ho,Bo,qo);nn.__defaultExtensionClasses=e({},Wo)}();
|
|
2
2
|
//# sourceMappingURL=default-extensions.js.map
|