posthog-js 1.393.4 → 1.393.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.es5.js +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +1 -1
- package/dist/array.full.no-external.js.map +1 -1
- package/dist/array.js +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/customizations.full.js +1 -1
- package/dist/dead-clicks-autocapture.js +1 -1
- package/dist/default-extensions.js +1 -1
- package/dist/extension-bundles.js +1 -1
- package/dist/lazy-recorder.js +1 -1
- package/dist/logs.js +1 -1
- package/dist/logs.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/module.full.js +1 -1
- package/dist/module.full.js.map +1 -1
- package/dist/module.full.no-external.js +1 -1
- package/dist/module.full.no-external.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.slim.js +1 -1
- package/dist/module.slim.no-external.js +1 -1
- package/dist/posthog-recorder.js +1 -1
- package/lib/package.json +1 -1
- package/lib/src/entrypoints/logs.js +71 -55
- package/lib/src/entrypoints/logs.js.map +1 -1
- package/package.json +4 -4
package/dist/array.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(){"use strict";var t="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:t;"undefined"==typeof self&&(e.self=e),"undefined"==typeof File&&(e.File=function(){});var i=null==e?void 0:e.navigator,r=null==e?void 0:e.document,s=null==e?void 0:e.location,n=null==e?void 0:e.fetch,o=null!=e&&e.XMLHttpRequest&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,l=null==e?void 0:e.CompressionStream,u=null==i?void 0:i.userAgent,h=null!=t?t:{},d="1.393.4",v={DEBUG:!1,LIB_VERSION:d,LIB_NAME:"web",JS_SDK_VERSION:d};function c(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(r,s)}function f(t){return function(){var e=this,i=arguments;return new Promise((function(r,s){var n=t.apply(e,i);function o(t){c(n,r,s,o,a,"next",t)}function a(t){c(n,r,s,o,a,"throw",t)}o(void 0)}))}}function p(){return p=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},p.apply(null,arguments)}function g(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 _=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function m(t){return"string"==typeof t||t}function y(t){return"string"==typeof t?t:void 0}var b,w=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.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",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}({}),x=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),S=["$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"],E=["token"],k="NativeGzipValidationError",P=t=>t.length>=2&&31===t[0]&&139===t[1],T=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),I=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=k,e},R=function(){var t=f((function*(t,e){18>t.size&&I("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());P(i)&&8===i[2]||I("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(b)return b;b=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;b[t]=e>>>0}return b})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&I("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&I("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function C(){return C=f((function*(t,e,i){void 0===e&&(e=!0);try{var r=(new TextEncoder).encode(t),s=new CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(r).then((()=>n.close())).catch(function(){var t=f((function*(t){try{yield n.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),a=new Response(s.readable).blob(),[l]=yield Promise.all([a,o]);return yield R(l,r),l}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),C.apply(this,arguments)}var F=["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"],M=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return F.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function O(t,e){return-1!==t.indexOf(e)}var A=function(t){return t.trim()},D=function(t){return t.replace(/^\$/,"")},L=Object.prototype,j=L.hasOwnProperty,z=L.toString,N=Array.isArray||function(t){return"[object Array]"===z.call(t)},U=t=>"function"==typeof t,B=t=>t===Object(t)&&!N(t),H=t=>{if(B(t)){for(var e in t)if(j.call(t,e))return!1;return!0}return!1},q=t=>void 0===t,G=t=>"[object String]"==z.call(t),V=t=>G(t)&&0===t.trim().length,W=t=>null===t,J=t=>q(t)||W(t),K=t=>"[object Number]"==z.call(t)&&t==t,Y=t=>K(t)&&t>0,Q=t=>"[object Boolean]"===z.call(t),X=t=>t instanceof FormData,Z=t=>O(S,t),tt=t=>O(E,t);function et(t){return null===t||"object"!=typeof t}function it(t,e){return{}.toString.call(t)==="[object "+e+"]"}function rt(t){return"undefined"!=typeof Event&&function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Event)}var st=[!0,"true",1,"1","yes"],nt=t=>O(st,t),ot=[!1,"false",0,"0","no"];function at(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),K(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),at(s||i,e,i,r))}class lt{constructor(t){this.Ee={},this.Pe=t.Pe,this.Fe=at(t.bucketSize,0,100,t.Ae),this.$e=at(t.refillRate,0,this.Fe,t.Ae),this.De=at(t.refillInterval,0,864e5,t.Ae)}Ne(t,e){var i=Math.floor((e-t.lastAccess)/this.De);i>0&&(t.tokens=Math.min(t.tokens+i*this.$e,this.Fe),t.lastAccess=t.lastAccess+i*this.De)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.Ee[r];return s?this.Ne(s,i):this.Ee[r]=s={tokens:this.Fe,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.Pe)||e.call(this,t)),0===s.tokens)}stop(){this.Ee={}}}var ut="Mobile",ht="iOS",dt="Android",vt="Tablet",ct=dt+" "+vt,ft="iPad",pt="Apple",gt=pt+" Watch",_t="Safari",mt="BlackBerry",yt="Samsung",bt=yt+"Browser",wt=yt+" Internet",xt="Chrome",St=xt+" OS",Et=xt+" "+ht,kt="Internet Explorer",$t=kt+" "+ut,Pt="Opera",Tt=Pt+" Mini",It="Edge",Rt="Microsoft "+It,Ct="Firefox",Ft=Ct+" "+ht,Mt="Nintendo",Ot="PlayStation",At="Xbox",Dt=dt+" "+ut,Lt=ut+" "+_t,jt="Windows",zt=jt+" Phone",Nt="Nokia",Ut="Ouya",Bt="Generic",Ht=Bt+" "+ut.toLowerCase(),qt=Bt+" "+vt.toLowerCase(),Gt="Konqueror",Vt="Oculus Browser",Wt="Vivaldi",Jt="Yandex",Kt="Whale",Yt="DuckDuckGo",Qt="Pale Moon",Xt="Waterfox",Zt="Brave",te="Google Search App",ee="(\\d+(\\.\\d+)?)",ie=new RegExp("Version/"+ee),re=new RegExp(At,"i"),se=new RegExp(Ot+" \\w+","i"),ne=new RegExp(Mt+" \\w+","i"),oe=new RegExp(mt+"|PlayBook|BB10","i"),ae={"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"},le=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?Zt:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&O(t,"GSA/")?te:O(t," OPR/")&&O(t,"Mini")?Tt:O(t," OPR/")?Pt:oe.test(t)?mt:O(t,"IE"+ut)||O(t,"WPDesktop")?$t:O(t,"OculusBrowser")?Vt:O(t,bt)?wt:O(t,It)||O(t,"Edg/")?Rt:O(t,Wt+"/")?Wt:O(t,"YaBrowser/")?Jt:O(t,Kt+"/")?Kt:O(t,Yt+"/")||O(t,"Ddg/")?Yt:O(t,"FBIOS")?"Facebook "+ut:O(t,"UCWEB")||O(t,"UCBrowser")?"UC Browser":O(t,"CriOS")?Et:O(t,"CrMo")||O(t,xt)?xt:O(t,dt)&&O(t,_t)?Dt:O(t,"FxiOS")?Ft:O(t.toLowerCase(),Gt.toLowerCase())?Gt:O(t,Zt+"/")?Zt:((t,e)=>e&&O(e,pt)||function(t){return O(t,_t)&&!O(t,xt)&&!O(t,dt)}(t))(t,e)?O(t,ut)?Lt:_t:O(t,"PaleMoon/")?Qt:O(t,Xt+"/")?Xt:O(t,Ct)?Ct:O(t,"MSIE")||O(t,"Trident/")?kt:O(t,"Gecko")?Ct:"")},ue={[$t]:[new RegExp("rv:"+ee)],[Rt]:[new RegExp(It+"?\\/"+ee)],[xt]:[new RegExp("("+xt+"|CrMo)\\/"+ee)],[Et]:[new RegExp("CriOS\\/"+ee)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ee)],[_t]:[ie],[Lt]:[ie],[Pt]:[new RegExp("(Opera|OPR)\\/"+ee)],[Ct]:[new RegExp(Ct+"\\/"+ee)],[Ft]:[new RegExp("FxiOS\\/"+ee)],[Gt]:[new RegExp("Konqueror[:/]?"+ee,"i")],[mt]:[new RegExp(mt+" "+ee),ie],[Dt]:[new RegExp("android\\s"+ee,"i")],[wt]:[new RegExp(bt+"\\/"+ee)],[Vt]:[new RegExp("OculusBrowser\\/"+ee)],[Wt]:[new RegExp(Wt+"\\/"+ee)],[Jt]:[new RegExp("YaBrowser\\/"+ee)],[Kt]:[new RegExp(Kt+"\\/"+ee)],[Zt]:[new RegExp(Zt+"\\/"+ee)],[Yt]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ee)],[Qt]:[new RegExp("PaleMoon\\/"+ee)],[Xt]:[new RegExp(Xt+"\\/"+ee)],[te]:[new RegExp("GSA\\/"+ee)],[kt]:[new RegExp("(rv:|MSIE )"+ee)],Mozilla:[new RegExp("rv:"+ee)]},he=function(t,e,i,r){var s=le(t,e,i,r),n=ue[s];if(q(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},de=[[new RegExp(At+"; "+At+" (.*?)[);]","i"),t=>[At,t&&t[1]||""]],[new RegExp(Mt,"i"),[Mt,""]],[new RegExp(Ot,"i"),[Ot,""]],[oe,[mt,""]],[new RegExp(jt,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[zt,""];if(new RegExp(ut).test(e)&&!/IEMobile\b/.test(e))return[jt+" "+ut,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=ae[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[jt,r]}return[jt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[ht,[t[3],t[4],t[5]||"0"].join(".")]:[ht,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=q(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+dt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+dt+")","i"),t=>t&&t[2]?[dt,[t[2],t[3],t[4]||"0"].join(".")]:[dt,""]],[/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/,[St,""]],[/Linux|debian/i,["Linux",""]]],ve=function(t){return ne.test(t)?Mt:se.test(t)?Ot:re.test(t)?At:new RegExp(Ut,"i").test(t)?Ut:new RegExp("("+zt+"|WPDesktop)","i").test(t)?zt:/iPad/.test(t)?ft:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?gt:oe.test(t)?mt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Nt,"i").test(t)?Nt:/(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(ut).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)?dt:ct:new RegExp("(pda|"+ut+")","i").test(t)?Ht:new RegExp(vt,"i").test(t)&&!new RegExp(vt+" pc","i").test(t)?qt:""},ce=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function fe(t,e){return"string"==typeof(i=t)&&ce.test(i)?t:e();var i}function pe(t){return t?t.split("#")[0]:t}function ge(t,e){var i=setTimeout(t,e);return(null==i?void 0:i.unref)&&(null==i||i.unref()),i}var _e=t=>t instanceof Error,me={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}},ye=me.info;function be(t){if(Q(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(N(t))return{arrayValue:{values:t.map((t=>be(t)))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}function we(t){var e=[];for(var i in t){var r=t[i];W(r)||q(r)||e.push({key:i,value:be(r)})}return e}function xe(t,e){var i=t.level||"info",{text:r,number:s}=me[i]||ye,n=String(Date.now())+"000000",o={};e.distinctId&&(o.posthogDistinctId=e.distinctId),e.sessionId&&(o.sessionId=e.sessionId),e.windowId&&(o["window.id"]=e.windowId),J(e.sessionStartTimestamp)||(o.sessionStartTimestamp=String(e.sessionStartTimestamp)),J(e.lastActivityTimestamp)||(o.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(o["url.full"]=e.currentUrl),e.screenName&&(o["screen.name"]=e.screenName),e.appState&&(o["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(o.feature_flags=e.activeFeatureFlags);var a=p({},o,t.attributes||{}),l={timeUnixNano:n,observedTimeUnixNano:n,severityNumber:s,severityText:r,body:{stringValue:t.body},attributes:we(a)};return t.trace_id&&(l.traceId=t.trace_id),t.span_id&&(l.spanId=t.span_id),q(t.trace_flags)||(l.flags=t.trace_flags),l}function Se(t,e,i){return p({},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":i})}function Ee(t,e,i,r){return{resourceLogs:[{resource:{attributes:we(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}let ke=class{constructor(t,e,i,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.Se=e,this.Ae=i,this.qe=r,this.Be=s,this.je=n,this.He=o,this.Ue=null,this.ze=0,this.Ve=0,this.We=0,this.Ge=0,this.Ze=!1,this.Qe=e.maxBufferSize,this.Je=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.Ye=e.flushIntervalMs,this.Ke=e.maxBatchRecordsPerPost,this.Xe=e.rateCapWindowMs,this.et=e.maxLogsPerInterval}reset(){this.tt(),this.Ue=null,this.We=0,this.Ge=0,this.Ze=!1,this.ze=0,this.Ve=0,this.Ke=this.Se.maxBatchRecordsPerPost}onReconnect(){this.Ve=0,this.rt()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var e=this.it(t);if(null!==e)if(e.body){if(this.nt()){var i={record:xe(e,this.qe())};this.Be((()=>this.st(i)))}}else this.Ae.info("Log was rejected in beforeSend function")}}it(t){var e=this.Se.beforeSend;if(!e)return t;var i=N(e)?e:[e],r=t;for(var s of i)try{var n=s(r);if(!n)return this.Ae.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.Ae.error("Error in beforeSend function for log:",t),null}return r}nt(){if(void 0===this.et)return!0;var t=Date.now(),e=t-this.We;return this.Xe>e&&e>=0||(this.We=t,this.Ge=0,this.Ze=!1),this.et>this.Ge?(this.Ge++,!0):(this.Ze||(this.Ae.warn("captureLog dropping logs: exceeded "+this.et+" logs per "+this.Xe+"ms"),this.Ze=!0),!1)}flush(){var t=this;return f((function*(){if(!t._instance.isDisabled)return t.Ue||(t.Ue=t.ot().finally((()=>{t.Ue=null}))),t.Ue}))()}ot(){var t=this;return f((function*(){var e;t.tt();var i=null!==(e=t._instance.getPersistedProperty(w.LogsQueue))&&void 0!==e?e:[];if(0!==i.length)for(var r=i.length,s=0;i.length>0&&r>s;){var n,o;t.ze=0;var a=Math.min(i.length,t.Ke),l=i.slice(0,a),u=Ee(l.map((t=>t.record)),t.ut(),null!==(n=t.He)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),h=yield t._instance.ht(u);if("too-large"===h.kind&&l.length>1)t.Ke=Math.max(1,Math.floor(l.length/2)),t.Ae.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+t.Ke);else{if("retry-later"===h.kind)throw h.error;if("too-large"===h.kind?t.Ae.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"===h.kind&&t.Se.maxBatchRecordsPerPost>t.Ke&&(t.Ke=Math.min(t.Se.maxBatchRecordsPerPost,t.Ke+1)),yield t.dt(l.length),i=null!==(o=t._instance.getPersistedProperty(w.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===h.kind)throw h.error}}}))()}dt(t){var e=this;return f((function*(){var i,r=Math.max(0,t-e.ze),s=null!==(i=e._instance.getPersistedProperty(w.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(w.LogsQueue,s.slice(r)),yield e.je()}))()}ut(){return Se(this.Se,this._instance.getLibraryId(),this._instance.getLibraryVersion())}st(t){var e;if(!this._instance.optedOut){var i=null!==(e=this._instance.getPersistedProperty(w.LogsQueue))&&void 0!==e?e:[];this.Je>i.length||(i.shift(),this.ze++,this.Ae.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(w.LogsQueue,i),this.Qe>i.length?this.ct():this.rt()}}ct(t){void 0===t&&(t=this.Ye),this.vt||(this.vt=ge((()=>{this.vt=void 0,this.rt()}),t))}ft(){var t=Math.min(Math.max(0,this.Ve-1),6);return this.Ye*Math.pow(2,t)}yt(){var t=this._instance.getPersistedProperty(w.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return f((function*(){e.tt();var i=e.flush().catch((()=>{}));void 0!==t?yield Promise.race([i,new Promise((e=>ge(e,t)))]):yield i}))()}flushWithTimeout(t){var e=this;return f((function*(){var i=!1,r=e.flush(),s=new Promise((e=>ge((()=>{i=!0,e()}),t)));try{yield Promise.race([r,s])}finally{i&&r.catch((()=>{}))}}))()}rt(){this.flush().then((()=>{this.Ve=0}),(t=>{this.Ve++,this.Ae.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.yt()&&this.ct(this.ft())}))}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}};var $e,Pe,Te;function Ie(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return Te&&i.length===Pe||(Pe=i.length,Te=i.reduce(((i,r)=>{$e||($e={});var s=$e[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,$e[r]=[l,u];break}}return i}),{})),Te}}class Re{constructor(t,e,i){void 0===i&&(i=[]),this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e){void 0===e&&(e={});var i=e&&e.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(t){var e=this;return f((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&N(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t}))()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null==(e=t.syntheticException)?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var i,r;return null!=t.cause&&(i=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),p({},t,{cause:i,stack:r})}applyChunkIds(t,e){return t.map((t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t)))}applyCoercers(t,e){for(var i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var e=this;return f((function*(){var i=t;for(var r of e.modifiers)i=yield r(i);return i}))()}convertToExceptionList(t,e){var i,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(i=e.type)&&void 0!==i?i:"generic",handled:null===(r=e.handled)||void 0===r||r,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});var o=[n];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,p({},e,{handled:!0}))),o}buildParsingContext(t){var e;return{chunkIdMap:Ie(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,i){void 0===i&&(i=0);var r=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(t,e,r);return this.applyCoercers(i,s)}};return p({},e,{syntheticException:0==i?e.syntheticException:void 0,mechanism:t,apply:t=>r(t,i),next:t=>r(t,i+1)})}}var Ce="?";function Fe(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?Ce:i,in_app:!0};return q(r)||(n.lineno=r),q(s)||(n.colno=s),n}var Me=(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]:Ce,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},Oe=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ae=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,De=/\((\S*)(?::(\d+))(?::(\d+))\)/,Le=(t,e)=>{var i=Oe.exec(t);if(i){var[,r,s,n]=i;return Fe(e,r,Ce,+s,+n)}var o=Ae.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=De.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=Me(o[1]||Ce,o[2]);return Fe(e,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},je=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ze=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ne=(t,e)=>{var i=je.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=ze.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]||Ce;return[n,s]=Me(n,s),Fe(e,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Ue=/\(error: (.*)\)/;class Be{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=G(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 it(t,"DOMException")}isDOMError(t){return it(t,"DOMError")}}class He{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 qe{constructor(){}match(t){return it(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 Ge=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Ve{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(Ge);return r&&(e=r[1],i=r[2]),[e,i]}}var We=["fatal","error","warning","log","info","debug"];function Je(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 Ke{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 rt(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: "+Je(t)}isSeverityLevel(t){return G(t)&&!V(t)&&We.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(_e(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class Ye{match(t){return rt(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Je(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class Qe{match(t){return et(t)}coerce(t,e){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class Xe{match(t){return it(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!rt(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 et(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 Ze="$message",ti="$timestamp",ei=new Set([Ze,ti]),ii={enabled:!0,max_bytes:32768};function ri(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:ii.enabled,max_bytes:ni(t.max_bytes,ii.max_bytes)}:p({},ii)}class si{constructor(t){this.bt=[],this._t=0,this.Se=ri(t)}setConfig(t){this.Se=ri(t),this.wt()}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(!B(i))return;var r=i,s=r[Ze],n=r[ti];if(!G(s)||0===s.trim().length)return;if(!G(n)&&!K(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.Se.max_bytes||(this.bt.push({step:e.step,bytes:i}),this._t+=i,this.wt())}}getAttachable(){return this.bt.map((t=>t.step))}clear(){this.bt=[],this._t=0}size(){return this.bt.length}wt(){for(;this._t>this.Se.max_bytes&&this.bt.length>0;){var t=this.bt.shift();t&&(this._t-=t.bytes)}}}function ni(t,e){if(!K(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var oi=function(e,i){var{debugEnabled:r}=void 0===i?{}:i,s={k(i){if(t&&(v.DEBUG||h.POSTHOG_DEBUG||r)&&!q(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[i]?t.console[i].__rrweb_original__:t.console[i]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(e,...o)}},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("error",...e)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,i)=>oi(e+" "+t,i)};return s},ai=oi("[PostHog.js]"),li=ai.createLogger,ui=li("[ExternalScriptsLoader]"),hi=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return ui.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=null==r?void 0:r.querySelectorAll("script");if(s)for(var n,o=function(){if(s[a].src===e){var t=s[a];return t.__posthog_loading_callback_fired?{v:i()}:(t.addEventListener("load",(e=>{t.__posthog_loading_callback_fired=!0,i(void 0,e)})),t.onerror=t=>i(t),{v:void 0})}},a=0;s.length>a;a++)if(n=o())return n.v;var l=()=>{if(!r)return i("document not found");var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>i(t),t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?l():null==r||r.addEventListener("DOMContentLoaded",l)};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r;if(t.config.strict_script_versioning)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var s="/static/"+e+".js?v="+t.version;if("toolbar"===e){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}r=t.requestRouter.endpointFor("assets",s)}hi(t,r,i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");hi(t,o,i)}},h.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);hi(t,r,i)};var di="$people_distinct_id",vi="$device_id",ci="__alias",fi="__timers",pi="$autocapture_disabled_server_side",gi="$heatmaps_enabled_server_side",_i="$exception_capture_enabled_server_side",mi="$error_tracking_suppression_rules",yi="$error_tracking_capture_extension_exceptions",bi="$web_vitals_enabled_server_side",wi="$dead_clicks_enabled_server_side",xi="$product_tours_enabled_server_side",Si="$web_vitals_allowed_metrics",Ei="$session_recording_remote_config",ki="$replay_sample_rate",$i="$replay_override_sampling",Pi="$replay_override_linked_flag",Ti="$replay_override_url_trigger",Ii="$replay_override_event_trigger",Ri="$sesid",Ci="$session_is_sampled",Fi="$enabled_feature_flags",Mi="$active_feature_flags",Oi="$early_access_features",Ai="$feature_flag_details",Di="$feature_flag_payloads",Li="$feature_flag_request_id",ji="$override_feature_flags",zi="$override_feature_flag_payloads",Ni="$stored_person_properties",Ui="$stored_group_properties",Bi="$surveys",Hi="$surveys_loaded_at",qi="$surveys_activated",Gi="ph_product_tours",Vi="$flag_call_reported",Wi="$flag_call_reported_session_id",Ji="$feature_flag_errors",Ki="$feature_flag_evaluated_at",Yi="$user_state",Qi="$client_session_props",Xi="$capture_rate_limit",Zi="$initial_campaign_params",tr="$initial_referrer_info",er="$initial_person_info",ir="$epp",rr="__POSTHOG_TOOLBAR__",sr="$posthog_cookieless",nr="$sdk_debug_extensions_init_method",or="$sdk_debug_extensions_init_time_ms",ar="$sdk_debug_recording_script_not_loaded",lr="PostHog loadExternalDependency extension not found.",ur="on_reject",hr="always",dr="anonymous",vr="identified",cr="identified_only",fr="visibilitychange",pr="beforeunload",gr="$pageview",_r="$pageleave",mr="$identify",yr="$groupidentify";function br(t,e){N(t)&&t.forEach(e)}function wr(t,e){if(!J(t))if(N(t))t.forEach(e);else if(X(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)j.call(t,i)&&e(t[i],i)}var xr=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 Sr(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 Er=function(t){try{return t()}catch(t){return}},kr=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){ai.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ai.critical(t)}}},$r=function(t){var e={};return wr(t,(function(t,i){(G(t)&&t.length>0||K(t))&&(e[i]=t)})),e};var Pr=["herokuapp.com","vercel.app","netlify.app"];function Tr(t){var e=null==t?void 0:t.hostname;if(!G(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of Pr)if(i===r)return!1;return!0}function Ir(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 Rr(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 K(t)&&isFinite(t)&&Math.floor(t)===t});class Cr{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 Cr(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 Cr(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 Fr{constructor(){this.S=0,this.C=0,this.I=new Ar}generate(){var t=this.generateOrAbort();if(q(t)){this.S=0;var e=this.generateOrAbort();if(q(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 Cr.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 Mr,Or=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!q(t.crypto)&&crypto.getRandomValues&&(Or=t=>crypto.getRandomValues(t));class Ar{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||(Or(this.R),this.O=0),this.R[this.O++]}}var Dr=()=>Lr().toString(),Lr=()=>(Mr||(Mr=new Fr)).generate(),jr="",zr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Nr={N:()=>!!r,D(t){ai.error("cookieStore error: "+t)},P(t){if(r){try{for(var e=t+"=",i=r.cookie.split(";").filter((t=>t.length)),s=0;i.length>s;s++){for(var n=i[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}},F(t){var e;try{e=JSON.parse(Nr.P(t))||{}}catch(t){}return e},q(t,e,i,s,n){if(!r)return!1;try{var o="",a="",l=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=r),jr)return jr;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),s=Math.min(i.length,8),n="dmn_chk_"+Dr();!jr&&s--;){var o=i.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";e.cookie=a+";max-age=3",e.cookie.includes(n)&&(e.cookie=a+";max-age=0",jr=o)}return jr}(t);if(!i){var s=(t=>{var e=t.match(zr);return e?e[0]:""})(t);s!==i&&ai.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(r.location.hostname,s);if(i){var u=new Date;u.setTime(u.getTime()+864e5*i),o="; expires="+u.toUTCString()}n&&(a="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+l+a;return h.length>3686.4&&ai.warn("cookieStore warning: large cookie, len="+h.length),r.cookie=h,!0}catch(t){return!1}},A(t,e){if(null!=r&&r.cookie)try{Nr.q(t,"",-1,e)}catch(t){return}}},Ur=null,Br={N(){if(!W(Ur))return Ur;var e=!0;if(q(t))e=!1;else try{var i="__mplssupport__";Br.q(i,"xyz"),'"xyz"'!==Br.P(i)&&(e=!1),Br.A(i)}catch(t){e=!1}return e||ai.error("localStorage unsupported; falling back to cookie store"),Ur=e,e},D(t){ai.error("localStorage error: "+t)},P(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Br.D(t)}return null},F(t){try{return JSON.parse(Br.P(t))||{}}catch(t){}return null},q(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Br.D(t)}return!1},A(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Br.D(t)}}},Hr=[vi,"distinct_id",Ri,Ci,ir,er,Yi],qr={},Gr={N:()=>!0,D(t){ai.error("memoryStorage error: "+t)},P:t=>qr[t]||null,F:t=>qr[t]||null,q:(t,e)=>(qr[t]=e,!0),A(t){delete qr[t]}},Vr=null,Wr={N(){if(!W(Vr))return Vr;if(Vr=!0,q(t))Vr=!1;else try{var e="__support__";Wr.q(e,"xyz"),'"xyz"'!==Wr.P(e)&&(Vr=!1),Wr.A(e)}catch(t){Vr=!1}return Vr},D(t){ai.error("sessionStorage error: ",t)},P(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){Wr.D(t)}return null},F(t){try{return JSON.parse(Wr.P(t))||null}catch(t){}return null},q(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Wr.D(t)}return!1},A(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){Wr.D(t)}}};class Jr{constructor(t){this._instance=t}get Se(){return this._instance.config}get consent(){return this.kt()?0:this.St}isOptedOut(){return this.Se.cookieless_mode===hr||this.isRejected()||-1===this.consent&&this.Se.cookieless_mode===ur}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Se.opt_out_capturing_by_default}optInOut(t){this.Ct.q(this.It,t?1:0,this.Se.cookie_expiration,this.Se.cross_subdomain_cookie,this.Se.secure_cookie)}reset(){this.Ct.A(this.It,this.Se.cross_subdomain_cookie)}get It(){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 St(){var t=this.Ct.P(this.It);return nt(t)?1:O(ot,t)?0:-1}get Ct(){var t=this.Se.opt_out_capturing_persistence_type,e="localStorage"===t?Br:Nr;if(!this.Tt||this.Tt!==e){this.Tt=e;var i="localStorage"===t?Nr:Br;i.P(this.It)&&(this.Tt.P(this.It)||this.optInOut(nt(i.P(this.It))),i.A(this.It,this.Se.cross_subdomain_cookie))}return this.Tt}kt(){return!!this.Se.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,h.doNotTrack].some((t=>nt(t)))}}var Kr=1,Yr=3,Qr=11;function Xr(t){return t instanceof Element&&(t.id===rr||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Zr(t){return!!t&&t.nodeType===Kr}function ts(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function es(t){return!!t&&t.nodeType===Yr}function is(t){return!!t&&t.nodeType===Qr&&Zr(t.host)}function rs(t){return t?A(t).split(/\s+/):[]}function ss(e){var i=null==t?void 0:t.location.href;return!!(i&&e&&e.some((t=>i.match(t))))}function ns(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 rs(e)}function os(t){return J(t)?null:A(t).split(/(\s+)/).filter((t=>Is(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function as(t){var e="";return ws(t)&&!xs(t)&&t.childNodes&&t.childNodes.length&&wr(t.childNodes,(function(t){var i;es(t)&&t.textContent&&(e+=null!==(i=os(t.textContent))&&void 0!==i?i:"")})),A(e)}function ls(t){return q(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var us=["a","button","form","input","select","textarea","label"];function hs(t,e){if(q(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 ds(t){var e=t.parentNode;return!(!e||!Zr(e))&&e}var vs=[".ph-no-autocapture","[data-ph-no-autocapture]"],cs=["next","previous","prev",">","<"],fs=[...cs,"+","-","−","–"],ps=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,gs=[".ph-no-rageclick",".ph-no-capture"],_s=["","text","search","email","password","url","tel","number"];function ms(e,i){if(!t||ys(e))return!1;var r,s,n,o,a;if(Q(i)?(r=!!i&&gs,s=void 0,n=!1):(r=null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:gs,s=null==i?void 0:i.content_ignorelist,n=null!==(a=null==i?void 0:i.ignore_text_selection)&&void 0!==a&&a),!1===r)return!1;if(n&&function(t){return!(!t||!Zr(t))&&(!!ts(t,"textarea")||(ts(t,"input")?O(_s,(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)))}(e))return!1;var{targetElementList:l}=bs(e,!1);return!function(t,e){if(!1===t||q(t))return!1;var i;if(!0===t)i=cs;else{if(!N(t))return!1;if(t.length>10)return ai.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=>ps(e,t)||ps(r,t)))}))}(s,l.map((t=>{var e;return{safeText:as(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!hs(l,r)}var ys=t=>!t||ts(t,"html")||!Zr(t),bs=(e,i)=>{if(!t||ys(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[e],n=e;n.parentNode&&!ts(n,"body");)if(is(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=ds(n);if(!o)break;if(i||us.indexOf(o.tagName.toLowerCase())>-1)r=!0;else{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}s.push(o),n=o}return{parentIsUsefulElement:r,targetElementList:s}};function ws(t){for(var e=t;e.parentNode&&!ts(e,"body");e=e.parentNode){var i=ns(e);if(O(i,"ph-sensitive")||O(i,"ph-no-capture"))return!1}if(O(ns(t),"ph-include"))return!0;var r=t.type||"";if(G(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!G(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 xs(t){return!!(ts(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||ts(t,"select")||ts(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Ss="(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})",Es=new RegExp("^(?:"+Ss+")$"),ks=new RegExp(Ss),$s="\\d{3}-?\\d{2}-?\\d{4}",Ps=new RegExp("^("+$s+")$"),Ts=new RegExp("("+$s+")");function Is(t,e){if(void 0===e&&(e=!0),J(t))return!1;if(G(t)){if(t=A(t),(e?Es:ks).test((t||"").replace(/[- ]/g,"")))return!1;if((e?Ps:Ts).test(t))return!1}return!0}function Rs(t){var e=as(t);return Is(e=(e+" "+Cs(t)).trim())?e:""}function Cs(t){var e="";return t&&t.childNodes&&t.childNodes.length&&wr(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=as(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Cs(t)).trim())}catch(t){ai.error("[AutoCapture]",t)}})),e}function Fs(t){return t.replace(/"|\\"/g,'\\"')}function Ms(t){var e=t.attr__class;return e?N(e)?e:rs(e):void 0}var Os=li("[Dead Clicks]"),As=()=>!0,Ds=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(wi)),r=t.instance.config.capture_dead_clicks;return Q(r)?r:!!B(r)||i};class Ls{get lazyLoadedDeadClicksAutocapture(){return this.Et}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({[wi]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Mt((()=>{this.Pt()})):this.stop()}Mt(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.initDeadClicksAutocapture?t():null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?Os.error("failed to load script",e):t()}))}Pt(){var t;if(r){if(!this.Et&&null!=(t=h.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=B(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};e.__onCapture=this.onCapture,this.Et=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.Et.start(r),Os.info("starting...")}}else Os.error("`document` not found. Cannot start.")}stop(){this.Et&&(this.Et.stop(),this.Et=void 0,Os.info("stopping..."))}}var js=li("[SegmentIntegration]");var zs="posthog-js";function Ns(t,e){var{organization:i,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===e?{}:e;return e=>{var a,l,u,h,d;if("*"!==n&&!n.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,f=(null==(a=e.exception)?void 0:a.values)||[],g=f.map((t=>p({},t,{stacktrace:t.stacktrace?p({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>p({},t,{platform:"web:javascript"})))}):void 0}))),_={$exception_message:(null==(l=f[0])?void 0:l.value)||e.message,$exception_type:null==(u=f[0])?void 0:u.type,$exception_level:e.level,$exception_list:g,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(h=f[0])?void 0:h.value)||e.message,$sentry_exception_type:null==(d=f[0])?void 0:d.type,$sentry_tags:e.tags};return i&&r&&(_.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+e.event_id),o&&(null==(c=t.exceptions)||c.sendExceptionEvent(_)),e}}class Us{constructor(t,e,i,r,s,n){this.name=zs,this.setupOnce=function(o){o(Ns(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Bs{constructor(t){this.Rt=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(ai.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Ot=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Lt()}Lt(){var t;this.Ft=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Rt)}destroy(){var t;null==(t=this.Ft)||t.call(this),this.Ft=void 0}doPageView(e,i){var r,s=this.At(e,i);return this.Ot={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.At(t,null==(e=this.Ot)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Ot)?void 0:t.pageViewId}}At(t,e){var i=this.Ot;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(!(q(n)||q(o)||q(a)||q(l)||q(u)||q(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?at(o/n,0,1,ai):1,v=n>1?at(a/n,0,1,ai):1,c=l>1?at(u/l,0,1,ai):1,f=l>1?at(h/l,0,1,ai):1;r=xr(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 Hs=["flags","surveys"],qs={[di]:{exposure:"hidden"},[ci]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[fi]:{exposure:"hidden"},[pi]:{exposure:"event"},[gi]:{exposure:"hidden"},[_i]:{exposure:"event"},[mi]:{exposure:"hidden"},[yi]:{exposure:"event"},[bi]:{exposure:"event"},[wi]:{exposure:"event"},[xi]:{exposure:"hidden"},[Si]:{exposure:"event"},[Ei]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Ri]:{exposure:"hidden"},[Ci]:{exposure:"event"},[ki]:{exposure:"event",shouldSkipFromEventProperties:t=>W(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"},[Fi]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!B(t))return{};for(var e={},i=Object.keys(t),r=0;i.length>r;r++)e["$feature/"+i[r]]=t[i[r]];return e}},[Mi]:{exposure:"event",storageGroup:"flags"},[Oi]:{exposure:"hidden"},[Ai]:{exposure:"hidden",storageGroup:"flags"},[Di]:{exposure:"event",storageGroup:"flags"},[Li]:{exposure:"event",storageGroup:"flags",volatile:!0},[ji]:{exposure:"event"},[zi]:{exposure:"hidden"},[Ni]:{exposure:"hidden"},[Ui]:{exposure:"hidden"},[Bi]:{exposure:"hidden",storageGroup:"surveys"},[Hi]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[qi]:{exposure:"event"},[Gi]:{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"},[Vi]:{exposure:"hidden"},[Wi]:{exposure:"hidden"},[Ji]:{exposure:"hidden"},[Ki]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Yi]:{exposure:"hidden"},[Qi]:{exposure:"hidden"},[Xi]:{exposure:"hidden"},[Zi]:{exposure:"hidden"},[tr]:{exposure:"hidden"},[er]:{exposure:"hidden"},[ir]:{exposure:"hidden"},[$i]:{exposure:"event"},[Pi]:{exposure:"event"},[Ti]:{exposure:"event"},[Ii]:{exposure:"event"},[nr]:{exposure:"event"},[or]:{exposure:"event"},[ar]:{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"}},Gs=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Vs=t=>{var e=qs[t];if(e)return e;for(var[i,r]of Gs)if(0===t.indexOf(i))return r},Ws=t=>{var e=null==r?void 0:r.createElement("a");return q(e)?null:(e.href=t,e)},Js=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(!N(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){ai.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Ks=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("=");N(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},Ys=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},Qs="https?://(.*)",Xs=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Zs=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Xs],tn="<masked>",en=["li_fat_id"];function rn(t,e,i){if(!r)return{};var s,n=e?[...Xs,...i||[]]:[],o=sn(Ks(r.URL,n,tn),t),a=(s={},wr(en,(function(t){var e=Nr.P(t);s[t]=e||null})),s);return xr(a,o)}function sn(t,e){var i=Zs.concat(e||[]),r={};return wr(i,(function(e){var i=Js(t,e);r[e]=i||null})),r}function nn(t){var e=function(t){return t?0===t.search(Qs+"google.([^/?]*)")?"google":0===t.search(Qs+"bing.com")?"bing":0===t.search(Qs+"yahoo.com")?"yahoo":0===t.search(Qs+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!W(e)){s.$search_engine=e;var n=r?Js(r.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function on(){return navigator.language||navigator.userLanguage}var an="$direct";function ln(){return(null==r?void 0:r.referrer)||an}function un(t,e,i){void 0===i&&(i=!1);var r=t?[...Xs,...e||[]]:[],n=i?pe(null==s?void 0:s.href):null==s?void 0:s.href,o=null==n?void 0:n.substring(0,1e3);return{r:ln().substring(0,1e3),u:o?Ks(o,r,tn):void 0}}function hn(t,e){var i;void 0===e&&(e=!1);var{r:r,u:s}=t,n=e?pe(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==an?an:null==(i=Ws(r))?void 0:i.host};if(n){o.$current_url=n;var a=Ws(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=sn(n);xr(o,l)}if(r){var u=nn(r);xr(o,u)}return o}function dn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function vn(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var cn={flags:Ki,surveys:Hi},fn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],pn="main";class gn{constructor(e,i,r){if(void 0===r&&(r=!0),this.$t={},this.Dt=!1,this.Nt=!1,this.Se=e,this.qt=r,this.props={},this.Bt=!1,this.jt=(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"})(e),this.Ct=this.Ht(e),this.Nt=this.Ut(e),this.load(),e.debug&&ai.info("Persistence loaded",e.persistence,p({},this.props)),this.update_config(e,e,i),this.save(),t){var s=()=>this.flush();Ir(t,"beforeunload",s,{capture:!1}),Ir(t,"pagehide",s,{capture:!1})}}zt(){var t,e=null==(t=this.Se)?void 0:t.persistence_save_debounce_ms;return K(e)&&e>0?e:0}isDisabled(){return!!this.Vt}Ht(e){-1===fn.indexOf(e.persistence.toLowerCase())&&(ai.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var i,r=function(e,i){void 0===e&&(e=[]),void 0===i&&(i=!1);var r=[...Hr,...e];return p({},Br,{F(t){try{var e={};try{e=Nr.F(t)||{}}catch(t){}var r,s=JSON.parse(Br.P(t)||"{}");if(i){var n={};for(var o in e){var a=e[o];W(a)||""===a||(n[o]=a)}r=xr(s,n)}else r=xr(e,s);return Br.q(t,r),r}catch(t){}return null},q(t,e,i,s,n,o){var a=Br.q(t,e,void 0,void 0,o);try{var l={};r.forEach((t=>{e[t]&&(l[t]=e[t])})),Object.keys(l).length&&Nr.q(t,l,i,s,n,o)}catch(t){Br.D(t)}return a},A(e,i){try{null==t||t.localStorage.removeItem(e),Nr.A(e,i)}catch(t){Br.D(t)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),s=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&Br.N()?(i=Br,s=!0):"localstorage+cookie"===n&&r.N()?(i=r,s=!0):"sessionstorage"===n&&Wr.N()?i=Wr:"memory"===n?i=Gr:"cookie"===n?i=Nr:r.N()?(i=r,s=!0):i=Nr,this.Dt=s,i}Wt(t){return this.jt+"__"+t}Ut(t){return this.Dt&&!!t.split_storage}Gt(t){var e=null!=t?t:this.Se.feature_flag_cache_ttl_ms;if(!e||0>=e)return!1;var i=this.props[Ki];return!i||"number"!=typeof i||Date.now()-i>e}properties(){var t={};return wr(this.props,((e,i)=>{var r=Vs(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,i===Fi?()=>this.Gt():()=>!1))return;r.transformToEventProperties&&xr(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.Vt){var t=this.Ct.F(this.jt);t&&(this.props=xr({},t)),this.Nt&&this.Zt()}}Zt(){for(var t of Hs){var e=Br.F(this.Wt(t));if(e&&!H(e)){var i=this.Qt(t);i.persisted=!0,this.Jt(t)||(i.fingerprint=this.Yt(e,t)),this.Kt(t,e)||xr(this.props,e)}}}Jt(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=Vs(e))?void 0:i.storageGroup)===t}))}Kt(t,e){var i=cn[t];if(!i)return!1;var r=e[i],s=this.props[i];return K(r)&&K(s)&&s>r}refreshKey(t){var e;if(!this.Vt){var i=this.Nt?null==(e=Vs(t))?void 0:e.storageGroup:void 0,r=i?Br.F(this.Wt(i)):this.Ct.F(this.jt);if(r&&t in r)this.Xt(t,r[t]);else{if(i){var s=this.Ct.F(this.jt);if(s&&t in s)return void this.Xt(t,s[t])}this.er(t)}}}save(){if(!this.Vt){var t=this.zt();t>0?q(this.tr)&&(this.tr=setTimeout((()=>{this.tr=void 0,this.rr()}),t)):this.rr()}}flush(){q(this.tr)||(clearTimeout(this.tr),this.tr=void 0,this.rr())}rr(){this.Vt||(this.Nt?this.ir():this.nr(this.Ct,this.jt,this.props,pn))}ir(){var{main:t,groups:e}=this.sr();for(var i of(this.nr(this.Ct,this.jt,t,pn),Hs)){var r,s=e[i];(!H(s)||null!=(r=this.$t[i])&&r.persisted)&&this.nr(Br,this.Wt(i),s,i)}}sr(){var t={},e={};for(var i of Hs)e[i]={};return wr(this.props,((i,r)=>{var s,n=null==(s=Vs(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Yt(t,e){if(e===pn)return JSON.stringify(t)+"|"+this.ar+"|"+this.lr+"|"+this.ur;var i={};return wr(t,((t,e)=>{var r;i[e]=null!=(r=Vs(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}nr(t,e,i,r){var s=this.Qt(r);if(r===pn||s.dirty||q(s.fingerprint)){var n;try{if((n=this.Yt(i,r))===s.fingerprint)return void(s.dirty=!1)}catch(t){n=void 0}t.q(e,i,this.ar,this.lr,this.ur,this.Se.debug)?(s.dirty=!1,r!==pn&&(s.persisted=!0),q(n)||(s.fingerprint=n)):this.Se.debug&&ai.warn('failed to persist storage entry "'+e+'"; will retry on next save')}}remove(t){var{keepGroupEntries:e=!1}=void 0===t?{}:t;if(q(this.tr)||(clearTimeout(this.tr),this.tr=void 0),this.Ct.A(this.jt,!1),this.Ct.A(this.jt,!0),!e&&this.qt)for(var i of Hs)Br.A(this.Wt(i));e?delete this.$t[pn]:this.$t={}}clear(){this.remove(),this.props={}}register_once(t,e,i){if(B(t)){q(e)&&(e="None"),this.ar=q(i)?this.hr:i;var r=!1;if(wr(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Xt(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(B(t)){this.ar=q(e)?this.hr:e;var i=!1;if(wr(t,((e,r)=>{t.hasOwnProperty(r)&&this.props[r]!==e&&(this.Xt(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.er(t),this.save())}update_campaign_params(){if(!this.Bt){var t=rn(this.Se.custom_campaign_params,this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties);H($r(t))||this.register(t),this.Bt=!0}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?nn(t):{})}update_referrer_info(){var t;this.register_once({$referrer:ln(),$referring_domain:null!=r&&r.referrer&&(null==(t=Ws(r.referrer))?void 0:t.host)||an},void 0)}set_initial_person_info(){this.props[Zi]||this.props[tr]||this.register_once({[er]:un(this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties,this.Se.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};wr([tr,Zi],(e=>{var i=this.props[e];i&&wr(i,(function(e,i){t["$initial_"+D(i)]=e}))}));var e=this.props[er];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=hn(t,e),r={};return wr(i,(function(t,e){r["$initial_"+D(e)]=t})),r}(e,this.Se.disable_capture_url_hashes);xr(t,i)}return t}safe_merge(t){return wr(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){this.hr=this.ar=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.Ht(t):this.Ct,n=this.Ut(t);if(r||n!==this.Nt){var o=this.props;this.clear(),this.Ct=s,this.Nt=n,this.props=o,this.save()}}set_disabled(t){this.Vt=t,this.Vt?this.remove():this.save()}set_cross_subdomain(t){t!==this.lr&&(this.lr=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.ur&&(this.ur=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[fi]||{};i[t]=e,this.Xt(fi,i),this.save()}remove_event_timer(t){var e=this.props[fi]||{},i=e[t];return q(i)||(delete e[t],this.Xt(fi,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Xt(t,e),this.save()}Xt(t,e){var i;this.props[t]=e,null!=(i=Vs(t))&&i.volatile||this.dr(t)}er(t){delete this.props[t],this.dr(t)}dr(t){var e,i=null==(e=Vs(t))?void 0:e.storageGroup;i&&(this.Qt(i).dirty=!0)}Qt(t){return this.$t[t]||(this.$t[t]={})}}var _n="events",mn="cancelEvents",yn="survey shown",bn="survey dismissed",wn="survey sent",xn="popover",Sn=li("[RateLimiter]");class En{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=>{Sn.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Sn.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(Xi))&&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(Xi,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var kn=li("[RemoteConfig]");class $n{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=h._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}cr(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}vr(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 kn.info("Using preloaded remote config",this.remoteConfig),this.pr(this.remoteConfig),void this.gr();if(this._instance.mr())return void kn.warn("Remote config is disabled. Falling back to local config.");this.cr((t=>{if(!t)return kn.info("No config found after loading remote JS config. Falling back to JSON."),void this.vr((t=>{this.pr(t),this.gr()}));this.pr(t),this.gr()}))}catch(t){kn.error("Error loading remote config",t)}}stop(){this.yr&&(clearInterval(this.yr),this.yr=void 0)}refresh(){!this._instance.mr()&&r&&"hidden"!==r.visibilityState&&this._instance.reloadFeatureFlags()}gr(){var t;if(!this.yr){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.yr=setInterval((()=>{this.refresh()}),e))}}pr(t){var e;t||kn.error("Failed to fetch remote config from PostHog."),this._instance.pr(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 Pn="gzip-js",Tn="base64",In=Uint8Array,Rn=Uint16Array,Cn=Uint32Array,Fn=new In([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]),Mn=new In([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]),On=new In([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),An=function(t,e){for(var i=new Rn(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Cn(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]},Dn=An(Fn,2),Ln=Dn[1];Dn[0][28]=258,Ln[258]=28;for(var jn=An(Mn,0)[1],zn=new Rn(32768),Nn=0;32768>Nn;++Nn){var Un=(43690&Nn)>>>1|(21845&Nn)<<1;zn[Nn]=((65280&(Un=(61680&(Un=(52428&Un)>>>2|(13107&Un)<<2))>>>4|(3855&Un)<<4))>>>8|(255&Un)<<8)>>>1}var Bn=function(t,e,i){for(var r=t.length,s=0,n=new Rn(e);r>s;++s)++n[t[s]-1];var o,a=new Rn(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Rn(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[zn[d]>>>l]=u}else for(o=new Rn(r),s=0;r>s;++s)o[s]=zn[a[t[s]-1]++]>>>15-t[s];return o},Hn=new In(288);for(Nn=0;144>Nn;++Nn)Hn[Nn]=8;for(Nn=144;256>Nn;++Nn)Hn[Nn]=9;for(Nn=256;280>Nn;++Nn)Hn[Nn]=7;for(Nn=280;288>Nn;++Nn)Hn[Nn]=8;var qn=new In(32);for(Nn=0;32>Nn;++Nn)qn[Nn]=5;var Gn=Bn(Hn,9,0),Vn=Bn(qn,5,0),Wn=function(t){return(t/8>>0)+(7&t&&1)},Jn=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Rn?Rn:t instanceof Cn?Cn:In)(i-e);return r.set(t.subarray(e,i)),r},Kn=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},Yn=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},Qn=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 In(0),0];if(1==s){var o=new In(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 Rn(v+1),f=Xn(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 In(c),f]},Xn=function(t,e,i){return-1==t.s?Math.max(Xn(t.l,e,i+1),Xn(t.r,e,i+1)):e[t.s]=i},Zn=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Rn(++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]},to=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},eo=function(t,e,i){var r=i.length,s=Wn(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)},io=function(t,e,i,r,s,n,o,a,l,u,h){Kn(e,h++,i),++s[256];for(var d=Qn(s,15),v=d[0],c=d[1],f=Qn(n,15),p=f[0],g=f[1],_=Zn(v),m=_[0],y=_[1],b=Zn(p),w=b[0],x=b[1],S=new Rn(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=Qn(S,7),P=k[0],T=k[1],I=19;I>4&&!P[On[I-1]];--I);var R,C,F,M,O=u+5<<3,A=to(s,Hn)+to(n,qn)+o,D=to(s,v)+to(n,p)+o+14+3*I+to(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(A>=O&&D>=O)return eo(e,h,t.subarray(l,l+u));if(Kn(e,h,1+(A>D)),h+=2,A>D){R=Bn(v,c,0),C=v,F=Bn(p,g,0),M=p;var L=Bn(P,T,0);for(Kn(e,h,y-257),Kn(e,h+5,x-1),Kn(e,h+10,I-4),h+=14,E=0;I>E;++E)Kn(e,h+3*E,P[On[E]]);h+=3*I;for(var j=[m,w],z=0;2>z;++z){var N=j[z];for(E=0;N.length>E;++E)Kn(e,h,L[U=31&N[E]]),h+=P[U],U>15&&(Kn(e,h,N[E]>>>5&127),h+=N[E]>>>12)}}else R=Gn,C=Hn,F=Vn,M=qn;for(E=0;a>E;++E)if(r[E]>255){var U;Yn(e,h,R[257+(U=r[E]>>>18&31)]),h+=C[U+257],U>7&&(Kn(e,h,r[E]>>>23&31),h+=Fn[U]);var B=31&r[E];Yn(e,h,F[B]),h+=M[B],B>3&&(Yn(e,h,r[E]>>>5&8191),h+=Mn[B])}else Yn(e,h,R[r[E]]),h+=C[r[E]];return Yn(e,h,R[256]),h+C[256]},ro=new Cn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),so=function(){for(var t=new Cn(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),no=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function oo(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=so[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 In(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=eo(l,u,t.subarray(h,d)):(l[h]=!0,u=eo(l,u,t.subarray(h,o)))}else{for(var v=ro[e-1],c=v>>>13,f=8191&v,p=(1<<i)-1,g=new Rn(32768),_=new Rn(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 Cn(25e3),x=new Rn(288),S=new Rn(32),E=0,k=0,P=(h=0,0),T=0,I=0;o>h;++h){var R=b(h),C=32767&h,F=_[R];if(g[C]=F,_[R]=C,h>=T){var M=o-h;if((E>7e3||P>24576)&&M>423){u=io(t,l,0,w,x,S,k,P,I,h-I,u),P=E=k=0,I=h;for(var O=0;286>O;++O)x[O]=0;for(O=0;30>O;++O)S[O]=0}var A=2,D=0,L=f,j=C-F&32767;if(M>2&&R==b(h-j))for(var z=Math.min(c,M)-1,N=Math.min(32767,h),U=Math.min(258,M);N>=j&&--L&&C!=F;){if(t[h+A]==t[h+A-j]){for(var B=0;U>B&&t[h+B]==t[h+B-j];++B);if(B>A){if(A=B,D=j,B>z)break;var H=Math.min(j,B-2),q=0;for(O=0;H>O;++O){var G=h-j+O+32768&32767,V=G-g[G]+32768&32767;V>q&&(q=V,F=G)}}}j+=(C=F)-(F=g[C])+32768&32767}if(D){w[P++]=268435456|Ln[A]<<18|jn[D];var W=31&Ln[A],J=31&jn[D];k+=Fn[W]+Mn[J],++x[257+W],++S[J],T=h+A,++E}else w[P++]=t[h],++x[t[h]]}}u=io(t,l,!0,w,x,S,k,P,I,h-I,u)}return Jn(a,0,r+Wn(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&&no(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),no(u,h-8,i.d()),no(u,h-4,r),u}var ao=!!o||!!n,lo="text/plain",uo=!1,ho=(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:"")},vo=function(t,e,i){var r;void 0===i&&(i=!0);var[s,n]=t.split("?"),o=p({},e),a=null!==(r=null==n?void 0:n.split("&").map((t=>{var e,[r,s]=t.split("="),n=i&&null!==(e=o[r])&&void 0!==e?e:s;return delete o[r],r+"="+n})))&&void 0!==r?r:[],l=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return wr(t,(function(t,e){q(t)||q(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(o);return l&&a.push(l),s+"?"+a.join("&")},co=(t,e)=>JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e),fo=t=>{if(t.xt)return t.xt;var{data:e,compression:i}=t;if(e){if(i===Pn){var r=oo(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new In(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 In(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 Jn(r,0,s)}(co(e)),{mtime:0});return{contentType:lo,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Tn){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(co(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:co(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=co(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},po=t=>{var e,i,r,s=fo(t);return!s||(i=t.compression,r=Js(t.url,"compression"),i!==x.GZipJS&&r!==x.GZipJS&&"gzip"!==r)||((e=s.body)instanceof ArrayBuffer?P(new Uint8Array(e)):ArrayBuffer.isView(e)&&P(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?{url:t.url,encodedBody:s}:(uo=!0,{url:ho(t.url,"compression"),encodedBody:fo(p({},t,{compression:void 0,xt:void 0}))})},go=function(){var t=f((function*(t){var e=co(t.data),i=yield function(t,e,i){return C.apply(this,arguments)}(e,v.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return p({},t,{xt:{contentType:lo,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),_o=(t,e)=>vo(t,{_:(new Date).getTime().toString(),ver:v.JS_SDK_VERSION,compression:e}),mo=[];n&&mo.push({transport:"fetch",method(t){var e,{url:i,encodedBody:r}=po(t),{contentType:s,body:o,estimatedSize:l}=null!=r?r:{},u=new Headers;wr(t.headers,(function(t,e){u.append(e,t)})),s&&u.append("Content-Type",s);var h=null,d=null;if(a){var v=new a;h={signal:v.signal,timeout:setTimeout((()=>{var e,i;e=t.timeout,(i=new Error("PostHog request timed out"+(e?" after "+e+"ms":""))).name="AbortError",v.abort(d=i)}),t.timeout)}}n(i,p({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&52428.8>(l||0),body:o,signal:null==(e=h)?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){ai.error(t)}null==t.callback||t.callback(r)})))).catch((e=>{e===d?ai.warn(e):ai.error(e),null==t.callback||t.callback({statusCode:0,error:e})})).finally((()=>h?clearTimeout(h.timeout):null))}}),o&&mo.push({transport:"XHR",method(t){var e=new o,{url:i,encodedBody:r}=po(t);e.open(t.method||"GET",i,!0);var{contentType:s,body:n}=null!=r?r:{};wr(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!=i&&i.sendBeacon&&mo.push({transport:"sendBeacon",method(t){try{var{url:e,encodedBody:r}=po(t),{contentType:s,body:n}=null!=r?r:{};if(!n)return;var o=n instanceof Blob?n:new Blob([n],{type:s});i.sendBeacon(e,o)}catch(t){}}});var yo=3e3;class bo{constructor(t,e){this.br=!0,this._r=[],this.wr=at((null==e?void 0:e.flush_interval_ms)||yo,250,5e3,ai.createLogger("flush interval"),yo),this.kr=t}enqueue(t){this._r.push(t),this.Sr||this.Cr()}unload(){this.Ir();var t=this._r.length>0?this.Tr():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.kr(p({},t,{transport:"sendBeacon"}))}))}enable(){this.br=!1,this.Cr()}Cr(){var t=this;this.br||(this.Sr=setTimeout((()=>{if(this.Ir(),this._r.length>0){var e=this.Tr(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&N(i.data)&&wr(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.kr(i)};for(var r in e)i()}}),this.wr))}Ir(){clearTimeout(this.Sr),this.Sr=void 0}Tr(){var t={};return wr(this._r,(e=>{var i,r=e,s=(r?r.batchKey:null)||r.url;q(t[s])&&(t[s]=p({},r,{data:[]})),null==(i=t[s].data)||i.push(r.data)})),this._r=[],t}}var wo=["retriesPerformedSoFar"];class xo{constructor(e){this.Er=!1,this.Mr=3e3,this._r=[],this._instance=e,this._r=[],this.Pr=!0,!q(t)&&"onLine"in t.navigator&&(this.Pr=t.navigator.onLine,this.Rr=()=>{this.Pr=!0,this.Or()},this.Lr=()=>{this.Pr=!1},Ir(t,"online",this.Rr),Ir(t,"offline",this.Lr))}get length(){return this._r.length}retriableRequest(t){var{retriesPerformedSoFar:e}=t,i=g(t,wo);Y(e)&&(i.url=vo(i.url,{retry_count:e})),this._instance._send_request(p({},i,{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.st(p({retriesPerformedSoFar:e},i));0===t.statusCode&&ai.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==i.callback||i.callback(t)}}))}st(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._r.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),ai.warn(s),this.Er||(this.Er=!0,this.Fr())}Fr(){if(this.Ar&&clearTimeout(this.Ar),0===this._r.length)return this.Er=!1,void(this.Ar=void 0);this.Ar=setTimeout((()=>{this.Pr&&this._r.length>0&&this.Or(),this.Fr()}),this.Mr)}Or(){var t=Date.now(),e=[],i=this._r.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this._r=e,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Ar&&(clearTimeout(this.Ar),this.Ar=void 0),this.Er=!1,q(t)||(this.Rr&&(t.removeEventListener("online",this.Rr),this.Rr=void 0),this.Lr&&(t.removeEventListener("offline",this.Lr),this.Lr=void 0)),this._r))try{this._instance._send_request(p({},e,{transport:"sendBeacon"}))}catch(t){ai.error(t)}this._r=[]}}class So{constructor(t){this.$r=()=>{var t,e,i,r;this.Dr||(this.Dr={});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.Dr.lastScrollY=Math.ceil(n),this.Dr.maxScrollY=Math.max(n,null!==(t=this.Dr.maxScrollY)&&void 0!==t?t:0),this.Dr.maxScrollHeight=Math.max(o,null!==(e=this.Dr.maxScrollHeight)&&void 0!==e?e:0),this.Dr.lastContentY=a,this.Dr.maxContentY=Math.max(a,null!==(i=this.Dr.maxContentY)&&void 0!==i?i:0),this.Dr.maxContentHeight=Math.max(l,null!==(r=this.Dr.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get Nr(){return this._instance.config.scroll_root_selector}getContext(){return this.Dr}resetContext(){var t=this.Dr;return setTimeout(this.$r,0),t}startMeasuringScrollPosition(){Ir(t,"scroll",this.$r,{capture:!0}),Ir(t,"scrollend",this.$r,{capture:!0}),Ir(t,"resize",this.$r)}scrollElement(){if(!this.Nr)return null==t?void 0:t.document.documentElement;var e=N(this.Nr)?this.Nr:[this.Nr];for(var i of e){var r=null==t?void 0:t.document.querySelector(i);if(r)return r}}qr(e){var i="y"===e?"scrollTop":"scrollLeft";if(this.Nr){var r=this.scrollElement();return r&&r[i]||0}return t?"y"===e?t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop||0:t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft||0:0}scrollY(){return this.qr("y")}scrollX(){return this.qr("x")}}var Eo=t=>un(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);class ko{constructor(t,e,i,r){this.Br=t=>{var e=this.jr();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Hr(this._instance)};this.Ur.register({[Qi]:i})}},this._instance=t,this.zr=e,this.Ur=i,this.Hr=r||Eo,this.zr.onSessionId(this.Br)}jr(){return this.Ur.props[Qi]}getSetOnceProps(){var t,e=null==(t=this.jr())?void 0:t.props;return e?"r"in e?hn(e,this._instance.config.disable_capture_url_hashes):{$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 wr($r(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+D(i)]=e})),t}}class $o{constructor(){this.Vr={}}on(t,e){return this.Vr[t]||(this.Vr[t]=[]),this.Vr[t].push(e),()=>{this.Vr[t]=this.Vr[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.Vr[t]||[])i(e);for(var r of this.Vr["*"]||[])r(t,e)}}var Po=li("[SessionId]");class To{on(t,e){return this.Wr.on(t,e)}constructor(t,e,i){var r;if(this.Gr=null,this.Zr=[],this.Qr=void 0,this.Jr=!1,this.Wr=new $o,this.Yr=(t,e)=>!(!Y(t)||!Y(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===hr)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Se=t.config,this.Ur=t.persistence,this.Kr=void 0,this.Xr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ei=e||Dr,this.ti=i||Dr;var s=this.Se.persistence_name||this.Se.token;if(this._sessionTimeoutMs=1e3*at(this.Se.session_idle_timeout_seconds||1800,60,36e3,Po.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ri(),this.ii="ph_"+s+"_window_id",this.ni="ph_"+s+"_primary_window_exists",this.si()){var n=Wr.F(this.ii),o=Wr.F(this.ni);n&&!o?this.Kr=n:Wr.A(this.ii),Wr.q(this.ni,!0)}if(null!=(r=this.Se.bootstrap)&&r.sessionID)try{var a=(t=>{var e=this.Se.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.oi(this.Se.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){Po.error("Invalid sessionID in bootstrap",t)}this.ai()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return q(this.Zr)&&(this.Zr=[]),this.Zr.push(t),this.Xr&&t(this.Xr,this.Kr),()=>{this.Zr=this.Zr.filter((e=>e!==t))}}si(){return"memory"!==this.Se.persistence&&!this.Ur.Vt&&Wr.N()}li(t){t!==this.Kr&&(this.Kr=t,this.si()&&Wr.q(this.ii,t))}ui(){return this.Kr?this.Kr:this.si()?Wr.F(this.ii):null}hi(t){var e=this.Gr;return!W(e)&&!W(t)&&5e3>Math.abs(t-e)}oi(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.Xr||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Xr=t,s&&!r||s&&this.hi(e)||(this.Gr=e,this.Ur.register({[Ri]:[e,t,i]}))}di(){var t,e=null==(t=this.Se)?void 0:t.persistence_save_debounce_ms;return Y(e)&&e>0}ci(){this.di()?this.Ur.refreshKey(Ri):(this.Ur.flush(),this.Ur.load())}vi(){var t;if(!W(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Gr){this.ci();var[,e,i]=this.fi();e===this.Xr&&i===this._sessionStartTimestamp&&(this.Gr=this._sessionActivityTimestamp,this.Ur.register({[Ri]:[this._sessionActivityTimestamp,null!==(t=this.Xr)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Ur.flush())}}pi(){var[t]=this.fi(),e=Y(t)?t:0,i=Y(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}gi(t){return this.ci(),this.Yr(t,this.pi())}fi(){var t=this.Ur.props[Ri];return N(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Gr=null,clearTimeout(this.mi),this.mi=void 0,this.oi(null,null,null)}destroy(){this.Jr=!0,this.vi(),clearTimeout(this.mi),this.mi=void 0,this.Qr&&t&&(t.removeEventListener(pr,this.Qr,{capture:!1}),this.Qr=void 0),this.Zr=[]}ai(){this.Qr=()=>{this.vi(),this.si()&&Wr.A(this.ni)},Ir(t,pr,this.Qr,{capture:!1})}checkAndGetSessionAndWindowId(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=null),this.Se.cookieless_mode===hr)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=e||(new Date).getTime(),[,r,s]=this.fi(),n=this.pi(),o=this.ui(),a=Y(s)&&Math.abs(i-s)>864e5,l=!1,u=!1,h=!r,d=r,v=!h&&!t&&this.Yr(i,n);v&&((v=this.gi(i))||Po.info("cross-tab refresh kept the session alive",{sessionId:r}),[,r,s]=this.fi()),h||v||a?(r=this.ei(),o=this.ti(),Po.info("new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:h,activityTimeout:v,sessionPastMaximumLength:a}}),s=i,l=!0):(o||(o=this.ti(),l=!0),(u=r!==d)&&(Po.info("adopted cross-tab session id",{sessionId:r,windowId:o}),l=!0));var c=Y(n)&&t&&!a?n:i,f=Y(s)?s:(new Date).getTime();this.li(o),this.oi(r,c,f),t||this.ri();var p={noSessionId:h,activityTimeout:v,sessionPastMaximumLength:a,crossTabAdoption:u};return l&&this.Zr.forEach((t=>t(r,o,p))),{sessionId:r,windowId:o,sessionStartTimestamp:f,changeReason:l?p:void 0,lastActivityTimestamp:n}}ri(){this.Jr||(clearTimeout(this.mi),this.mi=setTimeout((()=>{if(!this.Jr)if(this.gi((new Date).getTime())){var t=this.Xr;this.resetSessionId(),this.Wr.emit("forcedIdleReset",{idleSessionId:t})}else this.ri()}),1.1*this.sessionTimeoutMs))}}var Io=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&M(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>M(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver},Ro=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 Co(t,e,i){return co({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Fo={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=>Ro(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Ro(e,t))))),icontains:(t,e)=>e.map(Mo).some((e=>t.map(Mo).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Mo).every((e=>t.map(Mo).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)))}))},Mo=t=>t.toLowerCase();function Oo(t,e){return!t||Object.entries(t).every((t=>{var[i,r]=t,s=null==e?void 0:e[i];if(q(s)||W(s))return!1;var n=[String(s)],o=Fo[r.operator];return!!o&&o(r.values,n)}))}var Ao="custom",Do="i.posthog.com",Lo=/^\/static\//;class jo{constructor(t){this.yi={},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("."+Do,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.yi[this.apiHost]||(this.yi[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":Ao),this.yi[this.apiHost]}bi(t){if(Lo.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.bi(e);if(i)return""+i+e}if(this.region===Ao)return this.apiHost+e;var r=Do+e;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var zo=li("[Surveys]"),No="seenSurvey_",Uo=["popover","widget","api"],Bo={ignoreConditions:!1,ignoreDelay:!1,displayType:xn},Ho=li("[PostHog ExternalIntegrations]"),qo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Go{constructor(t){this._instance=t}Mt(t,e){var i;null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return Ho.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(e){var i,s,n;!r||null!=(i=h.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]||t.Mt(qo[e],(()=>{var i;null==(i=h.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[e])||i.start(t._instance)})),!r&&null!=(s=h.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[e]&&(null==(n=h.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[e])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;e(i)}}}var Vo,Wo={},Jo=0,Ko=()=>{},Yo='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Qo="Surveys module not available",Xo="sanitize_properties is deprecated. Use before_send instead",Zo="Invalid value for property_denylist config: ",ta="posthog",ea=!ao&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla")),ia=e=>{var i;return p({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Tr(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ko,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&G(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(i=t.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){ai.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:cr,before_send:void 0,request_queue_config:{flush_interval_ms:yo},error_tracking:{},_onCapture:Ko},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:fs,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-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}: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),disable_capture_url_hashes:!(!t||"2026-06-25">t)}))(e))},ra=[["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"]],sa=t=>{var e={};for(var[i,r]of ra)q(t[i])||(e[r]=t[i]);var s=xr({},e,t),n=t.__preview_external_dependency_versioned_paths;return q(n)||(q(t.strict_script_versioning)&&(s.strict_script_versioning=!!n),G(n)&&q(t.asset_host)&&(s.asset_host=n)),N(t.property_blacklist)&&(q(t.property_denylist)?s.property_denylist=t.property_blacklist:N(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:ai.error(Zo+t.property_denylist)),s};class na{constructor(){this.__forceAllowLocalhost=!1}get wi(){return this.__forceAllowLocalhost}set wi(t){ai.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class oa{xi(t,e){if(t){var i=this.ki.indexOf(t);-1!==i&&this.ki.splice(i,1)}return this.ki.push(e),null==e.initialize||e.initialize(),e}Si(){return this.config.cookieless_mode===hr||this.config.cookieless_mode===ur&&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 na,this.Ci=!1,this.version=v.LIB_VERSION,this.Ii=new $o,this.ki=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ia(),this.SentryIntegration=Us,this.sentryIntegration=t=>function(t,e){var i=Ns(t,e);return{name:zs,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ti=!1,this.Ei=null,this.Mi=null,this.Pi=null,this.scrollManager=new So(this),this.pageViewManager=new Bs(this),this.rateLimiter=new En(this),this.requestRouter=new jo(this),this.consent=new Jr(this),this.externalIntegrations=new Go(this);var e=null!==(t=oa.__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=G(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=G(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>ai.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==ta){var r,s=null!==(r=Wo[i])&&void 0!==r?r:new oa;return s._init(t,e,i),Wo[i]=s,Wo[ta][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n;void 0===i&&(i={});var o=G(e)?e.trim():"";if(!o)return ai.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},i.debug=this.Ri(i.debug),this.Oi=i,this.Li=[],i.person_profiles?this.Mi=i.person_profiles:i.process_person&&(this.Mi=i.process_person);var a=ia(i.defaults),l=sa(i),u=xr({},a,l,{name:r,token:o});B(a.rageclick)&&B(l.rageclick)&&(u.rageclick=xr({},a.rageclick,l.rageclick)),B(a.session_recording)&&B(l.session_recording)&&(u.session_recording=xr({},a.session_recording,l.session_recording)),this.set_config(u),this.config.on_xhr_error&&ai.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Pn;var h=this.Fi();this.persistence=new gn(this.config,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new gn(p({},this.config,{persistence:"sessionStorage"}),h,!1);var d=p({},this.persistence.props),c=p({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Ai=new bo((t=>this.$i(t)),this.config.request_queue_config),this.Di=new xo(this),this.__request_queue=[];var f=this.Si();if(f||(this.sessionManager=new To(this),this.sessionPropsManager=new ko(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(ai.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ni(f)}),0)):(ai.info("Initializing extensions synchronously"),this.Ni(f)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&ai.info("Starting in debug mode",{this:this,config:i,thisC:p({},this.config),p:d,s:c}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=p({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=i.bootstrap)?void 0:n.distinctID)){var g=i.bootstrap.distinctID,_=this.get_distinct_id(),m=this.persistence.get_property(Yi);if(i.bootstrap.isIdentifiedID&&null!=_&&_!==g&&m===dr)this.identify(g);else if(i.bootstrap.isIdentifiedID&&null!=_&&_!==g&&m===vr)ai.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 y=this.config.get_device_id(Dr()),b=i.bootstrap.isIdentifiedID?y:g;this.persistence.set_property(Yi,i.bootstrap.isIdentifiedID?vr:dr),this.register({distinct_id:g,$device_id:b})}}if(f)this.register_once({distinct_id:sr,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id(Dr());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(Yi,dr)}return Ir(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||Dr();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(Yi,vr)),e()},s=i.user();"then"in s&&U(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{Promise&&Promise.resolve||js.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()||(js.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(js.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,gr),identify:t=>e(t,mr),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.qi())):this.qi(),U(this.config._onCapture)&&this.config._onCapture!==Ko&&(ai.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&ai.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}Ni(t){var e,i,r,s,n,o,a,l=performance.now(),u=p({},oa.__defaultExtensionClasses,this.config.__extensionClasses),h=[];u.featureFlags&&this.ki.push(this.featureFlags=null!==(e=this.featureFlags)&&void 0!==e?e:new u.featureFlags(this)),u.exceptions&&this.ki.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new u.exceptions(this)),u.historyAutocapture&&this.ki.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.ki.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.ki.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.ki.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.ki.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.ki.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this)),u.logs&&this.ki.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new u.logs(this)),u.conversations&&this.ki.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new u.conversations(this)),u.productTours&&this.ki.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.ki.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.ki.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.ki.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.ki.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Ds)),u.toolbar&&this.ki.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new u.toolbar(this)),u.experiments&&this.ki.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new u.experiments(this)),this.ki.forEach((t=>{t.initialize&&h.push((()=>{null==t.initialize||t.initialize()}))})),h.push((()=>{if(this.Bi){var t=this.Bi;this.Bi=void 0,this.pr(t)}})),this.ji(h,l)}ji(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.ji(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){ai.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[nr]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[or]:r}),this.config.__preview_deferred_init_extensions&&ai.info("PostHog extensions initialized ("+r+"ms)")}pr(t){var e;if(!r||!r.body)return ai.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.pr(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Bi=t),this.Hi=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=O(t.supportedCompression,Pn)?Pn:O(t.supportedCompression,Tn)?Tn:void 0),null!=(e=t.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Mi?this.Mi:cr}),this.ki.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}qi(){try{this.config.loaded(this)}catch(t){ai.critical("`loaded` function failed",t)}if(this.Ui(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Si())&&this.zi()}),1),this.Vi=new $n(this),this.Vi.load()}Ui(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Ai)||t.enable())}_dom_loaded(){this.is_capturing()&&br(this.__request_queue,(t=>this.$i(t))),this.__request_queue=[],this.Ui()}_handle_unload(){var t,e,i,r;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),this.config.request_batching?(this.Wi()&&this.capture(_r),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(i=this.Ai)||i.unload(),null==(r=this.Di)||r.unload()):this.Wi()&&this.capture(_r,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?ea?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=p({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,(q(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,i,r,s=p({},t);s.timeout=s.timeout||6e4,s.url=_o(s.url,s.compression);var n=null!==(e=s.transport)&&void 0!==e?e:"fetch",o=mo.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),a=null!==(i=null==(r=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===n)return t[i]}(o))?void 0:r.method)&&void 0!==i?i:o[0].method;if(!a)throw new Error("No available transport method");"sendBeacon"!==n&&s.data&&s.compression===Pn&&l&&!uo?go(s).then((t=>{a(t)})).catch((e=>{if(T(e))return uo=!0,void a(p({},s,{compression:void 0,url:_o(t.url,void 0)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return T(t)||e===k})(e)&&(uo=!0),a(s)})):a(s)})(p({},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}))}$i(t){this.Di?this.Di.retriableRequest(t):this._send_request(t)}_execute_array(t){Jo++;try{var e,i=[],r=[],s=[];br(t,(t=>{if(t)if(N(e=t[0]))s.push(t);else if(U(t))try{t.call(this)}catch(e){ai.error("Error executing queued PostHog call",t,e)}else N(t)&&"alias"===e?i.push(t):N(t)&&-1!==e.indexOf("capture")&&U(this[e])?s.push(t):r.push(t)}));var n=function(t,e){br(t,(function(t){try{if(N(t[0])){var i=e;wr(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){ai.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{Jo--}}push(t){if(Jo>0&&N(t)&&G(t[0])){var e=oa.prototype[t[0]];U(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,i){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ai){if(this.is_capturing())if(!q(t)&&G(t)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=e&&e.$current_url&&!G(null==e?void 0:e.$current_url)&&(ai.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=i&&i.Gi||ai.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var h=new Date,d=(null==i?void 0:i.timestamp)||h,v=fe(null==i?void 0:i.uuid,Dr),c={uuid:v,event:t,properties:this.calculateEventProperties(t,e||{},d,v)};t===gr&&this.config.__preview_capture_bot_pageviews&&l&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),u&&(c.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==i?void 0:i.$set)&&(c.$set=null==i?void 0:i.$set);var f=null==i?void 0:i.$unset;f&&(c.$unset=f);var g,_,m,y=this.Zi(null==i?void 0:i.$set_once,t!==yr,t===mr);if(y&&(c.$set_once=y),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,n=c,o=t=>G(t)?t.slice(0,s):t,a=new Set,c=function t(e,i){return e!==Object(e)?o?o(e):e:a.has(e)?void 0:(a.add(e),N(e)?(r=[],br(e,(e=>{r.push(t(e))}))):(r={},wr(e,((e,i)=>{a.has(e)||(r[i]=t(e,i))}))),r);var r}(n)),c.timestamp=d,q(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=h),t===bn||t===wn){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})(No,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){zo.error("Failed to persist survey seen state",t)}})({id:b,current_iteration:w}),c.$set=p({},c.$set,{[(g={id:b,current_iteration:w},_=t===wn?"responded":"dismissed",m="$survey_"+_+"/"+g.id,g.current_iteration&&g.current_iteration>0&&(m="$survey_"+_+"/"+g.id+"/"+g.current_iteration),m)]:!0})}else t===yn&&(c.$set=p({},c.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===t){var x=null==e?void 0:e.$product_tour_type;x&&(c.$set=p({},c.$set,{["$product_tour_last_seen_date/"+x]:(new Date).toISOString()}))}var S=p({},c.properties.$set,c.$set);if(H(S)||this.setPersonPropertiesForFlags(S),!J(this.config.before_send)){var E=this.it(c);if(!E)return;(c=E).uuid=fe(c.uuid,Dr)}this.Ii.emit("eventCaptured",c);var k={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:null==i?void 0:i._batchKey,transport:null==i?void 0:i.transport};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.$i(k):this.Ai.enqueue(k),c}ai.critical("This capture call is ignored due to client rate limiting.")}}else ai.error("No event name provided to posthog.capture")}else ai.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;var l=a?void 0:this.persistence.remove_event_timer(e),h=p({},i);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.Si()&&(h.$cookieless_mode=!0),"$snapshot"===e){var d=p({},this.persistence.properties(),this.sessionPersistence.properties());return h.distinct_id=d.distinct_id,(!G(h.distinct_id)&&!K(h.distinct_id)||V(h.distinct_id))&&ai.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}var c,f=function(e,i,r,n){var o,a,l,h;if(void 0===n&&(n=!1),!u)return{};var d,c,f,p,g,_,m,y,b,w=e?[...Xs,...i||[]]:[],[x,S]=function(t){for(var e=0;de.length>e;e++){var[i,r]=de[e],s=i.exec(t),n=s&&(U(r)?r(s,t):r);if(n)return n}return["",""]}(u),E=null!=(d="undefined"!=typeof navigator?navigator:void 0)&&d.brave?{brave:!0}:{},k={detectGoogleSearchApp:r},P=xr($r({$os:x,$os_version:S,$browser:le(u,navigator.vendor,E,k),$device:ve(u),$device_type:(f=u,p={userAgentDataPlatform:null==(o=navigator)||null==(o=o.userAgentData)?void 0:o.platform,maxTouchPoints:null==(a=navigator)?void 0:a.maxTouchPoints,screenWidth:null==t||null==(l=t.screen)?void 0:l.width,screenHeight:null==t||null==(h=t.screen)?void 0:h.height,devicePixelRatio:null==t?void 0:t.devicePixelRatio},b=ve(f),b===ft||b===ct||"Kobo"===b||"Kindle Fire"===b||b===qt?vt:b===Mt||b===At||b===Ot||b===Ut?"Console":b===gt?"Wearable":b?ut:"Android"===(null==p?void 0:p.userAgentDataPlatform)&&(null!==(g=null==p?void 0:p.maxTouchPoints)&&void 0!==g?g:0)>0?600>Math.min(null!==(_=null==p?void 0:p.screenWidth)&&void 0!==_?_:0,null!==(m=null==p?void 0:p.screenHeight)&&void 0!==m?m:0)/(null!==(y=null==p?void 0:p.devicePixelRatio)&&void 0!==y?y:1)?ut:vt:"Desktop"),$timezone:dn(),$timezone_offset:vn()}),{$current_url:Ks(n?pe(null==s?void 0:s.href):null==s?void 0:s.href,w,tn),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:he(u,navigator.vendor,E,k),$browser_language:on(),$browser_language_prefix:(c=on(),"string"==typeof c?c.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return v.SDK_DIST_CHANNEL&&(P.$sdk_dist_channel=v.SDK_DIST_CHANNEL),P}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var{sessionId:g,windowId:_}=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime());h.$session_id=g,h.$window_id=_}this.sessionPropsManager&&xr(h,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&xr(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null==(m=this.Di)?void 0:m.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Ao&&(h.$lib_custom_api_host=this.config.api_host),c=e!==gr||a?e!==_r||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),h=xr(h,c),e===gr&&r&&(h.title=r.title),!q(l)){var y=n.getTime()-l;h.$duration=parseFloat((y/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser"),(h=xr({},f,this.persistence.properties(),this.sessionPersistence.properties(),h)).$is_identified=this._isIdentified(),N(this.config.property_denylist)?wr(this.config.property_denylist,(function(t){delete h[t]})):ai.error(Zo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(ai.error(Xo),h=b(h,e));var w=this.Qi();return h.$process_person_profile=w,w&&!a&&this.Ji("_calculate_event_properties"),h}Zi(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.Qi())return t;if(this.Ci&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=xr({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(ai.error(Xo),o=a(o,"$set_once")),e&&(this.Ci=!0),H(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)}Yi(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.Ii.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:Qo}),()=>{})}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:Qo})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:Qo})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=Bo),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:Qo}}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:Qo})}Ki(t){return!t||V(t)?(ai.critical("Unique user id has not been set in posthog.identify"),!1):t===sr?(ai.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())||(ai.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 ai.uninitializedWarning("posthog.identify");if(K(t)&&(t=t.toString(),ai.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Ki(t)&&this.Ji("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:t}),this.get_property(vi)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),t!==r&&t!==this.get_property(ci)&&(this.unregister(ci),this.register({distinct_id:t}));var s,n=(this.persistence.get_property(Yi)||dr)===dr;t!==r&&n?(this.persistence.set_property(Yi,vr),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.capture(mr,{distinct_id:t,$anon_distinct_id:r},{$set:e||{},$set_once:i||{}}),this.Pi=Co(t,e,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(e||i)&&this.setPersonProperties(e,i),t!==r&&(this.reloadFeatureFlags(),this.unregister(Vi))}}setPersonProperties(t,e){if((t||e)&&this.Ji("posthog.setPersonProperties")){var i=Co(this.get_distinct_id(),t,e);this.Pi!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Pi=i):ai.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(N(t)?t:[t]).filter((t=>G(t)&&t.length>0));0!==i.length&&this.Ji("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Pi=null)}group(t,e,i){if(t&&e){var r=this.getGroups(),s=r[t]!==e;if(s&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p({},r,{[t]:e})}),s||i){var n={$group_type:t,$group_key:e};i&&(n.$group_set=i),this.capture(yr,n)}i&&this.setGroupPropertiesForFlags({[t]:i}),s&&!i&&this.reloadFeatureFlags()}else ai.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.Ji("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e,i,r,s,n,o,a,l,u;if(ai.info("reset"),!this.__loaded)return ai.uninitializedWarning("posthog.reset");var h,d=this.get_property(vi),v=this.get_property(Ei);if(this.consent.reset(),null==(e=this.persistence)||e.clear(),null==(i=this.sessionPersistence)||i.clear(),q(v)||null==(h=this.persistence)||h.register({[Ei]:v}),null==(r=this.surveys)||r.reset(),null==(s=this.Vi)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.logs)||a.reset(),null==(l=this.persistence)||l.set_property(Yi,dr),null==(u=this.sessionManager)||u.resetSessionId(),this.Pi=null,this.config.cookieless_mode===hr)this.register_once({distinct_id:sr,$device_id:null},"");else{var c=this.config.get_device_id(Dr());this.register_once({distinct_id:c,$device_id:t?c:d},"")}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.Xi()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.en()}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(di)?(ai.critical("Attempting to create alias for existing People user - aborting."),-2):this.Ji("posthog.alias")?(q(e)&&(e=this.get_distinct_id()),t!==e?(this.Yi(ci,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(ai.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=p({},this.config);if(B(t)){var i,r,s,n,o,a,l,u,h,d,c;xr(this.config,sa(t));var f=this.Fi();null==(i=this.persistence)||i.update_config(this.config,e,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new gn(p({},this.config,{persistence:"sessionStorage"}),f,!1);var g=this.Ri(this.config.debug);Q(g)&&(this.config.debug=g),Q(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,Br.N()&&Br.q("ph_debug",!0),ai.info("set_config",{config:t,oldConfig:e,newConfig:p({},this.config)})):(v.DEBUG=!1,Br.N()&&Br.A("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(s=this.exceptions)||s.onConfigChange(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),null==(o=this.tracingHeaders)||o.startIfEnabledOrStop(),null==(a=this.autocapture)||a.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(h=this.deadClicksAutocapture)||h.startIfEnabledOrStop(),null==(d=this.surveys)||d.loadIfEnabled(),this.tn(),null==(c=this.externalIntegrations)||c.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){v.LIB_NAME=t,v.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(p({},r,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:oa.rn}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:ta;return e!==ta&&(e=ta+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(Yi))===vr||(null==(e=this.sessionPersistence)?void 0:e.get_property(Yi))===vr}Qi(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===cr&&!this._isIdentified()&&H(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[ci])&&(null==(e=this.persistence)||null==(e=e.props)||!e[ir]))}Wi(){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.Qi()||this.Ji("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Ji("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Ji(t){return"never"===this.config.person_profiles?(ai.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Yi(ir,!0),!0)}Fi(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ur)}tn(){var t,e,i,r,s=this.Fi();return(null==(t=this.persistence)?void 0:t.Vt)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.Vt)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==hr){if(this.Si()){var i,r,s,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new To(this),this.pageViewManager=new Bs(this),this.persistence&&(this.sessionPropsManager=new ko(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=oa.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.xi(this.sessionRecording,new l(this)),this.Hi&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Hi)))}var u,h;this.consent.optInOut(!0),this.tn(),this.Ui(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==ur&&(null==(u=this.surveys)||u.loadIfEnabled()),(q(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.zi()}else ai.warn(Yo)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==hr?(this.config.cookieless_mode===ur&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.tn(),this.config.cookieless_mode===ur&&(this.register({distinct_id:sr,$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.zi(),this.Ui())):ai.warn(Yo)}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===hr||(this.config.cookieless_mode===ur?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.tn()}_is_bot(){return i?Io(i,this.config.custom_blocked_useragents):void 0}zi(){r&&("visible"===r.visibilityState?this.Ti||(this.Ti=!0,this.capture(gr,{title:r.title},{send_instantly:!0}),this.Ei&&(r.removeEventListener(fr,this.Ei),this.Ei=null)):this.Ei||(this.Ei=this.zi.bind(this),Ir(r,fr,this.Ei)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}mr(){var t,e,i,r,s,n,o=this.Oi||{};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?(ai.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=ai,s=(e="advanced_disable_flags")in(t=o)&&!J(t[e]),n=i in t&&!J(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]))}it(t){var e;if(J(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(tt),r=N(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r){if(s=n(s),J(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return Z(t.event)?ai.warn(o+". This can cause unexpected behavior."):ai.info(o),null}s.properties&&!H(s.properties)||ai.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of i)if(s.properties&&J(s.properties[a]))return ai.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.Ot)?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)})}Ri(t){var e=Q(t)&&!t,i=Br.N()&&"true"===Br.P("ph_debug");return!e&&(!!i||t)}}oa.__defaultExtensionClasses={},oa.rn={trace:Vo=()=>{},debug:Vo,info:Vo,warn:Vo,error:Vo,fatal:Vo},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=kr(t.prototype[e[i]])}(oa,["identify"]);class aa{constructor(t){this.disabled=!1===t;var e=B(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 la="$copy_autocapture",ua=li("[AutoCapture]");function ha(t,e){return e.length>t?e.slice(0,t)+"...":e}function da(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!Zr(e));return e}function va(e,i){var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u,disableCaptureUrlHashes:h}=i;if(!Zr(e))return{props:{}};for(var d=[e],v=e;v.parentNode&&!ts(v,"body");)if(is(v.parentNode))d.push(v.parentNode.host),v=v.parentNode.host;else{if(!Zr(v.parentNode))break;d.push(v.parentNode),v=v.parentNode}var c,f,g=[],_={},m=!1,y=!1;if(wr(d,(t=>{var e=ws(t);if(ts(t,"a")){var i=t.getAttribute("href");m=!!(e&&i&&Is(i))&&(h?pe(i):i)}O(ns(t),"ph-no-capture")&&(y=!0),g.push(function(t,e,i,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};us.indexOf(n)>-1&&!i&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?ha(1024,Rs(t)):ha(1024,as(t)));var a=ns(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),wr(t.attributes,(function(i){var n;if((!xs(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&Is(i.value)&&(!G(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=i.value;"class"===i.name&&(a=rs(a).join(" ")),o["attr__"+i.name]=ha(1024,"href"===i.name&&s?pe(a):a)}}));for(var l=1,u=1,h=t;h=da(h);)l++,h.tagName===t.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(t,o,a,l,h));var r=function(t){if(!ws(t))return{};var e={};return wr(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&&Is(r)&&(e[i]=r)}})),e}(t);xr(_,r)})),y)return{props:{},explicitNoCapture:y};if(a||(g[0].$el_text=ts(e,"a")||ts(e,"button")?Rs(e):as(e)),m){var b,w;g[0].attr__href=m;var x=null==(b=Ws(m))?void 0:b.host,S=null==t||null==(w=t.location)?void 0:w.host;x&&S&&x!==S&&(c=m)}return{props:xr({$event_type:n.type,$ce_version:1},u?{}:{$elements:g},{$elements_chain:(f=g,function(t){return t.map((t=>{var e,i,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var s of(t.attr_class.sort(),t.attr_class))r+="."+s.replace(/"/g,"");var n=p({},t.text?{text:t.text}:{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(i=t.nth_of_type)&&void 0!==i?i:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return Sr(n).sort(((t,e)=>{var[i]=t,[r]=e;return i.localeCompare(r)})).forEach((t=>{var[e,i]=t;return o[Fs(e.toString())]=Fs(i.toString())})),(r+=":")+Sr(o).map((t=>{var[e,i]=t;return e+'="'+i+'"'})).join("")})).join(";")}(function(t){return t.map((t=>{var e,i,r={text:null==(e=t.$el_text)?void 0:e.slice(0,400),tag_name:t.tag_name,href:null==(i=t.attr__href)?void 0:i.slice(0,2048),attr_class:Ms(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Sr(t).filter((t=>{var[e]=t;return 0===e.indexOf("attr__")})).forEach((t=>{var[e,i]=t;return r.attributes[e]=i})),r}))}(f)))},null!=(r=g[0])&&r.$el_text?{$el_text:null==(s=g[0])?void 0:s.$el_text}:{},c&&"click"===n.type?{$external_click_url:c}:{},_)}}var ca=li("[ExceptionAutocapture]"),fa=li("[TracingHeaders]"),pa=li("[Web Vitals]"),ga=9e5,_a="disabled",ma="lazy_loading",ya="awaiting_config",ba="missing_config";li("[SessionRecording]"),li("[SessionRecording]");var wa="[SessionRecording]",xa=li(wa),Sa=li("[Heatmaps]");function Ea(t){return B(t)&&"clientX"in t&&"clientY"in t&&K(t.clientX)&&K(t.clientY)}var ka=li("[Product Tours]"),$a=t=>{var e;return!t.config.disable_product_tours&&!(null==(e=t.persistence)||!e.get_property(xi))},Pa=["$set_once","$set"],Ta=li("[SiteApps]"),Ia="Error while initializing PostHog app with config id ";function Ra(t,e,i){if(J(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 Ca{constructor(t){this.nn=new $o,this.sn=(t,e)=>this.an(t,e)&&this.ln(t,e)&&this.un(t,e)&&this.hn(t,e),this.an=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t,this.dn=new Set,this.cn=new Set}init(){var t,e;q(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(!q(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e,i;null==(e=this.cn)||e.add(t),null==(i=t.steps)||i.forEach((t=>{var e;null==(e=this.dn)||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.dn.has(t)||this.dn.has(null==e?void 0:e.event))&&this.cn&&(null==(i=this.cn)?void 0:i.size)>0&&this.cn.forEach((t=>{this.vn(e,t)&&this.nn.emit("actionCaptured",t.name)}))}fn(t){this.onAction("actionCaptured",(e=>t(e)))}vn(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.sn(t,i))return!0;return!1}onAction(t,e){return this.nn.on(t,e)}ln(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(!Ra(r,e.url,e.url_matching||"contains"))return!1}return!0}un(t,e){return!!this.pn(t,e)&&!!this.gn(t,e)&&!!this.mn(t,e)}pn(t,e){var i;if(null==e||!e.href)return!0;var r=this.yn(t);if(r.length>0)return r.some((t=>Ra(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Ra((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}gn(t,e){var i;if(null==e||!e.text)return!0;var r=this.yn(t);if(r.length>0)return r.some((t=>Ra(t.text,e.text,e.text_matching||"exact")||Ra(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;!J(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=>Ra(t,n,o))))}mn(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}yn(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}hn(t,e){return null==e||!e.properties||0===e.properties.length||Oo(e.properties.reduce(((t,e)=>{var i=N(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 Fa{constructor(t){this.bn=[],this._instance=t,this._n=new Map,this.wn=new Map,this.xn=new Map}kn(t,e){return!!t&&Oo(t.propertyFilters,null==e?void 0:e.properties)}Sn(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}Cn(t,e,i){var r=(i===_n?this._n:this.wn).get(t),s=[];return this.In((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.kn(n,e)}))}register(t){var e;q(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.Tn(t),this.En(t))}En(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.Mn&&(this.Mn=new Ca(this._instance),this.Mn.init(),this.Mn.fn((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.Mn)||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.xn.get(e.name);i&&i.push(t.id),this.xn.set(e.name,i||[t.id])}})))})))}Tn(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._n=this.Sn(t,_n),this.wn=this.Sn(t,mn))}onEvent(t,e){var i,r,s=this.Pn(),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.Rn(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.On([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),void this.Ln(n)}if(this.wn.has(t)){var a=this.Cn(t,e,mn);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.On(a.map((t=>t.id))),a.forEach((t=>this.Fn(t.id))))}if(this._n.has(t)){s.info("event name matched",{event:t,eventPayload:e,items:this._n.get(t)});var l=this.Cn(t,e,_n);this.An(l.map((t=>t.id)))}}onAction(t){this.xn.has(t)&&this.An(this.xn.get(t)||[])}An(t){0!==t.length&&(this.bn=[...new Set([...this.bn,...t])],this.Pn().info("updating activated items",{activatedItems:this.getActivatedIds()}))}Ln(t){this.bn=this.bn.filter((e=>e!==t));var e=this.$n();e.includes(t)||this.Dn([...e,t])}On(t){var e=new Set(t);this.bn=this.bn.filter((t=>!e.has(t)));var i=this.$n(),r=i.filter((t=>!e.has(t)));r.length!==i.length&&this.Dn(r)}$n(){var t,e=this.Nn();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}getActivatedIds(){return[...new Set([...this.$n(),...this.bn])].filter((t=>!this.qn(t)))}reset(){this.bn=[],this.$n().length>0&&this.Dn([])}getEventToItemsMap(){return this._n}Bn(){return this.Mn}}class Ma extends Fa{constructor(t){super(t)}Nn(){return qi}jn(){return yn}In(t){var e;null==(e=this._instance)||e.getSurveys(t)}Fn(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}Pn(){return zo}Dn(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[qi]:t})}qn(){return!1}Rn(t,e){var i;this.In((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===yn?"consume":"ignore":t===yn?"persist":t===bn||t===wn?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Oa="SDK is not enabled or survey functionality is not yet loaded",Aa="Disabled. Not loading surveys.",Da=null!=t&&t.location?Ys(t.location.hash,"__posthog")||Ys(location.hash,"state"):null,La="_postHogToolbarParams",ja=li("[Toolbar]"),za=li("[FeatureFlags]"),Na=li("[FeatureFlags]",{debugEnabled:!0}),Ua="\" failed. Feature flags didn't load in time.",Ba=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},Ha=t=>{var e={};for(var[i,r]of Sr(t||{}))r&&(e[i]=r);return e},qa=li("[Error tracking]"),Ga="Refusing to render web experiment since the viewer is a likely bot",Va={icontains:(e,i)=>!!t&&i.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,i)=>!!t&&-1===i.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,i)=>!!t&&Ro(i.href,e),not_regex:(e,i)=>!!t&&!Ro(i.href,e),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class Wa{get Se(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{Wa.Hn("retrieved web experiments from the server"),e.Un=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.Un&&(Wa.Hn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.Un)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);G(r)&&t.variants[r]&&e.zn(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Wa.Vn(n)&&e.zn(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Wa.Hn(Ga);else if(!this.Se.disable_web_experiments){if(J(this.Un))return this.Un=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Wa.Hn("applying feature flags",t),t.forEach((t=>{var e;if(this.Un&&null!=(e=this.Un)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.Un)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.zn(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Wa.getWindowLocation();if(null!=t&&t.search){var e=Js(null==t?void 0:t.search,"__experiment_id"),i=Js(null==t?void 0:t.search,"__experiment_variant");e&&i&&(Wa.Hn("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.Wn(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.Se.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Se.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.Se.token),method:"GET",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Wn(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(Wa.Hn("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.zn(r[0].name,e,r[0].variants[e].transforms))}static Vn(t){return!J(t.conditions)&&Wa.Gn(t)&&Wa.Zn(t)}static Gn(t){var e;if(J(t.conditions)||J(null==(e=t.conditions)?void 0:e.url))return!0;var i,r,s,n=Wa.getWindowLocation();return!!n&&(null==(i=t.conditions)||!i.url||Va[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==t?void 0:t.location}static Zn(t){var e;if(J(t.conditions)||J(null==(e=t.conditions)?void 0:e.utm))return!0;var i=rn();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 Hn(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];ai.info("[WebExperiments] "+t,i)}zn(t,e,i){this._is_bot()?Wa.Hn(Ga):"control"!==e?i.forEach((i=>{if(i.selector){var r;Wa.Hn("applying transform of variant "+e+" for experiment "+t+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((t=>{var e=t;i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)}))}})):Wa.Hn("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?Io(i,this.Se.custom_blocked_useragents):void 0}}var Ja=li("[Conversations]"),Ka="Conversations not available yet.",Ya="console",Qa={featureFlags:class{constructor(t){this.Qn=!1,this.Jn=!1,this.Yn=!1,this.Kn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Se(){return this._instance.config}get Ur(){return this._instance.persistence}ns(t){return this._instance.get_property(t)}ss(){var t,e;return null!==(t=null==(e=this.Ur)?void 0:e.Gt(this.Se.feature_flag_cache_ttl_ms))&&void 0!==t&&t}os(){return!!this.ss()&&(this.rs||this.Yn||(this.rs=!0,za.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}ls(){var t,e=null!==(t=this.Se.evaluation_contexts)&&void 0!==t?t:this.Se.evaluation_environments;return!this.Se.evaluation_environments||this.Se.evaluation_contexts||this.ts||(za.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ts=!0),null!=e&&e.length?e.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||za.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}us(){return this.ls().length>0}hs(){var t=this.Se.flag_keys;if(!q(t)){if(N(t))return t.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||za.error("Invalid flag key found:",t,"Expected non-empty string"),e}));za.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,i){var r,s,n=null!=i&&i.merge&&null!==(r=this.ns(Fi))&&void 0!==r?r:{},o=null!=i&&i.merge&&null!==(s=this.ns(Di))&&void 0!==s?s:{},a=p({},n,t),l=p({},o,e),u={};for(var[h,d]of Object.entries(a))u[h]={key:h,enabled:m(d),variant:y(d),reason:void 0,metadata:q(null==l?void 0:l[h])?void 0:{id:0,version:void 0,description:void 0,payload:l[h]}};this.receivedFeatureFlags({flags:u})}get hasLoadedFlags(){return this.Jn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.ns(Ai),e=this.ns(ji),i=this.ns(zi);if(!i&&!e)return t||{};var r=xr({},t||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(e||{})])];for(var n of s){var o,a,l=r[n],u=null==e?void 0:e[n],h=q(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,d=q(u)?l.variant:"string"==typeof u?u:void 0,v=null==i?void 0:i[n],c=p({},l,{enabled:h,variant:h?null!=d?d:null==l?void 0:l.variant:void 0});h!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v&&(c.metadata=p({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=c}return this.Qn||(za.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:r}),this.Qn=!0),r}getFlagVariants(){var t=this.ns(Fi),e=this.ns(ji);if(!e)return t||{};for(var i=xr({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Qn||(za.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Qn=!0),i}getFlagPayloads(){var t=this.ns(Di),e=this.ns(zi);if(!e)return t||{};for(var i=xr({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Qn||(za.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Qn=!0),i}reloadFeatureFlags(){this.Kn||this.Se.advanced_disable_feature_flags||this.ds||(this._instance.Ii.emit("featureFlagsReloading",!0),this.ds=setTimeout((()=>{this.cs()}),5))}vs(){clearTimeout(this.ds),this.ds=void 0}ensureFlagsLoaded(){this.Jn||this.Yn||this.ds||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Kn=t}cs(t){var e;if(this.vs(),!this._instance.mr())if(this.Yn)this.Xn=!0;else{var i=this.Se.token,r=this.ns(vi),s={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:p({},(null==(e=this.Ur)?void 0:e.get_initial_props())||{},this.ns(Ni)||{}),group_properties:this.ns(Ui),timezone:dn()};W(r)||q(r)||(s.$device_id=r),(null!=t&&t.disableFlags||this.Se.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.us()&&(s.evaluation_contexts=this.ls());var n=this.hs();q(n)||(s.flag_keys=n);var o=!!this.Se.advanced_only_evaluate_survey_feature_flags,a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Se.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Yn=!0,this._instance._send_request({method:"POST",url:a,data:s,compression:this.Se.disable_compression?void 0:Tn,timeout:this.Se.feature_flag_request_timeout_ms,callback:t=>{var e,i,r,n=!0;if(200===t.statusCode&&(this.Xn||(this.$anon_distinct_id=void 0),n=!1),this.Yn=!1,!s.disable_flags||this.Xn){this.es=!n;var a=[];t.error?t.error instanceof Error?a.push("AbortError"===t.error.name?"timeout":"connection_error"):a.push("unknown_error"):200!==t.statusCode&&a.push("api_error_"+t.statusCode),null!=(e=t.json)&&e.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var l,u=!(null==(i=t.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(u&&a.push("quota_limited"),null==(r=this.Ur)||r.register({[Ji]:a}),u)za.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else s.disable_flags||this.receivedFeatureFlags(null!==(l=t.json)&&void 0!==l?l:{},n,{partialResponse:o}),this.Xn&&(this.Xn=!1,this.cs())}}})}}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.es)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.os()){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 za.warn('getFeatureFlag for key "'+t+Ua)}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.es)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.os()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],o=String(s),a=this.ns(Li)||void 0,l=this.ns(Ki)||void 0,u=this.ns(Vi)||{};if(this.Se.advanced_feature_flags_dedup_per_session){var h,d=this._instance.get_session_id(),v=this.ns(Wi);d&&d!==v&&(u={},null==(h=this.Ur)||h.register({[Vi]:u,[Wi]: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,S;N(u[t])?u[t].push(o):u[t]=[o],null==(c=this.Ur)||c.register({[Vi]:u});var E=this.getFeatureFlagDetails(t),k=[...null!==(f=this.ns(Ji))&&void 0!==f?f:[]];q(s)&&k.push("flag_missing");var P={$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.Se.bootstrap)||null==(p=p.featureFlags)?void 0:p[t])||null,$feature_flag_bootstrapped_payload:(null==(g=this.Se.bootstrap)||null==(g=g.featureFlagPayloads)?void 0:g[t])||null,$used_bootstrap_value:!this.es};q(null==E||null==(m=E.metadata)?void 0:m.version)||(P.$feature_flag_version=E.metadata.version);var T,I=null!==(y=null==E||null==(b=E.reason)?void 0:b.description)&&void 0!==y?y:null==E||null==(w=E.reason)?void 0:w.code;I&&(P.$feature_flag_reason=I),null!=E&&null!=(x=E.metadata)&&x.id&&(P.$feature_flag_id=E.metadata.id),q(null==E?void 0:E.original_variant)&&q(null==E?void 0:E.original_enabled)||(P.$feature_flag_original_response=q(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(S=E.metadata)&&S.original_payload&&(P.$feature_flag_original_payload=null==E||null==(T=E.metadata)?void 0:T.original_payload),k.length&&(P.$feature_flag_error=k.join(",")),this._instance.capture("$feature_flag_called",P)}if(r)return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:_(n)}}}else za.warn('getFeatureFlagResult for key "'+t+Ua)}getRemoteConfigPayload(t,e){var i=this.Se.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.us()&&(r.evaluation_contexts=this.ls());var s=this.hs();q(s)||(r.flag_keys=s),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Se.disable_compression?void 0:Tn,timeout:this.Se.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.es){if(this.Jn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(t,e);return q(i)?void 0:!!i}za.warn('isFeatureEnabled for key "'+t+Ua)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,i){if(this.Ur){this.Jn=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(t,e,i,r,s,n){void 0===i&&(i={}),void 0===r&&(r={}),void 0===s&&(s={});var o=(t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return null==(i=e[t].metadata)?void 0:i.payload})).map((t=>{var i;return[t,null==(i=e[t].metadata)?void 0:i.payload]})))):t.featureFlags&&za.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(l){var h=t.requestId,d=t.evaluatedAt;if(N(l)){za.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(l)for(var c=0;l.length>c;c++)v[l[c]]=!0;e&&e.register({[Mi]:l,[Fi]:v})}else{var f=l,g=u,_=a;if(null!=n&&n.partialResponse)f=p({},i,f),g=p({},r,g),_=p({},s,_);else if(t.errorsWhileComputingFlags)if(a){var m=new Set(Object.keys(a).filter((t=>{var e;return!(null!=(e=a[t])&&e.failed)})));f=p({},i,Object.fromEntries(Object.entries(f).filter((t=>{var[e]=t;return m.has(e)})))),g=p({},r,Object.fromEntries(Object.entries(g||{}).filter((t=>{var[e]=t;return m.has(e)})))),_=p({},s,Object.fromEntries(Object.entries(_||{}).filter((t=>{var[e]=t;return m.has(e)}))))}else f=p({},i,f),g=p({},r,g),_=p({},s,_);e&&e.register(p({[Mi]:Object.keys(Ha(f)),[Fi]:f||{},[Di]:g||{},[Ai]:_||{}},h?{[Li]:h}:{},d?{[Ki]:d}:{}))}}}(t,this.Ur,r,s,n,i),e||(this.rs=!1),this.fs(e)}}override(t,e){void 0===e&&(e=!1),za.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.Ur)return za.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.Ur.unregister(ji),this.Ur.unregister(zi),this.fs(),Na.info("All overrides cleared");if(N(t)){var e=Ba(t);return this.Ur.register({[ji]:e}),this.fs(),Na.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,r=t;if(this.Qn=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.Ur.unregister(ji),Na.info("Flag overrides cleared");else if(r.flags){if(N(r.flags)){var s=Ba(r.flags);this.Ur.register({[ji]:s})}else this.Ur.register({[ji]:r.flags});Na.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.Ur.unregister(zi),Na.info("Payload overrides cleared")):r.payloads&&(this.Ur.register({[zi]:r.payloads}),Na.info("Payload overrides set",{payloads:r.payloads}))),void this.fs()}if(t&&"object"==typeof t)return this.Ur.register({[ji]:t}),this.fs(),Na.info("Flag overrides set",{flags:t});za.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Jn){var{flags:e,flagVariants:i}=this.ps();t(e,i)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,i){var r,s=(this.ns(Oi)||[]).find((e=>e.flagKey===t)),n={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:n};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=p({},this.getFlagVariants(),{[t]:e});null==(r=this.Ur)||r.register({[Mi]:Object.keys(Ha(a)),[Fi]:a}),this.fs()}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.ns(Oi),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.Se.token+s),method:"GET",callback:e=>{var i,r;if(e.json){var s=e.json.earlyAccessFeatures;return null==(i=this.Ur)||i.unregister(Oi),null==(r=this.Ur)||r.register({[Oi]:s}),t(s)}}})}ps(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,i)=>(t[i]=e[i],t)),{})}}fs(t){var{flags:e,flagVariants:i}=this.ps();this.featureFlagEventHandlers.forEach((r=>r(e,i,{errorsLoading:t})))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var i=this.ns(Ni)||{},r=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),s=null==t?void 0:t.$set_once,n={};if(s)for(var o in s)({}).hasOwnProperty.call(s,o)&&(o in i||(n[o]=s[o]));this._instance.register({[Ni]:p({},i,n,r)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var i=p({},this.ns(Ni)||{});t.forEach((t=>{delete i[t]})),this._instance.register({[Ni]:i}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this._instance.unregister(Ni),t&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var i=this.ns(Ui)||{};0!==Object.keys(i).length&&Object.keys(i).forEach((e=>{i[e]=p({},i[e],t[e]),delete t[e]})),this._instance.register({[Ui]:p({},i,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.ns(Ui)||{};this._instance.register({[Ui]:p({},e,{[t]:{}})})}else this._instance.unregister(Ui)}reset(){this.Jn=!1,this.Yn=!1,this.Kn=!1,this.Xn=!1,this.es=!1,this.$anon_distinct_id=void 0,this.vs(),this.Qn=!1}}},Xa={sessionRecording:class{get Se(){return this._instance.config}get Ur(){return this._instance.persistence}get started(){var t;return!(null==(t=this.gs)||!t.isStarted)}get status(){var t,e;return this.ys===ya||this.ys===ba?this.ys:null!==(t=null==(e=this.gs)?void 0:e.status)&&void 0!==t?t:this.ys}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.ys=_a,this.bs=void 0,this._instance=t,!this._instance.sessionManager)throw xa.error("started without valid sessionManager"),new Error(wa+" started without valid sessionManager. This is a bug.");if(this.Se.cookieless_mode===hr)throw new Error(wa+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _s(){var e,i=!(null==(e=this._instance.get_property(Ei))||!e.enabled),r=!this.Se.disable_session_recording,s=this.Se.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&r&&!s}startIfEnabledOrStop(t){var e;if(!this._s||null==(e=this.gs)||!e.isStarted){var i=!q(Object.assign)&&!q(Array.from);this._s&&i?(this.ws(t),xa.info("starting")):(this.ys=_a,this.stopRecording())}}ws(t){var e,i,r;this._s&&(this.ys!==ya&&this.ys!==ba&&(this.ys=ma),null!=h&&null!=(e=h.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=h.__PosthogExtensions__)&&i.initSessionRecording?this.xs(t):null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.ks,(e=>{if(e)return xa.error("could not load recorder",e);this.xs(t)})))}stopRecording(){var t,e;null==(t=this.bs)||t.call(this),this.bs=void 0,null==(e=this.gs)||e.stop()}Ss(){var t,e;null==(t=this.bs)||t.call(this),this.bs=void 0,null==(e=this.gs)||e.discard()}Cs(){var t,e;null==(t=this.Ur)||t.unregister(Ci),null==(e=this.Ur)||e.unregister(ki)}Is(t,e){if(J(t))return null;var i,r=K(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(xa.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Ts(t){if(this.Ur){var e,i,r=this.Ur,s=()=>{var e,i=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.Is(null==(e=this.Se.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),n=this.Is(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:n;J(o)&&this.Cs();var a=null==i?void 0:i.minimumDurationMilliseconds;r.register({[Ei]:p({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:p({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:q(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};s(),null==(e=this.bs)||e.call(this),this.bs=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.Ts(t),void this.Ss()):(this.Ts(t),void this.startIfEnabledOrStop()):(this.ys===ya&&(this.ys=ba,xa.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var i;void 0===e&&(e="log"),null!=(i=this.gs)&&i.log?this.gs.log(t,e):xa.warn("log called before recorder was ready")}get ks(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(Ei);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}Es(){var t,e,i=this._instance.get_property(Ei);if(!i)return!1;try{e="object"==typeof i?i:JSON.parse(i)}catch(t){return xa.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}xs(t){var e,i;if(null==(e=h.__PosthogExtensions__)||!e.initSessionRecording)return xa.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[ar]:!0});if(this.gs||(this.gs=null==(i=h.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.gs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Es()){if(this.ys===ba||this.ys===ya)return;return this.ys=ya,xa.info("persisted remote config is stale, requesting fresh config before starting"),void new $n(this._instance).load()}this.ys=ma,this.gs.start(t)}onRRwebEmit(t){var e;null==(e=this.gs)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.gs||null==(e=this.Ur)||e.register({[Pi]:!0}),null==(t=this.gs)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.gs||null==(e=this.Ur)||e.register({[$i]:!0}),null==(t=this.gs)||t.overrideSampling()}overrideTrigger(t){var e,i;this.gs||null==(i=this.Ur)||i.register({["url"===t?Ti:Ii]:!0}),null==(e=this.gs)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.gs)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.gs)||!i.tryAddCustomEvent(t,e))}}},Za={autocapture:class{constructor(t){this.Ms=!1,this.Ps=null,this.Rs=!1,this.instance=t,this.rageclicks=new aa(t.config.rageclick),this.Os=null}initialize(){this.startIfEnabled()}get Se(){var t,e,i=B(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}Ls(){if(this.isBrowserSupported()){if(t&&r){var e=e=>{e=e||(null==t?void 0:t.event);try{this.Fs(e)}catch(t){ua.error("Failed to capture event",t)}};if(Ir(r,"submit",e,{capture:!0}),Ir(r,"change",e,{capture:!0}),Ir(r,"click",e,{capture:!0}),this.Se.capture_copied_text){var i=e=>{e=e||(null==t?void 0:t.event);try{this.Fs(e,la)}catch(t){ua.error("Failed to capture copy/cut event",t)}};Ir(r,"copy",i,{capture:!0}),Ir(r,"cut",i,{capture:!0})}}}else ua.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Ms&&(this.Ls(),this.Ms=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Rs=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[pi]:!!t.autocapture_opt_out}),this.Ps=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Os=t}getElementSelectors(t){var e,i=[];return null==(e=this.Os)||e.forEach((e=>{var s=null==r?void 0:r.querySelectorAll(e);null==s||s.forEach((r=>{t===r&&i.push(e)}))})),i}get isEnabled(){var t,e,i=null==(t=this.instance.persistence)?void 0:t.props[pi];if(W(this.Ps)&&!Q(i)&&!this.instance.mr())return!1;var r=null!==(e=this.Ps)&&void 0!==e?e:!!i;return!!this.instance.config.autocapture&&!r}Fs(e,i){if(void 0===i&&(i="$autocapture"),this.isEnabled){var r,s=ls(e);es(s)&&(s=s.parentNode||null),"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&ms(s,this.instance.config.rageclick)&&this.Fs(e,"$rageclick");var n=i===la;if(s&&function(e,i,r,s,n){var o,a,l,u,h,d;if(void 0===r&&(r=void 0),!t||ys(e))return!1;if(null!=(o=r)&&o.url_allowlist&&!ss(r.url_allowlist))return!1;if(null!=(a=r)&&a.url_ignorelist&&ss(r.url_ignorelist))return!1;if(null!=(l=r)&&l.dom_event_allowlist){var v=r.dom_event_allowlist;if(v&&!v.some((t=>i.type===t)))return!1}var{parentIsUsefulElement:c,targetElementList:f}=bs(e,s);if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(q(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}(f,r))return!1;if(!hs(f,null==(u=r)?void 0:u.css_selector_allowlist))return!1;if(hs(f,null!==(h=null==(d=r)?void 0:d.css_selector_ignorelist)&&void 0!==h?h:vs))return!1;var p=t.getComputedStyle(e);if(p&&"pointer"===p.getPropertyValue("cursor")&&"click"===i.type)return!0;var g=e.tagName.toLowerCase();switch(g){case"html":return!1;case"form":return(n||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(i.type)>=0;default:return c?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(us.indexOf(g)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,this.Se,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=va(s,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Se.element_attribute_ignorelist,elementsChainAsString:this.Rs,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),i===la){var u,h=os(null==t||null==(u=t.getSelection())?void 0:u.toString()),d=e.type||"clipboard";if(!h)return!1;o.$selected_content=h,o.$copy_type=d}return this.instance.capture(i,o),!0}}}isBrowserSupported(){return U(null==r?void 0:r.querySelectorAll)}},historyAutocapture:class{constructor(e){var i;this._instance=e,this.As=(null==t||null==(i=t.location)?void 0:i.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(ai.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.$s&&this.$s(),this.$s=void 0,ai.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.Ds("pushState"),this.Ds("replaceState"),this.Ns())}Ds(e){var i;if(t&&(null==(i=t.history[e])||!i.__posthog_wrapped__)){var r=this;!function(t,e,i){try{if(!(e in t))return()=>{};var r=t[e],s=i(r);return U(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()=>{}}}(t.history,e,(t=>function(i,s,n){t.call(this,i,s,n),r.qs(e)}))}}qs(e){try{var i,r=null==t||null==(i=t.location)?void 0:i.pathname;if(!r)return;r!==this.As&&this.isEnabled&&this._instance.capture(gr,{navigation_type:e}),this.As=r}catch(t){ai.error("Error capturing "+e+" pageview",t)}}Ns(){if(!this.$s){var e=()=>{this.qs("popstate")};Ir(t,"popstate",e),this.$s=()=>{t&&t.removeEventListener("popstate",e)}}}},heatmaps:class{get Se(){return this.instance.config}constructor(t){var e;this.Bs=!1,this.Ms=!1,this.js=null,this.instance=t,this.Bs=!(null==(e=this.instance.persistence)||!e.props[gi]),this.rageclicks=new aa(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return B(this.Se.capture_heatmaps)&&this.Se.capture_heatmaps.flush_interval_milliseconds&&(t=this.Se.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return J(this.Se.capture_heatmaps)?J(this.Se.enable_heatmaps)?this.Bs:this.Se.enable_heatmaps:!1!==this.Se.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Ms)return;Sa.info("starting..."),this.Hs(),this.ke()}else{var t;clearInterval(null!==(t=this.js)&&void 0!==t?t:void 0),this.Us(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[gi]:e}),this.Bs=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}zs(t){this.fe(t.originalEvent,"deadclick")}ke(){this.js&&clearInterval(this.js),this.js=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(r)?setInterval(this.Or.bind(this),this.flushIntervalMilliseconds):null}Hs(){t&&r&&(this.Vs=this.Or.bind(this),Ir(t,pr,this.Vs),this.Ws=e=>this.fe(e||(null==t?void 0:t.event)),Ir(r,"click",this.Ws,{capture:!0}),this.Gs=e=>this.Zs(e||(null==t?void 0:t.event)),Ir(r,"mousemove",this.Gs,{capture:!0}),this.Qs=new Ls(this.instance,As,this.zs.bind(this)),this.Qs.startIfEnabledOrStop(),this.Js=this.ke.bind(this),Ir(r,fr,this.Js),this.Ms=!0)}Us(){var e;t&&r&&(this.Vs&&t.removeEventListener(pr,this.Vs),this.Ws&&r.removeEventListener("click",this.Ws,{capture:!0}),this.Gs&&r.removeEventListener("mousemove",this.Gs,{capture:!0}),this.Js&&r.removeEventListener(fr,this.Js),clearTimeout(this.Ys),null==(e=this.Qs)||e.stop(),this.Ms=!1)}Ks(e,i){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(e,i,r){for(var s=e;s&&Zr(s)&&!ts(s,"body");){if(s===r)return!1;if(O(i,null==t?void 0:t.getComputedStyle(s).position))return!0;s=ds(s)}return!1}(ls(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:r),target_fixed:o,type:i}}fe(t,e){var i;if(void 0===e&&(e="click"),!Xr(t.target)&&Ea(t)){var r=this.Ks(t,e);null!=(i=this.rageclicks)&&i.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&ms(ls(t),this.instance.config.rageclick)&&this.Xs(p({},r,{type:"rageclick"})),this.Xs(r)}}Zs(t){!Xr(t.target)&&Ea(t)&&(clearTimeout(this.Ys),this.Ys=setTimeout((()=>{this.Xs(this.Ks(t,"mousemove"))}),500))}Xs(e){if(t){var i=this.Se.disable_capture_url_hashes?pe(t.location.href):t.location.href,r=this.Se.custom_personal_data_properties,s=this.Se.mask_personal_data_properties?[...Xs,...r||[]]:[],n=Ks(i,s,tn);this.R=this.R||{},this.R[n]||(this.R[n]=[]),this.R[n].push(e)}}Or(){this.R&&!H(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ls,webVitalsAutocapture:class{constructor(t){var e;this.Bs=!1,this.Ms=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.eo=()=>{clearTimeout(this.ro),0!==this.R.metrics.length&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((t,e)=>p({},t,{["$web_vitals_"+e.name+"_event"]:p({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.io=t=>{var e;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var i=this.no();if(!q(i))if(J(null==t?void 0:t.name)||J(null==t?void 0:t.value))pa.error("Invalid metric received",t);else if(!this.so||this.so>t.value){this.R.url!==i&&(this.eo(),this.ro=setTimeout(this.eo,this.flushToCaptureTimeoutMs)),q(this.R.url)&&(this.R.url=i),this.R.firstMetricTimestamp=q(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0);var r=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0),s=p({},t,{$current_url:i,timestamp:Date.now()});q(r)||(s.$session_id=r.sessionId,s.$window_id=r.windowId),this.R.metrics.push(s),this.R.metrics.length===this.allowedMetrics.length&&this.eo()}else pa.error("Ignoring metric with value >= "+this.so,t)},this.oo=()=>{if(!this.Ms){var t,e,i,r,s=h.__PosthogExtensions__;q(s)||q(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:e,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),t&&e&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.io.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&e(this.io.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.io.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.io.bind(this)),this.Ms=!0):pa.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Bs=!(null==(e=this._instance.persistence)||!e.props[bi]),this.startIfEnabled()}get ao(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=B(this.ao)?null==(t=this.ao)?void 0:t.web_vitals_allowed_metrics:void 0;return J(i)?(null==(e=this._instance.persistence)?void 0:e.props[Si])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(B(this.ao)?this.ao.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=B(this.ao)?this.ao.web_vitals_attribution:void 0;return null!=t&&t}get so(){var t=B(this.ao)&&K(this.ao.__web_vitals_max_value)?this.ao.__web_vitals_max_value:ga;return t>0&&6e4>=t?ga:t}get isEnabled(){var t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return pa.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=B(this.ao)?this.ao.web_vitals:Q(this.ao)?this.ao:void 0;return Q(e)?e:this.Bs}startIfEnabled(){this.isEnabled&&!this.Ms&&(pa.info("enabled, starting..."),this.Mt(this.oo))}onRemoteConfig(t){if("capturePerformance"in t){var e=B(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=B(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[bi]:e}),this._instance.persistence.register({[Si]:i})),this.Bs=e,this.startIfEnabled()}}Mt(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.postHogWebVitalsCallbacks?t():null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(e=>{e?pa.error("failed to load script",e):t()}))}no(){var e=t?this._instance.config.disable_capture_url_hashes?pe(t.location.href):t.location.href:void 0;if(e){var i=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Xs,...i||[]]:[];return Ks(e,r,tn)}pa.error("Could not determine current URL")}}},tl={exceptionObserver:class{constructor(e){var i,r,s;this.oo=()=>{var e;if(t&&this.isEnabled&&null!=(e=h.__PosthogExtensions__)&&e.errorWrappingFunctions){var i=h.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=h.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=h.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.lo&&this.Se.capture_unhandled_errors&&(this.lo=i(this.captureException.bind(this))),!this.uo&&this.Se.capture_unhandled_rejections&&(this.uo=r(this.captureException.bind(this))),!this.ho&&this.Se.capture_console_errors&&(this.ho=s(this.captureException.bind(this)))}catch(t){ca.error("failed to start",t),this.do()}}},this._instance=e,this.co=!(null==(i=this._instance.persistence)||!i.props[_i]),this.vo=new lt({refillRate:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==r?r:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,Ae:ca}),this.Se=this.fo(),this.startIfEnabledOrStop()}fo(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return B(t)?e=p({},e,t):(q(t)?this.co:t)&&(e=p({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Se.capture_console_errors||this.Se.capture_unhandled_errors||this.Se.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ca.info("enabled"),this.do(),this.Mt(this.oo)):this.do()}Mt(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.errorWrappingFunctions?t():null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return ca.error("failed to load script",e);t()}))}do(){var t,e,i;null==(t=this.lo)||t.call(this),this.lo=void 0,null==(e=this.uo)||e.call(this),this.uo=void 0,null==(i=this.ho)||i.call(this),this.ho=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.co=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[_i]:this.co}),this.Se=this.fo(),this.startIfEnabledOrStop())}onConfigChange(){this.Se=this.fo()}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.vo.consumeRateLimit(s)?ca.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,i;this.po=[],this.mo=new Re([new Be,new Xe,new qe,new He,new Ye,new Ke,new Ve,new Qe],function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];return function(e,r){void 0===r&&(r=0);for(var s=[],n=e.split("\n"),o=r;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=Ue.test(a)?a.replace(Ue,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of i){var h=u(l,t);if(h){s.push(h);break}}if(s.length>=50)break}}}return function(t){if(!t.length)return[];var e=Array.from(t);return e.reverse(),e.slice(0,50).map((t=>{return p({},t,{filename:t.filename||(i=e,i[i.length-1]||{}).filename,function:t.function||Ce});var i}))}(s)}}("web:javascript",Le,Ne)),this._instance=t,this.po=null!==(e=null==(i=this._instance.persistence)?void 0:i.get_property(mi))&&void 0!==e?e:[],this.yo=ri(this.bo()),this._o=new si(this.yo)}onConfigChange(){this.yo=ri(this.bo()),this._o.setConfig(this.yo)}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.po=s,this._instance.persistence&&this._instance.persistence.register({[mi]:this.po,[yi]:n})}}get wo(){var t,e=!!this._instance.get_property(yi),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.mo.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.yo.enabled)try{if(!G(t)||0===t.trim().length)return void qa.warn("Ignoring exception step because message must be a non-empty string");var i=this.xo(e),{sanitizedProperties:r,droppedKeys:s}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>ei.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(i);s.length>0&&qa.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._o.add(p({[Ze]:t,[ti]:(new Date).toISOString()},r))}catch(t){qa.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.ko(e)){if(this.So(e))return this.Co("Exception dropped: matched a suppression rule"),void qa.info("Skipping exception capture because a suppression rule matched");if(!this.wo&&this.Io(e))return this.Co("Exception dropped: thrown by a browser extension"),void qa.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.To(e))return this.Co("Exception dropped: thrown by the PostHog SDK"),void qa.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.yo.enabled&&J(t.$exception_steps)?this.Eo(t):t;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Gi:!0});return r&&this._o.clear(),r}catch(t){return qa.error("Failed to capture exception event. Dropping this exception.",t),void this._o.clear()}}catch(t){return void qa.error("Failed to process exception event. Ignoring this exception.",t)}}Eo(t){try{var e=this._o.getAttachable();return 0===e.length?t:p({},t,{$exception_steps:e})}catch(e){return qa.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Co(t){this.yo.enabled&&this._o.add({[Ze]:t,[ti]:(new Date).toISOString()})}xo(t){return B(t)?p({},t):{}}bo(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}So(t){if(0===t.length)return!1;var e=t.reduce(((t,e)=>{var{type:i,value:r}=e;return G(i)&&i.length>0&&t.$exception_types.push(i),G(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.po.some((t=>{var i=t.values.map((t=>{var i,r=Fo[t.operator],s=N(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)}))}Io(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://")))}To(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}ko(t){return!J(t)&&N(t)}}},el=p({productTours:class{get Ur(){return this._instance.persistence}constructor(t){this.Mo=null,this.Po=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if("productTours"in t){var e,i;if(this.Ur&&this.Ur.register({[xi]:!!t.productTours}),!$a(this._instance))return!this.Mo&&J(null==(e=this.Ur)?void 0:e.props[Gi])||ka.info("product tours disabled; stopping and clearing cached tours"),null==(i=this.Mo)||i.stop(),this.Mo=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Mo&&$a(this._instance)&&this.Mt((()=>this.Ro()))}Mt(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?ka.error("Could not load product tours script",e):t()}))}Ro(){var t;!this.Mo&&null!=(t=h.__PosthogExtensions__)&&t.generateProductTours&&(this.Mo=h.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!N(this.Po)||e){var i=this.Ur;if(i){var r=i.props[Gi];if(N(r)&&!e)return this.Po=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($a(this._instance)){var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return ka.error(s),void t([],{isLoaded:!1,error:s})}var n=N(e.json.product_tours)?e.json.product_tours:[];this.Po=n,i&&i.register({[Gi]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Po,{isLoaded:!0})}getActiveProductTours(t){J(this.Mo)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Mo.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.Mo)||e.showTourById(t)}previewTour(t){this.Mo?this.Mo.previewTour(t):this.Mt((()=>{var e;this.Ro(),null==(e=this.Mo)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Mo)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Mo)||t.nextStep()}previousStep(){var t;null==(t=this.Mo)||t.previousStep()}clearCache(){var t;this.Po=null,null==(t=this.Ur)||t.unregister(Gi)}resetTour(t){var e;null==(e=this.Mo)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.Mo)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.Mo)||e.cancelPendingTour(t)}}},Qa),il={siteApps:class{constructor(t){this.Oo=0,this._instance=t,this.Lo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Fo(t,e){if(e){var i=this.globalsForEvent(e);this.Lo.push(i),this.Lo.length>1e3&&(this.Lo=this.Lo.slice(10))}}get siteAppLoaders(){var t;return null==(t=h._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Fo.bind(this));this.Ao=()=>{t(),this.Lo=[],this.Ao=void 0}}}globalsForEvent(t){var e,i,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[d,v]of Object.entries(h))l[d]={id:u[d],type:d,properties:v};var{$set_once:c,$set:f}=t;return{event:p({},g(t,Pa),{properties:p({},t.properties,f?{$set:p({},null!==(e=null==(i=t.properties)?void 0:i.$set)&&void 0!==e?e:{},f)}:{},c?{$set_once:p({},null!==(r=null==(s=t.properties)?void 0:s.$set_once)&&void 0!==r?r:{},c)}:{}),elements_chain:null!==(n=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=t.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}$o(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)||(Ta.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)||(Ta.error("prepare_external_dependency_script returned null"),null):t}Do(){var t,e,i,s,n,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var u=null==r?void 0:r.defaultView,h=null==u||null==(t=u.Node)?void 0:t.prototype;if(!u||!h)return()=>{};if(this.Oo++,this.No)return this.qo();var d=[],v=this,c=new WeakSet,f=(t,e,i)=>{if(null!=t&&t[e]){var r=t[e];t[e]=i(r),d.push((()=>{t[e]=r}))}},p=t=>{if(c.has(t))return t;var e=v.$o(t);return e&&c.add(e),e},g=t=>t.map((t=>"string"==typeof t?t:p(t))).filter((t=>!W(t)));return f(h,"appendChild",(t=>function(e){var i=p(e);return i?t.call(this,i):e})),f(h,"insertBefore",(t=>function(e,i){var r=p(e);return r?t.call(this,r,i):e})),f(h,"replaceChild",(t=>function(e,i){var r=p(e);return r?t.call(this,r,i):i})),[null==(e=u.Element)?void 0:e.prototype,null==(i=u.Document)?void 0:i.prototype,null==(s=u.DocumentFragment)?void 0:s.prototype].forEach((t=>{f(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,g(i))})),f(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,g(i))}))})),[null==(n=u.Element)?void 0:n.prototype,null==(o=u.CharacterData)?void 0:o.prototype,null==(a=u.DocumentType)?void 0:a.prototype].forEach((t=>{f(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,g(i))})),f(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,g(i))})),f(t,"replaceWith",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];var s=g(i);return i.length&&!s.length?void 0:t.apply(this,s)}))})),f(null==(l=u.Element)?void 0:l.prototype,"insertAdjacentElement",(t=>function(e,i){var r=p(i);return r?t.call(this,e,r):null})),this.No=()=>{d.forEach((t=>t())),this.No=void 0},this.qo()}qo(){var t=!1;return()=>{var e;t||(t=!0,this.Oo--,0===this.Oo&&(null==(e=this.No)||e.call(this)))}}Bo(t,e){void 0===e&&(e=!0);var i=this.Do();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.Lo.length&&(Ta.info("Processing "+this.Lo.length+" events for site app with id "+t.id),this.Lo.forEach((t=>this.Bo((()=>null==e.processEvent?void 0:e.processEvent(t))))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this.Ao)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,Ta.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=this.Bo((e=>t.init({posthog:this._instance,callback(t){e(),s(t)}})),!1);n&&(e.processEvent=n),r=!0}catch(e){Ta.error(Ia+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){Ta.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}jo(){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)}Ho(t){var e=this;if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t),r=function(r){try{e.Bo((()=>null==r.processEvent?void 0:r.processEvent(i)))}catch(e){Ta.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.jo(),void this._instance.on("eventCaptured",(t=>this.Ho(t)))):void Ta.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Ao)||i.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var e;h["__$$ph_site_app_"+t]=s._instance,null==(e=h.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(s._instance,a,(e=>{if(e)return Ta.error(Ia+t,e)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else Ta.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},rl={tracingHeaders:class{constructor(t){this.Uo=void 0,this.zo=void 0,this.Vo=void 0,this.oo=()=>{var t,e,i=this.Wo();i?(q(this.Uo)&&(this.Uo=null==(t=h.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),q(this.zo)&&(this.zo=null==(e=h.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.do()},this._instance=t}initialize(){this.startIfEnabledOrStop()}Mt(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.tracingHeadersPatchFns?t():null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return fa.error("failed to load script",e);t()}))}Go(){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}Wo(){var t=this.Go();return N(t)?(N(this.Vo)?this.Vo.splice(0,this.Vo.length,...t):this.Vo=[...t],t.length>0?this.Vo:void 0):(N(this.Vo)&&this.Vo.splice(0),this.Vo=t||void 0,this.Vo)}do(){var t,e;null==(t=this.Uo)||t.call(this),null==(e=this.zo)||e.call(this),this.Uo=void 0,this.zo=void 0}startIfEnabledOrStop(){this.Wo()?this.Mt(this.oo):this.do()}}},sl=p({surveys:class{get Se(){return this._instance.config}constructor(t){this.Zo=void 0,this._surveyManager=null,this.Qo=!1,this.Jo=[],this.Yo=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Se.disable_surveys){var e=t.surveys;if(J(e))return zo.warn("Flags not loaded yet. Not loading surveys.");var i=N(e);this.Zo=i?e.length>0:e,zo.info("flags response received, isSurveysEnabled: "+this.Zo),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(No)||null!=r&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this._surveyManager)if(this.Qo)zo.info("Already initializing surveys, skipping...");else if(this.Se.disable_surveys)zo.info(Aa);else if(this.Se.cookieless_mode&&this._instance.consent.isOptedOut())zo.info("Not loading surveys in cookieless mode without consent.");else{var t=null==h?void 0:h.__PosthogExtensions__;if(t){if(!q(this.Zo)||this.Se.advanced_enable_surveys){var e=this.Zo||this.Se.advanced_enable_surveys;this.Qo=!0;try{var i=t.generateSurveys;if(i)return void this.Ko(i,e);var r=t.loadExternalDependency;if(!r)return void this.Xo(lr);r(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.Xo("Could not load surveys script",i):this.Ko(t.generateSurveys,e)}))}catch(t){throw this.Xo("Error initializing surveys",t),t}finally{this.Qo=!1}}}else zo.error("PostHog Extensions not found.")}}Ko(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new Ma(this._instance),zo.info("Surveys loaded successfully"),this.ea({isLoaded:!0})}Xo(t,e){zo.error(t,e),this.ea({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Jo.push(t),this._surveyManager&&this.ea({isLoaded:!0}),()=>{this.Jo=this.Jo.filter((e=>e!==t))}}getSurveys(t,e){if(void 0===e&&(e=!1),this.Se.disable_surveys)return zo.info(Aa),t([]);var i,r=this._instance.get_property(Bi);if(r&&!e)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.Yo?this.Yo.then((e=>{var{surveys:i,context:r}=e;return t(i,r)})):("undefined"!=typeof Promise&&(this.Yo=new Promise((t=>{i=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Se.token),method:"GET",timeout:this.Se.surveys_request_timeout_ms,callback:e=>{var r;this.Yo=null;var s=e.statusCode;if(200!==s||!e.json){var n="Surveys API could not be loaded, status: "+s;zo.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({[Bi]:l,[Hi]:Date.now()});var h={isLoaded:!0};t(l,h),null==i||i({surveys:l,context:h})}}))}ea(t){for(var e of this.Jo)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){zo.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!J(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);zo.warn("init was not called")}ta(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}ra(t){if(J(this._surveyManager))return{eligible:!1,reason:Oa};var e="string"==typeof t?this.ta(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(J(this._surveyManager))return zo.warn("init was not called"),{visible:!1,disabledReason:Oa};var e=this.ra(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return J(this._surveyManager)?(zo.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Oa})):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.ra(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var s;if(J(this._surveyManager))zo.warn("init was not called");else{var n="string"==typeof t?this.ta(t):t;if(null!=n&&n.id)if(Uo.includes(n.type)){var o=null==r?void 0:r.querySelector(e);if(o)return null!=(s=n.appearance)&&s.surveyPopupDelaySeconds?(zo.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,e;zo.info("Rendering survey "+n.id+" with delay of "+(null==(t=n.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(e=this._surveyManager)||e.renderSurvey(n,o,i),zo.info("Survey "+n.id+" rendered")}),1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,o,i);zo.warn("Survey element not found")}else zo.warn("Surveys of type "+n.type+" cannot be rendered in the app");else zo.warn("Survey not found")}}displaySurvey(t,e){var i;if(J(this._surveyManager))zo.warn("init was not called");else{var r=this.ta(t);if(r){var s=r;if(null!=(i=r.appearance)&&i.surveyPopupDelaySeconds&&e.ignoreDelay&&(s=p({},r,{appearance:p({},r.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==xn&&e.initialResponses&&zo.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void zo.warn("Survey is not eligible to be displayed: ",n.disabledReason)}"inline"!==e.displayType?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}else zo.warn("Survey not found")}}cancelPendingSurvey(t){J(this._surveyManager)?zo.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},Qa),nl={toolbar:class{constructor(t){this.instance=t}ia(t){h.ph_toolbar_state=t}na(){var t;return null!==(t=h.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,i,s){if(void 0===e&&(e=void 0),void 0===i&&(i=void 0),void 0===s&&(s=void 0),Rr(this.instance.config))return!1;if(!t||!r)return!1;e=null!=e?e:t.location,s=null!=s?s:t.history;try{if(!i){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}i=null==t?void 0:t.localStorage}var n,o=Da||Ys(e.hash,"__posthog")||Ys(e.hash,"state"),a=o?Er((()=>JSON.parse(atob(decodeURIComponent(o)))))||Er((()=>JSON.parse(decodeURIComponent(o)))):null;return a&&"ph_authorize"===a.action?((n=a).source="url",n&&Object.keys(n).length>0&&(a.desiredHash?e.hash=a.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):((n=JSON.parse(i.getItem(La)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(t){return!1}}sa(t){var e=h.ph_load_toolbar||h.ph_load_editor;!J(e)&&U(e)?e(t,this.instance):ja.warn("No toolbar load function found")}loadToolbar(e){var i=!(null==r||!r.getElementById(rr));if(!t||i)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=p({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(La,JSON.stringify(p({},n,{source:void 0}))),2===this.na())this.sa(n);else if(0===this.na()){var o;this.ia(1),null==(o=h.__PosthogExtensions__)||null==o.loadExternalDependency||o.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return ja.error("[Toolbar] Failed to load",t),void this.ia(0);this.ia(2),this.sa(n)})),Ir(t,"turbolinks:load",(()=>{this.ia(0),this.loadToolbar(n)}))}return!0}oa(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)}}},ol=p({experiments:Wa},Qa),al=p({},Qa,Xa,Za,tl,el,il,sl,rl,nl,ol,{conversations:class{constructor(t){this.aa=void 0,this._conversationsManager=null,this.la=!1,this.ua=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;J(e)||(Q(e)?this.aa=e:(this.aa=e.enabled,this.ua=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.aa=void 0,this.ua=null}loadIfEnabled(){if(!(this._conversationsManager||this.la||this._instance.config.disable_conversations||Rr(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==h?void 0:h.__PosthogExtensions__;if(t&&!q(this.aa)&&this.aa)if(this.ua&&this.ua.token){this.la=!0;try{var e=t.initConversations;if(e)return this.ha(e),void(this.la=!1);var i=t.loadExternalDependency;if(!i)return void this.da(lr);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.da("Could not load conversations script",e):this.ha(t.initConversations),this.la=!1}))}catch(t){this.da("Error initializing conversations",t),this.la=!1}}else Ja.error("Conversations enabled but missing token in remote config.")}}ha(t){if(this.ua)try{this._conversationsManager=t(this.ua,this._instance),Ja.info("Conversations loaded successfully")}catch(t){this.da("Error completing conversations initialization",t)}else Ja.error("Cannot complete initialization: remote config is null")}da(t,e){Ja.error(t,e),this._conversationsManager=null,this.la=!1}show(){this._conversationsManager?this._conversationsManager.show():Ja.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.aa&&!W(this._conversationsManager)}isVisible(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,e,i){var r=this;return f((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,e,i):(Ja.warn(Ka),null)}))()}getMessages(t,e){var i=this;return f((function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(Ja.warn(Ka),null)}))()}markAsRead(t){var e=this;return f((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Ja.warn(Ka),null)}))()}getTickets(t){var e=this;return f((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Ja.warn(Ka),null)}))()}requestRestoreLink(t){var e=this;return f((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Ja.warn(Ka),null)}))()}restoreFromToken(t){var e=this;return f((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Ja.warn(Ka),null)}))()}restoreFromUrlToken(){var t=this;return f((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Ja.warn(Ka),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}Xi(){var t;null==(t=this._conversationsManager)||t.setIdentity()}en(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},{logs:class{constructor(e){var i;this.ca=!1,this.va=!1,this.Ae=li("[logs]"),this._r=[],this.fa=[],this.pa=()=>{var t,e;null==(t=this.ga)||t.onReconnect(),null==(e=this.ma)||e.onReconnect()},this._instance=e,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.ca=!0),t&&Ir(t,"online",this.pa)}ya(t,e,i,r){var s,n=function(t,e){var i,r,s,n,o,a,l,u=null!==(i=null==t?void 0:t.flushIntervalMs)&&void 0!==i?i:3e3,h=null!==(r=null==t?void 0:t.maxBufferSize)&&void 0!==r?r:100,d=null!=e&&e.consoleCapture?void 0:null!==(s=null==t?void 0:t.maxLogsPerInterval)&&void 0!==s?s:1e3,v=q(d)?Math.max(h,2048):Math.max(h,d),c=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(n=null!==(o=null==c?void 0:c["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==n?n:null==e?void 0:e.serviceNameDefault,serviceVersion:null!==(a=null==c?void 0:c["service.version"])&&void 0!==a?a:null==t?void 0:t.serviceVersion,environment:null!==(l=null==c?void 0:c["deployment.environment"])&&void 0!==l?l:null==t?void 0:t.environment,resourceAttributes:c,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:h,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,i);return[new ke(this.ba(t,e),n,this.Ae,(()=>this._a()),(t=>t()),void 0,r),n]}wa(){var t,e,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;return this.ga&&this.xa===i||(null==(e=this.ga)||e.reset(),this.xa=i,[this.ga,this.ka]=this.ya((()=>this._r),(t=>{this._r=t}))),this.ga}Sa(){var t,e,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;return this.ma&&this.Ca===i||(null==(e=this.ma)||e.reset(),this.Ca=i,[this.ma,this.Ia]=this.ya((()=>this.fa),(t=>{this.fa=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Ya)),this.ma}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,i=null==(e=t.logs)?void 0:e.captureConsoleLogs;!J(i)&&i&&(this.ca=!0,this.loadIfEnabled())}reset(){var t,e;this._r=[],null==(t=this.ga)||t.reset(),this.fa=[],null==(e=this.ma)||e.reset()}captureLog(t){this.wa().captureLog(t)}le(t){this.Sa().captureLog(t)}get logger(){return this.Ta||(this.Ta={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.Ta}flushLogs(t){t?this.Ea(t):(this.ga&&this.ga.flush().catch((t=>this.Ae.error("PostHog logs flush failed:",t))),this.ma&&this.ma.flush().catch((t=>this.Ae.error("PostHog logs flush failed:",t))))}loadIfEnabled(){if(this.ca&&!this.va){var t=null==h?void 0:h.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(e=>{var i;e||null==(i=t.logs)||!i.initializeLogs?this.Ae.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.va=!0)})):this.Ae.error(lr)}else this.Ae.error("PostHog Extensions not found.")}}ba(t,e){var i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:e=>e===w.LogsQueue?t():void 0,setPersistedProperty(t,i){var r;t===w.LogsQueue&&e(null!==(r=i)&&void 0!==r?r:[])},ht:t=>this.ht(t),getLibraryId:()=>v.LIB_NAME,getLibraryVersion:()=>v.LIB_VERSION}}ht(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.Ma(),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)})}}})}))}Ea(t){this._r.length>0&&this.Pa(t,this._r,this.ka,v.LIB_NAME,(t=>{this._r=t})),this.fa.length>0&&this.Pa(t,this.fa,this.Ia,Ya,(t=>{this.fa=t}))}Pa(t,e,i,r,s){if(0!==e.length){var n=e.map((t=>t.record));s([]);var o=Ee(n,Se(i,v.LIB_NAME,v.LIB_VERSION),r,v.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Ma(),data:o,compression:"best-available",batchKey:"logs",transport:t})}}Ma(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}_a(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i,windowId:r,sessionStartTimestamp:s,lastActivityTimestamp:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=i,e.windowId=r,J(s)||(e.sessionStartTimestamp=s),J(n)||(e.lastActivityTimestamp=n)}if(null!=h&&null!=(t=h.location)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?pe(h.location.href):h.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}});oa.__defaultExtensionClasses=p({},al),function(){v.SDK_DIST_CHANNEL="cdn";var e=Wo[ta]=new oa,i=h.posthog;i&&wr(i._i,(function(t){if(t&&N(t)){var r=e.init(t[0],t[1],t[2]),s=i[t[2]]||i;r&&(r._execute_array.call(r.people,s.people),r._execute_array(s))}})),h.posthog=e,function(){function e(){e.done||(e.done=!0,ea=!1,wr(Wo,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?e():Ir(r,"DOMContentLoaded",e,{capture:!1}):t&&ai.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}()}();
|
|
1
|
+
!function(){"use strict";var t="undefined"!=typeof window?window:void 0,e="undefined"!=typeof globalThis?globalThis:t;"undefined"==typeof self&&(e.self=e),"undefined"==typeof File&&(e.File=function(){});var i=null==e?void 0:e.navigator,r=null==e?void 0:e.document,s=null==e?void 0:e.location,n=null==e?void 0:e.fetch,o=null!=e&&e.XMLHttpRequest&&"withCredentials"in new e.XMLHttpRequest?e.XMLHttpRequest:void 0,a=null==e?void 0:e.AbortController,l=null==e?void 0:e.CompressionStream,u=null==i?void 0:i.userAgent,h=null!=t?t:{},d="1.393.5",v={DEBUG:!1,LIB_VERSION:d,LIB_NAME:"web",JS_SDK_VERSION:d};function c(t,e,i,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void i(t)}a.done?e(l):Promise.resolve(l).then(r,s)}function f(t){return function(){var e=this,i=arguments;return new Promise((function(r,s){var n=t.apply(e,i);function o(t){c(n,r,s,o,a,"next",t)}function a(t){c(n,r,s,o,a,"throw",t)}o(void 0)}))}}function p(){return p=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},p.apply(null,arguments)}function g(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 _=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(e){return t}};function m(t){return"string"==typeof t||t}function y(t){return"string"==typeof t?t:void 0}var b,w=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.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",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}({}),x=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),S=["$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"],E=["token"],k="NativeGzipValidationError",P=t=>t.length>=2&&31===t[0]&&139===t[1],T=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),I=t=>{var e=new Error("Native gzip produced invalid output: "+t);throw e.name=k,e},R=function(){var t=f((function*(t,e){18>t.size&&I("too-short");var i=new Uint8Array(yield t.slice(0,10).arrayBuffer());P(i)&&8===i[2]||I("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var e=(()=>{if(b)return b;b=[];for(var t=0;256>t;t++){for(var e=t,i=0;8>i;i++)e=1&e?3988292384^e>>>1:e>>>1;b[t]=e>>>0}return b})(),i=4294967295,r=0;t.length>r;r++)i=e[255&(i^t[r])]^i>>>8;return(4294967295^i)>>>0})(e)&&I("invalid-crc");var s=e.length>>>0;r.getUint32(4,!0)!==s&&I("invalid-size")}));return function(e,i){return t.apply(this,arguments)}}();function C(){return C=f((function*(t,e,i){void 0===e&&(e=!0);try{var r=(new TextEncoder).encode(t),s=new CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(r).then((()=>n.close())).catch(function(){var t=f((function*(t){try{yield n.abort(t)}catch(t){}throw t}));return function(e){return t.apply(this,arguments)}}()),a=new Response(s.readable).blob(),[l]=yield Promise.all([a,o]);return yield R(l,r),l}catch(t){if(null!=i&&i.rethrow)throw t;return e&&console.error("Failed to gzip compress data",t),null}})),C.apply(this,arguments)}var F=["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"],M=function(t,e){if(void 0===e&&(e=[]),!t)return!1;var i=t.toLowerCase();return F.concat(e).some((t=>{var e=t.toLowerCase();return-1!==i.indexOf(e)}))};function O(t,e){return-1!==t.indexOf(e)}var A=function(t){return t.trim()},D=function(t){return t.replace(/^\$/,"")},L=Object.prototype,j=L.hasOwnProperty,z=L.toString,N=Array.isArray||function(t){return"[object Array]"===z.call(t)},U=t=>"function"==typeof t,B=t=>t===Object(t)&&!N(t),H=t=>{if(B(t)){for(var e in t)if(j.call(t,e))return!1;return!0}return!1},q=t=>void 0===t,G=t=>"[object String]"==z.call(t),V=t=>G(t)&&0===t.trim().length,W=t=>null===t,J=t=>q(t)||W(t),K=t=>"[object Number]"==z.call(t)&&t==t,Y=t=>K(t)&&t>0,Q=t=>"[object Boolean]"===z.call(t),X=t=>t instanceof FormData,Z=t=>O(S,t),tt=t=>O(E,t);function et(t){return null===t||"object"!=typeof t}function it(t,e){return{}.toString.call(t)==="[object "+e+"]"}function rt(t){return"undefined"!=typeof Event&&function(t,e){try{return t instanceof e}catch(t){return!1}}(t,Event)}var st=[!0,"true",1,"1","yes"],nt=t=>O(st,t),ot=[!1,"false",0,"0","no"];function at(t,e,i,r,s){return e>i&&(r.warn("min cannot be greater than max."),e=i),K(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),at(s||i,e,i,r))}class lt{constructor(t){this.Ee={},this.Pe=t.Pe,this.Fe=at(t.bucketSize,0,100,t.Ae),this.$e=at(t.refillRate,0,this.Fe,t.Ae),this.De=at(t.refillInterval,0,864e5,t.Ae)}Ne(t,e){var i=Math.floor((e-t.lastAccess)/this.De);i>0&&(t.tokens=Math.min(t.tokens+i*this.$e,this.Fe),t.lastAccess=t.lastAccess+i*this.De)}consumeRateLimit(t){var e,i=Date.now(),r=String(t),s=this.Ee[r];return s?this.Ne(s,i):this.Ee[r]=s={tokens:this.Fe,lastAccess:i},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(e=this.Pe)||e.call(this,t)),0===s.tokens)}stop(){this.Ee={}}}var ut="Mobile",ht="iOS",dt="Android",vt="Tablet",ct=dt+" "+vt,ft="iPad",pt="Apple",gt=pt+" Watch",_t="Safari",mt="BlackBerry",yt="Samsung",bt=yt+"Browser",wt=yt+" Internet",xt="Chrome",St=xt+" OS",Et=xt+" "+ht,kt="Internet Explorer",$t=kt+" "+ut,Pt="Opera",Tt=Pt+" Mini",It="Edge",Rt="Microsoft "+It,Ct="Firefox",Ft=Ct+" "+ht,Mt="Nintendo",Ot="PlayStation",At="Xbox",Dt=dt+" "+ut,Lt=ut+" "+_t,jt="Windows",zt=jt+" Phone",Nt="Nokia",Ut="Ouya",Bt="Generic",Ht=Bt+" "+ut.toLowerCase(),qt=Bt+" "+vt.toLowerCase(),Gt="Konqueror",Vt="Oculus Browser",Wt="Vivaldi",Jt="Yandex",Kt="Whale",Yt="DuckDuckGo",Qt="Pale Moon",Xt="Waterfox",Zt="Brave",te="Google Search App",ee="(\\d+(\\.\\d+)?)",ie=new RegExp("Version/"+ee),re=new RegExp(At,"i"),se=new RegExp(Ot+" \\w+","i"),ne=new RegExp(Mt+" \\w+","i"),oe=new RegExp(mt+"|PlayBook|BB10","i"),ae={"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"},le=function(t,e,i,r){e=e||"";var s=function(t){return null!=t&&t.brave?Zt:null}(i);return s||(null!=r&&r.detectGoogleSearchApp&&O(t,"GSA/")?te:O(t," OPR/")&&O(t,"Mini")?Tt:O(t," OPR/")?Pt:oe.test(t)?mt:O(t,"IE"+ut)||O(t,"WPDesktop")?$t:O(t,"OculusBrowser")?Vt:O(t,bt)?wt:O(t,It)||O(t,"Edg/")?Rt:O(t,Wt+"/")?Wt:O(t,"YaBrowser/")?Jt:O(t,Kt+"/")?Kt:O(t,Yt+"/")||O(t,"Ddg/")?Yt:O(t,"FBIOS")?"Facebook "+ut:O(t,"UCWEB")||O(t,"UCBrowser")?"UC Browser":O(t,"CriOS")?Et:O(t,"CrMo")||O(t,xt)?xt:O(t,dt)&&O(t,_t)?Dt:O(t,"FxiOS")?Ft:O(t.toLowerCase(),Gt.toLowerCase())?Gt:O(t,Zt+"/")?Zt:((t,e)=>e&&O(e,pt)||function(t){return O(t,_t)&&!O(t,xt)&&!O(t,dt)}(t))(t,e)?O(t,ut)?Lt:_t:O(t,"PaleMoon/")?Qt:O(t,Xt+"/")?Xt:O(t,Ct)?Ct:O(t,"MSIE")||O(t,"Trident/")?kt:O(t,"Gecko")?Ct:"")},ue={[$t]:[new RegExp("rv:"+ee)],[Rt]:[new RegExp(It+"?\\/"+ee)],[xt]:[new RegExp("("+xt+"|CrMo)\\/"+ee)],[Et]:[new RegExp("CriOS\\/"+ee)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+ee)],[_t]:[ie],[Lt]:[ie],[Pt]:[new RegExp("(Opera|OPR)\\/"+ee)],[Ct]:[new RegExp(Ct+"\\/"+ee)],[Ft]:[new RegExp("FxiOS\\/"+ee)],[Gt]:[new RegExp("Konqueror[:/]?"+ee,"i")],[mt]:[new RegExp(mt+" "+ee),ie],[Dt]:[new RegExp("android\\s"+ee,"i")],[wt]:[new RegExp(bt+"\\/"+ee)],[Vt]:[new RegExp("OculusBrowser\\/"+ee)],[Wt]:[new RegExp(Wt+"\\/"+ee)],[Jt]:[new RegExp("YaBrowser\\/"+ee)],[Kt]:[new RegExp(Kt+"\\/"+ee)],[Zt]:[new RegExp(Zt+"\\/"+ee)],[Yt]:[new RegExp("(DuckDuckGo|Ddg)\\/"+ee)],[Qt]:[new RegExp("PaleMoon\\/"+ee)],[Xt]:[new RegExp(Xt+"\\/"+ee)],[te]:[new RegExp("GSA\\/"+ee)],[kt]:[new RegExp("(rv:|MSIE )"+ee)],Mozilla:[new RegExp("rv:"+ee)]},he=function(t,e,i,r){var s=le(t,e,i,r),n=ue[s];if(q(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},de=[[new RegExp(At+"; "+At+" (.*?)[);]","i"),t=>[At,t&&t[1]||""]],[new RegExp(Mt,"i"),[Mt,""]],[new RegExp(Ot,"i"),[Ot,""]],[oe,[mt,""]],[new RegExp(jt,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[zt,""];if(new RegExp(ut).test(e)&&!/IEMobile\b/.test(e))return[jt+" "+ut,""];var i=/Windows NT ([0-9.]+)/i.exec(e);if(i&&i[1]){var r=ae[i[1]]||"";return/arm/i.test(e)&&(r="RT"),[jt,r]}return[jt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[ht,[t[3],t[4],t[5]||"0"].join(".")]:[ht,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=q(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+dt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+dt+")","i"),t=>t&&t[2]?[dt,[t[2],t[3],t[4]||"0"].join(".")]:[dt,""]],[/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/,[St,""]],[/Linux|debian/i,["Linux",""]]],ve=function(t){return ne.test(t)?Mt:se.test(t)?Ot:re.test(t)?At:new RegExp(Ut,"i").test(t)?Ut:new RegExp("("+zt+"|WPDesktop)","i").test(t)?zt:/iPad/.test(t)?ft:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?gt:oe.test(t)?mt:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Nt,"i").test(t)?Nt:/(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(ut).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)?dt:ct:new RegExp("(pda|"+ut+")","i").test(t)?Ht:new RegExp(vt,"i").test(t)&&!new RegExp(vt+" pc","i").test(t)?qt:""},ce=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function fe(t,e){return"string"==typeof(i=t)&&ce.test(i)?t:e();var i}function pe(t){return t?t.split("#")[0]:t}function ge(t,e){var i=setTimeout(t,e);return(null==i?void 0:i.unref)&&(null==i||i.unref()),i}var _e=t=>t instanceof Error,me={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}},ye=me.info;function be(t){if(Q(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(N(t))return{arrayValue:{values:t.map((t=>be(t)))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}function we(t){var e=[];for(var i in t){var r=t[i];W(r)||q(r)||e.push({key:i,value:be(r)})}return e}function xe(t,e){var i=t.level||"info",{text:r,number:s}=me[i]||ye,n=String(Date.now())+"000000",o={};e.distinctId&&(o.posthogDistinctId=e.distinctId),e.sessionId&&(o.sessionId=e.sessionId),e.windowId&&(o["window.id"]=e.windowId),J(e.sessionStartTimestamp)||(o.sessionStartTimestamp=String(e.sessionStartTimestamp)),J(e.lastActivityTimestamp)||(o.lastActivityTimestamp=String(e.lastActivityTimestamp)),e.currentUrl&&(o["url.full"]=e.currentUrl),e.screenName&&(o["screen.name"]=e.screenName),e.appState&&(o["app.state"]=e.appState),e.activeFeatureFlags&&e.activeFeatureFlags.length>0&&(o.feature_flags=e.activeFeatureFlags);var a=p({},o,t.attributes||{}),l={timeUnixNano:n,observedTimeUnixNano:n,severityNumber:s,severityText:r,body:{stringValue:t.body},attributes:we(a)};return t.trace_id&&(l.traceId=t.trace_id),t.span_id&&(l.spanId=t.span_id),q(t.trace_flags)||(l.flags=t.trace_flags),l}function Se(t,e,i){return p({},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":i})}function Ee(t,e,i,r){return{resourceLogs:[{resource:{attributes:we(e)},scopeLogs:[{scope:{name:i,version:r},logRecords:t}]}]}}let ke=class{constructor(t,e,i,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.Se=e,this.Ae=i,this.qe=r,this.Be=s,this.je=n,this.He=o,this.Ue=null,this.ze=0,this.Ve=0,this.We=0,this.Ge=0,this.Ze=!1,this.Qe=e.maxBufferSize,this.Je=Math.max(null!==(a=e.maxQueueSize)&&void 0!==a?a:e.maxBufferSize,e.maxBufferSize),this.Ye=e.flushIntervalMs,this.Ke=e.maxBatchRecordsPerPost,this.Xe=e.rateCapWindowMs,this.et=e.maxLogsPerInterval}reset(){this.tt(),this.Ue=null,this.We=0,this.Ge=0,this.Ze=!1,this.ze=0,this.Ve=0,this.Ke=this.Se.maxBatchRecordsPerPost}onReconnect(){this.Ve=0,this.rt()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var e=this.it(t);if(null!==e)if(e.body){if(this.nt()){var i={record:xe(e,this.qe())};this.Be((()=>this.st(i)))}}else this.Ae.info("Log was rejected in beforeSend function")}}it(t){var e=this.Se.beforeSend;if(!e)return t;var i=N(e)?e:[e],r=t;for(var s of i)try{var n=s(r);if(!n)return this.Ae.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.Ae.error("Error in beforeSend function for log:",t),null}return r}nt(){if(void 0===this.et)return!0;var t=Date.now(),e=t-this.We;return this.Xe>e&&e>=0||(this.We=t,this.Ge=0,this.Ze=!1),this.et>this.Ge?(this.Ge++,!0):(this.Ze||(this.Ae.warn("captureLog dropping logs: exceeded "+this.et+" logs per "+this.Xe+"ms"),this.Ze=!0),!1)}flush(){var t=this;return f((function*(){if(!t._instance.isDisabled)return t.Ue||(t.Ue=t.ot().finally((()=>{t.Ue=null}))),t.Ue}))()}ot(){var t=this;return f((function*(){var e;t.tt();var i=null!==(e=t._instance.getPersistedProperty(w.LogsQueue))&&void 0!==e?e:[];if(0!==i.length)for(var r=i.length,s=0;i.length>0&&r>s;){var n,o;t.ze=0;var a=Math.min(i.length,t.Ke),l=i.slice(0,a),u=Ee(l.map((t=>t.record)),t.ut(),null!==(n=t.He)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),h=yield t._instance.ht(u);if("too-large"===h.kind&&l.length>1)t.Ke=Math.max(1,Math.floor(l.length/2)),t.Ae.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+t.Ke);else{if("retry-later"===h.kind)throw h.error;if("too-large"===h.kind?t.Ae.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"===h.kind&&t.Se.maxBatchRecordsPerPost>t.Ke&&(t.Ke=Math.min(t.Se.maxBatchRecordsPerPost,t.Ke+1)),yield t.dt(l.length),i=null!==(o=t._instance.getPersistedProperty(w.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===h.kind)throw h.error}}}))()}dt(t){var e=this;return f((function*(){var i,r=Math.max(0,t-e.ze),s=null!==(i=e._instance.getPersistedProperty(w.LogsQueue))&&void 0!==i?i:[];e._instance.setPersistedProperty(w.LogsQueue,s.slice(r)),yield e.je()}))()}ut(){return Se(this.Se,this._instance.getLibraryId(),this._instance.getLibraryVersion())}st(t){var e;if(!this._instance.optedOut){var i=null!==(e=this._instance.getPersistedProperty(w.LogsQueue))&&void 0!==e?e:[];this.Je>i.length||(i.shift(),this.ze++,this.Ae.info("Logs queue is full, dropping oldest record.")),i.push(t),this._instance.setPersistedProperty(w.LogsQueue,i),this.Qe>i.length?this.ct():this.rt()}}ct(t){void 0===t&&(t=this.Ye),this.vt||(this.vt=ge((()=>{this.vt=void 0,this.rt()}),t))}ft(){var t=Math.min(Math.max(0,this.Ve-1),6);return this.Ye*Math.pow(2,t)}yt(){var t=this._instance.getPersistedProperty(w.LogsQueue);return!!t&&t.length>0}shutdown(t){var e=this;return f((function*(){e.tt();var i=e.flush().catch((()=>{}));void 0!==t?yield Promise.race([i,new Promise((e=>ge(e,t)))]):yield i}))()}flushWithTimeout(t){var e=this;return f((function*(){var i=!1,r=e.flush(),s=new Promise((e=>ge((()=>{i=!0,e()}),t)));try{yield Promise.race([r,s])}finally{i&&r.catch((()=>{}))}}))()}rt(){this.flush().then((()=>{this.Ve=0}),(t=>{this.Ve++,this.Ae.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.yt()&&this.ct(this.ft())}))}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}};var $e,Pe,Te;function Ie(t){var e=globalThis._posthogChunkIds;if(e){var i=Object.keys(e);return Te&&i.length===Pe||(Pe=i.length,Te=i.reduce(((i,r)=>{$e||($e={});var s=$e[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,$e[r]=[l,u];break}}return i}),{})),Te}}class Re{constructor(t,e,i){void 0===i&&(i=[]),this.coercers=t,this.stackParser=e,this.modifiers=i}buildFromUnknown(t,e){void 0===e&&(e={});var i=e&&e.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,e,0).apply(t),s=this.buildParsingContext(e),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(t){var e=this;return f((function*(){for(var i of t)i.stacktrace&&i.stacktrace.frames&&N(i.stacktrace.frames)&&(i.stacktrace.frames=yield e.applyModifiers(i.stacktrace.frames));return t}))()}coerceFallback(t){var e;return{type:"Error",value:"Unknown error",stack:null==(e=t.syntheticException)?void 0:e.stack,synthetic:!0}}parseStacktrace(t,e){var i,r;return null!=t.cause&&(i=this.parseStacktrace(t.cause,e)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?e.skipFirstLines:0),e.chunkIdMap)),p({},t,{cause:i,stack:r})}applyChunkIds(t,e){return t.map((t=>(t.filename&&e&&(t.chunk_id=e[t.filename]),t)))}applyCoercers(t,e){for(var i of this.coercers)if(i.match(t))return i.coerce(t,e);return this.coerceFallback(e)}applyModifiers(t){var e=this;return f((function*(){var i=t;for(var r of e.modifiers)i=yield r(i);return i}))()}convertToExceptionList(t,e){var i,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(i=e.type)&&void 0!==i?i:"generic",handled:null===(r=e.handled)||void 0===r||r,synthetic:null!==(s=t.synthetic)&&void 0!==s&&s}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});var o=[n];return null!=t.cause&&o.push(...this.convertToExceptionList(t.cause,p({},e,{handled:!0}))),o}buildParsingContext(t){var e;return{chunkIdMap:Ie(this.stackParser),skipFirstLines:null!==(e=t.skipFirstLines)&&void 0!==e?e:1}}buildCoercingContext(t,e,i){void 0===i&&(i=0);var r=(i,r)=>{if(4>=r){var s=this.buildCoercingContext(t,e,r);return this.applyCoercers(i,s)}};return p({},e,{syntheticException:0==i?e.syntheticException:void 0,mechanism:t,apply:t=>r(t,i),next:t=>r(t,i+1)})}}var Ce="?";function Fe(t,e,i,r,s){var n={platform:t,filename:e,function:"<anonymous>"===i?Ce:i,in_app:!0};return q(r)||(n.lineno=r),q(s)||(n.colno=s),n}var Me=(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]:Ce,i?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},Oe=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,Ae=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,De=/\((\S*)(?::(\d+))(?::(\d+))\)/,Le=(t,e)=>{var i=Oe.exec(t);if(i){var[,r,s,n]=i;return Fe(e,r,Ce,+s,+n)}var o=Ae.exec(t);if(o){if(o[2]&&0===o[2].indexOf("eval")){var a=De.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[l,u]=Me(o[1]||Ce,o[2]);return Fe(e,u,l,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},je=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,ze=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ne=(t,e)=>{var i=je.exec(t);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var r=ze.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]||Ce;return[n,s]=Me(n,s),Fe(e,s,n,i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},Ue=/\(error: (.*)\)/;class Be{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,e){var i=G(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 it(t,"DOMException")}isDOMError(t){return it(t,"DOMError")}}class He{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 qe{constructor(){}match(t){return it(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 Ge=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Ve{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(Ge);return r&&(e=r[1],i=r[2]),[e,i]}}var We=["fatal","error","warning","log","info","debug"];function Je(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 Ke{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 rt(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: "+Je(t)}isSeverityLevel(t){return G(t)&&!V(t)&&We.indexOf(t)>=0}getErrorPropertyFromObject(t){for(var e in t)if({}.hasOwnProperty.call(t,e)){var i=t[e];if(_e(i))return i}}getObjectClassName(t){try{var e=Object.getPrototypeOf(t);return e?e.constructor.name:void 0}catch(t){return}}}class Ye{match(t){return rt(t)}coerce(t,e){var i,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Je(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class Qe{match(t){return et(t)}coerce(t,e){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(i=e.syntheticException)?void 0:i.stack,synthetic:!0}}}class Xe{match(t){return it(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!rt(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 et(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 Ze="$message",ti="$timestamp",ei=new Set([Ze,ti]),ii={enabled:!0,max_bytes:32768};function ri(t){var e;return t?{enabled:null!==(e=t.enabled)&&void 0!==e?e:ii.enabled,max_bytes:ni(t.max_bytes,ii.max_bytes)}:p({},ii)}class si{constructor(t){this.bt=[],this._t=0,this.Se=ri(t)}setConfig(t){this.Se=ri(t),this.wt()}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(!B(i))return;var r=i,s=r[Ze],n=r[ti];if(!G(s)||0===s.trim().length)return;if(!G(n)&&!K(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.Se.max_bytes||(this.bt.push({step:e.step,bytes:i}),this._t+=i,this.wt())}}getAttachable(){return this.bt.map((t=>t.step))}clear(){this.bt=[],this._t=0}size(){return this.bt.length}wt(){for(;this._t>this.Se.max_bytes&&this.bt.length>0;){var t=this.bt.shift();t&&(this._t-=t.bytes)}}}function ni(t,e){if(!K(t)||t===1/0||t===-1/0)return e;var i=Math.floor(t);return 0>i?e:i}var oi=function(e,i){var{debugEnabled:r}=void 0===i?{}:i,s={k(i){if(t&&(v.DEBUG||h.POSTHOG_DEBUG||r)&&!q(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[i]?t.console[i].__rrweb_original__:t.console[i]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(e,...o)}},debug(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("debug",...e)},info(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("log",...e)},warn(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("warn",...e)},error(){for(var t=arguments.length,e=new Array(t),i=0;t>i;i++)e[i]=arguments[i];s.k("error",...e)},critical(){for(var t=arguments.length,i=new Array(t),r=0;t>r;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,i)=>oi(e+" "+t,i)};return s},ai=oi("[PostHog.js]"),li=ai.createLogger,ui=li("[ExternalScriptsLoader]"),hi=(t,e,i)=>{if(t.config.disable_external_dependency_loading)return ui.warn(e+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=null==r?void 0:r.querySelectorAll("script");if(s)for(var n,o=function(){if(s[a].src===e){var t=s[a];return t.__posthog_loading_callback_fired?{v:i()}:(t.addEventListener("load",(e=>{t.__posthog_loading_callback_fired=!0,i(void 0,e)})),t.onerror=t=>i(t),{v:void 0})}},a=0;s.length>a;a++)if(n=o())return n.v;var l=()=>{if(!r)return i("document not found");var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=e,s.onload=t=>{s.__posthog_loading_callback_fired=!0,i(void 0,t)},s.onerror=t=>i(t),t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===t.config.external_scripts_inject_target)r.head.appendChild(s);else{var n,o=r.querySelectorAll("body > script");o.length>0?null==(n=o[0].parentNode)||n.insertBefore(s,o[0]):r.body.appendChild(s)}};null!=r&&r.body?l():null==r||r.addEventListener("DOMContentLoaded",l)};h.__PosthogExtensions__=h.__PosthogExtensions__||{},h.__PosthogExtensions__.loadExternalDependency=(t,e,i)=>{if("remote-config"!==e){var r;if(t.config.strict_script_versioning)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var s="/static/"+e+".js?v="+t.version;if("toolbar"===e){var n=3e5;s=s+"&t="+Math.floor(Date.now()/n)*n}r=t.requestRouter.endpointFor("assets",s)}hi(t,r,i)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");hi(t,o,i)}},h.__PosthogExtensions__.loadSiteApp=(t,e,i)=>{var r=t.requestRouter.endpointFor("api",e);hi(t,r,i)};var di="$people_distinct_id",vi="$device_id",ci="__alias",fi="__timers",pi="$autocapture_disabled_server_side",gi="$heatmaps_enabled_server_side",_i="$exception_capture_enabled_server_side",mi="$error_tracking_suppression_rules",yi="$error_tracking_capture_extension_exceptions",bi="$web_vitals_enabled_server_side",wi="$dead_clicks_enabled_server_side",xi="$product_tours_enabled_server_side",Si="$web_vitals_allowed_metrics",Ei="$session_recording_remote_config",ki="$replay_sample_rate",$i="$replay_override_sampling",Pi="$replay_override_linked_flag",Ti="$replay_override_url_trigger",Ii="$replay_override_event_trigger",Ri="$sesid",Ci="$session_is_sampled",Fi="$enabled_feature_flags",Mi="$active_feature_flags",Oi="$early_access_features",Ai="$feature_flag_details",Di="$feature_flag_payloads",Li="$feature_flag_request_id",ji="$override_feature_flags",zi="$override_feature_flag_payloads",Ni="$stored_person_properties",Ui="$stored_group_properties",Bi="$surveys",Hi="$surveys_loaded_at",qi="$surveys_activated",Gi="ph_product_tours",Vi="$flag_call_reported",Wi="$flag_call_reported_session_id",Ji="$feature_flag_errors",Ki="$feature_flag_evaluated_at",Yi="$user_state",Qi="$client_session_props",Xi="$capture_rate_limit",Zi="$initial_campaign_params",tr="$initial_referrer_info",er="$initial_person_info",ir="$epp",rr="__POSTHOG_TOOLBAR__",sr="$posthog_cookieless",nr="$sdk_debug_extensions_init_method",or="$sdk_debug_extensions_init_time_ms",ar="$sdk_debug_recording_script_not_loaded",lr="PostHog loadExternalDependency extension not found.",ur="on_reject",hr="always",dr="anonymous",vr="identified",cr="identified_only",fr="visibilitychange",pr="beforeunload",gr="$pageview",_r="$pageleave",mr="$identify",yr="$groupidentify";function br(t,e){N(t)&&t.forEach(e)}function wr(t,e){if(!J(t))if(N(t))t.forEach(e);else if(X(t))t.forEach(((t,i)=>e(t,i)));else for(var i in t)j.call(t,i)&&e(t[i],i)}var xr=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 Sr(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 Er=function(t){try{return t()}catch(t){return}},kr=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){ai.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ai.critical(t)}}},$r=function(t){var e={};return wr(t,(function(t,i){(G(t)&&t.length>0||K(t))&&(e[i]=t)})),e};var Pr=["herokuapp.com","vercel.app","netlify.app"];function Tr(t){var e=null==t?void 0:t.hostname;if(!G(e))return!1;var i=e.split(".").slice(-2).join(".");for(var r of Pr)if(i===r)return!1;return!0}function Ir(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 Rr(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 K(t)&&isFinite(t)&&Math.floor(t)===t});class Cr{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 Cr(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 Cr(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 Fr{constructor(){this.S=0,this.C=0,this.I=new Ar}generate(){var t=this.generateOrAbort();if(q(t)){this.S=0;var e=this.generateOrAbort();if(q(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 Cr.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 Mr,Or=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!q(t.crypto)&&crypto.getRandomValues&&(Or=t=>crypto.getRandomValues(t));class Ar{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||(Or(this.R),this.O=0),this.R[this.O++]}}var Dr=()=>Lr().toString(),Lr=()=>(Mr||(Mr=new Fr)).generate(),jr="",zr=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var Nr={N:()=>!!r,D(t){ai.error("cookieStore error: "+t)},P(t){if(r){try{for(var e=t+"=",i=r.cookie.split(";").filter((t=>t.length)),s=0;i.length>s;s++){for(var n=i[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(e))return decodeURIComponent(n.substring(e.length,n.length))}}catch(t){}return null}},F(t){var e;try{e=JSON.parse(Nr.P(t))||{}}catch(t){}return e},q(t,e,i,s,n){if(!r)return!1;try{var o="",a="",l=function(t,e){if(e){var i=function(t,e){if(void 0===e&&(e=r),jr)return jr;if(!e)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var i=t.split("."),s=Math.min(i.length,8),n="dmn_chk_"+Dr();!jr&&s--;){var o=i.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";e.cookie=a+";max-age=3",e.cookie.includes(n)&&(e.cookie=a+";max-age=0",jr=o)}return jr}(t);if(!i){var s=(t=>{var e=t.match(zr);return e?e[0]:""})(t);s!==i&&ai.info("Warning: cookie subdomain discovery mismatch",s,i),i=s}return i?"; domain=."+i:""}return""}(r.location.hostname,s);if(i){var u=new Date;u.setTime(u.getTime()+864e5*i),o="; expires="+u.toUTCString()}n&&(a="; secure");var h=t+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+l+a;return h.length>3686.4&&ai.warn("cookieStore warning: large cookie, len="+h.length),r.cookie=h,!0}catch(t){return!1}},A(t,e){if(null!=r&&r.cookie)try{Nr.q(t,"",-1,e)}catch(t){return}}},Ur=null,Br={N(){if(!W(Ur))return Ur;var e=!0;if(q(t))e=!1;else try{var i="__mplssupport__";Br.q(i,"xyz"),'"xyz"'!==Br.P(i)&&(e=!1),Br.A(i)}catch(t){e=!1}return e||ai.error("localStorage unsupported; falling back to cookie store"),Ur=e,e},D(t){ai.error("localStorage error: "+t)},P(e){try{return null==t?void 0:t.localStorage.getItem(e)}catch(t){Br.D(t)}return null},F(t){try{return JSON.parse(Br.P(t))||{}}catch(t){}return null},q(e,i){try{return null==t||t.localStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Br.D(t)}return!1},A(e){try{null==t||t.localStorage.removeItem(e)}catch(t){Br.D(t)}}},Hr=[vi,"distinct_id",Ri,Ci,ir,er,Yi],qr={},Gr={N:()=>!0,D(t){ai.error("memoryStorage error: "+t)},P:t=>qr[t]||null,F:t=>qr[t]||null,q:(t,e)=>(qr[t]=e,!0),A(t){delete qr[t]}},Vr=null,Wr={N(){if(!W(Vr))return Vr;if(Vr=!0,q(t))Vr=!1;else try{var e="__support__";Wr.q(e,"xyz"),'"xyz"'!==Wr.P(e)&&(Vr=!1),Wr.A(e)}catch(t){Vr=!1}return Vr},D(t){ai.error("sessionStorage error: ",t)},P(e){try{return null==t?void 0:t.sessionStorage.getItem(e)}catch(t){Wr.D(t)}return null},F(t){try{return JSON.parse(Wr.P(t))||null}catch(t){}return null},q(e,i){try{return null==t||t.sessionStorage.setItem(e,JSON.stringify(i)),!0}catch(t){Wr.D(t)}return!1},A(e){try{null==t||t.sessionStorage.removeItem(e)}catch(t){Wr.D(t)}}};class Jr{constructor(t){this._instance=t}get Se(){return this._instance.config}get consent(){return this.kt()?0:this.St}isOptedOut(){return this.Se.cookieless_mode===hr||this.isRejected()||-1===this.consent&&this.Se.cookieless_mode===ur}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Se.opt_out_capturing_by_default}optInOut(t){this.Ct.q(this.It,t?1:0,this.Se.cookie_expiration,this.Se.cross_subdomain_cookie,this.Se.secure_cookie)}reset(){this.Ct.A(this.It,this.Se.cross_subdomain_cookie)}get It(){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 St(){var t=this.Ct.P(this.It);return nt(t)?1:O(ot,t)?0:-1}get Ct(){var t=this.Se.opt_out_capturing_persistence_type,e="localStorage"===t?Br:Nr;if(!this.Tt||this.Tt!==e){this.Tt=e;var i="localStorage"===t?Nr:Br;i.P(this.It)&&(this.Tt.P(this.It)||this.optInOut(nt(i.P(this.It))),i.A(this.It,this.Se.cross_subdomain_cookie))}return this.Tt}kt(){return!!this.Se.respect_dnt&&[null==i?void 0:i.doNotTrack,null==i?void 0:i.msDoNotTrack,h.doNotTrack].some((t=>nt(t)))}}var Kr=1,Yr=3,Qr=11;function Xr(t){return t instanceof Element&&(t.id===rr||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Zr(t){return!!t&&t.nodeType===Kr}function ts(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function es(t){return!!t&&t.nodeType===Yr}function is(t){return!!t&&t.nodeType===Qr&&Zr(t.host)}function rs(t){return t?A(t).split(/\s+/):[]}function ss(e){var i=null==t?void 0:t.location.href;return!!(i&&e&&e.some((t=>i.match(t))))}function ns(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 rs(e)}function os(t){return J(t)?null:A(t).split(/(\s+)/).filter((t=>Is(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function as(t){var e="";return ws(t)&&!xs(t)&&t.childNodes&&t.childNodes.length&&wr(t.childNodes,(function(t){var i;es(t)&&t.textContent&&(e+=null!==(i=os(t.textContent))&&void 0!==i?i:"")})),A(e)}function ls(t){return q(t.target)?t.srcElement||null:null!=(e=t.target)&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var us=["a","button","form","input","select","textarea","label"];function hs(t,e){if(q(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 ds(t){var e=t.parentNode;return!(!e||!Zr(e))&&e}var vs=[".ph-no-autocapture","[data-ph-no-autocapture]"],cs=["next","previous","prev",">","<"],fs=[...cs,"+","-","−","–"],ps=(t,e)=>/[a-z0-9]/i.test(e)?t.includes(e):t===e,gs=[".ph-no-rageclick",".ph-no-capture"],_s=["","text","search","email","password","url","tel","number"];function ms(e,i){if(!t||ys(e))return!1;var r,s,n,o,a;if(Q(i)?(r=!!i&&gs,s=void 0,n=!1):(r=null!==(o=null==i?void 0:i.css_selector_ignorelist)&&void 0!==o?o:gs,s=null==i?void 0:i.content_ignorelist,n=null!==(a=null==i?void 0:i.ignore_text_selection)&&void 0!==a&&a),!1===r)return!1;if(n&&function(t){return!(!t||!Zr(t))&&(!!ts(t,"textarea")||(ts(t,"input")?O(_s,(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)))}(e))return!1;var{targetElementList:l}=bs(e,!1);return!function(t,e){if(!1===t||q(t))return!1;var i;if(!0===t)i=cs;else{if(!N(t))return!1;if(t.length>10)return ai.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=>ps(e,t)||ps(r,t)))}))}(s,l.map((t=>{var e;return{safeText:as(t).toLowerCase(),ariaLabel:(null==(e=t.getAttribute("aria-label"))?void 0:e.toLowerCase().trim())||""}})))&&!hs(l,r)}var ys=t=>!t||ts(t,"html")||!Zr(t),bs=(e,i)=>{if(!t||ys(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[e],n=e;n.parentNode&&!ts(n,"body");)if(is(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=ds(n);if(!o)break;if(i||us.indexOf(o.tagName.toLowerCase())>-1)r=!0;else{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}s.push(o),n=o}return{parentIsUsefulElement:r,targetElementList:s}};function ws(t){for(var e=t;e.parentNode&&!ts(e,"body");e=e.parentNode){var i=ns(e);if(O(i,"ph-sensitive")||O(i,"ph-no-capture"))return!1}if(O(ns(t),"ph-include"))return!0;var r=t.type||"";if(G(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!G(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 xs(t){return!!(ts(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||ts(t,"select")||ts(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var Ss="(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})",Es=new RegExp("^(?:"+Ss+")$"),ks=new RegExp(Ss),$s="\\d{3}-?\\d{2}-?\\d{4}",Ps=new RegExp("^("+$s+")$"),Ts=new RegExp("("+$s+")");function Is(t,e){if(void 0===e&&(e=!0),J(t))return!1;if(G(t)){if(t=A(t),(e?Es:ks).test((t||"").replace(/[- ]/g,"")))return!1;if((e?Ps:Ts).test(t))return!1}return!0}function Rs(t){var e=as(t);return Is(e=(e+" "+Cs(t)).trim())?e:""}function Cs(t){var e="";return t&&t.childNodes&&t.childNodes.length&&wr(t.childNodes,(function(t){var i;if(t&&"span"===(null==(i=t.tagName)?void 0:i.toLowerCase()))try{var r=as(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+Cs(t)).trim())}catch(t){ai.error("[AutoCapture]",t)}})),e}function Fs(t){return t.replace(/"|\\"/g,'\\"')}function Ms(t){var e=t.attr__class;return e?N(e)?e:rs(e):void 0}var Os=li("[Dead Clicks]"),As=()=>!0,Ds=t=>{var e,i=!(null==(e=t.instance.persistence)||!e.get_property(wi)),r=t.instance.config.capture_dead_clicks;return Q(r)?r:!!B(r)||i};class Ls{get lazyLoadedDeadClicksAutocapture(){return this.Et}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({[wi]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Mt((()=>{this.Pt()})):this.stop()}Mt(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.initDeadClicksAutocapture?t():null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(e=>{e?Os.error("failed to load script",e):t()}))}Pt(){var t;if(r){if(!this.Et&&null!=(t=h.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var e=B(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};e.__onCapture=this.onCapture,this.Et=h.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,e),this.Et.start(r),Os.info("starting...")}}else Os.error("`document` not found. Cannot start.")}stop(){this.Et&&(this.Et.stop(),this.Et=void 0,Os.info("stopping..."))}}var js=li("[SegmentIntegration]");var zs="posthog-js";function Ns(t,e){var{organization:i,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===e?{}:e;return e=>{var a,l,u,h,d;if("*"!==n&&!n.includes(e.level)||!t.__loaded)return e;e.tags||(e.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());e.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(e.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,f=(null==(a=e.exception)?void 0:a.values)||[],g=f.map((t=>p({},t,{stacktrace:t.stacktrace?p({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>p({},t,{platform:"web:javascript"})))}):void 0}))),_={$exception_message:(null==(l=f[0])?void 0:l.value)||e.message,$exception_type:null==(u=f[0])?void 0:u.type,$exception_level:e.level,$exception_list:g,$sentry_event_id:e.event_id,$sentry_exception:e.exception,$sentry_exception_message:(null==(h=f[0])?void 0:h.value)||e.message,$sentry_exception_type:null==(d=f[0])?void 0:d.type,$sentry_tags:e.tags};return i&&r&&(_.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+e.event_id),o&&(null==(c=t.exceptions)||c.sendExceptionEvent(_)),e}}class Us{constructor(t,e,i,r,s,n){this.name=zs,this.setupOnce=function(o){o(Ns(t,{organization:e,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Bs{constructor(t){this.Rt=(t,e,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(ai.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:i}),this.Ot=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.Lt()}Lt(){var t;this.Ft=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.Rt)}destroy(){var t;null==(t=this.Ft)||t.call(this),this.Ft=void 0}doPageView(e,i){var r,s=this.At(e,i);return this.Ot={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:i,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var e;return this.At(t,null==(e=this.Ot)?void 0:e.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Ot)?void 0:t.pageViewId}}At(t,e){var i=this.Ot;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(!(q(n)||q(o)||q(a)||q(l)||q(u)||q(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?at(o/n,0,1,ai):1,v=n>1?at(a/n,0,1,ai):1,c=l>1?at(u/l,0,1,ai):1,f=l>1?at(h/l,0,1,ai):1;r=xr(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 Hs=["flags","surveys"],qs={[di]:{exposure:"hidden"},[ci]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[fi]:{exposure:"hidden"},[pi]:{exposure:"event"},[gi]:{exposure:"hidden"},[_i]:{exposure:"event"},[mi]:{exposure:"hidden"},[yi]:{exposure:"event"},[bi]:{exposure:"event"},[wi]:{exposure:"event"},[xi]:{exposure:"hidden"},[Si]:{exposure:"event"},[Ei]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[Ri]:{exposure:"hidden"},[Ci]:{exposure:"event"},[ki]:{exposure:"event",shouldSkipFromEventProperties:t=>W(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"},[Fi]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!B(t))return{};for(var e={},i=Object.keys(t),r=0;i.length>r;r++)e["$feature/"+i[r]]=t[i[r]];return e}},[Mi]:{exposure:"event",storageGroup:"flags"},[Oi]:{exposure:"hidden"},[Ai]:{exposure:"hidden",storageGroup:"flags"},[Di]:{exposure:"event",storageGroup:"flags"},[Li]:{exposure:"event",storageGroup:"flags",volatile:!0},[ji]:{exposure:"event"},[zi]:{exposure:"hidden"},[Ni]:{exposure:"hidden"},[Ui]:{exposure:"hidden"},[Bi]:{exposure:"hidden",storageGroup:"surveys"},[Hi]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[qi]:{exposure:"event"},[Gi]:{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"},[Vi]:{exposure:"hidden"},[Wi]:{exposure:"hidden"},[Ji]:{exposure:"hidden"},[Ki]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Yi]:{exposure:"hidden"},[Qi]:{exposure:"hidden"},[Xi]:{exposure:"hidden"},[Zi]:{exposure:"hidden"},[tr]:{exposure:"hidden"},[er]:{exposure:"hidden"},[ir]:{exposure:"hidden"},[$i]:{exposure:"event"},[Pi]:{exposure:"event"},[Ti]:{exposure:"event"},[Ii]:{exposure:"event"},[nr]:{exposure:"event"},[or]:{exposure:"event"},[ar]:{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"}},Gs=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Vs=t=>{var e=qs[t];if(e)return e;for(var[i,r]of Gs)if(0===t.indexOf(i))return r},Ws=t=>{var e=null==r?void 0:r.createElement("a");return q(e)?null:(e.href=t,e)},Js=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(!N(i)||2>i.length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(t){ai.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Ks=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("=");N(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},Ys=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},Qs="https?://(.*)",Xs=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Zs=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Xs],tn="<masked>",en=["li_fat_id"];function rn(t,e,i){if(!r)return{};var s,n=e?[...Xs,...i||[]]:[],o=sn(Ks(r.URL,n,tn),t),a=(s={},wr(en,(function(t){var e=Nr.P(t);s[t]=e||null})),s);return xr(a,o)}function sn(t,e){var i=Zs.concat(e||[]),r={};return wr(i,(function(e){var i=Js(t,e);r[e]=i||null})),r}function nn(t){var e=function(t){return t?0===t.search(Qs+"google.([^/?]*)")?"google":0===t.search(Qs+"bing.com")?"bing":0===t.search(Qs+"yahoo.com")?"yahoo":0===t.search(Qs+"duckduckgo.com")?"duckduckgo":null:null}(t),i="yahoo"!=e?"q":"p",s={};if(!W(e)){s.$search_engine=e;var n=r?Js(r.referrer,i):"";n.length&&(s.ph_keyword=n)}return s}function on(){return navigator.language||navigator.userLanguage}var an="$direct";function ln(){return(null==r?void 0:r.referrer)||an}function un(t,e,i){void 0===i&&(i=!1);var r=t?[...Xs,...e||[]]:[],n=i?pe(null==s?void 0:s.href):null==s?void 0:s.href,o=null==n?void 0:n.substring(0,1e3);return{r:ln().substring(0,1e3),u:o?Ks(o,r,tn):void 0}}function hn(t,e){var i;void 0===e&&(e=!1);var{r:r,u:s}=t,n=e?pe(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==an?an:null==(i=Ws(r))?void 0:i.host};if(n){o.$current_url=n;var a=Ws(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=sn(n);xr(o,l)}if(r){var u=nn(r);xr(o,u)}return o}function dn(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function vn(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var cn={flags:Ki,surveys:Hi},fn=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],pn="main";class gn{constructor(e,i,r){if(void 0===r&&(r=!0),this.$t={},this.Dt=!1,this.Nt=!1,this.Se=e,this.qt=r,this.props={},this.Bt=!1,this.jt=(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"})(e),this.Ct=this.Ht(e),this.Nt=this.Ut(e),this.load(),e.debug&&ai.info("Persistence loaded",e.persistence,p({},this.props)),this.update_config(e,e,i),this.save(),t){var s=()=>this.flush();Ir(t,"beforeunload",s,{capture:!1}),Ir(t,"pagehide",s,{capture:!1})}}zt(){var t,e=null==(t=this.Se)?void 0:t.persistence_save_debounce_ms;return K(e)&&e>0?e:0}isDisabled(){return!!this.Vt}Ht(e){-1===fn.indexOf(e.persistence.toLowerCase())&&(ai.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var i,r=function(e,i){void 0===e&&(e=[]),void 0===i&&(i=!1);var r=[...Hr,...e];return p({},Br,{F(t){try{var e={};try{e=Nr.F(t)||{}}catch(t){}var r,s=JSON.parse(Br.P(t)||"{}");if(i){var n={};for(var o in e){var a=e[o];W(a)||""===a||(n[o]=a)}r=xr(s,n)}else r=xr(e,s);return Br.q(t,r),r}catch(t){}return null},q(t,e,i,s,n,o){var a=Br.q(t,e,void 0,void 0,o);try{var l={};r.forEach((t=>{e[t]&&(l[t]=e[t])})),Object.keys(l).length&&Nr.q(t,l,i,s,n,o)}catch(t){Br.D(t)}return a},A(e,i){try{null==t||t.localStorage.removeItem(e),Nr.A(e,i)}catch(t){Br.D(t)}}})}(e.cookie_persisted_properties||[],e.__preview_cookie_wins_on_conflict||!1),s=!1,n=e.persistence.toLowerCase();return"localstorage"===n&&Br.N()?(i=Br,s=!0):"localstorage+cookie"===n&&r.N()?(i=r,s=!0):"sessionstorage"===n&&Wr.N()?i=Wr:"memory"===n?i=Gr:"cookie"===n?i=Nr:r.N()?(i=r,s=!0):i=Nr,this.Dt=s,i}Wt(t){return this.jt+"__"+t}Ut(t){return this.Dt&&!!t.split_storage}Gt(t){var e=null!=t?t:this.Se.feature_flag_cache_ttl_ms;if(!e||0>=e)return!1;var i=this.props[Ki];return!i||"number"!=typeof i||Date.now()-i>e}properties(){var t={};return wr(this.props,((e,i)=>{var r=Vs(i);if("derived"===(null==r?void 0:r.exposure)){if(null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(e,i===Fi?()=>this.Gt():()=>!1))return;r.transformToEventProperties&&xr(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.Vt){var t=this.Ct.F(this.jt);t&&(this.props=xr({},t)),this.Nt&&this.Zt()}}Zt(){for(var t of Hs){var e=Br.F(this.Wt(t));if(e&&!H(e)){var i=this.Qt(t);i.persisted=!0,this.Jt(t)||(i.fingerprint=this.Yt(e,t)),this.Kt(t,e)||xr(this.props,e)}}}Jt(t){return Object.keys(this.props).some((e=>{var i;return(null==(i=Vs(e))?void 0:i.storageGroup)===t}))}Kt(t,e){var i=cn[t];if(!i)return!1;var r=e[i],s=this.props[i];return K(r)&&K(s)&&s>r}refreshKey(t){var e;if(!this.Vt){var i=this.Nt?null==(e=Vs(t))?void 0:e.storageGroup:void 0,r=i?Br.F(this.Wt(i)):this.Ct.F(this.jt);if(r&&t in r)this.Xt(t,r[t]);else{if(i){var s=this.Ct.F(this.jt);if(s&&t in s)return void this.Xt(t,s[t])}this.er(t)}}}save(){if(!this.Vt){var t=this.zt();t>0?q(this.tr)&&(this.tr=setTimeout((()=>{this.tr=void 0,this.rr()}),t)):this.rr()}}flush(){q(this.tr)||(clearTimeout(this.tr),this.tr=void 0,this.rr())}rr(){this.Vt||(this.Nt?this.ir():this.nr(this.Ct,this.jt,this.props,pn))}ir(){var{main:t,groups:e}=this.sr();for(var i of(this.nr(this.Ct,this.jt,t,pn),Hs)){var r,s=e[i];(!H(s)||null!=(r=this.$t[i])&&r.persisted)&&this.nr(Br,this.Wt(i),s,i)}}sr(){var t={},e={};for(var i of Hs)e[i]={};return wr(this.props,((i,r)=>{var s,n=null==(s=Vs(r))?void 0:s.storageGroup;n?e[n][r]=i:t[r]=i})),{main:t,groups:e}}Yt(t,e){if(e===pn)return JSON.stringify(t)+"|"+this.ar+"|"+this.lr+"|"+this.ur;var i={};return wr(t,((t,e)=>{var r;i[e]=null!=(r=Vs(e))&&r.volatile?"__volatile__":t})),JSON.stringify(i)}nr(t,e,i,r){var s=this.Qt(r);if(r===pn||s.dirty||q(s.fingerprint)){var n;try{if((n=this.Yt(i,r))===s.fingerprint)return void(s.dirty=!1)}catch(t){n=void 0}t.q(e,i,this.ar,this.lr,this.ur,this.Se.debug)?(s.dirty=!1,r!==pn&&(s.persisted=!0),q(n)||(s.fingerprint=n)):this.Se.debug&&ai.warn('failed to persist storage entry "'+e+'"; will retry on next save')}}remove(t){var{keepGroupEntries:e=!1}=void 0===t?{}:t;if(q(this.tr)||(clearTimeout(this.tr),this.tr=void 0),this.Ct.A(this.jt,!1),this.Ct.A(this.jt,!0),!e&&this.qt)for(var i of Hs)Br.A(this.Wt(i));e?delete this.$t[pn]:this.$t={}}clear(){this.remove(),this.props={}}register_once(t,e,i){if(B(t)){q(e)&&(e="None"),this.ar=q(i)?this.hr:i;var r=!1;if(wr(t,((t,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==e||(this.Xt(i,t),r=!0)})),r)return this.save(),!0}return!1}register(t,e){if(B(t)){this.ar=q(e)?this.hr:e;var i=!1;if(wr(t,((e,r)=>{t.hasOwnProperty(r)&&this.props[r]!==e&&(this.Xt(r,e),i=!0)})),i)return this.save(),!0}return!1}unregister(t){t in this.props&&(this.er(t),this.save())}update_campaign_params(){if(!this.Bt){var t=rn(this.Se.custom_campaign_params,this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties);H($r(t))||this.register(t),this.Bt=!0}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?nn(t):{})}update_referrer_info(){var t;this.register_once({$referrer:ln(),$referring_domain:null!=r&&r.referrer&&(null==(t=Ws(r.referrer))?void 0:t.host)||an},void 0)}set_initial_person_info(){this.props[Zi]||this.props[tr]||this.register_once({[er]:un(this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties,this.Se.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};wr([tr,Zi],(e=>{var i=this.props[e];i&&wr(i,(function(e,i){t["$initial_"+D(i)]=e}))}));var e=this.props[er];if(e){var i=function(t,e){void 0===e&&(e=!1);var i=hn(t,e),r={};return wr(i,(function(t,e){r["$initial_"+D(e)]=t})),r}(e,this.Se.disable_capture_url_hashes);xr(t,i)}return t}safe_merge(t){return wr(this.props,(function(e,i){i in t||(t[i]=e)})),t}update_config(t,e,i){this.hr=this.ar=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.Ht(t):this.Ct,n=this.Ut(t);if(r||n!==this.Nt){var o=this.props;this.clear(),this.Ct=s,this.Nt=n,this.props=o,this.save()}}set_disabled(t){this.Vt=t,this.Vt?this.remove():this.save()}set_cross_subdomain(t){t!==this.lr&&(this.lr=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.ur&&(this.ur=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,e){var i=this.props[fi]||{};i[t]=e,this.Xt(fi,i),this.save()}remove_event_timer(t){var e=this.props[fi]||{},i=e[t];return q(i)||(delete e[t],this.Xt(fi,e),this.save()),i}get_property(t){return this.props[t]}set_property(t,e){this.Xt(t,e),this.save()}Xt(t,e){var i;this.props[t]=e,null!=(i=Vs(t))&&i.volatile||this.dr(t)}er(t){delete this.props[t],this.dr(t)}dr(t){var e,i=null==(e=Vs(t))?void 0:e.storageGroup;i&&(this.Qt(i).dirty=!0)}Qt(t){return this.$t[t]||(this.$t[t]={})}}var _n="events",mn="cancelEvents",yn="survey shown",bn="survey dismissed",wn="survey sent",xn="popover",Sn=li("[RateLimiter]");class En{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=>{Sn.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Sn.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(Xi))&&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(Xi,a),{isRateLimited:l,remainingTokens:a.tokens}}isServerRateLimited(t){var e=this.serverLimits[t||"events"]||!1;return!1!==e&&(new Date).getTime()<e}}var kn=li("[RemoteConfig]");class $n{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=h._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}cr(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.loadExternalDependency?null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}vr(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 kn.info("Using preloaded remote config",this.remoteConfig),this.pr(this.remoteConfig),void this.gr();if(this._instance.mr())return void kn.warn("Remote config is disabled. Falling back to local config.");this.cr((t=>{if(!t)return kn.info("No config found after loading remote JS config. Falling back to JSON."),void this.vr((t=>{this.pr(t),this.gr()}));this.pr(t),this.gr()}))}catch(t){kn.error("Error loading remote config",t)}}stop(){this.yr&&(clearInterval(this.yr),this.yr=void 0)}refresh(){!this._instance.mr()&&r&&"hidden"!==r.visibilityState&&this._instance.reloadFeatureFlags()}gr(){var t;if(!this.yr){var e=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==e&&(this.yr=setInterval((()=>{this.refresh()}),e))}}pr(t){var e;t||kn.error("Failed to fetch remote config from PostHog."),this._instance.pr(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 Pn="gzip-js",Tn="base64",In=Uint8Array,Rn=Uint16Array,Cn=Uint32Array,Fn=new In([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]),Mn=new In([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]),On=new In([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),An=function(t,e){for(var i=new Rn(31),r=0;31>r;++r)i[r]=e+=1<<t[r-1];var s=new Cn(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]},Dn=An(Fn,2),Ln=Dn[1];Dn[0][28]=258,Ln[258]=28;for(var jn=An(Mn,0)[1],zn=new Rn(32768),Nn=0;32768>Nn;++Nn){var Un=(43690&Nn)>>>1|(21845&Nn)<<1;zn[Nn]=((65280&(Un=(61680&(Un=(52428&Un)>>>2|(13107&Un)<<2))>>>4|(3855&Un)<<4))>>>8|(255&Un)<<8)>>>1}var Bn=function(t,e,i){for(var r=t.length,s=0,n=new Rn(e);r>s;++s)++n[t[s]-1];var o,a=new Rn(e);for(s=0;e>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(i){o=new Rn(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[zn[d]>>>l]=u}else for(o=new Rn(r),s=0;r>s;++s)o[s]=zn[a[t[s]-1]++]>>>15-t[s];return o},Hn=new In(288);for(Nn=0;144>Nn;++Nn)Hn[Nn]=8;for(Nn=144;256>Nn;++Nn)Hn[Nn]=9;for(Nn=256;280>Nn;++Nn)Hn[Nn]=7;for(Nn=280;288>Nn;++Nn)Hn[Nn]=8;var qn=new In(32);for(Nn=0;32>Nn;++Nn)qn[Nn]=5;var Gn=Bn(Hn,9,0),Vn=Bn(qn,5,0),Wn=function(t){return(t/8>>0)+(7&t&&1)},Jn=function(t,e,i){(null==i||i>t.length)&&(i=t.length);var r=new(t instanceof Rn?Rn:t instanceof Cn?Cn:In)(i-e);return r.set(t.subarray(e,i)),r},Kn=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8},Yn=function(t,e,i){var r=e/8>>0;t[r]|=i<<=7&e,t[r+1]|=i>>>8,t[r+2]|=i>>>16},Qn=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 In(0),0];if(1==s){var o=new In(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 Rn(v+1),f=Xn(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 In(c),f]},Xn=function(t,e,i){return-1==t.s?Math.max(Xn(t.l,e,i+1),Xn(t.r,e,i+1)):e[t.s]=i},Zn=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new Rn(++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]},to=function(t,e){for(var i=0,r=0;e.length>r;++r)i+=t[r]*e[r];return i},eo=function(t,e,i){var r=i.length,s=Wn(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)},io=function(t,e,i,r,s,n,o,a,l,u,h){Kn(e,h++,i),++s[256];for(var d=Qn(s,15),v=d[0],c=d[1],f=Qn(n,15),p=f[0],g=f[1],_=Zn(v),m=_[0],y=_[1],b=Zn(p),w=b[0],x=b[1],S=new Rn(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=Qn(S,7),P=k[0],T=k[1],I=19;I>4&&!P[On[I-1]];--I);var R,C,F,M,O=u+5<<3,A=to(s,Hn)+to(n,qn)+o,D=to(s,v)+to(n,p)+o+14+3*I+to(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(A>=O&&D>=O)return eo(e,h,t.subarray(l,l+u));if(Kn(e,h,1+(A>D)),h+=2,A>D){R=Bn(v,c,0),C=v,F=Bn(p,g,0),M=p;var L=Bn(P,T,0);for(Kn(e,h,y-257),Kn(e,h+5,x-1),Kn(e,h+10,I-4),h+=14,E=0;I>E;++E)Kn(e,h+3*E,P[On[E]]);h+=3*I;for(var j=[m,w],z=0;2>z;++z){var N=j[z];for(E=0;N.length>E;++E)Kn(e,h,L[U=31&N[E]]),h+=P[U],U>15&&(Kn(e,h,N[E]>>>5&127),h+=N[E]>>>12)}}else R=Gn,C=Hn,F=Vn,M=qn;for(E=0;a>E;++E)if(r[E]>255){var U;Yn(e,h,R[257+(U=r[E]>>>18&31)]),h+=C[U+257],U>7&&(Kn(e,h,r[E]>>>23&31),h+=Fn[U]);var B=31&r[E];Yn(e,h,F[B]),h+=M[B],B>3&&(Yn(e,h,r[E]>>>5&8191),h+=Mn[B])}else Yn(e,h,R[r[E]]),h+=C[r[E]];return Yn(e,h,R[256]),h+C[256]},ro=new Cn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),so=function(){for(var t=new Cn(256),e=0;256>e;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),no=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function oo(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=so[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 In(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=eo(l,u,t.subarray(h,d)):(l[h]=!0,u=eo(l,u,t.subarray(h,o)))}else{for(var v=ro[e-1],c=v>>>13,f=8191&v,p=(1<<i)-1,g=new Rn(32768),_=new Rn(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 Cn(25e3),x=new Rn(288),S=new Rn(32),E=0,k=0,P=(h=0,0),T=0,I=0;o>h;++h){var R=b(h),C=32767&h,F=_[R];if(g[C]=F,_[R]=C,h>=T){var M=o-h;if((E>7e3||P>24576)&&M>423){u=io(t,l,0,w,x,S,k,P,I,h-I,u),P=E=k=0,I=h;for(var O=0;286>O;++O)x[O]=0;for(O=0;30>O;++O)S[O]=0}var A=2,D=0,L=f,j=C-F&32767;if(M>2&&R==b(h-j))for(var z=Math.min(c,M)-1,N=Math.min(32767,h),U=Math.min(258,M);N>=j&&--L&&C!=F;){if(t[h+A]==t[h+A-j]){for(var B=0;U>B&&t[h+B]==t[h+B-j];++B);if(B>A){if(A=B,D=j,B>z)break;var H=Math.min(j,B-2),q=0;for(O=0;H>O;++O){var G=h-j+O+32768&32767,V=G-g[G]+32768&32767;V>q&&(q=V,F=G)}}}j+=(C=F)-(F=g[C])+32768&32767}if(D){w[P++]=268435456|Ln[A]<<18|jn[D];var W=31&Ln[A],J=31&jn[D];k+=Fn[W]+Mn[J],++x[257+W],++S[J],T=h+A,++E}else w[P++]=t[h],++x[t[h]]}}u=io(t,l,!0,w,x,S,k,P,I,h-I,u)}return Jn(a,0,r+Wn(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&&no(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),no(u,h-8,i.d()),no(u,h-4,r),u}var ao=!!o||!!n,lo="text/plain",uo=!1,ho=(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:"")},vo=function(t,e,i){var r;void 0===i&&(i=!0);var[s,n]=t.split("?"),o=p({},e),a=null!==(r=null==n?void 0:n.split("&").map((t=>{var e,[r,s]=t.split("="),n=i&&null!==(e=o[r])&&void 0!==e?e:s;return delete o[r],r+"="+n})))&&void 0!==r?r:[],l=function(t,e){var i,r;void 0===e&&(e="&");var s=[];return wr(t,(function(t,e){q(t)||q(e)||"undefined"===e||(i=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(e),s[s.length]=r+"="+i)})),s.join(e)}(o);return l&&a.push(l),s+"?"+a.join("&")},co=(t,e)=>JSON.stringify(t,((t,e)=>"bigint"==typeof e?e.toString():e),e),fo=t=>{if(t.xt)return t.xt;var{data:e,compression:i}=t;if(e){if(i===Pn){var r=oo(function(t,e){var i=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new In(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 In(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 Jn(r,0,s)}(co(e)),{mtime:0});return{contentType:lo,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(i===Tn){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,e)=>String.fromCharCode(parseInt(e,16))))):t}(co(e)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:co(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=co(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},po=t=>{var e,i,r,s=fo(t);return!s||(i=t.compression,r=Js(t.url,"compression"),i!==x.GZipJS&&r!==x.GZipJS&&"gzip"!==r)||((e=s.body)instanceof ArrayBuffer?P(new Uint8Array(e)):ArrayBuffer.isView(e)&&P(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?{url:t.url,encodedBody:s}:(uo=!0,{url:ho(t.url,"compression"),encodedBody:fo(p({},t,{compression:void 0,xt:void 0}))})},go=function(){var t=f((function*(t){var e=co(t.data),i=yield function(t,e,i){return C.apply(this,arguments)}(e,v.DEBUG,{rethrow:!0});if(!i)return t;var r=yield i.arrayBuffer();return p({},t,{xt:{contentType:lo,body:r,estimatedSize:r.byteLength}})}));return function(e){return t.apply(this,arguments)}}(),_o=(t,e)=>vo(t,{_:(new Date).getTime().toString(),ver:v.JS_SDK_VERSION,compression:e}),mo=[];n&&mo.push({transport:"fetch",method(t){var e,{url:i,encodedBody:r}=po(t),{contentType:s,body:o,estimatedSize:l}=null!=r?r:{},u=new Headers;wr(t.headers,(function(t,e){u.append(e,t)})),s&&u.append("Content-Type",s);var h=null,d=null;if(a){var v=new a;h={signal:v.signal,timeout:setTimeout((()=>{var e,i;e=t.timeout,(i=new Error("PostHog request timed out"+(e?" after "+e+"ms":""))).name="AbortError",v.abort(d=i)}),t.timeout)}}n(i,p({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&52428.8>(l||0),body:o,signal:null==(e=h)?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){ai.error(t)}null==t.callback||t.callback(r)})))).catch((e=>{e===d?ai.warn(e):ai.error(e),null==t.callback||t.callback({statusCode:0,error:e})})).finally((()=>h?clearTimeout(h.timeout):null))}}),o&&mo.push({transport:"XHR",method(t){var e=new o,{url:i,encodedBody:r}=po(t);e.open(t.method||"GET",i,!0);var{contentType:s,body:n}=null!=r?r:{};wr(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!=i&&i.sendBeacon&&mo.push({transport:"sendBeacon",method(t){try{var{url:e,encodedBody:r}=po(t),{contentType:s,body:n}=null!=r?r:{};if(!n)return;var o=n instanceof Blob?n:new Blob([n],{type:s});i.sendBeacon(e,o)}catch(t){}}});var yo=3e3;class bo{constructor(t,e){this.br=!0,this._r=[],this.wr=at((null==e?void 0:e.flush_interval_ms)||yo,250,5e3,ai.createLogger("flush interval"),yo),this.kr=t}enqueue(t){this._r.push(t),this.Sr||this.Cr()}unload(){this.Ir();var t=this._r.length>0?this.Tr():{},e=Object.values(t);[...e.filter((t=>0===t.url.indexOf("/e"))),...e.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.kr(p({},t,{transport:"sendBeacon"}))}))}enable(){this.br=!1,this.Cr()}Cr(){var t=this;this.br||(this.Sr=setTimeout((()=>{if(this.Ir(),this._r.length>0){var e=this.Tr(),i=function(){var i=e[r],s=(new Date).getTime();i.data&&N(i.data)&&wr(i.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.kr(i)};for(var r in e)i()}}),this.wr))}Ir(){clearTimeout(this.Sr),this.Sr=void 0}Tr(){var t={};return wr(this._r,(e=>{var i,r=e,s=(r?r.batchKey:null)||r.url;q(t[s])&&(t[s]=p({},r,{data:[]})),null==(i=t[s].data)||i.push(r.data)})),this._r=[],t}}var wo=["retriesPerformedSoFar"];class xo{constructor(e){this.Er=!1,this.Mr=3e3,this._r=[],this._instance=e,this._r=[],this.Pr=!0,!q(t)&&"onLine"in t.navigator&&(this.Pr=t.navigator.onLine,this.Rr=()=>{this.Pr=!0,this.Or()},this.Lr=()=>{this.Pr=!1},Ir(t,"online",this.Rr),Ir(t,"offline",this.Lr))}get length(){return this._r.length}retriableRequest(t){var{retriesPerformedSoFar:e}=t,i=g(t,wo);Y(e)&&(i.url=vo(i.url,{retry_count:e})),this._instance._send_request(p({},i,{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.st(p({retriesPerformedSoFar:e},i));0===t.statusCode&&ai.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==i.callback||i.callback(t)}}))}st(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._r.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+i;navigator.onLine||(s+=" (Browser is offline)"),ai.warn(s),this.Er||(this.Er=!0,this.Fr())}Fr(){if(this.Ar&&clearTimeout(this.Ar),0===this._r.length)return this.Er=!1,void(this.Ar=void 0);this.Ar=setTimeout((()=>{this.Pr&&this._r.length>0&&this.Or(),this.Fr()}),this.Mr)}Or(){var t=Date.now(),e=[],i=this._r.filter((i=>t>i.retryAt||(e.push(i),!1)));if(this._r=e,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Ar&&(clearTimeout(this.Ar),this.Ar=void 0),this.Er=!1,q(t)||(this.Rr&&(t.removeEventListener("online",this.Rr),this.Rr=void 0),this.Lr&&(t.removeEventListener("offline",this.Lr),this.Lr=void 0)),this._r))try{this._instance._send_request(p({},e,{transport:"sendBeacon"}))}catch(t){ai.error(t)}this._r=[]}}class So{constructor(t){this.$r=()=>{var t,e,i,r;this.Dr||(this.Dr={});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.Dr.lastScrollY=Math.ceil(n),this.Dr.maxScrollY=Math.max(n,null!==(t=this.Dr.maxScrollY)&&void 0!==t?t:0),this.Dr.maxScrollHeight=Math.max(o,null!==(e=this.Dr.maxScrollHeight)&&void 0!==e?e:0),this.Dr.lastContentY=a,this.Dr.maxContentY=Math.max(a,null!==(i=this.Dr.maxContentY)&&void 0!==i?i:0),this.Dr.maxContentHeight=Math.max(l,null!==(r=this.Dr.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get Nr(){return this._instance.config.scroll_root_selector}getContext(){return this.Dr}resetContext(){var t=this.Dr;return setTimeout(this.$r,0),t}startMeasuringScrollPosition(){Ir(t,"scroll",this.$r,{capture:!0}),Ir(t,"scrollend",this.$r,{capture:!0}),Ir(t,"resize",this.$r)}scrollElement(){if(!this.Nr)return null==t?void 0:t.document.documentElement;var e=N(this.Nr)?this.Nr:[this.Nr];for(var i of e){var r=null==t?void 0:t.document.querySelector(i);if(r)return r}}qr(e){var i="y"===e?"scrollTop":"scrollLeft";if(this.Nr){var r=this.scrollElement();return r&&r[i]||0}return t?"y"===e?t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop||0:t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft||0:0}scrollY(){return this.qr("y")}scrollX(){return this.qr("x")}}var Eo=t=>un(null==t?void 0:t.config.mask_personal_data_properties,null==t?void 0:t.config.custom_personal_data_properties,null==t?void 0:t.config.disable_capture_url_hashes);class ko{constructor(t,e,i,r){this.Br=t=>{var e=this.jr();if(!e||e.sessionId!==t){var i={sessionId:t,props:this.Hr(this._instance)};this.Ur.register({[Qi]:i})}},this._instance=t,this.zr=e,this.Ur=i,this.Hr=r||Eo,this.zr.onSessionId(this.Br)}jr(){return this.Ur.props[Qi]}getSetOnceProps(){var t,e=null==(t=this.jr())?void 0:t.props;return e?"r"in e?hn(e,this._instance.config.disable_capture_url_hashes):{$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 wr($r(this.getSetOnceProps()),((e,i)=>{"$current_url"===i&&(i="url"),t["$session_entry_"+D(i)]=e})),t}}class $o{constructor(){this.Vr={}}on(t,e){return this.Vr[t]||(this.Vr[t]=[]),this.Vr[t].push(e),()=>{this.Vr[t]=this.Vr[t].filter((t=>t!==e))}}emit(t,e){for(var i of this.Vr[t]||[])i(e);for(var r of this.Vr["*"]||[])r(t,e)}}var Po=li("[SessionId]");class To{on(t,e){return this.Wr.on(t,e)}constructor(t,e,i){var r;if(this.Gr=null,this.Zr=[],this.Qr=void 0,this.Jr=!1,this.Wr=new $o,this.Yr=(t,e)=>!(!Y(t)||!Y(e))&&Math.abs(t-e)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===hr)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Se=t.config,this.Ur=t.persistence,this.Kr=void 0,this.Xr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ei=e||Dr,this.ti=i||Dr;var s=this.Se.persistence_name||this.Se.token;if(this._sessionTimeoutMs=1e3*at(this.Se.session_idle_timeout_seconds||1800,60,36e3,Po.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ri(),this.ii="ph_"+s+"_window_id",this.ni="ph_"+s+"_primary_window_exists",this.si()){var n=Wr.F(this.ii),o=Wr.F(this.ni);n&&!o?this.Kr=n:Wr.A(this.ii),Wr.q(this.ni,!0)}if(null!=(r=this.Se.bootstrap)&&r.sessionID)try{var a=(t=>{var e=this.Se.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.oi(this.Se.bootstrap.sessionID,(new Date).getTime(),a)}catch(t){Po.error("Invalid sessionID in bootstrap",t)}this.ai()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return q(this.Zr)&&(this.Zr=[]),this.Zr.push(t),this.Xr&&t(this.Xr,this.Kr),()=>{this.Zr=this.Zr.filter((e=>e!==t))}}si(){return"memory"!==this.Se.persistence&&!this.Ur.Vt&&Wr.N()}li(t){t!==this.Kr&&(this.Kr=t,this.si()&&Wr.q(this.ii,t))}ui(){return this.Kr?this.Kr:this.si()?Wr.F(this.ii):null}hi(t){var e=this.Gr;return!W(e)&&!W(t)&&5e3>Math.abs(t-e)}oi(t,e,i){var r=e!==this._sessionActivityTimestamp,s=!(t!==this.Xr||i!==this._sessionStartTimestamp);this._sessionStartTimestamp=i,this._sessionActivityTimestamp=e,this.Xr=t,s&&!r||s&&this.hi(e)||(this.Gr=e,this.Ur.register({[Ri]:[e,t,i]}))}di(){var t,e=null==(t=this.Se)?void 0:t.persistence_save_debounce_ms;return Y(e)&&e>0}ci(){this.di()?this.Ur.refreshKey(Ri):(this.Ur.flush(),this.Ur.load())}vi(){var t;if(!W(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Gr){this.ci();var[,e,i]=this.fi();e===this.Xr&&i===this._sessionStartTimestamp&&(this.Gr=this._sessionActivityTimestamp,this.Ur.register({[Ri]:[this._sessionActivityTimestamp,null!==(t=this.Xr)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.Ur.flush())}}pi(){var[t]=this.fi(),e=Y(t)?t:0,i=Y(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(e,i)}gi(t){return this.ci(),this.Yr(t,this.pi())}fi(){var t=this.Ur.props[Ri];return N(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Gr=null,clearTimeout(this.mi),this.mi=void 0,this.oi(null,null,null)}destroy(){this.Jr=!0,this.vi(),clearTimeout(this.mi),this.mi=void 0,this.Qr&&t&&(t.removeEventListener(pr,this.Qr,{capture:!1}),this.Qr=void 0),this.Zr=[]}ai(){this.Qr=()=>{this.vi(),this.si()&&Wr.A(this.ni)},Ir(t,pr,this.Qr,{capture:!1})}checkAndGetSessionAndWindowId(t,e){if(void 0===t&&(t=!1),void 0===e&&(e=null),this.Se.cookieless_mode===hr)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=e||(new Date).getTime(),[,r,s]=this.fi(),n=this.pi(),o=this.ui(),a=Y(s)&&Math.abs(i-s)>864e5,l=!1,u=!1,h=!r,d=r,v=!h&&!t&&this.Yr(i,n);v&&((v=this.gi(i))||Po.info("cross-tab refresh kept the session alive",{sessionId:r}),[,r,s]=this.fi()),h||v||a?(r=this.ei(),o=this.ti(),Po.info("new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:h,activityTimeout:v,sessionPastMaximumLength:a}}),s=i,l=!0):(o||(o=this.ti(),l=!0),(u=r!==d)&&(Po.info("adopted cross-tab session id",{sessionId:r,windowId:o}),l=!0));var c=Y(n)&&t&&!a?n:i,f=Y(s)?s:(new Date).getTime();this.li(o),this.oi(r,c,f),t||this.ri();var p={noSessionId:h,activityTimeout:v,sessionPastMaximumLength:a,crossTabAdoption:u};return l&&this.Zr.forEach((t=>t(r,o,p))),{sessionId:r,windowId:o,sessionStartTimestamp:f,changeReason:l?p:void 0,lastActivityTimestamp:n}}ri(){this.Jr||(clearTimeout(this.mi),this.mi=setTimeout((()=>{if(!this.Jr)if(this.gi((new Date).getTime())){var t=this.Xr;this.resetSessionId(),this.Wr.emit("forcedIdleReset",{idleSessionId:t})}else this.ri()}),1.1*this.sessionTimeoutMs))}}var Io=function(t,e){if(!t)return!1;var i=t.userAgent;if(i&&M(i,e))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>M(null==t?void 0:t.brand,e))))return!0}catch(t){}return!!t.webdriver},Ro=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 Co(t,e,i){return co({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:i})}var Fo={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=>Ro(e,t))))),not_regex:(t,e)=>e.every((e=>t.every((t=>!Ro(e,t))))),icontains:(t,e)=>e.map(Mo).some((e=>t.map(Mo).some((t=>e.includes(t))))),not_icontains:(t,e)=>e.map(Mo).every((e=>t.map(Mo).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)))}))},Mo=t=>t.toLowerCase();function Oo(t,e){return!t||Object.entries(t).every((t=>{var[i,r]=t,s=null==e?void 0:e[i];if(q(s)||W(s))return!1;var n=[String(s)],o=Fo[r.operator];return!!o&&o(r.values,n)}))}var Ao="custom",Do="i.posthog.com",Lo=/^\/static\//;class jo{constructor(t){this.yi={},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("."+Do,".posthog.com")),"https://app.posthog.com"===e?"https://us.posthog.com":e}get region(){return this.yi[this.apiHost]||(this.yi[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":Ao),this.yi[this.apiHost]}bi(t){if(Lo.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.bi(e);if(i)return""+i+e}if(this.region===Ao)return this.apiHost+e;var r=Do+e;switch(t){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var zo=li("[Surveys]"),No="seenSurvey_",Uo=["popover","widget","api"],Bo={ignoreConditions:!1,ignoreDelay:!1,displayType:xn},Ho=li("[PostHog ExternalIntegrations]"),qo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Go{constructor(t){this._instance=t}Mt(t,e){var i;null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,t,(t=>{if(t)return Ho.error("failed to load script",t);e()}))}startIfEnabledOrStop(){var t=this,e=function(e){var i,s,n;!r||null!=(i=h.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[e]||t.Mt(qo[e],(()=>{var i;null==(i=h.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[e])||i.start(t._instance)})),!r&&null!=(s=h.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[e]&&(null==(n=h.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[e])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;e(i)}}}var Vo,Wo={},Jo=0,Ko=()=>{},Yo='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Qo="Surveys module not available",Xo="sanitize_properties is deprecated. Use before_send instead",Zo="Invalid value for property_denylist config: ",ta="posthog",ea=!ao&&-1===(null==u?void 0:u.indexOf("MSIE"))&&-1===(null==u?void 0:u.indexOf("Mozilla")),ia=e=>{var i;return p({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Tr(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Ko,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&G(null==s?void 0:s.search)&&-1!==s.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(i=t.location)?void 0:i.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){ai.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:cr,before_send:void 0,request_queue_config:{flush_interval_ms:yo},error_tracking:{},_onCapture:Ko},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:fs,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-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}: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),disable_capture_url_hashes:!(!t||"2026-06-25">t)}))(e))},ra=[["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"]],sa=t=>{var e={};for(var[i,r]of ra)q(t[i])||(e[r]=t[i]);var s=xr({},e,t),n=t.__preview_external_dependency_versioned_paths;return q(n)||(q(t.strict_script_versioning)&&(s.strict_script_versioning=!!n),G(n)&&q(t.asset_host)&&(s.asset_host=n)),N(t.property_blacklist)&&(q(t.property_denylist)?s.property_denylist=t.property_blacklist:N(t.property_denylist)?s.property_denylist=[...t.property_blacklist,...t.property_denylist]:ai.error(Zo+t.property_denylist)),s};class na{constructor(){this.__forceAllowLocalhost=!1}get wi(){return this.__forceAllowLocalhost}set wi(t){ai.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class oa{xi(t,e){if(t){var i=this.ki.indexOf(t);-1!==i&&this.ki.splice(i,1)}return this.ki.push(e),null==e.initialize||e.initialize(),e}Si(){return this.config.cookieless_mode===hr||this.config.cookieless_mode===ur&&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 na,this.Ci=!1,this.version=v.LIB_VERSION,this.Ii=new $o,this.ki=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=ia(),this.SentryIntegration=Us,this.sentryIntegration=t=>function(t,e){var i=Ns(t,e);return{name:zs,processEvent:t=>i(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ti=!1,this.Ei=null,this.Mi=null,this.Pi=null,this.scrollManager=new So(this),this.pageViewManager=new Bs(this),this.rateLimiter=new En(this),this.requestRouter=new jo(this),this.consent=new Jr(this),this.externalIntegrations=new Go(this);var e=null!==(t=oa.__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=G(t)?{[t]:e}:t;this.setPersonProperties(r),null==i||i({})},set_once:(t,e,i)=>{var r=G(t)?{[t]:e}:t;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",(t=>ai.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,e,i){if(i&&i!==ta){var r,s=null!==(r=Wo[i])&&void 0!==r?r:new oa;return s._init(t,e,i),Wo[i]=s,Wo[ta][i]=s,s}return this._init(t,e,i)}_init(e,i,r){var s,n;void 0===i&&(i={});var o=G(e)?e.trim():"";if(!o)return ai.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},i.debug=this.Ri(i.debug),this.Oi=i,this.Li=[],i.person_profiles?this.Mi=i.person_profiles:i.process_person&&(this.Mi=i.process_person);var a=ia(i.defaults),l=sa(i),u=xr({},a,l,{name:r,token:o});B(a.rageclick)&&B(l.rageclick)&&(u.rageclick=xr({},a.rageclick,l.rageclick)),B(a.session_recording)&&B(l.session_recording)&&(u.session_recording=xr({},a.session_recording,l.session_recording)),this.set_config(u),this.config.on_xhr_error&&ai.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Pn;var h=this.Fi();this.persistence=new gn(this.config,h),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new gn(p({},this.config,{persistence:"sessionStorage"}),h,!1);var d=p({},this.persistence.props),c=p({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Ai=new bo((t=>this.$i(t)),this.config.request_queue_config),this.Di=new xo(this),this.__request_queue=[];var f=this.Si();if(f||(this.sessionManager=new To(this),this.sessionPropsManager=new ko(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(ai.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.Ni(f)}),0)):(ai.info("Initializing extensions synchronously"),this.Ni(f)),v.DEBUG=v.DEBUG||this.config.debug,v.DEBUG&&ai.info("Starting in debug mode",{this:this,config:i,thisC:p({},this.config),p:d,s:c}),!this.config.identity_distinct_id||null!=(s=i.bootstrap)&&s.distinctID||(i.bootstrap=p({},i.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=i.bootstrap)?void 0:n.distinctID)){var g=i.bootstrap.distinctID,_=this.get_distinct_id(),m=this.persistence.get_property(Yi);if(i.bootstrap.isIdentifiedID&&null!=_&&_!==g&&m===dr)this.identify(g);else if(i.bootstrap.isIdentifiedID&&null!=_&&_!==g&&m===vr)ai.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 y=this.config.get_device_id(Dr()),b=i.bootstrap.isIdentifiedID?y:g;this.persistence.set_property(Yi,i.bootstrap.isIdentifiedID?vr:dr),this.register({distinct_id:g,$device_id:b})}}if(f)this.register_once({distinct_id:sr,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id(Dr());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(Yi,dr)}return Ir(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),i.segment?function(t,e){var i=t.config.segment;if(!i)return e();!function(t,e){var i=t.config.segment;if(!i)return e();var r=i=>{var r=()=>i.anonymousId()||Dr();t.config.get_device_id=r,i.id()&&(t.register({distinct_id:i.id(),$device_id:r()}),t.persistence.set_property(Yi,vr)),e()},s=i.user();"then"in s&&U(s.then)?s.then(r):r(s)}(t,(()=>{i.register((t=>{Promise&&Promise.resolve||js.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()||(js.info("No userId set, resetting PostHog"),t.reset()),e.event.userId&&e.event.userId!==t.get_distinct_id()&&(js.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,gr),identify:t=>e(t,mr),screen:t=>e(t,"$screen")}})(t)).then((()=>{e()}))}))}(this,(()=>this.qi())):this.qi(),U(this.config._onCapture)&&this.config._onCapture!==Ko&&(ai.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&ai.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}Ni(t){var e,i,r,s,n,o,a,l=performance.now(),u=p({},oa.__defaultExtensionClasses,this.config.__extensionClasses),h=[];u.featureFlags&&this.ki.push(this.featureFlags=null!==(e=this.featureFlags)&&void 0!==e?e:new u.featureFlags(this)),u.exceptions&&this.ki.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new u.exceptions(this)),u.historyAutocapture&&this.ki.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.ki.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.ki.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!t&&this.ki.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||h.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),u.autocapture&&this.ki.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.ki.push(this.surveys=null!==(r=this.surveys)&&void 0!==r?r:new u.surveys(this)),u.logs&&this.ki.push(this.logs=null!==(s=this.logs)&&void 0!==s?s:new u.logs(this)),u.conversations&&this.ki.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new u.conversations(this)),u.productTours&&this.ki.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.ki.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.ki.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.ki.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.ki.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,Ds)),u.toolbar&&this.ki.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new u.toolbar(this)),u.experiments&&this.ki.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new u.experiments(this)),this.ki.forEach((t=>{t.initialize&&h.push((()=>{null==t.initialize||t.initialize()}))})),h.push((()=>{if(this.Bi){var t=this.Bi;this.Bi=void 0,this.pr(t)}})),this.ji(h,l)}ji(t,e){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-e>=30&&t.length>0)return void setTimeout((()=>{this.ji(t,e)}),0);var i=t.shift();if(i)try{i()}catch(t){ai.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-e);this.register_for_session({[nr]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[or]:r}),this.config.__preview_deferred_init_extensions&&ai.info("PostHog extensions initialized ("+r+"ms)")}pr(t){var e;if(!r||!r.body)return ai.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.pr(t)}),500);this.config.__preview_deferred_init_extensions&&(this.Bi=t),this.Hi=t,this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=O(t.supportedCompression,Pn)?Pn:O(t.supportedCompression,Tn)?Tn:void 0),null!=(e=t.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this.Mi?this.Mi:cr}),this.ki.forEach((e=>null==e.onRemoteConfig?void 0:e.onRemoteConfig(t)))}qi(){try{this.config.loaded(this)}catch(t){ai.critical("`loaded` function failed",t)}if(this.Ui(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.hostname,e=this.config.internal_or_test_user_hostname;("string"==typeof e?t===e:e.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Si())&&this.zi()}),1),this.Vi=new $n(this),this.Vi.load()}Ui(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Ai)||t.enable())}_dom_loaded(){this.is_capturing()&&br(this.__request_queue,(t=>this.$i(t))),this.__request_queue=[],this.Ui()}_handle_unload(){var t,e,i,r;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),this.config.request_batching?(this.Wi()&&this.capture(_r),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(i=this.Ai)||i.unload(),null==(r=this.Di)||r.unload()):this.Wi()&&this.capture(_r,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?ea?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=p({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,(q(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,i,r,s=p({},t);s.timeout=s.timeout||6e4,s.url=_o(s.url,s.compression);var n=null!==(e=s.transport)&&void 0!==e?e:"fetch",o=mo.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),a=null!==(i=null==(r=function(t,e){for(var i=0;t.length>i;i++)if(t[i].transport===n)return t[i]}(o))?void 0:r.method)&&void 0!==i?i:o[0].method;if(!a)throw new Error("No available transport method");"sendBeacon"!==n&&s.data&&s.compression===Pn&&l&&!uo?go(s).then((t=>{a(t)})).catch((e=>{if(T(e))return uo=!0,void a(p({},s,{compression:void 0,url:_o(t.url,void 0)}));(t=>{if(!t||"object"!=typeof t)return!1;var e="name"in t?String(t.name):"";return T(t)||e===k})(e)&&(uo=!0),a(s)})):a(s)})(p({},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}))}$i(t){this.Di?this.Di.retriableRequest(t):this._send_request(t)}_execute_array(t){Jo++;try{var e,i=[],r=[],s=[];br(t,(t=>{if(t)if(N(e=t[0]))s.push(t);else if(U(t))try{t.call(this)}catch(e){ai.error("Error executing queued PostHog call",t,e)}else N(t)&&"alias"===e?i.push(t):N(t)&&-1!==e.indexOf("capture")&&U(this[e])?s.push(t):r.push(t)}));var n=function(t,e){br(t,(function(t){try{if(N(t[0])){var i=e;wr(t,(function(t){i=i[t[0]].apply(i,t.slice(1))}))}else e[t[0]].apply(e,t.slice(1))}catch(e){ai.error("Error executing queued PostHog call",t,e)}}))};n(i,this),n(r,this),n(s,this)}finally{Jo--}}push(t){if(Jo>0&&N(t)&&G(t[0])){var e=oa.prototype[t[0]];U(e)&&e.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,e,i){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ai){if(this.is_capturing())if(!q(t)&&G(t)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=e&&e.$current_url&&!G(null==e?void 0:e.$current_url)&&(ai.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==e||delete e.$current_url),"$exception"!==t||null!=i&&i.Gi||ai.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var h=new Date,d=(null==i?void 0:i.timestamp)||h,v=fe(null==i?void 0:i.uuid,Dr),c={uuid:v,event:t,properties:this.calculateEventProperties(t,e||{},d,v)};t===gr&&this.config.__preview_capture_bot_pageviews&&l&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),u&&(c.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==i?void 0:i.$set)&&(c.$set=null==i?void 0:i.$set);var f=null==i?void 0:i.$unset;f&&(c.$unset=f);var g,_,m,y=this.Zi(null==i?void 0:i.$set_once,t!==yr,t===mr);if(y&&(c.$set_once=y),null!=i&&i._noTruncate||(s=this.config.properties_string_max_length,n=c,o=t=>G(t)?t.slice(0,s):t,a=new Set,c=function t(e,i){return e!==Object(e)?o?o(e):e:a.has(e)?void 0:(a.add(e),N(e)?(r=[],br(e,(e=>{r.push(t(e))}))):(r={},wr(e,((e,i)=>{a.has(e)||(r[i]=t(e,i))}))),r);var r}(n)),c.timestamp=d,q(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=h),t===bn||t===wn){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})(No,t))(t);if(localStorage.getItem(e))return;localStorage.setItem(e,"true")}catch(t){zo.error("Failed to persist survey seen state",t)}})({id:b,current_iteration:w}),c.$set=p({},c.$set,{[(g={id:b,current_iteration:w},_=t===wn?"responded":"dismissed",m="$survey_"+_+"/"+g.id,g.current_iteration&&g.current_iteration>0&&(m="$survey_"+_+"/"+g.id+"/"+g.current_iteration),m)]:!0})}else t===yn&&(c.$set=p({},c.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===t){var x=null==e?void 0:e.$product_tour_type;x&&(c.$set=p({},c.$set,{["$product_tour_last_seen_date/"+x]:(new Date).toISOString()}))}var S=p({},c.properties.$set,c.$set);if(H(S)||this.setPersonPropertiesForFlags(S),!J(this.config.before_send)){var E=this.it(c);if(!E)return;(c=E).uuid=fe(c.uuid,Dr)}this.Ii.emit("eventCaptured",c);var k={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:null==i?void 0:i._batchKey,transport:null==i?void 0:i.transport};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.$i(k):this.Ai.enqueue(k),c}ai.critical("This capture call is ignored due to client rate limiting.")}}else ai.error("No event name provided to posthog.capture")}else ai.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(e=>t(e.event,e)))}calculateEventProperties(e,i,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return i;var l=a?void 0:this.persistence.remove_event_timer(e),h=p({},i);if(h.token=this.config.token,h.$config_defaults=this.config.defaults,this.Si()&&(h.$cookieless_mode=!0),"$snapshot"===e){var d=p({},this.persistence.properties(),this.sessionPersistence.properties());return h.distinct_id=d.distinct_id,(!G(h.distinct_id)&&!K(h.distinct_id)||V(h.distinct_id))&&ai.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),h}var c,f=function(e,i,r,n){var o,a,l,h;if(void 0===n&&(n=!1),!u)return{};var d,c,f,p,g,_,m,y,b,w=e?[...Xs,...i||[]]:[],[x,S]=function(t){for(var e=0;de.length>e;e++){var[i,r]=de[e],s=i.exec(t),n=s&&(U(r)?r(s,t):r);if(n)return n}return["",""]}(u),E=null!=(d="undefined"!=typeof navigator?navigator:void 0)&&d.brave?{brave:!0}:{},k={detectGoogleSearchApp:r},P=xr($r({$os:x,$os_version:S,$browser:le(u,navigator.vendor,E,k),$device:ve(u),$device_type:(f=u,p={userAgentDataPlatform:null==(o=navigator)||null==(o=o.userAgentData)?void 0:o.platform,maxTouchPoints:null==(a=navigator)?void 0:a.maxTouchPoints,screenWidth:null==t||null==(l=t.screen)?void 0:l.width,screenHeight:null==t||null==(h=t.screen)?void 0:h.height,devicePixelRatio:null==t?void 0:t.devicePixelRatio},b=ve(f),b===ft||b===ct||"Kobo"===b||"Kindle Fire"===b||b===qt?vt:b===Mt||b===At||b===Ot||b===Ut?"Console":b===gt?"Wearable":b?ut:"Android"===(null==p?void 0:p.userAgentDataPlatform)&&(null!==(g=null==p?void 0:p.maxTouchPoints)&&void 0!==g?g:0)>0?600>Math.min(null!==(_=null==p?void 0:p.screenWidth)&&void 0!==_?_:0,null!==(m=null==p?void 0:p.screenHeight)&&void 0!==m?m:0)/(null!==(y=null==p?void 0:p.devicePixelRatio)&&void 0!==y?y:1)?ut:vt:"Desktop"),$timezone:dn(),$timezone_offset:vn()}),{$current_url:Ks(n?pe(null==s?void 0:s.href):null==s?void 0:s.href,w,tn),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:u.length>1e3?u.substring(0,997)+"...":u,$browser_version:he(u,navigator.vendor,E,k),$browser_language:on(),$browser_language_prefix:(c=on(),"string"==typeof c?c.split("-")[0]:void 0),$screen_height:null==t?void 0:t.screen.height,$screen_width:null==t?void 0:t.screen.width,$viewport_height:null==t?void 0:t.innerHeight,$viewport_width:null==t?void 0:t.innerWidth,$lib:v.LIB_NAME,$lib_version:v.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return v.SDK_DIST_CHANNEL&&(P.$sdk_dist_channel=v.SDK_DIST_CHANNEL),P}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var{sessionId:g,windowId:_}=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime());h.$session_id=g,h.$window_id=_}this.sessionPropsManager&&xr(h,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&xr(h,this.sessionRecording.sdkDebugProperties),h.$sdk_debug_retry_queue_size=null==(m=this.Di)?void 0:m.length}catch(t){h.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===Ao&&(h.$lib_custom_api_host=this.config.api_host),c=e!==gr||a?e!==_r||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),h=xr(h,c),e===gr&&r&&(h.title=r.title),!q(l)){var y=n.getTime()-l;h.$duration=parseFloat((y/1e3).toFixed(3))}u&&this.config.opt_out_useragent_filter&&(h.$browser_type=this._is_bot()?"bot":"browser"),(h=xr({},f,this.persistence.properties(),this.sessionPersistence.properties(),h)).$is_identified=this._isIdentified(),N(this.config.property_denylist)?wr(this.config.property_denylist,(function(t){delete h[t]})):ai.error(Zo+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(ai.error(Xo),h=b(h,e));var w=this.Qi();return h.$process_person_profile=w,w&&!a&&this.Ji("_calculate_event_properties"),h}Zi(t,e,i){var r;if(void 0===e&&(e=!0),void 0===i&&(i=!1),!this.persistence||!this.Qi())return t;if(this.Ci&&!i)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=xr({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(ai.error(Xo),o=a(o,"$set_once")),e&&(this.Ci=!0),H(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)}Yi(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.Ii.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:Qo}),()=>{})}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:Qo})}getActiveMatchingSurveys(t,e){void 0===e&&(e=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,e):t([],{isLoaded:!1,error:Qo})}renderSurvey(t,e){var i;null==(i=this.surveys)||i.renderSurvey(t,e)}displaySurvey(t,e){var i;void 0===e&&(e=Bo),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:Qo}}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:Qo})}Ki(t){return!t||V(t)?(ai.critical("Unique user id has not been set in posthog.identify"),!1):t===sr?(ai.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())||(ai.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 ai.uninitializedWarning("posthog.identify");if(K(t)&&(t=t.toString(),ai.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Ki(t)&&this.Ji("posthog.identify")){var r=this.get_distinct_id();this.register({$user_id:t}),this.get_property(vi)||this.register_once({$had_persisted_distinct_id:!0,$device_id:r},""),t!==r&&t!==this.get_property(ci)&&(this.unregister(ci),this.register({distinct_id:t}));var s,n=(this.persistence.get_property(Yi)||dr)===dr;t!==r&&n?(this.persistence.set_property(Yi,vr),this.setPersonPropertiesForFlags({$set:e||{},$set_once:i||{}},!1),this.capture(mr,{distinct_id:t,$anon_distinct_id:r},{$set:e||{},$set_once:i||{}}),this.Pi=Co(t,e,i),null==(s=this.featureFlags)||s.setAnonymousDistinctId(r)):(e||i)&&this.setPersonProperties(e,i),t!==r&&(this.reloadFeatureFlags(),this.unregister(Vi))}}setPersonProperties(t,e){if((t||e)&&this.Ji("posthog.setPersonProperties")){var i=Co(this.get_distinct_id(),t,e);this.Pi!==i?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:e||{}},!0),this.capture("$set",{$set:t||{},$set_once:e||{}}),this.Pi=i):ai.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var e,i=(N(t)?t:[t]).filter((t=>G(t)&&t.length>0));0!==i.length&&this.Ji("posthog.unsetPersonProperties")&&(null==(e=this.featureFlags)||e.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.Pi=null)}group(t,e,i){if(t&&e){var r=this.getGroups(),s=r[t]!==e;if(s&&this.resetGroupPropertiesForFlags(t),this.register({$groups:p({},r,{[t]:e})}),s||i){var n={$group_type:t,$group_key:e};i&&(n.$group_set=i),this.capture(yr,n)}i&&this.setGroupPropertiesForFlags({[t]:i}),s&&!i&&this.reloadFeatureFlags()}else ai.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.Ji("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(t,e))}resetGroupPropertiesForFlags(t){var e;null==(e=this.featureFlags)||e.resetGroupPropertiesForFlags(t)}reset(t){var e,i,r,s,n,o,a,l,u;if(ai.info("reset"),!this.__loaded)return ai.uninitializedWarning("posthog.reset");var h,d=this.get_property(vi),v=this.get_property(Ei);if(this.consent.reset(),null==(e=this.persistence)||e.clear(),null==(i=this.sessionPersistence)||i.clear(),q(v)||null==(h=this.persistence)||h.register({[Ei]:v}),null==(r=this.surveys)||r.reset(),null==(s=this.Vi)||s.stop(),null==(n=this.featureFlags)||n.reset(),null==(o=this.conversations)||o.reset(),null==(a=this.logs)||a.reset(),null==(l=this.persistence)||l.set_property(Yi,dr),null==(u=this.sessionManager)||u.resetSessionId(),this.Pi=null,this.config.cookieless_mode===hr)this.register_once({distinct_id:sr,$device_id:null},"");else{var c=this.config.get_device_id(Dr());this.register_once({distinct_id:c,$device_id:t?c:d},"")}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.Xi()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.en()}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(di)?(ai.critical("Attempting to create alias for existing People user - aborting."),-2):this.Ji("posthog.alias")?(q(e)&&(e=this.get_distinct_id()),t!==e?(this.Yi(ci,t),this.capture("$create_alias",{alias:t,distinct_id:e})):(ai.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var e=p({},this.config);if(B(t)){var i,r,s,n,o,a,l,u,h,d,c;xr(this.config,sa(t));var f=this.Fi();null==(i=this.persistence)||i.update_config(this.config,e,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new gn(p({},this.config,{persistence:"sessionStorage"}),f,!1);var g=this.Ri(this.config.debug);Q(g)&&(this.config.debug=g),Q(this.config.debug)&&(this.config.debug?(v.DEBUG=!0,Br.N()&&Br.q("ph_debug",!0),ai.info("set_config",{config:t,oldConfig:e,newConfig:p({},this.config)})):(v.DEBUG=!1,Br.N()&&Br.A("ph_debug"))),null==(r=this.exceptionObserver)||r.onConfigChange(),null==(s=this.exceptions)||s.onConfigChange(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),null==(o=this.tracingHeaders)||o.startIfEnabledOrStop(),null==(a=this.autocapture)||a.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(h=this.deadClicksAutocapture)||h.startIfEnabledOrStop(),null==(d=this.surveys)||d.loadIfEnabled(),this.tn(),null==(c=this.externalIntegrations)||c.startIfEnabledOrStop()}}_overrideSDKInfo(t,e){v.LIB_NAME=t,v.LIB_VERSION=e}startSessionRecording(t){var e,i,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(e=this.sessionManager)||e.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,e){if(this.exceptions){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(p({},r,e))}}addExceptionStep(t,e){var i;null==(i=this.exceptions)||i.addExceptionStep(t,e)}captureLog(t){var e;null==(e=this.logs)||e.captureLog(t)}get logger(){var t,e;return null!==(t=null==(e=this.logs)?void 0:e.logger)&&void 0!==t?t:oa.rn}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:ta;return e!==ta&&(e=ta+"."+e),e}_isIdentified(){var t,e;return(null==(t=this.persistence)?void 0:t.get_property(Yi))===vr||(null==(e=this.sessionPersistence)?void 0:e.get_property(Yi))===vr}Qi(){var t,e;return!("never"===this.config.person_profiles||this.config.person_profiles===cr&&!this._isIdentified()&&H(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[ci])&&(null==(e=this.persistence)||null==(e=e.props)||!e[ir]))}Wi(){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.Qi()||this.Ji("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Ji("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Ji(t){return"never"===this.config.person_profiles?(ai.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Yi(ir,!0),!0)}Fi(){if("always"===this.config.cookieless_mode)return!0;var t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==ur)}tn(){var t,e,i,r,s=this.Fi();return(null==(t=this.persistence)?void 0:t.Vt)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(e=this.sessionPersistence)?void 0:e.Vt)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(t){var e;if(this.config.cookieless_mode!==hr){if(this.Si()){var i,r,s,n,o;this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new To(this),this.pageViewManager=new Bs(this),this.persistence&&(this.sessionPropsManager=new ko(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=oa.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.xi(this.sessionRecording,new l(this)),this.Hi&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Hi)))}var u,h;this.consent.optInOut(!0),this.tn(),this.Ui(),null==(e=this.sessionRecording)||e.startIfEnabledOrStop(),this.config.cookieless_mode==ur&&(null==(u=this.surveys)||u.loadIfEnabled()),(q(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.zi()}else ai.warn(Yo)}opt_out_capturing(){var t,e,i;this.config.cookieless_mode!==hr?(this.config.cookieless_mode===ur&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.tn(),this.config.cookieless_mode===ur&&(this.register({distinct_id:sr,$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.zi(),this.Ui())):ai.warn(Yo)}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===hr||(this.config.cookieless_mode===ur?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.tn()}_is_bot(){return i?Io(i,this.config.custom_blocked_useragents):void 0}zi(){r&&("visible"===r.visibilityState?this.Ti||(this.Ti=!0,this.capture(gr,{title:r.title},{send_instantly:!0}),this.Ei&&(r.removeEventListener(fr,this.Ei),this.Ei=null)):this.Ei||(this.Ei=this.zi.bind(this),Ir(r,fr,this.Ei)))}debug(e){!1===e?(null==t||t.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==t||t.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}mr(){var t,e,i,r,s,n,o=this.Oi||{};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?(ai.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=ai,s=(e="advanced_disable_flags")in(t=o)&&!J(t[e]),n=i in t&&!J(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]))}it(t){var e;if(J(this.config.before_send))return t;var i=Object.keys(null!==(e=t.properties)&&void 0!==e?e:{}).filter(tt),r=N(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r){if(s=n(s),J(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return Z(t.event)?ai.warn(o+". This can cause unexpected behavior."):ai.info(o),null}s.properties&&!H(s.properties)||ai.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}for(var a of i)if(s.properties&&J(s.properties[a]))return ai.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.Ot)?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)})}Ri(t){var e=Q(t)&&!t,i=Br.N()&&"true"===Br.P("ph_debug");return!e&&(!!i||t)}}oa.__defaultExtensionClasses={},oa.rn={trace:Vo=()=>{},debug:Vo,info:Vo,warn:Vo,error:Vo,fatal:Vo},function(t,e){for(var i=0;e.length>i;i++)t.prototype[e[i]]=kr(t.prototype[e[i]])}(oa,["identify"]);class aa{constructor(t){this.disabled=!1===t;var e=B(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 la="$copy_autocapture",ua=li("[AutoCapture]");function ha(t,e){return e.length>t?e.slice(0,t)+"...":e}function da(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do{e=e.previousSibling}while(e&&!Zr(e));return e}function va(e,i){var r,s,{e:n,maskAllElementAttributes:o,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:u,disableCaptureUrlHashes:h}=i;if(!Zr(e))return{props:{}};for(var d=[e],v=e;v.parentNode&&!ts(v,"body");)if(is(v.parentNode))d.push(v.parentNode.host),v=v.parentNode.host;else{if(!Zr(v.parentNode))break;d.push(v.parentNode),v=v.parentNode}var c,f,g=[],_={},m=!1,y=!1;if(wr(d,(t=>{var e=ws(t);if(ts(t,"a")){var i=t.getAttribute("href");m=!!(e&&i&&Is(i))&&(h?pe(i):i)}O(ns(t),"ph-no-capture")&&(y=!0),g.push(function(t,e,i,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};us.indexOf(n)>-1&&!i&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?ha(1024,Rs(t)):ha(1024,as(t)));var a=ns(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),wr(t.attributes,(function(i){var n;if((!xs(t)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!e&&Is(i.value)&&(!G(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=i.value;"class"===i.name&&(a=rs(a).join(" ")),o["attr__"+i.name]=ha(1024,"href"===i.name&&s?pe(a):a)}}));for(var l=1,u=1,h=t;h=da(h);)l++,h.tagName===t.tagName&&u++;return o.nth_child=l,o.nth_of_type=u,o}(t,o,a,l,h));var r=function(t){if(!ws(t))return{};var e={};return wr(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&&Is(r)&&(e[i]=r)}})),e}(t);xr(_,r)})),y)return{props:{},explicitNoCapture:y};if(a||(g[0].$el_text=ts(e,"a")||ts(e,"button")?Rs(e):as(e)),m){var b,w;g[0].attr__href=m;var x=null==(b=Ws(m))?void 0:b.host,S=null==t||null==(w=t.location)?void 0:w.host;x&&S&&x!==S&&(c=m)}return{props:xr({$event_type:n.type,$ce_version:1},u?{}:{$elements:g},{$elements_chain:(f=g,function(t){return t.map((t=>{var e,i,r="";if(t.tag_name&&(r+=t.tag_name),t.attr_class)for(var s of(t.attr_class.sort(),t.attr_class))r+="."+s.replace(/"/g,"");var n=p({},t.text?{text:t.text}:{},{"nth-child":null!==(e=t.nth_child)&&void 0!==e?e:0,"nth-of-type":null!==(i=t.nth_of_type)&&void 0!==i?i:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return Sr(n).sort(((t,e)=>{var[i]=t,[r]=e;return i.localeCompare(r)})).forEach((t=>{var[e,i]=t;return o[Fs(e.toString())]=Fs(i.toString())})),(r+=":")+Sr(o).map((t=>{var[e,i]=t;return e+'="'+i+'"'})).join("")})).join(";")}(function(t){return t.map((t=>{var e,i,r={text:null==(e=t.$el_text)?void 0:e.slice(0,400),tag_name:t.tag_name,href:null==(i=t.attr__href)?void 0:i.slice(0,2048),attr_class:Ms(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return Sr(t).filter((t=>{var[e]=t;return 0===e.indexOf("attr__")})).forEach((t=>{var[e,i]=t;return r.attributes[e]=i})),r}))}(f)))},null!=(r=g[0])&&r.$el_text?{$el_text:null==(s=g[0])?void 0:s.$el_text}:{},c&&"click"===n.type?{$external_click_url:c}:{},_)}}var ca=li("[ExceptionAutocapture]"),fa=li("[TracingHeaders]"),pa=li("[Web Vitals]"),ga=9e5,_a="disabled",ma="lazy_loading",ya="awaiting_config",ba="missing_config";li("[SessionRecording]"),li("[SessionRecording]");var wa="[SessionRecording]",xa=li(wa),Sa=li("[Heatmaps]");function Ea(t){return B(t)&&"clientX"in t&&"clientY"in t&&K(t.clientX)&&K(t.clientY)}var ka=li("[Product Tours]"),$a=t=>{var e;return!t.config.disable_product_tours&&!(null==(e=t.persistence)||!e.get_property(xi))},Pa=["$set_once","$set"],Ta=li("[SiteApps]"),Ia="Error while initializing PostHog app with config id ";function Ra(t,e,i){if(J(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 Ca{constructor(t){this.nn=new $o,this.sn=(t,e)=>this.an(t,e)&&this.ln(t,e)&&this.un(t,e)&&this.hn(t,e),this.an=(t,e)=>null==e||!e.event||(null==t?void 0:t.event)===(null==e?void 0:e.event),this._instance=t,this.dn=new Set,this.cn=new Set}init(){var t,e;q(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(!q(null==(e=this._instance)?void 0:e._addCaptureHook)&&(t.forEach((t=>{var e,i;null==(e=this.cn)||e.add(t),null==(i=t.steps)||i.forEach((t=>{var e;null==(e=this.dn)||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.dn.has(t)||this.dn.has(null==e?void 0:e.event))&&this.cn&&(null==(i=this.cn)?void 0:i.size)>0&&this.cn.forEach((t=>{this.vn(e,t)&&this.nn.emit("actionCaptured",t.name)}))}fn(t){this.onAction("actionCaptured",(e=>t(e)))}vn(t,e){if(null==(null==e?void 0:e.steps))return!1;for(var i of e.steps)if(this.sn(t,i))return!0;return!1}onAction(t,e){return this.nn.on(t,e)}ln(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(!Ra(r,e.url,e.url_matching||"contains"))return!1}return!0}un(t,e){return!!this.pn(t,e)&&!!this.gn(t,e)&&!!this.mn(t,e)}pn(t,e){var i;if(null==e||!e.href)return!0;var r=this.yn(t);if(r.length>0)return r.some((t=>Ra(t.href,e.href,e.href_matching||"exact")));var s,n=(null==t||null==(i=t.properties)?void 0:i.$elements_chain)||"";return!!n&&Ra((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",e.href,e.href_matching||"exact")}gn(t,e){var i;if(null==e||!e.text)return!0;var r=this.yn(t);if(r.length>0)return r.some((t=>Ra(t.text,e.text,e.text_matching||"exact")||Ra(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;!J(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=>Ra(t,n,o))))}mn(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}yn(t){var e;return null==(null==t||null==(e=t.properties)?void 0:e.$elements)?[]:null==t?void 0:t.properties.$elements}hn(t,e){return null==e||!e.properties||0===e.properties.length||Oo(e.properties.reduce(((t,e)=>{var i=N(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 Fa{constructor(t){this.bn=[],this._instance=t,this._n=new Map,this.wn=new Map,this.xn=new Map}kn(t,e){return!!t&&Oo(t.propertyFilters,null==e?void 0:e.properties)}Sn(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}Cn(t,e,i){var r=(i===_n?this._n:this.wn).get(t),s=[];return this.In((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.kn(n,e)}))}register(t){var e;q(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.Tn(t),this.En(t))}En(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.Mn&&(this.Mn=new Ca(this._instance),this.Mn.init(),this.Mn.fn((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.Mn)||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.xn.get(e.name);i&&i.push(t.id),this.xn.set(e.name,i||[t.id])}})))})))}Tn(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._n=this.Sn(t,_n),this.wn=this.Sn(t,mn))}onEvent(t,e){var i,r,s=this.Pn(),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.Rn(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.On([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),void this.Ln(n)}if(this.wn.has(t)){var a=this.Cn(t,e,mn);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.On(a.map((t=>t.id))),a.forEach((t=>this.Fn(t.id))))}if(this._n.has(t)){s.info("event name matched",{event:t,eventPayload:e,items:this._n.get(t)});var l=this.Cn(t,e,_n);this.An(l.map((t=>t.id)))}}onAction(t){this.xn.has(t)&&this.An(this.xn.get(t)||[])}An(t){0!==t.length&&(this.bn=[...new Set([...this.bn,...t])],this.Pn().info("updating activated items",{activatedItems:this.getActivatedIds()}))}Ln(t){this.bn=this.bn.filter((e=>e!==t));var e=this.$n();e.includes(t)||this.Dn([...e,t])}On(t){var e=new Set(t);this.bn=this.bn.filter((t=>!e.has(t)));var i=this.$n(),r=i.filter((t=>!e.has(t)));r.length!==i.length&&this.Dn(r)}$n(){var t,e=this.Nn();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[e])||[]}getActivatedIds(){return[...new Set([...this.$n(),...this.bn])].filter((t=>!this.qn(t)))}reset(){this.bn=[],this.$n().length>0&&this.Dn([])}getEventToItemsMap(){return this._n}Bn(){return this.Mn}}class Ma extends Fa{constructor(t){super(t)}Nn(){return qi}jn(){return yn}In(t){var e;null==(e=this._instance)||e.getSurveys(t)}Fn(t){var e;null==(e=this._instance)||e.cancelPendingSurvey(t)}Pn(){return zo}Dn(t){var e;null==(e=this._instance)||null==(e=e.persistence)||e.register({[qi]:t})}qn(){return!1}Rn(t,e){var i;this.In((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===yn?"consume":"ignore":t===yn?"persist":t===bn||t===wn?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var Oa="SDK is not enabled or survey functionality is not yet loaded",Aa="Disabled. Not loading surveys.",Da=null!=t&&t.location?Ys(t.location.hash,"__posthog")||Ys(location.hash,"state"):null,La="_postHogToolbarParams",ja=li("[Toolbar]"),za=li("[FeatureFlags]"),Na=li("[FeatureFlags]",{debugEnabled:!0}),Ua="\" failed. Feature flags didn't load in time.",Ba=t=>{for(var e={},i=0;t.length>i;i++)e[t[i]]=!0;return e},Ha=t=>{var e={};for(var[i,r]of Sr(t||{}))r&&(e[i]=r);return e},qa=li("[Error tracking]"),Ga="Refusing to render web experiment since the viewer is a likely bot",Va={icontains:(e,i)=>!!t&&i.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,i)=>!!t&&-1===i.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,i)=>!!t&&Ro(i.href,e),not_regex:(e,i)=>!!t&&!Ro(i.href,e),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class Wa{get Se(){return this._instance.config}constructor(t){var e=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),e.getWebExperiments((t=>{Wa.Hn("retrieved web experiments from the server"),e.Un=new Map,t.forEach((t=>{if(t.feature_flag_key){var i;e.Un&&(Wa.Hn("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(i=e.Un)||i.set(t.feature_flag_key,t));var r=e._instance.getFeatureFlag(t.feature_flag_key);G(r)&&t.variants[r]&&e.zn(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];Wa.Vn(n)&&e.zn(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())Wa.Hn(Ga);else if(!this.Se.disable_web_experiments){if(J(this.Un))return this.Un=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Wa.Hn("applying feature flags",t),t.forEach((t=>{var e;if(this.Un&&null!=(e=this.Un)&&e.has(t)){var i,r=this._instance.getFeatureFlag(t),s=null==(i=this.Un)?void 0:i.get(t);r&&null!=s&&s.variants[r]&&this.zn(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=Wa.getWindowLocation();if(null!=t&&t.search){var e=Js(null==t?void 0:t.search,"__experiment_id"),i=Js(null==t?void 0:t.search,"__experiment_variant");e&&i&&(Wa.Hn("previewing web experiments "+e+" && "+i),this.getWebExperiments((t=>{this.Wn(parseInt(e),i,t)}),!1,!0))}}loadIfEnabled(){this.Se.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,e,i){if(this.Se.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.Se.token),method:"GET",callback:e=>t(200===e.statusCode&&e.json&&e.json.experiments||[])})}Wn(t,e,i){var r=i.filter((e=>e.id===t));r&&r.length>0&&(Wa.Hn("Previewing web experiment ["+r[0].name+"] with variant ["+e+"]"),this.zn(r[0].name,e,r[0].variants[e].transforms))}static Vn(t){return!J(t.conditions)&&Wa.Gn(t)&&Wa.Zn(t)}static Gn(t){var e;if(J(t.conditions)||J(null==(e=t.conditions)?void 0:e.url))return!0;var i,r,s,n=Wa.getWindowLocation();return!!n&&(null==(i=t.conditions)||!i.url||Va[null!==(r=null==(s=t.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](t.conditions.url,n))}static getWindowLocation(){return null==t?void 0:t.location}static Zn(t){var e;if(J(t.conditions)||J(null==(e=t.conditions)?void 0:e.utm))return!0;var i=rn();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 Hn(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];ai.info("[WebExperiments] "+t,i)}zn(t,e,i){this._is_bot()?Wa.Hn(Ga):"control"!==e?i.forEach((i=>{if(i.selector){var r;Wa.Hn("applying transform of variant "+e+" for experiment "+t+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach((t=>{var e=t;i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)}))}})):Wa.Hn("Control variants leave the page unmodified.")}_is_bot(){return i&&this._instance?Io(i,this.Se.custom_blocked_useragents):void 0}}var Ja=li("[Conversations]"),Ka="Conversations not available yet.",Ya="console",Qa={featureFlags:class{constructor(t){this.Qn=!1,this.Jn=!1,this.Yn=!1,this.Kn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Se(){return this._instance.config}get Ur(){return this._instance.persistence}ns(t){return this._instance.get_property(t)}ss(){var t,e;return null!==(t=null==(e=this.Ur)?void 0:e.Gt(this.Se.feature_flag_cache_ttl_ms))&&void 0!==t&&t}os(){return!!this.ss()&&(this.rs||this.Yn||(this.rs=!0,za.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}ls(){var t,e=null!==(t=this.Se.evaluation_contexts)&&void 0!==t?t:this.Se.evaluation_environments;return!this.Se.evaluation_environments||this.Se.evaluation_contexts||this.ts||(za.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ts=!0),null!=e&&e.length?e.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||za.error("Invalid evaluation context found:",t,"Expected non-empty string"),e})):[]}us(){return this.ls().length>0}hs(){var t=this.Se.flag_keys;if(!q(t)){if(N(t))return t.filter((t=>{var e=t&&"string"==typeof t&&t.trim().length>0;return e||za.error("Invalid flag key found:",t,"Expected non-empty string"),e}));za.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,i){var r,s,n=null!=i&&i.merge&&null!==(r=this.ns(Fi))&&void 0!==r?r:{},o=null!=i&&i.merge&&null!==(s=this.ns(Di))&&void 0!==s?s:{},a=p({},n,t),l=p({},o,e),u={};for(var[h,d]of Object.entries(a))u[h]={key:h,enabled:m(d),variant:y(d),reason:void 0,metadata:q(null==l?void 0:l[h])?void 0:{id:0,version:void 0,description:void 0,payload:l[h]}};this.receivedFeatureFlags({flags:u})}get hasLoadedFlags(){return this.Jn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.ns(Ai),e=this.ns(ji),i=this.ns(zi);if(!i&&!e)return t||{};var r=xr({},t||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(e||{})])];for(var n of s){var o,a,l=r[n],u=null==e?void 0:e[n],h=q(u)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!u,d=q(u)?l.variant:"string"==typeof u?u:void 0,v=null==i?void 0:i[n],c=p({},l,{enabled:h,variant:h?null!=d?d:null==l?void 0:l.variant:void 0});h!==(null==l?void 0:l.enabled)&&(c.original_enabled=null==l?void 0:l.enabled),d!==(null==l?void 0:l.variant)&&(c.original_variant=null==l?void 0:l.variant),v&&(c.metadata=p({},null==l?void 0:l.metadata,{payload:v,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=c}return this.Qn||(za.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:i,finalDetails:r}),this.Qn=!0),r}getFlagVariants(){var t=this.ns(Fi),e=this.ns(ji);if(!e)return t||{};for(var i=xr({},t),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Qn||(za.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:i}),this.Qn=!0),i}getFlagPayloads(){var t=this.ns(Di),e=this.ns(zi);if(!e)return t||{};for(var i=xr({},t||{}),r=Object.keys(e),s=0;r.length>s;s++)i[r[s]]=e[r[s]];return this.Qn||(za.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:i}),this.Qn=!0),i}reloadFeatureFlags(){this.Kn||this.Se.advanced_disable_feature_flags||this.ds||(this._instance.Ii.emit("featureFlagsReloading",!0),this.ds=setTimeout((()=>{this.cs()}),5))}vs(){clearTimeout(this.ds),this.ds=void 0}ensureFlagsLoaded(){this.Jn||this.Yn||this.ds||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Kn=t}cs(t){var e;if(this.vs(),!this._instance.mr())if(this.Yn)this.Xn=!0;else{var i=this.Se.token,r=this.ns(vi),s={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:p({},(null==(e=this.Ur)?void 0:e.get_initial_props())||{},this.ns(Ni)||{}),group_properties:this.ns(Ui),timezone:dn()};W(r)||q(r)||(s.$device_id=r),(null!=t&&t.disableFlags||this.Se.advanced_disable_feature_flags)&&(s.disable_flags=!0),this.us()&&(s.evaluation_contexts=this.ls());var n=this.hs();q(n)||(s.flag_keys=n);var o=!!this.Se.advanced_only_evaluate_survey_feature_flags,a=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Se.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Yn=!0,this._instance._send_request({method:"POST",url:a,data:s,compression:this.Se.disable_compression?void 0:Tn,timeout:this.Se.feature_flag_request_timeout_ms,callback:t=>{var e,i,r,n=!0;if(200===t.statusCode&&(this.Xn||(this.$anon_distinct_id=void 0),n=!1),this.Yn=!1,!s.disable_flags||this.Xn){this.es=!n;var a=[];t.error?t.error instanceof Error?a.push("AbortError"===t.error.name?"timeout":"connection_error"):a.push("unknown_error"):200!==t.statusCode&&a.push("api_error_"+t.statusCode),null!=(e=t.json)&&e.errorsWhileComputingFlags&&a.push("errors_while_computing_flags");var l,u=!(null==(i=t.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));if(u&&a.push("quota_limited"),null==(r=this.Ur)||r.register({[Ji]:a}),u)za.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else s.disable_flags||this.receivedFeatureFlags(null!==(l=t.json)&&void 0!==l?l:{},n,{partialResponse:o}),this.Xn&&(this.Xn=!1,this.cs())}}})}}getFeatureFlag(t,e){var i;if(void 0===e&&(e={}),!e.fresh||this.es)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.os()){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 za.warn('getFeatureFlag for key "'+t+Ua)}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.es)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.os()){var i=this.getFlagVariants(),r=t in i,s=i[t],n=this.getFlagPayloads()[t],o=String(s),a=this.ns(Li)||void 0,l=this.ns(Ki)||void 0,u=this.ns(Vi)||{};if(this.Se.advanced_feature_flags_dedup_per_session){var h,d=this._instance.get_session_id(),v=this.ns(Wi);d&&d!==v&&(u={},null==(h=this.Ur)||h.register({[Vi]:u,[Wi]: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,S;N(u[t])?u[t].push(o):u[t]=[o],null==(c=this.Ur)||c.register({[Vi]:u});var E=this.getFeatureFlagDetails(t),k=[...null!==(f=this.ns(Ji))&&void 0!==f?f:[]];q(s)&&k.push("flag_missing");var P={$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.Se.bootstrap)||null==(p=p.featureFlags)?void 0:p[t])||null,$feature_flag_bootstrapped_payload:(null==(g=this.Se.bootstrap)||null==(g=g.featureFlagPayloads)?void 0:g[t])||null,$used_bootstrap_value:!this.es};q(null==E||null==(m=E.metadata)?void 0:m.version)||(P.$feature_flag_version=E.metadata.version);var T,I=null!==(y=null==E||null==(b=E.reason)?void 0:b.description)&&void 0!==y?y:null==E||null==(w=E.reason)?void 0:w.code;I&&(P.$feature_flag_reason=I),null!=E&&null!=(x=E.metadata)&&x.id&&(P.$feature_flag_id=E.metadata.id),q(null==E?void 0:E.original_variant)&&q(null==E?void 0:E.original_enabled)||(P.$feature_flag_original_response=q(E.original_variant)?E.original_enabled:E.original_variant),null!=E&&null!=(S=E.metadata)&&S.original_payload&&(P.$feature_flag_original_payload=null==E||null==(T=E.metadata)?void 0:T.original_payload),k.length&&(P.$feature_flag_error=k.join(",")),this._instance.capture("$feature_flag_called",P)}if(r)return{key:t,enabled:!!s,variant:"string"==typeof s?s:void 0,payload:_(n)}}}else za.warn('getFeatureFlagResult for key "'+t+Ua)}getRemoteConfigPayload(t,e){var i=this.Se.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.us()&&(r.evaluation_contexts=this.ls());var s=this.hs();q(s)||(r.flag_keys=s),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Se.disable_compression?void 0:Tn,timeout:this.Se.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.es){if(this.Jn||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(t,e);return q(i)?void 0:!!i}za.warn('isFeatureEnabled for key "'+t+Ua)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((e=>e!==t))}receivedFeatureFlags(t,e,i){if(this.Ur){this.Jn=!0;var r=this.getFlagVariants(),s=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(t,e,i,r,s,n){void 0===i&&(i={}),void 0===r&&(r={}),void 0===s&&(s={});var o=(t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var i;return[t,null!==(i=e[t].variant)&&void 0!==i?i:e[t].enabled]}))),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return null==(i=e[t].metadata)?void 0:i.payload})).map((t=>{var i;return[t,null==(i=e[t].metadata)?void 0:i.payload]})))):t.featureFlags&&za.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t})(t),a=o.flags,l=o.featureFlags,u=o.featureFlagPayloads;if(l){var h=t.requestId,d=t.evaluatedAt;if(N(l)){za.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(l)for(var c=0;l.length>c;c++)v[l[c]]=!0;e&&e.register({[Mi]:l,[Fi]:v})}else{var f=l,g=u,_=a;if(null!=n&&n.partialResponse)f=p({},i,f),g=p({},r,g),_=p({},s,_);else if(t.errorsWhileComputingFlags)if(a){var m=new Set(Object.keys(a).filter((t=>{var e;return!(null!=(e=a[t])&&e.failed)})));f=p({},i,Object.fromEntries(Object.entries(f).filter((t=>{var[e]=t;return m.has(e)})))),g=p({},r,Object.fromEntries(Object.entries(g||{}).filter((t=>{var[e]=t;return m.has(e)})))),_=p({},s,Object.fromEntries(Object.entries(_||{}).filter((t=>{var[e]=t;return m.has(e)}))))}else f=p({},i,f),g=p({},r,g),_=p({},s,_);e&&e.register(p({[Mi]:Object.keys(Ha(f)),[Fi]:f||{},[Di]:g||{},[Ai]:_||{}},h?{[Li]:h}:{},d?{[Ki]:d}:{}))}}}(t,this.Ur,r,s,n,i),e||(this.rs=!1),this.fs(e)}}override(t,e){void 0===e&&(e=!1),za.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.Ur)return za.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===t)return this.Ur.unregister(ji),this.Ur.unregister(zi),this.fs(),Na.info("All overrides cleared");if(N(t)){var e=Ba(t);return this.Ur.register({[ji]:e}),this.fs(),Na.info("Flag overrides set",{flags:t})}if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,r=t;if(this.Qn=Boolean(null!==(i=r.suppressWarning)&&void 0!==i&&i),"flags"in r)if(!1===r.flags)this.Ur.unregister(ji),Na.info("Flag overrides cleared");else if(r.flags){if(N(r.flags)){var s=Ba(r.flags);this.Ur.register({[ji]:s})}else this.Ur.register({[ji]:r.flags});Na.info("Flag overrides set",{flags:r.flags})}return"payloads"in r&&(!1===r.payloads?(this.Ur.unregister(zi),Na.info("Payload overrides cleared")):r.payloads&&(this.Ur.register({[zi]:r.payloads}),Na.info("Payload overrides set",{payloads:r.payloads}))),void this.fs()}if(t&&"object"==typeof t)return this.Ur.register({[ji]:t}),this.fs(),Na.info("Flag overrides set",{flags:t});za.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Jn){var{flags:e,flagVariants:i}=this.ps();t(e,i)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,i){var r,s=(this.ns(Oi)||[]).find((e=>e.flagKey===t)),n={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:n};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=p({},this.getFlagVariants(),{[t]:e});null==(r=this.Ur)||r.register({[Mi]:Object.keys(Ha(a)),[Fi]:a}),this.fs()}getEarlyAccessFeatures(t,e,i){void 0===e&&(e=!1);var r=this.ns(Oi),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.Se.token+s),method:"GET",callback:e=>{var i,r;if(e.json){var s=e.json.earlyAccessFeatures;return null==(i=this.Ur)||i.unregister(Oi),null==(r=this.Ur)||r.register({[Oi]:s}),t(s)}}})}ps(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter((t=>e[t])),flagVariants:Object.keys(e).filter((t=>e[t])).reduce(((t,i)=>(t[i]=e[i],t)),{})}}fs(t){var{flags:e,flagVariants:i}=this.ps();this.featureFlagEventHandlers.forEach((r=>r(e,i,{errorsLoading:t})))}setPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var i=this.ns(Ni)||{},r=(null==t?void 0:t.$set)||(null!=t&&t.$set_once?{}:t),s=null==t?void 0:t.$set_once,n={};if(s)for(var o in s)({}).hasOwnProperty.call(s,o)&&(o in i||(n[o]=s[o]));this._instance.register({[Ni]:p({},i,n,r)}),e&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,e){void 0===e&&(e=!0);var i=p({},this.ns(Ni)||{});t.forEach((t=>{delete i[t]})),this._instance.register({[Ni]:i}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this._instance.unregister(Ni),t&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(t,e){void 0===e&&(e=!0);var i=this.ns(Ui)||{};0!==Object.keys(i).length&&Object.keys(i).forEach((e=>{i[e]=p({},i[e],t[e]),delete t[e]})),this._instance.register({[Ui]:p({},i,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.ns(Ui)||{};this._instance.register({[Ui]:p({},e,{[t]:{}})})}else this._instance.unregister(Ui)}reset(){this.Jn=!1,this.Yn=!1,this.Kn=!1,this.Xn=!1,this.es=!1,this.$anon_distinct_id=void 0,this.vs(),this.Qn=!1}}},Xa={sessionRecording:class{get Se(){return this._instance.config}get Ur(){return this._instance.persistence}get started(){var t;return!(null==(t=this.gs)||!t.isStarted)}get status(){var t,e;return this.ys===ya||this.ys===ba?this.ys:null!==(t=null==(e=this.gs)?void 0:e.status)&&void 0!==t?t:this.ys}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.ys=_a,this.bs=void 0,this._instance=t,!this._instance.sessionManager)throw xa.error("started without valid sessionManager"),new Error(wa+" started without valid sessionManager. This is a bug.");if(this.Se.cookieless_mode===hr)throw new Error(wa+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _s(){var e,i=!(null==(e=this._instance.get_property(Ei))||!e.enabled),r=!this.Se.disable_session_recording,s=this.Se.disable_session_recording||this._instance.consent.isOptedOut();return t&&i&&r&&!s}startIfEnabledOrStop(t){var e;if(!this._s||null==(e=this.gs)||!e.isStarted){var i=!q(Object.assign)&&!q(Array.from);this._s&&i?(this.ws(t),xa.info("starting")):(this.ys=_a,this.stopRecording())}}ws(t){var e,i,r;this._s&&(this.ys!==ya&&this.ys!==ba&&(this.ys=ma),null!=h&&null!=(e=h.__PosthogExtensions__)&&null!=(e=e.rrweb)&&e.record&&null!=(i=h.__PosthogExtensions__)&&i.initSessionRecording?this.xs(t):null==(r=h.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.ks,(e=>{if(e)return xa.error("could not load recorder",e);this.xs(t)})))}stopRecording(){var t,e;null==(t=this.bs)||t.call(this),this.bs=void 0,null==(e=this.gs)||e.stop()}Ss(){var t,e;null==(t=this.bs)||t.call(this),this.bs=void 0,null==(e=this.gs)||e.discard()}Cs(){var t,e;null==(t=this.Ur)||t.unregister(Ci),null==(e=this.Ur)||e.unregister(ki)}Is(t,e){if(J(t))return null;var i,r=K(t)?t:parseFloat(t);return"number"!=typeof(i=r)||!Number.isFinite(i)||0>i||i>1?(xa.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Ts(t){if(this.Ur){var e,i,r=this.Ur,s=()=>{var e,i=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.Is(null==(e=this.Se.session_recording)?void 0:e.sampleRate,"session_recording.sampleRate"),n=this.Is(null==i?void 0:i.sampleRate,"remote config sampleRate"),o=null!=s?s:n;J(o)&&this.Cs();var a=null==i?void 0:i.minimumDurationMilliseconds;r.register({[Ei]:p({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:p({capturePerformance:t.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:o,minimumDurationMilliseconds:q(a)?null:a,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};s(),null==(e=this.bs)||e.call(this),this.bs=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}onRemoteConfig(t){return"sessionRecording"in t?!1===t.sessionRecording?(this.Ts(t),void this.Ss()):(this.Ts(t),void this.startIfEnabledOrStop()):(this.ys===ya&&(this.ys=ba,xa.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var i;void 0===e&&(e="log"),null!=(i=this.gs)&&i.log?this.gs.log(t,e):xa.warn("log called before recorder was ready")}get ks(){var t,e,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(Ei);return(null==i||null==(e=i.scriptConfig)?void 0:e.script)||"lazy-recorder"}Es(){var t,e,i=this._instance.get_property(Ei);if(!i)return!1;try{e="object"==typeof i?i:JSON.parse(i)}catch(t){return xa.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}xs(t){var e,i;if(null==(e=h.__PosthogExtensions__)||!e.initSessionRecording)return xa.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[ar]:!0});if(this.gs||(this.gs=null==(i=h.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.gs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Es()){if(this.ys===ba||this.ys===ya)return;return this.ys=ya,xa.info("persisted remote config is stale, requesting fresh config before starting"),void new $n(this._instance).load()}this.ys=ma,this.gs.start(t)}onRRwebEmit(t){var e;null==(e=this.gs)||null==e.onRRwebEmit||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.gs||null==(e=this.Ur)||e.register({[Pi]:!0}),null==(t=this.gs)||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.gs||null==(e=this.Ur)||e.register({[$i]:!0}),null==(t=this.gs)||t.overrideSampling()}overrideTrigger(t){var e,i;this.gs||null==(i=this.Ur)||i.register({["url"===t?Ti:Ii]:!0}),null==(e=this.gs)||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.gs)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var i;return!(null==(i=this.gs)||!i.tryAddCustomEvent(t,e))}}},Za={autocapture:class{constructor(t){this.Ms=!1,this.Ps=null,this.Rs=!1,this.instance=t,this.rageclicks=new aa(t.config.rageclick),this.Os=null}initialize(){this.startIfEnabled()}get Se(){var t,e,i=B(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}Ls(){if(this.isBrowserSupported()){if(t&&r){var e=e=>{e=e||(null==t?void 0:t.event);try{this.Fs(e)}catch(t){ua.error("Failed to capture event",t)}};if(Ir(r,"submit",e,{capture:!0}),Ir(r,"change",e,{capture:!0}),Ir(r,"click",e,{capture:!0}),this.Se.capture_copied_text){var i=e=>{e=e||(null==t?void 0:t.event);try{this.Fs(e,la)}catch(t){ua.error("Failed to capture copy/cut event",t)}};Ir(r,"copy",i,{capture:!0}),Ir(r,"cut",i,{capture:!0})}}}else ua.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Ms&&(this.Ls(),this.Ms=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Rs=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[pi]:!!t.autocapture_opt_out}),this.Ps=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Os=t}getElementSelectors(t){var e,i=[];return null==(e=this.Os)||e.forEach((e=>{var s=null==r?void 0:r.querySelectorAll(e);null==s||s.forEach((r=>{t===r&&i.push(e)}))})),i}get isEnabled(){var t,e,i=null==(t=this.instance.persistence)?void 0:t.props[pi];if(W(this.Ps)&&!Q(i)&&!this.instance.mr())return!1;var r=null!==(e=this.Ps)&&void 0!==e?e:!!i;return!!this.instance.config.autocapture&&!r}Fs(e,i){if(void 0===i&&(i="$autocapture"),this.isEnabled){var r,s=ls(e);es(s)&&(s=s.parentNode||null),"$autocapture"===i&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&ms(s,this.instance.config.rageclick)&&this.Fs(e,"$rageclick");var n=i===la;if(s&&function(e,i,r,s,n){var o,a,l,u,h,d;if(void 0===r&&(r=void 0),!t||ys(e))return!1;if(null!=(o=r)&&o.url_allowlist&&!ss(r.url_allowlist))return!1;if(null!=(a=r)&&a.url_ignorelist&&ss(r.url_ignorelist))return!1;if(null!=(l=r)&&l.dom_event_allowlist){var v=r.dom_event_allowlist;if(v&&!v.some((t=>i.type===t)))return!1}var{parentIsUsefulElement:c,targetElementList:f}=bs(e,s);if(!function(t,e){var i=null==e?void 0:e.element_allowlist;if(q(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}(f,r))return!1;if(!hs(f,null==(u=r)?void 0:u.css_selector_allowlist))return!1;if(hs(f,null!==(h=null==(d=r)?void 0:d.css_selector_ignorelist)&&void 0!==h?h:vs))return!1;var p=t.getComputedStyle(e);if(p&&"pointer"===p.getPropertyValue("cursor")&&"click"===i.type)return!0;var g=e.tagName.toLowerCase();switch(g){case"html":return!1;case"form":return(n||["submit"]).indexOf(i.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(i.type)>=0;default:return c?(n||["click"]).indexOf(i.type)>=0:(n||["click"]).indexOf(i.type)>=0&&(us.indexOf(g)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,this.Se,n,n?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=va(s,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Se.element_attribute_ignorelist,elementsChainAsString:this.Rs,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes});if(a)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),i===la){var u,h=os(null==t||null==(u=t.getSelection())?void 0:u.toString()),d=e.type||"clipboard";if(!h)return!1;o.$selected_content=h,o.$copy_type=d}return this.instance.capture(i,o),!0}}}isBrowserSupported(){return U(null==r?void 0:r.querySelectorAll)}},historyAutocapture:class{constructor(e){var i;this._instance=e,this.As=(null==t||null==(i=t.location)?void 0:i.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(ai.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.$s&&this.$s(),this.$s=void 0,ai.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.Ds("pushState"),this.Ds("replaceState"),this.Ns())}Ds(e){var i;if(t&&(null==(i=t.history[e])||!i.__posthog_wrapped__)){var r=this;!function(t,e,i){try{if(!(e in t))return()=>{};var r=t[e],s=i(r);return U(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()=>{}}}(t.history,e,(t=>function(i,s,n){t.call(this,i,s,n),r.qs(e)}))}}qs(e){try{var i,r=null==t||null==(i=t.location)?void 0:i.pathname;if(!r)return;r!==this.As&&this.isEnabled&&this._instance.capture(gr,{navigation_type:e}),this.As=r}catch(t){ai.error("Error capturing "+e+" pageview",t)}}Ns(){if(!this.$s){var e=()=>{this.qs("popstate")};Ir(t,"popstate",e),this.$s=()=>{t&&t.removeEventListener("popstate",e)}}}},heatmaps:class{get Se(){return this.instance.config}constructor(t){var e;this.Bs=!1,this.Ms=!1,this.js=null,this.instance=t,this.Bs=!(null==(e=this.instance.persistence)||!e.props[gi]),this.rageclicks=new aa(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return B(this.Se.capture_heatmaps)&&this.Se.capture_heatmaps.flush_interval_milliseconds&&(t=this.Se.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return J(this.Se.capture_heatmaps)?J(this.Se.enable_heatmaps)?this.Bs:this.Se.enable_heatmaps:!1!==this.Se.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Ms)return;Sa.info("starting..."),this.Hs(),this.ke()}else{var t;clearInterval(null!==(t=this.js)&&void 0!==t?t:void 0),this.Us(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[gi]:e}),this.Bs=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.R;return this.R=void 0,t}zs(t){this.fe(t.originalEvent,"deadclick")}ke(){this.js&&clearInterval(this.js),this.js=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(r)?setInterval(this.Or.bind(this),this.flushIntervalMilliseconds):null}Hs(){t&&r&&(this.Vs=this.Or.bind(this),Ir(t,pr,this.Vs),this.Ws=e=>this.fe(e||(null==t?void 0:t.event)),Ir(r,"click",this.Ws,{capture:!0}),this.Gs=e=>this.Zs(e||(null==t?void 0:t.event)),Ir(r,"mousemove",this.Gs,{capture:!0}),this.Qs=new Ls(this.instance,As,this.zs.bind(this)),this.Qs.startIfEnabledOrStop(),this.Js=this.ke.bind(this),Ir(r,fr,this.Js),this.Ms=!0)}Us(){var e;t&&r&&(this.Vs&&t.removeEventListener(pr,this.Vs),this.Ws&&r.removeEventListener("click",this.Ws,{capture:!0}),this.Gs&&r.removeEventListener("mousemove",this.Gs,{capture:!0}),this.Js&&r.removeEventListener(fr,this.Js),clearTimeout(this.Ys),null==(e=this.Qs)||e.stop(),this.Ms=!1)}Ks(e,i){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(e,i,r){for(var s=e;s&&Zr(s)&&!ts(s,"body");){if(s===r)return!1;if(O(i,null==t?void 0:t.getComputedStyle(s).position))return!0;s=ds(s)}return!1}(ls(e),["fixed","sticky"],n);return{x:e.clientX+(o?0:s),y:e.clientY+(o?0:r),target_fixed:o,type:i}}fe(t,e){var i;if(void 0===e&&(e="click"),!Xr(t.target)&&Ea(t)){var r=this.Ks(t,e);null!=(i=this.rageclicks)&&i.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&ms(ls(t),this.instance.config.rageclick)&&this.Xs(p({},r,{type:"rageclick"})),this.Xs(r)}}Zs(t){!Xr(t.target)&&Ea(t)&&(clearTimeout(this.Ys),this.Ys=setTimeout((()=>{this.Xs(this.Ks(t,"mousemove"))}),500))}Xs(e){if(t){var i=this.Se.disable_capture_url_hashes?pe(t.location.href):t.location.href,r=this.Se.custom_personal_data_properties,s=this.Se.mask_personal_data_properties?[...Xs,...r||[]]:[],n=Ks(i,s,tn);this.R=this.R||{},this.R[n]||(this.R[n]=[]),this.R[n].push(e)}}Or(){this.R&&!H(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Ls,webVitalsAutocapture:class{constructor(t){var e;this.Bs=!1,this.Ms=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.eo=()=>{clearTimeout(this.ro),0!==this.R.metrics.length&&(this._instance.capture("$web_vitals",this.R.metrics.reduce(((t,e)=>p({},t,{["$web_vitals_"+e.name+"_event"]:p({},e),["$web_vitals_"+e.name+"_value"]:e.value})),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.io=t=>{var e;this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var i=this.no();if(!q(i))if(J(null==t?void 0:t.name)||J(null==t?void 0:t.value))pa.error("Invalid metric received",t);else if(!this.so||this.so>t.value){this.R.url!==i&&(this.eo(),this.ro=setTimeout(this.eo,this.flushToCaptureTimeoutMs)),q(this.R.url)&&(this.R.url=i),this.R.firstMetricTimestamp=q(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,t.attribution&&t.attribution.interactionTargetElement&&(t.attribution.interactionTargetElement=void 0);var r=null==(e=this._instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0),s=p({},t,{$current_url:i,timestamp:Date.now()});q(r)||(s.$session_id=r.sessionId,s.$window_id=r.windowId),this.R.metrics.push(s),this.R.metrics.length===this.allowedMetrics.length&&this.eo()}else pa.error("Ignoring metric with value >= "+this.so,t)},this.oo=()=>{if(!this.Ms){var t,e,i,r,s=h.__PosthogExtensions__;q(s)||q(s.postHogWebVitalsCallbacks)||({onLCP:t,onCLS:e,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),t&&e&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&t(this.io.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&e(this.io.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.io.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.io.bind(this)),this.Ms=!0):pa.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.Bs=!(null==(e=this._instance.persistence)||!e.props[bi]),this.startIfEnabled()}get ao(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,i=B(this.ao)?null==(t=this.ao)?void 0:t.web_vitals_allowed_metrics:void 0;return J(i)?(null==(e=this._instance.persistence)?void 0:e.props[Si])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(B(this.ao)?this.ao.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=B(this.ao)?this.ao.web_vitals_attribution:void 0;return null!=t&&t}get so(){var t=B(this.ao)&&K(this.ao.__web_vitals_max_value)?this.ao.__web_vitals_max_value:ga;return t>0&&6e4>=t?ga:t}get isEnabled(){var t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return pa.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=B(this.ao)?this.ao.web_vitals:Q(this.ao)?this.ao:void 0;return Q(e)?e:this.Bs}startIfEnabled(){this.isEnabled&&!this.Ms&&(pa.info("enabled, starting..."),this.Mt(this.oo))}onRemoteConfig(t){if("capturePerformance"in t){var e=B(t.capturePerformance)&&!!t.capturePerformance.web_vitals,i=B(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[bi]:e}),this._instance.persistence.register({[Si]:i})),this.Bs=e,this.startIfEnabled()}}Mt(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.postHogWebVitalsCallbacks?t():null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",(e=>{e?pa.error("failed to load script",e):t()}))}no(){var e=t?this._instance.config.disable_capture_url_hashes?pe(t.location.href):t.location.href:void 0;if(e){var i=this._instance.config.custom_personal_data_properties,r=this._instance.config.mask_personal_data_properties?[...Xs,...i||[]]:[];return Ks(e,r,tn)}pa.error("Could not determine current URL")}}},tl={exceptionObserver:class{constructor(e){var i,r,s;this.oo=()=>{var e;if(t&&this.isEnabled&&null!=(e=h.__PosthogExtensions__)&&e.errorWrappingFunctions){var i=h.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=h.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=h.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.lo&&this.Se.capture_unhandled_errors&&(this.lo=i(this.captureException.bind(this))),!this.uo&&this.Se.capture_unhandled_rejections&&(this.uo=r(this.captureException.bind(this))),!this.ho&&this.Se.capture_console_errors&&(this.ho=s(this.captureException.bind(this)))}catch(t){ca.error("failed to start",t),this.do()}}},this._instance=e,this.co=!(null==(i=this._instance.persistence)||!i.props[_i]),this.vo=new lt({refillRate:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==r?r:1,bucketSize:null!==(s=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==s?s:10,refillInterval:1e4,Ae:ca}),this.Se=this.fo(),this.startIfEnabledOrStop()}fo(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return B(t)?e=p({},e,t):(q(t)?this.co:t)&&(e=p({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Se.capture_console_errors||this.Se.capture_unhandled_errors||this.Se.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ca.info("enabled"),this.do(),this.Mt(this.oo)):this.do()}Mt(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.errorWrappingFunctions?t():null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",(e=>{if(e)return ca.error("failed to load script",e);t()}))}do(){var t,e,i;null==(t=this.lo)||t.call(this),this.lo=void 0,null==(e=this.uo)||e.call(this),this.uo=void 0,null==(i=this.ho)||i.call(this),this.ho=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.co=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[_i]:this.co}),this.Se=this.fo(),this.startIfEnabledOrStop())}onConfigChange(){this.Se=this.fo()}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.vo.consumeRateLimit(s)?ca.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,i;this.po=[],this.mo=new Re([new Be,new Xe,new qe,new He,new Ye,new Ke,new Ve,new Qe],function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;e>r;r++)i[r-1]=arguments[r];return function(e,r){void 0===r&&(r=0);for(var s=[],n=e.split("\n"),o=r;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=Ue.test(a)?a.replace(Ue,"$1"):a;if(!l.match(/\S*Error: /)){for(var u of i){var h=u(l,t);if(h){s.push(h);break}}if(s.length>=50)break}}}return function(t){if(!t.length)return[];var e=Array.from(t);return e.reverse(),e.slice(0,50).map((t=>{return p({},t,{filename:t.filename||(i=e,i[i.length-1]||{}).filename,function:t.function||Ce});var i}))}(s)}}("web:javascript",Le,Ne)),this._instance=t,this.po=null!==(e=null==(i=this._instance.persistence)?void 0:i.get_property(mi))&&void 0!==e?e:[],this.yo=ri(this.bo()),this._o=new si(this.yo)}onConfigChange(){this.yo=ri(this.bo()),this._o.setConfig(this.yo)}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.po=s,this._instance.persistence&&this._instance.persistence.register({[mi]:this.po,[yi]:n})}}get wo(){var t,e=!!this._instance.get_property(yi),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=i?i:e)&&void 0!==t&&t}buildProperties(t,e){return this.mo.buildFromUnknown(t,{syntheticException:null==e?void 0:e.syntheticException,mechanism:{handled:null==e?void 0:e.handled}})}addExceptionStep(t,e){if(this.yo.enabled)try{if(!G(t)||0===t.trim().length)return void qa.warn("Ignoring exception step because message must be a non-empty string");var i=this.xo(e),{sanitizedProperties:r,droppedKeys:s}=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var e=[];return{sanitizedProperties:Object.keys(t).reduce(((i,r)=>ei.has(r)?(e.push(r),i):(i[r]=t[r],i)),{}),droppedKeys:e}}(i);s.length>0&&qa.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this._o.add(p({[Ze]:t,[ti]:(new Date).toISOString()},r))}catch(t){qa.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.ko(e)){if(this.So(e))return this.Co("Exception dropped: matched a suppression rule"),void qa.info("Skipping exception capture because a suppression rule matched");if(!this.wo&&this.Io(e))return this.Co("Exception dropped: thrown by a browser extension"),void qa.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.To(e))return this.Co("Exception dropped: thrown by the PostHog SDK"),void qa.info("Skipping exception capture because it was thrown by the PostHog SDK")}var i=this.yo.enabled&&J(t.$exception_steps)?this.Eo(t):t;try{var r=this._instance.capture("$exception",i,{_noTruncate:!0,_batchKey:"exceptionEvent",Gi:!0});return r&&this._o.clear(),r}catch(t){return qa.error("Failed to capture exception event. Dropping this exception.",t),void this._o.clear()}}catch(t){return void qa.error("Failed to process exception event. Ignoring this exception.",t)}}Eo(t){try{var e=this._o.getAttachable();return 0===e.length?t:p({},t,{$exception_steps:e})}catch(e){return qa.error("Failed to read buffered exception steps. Capturing exception without steps.",e),t}}Co(t){this.yo.enabled&&this._o.add({[Ze]:t,[ti]:(new Date).toISOString()})}xo(t){return B(t)?p({},t):{}}bo(){var t,e;return null!==(t=null==(e=this._instance.config.error_tracking)?void 0:e.exception_steps)&&void 0!==t?t:{}}So(t){if(0===t.length)return!1;var e=t.reduce(((t,e)=>{var{type:i,value:r}=e;return G(i)&&i.length>0&&t.$exception_types.push(i),G(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.po.some((t=>{var i=t.values.map((t=>{var i,r=Fo[t.operator],s=N(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)}))}Io(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://")))}To(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}ko(t){return!J(t)&&N(t)}}},el=p({productTours:class{get Ur(){return this._instance.persistence}constructor(t){this.Mo=null,this.Po=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if("productTours"in t){var e,i;if(this.Ur&&this.Ur.register({[xi]:!!t.productTours}),!$a(this._instance))return!this.Mo&&J(null==(e=this.Ur)?void 0:e.props[Gi])||ka.info("product tours disabled; stopping and clearing cached tours"),null==(i=this.Mo)||i.stop(),this.Mo=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Mo&&$a(this._instance)&&this.Mt((()=>this.Ro()))}Mt(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.generateProductTours?t():null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",(e=>{e?ka.error("Could not load product tours script",e):t()}))}Ro(){var t;!this.Mo&&null!=(t=h.__PosthogExtensions__)&&t.generateProductTours&&(this.Mo=h.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(void 0===e&&(e=!1),!N(this.Po)||e){var i=this.Ur;if(i){var r=i.props[Gi];if(N(r)&&!e)return this.Po=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($a(this._instance)){var r=e.statusCode;if(200!==r||!e.json){var s="Product Tours API could not be loaded, status: "+r;return ka.error(s),void t([],{isLoaded:!1,error:s})}var n=N(e.json.product_tours)?e.json.product_tours:[];this.Po=n,i&&i.register({[Gi]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Po,{isLoaded:!0})}getActiveProductTours(t){J(this.Mo)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Mo.getActiveProductTours(t)}showProductTour(t){var e;null==(e=this.Mo)||e.showTourById(t)}previewTour(t){this.Mo?this.Mo.previewTour(t):this.Mt((()=>{var e;this.Ro(),null==(e=this.Mo)||e.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Mo)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Mo)||t.nextStep()}previousStep(){var t;null==(t=this.Mo)||t.previousStep()}clearCache(){var t;this.Po=null,null==(t=this.Ur)||t.unregister(Gi)}resetTour(t){var e;null==(e=this.Mo)||e.resetTour(t)}resetAllTours(){var t;null==(t=this.Mo)||t.resetAllTours()}cancelPendingTour(t){var e;null==(e=this.Mo)||e.cancelPendingTour(t)}}},Qa),il={siteApps:class{constructor(t){this.Oo=0,this._instance=t,this.Lo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Fo(t,e){if(e){var i=this.globalsForEvent(e);this.Lo.push(i),this.Lo.length>1e3&&(this.Lo=this.Lo.slice(10))}}get siteAppLoaders(){var t;return null==(t=h._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.Fo.bind(this));this.Ao=()=>{t(),this.Lo=[],this.Ao=void 0}}}globalsForEvent(t){var e,i,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],h=this._instance.get_property("$stored_group_properties")||{};for(var[d,v]of Object.entries(h))l[d]={id:u[d],type:d,properties:v};var{$set_once:c,$set:f}=t;return{event:p({},g(t,Pa),{properties:p({},t.properties,f?{$set:p({},null!==(e=null==(i=t.properties)?void 0:i.$set)&&void 0!==e?e:{},f)}:{},c?{$set_once:p({},null!==(r=null==(s=t.properties)?void 0:s.$set_once)&&void 0!==r?r:{},c)}:{}),elements_chain:null!==(n=null==(o=t.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=t.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}$o(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)||(Ta.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)||(Ta.error("prepare_external_dependency_script returned null"),null):t}Do(){var t,e,i,s,n,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var u=null==r?void 0:r.defaultView,h=null==u||null==(t=u.Node)?void 0:t.prototype;if(!u||!h)return()=>{};if(this.Oo++,this.No)return this.qo();var d=[],v=this,c=new WeakSet,f=(t,e,i)=>{if(null!=t&&t[e]){var r=t[e];t[e]=i(r),d.push((()=>{t[e]=r}))}},p=t=>{if(c.has(t))return t;var e=v.$o(t);return e&&c.add(e),e},g=t=>t.map((t=>"string"==typeof t?t:p(t))).filter((t=>!W(t)));return f(h,"appendChild",(t=>function(e){var i=p(e);return i?t.call(this,i):e})),f(h,"insertBefore",(t=>function(e,i){var r=p(e);return r?t.call(this,r,i):e})),f(h,"replaceChild",(t=>function(e,i){var r=p(e);return r?t.call(this,r,i):i})),[null==(e=u.Element)?void 0:e.prototype,null==(i=u.Document)?void 0:i.prototype,null==(s=u.DocumentFragment)?void 0:s.prototype].forEach((t=>{f(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,g(i))})),f(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,g(i))}))})),[null==(n=u.Element)?void 0:n.prototype,null==(o=u.CharacterData)?void 0:o.prototype,null==(a=u.DocumentType)?void 0:a.prototype].forEach((t=>{f(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,g(i))})),f(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,g(i))})),f(t,"replaceWith",(t=>function(){for(var e=arguments.length,i=new Array(e),r=0;e>r;r++)i[r]=arguments[r];var s=g(i);return i.length&&!s.length?void 0:t.apply(this,s)}))})),f(null==(l=u.Element)?void 0:l.prototype,"insertAdjacentElement",(t=>function(e,i){var r=p(i);return r?t.call(this,e,r):null})),this.No=()=>{d.forEach((t=>t())),this.No=void 0},this.qo()}qo(){var t=!1;return()=>{var e;t||(t=!0,this.Oo--,0===this.Oo&&(null==(e=this.No)||e.call(this)))}}Bo(t,e){void 0===e&&(e=!0);var i=this.Do();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.Lo.length&&(Ta.info("Processing "+this.Lo.length+" events for site app with id "+t.id),this.Lo.forEach((t=>this.Bo((()=>null==e.processEvent?void 0:e.processEvent(t))))),e.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(i=this.Ao)||i.call(this))},r=!1,s=s=>{e.errored=!s,e.loaded=!0,Ta.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=this.Bo((e=>t.init({posthog:this._instance,callback(t){e(),s(t)}})),!1);n&&(e.processEvent=n),r=!0}catch(e){Ta.error(Ia+t.id,e),s(!1)}if(r&&e.loaded)try{i()}catch(i){Ta.error("Error while processing buffered events PostHog app with config id "+t.id,i),e.errored=!0}}jo(){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)}Ho(t){var e=this;if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(t),r=function(r){try{e.Bo((()=>null==r.processEvent?void 0:r.processEvent(i)))}catch(e){Ta.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.jo(),void this._instance.on("eventCaptured",(t=>this.Ho(t)))):void Ta.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Ao)||i.call(this),null!=(r=t.siteApps)&&r.length)if(this.isEnabled){var n=function(t){var e;h["__$$ph_site_app_"+t]=s._instance,null==(e=h.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(s._instance,a,(e=>{if(e)return Ta.error(Ia+t,e)}))};for(var{id:o,url:a}of t.siteApps)n(o)}else Ta.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},rl={tracingHeaders:class{constructor(t){this.Uo=void 0,this.zo=void 0,this.Vo=void 0,this.oo=()=>{var t,e,i=this.Wo();i?(q(this.Uo)&&(this.Uo=null==(t=h.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),q(this.zo)&&(this.zo=null==(e=h.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchFetch(i,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.do()},this._instance=t}initialize(){this.startIfEnabledOrStop()}Mt(t){var e,i;null!=(e=h.__PosthogExtensions__)&&e.tracingHeadersPatchFns?t():null==(i=h.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",(e=>{if(e)return fa.error("failed to load script",e);t()}))}Go(){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}Wo(){var t=this.Go();return N(t)?(N(this.Vo)?this.Vo.splice(0,this.Vo.length,...t):this.Vo=[...t],t.length>0?this.Vo:void 0):(N(this.Vo)&&this.Vo.splice(0),this.Vo=t||void 0,this.Vo)}do(){var t,e;null==(t=this.Uo)||t.call(this),null==(e=this.zo)||e.call(this),this.Uo=void 0,this.zo=void 0}startIfEnabledOrStop(){this.Wo()?this.Mt(this.oo):this.do()}}},sl=p({surveys:class{get Se(){return this._instance.config}constructor(t){this.Zo=void 0,this._surveyManager=null,this.Qo=!1,this.Jo=[],this.Yo=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Se.disable_surveys){var e=t.surveys;if(J(e))return zo.warn("Flags not loaded yet. Not loading surveys.");var i=N(e);this.Zo=i?e.length>0:e,zo.info("flags response received, isSurveysEnabled: "+this.Zo),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(No)||null!=r&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this._surveyManager)if(this.Qo)zo.info("Already initializing surveys, skipping...");else if(this.Se.disable_surveys)zo.info(Aa);else if(this.Se.cookieless_mode&&this._instance.consent.isOptedOut())zo.info("Not loading surveys in cookieless mode without consent.");else{var t=null==h?void 0:h.__PosthogExtensions__;if(t){if(!q(this.Zo)||this.Se.advanced_enable_surveys){var e=this.Zo||this.Se.advanced_enable_surveys;this.Qo=!0;try{var i=t.generateSurveys;if(i)return void this.Ko(i,e);var r=t.loadExternalDependency;if(!r)return void this.Xo(lr);r(this._instance,"surveys",(i=>{i||!t.generateSurveys?this.Xo("Could not load surveys script",i):this.Ko(t.generateSurveys,e)}))}catch(t){throw this.Xo("Error initializing surveys",t),t}finally{this.Qo=!1}}}else zo.error("PostHog Extensions not found.")}}Ko(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new Ma(this._instance),zo.info("Surveys loaded successfully"),this.ea({isLoaded:!0})}Xo(t,e){zo.error(t,e),this.ea({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Jo.push(t),this._surveyManager&&this.ea({isLoaded:!0}),()=>{this.Jo=this.Jo.filter((e=>e!==t))}}getSurveys(t,e){if(void 0===e&&(e=!1),this.Se.disable_surveys)return zo.info(Aa),t([]);var i,r=this._instance.get_property(Bi);if(r&&!e)return t(r,{isLoaded:!0});"undefined"!=typeof Promise&&this.Yo?this.Yo.then((e=>{var{surveys:i,context:r}=e;return t(i,r)})):("undefined"!=typeof Promise&&(this.Yo=new Promise((t=>{i=t}))),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Se.token),method:"GET",timeout:this.Se.surveys_request_timeout_ms,callback:e=>{var r;this.Yo=null;var s=e.statusCode;if(200!==s||!e.json){var n="Surveys API could not be loaded, status: "+s;zo.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({[Bi]:l,[Hi]:Date.now()});var h={isLoaded:!0};t(l,h),null==i||i({surveys:l,context:h})}}))}ea(t){for(var e of this.Jo)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(t){zo.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,e){if(void 0===e&&(e=!1),!J(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);zo.warn("init was not called")}ta(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}ra(t){if(J(this._surveyManager))return{eligible:!1,reason:Oa};var e="string"==typeof t?this.ta(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(J(this._surveyManager))return zo.warn("init was not called"),{visible:!1,disabledReason:Oa};var e=this.ra(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return J(this._surveyManager)?(zo.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Oa})):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.ra(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),e)}))}renderSurvey(t,e,i){var s;if(J(this._surveyManager))zo.warn("init was not called");else{var n="string"==typeof t?this.ta(t):t;if(null!=n&&n.id)if(Uo.includes(n.type)){var o=null==r?void 0:r.querySelector(e);if(o)return null!=(s=n.appearance)&&s.surveyPopupDelaySeconds?(zo.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout((()=>{var t,e;zo.info("Rendering survey "+n.id+" with delay of "+(null==(t=n.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(e=this._surveyManager)||e.renderSurvey(n,o,i),zo.info("Survey "+n.id+" rendered")}),1e3*n.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(n,o,i);zo.warn("Survey element not found")}else zo.warn("Surveys of type "+n.type+" cannot be rendered in the app");else zo.warn("Survey not found")}}displaySurvey(t,e){var i;if(J(this._surveyManager))zo.warn("init was not called");else{var r=this.ta(t);if(r){var s=r;if(null!=(i=r.appearance)&&i.surveyPopupDelaySeconds&&e.ignoreDelay&&(s=p({},r,{appearance:p({},r.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==xn&&e.initialResponses&&zo.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===e.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void zo.warn("Survey is not eligible to be displayed: ",n.disabledReason)}"inline"!==e.displayType?this._surveyManager.handlePopoverSurvey(s,e):this.renderSurvey(s,e.selector,e.properties)}else zo.warn("Survey not found")}}cancelPendingSurvey(t){J(this._surveyManager)?zo.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||t.handlePageUnload()}}},Qa),nl={toolbar:class{constructor(t){this.instance=t}ia(t){h.ph_toolbar_state=t}na(){var t;return null!==(t=h.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,i,s){if(void 0===e&&(e=void 0),void 0===i&&(i=void 0),void 0===s&&(s=void 0),Rr(this.instance.config))return!1;if(!t||!r)return!1;e=null!=e?e:t.location,s=null!=s?s:t.history;try{if(!i){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}i=null==t?void 0:t.localStorage}var n,o=Da||Ys(e.hash,"__posthog")||Ys(e.hash,"state"),a=o?Er((()=>JSON.parse(atob(decodeURIComponent(o)))))||Er((()=>JSON.parse(decodeURIComponent(o)))):null;return a&&"ph_authorize"===a.action?((n=a).source="url",n&&Object.keys(n).length>0&&(a.desiredHash?e.hash=a.desiredHash:s?s.replaceState(s.state,"",e.pathname+e.search):e.hash="")):((n=JSON.parse(i.getItem(La)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(t){return!1}}sa(t){var e=h.ph_load_toolbar||h.ph_load_editor;!J(e)&&U(e)?e(t,this.instance):ja.warn("No toolbar load function found")}loadToolbar(e){var i=!(null==r||!r.getElementById(rr));if(!t||i)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=p({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(La,JSON.stringify(p({},n,{source:void 0}))),2===this.na())this.sa(n);else if(0===this.na()){var o;this.ia(1),null==(o=h.__PosthogExtensions__)||null==o.loadExternalDependency||o.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return ja.error("[Toolbar] Failed to load",t),void this.ia(0);this.ia(2),this.sa(n)})),Ir(t,"turbolinks:load",(()=>{this.ia(0),this.loadToolbar(n)}))}return!0}oa(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)}}},ol=p({experiments:Wa},Qa),al=p({},Qa,Xa,Za,tl,el,il,sl,rl,nl,ol,{conversations:class{constructor(t){this.aa=void 0,this._conversationsManager=null,this.la=!1,this.ua=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;J(e)||(Q(e)?this.aa=e:(this.aa=e.enabled,this.ua=e),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.aa=void 0,this.ua=null}loadIfEnabled(){if(!(this._conversationsManager||this.la||this._instance.config.disable_conversations||Rr(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==h?void 0:h.__PosthogExtensions__;if(t&&!q(this.aa)&&this.aa)if(this.ua&&this.ua.token){this.la=!0;try{var e=t.initConversations;if(e)return this.ha(e),void(this.la=!1);var i=t.loadExternalDependency;if(!i)return void this.da(lr);i(this._instance,"conversations",(e=>{e||!t.initConversations?this.da("Could not load conversations script",e):this.ha(t.initConversations),this.la=!1}))}catch(t){this.da("Error initializing conversations",t),this.la=!1}}else Ja.error("Conversations enabled but missing token in remote config.")}}ha(t){if(this.ua)try{this._conversationsManager=t(this.ua,this._instance),Ja.info("Conversations loaded successfully")}catch(t){this.da("Error completing conversations initialization",t)}else Ja.error("Cannot complete initialization: remote config is null")}da(t,e){Ja.error(t,e),this._conversationsManager=null,this.la=!1}show(){this._conversationsManager?this._conversationsManager.show():Ja.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.aa&&!W(this._conversationsManager)}isVisible(){var t,e;return null!==(t=null==(e=this._conversationsManager)?void 0:e.isVisible())&&void 0!==t&&t}sendMessage(t,e,i){var r=this;return f((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,e,i):(Ja.warn(Ka),null)}))()}getMessages(t,e){var i=this;return f((function*(){return i._conversationsManager?i._conversationsManager.getMessages(t,e):(Ja.warn(Ka),null)}))()}markAsRead(t){var e=this;return f((function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(Ja.warn(Ka),null)}))()}getTickets(t){var e=this;return f((function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(Ja.warn(Ka),null)}))()}requestRestoreLink(t){var e=this;return f((function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(Ja.warn(Ka),null)}))()}restoreFromToken(t){var e=this;return f((function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(Ja.warn(Ka),null)}))()}restoreFromUrlToken(){var t=this;return f((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(Ja.warn(Ka),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}Xi(){var t;null==(t=this._conversationsManager)||t.setIdentity()}en(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},{logs:class{constructor(e){var i;this.ca=!1,this.va=!1,this.Ae=li("[logs]"),this._r=[],this.fa=[],this.pa=()=>{var t,e;null==(t=this.ga)||t.onReconnect(),null==(e=this.ma)||e.onReconnect()},this._instance=e,this._instance&&null!=(i=this._instance.config.logs)&&i.captureConsoleLogs&&(this.ca=!0),t&&Ir(t,"online",this.pa)}ya(t,e,i,r){var s,n=function(t,e){var i,r,s,n,o,a,l,u=null!==(i=null==t?void 0:t.flushIntervalMs)&&void 0!==i?i:3e3,h=null!==(r=null==t?void 0:t.maxBufferSize)&&void 0!==r?r:100,d=null!=e&&e.consoleCapture?void 0:null!==(s=null==t?void 0:t.maxLogsPerInterval)&&void 0!==s?s:1e3,v=q(d)?Math.max(h,2048):Math.max(h,d),c=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(n=null!==(o=null==c?void 0:c["service.name"])&&void 0!==o?o:null==t?void 0:t.serviceName)&&void 0!==n?n:null==e?void 0:e.serviceNameDefault,serviceVersion:null!==(a=null==c?void 0:c["service.version"])&&void 0!==a?a:null==t?void 0:t.serviceVersion,environment:null!==(l=null==c?void 0:c["deployment.environment"])&&void 0!==l?l:null==t?void 0:t.environment,resourceAttributes:c,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:u,maxBufferSize:h,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:u,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,i);return[new ke(this.ba(t,e),n,this.Ae,(()=>this._a()),(t=>t()),void 0,r),n]}wa(){var t,e,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;return this.ga&&this.xa===i||(null==(e=this.ga)||e.reset(),this.xa=i,[this.ga,this.ka]=this.ya((()=>this._r),(t=>{this._r=t}))),this.ga}Sa(){var t,e,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;return this.ma&&this.Ca===i||(null==(e=this.ma)||e.reset(),this.Ca=i,[this.ma,this.Ia]=this.ya((()=>this.fa),(t=>{this.fa=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Ya)),this.ma}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,i=null==(e=t.logs)?void 0:e.captureConsoleLogs;!J(i)&&i&&(this.ca=!0,this.loadIfEnabled())}reset(){var t,e;this._r=[],null==(t=this.ga)||t.reset(),this.fa=[],null==(e=this.ma)||e.reset()}captureLog(t){this.wa().captureLog(t)}le(t){this.Sa().captureLog(t)}get logger(){return this.Ta||(this.Ta={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.Ta}flushLogs(t){t?this.Ea(t):(this.ga&&this.ga.flush().catch((t=>this.Ae.error("PostHog logs flush failed:",t))),this.ma&&this.ma.flush().catch((t=>this.Ae.error("PostHog logs flush failed:",t))))}loadIfEnabled(){if(this.ca&&!this.va){var t=null==h?void 0:h.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",(e=>{var i;e||null==(i=t.logs)||!i.initializeLogs?this.Ae.error("Could not load logs script",e):(t.logs.initializeLogs(this._instance),this.va=!0)})):this.Ae.error(lr)}else this.Ae.error("PostHog Extensions not found.")}}ba(t,e){var i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:e=>e===w.LogsQueue?t():void 0,setPersistedProperty(t,i){var r;t===w.LogsQueue&&e(null!==(r=i)&&void 0!==r?r:[])},ht:t=>this.ht(t),getLibraryId:()=>v.LIB_NAME,getLibraryVersion:()=>v.LIB_VERSION}}ht(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.Ma(),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)})}}})}))}Ea(t){this._r.length>0&&this.Pa(t,this._r,this.ka,v.LIB_NAME,(t=>{this._r=t})),this.fa.length>0&&this.Pa(t,this.fa,this.Ia,Ya,(t=>{this.fa=t}))}Pa(t,e,i,r,s){if(0!==e.length){var n=e.map((t=>t.record));s([]);var o=Ee(n,Se(i,v.LIB_NAME,v.LIB_VERSION),r,v.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Ma(),data:o,compression:"best-available",batchKey:"logs",transport:t})}}Ma(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}_a(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:i,windowId:r,sessionStartTimestamp:s,lastActivityTimestamp:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=i,e.windowId=r,J(s)||(e.sessionStartTimestamp=s),J(n)||(e.lastActivityTimestamp=n)}if(null!=h&&null!=(t=h.location)&&t.href&&(e.currentUrl=this._instance.config.disable_capture_url_hashes?pe(h.location.href):h.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(e.activeFeatureFlags=o)}return e}}});oa.__defaultExtensionClasses=p({},al),function(){v.SDK_DIST_CHANNEL="cdn";var e=Wo[ta]=new oa,i=h.posthog;i&&wr(i._i,(function(t){if(t&&N(t)){var r=e.init(t[0],t[1],t[2]),s=i[t[2]]||i;r&&(r._execute_array.call(r.people,s.people),r._execute_array(s))}})),h.posthog=e,function(){function e(){e.done||(e.done=!0,ea=!1,wr(Wo,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?e():Ir(r,"DOMContentLoaded",e,{capture:!1}):t&&ai.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}()}();
|
|
2
2
|
//# sourceMappingURL=array.js.map
|