posthog-js 1.372.1 → 1.372.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/array.full.es5.js +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.js +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/conversations.js +1 -1
- package/dist/conversations.js.map +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/main.js +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.no-external.js +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/src/extensions/conversations/external/components/ConversationsWidget.d.ts +0 -2
- package/dist/src/extensions/conversations/external/components/MessagesView.d.ts +1 -2
- package/dist/src/extensions/conversations/external/components/styles.d.ts +1 -1
- package/lib/package.json +1 -1
- package/lib/src/extensions/conversations/external/components/ConversationsWidget.d.ts +0 -2
- package/lib/src/extensions/conversations/external/components/ConversationsWidget.js +3 -12
- package/lib/src/extensions/conversations/external/components/ConversationsWidget.js.map +1 -1
- package/lib/src/extensions/conversations/external/components/MessagesView.d.ts +1 -2
- package/lib/src/extensions/conversations/external/components/MessagesView.js +2 -2
- package/lib/src/extensions/conversations/external/components/MessagesView.js.map +1 -1
- package/lib/src/extensions/conversations/external/components/OpenChatButton.js +0 -2
- package/lib/src/extensions/conversations/external/components/OpenChatButton.js.map +1 -1
- package/lib/src/extensions/conversations/external/components/styles.d.ts +1 -1
- package/lib/src/extensions/conversations/external/components/styles.js +2 -2
- package/lib/src/extensions/conversations/external/components/styles.js.map +1 -1
- package/lib/src/extensions/conversations/external/index.js +3 -1
- package/lib/src/extensions/conversations/external/index.js.map +1 -1
- package/package.json +3 -3
package/dist/main.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";function t(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(r,s)}function e(e){return function(){var i=this,r=arguments;return new Promise((function(s,n){var o=e.apply(i,r);function a(e){t(o,s,n,a,l,"next",e)}function l(e){t(o,s,n,a,l,"throw",e)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},i.apply(null,arguments)}function r(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}Object.defineProperty(exports,"__esModule",{value:!0});var s="1.372.1",n={DEBUG:!1,LIB_VERSION:s,LIB_NAME:"web",JS_SDK_VERSION:s},o="$people_distinct_id",a="$device_id",l="__alias",u="__timers",h="$autocapture_disabled_server_side",d="$heatmaps_enabled_server_side",v="$exception_capture_enabled_server_side",c="$error_tracking_suppression_rules",p="$error_tracking_capture_extension_exceptions",f="$web_vitals_enabled_server_side",_="$dead_clicks_enabled_server_side",g="$product_tours_enabled_server_side",m="$web_vitals_allowed_metrics",b="$session_recording_remote_config",y="$replay_override_sampling",w="$replay_override_linked_flag",x="$replay_override_url_trigger",E="$replay_override_event_trigger",S="$sesid",T="$session_is_sampled",k="$enabled_feature_flags",R="$active_feature_flags",P="$early_access_features",O="$feature_flag_details",I="$feature_flag_payloads",C="$feature_flag_request_id",F="$override_feature_flags",A="$override_feature_flag_payloads",M="$stored_person_properties",D="$stored_group_properties",L="$surveys",U="$surveys_activated",N="ph_product_tours",j="$flag_call_reported",z="$flag_call_reported_session_id",B="$feature_flag_errors",H="$feature_flag_evaluated_at",q="$user_state",V="$client_session_props",W="$capture_rate_limit",G="$initial_campaign_params",Y="$initial_referrer_info",J="$initial_person_info",K="$epp",X="__POSTHOG_TOOLBAR__",Q="$posthog_cookieless",Z="$sdk_debug_extensions_init_method",tt="$sdk_debug_extensions_init_time_ms",et="$sdk_debug_recording_script_not_loaded",it="PostHog loadExternalDependency extension not found.",rt="on_reject",st="always",nt="anonymous",ot="identified",at="identified_only",lt="visibilitychange",ut="beforeunload",ht="$pageview",dt="$pageleave",vt="$identify",ct="$groupidentify",pt="undefined"!=typeof window?window:void 0,ft="undefined"!=typeof globalThis?globalThis:pt;"undefined"==typeof self&&(ft.self=ft),"undefined"==typeof File&&(ft.File=function(){});var _t=null==ft?void 0:ft.navigator,gt=null==ft?void 0:ft.document,mt=null==ft?void 0:ft.location,bt=null==ft?void 0:ft.fetch,yt=null!=ft&&ft.XMLHttpRequest&&"withCredentials"in new ft.XMLHttpRequest?ft.XMLHttpRequest:void 0,wt=null==ft?void 0:ft.AbortController,xt=null==ft?void 0:ft.CompressionStream,Et=null==_t?void 0:_t.userAgent,St=null!=pt?pt:{};function $t(){return $t=e((function*(t,i,r){void 0===i&&(i=!0);try{var s=new CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write((new TextEncoder).encode(t)).then((()=>n.close())).catch(function(){var t=e((function*(t){try{yield n.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),a=new Response(s.readable).blob(),[l]=yield Promise.all([a,o]);return l}catch(t){if(null!=r&&r.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}})),$t.apply(this,arguments)}var Tt=["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"],kt=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return Tt.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))},Rt=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function Pt(t,e){return-1!==t.indexOf(e)}var Ot=function(t){return t.trim()},It=function(t){return t.replace(/^\$/,"")},Ct=Object.prototype,Ft=Ct.hasOwnProperty,At=Ct.toString,Mt=Array.isArray||function(t){return"[object Array]"===At.call(t)},Dt=t=>"function"==typeof t,Lt=t=>t===Object(t)&&!Mt(t),Ut=t=>{if(Lt(t)){for(var e in t)if(Ft.call(t,e))return!1;return!0}return!1},Nt=t=>void 0===t,jt=t=>"[object String]"==At.call(t),zt=t=>jt(t)&&0===t.trim().length,Bt=t=>null===t,Ht=t=>Nt(t)||Bt(t),qt=t=>"[object Number]"==At.call(t)&&t==t,Vt=t=>qt(t)&&t>0,Wt=t=>"[object Boolean]"===At.call(t),Gt=t=>t instanceof FormData,Yt=t=>Pt(Rt,t);function Jt(t){return null===t||"object"!=typeof t}function Kt(t,e){return{}.toString.call(t)==="[object "+e+"]"}function Xt(t){return"undefined"!=typeof Event&&function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Event)}var Qt=[!0,"true",1,"1","yes"],Zt=t=>Pt(Qt,t),te=[!1,"false",0,"0","no"];function ee(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),qt(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),ee(s||i,e,i,r))}class ie{constructor(t){this.$t={},this.zt=t.zt,this.Ut=ee(t.bucketSize,0,100,t.Yt),this.Wt=ee(t.refillRate,0,this.Ut,t.Yt),this.Gt=ee(t.refillInterval,0,864e5,t.Yt)}Xt(t,e){var i=Math.floor((e-t.lastAccess)/this.Gt);i>0&&(t.tokens=Math.min(t.tokens+i*this.Wt,this.Ut),t.lastAccess=t.lastAccess+i*this.Gt)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.$t[r];return s?this.Xt(s,i):this.$t[r]=s={tokens:this.Ut,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.zt)||e.call(this,t)),0===s.tokens)}stop(){this.$t={}}}var re,se,ne,oe="Mobile",ae="iOS",le="Android",ue="Tablet",he=le+" "+ue,de="iPad",ve="Apple",ce=ve+" Watch",pe="Safari",fe="BlackBerry",_e="Samsung",ge=_e+"Browser",me=_e+" Internet",be="Chrome",ye=be+" OS",we=be+" "+ae,xe="Internet Explorer",Ee=xe+" "+oe,Se="Opera",$e=Se+" Mini",Te="Edge",ke="Microsoft "+Te,Re="Firefox",Pe=Re+" "+ae,Oe="Nintendo",Ie="PlayStation",Ce="Xbox",Fe=le+" "+oe,Ae=oe+" "+pe,Me="Windows",De=Me+" Phone",Le="Nokia",Ue="Ouya",Ne="Generic",je=Ne+" "+oe.toLowerCase(),ze=Ne+" "+ue.toLowerCase(),Be="Konqueror",He="(\\d+(\\.\\d+)?)",qe=new RegExp("Version/"+He),Ve=new RegExp(Ce,"i"),We=new RegExp(Ie+" \\w+","i"),Ge=new RegExp(Oe+" \\w+","i"),Ye=new RegExp(fe+"|PlayBook|BB10","i"),Je={"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"},Ke=function(t,e){return e=e||"",Pt(t," OPR/")&&Pt(t,"Mini")?$e:Pt(t," OPR/")?Se:Ye.test(t)?fe:Pt(t,"IE"+oe)||Pt(t,"WPDesktop")?Ee:Pt(t,ge)?me:Pt(t,Te)||Pt(t,"Edg/")?ke:Pt(t,"FBIOS")?"Facebook "+oe:Pt(t,"UCWEB")||Pt(t,"UCBrowser")?"UC Browser":Pt(t,"CriOS")?we:Pt(t,"CrMo")||Pt(t,be)?be:Pt(t,le)&&Pt(t,pe)?Fe:Pt(t,"FxiOS")?Pe:Pt(t.toLowerCase(),Be.toLowerCase())?Be:((t,e)=>e&&Pt(e,ve)||function(t){return Pt(t,pe)&&!Pt(t,be)&&!Pt(t,le)}(t))(t,e)?Pt(t,oe)?Ae:pe:Pt(t,Re)?Re:Pt(t,"MSIE")||Pt(t,"Trident/")?xe:Pt(t,"Gecko")?Re:""},Xe={[Ee]:[new RegExp("rv:"+He)],[ke]:[new RegExp(Te+"?\\/"+He)],[be]:[new RegExp("("+be+"|CrMo)\\/"+He)],[we]:[new RegExp("CriOS\\/"+He)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+He)],[pe]:[qe],[Ae]:[qe],[Se]:[new RegExp("(Opera|OPR)\\/"+He)],[Re]:[new RegExp(Re+"\\/"+He)],[Pe]:[new RegExp("FxiOS\\/"+He)],[Be]:[new RegExp("Konqueror[:/]?"+He,"i")],[fe]:[new RegExp(fe+" "+He),qe],[Fe]:[new RegExp("android\\s"+He,"i")],[me]:[new RegExp(ge+"\\/"+He)],[xe]:[new RegExp("(rv:|MSIE )"+He)],Mozilla:[new RegExp("rv:"+He)]},Qe=function(t,e){var i=Ke(t,e),r=Xe[i];if(Nt(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},Ze=[[new RegExp(Ce+"; "+Ce+" (.*?)[);]","i"),t=>[Ce,t&&t[1]||""]],[new RegExp(Oe,"i"),[Oe,""]],[new RegExp(Ie,"i"),[Ie,""]],[Ye,[fe,""]],[new RegExp(Me,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[De,""];if(new RegExp(oe).test(e)&&!/IEMobile\b/.test(e))return[Me+" "+oe,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Je[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[Me,r]}return[Me,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[ae,[t[3],t[4],t[5]||"0"].join(".")]:[ae,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=Nt(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+le+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+le+")","i"),t=>t&&t[2]?[le,[t[2],t[3],t[4]||"0"].join(".")]:[le,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ye,""]],[/Linux|debian/i,["Linux",""]]],ti=function(t){return Ge.test(t)?Oe:We.test(t)?Ie:Ve.test(t)?Ce:new RegExp(Ue,"i").test(t)?Ue:new RegExp("("+De+"|WPDesktop)","i").test(t)?De:/iPad/.test(t)?de:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ce:Ye.test(t)?fe:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Le,"i").test(t)?Le:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(oe).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?le:he:new RegExp("(pda|"+oe+")","i").test(t)?je:new RegExp(ue,"i").test(t)&&!new RegExp(ue+" pc","i").test(t)?ze:""},ei=t=>t instanceof Error,ii={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},ri=ii.info;function si(t){if(Wt(t))return{boolValue:t};if("number"==typeof t)return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if("string"==typeof t)return{stringValue:t};if(Mt(t))return{arrayValue:{values:t.map((t=>si(t)))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}function ni(t){var e=[];for(var i in t){var r=t[i];Bt(r)||Nt(r)||e.push({key:i,value:si(r)})}return e}function oi(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return ne&&i.length===se||(se=i.length,ne=i.reduce(((i,r)=>{re||(re={});var s=re[r];if(s)i[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=e[r];if(l&&u){i[l]=u,re[r]=[l,u];break}}return i}),{})),ne}}class ai{constructor(t,e,i){void 0===i&&(i=[]),this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e){void 0===e&&(e={});var i=e&&e.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(t){var i=this;return e((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&Mt(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null==(e=t.syntheticException)?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var r,s;return null!=t.cause&&(r=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),i({},t,{cause:r,stack:s})}applyChunkIds(t,e){return t.map((t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t)))}applyCoercers(t,e){for(var i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var i=this;return e((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,e){var r,s,n,o={type:t.type,value:t.value,mechanism:{type:null!==(r=e.type)&&void 0!==r?r:"generic",handled:null===(s=e.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,i({},e,{handled:!0}))),a}buildParsingContext(t){var e;return{chunkIdMap:oi(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,r){void 0===r&&(r=0);var s=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(t,e,r);return this.applyCoercers(i,s)}};return i({},e,{syntheticException:0==r?e.syntheticException:void 0,mechanism:t,apply:t=>s(t,r),next:t=>s(t,r+1)})}}var li="?";function ui(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?li:i,in_app:!0};return Nt(r)||(n.lineno=r),Nt(s)||(n.colno=s),n}var hi=(t,e)=>{var i=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return i||r?[-1!==t.indexOf("@")?t.split("@")[0]:li,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},di=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,vi=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ci=/\((\S*)(?::(\d+))(?::(\d+))\)/,pi=(t,e)=>{var i=di.exec(t);if(i){var[,r,s,n]=i;return ui(e,r,li,+s,+n)}var o=vi.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=ci.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=hi(o[1]||li,o[2]);return ui(e,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},fi=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,_i=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,gi=(t,e)=>{var i=fi.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=_i.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||li;return[n,s]=hi(n,s),ui(e,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},mi=/\(error: (.*)\)/;class bi{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=jt(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?e+": "+t.message:e}isDOMException(t){return Kt(t,"DOMException")}isDOMError(t){return Kt(t,"DOMError")}}class yi{match(t){return(t=>t instanceof Error)(t)}coerce(t,e){return{type:this.getType(t),value:this.getMessage(t,e),stack:this.getStack(t),cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,e){var i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}}class wi{constructor(){}match(t){return Kt(t,"ErrorEvent")&&null!=t.error}coerce(t,e){var i;return e.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}var xi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Ei{match(t){return"string"==typeof t}coerce(t,e){var i,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(t){var e="Error",i=t,r=t.match(xi);return r&&(e=r[1],i=r[2]),[e,i]}}var Si=["fatal","error","warning","log","info","debug"];function $i(t,e){void 0===e&&(e=40);var i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(e>=s.length)return r===i.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class Ti{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,r=this.getErrorPropertyFromObject(t);return r?e.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(i=e.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Xt(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var e="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(e+=" with message: '"+t.message+"'"),e}if("message"in t&&"string"==typeof t.message)return t.message;var i=this.getObjectClassName(t);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+$i(t)}isSeverityLevel(t){return jt(t)&&!zt(t)&&Si.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(ei(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class ki{match(t){return Xt(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+$i(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class Ri{match(t){return Jt(t)}coerce(t,e){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class Pi{match(t){return Kt(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Xt(t))return!1;try{var e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i,r=this.getUnhandledRejectionReason(t);return Jt(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}:e.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var Oi="$message",Ii="$timestamp",Ci=new Set([Oi,Ii]),Fi={enabled:!0,max_bytes:32768};function Ai(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:Fi.enabled,max_bytes:Di(t.max_bytes,Fi.max_bytes)}:i({},Fi)}class Mi{constructor(t){this.Jt=[],this.Kt=0,this.Lt=Ai(t)}setConfig(t){this.Lt=Ai(t),this.Qt()}add(t){var e=function(t){var e=function(t){var e=new WeakSet;try{return JSON.stringify(t,((t,i)=>{if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Date)return i.toISOString();if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){if(e.has(i))return"[Circular]";e.add(i)}return i}}))}catch(t){return}}(t);if(e)try{var i=JSON.parse(e);if(!Lt(i))return;var r=i,s=r[Oi],n=r[Ii];if(!jt(s)||0===s.trim().length)return;if(!jt(n)&&!qt(n))return;return{step:r,json:e}}catch(t){return}}(t);if(e){var i=function(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var e=encodeURIComponent(t),i=0,r=0;e.length>r;r++)"%"===e[r]?(i+=1,r+=2):i+=1;return i}(e.json);i>this.Lt.max_bytes||(this.Jt.push({step:e.step,bytes:i}),this.Kt+=i,this.Qt())}}getAttachable(){return this.Jt.map((t=>t.step))}clear(){this.Jt=[],this.Kt=0}size(){return this.Jt.length}Qt(){for(;this.Kt>this.Lt.max_bytes&&this.Jt.length>0;){var t=this.Jt.shift();t&&(this.Kt-=t.bytes)}}}function Di(t,e){if(!qt(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var Li=function(t,e){var{debugEnabled:i}=void 0===e?{}:e,r={C(e){if(pt&&(n.DEBUG||St.POSTHOG_DEBUG||i)&&!Nt(pt.console)&&pt.console){for(var r=("__rrweb_original__"in pt.console[e]?pt.console[e].__rrweb_original__:pt.console[e]),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,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.C("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.C("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.C("error",...e)},critical(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];console.error(t,...i)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(e,i)=>Li(t+" "+e,i)};return r},Ui=Li("[PostHog.js]"),Ni=Ui.createLogger;function ji(t,e){Mt(t)&&t.forEach(e)}function zi(t,e){if(!Ht(t))if(Mt(t))t.forEach(e);else if(Gt(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)Ft.call(t,i)&&e(t[i],i)}var Bi=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function Hi(t){for(var e=Object.keys(t),i=e.length,r=new Array(i);i--;)r[i]=[e[i],t[e[i]]];return r}var qi=function(t){try{return t()}catch(t){return}},Vi=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){Ui.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ui.critical(t)}}},Wi=function(t){var e={};return zi(t,(function(t,i){(jt(t)&&t.length>0||qt(t))&&(e[i]=t)})),e};var Gi=["herokuapp.com","vercel.app","netlify.app"];function Yi(t){var e=null==t?void 0:t.hostname;if(!jt(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of Gi)if(i===r)return!1;return!0}function Ji(t,e,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(e,i,{capture:s,passive:n})}function Ki(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 qt(t)&&isFinite(t)&&Math.floor(t)===t});class Xi{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|e>>>8,s[7]=e,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new Xi(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Xi(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class Qi{constructor(){this.I=0,this.S=0,this.k=new er}generate(){var t=this.generateOrAbort();if(Nt(t)){this.I=0;var e=this.generateOrAbort();if(Nt(e))throw new Error("Could not generate UUID after timestamp reset");return e}return t}generateOrAbort(){var t=Date.now();if(t>this.I)this.I=t,this.A();else{if(this.I>=t+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return Xi.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 Zi,tr=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};pt&&!Nt(pt.crypto)&&crypto.getRandomValues&&(tr=t=>crypto.getRandomValues(t));class er{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(tr(this.T),this.N=0),this.T[this.N++]}}var ir=()=>rr().toString(),rr=()=>(Zi||(Zi=new Qi)).generate(),sr="",nr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var or={R:()=>!!gt,B(t){Ui.error("cookieStore error: "+t)},O(t){if(gt){try{for(var e=t+"=",i=gt.cookie.split(";").filter((t=>t.length)),r=0;i.length>r;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(e))return decodeURIComponent(s.substring(e.length,s.length))}}catch(t){}return null}},Z(t){var e;try{e=JSON.parse(or.O(t))||{}}catch(t){}return e},M(t,e,i,r,s){if(gt)try{var n="",o="",a=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=gt),sr)return sr;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),r=Math.min(i.length,8),s="dmn_chk_"+ir();!sr&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";e.cookie=o+";max-age=3",e.cookie.includes(s)&&(e.cookie=o+";max-age=0",sr=n)}return sr}(t);if(!i){var r=(t=>{var e=t.match(nr);return e?e[0]:""})(t);r!==i&&Ui.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(gt.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&Ui.warn("cookieStore warning: large cookie, len="+u.length),gt.cookie=u,u}catch(t){return}},F(t,e){if(null!=gt&>.cookie)try{or.M(t,"",-1,e)}catch(t){return}}},ar=null,lr={R(){if(!Bt(ar))return ar;var t=!0;if(Nt(pt))t=!1;else try{var e="__mplssupport__";lr.M(e,"xyz"),'"xyz"'!==lr.O(e)&&(t=!1),lr.F(e)}catch(e){t=!1}return t||Ui.error("localStorage unsupported; falling back to cookie store"),ar=t,t},B(t){Ui.error("localStorage error: "+t)},O(t){try{return null==pt?void 0:pt.localStorage.getItem(t)}catch(t){lr.B(t)}return null},Z(t){try{return JSON.parse(lr.O(t))||{}}catch(t){}return null},M(t,e){try{null==pt||pt.localStorage.setItem(t,JSON.stringify(e))}catch(t){lr.B(t)}},F(t){try{null==pt||pt.localStorage.removeItem(t)}catch(t){lr.B(t)}}},ur=[a,"distinct_id",S,T,K,J,q],hr={},dr={R:()=>!0,B(t){Ui.error("memoryStorage error: "+t)},O:t=>hr[t]||null,Z:t=>hr[t]||null,M(t,e){hr[t]=e},F(t){delete hr[t]}},vr=null,cr={R(){if(!Bt(vr))return vr;if(vr=!0,Nt(pt))vr=!1;else try{var t="__support__";cr.M(t,"xyz"),'"xyz"'!==cr.O(t)&&(vr=!1),cr.F(t)}catch(t){vr=!1}return vr},B(t){Ui.error("sessionStorage error: ",t)},O(t){try{return null==pt?void 0:pt.sessionStorage.getItem(t)}catch(t){cr.B(t)}return null},Z(t){try{return JSON.parse(cr.O(t))||null}catch(t){}return null},M(t,e){try{null==pt||pt.sessionStorage.setItem(t,JSON.stringify(e))}catch(t){cr.B(t)}},F(t){try{null==pt||pt.sessionStorage.removeItem(t)}catch(t){cr.B(t)}}};class pr{constructor(t){this._instance=t}get Lt(){return this._instance.config}get consent(){return this.tr()?0:this.rr}isOptedOut(){return this.Lt.cookieless_mode===st||this.isRejected()||-1===this.consent&&this.Lt.cookieless_mode===rt}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Lt.opt_out_capturing_by_default}optInOut(t){this.ir.M(this.nr,t?1:0,this.Lt.cookie_expiration,this.Lt.cross_subdomain_cookie,this.Lt.secure_cookie)}reset(){this.ir.F(this.nr,this.Lt.cross_subdomain_cookie)}get nr(){var{token:t,opt_out_capturing_cookie_prefix:e,consent_persistence_name:i}=this._instance.config;return i||(e?e+t:"__ph_opt_in_out_"+t)}get rr(){var t=this.ir.O(this.nr);return Zt(t)?1:Pt(te,t)?0:-1}get ir(){var t=this.Lt.opt_out_capturing_persistence_type,e="localStorage"===t?lr:or;if(!this.sr||this.sr!==e){this.sr=e;var i="localStorage"===t?or:lr;i.O(this.nr)&&(this.sr.O(this.nr)||this.optInOut(Zt(i.O(this.nr))),i.F(this.nr,this.Lt.cross_subdomain_cookie))}return this.sr}tr(){return!!this.Lt.respect_dnt&&[null==_t?void 0:_t.doNotTrack,null==_t?void 0:_t.msDoNotTrack,St.doNotTrack].some((t=>Zt(t)))}}var fr=Ni("[Dead Clicks]"),_r=()=>!0,gr=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(_)),r=t.instance.config.capture_dead_clicks;return Wt(r)?r:!!Lt(r)||i};class mr{get lazyLoadedDeadClicksAutocapture(){return this.ar}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[_]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.lr((()=>{this.ur()})):this.stop()}lr(t){var e,i;null!=(e=St.__PosthogExtensions__)&&e.initDeadClicksAutocapture&&t(),null==(i=St.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?fr.error("failed to load script",e):t()}))}ur(){var t;if(gt){if(!this.ar&&null!=(t=St.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=Lt(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};e.__onCapture=this.onCapture,this.ar=St.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.ar.start(gt),fr.info("starting...")}}else fr.error("`document` not found. Cannot start.")}stop(){this.ar&&(this.ar.stop(),this.ar=void 0,fr.info("stopping..."))}}var br=Ni("[SegmentIntegration]");var yr="posthog-js";function wr(t,e){var{organization:r,projectId:s,prefix:n,severityAllowList:o=["error"],sendExceptionsToPostHog:a=!0}=void 0===e?{}:e;return e=>{var l,u,h,d,v;if("*"!==o&&!o.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var c=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=c,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p,f=(null==(l=e.exception)?void 0:l.values)||[],_=f.map((t=>i({},t,{stacktrace:t.stacktrace?i({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>i({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(u=f[0])?void 0:u.value)||e.message,$exception_type:null==(h=f[0])?void 0:h.type,$exception_level:e.level,$exception_list:_,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(d=f[0])?void 0:d.value)||e.message,$sentry_exception_type:null==(v=f[0])?void 0:v.type,$sentry_tags:e.tags};return r&&s&&(g.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+e.event_id),a&&(null==(p=t.exceptions)||p.sendExceptionEvent(g)),e}}class xr{constructor(t,e,i,r,s,n){this.name=yr,this.setupOnce=function(o){o(wr(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Er{constructor(t){this.hr=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(Ui.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.cr=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.dr()}dr(){var t;this.vr=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.hr)}destroy(){var t;null==(t=this.vr)||t.call(this),this.vr=void 0}doPageView(t,e){var i,r=this.pr(t,e);return this.cr={pathname:null!==(i=null==pt?void 0:pt.location.pathname)&&void 0!==i?i:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var e;return this.pr(t,null==(e=this.cr)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.cr)?void 0:t.pageViewId}}pr(t,e){var i=this.cr;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:h}=s;if(!(Nt(n)||Nt(o)||Nt(a)||Nt(l)||Nt(u)||Nt(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var d=n>1?ee(o/n,0,1,Ui):1,v=n>1?ee(a/n,0,1,Ui):1,c=l>1?ee(u/l,0,1,Ui):1,p=l>1?ee(h/l,0,1,Ui):1;r=Bi(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var Sr={[o]:{exposure:"hidden"},[l]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[u]:{exposure:"hidden"},[h]:{exposure:"event"},[d]:{exposure:"hidden"},[v]:{exposure:"event"},[c]:{exposure:"hidden"},[p]:{exposure:"event"},[f]:{exposure:"event"},[_]:{exposure:"event"},[g]:{exposure:"hidden"},[m]:{exposure:"event"},[b]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[S]:{exposure:"hidden"},[T]:{exposure:"event"},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},[k]:{exposure:"derived",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!Lt(t))return{};for(var e={},i=Object.keys(t),r=0;i.length>r;r++)e["$feature/"+i[r]]=t[i[r]];return e}},[R]:{exposure:"event"},[P]:{exposure:"hidden"},[O]:{exposure:"hidden"},[I]:{exposure:"event"},[C]:{exposure:"event"},[F]:{exposure:"event"},[A]:{exposure:"hidden"},[M]:{exposure:"hidden"},[D]:{exposure:"hidden"},[L]:{exposure:"hidden"},[U]:{exposure:"event"},[N]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[j]:{exposure:"hidden"},[z]:{exposure:"hidden"},[B]:{exposure:"hidden"},[H]:{exposure:"hidden"},[q]:{exposure:"hidden"},[V]:{exposure:"hidden"},[W]:{exposure:"hidden"},[G]:{exposure:"hidden"},[Y]:{exposure:"hidden"},[J]:{exposure:"hidden"},[K]:{exposure:"hidden"},[y]:{exposure:"event"},[w]:{exposure:"event"},[x]:{exposure:"event"},[E]:{exposure:"event"},[Z]:{exposure:"event"},[tt]:{exposure:"event"},[et]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},$r=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Tr=t=>{var e=null==gt?void 0:gt.createElement("a");return Nt(e)?null:(e.href=t,e)},kr=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!Mt(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){Ui.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Rr=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],h=0;l.length>h;h++){var d=l[h].split("=");Mt(d)&&(e.includes(d[0])?u.push(d[0]+"="+i):u.push(l[h]))}var v=a;return null!=o&&(v+="?"+u.join("&")),null!=s&&(v+="#"+s),v},Pr=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},Or="https?://(.*)",Ir=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Cr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ir],Fr="<masked>",Ar=["li_fat_id"];function Mr(t,e,i){if(!gt)return{};var r,s=e?[...Ir,...i||[]]:[],n=Dr(Rr(gt.URL,s,Fr),t),o=(r={},zi(Ar,(function(t){var e=or.O(t);r[t]=e||null})),r);return Bi(o,n)}function Dr(t,e){var i=Cr.concat(e||[]),r={};return zi(i,(function(e){var i=kr(t,e);r[e]=i||null})),r}function Lr(t){var e=function(t){return t?0===t.search(Or+"google.([^/?]*)")?"google":0===t.search(Or+"bing.com")?"bing":0===t.search(Or+"yahoo.com")?"yahoo":0===t.search(Or+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",r={};if(!Bt(e)){r.$search_engine=e;var s=gt?kr(gt.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function Ur(){return navigator.language||navigator.userLanguage}var Nr="$direct";function jr(){return(null==gt?void 0:gt.referrer)||Nr}function zr(t,e){var i=t?[...Ir,...e||[]]:[],r=null==mt?void 0:mt.href.substring(0,1e3);return{r:jr().substring(0,1e3),u:r?Rr(r,i,Fr):void 0}}function Br(t){var e,{r:i,u:r}=t,s={$referrer:i,$referring_domain:null==i?void 0:i==Nr?Nr:null==(e=Tr(i))?void 0:e.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=Dr(r);Bi(s,o)}if(i){var a=Lr(i);Bi(s,a)}return s}function Hr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function qr(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var Vr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Wr{constructor(t,e){this.Lt=t,this.props={},this.gr=!1,this.mr=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(t),this.ir=this.yr(t),this.load(),t.debug&&Ui.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save()}isDisabled(){return!!this.br}yr(t){-1===Vr.indexOf(t.persistence.toLowerCase())&&(Ui.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var e=function(t){void 0===t&&(t=[]);var e=[...ur,...t];return i({},lr,{Z(t){try{var e={};try{e=or.Z(t)||{}}catch(t){}var i=Bi(e,JSON.parse(lr.O(t)||"{}"));return lr.M(t,i),i}catch(t){}return null},M(t,i,r,s,n,o){try{lr.M(t,i,void 0,void 0,o);var a={};e.forEach((t=>{i[t]&&(a[t]=i[t])})),Object.keys(a).length&&or.M(t,a,r,s,n,o)}catch(t){lr.B(t)}},F(t,e){try{null==pt||pt.localStorage.removeItem(t),or.F(t,e)}catch(t){lr.B(t)}}})}(t.cookie_persisted_properties||[]),r=t.persistence.toLowerCase();return"localstorage"===r&&lr.R()?lr:"localstorage+cookie"===r&&e.R()?e:"sessionstorage"===r&&cr.R()?cr:"memory"===r?dr:"cookie"===r?or:e.R()?e:or}_r(t){var e=null!=t?t:this.Lt.feature_flag_cache_ttl_ms;if(!e||0>=e)return!1;var i=this.props[H];return!i||"number"!=typeof i||Date.now()-i>e}properties(){var t={};return zi(this.props,((e,i)=>{var r=(t=>{var e=Sr[t];if(e)return e;for(var[i,r]of $r)if(0===t.indexOf(i))return r})(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,i===k?()=>this._r():()=>!1))return;r.transformToEventProperties&&Bi(t,r.transformToEventProperties(e))}else r&&"event"!==r.exposure||(t[i]=e)})),t}load(){if(!this.br){var t=this.ir.Z(this.mr);t&&(this.props=Bi({},t))}}save(){this.br||this.ir.M(this.mr,this.props,this.wr,this.Ir,this.Cr,this.Lt.debug)}remove(){this.ir.F(this.mr,!1),this.ir.F(this.mr,!0)}clear(){this.remove(),this.props={}}register_once(t,e,i){if(Lt(t)){Nt(e)&&(e="None"),this.wr=Nt(i)?this.Sr:i;var r=!1;if(zi(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.kr(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(Lt(t)){this.wr=Nt(e)?this.Sr:e;var i=!1;if(zi(t,((e,r)=>{t.hasOwnProperty(r)&&this.props[r]!==e&&(this.kr(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Tr(t),this.save())}update_campaign_params(){if(!this.gr){var t=Mr(this.Lt.custom_campaign_params,this.Lt.mask_personal_data_properties,this.Lt.custom_personal_data_properties);Ut(Wi(t))||this.register(t),this.gr=!0}}update_search_keyword(){var t;this.register((t=null==gt?void 0:gt.referrer)?Lr(t):{})}update_referrer_info(){var t;this.register_once({$referrer:jr(),$referring_domain:null!=gt&>.referrer&&(null==(t=Tr(gt.referrer))?void 0:t.host)||Nr},void 0)}set_initial_person_info(){this.props[G]||this.props[Y]||this.register_once({[J]:zr(this.Lt.mask_personal_data_properties,this.Lt.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};zi([Y,G],(e=>{var i=this.props[e];i&&zi(i,(function(e,i){t["$initial_"+It(i)]=e}))}));var e,i,r=this.props[J];if(r){var s=(e=Br(r),i={},zi(e,(function(t,e){i["$initial_"+It(e)]=t})),i);Bi(t,s)}return t}safe_merge(t){return zi(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){if(this.Sr=this.wr=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==e.persistence||!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[])){var r=this.yr(t),s=this.props;this.clear(),this.ir=r,this.props=s,this.save()}}set_disabled(t){this.br=t,this.br?this.remove():this.save()}set_cross_subdomain(t){t!==this.Ir&&(this.Ir=t,this.remove(),this.save())}set_secure(t){t!==this.Cr&&(this.Cr=t,this.remove(),this.save())}set_event_timer(t,e){var i=this.props[u]||{};i[t]=e,this.kr(u,i),this.save()}remove_event_timer(t){var e=this.props[u]||{},i=e[t];return Nt(i)||(delete e[t],this.kr(u,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.kr(t,e),this.save()}kr(t,e){this.props[t]=e}Tr(t){delete this.props[t]}}var Gr={Activation:"events",Cancellation:"cancelEvents"},Yr={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Jr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Kr={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Xr={Popover:"popover",Inline:"inline"},Qr={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Zr={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},ts=Ni("[RateLimiter]");class es{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach((t=>{ts.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void ts.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(W))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;return l||t||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(W,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var is=Ni("[RemoteConfig]");class rs{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=St._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Ar(t){var e,i;null!=(e=St.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=St.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Er(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(e){t(e.json)}})}load(){try{if(this.remoteConfig)return is.info("Using preloaded remote config",this.remoteConfig),this.Rr(this.remoteConfig),void this.Nr();if(this._instance.Mr())return void is.warn("Remote config is disabled. Falling back to local config.");this.Ar((t=>{if(!t)return is.info("No config found after loading remote JS config. Falling back to JSON."),void this.Er((t=>{this.Rr(t),this.Nr()}));this.Rr(t),this.Nr()}))}catch(t){is.error("Error loading remote config",t)}}stop(){this.Fr&&(clearInterval(this.Fr),this.Fr=void 0)}refresh(){this._instance.Mr()||"hidden"===(null==gt?void 0:gt.visibilityState)||this._instance.reloadFeatureFlags()}Nr(){var t;if(!this.Fr){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.Fr=setInterval((()=>{this.refresh()}),e))}}Rr(t){var e;t||is.error("Failed to fetch remote config from PostHog."),this._instance.Rr(null!=t?t:{}),!1!==(null==t?void 0:t.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded())}}var ss={GZipJS:"gzip-js",Base64:"base64"},ns=Uint8Array,os=Uint16Array,as=Uint32Array,ls=new ns([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]),us=new ns([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]),hs=new ns([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ds=function(t,e){for(var i=new os(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new as(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},vs=ds(ls,2),cs=vs[1];vs[0][28]=258,cs[258]=28;for(var ps=ds(us,0)[1],fs=new os(32768),_s=0;32768>_s;++_s){var gs=(43690&_s)>>>1|(21845&_s)<<1;fs[_s]=((65280&(gs=(61680&(gs=(52428&gs)>>>2|(13107&gs)<<2))>>>4|(3855&gs)<<4))>>>8|(255&gs)<<8)>>>1}var ms=function(t,e,i){for(var r=t.length,s=0,n=new os(e);r>s;++s)++n[t[s]-1];var o,a=new os(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new os(1<<e);var l=15-e;for(s=0;r>s;++s)if(t[s])for(var u=s<<4|t[s],h=e-t[s],d=a[t[s]-1]++<<h,v=d|(1<<h)-1;v>=d;++d)o[fs[d]>>>l]=u}else for(o=new os(r),s=0;r>s;++s)o[s]=fs[a[t[s]-1]++]>>>15-t[s];return o},bs=new ns(288);for(_s=0;144>_s;++_s)bs[_s]=8;for(_s=144;256>_s;++_s)bs[_s]=9;for(_s=256;280>_s;++_s)bs[_s]=7;for(_s=280;288>_s;++_s)bs[_s]=8;var ys=new ns(32);for(_s=0;32>_s;++_s)ys[_s]=5;var ws=ms(bs,9,0),xs=ms(ys,5,0),Es=function(t){return(t/8>>0)+(7&t&&1)},Ss=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof os?os:t instanceof as?as:ns)(i-e);return r.set(t.subarray(e,i)),r},$s=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},Ts=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},ks=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new ns(0),0];if(1==s){var o=new ns(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,h=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=s-1;)a=i[i[d].f>i[u].f?u++:d++],l=i[u!=h&&i[d].f>i[u].f?u++:d++],i[h++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new os(v+1),p=Rs(i[h-1],c,0);if(p>e){r=0;var f=0,_=p-e,g=1<<_;for(n.sort((function(t,e){return c[e.s]-c[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=c[m])break;f+=g-(1<<p-c[m]),c[m]=e}for(f>>>=_;f>0;){var b=n[r].s;e>c[b]?f-=1<<e-c[b]++-1:++r}for(;r>=0&&f;--r){var y=n[r].s;c[y]==e&&(--c[y],++f)}p=e}return[new ns(c),p]},Rs=function(t,e,i){return-1==t.s?Math.max(Rs(t.l,e,i+1),Rs(t.r,e,i+1)):e[t.s]=i},Ps=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new os(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[i.subarray(0,r),e]},Os=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},Is=function(t,e,i){var r=i.length,s=Es(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},Cs=function(t,e,i,r,s,n,o,a,l,u,h){$s(e,h++,i),++s[256];for(var d=ks(s,15),v=d[0],c=d[1],p=ks(n,15),f=p[0],_=p[1],g=Ps(v),m=g[0],b=g[1],y=Ps(f),w=y[0],x=y[1],E=new os(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;w.length>S;++S)E[31&w[S]]++;for(var T=ks(E,7),k=T[0],R=T[1],P=19;P>4&&!k[hs[P-1]];--P);var O,I,C,F,A=u+5<<3,M=Os(s,bs)+Os(n,ys)+o,D=Os(s,v)+Os(n,f)+o+14+3*P+Os(E,k)+(2*E[16]+3*E[17]+7*E[18]);if(M>=A&&D>=A)return Is(e,h,t.subarray(l,l+u));if($s(e,h,1+(M>D)),h+=2,M>D){O=ms(v,c,0),I=v,C=ms(f,_,0),F=f;var L=ms(k,R,0);for($s(e,h,b-257),$s(e,h+5,x-1),$s(e,h+10,P-4),h+=14,S=0;P>S;++S)$s(e,h+3*S,k[hs[S]]);h+=3*P;for(var U=[m,w],N=0;2>N;++N){var j=U[N];for(S=0;j.length>S;++S)$s(e,h,L[z=31&j[S]]),h+=k[z],z>15&&($s(e,h,j[S]>>>5&127),h+=j[S]>>>12)}}else O=ws,I=bs,C=xs,F=ys;for(S=0;a>S;++S)if(r[S]>255){var z;Ts(e,h,O[257+(z=r[S]>>>18&31)]),h+=I[z+257],z>7&&($s(e,h,r[S]>>>23&31),h+=ls[z]);var B=31&r[S];Ts(e,h,C[B]),h+=F[B],B>3&&(Ts(e,h,r[S]>>>5&8191),h+=us[B])}else Ts(e,h,O[r[S]]),h+=I[r[S]];return Ts(e,h,O[256]),h+I[256]},Fs=new as([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),As=function(){for(var t=new as(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),Ms=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Ds(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=As[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,l,u=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,function(t,e,i,r,s,n){var o=t.length,a=new ns(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var d=h+65535;o>d?u=Is(l,u,t.subarray(h,d)):(l[h]=!0,u=Is(l,u,t.subarray(h,o)))}else{for(var v=Fs[e-1],c=v>>>13,p=8191&v,f=(1<<i)-1,_=new os(32768),g=new os(f+1),m=Math.ceil(i/3),b=2*m,y=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<b)&f},w=new as(25e3),x=new os(288),E=new os(32),S=0,T=0,k=(h=0,0),R=0,P=0;o>h;++h){var O=y(h),I=32767&h,C=g[O];if(_[I]=C,g[O]=I,h>=R){var F=o-h;if((S>7e3||k>24576)&&F>423){u=Cs(t,l,0,w,x,E,T,k,P,h-P,u),k=S=T=0,P=h;for(var A=0;286>A;++A)x[A]=0;for(A=0;30>A;++A)E[A]=0}var M=2,D=0,L=p,U=I-C&32767;if(F>2&&O==y(h-U))for(var N=Math.min(c,F)-1,j=Math.min(32767,h),z=Math.min(258,F);j>=U&&--L&&I!=C;){if(t[h+M]==t[h+M-U]){for(var B=0;z>B&&t[h+B]==t[h+B-U];++B);if(B>M){if(M=B,D=U,B>N)break;var H=Math.min(U,B-2),q=0;for(A=0;H>A;++A){var V=h-U+A+32768&32767,W=V-_[V]+32768&32767;W>q&&(q=W,C=V)}}}U+=(I=C)-(C=_[I])+32768&32767}if(D){w[k++]=268435456|cs[M]<<18|ps[D];var G=31&cs[M],Y=31&ps[D];T+=ls[G]+us[Y],++x[257+G],++E[Y],R=h+M,++S}else w[k++]=t[h],++x[t[h]]}}u=Cs(t,l,!0,w,x,E,T,k,P,h-P,u)}return Ss(a,0,r+Es(u)+s)}(n=t,null==(o=e).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),h=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&Ms(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(u,e),Ms(u,h-8,i.d()),Ms(u,h-4,r),u}var Ls=!!yt||!!bt,Us="text/plain",Ns=!1,js=function(t,e,r){var s;void 0===r&&(r=!0);var[n,o]=t.split("?"),a=i({},e),l=null!==(s=null==o?void 0:o.split("&").map((t=>{var e,[i,s]=t.split("="),n=r&&null!==(e=a[i])&&void 0!==e?e:s;return delete a[i],i+"="+n})))&&void 0!==s?s:[],u=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return zi(t,(function(t,e){Nt(t)||Nt(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(a);return u&&l.push(u),n+"?"+l.join("&")},zs=(t,e)=>JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e),Bs=t=>{if(t.er)return t.er;var{data:e,compression:i}=t;if(e){if(i===ss.GZipJS){var r=Ds(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new ns(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new ns(s+8+(i-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Ss(r,0,s)}(zs(e)),{mtime:0});return{contentType:Us,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===ss.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(zs(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:zs(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=zs(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Hs=function(){var t=e((function*(t){var e=zs(t.data),r=yield function(t,e,i){return $t.apply(this,arguments)}(e,n.DEBUG,{rethrow:!0});if(!r)return t;var s=yield r.arrayBuffer();return i({},t,{er:{contentType:Us,body:s,estimatedSize:s.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),qs=(t,e)=>js(t,{_:(new Date).getTime().toString(),ver:n.JS_SDK_VERSION,compression:e}),Vs=[];bt&&Vs.push({transport:"fetch",method(t){var e,r,{contentType:s,body:n,estimatedSize:o}=null!==(e=Bs(t))&&void 0!==e?e:{},a=new Headers;zi(t.headers,(function(t,e){a.append(e,t)})),s&&a.append("Content-Type",s);var l=t.url,u=null;if(wt){var h=new wt;u={signal:h.signal,timeout:setTimeout((()=>h.abort()),t.timeout)}}bt(l,i({method:(null==t?void 0:t.method)||"GET",headers:a,keepalive:"POST"===t.method&&52428.8>(o||0),body:n,signal:null==(r=u)?void 0:r.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){Ui.error(t)}null==t.callback||t.callback(r)})))).catch((e=>{Ui.error(e),null==t.callback||t.callback({statusCode:0,error:e})})).finally((()=>u?clearTimeout(u.timeout):null))}}),yt&&Vs.push({transport:"XHR",method(t){var e,i=new yt;i.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(e=Bs(t))&&void 0!==e?e:{};zi(t.headers,(function(t,e){i.setRequestHeader(e,t)})),r&&i.setRequestHeader("Content-Type",r),t.timeout&&(i.timeout=t.timeout),t.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(s)}}),null!=_t&&_t.sendBeacon&&Vs.push({transport:"sendBeacon",method(t){var e=js(t.url,{beacon:"1"});try{var i,{contentType:r,body:s}=null!==(i=Bs(t))&&void 0!==i?i:{};if(!s)return;var n=s instanceof Blob?s:new Blob([s],{type:r});_t.sendBeacon(e,n)}catch(t){}}});var Ws=3e3;class Gs{constructor(t,e){this.Or=!0,this.Pr=[],this.Lr=ee((null==e?void 0:e.flush_interval_ms)||Ws,250,5e3,Ui.createLogger("flush interval"),Ws),this.Dr=t}enqueue(t){this.Pr.push(t),this.Br||this.jr()}unload(){this.$r();var t=this.Pr.length>0?this.qr():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Dr(i({},t,{transport:"sendBeacon"}))}))}enable(){this.Or=!1,this.jr()}jr(){var t=this;this.Or||(this.Br=setTimeout((()=>{if(this.$r(),this.Pr.length>0){var e=this.qr(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&Mt(i.data)&&zi(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Dr(i)};for(var r in e)i()}}),this.Lr))}$r(){clearTimeout(this.Br),this.Br=void 0}qr(){var t={};return zi(this.Pr,(e=>{var r,s=e,n=(s?s.batchKey:null)||s.url;Nt(t[n])&&(t[n]=i({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this.Pr=[],t}}var Ys=["retriesPerformedSoFar"];class Js{constructor(t){this.Zr=!1,this.Hr=3e3,this.Pr=[],this._instance=t,this.Pr=[],this.Vr=!0,!Nt(pt)&&"onLine"in pt.navigator&&(this.Vr=pt.navigator.onLine,this.zr=()=>{this.Vr=!0,this.Ur()},this.Yr=()=>{this.Vr=!1},Ji(pt,"online",this.zr),Ji(pt,"offline",this.Yr))}get length(){return this.Pr.length}retriableRequest(t){var{retriesPerformedSoFar:e}=t,s=r(t,Ys);Vt(e)&&(s.url=js(s.url,{retry_count:e})),this._instance._send_request(i({},s,{callback:t=>{200===t.statusCode||t.statusCode>=400&&500>t.statusCode||(null!=e?e:0)>=10?null==s.callback||s.callback(t):this.Wr(i({retriesPerformedSoFar:e},s))}}))}Wr(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this.Pr.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),Ui.warn(s),this.Zr||(this.Zr=!0,this.Gr())}Gr(){if(this.Xr&&clearTimeout(this.Xr),0===this.Pr.length)return this.Zr=!1,void(this.Xr=void 0);this.Xr=setTimeout((()=>{this.Vr&&this.Pr.length>0&&this.Ur(),this.Gr()}),this.Hr)}Ur(){var t=Date.now(),e=[],i=this.Pr.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.Pr=e,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:t}of(this.Xr&&(clearTimeout(this.Xr),this.Xr=void 0),this.Zr=!1,Nt(pt)||(this.zr&&(pt.removeEventListener("online",this.zr),this.zr=void 0),this.Yr&&(pt.removeEventListener("offline",this.Yr),this.Yr=void 0)),this.Pr))try{this._instance._send_request(i({},t,{transport:"sendBeacon"}))}catch(t){Ui.error(t)}this.Pr=[]}}class Ks{constructor(t){this.Jr=()=>{var t,e,i,r;this.Kr||(this.Kr={});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.Kr.lastScrollY=Math.ceil(n),this.Kr.maxScrollY=Math.max(n,null!==(t=this.Kr.maxScrollY)&&void 0!==t?t:0),this.Kr.maxScrollHeight=Math.max(o,null!==(e=this.Kr.maxScrollHeight)&&void 0!==e?e:0),this.Kr.lastContentY=a,this.Kr.maxContentY=Math.max(a,null!==(i=this.Kr.maxContentY)&&void 0!==i?i:0),this.Kr.maxContentHeight=Math.max(l,null!==(r=this.Kr.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get Qr(){return this._instance.config.scroll_root_selector}getContext(){return this.Kr}resetContext(){var t=this.Kr;return setTimeout(this.Jr,0),t}startMeasuringScrollPosition(){Ji(pt,"scroll",this.Jr,{capture:!0}),Ji(pt,"scrollend",this.Jr,{capture:!0}),Ji(pt,"resize",this.Jr)}scrollElement(){if(!this.Qr)return null==pt?void 0:pt.document.documentElement;var t=Mt(this.Qr)?this.Qr:[this.Qr];for(var e of t){var i=null==pt?void 0:pt.document.querySelector(e);if(i)return i}}scrollY(){if(this.Qr){var t=this.scrollElement();return t&&t.scrollTop||0}return pt&&(pt.scrollY||pt.pageYOffset||pt.document.documentElement.scrollTop)||0}scrollX(){if(this.Qr){var t=this.scrollElement();return t&&t.scrollLeft||0}return pt&&(pt.scrollX||pt.pageXOffset||pt.document.documentElement.scrollLeft)||0}}var Xs=t=>zr(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class Qs{constructor(t,e,i,r){this.ei=t=>{var e=this.ti();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.ri(this._instance)};this.ii.register({[V]:i})}},this._instance=t,this.ni=e,this.ii=i,this.ri=r||Xs,this.ni.onSessionId(this.ei)}ti(){return this.ii.props[V]}getSetOnceProps(){var t,e=null==(t=this.ti())?void 0:t.props;return e?"r"in e?Br(e):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return zi(Wi(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+It(i)]=e})),t}}class Zs{constructor(){this.si={}}on(t,e){return this.si[t]||(this.si[t]=[]),this.si[t].push(e),()=>{this.si[t]=this.si[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.si[t]||[])i(e);for(var r of this.si["*"]||[])r(t,e)}}var tn=Ni("[SessionId]");class en{on(t,e){return this.oi.on(t,e)}constructor(t,e,i){var r;if(this.ai=[],this.li=void 0,this.oi=new Zs,this.ui=(t,e)=>!(!Vt(t)||!Vt(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===st)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Lt=t.config,this.ii=t.persistence,this.hi=void 0,this.ci=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.di=e||ir,this.vi=i||ir;var s=this.Lt.persistence_name||this.Lt.token;if(this._sessionTimeoutMs=1e3*ee(this.Lt.session_idle_timeout_seconds||1800,60,36e3,tn.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.fi(),this.pi="ph_"+s+"_window_id",this.gi="ph_"+s+"_primary_window_exists",this.mi()){var n=cr.Z(this.pi),o=cr.Z(this.gi);n&&!o?this.hi=n:cr.F(this.pi),cr.M(this.gi,!0)}if(null!=(r=this.Lt.bootstrap)&&r.sessionID)try{var a=(t=>{var e=this.Lt.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.yi(this.Lt.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){tn.error("Invalid sessionID in bootstrap",t)}this.bi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Nt(this.ai)&&(this.ai=[]),this.ai.push(t),this.ci&&t(this.ci,this.hi),()=>{this.ai=this.ai.filter((e=>e!==t))}}mi(){return"memory"!==this.Lt.persistence&&!this.ii.br&&cr.R()}wi(t){t!==this.hi&&(this.hi=t,this.mi()&&cr.M(this.pi,t))}Ii(){return this.hi?this.hi:this.mi()?cr.Z(this.pi):null}yi(t,e,i){t===this.ci&&e===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.ci=t,this.ii.register({[S]:[e,t,i]}))}Ci(){var t=this.ii.props[S];return Mt(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.yi(null,null,null)}destroy(){clearTimeout(this.Si),this.Si=void 0,this.li&&pt&&(pt.removeEventListener(ut,this.li,{capture:!1}),this.li=void 0),this.ai=[]}bi(){this.li=()=>{this.mi()&&cr.F(this.gi)},Ji(pt,ut,this.li,{capture:!1})}checkAndGetSessionAndWindowId(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=null),this.Lt.cookieless_mode===st)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=e||(new Date).getTime(),[r,s,n]=this.Ci(),o=this.Ii(),a=Vt(n)&&Math.abs(i-n)>864e5,l=!1,u=!s,h=!u&&!t&&this.ui(i,r);u||h||a?(s=this.di(),o=this.vi(),tn.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this.vi(),l=!0);var d=Vt(r)&&t&&!a?r:i,v=Vt(n)?n:(new Date).getTime();return this.wi(o),this.yi(s,d,v),t||this.fi(),l&&this.ai.forEach((t=>t(s,o,l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:v,changeReason:l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}fi(){clearTimeout(this.Si),this.Si=setTimeout((()=>{var[t]=this.Ci();if(this.ui((new Date).getTime(),t)){var e=this.ci;this.resetSessionId(),this.oi.emit("forcedIdleReset",{idleSessionId:e})}}),1.1*this.sessionTimeoutMs)}}var rn=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&kt(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>kt(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver},sn=function(t,e){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}};function nn(t,e,i){return zs({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var on={exact:(t,e)=>e.some((e=>t.some((t=>e===t)))),is_not:(t,e)=>e.every((e=>t.every((t=>e!==t)))),regex:(t,e)=>e.some((e=>t.some((t=>sn(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!sn(e,t))))),icontains:(t,e)=>e.map(an).some((e=>t.map(an).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(an).every((e=>t.map(an).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i<parseFloat(t)))}))},an=t=>t.toLowerCase();function ln(t,e){return!t||Object.entries(t).every((t=>{var[i,r]=t,s=null==e?void 0:e[i];if(Nt(s)||Bt(s))return!1;var n=[String(s)],o=on[r.operator];return!!o&&o(r.values,n)}))}var un="custom",hn="i.posthog.com",dn=/^\/static\//;class vn{constructor(t){this.xi={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+hn,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.xi[this.apiHost]||(this.xi[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":un),this.xi[this.apiHost]}ki(t){var e=this.instance.config.__preview_external_dependency_versioned_paths;if("string"==typeof e&&dn.test(t))return e.trim().replace(/\/$/,"")||void 0}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.uiHost+e;if("flags"===t)return this.flagsApiHost+e;if("assets"===t){var i=this.ki(e);if(i)return""+i+e}if(this.region===un)return this.apiHost+e;var r=hn+e;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var cn=Ni("[Surveys]"),pn="seenSurvey_",fn=[Yr.Popover,Yr.Widget,Yr.API],_n={ignoreConditions:!1,ignoreDelay:!1,displayType:Xr.Popover},gn=Ni("[PostHog ExternalIntegrations]"),mn={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class bn{constructor(t){this._instance=t}lr(t,e){var i;null==(i=St.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return gn.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(e){var i,s,n;!r||null!=(i=St.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]||t.lr(mn[e],(()=>{var i;null==(i=St.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[e])||i.start(t._instance)})),!r&&null!=(s=St.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[e]&&(null==(n=St.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[e])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;e(i)}}}var yn,wn={},xn=0,En=()=>{},Sn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',$n="Surveys module not available",Tn="sanitize_properties is deprecated. Use before_send instead",kn="Invalid value for property_denylist config: ",Rn="posthog",Pn=!Ls&&-1===(null==Et?void 0:Et.indexOf("MSIE"))&&-1===(null==Et?void 0:Et.indexOf("Mozilla")),On=t=>{var e;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Yi(null==gt?void 0:gt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:En,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,__preview_external_dependency_versioned_paths:!1,debug:mt&&jt(null==mt?void 0:mt.search)&&-1!==mt.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==pt||null==(e=pt.location)?void 0:e.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){Ui.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:at,before_send:void 0,request_queue_config:{flush_interval_ms:Ws},error_tracking:{},_onCapture:En,__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))},In=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],Cn=t=>{var e={};for(var[i,r]of In)Nt(t[i])||(e[r]=t[i]);var s=Bi({},e,t);return Mt(t.property_blacklist)&&(Nt(t.property_denylist)?s.property_denylist=t.property_blacklist:Mt(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:Ui.error(kn+t.property_denylist)),s};class Fn{constructor(){this.__forceAllowLocalhost=!1}get Ti(){return this.__forceAllowLocalhost}set Ti(t){Ui.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class An{Ai(t,e){if(t){var i=this.Ei.indexOf(t);-1!==i&&this.Ei.splice(i,1)}return this.Ei.push(e),null==e.initialize||e.initialize(),e}Ri(){return this.config.cookieless_mode===st||this.config.cookieless_mode===rt&&this.consent.isRejected()}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new Fn,this.Ni=!1,this.version=n.LIB_VERSION,this.Mi=new Zs,this.Ei=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=On(),this.SentryIntegration=xr,this.sentryIntegration=t=>function(t,e){var i=wr(t,e);return{name:yr,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fi=!1,this.Oi=null,this.Pi=null,this.Li=null,this.scrollManager=new Ks(this),this.pageViewManager=new Er(this),this.rateLimiter=new es(this),this.requestRouter=new vn(this),this.consent=new pr(this),this.externalIntegrations=new bn(this);var e=null!==(t=An.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=jt(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=jt(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>Ui.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==Rn){var r,s=null!==(r=wn[i])&&void 0!==r?r:new An;return s._init(t,e,i),wn[i]=s,wn[Rn][i]=s,s}return this._init(t,e,i)}_init(t,e,r){var s,o;if(void 0===e&&(e={}),Nt(t)||zt(t))return Ui.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={},e.debug=this.Di(e.debug),this.Bi=e,this.ji=[],e.person_profiles?this.Pi=e.person_profiles:e.process_person&&(this.Pi=e.process_person),this.set_config(Bi({},On(e.defaults),Cn(e),{name:r,token:t})),this.config.on_xhr_error&&Ui.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:ss.GZipJS;var a=this.$i();this.persistence=new Wr(this.config,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Wr(i({},this.config,{persistence:"sessionStorage"}),a);var l=i({},this.persistence.props),u=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.qi=new Gs((t=>this.Zi(t)),this.config.request_queue_config),this.Hi=new Js(this),this.__request_queue=[];var h=this.Ri();if(h||(this.sessionManager=new en(this),this.sessionPropsManager=new Qs(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Ui.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Vi(h)}),0)):(Ui.info("Initializing extensions synchronously"),this.Vi(h)),n.DEBUG=n.DEBUG||this.config.debug,n.DEBUG&&Ui.info("Starting in debug mode",{this:this,config:e,thisC:i({},this.config),p:l,s:u}),!this.config.identity_distinct_id||null!=(s=e.bootstrap)&&s.distinctID||(e.bootstrap=i({},e.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=e.bootstrap)?void 0:o.distinctID)){var d=e.bootstrap.distinctID,v=this.get_distinct_id(),c=this.persistence.get_property(q);if(e.bootstrap.isIdentifiedID&&null!=v&&v!==d&&c===nt)this.identify(d);else if(e.bootstrap.isIdentifiedID&&null!=v&&v!==d&&c===ot)Ui.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var p=this.config.get_device_id(ir()),f=e.bootstrap.isIdentifiedID?p:d;this.persistence.set_property(q,e.bootstrap.isIdentifiedID?ot:nt),this.register({distinct_id:d,$device_id:f})}}if(h)this.register_once({distinct_id:Q,$device_id:null},"");else if(!this.get_distinct_id()){var _=this.config.get_device_id(ir());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(q,nt)}return Ji(pt,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),e.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||ir();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(q,ot)),e()},s=i.user();"then"in s&&Dt(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{Promise&&Promise.resolve||br.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,i)=>{if(!i)return e;e.event.userId||e.event.anonymousId===t.get_distinct_id()||(br.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(br.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var r=t.calculateEventProperties(i,e.event.properties);return e.event.properties=Object.assign({},r,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>e(t,t.event.event),page:t=>e(t,ht),identify:t=>e(t,vt),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.zi())):this.zi(),Dt(this.config._onCapture)&&this.config._onCapture!==En&&(Ui.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Ui.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}Vi(t){var e,r,s,n,o,a,l,u=performance.now(),h=i({},An.__defaultExtensionClasses,this.config.__extensionClasses),d=[];h.featureFlags&&this.Ei.push(this.featureFlags=null!==(e=this.featureFlags)&&void 0!==e?e:new h.featureFlags(this)),h.exceptions&&this.Ei.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new h.exceptions(this)),h.historyAutocapture&&this.Ei.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.Ei.push(new h.tracingHeaders(this)),h.siteApps&&this.Ei.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.Ei.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.Ei.push(this.autocapture=new h.autocapture(this)),h.surveys&&this.Ei.push(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new h.surveys(this)),h.logs&&this.Ei.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new h.logs(this)),h.conversations&&this.Ei.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new h.conversations(this)),h.productTours&&this.Ei.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.Ei.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.Ei.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.Ei.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.Ei.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,gr)),h.toolbar&&this.Ei.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new h.toolbar(this)),h.experiments&&this.Ei.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new h.experiments(this)),this.Ei.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.Ui){var t=this.Ui;this.Ui=void 0,this.Rr(t)}})),this.Yi(d,u)}Yi(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.Yi(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){Ui.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[Z]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[tt]:r}),this.config.__preview_deferred_init_extensions&&Ui.info("PostHog extensions initialized ("+r+"ms)")}Rr(t){var e;if(!gt||!gt.body)return Ui.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Rr(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Ui=t),this.Wi=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=Pt(t.supportedCompression,ss.GZipJS)?ss.GZipJS:Pt(t.supportedCompression,ss.Base64)?ss.Base64:void 0),null!=(e=t.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Pi?this.Pi:at}),this.Ei.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}zi(){try{this.config.loaded(this)}catch(t){Ui.critical("`loaded` function failed",t)}if(this.Gi(),this.config.internal_or_test_user_hostname&&null!=mt&&mt.hostname){var t=mt.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ri())&&this.Xi()}),1),this.Ji=new rs(this),this.Ji.load()}Gi(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.qi)||t.enable())}_dom_loaded(){this.is_capturing()&&ji(this.__request_queue,(t=>this.Zi(t))),this.__request_queue=[],this.Gi()}_handle_unload(){var t,e,i,r;null==(t=this.surveys)||t.handlePageUnload(),this.config.request_batching?(this.Ki()&&this.capture(dt),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(i=this.qi)||i.unload(),null==(r=this.Hi)||r.unload()):this.Ki()&&this.capture(dt,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(Pn?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=js(t.url,{ip:this.config.ip?1:0}),t.headers=i({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,r,s,n=i({},t);n.timeout=n.timeout||6e4,n.url=qs(n.url,n.compression);var o=null!==(e=n.transport)&&void 0!==e?e:"fetch",a=Vs.filter((t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport))),l=null!==(r=null==(s=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===o)return t[i]}(a))?void 0:s.method)&&void 0!==r?r:a[0].method;if(!l)throw new Error("No available transport method");"sendBeacon"!==o&&n.data&&n.compression===ss.GZipJS&&xt&&!Ns?Hs(n).then((t=>{l(t)})).catch((e=>{if((t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""))(e))return Ns=!0,void l(i({},n,{compression:void 0,url:qs(t.url,void 0)}));l(n)})):l(n)})(i({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))))}Zi(t){this.Hi?this.Hi.retriableRequest(t):this._send_request(t)}_execute_array(t){xn++;try{var e,i=[],r=[],s=[];ji(t,(t=>{t&&(Mt(e=t[0])?s.push(t):Dt(t)?t.call(this):Mt(t)&&"alias"===e?i.push(t):Mt(t)&&-1!==e.indexOf("capture")&&Dt(this[e])?s.push(t):r.push(t))}));var n=function(t,e){ji(t,(function(t){if(Mt(t[0])){var i=e;zi(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}))};n(i,this),n(r,this),n(s,this)}finally{xn--}}push(t){if(xn>0&&Mt(t)&&jt(t[0])){var e=An.prototype[t[0]];Dt(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,r){var s,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qi){if(this.is_capturing())if(!Nt(t)&&jt(t)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var h=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==h||!h.isRateLimited){null!=e&&e.$current_url&&!jt(null==e?void 0:e.$current_url)&&(Ui.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=r&&r.Qi||Ui.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=ir(),p={uuid:c,event:t,properties:this.calculateEventProperties(t,e||{},v,c)};t===ht&&this.config.__preview_capture_bot_pageviews&&u&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),h&&(p.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens),(null==r?void 0:r.$set)&&(p.$set=null==r?void 0:r.$set);var f,_,g,m=this.en(null==r?void 0:r.$set_once,t!==ct,t===vt);if(m&&(p.$set_once=m),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,o=p,a=t=>jt(t)?t.slice(0,n):t,l=new Set,p=function t(e,i){return e!==Object(e)?a?a(e):e:l.has(e)?void 0:(l.add(e),Mt(e)?(r=[],ji(e,(e=>{r.push(t(e))}))):(r={},zi(e,((e,i)=>{l.has(e)||(r[i]=t(e,i))}))),r);var r}(o)),p.timestamp=v,Nt(null==r?void 0:r.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),t===Jr.DISMISSED||t===Jr.SENT){var b=null==e?void 0:e[Kr.SURVEY_ID],y=null==e?void 0:e[Kr.SURVEY_ITERATION];(t=>{try{var e=(t=>((t,e)=>{var i=""+pn+e.id;return e.current_iteration&&e.current_iteration>0&&(i=""+pn+e.id+"_"+e.current_iteration),i})(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){cn.error("Failed to persist survey seen state",t)}})({id:b,current_iteration:y}),p.$set=i({},p.$set,{[(f={id:b,current_iteration:y},_=t===Jr.SENT?"responded":"dismissed",g="$survey_"+_+"/"+f.id,f.current_iteration&&f.current_iteration>0&&(g="$survey_"+_+"/"+f.id+"/"+f.current_iteration),g)]:!0})}else t===Jr.SHOWN&&(p.$set=i({},p.$set,{[Kr.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Qr.SHOWN){var w=null==e?void 0:e[Zr.TOUR_TYPE];w&&(p.$set=i({},p.$set,{[Zr.TOUR_LAST_SEEN_DATE+"/"+w]:(new Date).toISOString()}))}var x=i({},p.properties.$set,p.$set);if(Ut(x)||this.setPersonPropertiesForFlags(x),!Ht(this.config.before_send)){var E=this.tn(p);if(!E)return;p=E}this.Mi.emit("eventCaptured",p);var S={method:"POST",url:null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,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.Zi(S):this.qi.enqueue(S),p}Ui.critical("This capture call is ignored due to client rate limiting.")}}else Ui.error("No event name provided to posthog.capture")}else Ui.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}calculateEventProperties(t,e,r,s,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return e;var a=o?void 0:this.persistence.remove_event_timer(t),l=i({},e);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.Ri()&&(l.$cookieless_mode=!0),"$snapshot"===t){var u=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!jt(l.distinct_id)&&!qt(l.distinct_id)||zt(l.distinct_id))&&Ui.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var h,d=function(t,e){var i,r,s,o;if(!Et)return{};var a,l,u,h,d,v,c,p,f=t?[...Ir,...e||[]]:[],[_,g]=function(t){for(var e=0;Ze.length>e;e++){var[i,r]=Ze[e],s=i.exec(t),n=s&&(Dt(r)?r(s,t):r);if(n)return n}return["",""]}(Et);return Bi(Wi({$os:_,$os_version:g,$browser:Ke(Et,navigator.vendor),$device:ti(Et),$device_type:(l=Et,u={userAgentDataPlatform:null==(i=navigator)||null==(i=i.userAgentData)?void 0:i.platform,maxTouchPoints:null==(r=navigator)?void 0:r.maxTouchPoints,screenWidth:null==pt||null==(s=pt.screen)?void 0:s.width,screenHeight:null==pt||null==(o=pt.screen)?void 0:o.height,devicePixelRatio:null==pt?void 0:pt.devicePixelRatio},p=ti(l),p===de||p===he||"Kobo"===p||"Kindle Fire"===p||p===ze?ue:p===Oe||p===Ce||p===Ie||p===Ue?"Console":p===ce?"Wearable":p?oe:"Android"===(null==u?void 0:u.userAgentDataPlatform)&&(null!==(h=null==u?void 0:u.maxTouchPoints)&&void 0!==h?h:0)>0?600>Math.min(null!==(d=null==u?void 0:u.screenWidth)&&void 0!==d?d:0,null!==(v=null==u?void 0:u.screenHeight)&&void 0!==v?v:0)/(null!==(c=null==u?void 0:u.devicePixelRatio)&&void 0!==c?c:1)?oe:ue:"Desktop"),$timezone:Hr(),$timezone_offset:qr()}),{$current_url:Rr(null==mt?void 0:mt.href,f,Fr),$host:null==mt?void 0:mt.host,$pathname:null==mt?void 0:mt.pathname,$raw_user_agent:Et.length>1e3?Et.substring(0,997)+"...":Et,$browser_version:Qe(Et,navigator.vendor),$browser_language:Ur(),$browser_language_prefix:(a=Ur(),"string"==typeof a?a.split("-")[0]:void 0),$screen_height:null==pt?void 0:pt.screen.height,$screen_width:null==pt?void 0:pt.screen.width,$viewport_height:null==pt?void 0:pt.innerHeight,$viewport_width:null==pt?void 0:pt.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&&Bi(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&Bi(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(p=this.Hi)?void 0:p.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===un&&(l.$lib_custom_api_host=this.config.api_host),h=t!==ht||o?t!==dt||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),l=Bi(l,h),t===ht&>&&(l.title=gt.title),!Nt(a)){var f=r.getTime()-a;l.$duration=parseFloat((f/1e3).toFixed(3))}Et&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=Bi({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),Mt(this.config.property_denylist)?zi(this.config.property_denylist,(function(t){delete l[t]})):Ui.error(kn+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(Ui.error(Tn),l=_(l,t));var g=this.rn();return l.$process_person_profile=g,g&&!o&&this.nn("_calculate_event_properties"),l}en(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.rn())return t;if(this.Ni&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=Bi({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Ui.error(Tn),o=a(o,"$set_once")),e&&(this.Ni=!0),Ut(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e;null==(e=this.sessionPersistence)||e.register(t)}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t)}sn(t,e){this.register({[t]:e})}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}isFeatureEnabled(t,e){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(t,e)}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.Mi.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:$n}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:$n})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:$n})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=_n),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:$n}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:$n})}an(t){return!t||zt(t)?(Ui.critical("Unique user id has not been set in posthog.identify"),!1):t===Q?(Ui.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())||(Ui.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return Ui.uninitializedWarning("posthog.identify");if(qt(t)&&(t=t.toString(),Ui.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.an(t)&&this.nn("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(q)||nt)===nt;t!==r&&n?(this.persistence.set_property(q,ot),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.capture(vt,{distinct_id:t,$anon_distinct_id:r},{$set:e||{},$set_once:i||{}}),this.Li=nn(t,e,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(e||i)&&this.setPersonProperties(e,i),t!==r&&(this.reloadFeatureFlags(),this.unregister(j))}}setPersonProperties(t,e){if((t||e)&&this.nn("posthog.setPersonProperties")){var i=nn(this.get_distinct_id(),t,e);this.Li!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Li=i):Ui.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,e,r){if(t&&e){var s=this.getGroups(),n=s[t]!==e;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:i({},s,{[t]:e})}),n||r){var o={$group_type:t,$group_key:e};r&&(o.$group_set=r),this.capture(ct,o)}r&&this.setGroupPropertiesForFlags({[t]:r}),n&&!r&&this.reloadFeatureFlags()}else Ui.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(){var t;null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.nn("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e,i,r,s,n,o,l,u;if(Ui.info("reset"),!this.__loaded)return Ui.uninitializedWarning("posthog.reset");var h=this.get_property(a);if(this.consent.reset(),null==(e=this.persistence)||e.clear(),null==(i=this.sessionPersistence)||i.clear(),null==(r=this.surveys)||r.reset(),null==(s=this.Ji)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(l=this.persistence)||l.set_property(q,nt),null==(u=this.sessionManager)||u.resetSessionId(),this.Li=null,this.config.cookieless_mode===st)this.register_once({distinct_id:Q,$device_id:null},"");else{var d=this.config.get_device_id(ir());this.register_once({distinct_id:d,$device_id:t?d:h},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(t,e){var i;this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i.ln()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.un()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:e,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property(o)?(Ui.critical("Attempting to create alias for existing People user - aborting."),-2):this.nn("posthog.alias")?(Nt(e)&&(e=this.get_distinct_id()),t!==e?(this.sn(l,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Ui.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=i({},this.config);if(Lt(t)){var r,s,o,a,l,u,h,d,v,c;Bi(this.config,Cn(t));var p=this.$i();null==(r=this.persistence)||r.update_config(this.config,e,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Wr(i({},this.config,{persistence:"sessionStorage"}),p);var f=this.Di(this.config.debug);Wt(f)&&(this.config.debug=f),Wt(this.config.debug)&&(this.config.debug?(n.DEBUG=!0,lr.R()&&lr.M("ph_debug",!0),Ui.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(n.DEBUG=!1,lr.R()&&lr.F("ph_debug"))),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.autocapture)||l.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),null==(h=this.exceptionObserver)||h.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(v=this.surveys)||v.loadIfEnabled(),this.hn(),null==(c=this.externalIntegrations)||c.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){n.LIB_NAME=t,n.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(i({},s,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:An.cn}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:Rn;return e!==Rn&&(e=Rn+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(q))===ot||(null==(e=this.sessionPersistence)?void 0:e.get_property(q))===ot}rn(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===at&&!this._isIdentified()&&Ut(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[l])&&(null==(e=this.persistence)||null==(e=e.props)||!e[K]))}Ki(){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.rn()||this.nn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.nn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}nn(t){return"never"===this.config.person_profiles?(Ui.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.sn(K,!0),!0)}$i(){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!==rt)}hn(){var t,e,i,r,s=this.$i();return(null==(t=this.persistence)?void 0:t.br)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.br)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==st){if(this.Ri()){var i,r,s,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new en(this),this.pageViewManager=new Er(this),this.persistence&&(this.sessionPropsManager=new Qs(this,this.sessionManager,this.persistence));var a,l=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=An.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.Ai(this.sessionRecording,new l(this)),this.Wi&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Wi)))}var u,h;this.consent.optInOut(!0),this.hn(),this.Gi(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==rt&&(null==(u=this.surveys)||u.loadIfEnabled()),(Nt(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.Xi()}else Ui.warn(Sn)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==st?(this.config.cookieless_mode===rt&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.hn(),this.config.cookieless_mode===rt&&(this.register({distinct_id:Q,$device_id:null}),null==(t=this.sessionManager)||t.destroy(),null==(e=this.pageViewManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(i=this.sessionRecording)||i.stopRecording(),this.sessionRecording=void 0,this.Xi())):Ui.warn(Sn)}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===st||(this.config.cookieless_mode===rt?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.hn()}_is_bot(){return _t?rn(_t,this.config.custom_blocked_useragents):void 0}Xi(){gt&&("visible"===gt.visibilityState?this.Fi||(this.Fi=!0,this.capture(ht,{title:gt.title},{send_instantly:!0}),this.Oi&&(gt.removeEventListener(lt,this.Oi),this.Oi=null)):this.Oi||(this.Oi=this.Xi.bind(this),Ji(gt,lt,this.Oi)))}debug(t){!1===t?(null==pt||pt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==pt||pt.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}))}Mr(){var t,e,i,r,s,n,o=this.Bi||{};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?(Ui.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",!1,r=Ui,s=(e="advanced_disable_flags")in(t=o)&&!Ht(t[e]),n=i in t&&!Ht(t[i]),s?t[e]:!!n&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i]))}tn(t){if(Ht(this.config.before_send))return t;var e=Mt(this.config.before_send)?this.config.before_send:[this.config.before_send],i=t;for(var r of e){if(i=r(i),Ht(i)){var s="Event '"+t.event+"' was rejected in beforeSend function";return Yt(t.event)?Ui.warn(s+". This can cause unexpected behavior."):Ui.info(s),null}i.properties&&!Ut(i.properties)||Ui.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var t;return null==(t=this.pageViewManager.cr)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Di(t){var e=Wt(t)&&!t,i=lr.R()&&"true"===lr.O("ph_debug");return!e&&(!!i||t)}}function Mn(t){return t instanceof Element&&(t.id===X||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Dn(t){return!!t&&1===t.nodeType}function Ln(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Un(t){return!!t&&3===t.nodeType}function Nn(t){return!!t&&11===t.nodeType}function jn(t){return t?Ot(t).split(/\s+/):[]}function zn(t){var e=null==pt?void 0:pt.location.href;return!!(e&&t&&t.some((t=>e.match(t))))}function Bn(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return jn(e)}function Hn(t){return Ht(t)?null:Ot(t).split(/(\s+)/).filter((t=>ao(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function qn(t){var e="";return Zn(t)&&!to(t)&&t.childNodes&&t.childNodes.length&&zi(t.childNodes,(function(t){var i;Un(t)&&t.textContent&&(e+=null!==(i=Hn(t.textContent))&&void 0!==i?i:"")})),Ot(e)}function Vn(t){return Nt(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}An.__defaultExtensionClasses={},An.cn={trace:yn=()=>{},debug:yn,info:yn,warn:yn,error:yn,fatal:yn},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=Vi(t.prototype[e[i]])}(An,["identify"]);var Wn=["a","button","form","input","select","textarea","label"];function Gn(t,e){if(Nt(e))return!0;var i,r=function(t){if(e.some((e=>t.matches(e))))return{v:!0}};for(var s of t)if(i=r(s))return i.v;return!1}function Yn(t){var e=t.parentNode;return!(!e||!Dn(e))&&e}var Jn=["next","previous","prev",">","<"],Kn=[".ph-no-rageclick",".ph-no-capture"];var Xn=t=>!t||Ln(t,"html")||!Dn(t),Qn=(t,e)=>{if(!pt||Xn(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[t],s=t;s.parentNode&&!Ln(s,"body");)if(Nn(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=Yn(s);if(!n)break;if(e||Wn.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var o=pt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function Zn(t){for(var e=t;e.parentNode&&!Ln(e,"body");e=e.parentNode){var i=Bn(e);if(Pt(i,"ph-sensitive")||Pt(i,"ph-no-capture"))return!1}if(Pt(Bn(t),"ph-include"))return!0;var r=t.type||"";if(jt(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!jt(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 to(t){return!!(Ln(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Ln(t,"select")||Ln(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var eo="(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})",io=new RegExp("^(?:"+eo+")$"),ro=new RegExp(eo),so="\\d{3}-?\\d{2}-?\\d{4}",no=new RegExp("^("+so+")$"),oo=new RegExp("("+so+")");function ao(t,e){if(void 0===e&&(e=!0),Ht(t))return!1;if(jt(t)){if(t=Ot(t),(e?io:ro).test((t||"").replace(/[- ]/g,"")))return!1;if((e?no:oo).test(t))return!1}return!0}function lo(t){var e=qn(t);return ao(e=(e+" "+uo(t)).trim())?e:""}function uo(t){var e="";return t&&t.childNodes&&t.childNodes.length&&zi(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=qn(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+uo(t)).trim())}catch(t){Ui.error("[AutoCapture]",t)}})),e}function ho(t){return t.replace(/"|\\"/g,'\\"')}function vo(t){var e=t.attr__class;return e?Mt(e)?e:jn(e):void 0}class co{constructor(t){this.disabled=!1===t;var e=Lt(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(e-r.y)<this.thresholdPx&&this.timeoutMs>i-r.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}}var po="$copy_autocapture",fo=Ni("[AutoCapture]");function _o(t,e){return e.length>t?e.slice(0,t)+"...":e}function go(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!Dn(e));return e}function mo(t,e){for(var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=e,h=[t],d=t;d.parentNode&&!Ln(d,"body");)Nn(d.parentNode)?(h.push(d.parentNode.host),d=d.parentNode.host):(h.push(d.parentNode),d=d.parentNode);var v,c,p=[],f={},_=!1,g=!1;if(zi(h,(t=>{var e=Zn(t);"a"===t.tagName.toLowerCase()&&(_=t.getAttribute("href"),_=e&&_&&ao(_)&&_),Pt(Bn(t),"ph-no-capture")&&(g=!0),p.push(function(t,e,i,r){var s=t.tagName.toLowerCase(),n={tag_name:s};Wn.indexOf(s)>-1&&!i&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?_o(1024,lo(t)):_o(1024,qn(t)));var o=Bn(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),zi(t.attributes,(function(i){var s;if((!to(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&ao(i.value)&&(!jt(s=i.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=i.value;"class"===i.name&&(o=jn(o).join(" ")),n["attr__"+i.name]=_o(1024,o)}}));for(var a=1,l=1,u=t;u=go(u);)a++,u.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(t,o,a,l));var i=function(t){if(!Zn(t))return{};var e={};return zi(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var i=t.name.replace("data-ph-capture-attribute-",""),r=t.value;i&&r&&ao(r)&&(e[i]=r)}})),e}(t);Bi(f,i)})),g)return{props:{},explicitNoCapture:g};if(a||(p[0].$el_text="a"===t.tagName.toLowerCase()||"button"===t.tagName.toLowerCase()?lo(t):qn(t)),_){var m,b;p[0].attr__href=_;var y=null==(m=Tr(_))?void 0:m.host,w=null==pt||null==(b=pt.location)?void 0:b.host;y&&w&&y!==w&&(v=_)}return{props:Bi({$event_type:n.type,$ce_version:1},u?{}:{$elements:p},{$elements_chain:(c=p,function(t){return t.map((t=>{var e,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=i({},t.text?{text:t.text}:{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e: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 Hi(o).sort(((t,e)=>{var[i]=t,[r]=e;return i.localeCompare(r)})).forEach((t=>{var[e,i]=t;return a[ho(e.toString())]=ho(i.toString())})),(s+=":")+Hi(a).map((t=>{var[e,i]=t;return e+'="'+i+'"'})).join("")})).join(";")}(function(t){return t.map((t=>{var e,i,r={text:null==(e=t.$el_text)?void 0:e.slice(0,400),tag_name:t.tag_name,href:null==(i=t.attr__href)?void 0:i.slice(0,2048),attr_class:vo(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Hi(t).filter((t=>{var[e]=t;return 0===e.indexOf("attr__")})).forEach((t=>{var[e,i]=t;return r.attributes[e]=i})),r}))}(c)))},null!=(r=p[0])&&r.$el_text?{$el_text:null==(s=p[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},f)}}var bo=Ni("[ExceptionAutocapture]");function yo(t,e,i){try{if(!(e in t))return()=>{};var r=t[e],s=i(r);return Dt(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=s,()=>{t[e]=r}}catch(t){return()=>{}}}var wo=Ni("[TracingHeaders]"),xo=Ni("[Web Vitals]"),Eo=9e5,So="disabled",$o="lazy_loading",To="awaiting_config",ko="missing_config";Ni("[SessionRecording]"),Ni("[SessionRecording]");var Ro="[SessionRecording]",Po=Ni(Ro),Oo=Ni("[Heatmaps]");function Io(t){return Lt(t)&&"clientX"in t&&"clientY"in t&&qt(t.clientX)&&qt(t.clientY)}var Co=Ni("[Product Tours]"),Fo=["$set_once","$set"],Ao=Ni("[SiteApps]"),Mo="Error while initializing PostHog app with config id ";function Do(t,e,i){if(Ht(t))return!1;switch(i){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch(t){return!1}default:return!1}}class Lo{constructor(t){this.dn=new Zs,this.vn=(t,e)=>this.fn(t,e)&&this.pn(t,e)&&this.gn(t,e)&&this.mn(t,e),this.fn=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t,this.yn=new Set,this.bn=new Set}init(){var t,e;Nt(null==(t=this._instance)?void 0:t._addCaptureHook)||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.on(t,e)})))}register(t){var e,i;if(!Nt(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e,i;null==(e=this.bn)||e.add(t),null==(i=t.steps)||i.forEach((t=>{var e;null==(e=this.yn)||e.add((null==t?void 0:t.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var r,s=new Set;t.forEach((t=>{var e;null==(e=t.steps)||e.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,e){var i;null!=e&&0!=t.length&&(this.yn.has(t)||this.yn.has(null==e?void 0:e.event))&&this.bn&&(null==(i=this.bn)?void 0:i.size)>0&&this.bn.forEach((t=>{this._n(e,t)&&this.dn.emit("actionCaptured",t.name)}))}wn(t){this.onAction("actionCaptured",(e=>t(e)))}_n(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.vn(t,i))return!0;return!1}onAction(t,e){return this.dn.on(t,e)}pn(t,e){if(null!=e&&e.url){var i,r=null==t||null==(i=t.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Do(r,e.url,e.url_matching||"contains"))return!1}return!0}gn(t,e){return!!this.In(t,e)&&!!this.Cn(t,e)&&!!this.Sn(t,e)}In(t,e){var i;if(null==e||!e.href)return!0;var r=this.xn(t);if(r.length>0)return r.some((t=>Do(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Do((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}Cn(t,e){var i;if(null==e||!e.text)return!0;var r=this.xn(t);if(r.length>0)return r.some((t=>Do(t.text,e.text,e.text_matching||"exact")||Do(t.$el_text,e.text,e.text_matching||"exact")));var s,n,o,a=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!a&&(s=function(t){for(var e,i=[],r=/(?::|")text="(.*?)"/g;!Ht(e=r.exec(t));)i.includes(e[1])||i.push(e[1]);return i}(a),n=e.text,o=e.text_matching||"exact",s.some((t=>Do(t,n,o))))}Sn(t,e){var i,r;if(null==e||!e.selector)return!0;var s=null==t||null==(i=t.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(e.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(e.selector_regex&&n)try{return new RegExp(e.selector_regex).test(n)}catch(t){return!1}return!1}xn(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}mn(t,e){return null==e||!e.properties||0===e.properties.length||ln(e.properties.reduce(((t,e)=>{var i=Mt(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class Uo{constructor(t){this._instance=t,this.kn=new Map,this.Tn=new Map,this.An=new Map}En(t,e){return!!t&&ln(t.propertyFilters,null==e?void 0:e.properties)}Rn(t,e){var i=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[e])||null==(r=r.values)||r.forEach((e=>{if(null!=e&&e.name){var r=i.get(e.name)||[];r.push(t.id),i.set(e.name,r)}}))})),i}Nn(t,e,i){var r=(i===Gr.Activation?this.kn:this.Tn).get(t),s=[];return this.Mn((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[i])||null==(s=s.values)?void 0:s.find((e=>e.name===t));return this.En(n,e)}))}register(t){var e;Nt(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.Fn(t),this.On(t))}On(t){var e=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.actions)&&(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0}));0!==e.length&&(null==this.Pn&&(this.Pn=new Lo(this._instance),this.Pn.init(),this.Pn.wn((t=>{this.onAction(t)}))),e.forEach((t=>{var e,i,r,s,n;t.conditions&&null!=(e=t.conditions)&&e.actions&&null!=(i=t.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.Pn)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((e=>{if(e&&e.name){var i=this.An.get(e.name);i&&i.push(t.id),this.An.set(e.name,i||[t.id])}})))})))}Fn(t){var e,i=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.events)&&(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0})),r=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.cancelEvents)&&(null==(i=t.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0}));0===i.length&&0===r.length||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.onEvent(t,e)})),this.kn=this.Rn(t,Gr.Activation),this.Tn=this.Rn(t,Gr.Cancellation))}onEvent(t,e){var i,r=this.ue(),s=this.Ln(),n=this.Dn(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[s])||[];if(n===t&&e&&o.length>0){var a,l;r.info("event matched, removing item from activated items",{event:t,eventPayload:e,existingActivatedItems:o});var u=(null==e||null==(a=e.properties)?void 0:a.$survey_id)||(null==e||null==(l=e.properties)?void 0:l.$product_tour_id);if(u){var h=o.indexOf(u);0>h||(o.splice(h,1),this.Bn(o))}}else{if(this.Tn.has(t)){var d=this.Nn(t,e,Gr.Cancellation);d.length>0&&(r.info("cancel event matched, cancelling items",{event:t,itemsToCancel:d.map((t=>t.id))}),d.forEach((t=>{var e=o.indexOf(t.id);0>e||o.splice(e,1),this.jn(t.id)})),this.Bn(o))}if(this.kn.has(t)){r.info("event name matched",{event:t,eventPayload:e,items:this.kn.get(t)});var v=this.Nn(t,e,Gr.Activation);this.Bn(o.concat(v.map((t=>t.id))||[]))}}}onAction(t){var e,i=this.Ln(),r=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[i])||[];this.An.has(t)&&this.Bn(r.concat(this.An.get(t)||[]))}Bn(t){var e=this.ue(),i=[...new Set(t)].filter((t=>!this.$n(t)));e.info("updating activated items",{activatedItems:i}),this.qn(i)}getActivatedIds(){var t,e=this.Ln();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}getEventToItemsMap(){return this.kn}Zn(){return this.Pn}}class No extends Uo{constructor(t){super(t)}Ln(){return U}Dn(){return Jr.SHOWN}Mn(t){var e;null==(e=this._instance)||e.getSurveys(t)}jn(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}ue(){return cn}qn(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[U]:t})}$n(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var jo="SDK is not enabled or survey functionality is not yet loaded",zo="Disabled. Not loading surveys.",Bo=null!=pt&&pt.location?Pr(pt.location.hash,"__posthog")||Pr(location.hash,"state"):null,Ho="_postHogToolbarParams",qo=Ni("[Toolbar]"),Vo=Ni("[FeatureFlags]"),Wo=Ni("[FeatureFlags]",{debugEnabled:!0}),Go="\" failed. Feature flags didn't load in time.",Yo=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},Jo=t=>{var e={};for(var[i,r]of Hi(t||{}))r&&(e[i]=r);return e},Ko=Ni("[Error tracking]"),Xo="Refusing to render web experiment since the viewer is a likely bot",Qo={icontains:(t,e)=>!!pt&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!pt&&-1===e.href.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>!!pt&&sn(e.href,t),not_regex:(t,e)=>!!pt&&!sn(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class Zo{get Lt(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{Zo.Hn("retrieved web experiments from the server"),e.Vn=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.Vn&&(Zo.Hn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.Vn)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);jt(r)&&t.variants[r]&&e.zn(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Zo.Un(n)&&e.zn(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Zo.Hn(Xo);else if(!this.Lt.disable_web_experiments){if(Ht(this.Vn))return this.Vn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Zo.Hn("applying feature flags",t),t.forEach((t=>{var e;if(this.Vn&&null!=(e=this.Vn)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.Vn)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.zn(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Zo.getWindowLocation();if(null!=t&&t.search){var e=kr(null==t?void 0:t.search,"__experiment_id"),i=kr(null==t?void 0:t.search,"__experiment_variant");e&&i&&(Zo.Hn("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.Yn(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.Lt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Lt.disable_web_experiments&&!i)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Lt.token),method:"GET",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Yn(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(Zo.Hn("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.zn(r[0].name,e,r[0].variants[e].transforms))}static Un(t){return!Ht(t.conditions)&&Zo.Wn(t)&&Zo.Gn(t)}static Wn(t){var e;if(Ht(t.conditions)||Ht(null==(e=t.conditions)?void 0:e.url))return!0;var i,r,s,n=Zo.getWindowLocation();return!!n&&(null==(i=t.conditions)||!i.url||Qo[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==pt?void 0:pt.location}static Gn(t){var e;if(Ht(t.conditions)||Ht(null==(e=t.conditions)?void 0:e.utm))return!0;var i=Mr();if(i.utm_source){var r,s,n,o,a,l,u,h,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==i.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,p=null==(u=t.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=t.conditions)||null==(h=h.utm)?void 0:h.utm_term)==i.utm_term;return d&&c&&p&&v}return!1}static Hn(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];Ui.info("[WebExperiments] "+t,i)}zn(t,e,i){this._is_bot()?Zo.Hn(Xo):"control"!==e?i.forEach((i=>{if(i.selector){var r;Zo.Hn("applying transform of variant "+e+" for experiment "+t+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((t=>{var e=t;i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)}))}})):Zo.Hn("Control variants leave the page unmodified.")}_is_bot(){return _t&&this._instance?rn(_t,this.Lt.custom_blocked_useragents):void 0}}var ta=Ni("[Conversations]"),ea="Conversations not available yet.",ia={featureFlags:class{constructor(t){this.Xn=!1,this.Jn=!1,this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Lt(){return this._instance.config}get ii(){return this._instance.persistence}ss(t){return this._instance.get_property(t)}os(){var t,e;return null!==(t=null==(e=this.ii)?void 0:e._r(this.Lt.feature_flag_cache_ttl_ms))&&void 0!==t&&t}ls(){return!!this.os()&&(this.ns||this.Kn||(this.ns=!0,Vo.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}us(){var t,e=null!==(t=this.Lt.evaluation_contexts)&&void 0!==t?t:this.Lt.evaluation_environments;return!this.Lt.evaluation_environments||this.Lt.evaluation_contexts||this.rs||(Vo.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.rs=!0),null!=e&&e.length?e.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||Vo.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}hs(){return this.us().length>0}initialize(){var t,e,{config:i}=this._instance,r=null!==(t=null==(e=i.bootstrap)?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,e)=>(t[e]=r[e]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,e)=>(o[e]&&(t[e]=o[e]),t)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,e,r){var s=null!=r&&r.merge?this.getFlagVariants():{},n=null!=r&&r.merge?this.getFlagPayloads():{},o=i({},s,t),a=i({},n,e),l={};for(var[u,h]of Object.entries(o)){var d="string"==typeof h;l[u]={key:u,enabled:!!d||Boolean(h),variant:d?h:void 0,reason:void 0,metadata:Nt(null==a?void 0:a[u])?void 0:{id:0,version:void 0,description:void 0,payload:a[u]}}}this.receivedFeatureFlags({flags:l})}get hasLoadedFlags(){return this.Jn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.ss(O),e=this.ss(F),r=this.ss(A);if(!r&&!e)return t||{};var s=Bi({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(e||{})])];for(var o of n){var a,l,u=s[o],h=null==e?void 0:e[o],d=Nt(h)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!h,v=Nt(h)?u.variant:"string"==typeof h?h:void 0,c=null==r?void 0:r[o],p=i({},u,{enabled:d,variant:d?null!=v?v:null==u?void 0:u.variant:void 0});d!==(null==u?void 0:u.enabled)&&(p.original_enabled=null==u?void 0:u.enabled),v!==(null==u?void 0:u.variant)&&(p.original_variant=null==u?void 0:u.variant),c&&(p.metadata=i({},null==u?void 0:u.metadata,{payload:c,original_payload:null==u||null==(l=u.metadata)?void 0:l.payload})),s[o]=p}return this.Xn||(Vo.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.Xn=!0),s}getFlagVariants(){var t=this.ss(k),e=this.ss(F);if(!e)return t||{};for(var i=Bi({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Xn||(Vo.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Xn=!0),i}getFlagPayloads(){var t=this.ss(I),e=this.ss(A);if(!e)return t||{};for(var i=Bi({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Xn||(Vo.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Xn=!0),i}reloadFeatureFlags(){this.Qn||this.Lt.advanced_disable_feature_flags||this.cs||(this._instance.Mi.emit("featureFlagsReloading",!0),this.cs=setTimeout((()=>{this.ds()}),5))}vs(){clearTimeout(this.cs),this.cs=void 0}ensureFlagsLoaded(){this.Jn||this.Kn||this.cs||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Qn=t}ds(t){var e;if(this.vs(),!this._instance.Mr())if(this.Kn)this.es=!0;else{var r=this.Lt.token,s=this.ss(a),n={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:i({},(null==(e=this.ii)?void 0:e.get_initial_props())||{},this.ss(M)||{}),group_properties:this.ss(D),timezone:Hr()};Bt(s)||Nt(s)||(n.$device_id=s),(null!=t&&t.disableFlags||this.Lt.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.hs()&&(n.evaluation_contexts=this.us());var o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Lt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Kn=!0,this._instance._send_request({method:"POST",url:o,data:n,compression:this.Lt.disable_compression?void 0:ss.Base64,timeout:this.Lt.feature_flag_request_timeout_ms,callback:t=>{var e,i,r,s=!0;if(200===t.statusCode&&(this.es||(this.$anon_distinct_id=void 0),s=!1),this.Kn=!1,!n.disable_flags||this.es){this.ts=!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!=(e=t.json)&&e.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var a,l=!(null==(i=t.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(l&&o.push("quota_limited"),null==(r=this.ii)||r.register({[B]:o}),l)Vo.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,{partialResponse:!!this.Lt.advanced_only_evaluate_survey_feature_flags}),this.es&&(this.es=!1,this.ds())}}})}}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.ts)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var r=this.getFeatureFlagResult(t,e);return null!==(i=null==r?void 0:r.variant)&&void 0!==i?i:null==r?void 0:r.enabled}}else Vo.warn('getFeatureFlag for key "'+t+Go)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e){if(void 0===e&&(e={}),!e.fresh||this.ts)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],o=String(s),a=this.ss(C)||void 0,l=this.ss(H)||void 0,u=this.ss(j)||{};if(this.Lt.advanced_feature_flags_dedup_per_session){var h,d=this._instance.get_session_id(),v=this.ss(z);d&&d!==v&&(u={},null==(h=this.ii)||h.register({[j]:u,[z]:d}))}if((e.send_event||!("send_event"in e))&&(!(t in u)||!u[t].includes(o))){var c,p,f,_,g,m,b,y,w,x;Mt(u[t])?u[t].push(o):u[t]=[o],null==(c=this.ii)||c.register({[j]:u});var E=this.getFeatureFlagDetails(t),S=[...null!==(p=this.ss(B))&&void 0!==p?p:[]];Nt(s)&&S.push("flag_missing");var T={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(f=this.Lt.bootstrap)||null==(f=f.featureFlags)?void 0:f[t])||null,$feature_flag_bootstrapped_payload:(null==(_=this.Lt.bootstrap)||null==(_=_.featureFlagPayloads)?void 0:_[t])||null,$used_bootstrap_value:!this.ts};Nt(null==E||null==(g=E.metadata)?void 0:g.version)||(T.$feature_flag_version=E.metadata.version);var k,R=null!==(m=null==E||null==(b=E.reason)?void 0:b.description)&&void 0!==m?m:null==E||null==(y=E.reason)?void 0:y.code;R&&(T.$feature_flag_reason=R),null!=E&&null!=(w=E.metadata)&&w.id&&(T.$feature_flag_id=E.metadata.id),Nt(null==E?void 0:E.original_variant)&&Nt(null==E?void 0:E.original_enabled)||(T.$feature_flag_original_response=Nt(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(x=E.metadata)&&x.original_payload&&(T.$feature_flag_original_payload=null==E||null==(k=E.metadata)?void 0:k.original_payload),S.length&&(T.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",T)}if(r){var P=n;if(!Nt(n))try{P=JSON.parse(n)}catch(t){}return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:P}}}}else Vo.warn('getFeatureFlagResult for key "'+t+Go)}getRemoteConfigPayload(t,e){var i=this.Lt.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.hs()&&(r.evaluation_contexts=this.us()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Lt.disable_compression?void 0:ss.Base64,timeout:this.Lt.feature_flag_request_timeout_ms,callback(i){var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;e((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,e){if(void 0===e&&(e={}),!e.fresh||this.ts){if(this.Jn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(t,e);return Nt(i)?void 0:!!i}Vo.warn('isFeatureEnabled for key "'+t+Go)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,r){if(this.ii){this.Jn=!0;var s=this.getFlagVariants(),n=this.getFlagPayloads(),o=this.getFlagsWithDetails();!function(t,e,r,s,n,o){void 0===r&&(r={}),void 0===s&&(s={}),void 0===n&&(n={});var a=(t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return null==(i=e[t].metadata)?void 0:i.payload})).map((t=>{var i;return[t,null==(i=e[t].metadata)?void 0:i.payload]})))):Vo.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t),l=a.flags,u=a.featureFlags,h=a.featureFlagPayloads;if(u){var d=t.requestId,v=t.evaluatedAt;if(Mt(u)){Vo.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(u)for(var p=0;u.length>p;p++)c[u[p]]=!0;e&&e.register({[R]:u,[k]:c})}else{var f=u,_=h,g=l;if(null!=o&&o.partialResponse)f=i({},r,f),_=i({},s,_),g=i({},n,g);else if(t.errorsWhileComputingFlags)if(l){var m=new Set(Object.keys(l).filter((t=>{var e;return!(null!=(e=l[t])&&e.failed)})));f=i({},r,Object.fromEntries(Object.entries(f).filter((t=>{var[e]=t;return m.has(e)})))),_=i({},s,Object.fromEntries(Object.entries(_||{}).filter((t=>{var[e]=t;return m.has(e)})))),g=i({},n,Object.fromEntries(Object.entries(g||{}).filter((t=>{var[e]=t;return m.has(e)}))))}else f=i({},r,f),_=i({},s,_),g=i({},n,g);e&&e.register(i({[R]:Object.keys(Jo(f)),[k]:f||{},[I]:_||{},[O]:g||{}},d?{[C]:d}:{},v?{[H]:v}:{}))}}}(t,this.ii,s,n,o,r),e||(this.ns=!1),this.fs(e)}}override(t,e){void 0===e&&(e=!1),Vo.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.ii)return Vo.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.ii.unregister(F),this.ii.unregister(A),this.fs(),Wo.info("All overrides cleared");if(Mt(t)){var e=Yo(t);return this.ii.register({[F]:e}),this.fs(),Wo.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,r=t;if(this.Xn=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.ii.unregister(F),Wo.info("Flag overrides cleared");else if(r.flags){if(Mt(r.flags)){var s=Yo(r.flags);this.ii.register({[F]:s})}else this.ii.register({[F]:r.flags});Wo.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.ii.unregister(A),Wo.info("Payload overrides cleared")):r.payloads&&(this.ii.register({[A]:r.payloads}),Wo.info("Payload overrides set",{payloads:r.payloads}))),void this.fs()}if(t&&"object"==typeof t)return this.ii.register({[F]:t}),this.fs(),Wo.info("Flag overrides set",{flags:t});Vo.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Jn){var{flags:e,flagVariants:i}=this.ps();t(e,i)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var s,n=(this.ss(P)||[]).find((e=>e.flagKey===t)),o={["$feature_enrollment/"+t]:e},a={$feature_flag:t,$feature_enrollment:e,$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=i({},this.getFlagVariants(),{[t]:e});null==(s=this.ii)||s.register({[R]:Object.keys(Jo(l)),[k]:l}),this.fs()}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.ss(P),s=i?"&"+i.map((t=>"stage="+t)).join("&"):"";if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Lt.token+s),method:"GET",callback:e=>{var i,r;if(e.json){var s=e.json.earlyAccessFeatures;return null==(i=this.ii)||i.unregister(P),null==(r=this.ii)||r.register({[P]:s}),t(s)}}})}ps(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,i)=>(t[i]=e[i],t)),{})}}fs(t){var{flags:e,flagVariants:i}=this.ps();this.featureFlagEventHandlers.forEach((r=>r(e,i,{errorsLoading:t})))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.ss(M)||{},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({[M]:i({},r,o,s)}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(M)}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.ss(D)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((e=>{r[e]=i({},r[e],t[e]),delete t[e]})),this._instance.register({[D]:i({},r,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.ss(D)||{};this._instance.register({[D]:i({},e,{[t]:{}})})}else this._instance.unregister(D)}reset(){this.Jn=!1,this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.$anon_distinct_id=void 0,this.vs(),this.Xn=!1}}},ra={sessionRecording:class{get Lt(){return this._instance.config}get ii(){return this._instance.persistence}get started(){var t;return!(null==(t=this.gs)||!t.isStarted)}get status(){var t,e;return this.ys===To||this.ys===ko?this.ys:null!==(t=null==(e=this.gs)?void 0:e.status)&&void 0!==t?t:this.ys}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.ys=So,this.bs=void 0,this._instance=t,!this._instance.sessionManager)throw Po.error("started without valid sessionManager"),new Error(Ro+" started without valid sessionManager. This is a bug.");if(this.Lt.cookieless_mode===st)throw new Error(Ro+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _s(){var t,e=!(null==(t=this._instance.get_property(b))||!t.enabled),i=!this.Lt.disable_session_recording,r=this.Lt.disable_session_recording||this._instance.consent.isOptedOut();return pt&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!this._s||null==(e=this.gs)||!e.isStarted){var i=!Nt(Object.assign)&&!Nt(Array.from);this._s&&i?(this.ws(t),Po.info("starting")):(this.ys=So,this.stopRecording())}}ws(t){var e,i,r;this._s&&(this.ys!==To&&this.ys!==ko&&(this.ys=$o),null!=St&&null!=(e=St.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=St.__PosthogExtensions__)&&i.initSessionRecording?this.Is(t):null==(r=St.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Cs,(e=>{if(e)return Po.error("could not load recorder",e);this.Is(t)})))}stopRecording(){var t,e;null==(t=this.bs)||t.call(this),this.bs=void 0,null==(e=this.gs)||e.stop()}Ss(){var t,e;null==(t=this.bs)||t.call(this),this.bs=void 0,null==(e=this.gs)||e.discard()}xs(){var t;null==(t=this.ii)||t.unregister(T)}ks(t,e){if(Ht(t))return null;var i,r=qt(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(Po.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Ts(t){if(this.ii){var e,r,s=this.ii,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.ks(null==(e=this.Lt.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),o=this.ks(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;Ht(a)&&this.xs();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[b]:i({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:i({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:Nt(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,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};n(),null==(e=this.bs)||e.call(this),this.bs=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.Ts(t),void this.Ss()):(this.Ts(t),void this.startIfEnabledOrStop()):(this.ys===To&&(this.ys=ko,Po.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var i;void 0===e&&(e="log"),null!=(i=this.gs)&&i.log?this.gs.log(t,e):Po.warn("log called before recorder was ready")}get Cs(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(b);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}As(){var t,e=this._instance.get_property(b);if(!e)return!1;var i=null!==(t=("object"==typeof e?e:JSON.parse(e)).cache_timestamp)&&void 0!==t?t:Date.now();return 36e5>=Date.now()-i}Is(t){var e,i;if(null==(e=St.__PosthogExtensions__)||!e.initSessionRecording)return Po.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[et]:!0});if(this.gs||(this.gs=null==(i=St.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.gs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.As()){if(this.ys===ko||this.ys===To)return;return this.ys=To,Po.info("persisted remote config is stale, requesting fresh config before starting"),void new rs(this._instance).load()}this.ys=$o,this.gs.start(t)}onRRwebEmit(t){var e;null==(e=this.gs)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.gs||null==(e=this.ii)||e.register({[w]:!0}),null==(t=this.gs)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.gs||null==(e=this.ii)||e.register({[y]:!0}),null==(t=this.gs)||t.overrideSampling()}overrideTrigger(t){var e,i;this.gs||null==(i=this.ii)||i.register({["url"===t?x:E]:!0}),null==(e=this.gs)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.gs)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.gs)||!i.tryAddCustomEvent(t,e))}}},sa={autocapture:class{constructor(t){this.Es=!1,this.Rs=null,this.Ns=!1,this.instance=t,this.rageclicks=new co(t.config.rageclick),this.Ms=null}initialize(){this.startIfEnabled()}get Lt(){var t,e,i=Lt(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(t=i.url_allowlist)?void 0:t.map((t=>new RegExp(t))),i.url_ignorelist=null==(e=i.url_ignorelist)?void 0:e.map((t=>new RegExp(t))),i}Fs(){if(this.isBrowserSupported()){if(pt&>){var t=t=>{t=t||(null==pt?void 0:pt.event);try{this.Os(t)}catch(t){fo.error("Failed to capture event",t)}};if(Ji(gt,"submit",t,{capture:!0}),Ji(gt,"change",t,{capture:!0}),Ji(gt,"click",t,{capture:!0}),this.Lt.capture_copied_text){var e=t=>{this.Os(t=t||(null==pt?void 0:pt.event),po)};Ji(gt,"copy",e,{capture:!0}),Ji(gt,"cut",e,{capture:!0})}}}else fo.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Es&&(this.Fs(),this.Es=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Ns=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[h]:!!t.autocapture_opt_out}),this.Rs=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Ms=t}getElementSelectors(t){var e,i=[];return null==(e=this.Ms)||e.forEach((e=>{var r=null==gt?void 0:gt.querySelectorAll(e);null==r||r.forEach((r=>{t===r&&i.push(e)}))})),i}get isEnabled(){var t,e,i=null==(t=this.instance.persistence)?void 0:t.props[h];if(Bt(this.Rs)&&!Wt(i)&&!this.instance.Mr())return!1;var r=null!==(e=this.Rs)&&void 0!==e?e:!!i;return!!this.instance.config.autocapture&&!r}Os(t,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var i,r=Vn(t);Un(r)&&(r=r.parentNode||null),"$autocapture"===e&&"click"===t.type&&t instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&function(t,e){if(!pt||Xn(t))return!1;var i,r,s;if(Wt(e)?(i=!!e&&Kn,r=void 0):(i=null!==(s=null==e?void 0:e.css_selector_ignorelist)&&void 0!==s?s:Kn,r=null==e?void 0:e.content_ignorelist),!1===i)return!1;var{targetElementList:n}=Qn(t,!1);return!function(t,e){if(!1===t||Nt(t))return!1;var i;if(!0===t)i=Jn;else{if(!Mt(t))return!1;if(t.length>10)return Ui.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=t.map((t=>t.toLowerCase()))}return e.some((t=>{var{safeText:e,ariaLabel:r}=t;return i.some((t=>e.includes(t)||r.includes(t)))}))}(r,n.map((t=>{var e;return{safeText:qn(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!Gn(n,i)}(r,this.instance.config.rageclick)&&this.Os(t,"$rageclick");var s=e===po;if(r&&function(t,e,i,r,s){var n,o,a,l;if(void 0===i&&(i=void 0),!pt||Xn(t))return!1;if(null!=(n=i)&&n.url_allowlist&&!zn(i.url_allowlist))return!1;if(null!=(o=i)&&o.url_ignorelist&&zn(i.url_ignorelist))return!1;if(null!=(a=i)&&a.dom_event_allowlist){var u=i.dom_event_allowlist;if(u&&!u.some((t=>e.type===t)))return!1}var{parentIsUsefulElement:h,targetElementList:d}=Qn(t,r);if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(Nt(i))return!0;var r,s=function(t){if(i.some((e=>t.tagName.toLowerCase()===e)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(d,i))return!1;if(!Gn(d,null==(l=i)?void 0:l.css_selector_allowlist))return!1;var v=pt.getComputedStyle(t);if(v&&"pointer"===v.getPropertyValue("cursor")&&"click"===e.type)return!0;var c=t.tagName.toLowerCase();switch(c){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return h?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(Wn.indexOf(c)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,this.Lt,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=mo(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Lt.element_attribute_ignorelist,elementsChainAsString:this.Ns});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(n.$element_selectors=a),e===po){var l,u=Hn(null==pt||null==(l=pt.getSelection())?void 0:l.toString()),h=t.type||"clipboard";if(!u)return!1;n.$selected_content=u,n.$copy_type=h}return this.instance.capture(e,n),!0}}}isBrowserSupported(){return Dt(null==gt?void 0:gt.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.Ps=(null==pt||null==(e=pt.location)?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Ui.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ls&&this.Ls(),this.Ls=void 0,Ui.info("History API monitoring stopped")}monitorHistoryChanges(){var t,e;if(pt&&pt.history){var i=this;null!=(t=pt.history.pushState)&&t.__posthog_wrapped__||yo(pt.history,"pushState",(t=>function(e,r,s){t.call(this,e,r,s),i.Ds("pushState")})),null!=(e=pt.history.replaceState)&&e.__posthog_wrapped__||yo(pt.history,"replaceState",(t=>function(e,r,s){t.call(this,e,r,s),i.Ds("replaceState")})),this.Bs()}}Ds(t){try{var e,i=null==pt||null==(e=pt.location)?void 0:e.pathname;if(!i)return;i!==this.Ps&&this.isEnabled&&this._instance.capture(ht,{navigation_type:t}),this.Ps=i}catch(e){Ui.error("Error capturing "+t+" pageview",e)}}Bs(){if(!this.Ls){var t=()=>{this.Ds("popstate")};Ji(pt,"popstate",t),this.Ls=()=>{pt&&pt.removeEventListener("popstate",t)}}}},heatmaps:class{get Lt(){return this.instance.config}constructor(t){var e;this.js=!1,this.Es=!1,this.$s=null,this.instance=t,this.js=!(null==(e=this.instance.persistence)||!e.props[d]),this.rageclicks=new co(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return Lt(this.Lt.capture_heatmaps)&&this.Lt.capture_heatmaps.flush_interval_milliseconds&&(t=this.Lt.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Ht(this.Lt.capture_heatmaps)?Ht(this.Lt.enable_heatmaps)?this.js:this.Lt.enable_heatmaps:!1!==this.Lt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Es)return;Oo.info("starting..."),this.qs(),this.Ot()}else{var t;clearInterval(null!==(t=this.$s)&&void 0!==t?t:void 0),this.Zs(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[d]:e}),this.js=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.T;return this.T=void 0,t}Hs(t){this.At(t.originalEvent,"deadclick")}Ot(){this.$s&&clearInterval(this.$s),this.$s="visible"===(null==gt?void 0:gt.visibilityState)?setInterval(this.Ur.bind(this),this.flushIntervalMilliseconds):null}qs(){pt&>&&(this.Vs=this.Ur.bind(this),Ji(pt,ut,this.Vs),this.zs=t=>this.At(t||(null==pt?void 0:pt.event)),Ji(gt,"click",this.zs,{capture:!0}),this.Us=t=>this.Ys(t||(null==pt?void 0:pt.event)),Ji(gt,"mousemove",this.Us,{capture:!0}),this.Ws=new mr(this.instance,_r,this.Hs.bind(this)),this.Ws.startIfEnabledOrStop(),this.Gs=this.Ot.bind(this),Ji(gt,lt,this.Gs),this.Es=!0)}Zs(){var t;pt&>&&(this.Vs&&pt.removeEventListener(ut,this.Vs),this.zs&>.removeEventListener("click",this.zs,{capture:!0}),this.Us&>.removeEventListener("mousemove",this.Us,{capture:!0}),this.Gs&>.removeEventListener(lt,this.Gs),clearTimeout(this.Xs),null==(t=this.Ws)||t.stop(),this.Es=!1)}Js(t,e){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,e,i){for(var r=t;r&&Dn(r)&&!Ln(r,"body");){if(r===i)return!1;if(Pt(e,null==pt?void 0:pt.getComputedStyle(r).position))return!0;r=Yn(r)}return!1}(Vn(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:i),target_fixed:n,type:e}}At(t,e){var r;if(void 0===e&&(e="click"),!Mn(t.target)&&Io(t)){var s=this.Js(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.Ks(i({},s,{type:"rageclick"})),this.Ks(s)}}Ys(t){!Mn(t.target)&&Io(t)&&(clearTimeout(this.Xs),this.Xs=setTimeout((()=>{this.Ks(this.Js(t,"mousemove"))}),500))}Ks(t){if(pt){var e=pt.location.href,i=this.Lt.custom_personal_data_properties,r=this.Lt.mask_personal_data_properties?[...Ir,...i||[]]:[],s=Rr(e,r,Fr);this.T=this.T||{},this.T[s]||(this.T[s]=[]),this.T[s].push(t)}}Ur(){this.T&&!Ut(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:mr,webVitalsAutocapture:class{constructor(t){var e;this.js=!1,this.Es=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Qs=()=>{clearTimeout(this.eo),0!==this.T.metrics.length&&(this._instance.capture("$web_vitals",this.T.metrics.reduce(((t,e)=>i({},t,{["$web_vitals_"+e.name+"_event"]:i({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.dt=t=>{var e,r=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);if(Nt(r))xo.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.ro();Nt(s)||(Ht(null==t?void 0:t.name)||Ht(null==t?void 0:t.value)?xo.error("Invalid metric received",t):!this.io||this.io>t.value?(this.T.url!==s&&(this.Qs(),this.eo=setTimeout(this.Qs,this.flushToCaptureTimeoutMs)),Nt(this.T.url)&&(this.T.url=s),this.T.firstMetricTimestamp=Nt(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.T.metrics.push(i({},t,{$current_url:s,$session_id:r.sessionId,$window_id:r.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.Qs()):xo.error("Ignoring metric with value >= "+this.io,t))}},this.no=()=>{if(!this.Es){var t,e,i,r,s=St.__PosthogExtensions__;Nt(s)||Nt(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:e,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),t&&e&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.dt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&e(this.dt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.dt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.dt.bind(this)),this.Es=!0):xo.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.js=!(null==(e=this._instance.persistence)||!e.props[f]),this.startIfEnabled()}get so(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=Lt(this.so)?null==(t=this.so)?void 0:t.web_vitals_allowed_metrics:void 0;return Ht(i)?(null==(e=this._instance.persistence)?void 0:e.props[m])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(Lt(this.so)?this.so.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=Lt(this.so)?this.so.web_vitals_attribution:void 0;return null!=t&&t}get io(){var t=Lt(this.so)&&qt(this.so.__web_vitals_max_value)?this.so.__web_vitals_max_value:Eo;return t>0&&6e4>=t?Eo:t}get isEnabled(){var t=null==mt?void 0:mt.protocol;if("http:"!==t&&"https:"!==t)return xo.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=Lt(this.so)?this.so.web_vitals:Wt(this.so)?this.so:void 0;return Wt(e)?e:this.js}startIfEnabled(){this.isEnabled&&!this.Es&&(xo.info("enabled, starting..."),this.lr(this.no))}onRemoteConfig(t){if("capturePerformance"in t){var e=Lt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=Lt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[f]:e}),this._instance.persistence.register({[m]:i})),this.js=e,this.startIfEnabled()}}lr(t){var e,i;null!=(e=St.__PosthogExtensions__)&&e.postHogWebVitalsCallbacks?t():null==(i=St.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(e=>{e?xo.error("failed to load script",e):t()}))}ro(){var t=pt?pt.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...Ir,...e||[]]:[];return Rr(t,i,Fr)}xo.error("Could not determine current URL")}}},na={exceptionObserver:class{constructor(t){var e,i,r;this.no=()=>{var t;if(pt&&this.isEnabled&&null!=(t=St.__PosthogExtensions__)&&t.errorWrappingFunctions){var e=St.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=St.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=St.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.oo&&this.Lt.capture_unhandled_errors&&(this.oo=e(this.captureException.bind(this))),!this.ao&&this.Lt.capture_unhandled_rejections&&(this.ao=i(this.captureException.bind(this))),!this.lo&&this.Lt.capture_console_errors&&(this.lo=r(this.captureException.bind(this)))}catch(t){bo.error("failed to start",t),this.uo()}}},this._instance=t,this.ho=!(null==(e=this._instance.persistence)||!e.props[v]),this.co=new ie({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10,refillInterval:1e4,Yt:bo}),this.Lt=this.do(),this.startIfEnabledOrStop()}do(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Lt(t)?e=i({},e,t):(Nt(t)?this.ho:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Lt.capture_console_errors||this.Lt.capture_unhandled_errors||this.Lt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(bo.info("enabled"),this.uo(),this.lr(this.no)):this.uo()}lr(t){var e,i;null!=(e=St.__PosthogExtensions__)&&e.errorWrappingFunctions&&t(),null==(i=St.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return bo.error("failed to load script",e);t()}))}uo(){var t,e,i;null==(t=this.oo)||t.call(this),this.oo=void 0,null==(e=this.ao)||e.call(this),this.ao=void 0,null==(i=this.lo)||i.call(this),this.lo=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.ho=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[v]:this.ho}),this.Lt=this.do(),this.startIfEnabledOrStop())}onConfigChange(){this.Lt=this.do()}captureException(t){var e,i,r,s=null!==(e=null==t||null==(i=t.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==e?e:"Exception";this.co.consumeRateLimit(s)?bo.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,r;this.vo=[],this.fo=new ai([new bi,new Pi,new wi,new yi,new ki,new Ti,new Ei,new Ri],function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),s=1;e>s;s++)r[s-1]=arguments[s];return function(e,s){void 0===s&&(s=0);for(var n=[],o=e.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var u=mi.test(l)?l.replace(mi,"$1"):l;if(!u.match(/\S*Error: /)){for(var h of r){var d=h(u,t);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var e=Array.from(t);return e.reverse(),e.slice(0,50).map((t=>{return i({},t,{filename:t.filename||(r=e,r[r.length-1]||{}).filename,function:t.function||li});var r}))}(n)}}("web:javascript",pi,gi)),this._instance=t,this.vo=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property(c))&&void 0!==e?e:[],this.po=Ai(this.mo()),this.yo=new Mi(this.po)}onConfigChange(){this.po=Ai(this.mo()),this.yo.setConfig(this.po)}onRemoteConfig(t){var e,i,r;if("errorTracking"in t){var s=null!==(e=null==(i=t.errorTracking)?void 0:i.suppressionRules)&&void 0!==e?e:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.vo=s,this._instance.persistence&&this._instance.persistence.register({[c]:this.vo,[p]:n})}}get bo(){var t,e=!!this._instance.get_property(p),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.fo.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.po.enabled)try{if(!jt(t)||0===t.trim().length)return void Ko.warn("Ignoring exception step because message must be a non-empty string");var r=this._o(e),{sanitizedProperties:s,droppedKeys:n}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>Ci.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(r);n.length>0&&Ko.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.yo.add(i({[Oi]:t,[Ii]:(new Date).toISOString()},s))}catch(t){Ko.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.wo(e)){if(this.Io(e))return this.Co("Exception dropped: matched a suppression rule"),void Ko.info("Skipping exception capture because a suppression rule matched");if(!this.bo&&this.So(e))return this.Co("Exception dropped: thrown by a browser extension"),void Ko.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.xo(e))return this.Co("Exception dropped: thrown by the PostHog SDK"),void Ko.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.po.enabled&&Ht(t.$exception_steps)?this.ko(t):t;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Qi:!0});return r&&this.yo.clear(),r}catch(t){return Ko.error("Failed to capture exception event. Dropping this exception.",t),void this.yo.clear()}}catch(t){return void Ko.error("Failed to process exception event. Ignoring this exception.",t)}}ko(t){try{var e=this.yo.getAttachable();return 0===e.length?t:i({},t,{$exception_steps:e})}catch(e){return Ko.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Co(t){this.po.enabled&&this.yo.add({[Oi]:t,[Ii]:(new Date).toISOString()})}_o(t){return Lt(t)?i({},t):{}}mo(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}Io(t){if(0===t.length)return!1;var e=t.reduce(((t,e)=>{var{type:i,value:r}=e;return jt(i)&&i.length>0&&t.$exception_types.push(i),jt(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.vo.some((t=>{var i=t.values.map((t=>{var i,r=on[t.operator],s=Mt(t.value)?t.value:[t.value],n=null!==(i=e[t.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)}));return"OR"===t.type?i.some(Boolean):i.every(Boolean)}))}So(t){return t.flatMap((t=>{var e,i;return null!==(e=null==(i=t.stacktrace)?void 0:i.frames)&&void 0!==e?e:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}xo(t){if(t.length>0){var e,i,r,s,n=null!==(e=null==(i=t[0].stacktrace)?void 0:i.frames)&&void 0!==e?e:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}wo(t){return!Ht(t)&&Mt(t)}}},oa=i({productTours:class{get ii(){return this._instance.persistence}constructor(t){this.To=null,this.Ao=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this.ii&&this.ii.register({[g]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,e;this.To||(t=this._instance).config.disable_product_tours||null==(e=t.persistence)||!e.get_property(g)||this.lr((()=>this.Eo()))}lr(t){var e,i;null!=(e=St.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=St.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?Co.error("Could not load product tours script",e):t()}))}Eo(){var t;!this.To&&null!=(t=St.__PosthogExtensions__)&&t.generateProductTours&&(this.To=St.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!Mt(this.Ao)||e){var i=this.ii;if(i){var r=i.props[N];if(Mt(r)&&!e)return this.Ao=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:e=>{var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return Co.error(s),void t([],{isLoaded:!1,error:s})}var n=Mt(e.json.product_tours)?e.json.product_tours:[];this.Ao=n,i&&i.register({[N]:n}),t(n,{isLoaded:!0})}})}else t(this.Ao,{isLoaded:!0})}getActiveProductTours(t){Ht(this.To)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.To.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.To)||e.showTourById(t)}previewTour(t){this.To?this.To.previewTour(t):this.lr((()=>{var e;this.Eo(),null==(e=this.To)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.To)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.To)||t.nextStep()}previousStep(){var t;null==(t=this.To)||t.previousStep()}clearCache(){var t;this.Ao=null,null==(t=this.ii)||t.unregister(N)}resetTour(t){var e;null==(e=this.To)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.To)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.To)||e.cancelPendingTour(t)}}},ia),aa={siteApps:class{constructor(t){this._instance=t,this.Ro=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}No(t,e){if(e){var i=this.globalsForEvent(e);this.Ro.push(i),this.Ro.length>1e3&&(this.Ro=this.Ro.slice(10))}}get siteAppLoaders(){var t;return null==(t=St._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.No.bind(this));this.Mo=()=>{t(),this.Ro=[],this.Mo=void 0}}}globalsForEvent(t){var e,s,n,o,a,l,u;if(!t)throw new Error("Event payload is required");var h={},d=this._instance.get_property("$groups")||[],v=this._instance.get_property("$stored_group_properties")||{};for(var[c,p]of Object.entries(v))h[c]={id:d[c],type:c,properties:p};var{$set_once:f,$set:_}=t;return{event:i({},r(t,Fo),{properties:i({},t.properties,_?{$set:i({},null!==(e=null==(s=t.properties)?void 0:s.$set)&&void 0!==e?e:{},_)}:{},f?{$set_once:i({},null!==(n=null==(o=t.properties)?void 0:o.$set_once)&&void 0!==n?n:{},f)}:{}),elements_chain:null!==(a=null==(l=t.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(u=t.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}setupSiteApp(t){var e=this.apps[t.id],i=()=>{var i;!e.errored&&this.Ro.length&&(Ao.info("Processing "+this.Ro.length+" events for site app with id "+t.id),this.Ro.forEach((t=>null==e.processEvent?void 0:e.processEvent(t))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this.Mo)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,Ao.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=t.init({posthog:this._instance,callback(t){s(t)}});n&&(e.processEvent=n),r=!0}catch(e){Ao.error(Mo+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){Ao.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}Fo(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of t)this.setupSiteApp(i)}Oo(t){if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(e)}catch(e){Ao.error("Error while processing event "+t.event+" for site app "+i.id,e)}}}onRemoteConfig(t){var e,i,r,s=this;if(null!=(e=this.siteAppLoaders)&&e.length)return this.isEnabled?(this.Fo(),void this._instance.on("eventCaptured",(t=>this.Oo(t)))):void Ao.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Mo)||i.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var e;St["__$$ph_site_app_"+t]=s._instance,null==(e=St.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(s._instance,a,(e=>{if(e)return Ao.error(Mo+t,e)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else Ao.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},la={tracingHeaders:class{constructor(t){this.Po=void 0,this.Lo=void 0,this.no=()=>{var t,e,i=this.Do()||[];Nt(this.Po)&&(null==(t=St.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(i,this._instance.get_distinct_id(),this._instance.sessionManager)),Nt(this.Lo)&&(null==(e=St.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchFetch(i,this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}initialize(){this.startIfEnabledOrStop()}lr(t){var e,i;null!=(e=St.__PosthogExtensions__)&&e.tracingHeadersPatchFns&&t(),null==(i=St.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return wo.error("failed to load script",e);t()}))}Do(){var t;return null!==(t=this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}startIfEnabledOrStop(){var t,e;this.Do()?this.lr(this.no):(null==(t=this.Po)||t.call(this),null==(e=this.Lo)||e.call(this),this.Po=void 0,this.Lo=void 0)}}},ua=i({surveys:class{get Lt(){return this._instance.config}constructor(t){this.Bo=void 0,this._surveyManager=null,this.jo=!1,this.$o=[],this.qo=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Lt.disable_surveys){var e=t.surveys;if(Ht(e))return cn.warn("Flags not loaded yet. Not loading surveys.");var i=Mt(e);this.Bo=i?e.length>0:e,cn.info("flags response received, isSurveysEnabled: "+this.Bo),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],e=0;e<localStorage.length;e++){var i=localStorage.key(e);(null!=i&&i.startsWith(pn)||null!=i&&i.startsWith("inProgressSurvey_"))&&t.push(i)}t.forEach((t=>localStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.jo)cn.info("Already initializing surveys, skipping...");else if(this.Lt.disable_surveys)cn.info(zo);else if(this.Lt.cookieless_mode&&this._instance.consent.isOptedOut())cn.info("Not loading surveys in cookieless mode without consent.");else{var t=null==St?void 0:St.__PosthogExtensions__;if(t){if(!Nt(this.Bo)||this.Lt.advanced_enable_surveys){var e=this.Bo||this.Lt.advanced_enable_surveys;this.jo=!0;try{var i=t.generateSurveys;if(i)return void this.Zo(i,e);var r=t.loadExternalDependency;if(!r)return void this.Ho(it);r(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.Ho("Could not load surveys script",i):this.Zo(t.generateSurveys,e)}))}catch(t){throw this.Ho("Error initializing surveys",t),t}finally{this.jo=!1}}}else cn.error("PostHog Extensions not found.")}}Zo(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new No(this._instance),cn.info("Surveys loaded successfully"),this.Vo({isLoaded:!0})}Ho(t,e){cn.error(t,e),this.Vo({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.$o.push(t),this._surveyManager&&this.Vo({isLoaded:!0}),()=>{this.$o=this.$o.filter((e=>e!==t))}}getSurveys(t,e){if(void 0===e&&(e=!1),this.Lt.disable_surveys)return cn.info(zo),t([]);var i,r=this._instance.get_property(L);if(r&&!e)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.qo?this.qo.then((e=>{var{surveys:i,context:r}=e;return t(i,r)})):("undefined"!=typeof Promise&&(this.qo=new Promise((t=>{i=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Lt.token),method:"GET",timeout:this.Lt.surveys_request_timeout_ms,callback:e=>{var r;this.qo=null;var s=e.statusCode;if(200!==s||!e.json){var n="Surveys API could not be loaded, status: "+s;cn.error(n);var o={isLoaded:!1,error:n};return t([],o),void(null==i||i({surveys:[],context:o}))}var a,l=e.json.surveys||[],u=l.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var e;return!(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}(t)||function(t){var e;return!(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)||!e.length)}(t))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(r=this._instance.persistence)||r.register({[L]:l});var h={isLoaded:!0};t(l,h),null==i||i({surveys:l,context:h})}}))}Vo(t){for(var e of this.$o)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){cn.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!Ht(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);cn.warn("init was not called")}zo(t){var e=null;return this.getSurveys((i=>{var r;e=null!==(r=i.find((e=>e.id===t)))&&void 0!==r?r:null})),e}Uo(t){if(Ht(this._surveyManager))return{eligible:!1,reason:jo};var e="string"==typeof t?this.zo(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Ht(this._surveyManager))return cn.warn("init was not called"),{visible:!1,disabledReason:jo};var e=this.Uo(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Ht(this._surveyManager)?(cn.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:jo})):new Promise((i=>{this.getSurveys((e=>{var r,s=null!==(r=e.find((e=>e.id===t)))&&void 0!==r?r:null;if(s){var n=this.Uo(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var r;if(Ht(this._surveyManager))cn.warn("init was not called");else{var s="string"==typeof t?this.zo(t):t;if(null!=s&&s.id)if(fn.includes(s.type)){var n=null==gt?void 0:gt.querySelector(e);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(cn.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,e;cn.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(e=this._surveyManager)||e.renderSurvey(s,n,i),cn.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);cn.warn("Survey element not found")}else cn.warn("Surveys of type "+s.type+" cannot be rendered in the app");else cn.warn("Survey not found")}}displaySurvey(t,e){var r;if(Ht(this._surveyManager))cn.warn("init was not called");else{var s=this.zo(t);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&e.ignoreDelay&&(n=i({},s,{appearance:i({},s.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==Xr.Popover&&e.initialResponses&&cn.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var o=this.canRenderSurvey(s);if(!o.visible)return void cn.warn("Survey is not eligible to be displayed: ",o.disabledReason)}e.displayType!==Xr.Inline?this._surveyManager.handlePopoverSurvey(n,e):this.renderSurvey(n,e.selector,e.properties)}else cn.warn("Survey not found")}}cancelPendingSurvey(t){Ht(this._surveyManager)?cn.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},ia),ha={toolbar:class{constructor(t){this.instance=t}Yo(t){St.ph_toolbar_state=t}Wo(){var t;return null!==(t=St.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,i){if(void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),Ki(this.instance.config))return!1;if(!pt||!gt)return!1;t=null!=t?t:pt.location,i=null!=i?i:pt.history;try{if(!e){try{pt.localStorage.setItem("test","test"),pt.localStorage.removeItem("test")}catch(t){return!1}e=null==pt?void 0:pt.localStorage}var r,s=Bo||Pr(t.hash,"__posthog")||Pr(t.hash,"state"),n=s?qi((()=>JSON.parse(atob(decodeURIComponent(s)))))||qi((()=>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:i?i.replaceState(i.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(e.getItem(Ho)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Go(t){var e=St.ph_load_toolbar||St.ph_load_editor;!Ht(e)&&Dt(e)?e(t,this.instance):qo.warn("No toolbar load function found")}loadToolbar(t){var e=!(null==gt||!gt.getElementById(X));if(!pt||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=i({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(pt.localStorage.setItem(Ho,JSON.stringify(i({},s,{source:void 0}))),2===this.Wo())this.Go(s);else if(0===this.Wo()){var n;this.Yo(1),null==(n=St.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return qo.error("[Toolbar] Failed to load",t),void this.Yo(0);this.Yo(2),this.Go(s)})),Ji(pt,"turbolinks:load",(()=>{this.Yo(0),this.loadToolbar(s)}))}return!0}Xo(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,i){return void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(t,e,i)}}},da=i({experiments:Zo},ia),va={conversations:class{constructor(t){this.Jo=void 0,this._conversationsManager=null,this.Ko=!1,this.Qo=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;Ht(e)||(Wt(e)?this.Jo=e:(this.Jo=e.enabled,this.Qo=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Jo=void 0,this.Qo=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ko||this._instance.config.disable_conversations||Ki(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==St?void 0:St.__PosthogExtensions__;if(t&&!Nt(this.Jo)&&this.Jo)if(this.Qo&&this.Qo.token){this.Ko=!0;try{var e=t.initConversations;if(e)return this.ea(e),void(this.Ko=!1);var i=t.loadExternalDependency;if(!i)return void this.ta(it);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.ta("Could not load conversations script",e):this.ea(t.initConversations),this.Ko=!1}))}catch(t){this.ta("Error initializing conversations",t),this.Ko=!1}}else ta.error("Conversations enabled but missing token in remote config.")}}ea(t){if(this.Qo)try{this._conversationsManager=t(this.Qo,this._instance),ta.info("Conversations loaded successfully")}catch(t){this.ta("Error completing conversations initialization",t)}else ta.error("Cannot complete initialization: remote config is null")}ta(t,e){ta.error(t,e),this._conversationsManager=null,this.Ko=!1}show(){this._conversationsManager?this._conversationsManager.show():ta.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Jo&&!Bt(this._conversationsManager)}isVisible(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,i,r){var s=this;return e((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,r):(ta.warn(ea),null)}))()}getMessages(t,i){var r=this;return e((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,i):(ta.warn(ea),null)}))()}markAsRead(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(ta.warn(ea),null)}))()}getTickets(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(ta.warn(ea),null)}))()}requestRestoreLink(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(ta.warn(ea),null)}))()}restoreFromToken(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(ta.warn(ea),null)}))()}restoreFromUrlToken(){var t=this;return e((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(ta.warn(ea),null)}))()}getCurrentTicketId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}ln(){var t;null==(t=this._conversationsManager)||t.setIdentity()}un(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},ca={logs:class{constructor(t){var e;this.ra=!1,this.ia=!1,this.Yt=Ni("[logs]"),this.na=[],this.sa=0,this.oa=0,this.aa=!1,this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.ra=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,i=null==(e=t.logs)?void 0:e.captureConsoleLogs;!Ht(i)&&i&&(this.ra=!0,this.loadIfEnabled())}reset(){this.na=[],this.Br&&(clearTimeout(this.Br),this.Br=void 0),this.sa=0,this.oa=0,this.aa=!1}loadIfEnabled(){if(this.ra&&!this.ia){var t=null==St?void 0:St.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(e=>{var i;e||null==(i=t.logs)||!i.initializeLogs?this.Yt.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.ia=!0)})):this.Yt.error(it)}else this.Yt.error("PostHog Extensions not found.")}}captureLog(t){var e,r,s,n,o,a;if(this._instance.is_capturing())if(t&&t.body){var l=null!==(e=null==(r=this._instance.config.logs)?void 0:r.flushIntervalMs)&&void 0!==e?e:3e3,u=null!==(s=null==(n=this._instance.config.logs)?void 0:n.maxLogsPerInterval)&&void 0!==s?s:1e3,h=Date.now();if(l>h-this.oa||(this.oa=h,this.sa=0,this.aa=!1),u>this.sa){this.sa++;var d=function(t,e){var r=t.level||"info",{text:s,number:n}=ii[r]||ri,o=String(Date.now())+"000000",a={};e.distinctId&&(a.posthogDistinctId=e.distinctId),e.sessionId&&(a.sessionId=e.sessionId),e.currentUrl&&(a["url.full"]=e.currentUrl),e.screenName&&(a["screen.name"]=e.screenName),e.appState&&(a["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(a.feature_flags=e.activeFeatureFlags);var l=i({},a,t.attributes||{}),u={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:n,severityText:s,body:{stringValue:t.body},attributes:ni(l)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),Nt(t.trace_flags)||(u.flags=t.trace_flags),u}(t,this.la());this.na.push({record:d}),(null!==(o=null==(a=this._instance.config.logs)?void 0:a.maxBufferSize)&&void 0!==o?o:100)>this.na.length?this.ua():this.flushLogs()}else this.aa||(this.Yt.warn("captureLog dropping logs: exceeded "+u+" logs per "+l+"ms"),this.aa=!0)}else this.Yt.warn("captureLog requires a body")}get logger(){return this.ha||(this.ha={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.ha}flushLogs(t){if(this.Br&&(clearTimeout(this.Br),this.Br=void 0),0!==this.na.length){var e=this.na;this.na=[];var r=this._instance.config.logs,s=i({"service.name":(null==r?void 0:r.serviceName)||"unknown_service"},(null==r?void 0:r.environment)&&{"deployment.environment":r.environment},(null==r?void 0:r.serviceVersion)&&{"service.version":r.serviceVersion},null==r?void 0:r.resourceAttributes),o=function(t,e,i,r){return{resourceLogs:[{resource:{attributes:ni(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}(e.map((t=>t.record)),s,n.LIB_NAME,n.LIB_VERSION),a=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Zi({method:"POST",url:a,data:o,compression:"best-available",batchKey:"logs",transport:t})}}ua(){var t,e;this.Br||(this.Br=setTimeout((()=>{this.Br=void 0,this.flushLogs()}),null!==(t=null==(e=this._instance.config.logs)?void 0:e.flushIntervalMs)&&void 0!==t?t:3e3))}la(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=i}if(null!=St&&null!=(t=St.location)&&t.href&&(e.currentUrl=St.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(e.activeFeatureFlags=r)}return e}}},pa=i({},ia,ra,sa,na,oa,aa,ua,la,ha,da,va,ca);An.__defaultExtensionClasses=i({},pa);var fa=Ni("[ExternalScriptsLoader]"),_a=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return fa.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=null==gt?void 0:gt.querySelectorAll("script");if(r)for(var s,n=function(){if(r[o].src===e){var t=r[o];return t.__posthog_loading_callback_fired?{v:i()}:(t.addEventListener("load",(e=>{t.__posthog_loading_callback_fired=!0,i(void 0,e)})),t.onerror=t=>i(t),{v:void 0})}},o=0;r.length>o;o++)if(s=n())return s.v;var a=()=>{if(!gt)return i("document not found");var r=gt.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=e,r.onload=t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)},r.onerror=t=>i(t),t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)gt.head.appendChild(r);else{var s,n=gt.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):gt.body.appendChild(r)}};null!=gt&>.body?a():null==gt||gt.addEventListener("DOMContentLoaded",a)};St.__PosthogExtensions__=St.__PosthogExtensions__||{},St.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r;if(t.config.__preview_external_dependency_versioned_paths)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var s="/static/"+e+".js?v="+t.version;if("toolbar"===e){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}r=t.requestRouter.endpointFor("assets",s)}_a(t,r,i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");_a(t,o,i)}},St.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);_a(t,r,i)};var ga,ma=(ga=wn[Rn]=new An,function(){function t(){t.done||(t.done=!0,Pn=!1,zi(wn,(function(t){t._dom_loaded()})))}null!=gt&>.addEventListener?"complete"===gt.readyState?t():Ji(gt,"DOMContentLoaded",t,{capture:!1}):pt&&Ui.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),ga);exports.Compression=ss,exports.DEFAULT_PRODUCT_TOUR_APPEARANCE={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},exports.DisplaySurveyType=Xr,exports.PostHog=An,exports.ProductTourEventName=Qr,exports.ProductTourEventProperties=Zr,exports.SurveyEventName=Jr,exports.SurveyEventProperties=Kr,exports.SurveyEventType=Gr,exports.SurveyPosition={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},exports.SurveyQuestionBranchingType={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},exports.SurveyQuestionType={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},exports.SurveySchedule={Once:"once",Recurring:"recurring",Always:"always"},exports.SurveyTabPosition={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},exports.SurveyType=Yr,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=ma,exports.posthog=ma,exports.severityLevels=["fatal","error","warning","log","info","debug"];
|
|
1
|
+
"use strict";function t(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(r,s)}function e(e){return function(){var i=this,r=arguments;return new Promise((function(s,n){var o=e.apply(i,r);function a(e){t(o,s,n,a,l,"next",e)}function l(e){t(o,s,n,a,l,"throw",e)}a(void 0)}))}}function i(){return i=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var i=arguments[e];for(var r in i)({}).hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t},i.apply(null,arguments)}function r(t,e){if(null==t)return{};var i={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==e.indexOf(r))continue;i[r]=t[r]}return i}Object.defineProperty(exports,"__esModule",{value:!0});var s="1.372.2",n={DEBUG:!1,LIB_VERSION:s,LIB_NAME:"web",JS_SDK_VERSION:s},o="$people_distinct_id",a="$device_id",l="__alias",u="__timers",h="$autocapture_disabled_server_side",d="$heatmaps_enabled_server_side",v="$exception_capture_enabled_server_side",c="$error_tracking_suppression_rules",p="$error_tracking_capture_extension_exceptions",f="$web_vitals_enabled_server_side",_="$dead_clicks_enabled_server_side",g="$product_tours_enabled_server_side",m="$web_vitals_allowed_metrics",b="$session_recording_remote_config",y="$replay_override_sampling",w="$replay_override_linked_flag",x="$replay_override_url_trigger",E="$replay_override_event_trigger",S="$sesid",T="$session_is_sampled",k="$enabled_feature_flags",R="$active_feature_flags",P="$early_access_features",O="$feature_flag_details",I="$feature_flag_payloads",C="$feature_flag_request_id",F="$override_feature_flags",A="$override_feature_flag_payloads",M="$stored_person_properties",D="$stored_group_properties",L="$surveys",U="$surveys_activated",N="ph_product_tours",j="$flag_call_reported",z="$flag_call_reported_session_id",B="$feature_flag_errors",H="$feature_flag_evaluated_at",q="$user_state",V="$client_session_props",W="$capture_rate_limit",G="$initial_campaign_params",Y="$initial_referrer_info",J="$initial_person_info",K="$epp",X="__POSTHOG_TOOLBAR__",Q="$posthog_cookieless",Z="$sdk_debug_extensions_init_method",tt="$sdk_debug_extensions_init_time_ms",et="$sdk_debug_recording_script_not_loaded",it="PostHog loadExternalDependency extension not found.",rt="on_reject",st="always",nt="anonymous",ot="identified",at="identified_only",lt="visibilitychange",ut="beforeunload",ht="$pageview",dt="$pageleave",vt="$identify",ct="$groupidentify",pt="undefined"!=typeof window?window:void 0,ft="undefined"!=typeof globalThis?globalThis:pt;"undefined"==typeof self&&(ft.self=ft),"undefined"==typeof File&&(ft.File=function(){});var _t=null==ft?void 0:ft.navigator,gt=null==ft?void 0:ft.document,mt=null==ft?void 0:ft.location,bt=null==ft?void 0:ft.fetch,yt=null!=ft&&ft.XMLHttpRequest&&"withCredentials"in new ft.XMLHttpRequest?ft.XMLHttpRequest:void 0,wt=null==ft?void 0:ft.AbortController,xt=null==ft?void 0:ft.CompressionStream,Et=null==_t?void 0:_t.userAgent,St=null!=pt?pt:{};function $t(){return $t=e((function*(t,i,r){void 0===i&&(i=!0);try{var s=new CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write((new TextEncoder).encode(t)).then((()=>n.close())).catch(function(){var t=e((function*(t){try{yield n.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),a=new Response(s.readable).blob(),[l]=yield Promise.all([a,o]);return l}catch(t){if(null!=r&&r.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}})),$t.apply(this,arguments)}var Tt=["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"],kt=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return Tt.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))},Rt=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function Pt(t,e){return-1!==t.indexOf(e)}var Ot=function(t){return t.trim()},It=function(t){return t.replace(/^\$/,"")},Ct=Object.prototype,Ft=Ct.hasOwnProperty,At=Ct.toString,Mt=Array.isArray||function(t){return"[object Array]"===At.call(t)},Dt=t=>"function"==typeof t,Lt=t=>t===Object(t)&&!Mt(t),Ut=t=>{if(Lt(t)){for(var e in t)if(Ft.call(t,e))return!1;return!0}return!1},Nt=t=>void 0===t,jt=t=>"[object String]"==At.call(t),zt=t=>jt(t)&&0===t.trim().length,Bt=t=>null===t,Ht=t=>Nt(t)||Bt(t),qt=t=>"[object Number]"==At.call(t)&&t==t,Vt=t=>qt(t)&&t>0,Wt=t=>"[object Boolean]"===At.call(t),Gt=t=>t instanceof FormData,Yt=t=>Pt(Rt,t);function Jt(t){return null===t||"object"!=typeof t}function Kt(t,e){return{}.toString.call(t)==="[object "+e+"]"}function Xt(t){return"undefined"!=typeof Event&&function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Event)}var Qt=[!0,"true",1,"1","yes"],Zt=t=>Pt(Qt,t),te=[!1,"false",0,"0","no"];function ee(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),qt(t)?t>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),ee(s||i,e,i,r))}class ie{constructor(t){this.$t={},this.zt=t.zt,this.Ut=ee(t.bucketSize,0,100,t.Yt),this.Wt=ee(t.refillRate,0,this.Ut,t.Yt),this.Gt=ee(t.refillInterval,0,864e5,t.Yt)}Xt(t,e){var i=Math.floor((e-t.lastAccess)/this.Gt);i>0&&(t.tokens=Math.min(t.tokens+i*this.Wt,this.Ut),t.lastAccess=t.lastAccess+i*this.Gt)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.$t[r];return s?this.Xt(s,i):this.$t[r]=s={tokens:this.Ut,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.zt)||e.call(this,t)),0===s.tokens)}stop(){this.$t={}}}var re,se,ne,oe="Mobile",ae="iOS",le="Android",ue="Tablet",he=le+" "+ue,de="iPad",ve="Apple",ce=ve+" Watch",pe="Safari",fe="BlackBerry",_e="Samsung",ge=_e+"Browser",me=_e+" Internet",be="Chrome",ye=be+" OS",we=be+" "+ae,xe="Internet Explorer",Ee=xe+" "+oe,Se="Opera",$e=Se+" Mini",Te="Edge",ke="Microsoft "+Te,Re="Firefox",Pe=Re+" "+ae,Oe="Nintendo",Ie="PlayStation",Ce="Xbox",Fe=le+" "+oe,Ae=oe+" "+pe,Me="Windows",De=Me+" Phone",Le="Nokia",Ue="Ouya",Ne="Generic",je=Ne+" "+oe.toLowerCase(),ze=Ne+" "+ue.toLowerCase(),Be="Konqueror",He="(\\d+(\\.\\d+)?)",qe=new RegExp("Version/"+He),Ve=new RegExp(Ce,"i"),We=new RegExp(Ie+" \\w+","i"),Ge=new RegExp(Oe+" \\w+","i"),Ye=new RegExp(fe+"|PlayBook|BB10","i"),Je={"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"},Ke=function(t,e){return e=e||"",Pt(t," OPR/")&&Pt(t,"Mini")?$e:Pt(t," OPR/")?Se:Ye.test(t)?fe:Pt(t,"IE"+oe)||Pt(t,"WPDesktop")?Ee:Pt(t,ge)?me:Pt(t,Te)||Pt(t,"Edg/")?ke:Pt(t,"FBIOS")?"Facebook "+oe:Pt(t,"UCWEB")||Pt(t,"UCBrowser")?"UC Browser":Pt(t,"CriOS")?we:Pt(t,"CrMo")||Pt(t,be)?be:Pt(t,le)&&Pt(t,pe)?Fe:Pt(t,"FxiOS")?Pe:Pt(t.toLowerCase(),Be.toLowerCase())?Be:((t,e)=>e&&Pt(e,ve)||function(t){return Pt(t,pe)&&!Pt(t,be)&&!Pt(t,le)}(t))(t,e)?Pt(t,oe)?Ae:pe:Pt(t,Re)?Re:Pt(t,"MSIE")||Pt(t,"Trident/")?xe:Pt(t,"Gecko")?Re:""},Xe={[Ee]:[new RegExp("rv:"+He)],[ke]:[new RegExp(Te+"?\\/"+He)],[be]:[new RegExp("("+be+"|CrMo)\\/"+He)],[we]:[new RegExp("CriOS\\/"+He)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+He)],[pe]:[qe],[Ae]:[qe],[Se]:[new RegExp("(Opera|OPR)\\/"+He)],[Re]:[new RegExp(Re+"\\/"+He)],[Pe]:[new RegExp("FxiOS\\/"+He)],[Be]:[new RegExp("Konqueror[:/]?"+He,"i")],[fe]:[new RegExp(fe+" "+He),qe],[Fe]:[new RegExp("android\\s"+He,"i")],[me]:[new RegExp(ge+"\\/"+He)],[xe]:[new RegExp("(rv:|MSIE )"+He)],Mozilla:[new RegExp("rv:"+He)]},Qe=function(t,e){var i=Ke(t,e),r=Xe[i];if(Nt(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},Ze=[[new RegExp(Ce+"; "+Ce+" (.*?)[);]","i"),t=>[Ce,t&&t[1]||""]],[new RegExp(Oe,"i"),[Oe,""]],[new RegExp(Ie,"i"),[Ie,""]],[Ye,[fe,""]],[new RegExp(Me,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[De,""];if(new RegExp(oe).test(e)&&!/IEMobile\b/.test(e))return[Me+" "+oe,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=Je[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[Me,r]}return[Me,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[ae,[t[3],t[4],t[5]||"0"].join(".")]:[ae,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=Nt(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+le+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+le+")","i"),t=>t&&t[2]?[le,[t[2],t[3],t[4]||"0"].join(".")]:[le,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ye,""]],[/Linux|debian/i,["Linux",""]]],ti=function(t){return Ge.test(t)?Oe:We.test(t)?Ie:Ve.test(t)?Ce:new RegExp(Ue,"i").test(t)?Ue:new RegExp("("+De+"|WPDesktop)","i").test(t)?De:/iPad/.test(t)?de:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ce:Ye.test(t)?fe:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Le,"i").test(t)?Le:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(oe).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?le:he:new RegExp("(pda|"+oe+")","i").test(t)?je:new RegExp(ue,"i").test(t)&&!new RegExp(ue+" pc","i").test(t)?ze:""},ei=t=>t instanceof Error,ii={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},ri=ii.info;function si(t){if(Wt(t))return{boolValue:t};if("number"==typeof t)return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if("string"==typeof t)return{stringValue:t};if(Mt(t))return{arrayValue:{values:t.map((t=>si(t)))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}function ni(t){var e=[];for(var i in t){var r=t[i];Bt(r)||Nt(r)||e.push({key:i,value:si(r)})}return e}function oi(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return ne&&i.length===se||(se=i.length,ne=i.reduce(((i,r)=>{re||(re={});var s=re[r];if(s)i[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,u=e[r];if(l&&u){i[l]=u,re[r]=[l,u];break}}return i}),{})),ne}}class ai{constructor(t,e,i){void 0===i&&(i=[]),this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e){void 0===e&&(e={});var i=e&&e.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(t){var i=this;return e((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&Mt(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null==(e=t.syntheticException)?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var r,s;return null!=t.cause&&(r=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(s=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),i({},t,{cause:r,stack:s})}applyChunkIds(t,e){return t.map((t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t)))}applyCoercers(t,e){for(var i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var i=this;return e((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,e){var r,s,n,o={type:t.type,value:t.value,mechanism:{type:null!==(r=e.type)&&void 0!==r?r:"generic",handled:null===(s=e.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,i({},e,{handled:!0}))),a}buildParsingContext(t){var e;return{chunkIdMap:oi(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,r){void 0===r&&(r=0);var s=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(t,e,r);return this.applyCoercers(i,s)}};return i({},e,{syntheticException:0==r?e.syntheticException:void 0,mechanism:t,apply:t=>s(t,r),next:t=>s(t,r+1)})}}var li="?";function ui(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?li:i,in_app:!0};return Nt(r)||(n.lineno=r),Nt(s)||(n.colno=s),n}var hi=(t,e)=>{var i=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return i||r?[-1!==t.indexOf("@")?t.split("@")[0]:li,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},di=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,vi=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ci=/\((\S*)(?::(\d+))(?::(\d+))\)/,pi=(t,e)=>{var i=di.exec(t);if(i){var[,r,s,n]=i;return ui(e,r,li,+s,+n)}var o=vi.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=ci.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=hi(o[1]||li,o[2]);return ui(e,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},fi=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,_i=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,gi=(t,e)=>{var i=fi.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=_i.exec(i[3]);r&&(i[1]=i[1]||"eval",i[3]=r[1],i[4]=r[2],i[5]="")}var s=i[3],n=i[1]||li;return[n,s]=hi(n,s),ui(e,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},mi=/\(error: (.*)\)/;class bi{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=jt(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:i?t.stack:void 0,cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var e=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?e+": "+t.message:e}isDOMException(t){return Kt(t,"DOMException")}isDOMError(t){return Kt(t,"DOMError")}}class yi{match(t){return(t=>t instanceof Error)(t)}coerce(t,e){return{type:this.getType(t),value:this.getMessage(t,e),stack:this.getStack(t),cause:t.cause?e.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,e){var i=t.message;return String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(t){return t.stacktrace||t.stack||void 0}}class wi{constructor(){}match(t){return Kt(t,"ErrorEvent")&&null!=t.error}coerce(t,e){var i;return e.apply(t.error)||{type:"ErrorEvent",value:t.message,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}var xi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Ei{match(t){return"string"==typeof t}coerce(t,e){var i,[r,s]=this.getInfos(t);return{type:null!=r?r:"Error",value:null!=s?s:t,stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(t){var e="Error",i=t,r=t.match(xi);return r&&(e=r[1],i=r[2]),[e,i]}}var Si=["fatal","error","warning","log","info","debug"];function $i(t,e){void 0===e&&(e=40);var i=Object.keys(t);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(e>=s.length)return r===i.length?s:s.length>e?s.slice(0,e)+"...":s}return""}class Ti{match(t){return"object"==typeof t&&null!==t}coerce(t,e){var i,r=this.getErrorPropertyFromObject(t);return r?e.apply(r):{type:this.getType(t),value:this.getValue(t),stack:null==(i=e.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return Xt(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var e="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(e+=" with message: '"+t.message+"'"),e}if("message"in t&&"string"==typeof t.message)return t.message;var i=this.getObjectClassName(t);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+$i(t)}isSeverityLevel(t){return jt(t)&&!zt(t)&&Si.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(ei(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class ki{match(t){return Xt(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+$i(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class Ri{match(t){return Jt(t)}coerce(t,e){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class Pi{match(t){return Kt(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!Xt(t))return!1;try{var e=t.detail;return null!=e&&"object"==typeof e&&"reason"in e}catch(t){return!1}}coerce(t,e){var i,r=this.getUnhandledRejectionReason(t);return Jt(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}:e.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var Oi="$message",Ii="$timestamp",Ci=new Set([Oi,Ii]),Fi={enabled:!0,max_bytes:32768};function Ai(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:Fi.enabled,max_bytes:Di(t.max_bytes,Fi.max_bytes)}:i({},Fi)}class Mi{constructor(t){this.Jt=[],this.Kt=0,this.Lt=Ai(t)}setConfig(t){this.Lt=Ai(t),this.Qt()}add(t){var e=function(t){var e=function(t){var e=new WeakSet;try{return JSON.stringify(t,((t,i)=>{if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Date)return i.toISOString();if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){if(e.has(i))return"[Circular]";e.add(i)}return i}}))}catch(t){return}}(t);if(e)try{var i=JSON.parse(e);if(!Lt(i))return;var r=i,s=r[Oi],n=r[Ii];if(!jt(s)||0===s.trim().length)return;if(!jt(n)&&!qt(n))return;return{step:r,json:e}}catch(t){return}}(t);if(e){var i=function(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var e=encodeURIComponent(t),i=0,r=0;e.length>r;r++)"%"===e[r]?(i+=1,r+=2):i+=1;return i}(e.json);i>this.Lt.max_bytes||(this.Jt.push({step:e.step,bytes:i}),this.Kt+=i,this.Qt())}}getAttachable(){return this.Jt.map((t=>t.step))}clear(){this.Jt=[],this.Kt=0}size(){return this.Jt.length}Qt(){for(;this.Kt>this.Lt.max_bytes&&this.Jt.length>0;){var t=this.Jt.shift();t&&(this.Kt-=t.bytes)}}}function Di(t,e){if(!qt(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var Li=function(t,e){var{debugEnabled:i}=void 0===e?{}:e,r={C(e){if(pt&&(n.DEBUG||St.POSTHOG_DEBUG||i)&&!Nt(pt.console)&&pt.console){for(var r=("__rrweb_original__"in pt.console[e]?pt.console[e].__rrweb_original__:pt.console[e]),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,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.C("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.C("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.C("error",...e)},critical(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];console.error(t,...i)},uninitializedWarning(t){r.error("You must initialize PostHog before calling "+t)},createLogger:(e,i)=>Li(t+" "+e,i)};return r},Ui=Li("[PostHog.js]"),Ni=Ui.createLogger;function ji(t,e){Mt(t)&&t.forEach(e)}function zi(t,e){if(!Ht(t))if(Mt(t))t.forEach(e);else if(Gt(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)Ft.call(t,i)&&e(t[i],i)}var Bi=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];for(var s of i)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function Hi(t){for(var e=Object.keys(t),i=e.length,r=new Array(i);i--;)r[i]=[e[i],t[e[i]]];return r}var qi=function(t){try{return t()}catch(t){return}},Vi=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,i)}catch(t){Ui.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Ui.critical(t)}}},Wi=function(t){var e={};return zi(t,(function(t,i){(jt(t)&&t.length>0||qt(t))&&(e[i]=t)})),e};var Gi=["herokuapp.com","vercel.app","netlify.app"];function Yi(t){var e=null==t?void 0:t.hostname;if(!jt(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of Gi)if(i===r)return!1;return!0}function Ji(t,e,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==t||t.addEventListener(e,i,{capture:s,passive:n})}function Ki(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 qt(t)&&isFinite(t)&&Math.floor(t)===t});class Xi{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,e,i,r){if(!Number.isInteger(t)||!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||0>t||0>e||0>i||0>r||t>0xffffffffffff||e>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|e>>>8,s[7]=e,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new Xi(s)}toString(){for(var t="",e=0;this.bytes.length>e;e++)t=t+(this.bytes[e]>>>4).toString(16)+(15&this.bytes[e]).toString(16),3!==e&&5!==e&&7!==e&&9!==e||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new Xi(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var e=0;16>e;e++){var i=this.bytes[e]-t.bytes[e];if(0!==i)return Math.sign(i)}return 0}}class Qi{constructor(){this.I=0,this.S=0,this.k=new er}generate(){var t=this.generateOrAbort();if(Nt(t)){this.I=0;var e=this.generateOrAbort();if(Nt(e))throw new Error("Could not generate UUID after timestamp reset");return e}return t}generateOrAbort(){var t=Date.now();if(t>this.I)this.I=t,this.A();else{if(this.I>=t+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return Xi.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 Zi,tr=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};pt&&!Nt(pt.crypto)&&crypto.getRandomValues&&(tr=t=>crypto.getRandomValues(t));class er{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(tr(this.T),this.N=0),this.T[this.N++]}}var ir=()=>rr().toString(),rr=()=>(Zi||(Zi=new Qi)).generate(),sr="",nr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var or={R:()=>!!gt,B(t){Ui.error("cookieStore error: "+t)},O(t){if(gt){try{for(var e=t+"=",i=gt.cookie.split(";").filter((t=>t.length)),r=0;i.length>r;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(e))return decodeURIComponent(s.substring(e.length,s.length))}}catch(t){}return null}},Z(t){var e;try{e=JSON.parse(or.O(t))||{}}catch(t){}return e},M(t,e,i,r,s){if(gt)try{var n="",o="",a=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=gt),sr)return sr;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),r=Math.min(i.length,8),s="dmn_chk_"+ir();!sr&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";e.cookie=o+";max-age=3",e.cookie.includes(s)&&(e.cookie=o+";max-age=0",sr=n)}return sr}(t);if(!i){var r=(t=>{var e=t.match(nr);return e?e[0]:""})(t);r!==i&&Ui.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(gt.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}s&&(o="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&Ui.warn("cookieStore warning: large cookie, len="+u.length),gt.cookie=u,u}catch(t){return}},F(t,e){if(null!=gt&>.cookie)try{or.M(t,"",-1,e)}catch(t){return}}},ar=null,lr={R(){if(!Bt(ar))return ar;var t=!0;if(Nt(pt))t=!1;else try{var e="__mplssupport__";lr.M(e,"xyz"),'"xyz"'!==lr.O(e)&&(t=!1),lr.F(e)}catch(e){t=!1}return t||Ui.error("localStorage unsupported; falling back to cookie store"),ar=t,t},B(t){Ui.error("localStorage error: "+t)},O(t){try{return null==pt?void 0:pt.localStorage.getItem(t)}catch(t){lr.B(t)}return null},Z(t){try{return JSON.parse(lr.O(t))||{}}catch(t){}return null},M(t,e){try{null==pt||pt.localStorage.setItem(t,JSON.stringify(e))}catch(t){lr.B(t)}},F(t){try{null==pt||pt.localStorage.removeItem(t)}catch(t){lr.B(t)}}},ur=[a,"distinct_id",S,T,K,J,q],hr={},dr={R:()=>!0,B(t){Ui.error("memoryStorage error: "+t)},O:t=>hr[t]||null,Z:t=>hr[t]||null,M(t,e){hr[t]=e},F(t){delete hr[t]}},vr=null,cr={R(){if(!Bt(vr))return vr;if(vr=!0,Nt(pt))vr=!1;else try{var t="__support__";cr.M(t,"xyz"),'"xyz"'!==cr.O(t)&&(vr=!1),cr.F(t)}catch(t){vr=!1}return vr},B(t){Ui.error("sessionStorage error: ",t)},O(t){try{return null==pt?void 0:pt.sessionStorage.getItem(t)}catch(t){cr.B(t)}return null},Z(t){try{return JSON.parse(cr.O(t))||null}catch(t){}return null},M(t,e){try{null==pt||pt.sessionStorage.setItem(t,JSON.stringify(e))}catch(t){cr.B(t)}},F(t){try{null==pt||pt.sessionStorage.removeItem(t)}catch(t){cr.B(t)}}};class pr{constructor(t){this._instance=t}get Lt(){return this._instance.config}get consent(){return this.tr()?0:this.rr}isOptedOut(){return this.Lt.cookieless_mode===st||this.isRejected()||-1===this.consent&&this.Lt.cookieless_mode===rt}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Lt.opt_out_capturing_by_default}optInOut(t){this.ir.M(this.nr,t?1:0,this.Lt.cookie_expiration,this.Lt.cross_subdomain_cookie,this.Lt.secure_cookie)}reset(){this.ir.F(this.nr,this.Lt.cross_subdomain_cookie)}get nr(){var{token:t,opt_out_capturing_cookie_prefix:e,consent_persistence_name:i}=this._instance.config;return i||(e?e+t:"__ph_opt_in_out_"+t)}get rr(){var t=this.ir.O(this.nr);return Zt(t)?1:Pt(te,t)?0:-1}get ir(){var t=this.Lt.opt_out_capturing_persistence_type,e="localStorage"===t?lr:or;if(!this.sr||this.sr!==e){this.sr=e;var i="localStorage"===t?or:lr;i.O(this.nr)&&(this.sr.O(this.nr)||this.optInOut(Zt(i.O(this.nr))),i.F(this.nr,this.Lt.cross_subdomain_cookie))}return this.sr}tr(){return!!this.Lt.respect_dnt&&[null==_t?void 0:_t.doNotTrack,null==_t?void 0:_t.msDoNotTrack,St.doNotTrack].some((t=>Zt(t)))}}var fr=Ni("[Dead Clicks]"),_r=()=>!0,gr=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(_)),r=t.instance.config.capture_dead_clicks;return Wt(r)?r:!!Lt(r)||i};class mr{get lazyLoadedDeadClicksAutocapture(){return this.ar}constructor(t,e,i){this.instance=t,this.isEnabled=e,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(t){"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[_]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.lr((()=>{this.ur()})):this.stop()}lr(t){var e,i;null!=(e=St.__PosthogExtensions__)&&e.initDeadClicksAutocapture&&t(),null==(i=St.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?fr.error("failed to load script",e):t()}))}ur(){var t;if(gt){if(!this.ar&&null!=(t=St.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=Lt(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};e.__onCapture=this.onCapture,this.ar=St.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.ar.start(gt),fr.info("starting...")}}else fr.error("`document` not found. Cannot start.")}stop(){this.ar&&(this.ar.stop(),this.ar=void 0,fr.info("stopping..."))}}var br=Ni("[SegmentIntegration]");var yr="posthog-js";function wr(t,e){var{organization:r,projectId:s,prefix:n,severityAllowList:o=["error"],sendExceptionsToPostHog:a=!0}=void 0===e?{}:e;return e=>{var l,u,h,d,v;if("*"!==o&&!o.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var c=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=c,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p,f=(null==(l=e.exception)?void 0:l.values)||[],_=f.map((t=>i({},t,{stacktrace:t.stacktrace?i({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>i({},t,{platform:"web:javascript"})))}):void 0}))),g={$exception_message:(null==(u=f[0])?void 0:u.value)||e.message,$exception_type:null==(h=f[0])?void 0:h.type,$exception_level:e.level,$exception_list:_,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(d=f[0])?void 0:d.value)||e.message,$sentry_exception_type:null==(v=f[0])?void 0:v.type,$sentry_tags:e.tags};return r&&s&&(g.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+e.event_id),a&&(null==(p=t.exceptions)||p.sendExceptionEvent(g)),e}}class xr{constructor(t,e,i,r,s,n){this.name=yr,this.setupOnce=function(o){o(wr(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Er{constructor(t){this.hr=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(Ui.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.cr=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.dr()}dr(){var t;this.vr=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.hr)}destroy(){var t;null==(t=this.vr)||t.call(this),this.vr=void 0}doPageView(t,e){var i,r=this.pr(t,e);return this.cr={pathname:null!==(i=null==pt?void 0:pt.location.pathname)&&void 0!==i?i:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var e;return this.pr(t,null==(e=this.cr)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.cr)?void 0:t.pageViewId}}pr(t,e){var i=this.cr;if(!i)return{$pageview_id:e};var r={$pageview_id:e,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:u,maxContentY:h}=s;if(!(Nt(n)||Nt(o)||Nt(a)||Nt(l)||Nt(u)||Nt(h))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var d=n>1?ee(o/n,0,1,Ui):1,v=n>1?ee(a/n,0,1,Ui):1,c=l>1?ee(u/l,0,1,Ui):1,p=l>1?ee(h/l,0,1,Ui):1;r=Bi(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:p})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var Sr={[o]:{exposure:"hidden"},[l]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[u]:{exposure:"hidden"},[h]:{exposure:"event"},[d]:{exposure:"hidden"},[v]:{exposure:"event"},[c]:{exposure:"hidden"},[p]:{exposure:"event"},[f]:{exposure:"event"},[_]:{exposure:"event"},[g]:{exposure:"hidden"},[m]:{exposure:"event"},[b]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[S]:{exposure:"hidden"},[T]:{exposure:"event"},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},[k]:{exposure:"derived",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!Lt(t))return{};for(var e={},i=Object.keys(t),r=0;i.length>r;r++)e["$feature/"+i[r]]=t[i[r]];return e}},[R]:{exposure:"event"},[P]:{exposure:"hidden"},[O]:{exposure:"hidden"},[I]:{exposure:"event"},[C]:{exposure:"event"},[F]:{exposure:"event"},[A]:{exposure:"hidden"},[M]:{exposure:"hidden"},[D]:{exposure:"hidden"},[L]:{exposure:"hidden"},[U]:{exposure:"event"},[N]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[j]:{exposure:"hidden"},[z]:{exposure:"hidden"},[B]:{exposure:"hidden"},[H]:{exposure:"hidden"},[q]:{exposure:"hidden"},[V]:{exposure:"hidden"},[W]:{exposure:"hidden"},[G]:{exposure:"hidden"},[Y]:{exposure:"hidden"},[J]:{exposure:"hidden"},[K]:{exposure:"hidden"},[y]:{exposure:"event"},[w]:{exposure:"event"},[x]:{exposure:"event"},[E]:{exposure:"event"},[Z]:{exposure:"event"},[tt]:{exposure:"event"},[et]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},$r=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Tr=t=>{var e=null==gt?void 0:gt.createElement("a");return Nt(e)?null:(e.href=t,e)},kr=function(t,e){for(var i,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!Mt(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){Ui.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Rr=function(t,e,i){if(!t||!e||!e.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),u=[],h=0;l.length>h;h++){var d=l[h].split("=");Mt(d)&&(e.includes(d[0])?u.push(d[0]+"="+i):u.push(l[h]))}var v=a;return null!=o&&(v+="?"+u.join("&")),null!=s&&(v+="#"+s),v},Pr=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},Or="https?://(.*)",Ir=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Cr=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ir],Fr="<masked>",Ar=["li_fat_id"];function Mr(t,e,i){if(!gt)return{};var r,s=e?[...Ir,...i||[]]:[],n=Dr(Rr(gt.URL,s,Fr),t),o=(r={},zi(Ar,(function(t){var e=or.O(t);r[t]=e||null})),r);return Bi(o,n)}function Dr(t,e){var i=Cr.concat(e||[]),r={};return zi(i,(function(e){var i=kr(t,e);r[e]=i||null})),r}function Lr(t){var e=function(t){return t?0===t.search(Or+"google.([^/?]*)")?"google":0===t.search(Or+"bing.com")?"bing":0===t.search(Or+"yahoo.com")?"yahoo":0===t.search(Or+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",r={};if(!Bt(e)){r.$search_engine=e;var s=gt?kr(gt.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function Ur(){return navigator.language||navigator.userLanguage}var Nr="$direct";function jr(){return(null==gt?void 0:gt.referrer)||Nr}function zr(t,e){var i=t?[...Ir,...e||[]]:[],r=null==mt?void 0:mt.href.substring(0,1e3);return{r:jr().substring(0,1e3),u:r?Rr(r,i,Fr):void 0}}function Br(t){var e,{r:i,u:r}=t,s={$referrer:i,$referring_domain:null==i?void 0:i==Nr?Nr:null==(e=Tr(i))?void 0:e.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=Dr(r);Bi(s,o)}if(i){var a=Lr(i);Bi(s,a)}return s}function Hr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function qr(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var Vr=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Wr{constructor(t,e){this.Lt=t,this.props={},this.gr=!1,this.mr=(t=>{var e="";return t.token&&(e=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+e+"_posthog"})(t),this.ir=this.yr(t),this.load(),t.debug&&Ui.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save()}isDisabled(){return!!this.br}yr(t){-1===Vr.indexOf(t.persistence.toLowerCase())&&(Ui.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var e=function(t){void 0===t&&(t=[]);var e=[...ur,...t];return i({},lr,{Z(t){try{var e={};try{e=or.Z(t)||{}}catch(t){}var i=Bi(e,JSON.parse(lr.O(t)||"{}"));return lr.M(t,i),i}catch(t){}return null},M(t,i,r,s,n,o){try{lr.M(t,i,void 0,void 0,o);var a={};e.forEach((t=>{i[t]&&(a[t]=i[t])})),Object.keys(a).length&&or.M(t,a,r,s,n,o)}catch(t){lr.B(t)}},F(t,e){try{null==pt||pt.localStorage.removeItem(t),or.F(t,e)}catch(t){lr.B(t)}}})}(t.cookie_persisted_properties||[]),r=t.persistence.toLowerCase();return"localstorage"===r&&lr.R()?lr:"localstorage+cookie"===r&&e.R()?e:"sessionstorage"===r&&cr.R()?cr:"memory"===r?dr:"cookie"===r?or:e.R()?e:or}_r(t){var e=null!=t?t:this.Lt.feature_flag_cache_ttl_ms;if(!e||0>=e)return!1;var i=this.props[H];return!i||"number"!=typeof i||Date.now()-i>e}properties(){var t={};return zi(this.props,((e,i)=>{var r=(t=>{var e=Sr[t];if(e)return e;for(var[i,r]of $r)if(0===t.indexOf(i))return r})(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,i===k?()=>this._r():()=>!1))return;r.transformToEventProperties&&Bi(t,r.transformToEventProperties(e))}else r&&"event"!==r.exposure||(t[i]=e)})),t}load(){if(!this.br){var t=this.ir.Z(this.mr);t&&(this.props=Bi({},t))}}save(){this.br||this.ir.M(this.mr,this.props,this.wr,this.Ir,this.Cr,this.Lt.debug)}remove(){this.ir.F(this.mr,!1),this.ir.F(this.mr,!0)}clear(){this.remove(),this.props={}}register_once(t,e,i){if(Lt(t)){Nt(e)&&(e="None"),this.wr=Nt(i)?this.Sr:i;var r=!1;if(zi(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.kr(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(Lt(t)){this.wr=Nt(e)?this.Sr:e;var i=!1;if(zi(t,((e,r)=>{t.hasOwnProperty(r)&&this.props[r]!==e&&(this.kr(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.Tr(t),this.save())}update_campaign_params(){if(!this.gr){var t=Mr(this.Lt.custom_campaign_params,this.Lt.mask_personal_data_properties,this.Lt.custom_personal_data_properties);Ut(Wi(t))||this.register(t),this.gr=!0}}update_search_keyword(){var t;this.register((t=null==gt?void 0:gt.referrer)?Lr(t):{})}update_referrer_info(){var t;this.register_once({$referrer:jr(),$referring_domain:null!=gt&>.referrer&&(null==(t=Tr(gt.referrer))?void 0:t.host)||Nr},void 0)}set_initial_person_info(){this.props[G]||this.props[Y]||this.register_once({[J]:zr(this.Lt.mask_personal_data_properties,this.Lt.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};zi([Y,G],(e=>{var i=this.props[e];i&&zi(i,(function(e,i){t["$initial_"+It(i)]=e}))}));var e,i,r=this.props[J];if(r){var s=(e=Br(r),i={},zi(e,(function(t,e){i["$initial_"+It(e)]=t})),i);Bi(t,s)}return t}safe_merge(t){return zi(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){if(this.Sr=this.wr=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==e.persistence||!((t,e)=>{if(t.length!==e.length)return!1;var i=[...t].sort(),r=[...e].sort();return i.every(((t,e)=>t===r[e]))})(t.cookie_persisted_properties||[],e.cookie_persisted_properties||[])){var r=this.yr(t),s=this.props;this.clear(),this.ir=r,this.props=s,this.save()}}set_disabled(t){this.br=t,this.br?this.remove():this.save()}set_cross_subdomain(t){t!==this.Ir&&(this.Ir=t,this.remove(),this.save())}set_secure(t){t!==this.Cr&&(this.Cr=t,this.remove(),this.save())}set_event_timer(t,e){var i=this.props[u]||{};i[t]=e,this.kr(u,i),this.save()}remove_event_timer(t){var e=this.props[u]||{},i=e[t];return Nt(i)||(delete e[t],this.kr(u,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.kr(t,e),this.save()}kr(t,e){this.props[t]=e}Tr(t){delete this.props[t]}}var Gr={Activation:"events",Cancellation:"cancelEvents"},Yr={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},Jr={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Kr={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Xr={Popover:"popover",Inline:"inline"},Qr={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Zr={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},ts=Ni("[RateLimiter]");class es{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var e=t.text;if(e&&e.length)try{(JSON.parse(e).quota_limited||[]).forEach((t=>{ts.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void ts.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:e})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var e,i,r;void 0===t&&(t=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:n}=this,o=(new Date).getTime(),a=null!==(e=null==(i=this.instance.persistence)?void 0:i.get_property(W))&&void 0!==e?e:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;return l||t||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||t||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(W,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var is=Ni("[RemoteConfig]");class rs{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=St._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}Ar(t){var e,i;null!=(e=St.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=St.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}Er(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(e){t(e.json)}})}load(){try{if(this.remoteConfig)return is.info("Using preloaded remote config",this.remoteConfig),this.Rr(this.remoteConfig),void this.Nr();if(this._instance.Mr())return void is.warn("Remote config is disabled. Falling back to local config.");this.Ar((t=>{if(!t)return is.info("No config found after loading remote JS config. Falling back to JSON."),void this.Er((t=>{this.Rr(t),this.Nr()}));this.Rr(t),this.Nr()}))}catch(t){is.error("Error loading remote config",t)}}stop(){this.Fr&&(clearInterval(this.Fr),this.Fr=void 0)}refresh(){this._instance.Mr()||"hidden"===(null==gt?void 0:gt.visibilityState)||this._instance.reloadFeatureFlags()}Nr(){var t;if(!this.Fr){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.Fr=setInterval((()=>{this.refresh()}),e))}}Rr(t){var e;t||is.error("Failed to fetch remote config from PostHog."),this._instance.Rr(null!=t?t:{}),!1!==(null==t?void 0:t.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded())}}var ss={GZipJS:"gzip-js",Base64:"base64"},ns=Uint8Array,os=Uint16Array,as=Uint32Array,ls=new ns([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]),us=new ns([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]),hs=new ns([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ds=function(t,e){for(var i=new os(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new as(i[30]);for(r=1;30>r;++r)for(var n=i[r];i[r+1]>n;++n)s[n]=n-i[r]<<5|r;return[i,s]},vs=ds(ls,2),cs=vs[1];vs[0][28]=258,cs[258]=28;for(var ps=ds(us,0)[1],fs=new os(32768),_s=0;32768>_s;++_s){var gs=(43690&_s)>>>1|(21845&_s)<<1;fs[_s]=((65280&(gs=(61680&(gs=(52428&gs)>>>2|(13107&gs)<<2))>>>4|(3855&gs)<<4))>>>8|(255&gs)<<8)>>>1}var ms=function(t,e,i){for(var r=t.length,s=0,n=new os(e);r>s;++s)++n[t[s]-1];var o,a=new os(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new os(1<<e);var l=15-e;for(s=0;r>s;++s)if(t[s])for(var u=s<<4|t[s],h=e-t[s],d=a[t[s]-1]++<<h,v=d|(1<<h)-1;v>=d;++d)o[fs[d]>>>l]=u}else for(o=new os(r),s=0;r>s;++s)o[s]=fs[a[t[s]-1]++]>>>15-t[s];return o},bs=new ns(288);for(_s=0;144>_s;++_s)bs[_s]=8;for(_s=144;256>_s;++_s)bs[_s]=9;for(_s=256;280>_s;++_s)bs[_s]=7;for(_s=280;288>_s;++_s)bs[_s]=8;var ys=new ns(32);for(_s=0;32>_s;++_s)ys[_s]=5;var ws=ms(bs,9,0),xs=ms(ys,5,0),Es=function(t){return(t/8>>0)+(7&t&&1)},Ss=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof os?os:t instanceof as?as:ns)(i-e);return r.set(t.subarray(e,i)),r},$s=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},Ts=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},ks=function(t,e){for(var i=[],r=0;t.length>r;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new ns(0),0];if(1==s){var o=new ns(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort((function(t,e){return t.f-e.f})),i.push({s:-1,f:25001});var a=i[0],l=i[1],u=0,h=1,d=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};h!=s-1;)a=i[i[d].f>i[u].f?u++:d++],l=i[u!=h&&i[d].f>i[u].f?u++:d++],i[h++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new os(v+1),p=Rs(i[h-1],c,0);if(p>e){r=0;var f=0,_=p-e,g=1<<_;for(n.sort((function(t,e){return c[e.s]-c[t.s]||t.f-e.f}));s>r;++r){var m=n[r].s;if(e>=c[m])break;f+=g-(1<<p-c[m]),c[m]=e}for(f>>>=_;f>0;){var b=n[r].s;e>c[b]?f-=1<<e-c[b]++-1:++r}for(;r>=0&&f;--r){var y=n[r].s;c[y]==e&&(--c[y],++f)}p=e}return[new ns(c),p]},Rs=function(t,e,i){return-1==t.s?Math.max(Rs(t.l,e,i+1),Rs(t.r,e,i+1)):e[t.s]=i},Ps=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new os(++e),r=0,s=t[0],n=1,o=function(t){i[r++]=t},a=1;e>=a;++a)if(t[a]==s&&a!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[i.subarray(0,r),e]},Os=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},Is=function(t,e,i){var r=i.length,s=Es(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=i[n];return 8*(s+4+r)},Cs=function(t,e,i,r,s,n,o,a,l,u,h){$s(e,h++,i),++s[256];for(var d=ks(s,15),v=d[0],c=d[1],p=ks(n,15),f=p[0],_=p[1],g=Ps(v),m=g[0],b=g[1],y=Ps(f),w=y[0],x=y[1],E=new os(19),S=0;m.length>S;++S)E[31&m[S]]++;for(S=0;w.length>S;++S)E[31&w[S]]++;for(var T=ks(E,7),k=T[0],R=T[1],P=19;P>4&&!k[hs[P-1]];--P);var O,I,C,F,A=u+5<<3,M=Os(s,bs)+Os(n,ys)+o,D=Os(s,v)+Os(n,f)+o+14+3*P+Os(E,k)+(2*E[16]+3*E[17]+7*E[18]);if(M>=A&&D>=A)return Is(e,h,t.subarray(l,l+u));if($s(e,h,1+(M>D)),h+=2,M>D){O=ms(v,c,0),I=v,C=ms(f,_,0),F=f;var L=ms(k,R,0);for($s(e,h,b-257),$s(e,h+5,x-1),$s(e,h+10,P-4),h+=14,S=0;P>S;++S)$s(e,h+3*S,k[hs[S]]);h+=3*P;for(var U=[m,w],N=0;2>N;++N){var j=U[N];for(S=0;j.length>S;++S)$s(e,h,L[z=31&j[S]]),h+=k[z],z>15&&($s(e,h,j[S]>>>5&127),h+=j[S]>>>12)}}else O=ws,I=bs,C=xs,F=ys;for(S=0;a>S;++S)if(r[S]>255){var z;Ts(e,h,O[257+(z=r[S]>>>18&31)]),h+=I[z+257],z>7&&($s(e,h,r[S]>>>23&31),h+=ls[z]);var B=31&r[S];Ts(e,h,C[B]),h+=F[B],B>3&&(Ts(e,h,r[S]>>>5&8191),h+=us[B])}else Ts(e,h,O[r[S]]),h+=I[r[S]];return Ts(e,h,O[256]),h+I[256]},Fs=new as([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),As=function(){for(var t=new as(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),Ms=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function Ds(t,e){void 0===e&&(e={});var i=function(){var t=4294967295;return{p(e){for(var i=t,r=0;e.length>r;++r)i=As[255&i^e[r]]^i>>>8;t=i},d(){return 4294967295^t}}}(),r=t.length;i.p(t);var s,n,o,a,l,u=(a=10+((s=e).filename&&s.filename.length+1||0),l=8,function(t,e,i,r,s,n){var o=t.length,a=new ns(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),u=0;if(!e||8>o)for(var h=0;o>=h;h+=65535){var d=h+65535;o>d?u=Is(l,u,t.subarray(h,d)):(l[h]=!0,u=Is(l,u,t.subarray(h,o)))}else{for(var v=Fs[e-1],c=v>>>13,p=8191&v,f=(1<<i)-1,_=new os(32768),g=new os(f+1),m=Math.ceil(i/3),b=2*m,y=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<b)&f},w=new as(25e3),x=new os(288),E=new os(32),S=0,T=0,k=(h=0,0),R=0,P=0;o>h;++h){var O=y(h),I=32767&h,C=g[O];if(_[I]=C,g[O]=I,h>=R){var F=o-h;if((S>7e3||k>24576)&&F>423){u=Cs(t,l,0,w,x,E,T,k,P,h-P,u),k=S=T=0,P=h;for(var A=0;286>A;++A)x[A]=0;for(A=0;30>A;++A)E[A]=0}var M=2,D=0,L=p,U=I-C&32767;if(F>2&&O==y(h-U))for(var N=Math.min(c,F)-1,j=Math.min(32767,h),z=Math.min(258,F);j>=U&&--L&&I!=C;){if(t[h+M]==t[h+M-U]){for(var B=0;z>B&&t[h+B]==t[h+B-U];++B);if(B>M){if(M=B,D=U,B>N)break;var H=Math.min(U,B-2),q=0;for(A=0;H>A;++A){var V=h-U+A+32768&32767,W=V-_[V]+32768&32767;W>q&&(q=W,C=V)}}}U+=(I=C)-(C=_[I])+32768&32767}if(D){w[k++]=268435456|cs[M]<<18|ps[D];var G=31&cs[M],Y=31&ps[D];T+=ls[G]+us[Y],++x[257+G],++E[Y],R=h+M,++S}else w[k++]=t[h],++x[t[h]]}}u=Cs(t,l,!0,w,x,E,T,k,P,h-P,u)}return Ss(a,0,r+Es(u)+s)}(n=t,null==(o=e).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),h=u.length;return function(t,e){var i=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>e.level?4:9==e.level?2:0,t[9]=3,0!=e.mtime&&Ms(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;i.length>=r;++r)t[r+10]=i.charCodeAt(r)}}(u,e),Ms(u,h-8,i.d()),Ms(u,h-4,r),u}var Ls=!!yt||!!bt,Us="text/plain",Ns=!1,js=function(t,e,r){var s;void 0===r&&(r=!0);var[n,o]=t.split("?"),a=i({},e),l=null!==(s=null==o?void 0:o.split("&").map((t=>{var e,[i,s]=t.split("="),n=r&&null!==(e=a[i])&&void 0!==e?e:s;return delete a[i],i+"="+n})))&&void 0!==s?s:[],u=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return zi(t,(function(t,e){Nt(t)||Nt(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(a);return u&&l.push(u),n+"?"+l.join("&")},zs=(t,e)=>JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e),Bs=t=>{if(t.er)return t.er;var{data:e,compression:i}=t;if(e){if(i===ss.GZipJS){var r=Ds(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new ns(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;i>o;++o){if(s+5>r.length){var a=new ns(s+8+(i-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Ss(r,0,s)}(zs(e)),{mtime:0});return{contentType:Us,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===ss.Base64){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(zs(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:zs(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=zs(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},Hs=function(){var t=e((function*(t){var e=zs(t.data),r=yield function(t,e,i){return $t.apply(this,arguments)}(e,n.DEBUG,{rethrow:!0});if(!r)return t;var s=yield r.arrayBuffer();return i({},t,{er:{contentType:Us,body:s,estimatedSize:s.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),qs=(t,e)=>js(t,{_:(new Date).getTime().toString(),ver:n.JS_SDK_VERSION,compression:e}),Vs=[];bt&&Vs.push({transport:"fetch",method(t){var e,r,{contentType:s,body:n,estimatedSize:o}=null!==(e=Bs(t))&&void 0!==e?e:{},a=new Headers;zi(t.headers,(function(t,e){a.append(e,t)})),s&&a.append("Content-Type",s);var l=t.url,u=null;if(wt){var h=new wt;u={signal:h.signal,timeout:setTimeout((()=>h.abort()),t.timeout)}}bt(l,i({method:(null==t?void 0:t.method)||"GET",headers:a,keepalive:"POST"===t.method&&52428.8>(o||0),body:n,signal:null==(r=u)?void 0:r.signal},t.fetchOptions)).then((e=>e.text().then((i=>{var r={statusCode:e.status,text:i};if(200===e.status)try{r.json=JSON.parse(i)}catch(t){Ui.error(t)}null==t.callback||t.callback(r)})))).catch((e=>{Ui.error(e),null==t.callback||t.callback({statusCode:0,error:e})})).finally((()=>u?clearTimeout(u.timeout):null))}}),yt&&Vs.push({transport:"XHR",method(t){var e,i=new yt;i.open(t.method||"GET",t.url,!0);var{contentType:r,body:s}=null!==(e=Bs(t))&&void 0!==e?e:{};zi(t.headers,(function(t,e){i.setRequestHeader(e,t)})),r&&i.setRequestHeader("Content-Type",r),t.timeout&&(i.timeout=t.timeout),t.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(4===i.readyState){var e={statusCode:i.status,text:i.responseText};if(200===i.status)try{e.json=JSON.parse(i.responseText)}catch(t){}null==t.callback||t.callback(e)}},i.send(s)}}),null!=_t&&_t.sendBeacon&&Vs.push({transport:"sendBeacon",method(t){var e=js(t.url,{beacon:"1"});try{var i,{contentType:r,body:s}=null!==(i=Bs(t))&&void 0!==i?i:{};if(!s)return;var n=s instanceof Blob?s:new Blob([s],{type:r});_t.sendBeacon(e,n)}catch(t){}}});var Ws=3e3;class Gs{constructor(t,e){this.Or=!0,this.Pr=[],this.Lr=ee((null==e?void 0:e.flush_interval_ms)||Ws,250,5e3,Ui.createLogger("flush interval"),Ws),this.Dr=t}enqueue(t){this.Pr.push(t),this.Br||this.jr()}unload(){this.$r();var t=this.Pr.length>0?this.qr():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Dr(i({},t,{transport:"sendBeacon"}))}))}enable(){this.Or=!1,this.jr()}jr(){var t=this;this.Or||(this.Br=setTimeout((()=>{if(this.$r(),this.Pr.length>0){var e=this.qr(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&Mt(i.data)&&zi(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Dr(i)};for(var r in e)i()}}),this.Lr))}$r(){clearTimeout(this.Br),this.Br=void 0}qr(){var t={};return zi(this.Pr,(e=>{var r,s=e,n=(s?s.batchKey:null)||s.url;Nt(t[n])&&(t[n]=i({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this.Pr=[],t}}var Ys=["retriesPerformedSoFar"];class Js{constructor(t){this.Zr=!1,this.Hr=3e3,this.Pr=[],this._instance=t,this.Pr=[],this.Vr=!0,!Nt(pt)&&"onLine"in pt.navigator&&(this.Vr=pt.navigator.onLine,this.zr=()=>{this.Vr=!0,this.Ur()},this.Yr=()=>{this.Vr=!1},Ji(pt,"online",this.zr),Ji(pt,"offline",this.Yr))}get length(){return this.Pr.length}retriableRequest(t){var{retriesPerformedSoFar:e}=t,s=r(t,Ys);Vt(e)&&(s.url=js(s.url,{retry_count:e})),this._instance._send_request(i({},s,{callback:t=>{200===t.statusCode||t.statusCode>=400&&500>t.statusCode||(null!=e?e:0)>=10?null==s.callback||s.callback(t):this.Wr(i({retriesPerformedSoFar:e},s))}}))}Wr(t){var e=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=e+1;var i=function(t){var e=3e3*Math.pow(2,t),i=e/2,r=Math.min(18e5,e),s=Math.random()-.5;return Math.ceil(r+s*(r-i))}(e),r=Date.now()+i;this.Pr.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),Ui.warn(s),this.Zr||(this.Zr=!0,this.Gr())}Gr(){if(this.Xr&&clearTimeout(this.Xr),0===this.Pr.length)return this.Zr=!1,void(this.Xr=void 0);this.Xr=setTimeout((()=>{this.Vr&&this.Pr.length>0&&this.Ur(),this.Gr()}),this.Hr)}Ur(){var t=Date.now(),e=[],i=this.Pr.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.Pr=e,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:t}of(this.Xr&&(clearTimeout(this.Xr),this.Xr=void 0),this.Zr=!1,Nt(pt)||(this.zr&&(pt.removeEventListener("online",this.zr),this.zr=void 0),this.Yr&&(pt.removeEventListener("offline",this.Yr),this.Yr=void 0)),this.Pr))try{this._instance._send_request(i({},t,{transport:"sendBeacon"}))}catch(t){Ui.error(t)}this.Pr=[]}}class Ks{constructor(t){this.Jr=()=>{var t,e,i,r;this.Kr||(this.Kr={});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.Kr.lastScrollY=Math.ceil(n),this.Kr.maxScrollY=Math.max(n,null!==(t=this.Kr.maxScrollY)&&void 0!==t?t:0),this.Kr.maxScrollHeight=Math.max(o,null!==(e=this.Kr.maxScrollHeight)&&void 0!==e?e:0),this.Kr.lastContentY=a,this.Kr.maxContentY=Math.max(a,null!==(i=this.Kr.maxContentY)&&void 0!==i?i:0),this.Kr.maxContentHeight=Math.max(l,null!==(r=this.Kr.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get Qr(){return this._instance.config.scroll_root_selector}getContext(){return this.Kr}resetContext(){var t=this.Kr;return setTimeout(this.Jr,0),t}startMeasuringScrollPosition(){Ji(pt,"scroll",this.Jr,{capture:!0}),Ji(pt,"scrollend",this.Jr,{capture:!0}),Ji(pt,"resize",this.Jr)}scrollElement(){if(!this.Qr)return null==pt?void 0:pt.document.documentElement;var t=Mt(this.Qr)?this.Qr:[this.Qr];for(var e of t){var i=null==pt?void 0:pt.document.querySelector(e);if(i)return i}}scrollY(){if(this.Qr){var t=this.scrollElement();return t&&t.scrollTop||0}return pt&&(pt.scrollY||pt.pageYOffset||pt.document.documentElement.scrollTop)||0}scrollX(){if(this.Qr){var t=this.scrollElement();return t&&t.scrollLeft||0}return pt&&(pt.scrollX||pt.pageXOffset||pt.document.documentElement.scrollLeft)||0}}var Xs=t=>zr(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class Qs{constructor(t,e,i,r){this.ei=t=>{var e=this.ti();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.ri(this._instance)};this.ii.register({[V]:i})}},this._instance=t,this.ni=e,this.ii=i,this.ri=r||Xs,this.ni.onSessionId(this.ei)}ti(){return this.ii.props[V]}getSetOnceProps(){var t,e=null==(t=this.ti())?void 0:t.props;return e?"r"in e?Br(e):{$referring_domain:e.referringDomain,$pathname:e.initialPathName,utm_source:e.utm_source,utm_campaign:e.utm_campaign,utm_medium:e.utm_medium,utm_content:e.utm_content,utm_term:e.utm_term}:{}}getSessionProps(){var t={};return zi(Wi(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+It(i)]=e})),t}}class Zs{constructor(){this.si={}}on(t,e){return this.si[t]||(this.si[t]=[]),this.si[t].push(e),()=>{this.si[t]=this.si[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.si[t]||[])i(e);for(var r of this.si["*"]||[])r(t,e)}}var tn=Ni("[SessionId]");class en{on(t,e){return this.oi.on(t,e)}constructor(t,e,i){var r;if(this.ai=[],this.li=void 0,this.oi=new Zs,this.ui=(t,e)=>!(!Vt(t)||!Vt(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===st)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Lt=t.config,this.ii=t.persistence,this.hi=void 0,this.ci=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.di=e||ir,this.vi=i||ir;var s=this.Lt.persistence_name||this.Lt.token;if(this._sessionTimeoutMs=1e3*ee(this.Lt.session_idle_timeout_seconds||1800,60,36e3,tn.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.fi(),this.pi="ph_"+s+"_window_id",this.gi="ph_"+s+"_primary_window_exists",this.mi()){var n=cr.Z(this.pi),o=cr.Z(this.gi);n&&!o?this.hi=n:cr.F(this.pi),cr.M(this.gi,!0)}if(null!=(r=this.Lt.bootstrap)&&r.sessionID)try{var a=(t=>{var e=this.Lt.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.yi(this.Lt.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){tn.error("Invalid sessionID in bootstrap",t)}this.bi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Nt(this.ai)&&(this.ai=[]),this.ai.push(t),this.ci&&t(this.ci,this.hi),()=>{this.ai=this.ai.filter((e=>e!==t))}}mi(){return"memory"!==this.Lt.persistence&&!this.ii.br&&cr.R()}wi(t){t!==this.hi&&(this.hi=t,this.mi()&&cr.M(this.pi,t))}Ii(){return this.hi?this.hi:this.mi()?cr.Z(this.pi):null}yi(t,e,i){t===this.ci&&e===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.ci=t,this.ii.register({[S]:[e,t,i]}))}Ci(){var t=this.ii.props[S];return Mt(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.yi(null,null,null)}destroy(){clearTimeout(this.Si),this.Si=void 0,this.li&&pt&&(pt.removeEventListener(ut,this.li,{capture:!1}),this.li=void 0),this.ai=[]}bi(){this.li=()=>{this.mi()&&cr.F(this.gi)},Ji(pt,ut,this.li,{capture:!1})}checkAndGetSessionAndWindowId(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=null),this.Lt.cookieless_mode===st)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=e||(new Date).getTime(),[r,s,n]=this.Ci(),o=this.Ii(),a=Vt(n)&&Math.abs(i-n)>864e5,l=!1,u=!s,h=!u&&!t&&this.ui(i,r);u||h||a?(s=this.di(),o=this.vi(),tn.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this.vi(),l=!0);var d=Vt(r)&&t&&!a?r:i,v=Vt(n)?n:(new Date).getTime();return this.wi(o),this.yi(s,d,v),t||this.fi(),l&&this.ai.forEach((t=>t(s,o,l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0))),{sessionId:s,windowId:o,sessionStartTimestamp:v,changeReason:l?{noSessionId:u,activityTimeout:h,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}fi(){clearTimeout(this.Si),this.Si=setTimeout((()=>{var[t]=this.Ci();if(this.ui((new Date).getTime(),t)){var e=this.ci;this.resetSessionId(),this.oi.emit("forcedIdleReset",{idleSessionId:e})}}),1.1*this.sessionTimeoutMs)}}var rn=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&kt(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>kt(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver},sn=function(t,e){if(!function(t){try{new RegExp(t)}catch(t){return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch(t){return!1}};function nn(t,e,i){return zs({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var on={exact:(t,e)=>e.some((e=>t.some((t=>e===t)))),is_not:(t,e)=>e.every((e=>t.every((t=>e!==t)))),regex:(t,e)=>e.some((e=>t.some((t=>sn(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!sn(e,t))))),icontains:(t,e)=>e.map(an).some((e=>t.map(an).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(an).every((e=>t.map(an).every((t=>!e.includes(t))))),gt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i>parseFloat(t)))})),lt:(t,e)=>e.some((e=>{var i=parseFloat(e);return!isNaN(i)&&t.some((t=>i<parseFloat(t)))}))},an=t=>t.toLowerCase();function ln(t,e){return!t||Object.entries(t).every((t=>{var[i,r]=t,s=null==e?void 0:e[i];if(Nt(s)||Bt(s))return!1;var n=[String(s)],o=on[r.operator];return!!o&&o(r.values,n)}))}var un="custom",hn="i.posthog.com",dn=/^\/static\//;class vn{constructor(t){this.xi={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,e=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return e||(e=this.apiHost.replace("."+hn,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.xi[this.apiHost]||(this.xi[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":un),this.xi[this.apiHost]}ki(t){var e=this.instance.config.__preview_external_dependency_versioned_paths;if("string"==typeof e&&dn.test(t))return e.trim().replace(/\/$/,"")||void 0}endpointFor(t,e){if(void 0===e&&(e=""),e&&(e="/"===e[0]?e:"/"+e),"ui"===t)return this.uiHost+e;if("flags"===t)return this.flagsApiHost+e;if("assets"===t){var i=this.ki(e);if(i)return""+i+e}if(this.region===un)return this.apiHost+e;var r=hn+e;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var cn=Ni("[Surveys]"),pn="seenSurvey_",fn=[Yr.Popover,Yr.Widget,Yr.API],_n={ignoreConditions:!1,ignoreDelay:!1,displayType:Xr.Popover},gn=Ni("[PostHog ExternalIntegrations]"),mn={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class bn{constructor(t){this._instance=t}lr(t,e){var i;null==(i=St.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return gn.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(e){var i,s,n;!r||null!=(i=St.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]||t.lr(mn[e],(()=>{var i;null==(i=St.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[e])||i.start(t._instance)})),!r&&null!=(s=St.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[e]&&(null==(n=St.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[e])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;e(i)}}}var yn,wn={},xn=0,En=()=>{},Sn='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',$n="Surveys module not available",Tn="sanitize_properties is deprecated. Use before_send instead",kn="Invalid value for property_denylist config: ",Rn="posthog",Pn=!Ls&&-1===(null==Et?void 0:Et.indexOf("MSIE"))&&-1===(null==Et?void 0:Et.indexOf("Mozilla")),On=t=>{var e;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Yi(null==gt?void 0:gt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:En,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,__preview_external_dependency_versioned_paths:!1,debug:mt&&jt(null==mt?void 0:mt.search)&&-1!==mt.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==pt||null==(e=pt.location)?void 0:e.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){Ui.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:at,before_send:void 0,request_queue_config:{flush_interval_ms:Ws},error_tracking:{},_onCapture:En,__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))},In=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],Cn=t=>{var e={};for(var[i,r]of In)Nt(t[i])||(e[r]=t[i]);var s=Bi({},e,t);return Mt(t.property_blacklist)&&(Nt(t.property_denylist)?s.property_denylist=t.property_blacklist:Mt(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:Ui.error(kn+t.property_denylist)),s};class Fn{constructor(){this.__forceAllowLocalhost=!1}get Ti(){return this.__forceAllowLocalhost}set Ti(t){Ui.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class An{Ai(t,e){if(t){var i=this.Ei.indexOf(t);-1!==i&&this.Ei.splice(i,1)}return this.Ei.push(e),null==e.initialize||e.initialize(),e}Ri(){return this.config.cookieless_mode===st||this.config.cookieless_mode===rt&&this.consent.isRejected()}get decideEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,e;return null!==(t=null==(e=this.featureFlags)?void 0:e.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new Fn,this.Ni=!1,this.version=n.LIB_VERSION,this.Mi=new Zs,this.Ei=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=On(),this.SentryIntegration=xr,this.sentryIntegration=t=>function(t,e){var i=wr(t,e);return{name:yr,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fi=!1,this.Oi=null,this.Pi=null,this.Li=null,this.scrollManager=new Ks(this),this.pageViewManager=new Er(this),this.rateLimiter=new es(this),this.requestRouter=new vn(this),this.consent=new pr(this),this.externalIntegrations=new bn(this);var e=null!==(t=An.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=e.featureFlags&&new e.featureFlags(this),this.toolbar=e.toolbar&&new e.toolbar(this),this.surveys=e.surveys&&new e.surveys(this),this.conversations=e.conversations&&new e.conversations(this),this.logs=e.logs&&new e.logs(this),this.experiments=e.experiments&&new e.experiments(this),this.exceptions=e.exceptions&&new e.exceptions(this),this.people={set:(t,e,i)=>{var r=jt(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=jt(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>Ui.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==Rn){var r,s=null!==(r=wn[i])&&void 0!==r?r:new An;return s._init(t,e,i),wn[i]=s,wn[Rn][i]=s,s}return this._init(t,e,i)}_init(t,e,r){var s,o;if(void 0===e&&(e={}),Nt(t)||zt(t))return Ui.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={},e.debug=this.Di(e.debug),this.Bi=e,this.ji=[],e.person_profiles?this.Pi=e.person_profiles:e.process_person&&(this.Pi=e.process_person),this.set_config(Bi({},On(e.defaults),Cn(e),{name:r,token:t})),this.config.on_xhr_error&&Ui.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:ss.GZipJS;var a=this.$i();this.persistence=new Wr(this.config,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Wr(i({},this.config,{persistence:"sessionStorage"}),a);var l=i({},this.persistence.props),u=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.qi=new Gs((t=>this.Zi(t)),this.config.request_queue_config),this.Hi=new Js(this),this.__request_queue=[];var h=this.Ri();if(h||(this.sessionManager=new en(this),this.sessionPropsManager=new Qs(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(Ui.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Vi(h)}),0)):(Ui.info("Initializing extensions synchronously"),this.Vi(h)),n.DEBUG=n.DEBUG||this.config.debug,n.DEBUG&&Ui.info("Starting in debug mode",{this:this,config:e,thisC:i({},this.config),p:l,s:u}),!this.config.identity_distinct_id||null!=(s=e.bootstrap)&&s.distinctID||(e.bootstrap=i({},e.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(o=e.bootstrap)?void 0:o.distinctID)){var d=e.bootstrap.distinctID,v=this.get_distinct_id(),c=this.persistence.get_property(q);if(e.bootstrap.isIdentifiedID&&null!=v&&v!==d&&c===nt)this.identify(d);else if(e.bootstrap.isIdentifiedID&&null!=v&&v!==d&&c===ot)Ui.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var p=this.config.get_device_id(ir()),f=e.bootstrap.isIdentifiedID?p:d;this.persistence.set_property(q,e.bootstrap.isIdentifiedID?ot:nt),this.register({distinct_id:d,$device_id:f})}}if(h)this.register_once({distinct_id:Q,$device_id:null},"");else if(!this.get_distinct_id()){var _=this.config.get_device_id(ir());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(q,nt)}return Ji(pt,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),e.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||ir();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(q,ot)),e()},s=i.user();"then"in s&&Dt(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{Promise&&Promise.resolve||br.warn("This browser does not have Promise support, and can not use the segment integration");var e=(e,i)=>{if(!i)return e;e.event.userId||e.event.anonymousId===t.get_distinct_id()||(br.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(br.info("UserId set, identifying with PostHog"),t.identify(e.event.userId));var r=t.calculateEventProperties(i,e.event.properties);return e.event.properties=Object.assign({},r,e.event.properties),e};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>e(t,t.event.event),page:t=>e(t,ht),identify:t=>e(t,vt),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.zi())):this.zi(),Dt(this.config._onCapture)&&this.config._onCapture!==En&&(Ui.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Ui.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}Vi(t){var e,r,s,n,o,a,l,u=performance.now(),h=i({},An.__defaultExtensionClasses,this.config.__extensionClasses),d=[];h.featureFlags&&this.Ei.push(this.featureFlags=null!==(e=this.featureFlags)&&void 0!==e?e:new h.featureFlags(this)),h.exceptions&&this.Ei.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new h.exceptions(this)),h.historyAutocapture&&this.Ei.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.Ei.push(new h.tracingHeaders(this)),h.siteApps&&this.Ei.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.Ei.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.Ei.push(this.autocapture=new h.autocapture(this)),h.surveys&&this.Ei.push(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new h.surveys(this)),h.logs&&this.Ei.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new h.logs(this)),h.conversations&&this.Ei.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new h.conversations(this)),h.productTours&&this.Ei.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.Ei.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.Ei.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.Ei.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.Ei.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,gr)),h.toolbar&&this.Ei.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new h.toolbar(this)),h.experiments&&this.Ei.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new h.experiments(this)),this.Ei.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.Ui){var t=this.Ui;this.Ui=void 0,this.Rr(t)}})),this.Yi(d,u)}Yi(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.Yi(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){Ui.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[Z]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[tt]:r}),this.config.__preview_deferred_init_extensions&&Ui.info("PostHog extensions initialized ("+r+"ms)")}Rr(t){var e;if(!gt||!gt.body)return Ui.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Rr(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Ui=t),this.Wi=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=Pt(t.supportedCompression,ss.GZipJS)?ss.GZipJS:Pt(t.supportedCompression,ss.Base64)?ss.Base64:void 0),null!=(e=t.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Pi?this.Pi:at}),this.Ei.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}zi(){try{this.config.loaded(this)}catch(t){Ui.critical("`loaded` function failed",t)}if(this.Gi(),this.config.internal_or_test_user_hostname&&null!=mt&&mt.hostname){var t=mt.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Ri())&&this.Xi()}),1),this.Ji=new rs(this),this.Ji.load()}Gi(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.qi)||t.enable())}_dom_loaded(){this.is_capturing()&&ji(this.__request_queue,(t=>this.Zi(t))),this.__request_queue=[],this.Gi()}_handle_unload(){var t,e,i,r;null==(t=this.surveys)||t.handlePageUnload(),this.config.request_batching?(this.Ki()&&this.capture(dt),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(i=this.qi)||i.unload(),null==(r=this.Hi)||r.unload()):this.Ki()&&this.capture(dt,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(Pn?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=js(t.url,{ip:this.config.ip?1:0}),t.headers=i({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,t.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||this.config.fetch_options,(t=>{var e,r,s,n=i({},t);n.timeout=n.timeout||6e4,n.url=qs(n.url,n.compression);var o=null!==(e=n.transport)&&void 0!==e?e:"fetch",a=Vs.filter((t=>!n.disableTransport||!t.transport||!n.disableTransport.includes(t.transport))),l=null!==(r=null==(s=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===o)return t[i]}(a))?void 0:s.method)&&void 0!==r?r:a[0].method;if(!l)throw new Error("No available transport method");"sendBeacon"!==o&&n.data&&n.compression===ss.GZipJS&&xt&&!Ns?Hs(n).then((t=>{l(t)})).catch((e=>{if((t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""))(e))return Ns=!0,void l(i({},n,{compression:void 0,url:qs(t.url,void 0)}));l(n)})):l(n)})(i({},t,{callback:e=>{var i,r;this.rateLimiter.checkForLimiting(e),400>e.statusCode||null==(i=(r=this.config).on_request_error)||i.call(r,e),null==t.callback||t.callback(e)}}))))}Zi(t){this.Hi?this.Hi.retriableRequest(t):this._send_request(t)}_execute_array(t){xn++;try{var e,i=[],r=[],s=[];ji(t,(t=>{t&&(Mt(e=t[0])?s.push(t):Dt(t)?t.call(this):Mt(t)&&"alias"===e?i.push(t):Mt(t)&&-1!==e.indexOf("capture")&&Dt(this[e])?s.push(t):r.push(t))}));var n=function(t,e){ji(t,(function(t){if(Mt(t[0])){var i=e;zi(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}))};n(i,this),n(r,this),n(s,this)}finally{xn--}}push(t){if(xn>0&&Mt(t)&&jt(t[0])){var e=An.prototype[t[0]];Dt(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,r){var s,n,o,a,l;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qi){if(this.is_capturing())if(!Nt(t)&&jt(t)){var u=!this.config.opt_out_useragent_filter&&this._is_bot();if(!u||this.config.__preview_capture_bot_pageviews){var h=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==h||!h.isRateLimited){null!=e&&e.$current_url&&!jt(null==e?void 0:e.$current_url)&&(Ui.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=r&&r.Qi||Ui.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=ir(),p={uuid:c,event:t,properties:this.calculateEventProperties(t,e||{},v,c)};t===ht&&this.config.__preview_capture_bot_pageviews&&u&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),h&&(p.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens),(null==r?void 0:r.$set)&&(p.$set=null==r?void 0:r.$set);var f,_,g,m=this.en(null==r?void 0:r.$set_once,t!==ct,t===vt);if(m&&(p.$set_once=m),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,o=p,a=t=>jt(t)?t.slice(0,n):t,l=new Set,p=function t(e,i){return e!==Object(e)?a?a(e):e:l.has(e)?void 0:(l.add(e),Mt(e)?(r=[],ji(e,(e=>{r.push(t(e))}))):(r={},zi(e,((e,i)=>{l.has(e)||(r[i]=t(e,i))}))),r);var r}(o)),p.timestamp=v,Nt(null==r?void 0:r.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),t===Jr.DISMISSED||t===Jr.SENT){var b=null==e?void 0:e[Kr.SURVEY_ID],y=null==e?void 0:e[Kr.SURVEY_ITERATION];(t=>{try{var e=(t=>((t,e)=>{var i=""+pn+e.id;return e.current_iteration&&e.current_iteration>0&&(i=""+pn+e.id+"_"+e.current_iteration),i})(0,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){cn.error("Failed to persist survey seen state",t)}})({id:b,current_iteration:y}),p.$set=i({},p.$set,{[(f={id:b,current_iteration:y},_=t===Jr.SENT?"responded":"dismissed",g="$survey_"+_+"/"+f.id,f.current_iteration&&f.current_iteration>0&&(g="$survey_"+_+"/"+f.id+"/"+f.current_iteration),g)]:!0})}else t===Jr.SHOWN&&(p.$set=i({},p.$set,{[Kr.SURVEY_LAST_SEEN_DATE]:(new Date).toISOString()}));if(t===Qr.SHOWN){var w=null==e?void 0:e[Zr.TOUR_TYPE];w&&(p.$set=i({},p.$set,{[Zr.TOUR_LAST_SEEN_DATE+"/"+w]:(new Date).toISOString()}))}var x=i({},p.properties.$set,p.$set);if(Ut(x)||this.setPersonPropertiesForFlags(x),!Ht(this.config.before_send)){var E=this.tn(p);if(!E)return;p=E}this.Mi.emit("eventCaptured",p);var S={method:"POST",url:null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,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.Zi(S):this.qi.enqueue(S),p}Ui.critical("This capture call is ignored due to client rate limiting.")}}else Ui.error("No event name provided to posthog.capture")}else Ui.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}calculateEventProperties(t,e,r,s,o){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return e;var a=o?void 0:this.persistence.remove_event_timer(t),l=i({},e);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.Ri()&&(l.$cookieless_mode=!0),"$snapshot"===t){var u=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!jt(l.distinct_id)&&!qt(l.distinct_id)||zt(l.distinct_id))&&Ui.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var h,d=function(t,e){var i,r,s,o;if(!Et)return{};var a,l,u,h,d,v,c,p,f=t?[...Ir,...e||[]]:[],[_,g]=function(t){for(var e=0;Ze.length>e;e++){var[i,r]=Ze[e],s=i.exec(t),n=s&&(Dt(r)?r(s,t):r);if(n)return n}return["",""]}(Et);return Bi(Wi({$os:_,$os_version:g,$browser:Ke(Et,navigator.vendor),$device:ti(Et),$device_type:(l=Et,u={userAgentDataPlatform:null==(i=navigator)||null==(i=i.userAgentData)?void 0:i.platform,maxTouchPoints:null==(r=navigator)?void 0:r.maxTouchPoints,screenWidth:null==pt||null==(s=pt.screen)?void 0:s.width,screenHeight:null==pt||null==(o=pt.screen)?void 0:o.height,devicePixelRatio:null==pt?void 0:pt.devicePixelRatio},p=ti(l),p===de||p===he||"Kobo"===p||"Kindle Fire"===p||p===ze?ue:p===Oe||p===Ce||p===Ie||p===Ue?"Console":p===ce?"Wearable":p?oe:"Android"===(null==u?void 0:u.userAgentDataPlatform)&&(null!==(h=null==u?void 0:u.maxTouchPoints)&&void 0!==h?h:0)>0?600>Math.min(null!==(d=null==u?void 0:u.screenWidth)&&void 0!==d?d:0,null!==(v=null==u?void 0:u.screenHeight)&&void 0!==v?v:0)/(null!==(c=null==u?void 0:u.devicePixelRatio)&&void 0!==c?c:1)?oe:ue:"Desktop"),$timezone:Hr(),$timezone_offset:qr()}),{$current_url:Rr(null==mt?void 0:mt.href,f,Fr),$host:null==mt?void 0:mt.host,$pathname:null==mt?void 0:mt.pathname,$raw_user_agent:Et.length>1e3?Et.substring(0,997)+"...":Et,$browser_version:Qe(Et,navigator.vendor),$browser_language:Ur(),$browser_language_prefix:(a=Ur(),"string"==typeof a?a.split("-")[0]:void 0),$screen_height:null==pt?void 0:pt.screen.height,$screen_width:null==pt?void 0:pt.screen.width,$viewport_height:null==pt?void 0:pt.innerHeight,$viewport_width:null==pt?void 0:pt.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&&Bi(l,this.sessionPropsManager.getSessionProps());try{var p;this.sessionRecording&&Bi(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(p=this.Hi)?void 0:p.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===un&&(l.$lib_custom_api_host=this.config.api_host),h=t!==ht||o?t!==dt||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),l=Bi(l,h),t===ht&>&&(l.title=gt.title),!Nt(a)){var f=r.getTime()-a;l.$duration=parseFloat((f/1e3).toFixed(3))}Et&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=Bi({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),Mt(this.config.property_denylist)?zi(this.config.property_denylist,(function(t){delete l[t]})):Ui.error(kn+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var _=this.config.sanitize_properties;_&&(Ui.error(Tn),l=_(l,t));var g=this.rn();return l.$process_person_profile=g,g&&!o&&this.nn("_calculate_event_properties"),l}en(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.rn())return t;if(this.Ni&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=Bi({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Ui.error(Tn),o=a(o,"$set_once")),e&&(this.Ni=!0),Ut(o)?void 0:o}register(t,e){var i;null==(i=this.persistence)||i.register(t,e)}register_once(t,e,i){var r;null==(r=this.persistence)||r.register_once(t,e,i)}register_for_session(t){var e;null==(e=this.sessionPersistence)||e.register(t)}unregister(t){var e;null==(e=this.persistence)||e.unregister(t)}unregister_for_session(t){var e;null==(e=this.sessionPersistence)||e.unregister(t)}sn(t,e){this.register({[t]:e})}getFeatureFlag(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(t,e)}getFeatureFlagPayload(t){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagPayload(t)}getFeatureFlagResult(t,e){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(t,e)}isFeatureEnabled(t,e){var i;return null==(i=this.featureFlags)?void 0:i.isFeatureEnabled(t,e)}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,e,i){var r;null==(r=this.featureFlags)||r.updateFlags(t,e,i)}updateEarlyAccessFeatureEnrollment(t,e,i){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,e,i)}getEarlyAccessFeatures(t,e,i){var r;return void 0===e&&(e=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,e,i)}on(t,e){return this.Mi.on(t,e)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:$n}),()=>{})}onSessionId(t){var e,i;return null!==(e=null==(i=this.sessionManager)?void 0:i.onSessionId(t))&&void 0!==e?e:()=>{}}getSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getSurveys(t,e):t([],{isLoaded:!1,error:$n})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:$n})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=_n),null==(i=this.surveys)||i.displaySurvey(t,e)}cancelPendingSurvey(t){var e;null==(e=this.surveys)||e.cancelPendingSurvey(t)}canRenderSurvey(t){var e,i;return null!==(e=null==(i=this.surveys)?void 0:i.canRenderSurvey(t))&&void 0!==e?e:{visible:!1,disabledReason:$n}}canRenderSurveyAsync(t,e){var i,r;return void 0===e&&(e=!1),null!==(i=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,e))&&void 0!==i?i:Promise.resolve({visible:!1,disabledReason:$n})}an(t){return!t||zt(t)?(Ui.critical("Unique user id has not been set in posthog.identify"),!1):t===Q?(Ui.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())||(Ui.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,e,i){if(!this.__loaded||!this.persistence)return Ui.uninitializedWarning("posthog.identify");if(qt(t)&&(t=t.toString(),Ui.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.an(t)&&this.nn("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(q)||nt)===nt;t!==r&&n?(this.persistence.set_property(q,ot),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.capture(vt,{distinct_id:t,$anon_distinct_id:r},{$set:e||{},$set_once:i||{}}),this.Li=nn(t,e,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(e||i)&&this.setPersonProperties(e,i),t!==r&&(this.reloadFeatureFlags(),this.unregister(j))}}setPersonProperties(t,e){if((t||e)&&this.nn("posthog.setPersonProperties")){var i=nn(this.get_distinct_id(),t,e);this.Li!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Li=i):Ui.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,e,r){if(t&&e){var s=this.getGroups(),n=s[t]!==e;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:i({},s,{[t]:e})}),n||r){var o={$group_type:t,$group_key:e};r&&(o.$group_set=r),this.capture(ct,o)}r&&this.setGroupPropertiesForFlags({[t]:r}),n&&!r&&this.reloadFeatureFlags()}else Ui.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(t,e)}resetPersonPropertiesForFlags(){var t;null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.nn("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e,i,r,s,n,o,l,u;if(Ui.info("reset"),!this.__loaded)return Ui.uninitializedWarning("posthog.reset");var h=this.get_property(a);if(this.consent.reset(),null==(e=this.persistence)||e.clear(),null==(i=this.sessionPersistence)||i.clear(),null==(r=this.surveys)||r.reset(),null==(s=this.Ji)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(l=this.persistence)||l.set_property(q,nt),null==(u=this.sessionManager)||u.resetSessionId(),this.Li=null,this.config.cookieless_mode===st)this.register_once({distinct_id:Q,$device_id:null},"");else{var d=this.config.get_device_id(ir());this.register_once({distinct_id:d,$device_id:t?d:h},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(t,e){var i;this.config.identity_distinct_id=t,this.config.identity_hash=e,this.alias(t),null==(i=this.conversations)||i.ln()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.un()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,e;return null!==(t=null==(e=this.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:e,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+e);if(null!=t&&t.withTimestamp&&i){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(t,e){return t===this.get_property(o)?(Ui.critical("Attempting to create alias for existing People user - aborting."),-2):this.nn("posthog.alias")?(Nt(e)&&(e=this.get_distinct_id()),t!==e?(this.sn(l,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(Ui.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=i({},this.config);if(Lt(t)){var r,s,o,a,l,u,h,d,v,c;Bi(this.config,Cn(t));var p=this.$i();null==(r=this.persistence)||r.update_config(this.config,e,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new Wr(i({},this.config,{persistence:"sessionStorage"}),p);var f=this.Di(this.config.debug);Wt(f)&&(this.config.debug=f),Wt(this.config.debug)&&(this.config.debug?(n.DEBUG=!0,lr.R()&&lr.M("ph_debug",!0),Ui.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(n.DEBUG=!1,lr.R()&&lr.F("ph_debug"))),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.autocapture)||l.startIfEnabled(),null==(u=this.heatmaps)||u.startIfEnabled(),null==(h=this.exceptionObserver)||h.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(v=this.surveys)||v.loadIfEnabled(),this.hn(),null==(c=this.externalIntegrations)||c.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){n.LIB_NAME=t,n.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var r=new Error("PostHog syntheticException"),s=this.exceptions.buildProperties(t,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(i({},s,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:An.cn}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var e,i;return null!==(e=null==(i=this.toolbar)?void 0:i.loadToolbar(t))&&void 0!==e&&e}get_property(t){var e;return null==(e=this.persistence)?void 0:e.props[t]}getSessionProperty(t){var e;return null==(e=this.sessionPersistence)?void 0:e.props[t]}toString(){var t,e=null!==(t=this.config.name)&&void 0!==t?t:Rn;return e!==Rn&&(e=Rn+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(q))===ot||(null==(e=this.sessionPersistence)?void 0:e.get_property(q))===ot}rn(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===at&&!this._isIdentified()&&Ut(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[l])&&(null==(e=this.persistence)||null==(e=e.props)||!e[K]))}Ki(){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.rn()||this.nn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.nn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}nn(t){return"never"===this.config.person_profiles?(Ui.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.sn(K,!0),!0)}$i(){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!==rt)}hn(){var t,e,i,r,s=this.$i();return(null==(t=this.persistence)?void 0:t.br)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.br)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==st){if(this.Ri()){var i,r,s,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new en(this),this.pageViewManager=new Er(this),this.persistence&&(this.sessionPropsManager=new Qs(this,this.sessionManager,this.persistence));var a,l=null!==(s=null==(n=this.config.__extensionClasses)?void 0:n.sessionRecording)&&void 0!==s?s:null==(o=An.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.Ai(this.sessionRecording,new l(this)),this.Wi&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Wi)))}var u,h;this.consent.optInOut(!0),this.hn(),this.Gi(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==rt&&(null==(u=this.surveys)||u.loadIfEnabled()),(Nt(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.Xi()}else Ui.warn(Sn)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==st?(this.config.cookieless_mode===rt&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.hn(),this.config.cookieless_mode===rt&&(this.register({distinct_id:Q,$device_id:null}),null==(t=this.sessionManager)||t.destroy(),null==(e=this.pageViewManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(i=this.sessionRecording)||i.stopRecording(),this.sessionRecording=void 0,this.Xi())):Ui.warn(Sn)}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===st||(this.config.cookieless_mode===rt?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.hn()}_is_bot(){return _t?rn(_t,this.config.custom_blocked_useragents):void 0}Xi(){gt&&("visible"===gt.visibilityState?this.Fi||(this.Fi=!0,this.capture(ht,{title:gt.title},{send_instantly:!0}),this.Oi&&(gt.removeEventListener(lt,this.Oi),this.Oi=null)):this.Oi||(this.Oi=this.Xi.bind(this),Ji(gt,lt,this.Oi)))}debug(t){!1===t?(null==pt||pt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==pt||pt.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}))}Mr(){var t,e,i,r,s,n,o=this.Bi||{};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?(Ui.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",!1,r=Ui,s=(e="advanced_disable_flags")in(t=o)&&!Ht(t[e]),n=i in t&&!Ht(t[i]),s?t[e]:!!n&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),t[i]))}tn(t){if(Ht(this.config.before_send))return t;var e=Mt(this.config.before_send)?this.config.before_send:[this.config.before_send],i=t;for(var r of e){if(i=r(i),Ht(i)){var s="Event '"+t.event+"' was rejected in beforeSend function";return Yt(t.event)?Ui.warn(s+". This can cause unexpected behavior."):Ui.info(s),null}i.properties&&!Ut(i.properties)||Ui.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var t;return null==(t=this.pageViewManager.cr)?void 0:t.pageViewId}captureTraceFeedback(t,e){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:e})}captureTraceMetric(t,e,i){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:e,$ai_metric_value:String(i)})}Di(t){var e=Wt(t)&&!t,i=lr.R()&&"true"===lr.O("ph_debug");return!e&&(!!i||t)}}function Mn(t){return t instanceof Element&&(t.id===X||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Dn(t){return!!t&&1===t.nodeType}function Ln(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Un(t){return!!t&&3===t.nodeType}function Nn(t){return!!t&&11===t.nodeType}function jn(t){return t?Ot(t).split(/\s+/):[]}function zn(t){var e=null==pt?void 0:pt.location.href;return!!(e&&t&&t.some((t=>e.match(t))))}function Bn(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return jn(e)}function Hn(t){return Ht(t)?null:Ot(t).split(/(\s+)/).filter((t=>ao(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function qn(t){var e="";return Zn(t)&&!to(t)&&t.childNodes&&t.childNodes.length&&zi(t.childNodes,(function(t){var i;Un(t)&&t.textContent&&(e+=null!==(i=Hn(t.textContent))&&void 0!==i?i:"")})),Ot(e)}function Vn(t){return Nt(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}An.__defaultExtensionClasses={},An.cn={trace:yn=()=>{},debug:yn,info:yn,warn:yn,error:yn,fatal:yn},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=Vi(t.prototype[e[i]])}(An,["identify"]);var Wn=["a","button","form","input","select","textarea","label"];function Gn(t,e){if(Nt(e))return!0;var i,r=function(t){if(e.some((e=>t.matches(e))))return{v:!0}};for(var s of t)if(i=r(s))return i.v;return!1}function Yn(t){var e=t.parentNode;return!(!e||!Dn(e))&&e}var Jn=["next","previous","prev",">","<"],Kn=[".ph-no-rageclick",".ph-no-capture"];var Xn=t=>!t||Ln(t,"html")||!Dn(t),Qn=(t,e)=>{if(!pt||Xn(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[t],s=t;s.parentNode&&!Ln(s,"body");)if(Nn(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=Yn(s);if(!n)break;if(e||Wn.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var o=pt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function Zn(t){for(var e=t;e.parentNode&&!Ln(e,"body");e=e.parentNode){var i=Bn(e);if(Pt(i,"ph-sensitive")||Pt(i,"ph-no-capture"))return!1}if(Pt(Bn(t),"ph-include"))return!0;var r=t.type||"";if(jt(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!jt(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 to(t){return!!(Ln(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Ln(t,"select")||Ln(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var eo="(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})",io=new RegExp("^(?:"+eo+")$"),ro=new RegExp(eo),so="\\d{3}-?\\d{2}-?\\d{4}",no=new RegExp("^("+so+")$"),oo=new RegExp("("+so+")");function ao(t,e){if(void 0===e&&(e=!0),Ht(t))return!1;if(jt(t)){if(t=Ot(t),(e?io:ro).test((t||"").replace(/[- ]/g,"")))return!1;if((e?no:oo).test(t))return!1}return!0}function lo(t){var e=qn(t);return ao(e=(e+" "+uo(t)).trim())?e:""}function uo(t){var e="";return t&&t.childNodes&&t.childNodes.length&&zi(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=qn(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+uo(t)).trim())}catch(t){Ui.error("[AutoCapture]",t)}})),e}function ho(t){return t.replace(/"|\\"/g,'\\"')}function vo(t){var e=t.attr__class;return e?Mt(e)?e:jn(e):void 0}class co{constructor(t){this.disabled=!1===t;var e=Lt(t)?t:{};this.thresholdPx=e.threshold_px||30,this.timeoutMs=e.timeout_ms||1e3,this.clickCount=e.click_count||3,this.clicks=[]}isRageClick(t,e,i){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(e-r.y)<this.thresholdPx&&this.timeoutMs>i-r.timestamp){if(this.clicks.push({x:t,y:e,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:e,timestamp:i}];return!1}}var po="$copy_autocapture",fo=Ni("[AutoCapture]");function _o(t,e){return e.length>t?e.slice(0,t)+"...":e}function go(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!Dn(e));return e}function mo(t,e){for(var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=e,h=[t],d=t;d.parentNode&&!Ln(d,"body");)Nn(d.parentNode)?(h.push(d.parentNode.host),d=d.parentNode.host):(h.push(d.parentNode),d=d.parentNode);var v,c,p=[],f={},_=!1,g=!1;if(zi(h,(t=>{var e=Zn(t);"a"===t.tagName.toLowerCase()&&(_=t.getAttribute("href"),_=e&&_&&ao(_)&&_),Pt(Bn(t),"ph-no-capture")&&(g=!0),p.push(function(t,e,i,r){var s=t.tagName.toLowerCase(),n={tag_name:s};Wn.indexOf(s)>-1&&!i&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?_o(1024,lo(t)):_o(1024,qn(t)));var o=Bn(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),zi(t.attributes,(function(i){var s;if((!to(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&ao(i.value)&&(!jt(s=i.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=i.value;"class"===i.name&&(o=jn(o).join(" ")),n["attr__"+i.name]=_o(1024,o)}}));for(var a=1,l=1,u=t;u=go(u);)a++,u.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(t,o,a,l));var i=function(t){if(!Zn(t))return{};var e={};return zi(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var i=t.name.replace("data-ph-capture-attribute-",""),r=t.value;i&&r&&ao(r)&&(e[i]=r)}})),e}(t);Bi(f,i)})),g)return{props:{},explicitNoCapture:g};if(a||(p[0].$el_text="a"===t.tagName.toLowerCase()||"button"===t.tagName.toLowerCase()?lo(t):qn(t)),_){var m,b;p[0].attr__href=_;var y=null==(m=Tr(_))?void 0:m.host,w=null==pt||null==(b=pt.location)?void 0:b.host;y&&w&&y!==w&&(v=_)}return{props:Bi({$event_type:n.type,$ce_version:1},u?{}:{$elements:p},{$elements_chain:(c=p,function(t){return t.map((t=>{var e,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=i({},t.text?{text:t.text}:{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e: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 Hi(o).sort(((t,e)=>{var[i]=t,[r]=e;return i.localeCompare(r)})).forEach((t=>{var[e,i]=t;return a[ho(e.toString())]=ho(i.toString())})),(s+=":")+Hi(a).map((t=>{var[e,i]=t;return e+'="'+i+'"'})).join("")})).join(";")}(function(t){return t.map((t=>{var e,i,r={text:null==(e=t.$el_text)?void 0:e.slice(0,400),tag_name:t.tag_name,href:null==(i=t.attr__href)?void 0:i.slice(0,2048),attr_class:vo(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Hi(t).filter((t=>{var[e]=t;return 0===e.indexOf("attr__")})).forEach((t=>{var[e,i]=t;return r.attributes[e]=i})),r}))}(c)))},null!=(r=p[0])&&r.$el_text?{$el_text:null==(s=p[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},f)}}var bo=Ni("[ExceptionAutocapture]");function yo(t,e,i){try{if(!(e in t))return()=>{};var r=t[e],s=i(r);return Dt(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=s,()=>{t[e]=r}}catch(t){return()=>{}}}var wo=Ni("[TracingHeaders]"),xo=Ni("[Web Vitals]"),Eo=9e5,So="disabled",$o="lazy_loading",To="awaiting_config",ko="missing_config";Ni("[SessionRecording]"),Ni("[SessionRecording]");var Ro="[SessionRecording]",Po=Ni(Ro),Oo=Ni("[Heatmaps]");function Io(t){return Lt(t)&&"clientX"in t&&"clientY"in t&&qt(t.clientX)&&qt(t.clientY)}var Co=Ni("[Product Tours]"),Fo=["$set_once","$set"],Ao=Ni("[SiteApps]"),Mo="Error while initializing PostHog app with config id ";function Do(t,e,i){if(Ht(t))return!1;switch(i){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch(t){return!1}default:return!1}}class Lo{constructor(t){this.dn=new Zs,this.vn=(t,e)=>this.fn(t,e)&&this.pn(t,e)&&this.gn(t,e)&&this.mn(t,e),this.fn=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t,this.yn=new Set,this.bn=new Set}init(){var t,e;Nt(null==(t=this._instance)?void 0:t._addCaptureHook)||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.on(t,e)})))}register(t){var e,i;if(!Nt(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e,i;null==(e=this.bn)||e.add(t),null==(i=t.steps)||i.forEach((t=>{var e;null==(e=this.yn)||e.add((null==t?void 0:t.event)||"")}))})),null!=(i=this._instance)&&i.autocapture)){var r,s=new Set;t.forEach((t=>{var e;null==(e=t.steps)||e.forEach((t=>{null!=t&&t.selector&&s.add(null==t?void 0:t.selector)}))})),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(t,e){var i;null!=e&&0!=t.length&&(this.yn.has(t)||this.yn.has(null==e?void 0:e.event))&&this.bn&&(null==(i=this.bn)?void 0:i.size)>0&&this.bn.forEach((t=>{this._n(e,t)&&this.dn.emit("actionCaptured",t.name)}))}wn(t){this.onAction("actionCaptured",(e=>t(e)))}_n(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.vn(t,i))return!0;return!1}onAction(t,e){return this.dn.on(t,e)}pn(t,e){if(null!=e&&e.url){var i,r=null==t||null==(i=t.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!Do(r,e.url,e.url_matching||"contains"))return!1}return!0}gn(t,e){return!!this.In(t,e)&&!!this.Cn(t,e)&&!!this.Sn(t,e)}In(t,e){var i;if(null==e||!e.href)return!0;var r=this.xn(t);if(r.length>0)return r.some((t=>Do(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Do((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}Cn(t,e){var i;if(null==e||!e.text)return!0;var r=this.xn(t);if(r.length>0)return r.some((t=>Do(t.text,e.text,e.text_matching||"exact")||Do(t.$el_text,e.text,e.text_matching||"exact")));var s,n,o,a=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!a&&(s=function(t){for(var e,i=[],r=/(?::|")text="(.*?)"/g;!Ht(e=r.exec(t));)i.includes(e[1])||i.push(e[1]);return i}(a),n=e.text,o=e.text_matching||"exact",s.some((t=>Do(t,n,o))))}Sn(t,e){var i,r;if(null==e||!e.selector)return!0;var s=null==t||null==(i=t.properties)?void 0:i.$element_selectors;if(null!=s&&s.includes(e.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(e.selector_regex&&n)try{return new RegExp(e.selector_regex).test(n)}catch(t){return!1}return!1}xn(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}mn(t,e){return null==e||!e.properties||0===e.properties.length||ln(e.properties.reduce(((t,e)=>{var i=Mt(e.value)?e.value.map(String):null!=e.value?[String(e.value)]:[];return t[e.key]={values:i,operator:e.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class Uo{constructor(t){this._instance=t,this.kn=new Map,this.Tn=new Map,this.An=new Map}En(t,e){return!!t&&ln(t.propertyFilters,null==e?void 0:e.properties)}Rn(t,e){var i=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[e])||null==(r=r.values)||r.forEach((e=>{if(null!=e&&e.name){var r=i.get(e.name)||[];r.push(t.id),i.set(e.name,r)}}))})),i}Nn(t,e,i){var r=(i===Gr.Activation?this.kn:this.Tn).get(t),s=[];return this.Mn((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[i])||null==(s=s.values)?void 0:s.find((e=>e.name===t));return this.En(n,e)}))}register(t){var e;Nt(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.Fn(t),this.On(t))}On(t){var e=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.actions)&&(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0}));0!==e.length&&(null==this.Pn&&(this.Pn=new Lo(this._instance),this.Pn.init(),this.Pn.wn((t=>{this.onAction(t)}))),e.forEach((t=>{var e,i,r,s,n;t.conditions&&null!=(e=t.conditions)&&e.actions&&null!=(i=t.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=t.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.Pn)||s.register(t.conditions.actions.values),null==(n=t.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach((e=>{if(e&&e.name){var i=this.An.get(e.name);i&&i.push(t.id),this.An.set(e.name,i||[t.id])}})))})))}Fn(t){var e,i=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.events)&&(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0})),r=t.filter((t=>{var e,i;return(null==(e=t.conditions)?void 0:e.cancelEvents)&&(null==(i=t.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0}));0===i.length&&0===r.length||(null==(e=this._instance)||e._addCaptureHook(((t,e)=>{this.onEvent(t,e)})),this.kn=this.Rn(t,Gr.Activation),this.Tn=this.Rn(t,Gr.Cancellation))}onEvent(t,e){var i,r=this.ue(),s=this.Ln(),n=this.Dn(),o=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[s])||[];if(n===t&&e&&o.length>0){var a,l;r.info("event matched, removing item from activated items",{event:t,eventPayload:e,existingActivatedItems:o});var u=(null==e||null==(a=e.properties)?void 0:a.$survey_id)||(null==e||null==(l=e.properties)?void 0:l.$product_tour_id);if(u){var h=o.indexOf(u);0>h||(o.splice(h,1),this.Bn(o))}}else{if(this.Tn.has(t)){var d=this.Nn(t,e,Gr.Cancellation);d.length>0&&(r.info("cancel event matched, cancelling items",{event:t,itemsToCancel:d.map((t=>t.id))}),d.forEach((t=>{var e=o.indexOf(t.id);0>e||o.splice(e,1),this.jn(t.id)})),this.Bn(o))}if(this.kn.has(t)){r.info("event name matched",{event:t,eventPayload:e,items:this.kn.get(t)});var v=this.Nn(t,e,Gr.Activation);this.Bn(o.concat(v.map((t=>t.id))||[]))}}}onAction(t){var e,i=this.Ln(),r=(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[i])||[];this.An.has(t)&&this.Bn(r.concat(this.An.get(t)||[]))}Bn(t){var e=this.ue(),i=[...new Set(t)].filter((t=>!this.$n(t)));e.info("updating activated items",{activatedItems:i}),this.qn(i)}getActivatedIds(){var t,e=this.Ln();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}getEventToItemsMap(){return this.kn}Zn(){return this.Pn}}class No extends Uo{constructor(t){super(t)}Ln(){return U}Dn(){return Jr.SHOWN}Mn(t){var e;null==(e=this._instance)||e.getSurveys(t)}jn(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}ue(){return cn}qn(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[U]:t})}$n(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var jo="SDK is not enabled or survey functionality is not yet loaded",zo="Disabled. Not loading surveys.",Bo=null!=pt&&pt.location?Pr(pt.location.hash,"__posthog")||Pr(location.hash,"state"):null,Ho="_postHogToolbarParams",qo=Ni("[Toolbar]"),Vo=Ni("[FeatureFlags]"),Wo=Ni("[FeatureFlags]",{debugEnabled:!0}),Go="\" failed. Feature flags didn't load in time.",Yo=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},Jo=t=>{var e={};for(var[i,r]of Hi(t||{}))r&&(e[i]=r);return e},Ko=Ni("[Error tracking]"),Xo="Refusing to render web experiment since the viewer is a likely bot",Qo={icontains:(t,e)=>!!pt&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!pt&&-1===e.href.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>!!pt&&sn(e.href,t),not_regex:(t,e)=>!!pt&&!sn(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class Zo{get Lt(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{Zo.Hn("retrieved web experiments from the server"),e.Vn=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.Vn&&(Zo.Hn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.Vn)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);jt(r)&&t.variants[r]&&e.zn(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Zo.Un(n)&&e.zn(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Zo.Hn(Xo);else if(!this.Lt.disable_web_experiments){if(Ht(this.Vn))return this.Vn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Zo.Hn("applying feature flags",t),t.forEach((t=>{var e;if(this.Vn&&null!=(e=this.Vn)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.Vn)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.zn(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Zo.getWindowLocation();if(null!=t&&t.search){var e=kr(null==t?void 0:t.search,"__experiment_id"),i=kr(null==t?void 0:t.search,"__experiment_variant");e&&i&&(Zo.Hn("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.Yn(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.Lt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Lt.disable_web_experiments&&!i)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Lt.token),method:"GET",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Yn(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(Zo.Hn("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.zn(r[0].name,e,r[0].variants[e].transforms))}static Un(t){return!Ht(t.conditions)&&Zo.Wn(t)&&Zo.Gn(t)}static Wn(t){var e;if(Ht(t.conditions)||Ht(null==(e=t.conditions)?void 0:e.url))return!0;var i,r,s,n=Zo.getWindowLocation();return!!n&&(null==(i=t.conditions)||!i.url||Qo[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==pt?void 0:pt.location}static Gn(t){var e;if(Ht(t.conditions)||Ht(null==(e=t.conditions)?void 0:e.utm))return!0;var i=Mr();if(i.utm_source){var r,s,n,o,a,l,u,h,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==i.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,p=null==(u=t.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=t.conditions)||null==(h=h.utm)?void 0:h.utm_term)==i.utm_term;return d&&c&&p&&v}return!1}static Hn(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];Ui.info("[WebExperiments] "+t,i)}zn(t,e,i){this._is_bot()?Zo.Hn(Xo):"control"!==e?i.forEach((i=>{if(i.selector){var r;Zo.Hn("applying transform of variant "+e+" for experiment "+t+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((t=>{var e=t;i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)}))}})):Zo.Hn("Control variants leave the page unmodified.")}_is_bot(){return _t&&this._instance?rn(_t,this.Lt.custom_blocked_useragents):void 0}}var ta=Ni("[Conversations]"),ea="Conversations not available yet.",ia={featureFlags:class{constructor(t){this.Xn=!1,this.Jn=!1,this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Lt(){return this._instance.config}get ii(){return this._instance.persistence}ss(t){return this._instance.get_property(t)}os(){var t,e;return null!==(t=null==(e=this.ii)?void 0:e._r(this.Lt.feature_flag_cache_ttl_ms))&&void 0!==t&&t}ls(){return!!this.os()&&(this.ns||this.Kn||(this.ns=!0,Vo.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}us(){var t,e=null!==(t=this.Lt.evaluation_contexts)&&void 0!==t?t:this.Lt.evaluation_environments;return!this.Lt.evaluation_environments||this.Lt.evaluation_contexts||this.rs||(Vo.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.rs=!0),null!=e&&e.length?e.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||Vo.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}hs(){return this.us().length>0}initialize(){var t,e,{config:i}=this._instance,r=null!==(t=null==(e=i.bootstrap)?void 0:e.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,e)=>(t[e]=r[e]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,e)=>(o[e]&&(t[e]=o[e]),t)),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,e,r){var s=null!=r&&r.merge?this.getFlagVariants():{},n=null!=r&&r.merge?this.getFlagPayloads():{},o=i({},s,t),a=i({},n,e),l={};for(var[u,h]of Object.entries(o)){var d="string"==typeof h;l[u]={key:u,enabled:!!d||Boolean(h),variant:d?h:void 0,reason:void 0,metadata:Nt(null==a?void 0:a[u])?void 0:{id:0,version:void 0,description:void 0,payload:a[u]}}}this.receivedFeatureFlags({flags:l})}get hasLoadedFlags(){return this.Jn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.ss(O),e=this.ss(F),r=this.ss(A);if(!r&&!e)return t||{};var s=Bi({},t||{}),n=[...new Set([...Object.keys(r||{}),...Object.keys(e||{})])];for(var o of n){var a,l,u=s[o],h=null==e?void 0:e[o],d=Nt(h)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!h,v=Nt(h)?u.variant:"string"==typeof h?h:void 0,c=null==r?void 0:r[o],p=i({},u,{enabled:d,variant:d?null!=v?v:null==u?void 0:u.variant:void 0});d!==(null==u?void 0:u.enabled)&&(p.original_enabled=null==u?void 0:u.enabled),v!==(null==u?void 0:u.variant)&&(p.original_variant=null==u?void 0:u.variant),c&&(p.metadata=i({},null==u?void 0:u.metadata,{payload:c,original_payload:null==u||null==(l=u.metadata)?void 0:l.payload})),s[o]=p}return this.Xn||(Vo.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.Xn=!0),s}getFlagVariants(){var t=this.ss(k),e=this.ss(F);if(!e)return t||{};for(var i=Bi({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Xn||(Vo.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Xn=!0),i}getFlagPayloads(){var t=this.ss(I),e=this.ss(A);if(!e)return t||{};for(var i=Bi({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Xn||(Vo.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Xn=!0),i}reloadFeatureFlags(){this.Qn||this.Lt.advanced_disable_feature_flags||this.cs||(this._instance.Mi.emit("featureFlagsReloading",!0),this.cs=setTimeout((()=>{this.ds()}),5))}vs(){clearTimeout(this.cs),this.cs=void 0}ensureFlagsLoaded(){this.Jn||this.Kn||this.cs||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Qn=t}ds(t){var e;if(this.vs(),!this._instance.Mr())if(this.Kn)this.es=!0;else{var r=this.Lt.token,s=this.ss(a),n={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:i({},(null==(e=this.ii)?void 0:e.get_initial_props())||{},this.ss(M)||{}),group_properties:this.ss(D),timezone:Hr()};Bt(s)||Nt(s)||(n.$device_id=s),(null!=t&&t.disableFlags||this.Lt.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.hs()&&(n.evaluation_contexts=this.us());var o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Lt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Kn=!0,this._instance._send_request({method:"POST",url:o,data:n,compression:this.Lt.disable_compression?void 0:ss.Base64,timeout:this.Lt.feature_flag_request_timeout_ms,callback:t=>{var e,i,r,s=!0;if(200===t.statusCode&&(this.es||(this.$anon_distinct_id=void 0),s=!1),this.Kn=!1,!n.disable_flags||this.es){this.ts=!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!=(e=t.json)&&e.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var a,l=!(null==(i=t.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(l&&o.push("quota_limited"),null==(r=this.ii)||r.register({[B]:o}),l)Vo.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,{partialResponse:!!this.Lt.advanced_only_evaluate_survey_feature_flags}),this.es&&(this.es=!1,this.ds())}}})}}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.ts)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var r=this.getFeatureFlagResult(t,e);return null!==(i=null==r?void 0:r.variant)&&void 0!==i?i:null==r?void 0:r.enabled}}else Vo.warn('getFeatureFlag for key "'+t+Go)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return null==e?void 0:e.payload}getFeatureFlagResult(t,e){if(void 0===e&&(e={}),!e.fresh||this.ts)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],o=String(s),a=this.ss(C)||void 0,l=this.ss(H)||void 0,u=this.ss(j)||{};if(this.Lt.advanced_feature_flags_dedup_per_session){var h,d=this._instance.get_session_id(),v=this.ss(z);d&&d!==v&&(u={},null==(h=this.ii)||h.register({[j]:u,[z]:d}))}if((e.send_event||!("send_event"in e))&&(!(t in u)||!u[t].includes(o))){var c,p,f,_,g,m,b,y,w,x;Mt(u[t])?u[t].push(o):u[t]=[o],null==(c=this.ii)||c.register({[j]:u});var E=this.getFeatureFlagDetails(t),S=[...null!==(p=this.ss(B))&&void 0!==p?p:[]];Nt(s)&&S.push("flag_missing");var T={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(f=this.Lt.bootstrap)||null==(f=f.featureFlags)?void 0:f[t])||null,$feature_flag_bootstrapped_payload:(null==(_=this.Lt.bootstrap)||null==(_=_.featureFlagPayloads)?void 0:_[t])||null,$used_bootstrap_value:!this.ts};Nt(null==E||null==(g=E.metadata)?void 0:g.version)||(T.$feature_flag_version=E.metadata.version);var k,R=null!==(m=null==E||null==(b=E.reason)?void 0:b.description)&&void 0!==m?m:null==E||null==(y=E.reason)?void 0:y.code;R&&(T.$feature_flag_reason=R),null!=E&&null!=(w=E.metadata)&&w.id&&(T.$feature_flag_id=E.metadata.id),Nt(null==E?void 0:E.original_variant)&&Nt(null==E?void 0:E.original_enabled)||(T.$feature_flag_original_response=Nt(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(x=E.metadata)&&x.original_payload&&(T.$feature_flag_original_payload=null==E||null==(k=E.metadata)?void 0:k.original_payload),S.length&&(T.$feature_flag_error=S.join(",")),this._instance.capture("$feature_flag_called",T)}if(r){var P=n;if(!Nt(n))try{P=JSON.parse(n)}catch(t){}return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:P}}}}else Vo.warn('getFeatureFlagResult for key "'+t+Go)}getRemoteConfigPayload(t,e){var i=this.Lt.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.hs()&&(r.evaluation_contexts=this.us()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Lt.disable_compression?void 0:ss.Base64,timeout:this.Lt.feature_flag_request_timeout_ms,callback(i){var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;e((null==s?void 0:s[t])||void 0)}})}isFeatureEnabled(t,e){if(void 0===e&&(e={}),!e.fresh||this.ts){if(this.Jn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(t,e);return Nt(i)?void 0:!!i}Vo.warn('isFeatureEnabled for key "'+t+Go)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,r){if(this.ii){this.Jn=!0;var s=this.getFlagVariants(),n=this.getFlagPayloads(),o=this.getFlagsWithDetails();!function(t,e,r,s,n,o){void 0===r&&(r={}),void 0===s&&(s={}),void 0===n&&(n={});var a=(t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return null==(i=e[t].metadata)?void 0:i.payload})).map((t=>{var i;return[t,null==(i=e[t].metadata)?void 0:i.payload]})))):Vo.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t),l=a.flags,u=a.featureFlags,h=a.featureFlagPayloads;if(u){var d=t.requestId,v=t.evaluatedAt;if(Mt(u)){Vo.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(u)for(var p=0;u.length>p;p++)c[u[p]]=!0;e&&e.register({[R]:u,[k]:c})}else{var f=u,_=h,g=l;if(null!=o&&o.partialResponse)f=i({},r,f),_=i({},s,_),g=i({},n,g);else if(t.errorsWhileComputingFlags)if(l){var m=new Set(Object.keys(l).filter((t=>{var e;return!(null!=(e=l[t])&&e.failed)})));f=i({},r,Object.fromEntries(Object.entries(f).filter((t=>{var[e]=t;return m.has(e)})))),_=i({},s,Object.fromEntries(Object.entries(_||{}).filter((t=>{var[e]=t;return m.has(e)})))),g=i({},n,Object.fromEntries(Object.entries(g||{}).filter((t=>{var[e]=t;return m.has(e)}))))}else f=i({},r,f),_=i({},s,_),g=i({},n,g);e&&e.register(i({[R]:Object.keys(Jo(f)),[k]:f||{},[I]:_||{},[O]:g||{}},d?{[C]:d}:{},v?{[H]:v}:{}))}}}(t,this.ii,s,n,o,r),e||(this.ns=!1),this.fs(e)}}override(t,e){void 0===e&&(e=!1),Vo.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.ii)return Vo.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.ii.unregister(F),this.ii.unregister(A),this.fs(),Wo.info("All overrides cleared");if(Mt(t)){var e=Yo(t);return this.ii.register({[F]:e}),this.fs(),Wo.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,r=t;if(this.Xn=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.ii.unregister(F),Wo.info("Flag overrides cleared");else if(r.flags){if(Mt(r.flags)){var s=Yo(r.flags);this.ii.register({[F]:s})}else this.ii.register({[F]:r.flags});Wo.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.ii.unregister(A),Wo.info("Payload overrides cleared")):r.payloads&&(this.ii.register({[A]:r.payloads}),Wo.info("Payload overrides set",{payloads:r.payloads}))),void this.fs()}if(t&&"object"==typeof t)return this.ii.register({[F]:t}),this.fs(),Wo.info("Flag overrides set",{flags:t});Vo.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Jn){var{flags:e,flagVariants:i}=this.ps();t(e,i)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var s,n=(this.ss(P)||[]).find((e=>e.flagKey===t)),o={["$feature_enrollment/"+t]:e},a={$feature_flag:t,$feature_enrollment:e,$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=i({},this.getFlagVariants(),{[t]:e});null==(s=this.ii)||s.register({[R]:Object.keys(Jo(l)),[k]:l}),this.fs()}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.ss(P),s=i?"&"+i.map((t=>"stage="+t)).join("&"):"";if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Lt.token+s),method:"GET",callback:e=>{var i,r;if(e.json){var s=e.json.earlyAccessFeatures;return null==(i=this.ii)||i.unregister(P),null==(r=this.ii)||r.register({[P]:s}),t(s)}}})}ps(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,i)=>(t[i]=e[i],t)),{})}}fs(t){var{flags:e,flagVariants:i}=this.ps();this.featureFlagEventHandlers.forEach((r=>r(e,i,{errorsLoading:t})))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.ss(M)||{},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({[M]:i({},r,o,s)}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(M)}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.ss(D)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((e=>{r[e]=i({},r[e],t[e]),delete t[e]})),this._instance.register({[D]:i({},r,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.ss(D)||{};this._instance.register({[D]:i({},e,{[t]:{}})})}else this._instance.unregister(D)}reset(){this.Jn=!1,this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.$anon_distinct_id=void 0,this.vs(),this.Xn=!1}}},ra={sessionRecording:class{get Lt(){return this._instance.config}get ii(){return this._instance.persistence}get started(){var t;return!(null==(t=this.gs)||!t.isStarted)}get status(){var t,e;return this.ys===To||this.ys===ko?this.ys:null!==(t=null==(e=this.gs)?void 0:e.status)&&void 0!==t?t:this.ys}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.ys=So,this.bs=void 0,this._instance=t,!this._instance.sessionManager)throw Po.error("started without valid sessionManager"),new Error(Ro+" started without valid sessionManager. This is a bug.");if(this.Lt.cookieless_mode===st)throw new Error(Ro+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _s(){var t,e=!(null==(t=this._instance.get_property(b))||!t.enabled),i=!this.Lt.disable_session_recording,r=this.Lt.disable_session_recording||this._instance.consent.isOptedOut();return pt&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!this._s||null==(e=this.gs)||!e.isStarted){var i=!Nt(Object.assign)&&!Nt(Array.from);this._s&&i?(this.ws(t),Po.info("starting")):(this.ys=So,this.stopRecording())}}ws(t){var e,i,r;this._s&&(this.ys!==To&&this.ys!==ko&&(this.ys=$o),null!=St&&null!=(e=St.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=St.__PosthogExtensions__)&&i.initSessionRecording?this.Is(t):null==(r=St.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Cs,(e=>{if(e)return Po.error("could not load recorder",e);this.Is(t)})))}stopRecording(){var t,e;null==(t=this.bs)||t.call(this),this.bs=void 0,null==(e=this.gs)||e.stop()}Ss(){var t,e;null==(t=this.bs)||t.call(this),this.bs=void 0,null==(e=this.gs)||e.discard()}xs(){var t;null==(t=this.ii)||t.unregister(T)}ks(t,e){if(Ht(t))return null;var i,r=qt(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(Po.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Ts(t){if(this.ii){var e,r,s=this.ii,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.ks(null==(e=this.Lt.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),o=this.ks(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;Ht(a)&&this.xs();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[b]:i({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:i({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:Nt(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,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};n(),null==(e=this.bs)||e.call(this),this.bs=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.Ts(t),void this.Ss()):(this.Ts(t),void this.startIfEnabledOrStop()):(this.ys===To&&(this.ys=ko,Po.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var i;void 0===e&&(e="log"),null!=(i=this.gs)&&i.log?this.gs.log(t,e):Po.warn("log called before recorder was ready")}get Cs(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(b);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}As(){var t,e=this._instance.get_property(b);if(!e)return!1;var i=null!==(t=("object"==typeof e?e:JSON.parse(e)).cache_timestamp)&&void 0!==t?t:Date.now();return 36e5>=Date.now()-i}Is(t){var e,i;if(null==(e=St.__PosthogExtensions__)||!e.initSessionRecording)return Po.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[et]:!0});if(this.gs||(this.gs=null==(i=St.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.gs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.As()){if(this.ys===ko||this.ys===To)return;return this.ys=To,Po.info("persisted remote config is stale, requesting fresh config before starting"),void new rs(this._instance).load()}this.ys=$o,this.gs.start(t)}onRRwebEmit(t){var e;null==(e=this.gs)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.gs||null==(e=this.ii)||e.register({[w]:!0}),null==(t=this.gs)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.gs||null==(e=this.ii)||e.register({[y]:!0}),null==(t=this.gs)||t.overrideSampling()}overrideTrigger(t){var e,i;this.gs||null==(i=this.ii)||i.register({["url"===t?x:E]:!0}),null==(e=this.gs)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.gs)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.gs)||!i.tryAddCustomEvent(t,e))}}},sa={autocapture:class{constructor(t){this.Es=!1,this.Rs=null,this.Ns=!1,this.instance=t,this.rageclicks=new co(t.config.rageclick),this.Ms=null}initialize(){this.startIfEnabled()}get Lt(){var t,e,i=Lt(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(t=i.url_allowlist)?void 0:t.map((t=>new RegExp(t))),i.url_ignorelist=null==(e=i.url_ignorelist)?void 0:e.map((t=>new RegExp(t))),i}Fs(){if(this.isBrowserSupported()){if(pt&>){var t=t=>{t=t||(null==pt?void 0:pt.event);try{this.Os(t)}catch(t){fo.error("Failed to capture event",t)}};if(Ji(gt,"submit",t,{capture:!0}),Ji(gt,"change",t,{capture:!0}),Ji(gt,"click",t,{capture:!0}),this.Lt.capture_copied_text){var e=t=>{this.Os(t=t||(null==pt?void 0:pt.event),po)};Ji(gt,"copy",e,{capture:!0}),Ji(gt,"cut",e,{capture:!0})}}}else fo.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Es&&(this.Fs(),this.Es=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Ns=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[h]:!!t.autocapture_opt_out}),this.Rs=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Ms=t}getElementSelectors(t){var e,i=[];return null==(e=this.Ms)||e.forEach((e=>{var r=null==gt?void 0:gt.querySelectorAll(e);null==r||r.forEach((r=>{t===r&&i.push(e)}))})),i}get isEnabled(){var t,e,i=null==(t=this.instance.persistence)?void 0:t.props[h];if(Bt(this.Rs)&&!Wt(i)&&!this.instance.Mr())return!1;var r=null!==(e=this.Rs)&&void 0!==e?e:!!i;return!!this.instance.config.autocapture&&!r}Os(t,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var i,r=Vn(t);Un(r)&&(r=r.parentNode||null),"$autocapture"===e&&"click"===t.type&&t instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(t.clientX,t.clientY,t.timeStamp||(new Date).getTime())&&function(t,e){if(!pt||Xn(t))return!1;var i,r,s;if(Wt(e)?(i=!!e&&Kn,r=void 0):(i=null!==(s=null==e?void 0:e.css_selector_ignorelist)&&void 0!==s?s:Kn,r=null==e?void 0:e.content_ignorelist),!1===i)return!1;var{targetElementList:n}=Qn(t,!1);return!function(t,e){if(!1===t||Nt(t))return!1;var i;if(!0===t)i=Jn;else{if(!Mt(t))return!1;if(t.length>10)return Ui.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=t.map((t=>t.toLowerCase()))}return e.some((t=>{var{safeText:e,ariaLabel:r}=t;return i.some((t=>e.includes(t)||r.includes(t)))}))}(r,n.map((t=>{var e;return{safeText:qn(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!Gn(n,i)}(r,this.instance.config.rageclick)&&this.Os(t,"$rageclick");var s=e===po;if(r&&function(t,e,i,r,s){var n,o,a,l;if(void 0===i&&(i=void 0),!pt||Xn(t))return!1;if(null!=(n=i)&&n.url_allowlist&&!zn(i.url_allowlist))return!1;if(null!=(o=i)&&o.url_ignorelist&&zn(i.url_ignorelist))return!1;if(null!=(a=i)&&a.dom_event_allowlist){var u=i.dom_event_allowlist;if(u&&!u.some((t=>e.type===t)))return!1}var{parentIsUsefulElement:h,targetElementList:d}=Qn(t,r);if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(Nt(i))return!0;var r,s=function(t){if(i.some((e=>t.tagName.toLowerCase()===e)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(d,i))return!1;if(!Gn(d,null==(l=i)?void 0:l.css_selector_allowlist))return!1;var v=pt.getComputedStyle(t);if(v&&"pointer"===v.getPropertyValue("cursor")&&"click"===e.type)return!0;var c=t.tagName.toLowerCase();switch(c){case"html":return!1;case"form":return(s||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(e.type)>=0;default:return h?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(Wn.indexOf(c)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,this.Lt,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=mo(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Lt.element_attribute_ignorelist,elementsChainAsString:this.Ns});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(n.$element_selectors=a),e===po){var l,u=Hn(null==pt||null==(l=pt.getSelection())?void 0:l.toString()),h=t.type||"clipboard";if(!u)return!1;n.$selected_content=u,n.$copy_type=h}return this.instance.capture(e,n),!0}}}isBrowserSupported(){return Dt(null==gt?void 0:gt.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.Ps=(null==pt||null==(e=pt.location)?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(Ui.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ls&&this.Ls(),this.Ls=void 0,Ui.info("History API monitoring stopped")}monitorHistoryChanges(){var t,e;if(pt&&pt.history){var i=this;null!=(t=pt.history.pushState)&&t.__posthog_wrapped__||yo(pt.history,"pushState",(t=>function(e,r,s){t.call(this,e,r,s),i.Ds("pushState")})),null!=(e=pt.history.replaceState)&&e.__posthog_wrapped__||yo(pt.history,"replaceState",(t=>function(e,r,s){t.call(this,e,r,s),i.Ds("replaceState")})),this.Bs()}}Ds(t){try{var e,i=null==pt||null==(e=pt.location)?void 0:e.pathname;if(!i)return;i!==this.Ps&&this.isEnabled&&this._instance.capture(ht,{navigation_type:t}),this.Ps=i}catch(e){Ui.error("Error capturing "+t+" pageview",e)}}Bs(){if(!this.Ls){var t=()=>{this.Ds("popstate")};Ji(pt,"popstate",t),this.Ls=()=>{pt&&pt.removeEventListener("popstate",t)}}}},heatmaps:class{get Lt(){return this.instance.config}constructor(t){var e;this.js=!1,this.Es=!1,this.$s=null,this.instance=t,this.js=!(null==(e=this.instance.persistence)||!e.props[d]),this.rageclicks=new co(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return Lt(this.Lt.capture_heatmaps)&&this.Lt.capture_heatmaps.flush_interval_milliseconds&&(t=this.Lt.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Ht(this.Lt.capture_heatmaps)?Ht(this.Lt.enable_heatmaps)?this.js:this.Lt.enable_heatmaps:!1!==this.Lt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Es)return;Oo.info("starting..."),this.qs(),this.Ot()}else{var t;clearInterval(null!==(t=this.$s)&&void 0!==t?t:void 0),this.Zs(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[d]:e}),this.js=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.T;return this.T=void 0,t}Hs(t){this.At(t.originalEvent,"deadclick")}Ot(){this.$s&&clearInterval(this.$s),this.$s="visible"===(null==gt?void 0:gt.visibilityState)?setInterval(this.Ur.bind(this),this.flushIntervalMilliseconds):null}qs(){pt&>&&(this.Vs=this.Ur.bind(this),Ji(pt,ut,this.Vs),this.zs=t=>this.At(t||(null==pt?void 0:pt.event)),Ji(gt,"click",this.zs,{capture:!0}),this.Us=t=>this.Ys(t||(null==pt?void 0:pt.event)),Ji(gt,"mousemove",this.Us,{capture:!0}),this.Ws=new mr(this.instance,_r,this.Hs.bind(this)),this.Ws.startIfEnabledOrStop(),this.Gs=this.Ot.bind(this),Ji(gt,lt,this.Gs),this.Es=!0)}Zs(){var t;pt&>&&(this.Vs&&pt.removeEventListener(ut,this.Vs),this.zs&>.removeEventListener("click",this.zs,{capture:!0}),this.Us&>.removeEventListener("mousemove",this.Us,{capture:!0}),this.Gs&>.removeEventListener(lt,this.Gs),clearTimeout(this.Xs),null==(t=this.Ws)||t.stop(),this.Es=!1)}Js(t,e){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(t,e,i){for(var r=t;r&&Dn(r)&&!Ln(r,"body");){if(r===i)return!1;if(Pt(e,null==pt?void 0:pt.getComputedStyle(r).position))return!0;r=Yn(r)}return!1}(Vn(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:i),target_fixed:n,type:e}}At(t,e){var r;if(void 0===e&&(e="click"),!Mn(t.target)&&Io(t)){var s=this.Js(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&this.Ks(i({},s,{type:"rageclick"})),this.Ks(s)}}Ys(t){!Mn(t.target)&&Io(t)&&(clearTimeout(this.Xs),this.Xs=setTimeout((()=>{this.Ks(this.Js(t,"mousemove"))}),500))}Ks(t){if(pt){var e=pt.location.href,i=this.Lt.custom_personal_data_properties,r=this.Lt.mask_personal_data_properties?[...Ir,...i||[]]:[],s=Rr(e,r,Fr);this.T=this.T||{},this.T[s]||(this.T[s]=[]),this.T[s].push(t)}}Ur(){this.T&&!Ut(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:mr,webVitalsAutocapture:class{constructor(t){var e;this.js=!1,this.Es=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Qs=()=>{clearTimeout(this.eo),0!==this.T.metrics.length&&(this._instance.capture("$web_vitals",this.T.metrics.reduce(((t,e)=>i({},t,{["$web_vitals_"+e.name+"_event"]:i({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.dt=t=>{var e,r=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);if(Nt(r))xo.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.ro();Nt(s)||(Ht(null==t?void 0:t.name)||Ht(null==t?void 0:t.value)?xo.error("Invalid metric received",t):!this.io||this.io>t.value?(this.T.url!==s&&(this.Qs(),this.eo=setTimeout(this.Qs,this.flushToCaptureTimeoutMs)),Nt(this.T.url)&&(this.T.url=s),this.T.firstMetricTimestamp=Nt(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0),this.T.metrics.push(i({},t,{$current_url:s,$session_id:r.sessionId,$window_id:r.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.Qs()):xo.error("Ignoring metric with value >= "+this.io,t))}},this.no=()=>{if(!this.Es){var t,e,i,r,s=St.__PosthogExtensions__;Nt(s)||Nt(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:e,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),t&&e&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.dt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&e(this.dt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.dt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.dt.bind(this)),this.Es=!0):xo.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.js=!(null==(e=this._instance.persistence)||!e.props[f]),this.startIfEnabled()}get so(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=Lt(this.so)?null==(t=this.so)?void 0:t.web_vitals_allowed_metrics:void 0;return Ht(i)?(null==(e=this._instance.persistence)?void 0:e.props[m])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(Lt(this.so)?this.so.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=Lt(this.so)?this.so.web_vitals_attribution:void 0;return null!=t&&t}get io(){var t=Lt(this.so)&&qt(this.so.__web_vitals_max_value)?this.so.__web_vitals_max_value:Eo;return t>0&&6e4>=t?Eo:t}get isEnabled(){var t=null==mt?void 0:mt.protocol;if("http:"!==t&&"https:"!==t)return xo.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=Lt(this.so)?this.so.web_vitals:Wt(this.so)?this.so:void 0;return Wt(e)?e:this.js}startIfEnabled(){this.isEnabled&&!this.Es&&(xo.info("enabled, starting..."),this.lr(this.no))}onRemoteConfig(t){if("capturePerformance"in t){var e=Lt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=Lt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[f]:e}),this._instance.persistence.register({[m]:i})),this.js=e,this.startIfEnabled()}}lr(t){var e,i;null!=(e=St.__PosthogExtensions__)&&e.postHogWebVitalsCallbacks?t():null==(i=St.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(e=>{e?xo.error("failed to load script",e):t()}))}ro(){var t=pt?pt.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...Ir,...e||[]]:[];return Rr(t,i,Fr)}xo.error("Could not determine current URL")}}},na={exceptionObserver:class{constructor(t){var e,i,r;this.no=()=>{var t;if(pt&&this.isEnabled&&null!=(t=St.__PosthogExtensions__)&&t.errorWrappingFunctions){var e=St.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=St.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=St.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.oo&&this.Lt.capture_unhandled_errors&&(this.oo=e(this.captureException.bind(this))),!this.ao&&this.Lt.capture_unhandled_rejections&&(this.ao=i(this.captureException.bind(this))),!this.lo&&this.Lt.capture_console_errors&&(this.lo=r(this.captureException.bind(this)))}catch(t){bo.error("failed to start",t),this.uo()}}},this._instance=t,this.ho=!(null==(e=this._instance.persistence)||!e.props[v]),this.co=new ie({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10,refillInterval:1e4,Yt:bo}),this.Lt=this.do(),this.startIfEnabledOrStop()}do(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Lt(t)?e=i({},e,t):(Nt(t)?this.ho:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Lt.capture_console_errors||this.Lt.capture_unhandled_errors||this.Lt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(bo.info("enabled"),this.uo(),this.lr(this.no)):this.uo()}lr(t){var e,i;null!=(e=St.__PosthogExtensions__)&&e.errorWrappingFunctions&&t(),null==(i=St.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return bo.error("failed to load script",e);t()}))}uo(){var t,e,i;null==(t=this.oo)||t.call(this),this.oo=void 0,null==(e=this.ao)||e.call(this),this.ao=void 0,null==(i=this.lo)||i.call(this),this.lo=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.ho=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[v]:this.ho}),this.Lt=this.do(),this.startIfEnabledOrStop())}onConfigChange(){this.Lt=this.do()}captureException(t){var e,i,r,s=null!==(e=null==t||null==(i=t.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==e?e:"Exception";this.co.consumeRateLimit(s)?bo.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,r;this.vo=[],this.fo=new ai([new bi,new Pi,new wi,new yi,new ki,new Ti,new Ei,new Ri],function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),s=1;e>s;s++)r[s-1]=arguments[s];return function(e,s){void 0===s&&(s=0);for(var n=[],o=e.split("\n"),a=s;o.length>a;a++){var l=o[a];if(1024>=l.length){var u=mi.test(l)?l.replace(mi,"$1"):l;if(!u.match(/\S*Error: /)){for(var h of r){var d=h(u,t);if(d){n.push(d);break}}if(n.length>=50)break}}}return function(t){if(!t.length)return[];var e=Array.from(t);return e.reverse(),e.slice(0,50).map((t=>{return i({},t,{filename:t.filename||(r=e,r[r.length-1]||{}).filename,function:t.function||li});var r}))}(n)}}("web:javascript",pi,gi)),this._instance=t,this.vo=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property(c))&&void 0!==e?e:[],this.po=Ai(this.mo()),this.yo=new Mi(this.po)}onConfigChange(){this.po=Ai(this.mo()),this.yo.setConfig(this.po)}onRemoteConfig(t){var e,i,r;if("errorTracking"in t){var s=null!==(e=null==(i=t.errorTracking)?void 0:i.suppressionRules)&&void 0!==e?e:[],n=null==(r=t.errorTracking)?void 0:r.captureExtensionExceptions;this.vo=s,this._instance.persistence&&this._instance.persistence.register({[c]:this.vo,[p]:n})}}get bo(){var t,e=!!this._instance.get_property(p),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.fo.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.po.enabled)try{if(!jt(t)||0===t.trim().length)return void Ko.warn("Ignoring exception step because message must be a non-empty string");var r=this._o(e),{sanitizedProperties:s,droppedKeys:n}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>Ci.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(r);n.length>0&&Ko.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.yo.add(i({[Oi]:t,[Ii]:(new Date).toISOString()},s))}catch(t){Ko.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.wo(e)){if(this.Io(e))return this.Co("Exception dropped: matched a suppression rule"),void Ko.info("Skipping exception capture because a suppression rule matched");if(!this.bo&&this.So(e))return this.Co("Exception dropped: thrown by a browser extension"),void Ko.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.xo(e))return this.Co("Exception dropped: thrown by the PostHog SDK"),void Ko.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.po.enabled&&Ht(t.$exception_steps)?this.ko(t):t;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Qi:!0});return r&&this.yo.clear(),r}catch(t){return Ko.error("Failed to capture exception event. Dropping this exception.",t),void this.yo.clear()}}catch(t){return void Ko.error("Failed to process exception event. Ignoring this exception.",t)}}ko(t){try{var e=this.yo.getAttachable();return 0===e.length?t:i({},t,{$exception_steps:e})}catch(e){return Ko.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Co(t){this.po.enabled&&this.yo.add({[Oi]:t,[Ii]:(new Date).toISOString()})}_o(t){return Lt(t)?i({},t):{}}mo(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}Io(t){if(0===t.length)return!1;var e=t.reduce(((t,e)=>{var{type:i,value:r}=e;return jt(i)&&i.length>0&&t.$exception_types.push(i),jt(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.vo.some((t=>{var i=t.values.map((t=>{var i,r=on[t.operator],s=Mt(t.value)?t.value:[t.value],n=null!==(i=e[t.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)}));return"OR"===t.type?i.some(Boolean):i.every(Boolean)}))}So(t){return t.flatMap((t=>{var e,i;return null!==(e=null==(i=t.stacktrace)?void 0:i.frames)&&void 0!==e?e:[]})).some((t=>t.filename&&t.filename.startsWith("chrome-extension://")))}xo(t){if(t.length>0){var e,i,r,s,n=null!==(e=null==(i=t[0].stacktrace)?void 0:i.frames)&&void 0!==e?e:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}wo(t){return!Ht(t)&&Mt(t)}}},oa=i({productTours:class{get ii(){return this._instance.persistence}constructor(t){this.To=null,this.Ao=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this.ii&&this.ii.register({[g]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,e;this.To||(t=this._instance).config.disable_product_tours||null==(e=t.persistence)||!e.get_property(g)||this.lr((()=>this.Eo()))}lr(t){var e,i;null!=(e=St.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=St.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?Co.error("Could not load product tours script",e):t()}))}Eo(){var t;!this.To&&null!=(t=St.__PosthogExtensions__)&&t.generateProductTours&&(this.To=St.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!Mt(this.Ao)||e){var i=this.ii;if(i){var r=i.props[N];if(Mt(r)&&!e)return this.Ao=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:e=>{var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return Co.error(s),void t([],{isLoaded:!1,error:s})}var n=Mt(e.json.product_tours)?e.json.product_tours:[];this.Ao=n,i&&i.register({[N]:n}),t(n,{isLoaded:!0})}})}else t(this.Ao,{isLoaded:!0})}getActiveProductTours(t){Ht(this.To)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.To.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.To)||e.showTourById(t)}previewTour(t){this.To?this.To.previewTour(t):this.lr((()=>{var e;this.Eo(),null==(e=this.To)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.To)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.To)||t.nextStep()}previousStep(){var t;null==(t=this.To)||t.previousStep()}clearCache(){var t;this.Ao=null,null==(t=this.ii)||t.unregister(N)}resetTour(t){var e;null==(e=this.To)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.To)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.To)||e.cancelPendingTour(t)}}},ia),aa={siteApps:class{constructor(t){this._instance=t,this.Ro=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}No(t,e){if(e){var i=this.globalsForEvent(e);this.Ro.push(i),this.Ro.length>1e3&&(this.Ro=this.Ro.slice(10))}}get siteAppLoaders(){var t;return null==(t=St._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.No.bind(this));this.Mo=()=>{t(),this.Ro=[],this.Mo=void 0}}}globalsForEvent(t){var e,s,n,o,a,l,u;if(!t)throw new Error("Event payload is required");var h={},d=this._instance.get_property("$groups")||[],v=this._instance.get_property("$stored_group_properties")||{};for(var[c,p]of Object.entries(v))h[c]={id:d[c],type:c,properties:p};var{$set_once:f,$set:_}=t;return{event:i({},r(t,Fo),{properties:i({},t.properties,_?{$set:i({},null!==(e=null==(s=t.properties)?void 0:s.$set)&&void 0!==e?e:{},_)}:{},f?{$set_once:i({},null!==(n=null==(o=t.properties)?void 0:o.$set_once)&&void 0!==n?n:{},f)}:{}),elements_chain:null!==(a=null==(l=t.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(u=t.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}setupSiteApp(t){var e=this.apps[t.id],i=()=>{var i;!e.errored&&this.Ro.length&&(Ao.info("Processing "+this.Ro.length+" events for site app with id "+t.id),this.Ro.forEach((t=>null==e.processEvent?void 0:e.processEvent(t))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this.Mo)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,Ao.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=t.init({posthog:this._instance,callback(t){s(t)}});n&&(e.processEvent=n),r=!0}catch(e){Ao.error(Mo+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){Ao.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}Fo(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of t)this.setupSiteApp(i)}Oo(t){if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(e)}catch(e){Ao.error("Error while processing event "+t.event+" for site app "+i.id,e)}}}onRemoteConfig(t){var e,i,r,s=this;if(null!=(e=this.siteAppLoaders)&&e.length)return this.isEnabled?(this.Fo(),void this._instance.on("eventCaptured",(t=>this.Oo(t)))):void Ao.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Mo)||i.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var e;St["__$$ph_site_app_"+t]=s._instance,null==(e=St.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(s._instance,a,(e=>{if(e)return Ao.error(Mo+t,e)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else Ao.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},la={tracingHeaders:class{constructor(t){this.Po=void 0,this.Lo=void 0,this.no=()=>{var t,e,i=this.Do()||[];Nt(this.Po)&&(null==(t=St.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchXHR(i,this._instance.get_distinct_id(),this._instance.sessionManager)),Nt(this.Lo)&&(null==(e=St.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchFetch(i,this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}initialize(){this.startIfEnabledOrStop()}lr(t){var e,i;null!=(e=St.__PosthogExtensions__)&&e.tracingHeadersPatchFns&&t(),null==(i=St.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return wo.error("failed to load script",e);t()}))}Do(){var t;return null!==(t=this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}startIfEnabledOrStop(){var t,e;this.Do()?this.lr(this.no):(null==(t=this.Po)||t.call(this),null==(e=this.Lo)||e.call(this),this.Po=void 0,this.Lo=void 0)}}},ua=i({surveys:class{get Lt(){return this._instance.config}constructor(t){this.Bo=void 0,this._surveyManager=null,this.jo=!1,this.$o=[],this.qo=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Lt.disable_surveys){var e=t.surveys;if(Ht(e))return cn.warn("Flags not loaded yet. Not loading surveys.");var i=Mt(e);this.Bo=i?e.length>0:e,cn.info("flags response received, isSurveysEnabled: "+this.Bo),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],e=0;e<localStorage.length;e++){var i=localStorage.key(e);(null!=i&&i.startsWith(pn)||null!=i&&i.startsWith("inProgressSurvey_"))&&t.push(i)}t.forEach((t=>localStorage.removeItem(t)))}loadIfEnabled(){if(!this._surveyManager)if(this.jo)cn.info("Already initializing surveys, skipping...");else if(this.Lt.disable_surveys)cn.info(zo);else if(this.Lt.cookieless_mode&&this._instance.consent.isOptedOut())cn.info("Not loading surveys in cookieless mode without consent.");else{var t=null==St?void 0:St.__PosthogExtensions__;if(t){if(!Nt(this.Bo)||this.Lt.advanced_enable_surveys){var e=this.Bo||this.Lt.advanced_enable_surveys;this.jo=!0;try{var i=t.generateSurveys;if(i)return void this.Zo(i,e);var r=t.loadExternalDependency;if(!r)return void this.Ho(it);r(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.Ho("Could not load surveys script",i):this.Zo(t.generateSurveys,e)}))}catch(t){throw this.Ho("Error initializing surveys",t),t}finally{this.jo=!1}}}else cn.error("PostHog Extensions not found.")}}Zo(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new No(this._instance),cn.info("Surveys loaded successfully"),this.Vo({isLoaded:!0})}Ho(t,e){cn.error(t,e),this.Vo({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.$o.push(t),this._surveyManager&&this.Vo({isLoaded:!0}),()=>{this.$o=this.$o.filter((e=>e!==t))}}getSurveys(t,e){if(void 0===e&&(e=!1),this.Lt.disable_surveys)return cn.info(zo),t([]);var i,r=this._instance.get_property(L);if(r&&!e)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.qo?this.qo.then((e=>{var{surveys:i,context:r}=e;return t(i,r)})):("undefined"!=typeof Promise&&(this.qo=new Promise((t=>{i=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Lt.token),method:"GET",timeout:this.Lt.surveys_request_timeout_ms,callback:e=>{var r;this.qo=null;var s=e.statusCode;if(200!==s||!e.json){var n="Surveys API could not be loaded, status: "+s;cn.error(n);var o={isLoaded:!1,error:n};return t([],o),void(null==i||i({surveys:[],context:o}))}var a,l=e.json.surveys||[],u=l.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(function(t){var e;return!(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)||!e.length)}(t)||function(t){var e;return!(null==(e=t.conditions)||null==(e=e.actions)||null==(e=e.values)||!e.length)}(t))));u.length>0&&(null==(a=this._surveyEventReceiver)||a.register(u)),null==(r=this._instance.persistence)||r.register({[L]:l});var h={isLoaded:!0};t(l,h),null==i||i({surveys:l,context:h})}}))}Vo(t){for(var e of this.$o)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){cn.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!Ht(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);cn.warn("init was not called")}zo(t){var e=null;return this.getSurveys((i=>{var r;e=null!==(r=i.find((e=>e.id===t)))&&void 0!==r?r:null})),e}Uo(t){if(Ht(this._surveyManager))return{eligible:!1,reason:jo};var e="string"==typeof t?this.zo(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Ht(this._surveyManager))return cn.warn("init was not called"),{visible:!1,disabledReason:jo};var e=this.Uo(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Ht(this._surveyManager)?(cn.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:jo})):new Promise((i=>{this.getSurveys((e=>{var r,s=null!==(r=e.find((e=>e.id===t)))&&void 0!==r?r:null;if(s){var n=this.Uo(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var r;if(Ht(this._surveyManager))cn.warn("init was not called");else{var s="string"==typeof t?this.zo(t):t;if(null!=s&&s.id)if(fn.includes(s.type)){var n=null==gt?void 0:gt.querySelector(e);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(cn.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,e;cn.info("Rendering survey "+s.id+" with delay of "+(null==(t=s.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(e=this._surveyManager)||e.renderSurvey(s,n,i),cn.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);cn.warn("Survey element not found")}else cn.warn("Surveys of type "+s.type+" cannot be rendered in the app");else cn.warn("Survey not found")}}displaySurvey(t,e){var r;if(Ht(this._surveyManager))cn.warn("init was not called");else{var s=this.zo(t);if(s){var n=s;if(null!=(r=s.appearance)&&r.surveyPopupDelaySeconds&&e.ignoreDelay&&(n=i({},s,{appearance:i({},s.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==Xr.Popover&&e.initialResponses&&cn.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var o=this.canRenderSurvey(s);if(!o.visible)return void cn.warn("Survey is not eligible to be displayed: ",o.disabledReason)}e.displayType!==Xr.Inline?this._surveyManager.handlePopoverSurvey(n,e):this.renderSurvey(n,e.selector,e.properties)}else cn.warn("Survey not found")}}cancelPendingSurvey(t){Ht(this._surveyManager)?cn.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},ia),ha={toolbar:class{constructor(t){this.instance=t}Yo(t){St.ph_toolbar_state=t}Wo(){var t;return null!==(t=St.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,i){if(void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),Ki(this.instance.config))return!1;if(!pt||!gt)return!1;t=null!=t?t:pt.location,i=null!=i?i:pt.history;try{if(!e){try{pt.localStorage.setItem("test","test"),pt.localStorage.removeItem("test")}catch(t){return!1}e=null==pt?void 0:pt.localStorage}var r,s=Bo||Pr(t.hash,"__posthog")||Pr(t.hash,"state"),n=s?qi((()=>JSON.parse(atob(decodeURIComponent(s)))))||qi((()=>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:i?i.replaceState(i.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(e.getItem(Ho)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}Go(t){var e=St.ph_load_toolbar||St.ph_load_editor;!Ht(e)&&Dt(e)?e(t,this.instance):qo.warn("No toolbar load function found")}loadToolbar(t){var e=!(null==gt||!gt.getElementById(X));if(!pt||e)return!1;var r="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=i({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(pt.localStorage.setItem(Ho,JSON.stringify(i({},s,{source:void 0}))),2===this.Wo())this.Go(s);else if(0===this.Wo()){var n;this.Yo(1),null==(n=St.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return qo.error("[Toolbar] Failed to load",t),void this.Yo(0);this.Yo(2),this.Go(s)})),Ji(pt,"turbolinks:load",(()=>{this.Yo(0),this.loadToolbar(s)}))}return!0}Xo(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,i){return void 0===t&&(t=void 0),void 0===e&&(e=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(t,e,i)}}},da=i({experiments:Zo},ia),va={conversations:class{constructor(t){this.Jo=void 0,this._conversationsManager=null,this.Ko=!1,this.Qo=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;Ht(e)||(Wt(e)?this.Jo=e:(this.Jo=e.enabled,this.Qo=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Jo=void 0,this.Qo=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ko||this._instance.config.disable_conversations||Ki(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==St?void 0:St.__PosthogExtensions__;if(t&&!Nt(this.Jo)&&this.Jo)if(this.Qo&&this.Qo.token){this.Ko=!0;try{var e=t.initConversations;if(e)return this.ea(e),void(this.Ko=!1);var i=t.loadExternalDependency;if(!i)return void this.ta(it);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.ta("Could not load conversations script",e):this.ea(t.initConversations),this.Ko=!1}))}catch(t){this.ta("Error initializing conversations",t),this.Ko=!1}}else ta.error("Conversations enabled but missing token in remote config.")}}ea(t){if(this.Qo)try{this._conversationsManager=t(this.Qo,this._instance),ta.info("Conversations loaded successfully")}catch(t){this.ta("Error completing conversations initialization",t)}else ta.error("Cannot complete initialization: remote config is null")}ta(t,e){ta.error(t,e),this._conversationsManager=null,this.Ko=!1}show(){this._conversationsManager?this._conversationsManager.show():ta.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Jo&&!Bt(this._conversationsManager)}isVisible(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,i,r){var s=this;return e((function*(){return s._conversationsManager?s._conversationsManager.sendMessage(t,i,r):(ta.warn(ea),null)}))()}getMessages(t,i){var r=this;return e((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,i):(ta.warn(ea),null)}))()}markAsRead(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(ta.warn(ea),null)}))()}getTickets(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(ta.warn(ea),null)}))()}requestRestoreLink(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(ta.warn(ea),null)}))()}restoreFromToken(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(ta.warn(ea),null)}))()}restoreFromUrlToken(){var t=this;return e((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(ta.warn(ea),null)}))()}getCurrentTicketId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.getWidgetSessionId())&&void 0!==t?t:null}ln(){var t;null==(t=this._conversationsManager)||t.setIdentity()}un(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},ca={logs:class{constructor(t){var e;this.ra=!1,this.ia=!1,this.Yt=Ni("[logs]"),this.na=[],this.sa=0,this.oa=0,this.aa=!1,this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.ra=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,i=null==(e=t.logs)?void 0:e.captureConsoleLogs;!Ht(i)&&i&&(this.ra=!0,this.loadIfEnabled())}reset(){this.na=[],this.Br&&(clearTimeout(this.Br),this.Br=void 0),this.sa=0,this.oa=0,this.aa=!1}loadIfEnabled(){if(this.ra&&!this.ia){var t=null==St?void 0:St.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(e=>{var i;e||null==(i=t.logs)||!i.initializeLogs?this.Yt.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.ia=!0)})):this.Yt.error(it)}else this.Yt.error("PostHog Extensions not found.")}}captureLog(t){var e,r,s,n,o,a;if(this._instance.is_capturing())if(t&&t.body){var l=null!==(e=null==(r=this._instance.config.logs)?void 0:r.flushIntervalMs)&&void 0!==e?e:3e3,u=null!==(s=null==(n=this._instance.config.logs)?void 0:n.maxLogsPerInterval)&&void 0!==s?s:1e3,h=Date.now();if(l>h-this.oa||(this.oa=h,this.sa=0,this.aa=!1),u>this.sa){this.sa++;var d=function(t,e){var r=t.level||"info",{text:s,number:n}=ii[r]||ri,o=String(Date.now())+"000000",a={};e.distinctId&&(a.posthogDistinctId=e.distinctId),e.sessionId&&(a.sessionId=e.sessionId),e.currentUrl&&(a["url.full"]=e.currentUrl),e.screenName&&(a["screen.name"]=e.screenName),e.appState&&(a["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(a.feature_flags=e.activeFeatureFlags);var l=i({},a,t.attributes||{}),u={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:n,severityText:s,body:{stringValue:t.body},attributes:ni(l)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),Nt(t.trace_flags)||(u.flags=t.trace_flags),u}(t,this.la());this.na.push({record:d}),(null!==(o=null==(a=this._instance.config.logs)?void 0:a.maxBufferSize)&&void 0!==o?o:100)>this.na.length?this.ua():this.flushLogs()}else this.aa||(this.Yt.warn("captureLog dropping logs: exceeded "+u+" logs per "+l+"ms"),this.aa=!0)}else this.Yt.warn("captureLog requires a body")}get logger(){return this.ha||(this.ha={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.ha}flushLogs(t){if(this.Br&&(clearTimeout(this.Br),this.Br=void 0),0!==this.na.length){var e=this.na;this.na=[];var r=this._instance.config.logs,s=i({"service.name":(null==r?void 0:r.serviceName)||"unknown_service"},(null==r?void 0:r.environment)&&{"deployment.environment":r.environment},(null==r?void 0:r.serviceVersion)&&{"service.version":r.serviceVersion},null==r?void 0:r.resourceAttributes),o=function(t,e,i,r){return{resourceLogs:[{resource:{attributes:ni(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}(e.map((t=>t.record)),s,n.LIB_NAME,n.LIB_VERSION),a=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Zi({method:"POST",url:a,data:o,compression:"best-available",batchKey:"logs",transport:t})}}ua(){var t,e;this.Br||(this.Br=setTimeout((()=>{this.Br=void 0,this.flushLogs()}),null!==(t=null==(e=this._instance.config.logs)?void 0:e.flushIntervalMs)&&void 0!==t?t:3e3))}la(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=i}if(null!=St&&null!=(t=St.location)&&t.href&&(e.currentUrl=St.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(e.activeFeatureFlags=r)}return e}}},pa=i({},ia,ra,sa,na,oa,aa,ua,la,ha,da,va,ca);An.__defaultExtensionClasses=i({},pa);var fa=Ni("[ExternalScriptsLoader]"),_a=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return fa.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=null==gt?void 0:gt.querySelectorAll("script");if(r)for(var s,n=function(){if(r[o].src===e){var t=r[o];return t.__posthog_loading_callback_fired?{v:i()}:(t.addEventListener("load",(e=>{t.__posthog_loading_callback_fired=!0,i(void 0,e)})),t.onerror=t=>i(t),{v:void 0})}},o=0;r.length>o;o++)if(s=n())return s.v;var a=()=>{if(!gt)return i("document not found");var r=gt.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=e,r.onload=t=>{r.__posthog_loading_callback_fired=!0,i(void 0,t)},r.onerror=t=>i(t),t.config.prepare_external_dependency_script&&(r=t.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)gt.head.appendChild(r);else{var s,n=gt.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):gt.body.appendChild(r)}};null!=gt&>.body?a():null==gt||gt.addEventListener("DOMContentLoaded",a)};St.__PosthogExtensions__=St.__PosthogExtensions__||{},St.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r;if(t.config.__preview_external_dependency_versioned_paths)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var s="/static/"+e+".js?v="+t.version;if("toolbar"===e){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}r=t.requestRouter.endpointFor("assets",s)}_a(t,r,i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");_a(t,o,i)}},St.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);_a(t,r,i)};var ga,ma=(ga=wn[Rn]=new An,function(){function t(){t.done||(t.done=!0,Pn=!1,zi(wn,(function(t){t._dom_loaded()})))}null!=gt&>.addEventListener?"complete"===gt.readyState?t():Ji(gt,"DOMContentLoaded",t,{capture:!1}):pt&&Ui.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),ga);exports.Compression=ss,exports.DEFAULT_PRODUCT_TOUR_APPEARANCE={backgroundColor:"#ffffff",textColor:"#1d1f27",buttonColor:"#1d1f27",borderRadius:8,buttonBorderRadius:6,borderColor:"#e5e7eb",fontFamily:"system-ui",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.15)",showOverlay:!0,whiteLabel:!1,dismissOnClickOutside:!0,zIndex:2147483646},exports.DisplaySurveyType=Xr,exports.PostHog=An,exports.ProductTourEventName=Qr,exports.ProductTourEventProperties=Zr,exports.SurveyEventName=Jr,exports.SurveyEventProperties=Kr,exports.SurveyEventType=Gr,exports.SurveyPosition={TopLeft:"top_left",TopRight:"top_right",TopCenter:"top_center",MiddleLeft:"middle_left",MiddleRight:"middle_right",MiddleCenter:"middle_center",Left:"left",Center:"center",Right:"right",NextToTrigger:"next_to_trigger"},exports.SurveyQuestionBranchingType={NextQuestion:"next_question",End:"end",ResponseBased:"response_based",SpecificQuestion:"specific_question"},exports.SurveyQuestionType={Open:"open",MultipleChoice:"multiple_choice",SingleChoice:"single_choice",Rating:"rating",Link:"link"},exports.SurveySchedule={Once:"once",Recurring:"recurring",Always:"always"},exports.SurveyTabPosition={Top:"top",Left:"left",Right:"right",Bottom:"bottom"},exports.SurveyType=Yr,exports.SurveyWidgetType={Button:"button",Tab:"tab",Selector:"selector"},exports.default=ma,exports.posthog=ma,exports.severityLevels=["fatal","error","warning","log","info","debug"];
|
|
2
2
|
//# sourceMappingURL=main.js.map
|