posthog-js 1.419.0 → 1.419.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/array.js CHANGED
@@ -1,2 +1,2 @@
1
- !function(){"use strict";var t="undefined"!=typeof window?window:void 0,i="undefined"!=typeof globalThis?globalThis:t,e=null==i?void 0:i.navigator,r=null==i?void 0:i.document,s=null==i?void 0:i.location,n=null==i?void 0:i.fetch,o=null!=i&&i.XMLHttpRequest&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0,a=null==i?void 0:i.AbortController,l=null==i?void 0:i.CompressionStream,h=null==e?void 0:e.userAgent;function u(){return!(!t||!1===t.navigator.onLine)}var d="undefined"!=typeof globalThis?globalThis:t;d&&"undefined"==typeof self&&(d.self=d),d&&"undefined"==typeof File&&(d.File=function(){});var v=null!=t?t:{},c={DEBUG:!1,LIB_VERSION:"0.5.2",LIB_NAME:"browser-common"};function f(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function p(t){return function(){var i=this,e=arguments;return new Promise((function(r,s){var n=t.apply(i,e);function o(t){f(n,r,s,o,a,"next",t)}function a(t){f(n,r,s,o,a,"throw",t)}o(void 0)}))}}function g(){return g=Object.assign?Object.assign.bind():function(t){for(var i=1;arguments.length>i;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},g.apply(null,arguments)}function _(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}var m=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function y(t){return"string"==typeof t||t}function b(t){return"string"==typeof t?t:void 0}var w,x=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],S=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.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_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.PushRegistered="push_registered",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}({}),k=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),E=["$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"],P=["token"],T="NativeGzipValidationError",C=t=>t.length>=2&&31===t[0]&&139===t[1],F=(t,i)=>t===k.GZipJS||i===k.GZipJS||"gzip"===i,R=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),I=t=>{var i=new Error("Native gzip produced invalid output: "+t);throw i.name=T,i},M=function(){var t=p((function*(t,i){18>t.size&&I("too-short");var e=new Uint8Array(yield t.slice(0,10).arrayBuffer());C(e)&&8===e[2]||I("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var i=(()=>{if(w)return w;w=[];for(var t=0;256>t;t++){for(var i=t,e=0;8>e;e++)i=1&i?3988292384^i>>>1:i>>>1;w[t]=i>>>0}return w})(),e=4294967295,r=0;t.length>r;r++)e=i[255&(e^t[r])]^e>>>8;return(4294967295^e)>>>0})(i)&&I("invalid-crc");var s=i.length>>>0;r.getUint32(4,!0)!==s&&I("invalid-size")}));return function(i,e){return t.apply(this,arguments)}}();function A(){return A=p((function*(t,i,e){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(r).then((()=>n.close())).catch(function(){var t=p((function*(t){try{yield n.abort(t)}catch(t){}throw t}));return function(i){return t.apply(this,arguments)}}()),a=new Response(s.readable).blob(),l=(yield Promise.all([a,o]))[0];return yield M(l,r),l}catch(t){if(null!=e&&e.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}})),A.apply(this,arguments)}var O=20,D=1e3,j=1e4,L="[Circular]",N="[Truncated]",B="[Unserializable]",z="[Function]";function U(t){for(var i="",e=0;t.length>e;e++){var r=t.charCodeAt(e);if(55296>r||r>56319)i+=56320>r||r>57343?t[e]:"�";else{var s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++)}}return i}var q=["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"],H=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return q.concat(i).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))};function V(t,i){return-1!==t.indexOf(i)}var W=function(t){return t.trim()},G=function(t){return t.replace(/^\$/,"")};function K(t){var i,e=[];return null!==(i=JSON.stringify(t,(function(t,i){if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){for(;e.length>0&&e[e.length-1]!==this;)e.pop();if(e.includes(i))return"[Circular]";e.push(i)}return i}})))&&void 0!==i?i:"null"}var J=Object.prototype,Y=J.hasOwnProperty,Q=J.toString,X=Array.isArray||function(t){return"[object Array]"===Q.call(t)},Z=t=>"function"==typeof t,tt=t=>t===Object(t)&&!X(t),it=t=>{if(tt(t)){for(var i in t)if(Y.call(t,i))return!1;return!0}return!1},et=t=>void 0===t,rt=t=>"[object String]"==Q.call(t),st=t=>rt(t)&&0===t.trim().length,nt=t=>null===t,ot=t=>et(t)||nt(t),at=t=>"[object Number]"==Q.call(t)&&t==t,lt=t=>at(t)&&t>0,ht=t=>"[object Boolean]"===Q.call(t),ut=t=>t instanceof FormData,dt=t=>V(E,t),vt=t=>V(P,t);function ct(t){return null===t||"object"!=typeof t}function ft(t,i){return{}.toString.call(t)==="[object "+i+"]"}function pt(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return _t(t,Error)}}function gt(t){return"undefined"!=typeof Event&&_t(t,Event)}function _t(t,i){try{return t instanceof i}catch(t){return!1}}var mt=[!0,"true",1,"1","yes"],yt=t=>V(mt,t),bt=[!1,"false",0,"0","no"];function wt(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),at(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(r.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(r.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+s),wt(s||e,i,e,r))}class xt{constructor(t){this.k={},this.S=t.S,this.C=wt(t.bucketSize,0,100,t.I),this.R=wt(t.refillRate,0,this.C,t.I),this.A=wt(t.refillInterval,0,864e5,t.I)}O(t,i){var e=Math.floor((i-t.lastAccess)/this.A);e>0&&(t.tokens=Math.min(t.tokens+e*this.R,this.C),t.lastAccess=t.lastAccess+e*this.A)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.k[r];return s?this.O(s,e):this.k[r]=s={tokens:this.C,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.S)||i.call(this,t)),0===s.tokens)}stop(){this.k={}}}var St="Mobile",kt="iOS",Et="Android",$t="Tablet",Pt=Et+" "+$t,Tt="iPad",Ct="Apple",Ft=Ct+" Watch",Rt="Safari",It="BlackBerry",Mt="Samsung",At=Mt+"Browser",Ot=Mt+" Internet",Dt="Chrome",jt=Dt+" OS",Lt=Dt+" "+kt,Nt="Internet Explorer",Bt=Nt+" "+St,zt="Opera",Ut=zt+" Mini",qt="Edge",Ht="Microsoft "+qt,Vt="Firefox",Wt=Vt+" "+kt,Gt="Nintendo",Kt="PlayStation",Jt="Xbox",Yt=Et+" "+St,Qt=St+" "+Rt,Xt="Windows",Zt=Xt+" Phone",ti="Nokia",ii="Ouya",ei="Generic",ri=ei+" "+St.toLowerCase(),si=ei+" "+$t.toLowerCase(),ni="Konqueror",oi="Oculus Browser",ai="Vivaldi",li="Yandex",hi="Whale",ui="DuckDuckGo",di="Pale Moon",vi="Waterfox",ci="Brave",fi="Google Search App",pi="(\\d+(\\.\\d+)?)",gi=new RegExp("Version/"+pi),_i=new RegExp(Jt,"i"),mi=new RegExp(Kt+" \\w+","i"),yi=new RegExp(Gt+" \\w+","i"),bi=new RegExp(It+"|PlayBook|BB10","i"),wi={"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"},xi=function(t,i,e,r){i=i||"";var s=function(t){return null!=t&&t.brave?ci:null}(e);return s||(null!=r&&r.detectGoogleSearchApp&&V(t,"GSA/")?fi:V(t," OPR/")&&V(t,"Mini")?Ut:V(t," OPR/")?zt:bi.test(t)?It:V(t,"IE"+St)||V(t,"WPDesktop")?Bt:V(t,"OculusBrowser")?oi:V(t,At)?Ot:V(t,qt)||V(t,"Edg/")?Ht:V(t,ai+"/")?ai:V(t,"YaBrowser/")?li:V(t,hi+"/")?hi:V(t,ui+"/")||V(t,"Ddg/")?ui:V(t,"FBIOS")?"Facebook "+St:V(t,"UCWEB")||V(t,"UCBrowser")?"UC Browser":V(t,"CriOS")?Lt:V(t,"CrMo")||V(t,Dt)?Dt:V(t,Et)&&V(t,Rt)?Yt:V(t,"FxiOS")?Wt:V(t.toLowerCase(),ni.toLowerCase())?ni:V(t,ci+"/")?ci:((t,i)=>i&&V(i,Ct)||function(t){return V(t,Rt)&&!V(t,Dt)&&!V(t,Et)}(t))(t,i)?V(t,St)?Qt:Rt:V(t,"PaleMoon/")?di:V(t,vi+"/")?vi:V(t,Vt)?Vt:V(t,"MSIE")||V(t,"Trident/")?Nt:V(t,"Gecko")?Vt:"")},Si={[Bt]:[new RegExp("rv:"+pi)],[Ht]:[new RegExp(qt+"?\\/"+pi)],[Dt]:[new RegExp("("+Dt+"|CrMo)\\/"+pi)],[Lt]:[new RegExp("CriOS\\/"+pi)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+pi)],[Rt]:[gi],[Qt]:[gi],[zt]:[new RegExp("(Opera|OPR)\\/"+pi)],[Vt]:[new RegExp(Vt+"\\/"+pi)],[Wt]:[new RegExp("FxiOS\\/"+pi)],[ni]:[new RegExp("Konqueror[:/]?"+pi,"i")],[It]:[new RegExp(It+" "+pi),gi],[Yt]:[new RegExp("android\\s"+pi,"i")],[Ot]:[new RegExp(At+"\\/"+pi)],[oi]:[new RegExp("OculusBrowser\\/"+pi)],[ai]:[new RegExp(ai+"\\/"+pi)],[li]:[new RegExp("YaBrowser\\/"+pi)],[hi]:[new RegExp(hi+"\\/"+pi)],[ci]:[new RegExp(ci+"\\/"+pi)],[ui]:[new RegExp("(DuckDuckGo|Ddg)\\/"+pi)],[di]:[new RegExp("PaleMoon\\/"+pi)],[vi]:[new RegExp(vi+"\\/"+pi)],[fi]:[new RegExp("GSA\\/"+pi)],[Nt]:[new RegExp("(rv:|MSIE )"+pi)],Mozilla:[new RegExp("rv:"+pi)]},ki=function(t,i,e,r){var s=xi(t,i,e,r),n=Si[s];if(et(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},Ei=[[new RegExp(Jt+"; "+Jt+" (.*?)[);]","i"),t=>[Jt,t&&t[1]||""]],[new RegExp(Gt,"i"),[Gt,""]],[new RegExp(Kt,"i"),[Kt,""]],[bi,[It,""]],[new RegExp(Xt,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[Zt,""];if(new RegExp(St).test(i)&&!/IEMobile\b/.test(i))return[Xt+" "+St,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=wi[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[Xt,r]}return[Xt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[kt,[t[3],t[4],t[5]||"0"].join(".")]:[kt,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=et(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+Et+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Et+")","i"),t=>t&&t[2]?[Et,[t[2],t[3],t[4]||"0"].join(".")]:[Et,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[jt,""]],[/Linux|debian/i,["Linux",""]]],$i=function(t){return yi.test(t)?Gt:mi.test(t)?Kt:_i.test(t)?Jt:new RegExp(ii,"i").test(t)?ii:new RegExp("("+Zt+"|WPDesktop)","i").test(t)?Zt:/iPad/.test(t)?Tt:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Ft:bi.test(t)?It:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(ti,"i").test(t)?ti:/(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(St).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Et:Pt:new RegExp("(pda|"+St+")","i").test(t)?ri:new RegExp($t,"i").test(t)&&!new RegExp($t+" pc","i").test(t)?si:""},Pi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ti(t,i){return"string"==typeof(e=t)&&Pi.test(e)?t:i();var e}function Ci(t){return t?t.split("#")[0]:t}function Fi(t,i){var e=setTimeout(t,i);return(null==e?void 0:e.unref)&&(null==e||e.unref()),e}function Ri(t,i,e){return Ii.apply(this,arguments)}function Ii(){return(Ii=p((function*(t,i,e){var r;try{return yield Promise.race([t,new Promise(((t,s)=>{r=Fi((()=>{try{null==e||e(),t()}catch(t){s(t)}}),i)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}var Mi={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}},Ai=Mi.info,Oi=0x8000000000000000,Di={}.propertyIsEnumerable;function ji(t,i){try{return Bi(t,i,{ancestors:new WeakSet,remainingNodes:j},0)}catch(t){return[]}}function Li(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:N};if(e.remainingNodes--,ht(t))return{boolValue:t};if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if("undefined"==typeof BigInt)return{stringValue:String(t)};var s=BigInt(t).toString();return t>=Oi||-Oi>t?(null==i||i.debug("Attribute "+s+" is outside the int64 range; encoding it as a string"),{stringValue:s}):{intValue:s}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:U(t)};if("function"==typeof t)return{stringValue:z};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(e.ancestors.has(t))return{stringValue:L};if(r>=O)return{stringValue:N};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?U(o):String(o)}}e.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return Li(a.call(t),i,e,r+1)}catch(t){}return X(t)?{arrayValue:{values:Ni(t,i,e,r+1)}}:{kvlistValue:{values:Bi(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:U(String(t))}}function Ni(t,i,e,r){for(var s=[],n=Math.min(t.length,D),o=0;n>o&&e.remainingNodes>0;o++)try{var a=o in t?t[o]:void 0;if(ot(a))continue;s.push(Li(a,i,e,r))}catch(t){s.push({stringValue:B})}return t.length>o&&s.push({stringValue:N}),s}function Bi(t,i,e,r){var s=[];for(var n in t)if(Di.call(t,n)){if(s.length>=D||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=t[n];if(nt(o)||et(o))continue;s.push({key:U(n),value:Li(o,i,e,r)})}catch(t){s.push({key:U(n),value:{stringValue:B}})}}return s}function zi(t){try{return U(String(t))}catch(t){return B}}function Ui(t,i,e){var r=Mi[t.level||"info"]||Ai,s=r.text,n=r.number,o=String(Date.now())+"000000",a={};i.distinctId&&(a.posthogDistinctId=i.distinctId),i.sessionId&&(a.sessionId=i.sessionId),i.windowId&&(a["window.id"]=i.windowId),ot(i.sessionStartTimestamp)||(a.sessionStartTimestamp=String(i.sessionStartTimestamp)),ot(i.lastActivityTimestamp)||(a.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(a["url.full"]=i.currentUrl),i.screenName&&(a["screen.name"]=i.screenName),i.appState&&(a["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(a.feature_flags=i.activeFeatureFlags);var l=g({},a),h=t.attributes;if(h){var u=[];try{u=Object.keys(h)}catch(t){u=[]}for(var d of u){var v=void 0;try{v=h[d]}catch(t){v=B}Object.defineProperty(l,d,{value:v,enumerable:!0,writable:!0,configurable:!0})}}var c={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:n,severityText:s,body:{stringValue:zi(t.body)},attributes:ji(l,e)};return t.trace_id&&(c.traceId=t.trace_id),t.span_id&&(c.spanId=t.span_id),et(t.trace_flags)||(c.flags=t.trace_flags),c}function qi(t,i,e){return g({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":i,"telemetry.sdk.version":e})}function Hi(t,i,e,r){return{resourceLogs:[{resource:{attributes:ji(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}let Vi=class{constructor(t,i,e,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.qi=i,this.I=e,this.rn=r,this.nn=s,this.sn=n,this.an=o,this.ln=null,this.un=0,this.hn=0,this.dn=0,this.vn=0,this.cn=!1,this.fn=i.maxBufferSize,this.pn=Math.max(null!==(a=i.maxQueueSize)&&void 0!==a?a:i.maxBufferSize,i.maxBufferSize),this.gn=i.flushIntervalMs,this.mn=i.maxBatchRecordsPerPost,this.yn=i.rateCapWindowMs,this.bn=i.maxLogsPerInterval}reset(){this._n(),this.ln=null,this.dn=0,this.vn=0,this.cn=!1,this.un=0,this.hn=0,this.mn=this.qi.maxBatchRecordsPerPost}onReconnect(){this.hn=0,this.wn()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var i=this.kn(t);if(null!==i)if(i.body){if(this.Sn()){var e={record:Ui(i,this.rn(),this.I)};this.nn((()=>this.xn(e)))}}else this.I.info("Log was rejected in beforeSend function")}}kn(t){var i=this.qi.beforeSend;if(!i)return t;var e=X(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.I.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.I.error("Error in beforeSend function for log:",t),null}return r}Sn(){if(void 0===this.bn)return!0;var t=Date.now(),i=t-this.dn;return this.yn>i&&i>=0||(this.dn=t,this.vn=0,this.cn=!1),this.bn>this.vn?(this.vn++,!0):(this.cn||(this.I.warn("captureLog dropping logs: exceeded "+this.bn+" logs per "+this.yn+"ms"),this.cn=!0),!1)}flush(){var t=this;return p((function*(){if(!t._instance.isDisabled)return t.ln||(t.ln=t.Cn().finally((()=>{t.ln=null}))),t.ln}))()}Cn(){var t=this;return p((function*(){var i;t._n();var e=null!==(i=t._instance.getPersistedProperty(S.LogsQueue))&&void 0!==i?i:[];if(0!==e.length)for(var r=e.length,s=0;e.length>0&&r>s;){var n,o;t.un=0;var a=Math.min(e.length,t.mn),l=e.slice(0,a),h=Hi(l.map((t=>t.record)),t.Tn(),null!==(n=t.an)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.Mn(h);if("too-large"===u.kind&&l.length>1)t.mn=Math.max(1,Math.floor(l.length/2)),t.I.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+t.mn);else{if("retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.I.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&t.qi.maxBatchRecordsPerPost>t.mn&&(t.mn=Math.min(t.qi.maxBatchRecordsPerPost,t.mn+1)),yield t.En(l.length),e=null!==(o=t._instance.getPersistedProperty(S.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===u.kind)throw u.error}}}))()}En(t){var i=this;return p((function*(){var e,r=Math.max(0,t-i.un),s=null!==(e=i._instance.getPersistedProperty(S.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(S.LogsQueue,s.slice(r)),yield i.sn()}))()}Tn(){return qi(this.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion())}xn(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(S.LogsQueue))&&void 0!==i?i:[];this.pn>e.length||(e.shift(),this.un++,this.I.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(S.LogsQueue,e),this.fn>e.length?this.In():this.wn()}}In(t){void 0===t&&(t=this.gn),this.Rn||(this.Rn=Fi((()=>{this.Rn=void 0,this.wn()}),t))}Pn(){var t=Math.min(Math.max(0,this.hn-1),6);return this.gn*Math.pow(2,t)}An(){var t=this._instance.getPersistedProperty(S.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return p((function*(){i._n();var e=i.flush().catch((()=>{}));void 0!==t?yield Ri(e,t):yield e}))()}flushWithTimeout(t){var i=this;return p((function*(){var e=i.flush();yield Ri(e,t,(()=>{e.catch((()=>{}))}))}))()}wn(){this.flush().then((()=>{this.hn=0}),(t=>{this.hn++,this.I.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.An()&&this.In(this.Pn())}))}_n(){this.Rn&&(clearTimeout(this.Rn),this.Rn=void 0)}};var Wi=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Gi(t){return String(t)+"000000"}function Ki(t,i,e,r){var s="";return r&&(s=Object.keys(r).sort().map((t=>JSON.stringify(t)+":"+JSON.stringify(r[t]))).join(",")),t+"\0"+i+"\0"+(null!=e?e:"")+"\0"+s}let Ji=class{constructor(t,i,e){this._instance=t,this.qi=i,this.I=e,this.Fn=new Map,this.ln=null,this.Ln=!1,this.On=new Map,this.Dn=new Set,this.$n=0}count(t,i,e){void 0===i&&(i=1),this.Nn({name:t,type:"count",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}gauge(t,i,e){this.Nn({name:t,type:"gauge",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}histogram(t,i,e){this.Nn({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this,i=this.ln,e=function(){var e=p((function*(){i&&(yield i.catch((()=>{}))),yield t.qn()}));return function(){return e.apply(this,arguments)}}(),r=e().finally((()=>{this.ln===r&&(this.ln=null)}));return this.ln=r,r}drainWindow(){if(0===this.Fn.size)return null;var t=this.Fn;return this.Fn=new Map,this.Ln=!1,this.On=new Map,this.Dn=new Set,this.jn(t)}reset(){this.$n++,this._n(),this.Fn=new Map,this.ln=null,this.Ln=!1,this.On=new Map,this.Dn=new Set}Nn(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var i=this.kn(t);if(null!==i)if(i.name&&"string"==typeof i.name)if("number"==typeof i.value&&Number.isFinite(i.value))if("count"===i.type&&0>i.value)this.I.warn("Dropping count '"+i.name+"': counters are monotonic, value must be >= 0");else{var e,r;try{e=i.attributes?g({},i.attributes):void 0,r=Ki(i.type,i.name,i.unit,e)}catch(t){return void this.I.warn("Dropping metric '"+i.name+"': attributes could not be serialized",t)}var s=this.Fn.get(r);if(!s){if(!this.Bn())return;s={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now()},this.Fn.set(r,s)}var n=this.On.get(i.name);void 0===n?this.On.set(i.name,i.type):n===i.type||this.Dn.has(i.name)||(this.Dn.add(i.name),this.I.warn("Metric name '"+i.name+"' is already used as a "+n+"; recording it as a "+i.type+" too will blend both series in charts. Use a distinct name.")),this.Hn(s,i.value),this.In()}else this.I.warn("Dropping metric '"+i.name+"': value must be a finite number");else this.I.warn("Dropping metric with empty name")}}Bn(){return this.qi.maxSeriesPerFlush>this.Fn.size||(this.Ln||(this.Ln=!0,this.I.warn("Metric series cap reached ("+this.qi.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Hn(t,i){var e;switch(t.type){case"count":t.total=(null!==(e=t.total)&&void 0!==e?e:0)+i;break;case"gauge":t.last=i;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:i,max:i,bucketCounts:new Array(Wi.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=i,r.min=Math.min(r.min,i),r.max=Math.max(r.max,i),r.bucketCounts[function(t,i){for(var e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,Wi)]+=1}}kn(t){var i=this.qi.beforeSend;if(!i)return t;var e=X(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.I.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.I.error("Error in beforeSend function for metric:",t),null}return r}In(){this.Rn||(this.Rn=Fi((()=>{this.Rn=void 0,this.flush().catch((t=>{this.I.error("Metrics flush failed:",t)}))}),this.qi.flushIntervalMs))}_n(){this.Rn&&(clearTimeout(this.Rn),this.Rn=void 0)}qn(){var t=this;return p((function*(){if(0!==t.Fn.size){var i=t.Fn;t.Fn=new Map,t.Ln=!1,t.On=new Map,t.Dn=new Set;var e=t.$n,r=yield t._instance.Un(t.jn(i));if(e===t.$n)switch(r.kind){case"ok":return;case"retry-later":return t.zn(i),void t.In();case"too-large":return void t.I.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.I.error("Failed to send metrics batch:",r.error)}}}))()}jn(t){return i=this.Wn(t),e=function(t,i,e){return g({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":i,"telemetry.sdk.version":e})}(this.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:ji(e)},scopeMetrics:[{scope:{name:r,version:s},metrics:i}]}]};var i,e,r,s}Wn(t){var i=Gi(Date.now()),e=new Map;for(var r of t.values()){var s,n=Ki(r.type,r.name,r.unit,void 0),o=e.get(n);o||(o=g({name:r.name},r.unit&&{unit:r.unit}),"count"===r.type?o.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===r.type?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},e.set(n,o));var a=ji(null!==(s=r.attributes)&&void 0!==s?s:{},this.I),l=Gi(r.windowStartMs);if("count"===r.type){var h,u={attributes:a,startTimeUnixNano:l,timeUnixNano:i,asDouble:null!==(h=r.total)&&void 0!==h?h:0};o.sum.dataPoints.push(u)}else if("gauge"===r.type){var d,v={attributes:a,timeUnixNano:i,asDouble:null!==(d=r.last)&&void 0!==d?d:0};o.gauge.dataPoints.push(v)}else r.hist&&o.histogram.dataPoints.push({attributes:a,startTimeUnixNano:l,timeUnixNano:i,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:Wi})}return Array.from(e.values())}zn(t){var i,e;for(var r of t){var s=r[0],n=r[1],o=this.Fn.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(i=o.total)&&void 0!==i?i:0)+(null!==(e=n.total)&&void 0!==e?e:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this.Bn()&&this.Fn.set(s,n)}}};var Yi,Qi,Xi;function Zi(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Xi&&e.length===Qi||(Qi=e.length,Xi=e.reduce(((e,r)=>{Yi||(Yi={});var s=Yi[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,h=i[r];if(l&&h){e[l]=h,Yi[r]=[l,h];break}}return e}),{})),Xi}}class te{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return p((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&X(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e,r;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),g({},t,{cause:e,stack:r})}applyChunkIds(t,i){return t.map((t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t)))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return p((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,i){var e,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(r=i.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,g({},i,{handled:!0}))),o}buildParsingContext(t){var i;return{chunkIdMap:Zi(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var r=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return g({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>r(t,e),next:t=>r(t,e+1)})}}var ie="?";function ee(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?ie:e,in_app:!(null!=i&&i.startsWith("webkit-masked-url://"))&&"<anonymous>"!==i};return et(r)||(n.lineno=r),et(s)||(n.colno=s),n}var re=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:ie,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},se=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ne=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,oe=/\((\S*)(?::(\d+))(?::(\d+))\)/,ae=(t,i)=>{var e=se.exec(t);if(e)return ee(i,e[1],ie,+e[2],+e[3]);var r=ne.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=oe.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=re(r[1]||ie,r[2]);return ee(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},le=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,he=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ue=(t,i)=>{var e=le.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=he.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||ie,o=re(n,s);return ee(i,s=o[1],n=o[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},de=/\(error: (.*)\)/;class ve{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=rt(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return ft(t,"DOMException")}isDOMError(t){return ft(t,"DOMError")}}class ce{match(t){return pt(t)}coerce(t,i){var e,r=this.getStack(t),s=void 0===r;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=r?r:null==(e=i.syntheticException)?void 0:e.stack,cause:t.cause?i.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){return t.stacktrace||t.stack||void 0}}class fe{constructor(){}match(t){return!!ft(t,"ErrorEvent")&&(null!=t.error||this.fi(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);var r=i.apply(t.message);return g({},r,{stack:null!==(e=this.pi(t))&&void 0!==e?e:r.stack,synthetic:!0})}fi(t){return rt(t.message)&&t.message.length>0}pi(t){var i,e,r=t,s=null!==(i=r.lineno)&&void 0!==i?i:0,n=null!==(e=r.colno)&&void 0!==e?e:0;if(rt(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}}var pe=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class ge{match(t){return"string"==typeof t}coerce(t,i){var e,r=this.getInfos(t),s=r[0],n=r[1];return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(pe);return r&&(i=r[1],e=r[2]),[i,e]}}var _e=["fatal","error","warning","log","info","debug"];function me(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(i>=s.length)return r===e.length?s:s.length>i?s.slice(0,i)+"...":s}return""}class ye{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r,s=this.getErrorPropertyFromObject(t);return s?i.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null==(r=i.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(gt(t))return t.constructor.name;var i="name"in t?t.name:void 0;return rt(i)&&!st(i)?i:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+me(t)}isSeverityLevel(t){return rt(t)&&!st(t)&&_e.indexOf(t)>=0}getStack(t){try{return rt(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:rt(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(var i in t)if({}.hasOwnProperty.call(t,i)){var e=t[i];if(pt(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class be{match(t){return gt(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+me(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class we{match(t){return ct(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class xe{match(t){return ft(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!gt(t))return!1;try{var i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return ct(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var Se="$message",ke="$timestamp",Ee=new Set([Se,ke]),$e={enabled:!0,max_bytes:32768};function Pe(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:$e.enabled,max_bytes:Ce(t.max_bytes,$e.max_bytes)}:g({},$e)}class Te{constructor(t){this.Vn=[],this.Gn=0,this.qi=Pe(t)}setConfig(t){this.qi=Pe(t),this.Zn()}add(t){var i=function(t){var i;try{i=K(t)}catch(t){return}try{var e=JSON.parse(i);if(!tt(e))return;var r=e,s=r[Se],n=r[ke];if(!rt(s)||0===s.trim().length)return;if(!rt(n)&&!at(n))return;return{step:r,json:i}}catch(t){return}}(t);if(i){var e=function(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var i=encodeURIComponent(t),e=0,r=0;i.length>r;r++)"%"===i[r]?(e+=1,r+=2):e+=1;return e}(i.json);e>this.qi.max_bytes||(this.Vn.push({step:i.step,bytes:e}),this.Gn+=e,this.Zn())}}getAttachable(){return this.Vn.map((t=>t.step))}clear(){this.Vn=[],this.Gn=0}size(){return this.Vn.length}Zn(){for(;this.Gn>this.qi.max_bytes&&this.Vn.length>0;){var t=this.Vn.shift();t&&(this.Gn-=t.bytes)}}}function Ce(t,i){if(!at(t)||t===1/0||t===-1/0)return i;var e=Math.floor(t);return 0>e?i:e}var Fe=function(i,e){var r=(void 0===e?{}:e).debugEnabled,s={F(e){if(t&&(c.DEBUG||t.POSTHOG_DEBUG||r)&&!et(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[e]?t.console[e].__rrweb_original__:t.console[e]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(i,...o)}},debug(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];s.F("debug",...i)},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];s.F("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];s.F("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];s.F("error",...i)},critical(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];console.error(i,...e)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,e)=>Fe(i+" "+t,e)};return s},Re=Fe("[PostHog.js]"),Ie=Re.createLogger,Me=Ie("[ExternalScriptsLoader]"),Ae=t=>{var i=null==r?void 0:r.querySelectorAll("script");if(i)for(var e=0;i.length>e;e++)if(i[e].src===t||i[e].getAttribute("src")===t)return i[e]},Oe=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return Me.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var s=Ae(i);if(s){if(s.__posthog_loading_callback_fired)return e();var n=s.__posthog_loading_error;return n?e(n):(s.addEventListener("load",(t=>{s.__posthog_loading_callback_fired=!0,e(void 0,t)})),void s.addEventListener("error",(t=>{s.__posthog_loading_error=t,e(t)})))}var o=()=>{if(!r)return e("document not found");if(Ae(i))return Oe(t,i,e);var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=i,s.onload=t=>{s.__posthog_loading_callback_fired=!0,e(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,e(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return e("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?o():null==r||r.addEventListener("DOMContentLoaded",o)},De={},je=(t,i)=>{var e="/static/"+i+".js?v="+t.version;if("toolbar"===i){var r=3e5;e=e+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",e)};v.__PosthogExtensions__=v.__PosthogExtensions__||{},v.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{if("remote-config"!==i){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+i+".js"),n=De[s];if("fallback"===r&&n){if(Ae(n))return void Oe(t,n,e);delete De[s]}Oe(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)e(r);else{var o,a=je(t,i);De[s]=a;var l=Ae(s);null==l||null==(o=l.parentNode)||o.removeChild(l),Oe(t,a,e)}else e(void 0,n)}:e)}else Oe(t,je(t,i),e)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Oe(t,o,e)}},v.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{var r=t.requestRouter.endpointFor("api",i);Oe(t,r,e)};c.DEBUG=!1,c.LIB_VERSION="1.419.0",c.LIB_NAME="web";var Le="$people_distinct_id",Ne="distinct_id",Be="$device_id",ze="$device_model",Ue="__alias",qe="__timers",He="$autocapture_disabled_server_side",Ve="$heatmaps_enabled_server_side",We="$exception_capture_enabled_server_side",Ge="$error_tracking_suppression_rules",Ke="$error_tracking_capture_extension_exceptions",Je="$web_vitals_enabled_server_side",Ye="$dead_clicks_enabled_server_side",Qe="$product_tours_enabled_server_side",Xe="$web_vitals_allowed_metrics",Ze="$session_recording_remote_config",tr="$replay_sample_rate",ir="$replay_override_sampling",er="$replay_override_linked_flag",rr="$replay_override_url_trigger",sr="$replay_override_event_trigger",nr="$sesid",or="$session_is_sampled",ar="$enabled_feature_flags",lr="$active_feature_flags",hr="$early_access_features",ur="$feature_flag_details",dr="$feature_flag_payloads",vr="$feature_flag_request_id",cr="$minimal_flag_called_events",fr="$override_feature_flags",pr="$override_feature_flag_payloads",gr="$stored_person_properties",_r="$stored_group_properties",mr="$groups",yr="$surveys",br="$surveys_loaded_at",wr="$surveys_activated",xr="$surveys_activated_session",Sr="$surveys_activated_timestamps",kr="ph_product_tours",Er="$flag_call_reported",$r="$flag_call_reported_session_id",Pr="$feature_flag_errors",Tr="$feature_flag_evaluated_at",Cr="$user_state",Fr="$client_session_props",Rr="$capture_rate_limit",Ir="$initial_campaign_params",Mr="$initial_referrer_info",Ar="$initial_person_info",Or="$epp",Dr="$posthog_cookieless",jr="$cookieless_mode",Lr="$sdk_debug_extensions_init_method",Nr="$sdk_debug_extensions_init_time_ms",Br="$sdk_debug_recording_script_not_loaded",zr="PostHog loadExternalDependency extension not found.",Ur="on_reject",qr="always",Hr="anonymous",Vr="identified",Wr="identified_only",Gr="visibilitychange",Kr="beforeunload",Jr="$pageview",Yr="$pageleave",Qr="$identify",Xr="$groupidentify";function Zr(t,i){X(t)&&t.forEach(i)}function ts(t,i){if(!ot(t))if(X(t))t.forEach(i);else if(ut(t))t.forEach(((t,e)=>i(t,e)));else for(var e in t)Y.call(t,e)&&i(t[e],e)}var is=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];for(var s of e)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function es(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}var rs=function(t){try{return t()}catch(t){return}},ss=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){Re.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Re.critical(t)}}},ns=function(t){var i={};return ts(t,(function(t,e){(rt(t)&&t.length>0||at(t))&&(i[e]=t)})),i};var os=["herokuapp.com","vercel.app","netlify.app"];function as(t){var i=null==t?void 0:t.hostname;if(!rt(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of os)if(e===r)return!1;return!0}function ls(t,i,e,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(i,e,{capture:void 0!==n&&n,passive:void 0===o||o})}function hs(t){return"ph_toolbar_internal"===t.name}var us=t=>{if(r){try{for(var i=t+"=",e=r.cookie.split(";").filter((t=>t.length)),s=0;e.length>s;s++){for(var n=e[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(i))return decodeURIComponent(n.substring(i.length,n.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return at(t)&&isFinite(t)&&Math.floor(t)===t});class ds{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,e,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||0>t||0>i||0>e||0>r||t>0xffffffffffff||i>4095||e>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/256,s[5]=t,s[6]=112|i>>>8,s[7]=i,s[8]=128|e>>>24,s[9]=e>>>16,s[10]=e>>>8,s[11]=e,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new ds(s)}toString(){for(var t="",i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new ds(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;16>i;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class vs{generate(){var t=this.generateOrAbort();if(!et(t))return t;this.Rr=0;var i=this.generateOrAbort();if(et(i))throw new Error("Could not generate UUID after timestamp reset");return i}generateOrAbort(){var t=Date.now();if(t>this.Rr)this.Rr=t,this.Ar();else{if(this.Rr>=t+1e4)return;this.Lr++,this.Lr>4398046511103&&(this.Rr++,this.Ar())}return ds.fromFieldsV7(this.Rr,Math.trunc(this.Lr/Math.pow(2,30)),this.Lr&Math.pow(2,30)-1,this.Or.nextUint32())}Ar(){this.Lr=1024*this.Or.nextUint32()+(1023&this.Or.nextUint32())}constructor(){this.Rr=0,this.Lr=0,this.Or=new ps}}var cs,fs=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!et(t.crypto)&&crypto.getRandomValues&&(fs=t=>crypto.getRandomValues(t));class ps{nextUint32(){return this.ft.length>this.Fr||(fs(this.ft),this.Fr=0),this.ft[this.Fr++]}constructor(){this.ft=new Uint32Array(8),this.Fr=1/0}}var gs=()=>_s().toString(),_s=()=>(cs||(cs=new vs)).generate(),ms="",ys=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var bs={Nr:()=>!!r,jr(t){Re.error("cookieStore error: "+t)},Pr:us,Br(t){var i;try{i=JSON.parse(bs.Pr(t))||{}}catch(t){}return i},Dr(t,i,e,s,n){if(!r)return!1;try{var o="",a="",l=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=r),ms)return ms;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),s=Math.min(e.length,8),n="dmn_chk_"+gs();!ms&&s--;){var o=e.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";i.cookie=a+";max-age=3",i.cookie.includes(n)&&(i.cookie=a+";max-age=0",ms=o)}return ms}(t);if(!e){var s=(t=>{var i=t.match(ys);return i?i[0]:""})(t);s!==e&&Re.info("Warning: cookie subdomain discovery mismatch",s,e),e=s}return e?"; domain=."+e:""}return""}(r.location.hostname,s);if(e){var h=new Date;h.setTime(h.getTime()+864e5*e),o="; expires="+h.toUTCString()}n&&(a="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(i))+o+"; SameSite=Lax; path=/"+l+a;return u.length>3686.4&&Re.warn("cookieStore warning: large cookie, len="+u.length),r.cookie=u,!0}catch(t){return!1}},qr(t,i){if(null!=r&&r.cookie)try{bs.Dr(t,"",-1,i)}catch(t){return}}},ws=null,xs={Nr(){if(!nt(ws))return ws;var i=!0;if(et(t))i=!1;else try{var e="__mplssupport__";xs.Dr(e,"xyz"),'"xyz"'!==xs.Pr(e)&&(i=!1),xs.qr(e)}catch(t){i=!1}return i||Re.error("localStorage unsupported; falling back to cookie store"),ws=i,i},jr(t){Re.error("localStorage error: "+t)},Pr(i){try{return null==t?void 0:t.localStorage.getItem(i)}catch(t){xs.jr(t)}return null},Br(t){try{return JSON.parse(xs.Pr(t))||{}}catch(t){}return null},Dr(i,e){try{return null==t||t.localStorage.setItem(i,JSON.stringify(e)),!0}catch(t){xs.jr(t)}return!1},qr(i){try{null==t||t.localStorage.removeItem(i)}catch(t){xs.jr(t)}}},Ss=[gr,lr,ar,ur,dr,vr,Tr,Pr,Er],ks=[Be,Ne,nr,or,Or,Ar,Cr],Es=t=>t+"_cpm",$s=["__proto__","constructor","prototype"],Ps=t=>{if(!tt(t))return{};var i={};return Object.keys(t).forEach((e=>{-1===$s.indexOf(e)&&(i[e]=t[e])})),i},Ts=function(t,i){void 0===i&&(i=[]);var e={};return[...ks,...i].forEach((i=>{var r=t[i];et(r)||nt(r)||""===r||(e[i]=r)})),e},Cs=t=>{for(var i=5381,e=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);i=33*i^s,e=Math.imul(e^s,16777619)}return t.length.toString(36)+"."+(i>>>0).toString(36)+"."+(e>>>0).toString(36)},Fs=(t,i)=>({p:i,f:Cs(JSON.stringify(t))}),Rs=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{var e=bs.Br(Es(t)),r=(null==e?void 0:e.f)===Cs(i)&&X(e.p);return{properties:r?e.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Is=(t,i)=>i+"|"+(bs.Pr(Es(t))||""),Ms={},As={Nr:()=>!0,jr(t){Re.error("memoryStorage error: "+t)},Pr:t=>Ms[t]||null,Br:t=>Ms[t]||null,Dr:(t,i)=>(Ms[t]=i,!0),qr(t){delete Ms[t]}},Os=null,Ds={Nr(){if(!nt(Os))return Os;if(Os=!0,et(t))Os=!1;else try{var i="__support__";Ds.Dr(i,"xyz"),'"xyz"'!==Ds.Pr(i)&&(Os=!1),Ds.qr(i)}catch(t){Os=!1}return Os},jr(t){Re.error("sessionStorage error: ",t)},Pr(i){try{return null==t?void 0:t.sessionStorage.getItem(i)}catch(t){Ds.jr(t)}return null},Br(t){try{return JSON.parse(Ds.Pr(t))||null}catch(t){}return null},Dr(i,e){try{return null==t||t.sessionStorage.setItem(i,JSON.stringify(e)),!0}catch(t){Ds.jr(t)}return!1},qr(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){Ds.jr(t)}}};class js{constructor(t){this._instance=t}get qi(){return this._instance.config}get consent(){return this.cs()?0:this.fs}isOptedOut(){return this.qi.cookieless_mode===qr||this.isRejected()||-1===this.consent&&this.qi.cookieless_mode===Ur}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.qi.opt_out_capturing_by_default}optInOut(t){this.ps.Dr(this.gs,t?1:0,this.qi.cookie_expiration,this.qi.cross_subdomain_cookie,this.qi.secure_cookie)}reset(){this.ps.qr(this.gs,this.qi.cross_subdomain_cookie)}get gs(){var t=this._instance.config,i=t.token,e=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(e?e+i:"__ph_opt_in_out_"+i)}get fs(){var t=this.ps.Pr(this.gs);return yt(t)?1:V(bt,t)?0:-1}get ps(){var t=this.qi.opt_out_capturing_persistence_type,i="localStorage"===t?xs:bs;if(!this.ys||this.ys!==i){this.ys=i;var e="localStorage"===t?bs:xs;e.Pr(this.gs)&&(this.ys.Pr(this.gs)||this.optInOut(yt(e.Pr(this.gs))),e.qr(this.gs,this.qi.cross_subdomain_cookie))}return this.ys}cs(){return!!this.qi.respect_dnt&&[null==e?void 0:e.doNotTrack,null==e?void 0:e.msDoNotTrack,v.doNotTrack].some((t=>yt(t)))}}function Ls(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!Z(r))return i;try{var s=r(i);return rt(s)&&s?s:i}catch(t){return Re.error("Error in get_current_url, falling back to window.location.href",t),i}}var Ns="__POSTHOG_TOOLBAR__",Bs=1,zs=3,Us=11;function qs(t){return t instanceof Element&&(t.id===Ns||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Hs(t){return!!t&&t.nodeType===Bs}function Vs(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function Ws(t){return!!t&&t.nodeType===zs}function Gs(t){return!!t&&t.nodeType===Us&&Hs(t.host)}var Ks=1e3;function Js(t){return t?W(t).split(/\s+/):[]}function Ys(i,e){var r=function(i){var e,r=null==t||null==(e=t.location)?void 0:e.href;return et(r)?void 0:Ls(i,r)}(e);return!!(r&&i&&i.some((t=>r.match(t))))}function Qs(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return Js(i)}function Xs(t){return ot(t)?null:W(t).split(/(\s+)/).filter((t=>Sn(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Zs(t){var i="";return fn(t)&&!pn(t)&&t.childNodes&&t.childNodes.length&&ts(t.childNodes,(function(t){var e;Ws(t)&&t.textContent&&(i+=null!==(e=Xs(t.textContent))&&void 0!==e?e:"")})),W(i)}function tn(t){var i;return et(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var en=["a","button","form","input","select","textarea","label"];function rn(t,i){if(et(i))return!0;var e,r=function(t){if(i.some((i=>function(t,i){var e=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!e&&e.call(t,i)}catch(t){return!1}}(t,i))))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function sn(t){var i=t.parentNode;return!(!i||!Hs(i))&&i}var nn=[".ph-no-autocapture","[data-ph-no-autocapture]"],on=["next","previous","prev",">","<"],an=[...on,"+","-","−","–"],ln=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,hn=[".ph-no-rageclick",".ph-no-capture"],un=["","text","search","email","password","url","tel","number"];function dn(i,e){if(!t||vn(i))return!1;var r,s,n,o,a;if(ht(e)?(r=!!e&&hn,s=void 0,n=!1):(r=null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:hn,s=null==e?void 0:e.content_ignorelist,n=null!==(a=null==e?void 0:e.ignore_text_selection)&&void 0!==a&&a),!1===r)return!1;if(n&&function(t){return!(!t||!Hs(t))&&(!!Vs(t,"textarea")||(Vs(t,"input")?V(un,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var i=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===i||""===i}(t)))}(i))return!1;var l=cn(i,!1).targetElementList;return!function(t,i){if(!1===t||et(t))return!1;var e;if(!0===t)e=on;else{if(!X(t))return!1;if(t.length>10)return Re.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map((t=>t.toLowerCase()))}return i.some((t=>{var i=t.safeText,r=t.ariaLabel;return e.some((t=>ln(i,t)||ln(r,t)))}))}(s,l.map((t=>{var i;return{safeText:Zs(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!rn(l,r)}var vn=t=>!t||Vs(t,"html")||!Hs(t),cn=(i,e)=>{if(!t||vn(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[i],n=i;n.parentNode&&!Vs(n,"body");)if(Gs(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=sn(n);if(!o)break;if(e||en.indexOf(o.tagName.toLowerCase())>-1)r=!0;else try{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}catch(t){}s.push(o),n=o}return{parentIsUsefulElement:r,targetElementList:s}};function fn(t){for(var i=new Set,e=0,r=t;r.parentNode&&!Vs(r,"body");r=r.parentNode){if(e++>=Ks||i.has(r))return!1;i.add(r);var s=Qs(r);if(V(s,"ph-sensitive")||V(s,"ph-no-capture"))return!1}if(V(Qs(t),"ph-include"))return!0;var n=t.type||"";if(rt(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!rt(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function pn(t){return!!(Vs(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Vs(t,"select")||Vs(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var gn=new RegExp("^(?:(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}))$"),_n=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,mn=[16,15,14,13],yn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),bn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),wn=/[0-9A-Za-z_]/;function xn(t){for(var i=0,e=!1,r=t.length-1;r>=0;r--){var s=t.charCodeAt(r)-48;e&&(s*=2)>9&&(s-=9),i+=s,e=!e}return i%10==0}function Sn(t,i){if(void 0===i&&(i=!0),ot(t))return!1;if(rt(t)){t=W(t);var e=i?gn.test((t||"").replace(/[- ]/g,"")):function(t){var i;for(_n.lastIndex=0;i=_n.exec(t);){var e=i[2];if(e)for(var r=e.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of mn){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(gn.test(a)&&xn(a))return!0}}}return!1}(t);if(e)return!1;var r=i?yn.test(t):function(t){var i;for(bn.lastIndex=0;i=bn.exec(t);){var e=i[1],r=i[3];if(!(e&&r&&wn.test(e)&&wn.test(r)))return!0}return!1}(t);if(r)return!1}return!0}function kn(t){var i=Zs(t);return Sn(i=(i+" "+En(t)).trim())?i:""}function En(t){var i="";return t&&t.childNodes&&t.childNodes.length&&ts(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=Zs(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+En(t)).trim())}catch(t){Re.error("[AutoCapture]",t)}})),i}function $n(t){return t.replace(/"|\\"/g,'\\"')}function Pn(t){var i=t.attr__class;if(i)return X(i)?i:Js(i)}var Tn=Ie("[Dead Clicks]"),Cn=()=>!0,Fn=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(Ye)),r=t.instance.config.capture_dead_clicks;return ht(r)?r:!!tt(r)||e};class Rn{get lazyLoadedDeadClicksAutocapture(){return this.bs}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[Ye]:i.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this._s((()=>{this.ws()})):this.stop()}_s(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.initDeadClicksAutocapture?t():null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Tn.error("failed to load script",i):t()}))}ws(){var t;if(r){if(!this.bs&&null!=(t=v.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=tt(this.instance.config.capture_dead_clicks)?g({},this.instance.config.capture_dead_clicks):{};i.__onCapture=this.onCapture,this.onCapture&&(i.capture_dead_swipes=!1),this.bs=v.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.bs.start(r),Tn.info("starting...")}}else Tn.error("`document` not found. Cannot start.")}stop(){this.bs&&(this.bs.stop(),this.bs=void 0,Tn.info("stopping..."))}}var In=Ie("[SegmentIntegration]");var Mn="posthog-js";function An(t,i){var e=void 0===i?{}:i,r=e.organization,s=e.projectId,n=e.prefix,o=e.severityAllowList,a=void 0===o?["error"]:o,l=e.sendExceptionsToPostHog,h=void 0===l||l;return i=>{var e,o,l,u,d;if("*"!==a&&!a.includes(i.level)||!t.__loaded)return i;i.tags||(i.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,f=(null==(e=i.exception)?void 0:e.values)||[],p=f.map((t=>g({},t,{stacktrace:t.stacktrace?g({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>g({},t,{platform:"web:javascript"})))}):void 0}))),_={$exception_message:(null==(o=f[0])?void 0:o.value)||i.message,$exception_type:null==(l=f[0])?void 0:l.type,$exception_level:i.level,$exception_list:p,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(u=f[0])?void 0:u.value)||i.message,$sentry_exception_type:null==(d=f[0])?void 0:d.type,$sentry_tags:i.tags};return r&&s&&(_.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+i.event_id),h&&(null==(c=t.exceptions)||c.sendExceptionEvent(_)),i}}class On{constructor(t,i,e,r,s,n){this.name=Mn,this.setupOnce=function(o){o(An(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Dn{constructor(t){this.ks=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(Re.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.Ss=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.xs()}xs(){var t;this.Cs=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.ks)}destroy(){var t;null==(t=this.Cs)||t.call(this),this.Cs=void 0}doPageView(i,e){var r,s=this.Ts(i,e);return this.Ss={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:e,timestamp:i},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var i;return this.Ts(t,null==(i=this.Ss)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Ss)?void 0:t.pageViewId}}Ts(t,i){var e=this.Ss;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,h=s.lastContentY,u=s.maxContentY;if(!(et(n)||et(o)||et(a)||et(l)||et(h)||et(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?wt(o/n,0,1,Re):1,v=n>1?wt(a/n,0,1,Re):1,c=l>1?wt(h/l,0,1,Re):1,f=l>1?wt(u/l,0,1,Re):1;r=is(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}}var jn=["flags","surveys"],Ln={[Le]:{exposure:"hidden"},[Ue]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[qe]:{exposure:"hidden"},[He]:{exposure:"event"},[Ve]:{exposure:"hidden"},[We]:{exposure:"event"},[Ge]:{exposure:"hidden"},[Ke]:{exposure:"event"},[Je]:{exposure:"event"},[Ye]:{exposure:"event"},[Qe]:{exposure:"hidden"},[Xe]:{exposure:"event"},[Ze]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[nr]:{exposure:"hidden"},[or]:{exposure:"event"},[tr]:{exposure:"event",shouldSkipFromEventProperties:t=>nt(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"},[ar]:{exposure:"hidden",storageGroup:"flags"},[lr]:{exposure:"hidden",storageGroup:"flags"},[hr]:{exposure:"hidden"},[ur]:{exposure:"hidden",storageGroup:"flags"},[dr]:{exposure:"hidden",storageGroup:"flags"},[vr]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[cr]:{exposure:"hidden",storageGroup:"flags"},[fr]:{exposure:"hidden"},[pr]:{exposure:"hidden"},[gr]:{exposure:"hidden"},[_r]:{exposure:"hidden"},[yr]:{exposure:"hidden",storageGroup:"surveys"},[br]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[wr]:{exposure:"event"},[xr]:{exposure:"hidden"},[Sr]:{exposure:"hidden"},[kr]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Er]:{exposure:"hidden"},[$r]:{exposure:"hidden"},[mr]:{exposure:"event"},[Pr]:{exposure:"hidden"},[Tr]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Cr]:{exposure:"hidden"},[Fr]:{exposure:"hidden"},[Rr]:{exposure:"hidden"},[Ir]:{exposure:"hidden"},[Mr]:{exposure:"hidden"},[Ar]:{exposure:"hidden"},[Or]:{exposure:"hidden"},[ir]:{exposure:"event"},[er]:{exposure:"event"},[rr]:{exposure:"event"},[sr]:{exposure:"event"},[Lr]:{exposure:"event"},[Nr]:{exposure:"event"},[Br]:{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_pending_trigger_conditions:{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"}},Nn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Bn=t=>{var i=Ln[t];if(i)return i;for(var e of Nn){var r=e[1];if(0===t.indexOf(e[0]))return r}},zn=(t,i)=>{try{return JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i)}catch(i){return K(t)}},Un=t=>{var i=null==r?void 0:r.createElement("a");return et(i)?null:(i.href=t,i)},qn=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!X(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){Re.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Hn=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");X(d)&&(i.includes(d[0])?h.push(d[0]+"="+e):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},Vn=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},Wn=(t,i)=>t>=i&&u(),Gn=(t,i,e,r)=>{if(0===t){if(u()){var s=i+1;return s===e&&r(),s}return i}return 0},Kn="https?://(.*)",Jn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Yn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Jn],Qn="<masked>",Xn=["li_fat_id"];function Zn(t,i,e){if(!r)return{};var s,n=i?[...Jn,...e||[]]:[],o=to(Hn(r.URL,n,Qn),t),a=(s={},ts(Xn,(function(t){var i=us(t);s[t]=i||null})),s);return is(a,o)}function to(t,i){var e=Yn.concat(i||[]),r={};return ts(e,(function(i){var e=qn(t,i);r[i]=e||null})),r}function io(t){var i=function(t){return t?0===t.search(Kn+"google.([^/?]*)")?"google":0===t.search(Kn+"bing.com")?"bing":0===t.search(Kn+"yahoo.com")?"yahoo":0===t.search(Kn+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",s={};if(!nt(i)){s.$search_engine=i;var n=r?qn(r.referrer,e):"";n.length&&(s.ph_keyword=n)}return s}function eo(){return navigator.language||navigator.userLanguage}var ro="$direct";function so(){return(null==r?void 0:r.referrer)||ro}function no(t,i,e){void 0===e&&(e=!1);var r=t?[...Jn,...i||[]]:[],n=e?Ci(null==s?void 0:s.href):null==s?void 0:s.href,o=null==n?void 0:n.substring(0,1e3);return{r:so().substring(0,1e3),u:o?Hn(o,r,Qn):void 0}}function oo(t,i){var e;void 0===i&&(i=!1);var r=t.r,s=t.u,n=i?Ci(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==ro?ro:null==(e=Un(r))?void 0:e.host};if(n){o.$current_url=n;var a=Un(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=to(n);is(o,l)}if(r){var h=io(r);is(o,h)}return o}function ao(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function lo(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var ho={flags:Tr,surveys:br},uo=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],vo=t=>t+"_cookie_identity_change_pending",co="main",fo=(t,i)=>{ts(t,((e,r)=>{var s=Bn(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(i,r)||delete t[r]}))};class po{constructor(i,e,r){if(void 0===r&&(r=!0),this.Ms={},this.Es=!1,this.Is=!1,this.Rs=!1,this.Ps=!1,this.qi=i,this.As=r,this.props={},this.Fs=void 0,this.Ls=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(i),this.ps=this.Os(i),this.Is=this.Ds(i),this.load(),i.debug&&Re.info("Persistence loaded",i.persistence,g({},this.props)),this.update_config(i,i,e),this.save(),t){var s=()=>this.flush();ls(t,"beforeunload",s,{capture:!1}),ls(t,"pagehide",s,{capture:!1})}}$s(){var t,i=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return at(i)&&i>0?i:0}Ns(t){if(this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase())if(t)try{var i=Ts(t,this.qi.cookie_persisted_properties||[]),e=Fs(i,this.qi.cookie_persisted_properties||[]),r=JSON.stringify(i)+"|"+JSON.stringify(e),s=bs.Pr(this.Ls)||void 0;s&&Is(this.Ls,s)===r&&(this.qs=r,this.js=s)}catch(t){}else try{var n=bs.Pr(this.Ls)||void 0;this.qs=n?Is(this.Ls,n):void 0,this.js=n}catch(t){}}syncCookieProperties(){return this.Bs(this.qi)}Bs(t,i){if(void 0===i&&(i=!1),this.Hs&&!i||this.Ps||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var e;try{e=bs.Pr(this.Ls)||void 0}catch(t){}if(!e||e===this.js)return!1;var r,s=Is(this.Ls,e);try{r=Ps(JSON.parse(e))}catch(t){return!1}if((bs.Pr(this.Ls)||void 0)!==e)return!1;this.qs=s,this.js=e;var n=Rs(this.Ls,e),o=[...ks,...n.properties],a={};if(Object.keys(r).forEach((t=>{var i=r[t];(et(i)||nt(i)||""===i||t===Cr&&i!==Hr&&i!==Vr)&&(a[t]=!0,delete r[t])})),it(r))return!1;var l=Ne in r||r[Cr]===Hr||r[Cr]===Vr,h=this.props[Ne],u=this.props[Cr],d=is({},this.props);[...ks,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(l||t!==Ne&&t!==Cr)){var i=d[t];!n.isValid&&-1!==ks.indexOf(t)&&(!1===i||0===i)||delete d[t]}})),this.props=is(d,r),!l||Cr in r||Cr in this.props||this.Us(Cr,Hr);var v=this.props[Ne],c=this.props[Cr];return!l||v===h&&c===u||(this.Rs=!0,Ds.Dr(vo(this.Ls),!0),this.zs(gr),this.zs(lr),this.zs(ar),this.zs(ur),this.zs(dr),this.zs(vr),this.zs(Tr),this.zs(Pr),this.zs(Er),c===Hr&&(u===Vr||r[Cr]===Hr||!et(h)&&v!==h)&&(fo(this.props,r),this.zs(_r)),c===Vr?this.props.$user_id=v:delete this.props.$user_id,this.zs(Ue)),!0}consumeCookieIdentityChange(){var t=vo(this.Ls),i=this.Rs||!!Ds.Pr(t);return this.Rs=!1,i&&Ds.qr(t),i}Ws(t){return void 0===t&&(t=!1),!(this.Ps||this.Hs&&!t||!this.qi.cookieWinsOnConflict||"localstorage+cookie"!==this.qi.persistence.toLowerCase()||(this.Ps=!0,0))}Vs(){this.Ps&&(et(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),delete this.Ms[co],this.Zs(!0))}Qs(t){if(void 0===t&&(t=!0),this.Ps)try{t?this.Vs():et(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0)}finally{this.Ps=!1}}isDisabled(){return!!this.Hs}Os(i){-1===uo.indexOf(i.persistence.toLowerCase())&&(Re.critical("Unknown persistence type "+i.persistence+"; falling back to localStorage+cookie"),i.persistence="localStorage+cookie");var e,r=function(i,e){void 0===i&&(i=[]),void 0===e&&(e=!1);var r=[...ks,...i];return g({},xs,{Br(t){try{var i,s={};try{i=bs.Pr(t)||void 0,s=i?Ps(JSON.parse(i)):{}}catch(t){}var n,o=JSON.parse(xs.Pr(t)||"{}");if(e){var a=Rs(t,i),l=[...ks,...a.properties],h={};Object.keys(s).forEach((t=>{var i=s[t];nt(i)||""===i||t===Cr&&i!==Hr&&i!==Vr||(h[t]=i)}));var u=Ne in h||h[Cr]===Hr||h[Cr]===Vr;if(Object.keys(h).length>0){var d,v=o[Ne],c=null!==(d=o[Cr])&&void 0!==d?d:Hr;r.forEach((t=>{if(-1!==l.indexOf(t)&&!(t in s)&&(u||t!==Ne&&t!==Cr)){var i=o[t];!a.isValid&&-1!==ks.indexOf(t)&&(!1===i||0===i)||delete o[t]}})),!u||Cr in s||Cr in o||(o[Cr]=Hr),!u||(Ne in h?h[Ne]:o[Ne])===v&&(Cr in h?h[Cr]:o[Cr])===c||(Ss.forEach((t=>delete o[t])),h[Cr]===Vr&&Ne in h?o.$user_id=h[Ne]:delete o.$user_id,h[Cr]!==Vr&&(delete o[mr],delete o[_r]),delete o.__alias)}n=is(o,h)}else n=is(s,o);return xs.Dr(t,n),n}catch(t){}return null},Dr(t,r,s,n,o,a){var l=xs.Dr(t,r,void 0,void 0,a);try{var h=Ts(r,i);if(Object.keys(h).length){if(e){var u=Es(t),d=Fs(h,i);if(bs.Dr(u,d,s,n,o,a),bs.Pr(u)!==JSON.stringify(d)){bs.qr(u,n);var v=Ts(r);return bs.Dr(t,v,s,n,o,a),l}}bs.Dr(t,h,s,n,o,a)}}catch(t){xs.jr(t)}return l},qr(i,e){try{null==t||t.localStorage.removeItem(i),bs.qr(i,e),bs.qr(Es(i),e)}catch(t){xs.jr(t)}}})}(i.cookie_persisted_properties||[],i.cookieWinsOnConflict),s=!1,n=i.persistence.toLowerCase();return"localstorage"===n&&xs.Nr()?(e=xs,s=!0):"localstorage+cookie"===n&&r.Nr()?(e=r,s=!0):"sessionstorage"===n&&Ds.Nr()?e=Ds:"memory"===n?e=As:"cookie"===n?e=bs:r.Nr()?(e=r,s=!0):e=bs,this.Es=s,e}Js(t){return this.Ls+"__"+t}Ds(t){return this.Es&&!!t.split_storage}properties(){var t={};return ts(this.props,((i,e)=>{var r=Bn(e);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(i))return;t[e]=i}})),t}load(t){if(void 0===t&&(t=!1),!this.Hs||t){var i=this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase(),e=i?xs.Br(this.Ls):null,r={};if(i)try{ts(r=Ps(bs.Br(this.Ls)),((t,i)=>{(et(t)||nt(t)||""===t)&&delete r[i]}))}catch(t){}var s=this.ps.Br(this.Ls);if(s&&(this.props=is({},s)),this.Is&&this.Ks(),i&&s){var n,o,a=null==e?void 0:e[Ne],l=null!==(n=null==e?void 0:e[Cr])&&void 0!==n?n:Hr,h=s[Ne],u=null!==(o=s[Cr])&&void 0!==o?o:Hr;if(h!==a||u!==l){this.Rs=!0,Ds.Dr(vo(this.Ls),!0);var d=is({},this.props);Ss.forEach((t=>delete d[t])),u===Hr&&(l===Vr||r[Cr]===Hr||!et(a)&&h!==a)&&(fo(d,r),delete d[_r]),this.props=d;var v=new Set;Ss.forEach((t=>{var i,e=null==(i=Bn(t))?void 0:i.storageGroup;e&&v.add(e)})),v.forEach((t=>{var i={};ts(this.props,((e,r)=>{var s;(null==(s=Bn(r))?void 0:s.storageGroup)===t&&(i[r]=e)})),it(i)?(xs.qr(this.Js(t)),this.Ms[t]={}):xs.Dr(this.Js(t),i)&&(this.Ms[t]={persisted:!0,fingerprint:this.Ys(i,t)})}))}}Ds.Pr(vo(this.Ls))&&(this.Rs=!0)}}Ks(){for(var t of jn){var i=xs.Br(this.Js(t));if(i&&!it(i)){var e=this.Xs(t);e.persisted=!0,this.ta(t)||(e.fingerprint=this.Ys(i,t)),this.ea(t,i)||is(this.props,i)}}}ta(t){return Object.keys(this.props).some((i=>{var e;return(null==(e=Bn(i))?void 0:e.storageGroup)===t}))}ea(t,i){var e=ho[t];if(!e)return!1;var r=i[e],s=this.props[e];return at(r)&&at(s)&&s>r}refreshKey(t){var i;if(!this.Hs){var e=this.Is?null==(i=Bn(t))?void 0:i.storageGroup:void 0,r=e?xs.Br(this.Js(e)):this.ps.Br(this.Ls);if(r&&t in r)this.Us(t,r[t]);else{if(e){var s=this.ps.Br(this.Ls);if(s&&t in s)return void this.Us(t,s[t])}this.zs(t)}}}save(){if(!this.Hs){var t=this.$s();t>0?et(this.Gs)&&(this.Gs=setTimeout((()=>{this.Gs=void 0,this.Zs()}),t)):this.Zs()}}flush(){et(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0,this.Zs())}Zs(t){void 0===t&&(t=!1),this.Hs||this.Ps&&!t||(t||this.syncCookieProperties(),this.Is?this.ia():this.ra(this.ps,this.Ls,this.props,co)&&this.Ns(this.props))}ia(){var t=this.na(),i=t.main,e=t.groups;for(var r of(this.ra(this.ps,this.Ls,i,co)&&this.Ns(i),jn)){var s,n=e[r];(!it(n)||null!=(s=this.Ms[r])&&s.persisted)&&this.ra(xs,this.Js(r),n,r)}}na(){var t={},i={flags:{},surveys:{}};return ts(this.props,((e,r)=>{var s,n=null==(s=Bn(r))?void 0:s.storageGroup;n?i[n][r]=e:t[r]=e})),{main:t,groups:i}}Ys(t,i){if(i===co)return JSON.stringify(t)+"|"+this.sa+"|"+this.aa+"|"+this.oa;var e={};return ts(t,((t,i)=>{var r;e[i]=null!=(r=Bn(i))&&r.volatile?"__volatile__":t})),JSON.stringify(e)}ra(t,i,e,r){var s,n=this.Xs(r);if(r!==co&&!n.dirty&&!et(n.fingerprint))return!1;try{if((s=this.Ys(e,r))===n.fingerprint)return n.dirty=!1,!1}catch(t){s=void 0}return t.Dr(i,e,this.sa,this.aa,this.oa,this.qi.debug)?(n.dirty=!1,r!==co&&(n.persisted=!0),et(s)||(n.fingerprint=s),!0):(this.qi.debug&&Re.warn('failed to persist storage entry "'+i+'"; will retry on next save'),!1)}remove(t){var i=(void 0===t?{}:t).keepGroupEntries,e=void 0!==i&&i;if(et(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),this.ps.qr(this.Ls,!1),this.ps.qr(this.Ls,!0),!e&&this.As)for(var r of jn)xs.qr(this.Js(r));e?delete this.Ms[co]:this.Ms={},this.qs=void 0,this.js=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(tt(t)){this.syncCookieProperties(),et(i)&&(i="None"),this.sa=et(e)?this.la:e;var r=!1;if(ts(t,((t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.Us(e,t),r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(tt(t)){this.syncCookieProperties(),this.sa=et(i)?this.la:i;var e=!1;if(ts(t,((i,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==i||tt(i)||X(i))&&(this.Us(r,i),e=!0)})),e)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var i="string"==typeof t?[t]:t,e=!1;for(var r of i)r in this.props&&(this.zs(r),e=!0);e&&this.save()}update_campaign_params(){var t=null==r?void 0:r.URL;if(t!==this.Fs){var i=Zn(this.qi.custom_campaign_params,this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties);it(ns(i))||this.register(i),this.Fs=t}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?io(t):{})}update_referrer_info(){var t;this.register_once({$referrer:so(),$referring_domain:null!=r&&r.referrer&&(null==(t=Un(r.referrer))?void 0:t.host)||ro},void 0)}set_initial_person_info(){this.props[Ir]||this.props[Mr]||this.register_once({[Ar]:no(this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties,this.qi.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};ts([Mr,Ir],(i=>{var e=this.props[i];e&&ts(e,(function(i,e){t["$initial_"+G(e)]=i}))}));var i=this.props[Ar];if(i){var e=function(t,i){void 0===i&&(i=!1);var e=oo(t,i),r={};return ts(e,(function(t,i){r["$initial_"+G(i)]=t})),r}(i,this.qi.disable_capture_url_hashes);is(t,e)}return t}safe_merge(t){return ts(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,e){var r=t.persistence!==i.persistence,s=!((t,i)=>{if(t.length!==i.length)return!1;var e=[...t].sort(),r=[...i].sort();return e.every(((t,i)=>t===r[i]))})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),n=r||s,o=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,a=t.disable_persistence||!!e,l=!!this.Hs&&!a;a||this.Bs(i,l),this.qi=t,!a&&(r||s||o)&&(this.qs=void 0,this.js=void 0,this.Bs(g({},t,{cookie_persisted_properties:i.cookie_persisted_properties}),l));var h=n||o?this.Os(t):this.ps,u=this.Ds(t),d=n||u!==this.Is,v=!a&&(d||t.cross_subdomain_cookie!==this.aa||t.secure_cookie!==this.oa)&&this.Ws(l);try{if(this.la=this.sa=t.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),d){var c=this.props;this.clear(),this.ps=h,this.Is=u,this.props=c,this.save()}else o&&(this.ps=h,a||(delete this.Ms[co],this.Zs()))}finally{v&&this.Qs()}}set_disabled(t){this.Hs=t,this.Hs?this.remove():this.save()}set_cross_subdomain(t){t!==this.aa&&(this.aa=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.oa&&(this.oa=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){var e=this.props[qe]||{};e[t]=i,this.Us(qe,e),this.save()}remove_event_timer(t){var i=this.props[qe]||{},e=i[t];return et(e)||(delete i[t],this.Us(qe,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.Us(t,i),this.save()}Us(t,i){var e;this.props[t]=i,null!=(e=Bn(t))&&e.volatile||this.ua(t)}zs(t){delete this.props[t],this.ua(t)}ua(t){var i,e=null==(i=Bn(t))?void 0:i.storageGroup;e&&(this.Xs(e).dirty=!0)}Xs(t){return this.Ms[t]||(this.Ms[t]={})}}function go(t){var i=!0;return{dispose(){if(i){i=!1;var e=t();e&&Z(e.then)&&e.then(void 0,(()=>{}))}}}}var _o="gzip-js",mo="base64",yo="events",bo="cancelEvents",wo="survey shown",xo="survey dismissed",So="survey sent",ko="popover",Eo=Ie("[RateLimiter]");class $o{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{Eo.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Eo.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(Rr))&&void 0!==i?i:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var h=(at(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.ha(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(Rr,a),{isRateLimited:l,remainingTokens:a.tokens}}da(t){var i=this.instance.config.property_denylist;return!X(i)||!i.includes(t)}va(){var t;if(this.da("$current_url")&&this.da("$pathname")&&null!=s&&s.pathname)return""+(null!==(t=s.origin)&&void 0!==t?t:"")+s.pathname}ha(t){var i,e,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.va(),o=this.da("$session_id")?null==(i=(e=this.instance).get_session_id)?void 0:i.call(e):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}}var Po=Ie("[RemoteConfig]");class To{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}ca(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}fa(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return Po.info("Using preloaded remote config",this.remoteConfig),this.pa(this.remoteConfig),void this.ga();if(this._instance.ma())return void Po.warn("Remote config is disabled. Falling back to local config.");this.ca((t=>{if(!t)return Po.info("No config found after loading remote JS config. Falling back to JSON."),void this.fa((t=>{this.pa(t.json,t),this.ga()}));this.pa(t),this.ga()}))}catch(t){Po.error("Error loading remote config",t),this.pa()}}stop(){this.ya&&(clearInterval(this.ya),this.ya=void 0)}refresh(){!this._instance.ma()&&r&&"hidden"!==r.visibilityState&&this._instance.reloadFeatureFlags()}ga(){var t;if(!this.ya){var i=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==i&&(this.ya=setInterval((()=>{this.refresh()}),i))}}pa(t,i){!t&&i&&(0===i.statusCode?i.error||Po.warn("Failed to fetch remote config from PostHog."):Po.error("Failed to fetch remote config from PostHog."));try{this._instance.pa(t?{ok:!0,config:t}:{ok:!1})}catch(t){Po.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var e;null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded()}catch(t){Po.error("Error loading feature flags",t)}}}var Co=Uint8Array,Fo=Uint16Array,Ro=Uint32Array,Io=new Co([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]),Mo=new Co([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]),Ao=new Co([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Oo=function(t,i){for(var e=new Fo(31),r=0;31>r;++r)e[r]=i+=1<<t[r-1];var s=new Ro(e[30]);for(r=1;30>r;++r)for(var n=e[r];e[r+1]>n;++n)s[n]=n-e[r]<<5|r;return[e,s]},Do=Oo(Io,2),jo=Do[1];Do[0][28]=258,jo[258]=28;for(var Lo=Oo(Mo,0)[1],No=new Fo(32768),Bo=0;32768>Bo;++Bo){var zo=(43690&Bo)>>>1|(21845&Bo)<<1;No[Bo]=((65280&(zo=(61680&(zo=(52428&zo)>>>2|(13107&zo)<<2))>>>4|(3855&zo)<<4))>>>8|(255&zo)<<8)>>>1}var Uo=function(t,i,e){for(var r=t.length,s=0,n=new Fo(i);r>s;++s)++n[t[s]-1];var o,a=new Fo(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new Fo(1<<i);var l=15-i;for(s=0;r>s;++s)if(t[s])for(var h=s<<4|t[s],u=i-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[No[d]>>>l]=h}else for(o=new Fo(r),s=0;r>s;++s)o[s]=No[a[t[s]-1]++]>>>15-t[s];return o},qo=new Co(288);for(Bo=0;144>Bo;++Bo)qo[Bo]=8;for(Bo=144;256>Bo;++Bo)qo[Bo]=9;for(Bo=256;280>Bo;++Bo)qo[Bo]=7;for(Bo=280;288>Bo;++Bo)qo[Bo]=8;var Ho=new Co(32);for(Bo=0;32>Bo;++Bo)Ho[Bo]=5;var Vo=Uo(qo,9,0),Wo=Uo(Ho,5,0),Go=function(t){return(t/8>>0)+(7&t&&1)},Ko=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof Fo?Fo:t instanceof Ro?Ro:Co)(e-i);return r.set(t.subarray(i,e)),r},Jo=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},Yo=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8,t[r+2]|=e>>>16},Qo=function(t,i){for(var e=[],r=0;t.length>r;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new Co(0),0];if(1==s){var o=new Co(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort((function(t,i){return t.f-i.f})),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,u=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=e[e[d].f>e[h].f?h++:d++],l=e[h!=u&&e[d].f>e[h].f?h++:d++],e[u++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new Fo(v+1),f=Xo(e[u-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;for(n.sort((function(t,i){return c[i.s]-c[t.s]||t.f-i.f}));s>r;++r){var m=n[r].s;if(i>=c[m])break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>>=g;p>0;){var y=n[r].s;i>c[y]?p-=1<<i-c[y]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;c[b]==i&&(--c[b],++p)}f=i}return[new Co(c),f]},Xo=function(t,i,e){return-1==t.s?Math.max(Xo(t.l,i,e+1),Xo(t.r,i,e+1)):i[t.s]=e},Zo=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new Fo(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;i>=a;++a)if(t[a]==s&&a!=i)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[e.subarray(0,r),i]},ta=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},ia=function(t,i,e){var r=e.length,s=Go(i+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=e[n];return 8*(s+4+r)},ea=function(t,i,e,r,s,n,o,a,l,h,u){Jo(i,u++,e),++s[256];for(var d=Qo(s,15),v=d[0],c=d[1],f=Qo(n,15),p=f[0],g=f[1],_=Zo(v),m=_[0],y=_[1],b=Zo(p),w=b[0],x=b[1],S=new Fo(19),k=0;m.length>k;++k)S[31&m[k]]++;for(k=0;w.length>k;++k)S[31&w[k]]++;for(var E=Qo(S,7),P=E[0],T=E[1],C=19;C>4&&!P[Ao[C-1]];--C);var F,R,I,M,A=h+5<<3,O=ta(s,qo)+ta(n,Ho)+o,D=ta(s,v)+ta(n,p)+o+14+3*C+ta(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(O>=A&&D>=A)return ia(i,u,t.subarray(l,l+h));if(Jo(i,u,1+(O>D)),u+=2,O>D){F=Uo(v,c,0),R=v,I=Uo(p,g,0),M=p;var j=Uo(P,T,0);for(Jo(i,u,y-257),Jo(i,u+5,x-1),Jo(i,u+10,C-4),u+=14,k=0;C>k;++k)Jo(i,u+3*k,P[Ao[k]]);u+=3*C;for(var L=[m,w],N=0;2>N;++N){var B=L[N];for(k=0;B.length>k;++k)Jo(i,u,j[z=31&B[k]]),u+=P[z],z>15&&(Jo(i,u,B[k]>>>5&127),u+=B[k]>>>12)}}else F=Vo,R=qo,I=Wo,M=Ho;for(k=0;a>k;++k)if(r[k]>255){var z;Yo(i,u,F[257+(z=r[k]>>>18&31)]),u+=R[z+257],z>7&&(Jo(i,u,r[k]>>>23&31),u+=Io[z]);var U=31&r[k];Yo(i,u,I[U]),u+=M[U],U>3&&(Yo(i,u,r[k]>>>5&8191),u+=Mo[U])}else Yo(i,u,F[r[k]]),u+=R[r[k]];return Yo(i,u,F[256]),u+R[256]},ra=new Ro([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),sa=function(){for(var t=new Ro(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),na=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function oa(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p(i){for(var e=t,r=0;i.length>r;++r)e=sa[255&e^i[r]]^e>>>8;t=e},d(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n,o,a,l,h=(a=10+((s=i).filename&&s.filename.length+1||0),l=8,function(t,i,e,r,s,n){var o=t.length,a=new Co(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!i||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=ia(l,h,t.subarray(u,d)):(l[u]=!0,h=ia(l,h,t.subarray(u,o)))}else{for(var v=ra[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new Fo(32768),_=new Fo(p+1),m=Math.ceil(e/3),y=2*m,b=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<y)&p},w=new Ro(25e3),x=new Fo(288),S=new Fo(32),k=0,E=0,P=(u=0,0),T=0,C=0;o>u;++u){var F=b(u),R=32767&u,I=_[F];if(g[R]=I,_[F]=R,u>=T){var M=o-u;if((k>7e3||P>24576)&&M>423){h=ea(t,l,0,w,x,S,E,P,C,u-C,h),P=k=E=0,C=u;for(var A=0;286>A;++A)x[A]=0;for(A=0;30>A;++A)S[A]=0}var O=2,D=0,j=f,L=R-I&32767;if(M>2&&F==b(u-L))for(var N=Math.min(c,M)-1,B=Math.min(32767,u),z=Math.min(258,M);B>=L&&--j&&R!=I;){if(t[u+O]==t[u+O-L]){for(var U=0;z>U&&t[u+U]==t[u+U-L];++U);if(U>O){if(O=U,D=L,U>N)break;var q=Math.min(L,U-2),H=0;for(A=0;q>A;++A){var V=u-L+A+32768&32767,W=V-g[V]+32768&32767;W>H&&(H=W,I=V)}}}L+=(R=I)-(I=g[R])+32768&32767}if(D){w[P++]=268435456|jo[O]<<18|Lo[D];var G=31&jo[O],K=31&Lo[D];E+=Io[G]+Mo[K],++x[257+G],++S[K],T=u+O,++k}else w[P++]=t[u],++x[t[u]]}}h=ea(t,l,!0,w,x,S,E,P,C,u-C,h)}return Ko(a,0,r+Go(h)+s)}(n=t,null==(o=i).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),u=h.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>i.level?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&na(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;e.length>=r;++r)t[r+10]=e.charCodeAt(r)}}(h,i),na(h,u-8,e.d()),na(h,u-4,r),h}var aa=!!o||!!n,la="text/plain",ha=!1,ua=(t,i)=>{var e=t.split("#"),r=e[1],s=e[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==i)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},da=function(t,i,e){var r;void 0===e&&(e=!0);var s=t.split("?"),n=s[0],o=s[1],a=g({},i),l=null!==(r=null==o?void 0:o.split("&").map((t=>{var i,r=t.split("="),s=r[0],n=e&&null!==(i=a[s])&&void 0!==i?i:r[1];return delete a[s],s+"="+n})))&&void 0!==r?r:[],h=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return ts(t,(function(t,i){et(t)||et(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)})),s.join(i)}(a);return h&&l.push(h),l.length>0?n+"?"+l.join("&"):n},va=t=>{if(t.ba)return t.ba;var i=t.data,e=t.compression;if(i){if(e===_o){var r=oa(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Co(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;e>o;++o){if(s+5>r.length){var a=new Co(s+8+(e-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Ko(r,0,s)}(zn(i)),{mtime:0});return{contentType:la,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===mo){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,i)=>String.fromCharCode(parseInt(i,16))))):t}(zn(i)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:zn(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=zn(i);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},ca=t=>{var i,e,r=()=>"sendBeacon"===t.transport?{url:da(t.url,{compression:mo}),encodedBody:va(g({},t,{compression:mo,ba:void 0}))}:{url:ua(t.url,"compression"),encodedBody:va(g({},t,{compression:void 0,ba:void 0}))};try{i=va(t)}catch(i){if(F(t.compression,qn(t.url,"compression")))return Re.error("Failed to gzip request body, sending uncompressed payload",i),r();throw i}return i&&F(t.compression,qn(t.url,"compression"))&&!((e=i.body)instanceof ArrayBuffer?C(new Uint8Array(e)):ArrayBuffer.isView(e)&&C(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?(ha=!0,r()):{url:t.url,encodedBody:i}},fa=t=>{try{return ca(t)}catch(i){return Re.error(i),void(null==t.callback||t.callback({statusCode:0,error:i}))}},pa=function(){var t=p((function*(t){var i=zn(t.data),e=yield function(t,i,e){return A.apply(this,arguments)}(i,c.DEBUG,{rethrow:!0});if(!e)return t;var r=yield e.arrayBuffer();return g({},t,{ba:{contentType:la,body:r,estimatedSize:r.byteLength}})}));return function(i){return t.apply(this,arguments)}}(),ga=/Failed to fetch|NetworkError|Load failed/i,_a=t=>"TypeError"===(null==t?void 0:t.name)&&ga.test((null==t?void 0:t.message)||""),ma=t=>{var i=fa(t);if(i){var e=i.url,r=i.encodedBody,s=null!=r?r:{},o=s.contentType,l=s.body,h=s.estimatedSize,u=new Headers;ts(t.headers,(function(t,i){u.append(i,t)})),o&&u.append("Content-Type",o);var d=null,v=!1;if(a){var c=new a;d={signal:c.signal,timeout:setTimeout((()=>{var i,e;v=!0,c.abort((i=t.timeout,(e=new Error("PostHog request timed out"+(i?" after "+i+"ms":""))).name="AbortError",e))}),t.timeout)}}var f=i=>{v&&"AbortError"===(null==i?void 0:i.name)||_a(i)?Re.warn(i):Re.error(i),null==t.callback||t.callback({statusCode:0,error:i})};try{var p;n(e,g({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&!t._a&&52428.8>(h||0),body:l,signal:null==(p=d)?void 0:p.signal},t.fetchOptions)).then((i=>i.text().then((e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){Re.error(t)}null==t.callback||t.callback(r)})))).catch(f).finally((()=>d?clearTimeout(d.timeout):null))}catch(t){d&&clearTimeout(d.timeout),f(t)}}},ya=t=>{try{var i,r=ca(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var h=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(e.sendBeacon(s,h))return;var u=X(t.data)?t.data:null==(i=t.data)?void 0:i.batch;if(X(u)&&u.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(u.length/2),v=i=>X(t.data)?i:g({},t.data,{batch:i});return ya(g({},t,{data:v(u.slice(0,d))})),void ya(g({},t,{data:v(u.slice(d))}))}Re.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),ma(g({},t,{_a:!0}))}catch(t){Re.warn("Beacon send failed",t)}},ba=(t,i,e,r)=>{var s="query"===r?"POST"===i?"sent_at":"_":void 0;return da(e===_o?ua(t,"compression"):t,g({},s?{[s]:Date.now().toString()}:{},e===_o?{}:{compression:e}))},wa=[];n&&wa.push({transport:"fetch",method:ma}),o&&wa.push({transport:"XHR",method(t){var i=fa(t);if(i){var e=new o,r=i.encodedBody;e.open(t.method||"GET",i.url,!0);var s=null!=r?r:{},n=s.contentType,a=s.body;ts(t.headers,(function(t,i){e.setRequestHeader(i,t)})),n&&e.setRequestHeader("Content-Type",n),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(a)}}}),null!=e&&e.sendBeacon&&wa.push({transport:"sendBeacon",method:ya});var xa=3e3;class Sa{constructor(t,i){this.wa=!0,this.ka=[],this.Sa=wt((null==i?void 0:i.flush_interval_ms)||xa,250,5e3,Re.createLogger("flush interval"),xa),this.xa=t}enqueue(t){this.ka.push(t),this.Ca||this.Ta()}unload(){this.Ma();var t=this.ka.length>0?this.Ea():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Ia(g({},t,{transport:"sendBeacon"}))}))}enable(){this.wa=!1,this.Ta()}Ta(){var t=this;this.wa||(this.Ca=setTimeout((()=>{if(this.Ma(),this.ka.length>0){var i=this.Ea(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&X(e.data)&&ts(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Ia(e)};for(var r in i)e()}}),this.Sa))}Ia(t){try{this.xa(t)}catch(t){Re.error(t)}}Ma(){clearTimeout(this.Ca),this.Ca=void 0}Ea(){var t={};return ts(this.ka,(i=>{var e,r=i,s=(r?r.batchKey:null)||r.url;et(t[s])&&(t[s]=g({},r,{data:[]})),null==(e=t[s].data)||e.push(r.data)})),this.ka=[],t}}var ka=["retriesPerformedSoFar"];class Ea{constructor(i){this.Ra=!1,this.Pa=3e3,this.ka=[],this._instance=i,this.ka=[],this.Aa=!0,!et(t)&&"onLine"in t.navigator&&(this.Aa=t.navigator.onLine,this.Fa=()=>{this.Aa=!0,this.La()},this.Oa=()=>{this.Aa=!1},ls(t,"online",this.Fa),ls(t,"offline",this.Oa))}get length(){return this.ka.length}retriableRequest(t){var i=t.retriesPerformedSoFar,e=_(t,ka);lt(i)&&(e.url=da(e.url,{retry_count:i})),this._instance._send_request(g({},e,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=i?i:0))return void this.xn(g({retriesPerformedSoFar:i},e));0===t.statusCode&&Re.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!=i?i:0)+" retries.")}null==e.callback||e.callback(t)}}))}xn(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=Math.random()-.5;return Math.ceil(r+s*(r-e))}(i),r=Date.now()+e;this.ka.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),Re.warn(s),this.Ra||(this.Ra=!0,this.Da())}Da(){if(this.$a&&clearTimeout(this.$a),0===this.ka.length)return this.Ra=!1,void(this.$a=void 0);this.$a=setTimeout((()=>{this.Aa&&this.ka.length>0&&this.La(),this.Da()}),this.Pa)}La(){var t=Date.now(),i=[],e=this.ka.filter((e=>t>e.retryAt||(i.push(e),!1)));if(this.ka=i,e.length>0)for(var r of e)this.retriableRequest(r.requestOptions)}unload(){for(var i of(this.$a&&(clearTimeout(this.$a),this.$a=void 0),this.Ra=!1,et(t)||(this.Fa&&(t.removeEventListener("online",this.Fa),this.Fa=void 0),this.Oa&&(t.removeEventListener("offline",this.Oa),this.Oa=void 0)),this.ka)){var e=i.requestOptions;try{this._instance._send_request(g({},e,{transport:"sendBeacon"}))}catch(t){Re.error(t)}}this.ka=[]}}class $a{constructor(t){this.Na=()=>{var t,i,e,r;this.qa||(this.qa={});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.qa.lastScrollY=Math.ceil(n),this.qa.maxScrollY=Math.max(n,null!==(t=this.qa.maxScrollY)&&void 0!==t?t:0),this.qa.maxScrollHeight=Math.max(o,null!==(i=this.qa.maxScrollHeight)&&void 0!==i?i:0),this.qa.lastContentY=a,this.qa.maxContentY=Math.max(a,null!==(e=this.qa.maxContentY)&&void 0!==e?e:0),this.qa.maxContentHeight=Math.max(l,null!==(r=this.qa.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get ja(){return this._instance.config.scroll_root_selector}getContext(){return this.qa}resetContext(){var t=this.qa;return setTimeout(this.Na,0),t}startMeasuringScrollPosition(){ls(t,"scroll",this.Na,{capture:!0}),ls(t,"scrollend",this.Na,{capture:!0}),ls(t,"resize",this.Na)}scrollElement(){if(!this.ja)return null==t?void 0:t.document.documentElement;var i=X(this.ja)?this.ja:[this.ja];for(var e of i){var r=null==t?void 0:t.document.querySelector(e);if(r)return r}}Ba(i){var e="y"===i?"scrollTop":"scrollLeft";if(this.ja){var r=this.scrollElement();return r&&r[e]||0}return t?"y"===i?t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop||0:t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft||0:0}scrollY(){return this.Ba("y")}scrollX(){return this.Ba("x")}}var Pa=t=>no(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 Ta{constructor(t,i,e,r){this.ot=t=>{var i=this.Ha();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Ua(this._instance)};this.za.register({[Fr]:e})}},this._instance=t,this.Wa=i,this.za=e,this.Ua=r||Pa,this.Wa.onSessionId(this.ot)}Ha(){return this.za.props[Fr]}getSetOnceProps(){var t,i=null==(t=this.Ha())?void 0:t.props;return i?"r"in i?oo(i,this._instance.config.disable_capture_url_hashes):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return ts(ns(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+G(e)]=i})),t}}class Ca{on(t,i){return this.Va[t]||(this.Va[t]=[]),this.Va[t].push(i),()=>{this.Va[t]=this.Va[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.Va[t]||[])e(i);for(var r of this.Va["*"]||[])r(t,i)}constructor(){this.Va={}}}var Fa=Ie("[SessionId]"),Ra=864e5;class Ia{on(t,i){return this.Ga.on(t,i)}constructor(t,i,e){var r;if(this.Za=null,this.Qa=null,this.Ja=[],this.Ka=void 0,this.Ya=!1,this.Ga=new Ca,this.Xa=(t,i)=>!(!lt(t)||!lt(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===qr)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qi=t.config,this.za=t.persistence,this.st=void 0,this._e=void 0,this._sessionStartTimestamp=null,this.eo=void 0,this._sessionActivityTimestamp=null,this.io=i||gs,this.ro=e||gs;var s=this.qi.persistence_name||this.qi.token;if(this._sessionTimeoutMs=1e3*wt(this.qi.session_idle_timeout_seconds||1800,60,36e3,Fa.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.no(),this.so="ph_"+s+"_window_id",this.ao="ph_"+s+"_primary_window_exists",this.oo()){var n=Ds.Br(this.so),o=Ds.Br(this.ao);n&&!o?this.st=n:Ds.qr(this.so),Ds.Dr(this.ao,!0)}null!=(r=this.qi.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.qi.bootstrap.sessionID),this.lo()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return et(this.Ja)&&(this.Ja=[]),this.Ja.push(t),this._e&&t(this._e,this.st),()=>{this.Ja=this.Ja.filter((i=>i!==t))}}oo(){return"memory"!==this.qi.persistence&&!this.za.Hs&&Ds.Nr()}uo(t){t!==this.st&&(this.st=t,this.oo()&&Ds.Dr(this.so,t))}ho(){return this.st?this.st:this.oo()?Ds.Br(this.so):null}do(t){var i=this.Za;return!nt(i)&&!nt(t)&&5e3>Math.abs(t-i)}vo(t,i,e){var r=i!==this._sessionActivityTimestamp,s=!(t!==this._e||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this._e=t,s&&!r||s&&this.do(i)||(this.Za=i,this.za.register({[nr]:[i,t,e]}))}co(){var t,i=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return lt(i)&&i>0}fo(){this.co()?this.za.refreshKey(nr):(this.za.flush(),this.za.load())}po(){var t;if(!nt(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Za){this.fo();var i=this.mo();i[1]===this._e&&i[2]===this._sessionStartTimestamp&&(this.Za=this._sessionActivityTimestamp,this.za.register({[nr]:[this._sessionActivityTimestamp,null!==(t=this._e)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.za.flush())}}yo(){var t=this.mo()[0],i=lt(t)?t:0,e=lt(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}bo(t){return this.fo(),this.Xa(t,this.yo())}mo(){var t=this.za.props[nr];return X(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Za=null,this.eo=void 0,clearTimeout(this._o),this._o=void 0,this.vo(null,null,null)}setBootstrapSessionId(t,i){void 0===i&&(i=!1);var e=function(t,i){void 0===i&&(i=(new Date).getTime());try{var e=(t=>{var i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(t);return e>i+6e4?void Fa.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void Fa.error("Invalid sessionID in bootstrap",t)}}(t);return!et(e)&&(i?this.eo={sessionId:t,sessionStartTimestamp:e}:this.vo(t,(new Date).getTime(),e),!0)}destroy(){this.Ya=!0,this.po(),clearTimeout(this._o),this._o=void 0,this.Ka&&t&&(t.removeEventListener(Kr,this.Ka,{capture:!1}),this.Ka=void 0),this.Ja=[]}lo(){this.Ka=()=>{this.po(),this.oo()&&Ds.qr(this.ao)},ls(t,Kr,this.Ka,{capture:!1})}checkAndGetSessionAndWindowId(t,i,e){if(void 0===t&&(t=!1),void 0===i&&(i=null),void 0===e&&(e=!1),this.qi.cookieless_mode===qr)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=i||(new Date).getTime(),s=this._e;if(e)this.Qa=r;else if(nt(this.Qa)||this.Qa>r||r-this.Qa>=1e3){var n,o;null==(n=(o=this.za).syncCookieProperties)||n.call(o),this.Qa=r}var a=this.mo(),l=a[1],h=a[2],u=!et(s)&&l!==s,d=this.yo(),v=this.ho(),c=this.eo,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Ra),p=c?f:lt(h)&&Math.abs(r-h)>Ra,g=!1,_=u,m=!l||!!c,y=l,b=!m&&!t&&this.Xa(r,d);if(b){(b=this.bo(r))||Fa.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.mo();l=w[1],h=w[2]}if(m||b||p){_=!1;var x=c&&!f;l=x?c.sessionId:this.io(),v=this.ro(),Fa.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this.eo=void 0,g=!0}else v||(v=this.ro(),g=!0),(_=_||l!==y)&&(Fa.info("adopted cross-tab session id",{sessionId:l,windowId:v}),g=!0);var S=lt(d)&&t&&!p?d:r,k=lt(h)?h:(new Date).getTime();this.uo(v),this.vo(l,S,k),t||this.no();var E={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p,crossTabAdoption:_};return g&&this.Ja.forEach((t=>t(l,v,E))),{sessionId:l,windowId:v,sessionStartTimestamp:k,changeReason:g?E:void 0,lastActivityTimestamp:d}}no(){this.Ya||(clearTimeout(this._o),this._o=setTimeout((()=>{if(!this.Ya)if(this.bo((new Date).getTime())){var t=this._e;this.resetSessionId(),this.Ga.emit("forcedIdleReset",{idleSessionId:t})}else this.no()}),1.1*this.sessionTimeoutMs))}}var Ma=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&H(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>H(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver};function Aa(){return(Aa=p((function*(){var t=null==e?void 0:e.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var i=yield t.getHighEntropyValues(["model"]),r=null==i?void 0:i.model;return rt(r)&&r.length>0?r:void 0}catch(t){return void Re.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function Oa(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var Da=(t,i)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}},ja=t=>t.toLowerCase(),La={exact:(t,i)=>i.some((i=>t.some((t=>i===t)))),is_not:(t,i)=>i.every((i=>t.every((t=>i!==t)))),regex:(t,i)=>i.some((i=>t.some((t=>Da(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!Da(i,t))))),icontains:(t,i)=>i.map(ja).some((i=>t.map(ja).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(ja).every((i=>t.map(ja).every((t=>!i.includes(t))))),gt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e>parseFloat(t)))})),lt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e<parseFloat(t)))}))};function Na(t,i){return!t||Object.entries(t).every((t=>{var e=t[1],r=null==i?void 0:i[t[0]];if(null==r)return!1;var s=La[e.operator];return!!s&&s(e.values,[String(r)])}))}function Ba(t,i,e){return zn({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var za="custom",Ua="i.posthog.com",qa=/^\/static\//,Ha=["/s/","/e/","/i/"];class Va{constructor(t){this.wo={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+Ua,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.wo[this.apiHost]||(this.wo[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":za),this.wo[this.apiHost]}ko(t){if(qa.test(t)){var i=this.instance.config.asset_host;if("string"==typeof i)return i.trim().replace(/\/$/,"")||void 0}}So(t){var i=Un(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}xo(t,i,e){if("ui"===t)return e;var r=e,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Un(e))?void 0:n.href)||e;r=s(new URL(o)).toString()}if(s&&"api"===t&&Ha.some((t=>0===i.indexOf(t)))){var a=this.So(r);if(a){var l,h=this.apiHost,u=this.Co;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(u={apiHost:h,rewriteRequestPath:s,urls:new Set},this.Co=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var i=this.Co,e=this.So(t);return(null==i?void 0:i.apiHost)===this.apiHost&&i.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!e&&i.urls.has(e)}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.xo(t,i,this.uiHost+i);if("flags"===t)return this.xo(t,i,this.flagsApiHost+i);if("assets"===t){var e=this.ko(i);if(e)return this.xo(t,i,""+e+i)}if(this.region===za)return this.xo(t,i,this.apiHost+i);var r=Ua+i;switch(t){case"assets":return this.xo(t,i,"https://"+this.region+"-assets."+r);case"api":return this.xo(t,i,"https://"+this.region+"."+r)}}}var Wa=Ie("[Surveys]"),Ga="seenSurvey_",Ka=t=>{try{var i=(t=>((t,i)=>""+t+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(i))(Ga,t))(t);if(localStorage.getItem(i))return;localStorage.setItem(i,"true")}catch(t){Wa.error("Failed to persist survey seen state",t)}},Ja=["popover","widget","api"],Ya={ignoreConditions:!1,ignoreDelay:!1,displayType:ko},Qa=Ie("[PostHog ExternalIntegrations]"),Xa={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Za{constructor(t){this._instance=t}_s(t,i){var e;null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return Qa.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(){var i,r,s,n=e[0],o=e[1];!o||null!=(i=v.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[n]||t._s(Xa[n],(()=>{var i;null==(i=v.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[n])||i.start(t._instance)})),!o&&null!=(r=v.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=v.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var e of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;i()}}}class tl{constructor(t,i){this.I=t,this.ns=i,this.To=new Map,this.Xn=!1}add(t){var i=this;return p((function*(){if(i.Xn)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i.To.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');i.To.set(t.name,t);try{var e=t.setup(i.ns);e&&(yield e)}catch(e){var r=i.To.get(t.name)===t;r&&i.To.delete(t.name),i.I.error('Failed to set up browser extension "'+t.name+'"',e),r&&i.Mo(t)}}))()}dispose(){if(!this.Xn){this.Xn=!0;var t=Array.from(this.To.values()).reverse();for(var i of(this.To.clear(),t))this.Mo(i)}}Mo(t){try{var i=null==t.dispose?void 0:t.dispose();i&&Z(i.then)&&i.then(void 0,(i=>{this.I.error('Failed to dispose browser extension "'+t.name+'"',i)}))}catch(i){this.I.error('Failed to dispose browser extension "'+t.name+'"',i)}}}class il{constructor(t){this._instance=t}initialize(){}get(t){var i=this._instance.persistence;if("string"==typeof t)return null==i?void 0:i.get_property(t);var e={};for(var r of t){var s=null==i?void 0:i.get_property(r);et(s)||(e[r]=s)}return e}set(t,i){var e;null==(e=this._instance.persistence)||e.register("string"==typeof t?{[t]:i}:t)}remove(t){var i;null==(i=this._instance.persistence)||i.unregister(t)}}var el="extensionsRemoteConfig";class rl{constructor(t){this.Xn=!1,this.instance=t,this.I=Re,this.Eo=t.Io,this.kv=new il(t),this.onEvent=t=>go(this.instance.on("eventCaptured",(i=>{try{t({event:i.event,properties:i.properties})}catch(t){this.I.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.Xn)return go((()=>{}));var i=i=>{try{t(i)}catch(t){this.I.error("Browser extension remote config listener failed",t)}},e=this.instance.Ro.on(el,i);return this.Eo&&i(this.Eo),go(e)},this.Po=new tl(Re.createLogger("[BrowserExtensions]"),this)}get logger(){return this.I}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(Be))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(Be);return"string"==typeof t?t:void 0}get library(){return{name:c.LIB_NAME,version:c.LIB_VERSION}}get initialPersonProperties(){var t,i;return null!==(t=null==(i=this.instance.persistence)?void 0:i.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,i,e,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(i=null==s?void 0:s.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==s?void 0:s.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(t){return this.Po.add(t)}capture(t,i,e){var r=this;return p((function*(){e?r.instance.capture(t,i,{timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce}):r.instance.capture(t,i)}))()}registerDynamicEventProperties(t){return go(this.instance.Ao(t))}handleRemoteConfig(t){this.Xn||(this.Eo=t,this.instance.Ro.emit(el,t))}sendRequest(t,i){var e=this;return p((function*(){var r;void 0===i&&(i={});var s=e.instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",t),n={method:i.method,url:i.query?da(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(e.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,e.instance._send_request(n)}))}))()}dispose(){this.Xn||(this.Xn=!0,this.Po.dispose())}}var sl={},nl=0,ol=()=>{},al='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',ll="Surveys module not available",hl="sanitize_properties is deprecated. Use before_send instead",ul="Invalid value for property_denylist config: ",dl=["token","distinct_id",jr],vl="posthog",cl=!aa&&-1===(null==h?void 0:h.indexOf("MSIE"))&&-1===(null==h?void 0:h.indexOf("Mozilla")),fl=i=>{var e;return g({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:as(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ol,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=i?i:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&rt(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,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(e=t.location)?void 0:e.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){Re.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:Wr,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:xa},error_tracking:{},_onCapture:ol},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:an,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),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(i))},pl=[["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"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],gl=t=>{var i={};for(var e of pl){var r=e[0],s=e[1];et(t[r])||(i[s]=t[r])}var n=is({},i,t),o=t.__preview_external_dependency_versioned_paths;return et(o)||(et(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),rt(o)&&et(t.asset_host)&&(n.asset_host=o)),X(t.property_blacklist)&&(et(t.property_denylist)?n.property_denylist=t.property_blacklist:X(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:Re.error(ul+t.property_denylist)),n};class _l{constructor(){this.__forceAllowLocalhost=!1}get Fo(){return this.__forceAllowLocalhost}set Fo(t){Re.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class ml{Lo(t,i){if(t){var e=this.To.indexOf(t);-1!==e&&this.To.splice(e,1)}return this.To.push(i),null==i.initialize||i.initialize(),i}Oo(){return this.config.cookieless_mode===qr||this.config.cookieless_mode===Ur&&this.consent.isRejected()}Do(){if(!this.Oo()&&this.get_distinct_id()===Dr){var t=this.persistence;if(t){this.$o()||t.load(!0);var i=this.get_distinct_id();if(!i||i===Dr){var e=this.config.get_device_id(gs());this.register({distinct_id:e,$device_id:e}),t.set_property(Cr,Hr)}this.No()}}}get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new _l,this.qo=!1,this.version=c.LIB_VERSION,this.jo=new Set,this.Bo="",this.Ro=new Ca,this.To=[],this.Ho=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=fl(),this.SentryIntegration=On,this.sentryIntegration=t=>function(t,i){var e=An(t,i);return{name:Mn,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Uo=!1,this.zo=null,this.Wo=null,this.Vo=null,this.scrollManager=new $a(this),this.pageViewManager=new Dn(this),this.rateLimiter=new $o(this),this.requestRouter=new Va(this),this.consent=new js(this),this.externalIntegrations=new Za(this);var i=null!==(t=ml.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,i,e)=>{var r=rt(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=rt(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>Re.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==vl){var r,s=null!==(r=sl[e])&&void 0!==r?r:new ml;return s._init(t,i,e),sl[e]=s,sl[vl][e]=s,s}return this._init(t,i,e)}_init(i,e,r){var s,n;void 0===e&&(e={});var o,a=rt(i)?i.trim():"";if(!a)return Re.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 a!==(null==(o=this.config)?void 0:o.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+a+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=fl(e.defaults),e.debug=this.Go(e.debug),this.Zo=e,this.Qo=[],e.person_profiles?this.Wo=e.person_profiles:e.process_person&&(this.Wo=e.process_person);var l=fl(e.defaults),h=gl(e),u=is({},l,h,{name:r,token:a});tt(l.rageclick)&&tt(h.rageclick)&&(u.rageclick=is({},l.rageclick,h.rageclick)),tt(l.session_recording)&&tt(h.session_recording)&&(u.session_recording=is({},l.session_recording,h.session_recording)),this.set_config(u),this.config.on_xhr_error&&Re.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:_o;var d=this.$o();if(this.persistence=new po(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new po(g({},this.config,{persistence:"sessionStorage"}),d,!1),this.Bo="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&Ds.Nr()){var v=Ds.Br(this.Bo);X(v)&&v.forEach((t=>{rt(t)&&this.jo.add(t)}))}else Ds.qr(this.Bo);var f=g({},this.persistence.props),p=g({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Jo=new Sa((t=>this.Ko(t)),this.config.request_queue_config),this.Yo=new Ea(this),this.__request_queue=[];var _=this.Oo();if(_||(this.sessionManager=new Ia(this),this.sessionPropsManager=new Ta(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,i,e)=>{(null!=e&&e.activityTimeout||null!=e&&e.sessionPastMaximumLength||null!=e&&e.crossTabAdoption)&&this.Xo()}))),this.tl(),this.config.__preview_deferred_init_extensions?(Re.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.el(_)}),0)):(Re.info("Initializing extensions synchronously"),this.el(_)),c.DEBUG=c.DEBUG||this.config.debug,c.DEBUG&&Re.info("Starting in debug mode",{this:this,config:e,thisC:g({},this.config),p:f,s:p}),!this.config.identity_distinct_id||null!=(s=e.bootstrap)&&s.distinctID||(e.bootstrap=g({},e.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=e.bootstrap)?void 0:n.distinctID)){var m=e.bootstrap.distinctID,y=this.get_distinct_id(),b=this.persistence.get_property(Cr);if(e.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===Hr)this.identify(m);else if(e.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===Vr)Re.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 w=this.config.get_device_id(gs()),x=e.bootstrap.isIdentifiedID?w:m;this.persistence.set_property(Cr,e.bootstrap.isIdentifiedID?Vr:Hr),this.register({distinct_id:m,$device_id:x})}}if(_)this.register_once({distinct_id:Dr,$device_id:null},"");else if(!this.get_distinct_id()){var S=this.config.get_device_id(gs());this.register_once({distinct_id:S,$device_id:S},""),this.persistence.set_property(Cr,Hr)}return ls(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),e.segment?function(t,i){var e=t.config.segment;if(!e)return i();!function(t,i){var e=t.config.segment;if(!e)return i();var r=e=>{var r=()=>e.anonymousId()||gs();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(Cr,Vr)),i()},s=e.user();"then"in s&&Z(s.then)?s.then(r):r(s)}(t,(()=>{e.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||In.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,e)=>{if(!e)return i;i.event.userId||i.event.anonymousId===t.get_distinct_id()||(In.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(In.info("UserId set, identifying with PostHog"),t.identify(i.event.userId));var r=t.calculateEventProperties(e,i.event.properties);return i.event.properties=Object.assign({},r,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>i(t,t.event.event),page:t=>i(t,Jr),identify:t=>i(t,Qr),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}(this,(()=>this.il())):this.il(),Z(this.config._onCapture)&&this.config._onCapture!==ol&&(Re.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Re.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.config.disableDeviceModel||function(){return Aa.apply(this,arguments)}().then((t=>{t&&this.register({[ze]:t})})).catch(ol),this}rl(t){var i=t;return rt(i.name)&&Z(i.setup)}nl(t,i){this.rl(t)?i.push((()=>{this.sl().add(t).catch(ol)})):this.To.push(t)}tl(){var t,i,e,r,s,n,o=null!==(t=null==(i=this.config.__extensionClasses)?void 0:i.featureFlags)&&void 0!==t?t:null==(e=ml.__defaultExtensionClasses)?void 0:e.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.al)||r.call(this),this.al=void 0,this.featureFlags=new o(this)),Z(this.featureFlags.onReloading)&&Z(this.featureFlags.setup)?this.al||(this.al=this.featureFlags.onReloading((()=>{this.Ro.emit("featureFlagsReloading",!0)})),this.sl().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}el(t){var i,e,r,s,n,o,a,l=performance.now(),h=g({},ml.__defaultExtensionClasses,this.config.__extensionClasses),u=[];h.exceptions&&this.To.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new h.exceptions(this)),h.historyAutocapture&&this.To.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.To.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.To.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.To.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||u.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.nl(this.autocapture=new h.autocapture(this),u),h.surveys&&this.nl(this.surveys=null!==(e=this.surveys)&&void 0!==e?e:new h.surveys(this),u),h.logs&&this.To.push(this.logs=null!==(r=this.logs)&&void 0!==r?r:new h.logs(this)),h.metrics&&this.To.push(this.metrics=null!==(s=this.metrics)&&void 0!==s?s:new h.metrics(this)),h.conversations&&this.To.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new h.conversations(this)),h.productTours&&this.To.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.To.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.To.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.To.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.To.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,Fn)),h.toolbar&&this.To.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new h.toolbar(this)),h.experiments&&this.To.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new h.experiments(this)),this.To.forEach((t=>{t.initialize&&u.push((()=>{null==t.initialize||t.initialize()}))})),u.push((()=>{if(this.ol){var t=this.ol;this.ol=void 0,this.To.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}})),this.ll(u,l)}ll(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.ll(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){Re.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({[Lr]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Nr]:r}),this.config.__preview_deferred_init_extensions&&Re.info("PostHog extensions initialized ("+r+"ms)")}pa(t){var i;if(!r||!r.body)return Re.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.pa(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.ol=t),this.Io=t,this.compression=void 0,t.ok){var e,s=t.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=V(s.supportedCompression,_o)?_o:V(s.supportedCompression,mo)?mo:void 0),null!=(e=s.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.Wo?this.Wo:Wr}),null==(i=this.ul)||i.handleRemoteConfig(t),this.To.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}il(){try{this.config.loaded(this)}catch(t){Re.critical("`loaded` function failed",t)}if(this.hl(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.hostname,i=this.config.internal_or_test_user_hostname;("string"==typeof i?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Oo())&&this.dl()}),1),this.vl=new To(this),this.vl.load()}hl(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Jo)||t.enable())}_dom_loaded(){this.is_capturing()&&Zr(this.__request_queue,(t=>this.Ko(t))),this.__request_queue=[],this.hl()}_handle_unload(){var t,i,e,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(i=this.metrics)||i.flush("sendBeacon"),this.config.request_batching?(this.cl()&&this.capture(Yr),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(r=this.Jo)||r.unload(),null==(s=this.Yo)||s.unload()):this.cl()&&this.capture(Yr,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?cl?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=g({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,(et(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 i,e,r,s=g({},t);s.timeout=s.timeout||6e4;var n,o,a,h,u,d=null!==(i=s.transport)&&void 0!==i?i:"fetch";"sendBeacon"===d&&et(s.compression)&&s.data&&(s.compression=mo),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(o=null==(u=(h=(X(n=s.data)?n:[n]).map((t=>g({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(a=u.properties)?void 0:a.token)&&void 0!==o?o:null==u?void 0:u.token,batch:h,sent_at:(new Date).toISOString()}:"body"===s.timestampMode&&(s.data=function(t,i){return void 0===i&&(i=(new Date).toISOString()),X(t)?t.map((t=>g({},t,{sent_at:i}))):g({},t,{sent_at:i})}(s.data))),s.url=ba(s.url,s.method,s.compression,s.timestampMode);var v=wa.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),c=null!==(e=null==(r=function(t,i){for(var e=0;t.length>e;e++)if(t[e].transport===d)return t[e]}(v))?void 0:r.method)&&void 0!==e?e:v[0].method;if(!c)throw new Error("No available transport method");var f=t=>{try{c(t)}catch(t){_a(t)?Re.warn(t):Re.error(t),null==s.callback||s.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&s.data&&s.compression===_o&&l&&"undefined"!=typeof Promise&&!ha?pa(s).then((t=>{f(t)})).catch((i=>{if(R(i))return ha=!0,void f(g({},s,{compression:void 0,url:ba(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var i="name"in t?String(t.name):"";return R(t)||i===T})(i)&&(ha=!0),f(s)})):c(s)})(g({},t,{callback:i=>{var e,r;this.rateLimiter.checkForLimiting(i),400>i.statusCode||null==(e=(r=this.config).on_request_error)||e.call(r,i),null==t.callback||t.callback(i)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Ko(t){this.Yo?this.Yo.retriableRequest(t):this._send_request(t)}_execute_array(t){nl++;try{var i,e=[],r=[],s=[];Zr(t,(t=>{if(t)if(X(i=t[0]))s.push(t);else if(Z(t))try{t.call(this)}catch(i){Re.error("Error executing queued PostHog call",t,i)}else X(t)&&"alias"===i?e.push(t):X(t)&&-1!==i.indexOf("capture")&&Z(this[i])?s.push(t):r.push(t)}));var n=function(t,i){Zr(t,(function(t){try{if(X(t[0])){var e=i;ts(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else i[t[0]].apply(i,t.slice(1))}catch(i){Re.error("Error executing queued PostHog call",t,i)}}))};n(e,this),n(r,this),n(s,this)}finally{nl--}}push(t){if(nl>0&&X(t)&&rt(t[0])){var i=ml.prototype[t[0]];Z(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,i,e){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Jo){if(this.is_capturing())if(!et(t)&&rt(t)){this.Do();var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var h=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==h||!h.isRateLimited){null!=i&&i.$current_url&&!rt(null==i?void 0:i.$current_url)&&(Re.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||null!=e&&e.fl||Re.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 u=new Date,d=(null==e?void 0:e.timestamp)||u,v=Ti(null==e?void 0:e.uuid,gs),c={uuid:v,event:t,properties:this.calculateEventProperties(t,i||{},d,v)};t===Jr&&this.config.__preview_capture_bot_pageviews&&l&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),h&&(c.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);var f="$feature_flag_called"===t&&!1===c.properties.$feature_flag_has_experiment&&!0===this.get_property(cr);(null==e?void 0:e.$set)&&!f&&(c.$set=null==e?void 0:e.$set);var p=null==e?void 0:e.$unset;p&&(c.$unset=p);var _,m,y,b=f?void 0:this.pl(null==e?void 0:e.$set_once,t!==Xr,t===Qr);if(b&&(c.$set_once=b),null!=e&&e._noTruncate||(s=this.config.properties_string_max_length,n=c,o=t=>rt(t)?t.slice(0,s):t,a=new Set,c=function t(i,e){if(i!==Object(i))return o?o(i):i;if(!a.has(i)){var r;if(a.add(i),X(i))r=[],Zr(i,(i=>{r.push(t(i))}));else{var s={};ts(i,((i,e)=>{a.has(i)||(s[e]=t(i,e))})),r=s}return r}}(n)),c.timestamp=d,et(null==e?void 0:e.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=u),f&&(c.properties=function(t,i){void 0===i&&(i=[]);var e={},r=i=>{void 0!==t[i]&&(e[i]=t[i])};return x.forEach(r),i.forEach(r),e}(c.properties,dl)),t===xo||t===So){var w=null==i?void 0:i.$survey_id,S=null==i?void 0:i.$survey_iteration;Ka({id:w,current_iteration:S}),c.$set=g({},c.$set,{[(_={id:w,current_iteration:S},m=t===So?"responded":"dismissed",y="$survey_"+m+"/"+_.id,_.current_iteration&&_.current_iteration>0&&(y="$survey_"+m+"/"+_.id+"/"+_.current_iteration),y)]:!0})}else t===wo&&(c.$set=g({},c.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===t){var k=null==i?void 0:i.$product_tour_type;k&&(c.$set=g({},c.$set,{["$product_tour_last_seen_date/"+k]:(new Date).toISOString()}))}var E=g({},c.properties.$set,c.$set);if(it(E)||this.setPersonPropertiesForFlags(E),!ot(this.config.before_send)){var P=this.kn(c);if(!P)return;(c=P).uuid=Ti(c.uuid,gs)}this.Ro.emit("eventCaptured",c);var T=null!==(r=null==e?void 0:e._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),C={method:"POST",url:T,data:c,compression:"best-available",timestampMode:"recordings"===(null==e?void 0:e._batchKey)||/\/s\/(?:\?|$)/.test(T)?"body":"capture-body",batchKey:null==e?void 0:e._batchKey,transport:null==e?void 0:e.transport};return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly?this.Ko(C):this.Jo.enqueue(C),c}Re.critical("This capture call is ignored due to client rate limiting.")}}else Re.error("No event name provided to posthog.capture")}else Re.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(i=>t(i.event,i)))}sl(){var t;return null!==(t=this.ul)&&void 0!==t?t:this.ul=new rl(this)}Ao(t){this.Ho.push(t);var i=!0;return()=>{if(i){i=!1;var e=this.Ho.indexOf(t);-1!==e&&this.Ho.splice(e,1)}}}gl(t){var i,e,r;return void 0===t&&(t=!0),!(null==(i=this.persistence)||!i.consumeCookieIdentityChange())&&(this.Vo=null,this.persistence.get_property(Cr)===Hr&&(null==(r=this.sessionPersistence)||r.clear(),this.jo.clear(),this.ml()),null==(e=this.featureFlags)||e.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(i,e,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return e;this.persistence.syncCookieProperties(),this.gl();var l=a?void 0:this.persistence.remove_event_timer(i),u=g({},e);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this.Oo()&&(u[jr]=!0),"$snapshot"===i){var d=g({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=d.distinct_id,(!rt(u.distinct_id)&&!at(u.distinct_id)||st(u.distinct_id))&&Re.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var v,f=function(i,e,r,n){var o,a,l,u;if(void 0===n&&(n=!1),!h)return{};var d,v=i?[...Jn,...e||[]]:[],f=function(t){for(var i=0;Ei.length>i;i++){var e=Ei[i],r=e[1],s=e[0].exec(t),n=s&&(Z(r)?r(s,t):r);if(n)return n}return["",""]}(h),p=f[0],g=f[1],_=null!=(d="undefined"!=typeof navigator?navigator:void 0)&&d.brave?{brave:!0}:{},m={};et(r)||(m.detectGoogleSearchApp=r);var y={},b=null==(o=navigator)||null==(o=o.userAgentData)?void 0:o.platform,w=null==(a=navigator)?void 0:a.maxTouchPoints,x=null==t||null==(l=t.screen)?void 0:l.width,S=null==t||null==(u=t.screen)?void 0:u.height,k=null==t?void 0:t.devicePixelRatio;et(b)||(y.userAgentDataPlatform=b),et(w)||(y.maxTouchPoints=w),et(x)||(y.screenWidth=x),et(S)||(y.screenHeight=S),et(k)||(y.devicePixelRatio=k);var E,P,T,C,F,R,I,M,A=is(ns({$os:p,$os_version:g,$browser:xi(h,navigator.vendor,_,m),$device:$i(h),$device_type:(P=h,T=y,M=$i(P),M===Tt||M===Pt||"Kobo"===M||"Kindle Fire"===M||M===si?$t:M===Gt||M===Jt||M===Kt||M===ii?"Console":M===Ft?"Wearable":M?St:"Android"===(null==T?void 0:T.userAgentDataPlatform)&&(null!==(C=null==T?void 0:T.maxTouchPoints)&&void 0!==C?C:0)>0?600>Math.min(null!==(F=null==T?void 0:T.screenWidth)&&void 0!==F?F:0,null!==(R=null==T?void 0:T.screenHeight)&&void 0!==R?R:0)/(null!==(I=null==T?void 0:T.devicePixelRatio)&&void 0!==I?I:1)?St:$t:"Desktop"),$timezone:ao(),$timezone_offset:lo()}),{$current_url:Hn(n?Ci(null==s?void 0:s.href):null==s?void 0:s.href,v,Qn),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:h.length>1e3?h.substring(0,997)+"...":h,$browser_version:ki(h,navigator.vendor,_,m),$browser_language:eo(),$browser_language_prefix:(E=eo(),"string"==typeof E?E.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:c.LIB_NAME,$lib_version:c.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return c.SDK_DIST_CHANNEL&&(A.$sdk_dist_channel=c.SDK_DIST_CHANNEL),A}(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 p=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime(),!0),_=p.windowId;u.$session_id=p.sessionId,u.$window_id=_}this.sessionPropsManager&&is(u,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&is(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null==(m=this.Yo)?void 0:m.length}catch(t){u.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===za&&(u.$lib_custom_api_host=this.config.api_host),v=i!==Jr||a?i!==Yr||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),u=is(u,v),i===Jr&&r&&(u.title=r.title),!et(l)){var y=n.getTime()-l;u.$duration=parseFloat((y/1e3).toFixed(3))}h&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");var b=this.persistence.properties(),w=this.sessionPersistence.properties();ts(["$referrer","$referring_domain"],(t=>{t in b&&delete w[t]}));var x={};if(this.Ho.length>0)for(var S of this.Ho.slice())try{is(x,S())}catch(t){Re.error("Failed to produce browser extension event properties",t)}(u=is({},f,b,w,g({},x,u))).$is_identified=this._isIdentified(),X(this.config.property_denylist)?ts(this.config.property_denylist,(function(t){delete u[t]})):Re.error(ul+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&(Re.error(hl),u=k(u,i));var E=this.yl();return u.$process_person_profile=E,E&&!a&&this.bl("_calculate_event_properties"),u}pl(t,i,e){var r;if(void 0===i&&(i=!0),void 0===e&&(e=!1),!this.persistence||!this.yl())return t;if(this.qo&&!e)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=is({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Re.error(hl),o=a(o,"$set_once")),i&&(this.qo=!0),it(o)?void 0:o}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i,e;null==(i=this.persistence)||i.syncCookieProperties(),this.gl(),null==(e=this.sessionPersistence)||e.register(t),Object.keys(t).forEach((t=>this.jo.add(t))),this.ml()}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t),this.jo.delete(t),this.ml()}_l(t,i){this.register({[t]:i})}Xo(){this.jo.forEach((t=>{var i;null==(i=this.sessionPersistence)||i.unregister(t)})),this.jo.clear(),this.ml()}ml(){var t;if(this.Bo)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.Hs||!Ds.Nr())Ds.qr(this.Bo);else{var i=[];this.jo.forEach((t=>i.push(t))),i.length>0?Ds.Dr(this.Bo,i):Ds.qr(this.Bo)}}getFeatureFlag(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,i){var e,r;return null!==(e=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,i))&&void 0!==e?e:null==i?void 0:i.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,i,e){var r;null==(r=this.featureFlags)||r.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){var r;return void 0===i&&(i=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.Ro.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:ll}),()=>{})}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:ll})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:ll})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=Ya),null==(e=this.surveys)||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null==(i=this.surveys)||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null==(e=this.surveys)?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:ll}}canRenderSurveyAsync(t,i){var e,r;return void 0===i&&(i=!1),null!==(e=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:ll})}wl(t){return!t||st(t)?(Re.critical("Unique user id has not been set in posthog.identify"),!1):t===Dr?(Re.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())||(Re.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,i,e){if(!this.__loaded||!this.persistence)return Re.uninitializedWarning("posthog.identify");if(at(t)&&(t=t.toString(),Re.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.wl(t)&&this.bl("posthog.identify")){this.Do();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.gl(!1),o=this.persistence.Ws(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Be)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property(Ue)&&(this.unregister(Ue),this.register({distinct_id:t}));var h,u=(this.persistence.get_property(Cr)||Hr)===Hr,d=t!==l,v=!d&&u;if(d&&u)this.persistence.set_property(Cr,Vr),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture(Qr,{distinct_id:t,$anon_distinct_id:l},{$set:i||{},$set_once:e||{}}),this.Vo=Ba(t,i,e),null==(h=this.featureFlags)||h.setAnonymousDistinctId(l);else if(v){this.persistence.set_property(Cr,Vr);var c=i||{},f=e||{};this.setPersonPropertiesForFlags({$set:c,$set_once:f},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture("$set",{$set:c,$set_once:f}),this.Vo=Ba(t,i,e)}else(i||e)&&this.setPersonProperties(i,e);d||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Er)):v&&(i||e)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Qs(a)}}}setPersonProperties(t,i){if((t||i)&&this.bl("posthog.setPersonProperties")){var e=Ba(this.get_distinct_id(),t,i);this.Vo!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Vo=e):Re.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var i,e=(X(t)?t:[t]).filter((t=>rt(t)&&t.length>0));0!==e.length&&this.bl("posthog.unsetPersonProperties")&&(null==(i=this.featureFlags)||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.Vo=null)}group(t,i,e){var r;if(t&&i){null==(r=this.persistence)||r.syncCookieProperties(),this.gl();var s=this.getGroups(),n=s[t]!==i;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:g({},s,{[t]:i})}),n||e){var o={$group_type:t,$group_key:i};e&&(o.$group_set=e),this.capture(Xr,o)}e&&this.setGroupPropertiesForFlags({[t]:e}),n&&!e&&this.reloadFeatureFlags()}else Re.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),null==(e=this.featureFlags)||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),this.bl("posthog.setGroupPropertiesForFlags")&&(null==(e=this.featureFlags)||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null==(i=this.featureFlags)||i.resetGroupPropertiesForFlags(t)}reset(t){var i=ht(t)?t:null==t?void 0:t.resetDeviceID,e=ht(t)||null==t?void 0:t.bootstrap;this.kl(i,!1,e)}kl(t,i,e){var r,s,n;if(void 0===i&&(i=!1),Re.info("reset"),!this.__loaded)return Re.uninitializedWarning("posthog.reset");var o=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null==(r=this.Zo)?void 0:r.bootstrap)||{},null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this.ma());var a=this.get_property(Be),l=this.get_property(ze),h=this.get_property(Ze),u=this.is_capturing();this.consent.reset(),i||!u||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var d=null==(n=this.persistence)||null==n.Ws?void 0:n.Ws(),v=!1;try{var c,f,p,_,m,y,b,w,x,S,k,E,P,T;if(null==(c=this.persistence)||c.clear(),null==(f=this.sessionPersistence)||f.clear(),this.jo.clear(),this.ml(),et(h)||null==(k=this.persistence)||k.register({[Ze]:h}),null==(p=this.surveys)||p.reset(),null==(_=this.vl)||_.stop(),null==(m=this.featureFlags)||m.reset(),null==(y=this.conversations)||y.reset(),null==(b=this.logs)||b.reset(),null==(w=this.metrics)||w.reset(),null==(x=this.persistence)||x.set_property(Cr,Hr),null==(S=this.sessionManager)||S.resetSessionId(),this.Vo=null,this.config.cookieless_mode===qr)this.register_once({distinct_id:Dr,$device_id:null},"");else{var C=this.config.get_device_id(gs());this.register_once({distinct_id:C,$device_id:t?C:a},""),t||et(l)||this.register({[ze]:l})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(void 0===e.distinctID||this.Oo()||(null==(T=this.persistence)||T.set_property(Cr,e.isIdentifiedID?Vr:Hr),this.register({distinct_id:e.distinctID})),null==(E=this.featureFlags)||E.initialize(),!(et(o)||null!=(P=this.sessionManager)&&P.setBootstrapSessionId(o,!0))){var F=g({},e);delete F.sessionID,this.config.bootstrap=F}delete this.config.identity_distinct_id,delete this.config.identity_hash,v=!0}finally{var R;d&&(null==(R=this.persistence)||null==R.Qs||R.Qs(v))}this.reloadFeatureFlags()}shutdown(t){var i=this;return p((function*(){var t,e,r,s,n,o;if(i.__loaded){null==(t=i.vl)||t.stop(),i.sl().dispose(),null==(e=i.sessionRecording)||e.dispose(),null==(r=i.logs)||r.flushLogs("sendBeacon"),null==(s=i.metrics)||s.flush("sendBeacon"),null==(n=i.Jo)||n.unload(),null==(o=i.Yo)||o.unload();try{var a;null==(a=i.featureFlags)||a.destroy()}catch(t){Re.error("Error while destroying feature flags",t)}}else Re.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,i){var e;this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),null==(e=this.conversations)||e.Sl()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.xl()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var i=this.sessionManager.checkAndGetSessionAndWindowId(!0),e=i.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i.sessionId);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property(Le)?(Re.critical("Attempting to create alias for existing People user - aborting."),-2):this.bl("posthog.alias")?(et(i)&&(i=this.get_distinct_id()),t!==i?(this._l(Ue,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Re.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=g({},this.config);if(tt(t)){var e,r,s,n,o,a,l,h,u,d,v,f;is(this.config,gl(t));var p=this.$o();null==(e=this.persistence)||e.update_config(this.config,i,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new po(g({},this.config,{persistence:"sessionStorage"}),p,!1);var _,m=this.Go(this.config.debug);ht(m)&&(this.config.debug=m),ht(this.config.debug)&&(this.config.debug?(c.DEBUG=!0,xs.Nr()&&xs.Dr("ph_debug",!0),Re.info("set_config",{config:t,oldConfig:i,newConfig:g({},this.config)})):(c.DEBUG=!1,xs.Nr()&&xs.qr("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this.ma()),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(n=this.exceptions)||n.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(l=this.autocapture)||l.startIfEnabled(),null==(h=this.heatmaps)||h.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(_=this.historyAutocapture)||_.startIfEnabledOrStop()),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(v=this.surveys)||v.loadIfEnabled(),this.No(),null==(f=this.externalIntegrations)||f.startIfEnabledOrStop()}}_overrideSDKInfo(t,i){c.LIB_NAME=t,c.LIB_VERSION=i}startSessionRecording(t){var i,e,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(i=this.sessionManager)||i.checkAndGetSessionAndWindowId(),a.sampling&&(null==(e=this.sessionRecording)||e.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){if(this.exceptions){var e=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:e});return this.exceptions.sendExceptionEvent(g({},r,i))}}addExceptionStep(t,i){var e;null==(e=this.exceptions)||e.addExceptionStep(t,i)}captureLog(t){var i;null==(i=this.logs)||i.captureLog(t)}get logger(){var t,i;return null!==(t=null==(i=this.logs)?void 0:i.logger)&&void 0!==t?t:ml.Cl}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null==(e=this.toolbar)?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:vl;return i!==vl&&(i=vl+"."+i),i}_isIdentified(){var t,i;return(null==(t=this.persistence)?void 0:t.get_property(Cr))===Vr||(null==(i=this.sessionPersistence)?void 0:i.get_property(Cr))===Vr}yl(){var t,i;return!("never"===this.config.person_profiles||this.config.person_profiles===Wr&&!this._isIdentified()&&it(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Ue])&&(null==(i=this.persistence)||null==(i=i.props)||!i[Or]))}cl(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.yl()||this.bl("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bl("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bl(t){return"never"===this.config.person_profiles?(Re.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._l(Or,!0),!0)}$o(){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)}No(){var t,i,e,r,s=this.$o();return(null==(t=this.persistence)?void 0:t.Hs)!==s&&(null==(e=this.persistence)||e.set_disabled(s)),(null==(i=this.sessionPersistence)?void 0:i.Hs)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s&&(this.jo.clear(),this.ml()),s}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==qr){if(this.Oo()){var e,r,s,n,o;this.kl(!0,!0),null==(e=this.sessionManager)||e.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Ia(this),this.pageViewManager=new Dn(this),this.persistence&&(this.sessionPropsManager=new Ta(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=ml.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.Lo(this.sessionRecording,new l(this)),this.Io&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Io)))}var h,u;this.consent.optInOut(!0),this.No(),this.hl(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),this.config.cookieless_mode==Ur&&(null==(h=this.surveys)||h.loadIfEnabled()),(et(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(u=null==t?void 0:t.captureEventName)&&void 0!==u?u:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.dl()}else Re.warn(al)}opt_out_capturing(){var t,i,e;this.config.cookieless_mode!==qr?(this.config.cookieless_mode===Ur&&this.consent.isOptedIn()&&this.kl(!0,!0),this.consent.optInOut(!1),this.No(),this.config.cookieless_mode===Ur&&(this.register({distinct_id:Dr,$device_id:null}),null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,null==(i=this.sessionManager)||i.destroy(),null==(e=this.pageViewManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.dl(),this.hl())):Re.warn(al)}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===qr||(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.No()}_is_bot(){return e?Ma(e,this.config.custom_blocked_useragents):void 0}dl(){r&&("visible"===r.visibilityState?this.Uo||(this.Uo=!0,this.capture(Jr,{title:r.title},{send_instantly:!0}),this.zo&&(r.removeEventListener(Gr,this.zo),this.zo=null)):this.zo||(this.zo=this.dl.bind(this),ls(r,Gr,this.zo)))}debug(i){!1===i?(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}))}ma(){var t=this.Zo||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Re.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):function(t,i,e,r,s){var n=i in t&&!ot(t[i]),o=e in t&&!ot(t[e]);return n?t[i]:!!o&&(s&&s.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e])}(t,"advanced_disable_flags","advanced_disable_decide",0,Re)}kn(t){var i;if(ot(this.config.before_send))return t;var e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(vt),r=X(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),ot(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return dt(t.event)?Re.warn(o+". This can cause unexpected behavior."):Re.info(o),null}s.properties&&!it(s.properties)||Re.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(i){return Re.error("Error in beforeSend function for event '"+t.event+"':",i),null}for(var a of e)if(s.properties&&ot(s.properties[a]))return Re.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.Ss)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}Go(t){var i=ht(t)&&!t,e=xs.Nr()&&"true"===xs.Pr("ph_debug");return!i&&(!!e||t)}}ml.__defaultExtensionClasses={},ml.Cl=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,i){for(var e=0;i.length>e;e++)t.prototype[i[e]]=ss(t.prototype[i[e]])}(ml,["identify"]);class yl{constructor(t){this.disabled=!1===t;var i=tt(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<this.thresholdPx&&this.timeoutMs>e-r.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}}var bl="$copy_autocapture",wl=Ie("[AutoCapture]");function xl(t,i){return i.length>t?i.slice(0,t)+"...":i}function Sl(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!Hs(i));return i}function kl(i,e){var r,s,n=e.e,o=e.maskAllElementAttributes,a=e.maskAllText,l=e.elementAttributeIgnoreList,h=e.elementsChainAsString,u=e.disableCaptureUrlHashes;if(!Hs(i))return{props:{}};for(var d=[i],v=new Set([i]),c=i;c.parentNode&&!Vs(c,"body")&&Ks>d.length;)if(Gs(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!Hs(c.parentNode))break;if(v.has(c.parentNode))break;v.add(c.parentNode),d.push(c.parentNode),c=c.parentNode}var p,_,m=[],y={},b=!1,w=!1;if(ts(d,(t=>{var i=fn(t);if(Vs(t,"a")){var e=t.getAttribute("href");b=!!(i&&e&&Sn(e))&&(u?Ci(e):e)}V(Qs(t),"ph-no-capture")&&(w=!0),m.push(function(t,i,e,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};en.indexOf(n)>-1&&!e&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?xl(1024,kn(t)):xl(1024,Zs(t)));var a=Qs(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),ts(t.attributes,(function(e){var n;if((!pn(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&Sn(e.value)&&(!rt(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=e.value;"class"===e.name&&(a=Js(a).join(" ")),o["attr__"+e.name]=xl(1024,"href"===e.name&&s?Ci(a):a)}}));for(var l=1,h=1,u=t;u=Sl(u);)l++,u.tagName===t.tagName&&h++;return o.nth_child=l,o.nth_of_type=h,o}(t,o,a,l,u));var r=function(t){if(!fn(t))return{};var i={};return ts(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&Sn(r)&&(i[e]=r)}})),i}(t);is(y,r)})),w)return{props:{},explicitNoCapture:w};if(a||(m[0].$el_text=Vs(i,"a")||Vs(i,"button")?kn(i):Zs(i)),b){var x,S;m[0].attr__href=b;var k=null==(x=Un(b))?void 0:x.host,E=null==t||null==(S=t.location)?void 0:S.host;k&&E&&k!==E&&(p=b)}return{props:is({$event_type:n.type,$ce_version:1},h?{}:{$elements:m},{$elements_chain:(_=m,function(t){return t.map((t=>{var i,e,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=g({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return es(n).sort(((t,i)=>t[0].localeCompare(i[0]))).forEach((t=>{var i=t[1];return o[$n(t[0].toString())]=$n(i.toString())})),(r+=":")+es(o).map((t=>t[0]+'="'+t[1]+'"')).join("")})).join(";")}(function(t){return t.map((t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:Pn(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return es(t).filter((t=>0===t[0].indexOf("attr__"))).forEach((t=>r.attributes[t[0]]=t[1])),r}))}(_)))},null!=(r=m[0])&&r.$el_text?{$el_text:null==(s=m[0])?void 0:s.$el_text}:{},p&&"click"===n.type?{$external_click_url:p}:{},y)}}class El{constructor(t){this.name="autocapture",this.Qn=!1,this.Jn=null,this.Kn=!1,this.Yn=!1,this.qi={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Xn=!1,this.ts=t,this.ts.refresh(this.qi),this.rageclicks=new yl(this.qi.rageclick),this.es=null}setup(t){this.rs(),this.ns=t;var i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Xn?i.dispose():(this.ss=i,this.startIfEnabled())}dispose(){var t;this.Xn||(this.Xn=!0,this.ns=void 0,null==(t=this.ss)||t.dispose(),this.ss=void 0,this.os())}ls(){return this.ts.refresh(this.qi),this.qi}rs(){var t,i;return this.ls(),this.qi.url_allowlist=null==(t=this.qi.url_allowlist)?void 0:t.map((t=>new RegExp(t))),this.qi.url_ignorelist=null==(i=this.qi.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),this.qi}us(){if(this.isBrowserSupported()){if(t&&r){var i=this.hs=i=>{i=i||(null==t?void 0:t.event);try{this.ds(i)}catch(t){wl.error("Failed to capture event",t)}};if(ls(r,"submit",i,{capture:!0}),ls(r,"change",i,{capture:!0}),ls(r,"click",i,{capture:!0}),this.ls().capture_copied_text){var e=this.vs=i=>{i=i||(null==t?void 0:t.event);try{this.ds(i,bl)}catch(t){wl.error("Failed to capture copy/cut event",t)}};ls(r,"copy",e,{capture:!0}),ls(r,"cut",e,{capture:!0})}}}else wl.info("Disabling Automatic Event Collection because this browser is not supported")}os(){this.hs&&(null==r||r.removeEventListener("submit",this.hs,!0),null==r||r.removeEventListener("change",this.hs,!0),null==r||r.removeEventListener("click",this.hs,!0),this.hs=void 0),this.vs&&(null==r||r.removeEventListener("copy",this.vs,!0),null==r||r.removeEventListener("cut",this.vs,!0),this.vs=void 0),this.Qn=!1}startIfEnabled(){!this.Xn&&this.ns&&this.isEnabled&&!this.Qn&&(this.us(),this.Qn=!0)}onRemoteConfig(t){if(!this.Xn)if(this.Kn=!0,t.ok){var i=t.config;i.elementsChainAsString&&(this.Yn=i.elementsChainAsString);var e,r=i.autocapture_opt_out;ht(r)&&(null==(e=this.ns)||e.kv.set(He,r),this.Jn=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.es=t}getElementSelectors(t){var i,e=[];return null==(i=this.es)||i.forEach((i=>{var s=null==r?void 0:r.querySelectorAll(i);null==s||s.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i;if(this.Xn)return!1;var e=null==(t=this.ns)?void 0:t.kv.get(He),r=this.Jn,s=this.ls(),n=s.remoteRequestsDisabled&&!this.Kn;if(nt(r)&&!ht(e)&&!n)return!1;var o=null!==(i=this.Jn)&&void 0!==i?i:!!e;return!!s.enabled&&!o}ds(i,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var r=tn(i);Ws(r)&&(r=r.parentNode||null);var s,n=this.rs();"$autocapture"===e&&"click"===i.type&&i instanceof MouseEvent&&n.rageclick&&null!=(s=this.rageclicks)&&s.isRageClick(i.clientX,i.clientY,i.timeStamp||(new Date).getTime())&&dn(r,n.rageclick)&&this.ds(i,"$rageclick");var o=e===bl;if(r&&function(i,e,r,s,n,o){var a;if(!t||vn(i))return!1;if(null!=r&&r.url_allowlist&&!Ys(r.url_allowlist,o))return!1;if(null!=r&&r.url_ignorelist&&Ys(r.url_ignorelist,o))return!1;if(null!=r&&r.dom_event_allowlist){var l=r.dom_event_allowlist;if(l&&!l.some((t=>e.type===t)))return!1}var h=cn(i,s),u=h.parentIsUsefulElement,d=h.targetElementList;if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(et(e))return!0;var r,s=function(t){if(e.some((i=>t.tagName.toLowerCase()===i)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(d,r))return!1;if(!rn(d,null==r?void 0:r.css_selector_allowlist))return!1;if(rn(d,null!==(a=null==r?void 0:r.css_selector_ignorelist)&&void 0!==a?a:nn))return!1;try{var v=t.getComputedStyle(i);if(v&&"pointer"===v.getPropertyValue("cursor")&&"click"===e.type)return!0}catch(t){}var c=i.tagName.toLowerCase();switch(c){case"html":return!1;case"form":return(n||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(e.type)>=0;default:return u?(n||["click"]).indexOf(e.type)>=0:(n||["click"]).indexOf(e.type)>=0&&(en.indexOf(c)>-1||"true"===i.getAttribute("contenteditable"))}}(r,i,n,o,o?["copy","cut"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var a,l=kl(r,{e:i,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.Yn,disableCaptureUrlHashes:n.disableCaptureUrlHashes}),h=l.props;if(l.explicitNoCapture)return!1;var u=this.getElementSelectors(r);if(u&&u.length>0&&(h.$element_selectors=u),e===bl){var d,v=Xs(null==t||null==(d=t.getSelection())?void 0:d.toString()),c=i.type||"clipboard";if(!v)return!1;h.$selected_content=v,h.$copy_type=c}return null==(a=this.ns)||a.capture(e,h).catch((t=>wl.error("Failed to capture event",t))),!0}}}isBrowserSupported(){return Z(null==r?void 0:r.querySelectorAll)}}class $l{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=tt(i.autocapture)?i.autocapture:void 0;t.enabled=!!i.autocapture,t.rageclick=i.rageclick,t.maskAllElementAttributes=i.mask_all_element_attributes,t.maskAllText=i.mask_all_text,t.disableCaptureUrlHashes=i.disable_capture_url_hashes,t.getCurrentUrl=i.get_current_url,t.remoteRequestsDisabled=this._instance.ma(),t.url_allowlist=null==e?void 0:e.url_allowlist,t.url_ignorelist=null==e?void 0:e.url_ignorelist,t.dom_event_allowlist=null==e?void 0:e.dom_event_allowlist,t.element_allowlist=null==e?void 0:e.element_allowlist,t.css_selector_allowlist=null==e?void 0:e.css_selector_allowlist,t.css_selector_ignorelist=null==e?void 0:e.css_selector_ignorelist,t.element_attribute_ignorelist=null==e?void 0:e.element_attribute_ignorelist,t.capture_copied_text=null==e?void 0:e.capture_copied_text}}var Pl=Ie("[ExceptionAutocapture]"),Tl=()=>{},Cl=Ie("[TracingHeaders]"),Fl=Ie("[Web Vitals]"),Rl=9e5,Il=["CLS","FCP","INP","LCP"],Ml=["INP","LCP"],Al=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Ol="disabled",Dl="lazy_loading",jl="awaiting_config",Ll="missing_config";Ie("[SessionRecording]"),Ie("[SessionRecording]");var Nl="[SessionRecording]",Bl=Ie(Nl),zl=Ie("[Heatmaps]");function Ul(t){return tt(t)&&"clientX"in t&&"clientY"in t&&at(t.clientX)&&at(t.clientY)}var ql=Ie("[Product Tours]"),Hl=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(Qe))},Vl=["$set_once","$set"],Wl=Ie("[SiteApps]"),Gl="Error while initializing PostHog app with config id ",Kl=(t,i)=>null!=t&&t.then?t.then(i):i(t),Jl="SDK is not enabled or survey functionality is not yet loaded",Yl="Disabled. Not loading surveys.";class Ql{constructor(t,i){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Tl=!1,this.Ml=[],this.El=null,this.Il=null,this.Xn=!1,this.Rl=new Set,this.onRemoteConfig=t=>{if(!this.Xn&&!this.qi.disableSurveys){if(!t.ok)return Wa.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(ot(i))return Wa.warn("Flags not loaded yet. Not loading surveys.");this.Pl=ht(i)?i:i.length>0,Wa.info("flags response received, isSurveysEnabled: "+this.Pl),this.loadIfEnabled()}},this.ts=t,this.Al=i}setup(t){if(!this.Xn)return this.Fl=t,Kl(t.kv.initialize(),(()=>{if(this.Fl===t&&!this.Xn){this.Fl=void 0,this.ns=t;var i=t.onRemoteConfig(this.onRemoteConfig);this.Xn?i.dispose():(this.ss=i,this.loadIfEnabled())}}))}dispose(){var t,i,e;this.Xn||(this.Xn=!0,this.Fl=void 0,this.ns=void 0,null==(t=this.ss)||t.dispose(),this.ss=void 0,null==(i=this._surveyEventReceiver)||i.dispose(),this._surveyEventReceiver=null,null==(e=this._surveyManager)||null==e.dispose||e.dispose(),this._surveyManager=null,this.Ml=[],this.El=null,this.Rl.forEach((t=>clearTimeout(t))),this.Rl.clear())}get qi(){return this.ts.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var i=[],e=0;e<localStorage.length;e++){var r=localStorage.key(e);(null!=r&&r.startsWith(Ga)||null!=r&&r.startsWith("inProgressSurvey_"))&&i.push(r)}i.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this.Xn&&this.ns){var t=this.qi;if(!this._surveyManager)if(this.Tl)Wa.info("Already initializing surveys, skipping...");else if(t.disableSurveys)Wa.info(Yl);else if(t.cookielessMode&&this.ts.isOptedOut())Wa.info("Not loading surveys in cookieless mode without consent.");else{var i=this.ts.getExtensions();if(i){if(!et(this.Pl)||t.advancedEnableSurveys){var e=this.Pl||t.advancedEnableSurveys;this.Tl=!0;try{var r=i.generateSurveys;if(r)return this.Ll(r,e),void(this.Tl=!1);var s=i.loadExternalDependency;if(!s)return this.Ol(zr),void(this.Tl=!1);s((t=>{try{if(this.Xn)return;var i=this.ts.getExtensions();t||null==i||!i.generateSurveys?this.Ol("Could not load surveys script",t):this.Ll(i.generateSurveys,e)}finally{this.Tl=!1}}))}catch(t){throw this.Tl=!1,this.Ol("Error initializing surveys",t),t}}}else Wa.error("PostHog Extensions not found.")}}}Ll(t,i){this.Xn||(this._surveyManager=t(i),this._surveyEventReceiver=this.ts.createEventReceiver(),Wa.info("Surveys loaded successfully"),this.Dl({isLoaded:!0}))}Ol(t,i){Wa.error(t,i),this.Dl({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Ml.push(t),this._surveyManager&&this.Dl({isLoaded:!0}),()=>{this.Ml=this.Ml.filter((i=>i!==t))}}getSurveys(t,i){var e;void 0===i&&(i=!1);var r=null!==(e=this.ns)&&void 0!==e?e:this.Al;if(r&&!this.Xn){if(this.qi.disableSurveys)return Wa.info(Yl),t([]);var s=r.kv.get(yr);if(s&&!i)return t(s,{isLoaded:!0}),void(this.$l()&&this.getSurveys((()=>{}),!0));if(this.El)this.El.then((i=>{this.Xn||t(i.surveys,i.context)})).catch((t=>Wa.error("Error in survey callback",t)));else{var n=this.Nl("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.qi.requestTimeoutMs}).then((t=>{try{return this.ql(r,t)}catch(t){return Wa.error("Error processing surveys response",t),this.ql(r,{statusCode:0,error:t})}}),(t=>this.ql(r,{statusCode:0,error:t})));this.El=n;var o=()=>{this.El===n&&(this.El=null)};n.then((i=>{o(),this.Xn||t(i.surveys,i.context)}),o).catch((t=>Wa.error("Error in survey callback",t)))}}}Nl(t,i){var e=this.ns;return e?e.sendRequest(t,i):new Promise((t=>t({statusCode:0,error:new Error(Jl)})))}ql(t,i){if(this.Xn)return{surveys:[],context:{isLoaded:!1,error:Jl}};var e=i.statusCode;if(200!==e||!i.json){var r="Surveys API could not be loaded, status: "+e;return 0!==e?Wa.error(r):i.error||Wa.warn(r),this.Il=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Il=null;var s,n=i.json.surveys||[],o=n.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Oa(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t))));return o.length>0&&(null==(s=this._surveyEventReceiver)||s.register(o)),t.kv.set({[yr]:n,[br]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}$l(){return this.jl()&&!this.El&&!this.Bl()}jl(){var t,i,e=null==(t=null!==(i=this.ns)&&void 0!==i?i:this.Al)?void 0:t.kv.get(br);return at(e)&&Date.now()-e>3e5}Bl(){return at(this.Il)&&3e5>Date.now()-this.Il}markSurveyAsSeen(t,i){var e,r={id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null};Ka(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Dl(t){for(var i of this.Ml)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){Wa.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!ot(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Wa.warn("init was not called")}Hl(t){var i=null;return this.getSurveys((e=>{var r;i=null!==(r=e.find((i=>i.id===t)))&&void 0!==r?r:null})),i}Ul(t){if(ot(this._surveyManager))return{eligible:!1,reason:Jl};var i="string"==typeof t?this.Hl(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}zl(t){if(ot(this._surveyManager))return{eligible:!1,reason:Jl};var i="string"==typeof t?this.Hl(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(ot(this._surveyManager))return Wa.warn("init was not called"),{visible:!1,disabledReason:Jl};var i=this.zl(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return ot(this._surveyManager)?(Wa.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Jl})):new Promise((e=>{this.getSurveys((i=>{var r,s=null!==(r=i.find((i=>i.id===t)))&&void 0!==r?r:null;if(s){var n=this.zl(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i,e){var s;if(ot(this._surveyManager))Wa.warn("init was not called");else{var n="string"==typeof t?this.Hl(t):t;if(null!=n&&n.id)if(Ja.includes(n.type)){var o=null==r?void 0:r.querySelector(i);if(o)if(null!=(s=n.appearance)&&s.surveyPopupDelaySeconds){Wa.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds");var a=setTimeout((()=>{var t,i;this.Rl.delete(a),this.Xn||(Wa.info("Rendering survey "+n.id+" with delay of "+(null==(t=n.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(n,o,e),Wa.info("Survey "+n.id+" rendered"))}),1e3*n.appearance.surveyPopupDelaySeconds);this.Rl.add(a)}else this._surveyManager.renderSurvey(n,o,e);else Wa.warn("Survey element not found")}else Wa.warn("Surveys of type "+n.type+" cannot be rendered in the app");else Wa.warn("Survey not found")}}displaySurvey(t,i){var e;if(ot(this._surveyManager))Wa.warn("init was not called");else{var r=this.Hl(t);if(r){var s=r;if(null!=(e=r.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(s=g({},r,{appearance:g({},r.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==ko&&i.initialResponses&&Wa.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var n=this.Ul(r);if(!n.eligible)return void Wa.warn("Survey is not eligible to be displayed: ",n.reason)}"inline"!==i.displayType?this._surveyManager.handlePopoverSurvey(s,i):this.renderSurvey(s,i.selector,i.properties)}else Wa.warn("Survey not found")}}cancelPendingSurvey(t){ot(this._surveyManager)?Wa.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}}function Xl(t,i,e){if(ot(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}class Zl{constructor(t){this.Wl=new Set,this.Vl=new Set,this.Gl=new Ca,this.Zl=(t,i)=>this.Ql(t,i)&&this.Jl(t,i)&&this.Kl(t,i)&&this.Yl(t,i),this.Ql=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t}init(){var t,i;et(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Xl=null==(i=this._instance)?void 0:i._addCaptureHook(((t,i)=>{this.on(t,i)})))}dispose(){var t;null==(t=this.Xl)||t.call(this),this.Xl=void 0,this.Gl=new Ca}register(t){var i,e;if(!et(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach((t=>{var i;this.Wl.add(t),null==(i=t.steps)||i.forEach((t=>{this.Vl.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r=new Set;this.Wl.forEach((t=>{var i;null==(i=t.steps)||i.forEach((t=>{null!=t&&t.selector&&r.add(t.selector)}))})),this._instance.autocapture.setElementSelectors(r)}}replace(t){this.Wl.clear(),this.Vl.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.Vl.has(t)||this.Vl.has(i.event))&&this.Wl.forEach((t=>{this.tu(i,t)&&this.Gl.emit("actionCaptured",t.name)}))}eu(t){this.onAction("actionCaptured",(i=>t(i)))}tu(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.Zl(t,e))return!0;return!1}onAction(t,i){return this.Gl.on(t,i)}Jl(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!Xl(r,i.url,i.url_matching||"contains"))return!1}return!0}Kl(t,i){return!!this.iu(t,i)&&!!this.ru(t,i)&&!!this.nu(t,i)}iu(t,i){var e;if(null==i||!i.href)return!0;var r=this.su(t);if(r.length>0)return r.some((t=>Xl(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&Xl((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}ru(t,i){var e;if(null==i||!i.text)return!0;var r=this.su(t);if(r.length>0)return r.some((t=>Xl(t.text,i.text,i.text_matching||"exact")||Xl(t.$el_text,i.text,i.text_matching||"exact")));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!ot(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some((t=>Xl(t,n,o))))}nu(t,i){var e,r;if(null==i||!i.selector)return!0;var s=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(null!=s&&s.includes(i.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&n)try{return new RegExp(i.selector_regex).test(n)}catch(t){return!1}return!1}su(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Yl(t,i){return null==i||!i.properties||0===i.properties.length||Na(i.properties.reduce(((t,i)=>{var e=X(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class th{constructor(t){var i;this.au=[],this._instance=t,this.ou=new Map,this.lu=new Map,this.uu=new Map,this.hu=null==(i=this._instance)||null==i.onSessionId?void 0:i.onSessionId((t=>this.du(t)))}vu(t){return!1}cu(){return null}fu(t){}pu(){}gu(t,i){return!!t&&Na(t.propertyFilters,null==i?void 0:i.properties)}mu(t,i){var e=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach((i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}}))})),e}yu(t,i,e){var r=(e===yo?this.ou:this.lu).get(t),s=[];return this.bu((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find((i=>i.name===t));return this.gu(n,i)}))}register(t){this._u(t,!1)}replace(t){this._u(t,!0)}_u(t,i){var e;et(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.wu(t,i),this.ku(t,i))}ku(t,i){var e=t.filter((t=>{var i;return null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length}));if(i&&this.uu.clear(),0!==e.length){this.Su||(this.Su=new Zl(this._instance),this.Su.init(),this.Su.eu((t=>this.onAction(t))));var r=[];e.forEach((t=>{var i;null==(i=t.conditions)||null==(i=i.actions)||i.values.forEach((i=>{if(r.push(i),i.name){var e,s=null!==(e=this.uu.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.uu.set(i.name,s)}}))})),i?this.Su.replace(r):this.Su.register(r)}else{var s;i&&(null==(s=this.Su)||s.replace([]))}}xu(t,i){i.forEach(((i,e)=>{var r,s=null!==(r=t.get(e))&&void 0!==r?r:[];i.forEach((t=>{s.includes(t)||s.push(t)})),t.set(e,s)}))}wu(t,i){var e,r,s=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0})),n=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0})),o=this.mu(t,yo),a=this.mu(t,bo);i?(this.ou=o,this.lu=a):(this.xu(this.ou,o),this.xu(this.lu,a)),(0!==s.length||0!==n.length)&&(null!==(e=this.Xl)&&void 0!==e||(this.Xl=null==(r=this._instance)?void 0:r._addCaptureHook(((t,i)=>{this.onEvent(t,i)}))))}onEvent(t,i){var e,r,s=this.Cu(),n=(null==i||null==(e=i.properties)?void 0:e.$survey_id)||(null==i||null==(r=i.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this.Tu(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.Mu([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.Eu(n),void this.Iu([n])}if(this.lu.has(t)){var a=this.yu(t,i,bo);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.Mu(a.map((t=>t.id))),a.forEach((t=>this.Ru(t.id))))}if(this.ou.has(t)){s.info("event name matched",{event:t,eventPayload:i,items:this.ou.get(t)});var l=this.yu(t,i,yo);this.Pu(l.map((t=>t.id)))}}onAction(t){this.uu.has(t)&&this.Pu(this.uu.get(t)||[])}Pu(t){var i;if(0!==t.length){var e=!(null==(i=this._instance)||null==i.get_session_id||!i.get_session_id()),r=[];for(var s of t)e&&this.vu(s)?this.Eu(s)&&this.Au(s):r.push(s);r.length>0&&(this.au=[...new Set([...this.au,...r])]),this.Cu().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Eu(t){this.au=this.au.filter((i=>i!==t));var i=this.Fu();return!i.includes(t)&&(this.Lu([...i,t]),this.Ou(),!0)}Mu(t){var i=new Set(t);this.au=this.au.filter((t=>!i.has(t)));var e=this.Du(),r=e.filter((t=>!i.has(t)));r.length!==e.length&&(this.Lu(r),0===r.length&&this.$u()),this.Iu(t)}Nu(){var t,i=this.cu();if(!i)return{};var e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e&&"object"==typeof e?e:{}}Au(t){if(this.cu()){var i=this.Nu();this.fu(g({},i,{[t]:Date.now()}))}}Iu(t){if(this.cu()){var i=this.Nu(),e={},r=!1;for(var s of Object.entries(i)){var n=s[0],o=s[1];t.includes(n)?r=!0:e[n]=o}r&&(it(e)?this.pu():this.fu(e))}}qu(){this.cu()&&this.pu()}getActivationTimestamp(t){if(this.Fu().includes(t)){var i=this.Nu()[t];return at(i)?i:void 0}}Du(){var t,i=this.ju();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}Fu(){var t,i,e=this.Du();if(0===e.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.Bu()],s=null==(i=this._instance)||null==i.get_session_id?void 0:i.get_session_id();return s&&r===s?e:[]}Ou(){var t,i=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();i&&this.Hu(i)}$u(){this.Uu()}du(t){var i,e=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[this.Bu()];if(e&&e!==t){var r=this.Du(),s=this.Nu();r.length>0&&(this.Lu([]),r.filter((t=>at(s[t]))).forEach((t=>this.Ru(t)))),this.$u(),this.qu()}}getActivatedIds(){return[...new Set([...this.Fu(),...this.au])].filter((t=>!this.zu(t)))}dispose(){var t,i,e;null==(t=this.hu)||t.call(this),this.hu=void 0,null==(i=this.Xl)||i.call(this),this.Xl=void 0,null==(e=this.Su)||e.dispose(),this.Su=void 0}reset(){this.au=[],this.Du().length>0&&this.Lu([]),this.$u(),this.qu()}getEventToItemsMap(){return this.ou}Wu(){return this.Su}}class ih extends th{constructor(t){super(t)}ju(){return wr}Bu(){return xr}cu(){return Sr}fu(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Sr]:t})}pu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(Sr)}vu(t){var i,e;this.bu((i=>{e=i.find((i=>i.id===t))}));var r=null==(i=e)||null==(i=i.appearance)?void 0:i.surveyPopupDelaySeconds;return at(r)&&r>0}Vu(){return wo}bu(t){var i;null==(i=this._instance)||i.getSurveys(t)}Ru(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}Cu(){return Wa}Lu(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[wr]:t})}Hu(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[xr]:t})}Uu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(xr)}zu(){return!1}Tu(t,i){var e;this.bu((t=>{e=t.find((t=>t.id===i))}));var r=!e||function(t){var i;return Oa(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(e);return r?t===wo?"consume":"ignore":t===wo?"persist":t===xo||t===So?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class eh{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);var i={};for(var e of t){var r=this._instance.get_property(e);et(r)||(i[e]=r)}return i}set(t,i){this._instance.register("string"==typeof t?{[t]:i}:t)}remove(t){"string"!=typeof t?t.forEach((t=>this._instance.unregister(t))):this._instance.unregister(t)}}class rh{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var t=null==v?void 0:v.__PosthogExtensions__;if(t){var i=t.generateSurveys,e=t.loadExternalDependency;return{generateSurveys:i?t=>i(this._instance,t):void 0,loadExternalDependency:e?t=>e(this._instance,"surveys",t):void 0}}}createEventReceiver(){return new ih(this._instance)}}var sh=null!=t&&t.location?Vn(t.location.hash,"__posthog")||Vn(location.hash,"state"):null,nh="_postHogToolbarParams",oh=Ie("[Toolbar]"),ah=Ie("[FeatureFlags]");class lh{constructor(t,i){void 0===i&&(i=!1),this.Gu=!1,this.update(t,i)}update(t,i){this.Zu=((t,i)=>{var e,r,s,n;return{bootstrap:{featureFlags:null==(e=t.bootstrap)?void 0:e.featureFlags,featureFlagPayloads:null==(r=t.bootstrap)?void 0:r.featureFlagPayloads},remoteRequestsDisabled:i,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?"none":"base64",evaluationContexts:null!==(s=null!==(n=t.evaluation_contexts)&&void 0!==n?n:t.evaluation_environments)&&void 0!==s?s:[],flagKeys:X(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.Gu||(ah.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Gu=!0),et(t.flag_keys)||X(t.flag_keys)||ah.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Zu}}var hh=Ie("[FeatureFlags]"),uh=Ie("[FeatureFlags]",{debugEnabled:!0}),dh="\" failed. Feature flags didn't load in time.",vh="connection_error",ch=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},fh=t=>{var i={};for(var e of es(t||{})){var r=e[1];r&&(i[e[0]]=r)}return i},ph=Ie("[Error tracking]"),gh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:"],_h=["__firefox__","__gCrWeb"],mh="Refusing to render web experiment since the viewer is a likely bot",yh={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>Da(i,t),not_regex:(t,i)=>!Da(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t};class bh{get qi(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{bh.Qu("retrieved web experiments from the server"),i.Ju=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;i.Ju&&(bh.Qu("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.Ju)||e.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);rt(r)&&t.variants[r]&&i.Ku(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];bh.Yu(n,i._instance)&&i.Ku(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())bh.Qu(mh);else if(!this.qi.disable_web_experiments){if(ot(this.Ju))return this.Ju=new Map,this.loadIfEnabled(),void this.previewWebExperiment();bh.Qu("applying feature flags",t),t.forEach((t=>{var i;if(this.Ju&&null!=(i=this.Ju)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.Ju)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.Ku(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=bh.getWindowLocation();if(null!=t&&t.search){var i=qn(null==t?void 0:t.search,"__experiment_id"),e=qn(null==t?void 0:t.search,"__experiment_variant");i&&e&&(bh.Qu("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.Xu(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this.qi.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.qi.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.qi.token),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}Xu(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(bh.Qu("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.Ku(r[0].name,i,r[0].variants[i].transforms))}static Yu(t,i){return!ot(t.conditions)&&bh.th(t,i)&&bh.eh(t)}static th(t,i){var e;if(ot(t.conditions)||ot(null==(e=t.conditions)?void 0:e.url))return!0;var r=bh.getWindowLocation();if(r){var s,n,o,a=Ls(i,r.href);return null==(s=t.conditions)||!s.url||yh[null!==(n=null==(o=t.conditions)?void 0:o.urlMatchType)&&void 0!==n?n:"icontains"](t.conditions.url,a)}return!1}static getWindowLocation(){return null==t?void 0:t.location}static eh(t){var i;if(ot(t.conditions)||ot(null==(i=t.conditions)?void 0:i.utm))return!0;var e=Zn();if(e.utm_source){var r,s,n,o,a,l,h,u,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(h=t.conditions)||null==(h=h.utm)||!h.utm_term||(null==(u=t.conditions)||null==(u=u.utm)?void 0:u.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static Qu(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];Re.info("[WebExperiments] "+t,e)}Ku(t,i,e){this._is_bot()?bh.Qu(mh):"control"!==i?e.forEach((e=>{if(e.selector){var r;bh.Qu("applying transform of variant "+i+" for experiment "+t+" ",e);var s=null==(r=document)?void 0:r.querySelectorAll(e.selector);null==s||s.forEach((t=>{var i=t;e.html&&(i.innerHTML=e.html),e.css&&i.setAttribute("style",e.css)}))}})):bh.Qu("Control variants leave the page unmodified.")}_is_bot(){return e&&this._instance?Ma(e,this.qi.custom_blocked_useragents):void 0}}var wh=Ie("[Conversations]"),xh="Conversations not available yet.",Sh="console",kh="__posthogHandledLogsRequestError",Eh=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[kh]=!0,e},$h=t=>!!t&&"object"==typeof t&&!0===t[kh],Ph={featureFlags:class{constructor(t){this.name="featureFlags",this.ih=!1,this.featureFlagEventHandlers=[],this.I=hh,this.rh={},this.nh={},this.sh=[],this.ah=!1,this.oh=!1,this.lh=0,this.uh=!1,this.hh=!1,this.dh=!1,this.fh=!1,this.ph=0,this.Tt=()=>{var t=this.gh();this.ph=0,t&&this.reloadFeatureFlags()},"get"in t?this.ts=t:(this.mh=new lh(t.config,t.ma()),this.ts=this.mh)}updateConfig(t,i){var e;null==(e=this.mh)||e.update(t,i)}setup(t){return this.Fl=t,this.I=t.logger.createLogger("[FeatureFlags]"),Kl(t.kv.initialize(),(()=>{this.Fl===t&&(this.Fl=void 0,this.ns=t,this.yh(t))}))}yh(i){if(this.ns===i)return t&&ls(t,"online",this.Tt),this.bh=i.registerDynamicEventProperties((()=>this._h()?this.rh:this.nh)),this.wh(),this.initialize()}destroy(){null==t||t.removeEventListener("online",this.Tt)}dispose(){var i;this.lh++,this.hh=!1,this.Fl=void 0,this.ns&&(this.kh(),null==(i=this.bh)||i.dispose(),this.bh=void 0,this.sh=[],null==t||t.removeEventListener("online",this.Tt),this.ns=void 0)}get qi(){return this.ts.get()}Sh(t){var i;return null==(i=this.ns)?void 0:i.kv.get(t)}Dr(t){this.xh((()=>{var i;return null==(i=this.ns)?void 0:i.kv.set(t)}))}qr(t){this.xh((()=>{var i;return null==(i=this.ns)?void 0:i.kv.remove(t)}))}xh(t){try{t()}catch(t){this.I.error("Failed to update feature flag persistence",t)}}wh(){var t={};for(var i of[lr,dr,vr,fr]){var e=this.Sh(i);et(e)||(t[i]=e)}this.rh=t;var r=g({},t),s=this.Sh(ar);if(s)for(var n of Object.entries(s))r["$feature/"+n[0]]=n[1];this.nh=r}_h(){var t=this.qi.cacheTtlMs;if(!t||0>=t)return!1;var i=this.Sh(Tr);return"number"!=typeof i||Date.now()-i>t}Ch(){return!!this._h()&&(this.fh||this.oh||(this.fh=!0,this.I.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Th(){var t=this.qi.evaluationContexts;return null!=t&&t.length?t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.I.error("Invalid evaluation context found:",t,"Expected non-empty string"),i})):[]}Mh(){var t=this.qi.flagKeys;if(!et(t))return t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.I.error("Invalid flag key found:",t,"Expected non-empty string"),i}))}initialize(){var t,i,e=this.qi,r=null!==(t=null==(i=e.bootstrap)?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,i)=>(t[i]=r[i]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,i)=>(t[i]=o[i],t)),{});return this.Eh({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,i,e){var r,s,n=null!=e&&e.merge&&null!==(r=this.Sh(ar))&&void 0!==r?r:{},o=null!=e&&e.merge&&null!==(s=this.Sh(dr))&&void 0!==s?s:{},a=g({},n,t),l=g({},o,i),h={};for(var u of Object.entries(a)){var d=u[0],v=u[1];h[d]={key:d,enabled:y(v),variant:b(v),reason:void 0,metadata:et(null==l?void 0:l[d])?void 0:{id:0,version:void 0,description:void 0,payload:l[d]}}}this.Eh({flags:h})}get hasLoadedFlags(){return this.ah}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Sh(ur),i=this.Sh(fr),e=this.Sh(pr);if(!e&&!i)return t||{};var r=is({},t||{}),s=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(var n of s){var o,a,l=r[n],h=null==i?void 0:i[n],u=et(h)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!h,d=et(h)?null==l?void 0:l.variant:"string"==typeof h?h:void 0,v=null==e?void 0:e[n],c=g({},l,{enabled:u,variant:u?null!=d?d:null==l?void 0:l.variant:void 0});u!==(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=g({},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.ih||(this.I.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:r}),this.ih=!0),r}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map((e=>{var r=t[e];return{key:e,enabled:y(r),variant:b(r),payload:m(i[e])}}))}getFlagVariants(){var t=this.Sh(ar),i=this.Sh(fr);if(!i)return t||{};for(var e=is({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.ih||(this.I.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.ih=!0),e}getFlagPayloads(){var t=this.Sh(dr),i=this.Sh(pr);if(!i)return t||{};for(var e=is({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.ih||(this.I.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.ih=!0),e}reloadFeatureFlags(){this.uh||this.qi.featureFlagsDisabled||this.gh()||this.Ih||(this.sh.slice().forEach((t=>{try{t()}catch(t){this.I.error("Error while running feature flags reloading callback",t)}})),this.Ih=setTimeout((()=>{this.Rh()}),5))}kh(){clearTimeout(this.Ih),this.Ih=void 0}onReloading(t){return this.sh.push(t),()=>{this.sh=this.sh.filter((i=>i!==t))}}ensureFlagsLoaded(){this.ah||this.oh||this.Ih||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.uh=t}resetFlagCallReported(){this.qr(Er)}Rh(t){this.kh();var i=this.ns;if(i&&!this.qi.remoteRequestsDisabled&&!this.gh())if(this.oh)this.hh=!0;else{var e={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:g({},i.initialPersonProperties,this.Sh(gr)||{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.Sh(_r),timezone:ao()};et(i.deviceId)||(e.$device_id=i.deviceId),(null!=t&&t.disableFlags||this.qi.featureFlagsDisabled)&&(e.disable_flags=!0);var r=this.Th();r.length&&(e.evaluation_contexts=r);var s=this.Mh();et(s)||(e.flag_keys=s);var n=this.qi.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(n?"&only_evaluate_survey_feature_flags=true":""),a=this.lh;this.oh=!0;var l=()=>{this.hh&&(this.hh=!1,this.Rh())},h=t=>{this.oh=!1,a===this.lh?(this.Dr({[Pr]:[vh]}),this.I.error("Feature flag request failed",t),l()):l()};try{i.sendRequest(o,{target:"flags",method:"POST",body:e,compression:"base64"===this.qi.compression?mo:void 0,sentAt:"body",timeoutMs:this.qi.requestTimeoutMs}).then((t=>{var i,r,s=null!==(i=t.json)&&void 0!==i?i:{},o=200!==t.statusCode;if(this.oh=!1,a===this.lh){if(this.Ph(t.statusCode),o||this.hh||(this.$anon_distinct_id=void 0),!e.disable_flags||this.hh){this.dh=!o;var h=[];t.error?h.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?vh:"unknown_error"):200!==t.statusCode&&h.push("api_error_"+t.statusCode),s.errorsWhileComputingFlags&&h.push("errors_while_computing_flags");var u=!(null==(r=s.quotaLimited)||!r.includes("feature_flags"));u&&h.push("quota_limited"),this.Dr({[Pr]:h}),u?this.I.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."):e.disable_flags||this.Eh(s,o,{partialResponse:n}),l()}}else l()})).catch(h)}catch(t){h(t)}}}gh(){return Wn(this.ph,3)}Ph(t){this.ph=Gn(t,this.ph,3,(()=>this.I.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(t,i){var e;if(void 0===i&&(i={}),!i.fresh||this.dh)if(this.ah||this.getFlags()&&this.getFlags().length>0){if(!this.Ch()){var r=this.getFeatureFlagResult(t,i);return null!==(e=null==r?void 0:r.variant)&&void 0!==e?e:null==r?void 0:r.enabled}}else this.I.warn('getFeatureFlag for key "'+t+dh)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i){if(void 0===i&&(i={}),!i.fresh||this.dh)if(this.ah||this.getFlags()&&this.getFlags().length>0){if(!this.Ch()){var e,r=this.getFlagVariants(),s=t in r,n=r[t],o=this.getFlagPayloads()[t],a=String(n),l=this.Sh(vr)||void 0,h=this.Sh(Tr)||void 0,u=this.Sh(Er)||{};if(this.qi.deduplicateCallsPerSession){var d,v=null==(d=this.ns)?void 0:d.session.sessionId,c=this.Sh($r);v&&v!==c&&(u={},e=v)}if(i.send_event||!("send_event"in i))if(t in u&&u[t].includes(a))e&&this.Dr({[Er]:u,[$r]:e});else{var f,p,_,y,b,w,x,S,k,E,P,T;X(u[t])?u[t].push(a):u[t]=[a],this.Dr(g({[Er]:u},e?{[$r]:e}:{}));var C=this.getFeatureFlagDetails(t),F=[...null!==(f=this.Sh(Pr))&&void 0!==f?f:[]];et(n)&&F.push("flag_missing");var R={$feature_flag:t,$feature_flag_response:n,$feature_flag_payload:null!=o?o:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:null!==(p=null==(_=this.qi.bootstrap)||null==(_=_.featureFlags)?void 0:_[t])&&void 0!==p?p:null,$feature_flag_bootstrapped_payload:null!==(y=null==(b=this.qi.bootstrap)||null==(b=b.featureFlagPayloads)?void 0:b[t])&&void 0!==y?y:null,$used_bootstrap_value:!this.dh};et(null==C||null==(w=C.metadata)?void 0:w.has_experiment)||(R.$feature_flag_has_experiment=C.metadata.has_experiment),et(null==C||null==(x=C.metadata)?void 0:x.version)||(R.$feature_flag_version=C.metadata.version);var I,M=null!==(S=null==C||null==(k=C.reason)?void 0:k.description)&&void 0!==S?S:null==C||null==(E=C.reason)?void 0:E.code;M&&(R.$feature_flag_reason=M),null!=C&&null!=(P=C.metadata)&&P.id&&(R.$feature_flag_id=C.metadata.id),et(null==C?void 0:C.original_variant)&&et(null==C?void 0:C.original_enabled)||(R.$feature_flag_original_response=et(C.original_variant)?C.original_enabled:C.original_variant),null!=C&&null!=(T=C.metadata)&&T.original_payload&&(R.$feature_flag_original_payload=null==C||null==(I=C.metadata)?void 0:I.original_payload),F.length&&(R.$feature_flag_error=F.join(",")),this.Ah(R)}else e&&this.Dr({[Er]:u,[$r]:e});if(s)return{key:t,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:m(o)}}}else this.I.warn('getFeatureFlagResult for key "'+t+dh)}Ah(t){try{var i;null==(i=this.ns)||i.capture("$feature_flag_called",t).catch((t=>{this.I.error("Failed to capture feature flag call",t)}))}catch(t){this.I.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,i){this.Fh(t,i)}Fh(t,i){var e=this;return p((function*(){var r=e.ns;if(r){var s={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},n=e.Th();n.length&&(s.evaluation_contexts=n);var o,a=e.Mh();et(a)||(s.flag_keys=a);try{var l,h=null==(l=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:"base64"===e.qi.compression?mo:void 0,sentAt:"body",timeoutMs:e.qi.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;o=(null==h?void 0:h[t])||void 0}catch(t){return void e.I.error("Remote config feature flag request failed",t)}try{i(o)}catch(t){e.I.error("Remote config feature flag callback failed",t)}}}))()}isFeatureEnabled(t,i){if(void 0===i&&(i={}),i.fresh&&!this.dh)return i.defaultValue;if(!(this.ah||this.getFlags()&&this.getFlags().length>0))return this.I.warn('isFeatureEnabled for key "'+t+dh),i.defaultValue;var e=this.getFeatureFlag(t,i);return et(e)?i.defaultValue:!!e}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i,e){this.Eh(t,i,e)}Eh(t,i,e){if(this.ns){this.ah=!0;var r=function(t,i,e,r,s,n){void 0===i&&(i={}),void 0===e&&(e={}),void 0===r&&(r={}),void 0===n&&(n=hh);var o=((t,i)=>{var e=t.flags;return e?g({},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]}))),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&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t)})(t,n),a=o.flags,l=o.featureFlags,h=o.featureFlagPayloads;if(l){var u=t.requestId,d=t.evaluatedAt;if(X(l)){n.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;return{[lr]:l,[ar]:v,[cr]:!1}}var f=l,p=h,_=a;if(null!=s&&s.partialResponse)f=g({},i,f),p=g({},e,p),_=g({},r,_);else if(t.errorsWhileComputingFlags)if(a){var m=new Set(Object.keys(a).filter((t=>{var i;return!(null!=(i=a[t])&&i.failed)})));f=g({},i,Object.fromEntries(Object.entries(f).filter((t=>m.has(t[0]))))),p=g({},e,Object.fromEntries(Object.entries(p||{}).filter((t=>m.has(t[0]))))),_=g({},r,Object.fromEntries(Object.entries(_||{}).filter((t=>m.has(t[0])))))}else f=g({},i,f),p=g({},e,p),_=g({},r,_);return g({[lr]:Object.keys(fh(f)),[ar]:f||{},[dr]:p||{},[ur]:_||{},[cr]:!0===t.minimalFlagCalledEvents},u?{[vr]:u}:{},d?{[Tr]:d}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.I);r&&this.Dr(r),i||(this.fh=!1),this.Lh(i)}}override(t,i){void 0===i&&(i=!1),this.I.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.Oh(t)}Oh(t){if(this.ns){if(!1===t)return this.qr([fr,pr]),this.Lh(),void uh.info("All overrides cleared");if(X(t))return this.Dr({[fr]:ch(t)}),this.Lh(),void uh.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;this.ih=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);var r={},s=e.flags,n=e.payloads;return s&&(r[fr]=X(s)?ch(s):s),n&&(r[pr]=n),Object.keys(r).length&&this.Dr(r),!1===s&&!1===n?this.qr([fr,pr]):!1===s?this.qr(fr):!1===n&&this.qr(pr),this.Lh(),!1===s?uh.info("Flag overrides cleared"):s&&uh.info("Flag overrides set",{flags:s}),void(!1===n?uh.info("Payload overrides cleared"):n&&uh.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.Dr({[fr]:t}),this.Lh(),void uh.info("Flag overrides set",{flags:t});this.I.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.I.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.ah){var i=this.Dh(),e=i.flags,r=i.flagVariants;try{t(e,r)}catch(t){this.I.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var r=(this.Sh(hr)||[]).find((i=>i.flagKey===t)),s={["$feature_enrollment/"+t]:i},n={$feature_flag:t,$feature_enrollment:i,$set:s};r&&(n.$early_access_feature_name=r.name),e&&(n.$feature_enrollment_stage=e);var o=g({},this.getFlagVariants(),{[t]:i});this.Dr({[lr]:Object.keys(fh(o)),[ar]:o,[gr]:g({},this.Sh(gr)||{},s)}),this.Lh();try{var a;null==(a=this.ns)||a.capture("$feature_enrollment_update",n).catch((t=>{this.I.error("Failed to capture early access feature enrollment",t)}))}catch(t){this.I.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.Sh(hr);!r||i?this.$h(t,e):t(r)}$h(t,i){var e=this;return p((function*(){var r=e.ns;if(r){var s,n=i?"&"+i.map((t=>"stage="+t)).join("&"):"";try{var o=yield r.sendRequest("/api/early_access_features/?token="+r.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;e.Dr({[hr]:s=o.json.earlyAccessFeatures})}catch(t){return void e.I.error("Early access feature request failed",t)}try{t(s)}catch(t){e.I.error("Early access feature callback failed",t)}}}))()}Dh(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter((t=>i[t])),flagVariants:Object.keys(i).filter((t=>i[t])).reduce(((t,e)=>(t[e]=i[e],t)),{})}}Lh(t){this.wh();var i=this.Dh(),e=i.flags,r=i.flagVariants;this.featureFlagEventHandlers.forEach((i=>{try{i(e,r,{errorsLoading:t})}catch(t){this.I.error("Error while running feature flags callback",t)}}))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.Nh(t,i)}Nh(t,i){void 0===i&&(i=!0);var e=this.Sh(gr)||{},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 e||(n[o]=s[o]));this.Dr({[gr]:g({},e,n,r)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=g({},this.Sh(gr)||{});t.forEach((t=>{delete e[t]})),this.Dr({[gr]:e}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.qr(gr),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this.Sh(_r)||{},r=g({},e);for(var s of Object.keys(t))r[s]=g({},e[s],t[s]);this.Dr({[_r]:r}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.Sh(_r)||{};this.Dr({[_r]:g({},i,{[t]:{}})})}else this.qr(_r)}reset(){this.lh++,this.hh=!1,this.rh={},this.nh={},this.ah=!1,this.uh=!1,this.dh=!1,this.$anon_distinct_id=void 0,this.kh(),this.ih=!1,this.ph=0}}},Th={sessionRecording:class{get qi(){return this._instance.config}get za(){return this._instance.persistence}get started(){var t;return!(null==(t=this.qh)||!t.isStarted)}get status(){var t,i;return this.jh===jl||this.jh===Ll?this.jh:null!==(t=null==(i=this.qh)?void 0:i.status)&&void 0!==t?t:this.jh}constructor(i){if(this._forceAllowLocalhostNetworkCapture=!1,this.jh=Ol,this.Bh=void 0,this.Hh=!1,this.kt=(()=>{var i;if(null==r||!r.visibilityState||"visible"===r.visibilityState)return!0;var e=null==t||null==(i=t.performance)||null==i.getEntriesByType?void 0:i.getEntriesByType("visibility-state");return!(null!=e&&e.length)||e.some((t=>"visible"===t.name))})(),this.It=()=>{var t;"visible"===(null==r?void 0:r.visibilityState)&&(this.kt=!0,null==(t=this.qh)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},this._instance=i,!this._instance.sessionManager)throw Bl.error("started without valid sessionManager"),new Error(Nl+" started without valid sessionManager. This is a bug.");if(this.qi.cookieless_mode===qr)throw new Error(Nl+' cannot be used with cookieless_mode="always"');null!=r&&r.addEventListener&&ls(r,"visibilitychange",this.It)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Hh=!0,null==r||null==r.removeEventListener||r.removeEventListener("visibilitychange",this.It),this.stopRecording()}get Uh(){var i,e=!(null==(i=this._instance.get_property(Ze))||!i.enabled),r=!this.qi.disable_session_recording,s=this.qi.disable_session_recording||this._instance.consent.isOptedOut();return t&&e&&r&&!s}startIfEnabledOrStop(t){var i;if(!(this.Hh||this.Uh&&null!=(i=this.qh)&&i.isStarted)){var e=!et(Object.assign)&&!et(Array.from);this.Uh&&e?(this.zh(t),Bl.info("starting")):(this.jh=Ol,this.stopRecording())}}zh(t){var i,e,r;this.Uh&&(this.jh!==jl&&this.jh!==Ll&&(this.jh=Dl),null!=v&&null!=(i=v.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=v.__PosthogExtensions__)&&e.initSessionRecording?this.Wh(t):null==(r=v.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Vh,(i=>{if(i)return this._instance.register_for_session({[Br]:!0}),Bl.error("could not load recorder",i);this.Wh(t)})))}stopRecording(){var t,i;null==(t=this.Bh)||t.call(this),this.Bh=void 0,null==(i=this.qh)||i.stop()}Gh(){var t,i;null==(t=this.Bh)||t.call(this),this.Bh=void 0,null==(i=this.qh)||i.discard()}Zh(){var t,i;null==(t=this.za)||t.unregister(or),null==(i=this.za)||i.unregister(tr)}Qh(t,i){if(ot(t))return null;var e,r=at(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(Bl.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Jh(t){if(this.za){var i,e,r=this.za,s=()=>{var i,e=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.Qh(null==(i=this.qi.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),n=this.Qh(null==e?void 0:e.sampleRate,"remote config sampleRate"),o=null!=s?s:n;ot(o)&&this.Zh();var a=null==e?void 0:e.minimumDurationMilliseconds;r.register({[Ze]:g({cache_timestamp:Date.now(),enabled:!!e},e,{networkPayloadCapture:g({capturePerformance:t.capturePerformance},null==e?void 0:e.networkPayloadCapture),canvasRecording:{enabled:null==e?void 0:e.recordCanvas,fps:null==e?void 0:e.canvasFps,quality:null==e?void 0:e.canvasQuality},sampleRate:o,minimumDurationMilliseconds:et(a)?null:a,endpoint:null==e?void 0:e.endpoint,triggerMatchType:null==e?void 0:e.triggerMatchType,masking:null==e?void 0:e.masking,urlTriggers:null==e?void 0:e.urlTriggers,version:null==e?void 0:e.version,triggerGroups:null==e?void 0:e.triggerGroups})})};s(),null==(i=this.Bh)||i.call(this),this.Bh=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(s)}}onRemoteConfig(t){var i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?!1===i.sessionRecording?(this.Jh(i),void this.Gh()):(this.Jh(i),void this.startIfEnabledOrStop()):(this.jh===jl&&(this.jh=Ll,Bl.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.qh)&&e.log?this.qh.log(t,i):Bl.warn("log called before recorder was ready")}get Vh(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(Ze);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}Kh(){var t,i=this._instance.get_property(Ze);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return Bl.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!ot(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}Wh(t){var i,e,r;if(!this.Hh){if(null==(i=v.__PosthogExtensions__)||!i.initSessionRecording)return Bl.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Br]:!0});var s;if(this.qh||(this.qh=null==(s=v.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.kt),this.qh._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Kh()){if(this.jh===Ll||this.jh===jl)return;return this.jh=jl,Bl.info("persisted remote config is stale, requesting fresh config before starting"),void new To(this._instance).load()}this.jh=Dl,null==(e=(r=this.qh).setDocumentWasEverVisible)||e.call(r,this.kt),this.qh.start(t)}}onRRwebEmit(t){var i;null==(i=this.qh)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.qh||null==(i=this.za)||i.register({[er]:!0}),null==(t=this.qh)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.qh||null==(i=this.za)||i.register({[ir]:!0}),null==(t=this.qh)||t.overrideSampling()}overrideTrigger(t){var i,e;this.qh||null==(e=this.za)||e.register({["url"===t?rr:sr]:!0}),null==(i=this.qh)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.qh)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.qh)||!e.tryAddCustomEvent(t,i))}}},Ch={autocapture:class extends El{constructor(t){super(new $l(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.Yh=this.Xh()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.td();return!!(t.path||t.search||this.ed(t))}startIfEnabled(){this.isEnabled&&(Re.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Yh=this.Xh(),this.startIfEnabled()}stop(){this.rd&&this.rd(),this.rd=void 0,this.nd&&this.nd(),this.nd=void 0,Re.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.sd("pushState"),this.sd("replaceState"),this.ad(),this.ed()&&this.od())}sd(i){var e;if(t&&(null==(e=t.history[i])||!e.__posthog_wrapped__)){var r=this;!function(t,i,e){try{if(!(i in t))return Tl;var r={next:t[i]},s=e((function(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];return r.next.apply(this,i)}));return Z(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[i]=s,()=>{if(t[i]!==s)for(var e=t[i];Z(e)&&e.__posthog_layer__;){var n=e.__posthog_layer__;if(n.next===s)return void(n.next=r.next);e=n.next}else t[i]=r.next}}catch(t){return Tl}}(t.history,i,(t=>function(e,s,n){t.call(this,e,s,n),r.ld(i)}))}}Xh(){var i=null==t?void 0:t.location;if(null!=i&&i.pathname)return{pathname:i.pathname,search:i.search,hash:i.hash}}td(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:tt(t)?t:{}}ed(t){return void 0===t&&(t=this.td()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}ud(t){var i=this.td(),e=this.Yh;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.ed(i)&&t.hash!==e.hash))}ld(t){try{var i=this.Xh();if(!i)return;this.ud(i)&&this._instance.capture(Jr,{navigation_type:t}),this.Yh=i}catch(i){Re.error("Error capturing "+t+" pageview",i)}}ad(){if(!this.rd){var i=()=>{this.ld("popstate")};ls(t,"popstate",i),this.rd=()=>{t&&t.removeEventListener("popstate",i)}}}od(){if(!this.nd){var i=()=>{this.ld("hashchange")};ls(t,"hashchange",i),this.nd=()=>{t&&t.removeEventListener("hashchange",i)}}}},heatmaps:class{get qi(){return this.instance.config}constructor(t){var i;this.hd=!1,this.Qn=!1,this.dd=null,this.instance=t,this.hd=!(null==(i=this.instance.persistence)||!i.props[Ve]),this.rageclicks=new yl(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return tt(this.qi.capture_heatmaps)&&this.qi.capture_heatmaps.flush_interval_milliseconds&&(t=this.qi.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return ot(this.qi.capture_heatmaps)?ot(this.qi.enable_heatmaps)?this.hd:this.qi.enable_heatmaps:!1!==this.qi.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Qn)return;zl.info("starting..."),this.vd(),this.It()}else{var t;clearInterval(null!==(t=this.dd)&&void 0!==t?t:void 0),this.fd(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var i=t.config;if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Ve]:e}),this.hd=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.ft;return this.ft=void 0,t}pd(t){Ul(t.originalEvent)&&this.ki(t.originalEvent,"deadclick")}It(){this.dd&&clearInterval(this.dd),this.dd=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(r)?setInterval(this.La.bind(this),this.flushIntervalMilliseconds):null}vd(){t&&r&&(this.gd=this.La.bind(this),ls(t,Kr,this.gd),this.md=i=>this.ki(i||(null==t?void 0:t.event)),ls(r,"click",this.md,{capture:!0}),this.yd=i=>this.bd(i||(null==t?void 0:t.event)),ls(r,"mousemove",this.yd,{capture:!0}),this._d=new Rn(this.instance,Cn,this.pd.bind(this)),this._d.startIfEnabledOrStop(),this.wd=this.It.bind(this),ls(r,Gr,this.wd),this.Qn=!0)}fd(){var i;t&&r&&(this.gd&&t.removeEventListener(Kr,this.gd),this.md&&r.removeEventListener("click",this.md,{capture:!0}),this.yd&&r.removeEventListener("mousemove",this.yd,{capture:!0}),this.wd&&r.removeEventListener(Gr,this.wd),clearTimeout(this.kd),null==(i=this._d)||i.stop(),this.Qn=!1)}Sd(i,e){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(i,e,r){for(var s=i;s&&Hs(s)&&!Vs(s,"body");){if(s===r)return!1;var n=void 0;try{var o,a,l;n=null==(o=null!==(a=null==(l=s.ownerDocument)?void 0:l.defaultView)&&void 0!==a?a:t)?void 0:o.getComputedStyle(s).position}catch(t){return!1}if(V(e,n))return!0;s=sn(s)}return!1}(tn(i),["fixed","sticky"],n);return{x:i.clientX+(o?0:s),y:i.clientY+(o?0:r),target_fixed:o,type:e}}ki(t,i){var e;if(void 0===i&&(i="click"),!qs(t.target)&&Ul(t)){var r=this.Sd(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&dn(tn(t),this.instance.config.rageclick)&&this.Nn(g({},r,{type:"rageclick"})),this.Nn(r)}}bd(t){!qs(t.target)&&Ul(t)&&(clearTimeout(this.kd),this.kd=setTimeout((()=>{this.Nn(this.Sd(t,"mousemove"))}),500))}Nn(i){if(t){var e=this.qi.disable_capture_url_hashes?Ci(t.location.href):t.location.href,r=this.qi.custom_personal_data_properties,s=this.qi.mask_personal_data_properties?[...Jn,...r||[]]:[],n=Hn(e,s,Qn);this.ft=this.ft||{},this.ft[n]||(this.ft[n]=[]),this.ft[n].push(i)}}La(){this.ft&&!it(this.ft)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Rn,webVitalsAutocapture:class{constructor(t){var i;this.hd=!1,this.Qn=!1,this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.xd=()=>{clearTimeout(this.Cd),this.Cd=void 0,0!==this.ft.metrics.length&&(this._instance.capture("$web_vitals",g({$current_url:this.ft.url},this.ft.metrics.reduce(((t,i)=>g({},t,{["$web_vitals_"+i.name+"_event"]:g({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{}))),this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Td=t=>{var i;if(this.ft=this.ft||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},ot(null==t?void 0:t.name)||ot(null==t?void 0:t.value))Fl.error("Invalid metric received",t);else{var e="string"==typeof t.navigationURL?t.navigationURL:void 0,r=this.Md(e);if(!et(r)){var s=at(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+r;if(!this.Ed||this.Ed>t.value){this.ft.navigationKey!==s&&(this.xd(),this.Cd=setTimeout(this.xd,this.flushToCaptureTimeoutMs)),et(this.ft.navigationKey)&&(this.ft.navigationKey=s,this.ft.url=r),this.ft.firstMetricTimestamp=et(this.ft.firstMetricTimestamp)?Date.now():this.ft.firstMetricTimestamp;var n=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0),o=g({},t,e?{navigationURL:r}:{},{$current_url:r,timestamp:Date.now()});if(delete o.entries,tt(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var a={};for(var l of Al){var h="url"===l&&"string"==typeof t.attribution[l]?this.Md(t.attribution[l]):t.attribution[l];et(h)||(a[l]=h)}o.attribution=a}else delete o.attribution;et(n)||(o.$session_id=n.sessionId,o.$window_id=n.windowId),this.ft.metrics.push(o),this.ft.metrics.length===this.allowedMetrics.length&&this.xd()}else Fl.error("Ignoring metric with value >= "+this.Ed,t)}}},this.Id=()=>{if(!this.Qn){var t,i,e,r,s=!1,n=v.__PosthogExtensions__,o=null==n?void 0:n.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this.Rd])||("web-vitals"===this.Rd&&et(o)?null==n?void 0:n.postHogWebVitalsCallbacks:void 0);if(!et(a)){var l=a.withoutAttribution,h=this.attributionMetrics;s=!et(l),t=h.indexOf("LCP")>-1?a.onLCP:(null==l?void 0:l.onLCP)||a.onLCP,i=h.indexOf("CLS")>-1?a.onCLS:(null==l?void 0:l.onCLS)||a.onCLS,e=h.indexOf("FCP")>-1?a.onFCP:(null==l?void 0:l.onFCP)||a.onFCP,r=h.indexOf("INP")>-1?a.onINP:(null==l?void 0:l.onINP)||a.onINP}if(t&&i&&e&&r){var u={reportSoftNavs:this.useSoftNavs},d=s&&this.attributionMetrics.indexOf("INP")>-1?g({},u,{includeProcessedEventEntries:!1}):u;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Td.bind(this),u),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Td.bind(this),u),this.allowedMetrics.indexOf("FCP")>-1&&e(this.Td.bind(this),u),this.allowedMetrics.indexOf("INP")>-1&&r(this.Td.bind(this),d),this.Qn=!0}else Fl.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.hd=!(null==(i=this._instance.persistence)||!i.props[Je]),this.startIfEnabled()}get Pd(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=tt(this.Pd)?null==(t=this.Pd)?void 0:t.web_vitals_allowed_metrics:void 0;return ot(e)?(null==(i=this._instance.persistence)?void 0:i.props[Xe])||Il:e}get flushToCaptureTimeoutMs(){return(tt(this.Pd)?this.Pd.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=tt(this.Pd)?this.Pd.web_vitals_attribution:void 0;return ht(t)?t?Il:[]:X(t)?t:Ml}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t=tt(this.Pd)?this.Pd.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Ed(){var t=tt(this.Pd)&&at(this.Pd.__web_vitals_max_value)?this.Pd.__web_vitals_max_value:Rl;return t>0&&6e4>=t?Rl:t}get isEnabled(){var t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return Fl.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=tt(this.Pd)?this.Pd.web_vitals:ht(this.Pd)?this.Pd:void 0;return ht(i)?i:this.hd}startIfEnabled(){this.isEnabled&&!this.Qn&&(Fl.info("enabled, starting..."),this._s(this.Id))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=tt(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=tt(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Je]:e}),this._instance.persistence.register({[Xe]:r})),this.hd=e,this.startIfEnabled()}}}get Rd(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}_s(t){var i=v.__PosthogExtensions__,e=this.Rd,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&et(r)&&null!=i&&i.postHogWebVitalsCallbacks?t():null==i||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(i=>{i?Fl.error("failed to load script",i):t()}))}Md(i){var e=i||(null==t?void 0:t.location.href);if(e){var r=this._instance.config.disable_capture_url_hashes?Ci(e):e,s=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Jn,...s||[]]:[];return Hn(r,n,Qn)}Fl.error("Could not determine current URL")}}},Fh={exceptionObserver:class{constructor(i){var e;this.Id=()=>{var i;if(t&&this.isEnabled&&null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions){var e=v.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=v.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=v.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Ad&&this.qi.capture_unhandled_errors&&(this.Ad=e(this.captureException.bind(this))),!this.Fd&&this.qi.capture_unhandled_rejections&&(this.Fd=r(this.captureException.bind(this))),!this.Ld&&this.qi.capture_console_errors&&(this.Ld=s(this.captureException.bind(this)))}catch(t){Pl.error("failed to start",t),this.Od()}}},this._instance=i,this.Dd=!(null==(e=this._instance.persistence)||!e.props[We]),this.oe=new xt(g({},function(t){var i,e,r,s;return void 0===t&&(t={}),{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,I:Pl})),this.qi=this.$d(),this.startIfEnabledOrStop()}$d(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return tt(t)?i=g({},i,t):(et(t)?this.Dd:t)&&(i=g({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.qi.capture_console_errors||this.qi.capture_unhandled_errors||this.qi.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Pl.info("enabled"),this.Od(),this._s(this.Id)):this.Od()}_s(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions?t():null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Pl.error("failed to load script",i);t()}))}Od(){var t,i,e;null==(t=this.Ad)||t.call(this),this.Ad=void 0,null==(i=this.Fd)||i.call(this),this.Fd=void 0,null==(e=this.Ld)||e.call(this),this.Ld=void 0}onRemoteConfig(t){if(t.ok){var i=t.config;"autocaptureExceptions"in i&&(this.Dd=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[We]:this.Dd}),this.qi=this.$d(),this.startIfEnabledOrStop())}}onConfigChange(){this.qi=this.$d()}captureException(t){var i,e,r,s=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.oe.consumeRateLimit(s)?Pl.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var i,e;this.Nd=[],this.qd=new te([new ve,new xe,new fe,new ce,new be,new ye,new ge,new we],function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];return function(i,r){void 0===r&&(r=0);for(var s=[],n=i.split("\n"),o=r;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=de.test(a)?a.replace(de,"$1"):a;if(!l.match(/\S*Error: /)){for(var h of e){var u=h(l,t);if(u){s.push(u);break}}if(s.length>=50)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,50).map((t=>{return g({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||ie});var e}))}(s)}}("web:javascript",ae,ue)),this._instance=t,this.Nd=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property(Ge))&&void 0!==i?i:[],this.jd=Pe(this.Bd()),this.Hd=new Te(this.jd)}onConfigChange(){this.jd=Pe(this.Bd()),this.Hd.setConfig(this.jd)}onRemoteConfig(t){var i,e,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(i=null==(e=s.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],o=null==(r=s.errorTracking)?void 0:r.captureExtensionExceptions;this.Nd=n,this._instance.persistence&&this._instance.persistence.register({[Ge]:this.Nd,[Ke]:o})}}}get Ud(){var t,i=!!this._instance.get_property(Ke),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.qd.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.jd.enabled)try{if(!rt(t)||0===t.trim().length)return void ph.warn("Ignoring exception step because message must be a non-empty string");var e=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var i=[];return{sanitizedProperties:Object.keys(t).reduce(((e,r)=>Ee.has(r)?(i.push(r),e):(e[r]=t[r],e)),{}),droppedKeys:i}}(this.zd(i)),r=e.sanitizedProperties,s=e.droppedKeys;s.length>0&&ph.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.Hd.add(g({[Se]:t,[ke]:(new Date).toISOString()},r))}catch(t){ph.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var i=t.$exception_list;if(this.Wd(i)){if(this.Vd(i))return this.Gd("Exception dropped: matched a suppression rule"),void ph.info("Skipping exception capture because a suppression rule matched");if(!this.Ud&&this.Zd(i))return this.Gd("Exception dropped: thrown by a browser extension"),void ph.info("Skipping exception capture because it was thrown by an extension");if(!this.Ud&&this.Qd(i))return this.Gd("Exception dropped: thrown by an injected browser script"),void ph.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Jd(i))return this.Gd("Exception dropped: thrown by the PostHog SDK"),void ph.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this.jd.enabled&&ot(t.$exception_steps)?this.Kd(t):t,r="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;r&&(e.$release_id=r);try{var s=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",fl:!0});return s&&this.Hd.clear(),s}catch(t){return ph.error("Failed to capture exception event. Dropping this exception.",t),void this.Hd.clear()}}catch(t){return void ph.error("Failed to process exception event. Ignoring this exception.",t)}var n}Kd(t){try{var i=this.Hd.getAttachable();return 0===i.length?t:g({},t,{$exception_steps:i})}catch(i){return ph.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}Gd(t){this.jd.enabled&&this.Hd.add({[Se]:t,[ke]:(new Date).toISOString()})}zd(t){return tt(t)?g({},t):{}}Bd(){var t,i;return null!==(t=null==(i=this._instance.config.error_tracking)?void 0:i.exception_steps)&&void 0!==t?t:{}}Vd(t){if(0===t.length)return!1;try{var i=t.reduce(((t,i)=>{var e=i.type,r=i.value;return rt(e)&&e.length>0&&t.$exception_types.push(e),rt(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.Nd.some((t=>{var e=t.values.map((t=>{var e=La[t.operator],r=i[t.key];if(!e||!r)return!1;var s=X(t.value)?t.value:[t.value];return s.length>0&&e(s,r)}));return"OR"===t.type?e.some(Boolean):e.every(Boolean)}))}catch(t){return ph.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Zd(t){return t.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})).some((t=>{var i=t.filename;return!!i&&gh.some((t=>i.startsWith(t)))}))}Qd(t){return t.some((t=>{var i=t.value;return rt(i)&&_h.some((t=>i.includes(t)))}))}Jd(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Wd(t){return!ot(t)&&X(t)}}},Rh=g({productTours:class{get za(){return this._instance.persistence}constructor(t){this.Yd=null,this.Xd=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var i=t.config;if("productTours"in i){var e,r;if(this.za&&this.za.register({[Qe]:!!i.productTours}),!Hl(this._instance))return!this.Yd&&ot(null==(e=this.za)?void 0:e.props[kr])||ql.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.Yd)||r.stop(),this.Yd=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Yd&&Hl(this._instance)&&this._s((()=>this.tv()))}_s(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",(i=>{i?ql.error("Could not load product tours script",i):t()}))}tv(){var t;!this.Yd&&null!=(t=v.__PosthogExtensions__)&&t.generateProductTours&&(this.Yd=v.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!X(this.Xd)||i){var e=this.za;if(e){var r=e.props[kr];if(X(r)&&!i)return this.Xd=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",timestampMode:"query",callback:i=>{if(Hl(this._instance)){var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return 0===r?i.error||ql.warn(s):ql.error(s),void t([],{isLoaded:!1,error:s})}var n=X(i.json.product_tours)?i.json.product_tours:[];this.Xd=n,e&&e.register({[kr]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Xd,{isLoaded:!0})}getActiveProductTours(t){ot(this.Yd)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Yd.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.Yd)||i.showTourById(t)}previewTour(t){this.Yd?this.Yd.previewTour(t):this._s((()=>{var i;this.tv(),null==(i=this.Yd)||i.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Yd)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Yd)||t.nextStep()}previousStep(){var t;null==(t=this.Yd)||t.previousStep()}clearCache(){var t;this.Xd=null,null==(t=this.za)||t.unregister(kr)}resetTour(t){var i;null==(i=this.Yd)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.Yd)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.Yd)||i.cancelPendingTour(t)}}},Ph),Ih={siteApps:class{constructor(t){this.ev=0,this._instance=t,this.iv=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}rv(t,i){if(i){var e=this.globalsForEvent(i);this.iv.push(e),this.iv.length>1e3&&(this.iv=this.iv.slice(10))}}get siteAppLoaders(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.rv.bind(this));this.nv=()=>{t(),this.iv=[],this.nv=void 0}}}globalsForEvent(t){var i,e,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},h=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var d of Object.entries(u)){var v=d[0];l[v]={id:h[v],type:v,properties:d[1]}}var c=t.$set_once,f=t.$set;return{event:g({},_(t,Vl),{properties:g({},t.properties,f?{$set:g({},null!==(i=null==(e=t.properties)?void 0:e.$set)&&void 0!==i?i:{},f)}:{},c?{$set_once:g({},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}}sv(t){var i,e=null==(i=t.tagName)?void 0:i.toLowerCase();return"style"===e&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(Wl.error("prepare_external_dependency_stylesheet returned null"),null):"script"===e&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(Wl.error("prepare_external_dependency_script returned null"),null):t}av(){var t,i,e,s,n,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var h=null==r?void 0:r.defaultView,u=null==h||null==(t=h.Node)?void 0:t.prototype;if(!h||!u)return()=>{};if(this.ev++,this.ov)return this.lv();var d=[],v=this,c=new WeakSet,f=(t,i,e)=>{if(null!=t&&t[i]){var r=t[i];t[i]=e(r),d.push((()=>{t[i]=r}))}},p=t=>{if(c.has(t))return t;var i=v.sv(t);return i&&c.add(i),i},g=t=>t.map((t=>"string"==typeof t?t:p(t))).filter((t=>!nt(t)));return f(u,"appendChild",(t=>function(i){var e=p(i);return e?t.call(this,e):i})),f(u,"insertBefore",(t=>function(i,e){var r=p(i);return r?t.call(this,r,e):i})),f(u,"replaceChild",(t=>function(i,e){var r=p(i);return r?t.call(this,r,e):e})),[null==(i=h.Element)?void 0:i.prototype,null==(e=h.Document)?void 0:e.prototype,null==(s=h.DocumentFragment)?void 0:s.prototype].forEach((t=>{f(t,"append",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))})),f(t,"prepend",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))}))})),[null==(n=h.Element)?void 0:n.prototype,null==(o=h.CharacterData)?void 0:o.prototype,null==(a=h.DocumentType)?void 0:a.prototype].forEach((t=>{f(t,"before",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))})),f(t,"after",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))})),f(t,"replaceWith",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];var s=g(e);return e.length&&!s.length?void 0:t.apply(this,s)}))})),f(null==(l=h.Element)?void 0:l.prototype,"insertAdjacentElement",(t=>function(i,e){var r=p(e);return r?t.call(this,i,r):null})),this.ov=()=>{d.forEach((t=>t())),this.ov=void 0},this.lv()}lv(){var t=!1;return()=>{var i;t||(t=!0,this.ev--,0===this.ev&&(null==(i=this.ov)||i.call(this)))}}uv(t,i){void 0===i&&(i=!0);var e=this.av();try{var r=t(e);return i&&e(),r}catch(t){throw e(),t}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;!i.errored&&this.iv.length&&(Wl.info("Processing "+this.iv.length+" events for site app with id "+t.id),this.iv.forEach((t=>this.uv((()=>null==i.processEvent?void 0:i.processEvent(t))))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(e=this.nv)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,Wl.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var n=this.uv((i=>t.init({posthog:this._instance,callback(t){i(),s(t)}})),!1).processEvent;n&&(i.processEvent=n),r=!0}catch(i){Wl.error(Gl+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){Wl.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}hv(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}dv(t){var i=this;if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t),r=function(r){try{i.uv((()=>null==r.processEvent?void 0:r.processEvent(e)))}catch(i){Wl.error("Error while processing event "+t.event+" for site app "+r.id,i)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.hv(),void this._instance.on("eventCaptured",(t=>this.dv(t)))):void Wl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.nv)||e.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var o=function(){var t,i=a.id,e=a.url;v["__$$ph_site_app_"+i]=s._instance,null==(t=v.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,e,(t=>{if(t)return Wl.error(Gl+i,t)}))};for(var a of n.siteApps)o()}else Wl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Mh={tracingHeaders:class{constructor(t){this.vv=void 0,this.fv=void 0,this.pv=void 0,this.Id=()=>{var t,i,e=this.gv();e?(et(this.vv)&&(this.vv=null==(t=v.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),et(this.fv)&&(this.fv=null==(i=v.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)?void 0:i._patchFetch(e,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Od()},this._instance=t}initialize(){this.startIfEnabledOrStop()}_s(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.tracingHeadersPatchFns?t():null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return Cl.error("failed to load script",i);t()}))}mv(){var t,i;return null!==(t=null!==(i=this._instance.config.tracing_headers)&&void 0!==i?i:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}gv(){var t=this.mv();return X(t)?(X(this.pv)?this.pv.splice(0,this.pv.length,...t):this.pv=[...t],t.length>0?this.pv:void 0):(X(this.pv)&&this.pv.splice(0),this.pv=t||void 0,this.pv)}Od(){var t,i;null==(t=this.vv)||t.call(this),null==(i=this.fv)||i.call(this),this.vv=void 0,this.fv=void 0}startIfEnabledOrStop(){this.gv()?this._s(this.Id):this.Od()}}},Ah=g({surveys:class extends Ql{constructor(t){var i;super(new rh(t),{get projectToken(){return i.config.token},kv:new eh(i=t)}),this._instance=t}Nl(t,i){var e=i.query?da(t,i.query):t;return new Promise((t=>{var r;this._instance._send_request({method:i.method,url:this._instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",e),data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,timestampMode:i.sentAt,callback:t})}))}}},Ph),Oh={toolbar:class{constructor(t){this.instance=t}yv(t){v.ph_toolbar_state=t}bv(){var t;return null!==(t=v.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i,e,s){if(void 0===i&&(i=void 0),void 0===e&&(e=void 0),void 0===s&&(s=void 0),hs(this.instance.config))return!1;if(!t||!r)return!1;i=null!=i?i:t.location,s=null!=s?s:t.history;try{if(!e){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}e=null==t?void 0:t.localStorage}var n,o=sh||Vn(i.hash,"__posthog")||Vn(i.hash,"state"),a=o?rs((()=>JSON.parse(atob(decodeURIComponent(o)))))||rs((()=>JSON.parse(decodeURIComponent(o)))):null;return a&&"ph_authorize"===a.action?((n=a).source="url",n&&Object.keys(n).length>0&&(a.desiredHash?i.hash=a.desiredHash:s?s.replaceState(s.state,"",i.pathname+i.search):i.hash="")):((n=JSON.parse(e.getItem(nh)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(t){return!1}}_v(t){var i=v.ph_load_toolbar||v.ph_load_editor;!ot(i)&&Z(i)?i(t,this.instance):oh.warn("No toolbar load function found")}loadToolbar(i){var e=!(null==r||!r.getElementById(Ns));if(!t||e)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=g({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(nh,JSON.stringify(g({},n,{source:void 0}))),2===this.bv())this._v(n);else if(0===this.bv()){var o;this.yv(1),null==(o=v.__PosthogExtensions__)||null==o.loadExternalDependency||o.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return oh.error("[Toolbar] Failed to load",t),void this.yv(0);this.yv(2),this._v(n)})),ls(t,"turbolinks:load",(()=>{this.yv(0),this.loadToolbar(n)}))}return!0}wv(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}},Dh=g({experiments:bh},Ph),jh={conversations:class{constructor(t){this.Sv=void 0,this._conversationsManager=null,this.xv=!1,this.Me=null,this.Cv=!1,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.Tv=t.ok,t.ok)){var i=t.config.conversations;ot(i)||(ht(i)?this.Sv=i:(this.Sv=i.enabled,this.Me=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Sv=void 0,this.Me=null,this.Tv=void 0,this.Cv=!1}loadIfEnabled(){if(!(this._conversationsManager||this.xv||this._instance.config.disable_conversations||hs(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==v?void 0:v.__PosthogExtensions__;if(t&&!et(this.Sv)&&this.Sv)if(this.Me&&this.Me.token){this.xv=!0;try{var i=t.initConversations;if(i)return this.Mv(i),void(this.xv=!1);var e=t.loadExternalDependency;if(!e)return void this.Ev(zr);e(this._instance,"conversations",(i=>{i||!t.initConversations?this.Ev("Could not load conversations script",i):this.Mv(t.initConversations),this.xv=!1}))}catch(t){this.Ev("Error initializing conversations",t),this.xv=!1}}else wh.error("Conversations enabled but missing token in remote config.")}}Mv(t){if(this.Me)try{this._conversationsManager=t(this.Me,this._instance),this.Cv=!1,wh.info("Conversations loaded successfully")}catch(t){this.Ev("Error completing conversations initialization",t)}else wh.error("Cannot complete initialization: remote config is null")}Ev(t,i){wh.error(t,i),this._conversationsManager=null,this.xv=!1,this.Cv=!0}show(){this._conversationsManager?this._conversationsManager.show():wh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Sv&&!nt(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":hs(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Tv?"remote_config_failed":et(this.Sv)?this.Tv?"disabled_in_project":"remote_config_pending":this.Sv?ot(this.Me)||!this.Me.token?"missing_token":null!=v&&v.__PosthogExtensions__?this.xv?"initializing":this.Cv?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var r=this;return p((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,i,e):(wh.warn(xh),null)}))()}getMessages(t,i){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(wh.warn(xh),null)}))()}markAsRead(t){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(wh.warn(xh),null)}))()}getTickets(t){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(wh.warn(xh),null)}))()}requestRestoreLink(t){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(wh.warn(xh),null)}))()}restoreFromToken(t){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(wh.warn(xh),null)}))()}restoreFromUrlToken(){var t=this;return p((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(wh.warn(xh),null)}))()}getCurrentTicketId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}Sl(){var t;null==(t=this._conversationsManager)||t.setIdentity()}xl(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},Lh={logs:class{constructor(i){var e,r=this;this.Iv=!1,this.Rv=!1,this.I=Ie("[logs]"),this.Pv=g({},this.I,{error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];i.some($h)||r.I.error(...i)}}),this.ka=[],this.Av=[],this.ph=0,this.Fv=()=>{var t,i;this.ph=0,null==(t=this.Lv)||t.onReconnect(),null==(i=this.Ov)||i.onReconnect()},this._instance=i,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.Iv=!0),t&&ls(t,"online",this.Fv)}Dv(t,i,e,r){var s,n=function(t,i){var e,r,s,n,o,a,l,h=null!==(e=null==t?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3,u=null!==(r=null==t?void 0:t.maxBufferSize)&&void 0!==r?r:100,d=null!=i&&i.consoleCapture?void 0:null!==(s=null==t?void 0:t.maxLogsPerInterval)&&void 0!==s?s:1e3,v=et(d)?Math.max(u,2048):Math.max(u,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==i?void 0:i.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:h,maxBufferSize:u,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:h,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,e);return[new Vi(this.$v(t,i),n,this.Pv,(()=>this.Nv()),(t=>t()),void 0,r),n]}qv(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Lv||this.jv!==i){var e;null==(e=this.Lv)||e.reset(),this.jv=i;var r=this.Dv((()=>this.ka),(t=>{this.ka=t}));this.Lv=r[0],this.Bv=r[1]}return this.Lv}Hv(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Ov||this.Uv!==i){var e;null==(e=this.Ov)||e.reset(),this.Uv=i;var r=this.Dv((()=>this.Av),(t=>{this.Av=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Sh);this.Ov=r[0],this.zv=r[1]}return this.Ov}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var i;if(t.ok){var e=null==(i=t.config.logs)?void 0:i.captureConsoleLogs;!ot(e)&&e&&(this.Iv=!0,this.loadIfEnabled())}}reset(){var t,i;this.ka=[],null==(t=this.Lv)||t.reset(),this.Av=[],null==(i=this.Ov)||i.reset(),this.ph=0}captureLog(t){this.qv().captureLog(t)}vi(t){this.Hv().captureLog(t)}get logger(){return this.Wv||(this.Wv={trace:(t,i)=>this.captureLog({body:t,level:"trace",attributes:i}),debug:(t,i)=>this.captureLog({body:t,level:"debug",attributes:i}),info:(t,i)=>this.captureLog({body:t,level:"info",attributes:i}),warn:(t,i)=>this.captureLog({body:t,level:"warn",attributes:i}),error:(t,i)=>this.captureLog({body:t,level:"error",attributes:i}),fatal:(t,i)=>this.captureLog({body:t,level:"fatal",attributes:i})}),this.Wv}flushLogs(t){t?this.Vv(t):(this.Lv&&this.Lv.flush().catch((t=>this.Gv(t))),this.Ov&&this.Ov.flush().catch((t=>this.Gv(t))))}Gv(t){$h(t)||this.I.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Iv&&!this.Rv){var t=null==v?void 0:v.__PosthogExtensions__;if(t){var i=t.loadExternalDependency;i?i(this._instance,"logs",(i=>{var e;i||null==(e=t.logs)||!e.initializeLogs?this.I.error("Could not load logs script",i):(t.logs.initializeLogs(this._instance),this.Rv=!0)})):this.I.error(zr)}else this.I.error("PostHog Extensions not found.")}}$v(t,i){var e=this._instance;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},getPersistedProperty:i=>i===S.LogsQueue?t():void 0,setPersistedProperty(t,e){var r;t===S.LogsQueue&&i(null!==(r=e)&&void 0!==r?r:[])},Mn:t=>this.Mn(t),getLibraryId:()=>c.LIB_NAME,getLibraryVersion:()=>c.LIB_VERSION}}Mn(t){return new Promise((i=>{if(Wn(this.ph,3))i({kind:"fatal",error:Eh(void 0,"logs endpoint is unreachable, dropping batch")});else{var e=!1,r=t=>{e||(e=!0,clearTimeout(s),i(t))},s=setTimeout((()=>{this.I.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:Eh(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.Zv(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var i=t.statusCode;if(this.Qv(i),i>=200&&300>i)r({kind:"ok"});else if(413===i)r({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)r({kind:"fatal",error:new Error("logs request failed with status "+i)});else{var e;0===i?(t.error||this.I.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:Eh(t.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("logs request failed with status "+i)})}}})}}))}Qv(t){(0!==t||this._instance.__loaded)&&(this.ph=Gn(t,this.ph,3,(()=>this.I.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}Vv(t){this.ka.length>0&&this.Jv(t,this.ka,this.Bv,c.LIB_NAME,(t=>{this.ka=t})),this.Av.length>0&&this.Jv(t,this.Av,this.zv,Sh,(t=>{this.Av=t}))}Jv(t,i,e,r,s){if(0!==i.length){var n=i.map((t=>t.record));s([]);var o=Hi(n,qi(e,c.LIB_NAME,c.LIB_VERSION),r,c.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Zv(),data:o,compression:"best-available",batchKey:"logs",transport:t})}}Zv(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Nv(){var t,i={};if(i.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var e=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=e.windowId,s=e.sessionStartTimestamp,n=e.lastActivityTimestamp;i.sessionId=e.sessionId,i.windowId=r,ot(s)||(i.sessionStartTimestamp=s),ot(n)||(i.lastActivityTimestamp=n)}if(null!=v&&null!=(t=v.location)&&t.href&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?Ci(v.location.href):v.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(i.activeFeatureFlags=o)}return i}}},Nh={metrics:class{constructor(t){this.I=Ie("[metrics]"),this._instance=t}initialize(){}qv(){var t,i,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.Lv&&this.jv===e||(null==(i=this.Lv)||i.reset(),this.jv=e,this.Lv=new Ji(this.$v(),function(t){var i,e,r,s,n,o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(i=null==o?void 0:o["service.name"])&&void 0!==i?i:null==t?void 0:t.serviceName,serviceVersion:null!==(e=null==o?void 0:o["service.version"])&&void 0!==e?e:null==t?void 0:t.serviceVersion,environment:null!==(r=null==o?void 0:o["deployment.environment"])&&void 0!==r?r:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(e),this.I)),this.Lv}count(t,i,e){void 0===i&&(i=1),this.qv().count(t,i,e)}gauge(t,i,e){this.qv().gauge(t,i,e)}histogram(t,i,e){this.qv().histogram(t,i,e)}flush(t){if(!this.Lv)return Promise.resolve();if(t){var i=this.Lv.drainWindow();return i&&this.Un(i,t),Promise.resolve()}return this.Lv.flush().catch((t=>this.I.error("PostHog metrics flush failed:",t)))}reset(){var t;null==(t=this.Lv)||t.reset()}$v(){var t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Un:t=>i.Un(t),getLibraryId:()=>c.LIB_NAME,getLibraryVersion:()=>c.LIB_VERSION}}Un(t,i){return new Promise((e=>{var r=!1,s=t=>{r||(r=!0,clearTimeout(n),e(t))},n=setTimeout((()=>s({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(g({method:"POST",url:this.Kv(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i},{fireCallbackOnDrop:!0,callback(t){var i=t.statusCode;if(i>=200&&300>i)s({kind:"ok"});else if(413===i)s({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)s({kind:"fatal",error:new Error("metrics request failed with status "+i)});else{var e;s({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("metrics request failed with status "+i)})}}}))}))}Kv(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Bh=g({},Ph,Th,Ch,Fh,Rh,Ih,Ah,Mh,Oh,Dh,jh,Lh,Nh);ml.__defaultExtensionClasses=g({},Bh),function(){c.SDK_DIST_CHANNEL="cdn";var i=v.posthog;if(!i||X(i._i)){var e=sl[vl]=new ml;if(i){var s=[];ts(i._i,(function(t){if(t&&X(t)){var r=e.init(t[0],t[1],t[2]),n=i[t[2]]||i;r.__loaded&&-1===s.indexOf(n)&&(s.push(n),r._execute_array.call(r.people,n.people),r._execute_array(n))}}))}e.__SV=1,v.posthog=e,function(){function i(){i.done||(i.done=!0,cl=!1,ts(sl,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?i():ls(r,"DOMContentLoaded",i,{capture:!1}):t&&Re.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,i="undefined"!=typeof globalThis?globalThis:t,e=null==i?void 0:i.navigator,r=null==i?void 0:i.document,s=null==i?void 0:i.location,n=null==i?void 0:i.fetch,o=null!=i&&i.XMLHttpRequest&&"withCredentials"in new i.XMLHttpRequest?i.XMLHttpRequest:void 0,a=null==i?void 0:i.AbortController,l=null==i?void 0:i.CompressionStream,h=null==e?void 0:e.userAgent;function u(){return!(!t||!1===t.navigator.onLine)}var d="undefined"!=typeof globalThis?globalThis:t;d&&"undefined"==typeof self&&(d.self=d),d&&"undefined"==typeof File&&(d.File=function(){});var v=null!=t?t:{},c={DEBUG:!1,LIB_VERSION:"0.5.2",LIB_NAME:"browser-common"};function f(t,i,e,r,s,n,o){try{var a=t[n](o),l=a.value}catch(t){return void e(t)}a.done?i(l):Promise.resolve(l).then(r,s)}function p(t){return function(){var i=this,e=arguments;return new Promise((function(r,s){var n=t.apply(i,e);function o(t){f(n,r,s,o,a,"next",t)}function a(t){f(n,r,s,o,a,"throw",t)}o(void 0)}))}}function g(){return g=Object.assign?Object.assign.bind():function(t){for(var i=1;arguments.length>i;i++){var e=arguments[i];for(var r in e)({}).hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t},g.apply(null,arguments)}function _(t,i){if(null==t)return{};var e={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(-1!==i.indexOf(r))continue;e[r]=t[r]}return e}var m=t=>{if("string"!=typeof t)return t;try{return JSON.parse(t)}catch(i){return t}};function y(t){return"string"==typeof t||t}function b(t){return"string"==typeof t?t:void 0}var w,x=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],S=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.AiQueue="ai_queue",t.AiCaptureQueue="ai_capture_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.PushRegistered="push_registered",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}({}),k=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),E=["$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"],P=["token"],T="NativeGzipValidationError",C=t=>t.length>=2&&31===t[0]&&139===t[1],F=(t,i)=>t===k.GZipJS||i===k.GZipJS||"gzip"===i,R=t=>!(!t||"object"!=typeof t)&&"NotReadableError"===("name"in t?String(t.name):""),I=t=>{var i=new Error("Native gzip produced invalid output: "+t);throw i.name=T,i},M=function(){var t=p((function*(t,i){18>t.size&&I("too-short");var e=new Uint8Array(yield t.slice(0,10).arrayBuffer());C(e)&&8===e[2]||I("invalid-header");var r=new DataView(yield t.slice(t.size-8).arrayBuffer());r.getUint32(0,!0)!==(t=>{for(var i=(()=>{if(w)return w;w=[];for(var t=0;256>t;t++){for(var i=t,e=0;8>e;e++)i=1&i?3988292384^i>>>1:i>>>1;w[t]=i>>>0}return w})(),e=4294967295,r=0;t.length>r;r++)e=i[255&(e^t[r])]^e>>>8;return(4294967295^e)>>>0})(i)&&I("invalid-crc");var s=i.length>>>0;r.getUint32(4,!0)!==s&&I("invalid-size")}));return function(i,e){return t.apply(this,arguments)}}();function A(){return A=p((function*(t,i,e){void 0===i&&(i=!0);try{var r=(new TextEncoder).encode(t),s=new globalThis.CompressionStream("gzip"),n=s.writable.getWriter(),o=n.write(r).then((()=>n.close())).catch(function(){var t=p((function*(t){try{yield n.abort(t)}catch(t){}throw t}));return function(i){return t.apply(this,arguments)}}()),a=new Response(s.readable).blob(),l=(yield Promise.all([a,o]))[0];return yield M(l,r),l}catch(t){if(null!=e&&e.rethrow)throw t;return i&&console.error("Failed to gzip compress data",t),null}})),A.apply(this,arguments)}var O=20,D=1e3,j=1e4,L="[Circular]",N="[Truncated]",B="[Unserializable]",z="[Function]";function U(t){for(var i="",e=0;t.length>e;e++){var r=t.charCodeAt(e);if(55296>r||r>56319)i+=56320>r||r>57343?t[e]:"�";else{var s=t.charCodeAt(e+1);56320>s||s>57343?i+="�":(i+=t[e]+t[e+1],e++)}}return i}var q=["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"],H=function(t,i){if(void 0===i&&(i=[]),!t)return!1;var e=t.toLowerCase();return q.concat(i).some((t=>{var i=t.toLowerCase();return-1!==e.indexOf(i)}))};function V(t,i){return-1!==t.indexOf(i)}var W=function(t){return t.trim()},G=function(t){return t.replace(/^\$/,"")};function K(t){var i,e=[];return null!==(i=JSON.stringify(t,(function(t,i){if("bigint"==typeof i)return i.toString();if("function"!=typeof i&&"symbol"!=typeof i){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&"object"==typeof i){for(;e.length>0&&e[e.length-1]!==this;)e.pop();if(e.includes(i))return"[Circular]";e.push(i)}return i}})))&&void 0!==i?i:"null"}var J=Object.prototype,Y=J.hasOwnProperty,Q=J.toString,X=Array.isArray||function(t){return"[object Array]"===Q.call(t)},Z=t=>"function"==typeof t,tt=t=>t===Object(t)&&!X(t),it=t=>{if(tt(t)){for(var i in t)if(Y.call(t,i))return!1;return!0}return!1},et=t=>void 0===t,rt=t=>"[object String]"==Q.call(t),st=t=>rt(t)&&0===t.trim().length,nt=t=>null===t,ot=t=>et(t)||nt(t),at=t=>"[object Number]"==Q.call(t)&&t==t,lt=t=>at(t)&&t>0,ht=t=>"[object Boolean]"===Q.call(t),ut=t=>t instanceof FormData,dt=t=>V(E,t),vt=t=>V(P,t);function ct(t){return null===t||"object"!=typeof t}function ft(t,i){return{}.toString.call(t)==="[object "+i+"]"}function pt(t){switch({}.toString.call(t)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return _t(t,Error)}}function gt(t){return"undefined"!=typeof Event&&_t(t,Event)}function _t(t,i){try{return t instanceof i}catch(t){return!1}}var mt=[!0,"true",1,"1","yes"],yt=t=>V(mt,t),bt=[!1,"false",0,"0","no"];function wt(t,i,e,r,s){return i>e&&(r.warn("min cannot be greater than max."),i=e),at(t)?t>e?(r.warn(" cannot be greater than max: "+e+". Using max value instead."),e):i>t?(r.warn(" cannot be less than min: "+i+". Using min value instead."),i):t:(r.warn(" must be a number. using max or fallback. max: "+e+", fallback: "+s),wt(s||e,i,e,r))}class xt{constructor(t){this.k={},this.S=t.S,this.C=wt(t.bucketSize,0,100,t.I),this.R=wt(t.refillRate,0,this.C,t.I),this.A=wt(t.refillInterval,0,864e5,t.I)}O(t,i){var e=Math.floor((i-t.lastAccess)/this.A);e>0&&(t.tokens=Math.min(t.tokens+e*this.R,this.C),t.lastAccess=t.lastAccess+e*this.A)}consumeRateLimit(t){var i,e=Date.now(),r=String(t),s=this.k[r];return s?this.O(s,e):this.k[r]=s={tokens:this.C,lastAccess:e},0===s.tokens||(s.tokens--,0===s.tokens&&(null==(i=this.S)||i.call(this,t)),0===s.tokens)}stop(){this.k={}}}var St="Mobile",kt="iOS",Et="Android",$t="Tablet",Pt=Et+" "+$t,Tt="iPad",Ct="Apple",Ft=Ct+" Watch",Rt="Safari",It="BlackBerry",Mt="Samsung",At=Mt+"Browser",Ot=Mt+" Internet",Dt="Chrome",jt=Dt+" OS",Lt=Dt+" "+kt,Nt="Internet Explorer",Bt=Nt+" "+St,zt="Opera",Ut=zt+" Mini",qt="Edge",Ht="Microsoft "+qt,Vt="Firefox",Wt=Vt+" "+kt,Gt="Nintendo",Kt="PlayStation",Jt="Xbox",Yt=Et+" "+St,Qt=St+" "+Rt,Xt="Windows",Zt=Xt+" Phone",ti="Nokia",ii="Ouya",ei="Generic",ri=ei+" "+St.toLowerCase(),si=ei+" "+$t.toLowerCase(),ni="Konqueror",oi="Oculus Browser",ai="Vivaldi",li="Yandex",hi="Whale",ui="DuckDuckGo",di="Pale Moon",vi="Waterfox",ci="Brave",fi="Google Search App",pi="(\\d+(\\.\\d+)?)",gi=new RegExp("Version/"+pi),_i=new RegExp(Jt,"i"),mi=new RegExp(Kt+" \\w+","i"),yi=new RegExp(Gt+" \\w+","i"),bi=new RegExp(It+"|PlayBook|BB10","i"),wi={"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"},xi=function(t,i,e,r){i=i||"";var s=function(t){return null!=t&&t.brave?ci:null}(e);return s||(null!=r&&r.detectGoogleSearchApp&&V(t,"GSA/")?fi:V(t," OPR/")&&V(t,"Mini")?Ut:V(t," OPR/")?zt:bi.test(t)?It:V(t,"IE"+St)||V(t,"WPDesktop")?Bt:V(t,"OculusBrowser")?oi:V(t,At)?Ot:V(t,qt)||V(t,"Edg/")?Ht:V(t,ai+"/")?ai:V(t,"YaBrowser/")?li:V(t,hi+"/")?hi:V(t,ui+"/")||V(t,"Ddg/")?ui:V(t,"FBIOS")?"Facebook "+St:V(t,"UCWEB")||V(t,"UCBrowser")?"UC Browser":V(t,"CriOS")?Lt:V(t,"CrMo")||V(t,Dt)?Dt:V(t,Et)&&V(t,Rt)?Yt:V(t,"FxiOS")?Wt:V(t.toLowerCase(),ni.toLowerCase())?ni:V(t,ci+"/")?ci:((t,i)=>i&&V(i,Ct)||function(t){return V(t,Rt)&&!V(t,Dt)&&!V(t,Et)}(t))(t,i)?V(t,St)?Qt:Rt:V(t,"PaleMoon/")?di:V(t,vi+"/")?vi:V(t,Vt)?Vt:V(t,"MSIE")||V(t,"Trident/")?Nt:V(t,"Gecko")?Vt:"")},Si={[Bt]:[new RegExp("rv:"+pi)],[Ht]:[new RegExp(qt+"?\\/"+pi)],[Dt]:[new RegExp("("+Dt+"|CrMo)\\/"+pi)],[Lt]:[new RegExp("CriOS\\/"+pi)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+pi)],[Rt]:[gi],[Qt]:[gi],[zt]:[new RegExp("(Opera|OPR)\\/"+pi)],[Vt]:[new RegExp(Vt+"\\/"+pi)],[Wt]:[new RegExp("FxiOS\\/"+pi)],[ni]:[new RegExp("Konqueror[:/]?"+pi,"i")],[It]:[new RegExp(It+" "+pi),gi],[Yt]:[new RegExp("android\\s"+pi,"i")],[Ot]:[new RegExp(At+"\\/"+pi)],[oi]:[new RegExp("OculusBrowser\\/"+pi)],[ai]:[new RegExp(ai+"\\/"+pi)],[li]:[new RegExp("YaBrowser\\/"+pi)],[hi]:[new RegExp(hi+"\\/"+pi)],[ci]:[new RegExp(ci+"\\/"+pi)],[ui]:[new RegExp("(DuckDuckGo|Ddg)\\/"+pi)],[di]:[new RegExp("PaleMoon\\/"+pi)],[vi]:[new RegExp(vi+"\\/"+pi)],[fi]:[new RegExp("GSA\\/"+pi)],[Nt]:[new RegExp("(rv:|MSIE )"+pi)],Mozilla:[new RegExp("rv:"+pi)]},ki=function(t,i,e,r){var s=xi(t,i,e,r),n=Si[s];if(et(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},Ei=[[new RegExp(Jt+"; "+Jt+" (.*?)[);]","i"),t=>[Jt,t&&t[1]||""]],[new RegExp(Gt,"i"),[Gt,""]],[new RegExp(Kt,"i"),[Kt,""]],[bi,[It,""]],[new RegExp(Xt,"i"),(t,i)=>{if(/Phone/.test(i)||/WPDesktop/.test(i))return[Zt,""];if(new RegExp(St).test(i)&&!/IEMobile\b/.test(i))return[Xt+" "+St,""];var e=/Windows NT ([0-9.]+)/i.exec(i);if(e&&e[1]){var r=wi[e[1]]||"";return/arm/i.test(i)&&(r="RT"),[Xt,r]}return[Xt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[kt,[t[3],t[4],t[5]||"0"].join(".")]:[kt,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var i="";return t&&t.length>=3&&(i=et(t[2])?t[3]:t[2]),["watchOS",i]}],[new RegExp("("+Et+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Et+")","i"),t=>t&&t[2]?[Et,[t[2],t[3],t[4]||"0"].join(".")]:[Et,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var i=["Mac OS X",""];return t&&t[1]&&(i[1]=[t[1],t[2],t[3]||"0"].join(".")),i}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[jt,""]],[/Linux|debian/i,["Linux",""]]],$i=function(t){return yi.test(t)?Gt:mi.test(t)?Kt:_i.test(t)?Jt:new RegExp(ii,"i").test(t)?ii:new RegExp("("+Zt+"|WPDesktop)","i").test(t)?Zt:/iPad/.test(t)?Tt:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Ft:bi.test(t)?It:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(ti,"i").test(t)?ti:/(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(St).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Et:Pt:new RegExp("(pda|"+St+")","i").test(t)?ri:new RegExp($t,"i").test(t)&&!new RegExp($t+" pc","i").test(t)?si:""},Pi=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function Ti(t,i){return"string"==typeof(e=t)&&Pi.test(e)?t:i();var e}function Ci(t){return t?t.split("#")[0]:t}function Fi(t,i){var e=setTimeout(t,i);return(null==e?void 0:e.unref)&&(null==e||e.unref()),e}function Ri(t,i,e){return Ii.apply(this,arguments)}function Ii(){return(Ii=p((function*(t,i,e){var r;try{return yield Promise.race([t,new Promise(((t,s)=>{r=Fi((()=>{try{null==e||e(),t()}catch(t){s(t)}}),i)}))])}finally{clearTimeout(r)}}))).apply(this,arguments)}var Mi={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}},Ai=Mi.info,Oi=0x8000000000000000,Di={}.propertyIsEnumerable;function ji(t,i){try{return Bi(t,i,{ancestors:new WeakSet,remainingNodes:j},0)}catch(t){return[]}}function Li(t,i,e,r){if(0>=e.remainingNodes)return{stringValue:N};if(e.remainingNodes--,ht(t))return{boolValue:t};if("number"==typeof t){if(!Number.isFinite(t))return{stringValue:String(t)};if(Number.isInteger(t)){if(Number.isSafeInteger(t))return{intValue:String(t)};if("undefined"==typeof BigInt)return{stringValue:String(t)};var s=BigInt(t).toString();return t>=Oi||-Oi>t?(null==i||i.debug("Attribute "+s+" is outside the int64 range; encoding it as a string"),{stringValue:s}):{intValue:s}}return{doubleValue:t}}if("string"==typeof t)return{stringValue:U(t)};if("function"==typeof t)return{stringValue:z};if("symbol"==typeof t)return{stringValue:String(t)};if("object"==typeof t&&null!==t){if(e.ancestors.has(t))return{stringValue:L};if(r>=O)return{stringValue:N};if(t instanceof Date){var n=t.getTime(),o=Number.isFinite(n)?t.toISOString():String(t);return{stringValue:"string"==typeof o?U(o):String(o)}}e.ancestors.add(t);try{try{var a=t.toJSON;if("function"==typeof a)return Li(a.call(t),i,e,r+1)}catch(t){}return X(t)?{arrayValue:{values:Ni(t,i,e,r+1)}}:{kvlistValue:{values:Bi(t,i,e,r+1)}}}finally{e.ancestors.delete(t)}}return{stringValue:U(String(t))}}function Ni(t,i,e,r){for(var s=[],n=Math.min(t.length,D),o=0;n>o&&e.remainingNodes>0;o++)try{var a=o in t?t[o]:void 0;if(ot(a))continue;s.push(Li(a,i,e,r))}catch(t){s.push({stringValue:B})}return t.length>o&&s.push({stringValue:N}),s}function Bi(t,i,e,r){var s=[];for(var n in t)if(Di.call(t,n)){if(s.length>=D||0>=e.remainingNodes){null==i||i.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{var o=t[n];if(nt(o)||et(o))continue;s.push({key:U(n),value:Li(o,i,e,r)})}catch(t){s.push({key:U(n),value:{stringValue:B}})}}return s}function zi(t){try{return U(String(t))}catch(t){return B}}function Ui(t,i,e){var r=Mi[t.level||"info"]||Ai,s=r.text,n=r.number,o=String(Date.now())+"000000",a={};i.distinctId&&(a.posthogDistinctId=i.distinctId),i.sessionId&&(a.sessionId=i.sessionId),i.windowId&&(a["window.id"]=i.windowId),ot(i.sessionStartTimestamp)||(a.sessionStartTimestamp=String(i.sessionStartTimestamp)),ot(i.lastActivityTimestamp)||(a.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(a["url.full"]=i.currentUrl),i.screenName&&(a["screen.name"]=i.screenName),i.appState&&(a["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(a.feature_flags=i.activeFeatureFlags);var l=g({},a),h=t.attributes;if(h){var u=[];try{u=Object.keys(h)}catch(t){u=[]}for(var d of u){var v=void 0;try{v=h[d]}catch(t){v=B}Object.defineProperty(l,d,{value:v,enumerable:!0,writable:!0,configurable:!0})}}var c={timeUnixNano:o,observedTimeUnixNano:o,severityNumber:n,severityText:s,body:{stringValue:zi(t.body)},attributes:ji(l,e)};return t.trace_id&&(c.traceId=t.trace_id),t.span_id&&(c.spanId=t.span_id),et(t.trace_flags)||(c.flags=t.trace_flags),c}function qi(t,i,e){return g({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":i,"telemetry.sdk.version":e})}function Hi(t,i,e,r){return{resourceLogs:[{resource:{attributes:ji(i)},scopeLogs:[{scope:{name:e,version:r},logRecords:t}]}]}}let Vi=class{constructor(t,i,e,r,s,n,o){var a;void 0===n&&(n=()=>Promise.resolve()),this._instance=t,this.qi=i,this.I=e,this.rn=r,this.nn=s,this.sn=n,this.an=o,this.ln=null,this.un=0,this.hn=0,this.dn=0,this.vn=0,this.cn=!1,this.fn=i.maxBufferSize,this.pn=Math.max(null!==(a=i.maxQueueSize)&&void 0!==a?a:i.maxBufferSize,i.maxBufferSize),this.gn=i.flushIntervalMs,this.mn=i.maxBatchRecordsPerPost,this.yn=i.rateCapWindowMs,this.bn=i.maxLogsPerInterval}reset(){this._n(),this.ln=null,this.dn=0,this.vn=0,this.cn=!1,this.un=0,this.hn=0,this.mn=this.qi.maxBatchRecordsPerPost}onReconnect(){this.hn=0,this.wn()}captureLog(t){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=t&&t.body){var i=this.kn(t);if(null!==i)if(i.body){if(this.Sn()){var e={record:Ui(i,this.rn(),this.I)};this.nn((()=>this.xn(e)))}}else this.I.info("Log was rejected in beforeSend function")}}kn(t){var i=this.qi.beforeSend;if(!i)return t;var e=X(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.I.info("Log was rejected in beforeSend function"),null;r=n}catch(t){return this.I.error("Error in beforeSend function for log:",t),null}return r}Sn(){if(void 0===this.bn)return!0;var t=Date.now(),i=t-this.dn;return this.yn>i&&i>=0||(this.dn=t,this.vn=0,this.cn=!1),this.bn>this.vn?(this.vn++,!0):(this.cn||(this.I.warn("captureLog dropping logs: exceeded "+this.bn+" logs per "+this.yn+"ms"),this.cn=!0),!1)}flush(){var t=this;return p((function*(){if(!t._instance.isDisabled)return t.ln||(t.ln=t.Cn().finally((()=>{t.ln=null}))),t.ln}))()}Cn(){var t=this;return p((function*(){var i;t._n();var e=null!==(i=t._instance.getPersistedProperty(S.LogsQueue))&&void 0!==i?i:[];if(0!==e.length)for(var r=e.length,s=0;e.length>0&&r>s;){var n,o;t.un=0;var a=Math.min(e.length,t.mn),l=e.slice(0,a),h=Hi(l.map((t=>t.record)),t.Tn(),null!==(n=t.an)&&void 0!==n?n:t._instance.getLibraryId(),t._instance.getLibraryVersion()),u=yield t._instance.Mn(h);if("too-large"===u.kind&&l.length>1)t.mn=Math.max(1,Math.floor(l.length/2)),t.I.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+t.mn);else{if("retry-later"===u.kind)throw u.error;if("too-large"===u.kind?t.I.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===u.kind&&t.qi.maxBatchRecordsPerPost>t.mn&&(t.mn=Math.min(t.qi.maxBatchRecordsPerPost,t.mn+1)),yield t.En(l.length),e=null!==(o=t._instance.getPersistedProperty(S.LogsQueue))&&void 0!==o?o:[],s+=l.length,"fatal"===u.kind)throw u.error}}}))()}En(t){var i=this;return p((function*(){var e,r=Math.max(0,t-i.un),s=null!==(e=i._instance.getPersistedProperty(S.LogsQueue))&&void 0!==e?e:[];i._instance.setPersistedProperty(S.LogsQueue,s.slice(r)),yield i.sn()}))()}Tn(){return qi(this.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion())}xn(t){var i;if(!this._instance.optedOut){var e=null!==(i=this._instance.getPersistedProperty(S.LogsQueue))&&void 0!==i?i:[];this.pn>e.length||(e.shift(),this.un++,this.I.info("Logs queue is full, dropping oldest record.")),e.push(t),this._instance.setPersistedProperty(S.LogsQueue,e),this.fn>e.length?this.In():this.wn()}}In(t){void 0===t&&(t=this.gn),this.Rn||(this.Rn=Fi((()=>{this.Rn=void 0,this.wn()}),t))}Pn(){var t=Math.min(Math.max(0,this.hn-1),6);return this.gn*Math.pow(2,t)}An(){var t=this._instance.getPersistedProperty(S.LogsQueue);return!!t&&t.length>0}shutdown(t){var i=this;return p((function*(){i._n();var e=i.flush().catch((()=>{}));void 0!==t?yield Ri(e,t):yield e}))()}flushWithTimeout(t){var i=this;return p((function*(){var e=i.flush();yield Ri(e,t,(()=>{e.catch((()=>{}))}))}))()}wn(){this.flush().then((()=>{this.hn=0}),(t=>{this.hn++,this.I.error("PostHog logs flush failed:",t)})).finally((()=>{!this._instance.isDisabled&&this.An()&&this.In(this.Pn())}))}_n(){this.Rn&&(clearTimeout(this.Rn),this.Rn=void 0)}};var Wi=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Gi(t){return String(t)+"000000"}function Ki(t,i,e,r){var s="";return r&&(s=Object.keys(r).sort().map((t=>JSON.stringify(t)+":"+JSON.stringify(r[t]))).join(",")),t+"\0"+i+"\0"+(null!=e?e:"")+"\0"+s}let Ji=class{constructor(t,i,e){this._instance=t,this.qi=i,this.I=e,this.Fn=new Map,this.ln=null,this.Ln=!1,this.On=new Map,this.Dn=new Set,this.$n=0}count(t,i,e){void 0===i&&(i=1),this.Nn({name:t,type:"count",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}gauge(t,i,e){this.Nn({name:t,type:"gauge",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}histogram(t,i,e){this.Nn({name:t,type:"histogram",value:i,unit:null==e?void 0:e.unit,attributes:null==e?void 0:e.attributes})}flush(){var t=this,i=this.ln,e=function(){var e=p((function*(){i&&(yield i.catch((()=>{}))),yield t.qn()}));return function(){return e.apply(this,arguments)}}(),r=e().finally((()=>{this.ln===r&&(this.ln=null)}));return this.ln=r,r}drainWindow(){if(0===this.Fn.size)return null;var t=this.Fn;return this.Fn=new Map,this.Ln=!1,this.On=new Map,this.Dn=new Set,this.jn(t)}reset(){this.$n++,this._n(),this.Fn=new Map,this.ln=null,this.Ln=!1,this.On=new Map,this.Dn=new Set}Nn(t){if(!this._instance.isDisabled&&!this._instance.optedOut){var i=this.kn(t);if(null!==i)if(i.name&&"string"==typeof i.name)if("number"==typeof i.value&&Number.isFinite(i.value))if("count"===i.type&&0>i.value)this.I.warn("Dropping count '"+i.name+"': counters are monotonic, value must be >= 0");else{var e,r;try{e=i.attributes?g({},i.attributes):void 0,r=Ki(i.type,i.name,i.unit,e)}catch(t){return void this.I.warn("Dropping metric '"+i.name+"': attributes could not be serialized",t)}var s=this.Fn.get(r);if(!s){if(!this.Bn())return;s={name:i.name,type:i.type,unit:i.unit,attributes:e,windowStartMs:Date.now()},this.Fn.set(r,s)}var n=this.On.get(i.name);void 0===n?this.On.set(i.name,i.type):n===i.type||this.Dn.has(i.name)||(this.Dn.add(i.name),this.I.warn("Metric name '"+i.name+"' is already used as a "+n+"; recording it as a "+i.type+" too will blend both series in charts. Use a distinct name.")),this.Hn(s,i.value),this.In()}else this.I.warn("Dropping metric '"+i.name+"': value must be a finite number");else this.I.warn("Dropping metric with empty name")}}Bn(){return this.qi.maxSeriesPerFlush>this.Fn.size||(this.Ln||(this.Ln=!0,this.I.warn("Metric series cap reached ("+this.qi.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Hn(t,i){var e;switch(t.type){case"count":t.total=(null!==(e=t.total)&&void 0!==e?e:0)+i;break;case"gauge":t.last=i;break;case"histogram":t.hist||(t.hist={count:0,sum:0,min:i,max:i,bucketCounts:new Array(Wi.length+1).fill(0)});var r=t.hist;r.count+=1,r.sum+=i,r.min=Math.min(r.min,i),r.max=Math.max(r.max,i),r.bucketCounts[function(t,i){for(var e=0;i.length>e;e++)if(i[e]>=t)return e;return i.length}(i,Wi)]+=1}}kn(t){var i=this.qi.beforeSend;if(!i)return t;var e=X(i)?i:[i],r=t;for(var s of e)try{var n=s(r);if(!n)return this.I.info("Metric was rejected in beforeSend function"),null;r=n}catch(t){return this.I.error("Error in beforeSend function for metric:",t),null}return r}In(){this.Rn||(this.Rn=Fi((()=>{this.Rn=void 0,this.flush().catch((t=>{this.I.error("Metrics flush failed:",t)}))}),this.qi.flushIntervalMs))}_n(){this.Rn&&(clearTimeout(this.Rn),this.Rn=void 0)}qn(){var t=this;return p((function*(){if(0!==t.Fn.size){var i=t.Fn;t.Fn=new Map,t.Ln=!1,t.On=new Map,t.Dn=new Set;var e=t.$n,r=yield t._instance.Un(t.jn(i));if(e===t.$n)switch(r.kind){case"ok":return;case"retry-later":return t.zn(i),void t.In();case"too-large":return void t.I.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void t.I.error("Failed to send metrics batch:",r.error)}}}))()}jn(t){return i=this.Wn(t),e=function(t,i,e){return g({},t.resourceAttributes,{"service.name":t.serviceName||"unknown_service"},t.environment&&{"deployment.environment":t.environment},t.serviceVersion&&{"service.version":t.serviceVersion},{"telemetry.sdk.name":i,"telemetry.sdk.version":e})}(this.qi,this._instance.getLibraryId(),this._instance.getLibraryVersion()),r=this._instance.getLibraryId(),s=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:ji(e)},scopeMetrics:[{scope:{name:r,version:s},metrics:i}]}]};var i,e,r,s}Wn(t){var i=Gi(Date.now()),e=new Map;for(var r of t.values()){var s,n=Ki(r.type,r.name,r.unit,void 0),o=e.get(n);o||(o=g({name:r.name},r.unit&&{unit:r.unit}),"count"===r.type?o.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===r.type?o.gauge={dataPoints:[]}:o.histogram={aggregationTemporality:1,dataPoints:[]},e.set(n,o));var a=ji(null!==(s=r.attributes)&&void 0!==s?s:{},this.I),l=Gi(r.windowStartMs);if("count"===r.type){var h,u={attributes:a,startTimeUnixNano:l,timeUnixNano:i,asDouble:null!==(h=r.total)&&void 0!==h?h:0};o.sum.dataPoints.push(u)}else if("gauge"===r.type){var d,v={attributes:a,timeUnixNano:i,asDouble:null!==(d=r.last)&&void 0!==d?d:0};o.gauge.dataPoints.push(v)}else r.hist&&o.histogram.dataPoints.push({attributes:a,startTimeUnixNano:l,timeUnixNano:i,count:r.hist.count,sum:r.hist.sum,min:r.hist.min,max:r.hist.max,bucketCounts:r.hist.bucketCounts,explicitBounds:Wi})}return Array.from(e.values())}zn(t){var i,e;for(var r of t){var s=r[0],n=r[1],o=this.Fn.get(s);if(o)switch(o.windowStartMs=Math.min(o.windowStartMs,n.windowStartMs),o.type){case"count":o.total=(null!==(i=o.total)&&void 0!==i?i:0)+(null!==(e=n.total)&&void 0!==e?e:0);break;case"gauge":break;case"histogram":if(n.hist)if(o.hist){o.hist.count+=n.hist.count,o.hist.sum+=n.hist.sum,o.hist.min=Math.min(o.hist.min,n.hist.min),o.hist.max=Math.max(o.hist.max,n.hist.max);for(var a=0;o.hist.bucketCounts.length>a;a++)o.hist.bucketCounts[a]+=n.hist.bucketCounts[a]}else o.hist=n.hist}else this.Bn()&&this.Fn.set(s,n)}}};var Yi,Qi,Xi;function Zi(t){var i=globalThis._posthogChunkIds;if(i){var e=Object.keys(i);return Xi&&e.length===Qi||(Qi=e.length,Xi=e.reduce(((e,r)=>{Yi||(Yi={});var s=Yi[r];if(s)e[s[0]]=s[1];else for(var n=t(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,h=i[r];if(l&&h){e[l]=h,Yi[r]=[l,h];break}}return e}),{})),Xi}}class te{constructor(t,i,e){void 0===e&&(e=[]),this.coercers=t,this.stackParser=i,this.modifiers=e}buildFromUnknown(t,i){void 0===i&&(i={});var e=i&&i.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(e,i,0).apply(t),s=this.buildParsingContext(i),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,e),$exception_level:"error"}}modifyFrames(t){var i=this;return p((function*(){for(var e of t)e.stacktrace&&e.stacktrace.frames&&X(e.stacktrace.frames)&&(e.stacktrace.frames=yield i.applyModifiers(e.stacktrace.frames));return t}))()}coerceFallback(t){var i;return{type:"Error",value:"Unknown error",stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}parseStacktrace(t,i){var e,r;return null!=t.cause&&(e=this.parseStacktrace(t.cause,i)),""!=t.stack&&null!=t.stack&&(r=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?i.skipFirstLines:0),i.chunkIdMap)),g({},t,{cause:e,stack:r})}applyChunkIds(t,i){return t.map((t=>(t.filename&&i&&(t.chunk_id=i[t.filename]),t)))}applyCoercers(t,i){for(var e of this.coercers)if(e.match(t))return e.coerce(t,i);return this.coerceFallback(i)}applyModifiers(t){var i=this;return p((function*(){var e=t;for(var r of i.modifiers)e=yield r(e);return e}))()}convertToExceptionList(t,i){var e,r,s,n={type:t.type,value:t.value,mechanism:{type:null!==(e=i.type)&&void 0!==e?e:"generic",handled:null===(r=i.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,g({},i,{handled:!0}))),o}buildParsingContext(t){var i;return{chunkIdMap:Zi(this.stackParser),skipFirstLines:null!==(i=t.skipFirstLines)&&void 0!==i?i:1}}buildCoercingContext(t,i,e){void 0===e&&(e=0);var r=(e,r)=>{if(4>=r){var s=this.buildCoercingContext(t,i,r);return this.applyCoercers(e,s)}};return g({},i,{syntheticException:0==e?i.syntheticException:void 0,mechanism:t,apply:t=>r(t,e),next:t=>r(t,e+1)})}}var ie="?";function ee(t,i,e,r,s){var n={platform:t,filename:i,function:"<anonymous>"===e?ie:e,in_app:!(null!=i&&i.startsWith("webkit-masked-url://"))&&"<anonymous>"!==i};return et(r)||(n.lineno=r),et(s)||(n.colno=s),n}var re=(t,i)=>{var e=-1!==t.indexOf("safari-extension"),r=-1!==t.indexOf("safari-web-extension");return e||r?[-1!==t.indexOf("@")?t.split("@")[0]:ie,e?"safari-extension:"+i:"safari-web-extension:"+i]:[t,i]},se=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ne=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,oe=/\((\S*)(?::(\d+))(?::(\d+))\)/,ae=(t,i)=>{var e=se.exec(t);if(e)return ee(i,e[1],ie,+e[2],+e[3]);var r=ne.exec(t);if(r){if(r[2]&&0===r[2].indexOf("eval")){var s=oe.exec(r[2]);s&&(r[2]=s[1],r[3]=s[2],r[4]=s[3])}var n=re(r[1]||ie,r[2]);return ee(i,n[1],n[0],r[3]?+r[3]:void 0,r[4]?+r[4]:void 0)}},le=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,he=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ue=(t,i)=>{var e=le.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var r=he.exec(e[3]);r&&(e[1]=e[1]||"eval",e[3]=r[1],e[4]=r[2],e[5]="")}var s=e[3],n=e[1]||ie,o=re(n,s);return ee(i,s=o[1],n=o[0],e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},de=/\(error: (.*)\)/;class ve{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,i){var e=rt(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:e?t.stack:void 0,cause:t.cause?i.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){var i=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?i+": "+t.message:i}isDOMException(t){return ft(t,"DOMException")}isDOMError(t){return ft(t,"DOMError")}}class ce{match(t){return pt(t)}coerce(t,i){var e,r=this.getStack(t),s=void 0===r;return{type:this.getType(t),value:this.getMessage(t,i),stack:null!=r?r:null==(e=i.syntheticException)?void 0:e.stack,cause:t.cause?i.next(t.cause):void 0,synthetic:s}}getType(t){return t.name||t.constructor.name}getMessage(t,i){var e=t.message;return String(e.error&&"string"==typeof e.error.message?e.error.message:e)}getStack(t){return t.stacktrace||t.stack||void 0}}class fe{constructor(){}match(t){return!!ft(t,"ErrorEvent")&&(null!=t.error||this.fi(t))}coerce(t,i){var e;if(null!=t.error)return i.apply(t.error);var r=i.apply(t.message);return g({},r,{stack:null!==(e=this.pi(t))&&void 0!==e?e:r.stack,synthetic:!0})}fi(t){return rt(t.message)&&t.message.length>0}pi(t){var i,e,r=t,s=null!==(i=r.lineno)&&void 0!==i?i:0,n=null!==(e=r.colno)&&void 0!==e?e:0;if(rt(r.filename)&&0!==r.filename.length&&0!==s)return"Error\n at "+r.filename+":"+s+":"+n}}var pe=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class ge{match(t){return"string"==typeof t}coerce(t,i){var e,r=this.getInfos(t),s=r[0],n=r[1];return{type:null!=s?s:"Error",value:null!=n?n:t,stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}getInfos(t){var i="Error",e=t,r=t.match(pe);return r&&(i=r[1],e=r[2]),[i,e]}}var _e=["fatal","error","warning","log","info","debug"];function me(t,i){void 0===i&&(i=40);var e=Object.keys(t);if(e.sort(),!e.length)return"[object has no keys]";for(var r=e.length;r>0;r--){var s=e.slice(0,r).join(", ");if(i>=s.length)return r===e.length?s:s.length>i?s.slice(0,i)+"...":s}return""}class ye{match(t){return"object"==typeof t&&null!==t}coerce(t,i){var e,r,s=this.getErrorPropertyFromObject(t);return s?i.apply(s):{type:this.getType(t),value:this.getValue(t),stack:null!==(e=this.getStack(t))&&void 0!==e?e:null==(r=i.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){if(gt(t))return t.constructor.name;var i="name"in t?t.name:void 0;return rt(i)&&!st(i)?i:"Error"}getValue(t){if("name"in t&&"string"==typeof t.name){var i="'"+t.name+"' captured as exception";return"message"in t&&"string"==typeof t.message&&(i+=" with message: '"+t.message+"'"),i}if("message"in t&&"string"==typeof t.message)return t.message;var e=this.getObjectClassName(t);return(e&&"Object"!==e?"'"+e+"'":"Object")+" captured as exception with keys: "+me(t)}isSeverityLevel(t){return rt(t)&&!st(t)&&_e.indexOf(t)>=0}getStack(t){try{return rt(t.stacktrace)&&t.stacktrace.length>0?t.stacktrace:rt(t.stack)&&t.stack.length>0?t.stack:void 0}catch(t){return}}getErrorPropertyFromObject(t){for(var i in t)if({}.hasOwnProperty.call(t,i)){var e=t[i];if(pt(e))return e}}getObjectClassName(t){try{var i=Object.getPrototypeOf(t);return i?i.constructor.name:void 0}catch(t){return}}}class be{match(t){return gt(t)}coerce(t,i){var e,r=t.constructor.name;return{type:r,value:r+" captured as exception with keys: "+me(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class we{match(t){return ct(t)}coerce(t,i){var e;return{type:"Error",value:"Primitive value captured as exception: "+String(t),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}}}class xe{match(t){return ft(t,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(t)}isCustomEventWrappingRejection(t){if(!gt(t))return!1;try{var i=t.detail;return null!=i&&"object"==typeof i&&"reason"in i}catch(t){return!1}}coerce(t,i){var e,r=this.getUnhandledRejectionReason(t);return ct(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(e=i.syntheticException)?void 0:e.stack,synthetic:!0}:i.apply(r)}getUnhandledRejectionReason(t){try{if("reason"in t)return t.reason;if("detail"in t&&null!=t.detail&&"object"==typeof t.detail&&"reason"in t.detail)return t.detail.reason}catch(t){}return t}}var Se="$message",ke="$timestamp",Ee=new Set([Se,ke]),$e={enabled:!0,max_bytes:32768};function Pe(t){var i;return t?{enabled:null!==(i=t.enabled)&&void 0!==i?i:$e.enabled,max_bytes:Ce(t.max_bytes,$e.max_bytes)}:g({},$e)}class Te{constructor(t){this.Vn=[],this.Gn=0,this.qi=Pe(t)}setConfig(t){this.qi=Pe(t),this.Zn()}add(t){var i=function(t){var i;try{i=K(t)}catch(t){return}try{var e=JSON.parse(i);if(!tt(e))return;var r=e,s=r[Se],n=r[ke];if(!rt(s)||0===s.trim().length)return;if(!rt(n)&&!at(n))return;return{step:r,json:i}}catch(t){return}}(t);if(i){var e=function(t){if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t).length;for(var i=encodeURIComponent(t),e=0,r=0;i.length>r;r++)"%"===i[r]?(e+=1,r+=2):e+=1;return e}(i.json);e>this.qi.max_bytes||(this.Vn.push({step:i.step,bytes:e}),this.Gn+=e,this.Zn())}}getAttachable(){return this.Vn.map((t=>t.step))}clear(){this.Vn=[],this.Gn=0}size(){return this.Vn.length}Zn(){for(;this.Gn>this.qi.max_bytes&&this.Vn.length>0;){var t=this.Vn.shift();t&&(this.Gn-=t.bytes)}}}function Ce(t,i){if(!at(t)||t===1/0||t===-1/0)return i;var e=Math.floor(t);return 0>e?i:e}var Fe=function(i,e){var r=(void 0===e?{}:e).debugEnabled,s={F(e){if(t&&(c.DEBUG||t.POSTHOG_DEBUG||r)&&!et(t.console)&&t.console){for(var s=("__rrweb_original__"in t.console[e]?t.console[e].__rrweb_original__:t.console[e]),n=arguments.length,o=new Array(n>1?n-1:0),a=1;n>a;a++)o[a-1]=arguments[a];s(i,...o)}},debug(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];s.F("debug",...i)},info(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];s.F("log",...i)},warn(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];s.F("warn",...i)},error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];s.F("error",...i)},critical(){for(var t=arguments.length,e=new Array(t),r=0;t>r;r++)e[r]=arguments[r];console.error(i,...e)},uninitializedWarning(t){s.error("You must initialize PostHog before calling "+t)},createLogger:(t,e)=>Fe(i+" "+t,e)};return s},Re=Fe("[PostHog.js]"),Ie=Re.createLogger,Me=Ie("[ExternalScriptsLoader]"),Ae=t=>{var i=null==r?void 0:r.querySelectorAll("script");if(i)for(var e=0;i.length>e;e++)if(i[e].src===t||i[e].getAttribute("src")===t)return i[e]},Oe=(t,i,e)=>{if(t.config.disable_external_dependency_loading)return Me.warn(i+" was requested but loading of external scripts is disabled."),e("Loading of external scripts is disabled");var s=Ae(i);if(s){if(s.__posthog_loading_callback_fired)return e();var n=s.__posthog_loading_error;return n?e(n):(s.addEventListener("load",(t=>{s.__posthog_loading_callback_fired=!0,e(void 0,t)})),void s.addEventListener("error",(t=>{s.__posthog_loading_error=t,e(t)})))}var o=()=>{if(!r)return e("document not found");if(Ae(i))return Oe(t,i,e);var s=r.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=i,s.onload=t=>{s.__posthog_loading_callback_fired=!0,e(void 0,t)},s.onerror=t=>{s.__posthog_loading_error=t,e(t)},t.config.prepare_external_dependency_script&&(s=t.config.prepare_external_dependency_script(s)),!s)return e("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?o():null==r||r.addEventListener("DOMContentLoaded",o)},De={},je=(t,i)=>{var e="/static/"+i+".js?v="+t.version;if("toolbar"===i){var r=3e5;e=e+"&t="+Math.floor(Date.now()/r)*r}return t.requestRouter.endpointFor("assets",e)};v.__PosthogExtensions__=v.__PosthogExtensions__||{},v.__PosthogExtensions__.loadExternalDependency=(t,i,e)=>{if("remote-config"!==i){var r=t.config.strict_script_versioning;if(r){var s=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+i+".js"),n=De[s];if("fallback"===r&&n){if(Ae(n))return void Oe(t,n,e);delete De[s]}Oe(t,s,"fallback"===r?(r,n)=>{if(r)if("string"==typeof r)e(r);else{var o,a=je(t,i);De[s]=a;var l=Ae(s);null==l||null==(o=l.parentNode)||o.removeChild(l),Oe(t,a,e)}else e(void 0,n)}:e)}else Oe(t,je(t,i),e)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Oe(t,o,e)}},v.__PosthogExtensions__.loadSiteApp=(t,i,e)=>{var r=t.requestRouter.endpointFor("api",i);Oe(t,r,e)};c.DEBUG=!1,c.LIB_VERSION="1.419.2",c.LIB_NAME="web";var Le="$people_distinct_id",Ne="distinct_id",Be="$device_id",ze="$device_model",Ue="__alias",qe="__timers",He="$autocapture_disabled_server_side",Ve="$heatmaps_enabled_server_side",We="$exception_capture_enabled_server_side",Ge="$error_tracking_suppression_rules",Ke="$error_tracking_capture_extension_exceptions",Je="$web_vitals_enabled_server_side",Ye="$dead_clicks_enabled_server_side",Qe="$product_tours_enabled_server_side",Xe="$web_vitals_allowed_metrics",Ze="$session_recording_remote_config",tr="$replay_sample_rate",ir="$replay_override_sampling",er="$replay_override_linked_flag",rr="$replay_override_url_trigger",sr="$replay_override_event_trigger",nr="$sesid",or="$session_is_sampled",ar="$enabled_feature_flags",lr="$active_feature_flags",hr="$early_access_features",ur="$feature_flag_details",dr="$feature_flag_payloads",vr="$feature_flag_request_id",cr="$minimal_flag_called_events",fr="$override_feature_flags",pr="$override_feature_flag_payloads",gr="$stored_person_properties",_r="$stored_group_properties",mr="$groups",yr="$surveys",br="$surveys_loaded_at",wr="$surveys_activated",xr="$surveys_activated_session",Sr="$surveys_activated_timestamps",kr="ph_product_tours",Er="$flag_call_reported",$r="$flag_call_reported_session_id",Pr="$feature_flag_errors",Tr="$feature_flag_evaluated_at",Cr="$user_state",Fr="$client_session_props",Rr="$capture_rate_limit",Ir="$initial_campaign_params",Mr="$initial_referrer_info",Ar="$initial_person_info",Or="$epp",Dr="$posthog_cookieless",jr="$cookieless_mode",Lr="$sdk_debug_extensions_init_method",Nr="$sdk_debug_extensions_init_time_ms",Br="$sdk_debug_recording_script_not_loaded",zr="PostHog loadExternalDependency extension not found.",Ur="on_reject",qr="always",Hr="anonymous",Vr="identified",Wr="identified_only",Gr="visibilitychange",Kr="beforeunload",Jr="$pageview",Yr="$pageleave",Qr="$identify",Xr="$groupidentify";function Zr(t,i){X(t)&&t.forEach(i)}function ts(t,i){if(!ot(t))if(X(t))t.forEach(i);else if(ut(t))t.forEach(((t,e)=>i(t,e)));else for(var e in t)Y.call(t,e)&&i(t[e],e)}var is=function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];for(var s of e)for(var n in s)void 0!==s[n]&&(t[n]=s[n]);return t};function es(t){for(var i=Object.keys(t),e=i.length,r=new Array(e);e--;)r[e]=[i[e],t[i[e]]];return r}var rs=function(t){try{return t()}catch(t){return}},ss=function(t){return function(){try{for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,e)}catch(t){Re.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Re.critical(t)}}},ns=function(t){var i={};return ts(t,(function(t,e){(rt(t)&&t.length>0||at(t))&&(i[e]=t)})),i};var os=["herokuapp.com","vercel.app","netlify.app"];function as(t){var i=null==t?void 0:t.hostname;if(!rt(i))return!1;var e=i.split(".").slice(-2).join(".");for(var r of os)if(e===r)return!1;return!0}function ls(t,i,e,r){var s=null!=r?r:{},n=s.capture,o=s.passive;null==t||t.addEventListener(i,e,{capture:void 0!==n&&n,passive:void 0===o||o})}function hs(t){return"ph_toolbar_internal"===t.name}var us=t=>{if(r){try{for(var i=t+"=",e=r.cookie.split(";").filter((t=>t.length)),s=0;e.length>s;s++){for(var n=e[s];" "==n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(i))return decodeURIComponent(n.substring(i.length,n.length))}}catch(t){}return null}};Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return at(t)&&isFinite(t)&&Math.floor(t)===t});class ds{constructor(t){if(this.bytes=t,16!==t.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,i,e,r){if(!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(e)||!Number.isInteger(r)||0>t||0>i||0>e||0>r||t>0xffffffffffff||i>4095||e>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/256,s[5]=t,s[6]=112|i>>>8,s[7]=i,s[8]=128|e>>>24,s[9]=e>>>16,s[10]=e>>>8,s[11]=e,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new ds(s)}toString(){for(var t="",i=0;this.bytes.length>i;i++)t=t+(this.bytes[i]>>>4).toString(16)+(15&this.bytes[i]).toString(16),3!==i&&5!==i&&7!==i&&9!==i||(t+="-");if(36!==t.length)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new ds(this.bytes.slice(0))}equals(t){return 0===this.compareTo(t)}compareTo(t){for(var i=0;16>i;i++){var e=this.bytes[i]-t.bytes[i];if(0!==e)return Math.sign(e)}return 0}}class vs{generate(){var t=this.generateOrAbort();if(!et(t))return t;this.Rr=0;var i=this.generateOrAbort();if(et(i))throw new Error("Could not generate UUID after timestamp reset");return i}generateOrAbort(){var t=Date.now();if(t>this.Rr)this.Rr=t,this.Ar();else{if(this.Rr>=t+1e4)return;this.Lr++,this.Lr>4398046511103&&(this.Rr++,this.Ar())}return ds.fromFieldsV7(this.Rr,Math.trunc(this.Lr/Math.pow(2,30)),this.Lr&Math.pow(2,30)-1,this.Or.nextUint32())}Ar(){this.Lr=1024*this.Or.nextUint32()+(1023&this.Or.nextUint32())}constructor(){this.Rr=0,this.Lr=0,this.Or=new ps}}var cs,fs=t=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var i=0;t.length>i;i++)t[i]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};t&&!et(t.crypto)&&crypto.getRandomValues&&(fs=t=>crypto.getRandomValues(t));class ps{nextUint32(){return this.ft.length>this.Fr||(fs(this.ft),this.Fr=0),this.ft[this.Fr++]}constructor(){this.ft=new Uint32Array(8),this.Fr=1/0}}var gs=()=>_s().toString(),_s=()=>(cs||(cs=new vs)).generate(),ms="",ys=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;var bs={Nr:()=>!!r,jr(t){Re.error("cookieStore error: "+t)},Pr:us,Br(t){var i;try{i=JSON.parse(bs.Pr(t))||{}}catch(t){}return i},Dr(t,i,e,s,n){if(!r)return!1;try{var o="",a="",l=function(t,i){if(i){var e=function(t,i){if(void 0===i&&(i=r),ms)return ms;if(!i)return"";if(["localhost","127.0.0.1"].includes(t))return"";for(var e=t.split("."),s=Math.min(e.length,8),n="dmn_chk_"+gs();!ms&&s--;){var o=e.slice(s).join("."),a=n+"=1;domain=."+o+";path=/";i.cookie=a+";max-age=3",i.cookie.includes(n)&&(i.cookie=a+";max-age=0",ms=o)}return ms}(t);if(!e){var s=(t=>{var i=t.match(ys);return i?i[0]:""})(t);s!==e&&Re.info("Warning: cookie subdomain discovery mismatch",s,e),e=s}return e?"; domain=."+e:""}return""}(r.location.hostname,s);if(e){var h=new Date;h.setTime(h.getTime()+864e5*e),o="; expires="+h.toUTCString()}n&&(a="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(i))+o+"; SameSite=Lax; path=/"+l+a;return u.length>3686.4&&Re.warn("cookieStore warning: large cookie, len="+u.length),r.cookie=u,!0}catch(t){return!1}},qr(t,i){if(null!=r&&r.cookie)try{bs.Dr(t,"",-1,i)}catch(t){return}}},ws=null,xs={Nr(){if(!nt(ws))return ws;var i=!0;if(et(t))i=!1;else try{var e="__mplssupport__";xs.Dr(e,"xyz"),'"xyz"'!==xs.Pr(e)&&(i=!1),xs.qr(e)}catch(t){i=!1}return i||Re.error("localStorage unsupported; falling back to cookie store"),ws=i,i},jr(t){Re.error("localStorage error: "+t)},Pr(i){try{return null==t?void 0:t.localStorage.getItem(i)}catch(t){xs.jr(t)}return null},Br(t){try{return JSON.parse(xs.Pr(t))||{}}catch(t){}return null},Dr(i,e){try{return null==t||t.localStorage.setItem(i,JSON.stringify(e)),!0}catch(t){xs.jr(t)}return!1},qr(i){try{null==t||t.localStorage.removeItem(i)}catch(t){xs.jr(t)}}},Ss=[gr,lr,ar,ur,dr,vr,Tr,Pr,Er],ks=[Be,Ne,nr,or,Or,Ar,Cr],Es=t=>t+"_cpm",$s=["__proto__","constructor","prototype"],Ps=t=>{if(!tt(t))return{};var i={};return Object.keys(t).forEach((e=>{-1===$s.indexOf(e)&&(i[e]=t[e])})),i},Ts=function(t,i){void 0===i&&(i=[]);var e={};return[...ks,...i].forEach((i=>{var r=t[i];et(r)||nt(r)||""===r||(e[i]=r)})),e},Cs=t=>{for(var i=5381,e=2166136261,r=0;t.length>r;r++){var s=t.charCodeAt(r);i=33*i^s,e=Math.imul(e^s,16777619)}return t.length.toString(36)+"."+(i>>>0).toString(36)+"."+(e>>>0).toString(36)},Fs=(t,i)=>({p:i,f:Cs(JSON.stringify(t))}),Rs=(t,i)=>{if(!i)return{properties:[],isValid:!1};try{var e=bs.Br(Es(t)),r=(null==e?void 0:e.f)===Cs(i)&&X(e.p);return{properties:r?e.p:[],isValid:r}}catch(t){return{properties:[],isValid:!1}}},Is=(t,i)=>i+"|"+(bs.Pr(Es(t))||""),Ms={},As={Nr:()=>!0,jr(t){Re.error("memoryStorage error: "+t)},Pr:t=>Ms[t]||null,Br:t=>Ms[t]||null,Dr:(t,i)=>(Ms[t]=i,!0),qr(t){delete Ms[t]}},Os=null,Ds={Nr(){if(!nt(Os))return Os;if(Os=!0,et(t))Os=!1;else try{var i="__support__";Ds.Dr(i,"xyz"),'"xyz"'!==Ds.Pr(i)&&(Os=!1),Ds.qr(i)}catch(t){Os=!1}return Os},jr(t){Re.error("sessionStorage error: ",t)},Pr(i){try{return null==t?void 0:t.sessionStorage.getItem(i)}catch(t){Ds.jr(t)}return null},Br(t){try{return JSON.parse(Ds.Pr(t))||null}catch(t){}return null},Dr(i,e){try{return null==t||t.sessionStorage.setItem(i,JSON.stringify(e)),!0}catch(t){Ds.jr(t)}return!1},qr(i){try{null==t||t.sessionStorage.removeItem(i)}catch(t){Ds.jr(t)}}};class js{constructor(t){this._instance=t}get qi(){return this._instance.config}get consent(){return this.cs()?0:this.fs}isOptedOut(){return this.qi.cookieless_mode===qr||this.isRejected()||-1===this.consent&&this.qi.cookieless_mode===Ur}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.qi.opt_out_capturing_by_default}optInOut(t){this.ps.Dr(this.gs,t?1:0,this.qi.cookie_expiration,this.qi.cross_subdomain_cookie,this.qi.secure_cookie)}reset(){this.ps.qr(this.gs,this.qi.cross_subdomain_cookie)}get gs(){var t=this._instance.config,i=t.token,e=t.opt_out_capturing_cookie_prefix;return t.consent_persistence_name||(e?e+i:"__ph_opt_in_out_"+i)}get fs(){var t=this.ps.Pr(this.gs);return yt(t)?1:V(bt,t)?0:-1}get ps(){var t=this.qi.opt_out_capturing_persistence_type,i="localStorage"===t?xs:bs;if(!this.ys||this.ys!==i){this.ys=i;var e="localStorage"===t?bs:xs;e.Pr(this.gs)&&(this.ys.Pr(this.gs)||this.optInOut(yt(e.Pr(this.gs))),e.qr(this.gs,this.qi.cross_subdomain_cookie))}return this.ys}cs(){return!!this.qi.respect_dnt&&[null==e?void 0:e.doNotTrack,null==e?void 0:e.msDoNotTrack,v.doNotTrack].some((t=>yt(t)))}}function Ls(t,i){var e,r=null==t||null==(e=t.config)?void 0:e.get_current_url;if(!Z(r))return i;try{var s=r(i);return rt(s)&&s?s:i}catch(t){return Re.error("Error in get_current_url, falling back to window.location.href",t),i}}var Ns="__POSTHOG_TOOLBAR__",Bs=1,zs=3,Us=11;function qs(t){return t instanceof Element&&(t.id===Ns||!(null==t.closest||!t.closest(".toolbar-global-fade-container")))}function Hs(t){return!!t&&t.nodeType===Bs}function Vs(t,i){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===i.toLowerCase()}function Ws(t){return!!t&&t.nodeType===zs}function Gs(t){return!!t&&t.nodeType===Us&&Hs(t.host)}var Ks=1e3;function Js(t){return t?W(t).split(/\s+/):[]}function Ys(i,e){var r=function(i){var e,r=null==t||null==(e=t.location)?void 0:e.href;return et(r)?void 0:Ls(i,r)}(e);return!!(r&&i&&i.some((t=>r.match(t))))}function Qs(t){var i="";switch(typeof t.className){case"string":i=t.className;break;case"object":i=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:i=""}return Js(i)}function Xs(t){return ot(t)?null:W(t).split(/(\s+)/).filter((t=>Sn(t))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Zs(t){var i="";return fn(t)&&!pn(t)&&t.childNodes&&t.childNodes.length&&ts(t.childNodes,(function(t){var e;Ws(t)&&t.textContent&&(i+=null!==(e=Xs(t.textContent))&&void 0!==e?e:"")})),W(i)}function tn(t){var i;return et(t.target)?t.srcElement||null:null!=(i=t.target)&&i.shadowRoot?t.composedPath()[0]||null:t.target||null}var en=["a","button","form","input","select","textarea","label"];function rn(t,i){if(et(i))return!0;var e,r=function(t){if(i.some((i=>function(t,i){var e=t.matches||t.matchesSelector||t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||t.oMatchesSelector;try{return!!e&&e.call(t,i)}catch(t){return!1}}(t,i))))return{v:!0}};for(var s of t)if(e=r(s))return e.v;return!1}function sn(t){var i=t.parentNode;return!(!i||!Hs(i))&&i}var nn=[".ph-no-autocapture","[data-ph-no-autocapture]"],on=["next","previous","prev",">","<"],an=[...on,"+","-","−","–"],ln=(t,i)=>/[a-z0-9]/i.test(i)?t.includes(i):t===i,hn=[".ph-no-rageclick",".ph-no-capture"],un=["","text","search","email","password","url","tel","number"];function dn(i,e){if(!t||vn(i))return!1;var r,s,n,o,a;if(ht(e)?(r=!!e&&hn,s=void 0,n=!1):(r=null!==(o=null==e?void 0:e.css_selector_ignorelist)&&void 0!==o?o:hn,s=null==e?void 0:e.content_ignorelist,n=null!==(a=null==e?void 0:e.ignore_text_selection)&&void 0!==a&&a),!1===r)return!1;if(n&&function(t){return!(!t||!Hs(t))&&(!!Vs(t,"textarea")||(Vs(t,"input")?V(un,(t.getAttribute("type")||"").toLowerCase()):function(t){if(t.isContentEditable)return!0;var i=null==t.getAttribute?void 0:t.getAttribute("contenteditable");return"true"===i||""===i}(t)))}(i))return!1;var l=cn(i,!1).targetElementList;return!function(t,i){if(!1===t||et(t))return!1;var e;if(!0===t)e=on;else{if(!X(t))return!1;if(t.length>10)return Re.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;e=t.map((t=>t.toLowerCase()))}return i.some((t=>{var i=t.safeText,r=t.ariaLabel;return e.some((t=>ln(i,t)||ln(r,t)))}))}(s,l.map((t=>{var i;return{safeText:Zs(t).toLowerCase(),ariaLabel:(null==(i=t.getAttribute("aria-label"))?void 0:i.toLowerCase().trim())||""}})))&&!rn(l,r)}var vn=t=>!t||Vs(t,"html")||!Hs(t),cn=(i,e)=>{if(!t||vn(i))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,s=[i],n=i;n.parentNode&&!Vs(n,"body");)if(Gs(n.parentNode))s.push(n.parentNode.host),n=n.parentNode.host;else{var o=sn(n);if(!o)break;if(e||en.indexOf(o.tagName.toLowerCase())>-1)r=!0;else try{var a=t.getComputedStyle(o);a&&"pointer"===a.getPropertyValue("cursor")&&(r=!0)}catch(t){}s.push(o),n=o}return{parentIsUsefulElement:r,targetElementList:s}};function fn(t){for(var i=new Set,e=0,r=t;r.parentNode&&!Vs(r,"body");r=r.parentNode){if(e++>=Ks||i.has(r))return!1;i.add(r);var s=Qs(r);if(V(s,"ph-sensitive")||V(s,"ph-no-capture"))return!1}if(V(Qs(t),"ph-include"))return!0;var n=t.type||"";if(rt(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var o=t.name||t.id||"";return!rt(o)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(o.replace(/[^a-zA-Z0-9]/g,""))}function pn(t){return!!(Vs(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Vs(t,"select")||Vs(t,"textarea")||"true"===t.getAttribute("contenteditable"))}var gn=new RegExp("^(?:(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}))$"),_n=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,mn=[16,15,14,13],yn=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),bn=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),wn=/[0-9A-Za-z_]/;function xn(t){for(var i=0,e=!1,r=t.length-1;r>=0;r--){var s=t.charCodeAt(r)-48;e&&(s*=2)>9&&(s-=9),i+=s,e=!e}return i%10==0}function Sn(t,i){if(void 0===i&&(i=!0),ot(t))return!1;if(rt(t)){t=W(t);var e=i?gn.test((t||"").replace(/[- ]/g,"")):function(t){var i;for(_n.lastIndex=0;i=_n.exec(t);){var e=i[2];if(e)for(var r=e.replace(/[- ]/g,""),s=0;r.length>s;s++)for(var n of mn){var o=s+n;if(r.length>=o){var a=r.slice(s,o);if(gn.test(a)&&xn(a))return!0}}}return!1}(t);if(e)return!1;var r=i?yn.test(t):function(t){var i;for(bn.lastIndex=0;i=bn.exec(t);){var e=i[1],r=i[3];if(!(e&&r&&wn.test(e)&&wn.test(r)))return!0}return!1}(t);if(r)return!1}return!0}function kn(t){var i=Zs(t);return Sn(i=(i+" "+En(t)).trim())?i:""}function En(t){var i="";return t&&t.childNodes&&t.childNodes.length&&ts(t.childNodes,(function(t){var e;if(t&&"span"===(null==(e=t.tagName)?void 0:e.toLowerCase()))try{var r=Zs(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+En(t)).trim())}catch(t){Re.error("[AutoCapture]",t)}})),i}function $n(t){return t.replace(/"|\\"/g,'\\"')}function Pn(t){var i=t.attr__class;if(i)return X(i)?i:Js(i)}var Tn=Ie("[Dead Clicks]"),Cn=()=>!0,Fn=t=>{var i,e=!(null==(i=t.instance.persistence)||!i.get_property(Ye)),r=t.instance.config.capture_dead_clicks;return ht(r)?r:!!tt(r)||e};class Rn{get lazyLoadedDeadClicksAutocapture(){return this.bs}constructor(t,i,e){this.instance=t,this.isEnabled=i,this.onCapture=e,this.startIfEnabledOrStop()}onRemoteConfig(t){if(t.ok){var i=t.config;"captureDeadClicks"in i&&(this.instance.persistence&&this.instance.persistence.register({[Ye]:i.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this._s((()=>{this.ws()})):this.stop()}_s(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.initDeadClicksAutocapture?t():null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this.instance,"dead-clicks-autocapture",(i=>{i?Tn.error("failed to load script",i):t()}))}ws(){var t;if(r){if(!this.bs&&null!=(t=v.__PosthogExtensions__)&&t.initDeadClicksAutocapture){var i=tt(this.instance.config.capture_dead_clicks)?g({},this.instance.config.capture_dead_clicks):{};i.__onCapture=this.onCapture,this.onCapture&&(i.capture_dead_swipes=!1),this.bs=v.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,i),this.bs.start(r),Tn.info("starting...")}}else Tn.error("`document` not found. Cannot start.")}stop(){this.bs&&(this.bs.stop(),this.bs=void 0,Tn.info("stopping..."))}}var In=Ie("[SegmentIntegration]");var Mn="posthog-js";function An(t,i){var e=void 0===i?{}:i,r=e.organization,s=e.projectId,n=e.prefix,o=e.severityAllowList,a=void 0===o?["error"]:o,l=e.sendExceptionsToPostHog,h=void 0===l||l;return i=>{var e,o,l,u,d;if("*"!==a&&!a.includes(i.level)||!t.__loaded)return i;i.tags||(i.tags={});var v=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());i.tags["PostHog Person URL"]=v,t.sessionRecordingStarted()&&(i.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var c,f=(null==(e=i.exception)?void 0:e.values)||[],p=f.map((t=>g({},t,{stacktrace:t.stacktrace?g({},t.stacktrace,{type:"raw",frames:(t.stacktrace.frames||[]).map((t=>g({},t,{platform:"web:javascript"})))}):void 0}))),_={$exception_message:(null==(o=f[0])?void 0:o.value)||i.message,$exception_type:null==(l=f[0])?void 0:l.type,$exception_level:i.level,$exception_list:p,$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:(null==(u=f[0])?void 0:u.value)||i.message,$sentry_exception_type:null==(d=f[0])?void 0:d.type,$sentry_tags:i.tags};return r&&s&&(_.$sentry_url=(n||"https://sentry.io/organizations/")+r+"/issues/?project="+s+"&query="+i.event_id),h&&(null==(c=t.exceptions)||c.sendExceptionEvent(_)),i}}class On{constructor(t,i,e,r,s,n){this.name=Mn,this.setupOnce=function(o){o(An(t,{organization:i,projectId:e,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}class Dn{constructor(t){this.ks=(t,i,e)=>{e&&(e.noSessionId||e.activityTimeout||e.sessionPastMaximumLength||e.crossTabAdoption)&&(Re.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:e}),this.Ss=void 0,this._instance.scrollManager.resetContext())},this._instance=t,this.xs()}xs(){var t;this.Cs=null==(t=this._instance.sessionManager)?void 0:t.onSessionId(this.ks)}destroy(){var t;null==(t=this.Cs)||t.call(this),this.Cs=void 0}doPageView(i,e){var r,s=this.Ts(i,e);return this.Ss={pathname:null!==(r=null==t?void 0:t.location.pathname)&&void 0!==r?r:"",pageViewId:e,timestamp:i},this._instance.scrollManager.resetContext(),s}doPageLeave(t){var i;return this.Ts(t,null==(i=this.Ss)?void 0:i.pageViewId)}doEvent(){var t;return{$pageview_id:null==(t=this.Ss)?void 0:t.pageViewId}}Ts(t,i){var e=this.Ss;if(!e)return{$pageview_id:i};var r={$pageview_id:i,$prev_pageview_id:e.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var n=s.maxScrollHeight,o=s.lastScrollY,a=s.maxScrollY,l=s.maxContentHeight,h=s.lastContentY,u=s.maxContentY;if(!(et(n)||et(o)||et(a)||et(l)||et(h)||et(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),h=Math.ceil(h),u=Math.ceil(u);var d=n>1?wt(o/n,0,1,Re):1,v=n>1?wt(a/n,0,1,Re):1,c=l>1?wt(h/l,0,1,Re):1,f=l>1?wt(u/l,0,1,Re):1;r=is(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:h,$prev_pageview_last_content_percentage:c,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return e.pathname&&(r.$prev_pageview_pathname=e.pathname),e.timestamp&&(r.$prev_pageview_duration=(t.getTime()-e.timestamp.getTime())/1e3),r}}var jn=["flags","surveys"],Ln={[Le]:{exposure:"hidden"},[Ue]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[qe]:{exposure:"hidden"},[He]:{exposure:"event"},[Ve]:{exposure:"hidden"},[We]:{exposure:"event"},[Ge]:{exposure:"hidden"},[Ke]:{exposure:"event"},[Je]:{exposure:"event"},[Ye]:{exposure:"event"},[Qe]:{exposure:"hidden"},[Xe]:{exposure:"event"},[Ze]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[nr]:{exposure:"hidden"},[or]:{exposure:"event"},[tr]:{exposure:"event",shouldSkipFromEventProperties:t=>nt(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"},[ar]:{exposure:"hidden",storageGroup:"flags"},[lr]:{exposure:"hidden",storageGroup:"flags"},[hr]:{exposure:"hidden"},[ur]:{exposure:"hidden",storageGroup:"flags"},[dr]:{exposure:"hidden",storageGroup:"flags"},[vr]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[cr]:{exposure:"hidden",storageGroup:"flags"},[fr]:{exposure:"hidden"},[pr]:{exposure:"hidden"},[gr]:{exposure:"hidden"},[_r]:{exposure:"hidden"},[yr]:{exposure:"hidden",storageGroup:"surveys"},[br]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[wr]:{exposure:"event"},[xr]:{exposure:"hidden"},[Sr]:{exposure:"hidden"},[kr]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Er]:{exposure:"hidden"},[$r]:{exposure:"hidden"},[mr]:{exposure:"event"},[Pr]:{exposure:"hidden"},[Tr]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Cr]:{exposure:"hidden"},[Fr]:{exposure:"hidden"},[Rr]:{exposure:"hidden"},[Ir]:{exposure:"hidden"},[Mr]:{exposure:"hidden"},[Ar]:{exposure:"hidden"},[Or]:{exposure:"hidden"},[ir]:{exposure:"event"},[er]:{exposure:"event"},[rr]:{exposure:"event"},[sr]:{exposure:"event"},[Lr]:{exposure:"event"},[Nr]:{exposure:"event"},[Br]:{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_pending_trigger_conditions:{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"}},Nn=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],Bn=t=>{var i=Ln[t];if(i)return i;for(var e of Nn){var r=e[1];if(0===t.indexOf(e[0]))return r}},zn=(t,i)=>{try{return JSON.stringify(t,((t,i)=>"bigint"==typeof i?i.toString():i),i)}catch(i){return K(t)}},Un=t=>{var i=null==r?void 0:r.createElement("a");return et(i)?null:(i.href=t,i)},qn=function(t,i){for(var e,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;r.length>s;s++){var n=r[s].split("=");if(n[0]===i){e=n;break}}if(!X(e)||2>e.length)return"";var o=e[1];try{o=decodeURIComponent(o)}catch(t){Re.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Hn=function(t,i,e){if(!t||!i||!i.length)return t;for(var r=t.split("#"),s=r[1],n=(r[0]||"").split("?"),o=n[1],a=n[0],l=(o||"").split("&"),h=[],u=0;l.length>u;u++){var d=l[u].split("=");X(d)&&(i.includes(d[0])?h.push(d[0]+"="+e):h.push(l[u]))}var v=a;return null!=o&&(v+="?"+h.join("&")),null!=s&&(v+="#"+s),v},Vn=function(t,i){var e=t.match(new RegExp(i+"=([^&]*)"));return e?e[1]:null},Wn=(t,i)=>t>=i&&u(),Gn=(t,i,e,r)=>{if(0===t){if(u()){var s=i+1;return s===e&&r(),s}return i}return 0},Kn="https?://(.*)",Jn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Yn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Jn],Qn="<masked>",Xn=["li_fat_id"];function Zn(t,i,e){if(!r)return{};var s,n=i?[...Jn,...e||[]]:[],o=to(Hn(r.URL,n,Qn),t),a=(s={},ts(Xn,(function(t){var i=us(t);s[t]=i||null})),s);return is(a,o)}function to(t,i){var e=Yn.concat(i||[]),r={};return ts(e,(function(i){var e=qn(t,i);r[i]=e||null})),r}function io(t){var i=function(t){return t?0===t.search(Kn+"google.([^/?]*)")?"google":0===t.search(Kn+"bing.com")?"bing":0===t.search(Kn+"yahoo.com")?"yahoo":0===t.search(Kn+"duckduckgo.com")?"duckduckgo":null:null}(t),e="yahoo"!=i?"q":"p",s={};if(!nt(i)){s.$search_engine=i;var n=r?qn(r.referrer,e):"";n.length&&(s.ph_keyword=n)}return s}function eo(){return navigator.language||navigator.userLanguage}var ro="$direct";function so(){return(null==r?void 0:r.referrer)||ro}function no(t,i,e){void 0===e&&(e=!1);var r=t?[...Jn,...i||[]]:[],n=e?Ci(null==s?void 0:s.href):null==s?void 0:s.href,o=null==n?void 0:n.substring(0,1e3);return{r:so().substring(0,1e3),u:o?Hn(o,r,Qn):void 0}}function oo(t,i){var e;void 0===i&&(i=!1);var r=t.r,s=t.u,n=i?Ci(s):s,o={$referrer:r,$referring_domain:null==r?void 0:r==ro?ro:null==(e=Un(r))?void 0:e.host};if(n){o.$current_url=n;var a=Un(n);o.$host=null==a?void 0:a.host,o.$pathname=null==a?void 0:a.pathname;var l=to(n);is(o,l)}if(r){var h=io(r);is(o,h)}return o}function ao(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){return}}function lo(){try{return(new Date).getTimezoneOffset()}catch(t){return}}var ho={flags:Tr,surveys:br},uo=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],vo=t=>t+"_cookie_identity_change_pending",co="main",fo=(t,i)=>{ts(t,((e,r)=>{var s=Bn(r);s&&"event"!==s.exposure||{}.hasOwnProperty.call(i,r)||delete t[r]}))};class po{constructor(i,e,r){if(void 0===r&&(r=!0),this.Ms={},this.Es=!1,this.Is=!1,this.Rs=!1,this.Ps=!1,this.qi=i,this.As=r,this.props={},this.Fs=void 0,this.Ls=(t=>{var i="";return t.token&&(i=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+i+"_posthog"})(i),this.ps=this.Os(i),this.Is=this.Ds(i),this.load(),i.debug&&Re.info("Persistence loaded",i.persistence,g({},this.props)),this.update_config(i,i,e),this.save(),t){var s=()=>this.flush();ls(t,"beforeunload",s,{capture:!1}),ls(t,"pagehide",s,{capture:!1})}}$s(){var t,i=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return at(i)&&i>0?i:0}Ns(t){if(this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase())if(t)try{var i=Ts(t,this.qi.cookie_persisted_properties||[]),e=Fs(i,this.qi.cookie_persisted_properties||[]),r=JSON.stringify(i)+"|"+JSON.stringify(e),s=bs.Pr(this.Ls)||void 0;s&&Is(this.Ls,s)===r&&(this.qs=r,this.js=s)}catch(t){}else try{var n=bs.Pr(this.Ls)||void 0;this.qs=n?Is(this.Ls,n):void 0,this.js=n}catch(t){}}syncCookieProperties(){return this.Bs(this.qi)}Bs(t,i){if(void 0===i&&(i=!1),this.Hs&&!i||this.Ps||!t.cookieWinsOnConflict||"localstorage+cookie"!==t.persistence.toLowerCase())return!1;var e;try{e=bs.Pr(this.Ls)||void 0}catch(t){}if(!e||e===this.js)return!1;var r,s=Is(this.Ls,e);try{r=Ps(JSON.parse(e))}catch(t){return!1}if((bs.Pr(this.Ls)||void 0)!==e)return!1;this.qs=s,this.js=e;var n=Rs(this.Ls,e),o=[...ks,...n.properties],a={};if(Object.keys(r).forEach((t=>{var i=r[t];(et(i)||nt(i)||""===i||t===Cr&&i!==Hr&&i!==Vr)&&(a[t]=!0,delete r[t])})),it(r))return!1;var l=Ne in r||r[Cr]===Hr||r[Cr]===Vr,h=this.props[Ne],u=this.props[Cr],d=is({},this.props);[...ks,...t.cookie_persisted_properties||[]].forEach((t=>{if(-1!==o.indexOf(t)&&!(t in r)&&!a[t]&&(l||t!==Ne&&t!==Cr)){var i=d[t];!n.isValid&&-1!==ks.indexOf(t)&&(!1===i||0===i)||delete d[t]}})),this.props=is(d,r),!l||Cr in r||Cr in this.props||this.Us(Cr,Hr);var v=this.props[Ne],c=this.props[Cr];return!l||v===h&&c===u||(this.Rs=!0,Ds.Dr(vo(this.Ls),!0),this.zs(gr),this.zs(lr),this.zs(ar),this.zs(ur),this.zs(dr),this.zs(vr),this.zs(Tr),this.zs(Pr),this.zs(Er),c===Hr&&(u===Vr||r[Cr]===Hr||!et(h)&&v!==h)&&(fo(this.props,r),this.zs(_r)),c===Vr?this.props.$user_id=v:delete this.props.$user_id,this.zs(Ue)),!0}consumeCookieIdentityChange(){var t=vo(this.Ls),i=this.Rs||!!Ds.Pr(t);return this.Rs=!1,i&&Ds.qr(t),i}Ws(t){return void 0===t&&(t=!1),!(this.Ps||this.Hs&&!t||!this.qi.cookieWinsOnConflict||"localstorage+cookie"!==this.qi.persistence.toLowerCase()||(this.Ps=!0,0))}Vs(){this.Ps&&(et(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),delete this.Ms[co],this.Zs(!0))}Qs(t){if(void 0===t&&(t=!0),this.Ps)try{t?this.Vs():et(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0)}finally{this.Ps=!1}}isDisabled(){return!!this.Hs}Os(i){-1===uo.indexOf(i.persistence.toLowerCase())&&(Re.critical("Unknown persistence type "+i.persistence+"; falling back to localStorage+cookie"),i.persistence="localStorage+cookie");var e,r=function(i,e){void 0===i&&(i=[]),void 0===e&&(e=!1);var r=[...ks,...i];return g({},xs,{Br(t){try{var i,s={};try{i=bs.Pr(t)||void 0,s=i?Ps(JSON.parse(i)):{}}catch(t){}var n,o=JSON.parse(xs.Pr(t)||"{}");if(e){var a=Rs(t,i),l=[...ks,...a.properties],h={};Object.keys(s).forEach((t=>{var i=s[t];nt(i)||""===i||t===Cr&&i!==Hr&&i!==Vr||(h[t]=i)}));var u=Ne in h||h[Cr]===Hr||h[Cr]===Vr;if(Object.keys(h).length>0){var d,v=o[Ne],c=null!==(d=o[Cr])&&void 0!==d?d:Hr;r.forEach((t=>{if(-1!==l.indexOf(t)&&!(t in s)&&(u||t!==Ne&&t!==Cr)){var i=o[t];!a.isValid&&-1!==ks.indexOf(t)&&(!1===i||0===i)||delete o[t]}})),!u||Cr in s||Cr in o||(o[Cr]=Hr),!u||(Ne in h?h[Ne]:o[Ne])===v&&(Cr in h?h[Cr]:o[Cr])===c||(Ss.forEach((t=>delete o[t])),h[Cr]===Vr&&Ne in h?o.$user_id=h[Ne]:delete o.$user_id,h[Cr]!==Vr&&(delete o[mr],delete o[_r]),delete o.__alias)}n=is(o,h)}else n=is(s,o);return xs.Dr(t,n),n}catch(t){}return null},Dr(t,r,s,n,o,a){var l=xs.Dr(t,r,void 0,void 0,a);try{var h=Ts(r,i);if(Object.keys(h).length){if(e){var u=Es(t),d=Fs(h,i);if(bs.Dr(u,d,s,n,o,a),bs.Pr(u)!==JSON.stringify(d)){bs.qr(u,n);var v=Ts(r);return bs.Dr(t,v,s,n,o,a),l}}bs.Dr(t,h,s,n,o,a)}}catch(t){xs.jr(t)}return l},qr(i,e){try{null==t||t.localStorage.removeItem(i),bs.qr(i,e),bs.qr(Es(i),e)}catch(t){xs.jr(t)}}})}(i.cookie_persisted_properties||[],i.cookieWinsOnConflict),s=!1,n=i.persistence.toLowerCase();return"localstorage"===n&&xs.Nr()?(e=xs,s=!0):"localstorage+cookie"===n&&r.Nr()?(e=r,s=!0):"sessionstorage"===n&&Ds.Nr()?e=Ds:"memory"===n?e=As:"cookie"===n?e=bs:r.Nr()?(e=r,s=!0):e=bs,this.Es=s,e}Js(t){return this.Ls+"__"+t}Ds(t){return this.Es&&!!t.split_storage}properties(){var t={};return ts(this.props,((i,e)=>{var r=Bn(e);if(!r||"event"===r.exposure){if(null!=r&&null!=r.shouldSkipFromEventProperties&&r.shouldSkipFromEventProperties(i))return;t[e]=i}})),t}load(t){if(void 0===t&&(t=!1),!this.Hs||t){var i=this.qi.cookieWinsOnConflict&&"localstorage+cookie"===this.qi.persistence.toLowerCase(),e=i?xs.Br(this.Ls):null,r={};if(i)try{ts(r=Ps(bs.Br(this.Ls)),((t,i)=>{(et(t)||nt(t)||""===t)&&delete r[i]}))}catch(t){}var s=this.ps.Br(this.Ls);if(s&&(this.props=is({},s)),this.Is&&this.Ks(),i&&s){var n,o,a=null==e?void 0:e[Ne],l=null!==(n=null==e?void 0:e[Cr])&&void 0!==n?n:Hr,h=s[Ne],u=null!==(o=s[Cr])&&void 0!==o?o:Hr;if(h!==a||u!==l){this.Rs=!0,Ds.Dr(vo(this.Ls),!0);var d=is({},this.props);Ss.forEach((t=>delete d[t])),u===Hr&&(l===Vr||r[Cr]===Hr||!et(a)&&h!==a)&&(fo(d,r),delete d[_r]),this.props=d;var v=new Set;Ss.forEach((t=>{var i,e=null==(i=Bn(t))?void 0:i.storageGroup;e&&v.add(e)})),v.forEach((t=>{var i={};ts(this.props,((e,r)=>{var s;(null==(s=Bn(r))?void 0:s.storageGroup)===t&&(i[r]=e)})),it(i)?(xs.qr(this.Js(t)),this.Ms[t]={}):xs.Dr(this.Js(t),i)&&(this.Ms[t]={persisted:!0,fingerprint:this.Ys(i,t)})}))}}Ds.Pr(vo(this.Ls))&&(this.Rs=!0)}}Ks(){for(var t of jn){var i=xs.Br(this.Js(t));if(i&&!it(i)){var e=this.Xs(t);e.persisted=!0,this.ta(t)||(e.fingerprint=this.Ys(i,t)),this.ea(t,i)||is(this.props,i)}}}ta(t){return Object.keys(this.props).some((i=>{var e;return(null==(e=Bn(i))?void 0:e.storageGroup)===t}))}ea(t,i){var e=ho[t];if(!e)return!1;var r=i[e],s=this.props[e];return at(r)&&at(s)&&s>r}refreshKey(t){var i;if(!this.Hs){var e=this.Is?null==(i=Bn(t))?void 0:i.storageGroup:void 0,r=e?xs.Br(this.Js(e)):this.ps.Br(this.Ls);if(r&&t in r)this.Us(t,r[t]);else{if(e){var s=this.ps.Br(this.Ls);if(s&&t in s)return void this.Us(t,s[t])}this.zs(t)}}}save(){if(!this.Hs){var t=this.$s();t>0?et(this.Gs)&&(this.Gs=setTimeout((()=>{this.Gs=void 0,this.Zs()}),t)):this.Zs()}}flush(){et(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0,this.Zs())}Zs(t){void 0===t&&(t=!1),this.Hs||this.Ps&&!t||(t||this.syncCookieProperties(),this.Is?this.ia():this.ra(this.ps,this.Ls,this.props,co)&&this.Ns(this.props))}ia(){var t=this.na(),i=t.main,e=t.groups;for(var r of(this.ra(this.ps,this.Ls,i,co)&&this.Ns(i),jn)){var s,n=e[r];(!it(n)||null!=(s=this.Ms[r])&&s.persisted)&&this.ra(xs,this.Js(r),n,r)}}na(){var t={},i={flags:{},surveys:{}};return ts(this.props,((e,r)=>{var s,n=null==(s=Bn(r))?void 0:s.storageGroup;n?i[n][r]=e:t[r]=e})),{main:t,groups:i}}Ys(t,i){if(i===co)return JSON.stringify(t)+"|"+this.sa+"|"+this.aa+"|"+this.oa;var e={};return ts(t,((t,i)=>{var r;e[i]=null!=(r=Bn(i))&&r.volatile?"__volatile__":t})),JSON.stringify(e)}ra(t,i,e,r){var s,n=this.Xs(r);if(r!==co&&!n.dirty&&!et(n.fingerprint))return!1;try{if((s=this.Ys(e,r))===n.fingerprint)return n.dirty=!1,!1}catch(t){s=void 0}return t.Dr(i,e,this.sa,this.aa,this.oa,this.qi.debug)?(n.dirty=!1,r!==co&&(n.persisted=!0),et(s)||(n.fingerprint=s),!0):(this.qi.debug&&Re.warn('failed to persist storage entry "'+i+'"; will retry on next save'),!1)}remove(t){var i=(void 0===t?{}:t).keepGroupEntries,e=void 0!==i&&i;if(et(this.Gs)||(clearTimeout(this.Gs),this.Gs=void 0),this.ps.qr(this.Ls,!1),this.ps.qr(this.Ls,!0),!e&&this.As)for(var r of jn)xs.qr(this.Js(r));e?delete this.Ms[co]:this.Ms={},this.qs=void 0,this.js=void 0}clear(){this.remove(),this.props={}}register_once(t,i,e){if(tt(t)){this.syncCookieProperties(),et(i)&&(i="None"),this.sa=et(e)?this.la:e;var r=!1;if(ts(t,((t,e)=>{this.props.hasOwnProperty(e)&&this.props[e]!==i||(this.Us(e,t),r=!0)})),r)return this.save(),!0}return!1}register(t,i){if(tt(t)){this.syncCookieProperties(),this.sa=et(i)?this.la:i;var e=!1;if(ts(t,((i,r)=>{t.hasOwnProperty(r)&&(this.props[r]!==i||tt(i)||X(i))&&(this.Us(r,i),e=!0)})),e)return this.save(),!0}return!1}unregister(t){this.syncCookieProperties();var i="string"==typeof t?[t]:t,e=!1;for(var r of i)r in this.props&&(this.zs(r),e=!0);e&&this.save()}update_campaign_params(){var t=null==r?void 0:r.URL;if(t!==this.Fs){var i=Zn(this.qi.custom_campaign_params,this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties);it(ns(i))||this.register(i),this.Fs=t}}update_search_keyword(){var t;this.register((t=null==r?void 0:r.referrer)?io(t):{})}update_referrer_info(){var t;this.register_once({$referrer:so(),$referring_domain:null!=r&&r.referrer&&(null==(t=Un(r.referrer))?void 0:t.host)||ro},void 0)}set_initial_person_info(){this.props[Ir]||this.props[Mr]||this.register_once({[Ar]:no(this.qi.mask_personal_data_properties,this.qi.custom_personal_data_properties,this.qi.disable_capture_url_hashes)},void 0)}get_initial_props(){var t={};ts([Mr,Ir],(i=>{var e=this.props[i];e&&ts(e,(function(i,e){t["$initial_"+G(e)]=i}))}));var i=this.props[Ar];if(i){var e=function(t,i){void 0===i&&(i=!1);var e=oo(t,i),r={};return ts(e,(function(t,i){r["$initial_"+G(i)]=t})),r}(i,this.qi.disable_capture_url_hashes);is(t,e)}return t}safe_merge(t){return ts(this.props,(function(i,e){e in t||(t[e]=i)})),t}update_config(t,i,e){var r=t.persistence!==i.persistence,s=!((t,i)=>{if(t.length!==i.length)return!1;var e=[...t].sort(),r=[...i].sort();return e.every(((t,i)=>t===r[i]))})(t.cookie_persisted_properties||[],i.cookie_persisted_properties||[]),n=r||s,o=t.cookieWinsOnConflict!==i.cookieWinsOnConflict,a=t.disable_persistence||!!e,l=!!this.Hs&&!a;a||this.Bs(i,l),this.qi=t,!a&&(r||s||o)&&(this.qs=void 0,this.js=void 0,this.Bs(g({},t,{cookie_persisted_properties:i.cookie_persisted_properties}),l));var h=n||o?this.Os(t):this.ps,u=this.Ds(t),d=n||u!==this.Is,v=!a&&(d||t.cross_subdomain_cookie!==this.aa||t.secure_cookie!==this.oa)&&this.Ws(l);try{if(this.la=this.sa=t.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),d){var c=this.props;this.clear(),this.ps=h,this.Is=u,this.props=c,this.save()}else o&&(this.ps=h,a||(delete this.Ms[co],this.Zs()))}finally{v&&this.Qs()}}set_disabled(t){this.Hs=t,this.Hs?this.remove():this.save()}set_cross_subdomain(t){t!==this.aa&&(this.aa=t,this.remove({keepGroupEntries:!0}),this.save())}set_secure(t){t!==this.oa&&(this.oa=t,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(t,i){var e=this.props[qe]||{};e[t]=i,this.Us(qe,e),this.save()}remove_event_timer(t){var i=this.props[qe]||{},e=i[t];return et(e)||(delete i[t],this.Us(qe,i),this.save()),e}get_property(t){return this.props[t]}set_property(t,i){this.Us(t,i),this.save()}Us(t,i){var e;this.props[t]=i,null!=(e=Bn(t))&&e.volatile||this.ua(t)}zs(t){delete this.props[t],this.ua(t)}ua(t){var i,e=null==(i=Bn(t))?void 0:i.storageGroup;e&&(this.Xs(e).dirty=!0)}Xs(t){return this.Ms[t]||(this.Ms[t]={})}}function go(t){var i=!0;return{dispose(){if(i){i=!1;var e=t();e&&Z(e.then)&&e.then(void 0,(()=>{}))}}}}var _o="gzip-js",mo="base64",yo="events",bo="cancelEvents",wo="survey shown",xo="survey dismissed",So="survey sent",ko="popover",Eo=Ie("[RateLimiter]");class $o{constructor(t){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{var i=t.text;if(i&&i.length)try{(JSON.parse(i).quota_limited||[]).forEach((t=>{Eo.info((t||"events")+" is quota limited."),this.serverLimits[t]=(new Date).getTime()+6e4}))}catch(t){return void Eo.warn('could not rate limit - continuing. Error: "'+(null==t?void 0:t.message)+'"',{text:i})}},this.instance=t,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var t;return(null==(t=this.instance.config.rate_limiting)?void 0:t.events_per_second)||10}get captureEventsBurstLimit(){var t;return Math.max((null==(t=this.instance.config.rate_limiting)?void 0:t.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(t){var i,e,r;void 0===t&&(t=!1);var s=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,o=(new Date).getTime(),a=null!==(i=null==(e=this.instance.persistence)?void 0:e.get_property(Rr))&&void 0!==i?i:{tokens:s,last:o};a.tokens+=(o-a.last)/1e3*n,a.last=o,a.tokens>s&&(a.tokens=s);var l=1>a.tokens;if(l||t||(a.tokens=Math.max(0,a.tokens-1)),l&&!t){var h=(at(a.dropped)?a.dropped:0)+1;a.dropped=h,!this.lastEventRateLimited&&this.ha(h)&&(a.dropped=0)}return this.lastEventRateLimited=l,null==(r=this.instance.persistence)||r.set_property(Rr,a),{isRateLimited:l,remainingTokens:a.tokens}}da(t){var i=this.instance.config.property_denylist;return!X(i)||!i.includes(t)}va(){var t;if(this.da("$current_url")&&this.da("$pathname")&&null!=s&&s.pathname)return""+(null!==(t=s.origin)&&void 0!==t?t:"")+s.pathname}ha(t){var i,e,r=this.captureEventsBurstLimit,s=this.captureEventsPerSecond,n=this.va(),o=this.da("$session_id")?null==(i=(e=this.instance).get_session_id)?void 0:i.call(e):void 0,a=[t+" event(s) dropped since the last warning",n?"triggered on "+n:void 0,o?"session "+o:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited: "+a+". Config is set to "+s+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0})}isServerRateLimited(t){var i=this.serverLimits[t||"events"]||!1;return!1!==i&&(new Date).getTime()<i}}var Po=Ie("[RemoteConfig]");class To{constructor(t){this._instance=t}get remoteConfig(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.config}ca(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.loadExternalDependency?null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"remote-config",(()=>t(this.remoteConfig))):t()}fa(t){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t})}load(){try{if(this.remoteConfig)return Po.info("Using preloaded remote config",this.remoteConfig),this.pa(this.remoteConfig),void this.ga();if(this._instance.ma())return void Po.warn("Remote config is disabled. Falling back to local config.");this.ca((t=>{if(!t)return Po.info("No config found after loading remote JS config. Falling back to JSON."),void this.fa((t=>{this.pa(t.json,t),this.ga()}));this.pa(t),this.ga()}))}catch(t){Po.error("Error loading remote config",t),this.pa()}}stop(){this.ya&&(clearInterval(this.ya),this.ya=void 0)}refresh(){!this._instance.ma()&&r&&"hidden"!==r.visibilityState&&this._instance.reloadFeatureFlags()}ga(){var t;if(!this.ya){var i=null!==(t=this._instance.config.remote_config_refresh_interval_ms)&&void 0!==t?t:3e5;0!==i&&(this.ya=setInterval((()=>{this.refresh()}),i))}}pa(t,i){!t&&i&&(0===i.statusCode?i.error||Po.warn("Failed to fetch remote config from PostHog."):Po.error("Failed to fetch remote config from PostHog."));try{this._instance.pa(t?{ok:!0,config:t}:{ok:!1})}catch(t){Po.error("Error applying remote config",t)}if(!1!==(null==t?void 0:t.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var e;null==(e=this._instance.featureFlags)||e.ensureFlagsLoaded()}catch(t){Po.error("Error loading feature flags",t)}}}var Co=Uint8Array,Fo=Uint16Array,Ro=Uint32Array,Io=new Co([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]),Mo=new Co([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]),Ao=new Co([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Oo=function(t,i){for(var e=new Fo(31),r=0;31>r;++r)e[r]=i+=1<<t[r-1];var s=new Ro(e[30]);for(r=1;30>r;++r)for(var n=e[r];e[r+1]>n;++n)s[n]=n-e[r]<<5|r;return[e,s]},Do=Oo(Io,2),jo=Do[1];Do[0][28]=258,jo[258]=28;for(var Lo=Oo(Mo,0)[1],No=new Fo(32768),Bo=0;32768>Bo;++Bo){var zo=(43690&Bo)>>>1|(21845&Bo)<<1;No[Bo]=((65280&(zo=(61680&(zo=(52428&zo)>>>2|(13107&zo)<<2))>>>4|(3855&zo)<<4))>>>8|(255&zo)<<8)>>>1}var Uo=function(t,i,e){for(var r=t.length,s=0,n=new Fo(i);r>s;++s)++n[t[s]-1];var o,a=new Fo(i);for(s=0;i>s;++s)a[s]=a[s-1]+n[s-1]<<1;if(e){o=new Fo(1<<i);var l=15-i;for(s=0;r>s;++s)if(t[s])for(var h=s<<4|t[s],u=i-t[s],d=a[t[s]-1]++<<u,v=d|(1<<u)-1;v>=d;++d)o[No[d]>>>l]=h}else for(o=new Fo(r),s=0;r>s;++s)o[s]=No[a[t[s]-1]++]>>>15-t[s];return o},qo=new Co(288);for(Bo=0;144>Bo;++Bo)qo[Bo]=8;for(Bo=144;256>Bo;++Bo)qo[Bo]=9;for(Bo=256;280>Bo;++Bo)qo[Bo]=7;for(Bo=280;288>Bo;++Bo)qo[Bo]=8;var Ho=new Co(32);for(Bo=0;32>Bo;++Bo)Ho[Bo]=5;var Vo=Uo(qo,9,0),Wo=Uo(Ho,5,0),Go=function(t){return(t/8>>0)+(7&t&&1)},Ko=function(t,i,e){(null==e||e>t.length)&&(e=t.length);var r=new(t instanceof Fo?Fo:t instanceof Ro?Ro:Co)(e-i);return r.set(t.subarray(i,e)),r},Jo=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8},Yo=function(t,i,e){var r=i/8>>0;t[r]|=e<<=7&i,t[r+1]|=e>>>8,t[r+2]|=e>>>16},Qo=function(t,i){for(var e=[],r=0;t.length>r;++r)t[r]&&e.push({s:r,f:t[r]});var s=e.length,n=e.slice();if(!s)return[new Co(0),0];if(1==s){var o=new Co(e[0].s+1);return o[e[0].s]=1,[o,1]}e.sort((function(t,i){return t.f-i.f})),e.push({s:-1,f:25001});var a=e[0],l=e[1],h=0,u=1,d=2;for(e[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=e[e[d].f>e[h].f?h++:d++],l=e[h!=u&&e[d].f>e[h].f?h++:d++],e[u++]={s:-1,f:a.f+l.f,l:a,r:l};var v=n[0].s;for(r=1;s>r;++r)n[r].s>v&&(v=n[r].s);var c=new Fo(v+1),f=Xo(e[u-1],c,0);if(f>i){r=0;var p=0,g=f-i,_=1<<g;for(n.sort((function(t,i){return c[i.s]-c[t.s]||t.f-i.f}));s>r;++r){var m=n[r].s;if(i>=c[m])break;p+=_-(1<<f-c[m]),c[m]=i}for(p>>>=g;p>0;){var y=n[r].s;i>c[y]?p-=1<<i-c[y]++-1:++r}for(;r>=0&&p;--r){var b=n[r].s;c[b]==i&&(--c[b],++p)}f=i}return[new Co(c),f]},Xo=function(t,i,e){return-1==t.s?Math.max(Xo(t.l,i,e+1),Xo(t.r,i,e+1)):i[t.s]=e},Zo=function(t){for(var i=t.length;i&&!t[--i];);for(var e=new Fo(++i),r=0,s=t[0],n=1,o=function(t){e[r++]=t},a=1;i>=a;++a)if(t[a]==s&&a!=i)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=t[a]}return[e.subarray(0,r),i]},ta=function(t,i){for(var e=0,r=0;i.length>r;++r)e+=t[r]*i[r];return e},ia=function(t,i,e){var r=e.length,s=Go(i+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;r>n;++n)t[s+n+4]=e[n];return 8*(s+4+r)},ea=function(t,i,e,r,s,n,o,a,l,h,u){Jo(i,u++,e),++s[256];for(var d=Qo(s,15),v=d[0],c=d[1],f=Qo(n,15),p=f[0],g=f[1],_=Zo(v),m=_[0],y=_[1],b=Zo(p),w=b[0],x=b[1],S=new Fo(19),k=0;m.length>k;++k)S[31&m[k]]++;for(k=0;w.length>k;++k)S[31&w[k]]++;for(var E=Qo(S,7),P=E[0],T=E[1],C=19;C>4&&!P[Ao[C-1]];--C);var F,R,I,M,A=h+5<<3,O=ta(s,qo)+ta(n,Ho)+o,D=ta(s,v)+ta(n,p)+o+14+3*C+ta(S,P)+(2*S[16]+3*S[17]+7*S[18]);if(O>=A&&D>=A)return ia(i,u,t.subarray(l,l+h));if(Jo(i,u,1+(O>D)),u+=2,O>D){F=Uo(v,c,0),R=v,I=Uo(p,g,0),M=p;var j=Uo(P,T,0);for(Jo(i,u,y-257),Jo(i,u+5,x-1),Jo(i,u+10,C-4),u+=14,k=0;C>k;++k)Jo(i,u+3*k,P[Ao[k]]);u+=3*C;for(var L=[m,w],N=0;2>N;++N){var B=L[N];for(k=0;B.length>k;++k)Jo(i,u,j[z=31&B[k]]),u+=P[z],z>15&&(Jo(i,u,B[k]>>>5&127),u+=B[k]>>>12)}}else F=Vo,R=qo,I=Wo,M=Ho;for(k=0;a>k;++k)if(r[k]>255){var z;Yo(i,u,F[257+(z=r[k]>>>18&31)]),u+=R[z+257],z>7&&(Jo(i,u,r[k]>>>23&31),u+=Io[z]);var U=31&r[k];Yo(i,u,I[U]),u+=M[U],U>3&&(Yo(i,u,r[k]>>>5&8191),u+=Mo[U])}else Yo(i,u,F[r[k]]),u+=R[r[k]];return Yo(i,u,F[256]),u+R[256]},ra=new Ro([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),sa=function(){for(var t=new Ro(256),i=0;256>i;++i){for(var e=i,r=9;--r;)e=(1&e&&3988292384)^e>>>1;t[i]=e}return t}(),na=function(t,i,e){for(;e;++i)t[i]=e,e>>>=8};function oa(t,i){void 0===i&&(i={});var e=function(){var t=4294967295;return{p(i){for(var e=t,r=0;i.length>r;++r)e=sa[255&e^i[r]]^e>>>8;t=e},d(){return 4294967295^t}}}(),r=t.length;e.p(t);var s,n,o,a,l,h=(a=10+((s=i).filename&&s.filename.length+1||0),l=8,function(t,i,e,r,s,n){var o=t.length,a=new Co(r+o+5*(1+Math.floor(o/7e3))+s),l=a.subarray(r,a.length-s),h=0;if(!i||8>o)for(var u=0;o>=u;u+=65535){var d=u+65535;o>d?h=ia(l,h,t.subarray(u,d)):(l[u]=!0,h=ia(l,h,t.subarray(u,o)))}else{for(var v=ra[i-1],c=v>>>13,f=8191&v,p=(1<<e)-1,g=new Fo(32768),_=new Fo(p+1),m=Math.ceil(e/3),y=2*m,b=function(i){return(t[i]^t[i+1]<<m^t[i+2]<<y)&p},w=new Ro(25e3),x=new Fo(288),S=new Fo(32),k=0,E=0,P=(u=0,0),T=0,C=0;o>u;++u){var F=b(u),R=32767&u,I=_[F];if(g[R]=I,_[F]=R,u>=T){var M=o-u;if((k>7e3||P>24576)&&M>423){h=ea(t,l,0,w,x,S,E,P,C,u-C,h),P=k=E=0,C=u;for(var A=0;286>A;++A)x[A]=0;for(A=0;30>A;++A)S[A]=0}var O=2,D=0,j=f,L=R-I&32767;if(M>2&&F==b(u-L))for(var N=Math.min(c,M)-1,B=Math.min(32767,u),z=Math.min(258,M);B>=L&&--j&&R!=I;){if(t[u+O]==t[u+O-L]){for(var U=0;z>U&&t[u+U]==t[u+U-L];++U);if(U>O){if(O=U,D=L,U>N)break;var q=Math.min(L,U-2),H=0;for(A=0;q>A;++A){var V=u-L+A+32768&32767,W=V-g[V]+32768&32767;W>H&&(H=W,I=V)}}}L+=(R=I)-(I=g[R])+32768&32767}if(D){w[P++]=268435456|jo[O]<<18|Lo[D];var G=31&jo[O],K=31&Lo[D];E+=Io[G]+Mo[K],++x[257+G],++S[K],T=u+O,++k}else w[P++]=t[u],++x[t[u]]}}h=ea(t,l,!0,w,x,S,E,P,C,u-C,h)}return Ko(a,0,r+Go(h)+s)}(n=t,null==(o=i).level?6:o.level,null==o.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+o.mem,a,l)),u=h.length;return function(t,i){var e=i.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=2>i.level?4:9==i.level?2:0,t[9]=3,0!=i.mtime&&na(t,4,Math.floor(new Date(i.mtime||Date.now())/1e3)),e){t[3]=8;for(var r=0;e.length>=r;++r)t[r+10]=e.charCodeAt(r)}}(h,i),na(h,u-8,e.d()),na(h,u-4,r),h}var aa=!!o||!!n,la="text/plain",ha=!1,ua=(t,i)=>{var e=t.split("#"),r=e[1],s=e[0].split("?"),n=s[0],o=s[1];if(!o)return t;var a=o.split("&").filter((t=>t.split("=")[0]!==i)).join("&");return n+(a?"?"+a:"")+(r?"#"+r:"")},da=function(t,i,e){var r;void 0===e&&(e=!0);var s=t.split("?"),n=s[0],o=s[1],a=g({},i),l=null!==(r=null==o?void 0:o.split("&").map((t=>{var i,r=t.split("="),s=r[0],n=e&&null!==(i=a[s])&&void 0!==i?i:r[1];return delete a[s],s+"="+n})))&&void 0!==r?r:[],h=function(t,i){var e,r;void 0===i&&(i="&");var s=[];return ts(t,(function(t,i){et(t)||et(i)||"undefined"===i||(e=encodeURIComponent((t=>t instanceof File)(t)?t.name:t.toString()),r=encodeURIComponent(i),s[s.length]=r+"="+e)})),s.join(i)}(a);return h&&l.push(h),l.length>0?n+"?"+l.join("&"):n},va=t=>{if(t.ba)return t.ba;var i=t.data,e=t.compression;if(i){if(e===_o){var r=oa(function(t,i){var e=t.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(t);for(var r=new Co(t.length+(t.length>>>1)),s=0,n=function(t){r[s++]=t},o=0;e>o;++o){if(s+5>r.length){var a=new Co(s+8+(e-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);128>l?n(l):2048>l?(n(192|l>>>6),n(128|63&l)):l>55295&&57344>l?(n(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),n(128|l>>>12&63),n(128|l>>>6&63),n(128|63&l)):(n(224|l>>>12),n(128|l>>>6&63),n(128|63&l))}return Ko(r,0,s)}(zn(i)),{mtime:0});return{contentType:la,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(e===mo){var s=function(t){return t?btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,((t,i)=>String.fromCharCode(parseInt(i,16))))):t}(zn(i)),n=(t=>"data="+encodeURIComponent("string"==typeof t?t:zn(t)))(s);return{contentType:"application/x-www-form-urlencoded",body:n,estimatedSize:new Blob([n]).size}}var o=zn(i);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},ca=t=>{var i,e,r=()=>"sendBeacon"===t.transport?{url:da(t.url,{compression:mo}),encodedBody:va(g({},t,{compression:mo,ba:void 0}))}:{url:ua(t.url,"compression"),encodedBody:va(g({},t,{compression:void 0,ba:void 0}))};try{i=va(t)}catch(i){if(F(t.compression,qn(t.url,"compression")))return Re.error("Failed to gzip request body, sending uncompressed payload",i),r();throw i}return i&&F(t.compression,qn(t.url,"compression"))&&!((e=i.body)instanceof ArrayBuffer?C(new Uint8Array(e)):ArrayBuffer.isView(e)&&C(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)))?(ha=!0,r()):{url:t.url,encodedBody:i}},fa=t=>{try{return ca(t)}catch(i){return Re.error(i),void(null==t.callback||t.callback({statusCode:0,error:i}))}},pa=function(){var t=p((function*(t){var i=zn(t.data),e=yield function(t,i,e){return A.apply(this,arguments)}(i,c.DEBUG,{rethrow:!0});if(!e)return t;var r=yield e.arrayBuffer();return g({},t,{ba:{contentType:la,body:r,estimatedSize:r.byteLength}})}));return function(i){return t.apply(this,arguments)}}(),ga=/Failed to fetch|NetworkError|Load failed/i,_a=t=>"TypeError"===(null==t?void 0:t.name)&&ga.test((null==t?void 0:t.message)||""),ma=t=>{var i=fa(t);if(i){var e=i.url,r=i.encodedBody,s=null!=r?r:{},o=s.contentType,l=s.body,h=s.estimatedSize,u=new Headers;ts(t.headers,(function(t,i){u.append(i,t)})),o&&u.append("Content-Type",o);var d=null,v=!1;if(a){var c=new a;d={signal:c.signal,timeout:setTimeout((()=>{var i,e;v=!0,c.abort((i=t.timeout,(e=new Error("PostHog request timed out"+(i?" after "+i+"ms":""))).name="AbortError",e))}),t.timeout)}}var f=i=>{v&&"AbortError"===(null==i?void 0:i.name)||_a(i)?Re.warn(i):Re.error(i),null==t.callback||t.callback({statusCode:0,error:i})};try{var p;n(e,g({method:(null==t?void 0:t.method)||"GET",headers:u,keepalive:"POST"===t.method&&!t._a&&52428.8>(h||0),body:l,signal:null==(p=d)?void 0:p.signal},t.fetchOptions)).then((i=>i.text().then((e=>{var r={statusCode:i.status,text:e};if(200===i.status)try{r.json=JSON.parse(e)}catch(t){Re.error(t)}null==t.callback||t.callback(r)})))).catch(f).finally((()=>d?clearTimeout(d.timeout):null))}catch(t){d&&clearTimeout(d.timeout),f(t)}}},ya=t=>{try{var i,r=ca(t),s=r.url,n=r.encodedBody,o=null!=n?n:{},a=o.body,l=o.estimatedSize;if(!a)return;var h=a instanceof Blob?a:new Blob([a],{type:o.contentType});if(e.sendBeacon(s,h))return;var u=X(t.data)?t.data:null==(i=t.data)?void 0:i.batch;if(X(u)&&u.length>1&&(null!=l?l:0)>16384){var d=Math.ceil(u.length/2),v=i=>X(t.data)?i:g({},t.data,{batch:i});return ya(g({},t,{data:v(u.slice(0,d))})),void ya(g({},t,{data:v(u.slice(d))}))}Re.warn("Beacon of ~"+(null!=l?l:0)+" bytes was rejected by the browser, falling back to fetch"),ma(g({},t,{_a:!0}))}catch(t){Re.warn("Beacon send failed",t)}},ba=(t,i,e,r)=>{var s="query"===r?"POST"===i?"sent_at":"_":void 0;return da(e===_o?ua(t,"compression"):t,g({},s?{[s]:Date.now().toString()}:{},e===_o?{}:{compression:e}))},wa=[];n&&wa.push({transport:"fetch",method:ma}),o&&wa.push({transport:"XHR",method(t){var i=fa(t);if(i){var e=new o,r=i.encodedBody;e.open(t.method||"GET",i.url,!0);var s=null!=r?r:{},n=s.contentType,a=s.body;ts(t.headers,(function(t,i){e.setRequestHeader(i,t)})),n&&e.setRequestHeader("Content-Type",n),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(a)}}}),null!=e&&e.sendBeacon&&wa.push({transport:"sendBeacon",method:ya});var xa=3e3;class Sa{constructor(t,i){this.wa=!0,this.ka=[],this.Sa=wt((null==i?void 0:i.flush_interval_ms)||xa,250,5e3,Re.createLogger("flush interval"),xa),this.xa=t}enqueue(t){this.ka.push(t),this.Ca||this.Ta()}unload(){this.Ma();var t=this.ka.length>0?this.Ea():{},i=Object.values(t);[...i.filter((t=>0===t.url.indexOf("/e"))),...i.filter((t=>0!==t.url.indexOf("/e")))].map((t=>{this.Ia(g({},t,{transport:"sendBeacon"}))}))}enable(){this.wa=!1,this.Ta()}Ta(){var t=this;this.wa||(this.Ca=setTimeout((()=>{if(this.Ma(),this.ka.length>0){var i=this.Ea(),e=function(){var e=i[r],s=(new Date).getTime();e.data&&X(e.data)&&ts(e.data,(t=>{t.offset=Math.abs(t.timestamp-s),delete t.timestamp})),t.Ia(e)};for(var r in i)e()}}),this.Sa))}Ia(t){try{this.xa(t)}catch(t){Re.error(t)}}Ma(){clearTimeout(this.Ca),this.Ca=void 0}Ea(){var t={};return ts(this.ka,(i=>{var e,r=i,s=(r?r.batchKey:null)||r.url;et(t[s])&&(t[s]=g({},r,{data:[]})),null==(e=t[s].data)||e.push(r.data)})),this.ka=[],t}}var ka=["retriesPerformedSoFar"];class Ea{constructor(i){this.Ra=!1,this.Pa=3e3,this.ka=[],this._instance=i,this.ka=[],this.Aa=!0,!et(t)&&"onLine"in t.navigator&&(this.Aa=t.navigator.onLine,this.Fa=()=>{this.Aa=!0,this.La()},this.Oa=()=>{this.Aa=!1},ls(t,"online",this.Fa),ls(t,"offline",this.Oa))}get length(){return this.ka.length}retriableRequest(t){var i=t.retriesPerformedSoFar,e=_(t,ka);lt(i)&&(e.url=da(e.url,{retry_count:i})),this._instance._send_request(g({},e,{callback:t=>{if(200!==t.statusCode&&(400>t.statusCode||t.statusCode>=500)){if((0===t.statusCode?3:10)>(null!=i?i:0))return void this.xn(g({retriesPerformedSoFar:i},e));0===t.statusCode&&Re.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!=i?i:0)+" retries.")}null==e.callback||e.callback(t)}}))}xn(t){var i=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=i+1;var e=function(t){var i=3e3*Math.pow(2,t),e=i/2,r=Math.min(18e5,i),s=Math.random()-.5;return Math.ceil(r+s*(r-e))}(i),r=Date.now()+e;this.ka.push({retryAt:r,requestOptions:t});var s="Enqueued failed request for retry in "+e;navigator.onLine||(s+=" (Browser is offline)"),Re.warn(s),this.Ra||(this.Ra=!0,this.Da())}Da(){if(this.$a&&clearTimeout(this.$a),0===this.ka.length)return this.Ra=!1,void(this.$a=void 0);this.$a=setTimeout((()=>{this.Aa&&this.ka.length>0&&this.La(),this.Da()}),this.Pa)}La(){var t=Date.now(),i=[],e=this.ka.filter((e=>t>e.retryAt||(i.push(e),!1)));if(this.ka=i,e.length>0)for(var r of e)this.retriableRequest(r.requestOptions)}unload(){for(var i of(this.$a&&(clearTimeout(this.$a),this.$a=void 0),this.Ra=!1,et(t)||(this.Fa&&(t.removeEventListener("online",this.Fa),this.Fa=void 0),this.Oa&&(t.removeEventListener("offline",this.Oa),this.Oa=void 0)),this.ka)){var e=i.requestOptions;try{this._instance._send_request(g({},e,{transport:"sendBeacon"}))}catch(t){Re.error(t)}}this.ka=[]}}class $a{constructor(t){this.Na=()=>{var t,i,e,r;this.qa||(this.qa={});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.qa.lastScrollY=Math.ceil(n),this.qa.maxScrollY=Math.max(n,null!==(t=this.qa.maxScrollY)&&void 0!==t?t:0),this.qa.maxScrollHeight=Math.max(o,null!==(i=this.qa.maxScrollHeight)&&void 0!==i?i:0),this.qa.lastContentY=a,this.qa.maxContentY=Math.max(a,null!==(e=this.qa.maxContentY)&&void 0!==e?e:0),this.qa.maxContentHeight=Math.max(l,null!==(r=this.qa.maxContentHeight)&&void 0!==r?r:0)},this._instance=t}get ja(){return this._instance.config.scroll_root_selector}getContext(){return this.qa}resetContext(){var t=this.qa;return setTimeout(this.Na,0),t}startMeasuringScrollPosition(){ls(t,"scroll",this.Na,{capture:!0}),ls(t,"scrollend",this.Na,{capture:!0}),ls(t,"resize",this.Na)}scrollElement(){if(!this.ja)return null==t?void 0:t.document.documentElement;var i=X(this.ja)?this.ja:[this.ja];for(var e of i){var r=null==t?void 0:t.document.querySelector(e);if(r)return r}}Ba(i){var e="y"===i?"scrollTop":"scrollLeft";if(this.ja){var r=this.scrollElement();return r&&r[e]||0}return t?"y"===i?t.scrollY||t.pageYOffset||t.document.documentElement.scrollTop||0:t.scrollX||t.pageXOffset||t.document.documentElement.scrollLeft||0:0}scrollY(){return this.Ba("y")}scrollX(){return this.Ba("x")}}var Pa=t=>no(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 Ta{constructor(t,i,e,r){this.ot=t=>{var i=this.Ha();if(!i||i.sessionId!==t){var e={sessionId:t,props:this.Ua(this._instance)};this.za.register({[Fr]:e})}},this._instance=t,this.Wa=i,this.za=e,this.Ua=r||Pa,this.Wa.onSessionId(this.ot)}Ha(){return this.za.props[Fr]}getSetOnceProps(){var t,i=null==(t=this.Ha())?void 0:t.props;return i?"r"in i?oo(i,this._instance.config.disable_capture_url_hashes):{$referring_domain:i.referringDomain,$pathname:i.initialPathName,utm_source:i.utm_source,utm_campaign:i.utm_campaign,utm_medium:i.utm_medium,utm_content:i.utm_content,utm_term:i.utm_term}:{}}getSessionProps(){var t={};return ts(ns(this.getSetOnceProps()),((i,e)=>{"$current_url"===e&&(e="url"),t["$session_entry_"+G(e)]=i})),t}}class Ca{on(t,i){return this.Va[t]||(this.Va[t]=[]),this.Va[t].push(i),()=>{this.Va[t]=this.Va[t].filter((t=>t!==i))}}emit(t,i){for(var e of this.Va[t]||[])e(i);for(var r of this.Va["*"]||[])r(t,i)}constructor(){this.Va={}}}var Fa=Ie("[SessionId]"),Ra=864e5;class Ia{on(t,i){return this.Ga.on(t,i)}constructor(t,i,e){var r;if(this.Za=null,this.Qa=null,this.Ja=[],this.Ka=void 0,this.Ya=!1,this.Ga=new Ca,this.Xa=(t,i)=>!(!lt(t)||!lt(i))&&Math.abs(t-i)>this.sessionTimeoutMs,!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.cookieless_mode===qr)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.qi=t.config,this.za=t.persistence,this.st=void 0,this._e=void 0,this._sessionStartTimestamp=null,this.eo=void 0,this._sessionActivityTimestamp=null,this.io=i||gs,this.ro=e||gs;var s=this.qi.persistence_name||this.qi.token;if(this._sessionTimeoutMs=1e3*wt(this.qi.session_idle_timeout_seconds||1800,60,36e3,Fa.createLogger("session_idle_timeout_seconds"),1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.no(),this.so="ph_"+s+"_window_id",this.ao="ph_"+s+"_primary_window_exists",this.oo()){var n=Ds.Br(this.so),o=Ds.Br(this.ao);n&&!o?this.st=n:Ds.qr(this.so),Ds.Dr(this.ao,!0)}null!=(r=this.qi.bootstrap)&&r.sessionID&&this.setBootstrapSessionId(this.qi.bootstrap.sessionID),this.lo()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return et(this.Ja)&&(this.Ja=[]),this.Ja.push(t),this._e&&t(this._e,this.st),()=>{this.Ja=this.Ja.filter((i=>i!==t))}}oo(){return"memory"!==this.qi.persistence&&!this.za.Hs&&Ds.Nr()}uo(t){t!==this.st&&(this.st=t,this.oo()&&Ds.Dr(this.so,t))}ho(){return this.st?this.st:this.oo()?Ds.Br(this.so):null}do(t){var i=this.Za;return!nt(i)&&!nt(t)&&5e3>Math.abs(t-i)}vo(t,i,e){var r=i!==this._sessionActivityTimestamp,s=!(t!==this._e||e!==this._sessionStartTimestamp);this._sessionStartTimestamp=e,this._sessionActivityTimestamp=i,this._e=t,s&&!r||s&&this.do(i)||(this.Za=i,this.za.register({[nr]:[i,t,e]}))}co(){var t,i=null==(t=this.qi)?void 0:t.persistence_save_debounce_ms;return lt(i)&&i>0}fo(){this.co()?this.za.refreshKey(nr):(this.za.flush(),this.za.load())}po(){var t;if(!nt(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Za){this.fo();var i=this.mo();i[1]===this._e&&i[2]===this._sessionStartTimestamp&&(this.Za=this._sessionActivityTimestamp,this.za.register({[nr]:[this._sessionActivityTimestamp,null!==(t=this._e)&&void 0!==t?t:null,this._sessionStartTimestamp]}),this.za.flush())}}yo(){var t=this.mo()[0],i=lt(t)?t:0,e=lt(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(i,e)}bo(t){return this.fo(),this.Xa(t,this.yo())}mo(){var t=this.za.props[nr];return X(t)&&2===t.length&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this.Za=null,this.eo=void 0,clearTimeout(this._o),this._o=void 0,this.vo(null,null,null)}setBootstrapSessionId(t,i){void 0===i&&(i=!1);var e=function(t,i){void 0===i&&(i=(new Date).getTime());try{var e=(t=>{var i=t.replace(/-/g,"");if(32!==i.length)throw new Error("Not a valid UUID");if("7"!==i[12])throw new Error("Not a UUIDv7");return parseInt(i.substring(0,12),16)})(t);return e>i+6e4?void Fa.error("Bootstrap sessionID cannot be in the future"):e}catch(t){return void Fa.error("Invalid sessionID in bootstrap",t)}}(t);return!et(e)&&(i?this.eo={sessionId:t,sessionStartTimestamp:e}:this.vo(t,(new Date).getTime(),e),!0)}destroy(){this.Ya=!0,this.po(),clearTimeout(this._o),this._o=void 0,this.Ka&&t&&(t.removeEventListener(Kr,this.Ka,{capture:!1}),this.Ka=void 0),this.Ja=[]}lo(){this.Ka=()=>{this.po(),this.oo()&&Ds.qr(this.ao)},ls(t,Kr,this.Ka,{capture:!1})}checkAndGetSessionAndWindowId(t,i,e){if(void 0===t&&(t=!1),void 0===i&&(i=null),void 0===e&&(e=!1),this.qi.cookieless_mode===qr)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=i||(new Date).getTime(),s=this._e;if(e)this.Qa=r;else if(nt(this.Qa)||this.Qa>r||r-this.Qa>=1e3){var n,o;null==(n=(o=this.za).syncCookieProperties)||n.call(o),this.Qa=r}var a=this.mo(),l=a[1],h=a[2],u=!et(s)&&l!==s,d=this.yo(),v=this.ho(),c=this.eo,f=!!c&&(c.sessionStartTimestamp>r+6e4||r-c.sessionStartTimestamp>Ra),p=c?f:lt(h)&&Math.abs(r-h)>Ra,g=!1,_=u,m=!l||!!c,y=l,b=!m&&!t&&this.Xa(r,d);if(b){(b=this.bo(r))||Fa.info("cross-tab refresh kept the session alive",{sessionId:l});var w=this.mo();l=w[1],h=w[2]}if(m||b||p){_=!1;var x=c&&!f;l=x?c.sessionId:this.io(),v=this.ro(),Fa.info("new session ID assigned",{sessionId:l,windowId:v,bootstrapped:!!x,changeReason:{noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p}}),h=x?c.sessionStartTimestamp:r,this.eo=void 0,g=!0}else v||(v=this.ro(),g=!0),(_=_||l!==y)&&(Fa.info("adopted cross-tab session id",{sessionId:l,windowId:v}),g=!0);var S=lt(d)&&t&&!p?d:r,k=lt(h)?h:(new Date).getTime();this.uo(v),this.vo(l,S,k),t||this.no();var E={noSessionId:m,activityTimeout:b,sessionPastMaximumLength:p,crossTabAdoption:_};return g&&this.Ja.forEach((t=>t(l,v,E))),{sessionId:l,windowId:v,sessionStartTimestamp:k,changeReason:g?E:void 0,lastActivityTimestamp:d}}no(){this.Ya||(clearTimeout(this._o),this._o=setTimeout((()=>{if(!this.Ya)if(this.bo((new Date).getTime())){var t=this._e;this.resetSessionId(),this.Ga.emit("forcedIdleReset",{idleSessionId:t})}else this.no()}),1.1*this.sessionTimeoutMs))}}var Ma=function(t,i){if(!t)return!1;var e=t.userAgent;if(e&&H(e,i))return!0;try{var r=null==t?void 0:t.userAgentData;if(null!=r&&r.brands&&r.brands.some((t=>H(null==t?void 0:t.brand,i))))return!0}catch(t){}return!!t.webdriver};function Aa(){return(Aa=p((function*(){var t=null==e?void 0:e.userAgentData;if(null!=t&&t.getHighEntropyValues)try{var i=yield t.getHighEntropyValues(["model"]),r=null==i?void 0:i.model;return rt(r)&&r.length>0?r:void 0}catch(t){return void Re.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t)}}))).apply(this,arguments)}function Oa(t){var i;return!(null==(i=t.conditions)||null==(i=i.events)||null==(i=i.values)||!i.length)}var Da=(t,i)=>{if(!(t=>{try{new RegExp(t)}catch(t){return!1}return!0})(i))return!1;try{return new RegExp(i).test(t)}catch(t){return!1}},ja=t=>t.toLowerCase(),La={exact:(t,i)=>i.some((i=>t.some((t=>i===t)))),is_not:(t,i)=>i.every((i=>t.every((t=>i!==t)))),regex:(t,i)=>i.some((i=>t.some((t=>Da(i,t))))),not_regex:(t,i)=>i.every((i=>t.every((t=>!Da(i,t))))),icontains:(t,i)=>i.map(ja).some((i=>t.map(ja).some((t=>i.includes(t))))),not_icontains:(t,i)=>i.map(ja).every((i=>t.map(ja).every((t=>!i.includes(t))))),gt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e>parseFloat(t)))})),lt:(t,i)=>i.some((i=>{var e=parseFloat(i);return!isNaN(e)&&t.some((t=>e<parseFloat(t)))}))};function Na(t,i){return!t||Object.entries(t).every((t=>{var e=t[1],r=null==i?void 0:i[t[0]];if(null==r)return!1;var s=La[e.operator];return!!s&&s(e.values,[String(r)])}))}function Ba(t,i,e){return zn({distinct_id:t,userPropertiesToSet:i,userPropertiesToSetOnce:e})}var za="custom",Ua="i.posthog.com",qa=/^\/static\//,Ha=["/s/","/e/","/i/"];class Va{constructor(t){this.wo={},this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===t?"https://us.i.posthog.com":t}get flagsApiHost(){var t=this.instance.config.flags_api_host;return t?t.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var t,i=null==(t=this.instance.config.ui_host)?void 0:t.replace(/\/$/,"");return i||(i=this.apiHost.replace("."+Ua,".posthog.com")),"https://app.posthog.com"===i?"https://us.posthog.com":i}get region(){return this.wo[this.apiHost]||(this.wo[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":za),this.wo[this.apiHost]}ko(t){if(qa.test(t)){var i=this.instance.config.asset_host;if("string"==typeof i)return i.trim().replace(/\/$/,"")||void 0}}So(t){var i=Un(t);return i?i.protocol+"//"+i.host+i.pathname:void 0}xo(t,i,e){if("ui"===t)return e;var r=e,s=this.instance.config.rewriteRequestPath;if(s){var n,o=(null==(n=Un(e))?void 0:n.href)||e;r=s(new URL(o)).toString()}if(s&&"api"===t&&Ha.some((t=>0===i.indexOf(t)))){var a=this.So(r);if(a){var l,h=this.apiHost,u=this.Co;(null==(l=u)?void 0:l.apiHost)===h&&u.rewriteRequestPath===s||(u={apiHost:h,rewriteRequestPath:s,urls:new Set},this.Co=u),u.urls.add(a)}}return r}isIngestionEndpoint(t){var i=this.Co,e=this.So(t);return(null==i?void 0:i.apiHost)===this.apiHost&&i.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!e&&i.urls.has(e)}endpointFor(t,i){if(void 0===i&&(i=""),i&&(i="/"===i[0]?i:"/"+i),"ui"===t)return this.xo(t,i,this.uiHost+i);if("flags"===t)return this.xo(t,i,this.flagsApiHost+i);if("assets"===t){var e=this.ko(i);if(e)return this.xo(t,i,""+e+i)}if(this.region===za)return this.xo(t,i,this.apiHost+i);var r=Ua+i;switch(t){case"assets":return this.xo(t,i,"https://"+this.region+"-assets."+r);case"api":return this.xo(t,i,"https://"+this.region+"."+r)}}}var Wa=Ie("[Surveys]"),Ga="seenSurvey_",Ka=t=>{try{var i=(t=>((t,i)=>""+t+function(t){return t.current_iteration&&t.current_iteration>0?t.id+"_"+t.current_iteration:t.id}(i))(Ga,t))(t);if(localStorage.getItem(i))return;localStorage.setItem(i,"true")}catch(t){Wa.error("Failed to persist survey seen state",t)}},Ja=["popover","widget","api"],Ya={ignoreConditions:!1,ignoreDelay:!1,displayType:ko},Qa=Ie("[PostHog ExternalIntegrations]"),Xa={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class Za{constructor(t){this._instance=t}_s(t,i){var e;null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,t,(t=>{if(t)return Qa.error("failed to load script",t);i()}))}startIfEnabledOrStop(){var t=this,i=function(){var i,r,s,n=e[0],o=e[1];!o||null!=(i=v.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[n]||t._s(Xa[n],(()=>{var i;null==(i=v.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[n])||i.start(t._instance)})),!o&&null!=(r=v.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[n]&&(null==(s=v.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[n])||s.stop())};for(var e of Object.entries(null!==(r=this._instance.config.integrations)&&void 0!==r?r:{})){var r;i()}}}class tl{constructor(t,i){this.I=t,this.ns=i,this.To=new Map,this.Xn=!1}add(t){var i=this;return p((function*(){if(i.Xn)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(i.To.has(t.name))throw new Error('Browser extension "'+t.name+'" is already registered');i.To.set(t.name,t);try{var e=t.setup(i.ns);e&&(yield e)}catch(e){var r=i.To.get(t.name)===t;r&&i.To.delete(t.name),i.I.error('Failed to set up browser extension "'+t.name+'"',e),r&&i.Mo(t)}}))()}dispose(){if(!this.Xn){this.Xn=!0;var t=Array.from(this.To.values()).reverse();for(var i of(this.To.clear(),t))this.Mo(i)}}Mo(t){try{var i=null==t.dispose?void 0:t.dispose();i&&Z(i.then)&&i.then(void 0,(i=>{this.I.error('Failed to dispose browser extension "'+t.name+'"',i)}))}catch(i){this.I.error('Failed to dispose browser extension "'+t.name+'"',i)}}}class il{constructor(t){this._instance=t}initialize(){}get(t){var i=this._instance.persistence;if("string"==typeof t)return null==i?void 0:i.get_property(t);var e={};for(var r of t){var s=null==i?void 0:i.get_property(r);et(s)||(e[r]=s)}return e}set(t,i){var e;null==(e=this._instance.persistence)||e.register("string"==typeof t?{[t]:i}:t)}remove(t){var i;null==(i=this._instance.persistence)||i.unregister(t)}}var el="extensionsRemoteConfig";class rl{constructor(t){this.Xn=!1,this.instance=t,this.I=Re,this.Eo=t.Io,this.kv=new il(t),this.onEvent=t=>go(this.instance.on("eventCaptured",(i=>{try{t({event:i.event,properties:i.properties})}catch(t){this.I.error("Browser extension event listener failed",t)}}))),this.onRemoteConfig=t=>{if(this.Xn)return go((()=>{}));var i=i=>{try{t(i)}catch(t){this.I.error("Browser extension remote config listener failed",t)}},e=this.instance.Ro.on(el,i);return this.Eo&&i(this.Eo),go(e)},this.Po=new tl(Re.createLogger("[BrowserExtensions]"),this)}get logger(){return this.I}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var t;return null!==(t=this.instance.get_property(Be))&&void 0!==t?t:this.distinctId}get deviceId(){var t=this.instance.get_property(Be);return"string"==typeof t?t:void 0}get library(){return{name:c.LIB_NAME,version:c.LIB_VERSION}}get initialPersonProperties(){var t,i;return null!==(t=null==(i=this.instance.persistence)?void 0:i.get_initial_props())&&void 0!==t?t:{}}get groups(){return this.instance.getGroups()}get session(){try{var t,i,e,r,s=null==(t=this.instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);return{sessionId:null!==(i=null==s?void 0:s.sessionId)&&void 0!==i?i:"",windowId:null!==(e=null==s?void 0:s.windowId)&&void 0!==e?e:"",sessionStartTimestamp:null!==(r=null==s?void 0:s.sessionStartTimestamp)&&void 0!==r?r:0}}catch(t){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(t){return this.Po.add(t)}capture(t,i,e){var r=this;return p((function*(){e?r.instance.capture(t,i,{timestamp:e.timestamp,uuid:e.uuid,$set:e.set,$set_once:e.setOnce}):r.instance.capture(t,i)}))()}registerDynamicEventProperties(t){return go(this.instance.Ao(t))}handleRemoteConfig(t){this.Xn||(this.Eo=t,this.instance.Ro.emit(el,t))}sendRequest(t,i){var e=this;return p((function*(){var r;void 0===i&&(i={});var s=e.instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",t),n={method:i.method,url:i.query?da(s,i.query):s,data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,timestampMode:i.sentAt};return"sendBeacon"===i.transport?(e.instance._send_request(n),{statusCode:202}):new Promise((t=>{n.callback=t,e.instance._send_request(n)}))}))()}dispose(){this.Xn||(this.Xn=!0,this.Po.dispose())}}var sl={},nl=0,ol=()=>{},al='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',ll="Surveys module not available",hl="sanitize_properties is deprecated. Use before_send instead",ul="Invalid value for property_denylist config: ",dl=["token","distinct_id",jr],vl="posthog",cl=!aa&&-1===(null==h?void 0:h.indexOf("MSIE"))&&-1===(null==h?void 0:h.indexOf("Mozilla")),fl=i=>{var e;return g({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:as(null==r?void 0:r.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ol,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=i?i:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:s&&rt(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,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:"https:"===(null==t||null==(e=t.location)?void 0:e.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(t){Re.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:Wr,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:xa},error_tracking:{},_onCapture:ol},(t=>({rageclick:t&&t>="2026-05-30"?{content_ignorelist:an,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),cookieWinsOnConflict:!(!t||"unset"===t||"2026-08-29">t)}))(i))},pl=[["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"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],gl=t=>{var i={};for(var e of pl){var r=e[0],s=e[1];et(t[r])||(i[s]=t[r])}var n=is({},i,t),o=t.__preview_external_dependency_versioned_paths;return et(o)||(et(t.strict_script_versioning)&&(n.strict_script_versioning=!!o),rt(o)&&et(t.asset_host)&&(n.asset_host=o)),X(t.property_blacklist)&&(et(t.property_denylist)?n.property_denylist=t.property_blacklist:X(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:Re.error(ul+t.property_denylist)),n};class _l{constructor(){this.__forceAllowLocalhost=!1}get Fo(){return this.__forceAllowLocalhost}set Fo(t){Re.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class ml{Lo(t,i){if(t){var e=this.To.indexOf(t);-1!==e&&this.To.splice(e,1)}return this.To.push(i),null==i.initialize||i.initialize(),i}Oo(){return this.config.cookieless_mode===qr||this.config.cookieless_mode===Ur&&this.consent.isRejected()}Do(){if(!this.Oo()&&this.get_distinct_id()===Dr){var t=this.persistence;if(t){this.$o()||t.load(!0);var i=this.get_distinct_id();if(!i||i===Dr){var e=this.config.get_device_id(gs());this.register({distinct_id:e,$device_id:e}),t.set_property(Cr,Hr)}this.No()}}}get decideEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}get flagsEndpointWasHit(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.hasLoadedFlags)&&void 0!==t&&t}constructor(){var t;this.webPerformance=new _l,this.qo=!1,this.version=c.LIB_VERSION,this.jo=new Set,this.Bo="",this.Ro=new Ca,this.To=[],this.Ho=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=fl(),this.SentryIntegration=On,this.sentryIntegration=t=>function(t,i){var e=An(t,i);return{name:Mn,processEvent:t=>e(t)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Uo=!1,this.zo=null,this.Wo=null,this.Vo=null,this.scrollManager=new $a(this),this.pageViewManager=new Dn(this),this.rateLimiter=new $o(this),this.requestRouter=new Va(this),this.consent=new js(this),this.externalIntegrations=new Za(this);var i=null!==(t=ml.__defaultExtensionClasses)&&void 0!==t?t:{};this.featureFlags=i.featureFlags&&new i.featureFlags(this),this.toolbar=i.toolbar&&new i.toolbar(this),this.surveys=i.surveys&&new i.surveys(this),this.conversations=i.conversations&&new i.conversations(this),this.logs=i.logs&&new i.logs(this),this.metrics=i.metrics&&new i.metrics(this),this.experiments=i.experiments&&new i.experiments(this),this.exceptions=i.exceptions&&new i.exceptions(this),this.people={set:(t,i,e)=>{var r=rt(t)?{[t]:i}:t;this.setPersonProperties(r),null==e||e({})},set_once:(t,i,e)=>{var r=rt(t)?{[t]:i}:t;this.setPersonProperties(void 0,r),null==e||e({})}},this.on("eventCaptured",(t=>Re.info('send "'+(null==t?void 0:t.event)+'"',t)))}init(t,i,e){if(e&&e!==vl){var r,s=null!==(r=sl[e])&&void 0!==r?r:new ml;return s._init(t,i,e),sl[e]=s,sl[vl][e]=s,s}return this._init(t,i,e)}_init(i,e,r){var s,n;void 0===e&&(e={});var o,a=rt(i)?i.trim():"";if(!a)return Re.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 a!==(null==(o=this.config)?void 0:o.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+a+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=fl(e.defaults),e.debug=this.Go(e.debug),this.Zo=e,this.Qo=[],e.person_profiles?this.Wo=e.person_profiles:e.process_person&&(this.Wo=e.process_person);var l=fl(e.defaults),h=gl(e),u=is({},l,h,{name:r,token:a});tt(l.rageclick)&&tt(h.rageclick)&&(u.rageclick=is({},l.rageclick,h.rageclick)),tt(l.session_recording)&&tt(h.session_recording)&&(u.session_recording=is({},l.session_recording,h.session_recording)),this.set_config(u),this.config.on_xhr_error&&Re.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=e.disable_compression?void 0:_o;var d=this.$o();if(this.persistence=new po(this.config,d),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new po(g({},this.config,{persistence:"sessionStorage"}),d,!1),this.Bo="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties","memory"!==this.config.persistence&&!d&&Ds.Nr()){var v=Ds.Br(this.Bo);X(v)&&v.forEach((t=>{rt(t)&&this.jo.add(t)}))}else Ds.qr(this.Bo);var f=g({},this.persistence.props),p=g({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Jo=new Sa((t=>this.Ko(t)),this.config.request_queue_config),this.Yo=new Ea(this),this.__request_queue=[];var _=this.Oo();if(_||(this.sessionManager=new Ia(this),this.sessionPropsManager=new Ta(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId(((t,i,e)=>{(null!=e&&e.activityTimeout||null!=e&&e.sessionPastMaximumLength||null!=e&&e.crossTabAdoption)&&this.Xo()}))),this.tl(),this.config.__preview_deferred_init_extensions?(Re.info("Deferring extension initialization to improve startup performance"),setTimeout((()=>{this.el(_)}),0)):(Re.info("Initializing extensions synchronously"),this.el(_)),c.DEBUG=c.DEBUG||this.config.debug,c.DEBUG&&Re.info("Starting in debug mode",{this:this,config:e,thisC:g({},this.config),p:f,s:p}),!this.config.identity_distinct_id||null!=(s=e.bootstrap)&&s.distinctID||(e.bootstrap=g({},e.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),void 0!==(null==(n=e.bootstrap)?void 0:n.distinctID)){var m=e.bootstrap.distinctID,y=this.get_distinct_id(),b=this.persistence.get_property(Cr);if(e.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===Hr)this.identify(m);else if(e.bootstrap.isIdentifiedID&&null!=y&&y!==m&&b===Vr)Re.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 w=this.config.get_device_id(gs()),x=e.bootstrap.isIdentifiedID?w:m;this.persistence.set_property(Cr,e.bootstrap.isIdentifiedID?Vr:Hr),this.register({distinct_id:m,$device_id:x})}}if(_)this.register_once({distinct_id:Dr,$device_id:null},"");else if(!this.get_distinct_id()){var S=this.config.get_device_id(gs());this.register_once({distinct_id:S,$device_id:S},""),this.persistence.set_property(Cr,Hr)}return ls(t,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),e.segment?function(t,i){var e=t.config.segment;if(!e)return i();!function(t,i){var e=t.config.segment;if(!e)return i();var r=e=>{var r=()=>e.anonymousId()||gs();t.config.get_device_id=r,e.id()&&(t.register({distinct_id:e.id(),$device_id:r()}),t.persistence.set_property(Cr,Vr)),i()},s=e.user();"then"in s&&Z(s.then)?s.then(r):r(s)}(t,(()=>{e.register((t=>{"undefined"!=typeof Promise&&Promise.resolve||In.warn("This browser does not have Promise support, and can not use the segment integration");var i=(i,e)=>{if(!e)return i;i.event.userId||i.event.anonymousId===t.get_distinct_id()||(In.info("No userId set, resetting PostHog"),t.reset()),i.event.userId&&i.event.userId!==t.get_distinct_id()&&(In.info("UserId set, identifying with PostHog"),t.identify(i.event.userId));var r=t.calculateEventProperties(e,i.event.properties);return i.event.properties=Object.assign({},r,i.event.properties),i};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:t=>i(t,t.event.event),page:t=>i(t,Jr),identify:t=>i(t,Qr),screen:t=>i(t,"$screen")}})(t)).then((()=>{i()}))}))}(this,(()=>this.il())):this.il(),Z(this.config._onCapture)&&this.config._onCapture!==ol&&(Re.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(t=>this.config._onCapture(t.event,t)))),this.config.ip&&Re.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.config.disableDeviceModel||function(){return Aa.apply(this,arguments)}().then((t=>{t&&this.register({[ze]:t})})).catch(ol),this}rl(t){var i=t;return rt(i.name)&&Z(i.setup)}nl(t,i){this.rl(t)?i.push((()=>{this.sl().add(t).catch(ol)})):this.To.push(t)}tl(){var t,i,e,r,s,n,o=null!==(t=null==(i=this.config.__extensionClasses)?void 0:i.featureFlags)&&void 0!==t?t:null==(e=ml.__defaultExtensionClasses)?void 0:e.featureFlags;o&&(this.featureFlags&&this.featureFlags instanceof o||(null==(r=this.al)||r.call(this),this.al=void 0,this.featureFlags=new o(this)),Z(this.featureFlags.onReloading)&&Z(this.featureFlags.setup)?this.al||(this.al=this.featureFlags.onReloading((()=>{this.Ro.emit("featureFlagsReloading",!0)})),this.sl().add(this.featureFlags)):null==(s=(n=this.featureFlags).initialize)||s.call(n))}el(t){var i,e,r,s,n,o,a,l=performance.now(),h=g({},ml.__defaultExtensionClasses,this.config.__extensionClasses),u=[];h.exceptions&&this.To.push(this.exceptions=null!==(i=this.exceptions)&&void 0!==i?i:new h.exceptions(this)),h.historyAutocapture&&this.To.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.To.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.To.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!t&&this.To.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||u.push((()=>{this.scrollManager.startMeasuringScrollPosition()})),h.autocapture&&this.nl(this.autocapture=new h.autocapture(this),u),h.surveys&&this.nl(this.surveys=null!==(e=this.surveys)&&void 0!==e?e:new h.surveys(this),u),h.logs&&this.To.push(this.logs=null!==(r=this.logs)&&void 0!==r?r:new h.logs(this)),h.metrics&&this.To.push(this.metrics=null!==(s=this.metrics)&&void 0!==s?s:new h.metrics(this)),h.conversations&&this.To.push(this.conversations=null!==(n=this.conversations)&&void 0!==n?n:new h.conversations(this)),h.productTours&&this.To.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.To.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.To.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.To.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.To.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,Fn)),h.toolbar&&this.To.push(this.toolbar=null!==(o=this.toolbar)&&void 0!==o?o:new h.toolbar(this)),h.experiments&&this.To.push(this.experiments=null!==(a=this.experiments)&&void 0!==a?a:new h.experiments(this)),this.To.forEach((t=>{t.initialize&&u.push((()=>{null==t.initialize||t.initialize()}))})),u.push((()=>{if(this.ol){var t=this.ol;this.ol=void 0,this.To.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}})),this.ll(u,l)}ll(t,i){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-i>=30&&t.length>0)return void setTimeout((()=>{this.ll(t,i)}),0);var e=t.shift();if(e)try{e()}catch(t){Re.error("Error initializing extension:",t)}}var r=Math.round(performance.now()-i);this.register_for_session({[Lr]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Nr]:r}),this.config.__preview_deferred_init_extensions&&Re.info("PostHog extensions initialized ("+r+"ms)")}pa(t){var i;if(!r||!r.body)return Re.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.pa(t)}),500);if(this.config.__preview_deferred_init_extensions&&(this.ol=t),this.Io=t,this.compression=void 0,t.ok){var e,s=t.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=V(s.supportedCompression,_o)?_o:V(s.supportedCompression,mo)?mo:void 0),null!=(e=s.analytics)&&e.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.Wo?this.Wo:Wr}),null==(i=this.ul)||i.handleRemoteConfig(t),this.To.forEach((i=>null==i.onRemoteConfig?void 0:i.onRemoteConfig(t)))}il(){try{this.config.loaded(this)}catch(t){Re.critical("`loaded` function failed",t)}if(this.hl(),this.config.internal_or_test_user_hostname&&null!=s&&s.hostname){var t=s.hostname,i=this.config.internal_or_test_user_hostname;("string"==typeof i?t===i:i.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.Oo())&&this.dl()}),1),this.vl=new To(this),this.vl.load()}hl(){var t;this.is_capturing()&&this.config.request_batching&&(null==(t=this.Jo)||t.enable())}_dom_loaded(){this.is_capturing()&&Zr(this.__request_queue,(t=>this.Ko(t))),this.__request_queue=[],this.hl()}_handle_unload(){var t,i,e,r,s;null==(t=this.surveys)||null==t.handlePageUnload||t.handlePageUnload(),null==(i=this.metrics)||i.flush("sendBeacon"),this.config.request_batching?(this.cl()&&this.capture(Yr),null==(e=this.logs)||e.flushLogs("sendBeacon"),null==(r=this.Jo)||r.unload(),null==(s=this.Yo)||s.unload()):this.cl()&&this.capture(Yr,null,{transport:"sendBeacon"})}_send_request(t){this.__loaded?cl?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=g({},this.config.request_headers,t.headers),t.compression="best-available"===t.compression?this.compression:t.compression,(et(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 i,e,r,s=g({},t);s.timeout=s.timeout||6e4;var n,o,a,h,u,d=null!==(i=s.transport)&&void 0!==i?i:"fetch";"sendBeacon"===d&&et(s.compression)&&s.data&&(s.compression=mo),"POST"===s.method&&s.data&&("capture-body"===s.timestampMode?s.data={api_key:null!==(o=null==(u=(h=(X(n=s.data)?n:[n]).map((t=>g({},t,t.timestamp instanceof Date&&!isNaN(t.timestamp.getTime())?{timestamp:t.timestamp.toISOString()}:{}))))[0])||null==(a=u.properties)?void 0:a.token)&&void 0!==o?o:null==u?void 0:u.token,batch:h,sent_at:(new Date).toISOString()}:"body"===s.timestampMode&&(s.data=function(t,i){return void 0===i&&(i=(new Date).toISOString()),X(t)?t.map((t=>g({},t,{sent_at:i}))):g({},t,{sent_at:i})}(s.data))),s.url=ba(s.url,s.method,s.compression,s.timestampMode);var v=wa.filter((t=>!s.disableTransport||!t.transport||!s.disableTransport.includes(t.transport))),c=null!==(e=null==(r=function(t,i){for(var e=0;t.length>e;e++)if(t[e].transport===d)return t[e]}(v))?void 0:r.method)&&void 0!==e?e:v[0].method;if(!c)throw new Error("No available transport method");var f=t=>{try{c(t)}catch(t){_a(t)?Re.warn(t):Re.error(t),null==s.callback||s.callback({statusCode:0,error:t})}};"sendBeacon"!==d&&s.data&&s.compression===_o&&l&&"undefined"!=typeof Promise&&!ha?pa(s).then((t=>{f(t)})).catch((i=>{if(R(i))return ha=!0,void f(g({},s,{compression:void 0,url:ba(t.url,t.method,void 0,t.timestampMode)}));(t=>{if(!t||"object"!=typeof t)return!1;var i="name"in t?String(t.name):"";return R(t)||i===T})(i)&&(ha=!0),f(s)})):c(s)})(g({},t,{callback:i=>{var e,r;this.rateLimiter.checkForLimiting(i),400>i.statusCode||null==(e=(r=this.config).on_request_error)||e.call(r,i),null==t.callback||t.callback(i)}}))):t.fireCallbackOnDrop&&(null==t.callback||t.callback({statusCode:0}))}Ko(t){this.Yo?this.Yo.retriableRequest(t):this._send_request(t)}_execute_array(t){nl++;try{var i,e=[],r=[],s=[];Zr(t,(t=>{if(t)if(X(i=t[0]))s.push(t);else if(Z(t))try{t.call(this)}catch(i){Re.error("Error executing queued PostHog call",t,i)}else X(t)&&"alias"===i?e.push(t):X(t)&&-1!==i.indexOf("capture")&&Z(this[i])?s.push(t):r.push(t)}));var n=function(t,i){Zr(t,(function(t){try{if(X(t[0])){var e=i;ts(t,(function(t){e=e[t[0]].apply(e,t.slice(1))}))}else i[t[0]].apply(i,t.slice(1))}catch(i){Re.error("Error executing queued PostHog call",t,i)}}))};n(e,this),n(r,this),n(s,this)}finally{nl--}}push(t){if(nl>0&&X(t)&&rt(t[0])){var i=ml.prototype[t[0]];Z(i)&&i.apply(this,t.slice(1))}else this._execute_array([t])}capture(t,i,e){var r,s,n,o,a;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Jo){if(this.is_capturing())if(!et(t)&&rt(t)){this.Do();var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var h=null!=e&&e.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==h||!h.isRateLimited){null!=i&&i.$current_url&&!rt(null==i?void 0:i.$current_url)&&(Re.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==i||delete i.$current_url),"$exception"!==t||null!=e&&e.fl||Re.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 u=new Date,d=(null==e?void 0:e.timestamp)||u,v=Ti(null==e?void 0:e.uuid,gs),c={uuid:v,event:t,properties:this.calculateEventProperties(t,i||{},d,v)};t===Jr&&this.config.__preview_capture_bot_pageviews&&l&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),h&&(c.properties.$lib_rate_limit_remaining_tokens=h.remainingTokens);var f="$feature_flag_called"===t&&!1===c.properties.$feature_flag_has_experiment&&!0===this.get_property(cr);(null==e?void 0:e.$set)&&!f&&(c.$set=null==e?void 0:e.$set);var p=null==e?void 0:e.$unset;p&&(c.$unset=p);var _,m,y,b=f?void 0:this.pl(null==e?void 0:e.$set_once,t!==Xr,t===Qr);if(b&&(c.$set_once=b),null!=e&&e._noTruncate||(s=this.config.properties_string_max_length,n=c,o=t=>rt(t)?t.slice(0,s):t,a=new Set,c=function t(i,e){if(i!==Object(i))return o?o(i):i;if(!a.has(i)){var r;if(a.add(i),X(i))r=[],Zr(i,(i=>{r.push(t(i))}));else{var s={};ts(i,((i,e)=>{a.has(i)||(s[e]=t(i,e))})),r=s}return r}}(n)),c.timestamp=d,et(null==e?void 0:e.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=u),f&&(c.properties=function(t,i){void 0===i&&(i=[]);var e={},r=i=>{void 0!==t[i]&&(e[i]=t[i])};return x.forEach(r),i.forEach(r),e}(c.properties,dl)),t===xo||t===So){var w=null==i?void 0:i.$survey_id,S=null==i?void 0:i.$survey_iteration;Ka({id:w,current_iteration:S}),c.$set=g({},c.$set,{[(_={id:w,current_iteration:S},m=t===So?"responded":"dismissed",y="$survey_"+m+"/"+_.id,_.current_iteration&&_.current_iteration>0&&(y="$survey_"+m+"/"+_.id+"/"+_.current_iteration),y)]:!0})}else t===wo&&(c.$set=g({},c.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===t){var k=null==i?void 0:i.$product_tour_type;k&&(c.$set=g({},c.$set,{["$product_tour_last_seen_date/"+k]:(new Date).toISOString()}))}var E=g({},c.properties.$set,c.$set);if(it(E)||this.setPersonPropertiesForFlags(E),!ot(this.config.before_send)){var P=this.kn(c);if(!P)return;(c=P).uuid=Ti(c.uuid,gs)}this.Ro.emit("eventCaptured",c);var T=null!==(r=null==e?void 0:e._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),C={method:"POST",url:T,data:c,compression:"best-available",timestampMode:"recordings"===(null==e?void 0:e._batchKey)||/\/s\/(?:\?|$)/.test(T)?"body":"capture-body",batchKey:null==e?void 0:e._batchKey,transport:null==e?void 0:e.transport};return!this.config.request_batching||e&&(null==e||!e._batchKey)||null!=e&&e.send_instantly?this.Ko(C):this.Jo.enqueue(C),c}Re.critical("This capture call is ignored due to client rate limiting.")}}else Re.error("No event name provided to posthog.capture")}else Re.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",(i=>t(i.event,i)))}sl(){var t;return null!==(t=this.ul)&&void 0!==t?t:this.ul=new rl(this)}Ao(t){this.Ho.push(t);var i=!0;return()=>{if(i){i=!1;var e=this.Ho.indexOf(t);-1!==e&&this.Ho.splice(e,1)}}}gl(t){var i,e,r;return void 0===t&&(t=!0),!(null==(i=this.persistence)||!i.consumeCookieIdentityChange())&&(this.Vo=null,this.persistence.get_property(Cr)===Hr&&(null==(r=this.sessionPersistence)||r.clear(),this.jo.clear(),this.ml()),null==(e=this.featureFlags)||e.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(i,e,n,o,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return e;this.persistence.syncCookieProperties(),this.gl();var l=a?void 0:this.persistence.remove_event_timer(i),u=g({},e);if(u.token=this.config.token,u.$config_defaults=this.config.defaults,this.Oo()&&(u[jr]=!0),"$snapshot"===i){var d=g({},this.persistence.properties(),this.sessionPersistence.properties());return u.distinct_id=d.distinct_id,(!rt(u.distinct_id)&&!at(u.distinct_id)||st(u.distinct_id))&&Re.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),u}var v,f=function(i,e,r,n){var o,a,l,u;if(void 0===n&&(n=!1),!h)return{};var d,v=i?[...Jn,...e||[]]:[],f=function(t){for(var i=0;Ei.length>i;i++){var e=Ei[i],r=e[1],s=e[0].exec(t),n=s&&(Z(r)?r(s,t):r);if(n)return n}return["",""]}(h),p=f[0],g=f[1],_=null!=(d="undefined"!=typeof navigator?navigator:void 0)&&d.brave?{brave:!0}:{},m={};et(r)||(m.detectGoogleSearchApp=r);var y={},b=null==(o=navigator)||null==(o=o.userAgentData)?void 0:o.platform,w=null==(a=navigator)?void 0:a.maxTouchPoints,x=null==t||null==(l=t.screen)?void 0:l.width,S=null==t||null==(u=t.screen)?void 0:u.height,k=null==t?void 0:t.devicePixelRatio;et(b)||(y.userAgentDataPlatform=b),et(w)||(y.maxTouchPoints=w),et(x)||(y.screenWidth=x),et(S)||(y.screenHeight=S),et(k)||(y.devicePixelRatio=k);var E,P,T,C,F,R,I,M,A=is(ns({$os:p,$os_version:g,$browser:xi(h,navigator.vendor,_,m),$device:$i(h),$device_type:(P=h,T=y,M=$i(P),M===Tt||M===Pt||"Kobo"===M||"Kindle Fire"===M||M===si?$t:M===Gt||M===Jt||M===Kt||M===ii?"Console":M===Ft?"Wearable":M?St:"Android"===(null==T?void 0:T.userAgentDataPlatform)&&(null!==(C=null==T?void 0:T.maxTouchPoints)&&void 0!==C?C:0)>0?600>Math.min(null!==(F=null==T?void 0:T.screenWidth)&&void 0!==F?F:0,null!==(R=null==T?void 0:T.screenHeight)&&void 0!==R?R:0)/(null!==(I=null==T?void 0:T.devicePixelRatio)&&void 0!==I?I:1)?St:$t:"Desktop"),$timezone:ao(),$timezone_offset:lo()}),{$current_url:Hn(n?Ci(null==s?void 0:s.href):null==s?void 0:s.href,v,Qn),$host:null==s?void 0:s.host,$pathname:null==s?void 0:s.pathname,$raw_user_agent:h.length>1e3?h.substring(0,997)+"...":h,$browser_version:ki(h,navigator.vendor,_,m),$browser_language:eo(),$browser_language_prefix:(E=eo(),"string"==typeof E?E.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:c.LIB_NAME,$lib_version:c.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return c.SDK_DIST_CHANNEL&&(A.$sdk_dist_channel=c.SDK_DIST_CHANNEL),A}(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 p=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime(),!0),_=p.windowId;u.$session_id=p.sessionId,u.$window_id=_}this.sessionPropsManager&&is(u,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&is(u,this.sessionRecording.sdkDebugProperties),u.$sdk_debug_retry_queue_size=null==(m=this.Yo)?void 0:m.length}catch(t){u.$sdk_debug_error_capturing_properties=String(t)}if(this.requestRouter.region===za&&(u.$lib_custom_api_host=this.config.api_host),v=i!==Jr||a?i!==Yr||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,o),u=is(u,v),i===Jr&&r&&(u.title=r.title),!et(l)){var y=n.getTime()-l;u.$duration=parseFloat((y/1e3).toFixed(3))}h&&this.config.opt_out_useragent_filter&&(u.$browser_type=this._is_bot()?"bot":"browser");var b=this.persistence.properties(),w=this.sessionPersistence.properties();ts(["$referrer","$referring_domain"],(t=>{t in b&&delete w[t]}));var x={};if(this.Ho.length>0)for(var S of this.Ho.slice())try{is(x,S())}catch(t){Re.error("Failed to produce browser extension event properties",t)}(u=is({},f,b,w,g({},x,u))).$is_identified=this._isIdentified(),X(this.config.property_denylist)?ts(this.config.property_denylist,(function(t){delete u[t]})):Re.error(ul+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var k=this.config.sanitize_properties;k&&(Re.error(hl),u=k(u,i));var E=this.yl();return u.$process_person_profile=E,E&&!a&&this.bl("_calculate_event_properties"),u}pl(t,i,e){var r;if(void 0===i&&(i=!0),void 0===e&&(e=!1),!this.persistence||!this.yl())return t;if(this.qo&&!e)return t;var s=this.persistence.get_initial_props(),n=null==(r=this.sessionPropsManager)?void 0:r.getSetOnceProps(),o=is({},s,n||{},t||{}),a=this.config.sanitize_properties;return a&&(Re.error(hl),o=a(o,"$set_once")),i&&(this.qo=!0),it(o)?void 0:o}register(t,i){var e;null==(e=this.persistence)||e.register(t,i)}register_once(t,i,e){var r;null==(r=this.persistence)||r.register_once(t,i,e)}register_for_session(t){var i,e;null==(i=this.persistence)||i.syncCookieProperties(),this.gl(),null==(e=this.sessionPersistence)||e.register(t),Object.keys(t).forEach((t=>this.jo.add(t))),this.ml()}unregister(t){var i;null==(i=this.persistence)||i.unregister(t)}unregister_for_session(t){var i;null==(i=this.sessionPersistence)||i.unregister(t),this.jo.delete(t),this.ml()}_l(t,i){this.register({[t]:i})}Xo(){this.jo.forEach((t=>{var i;null==(i=this.sessionPersistence)||i.unregister(t)})),this.jo.clear(),this.ml()}ml(){var t;if(this.Bo)if("memory"===this.config.persistence||null!=(t=this.sessionPersistence)&&t.Hs||!Ds.Nr())Ds.qr(this.Bo);else{var i=[];this.jo.forEach((t=>i.push(t))),i.length>0?Ds.Dr(this.Bo,i):Ds.qr(this.Bo)}}getFeatureFlag(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlag(t,i)}getFeatureFlagPayload(t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagPayload(t)}getFeatureFlagResult(t,i){var e;return null==(e=this.featureFlags)?void 0:e.getFeatureFlagResult(t,i)}getAllFeatureFlags(){var t,i;return null!==(t=null==(i=this.featureFlags)?void 0:i.getAllFeatureFlags())&&void 0!==t?t:[]}isFeatureEnabled(t,i){var e,r;return null!==(e=null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(t,i))&&void 0!==e?e:null==i?void 0:i.defaultValue}reloadFeatureFlags(){var t;null==(t=this.featureFlags)||t.reloadFeatureFlags()}updateFlags(t,i,e){var r;null==(r=this.featureFlags)||r.updateFlags(t,i,e)}updateEarlyAccessFeatureEnrollment(t,i,e){var r;null==(r=this.featureFlags)||r.updateEarlyAccessFeatureEnrollment(t,i,e)}getEarlyAccessFeatures(t,i,e){var r;return void 0===i&&(i=!1),null==(r=this.featureFlags)?void 0:r.getEarlyAccessFeatures(t,i,e)}on(t,i){return this.Ro.on(t,i)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:ll}),()=>{})}onSessionId(t){var i,e;return null!==(i=null==(e=this.sessionManager)?void 0:e.onSessionId(t))&&void 0!==i?i:()=>{}}getSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getSurveys(t,i):t([],{isLoaded:!1,error:ll})}getActiveMatchingSurveys(t,i){void 0===i&&(i=!1),this.surveys?this.surveys.getActiveMatchingSurveys(t,i):t([],{isLoaded:!1,error:ll})}renderSurvey(t,i){var e;null==(e=this.surveys)||e.renderSurvey(t,i)}displaySurvey(t,i){var e;void 0===i&&(i=Ya),null==(e=this.surveys)||e.displaySurvey(t,i)}cancelPendingSurvey(t){var i;null==(i=this.surveys)||i.cancelPendingSurvey(t)}canRenderSurvey(t){var i,e;return null!==(i=null==(e=this.surveys)?void 0:e.canRenderSurvey(t))&&void 0!==i?i:{visible:!1,disabledReason:ll}}canRenderSurveyAsync(t,i){var e,r;return void 0===i&&(i=!1),null!==(e=null==(r=this.surveys)?void 0:r.canRenderSurveyAsync(t,i))&&void 0!==e?e:Promise.resolve({visible:!1,disabledReason:ll})}wl(t){return!t||st(t)?(Re.critical("Unique user id has not been set in posthog.identify"),!1):t===Dr?(Re.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())||(Re.critical('The string "'+t+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(t,i,e){if(!this.__loaded||!this.persistence)return Re.uninitializedWarning("posthog.identify");if(at(t)&&(t=t.toString(),Re.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.wl(t)&&this.bl("posthog.identify")){this.Do();var r=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==r,n=this.gl(!1),o=this.persistence.Ws(),a=!1;try{var l=this.get_distinct_id();this.register({$user_id:t}),this.get_property(Be)||this.register_once({$had_persisted_distinct_id:!0,$device_id:l},""),t!==l&&t!==this.get_property(Ue)&&(this.unregister(Ue),this.register({distinct_id:t}));var h,u=(this.persistence.get_property(Cr)||Hr)===Hr,d=t!==l,v=!d&&u;if(d&&u)this.persistence.set_property(Cr,Vr),this.setPersonPropertiesForFlags({$set:i||{},$set_once:e||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture(Qr,{distinct_id:t,$anon_distinct_id:l},{$set:i||{},$set_once:e||{}}),this.Vo=Ba(t,i,e),null==(h=this.featureFlags)||h.setAnonymousDistinctId(l);else if(v){this.persistence.set_property(Cr,Vr);var c=i||{},f=e||{};this.setPersonPropertiesForFlags({$set:c,$set_once:f},!1),this.config.cookieWinsOnConflict&&this.persistence.Vs(),this.capture("$set",{$set:c,$set_once:f}),this.Vo=Ba(t,i,e)}else(i||e)&&this.setPersonProperties(i,e);d||s||n?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(Er)):v&&(i||e)&&this.reloadFeatureFlags(),a=!0}finally{o&&this.persistence.Qs(a)}}}setPersonProperties(t,i){if((t||i)&&this.bl("posthog.setPersonProperties")){var e=Ba(this.get_distinct_id(),t,i);this.Vo!==e?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!0),this.capture("$set",{$set:t||{},$set_once:i||{}}),this.Vo=e):Re.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(t){var i,e=(X(t)?t:[t]).filter((t=>rt(t)&&t.length>0));0!==e.length&&this.bl("posthog.unsetPersonProperties")&&(null==(i=this.featureFlags)||i.unsetPersonPropertiesForFlags(e,!0),this.capture("$set",{$unset:e}),this.Vo=null)}group(t,i,e){var r;if(t&&i){null==(r=this.persistence)||r.syncCookieProperties(),this.gl();var s=this.getGroups(),n=s[t]!==i;if(n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:g({},s,{[t]:i})}),n||e){var o={$group_type:t,$group_key:i};e&&(o.$group_set=e),this.capture(Xr,o)}e&&this.setGroupPropertiesForFlags({[t]:e}),n&&!e&&this.reloadFeatureFlags()}else Re.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),null==(e=this.featureFlags)||e.setPersonPropertiesForFlags(t,i)}resetPersonPropertiesForFlags(t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,i){var e;void 0===i&&(i=!0),this.bl("posthog.setGroupPropertiesForFlags")&&(null==(e=this.featureFlags)||e.setGroupPropertiesForFlags(t,i))}resetGroupPropertiesForFlags(t){var i;null==(i=this.featureFlags)||i.resetGroupPropertiesForFlags(t)}reset(t){var i=ht(t)?t:null==t?void 0:t.resetDeviceID,e=ht(t)||null==t?void 0:t.bootstrap;this.kl(i,!1,e)}kl(t,i,e){var r,s,n;if(void 0===i&&(i=!1),Re.info("reset"),!this.__loaded)return Re.uninitializedWarning("posthog.reset");var o=null==e?void 0:e.sessionID;this.config.bootstrap=e||(null==(r=this.Zo)?void 0:r.bootstrap)||{},null==(s=this.featureFlags)||null==s.updateConfig||s.updateConfig(this.config,this.ma());var a=this.get_property(Be),l=this.get_property(ze),h=this.get_property(Ze),u=this.is_capturing();this.consent.reset(),i||!u||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");var d=null==(n=this.persistence)||null==n.Ws?void 0:n.Ws(),v=!1;try{var c,f,p,_,m,y,b,w,x,S,k,E,P,T;if(null==(c=this.persistence)||c.clear(),null==(f=this.sessionPersistence)||f.clear(),this.jo.clear(),this.ml(),et(h)||null==(k=this.persistence)||k.register({[Ze]:h}),null==(p=this.surveys)||p.reset(),null==(_=this.vl)||_.stop(),null==(m=this.featureFlags)||m.reset(),null==(y=this.conversations)||y.reset(),null==(b=this.logs)||b.reset(),null==(w=this.metrics)||w.reset(),null==(x=this.persistence)||x.set_property(Cr,Hr),null==(S=this.sessionManager)||S.resetSessionId(),this.Vo=null,this.config.cookieless_mode===qr)this.register_once({distinct_id:Dr,$device_id:null},"");else{var C=this.config.get_device_id(gs());this.register_once({distinct_id:C,$device_id:t?C:a},""),t||et(l)||this.register({[ze]:l})}if(this.register({$last_posthog_reset:(new Date).toISOString()},1),e)if(void 0===e.distinctID||this.Oo()||(null==(T=this.persistence)||T.set_property(Cr,e.isIdentifiedID?Vr:Hr),this.register({distinct_id:e.distinctID})),null==(E=this.featureFlags)||E.initialize(),!(et(o)||null!=(P=this.sessionManager)&&P.setBootstrapSessionId(o,!0))){var F=g({},e);delete F.sessionID,this.config.bootstrap=F}delete this.config.identity_distinct_id,delete this.config.identity_hash,v=!0}finally{var R;d&&(null==(R=this.persistence)||null==R.Qs||R.Qs(v))}this.reloadFeatureFlags()}shutdown(t){var i=this;return p((function*(){var t,e,r,s,n,o;if(i.__loaded){null==(t=i.vl)||t.stop(),i.sl().dispose(),null==(e=i.sessionRecording)||e.dispose(),null==(r=i.logs)||r.flushLogs("sendBeacon"),null==(s=i.metrics)||s.flush("sendBeacon"),null==(n=i.Jo)||n.unload(),null==(o=i.Yo)||o.unload();try{var a;null==(a=i.featureFlags)||a.destroy()}catch(t){Re.error("Error while destroying feature flags",t)}}else Re.uninitializedWarning("posthog.shutdown")}))()}setIdentity(t,i){var e;this.config.identity_distinct_id=t,this.config.identity_hash=i,this.alias(t),null==(e=this.conversations)||e.Sl()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(t=this.conversations)||t.xl()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==t?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var i=this.sessionManager.checkAndGetSessionAndWindowId(!0),e=i.sessionStartTimestamp,r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+i.sessionId);if(null!=t&&t.withTimestamp&&e){var s,n=null!==(s=t.timestampLookBack)&&void 0!==s?s:10;if(!e)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-e)/1e3)-n,0)}return r}alias(t,i){return t===this.get_property(Le)?(Re.critical("Attempting to create alias for existing People user - aborting."),-2):this.bl("posthog.alias")?(et(i)&&(i=this.get_distinct_id()),t!==i?(this._l(Ue,t),this.capture("$create_alias",{alias:t,distinct_id:i})):(Re.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var i=g({},this.config);if(tt(t)){var e,r,s,n,o,a,l,h,u,d,v,f;is(this.config,gl(t));var p=this.$o();null==(e=this.persistence)||e.update_config(this.config,i,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new po(g({},this.config,{persistence:"sessionStorage"}),p,!1);var _,m=this.Go(this.config.debug);ht(m)&&(this.config.debug=m),ht(this.config.debug)&&(this.config.debug?(c.DEBUG=!0,xs.Nr()&&xs.Dr("ph_debug",!0),Re.info("set_config",{config:t,oldConfig:i,newConfig:g({},this.config)})):(c.DEBUG=!1,xs.Nr()&&xs.qr("ph_debug"))),null==(r=this.featureFlags)||null==r.updateConfig||r.updateConfig(this.config,this.ma()),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(n=this.exceptions)||n.onConfigChange(),null==(o=this.sessionRecording)||o.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(l=this.autocapture)||l.startIfEnabled(),null==(h=this.heatmaps)||h.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&(null==(_=this.historyAutocapture)||_.startIfEnabledOrStop()),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(d=this.deadClicksAutocapture)||d.startIfEnabledOrStop(),null==(v=this.surveys)||v.loadIfEnabled(),this.No(),null==(f=this.externalIntegrations)||f.startIfEnabledOrStop()}}_overrideSDKInfo(t,i){c.LIB_NAME=t,c.LIB_VERSION=i}startSessionRecording(t){var i,e,r,s,n,o=!0===t,a={sampling:o||!(null==t||!t.sampling),linked_flag:o||!(null==t||!t.linked_flag),url_trigger:o||!(null==t||!t.url_trigger),event_trigger:o||!(null==t||!t.event_trigger)};Object.values(a).some(Boolean)&&(null==(i=this.sessionManager)||i.checkAndGetSessionAndWindowId(),a.sampling&&(null==(e=this.sessionRecording)||e.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event")));this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!(null==(t=this.sessionRecording)||!t.started)}captureException(t,i){if(this.exceptions){var e=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(t,{handled:!0,syntheticException:e});return this.exceptions.sendExceptionEvent(g({},r,i))}}addExceptionStep(t,i){var e;null==(e=this.exceptions)||e.addExceptionStep(t,i)}captureLog(t){var i;null==(i=this.logs)||i.captureLog(t)}get logger(){var t,i;return null!==(t=null==(i=this.logs)?void 0:i.logger)&&void 0!==t?t:ml.Cl}startExceptionAutocapture(t){this.set_config({capture_exceptions:null==t||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var i,e;return null!==(i=null==(e=this.toolbar)?void 0:e.loadToolbar(t))&&void 0!==i&&i}get_property(t){var i;return null==(i=this.persistence)?void 0:i.props[t]}getSessionProperty(t){var i;return null==(i=this.sessionPersistence)?void 0:i.props[t]}toString(){var t,i=null!==(t=this.config.name)&&void 0!==t?t:vl;return i!==vl&&(i=vl+"."+i),i}_isIdentified(){var t,i;return(null==(t=this.persistence)?void 0:t.get_property(Cr))===Vr||(null==(i=this.sessionPersistence)?void 0:i.get_property(Cr))===Vr}yl(){var t,i;return!("never"===this.config.person_profiles||this.config.person_profiles===Wr&&!this._isIdentified()&&it(this.getGroups())&&(null==(t=this.persistence)||null==(t=t.props)||!t[Ue])&&(null==(i=this.persistence)||null==(i=i.props)||!i[Or]))}cl(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&!!this.config.capture_pageview}createPersonProfile(){this.yl()||this.bl("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bl("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bl(t){return"never"===this.config.person_profiles?(Re.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._l(Or,!0),!0)}$o(){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)}No(){var t,i,e,r,s=this.$o();return(null==(t=this.persistence)?void 0:t.Hs)!==s&&(null==(e=this.persistence)||e.set_disabled(s)),(null==(i=this.sessionPersistence)?void 0:i.Hs)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s&&(this.jo.clear(),this.ml()),s}opt_in_capturing(t){var i;if(this.config.cookieless_mode!==qr){if(this.Oo()){var e,r,s,n,o;this.kl(!0,!0),null==(e=this.sessionManager)||e.destroy(),null==(r=this.pageViewManager)||r.destroy(),this.sessionManager=new Ia(this),this.pageViewManager=new Dn(this),this.persistence&&(this.sessionPropsManager=new Ta(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=ml.__defaultExtensionClasses)?void 0:o.sessionRecording;l&&(this.sessionRecording=this.Lo(this.sessionRecording,new l(this)),this.Io&&(null==(a=this.sessionRecording)||null==a.onRemoteConfig||a.onRemoteConfig(this.Io)))}var h,u;this.consent.optInOut(!0),this.No(),this.hl(),null==(i=this.sessionRecording)||i.startIfEnabledOrStop(),this.config.cookieless_mode==Ur&&(null==(h=this.surveys)||h.loadIfEnabled()),(et(null==t?void 0:t.captureEventName)||null!=t&&t.captureEventName)&&this.capture(null!==(u=null==t?void 0:t.captureEventName)&&void 0!==u?u:"$opt_in",null==t?void 0:t.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.dl()}else Re.warn(al)}opt_out_capturing(){var t,i,e;this.config.cookieless_mode!==qr?(this.config.cookieless_mode===Ur&&this.consent.isOptedIn()&&this.kl(!0,!0),this.consent.optInOut(!1),this.No(),this.config.cookieless_mode===Ur&&(this.register({distinct_id:Dr,$device_id:null}),null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,null==(i=this.sessionManager)||i.destroy(),null==(e=this.pageViewManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.dl(),this.hl())):Re.warn(al)}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===qr||(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.No()}_is_bot(){return e?Ma(e,this.config.custom_blocked_useragents):void 0}dl(){r&&("visible"===r.visibilityState?this.Uo||(this.Uo=!0,this.capture(Jr,{title:r.title},{send_instantly:!0}),this.zo&&(r.removeEventListener(Gr,this.zo),this.zo=null)):this.zo||(this.zo=this.dl.bind(this),ls(r,Gr,this.zo)))}debug(i){!1===i?(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}))}ma(){var t=this.Zo||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(Re.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):function(t,i,e,r,s){var n=i in t&&!ot(t[i]),o=e in t&&!ot(t[e]);return n?t[i]:!!o&&(s&&s.warn("Config field '"+e+"' is deprecated. Please use '"+i+"' instead. The old field will be removed in a future major version."),t[e])}(t,"advanced_disable_flags","advanced_disable_decide",0,Re)}kn(t){var i;if(ot(this.config.before_send))return t;var e=Object.keys(null!==(i=t.properties)&&void 0!==i?i:{}).filter(vt),r=X(this.config.before_send)?this.config.before_send:[this.config.before_send],s=t;for(var n of r)try{if(s=n(s),ot(s)){var o="Event '"+t.event+"' was rejected in beforeSend function";return dt(t.event)?Re.warn(o+". This can cause unexpected behavior."):Re.info(o),null}s.properties&&!it(s.properties)||Re.warn("Event '"+t.event+"' has no properties after beforeSend function, this is likely an error.")}catch(i){return Re.error("Error in beforeSend function for event '"+t.event+"':",i),null}for(var a of e)if(s.properties&&ot(s.properties[a]))return Re.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.Ss)?void 0:t.pageViewId}captureTraceFeedback(t,i){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:i})}captureTraceMetric(t,i,e){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:i,$ai_metric_value:String(e)})}Go(t){var i=ht(t)&&!t,e=xs.Nr()&&"true"===xs.Pr("ph_debug");return!i&&(!!e||t)}}ml.__defaultExtensionClasses={},ml.Cl=(()=>{var t=()=>{};return{trace:t,debug:t,info:t,warn:t,error:t,fatal:t}})(),function(t,i){for(var e=0;i.length>e;e++)t.prototype[i[e]]=ss(t.prototype[i[e]])}(ml,["identify"]);class yl{constructor(t){this.disabled=!1===t;var i=tt(t)?t:{};this.thresholdPx=i.threshold_px||30,this.timeoutMs=i.timeout_ms||1e3,this.clickCount=i.click_count||3,this.clicks=[]}isRageClick(t,i,e){if(this.disabled)return!1;var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(t-r.x)+Math.abs(i-r.y)<this.thresholdPx&&this.timeoutMs>e-r.timestamp){if(this.clicks.push({x:t,y:i,timestamp:e}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:t,y:i,timestamp:e}];return!1}}var bl="$copy_autocapture",wl=Ie("[AutoCapture]");function xl(t,i){return i.length>t?i.slice(0,t)+"...":i}function Sl(t){if(t.previousElementSibling)return t.previousElementSibling;var i=t;do{i=i.previousSibling}while(i&&!Hs(i));return i}function kl(i,e){var r,s,n=e.e,o=e.maskAllElementAttributes,a=e.maskAllText,l=e.elementAttributeIgnoreList,h=e.elementsChainAsString,u=e.disableCaptureUrlHashes;if(!Hs(i))return{props:{}};for(var d=[i],v=new Set([i]),c=i;c.parentNode&&!Vs(c,"body")&&Ks>d.length;)if(Gs(c.parentNode)){var f=c.parentNode.host;if(v.has(f))break;v.add(f),d.push(f),c=f}else{if(!Hs(c.parentNode))break;if(v.has(c.parentNode))break;v.add(c.parentNode),d.push(c.parentNode),c=c.parentNode}var p,_,m=[],y={},b=!1,w=!1;if(ts(d,(t=>{var i=fn(t);if(Vs(t,"a")){var e=t.getAttribute("href");b=!!(i&&e&&Sn(e))&&(u?Ci(e):e)}V(Qs(t),"ph-no-capture")&&(w=!0),m.push(function(t,i,e,r,s){void 0===s&&(s=!1);var n=t.tagName.toLowerCase(),o={tag_name:n};en.indexOf(n)>-1&&!e&&(o.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?xl(1024,kn(t)):xl(1024,Zs(t)));var a=Qs(t);a.length>0&&(o.classes=a.filter((function(t){return""!==t}))),ts(t.attributes,(function(e){var n;if((!pn(t)||-1!==["name","id","class","aria-label"].indexOf(e.name))&&(null==r||!r.includes(e.name))&&!i&&Sn(e.value)&&(!rt(n=e.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var a=e.value;"class"===e.name&&(a=Js(a).join(" ")),o["attr__"+e.name]=xl(1024,"href"===e.name&&s?Ci(a):a)}}));for(var l=1,h=1,u=t;u=Sl(u);)l++,u.tagName===t.tagName&&h++;return o.nth_child=l,o.nth_of_type=h,o}(t,o,a,l,u));var r=function(t){if(!fn(t))return{};var i={};return ts(t.attributes,(function(t){if(t.name&&0===t.name.indexOf("data-ph-capture-attribute")){var e=t.name.replace("data-ph-capture-attribute-",""),r=t.value;e&&r&&Sn(r)&&(i[e]=r)}})),i}(t);is(y,r)})),w)return{props:{},explicitNoCapture:w};if(a||(m[0].$el_text=Vs(i,"a")||Vs(i,"button")?kn(i):Zs(i)),b){var x,S;m[0].attr__href=b;var k=null==(x=Un(b))?void 0:x.host,E=null==t||null==(S=t.location)?void 0:S.host;k&&E&&k!==E&&(p=b)}return{props:is({$event_type:n.type,$ce_version:1},h?{}:{$elements:m},{$elements_chain:(_=m,function(t){return t.map((t=>{var i,e,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=g({},t.text?{text:t.text}:{},{"nth-child":null!==(i=t.nth_child)&&void 0!==i?i:0,"nth-of-type":null!==(e=t.nth_of_type)&&void 0!==e?e:0},t.href?{href:t.href}:{},t.attr_id?{attr_id:t.attr_id}:{},t.attributes),o={};return es(n).sort(((t,i)=>t[0].localeCompare(i[0]))).forEach((t=>{var i=t[1];return o[$n(t[0].toString())]=$n(i.toString())})),(r+=":")+es(o).map((t=>t[0]+'="'+t[1]+'"')).join("")})).join(";")}(function(t){return t.map((t=>{var i,e,r={text:null==(i=t.$el_text)?void 0:i.slice(0,400),tag_name:t.tag_name,href:null==(e=t.attr__href)?void 0:e.slice(0,2048),attr_class:Pn(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return es(t).filter((t=>0===t[0].indexOf("attr__"))).forEach((t=>r.attributes[t[0]]=t[1])),r}))}(_)))},null!=(r=m[0])&&r.$el_text?{$el_text:null==(s=m[0])?void 0:s.$el_text}:{},p&&"click"===n.type?{$external_click_url:p}:{},y)}}class El{constructor(t){this.name="autocapture",this.Qn=!1,this.Jn=null,this.Kn=!1,this.Yn=!1,this.qi={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Xn=!1,this.ts=t,this.ts.refresh(this.qi),this.rageclicks=new yl(this.qi.rageclick),this.es=null}setup(t){this.rs(),this.ns=t;var i=t.onRemoteConfig(this.onRemoteConfig.bind(this));this.Xn?i.dispose():(this.ss=i,this.startIfEnabled())}dispose(){var t;this.Xn||(this.Xn=!0,this.ns=void 0,null==(t=this.ss)||t.dispose(),this.ss=void 0,this.os())}ls(){return this.ts.refresh(this.qi),this.qi}rs(){var t,i;return this.ls(),this.qi.url_allowlist=null==(t=this.qi.url_allowlist)?void 0:t.map((t=>new RegExp(t))),this.qi.url_ignorelist=null==(i=this.qi.url_ignorelist)?void 0:i.map((t=>new RegExp(t))),this.qi}us(){if(this.isBrowserSupported()){if(t&&r){var i=this.hs=i=>{i=i||(null==t?void 0:t.event);try{this.ds(i)}catch(t){wl.error("Failed to capture event",t)}};if(ls(r,"submit",i,{capture:!0}),ls(r,"change",i,{capture:!0}),ls(r,"click",i,{capture:!0}),this.ls().capture_copied_text){var e=this.vs=i=>{i=i||(null==t?void 0:t.event);try{this.ds(i,bl)}catch(t){wl.error("Failed to capture copy/cut event",t)}};ls(r,"copy",e,{capture:!0}),ls(r,"cut",e,{capture:!0})}}}else wl.info("Disabling Automatic Event Collection because this browser is not supported")}os(){this.hs&&(null==r||r.removeEventListener("submit",this.hs,!0),null==r||r.removeEventListener("change",this.hs,!0),null==r||r.removeEventListener("click",this.hs,!0),this.hs=void 0),this.vs&&(null==r||r.removeEventListener("copy",this.vs,!0),null==r||r.removeEventListener("cut",this.vs,!0),this.vs=void 0),this.Qn=!1}startIfEnabled(){!this.Xn&&this.ns&&this.isEnabled&&!this.Qn&&(this.us(),this.Qn=!0)}onRemoteConfig(t){if(!this.Xn)if(this.Kn=!0,t.ok){var i=t.config;i.elementsChainAsString&&(this.Yn=i.elementsChainAsString);var e,r=i.autocapture_opt_out;ht(r)&&(null==(e=this.ns)||e.kv.set(He,r),this.Jn=r),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(t){this.es=t}getElementSelectors(t){var i,e=[];return null==(i=this.es)||i.forEach((i=>{var s=null==r?void 0:r.querySelectorAll(i);null==s||s.forEach((r=>{t===r&&e.push(i)}))})),e}get isEnabled(){var t,i;if(this.Xn)return!1;var e=null==(t=this.ns)?void 0:t.kv.get(He),r=this.Jn,s=this.ls(),n=s.remoteRequestsDisabled&&!this.Kn;if(nt(r)&&!ht(e)&&!n)return!1;var o=null!==(i=this.Jn)&&void 0!==i?i:!!e;return!!s.enabled&&!o}ds(i,e){if(void 0===e&&(e="$autocapture"),this.isEnabled){var r=tn(i);Ws(r)&&(r=r.parentNode||null);var s,n=this.rs();"$autocapture"===e&&"click"===i.type&&i instanceof MouseEvent&&n.rageclick&&null!=(s=this.rageclicks)&&s.isRageClick(i.clientX,i.clientY,i.timeStamp||(new Date).getTime())&&dn(r,n.rageclick)&&this.ds(i,"$rageclick");var o=e===bl;if(r&&function(i,e,r,s,n,o){var a;if(!t||vn(i))return!1;if(null!=r&&r.url_allowlist&&!Ys(r.url_allowlist,o))return!1;if(null!=r&&r.url_ignorelist&&Ys(r.url_ignorelist,o))return!1;if(null!=r&&r.dom_event_allowlist){var l=r.dom_event_allowlist;if(l&&!l.some((t=>e.type===t)))return!1}var h=cn(i,s),u=h.parentIsUsefulElement,d=h.targetElementList;if(!function(t,i){var e=null==i?void 0:i.element_allowlist;if(et(e))return!0;var r,s=function(t){if(e.some((i=>t.tagName.toLowerCase()===i)))return{v:!0}};for(var n of t)if(r=s(n))return r.v;return!1}(d,r))return!1;if(!rn(d,null==r?void 0:r.css_selector_allowlist))return!1;if(rn(d,null!==(a=null==r?void 0:r.css_selector_ignorelist)&&void 0!==a?a:nn))return!1;try{var v=t.getComputedStyle(i);if(v&&"pointer"===v.getPropertyValue("cursor")&&"click"===e.type)return!0}catch(t){}var c=i.tagName.toLowerCase();switch(c){case"html":return!1;case"form":return(n||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(e.type)>=0;default:return u?(n||["click"]).indexOf(e.type)>=0:(n||["click"]).indexOf(e.type)>=0&&(en.indexOf(c)>-1||"true"===i.getAttribute("contenteditable"))}}(r,i,n,o,o?["copy","cut"]:void 0,{config:{get_current_url:n.getCurrentUrl}})){var a,l=kl(r,{e:i,maskAllElementAttributes:n.maskAllElementAttributes,maskAllText:n.maskAllText,elementAttributeIgnoreList:n.element_attribute_ignorelist,elementsChainAsString:this.Yn,disableCaptureUrlHashes:n.disableCaptureUrlHashes}),h=l.props;if(l.explicitNoCapture)return!1;var u=this.getElementSelectors(r);if(u&&u.length>0&&(h.$element_selectors=u),e===bl){var d,v=Xs(null==t||null==(d=t.getSelection())?void 0:d.toString()),c=i.type||"clipboard";if(!v)return!1;h.$selected_content=v,h.$copy_type=c}return null==(a=this.ns)||a.capture(e,h).catch((t=>wl.error("Failed to capture event",t))),!0}}}isBrowserSupported(){return Z(null==r?void 0:r.querySelectorAll)}}class $l{constructor(t){this._instance=t}refresh(t){var i=this._instance.config,e=tt(i.autocapture)?i.autocapture:void 0;t.enabled=!!i.autocapture,t.rageclick=i.rageclick,t.maskAllElementAttributes=i.mask_all_element_attributes,t.maskAllText=i.mask_all_text,t.disableCaptureUrlHashes=i.disable_capture_url_hashes,t.getCurrentUrl=i.get_current_url,t.remoteRequestsDisabled=this._instance.ma(),t.url_allowlist=null==e?void 0:e.url_allowlist,t.url_ignorelist=null==e?void 0:e.url_ignorelist,t.dom_event_allowlist=null==e?void 0:e.dom_event_allowlist,t.element_allowlist=null==e?void 0:e.element_allowlist,t.css_selector_allowlist=null==e?void 0:e.css_selector_allowlist,t.css_selector_ignorelist=null==e?void 0:e.css_selector_ignorelist,t.element_attribute_ignorelist=null==e?void 0:e.element_attribute_ignorelist,t.capture_copied_text=null==e?void 0:e.capture_copied_text}}var Pl=Ie("[ExceptionAutocapture]"),Tl=()=>{},Cl=Ie("[TracingHeaders]"),Fl=Ie("[Web Vitals]"),Rl=9e5,Il=["CLS","FCP","INP","LCP"],Ml=["INP","LCP"],Al=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],Ol="disabled",Dl="lazy_loading",jl="awaiting_config",Ll="missing_config";Ie("[SessionRecording]"),Ie("[SessionRecording]");var Nl="[SessionRecording]",Bl=Ie(Nl),zl=Ie("[Heatmaps]");function Ul(t){return tt(t)&&"clientX"in t&&"clientY"in t&&at(t.clientX)&&at(t.clientY)}var ql=Ie("[Product Tours]"),Hl=t=>{var i;return!t.config.disable_product_tours&&!(null==(i=t.persistence)||!i.get_property(Qe))},Vl=["$set_once","$set"],Wl=Ie("[SiteApps]"),Gl="Error while initializing PostHog app with config id ",Kl=(t,i)=>null!=t&&t.then?t.then(i):i(t),Jl="SDK is not enabled or survey functionality is not yet loaded",Yl="Disabled. Not loading surveys.";class Ql{constructor(t,i){this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Tl=!1,this.Ml=[],this.El=null,this.Il=null,this.Xn=!1,this.Rl=new Set,this.onRemoteConfig=t=>{if(!this.Xn&&!this.qi.disableSurveys){if(!t.ok)return Wa.warn("Remote config unavailable. Not loading surveys.");var i=t.config.surveys;if(ot(i))return Wa.warn("Flags not loaded yet. Not loading surveys.");this.Pl=ht(i)?i:i.length>0,Wa.info("flags response received, isSurveysEnabled: "+this.Pl),this.loadIfEnabled()}},this.ts=t,this.Al=i}setup(t){if(!this.Xn)return this.Fl=t,Kl(t.kv.initialize(),(()=>{if(this.Fl===t&&!this.Xn){this.Fl=void 0,this.ns=t;var i=t.onRemoteConfig(this.onRemoteConfig);this.Xn?i.dispose():(this.ss=i,this.loadIfEnabled())}}))}dispose(){var t,i,e;this.Xn||(this.Xn=!0,this.Fl=void 0,this.ns=void 0,null==(t=this.ss)||t.dispose(),this.ss=void 0,null==(i=this._surveyEventReceiver)||i.dispose(),this._surveyEventReceiver=null,null==(e=this._surveyManager)||null==e.dispose||e.dispose(),this._surveyManager=null,this.Ml=[],this.El=null,this.Rl.forEach((t=>clearTimeout(t))),this.Rl.clear())}get qi(){return this.ts.get()}initialize(){this.loadIfEnabled()}reset(){try{var t;null==(t=this._surveyEventReceiver)||t.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var i=[],e=0;e<localStorage.length;e++){var r=localStorage.key(e);(null!=r&&r.startsWith(Ga)||null!=r&&r.startsWith("inProgressSurvey_"))&&i.push(r)}i.forEach((t=>localStorage.removeItem(t)))}catch(t){}}loadIfEnabled(){if(!this.Xn&&this.ns){var t=this.qi;if(!this._surveyManager)if(this.Tl)Wa.info("Already initializing surveys, skipping...");else if(t.disableSurveys)Wa.info(Yl);else if(t.cookielessMode&&this.ts.isOptedOut())Wa.info("Not loading surveys in cookieless mode without consent.");else{var i=this.ts.getExtensions();if(i){if(!et(this.Pl)||t.advancedEnableSurveys){var e=this.Pl||t.advancedEnableSurveys;this.Tl=!0;try{var r=i.generateSurveys;if(r)return this.Ll(r,e),void(this.Tl=!1);var s=i.loadExternalDependency;if(!s)return this.Ol(zr),void(this.Tl=!1);s((t=>{try{if(this.Xn)return;var i=this.ts.getExtensions();t||null==i||!i.generateSurveys?this.Ol("Could not load surveys script",t):this.Ll(i.generateSurveys,e)}finally{this.Tl=!1}}))}catch(t){throw this.Tl=!1,this.Ol("Error initializing surveys",t),t}}}else Wa.error("PostHog Extensions not found.")}}}Ll(t,i){this.Xn||(this._surveyManager=t(i),this._surveyEventReceiver=this.ts.createEventReceiver(),Wa.info("Surveys loaded successfully"),this.Dl({isLoaded:!0}))}Ol(t,i){Wa.error(t,i),this.Dl({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.Ml.push(t),this._surveyManager&&this.Dl({isLoaded:!0}),()=>{this.Ml=this.Ml.filter((i=>i!==t))}}getSurveys(t,i){var e;void 0===i&&(i=!1);var r=null!==(e=this.ns)&&void 0!==e?e:this.Al;if(r&&!this.Xn){if(this.qi.disableSurveys)return Wa.info(Yl),t([]);var s=r.kv.get(yr);if(s&&!i)return t(s,{isLoaded:!0}),void(this.$l()&&this.getSurveys((()=>{}),!0));if(this.El)this.El.then((i=>{this.Xn||t(i.surveys,i.context)})).catch((t=>Wa.error("Error in survey callback",t)));else{var n=this.Nl("/api/surveys/",{method:"GET",query:{token:r.projectToken},sentAt:"query",timeoutMs:this.qi.requestTimeoutMs}).then((t=>{try{return this.ql(r,t)}catch(t){return Wa.error("Error processing surveys response",t),this.ql(r,{statusCode:0,error:t})}}),(t=>this.ql(r,{statusCode:0,error:t})));this.El=n;var o=()=>{this.El===n&&(this.El=null)};n.then((i=>{o(),this.Xn||t(i.surveys,i.context)}),o).catch((t=>Wa.error("Error in survey callback",t)))}}}Nl(t,i){var e=this.ns;return e?e.sendRequest(t,i):new Promise((t=>t({statusCode:0,error:new Error(Jl)})))}ql(t,i){if(this.Xn)return{surveys:[],context:{isLoaded:!1,error:Jl}};var e=i.statusCode;if(200!==e||!i.json){var r="Surveys API could not be loaded, status: "+e;return 0!==e?Wa.error(r):i.error||Wa.warn(r),this.Il=Date.now(),{surveys:[],context:{isLoaded:!1,error:r}}}this.Il=null;var s,n=i.json.surveys||[],o=n.filter((t=>function(t){return!(!t.start_date||t.end_date)}(t)&&(Oa(t)||function(t){var i;return!(null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)||!i.length)}(t))));return o.length>0&&(null==(s=this._surveyEventReceiver)||s.register(o)),t.kv.set({[yr]:n,[br]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}$l(){return this.jl()&&!this.El&&!this.Bl()}jl(){var t,i,e=null==(t=null!==(i=this.ns)&&void 0!==i?i:this.Al)?void 0:t.kv.get(br);return at(e)&&Date.now()-e>3e5}Bl(){return at(this.Il)&&3e5>Date.now()-this.Il}markSurveyAsSeen(t,i){var e,r={id:t,current_iteration:null!==(e=null==i?void 0:i.iteration)&&void 0!==e?e:null};Ka(r);try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(t){}}Dl(t){for(var i of this.Ml)try{if(!t.isLoaded)return i([],t);this.getSurveys(i)}catch(t){Wa.error("Error in survey callback",t)}}getActiveMatchingSurveys(t,i){if(void 0===i&&(i=!1),!ot(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,i);Wa.warn("init was not called")}Hl(t){var i=null;return this.getSurveys((e=>{var r;i=null!==(r=e.find((i=>i.id===t)))&&void 0!==r?r:null})),i}Ul(t){if(ot(this._surveyManager))return{eligible:!1,reason:Jl};var i="string"==typeof t?this.Hl(t):t;return i?this._surveyManager.checkSurveyEligibility(i):{eligible:!1,reason:"Survey not found"}}zl(t){if(ot(this._surveyManager))return{eligible:!1,reason:Jl};var i="string"==typeof t?this.Hl(t):t;return i?this._surveyManager.checkSurveyRenderability(i):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(ot(this._surveyManager))return Wa.warn("init was not called"),{visible:!1,disabledReason:Jl};var i=this.zl(t);return{visible:i.eligible,disabledReason:i.reason}}canRenderSurveyAsync(t,i){return ot(this._surveyManager)?(Wa.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:Jl})):new Promise((e=>{this.getSurveys((i=>{var r,s=null!==(r=i.find((i=>i.id===t)))&&void 0!==r?r:null;if(s){var n=this.zl(s);e({visible:n.eligible,disabledReason:n.reason})}else e({visible:!1,disabledReason:"Survey not found"})}),i)}))}renderSurvey(t,i,e){var s;if(ot(this._surveyManager))Wa.warn("init was not called");else{var n="string"==typeof t?this.Hl(t):t;if(null!=n&&n.id)if(Ja.includes(n.type)){var o=null==r?void 0:r.querySelector(i);if(o)if(null!=(s=n.appearance)&&s.surveyPopupDelaySeconds){Wa.info("Rendering survey "+n.id+" with delay of "+n.appearance.surveyPopupDelaySeconds+" seconds");var a=setTimeout((()=>{var t,i;this.Rl.delete(a),this.Xn||(Wa.info("Rendering survey "+n.id+" with delay of "+(null==(t=n.appearance)?void 0:t.surveyPopupDelaySeconds)+" seconds"),null==(i=this._surveyManager)||i.renderSurvey(n,o,e),Wa.info("Survey "+n.id+" rendered"))}),1e3*n.appearance.surveyPopupDelaySeconds);this.Rl.add(a)}else this._surveyManager.renderSurvey(n,o,e);else Wa.warn("Survey element not found")}else Wa.warn("Surveys of type "+n.type+" cannot be rendered in the app");else Wa.warn("Survey not found")}}displaySurvey(t,i){var e;if(ot(this._surveyManager))Wa.warn("init was not called");else{var r=this.Hl(t);if(r){var s=r;if(null!=(e=r.appearance)&&e.surveyPopupDelaySeconds&&i.ignoreDelay&&(s=g({},r,{appearance:g({},r.appearance,{surveyPopupDelaySeconds:0})})),i.displayType!==ko&&i.initialResponses&&Wa.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===i.ignoreConditions){var n=this.Ul(r);if(!n.eligible)return void Wa.warn("Survey is not eligible to be displayed: ",n.reason)}"inline"!==i.displayType?this._surveyManager.handlePopoverSurvey(s,i):this.renderSurvey(s,i.selector,i.properties)}else Wa.warn("Survey not found")}}cancelPendingSurvey(t){ot(this._surveyManager)?Wa.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;null==(t=this._surveyManager)||null==t.handlePageUnload||t.handlePageUnload()}}function Xl(t,i,e){if(ot(t))return!1;switch(e){case"exact":return t===i;case"contains":var r=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(i).test(t)}catch(t){return!1}default:return!1}}class Zl{constructor(t){this.Wl=new Set,this.Vl=new Set,this.Gl=new Ca,this.Zl=(t,i)=>this.Ql(t,i)&&this.Jl(t,i)&&this.Kl(t,i)&&this.Yl(t,i),this.Ql=(t,i)=>null==i||!i.event||(null==t?void 0:t.event)===(null==i?void 0:i.event),this._instance=t}init(){var t,i;et(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Xl=null==(i=this._instance)?void 0:i._addCaptureHook(((t,i)=>{this.on(t,i)})))}dispose(){var t;null==(t=this.Xl)||t.call(this),this.Xl=void 0,this.Gl=new Ca}register(t){var i,e;if(!et(null==(i=this._instance)?void 0:i._addCaptureHook)&&(t.forEach((t=>{var i;this.Wl.add(t),null==(i=t.steps)||i.forEach((t=>{this.Vl.add((null==t?void 0:t.event)||"")}))})),null!=(e=this._instance)&&e.autocapture)){var r=new Set;this.Wl.forEach((t=>{var i;null==(i=t.steps)||i.forEach((t=>{null!=t&&t.selector&&r.add(t.selector)}))})),this._instance.autocapture.setElementSelectors(r)}}replace(t){this.Wl.clear(),this.Vl.clear(),this.register(t)}on(t,i){null!=i&&0!=t.length&&(this.Vl.has(t)||this.Vl.has(i.event))&&this.Wl.forEach((t=>{this.tu(i,t)&&this.Gl.emit("actionCaptured",t.name)}))}eu(t){this.onAction("actionCaptured",(i=>t(i)))}tu(t,i){if(null==(null==i?void 0:i.steps))return!1;for(var e of i.steps)if(this.Zl(t,e))return!0;return!1}onAction(t,i){return this.Gl.on(t,i)}Jl(t,i){if(null!=i&&i.url){var e,r=null==t||null==(e=t.properties)?void 0:e.$current_url;if(!r||"string"!=typeof r)return!1;if(!Xl(r,i.url,i.url_matching||"contains"))return!1}return!0}Kl(t,i){return!!this.iu(t,i)&&!!this.ru(t,i)&&!!this.nu(t,i)}iu(t,i){var e;if(null==i||!i.href)return!0;var r=this.su(t);if(r.length>0)return r.some((t=>Xl(t.href,i.href,i.href_matching||"exact")));var s,n=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!n&&Xl((s=n.match(/(?::|")href="(.*?)"/))?s[1]:"",i.href,i.href_matching||"exact")}ru(t,i){var e;if(null==i||!i.text)return!0;var r=this.su(t);if(r.length>0)return r.some((t=>Xl(t.text,i.text,i.text_matching||"exact")||Xl(t.$el_text,i.text,i.text_matching||"exact")));var s,n,o,a=(null==t||null==(e=t.properties)?void 0:e.$elements_chain)||"";return!!a&&(s=function(t){for(var i,e=[],r=/(?::|")text="(.*?)"/g;!ot(i=r.exec(t));)e.includes(i[1])||e.push(i[1]);return e}(a),n=i.text,o=i.text_matching||"exact",s.some((t=>Xl(t,n,o))))}nu(t,i){var e,r;if(null==i||!i.selector)return!0;var s=null==t||null==(e=t.properties)?void 0:e.$element_selectors;if(null!=s&&s.includes(i.selector))return!0;var n=(null==t||null==(r=t.properties)?void 0:r.$elements_chain)||"";if(i.selector_regex&&n)try{return new RegExp(i.selector_regex).test(n)}catch(t){return!1}return!1}su(t){var i;return null==(null==t||null==(i=t.properties)?void 0:i.$elements)?[]:null==t?void 0:t.properties.$elements}Yl(t,i){return null==i||!i.properties||0===i.properties.length||Na(i.properties.reduce(((t,i)=>{var e=X(i.value)?i.value.map(String):null!=i.value?[String(i.value)]:[];return t[i.key]={values:e,operator:i.operator||"exact"},t}),{}),null==t?void 0:t.properties)}}class th{constructor(t){var i;this.au=[],this._instance=t,this.ou=new Map,this.lu=new Map,this.uu=new Map,this.hu=null==(i=this._instance)||null==i.onSessionId?void 0:i.onSessionId((t=>this.du(t)))}vu(t){return!1}cu(){return null}fu(t){}pu(){}gu(t,i){return!!t&&Na(t.propertyFilters,null==i?void 0:i.properties)}mu(t,i){var e=new Map;return t.forEach((t=>{var r;null==(r=t.conditions)||null==(r=r[i])||null==(r=r.values)||r.forEach((i=>{if(null!=i&&i.name){var r=e.get(i.name)||[];r.push(t.id),e.set(i.name,r)}}))})),e}yu(t,i,e){var r=(e===yo?this.ou:this.lu).get(t),s=[];return this.bu((t=>{s=t.filter((t=>null==r?void 0:r.includes(t.id)))})),s.filter((r=>{var s,n=null==(s=r.conditions)||null==(s=s[e])||null==(s=s.values)?void 0:s.find((i=>i.name===t));return this.gu(n,i)}))}register(t){this._u(t,!1)}replace(t){this._u(t,!0)}_u(t,i){var e;et(null==(e=this._instance)?void 0:e._addCaptureHook)||(this.wu(t,i),this.ku(t,i))}ku(t,i){var e=t.filter((t=>{var i;return null==(i=t.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length}));if(i&&this.uu.clear(),0!==e.length){this.Su||(this.Su=new Zl(this._instance),this.Su.init(),this.Su.eu((t=>this.onAction(t))));var r=[];e.forEach((t=>{var i;null==(i=t.conditions)||null==(i=i.actions)||i.values.forEach((i=>{if(r.push(i),i.name){var e,s=null!==(e=this.uu.get(i.name))&&void 0!==e?e:[];s.includes(t.id)||s.push(t.id),this.uu.set(i.name,s)}}))})),i?this.Su.replace(r):this.Su.register(r)}else{var s;i&&(null==(s=this.Su)||s.replace([]))}}xu(t,i){i.forEach(((i,e)=>{var r,s=null!==(r=t.get(e))&&void 0!==r?r:[];i.forEach((t=>{s.includes(t)||s.push(t)})),t.set(e,s)}))}wu(t,i){var e,r,s=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.events)&&(null==(e=t.conditions)||null==(e=e.events)||null==(e=e.values)?void 0:e.length)>0})),n=t.filter((t=>{var i,e;return(null==(i=t.conditions)?void 0:i.cancelEvents)&&(null==(e=t.conditions)||null==(e=e.cancelEvents)||null==(e=e.values)?void 0:e.length)>0})),o=this.mu(t,yo),a=this.mu(t,bo);i?(this.ou=o,this.lu=a):(this.xu(this.ou,o),this.xu(this.lu,a)),(0!==s.length||0!==n.length)&&(null!==(e=this.Xl)&&void 0!==e||(this.Xl=null==(r=this._instance)?void 0:r._addCaptureHook(((t,i)=>{this.onEvent(t,i)}))))}onEvent(t,i){var e,r,s=this.Cu(),n=(null==i||null==(e=i.properties)?void 0:e.$survey_id)||(null==i||null==(r=i.properties)?void 0:r.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var o=this.Tu(t,n);if("consume"===o)return s.info("event consumed activated item, removing it",{event:t,itemId:n}),void this.Mu([n]);if("persist"===o)return s.info("shown item promoted to persisted activation",{event:t,itemId:n}),this.Eu(n),void this.Iu([n])}if(this.lu.has(t)){var a=this.yu(t,i,bo);a.length>0&&(s.info("cancel event matched, cancelling items",{event:t,itemsToCancel:a.map((t=>t.id))}),this.Mu(a.map((t=>t.id))),a.forEach((t=>this.Ru(t.id))))}if(this.ou.has(t)){s.info("event name matched",{event:t,eventPayload:i,items:this.ou.get(t)});var l=this.yu(t,i,yo);this.Pu(l.map((t=>t.id)))}}onAction(t){this.uu.has(t)&&this.Pu(this.uu.get(t)||[])}Pu(t){var i;if(0!==t.length){var e=!(null==(i=this._instance)||null==i.get_session_id||!i.get_session_id()),r=[];for(var s of t)e&&this.vu(s)?this.Eu(s)&&this.Au(s):r.push(s);r.length>0&&(this.au=[...new Set([...this.au,...r])]),this.Cu().info("updating activated items",{activatedItems:this.getActivatedIds()})}}Eu(t){this.au=this.au.filter((i=>i!==t));var i=this.Fu();return!i.includes(t)&&(this.Lu([...i,t]),this.Ou(),!0)}Mu(t){var i=new Set(t);this.au=this.au.filter((t=>!i.has(t)));var e=this.Du(),r=e.filter((t=>!i.has(t)));r.length!==e.length&&(this.Lu(r),0===r.length&&this.$u()),this.Iu(t)}Nu(){var t,i=this.cu();if(!i)return{};var e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i];return e&&"object"==typeof e?e:{}}Au(t){if(this.cu()){var i=this.Nu();this.fu(g({},i,{[t]:Date.now()}))}}Iu(t){if(this.cu()){var i=this.Nu(),e={},r=!1;for(var s of Object.entries(i)){var n=s[0],o=s[1];t.includes(n)?r=!0:e[n]=o}r&&(it(e)?this.pu():this.fu(e))}}qu(){this.cu()&&this.pu()}getActivationTimestamp(t){if(this.Fu().includes(t)){var i=this.Nu()[t];return at(i)?i:void 0}}Du(){var t,i=this.ju();return(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[i])||[]}Fu(){var t,i,e=this.Du();if(0===e.length)return[];var r=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.Bu()],s=null==(i=this._instance)||null==i.get_session_id?void 0:i.get_session_id();return s&&r===s?e:[]}Ou(){var t,i=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();i&&this.Hu(i)}$u(){this.Uu()}du(t){var i,e=null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[this.Bu()];if(e&&e!==t){var r=this.Du(),s=this.Nu();r.length>0&&(this.Lu([]),r.filter((t=>at(s[t]))).forEach((t=>this.Ru(t)))),this.$u(),this.qu()}}getActivatedIds(){return[...new Set([...this.Fu(),...this.au])].filter((t=>!this.zu(t)))}dispose(){var t,i,e;null==(t=this.hu)||t.call(this),this.hu=void 0,null==(i=this.Xl)||i.call(this),this.Xl=void 0,null==(e=this.Su)||e.dispose(),this.Su=void 0}reset(){this.au=[],this.Du().length>0&&this.Lu([]),this.$u(),this.qu()}getEventToItemsMap(){return this.ou}Wu(){return this.Su}}class ih extends th{constructor(t){super(t)}ju(){return wr}Bu(){return xr}cu(){return Sr}fu(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[Sr]:t})}pu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(Sr)}vu(t){var i,e;this.bu((i=>{e=i.find((i=>i.id===t))}));var r=null==(i=e)||null==(i=i.appearance)?void 0:i.surveyPopupDelaySeconds;return at(r)&&r>0}Vu(){return wo}bu(t){var i;null==(i=this._instance)||i.getSurveys(t)}Ru(t){var i;null==(i=this._instance)||i.cancelPendingSurvey(t)}Cu(){return Wa}Lu(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[wr]:t})}Hu(t){var i;null==(i=this._instance)||null==(i=i.persistence)||i.register({[xr]:t})}Uu(){var t;null==(t=this._instance)||null==(t=t.persistence)||t.unregister(xr)}zu(){return!1}Tu(t,i){var e;this.bu((t=>{e=t.find((t=>t.id===i))}));var r=!e||function(t){var i;return Oa(t)&&!(null==(i=t.conditions)||null==(i=i.events)||!i.repeatedActivation)||"always"===t.schedule}(e);return r?t===wo?"consume":"ignore":t===wo?"persist":t===xo||t===So?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}class eh{constructor(t){this._instance=t}initialize(){}get(t){if("string"==typeof t)return this._instance.get_property(t);var i={};for(var e of t){var r=this._instance.get_property(e);et(r)||(i[e]=r)}return i}set(t,i){this._instance.register("string"==typeof t?{[t]:i}:t)}remove(t){"string"!=typeof t?t.forEach((t=>this._instance.unregister(t))):this._instance.unregister(t)}}class rh{constructor(t){this._instance=t}get(){var t=this._instance.config;return{disableSurveys:t.disable_surveys,cookielessMode:!!t.cookieless_mode,advancedEnableSurveys:t.advanced_enable_surveys,requestTimeoutMs:t.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}getExtensions(){var t=null==v?void 0:v.__PosthogExtensions__;if(t){var i=t.generateSurveys,e=t.loadExternalDependency;return{generateSurveys:i?t=>i(this._instance,t):void 0,loadExternalDependency:e?t=>e(this._instance,"surveys",t):void 0}}}createEventReceiver(){return new ih(this._instance)}}var sh=null!=t&&t.location?Vn(t.location.hash,"__posthog")||Vn(location.hash,"state"):null,nh="_postHogToolbarParams",oh=Ie("[Toolbar]"),ah=Ie("[FeatureFlags]");class lh{constructor(t,i){void 0===i&&(i=!1),this.Gu=!1,this.update(t,i)}update(t,i){this.Zu=((t,i)=>{var e,r,s,n;return{bootstrap:{featureFlags:null==(e=t.bootstrap)?void 0:e.featureFlags,featureFlagPayloads:null==(r=t.bootstrap)?void 0:r.featureFlagPayloads},remoteRequestsDisabled:i,featureFlagsDisabled:!!t.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!t.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!t.advanced_feature_flags_dedup_per_session,cacheTtlMs:t.feature_flag_cache_ttl_ms,requestTimeoutMs:t.feature_flag_request_timeout_ms,compression:t.disable_compression?"none":"base64",evaluationContexts:null!==(s=null!==(n=t.evaluation_contexts)&&void 0!==n?n:t.evaluation_environments)&&void 0!==s?s:[],flagKeys:X(t.flag_keys)?t.flag_keys:void 0}})(t,i),!t.evaluation_environments||t.evaluation_contexts||this.Gu||(ah.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Gu=!0),et(t.flag_keys)||X(t.flag_keys)||ah.error("Invalid flag_keys found:",t.flag_keys,"Expected array of non-empty strings")}get(){return this.Zu}}var hh=Ie("[FeatureFlags]"),uh=Ie("[FeatureFlags]",{debugEnabled:!0}),dh="\" failed. Feature flags didn't load in time.",vh="connection_error",ch=t=>{for(var i={},e=0;t.length>e;e++)i[t[e]]=!0;return i},fh=t=>{var i={};for(var e of es(t||{})){var r=e[1];r&&(i[e[0]]=r)}return i},ph=Ie("[Error tracking]"),gh=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:"],_h=["__firefox__","__gCrWeb"],mh="Refusing to render web experiment since the viewer is a likely bot",yh={icontains:(t,i)=>i.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,i)=>-1===i.toLowerCase().indexOf(t.toLowerCase()),regex:(t,i)=>Da(i,t),not_regex:(t,i)=>!Da(i,t),exact:(t,i)=>i===t,is_not:(t,i)=>i!==t};class bh{get qi(){return this._instance.config}constructor(t){var i=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(t){void 0===t&&(t=!1),i.getWebExperiments((t=>{bh.Qu("retrieved web experiments from the server"),i.Ju=new Map,t.forEach((t=>{if(t.feature_flag_key){var e;i.Ju&&(bh.Qu("setting flag key ",t.feature_flag_key," to web experiment ",t),null==(e=i.Ju)||e.set(t.feature_flag_key,t));var r=i._instance.getFeatureFlag(t.feature_flag_key);rt(r)&&t.variants[r]&&i.Ku(t.name,r,t.variants[r].transforms)}else if(t.variants)for(var s in t.variants){var n=t.variants[s];bh.Yu(n,i._instance)&&i.Ku(t.name,s,n.transforms)}}))}),t)},this._instance=t,this._instance.onFeatureFlags((t=>{this.onFeatureFlags(t)}))}initialize(){}onFeatureFlags(t){if(this._is_bot())bh.Qu(mh);else if(!this.qi.disable_web_experiments){if(ot(this.Ju))return this.Ju=new Map,this.loadIfEnabled(),void this.previewWebExperiment();bh.Qu("applying feature flags",t),t.forEach((t=>{var i;if(this.Ju&&null!=(i=this.Ju)&&i.has(t)){var e,r=this._instance.getFeatureFlag(t),s=null==(e=this.Ju)?void 0:e.get(t);r&&null!=s&&s.variants[r]&&this.Ku(s.name,r,s.variants[r].transforms)}}))}}previewWebExperiment(){var t=bh.getWindowLocation();if(null!=t&&t.search){var i=qn(null==t?void 0:t.search,"__experiment_id"),e=qn(null==t?void 0:t.search,"__experiment_variant");i&&e&&(bh.Qu("previewing web experiments "+i+" && "+e),this.getWebExperiments((t=>{this.Xu(parseInt(i),e,t)}),!1,!0))}}loadIfEnabled(){this.qi.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,i,e){if(this.qi.disable_web_experiments&&!e)return t([]);var r=this._instance.get_property("$web_experiments");if(r&&!i)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.qi.token),method:"GET",timestampMode:"query",callback:i=>t(200===i.statusCode&&i.json&&i.json.experiments||[])})}Xu(t,i,e){var r=e.filter((i=>i.id===t));r&&r.length>0&&(bh.Qu("Previewing web experiment ["+r[0].name+"] with variant ["+i+"]"),this.Ku(r[0].name,i,r[0].variants[i].transforms))}static Yu(t,i){return!ot(t.conditions)&&bh.th(t,i)&&bh.eh(t)}static th(t,i){var e;if(ot(t.conditions)||ot(null==(e=t.conditions)?void 0:e.url))return!0;var r=bh.getWindowLocation();if(r){var s,n,o,a=Ls(i,r.href);return null==(s=t.conditions)||!s.url||yh[null!==(n=null==(o=t.conditions)?void 0:o.urlMatchType)&&void 0!==n?n:"icontains"](t.conditions.url,a)}return!1}static getWindowLocation(){return null==t?void 0:t.location}static eh(t){var i;if(ot(t.conditions)||ot(null==(i=t.conditions)?void 0:i.utm))return!0;var e=Zn();if(e.utm_source){var r,s,n,o,a,l,h,u,d=null==(r=t.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=t.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==e.utm_campaign,v=null==(n=t.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=t.conditions)||null==(o=o.utm)?void 0:o.utm_source)==e.utm_source,c=null==(a=t.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=t.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==e.utm_medium,f=null==(h=t.conditions)||null==(h=h.utm)||!h.utm_term||(null==(u=t.conditions)||null==(u=u.utm)?void 0:u.utm_term)==e.utm_term;return d&&c&&f&&v}return!1}static Qu(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];Re.info("[WebExperiments] "+t,e)}Ku(t,i,e){this._is_bot()?bh.Qu(mh):"control"!==i?e.forEach((e=>{if(e.selector){var r;bh.Qu("applying transform of variant "+i+" for experiment "+t+" ",e);var s=null==(r=document)?void 0:r.querySelectorAll(e.selector);null==s||s.forEach((t=>{var i=t;e.html&&(i.innerHTML=e.html),e.css&&i.setAttribute("style",e.css)}))}})):bh.Qu("Control variants leave the page unmodified.")}_is_bot(){return e&&this._instance?Ma(e,this.qi.custom_blocked_useragents):void 0}}var wh=Ie("[Conversations]"),xh="Conversations not available yet.",Sh="console",kh="__posthogHandledLogsRequestError",Eh=(t,i)=>{var e=t instanceof Error?t:new Error(i);return e[kh]=!0,e},$h=t=>!!t&&"object"==typeof t&&!0===t[kh],Ph={featureFlags:class{constructor(t){this.name="featureFlags",this.ih=!1,this.featureFlagEventHandlers=[],this.I=hh,this.rh={},this.nh={},this.sh=[],this.ah=!1,this.oh=!1,this.lh=0,this.uh=!1,this.hh=!1,this.dh=!1,this.fh=!1,this.ph=0,this.Tt=()=>{var t=this.gh();this.ph=0,t&&this.reloadFeatureFlags()},"get"in t?this.ts=t:(this.mh=new lh(t.config,t.ma()),this.ts=this.mh)}updateConfig(t,i){var e;null==(e=this.mh)||e.update(t,i)}setup(t){return this.Fl=t,this.I=t.logger.createLogger("[FeatureFlags]"),Kl(t.kv.initialize(),(()=>{this.Fl===t&&(this.Fl=void 0,this.ns=t,this.yh(t))}))}yh(i){if(this.ns===i)return t&&ls(t,"online",this.Tt),this.bh=i.registerDynamicEventProperties((()=>this._h()?this.rh:this.nh)),this.wh(),this.initialize()}destroy(){null==t||t.removeEventListener("online",this.Tt)}dispose(){var i;this.lh++,this.hh=!1,this.Fl=void 0,this.ns&&(this.kh(),null==(i=this.bh)||i.dispose(),this.bh=void 0,this.sh=[],null==t||t.removeEventListener("online",this.Tt),this.ns=void 0)}get qi(){return this.ts.get()}Sh(t){var i;return null==(i=this.ns)?void 0:i.kv.get(t)}Dr(t){this.xh((()=>{var i;return null==(i=this.ns)?void 0:i.kv.set(t)}))}qr(t){this.xh((()=>{var i;return null==(i=this.ns)?void 0:i.kv.remove(t)}))}xh(t){try{t()}catch(t){this.I.error("Failed to update feature flag persistence",t)}}wh(){var t={};for(var i of[lr,dr,vr,fr]){var e=this.Sh(i);et(e)||(t[i]=e)}this.rh=t;var r=g({},t),s=this.Sh(ar);if(s)for(var n of Object.entries(s))r["$feature/"+n[0]]=n[1];this.nh=r}_h(){var t=this.qi.cacheTtlMs;if(!t||0>=t)return!1;var i=this.Sh(Tr);return"number"!=typeof i||Date.now()-i>t}Ch(){return!!this._h()&&(this.fh||this.oh||(this.fh=!0,this.I.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}Th(){var t=this.qi.evaluationContexts;return null!=t&&t.length?t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.I.error("Invalid evaluation context found:",t,"Expected non-empty string"),i})):[]}Mh(){var t=this.qi.flagKeys;if(!et(t))return t.filter((t=>{var i=t&&"string"==typeof t&&t.trim().length>0;return i||this.I.error("Invalid flag key found:",t,"Expected non-empty string"),i}))}initialize(){var t,i,e=this.qi,r=null!==(t=null==(i=e.bootstrap)?void 0:i.featureFlags)&&void 0!==t?t:{};if(Object.keys(r).length){var s,n,o=null!==(s=null==(n=e.bootstrap)?void 0:n.featureFlagPayloads)&&void 0!==s?s:{},a=Object.keys(r).filter((t=>!!r[t])).reduce(((t,i)=>(t[i]=r[i]||!1,t)),{}),l=Object.keys(o).filter((t=>a[t])).reduce(((t,i)=>(t[i]=o[i],t)),{});return this.Eh({featureFlags:a,featureFlagPayloads:l})}}updateFlags(t,i,e){var r,s,n=null!=e&&e.merge&&null!==(r=this.Sh(ar))&&void 0!==r?r:{},o=null!=e&&e.merge&&null!==(s=this.Sh(dr))&&void 0!==s?s:{},a=g({},n,t),l=g({},o,i),h={};for(var u of Object.entries(a)){var d=u[0],v=u[1];h[d]={key:d,enabled:y(v),variant:b(v),reason:void 0,metadata:et(null==l?void 0:l[d])?void 0:{id:0,version:void 0,description:void 0,payload:l[d]}}}this.Eh({flags:h})}get hasLoadedFlags(){return this.ah}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.Sh(ur),i=this.Sh(fr),e=this.Sh(pr);if(!e&&!i)return t||{};var r=is({},t||{}),s=[...new Set([...Object.keys(e||{}),...Object.keys(i||{})])];for(var n of s){var o,a,l=r[n],h=null==i?void 0:i[n],u=et(h)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!h,d=et(h)?null==l?void 0:l.variant:"string"==typeof h?h:void 0,v=null==e?void 0:e[n],c=g({},l,{enabled:u,variant:u?null!=d?d:null==l?void 0:l.variant:void 0});u!==(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=g({},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.ih||(this.I.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:e,finalDetails:r}),this.ih=!0),r}getAllFeatureFlags(){var t=this.getFlagVariants(),i=this.getFlagPayloads();return Object.keys(t).map((e=>{var r=t[e];return{key:e,enabled:y(r),variant:b(r),payload:m(i[e])}}))}getFlagVariants(){var t=this.Sh(ar),i=this.Sh(fr);if(!i)return t||{};for(var e=is({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.ih||(this.I.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:i,finalFlags:e}),this.ih=!0),e}getFlagPayloads(){var t=this.Sh(dr),i=this.Sh(pr);if(!i)return t||{};for(var e=is({},t||{}),r=Object.keys(i),s=0;r.length>s;s++)e[r[s]]=i[r[s]];return this.ih||(this.I.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:i,finalPayloads:e}),this.ih=!0),e}reloadFeatureFlags(){this.uh||this.qi.featureFlagsDisabled||this.gh()||this.Ih||(this.sh.slice().forEach((t=>{try{t()}catch(t){this.I.error("Error while running feature flags reloading callback",t)}})),this.Ih=setTimeout((()=>{this.Rh()}),5))}kh(){clearTimeout(this.Ih),this.Ih=void 0}onReloading(t){return this.sh.push(t),()=>{this.sh=this.sh.filter((i=>i!==t))}}ensureFlagsLoaded(){this.ah||this.oh||this.Ih||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.uh=t}resetFlagCallReported(){this.qr(Er)}Rh(t){this.kh();var i=this.ns;if(i&&!this.qi.remoteRequestsDisabled&&!this.gh())if(this.oh)this.hh=!0;else{var e={token:i.projectToken,distinct_id:i.distinctId,groups:i.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:g({},i.initialPersonProperties,this.Sh(gr)||{},{$lib:i.library.name,$lib_version:i.library.version}),group_properties:this.Sh(_r),timezone:ao()};et(i.deviceId)||(e.$device_id=i.deviceId),(null!=t&&t.disableFlags||this.qi.featureFlagsDisabled)&&(e.disable_flags=!0);var r=this.Th();r.length&&(e.evaluation_contexts=r);var s=this.Mh();et(s)||(e.flag_keys=s);var n=this.qi.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(n?"&only_evaluate_survey_feature_flags=true":""),a=this.lh;this.oh=!0;var l=()=>{this.hh&&(this.hh=!1,this.Rh())},h=t=>{this.oh=!1,a===this.lh?(this.Dr({[Pr]:[vh]}),this.I.error("Feature flag request failed",t),l()):l()};try{i.sendRequest(o,{target:"flags",method:"POST",body:e,compression:"base64"===this.qi.compression?mo:void 0,sentAt:"body",timeoutMs:this.qi.requestTimeoutMs}).then((t=>{var i,r,s=null!==(i=t.json)&&void 0!==i?i:{},o=200!==t.statusCode;if(this.oh=!1,a===this.lh){if(this.Ph(t.statusCode),o||this.hh||(this.$anon_distinct_id=void 0),!e.disable_flags||this.hh){this.dh=!o;var h=[];t.error?h.push(t.error instanceof Error&&"AbortError"===t.error.name?"timeout":t.error instanceof Error?vh:"unknown_error"):200!==t.statusCode&&h.push("api_error_"+t.statusCode),s.errorsWhileComputingFlags&&h.push("errors_while_computing_flags");var u=!(null==(r=s.quotaLimited)||!r.includes("feature_flags"));u&&h.push("quota_limited"),this.Dr({[Pr]:h}),u?this.I.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."):e.disable_flags||this.Eh(s,o,{partialResponse:n}),l()}}else l()})).catch(h)}catch(t){h(t)}}}gh(){return Wn(this.ph,3)}Ph(t){this.ph=Gn(t,this.ph,3,(()=>this.I.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes.")))}getFeatureFlag(t,i){var e;if(void 0===i&&(i={}),!i.fresh||this.dh)if(this.ah||this.getFlags()&&this.getFlags().length>0){if(!this.Ch()){var r=this.getFeatureFlagResult(t,i);return null!==(e=null==r?void 0:r.variant)&&void 0!==e?e:null==r?void 0:r.enabled}}else this.I.warn('getFeatureFlag for key "'+t+dh)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var i=this.getFeatureFlagResult(t,{send_event:!1});return null==i?void 0:i.payload}getFeatureFlagResult(t,i){if(void 0===i&&(i={}),!i.fresh||this.dh)if(this.ah||this.getFlags()&&this.getFlags().length>0){if(!this.Ch()){var e,r=this.getFlagVariants(),s=t in r,n=r[t],o=this.getFlagPayloads()[t],a=String(n),l=this.Sh(vr)||void 0,h=this.Sh(Tr)||void 0,u=this.Sh(Er)||{};if(this.qi.deduplicateCallsPerSession){var d,v=null==(d=this.ns)?void 0:d.session.sessionId,c=this.Sh($r);v&&v!==c&&(u={},e=v)}if(i.send_event||!("send_event"in i))if(t in u&&u[t].includes(a))e&&this.Dr({[Er]:u,[$r]:e});else{var f,p,_,y,b,w,x,S,k,E,P,T;X(u[t])?u[t].push(a):u[t]=[a],this.Dr(g({[Er]:u},e?{[$r]:e}:{}));var C=this.getFeatureFlagDetails(t),F=[...null!==(f=this.Sh(Pr))&&void 0!==f?f:[]];et(n)&&F.push("flag_missing");var R={$feature_flag:t,$feature_flag_response:n,$feature_flag_payload:null!=o?o:null,$feature_flag_request_id:l,$feature_flag_evaluated_at:h,$feature_flag_bootstrapped_response:null!==(p=null==(_=this.qi.bootstrap)||null==(_=_.featureFlags)?void 0:_[t])&&void 0!==p?p:null,$feature_flag_bootstrapped_payload:null!==(y=null==(b=this.qi.bootstrap)||null==(b=b.featureFlagPayloads)?void 0:b[t])&&void 0!==y?y:null,$used_bootstrap_value:!this.dh};et(null==C||null==(w=C.metadata)?void 0:w.has_experiment)||(R.$feature_flag_has_experiment=C.metadata.has_experiment),et(null==C||null==(x=C.metadata)?void 0:x.version)||(R.$feature_flag_version=C.metadata.version);var I,M=null!==(S=null==C||null==(k=C.reason)?void 0:k.description)&&void 0!==S?S:null==C||null==(E=C.reason)?void 0:E.code;M&&(R.$feature_flag_reason=M),null!=C&&null!=(P=C.metadata)&&P.id&&(R.$feature_flag_id=C.metadata.id),et(null==C?void 0:C.original_variant)&&et(null==C?void 0:C.original_enabled)||(R.$feature_flag_original_response=et(C.original_variant)?C.original_enabled:C.original_variant),null!=C&&null!=(T=C.metadata)&&T.original_payload&&(R.$feature_flag_original_payload=null==C||null==(I=C.metadata)?void 0:I.original_payload),F.length&&(R.$feature_flag_error=F.join(",")),this.Ah(R)}else e&&this.Dr({[Er]:u,[$r]:e});if(s)return{key:t,enabled:!!n,variant:"string"==typeof n?n:void 0,payload:m(o)}}}else this.I.warn('getFeatureFlagResult for key "'+t+dh)}Ah(t){try{var i;null==(i=this.ns)||i.capture("$feature_flag_called",t).catch((t=>{this.I.error("Failed to capture feature flag call",t)}))}catch(t){this.I.error("Failed to capture feature flag call",t)}}getRemoteConfigPayload(t,i){this.Fh(t,i)}Fh(t,i){var e=this;return p((function*(){var r=e.ns;if(r){var s={distinct_id:r.distinctId,token:r.projectToken,person_properties:{$lib:r.library.name,$lib_version:r.library.version}},n=e.Th();n.length&&(s.evaluation_contexts=n);var o,a=e.Mh();et(a)||(s.flag_keys=a);try{var l,h=null==(l=(yield r.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:s,compression:"base64"===e.qi.compression?mo:void 0,sentAt:"body",timeoutMs:e.qi.requestTimeoutMs})).json)?void 0:l.featureFlagPayloads;o=(null==h?void 0:h[t])||void 0}catch(t){return void e.I.error("Remote config feature flag request failed",t)}try{i(o)}catch(t){e.I.error("Remote config feature flag callback failed",t)}}}))()}isFeatureEnabled(t,i){if(void 0===i&&(i={}),i.fresh&&!this.dh)return i.defaultValue;if(!(this.ah||this.getFlags()&&this.getFlags().length>0))return this.I.warn('isFeatureEnabled for key "'+t+dh),i.defaultValue;var e=this.getFeatureFlag(t,i);return et(e)?i.defaultValue:!!e}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((i=>i!==t))}receivedFeatureFlags(t,i,e){this.Eh(t,i,e)}Eh(t,i,e){if(this.ns){this.ah=!0;var r=function(t,i,e,r,s,n){void 0===i&&(i={}),void 0===e&&(e={}),void 0===r&&(r={}),void 0===n&&(n=hh);var o=((t,i)=>{var e=t.flags;return e?g({},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]}))),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&&i.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t)})(t,n),a=o.flags,l=o.featureFlags,h=o.featureFlagPayloads;if(l){var u=t.requestId,d=t.evaluatedAt;if(X(l)){n.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;return{[lr]:l,[ar]:v,[cr]:!1}}var f=l,p=h,_=a;if(null!=s&&s.partialResponse)f=g({},i,f),p=g({},e,p),_=g({},r,_);else if(t.errorsWhileComputingFlags)if(a){var m=new Set(Object.keys(a).filter((t=>{var i;return!(null!=(i=a[t])&&i.failed)})));f=g({},i,Object.fromEntries(Object.entries(f).filter((t=>m.has(t[0]))))),p=g({},e,Object.fromEntries(Object.entries(p||{}).filter((t=>m.has(t[0]))))),_=g({},r,Object.fromEntries(Object.entries(_||{}).filter((t=>m.has(t[0])))))}else f=g({},i,f),p=g({},e,p),_=g({},r,_);return g({[lr]:Object.keys(fh(f)),[ar]:f||{},[dr]:p||{},[ur]:_||{},[cr]:!0===t.minimalFlagCalledEvents},u?{[vr]:u}:{},d?{[Tr]:d}:{})}}(t,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),e,this.I);r&&this.Dr(r),i||(this.fh=!1),this.Lh(i)}}override(t,i){void 0===i&&(i=!1),this.I.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:i})}overrideFeatureFlags(t){this.Oh(t)}Oh(t){if(this.ns){if(!1===t)return this.qr([fr,pr]),this.Lh(),void uh.info("All overrides cleared");if(X(t))return this.Dr({[fr]:ch(t)}),this.Lh(),void uh.info("Flag overrides set",{flags:t});if(t&&"object"==typeof t&&("flags"in t||"payloads"in t)){var i,e=t;this.ih=Boolean(null!==(i=e.suppressWarning)&&void 0!==i&&i);var r={},s=e.flags,n=e.payloads;return s&&(r[fr]=X(s)?ch(s):s),n&&(r[pr]=n),Object.keys(r).length&&this.Dr(r),!1===s&&!1===n?this.qr([fr,pr]):!1===s?this.qr(fr):!1===n&&this.qr(pr),this.Lh(),!1===s?uh.info("Flag overrides cleared"):s&&uh.info("Flag overrides set",{flags:s}),void(!1===n?uh.info("Payload overrides cleared"):n&&uh.info("Payload overrides set",{payloads:n}))}if(t&&"object"==typeof t)return this.Dr({[fr]:t}),this.Lh(),void uh.info("Flag overrides set",{flags:t});this.I.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}else this.I.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.ah){var i=this.Dh(),e=i.flags,r=i.flagVariants;try{t(e,r)}catch(t){this.I.error("Error while running feature flags callback",t)}}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,i,e){var r=(this.Sh(hr)||[]).find((i=>i.flagKey===t)),s={["$feature_enrollment/"+t]:i},n={$feature_flag:t,$feature_enrollment:i,$set:s};r&&(n.$early_access_feature_name=r.name),e&&(n.$feature_enrollment_stage=e);var o=g({},this.getFlagVariants(),{[t]:i});this.Dr({[lr]:Object.keys(fh(o)),[ar]:o,[gr]:g({},this.Sh(gr)||{},s)}),this.Lh();try{var a;null==(a=this.ns)||a.capture("$feature_enrollment_update",n).catch((t=>{this.I.error("Failed to capture early access feature enrollment",t)}))}catch(t){this.I.error("Failed to capture early access feature enrollment",t)}}getEarlyAccessFeatures(t,i,e){void 0===i&&(i=!1);var r=this.Sh(hr);!r||i?this.$h(t,e):t(r)}$h(t,i){var e=this;return p((function*(){var r=e.ns;if(r){var s,n=i?"&"+i.map((t=>"stage="+t)).join("&"):"";try{var o=yield r.sendRequest("/api/early_access_features/?token="+r.projectToken+n,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;e.Dr({[hr]:s=o.json.earlyAccessFeatures})}catch(t){return void e.I.error("Early access feature request failed",t)}try{t(s)}catch(t){e.I.error("Early access feature callback failed",t)}}}))()}Dh(){var t=this.getFlags(),i=this.getFlagVariants();return{flags:t.filter((t=>i[t])),flagVariants:Object.keys(i).filter((t=>i[t])).reduce(((t,e)=>(t[e]=i[e],t)),{})}}Lh(t){this.wh();var i=this.Dh(),e=i.flags,r=i.flagVariants;this.featureFlagEventHandlers.forEach((i=>{try{i(e,r,{errorsLoading:t})}catch(t){this.I.error("Error while running feature flags callback",t)}}))}setPersonPropertiesForFlags(t,i){void 0===i&&(i=!0),this.Nh(t,i)}Nh(t,i){void 0===i&&(i=!0);var e=this.Sh(gr)||{},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 e||(n[o]=s[o]));this.Dr({[gr]:g({},e,n,r)}),i&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=g({},this.Sh(gr)||{});t.forEach((t=>{delete e[t]})),this.Dr({[gr]:e}),i&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(t){void 0===t&&(t=!0),this.qr(gr),t&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(t,i){void 0===i&&(i=!0);var e=this.Sh(_r)||{},r=g({},e);for(var s of Object.keys(t))r[s]=g({},e[s],t[s]);this.Dr({[_r]:r}),i&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var i=this.Sh(_r)||{};this.Dr({[_r]:g({},i,{[t]:{}})})}else this.qr(_r)}reset(){this.lh++,this.hh=!1,this.rh={},this.nh={},this.ah=!1,this.uh=!1,this.dh=!1,this.$anon_distinct_id=void 0,this.kh(),this.ih=!1,this.ph=0}}},Th={sessionRecording:class{get qi(){return this._instance.config}get za(){return this._instance.persistence}get started(){var t;return!(null==(t=this.qh)||!t.isStarted)}get status(){var t,i;return this.jh===jl||this.jh===Ll?this.jh:null!==(t=null==(i=this.qh)?void 0:i.status)&&void 0!==t?t:this.jh}constructor(i){if(this._forceAllowLocalhostNetworkCapture=!1,this.jh=Ol,this.Bh=void 0,this.Hh=!1,this.kt=(()=>{var i;if(null==r||!r.visibilityState||"visible"===r.visibilityState)return!0;var e=null==t||null==(i=t.performance)||null==i.getEntriesByType?void 0:i.getEntriesByType("visibility-state");return!(null!=e&&e.length)||e.some((t=>"visible"===t.name))})(),this.It=()=>{var t;"visible"===(null==r?void 0:r.visibilityState)&&(this.kt=!0,null==(t=this.qh)||null==t.setDocumentWasEverVisible||t.setDocumentWasEverVisible(!0))},this._instance=i,!this._instance.sessionManager)throw Bl.error("started without valid sessionManager"),new Error(Nl+" started without valid sessionManager. This is a bug.");if(this.qi.cookieless_mode===qr)throw new Error(Nl+' cannot be used with cookieless_mode="always"');null!=r&&r.addEventListener&&ls(r,"visibilitychange",this.It)}initialize(){this.startIfEnabledOrStop()}dispose(){this.Hh=!0,null==r||null==r.removeEventListener||r.removeEventListener("visibilitychange",this.It),this.stopRecording()}get Uh(){var i,e=!(null==(i=this._instance.get_property(Ze))||!i.enabled),r=!this.qi.disable_session_recording,s=this.qi.disable_session_recording||this._instance.consent.isOptedOut();return t&&e&&r&&!s}startIfEnabledOrStop(t){var i;if(!(this.Hh||this.Uh&&null!=(i=this.qh)&&i.isStarted)){var e=!et(Object.assign)&&!et(Array.from);this.Uh&&e?(this.zh(t),Bl.info("starting")):(this.jh=Ol,this.stopRecording())}}zh(t){var i,e,r;this.Uh&&(this.jh!==jl&&this.jh!==Ll&&(this.jh=Dl),null!=v&&null!=(i=v.__PosthogExtensions__)&&null!=(i=i.rrweb)&&i.record&&null!=(e=v.__PosthogExtensions__)&&e.initSessionRecording?this.Wh(t):null==(r=v.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.Vh,(i=>{if(i)return this._instance.register_for_session({[Br]:!0}),Bl.error("could not load recorder",i);this.Wh(t)})))}stopRecording(){var t,i;null==(t=this.Bh)||t.call(this),this.Bh=void 0,null==(i=this.qh)||i.stop()}Gh(){var t,i;null==(t=this.Bh)||t.call(this),this.Bh=void 0,null==(i=this.qh)||i.discard()}Zh(){var t,i;null==(t=this.za)||t.unregister(or),null==(i=this.za)||i.unregister(tr)}Qh(t,i){if(ot(t))return null;var e,r=at(t)?t:parseFloat(t);return"number"!=typeof(e=r)||!Number.isFinite(e)||0>e||e>1?(Bl.warn(i+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Jh(t){if(this.za){var i,e,r=this.za,s=()=>{var i,e=!1===t.sessionRecording?void 0:t.sessionRecording,s=this.Qh(null==(i=this.qi.session_recording)?void 0:i.sampleRate,"session_recording.sampleRate"),n=this.Qh(null==e?void 0:e.sampleRate,"remote config sampleRate"),o=null!=s?s:n;ot(o)&&this.Zh();var a=null==e?void 0:e.minimumDurationMilliseconds;r.register({[Ze]:g({cache_timestamp:Date.now(),enabled:!!e},e,{networkPayloadCapture:g({capturePerformance:t.capturePerformance},null==e?void 0:e.networkPayloadCapture),canvasRecording:{enabled:null==e?void 0:e.recordCanvas,fps:null==e?void 0:e.canvasFps,quality:null==e?void 0:e.canvasQuality},sampleRate:o,minimumDurationMilliseconds:et(a)?null:a,endpoint:null==e?void 0:e.endpoint,triggerMatchType:null==e?void 0:e.triggerMatchType,masking:null==e?void 0:e.masking,urlTriggers:null==e?void 0:e.urlTriggers,version:null==e?void 0:e.version,triggerGroups:null==e?void 0:e.triggerGroups})})};s(),null==(i=this.Bh)||i.call(this),this.Bh=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(s)}}onRemoteConfig(t){var i=t.ok?t.config:void 0;return i&&"sessionRecording"in i?!1===i.sessionRecording?(this.Jh(i),void this.Gh()):(this.Jh(i),void this.startIfEnabledOrStop()):(this.jh===jl&&(this.jh=Ll,Bl.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,i){var e;void 0===i&&(i="log"),null!=(e=this.qh)&&e.log?this.qh.log(t,i):Bl.warn("log called before recorder was ready")}get Vh(){var t,i,e=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.get_property(Ze);return(null==e||null==(i=e.scriptConfig)?void 0:i.script)||"lazy-recorder"}Kh(){var t,i=this._instance.get_property(Ze);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(t){return Bl.warn("persisted remote config for session recording is invalid and will be ignored",t),!1}return!ot(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}Wh(t){var i,e,r;if(!this.Hh){if(null==(i=v.__PosthogExtensions__)||!i.initSessionRecording)return Bl.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Br]:!0});var s;if(this.qh||(this.qh=null==(s=v.__PosthogExtensions__)?void 0:s.initSessionRecording(this._instance,this.kt),this.qh._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Kh()){if(this.jh===Ll||this.jh===jl)return;return this.jh=jl,Bl.info("persisted remote config is stale, requesting fresh config before starting"),void new To(this._instance).load()}this.jh=Dl,null==(e=(r=this.qh).setDocumentWasEverVisible)||e.call(r,this.kt),this.qh.start(t)}}onRRwebEmit(t){var i;null==(i=this.qh)||null==i.onRRwebEmit||i.onRRwebEmit(t)}overrideLinkedFlag(){var t,i;this.qh||null==(i=this.za)||i.register({[er]:!0}),null==(t=this.qh)||t.overrideLinkedFlag()}overrideSampling(){var t,i;this.qh||null==(i=this.za)||i.register({[ir]:!0}),null==(t=this.qh)||t.overrideSampling()}overrideTrigger(t){var i,e;this.qh||null==(e=this.za)||e.register({["url"===t?rr:sr]:!0}),null==(i=this.qh)||i.overrideTrigger(t)}get sdkDebugProperties(){var t;return(null==(t=this.qh)?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,i){var e;return!(null==(e=this.qh)||!e.tryAddCustomEvent(t,i))}}},Ch={autocapture:class extends El{constructor(t){super(new $l(t)),this.instance=t}},historyAutocapture:class{constructor(t){this._instance=t,this.Yh=this.Xh()}initialize(){this.startIfEnabled()}get isEnabled(){var t=this.td();return!!(t.path||t.search||this.ed(t))}startIfEnabled(){this.isEnabled&&(Re.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.Yh=this.Xh(),this.startIfEnabled()}stop(){this.rd&&this.rd(),this.rd=void 0,this.nd&&this.nd(),this.nd=void 0,Re.info("History API monitoring stopped")}monitorHistoryChanges(){t&&t.history&&(this.sd("pushState"),this.sd("replaceState"),this.ad(),this.ed()&&this.od())}sd(i){var e;if(t&&(null==(e=t.history[i])||!e.__posthog_wrapped__)){var r=this;!function(t,i,e){try{if(!(i in t))return Tl;var r={next:t[i]},s=e((function(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];return r.next.apply(this,i)}));return Z(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:r}})),t[i]=s,()=>{if(t[i]!==s)for(var e=t[i];Z(e)&&e.__posthog_layer__;){var n=e.__posthog_layer__;if(n.next===s)return void(n.next=r.next);e=n.next}else t[i]=r.next}}catch(t){return Tl}}(t.history,i,(t=>function(e,s,n){t.call(this,e,s,n),r.ld(i)}))}}Xh(){var i=null==t?void 0:t.location;if(null!=i&&i.pathname)return{pathname:i.pathname,search:i.search,hash:i.hash}}td(){var t=this._instance.config.capture_pageview;return"history_change"===t?{path:!0}:tt(t)?t:{}}ed(t){return void 0===t&&(t=this.td()),!!t.hash&&!this._instance.config.disable_capture_url_hashes}ud(t){var i=this.td(),e=this.Yh;return!(!e||!(i.path&&t.pathname!==e.pathname||i.search&&t.search!==e.search||this.ed(i)&&t.hash!==e.hash))}ld(t){try{var i=this.Xh();if(!i)return;this.ud(i)&&this._instance.capture(Jr,{navigation_type:t}),this.Yh=i}catch(i){Re.error("Error capturing "+t+" pageview",i)}}ad(){if(!this.rd){var i=()=>{this.ld("popstate")};ls(t,"popstate",i),this.rd=()=>{t&&t.removeEventListener("popstate",i)}}}od(){if(!this.nd){var i=()=>{this.ld("hashchange")};ls(t,"hashchange",i),this.nd=()=>{t&&t.removeEventListener("hashchange",i)}}}},heatmaps:class{get qi(){return this.instance.config}constructor(t){var i;this.hd=!1,this.Qn=!1,this.dd=null,this.instance=t,this.hd=!(null==(i=this.instance.persistence)||!i.props[Ve]),this.rageclicks=new yl(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return tt(this.qi.capture_heatmaps)&&this.qi.capture_heatmaps.flush_interval_milliseconds&&(t=this.qi.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return ot(this.qi.capture_heatmaps)?ot(this.qi.enable_heatmaps)?this.hd:this.qi.enable_heatmaps:!1!==this.qi.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.Qn)return;zl.info("starting..."),this.vd(),this.It()}else{var t;clearInterval(null!==(t=this.dd)&&void 0!==t?t:void 0),this.fd(),this.getAndClearBuffer()}}onRemoteConfig(t){if(t.ok){var i=t.config;if("heatmaps"in i){var e=!!i.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Ve]:e}),this.hd=e,this.startIfEnabled()}}}getAndClearBuffer(){var t=this.ft;return this.ft=void 0,t}pd(t){Ul(t.originalEvent)&&this.ki(t.originalEvent,"deadclick")}It(){this.dd&&clearInterval(this.dd),this.dd=function(t){return"visible"===(null==t?void 0:t.visibilityState)}(r)?setInterval(this.La.bind(this),this.flushIntervalMilliseconds):null}vd(){t&&r&&(this.gd=this.La.bind(this),ls(t,Kr,this.gd),this.md=i=>this.ki(i||(null==t?void 0:t.event)),ls(r,"click",this.md,{capture:!0}),this.yd=i=>this.bd(i||(null==t?void 0:t.event)),ls(r,"mousemove",this.yd,{capture:!0}),this._d=new Rn(this.instance,Cn,this.pd.bind(this)),this._d.startIfEnabledOrStop(),this.wd=this.It.bind(this),ls(r,Gr,this.wd),this.Qn=!0)}fd(){var i;t&&r&&(this.gd&&t.removeEventListener(Kr,this.gd),this.md&&r.removeEventListener("click",this.md,{capture:!0}),this.yd&&r.removeEventListener("mousemove",this.yd,{capture:!0}),this.wd&&r.removeEventListener(Gr,this.wd),clearTimeout(this.kd),null==(i=this._d)||i.stop(),this.Qn=!1)}Sd(i,e){var r=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),n=this.instance.scrollManager.scrollElement(),o=function(i,e,r){for(var s=i;s&&Hs(s)&&!Vs(s,"body");){if(s===r)return!1;var n=void 0;try{var o,a,l;n=null==(o=null!==(a=null==(l=s.ownerDocument)?void 0:l.defaultView)&&void 0!==a?a:t)?void 0:o.getComputedStyle(s).position}catch(t){return!1}if(V(e,n))return!0;s=sn(s)}return!1}(tn(i),["fixed","sticky"],n);return{x:i.clientX+(o?0:s),y:i.clientY+(o?0:r),target_fixed:o,type:e}}ki(t,i){var e;if(void 0===i&&(i="click"),!qs(t.target)&&Ul(t)){var r=this.Sd(t,i);null!=(e=this.rageclicks)&&e.isRageClick(t.clientX,t.clientY,(new Date).getTime())&&dn(tn(t),this.instance.config.rageclick)&&this.Nn(g({},r,{type:"rageclick"})),this.Nn(r)}}bd(t){!qs(t.target)&&Ul(t)&&(clearTimeout(this.kd),this.kd=setTimeout((()=>{this.Nn(this.Sd(t,"mousemove"))}),500))}Nn(i){if(t){var e=this.qi.disable_capture_url_hashes?Ci(t.location.href):t.location.href,r=this.qi.custom_personal_data_properties,s=this.qi.mask_personal_data_properties?[...Jn,...r||[]]:[],n=Hn(e,s,Qn);this.ft=this.ft||{},this.ft[n]||(this.ft[n]=[]),this.ft[n].push(i)}}La(){this.ft&&!it(this.ft)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:Rn,webVitalsAutocapture:class{constructor(t){var i;this.hd=!1,this.Qn=!1,this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.xd=()=>{clearTimeout(this.Cd),this.Cd=void 0,0!==this.ft.metrics.length&&(this._instance.capture("$web_vitals",g({$current_url:this.ft.url},this.ft.metrics.reduce(((t,i)=>g({},t,{["$web_vitals_"+i.name+"_event"]:g({},i),["$web_vitals_"+i.name+"_value"]:i.value})),{}))),this.ft={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Td=t=>{var i;if(this.ft=this.ft||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},ot(null==t?void 0:t.name)||ot(null==t?void 0:t.value))Fl.error("Invalid metric received",t);else{var e="string"==typeof t.navigationURL?t.navigationURL:void 0,r=this.Md(e);if(!et(r)){var s=at(t.navigationId)||"string"==typeof t.navigationId?"navigation:"+t.navigationId:"url:"+r;if(!this.Ed||this.Ed>t.value){this.ft.navigationKey!==s&&(this.xd(),this.Cd=setTimeout(this.xd,this.flushToCaptureTimeoutMs)),et(this.ft.navigationKey)&&(this.ft.navigationKey=s,this.ft.url=r),this.ft.firstMetricTimestamp=et(this.ft.firstMetricTimestamp)?Date.now():this.ft.firstMetricTimestamp;var n=null==(i=this._instance.sessionManager)?void 0:i.checkAndGetSessionAndWindowId(!0),o=g({},t,e?{navigationURL:r}:{},{$current_url:r,timestamp:Date.now()});if(delete o.entries,tt(t.attribution)&&this.attributionMetrics.indexOf(t.name)>-1){var a={};for(var l of Al){var h="url"===l&&"string"==typeof t.attribution[l]?this.Md(t.attribution[l]):t.attribution[l];et(h)||(a[l]=h)}o.attribution=a}else delete o.attribution;et(n)||(o.$session_id=n.sessionId,o.$window_id=n.windowId),this.ft.metrics.push(o),this.ft.metrics.length===this.allowedMetrics.length&&this.xd()}else Fl.error("Ignoring metric with value >= "+this.Ed,t)}}},this.Id=()=>{if(!this.Qn){var t,i,e,r,s=!1,n=v.__PosthogExtensions__,o=null==n?void 0:n.postHogWebVitalsCallbacksByFlavor,a=(null==o?void 0:o[this.Rd])||("web-vitals"===this.Rd&&et(o)?null==n?void 0:n.postHogWebVitalsCallbacks:void 0);if(!et(a)){var l=a.withoutAttribution,h=this.attributionMetrics;s=!et(l),t=h.indexOf("LCP")>-1?a.onLCP:(null==l?void 0:l.onLCP)||a.onLCP,i=h.indexOf("CLS")>-1?a.onCLS:(null==l?void 0:l.onCLS)||a.onCLS,e=h.indexOf("FCP")>-1?a.onFCP:(null==l?void 0:l.onFCP)||a.onFCP,r=h.indexOf("INP")>-1?a.onINP:(null==l?void 0:l.onINP)||a.onINP}if(t&&i&&e&&r){var u={reportSoftNavs:this.useSoftNavs},d=s&&this.attributionMetrics.indexOf("INP")>-1?g({},u,{includeProcessedEventEntries:!1}):u;this.allowedMetrics.indexOf("LCP")>-1&&t(this.Td.bind(this),u),this.allowedMetrics.indexOf("CLS")>-1&&i(this.Td.bind(this),u),this.allowedMetrics.indexOf("FCP")>-1&&e(this.Td.bind(this),u),this.allowedMetrics.indexOf("INP")>-1&&r(this.Td.bind(this),d),this.Qn=!0}else Fl.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.hd=!(null==(i=this._instance.persistence)||!i.props[Je]),this.startIfEnabled()}get Pd(){return this._instance.config.capture_performance}get allowedMetrics(){var t,i,e=tt(this.Pd)?null==(t=this.Pd)?void 0:t.web_vitals_allowed_metrics:void 0;return ot(e)?(null==(i=this._instance.persistence)?void 0:i.props[Xe])||Il:e}get flushToCaptureTimeoutMs(){return(tt(this.Pd)?this.Pd.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){var t=tt(this.Pd)?this.Pd.web_vitals_attribution:void 0;return ht(t)?t?Il:[]:X(t)?t:Ml}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){var t=tt(this.Pd)?this.Pd.__preview_web_vitals_soft_navs:void 0;return null!=t&&t}get Ed(){var t=tt(this.Pd)&&at(this.Pd.__web_vitals_max_value)?this.Pd.__web_vitals_max_value:Rl;return t>0&&6e4>=t?Rl:t}get isEnabled(){var t=null==s?void 0:s.protocol;if("http:"!==t&&"https:"!==t)return Fl.info("Web Vitals are disabled on non-http/https protocols"),!1;var i=tt(this.Pd)?this.Pd.web_vitals:ht(this.Pd)?this.Pd:void 0;return ht(i)?i:this.hd}startIfEnabled(){this.isEnabled&&!this.Qn&&(Fl.info("enabled, starting..."),this._s(this.Id))}onRemoteConfig(t){if(t.ok){var i=t.config;if("capturePerformance"in i){var e=tt(i.capturePerformance)&&!!i.capturePerformance.web_vitals,r=tt(i.capturePerformance)?i.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[Je]:e}),this._instance.persistence.register({[Xe]:r})),this.hd=e,this.startIfEnabled()}}}get Rd(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}_s(t){var i=v.__PosthogExtensions__,e=this.Rd,r=null==i?void 0:i.postHogWebVitalsCallbacksByFlavor;null!=r&&r[e]||"web-vitals"===e&&et(r)&&null!=i&&i.postHogWebVitalsCallbacks?t():null==i||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,(i=>{i?Fl.error("failed to load script",i):t()}))}Md(i){var e=i||(null==t?void 0:t.location.href);if(e){var r=this._instance.config.disable_capture_url_hashes?Ci(e):e,s=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Jn,...s||[]]:[];return Hn(r,n,Qn)}Fl.error("Could not determine current URL")}}},Fh={exceptionObserver:class{constructor(i){var e;this.Id=()=>{var i;if(t&&this.isEnabled&&null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions){var e=v.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=v.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=v.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Ad&&this.qi.capture_unhandled_errors&&(this.Ad=e(this.captureException.bind(this))),!this.Fd&&this.qi.capture_unhandled_rejections&&(this.Fd=r(this.captureException.bind(this))),!this.Ld&&this.qi.capture_console_errors&&(this.Ld=s(this.captureException.bind(this)))}catch(t){Pl.error("failed to start",t),this.Od()}}},this._instance=i,this.Dd=!(null==(e=this._instance.persistence)||!e.props[We]),this.oe=new xt(g({},function(t){var i,e,r,s;return void 0===t&&(t={}),{refillRate:null!==(i=null!==(e=t.exceptionRateLimiterRefillRate)&&void 0!==e?e:t.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=null!==(s=t.exceptionRateLimiterBucketSize)&&void 0!==s?s:t.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10}}(this._instance.config.error_tracking),{refillInterval:1e4,I:Pl})),this.qi=this.$d(),this.startIfEnabledOrStop()}$d(){var t=this._instance.config.capture_exceptions,i={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return tt(t)?i=g({},i,t):(et(t)?this.Dd:t)&&(i=g({},i,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),i}get isEnabled(){return this.qi.capture_console_errors||this.qi.capture_unhandled_errors||this.qi.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(Pl.info("enabled"),this.Od(),this._s(this.Id)):this.Od()}_s(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.errorWrappingFunctions?t():null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"exception-autocapture",(i=>{if(i)return Pl.error("failed to load script",i);t()}))}Od(){var t,i,e;null==(t=this.Ad)||t.call(this),this.Ad=void 0,null==(i=this.Fd)||i.call(this),this.Fd=void 0,null==(e=this.Ld)||e.call(this),this.Ld=void 0}onRemoteConfig(t){if(t.ok){var i=t.config;"autocaptureExceptions"in i&&(this.Dd=!!i.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[We]:this.Dd}),this.qi=this.$d(),this.startIfEnabledOrStop())}}onConfigChange(){this.qi=this.$d()}captureException(t){var i,e,r,s=null!==(i=null==t||null==(e=t.$exception_list)||null==(e=e[0])?void 0:e.type)&&void 0!==i?i:"Exception";this.oe.consumeRateLimit(s)?Pl.info("Skipping exception capture because of client rate limiting.",{exception:s}):null==(r=this._instance.exceptions)||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var i,e;this.Nd=[],this.qd=new te([new ve,new xe,new fe,new ce,new be,new ye,new ge,new we],function(t){for(var i=arguments.length,e=new Array(i>1?i-1:0),r=1;i>r;r++)e[r-1]=arguments[r];return function(i,r){void 0===r&&(r=0);for(var s=[],n=i.split("\n"),o=r;n.length>o;o++){var a=n[o];if(1024>=a.length){var l=de.test(a)?a.replace(de,"$1"):a;if(!l.match(/\S*Error: /)){for(var h of e){var u=h(l,t);if(u){s.push(u);break}}if(s.length>=50)break}}}return function(t){if(!t.length)return[];var i=Array.from(t);return i.reverse(),i.slice(0,50).map((t=>{return g({},t,{filename:t.filename||(e=i,e[e.length-1]||{}).filename,function:t.function||ie});var e}))}(s)}}("web:javascript",ae,ue)),this._instance=t,this.Nd=null!==(i=null==(e=this._instance.persistence)?void 0:e.get_property(Ge))&&void 0!==i?i:[],this.jd=Pe(this.Bd()),this.Hd=new Te(this.jd)}onConfigChange(){this.jd=Pe(this.Bd()),this.Hd.setConfig(this.jd)}onRemoteConfig(t){var i,e,r;if(t.ok){var s=t.config;if("errorTracking"in s){var n=null!==(i=null==(e=s.errorTracking)?void 0:e.suppressionRules)&&void 0!==i?i:[],o=null==(r=s.errorTracking)?void 0:r.captureExtensionExceptions;this.Nd=n,this._instance.persistence&&this._instance.persistence.register({[Ge]:this.Nd,[Ke]:o})}}}get Ud(){var t,i=!!this._instance.get_property(Ke),e=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(t=null!=e?e:i)&&void 0!==t&&t}buildProperties(t,i){return this.qd.buildFromUnknown(t,{syntheticException:null==i?void 0:i.syntheticException,mechanism:{handled:null==i?void 0:i.handled}})}addExceptionStep(t,i){if(this.jd.enabled)try{if(!rt(t)||0===t.trim().length)return void ph.warn("Ignoring exception step because message must be a non-empty string");var e=function(t){if(!t)return{sanitizedProperties:{},droppedKeys:[]};var i=[];return{sanitizedProperties:Object.keys(t).reduce(((e,r)=>Ee.has(r)?(i.push(r),e):(e[r]=t[r],e)),{}),droppedKeys:i}}(this.zd(i)),r=e.sanitizedProperties,s=e.droppedKeys;s.length>0&&ph.warn("Ignoring reserved exception step fields",{droppedKeys:s}),this.Hd.add(g({[Se]:t,[ke]:(new Date).toISOString()},r))}catch(t){ph.error("Failed to add exception step. Ignoring breadcrumb.",t)}}sendExceptionEvent(t){try{var i=t.$exception_list;if(this.Wd(i)){if(this.Vd(i))return this.Gd("Exception dropped: matched a suppression rule"),void ph.info("Skipping exception capture because a suppression rule matched");if(!this.Ud&&this.Zd(i))return this.Gd("Exception dropped: thrown by a browser extension"),void ph.info("Skipping exception capture because it was thrown by an extension");if(!this.Ud&&this.Qd(i))return this.Gd("Exception dropped: thrown by an injected browser script"),void ph.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.Jd(i))return this.Gd("Exception dropped: thrown by the PostHog SDK"),void ph.info("Skipping exception capture because it was thrown by the PostHog SDK")}var e=this.jd.enabled&&ot(t.$exception_steps)?this.Kd(t):t,r="string"==typeof(n=globalThis._posthogReleaseId)&&n.length>0?n:void 0;r&&(e.$release_id=r);try{var s=this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent",fl:!0});return s&&this.Hd.clear(),s}catch(t){return ph.error("Failed to capture exception event. Dropping this exception.",t),void this.Hd.clear()}}catch(t){return void ph.error("Failed to process exception event. Ignoring this exception.",t)}var n}Kd(t){try{var i=this.Hd.getAttachable();return 0===i.length?t:g({},t,{$exception_steps:i})}catch(i){return ph.error("Failed to read buffered exception steps. Capturing exception without steps.",i),t}}Gd(t){this.jd.enabled&&this.Hd.add({[Se]:t,[ke]:(new Date).toISOString()})}zd(t){return tt(t)?g({},t):{}}Bd(){var t,i;return null!==(t=null==(i=this._instance.config.error_tracking)?void 0:i.exception_steps)&&void 0!==t?t:{}}Vd(t){if(0===t.length)return!1;try{var i=t.reduce(((t,i)=>{var e=i.type,r=i.value;return rt(e)&&e.length>0&&t.$exception_types.push(e),rt(r)&&r.length>0&&t.$exception_values.push(r),t}),{$exception_types:[],$exception_values:[]});return this.Nd.some((t=>{var e=t.values.map((t=>{var e=La[t.operator],r=i[t.key];if(!e||!r)return!1;var s=X(t.value)?t.value:[t.value];return s.length>0&&e(s,r)}));return"OR"===t.type?e.some(Boolean):e.every(Boolean)}))}catch(t){return ph.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}Zd(t){return t.flatMap((t=>{var i,e;return null!==(i=null==(e=t.stacktrace)?void 0:e.frames)&&void 0!==i?i:[]})).some((t=>{var i=t.filename;return!!i&&gh.some((t=>i.startsWith(t)))}))}Qd(t){return t.some((t=>{var i=t.value;return rt(i)&&_h.some((t=>i.includes(t)))}))}Jd(t){if(t.length>0){var i,e,r,s,n=null!==(i=null==(e=t[0].stacktrace)?void 0:e.frames)&&void 0!==i?i:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Wd(t){return!ot(t)&&X(t)}}},Rh=g({productTours:class{get za(){return this._instance.persistence}constructor(t){this.Yd=null,this.Xd=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(t.ok){var i=t.config;if("productTours"in i){var e,r;if(this.za&&this.za.register({[Qe]:!!i.productTours}),!Hl(this._instance))return!this.Yd&&ot(null==(e=this.za)?void 0:e.props[kr])||ql.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.Yd)||r.stop(),this.Yd=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Yd&&Hl(this._instance)&&this._s((()=>this.tv()))}_s(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.generateProductTours?t():null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"product-tours",(i=>{i?ql.error("Could not load product tours script",i):t()}))}tv(){var t;!this.Yd&&null!=(t=v.__PosthogExtensions__)&&t.generateProductTours&&(this.Yd=v.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,i){if(void 0===i&&(i=!1),!X(this.Xd)||i){var e=this.za;if(e){var r=e.props[kr];if(X(r)&&!i)return this.Xd=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",timestampMode:"query",callback:i=>{if(Hl(this._instance)){var r=i.statusCode;if(200!==r||!i.json){var s="Product Tours API could not be loaded, status: "+r;return 0===r?i.error||ql.warn(s):ql.error(s),void t([],{isLoaded:!1,error:s})}var n=X(i.json.product_tours)?i.json.product_tours:[];this.Xd=n,e&&e.register({[kr]:n}),t(n,{isLoaded:!0})}else t([],{isLoaded:!0})}})}else t(this.Xd,{isLoaded:!0})}getActiveProductTours(t){ot(this.Yd)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.Yd.getActiveProductTours(t)}showProductTour(t){var i;null==(i=this.Yd)||i.showTourById(t)}previewTour(t){this.Yd?this.Yd.previewTour(t):this._s((()=>{var i;this.tv(),null==(i=this.Yd)||i.previewTour(t)}))}dismissProductTour(){var t;null==(t=this.Yd)||t.dismissTour("user_clicked_skip")}nextStep(){var t;null==(t=this.Yd)||t.nextStep()}previousStep(){var t;null==(t=this.Yd)||t.previousStep()}clearCache(){var t;this.Xd=null,null==(t=this.za)||t.unregister(kr)}resetTour(t){var i;null==(i=this.Yd)||i.resetTour(t)}resetAllTours(){var t;null==(t=this.Yd)||t.resetAllTours()}cancelPendingTour(t){var i;null==(i=this.Yd)||i.cancelPendingTour(t)}}},Ph),Ih={siteApps:class{constructor(t){this.ev=0,this._instance=t,this.iv=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}rv(t,i){if(i){var e=this.globalsForEvent(i);this.iv.push(e),this.iv.length>1e3&&(this.iv=this.iv.slice(10))}}get siteAppLoaders(){var t;return null==(t=v._POSTHOG_REMOTE_CONFIG)||null==(t=t[this._instance.config.token])?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.rv.bind(this));this.nv=()=>{t(),this.iv=[],this.nv=void 0}}}globalsForEvent(t){var i,e,r,s,n,o,a;if(!t)throw new Error("Event payload is required");var l={},h=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var d of Object.entries(u)){var v=d[0];l[v]={id:h[v],type:v,properties:d[1]}}var c=t.$set_once,f=t.$set;return{event:g({},_(t,Vl),{properties:g({},t.properties,f?{$set:g({},null!==(i=null==(e=t.properties)?void 0:e.$set)&&void 0!==i?i:{},f)}:{},c?{$set_once:g({},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}}sv(t){var i,e=null==(i=t.tagName)?void 0:i.toLowerCase();return"style"===e&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(t)||(Wl.error("prepare_external_dependency_stylesheet returned null"),null):"script"===e&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(t)||(Wl.error("prepare_external_dependency_script returned null"),null):t}av(){var t,i,e,s,n,o,a,l;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var h=null==r?void 0:r.defaultView,u=null==h||null==(t=h.Node)?void 0:t.prototype;if(!h||!u)return()=>{};if(this.ev++,this.ov)return this.lv();var d=[],v=this,c=new WeakSet,f=(t,i,e)=>{if(null!=t&&t[i]){var r=t[i];t[i]=e(r),d.push((()=>{t[i]=r}))}},p=t=>{if(c.has(t))return t;var i=v.sv(t);return i&&c.add(i),i},g=t=>t.map((t=>"string"==typeof t?t:p(t))).filter((t=>!nt(t)));return f(u,"appendChild",(t=>function(i){var e=p(i);return e?t.call(this,e):i})),f(u,"insertBefore",(t=>function(i,e){var r=p(i);return r?t.call(this,r,e):i})),f(u,"replaceChild",(t=>function(i,e){var r=p(i);return r?t.call(this,r,e):e})),[null==(i=h.Element)?void 0:i.prototype,null==(e=h.Document)?void 0:e.prototype,null==(s=h.DocumentFragment)?void 0:s.prototype].forEach((t=>{f(t,"append",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))})),f(t,"prepend",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))}))})),[null==(n=h.Element)?void 0:n.prototype,null==(o=h.CharacterData)?void 0:o.prototype,null==(a=h.DocumentType)?void 0:a.prototype].forEach((t=>{f(t,"before",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))})),f(t,"after",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];return t.apply(this,g(e))})),f(t,"replaceWith",(t=>function(){for(var i=arguments.length,e=new Array(i),r=0;i>r;r++)e[r]=arguments[r];var s=g(e);return e.length&&!s.length?void 0:t.apply(this,s)}))})),f(null==(l=h.Element)?void 0:l.prototype,"insertAdjacentElement",(t=>function(i,e){var r=p(e);return r?t.call(this,i,r):null})),this.ov=()=>{d.forEach((t=>t())),this.ov=void 0},this.lv()}lv(){var t=!1;return()=>{var i;t||(t=!0,this.ev--,0===this.ev&&(null==(i=this.ov)||i.call(this)))}}uv(t,i){void 0===i&&(i=!0);var e=this.av();try{var r=t(e);return i&&e(),r}catch(t){throw e(),t}}setupSiteApp(t){var i=this.apps[t.id],e=()=>{var e;!i.errored&&this.iv.length&&(Wl.info("Processing "+this.iv.length+" events for site app with id "+t.id),this.iv.forEach((t=>this.uv((()=>null==i.processEvent?void 0:i.processEvent(t))))),i.processedBuffer=!0),Object.values(this.apps).every((t=>t.processedBuffer||t.errored))&&(null==(e=this.nv)||e.call(this))},r=!1,s=s=>{i.errored=!s,i.loaded=!0,Wl.info("Site app with id "+t.id+" "+(s?"loaded":"errored")),r&&e()};try{var n=this.uv((i=>t.init({posthog:this._instance,callback(t){i(),s(t)}})),!1).processEvent;n&&(i.processEvent=n),r=!0}catch(i){Wl.error(Gl+t.id,i),s(!1)}if(r&&i.loaded)try{e()}catch(e){Wl.error("Error while processing buffered events PostHog app with config id "+t.id,e),i.errored=!0}}hv(){var t=this.siteAppLoaders||[];for(var i of t)this.apps[i.id]={id:i.id,loaded:!1,errored:!1,processedBuffer:!1};for(var e of t)this.setupSiteApp(e)}dv(t){var i=this;if(0!==Object.keys(this.apps).length){var e=this.globalsForEvent(t),r=function(r){try{i.uv((()=>null==r.processEvent?void 0:r.processEvent(e)))}catch(i){Wl.error("Error while processing event "+t.event+" for site app "+r.id,i)}};for(var s of Object.values(this.apps))r(s)}}onRemoteConfig(t){var i,e,r,s=this;if(null!=(i=this.siteAppLoaders)&&i.length)return this.isEnabled?(this.hv(),void this._instance.on("eventCaptured",(t=>this.dv(t)))):void Wl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(e=this.nv)||e.call(this),t.ok){var n=t.config;if(null!=(r=n.siteApps)&&r.length)if(this.isEnabled){var o=function(){var t,i=a.id,e=a.url;v["__$$ph_site_app_"+i]=s._instance,null==(t=v.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,e,(t=>{if(t)return Wl.error(Gl+i,t)}))};for(var a of n.siteApps)o()}else Wl.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},Mh={tracingHeaders:class{constructor(t){this.vv=void 0,this.fv=void 0,this.pv=void 0,this.Id=()=>{var t,i,e=this.gv();e?(et(this.vv)&&(this.vv=null==(t=v.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchXHR(e,(()=>this._instance.get_distinct_id()),this._instance.sessionManager)),et(this.fv)&&(this.fv=null==(i=v.__PosthogExtensions__)||null==(i=i.tracingHeadersPatchFns)?void 0:i._patchFetch(e,(()=>this._instance.get_distinct_id()),this._instance.sessionManager))):this.Od()},this._instance=t}initialize(){this.startIfEnabledOrStop()}_s(t){var i,e;null!=(i=v.__PosthogExtensions__)&&i.tracingHeadersPatchFns?t():null==(e=v.__PosthogExtensions__)||null==e.loadExternalDependency||e.loadExternalDependency(this._instance,"tracing-headers",(i=>{if(i)return Cl.error("failed to load script",i);t()}))}mv(){var t,i;return null!==(t=null!==(i=this._instance.config.tracing_headers)&&void 0!==i?i:this._instance.config.addTracingHeaders)&&void 0!==t?t:this._instance.config.__add_tracing_headers}gv(){var t=this.mv();return X(t)?(X(this.pv)?this.pv.splice(0,this.pv.length,...t):this.pv=[...t],t.length>0?this.pv:void 0):(X(this.pv)&&this.pv.splice(0),this.pv=t||void 0,this.pv)}Od(){var t,i;null==(t=this.vv)||t.call(this),null==(i=this.fv)||i.call(this),this.vv=void 0,this.fv=void 0}startIfEnabledOrStop(){this.gv()?this._s(this.Id):this.Od()}}},Ah=g({surveys:class extends Ql{constructor(t){var i;super(new rh(t),{get projectToken(){return i.config.token},kv:new eh(i=t)}),this._instance=t}Nl(t,i){var e=i.query?da(t,i.query):t;return new Promise((t=>{var r;this._instance._send_request({method:i.method,url:this._instance.requestRouter.endpointFor(null!==(r=i.target)&&void 0!==r?r:"api",e),data:i.body,headers:i.headers,timeout:i.timeoutMs,fireCallbackOnDrop:!0,transport:i.transport,compression:i.compression,timestampMode:i.sentAt,callback:t})}))}}},Ph),Oh={toolbar:class{constructor(t){this.instance=t}yv(t){v.ph_toolbar_state=t}bv(){var t;return null!==(t=v.ph_toolbar_state)&&void 0!==t?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(i,e,s){if(void 0===i&&(i=void 0),void 0===e&&(e=void 0),void 0===s&&(s=void 0),hs(this.instance.config))return!1;if(!t||!r)return!1;i=null!=i?i:t.location,s=null!=s?s:t.history;try{if(!e){try{t.localStorage.setItem("test","test"),t.localStorage.removeItem("test")}catch(t){return!1}e=null==t?void 0:t.localStorage}var n,o=sh||Vn(i.hash,"__posthog")||Vn(i.hash,"state"),a=o?rs((()=>JSON.parse(atob(decodeURIComponent(o)))))||rs((()=>JSON.parse(decodeURIComponent(o)))):null;return a&&"ph_authorize"===a.action?((n=a).source="url",n&&Object.keys(n).length>0&&(a.desiredHash?i.hash=a.desiredHash:s?s.replaceState(s.state,"",i.pathname+i.search):i.hash="")):((n=JSON.parse(e.getItem(nh)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(t){return!1}}_v(t){var i=v.ph_load_toolbar||v.ph_load_editor;!ot(i)&&Z(i)?i(t,this.instance):oh.warn("No toolbar load function found")}loadToolbar(i){var e=!(null==r||!r.getElementById(Ns));if(!t||e)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,n=g({token:this.instance.config.token},i,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});if(t.localStorage.setItem(nh,JSON.stringify(g({},n,{source:void 0}))),2===this.bv())this._v(n);else if(0===this.bv()){var o;this.yv(1),null==(o=v.__PosthogExtensions__)||null==o.loadExternalDependency||o.loadExternalDependency(this.instance,"toolbar",(t=>{if(t)return oh.error("[Toolbar] Failed to load",t),void this.yv(0);this.yv(2),this._v(n)})),ls(t,"turbolinks:load",(()=>{this.yv(0),this.loadToolbar(n)}))}return!0}wv(t){return this.loadToolbar(t)}maybeLoadEditor(t,i,e){return void 0===t&&(t=void 0),void 0===i&&(i=void 0),void 0===e&&(e=void 0),this.maybeLoadToolbar(t,i,e)}}},Dh=g({experiments:bh},Ph),jh={conversations:class{constructor(t){this.Sv=void 0,this._conversationsManager=null,this.xv=!1,this.Me=null,this.Cv=!1,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations&&(this.Tv=t.ok,t.ok)){var i=t.config.conversations;ot(i)||(ht(i)?this.Sv=i:(this.Sv=i.enabled,this.Me=i),this.loadIfEnabled())}}reset(){var t;null==(t=this._conversationsManager)||t.reset(),this._conversationsManager=null,this.Sv=void 0,this.Me=null,this.Tv=void 0,this.Cv=!1}loadIfEnabled(){if(!(this._conversationsManager||this.xv||this._instance.config.disable_conversations||hs(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=null==v?void 0:v.__PosthogExtensions__;if(t&&!et(this.Sv)&&this.Sv)if(this.Me&&this.Me.token){this.xv=!0;try{var i=t.initConversations;if(i)return this.Mv(i),void(this.xv=!1);var e=t.loadExternalDependency;if(!e)return void this.Ev(zr);e(this._instance,"conversations",(i=>{i||!t.initConversations?this.Ev("Could not load conversations script",i):this.Mv(t.initConversations),this.xv=!1}))}catch(t){this.Ev("Error initializing conversations",t),this.xv=!1}}else wh.error("Conversations enabled but missing token in remote config.")}}Mv(t){if(this.Me)try{this._conversationsManager=t(this.Me,this._instance),this.Cv=!1,wh.info("Conversations loaded successfully")}catch(t){this.Ev("Error completing conversations initialization",t)}else wh.error("Cannot complete initialization: remote config is null")}Ev(t,i){wh.error(t,i),this._conversationsManager=null,this.xv=!1,this.Cv=!0}show(){this._conversationsManager?this._conversationsManager.show():wh.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.Sv&&!nt(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":hs(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":!1===this.Tv?"remote_config_failed":et(this.Sv)?this.Tv?"disabled_in_project":"remote_config_pending":this.Sv?ot(this.Me)||!this.Me.token?"missing_token":null!=v&&v.__PosthogExtensions__?this.xv?"initializing":this.Cv?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.isVisible())&&void 0!==t&&t}sendMessage(t,i,e){var r=this;return p((function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,i,e):(wh.warn(xh),null)}))()}getMessages(t,i){var e=this;return p((function*(){return e._conversationsManager?e._conversationsManager.getMessages(t,i):(wh.warn(xh),null)}))()}markAsRead(t){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.markAsRead(t):(wh.warn(xh),null)}))()}getTickets(t){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.getTickets(t):(wh.warn(xh),null)}))()}requestRestoreLink(t){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.requestRestoreLink(t):(wh.warn(xh),null)}))()}restoreFromToken(t){var i=this;return p((function*(){return i._conversationsManager?i._conversationsManager.restoreFromToken(t):(wh.warn(xh),null)}))()}restoreFromUrlToken(){var t=this;return p((function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(wh.warn(xh),null)}))()}getCurrentTicketId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getCurrentTicketId())&&void 0!==t?t:null}getWidgetSessionId(){var t,i;return null!==(t=null==(i=this._conversationsManager)?void 0:i.getWidgetSessionId())&&void 0!==t?t:null}Sl(){var t;null==(t=this._conversationsManager)||t.setIdentity()}xl(){var t;null==(t=this._conversationsManager)||t.clearIdentity()}}},Lh={logs:class{constructor(i){var e,r=this;this.Iv=!1,this.Rv=!1,this.I=Ie("[logs]"),this.Pv=g({},this.I,{error(){for(var t=arguments.length,i=new Array(t),e=0;t>e;e++)i[e]=arguments[e];i.some($h)||r.I.error(...i)}}),this.ka=[],this.Av=[],this.ph=0,this.Fv=()=>{var t,i;this.ph=0,null==(t=this.Lv)||t.onReconnect(),null==(i=this.Ov)||i.onReconnect()},this._instance=i,this._instance&&null!=(e=this._instance.config.logs)&&e.captureConsoleLogs&&(this.Iv=!0),t&&ls(t,"online",this.Fv)}Dv(t,i,e,r){var s,n=function(t,i){var e,r,s,n,o,a,l,h=null!==(e=null==t?void 0:t.flushIntervalMs)&&void 0!==e?e:3e3,u=null!==(r=null==t?void 0:t.maxBufferSize)&&void 0!==r?r:100,d=null!=i&&i.consoleCapture?void 0:null!==(s=null==t?void 0:t.maxLogsPerInterval)&&void 0!==s?s:1e3,v=et(d)?Math.max(u,2048):Math.max(u,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==i?void 0:i.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:h,maxBufferSize:u,maxQueueSize:v,maxBatchRecordsPerPost:100,rateCapWindowMs:h,maxLogsPerInterval:d,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}(null==(s=this._instance)||null==(s=s.config)?void 0:s.logs,e);return[new Vi(this.$v(t,i),n,this.Pv,(()=>this.Nv()),(t=>t()),void 0,r),n]}qv(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Lv||this.jv!==i){var e;null==(e=this.Lv)||e.reset(),this.jv=i;var r=this.Dv((()=>this.ka),(t=>{this.ka=t}));this.Lv=r[0],this.Bv=r[1]}return this.Lv}Hv(){var t,i=null==(t=this._instance)||null==(t=t.config)?void 0:t.logs;if(!this.Ov||this.Uv!==i){var e;null==(e=this.Ov)||e.reset(),this.Uv=i;var r=this.Dv((()=>this.Av),(t=>{this.Av=t}),{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Sh);this.Ov=r[0],this.zv=r[1]}return this.Ov}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var i;if(t.ok){var e=null==(i=t.config.logs)?void 0:i.captureConsoleLogs;!ot(e)&&e&&(this.Iv=!0,this.loadIfEnabled())}}reset(){var t,i;this.ka=[],null==(t=this.Lv)||t.reset(),this.Av=[],null==(i=this.Ov)||i.reset(),this.ph=0}captureLog(t){this.qv().captureLog(t)}vi(t){this.Hv().captureLog(t)}get logger(){return this.Wv||(this.Wv={trace:(t,i)=>this.captureLog({body:t,level:"trace",attributes:i}),debug:(t,i)=>this.captureLog({body:t,level:"debug",attributes:i}),info:(t,i)=>this.captureLog({body:t,level:"info",attributes:i}),warn:(t,i)=>this.captureLog({body:t,level:"warn",attributes:i}),error:(t,i)=>this.captureLog({body:t,level:"error",attributes:i}),fatal:(t,i)=>this.captureLog({body:t,level:"fatal",attributes:i})}),this.Wv}flushLogs(t){t?this.Vv(t):(this.Lv&&this.Lv.flush().catch((t=>this.Gv(t))),this.Ov&&this.Ov.flush().catch((t=>this.Gv(t))))}Gv(t){$h(t)||this.I.error("PostHog logs flush failed:",t)}loadIfEnabled(){if(this.Iv&&!this.Rv){var t=null==v?void 0:v.__PosthogExtensions__;if(t){var i=t.loadExternalDependency;i?i(this._instance,"logs",(i=>{var e;i||null==(e=t.logs)||!e.initializeLogs?this.I.error("Could not load logs script",i):(t.logs.initializeLogs(this._instance),this.Rv=!0)})):this.I.error(zr)}else this.I.error("PostHog Extensions not found.")}}$v(t,i){var e=this._instance;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},getPersistedProperty:i=>i===S.LogsQueue?t():void 0,setPersistedProperty(t,e){var r;t===S.LogsQueue&&i(null!==(r=e)&&void 0!==r?r:[])},Mn:t=>this.Mn(t),getLibraryId:()=>c.LIB_NAME,getLibraryVersion:()=>c.LIB_VERSION}}Mn(t){return new Promise((i=>{if(Wn(this.ph,3))i({kind:"fatal",error:Eh(void 0,"logs endpoint is unreachable, dropping batch")});else{var e=!1,r=t=>{e||(e=!0,clearTimeout(s),i(t))},s=setTimeout((()=>{this.I.warn("Logs request timed out before receiving a response"),r({kind:"retry-later",error:Eh(void 0,"logs request timed out")})}),9e4);this._instance._send_request({method:"POST",url:this.Zv(),data:t,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:t=>{var i=t.statusCode;if(this.Qv(i),i>=200&&300>i)r({kind:"ok"});else if(413===i)r({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)r({kind:"fatal",error:new Error("logs request failed with status "+i)});else{var e;0===i?(t.error||this.I.warn("Logs request failed before receiving an HTTP response"),r({kind:"retry-later",error:Eh(t.error,"logs request failed before receiving an HTTP response")})):r({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("logs request failed with status "+i)})}}})}}))}Qv(t){(0!==t||this._instance.__loaded)&&(this.ph=Gn(t,this.ph,3,(()=>this.I.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes."))))}Vv(t){this.ka.length>0&&this.Jv(t,this.ka,this.Bv,c.LIB_NAME,(t=>{this.ka=t})),this.Av.length>0&&this.Jv(t,this.Av,this.zv,Sh,(t=>{this.Av=t}))}Jv(t,i,e,r,s){if(0!==i.length){var n=i.map((t=>t.record));s([]);var o=Hi(n,qi(e,c.LIB_NAME,c.LIB_VERSION),r,c.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Zv(),data:o,compression:"best-available",batchKey:"logs",transport:t})}}Zv(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}Nv(){var t,i={};if(i.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var e=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),r=e.windowId,s=e.sessionStartTimestamp,n=e.lastActivityTimestamp;i.sessionId=e.sessionId,i.windowId=r,ot(s)||(i.sessionStartTimestamp=s),ot(n)||(i.lastActivityTimestamp=n)}if(null!=v&&null!=(t=v.location)&&t.href&&(i.currentUrl=this._instance.config.disable_capture_url_hashes?Ci(v.location.href):v.location.href),this._instance.featureFlags){var o=this._instance.featureFlags.getFlags();o&&o.length>0&&(i.activeFeatureFlags=o)}return i}}},Nh={metrics:class{constructor(t){this.I=Ie("[metrics]"),this._instance=t}initialize(){}qv(){var t,i,e=null==(t=this._instance)||null==(t=t.config)?void 0:t.metrics;return this.Lv&&this.jv===e||(null==(i=this.Lv)||i.reset(),this.jv=e,this.Lv=new Ji(this.$v(),function(t){var i,e,r,s,n,o=null==t?void 0:t.resourceAttributes;return{serviceName:null!==(i=null==o?void 0:o["service.name"])&&void 0!==i?i:null==t?void 0:t.serviceName,serviceVersion:null!==(e=null==o?void 0:o["service.version"])&&void 0!==e?e:null==t?void 0:t.serviceVersion,environment:null!==(r=null==o?void 0:o["deployment.environment"])&&void 0!==r?r:null==t?void 0:t.environment,resourceAttributes:o,beforeSend:null==t?void 0:t.beforeSend,flushIntervalMs:null!==(s=null==t?void 0:t.flushIntervalMs)&&void 0!==s?s:1e4,maxSeriesPerFlush:null!==(n=null==t?void 0:t.maxSeriesPerFlush)&&void 0!==n?n:1e3}}(e),this.I)),this.Lv}count(t,i,e){void 0===i&&(i=1),this.qv().count(t,i,e)}gauge(t,i,e){this.qv().gauge(t,i,e)}histogram(t,i,e){this.qv().histogram(t,i,e)}flush(t){if(!this.Lv)return Promise.resolve();if(t){var i=this.Lv.drainWindow();return i&&this.Un(i,t),Promise.resolve()}return this.Lv.flush().catch((t=>this.I.error("PostHog metrics flush failed:",t)))}reset(){var t;null==(t=this.Lv)||t.reset()}$v(){var t=this._instance,i=this;return{get isDisabled(){return!1},get optedOut(){return!t.is_capturing()},Un:t=>i.Un(t),getLibraryId:()=>c.LIB_NAME,getLibraryVersion:()=>c.LIB_VERSION}}Un(t,i){return new Promise((e=>{var r=!1,s=t=>{r||(r=!0,clearTimeout(n),e(t))},n=setTimeout((()=>s({kind:"retry-later",error:new Error("metrics request timed out")})),9e4);this._instance._send_request(g({method:"POST",url:this.Kv(),data:t,compression:"best-available",batchKey:"metrics"},i&&{transport:i},{fireCallbackOnDrop:!0,callback(t){var i=t.statusCode;if(i>=200&&300>i)s({kind:"ok"});else if(413===i)s({kind:"too-large"});else if(0!==i&&408!==i&&429!==i&&500>i)s({kind:"fatal",error:new Error("metrics request failed with status "+i)});else{var e;s({kind:"retry-later",error:null!==(e=t.error)&&void 0!==e?e:new Error("metrics request failed with status "+i)})}}}))}))}Kv(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}},Bh=g({},Ph,Th,Ch,Fh,Rh,Ih,Ah,Mh,Oh,Dh,jh,Lh,Nh);ml.__defaultExtensionClasses=g({},Bh),function(){c.SDK_DIST_CHANNEL="cdn";var i=v.posthog;if(!i||X(i._i)){var e=sl[vl]=new ml;if(i){var s=[];ts(i._i,(function(t){if(t&&X(t)){var r=e.init(t[0],t[1],t[2]),n=i[t[2]]||i;r.__loaded&&-1===s.indexOf(n)&&(s.push(n),r._execute_array.call(r.people,n.people),r._execute_array(n))}}))}e.__SV=1,v.posthog=e,function(){function i(){i.done||(i.done=!0,cl=!1,ts(sl,(function(t){t._dom_loaded()})))}null!=r&&r.addEventListener?"complete"===r.readyState?i():ls(r,"DOMContentLoaded",i,{capture:!1}):t&&Re.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}()}}()}();
2
2
  //# sourceMappingURL=array.js.map