posthog-js 1.391.6 → 1.391.7

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.
@@ -1,2 +1,2 @@
1
- !function(){"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}var s="1.391.6",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",f="$error_tracking_capture_extension_exceptions",p="$web_vitals_enabled_server_side",g="$dead_clicks_enabled_server_side",_="$product_tours_enabled_server_side",m="$web_vitals_allowed_metrics",y="$session_recording_remote_config",b="$replay_sample_rate",w="$replay_override_sampling",x="$replay_override_linked_flag",S="$replay_override_url_trigger",E="$replay_override_event_trigger",k="$sesid",P="$session_is_sampled",T="$enabled_feature_flags",R="$active_feature_flags",I="$early_access_features",C="$feature_flag_details",F="$feature_flag_payloads",O="$feature_flag_request_id",M="$override_feature_flags",A="$override_feature_flag_payloads",D="$stored_person_properties",j="$stored_group_properties",L="$surveys",z="$surveys_loaded_at",N="$surveys_activated",U="ph_product_tours",B="$flag_call_reported",H="$flag_call_reported_session_id",q="$feature_flag_errors",G="$feature_flag_evaluated_at",V="$user_state",W="$client_session_props",J="$capture_rate_limit",K="$initial_campaign_params",Y="$initial_referrer_info",X="$initial_person_info",Q="$epp",Z="__POSTHOG_TOOLBAR__",tt="$posthog_cookieless",et="$sdk_debug_extensions_init_method",it="$sdk_debug_extensions_init_time_ms",rt="$sdk_debug_recording_script_not_loaded",st="PostHog loadExternalDependency extension not found.",nt="on_reject",ot="always",at="anonymous",lt="identified",ut="identified_only",ht="visibilitychange",dt="beforeunload",vt="$pageview",ct="$pageleave",ft="$identify",pt="$groupidentify",gt="undefined"!=typeof window?window:void 0,_t="undefined"!=typeof globalThis?globalThis:gt;"undefined"==typeof self&&(_t.self=_t),"undefined"==typeof File&&(_t.File=function(){});var mt=null==_t?void 0:_t.navigator,yt=null==_t?void 0:_t.document,bt=null==_t?void 0:_t.location,wt=null==_t?void 0:_t.fetch,xt=null!=_t&&_t.XMLHttpRequest&&"withCredentials"in new _t.XMLHttpRequest?_t.XMLHttpRequest:void 0,St=null==_t?void 0:_t.AbortController,Et=null==_t?void 0:_t.CompressionStream,kt=null==mt?void 0:mt.userAgent,$t=null!=gt?gt:{},Pt=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function Tt(t){return"string"==typeof t||t}function Rt(t){return"string"==typeof t?t:void 0}var It,Ct=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),Ft=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),Ot=["$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"],Mt=["token"],At="NativeGzipValidationError",Dt=t=>t.length>=2&&31===t[0]&&139===t[1],jt=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Lt=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=At,e},zt=function(){var t=e((function*(t,e){18>t.size&&Lt("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());Dt(i)&&8===i[2]||Lt("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(It)return It;It=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;It[t]=e>>>0}return It})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&Lt("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&Lt("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function Nt(){return Nt=e((function*(t,i,r){void 0===i&&(i=!0);try{var s=(new TextEncoder).encode(t),n=new CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(s).then((()=>o.close())).catch(function(){var t=e((function*(t){try{yield o.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),l=new Response(n.readable).blob(),[u]=yield Promise.all([l,a]);return yield zt(u,s),u}catch(t){if(null!=r&&r.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}})),Nt.apply(this,arguments)}var Ut=["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"],Bt=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return Ut.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function Ht(t,e){return-1!==t.indexOf(e)}var qt=function(t){return t.trim()},Gt=function(t){return t.replace(/^\$/,"")},Vt=Object.prototype,Wt=Vt.hasOwnProperty,Jt=Vt.toString,Kt=Array.isArray||function(t){return"[object Array]"===Jt.call(t)},Yt=t=>"function"==typeof t,Xt=t=>t===Object(t)&&!Kt(t),Qt=t=>{if(Xt(t)){for(var e in t)if(Wt.call(t,e))return!1;return!0}return!1},Zt=t=>void 0===t,te=t=>"[object String]"==Jt.call(t),ee=t=>te(t)&&0===t.trim().length,ie=t=>null===t,re=t=>Zt(t)||ie(t),se=t=>"[object Number]"==Jt.call(t)&&t==t,ne=t=>se(t)&&t>0,oe=t=>"[object Boolean]"===Jt.call(t),ae=t=>t instanceof FormData,le=t=>Ht(Ot,t),ue=t=>Ht(Mt,t);function he(t){return null===t||"object"!=typeof t}function de(t,e){return{}.toString.call(t)==="[object "+e+"]"}function ve(t){return"undefined"!=typeof Event&&function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Event)}var ce=[!0,"true",1,"1","yes"],fe=t=>Ht(ce,t),pe=[!1,"false",0,"0","no"];function ge(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),se(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),ge(s||i,e,i,r))}class _e{constructor(t){this.$t={},this.Gt=t.Gt,this.Zt=ge(t.bucketSize,0,100,t.Qt),this.Jt=ge(t.refillRate,0,this.Zt,t.Qt),this.Kt=ge(t.refillInterval,0,864e5,t.Qt)}Yt(t,e){var i=Math.floor((e-t.lastAccess)/this.Kt);i>0&&(t.tokens=Math.min(t.tokens+i*this.Jt,this.Zt),t.lastAccess=t.lastAccess+i*this.Kt)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.$t[r];return s?this.Yt(s,i):this.$t[r]=s={tokens:this.Zt,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.Gt)||e.call(this,t)),0===s.tokens)}stop(){this.$t={}}}var me="Mobile",ye="iOS",be="Android",we="Tablet",xe=be+" "+we,Se="iPad",Ee="Apple",ke=Ee+" Watch",$e="Safari",Pe="BlackBerry",Te="Samsung",Re=Te+"Browser",Ie=Te+" Internet",Ce="Chrome",Fe=Ce+" OS",Oe=Ce+" "+ye,Me="Internet Explorer",Ae=Me+" "+me,De="Opera",je=De+" Mini",Le="Edge",ze="Microsoft "+Le,Ne="Firefox",Ue=Ne+" "+ye,Be="Nintendo",He="PlayStation",qe="Xbox",Ge=be+" "+me,Ve=me+" "+$e,We="Windows",Je=We+" Phone",Ke="Nokia",Ye="Ouya",Xe="Generic",Qe=Xe+" "+me.toLowerCase(),Ze=Xe+" "+we.toLowerCase(),ti="Konqueror",ei="Oculus Browser",ii="Vivaldi",ri="Yandex",si="Whale",ni="DuckDuckGo",oi="Pale Moon",ai="Waterfox",li="Brave",ui="Google Search App",hi="(\\d+(\\.\\d+)?)",di=new RegExp("Version/"+hi),vi=new RegExp(qe,"i"),ci=new RegExp(He+" \\w+","i"),fi=new RegExp(Be+" \\w+","i"),pi=new RegExp(Pe+"|PlayBook|BB10","i"),gi={"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"},_i=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?li:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&Ht(t,"GSA/")?ui:Ht(t," OPR/")&&Ht(t,"Mini")?je:Ht(t," OPR/")?De:pi.test(t)?Pe:Ht(t,"IE"+me)||Ht(t,"WPDesktop")?Ae:Ht(t,"OculusBrowser")?ei:Ht(t,Re)?Ie:Ht(t,Le)||Ht(t,"Edg/")?ze:Ht(t,ii+"/")?ii:Ht(t,"YaBrowser/")?ri:Ht(t,si+"/")?si:Ht(t,ni+"/")||Ht(t,"Ddg/")?ni:Ht(t,"FBIOS")?"Facebook "+me:Ht(t,"UCWEB")||Ht(t,"UCBrowser")?"UC Browser":Ht(t,"CriOS")?Oe:Ht(t,"CrMo")||Ht(t,Ce)?Ce:Ht(t,be)&&Ht(t,$e)?Ge:Ht(t,"FxiOS")?Ue:Ht(t.toLowerCase(),ti.toLowerCase())?ti:Ht(t,li+"/")?li:((t,e)=>e&&Ht(e,Ee)||function(t){return Ht(t,$e)&&!Ht(t,Ce)&&!Ht(t,be)}(t))(t,e)?Ht(t,me)?Ve:$e:Ht(t,"PaleMoon/")?oi:Ht(t,ai+"/")?ai:Ht(t,Ne)?Ne:Ht(t,"MSIE")||Ht(t,"Trident/")?Me:Ht(t,"Gecko")?Ne:"")},mi={[Ae]:[new RegExp("rv:"+hi)],[ze]:[new RegExp(Le+"?\\/"+hi)],[Ce]:[new RegExp("("+Ce+"|CrMo)\\/"+hi)],[Oe]:[new RegExp("CriOS\\/"+hi)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+hi)],[$e]:[di],[Ve]:[di],[De]:[new RegExp("(Opera|OPR)\\/"+hi)],[Ne]:[new RegExp(Ne+"\\/"+hi)],[Ue]:[new RegExp("FxiOS\\/"+hi)],[ti]:[new RegExp("Konqueror[:/]?"+hi,"i")],[Pe]:[new RegExp(Pe+" "+hi),di],[Ge]:[new RegExp("android\\s"+hi,"i")],[Ie]:[new RegExp(Re+"\\/"+hi)],[ei]:[new RegExp("OculusBrowser\\/"+hi)],[ii]:[new RegExp(ii+"\\/"+hi)],[ri]:[new RegExp("YaBrowser\\/"+hi)],[si]:[new RegExp(si+"\\/"+hi)],[li]:[new RegExp(li+"\\/"+hi)],[ni]:[new RegExp("(DuckDuckGo|Ddg)\\/"+hi)],[oi]:[new RegExp("PaleMoon\\/"+hi)],[ai]:[new RegExp(ai+"\\/"+hi)],[ui]:[new RegExp("GSA\\/"+hi)],[Me]:[new RegExp("(rv:|MSIE )"+hi)],Mozilla:[new RegExp("rv:"+hi)]},yi=function(t,e,i,r){var s=_i(t,e,i,r),n=mi[s];if(Zt(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},bi=[[new RegExp(qe+"; "+qe+" (.*?)[);]","i"),t=>[qe,t&&t[1]||""]],[new RegExp(Be,"i"),[Be,""]],[new RegExp(He,"i"),[He,""]],[pi,[Pe,""]],[new RegExp(We,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Je,""];if(new RegExp(me).test(e)&&!/IEMobile\b/.test(e))return[We+" "+me,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=gi[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[We,r]}return[We,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[ye,[t[3],t[4],t[5]||"0"].join(".")]:[ye,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=Zt(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+be+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+be+")","i"),t=>t&&t[2]?[be,[t[2],t[3],t[4]||"0"].join(".")]:[be,""]],[/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/,[Fe,""]],[/Linux|debian/i,["Linux",""]]],wi=function(t){return fi.test(t)?Be:ci.test(t)?He:vi.test(t)?qe:new RegExp(Ye,"i").test(t)?Ye:new RegExp("("+Je+"|WPDesktop)","i").test(t)?Je:/iPad/.test(t)?Se:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ke:pi.test(t)?Pe:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Ke,"i").test(t)?Ke:/(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(me).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)?be:xe:new RegExp("(pda|"+me+")","i").test(t)?Qe:new RegExp(we,"i").test(t)&&!new RegExp(we+" pc","i").test(t)?Ze:""},xi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Si(t,e){return"string"==typeof(i=t)&&xi.test(i)?t:e();var i}function Ei(t,e){var i=setTimeout(t,e);return(null==i?void 0:i.unref)&&(null==i||i.unref()),i}var ki=t=>t instanceof Error,$i={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}},Pi=$i.info;function Ti(t){if(oe(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(Kt(t))return{arrayValue:{values:t.map((t=>Ti(t)))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}function Ri(t){var e=[];for(var i in t){var r=t[i];ie(r)||Zt(r)||e.push({key:i,value:Ti(r)})}return e}function Ii(t,e){var r=t.level||"info",{text:s,number:n}=$i[r]||Pi,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:Ri(l)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),Zt(t.trace_flags)||(u.flags=t.trace_flags),u}function Ci(t,e,r){return i({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":r})}function Fi(t,e,i,r){return{resourceLogs:[{resource:{attributes:Ri(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}let Oi=class{constructor(t,e,i,r,s,n){var o;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.Dt=e,this.Qt=i,this.Xt=r,this.er=s,this.tr=n,this.rr=null,this.ir=0,this.nr=0,this.sr=0,this.ar=0,this.lr=!1,this.ur=e.maxBufferSize,this.ot=Math.max(null!==(o=e.maxQueueSize)&&void 0!==o?o:e.maxBufferSize,e.maxBufferSize),this.hr=e.flushIntervalMs,this.cr=e.maxBatchRecordsPerPost,this.dr=e.rateCapWindowMs,this.vr=e.maxLogsPerInterval}reset(){this.pr(),this.rr=null,this.sr=0,this.ar=0,this.lr=!1,this.ir=0,this.nr=0,this.cr=this.Dt.maxBatchRecordsPerPost}onReconnect(){this.nr=0,this.gr()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var e=this.mr(t);if(null!==e)if(e.body){if(this.yr()){var i={record:Ii(e,this.Xt())};this.er((()=>this.br(i)))}}else this.Qt.info("Log was rejected in beforeSend function")}}mr(t){var e=this.Dt.beforeSend;if(!e)return t;var i=Kt(e)?e:[e],r=t;for(var s of i)try{var n=s(r);if(!n)return this.Qt.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.Qt.error("Error in beforeSend function for log:",t),null}return r}yr(){if(void 0===this.vr)return!0;var t=Date.now(),e=t-this.sr;return this.dr>e&&e>=0||(this.sr=t,this.ar=0,this.lr=!1),this.vr>this.ar?(this.ar++,!0):(this.lr||(this.Qt.warn("captureLog dropping logs: exceeded "+this.vr+" logs per "+this.dr+"ms"),this.lr=!0),!1)}flush(){var t=this;return e((function*(){if(!t._instance.isDisabled)return t.rr||(t.rr=t._r().finally((()=>{t.rr=null}))),t.rr}))()}_r(){var t=this;return e((function*(){var e;t.pr();var i=null!==(e=t._instance.getPersistedProperty(Ct.LogsQueue))&&void 0!==e?e:[];if(0!==i.length)for(var r=i.length,s=0;i.length>0&&r>s;){var n;t.ir=0;var o=Math.min(i.length,t.cr),a=i.slice(0,o),l=Fi(a.map((t=>t.record)),t.wr(),t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.kr(l);if("too-large"===u.kind&&a.length>1)t.cr=Math.max(1,Math.floor(a.length/2)),t.Qt.warn("Received 413 when sending logs batch of size "+a.length+", reducing batch size to "+t.cr);else{if("retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.Qt.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&t.Dt.maxBatchRecordsPerPost>t.cr&&(t.cr=Math.min(t.Dt.maxBatchRecordsPerPost,t.cr+1)),yield t.Sr(a.length),i=null!==(n=t._instance.getPersistedProperty(Ct.LogsQueue))&&void 0!==n?n:[],s+=a.length,"fatal"===u.kind)throw u.error}}}))()}Sr(t){var i=this;return e((function*(){var e,r=Math.max(0,t-i.ir),s=null!==(e=i._instance.getPersistedProperty(Ct.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(Ct.LogsQueue,s.slice(r)),yield i.tr()}))()}wr(){return Ci(this.Dt,this._instance.getLibraryId(),this._instance.getLibraryVersion())}br(t){var e;if(!this._instance.optedOut){var i=null!==(e=this._instance.getPersistedProperty(Ct.LogsQueue))&&void 0!==e?e:[];this.ot>i.length||(i.shift(),this.ir++,this.Qt.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(Ct.LogsQueue,i),this.ur>i.length?this.Cr():this.gr()}}Cr(t){void 0===t&&(t=this.hr),this.Ir||(this.Ir=Ei((()=>{this.Ir=void 0,this.gr()}),t))}Tr(){var t=Math.min(Math.max(0,this.nr-1),6);return this.hr*Math.pow(2,t)}Er(){var t=this._instance.getPersistedProperty(Ct.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return e((function*(){i.pr();var e=i.flush().catch((()=>{}));void 0!==t?yield Promise.race([e,new Promise((e=>Ei(e,t)))]):yield e}))()}flushWithTimeout(t){var i=this;return e((function*(){var e=!1,r=i.flush(),s=new Promise((i=>Ei((()=>{e=!0,i()}),t)));try{yield Promise.race([r,s])}finally{e&&r.catch((()=>{}))}}))()}gr(){this.flush().then((()=>{this.nr=0}),(t=>{this.nr++,this.Qt.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.Er()&&this.Cr(this.Tr())}))}pr(){this.Ir&&(clearTimeout(this.Ir),this.Ir=void 0)}};var Mi,Ai,Di;function ji(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return Di&&i.length===Ai||(Ai=i.length,Di=i.reduce(((i,r)=>{Mi||(Mi={});var s=Mi[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,Mi[r]=[l,u];break}}return i}),{})),Di}}class Li{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&&Kt(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:ji(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 zi="?";function Ni(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?zi:i,in_app:!0};return Zt(r)||(n.lineno=r),Zt(s)||(n.colno=s),n}var Ui=(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]:zi,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},Bi=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Hi=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,qi=/\((\S*)(?::(\d+))(?::(\d+))\)/,Gi=(t,e)=>{var i=Bi.exec(t);if(i){var[,r,s,n]=i;return Ni(e,r,zi,+s,+n)}var o=Hi.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=qi.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=Ui(o[1]||zi,o[2]);return Ni(e,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Vi=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Wi=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ji=(t,e)=>{var i=Vi.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=Wi.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]||zi;return[n,s]=Ui(n,s),Ni(e,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Ki=/\(error: (.*)\)/;class Yi{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=te(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 de(t,"DOMException")}isDOMError(t){return de(t,"DOMError")}}class Xi{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 Qi{constructor(){}match(t){return de(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 Zi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class tr{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(Zi);return r&&(e=r[1],i=r[2]),[e,i]}}var er=["fatal","error","warning","log","info","debug"];function ir(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 rr{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 ve(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: "+ir(t)}isSeverityLevel(t){return te(t)&&!ee(t)&&er.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(ki(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class sr{match(t){return ve(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+ir(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class nr{match(t){return he(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 or{match(t){return de(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!ve(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 he(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 ar="$message",lr="$timestamp",ur=new Set([ar,lr]),hr={enabled:!0,max_bytes:32768};function dr(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:hr.enabled,max_bytes:cr(t.max_bytes,hr.max_bytes)}:i({},hr)}class vr{constructor(t){this.Mr=[],this.Rr=0,this.Dt=dr(t)}setConfig(t){this.Dt=dr(t),this.Pr()}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(!Xt(i))return;var r=i,s=r[ar],n=r[lr];if(!te(s)||0===s.trim().length)return;if(!te(n)&&!se(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.Dt.max_bytes||(this.Mr.push({step:e.step,bytes:i}),this.Rr+=i,this.Pr())}}getAttachable(){return this.Mr.map((t=>t.step))}clear(){this.Mr=[],this.Rr=0}size(){return this.Mr.length}Pr(){for(;this.Rr>this.Dt.max_bytes&&this.Mr.length>0;){var t=this.Mr.shift();t&&(this.Rr-=t.bytes)}}}function cr(t,e){if(!se(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var fr=function(t,e){var{debugEnabled:i}=void 0===e?{}:e,r={k(e){if(gt&&(n.DEBUG||$t.POSTHOG_DEBUG||i)&&!Zt(gt.console)&&gt.console){for(var r=("__rrweb_original__"in gt.console[e]?gt.console[e].__rrweb_original__:gt.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)}},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.k("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.k("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.k("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.k("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)=>fr(t+" "+e,i)};return r},pr=fr("[PostHog.js]"),gr=pr.createLogger;function _r(t,e){Kt(t)&&t.forEach(e)}function mr(t,e){if(!re(t))if(Kt(t))t.forEach(e);else if(ae(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)Wt.call(t,i)&&e(t[i],i)}var yr=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 br(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 wr=function(t){try{return t()}catch(t){return}},xr=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){pr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),pr.critical(t)}}},Sr=function(t){var e={};return mr(t,(function(t,i){(te(t)&&t.length>0||se(t))&&(e[i]=t)})),e};var Er=["herokuapp.com","vercel.app","netlify.app"];function kr(t){var e=null==t?void 0:t.hostname;if(!te(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of Er)if(i===r)return!1;return!0}function $r(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 Pr(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 se(t)&&isFinite(t)&&Math.floor(t)===t});class Tr{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 Tr(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 Tr(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 Rr{constructor(){this.S=0,this.C=0,this.I=new Fr}generate(){var t=this.generateOrAbort();if(Zt(t)){this.S=0;var e=this.generateOrAbort();if(Zt(e))throw new Error("Could not generate UUID after timestamp reset");return e}return t}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.M();else{if(this.S>=t+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.M())}return Tr.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}M(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var Ir,Cr=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};gt&&!Zt(gt.crypto)&&crypto.getRandomValues&&(Cr=t=>crypto.getRandomValues(t));class Fr{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||(Cr(this.R),this.O=0),this.R[this.O++]}}var Or=()=>Mr().toString(),Mr=()=>(Ir||(Ir=new Rr)).generate(),Ar="",Dr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var jr={N:()=>!!yt,D(t){pr.error("cookieStore error: "+t)},P(t){if(yt){try{for(var e=t+"=",i=yt.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}},F(t){var e;try{e=JSON.parse(jr.P(t))||{}}catch(t){}return e},A(t,e,i,r,s){if(!yt)return!1;try{var n="",o="",a=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=yt),Ar)return Ar;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_"+Or();!Ar&&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",Ar=n)}return Ar}(t);if(!i){var r=(t=>{var e=t.match(Dr);return e?e[0]:""})(t);r!==i&&pr.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(yt.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&&pr.warn("cookieStore warning: large cookie, len="+u.length),yt.cookie=u,!0}catch(t){return!1}},q(t,e){if(null!=yt&&yt.cookie)try{jr.A(t,"",-1,e)}catch(t){return}}},Lr=null,zr={N(){if(!ie(Lr))return Lr;var t=!0;if(Zt(gt))t=!1;else try{var e="__mplssupport__";zr.A(e,"xyz"),'"xyz"'!==zr.P(e)&&(t=!1),zr.q(e)}catch(e){t=!1}return t||pr.error("localStorage unsupported; falling back to cookie store"),Lr=t,t},D(t){pr.error("localStorage error: "+t)},P(t){try{return null==gt?void 0:gt.localStorage.getItem(t)}catch(t){zr.D(t)}return null},F(t){try{return JSON.parse(zr.P(t))||{}}catch(t){}return null},A(t,e){try{return null==gt||gt.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){zr.D(t)}return!1},q(t){try{null==gt||gt.localStorage.removeItem(t)}catch(t){zr.D(t)}}},Nr=[a,"distinct_id",k,P,Q,X,V],Ur={},Br={N:()=>!0,D(t){pr.error("memoryStorage error: "+t)},P:t=>Ur[t]||null,F:t=>Ur[t]||null,A:(t,e)=>(Ur[t]=e,!0),q(t){delete Ur[t]}},Hr=null,qr={N(){if(!ie(Hr))return Hr;if(Hr=!0,Zt(gt))Hr=!1;else try{var t="__support__";qr.A(t,"xyz"),'"xyz"'!==qr.P(t)&&(Hr=!1),qr.q(t)}catch(t){Hr=!1}return Hr},D(t){pr.error("sessionStorage error: ",t)},P(t){try{return null==gt?void 0:gt.sessionStorage.getItem(t)}catch(t){qr.D(t)}return null},F(t){try{return JSON.parse(qr.P(t))||null}catch(t){}return null},A(t,e){try{return null==gt||gt.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){qr.D(t)}return!1},q(t){try{null==gt||gt.sessionStorage.removeItem(t)}catch(t){qr.D(t)}}};class Gr{constructor(t){this._instance=t}get Dt(){return this._instance.config}get consent(){return this.Lr()?0:this.Ar}isOptedOut(){return this.Dt.cookieless_mode===ot||this.isRejected()||-1===this.consent&&this.Dt.cookieless_mode===nt}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Dt.opt_out_capturing_by_default}optInOut(t){this.Fr.A(this.Nr,t?1:0,this.Dt.cookie_expiration,this.Dt.cross_subdomain_cookie,this.Dt.secure_cookie)}reset(){this.Fr.q(this.Nr,this.Dt.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 Ar(){var t=this.Fr.P(this.Nr);return fe(t)?1:Ht(pe,t)?0:-1}get Fr(){var t=this.Dt.opt_out_capturing_persistence_type,e="localStorage"===t?zr:jr;if(!this.Dr||this.Dr!==e){this.Dr=e;var i="localStorage"===t?jr:zr;i.P(this.Nr)&&(this.Dr.P(this.Nr)||this.optInOut(fe(i.P(this.Nr))),i.q(this.Nr,this.Dt.cross_subdomain_cookie))}return this.Dr}Lr(){return!!this.Dt.respect_dnt&&[null==mt?void 0:mt.doNotTrack,null==mt?void 0:mt.msDoNotTrack,$t.doNotTrack].some((t=>fe(t)))}}var Vr=1,Wr=3,Jr=11;function Kr(t){return t instanceof Element&&(t.id===Z||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Yr(t){return!!t&&t.nodeType===Vr}function Xr(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Qr(t){return!!t&&t.nodeType===Wr}function Zr(t){return!!t&&t.nodeType===Jr&&Yr(t.host)}function ts(t){return t?qt(t).split(/\s+/):[]}function es(t){var e=null==gt?void 0:gt.location.href;return!!(e&&t&&t.some((t=>e.match(t))))}function is(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 ts(e)}function rs(t){return re(t)?null:qt(t).split(/(\s+)/).filter((t=>$s(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ss(t){var e="";return ms(t)&&!ys(t)&&t.childNodes&&t.childNodes.length&&mr(t.childNodes,(function(t){var i;Qr(t)&&t.textContent&&(e+=null!==(i=rs(t.textContent))&&void 0!==i?i:"")})),qt(e)}function ns(t){return Zt(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var os=["a","button","form","input","select","textarea","label"];function as(t,e){if(Zt(e))return!0;var i,r=function(t){if(e.some((e=>function(t,e){var i=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!i&&i.call(t,e)}catch(t){return!1}}(t,e))))return{v:!0}};for(var s of t)if(i=r(s))return i.v;return!1}function ls(t){var e=t.parentNode;return!(!e||!Yr(e))&&e}var us=[".ph-no-autocapture","[data-ph-no-autocapture]"],hs=["next","previous","prev",">","<"],ds=[...hs,"+","-","−","–"],vs=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,cs=[".ph-no-rageclick",".ph-no-capture"],fs=["","text","search","email","password","url","tel","number"];function ps(t,e){if(!gt||gs(t))return!1;var i,r,s,n,o;if(oe(e)?(i=!!e&&cs,r=void 0,s=!1):(i=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:cs,r=null==e?void 0:e.content_ignorelist,s=null!==(o=null==e?void 0:e.ignore_text_selection)&&void 0!==o&&o),!1===i)return!1;if(s&&function(t){return!(!t||!Yr(t))&&(!!Xr(t,"textarea")||(Xr(t,"input")?Ht(fs,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var e=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===e||""===e}(t)))}(t))return!1;var{targetElementList:a}=_s(t,!1);return!function(t,e){if(!1===t||Zt(t))return!1;var i;if(!0===t)i=hs;else{if(!Kt(t))return!1;if(t.length>10)return pr.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=>vs(e,t)||vs(r,t)))}))}(r,a.map((t=>{var e;return{safeText:ss(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!as(a,i)}var gs=t=>!t||Xr(t,"html")||!Yr(t),_s=(t,e)=>{if(!gt||gs(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[t],s=t;s.parentNode&&!Xr(s,"body");)if(Zr(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=ls(s);if(!n)break;if(e||os.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var o=gt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function ms(t){for(var e=t;e.parentNode&&!Xr(e,"body");e=e.parentNode){var i=is(e);if(Ht(i,"ph-sensitive")||Ht(i,"ph-no-capture"))return!1}if(Ht(is(t),"ph-include"))return!0;var r=t.type||"";if(te(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!te(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 ys(t){return!!(Xr(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Xr(t,"select")||Xr(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var bs="(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})",ws=new RegExp("^(?:"+bs+")$"),xs=new RegExp(bs),Ss="\\d{3}-?\\d{2}-?\\d{4}",Es=new RegExp("^("+Ss+")$"),ks=new RegExp("("+Ss+")");function $s(t,e){if(void 0===e&&(e=!0),re(t))return!1;if(te(t)){if(t=qt(t),(e?ws:xs).test((t||"").replace(/[- ]/g,"")))return!1;if((e?Es:ks).test(t))return!1}return!0}function Ps(t){var e=ss(t);return $s(e=(e+" "+Ts(t)).trim())?e:""}function Ts(t){var e="";return t&&t.childNodes&&t.childNodes.length&&mr(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=ss(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Ts(t)).trim())}catch(t){pr.error("[AutoCapture]",t)}})),e}function Rs(t){return t.replace(/"|\\"/g,'\\"')}function Is(t){var e=t.attr__class;return e?Kt(e)?e:ts(e):void 0}var Cs=gr("[Dead Clicks]"),Fs=()=>!0,Os=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(g)),r=t.instance.config.capture_dead_clicks;return oe(r)?r:!!Xt(r)||i};class Ms{get lazyLoadedDeadClicksAutocapture(){return this.$r}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({[g]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.qr((()=>{this.jr()})):this.stop()}qr(t){var e,i;null!=(e=$t.__PosthogExtensions__)&&e.initDeadClicksAutocapture?t():null==(i=$t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?Cs.error("failed to load script",e):t()}))}jr(){var t;if(yt){if(!this.$r&&null!=(t=$t.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=Xt(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};e.__onCapture=this.onCapture,this.$r=$t.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.$r.start(yt),Cs.info("starting...")}}else Cs.error("`document` not found. Cannot start.")}stop(){this.$r&&(this.$r.stop(),this.$r=void 0,Cs.info("stopping..."))}}var As=gr("[SegmentIntegration]");var Ds="posthog-js";function js(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 f,p=(null==(l=e.exception)?void 0:l.values)||[],g=p.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}))),_={$exception_message:(null==(u=p[0])?void 0:u.value)||e.message,$exception_type:null==(h=p[0])?void 0:h.type,$exception_level:e.level,$exception_list:g,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||e.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:e.tags};return r&&s&&(_.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+e.event_id),a&&(null==(f=t.exceptions)||f.sendExceptionEvent(_)),e}}class Ls{constructor(t,e,i,r,s,n){this.name=Ds,this.setupOnce=function(o){o(js(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class zs{constructor(t){this.Br=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(pr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Hr=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Ur()}Ur(){var t;this.zr=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Br)}destroy(){var t;null==(t=this.zr)||t.call(this),this.zr=void 0}doPageView(t,e){var i,r=this.Vr(t,e);return this.Hr={pathname:null!==(i=null==gt?void 0:gt.location.pathname)&&void 0!==i?i:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var e;return this.Vr(t,null==(e=this.Hr)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Hr)?void 0:t.pageViewId}}Vr(t,e){var i=this.Hr;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(!(Zt(n)||Zt(o)||Zt(a)||Zt(l)||Zt(u)||Zt(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?ge(o/n,0,1,pr):1,v=n>1?ge(a/n,0,1,pr):1,c=l>1?ge(u/l,0,1,pr):1,f=l>1?ge(h/l,0,1,pr):1;r=yr(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:f})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var Ns=["flags","surveys"],Us={[o]:{exposure:"hidden"},[l]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[u]:{exposure:"hidden"},[h]:{exposure:"event"},[d]:{exposure:"hidden"},[v]:{exposure:"event"},[c]:{exposure:"hidden"},[f]:{exposure:"event"},[p]:{exposure:"event"},[g]:{exposure:"event"},[_]:{exposure:"hidden"},[m]:{exposure:"event"},[y]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[k]:{exposure:"hidden"},[P]:{exposure:"event"},[b]:{exposure:"event",shouldSkipFromEventProperties:t=>ie(t)},$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"},$sess_rec_flush_size:{exposure:"hidden"},[T]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!Xt(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",storageGroup:"flags"},[I]:{exposure:"hidden"},[C]:{exposure:"hidden",storageGroup:"flags"},[F]:{exposure:"event",storageGroup:"flags"},[O]:{exposure:"event",storageGroup:"flags",volatile:!0},[M]:{exposure:"event"},[A]:{exposure:"hidden"},[D]:{exposure:"hidden"},[j]:{exposure:"hidden"},[L]:{exposure:"hidden",storageGroup:"surveys"},[z]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[N]:{exposure:"event"},[U]:{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"},[B]:{exposure:"hidden"},[H]:{exposure:"hidden"},[q]:{exposure:"hidden"},[G]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[V]:{exposure:"hidden"},[W]:{exposure:"hidden"},[J]:{exposure:"hidden"},[K]:{exposure:"hidden"},[Y]:{exposure:"hidden"},[X]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[w]:{exposure:"event"},[x]:{exposure:"event"},[S]:{exposure:"event"},[E]:{exposure:"event"},[et]:{exposure:"event"},[it]:{exposure:"event"},[rt]:{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"}},Bs=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Hs=t=>{var e=Us[t];if(e)return e;for(var[i,r]of Bs)if(0===t.indexOf(i))return r},qs=t=>{var e=null==yt?void 0:yt.createElement("a");return Zt(e)?null:(e.href=t,e)},Gs=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(!Kt(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){pr.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Vs=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("=");Kt(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},Ws=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},Js="https?://(.*)",Ks=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ys=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ks],Xs="<masked>",Qs=["li_fat_id"];function Zs(t,e,i){if(!yt)return{};var r,s=e?[...Ks,...i||[]]:[],n=tn(Vs(yt.URL,s,Xs),t),o=(r={},mr(Qs,(function(t){var e=jr.P(t);r[t]=e||null})),r);return yr(o,n)}function tn(t,e){var i=Ys.concat(e||[]),r={};return mr(i,(function(e){var i=Gs(t,e);r[e]=i||null})),r}function en(t){var e=function(t){return t?0===t.search(Js+"google.([^/?]*)")?"google":0===t.search(Js+"bing.com")?"bing":0===t.search(Js+"yahoo.com")?"yahoo":0===t.search(Js+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",r={};if(!ie(e)){r.$search_engine=e;var s=yt?Gs(yt.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function rn(){return navigator.language||navigator.userLanguage}var sn="$direct";function nn(){return(null==yt?void 0:yt.referrer)||sn}function on(t,e){var i=t?[...Ks,...e||[]]:[],r=null==bt?void 0:bt.href.substring(0,1e3);return{r:nn().substring(0,1e3),u:r?Vs(r,i,Xs):void 0}}function an(t){var e,{r:i,u:r}=t,s={$referrer:i,$referring_domain:null==i?void 0:i==sn?sn:null==(e=qs(i))?void 0:e.host};if(r){s.$current_url=r;var n=qs(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=tn(r);yr(s,o)}if(i){var a=en(i);yr(s,a)}return s}function ln(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function un(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var hn={flags:G,surveys:z},dn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],vn="main";class cn{constructor(t,e,r){if(void 0===r&&(r=!0),this.Wr={},this.Gr=!1,this.Zr=!1,this.Dt=t,this.Qr=r,this.props={},this.Jr=!1,this.Kr=(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.Fr=this.Yr(t),this.Zr=this.Xr(t),this.load(),t.debug&&pr.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save(),gt){var s=()=>this.flush();$r(gt,"beforeunload",s,{capture:!1}),$r(gt,"pagehide",s,{capture:!1})}}ei(){var t,e=null==(t=this.Dt)?void 0:t.persistence_save_debounce_ms;return se(e)&&e>0?e:0}isDisabled(){return!!this.ti}Yr(t){-1===dn.indexOf(t.persistence.toLowerCase())&&(pr.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var e,r=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=!1);var r=[...Nr,...t];return i({},zr,{F(t){try{var i={};try{i=jr.F(t)||{}}catch(t){}var r,s=JSON.parse(zr.P(t)||"{}");if(e){var n={};for(var o in i){var a=i[o];ie(a)||""===a||(n[o]=a)}r=yr(s,n)}else r=yr(i,s);return zr.A(t,r),r}catch(t){}return null},A(t,e,i,s,n,o){var a=zr.A(t,e,void 0,void 0,o);try{var l={};r.forEach((t=>{e[t]&&(l[t]=e[t])})),Object.keys(l).length&&jr.A(t,l,i,s,n,o)}catch(t){zr.D(t)}return a},q(t,e){try{null==gt||gt.localStorage.removeItem(t),jr.q(t,e)}catch(t){zr.D(t)}}})}(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&zr.N()?(e=zr,s=!0):"localstorage+cookie"===n&&r.N()?(e=r,s=!0):"sessionstorage"===n&&qr.N()?e=qr:"memory"===n?e=Br:"cookie"===n?e=jr:r.N()?(e=r,s=!0):e=jr,this.Gr=s,e}ri(t){return this.Kr+"__"+t}Xr(t){return this.Gr&&!!t.split_storage}ii(t){var e=null!=t?t:this.Dt.feature_flag_cache_ttl_ms;if(!e||0>=e)return!1;var i=this.props[G];return!i||"number"!=typeof i||Date.now()-i>e}properties(){var t={};return mr(this.props,((e,i)=>{var r=Hs(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,i===T?()=>this.ii():()=>!1))return;r.transformToEventProperties&&yr(t,r.transformToEventProperties(e))}else if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,(()=>!1)))return;t[i]=e}})),t}load(){if(!this.ti){var t=this.Fr.F(this.Kr);t&&(this.props=yr({},t)),this.Zr&&this.ni()}}ni(){for(var t of Ns){var e=zr.F(this.ri(t));if(e&&!Qt(e)){var i=this.si(t);i.persisted=!0,this.oi(t)||(i.fingerprint=this.ai(e,t)),this.li(t,e)||yr(this.props,e)}}}oi(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=Hs(e))?void 0:i.storageGroup)===t}))}li(t,e){var i=hn[t];if(!i)return!1;var r=e[i],s=this.props[i];return se(r)&&se(s)&&s>r}refreshKey(t){var e;if(!this.ti){var i=this.Zr?null==(e=Hs(t))?void 0:e.storageGroup:void 0,r=i?zr.F(this.ri(i)):this.Fr.F(this.Kr);if(r&&t in r)this.ui(t,r[t]);else{if(i){var s=this.Fr.F(this.Kr);if(s&&t in s)return void this.ui(t,s[t])}this.hi(t)}}}save(){if(!this.ti){var t=this.ei();t>0?Zt(this.ci)&&(this.ci=setTimeout((()=>{this.ci=void 0,this.di()}),t)):this.di()}}flush(){Zt(this.ci)||(clearTimeout(this.ci),this.ci=void 0,this.di())}di(){this.ti||(this.Zr?this.vi():this.fi(this.Fr,this.Kr,this.props,vn))}vi(){var{main:t,groups:e}=this.pi();for(var i of(this.fi(this.Fr,this.Kr,t,vn),Ns)){var r,s=e[i];(!Qt(s)||null!=(r=this.Wr[i])&&r.persisted)&&this.fi(zr,this.ri(i),s,i)}}pi(){var t={},e={};for(var i of Ns)e[i]={};return mr(this.props,((i,r)=>{var s,n=null==(s=Hs(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}ai(t,e){if(e===vn)return JSON.stringify(t)+"|"+this.gi+"|"+this.mi+"|"+this.yi;var i={};return mr(t,((t,e)=>{var r;i[e]=null!=(r=Hs(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}fi(t,e,i,r){var s=this.si(r);if(r===vn||s.dirty||Zt(s.fingerprint)){var n;try{if((n=this.ai(i,r))===s.fingerprint)return void(s.dirty=!1)}catch(t){n=void 0}t.A(e,i,this.gi,this.mi,this.yi,this.Dt.debug)?(s.dirty=!1,r!==vn&&(s.persisted=!0),Zt(n)||(s.fingerprint=n)):this.Dt.debug&&pr.warn('failed to persist storage entry "'+e+'"; will retry on next save')}}remove(t){var{keepGroupEntries:e=!1}=void 0===t?{}:t;if(Zt(this.ci)||(clearTimeout(this.ci),this.ci=void 0),this.Fr.q(this.Kr,!1),this.Fr.q(this.Kr,!0),!e&&this.Qr)for(var i of Ns)zr.q(this.ri(i));e?delete this.Wr[vn]:this.Wr={}}clear(){this.remove(),this.props={}}register_once(t,e,i){if(Xt(t)){Zt(e)&&(e="None"),this.gi=Zt(i)?this.bi:i;var r=!1;if(mr(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.ui(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(Xt(t)){this.gi=Zt(e)?this.bi:e;var i=!1;if(mr(t,((e,r)=>{t.hasOwnProperty(r)&&this.props[r]!==e&&(this.ui(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.hi(t),this.save())}update_campaign_params(){if(!this.Jr){var t=Zs(this.Dt.custom_campaign_params,this.Dt.mask_personal_data_properties,this.Dt.custom_personal_data_properties);Qt(Sr(t))||this.register(t),this.Jr=!0}}update_search_keyword(){var t;this.register((t=null==yt?void 0:yt.referrer)?en(t):{})}update_referrer_info(){var t;this.register_once({$referrer:nn(),$referring_domain:null!=yt&&yt.referrer&&(null==(t=qs(yt.referrer))?void 0:t.host)||sn},void 0)}set_initial_person_info(){this.props[K]||this.props[Y]||this.register_once({[X]:on(this.Dt.mask_personal_data_properties,this.Dt.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};mr([Y,K],(e=>{var i=this.props[e];i&&mr(i,(function(e,i){t["$initial_"+Gt(i)]=e}))}));var e,i,r=this.props[X];if(r){var s=(e=an(r),i={},mr(e,(function(t,e){i["$initial_"+Gt(e)]=t})),i);yr(t,s)}return t}safe_merge(t){return mr(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){this.bi=this.gi=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var r=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||[]),s=r?this.Yr(t):this.Fr,n=this.Xr(t);if(r||n!==this.Zr){var o=this.props;this.clear(),this.Fr=s,this.Zr=n,this.props=o,this.save()}}set_disabled(t){this.ti=t,this.ti?this.remove():this.save()}set_cross_subdomain(t){t!==this.mi&&(this.mi=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.yi&&(this.yi=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[u]||{};i[t]=e,this.ui(u,i),this.save()}remove_event_timer(t){var e=this.props[u]||{},i=e[t];return Zt(i)||(delete e[t],this.ui(u,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.ui(t,e),this.save()}ui(t,e){var i;this.props[t]=e,null!=(i=Hs(t))&&i.volatile||this.wi(t)}hi(t){delete this.props[t],this.wi(t)}wi(t){var e,i=null==(e=Hs(t))?void 0:e.storageGroup;i&&(this.si(i).dirty=!0)}si(t){return this.Wr[t]||(this.Wr[t]={})}}var fn="events",pn="cancelEvents",gn="survey shown",_n="survey dismissed",mn="survey sent",yn="popover",bn=gr("[RateLimiter]");class wn{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=>{bn.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void bn.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(J))&&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(J,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var xn=gr("[RemoteConfig]");class Sn{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=$t._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}xi(t){var e,i;null!=(e=$t.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=$t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}ki(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 xn.info("Using preloaded remote config",this.remoteConfig),this.Si(this.remoteConfig),void this.Ci();if(this._instance.Ii())return void xn.warn("Remote config is disabled. Falling back to local config.");this.xi((t=>{if(!t)return xn.info("No config found after loading remote JS config. Falling back to JSON."),void this.ki((t=>{this.Si(t),this.Ci()}));this.Si(t),this.Ci()}))}catch(t){xn.error("Error loading remote config",t)}}stop(){this.Ti&&(clearInterval(this.Ti),this.Ti=void 0)}refresh(){!this._instance.Ii()&&yt&&"hidden"!==yt.visibilityState&&this._instance.reloadFeatureFlags()}Ci(){var t;if(!this.Ti){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.Ti=setInterval((()=>{this.refresh()}),e))}}Si(t){var e;t||xn.error("Failed to fetch remote config from PostHog."),this._instance.Si(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 En="gzip-js",kn="base64",$n=Uint8Array,Pn=Uint16Array,Tn=Uint32Array,Rn=new $n([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]),In=new $n([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]),Cn=new $n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fn=function(t,e){for(var i=new Pn(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Tn(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]},On=Fn(Rn,2),Mn=On[1];On[0][28]=258,Mn[258]=28;for(var An=Fn(In,0)[1],Dn=new Pn(32768),jn=0;32768>jn;++jn){var Ln=(43690&jn)>>>1|(21845&jn)<<1;Dn[jn]=((65280&(Ln=(61680&(Ln=(52428&Ln)>>>2|(13107&Ln)<<2))>>>4|(3855&Ln)<<4))>>>8|(255&Ln)<<8)>>>1}var zn=function(t,e,i){for(var r=t.length,s=0,n=new Pn(e);r>s;++s)++n[t[s]-1];var o,a=new Pn(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Pn(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[Dn[d]>>>l]=u}else for(o=new Pn(r),s=0;r>s;++s)o[s]=Dn[a[t[s]-1]++]>>>15-t[s];return o},Nn=new $n(288);for(jn=0;144>jn;++jn)Nn[jn]=8;for(jn=144;256>jn;++jn)Nn[jn]=9;for(jn=256;280>jn;++jn)Nn[jn]=7;for(jn=280;288>jn;++jn)Nn[jn]=8;var Un=new $n(32);for(jn=0;32>jn;++jn)Un[jn]=5;var Bn=zn(Nn,9,0),Hn=zn(Un,5,0),qn=function(t){return(t/8>>0)+(7&t&&1)},Gn=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Pn?Pn:t instanceof Tn?Tn:$n)(i-e);return r.set(t.subarray(e,i)),r},Vn=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},Wn=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},Jn=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 $n(0),0];if(1==s){var o=new $n(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 Pn(v+1),f=Kn(i[h-1],c,0);if(f>e){r=0;var p=0,g=f-e,_=1<<g;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;p+=_-(1<<f-c[m]),c[m]=e}for(p>>>=g;p>0;){var y=n[r].s;e>c[y]?p-=1<<e-c[y]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;c[b]==e&&(--c[b],++p)}f=e}return[new $n(c),f]},Kn=function(t,e,i){return-1==t.s?Math.max(Kn(t.l,e,i+1),Kn(t.r,e,i+1)):e[t.s]=i},Yn=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Pn(++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]},Xn=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},Qn=function(t,e,i){var r=i.length,s=qn(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)},Zn=function(t,e,i,r,s,n,o,a,l,u,h){Vn(e,h++,i),++s[256];for(var d=Jn(s,15),v=d[0],c=d[1],f=Jn(n,15),p=f[0],g=f[1],_=Yn(v),m=_[0],y=_[1],b=Yn(p),w=b[0],x=b[1],S=new Pn(19),E=0;m.length>E;++E)S[31&m[E]]++;for(E=0;w.length>E;++E)S[31&w[E]]++;for(var k=Jn(S,7),P=k[0],T=k[1],R=19;R>4&&!P[Cn[R-1]];--R);var I,C,F,O,M=u+5<<3,A=Xn(s,Nn)+Xn(n,Un)+o,D=Xn(s,v)+Xn(n,p)+o+14+3*R+Xn(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(A>=M&&D>=M)return Qn(e,h,t.subarray(l,l+u));if(Vn(e,h,1+(A>D)),h+=2,A>D){I=zn(v,c,0),C=v,F=zn(p,g,0),O=p;var j=zn(P,T,0);for(Vn(e,h,y-257),Vn(e,h+5,x-1),Vn(e,h+10,R-4),h+=14,E=0;R>E;++E)Vn(e,h+3*E,P[Cn[E]]);h+=3*R;for(var L=[m,w],z=0;2>z;++z){var N=L[z];for(E=0;N.length>E;++E)Vn(e,h,j[U=31&N[E]]),h+=P[U],U>15&&(Vn(e,h,N[E]>>>5&127),h+=N[E]>>>12)}}else I=Bn,C=Nn,F=Hn,O=Un;for(E=0;a>E;++E)if(r[E]>255){var U;Wn(e,h,I[257+(U=r[E]>>>18&31)]),h+=C[U+257],U>7&&(Vn(e,h,r[E]>>>23&31),h+=Rn[U]);var B=31&r[E];Wn(e,h,F[B]),h+=O[B],B>3&&(Wn(e,h,r[E]>>>5&8191),h+=In[B])}else Wn(e,h,I[r[E]]),h+=C[r[E]];return Wn(e,h,I[256]),h+C[256]},to=new Tn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),eo=function(){for(var t=new Tn(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),io=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function ro(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=eo[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 $n(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=Qn(l,u,t.subarray(h,d)):(l[h]=!0,u=Qn(l,u,t.subarray(h,o)))}else{for(var v=to[e-1],c=v>>>13,f=8191&v,p=(1<<i)-1,g=new Pn(32768),_=new Pn(p+1),m=Math.ceil(i/3),y=2*m,b=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<y)&p},w=new Tn(25e3),x=new Pn(288),S=new Pn(32),E=0,k=0,P=(h=0,0),T=0,R=0;o>h;++h){var I=b(h),C=32767&h,F=_[I];if(g[C]=F,_[I]=C,h>=T){var O=o-h;if((E>7e3||P>24576)&&O>423){u=Zn(t,l,0,w,x,S,k,P,R,h-R,u),P=E=k=0,R=h;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)S[M]=0}var A=2,D=0,j=f,L=C-F&32767;if(O>2&&I==b(h-L))for(var z=Math.min(c,O)-1,N=Math.min(32767,h),U=Math.min(258,O);N>=L&&--j&&C!=F;){if(t[h+A]==t[h+A-L]){for(var B=0;U>B&&t[h+B]==t[h+B-L];++B);if(B>A){if(A=B,D=L,B>z)break;var H=Math.min(L,B-2),q=0;for(M=0;H>M;++M){var G=h-L+M+32768&32767,V=G-g[G]+32768&32767;V>q&&(q=V,F=G)}}}L+=(C=F)-(F=g[C])+32768&32767}if(D){w[P++]=268435456|Mn[A]<<18|An[D];var W=31&Mn[A],J=31&An[D];k+=Rn[W]+In[J],++x[257+W],++S[J],T=h+A,++E}else w[P++]=t[h],++x[t[h]]}}u=Zn(t,l,!0,w,x,S,k,P,R,h-R,u)}return Gn(a,0,r+qn(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&&io(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),io(u,h-8,i.d()),io(u,h-4,r),u}var so=!!xt||!!wt,no="text/plain",oo=!1,ao=(t,e)=>{var[i,r]=t.split("#"),[s,n]=i.split("?");if(!n)return t;var o=n.split("&").filter((t=>t.split("=")[0]!==e)).join("&");return s+(o?"?"+o:"")+(r?"#"+r:"")},lo=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 mr(t,(function(t,e){Zt(t)||Zt(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("&")},uo=(t,e)=>JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e),ho=t=>{if(t.Or)return t.Or;var{data:e,compression:i}=t;if(e){if(i===En){var r=ro(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new $n(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 $n(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 Gn(r,0,s)}(uo(e)),{mtime:0});return{contentType:no,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===kn){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(uo(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:uo(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=uo(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},vo=t=>{var e,r,s,n=ho(t);return!n||(r=t.compression,s=Gs(t.url,"compression"),r!==Ft.GZipJS&&s!==Ft.GZipJS&&"gzip"!==s)||((e=n.body)instanceof ArrayBuffer?Dt(new Uint8Array(e)):ArrayBuffer.isView(e)&&Dt(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?{url:t.url,encodedBody:n}:(oo=!0,{url:ao(t.url,"compression"),encodedBody:ho(i({},t,{compression:void 0,Or:void 0}))})},co=function(){var t=e((function*(t){var e=uo(t.data),r=yield function(t,e,i){return Nt.apply(this,arguments)}(e,n.DEBUG,{rethrow:!0});if(!r)return t;var s=yield r.arrayBuffer();return i({},t,{Or:{contentType:no,body:s,estimatedSize:s.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),fo=(t,e)=>lo(t,{_:(new Date).getTime().toString(),ver:n.JS_SDK_VERSION,compression:e}),po=[];wt&&po.push({transport:"fetch",method(t){var e,{url:r,encodedBody:s}=vo(t),{contentType:n,body:o,estimatedSize:a}=null!=s?s:{},l=new Headers;mr(t.headers,(function(t,e){l.append(e,t)})),n&&l.append("Content-Type",n);var u=null;if(St){var h=new St;u={signal:h.signal,timeout:setTimeout((()=>h.abort()),t.timeout)}}wt(r,i({method:(null==t?void 0:t.method)||"GET",headers:l,keepalive:"POST"===t.method&&52428.8>(a||0),body:o,signal:null==(e=u)?void 0:e.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){pr.error(t)}null==t.callback||t.callback(r)})))).catch((e=>{pr.error(e),null==t.callback||t.callback({statusCode:0,error:e})})).finally((()=>u?clearTimeout(u.timeout):null))}}),xt&&po.push({transport:"XHR",method(t){var e=new xt,{url:i,encodedBody:r}=vo(t);e.open(t.method||"GET",i,!0);var{contentType:s,body:n}=null!=r?r:{};mr(t.headers,(function(t,i){e.setRequestHeader(i,t)})),s&&e.setRequestHeader("Content-Type",s),t.timeout&&(e.timeout=t.timeout),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(n)}}),null!=mt&&mt.sendBeacon&&po.push({transport:"sendBeacon",method(t){try{var{url:e,encodedBody:i}=vo(t),{contentType:r,body:s}=null!=i?i:{};if(!s)return;var n=s instanceof Blob?s:new Blob([s],{type:r});mt.sendBeacon(e,n)}catch(t){}}});var go=3e3;class _o{constructor(t,e){this.Ei=!0,this.Mi=[],this.Ri=ge((null==e?void 0:e.flush_interval_ms)||go,250,5e3,pr.createLogger("flush interval"),go),this.Pi=t}enqueue(t){this.Mi.push(t),this.Oi||this.Li()}unload(){this.Ai();var t=this.Mi.length>0?this.Fi():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Pi(i({},t,{transport:"sendBeacon"}))}))}enable(){this.Ei=!1,this.Li()}Li(){var t=this;this.Ei||(this.Oi=setTimeout((()=>{if(this.Ai(),this.Mi.length>0){var e=this.Fi(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&Kt(i.data)&&mr(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Pi(i)};for(var r in e)i()}}),this.Ri))}Ai(){clearTimeout(this.Oi),this.Oi=void 0}Fi(){var t={};return mr(this.Mi,(e=>{var r,s=e,n=(s?s.batchKey:null)||s.url;Zt(t[n])&&(t[n]=i({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this.Mi=[],t}}var mo=["retriesPerformedSoFar"];class yo{constructor(t){this.Ni=!1,this.Di=3e3,this.Mi=[],this._instance=t,this.Mi=[],this.$i=!0,!Zt(gt)&&"onLine"in gt.navigator&&(this.$i=gt.navigator.onLine,this.qi=()=>{this.$i=!0,this.ji()},this.Bi=()=>{this.$i=!1},$r(gt,"online",this.qi),$r(gt,"offline",this.Bi))}get length(){return this.Mi.length}retriableRequest(t){var{retriesPerformedSoFar:e}=t,s=r(t,mo);ne(e)&&(s.url=lo(s.url,{retry_count:e})),this._instance._send_request(i({},s,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.br(i({retriesPerformedSoFar:e},s));0===t.statusCode&&pr.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=e?e:0)+" retries.")}null==s.callback||s.callback(t)}}))}br(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.Mi.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),pr.warn(s),this.Ni||(this.Ni=!0,this.Hi())}Hi(){if(this.Ui&&clearTimeout(this.Ui),0===this.Mi.length)return this.Ni=!1,void(this.Ui=void 0);this.Ui=setTimeout((()=>{this.$i&&this.Mi.length>0&&this.ji(),this.Hi()}),this.Di)}ji(){var t=Date.now(),e=[],i=this.Mi.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.Mi=e,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:t}of(this.Ui&&(clearTimeout(this.Ui),this.Ui=void 0),this.Ni=!1,Zt(gt)||(this.qi&&(gt.removeEventListener("online",this.qi),this.qi=void 0),this.Bi&&(gt.removeEventListener("offline",this.Bi),this.Bi=void 0)),this.Mi))try{this._instance._send_request(i({},t,{transport:"sendBeacon"}))}catch(t){pr.error(t)}this.Mi=[]}}class bo{constructor(t){this.zi=()=>{var t,e,i,r;this.Vi||(this.Vi={});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.Vi.lastScrollY=Math.ceil(n),this.Vi.maxScrollY=Math.max(n,null!==(t=this.Vi.maxScrollY)&&void 0!==t?t:0),this.Vi.maxScrollHeight=Math.max(o,null!==(e=this.Vi.maxScrollHeight)&&void 0!==e?e:0),this.Vi.lastContentY=a,this.Vi.maxContentY=Math.max(a,null!==(i=this.Vi.maxContentY)&&void 0!==i?i:0),this.Vi.maxContentHeight=Math.max(l,null!==(r=this.Vi.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get Wi(){return this._instance.config.scroll_root_selector}getContext(){return this.Vi}resetContext(){var t=this.Vi;return setTimeout(this.zi,0),t}startMeasuringScrollPosition(){$r(gt,"scroll",this.zi,{capture:!0}),$r(gt,"scrollend",this.zi,{capture:!0}),$r(gt,"resize",this.zi)}scrollElement(){if(!this.Wi)return null==gt?void 0:gt.document.documentElement;var t=Kt(this.Wi)?this.Wi:[this.Wi];for(var e of t){var i=null==gt?void 0:gt.document.querySelector(e);if(i)return i}}Gi(t){var e="y"===t?"scrollTop":"scrollLeft";if(this.Wi){var i=this.scrollElement();return i&&i[e]||0}return gt?"y"===t?gt.scrollY||gt.pageYOffset||gt.document.documentElement.scrollTop||0:gt.scrollX||gt.pageXOffset||gt.document.documentElement.scrollLeft||0:0}scrollY(){return this.Gi("y")}scrollX(){return this.Gi("x")}}var wo=t=>on(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class xo{constructor(t,e,i,r){this.Zi=t=>{var e=this.Qi();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Ji(this._instance)};this.Ki.register({[W]:i})}},this._instance=t,this.Yi=e,this.Ki=i,this.Ji=r||wo,this.Yi.onSessionId(this.Zi)}Qi(){return this.Ki.props[W]}getSetOnceProps(){var t,e=null==(t=this.Qi())?void 0:t.props;return e?"r"in e?an(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 mr(Sr(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+Gt(i)]=e})),t}}class So{constructor(){this.Xi={}}on(t,e){return this.Xi[t]||(this.Xi[t]=[]),this.Xi[t].push(e),()=>{this.Xi[t]=this.Xi[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.Xi[t]||[])i(e);for(var r of this.Xi["*"]||[])r(t,e)}}var Eo=gr("[SessionId]");class ko{on(t,e){return this.en.on(t,e)}constructor(t,e,i){var r;if(this.tn=null,this.rn=[],this.nn=void 0,this.sn=!1,this.en=new So,this.an=(t,e)=>!(!ne(t)||!ne(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===ot)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Dt=t.config,this.Ki=t.persistence,this.ln=void 0,this.un=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.hn=e||Or,this.cn=i||Or;var s=this.Dt.persistence_name||this.Dt.token;if(this._sessionTimeoutMs=1e3*ge(this.Dt.session_idle_timeout_seconds||1800,60,36e3,Eo.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.dn(),this.vn="ph_"+s+"_window_id",this.fn="ph_"+s+"_primary_window_exists",this.pn()){var n=qr.F(this.vn),o=qr.F(this.fn);n&&!o?this.ln=n:qr.q(this.vn),qr.A(this.fn,!0)}if(null!=(r=this.Dt.bootstrap)&&r.sessionID)try{var a=(t=>{var e=this.Dt.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.gn(this.Dt.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){Eo.error("Invalid sessionID in bootstrap",t)}this.mn()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Zt(this.rn)&&(this.rn=[]),this.rn.push(t),this.un&&t(this.un,this.ln),()=>{this.rn=this.rn.filter((e=>e!==t))}}pn(){return"memory"!==this.Dt.persistence&&!this.Ki.ti&&qr.N()}yn(t){t!==this.ln&&(this.ln=t,this.pn()&&qr.A(this.vn,t))}bn(){return this.ln?this.ln:this.pn()?qr.F(this.vn):null}_n(t){var e=this.tn;return!ie(e)&&!ie(t)&&5e3>Math.abs(t-e)}gn(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.un||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.un=t,s&&!r||s&&this._n(e)||(this.tn=e,this.Ki.register({[k]:[e,t,i]}))}wn(){var t,e=null==(t=this.Dt)?void 0:t.persistence_save_debounce_ms;return ne(e)&&e>0}xn(){this.wn()?this.Ki.refreshKey(k):(this.Ki.flush(),this.Ki.load())}kn(){var t;if(!ie(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.tn){this.xn();var[,e,i]=this.Sn();e===this.un&&i===this._sessionStartTimestamp&&(this.tn=this._sessionActivityTimestamp,this.Ki.register({[k]:[this._sessionActivityTimestamp,null!==(t=this.un)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Ki.flush())}}Cn(){var[t]=this.Sn(),e=ne(t)?t:0,i=ne(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}In(t){return this.xn(),this.an(t,this.Cn())}Sn(){var t=this.Ki.props[k];return Kt(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.tn=null,clearTimeout(this.Tn),this.Tn=void 0,this.gn(null,null,null)}destroy(){this.sn=!0,this.kn(),clearTimeout(this.Tn),this.Tn=void 0,this.nn&&gt&&(gt.removeEventListener(dt,this.nn,{capture:!1}),this.nn=void 0),this.rn=[]}mn(){this.nn=()=>{this.kn(),this.pn()&&qr.q(this.fn)},$r(gt,dt,this.nn,{capture:!1})}checkAndGetSessionAndWindowId(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=null),this.Dt.cookieless_mode===ot)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=e||(new Date).getTime(),[,r,s]=this.Sn(),n=this.Cn(),o=this.bn(),a=ne(s)&&Math.abs(i-s)>864e5,l=!1,u=!1,h=!r,d=r,v=!h&&!t&&this.an(i,n);v&&((v=this.In(i))||Eo.info("cross-tab refresh kept the session alive",{sessionId:r}),[,r,s]=this.Sn()),h||v||a?(r=this.hn(),o=this.cn(),Eo.info("new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:h,activityTimeout:v,sessionPastMaximumLength:a}}),s=i,l=!0):(o||(o=this.cn(),l=!0),(u=r!==d)&&(Eo.info("adopted cross-tab session id",{sessionId:r,windowId:o}),l=!0));var c=ne(n)&&t&&!a?n:i,f=ne(s)?s:(new Date).getTime();this.yn(o),this.gn(r,c,f),t||this.dn();var p={noSessionId:h,activityTimeout:v,sessionPastMaximumLength:a,crossTabAdoption:u};return l&&this.rn.forEach((t=>t(r,o,p))),{sessionId:r,windowId:o,sessionStartTimestamp:f,changeReason:l?p:void 0,lastActivityTimestamp:n}}dn(){this.sn||(clearTimeout(this.Tn),this.Tn=setTimeout((()=>{if(!this.sn)if(this.In((new Date).getTime())){var t=this.un;this.resetSessionId(),this.en.emit("forcedIdleReset",{idleSessionId:t})}else this.dn()}),1.1*this.sessionTimeoutMs))}}var $o=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&Bt(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>Bt(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver},Po=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 To(t,e,i){return uo({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Ro={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=>Po(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Po(e,t))))),icontains:(t,e)=>e.map(Io).some((e=>t.map(Io).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Io).every((e=>t.map(Io).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)))}))},Io=t=>t.toLowerCase();function Co(t,e){return!t||Object.entries(t).every((t=>{var[i,r]=t,s=null==e?void 0:e[i];if(Zt(s)||ie(s))return!1;var n=[String(s)],o=Ro[r.operator];return!!o&&o(r.values,n)}))}var Fo="custom",Oo="i.posthog.com",Mo=/^\/static\//;class Ao{constructor(t){this.En={},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("."+Oo,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.En[this.apiHost]||(this.En[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":Fo),this.En[this.apiHost]}Mn(t){if(Mo.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)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.Mn(e);if(i)return""+i+e}if(this.region===Fo)return this.apiHost+e;var r=Oo+e;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var Do=gr("[Surveys]"),jo="seenSurvey_",Lo=["popover","widget","api"],zo={ignoreConditions:!1,ignoreDelay:!1,displayType:yn},No=gr("[PostHog ExternalIntegrations]"),Uo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Bo{constructor(t){this._instance=t}qr(t,e){var i;null==(i=$t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return No.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(e){var i,s,n;!r||null!=(i=$t.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]||t.qr(Uo[e],(()=>{var i;null==(i=$t.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[e])||i.start(t._instance)})),!r&&null!=(s=$t.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[e]&&(null==(n=$t.__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 Ho,qo={},Go=0,Vo=()=>{},Wo='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Jo="Surveys module not available",Ko="sanitize_properties is deprecated. Use before_send instead",Yo="Invalid value for property_denylist config: ",Xo="posthog",Qo=!so&&-1===(null==kt?void 0:kt.indexOf("MSIE"))&&-1===(null==kt?void 0:kt.indexOf("Mozilla")),Zo=t=>{var e;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:kr(null==yt?void 0:yt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Vo,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,__preview_cookie_wins_on_conflict:!1,debug:bt&&te(null==bt?void 0:bt.search)&&-1!==bt.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,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==gt||null==(e=gt.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){pr.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:ut,before_send:void 0,request_queue_config:{flush_interval_ms:go},error_tracking:{},_onCapture:Vo},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:ds,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t)}))(t))},ta=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],ea=t=>{var e={};for(var[i,r]of ta)Zt(t[i])||(e[r]=t[i]);var s=yr({},e,t),n=t.__preview_external_dependency_versioned_paths;return Zt(n)||(Zt(t.strict_script_versioning)&&(s.strict_script_versioning=!!n),te(n)&&Zt(t.asset_host)&&(s.asset_host=n)),Kt(t.property_blacklist)&&(Zt(t.property_denylist)?s.property_denylist=t.property_blacklist:Kt(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:pr.error(Yo+t.property_denylist)),s};class ia{constructor(){this.__forceAllowLocalhost=!1}get Rn(){return this.__forceAllowLocalhost}set Rn(t){pr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class ra{Pn(t,e){if(t){var i=this.On.indexOf(t);-1!==i&&this.On.splice(i,1)}return this.On.push(e),null==e.initialize||e.initialize(),e}Ln(){return this.config.cookieless_mode===ot||this.config.cookieless_mode===nt&&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 ia,this.An=!1,this.version=n.LIB_VERSION,this.Fn=new So,this.On=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Zo(),this.SentryIntegration=Ls,this.sentryIntegration=t=>function(t,e){var i=js(t,e);return{name:Ds,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Nn=!1,this.Dn=null,this.$n=null,this.qn=null,this.scrollManager=new bo(this),this.pageViewManager=new zs(this),this.rateLimiter=new wn(this),this.requestRouter=new Ao(this),this.consent=new Gr(this),this.externalIntegrations=new Bo(this);var e=null!==(t=ra.__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=te(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=te(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>pr.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==Xo){var r,s=null!==(r=qo[i])&&void 0!==r?r:new ra;return s._init(t,e,i),qo[i]=s,qo[Xo][i]=s,s}return this._init(t,e,i)}_init(t,e,r){var s,o;void 0===e&&(e={});var a=te(t)?t.trim():"";if(!a)return pr.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.jn(e.debug),this.Bn=e,this.Hn=[],e.person_profiles?this.$n=e.person_profiles:e.process_person&&(this.$n=e.process_person);var l=Zo(e.defaults),u=ea(e),h=yr({},l,u,{name:r,token:a});Xt(l.rageclick)&&Xt(u.rageclick)&&(h.rageclick=yr({},l.rageclick,u.rageclick)),Xt(l.session_recording)&&Xt(u.session_recording)&&(h.session_recording=yr({},l.session_recording,u.session_recording)),this.set_config(h),this.config.on_xhr_error&&pr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:En;var d=this.Un();this.persistence=new cn(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new cn(i({},this.config,{persistence:"sessionStorage"}),d,!1);var v=i({},this.persistence.props),c=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.zn=new _o((t=>this.Vn(t)),this.config.request_queue_config),this.Wn=new yo(this),this.__request_queue=[];var f=this.Ln();if(f||(this.sessionManager=new ko(this),this.sessionPropsManager=new xo(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(pr.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Gn(f)}),0)):(pr.info("Initializing extensions synchronously"),this.Gn(f)),n.DEBUG=n.DEBUG||this.config.debug,n.DEBUG&&pr.info("Starting in debug mode",{this:this,config:e,thisC:i({},this.config),p:v,s:c}),!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 p=e.bootstrap.distinctID,g=this.get_distinct_id(),_=this.persistence.get_property(V);if(e.bootstrap.isIdentifiedID&&null!=g&&g!==p&&_===at)this.identify(p);else if(e.bootstrap.isIdentifiedID&&null!=g&&g!==p&&_===lt)pr.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 m=this.config.get_device_id(Or()),y=e.bootstrap.isIdentifiedID?m:p;this.persistence.set_property(V,e.bootstrap.isIdentifiedID?lt:at),this.register({distinct_id:p,$device_id:y})}}if(f)this.register_once({distinct_id:tt,$device_id:null},"");else if(!this.get_distinct_id()){var b=this.config.get_device_id(Or());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(V,at)}return $r(gt,"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()||Or();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(V,lt)),e()},s=i.user();"then"in s&&Yt(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{Promise&&Promise.resolve||As.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()||(As.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(As.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,vt),identify:t=>e(t,ft),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.Zn())):this.Zn(),Yt(this.config._onCapture)&&this.config._onCapture!==Vo&&(pr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&pr.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Gn(t){var e,r,s,n,o,a,l,u=performance.now(),h=i({},ra.__defaultExtensionClasses,this.config.__extensionClasses),d=[];h.featureFlags&&this.On.push(this.featureFlags=null!==(e=this.featureFlags)&&void 0!==e?e:new h.featureFlags(this)),h.exceptions&&this.On.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new h.exceptions(this)),h.historyAutocapture&&this.On.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.On.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.On.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.On.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.On.push(this.autocapture=new h.autocapture(this)),h.surveys&&this.On.push(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new h.surveys(this)),h.logs&&this.On.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new h.logs(this)),h.conversations&&this.On.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new h.conversations(this)),h.productTours&&this.On.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.On.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.On.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.On.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.On.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,Os)),h.toolbar&&this.On.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new h.toolbar(this)),h.experiments&&this.On.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new h.experiments(this)),this.On.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.Qn){var t=this.Qn;this.Qn=void 0,this.Si(t)}})),this.Jn(d,u)}Jn(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.Jn(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){pr.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[et]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[it]:r}),this.config.__preview_deferred_init_extensions&&pr.info("PostHog extensions initialized ("+r+"ms)")}Si(t){var e;if(!yt||!yt.body)return pr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Si(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Qn=t),this.Kn=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=Ht(t.supportedCompression,En)?En:Ht(t.supportedCompression,kn)?kn:void 0),null!=(e=t.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.$n?this.$n:ut}),this.On.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}Zn(){try{this.config.loaded(this)}catch(t){pr.critical("`loaded` function failed",t)}if(this.Yn(),this.config.internal_or_test_user_hostname&&null!=bt&&bt.hostname){var t=bt.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.Ln())&&this.Xn()}),1),this.es=new Sn(this),this.es.load()}Yn(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.zn)||t.enable())}_dom_loaded(){this.is_capturing()&&_r(this.__request_queue,(t=>this.Vn(t))),this.__request_queue=[],this.Yn()}_handle_unload(){var t,e,i,r;null==(t=this.surveys)||t.handlePageUnload(),this.config.request_batching?(this.ts()&&this.capture(ct),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(i=this.zn)||i.unload(),null==(r=this.Wn)||r.unload()):this.ts()&&this.capture(ct,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?Qo?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=i({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,(Zt(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.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=fo(n.url,n.compression);var o=null!==(e=n.transport)&&void 0!==e?e:"fetch",a=po.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===En&&Et&&!oo?co(n).then((t=>{l(t)})).catch((e=>{if(jt(e))return oo=!0,void l(i({},n,{compression:void 0,url:fo(t.url,void 0)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return jt(t)||e===At})(e)&&(oo=!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)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Vn(t){this.Wn?this.Wn.retriableRequest(t):this._send_request(t)}_execute_array(t){Go++;try{var e,i=[],r=[],s=[];_r(t,(t=>{if(t)if(Kt(e=t[0]))s.push(t);else if(Yt(t))try{t.call(this)}catch(e){pr.error("Error executing queued PostHog call",t,e)}else Kt(t)&&"alias"===e?i.push(t):Kt(t)&&-1!==e.indexOf("capture")&&Yt(this[e])?s.push(t):r.push(t)}));var n=function(t,e){_r(t,(function(t){try{if(Kt(t[0])){var i=e;mr(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){pr.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{Go--}}push(t){if(Go>0&&Kt(t)&&te(t[0])){var e=ra.prototype[t[0]];Yt(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.zn){if(this.is_capturing())if(!Zt(t)&&te(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&&!te(null==e?void 0:e.$current_url)&&(pr.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.rs||pr.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=Si(null==r?void 0:r.uuid,Or),f={uuid:c,event:t,properties:this.calculateEventProperties(t,e||{},v,c)};t===vt&&this.config.__preview_capture_bot_pageviews&&u&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),h&&(f.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens),(null==r?void 0:r.$set)&&(f.$set=null==r?void 0:r.$set);var p=null==r?void 0:r.$unset;p&&(f.$unset=p);var g,_,m,y=this.ns(null==r?void 0:r.$set_once,t!==pt,t===ft);if(y&&(f.$set_once=y),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,o=f,a=t=>te(t)?t.slice(0,n):t,l=new Set,f=function t(e,i){return e!==Object(e)?a?a(e):e:l.has(e)?void 0:(l.add(e),Kt(e)?(r=[],_r(e,(e=>{r.push(t(e))}))):(r={},mr(e,((e,i)=>{l.has(e)||(r[i]=t(e,i))}))),r);var r}(o)),f.timestamp=v,Zt(null==r?void 0:r.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=d),t===_n||t===mn){var b=null==e?void 0:e.$survey_id,w=null==e?void 0:e.$survey_iteration;(t=>{try{var e=(t=>((t,e)=>{var i=""+t+e.id;return e.current_iteration&&e.current_iteration>0&&(i=""+t+e.id+"_"+e.current_iteration),i})(jo,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){Do.error("Failed to persist survey seen state",t)}})({id:b,current_iteration:w}),f.$set=i({},f.$set,{[(g={id:b,current_iteration:w},_=t===mn?"responded":"dismissed",m="$survey_"+_+"/"+g.id,g.current_iteration&&g.current_iteration>0&&(m="$survey_"+_+"/"+g.id+"/"+g.current_iteration),m)]:!0})}else t===gn&&(f.$set=i({},f.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===t){var x=null==e?void 0:e.$product_tour_type;x&&(f.$set=i({},f.$set,{["$product_tour_last_seen_date/"+x]:(new Date).toISOString()}))}var S=i({},f.properties.$set,f.$set);if(Qt(S)||this.setPersonPropertiesForFlags(S),!re(this.config.before_send)){var E=this.mr(f);if(!E)return;(f=E).uuid=Si(f.uuid,Or)}this.Fn.emit("eventCaptured",f);var k={method:"POST",url:null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:f,compression:"best-available",batchKey:null==r?void 0:r._batchKey,transport:null==r?void 0:r.transport};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this.Vn(k):this.zn.enqueue(k),f}pr.critical("This capture call is ignored due to client rate limiting.")}}else pr.error("No event name provided to posthog.capture")}else pr.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.Ln()&&(l.$cookieless_mode=!0),"$snapshot"===t){var u=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!te(l.distinct_id)&&!se(l.distinct_id)||ee(l.distinct_id))&&pr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var h,d=function(t,e,i){var r,s,o,a;if(!kt)return{};var l,u,h,d,v,c,f,p,g,_=t?[...Ks,...e||[]]:[],[m,y]=function(t){for(var e=0;bi.length>e;e++){var[i,r]=bi[e],s=i.exec(t),n=s&&(Yt(r)?r(s,t):r);if(n)return n}return["",""]}(kt),b=null!=(l="undefined"!=typeof navigator?navigator:void 0)&&l.brave?{brave:!0}:{},w={detectGoogleSearchApp:i},x=yr(Sr({$os:m,$os_version:y,$browser:_i(kt,navigator.vendor,b,w),$device:wi(kt),$device_type:(h=kt,d={userAgentDataPlatform:null==(r=navigator)||null==(r=r.userAgentData)?void 0:r.platform,maxTouchPoints:null==(s=navigator)?void 0:s.maxTouchPoints,screenWidth:null==gt||null==(o=gt.screen)?void 0:o.width,screenHeight:null==gt||null==(a=gt.screen)?void 0:a.height,devicePixelRatio:null==gt?void 0:gt.devicePixelRatio},g=wi(h),g===Se||g===xe||"Kobo"===g||"Kindle Fire"===g||g===Ze?we:g===Be||g===qe||g===He||g===Ye?"Console":g===ke?"Wearable":g?me:"Android"===(null==d?void 0:d.userAgentDataPlatform)&&(null!==(v=null==d?void 0:d.maxTouchPoints)&&void 0!==v?v:0)>0?600>Math.min(null!==(c=null==d?void 0:d.screenWidth)&&void 0!==c?c:0,null!==(f=null==d?void 0:d.screenHeight)&&void 0!==f?f:0)/(null!==(p=null==d?void 0:d.devicePixelRatio)&&void 0!==p?p:1)?me:we:"Desktop"),$timezone:ln(),$timezone_offset:un()}),{$current_url:Vs(null==bt?void 0:bt.href,_,Xs),$host:null==bt?void 0:bt.host,$pathname:null==bt?void 0:bt.pathname,$raw_user_agent:kt.length>1e3?kt.substring(0,997)+"...":kt,$browser_version:yi(kt,navigator.vendor,b,w),$browser_language:rn(),$browser_language_prefix:(u=rn(),"string"==typeof u?u.split("-")[0]:void 0),$screen_height:null==gt?void 0:gt.screen.height,$screen_width:null==gt?void 0:gt.screen.width,$viewport_height:null==gt?void 0:gt.innerHeight,$viewport_width:null==gt?void 0:gt.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});return n.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=n.SDK_DIST_CHANNEL),x}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app);if(this.sessionManager){var{sessionId:v,windowId:c}=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime());l.$session_id=v,l.$window_id=c}this.sessionPropsManager&&yr(l,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&yr(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(f=this.Wn)?void 0:f.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Fo&&(l.$lib_custom_api_host=this.config.api_host),h=t!==vt||o?t!==ct||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),l=yr(l,h),t===vt&&yt&&(l.title=yt.title),!Zt(a)){var p=r.getTime()-a;l.$duration=parseFloat((p/1e3).toFixed(3))}kt&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=yr({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),Kt(this.config.property_denylist)?mr(this.config.property_denylist,(function(t){delete l[t]})):pr.error(Yo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(pr.error(Ko),l=g(l,t));var _=this.ss();return l.$process_person_profile=_,_&&!o&&this.os("_calculate_event_properties"),l}ns(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.ss())return t;if(this.An&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=yr({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(pr.error(Ko),o=a(o,"$set_once")),e&&(this.An=!0),Qt(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)}ls(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.Fn.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:Jo}),()=>{})}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:Jo})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:Jo})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=zo),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:Jo}}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:Jo})}us(t){return!t||ee(t)?(pr.critical("Unique user id has not been set in posthog.identify"),!1):t===tt?(pr.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())||(pr.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 pr.uninitializedWarning("posthog.identify");if(se(t)&&(t=t.toString(),pr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.us(t)&&this.os("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(V)||at)===at;t!==r&&n?(this.persistence.set_property(V,lt),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.capture(ft,{distinct_id:t,$anon_distinct_id:r},{$set:e||{},$set_once:i||{}}),this.qn=To(t,e,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(e||i)&&this.setPersonProperties(e,i),t!==r&&(this.reloadFeatureFlags(),this.unregister(B))}}setPersonProperties(t,e){if((t||e)&&this.os("posthog.setPersonProperties")){var i=To(this.get_distinct_id(),t,e);this.qn!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.qn=i):pr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(Kt(t)?t:[t]).filter((t=>te(t)&&t.length>0));0!==i.length&&this.os("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.qn=null)}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(pt,o)}r&&this.setGroupPropertiesForFlags({[t]:r}),n&&!r&&this.reloadFeatureFlags()}else pr.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(t){var e;void 0===t&&(t=!0),null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.os("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,h;if(pr.info("reset"),!this.__loaded)return pr.uninitializedWarning("posthog.reset");var d,v=this.get_property(a),c=this.get_property(y);if(this.consent.reset(),null==(e=this.persistence)||e.clear(),null==(i=this.sessionPersistence)||i.clear(),Zt(c)||null==(d=this.persistence)||d.register({[y]:c}),null==(r=this.surveys)||r.reset(),null==(s=this.es)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(l=this.logs)||l.reset(),null==(u=this.persistence)||u.set_property(V,at),null==(h=this.sessionManager)||h.resetSessionId(),this.qn=null,this.config.cookieless_mode===ot)this.register_once({distinct_id:tt,$device_id:null},"");else{var f=this.config.get_device_id(Or());this.register_once({distinct_id:f,$device_id:t?f:v},"")}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.hs()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.cs()}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)?(pr.critical("Attempting to create alias for existing People user - aborting."),-2):this.os("posthog.alias")?(Zt(e)&&(e=this.get_distinct_id()),t!==e?(this.ls(l,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(pr.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=i({},this.config);if(Xt(t)){var r,s,o,a,l,u,h,d,v,c,f;yr(this.config,ea(t));var p=this.Un();null==(r=this.persistence)||r.update_config(this.config,e,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new cn(i({},this.config,{persistence:"sessionStorage"}),p,!1);var g=this.jn(this.config.debug);oe(g)&&(this.config.debug=g),oe(this.config.debug)&&(this.config.debug?(n.DEBUG=!0,zr.N()&&zr.A("ph_debug",!0),pr.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(n.DEBUG=!1,zr.N()&&zr.q("ph_debug"))),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(h=this.heatmaps)||h.startIfEnabled(),null==(d=this.exceptionObserver)||d.startIfEnabledOrStop(),null==(v=this.deadClicksAutocapture)||v.startIfEnabledOrStop(),null==(c=this.surveys)||c.loadIfEnabled(),this.ds(),null==(f=this.externalIntegrations)||f.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:ra.vs}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:Xo;return e!==Xo&&(e=Xo+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(V))===lt||(null==(e=this.sessionPersistence)?void 0:e.get_property(V))===lt}ss(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===ut&&!this._isIdentified()&&Qt(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[l])&&(null==(e=this.persistence)||null==(e=e.props)||!e[Q]))}ts(){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.ss()||this.os("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.os("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}os(t){return"never"===this.config.person_profiles?(pr.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.ls(Q,!0),!0)}Un(){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!==nt)}ds(){var t,e,i,r,s=this.Un();return(null==(t=this.persistence)?void 0:t.ti)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.ti)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==ot){if(this.Ln()){var i,r,s,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new ko(this),this.pageViewManager=new zs(this),this.persistence&&(this.sessionPropsManager=new xo(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=ra.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.Pn(this.sessionRecording,new l(this)),this.Kn&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Kn)))}var u,h;this.consent.optInOut(!0),this.ds(),this.Yn(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==nt&&(null==(u=this.surveys)||u.loadIfEnabled()),(Zt(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.Xn()}else pr.warn(Wo)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==ot?(this.config.cookieless_mode===nt&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.ds(),this.config.cookieless_mode===nt&&(this.register({distinct_id:tt,$device_id:null}),null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Xn(),this.Yn())):pr.warn(Wo)}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===ot||(this.config.cookieless_mode===nt?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.ds()}_is_bot(){return mt?$o(mt,this.config.custom_blocked_useragents):void 0}Xn(){yt&&("visible"===yt.visibilityState?this.Nn||(this.Nn=!0,this.capture(vt,{title:yt.title},{send_instantly:!0}),this.Dn&&(yt.removeEventListener(ht,this.Dn),this.Dn=null)):this.Dn||(this.Dn=this.Xn.bind(this),$r(yt,ht,this.Dn)))}debug(t){!1===t?(null==gt||gt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==gt||gt.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}))}Ii(){var t,e,i,r,s,n,o=this.Bn||{};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?(pr.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=pr,s=(e="advanced_disable_flags")in(t=o)&&!re(t[e]),n=i in t&&!re(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]))}mr(t){var e;if(re(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(ue),r=Kt(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r){if(s=n(s),re(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return le(t.event)?pr.warn(o+". This can cause unexpected behavior."):pr.info(o),null}s.properties&&!Qt(s.properties)||pr.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of i)if(s.properties&&re(s.properties[a]))return pr.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.Hr)?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)})}jn(t){var e=oe(t)&&!t,i=zr.N()&&"true"===zr.P("ph_debug");return!e&&(!!i||t)}}ra.__defaultExtensionClasses={},ra.vs={trace:Ho=()=>{},debug:Ho,info:Ho,warn:Ho,error:Ho,fatal:Ho},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=xr(t.prototype[e[i]])}(ra,["identify"]);class sa{constructor(t){this.disabled=!1===t;var e=Xt(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 na="$copy_autocapture",oa=gr("[AutoCapture]");function aa(t,e){return e.length>t?e.slice(0,t)+"...":e}function la(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!Yr(e));return e}function ua(t,e){var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=e;if(!Yr(t))return{props:{}};for(var h=[t],d=t;d.parentNode&&!Xr(d,"body");)if(Zr(d.parentNode))h.push(d.parentNode.host),d=d.parentNode.host;else{if(!Yr(d.parentNode))break;h.push(d.parentNode),d=d.parentNode}var v,c,f=[],p={},g=!1,_=!1;if(mr(h,(t=>{var e=ms(t);if(Xr(t,"a")){var i=t.getAttribute("href");g=e&&!!i&&$s(i)&&i}Ht(is(t),"ph-no-capture")&&(_=!0),f.push(function(t,e,i,r){var s=t.tagName.toLowerCase(),n={tag_name:s};os.indexOf(s)>-1&&!i&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?aa(1024,Ps(t)):aa(1024,ss(t)));var o=is(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),mr(t.attributes,(function(i){var s;if((!ys(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&$s(i.value)&&(!te(s=i.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=i.value;"class"===i.name&&(o=ts(o).join(" ")),n["attr__"+i.name]=aa(1024,o)}}));for(var a=1,l=1,u=t;u=la(u);)a++,u.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(t,o,a,l));var r=function(t){if(!ms(t))return{};var e={};return mr(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&&$s(r)&&(e[i]=r)}})),e}(t);yr(p,r)})),_)return{props:{},explicitNoCapture:_};if(a||(f[0].$el_text=Xr(t,"a")||Xr(t,"button")?Ps(t):ss(t)),g){var m,y;f[0].attr__href=g;var b=null==(m=qs(g))?void 0:m.host,w=null==gt||null==(y=gt.location)?void 0:y.host;b&&w&&b!==w&&(v=g)}return{props:yr({$event_type:n.type,$ce_version:1},u?{}:{$elements:f},{$elements_chain:(c=f,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 br(o).sort(((t,e)=>{var[i]=t,[r]=e;return i.localeCompare(r)})).forEach((t=>{var[e,i]=t;return a[Rs(e.toString())]=Rs(i.toString())})),(s+=":")+br(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:Is(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return br(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=f[0])&&r.$el_text?{$el_text:null==(s=f[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},p)}}var ha=gr("[ExceptionAutocapture]"),da=gr("[TracingHeaders]"),va=gr("[Web Vitals]"),ca=9e5,fa="disabled",pa="lazy_loading",ga="awaiting_config",_a="missing_config";gr("[SessionRecording]"),gr("[SessionRecording]");var ma="[SessionRecording]",ya=gr(ma),ba=gr("[Heatmaps]");function wa(t){return Xt(t)&&"clientX"in t&&"clientY"in t&&se(t.clientX)&&se(t.clientY)}var xa=gr("[Product Tours]"),Sa=t=>{var e;return!t.config.disable_product_tours&&!(null==(e=t.persistence)||!e.get_property(_))},Ea=["$set_once","$set"],ka=gr("[SiteApps]"),$a="Error while initializing PostHog app with config id ";function Pa(t,e,i){if(re(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 Ta{constructor(t){this.fs=new So,this.ps=(t,e)=>this.gs(t,e)&&this.ys(t,e)&&this.bs(t,e)&&this._s(t,e),this.gs=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t,this.ws=new Set,this.xs=new Set}init(){var t,e;Zt(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(!Zt(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e,i;null==(e=this.xs)||e.add(t),null==(i=t.steps)||i.forEach((t=>{var e;null==(e=this.ws)||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.ws.has(t)||this.ws.has(null==e?void 0:e.event))&&this.xs&&(null==(i=this.xs)?void 0:i.size)>0&&this.xs.forEach((t=>{this.ks(e,t)&&this.fs.emit("actionCaptured",t.name)}))}Ss(t){this.onAction("actionCaptured",(e=>t(e)))}ks(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.ps(t,i))return!0;return!1}onAction(t,e){return this.fs.on(t,e)}ys(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(!Pa(r,e.url,e.url_matching||"contains"))return!1}return!0}bs(t,e){return!!this.Cs(t,e)&&!!this.Is(t,e)&&!!this.Ts(t,e)}Cs(t,e){var i;if(null==e||!e.href)return!0;var r=this.Es(t);if(r.length>0)return r.some((t=>Pa(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Pa((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}Is(t,e){var i;if(null==e||!e.text)return!0;var r=this.Es(t);if(r.length>0)return r.some((t=>Pa(t.text,e.text,e.text_matching||"exact")||Pa(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;!re(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=>Pa(t,n,o))))}Ts(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}Es(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}_s(t,e){return null==e||!e.properties||0===e.properties.length||Co(e.properties.reduce(((t,e)=>{var i=Kt(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 Ra{constructor(t){this.Ms=[],this._instance=t,this.Rs=new Map,this.Ps=new Map,this.Os=new Map}Ls(t,e){return!!t&&Co(t.propertyFilters,null==e?void 0:e.properties)}As(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}Fs(t,e,i){var r=(i===fn?this.Rs:this.Ps).get(t),s=[];return this.Ns((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.Ls(n,e)}))}register(t){var e;Zt(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.Ds(t),this.$s(t))}$s(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.qs&&(this.qs=new Ta(this._instance),this.qs.init(),this.qs.Ss((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.qs)||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.Os.get(e.name);i&&i.push(t.id),this.Os.set(e.name,i||[t.id])}})))})))}Ds(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.Rs=this.As(t,fn),this.Ps=this.As(t,pn))}onEvent(t,e){var i,r,s=this.ce(),n=(null==e||null==(i=e.properties)?void 0:i.$survey_id)||(null==e||null==(r=e.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this.js(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.Bs([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),void this.Hs(n)}if(this.Ps.has(t)){var a=this.Fs(t,e,pn);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.Bs(a.map((t=>t.id))),a.forEach((t=>this.Us(t.id))))}if(this.Rs.has(t)){s.info("event name matched",{event:t,eventPayload:e,items:this.Rs.get(t)});var l=this.Fs(t,e,fn);this.zs(l.map((t=>t.id)))}}onAction(t){this.Os.has(t)&&this.zs(this.Os.get(t)||[])}zs(t){0!==t.length&&(this.Ms=[...new Set([...this.Ms,...t])],this.ce().info("updating activated items",{activatedItems:this.getActivatedIds()}))}Hs(t){this.Ms=this.Ms.filter((e=>e!==t));var e=this.Vs();e.includes(t)||this.Ws([...e,t])}Bs(t){var e=new Set(t);this.Ms=this.Ms.filter((t=>!e.has(t)));var i=this.Vs(),r=i.filter((t=>!e.has(t)));r.length!==i.length&&this.Ws(r)}Vs(){var t,e=this.Gs();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}getActivatedIds(){return[...new Set([...this.Vs(),...this.Ms])].filter((t=>!this.Zs(t)))}reset(){this.Ms=[],this.Vs().length>0&&this.Ws([])}getEventToItemsMap(){return this.Rs}Qs(){return this.qs}}class Ia extends Ra{constructor(t){super(t)}Gs(){return N}Js(){return gn}Ns(t){var e;null==(e=this._instance)||e.getSurveys(t)}Us(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}ce(){return Do}Ws(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[N]:t})}Zs(){return!1}js(t,e){var i;this.Ns((t=>{i=t.find((t=>t.id===e))}));var r=!i||function(t){var e,i,r,s=(null!==(e=null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)&&void 0!==e?e:0)>0;return"always"===t.schedule||!(null==(r=t.conditions)||null==(r=r.events)||!r.repeatedActivation||!s)}(i);return r?t===gn?"consume":"ignore":t===gn?"persist":t===_n||t===mn?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Ca="SDK is not enabled or survey functionality is not yet loaded",Fa="Disabled. Not loading surveys.",Oa=null!=gt&&gt.location?Ws(gt.location.hash,"__posthog")||Ws(location.hash,"state"):null,Ma="_postHogToolbarParams",Aa=gr("[Toolbar]"),Da=gr("[FeatureFlags]"),ja=gr("[FeatureFlags]",{debugEnabled:!0}),La="\" failed. Feature flags didn't load in time.",za=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},Na=t=>{var e={};for(var[i,r]of br(t||{}))r&&(e[i]=r);return e},Ua=gr("[Error tracking]"),Ba="Refusing to render web experiment since the viewer is a likely bot",Ha={icontains:(t,e)=>!!gt&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!gt&&-1===e.href.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>!!gt&&Po(e.href,t),not_regex:(t,e)=>!!gt&&!Po(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class qa{get Dt(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{qa.Ks("retrieved web experiments from the server"),e.Ys=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.Ys&&(qa.Ks("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.Ys)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);te(r)&&t.variants[r]&&e.Xs(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];qa.eo(n)&&e.Xs(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())qa.Ks(Ba);else if(!this.Dt.disable_web_experiments){if(re(this.Ys))return this.Ys=new Map,this.loadIfEnabled(),void this.previewWebExperiment();qa.Ks("applying feature flags",t),t.forEach((t=>{var e;if(this.Ys&&null!=(e=this.Ys)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.Ys)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.Xs(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=qa.getWindowLocation();if(null!=t&&t.search){var e=Gs(null==t?void 0:t.search,"__experiment_id"),i=Gs(null==t?void 0:t.search,"__experiment_variant");e&&i&&(qa.Ks("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.ro(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.Dt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Dt.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.Dt.token),method:"GET",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}ro(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(qa.Ks("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.Xs(r[0].name,e,r[0].variants[e].transforms))}static eo(t){return!re(t.conditions)&&qa.io(t)&&qa.no(t)}static io(t){var e;if(re(t.conditions)||re(null==(e=t.conditions)?void 0:e.url))return!0;var i,r,s,n=qa.getWindowLocation();return!!n&&(null==(i=t.conditions)||!i.url||Ha[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==gt?void 0:gt.location}static no(t){var e;if(re(t.conditions)||re(null==(e=t.conditions)?void 0:e.utm))return!0;var i=Zs();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,f=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&&f&&v}return!1}static Ks(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];pr.info("[WebExperiments] "+t,i)}Xs(t,e,i){this._is_bot()?qa.Ks(Ba):"control"!==e?i.forEach((i=>{if(i.selector){var r;qa.Ks("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)}))}})):qa.Ks("Control variants leave the page unmodified.")}_is_bot(){return mt&&this._instance?$o(mt,this.Dt.custom_blocked_useragents):void 0}}var Ga=gr("[Conversations]"),Va="Conversations not available yet.",Wa={featureFlags:class{constructor(t){this.so=!1,this.oo=!1,this.ao=!1,this.lo=!1,this.uo=!1,this.ho=!1,this.co=!1,this.do=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Dt(){return this._instance.config}get Ki(){return this._instance.persistence}vo(t){return this._instance.get_property(t)}fo(){var t,e;return null!==(t=null==(e=this.Ki)?void 0:e.ii(this.Dt.feature_flag_cache_ttl_ms))&&void 0!==t&&t}po(){return!!this.fo()&&(this.do||this.ao||(this.do=!0,Da.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}mo(){var t,e=null!==(t=this.Dt.evaluation_contexts)&&void 0!==t?t:this.Dt.evaluation_environments;return!this.Dt.evaluation_environments||this.Dt.evaluation_contexts||this.co||(Da.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.co=!0),null!=e&&e.length?e.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||Da.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}yo(){return this.mo().length>0}bo(){var t=this.Dt.flag_keys;if(!Zt(t)){if(Kt(t))return t.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||Da.error("Invalid flag key found:",t,"Expected non-empty string"),e}));Da.error("Invalid flag_keys found:",t,"Expected array of non-empty strings")}}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,n,o=null!=r&&r.merge&&null!==(s=this.vo(T))&&void 0!==s?s:{},a=null!=r&&r.merge&&null!==(n=this.vo(F))&&void 0!==n?n:{},l=i({},o,t),u=i({},a,e),h={};for(var[d,v]of Object.entries(l))h[d]={key:d,enabled:Tt(v),variant:Rt(v),reason:void 0,metadata:Zt(null==u?void 0:u[d])?void 0:{id:0,version:void 0,description:void 0,payload:u[d]}};this.receivedFeatureFlags({flags:h})}get hasLoadedFlags(){return this.oo}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.vo(C),e=this.vo(M),r=this.vo(A);if(!r&&!e)return t||{};var s=yr({},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=Zt(h)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!h,v=Zt(h)?u.variant:"string"==typeof h?h:void 0,c=null==r?void 0:r[o],f=i({},u,{enabled:d,variant:d?null!=v?v:null==u?void 0:u.variant:void 0});d!==(null==u?void 0:u.enabled)&&(f.original_enabled=null==u?void 0:u.enabled),v!==(null==u?void 0:u.variant)&&(f.original_variant=null==u?void 0:u.variant),c&&(f.metadata=i({},null==u?void 0:u.metadata,{payload:c,original_payload:null==u||null==(l=u.metadata)?void 0:l.payload})),s[o]=f}return this.so||(Da.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.so=!0),s}getFlagVariants(){var t=this.vo(T),e=this.vo(M);if(!e)return t||{};for(var i=yr({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.so||(Da.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.so=!0),i}getFlagPayloads(){var t=this.vo(F),e=this.vo(A);if(!e)return t||{};for(var i=yr({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.so||(Da.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.so=!0),i}reloadFeatureFlags(){this.lo||this.Dt.advanced_disable_feature_flags||this._o||(this._instance.Fn.emit("featureFlagsReloading",!0),this._o=setTimeout((()=>{this.wo()}),5))}xo(){clearTimeout(this._o),this._o=void 0}ensureFlagsLoaded(){this.oo||this.ao||this._o||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.lo=t}wo(t){var e;if(this.xo(),!this._instance.Ii())if(this.ao)this.uo=!0;else{var r=this.Dt.token,s=this.vo(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.Ki)?void 0:e.get_initial_props())||{},this.vo(D)||{}),group_properties:this.vo(j),timezone:ln()};ie(s)||Zt(s)||(n.$device_id=s),(null!=t&&t.disableFlags||this.Dt.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.yo()&&(n.evaluation_contexts=this.mo());var o=this.bo();Zt(o)||(n.flag_keys=o);var l=!!this.Dt.advanced_only_evaluate_survey_feature_flags,u=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Dt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.ao=!0,this._instance._send_request({method:"POST",url:u,data:n,compression:this.Dt.disable_compression?void 0:kn,timeout:this.Dt.feature_flag_request_timeout_ms,callback:t=>{var e,i,r,s=!0;if(200===t.statusCode&&(this.uo||(this.$anon_distinct_id=void 0),s=!1),this.ao=!1,!n.disable_flags||this.uo){this.ho=!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,u=!(null==(i=t.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(u&&o.push("quota_limited"),null==(r=this.Ki)||r.register({[q]:o}),u)Da.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:l}),this.uo&&(this.uo=!1,this.wo())}}})}}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.ho)if(this.oo||this.getFlags()&&this.getFlags().length>0){if(!this.po()){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 Da.warn('getFeatureFlag for key "'+t+La)}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.ho)if(this.oo||this.getFlags()&&this.getFlags().length>0){if(!this.po()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],o=String(s),a=this.vo(O)||void 0,l=this.vo(G)||void 0,u=this.vo(B)||{};if(this.Dt.advanced_feature_flags_dedup_per_session){var h,d=this._instance.get_session_id(),v=this.vo(H);d&&d!==v&&(u={},null==(h=this.Ki)||h.register({[B]:u,[H]:d}))}if((e.send_event||!("send_event"in e))&&(!(t in u)||!u[t].includes(o))){var c,f,p,g,_,m,y,b,w,x;Kt(u[t])?u[t].push(o):u[t]=[o],null==(c=this.Ki)||c.register({[B]:u});var S=this.getFeatureFlagDetails(t),E=[...null!==(f=this.vo(q))&&void 0!==f?f:[]];Zt(s)&&E.push("flag_missing");var k={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(p=this.Dt.bootstrap)||null==(p=p.featureFlags)?void 0:p[t])||null,$feature_flag_bootstrapped_payload:(null==(g=this.Dt.bootstrap)||null==(g=g.featureFlagPayloads)?void 0:g[t])||null,$used_bootstrap_value:!this.ho};Zt(null==S||null==(_=S.metadata)?void 0:_.version)||(k.$feature_flag_version=S.metadata.version);var P,T=null!==(m=null==S||null==(y=S.reason)?void 0:y.description)&&void 0!==m?m:null==S||null==(b=S.reason)?void 0:b.code;T&&(k.$feature_flag_reason=T),null!=S&&null!=(w=S.metadata)&&w.id&&(k.$feature_flag_id=S.metadata.id),Zt(null==S?void 0:S.original_variant)&&Zt(null==S?void 0:S.original_enabled)||(k.$feature_flag_original_response=Zt(S.original_variant)?S.original_enabled:S.original_variant),null!=S&&null!=(x=S.metadata)&&x.original_payload&&(k.$feature_flag_original_payload=null==S||null==(P=S.metadata)?void 0:P.original_payload),E.length&&(k.$feature_flag_error=E.join(",")),this._instance.capture("$feature_flag_called",k)}if(r)return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:Pt(n)}}}else Da.warn('getFeatureFlagResult for key "'+t+La)}getRemoteConfigPayload(t,e){var i=this.Dt.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.yo()&&(r.evaluation_contexts=this.mo());var s=this.bo();Zt(s)||(r.flag_keys=s),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Dt.disable_compression?void 0:kn,timeout:this.Dt.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.ho){if(this.oo||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(t,e);return Zt(i)?void 0:!!i}Da.warn('isFeatureEnabled for key "'+t+La)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,r){if(this.Ki){this.oo=!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]})))):Da.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(Kt(u)){Da.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(u)for(var f=0;u.length>f;f++)c[u[f]]=!0;e&&e.register({[R]:u,[T]:c})}else{var p=u,g=h,_=l;if(null!=o&&o.partialResponse)p=i({},r,p),g=i({},s,g),_=i({},n,_);else if(t.errorsWhileComputingFlags)if(l){var m=new Set(Object.keys(l).filter((t=>{var e;return!(null!=(e=l[t])&&e.failed)})));p=i({},r,Object.fromEntries(Object.entries(p).filter((t=>{var[e]=t;return m.has(e)})))),g=i({},s,Object.fromEntries(Object.entries(g||{}).filter((t=>{var[e]=t;return m.has(e)})))),_=i({},n,Object.fromEntries(Object.entries(_||{}).filter((t=>{var[e]=t;return m.has(e)}))))}else p=i({},r,p),g=i({},s,g),_=i({},n,_);e&&e.register(i({[R]:Object.keys(Na(p)),[T]:p||{},[F]:g||{},[C]:_||{}},d?{[O]:d}:{},v?{[G]:v}:{}))}}}(t,this.Ki,s,n,o,r),e||(this.do=!1),this.ko(e)}}override(t,e){void 0===e&&(e=!1),Da.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.Ki)return Da.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.Ki.unregister(M),this.Ki.unregister(A),this.ko(),ja.info("All overrides cleared");if(Kt(t)){var e=za(t);return this.Ki.register({[M]:e}),this.ko(),ja.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,r=t;if(this.so=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.Ki.unregister(M),ja.info("Flag overrides cleared");else if(r.flags){if(Kt(r.flags)){var s=za(r.flags);this.Ki.register({[M]:s})}else this.Ki.register({[M]:r.flags});ja.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.Ki.unregister(A),ja.info("Payload overrides cleared")):r.payloads&&(this.Ki.register({[A]:r.payloads}),ja.info("Payload overrides set",{payloads:r.payloads}))),void this.ko()}if(t&&"object"==typeof t)return this.Ki.register({[M]:t}),this.ko(),ja.info("Flag overrides set",{flags:t});Da.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.oo){var{flags:e,flagVariants:i}=this.So();t(e,i)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var s,n=(this.vo(I)||[]).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.Ki)||s.register({[R]:Object.keys(Na(l)),[T]:l}),this.ko()}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.vo(I),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.Dt.token+s),method:"GET",callback:e=>{var i,r;if(e.json){var s=e.json.earlyAccessFeatures;return null==(i=this.Ki)||i.unregister(I),null==(r=this.Ki)||r.register({[I]:s}),t(s)}}})}So(){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)),{})}}ko(t){var{flags:e,flagVariants:i}=this.So();this.featureFlagEventHandlers.forEach((r=>r(e,i,{errorsLoading:t})))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.vo(D)||{},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({[D]:i({},r,o,s)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=i({},this.vo(D)||{});t.forEach((t=>{delete r[t]})),this._instance.register({[D]:r}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this._instance.unregister(D),t&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.vo(j)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((e=>{r[e]=i({},r[e],t[e]),delete t[e]})),this._instance.register({[j]:i({},r,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.vo(j)||{};this._instance.register({[j]:i({},e,{[t]:{}})})}else this._instance.unregister(j)}reset(){this.oo=!1,this.ao=!1,this.lo=!1,this.uo=!1,this.ho=!1,this.$anon_distinct_id=void 0,this.xo(),this.so=!1}}},Ja={sessionRecording:class{get Dt(){return this._instance.config}get Ki(){return this._instance.persistence}get started(){var t;return!(null==(t=this.Co)||!t.isStarted)}get status(){var t,e;return this.Io===ga||this.Io===_a?this.Io:null!==(t=null==(e=this.Co)?void 0:e.status)&&void 0!==t?t:this.Io}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.Io=fa,this.To=void 0,this._instance=t,!this._instance.sessionManager)throw ya.error("started without valid sessionManager"),new Error(ma+" started without valid sessionManager. This is a bug.");if(this.Dt.cookieless_mode===ot)throw new Error(ma+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Eo(){var t,e=!(null==(t=this._instance.get_property(y))||!t.enabled),i=!this.Dt.disable_session_recording,r=this.Dt.disable_session_recording||this._instance.consent.isOptedOut();return gt&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!this.Eo||null==(e=this.Co)||!e.isStarted){var i=!Zt(Object.assign)&&!Zt(Array.from);this.Eo&&i?(this.Mo(t),ya.info("starting")):(this.Io=fa,this.stopRecording())}}Mo(t){var e,i,r;this.Eo&&(this.Io!==ga&&this.Io!==_a&&(this.Io=pa),null!=$t&&null!=(e=$t.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=$t.__PosthogExtensions__)&&i.initSessionRecording?this.Ro(t):null==(r=$t.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Po,(e=>{if(e)return ya.error("could not load recorder",e);this.Ro(t)})))}stopRecording(){var t,e;null==(t=this.To)||t.call(this),this.To=void 0,null==(e=this.Co)||e.stop()}Oo(){var t,e;null==(t=this.To)||t.call(this),this.To=void 0,null==(e=this.Co)||e.discard()}Lo(){var t,e;null==(t=this.Ki)||t.unregister(P),null==(e=this.Ki)||e.unregister(b)}Ao(t,e){if(re(t))return null;var i,r=se(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(ya.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Fo(t){if(this.Ki){var e,r,s=this.Ki,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Ao(null==(e=this.Dt.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),o=this.Ao(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;re(a)&&this.Lo();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[y]: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:Zt(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.To)||e.call(this),this.To=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.Fo(t),void this.Oo()):(this.Fo(t),void this.startIfEnabledOrStop()):(this.Io===ga&&(this.Io=_a,ya.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.Co)&&i.log?this.Co.log(t,e):ya.warn("log called before recorder was ready")}get Po(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(y);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}No(){var t,e,i=this._instance.get_property(y);if(!i)return!1;try{e="object"==typeof i?i:JSON.parse(i)}catch(t){return ya.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}var r=null!==(t=e.cache_timestamp)&&void 0!==t?t:Date.now();return 36e5>=Date.now()-r}Ro(t){var e,i;if(null==(e=$t.__PosthogExtensions__)||!e.initSessionRecording)return ya.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[rt]:!0});if(this.Co||(this.Co=null==(i=$t.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.Co._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.No()){if(this.Io===_a||this.Io===ga)return;return this.Io=ga,ya.info("persisted remote config is stale, requesting fresh config before starting"),void new Sn(this._instance).load()}this.Io=pa,this.Co.start(t)}onRRwebEmit(t){var e;null==(e=this.Co)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.Co||null==(e=this.Ki)||e.register({[x]:!0}),null==(t=this.Co)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Co||null==(e=this.Ki)||e.register({[w]:!0}),null==(t=this.Co)||t.overrideSampling()}overrideTrigger(t){var e,i;this.Co||null==(i=this.Ki)||i.register({["url"===t?S:E]:!0}),null==(e=this.Co)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.Co)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.Co)||!i.tryAddCustomEvent(t,e))}}},Ka={autocapture:class{constructor(t){this.Do=!1,this.$o=null,this.qo=!1,this.instance=t,this.rageclicks=new sa(t.config.rageclick),this.jo=null}initialize(){this.startIfEnabled()}get Dt(){var t,e,i=Xt(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}Bo(){if(this.isBrowserSupported()){if(gt&&yt){var t=t=>{t=t||(null==gt?void 0:gt.event);try{this.Ho(t)}catch(t){oa.error("Failed to capture event",t)}};if($r(yt,"submit",t,{capture:!0}),$r(yt,"change",t,{capture:!0}),$r(yt,"click",t,{capture:!0}),this.Dt.capture_copied_text){var e=t=>{t=t||(null==gt?void 0:gt.event);try{this.Ho(t,na)}catch(t){oa.error("Failed to capture copy/cut event",t)}};$r(yt,"copy",e,{capture:!0}),$r(yt,"cut",e,{capture:!0})}}}else oa.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Do&&(this.Bo(),this.Do=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.qo=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[h]:!!t.autocapture_opt_out}),this.$o=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.jo=t}getElementSelectors(t){var e,i=[];return null==(e=this.jo)||e.forEach((e=>{var r=null==yt?void 0:yt.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(ie(this.$o)&&!oe(i)&&!this.instance.Ii())return!1;var r=null!==(e=this.$o)&&void 0!==e?e:!!i;return!!this.instance.config.autocapture&&!r}Ho(t,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var i,r=ns(t);Qr(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())&&ps(r,this.instance.config.rageclick)&&this.Ho(t,"$rageclick");var s=e===na;if(r&&function(t,e,i,r,s){var n,o,a,l,u,h;if(void 0===i&&(i=void 0),!gt||gs(t))return!1;if(null!=(n=i)&&n.url_allowlist&&!es(i.url_allowlist))return!1;if(null!=(o=i)&&o.url_ignorelist&&es(i.url_ignorelist))return!1;if(null!=(a=i)&&a.dom_event_allowlist){var d=i.dom_event_allowlist;if(d&&!d.some((t=>e.type===t)))return!1}var{parentIsUsefulElement:v,targetElementList:c}=_s(t,r);if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(Zt(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}(c,i))return!1;if(!as(c,null==(l=i)?void 0:l.css_selector_allowlist))return!1;if(as(c,null!==(u=null==(h=i)?void 0:h.css_selector_ignorelist)&&void 0!==u?u:us))return!1;var f=gt.getComputedStyle(t);if(f&&"pointer"===f.getPropertyValue("cursor")&&"click"===e.type)return!0;var p=t.tagName.toLowerCase();switch(p){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 v?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(os.indexOf(p)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,this.Dt,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=ua(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Dt.element_attribute_ignorelist,elementsChainAsString:this.qo});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(n.$element_selectors=a),e===na){var l,u=rs(null==gt||null==(l=gt.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 Yt(null==yt?void 0:yt.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.Uo=(null==gt||null==(e=gt.location)?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(pr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.zo&&this.zo(),this.zo=void 0,pr.info("History API monitoring stopped")}monitorHistoryChanges(){gt&&gt.history&&(this.Vo("pushState"),this.Vo("replaceState"),this.Wo())}Vo(t){var e;if(gt&&(null==(e=gt.history[t])||!e.__posthog_wrapped__)){var i=this;!function(t,e,i){try{if(!(e in t))return()=>{};var r=t[e],s=i(r);return Yt(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=s,()=>{t[e]===s&&(t[e]=r)}}catch(t){return()=>{}}}(gt.history,t,(e=>function(r,s,n){e.call(this,r,s,n),i.Go(t)}))}}Go(t){try{var e,i=null==gt||null==(e=gt.location)?void 0:e.pathname;if(!i)return;i!==this.Uo&&this.isEnabled&&this._instance.capture(vt,{navigation_type:t}),this.Uo=i}catch(e){pr.error("Error capturing "+t+" pageview",e)}}Wo(){if(!this.zo){var t=()=>{this.Go("popstate")};$r(gt,"popstate",t),this.zo=()=>{gt&&gt.removeEventListener("popstate",t)}}}},heatmaps:class{get Dt(){return this.instance.config}constructor(t){var e;this.Zo=!1,this.Do=!1,this.Qo=null,this.instance=t,this.Zo=!(null==(e=this.instance.persistence)||!e.props[d]),this.rageclicks=new sa(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return Xt(this.Dt.capture_heatmaps)&&this.Dt.capture_heatmaps.flush_interval_milliseconds&&(t=this.Dt.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return re(this.Dt.capture_heatmaps)?re(this.Dt.enable_heatmaps)?this.Zo:this.Dt.enable_heatmaps:!1!==this.Dt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Do)return;ba.info("starting..."),this.Jo(),this.Pt()}else{var t;clearInterval(null!==(t=this.Qo)&&void 0!==t?t:void 0),this.Ko(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[d]:e}),this.Zo=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}Yo(t){this._t(t.originalEvent,"deadclick")}Pt(){this.Qo&&clearInterval(this.Qo),this.Qo=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(yt)?setInterval(this.ji.bind(this),this.flushIntervalMilliseconds):null}Jo(){gt&&yt&&(this.Xo=this.ji.bind(this),$r(gt,dt,this.Xo),this.ea=t=>this._t(t||(null==gt?void 0:gt.event)),$r(yt,"click",this.ea,{capture:!0}),this.ta=t=>this.ra(t||(null==gt?void 0:gt.event)),$r(yt,"mousemove",this.ta,{capture:!0}),this.ia=new Ms(this.instance,Fs,this.Yo.bind(this)),this.ia.startIfEnabledOrStop(),this.na=this.Pt.bind(this),$r(yt,ht,this.na),this.Do=!0)}Ko(){var t;gt&&yt&&(this.Xo&&gt.removeEventListener(dt,this.Xo),this.ea&&yt.removeEventListener("click",this.ea,{capture:!0}),this.ta&&yt.removeEventListener("mousemove",this.ta,{capture:!0}),this.na&&yt.removeEventListener(ht,this.na),clearTimeout(this.sa),null==(t=this.ia)||t.stop(),this.Do=!1)}oa(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&&Yr(r)&&!Xr(r,"body");){if(r===i)return!1;if(Ht(e,null==gt?void 0:gt.getComputedStyle(r).position))return!0;r=ls(r)}return!1}(ns(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:i),target_fixed:n,type:e}}_t(t,e){var r;if(void 0===e&&(e="click"),!Kr(t.target)&&wa(t)){var s=this.oa(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&ps(ns(t),this.instance.config.rageclick)&&this.aa(i({},s,{type:"rageclick"})),this.aa(s)}}ra(t){!Kr(t.target)&&wa(t)&&(clearTimeout(this.sa),this.sa=setTimeout((()=>{this.aa(this.oa(t,"mousemove"))}),500))}aa(t){if(gt){var e=gt.location.href,i=this.Dt.custom_personal_data_properties,r=this.Dt.mask_personal_data_properties?[...Ks,...i||[]]:[],s=Vs(e,r,Xs);this.R=this.R||{},this.R[s]||(this.R[s]=[]),this.R[s].push(t)}}ji(){this.R&&!Qt(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ms,webVitalsAutocapture:class{constructor(t){var e;this.Zo=!1,this.Do=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.la=()=>{clearTimeout(this.ua),0!==this.R.metrics.length&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((t,e)=>i({},t,{["$web_vitals_"+e.name+"_event"]:i({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.vt=t=>{var e;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.ha();if(!Zt(r))if(re(null==t?void 0:t.name)||re(null==t?void 0:t.value))va.error("Invalid metric received",t);else if(!this.ca||this.ca>t.value){this.R.url!==r&&(this.la(),this.ua=setTimeout(this.la,this.flushToCaptureTimeoutMs)),Zt(this.R.url)&&(this.R.url=r),this.R.firstMetricTimestamp=Zt(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0);var s=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0),n=i({},t,{$current_url:r,timestamp:Date.now()});Zt(s)||(n.$session_id=s.sessionId,n.$window_id=s.windowId),this.R.metrics.push(n),this.R.metrics.length===this.allowedMetrics.length&&this.la()}else va.error("Ignoring metric with value >= "+this.ca,t)},this.da=()=>{if(!this.Do){var t,e,i,r,s=$t.__PosthogExtensions__;Zt(s)||Zt(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:e,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),t&&e&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.vt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&e(this.vt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.vt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.vt.bind(this)),this.Do=!0):va.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Zo=!(null==(e=this._instance.persistence)||!e.props[p]),this.startIfEnabled()}get va(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=Xt(this.va)?null==(t=this.va)?void 0:t.web_vitals_allowed_metrics:void 0;return re(i)?(null==(e=this._instance.persistence)?void 0:e.props[m])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(Xt(this.va)?this.va.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=Xt(this.va)?this.va.web_vitals_attribution:void 0;return null!=t&&t}get ca(){var t=Xt(this.va)&&se(this.va.__web_vitals_max_value)?this.va.__web_vitals_max_value:ca;return t>0&&6e4>=t?ca:t}get isEnabled(){var t=null==bt?void 0:bt.protocol;if("http:"!==t&&"https:"!==t)return va.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=Xt(this.va)?this.va.web_vitals:oe(this.va)?this.va:void 0;return oe(e)?e:this.Zo}startIfEnabled(){this.isEnabled&&!this.Do&&(va.info("enabled, starting..."),this.qr(this.da))}onRemoteConfig(t){if("capturePerformance"in t){var e=Xt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=Xt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[p]:e}),this._instance.persistence.register({[m]:i})),this.Zo=e,this.startIfEnabled()}}qr(t){var e,i;null!=(e=$t.__PosthogExtensions__)&&e.postHogWebVitalsCallbacks?t():null==(i=$t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(e=>{e?va.error("failed to load script",e):t()}))}ha(){var t=gt?gt.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...Ks,...e||[]]:[];return Vs(t,i,Xs)}va.error("Could not determine current URL")}}},Ya={exceptionObserver:class{constructor(t){var e,i,r;this.da=()=>{var t;if(gt&&this.isEnabled&&null!=(t=$t.__PosthogExtensions__)&&t.errorWrappingFunctions){var e=$t.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=$t.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=$t.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.fa&&this.Dt.capture_unhandled_errors&&(this.fa=e(this.captureException.bind(this))),!this.pa&&this.Dt.capture_unhandled_rejections&&(this.pa=i(this.captureException.bind(this))),!this.ga&&this.Dt.capture_console_errors&&(this.ga=r(this.captureException.bind(this)))}catch(t){ha.error("failed to start",t),this.ma()}}},this._instance=t,this.ya=!(null==(e=this._instance.persistence)||!e.props[v]),this.ba=new _e({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,Qt:ha}),this.Dt=this._a(),this.startIfEnabledOrStop()}_a(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Xt(t)?e=i({},e,t):(Zt(t)?this.ya:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Dt.capture_console_errors||this.Dt.capture_unhandled_errors||this.Dt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ha.info("enabled"),this.ma(),this.qr(this.da)):this.ma()}qr(t){var e,i;null!=(e=$t.__PosthogExtensions__)&&e.errorWrappingFunctions?t():null==(i=$t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return ha.error("failed to load script",e);t()}))}ma(){var t,e,i;null==(t=this.fa)||t.call(this),this.fa=void 0,null==(e=this.pa)||e.call(this),this.pa=void 0,null==(i=this.ga)||i.call(this),this.ga=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.ya=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[v]:this.ya}),this.Dt=this._a(),this.startIfEnabledOrStop())}onConfigChange(){this.Dt=this._a()}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.ba.consumeRateLimit(s)?ha.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.wa=[],this.xa=new Li([new Yi,new or,new Qi,new Xi,new sr,new rr,new tr,new nr],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=Ki.test(l)?l.replace(Ki,"$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||zi});var r}))}(n)}}("web:javascript",Gi,Ji)),this._instance=t,this.wa=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property(c))&&void 0!==e?e:[],this.ka=dr(this.Sa()),this.Ca=new vr(this.ka)}onConfigChange(){this.ka=dr(this.Sa()),this.Ca.setConfig(this.ka)}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.wa=s,this._instance.persistence&&this._instance.persistence.register({[c]:this.wa,[f]:n})}}get Ia(){var t,e=!!this._instance.get_property(f),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.xa.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.ka.enabled)try{if(!te(t)||0===t.trim().length)return void Ua.warn("Ignoring exception step because message must be a non-empty string");var r=this.Ta(e),{sanitizedProperties:s,droppedKeys:n}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>ur.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(r);n.length>0&&Ua.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Ca.add(i({[ar]:t,[lr]:(new Date).toISOString()},s))}catch(t){Ua.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.Ea(e)){if(this.Ma(e))return this.Ra("Exception dropped: matched a suppression rule"),void Ua.info("Skipping exception capture because a suppression rule matched");if(!this.Ia&&this.Pa(e))return this.Ra("Exception dropped: thrown by a browser extension"),void Ua.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Oa(e))return this.Ra("Exception dropped: thrown by the PostHog SDK"),void Ua.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.ka.enabled&&re(t.$exception_steps)?this.La(t):t;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",rs:!0});return r&&this.Ca.clear(),r}catch(t){return Ua.error("Failed to capture exception event. Dropping this exception.",t),void this.Ca.clear()}}catch(t){return void Ua.error("Failed to process exception event. Ignoring this exception.",t)}}La(t){try{var e=this.Ca.getAttachable();return 0===e.length?t:i({},t,{$exception_steps:e})}catch(e){return Ua.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Ra(t){this.ka.enabled&&this.Ca.add({[ar]:t,[lr]:(new Date).toISOString()})}Ta(t){return Xt(t)?i({},t):{}}Sa(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}Ma(t){if(0===t.length)return!1;var e=t.reduce(((t,e)=>{var{type:i,value:r}=e;return te(i)&&i.length>0&&t.$exception_types.push(i),te(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.wa.some((t=>{var i=t.values.map((t=>{var i,r=Ro[t.operator],s=Kt(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)}))}Pa(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://")))}Oa(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}Ea(t){return!re(t)&&Kt(t)}}},Xa=i({productTours:class{get Ki(){return this._instance.persistence}constructor(t){this.Aa=null,this.Fa=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if("productTours"in t){var e,i;if(this.Ki&&this.Ki.register({[_]:!!t.productTours}),!Sa(this._instance))return!this.Aa&&re(null==(e=this.Ki)?void 0:e.props[U])||xa.info("product tours disabled; stopping and clearing cached tours"),null==(i=this.Aa)||i.stop(),this.Aa=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Aa&&Sa(this._instance)&&this.qr((()=>this.Na()))}qr(t){var e,i;null!=(e=$t.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=$t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?xa.error("Could not load product tours script",e):t()}))}Na(){var t;!this.Aa&&null!=(t=$t.__PosthogExtensions__)&&t.generateProductTours&&(this.Aa=$t.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!Kt(this.Fa)||e){var i=this.Ki;if(i){var r=i.props[U];if(Kt(r)&&!e)return this.Fa=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=>{if(Sa(this._instance)){var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return xa.error(s),void t([],{isLoaded:!1,error:s})}var n=Kt(e.json.product_tours)?e.json.product_tours:[];this.Fa=n,i&&i.register({[U]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Fa,{isLoaded:!0})}getActiveProductTours(t){re(this.Aa)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Aa.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.Aa)||e.showTourById(t)}previewTour(t){this.Aa?this.Aa.previewTour(t):this.qr((()=>{var e;this.Na(),null==(e=this.Aa)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Aa)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Aa)||t.nextStep()}previousStep(){var t;null==(t=this.Aa)||t.previousStep()}clearCache(){var t;this.Fa=null,null==(t=this.Ki)||t.unregister(U)}resetTour(t){var e;null==(e=this.Aa)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.Aa)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.Aa)||e.cancelPendingTour(t)}}},Wa),Qa={siteApps:class{constructor(t){this.Da=0,this._instance=t,this.$a=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}qa(t,e){if(e){var i=this.globalsForEvent(e);this.$a.push(i),this.$a.length>1e3&&(this.$a=this.$a.slice(10))}}get siteAppLoaders(){var t;return null==(t=$t._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.qa.bind(this));this.ja=()=>{t(),this.$a=[],this.ja=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,f]of Object.entries(v))h[c]={id:d[c],type:c,properties:f};var{$set_once:p,$set:g}=t;return{event:i({},r(t,Ea),{properties:i({},t.properties,g?{$set:i({},null!==(e=null==(s=t.properties)?void 0:s.$set)&&void 0!==e?e:{},g)}:{},p?{$set_once:i({},null!==(n=null==(o=t.properties)?void 0:o.$set_once)&&void 0!==n?n:{},p)}:{}),elements_chain:null!==(a=null==(l=t.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(u=t.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}Ba(t){var e,i=null==(e=t.tagName)?void 0:e.toLowerCase();return"style"===i&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(ka.error("prepare_external_dependency_stylesheet returned null"),null):"script"===i&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(ka.error("prepare_external_dependency_script returned null"),null):t}Ha(){var t,e,i,r,s,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==yt?void 0:yt.defaultView,u=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!u)return()=>{};if(this.Da++,this.Ua)return this.za();var h=[],d=this,v=new WeakSet,c=(t,e,i)=>{if(null!=t&&t[e]){var r=t[e];t[e]=i(r),h.push((()=>{t[e]=r}))}},f=t=>{if(v.has(t))return t;var e=d.Ba(t);return e&&v.add(e),e},p=t=>t.map((t=>"string"==typeof t?t:f(t))).filter((t=>!ie(t)));return c(u,"appendChild",(t=>function(e){var i=f(e);return i?t.call(this,i):e})),c(u,"insertBefore",(t=>function(e,i){var r=f(e);return r?t.call(this,r,i):e})),c(u,"replaceChild",(t=>function(e,i){var r=f(e);return r?t.call(this,r,i):i})),[null==(e=l.Element)?void 0:e.prototype,null==(i=l.Document)?void 0:i.prototype,null==(r=l.DocumentFragment)?void 0:r.prototype].forEach((t=>{c(t,"append",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))})),c(t,"prepend",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))}))})),[null==(s=l.Element)?void 0:s.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach((t=>{c(t,"before",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))})),c(t,"after",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))})),c(t,"replaceWith",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];var s=p(i);return i.length&&!s.length?void 0:t.apply(this,s)}))})),c(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",(t=>function(e,i){var r=f(i);return r?t.call(this,e,r):null})),this.Ua=()=>{h.forEach((t=>t())),this.Ua=void 0},this.za()}za(){var t=!1;return()=>{var e;t||(t=!0,this.Da--,0===this.Da&&(null==(e=this.Ua)||e.call(this)))}}Va(t,e){void 0===e&&(e=!0);var i=this.Ha();try{var r=t(i);return e&&i(),r}catch(t){throw i(),t}}setupSiteApp(t){var e=this.apps[t.id],i=()=>{var i;!e.errored&&this.$a.length&&(ka.info("Processing "+this.$a.length+" events for site app with id "+t.id),this.$a.forEach((t=>this.Va((()=>null==e.processEvent?void 0:e.processEvent(t))))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this.ja)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,ka.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=this.Va((e=>t.init({posthog:this._instance,callback(t){e(),s(t)}})),!1);n&&(e.processEvent=n),r=!0}catch(e){ka.error($a+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){ka.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}Wa(){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)}Ga(t){var e=this;if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t),r=function(r){try{e.Va((()=>null==r.processEvent?void 0:r.processEvent(i)))}catch(e){ka.error("Error while processing event "+t.event+" for site app "+r.id,e)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var e,i,r,s=this;if(null!=(e=this.siteAppLoaders)&&e.length)return this.isEnabled?(this.Wa(),void this._instance.on("eventCaptured",(t=>this.Ga(t)))):void ka.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.ja)||i.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var e;$t["__$$ph_site_app_"+t]=s._instance,null==(e=$t.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(s._instance,a,(e=>{if(e)return ka.error($a+t,e)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else ka.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Za={tracingHeaders:class{constructor(t){this.Za=void 0,this.Qa=void 0,this.Ja=void 0,this.da=()=>{var t,e,i=this.Ka();i?(Zt(this.Za)&&(this.Za=null==(t=$t.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Zt(this.Qa)&&(this.Qa=null==(e=$t.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.ma()},this._instance=t}initialize(){this.startIfEnabledOrStop()}qr(t){var e,i;null!=(e=$t.__PosthogExtensions__)&&e.tracingHeadersPatchFns?t():null==(i=$t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return da.error("failed to load script",e);t()}))}Ya(){var t,e;return null!==(t=null!==(e=this._instance.config.tracing_headers)&&void 0!==e?e:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}Ka(){var t=this.Ya();return Kt(t)?(Kt(this.Ja)?this.Ja.splice(0,this.Ja.length,...t):this.Ja=[...t],t.length>0?this.Ja:void 0):(Kt(this.Ja)&&this.Ja.splice(0),this.Ja=t||void 0,this.Ja)}ma(){var t,e;null==(t=this.Za)||t.call(this),null==(e=this.Qa)||e.call(this),this.Za=void 0,this.Qa=void 0}startIfEnabledOrStop(){this.Ka()?this.qr(this.da):this.ma()}}},tl=i({surveys:class{get Dt(){return this._instance.config}constructor(t){this.Xa=void 0,this._surveyManager=null,this.el=!1,this.tl=[],this.rl=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Dt.disable_surveys){var e=t.surveys;if(re(e))return Do.warn("Flags not loaded yet. Not loading surveys.");var i=Kt(e);this.Xa=i?e.length>0:e,Do.info("flags response received, isSurveysEnabled: "+this.Xa),this.loadIfEnabled()}}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e=[],i=0;i<localStorage.length;i++){var r=localStorage.key(i);(null!=r&&r.startsWith(jo)||null!=r&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this._surveyManager)if(this.el)Do.info("Already initializing surveys, skipping...");else if(this.Dt.disable_surveys)Do.info(Fa);else if(this.Dt.cookieless_mode&&this._instance.consent.isOptedOut())Do.info("Not loading surveys in cookieless mode without consent.");else{var t=null==$t?void 0:$t.__PosthogExtensions__;if(t){if(!Zt(this.Xa)||this.Dt.advanced_enable_surveys){var e=this.Xa||this.Dt.advanced_enable_surveys;this.el=!0;try{var i=t.generateSurveys;if(i)return void this.il(i,e);var r=t.loadExternalDependency;if(!r)return void this.nl(st);r(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.nl("Could not load surveys script",i):this.il(t.generateSurveys,e)}))}catch(t){throw this.nl("Error initializing surveys",t),t}finally{this.el=!1}}}else Do.error("PostHog Extensions not found.")}}il(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new Ia(this._instance),Do.info("Surveys loaded successfully"),this.sl({isLoaded:!0})}nl(t,e){Do.error(t,e),this.sl({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.tl.push(t),this._surveyManager&&this.sl({isLoaded:!0}),()=>{this.tl=this.tl.filter((e=>e!==t))}}getSurveys(t,e){if(void 0===e&&(e=!1),this.Dt.disable_surveys)return Do.info(Fa),t([]);var i,r=this._instance.get_property(L);if(r&&!e)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.rl?this.rl.then((e=>{var{surveys:i,context:r}=e;return t(i,r)})):("undefined"!=typeof Promise&&(this.rl=new Promise((t=>{i=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Dt.token),method:"GET",timeout:this.Dt.surveys_request_timeout_ms,callback:e=>{var r;this.rl=null;var s=e.statusCode;if(200!==s||!e.json){var n="Surveys API could not be loaded, status: "+s;Do.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,[z]:Date.now()});var h={isLoaded:!0};t(l,h),null==i||i({surveys:l,context:h})}}))}sl(t){for(var e of this.tl)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){Do.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!re(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Do.warn("init was not called")}ol(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}al(t){if(re(this._surveyManager))return{eligible:!1,reason:Ca};var e="string"==typeof t?this.ol(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(re(this._surveyManager))return Do.warn("init was not called"),{visible:!1,disabledReason:Ca};var e=this.al(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return re(this._surveyManager)?(Do.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ca})):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.al(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var r;if(re(this._surveyManager))Do.warn("init was not called");else{var s="string"==typeof t?this.ol(t):t;if(null!=s&&s.id)if(Lo.includes(s.type)){var n=null==yt?void 0:yt.querySelector(e);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(Do.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,e;Do.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),Do.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);Do.warn("Survey element not found")}else Do.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Do.warn("Survey not found")}}displaySurvey(t,e){var r;if(re(this._surveyManager))Do.warn("init was not called");else{var s=this.ol(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!==yn&&e.initialResponses&&Do.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 Do.warn("Survey is not eligible to be displayed: ",o.disabledReason)}"inline"!==e.displayType?this._surveyManager.handlePopoverSurvey(n,e):this.renderSurvey(n,e.selector,e.properties)}else Do.warn("Survey not found")}}cancelPendingSurvey(t){re(this._surveyManager)?Do.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},Wa),el={toolbar:class{constructor(t){this.instance=t}ll(t){$t.ph_toolbar_state=t}ul(){var t;return null!==(t=$t.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),Pr(this.instance.config))return!1;if(!gt||!yt)return!1;t=null!=t?t:gt.location,i=null!=i?i:gt.history;try{if(!e){try{gt.localStorage.setItem("test","test"),gt.localStorage.removeItem("test")}catch(t){return!1}e=null==gt?void 0:gt.localStorage}var r,s=Oa||Ws(t.hash,"__posthog")||Ws(t.hash,"state"),n=s?wr((()=>JSON.parse(atob(decodeURIComponent(s)))))||wr((()=>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(Ma)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}hl(t){var e=$t.ph_load_toolbar||$t.ph_load_editor;!re(e)&&Yt(e)?e(t,this.instance):Aa.warn("No toolbar load function found")}loadToolbar(t){var e=!(null==yt||!yt.getElementById(Z));if(!gt||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(gt.localStorage.setItem(Ma,JSON.stringify(i({},s,{source:void 0}))),2===this.ul())this.hl(s);else if(0===this.ul()){var n;this.ll(1),null==(n=$t.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return Aa.error("[Toolbar] Failed to load",t),void this.ll(0);this.ll(2),this.hl(s)})),$r(gt,"turbolinks:load",(()=>{this.ll(0),this.loadToolbar(s)}))}return!0}cl(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)}}},il=i({experiments:qa},Wa),rl=i({},Wa,Ja,Ka,Ya,Xa,Qa,tl,Za,el,il,{conversations:class{constructor(t){this.dl=void 0,this._conversationsManager=null,this.vl=!1,this.fl=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;re(e)||(oe(e)?this.dl=e:(this.dl=e.enabled,this.fl=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.dl=void 0,this.fl=null}loadIfEnabled(){if(!(this._conversationsManager||this.vl||this._instance.config.disable_conversations||Pr(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==$t?void 0:$t.__PosthogExtensions__;if(t&&!Zt(this.dl)&&this.dl)if(this.fl&&this.fl.token){this.vl=!0;try{var e=t.initConversations;if(e)return this.pl(e),void(this.vl=!1);var i=t.loadExternalDependency;if(!i)return void this.gl(st);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.gl("Could not load conversations script",e):this.pl(t.initConversations),this.vl=!1}))}catch(t){this.gl("Error initializing conversations",t),this.vl=!1}}else Ga.error("Conversations enabled but missing token in remote config.")}}pl(t){if(this.fl)try{this._conversationsManager=t(this.fl,this._instance),Ga.info("Conversations loaded successfully")}catch(t){this.gl("Error completing conversations initialization",t)}else Ga.error("Cannot complete initialization: remote config is null")}gl(t,e){Ga.error(t,e),this._conversationsManager=null,this.vl=!1}show(){this._conversationsManager?this._conversationsManager.show():Ga.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.dl&&!ie(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):(Ga.warn(Va),null)}))()}getMessages(t,i){var r=this;return e((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,i):(Ga.warn(Va),null)}))()}markAsRead(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(Ga.warn(Va),null)}))()}getTickets(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(Ga.warn(Va),null)}))()}requestRestoreLink(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(Ga.warn(Va),null)}))()}restoreFromToken(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(Ga.warn(Va),null)}))()}restoreFromUrlToken(){var t=this;return e((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Ga.warn(Va),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}hs(){var t;null==(t=this._conversationsManager)||t.setIdentity()}cs(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},{logs:class{constructor(t){var e;this.ml=!1,this.yl=!1,this.Qt=gr("[logs]"),this.Mi=[],this.bl=()=>{var t;null==(t=this._l)||t.onReconnect()},this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.ml=!0),gt&&$r(gt,"online",this.bl)}wl(){var t,e,i,r,s,n,o,a,l,u,h,d,v,c,f=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;return this._l&&this.xl===f||(null==(e=this._l)||e.reset(),this.xl=f,this.kl=(u=null!==(r=null==(i=f)?void 0:i.flushIntervalMs)&&void 0!==r?r:3e3,h=null!==(s=null==i?void 0:i.maxBufferSize)&&void 0!==s?s:100,d=null!==(n=null==i?void 0:i.maxLogsPerInterval)&&void 0!==n?n:1e3,v=Math.max(h,d),{serviceName:null!==(o=null==(c=null==i?void 0:i.resourceAttributes)?void 0:c["service.name"])&&void 0!==o?o:null==i?void 0:i.serviceName,serviceVersion:null!==(a=null==c?void 0:c["service.version"])&&void 0!==a?a:null==i?void 0:i.serviceVersion,environment:null!==(l=null==c?void 0:c["deployment.environment"])&&void 0!==l?l:null==i?void 0:i.environment,resourceAttributes:c,beforeSend:null==i?void 0:i.beforeSend,flushIntervalMs:u,maxBufferSize:h,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}),this._l=new Oi(this.Sl(),this.kl,this.Qt,(()=>this.Cl()),(t=>t()))),this._l}Il(){return this.wl(),this.kl}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,i=null==(e=t.logs)?void 0:e.captureConsoleLogs;!re(i)&&i&&(this.ml=!0,this.loadIfEnabled())}reset(){var t;this.Mi=[],null==(t=this._l)||t.reset()}captureLog(t){this.wl().captureLog(t)}get logger(){return this.Tl||(this.Tl={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.Tl}flushLogs(t){t?this.El(t):this.wl().flush().catch((t=>this.Qt.error("PostHog logs flush failed:",t)))}loadIfEnabled(){if(this.ml&&!this.yl){var t=null==$t?void 0:$t.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(e=>{var i;e||null==(i=t.logs)||!i.initializeLogs?this.Qt.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.yl=!0)})):this.Qt.error(st)}else this.Qt.error("PostHog Extensions not found.")}}Sl(){var t=this._instance;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},getPersistedProperty:t=>t===Ct.LogsQueue?this.Mi:void 0,setPersistedProperty:(t,e)=>{var i;t===Ct.LogsQueue&&(this.Mi=null!==(i=e)&&void 0!==i?i:[])},kr:t=>this.kr(t),getLibraryId:()=>n.LIB_NAME,getLibraryVersion:()=>n.LIB_VERSION}}kr(t){return new Promise((e=>{var i=!1,r=t=>{i||(i=!0,clearTimeout(s),e(t))},s=setTimeout((()=>r({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.Ml(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback(t){var e=t.statusCode;if(e>=200&&300>e)r({kind:"ok"});else if(413===e)r({kind:"too-large"});else if(0!==e&&429!==e&&500>e)r({kind:"fatal",error:new Error("logs request failed with status "+e)});else{var i;r({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("logs request failed with status "+e)})}}})}))}El(t){var e=this.Il();if(0!==this.Mi.length){var i=this.Mi.map((t=>t.record));this.Mi=[];var r=Fi(i,Ci(e,n.LIB_NAME,n.LIB_VERSION),n.LIB_NAME,n.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Ml(),data:r,compression:"best-available",batchKey:"logs",transport:t})}}Ml(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Cl(){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!=$t&&null!=(t=$t.location)&&t.href&&(e.currentUrl=$t.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(e.activeFeatureFlags=r)}return e}}});ra.__defaultExtensionClasses=i({},rl)}();
1
+ !function(){"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}var s="1.391.7",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",f="$error_tracking_capture_extension_exceptions",p="$web_vitals_enabled_server_side",g="$dead_clicks_enabled_server_side",_="$product_tours_enabled_server_side",m="$web_vitals_allowed_metrics",y="$session_recording_remote_config",b="$replay_sample_rate",w="$replay_override_sampling",x="$replay_override_linked_flag",S="$replay_override_url_trigger",E="$replay_override_event_trigger",k="$sesid",P="$session_is_sampled",T="$enabled_feature_flags",R="$active_feature_flags",I="$early_access_features",C="$feature_flag_details",F="$feature_flag_payloads",O="$feature_flag_request_id",M="$override_feature_flags",A="$override_feature_flag_payloads",D="$stored_person_properties",j="$stored_group_properties",L="$surveys",z="$surveys_loaded_at",N="$surveys_activated",U="ph_product_tours",B="$flag_call_reported",H="$flag_call_reported_session_id",q="$feature_flag_errors",G="$feature_flag_evaluated_at",V="$user_state",W="$client_session_props",J="$capture_rate_limit",K="$initial_campaign_params",Y="$initial_referrer_info",X="$initial_person_info",Q="$epp",Z="__POSTHOG_TOOLBAR__",tt="$posthog_cookieless",et="$sdk_debug_extensions_init_method",it="$sdk_debug_extensions_init_time_ms",rt="$sdk_debug_recording_script_not_loaded",st="PostHog loadExternalDependency extension not found.",nt="on_reject",ot="always",at="anonymous",lt="identified",ut="identified_only",ht="visibilitychange",dt="beforeunload",vt="$pageview",ct="$pageleave",ft="$identify",pt="$groupidentify",gt="undefined"!=typeof window?window:void 0,_t="undefined"!=typeof globalThis?globalThis:gt;"undefined"==typeof self&&(_t.self=_t),"undefined"==typeof File&&(_t.File=function(){});var mt=null==_t?void 0:_t.navigator,yt=null==_t?void 0:_t.document,bt=null==_t?void 0:_t.location,wt=null==_t?void 0:_t.fetch,xt=null!=_t&&_t.XMLHttpRequest&&"withCredentials"in new _t.XMLHttpRequest?_t.XMLHttpRequest:void 0,St=null==_t?void 0:_t.AbortController,Et=null==_t?void 0:_t.CompressionStream,kt=null==mt?void 0:mt.userAgent,$t=null!=gt?gt:{},Pt=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function Tt(t){return"string"==typeof t||t}function Rt(t){return"string"==typeof t?t:void 0}var It,Ct=function(t){return t.AnonymousId="anonymous_id",t.DistinctId="distinct_id",t.Props="props",t.EnablePersonProcessing="enable_person_processing",t.PersonMode="person_mode",t.FeatureFlagDetails="feature_flag_details",t.FeatureFlags="feature_flags",t.FeatureFlagPayloads="feature_flag_payloads",t.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",t.BootstrapFeatureFlags="bootstrap_feature_flags",t.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",t.OverrideFeatureFlags="override_feature_flags",t.Queue="queue",t.LogsQueue="logs_queue",t.OptedOut="opted_out",t.SessionId="session_id",t.SessionStartTimestamp="session_start_timestamp",t.SessionLastTimestamp="session_timestamp",t.PersonProperties="person_properties",t.GroupProperties="group_properties",t.InstalledAppBuild="installed_app_build",t.InstalledAppVersion="installed_app_version",t.SessionReplay="session_replay",t.SurveyLastSeenDate="survey_last_seen_date",t.SurveysSeen="surveys_seen",t.Surveys="surveys",t.RemoteConfig="remote_config",t.FlagsEndpointWasHit="flags_endpoint_was_hit",t.DeviceId="device_id",t}({}),Ft=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),Ot=["$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"],Mt=["token"],At="NativeGzipValidationError",Dt=t=>t.length>=2&&31===t[0]&&139===t[1],jt=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),Lt=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=At,e},zt=function(){var t=e((function*(t,e){18>t.size&&Lt("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());Dt(i)&&8===i[2]||Lt("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(It)return It;It=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;It[t]=e>>>0}return It})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&Lt("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&Lt("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function Nt(){return Nt=e((function*(t,i,r){void 0===i&&(i=!0);try{var s=(new TextEncoder).encode(t),n=new CompressionStream("gzip"),o=n.writable.getWriter(),a=o.write(s).then((()=>o.close())).catch(function(){var t=e((function*(t){try{yield o.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),l=new Response(n.readable).blob(),[u]=yield Promise.all([l,a]);return yield zt(u,s),u}catch(t){if(null!=r&&r.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}})),Nt.apply(this,arguments)}var Ut=["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"],Bt=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return Ut.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function Ht(t,e){return-1!==t.indexOf(e)}var qt=function(t){return t.trim()},Gt=function(t){return t.replace(/^\$/,"")},Vt=Object.prototype,Wt=Vt.hasOwnProperty,Jt=Vt.toString,Kt=Array.isArray||function(t){return"[object Array]"===Jt.call(t)},Yt=t=>"function"==typeof t,Xt=t=>t===Object(t)&&!Kt(t),Qt=t=>{if(Xt(t)){for(var e in t)if(Wt.call(t,e))return!1;return!0}return!1},Zt=t=>void 0===t,te=t=>"[object String]"==Jt.call(t),ee=t=>te(t)&&0===t.trim().length,ie=t=>null===t,re=t=>Zt(t)||ie(t),se=t=>"[object Number]"==Jt.call(t)&&t==t,ne=t=>se(t)&&t>0,oe=t=>"[object Boolean]"===Jt.call(t),ae=t=>t instanceof FormData,le=t=>Ht(Ot,t),ue=t=>Ht(Mt,t);function he(t){return null===t||"object"!=typeof t}function de(t,e){return{}.toString.call(t)==="[object "+e+"]"}function ve(t){return"undefined"!=typeof Event&&function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Event)}var ce=[!0,"true",1,"1","yes"],fe=t=>Ht(ce,t),pe=[!1,"false",0,"0","no"];function ge(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),se(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),ge(s||i,e,i,r))}class _e{constructor(t){this.$t={},this.Gt=t.Gt,this.Zt=ge(t.bucketSize,0,100,t.Qt),this.Jt=ge(t.refillRate,0,this.Zt,t.Qt),this.Kt=ge(t.refillInterval,0,864e5,t.Qt)}Yt(t,e){var i=Math.floor((e-t.lastAccess)/this.Kt);i>0&&(t.tokens=Math.min(t.tokens+i*this.Jt,this.Zt),t.lastAccess=t.lastAccess+i*this.Kt)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.$t[r];return s?this.Yt(s,i):this.$t[r]=s={tokens:this.Zt,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.Gt)||e.call(this,t)),0===s.tokens)}stop(){this.$t={}}}var me="Mobile",ye="iOS",be="Android",we="Tablet",xe=be+" "+we,Se="iPad",Ee="Apple",ke=Ee+" Watch",$e="Safari",Pe="BlackBerry",Te="Samsung",Re=Te+"Browser",Ie=Te+" Internet",Ce="Chrome",Fe=Ce+" OS",Oe=Ce+" "+ye,Me="Internet Explorer",Ae=Me+" "+me,De="Opera",je=De+" Mini",Le="Edge",ze="Microsoft "+Le,Ne="Firefox",Ue=Ne+" "+ye,Be="Nintendo",He="PlayStation",qe="Xbox",Ge=be+" "+me,Ve=me+" "+$e,We="Windows",Je=We+" Phone",Ke="Nokia",Ye="Ouya",Xe="Generic",Qe=Xe+" "+me.toLowerCase(),Ze=Xe+" "+we.toLowerCase(),ti="Konqueror",ei="Oculus Browser",ii="Vivaldi",ri="Yandex",si="Whale",ni="DuckDuckGo",oi="Pale Moon",ai="Waterfox",li="Brave",ui="Google Search App",hi="(\\d+(\\.\\d+)?)",di=new RegExp("Version/"+hi),vi=new RegExp(qe,"i"),ci=new RegExp(He+" \\w+","i"),fi=new RegExp(Be+" \\w+","i"),pi=new RegExp(Pe+"|PlayBook|BB10","i"),gi={"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"},_i=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?li:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&Ht(t,"GSA/")?ui:Ht(t," OPR/")&&Ht(t,"Mini")?je:Ht(t," OPR/")?De:pi.test(t)?Pe:Ht(t,"IE"+me)||Ht(t,"WPDesktop")?Ae:Ht(t,"OculusBrowser")?ei:Ht(t,Re)?Ie:Ht(t,Le)||Ht(t,"Edg/")?ze:Ht(t,ii+"/")?ii:Ht(t,"YaBrowser/")?ri:Ht(t,si+"/")?si:Ht(t,ni+"/")||Ht(t,"Ddg/")?ni:Ht(t,"FBIOS")?"Facebook "+me:Ht(t,"UCWEB")||Ht(t,"UCBrowser")?"UC Browser":Ht(t,"CriOS")?Oe:Ht(t,"CrMo")||Ht(t,Ce)?Ce:Ht(t,be)&&Ht(t,$e)?Ge:Ht(t,"FxiOS")?Ue:Ht(t.toLowerCase(),ti.toLowerCase())?ti:Ht(t,li+"/")?li:((t,e)=>e&&Ht(e,Ee)||function(t){return Ht(t,$e)&&!Ht(t,Ce)&&!Ht(t,be)}(t))(t,e)?Ht(t,me)?Ve:$e:Ht(t,"PaleMoon/")?oi:Ht(t,ai+"/")?ai:Ht(t,Ne)?Ne:Ht(t,"MSIE")||Ht(t,"Trident/")?Me:Ht(t,"Gecko")?Ne:"")},mi={[Ae]:[new RegExp("rv:"+hi)],[ze]:[new RegExp(Le+"?\\/"+hi)],[Ce]:[new RegExp("("+Ce+"|CrMo)\\/"+hi)],[Oe]:[new RegExp("CriOS\\/"+hi)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+hi)],[$e]:[di],[Ve]:[di],[De]:[new RegExp("(Opera|OPR)\\/"+hi)],[Ne]:[new RegExp(Ne+"\\/"+hi)],[Ue]:[new RegExp("FxiOS\\/"+hi)],[ti]:[new RegExp("Konqueror[:/]?"+hi,"i")],[Pe]:[new RegExp(Pe+" "+hi),di],[Ge]:[new RegExp("android\\s"+hi,"i")],[Ie]:[new RegExp(Re+"\\/"+hi)],[ei]:[new RegExp("OculusBrowser\\/"+hi)],[ii]:[new RegExp(ii+"\\/"+hi)],[ri]:[new RegExp("YaBrowser\\/"+hi)],[si]:[new RegExp(si+"\\/"+hi)],[li]:[new RegExp(li+"\\/"+hi)],[ni]:[new RegExp("(DuckDuckGo|Ddg)\\/"+hi)],[oi]:[new RegExp("PaleMoon\\/"+hi)],[ai]:[new RegExp(ai+"\\/"+hi)],[ui]:[new RegExp("GSA\\/"+hi)],[Me]:[new RegExp("(rv:|MSIE )"+hi)],Mozilla:[new RegExp("rv:"+hi)]},yi=function(t,e,i,r){var s=_i(t,e,i,r),n=mi[s];if(Zt(n))return null;for(var o=0;n.length>o;o++){var a=t.match(n[o]);if(a)return parseFloat(a[a.length-2])}return null},bi=[[new RegExp(qe+"; "+qe+" (.*?)[);]","i"),t=>[qe,t&&t[1]||""]],[new RegExp(Be,"i"),[Be,""]],[new RegExp(He,"i"),[He,""]],[pi,[Pe,""]],[new RegExp(We,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Je,""];if(new RegExp(me).test(e)&&!/IEMobile\b/.test(e))return[We+" "+me,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=gi[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[We,r]}return[We,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[ye,[t[3],t[4],t[5]||"0"].join(".")]:[ye,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=Zt(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+be+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+be+")","i"),t=>t&&t[2]?[be,[t[2],t[3],t[4]||"0"].join(".")]:[be,""]],[/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/,[Fe,""]],[/Linux|debian/i,["Linux",""]]],wi=function(t){return fi.test(t)?Be:ci.test(t)?He:vi.test(t)?qe:new RegExp(Ye,"i").test(t)?Ye:new RegExp("("+Je+"|WPDesktop)","i").test(t)?Je:/iPad/.test(t)?Se:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?ke:pi.test(t)?Pe:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Ke,"i").test(t)?Ke:/(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(me).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)?be:xe:new RegExp("(pda|"+me+")","i").test(t)?Qe:new RegExp(we,"i").test(t)&&!new RegExp(we+" pc","i").test(t)?Ze:""},xi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Si(t,e){return"string"==typeof(i=t)&&xi.test(i)?t:e();var i}function Ei(t,e){var i=setTimeout(t,e);return(null==i?void 0:i.unref)&&(null==i||i.unref()),i}var ki=t=>t instanceof Error,$i={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}},Pi=$i.info;function Ti(t){if(oe(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(Kt(t))return{arrayValue:{values:t.map((t=>Ti(t)))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}function Ri(t){var e=[];for(var i in t){var r=t[i];ie(r)||Zt(r)||e.push({key:i,value:Ti(r)})}return e}function Ii(t,e){var r=t.level||"info",{text:s,number:n}=$i[r]||Pi,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:Ri(l)};return t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),Zt(t.trace_flags)||(u.flags=t.trace_flags),u}function Ci(t,e,r){return i({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":e,"telemetry.sdk.version":r})}function Fi(t,e,i,r){return{resourceLogs:[{resource:{attributes:Ri(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}let Oi=class{constructor(t,e,i,r,s,n){var o;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.Dt=e,this.Qt=i,this.Xt=r,this.er=s,this.tr=n,this.rr=null,this.ir=0,this.nr=0,this.sr=0,this.ar=0,this.lr=!1,this.ur=e.maxBufferSize,this.ot=Math.max(null!==(o=e.maxQueueSize)&&void 0!==o?o:e.maxBufferSize,e.maxBufferSize),this.hr=e.flushIntervalMs,this.cr=e.maxBatchRecordsPerPost,this.dr=e.rateCapWindowMs,this.vr=e.maxLogsPerInterval}reset(){this.pr(),this.rr=null,this.sr=0,this.ar=0,this.lr=!1,this.ir=0,this.nr=0,this.cr=this.Dt.maxBatchRecordsPerPost}onReconnect(){this.nr=0,this.gr()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var e=this.mr(t);if(null!==e)if(e.body){if(this.yr()){var i={record:Ii(e,this.Xt())};this.er((()=>this.br(i)))}}else this.Qt.info("Log was rejected in beforeSend function")}}mr(t){var e=this.Dt.beforeSend;if(!e)return t;var i=Kt(e)?e:[e],r=t;for(var s of i)try{var n=s(r);if(!n)return this.Qt.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.Qt.error("Error in beforeSend function for log:",t),null}return r}yr(){if(void 0===this.vr)return!0;var t=Date.now(),e=t-this.sr;return this.dr>e&&e>=0||(this.sr=t,this.ar=0,this.lr=!1),this.vr>this.ar?(this.ar++,!0):(this.lr||(this.Qt.warn("captureLog dropping logs: exceeded "+this.vr+" logs per "+this.dr+"ms"),this.lr=!0),!1)}flush(){var t=this;return e((function*(){if(!t._instance.isDisabled)return t.rr||(t.rr=t._r().finally((()=>{t.rr=null}))),t.rr}))()}_r(){var t=this;return e((function*(){var e;t.pr();var i=null!==(e=t._instance.getPersistedProperty(Ct.LogsQueue))&&void 0!==e?e:[];if(0!==i.length)for(var r=i.length,s=0;i.length>0&&r>s;){var n;t.ir=0;var o=Math.min(i.length,t.cr),a=i.slice(0,o),l=Fi(a.map((t=>t.record)),t.wr(),t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.kr(l);if("too-large"===u.kind&&a.length>1)t.cr=Math.max(1,Math.floor(a.length/2)),t.Qt.warn("Received 413 when sending logs batch of size "+a.length+", reducing batch size to "+t.cr);else{if("retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.Qt.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&t.Dt.maxBatchRecordsPerPost>t.cr&&(t.cr=Math.min(t.Dt.maxBatchRecordsPerPost,t.cr+1)),yield t.Sr(a.length),i=null!==(n=t._instance.getPersistedProperty(Ct.LogsQueue))&&void 0!==n?n:[],s+=a.length,"fatal"===u.kind)throw u.error}}}))()}Sr(t){var i=this;return e((function*(){var e,r=Math.max(0,t-i.ir),s=null!==(e=i._instance.getPersistedProperty(Ct.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(Ct.LogsQueue,s.slice(r)),yield i.tr()}))()}wr(){return Ci(this.Dt,this._instance.getLibraryId(),this._instance.getLibraryVersion())}br(t){var e;if(!this._instance.optedOut){var i=null!==(e=this._instance.getPersistedProperty(Ct.LogsQueue))&&void 0!==e?e:[];this.ot>i.length||(i.shift(),this.ir++,this.Qt.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(Ct.LogsQueue,i),this.ur>i.length?this.Cr():this.gr()}}Cr(t){void 0===t&&(t=this.hr),this.Ir||(this.Ir=Ei((()=>{this.Ir=void 0,this.gr()}),t))}Tr(){var t=Math.min(Math.max(0,this.nr-1),6);return this.hr*Math.pow(2,t)}Er(){var t=this._instance.getPersistedProperty(Ct.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return e((function*(){i.pr();var e=i.flush().catch((()=>{}));void 0!==t?yield Promise.race([e,new Promise((e=>Ei(e,t)))]):yield e}))()}flushWithTimeout(t){var i=this;return e((function*(){var e=!1,r=i.flush(),s=new Promise((i=>Ei((()=>{e=!0,i()}),t)));try{yield Promise.race([r,s])}finally{e&&r.catch((()=>{}))}}))()}gr(){this.flush().then((()=>{this.nr=0}),(t=>{this.nr++,this.Qt.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.Er()&&this.Cr(this.Tr())}))}pr(){this.Ir&&(clearTimeout(this.Ir),this.Ir=void 0)}};var Mi,Ai,Di;function ji(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return Di&&i.length===Ai||(Ai=i.length,Di=i.reduce(((i,r)=>{Mi||(Mi={});var s=Mi[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,Mi[r]=[l,u];break}}return i}),{})),Di}}class Li{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&&Kt(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:ji(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 zi="?";function Ni(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?zi:i,in_app:!0};return Zt(r)||(n.lineno=r),Zt(s)||(n.colno=s),n}var Ui=(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]:zi,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},Bi=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Hi=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,qi=/\((\S*)(?::(\d+))(?::(\d+))\)/,Gi=(t,e)=>{var i=Bi.exec(t);if(i){var[,r,s,n]=i;return Ni(e,r,zi,+s,+n)}var o=Hi.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=qi.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=Ui(o[1]||zi,o[2]);return Ni(e,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},Vi=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Wi=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ji=(t,e)=>{var i=Vi.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=Wi.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]||zi;return[n,s]=Ui(n,s),Ni(e,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Ki=/\(error: (.*)\)/;class Yi{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=te(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 de(t,"DOMException")}isDOMError(t){return de(t,"DOMError")}}class Xi{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 Qi{constructor(){}match(t){return de(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 Zi=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class tr{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(Zi);return r&&(e=r[1],i=r[2]),[e,i]}}var er=["fatal","error","warning","log","info","debug"];function ir(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 rr{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 ve(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: "+ir(t)}isSeverityLevel(t){return te(t)&&!ee(t)&&er.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(ki(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class sr{match(t){return ve(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+ir(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class nr{match(t){return he(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 or{match(t){return de(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!ve(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 he(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 ar="$message",lr="$timestamp",ur=new Set([ar,lr]),hr={enabled:!0,max_bytes:32768};function dr(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:hr.enabled,max_bytes:cr(t.max_bytes,hr.max_bytes)}:i({},hr)}class vr{constructor(t){this.Mr=[],this.Rr=0,this.Dt=dr(t)}setConfig(t){this.Dt=dr(t),this.Pr()}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(!Xt(i))return;var r=i,s=r[ar],n=r[lr];if(!te(s)||0===s.trim().length)return;if(!te(n)&&!se(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.Dt.max_bytes||(this.Mr.push({step:e.step,bytes:i}),this.Rr+=i,this.Pr())}}getAttachable(){return this.Mr.map((t=>t.step))}clear(){this.Mr=[],this.Rr=0}size(){return this.Mr.length}Pr(){for(;this.Rr>this.Dt.max_bytes&&this.Mr.length>0;){var t=this.Mr.shift();t&&(this.Rr-=t.bytes)}}}function cr(t,e){if(!se(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var fr=function(t,e){var{debugEnabled:i}=void 0===e?{}:e,r={k(e){if(gt&&(n.DEBUG||$t.POSTHOG_DEBUG||i)&&!Zt(gt.console)&&gt.console){for(var r=("__rrweb_original__"in gt.console[e]?gt.console[e].__rrweb_original__:gt.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)}},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.k("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.k("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.k("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];r.k("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)=>fr(t+" "+e,i)};return r},pr=fr("[PostHog.js]"),gr=pr.createLogger;function _r(t,e){Kt(t)&&t.forEach(e)}function mr(t,e){if(!re(t))if(Kt(t))t.forEach(e);else if(ae(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)Wt.call(t,i)&&e(t[i],i)}var yr=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 br(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 wr=function(t){try{return t()}catch(t){return}},xr=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){pr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),pr.critical(t)}}},Sr=function(t){var e={};return mr(t,(function(t,i){(te(t)&&t.length>0||se(t))&&(e[i]=t)})),e};var Er=["herokuapp.com","vercel.app","netlify.app"];function kr(t){var e=null==t?void 0:t.hostname;if(!te(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of Er)if(i===r)return!1;return!0}function $r(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 Pr(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 se(t)&&isFinite(t)&&Math.floor(t)===t});class Tr{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 Tr(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 Tr(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 Rr{constructor(){this.S=0,this.C=0,this.I=new Fr}generate(){var t=this.generateOrAbort();if(Zt(t)){this.S=0;var e=this.generateOrAbort();if(Zt(e))throw new Error("Could not generate UUID after timestamp reset");return e}return t}generateOrAbort(){var t=Date.now();if(t>this.S)this.S=t,this.M();else{if(this.S>=t+1e4)return;this.C++,this.C>4398046511103&&(this.S++,this.M())}return Tr.fromFieldsV7(this.S,Math.trunc(this.C/Math.pow(2,30)),this.C&Math.pow(2,30)-1,this.I.nextUint32())}M(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var Ir,Cr=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};gt&&!Zt(gt.crypto)&&crypto.getRandomValues&&(Cr=t=>crypto.getRandomValues(t));class Fr{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||(Cr(this.R),this.O=0),this.R[this.O++]}}var Or=()=>Mr().toString(),Mr=()=>(Ir||(Ir=new Rr)).generate(),Ar="",Dr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var jr={N:()=>!!yt,D(t){pr.error("cookieStore error: "+t)},P(t){if(yt){try{for(var e=t+"=",i=yt.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}},F(t){var e;try{e=JSON.parse(jr.P(t))||{}}catch(t){}return e},A(t,e,i,r,s){if(!yt)return!1;try{var n="",o="",a=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=yt),Ar)return Ar;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_"+Or();!Ar&&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",Ar=n)}return Ar}(t);if(!i){var r=(t=>{var e=t.match(Dr);return e?e[0]:""})(t);r!==i&&pr.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(yt.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&&pr.warn("cookieStore warning: large cookie, len="+u.length),yt.cookie=u,!0}catch(t){return!1}},q(t,e){if(null!=yt&&yt.cookie)try{jr.A(t,"",-1,e)}catch(t){return}}},Lr=null,zr={N(){if(!ie(Lr))return Lr;var t=!0;if(Zt(gt))t=!1;else try{var e="__mplssupport__";zr.A(e,"xyz"),'"xyz"'!==zr.P(e)&&(t=!1),zr.q(e)}catch(e){t=!1}return t||pr.error("localStorage unsupported; falling back to cookie store"),Lr=t,t},D(t){pr.error("localStorage error: "+t)},P(t){try{return null==gt?void 0:gt.localStorage.getItem(t)}catch(t){zr.D(t)}return null},F(t){try{return JSON.parse(zr.P(t))||{}}catch(t){}return null},A(t,e){try{return null==gt||gt.localStorage.setItem(t,JSON.stringify(e)),!0}catch(t){zr.D(t)}return!1},q(t){try{null==gt||gt.localStorage.removeItem(t)}catch(t){zr.D(t)}}},Nr=[a,"distinct_id",k,P,Q,X,V],Ur={},Br={N:()=>!0,D(t){pr.error("memoryStorage error: "+t)},P:t=>Ur[t]||null,F:t=>Ur[t]||null,A:(t,e)=>(Ur[t]=e,!0),q(t){delete Ur[t]}},Hr=null,qr={N(){if(!ie(Hr))return Hr;if(Hr=!0,Zt(gt))Hr=!1;else try{var t="__support__";qr.A(t,"xyz"),'"xyz"'!==qr.P(t)&&(Hr=!1),qr.q(t)}catch(t){Hr=!1}return Hr},D(t){pr.error("sessionStorage error: ",t)},P(t){try{return null==gt?void 0:gt.sessionStorage.getItem(t)}catch(t){qr.D(t)}return null},F(t){try{return JSON.parse(qr.P(t))||null}catch(t){}return null},A(t,e){try{return null==gt||gt.sessionStorage.setItem(t,JSON.stringify(e)),!0}catch(t){qr.D(t)}return!1},q(t){try{null==gt||gt.sessionStorage.removeItem(t)}catch(t){qr.D(t)}}};class Gr{constructor(t){this._instance=t}get Dt(){return this._instance.config}get consent(){return this.Lr()?0:this.Ar}isOptedOut(){return this.Dt.cookieless_mode===ot||this.isRejected()||-1===this.consent&&this.Dt.cookieless_mode===nt}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Dt.opt_out_capturing_by_default}optInOut(t){this.Fr.A(this.Nr,t?1:0,this.Dt.cookie_expiration,this.Dt.cross_subdomain_cookie,this.Dt.secure_cookie)}reset(){this.Fr.q(this.Nr,this.Dt.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 Ar(){var t=this.Fr.P(this.Nr);return fe(t)?1:Ht(pe,t)?0:-1}get Fr(){var t=this.Dt.opt_out_capturing_persistence_type,e="localStorage"===t?zr:jr;if(!this.Dr||this.Dr!==e){this.Dr=e;var i="localStorage"===t?jr:zr;i.P(this.Nr)&&(this.Dr.P(this.Nr)||this.optInOut(fe(i.P(this.Nr))),i.q(this.Nr,this.Dt.cross_subdomain_cookie))}return this.Dr}Lr(){return!!this.Dt.respect_dnt&&[null==mt?void 0:mt.doNotTrack,null==mt?void 0:mt.msDoNotTrack,$t.doNotTrack].some((t=>fe(t)))}}var Vr=1,Wr=3,Jr=11;function Kr(t){return t instanceof Element&&(t.id===Z||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Yr(t){return!!t&&t.nodeType===Vr}function Xr(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function Qr(t){return!!t&&t.nodeType===Wr}function Zr(t){return!!t&&t.nodeType===Jr&&Yr(t.host)}function ts(t){return t?qt(t).split(/\s+/):[]}function es(t){var e=null==gt?void 0:gt.location.href;return!!(e&&t&&t.some((t=>e.match(t))))}function is(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 ts(e)}function rs(t){return re(t)?null:qt(t).split(/(\s+)/).filter((t=>$s(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ss(t){var e="";return ms(t)&&!ys(t)&&t.childNodes&&t.childNodes.length&&mr(t.childNodes,(function(t){var i;Qr(t)&&t.textContent&&(e+=null!==(i=rs(t.textContent))&&void 0!==i?i:"")})),qt(e)}function ns(t){return Zt(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var os=["a","button","form","input","select","textarea","label"];function as(t,e){if(Zt(e))return!0;var i,r=function(t){if(e.some((e=>function(t,e){var i=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!i&&i.call(t,e)}catch(t){return!1}}(t,e))))return{v:!0}};for(var s of t)if(i=r(s))return i.v;return!1}function ls(t){var e=t.parentNode;return!(!e||!Yr(e))&&e}var us=[".ph-no-autocapture","[data-ph-no-autocapture]"],hs=["next","previous","prev",">","<"],ds=[...hs,"+","-","−","–"],vs=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,cs=[".ph-no-rageclick",".ph-no-capture"],fs=["","text","search","email","password","url","tel","number"];function ps(t,e){if(!gt||gs(t))return!1;var i,r,s,n,o;if(oe(e)?(i=!!e&&cs,r=void 0,s=!1):(i=null!==(n=null==e?void 0:e.css_selector_ignorelist)&&void 0!==n?n:cs,r=null==e?void 0:e.content_ignorelist,s=null!==(o=null==e?void 0:e.ignore_text_selection)&&void 0!==o&&o),!1===i)return!1;if(s&&function(t){return!(!t||!Yr(t))&&(!!Xr(t,"textarea")||(Xr(t,"input")?Ht(fs,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var e=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===e||""===e}(t)))}(t))return!1;var{targetElementList:a}=_s(t,!1);return!function(t,e){if(!1===t||Zt(t))return!1;var i;if(!0===t)i=hs;else{if(!Kt(t))return!1;if(t.length>10)return pr.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=>vs(e,t)||vs(r,t)))}))}(r,a.map((t=>{var e;return{safeText:ss(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!as(a,i)}var gs=t=>!t||Xr(t,"html")||!Yr(t),_s=(t,e)=>{if(!gt||gs(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[t],s=t;s.parentNode&&!Xr(s,"body");)if(Zr(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=ls(s);if(!n)break;if(e||os.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var o=gt.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function ms(t){for(var e=t;e.parentNode&&!Xr(e,"body");e=e.parentNode){var i=is(e);if(Ht(i,"ph-sensitive")||Ht(i,"ph-no-capture"))return!1}if(Ht(is(t),"ph-include"))return!0;var r=t.type||"";if(te(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!te(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 ys(t){return!!(Xr(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Xr(t,"select")||Xr(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var bs="(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})",ws=new RegExp("^(?:"+bs+")$"),xs=new RegExp(bs),Ss="\\d{3}-?\\d{2}-?\\d{4}",Es=new RegExp("^("+Ss+")$"),ks=new RegExp("("+Ss+")");function $s(t,e){if(void 0===e&&(e=!0),re(t))return!1;if(te(t)){if(t=qt(t),(e?ws:xs).test((t||"").replace(/[- ]/g,"")))return!1;if((e?Es:ks).test(t))return!1}return!0}function Ps(t){var e=ss(t);return $s(e=(e+" "+Ts(t)).trim())?e:""}function Ts(t){var e="";return t&&t.childNodes&&t.childNodes.length&&mr(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=ss(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Ts(t)).trim())}catch(t){pr.error("[AutoCapture]",t)}})),e}function Rs(t){return t.replace(/"|\\"/g,'\\"')}function Is(t){var e=t.attr__class;return e?Kt(e)?e:ts(e):void 0}var Cs=gr("[Dead Clicks]"),Fs=()=>!0,Os=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(g)),r=t.instance.config.capture_dead_clicks;return oe(r)?r:!!Xt(r)||i};class Ms{get lazyLoadedDeadClicksAutocapture(){return this.$r}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({[g]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.qr((()=>{this.jr()})):this.stop()}qr(t){var e,i;null!=(e=$t.__PosthogExtensions__)&&e.initDeadClicksAutocapture?t():null==(i=$t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?Cs.error("failed to load script",e):t()}))}jr(){var t;if(yt){if(!this.$r&&null!=(t=$t.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=Xt(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};e.__onCapture=this.onCapture,this.$r=$t.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.$r.start(yt),Cs.info("starting...")}}else Cs.error("`document` not found. Cannot start.")}stop(){this.$r&&(this.$r.stop(),this.$r=void 0,Cs.info("stopping..."))}}var As=gr("[SegmentIntegration]");var Ds="posthog-js";function js(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 f,p=(null==(l=e.exception)?void 0:l.values)||[],g=p.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}))),_={$exception_message:(null==(u=p[0])?void 0:u.value)||e.message,$exception_type:null==(h=p[0])?void 0:h.type,$exception_level:e.level,$exception_list:g,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(d=p[0])?void 0:d.value)||e.message,$sentry_exception_type:null==(v=p[0])?void 0:v.type,$sentry_tags:e.tags};return r&&s&&(_.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+e.event_id),a&&(null==(f=t.exceptions)||f.sendExceptionEvent(_)),e}}class Ls{constructor(t,e,i,r,s,n){this.name=Ds,this.setupOnce=function(o){o(js(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class zs{constructor(t){this.Br=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(pr.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Hr=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Ur()}Ur(){var t;this.zr=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Br)}destroy(){var t;null==(t=this.zr)||t.call(this),this.zr=void 0}doPageView(t,e){var i,r=this.Vr(t,e);return this.Hr={pathname:null!==(i=null==gt?void 0:gt.location.pathname)&&void 0!==i?i:"",pageViewId:e,timestamp:t},this._instance.scrollManager.resetContext(),r}doPageLeave(t){var e;return this.Vr(t,null==(e=this.Hr)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Hr)?void 0:t.pageViewId}}Vr(t,e){var i=this.Hr;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(!(Zt(n)||Zt(o)||Zt(a)||Zt(l)||Zt(u)||Zt(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?ge(o/n,0,1,pr):1,v=n>1?ge(a/n,0,1,pr):1,c=l>1?ge(u/l,0,1,pr):1,f=l>1?ge(h/l,0,1,pr):1;r=yr(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:f})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(t.getTime()-i.timestamp.getTime())/1e3),r}}var Ns=["flags","surveys"],Us={[o]:{exposure:"hidden"},[l]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[u]:{exposure:"hidden"},[h]:{exposure:"event"},[d]:{exposure:"hidden"},[v]:{exposure:"event"},[c]:{exposure:"hidden"},[f]:{exposure:"event"},[p]:{exposure:"event"},[g]:{exposure:"event"},[_]:{exposure:"hidden"},[m]:{exposure:"event"},[y]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[k]:{exposure:"hidden"},[P]:{exposure:"event"},[b]:{exposure:"event",shouldSkipFromEventProperties:t=>ie(t)},$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"},$sess_rec_flush_size:{exposure:"hidden"},[T]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!Xt(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",storageGroup:"flags"},[I]:{exposure:"hidden"},[C]:{exposure:"hidden",storageGroup:"flags"},[F]:{exposure:"event",storageGroup:"flags"},[O]:{exposure:"event",storageGroup:"flags",volatile:!0},[M]:{exposure:"event"},[A]:{exposure:"hidden"},[D]:{exposure:"hidden"},[j]:{exposure:"hidden"},[L]:{exposure:"hidden",storageGroup:"surveys"},[z]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[N]:{exposure:"event"},[U]:{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"},[B]:{exposure:"hidden"},[H]:{exposure:"hidden"},[q]:{exposure:"hidden"},[G]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[V]:{exposure:"hidden"},[W]:{exposure:"hidden"},[J]:{exposure:"hidden"},[K]:{exposure:"hidden"},[Y]:{exposure:"hidden"},[X]:{exposure:"hidden"},[Q]:{exposure:"hidden"},[w]:{exposure:"event"},[x]:{exposure:"event"},[S]:{exposure:"event"},[E]:{exposure:"event"},[et]:{exposure:"event"},[it]:{exposure:"event"},[rt]:{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"}},Bs=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Hs=t=>{var e=Us[t];if(e)return e;for(var[i,r]of Bs)if(0===t.indexOf(i))return r},qs=t=>{var e=null==yt?void 0:yt.createElement("a");return Zt(e)?null:(e.href=t,e)},Gs=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(!Kt(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){pr.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Vs=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("=");Kt(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},Ws=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},Js="https?://(.*)",Ks=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ys=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Ks],Xs="<masked>",Qs=["li_fat_id"];function Zs(t,e,i){if(!yt)return{};var r,s=e?[...Ks,...i||[]]:[],n=tn(Vs(yt.URL,s,Xs),t),o=(r={},mr(Qs,(function(t){var e=jr.P(t);r[t]=e||null})),r);return yr(o,n)}function tn(t,e){var i=Ys.concat(e||[]),r={};return mr(i,(function(e){var i=Gs(t,e);r[e]=i||null})),r}function en(t){var e=function(t){return t?0===t.search(Js+"google.([^/?]*)")?"google":0===t.search(Js+"bing.com")?"bing":0===t.search(Js+"yahoo.com")?"yahoo":0===t.search(Js+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",r={};if(!ie(e)){r.$search_engine=e;var s=yt?Gs(yt.referrer,i):"";s.length&&(r.ph_keyword=s)}return r}function rn(){return navigator.language||navigator.userLanguage}var sn="$direct";function nn(){return(null==yt?void 0:yt.referrer)||sn}function on(t,e){var i=t?[...Ks,...e||[]]:[],r=null==bt?void 0:bt.href.substring(0,1e3);return{r:nn().substring(0,1e3),u:r?Vs(r,i,Xs):void 0}}function an(t){var e,{r:i,u:r}=t,s={$referrer:i,$referring_domain:null==i?void 0:i==sn?sn:null==(e=qs(i))?void 0:e.host};if(r){s.$current_url=r;var n=qs(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=tn(r);yr(s,o)}if(i){var a=en(i);yr(s,a)}return s}function ln(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function un(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var hn={flags:G,surveys:z},dn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],vn="main";class cn{constructor(t,e,r){if(void 0===r&&(r=!0),this.Wr={},this.Gr=!1,this.Zr=!1,this.Dt=t,this.Qr=r,this.props={},this.Jr=!1,this.Kr=(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.Fr=this.Yr(t),this.Zr=this.Xr(t),this.load(),t.debug&&pr.info("Persistence loaded",t.persistence,i({},this.props)),this.update_config(t,t,e),this.save(),gt){var s=()=>this.flush();$r(gt,"beforeunload",s,{capture:!1}),$r(gt,"pagehide",s,{capture:!1})}}ei(){var t,e=null==(t=this.Dt)?void 0:t.persistence_save_debounce_ms;return se(e)&&e>0?e:0}isDisabled(){return!!this.ti}Yr(t){-1===dn.indexOf(t.persistence.toLowerCase())&&(pr.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var e,r=function(t,e){void 0===t&&(t=[]),void 0===e&&(e=!1);var r=[...Nr,...t];return i({},zr,{F(t){try{var i={};try{i=jr.F(t)||{}}catch(t){}var r,s=JSON.parse(zr.P(t)||"{}");if(e){var n={};for(var o in i){var a=i[o];ie(a)||""===a||(n[o]=a)}r=yr(s,n)}else r=yr(i,s);return zr.A(t,r),r}catch(t){}return null},A(t,e,i,s,n,o){var a=zr.A(t,e,void 0,void 0,o);try{var l={};r.forEach((t=>{e[t]&&(l[t]=e[t])})),Object.keys(l).length&&jr.A(t,l,i,s,n,o)}catch(t){zr.D(t)}return a},q(t,e){try{null==gt||gt.localStorage.removeItem(t),jr.q(t,e)}catch(t){zr.D(t)}}})}(t.cookie_persisted_properties||[],t.__preview_cookie_wins_on_conflict||!1),s=!1,n=t.persistence.toLowerCase();return"localstorage"===n&&zr.N()?(e=zr,s=!0):"localstorage+cookie"===n&&r.N()?(e=r,s=!0):"sessionstorage"===n&&qr.N()?e=qr:"memory"===n?e=Br:"cookie"===n?e=jr:r.N()?(e=r,s=!0):e=jr,this.Gr=s,e}ri(t){return this.Kr+"__"+t}Xr(t){return this.Gr&&!!t.split_storage}ii(t){var e=null!=t?t:this.Dt.feature_flag_cache_ttl_ms;if(!e||0>=e)return!1;var i=this.props[G];return!i||"number"!=typeof i||Date.now()-i>e}properties(){var t={};return mr(this.props,((e,i)=>{var r=Hs(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,i===T?()=>this.ii():()=>!1))return;r.transformToEventProperties&&yr(t,r.transformToEventProperties(e))}else if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,(()=>!1)))return;t[i]=e}})),t}load(){if(!this.ti){var t=this.Fr.F(this.Kr);t&&(this.props=yr({},t)),this.Zr&&this.ni()}}ni(){for(var t of Ns){var e=zr.F(this.ri(t));if(e&&!Qt(e)){var i=this.si(t);i.persisted=!0,this.oi(t)||(i.fingerprint=this.ai(e,t)),this.li(t,e)||yr(this.props,e)}}}oi(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=Hs(e))?void 0:i.storageGroup)===t}))}li(t,e){var i=hn[t];if(!i)return!1;var r=e[i],s=this.props[i];return se(r)&&se(s)&&s>r}refreshKey(t){var e;if(!this.ti){var i=this.Zr?null==(e=Hs(t))?void 0:e.storageGroup:void 0,r=i?zr.F(this.ri(i)):this.Fr.F(this.Kr);if(r&&t in r)this.ui(t,r[t]);else{if(i){var s=this.Fr.F(this.Kr);if(s&&t in s)return void this.ui(t,s[t])}this.hi(t)}}}save(){if(!this.ti){var t=this.ei();t>0?Zt(this.ci)&&(this.ci=setTimeout((()=>{this.ci=void 0,this.di()}),t)):this.di()}}flush(){Zt(this.ci)||(clearTimeout(this.ci),this.ci=void 0,this.di())}di(){this.ti||(this.Zr?this.vi():this.fi(this.Fr,this.Kr,this.props,vn))}vi(){var{main:t,groups:e}=this.pi();for(var i of(this.fi(this.Fr,this.Kr,t,vn),Ns)){var r,s=e[i];(!Qt(s)||null!=(r=this.Wr[i])&&r.persisted)&&this.fi(zr,this.ri(i),s,i)}}pi(){var t={},e={};for(var i of Ns)e[i]={};return mr(this.props,((i,r)=>{var s,n=null==(s=Hs(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}ai(t,e){if(e===vn)return JSON.stringify(t)+"|"+this.gi+"|"+this.mi+"|"+this.yi;var i={};return mr(t,((t,e)=>{var r;i[e]=null!=(r=Hs(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}fi(t,e,i,r){var s=this.si(r);if(r===vn||s.dirty||Zt(s.fingerprint)){var n;try{if((n=this.ai(i,r))===s.fingerprint)return void(s.dirty=!1)}catch(t){n=void 0}t.A(e,i,this.gi,this.mi,this.yi,this.Dt.debug)?(s.dirty=!1,r!==vn&&(s.persisted=!0),Zt(n)||(s.fingerprint=n)):this.Dt.debug&&pr.warn('failed to persist storage entry "'+e+'"; will retry on next save')}}remove(t){var{keepGroupEntries:e=!1}=void 0===t?{}:t;if(Zt(this.ci)||(clearTimeout(this.ci),this.ci=void 0),this.Fr.q(this.Kr,!1),this.Fr.q(this.Kr,!0),!e&&this.Qr)for(var i of Ns)zr.q(this.ri(i));e?delete this.Wr[vn]:this.Wr={}}clear(){this.remove(),this.props={}}register_once(t,e,i){if(Xt(t)){Zt(e)&&(e="None"),this.gi=Zt(i)?this.bi:i;var r=!1;if(mr(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.ui(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(Xt(t)){this.gi=Zt(e)?this.bi:e;var i=!1;if(mr(t,((e,r)=>{t.hasOwnProperty(r)&&this.props[r]!==e&&(this.ui(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.hi(t),this.save())}update_campaign_params(){if(!this.Jr){var t=Zs(this.Dt.custom_campaign_params,this.Dt.mask_personal_data_properties,this.Dt.custom_personal_data_properties);Qt(Sr(t))||this.register(t),this.Jr=!0}}update_search_keyword(){var t;this.register((t=null==yt?void 0:yt.referrer)?en(t):{})}update_referrer_info(){var t;this.register_once({$referrer:nn(),$referring_domain:null!=yt&&yt.referrer&&(null==(t=qs(yt.referrer))?void 0:t.host)||sn},void 0)}set_initial_person_info(){this.props[K]||this.props[Y]||this.register_once({[X]:on(this.Dt.mask_personal_data_properties,this.Dt.custom_personal_data_properties)},void 0)}get_initial_props(){var t={};mr([Y,K],(e=>{var i=this.props[e];i&&mr(i,(function(e,i){t["$initial_"+Gt(i)]=e}))}));var e,i,r=this.props[X];if(r){var s=(e=an(r),i={},mr(e,(function(t,e){i["$initial_"+Gt(e)]=t})),i);yr(t,s)}return t}safe_merge(t){return mr(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){this.bi=this.gi=t.cookie_expiration,this.set_disabled(t.disable_persistence||!!i),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie);var r=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||[]),s=r?this.Yr(t):this.Fr,n=this.Xr(t);if(r||n!==this.Zr){var o=this.props;this.clear(),this.Fr=s,this.Zr=n,this.props=o,this.save()}}set_disabled(t){this.ti=t,this.ti?this.remove():this.save()}set_cross_subdomain(t){t!==this.mi&&(this.mi=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.yi&&(this.yi=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[u]||{};i[t]=e,this.ui(u,i),this.save()}remove_event_timer(t){var e=this.props[u]||{},i=e[t];return Zt(i)||(delete e[t],this.ui(u,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.ui(t,e),this.save()}ui(t,e){var i;this.props[t]=e,null!=(i=Hs(t))&&i.volatile||this.wi(t)}hi(t){delete this.props[t],this.wi(t)}wi(t){var e,i=null==(e=Hs(t))?void 0:e.storageGroup;i&&(this.si(i).dirty=!0)}si(t){return this.Wr[t]||(this.Wr[t]={})}}var fn="events",pn="cancelEvents",gn="survey shown",_n="survey dismissed",mn="survey sent",yn="popover",bn=gr("[RateLimiter]");class wn{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=>{bn.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void bn.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(J))&&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(J,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var xn=gr("[RemoteConfig]");class Sn{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=$t._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}xi(t){var e,i;null!=(e=$t.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=$t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}ki(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 xn.info("Using preloaded remote config",this.remoteConfig),this.Si(this.remoteConfig),void this.Ci();if(this._instance.Ii())return void xn.warn("Remote config is disabled. Falling back to local config.");this.xi((t=>{if(!t)return xn.info("No config found after loading remote JS config. Falling back to JSON."),void this.ki((t=>{this.Si(t),this.Ci()}));this.Si(t),this.Ci()}))}catch(t){xn.error("Error loading remote config",t)}}stop(){this.Ti&&(clearInterval(this.Ti),this.Ti=void 0)}refresh(){!this._instance.Ii()&&yt&&"hidden"!==yt.visibilityState&&this._instance.reloadFeatureFlags()}Ci(){var t;if(!this.Ti){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.Ti=setInterval((()=>{this.refresh()}),e))}}Si(t){var e;t||xn.error("Failed to fetch remote config from PostHog."),this._instance.Si(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 En="gzip-js",kn="base64",$n=Uint8Array,Pn=Uint16Array,Tn=Uint32Array,Rn=new $n([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]),In=new $n([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]),Cn=new $n([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Fn=function(t,e){for(var i=new Pn(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Tn(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]},On=Fn(Rn,2),Mn=On[1];On[0][28]=258,Mn[258]=28;for(var An=Fn(In,0)[1],Dn=new Pn(32768),jn=0;32768>jn;++jn){var Ln=(43690&jn)>>>1|(21845&jn)<<1;Dn[jn]=((65280&(Ln=(61680&(Ln=(52428&Ln)>>>2|(13107&Ln)<<2))>>>4|(3855&Ln)<<4))>>>8|(255&Ln)<<8)>>>1}var zn=function(t,e,i){for(var r=t.length,s=0,n=new Pn(e);r>s;++s)++n[t[s]-1];var o,a=new Pn(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Pn(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[Dn[d]>>>l]=u}else for(o=new Pn(r),s=0;r>s;++s)o[s]=Dn[a[t[s]-1]++]>>>15-t[s];return o},Nn=new $n(288);for(jn=0;144>jn;++jn)Nn[jn]=8;for(jn=144;256>jn;++jn)Nn[jn]=9;for(jn=256;280>jn;++jn)Nn[jn]=7;for(jn=280;288>jn;++jn)Nn[jn]=8;var Un=new $n(32);for(jn=0;32>jn;++jn)Un[jn]=5;var Bn=zn(Nn,9,0),Hn=zn(Un,5,0),qn=function(t){return(t/8>>0)+(7&t&&1)},Gn=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Pn?Pn:t instanceof Tn?Tn:$n)(i-e);return r.set(t.subarray(e,i)),r},Vn=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},Wn=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},Jn=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 $n(0),0];if(1==s){var o=new $n(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 Pn(v+1),f=Kn(i[h-1],c,0);if(f>e){r=0;var p=0,g=f-e,_=1<<g;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;p+=_-(1<<f-c[m]),c[m]=e}for(p>>>=g;p>0;){var y=n[r].s;e>c[y]?p-=1<<e-c[y]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;c[b]==e&&(--c[b],++p)}f=e}return[new $n(c),f]},Kn=function(t,e,i){return-1==t.s?Math.max(Kn(t.l,e,i+1),Kn(t.r,e,i+1)):e[t.s]=i},Yn=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Pn(++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]},Xn=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},Qn=function(t,e,i){var r=i.length,s=qn(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)},Zn=function(t,e,i,r,s,n,o,a,l,u,h){Vn(e,h++,i),++s[256];for(var d=Jn(s,15),v=d[0],c=d[1],f=Jn(n,15),p=f[0],g=f[1],_=Yn(v),m=_[0],y=_[1],b=Yn(p),w=b[0],x=b[1],S=new Pn(19),E=0;m.length>E;++E)S[31&m[E]]++;for(E=0;w.length>E;++E)S[31&w[E]]++;for(var k=Jn(S,7),P=k[0],T=k[1],R=19;R>4&&!P[Cn[R-1]];--R);var I,C,F,O,M=u+5<<3,A=Xn(s,Nn)+Xn(n,Un)+o,D=Xn(s,v)+Xn(n,p)+o+14+3*R+Xn(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(A>=M&&D>=M)return Qn(e,h,t.subarray(l,l+u));if(Vn(e,h,1+(A>D)),h+=2,A>D){I=zn(v,c,0),C=v,F=zn(p,g,0),O=p;var j=zn(P,T,0);for(Vn(e,h,y-257),Vn(e,h+5,x-1),Vn(e,h+10,R-4),h+=14,E=0;R>E;++E)Vn(e,h+3*E,P[Cn[E]]);h+=3*R;for(var L=[m,w],z=0;2>z;++z){var N=L[z];for(E=0;N.length>E;++E)Vn(e,h,j[U=31&N[E]]),h+=P[U],U>15&&(Vn(e,h,N[E]>>>5&127),h+=N[E]>>>12)}}else I=Bn,C=Nn,F=Hn,O=Un;for(E=0;a>E;++E)if(r[E]>255){var U;Wn(e,h,I[257+(U=r[E]>>>18&31)]),h+=C[U+257],U>7&&(Vn(e,h,r[E]>>>23&31),h+=Rn[U]);var B=31&r[E];Wn(e,h,F[B]),h+=O[B],B>3&&(Wn(e,h,r[E]>>>5&8191),h+=In[B])}else Wn(e,h,I[r[E]]),h+=C[r[E]];return Wn(e,h,I[256]),h+C[256]},to=new Tn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),eo=function(){for(var t=new Tn(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),io=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function ro(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=eo[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 $n(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=Qn(l,u,t.subarray(h,d)):(l[h]=!0,u=Qn(l,u,t.subarray(h,o)))}else{for(var v=to[e-1],c=v>>>13,f=8191&v,p=(1<<i)-1,g=new Pn(32768),_=new Pn(p+1),m=Math.ceil(i/3),y=2*m,b=function(e){return(t[e]^t[e+1]<<m^t[e+2]<<y)&p},w=new Tn(25e3),x=new Pn(288),S=new Pn(32),E=0,k=0,P=(h=0,0),T=0,R=0;o>h;++h){var I=b(h),C=32767&h,F=_[I];if(g[C]=F,_[I]=C,h>=T){var O=o-h;if((E>7e3||P>24576)&&O>423){u=Zn(t,l,0,w,x,S,k,P,R,h-R,u),P=E=k=0,R=h;for(var M=0;286>M;++M)x[M]=0;for(M=0;30>M;++M)S[M]=0}var A=2,D=0,j=f,L=C-F&32767;if(O>2&&I==b(h-L))for(var z=Math.min(c,O)-1,N=Math.min(32767,h),U=Math.min(258,O);N>=L&&--j&&C!=F;){if(t[h+A]==t[h+A-L]){for(var B=0;U>B&&t[h+B]==t[h+B-L];++B);if(B>A){if(A=B,D=L,B>z)break;var H=Math.min(L,B-2),q=0;for(M=0;H>M;++M){var G=h-L+M+32768&32767,V=G-g[G]+32768&32767;V>q&&(q=V,F=G)}}}L+=(C=F)-(F=g[C])+32768&32767}if(D){w[P++]=268435456|Mn[A]<<18|An[D];var W=31&Mn[A],J=31&An[D];k+=Rn[W]+In[J],++x[257+W],++S[J],T=h+A,++E}else w[P++]=t[h],++x[t[h]]}}u=Zn(t,l,!0,w,x,S,k,P,R,h-R,u)}return Gn(a,0,r+qn(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&&io(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),io(u,h-8,i.d()),io(u,h-4,r),u}var so=!!xt||!!wt,no="text/plain",oo=!1,ao=(t,e)=>{var[i,r]=t.split("#"),[s,n]=i.split("?");if(!n)return t;var o=n.split("&").filter((t=>t.split("=")[0]!==e)).join("&");return s+(o?"?"+o:"")+(r?"#"+r:"")},lo=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 mr(t,(function(t,e){Zt(t)||Zt(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("&")},uo=(t,e)=>JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e),ho=t=>{if(t.Or)return t.Or;var{data:e,compression:i}=t;if(e){if(i===En){var r=ro(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new $n(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 $n(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 Gn(r,0,s)}(uo(e)),{mtime:0});return{contentType:no,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===kn){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(uo(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:uo(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=uo(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},vo=t=>{var e,r,s,n=ho(t);return!n||(r=t.compression,s=Gs(t.url,"compression"),r!==Ft.GZipJS&&s!==Ft.GZipJS&&"gzip"!==s)||((e=n.body)instanceof ArrayBuffer?Dt(new Uint8Array(e)):ArrayBuffer.isView(e)&&Dt(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?{url:t.url,encodedBody:n}:(oo=!0,{url:ao(t.url,"compression"),encodedBody:ho(i({},t,{compression:void 0,Or:void 0}))})},co=function(){var t=e((function*(t){var e=uo(t.data),r=yield function(t,e,i){return Nt.apply(this,arguments)}(e,n.DEBUG,{rethrow:!0});if(!r)return t;var s=yield r.arrayBuffer();return i({},t,{Or:{contentType:no,body:s,estimatedSize:s.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),fo=(t,e)=>lo(t,{_:(new Date).getTime().toString(),ver:n.JS_SDK_VERSION,compression:e}),po=[];wt&&po.push({transport:"fetch",method(t){var e,{url:r,encodedBody:s}=vo(t),{contentType:n,body:o,estimatedSize:a}=null!=s?s:{},l=new Headers;mr(t.headers,(function(t,e){l.append(e,t)})),n&&l.append("Content-Type",n);var u=null;if(St){var h=new St;u={signal:h.signal,timeout:setTimeout((()=>h.abort()),t.timeout)}}wt(r,i({method:(null==t?void 0:t.method)||"GET",headers:l,keepalive:"POST"===t.method&&52428.8>(a||0),body:o,signal:null==(e=u)?void 0:e.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){pr.error(t)}null==t.callback||t.callback(r)})))).catch((e=>{pr.error(e),null==t.callback||t.callback({statusCode:0,error:e})})).finally((()=>u?clearTimeout(u.timeout):null))}}),xt&&po.push({transport:"XHR",method(t){var e=new xt,{url:i,encodedBody:r}=vo(t);e.open(t.method||"GET",i,!0);var{contentType:s,body:n}=null!=r?r:{};mr(t.headers,(function(t,i){e.setRequestHeader(i,t)})),s&&e.setRequestHeader("Content-Type",s),t.timeout&&(e.timeout=t.timeout),e.onreadystatechange=()=>{if(4===e.readyState){var i={statusCode:e.status,text:e.responseText};if(200===e.status)try{i.json=JSON.parse(e.responseText)}catch(t){}null==t.callback||t.callback(i)}},e.send(n)}}),null!=mt&&mt.sendBeacon&&po.push({transport:"sendBeacon",method(t){try{var{url:e,encodedBody:i}=vo(t),{contentType:r,body:s}=null!=i?i:{};if(!s)return;var n=s instanceof Blob?s:new Blob([s],{type:r});mt.sendBeacon(e,n)}catch(t){}}});var go=3e3;class _o{constructor(t,e){this.Ei=!0,this.Mi=[],this.Ri=ge((null==e?void 0:e.flush_interval_ms)||go,250,5e3,pr.createLogger("flush interval"),go),this.Pi=t}enqueue(t){this.Mi.push(t),this.Oi||this.Li()}unload(){this.Ai();var t=this.Mi.length>0?this.Fi():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Pi(i({},t,{transport:"sendBeacon"}))}))}enable(){this.Ei=!1,this.Li()}Li(){var t=this;this.Ei||(this.Oi=setTimeout((()=>{if(this.Ai(),this.Mi.length>0){var e=this.Fi(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&Kt(i.data)&&mr(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Pi(i)};for(var r in e)i()}}),this.Ri))}Ai(){clearTimeout(this.Oi),this.Oi=void 0}Fi(){var t={};return mr(this.Mi,(e=>{var r,s=e,n=(s?s.batchKey:null)||s.url;Zt(t[n])&&(t[n]=i({},s,{data:[]})),null==(r=t[n].data)||r.push(s.data)})),this.Mi=[],t}}var mo=["retriesPerformedSoFar"];class yo{constructor(t){this.Ni=!1,this.Di=3e3,this.Mi=[],this._instance=t,this.Mi=[],this.$i=!0,!Zt(gt)&&"onLine"in gt.navigator&&(this.$i=gt.navigator.onLine,this.qi=()=>{this.$i=!0,this.ji()},this.Bi=()=>{this.$i=!1},$r(gt,"online",this.qi),$r(gt,"offline",this.Bi))}get length(){return this.Mi.length}retriableRequest(t){var{retriesPerformedSoFar:e}=t,s=r(t,mo);ne(e)&&(s.url=lo(s.url,{retry_count:e})),this._instance._send_request(i({},s,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=e?e:0))return void this.br(i({retriesPerformedSoFar:e},s));0===t.statusCode&&pr.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=e?e:0)+" retries.")}null==s.callback||s.callback(t)}}))}br(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.Mi.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),pr.warn(s),this.Ni||(this.Ni=!0,this.Hi())}Hi(){if(this.Ui&&clearTimeout(this.Ui),0===this.Mi.length)return this.Ni=!1,void(this.Ui=void 0);this.Ui=setTimeout((()=>{this.$i&&this.Mi.length>0&&this.ji(),this.Hi()}),this.Di)}ji(){var t=Date.now(),e=[],i=this.Mi.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this.Mi=e,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:t}of(this.Ui&&(clearTimeout(this.Ui),this.Ui=void 0),this.Ni=!1,Zt(gt)||(this.qi&&(gt.removeEventListener("online",this.qi),this.qi=void 0),this.Bi&&(gt.removeEventListener("offline",this.Bi),this.Bi=void 0)),this.Mi))try{this._instance._send_request(i({},t,{transport:"sendBeacon"}))}catch(t){pr.error(t)}this.Mi=[]}}class bo{constructor(t){this.zi=()=>{var t,e,i,r;this.Vi||(this.Vi={});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.Vi.lastScrollY=Math.ceil(n),this.Vi.maxScrollY=Math.max(n,null!==(t=this.Vi.maxScrollY)&&void 0!==t?t:0),this.Vi.maxScrollHeight=Math.max(o,null!==(e=this.Vi.maxScrollHeight)&&void 0!==e?e:0),this.Vi.lastContentY=a,this.Vi.maxContentY=Math.max(a,null!==(i=this.Vi.maxContentY)&&void 0!==i?i:0),this.Vi.maxContentHeight=Math.max(l,null!==(r=this.Vi.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get Wi(){return this._instance.config.scroll_root_selector}getContext(){return this.Vi}resetContext(){var t=this.Vi;return setTimeout(this.zi,0),t}startMeasuringScrollPosition(){$r(gt,"scroll",this.zi,{capture:!0}),$r(gt,"scrollend",this.zi,{capture:!0}),$r(gt,"resize",this.zi)}scrollElement(){if(!this.Wi)return null==gt?void 0:gt.document.documentElement;var t=Kt(this.Wi)?this.Wi:[this.Wi];for(var e of t){var i=null==gt?void 0:gt.document.querySelector(e);if(i)return i}}Gi(t){var e="y"===t?"scrollTop":"scrollLeft";if(this.Wi){var i=this.scrollElement();return i&&i[e]||0}return gt?"y"===t?gt.scrollY||gt.pageYOffset||gt.document.documentElement.scrollTop||0:gt.scrollX||gt.pageXOffset||gt.document.documentElement.scrollLeft||0:0}scrollY(){return this.Gi("y")}scrollX(){return this.Gi("x")}}var wo=t=>on(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties);class xo{constructor(t,e,i,r){this.Zi=t=>{var e=this.Qi();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Ji(this._instance)};this.Ki.register({[W]:i})}},this._instance=t,this.Yi=e,this.Ki=i,this.Ji=r||wo,this.Yi.onSessionId(this.Zi)}Qi(){return this.Ki.props[W]}getSetOnceProps(){var t,e=null==(t=this.Qi())?void 0:t.props;return e?"r"in e?an(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 mr(Sr(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+Gt(i)]=e})),t}}class So{constructor(){this.Xi={}}on(t,e){return this.Xi[t]||(this.Xi[t]=[]),this.Xi[t].push(e),()=>{this.Xi[t]=this.Xi[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.Xi[t]||[])i(e);for(var r of this.Xi["*"]||[])r(t,e)}}var Eo=gr("[SessionId]");class ko{on(t,e){return this.en.on(t,e)}constructor(t,e,i){var r;if(this.tn=null,this.rn=[],this.nn=void 0,this.sn=!1,this.en=new So,this.an=(t,e)=>!(!ne(t)||!ne(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===ot)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Dt=t.config,this.Ki=t.persistence,this.ln=void 0,this.un=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.hn=e||Or,this.cn=i||Or;var s=this.Dt.persistence_name||this.Dt.token;if(this._sessionTimeoutMs=1e3*ge(this.Dt.session_idle_timeout_seconds||1800,60,36e3,Eo.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.dn(),this.vn="ph_"+s+"_window_id",this.fn="ph_"+s+"_primary_window_exists",this.pn()){var n=qr.F(this.vn),o=qr.F(this.fn);n&&!o?this.ln=n:qr.q(this.vn),qr.A(this.fn,!0)}if(null!=(r=this.Dt.bootstrap)&&r.sessionID)try{var a=(t=>{var e=this.Dt.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.gn(this.Dt.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){Eo.error("Invalid sessionID in bootstrap",t)}this.mn()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Zt(this.rn)&&(this.rn=[]),this.rn.push(t),this.un&&t(this.un,this.ln),()=>{this.rn=this.rn.filter((e=>e!==t))}}pn(){return"memory"!==this.Dt.persistence&&!this.Ki.ti&&qr.N()}yn(t){t!==this.ln&&(this.ln=t,this.pn()&&qr.A(this.vn,t))}bn(){return this.ln?this.ln:this.pn()?qr.F(this.vn):null}_n(t){var e=this.tn;return!ie(e)&&!ie(t)&&5e3>Math.abs(t-e)}gn(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.un||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.un=t,s&&!r||s&&this._n(e)||(this.tn=e,this.Ki.register({[k]:[e,t,i]}))}wn(){var t,e=null==(t=this.Dt)?void 0:t.persistence_save_debounce_ms;return ne(e)&&e>0}xn(){this.wn()?this.Ki.refreshKey(k):(this.Ki.flush(),this.Ki.load())}kn(){var t;if(!ie(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.tn){this.xn();var[,e,i]=this.Sn();e===this.un&&i===this._sessionStartTimestamp&&(this.tn=this._sessionActivityTimestamp,this.Ki.register({[k]:[this._sessionActivityTimestamp,null!==(t=this.un)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Ki.flush())}}Cn(){var[t]=this.Sn(),e=ne(t)?t:0,i=ne(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}In(t){return this.xn(),this.an(t,this.Cn())}Sn(){var t=this.Ki.props[k];return Kt(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.tn=null,clearTimeout(this.Tn),this.Tn=void 0,this.gn(null,null,null)}destroy(){this.sn=!0,this.kn(),clearTimeout(this.Tn),this.Tn=void 0,this.nn&&gt&&(gt.removeEventListener(dt,this.nn,{capture:!1}),this.nn=void 0),this.rn=[]}mn(){this.nn=()=>{this.kn(),this.pn()&&qr.q(this.fn)},$r(gt,dt,this.nn,{capture:!1})}checkAndGetSessionAndWindowId(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=null),this.Dt.cookieless_mode===ot)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=e||(new Date).getTime(),[,r,s]=this.Sn(),n=this.Cn(),o=this.bn(),a=ne(s)&&Math.abs(i-s)>864e5,l=!1,u=!1,h=!r,d=r,v=!h&&!t&&this.an(i,n);v&&((v=this.In(i))||Eo.info("cross-tab refresh kept the session alive",{sessionId:r}),[,r,s]=this.Sn()),h||v||a?(r=this.hn(),o=this.cn(),Eo.info("new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:h,activityTimeout:v,sessionPastMaximumLength:a}}),s=i,l=!0):(o||(o=this.cn(),l=!0),(u=r!==d)&&(Eo.info("adopted cross-tab session id",{sessionId:r,windowId:o}),l=!0));var c=ne(n)&&t&&!a?n:i,f=ne(s)?s:(new Date).getTime();this.yn(o),this.gn(r,c,f),t||this.dn();var p={noSessionId:h,activityTimeout:v,sessionPastMaximumLength:a,crossTabAdoption:u};return l&&this.rn.forEach((t=>t(r,o,p))),{sessionId:r,windowId:o,sessionStartTimestamp:f,changeReason:l?p:void 0,lastActivityTimestamp:n}}dn(){this.sn||(clearTimeout(this.Tn),this.Tn=setTimeout((()=>{if(!this.sn)if(this.In((new Date).getTime())){var t=this.un;this.resetSessionId(),this.en.emit("forcedIdleReset",{idleSessionId:t})}else this.dn()}),1.1*this.sessionTimeoutMs))}}var $o=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&Bt(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>Bt(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver},Po=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 To(t,e,i){return uo({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Ro={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=>Po(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Po(e,t))))),icontains:(t,e)=>e.map(Io).some((e=>t.map(Io).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Io).every((e=>t.map(Io).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)))}))},Io=t=>t.toLowerCase();function Co(t,e){return!t||Object.entries(t).every((t=>{var[i,r]=t,s=null==e?void 0:e[i];if(Zt(s)||ie(s))return!1;var n=[String(s)],o=Ro[r.operator];return!!o&&o(r.values,n)}))}var Fo="custom",Oo="i.posthog.com",Mo=/^\/static\//;class Ao{constructor(t){this.En={},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("."+Oo,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.En[this.apiHost]||(this.En[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":Fo),this.En[this.apiHost]}Mn(t){if(Mo.test(t)){var e=this.instance.config.asset_host;if("string"==typeof e)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.Mn(e);if(i)return""+i+e}if(this.region===Fo)return this.apiHost+e;var r=Oo+e;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var Do=gr("[Surveys]"),jo="seenSurvey_",Lo=["popover","widget","api"],zo={ignoreConditions:!1,ignoreDelay:!1,displayType:yn},No=gr("[PostHog ExternalIntegrations]"),Uo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Bo{constructor(t){this._instance=t}qr(t,e){var i;null==(i=$t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return No.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(e){var i,s,n;!r||null!=(i=$t.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]||t.qr(Uo[e],(()=>{var i;null==(i=$t.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[e])||i.start(t._instance)})),!r&&null!=(s=$t.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[e]&&(null==(n=$t.__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 Ho,qo={},Go=0,Vo=()=>{},Wo='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Jo="Surveys module not available",Ko="sanitize_properties is deprecated. Use before_send instead",Yo="Invalid value for property_denylist config: ",Xo="posthog",Qo=!so&&-1===(null==kt?void 0:kt.indexOf("MSIE"))&&-1===(null==kt?void 0:kt.indexOf("Mozilla")),Zo=t=>{var e;return i({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:kr(null==yt?void 0:yt.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Vo,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,__preview_cookie_wins_on_conflict:!1,debug:bt&&te(null==bt?void 0:bt.search)&&-1!==bt.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,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==gt||null==(e=gt.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){pr.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:ut,before_send:void 0,request_queue_config:{flush_interval_ms:go},error_tracking:{},_onCapture:Vo},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:ds,ignore_text_selection:!0}:!t||"2025-11-30">t||{content_ignorelist:!0},capture_pageview:!t||"2025-05-24">t||"history_change",session_recording:t&&t>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:t&&t>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:t&&t>="2026-01-30"?"head":"body",internal_or_test_user_hostname:t&&t>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:t&&t>="2026-05-30"?250:0,split_storage:!(!t||"2026-05-30">t),detect_google_search_app:!(!t||"2026-05-30">t)}))(t))},ta=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],ea=t=>{var e={};for(var[i,r]of ta)Zt(t[i])||(e[r]=t[i]);var s=yr({},e,t),n=t.__preview_external_dependency_versioned_paths;return Zt(n)||(Zt(t.strict_script_versioning)&&(s.strict_script_versioning=!!n),te(n)&&Zt(t.asset_host)&&(s.asset_host=n)),Kt(t.property_blacklist)&&(Zt(t.property_denylist)?s.property_denylist=t.property_blacklist:Kt(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:pr.error(Yo+t.property_denylist)),s};class ia{constructor(){this.__forceAllowLocalhost=!1}get Rn(){return this.__forceAllowLocalhost}set Rn(t){pr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class ra{Pn(t,e){if(t){var i=this.On.indexOf(t);-1!==i&&this.On.splice(i,1)}return this.On.push(e),null==e.initialize||e.initialize(),e}Ln(){return this.config.cookieless_mode===ot||this.config.cookieless_mode===nt&&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 ia,this.An=!1,this.version=n.LIB_VERSION,this.Fn=new So,this.On=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Zo(),this.SentryIntegration=Ls,this.sentryIntegration=t=>function(t,e){var i=js(t,e);return{name:Ds,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Nn=!1,this.Dn=null,this.$n=null,this.qn=null,this.scrollManager=new bo(this),this.pageViewManager=new zs(this),this.rateLimiter=new wn(this),this.requestRouter=new Ao(this),this.consent=new Gr(this),this.externalIntegrations=new Bo(this);var e=null!==(t=ra.__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=te(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=te(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>pr.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==Xo){var r,s=null!==(r=qo[i])&&void 0!==r?r:new ra;return s._init(t,e,i),qo[i]=s,qo[Xo][i]=s,s}return this._init(t,e,i)}_init(t,e,r){var s,o;void 0===e&&(e={});var a=te(t)?t.trim():"";if(!a)return pr.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.jn(e.debug),this.Bn=e,this.Hn=[],e.person_profiles?this.$n=e.person_profiles:e.process_person&&(this.$n=e.process_person);var l=Zo(e.defaults),u=ea(e),h=yr({},l,u,{name:r,token:a});Xt(l.rageclick)&&Xt(u.rageclick)&&(h.rageclick=yr({},l.rageclick,u.rageclick)),Xt(l.session_recording)&&Xt(u.session_recording)&&(h.session_recording=yr({},l.session_recording,u.session_recording)),this.set_config(h),this.config.on_xhr_error&&pr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:En;var d=this.Un();this.persistence=new cn(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new cn(i({},this.config,{persistence:"sessionStorage"}),d,!1);var v=i({},this.persistence.props),c=i({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.zn=new _o((t=>this.Vn(t)),this.config.request_queue_config),this.Wn=new yo(this),this.__request_queue=[];var f=this.Ln();if(f||(this.sessionManager=new ko(this),this.sessionPropsManager=new xo(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(pr.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Gn(f)}),0)):(pr.info("Initializing extensions synchronously"),this.Gn(f)),n.DEBUG=n.DEBUG||this.config.debug,n.DEBUG&&pr.info("Starting in debug mode",{this:this,config:e,thisC:i({},this.config),p:v,s:c}),!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 p=e.bootstrap.distinctID,g=this.get_distinct_id(),_=this.persistence.get_property(V);if(e.bootstrap.isIdentifiedID&&null!=g&&g!==p&&_===at)this.identify(p);else if(e.bootstrap.isIdentifiedID&&null!=g&&g!==p&&_===lt)pr.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 m=this.config.get_device_id(Or()),y=e.bootstrap.isIdentifiedID?m:p;this.persistence.set_property(V,e.bootstrap.isIdentifiedID?lt:at),this.register({distinct_id:p,$device_id:y})}}if(f)this.register_once({distinct_id:tt,$device_id:null},"");else if(!this.get_distinct_id()){var b=this.config.get_device_id(Or());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(V,at)}return $r(gt,"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()||Or();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(V,lt)),e()},s=i.user();"then"in s&&Yt(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{Promise&&Promise.resolve||As.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()||(As.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(As.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,vt),identify:t=>e(t,ft),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.Zn())):this.Zn(),Yt(this.config._onCapture)&&this.config._onCapture!==Vo&&(pr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&pr.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Gn(t){var e,r,s,n,o,a,l,u=performance.now(),h=i({},ra.__defaultExtensionClasses,this.config.__extensionClasses),d=[];h.featureFlags&&this.On.push(this.featureFlags=null!==(e=this.featureFlags)&&void 0!==e?e:new h.featureFlags(this)),h.exceptions&&this.On.push(this.exceptions=null!==(r=this.exceptions)&&void 0!==r?r:new h.exceptions(this)),h.historyAutocapture&&this.On.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.On.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.On.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.On.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||d.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.On.push(this.autocapture=new h.autocapture(this)),h.surveys&&this.On.push(this.surveys=null!==(s=this.surveys)&&void 0!==s?s:new h.surveys(this)),h.logs&&this.On.push(this.logs=null!==(n=this.logs)&&void 0!==n?n:new h.logs(this)),h.conversations&&this.On.push(this.conversations=null!==(o=this.conversations)&&void 0!==o?o:new h.conversations(this)),h.productTours&&this.On.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.On.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.On.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.On.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.On.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,Os)),h.toolbar&&this.On.push(this.toolbar=null!==(a=this.toolbar)&&void 0!==a?a:new h.toolbar(this)),h.experiments&&this.On.push(this.experiments=null!==(l=this.experiments)&&void 0!==l?l:new h.experiments(this)),this.On.forEach((t=>{t.initialize&&d.push((()=>{null==t.initialize||t.initialize()}))})),d.push((()=>{if(this.Qn){var t=this.Qn;this.Qn=void 0,this.Si(t)}})),this.Jn(d,u)}Jn(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.Jn(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){pr.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[et]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[it]:r}),this.config.__preview_deferred_init_extensions&&pr.info("PostHog extensions initialized ("+r+"ms)")}Si(t){var e;if(!yt||!yt.body)return pr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Si(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Qn=t),this.Kn=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=Ht(t.supportedCompression,En)?En:Ht(t.supportedCompression,kn)?kn:void 0),null!=(e=t.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.$n?this.$n:ut}),this.On.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}Zn(){try{this.config.loaded(this)}catch(t){pr.critical("`loaded` function failed",t)}if(this.Yn(),this.config.internal_or_test_user_hostname&&null!=bt&&bt.hostname){var t=bt.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.Ln())&&this.Xn()}),1),this.es=new Sn(this),this.es.load()}Yn(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.zn)||t.enable())}_dom_loaded(){this.is_capturing()&&_r(this.__request_queue,(t=>this.Vn(t))),this.__request_queue=[],this.Yn()}_handle_unload(){var t,e,i,r;null==(t=this.surveys)||t.handlePageUnload(),this.config.request_batching?(this.ts()&&this.capture(ct),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(i=this.zn)||i.unload(),null==(r=this.Wn)||r.unload()):this.ts()&&this.capture(ct,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?Qo?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:429})):(t.transport=t.transport||this.config.api_transport,t.headers=i({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,(Zt(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.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=fo(n.url,n.compression);var o=null!==(e=n.transport)&&void 0!==e?e:"fetch",a=po.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===En&&Et&&!oo?co(n).then((t=>{l(t)})).catch((e=>{if(jt(e))return oo=!0,void l(i({},n,{compression:void 0,url:fo(t.url,void 0)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return jt(t)||e===At})(e)&&(oo=!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)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Vn(t){this.Wn?this.Wn.retriableRequest(t):this._send_request(t)}_execute_array(t){Go++;try{var e,i=[],r=[],s=[];_r(t,(t=>{if(t)if(Kt(e=t[0]))s.push(t);else if(Yt(t))try{t.call(this)}catch(e){pr.error("Error executing queued PostHog call",t,e)}else Kt(t)&&"alias"===e?i.push(t):Kt(t)&&-1!==e.indexOf("capture")&&Yt(this[e])?s.push(t):r.push(t)}));var n=function(t,e){_r(t,(function(t){try{if(Kt(t[0])){var i=e;mr(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){pr.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{Go--}}push(t){if(Go>0&&Kt(t)&&te(t[0])){var e=ra.prototype[t[0]];Yt(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.zn){if(this.is_capturing())if(!Zt(t)&&te(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&&!te(null==e?void 0:e.$current_url)&&(pr.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.rs||pr.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=Si(null==r?void 0:r.uuid,Or),f={uuid:c,event:t,properties:this.calculateEventProperties(t,e||{},v,c)};t===vt&&this.config.__preview_capture_bot_pageviews&&u&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),h&&(f.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens),(null==r?void 0:r.$set)&&(f.$set=null==r?void 0:r.$set);var p=null==r?void 0:r.$unset;p&&(f.$unset=p);var g,_,m,y=this.ns(null==r?void 0:r.$set_once,t!==pt,t===ft);if(y&&(f.$set_once=y),null!=r&&r._noTruncate||(n=this.config.properties_string_max_length,o=f,a=t=>te(t)?t.slice(0,n):t,l=new Set,f=function t(e,i){return e!==Object(e)?a?a(e):e:l.has(e)?void 0:(l.add(e),Kt(e)?(r=[],_r(e,(e=>{r.push(t(e))}))):(r={},mr(e,((e,i)=>{l.has(e)||(r[i]=t(e,i))}))),r);var r}(o)),f.timestamp=v,Zt(null==r?void 0:r.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=d),t===_n||t===mn){var b=null==e?void 0:e.$survey_id,w=null==e?void 0:e.$survey_iteration;(t=>{try{var e=(t=>((t,e)=>{var i=""+t+e.id;return e.current_iteration&&e.current_iteration>0&&(i=""+t+e.id+"_"+e.current_iteration),i})(jo,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){Do.error("Failed to persist survey seen state",t)}})({id:b,current_iteration:w}),f.$set=i({},f.$set,{[(g={id:b,current_iteration:w},_=t===mn?"responded":"dismissed",m="$survey_"+_+"/"+g.id,g.current_iteration&&g.current_iteration>0&&(m="$survey_"+_+"/"+g.id+"/"+g.current_iteration),m)]:!0})}else t===gn&&(f.$set=i({},f.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===t){var x=null==e?void 0:e.$product_tour_type;x&&(f.$set=i({},f.$set,{["$product_tour_last_seen_date/"+x]:(new Date).toISOString()}))}var S=i({},f.properties.$set,f.$set);if(Qt(S)||this.setPersonPropertiesForFlags(S),!re(this.config.before_send)){var E=this.mr(f);if(!E)return;(f=E).uuid=Si(f.uuid,Or)}this.Fn.emit("eventCaptured",f);var k={method:"POST",url:null!==(s=null==r?void 0:r._url)&&void 0!==s?s:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:f,compression:"best-available",batchKey:null==r?void 0:r._batchKey,transport:null==r?void 0:r.transport};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this.Vn(k):this.zn.enqueue(k),f}pr.critical("This capture call is ignored due to client rate limiting.")}}else pr.error("No event name provided to posthog.capture")}else pr.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.Ln()&&(l.$cookieless_mode=!0),"$snapshot"===t){var u=i({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=u.distinct_id,(!te(l.distinct_id)&&!se(l.distinct_id)||ee(l.distinct_id))&&pr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var h,d=function(t,e,i){var r,s,o,a;if(!kt)return{};var l,u,h,d,v,c,f,p,g,_=t?[...Ks,...e||[]]:[],[m,y]=function(t){for(var e=0;bi.length>e;e++){var[i,r]=bi[e],s=i.exec(t),n=s&&(Yt(r)?r(s,t):r);if(n)return n}return["",""]}(kt),b=null!=(l="undefined"!=typeof navigator?navigator:void 0)&&l.brave?{brave:!0}:{},w={detectGoogleSearchApp:i},x=yr(Sr({$os:m,$os_version:y,$browser:_i(kt,navigator.vendor,b,w),$device:wi(kt),$device_type:(h=kt,d={userAgentDataPlatform:null==(r=navigator)||null==(r=r.userAgentData)?void 0:r.platform,maxTouchPoints:null==(s=navigator)?void 0:s.maxTouchPoints,screenWidth:null==gt||null==(o=gt.screen)?void 0:o.width,screenHeight:null==gt||null==(a=gt.screen)?void 0:a.height,devicePixelRatio:null==gt?void 0:gt.devicePixelRatio},g=wi(h),g===Se||g===xe||"Kobo"===g||"Kindle Fire"===g||g===Ze?we:g===Be||g===qe||g===He||g===Ye?"Console":g===ke?"Wearable":g?me:"Android"===(null==d?void 0:d.userAgentDataPlatform)&&(null!==(v=null==d?void 0:d.maxTouchPoints)&&void 0!==v?v:0)>0?600>Math.min(null!==(c=null==d?void 0:d.screenWidth)&&void 0!==c?c:0,null!==(f=null==d?void 0:d.screenHeight)&&void 0!==f?f:0)/(null!==(p=null==d?void 0:d.devicePixelRatio)&&void 0!==p?p:1)?me:we:"Desktop"),$timezone:ln(),$timezone_offset:un()}),{$current_url:Vs(null==bt?void 0:bt.href,_,Xs),$host:null==bt?void 0:bt.host,$pathname:null==bt?void 0:bt.pathname,$raw_user_agent:kt.length>1e3?kt.substring(0,997)+"...":kt,$browser_version:yi(kt,navigator.vendor,b,w),$browser_language:rn(),$browser_language_prefix:(u=rn(),"string"==typeof u?u.split("-")[0]:void 0),$screen_height:null==gt?void 0:gt.screen.height,$screen_width:null==gt?void 0:gt.screen.width,$viewport_height:null==gt?void 0:gt.innerHeight,$viewport_width:null==gt?void 0:gt.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});return n.SDK_DIST_CHANNEL&&(x.$sdk_dist_channel=n.SDK_DIST_CHANNEL),x}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app);if(this.sessionManager){var{sessionId:v,windowId:c}=this.sessionManager.checkAndGetSessionAndWindowId(o,r.getTime());l.$session_id=v,l.$window_id=c}this.sessionPropsManager&&yr(l,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&yr(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(f=this.Wn)?void 0:f.length}catch(t){l.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Fo&&(l.$lib_custom_api_host=this.config.api_host),h=t!==vt||o?t!==ct||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,s),l=yr(l,h),t===vt&&yt&&(l.title=yt.title),!Zt(a)){var p=r.getTime()-a;l.$duration=parseFloat((p/1e3).toFixed(3))}kt&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser"),(l=yr({},d,this.persistence.properties(),this.sessionPersistence.properties(),l)).$is_identified=this._isIdentified(),Kt(this.config.property_denylist)?mr(this.config.property_denylist,(function(t){delete l[t]})):pr.error(Yo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var g=this.config.sanitize_properties;g&&(pr.error(Ko),l=g(l,t));var _=this.ss();return l.$process_person_profile=_,_&&!o&&this.os("_calculate_event_properties"),l}ns(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.ss())return t;if(this.An&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=yr({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(pr.error(Ko),o=a(o,"$set_once")),e&&(this.An=!0),Qt(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)}ls(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.Fn.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:Jo}),()=>{})}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:Jo})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:Jo})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=zo),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:Jo}}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:Jo})}us(t){return!t||ee(t)?(pr.critical("Unique user id has not been set in posthog.identify"),!1):t===tt?(pr.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())||(pr.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 pr.uninitializedWarning("posthog.identify");if(se(t)&&(t=t.toString(),pr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.us(t)&&this.os("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(V)||at)===at;t!==r&&n?(this.persistence.set_property(V,lt),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.capture(ft,{distinct_id:t,$anon_distinct_id:r},{$set:e||{},$set_once:i||{}}),this.qn=To(t,e,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(e||i)&&this.setPersonProperties(e,i),t!==r&&(this.reloadFeatureFlags(),this.unregister(B))}}setPersonProperties(t,e){if((t||e)&&this.os("posthog.setPersonProperties")){var i=To(this.get_distinct_id(),t,e);this.qn!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.qn=i):pr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(Kt(t)?t:[t]).filter((t=>te(t)&&t.length>0));0!==i.length&&this.os("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.qn=null)}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(pt,o)}r&&this.setGroupPropertiesForFlags({[t]:r}),n&&!r&&this.reloadFeatureFlags()}else pr.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(t){var e;void 0===t&&(t=!0),null==(e=this.featureFlags)||e.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,e){var i;void 0===e&&(e=!0),this.os("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,h;if(pr.info("reset"),!this.__loaded)return pr.uninitializedWarning("posthog.reset");var d,v=this.get_property(a),c=this.get_property(y);if(this.consent.reset(),null==(e=this.persistence)||e.clear(),null==(i=this.sessionPersistence)||i.clear(),Zt(c)||null==(d=this.persistence)||d.register({[y]:c}),null==(r=this.surveys)||r.reset(),null==(s=this.es)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(l=this.logs)||l.reset(),null==(u=this.persistence)||u.set_property(V,at),null==(h=this.sessionManager)||h.resetSessionId(),this.qn=null,this.config.cookieless_mode===ot)this.register_once({distinct_id:tt,$device_id:null},"");else{var f=this.config.get_device_id(Or());this.register_once({distinct_id:f,$device_id:t?f:v},"")}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.hs()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.cs()}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)?(pr.critical("Attempting to create alias for existing People user - aborting."),-2):this.os("posthog.alias")?(Zt(e)&&(e=this.get_distinct_id()),t!==e?(this.ls(l,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(pr.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=i({},this.config);if(Xt(t)){var r,s,o,a,l,u,h,d,v,c,f;yr(this.config,ea(t));var p=this.Un();null==(r=this.persistence)||r.update_config(this.config,e,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new cn(i({},this.config,{persistence:"sessionStorage"}),p,!1);var g=this.jn(this.config.debug);oe(g)&&(this.config.debug=g),oe(this.config.debug)&&(this.config.debug?(n.DEBUG=!0,zr.N()&&zr.A("ph_debug",!0),pr.info("set_config",{config:t,oldConfig:e,newConfig:i({},this.config)})):(n.DEBUG=!1,zr.N()&&zr.q("ph_debug"))),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(o=this.exceptions)||o.onConfigChange(),null==(a=this.sessionRecording)||a.startIfEnabledOrStop(),null==(l=this.tracingHeaders)||l.startIfEnabledOrStop(),null==(u=this.autocapture)||u.startIfEnabled(),null==(h=this.heatmaps)||h.startIfEnabled(),null==(d=this.exceptionObserver)||d.startIfEnabledOrStop(),null==(v=this.deadClicksAutocapture)||v.startIfEnabledOrStop(),null==(c=this.surveys)||c.loadIfEnabled(),this.ds(),null==(f=this.externalIntegrations)||f.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:ra.vs}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:Xo;return e!==Xo&&(e=Xo+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(V))===lt||(null==(e=this.sessionPersistence)?void 0:e.get_property(V))===lt}ss(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===ut&&!this._isIdentified()&&Qt(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[l])&&(null==(e=this.persistence)||null==(e=e.props)||!e[Q]))}ts(){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.ss()||this.os("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.os("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}os(t){return"never"===this.config.person_profiles?(pr.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.ls(Q,!0),!0)}Un(){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!==nt)}ds(){var t,e,i,r,s=this.Un();return(null==(t=this.persistence)?void 0:t.ti)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.ti)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==ot){if(this.Ln()){var i,r,s,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new ko(this),this.pageViewManager=new zs(this),this.persistence&&(this.sessionPropsManager=new xo(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=ra.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.Pn(this.sessionRecording,new l(this)),this.Kn&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Kn)))}var u,h;this.consent.optInOut(!0),this.ds(),this.Yn(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==nt&&(null==(u=this.surveys)||u.loadIfEnabled()),(Zt(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.Xn()}else pr.warn(Wo)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==ot?(this.config.cookieless_mode===nt&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.ds(),this.config.cookieless_mode===nt&&(this.register({distinct_id:tt,$device_id:null}),null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,null==(e=this.sessionManager)||e.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Xn(),this.Yn())):pr.warn(Wo)}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===ot||(this.config.cookieless_mode===nt?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.ds()}_is_bot(){return mt?$o(mt,this.config.custom_blocked_useragents):void 0}Xn(){yt&&("visible"===yt.visibilityState?this.Nn||(this.Nn=!0,this.capture(vt,{title:yt.title},{send_instantly:!0}),this.Dn&&(yt.removeEventListener(ht,this.Dn),this.Dn=null)):this.Dn||(this.Dn=this.Xn.bind(this),$r(yt,ht,this.Dn)))}debug(t){!1===t?(null==gt||gt.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==gt||gt.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}))}Ii(){var t,e,i,r,s,n,o=this.Bn||{};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?(pr.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=pr,s=(e="advanced_disable_flags")in(t=o)&&!re(t[e]),n=i in t&&!re(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]))}mr(t){var e;if(re(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(ue),r=Kt(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r){if(s=n(s),re(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return le(t.event)?pr.warn(o+". This can cause unexpected behavior."):pr.info(o),null}s.properties&&!Qt(s.properties)||pr.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of i)if(s.properties&&re(s.properties[a]))return pr.warn("Event '"+t.event+"' had its '"+a+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return s}getPageViewId(){var t;return null==(t=this.pageViewManager.Hr)?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)})}jn(t){var e=oe(t)&&!t,i=zr.N()&&"true"===zr.P("ph_debug");return!e&&(!!i||t)}}ra.__defaultExtensionClasses={},ra.vs={trace:Ho=()=>{},debug:Ho,info:Ho,warn:Ho,error:Ho,fatal:Ho},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=xr(t.prototype[e[i]])}(ra,["identify"]);class sa{constructor(t){this.disabled=!1===t;var e=Xt(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 na="$copy_autocapture",oa=gr("[AutoCapture]");function aa(t,e){return e.length>t?e.slice(0,t)+"...":e}function la(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!Yr(e));return e}function ua(t,e){var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u}=e;if(!Yr(t))return{props:{}};for(var h=[t],d=t;d.parentNode&&!Xr(d,"body");)if(Zr(d.parentNode))h.push(d.parentNode.host),d=d.parentNode.host;else{if(!Yr(d.parentNode))break;h.push(d.parentNode),d=d.parentNode}var v,c,f=[],p={},g=!1,_=!1;if(mr(h,(t=>{var e=ms(t);if(Xr(t,"a")){var i=t.getAttribute("href");g=e&&!!i&&$s(i)&&i}Ht(is(t),"ph-no-capture")&&(_=!0),f.push(function(t,e,i,r){var s=t.tagName.toLowerCase(),n={tag_name:s};os.indexOf(s)>-1&&!i&&(n.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?aa(1024,Ps(t)):aa(1024,ss(t)));var o=is(t);o.length>0&&(n.classes=o.filter((function(t){return""!==t}))),mr(t.attributes,(function(i){var s;if((!ys(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&$s(i.value)&&(!te(s=i.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=i.value;"class"===i.name&&(o=ts(o).join(" ")),n["attr__"+i.name]=aa(1024,o)}}));for(var a=1,l=1,u=t;u=la(u);)a++,u.tagName===t.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(t,o,a,l));var r=function(t){if(!ms(t))return{};var e={};return mr(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&&$s(r)&&(e[i]=r)}})),e}(t);yr(p,r)})),_)return{props:{},explicitNoCapture:_};if(a||(f[0].$el_text=Xr(t,"a")||Xr(t,"button")?Ps(t):ss(t)),g){var m,y;f[0].attr__href=g;var b=null==(m=qs(g))?void 0:m.host,w=null==gt||null==(y=gt.location)?void 0:y.host;b&&w&&b!==w&&(v=g)}return{props:yr({$event_type:n.type,$ce_version:1},u?{}:{$elements:f},{$elements_chain:(c=f,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 br(o).sort(((t,e)=>{var[i]=t,[r]=e;return i.localeCompare(r)})).forEach((t=>{var[e,i]=t;return a[Rs(e.toString())]=Rs(i.toString())})),(s+=":")+br(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:Is(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return br(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=f[0])&&r.$el_text?{$el_text:null==(s=f[0])?void 0:s.$el_text}:{},v&&"click"===n.type?{$external_click_url:v}:{},p)}}var ha=gr("[ExceptionAutocapture]"),da=gr("[TracingHeaders]"),va=gr("[Web Vitals]"),ca=9e5,fa="disabled",pa="lazy_loading",ga="awaiting_config",_a="missing_config";gr("[SessionRecording]"),gr("[SessionRecording]");var ma="[SessionRecording]",ya=gr(ma),ba=gr("[Heatmaps]");function wa(t){return Xt(t)&&"clientX"in t&&"clientY"in t&&se(t.clientX)&&se(t.clientY)}var xa=gr("[Product Tours]"),Sa=t=>{var e;return!t.config.disable_product_tours&&!(null==(e=t.persistence)||!e.get_property(_))},Ea=["$set_once","$set"],ka=gr("[SiteApps]"),$a="Error while initializing PostHog app with config id ";function Pa(t,e,i){if(re(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 Ta{constructor(t){this.fs=new So,this.ps=(t,e)=>this.gs(t,e)&&this.ys(t,e)&&this.bs(t,e)&&this._s(t,e),this.gs=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t,this.ws=new Set,this.xs=new Set}init(){var t,e;Zt(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(!Zt(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e,i;null==(e=this.xs)||e.add(t),null==(i=t.steps)||i.forEach((t=>{var e;null==(e=this.ws)||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.ws.has(t)||this.ws.has(null==e?void 0:e.event))&&this.xs&&(null==(i=this.xs)?void 0:i.size)>0&&this.xs.forEach((t=>{this.ks(e,t)&&this.fs.emit("actionCaptured",t.name)}))}Ss(t){this.onAction("actionCaptured",(e=>t(e)))}ks(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.ps(t,i))return!0;return!1}onAction(t,e){return this.fs.on(t,e)}ys(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(!Pa(r,e.url,e.url_matching||"contains"))return!1}return!0}bs(t,e){return!!this.Cs(t,e)&&!!this.Is(t,e)&&!!this.Ts(t,e)}Cs(t,e){var i;if(null==e||!e.href)return!0;var r=this.Es(t);if(r.length>0)return r.some((t=>Pa(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Pa((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}Is(t,e){var i;if(null==e||!e.text)return!0;var r=this.Es(t);if(r.length>0)return r.some((t=>Pa(t.text,e.text,e.text_matching||"exact")||Pa(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;!re(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=>Pa(t,n,o))))}Ts(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}Es(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}_s(t,e){return null==e||!e.properties||0===e.properties.length||Co(e.properties.reduce(((t,e)=>{var i=Kt(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 Ra{constructor(t){this.Ms=[],this._instance=t,this.Rs=new Map,this.Ps=new Map,this.Os=new Map}Ls(t,e){return!!t&&Co(t.propertyFilters,null==e?void 0:e.properties)}As(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}Fs(t,e,i){var r=(i===fn?this.Rs:this.Ps).get(t),s=[];return this.Ns((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.Ls(n,e)}))}register(t){var e;Zt(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.Ds(t),this.$s(t))}$s(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.qs&&(this.qs=new Ta(this._instance),this.qs.init(),this.qs.Ss((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.qs)||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.Os.get(e.name);i&&i.push(t.id),this.Os.set(e.name,i||[t.id])}})))})))}Ds(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.Rs=this.As(t,fn),this.Ps=this.As(t,pn))}onEvent(t,e){var i,r,s=this.ce(),n=(null==e||null==(i=e.properties)?void 0:i.$survey_id)||(null==e||null==(r=e.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this.js(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.Bs([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),void this.Hs(n)}if(this.Ps.has(t)){var a=this.Fs(t,e,pn);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.Bs(a.map((t=>t.id))),a.forEach((t=>this.Us(t.id))))}if(this.Rs.has(t)){s.info("event name matched",{event:t,eventPayload:e,items:this.Rs.get(t)});var l=this.Fs(t,e,fn);this.zs(l.map((t=>t.id)))}}onAction(t){this.Os.has(t)&&this.zs(this.Os.get(t)||[])}zs(t){0!==t.length&&(this.Ms=[...new Set([...this.Ms,...t])],this.ce().info("updating activated items",{activatedItems:this.getActivatedIds()}))}Hs(t){this.Ms=this.Ms.filter((e=>e!==t));var e=this.Vs();e.includes(t)||this.Ws([...e,t])}Bs(t){var e=new Set(t);this.Ms=this.Ms.filter((t=>!e.has(t)));var i=this.Vs(),r=i.filter((t=>!e.has(t)));r.length!==i.length&&this.Ws(r)}Vs(){var t,e=this.Gs();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}getActivatedIds(){return[...new Set([...this.Vs(),...this.Ms])].filter((t=>!this.Zs(t)))}reset(){this.Ms=[],this.Vs().length>0&&this.Ws([])}getEventToItemsMap(){return this.Rs}Qs(){return this.qs}}class Ia extends Ra{constructor(t){super(t)}Gs(){return N}Js(){return gn}Ns(t){var e;null==(e=this._instance)||e.getSurveys(t)}Us(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}ce(){return Do}Ws(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[N]:t})}Zs(){return!1}js(t,e){var i;this.Ns((t=>{i=t.find((t=>t.id===e))}));var r=!i||function(t){var e,i,r,s=(null!==(e=null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)&&void 0!==e?e:0)>0;return"always"===t.schedule||!(null==(r=t.conditions)||null==(r=r.events)||!r.repeatedActivation||!s)}(i);return r?t===gn?"consume":"ignore":t===gn?"persist":t===_n||t===mn?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Ca="SDK is not enabled or survey functionality is not yet loaded",Fa="Disabled. Not loading surveys.",Oa=null!=gt&&gt.location?Ws(gt.location.hash,"__posthog")||Ws(location.hash,"state"):null,Ma="_postHogToolbarParams",Aa=gr("[Toolbar]"),Da=gr("[FeatureFlags]"),ja=gr("[FeatureFlags]",{debugEnabled:!0}),La="\" failed. Feature flags didn't load in time.",za=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},Na=t=>{var e={};for(var[i,r]of br(t||{}))r&&(e[i]=r);return e},Ua=gr("[Error tracking]"),Ba="Refusing to render web experiment since the viewer is a likely bot",Ha={icontains:(t,e)=>!!gt&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!gt&&-1===e.href.toLowerCase().indexOf(t.toLowerCase()),regex:(t,e)=>!!gt&&Po(e.href,t),not_regex:(t,e)=>!!gt&&!Po(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class qa{get Dt(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{qa.Ks("retrieved web experiments from the server"),e.Ys=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.Ys&&(qa.Ks("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.Ys)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);te(r)&&t.variants[r]&&e.Xs(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];qa.eo(n)&&e.Xs(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())qa.Ks(Ba);else if(!this.Dt.disable_web_experiments){if(re(this.Ys))return this.Ys=new Map,this.loadIfEnabled(),void this.previewWebExperiment();qa.Ks("applying feature flags",t),t.forEach((t=>{var e;if(this.Ys&&null!=(e=this.Ys)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.Ys)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.Xs(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=qa.getWindowLocation();if(null!=t&&t.search){var e=Gs(null==t?void 0:t.search,"__experiment_id"),i=Gs(null==t?void 0:t.search,"__experiment_variant");e&&i&&(qa.Ks("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.ro(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.Dt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Dt.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.Dt.token),method:"GET",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}ro(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(qa.Ks("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.Xs(r[0].name,e,r[0].variants[e].transforms))}static eo(t){return!re(t.conditions)&&qa.io(t)&&qa.no(t)}static io(t){var e;if(re(t.conditions)||re(null==(e=t.conditions)?void 0:e.url))return!0;var i,r,s,n=qa.getWindowLocation();return!!n&&(null==(i=t.conditions)||!i.url||Ha[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==gt?void 0:gt.location}static no(t){var e;if(re(t.conditions)||re(null==(e=t.conditions)?void 0:e.utm))return!0;var i=Zs();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,f=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&&f&&v}return!1}static Ks(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];pr.info("[WebExperiments] "+t,i)}Xs(t,e,i){this._is_bot()?qa.Ks(Ba):"control"!==e?i.forEach((i=>{if(i.selector){var r;qa.Ks("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)}))}})):qa.Ks("Control variants leave the page unmodified.")}_is_bot(){return mt&&this._instance?$o(mt,this.Dt.custom_blocked_useragents):void 0}}var Ga=gr("[Conversations]"),Va="Conversations not available yet.",Wa={featureFlags:class{constructor(t){this.so=!1,this.oo=!1,this.ao=!1,this.lo=!1,this.uo=!1,this.ho=!1,this.co=!1,this.do=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Dt(){return this._instance.config}get Ki(){return this._instance.persistence}vo(t){return this._instance.get_property(t)}fo(){var t,e;return null!==(t=null==(e=this.Ki)?void 0:e.ii(this.Dt.feature_flag_cache_ttl_ms))&&void 0!==t&&t}po(){return!!this.fo()&&(this.do||this.ao||(this.do=!0,Da.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}mo(){var t,e=null!==(t=this.Dt.evaluation_contexts)&&void 0!==t?t:this.Dt.evaluation_environments;return!this.Dt.evaluation_environments||this.Dt.evaluation_contexts||this.co||(Da.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.co=!0),null!=e&&e.length?e.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||Da.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}yo(){return this.mo().length>0}bo(){var t=this.Dt.flag_keys;if(!Zt(t)){if(Kt(t))return t.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||Da.error("Invalid flag key found:",t,"Expected non-empty string"),e}));Da.error("Invalid flag_keys found:",t,"Expected array of non-empty strings")}}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,n,o=null!=r&&r.merge&&null!==(s=this.vo(T))&&void 0!==s?s:{},a=null!=r&&r.merge&&null!==(n=this.vo(F))&&void 0!==n?n:{},l=i({},o,t),u=i({},a,e),h={};for(var[d,v]of Object.entries(l))h[d]={key:d,enabled:Tt(v),variant:Rt(v),reason:void 0,metadata:Zt(null==u?void 0:u[d])?void 0:{id:0,version:void 0,description:void 0,payload:u[d]}};this.receivedFeatureFlags({flags:h})}get hasLoadedFlags(){return this.oo}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.vo(C),e=this.vo(M),r=this.vo(A);if(!r&&!e)return t||{};var s=yr({},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=Zt(h)?null!==(a=null==u?void 0:u.enabled)&&void 0!==a&&a:!!h,v=Zt(h)?u.variant:"string"==typeof h?h:void 0,c=null==r?void 0:r[o],f=i({},u,{enabled:d,variant:d?null!=v?v:null==u?void 0:u.variant:void 0});d!==(null==u?void 0:u.enabled)&&(f.original_enabled=null==u?void 0:u.enabled),v!==(null==u?void 0:u.variant)&&(f.original_variant=null==u?void 0:u.variant),c&&(f.metadata=i({},null==u?void 0:u.metadata,{payload:c,original_payload:null==u||null==(l=u.metadata)?void 0:l.payload})),s[o]=f}return this.so||(Da.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:s}),this.so=!0),s}getFlagVariants(){var t=this.vo(T),e=this.vo(M);if(!e)return t||{};for(var i=yr({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.so||(Da.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.so=!0),i}getFlagPayloads(){var t=this.vo(F),e=this.vo(A);if(!e)return t||{};for(var i=yr({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.so||(Da.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.so=!0),i}reloadFeatureFlags(){this.lo||this.Dt.advanced_disable_feature_flags||this._o||(this._instance.Fn.emit("featureFlagsReloading",!0),this._o=setTimeout((()=>{this.wo()}),5))}xo(){clearTimeout(this._o),this._o=void 0}ensureFlagsLoaded(){this.oo||this.ao||this._o||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.lo=t}wo(t){var e;if(this.xo(),!this._instance.Ii())if(this.ao)this.uo=!0;else{var r=this.Dt.token,s=this.vo(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.Ki)?void 0:e.get_initial_props())||{},this.vo(D)||{}),group_properties:this.vo(j),timezone:ln()};ie(s)||Zt(s)||(n.$device_id=s),(null!=t&&t.disableFlags||this.Dt.advanced_disable_feature_flags)&&(n.disable_flags=!0),this.yo()&&(n.evaluation_contexts=this.mo());var o=this.bo();Zt(o)||(n.flag_keys=o);var l=!!this.Dt.advanced_only_evaluate_survey_feature_flags,u=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Dt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.ao=!0,this._instance._send_request({method:"POST",url:u,data:n,compression:this.Dt.disable_compression?void 0:kn,timeout:this.Dt.feature_flag_request_timeout_ms,callback:t=>{var e,i,r,s=!0;if(200===t.statusCode&&(this.uo||(this.$anon_distinct_id=void 0),s=!1),this.ao=!1,!n.disable_flags||this.uo){this.ho=!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,u=!(null==(i=t.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(u&&o.push("quota_limited"),null==(r=this.Ki)||r.register({[q]:o}),u)Da.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:l}),this.uo&&(this.uo=!1,this.wo())}}})}}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.ho)if(this.oo||this.getFlags()&&this.getFlags().length>0){if(!this.po()){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 Da.warn('getFeatureFlag for key "'+t+La)}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.ho)if(this.oo||this.getFlags()&&this.getFlags().length>0){if(!this.po()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],o=String(s),a=this.vo(O)||void 0,l=this.vo(G)||void 0,u=this.vo(B)||{};if(this.Dt.advanced_feature_flags_dedup_per_session){var h,d=this._instance.get_session_id(),v=this.vo(H);d&&d!==v&&(u={},null==(h=this.Ki)||h.register({[B]:u,[H]:d}))}if((e.send_event||!("send_event"in e))&&(!(t in u)||!u[t].includes(o))){var c,f,p,g,_,m,y,b,w,x;Kt(u[t])?u[t].push(o):u[t]=[o],null==(c=this.Ki)||c.register({[B]:u});var S=this.getFeatureFlagDetails(t),E=[...null!==(f=this.vo(q))&&void 0!==f?f:[]];Zt(s)&&E.push("flag_missing");var k={$feature_flag:t,$feature_flag_response:s,$feature_flag_payload:n||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(p=this.Dt.bootstrap)||null==(p=p.featureFlags)?void 0:p[t])||null,$feature_flag_bootstrapped_payload:(null==(g=this.Dt.bootstrap)||null==(g=g.featureFlagPayloads)?void 0:g[t])||null,$used_bootstrap_value:!this.ho};Zt(null==S||null==(_=S.metadata)?void 0:_.version)||(k.$feature_flag_version=S.metadata.version);var P,T=null!==(m=null==S||null==(y=S.reason)?void 0:y.description)&&void 0!==m?m:null==S||null==(b=S.reason)?void 0:b.code;T&&(k.$feature_flag_reason=T),null!=S&&null!=(w=S.metadata)&&w.id&&(k.$feature_flag_id=S.metadata.id),Zt(null==S?void 0:S.original_variant)&&Zt(null==S?void 0:S.original_enabled)||(k.$feature_flag_original_response=Zt(S.original_variant)?S.original_enabled:S.original_variant),null!=S&&null!=(x=S.metadata)&&x.original_payload&&(k.$feature_flag_original_payload=null==S||null==(P=S.metadata)?void 0:P.original_payload),E.length&&(k.$feature_flag_error=E.join(",")),this._instance.capture("$feature_flag_called",k)}if(r)return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:Pt(n)}}}else Da.warn('getFeatureFlagResult for key "'+t+La)}getRemoteConfigPayload(t,e){var i=this.Dt.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.yo()&&(r.evaluation_contexts=this.mo());var s=this.bo();Zt(s)||(r.flag_keys=s),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Dt.disable_compression?void 0:kn,timeout:this.Dt.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.ho){if(this.oo||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(t,e);return Zt(i)?void 0:!!i}Da.warn('isFeatureEnabled for key "'+t+La)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,r){if(this.Ki){this.oo=!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]})))):Da.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(Kt(u)){Da.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var c={};if(u)for(var f=0;u.length>f;f++)c[u[f]]=!0;e&&e.register({[R]:u,[T]:c})}else{var p=u,g=h,_=l;if(null!=o&&o.partialResponse)p=i({},r,p),g=i({},s,g),_=i({},n,_);else if(t.errorsWhileComputingFlags)if(l){var m=new Set(Object.keys(l).filter((t=>{var e;return!(null!=(e=l[t])&&e.failed)})));p=i({},r,Object.fromEntries(Object.entries(p).filter((t=>{var[e]=t;return m.has(e)})))),g=i({},s,Object.fromEntries(Object.entries(g||{}).filter((t=>{var[e]=t;return m.has(e)})))),_=i({},n,Object.fromEntries(Object.entries(_||{}).filter((t=>{var[e]=t;return m.has(e)}))))}else p=i({},r,p),g=i({},s,g),_=i({},n,_);e&&e.register(i({[R]:Object.keys(Na(p)),[T]:p||{},[F]:g||{},[C]:_||{}},d?{[O]:d}:{},v?{[G]:v}:{}))}}}(t,this.Ki,s,n,o,r),e||(this.do=!1),this.ko(e)}}override(t,e){void 0===e&&(e=!1),Da.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.Ki)return Da.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.Ki.unregister(M),this.Ki.unregister(A),this.ko(),ja.info("All overrides cleared");if(Kt(t)){var e=za(t);return this.Ki.register({[M]:e}),this.ko(),ja.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,r=t;if(this.so=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.Ki.unregister(M),ja.info("Flag overrides cleared");else if(r.flags){if(Kt(r.flags)){var s=za(r.flags);this.Ki.register({[M]:s})}else this.Ki.register({[M]:r.flags});ja.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.Ki.unregister(A),ja.info("Payload overrides cleared")):r.payloads&&(this.Ki.register({[A]:r.payloads}),ja.info("Payload overrides set",{payloads:r.payloads}))),void this.ko()}if(t&&"object"==typeof t)return this.Ki.register({[M]:t}),this.ko(),ja.info("Flag overrides set",{flags:t});Da.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.oo){var{flags:e,flagVariants:i}=this.So();t(e,i)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,r){var s,n=(this.vo(I)||[]).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.Ki)||s.register({[R]:Object.keys(Na(l)),[T]:l}),this.ko()}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.vo(I),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.Dt.token+s),method:"GET",callback:e=>{var i,r;if(e.json){var s=e.json.earlyAccessFeatures;return null==(i=this.Ki)||i.unregister(I),null==(r=this.Ki)||r.register({[I]:s}),t(s)}}})}So(){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)),{})}}ko(t){var{flags:e,flagVariants:i}=this.So();this.featureFlagEventHandlers.forEach((r=>r(e,i,{errorsLoading:t})))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.vo(D)||{},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({[D]:i({},r,o,s)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=i({},this.vo(D)||{});t.forEach((t=>{delete r[t]})),this._instance.register({[D]:r}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this._instance.unregister(D),t&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var r=this.vo(j)||{};0!==Object.keys(r).length&&Object.keys(r).forEach((e=>{r[e]=i({},r[e],t[e]),delete t[e]})),this._instance.register({[j]:i({},r,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.vo(j)||{};this._instance.register({[j]:i({},e,{[t]:{}})})}else this._instance.unregister(j)}reset(){this.oo=!1,this.ao=!1,this.lo=!1,this.uo=!1,this.ho=!1,this.$anon_distinct_id=void 0,this.xo(),this.so=!1}}},Ja={sessionRecording:class{get Dt(){return this._instance.config}get Ki(){return this._instance.persistence}get started(){var t;return!(null==(t=this.Co)||!t.isStarted)}get status(){var t,e;return this.Io===ga||this.Io===_a?this.Io:null!==(t=null==(e=this.Co)?void 0:e.status)&&void 0!==t?t:this.Io}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.Io=fa,this.To=void 0,this._instance=t,!this._instance.sessionManager)throw ya.error("started without valid sessionManager"),new Error(ma+" started without valid sessionManager. This is a bug.");if(this.Dt.cookieless_mode===ot)throw new Error(ma+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get Eo(){var t,e=!(null==(t=this._instance.get_property(y))||!t.enabled),i=!this.Dt.disable_session_recording,r=this.Dt.disable_session_recording||this._instance.consent.isOptedOut();return gt&&e&&i&&!r}startIfEnabledOrStop(t){var e;if(!this.Eo||null==(e=this.Co)||!e.isStarted){var i=!Zt(Object.assign)&&!Zt(Array.from);this.Eo&&i?(this.Mo(t),ya.info("starting")):(this.Io=fa,this.stopRecording())}}Mo(t){var e,i,r;this.Eo&&(this.Io!==ga&&this.Io!==_a&&(this.Io=pa),null!=$t&&null!=(e=$t.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=$t.__PosthogExtensions__)&&i.initSessionRecording?this.Ro(t):null==(r=$t.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Po,(e=>{if(e)return ya.error("could not load recorder",e);this.Ro(t)})))}stopRecording(){var t,e;null==(t=this.To)||t.call(this),this.To=void 0,null==(e=this.Co)||e.stop()}Oo(){var t,e;null==(t=this.To)||t.call(this),this.To=void 0,null==(e=this.Co)||e.discard()}Lo(){var t,e;null==(t=this.Ki)||t.unregister(P),null==(e=this.Ki)||e.unregister(b)}Ao(t,e){if(re(t))return null;var i,r=se(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(ya.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Fo(t){if(this.Ki){var e,r,s=this.Ki,n=()=>{var e,r=!1===t.sessionRecording?void 0:t.sessionRecording,n=this.Ao(null==(e=this.Dt.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),o=this.Ao(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=n?n:o;re(a)&&this.Lo();var l=null==r?void 0:r.minimumDurationMilliseconds;s.register({[y]: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:Zt(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.To)||e.call(this),this.To=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(n)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.Fo(t),void this.Oo()):(this.Fo(t),void this.startIfEnabledOrStop()):(this.Io===ga&&(this.Io=_a,ya.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.Co)&&i.log?this.Co.log(t,e):ya.warn("log called before recorder was ready")}get Po(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(y);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}No(){var t,e,i=this._instance.get_property(y);if(!i)return!1;try{e="object"==typeof i?i:JSON.parse(i)}catch(t){return ya.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}var r=null!==(t=e.cache_timestamp)&&void 0!==t?t:Date.now();return 36e5>=Date.now()-r}Ro(t){var e,i;if(null==(e=$t.__PosthogExtensions__)||!e.initSessionRecording)return ya.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[rt]:!0});if(this.Co||(this.Co=null==(i=$t.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.Co._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.No()){if(this.Io===_a||this.Io===ga)return;return this.Io=ga,ya.info("persisted remote config is stale, requesting fresh config before starting"),void new Sn(this._instance).load()}this.Io=pa,this.Co.start(t)}onRRwebEmit(t){var e;null==(e=this.Co)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.Co||null==(e=this.Ki)||e.register({[x]:!0}),null==(t=this.Co)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.Co||null==(e=this.Ki)||e.register({[w]:!0}),null==(t=this.Co)||t.overrideSampling()}overrideTrigger(t){var e,i;this.Co||null==(i=this.Ki)||i.register({["url"===t?S:E]:!0}),null==(e=this.Co)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.Co)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.Co)||!i.tryAddCustomEvent(t,e))}}},Ka={autocapture:class{constructor(t){this.Do=!1,this.$o=null,this.qo=!1,this.instance=t,this.rageclicks=new sa(t.config.rageclick),this.jo=null}initialize(){this.startIfEnabled()}get Dt(){var t,e,i=Xt(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}Bo(){if(this.isBrowserSupported()){if(gt&&yt){var t=t=>{t=t||(null==gt?void 0:gt.event);try{this.Ho(t)}catch(t){oa.error("Failed to capture event",t)}};if($r(yt,"submit",t,{capture:!0}),$r(yt,"change",t,{capture:!0}),$r(yt,"click",t,{capture:!0}),this.Dt.capture_copied_text){var e=t=>{t=t||(null==gt?void 0:gt.event);try{this.Ho(t,na)}catch(t){oa.error("Failed to capture copy/cut event",t)}};$r(yt,"copy",e,{capture:!0}),$r(yt,"cut",e,{capture:!0})}}}else oa.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Do&&(this.Bo(),this.Do=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.qo=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[h]:!!t.autocapture_opt_out}),this.$o=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.jo=t}getElementSelectors(t){var e,i=[];return null==(e=this.jo)||e.forEach((e=>{var r=null==yt?void 0:yt.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(ie(this.$o)&&!oe(i)&&!this.instance.Ii())return!1;var r=null!==(e=this.$o)&&void 0!==e?e:!!i;return!!this.instance.config.autocapture&&!r}Ho(t,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var i,r=ns(t);Qr(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())&&ps(r,this.instance.config.rageclick)&&this.Ho(t,"$rageclick");var s=e===na;if(r&&function(t,e,i,r,s){var n,o,a,l,u,h;if(void 0===i&&(i=void 0),!gt||gs(t))return!1;if(null!=(n=i)&&n.url_allowlist&&!es(i.url_allowlist))return!1;if(null!=(o=i)&&o.url_ignorelist&&es(i.url_ignorelist))return!1;if(null!=(a=i)&&a.dom_event_allowlist){var d=i.dom_event_allowlist;if(d&&!d.some((t=>e.type===t)))return!1}var{parentIsUsefulElement:v,targetElementList:c}=_s(t,r);if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(Zt(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}(c,i))return!1;if(!as(c,null==(l=i)?void 0:l.css_selector_allowlist))return!1;if(as(c,null!==(u=null==(h=i)?void 0:h.css_selector_ignorelist)&&void 0!==u?u:us))return!1;var f=gt.getComputedStyle(t);if(f&&"pointer"===f.getPropertyValue("cursor")&&"click"===e.type)return!0;var p=t.tagName.toLowerCase();switch(p){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 v?(s||["click"]).indexOf(e.type)>=0:(s||["click"]).indexOf(e.type)>=0&&(os.indexOf(p)>-1||"true"===t.getAttribute("contenteditable"))}}(r,t,this.Dt,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:o}=ua(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Dt.element_attribute_ignorelist,elementsChainAsString:this.qo});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(n.$element_selectors=a),e===na){var l,u=rs(null==gt||null==(l=gt.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 Yt(null==yt?void 0:yt.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.Uo=(null==gt||null==(e=gt.location)?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(pr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.zo&&this.zo(),this.zo=void 0,pr.info("History API monitoring stopped")}monitorHistoryChanges(){gt&&gt.history&&(this.Vo("pushState"),this.Vo("replaceState"),this.Wo())}Vo(t){var e;if(gt&&(null==(e=gt.history[t])||!e.__posthog_wrapped__)){var i=this;!function(t,e,i){try{if(!(e in t))return()=>{};var r=t[e],s=i(r);return Yt(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=s,()=>{t[e]===s&&(t[e]=r)}}catch(t){return()=>{}}}(gt.history,t,(e=>function(r,s,n){e.call(this,r,s,n),i.Go(t)}))}}Go(t){try{var e,i=null==gt||null==(e=gt.location)?void 0:e.pathname;if(!i)return;i!==this.Uo&&this.isEnabled&&this._instance.capture(vt,{navigation_type:t}),this.Uo=i}catch(e){pr.error("Error capturing "+t+" pageview",e)}}Wo(){if(!this.zo){var t=()=>{this.Go("popstate")};$r(gt,"popstate",t),this.zo=()=>{gt&&gt.removeEventListener("popstate",t)}}}},heatmaps:class{get Dt(){return this.instance.config}constructor(t){var e;this.Zo=!1,this.Do=!1,this.Qo=null,this.instance=t,this.Zo=!(null==(e=this.instance.persistence)||!e.props[d]),this.rageclicks=new sa(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return Xt(this.Dt.capture_heatmaps)&&this.Dt.capture_heatmaps.flush_interval_milliseconds&&(t=this.Dt.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return re(this.Dt.capture_heatmaps)?re(this.Dt.enable_heatmaps)?this.Zo:this.Dt.enable_heatmaps:!1!==this.Dt.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Do)return;ba.info("starting..."),this.Jo(),this.Pt()}else{var t;clearInterval(null!==(t=this.Qo)&&void 0!==t?t:void 0),this.Ko(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[d]:e}),this.Zo=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}Yo(t){this._t(t.originalEvent,"deadclick")}Pt(){this.Qo&&clearInterval(this.Qo),this.Qo=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(yt)?setInterval(this.ji.bind(this),this.flushIntervalMilliseconds):null}Jo(){gt&&yt&&(this.Xo=this.ji.bind(this),$r(gt,dt,this.Xo),this.ea=t=>this._t(t||(null==gt?void 0:gt.event)),$r(yt,"click",this.ea,{capture:!0}),this.ta=t=>this.ra(t||(null==gt?void 0:gt.event)),$r(yt,"mousemove",this.ta,{capture:!0}),this.ia=new Ms(this.instance,Fs,this.Yo.bind(this)),this.ia.startIfEnabledOrStop(),this.na=this.Pt.bind(this),$r(yt,ht,this.na),this.Do=!0)}Ko(){var t;gt&&yt&&(this.Xo&&gt.removeEventListener(dt,this.Xo),this.ea&&yt.removeEventListener("click",this.ea,{capture:!0}),this.ta&&yt.removeEventListener("mousemove",this.ta,{capture:!0}),this.na&&yt.removeEventListener(ht,this.na),clearTimeout(this.sa),null==(t=this.ia)||t.stop(),this.Do=!1)}oa(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&&Yr(r)&&!Xr(r,"body");){if(r===i)return!1;if(Ht(e,null==gt?void 0:gt.getComputedStyle(r).position))return!0;r=ls(r)}return!1}(ns(t),["fixed","sticky"],s);return{x:t.clientX+(n?0:r),y:t.clientY+(n?0:i),target_fixed:n,type:e}}_t(t,e){var r;if(void 0===e&&(e="click"),!Kr(t.target)&&wa(t)){var s=this.oa(t,e);null!=(r=this.rageclicks)&&r.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&ps(ns(t),this.instance.config.rageclick)&&this.aa(i({},s,{type:"rageclick"})),this.aa(s)}}ra(t){!Kr(t.target)&&wa(t)&&(clearTimeout(this.sa),this.sa=setTimeout((()=>{this.aa(this.oa(t,"mousemove"))}),500))}aa(t){if(gt){var e=gt.location.href,i=this.Dt.custom_personal_data_properties,r=this.Dt.mask_personal_data_properties?[...Ks,...i||[]]:[],s=Vs(e,r,Xs);this.R=this.R||{},this.R[s]||(this.R[s]=[]),this.R[s].push(t)}}ji(){this.R&&!Qt(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ms,webVitalsAutocapture:class{constructor(t){var e;this.Zo=!1,this.Do=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.la=()=>{clearTimeout(this.ua),0!==this.R.metrics.length&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((t,e)=>i({},t,{["$web_vitals_"+e.name+"_event"]:i({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.vt=t=>{var e;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.ha();if(!Zt(r))if(re(null==t?void 0:t.name)||re(null==t?void 0:t.value))va.error("Invalid metric received",t);else if(!this.ca||this.ca>t.value){this.R.url!==r&&(this.la(),this.ua=setTimeout(this.la,this.flushToCaptureTimeoutMs)),Zt(this.R.url)&&(this.R.url=r),this.R.firstMetricTimestamp=Zt(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0);var s=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0),n=i({},t,{$current_url:r,timestamp:Date.now()});Zt(s)||(n.$session_id=s.sessionId,n.$window_id=s.windowId),this.R.metrics.push(n),this.R.metrics.length===this.allowedMetrics.length&&this.la()}else va.error("Ignoring metric with value >= "+this.ca,t)},this.da=()=>{if(!this.Do){var t,e,i,r,s=$t.__PosthogExtensions__;Zt(s)||Zt(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:e,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),t&&e&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.vt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&e(this.vt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.vt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.vt.bind(this)),this.Do=!0):va.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Zo=!(null==(e=this._instance.persistence)||!e.props[p]),this.startIfEnabled()}get va(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=Xt(this.va)?null==(t=this.va)?void 0:t.web_vitals_allowed_metrics:void 0;return re(i)?(null==(e=this._instance.persistence)?void 0:e.props[m])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(Xt(this.va)?this.va.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=Xt(this.va)?this.va.web_vitals_attribution:void 0;return null!=t&&t}get ca(){var t=Xt(this.va)&&se(this.va.__web_vitals_max_value)?this.va.__web_vitals_max_value:ca;return t>0&&6e4>=t?ca:t}get isEnabled(){var t=null==bt?void 0:bt.protocol;if("http:"!==t&&"https:"!==t)return va.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=Xt(this.va)?this.va.web_vitals:oe(this.va)?this.va:void 0;return oe(e)?e:this.Zo}startIfEnabled(){this.isEnabled&&!this.Do&&(va.info("enabled, starting..."),this.qr(this.da))}onRemoteConfig(t){if("capturePerformance"in t){var e=Xt(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=Xt(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[p]:e}),this._instance.persistence.register({[m]:i})),this.Zo=e,this.startIfEnabled()}}qr(t){var e,i;null!=(e=$t.__PosthogExtensions__)&&e.postHogWebVitalsCallbacks?t():null==(i=$t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(e=>{e?va.error("failed to load script",e):t()}))}ha(){var t=gt?gt.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...Ks,...e||[]]:[];return Vs(t,i,Xs)}va.error("Could not determine current URL")}}},Ya={exceptionObserver:class{constructor(t){var e,i,r;this.da=()=>{var t;if(gt&&this.isEnabled&&null!=(t=$t.__PosthogExtensions__)&&t.errorWrappingFunctions){var e=$t.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=$t.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=$t.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.fa&&this.Dt.capture_unhandled_errors&&(this.fa=e(this.captureException.bind(this))),!this.pa&&this.Dt.capture_unhandled_rejections&&(this.pa=i(this.captureException.bind(this))),!this.ga&&this.Dt.capture_console_errors&&(this.ga=r(this.captureException.bind(this)))}catch(t){ha.error("failed to start",t),this.ma()}}},this._instance=t,this.ya=!(null==(e=this._instance.persistence)||!e.props[v]),this.ba=new _e({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,Qt:ha}),this.Dt=this._a(),this.startIfEnabledOrStop()}_a(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Xt(t)?e=i({},e,t):(Zt(t)?this.ya:t)&&(e=i({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Dt.capture_console_errors||this.Dt.capture_unhandled_errors||this.Dt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ha.info("enabled"),this.ma(),this.qr(this.da)):this.ma()}qr(t){var e,i;null!=(e=$t.__PosthogExtensions__)&&e.errorWrappingFunctions?t():null==(i=$t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return ha.error("failed to load script",e);t()}))}ma(){var t,e,i;null==(t=this.fa)||t.call(this),this.fa=void 0,null==(e=this.pa)||e.call(this),this.pa=void 0,null==(i=this.ga)||i.call(this),this.ga=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.ya=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[v]:this.ya}),this.Dt=this._a(),this.startIfEnabledOrStop())}onConfigChange(){this.Dt=this._a()}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.ba.consumeRateLimit(s)?ha.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.wa=[],this.xa=new Li([new Yi,new or,new Qi,new Xi,new sr,new rr,new tr,new nr],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=Ki.test(l)?l.replace(Ki,"$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||zi});var r}))}(n)}}("web:javascript",Gi,Ji)),this._instance=t,this.wa=null!==(e=null==(r=this._instance.persistence)?void 0:r.get_property(c))&&void 0!==e?e:[],this.ka=dr(this.Sa()),this.Ca=new vr(this.ka)}onConfigChange(){this.ka=dr(this.Sa()),this.Ca.setConfig(this.ka)}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.wa=s,this._instance.persistence&&this._instance.persistence.register({[c]:this.wa,[f]:n})}}get Ia(){var t,e=!!this._instance.get_property(f),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.xa.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.ka.enabled)try{if(!te(t)||0===t.trim().length)return void Ua.warn("Ignoring exception step because message must be a non-empty string");var r=this.Ta(e),{sanitizedProperties:s,droppedKeys:n}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>ur.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(r);n.length>0&&Ua.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.Ca.add(i({[ar]:t,[lr]:(new Date).toISOString()},s))}catch(t){Ua.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.Ea(e)){if(this.Ma(e))return this.Ra("Exception dropped: matched a suppression rule"),void Ua.info("Skipping exception capture because a suppression rule matched");if(!this.Ia&&this.Pa(e))return this.Ra("Exception dropped: thrown by a browser extension"),void Ua.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Oa(e))return this.Ra("Exception dropped: thrown by the PostHog SDK"),void Ua.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.ka.enabled&&re(t.$exception_steps)?this.La(t):t;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",rs:!0});return r&&this.Ca.clear(),r}catch(t){return Ua.error("Failed to capture exception event. Dropping this exception.",t),void this.Ca.clear()}}catch(t){return void Ua.error("Failed to process exception event. Ignoring this exception.",t)}}La(t){try{var e=this.Ca.getAttachable();return 0===e.length?t:i({},t,{$exception_steps:e})}catch(e){return Ua.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Ra(t){this.ka.enabled&&this.Ca.add({[ar]:t,[lr]:(new Date).toISOString()})}Ta(t){return Xt(t)?i({},t):{}}Sa(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}Ma(t){if(0===t.length)return!1;var e=t.reduce(((t,e)=>{var{type:i,value:r}=e;return te(i)&&i.length>0&&t.$exception_types.push(i),te(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.wa.some((t=>{var i=t.values.map((t=>{var i,r=Ro[t.operator],s=Kt(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)}))}Pa(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://")))}Oa(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}Ea(t){return!re(t)&&Kt(t)}}},Xa=i({productTours:class{get Ki(){return this._instance.persistence}constructor(t){this.Aa=null,this.Fa=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if("productTours"in t){var e,i;if(this.Ki&&this.Ki.register({[_]:!!t.productTours}),!Sa(this._instance))return!this.Aa&&re(null==(e=this.Ki)?void 0:e.props[U])||xa.info("product tours disabled; stopping and clearing cached tours"),null==(i=this.Aa)||i.stop(),this.Aa=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Aa&&Sa(this._instance)&&this.qr((()=>this.Na()))}qr(t){var e,i;null!=(e=$t.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=$t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?xa.error("Could not load product tours script",e):t()}))}Na(){var t;!this.Aa&&null!=(t=$t.__PosthogExtensions__)&&t.generateProductTours&&(this.Aa=$t.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!Kt(this.Fa)||e){var i=this.Ki;if(i){var r=i.props[U];if(Kt(r)&&!e)return this.Fa=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=>{if(Sa(this._instance)){var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return xa.error(s),void t([],{isLoaded:!1,error:s})}var n=Kt(e.json.product_tours)?e.json.product_tours:[];this.Fa=n,i&&i.register({[U]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Fa,{isLoaded:!0})}getActiveProductTours(t){re(this.Aa)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Aa.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.Aa)||e.showTourById(t)}previewTour(t){this.Aa?this.Aa.previewTour(t):this.qr((()=>{var e;this.Na(),null==(e=this.Aa)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Aa)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Aa)||t.nextStep()}previousStep(){var t;null==(t=this.Aa)||t.previousStep()}clearCache(){var t;this.Fa=null,null==(t=this.Ki)||t.unregister(U)}resetTour(t){var e;null==(e=this.Aa)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.Aa)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.Aa)||e.cancelPendingTour(t)}}},Wa),Qa={siteApps:class{constructor(t){this.Da=0,this._instance=t,this.$a=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}qa(t,e){if(e){var i=this.globalsForEvent(e);this.$a.push(i),this.$a.length>1e3&&(this.$a=this.$a.slice(10))}}get siteAppLoaders(){var t;return null==(t=$t._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.qa.bind(this));this.ja=()=>{t(),this.$a=[],this.ja=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,f]of Object.entries(v))h[c]={id:d[c],type:c,properties:f};var{$set_once:p,$set:g}=t;return{event:i({},r(t,Ea),{properties:i({},t.properties,g?{$set:i({},null!==(e=null==(s=t.properties)?void 0:s.$set)&&void 0!==e?e:{},g)}:{},p?{$set_once:i({},null!==(n=null==(o=t.properties)?void 0:o.$set_once)&&void 0!==n?n:{},p)}:{}),elements_chain:null!==(a=null==(l=t.properties)?void 0:l.$elements_chain)&&void 0!==a?a:"",distinct_id:null==(u=t.properties)?void 0:u.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:h}}Ba(t){var e,i=null==(e=t.tagName)?void 0:e.toLowerCase();return"style"===i&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(ka.error("prepare_external_dependency_stylesheet returned null"),null):"script"===i&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(ka.error("prepare_external_dependency_script returned null"),null):t}Ha(){var t,e,i,r,s,n,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var l=null==yt?void 0:yt.defaultView,u=null==l||null==(t=l.Node)?void 0:t.prototype;if(!l||!u)return()=>{};if(this.Da++,this.Ua)return this.za();var h=[],d=this,v=new WeakSet,c=(t,e,i)=>{if(null!=t&&t[e]){var r=t[e];t[e]=i(r),h.push((()=>{t[e]=r}))}},f=t=>{if(v.has(t))return t;var e=d.Ba(t);return e&&v.add(e),e},p=t=>t.map((t=>"string"==typeof t?t:f(t))).filter((t=>!ie(t)));return c(u,"appendChild",(t=>function(e){var i=f(e);return i?t.call(this,i):e})),c(u,"insertBefore",(t=>function(e,i){var r=f(e);return r?t.call(this,r,i):e})),c(u,"replaceChild",(t=>function(e,i){var r=f(e);return r?t.call(this,r,i):i})),[null==(e=l.Element)?void 0:e.prototype,null==(i=l.Document)?void 0:i.prototype,null==(r=l.DocumentFragment)?void 0:r.prototype].forEach((t=>{c(t,"append",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))})),c(t,"prepend",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))}))})),[null==(s=l.Element)?void 0:s.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(o=l.DocumentType)?void 0:o.prototype].forEach((t=>{c(t,"before",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))})),c(t,"after",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];return t.apply(this,p(i))})),c(t,"replaceWith",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];var s=p(i);return i.length&&!s.length?void 0:t.apply(this,s)}))})),c(null==(a=l.Element)?void 0:a.prototype,"insertAdjacentElement",(t=>function(e,i){var r=f(i);return r?t.call(this,e,r):null})),this.Ua=()=>{h.forEach((t=>t())),this.Ua=void 0},this.za()}za(){var t=!1;return()=>{var e;t||(t=!0,this.Da--,0===this.Da&&(null==(e=this.Ua)||e.call(this)))}}Va(t,e){void 0===e&&(e=!0);var i=this.Ha();try{var r=t(i);return e&&i(),r}catch(t){throw i(),t}}setupSiteApp(t){var e=this.apps[t.id],i=()=>{var i;!e.errored&&this.$a.length&&(ka.info("Processing "+this.$a.length+" events for site app with id "+t.id),this.$a.forEach((t=>this.Va((()=>null==e.processEvent?void 0:e.processEvent(t))))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this.ja)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,ka.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=this.Va((e=>t.init({posthog:this._instance,callback(t){e(),s(t)}})),!1);n&&(e.processEvent=n),r=!0}catch(e){ka.error($a+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){ka.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}Wa(){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)}Ga(t){var e=this;if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t),r=function(r){try{e.Va((()=>null==r.processEvent?void 0:r.processEvent(i)))}catch(e){ka.error("Error while processing event "+t.event+" for site app "+r.id,e)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var e,i,r,s=this;if(null!=(e=this.siteAppLoaders)&&e.length)return this.isEnabled?(this.Wa(),void this._instance.on("eventCaptured",(t=>this.Ga(t)))):void ka.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.ja)||i.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var e;$t["__$$ph_site_app_"+t]=s._instance,null==(e=$t.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(s._instance,a,(e=>{if(e)return ka.error($a+t,e)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else ka.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},Za={tracingHeaders:class{constructor(t){this.Za=void 0,this.Qa=void 0,this.Ja=void 0,this.da=()=>{var t,e,i=this.Ka();i?(Zt(this.Za)&&(this.Za=null==(t=$t.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),Zt(this.Qa)&&(this.Qa=null==(e=$t.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.ma()},this._instance=t}initialize(){this.startIfEnabledOrStop()}qr(t){var e,i;null!=(e=$t.__PosthogExtensions__)&&e.tracingHeadersPatchFns?t():null==(i=$t.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return da.error("failed to load script",e);t()}))}Ya(){var t,e;return null!==(t=null!==(e=this._instance.config.tracing_headers)&&void 0!==e?e:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}Ka(){var t=this.Ya();return Kt(t)?(Kt(this.Ja)?this.Ja.splice(0,this.Ja.length,...t):this.Ja=[...t],t.length>0?this.Ja:void 0):(Kt(this.Ja)&&this.Ja.splice(0),this.Ja=t||void 0,this.Ja)}ma(){var t,e;null==(t=this.Za)||t.call(this),null==(e=this.Qa)||e.call(this),this.Za=void 0,this.Qa=void 0}startIfEnabledOrStop(){this.Ka()?this.qr(this.da):this.ma()}}},tl=i({surveys:class{get Dt(){return this._instance.config}constructor(t){this.Xa=void 0,this._surveyManager=null,this.el=!1,this.tl=[],this.rl=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Dt.disable_surveys){var e=t.surveys;if(re(e))return Do.warn("Flags not loaded yet. Not loading surveys.");var i=Kt(e);this.Xa=i?e.length>0:e,Do.info("flags response received, isSurveysEnabled: "+this.Xa),this.loadIfEnabled()}}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var e=[],i=0;i<localStorage.length;i++){var r=localStorage.key(i);(null!=r&&r.startsWith(jo)||null!=r&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this._surveyManager)if(this.el)Do.info("Already initializing surveys, skipping...");else if(this.Dt.disable_surveys)Do.info(Fa);else if(this.Dt.cookieless_mode&&this._instance.consent.isOptedOut())Do.info("Not loading surveys in cookieless mode without consent.");else{var t=null==$t?void 0:$t.__PosthogExtensions__;if(t){if(!Zt(this.Xa)||this.Dt.advanced_enable_surveys){var e=this.Xa||this.Dt.advanced_enable_surveys;this.el=!0;try{var i=t.generateSurveys;if(i)return void this.il(i,e);var r=t.loadExternalDependency;if(!r)return void this.nl(st);r(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.nl("Could not load surveys script",i):this.il(t.generateSurveys,e)}))}catch(t){throw this.nl("Error initializing surveys",t),t}finally{this.el=!1}}}else Do.error("PostHog Extensions not found.")}}il(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new Ia(this._instance),Do.info("Surveys loaded successfully"),this.sl({isLoaded:!0})}nl(t,e){Do.error(t,e),this.sl({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.tl.push(t),this._surveyManager&&this.sl({isLoaded:!0}),()=>{this.tl=this.tl.filter((e=>e!==t))}}getSurveys(t,e){if(void 0===e&&(e=!1),this.Dt.disable_surveys)return Do.info(Fa),t([]);var i,r=this._instance.get_property(L);if(r&&!e)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.rl?this.rl.then((e=>{var{surveys:i,context:r}=e;return t(i,r)})):("undefined"!=typeof Promise&&(this.rl=new Promise((t=>{i=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Dt.token),method:"GET",timeout:this.Dt.surveys_request_timeout_ms,callback:e=>{var r;this.rl=null;var s=e.statusCode;if(200!==s||!e.json){var n="Surveys API could not be loaded, status: "+s;Do.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,[z]:Date.now()});var h={isLoaded:!0};t(l,h),null==i||i({surveys:l,context:h})}}))}sl(t){for(var e of this.tl)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){Do.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!re(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);Do.warn("init was not called")}ol(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}al(t){if(re(this._surveyManager))return{eligible:!1,reason:Ca};var e="string"==typeof t?this.ol(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(re(this._surveyManager))return Do.warn("init was not called"),{visible:!1,disabledReason:Ca};var e=this.al(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return re(this._surveyManager)?(Do.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Ca})):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.al(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var r;if(re(this._surveyManager))Do.warn("init was not called");else{var s="string"==typeof t?this.ol(t):t;if(null!=s&&s.id)if(Lo.includes(s.type)){var n=null==yt?void 0:yt.querySelector(e);if(n)return null!=(r=s.appearance)&&r.surveyPopupDelaySeconds?(Do.info("Rendering survey "+s.id+" with delay of "+s.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,e;Do.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),Do.info("Survey "+s.id+" rendered")}),1e3*s.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(s,n,i);Do.warn("Survey element not found")}else Do.warn("Surveys of type "+s.type+" cannot be rendered in the app");else Do.warn("Survey not found")}}displaySurvey(t,e){var r;if(re(this._surveyManager))Do.warn("init was not called");else{var s=this.ol(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!==yn&&e.initialResponses&&Do.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 Do.warn("Survey is not eligible to be displayed: ",o.disabledReason)}"inline"!==e.displayType?this._surveyManager.handlePopoverSurvey(n,e):this.renderSurvey(n,e.selector,e.properties)}else Do.warn("Survey not found")}}cancelPendingSurvey(t){re(this._surveyManager)?Do.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},Wa),el={toolbar:class{constructor(t){this.instance=t}ll(t){$t.ph_toolbar_state=t}ul(){var t;return null!==(t=$t.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),Pr(this.instance.config))return!1;if(!gt||!yt)return!1;t=null!=t?t:gt.location,i=null!=i?i:gt.history;try{if(!e){try{gt.localStorage.setItem("test","test"),gt.localStorage.removeItem("test")}catch(t){return!1}e=null==gt?void 0:gt.localStorage}var r,s=Oa||Ws(t.hash,"__posthog")||Ws(t.hash,"state"),n=s?wr((()=>JSON.parse(atob(decodeURIComponent(s)))))||wr((()=>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(Ma)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(t){return!1}}hl(t){var e=$t.ph_load_toolbar||$t.ph_load_editor;!re(e)&&Yt(e)?e(t,this.instance):Aa.warn("No toolbar load function found")}loadToolbar(t){var e=!(null==yt||!yt.getElementById(Z));if(!gt||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(gt.localStorage.setItem(Ma,JSON.stringify(i({},s,{source:void 0}))),2===this.ul())this.hl(s);else if(0===this.ul()){var n;this.ll(1),null==(n=$t.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return Aa.error("[Toolbar] Failed to load",t),void this.ll(0);this.ll(2),this.hl(s)})),$r(gt,"turbolinks:load",(()=>{this.ll(0),this.loadToolbar(s)}))}return!0}cl(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)}}},il=i({experiments:qa},Wa),rl=i({},Wa,Ja,Ka,Ya,Xa,Qa,tl,Za,el,il,{conversations:class{constructor(t){this.dl=void 0,this._conversationsManager=null,this.vl=!1,this.fl=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;re(e)||(oe(e)?this.dl=e:(this.dl=e.enabled,this.fl=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.dl=void 0,this.fl=null}loadIfEnabled(){if(!(this._conversationsManager||this.vl||this._instance.config.disable_conversations||Pr(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==$t?void 0:$t.__PosthogExtensions__;if(t&&!Zt(this.dl)&&this.dl)if(this.fl&&this.fl.token){this.vl=!0;try{var e=t.initConversations;if(e)return this.pl(e),void(this.vl=!1);var i=t.loadExternalDependency;if(!i)return void this.gl(st);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.gl("Could not load conversations script",e):this.pl(t.initConversations),this.vl=!1}))}catch(t){this.gl("Error initializing conversations",t),this.vl=!1}}else Ga.error("Conversations enabled but missing token in remote config.")}}pl(t){if(this.fl)try{this._conversationsManager=t(this.fl,this._instance),Ga.info("Conversations loaded successfully")}catch(t){this.gl("Error completing conversations initialization",t)}else Ga.error("Cannot complete initialization: remote config is null")}gl(t,e){Ga.error(t,e),this._conversationsManager=null,this.vl=!1}show(){this._conversationsManager?this._conversationsManager.show():Ga.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.dl&&!ie(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):(Ga.warn(Va),null)}))()}getMessages(t,i){var r=this;return e((function*(){return r._conversationsManager?r._conversationsManager.getMessages(t,i):(Ga.warn(Va),null)}))()}markAsRead(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(Ga.warn(Va),null)}))()}getTickets(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(Ga.warn(Va),null)}))()}requestRestoreLink(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(Ga.warn(Va),null)}))()}restoreFromToken(t){var i=this;return e((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(Ga.warn(Va),null)}))()}restoreFromUrlToken(){var t=this;return e((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Ga.warn(Va),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}hs(){var t;null==(t=this._conversationsManager)||t.setIdentity()}cs(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},{logs:class{constructor(t){var e;this.ml=!1,this.yl=!1,this.Qt=gr("[logs]"),this.Mi=[],this.bl=()=>{var t;null==(t=this._l)||t.onReconnect()},this._instance=t,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.ml=!0),gt&&$r(gt,"online",this.bl)}wl(){var t,e,i,r,s,n,o,a,l,u,h,d,v,c,f=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;return this._l&&this.xl===f||(null==(e=this._l)||e.reset(),this.xl=f,this.kl=(u=null!==(r=null==(i=f)?void 0:i.flushIntervalMs)&&void 0!==r?r:3e3,h=null!==(s=null==i?void 0:i.maxBufferSize)&&void 0!==s?s:100,d=null!==(n=null==i?void 0:i.maxLogsPerInterval)&&void 0!==n?n:1e3,v=Math.max(h,d),{serviceName:null!==(o=null==(c=null==i?void 0:i.resourceAttributes)?void 0:c["service.name"])&&void 0!==o?o:null==i?void 0:i.serviceName,serviceVersion:null!==(a=null==c?void 0:c["service.version"])&&void 0!==a?a:null==i?void 0:i.serviceVersion,environment:null!==(l=null==c?void 0:c["deployment.environment"])&&void 0!==l?l:null==i?void 0:i.environment,resourceAttributes:c,beforeSend:null==i?void 0:i.beforeSend,flushIntervalMs:u,maxBufferSize:h,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}),this._l=new Oi(this.Sl(),this.kl,this.Qt,(()=>this.Cl()),(t=>t()))),this._l}Il(){return this.wl(),this.kl}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,i=null==(e=t.logs)?void 0:e.captureConsoleLogs;!re(i)&&i&&(this.ml=!0,this.loadIfEnabled())}reset(){var t;this.Mi=[],null==(t=this._l)||t.reset()}captureLog(t){this.wl().captureLog(t)}get logger(){return this.Tl||(this.Tl={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.Tl}flushLogs(t){t?this.El(t):this.wl().flush().catch((t=>this.Qt.error("PostHog logs flush failed:",t)))}loadIfEnabled(){if(this.ml&&!this.yl){var t=null==$t?void 0:$t.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(e=>{var i;e||null==(i=t.logs)||!i.initializeLogs?this.Qt.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.yl=!0)})):this.Qt.error(st)}else this.Qt.error("PostHog Extensions not found.")}}Sl(){var t=this._instance;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},getPersistedProperty:t=>t===Ct.LogsQueue?this.Mi:void 0,setPersistedProperty:(t,e)=>{var i;t===Ct.LogsQueue&&(this.Mi=null!==(i=e)&&void 0!==i?i:[])},kr:t=>this.kr(t),getLibraryId:()=>n.LIB_NAME,getLibraryVersion:()=>n.LIB_VERSION}}kr(t){return new Promise((e=>{var i=!1,r=t=>{i||(i=!0,clearTimeout(s),e(t))},s=setTimeout((()=>r({kind:"retry-later",error:new Error("logs request timed out")})),9e4);this._instance._send_request({method:"POST",url:this.Ml(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback(t){var e=t.statusCode;if(e>=200&&300>e)r({kind:"ok"});else if(413===e)r({kind:"too-large"});else if(0!==e&&429!==e&&500>e)r({kind:"fatal",error:new Error("logs request failed with status "+e)});else{var i;r({kind:"retry-later",error:null!==(i=t.error)&&void 0!==i?i:new Error("logs request failed with status "+e)})}}})}))}El(t){var e=this.Il();if(0!==this.Mi.length){var i=this.Mi.map((t=>t.record));this.Mi=[];var r=Fi(i,Ci(e,n.LIB_NAME,n.LIB_VERSION),n.LIB_NAME,n.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Ml(),data:r,compression:"best-available",batchKey:"logs",transport:t})}}Ml(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Cl(){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!=$t&&null!=(t=$t.location)&&t.href&&(e.currentUrl=$t.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(e.activeFeatureFlags=r)}return e}}});ra.__defaultExtensionClasses=i({},rl)}();
2
2
  //# sourceMappingURL=default-extensions.js.map